unit u_op_seai_fuhui; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, Mask, wwdbedit, Wwdotdot, Wwdbcomb, wwdblook, RxLookup, wwdbdatetimepicker, StdCtrls, bsSkinCtrls, ExtCtrls, DB, ADODB, dxExEdtr, dxDBTLCl, dxGrClms, dxDBGrid, dxTL, dxDBCtrl, dxCntner, Menus, XPMenu; type Tfrm_op_seai_fuhui = class(TForm) Panel2: TPanel; Panel3: TPanel; bsSkinButton10: TbsSkinButton; bsSkinButton6: TbsSkinButton; bsSkinButton9: TbsSkinButton; bsSkinButton5: TbsSkinButton; bsSkinPanel1: TbsSkinPanel; Label6: TLabel; Label3: TLabel; Label1: TLabel; Label2: TLabel; Label10: TLabel; Label5: TLabel; Label9: TLabel; Label8: TLabel; Label11: TLabel; Label30: TLabel; Label125: TLabel; Label124: TLabel; Edit1: TEdit; Edit4: TEdit; Edit2: TEdit; Edit3: TEdit; wwDBDateTimePicker1: TwwDBDateTimePicker; wwDBDateTimePicker2: TwwDBDateTimePicker; RxDBLookupCombo2: TRxDBLookupCombo; wwDBDateTimePicker3: TwwDBDateTimePicker; wwDBDateTimePicker4: TwwDBDateTimePicker; Edit7: TEdit; wwDBLookupCombo49: TwwDBLookupCombo; wwDBLookupCombo52: TwwDBLookupCombo; t_op_seai: TADOQuery; t_op_seai1: TDataSource; dxDBGrid1: TdxDBGrid; dxDBGrid1Column1: TdxDBGridMaskColumn; dxDBGrid1Column2: TdxDBGridMaskColumn; dxDBGrid1Column3: TdxDBGridMaskColumn; dxDBGrid1Column4: TdxDBGridMaskColumn; dxDBGrid1Column5: TdxDBGridMaskColumn; dxDBGrid1Column6: TdxDBGridMaskColumn; dxDBGrid1Column7: TdxDBGridMaskColumn; dxDBGrid1Column8: TdxDBGridMaskColumn; dxDBGrid1Column78: TdxDBGridColumn; dxDBGrid1Column9: TdxDBGridMaskColumn; dxDBGrid1Column10: TdxDBGridMaskColumn; dxDBGrid1Column11: TdxDBGridMaskColumn; dxDBGrid1Column12: TdxDBGridMaskColumn; dxDBGrid1Column13: TdxDBGridMaskColumn; dxDBGrid1Column14: TdxDBGridMaskColumn; dxDBGrid1Column15: TdxDBGridMaskColumn; dxDBGrid1Column16: TdxDBGridDateColumn; dxDBGrid1Column19: TdxDBGridMaskColumn; dxDBGrid1Column20: TdxDBGridMaskColumn; dxDBGrid1Column22: TdxDBGridDateColumn; dxDBGrid1Column32: TdxDBGridMaskColumn; dxDBGrid1Column35: TdxDBGridMaskColumn; dxDBGrid1Column36: TdxDBGridMaskColumn; dxDBGrid1Column37: TdxDBGridMaskColumn; dxDBGrid1Column38: TdxDBGridMaskColumn; dxDBGrid1Column39: TdxDBGridColumn; dxDBGrid1Column40: TdxDBGridColumn; dxDBGrid11: TdxDBGridMaskColumn; dxDBGrid12: TdxDBGridMaskColumn; dxDBGrid13: TdxDBGridMaskColumn; dxDBGrid14: TdxDBGridMaskColumn; dxDBGrid15: TdxDBGridMaskColumn; dxDBGrid16: TdxDBGridMaskColumn; dxDBGrid17: TdxDBGridMaskColumn; dxDBGrid18: TdxDBGridMaskColumn; dxDBGrid19: TdxDBGridMaskColumn; dxDBGrid110: TdxDBGridMaskColumn; dxDBGrid111: TdxDBGridMaskColumn; dxDBGrid112: TdxDBGridMaskColumn; dxDBGrid113: TdxDBGridMaskColumn; dxDBGrid114: TdxDBGridMaskColumn; dxDBGrid115: TdxDBGridMaskColumn; dxDBGrid116: TdxDBGridMaskColumn; dxDBGrid117: TdxDBGridMaskColumn; dxDBGrid118: TdxDBGridMaskColumn; dxDBGrid119: TdxDBGridMaskColumn; dxDBGrid120: TdxDBGridMaskColumn; dxDBGrid1Column61: TdxDBGridMaskColumn; dxDBGrid1TEU: TdxDBGridMaskColumn; dxDBGrid1Column63: TdxDBGridMaskColumn; dxDBGrid1Column64: TdxDBGridMaskColumn; dxDBGrid1Column65: TdxDBGridDateColumn; dxDBGrid1Column66: TdxDBGridMaskColumn; dxDBGrid1Column67: TdxDBGridMaskColumn; dxDBGrid1Column72: TdxDBGridMaskColumn; dxDBGrid1Column68: TdxDBGridMaskColumn; dxDBGrid1Column69: TdxDBGridMaskColumn; dxDBGrid1Column70: TdxDBGridMaskColumn; dxDBGrid1Column74: TdxDBGridMaskColumn; dxDBGrid1Column75: TdxDBGridMaskColumn; dxDBGrid1Column73: TdxDBGridColumn; dxDBGrid1Column76: TdxDBGridColumn; dxDBGrid1Column79: TdxDBGridColumn; dxDBGrid1Column80: TdxDBGridColumn; dxDBGrid1Column81: TdxDBGridColumn; PopupMenu2: TPopupMenu; N10: TMenuItem; N11: TMenuItem; N14: TMenuItem; N13: TMenuItem; N12: TMenuItem; N15: TMenuItem; N16: TMenuItem; XPMenu1: TXPMenu; Label13: TLabel; wwDBComboBox2: TwwDBComboBox; Label14: TLabel; wwDBDateTimePicker7: TwwDBDateTimePicker; Label15: TLabel; wwDBDateTimePicker8: TwwDBDateTimePicker; Label16: TLabel; Edit5: TEdit; ListBoxNos: TListBox; dxDBGrid1Column89: TdxDBGridColumn; bsSkinButton2: TbsSkinButton; bsSkinButton3: TbsSkinButton; dxDBGrid1Column90: TdxDBGridCheckColumn; dxDBGrid1Column91: TdxDBGridColumn; dxDBGrid1Column71: TdxDBGridColumn; dxDBGrid1Column77: TdxDBGridColumn; procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure bsSkinButton5Click(Sender: TObject); procedure bsSkinButton10Click(Sender: TObject); procedure bsSkinButton6Click(Sender: TObject); procedure dxDBGrid1ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); procedure N10Click(Sender: TObject); procedure N14Click(Sender: TObject); procedure N12Click(Sender: TObject); procedure N16Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure bsSkinButton9Click(Sender: TObject); procedure Edit1KeyPress(Sender: TObject; var Key: Char); procedure Edit5Enter(Sender: TObject); procedure Edit5Exit(Sender: TObject); procedure Edit5KeyPress(Sender: TObject; var Key: Char); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); private FHblNo:TStrings; { Private declarations } public { Public declarations } end; var frm_op_seai_fuhui: Tfrm_op_seai_fuhui; implementation uses u_main, my_sys_function, my_sys_chat; {$R *.dfm} procedure Tfrm_op_seai_fuhui.FormClose(Sender: TObject; var Action: TCloseAction); begin FreeAndNil(FHblNo); savereggrid(dxdbgrid1,caption); frm_op_seai_fuhui.Hide; frm_op_seai_fuhui.ManualFloat(frm_op_seai_fuhui.BoundsRect ); frm_main.freeTabs('frm_op_seai_fuhui'); action:=cafree; frm_op_seai_fuhui:=nil; end; procedure Tfrm_op_seai_fuhui.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_op_seai_fuhui.bsSkinButton10Click(Sender: TObject); var str,S3:widestring; i:integer; begin if (wwDBDateTimePicker7.text<>'')or(wwDBDateTimePicker8.text<>'') then begin str:='where 是否付汇=1'; if wwDBDateTimePicker7.text<>'' then str:=str+' and 付汇日期>='+''''+wwDBDateTimePicker7.text+''''; if wwDBDateTimePicker8.text<>'' then str:=str+' and 付汇日期<='+''''+wwDBDateTimePicker8.text+''''; end else begin if wwDBComboBox2.text='' then str:='where 1=1'; if wwDBComboBox2.text='没有付汇' then str:='where 是否付汇=0'; if wwDBComboBox2.text='已经付汇' then str:='where 是否付汇=1'; 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[0]<>''then // str:=str+' and 操作员='+''''+RxDBLookupCombo6.DisplayValues[0]+''''; if wwDBLookupCombo49.text<>''then str:=str+' and 船名 like '+''''+'%'+wwDBLookupCombo49.text+'%'+''''; if Edit7.text<>''then str:=str+' and 航次 like '+''''+'%'+Edit7.text+'%'+''''; if wwDBLookupCombo52.text<>''then str:=str+' and 卸货港 like '+''''+'%'+wwDBLookupCombo52.text+'%'+''''; if FHblNo.Count<>0 then begin str:=str+' and ('; for i:=0 to FHblNo.Count-1 do begin if i=0 then str:=str+'报关单号='+''''+Trim(FHblNo.Strings[i])+'''' else str:=str+' or 报关单号='+''''+Trim(FHblNo.Strings[i])+''''; end; str:=str+') '; end; t_op_seai.close; t_op_seai.sql.clear; t_op_seai.sql.add('select * from t_op_seai '+str+default_sort(54,'t_op_seai','','desc')); t_op_seai.open; end; procedure Tfrm_op_seai_fuhui.bsSkinButton6Click(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:=''; wwDBLookupCombo52.text:=''; // RxDBLookupCombo6.ClearValue; // wwDBComboBox1.text:=''; // wwDBDateTimePicker5.text:=''; //wwDBDateTimePicker6.text:=''; FHblNo.Clear; wwDBComboBox2.text:=''; wwDBDateTimePicker7.text:=''; wwDBDateTimePicker8.text:=''; end; procedure Tfrm_op_seai_fuhui.dxDBGrid1ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); begin Column_sort(Column,t_op_seai,'业务编号'); end; procedure Tfrm_op_seai_fuhui.N10Click(Sender: TObject); begin update_grid_view_no(dxdbgrid1); end; procedure Tfrm_op_seai_fuhui.N14Click(Sender: TObject); begin update_grid_view_all(dxdbgrid1); end; procedure Tfrm_op_seai_fuhui.N12Click(Sender: TObject); begin // update_grid(dxdbgrid1,98); end; procedure Tfrm_op_seai_fuhui.N16Click(Sender: TObject); begin grid_save_xls(dxdbgrid1); end; procedure Tfrm_op_seai_fuhui.FormShow(Sender: TObject); begin loadreggrid(dxdbgrid1,true,caption); FHblNo:=TStringList.Create; end; procedure Tfrm_op_seai_fuhui.bsSkinButton9Click(Sender: TObject); begin sys_print('海运进口付汇',2,nil,nil,nil,nil,t_op_seai1,nil,nil,nil,nil,nil,nil); end; procedure Tfrm_op_seai_fuhui.Edit1KeyPress(Sender: TObject; var Key: Char); begin if key=#13 then begin key:=#0; frm_op_seai_fuhui.bsSkinButton10Click(Sender); end; end; procedure Tfrm_op_seai_fuhui.Edit5Enter(Sender: TObject); begin ListBoxNos.Items.Clear; ListBoxNos.Items.Assign(FHblNo); ListBoxNos.Visible:=true; end; procedure Tfrm_op_seai_fuhui.Edit5Exit(Sender: TObject); begin ListBoxNos.Visible:=false; ListBoxNos.Items.Clear; end; procedure Tfrm_op_seai_fuhui.Edit5KeyPress(Sender: TObject; var Key: Char); begin if Key<>#13 then exit; if (Trim(Edit5.Text)<>'') then begin FHblNo.Add(Trim(Edit5.Text)); ListBoxNos.Items.Add(Trim(Edit5.Text)); Edit5.Text:=''; end; end; procedure Tfrm_op_seai_fuhui.bsSkinButton2Click(Sender: TObject); var i:integer; begin if t_op_seai.isempty then exit; if dxDBGrid1.SelectedCount>=1 then begin for i:=0 to dxDBGrid1.SelectedCount-1 do begin t_op_seai.GotoBookmark(pointer(dxDBGrid1.selectedrows[i])); if not t_op_seai.FieldByName('是否付汇').asboolean then begin t_op_seai.Edit; t_op_seai['是否付汇']:=1; t_op_seai['付汇日期']:=date; t_op_seai.post; end; end; end else begin if not t_op_seai.FieldByName('是否结汇').asboolean then begin t_op_seai.Edit; t_op_seai['是否付汇']:=1; t_op_seai['付汇日期']:=date; t_op_seai.post; end; end; end; procedure Tfrm_op_seai_fuhui.bsSkinButton3Click(Sender: TObject); var i:integer; begin if t_op_seai.isempty then exit; if dxDBGrid1.SelectedCount>=1 then begin for i:=0 to dxDBGrid1.SelectedCount-1 do begin t_op_seai.GotoBookmark(pointer(dxDBGrid1.selectedrows[i])); if t_op_seai.FieldByName('是否付汇').asboolean then begin t_op_seai.Edit; t_op_seai['是否付汇']:=0; t_op_seai['付汇日期']:=null; t_op_seai.post; end; end; end else begin if t_op_seai.FieldByName('是否付汇').asboolean then begin t_op_seai.Edit; t_op_seai['是否付汇']:=0; t_op_seai['付汇日期']:=null; t_op_seai.post; end; end; end; end.