unit u_op_truck; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, dxExEdtr, XPMenu, Menus, DB, ADODB, dxDBTLCl, dxGrClms, dxDBCtrl, dxDBGrid, dxTL, dxCntner, Mask, wwdbedit, Wwdotdot, Wwdbcomb, wwdblook, RxLookup, wwdbdatetimepicker, StdCtrls, bsSkinCtrls, ExtCtrls, DBCtrls, ComCtrls, bsSkinTabs, bsdbctrls, Grids, Wwdbigrd, Wwdbgrid; type Tfrm_op_truck = class(TForm) Panel2: TPanel; t_op_seae: TADOQuery; t_op_seae1: TDataSource; PopupMenu2: TPopupMenu; N10: TMenuItem; N11: TMenuItem; N14: TMenuItem; N13: TMenuItem; N12: TMenuItem; N15: TMenuItem; N16: TMenuItem; XPMenu1: TXPMenu; t_op_letter: TADOQuery; t_op_letter1: TDataSource; t_op_letter_pc: TADOQuery; t_op_letter_pc1: TDataSource; bsSkinPageControl1: TbsSkinPageControl; bsSkinTabSheet1: TbsSkinTabSheet; dxDBGrid1: TdxDBGrid; dxDBGrid1Column86: TdxDBGridCheckColumn; dxDBGrid1Column87: TdxDBGridCheckColumn; dxDBGrid1Column88: TdxDBGridColumn; dxDBGrid1Column1: TdxDBGridMaskColumn; dxDBGrid1Column4: TdxDBGridMaskColumn; dxDBGrid1Column5: TdxDBGridMaskColumn; dxDBGrid1Column6: TdxDBGridMaskColumn; dxDBGrid1Column7: TdxDBGridMaskColumn; dxDBGrid1Column13: TdxDBGridMaskColumn; dxDBGrid1Column14: TdxDBGridMaskColumn; dxDBGrid1Column15: TdxDBGridMaskColumn; dxDBGrid1Column16: TdxDBGridDateColumn; dxDBGrid1Column17: TdxDBGridDateColumn; dxDBGrid1Column19: TdxDBGridMaskColumn; dxDBGrid1Column20: 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; dxDBGrid1Column61: TdxDBGridMaskColumn; dxDBGrid1TEU: TdxDBGridMaskColumn; dxDBGrid1Column63: TdxDBGridMaskColumn; dxDBGrid1Column64: TdxDBGridMaskColumn; dxDBGrid1Column65: TdxDBGridDateColumn; dxDBGrid1Column66: TdxDBGridMaskColumn; dxDBGrid1Column67: TdxDBGridMaskColumn; dxDBGrid1Column72: TdxDBGridMaskColumn; dxDBGrid1Column74: TdxDBGridMaskColumn; bsSkinTabSheet2: TbsSkinTabSheet; dxDBGrid2: TdxDBGrid; dxDBGridMaskColumn1: TdxDBGridMaskColumn; dxDBGrid1HEAD_TO: TdxDBGridMaskColumn; dxDBGridColumn1: TdxDBGridColumn; dxDBGridColumn2: TdxDBGridColumn; bsSkinPanel2: TbsSkinPanel; bsSkinPanel3: TbsSkinPanel; bsSkinButton1: TbsSkinButton; bsSkinButton3: TbsSkinButton; bsSkinButton4: TbsSkinButton; bsSkinButton7: TbsSkinButton; bsSkinButton9: TbsSkinButton; bsSkinPanel4: TbsSkinPanel; Label13: TLabel; Label14: TLabel; DBEdit1: TDBEdit; DBEdit2: TDBEdit; Button5: TButton; Label29: TLabel; DBEdit14: TDBEdit; Label49: TLabel; DBEdit31: TDBEdit; Label50: TLabel; DBEdit32: TDBEdit; Button2: TButton; DBEdit17: TDBEdit; Label15: TLabel; Label31: TLabel; DBEdit18: TDBEdit; Label32: TLabel; DBEdit19: TDBEdit; Label33: TLabel; DBEdit20: TDBEdit; Label28: TLabel; DBEdit11: TDBEdit; Button1: TButton; DBEdit21: TDBEdit; Label34: TLabel; Label35: TLabel; DBEdit22: TDBEdit; Label36: TLabel; DBEdit23: TDBEdit; Button3: TButton; DBEdit24: TDBEdit; Label37: TLabel; Label38: TLabel; DBEdit25: TDBEdit; DBMemo13: TDBMemo; Label39: TLabel; bsSkinPanel5: TbsSkinPanel; Label17: TLabel; Label18: TLabel; Label19: TLabel; Label20: TLabel; Label22: TLabel; Label23: TLabel; Label24: TLabel; Label25: TLabel; DBEdit5: TDBEdit; DBEdit6: TDBEdit; DBEdit10: TDBEdit; DBEdit12: TDBEdit; DBEdit13: TDBEdit; DBEdit45: TDBEdit; DBEdit46: TDBEdit; PopupMenu1: TPopupMenu; N1: TMenuItem; N2: TMenuItem; N21: TMenuItem; N22: TMenuItem; N20: TMenuItem; bsSkinButton14: TbsSkinButton; RxDBLookupCombo10: TRxDBLookupCombo; dxDBGrid1Column41: TdxDBGridColumn; dxDBGrid1Column42: TdxDBGridColumn; dxDBGrid1Column43: TdxDBGridColumn; bsSkinPanel1: TbsSkinPanel; Label6: TLabel; Label3: TLabel; Label1: TLabel; Label2: TLabel; Label10: TLabel; Label5: TLabel; Label9: TLabel; Label8: TLabel; Label11: TLabel; Label30: TLabel; Label125: TLabel; Label16: TLabel; Label7: TLabel; Label4: TLabel; Label12: TLabel; Edit1: TEdit; Edit4: TEdit; Edit2: TEdit; Edit3: TEdit; wwDBDateTimePicker1: TwwDBDateTimePicker; wwDBDateTimePicker2: TwwDBDateTimePicker; RxDBLookupCombo2: TRxDBLookupCombo; wwDBDateTimePicker3: TwwDBDateTimePicker; wwDBDateTimePicker4: TwwDBDateTimePicker; Edit7: TEdit; wwDBLookupCombo49: TwwDBLookupCombo; RxDBLookupCombo6: TRxDBLookupCombo; wwDBComboBox1: TwwDBComboBox; wwDBDateTimePicker5: TwwDBDateTimePicker; wwDBDateTimePicker6: TwwDBDateTimePicker; bsSkinButton8: TbsSkinButton; bsSkinButton11: TbsSkinButton; bsSkinButton13: TbsSkinButton; bsSkinButton12: TbsSkinButton; bsSkinButton10: TbsSkinButton; bsSkinButton6: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinButton5: TbsSkinButton; bsSkinButton15: TbsSkinButton; bsSkinButton16: TbsSkinButton; Label21: TLabel; RxDBLookupCombo1: TRxDBLookupCombo; Label26: TLabel; DBEdit3: TDBEdit; Label27: TLabel; DBEdit4: TDBEdit; t_op_letter_pc_ctn1: TDataSource; t_op_letter_pc_ctn: TADOQuery; bsSkinPanel6: TbsSkinPanel; wwDBGrid1: TwwDBGrid; bsSkinPanel7: TbsSkinPanel; bsSkinDBNavigator1: TbsSkinDBNavigator; wwDBLookupCombo1: TwwDBLookupCombo; 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 Edit1KeyPress(Sender: TObject; var Key: Char); procedure bsSkinButton13Click(Sender: TObject); procedure bsSkinButton12Click(Sender: TObject); procedure bsSkinButton8Click(Sender: TObject); procedure bsSkinButton11Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure t_op_letterAfterInsert(DataSet: TDataSet); procedure bsSkinButton1Click(Sender: TObject); procedure t_op_letterBeforeInsert(DataSet: TDataSet); procedure t_op_letter_pcBeforeInsert(DataSet: TDataSet); procedure t_op_letter_pcAfterInsert(DataSet: TDataSet); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton4Click(Sender: TObject); procedure bsSkinButton7Click(Sender: TObject); procedure bsSkinButton9Click(Sender: TObject); procedure N1Click(Sender: TObject); procedure N21Click(Sender: TObject); procedure N20Click(Sender: TObject); procedure Button5Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure dxDBGrid1DblClick(Sender: TObject); procedure t_op_letterBeforeEdit(DataSet: TDataSet); procedure bsSkinButton14Click(Sender: TObject); procedure bsSkinButton16Click(Sender: TObject); procedure t_op_seaeBeforeEdit(DataSet: TDataSet); procedure bsSkinButton15Click(Sender: TObject); procedure t_op_seaeBeforePost(DataSet: TDataSet); procedure Panel2Resize(Sender: TObject); procedure t_op_letter_pc_ctnAfterInsert(DataSet: TDataSet); private { Private declarations } public { Public declarations } end; var frm_op_truck: Tfrm_op_truck; frm_op_truck_insert:boolean; implementation uses u_main, u_data_share, u_code_send_head, u_code_truck_client, u_code_truck_changzhan, my_sys_function, my_sys_chat; {$R *.dfm} procedure Tfrm_op_truck.FormClose(Sender: TObject; var Action: TCloseAction); begin savereggrid(dxdbgrid1,caption); frm_op_truck.Hide; frm_op_truck.ManualFloat(frm_op_truck.BoundsRect ); frm_main.freeTabs('frm_op_truck'); action:=cafree; frm_op_truck:=nil; end; procedure Tfrm_op_truck.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_op_truck.bsSkinButton10Click(Sender: TObject); var str:widestring; begin if (wwDBDateTimePicker5.text<>'')or(wwDBDateTimePicker6.text<>'') then begin str:='where 是否派车=1'; if wwDBDateTimePicker5.text<>'' then str:=str+' and 派车日期>='+''''+wwDBDateTimePicker5.text+''''; if wwDBDateTimePicker6.text<>'' then str:=str+' and 派车日期<='+''''+wwDBDateTimePicker6.text+''''; end else begin if wwDBComboBox1.text='' then str:='where 请求派车=1 and 是否派车=0'; if wwDBComboBox1.text='没有派车' then str:='where 请求派车=1 and 是否派车=0'; if wwDBComboBox1.text='已经派车' then str:='where 请求派车=1 and 是否派车=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[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 RxDBLookupCombo1.DisplayValues[1]<>''then str:=str+' and 承运车队='+''''+RxDBLookupCombo1.DisplayValues[1]+''''; t_op_seae.close; t_op_seae.sql.clear; t_op_seae.sql.add('select * from t_op_seae '+str+default_sort(53,'t_op_seae','','desc')); t_op_seae.open; end; procedure Tfrm_op_truck.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:=''; RxDBLookupCombo1.ClearValue; RxDBLookupCombo6.ClearValue; wwDBComboBox1.text:=''; wwDBDateTimePicker5.text:=''; wwDBDateTimePicker6.text:=''; end; procedure Tfrm_op_truck.dxDBGrid1ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); begin Column_sort(Column,t_op_seae,'业务编号'); end; procedure Tfrm_op_truck.N10Click(Sender: TObject); begin update_grid_view_no(dxdbgrid1); end; procedure Tfrm_op_truck.N14Click(Sender: TObject); begin update_grid_view_all(dxdbgrid1); end; procedure Tfrm_op_truck.N12Click(Sender: TObject); begin update_grid(dxdbgrid1,100); end; procedure Tfrm_op_truck.N16Click(Sender: TObject); begin grid_save_xls(dxdbgrid1); end; procedure Tfrm_op_truck.FormShow(Sender: TObject); begin loadreggrid(dxdbgrid1,true,caption); t_op_seae.open; t_op_letter.open; t_op_letter_pc.Open; t_op_letter_pc_ctn.Open; end; procedure Tfrm_op_truck.Edit1KeyPress(Sender: TObject; var Key: Char); begin if key=#13 then begin key:=#0; frm_op_truck.bsSkinButton10Click(Sender); end; end; procedure Tfrm_op_truck.bsSkinButton13Click(Sender: TObject); begin if t_op_seae.IsEmpty then exit; if t_op_seae.FieldByName('是否派车').asboolean then begin showmessage('当前业务已经派车!!'); exit; end; if t_op_seae.FieldByName('业务状态').asstring='业务封帐' then begin showmessage('当前业务已经封帐!!'); exit; end; if t_op_seae.fieldbyname('承运车队').asstring=''then begin showmessage('晴添入承运车队!!'); exit; end; t_op_seae.Edit; t_op_seae['是否派车']:=1; t_op_seae['派车日期']:=date; t_op_seae.post; { Send_op_do('调度确认派车,业务编号:'+t_op_seae.fieldbyname('业务编号').AsString +',主提单号:'+t_op_seae.fieldbyname('主提单号').AsString,'38', t_op_seae.fieldbyname('操作员').AsString, t_op_seae.fieldbyname('客服员').AsString, t_op_seae.fieldbyname('揽货人').AsString); } showmessage('确认派车成功!!'); end; procedure Tfrm_op_truck.bsSkinButton12Click(Sender: TObject); begin if t_op_seae.IsEmpty then exit; if not t_op_seae.FieldByName('是否派车').asboolean then begin showmessage('当前业务还没有派车!!'); exit; end; if t_op_seae.FieldByName('业务状态').asstring='业务封帐' then begin showmessage('当前业务已经封帐!!'); exit; end; t_op_seae.Edit; t_op_seae['是否派车']:=0; t_op_seae['派车日期']:=null; t_op_seae.post; showmessage('取消派车成功!!'); end; procedure Tfrm_op_truck.bsSkinButton8Click(Sender: TObject); begin table_Prior(t_op_seae); end; procedure Tfrm_op_truck.bsSkinButton11Click(Sender: TObject); begin table_Next(t_op_seae); end; procedure Tfrm_op_truck.bsSkinButton2Click(Sender: TObject); begin t_op_seae.close; t_op_seae.sql.clear; t_op_seae.sql.add('select * from t_op_seae where 请求派车=1 and 是否派车=0'+default_sort(53,'t_op_seae','','desc')); t_op_seae.open; end; procedure Tfrm_op_truck.t_op_letterAfterInsert(DataSet: TDataSet); begin t_op_letter['函电名称']:='派车通知'; t_op_letter['编号']:=t_op_seae['编号']; t_op_letter['签发人']:=employee; t_op_letter['签发日期']:=date; frm_op_truck_insert:=false; end; procedure Tfrm_op_truck.bsSkinButton1Click(Sender: TObject); begin if t_op_seae.IsEmpty then exit; frm_op_truck_insert:=true; t_op_letter.Insert; t_op_letter.Post; t_op_letter_pc.insert; end; procedure Tfrm_op_truck.t_op_letterBeforeInsert(DataSet: TDataSet); begin if not frm_op_truck_insert then abort; end; procedure Tfrm_op_truck.t_op_letter_pcBeforeInsert(DataSet: TDataSet); begin if t_op_letter.IsEmpty then abort; end; procedure Tfrm_op_truck.t_op_letter_pcAfterInsert(DataSet: TDataSet); begin t_op_letter_pc['LE_ID']:=t_op_letter['LE_ID']; t_op_letter_pc['箱型箱量']:=t_op_letter.DataSource.DataSet.fieldbyname('集装箱').asstring; if frm_data_share.t_code_truck_client.Locate('厂家名称',t_op_letter.DataSource.DataSet.fieldbyname('委托单位').asstring,[])then begin t_op_letter_pc['厂家地址']:=frm_data_share.t_code_truck_client['厂家地址']; t_op_letter_pc['厂家联系人']:=frm_data_share.t_code_truck_client['厂家联系人']; t_op_letter_pc['厂家联系电话']:=frm_data_share.t_code_truck_client['厂家联系电话']; end; t_op_letter_pc['背箱场站']:=t_op_letter.DataSource.DataSet.fieldbyname('场站').asstring; t_op_letter_pc['返箱地址']:=t_op_letter.DataSource.DataSet.fieldbyname('场站').asstring; if frm_data_share.t_code_truck_changzhan.Locate('场站名称',t_op_letter.DataSource.DataSet.fieldbyname('场站').asstring,[])then begin t_op_letter_pc['背箱场站']:=frm_data_share.t_code_truck_changzhan['场站名称']; t_op_letter_pc['场站联系人']:=frm_data_share.t_code_truck_changzhan['场站联系人']; t_op_letter_pc['场站电话']:=frm_data_share.t_code_truck_changzhan['场站电话']; t_op_letter_pc['返箱地址']:=frm_data_share.t_code_truck_changzhan['场站名称']; t_op_letter_pc['返箱联系人']:=frm_data_share.t_code_truck_changzhan['场站联系人']; t_op_letter_pc['返箱联系电话']:=frm_data_share.t_code_truck_changzhan['场站电话']; end; end; procedure Tfrm_op_truck.bsSkinButton3Click(Sender: TObject); begin table_post(t_op_letter); table_post(t_op_letter_pc); table_post(t_op_letter_pc_ctn); end; procedure Tfrm_op_truck.bsSkinButton4Click(Sender: TObject); begin if application.MessageBox('您确定要删除数据吗?','警告:',MB_OKCANCEL)=IDOK then begin if not t_op_letter_pc.IsEmpty then t_op_letter_pc.Delete; if not t_op_letter.IsEmpty then t_op_letter.delete; end; end; procedure Tfrm_op_truck.bsSkinButton7Click(Sender: TObject); begin if (t_op_letter_pc.State=dsinsert)or(t_op_letter_pc.State=dsedit) then t_op_letter_pc.cancel; if (t_op_letter.State=dsinsert)or(t_op_letter.State=dsedit) then t_op_letter.cancel; end; procedure Tfrm_op_truck.bsSkinButton9Click(Sender: TObject); var Pnt:Tpoint; begin Pnt:=bsSkinButton9.ClientToScreen(Point(0,bsSkinButton9.Height)); PopupMenu1.Popup(Pnt.x,Pnt.y); end; procedure Tfrm_op_truck.N1Click(Sender: TObject); var book1:Tbookmark; begin if t_op_letter.IsEmpty then exit; if (t_op_letter.State=dsinsert)or(t_op_letter.State=dsedit) then t_op_letter.post; if (t_op_letter_pc.State=dsinsert)or(t_op_letter_pc.State=dsedit) then t_op_letter_pc.post; try book1:=t_op_letter.GetBookmark; t_op_letter.DisableControls; sys_print('海运出口派车通知',1,t_op_letter.DataSource,t_op_letter1,t_op_letter_pc1,nil,nil,nil,nil,nil,nil,nil,nil); finally t_op_letter.GotoBookmark(book1); t_op_letter.EnableControls; end; end; procedure Tfrm_op_truck.N21Click(Sender: TObject); var book1:Tbookmark; begin if t_op_letter.IsEmpty then exit; if (t_op_letter.State=dsinsert)or(t_op_letter.State=dsedit) then t_op_letter.post; if (t_op_letter_pc.State=dsinsert)or(t_op_letter_pc.State=dsedit) then t_op_letter_pc.post; try book1:=t_op_letter.GetBookmark; t_op_letter.DisableControls; sys_print('海运出口派车通知',3,t_op_letter.DataSource,t_op_letter1,t_op_letter_pc1,nil,nil,nil,nil,nil,nil,nil,nil); finally t_op_letter.GotoBookmark(book1); t_op_letter.EnableControls; end; end; procedure Tfrm_op_truck.N20Click(Sender: TObject); var book1:Tbookmark; begin if t_op_letter.IsEmpty then exit; if (t_op_letter.State=dsinsert)or(t_op_letter.State=dsedit) then t_op_letter.post; if (t_op_letter_pc.State=dsinsert)or(t_op_letter_pc.State=dsedit) then t_op_letter_pc.post; try book1:=t_op_letter.GetBookmark; t_op_letter.DisableControls; sys_print('海运出口派车通知',2,t_op_letter.DataSource,t_op_letter1,t_op_letter_pc1,nil,nil,nil,nil,nil,nil,nil,nil); finally t_op_letter.GotoBookmark(book1); t_op_letter.EnableControls; end; end; procedure Tfrm_op_truck.Button5Click(Sender: TObject); begin if t_op_letter.isempty then exit; if not if_open('144') then begin showmessage('对不起你没有此模块的操作权限!'); exit; end; try frm_code_send_head:=tfrm_code_send_head.Create (self); code_send_head_num:=4; frm_code_send_head.ShowModal; finally frm_code_send_head.Free; frm_code_send_head:=nil; end; end; procedure Tfrm_op_truck.Button2Click(Sender: TObject); begin if t_op_letter_pc.IsEmpty then exit; try frm_code_truck_changzhan:=tfrm_code_truck_changzhan.Create (self); code_truck_changzhan_num:=4; frm_code_truck_changzhan.ShowModal; finally frm_code_truck_changzhan.Free; frm_code_truck_changzhan:=nil; end; end; procedure Tfrm_op_truck.Button1Click(Sender: TObject); begin if t_op_letter_pc.IsEmpty then exit; try frm_code_truck_client:=tfrm_code_truck_client.Create (self); code_truck_client_num:=2; frm_code_truck_client.ShowModal; finally frm_code_truck_client.Free; frm_code_truck_client:=nil; end; end; procedure Tfrm_op_truck.Button3Click(Sender: TObject); begin if t_op_letter_pc.IsEmpty then exit; try frm_code_truck_changzhan:=tfrm_code_truck_changzhan.Create (self); code_truck_changzhan_num:=5; frm_code_truck_changzhan.ShowModal; finally frm_code_truck_changzhan.Free; frm_code_truck_changzhan:=nil; end; end; procedure Tfrm_op_truck.dxDBGrid1DblClick(Sender: TObject); begin bsSkinTabSheet2.Show; end; procedure Tfrm_op_truck.t_op_letterBeforeEdit(DataSet: TDataSet); begin if t_op_letter['签发人']<>employee then begin showmessage('对不起此函电是'+t_op_letter['签发人']+'录入的,您无权修改!!'); abort; end; end; procedure Tfrm_op_truck.bsSkinButton14Click(Sender: TObject); var afield,bfield: variant; i: Integer; pc:boolean; begin if t_op_letter.IsEmpty then begin showmessage('没有复制母体,不能复制新建!'); exit; end; afield := vararraycreate([0,t_op_letter.fieldcount-1],varvariant); for i := 0 to (t_op_letter.fieldcount-1) do begin afield[i] :=t_op_letter.fields[i].value ; end; if not t_op_letter_pc.IsEmpty then begin bfield := vararraycreate([0,t_op_letter_pc.fieldcount-1],varvariant); for i := 0 to (t_op_letter_pc.fieldcount-1) do begin bfield[i] :=t_op_letter_pc.fields[i].value ; end; pc:=true; end; frm_op_truck_insert:=true; t_op_letter.append; for i := 0 to (t_op_letter.fieldcount-1) do begin if t_op_letter.fields[i].FieldName<>'LE_ID'then t_op_letter.fields[i].value := afield[i] ; end; t_op_letter['签发人']:=employee; t_op_letter['签发日期']:=date; t_op_letter.post; t_op_letter_pc.append; for i := 0 to (t_op_letter_pc.fieldcount-1) do begin if t_op_letter_pc.fields[i].FieldName<>'LE_ID'then t_op_letter_pc.fields[i].value := bfield[i] ; end; t_op_letter_pc.post; end; procedure Tfrm_op_truck.bsSkinButton16Click(Sender: TObject); begin table_post(t_op_seae); end; procedure Tfrm_op_truck.t_op_seaeBeforeEdit(DataSet: TDataSet); begin if t_op_seae.FieldByName('业务状态').asstring='业务封帐' then begin showmessage('当前业务已经封帐,不能修改!!'); abort; end; end; procedure Tfrm_op_truck.bsSkinButton15Click(Sender: TObject); begin sys_print('海运出口派车统计',2,nil,nil,nil,nil,t_op_seae1,nil,nil,nil,nil,nil,nil); end; procedure Tfrm_op_truck.t_op_seaeBeforePost(DataSet: TDataSet); begin t_op_seae['陆运利润']:=t_op_seae.fieldbyname('应收陆运').asfloat-t_op_seae.fieldbyname('应付陆运').asfloat; end; procedure Tfrm_op_truck.Panel2Resize(Sender: TObject); var i:integer; begin i:=round(Panel2.width/10); bsSkinButton8.width:=i; bsSkinButton11.width:=i; bsSkinButton15.width:=i; bsSkinButton6.width:=i; bsSkinButton10.width:=i; bsSkinButton2.width:=i; bsSkinButton13.width:=i; bsSkinButton12.width:=i; bsSkinButton16.width:=i; end; procedure Tfrm_op_truck.t_op_letter_pc_ctnAfterInsert(DataSet: TDataSet); begin t_op_letter_pc_ctn['LE_ID']:=t_op_letter['LE_ID']; end; end.