unit u_ch_genleg; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, DB, ADODB, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, bsSkinCtrls, StdCtrls, RxLookup, ExtCtrls, ComCtrls, bsSkinTabs, Mask, wwdbedit, Wwdotdot, Wwdbcomb, bsSkinBoxCtrls, CheckLst, DBCtrls, bsdbctrls, Grids, DBGridEh; type Tfrm_ch_genleg = class(TForm) t_ch_cust_genleg: TADOQuery; t_ch_cust_genleg1: TDataSource; t_ch_bank_genleg: TADOQuery; t_ch_bank_genleg1: TDataSource; bsSkinPageControl1: TbsSkinPageControl; bsSkinTabSheet1: TbsSkinTabSheet; Label4: TLabel; bsSkinTabSheet4: TbsSkinTabSheet; bsSkinTabSheet5: TbsSkinTabSheet; t_ch_genleg: TADOQuery; t_ch_genleg1: TDataSource; bsSkinPanel1: TbsSkinPanel; bsSkinButton5: TbsSkinButton; bsSkinPanel2: TbsSkinPanel; bsSkinButton9: TbsSkinButton; bsSkinPanel3: TbsSkinPanel; bsSkinPanel4: TbsSkinPanel; cbYear: TwwDBComboBox; Label1: TLabel; cbmonth: TwwDBComboBox; Label6: TLabel; Label7: TLabel; bsSkinButton10: TbsSkinButton; DBGridEhCust: TDBGridEh; t_ch_cust_genlegDSDesigner: TIntegerField; t_ch_cust_genlegDSDesigner2: TSmallintField; t_ch_cust_genlegDSDesigner3: TStringField; t_ch_cust_genlegDSDesigner4: TBCDField; t_ch_cust_genlegDSDesigner5: TBCDField; t_ch_cust_genlegDSDesigner6: TBCDField; t_ch_cust_genlegDSDesigner7: TBCDField; t_ch_cust_genlegDSDesigner8: TBCDField; t_ch_cust_genlegDSDesigner9: TBCDField; t_ch_cust_genlegUSD: TBCDField; t_ch_cust_genlegUSD2: TBCDField; t_ch_cust_genlegUSD3: TBCDField; t_ch_cust_genlegUSD4: TBCDField; t_ch_cust_genlegUSD5: TBCDField; t_ch_cust_genlegUSD6: TBCDField; t_ch_cust_genlegCUST: TStringField; DBGridEhBank: TDBGridEh; DBGridEhGenleg: TDBGridEh; 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; t_ch_bank_genlegBANK: TStringField; bsSkinCheckRadioBox1: TbsSkinCheckRadioBox; 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; t_ch_genlegUSD: TBCDField; t_ch_genlegUSD2: TBCDField; t_ch_genlegUSD3: TBCDField; t_ch_genlegUSD4: TBCDField; t_ch_genlegUSD5: TBCDField; t_ch_genlegUSD6: TBCDField; bsSkinButton1: TbsSkinButton; bsSkinButton2: TbsSkinButton; 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_cust_genlegDSDesigner10: TBCDField; t_ch_cust_genlegDSDesigner11: TBCDField; t_ch_cust_genlegDSDesigner12: TBCDField; t_ch_cust_genlegUSD7: TBCDField; t_ch_cust_genlegUSD8: TBCDField; t_ch_cust_genlegUSD9: TBCDField; 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_curr_genleg: TADOQuery; IntegerField1: TIntegerField; SmallintField1: TSmallintField; StringField1: TStringField; StringField2: TStringField; BCDField1: TBCDField; BCDField2: TBCDField; BCDField3: TBCDField; BCDField4: TBCDField; BCDField5: TBCDField; BCDField6: TBCDField; BCDField7: TBCDField; BCDField8: TBCDField; BCDField9: TBCDField; BCDField10: TBCDField; BCDField11: TBCDField; BCDField12: TBCDField; StringField3: TStringField; BCDField13: TBCDField; BCDField14: TBCDField; BCDField15: TBCDField; BCDField16: TBCDField; BCDField17: TBCDField; BCDField18: TBCDField; t_ch_curr_genleg1: TDataSource; bsSkinPanel5: TbsSkinPanel; bsSkinPanel6: TbsSkinPanel; DBGridEh1: TDBGridEh; bsSkinButton3: TbsSkinButton; t_ch_genlegRMB: TBCDField; t_ch_genlegRMB2: TBCDField; t_ch_genlegRMB3: TBCDField; t_ch_genlegRMB4: TBCDField; t_ch_genlegRMB5: TBCDField; t_ch_genlegRMB6: TBCDField; t_ch_cust_genlegRMB: TBCDField; t_ch_cust_genlegRMB2: TBCDField; t_ch_cust_genlegRMB3: TBCDField; t_ch_cust_genlegRMB4: TBCDField; t_ch_cust_genlegRMB5: TBCDField; t_ch_cust_genlegRMB6: TBCDField; t_ch_bank_genlegRMB: TBCDField; t_ch_bank_genlegRMB2: TBCDField; t_ch_bank_genlegRMB3: TBCDField; t_ch_bank_genlegRMB4: TBCDField; t_ch_bank_genlegRMB5: TBCDField; t_ch_bank_genlegRMB6: TBCDField; t_ch_curr_genlegRMB: TBCDField; t_ch_curr_genlegRMB2: TBCDField; t_ch_curr_genlegRMB3: TBCDField; t_ch_curr_genlegRMB4: TBCDField; t_ch_curr_genlegRMB5: TBCDField; t_ch_curr_genlegRMB6: TBCDField; procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure bsSkinButton5Click(Sender: TObject); procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); procedure bsSkinCheckRadioBox1Click(Sender: TObject); procedure t_ch_cust_genlegAfterInsert(DataSet: TDataSet); procedure bsSkinButton10Click(Sender: TObject); procedure t_ch_cust_genlegDSDesigner4Change(Sender: TField); procedure t_ch_cust_genlegDSDesigner7Change(Sender: TField); procedure t_ch_cust_genlegUSDChange(Sender: TField); procedure t_ch_cust_genlegUSD4Change(Sender: TField); procedure bsSkinButton1Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure t_ch_curr_genlegAfterInsert(DataSet: TDataSet); procedure t_ch_cust_genlegDSDesigner10Change(Sender: TField); procedure t_ch_cust_genlegUSD7Change(Sender: TField); procedure bsSkinButton3Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var frm_ch_genleg: Tfrm_ch_genleg; implementation uses u_main, my_sys_function, u_data_share, AccCloseOffu, AccCloseOffBacku, u_ch_genleg_start; {$R *.dfm} procedure Tfrm_ch_genleg.FormClose(Sender: TObject; var Action: TCloseAction); begin frm_ch_genleg.Hide; frm_ch_genleg.ManualFloat(frm_ch_genleg.BoundsRect ); frm_main.freeTabs('frm_ch_genleg'); action:=cafree; frm_ch_genleg:=nil; end; procedure Tfrm_ch_genleg.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_ch_genleg.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin CanClose:=frm_close_query(t_ch_cust_genleg); CanClose:=frm_close_query(t_ch_genleg); CanClose:=frm_close_query(t_ch_bank_genleg); end; procedure Tfrm_ch_genleg.bsSkinCheckRadioBox1Click(Sender: TObject); begin if bsSkinCheckRadioBox1.Checked then begin DBGridEhCust.ReadOnly:=false; DBGridEhBank.readonly:=false; DBGridEhGenleg.readonly:=false; DBGridEhCust.Columns[0].ReadOnly:=true; DBGridEhCust.Columns[1].ReadOnly:=true; DBGridEhBank.Columns[0].ReadOnly:=true; DBGridEhBank.Columns[1].ReadOnly:=true; DBGridEhGenleg.Columns[0].ReadOnly:=true; DBGridEhGenleg.Columns[1].ReadOnly:=true; end else begin DBGridEhCust.ReadOnly:=true; DBGridEhBank.readonly:=true; DBGridEhGenleg.readonly:=true; end; end; procedure Tfrm_ch_genleg.t_ch_cust_genlegAfterInsert(DataSet: TDataSet); begin DataSet.FieldByName('年').AsInteger:=strtoint(cbYear.text); DataSet.FieldByName('月').AsInteger:=strtoint(cbmonth.text); DataSet.FieldByName('年初借方').Asfloat:=0.00; DataSet.FieldByName('年初贷方').Asfloat:=0.00; DataSet.FieldByName('年初余额').Asfloat:=0.00; DataSet.FieldByName('本月借方').Asfloat:=0.00; DataSet.FieldByName('本月贷方').Asfloat:=0.00; DataSet.FieldByName('本月余额').Asfloat:=0.00; DataSet.FieldByName('累计借方').Asfloat:=0.00; DataSet.FieldByName('累计贷方').Asfloat:=0.00; DataSet.FieldByName('累计余额').Asfloat:=0.00; DataSet.FieldByName('USD年初借方').Asfloat:=0.00; DataSet.FieldByName('USD年初贷方').Asfloat:=0.00; DataSet.FieldByName('USD年初余额').Asfloat:=0.00; DataSet.FieldByName('USD本月借方').Asfloat:=0.00; DataSet.FieldByName('USD本月贷方').Asfloat:=0.00; DataSet.FieldByName('USD本月余额').Asfloat:=0.00; DataSet.FieldByName('USD累计借方').Asfloat:=0.00; DataSet.FieldByName('USD累计贷方').Asfloat:=0.00; DataSet.FieldByName('USD累计余额').Asfloat:=0.00; end; procedure Tfrm_ch_genleg.bsSkinButton10Click(Sender: TObject); begin if (cbyear.text='') or (cbmonth.text='') then exit; t_ch_cust_genleg.Close; t_ch_cust_genleg.sql.Clear; t_ch_cust_genleg.sql.Add('select * from t_ch_cust_genleg where 年='+cbYear.text+' and 月='+cbmonth.text); t_ch_cust_genleg.open; t_ch_bank_genleg.Close; t_ch_bank_genleg.sql.Clear; t_ch_bank_genleg.sql.Add('select * from t_ch_bank_genleg where 年='+cbYear.text+' and 月='+cbmonth.text); t_ch_bank_genleg.open; t_ch_genleg.Close; t_ch_genleg.sql.Clear; t_ch_genleg.sql.Add('select * from t_ch_genleg where 年='+cbYear.text+' and 月='+cbmonth.text); t_ch_genleg.open; end; procedure Tfrm_ch_genleg.t_ch_cust_genlegDSDesigner4Change(Sender: TField); begin Sender.DataSet.FieldByName('年初余额').Asfloat:=Sender.DataSet.FieldByName('年初借方').Asfloat-Sender.DataSet.FieldByName('年初贷方').Asfloat; end; procedure Tfrm_ch_genleg.t_ch_cust_genlegDSDesigner7Change(Sender: TField); begin Sender.DataSet.FieldByName('本月余额').Asfloat:=Sender.DataSet.FieldByName('本月借方').Asfloat-Sender.DataSet.FieldByName('本月贷方').Asfloat; end; procedure Tfrm_ch_genleg.t_ch_cust_genlegUSDChange(Sender: TField); begin Sender.DataSet.FieldByName('USD年初余额').Asfloat:=Sender.DataSet.FieldByName('USD年初借方').Asfloat-Sender.DataSet.FieldByName('USD年初贷方').Asfloat; end; procedure Tfrm_ch_genleg.t_ch_cust_genlegUSD4Change(Sender: TField); begin Sender.DataSet.FieldByName('USD本月余额').Asfloat:=Sender.DataSet.FieldByName('USD本月借方').Asfloat-Sender.DataSet.FieldByName('USD本月贷方').Asfloat; end; procedure Tfrm_ch_genleg.bsSkinButton1Click(Sender: TObject); begin frmAccCloseOff:=TfrmAccCloseOff.create(self); try frmAccCloseOff.showmodal; finally FreeAndNil(frmAccCloseOff); end; cbYear.ItemIndex:=cbYear.Items.IndexOf(inttostr(Logininfo.offyear)); cbmonth.ItemIndex:=cbmonth.Items.IndexOf(inttostr(Logininfo.offmonth)); bsSkinButton10.OnClick(nil); end; procedure Tfrm_ch_genleg.bsSkinButton2Click(Sender: TObject); begin frmAccCloseOffBack:=TfrmAccCloseOffBack.create(self); try frmAccCloseOffBack.showmodal; finally FreeAndNil(frmAccCloseOffBack); end; cbYear.ItemIndex:=cbYear.Items.IndexOf(inttostr(Logininfo.offyear)); cbmonth.ItemIndex:=cbmonth.Items.IndexOf(inttostr(Logininfo.offmonth)); bsSkinButton10.OnClick(nil); end; procedure Tfrm_ch_genleg.FormShow(Sender: TObject); begin cbYear.ItemIndex:=cbYear.Items.IndexOf(inttostr(Logininfo.offyear)); cbmonth.ItemIndex:=cbmonth.Items.IndexOf(inttostr(Logininfo.offmonth)); bsSkinButton10.OnClick(nil); end; procedure Tfrm_ch_genleg.t_ch_curr_genlegAfterInsert(DataSet: TDataSet); begin DataSet.FieldByName('年').AsInteger:=strtoint(cbYear.text); DataSet.FieldByName('月').AsInteger:=strtoint(cbmonth.text); DataSet.FieldByName('银行代码').Asstring:='现金'; DataSet.FieldByName('本月借方').Asfloat:=0.00; DataSet.FieldByName('本月贷方').Asfloat:=0.00; DataSet.FieldByName('本月余额').Asfloat:=0.00; DataSet.FieldByName('累计借方').Asfloat:=0.00; DataSet.FieldByName('累计贷方').Asfloat:=0.00; DataSet.FieldByName('累计余额').Asfloat:=0.00; DataSet.FieldByName('USD本月借方').Asfloat:=0.00; DataSet.FieldByName('USD本月贷方').Asfloat:=0.00; DataSet.FieldByName('USD本月余额').Asfloat:=0.00; DataSet.FieldByName('USD累计借方').Asfloat:=0.00; DataSet.FieldByName('USD累计贷方').Asfloat:=0.00; DataSet.FieldByName('USD累计余额').Asfloat:=0.00; end; procedure Tfrm_ch_genleg.t_ch_cust_genlegDSDesigner10Change( Sender: TField); begin Sender.DataSet.FieldByName('累计余额').Asfloat:=Sender.DataSet.FieldByName('累计借方').Asfloat-Sender.DataSet.FieldByName('累计贷方').Asfloat; end; procedure Tfrm_ch_genleg.t_ch_cust_genlegUSD7Change(Sender: TField); begin Sender.DataSet.FieldByName('USD累计余额').Asfloat:=Sender.DataSet.FieldByName('USD累计借方').Asfloat-Sender.DataSet.FieldByName('USD累计贷方').Asfloat; end; procedure Tfrm_ch_genleg.bsSkinButton3Click(Sender: TObject); begin frm_ch_genleg_start:=Tfrm_ch_genleg_start.create(self); try frm_ch_genleg_start.showmodal; finally FreeAndNil(frm_ch_genleg_start); end; cbYear.ItemIndex:=cbYear.Items.IndexOf(inttostr(Logininfo.offyear)); cbmonth.ItemIndex:=cbmonth.Items.IndexOf(inttostr(Logininfo.offmonth)); bsSkinButton10.OnClick(nil); end; end.