unit u_rp_ch_feemodify; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, bsSkinCtrls, dxExEdtr, StdCtrls, DBCtrls, dxCntner, dxTL, dxDBCtrl, dxDBGrid, DB, ADODB, dxDBTLCl, dxGrClms, RxLookup, wwdbdatetimepicker, ExtCtrls, wwdblook, Menus, Mask, wwdbedit, Wwdotdot, Wwdbcomb; type Tfrm_rp_ch_feemodify = class(TForm) bsSkinPanel1: TbsSkinPanel; bsSkinPanel2: TbsSkinPanel; dxDBGrid1: TdxDBGrid; t_op_feemodify: TADOQuery; t_op_feemodify1: TDataSource; dxDBGrid1Column2: TdxDBGridMaskColumn; dxDBGrid1Column3: TdxDBGridMaskColumn; dxDBGrid1Column4: TdxDBGridMaskColumn; dxDBGrid1Column5: TdxDBGridMaskColumn; dxDBGrid1Column6: TdxDBGridMaskColumn; dxDBGrid1Column8: TdxDBGridMaskColumn; dxDBGrid1Column9: TdxDBGridMaskColumn; dxDBGrid1Column10: TdxDBGridMaskColumn; dxDBGrid1Column11: TdxDBGridMaskColumn; dxDBGrid1Column12: TdxDBGridMaskColumn; Label8: TLabel; wwDBDateTimePicker3: TwwDBDateTimePicker; Label11: TLabel; wwDBDateTimePicker4: TwwDBDateTimePicker; bsSkinButton10: TbsSkinButton; bsSkinButton5: TbsSkinButton; dxDBGrid1Column15: TdxDBGridColumn; dxDBGrid1Column16: TdxDBGridColumn; dxDBGrid1Column17: TdxDBGridColumn; dxDBGrid1Column18: TdxDBGridColumn; dxDBGrid1Column19: TdxDBGridColumn; lbl1: TLabel; wwDBLookupCombo49: TwwDBLookupCombo; lbl2: TLabel; edt1: TEdit; lbl3: TLabel; RxDBLookupCombo6: TRxDBLookupCombo; lbl4: TLabel; RxDBLookupCombo1: TRxDBLookupCombo; lbl5: TLabel; RxDBLookupCombo2: TRxDBLookupCombo; lbl6: TLabel; wwDBDateTimePicker1: TwwDBDateTimePicker; lbl7: TLabel; wwDBDateTimePicker2: TwwDBDateTimePicker; lbl8: TLabel; RxDBLookupCombo4: TRxDBLookupCombo; RxDBLookupCombo8: TRxDBLookupCombo; lbl9: TLabel; lbl10: TLabel; RxDBLookupCombo20: TRxDBLookupCombo; dxDBGrid1Column32: TdxDBGridColumn; bsSkinButton9: TbsSkinButton; PopupMenu2: TPopupMenu; N10: TMenuItem; N11: TMenuItem; N14: TMenuItem; N13: TMenuItem; N12: TMenuItem; N15: TMenuItem; N16: TMenuItem; dxDBGrid1Column20: TdxDBGridColumn; dxDBGrid1Column21: TdxDBGridColumn; dxDBGrid1Column22: TdxDBGridColumn; dxDBGrid1Column23: TdxDBGridColumn; dxDBGrid1Column24: TdxDBGridColumn; dxDBGrid1Column25: TdxDBGridColumn; dxDBGrid1Column26: TdxDBGridColumn; dxDBGrid1Column27: TdxDBGridColumn; Label1: TLabel; wwDBDateTimePicker5: TwwDBDateTimePicker; Label2: TLabel; wwDBDateTimePicker6: TwwDBDateTimePicker; dxDBGrid1Column28: TdxDBGridColumn; wwDBDateTimePicker7: TwwDBDateTimePicker; Label3: TLabel; wwDBDateTimePicker8: TwwDBDateTimePicker; Label4: TLabel; dxDBGrid1Column29: TdxDBGridColumn; dxDBGrid1Column30: TdxDBGridColumn; dxDBGrid1Column31: TdxDBGridColumn; Label44: TLabel; wwDBDateTimePicker9: TwwDBDateTimePicker; Label45: TLabel; wwDBDateTimePicker10: TwwDBDateTimePicker; dxDBGrid1Column33: TdxDBGridColumn; dxDBGrid1Column34: TdxDBGridColumn; Label38: TLabel; wwDBComboBox42: TwwDBComboBox; RxDBLookupCombo16: TRxDBLookupCombo; procedure bsSkinButton5Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormShow(Sender: TObject); procedure bsSkinButton10Click(Sender: TObject); procedure bsSkinButton9Click(Sender: TObject); procedure N10Click(Sender: TObject); procedure N14Click(Sender: TObject); procedure N12Click(Sender: TObject); procedure N16Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var frm_rp_ch_feemodify: Tfrm_rp_ch_feemodify; implementation uses u_main, my_sys_function; {$R *.dfm} procedure Tfrm_rp_ch_feemodify.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_rp_ch_feemodify.FormClose(Sender: TObject; var Action: TCloseAction); begin savereggrid(dxdbgrid1,caption); frm_rp_ch_feemodify.Hide; frm_rp_ch_feemodify.ManualFloat(frm_rp_ch_feemodify.BoundsRect ); frm_main.freeTabs('frm_rp_ch_feemodify'); action:=cafree; frm_rp_ch_feemodify:=nil; end; procedure Tfrm_rp_ch_feemodify.FormShow(Sender: TObject); begin loadreggrid(dxdbgrid1,false,caption); end; procedure Tfrm_rp_ch_feemodify.bsSkinButton10Click(Sender: TObject); var str:widestring; begin str:='where t_op_seae.费用状态=''费用封帐'' and t_ch_fee.录入日期>=(t_op_seae.费用封帐日期+1) and t_op_seae.费用封帐日期 is not null and t_ch_fee.费用状态 in (''审核通过'',''部分结算'',''结算完毕'') '; if RxDBLookupCombo6.DisplayValue<>''then begin if str=''then str:='where t_op_seae.操作员='+''''+RxDBLookupCombo6.DisplayValue+'''' else str:=str+' and t_op_seae.操作员='+''''+RxDBLookupCombo6.DisplayValue+''''; end; if RxDBLookupCombo1.DisplayValue<>''then begin if str=''then str:='where t_op_seae.揽货人='+''''+RxDBLookupCombo1.DisplayValue+'''' else str:=str+' and t_op_seae.揽货人='+''''+RxDBLookupCombo1.DisplayValue+''''; end; if wwDBLookupCombo49.Text<>'' then begin if str=''then str:='where t_op_seae.船名='+''''+wwDBLookupCombo49.Text+'''' else str:=str+' and t_op_seae.船名='+''''+wwDBLookupCombo49.Text+''''; end; if edt1.Text<>'' then begin if str=''then str:='where t_op_seae.航次='+''''+edt1.Text+'''' else str:=str+' and t_op_seae.航次='+''''+edt1.Text+''''; end; if RxDBLookupCombo2.DisplayValue<>''then begin if str=''then str:='where t_op_seae.委托单位='+''''+RxDBLookupCombo2.DisplayValues[1]+'''' else str:=str+' and t_op_seae.委托单位='+''''+RxDBLookupCombo2.DisplayValues[1]+''''; end; if RxDBLookupCombo4.DisplayValue<>''then begin if str=''then str:='where t_op_seae.船公司='+''''+RxDBLookupCombo4.DisplayValues[1]+'''' else str:=str+' and t_op_seae.船公司='+''''+RxDBLookupCombo4.DisplayValues[1]+''''; end; if RxDBLookupCombo8.DisplayValue<>''then begin if str=''then str:='where t_op_seae.货代公司='+''''+RxDBLookupCombo8.DisplayValues[1]+'''' else str:=str+' and t_op_seae.货代公司='+''''+RxDBLookupCombo8.DisplayValues[1]+''''; end; if RxDBLookupCombo20.DisplayValue<>''then begin if str=''then str:='where t_op_seae.航线='+''''+RxDBLookupCombo20.DisplayValues[1]+'''' else str:=str+' and t_op_seae.航线='+''''+RxDBLookupCombo20.DisplayValues[1]+''''; end; if wwDBDateTimePicker3.text<>''then begin if str=''then str:='where t_ch_fee.录入日期>='+''''+wwDBDateTimePicker3.text+'''' else str:=str+' and t_ch_fee.录入日期>='+''''+wwDBDateTimePicker3.text+''''; end; if wwDBDateTimePicker4.text<>''then begin if str=''then str:='where t_ch_fee.录入日期<='+''''+wwDBDateTimePicker4.text+' 23:59:59''' else str:=str+' and t_ch_fee.录入日期<='+''''+wwDBDateTimePicker4.text+' 23:59:59'''; end; if wwDBDateTimePicker8.text<>''then begin if str=''then str:='where t_ch_fee.审核日期>='+''''+wwDBDateTimePicker8.text+'''' else str:=str+' and t_ch_fee.审核日期>='+''''+wwDBDateTimePicker8.text+''''; end; if wwDBDateTimePicker7.text<>''then begin if str=''then str:='where t_ch_fee.审核日期<='+''''+wwDBDateTimePicker7.text+' 23:59:59''' else str:=str+' and t_ch_fee.审核日期<='+''''+wwDBDateTimePicker7.text+' 23:59:59'''; end; if wwDBDateTimePicker1.text<>''then begin if str=''then str:='where t_op_seae.开船日期>='+''''+wwDBDateTimePicker1.text+'''' else str:=str+' and t_op_seae.开船日期>='+''''+wwDBDateTimePicker1.text+''''; end; if wwDBDateTimePicker2.text<>''then begin if str=''then str:='where t_op_seae.开船日期<='+''''+wwDBDateTimePicker2.text+'''' else str:=str+' and t_op_seae.开船日期<='+''''+wwDBDateTimePicker2.text+''''; end; if wwDBDateTimePicker5.text<>''then begin if str=''then str:='where t_op_seae.预抵日期>='+''''+wwDBDateTimePicker5.text+'''' else str:=str+' and t_op_seae.预抵日期>='+''''+wwDBDateTimePicker5.text+''''; end; if wwDBDateTimePicker6.text<>''then begin if str=''then str:='where t_op_seae.预抵日期<='+''''+wwDBDateTimePicker6.text+'''' else str:=str+' and t_op_seae.预抵日期<='+''''+wwDBDateTimePicker6.text+''''; end; if wwDBDateTimePicker9.text<>''then begin if str=''then str:='where t_ch_fee.会计月份>='+''''+wwDBDateTimePicker9.text+'''' else str:=str+' and t_ch_fee.会计月份>='+''''+wwDBDateTimePicker9.text+''''; end; if wwDBDateTimePicker10.text<>''then begin if str=''then str:='where t_ch_fee.会计月份<='+''''+wwDBDateTimePicker10.text+'''' else str:=str+' and t_ch_fee.会计月份<='+''''+wwDBDateTimePicker10.text+''''; end; str:=query_tiaojian(1,str,'t_ch_fee.费用名称',wwDBComboBox42.text,RxDBLookupCombo16.DisplayValues[1]); t_op_feemodify.close; t_op_feemodify.sql.clear; t_op_feemodify.SQL.add('select t_ch_fee.CH_ID,t_ch_fee.类型,t_ch_fee.费用名称,t_ch_fee.客户名称,t_ch_fee.金额,t_ch_fee.币别,t_ch_fee.汇率,t_ch_fee.录入日期,t_ch_fee.录入人,t_op_seae.编号,t_op_seae.业务编号,t_op_seae.委托编号,t_op_seae.主提单号,'); t_op_feemodify.SQL.add('t_ch_fee.审核日期,t_ch_fee.审核人,t_ch_fee.会计月份,t_op_seae.分提单号,t_op_seae.委托单位,t_op_seae.集装箱,t_op_seae.操作员,'); t_op_feemodify.SQL.add('t_op_seae.客服员,t_op_seae.揽货人,t_op_seae.开船日期,t_op_seae.船名,t_op_seae.航次,'); t_op_feemodify.SQL.add('t_op_seae.航线,t_op_seae.船公司,t_op_seae.货代公司,t_op_seae.预抵日期,t_op_seae.费用封帐日期,(case when t_ch_fee.类型=''收'' then t_ch_fee.金额*t_ch_fee.汇率 else -t_ch_fee.金额*t_ch_fee.汇率 end) 增减利润 '); t_op_feemodify.SQL.add(' from t_op_seae left join t_ch_fee on (t_ch_fee.编号=t_op_seae.编号) '); t_op_feemodify.SQL.add(str+' order by 业务编号'); t_op_feemodify.open; end; procedure Tfrm_rp_ch_feemodify.bsSkinButton9Click(Sender: TObject); begin sys_print('费用封账后费用统计',2,nil,nil,nil,nil,t_op_feemodify1,nil,nil,nil,nil,nil,nil); end; procedure Tfrm_rp_ch_feemodify.N10Click(Sender: TObject); begin update_grid_view_no(dxdbgrid1); end; procedure Tfrm_rp_ch_feemodify.N14Click(Sender: TObject); begin update_grid_view_all(dxdbgrid1); end; procedure Tfrm_rp_ch_feemodify.N12Click(Sender: TObject); begin update_grid(dxdbgrid1,113); end; procedure Tfrm_rp_ch_feemodify.N16Click(Sender: TObject); begin grid_save_xls(dxdbgrid1); end; end.