unit u_op_seae_koudan; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, dxExEdtr, XPMenu, Menus, dxDBTLCl, dxGrClms, dxDBCtrl, dxDBGrid, dxTL, dxCntner, DB, ADODB, Mask, wwdbedit, Wwdotdot, Wwdbcomb, wwdblook, RxLookup, wwdbdatetimepicker, StdCtrls, bsSkinCtrls, ExtCtrls; type Tfrm_op_seae_koudan = 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; Label16: 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; RxDBLookupCombo6: TRxDBLookupCombo; t_op_seae: TADOQuery; t_op_seae1: TDataSource; dxdbgrid1: TdxDBGrid; dxdbgrid1Column84: TdxDBGridCheckColumn; dxdbgrid1Column85: TdxDBGridColumn; 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; dxdbgrid1Column17: TdxDBGridDateColumn; dxdbgrid1Column18: TdxDBGridDateColumn; dxdbgrid1Column19: TdxDBGridMaskColumn; dxdbgrid1Column20: TdxDBGridMaskColumn; dxdbgrid1Column22: TdxDBGridDateColumn; dxdbgrid1Column23: TdxDBGridMaskColumn; dxdbgrid1Column24: TdxDBGridMaskColumn; dxdbgrid1Column25: TdxDBGridMaskColumn; dxdbgrid1Column26: TdxDBGridMaskColumn; dxdbgrid1Column27: TdxDBGridMaskColumn; dxdbgrid1Column28: TdxDBGridMaskColumn; dxdbgrid1Column29: TdxDBGridMaskColumn; dxdbgrid1Column30: TdxDBGridMaskColumn; dxdbgrid1Column31: TdxDBGridDateColumn; dxdbgrid1Column32: TdxDBGridMaskColumn; dxdbgrid1Column33: TdxDBGridMaskColumn; dxdbgrid1Column34: 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; dxdbgrid1Column77: TdxDBGridCheckColumn; dxdbgrid1Column79: TdxDBGridColumn; dxdbgrid1Column80: TdxDBGridColumn; dxdbgrid1Column81: TdxDBGridColumn; dxdbgrid1Column83: TdxDBGridColumn; dxdbgrid1Column86: TdxDBGridCheckColumn; dxdbgrid1Column87: TdxDBGridCheckColumn; dxdbgrid1Column88: TdxDBGridColumn; bsSkinButton13: TbsSkinButton; bsSkinButton1: TbsSkinButton; PopupMenu2: TPopupMenu; N10: TMenuItem; N11: TMenuItem; N14: TMenuItem; N13: TMenuItem; N12: TMenuItem; N15: TMenuItem; N16: TMenuItem; XPMenu1: TXPMenu; Label12: TLabel; RxDBLookupCombo1: TRxDBLookupCombo; dxdbgrid1Column89: TdxDBGridColumn; Label4: TLabel; wwDBDateTimePicker5: TwwDBDateTimePicker; Label7: TLabel; wwDBDateTimePicker6: TwwDBDateTimePicker; dxdbgrid1Column90: TdxDBGridColumn; dxdbgrid1Column91: TdxDBGridColumn; dxdbgrid1Column92: TdxDBGridColumn; Edit5: TEdit; Label13: TLabel; Label14: TLabel; ComboBox1: TComboBox; 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 bsSkinButton13Click(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure dxdbgrid1Column83CustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean); private { Private declarations } public { Public declarations } end; var frm_op_seae_koudan: Tfrm_op_seae_koudan; implementation uses my_sys_function, u_main, my_sys_chat; {$R *.dfm} procedure Tfrm_op_seae_koudan.FormClose(Sender: TObject; var Action: TCloseAction); begin savereggrid(dxdbgrid1,caption); frm_op_seae_koudan.Hide; frm_op_seae_koudan.ManualFloat(frm_op_seae_koudan.BoundsRect ); frm_main.freeTabs('frm_op_seae_koudan'); action:=cafree; frm_op_seae_koudan:=nil; end; procedure Tfrm_op_seae_koudan.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_op_seae_koudan.bsSkinButton10Click(Sender: TObject); var str:widestring; begin 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 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 RxDBLookupCombo1.DisplayValues[1]<>''then str:=str+' and 船公司='+''''+RxDBLookupCombo1.DisplayValues[1]+''''; if wwDBDateTimePicker5.text<>''then str:=str+' and 预抵日期>='+''''+wwDBDateTimePicker5.text+''''; if wwDBDateTimePicker6.text<>''then str:=str+' and 预抵日期<'+''''+FormatDateTime('YYYY-MM-DD',(strtodatetime(wwDBDateTimePicker6.text)+1))+''''; t_op_seae.close; t_op_seae.sql.clear; t_op_seae.sql.add('select * from t_op_seae WHERE 1=1 '+str+default_sort(53,'t_op_seae','','desc')); t_op_seae.open; end; procedure Tfrm_op_seae_koudan.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; end; procedure Tfrm_op_seae_koudan.dxdbgrid1ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); begin Column_sort(Column,t_op_seae,'业务编号'); end; procedure Tfrm_op_seae_koudan.N10Click(Sender: TObject); begin update_grid_view_no(dxdbgrid1); end; procedure Tfrm_op_seae_koudan.N14Click(Sender: TObject); begin update_grid_view_all(dxdbgrid1); end; procedure Tfrm_op_seae_koudan.N12Click(Sender: TObject); begin update_grid(dxdbgrid1,199); end; procedure Tfrm_op_seae_koudan.N16Click(Sender: TObject); begin grid_save_xls(dxdbgrid1); end; procedure Tfrm_op_seae_koudan.FormShow(Sender: TObject); begin loadreggrid(dxdbgrid1,true,caption); end; procedure Tfrm_op_seae_koudan.bsSkinButton9Click(Sender: TObject); begin sys_print('海运出口签单',2,nil,nil,nil,nil,t_op_seae1,nil,nil,nil,nil,nil,nil); end; procedure Tfrm_op_seae_koudan.Edit1KeyPress(Sender: TObject; var Key: Char); begin if key=#13 then begin key:=#0; frm_op_seae_koudan.bsSkinButton10Click(Sender); end; end; procedure Tfrm_op_seae_koudan.bsSkinButton13Click(Sender: TObject); var i:Integer; begin if t_op_seae.IsEmpty then exit; if (trim(ComboBox1.Text)='') or (Length(Trim(ComboBox1.Text))<=6) then begin ShowMessage('必须录入扣单原因!'); exit; end; if dxDBGrid1.SelectedCount<1 then begin t_op_seae.Edit; t_op_seae['扣单状态']:='扣单'; t_op_seae['扣放单操作人']:=employee; t_op_seae['扣放单操作时间']:=now; t_op_seae['扣单原因']:=trim(ComboBox1.Text); t_op_seae.post; end else begin try t_op_seae.DisableControls; for i:=0 to dxDBGrid1.SelectedCount-1 do begin t_op_seae.GotoBookmark(pointer(dxDBGrid1.selectedrows[i])); t_op_seae.Edit; t_op_seae['扣单状态']:='扣单'; t_op_seae['扣放单操作人']:=employee; t_op_seae['扣放单操作时间']:=now; t_op_seae['扣单原因']:=trim(ComboBox1.Text); t_op_seae.post; end; finally t_op_seae.EnableControls; end; end; showmessage('确认扣单成功!!'); end; procedure Tfrm_op_seae_koudan.bsSkinButton1Click(Sender: TObject); var i:Integer; begin if t_op_seae.IsEmpty then exit; if dxDBGrid1.SelectedCount<1 then begin if t_op_seae.FieldByName('扣单原因').AsString='超出限额' then begin t_op_seae.Edit; t_op_seae['扣单状态']:='放单'; t_op_seae['扣单原因']:='未超出限额'; t_op_seae['扣放单操作人']:=employee; t_op_seae['扣放单操作时间']:=now; t_op_seae.post; end else if t_op_seae.FieldByName('扣单原因').AsString='超出账期' then begin t_op_seae.Edit; t_op_seae['扣单状态']:='放单'; t_op_seae['扣单原因']:='未超出账期'; t_op_seae['扣放单操作人']:=employee; t_op_seae['扣放单操作时间']:=now; t_op_seae.post; end else if t_op_seae.FieldByName('扣单原因').AsString='有提单号未归档费用确认' then begin t_op_seae.Edit; t_op_seae['扣单状态']:='放单'; t_op_seae['扣单原因']:='未有提单号未归档费用确认'; t_op_seae['扣放单操作人']:=employee; t_op_seae['扣放单操作时间']:=now; t_op_seae.post; end else if t_op_seae.FieldByName('扣单原因').AsString='' then begin if (trim(Edit5.Text)='') or (Length(Trim(Edit5.Text))<=6) then begin ShowMessage('必须录入3个汉字及以上放单原因!'); exit; end else begin t_op_seae.Edit; t_op_seae['扣单状态']:='放单'; t_op_seae['扣单原因']:=trim(Edit5.Text); t_op_seae['扣放单操作人']:=employee; t_op_seae['扣放单操作时间']:=now; t_op_seae.post; end; end; end else begin try t_op_seae.DisableControls; for i:=0 to dxDBGrid1.SelectedCount-1 do begin t_op_seae.GotoBookmark(pointer(dxDBGrid1.selectedrows[i])); if t_op_seae.FieldByName('扣单原因').AsString='超出限额' then begin t_op_seae.Edit; t_op_seae['扣单状态']:='放单'; t_op_seae['扣单原因']:='未超出限额'; t_op_seae['扣放单操作人']:=employee; t_op_seae['扣放单操作时间']:=now; t_op_seae.post; end else if t_op_seae.FieldByName('扣单原因').AsString='超出账期' then begin t_op_seae.Edit; t_op_seae['扣单状态']:='放单'; t_op_seae['扣单原因']:='未超出账期'; t_op_seae['扣放单操作人']:=employee; t_op_seae['扣放单操作时间']:=now; t_op_seae.post; end else if t_op_seae.FieldByName('扣单原因').AsString='有提单号未归档费用确认' then begin t_op_seae.Edit; t_op_seae['扣单状态']:='放单'; t_op_seae['扣单原因']:='未有提单号未归档费用确认'; t_op_seae['扣放单操作人']:=employee; t_op_seae['扣放单操作时间']:=now; t_op_seae.post; end else begin if (trim(Edit5.Text)='') or (Length(Trim(Edit5.Text))<=6) then begin ShowMessage('必须录入3个汉字及以上放单原因!'); exit; end else begin t_op_seae.Edit; t_op_seae['扣单状态']:='放单'; t_op_seae['扣单原因']:=trim(Edit5.Text); t_op_seae['扣放单操作人']:=employee; t_op_seae['扣放单操作时间']:=now; t_op_seae.post; end; end; end; finally t_op_seae.EnableControls; end; end; end; procedure Tfrm_op_seae_koudan.dxdbgrid1Column83CustomDraw(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[dxDBGrid1Column83.Index]='扣单') or (ANode.strings[dxDBGrid1Column83.Index]='自动扣单') then AColor:=clRed else AColor:=clWhite; AFont.Color:=clblack; end; end.