573 lines
16 KiB
ObjectPascal
573 lines
16 KiB
ObjectPascal
unit U_YFCRLZ;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxGraphics, cxCustomData, cxStyles, cxTL, cxMaskEdit, DB, ADODB,
|
||
cxInplaceContainer, cxDBTL, cxControls, cxTLData, ComCtrls, ToolWin,
|
||
StdCtrls, cxFilter, cxData, cxDataStorage, cxEdit, cxDBData, DBClient,
|
||
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, ExtCtrls,
|
||
cxSplitter, cxGridLevel, cxClasses, cxGridCustomView, cxGrid,
|
||
cxGridCustomPopupMenu, cxGridPopupMenu, RM_Dataset, RM_System, RM_Common,
|
||
RM_Class, RM_GridReport, IdBaseComponent, IdComponent, IdTCPConnection,
|
||
IdTCPClient, IdFTP,ShellAPI,IniFiles, cxCheckBox, cxCalendar,
|
||
cxButtonEdit, cxTextEdit, cxDropDownEdit;
|
||
|
||
type
|
||
TfrmYFCRLZ = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBRafresh: TToolButton;
|
||
TBDel: TToolButton;
|
||
TBClose: TToolButton;
|
||
ADOQueryTemp: TADOQuery;
|
||
ADOQueryCmd: TADOQuery;
|
||
Panel1: TPanel;
|
||
ToolButton2: TToolButton;
|
||
Label1: TLabel;
|
||
YFName: TEdit;
|
||
ADOQueryMain: TADOQuery;
|
||
ToolButton1: TToolButton;
|
||
RM1: TRMGridReport;
|
||
RMDB_Main: TRMDBDataSet;
|
||
Label3: TLabel;
|
||
FactoryName: TEdit;
|
||
cxGrid2: TcxGrid;
|
||
Tv2: TcxGridDBTableView;
|
||
VDate: TcxGridDBColumn;
|
||
VYFName: TcxGridDBColumn;
|
||
VQty: TcxGridDBColumn;
|
||
VQtyUnit: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
Label2: TLabel;
|
||
Label6: TLabel;
|
||
begdate: TDateTimePicker;
|
||
Enddate: TDateTimePicker;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
DS_HZ: TDataSource;
|
||
CDS_HZ: TClientDataSet;
|
||
ToolButton3: TToolButton;
|
||
VPrice: TcxGridDBColumn;
|
||
VYB: TcxGridDBColumn;
|
||
VFTYName: TcxGridDBColumn;
|
||
VOrderNo: TcxGridDBColumn;
|
||
VNote: TcxGridDBColumn;
|
||
Label4: TLabel;
|
||
OrderNo: TEdit;
|
||
ToolButton5: TToolButton;
|
||
VPS: TcxGridDBColumn;
|
||
v2Column1: TcxGridDBColumn;
|
||
v2SSel: TcxGridDBColumn;
|
||
Label5: TLabel;
|
||
CPName: TEdit;
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure TBDelClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBRafreshClick(Sender: TObject);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure FactoryNameChange(Sender: TObject);
|
||
procedure cxGridDBColumn5PropertiesEditValueChanged(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure cxGridDBColumn3PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure cxGridDBColumn6PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure OrderNoChange(Sender: TObject);
|
||
procedure OrderNoKeyPress(Sender: TObject; var Key: Char);
|
||
procedure ToolButton5Click(Sender: TObject);
|
||
procedure Tv2MouseDown(Sender: TObject; Button: TMouseButton;
|
||
Shift: TShiftState; X, Y: Integer);
|
||
procedure VHZFTYNamePropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure PriceChange(Sender: TObject);
|
||
private
|
||
{ Private declarations }
|
||
procedure InitGrid();
|
||
public
|
||
{ Public declarations }
|
||
|
||
end;
|
||
|
||
var
|
||
frmYFCRLZ: TfrmYFCRLZ;
|
||
|
||
implementation
|
||
uses
|
||
U_DataLink,U_RTFun,U_ZDYHelp,U_GYSSelList;
|
||
|
||
{$R *.dfm}
|
||
|
||
|
||
|
||
procedure TfrmYFCRLZ.InitGrid();
|
||
begin
|
||
begdate.SetFocus;
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select * from YF_Money_CR where CRTime>=:begdate and CRTime<:Enddate ');
|
||
sql.Add(' and isnull(CRType,'''')=''Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>'' ');
|
||
Parameters.ParamByName('begdate').Value:=Trim(FormatDateTime('yyyy-MM-dd',begdate.DateTime));
|
||
Parameters.ParamByName('Enddate').Value:=Trim(FormatDateTime('yyyy-MM-dd',Enddate.DateTime+1));
|
||
if Trim(FactoryName.Text)<>'' then
|
||
begin
|
||
SQL.Add(' and isnull(FactoryName,'''') like '''+'%'+Trim(FactoryName.Text)+'%'+'''');
|
||
end;
|
||
if Trim(YFName.Text)<>'' then
|
||
begin
|
||
SQL.Add(' and isnull(YFName,'''') like '''+'%'+Trim(YFName.Text)+'%'+'''');
|
||
end;
|
||
if Trim(OrderNo.Text)<>'' then
|
||
begin
|
||
SQL.Add(' and isnull(OrderNo,'''') like '''+'%'+Trim(OrderNo.Text)+'%'+'''');
|
||
end;
|
||
if Trim(CPName.Text)<>'' then
|
||
begin
|
||
SQL.Add(' and isnull(CPName,'''') like '''+'%'+Trim(CPName.Text)+'%'+'''');
|
||
end;
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain,CDS_HZ);
|
||
SInitCDSData20(ADOQueryMain,CDS_HZ);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYFCRLZ.FormDestroy(Sender: TObject);
|
||
begin
|
||
frmYFCRLZ:=nil;
|
||
end;
|
||
|
||
procedure TfrmYFCRLZ.FormClose(Sender: TObject; var Action: TCloseAction);
|
||
begin
|
||
Action:=caFree;
|
||
end;
|
||
|
||
procedure TfrmYFCRLZ.TBCloseClick(Sender: TObject);
|
||
begin
|
||
WriteCxGrid('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>',Tv2,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
Close;
|
||
end;
|
||
procedure TfrmYFCRLZ.TBDelClick(Sender: TObject);
|
||
var
|
||
FBBMoney,CRID:string;
|
||
begin
|
||
if CDS_HZ.IsEmpty then Exit;
|
||
if CDS_HZ.Locate('SSel',True,[])=False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
CDS_HZ.DisableControls;
|
||
with CDS_HZ do
|
||
begin
|
||
First;
|
||
while Locate('SSel',True,[]) do
|
||
begin
|
||
if Trim(CDS_HZ.fieldbyname('YFID').AsString)<>'' then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('delete YF_Money_CR where YFID='''+Trim(CDS_HZ.fieldbyname('YFID').AsString)+'''');
|
||
sql.Add('UPdate YF_Money_KC Set KCMoney=(select isnull(Sum(Money*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
||
sql.Add(',KCBBMoney=(select isnull(Sum(BBMoney*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
||
sql.Add(' where CRID='+CDS_HZ.Fieldbyname('CRID').AsString);
|
||
ExecSQL;
|
||
end;
|
||
CRID:=Trim(CDS_HZ.fieldbyname('CRID').AsString);
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from YF_Money_CR where CRID='+CRID);
|
||
Open;
|
||
end;
|
||
if ADOQueryTemp.IsEmpty then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('delete YF_Money_KC where CRID='+CRID);
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
end;
|
||
CDS_HZ.Delete;
|
||
end;
|
||
end;
|
||
CDS_HZ.EnableControls;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
Application.MessageBox('ɾ<><C9BE><EFBFBD>ɹ<EFBFBD>!','<27><>ʾ',0);
|
||
except
|
||
CDS_HZ.EnableConstraints;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ɾ<><C9BE><EFBFBD>쳣!','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYFCRLZ.FormShow(Sender: TObject);
|
||
var
|
||
fsj:String;
|
||
begin
|
||
ReadCxGrid('Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>',Tv2,'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>');
|
||
Enddate.DateTime:=SGetServerDate(ADOQueryTemp);
|
||
begdate.DateTime:=Enddate.DateTime-30;
|
||
end;
|
||
|
||
procedure TfrmYFCRLZ.TBRafreshClick(Sender: TObject);
|
||
begin
|
||
InitGrid();
|
||
end;
|
||
|
||
procedure TfrmYFCRLZ.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
||
SCreateCDS20(ADOQueryMain,CDS_HZ);
|
||
SInitCDSData20(ADOQueryMain,CDS_HZ);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYFCRLZ.FactoryNameChange(Sender: TObject);
|
||
begin
|
||
ToolButton2.Click;
|
||
end;
|
||
|
||
procedure TfrmYFCRLZ.cxGridDBColumn5PropertiesEditValueChanged(
|
||
Sender: TObject);
|
||
var
|
||
mvalue,FQty,FPrice,FMoney,FBBMoney,FFieldName:String;
|
||
begin
|
||
mvalue:=TcxTextEdit(Sender).EditingText;
|
||
if Trim(mvalue)='' then
|
||
begin
|
||
mvalue:='0';
|
||
end;
|
||
FFieldName:=Trim(Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName);
|
||
with CDS_HZ do
|
||
begin
|
||
Edit;
|
||
FieldByName(FFieldName).Value:=Trim(mvalue);
|
||
//Post;
|
||
end;
|
||
FQty:=Trim(CDS_HZ.fieldbyname('Qty').AsString);
|
||
if Trim(FQty)='' then FQty:='0';
|
||
FPrice:=Trim(CDS_HZ.fieldbyname('Price').AsString);
|
||
if Trim(FPrice)='' then FPrice:='0';
|
||
FMoney:=FloatToStr(StrToFloat(FQty)*StrToFloat(FPrice));
|
||
with CDS_HZ do
|
||
begin
|
||
Edit;
|
||
FieldByName('Money').Value:=StrToFloat(FMoney);
|
||
FieldByName('BBMoney').Value:=StrToFloat(FMoney);
|
||
Post;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYFCRLZ.ToolButton3Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmGYSSelList:=TfrmGYSSelList.Create(Application);
|
||
with frmGYSSelList do
|
||
begin
|
||
if ShowModal=1 then
|
||
begin
|
||
with Self.CDS_HZ do
|
||
begin
|
||
Append;
|
||
FieldByName('FactoryNo').Value:=Trim(Order_Main.fieldbyname('ZKID').AsString);
|
||
FieldByName('FactoryName').Value:=Trim(Order_Main.fieldbyname('KHName').AsString);
|
||
FieldByName('CRTime').Value:=Now;
|
||
Post;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmGYSSelList.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYFCRLZ.cxGridDBColumn3PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='YFName';
|
||
flagname:='<27><>Ŀ<EFBFBD><C4BF>ժҪ';
|
||
if ShowModal=1 then
|
||
begin
|
||
with Self.CDS_HZ do
|
||
begin
|
||
Edit;
|
||
FieldByName('YFCode').Value:=Trim(ClientDataSet1.fieldbyname('ZdyNo').AsString);
|
||
FieldByName('YFName').Value:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYFCRLZ.cxGridDBColumn6PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='OrderUnit';
|
||
flagname:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ';
|
||
if ShowModal=1 then
|
||
begin
|
||
Self.CDS_HZ.Edit;
|
||
Self.CDS_HZ.FieldByName('QtyUnit').Value:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYFCRLZ.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
if CDS_HZ.IsEmpty then Exit;
|
||
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>',cxGrid2);
|
||
|
||
end;
|
||
|
||
procedure TfrmYFCRLZ.OrderNoChange(Sender: TObject);
|
||
begin
|
||
if Length(Trim(OrderNo.Text))<3 then Exit;
|
||
ToolButton2.Click;
|
||
end;
|
||
|
||
procedure TfrmYFCRLZ.OrderNoKeyPress(Sender: TObject; var Key: Char);
|
||
begin
|
||
if Key=#13 then
|
||
begin
|
||
if Length(OrderNo.Text)<3 then Exit;
|
||
begdate.SetFocus;
|
||
try
|
||
ADOQueryMain.DisableControls;
|
||
with ADOQueryMain do
|
||
begin
|
||
Filtered:=False;
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select * from YF_Money_CR where OrderNo like :OrderNo ');
|
||
sql.Add(' and isnull(CRType,'''')=''Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>'' ');
|
||
Parameters.ParamByName('orderno').Value:='%'+Trim(OrderNo.Text)+'%';
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQueryMain,CDS_HZ);
|
||
SInitCDSData20(ADOQueryMain,CDS_HZ);
|
||
finally
|
||
ADOQueryMain.EnableControls;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYFCRLZ.ToolButton5Click(Sender: TObject);
|
||
var
|
||
CRID,maxId,FYFID:String;
|
||
begin
|
||
if CDS_HZ.IsEmpty then Exit;
|
||
if CDS_HZ.Locate('SSel',True,[])=False then
|
||
begin
|
||
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
ToolBar1.SetFocus;
|
||
try
|
||
ADOQueryCmd.Connection.BeginTrans;
|
||
CDS_HZ.DisableControls;
|
||
with CDS_HZ do
|
||
begin
|
||
First;
|
||
while Locate('SSel',True,[]) do
|
||
begin
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from YF_Money_CR where YFID='''+Trim(CDS_HZ.fieldbyname('YFID').AsString)+'''');
|
||
Open;
|
||
end;
|
||
FYFID:=Trim(ADOQueryTemp.fieldbyname('YFID').AsString);
|
||
if Trim(FYFID)='' then
|
||
begin
|
||
if GetLSNo(ADOQueryCmd,maxId,'YF','YF_Money_CR',4,1)=False then
|
||
begin
|
||
CDS_HZ.EnableControls;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡӦ<C8A1><D3A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end else
|
||
begin
|
||
maxId:=Trim(FYFID);
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from YF_Money_KC where FactoryNo='''+Trim(CDS_HZ.fieldbyname('FactoryNo').AsString)+'''');
|
||
Open;
|
||
end;
|
||
if ADOQueryCmd.IsEmpty=False then
|
||
begin
|
||
CRID:=ADOQueryCmd.fieldbyname('CRID').AsString;
|
||
end else
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('Update YF_Money_CRID set CRID=CRID+1');
|
||
sql.Add('select * from YF_Money_CRID ');
|
||
Open;
|
||
end;
|
||
CRID:=ADOQueryCmd.fieldbyname('CRID').AsString;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from YF_Money_KC where 1<>1');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Append;
|
||
FieldByName('CRID').Value:=StrToInt(CRID);
|
||
FieldByName('FactoryNo').Value:=Trim(CDS_HZ.fieldbyname('FactoryNo').AsString);
|
||
FieldByName('FactoryName').Value:=Trim(CDS_HZ.fieldbyname('FactoryName').AsString);
|
||
FieldByName('ZdyStr1').Value:='Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
||
Post;
|
||
end;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from YF_Money_CR where YFID='''+Trim(maxId)+'''');
|
||
Open;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
if Trim(FYFID)='' then
|
||
begin
|
||
Append;
|
||
FieldByName('Filler').Value:=Trim(DName);
|
||
end else
|
||
begin
|
||
Edit;
|
||
FieldByName('Editer').Value:=Trim(DName);
|
||
end;
|
||
FieldByName('YFID').Value:=Trim(maxId);
|
||
FieldByName('CRID').Value:=StrToInt(CRID);
|
||
RTSetSaveDataCDS(ADOQueryCmd,Tv2,CDS_HZ,'YF_Money_CR',3);
|
||
FieldByName('YFType').Value:='<27>ֹ<EFBFBD>¼<EFBFBD><C2BC>';
|
||
FieldByName('CRType').Value:='Ӧ<><D3A6><EFBFBD><EFBFBD><EFBFBD>Ǽ<EFBFBD>';
|
||
FieldByName('CRFlag').Value:='Ӧ<><D3A6><EFBFBD><EFBFBD>';
|
||
FieldByName('QtyFlag').Value:=1;
|
||
FieldByName('HuiLv').Value:=1;
|
||
FieldByName('BZType').Value:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
|
||
FieldByName('FactoryNo').Value:=Trim(CDS_HZ.fieldbyname('FactoryNo').AsString);
|
||
FieldByName('BBMoney').Value:=CDS_HZ.fieldbyname('Money').Value;
|
||
Post;
|
||
end;
|
||
with CDS_HZ do
|
||
begin
|
||
Edit;
|
||
FieldByName('YFId').Value:=Trim(maxId);
|
||
FieldByName('CRID').Value:=StrToInt(CRID);
|
||
FieldByName('SSel').Value:=False;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('UPdate YF_Money_KC Set KCMoney=(select isnull(Sum(Money*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
||
sql.Add(',KCBBMoney=(select isnull(Sum(BBMoney*QtyFlag),0) from YF_Money_CR A where A.CRID=YF_Money_KC.CRID)');
|
||
sql.Add(' where CRID='+CDS_HZ.Fieldbyname('CRID').AsString);
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
end;
|
||
CDS_HZ.EnableControls;
|
||
ADOQueryCmd.Connection.CommitTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>!','<27><>ʾ',0);
|
||
except
|
||
CDS_HZ.EnableControls;
|
||
ADOQueryCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>쳣!','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYFCRLZ.Tv2MouseDown(Sender: TObject; Button: TMouseButton;
|
||
Shift: TShiftState; X, Y: Integer);
|
||
begin
|
||
if CDS_HZ.IsEmpty then Exit;
|
||
If Trim(CDS_HZ.fieldbyname('YFType').AsString)='<27>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>' then
|
||
begin
|
||
TV2.OptionsSelection.CellSelect:=False;
|
||
end else
|
||
begin
|
||
TV2.OptionsSelection.CellSelect:=True;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYFCRLZ.VHZFTYNamePropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmGYSSelList:=TfrmGYSSelList.Create(Application);
|
||
with frmGYSSelList do
|
||
begin
|
||
if ShowModal=1 then
|
||
begin
|
||
with Self.CDS_HZ do
|
||
begin
|
||
Edit;
|
||
FieldByName('HZFactoryNo').Value:=Trim(Order_Main.fieldbyname('ZKID').AsString);
|
||
FieldByName('HZFactoryName').Value:=Trim(Order_Main.fieldbyname('KHNameJC').AsString);
|
||
//Post;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmGYSSelList.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmYFCRLZ.PriceChange(Sender: TObject);
|
||
begin
|
||
if ADOQueryMain.Active then
|
||
begin
|
||
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
||
SCreateCDS20(ADOQueryMain,CDS_HZ);
|
||
SInitCDSData20(ADOQueryMain,CDS_HZ);
|
||
end;
|
||
end;
|
||
|
||
end.
|