361 lines
10 KiB
ObjectPascal
361 lines
10 KiB
ObjectPascal
unit U_YF_Money_Sub;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, ComCtrls, ToolWin, DB, ADODB, cxControls, cxContainer, cxEdit,
|
||
cxTextEdit, cxCurrencyEdit, BtnEdit, StdCtrls, ExtCtrls, cxGraphics,
|
||
cxLookAndFeels, cxLookAndFeelPainters;
|
||
|
||
type
|
||
TFrmYF_Money_Sub = class(TForm)
|
||
ToolBar1: TToolBar;
|
||
TSAVE: TToolButton;
|
||
Tclose: TToolButton;
|
||
Panel1: TPanel;
|
||
Label11: TLabel;
|
||
Label9: TLabel;
|
||
Label8: TLabel;
|
||
Label5: TLabel;
|
||
Label2: TLabel;
|
||
note: TMemo;
|
||
CRTime: TDateTimePicker;
|
||
CRType: TBtnEditA;
|
||
OutMoney: TcxCurrencyEdit;
|
||
ADOQueryTMP: TADOQuery;
|
||
ADOQueryCMD: TADOQuery;
|
||
Label1: TLabel;
|
||
InMoney: TcxCurrencyEdit;
|
||
CRZY: TEdit;
|
||
Label3: TLabel;
|
||
FactoryName: TBtnEditA;
|
||
Label4: TLabel;
|
||
TOFactoryName: TBtnEditA;
|
||
OrderNo: TBtnEditA;
|
||
Label6: TLabel;
|
||
ADOQueryTEMP: TADOQuery;
|
||
procedure TcloseClick(Sender: TObject);
|
||
procedure TSAVEClick(Sender: TObject);
|
||
procedure CRTypeBtnClick(Sender: TObject);
|
||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||
procedure FormDestroy(Sender: TObject);
|
||
procedure FormShow(Sender: TObject);
|
||
procedure FormCreate(Sender: TObject);
|
||
procedure FactoryNameBtnClick(Sender: TObject);
|
||
procedure TOFactoryNameBtnClick(Sender: TObject);
|
||
procedure OrderNoBtnClick(Sender: TObject);
|
||
private
|
||
fopevent:string;
|
||
procedure savedata();
|
||
procedure initdata();
|
||
procedure geteditRzhi();
|
||
{ Private declarations }
|
||
public
|
||
fkeyNo: string;
|
||
fSYRName:string;
|
||
{ Public declarations }
|
||
end;
|
||
|
||
var
|
||
FrmYF_Money_Sub: TFrmYF_Money_Sub;
|
||
|
||
implementation
|
||
|
||
uses U_ZDYHelpSel, U_ZDYHelp,U_Fun, U_ProductOrderNewList,U_DataLink;
|
||
|
||
{$R *.dfm}
|
||
procedure TFrmYF_Money_Sub.geteditRzhi();
|
||
begin
|
||
fopevent:='';
|
||
with ADOQueryTemp do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from YF_Money_LL where LLNO='''+Trim(fkeyNo)+''' ');
|
||
open;
|
||
end;
|
||
IF not ADOQueryTemp.IsEmpty then
|
||
begin
|
||
IF trim(TOFactoryName.Text)<> trim(ADOQueryTemp.fieldbyName('TOFactoryName').AsString) then
|
||
fopevent:=fopevent+' <20>Է<EFBFBD><D4B7><EFBFBD>Ϣ:'+trim(ADOQueryTemp.fieldbyName('TOFactoryName').AsString)+'->'+trim(TOFactoryName.Text);
|
||
|
||
IF formatdateTime('yyyy-MM-dd',CRTime.DateTime)<> formatdateTime('yyyy-MM-dd',ADOQueryTemp.fieldbyName('CRTime').AsDateTime) then
|
||
fopevent:=fopevent+' <20><><EFBFBD><EFBFBD>:'+formatdateTime('yyyy-MM-dd',ADOQueryTemp.fieldbyName('CRTime').AsDateTime )+'->'+formatdateTime('yyyy-MM-dd',CRTime.DateTime);
|
||
|
||
IF strtofloatdef(trim(InMoney.Text),0)<> ADOQueryTemp.fieldbyName('InMoney').AsFloat then
|
||
fopevent:=fopevent+' <20>跽<EFBFBD><E8B7BD><EFBFBD><EFBFBD>:'+ADOQueryTemp.fieldbyName('inMoney').AsString+'->'+trim(InMoney.Text);
|
||
|
||
IF strtofloatdef(trim(OutMoney.Text),0)<> ADOQueryTemp.fieldbyName('OutMoney').AsFloat then
|
||
fopevent:=fopevent+' <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+ADOQueryTemp.fieldbyName('OutMoney').AsString+'->'+trim(OutMoney.Text);
|
||
|
||
if trim(fopevent)<>'' then
|
||
fopevent:='<27><><EFBFBD><EFBFBD><EFBFBD>˻<EFBFBD>:'+trim(ADOQueryTemp.fieldbyName('factoryName').AsString)+fopevent;
|
||
end;
|
||
|
||
IF trim(fopevent)<>'' then
|
||
begin
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
sql.Add('insert into SY_SysLog(operor,opertime,Model,acction,opevent,result) values( ');
|
||
sql.Add(' '+quotedstr(trim(DName)));
|
||
sql.Add(',getdate() ');
|
||
sql.Add(','+quotedstr(trim('<27>˻<EFBFBD><CBBB><EFBFBD>ˮ<EFBFBD>Ǽ<EFBFBD>')));
|
||
sql.Add(','+quotedstr(trim('<27>˻<EFBFBD><CBBB><EFBFBD>ˮ<EFBFBD><EFBFBD>')));
|
||
sql.Add(','+quotedstr(trim(fopevent)));
|
||
sql.Add(','+quotedstr(trim('<27>ɹ<EFBFBD>')));
|
||
sql.Add(')');
|
||
execsql;
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TFrmYF_Money_Sub.initdata();
|
||
begin
|
||
with adoquerycmd do
|
||
begin
|
||
close;
|
||
sql.clear;
|
||
sql.Add('select * from YF_Money_LL ');
|
||
sql.Add('where LLNO='+quotedstr(trim(fkeyNo)) );
|
||
open;
|
||
if not isempty then
|
||
begin
|
||
CRTime.DateTime:=fieldbyname('crtime').AsDateTime;
|
||
CRType.Text:=trim(fieldbyname('crtype').AsString);
|
||
factoryName.Text:=trim(fieldbyname('factoryName').AsString);
|
||
TOfactoryName.Text:=trim(fieldbyname('TOfactoryName').AsString);
|
||
NOTE.Text:=trim(fieldbyname('NOTE').AsString);
|
||
CRZY.Text:=trim(fieldbyname('crzy').AsString);
|
||
InMoney.Text:=trim(fieldbyname('InMoney').AsString);
|
||
OutMoney.Text:=Trim(fieldbyname('OutMoney').AsString);
|
||
orderNo.Text:=Trim(fieldbyname('orderNo').AsString);
|
||
end;
|
||
end;
|
||
end;
|
||
|
||
procedure TFrmYF_Money_Sub.savedata();
|
||
var
|
||
fid:string;
|
||
begin
|
||
try
|
||
ADOQueryCMD.Connection.BeginTrans;
|
||
if Trim(fkeyNo)='' then
|
||
begin
|
||
if GetLSNo(ADOQueryCMD,fkeyNo,'YL','YF_Money_LL',3,1)=False then
|
||
begin
|
||
ADOQueryCMD.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1>ˮ<EFBFBD><CBAE>ʧ<EFBFBD><CAA7>!','<27><>ʾ');
|
||
Exit;
|
||
end;
|
||
end;
|
||
geteditRzhi();
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('delete from YF_Money_LL where fromMainID='''+Trim(fkeyNo)+''' ');
|
||
execsql;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from YF_Money_LL where LLNO='''+Trim(fkeyNo)+''' ');
|
||
Open;
|
||
if isempty then
|
||
begin
|
||
append;
|
||
fieldbyname('filler').Value:=trim(Dname);
|
||
// fieldbyname('filltime').Value:=SGetServerDate10(adoqueryTmp);
|
||
end
|
||
else
|
||
begin
|
||
edit;
|
||
fieldbyname('chker').Value:=trim(Dname);
|
||
fieldbyname('chkTime').Value:=SGetServerDate10(adoqueryTmp);
|
||
end;
|
||
FieldByName('LLNO').Value:=Trim(fkeyNo);
|
||
fieldbyname('CRTime').Value:=formatdateTime('yyyy-MM-dd',CRTime.DateTime);
|
||
fieldbyname('CRType').Value:=trim(CRType.Text);
|
||
fieldbyname('factoryName').Value:=trim(factoryName.Text);
|
||
fieldbyname('TOfactoryName').Value:=trim(TOfactoryName.Text);
|
||
fieldbyname('CRType').Value:=trim(CRType.Text);
|
||
fieldbyname('NOTE').Value:=trim(NOTE.Text);
|
||
fieldbyname('CRZY').Value:=trim(CRZY.text);
|
||
fieldbyname('orderNo').Value:=trim(orderNo.text);
|
||
fieldbyname('inMoney').Value:=strtofloatdef(trim(inMoney.Text),0);
|
||
fieldbyname('OutMoney').Value:=strtofloatdef(trim(OutMoney.Text),0);
|
||
fieldbyname('syrName').Value:=trim(fsyrName);
|
||
fieldbyname('status').Value:='0';
|
||
Post;
|
||
end;
|
||
IF trim(CRType.Text)='<27>˻<EFBFBD><CBBB><EFBFBD>ת' then
|
||
begin
|
||
if GetLSNo(ADOQueryCMD,fid,'YL','YF_Money_LL',3,1)=False then
|
||
begin
|
||
ADOQueryCMD.Connection.RollbackTrans;
|
||
Application.MessageBox('ȡ<><C8A1>ˮ<EFBFBD><CBAE>ʧ<EFBFBD><CAA7>!','<27><>ʾ');
|
||
Exit;
|
||
end;
|
||
with ADOQueryCmd do
|
||
begin
|
||
Close;
|
||
sql.Clear;
|
||
SQL.Add('select * from YF_Money_LL where LLNO='''+Trim(fid)+''' ');
|
||
Open;
|
||
if isempty then
|
||
begin
|
||
append;
|
||
fieldbyname('filler').Value:=trim(Dname);
|
||
end
|
||
else
|
||
begin
|
||
edit;
|
||
fieldbyname('chker').Value:=trim(Dname);
|
||
fieldbyname('chkTime').Value:=SGetServerDate10(adoqueryTmp);
|
||
end;
|
||
FieldByName('LLNO').Value:=Trim(fid);
|
||
fieldbyname('CRTime').Value:=formatdateTime('yyyy-MM-dd',CRTime.DateTime);
|
||
fieldbyname('CRType').Value:=trim(CRType.Text);
|
||
fieldbyname('factoryName').Value:=trim(TOfactoryName.Text);
|
||
fieldbyname('TOfactoryName').Value:=trim(factoryName.Text);
|
||
fieldbyname('CRType').Value:=trim(CRType.Text);
|
||
fieldbyname('NOTE').Value:=trim(NOTE.Text);
|
||
fieldbyname('CRZY').Value:=trim(CRZY.text);
|
||
fieldbyname('inMoney').Value:=strtofloatdef(trim(OutMoney.Text),0);
|
||
fieldbyname('OutMoney').Value:=strtofloatdef(trim(InMoney.Text),0);
|
||
fieldbyname('status').Value:='0';
|
||
fieldbyname('fromMainID').Value:=trim(fkeyNo);
|
||
fieldbyname('syrName').Value:=trim(fsyrName);
|
||
Post;
|
||
end;
|
||
end;
|
||
ADOquerycmd.Connection.CommitTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD><C9B9><EFBFBD>','<27><>ʾ',0);
|
||
ModalResult:=1;
|
||
except
|
||
ADOquerycmd.Connection.RollbackTrans;
|
||
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>','<27><>ʾ',0);
|
||
end;
|
||
end;
|
||
|
||
procedure TFrmYF_Money_Sub.TcloseClick(Sender: TObject);
|
||
begin
|
||
close;
|
||
end;
|
||
|
||
procedure TFrmYF_Money_Sub.TSAVEClick(Sender: TObject);
|
||
begin
|
||
IF trim(FactoryName.Text)='' then
|
||
begin
|
||
application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>','<27><>ʾ<EFBFBD><CABE>Ϣ',0);
|
||
exit;
|
||
end;
|
||
savedata();
|
||
end;
|
||
|
||
procedure TFrmYF_Money_Sub.CRTypeBtnClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(self);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:='XJZZFLAG';
|
||
flagname:='ת<><D7AA><EFBFBD><EFBFBD><EFBFBD>Ͷ<EFBFBD><CDB6><EFBFBD>';
|
||
if showmodal=1 then
|
||
begin
|
||
CRType.Text:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
InMoney.Enabled:=true;
|
||
IF trim(CRType.Text)='<27>˻<EFBFBD><CBBB><EFBFBD>ת' then
|
||
begin
|
||
InMoney.Text:='';
|
||
InMoney.Enabled:=false;
|
||
end;
|
||
end;
|
||
|
||
procedure TFrmYF_Money_Sub.FormClose(Sender: TObject;
|
||
var Action: TCloseAction);
|
||
begin
|
||
action:=cafree;
|
||
end;
|
||
|
||
procedure TFrmYF_Money_Sub.FormDestroy(Sender: TObject);
|
||
begin
|
||
FrmYF_Money_Sub:=nil;
|
||
end;
|
||
|
||
procedure TFrmYF_Money_Sub.FormShow(Sender: TObject);
|
||
begin
|
||
CRTime.DateTime:=SGetServerDate10(adoqueryTmp);
|
||
initData();
|
||
end;
|
||
|
||
procedure TFrmYF_Money_Sub.FormCreate(Sender: TObject);
|
||
begin
|
||
Panel1.Align:=alclient;
|
||
end;
|
||
|
||
procedure TFrmYF_Money_Sub.FactoryNameBtnClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(self);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:=trim(fsyrName)+'XJLLFLAG';
|
||
flagname:='<27>˻<EFBFBD><CBBB><EFBFBD><EFBFBD>Ͷ<EFBFBD><CDB6><EFBFBD>';
|
||
if showmodal=1 then
|
||
begin
|
||
FactoryName.Text:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TFrmYF_Money_Sub.TOFactoryNameBtnClick(Sender: TObject);
|
||
begin
|
||
try
|
||
frmZDYHelp:=TfrmZDYHelp.Create(self);
|
||
with frmZDYHelp do
|
||
begin
|
||
flag:=trim(fsyrName)+'XJLLFLAG';
|
||
flagname:='<27>˻<EFBFBD><CBBB><EFBFBD><EFBFBD>Ͷ<EFBFBD><CDB6><EFBFBD>';
|
||
if showmodal=1 then
|
||
begin
|
||
TOFactoryName.Text:=Trim(ClientDataSet1.fieldbyname('ZDYName').AsString);
|
||
end;
|
||
end;
|
||
finally
|
||
frmZDYHelp.Free;
|
||
end;
|
||
end;
|
||
|
||
procedure TFrmYF_Money_Sub.OrderNoBtnClick(Sender: TObject);
|
||
begin
|
||
{ try
|
||
frmProductOrderNewList:=TfrmProductOrderNewList.Create(Application);
|
||
with frmProductOrderNewList do
|
||
begin
|
||
// DParameters1:='<27><>Ȩ<EFBFBD><C8A8>';
|
||
//frmProductOrderList.v1Column4.Visible:=True;
|
||
if ShowModal=1 then
|
||
begin
|
||
self.OrderNo.Text:=Order_Main.fieldbyname('OrderNo').asstring;
|
||
end;
|
||
end;
|
||
finally
|
||
frmProductOrderNewList.Free;
|
||
end; }
|
||
end;
|
||
|
||
end.
|