You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

287 lines
10 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

unit u_ch_genleg_start;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, bsSkinCtrls, Grids, DBGridEh, ComCtrls, bsSkinTabs, StdCtrls,
Mask, wwdbedit, Wwdotdot, Wwdbcomb, DB, kbmMemTable, ADODB;
type
Tfrm_ch_genleg_start = class(TForm)
bsSkinPanel1: TbsSkinPanel;
bsSkinPageControl1: TbsSkinPageControl;
bsSkinTabSheet5: TbsSkinTabSheet;
DBGridEhGenleg: TDBGridEh;
bsSkinTabSheet4: TbsSkinTabSheet;
DBGridEhBank: TDBGridEh;
bsSkinPanel4: TbsSkinPanel;
Label1: TLabel;
Label6: TLabel;
Label7: TLabel;
cbYear: TwwDBComboBox;
cbmonth: TwwDBComboBox;
bsSkinButton3: TbsSkinButton;
bsSkinButton1: TbsSkinButton;
t_ch_genleg: TkbmMemTable;
t_ch_genlegField: TFloatField;
t_ch_genlegField2: TFloatField;
t_ch_genlegField3: TFloatField;
t_ch_genlegUSD: TFloatField;
t_ch_genlegUSD2: TFloatField;
t_ch_genlegUSD3: TFloatField;
t_ch_bank_genleg: TkbmMemTable;
FloatField1: TFloatField;
FloatField2: TFloatField;
FloatField3: TFloatField;
FloatField4: TFloatField;
FloatField5: TFloatField;
FloatField6: TFloatField;
t_ch_bank_genlegField: TStringField;
t_ch_bank_genlegField2: TStringField;
t_ch_bank_genlegBANK: TStringField;
t_ch_genleg1: TDataSource;
t_ch_bank_genleg1: TDataSource;
t_ch_genleg_n: TADOQuery;
t_ch_genlegDSDesigner: TIntegerField;
t_ch_genlegDSDesigner2: TSmallintField;
t_ch_genlegDSDesigner3: TBCDField;
t_ch_genlegDSDesigner4: TBCDField;
t_ch_genlegDSDesigner5: TBCDField;
t_ch_genlegDSDesigner6: TBCDField;
t_ch_genlegDSDesigner7: TBCDField;
t_ch_genlegDSDesigner8: TBCDField;
BCDField1: TBCDField;
BCDField2: TBCDField;
BCDField3: TBCDField;
t_ch_genlegUSD4: TBCDField;
t_ch_genlegUSD5: TBCDField;
t_ch_genlegUSD6: TBCDField;
t_ch_genlegDSDesigner9: TBCDField;
t_ch_genlegDSDesigner10: TBCDField;
t_ch_genlegDSDesigner11: TBCDField;
t_ch_genlegUSD7: TBCDField;
t_ch_genlegUSD8: TBCDField;
t_ch_genlegUSD9: TBCDField;
t_ch_bank_genleg_n: TADOQuery;
t_ch_bank_genlegDSDesigner: TIntegerField;
t_ch_bank_genlegDSDesigner2: TSmallintField;
t_ch_bank_genlegDSDesigner3: TStringField;
t_ch_bank_genlegDSDesigner4: TStringField;
t_ch_bank_genlegDSDesigner5: TBCDField;
t_ch_bank_genlegDSDesigner6: TBCDField;
t_ch_bank_genlegDSDesigner7: TBCDField;
t_ch_bank_genlegDSDesigner8: TBCDField;
t_ch_bank_genlegDSDesigner9: TBCDField;
t_ch_bank_genlegDSDesigner10: TBCDField;
t_ch_bank_genlegUSD: TBCDField;
t_ch_bank_genlegUSD2: TBCDField;
t_ch_bank_genlegUSD3: TBCDField;
t_ch_bank_genlegUSD4: TBCDField;
t_ch_bank_genlegUSD5: TBCDField;
t_ch_bank_genlegUSD6: TBCDField;
StringField1: TStringField;
t_ch_bank_genlegDSDesigner11: TBCDField;
t_ch_bank_genlegDSDesigner12: TBCDField;
t_ch_bank_genlegDSDesigner13: TBCDField;
t_ch_bank_genlegUSD7: TBCDField;
t_ch_bank_genlegUSD8: TBCDField;
t_ch_bank_genlegUSD9: TBCDField;
t_ch_genlegRMB: TFloatField;
t_ch_genlegRMB2: TFloatField;
t_ch_genlegRMB3: TFloatField;
t_ch_bank_genlegRMB: TFloatField;
t_ch_bank_genlegRMB2: TFloatField;
t_ch_bank_genlegRMB3: TFloatField;
t_ch_bank_genleg_nRMB: TBCDField;
t_ch_bank_genleg_nRMB2: TBCDField;
t_ch_bank_genleg_nRMB3: TBCDField;
t_ch_bank_genleg_nRMB4: TBCDField;
t_ch_bank_genleg_nRMB5: TBCDField;
t_ch_bank_genleg_nRMB6: TBCDField;
t_ch_genleg_nRMB: TBCDField;
t_ch_genleg_nRMB2: TBCDField;
t_ch_genleg_nRMB3: TBCDField;
t_ch_genleg_nRMB4: TBCDField;
t_ch_genleg_nRMB5: TBCDField;
t_ch_genleg_nRMB6: TBCDField;
procedure t_ch_genlegFieldChange(Sender: TField);
procedure t_ch_genlegUSDChange(Sender: TField);
procedure t_ch_genlegAfterInsert(DataSet: TDataSet);
procedure FormShow(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton3Click(Sender: TObject);
procedure t_ch_bank_genleg_nAfterInsert(DataSet: TDataSet);
procedure t_ch_genlegRMBChange(Sender: TField);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_ch_genleg_start: Tfrm_ch_genleg_start;
implementation
uses u_main, u_data_share, my_sys_function;
{$R *.dfm}
procedure Tfrm_ch_genleg_start.t_ch_genlegFieldChange(Sender: TField);
begin
Sender.DataSet.FieldByName('<27>ۼ<EFBFBD><DBBC><EFBFBD><EFBFBD><EFBFBD>').Asfloat:=Sender.DataSet.FieldByName('<27>ۼƽ跽').Asfloat-Sender.DataSet.FieldByName('<27>ۼƴ<DBBC><C6B4><EFBFBD>').Asfloat;
end;
procedure Tfrm_ch_genleg_start.t_ch_genlegUSDChange(Sender: TField);
begin
Sender.DataSet.FieldByName('USD<53>ۼ<EFBFBD><DBBC><EFBFBD><EFBFBD><EFBFBD>').Asfloat:=Sender.DataSet.FieldByName('USD<53>ۼƽ跽').Asfloat-Sender.DataSet.FieldByName('USD<53>ۼƴ<DBBC><C6B4><EFBFBD>').Asfloat;
end;
procedure Tfrm_ch_genleg_start.t_ch_genlegAfterInsert(DataSet: TDataSet);
begin
DataSet.FieldByName('<27>ۼƽ跽').Asfloat:=0.00;
DataSet.FieldByName('<27>ۼƴ<DBBC><C6B4><EFBFBD>').Asfloat:=0.00;
DataSet.FieldByName('<27>ۼ<EFBFBD><DBBC><EFBFBD><EFBFBD><EFBFBD>').Asfloat:=0.00;
DataSet.FieldByName('USD<53>ۼƽ跽').Asfloat:=0.00;
DataSet.FieldByName('USD<53>ۼƴ<DBBC><C6B4><EFBFBD>').Asfloat:=0.00;
DataSet.FieldByName('USD<53>ۼ<EFBFBD><DBBC><EFBFBD><EFBFBD><EFBFBD>').Asfloat:=0.00;
DataSet.FieldByName('RMB<4D>ۼƽ跽').Asfloat:=0.00;
DataSet.FieldByName('RMB<4D>ۼƴ<DBBC><C6B4><EFBFBD>').Asfloat:=0.00;
DataSet.FieldByName('RMB<4D>ۼ<EFBFBD><DBBC><EFBFBD><EFBFBD><EFBFBD>').Asfloat:=0.00;
end;
procedure Tfrm_ch_genleg_start.FormShow(Sender: TObject);
begin
t_ch_genleg.open;
t_ch_bank_genleg.open;
t_ch_genleg.Insert;
t_ch_genleg.post;
frm_data_share.t_sys_bank.First;
while not frm_data_share.t_sys_bank.eof do begin
t_ch_bank_genleg.Insert;
t_ch_bank_genleg.fieldbyname('<27><><EFBFBD>д<EFBFBD><D0B4><EFBFBD>').AsString:=frm_data_share.t_sys_bank.fieldbyname('<27><><EFBFBD><EFBFBD>').AsString;
t_ch_bank_genleg.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString:=frm_data_share.t_sys_bank.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString;
t_ch_bank_genleg.post;
frm_data_share.t_sys_bank.next;
end;
cbYear.ItemIndex:=cbYear.Items.IndexOf(inttostr(Logininfo.offyear));
cbmonth.ItemIndex:=cbmonth.Items.IndexOf(inttostr(Logininfo.offmonth));
end;
procedure Tfrm_ch_genleg_start.bsSkinButton1Click(Sender: TObject);
begin
close;
end;
procedure Tfrm_ch_genleg_start.bsSkinButton3Click(Sender: TObject);
var
aQuery:TAdoQuery;
begin
if (cbYear.text='') or (cbMonth.text='') then begin
showmessage('<27><>ʼ<EFBFBD><EFBFBD>²<EFBFBD><C2B2><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>');
exit;
end;
if MessageDlg('ȷʵҪ<CAB5><D2AA>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>',mtWarning,[mbyes,mbno],0)=mrno then exit;
aQuery:=CreateAdoQuery;
try
frm_main.db.BeginTrans;
try
with aQuery do begin
Close;SQL.Clear;
SQL.Add('update period set closed=''T'' where period<='''+cbYear.Text+cbmonth.text+'''');
ExecSQL;
Close;SQL.Clear;
SQL.Add('update period set closed=''F'' where period>'''+cbYear.Text+cbmonth.text+'''');
ExecSQL;
Close;SQL.Clear;
SQL.Add('delete from t_ch_genleg');
ExecSQL;
Close;SQL.Clear;
SQL.Add('delete from t_ch_bank_genleg');
ExecSQL;
end;
t_ch_genleg_n.open;
t_ch_bank_genleg_n.open;
if not t_ch_genleg.IsEmpty then begin
t_ch_genleg_n.Insert;
t_ch_genleg_n.FieldByName('<27><>').AsInteger:=strtoint(cbYear.text);
t_ch_genleg_n.FieldByName('<27><>').AsInteger:=strtoint(cbmonth.text);
t_ch_genleg_n['<27>ۼƽ跽']:=t_ch_genleg['<27>ۼƽ跽'];
t_ch_genleg_n['<27>ۼƴ<DBBC><C6B4><EFBFBD>']:=t_ch_genleg['<27>ۼƴ<DBBC><C6B4><EFBFBD>'];
t_ch_genleg_n['<27>ۼ<EFBFBD><DBBC><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_genleg['<27>ۼ<EFBFBD><DBBC><EFBFBD><EFBFBD><EFBFBD>'];
t_ch_genleg_n['USD<53>ۼƽ跽']:=t_ch_genleg['USD<53>ۼƽ跽'];
t_ch_genleg_n['USD<53>ۼƴ<DBBC><C6B4><EFBFBD>']:=t_ch_genleg['USD<53>ۼƴ<DBBC><C6B4><EFBFBD>'];
t_ch_genleg_n['USD<53>ۼ<EFBFBD><DBBC><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_genleg['USD<53>ۼ<EFBFBD><DBBC><EFBFBD><EFBFBD><EFBFBD>'];
t_ch_genleg_n['RMB<4D>ۼƽ跽']:=t_ch_genleg['RMB<4D>ۼƽ跽'];
t_ch_genleg_n['RMB<4D>ۼƴ<DBBC><C6B4><EFBFBD>']:=t_ch_genleg['RMB<4D>ۼƴ<DBBC><C6B4><EFBFBD>'];
t_ch_genleg_n['RMB<4D>ۼ<EFBFBD><DBBC><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_genleg['RMB<4D>ۼ<EFBFBD><DBBC><EFBFBD><EFBFBD><EFBFBD>'];
t_ch_genleg_n.post;
end;
if not t_ch_bank_genleg.IsEmpty then begin
t_ch_bank_genleg.First;
while not t_ch_bank_genleg.Eof do begin
t_ch_bank_genleg_n.Insert;
t_ch_bank_genleg_n.FieldByName('<27><>').AsInteger:=strtoint(cbYear.text);
t_ch_bank_genleg_n.FieldByName('<27><>').AsInteger:=strtoint(cbmonth.text);
t_ch_bank_genleg_n['<27><><EFBFBD>д<EFBFBD><D0B4><EFBFBD>']:=t_ch_bank_genleg['<27><><EFBFBD>д<EFBFBD><D0B4><EFBFBD>'];
t_ch_bank_genleg_n['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_bank_genleg['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
t_ch_bank_genleg_n['<27>ۼƽ跽']:=t_ch_bank_genleg['<27>ۼƽ跽'];
t_ch_bank_genleg_n['<27>ۼƴ<DBBC><C6B4><EFBFBD>']:=t_ch_bank_genleg['<27>ۼƴ<DBBC><C6B4><EFBFBD>'];
t_ch_bank_genleg_n['<27>ۼ<EFBFBD><DBBC><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_bank_genleg['<27>ۼ<EFBFBD><DBBC><EFBFBD><EFBFBD><EFBFBD>'];
t_ch_bank_genleg_n['USD<53>ۼƽ跽']:=t_ch_bank_genleg['USD<53>ۼƽ跽'];
t_ch_bank_genleg_n['USD<53>ۼƴ<DBBC><C6B4><EFBFBD>']:=t_ch_bank_genleg['USD<53>ۼƴ<DBBC><C6B4><EFBFBD>'];
t_ch_bank_genleg_n['USD<53>ۼ<EFBFBD><DBBC><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_bank_genleg['USD<53>ۼ<EFBFBD><DBBC><EFBFBD><EFBFBD><EFBFBD>'];
t_ch_bank_genleg_n['RMB<4D>ۼƽ跽']:=t_ch_bank_genleg['RMB<4D>ۼƽ跽'];
t_ch_bank_genleg_n['RMB<4D>ۼƴ<DBBC><C6B4><EFBFBD>']:=t_ch_bank_genleg['RMB<4D>ۼƴ<DBBC><C6B4><EFBFBD>'];
t_ch_bank_genleg_n['RMB<4D>ۼ<EFBFBD><DBBC><EFBFBD><EFBFBD><EFBFBD>']:=t_ch_bank_genleg['RMB<4D>ۼ<EFBFBD><DBBC><EFBFBD><EFBFBD><EFBFBD>'];
t_ch_bank_genleg_n.post;
t_ch_bank_genleg.Next;
end;
end;
Logininfo.offyear:=StrToInt(cbYear.Text);
Logininfo.offmonth:=StrToInt(cbmonth.text);
frm_main.db.CommitTrans;
showmessage('<27><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD>ϣ<EFBFBD>');
except
frm_main.db.RollbackTrans;
showmessage('<27><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>г<EFBFBD><D0B3><EFBFBD><EFBFBD><EFBFBD>');
end;
finally
freeandnil(aQuery);
end;
end;
procedure Tfrm_ch_genleg_start.t_ch_bank_genleg_nAfterInsert(
DataSet: TDataSet);
begin
DataSet.FieldByName('<27><><EFBFBD>½跽').Asfloat:=0.00;
DataSet.FieldByName('<27><><EFBFBD>´<EFBFBD><C2B4><EFBFBD>').Asfloat:=0.00;
DataSet.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Asfloat:=0.00;
DataSet.FieldByName('USD<53><44><EFBFBD>½跽').Asfloat:=0.00;
DataSet.FieldByName('USD<53><44><EFBFBD>´<EFBFBD><C2B4><EFBFBD>').Asfloat:=0.00;
DataSet.FieldByName('USD<53><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Asfloat:=0.00;
DataSet.FieldByName('RMB<4D><42><EFBFBD>½跽').Asfloat:=0.00;
DataSet.FieldByName('RMB<4D><42><EFBFBD>´<EFBFBD><C2B4><EFBFBD>').Asfloat:=0.00;
DataSet.FieldByName('RMB<4D><42><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Asfloat:=0.00;
end;
procedure Tfrm_ch_genleg_start.t_ch_genlegRMBChange(Sender: TField);
begin
Sender.DataSet.FieldByName('RMB<4D>ۼ<EFBFBD><DBBC><EFBFBD><EFBFBD><EFBFBD>').Asfloat:=Sender.DataSet.FieldByName('RMB<4D>ۼƽ跽').Asfloat-Sender.DataSet.FieldByName('RMB<4D>ۼƴ<DBBC><C6B4><EFBFBD>').Asfloat;
end;
end.