unit u_op_kuaidi_shen; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, bsSkinCtrls, ExtCtrls, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, DB, ADODB, dxDBTLCl, dxGrClms, StdCtrls, Mask, DBCtrls, wwdbdatetimepicker, ComCtrls, bsSkinTabs, RxLookup, Menus, XPMenu, wwdbedit, Wwdotdot, Wwdbcomb; type Tfrm_op_kuaidi_shen = class(TForm) Panel2: TPanel; bsSkinButton7: TbsSkinButton; bsSkinButton6: TbsSkinButton; bsSkinButton9: TbsSkinButton; bsSkinButton10: TbsSkinButton; bsSkinButton1: TbsSkinButton; bsSkinButton11: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinButton4: TbsSkinButton; bsSkinButton3: TbsSkinButton; bsSkinButton5: TbsSkinButton; Notebook1: TNotebook; dxDBGrid1: TdxDBGrid; t_op_kuaidi: TADOQuery; t_op_kuaidi1: TDataSource; t_op_kuaidi_detail: TADOQuery; dxDBGrid1Column1: TdxDBGridMaskColumn; dxDBGrid1Column2: TdxDBGridMaskColumn; dxDBGrid1Column3: TdxDBGridMaskColumn; dxDBGrid1Column4: TdxDBGridMaskColumn; dxDBGrid1Column5: TdxDBGridMaskColumn; dxDBGrid1Column6: TdxDBGridMaskColumn; dxDBGrid1Column7: TdxDBGridDateColumn; dxDBGrid1Column8: TdxDBGridMaskColumn; dxDBGrid1Column9: TdxDBGridDateColumn; dxDBGrid1Column10: TdxDBGridMaskColumn; dxDBGrid1Column11: TdxDBGridDateColumn; bsSkinPageControl1: TbsSkinPageControl; bsSkinTabSheet1: TbsSkinTabSheet; bsSkinTabSheet2: TbsSkinTabSheet; Label1: TLabel; DBEdit1: TDBEdit; Label2: TLabel; DBEdit2: TDBEdit; Label9: TLabel; wwDBDateTimePicker1: TwwDBDateTimePicker; Label10: TLabel; DBEdit10: TDBEdit; Label11: TLabel; DBEdit11: TDBEdit; bsSkinGroupBox1: TbsSkinGroupBox; Label4: TLabel; Label5: TLabel; Label6: TLabel; Label7: TLabel; Label8: TLabel; Label12: TLabel; DBEdit4: TDBEdit; DBEdit5: TDBEdit; DBMemo1: TDBMemo; DBEdit6: TDBEdit; DBEdit7: TDBEdit; DBEdit8: TDBEdit; bsSkinGroupBox2: TbsSkinGroupBox; Label13: TLabel; Label14: TLabel; Label15: TLabel; Label16: TLabel; Label17: TLabel; Label18: TLabel; DBEdit9: TDBEdit; DBEdit12: TDBEdit; DBMemo2: TDBMemo; DBEdit13: TDBEdit; DBEdit14: TDBEdit; DBEdit15: TDBEdit; bsSkinGroupBox3: TbsSkinGroupBox; DBMemo3: TDBMemo; t_op_seae: TADOQuery; t_op_seae1: TDataSource; t_op_seai: TADOQuery; t_op_aire: TADOQuery; t_op_airi: TADOQuery; t_op_airi1: TDataSource; t_op_aire1: TDataSource; t_op_seai1: TDataSource; Panel1: TPanel; bsSkinPageControl2: TbsSkinPageControl; bsSkinTabSheet3: TbsSkinTabSheet; bsSkinPanel1: TbsSkinPanel; dxDBGrid2: TdxDBGrid; dxDBGrid2Column1: TdxDBGridMaskColumn; dxDBGrid2Column2: TdxDBGridMaskColumn; dxDBGrid2Column3: TdxDBGridMaskColumn; dxDBGrid2Column4: TdxDBGridMaskColumn; dxDBGrid2Column5: TdxDBGridMaskColumn; dxDBGrid2Column9: TdxDBGridDateColumn; dxDBGrid2Column6: TdxDBGridDateColumn; dxDBGrid2Column7: TdxDBGridMaskColumn; dxDBGrid2Column18: TdxDBGridColumn; dxDBGrid2Column8: TdxDBGridMaskColumn; dxDBGrid2Column10: TdxDBGridMaskColumn; dxDBGrid2Column14: TdxDBGridMaskColumn; dxDBGrid2Column11: TdxDBGridMaskColumn; dxDBGrid2Column12: TdxDBGridColumn; dxDBGrid2Column13: TdxDBGridColumn; dxDBGrid2Column15: TdxDBGridMaskColumn; dxDBGrid2Column16: TdxDBGridMaskColumn; dxDBGrid2Column17: TdxDBGridMaskColumn; bsSkinPanel2: TbsSkinPanel; Label3: TLabel; Label19: TLabel; Label20: TLabel; Label21: TLabel; Label22: TLabel; Label23: TLabel; Label24: TLabel; Label25: TLabel; Edit4: TEdit; Edit2: TEdit; Edit3: TEdit; wwDBDateTimePicker2: TwwDBDateTimePicker; wwDBDateTimePicker3: TwwDBDateTimePicker; wwDBDateTimePicker4: TwwDBDateTimePicker; wwDBDateTimePicker5: TwwDBDateTimePicker; RxDBLookupCombo2: TRxDBLookupCombo; bsSkinButton8: TbsSkinButton; bsSkinButton12: TbsSkinButton; bsSkinTabSheet4: TbsSkinTabSheet; bsSkinPanel3: TbsSkinPanel; Label26: TLabel; Label27: TLabel; Label28: TLabel; Label29: TLabel; Label30: TLabel; Label31: TLabel; Label32: TLabel; Label33: TLabel; Edit1: TEdit; Edit5: TEdit; Edit6: TEdit; wwDBDateTimePicker6: TwwDBDateTimePicker; wwDBDateTimePicker7: TwwDBDateTimePicker; wwDBDateTimePicker8: TwwDBDateTimePicker; wwDBDateTimePicker9: TwwDBDateTimePicker; RxDBLookupCombo1: TRxDBLookupCombo; bsSkinButton13: TbsSkinButton; bsSkinButton14: TbsSkinButton; bsSkinPanel4: TbsSkinPanel; dxDBGrid5: TdxDBGrid; dxDBGridMaskColumn3: TdxDBGridMaskColumn; dxDBGridMaskColumn4: TdxDBGridMaskColumn; dxDBGridMaskColumn5: TdxDBGridMaskColumn; dxDBGrid4Column19: TdxDBGridColumn; dxDBGridMaskColumn6: TdxDBGridMaskColumn; dxDBGridMaskColumn7: TdxDBGridMaskColumn; dxDBGridDateColumn1: TdxDBGridDateColumn; dxDBGridDateColumn2: TdxDBGridDateColumn; dxDBGridMaskColumn8: TdxDBGridMaskColumn; dxDBGridColumn4: TdxDBGridColumn; dxDBGridMaskColumn9: TdxDBGridMaskColumn; dxDBGridMaskColumn10: TdxDBGridMaskColumn; dxDBGridMaskColumn11: TdxDBGridMaskColumn; dxDBGridMaskColumn12: TdxDBGridMaskColumn; dxDBGridColumn5: TdxDBGridColumn; dxDBGridColumn6: TdxDBGridColumn; dxDBGridMaskColumn13: TdxDBGridMaskColumn; dxDBGridMaskColumn14: TdxDBGridMaskColumn; dxDBGridMaskColumn15: TdxDBGridMaskColumn; bsSkinTabSheet5: TbsSkinTabSheet; bsSkinPanel5: TbsSkinPanel; Label34: TLabel; Label35: TLabel; Label36: TLabel; Label37: TLabel; Label38: TLabel; Label39: TLabel; Label40: TLabel; Label41: TLabel; Edit8: TEdit; Edit9: TEdit; Edit10: TEdit; wwDBDateTimePicker10: TwwDBDateTimePicker; wwDBDateTimePicker11: TwwDBDateTimePicker; wwDBDateTimePicker12: TwwDBDateTimePicker; wwDBDateTimePicker13: TwwDBDateTimePicker; RxDBLookupCombo3: TRxDBLookupCombo; bsSkinButton15: TbsSkinButton; bsSkinButton16: TbsSkinButton; bsSkinPanel6: TbsSkinPanel; dxDBGrid8: TdxDBGrid; dxDBGridMaskColumn19: TdxDBGridMaskColumn; dxDBGridMaskColumn20: TdxDBGridMaskColumn; dxDBGridMaskColumn21: TdxDBGridMaskColumn; dxDBGridMaskColumn22: TdxDBGridMaskColumn; dxDBGridMaskColumn23: TdxDBGridMaskColumn; dxDBGridDateColumn3: TdxDBGridDateColumn; dxDBGridDateColumn4: TdxDBGridDateColumn; dxDBGridColumn12: TdxDBGridColumn; dxDBGridMaskColumn24: TdxDBGridMaskColumn; dxDBGridMaskColumn26: TdxDBGridMaskColumn; dxDBGridColumn13: TdxDBGridColumn; dxDBGridColumn14: TdxDBGridColumn; dxDBGridMaskColumn27: TdxDBGridMaskColumn; dxDBGridMaskColumn28: TdxDBGridMaskColumn; dxDBGridMaskColumn29: TdxDBGridMaskColumn; bsSkinTabSheet6: TbsSkinTabSheet; bsSkinPanel7: TbsSkinPanel; Label42: TLabel; Label43: TLabel; Label44: TLabel; Label45: TLabel; Label46: TLabel; Label47: TLabel; Label48: TLabel; Label49: TLabel; Edit7: TEdit; Edit11: TEdit; Edit12: TEdit; wwDBDateTimePicker14: TwwDBDateTimePicker; wwDBDateTimePicker15: TwwDBDateTimePicker; wwDBDateTimePicker16: TwwDBDateTimePicker; wwDBDateTimePicker17: TwwDBDateTimePicker; RxDBLookupCombo4: TRxDBLookupCombo; bsSkinButton17: TbsSkinButton; bsSkinButton18: TbsSkinButton; bsSkinPanel8: TbsSkinPanel; dxDBGrid11: TdxDBGrid; dxDBGridMaskColumn25: TdxDBGridMaskColumn; dxDBGridMaskColumn33: TdxDBGridMaskColumn; dxDBGridMaskColumn34: TdxDBGridMaskColumn; dxDBGridMaskColumn35: TdxDBGridMaskColumn; dxDBGridMaskColumn36: TdxDBGridMaskColumn; dxDBGridDateColumn5: TdxDBGridDateColumn; dxDBGridDateColumn6: TdxDBGridDateColumn; dxDBGridColumn20: TdxDBGridColumn; dxDBGridMaskColumn37: TdxDBGridMaskColumn; dxDBGridMaskColumn38: TdxDBGridMaskColumn; dxDBGridColumn21: TdxDBGridColumn; dxDBGridColumn22: TdxDBGridColumn; dxDBGridMaskColumn39: TdxDBGridMaskColumn; dxDBGridMaskColumn40: TdxDBGridMaskColumn; dxDBGridMaskColumn41: TdxDBGridMaskColumn; bsSkinGroupBox4: TbsSkinGroupBox; DBMemo4: TDBMemo; v_fee_do_seae: TADOQuery; v_fee_do_seae1: TDataSource; v_fee_do_seai: TADOQuery; v_fee_do_seai1: TDataSource; v_fee_do_aire: TADOQuery; v_fee_do_aire1: TDataSource; v_fee_do_airi: TADOQuery; v_fee_do_airi1: TDataSource; bsSkinPageControl3: TbsSkinPageControl; bsSkinTabSheet7: TbsSkinTabSheet; dxDBGrid3: TdxDBGrid; dxDBGridMaskColumn1: TdxDBGridMaskColumn; dxDBGridMaskColumn2: TdxDBGridMaskColumn; dxDBGridMaskColumn16: TdxDBGridMaskColumn; dxDBGridMaskColumn17: TdxDBGridMaskColumn; dxDBGridDateColumn7: TdxDBGridDateColumn; dxDBGridMaskColumn31: TdxDBGridMaskColumn; dxDBGrid1Column12: TdxDBGridMaskColumn; dxDBGrid1Column13: TdxDBGridMaskColumn; dxDBGrid1Column14: TdxDBGridMaskColumn; dxDBGrid1Column15: TdxDBGridMaskColumn; dxDBGrid1Column16: TdxDBGridColumn; dxDBGrid1Column17: TdxDBGridColumn; dxDBGrid1Column18: TdxDBGridMaskColumn; dxDBGrid1Column19: TdxDBGridMaskColumn; dxDBGrid1Column20: TdxDBGridMaskColumn; dxDBGrid1Column21: TdxDBGridMaskColumn; bsSkinTabSheet8: TbsSkinTabSheet; dxDBGrid4: TdxDBGrid; dxDBGridMaskColumn32: TdxDBGridMaskColumn; dxDBGridMaskColumn42: TdxDBGridMaskColumn; dxDBGridMaskColumn43: TdxDBGridMaskColumn; dxDBGrid2Column22: TdxDBGridColumn; dxDBGridMaskColumn44: TdxDBGridMaskColumn; dxDBGridDateColumn9: TdxDBGridDateColumn; dxDBGridDateColumn10: TdxDBGridDateColumn; dxDBGridMaskColumn47: TdxDBGridMaskColumn; dxDBGridMaskColumn48: TdxDBGridMaskColumn; dxDBGridMaskColumn49: TdxDBGridMaskColumn; dxDBGridMaskColumn50: TdxDBGridMaskColumn; dxDBGridMaskColumn51: TdxDBGridMaskColumn; dxDBGridColumn8: TdxDBGridColumn; dxDBGridColumn9: TdxDBGridColumn; dxDBGridMaskColumn52: TdxDBGridMaskColumn; dxDBGridMaskColumn53: TdxDBGridMaskColumn; dxDBGridMaskColumn54: TdxDBGridMaskColumn; dxDBGridMaskColumn55: TdxDBGridMaskColumn; bsSkinTabSheet9: TbsSkinTabSheet; dxDBGrid6: TdxDBGrid; dxDBGridMaskColumn56: TdxDBGridMaskColumn; dxDBGridMaskColumn57: TdxDBGridMaskColumn; dxDBGridMaskColumn58: TdxDBGridMaskColumn; dxDBGridMaskColumn59: TdxDBGridMaskColumn; dxDBGridDateColumn11: TdxDBGridDateColumn; dxDBGridDateColumn12: TdxDBGridDateColumn; dxDBGridMaskColumn62: TdxDBGridMaskColumn; dxDBGridMaskColumn63: TdxDBGridMaskColumn; dxDBGridMaskColumn64: TdxDBGridMaskColumn; dxDBGridColumn15: TdxDBGridColumn; dxDBGridColumn16: TdxDBGridColumn; dxDBGridMaskColumn65: TdxDBGridMaskColumn; dxDBGridMaskColumn66: TdxDBGridMaskColumn; dxDBGridMaskColumn67: TdxDBGridMaskColumn; bsSkinTabSheet10: TbsSkinTabSheet; dxDBGrid7: TdxDBGrid; dxDBGridMaskColumn68: TdxDBGridMaskColumn; dxDBGridMaskColumn69: TdxDBGridMaskColumn; dxDBGridMaskColumn70: TdxDBGridMaskColumn; dxDBGridMaskColumn71: TdxDBGridMaskColumn; dxDBGridDateColumn13: TdxDBGridDateColumn; dxDBGridDateColumn14: TdxDBGridDateColumn; dxDBGridMaskColumn74: TdxDBGridMaskColumn; dxDBGridMaskColumn75: TdxDBGridMaskColumn; dxDBGridMaskColumn76: TdxDBGridMaskColumn; dxDBGridColumn19: TdxDBGridColumn; dxDBGridColumn23: TdxDBGridColumn; dxDBGridMaskColumn77: TdxDBGridMaskColumn; dxDBGridMaskColumn78: TdxDBGridMaskColumn; dxDBGridMaskColumn79: TdxDBGridMaskColumn; dxDBGrid3Column17: TdxDBGridColumn; PopupMenu2: TPopupMenu; MenuItem1: TMenuItem; PopupMenu1: TPopupMenu; N1: TMenuItem; bsSkinButton19: TbsSkinButton; dxDBGrid1Column22: TdxDBGridColumn; dxDBGrid1Column23: TdxDBGridColumn; dxDBGrid1Column24: TdxDBGridColumn; wwDBComboBox1: TwwDBComboBox; Label50: TLabel; Label51: TLabel; DBEdit3: TDBEdit; Label52: TLabel; DBEdit16: TDBEdit; RxDBLookupCombo5: TRxDBLookupCombo; Label53: TLabel; dxDBGrid1Column25: TdxDBGridColumn; bsSkinButton20: TbsSkinButton; XPMenu1: TXPMenu; Label54: TLabel; DBEdit17: TDBEdit; dxDBGrid1Column26: TdxDBGridColumn; procedure bsSkinButton12Click(Sender: TObject); procedure bsSkinButton14Click(Sender: TObject); procedure bsSkinButton16Click(Sender: TObject); procedure bsSkinButton18Click(Sender: TObject); procedure bsSkinButton8Click(Sender: TObject); procedure bsSkinButton13Click(Sender: TObject); procedure bsSkinButton15Click(Sender: TObject); procedure bsSkinButton17Click(Sender: TObject); procedure t_op_kuaidiAfterInsert(DataSet: TDataSet); procedure t_op_kuaidiBeforeEdit(DataSet: TDataSet); procedure t_op_kuaidiBeforePost(DataSet: TDataSet); procedure bsSkinButton1Click(Sender: TObject); procedure bsSkinButton11Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton7Click(Sender: TObject); procedure bsSkinButton6Click(Sender: TObject); procedure bsSkinButton5Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormShow(Sender: TObject); procedure kuaidi_add(dxgrid:TdxDBGrid;table:Tadoquery); procedure kuaidi_delete(dxgrid:TdxDBGrid;table:Tadoquery); procedure MenuItem1Click(Sender: TObject); procedure N1Click(Sender: TObject); procedure bsSkinButton4Click(Sender: TObject); procedure Panel2Resize(Sender: TObject); procedure bsSkinButton9Click(Sender: TObject); procedure bsSkinButton19Click(Sender: TObject); procedure bsSkinButton20Click(Sender: TObject); procedure dxDBGrid1Column2CustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean); procedure DBEdit2Change(Sender: TObject); procedure bsSkinButton10Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var frm_op_kuaidi_shen: Tfrm_op_kuaidi_shen; implementation uses u_main, u_data_share, my_sys_function, u_code_send_address, u_op_kuaidi_query; {$R *.dfm} procedure Tfrm_op_kuaidi_shen.kuaidi_add(dxgrid:TdxDBGrid;table:Tadoquery); var i:integer; begin if t_op_kuaidi.IsEmpty then exit; if t_op_kuaidi.fieldbyname('申请状态').asstring='确认发出' then exit; if table.IsEmpty then exit; table_post(t_op_kuaidi); if dxgrid.SelectedCount>=1 then begin for i:=0 to dxgrid.SelectedCount-1 do begin table.GotoBookmark(pointer(dxgrid.selectedrows[i])); if not t_op_kuaidi_detail.Locate('编号',table.fieldbyname('编号').asstring,[])then begin t_op_kuaidi_detail.insert; t_op_kuaidi_detail['发送编号']:=t_op_kuaidi['发送编号']; t_op_kuaidi_detail['编号']:=table.fieldbyname('编号').asstring; t_op_kuaidi_detail.post; end; end; end else begin if not t_op_kuaidi_detail.Locate('编号',table.fieldbyname('编号').asstring,[])then begin t_op_kuaidi_detail.insert; t_op_kuaidi_detail['发送编号']:=t_op_kuaidi['发送编号']; t_op_kuaidi_detail['编号']:=table.fieldbyname('编号').asstring; t_op_kuaidi_detail.post; end; end; end; procedure Tfrm_op_kuaidi_shen.kuaidi_delete(dxgrid:TdxDBGrid;table:Tadoquery); var i:integer; begin if t_op_kuaidi.IsEmpty then exit; if t_op_kuaidi.fieldbyname('申请状态').asstring='确认发出' then exit; if table.IsEmpty then exit; if dxgrid.SelectedCount>=1 then begin for i:=0 to dxgrid.SelectedCount-1 do begin table.GotoBookmark(pointer(dxgrid.selectedrows[i])); if t_op_kuaidi_detail.Locate('编号',table.fieldbyname('编号').asstring,[])then begin t_op_kuaidi_detail.delete; end; end; end else begin if t_op_kuaidi_detail.Locate('编号',table.fieldbyname('编号').asstring,[])then begin t_op_kuaidi_detail.delete; end; end; end; procedure Tfrm_op_kuaidi_shen.bsSkinButton12Click(Sender: TObject); begin RxDBLookupCombo2.ClearValue; Edit4.text:=''; Edit3.Text:=''; Edit2.text:=''; wwDBDateTimePicker5.Clear; wwDBDateTimePicker2.clear; wwDBDateTimePicker3.clear; wwDBDateTimePicker4.clear; end; procedure Tfrm_op_kuaidi_shen.bsSkinButton14Click(Sender: TObject); begin RxDBLookupCombo1.ClearValue; Edit1.text:=''; Edit5.Text:=''; Edit6.text:=''; wwDBDateTimePicker9.Clear; wwDBDateTimePicker6.clear; wwDBDateTimePicker7.clear; wwDBDateTimePicker8.clear; end; procedure Tfrm_op_kuaidi_shen.bsSkinButton16Click(Sender: TObject); begin RxDBLookupCombo3.ClearValue; Edit8.text:=''; Edit9.Text:=''; Edit10.text:=''; wwDBDateTimePicker13.Clear; wwDBDateTimePicker10.clear; wwDBDateTimePicker11.clear; wwDBDateTimePicker12.clear; end; procedure Tfrm_op_kuaidi_shen.bsSkinButton18Click(Sender: TObject); begin RxDBLookupCombo4.ClearValue; Edit7.text:=''; Edit11.Text:=''; Edit12.text:=''; wwDBDateTimePicker17.Clear; wwDBDateTimePicker14.clear; wwDBDateTimePicker15.clear; wwDBDateTimePicker16.clear; end; procedure Tfrm_op_kuaidi_shen.bsSkinButton8Click(Sender: TObject); var str_op:widestring; begin str_op:=' where '+open_data('0001','录入人','操作员','客服员','报关操作','报检操作'); if Edit4.text<>''then str_op:=str_op+' and 委托编号 like '+''''+'%'+Edit4.text+'%'+''''; if Edit2.text<>''then str_op:=str_op+' and 主提单号 like '+''''+'%'+Edit2.text+'%'+''''; if Edit3.text<>''then str_op:=str_op+' and 分提单号 like '+''''+'%'+Edit3.text+'%'+''''; if wwDBDateTimePicker2.text<>''then str_op:=str_op+' and 开船日期>='+''''+wwDBDateTimePicker2.text+''''; if wwDBDateTimePicker4.text<>''then str_op:=str_op+' and 开船日期<='+''''+wwDBDateTimePicker4.text+''''; if wwDBDateTimePicker3.text<>''then str_op:=str_op+' and 会计期间>='+''''+wwDBDateTimePicker3.text+''''; if wwDBDateTimePicker5.text<>''then str_op:=str_op+' and 会计期间<='+''''+wwDBDateTimePicker5.text+''''; if RxDBLookupCombo2.DisplayValue<>''then str_op:=str_op+' and 委托单位='+''''+RxDBLookupCombo2.DisplayValues[1]+''''; str_op:='select * from t_op_seae'+str_op+default_sort(53,'t_op_seae','','desc'); t_op_seae.close; t_op_seae.SQL.clear; t_op_seae.sql.Add(str_op); t_op_seae.open; end; procedure Tfrm_op_kuaidi_shen.bsSkinButton13Click(Sender: TObject); var str_op:widestring; begin str_op:=' where '+open_data('0002','录入人','操作员','客服员','报关操作','报检操作'); if Edit1.text<>''then str_op:=str_op+' and 委托编号 like '+''''+'%'+Edit1.text+'%'+''''; if Edit5.text<>''then str_op:=str_op+' and 主提单号 like '+''''+'%'+Edit5.text+'%'+''''; if Edit6.text<>''then str_op:=str_op+' and 分提单号 like '+''''+'%'+Edit6.text+'%'+''''; if wwDBDateTimePicker6.text<>''then str_op:=str_op+' and 进口日期>='+''''+wwDBDateTimePicker6.text+''''; if wwDBDateTimePicker8.text<>''then str_op:=str_op+' and 进口日期<='+''''+wwDBDateTimePicker8.text+''''; if wwDBDateTimePicker7.text<>''then str_op:=str_op+' and 会计期间>='+''''+wwDBDateTimePicker7.text+''''; if wwDBDateTimePicker9.text<>''then str_op:=str_op+' and 会计期间<='+''''+wwDBDateTimePicker9.text+''''; if RxDBLookupCombo1.DisplayValue<>''then str_op:=str_op+' and 委托单位='+''''+RxDBLookupCombo1.DisplayValues[1]+''''; str_op:='select * from t_op_seai'+str_op+default_sort(54,'t_op_seai','','desc'); t_op_seai.close; t_op_seai.SQL.clear; t_op_seai.sql.Add(str_op); t_op_seai.open; end; procedure Tfrm_op_kuaidi_shen.bsSkinButton15Click(Sender: TObject); var str_op:widestring; begin str_op:=' where '+open_data('0003','录入人','操作员','客服员','no','no'); if Edit8.text<>''then str_op:=str_op+' and 委托编号 like '+''''+'%'+Edit8.text+'%'+''''; if Edit9.text<>''then str_op:=str_op+' and 主运单号 like '+''''+'%'+Edit9.text+'%'+''''; if Edit10.text<>''then str_op:=str_op+' and 分运单号 like '+''''+'%'+Edit10.text+'%'+''''; if wwDBDateTimePicker10.text<>''then str_op:=str_op+' and 一程开航日期>='+''''+wwDBDateTimePicker10.text+''''; if wwDBDateTimePicker12.text<>''then str_op:=str_op+' and 一程开航日期<='+''''+wwDBDateTimePicker12.text+''''; if wwDBDateTimePicker11.text<>''then str_op:=str_op+' and 会计期间>='+''''+wwDBDateTimePicker11.text+''''; if wwDBDateTimePicker13.text<>''then str_op:=str_op+' and 会计期间<='+''''+wwDBDateTimePicker13.text+''''; if RxDBLookupCombo3.DisplayValue<>''then str_op:=str_op+' and 委托单位='+''''+RxDBLookupCombo3.DisplayValues[1]+''''; str_op:='select * from t_op_aire'+str_op+default_sort(55,'t_op_aire','','desc'); t_op_aire.close; t_op_aire.SQL.clear; t_op_aire.sql.Add(str_op); t_op_aire.open; end; procedure Tfrm_op_kuaidi_shen.bsSkinButton17Click(Sender: TObject); var str_op:widestring; begin str_op:=' where '+open_data('0004','录入人','操作员','客服员','no','no'); if Edit7.text<>''then str_op:=str_op+' and 委托编号 like '+''''+'%'+Edit7.text+'%'+''''; if Edit11.text<>''then str_op:=str_op+' and 主运单号 like '+''''+'%'+Edit11.text+'%'+''''; if Edit12.text<>''then str_op:=str_op+' and 分运单号 like '+''''+'%'+Edit12.text+'%'+''''; if wwDBDateTimePicker14.text<>''then str_op:=str_op+' and 进口日期>='+''''+wwDBDateTimePicker14.text+''''; if wwDBDateTimePicker16.text<>''then str_op:=str_op+' and 进口日期<='+''''+wwDBDateTimePicker16.text+''''; if wwDBDateTimePicker15.text<>''then str_op:=str_op+' and 会计期间>='+''''+wwDBDateTimePicker15.text+''''; if wwDBDateTimePicker17.text<>''then str_op:=str_op+' and 会计期间<='+''''+wwDBDateTimePicker17.text+''''; if RxDBLookupCombo4.DisplayValue<>''then str_op:=str_op+' and 委托单位='+''''+RxDBLookupCombo4.DisplayValues[1]+''''; str_op:='select * from t_op_airi'+str_op+default_sort(56,'t_op_airi','','desc'); t_op_airi.close; t_op_airi.SQL.clear; t_op_airi.sql.Add(str_op); t_op_airi.open; end; procedure Tfrm_op_kuaidi_shen.t_op_kuaidiAfterInsert(DataSet: TDataSet); begin t_op_kuaidi['申请状态']:='申请发送'; t_op_kuaidi['申请人']:=employee; t_op_kuaidi['申请日期']:=now; t_op_kuaidi['要求发送日期']:=date; t_op_kuaidi['发件人姓名']:=employee; t_op_kuaidi['发件人公司']:=frm_data_share.t_sys_company.fieldbyname('全称').asstring; t_op_kuaidi['发件人地址']:=frm_data_share.t_sys_company.fieldbyname('地址').asstring; t_op_kuaidi['始发地']:='青岛'; t_op_kuaidi['发件人电话']:=frm_data_share.t_sys_company.fieldbyname('电话').asstring; t_op_kuaidi['发件人邮编']:=frm_data_share.t_sys_company.fieldbyname('邮编').asstring; end; procedure Tfrm_op_kuaidi_shen.t_op_kuaidiBeforeEdit(DataSet: TDataSet); begin if not modify_all then begin if (t_op_kuaidi.FieldByName('申请状态').asstring='确认发出')then begin showmessage('当前业务操作的状态不允许更改'); abort; end; end; end; procedure Tfrm_op_kuaidi_shen.t_op_kuaidiBeforePost(DataSet: TDataSet); begin table_before_post(t_op_kuaidi,'发件人姓名'); table_before_post(t_op_kuaidi,'发件人公司'); table_before_post(t_op_kuaidi,'发件人地址'); table_before_post(t_op_kuaidi,'始发地'); table_before_post(t_op_kuaidi,'发件人电话'); //table_before_post(t_op_kuaidi,'发件人邮编'); table_before_post(t_op_kuaidi,'收件人姓名'); table_before_post(t_op_kuaidi,'收件人公司'); table_before_post(t_op_kuaidi,'收件人地址'); table_before_post(t_op_kuaidi,'目的地'); table_before_post(t_op_kuaidi,'收件人电话'); //table_before_post(t_op_kuaidi,'收件人邮编'); table_before_post(t_op_kuaidi,'物品描述'); table_before_post(t_op_kuaidi,'要求发送日期'); if t_op_kuaidi.state=dsinsert then t_op_kuaidi['发送编号']:=get_no(date,'KS'); t_op_kuaidi['申请状态']:=t_op_kuaidi['申请状态']; end; procedure Tfrm_op_kuaidi_shen.bsSkinButton1Click(Sender: TObject); begin t_op_kuaidi.insert; Notebook1.PageIndex:=1; bsSkinButton11.Caption:='返回列表'; end; procedure Tfrm_op_kuaidi_shen.bsSkinButton11Click(Sender: TObject); var answer:TModalResult; begin if bsSkinButton11.Caption='编辑修改' then begin if t_op_kuaidi.IsEmpty then exit; Notebook1.PageIndex:=1; bsSkinButton11.Caption:='返回列表'; end else begin if (t_op_kuaidi.State=dsinsert)or(t_op_kuaidi.State=dsedit) then BEGIN answer:=messagedlg( '数据已经修改,是否保存?',mtWarning,mbYesNoCancel,0); if answer=mrYes then begin t_op_kuaidi.post; end; if answer=mrNo then begin t_op_kuaidi.cancel; end; if answer=mrCancel then begin exit; end; END; Notebook1.PageIndex:=0; bsSkinButton11.Caption:='编辑修改'; end; end; procedure Tfrm_op_kuaidi_shen.bsSkinButton2Click(Sender: TObject); begin table_post(t_op_kuaidi); end; procedure Tfrm_op_kuaidi_shen.bsSkinButton3Click(Sender: TObject); begin table_cancel(t_op_kuaidi); end; procedure Tfrm_op_kuaidi_shen.bsSkinButton7Click(Sender: TObject); begin if not t_op_kuaidi.Bof then t_op_kuaidi.Prior; end; procedure Tfrm_op_kuaidi_shen.bsSkinButton6Click(Sender: TObject); begin if not t_op_kuaidi.eof then t_op_kuaidi.next; end; procedure Tfrm_op_kuaidi_shen.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_op_kuaidi_shen.FormClose(Sender: TObject; var Action: TCloseAction); begin savereggrid(dxdbgrid1,caption); frm_op_kuaidi_shen.Hide; frm_op_kuaidi_shen.ManualFloat(frm_op_kuaidi_shen.BoundsRect); frm_main.freeTabs('frm_op_kuaidi_shen'); action:=cafree; frm_op_kuaidi_shen:=nil; end; procedure Tfrm_op_kuaidi_shen.FormShow(Sender: TObject); begin t_op_kuaidi.Parameters.ParamByName('申请人').value:=employee; t_op_kuaidi.open; t_op_kuaidi_detail.open; v_fee_do_seae.open; v_fee_do_seai.open; v_fee_do_aire.open; v_fee_do_airi.open; frm_data_share.t_crm_client_kuaidi.requery; loadreggrid(dxdbgrid1,false,caption); end; procedure Tfrm_op_kuaidi_shen.MenuItem1Click(Sender: TObject); begin if bsSkinTabSheet3.Showing then begin frm_op_kuaidi_shen.kuaidi_add(dxDBGrid2,t_op_seae); v_fee_do_seae.requery; exit; end; if bsSkinTabSheet4.Showing then begin frm_op_kuaidi_shen.kuaidi_add(dxDBGrid5,t_op_seai); v_fee_do_seai.requery; exit; end; if bsSkinTabSheet5.Showing then begin frm_op_kuaidi_shen.kuaidi_add(dxDBGrid8,t_op_aire); v_fee_do_aire.requery; exit; end; if bsSkinTabSheet6.Showing then begin frm_op_kuaidi_shen.kuaidi_add(dxDBGrid11,t_op_airi); v_fee_do_airi.requery; exit; end; end; procedure Tfrm_op_kuaidi_shen.N1Click(Sender: TObject); begin if bsSkinTabSheet7.Showing then begin frm_op_kuaidi_shen.kuaidi_delete(dxDBGrid3,v_fee_do_seae); v_fee_do_seae.requery; exit; end; if bsSkinTabSheet8.Showing then begin frm_op_kuaidi_shen.kuaidi_delete(dxDBGrid4,v_fee_do_seai); v_fee_do_seai.requery; exit; end; if bsSkinTabSheet9.Showing then begin frm_op_kuaidi_shen.kuaidi_delete(dxDBGrid6,v_fee_do_aire); v_fee_do_aire.requery; exit; end; if bsSkinTabSheet10.Showing then begin frm_op_kuaidi_shen.kuaidi_delete(dxDBGrid7,v_fee_do_airi); v_fee_do_airi.requery; exit; end; end; procedure Tfrm_op_kuaidi_shen.bsSkinButton4Click(Sender: TObject); begin if t_op_kuaidi.IsEmpty then exit; if t_op_kuaidi.fieldbyname('申请状态').asstring='确认发出' then exit; if application.MessageBox('您确定要删除数据吗?','警告:',MB_OKCANCEL)<>IDOK then exit; t_op_kuaidi_detail.First; while not t_op_kuaidi_detail.Eof do begin t_op_kuaidi_detail.Delete; end; t_op_kuaidi.delete; end; procedure Tfrm_op_kuaidi_shen.Panel2Resize(Sender: TObject); var i:integer; begin i:=round(Panel2.Width/11); bsSkinButton7.Width:=i; bsSkinButton6.Width:=i; bsSkinButton9.Width:=i; bsSkinButton10.Width:=i; bsSkinButton1.Width:=i; bsSkinButton11.Width:=i; bsSkinButton2.Width:=i; bsSkinButton4.Width:=i; bsSkinButton3.Width:=i; bsSkinButton19.Width:=i; end; procedure Tfrm_op_kuaidi_shen.bsSkinButton9Click(Sender: TObject); begin sys_print('快递发送申请',2,t_op_kuaidi1,nil,nil,nil,v_fee_do_seae1,v_fee_do_seai1,v_fee_do_aire1,v_fee_do_airi1,nil,nil,nil); end; procedure Tfrm_op_kuaidi_shen.bsSkinButton19Click(Sender: TObject); begin if t_op_kuaidi.IsEmpty then exit; if (t_op_kuaidi.fieldbyname('申请状态').asstring<>'申请发送') and(t_op_kuaidi.fieldbyname('申请状态').asstring<>'驳回申请') then begin showmessage('当前申请状态不能提交申请!!'); exit; end; t_op_kuaidi.edit; t_op_kuaidi['申请状态']:='提交申请'; t_op_kuaidi.post; // Send_invocie_check_shen('申请发送快递,发送编号:'+t_op_kuaidi.fieldbyname('发送编号').asstring,'163','34'); showmessage('提交申请成功!!'); end; procedure Tfrm_op_kuaidi_shen.bsSkinButton20Click(Sender: TObject); begin if t_op_kuaidi.IsEmpty then exit; if t_op_kuaidi.fieldbyname('申请状态').asstring='确认发出' then exit; try if not assigned(frm_code_send_address) then frm_code_send_address:=tfrm_code_send_address.Create (self); frm_code_send_address.ShowModal; finally frm_code_send_address.free; frm_code_send_address:=NIL; end; end; procedure Tfrm_op_kuaidi_shen.dxDBGrid1Column2CustomDraw(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[dxDBGrid1Column2.Index]='申请发送') then AColor :=clwhite else if (ANode.strings[dxDBGrid1Column2.Index]='提交申请') then AColor :=clyellow else if (ANode.strings[dxDBGrid1Column2.Index]='驳回申请')then AColor :=clred else if (ANode.strings[dxDBGrid1Column2.Index]='确认发出') then AColor :=$00DDF21C; AFont.Color:=clblack; end; procedure Tfrm_op_kuaidi_shen.DBEdit2Change(Sender: TObject); begin if (DBEdit2.Text='') or (DBEdit2.Text='申请发送')then DBEdit2.Color:=clwhite else if (DBEdit2.Text='提交申请') then DBEdit2.Color:=clyellow else if (DBEdit2.Text='驳回申请') then DBEdit2.Color:=clred else if (DBEdit2.Text='确认发出') then DBEdit2.Color:=$00DDF21C; end; procedure Tfrm_op_kuaidi_shen.bsSkinButton10Click(Sender: TObject); begin try frm_op_kuaidi_query:=tfrm_op_kuaidi_query.Create (self); kuaidi_query_num:=1; frm_op_kuaidi_query.ShowModal; finally frm_op_kuaidi_query.Free; frm_op_kuaidi_query:=nil; end; end; end.