unit u_op_airi; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, bsSkinCtrls, ExtCtrls, XPMenu, Menus, DB, ADODB, dxExEdtr, dxDBGrid, dxDBTLCl, dxGrClms, dxTL, dxDBCtrl, dxCntner, RxLookup, StdCtrls, Mask, DBCtrls, ComCtrls, bsSkinTabs, u_op_sate, u_fee, wwdbdatetimepicker, wwdbedit, Wwdotdot, Wwdbcomb, u_op_letter_free, wwdblook; type Tfrm_op_airi = class(TForm) Panel2: TPanel; bsSkinButton7: TbsSkinButton; bsSkinButton6: TbsSkinButton; bsSkinButton9: TbsSkinButton; bsSkinButton10: TbsSkinButton; bsSkinButton1: TbsSkinButton; bsSkinButton11: TbsSkinButton; bsSkinButton8: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinButton4: TbsSkinButton; bsSkinButton3: TbsSkinButton; bsSkinButton5: TbsSkinButton; Notebook1: TNotebook; t_op_airi: TADOQuery; t_op_airi1: TDataSource; PopupMenu1: TPopupMenu; N31: TMenuItem; t_ch_fee: TADOQuery; XPMenu1: TXPMenu; dxDBGrid1: TdxDBGrid; dxDBGrid1Column1: TdxDBGridMaskColumn; dxDBGrid1Column2: TdxDBGridMaskColumn; dxDBGrid1Column3: TdxDBGridMaskColumn; dxDBGrid1Column4: TdxDBGridDateColumn; dxDBGrid1Column5: TdxDBGridDateColumn; dxDBGrid1Column6: TdxDBGridMaskColumn; dxDBGrid1Column7: TdxDBGridMaskColumn; dxDBGrid1Column8: TdxDBGridMaskColumn; dxDBGrid1Column9: TdxDBGridMaskColumn; dxDBGrid1Column10: TdxDBGridMaskColumn; dxDBGrid1Column11: TdxDBGridMaskColumn; dxDBGrid1Column12: TdxDBGridMaskColumn; dxDBGrid1Column13: TdxDBGridMaskColumn; dxDBGrid1Column14: TdxDBGridMaskColumn; dxDBGrid1Column15: TdxDBGridMaskColumn; dxDBGrid1Column16: TdxDBGridDateColumn; dxDBGrid1Column17: TdxDBGridMaskColumn; dxDBGrid1Column18: TdxDBGridMaskColumn; dxDBGrid1Column20: TdxDBGridMaskColumn; dxDBGrid1Column21: TdxDBGridMaskColumn; dxDBGrid1Column22: TdxDBGridMaskColumn; dxDBGrid1Column23: TdxDBGridMaskColumn; dxDBGrid1Column24: TdxDBGridMaskColumn; dxDBGrid1Column25: TdxDBGridDateColumn; dxDBGrid1Column26: TdxDBGridMaskColumn; dxDBGrid1Column19: TdxDBGridColumn; bsSkinPanel1: TbsSkinPanel; Label1: TLabel; Label2: TLabel; Label17: TLabel; Label3: TLabel; Label37: TLabel; Label5: TLabel; Label38: TLabel; Label4: TLabel; Label36: TLabel; DBEdit1: TDBEdit; DBEdit2: TDBEdit; RxDBLookupCombo13: TRxDBLookupCombo; DBEdit3: TDBEdit; DBEdit8: TDBEdit; DBEdit4: TDBEdit; DBEdit9: TDBEdit; RxDBLookupCombo1: TRxDBLookupCombo; DBEdit7: TDBEdit; bsSkinPageControl1: TbsSkinPageControl; bsSkinTabSheet1: TbsSkinTabSheet; bsSkinTabSheet2: TbsSkinTabSheet; bsSkinTabSheet3: TbsSkinTabSheet; fra_fee1: Tfra_fee; fra_op_state1: Tfra_op_state; Label85: TLabel; Label86: TLabel; Label9: TLabel; RxDBLookupCombo6: TRxDBLookupCombo; Label10: TLabel; RxDBLookupCombo7: TRxDBLookupCombo; Label96: TLabel; DBEdit30: TDBEdit; DBEdit31: TDBEdit; Label97: TLabel; wwDBDateTimePicker2: TwwDBDateTimePicker; Label25: TLabel; wwDBDateTimePicker1: TwwDBDateTimePicker; Label6: TLabel; Label7: TLabel; DBEdit5: TDBEdit; Label8: TLabel; DBEdit6: TDBEdit; Label11: TLabel; DBEdit10: TDBEdit; Label12: TLabel; RxDBLookupCombo2: TRxDBLookupCombo; Label164: TLabel; RxDBLookupCombo11: TRxDBLookupCombo; Label23: TLabel; RxDBLookupCombo8: TRxDBLookupCombo; DBMemo17: TDBMemo; Label109: TLabel; Label110: TLabel; DBMemo18: TDBMemo; Label111: TLabel; DBMemo19: TDBMemo; dxDBGrid1Column27: TdxDBGridColumn; Label13: TLabel; wwDBComboBox3: TwwDBComboBox; Label65: TLabel; DBEdit18: TDBEdit; dxDBGrid1Column28: TdxDBGridColumn; bsSkinButton13: TbsSkinButton; Label19: TLabel; RxDBLookupCombo12: TRxDBLookupCombo; Label41: TLabel; Label27: TLabel; RxDBLookupCombo29: TRxDBLookupCombo; RxDBLookupCombo30: TRxDBLookupCombo; Label42: TLabel; PopupMenu2: TPopupMenu; N10: TMenuItem; N11: TMenuItem; N14: TMenuItem; N13: TMenuItem; N12: TMenuItem; N15: TMenuItem; N16: TMenuItem; PopupMenu3: TPopupMenu; N37: TMenuItem; N38: TMenuItem; N17: TMenuItem; N18: TMenuItem; N34: TMenuItem; N35: TMenuItem; N36: TMenuItem; N1: TMenuItem; N2: TMenuItem; N3: TMenuItem; N4: TMenuItem; N5: TMenuItem; N6: TMenuItem; N7: TMenuItem; RxDBLookupCombo31: TRxDBLookupCombo; bsSkinTabSheet4: TbsSkinTabSheet; fra_op_letter_free1: Tfra_op_letter_free; wwDBLookupCombo52: TwwDBLookupCombo; wwDBLookupCombo1: TwwDBLookupCombo; N8: TMenuItem; N9: TMenuItem; N19: TMenuItem; N20: TMenuItem; N21: TMenuItem; N22: TMenuItem; N23: TMenuItem; N24: TMenuItem; procedure bsSkinButton7Click(Sender: TObject); procedure bsSkinButton6Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton4Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton5Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure bsSkinButton9Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure bsSkinButton11Click(Sender: TObject); procedure bsSkinButton8Click(Sender: TObject); procedure Panel2Resize(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure t_op_airiBeforeEdit(DataSet: TDataSet); procedure t_op_airiBeforePost(DataSet: TDataSet); procedure bsSkinButton10Click(Sender: TObject); procedure dxDBGrid1Column3CustomDraw(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 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 DBEdit1KeyPress(Sender: TObject; var Key: Char); procedure DBEdit2KeyPress(Sender: TObject; var Key: Char); procedure DBEdit3KeyPress(Sender: TObject; var Key: Char); procedure DBEdit4KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo1KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo13KeyPress(Sender: TObject; var Key: Char); procedure DBEdit8KeyPress(Sender: TObject; var Key: Char); procedure DBEdit9KeyPress(Sender: TObject; var Key: Char); procedure DBEdit7KeyPress(Sender: TObject; var Key: Char); procedure wwDBDateTimePicker2KeyPress(Sender: TObject; var Key: Char); procedure wwDBDateTimePicker1KeyPress(Sender: TObject; var Key: Char); procedure DBEdit6KeyPress(Sender: TObject; var Key: Char); procedure DBEdit5KeyPress(Sender: TObject; var Key: Char); procedure DBEdit10KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo2KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo6KeyPress(Sender: TObject; var Key: Char); procedure DBEdit30KeyPress(Sender: TObject; var Key: Char); procedure DBEdit31KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo11KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo7KeyPress(Sender: TObject; var Key: Char); procedure DBEdit18KeyPress(Sender: TObject; var Key: Char); procedure DBEdit2Change(Sender: TObject); procedure DBEdit3Change(Sender: TObject); procedure RxDBLookupCombo12KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo29KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo8KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo30KeyPress(Sender: TObject; var Key: Char); procedure wwDBComboBox3KeyPress(Sender: TObject; var Key: Char); procedure RxDBLookupCombo12Change(Sender: TObject); procedure RxDBLookupCombo8Change(Sender: TObject); procedure N10Click(Sender: TObject); procedure N14Click(Sender: TObject); procedure N12Click(Sender: TObject); procedure N16Click(Sender: TObject); procedure dxDBGrid1ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); procedure bsSkinButton13Click(Sender: TObject); procedure N17Click(Sender: TObject); procedure N34Click(Sender: TObject); procedure N36Click(Sender: TObject); procedure N37Click(Sender: TObject); procedure N7Click(Sender: TObject); procedure N5Click(Sender: TObject); procedure N3Click(Sender: TObject); procedure RxDBLookupCombo31KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo1KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo52KeyPress(Sender: TObject; var Key: Char); procedure N9Click(Sender: TObject); procedure N20Click(Sender: TObject); procedure t_op_airiBeforeDelete(DataSet: TDataSet); procedure t_op_airiPostError(DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction); procedure t_op_airiBeforeCancel(DataSet: TDataSet); procedure N21Click(Sender: TObject); procedure N24Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var frm_op_airi: Tfrm_op_airi; implementation uses u_main, my_sys_function, u_op_airi_add, u_data_share, u_sys_progress, u_ch_piliang_airi; {$R *.dfm} procedure Tfrm_op_airi.bsSkinButton7Click(Sender: TObject); begin table_Prior(t_op_airi); end; procedure Tfrm_op_airi.bsSkinButton6Click(Sender: TObject); begin table_next(t_op_airi); end; procedure Tfrm_op_airi.bsSkinButton2Click(Sender: TObject); begin table_post(t_op_airi); end; procedure Tfrm_op_airi.bsSkinButton4Click(Sender: TObject); begin t_ch_fee.close; t_ch_fee.Parameters[0].value:=t_op_airi.fieldbyname('编号').asstring; t_ch_fee.open; if not t_ch_fee.IsEmpty then begin showmessage('对不起业务存在费用信息,不能删除!!'); exit; end; table_delete(t_op_airi); end; procedure Tfrm_op_airi.bsSkinButton3Click(Sender: TObject); begin table_cancel(t_op_airi); end; procedure Tfrm_op_airi.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_op_airi.FormClose(Sender: TObject; var Action: TCloseAction); begin savereggrid(dxdbgrid1,caption); savewwgrid(fra_fee1.wwDBGrid1); savewwgrid(fra_fee1.wwDBGrid2); frm_op_airi.Hide; frm_op_airi.ManualFloat(frm_op_airi.BoundsRect ); frm_main.freeTabs('frm_op_airi'); action:=cafree; frm_op_airi:=nil; end; procedure Tfrm_op_airi.bsSkinButton9Click(Sender: TObject); begin sys_print('空运进口单证',2,t_op_airi1,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil); end; procedure Tfrm_op_airi.FormShow(Sender: TObject); begin if not ASSIGNED(frm_sys_progress) then frm_sys_progress:=tfrm_sys_progress.Create(self); frm_sys_progress.bsSkinGauge1.ProgressText:='加载数据请等候。。。'; frm_sys_progress.Show; frm_sys_progress.bsSkinGauge1.MaxValue:=20; frm_sys_progress.bsSkinGauge1.MinValue:=0; frm_sys_progress.bsSkinGauge1.Value:=0; frm_sys_progress.Update; t_op_airi.Close; t_op_airi.SQL.clear; t_op_airi.SQL.Add('select top 50 * from t_op_airi where ' +'(录入人='+''''+employee+'''' +' or 操作员='+''''+employee+'''' +' or 客服员='+''''+employee+''''+')' +default_sort(56,'t_op_airi','','desc')); t_op_airi.open; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; fra_op_letter_free1.op_type.Text:='空运进口'; fra_op_letter_free1.t_op_letter.DataSource:=t_op_airi1; fra_op_letter_free1.t_op_letter.open; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; fra_op_letter_free1.t_op_letter_free_detail.open; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; loadreggrid(dxdbgrid1,false,caption); frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; loadwwgrid(fra_fee1.wwDBGrid1); loadwwgrid(fra_fee1.wwDBGrid2); if if_open('222') or if_open('223') then begin fra_fee1.edit_type.text:='4'; fra_fee1.edit_data.text:='0004'; fra_fee1.edit_report.text:='空运进口'; fra_fee1.t_ch_accept.DataSource:=t_op_airi1; fra_fee1.DBEdit50.DataSource:=t_op_airi1; if if_open('222') then begin fra_fee1.t_ch_accept.DataSource:=t_op_airi1; if (strtobool(get_parameters_value(64,'false'))=true) and (if_open('209')=false) then begin fra_fee1.t_ch_accept.close; fra_fee1.t_ch_accept.SQL.Clear; fra_fee1.t_ch_accept.SQL.Add('select * from t_ch_fee where 类型=' +''''+'收'+''''+' and 编号=:编号 and (录入人=' +''''+employee+''''+' or (录入人<>'+''''+employee+'''' +' and 机密<>1) ) order by 顺序,CH_ID'); end; fra_fee1.t_ch_accept.open; fra_fee1.a_shen_delete.open; fra_fee1.a_shen_modify_old.open; fra_fee1.a_shen_modify_new.open; fra_fee1.Panel3.visible:=true; end else fra_fee1.Panel3.visible:=false; if if_open('223') then begin fra_fee1.t_ch_pay.DataSource:=t_op_airi1; if (strtobool(get_parameters_value(64,'false'))=true) and (if_open('209')=false) then begin fra_fee1.t_ch_pay.close; fra_fee1.t_ch_pay.SQL.Clear; fra_fee1.t_ch_pay.SQL.Add('select * from t_ch_fee where 类型=' +''''+'付'+''''+' and 编号=:编号 and (录入人=' +''''+employee+''''+' or (录入人<>'+''''+employee+'''' +' and 机密<>1) ) order by 顺序,CH_ID'); end; fra_fee1.t_ch_pay.open; fra_fee1.p_shen_delete.open; fra_fee1.p_shen_modify_old.open; fra_fee1.p_shen_modify_new.open; fra_fee1.Panel1.visible:=true; end else fra_fee1.Panel1.visible:=false; if fra_fee1.Panel1.visible and fra_fee1.Panel3.visible then begin fra_fee1.Panel8.Visible:=true; fra_fee1.Panel8.Height:=20; fra_fee1.t_op_gain.DataSource:=t_op_airi1; fra_fee1.t_op_gain.open; fra_fee1.Panel9.Visible:=false; end else begin fra_fee1.Panel8.Visible:=false; end; end else begin fra_fee1.Visible:=false; end; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; fra_op_state1.edit_state.text:='4'; fra_op_state1.t_op_state.DataSource:=t_op_airi1; fra_op_state1.t_op_state.open; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_crm_client.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_crm_client_hangkong.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_crm_client_baoguan.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_crm_client_weituo.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_crm_client_daili.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_crm_client_shiper.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_crm_client_shouhuo.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_crm_client_tongzhi.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_code_source.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_sys_employee.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_code_code.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_code_fee.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_code_currency.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_data_share.t_code_port_air.requery; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_sys_progress.close; frm_sys_progress:=nil; end; procedure Tfrm_op_airi.bsSkinButton11Click(Sender: TObject); var answer:TModalResult; begin if bsSkinButton11.Caption='编辑修改' then begin Notebook1.PageIndex:=1; bsSkinButton11.Caption:='返回列表'; end else begin if (t_op_airi.State=dsinsert)or(t_op_airi.State=dsedit) then BEGIN answer:=messagedlg( '数据已经修改,是否保存?',mtWarning,mbYesNoCancel,0); if answer=mrYes then begin t_op_airi.post; end; if answer=mrNo then begin t_op_airi.cancel; end; if answer=mrCancel then begin exit; end; END; Notebook1.PageIndex:=0; bsSkinButton11.Caption:='编辑修改'; end; end; procedure Tfrm_op_airi.bsSkinButton8Click(Sender: TObject); var Pnt:Tpoint; begin Pnt:=bsSkinButton8.ClientToScreen(Point(0,bsSkinButton8.Height)); PopupMenu1.Popup(Pnt.x,Pnt.y); end; procedure Tfrm_op_airi.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; bsSkinButton8.Width:=i; bsSkinButton2.Width:=i; bsSkinButton4.Width:=i; bsSkinButton3.Width:=i; bsSkinButton13.Left:=Panel2.Width-bsSkinButton13.Width-20; end; procedure Tfrm_op_airi.bsSkinButton1Click(Sender: TObject); begin if (t_op_airi.State=dsinsert)or(t_op_airi.State=dsedit) then t_op_airi.post; try frm_op_airi_add:=tfrm_op_airi_add.Create(self); frm_op_airi_add.data1.Enabled:=false; frm_op_airi_add.data1.DataSet:=t_op_airi; frm_op_airi_add.data1.Enabled:=true; frm_op_airi_add.ShowModal; finally frm_op_airi_add.Free; end; end; procedure Tfrm_op_airi.t_op_airiBeforeEdit(DataSet: TDataSet); begin op_befor_post(t_op_airi,'0004'); end; procedure Tfrm_op_airi.t_op_airiBeforePost(DataSet: TDataSet); begin table_before_post(t_op_airi,'委托单位'); table_before_post(t_op_airi,'操作员'); table_before_post(t_op_airi,'揽货人'); table_before_post(t_op_airi,'客服员'); table_before_post(t_op_airi,'主运单号'); table_before_post(t_op_airi,'分运单号'); table_before_post(t_op_airi,'进口日期'); table_before_post(t_op_airi,'航班号'); table_before_post(t_op_airi,'始发港'); table_before_post(t_op_airi,'目的港'); table_before_post(t_op_airi,'业务来源'); table_before_post(t_op_airi,'销售部门'); table_before_post(t_op_airi,'操作部门'); op_empty('t_op_airi',t_op_airi); if t_op_airi.FieldByName('委托单位').OldValue<>t_op_airi.FieldByName('委托单位').asstring then begin if frm_data_share.t_crm_client_all.Locate('客户简称',t_op_airi.FieldByName('委托单位').asstring,[])then begin if frm_data_share.t_crm_client_all.fieldbyname('客户状态').asstring='封存客户'then begin showmessage('当前业务委托单位已经封存,不能再进行业务合作,如需合作请进行恢复客户操作!'); abort; end; end; end; if t_op_airi.State=dsinsert then begin if t_op_airi.fieldbyname('业务编号').asstring=''then begin t_op_airi['业务编号']:=get_no(t_op_airi.fieldbyname('会计期间').AsDateTime,'AI'); t_op_airi['编号']:=get_id; end; t_op_airi['业务状态']:='接受委托'; t_op_airi['费用状态']:='录入状态'; end; if strtobool(get_parameters_value(43,'false')) then begin if trim(t_op_airi.fieldbyname('主运单号').asstring)='' then begin t_op_airi['主提单标准']:=t_op_airi['编号']; end else begin t_op_airi['主提单标准']:=t_op_airi['主运单号']; end; end else begin t_op_airi['主提单标准']:=t_op_airi['编号']; end; if strtobool(get_parameters_value(44,'false')) then begin if trim(t_op_airi.fieldbyname('分运单号').asstring)='' then begin t_op_airi['分提单标准']:=t_op_airi['编号']; end else begin t_op_airi['分提单标准']:=t_op_airi['分运单号']; end; end else begin t_op_airi['分提单标准']:=t_op_airi['编号']; end; if strtobool(get_parameters_value(45,'false')) then begin if trim(t_op_airi.fieldbyname('委托编号').asstring)='' then begin t_op_airi['委托标准']:=t_op_airi['编号']; end else begin t_op_airi['委托标准']:=t_op_airi['委托编号']; end; end else begin t_op_airi['委托标准']:=t_op_airi['编号']; end; end; procedure Tfrm_op_airi.bsSkinButton10Click(Sender: TObject); begin query_airi(1,'0004'); end; procedure Tfrm_op_airi.dxDBGrid1Column3CustomDraw(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 AColor:=dxgrid_color_fee(ANode.strings[dxDBGrid1Column3.Index]); AFont.Color:=clblack; end; procedure Tfrm_op_airi.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 AColor:=dxgrid_color('空运进口',ANode.Strings[dxDBGrid1Column2.Index]); AFont.Color:=clblack; end; procedure Tfrm_op_airi.DBEdit1KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit2); end; procedure Tfrm_op_airi.DBEdit2KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit3); end; procedure Tfrm_op_airi.DBEdit3KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit4); end; procedure Tfrm_op_airi.DBEdit4KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit4); end; procedure Tfrm_op_airi.RxDBLookupCombo1KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo31); end; procedure Tfrm_op_airi.RxDBLookupCombo13KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit8); end; procedure Tfrm_op_airi.DBEdit8KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit9); end; procedure Tfrm_op_airi.DBEdit9KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit7); end; procedure Tfrm_op_airi.DBEdit7KeyPress(Sender: TObject; var Key: Char); begin key_wwDBDateTimePicker(Key,wwDBDateTimePicker2); end; procedure Tfrm_op_airi.wwDBDateTimePicker2KeyPress(Sender: TObject; var Key: Char); begin key_wwDBDateTimePicker(Key,wwDBDateTimePicker1); end; procedure Tfrm_op_airi.wwDBDateTimePicker1KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit6); end; procedure Tfrm_op_airi.DBEdit6KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo52); end; procedure Tfrm_op_airi.DBEdit5KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit10); end; procedure Tfrm_op_airi.DBEdit10KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo2); end; procedure Tfrm_op_airi.RxDBLookupCombo2KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo6); end; procedure Tfrm_op_airi.RxDBLookupCombo6KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit30); end; procedure Tfrm_op_airi.DBEdit30KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit31); end; procedure Tfrm_op_airi.DBEdit31KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo11); end; procedure Tfrm_op_airi.RxDBLookupCombo11KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo7); end; procedure Tfrm_op_airi.RxDBLookupCombo7KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo12); end; procedure Tfrm_op_airi.DBEdit18KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo1); end; procedure Tfrm_op_airi.DBEdit2Change(Sender: TObject); begin DBEdit2.Color:=dxgrid_color('空运进口',DBEdit2.text); end; procedure Tfrm_op_airi.DBEdit3Change(Sender: TObject); begin DBEdit3.Color:=dxgrid_color_fee(DBEdit3.text); end; procedure Tfrm_op_airi.RxDBLookupCombo12KeyPress(Sender: TObject; var Key: Char); begin key_DBMemo(Key,DBMemo17); end; procedure Tfrm_op_airi.RxDBLookupCombo29KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo8); end; procedure Tfrm_op_airi.RxDBLookupCombo8KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo30); end; procedure Tfrm_op_airi.RxDBLookupCombo30KeyPress(Sender: TObject; var Key: Char); begin key_wwDBComboBox(Key,wwDBComboBox3); end; procedure Tfrm_op_airi.wwDBComboBox3KeyPress(Sender: TObject; var Key: Char); begin key_DBMemo(Key,DBMemo19); end; procedure Tfrm_op_airi.RxDBLookupCombo12Change(Sender: TObject); begin if (t_op_airi.state=dsinsert)or(t_op_airi.state=dsedit)then begin if RxDBLookupCombo12.DisplayValue='' then exit; if frm_data_share.t_sys_employee.locate('姓名',RxDBLookupCombo12.DisplayValue,[]) then t_op_airi['销售部门']:=frm_data_share.t_sys_employee['部门名称']; end; end; procedure Tfrm_op_airi.RxDBLookupCombo8Change(Sender: TObject); begin if (t_op_airi.state=dsinsert)or(t_op_airi.state=dsedit)then begin if RxDBLookupCombo8.DisplayValue='' then exit; if frm_data_share.t_sys_employee.locate('姓名',RxDBLookupCombo8.DisplayValue,[]) then t_op_airi['操作部门']:=frm_data_share.t_sys_employee['部门名称']; end; end; procedure Tfrm_op_airi.N10Click(Sender: TObject); begin update_grid_view_no(dxdbgrid1); end; procedure Tfrm_op_airi.N14Click(Sender: TObject); begin update_grid_view_all(dxdbgrid1); end; procedure Tfrm_op_airi.N12Click(Sender: TObject); begin update_grid(dxdbgrid1,59); end; procedure Tfrm_op_airi.N16Click(Sender: TObject); begin grid_save_xls(dxdbgrid1); end; procedure Tfrm_op_airi.dxDBGrid1ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); begin Column_sort(Column,t_op_airi,'业务编号'); end; procedure Tfrm_op_airi.bsSkinButton13Click(Sender: TObject); var Pnt:Tpoint; begin Pnt:=bsSkinButton13.ClientToScreen(Point(0,bsSkinButton13.Height)); PopupMenu3.Popup(Pnt.x,Pnt.y); end; procedure Tfrm_op_airi.N17Click(Sender: TObject); begin t_op_airi.Close; t_op_airi.SQL.clear; t_op_airi.SQL.Add('select * from t_op_airi where ' +open_data('0004','录入人','操作员','客服员','no','no') +' and 编号 in (select distinct 编号 from t_ch_fee where 费用状态=' +''''+'录入状态'+''''+') ' +default_sort(56,'t_op_airi','','desc')); t_op_airi.open; end; procedure Tfrm_op_airi.N34Click(Sender: TObject); begin t_op_airi.Close; t_op_airi.SQL.clear; t_op_airi.SQL.Add('select * from t_op_airi where ' +open_data('0004','录入人','操作员','客服员','no','no') +' and 编号 in (select distinct 编号 from t_ch_fee where 费用状态 in (' +''''+'驳回提交'+''''+','+''''+'禁止修改'+''''+','+''''+'禁止删除'+''''+')) ' +default_sort(56,'t_op_airi','','desc')); t_op_airi.open; end; procedure Tfrm_op_airi.N36Click(Sender: TObject); begin t_op_airi.Close; t_op_airi.SQL.clear; t_op_airi.SQL.Add('select * from t_op_airi where ' +open_data('0004','录入人','操作员','客服员','no','no') +' and 编号 in (select distinct 编号 from t_ch_fee where 费用状态 in (' +''''+'提交审核'+''''+','+''''+'申请修改'+''''+','+''''+'申请删除'+''''+')) ' +default_sort(56,'t_op_airi','','desc')); t_op_airi.open; end; procedure Tfrm_op_airi.N37Click(Sender: TObject); begin t_op_airi.Close; t_op_airi.SQL.clear; t_op_airi.SQL.Add('select * from t_op_airi where ' +open_data('0004','录入人','操作员','客服员','no','no') +' and 编号 in (select distinct 编号 from t_op_state where 是否完成<>1) ' +default_sort(56,'t_op_airi','','desc')); t_op_airi.open; end; procedure Tfrm_op_airi.N7Click(Sender: TObject); var str:widestring; begin if t_op_airi.IsEmpty then exit; if if_open('222') and if_open('223') then begin if (t_op_airi.State=dsinsert)or(t_op_airi.State=dsedit) then t_op_airi.post; try frm_ch_piliang_airi:=tfrm_ch_piliang_airi.Create (self); t_op_airi.DisableControls; t_op_airi.first; while not t_op_airi.eof do begin if str='' then str:=''''+t_op_airi.fieldbyname('编号').AsString+'''' else str:=str+','+''''+t_op_airi.fieldbyname('编号').AsString+''''; t_op_airi.next; end; str:='('+str+')'; str:='select * from t_op_airi where 编号 in '+str+default_sort(56,'t_op_airi','','desc'); frm_ch_piliang_airi.t_op_airi.Parameters.ParamByName('SQLStr').value:=str; frm_ch_piliang_airi.t_op_airi.open; frm_ch_piliang_airi.ShowModal; finally t_op_airi.EnableControls; frm_ch_piliang_airi.Free; frm_ch_piliang_airi:=nil; end; end else begin showmessage('你无权进行利润帐单批量打印!!'); end; end; procedure Tfrm_op_airi.N5Click(Sender: TObject); var str:widestring; i:integer; begin if t_op_airi.IsEmpty then exit; if dxDBGrid1.SelectedCount<1 then begin showmessage('请选择要打印的业务帐单!!'); exit; end; if if_open('222') and if_open('223') then begin if (t_op_airi.State=dsinsert)or(t_op_airi.State=dsedit) then t_op_airi.post; try frm_ch_piliang_airi:=tfrm_ch_piliang_airi.Create (self); t_op_airi.DisableControls; for i:=0 to dxDBGrid1.SelectedCount-1 do begin t_op_airi.GotoBookmark(pointer(dxDBGrid1.selectedrows[i])); if str='' then str:=''''+t_op_airi.fieldbyname('编号').AsString+'''' else str:=str+','+''''+t_op_airi.fieldbyname('编号').AsString+''''; end; str:='('+str+')'; str:='select * from t_op_airi where 编号 in '+str+default_sort(56,'t_op_airi','','desc'); frm_ch_piliang_airi.t_op_airi.Parameters.ParamByName('SQLStr').value:=str; frm_ch_piliang_airi.t_op_airi.open; frm_ch_piliang_airi.ShowModal; finally t_op_airi.EnableControls; frm_ch_piliang_airi.Free; frm_ch_piliang_airi:=nil; end; end else begin showmessage('你无权进行利润帐单批量打印!!'); end; end; procedure Tfrm_op_airi.N3Click(Sender: TObject); var str:widestring; begin if t_op_airi.IsEmpty then exit; if if_open('222') and if_open('223') then begin if (t_op_airi.State=dsinsert)or(t_op_airi.State=dsedit) then t_op_airi.post; try frm_ch_piliang_airi:=tfrm_ch_piliang_airi.Create (self); str:='select * from t_op_airi where 编号=' +''''+t_op_airi.fieldbyname('编号').AsString+''''; frm_ch_piliang_airi.t_op_airi.Parameters.ParamByName('SQLStr').value:=str; frm_ch_piliang_airi.t_op_airi.open; frm_ch_piliang_airi.ShowModal; finally frm_ch_piliang_airi.Free; frm_ch_piliang_airi:=nil; end; end else begin showmessage('你无权进行利润帐单批量打印!!'); end; end; procedure Tfrm_op_airi.RxDBLookupCombo31KeyPress(Sender: TObject; var Key: Char); begin key_RxDBLookupCombo(Key,RxDBLookupCombo13); end; procedure Tfrm_op_airi.wwDBLookupCombo1KeyPress(Sender: TObject; var Key: Char); begin key_DBEdit(Key,DBEdit5); end; procedure Tfrm_op_airi.wwDBLookupCombo52KeyPress(Sender: TObject; var Key: Char); begin key_wwDBLookupCombo(Key,wwDBLookupCombo1); end; procedure Tfrm_op_airi.N9Click(Sender: TObject); begin t_op_airi.Close; t_op_airi.SQL.clear; t_op_airi.SQL.Add('select * from t_op_airi where ' +open_data('0004','录入人','操作员','客服员','no','no') +' and 费用状态<>'+''''+'费用封帐'+'''' +' and 编号 not in (select distinct 编号 from t_ch_fee where 类型='+''''+'收'+''''+')' +default_sort(56,'t_op_airi','','desc')); t_op_airi.open; end; procedure Tfrm_op_airi.N20Click(Sender: TObject); begin t_op_airi.Close; t_op_airi.SQL.clear; t_op_airi.SQL.Add('select * from t_op_airi where ' +open_data('0004','录入人','操作员','客服员','no','no') +' and 费用状态<>'+''''+'费用封帐'+'''' +' and 编号 not in (select distinct 编号 from t_ch_fee where 类型='+''''+'付'+''''+')' +default_sort(56,'t_op_airi','','desc')); t_op_airi.open; end; procedure Tfrm_op_airi.t_op_airiBeforeDelete(DataSet: TDataSet); begin op_befor_post(t_op_airi,'0004'); delete_add(4,t_op_airi); end; procedure Tfrm_op_airi.t_op_airiPostError(DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction); var str:widestring; begin if pos('SOME VALUES MAY HAVE BEEN CHANGED',UpperCase(E.Message))<>0 then begin showmessage('数据已经被其它用户修改,当前修改不能保存'+#13#10+'请刷新数据后重新录入'); abort; end; if pos('主提单标准',UpperCase(E.Message))<>0 then begin str:='select * from t_op_airi where 主提单标准='+''''+t_op_airi['主提单标准']+''''; double_airi(str,1); abort; end; if pos('分提单标准',UpperCase(E.Message))<>0 then begin str:='select * from t_op_airi where 分提单标准='+''''+t_op_airi['分提单标准']+''''; double_airi(str,2); abort; end; if pos('委托标准',UpperCase(E.Message))<>0 then begin str:='select * from t_op_airi where 委托标准='+''''+t_op_airi['委托标准']+''''; double_airi(str,3); abort; end; end; procedure Tfrm_op_airi.t_op_airiBeforeCancel(DataSet: TDataSet); begin delete_no(t_op_airi); end; procedure Tfrm_op_airi.N21Click(Sender: TObject); begin t_op_airi.Close; t_op_airi.SQL.clear; t_op_airi.SQL.Add('select * from t_op_airi where ' +open_data('0004','录入人','操作员','客服员','no','no') +' and 费用状态<>'+''''+'费用封帐'+'''' +' and 编号 not in (select distinct 编号 from t_ch_fee )' +default_sort(56,'t_op_airi','','desc')); t_op_airi.open; end; procedure Tfrm_op_airi.N24Click(Sender: TObject); begin t_op_airi.Close; t_op_airi.SQL.clear; t_op_airi.SQL.Add('select * from t_op_airi where ' +open_data('0004','录入人','操作员','客服员','no','no') +' and 费用状态<>'+''''+'费用封帐'+'''' +' and 编号 in (select distinct 编号 from t_ch_fee where 费用状态<>'+''''+'结算完毕'+''''+')' +default_sort(56,'t_op_airi','','desc')); t_op_airi.open; end; end.