unit u_ch_balance_accept_hexiao; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, dxExEdtr, XPMenu, Menus, DB, ADODB, ComCtrls, bsSkinTabs, u_ch_add_do, u_ch_delete_do, wwdbedit, Wwdotdot, Wwdbcomb, StdCtrls, DBCtrls, bsSkinCtrls, bsdbctrls, RxLookup, Mask, dxDBTLCl, dxGrClms, dxDBGrid, dxTL, dxDBCtrl, dxCntner, wwdbdatetimepicker, ToolEdit, RXDBCtrl, DBCtrlsEh; type Tfrm_ch_balance_accept_hexiao = class(TForm) bsSkinPanel2: TbsSkinPanel; bsSkinButton5: TbsSkinButton; bsSkinButton8: TbsSkinButton; bsSkinButton9: TbsSkinButton; bsSkinButton10: TbsSkinButton; bsSkinButton11: TbsSkinButton; bsSkinButton6: TbsSkinButton; bsSkinNotebook1: TbsSkinNotebook; dxDBGrid1: TdxDBGrid; dxDBGrid1Column1: TdxDBGridMaskColumn; dxDBGrid1Column2: TdxDBGridMaskColumn; dxDBGrid1Column5: TdxDBGridMaskColumn; dxDBGrid1Column3: TdxDBGridMaskColumn; dxDBGrid1Column4: TdxDBGridMaskColumn; dxDBGrid1Column6: TdxDBGridColumn; dxDBGrid1Column7: TdxDBGridColumn; dxDBGrid1Column8: TdxDBGridColumn; dxDBGrid1Column9: TdxDBGridMaskColumn; dxDBGrid1Column10: TdxDBGridMaskColumn; dxDBGrid1Column11: TdxDBGridMaskColumn; dxDBGrid1Column12: TdxDBGridDateColumn; dxDBGrid1Column15: TdxDBGridColumn; dxDBGrid1Column16: TdxDBGridColumn; dxDBGrid1Column13: TdxDBGridMaskColumn; dxDBGrid1Column14: TdxDBGridDateColumn; bsSkinPanel1: TbsSkinPanel; bsSkinPanel3: TbsSkinPanel; Label25: TLabel; Label17: TLabel; Label12: TLabel; Label1: TLabel; Label2: TLabel; Label3: TLabel; Label4: TLabel; Label5: TLabel; Label6: TLabel; Label7: TLabel; Label8: TLabel; Label9: TLabel; Label10: TLabel; DBEdit14: TDBEdit; DBEdit1: TDBEdit; DBEdit4: TDBEdit; DBEdit5: TDBEdit; DBEdit6: TDBEdit; DBEdit8: TDBEdit; DBEdit9: TDBEdit; DBEdit10: TDBEdit; DBMemo1: TDBMemo; RxDBLookupCombo2: TRxDBLookupCombo; wwDBComboBox1: TwwDBComboBox; RxDBLookupCombo3: TRxDBLookupCombo; fra_ch_delete_do1: Tfra_ch_delete_do; fra_ch_add_do1: Tfra_ch_add_do; t_ch_balance: TADOQuery; t_ch_balance1: TDataSource; t_ch_fee_do: TADOQuery; XPMenu1: TXPMenu; bsSkinButton1: TbsSkinButton; bsSkinButton2: TbsSkinButton; Label11: TLabel; PopupMenu3: TPopupMenu; N17: TMenuItem; N18: TMenuItem; N34: TMenuItem; N35: TMenuItem; N2: TMenuItem; N1: TMenuItem; N36: TMenuItem; bsSkinButton13: TbsSkinButton; bsSkinButton3: TbsSkinButton; DBEdit3: TDBEdit; Label13: TLabel; DBEdit7: TDBEdit; bsSkinButton38: TbsSkinButton; Label14: TLabel; RxDBLookupCombo1: TRxDBLookupCombo; dxDBGrid1Column17: TdxDBGridColumn; DBDateTimeEditEh1: TDBDateTimeEditEh; procedure bsSkinButton5Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure bsSkinPanel2Resize(Sender: TObject); procedure FormShow(Sender: TObject); procedure bsSkinButton11Click(Sender: TObject); procedure t_ch_balanceBeforePost(DataSet: TDataSet); procedure dxDBGrid1Column2CustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean); procedure bsSkinButton6Click(Sender: TObject); procedure bsSkinButton8Click(Sender: TObject); procedure bsSkinButton10Click(Sender: TObject); procedure t_ch_balanceAfterPost(DataSet: TDataSet); procedure t_ch_balanceBeforeEdit(DataSet: TDataSet); procedure bsSkinButton1Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton13Click(Sender: TObject); procedure N17Click(Sender: TObject); procedure N34Click(Sender: TObject); procedure N2Click(Sender: TObject); procedure N36Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton9Click(Sender: TObject); procedure bsSkinButton38Click(Sender: TObject); procedure bsSkinNotebook1PageChanged(Sender: TObject); procedure fra_ch_add_do1MenuItem1Click(Sender: TObject); private { Private declarations } procedure getdetail(balno:string); public { Public declarations } end; var ch_balance_accept_hexiao_open:boolean; frm_ch_balance_accept_hexiao: Tfrm_ch_balance_accept_hexiao; implementation uses u_main, u_data_share, u_ch_balance_query, my_sys_function, my_sys_chat; {$R *.dfm} procedure Tfrm_ch_balance_accept_hexiao.getdetail(balno:string); begin if StrToBool(get_parameters_value(85,'false')) then begin fra_ch_add_do1.bsSkinTabSheet1.TabVisible:=False; fra_ch_add_do1.bsSkinTabSheet2.TabVisible:=False; fra_ch_add_do1.bsSkinTabSheet3.TabVisible:=False; fra_ch_add_do1.bsSkinTabSheet4.TabVisible:=False; fra_ch_add_do1.bsSkinTabSheet5.TabVisible:=True; fra_ch_add_do1.bsSkinPageControl1.TabIndex:=0; fra_ch_delete_do1.bsSkinTabSheet1.TabVisible:=false; fra_ch_delete_do1.bsSkinTabSheet2.TabVisible:=false; fra_ch_delete_do1.bsSkinTabSheet3.TabVisible:=false; fra_ch_delete_do1.bsSkinTabSheet4.TabVisible:=false; fra_ch_delete_do1.bsSkinTabSheet5.TabVisible:=True; fra_ch_delete_do1.bsSkinPageControl1.ActivePage:=fra_ch_delete_do1.bsSkinTabSheet5; end else begin fra_ch_add_do1.bsSkinTabSheet1.TabVisible:=True; fra_ch_add_do1.bsSkinTabSheet2.TabVisible:=True; fra_ch_add_do1.bsSkinTabSheet3.TabVisible:=True; fra_ch_add_do1.bsSkinTabSheet4.TabVisible:=True; fra_ch_add_do1.bsSkinPageControl1.ActivePage:=fra_ch_add_do1.bsSkinTabSheet1; fra_ch_add_do1.bsSkinTabSheet5.TabVisible:=False; fra_ch_delete_do1.bsSkinTabSheet1.TabVisible:=True; fra_ch_delete_do1.bsSkinTabSheet2.TabVisible:=True; fra_ch_delete_do1.bsSkinTabSheet3.TabVisible:=True; fra_ch_delete_do1.bsSkinTabSheet4.TabVisible:=True; fra_ch_delete_do1.bsSkinTabSheet5.TabVisible:=false; fra_ch_delete_do1.bsSkinPageControl1.ActivePage:=fra_ch_delete_do1.bsSkinTabSheet1; end; if StrToBool(get_parameters_value(85,'false')) then begin fra_ch_delete_do1.v_fee_do_bscard.close; fra_ch_delete_do1.v_fee_do_bscard.SQL.clear; fra_ch_delete_do1.v_fee_do_bscard.sql.add('select * from v_fee_do_bscard ' +'where 工作编号='''+t_ch_balance.fieldbyname('帐单编号').asstring+''' order by 类型,编号,费用名称'); fra_ch_delete_do1.v_fee_do_bscard.Open; fra_ch_delete_do1.v_fee_do_bscard_sum.close; fra_ch_delete_do1.v_fee_do_bscard_sum.SQL.clear; fra_ch_delete_do1.v_fee_do_bscard_sum.sql.add('select 类型,SUBSTRING(CONVERT(char(15),开船日期,111),1,7) AS 月份,揽货人,原始币别,sum(原始金额) as 原始金额,sum(金额) as 金额 from v_fee_do_bscard ' +'where 工作编号='''+t_ch_balance.fieldbyname('帐单编号').asstring+''' group by 类型,SUBSTRING(CONVERT(char(15),开船日期,111),1,7),揽货人,原始币别 ' +'order by 类型,揽货人,SUBSTRING(CONVERT(char(15),开船日期,111),1,7),原始币别'); fra_ch_delete_do1.v_fee_do_bscard_sum.Open; end else begin fra_ch_delete_do1.v_fee_do_seae.close; fra_ch_delete_do1.v_fee_do_seae.SQL.clear; fra_ch_delete_do1.v_fee_do_seae.sql.add('select * from v_fee_do_seae ' +'where 工作编号='''+t_ch_balance.fieldbyname('帐单编号').asstring+''' order by 类型,编号,费用名称'); fra_ch_delete_do1.v_fee_do_seae.Open; fra_ch_delete_do1.v_fee_do_seai.close; fra_ch_delete_do1.v_fee_do_seai.SQL.clear; fra_ch_delete_do1.v_fee_do_seai.sql.add('select * from v_fee_do_seai ' +'where 工作编号='''+t_ch_balance.fieldbyname('帐单编号').asstring+''' order by 类型,编号,费用名称'); fra_ch_delete_do1.v_fee_do_seai.Open; fra_ch_delete_do1.v_fee_do_aire.close; fra_ch_delete_do1.v_fee_do_aire.SQL.clear; fra_ch_delete_do1.v_fee_do_aire.sql.add('select * from v_fee_do_aire ' +'where 工作编号='''+t_ch_balance.fieldbyname('帐单编号').asstring+''' order by 类型,编号,费用名称'); fra_ch_delete_do1.v_fee_do_aire.Open; fra_ch_delete_do1.v_fee_do_airi.close; fra_ch_delete_do1.v_fee_do_airi.SQL.clear; fra_ch_delete_do1.v_fee_do_airi.sql.add('select * from v_fee_do_airi ' +'where 工作编号='''+t_ch_balance.fieldbyname('帐单编号').asstring+''' order by 类型,编号,费用名称'); fra_ch_delete_do1.v_fee_do_airi.Open; fra_ch_delete_do1.v_fee_do_seae_sum.close; fra_ch_delete_do1.v_fee_do_seae_sum.SQL.clear; fra_ch_delete_do1.v_fee_do_seae_sum.sql.add('select 类型,SUBSTRING(CONVERT(char(15),开船日期,111),1,7) AS 月份,揽货人,原始币别,sum(原始金额) as 原始金额,sum(金额) as 金额 from v_fee_do_seae ' +'where 工作编号='''+t_ch_balance.fieldbyname('帐单编号').asstring+''' group by 类型,SUBSTRING(CONVERT(char(15),开船日期,111),1,7),揽货人,原始币别 ' +'order by 类型,揽货人,SUBSTRING(CONVERT(char(15),开船日期,111),1,7),原始币别'); fra_ch_delete_do1.v_fee_do_seae_sum.Open; fra_ch_delete_do1.v_fee_do_seai_sum.close; fra_ch_delete_do1.v_fee_do_seai_sum.SQL.clear; fra_ch_delete_do1.v_fee_do_seai_sum.sql.add('select 类型,SUBSTRING(CONVERT(char(15),进口日期,111),1,7) AS 月份,揽货人,原始币别,sum(原始金额) as 原始金额,sum(金额) as 金额 from v_fee_do_seai ' +'where 工作编号='''+t_ch_balance.fieldbyname('帐单编号').asstring+''' group by 类型,SUBSTRING(CONVERT(char(15),进口日期,111),1,7),揽货人,原始币别 ' +'order by 类型,揽货人,SUBSTRING(CONVERT(char(15),进口日期,111),1,7),原始币别'); fra_ch_delete_do1.v_fee_do_seai_sum.Open; fra_ch_delete_do1.v_fee_do_aire_sum.close; fra_ch_delete_do1.v_fee_do_aire_sum.SQL.clear; fra_ch_delete_do1.v_fee_do_aire_sum.sql.add('select 类型,SUBSTRING(CONVERT(char(15),开航日期,111),1,7) AS 月份,揽货人,原始币别,sum(原始金额) as 原始金额,sum(金额) as 金额 from v_fee_do_aire ' +'where 工作编号='''+t_ch_balance.fieldbyname('帐单编号').asstring+''' group by 类型,SUBSTRING(CONVERT(char(15),开航日期,111),1,7),揽货人,原始币别 ' +'order by 类型,揽货人,SUBSTRING(CONVERT(char(15),开航日期,111),1,7),原始币别'); fra_ch_delete_do1.v_fee_do_aire_sum.Open; fra_ch_delete_do1.v_fee_do_airi_sum.close; fra_ch_delete_do1.v_fee_do_airi_sum.SQL.clear; fra_ch_delete_do1.v_fee_do_airi_sum.sql.add('select 类型,SUBSTRING(CONVERT(char(15),进口日期,111),1,7) AS 月份,揽货人,原始币别,sum(原始金额) as 原始金额,sum(金额) as 金额 from v_fee_do_airi ' +'where 工作编号='''+t_ch_balance.fieldbyname('帐单编号').asstring+''' group by 类型,SUBSTRING(CONVERT(char(15),进口日期,111),1,7),揽货人,原始币别 ' +'order by 类型,揽货人,SUBSTRING(CONVERT(char(15),进口日期,111),1,7),原始币别'); fra_ch_delete_do1.v_fee_do_airi_sum.Open; end; end; procedure Tfrm_ch_balance_accept_hexiao.bsSkinButton5Click( Sender: TObject); begin close; end; procedure Tfrm_ch_balance_accept_hexiao.FormClose(Sender: TObject; var Action: TCloseAction); begin ch_balance_accept_hexiao_open:=false; frm_ch_balance_accept_hexiao.Hide; frm_ch_balance_accept_hexiao.ManualFloat(frm_ch_balance_accept_hexiao.BoundsRect ); frm_main.freeTabs('frm_ch_balance_accept_hexiao'); action:=cafree; frm_ch_balance_accept_hexiao:=nil; end; procedure Tfrm_ch_balance_accept_hexiao.bsSkinPanel2Resize( Sender: TObject); var i:integer; begin i:=round(bsSkinPanel2.Width/10); bsSkinButton9.Width:=i; bsSkinButton10.Width:=i; bsSkinButton11.Width:=i; bsSkinButton6.Width:=i; bsSkinButton8.Width:=i; bsSkinButton1.Width:=i; bsSkinButton2.Width:=i; bsSkinButton3.Width:=i; bsSkinButton38.Width:=i; bsSkinButton13.Left:=bsSkinPanel2.Width-bsSkinButton13.Width-20; end; procedure Tfrm_ch_balance_accept_hexiao.FormShow(Sender: TObject); begin bsSkinNotebook1.PageIndex:=0; t_ch_balance.Close; t_ch_balance.SQL.clear; t_ch_balance.SQL.Add('select * from t_ch_balance where 帐单状态<>'+''''+'审核通过'+'''' +' and 类型='+''''+'收'+'''' +' and '+open_data('1003','核销人','no','no','no','no') +' and 结算类别='+''''+'流程'+''''+' order by 帐单编号 desc'); t_ch_balance.open; ch_balance_accept_hexiao_open:=true; if StrToBool(get_parameters_value(85,'false')) then begin fra_ch_add_do1.bsSkinTabSheet1.TabVisible:=False; fra_ch_add_do1.bsSkinTabSheet2.TabVisible:=False; fra_ch_add_do1.bsSkinTabSheet3.TabVisible:=False; fra_ch_add_do1.bsSkinTabSheet4.TabVisible:=False; fra_ch_add_do1.bsSkinTabSheet5.TabVisible:=True; fra_ch_add_do1.bsSkinPageControl1.TabIndex:=0; fra_ch_delete_do1.bsSkinTabSheet1.TabVisible:=false; fra_ch_delete_do1.bsSkinTabSheet2.TabVisible:=false; fra_ch_delete_do1.bsSkinTabSheet3.TabVisible:=false; fra_ch_delete_do1.bsSkinTabSheet4.TabVisible:=false; fra_ch_delete_do1.bsSkinTabSheet5.TabVisible:=True; fra_ch_delete_do1.bsSkinPageControl1.ActivePage:=fra_ch_delete_do1.bsSkinTabSheet5; end else begin fra_ch_add_do1.bsSkinTabSheet1.TabVisible:=True; fra_ch_add_do1.bsSkinTabSheet2.TabVisible:=True; fra_ch_add_do1.bsSkinTabSheet3.TabVisible:=True; fra_ch_add_do1.bsSkinTabSheet4.TabVisible:=True; fra_ch_add_do1.bsSkinPageControl1.ActivePage:=fra_ch_add_do1.bsSkinTabSheet1; fra_ch_add_do1.bsSkinTabSheet5.TabVisible:=False; fra_ch_delete_do1.bsSkinTabSheet1.TabVisible:=True; fra_ch_delete_do1.bsSkinTabSheet2.TabVisible:=True; fra_ch_delete_do1.bsSkinTabSheet3.TabVisible:=True; fra_ch_delete_do1.bsSkinTabSheet4.TabVisible:=True; fra_ch_delete_do1.bsSkinTabSheet5.TabVisible:=false; fra_ch_delete_do1.bsSkinPageControl1.ActivePage:=fra_ch_delete_do1.bsSkinTabSheet1; end; if StrToBool(get_parameters_value(85,'false')) then begin fra_ch_delete_do1.v_fee_do_bscard.close; fra_ch_delete_do1.v_fee_do_bscard.SQL.clear; fra_ch_delete_do1.v_fee_do_bscard.sql.add('select * from v_fee_do_bscard ' +'where 工作编号='''+t_ch_balance.fieldbyname('帐单编号').asstring+''' order by 类型,编号,费用名称'); fra_ch_delete_do1.v_fee_do_bscard.Open; fra_ch_delete_do1.v_fee_do_bscard_sum.close; fra_ch_delete_do1.v_fee_do_bscard_sum.SQL.clear; fra_ch_delete_do1.v_fee_do_bscard_sum.sql.add('select 类型,SUBSTRING(CONVERT(char(15),开船日期,111),1,7) AS 月份,揽货人,原始币别,sum(原始金额) as 原始金额,sum(金额) as 金额 from v_fee_do_bscard ' +'where 工作编号='''+t_ch_balance.fieldbyname('帐单编号').asstring+''' group by 类型,SUBSTRING(CONVERT(char(15),开船日期,111),1,7),揽货人,原始币别 ' +'order by 类型,揽货人,SUBSTRING(CONVERT(char(15),开船日期,111),1,7),原始币别'); fra_ch_delete_do1.v_fee_do_bscard_sum.Open; fra_ch_add_do1.do_ban_fee1.DataSet:=fra_ch_delete_do1.v_fee_do_bscard; end else begin fra_ch_delete_do1.v_fee_do_seae.close; fra_ch_delete_do1.v_fee_do_seae.SQL.clear; fra_ch_delete_do1.v_fee_do_seae.sql.add('select * from v_fee_do_seae ' +'where 工作编号='''+t_ch_balance.fieldbyname('帐单编号').asstring+''' order by 类型,编号,费用名称'); fra_ch_delete_do1.v_fee_do_seae.Open; fra_ch_delete_do1.v_fee_do_seai.close; fra_ch_delete_do1.v_fee_do_seai.SQL.clear; fra_ch_delete_do1.v_fee_do_seai.sql.add('select * from v_fee_do_seai ' +'where 工作编号='''+t_ch_balance.fieldbyname('帐单编号').asstring+''' order by 类型,编号,费用名称'); fra_ch_delete_do1.v_fee_do_seai.Open; fra_ch_delete_do1.v_fee_do_aire.close; fra_ch_delete_do1.v_fee_do_aire.SQL.clear; fra_ch_delete_do1.v_fee_do_aire.sql.add('select * from v_fee_do_aire ' +'where 工作编号='''+t_ch_balance.fieldbyname('帐单编号').asstring+''' order by 类型,编号,费用名称'); fra_ch_delete_do1.v_fee_do_aire.Open; fra_ch_delete_do1.v_fee_do_airi.close; fra_ch_delete_do1.v_fee_do_airi.SQL.clear; fra_ch_delete_do1.v_fee_do_airi.sql.add('select * from v_fee_do_airi ' +'where 工作编号='''+t_ch_balance.fieldbyname('帐单编号').asstring+''' order by 类型,编号,费用名称'); fra_ch_delete_do1.v_fee_do_airi.Open; fra_ch_delete_do1.v_fee_do_seae_sum.close; fra_ch_delete_do1.v_fee_do_seae_sum.SQL.clear; fra_ch_delete_do1.v_fee_do_seae_sum.sql.add('select 类型,SUBSTRING(CONVERT(char(15),开船日期,111),1,7) AS 月份,揽货人,原始币别,sum(原始金额) as 原始金额,sum(金额) as 金额 from v_fee_do_seae ' +'where 工作编号='''+t_ch_balance.fieldbyname('帐单编号').asstring+''' group by 类型,SUBSTRING(CONVERT(char(15),开船日期,111),1,7),揽货人,原始币别 ' +'order by 类型,揽货人,SUBSTRING(CONVERT(char(15),开船日期,111),1,7),原始币别'); fra_ch_delete_do1.v_fee_do_seae_sum.Open; fra_ch_delete_do1.v_fee_do_seai_sum.close; fra_ch_delete_do1.v_fee_do_seai_sum.SQL.clear; fra_ch_delete_do1.v_fee_do_seai_sum.sql.add('select 类型,SUBSTRING(CONVERT(char(15),进口日期,111),1,7) AS 月份,揽货人,原始币别,sum(原始金额) as 原始金额,sum(金额) as 金额 from v_fee_do_seai ' +'where 工作编号='''+t_ch_balance.fieldbyname('帐单编号').asstring+''' group by 类型,SUBSTRING(CONVERT(char(15),进口日期,111),1,7),揽货人,原始币别 ' +'order by 类型,揽货人,SUBSTRING(CONVERT(char(15),进口日期,111),1,7),原始币别'); fra_ch_delete_do1.v_fee_do_seai_sum.Open; fra_ch_delete_do1.v_fee_do_aire_sum.close; fra_ch_delete_do1.v_fee_do_aire_sum.SQL.clear; fra_ch_delete_do1.v_fee_do_aire_sum.sql.add('select 类型,SUBSTRING(CONVERT(char(15),开航日期,111),1,7) AS 月份,揽货人,原始币别,sum(原始金额) as 原始金额,sum(金额) as 金额 from v_fee_do_aire ' +'where 工作编号='''+t_ch_balance.fieldbyname('帐单编号').asstring+''' group by 类型,SUBSTRING(CONVERT(char(15),开航日期,111),1,7),揽货人,原始币别 ' +'order by 类型,揽货人,SUBSTRING(CONVERT(char(15),开航日期,111),1,7),原始币别'); fra_ch_delete_do1.v_fee_do_aire_sum.Open; fra_ch_delete_do1.v_fee_do_airi_sum.close; fra_ch_delete_do1.v_fee_do_airi_sum.SQL.clear; fra_ch_delete_do1.v_fee_do_airi_sum.sql.add('select 类型,SUBSTRING(CONVERT(char(15),进口日期,111),1,7) AS 月份,揽货人,原始币别,sum(原始金额) as 原始金额,sum(金额) as 金额 from v_fee_do_airi ' +'where 工作编号='''+t_ch_balance.fieldbyname('帐单编号').asstring+''' group by 类型,SUBSTRING(CONVERT(char(15),进口日期,111),1,7),揽货人,原始币别 ' +'order by 类型,揽货人,SUBSTRING(CONVERT(char(15),进口日期,111),1,7),原始币别'); fra_ch_delete_do1.v_fee_do_airi_sum.Open; fra_ch_add_do1.do_ban_fee1.DataSet:=fra_ch_delete_do1.v_fee_do_seae; end; fra_ch_add_do1.do_ban1.DataSet:=t_ch_balance; fra_ch_add_do1.bs_text.text:='3'; fra_ch_add_do1.t_ch_fee_do.open; if StrToBool(get_parameters_value(83,'false')) then begin RxDBLookupCombo1.Visible:=TRUE; Label14.Visible:=true; end else begin RxDBLookupCombo1.Visible:=false; Label14.Visible:=false; Label6.Caption:='银 行'; end; fra_ch_delete_do1.bs_text.Text:='3'; fra_ch_delete_do1.do_ban1.DataSet:=t_ch_balance; end; procedure Tfrm_ch_balance_accept_hexiao.bsSkinButton11Click( Sender: TObject); var answer:TModalResult; begin if bsSkinButton11.Caption='编辑修改' then begin if t_ch_balance.IsEmpty then exit; bsSkinNotebook1.PageIndex:=1; bsSkinButton11.Caption:='返回列表'; end else begin if (t_ch_balance.State=dsinsert)or(t_ch_balance.State=dsedit) then BEGIN answer:=messagedlg( '数据已经修改,是否保存?',mtWarning,mbYesNoCancel,0); if answer=mrYes then begin t_ch_balance.post; end; if answer=mrNo then begin t_ch_balance.cancel; end; if answer=mrCancel then begin exit; end; END; bsSkinNotebook1.PageIndex:=0; bsSkinButton11.Caption:='编辑修改'; end; end; procedure Tfrm_ch_balance_accept_hexiao.t_ch_balanceBeforePost( DataSet: TDataSet); begin t_ch_balance['结算金额']:=s_w(strtoint(get_parameters_value(65,'2')),t_ch_balance['结算金额']); t_ch_balance['实结金额']:=s_w(strtoint(get_parameters_value(65,'2')),t_ch_balance['实结金额']); t_ch_balance['虚结金额']:=s_w(strtoint(get_parameters_value(65,'2')),t_ch_balance['虚结金额']); t_ch_balance['帐单状态']:=t_ch_balance['帐单状态']; t_ch_balance['虚结金额']:=t_ch_balance['结算金额']-t_ch_balance['实结金额']; end; procedure Tfrm_ch_balance_accept_hexiao.dxDBGrid1Column2CustomDraw( Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean); begin if (ANode.strings[dxDBGrid1Column2.Index]='录入状态') then AColor :=clwhite else if (ANode.strings[dxDBGrid1Column2.Index]='提交核销') then AColor :=$0080FFFF else if (ANode.strings[dxDBGrid1Column2.Index]='确认核销') then AColor :=$0080FF80 else if (ANode.strings[dxDBGrid1Column2.Index]='提交审核') then AColor :=$0000FF80 else if (ANode.strings[dxDBGrid1Column2.Index]='审核通过') then AColor :=clLime; AFont.Color:=clblack; end; procedure Tfrm_ch_balance_accept_hexiao.bsSkinButton6Click( Sender: TObject); begin if t_ch_balance.IsEmpty then exit; if t_ch_balance.FieldByName('帐单状态').asstring<>'提交核销'then begin showmessage('帐单状态不能确认核销!!'); end else begin try modify_all:=true; t_ch_balance.edit; t_ch_balance['帐单状态']:='确认核销'; t_ch_balance['核销人']:=employee; t_ch_balance.post; modify_all:=false; except modify_all:=false; t_ch_balance.cancel; showmessage('确认核销失败!!'); end; end; end; procedure Tfrm_ch_balance_accept_hexiao.bsSkinButton8Click( Sender: TObject); begin if t_ch_balance.IsEmpty then exit; if t_ch_balance.FieldByName('帐单状态').asstring<>'确认核销'then begin showmessage('帐单状态不能取消确认核销!!'); end else begin if t_ch_balance.fieldbyname('实结金额').asfloat<>0 then begin showmessage('当前帐单已经实现了核销,不能取消确认核销!!'); exit; end; try modify_all:=true; t_ch_balance.edit; t_ch_balance['帐单状态']:='提交核销'; t_ch_balance.post; modify_all:=false; except modify_all:=false; t_ch_balance.cancel; showmessage('取消确认核销失败!!'); end; end; end; procedure Tfrm_ch_balance_accept_hexiao.bsSkinButton10Click( Sender: TObject); begin try frm_ch_balance_query:=tfrm_ch_balance_query.Create (self); balance_query_type:=2; frm_ch_balance_query.ShowModal; bsSkinNotebook1.PageIndex:=0; finally frm_ch_balance_query.Free; end; end; procedure Tfrm_ch_balance_accept_hexiao.t_ch_balanceAfterPost( DataSet: TDataSet); begin if StrToBool(get_parameters_value(85,'false')) then begin fra_ch_delete_do1.v_fee_do_bscard.DisableControls; fra_ch_delete_do1.v_fee_do_bscard_sum.DisableControls; fra_ch_delete_do1.v_fee_do_bscard.Requery; fra_ch_delete_do1.v_fee_do_bscard_sum.Requery; fra_ch_delete_do1.v_fee_do_bscard.EnableControls; fra_ch_delete_do1.v_fee_do_bscard_sum.EnableControls; if fra_ch_add_do1.V_op_BSCARD.Active then begin fra_ch_add_do1.t_ch_fee.Requery(); fra_ch_add_do1.t_ch_fee_sum.Requery(); end; end else begin case delete_do_type_num of 1: begin fra_ch_delete_do1.v_fee_do_seae.Requery; fra_ch_delete_do1.v_fee_do_seae_sum.Requery; end; 2: begin fra_ch_delete_do1.v_fee_do_seai.Requery; fra_ch_delete_do1.v_fee_do_seai_sum.Requery; end; 3: begin fra_ch_delete_do1.v_fee_do_aire.Requery; fra_ch_delete_do1.v_fee_do_aire_sum.Requery; end; 4: begin fra_ch_delete_do1.v_fee_do_airi.Requery; fra_ch_delete_do1.v_fee_do_airi_sum.Requery; end; 5: begin fra_ch_delete_do1.v_fee_do_seae.Requery; fra_ch_delete_do1.v_fee_do_seae_sum.Requery; fra_ch_delete_do1.v_fee_do_seai.Requery; fra_ch_delete_do1.v_fee_do_seai_sum.Requery; fra_ch_delete_do1.v_fee_do_aire.Requery; fra_ch_delete_do1.v_fee_do_aire_sum.Requery; fra_ch_delete_do1.v_fee_do_airi.Requery; fra_ch_delete_do1.v_fee_do_airi_sum.Requery; end; end; case delete_do_type_num of 1,2,3,4,5: begin check_do_sum(3,t_ch_balance, fra_ch_delete_do1.v_fee_do_seae_sum,fra_ch_delete_do1.v_fee_do_seai_sum, fra_ch_delete_do1.v_fee_do_aire_sum,fra_ch_delete_do1.v_fee_do_airi_sum); end; end; if if_ch_delete_do then begin case delete_do_type_num of 1,2,3,4: begin if fra_ch_add_do1.t_op_seae.Active then begin fra_ch_add_do1.t_ch_fee.Requery(); fra_ch_add_do1.t_ch_fee_sum.Requery(); end; end; end; end; end; delete_do_type_num:=0; if_ch_delete_do:=false; end; procedure Tfrm_ch_balance_accept_hexiao.t_ch_balanceBeforeEdit( DataSet: TDataSet); var sdate:tdate; begin if not modify_all then begin if (t_ch_balance.FieldByName('帐单状态').asstring<>'确认核销')then begin showmessage('当前业务操作的状态不允许更改'); abort; end; end; sdate:=EncodeDate(Logininfo.offyear,Logininfo.offmonth,1); if not t_ch_balance.FieldByName('结算日期').IsNull then if sdate>t_ch_balance['结算日期'] then begin MessageDlg('此票结算单已月末结账,如果删除请先反结账!',mtError,[mbok],0); abort; end; end; procedure Tfrm_ch_balance_accept_hexiao.bsSkinButton1Click( Sender: TObject); begin if t_ch_balance.IsEmpty then exit; if t_ch_balance.FieldByName('帐单状态').asstring<>'确认核销'then begin showmessage('帐单状态不能提交审核!!'); end else begin try modify_all:=true; t_ch_balance.edit; t_ch_balance['帐单状态']:='提交审核'; if t_ch_balance['核销日期']=null then t_ch_balance['核销日期']:=now; if t_ch_balance['核销日期']<>null then t_ch_balance['结算日期']:=t_ch_balance['核销日期']; t_ch_balance.post; Send_invocie_check_check('收费核销完毕,帐单编号:'+t_ch_balance.fieldbyname('帐单编号').asstring +',客户:'+t_ch_balance.fieldbyname('客户名称').asstring,t_ch_balance.fieldbyname('结算人').asstring,'32'); modify_all:=false; except modify_all:=false; t_ch_balance.cancel; showmessage('提交审核失败!!'); end; end; end; procedure Tfrm_ch_balance_accept_hexiao.bsSkinButton2Click( Sender: TObject); begin if t_ch_balance.IsEmpty then exit; if t_ch_balance.FieldByName('帐单状态').asstring<>'提交审核'then begin showmessage('帐单状态不能取消提交审核!!'); end else begin try if t_ch_balance.State in [dsEdit,dsinsert] then t_ch_balance.Post; modify_all:=true; t_ch_balance.edit; t_ch_balance['帐单状态']:='确认核销'; t_ch_balance['核销日期']:=null; t_ch_balance.post; modify_all:=false; except on e : exception do begin modify_all:=false; t_ch_balance.cancel; showmessage('取消提交审核失败!!'+e.Message); end; end; end; end; procedure Tfrm_ch_balance_accept_hexiao.bsSkinButton13Click( Sender: TObject); var Pnt:Tpoint; begin Pnt:=bsSkinButton13.ClientToScreen(Point(0,bsSkinButton13.Height)); PopupMenu3.Popup(Pnt.x,Pnt.y); end; procedure Tfrm_ch_balance_accept_hexiao.N17Click(Sender: TObject); begin t_ch_balance.Close; t_ch_balance.SQL.clear; t_ch_balance.SQL.Add('select * from t_ch_balance where 帐单状态='+''''+'录入状态'+'''' +' and 类型='+''''+'收'+''''+' and 核销人='+''''+employee+'''' +' and 结算类别='+''''+'流程'+'''' +' order by 帐单编号 desc'); t_ch_balance.open; end; procedure Tfrm_ch_balance_accept_hexiao.N34Click(Sender: TObject); begin t_ch_balance.Close; t_ch_balance.SQL.clear; t_ch_balance.SQL.Add('select * from t_ch_balance where 帐单状态='+''''+'提交核销'+'''' +' and 类型='+''''+'收'+''''+' and 核销人='+''''+employee+'''' +' and 结算类别='+''''+'流程'+'''' +' order by 帐单编号 desc'); t_ch_balance.open; end; procedure Tfrm_ch_balance_accept_hexiao.N2Click(Sender: TObject); begin t_ch_balance.Close; t_ch_balance.SQL.clear; t_ch_balance.SQL.Add('select * from t_ch_balance where 帐单状态='+''''+'确认核销'+'''' +' and 类型='+''''+'收'+''''+' and 核销人='+''''+employee+'''' +' and 结算类别='+''''+'流程'+'''' +' order by 帐单编号 desc'); t_ch_balance.open; end; procedure Tfrm_ch_balance_accept_hexiao.N36Click(Sender: TObject); begin t_ch_balance.Close; t_ch_balance.SQL.clear; t_ch_balance.SQL.Add('select * from t_ch_balance where 帐单状态='+''''+'提交审核'+'''' +' and 类型='+''''+'收'+''''+' and 核销人='+''''+employee+'''' +' and 结算类别='+''''+'流程'+'''' +' order by 帐单编号 desc'); t_ch_balance.open; end; procedure Tfrm_ch_balance_accept_hexiao.bsSkinButton3Click( Sender: TObject); begin table_post(t_ch_balance); end; procedure Tfrm_ch_balance_accept_hexiao.bsSkinButton9Click( Sender: TObject); begin if StrToBool(get_parameters_value(85,'false')) then begin sys_print('应收费用结算',2,t_ch_balance1,nil,nil,nil, fra_ch_delete_do1.v_fee_do_bscard1,nil, nil,nil, t_ch_balance1,fra_ch_delete_do1.v_fee_do_bscard_sum1,nil); end else begin sys_print('应收费用结算',2,t_ch_balance1,nil,nil,nil, fra_ch_delete_do1.v_fee_do_seae1,fra_ch_delete_do1.v_fee_do_seai1, fra_ch_delete_do1.v_fee_do_aire1,fra_ch_delete_do1.v_fee_do_airi1, t_ch_balance1,fra_ch_delete_do1.v_fee_do_seae_sum1,fra_ch_delete_do1.v_fee_do_seai_sum1); end; end; procedure Tfrm_ch_balance_accept_hexiao.bsSkinButton38Click( Sender: TObject); var book1:Tbookmark; begin bsSkinNotebook1.PageIndex:=0; book1:=t_ch_balance.GetBookmark; t_ch_balance.Requery; t_ch_balance.GotoBookmark(book1); end; procedure Tfrm_ch_balance_accept_hexiao.bsSkinNotebook1PageChanged( Sender: TObject); begin if not ch_balance_accept_hexiao_open then exit; if bsSkinNotebook1.PageIndex<>1 then exit; getdetail(''); end; procedure Tfrm_ch_balance_accept_hexiao.fra_ch_add_do1MenuItem1Click( Sender: TObject); begin fra_ch_add_do1.MenuItem1Click(Sender); end; end.