776 lines
22 KiB
ObjectPascal
776 lines
22 KiB
ObjectPascal
unit U_NBFPInPutWGLBCOrderNo;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
||
cxDataStorage, cxEdit, DB, cxDBData, cxGridLevel, cxGridCustomTableView,
|
||
cxGridTableView, cxGridDBTableView, cxClasses, cxControls,
|
||
cxGridCustomView, cxGrid, cxMemo, cxRichEdit, ComCtrls, cxContainer,
|
||
cxTextEdit, cxMaskEdit, cxButtonEdit, StdCtrls, ToolWin, DBClient, ADODB,
|
||
ExtCtrls, BtnEdit, cxDropDownEdit, cxCalendar, cxGridCustomPopupMenu,
|
||
cxGridPopupMenu, cxSplitter;
|
||
|
||
type
|
||
TfrmNBFPInPutWGLBCOrderNo = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TBSave: TToolButton;
|
||
TBClose: TToolButton;
|
||
ADOTemp: TADOQuery;
|
||
ADOCmd: TADOQuery;
|
||
DataSource1: TDataSource;
|
||
Order_Sub: TClientDataSet;
|
||
ADOZDY: TADOQuery;
|
||
ADOQuery1: TADOQuery;
|
||
cxGridPopupMenu1: TcxGridPopupMenu;
|
||
ClientDataSet2: TClientDataSet;
|
||
cxGrid1: TcxGrid;
|
||
Tv1: TcxGridDBTableView;
|
||
v1Column9: TcxGridDBColumn;
|
||
v1Column10: TcxGridDBColumn;
|
||
v1Column20: TcxGridDBColumn;
|
||
v1Column5: TcxGridDBColumn;
|
||
v1Column18: TcxGridDBColumn;
|
||
v1Column1: TcxGridDBColumn;
|
||
v1Column3: TcxGridDBColumn;
|
||
v1Column2: TcxGridDBColumn;
|
||
v1Column12: TcxGridDBColumn;
|
||
cxGrid1Level1: TcxGridLevel;
|
||
Panel1: TPanel;
|
||
Panel2: TPanel;
|
||
DataSource2: TDataSource;
|
||
cxGridPopupMenu2: TcxGridPopupMenu;
|
||
cxGrid2: TcxGrid;
|
||
Tv2: TcxGridDBTableView;
|
||
cxGridDBColumn2: TcxGridDBColumn;
|
||
cxGridDBColumn3: TcxGridDBColumn;
|
||
cxGridDBColumn4: TcxGridDBColumn;
|
||
v1Column4: TcxGridDBColumn;
|
||
cxGridDBColumn5: TcxGridDBColumn;
|
||
cxGridDBColumn6: TcxGridDBColumn;
|
||
cxGridDBColumn7: TcxGridDBColumn;
|
||
cxGridDBColumn8: TcxGridDBColumn;
|
||
cxGridDBColumn9: TcxGridDBColumn;
|
||
cxGridDBColumn10: TcxGridDBColumn;
|
||
cxGridDBColumn11: TcxGridDBColumn;
|
||
cxGridLevel1: TcxGridLevel;
|
||
ToolBar2: TToolBar;
|
||
ToolButton2: TToolButton;
|
||
ToolButton5: TToolButton;
|
||
Panel3: TPanel;
|
||
ToolButton1: TToolButton;
|
||
ToolButton3: TToolButton;
|
||
Label1: TLabel;
|
||
BGOrderNo: TEdit;
|
||
v1Column6: TcxGridDBColumn;
|
||
v2Column1: TcxGridDBColumn;
|
||
v2Column2: TcxGridDBColumn;
|
||
Panel4: TPanel;
|
||
CheckBox1: TCheckBox;
|
||
procedure TBCloseClick(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure TBSaveClick(Sender: TObject);
|
||
procedure v1Column3PropertiesEditValueChanged(Sender: TObject);
|
||
procedure v1Column20PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure v1Column5PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure v1Column18PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
procedure ToolButton2Click(Sender: TObject);
|
||
procedure ToolButton5Click(Sender: TObject);
|
||
procedure ToolButton1Click(Sender: TObject);
|
||
procedure ToolButton3Click(Sender: TObject);
|
||
procedure v2Column2PropertiesEditValueChanged(Sender: TObject);
|
||
private
|
||
procedure InitData();
|
||
function SaveData():Boolean;
|
||
{ Private declarations }
|
||
public
|
||
PState,PCopyInt:Integer;
|
||
FMainId,FConNo,FConType,FYLType:String;
|
||
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
frmNBFPInPutWGLBCOrderNo: TfrmNBFPInPutWGLBCOrderNo;
|
||
|
||
implementation
|
||
uses
|
||
U_DataLink,U_ZDYHelp,U_RTFun,U_GYSFPSelList;
|
||
|
||
{$R *.dfm}
|
||
|
||
procedure TfrmNBFPInPutWGLBCOrderNo.TBCloseClick(Sender: TObject);
|
||
begin
|
||
Close;
|
||
WriteCxGrid('<27><>Ӧ<EFBFBD>̷<EFBFBD>Ʊ¼<C6B1><C2BC>',Tv1,'<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>');
|
||
WriteCxGrid('<27><>Ӧ<EFBFBD>̷<EFBFBD>Ʊ¼<C6B1><C2BC>2',Tv2,'<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>');
|
||
end;
|
||
|
||
procedure TfrmNBFPInPutWGLBCOrderNo.InitData();
|
||
begin
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from FP_BGOrderNo where FNID='''+Trim(FMainId)+'''');
|
||
Open;
|
||
end;
|
||
BGOrderNo.Text:=Trim(ADOQuery1.fieldbyname('BGOrderNo').AsString);
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
SQL.Clear;
|
||
sql.Add('select * from FP_GYSNB A');
|
||
sql.Add(' where A.FNID='''+Trim(FMainId)+'''');
|
||
sql.Add(' and isnull(FMType,'''')=''NB'' ');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQuery1,Order_Sub);
|
||
SInitCDSData20(ADOQuery1,Order_Sub);
|
||
with ADOQuery1 do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select A.*,B.HXQty,B.HXMoney,B.FHID ');
|
||
SQL.Add(' from FP_GYSNB A');
|
||
sql.Add(' inner join FP_Money_HX B on A.FMID=B.GYSFMID');
|
||
sql.Add(' where B.FNID='''+Trim(FMainId)+'''');
|
||
sql.Add(' and isnull(FMType,'''')=''GYS'' ');
|
||
Open;
|
||
end;
|
||
SCreateCDS20(ADOQuery1,ClientDataSet2);
|
||
SInitCDSData20(ADOQuery1,ClientDataSet2);
|
||
end;
|
||
|
||
|
||
|
||
procedure TfrmNBFPInPutWGLBCOrderNo.FormShow(Sender: TObject);
|
||
begin
|
||
ReadCxGrid('<27><>Ӧ<EFBFBD>̷<EFBFBD>Ʊ¼<C6B1><C2BC>',Tv1,'<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>');
|
||
ReadCxGrid('<27><>Ӧ<EFBFBD>̷<EFBFBD>Ʊ¼<C6B1><C2BC>2',Tv2,'<27><>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>');
|
||
InitData();
|
||
end;
|
||
|
||
function TfrmNBFPInPutWGLBCOrderNo.SaveData():Boolean;
|
||
var
|
||
maxno,MaxNoFN,maxNoFH,FFHID:String;
|
||
begin
|
||
try
|
||
Result:=False;
|
||
ADOCmd.Connection.BeginTrans;
|
||
//<2F><><EFBFBD>汨<EFBFBD>ض<EFBFBD><D8B6><EFBFBD><EFBFBD><EFBFBD>
|
||
if Trim(FMainId)='' then
|
||
begin
|
||
if GetLSNo(ADOCmd,MaxNoFN,'FN','FP_BGOrderNo',4,1)=False then
|
||
begin
|
||
Order_Sub.EnableControls;
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end else
|
||
begin
|
||
maxnoFN:=Trim(FMainId);
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from FP_BGOrderNo where FNID='''+Trim(FMainId)+'''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if Trim(FMainId)='' then
|
||
begin
|
||
Append;
|
||
FieldByName('Filler').Value:=Trim(DName);
|
||
end else
|
||
begin
|
||
Edit;
|
||
FieldByName('Editer').Value:=Trim(DName);
|
||
FieldByName('EditTime').Value:=SGetServerDateTime(ADOTemp);
|
||
end;
|
||
FieldByName('FNID').Value:=Trim(MaxNoFN);
|
||
FieldByName('BGOrderNo').Value:=Trim(BGOrderNo.Text);
|
||
Post;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from FP_BGOrderNo where BGOrderNo='''+Trim(BGOrderNo.Text)+'''');
|
||
Open;
|
||
end;
|
||
if ADOCmd.RecordCount>1 then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD>ض<EFBFBD><D8B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD>!','<27><>ʾ',0);
|
||
exit;
|
||
end;
|
||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>Ʊ
|
||
with Order_Sub do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
if Trim(Order_Sub.fieldbyname('FMID').AsString)='' then
|
||
begin
|
||
if GetLSNo(ADOCmd,maxno,'FM','FP_GYSNB',4,1)=False then
|
||
begin
|
||
Order_Sub.EnableControls;
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end else
|
||
begin
|
||
maxno:=Trim(Order_Sub.fieldbyname('FMID').AsString);
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from FP_GYSNB where FMID='''+Trim(Order_Sub.fieldbyname('FMID').AsString)+'''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if Trim(Order_Sub.fieldbyname('FMID').AsString)='' then
|
||
begin
|
||
Append;
|
||
end
|
||
else begin
|
||
Edit;
|
||
end;
|
||
FieldByName('FMID').Value:=Trim(maxno);
|
||
FieldByName('FNID').Value:=Trim(maxnoFN);
|
||
FieldByName('FMType').Value:='NB';
|
||
RTSetSaveDataCDS(ADOCmd,Tv1,Order_Sub,'FP_GYSNB',0) ;
|
||
if Trim(Order_Sub.fieldbyname('FMID').AsString)='' then
|
||
begin
|
||
FieldByName('Filler').Value:=Trim(DName);
|
||
end else
|
||
begin
|
||
FieldByName('Editer').Value:=Trim(DName);
|
||
FieldByName('EditTime').Value:=SGetServerDateTime(ADOTemp);
|
||
end;
|
||
Post;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from FP_GYSNB where FPNO='''+Trim(Order_Sub.fieldbyname('FPNO').AsString)+'''');
|
||
sql.Add(' and isnull(FMType,'''')=''NB'' ');
|
||
Open;
|
||
end;
|
||
if ADOCmd.RecordCount>1 then
|
||
begin
|
||
Order_Sub.EnableControls;
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Result:=False;
|
||
Application.MessageBox(PChar('<27><>Ʊ<EFBFBD><C6B1>:'+Trim(Order_Sub.fieldbyname('FPNO').AsString)+'<27>ظ<EFBFBD>!'),'',0);
|
||
Exit;
|
||
end;
|
||
Edit;
|
||
FieldByName('FMID').Value:=Trim(maxno);
|
||
Next;
|
||
end;
|
||
|
||
end;
|
||
//<2F><>Ӧ<EFBFBD>̷<EFBFBD>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>
|
||
with ClientDataSet2 do
|
||
begin
|
||
First;
|
||
while not Eof do
|
||
begin
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('select * from FP_Money_HX where ');
|
||
sql.Add(' FNID='''+Trim(MaxNoFN)+'''');
|
||
sql.Add(' and GYSFMID='''+Trim(ClientDataSet2.fieldbyname('FMID').AsString)+'''');
|
||
Open;
|
||
end;
|
||
FFHID:=Trim(ADOTemp.fieldbyname('FHID').AsString);
|
||
if Trim(FFHID)='' then
|
||
begin
|
||
if GetLSNo(ADOCmd,maxNoFH,'FH','FP_Money_HX',4,1)=False then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1>Ӧ<EFBFBD>̷<EFBFBD>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˮ<EFBFBD><CBAE>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
end else
|
||
begin
|
||
maxNoFH:=Trim(FFHID);
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select * from FP_Money_HX');
|
||
sql.Add(' where FHID='''+Trim(FFHID)+'''');
|
||
Open;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
if Trim(FFHID)='' then
|
||
begin
|
||
Append;
|
||
FieldByName('Filler').Value:=Trim(DName);
|
||
end else
|
||
begin
|
||
Edit;
|
||
FieldByName('Editer').Value:=Trim(DName);
|
||
FieldByName('EditTime').Value:=SGetServerDateTime(ADOTemp);
|
||
end;
|
||
FieldByName('FHID').Value:=Trim(maxNoFH);
|
||
FieldByName('FNID').Value:=Trim(MaxNoFN);
|
||
FieldByName('GYSFMID').Value:=Trim(ClientDataSet2.fieldbyname('FMID').AsString);
|
||
FieldByName('HXQty').Value:=ClientDataSet2.fieldbyname('HXQty').Value;
|
||
FieldByName('HXMoney').Value:=ClientDataSet2.fieldbyname('HXMoney').Value;
|
||
FieldByName('Type').Value:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>̷<EFBFBD>Ʊ';
|
||
Post;
|
||
end;
|
||
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add(' Update FP_GYSNB Set ');
|
||
sql.Add(' HXQty=(select sum(isnull(HXQty,0)) from FP_Money_HX A');
|
||
sql.Add(' where A.GYSFMID=FP_GYSNB.FMID and A.Type=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>̷<EFBFBD>Ʊ'')');
|
||
sql.Add(' ,HXMoney=(select sum(isnull(HXMoney,0)) from FP_Money_HX A');
|
||
sql.Add(' where A.GYSFMID=FP_GYSNB.FMID and A.Type=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>̷<EFBFBD>Ʊ'')');
|
||
sql.Add(' where FMID='''+Trim(ClientDataSet2.fieldbyname('FMID').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
with ADOTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' select DHXMoney=A.Money-isnull(A.HXMoney,0)');
|
||
sql.Add(',DHXQty=A.Qty-isnull(A.HXQty,0)');
|
||
sql.Add(' from FP_GYSNB A');
|
||
sql.Add(' where FMID='''+Trim(ClientDataSet2.fieldbyname('FMID').AsString)+'''');
|
||
Open;
|
||
end;
|
||
if ADOTemp.FieldByName('DHXQty').Value<0 then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڷ<EFBFBD>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if ADOTemp.FieldByName('DHXMoney').Value<0 then
|
||
begin
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڷ<EFBFBD>Ʊ<EFBFBD><C6B1><EFBFBD><EFBFBD>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
Edit;
|
||
FieldByName('FHID').Value:=Trim(maxNoFH);
|
||
Next;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('delete from FP_Money_HX where isnull(HXQty,0)=0 and isnull(HXMoney,0)=0');
|
||
sql.Add(' and FNID='''+Trim(MaxNoFN)+'''');
|
||
sql.Add(' and Type=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>̷<EFBFBD>Ʊ'' ');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
ADOCmd.Connection.CommitTrans;
|
||
FMainId:=Trim(MaxNoFN);
|
||
Result:=True;
|
||
except
|
||
Result:=False;
|
||
ADOCmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmNBFPInPutWGLBCOrderNo.TBSaveClick(Sender: TObject);
|
||
var
|
||
FPPrice,PRTPrice,BCMoney,FPQty,ChaMoney:string;
|
||
begin
|
||
ToolBar1.SetFocus;
|
||
if Trim(BGOrderNo.Text)='' then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>ض<EFBFBD><D8B6><EFBFBD><EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.IsEmpty then
|
||
begin
|
||
Application.MessageBox('<27>ڲ<EFBFBD><DAB2><EFBFBD>Ʊ<EFBFBD><C6B1><EFBFBD>ݲ<EFBFBD><DDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.Locate('FPNO',null,[]) then
|
||
begin
|
||
Application.MessageBox('<27><>Ʊ<EFBFBD>Ų<EFBFBD><C5B2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.Locate('FPType',null,[]) then
|
||
begin
|
||
Application.MessageBox('<27><>Ʊ<EFBFBD><C6B1><EFBFBD>Ͳ<EFBFBD><CDB2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.Locate('FPDate',null,[]) then
|
||
begin
|
||
Application.MessageBox('<27><>Ʊ<EFBFBD><C6B1><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.Locate('GHDanWei',null,[]) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.Locate('XHDanWei',null,[]) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.Locate('BGName',null,[]) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.Locate('Qty',null,[]) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.Locate('Price',null,[]) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD>۲<EFBFBD><DBB2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if Order_Sub.Locate('Money',null,[]) then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EEB2BB>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
||
Exit;
|
||
end;
|
||
if SaveData() then
|
||
begin
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ',0);
|
||
ModalResult:=1;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmNBFPInPutWGLBCOrderNo.v1Column3PropertiesEditValueChanged(
|
||
Sender: TObject);
|
||
var
|
||
mvalue,FQty,FPrice,FMoney,FName:String;
|
||
begin
|
||
FName:=Tv1.Controller.FocusedColumn.DataBinding.FilterFieldName;
|
||
mvalue:=TcxTextEdit(Sender).EditingText;
|
||
if Trim(mvalue)='' then mvalue:='0';
|
||
with Order_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName(FName).Value:=mvalue;
|
||
Post;
|
||
end;
|
||
FQty:=Order_Sub.fieldbyname('Qty').AsString;
|
||
FPrice:=Order_Sub.fieldbyname('Price').AsString;
|
||
FMoney:=Order_Sub.fieldbyname('Money').AsString;
|
||
if Trim(FQty)='' then FQty:='0';
|
||
if Trim(FPrice)='' then FPrice:='0';
|
||
if Trim(FMoney)='' then FMoney:='0';
|
||
if Trim(FName)<>'Money' then
|
||
begin
|
||
with Order_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('Money').Value:=StrToFloat(FQty)*StrToFloat(FPrice);
|
||
Post;
|
||
end;
|
||
end else
|
||
begin
|
||
if Trim(FQty)<>'0' then
|
||
begin
|
||
with Order_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('Price').Value:=StrToFloat(FMoney)*1.000000/StrToFloat(FQty);
|
||
Post;
|
||
end;
|
||
end else
|
||
begin
|
||
with Order_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('Price').Value:=Null;
|
||
Post;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmNBFPInPutWGLBCOrderNo.v1Column20PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='GSTT';
|
||
flagname:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ';
|
||
V1ZdyStr1.Visible:=True;
|
||
V1ZdyStr2.Visible:=True;
|
||
V1ZdyStr3.Visible:=True;
|
||
V1ZdyStr4.Visible:=True;
|
||
V1ZdyStr1.Caption:='<27><><EFBFBD><EFBFBD>';
|
||
V1ZdyStr2.Caption:='<27>绰';
|
||
V1ZdyStr3.Caption:='<27><><EFBFBD><EFBFBD>';
|
||
V1ZdyStr4.Caption:='<27><>ַ';
|
||
frmZDYHelp.Align:=alClient;
|
||
if ShowModal=1 then
|
||
begin
|
||
with Order_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('GHDanWei').Value:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmNBFPInPutWGLBCOrderNo.v1Column5PropertiesButtonClick(Sender: TObject;
|
||
AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='GSTT';
|
||
flagname:='<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ';
|
||
V1ZdyStr1.Visible:=True;
|
||
V1ZdyStr2.Visible:=True;
|
||
V1ZdyStr3.Visible:=True;
|
||
V1ZdyStr4.Visible:=True;
|
||
V1ZdyStr1.Caption:='<27><><EFBFBD><EFBFBD>';
|
||
V1ZdyStr2.Caption:='<27>绰';
|
||
V1ZdyStr3.Caption:='<27><><EFBFBD><EFBFBD>';
|
||
V1ZdyStr4.Caption:='<27><>ַ';
|
||
frmZDYHelp.Align:=alClient;
|
||
if ShowModal=1 then
|
||
begin
|
||
with Order_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('XHDanWei').Value:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmNBFPInPutWGLBCOrderNo.v1Column18PropertiesButtonClick(
|
||
Sender: TObject; AButtonIndex: Integer);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='BGName';
|
||
flagname:='<27><><EFBFBD><EFBFBD>Ʒ<EFBFBD><C6B7>';
|
||
if ShowModal=1 then
|
||
begin
|
||
with Self.Order_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('BGName').Value:=Trim(frmZDYHelp.ClientDataSet1.fieldbyname('ZdyName').AsString);
|
||
//Post;
|
||
end;
|
||
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmNBFPInPutWGLBCOrderNo.ToolButton2Click(Sender: TObject);
|
||
begin
|
||
try
|
||
frmGYSFPSelList:=TfrmGYSFPSelList.Create(Application);
|
||
with frmGYSFPSelList do
|
||
begin
|
||
if ShowModal=1 then
|
||
begin
|
||
with frmGYSFPSelList.Order_Main do
|
||
begin
|
||
First;
|
||
while Locate('SSel',True,[]) do
|
||
begin
|
||
if Self.ClientDataSet2.Locate('FMID',Trim(frmGYSFPSelList.Order_Main.fieldbyname('FMID').AsString),[])=False then
|
||
begin
|
||
with Self.ClientDataSet2 do
|
||
begin
|
||
Append;
|
||
FieldByName('FMId').Value:=frmGYSFPSelList.Order_Main.FieldByName('FMId').Value;
|
||
FieldByName('BCOrderNo').Value:=frmGYSFPSelList.Order_Main.FieldByName('BCOrderNo').Value;
|
||
FieldByName('FPNO').Value:=frmGYSFPSelList.Order_Main.FieldByName('FPNO').Value;
|
||
FieldByName('FPDate').Value:=frmGYSFPSelList.Order_Main.FieldByName('FPDate').Value;
|
||
FieldByName('FactoryName').Value:=frmGYSFPSelList.Order_Main.FieldByName('FactoryName').Value;
|
||
FieldByName('GHDanWei').Value:=frmGYSFPSelList.Order_Main.FieldByName('GHDanWei').Value;
|
||
FieldByName('XHDanWei').Value:=frmGYSFPSelList.Order_Main.FieldByName('XHDanWei').Value;
|
||
FieldByName('BFName').Value:=frmGYSFPSelList.Order_Main.FieldByName('BFName').Value;
|
||
FieldByName('QtyUnit').Value:=frmGYSFPSelList.Order_Main.FieldByName('QtyUnit').Value;
|
||
FieldByName('Qty').Value:=frmGYSFPSelList.Order_Main.FieldByName('Qty').Value;
|
||
FieldByName('Price').Value:=frmGYSFPSelList.Order_Main.FieldByName('Price').Value;
|
||
FieldByName('Money').Value:=frmGYSFPSelList.Order_Main.FieldByName('Money').Value;
|
||
FieldByName('HXQty').Value:=frmGYSFPSelList.Order_Main.FieldByName('DHXQty').Value;
|
||
FieldByName('HXMoney').Value:=frmGYSFPSelList.Order_Main.FieldByName('DHXMoney').Value;
|
||
//Post;
|
||
end;
|
||
end;
|
||
frmGYSFPSelList.Order_Main.Delete;
|
||
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
finally
|
||
frmGYSFPSelList.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TfrmNBFPInPutWGLBCOrderNo.ToolButton5Click(Sender: TObject);
|
||
begin
|
||
if ClientDataSet2.IsEmpty then Exit;
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('delete from FP_Money_HX ');
|
||
sql.Add(' where FHID='''+Trim(ClientDataSet2.fieldbyname('FHID').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add(' Update FP_GYSNB Set ');
|
||
sql.Add(' HXQty=(select sum(isnull(HXQty,0)) from FP_Money_HX A');
|
||
sql.Add(' where A.GYSFMID=FP_GYSNB.FMID and A.Type=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>̷<EFBFBD>Ʊ'')');
|
||
sql.Add(' ,HXMoney=(select sum(isnull(HXMoney,0)) from FP_Money_HX A');
|
||
sql.Add(' where A.GYSFMID=FP_GYSNB.FMID and A.Type=''<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>̷<EFBFBD>Ʊ'')');
|
||
sql.Add(' where FMID='''+Trim(ClientDataSet2.fieldbyname('FMID').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
ClientDataSet2.Delete;
|
||
end;
|
||
|
||
procedure TfrmNBFPInPutWGLBCOrderNo.ToolButton1Click(Sender: TObject);
|
||
begin
|
||
if Order_Sub.IsEmpty=False then
|
||
begin
|
||
CopyAddRowCDS(Order_Sub);
|
||
end else
|
||
begin
|
||
with Order_Sub do
|
||
begin
|
||
Append;
|
||
FieldByName('FPType').Value:='<27><><EFBFBD><EFBFBD>';
|
||
FieldByName('FPDate').Value:=SGetServerDate(ADOTemp);
|
||
Post;
|
||
end;
|
||
end;
|
||
with Order_Sub do
|
||
begin
|
||
Edit;
|
||
FieldByName('FMID').Value:=Null;
|
||
FieldByName('FPNO').Value:=Null;
|
||
Post;
|
||
end;
|
||
|
||
end;
|
||
|
||
procedure TfrmNBFPInPutWGLBCOrderNo.ToolButton3Click(Sender: TObject);
|
||
begin
|
||
if Order_Sub.IsEmpty then Exit;
|
||
if Trim(Order_Sub.FieldByName('FMID').AsString)<>'' then
|
||
begin
|
||
if Application.MessageBox('ȷ<><C8B7>Ҫɾ<D2AA><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
|
||
with ADOCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add(' delete from FP_GYSNB '); // Set HXMoney=Money,FNID=Null
|
||
sql.Add(' where FMID='''+Trim(Order_Sub.fieldbyname('FMID').AsString)+'''');
|
||
ExecSQL;
|
||
end;
|
||
end;
|
||
Order_Sub.Delete;
|
||
end;
|
||
|
||
procedure TfrmNBFPInPutWGLBCOrderNo.v2Column2PropertiesEditValueChanged(
|
||
Sender: TObject);
|
||
var
|
||
mvalue,FQty,FPrice,FMoney,FName:String;
|
||
begin
|
||
if CheckBox1.Checked=True then Exit;
|
||
FName:=Tv2.Controller.FocusedColumn.DataBinding.FilterFieldName;
|
||
mvalue:=TcxTextEdit(Sender).EditingText;
|
||
if Trim(mvalue)='' then mvalue:='0';
|
||
with ClientDataSet2 do
|
||
begin
|
||
Edit;
|
||
FieldByName(FName).Value:=mvalue;
|
||
Post;
|
||
end;
|
||
FQty:=ClientDataSet2.fieldbyname('HXQty').AsString;
|
||
FPrice:=ClientDataSet2.fieldbyname('Price').AsString;
|
||
FMoney:=ClientDataSet2.fieldbyname('HXMoney').AsString;
|
||
if Trim(FQty)='' then FQty:='0';
|
||
if Trim(FPrice)='' then FPrice:='0';
|
||
if Trim(FMoney)='' then FMoney:='0';
|
||
if Trim(FName)<>'HXMoney' then
|
||
begin
|
||
with ClientDataSet2 do
|
||
begin
|
||
Edit;
|
||
FieldByName('HXMoney').Value:=StrToFloat(FQty)*StrToFloat(FPrice);
|
||
Post;
|
||
end;
|
||
end else
|
||
begin
|
||
if Trim(FPrice)<>'0' then
|
||
begin
|
||
with ClientDataSet2 do
|
||
begin
|
||
Edit;
|
||
FieldByName('HXQty').Value:=StrToFloat(FMoney)*1.00/StrToFloat(FPrice);
|
||
Post;
|
||
end;
|
||
end else
|
||
begin
|
||
with ClientDataSet2 do
|
||
begin
|
||
Edit;
|
||
FieldByName('HXQty').Value:=Null;
|
||
Post;
|
||
end;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
end.
|