unit u_rp_tai_seae_pin; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, bsSkinCtrls, DB, ADODB,wwdbdatetimepicker, StdCtrls, wwdblook, RxLookup, Menus, XPMenu, Mask, wwdbedit, Wwdotdot, Wwdbcomb, dxExEdtr, dxDBTLCl, dxGrClms, dxTL, dxDBCtrl, dxDBGrid, dxCntner; type Tfrm_rp_tai_seae_pin = class(TForm) bsSkinPanel1: TbsSkinPanel; p_seae_pin1: TDataSource; dxDBGrid1: TdxDBGrid; p_seae_pin: TADOStoredProc; dxDBGrid1Column5: TdxDBGridColumn; dxDBGrid1Column3: TdxDBGridColumn; dxDBGrid1Column4: TdxDBGridColumn; dxDBGrid1Column6: TdxDBGridColumn; dxDBGrid1Column7: TdxDBGridColumn; dxDBGrid1Column8: TdxDBGridColumn; dxDBGrid1Column9: TdxDBGridColumn; dxDBGrid1Column10: TdxDBGridColumn; dxDBGrid1Column11: TdxDBGridColumn; dxDBGrid1Column12: TdxDBGridColumn; dxDBGrid1Column19: TdxDBGridColumn; dxDBGrid1Column21: TdxDBGridColumn; dxDBGrid1Column22: TdxDBGridColumn; dxDBGrid1Column23: TdxDBGridColumn; dxDBGrid1Column24: TdxDBGridColumn; dxDBGrid1Column25: TdxDBGridColumn; dxDBGrid1Column26: TdxDBGridColumn; dxDBGrid1Column28: TdxDBGridColumn; dxDBGrid1Column30: TdxDBGridColumn; dxDBGrid1Column32: TdxDBGridColumn; dxDBGrid1Column33: TdxDBGridColumn; dxDBGrid1Column34: TdxDBGridColumn; dxDBGrid1Column35: TdxDBGridColumn; dxDBGrid1Column40: TdxDBGridColumn; dxDBGrid1Column43: TdxDBGridColumn; dxDBGrid1Column54: TdxDBGridColumn; dxDBGrid1Column55: TdxDBGridColumn; dxDBGrid1Column56: TdxDBGridColumn; dxDBGrid1Column57: TdxDBGridColumn; dxDBGrid11: TdxDBGridColumn; dxDBGrid12: TdxDBGridColumn; dxDBGrid13: TdxDBGridColumn; dxDBGrid14: TdxDBGridColumn; dxDBGrid15: TdxDBGridColumn; dxDBGrid16: TdxDBGridColumn; dxDBGrid17: TdxDBGridColumn; dxDBGrid18: TdxDBGridColumn; dxDBGrid19: TdxDBGridColumn; dxDBGrid110: TdxDBGridColumn; dxDBGrid1Column80: TdxDBGridColumn; dxDBGrid1TEU: TdxDBGridColumn; dxDBGrid1Column82: TdxDBGridColumn; dxDBGrid1Column83: TdxDBGridColumn; dxDBGrid1Column84: TdxDBGridColumn; dxDBGrid1Column85: TdxDBGridColumn; dxDBGrid1Column86: TdxDBGridColumn; dxDBGrid1Column87: TdxDBGridColumn; dxDBGrid1Column88: TdxDBGridColumn; dxDBGrid1Column89: TdxDBGridColumn; dxDBGrid1Column90: TdxDBGridColumn; dxDBGrid1Column92: TdxDBGridColumn; dxDBGrid1Column93: TdxDBGridColumn; dxDBGrid1Column101: TdxDBGridColumn; dxDBGrid1Column102: TdxDBGridColumn; dxDBGrid1Column103: TdxDBGridColumn; dxDBGrid1Column104: TdxDBGridColumn; dxDBGrid1Column105: TdxDBGridColumn; dxDBGrid1Column106: TdxDBGridColumn; dxDBGrid1Column107: TdxDBGridColumn; dxDBGrid1Column108: TdxDBGridColumn; dxDBGrid1Column111: TdxDBGridColumn; dxDBGrid1Column113: TdxDBGridColumn; dxDBGrid1Column122: TdxDBGridColumn; dxDBGrid1Column124: TdxDBGridColumn; dxDBGrid1Column125: TdxDBGridColumn; dxDBGrid1Column127: TdxDBGridColumn; dxDBGrid1Column110: TdxDBGridCheckColumn; dxDBGrid1Column112: TdxDBGridCheckColumn; dxDBGrid1Column96: TdxDBGridCheckColumn; dxDBGrid1Column97: TdxDBGridCheckColumn; dxDBGrid1Column98: TdxDBGridCheckColumn; dxDBGrid1Column99: TdxDBGridCheckColumn; dxDBGrid1Column100: TdxDBGridCheckColumn; Label6: TLabel; Edit1: TEdit; Label3: TLabel; Edit4: TEdit; Label1: TLabel; Edit2: TEdit; Edit3: TEdit; Label2: TLabel; Label10: TLabel; wwDBDateTimePicker1: TwwDBDateTimePicker; Label5: TLabel; wwDBDateTimePicker2: TwwDBDateTimePicker; Label8: TLabel; wwDBDateTimePicker3: TwwDBDateTimePicker; Label11: TLabel; wwDBDateTimePicker4: TwwDBDateTimePicker; Label9: TLabel; RxDBLookupCombo2: TRxDBLookupCombo; Label125: TLabel; wwDBLookupCombo49: TwwDBLookupCombo; Label30: TLabel; Edit7: TEdit; Label20: TLabel; wwDBLookupCombo3: TwwDBLookupCombo; Label124: TLabel; wwDBLookupCombo52: TwwDBLookupCombo; Label14: TLabel; RxDBLookupCombo3: TRxDBLookupCombo; RxDBLookupCombo6: TRxDBLookupCombo; Label16: TLabel; bsSkinCheckGroup1: TbsSkinCheckGroup; bsSkinButton1: TbsSkinButton; bsSkinButton10: TbsSkinButton; bsSkinButton5: TbsSkinButton; bsSkinButton9: TbsSkinButton; dxDBGrid1Column91: TdxDBGridColumn; PopupMenu2: TPopupMenu; N10: TMenuItem; N11: TMenuItem; N14: TMenuItem; N13: TMenuItem; N12: TMenuItem; N15: TMenuItem; N16: TMenuItem; N39: TMenuItem; XPMenu1: TXPMenu; Label4: TLabel; wwDBComboBox44: TwwDBComboBox; dxDBGrid1Column75: TdxDBGridColumn; dxDBGrid1Column76: TdxDBGridColumn; dxDBGrid1Column77: TdxDBGridColumn; dxDBGrid1Column78: TdxDBGridColumn; dxDBGrid1Column79: TdxDBGridColumn; dxDBGrid1Column81: TdxDBGridColumn; dxDBGrid1Column94: TdxDBGridColumn; dxDBGrid1Column95: TdxDBGridColumn; dxDBGrid1Column109: TdxDBGridColumn; dxDBGrid1Column114: TdxDBGridColumn; dxDBGrid1Column115: TdxDBGridColumn; dxDBGrid1Column116: TdxDBGridColumn; dxDBGrid1Column117: TdxDBGridColumn; dxDBGrid1Column118: TdxDBGridColumn; dxDBGrid1Column119: TdxDBGridColumn; dxDBGrid1Column120: TdxDBGridColumn; dxDBGrid1Column121: TdxDBGridColumn; dxDBGrid1Column123: TdxDBGridColumn; dxDBGrid1Column126: TdxDBGridColumn; dxDBGrid1Column128: TdxDBGridColumn; dxDBGrid1Column129: TdxDBGridColumn; dxDBGrid1Column130: TdxDBGridColumn; dxDBGrid1Column132: TdxDBGridColumn; dxDBGrid1Column133: TdxDBGridCheckColumn; procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure bsSkinButton5Click(Sender: TObject); procedure bsSkinButton10Click(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure N10Click(Sender: TObject); procedure N16Click(Sender: TObject); procedure dxDBGrid1ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); procedure N14Click(Sender: TObject); procedure N12Click(Sender: TObject); procedure bsSkinButton9Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var frm_rp_tai_seae_pin: Tfrm_rp_tai_seae_pin; implementation uses u_main, my_sys_function, u_data_share; {$R *.dfm} procedure Tfrm_rp_tai_seae_pin.FormClose(Sender: TObject; var Action: TCloseAction); begin savereggrid(dxdbgrid1,caption); frm_rp_tai_seae_pin.Hide; frm_rp_tai_seae_pin.ManualFloat(frm_rp_tai_seae_pin.BoundsRect ); frm_main.freeTabs('frm_rp_tai_seae_pin'); action:=cafree; frm_rp_tai_seae_pin:=nil; end; procedure Tfrm_rp_tai_seae_pin.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_rp_tai_seae_pin.bsSkinButton10Click(Sender: TObject); begin Edit1.text:=''; Edit4.text:=''; Edit2.text:=''; Edit3.text:=''; wwDBDateTimePicker1.text:=''; wwDBDateTimePicker2.text:=''; RxDBLookupCombo2.ClearValue; wwDBDateTimePicker3.text:=''; wwDBDateTimePicker4.text:=''; wwDBLookupCombo49.text:=''; Edit7.text:=''; wwDBLookupCombo3.text:=''; wwDBLookupCombo52.text:=''; RxDBLookupCombo6.ClearValue; RxDBLookupCombo3.ClearValue; wwDBComboBox44.Text:=''; end; procedure Tfrm_rp_tai_seae_pin.bsSkinButton1Click(Sender: TObject); var str:widestring; pin_str:string; begin str:='where 装运方式 like '+''''+'拼箱%'+''''; if bsSkinCheckGroup1.Checked[0] then pin_str:='装运方式 in('+''''+'拼箱主票'+''''; if bsSkinCheckGroup1.Checked[1] then begin if pin_str=''then pin_str:='装运方式 in('+''''+'拼箱分票'+'''' else pin_str:=pin_str+','+''''+'拼箱分票'+''''; end; if bsSkinCheckGroup1.Checked[2] then begin if pin_str=''then pin_str:='装运方式 in('+''''+'拼箱单票'+'''' else pin_str:=pin_str+','+''''+'拼箱单票'+''''; end; if pin_str<>''then begin pin_str:=pin_str+')'; str:=str+' and '+pin_str; end; if Edit1.text<>''then str:=str+' and 业务编号 like '+''''+'%'+Edit1.text+'%'+''''; if Edit4.text<>''then str:=str+' and 委托编号 like '+''''+'%'+Edit4.text+'%'+''''; if Edit2.text<>''then str:=str+' and 主提单号 like '+''''+'%'+Edit2.text+'%'+''''; if Edit3.text<>''then str:=str+' and 分提单号 like '+''''+'%'+Edit3.text+'%'+''''; if wwDBDateTimePicker1.text<>''then str:=str+' and 开船日期>='+''''+wwDBDateTimePicker1.text+''''; if wwDBDateTimePicker2.text<>''then str:=str+' and 开船日期<='+''''+wwDBDateTimePicker2.text+''''; if wwDBDateTimePicker3.text<>''then str:=str+' and 会计期间>='+''''+wwDBDateTimePicker3.text+''''; if wwDBDateTimePicker4.text<>''then str:=str+' and 会计期间<='+''''+wwDBDateTimePicker4.text+''''; if RxDBLookupCombo2.DisplayValues[1]<>''then str:=str+' and 委托单位='+''''+RxDBLookupCombo2.DisplayValues[1]+''''; if RxDBLookupCombo6.DisplayValues[1]<>''then str:=str+' and 操作员='+''''+RxDBLookupCombo6.DisplayValues[1]+''''; if RxDBLookupCombo3.DisplayValues[1]<>''then str:=str+' and 揽货人='+''''+RxDBLookupCombo3.DisplayValues[1]+''''; if wwDBLookupCombo49.text<>''then str:=str+' and 船名 like '+''''+'%'+wwDBLookupCombo49.text+'%'+''''; if Edit7.text<>''then str:=str+' and 航次 like '+''''+'%'+Edit7.text+'%'+''''; if wwDBLookupCombo3.text<>''then str:=str+' and 装货港 like '+''''+'%'+wwDBLookupCombo3.text+'%'+''''; if wwDBLookupCombo52.text<>''then str:=str+' and 卸货港 like '+''''+'%'+wwDBLookupCombo52.text+'%'+''''; if wwDBComboBox44.Text='轻货' then begin Str:=Str+' and 重量/1000<尺码 ' end; if wwDBComboBox44.Text='重货' then begin Str:=Str+' and 重量/1000>=尺码 ' end; str:='select *,(case when 重量/1000>尺码 then 重量/1000 else 尺码 end) as 计费吨 ' +',t_op_gain.应收USD, t_op_gain.已收USD,(t_op_gain.应收USD-t_op_gain.已收USD)' +' AS 未收USD,t_op_gain.应收RMB, t_op_gain.已收RMB,(t_op_gain.应收RMB-t_op_gain.已收RMB)' +' AS 未收RMB, t_op_gain.合计应收,t_op_gain.合计已收,(t_op_gain.合计应收-t_op_gain.合计已收)' +' AS 合计未收,t_op_gain.应付USD, t_op_gain.已付USD, (t_op_gain.应付USD-t_op_gain.已付USD)' +' AS 未付USD,t_op_gain.应付RMB, t_op_gain.已付RMB,(t_op_gain.应付RMB- t_op_gain.已付RMB)' +' AS 未付RMB,t_op_gain.合计应付,t_op_gain.合计已付,(t_op_gain.合计应付-t_op_gain.合计已付)' +' AS 合计未付,t_op_gain.利润USD, t_op_gain.利润RMB, t_op_gain.毛利润, t_op_gain.利润率' +' from t_op_seae left JOIN t_op_gain ON t_op_seae.编号=t_op_gain.编号 '+str+default_sort(53,'t_op_seae','',''); p_seae_pin.close; p_seae_pin.Parameters.ParamByName('SQLStr').Value:=str; p_seae_pin.open; end; procedure Tfrm_rp_tai_seae_pin.FormShow(Sender: TObject); begin bsSkinCheckGroup1.Checked[0]:=true; bsSkinCheckGroup1.Checked[1]:=true; bsSkinCheckGroup1.Checked[2]:=true; loadreggrid(dxdbgrid1,true,caption); if frm_data_share.t_load_employee.FieldByName('应收').asboolean then begin dxDBGrid1.Bands[1].Visible:=true; end else begin dxDBGrid1.Bands[1].Visible:=false; end; if frm_data_share.t_load_employee.FieldByName('应付').asboolean then begin dxDBGrid1.Bands[2].Visible:=true; end else begin dxDBGrid1.Bands[2].Visible:=false; end; if frm_data_share.t_load_employee.FieldByName('利润').asboolean then begin dxDBGrid1.Bands[3].Visible:=true; end else begin dxDBGrid1.Bands[3].Visible:=false; end; end; procedure Tfrm_rp_tai_seae_pin.N10Click(Sender: TObject); begin update_grid_view_no(dxdbgrid1); end; procedure Tfrm_rp_tai_seae_pin.N16Click(Sender: TObject); begin grid_save_xls(dxdbgrid1); end; procedure Tfrm_rp_tai_seae_pin.dxDBGrid1ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); begin Column_sort_pro(Column,p_seae_pin,'业务编号'); end; procedure Tfrm_rp_tai_seae_pin.N14Click(Sender: TObject); begin update_grid_view_all(dxdbgrid1); end; procedure Tfrm_rp_tai_seae_pin.N12Click(Sender: TObject); begin update_grid(dxdbgrid1,1); end; procedure Tfrm_rp_tai_seae_pin.bsSkinButton9Click(Sender: TObject); begin sys_print('海运拼箱台帐',2,nil,nil,nil,nil,p_seae_pin1,nil,nil,nil,nil,nil,nil); end; end.