unit u_op_dg_his; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, bsSkinCtrls, dxExEdtr, dxDBTLCl, dxGrClms, dxTL, dxDBCtrl, dxDBGrid, dxCntner, wwdbdatetimepicker, RxLookup, StdCtrls, ExtCtrls, BusinessSkinForm, DB, ADODB, XPMenu, Menus, DBCtrls, Mask, wwdbedit, Wwdotdot, Wwdbcomb, wwdblook; type Tfrm_op_dg_his = class(TForm) bsSkinPanel1: TbsSkinPanel; bsSkinButton1: TbsSkinButton; bsSkinButton5: TbsSkinButton; bsSkinButton10: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinButton3: TbsSkinButton; Panel1: TPanel; bsSkinPanel3: TbsSkinPanel; Label6: TLabel; Label1: TLabel; Label9: TLabel; Label3: TLabel; Label2: TLabel; Label10: TLabel; Edit1: TEdit; Edit2: TEdit; RxDBLookupCombo2: TRxDBLookupCombo; Edit4: TEdit; Edit3: TEdit; wwDBDateTimePicker1: TwwDBDateTimePicker; dxDBGrid2: TdxDBGrid; dxDBGridMaskColumn1: TdxDBGridMaskColumn; dxDBGridMaskColumn4: TdxDBGridMaskColumn; dxDBGridMaskColumn5: TdxDBGridMaskColumn; dxDBGridMaskColumn6: TdxDBGridMaskColumn; dxDBGridMaskColumn7: TdxDBGridMaskColumn; dxDBGrid1Column12: TdxDBGridMaskColumn; dxDBGrid1Column13: TdxDBGridMaskColumn; dxDBGrid1Column14: TdxDBGridMaskColumn; dxDBGrid1Column15: TdxDBGridMaskColumn; dxDBGrid1Column16: TdxDBGridDateColumn; dxDBGrid1Column17: TdxDBGridDateColumn; dxDBGrid1Column18: TdxDBGridDateColumn; dxDBGrid1Column19: TdxDBGridMaskColumn; dxDBGrid1Column20: TdxDBGridMaskColumn; dxDBGrid1Column22: TdxDBGridDateColumn; dxDBGrid1Column63: TdxDBGridMaskColumn; dxDBGrid1Column64: TdxDBGridMaskColumn; dxDBGrid1Column65: TdxDBGridDateColumn; dxDBGrid1Column66: TdxDBGridMaskColumn; dxDBGrid1Column67: TdxDBGridMaskColumn; t_bill1: TDataSource; bsBusinessSkinForm1: TbsBusinessSkinForm; PopupMenu2: TPopupMenu; N1: TMenuItem; N2: TMenuItem; N21: TMenuItem; N22: TMenuItem; N20: TMenuItem; t_bill: TADOStoredProc; t_op_dgform1: TDataSource; t_op_dgform_old: TADOQuery; Panel2: TPanel; DataSource1: TDataSource; ADOQuery1: TADOQuery; dxDBGrid1: TdxDBGrid; dxDBGrid1Column3: TdxDBGridColumn; dxDBGridMaskColumn2: TdxDBGridMaskColumn; dxDBGridMaskColumn3: TdxDBGridMaskColumn; bsBusinessSkinForm2: TbsBusinessSkinForm; Label244: TLabel; Label245: TLabel; Label246: TLabel; Label247: TLabel; Label248: TLabel; Label249: TLabel; Label250: TLabel; Label251: TLabel; Label252: TLabel; Label253: TLabel; Label254: TLabel; Label255: TLabel; Label256: TLabel; Label257: TLabel; Label261: TLabel; Label263: TLabel; Label266: TLabel; Label267: TLabel; Label268: TLabel; Label269: TLabel; Label271: TLabel; Label272: TLabel; Label273: TLabel; Label274: TLabel; Label275: TLabel; Label276: TLabel; Label277: TLabel; Label278: TLabel; Label259: TLabel; Label262: TLabel; RxDBLookupCombo62: TRxDBLookupCombo; DBEdit94: TDBEdit; wwDBLookupCombo29: TwwDBLookupCombo; DBEdit96: TDBEdit; DBEdit97: TDBEdit; DBEdit98: TDBEdit; DBEdit99: TDBEdit; DBEdit101: TDBEdit; DBEdit102: TDBEdit; DBEdit103: TDBEdit; DBEdit104: TDBEdit; DBEdit108: TDBEdit; DBEdit117: TDBEdit; DBEdit118: TDBEdit; DBEdit119: TDBEdit; DBEdit122: TDBEdit; DBEdit123: TDBEdit; wwDBComboBox21: TwwDBComboBox; DBEdit100: TDBEdit; wwDBLookupCombo30: TwwDBLookupCombo; DBEdit124: TDBEdit; DBEdit125: TDBEdit; wwDBLookupCombo31: TwwDBLookupCombo; wwDBComboBox22: TwwDBComboBox; wwDBComboBox23: TwwDBComboBox; wwDBComboBox24: TwwDBComboBox; wwDBComboBox28: TwwDBComboBox; wwDBLookupCombo28: TwwDBLookupCombo; procedure bsSkinButton10Click(Sender: TObject); procedure bsSkinButton5Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure add_letter(old_letter,new_letter:Tadoquery); procedure bsSkinButton1Click(Sender: TObject); procedure Edit1KeyPress(Sender: TObject; var Key: Char); private { Private declarations } public { Public declarations } end; var frm_op_dg_his: Tfrm_op_dg_his; implementation uses u_op_letter, u_main, my_sys_function; {$R *.dfm} procedure Tfrm_op_dg_his.add_letter(old_letter,new_letter:Tadoquery); var j:integer; begin if not old_letter.IsEmpty then begin new_letter.insert; for j:=0 to (old_letter.fieldcount-1) do begin if (old_letter.fields[j].FieldName<>'LE_ID') then new_letter[old_letter.fields[j].FieldName]:= old_letter.fields[j].value; end; new_letter.post; end; end; procedure Tfrm_op_dg_his.bsSkinButton10Click(Sender: TObject); begin Edit1.text:=''; Edit4.text:=''; RxDBLookupCombo2.ClearValue; Edit2.text:=''; Edit3.text:=''; wwDBDateTimePicker1.text:=''; end; procedure Tfrm_op_dg_his.bsSkinButton5Click(Sender: TObject); begin CLOSE; end; procedure Tfrm_op_dg_his.bsSkinButton2Click(Sender: TObject); var str:widestring; begin if Edit1.text<>''then str:=' where 业务编号 like '+''''+'%'+Edit1.text+'%'+''''; if Edit4.text<>''then begin if str=''then str:=' where 委托编号 like '+''''+'%'+Edit4.text+'%'+'''' else str:=str+' and 委托编号 like '+''''+'%'+Edit4.text+'%'+''''; end; if Edit2.text<>''then begin if str=''then str:=' where 主提单号 like '+''''+'%'+Edit2.text+'%'+'''' else str:=str+' and 主提单号 like '+''''+'%'+Edit2.text+'%'+''''; end; if Edit3.text<>''then begin if str=''then str:=' where 分提单号 like '+''''+'%'+Edit3.text+'%'+'''' else str:=str+' and 分提单号 like '+''''+'%'+Edit3.text+'%'+''''; end; if RxDBLookupCombo2.DisplayValue<>''then begin if str=''then str:=' where 委托单位='+''''+RxDBLookupCombo2.DisplayValues[1]+'''' else str:=str+' and 委托单位='+''''+RxDBLookupCombo2.DisplayValues[1]+''''; end; if wwDBDateTimePicker1.text<>''then begin if str=''then str:=' where 开船日期='+''''+wwDBDateTimePicker1.text+'''' else str:=str+' and 开船日期='+''''+wwDBDateTimePicker1.text+''''; end; str:='select * from t_op_seae '+str+default_sort(53,'t_op_seae','',''); t_bill.close; t_bill.Parameters.ParamByName('SQLStr').value:=str; t_bill.open; t_op_dgform_old.Open; end; procedure Tfrm_op_dg_his.bsSkinButton3Click(Sender: TObject); var i,j:integer; begin if t_op_dgform_old.IsEmpty then exit; if dxDBGrid1.SelectedCount>=1 then begin for i:=0 to dxDBGrid1.SelectedCount-1 do begin t_op_dgform_old.GotoBookmark(pointer(dxDBGrid1.selectedrows[i])); frm_op_seae.t_op_dgform.append; for j:=0 to (t_op_dgform_old.fieldcount-1) do begin if (t_op_dgform_old.fields[j].FieldName<>'dg_id') and(t_op_dgform_old.fields[j].FieldName<>'编号') then frm_op_seae.t_op_dgform[t_op_dgform_old.fields[j].FieldName]:= t_op_dgform_old.fields[j].value; end; frm_op_seae.t_op_dgform.post; end; end else begin frm_op_seae.t_op_dgform.append; for j:=0 to (t_op_dgform_old.fieldcount-1) do begin if (t_op_dgform_old.fields[j].FieldName<>'dg_id') and(t_op_dgform_old.fields[j].FieldName<>'编号') then frm_op_seae.t_op_dgform[t_op_dgform_old.fields[j].FieldName]:= t_op_dgform_old.fields[j].value; end; frm_op_seae.t_op_dgform.post; end; close; end; procedure Tfrm_op_dg_his.bsSkinButton1Click(Sender: TObject); var j:integer; begin if t_op_dgform_old.IsEmpty then exit; t_op_dgform_old.first; while not t_op_dgform_old.eof do begin frm_op_seae.t_op_dgform.append; for j:=0 to (t_op_dgform_old.fieldcount-1) do begin if (t_op_dgform_old.fields[j].FieldName<>'dg_id') and(t_op_dgform_old.fields[j].FieldName<>'编号') then frm_op_seae.t_op_dgform[t_op_dgform_old.fields[j].FieldName]:= t_op_dgform_old.fields[j].value; end; frm_op_seae.t_op_dgform.post; t_op_dgform_old.next; end; close; end; procedure Tfrm_op_dg_his.Edit1KeyPress(Sender: TObject; var Key: Char); begin if key=#13 then begin key:=#0; frm_op_dg_his.bsSkinButton2Click(Sender); end; end; end.