unit u_op_seae_weituo_wf; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, bsSkinCtrls, ExtCtrls, DB, ADODB, dxExEdtr, dxCntner, dxTL, dxDBCtrl, dxDBGrid, ComCtrls, bsSkinTabs, RxLookup, StdCtrls, Mask, DBCtrls, wwdbdatetimepicker, wwdblook, u_op_sate, u_fee, u_op_card, Menus, dxDBTLCl, dxGrClms, bsdbctrls, XPMenu, Grids, Wwdbigrd, Wwdbgrid, RxMemDS, wwdbedit, Wwdotdot, Wwdbcomb, DBCtrlsEh; type Tfrm_op_seae_weituo_wf = class(TForm) Panel2: TPanel; bsSkinButton7: TbsSkinButton; bsSkinButton6: TbsSkinButton; bsSkinButton9: TbsSkinButton; bsSkinButton1: TbsSkinButton; bsSkinButton11: TbsSkinButton; bsSkinButton2: TbsSkinButton; bsSkinButton4: TbsSkinButton; bsSkinButton3: TbsSkinButton; bsSkinButton5: TbsSkinButton; bsSkinButton38: TbsSkinButton; t_op_seae_order: TADOQuery; t_op_seae_order1: TDataSource; PopupMenu3: TPopupMenu; N37: TMenuItem; N38: TMenuItem; N62: TMenuItem; N25: TMenuItem; N64: TMenuItem; N63: TMenuItem; N17: TMenuItem; N18: TMenuItem; N34: TMenuItem; N35: TMenuItem; N36: TMenuItem; XPMenu1: TXPMenu; PopupMenu2: TPopupMenu; N10: TMenuItem; N11: TMenuItem; N14: TMenuItem; N13: TMenuItem; N12: TMenuItem; N15: TMenuItem; N16: TMenuItem; bsSkinPageControl1: TbsSkinPageControl; bsSkinTabSheet1: TbsSkinTabSheet; bsSkinTabSheet2: TbsSkinTabSheet; bsSkinPanel1: TbsSkinPanel; Label19: TLabel; RxDBLookupCombo12: TRxDBLookupCombo; Label4: TLabel; RxDBLookupCombo1: TRxDBLookupCombo; DBEdit2: TDBEdit; Label2: TLabel; bsSkinPanel4: TbsSkinPanel; dxDBGrid1: TdxDBGrid; dxDBGrid1Column10: TdxDBGridColumn; dxDBGrid1Column9: TdxDBGridColumn; dxDBGrid1Column1: TdxDBGridMaskColumn; dxDBGrid1Column2: TdxDBGridMaskColumn; dxDBGrid1Column114: TdxDBGridColumn; dxDBGrid1Column3: TdxDBGridMaskColumn; dxDBGrid1Column4: TdxDBGridDateColumn; dxDBGrid1Column6: TdxDBGridColumn; dxDBGrid1Column7: TdxDBGridColumn; dxDBGrid1Column8: TdxDBGridColumn; bsSkinPanel3: TbsSkinPanel; Label6: TLabel; Label39: TLabel; Label14: TLabel; Label9: TLabel; Label10: TLabel; Label5: TLabel; Label3: TLabel; Label7: TLabel; Edit1: TEdit; wwDBComboBox44: TwwDBComboBox; RxDBLookupCombo3: TRxDBLookupCombo; RxDBLookupCombo2: TRxDBLookupCombo; wwDBDateTimePicker1: TwwDBDateTimePicker; wwDBDateTimePicker3: TwwDBDateTimePicker; wwDBDateTimePicker5: TwwDBDateTimePicker; wwDBDateTimePicker6: TwwDBDateTimePicker; bsSkinButton10: TbsSkinButton; bsSkinButton15: TbsSkinButton; dxDBGrid1Column11: TdxDBGridColumn; bsSkinPageControl2: TbsSkinPageControl; PopupMenu1: TPopupMenu; N1: TMenuItem; N2: TMenuItem; N3: TMenuItem; dxDBGrid1Column12: TdxDBGridColumn; dxDBGrid1Column13: TdxDBGridColumn; Label23: TLabel; DBEdit4: TDBEdit; dxDBGrid1Column14: TdxDBGridColumn; dxDBGrid1Column15: TdxDBGridColumn; dxDBGrid1Column16: TdxDBGridColumn; Label25: TLabel; DBEdit7: TDBEdit; dxDBGrid1Column17: TdxDBGridColumn; dxDBGrid1Column18: TdxDBGridColumn; wwDBComboBox5: TwwDBComboBox; Label29: TLabel; dxDBGrid1Column19: TdxDBGridColumn; t_op_ctn: TADOQuery; dxDBGrid1Column20: TdxDBGridColumn; dxDBGrid1Column21: TdxDBGridColumn; dxDBGrid1Column22: TdxDBGridColumn; dxDBGrid1Column23: TdxDBGridColumn; dxDBGrid1Column24: TdxDBGridColumn; dxDBGrid1Column25: TdxDBGridColumn; dxDBGrid1Column26: TdxDBGridColumn; dxDBGrid1Column27: TdxDBGridColumn; dxDBGrid1Column28: TdxDBGridColumn; dxDBGrid1Column29: TdxDBGridColumn; dxDBGrid1Column30: TdxDBGridColumn; dxDBGrid1Column31: TdxDBGridColumn; dxDBGrid1Column32: TdxDBGridColumn; bsSkinCheckRadioBox1: TbsSkinCheckRadioBox; dxDBGrid1Column33: TdxDBGridColumn; dxDBGrid1Column34: TdxDBGridColumn; dxDBGrid1Column35: TdxDBGridColumn; dxDBGrid1Column36: TdxDBGridColumn; dxDBGrid1Column37: TdxDBGridColumn; dxDBGrid1Column38: TdxDBGridColumn; t_crm_client_weituo1: TDataSource; t_crm_client_weituo: TADOQuery; dxDBGrid1Column39: TdxDBGridColumn; Label54: TLabel; RxDBLookupCombo11: TRxDBLookupCombo; Label53: TLabel; DBComboBoxEh3: TDBComboBoxEh; t_ch_accept1: TDataSource; t_ch_accept: TADOQuery; t_ch_pay1: TDataSource; t_ch_pay: TADOQuery; edit_type: TEdit; Label26: TLabel; wwDBComboBox3: TwwDBComboBox; bsSkinPanel6: TbsSkinPanel; Label124: TLabel; Label15: TLabel; Label13: TLabel; Label22: TLabel; Label28: TLabel; Label31: TLabel; Label33: TLabel; Label34: TLabel; Label40: TLabel; Label11: TLabel; Label1: TLabel; Label51: TLabel; Label52: TLabel; Label16: TLabel; Label73: TLabel; wwDBLookupCombo52: TwwDBLookupCombo; wwDBDateTimePicker2: TwwDBDateTimePicker; DBEdit5: TDBEdit; bsSkinGroupBox5: TbsSkinGroupBox; bsSkinDBCheckRadioBox1: TbsSkinDBCheckRadioBox; bsSkinDBCheckRadioBox2: TbsSkinDBCheckRadioBox; bsSkinDBCheckRadioBox3: TbsSkinDBCheckRadioBox; bsSkinDBCheckRadioBox4: TbsSkinDBCheckRadioBox; bsSkinDBCheckRadioBox5: TbsSkinDBCheckRadioBox; bsSkinDBCheckRadioBox9: TbsSkinDBCheckRadioBox; wwDBLookupCombo9: TwwDBLookupCombo; RxDBLookupCombo7: TRxDBLookupCombo; wwDBLookupCombo10: TwwDBLookupCombo; RxDBLookupCombo9: TRxDBLookupCombo; DBEdit8: TDBEdit; DBEdit9: TDBEdit; RxDBLookupCombo8: TRxDBLookupCombo; DBEdit1: TDBEdit; DBEdit14: TDBEdit; DBEdit15: TDBEdit; RxDBLookupCombo10: TRxDBLookupCombo; RxDBLookupCombo20: TRxDBLookupCombo; bsSkinPanel7: TbsSkinPanel; Label35: TLabel; Label8: TLabel; Label12: TLabel; Label20: TLabel; Label108: TLabel; Label109: TLabel; RxDBLookupCombo28: TRxDBLookupCombo; wwDBComboBox1: TwwDBComboBox; bsSkinDBCheckRadioBox7: TbsSkinDBCheckRadioBox; DBMemo1: TDBMemo; wwDBDateTimePicker7: TwwDBDateTimePicker; bsSkinButton21: TbsSkinButton; DBEdit37: TDBEdit; DBEdit38: TDBEdit; bsSkinButton22: TbsSkinButton; bsSkinExPanel1: TbsSkinExPanel; ADOQuery_wf: TADOQuery; ADOQuery_wf1: TDataSource; dxDBGrid2: TdxDBGrid; dxDBGrid2Column1: TdxDBGridColumn; dxDBGrid2Column2: TdxDBGridColumn; dxDBGrid2Column3: TdxDBGridColumn; dxDBGrid2Column4: TdxDBGridColumn; dxDBGrid2Column5: TdxDBGridColumn; tbl1: TbsSkinTabSheet; Label17: TLabel; RxDBLookupCombo13: TRxDBLookupCombo; Label119: TLabel; wwDBComboBox8: TwwDBComboBox; bsSkinDBCheckRadioBox6: TbsSkinDBCheckRadioBox; Label24: TLabel; DBEdit6: TDBEdit; Label18: TLabel; DBEdit3: TDBEdit; N4: TMenuItem; N5: TMenuItem; PopupMenu4: TPopupMenu; MenuItem1: TMenuItem; MenuItem2: TMenuItem; MenuItem9: TMenuItem; N75: TMenuItem; N76: TMenuItem; N77: TMenuItem; bsSkinTabSheet3: TbsSkinTabSheet; bsSkinExPanel2: TbsSkinExPanel; bsSkinPanel2: TbsSkinPanel; bsSkinButton8: TbsSkinButton; bsSkinButton12: TbsSkinButton; bsSkinButton13: TbsSkinButton; bsSkinButton14: TbsSkinButton; bsSkinButton23: TbsSkinButton; wwDBGrid1: TwwDBGrid; wwDBLookupCombo1: TwwDBLookupCombo; wwDBLookupCombo2: TwwDBLookupCombo; wwDBLookupCombo3: TwwDBLookupCombo; wwDBLookupCombo5: TwwDBLookupCombo; bsSkinExPanel3: TbsSkinExPanel; bsSkinPanel5: TbsSkinPanel; bsSkinButton16: TbsSkinButton; bsSkinButton17: TbsSkinButton; bsSkinButton18: TbsSkinButton; bsSkinButton19: TbsSkinButton; bsSkinButton20: TbsSkinButton; bsSkinButton24: TbsSkinButton; wwDBGrid2: TwwDBGrid; wwDBLookupCombo4: TwwDBLookupCombo; wwDBLookupCombo11: TwwDBLookupCombo; wwDBLookupCombo12: TwwDBLookupCombo; wwDBLookupCombo14: TwwDBLookupCombo; Label122: TLabel; DBMemo33: TDBMemo; RxDBLookupCombo4: TRxDBLookupCombo; wwDBLookupCombo6: TwwDBLookupCombo; Label121: TLabel; RxDBLookupCombo5: TRxDBLookupCombo; wwDBLookupCombo7: TwwDBLookupCombo; DBMemo34: TDBMemo; Label123: TLabel; DBMemo35: TDBMemo; RxDBLookupCombo6: TRxDBLookupCombo; wwDBLookupCombo8: TwwDBLookupCombo; Label43: TLabel; DBMemo10: TDBMemo; RxDBLookupCombo19: TRxDBLookupCombo; wwDBLookupCombo13: TwwDBLookupCombo; Label163: TLabel; DBMemo38: TDBMemo; Label21: TLabel; DBMemo39: TDBMemo; Label165: TLabel; Label166: TLabel; Label167: TLabel; Label169: TLabel; Label170: TLabel; Label32: TLabel; Label27: TLabel; Label30: TLabel; DBMemo40: TDBMemo; DBMemo41: TDBMemo; DBMemo42: TDBMemo; wwDBLookupCombo61: TwwDBLookupCombo; DBEdit81: TDBEdit; DBEdit82: TDBEdit; DBEdit83: TDBEdit; wwDBLookupCombo21: TwwDBLookupCombo; DBEdit25: TDBEdit; RxDBLookupCombo15: TRxDBLookupCombo; dxDBGrid1Column40: TdxDBGridColumn; t_bz_balance: TRxMemoryData; wwDBLookupCombo15: TwwDBLookupCombo; wwDBLookupCombo16: TwwDBLookupCombo; Label41: TLabel; RxDBLookupCombo31: TRxDBLookupCombo; Label36: TLabel; RxDBLookupCombo14: TRxDBLookupCombo; Label37: TLabel; RxDBLookupCombo16: TRxDBLookupCombo; procedure bsSkinButton5Click(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure Panel2Resize(Sender: TObject); procedure bsSkinButton7Click(Sender: TObject); procedure bsSkinButton6Click(Sender: TObject); procedure bsSkinButton2Click(Sender: TObject); procedure bsSkinButton9Click(Sender: TObject); procedure bsSkinButton11Click(Sender: TObject); procedure bsSkinButton4Click(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure bsSkinButton38Click(Sender: TObject); procedure FormShow(Sender: TObject); procedure t_op_seae_orderBeforeCancel(DataSet: TDataSet); procedure t_op_seae_orderPostError(DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction); procedure bsSkinButton10Click(Sender: TObject); procedure t_op_seae_orderBeforePost(DataSet: TDataSet); procedure t_op_seae_orderBeforeEdit(DataSet: TDataSet); procedure bsSkinButton15Click(Sender: TObject); procedure DBEdit5Click(Sender: TObject); procedure dxDBGrid1DblClick(Sender: TObject); procedure RxDBLookupCombo12Change(Sender: TObject); procedure RxDBLookupCombo1Enter(Sender: TObject); procedure RxDBLookupCombo8Enter(Sender: TObject); procedure RxDBLookupCombo1Exit(Sender: TObject); procedure RxDBLookupCombo8Exit(Sender: TObject); procedure RxDBLookupCombo4Change(Sender: TObject); procedure RxDBLookupCombo5Change(Sender: TObject); procedure RxDBLookupCombo6Change(Sender: TObject); procedure DBMemo40Change(Sender: TObject); procedure DBMemo41Change(Sender: TObject); procedure DBMemo42Change(Sender: TObject); procedure wwDBLookupCombo6Change(Sender: TObject); procedure wwDBLookupCombo7Change(Sender: TObject); procedure wwDBLookupCombo8Change(Sender: TObject); procedure wwDBLookupCombo6Exit(Sender: TObject); procedure wwDBLookupCombo7Exit(Sender: TObject); procedure wwDBLookupCombo8Exit(Sender: TObject); procedure N1Click(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure N3Click(Sender: TObject); procedure N10Click(Sender: TObject); procedure N16Click(Sender: TObject); procedure N14Click(Sender: TObject); procedure N12Click(Sender: TObject); procedure RxDBLookupCombo1Change(Sender: TObject); procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); procedure dxDBGrid1Column9CustomDraw(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 dxDBGrid1CustomDraw(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 wwDBLookupCombo52Change(Sender: TObject); procedure bsSkinButton21Click(Sender: TObject); procedure wwDBLookupCombo1Change(Sender: TObject); procedure wwDBLookupCombo1KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo5Exit(Sender: TObject); procedure wwDBLookupCombo3Change(Sender: TObject); procedure wwDBLookupCombo3KeyPress(Sender: TObject; var Key: Char); procedure t_ch_acceptAfterInsert(DataSet: TDataSet); procedure t_ch_acceptBeforePost(DataSet: TDataSet); procedure bsSkinButton8Click(Sender: TObject); procedure bsSkinButton12Click(Sender: TObject); procedure bsSkinButton13Click(Sender: TObject); procedure bsSkinButton14Click(Sender: TObject); procedure wwDBLookupCombo4Change(Sender: TObject); procedure wwDBLookupCombo4KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo14Change(Sender: TObject); procedure wwDBLookupCombo14KeyPress(Sender: TObject; var Key: Char); procedure t_ch_payAfterInsert(DataSet: TDataSet); procedure t_ch_payBeforePost(DataSet: TDataSet); procedure t_ch_acceptAfterPost(DataSet: TDataSet); procedure t_ch_payAfterPost(DataSet: TDataSet); procedure RxDBLookupCombo10Enter(Sender: TObject); procedure RxDBLookupCombo10Exit(Sender: TObject); procedure RxDBLookupCombo20Enter(Sender: TObject); procedure RxDBLookupCombo20Exit(Sender: TObject); procedure bsSkinButton17Click(Sender: TObject); procedure bsSkinButton16Click(Sender: TObject); procedure bsSkinButton18Click(Sender: TObject); procedure bsSkinButton19Click(Sender: TObject); procedure bsSkinButton20Click(Sender: TObject); procedure t_op_seae_orderAfterInsert(DataSet: TDataSet); procedure t_ch_payBeforeEdit(DataSet: TDataSet); procedure t_ch_acceptBeforeEdit(DataSet: TDataSet); procedure bsSkinButton22Click(Sender: TObject); procedure wwDBLookupCombo5KeyPress(Sender: TObject; var Key: Char); procedure wwDBLookupCombo5Change(Sender: TObject); procedure bsSkinButton23Click(Sender: TObject); procedure RxDBLookupCombo7Change(Sender: TObject); procedure RxDBLookupCombo7Enter(Sender: TObject); procedure RxDBLookupCombo7Exit(Sender: TObject); procedure N5Click(Sender: TObject); procedure MenuItem1Click(Sender: TObject); procedure N75Click(Sender: TObject); procedure N77Click(Sender: TObject); procedure bsSkinButton24Click(Sender: TObject); procedure dxDBGrid1Column40CustomDraw(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 wwDBLookupCombo15DropDown(Sender: TObject); procedure wwDBLookupCombo15Change(Sender: TObject); procedure wwDBLookupCombo16Change(Sender: TObject); procedure wwDBLookupCombo16DropDown(Sender: TObject); procedure t_ch_payBeforeDelete(DataSet: TDataSet); procedure t_ch_acceptBeforeInsert(DataSet: TDataSet); procedure t_ch_acceptBeforeDelete(DataSet: TDataSet); procedure t_ch_payBeforeInsert(DataSet: TDataSet); procedure RxDBLookupCombo14Enter(Sender: TObject); procedure RxDBLookupCombo14Exit(Sender: TObject); procedure RxDBLookupCombo16Enter(Sender: TObject); procedure RxDBLookupCombo16Exit(Sender: TObject); private procedure t_billsalescharge(Sender: TField); procedure t_ch_acceptdjoncharge(Sender: TField);//收费金额计算 procedure t_ch_paydjoncharge(Sender: TField); //付费金额计算 procedure t_ch_acceptcrmcharge(Sender: TField);//收费金额计算 procedure DatasetNOPricecharge(Sender: TField);//收费金额计算 procedure DatasetAmtcharge(Sender: TField);//收费金额计算 { Private declarations } public { Public declarations } function if_Edit_delete:Boolean; procedure setconcolor; procedure crmchargeDr(Sender: TField);//收费金额计算 procedure crmchargeCr(Sender: TField);//收费金额计算 procedure NOPricechargeDr(Sender: TField);//收费金额计算 procedure NOPricechargeCr(Sender: TField);//收费金额计算 end; var frm_op_seae_weituo_wf: Tfrm_op_seae_weituo_wf; implementation uses u_main,u_data_share, my_sys_function, u_sys_progress, u_op_seae_apply_add, u_op_add_code, u_op_ctn, u_opor_ctn, my_sys_chat,u_op_seae_oder_add, u_code_fee_project_order_add; {$R *.dfm} procedure Tfrm_op_seae_weituo_wf.setconcolor; procedure consetcolor(fielname:String); var i:integer; scolor:string; begin scolor:=get_parameters_value(144,'clInfoBk'); with bsSkinPanel1 do begin for i:=0 to ControlCount-1 do begin if Controls[i] is TwwDBComboBox then begin if TwwDBComboBox(Controls[i]).DataField=fielname then begin TwwDBComboBox(Controls[i]).Color:=StringToColor(scolor); exit; end; end else if Controls[i] is TwwDBLookupCombo then begin if TwwDBLookupCombo(Controls[i]).DataField=fielname then begin TwwDBLookupCombo(Controls[i]).Color:=StringToColor(scolor); exit; end; end else if Controls[i] is TDBEdit then begin if TDBEdit(Controls[i]).DataField=fielname then begin TDBEdit(Controls[i]).Color:=StringToColor(scolor); exit; end; end else if Controls[i] is TwwDBDateTimePicker then begin if TwwDBDateTimePicker(Controls[i]).DataField=fielname then begin TwwDBDateTimePicker(Controls[i]).Color:=StringToColor(scolor); exit; end; end else if Controls[i] is TDBMemo then begin if TDBMemo(Controls[i]).DataField=fielname then begin TDBMemo(Controls[i]).Color:=StringToColor(scolor); exit; end; end else if Controls[i] is TRxDBLookupCombo then begin if TRxDBLookupCombo(Controls[i]).DataField=fielname then begin TRxDBLookupCombo(Controls[i]).Color:=StringToColor(scolor); exit; end; end; end; end; { with bsSkinGroupBox1 do begin for i:=0 to ControlCount-1 do begin if Controls[i] is TwwDBComboBox then begin if TwwDBComboBox(Controls[i]).DataField=fielname then begin TwwDBComboBox(Controls[i]).Color:=StringToColor(scolor); exit; end; end else if Controls[i] is TwwDBLookupCombo then begin if TwwDBLookupCombo(Controls[i]).DataField=fielname then begin TwwDBLookupCombo(Controls[i]).Color:=StringToColor(scolor); exit; end; end else if Controls[i] is TDBEdit then begin if TDBEdit(Controls[i]).DataField=fielname then begin TDBEdit(Controls[i]).Color:=StringToColor(scolor); exit; end; end else if Controls[i] is TwwDBDateTimePicker then begin if TwwDBDateTimePicker(Controls[i]).DataField=fielname then begin TwwDBDateTimePicker(Controls[i]).Color:=StringToColor(scolor); exit; end; end else if Controls[i] is TDBMemo then begin if TDBMemo(Controls[i]).DataField=fielname then begin TDBMemo(Controls[i]).Color:=StringToColor(scolor); exit; end; end else if Controls[i] is TRxDBLookupCombo then begin if TRxDBLookupCombo(Controls[i]).DataField=fielname then begin TRxDBLookupCombo(Controls[i]).Color:=StringToColor(scolor); exit; end; end; end; end; } with bsSkinPanel1 do begin for i:=0 to ControlCount-1 do begin if Controls[i] is TDBEdit then begin if TDBEdit(Controls[i]).DataField=fielname then begin TDBEdit(Controls[i]).Color:=StringToColor(scolor); exit; end; end else if Controls[i] is TRxDBLookupCombo then begin if TRxDBLookupCombo(Controls[i]).DataField=fielname then begin TRxDBLookupCombo(Controls[i]).Color:=StringToColor(scolor); exit; end; end else if Controls[i] is TDBComboBoxEh then begin if TDBComboBoxEh(Controls[i]).DataField=fielname then begin TDBComboBoxEh(Controls[i]).Color:=StringToColor(scolor); exit; end; end; end; end; end; begin //必填项目不同颜色显示 frm_data_share.t_code_empty.Filtered:=false; frm_data_share.t_code_empty.Filter:='表=''t_op_seae_order'''; frm_data_share.t_code_empty.Filtered:=true; frm_data_share.t_code_empty.First; while not frm_data_share.t_code_empty.Eof do begin consetcolor(frm_data_share.t_code_empty.fieldbyname('字段名称').asstring); frm_data_share.t_code_empty.next; end; end; procedure Tfrm_op_seae_weituo_wf.t_ch_acceptdjoncharge(Sender: TField); begin //收费金额计算 if (Sender.DataSet.state=dsedit)or(Sender.DataSet.state=dsinsert)then begin if Sender.FieldName='单价' then try Sender.DataSet.FieldByName('不含税价').OnChange:=nil; Sender.DataSet.FieldByName('单价').OnChange:=nil; Sender.DataSet.FieldByName('金额').OnChange:=nil; Sender.DataSet['不含税价']:=Sender.DataSet.fieldbyname('单价').asfloat/(1+Sender.DataSet.fieldbyname('税率').asfloat/100); finally Sender.DataSet.FieldByName('单价').OnChange:=t_ch_acceptdjoncharge; Sender.DataSet.FieldByName('不含税价').OnChange:=DatasetNOPricecharge; Sender.DataSet.FieldByName('金额').OnChange:=DatasetAmtcharge; end; try Sender.DataSet.FieldByName('单价').OnChange:=nil; Sender.DataSet.FieldByName('金额').OnChange:=nil; if (Sender.DataSet.fieldbyname('单价').asfloat<>0) and (Sender.DataSet.fieldbyname('数量').asfloat<>0)then if (Sender.DataSet.fieldbyname('佣金比例').asfloat<>0) then Sender.DataSet['金额']:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('单价').asfloat*Sender.DataSet.fieldbyname('数量').asfloat*(1-Sender.DataSet.fieldbyname('佣金比例').asfloat/100)) else Sender.DataSet['金额']:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('单价').asfloat*Sender.DataSet.fieldbyname('数量').asfloat); Sender.DataSet['税额']:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('不含税价').asfloat*Sender.DataSet.fieldbyname('税率').asfloat/100*Sender.DataSet.fieldbyname('数量').asfloat); Sender.DataSet['不含税金额']:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('金额').asfloat-Sender.DataSet.fieldbyname('税额').asfloat); Sender.DataSet['财务税额']:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('金额').asfloat/(1+Sender.DataSet.fieldbyname('财务税率').asfloat/100)*Sender.DataSet.fieldbyname('财务税率').asfloat/100); Sender.DataSet['财务不含税价']:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('金额').asfloat-Sender.DataSet.fieldbyname('财务税额').asfloat); finally Sender.DataSet.FieldByName('金额').OnChange:=DatasetAmtcharge; Sender.DataSet.FieldByName('单价').OnChange:=t_ch_acceptdjoncharge; end; end; end; procedure Tfrm_op_seae_weituo_wf.t_ch_paydjoncharge(Sender: TField); begin if (Sender.DataSet.state=dsedit)or(Sender.DataSet.state=dsinsert)then begin if Sender.FieldName='单价' then try Sender.DataSet.FieldByName('不含税价').OnChange:=nil; Sender.DataSet.FieldByName('单价').OnChange:=nil; Sender.DataSet.FieldByName('金额').OnChange:=nil; Sender.DataSet['不含税价']:=Sender.DataSet.fieldbyname('单价').asfloat/(1+Sender.DataSet.fieldbyname('税率').asfloat/100); finally Sender.DataSet.FieldByName('单价').OnChange:=t_ch_paydjoncharge; Sender.DataSet.FieldByName('不含税价').OnChange:=DatasetNOPricecharge; Sender.DataSet.FieldByName('金额').OnChange:=DatasetAmtcharge; end; try Sender.DataSet.FieldByName('单价').OnChange:=nil; Sender.DataSet.FieldByName('金额').OnChange:=nil; if (Sender.DataSet.fieldbyname('单价').asfloat<>0) and (Sender.DataSet.fieldbyname('数量').asfloat<>0)then if (Sender.DataSet.fieldbyname('佣金比例').asfloat<>0) then Sender.DataSet['金额']:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('单价').asfloat*Sender.DataSet.fieldbyname('数量').asfloat*(1-Sender.DataSet.fieldbyname('佣金比例').asfloat/100)) else Sender.DataSet['金额']:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('单价').asfloat*Sender.DataSet.fieldbyname('数量').asfloat); Sender.DataSet['税额']:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('不含税价').asfloat*Sender.DataSet.fieldbyname('税率').asfloat/100*Sender.DataSet.fieldbyname('数量').asfloat); Sender.DataSet['不含税金额']:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('金额').asfloat-Sender.DataSet.fieldbyname('税额').asfloat); Sender.DataSet['财务税额']:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('金额').asfloat/(1+Sender.DataSet.fieldbyname('财务税率').asfloat/100)*Sender.DataSet.fieldbyname('财务税率').asfloat/100); Sender.DataSet['财务不含税价']:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('金额').asfloat-Sender.DataSet.fieldbyname('财务税额').asfloat); finally Sender.DataSet.FieldByName('金额').OnChange:=DatasetAmtcharge; Sender.DataSet.FieldByName('单价').OnChange:=t_ch_paydjoncharge; end; end; end; { if UpperCase(Sender.DataSet.Name)='T_CH_PAY' then wwDBGrid2.Refresh else wwDBGrid1.Refresh; } procedure Tfrm_op_seae_weituo_wf.t_ch_acceptcrmcharge(Sender: TField);//收费金额计算 begin if not Sender.DataSet.IsEmpty then if (Sender.DataSet.state=dsedit)or(Sender.DataSet.state=dsinsert)then begin case StrToInt(edit_type.text) of 1,2: begin if UpperCase(Sender.DataSet.Name)='T_CH_ACCEPT' then begin if frm_data_share.t_crm_client.Locate('客户简称',Sender.DataSet.DataSource.DataSet.fieldbyname('船公司').AsString,[]) then begin if Sender.DataSet.fieldbyname('金额').AsFloat=0 then Sender.DataSet['税率']:=frm_data_share.t_crm_client.fieldbyname('税率').AsFloat; Sender.DataSet['财务税率']:=frm_data_share.t_sys_company.fieldbyname('税率').AsFloat; end else if frm_data_share.t_crm_client.Locate('客户简称',Sender.DataSet.fieldbyname('客户名称').AsString,[]) then begin if Sender.DataSet.fieldbyname('金额').AsFloat=0 then Sender.DataSet['税率']:=frm_data_share.t_crm_client.fieldbyname('税率').AsFloat; Sender.DataSet['财务税率']:=frm_data_share.t_sys_company.fieldbyname('税率').AsFloat; end else begin if Sender.DataSet.fieldbyname('金额').AsFloat=0 then Sender.DataSet['税率']:=frm_data_share.t_sys_company.fieldbyname('税率').AsFloat; Sender.DataSet['财务税率']:=frm_data_share.t_sys_company.fieldbyname('税率').AsFloat; end; end else begin if frm_data_share.t_crm_client.Locate('客户简称',Sender.DataSet.fieldbyname('客户名称').AsString,[]) then begin if Sender.DataSet.fieldbyname('金额').AsFloat=0 then Sender.DataSet['税率']:=frm_data_share.t_crm_client.fieldbyname('税率').AsFloat; if not frm_data_share.t_crm_client.fieldbyname('进项税率').IsNull then Sender.DataSet['财务税率']:=frm_data_share.t_crm_client.fieldbyname('进项税率').AsFloat else Sender.DataSet['财务税率']:=frm_data_share.t_sys_company.fieldbyname('税率').AsFloat end else begin if Sender.DataSet.fieldbyname('金额').AsFloat=0 then Sender.DataSet['税率']:=frm_data_share.t_sys_company.fieldbyname('税率').AsFloat; Sender.DataSet['财务税率']:=frm_data_share.t_sys_company.fieldbyname('税率').AsFloat; end; end; end; 3,4: begin if UpperCase(Sender.DataSet.Name)='T_CH_ACCEPT' then begin if frm_data_share.t_crm_client.Locate('客户简称',Sender.DataSet.DataSource.DataSet.fieldbyname('航空公司').AsString,[]) then begin if Sender.DataSet.fieldbyname('金额').AsFloat=0 then Sender.DataSet['税率']:=frm_data_share.t_crm_client.fieldbyname('税率').AsFloat; Sender.DataSet['财务税率']:=frm_data_share.t_sys_company.fieldbyname('税率').AsFloat; end else if frm_data_share.t_crm_client.Locate('客户简称',Sender.DataSet.fieldbyname('客户名称').AsString,[]) then begin if Sender.DataSet.fieldbyname('金额').AsFloat=0 then Sender.DataSet['税率']:=frm_data_share.t_crm_client.fieldbyname('税率').AsFloat; if not frm_data_share.t_crm_client.fieldbyname('进项税率').IsNull then Sender.DataSet['财务税率']:=frm_data_share.t_crm_client.fieldbyname('进项税率').AsFloat else Sender.DataSet['财务税率']:=frm_data_share.t_sys_company.fieldbyname('税率').AsFloat end else begin if Sender.DataSet.fieldbyname('金额').AsFloat=0 then Sender.DataSet['税率']:=frm_data_share.t_sys_company.fieldbyname('税率').AsFloat; Sender.DataSet['财务税率']:=frm_data_share.t_sys_company.fieldbyname('税率').AsFloat; end; end else begin if frm_data_share.t_crm_client.Locate('客户简称',Sender.DataSet.fieldbyname('客户名称').AsString,[]) then begin if Sender.DataSet.fieldbyname('金额').AsFloat=0 then Sender.DataSet['税率']:=frm_data_share.t_crm_client.fieldbyname('税率').AsFloat; if not frm_data_share.t_crm_client.fieldbyname('进项税率').IsNull then Sender.DataSet['财务税率']:=frm_data_share.t_crm_client.fieldbyname('进项税率').AsFloat else Sender.DataSet['财务税率']:=frm_data_share.t_sys_company.fieldbyname('税率').AsFloat end else begin if Sender.DataSet.fieldbyname('金额').AsFloat=0 then Sender.DataSet['税率']:=frm_data_share.t_sys_company.fieldbyname('税率').AsFloat; Sender.DataSet['财务税率']:=frm_data_share.t_sys_company.fieldbyname('税率').AsFloat; end; end; end else begin Sender.DataSet['税率']:=frm_data_share.t_sys_company.fieldbyname('税率').AsFloat; Sender.DataSet['财务税率']:=frm_data_share.t_sys_company.fieldbyname('税率').AsFloat; end; end; { if UpperCase(Sender.DataSet.Name)='T_CH_PAY' then wwDBGrid2.Refresh else wwDBGrid1.Refresh; } end; end; procedure Tfrm_op_seae_weituo_wf.DatasetAmtcharge(Sender: TField); begin if not Sender.DataSet.IsEmpty then if (Sender.DataSet.state=dsedit)or(Sender.DataSet.state=dsinsert)then begin Sender.DataSet['财务税额']:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('金额').asfloat/(1+Sender.DataSet.fieldbyname('财务税率').asfloat/100)*Sender.DataSet.fieldbyname('财务税率').asfloat/100); Sender.DataSet['财务不含税价']:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('金额').asfloat-Sender.DataSet.fieldbyname('财务税额').asfloat); Sender.DataSet['税额']:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('不含税价').asfloat*Sender.DataSet.fieldbyname('税率').asfloat/100*Sender.DataSet.fieldbyname('数量').asfloat); Sender.DataSet['不含税金额']:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('金额').asfloat-Sender.DataSet.fieldbyname('税额').asfloat); try Sender.DataSet.FieldByName('不含税价').OnChange:=nil; Sender.DataSet.FieldByName('单价').OnChange:=nil; Sender.DataSet.FieldByName('税率').OnChange:=nil; Sender.DataSet.FieldByName('数量').OnChange:=nil; if Sender.FieldName='金额' then begin if Sender.DataSet.fieldbyname('数量').asfloat<>0 then Sender.DataSet.FieldByName('单价').asfloat:=Sender.DataSet.fieldbyname('金额').asfloat/Sender.DataSet.fieldbyname('数量').asfloat; // Sender.DataSet.FieldByName('单价').asfloat:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('金额').asfloat/Sender.DataSet.fieldbyname('数量').asfloat); if Sender.DataSet.fieldbyname('数量').asfloat<>0 then Sender.DataSet.FieldByName('不含税价').asfloat:=s_w(strtoint(apointnum),Sender.DataSet.FieldByName('单价').asfloat/(1+Sender.DataSet.FieldByName('税率').asfloat/100)); end; finally if UpperCase(Sender.DataSet.Name)='T_CH_ACCEPT' then begin Sender.DataSet.FieldByName('不含税价').OnChange:=DatasetNOPricecharge; Sender.DataSet.FieldByName('税率').OnChange:=DatasetNOPricecharge; Sender.DataSet.FieldByName('单价').OnChange:=t_ch_acceptdjoncharge; Sender.DataSet.FieldByName('数量').OnChange:=t_ch_acceptdjoncharge; end else begin Sender.DataSet.FieldByName('不含税价').OnChange:=DatasetNOPricecharge; Sender.DataSet.FieldByName('税率').OnChange:=DatasetNOPricecharge; Sender.DataSet.FieldByName('单价').OnChange:=t_ch_paydjoncharge; Sender.DataSet.FieldByName('数量').OnChange:=t_ch_paydjoncharge; end; end; { if UpperCase(Sender.DataSet.Name)='T_CH_PAY' then wwDBGrid2.Refresh else wwDBGrid1.Refresh; } end; end; procedure Tfrm_op_seae_weituo_wf.DatasetNOPricecharge(Sender: TField);//收费金额计算 begin if not Sender.DataSet.IsEmpty then if (Sender.DataSet.state=dsedit)or(Sender.DataSet.state=dsinsert)then begin if Sender.FieldName='不含税价' then begin try Sender.DataSet.FieldByName('金额').OnChange:=nil; Sender.DataSet.FieldByName('单价').OnChange:=nil; Sender.DataSet.fieldbyname('单价').asfloat:=Sender.DataSet.fieldbyname('不含税价').asfloat*Sender.DataSet.fieldbyname('税率').asfloat/100+Sender.DataSet.fieldbyname('不含税价').asfloat; // Sender.DataSet.fieldbyname('单价').asfloat:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('不含税价').asfloat*Sender.DataSet.fieldbyname('税率').asfloat/100+Sender.DataSet.fieldbyname('不含税价').asfloat); if (Sender.DataSet.fieldbyname('单价').asfloat<>0) and (Sender.DataSet.fieldbyname('数量').asfloat<>0)then if (Sender.DataSet.fieldbyname('佣金比例').asfloat<>0) then Sender.DataSet['金额']:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('单价').asfloat*Sender.DataSet.fieldbyname('数量').asfloat*(1-Sender.DataSet.fieldbyname('佣金比例').asfloat/100)) else Sender.DataSet['金额']:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('单价').asfloat*Sender.DataSet.fieldbyname('数量').asfloat); Sender.DataSet['财务税额']:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('金额').asfloat/(1+Sender.DataSet.fieldbyname('财务税率').asfloat/100)*Sender.DataSet.fieldbyname('财务税率').asfloat/100); Sender.DataSet['财务不含税价']:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('金额').asfloat-Sender.DataSet.fieldbyname('财务税额').asfloat); Sender.DataSet['税额']:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('不含税价').asfloat*Sender.DataSet.fieldbyname('税率').asfloat/100*Sender.DataSet.fieldbyname('数量').asfloat); Sender.DataSet['不含税金额']:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('金额').asfloat-Sender.DataSet.fieldbyname('税额').asfloat); finally Sender.DataSet.FieldByName('金额').OnChange:=DatasetAmtcharge; if UpperCase(Sender.DataSet.Name)='T_CH_ACCEPT' then Sender.DataSet.FieldByName('单价').OnChange:=t_ch_acceptdjoncharge else Sender.DataSet.FieldByName('单价').OnChange:=t_ch_paydjoncharge; end; end else if Sender.FieldName='税率' then begin try Sender.DataSet.FieldByName('金额').OnChange:=nil; Sender.DataSet.FieldByName('单价').OnChange:=nil; Sender.DataSet.fieldbyname('财务税率').OnChange:=nil; Sender.DataSet.fieldbyname('单价').asfloat:=Sender.DataSet.fieldbyname('不含税价').asfloat*Sender.DataSet.fieldbyname('税率').asfloat/100+Sender.DataSet.fieldbyname('不含税价').asfloat; // Sender.DataSet.fieldbyname('单价').asfloat:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('不含税价').asfloat*Sender.DataSet.fieldbyname('税率').asfloat/100+Sender.DataSet.fieldbyname('不含税价').asfloat); if (Sender.DataSet.fieldbyname('单价').asfloat<>0) and (Sender.DataSet.fieldbyname('数量').asfloat<>0)then if (Sender.DataSet.fieldbyname('佣金比例').asfloat<>0) then Sender.DataSet['金额']:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('单价').asfloat*Sender.DataSet.fieldbyname('数量').asfloat*(1-Sender.DataSet.fieldbyname('佣金比例').asfloat/100)) else Sender.DataSet['金额']:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('单价').asfloat*Sender.DataSet.fieldbyname('数量').asfloat); Sender.DataSet['财务税额']:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('金额').asfloat/(1+Sender.DataSet.fieldbyname('财务税率').asfloat/100)*Sender.DataSet.fieldbyname('财务税率').asfloat/100); Sender.DataSet['财务不含税价']:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('金额').asfloat-Sender.DataSet.fieldbyname('财务税额').asfloat); Sender.DataSet['税额']:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('不含税价').asfloat*Sender.DataSet.fieldbyname('税率').asfloat/100*Sender.DataSet.fieldbyname('数量').asfloat); Sender.DataSet['不含税金额']:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('金额').asfloat-Sender.DataSet.fieldbyname('税额').asfloat); if (Sender.DataSet.fieldbyname('税率').asfloat=0) and (UpperCase(Sender.DataSet.Name)='T_CH_PAY') then Sender.DataSet.fieldbyname('财务税率').asfloat:=0 else Sender.DataSet.fieldbyname('财务税率').asfloat:=frm_data_share.t_sys_company.fieldbyname('税率').AsFloat; finally Sender.DataSet.fieldbyname('财务税率').OnChange:=DatasetAmtcharge; Sender.DataSet.FieldByName('金额').OnChange:=DatasetAmtcharge; if UpperCase(Sender.DataSet.Name)='T_CH_ACCEPT' then Sender.DataSet.FieldByName('单价').OnChange:=t_ch_acceptdjoncharge else Sender.DataSet.FieldByName('单价').OnChange:=t_ch_paydjoncharge; end; end; end; end; procedure Tfrm_op_seae_weituo_wf.crmchargeDr(Sender: TField); begin if (Sender.DataSet.state=dsedit)or(Sender.DataSet.state=dsinsert)then begin if frm_data_share.t_crm_client.Locate('客户简称',Sender.DataSet.DataSource.DataSet.fieldbyname('船公司').AsString,[]) then begin Sender.DataSet['应收税率']:=frm_data_share.t_crm_client.fieldbyname('税率').AsFloat; Sender.DataSet['应收财务税率']:=frm_data_share.t_sys_company.fieldbyname('税率').AsFloat; end else if frm_data_share.t_crm_client.Locate('客户简称',Sender.DataSet.fieldbyname('应收客户').AsString,[]) then begin Sender.DataSet['应收税率']:=frm_data_share.t_crm_client.fieldbyname('税率').AsFloat; Sender.DataSet['应收财务税率']:=frm_data_share.t_sys_company.fieldbyname('税率').AsFloat; end else begin Sender.DataSet['应收财务税率']:=frm_data_share.t_sys_company.fieldbyname('税率').AsFloat; Sender.DataSet['应收财务税率']:=frm_data_share.t_sys_company.fieldbyname('税率').AsFloat; end; wwDBGrid1.Refresh; end; end; procedure Tfrm_op_seae_weituo_wf.crmchargeCr(Sender: TField); begin if (Sender.DataSet.state=dsedit)or(Sender.DataSet.state=dsinsert)then begin if frm_data_share.t_crm_client.Locate('客户简称',Sender.DataSet.DataSource.DataSet.fieldbyname('船公司').AsString,[]) then begin Sender.DataSet['应付税率']:=frm_data_share.t_crm_client.fieldbyname('税率').AsFloat; Sender.DataSet['应付财务税率']:=frm_data_share.t_sys_company.fieldbyname('税率').AsFloat; end else if frm_data_share.t_crm_client.Locate('客户简称',Sender.DataSet.fieldbyname('应付客户').AsString,[]) then begin Sender.DataSet['应付税率']:=frm_data_share.t_crm_client.fieldbyname('税率').AsFloat; Sender.DataSet['应付财务税率']:=frm_data_share.t_sys_company.fieldbyname('税率').AsFloat; end else begin Sender.DataSet['应付财务税率']:=frm_data_share.t_sys_company.fieldbyname('税率').AsFloat; Sender.DataSet['应付财务税率']:=frm_data_share.t_sys_company.fieldbyname('税率').AsFloat; end; wwDBGrid1.Refresh; end; end; procedure Tfrm_op_seae_weituo_wf.NOPricechargeDr(Sender: TField);//收费金额计算 begin //收费金额计算 if (Sender.DataSet.state=dsedit)or(Sender.DataSet.state=dsinsert)then begin Sender.DataSet['应收单价']:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('应收不含税价').asfloat*Sender.DataSet.fieldbyname('应收税率').asfloat/100+Sender.DataSet.fieldbyname('应收不含税价').asfloat); wwDBGrid1.Refresh; end; end; procedure Tfrm_op_seae_weituo_wf.NOPricechargeCr(Sender: TField);//收费金额计算 begin //收费金额计算 if (Sender.DataSet.state=dsedit)or(Sender.DataSet.state=dsinsert)then begin Sender.DataSet['应付单价']:=s_w(strtoint(apointnum),Sender.DataSet.fieldbyname('应付不含税价').asfloat*Sender.DataSet.fieldbyname('应付税率').asfloat/100+Sender.DataSet.fieldbyname('应付不含税价').asfloat); wwDBGrid1.Refresh; end; end; function Tfrm_op_seae_weituo_wf.if_Edit_delete:Boolean; var aAdoQuery:TADOQuery; begin result:=False; aAdoQuery:=CreateAdoQuery; with aAdoQuery do try Close;SQL.Clear; sql.Add('select 状态 from t_op_seae_order'); sql.Add('where or_id=:or_id and 状态 in (''新建订舱'',''驳回订舱'',''驳回提交'')'); Parameters.ParamByName('or_id').Value:=t_op_seae_order.FieldByName('or_id').AsInteger; Open; if not IsEmpty then result:=True; finally Free; end; end; procedure Tfrm_op_seae_weituo_wf.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_op_seae_weituo_wf.FormClose(Sender: TObject; var Action: TCloseAction); begin savereggrid(dxdbgrid1,caption); savewwgrid(wwDBGrid1,'销售应收'); savewwgrid(wwDBGrid2,'销售应付'); frm_op_seae_weituo_wf.Hide; frm_op_seae_weituo_wf.ManualFloat(frm_op_seae_weituo_wf.BoundsRect ); frm_main.freeTabs('frm_op_seae_weituo_wf'); action:=cafree; frm_op_seae_weituo_wf:=nil; end; procedure Tfrm_op_seae_weituo_wf.Panel2Resize(Sender: TObject); var i:integer; begin i:=round(Panel2.Width/11); bsSkinButton7.Width:=i; bsSkinButton6.Width:=i; bsSkinButton9.Width:=i; bsSkinButton1.Width:=i; bsSkinButton11.Width:=i; bsSkinButton2.Width:=i; bsSkinButton4.Width:=i; bsSkinButton3.Width:=i; bsSkinButton38.Width:=i; bsSkinButton22.Width:=i; end; procedure Tfrm_op_seae_weituo_wf.bsSkinButton7Click(Sender: TObject); begin table_Prior(t_op_seae_order); end; procedure Tfrm_op_seae_weituo_wf.bsSkinButton6Click(Sender: TObject); begin table_next(t_op_seae_order); end; procedure Tfrm_op_seae_weituo_wf.bsSkinButton2Click(Sender: TObject); begin table_post(t_op_seae_order); end; procedure Tfrm_op_seae_weituo_wf.bsSkinButton9Click(Sender: TObject); begin if t_op_seae_order.State in [dsedit,dsinsert] then t_op_seae_order.post; sys_print('海运出口订舱卡',2,t_op_seae_order1,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil); end; procedure Tfrm_op_seae_weituo_wf.bsSkinButton11Click(Sender: TObject); var ID_WordFlow:Integer; aadoQuery,aadoQueryInsert,badoQuery:TadoQuery; s,reasons:string; AmtDr,AmtCr:Double; book1:Tbookmark; begin book1:=t_op_seae_order.GetBookmark; t_op_seae_order.Requery; t_op_seae_order.GotoBookmark(book1); table_before_post(t_op_seae_order,'录入日期'); table_before_post(t_op_seae_order,'委托单位'); table_before_post(t_op_seae_order,'揽货人'); table_before_post(t_op_seae_order,'付费方式'); table_before_post(t_op_seae_order,'录入日期'); table_before_post(t_op_seae_order,'装货港'); table_before_post(t_op_seae_order,'卸货港'); table_before_post(t_op_seae_order,'目的地'); table_before_post(t_op_seae_order,'船公司'); table_before_post(t_op_seae_order,'业务方式'); if op_empty('t_op_seae_order',t_op_seae_order) then Abort; { badoQuery:=CreateAdoQuery; with badoQuery do try close;sql.clear; sql.add('select sum(财务不含税价*汇率) as 应收金额 from t_ch_fee_order where 类型=''收'' and 金额<>0 and OR_ID='+t_op_seae_order.fieldbyname('OR_ID').AsString); open; AmtDr:=fieldbyname('应收金额').AsFloat; close;sql.clear; sql.add('select sum(财务不含税价*汇率) as 应付金额 from t_ch_fee_order where 类型=''付'' and 金额<>0 and OR_ID='+t_op_seae_order.fieldbyname('OR_ID').AsString); open; AmtCr:=fieldbyname('应付金额').AsFloat; t_op_seae_order.Edit; t_op_seae_order.fieldbyname('毛利润').AsFloat:=AmtDr-AmtCr; if AmtDr<>0 then t_op_seae_order.fieldbyname('利润率').Value:=StrToFloat(FormatFloat('0.00;-0.00;0',(AmtDr-AmtCr)/AmtDr)) finally fREE; end; } if t_op_seae_order.State in [dsedit,dsinsert] then t_op_seae_order.post; if not if_Edit_delete then begin ShowMessage('状态为:'+t_op_seae_order.FieldByName('状态').AsString+'不能操作'); Abort; end; if t_op_seae_order.IsEmpty or (Trim(t_op_seae_order.FieldByName('订舱编号').AsString)='') then begin ShowMessage('委托编号不能为空'); exit; end; if frm_data_share.t_crm_client_all.Locate('客户简称',t_op_seae_order.fieldbyname('委托单位').asstring,[]) then begin if frm_data_share.t_crm_client_all.fieldbyname('是否停用').AsBoolean then begin MessageDlg('此委托单位已停用,不能录入!',mtWarning,[mbok],0); exit; end; end; aadoQuery:=CreateAdoQuery; aadoQueryInsert:=CreateAdoQuery; with aadoQueryInsert do begin Close;sql.Clear; sql.Add('Insert into t_workflow_do ( W_ID ,WI_ID ,OR_ID ,是否最后一步 ,审核人 ,当前状态 ,顺序)'); sql.Add('values (:W_ID,:WI_ID,:OR_ID,:是否最后一步,:审核人,:当前状态,:顺序)'); end; with aadoQuery do try Close;sql.Clear; sql.Add('Select * from t_ch_fee_order'); sql.Add('where or_id=:or_id'); Parameters.ParamByName('or_id').Value:=t_op_seae_order.fieldbyname('or_id').AsInteger; Open;First; while not Eof do begin if (fieldbyname('费用名称').asstring='')or (fieldbyname('客户名称').asstring='')or (fieldbyname('币别').asstring='')or (fieldbyname('汇率').asfloat=0) or ((fieldbyname('币别').asstring='RMB') and (fieldbyname('汇率').asfloat<>1)) or ((fieldbyname('币别').asstring<>'RMB') and (fieldbyname('汇率').asfloat=1)) then begin showmessage('费用输入不完整不能提交!,请检查费用明细'); exit; end; Next; end; finally // Free; end; //运杂费 s:=''; if t_op_seae_order.fieldbyname('是否退佣').AsBoolean then begin with aadoQuery do try Close;sql.Clear; sql.Add('Select * from t_ch_fee_order'); sql.Add('where or_id=:or_id and 费用名称=''运杂费'' and 类型=''付'' '); Parameters.ParamByName('or_id').Value:=t_op_seae_order.fieldbyname('or_id').AsInteger; Open; if IsEmpty then begin if Trim(s)='' then s:='是否有运杂费选项为:是,但是费用信息中没有录入运杂费' else s:='是否有运杂费选项为:是,但是费用信息中没有录入运杂费'+#13#10+s; end; finally // Free; end; end else begin with aadoQuery do try Close;sql.Clear; sql.Add('Select * from t_ch_fee_order'); sql.Add('where or_id=:or_id and 费用名称=''运杂费'' and 类型=''付'' '); Parameters.ParamByName('or_id').Value:=t_op_seae_order.fieldbyname('or_id').AsInteger; Open; if not IsEmpty then begin if Trim(s)='' then s:='是否有运杂费选项为:否,但是费用信息中录入运杂费' else s:='是否有运杂费选项为:否,但是费用信息中录入运杂费'+#13#10+s;; end; finally // Free; end; end; // cif 海运费 if Pos('PREPAID',UpperCase(t_op_seae_order.fieldbyname('付费方式').asstring))>0 then begin with aadoQuery do try Close;sql.Clear; sql.Add('Select * from t_ch_fee_order'); sql.Add('where or_id=:or_id and 费用名称=''海运费'' and 类型=''收'' '); Parameters.ParamByName('or_id').Value:=t_op_seae_order.fieldbyname('or_id').AsInteger; Open; if IsEmpty then begin if Trim(s)='' then s:='预付货没有录入应收海运费' else s:='预付货没有录入应收海运费'+#13#10+s;; end; Close;sql.Clear; sql.Add('Select * from t_ch_fee_order'); sql.Add('where or_id=:or_id and 费用名称=''海运费'' and 类型=''付'' '); Parameters.ParamByName('or_id').Value:=t_op_seae_order.fieldbyname('or_id').AsInteger; Open; if IsEmpty then begin if Trim(s)='' then s:='预付货没有录入应付海运费' else s:='预付货没有录入应付海运费'+#13#10+s;; end; finally // Free; end; end else if Pos('COLLECT',UpperCase(t_op_seae_order.fieldbyname('付费方式').asstring))>0 then begin with aadoQuery do try Close;sql.Clear; sql.Add('Select * from t_ch_fee_order'); sql.Add('where or_id=:or_id and 费用名称=''操作费'' and 类型=''收'' '); Parameters.ParamByName('or_id').Value:=t_op_seae_order.fieldbyname('or_id').AsInteger; Open; if IsEmpty then begin if Trim(s)='' then s:='到付货没有录入应收操作费' else s:='到付货没有录入应收操作费'+#13#10+s;; end; Close;sql.Clear; sql.Add('Select * from t_ch_fee_order'); sql.Add('where or_id=:or_id and 费用名称=''操作费'' and 类型=''付'' '); Parameters.ParamByName('or_id').Value:=t_op_seae_order.fieldbyname('or_id').AsInteger; Open; if IsEmpty then begin if Trim(s)='' then s:='到付货没有录入应付操作费' else s:='到付货没有录入应付操作费'+#13#10+s;; end; finally // Free; end; end else if (Pos('HK',UpperCase(t_op_seae_order.fieldbyname('付费方式').asstring))>0) or (t_op_seae_order.fieldbyname('业务方式').AsString='离岸') then begin with aadoQuery do try Close;sql.Clear; sql.Add('Select * from t_ch_fee_order'); sql.Add('where or_id=:or_id and 费用名称 =''HK海运费'' and 类型=''收'' '); Parameters.ParamByName('or_id').Value:=t_op_seae_order.fieldbyname('or_id').AsInteger; Open; if IsEmpty then begin if Trim(s)='' then s:='离岸货没有录入应收HK海运费' else s:='离岸货没有录入应收HK海运费'+#13#10+s;; end; Close;sql.Clear; sql.Add('Select * from t_ch_fee_order'); sql.Add('where or_id=:or_id and 费用名称 =''HK手续费'' and 类型=''收'' '); Parameters.ParamByName('or_id').Value:=t_op_seae_order.fieldbyname('or_id').AsInteger; Open; if IsEmpty then begin if Trim(s)='' then s:='离岸货没有录入应收HK手续费' else s:='离岸货没有录入应收HK手续费'+#13#10+s;; end; Close;sql.Clear; sql.Add('Select * from t_ch_fee_order'); sql.Add('where or_id=:or_id and 费用名称 =''HK财务费'' and 类型=''收'' '); Parameters.ParamByName('or_id').Value:=t_op_seae_order.fieldbyname('or_id').AsInteger; Open; if IsEmpty then begin if Trim(s)='' then s:='离岸货没有录入应收HK财务费' else s:='离岸货没有录入应收HK财务费'+#13#10+s;; end; Close;sql.Clear; sql.Add('Select * from t_ch_fee_order'); sql.Add('where or_id=:or_id and 费用名称 =''HK海运费'' and 类型=''收'' '); Parameters.ParamByName('or_id').Value:=t_op_seae_order.fieldbyname('or_id').AsInteger; Open; if IsEmpty then begin if Trim(s)='' then s:='离岸货没有录入应收HK海运费' else s:='离岸货没有录入应收HK海运费'+#13#10+s;; end; Close;sql.Clear; sql.Add('Select * from t_ch_fee_order'); sql.Add('where or_id=:or_id and 费用名称 =''HK手续费'' and 类型=''付'' '); Parameters.ParamByName('or_id').Value:=t_op_seae_order.fieldbyname('or_id').AsInteger; Open; if IsEmpty then begin if Trim(s)='' then s:='离岸货没有录入应付HK手续费' else s:='离岸货没有录入应付HK手续费'+#13#10+s;; end; Close;sql.Clear; sql.Add('Select * from t_ch_fee_order'); sql.Add('where or_id=:or_id and 费用名称 =''HK财务费'' and 类型=''付'' '); Parameters.ParamByName('or_id').Value:=t_op_seae_order.fieldbyname('or_id').AsInteger; Open; if IsEmpty then begin if Trim(s)='' then s:='离岸货没有录入应付HK财务费' else s:='离岸货没有录入应付HK财务费'+#13#10+s;; end; finally // Free; end; end; if Trim(s)<>'' then begin ShowMessage(s); exit; end; /// 收付 { with aadoQuery do try Close;Sql.Clear; SQL.Add('select 费用名称,'); SQL.Add(' SUM(CASE 类型 WHEN ''收'' THEN (case 币别 when ''USD'' then 金额 else 0 end) ELSE 0 END ) as 应收USD'); SQL.Add(','); SQL.Add(' SUM(CASE 类型 WHEN ''收'' THEN (case 币别 when ''RMB'' then 金额 else 0 end) ELSE 0 END ) as 应收RMB'); SQL.Add(','); SQL.Add('SUM(CASE 类型 WHEN ''付'' THEN (case 币别 when ''USD'' then 金额 else 0 end) ELSE 0 END ) as 应付USD'); SQL.Add(','); SQL.Add(' SUM(CASE 类型 WHEN ''付'' THEN (case 币别 when ''RMB'' then 金额 else 0 end) ELSE 0 END ) as 应付RMB'); SQL.Add('from t_ch_fee_ORDER'); sql.Add('where or_id=:or_id'); SQL.Add('group by 费用名称'); Parameters.ParamByName('or_id').Value:=t_op_seae_order.fieldbyname('or_id').AsInteger; Open;First; while not eof do begin if ((FieldByName('应收USD').AsFloat-FieldByName('应付USD').AsFloat)<0) or ((FieldByName('应收RMB').AsFloat-FieldByName('应付RMB').AsFloat)<0) then begin if Trim(Reasons)='' then Reasons:=FieldByName('费用名称').AsString+' 应收减应付小于0,'+#13#10 else Reasons:=Reasons+FieldByName('费用名称').AsString+' 应收减应付小于0,'+#13#10 end; Next; end; if Trim(Reasons)<>'' then begin if MessageDlg(Reasons,mtWarning,[mbyes,mbno],0)<>mryes then EXIT; end; finally end; } with aadoQuery do try if t_op_seae_order.fieldbyname('是否退佣').AsBoolean then begin Close;sql.Clear; sql.Add('Select * from t_workflow'); sql.Add('where 付费方式=:付费方式 and 业务方式=:业务方式 and 有无杂费=:是否退佣'); Parameters.ParamByName('付费方式').Value:=t_op_seae_order.fieldbyname('付费方式').AsString; Parameters.ParamByName('业务方式').Value:=t_op_seae_order.fieldbyname('业务方式').AsString; Parameters.ParamByName('是否退佣').Value:=1; Open;First; if IsEmpty then begin ShowMessage('不存在审核路径不能提交,请联系管理员'); Exit; end else if recordcount>=2 then begin ShowMessage('存在两条以上审核路径不能提交,请联系管理员'); Exit; end else begin ID_WordFlow:=fieldbyname('W_ID').AsInteger; end; end else begin Close;sql.Clear; sql.Add('Select * from t_workflow'); sql.Add('where 付费方式=:付费方式 and 业务方式=:业务方式 and 有无杂费=:是否退佣 and 利润<:毛利润1 and 利润止>=:毛利润2'); Parameters.ParamByName('付费方式').Value:=t_op_seae_order.fieldbyname('付费方式').AsString; Parameters.ParamByName('业务方式').Value:=t_op_seae_order.fieldbyname('业务方式').AsString; Parameters.ParamByName('是否退佣').Value:=0; Parameters.ParamByName('毛利润1').Value:=t_op_seae_order.fieldbyname('毛利润').AsFloat; Parameters.ParamByName('毛利润2').Value:=t_op_seae_order.fieldbyname('毛利润').AsFloat; Open;First; if IsEmpty then begin ShowMessage('不存在审核路径不能提交,请联系管理员'); Exit; end else if recordcount>=2 then begin ShowMessage('存在两条以上审核路径不能提交,请联系管理员'); Exit; end else begin ID_WordFlow:=fieldbyname('W_ID').AsInteger; end; end; if MessageDlg('确实要提交吗?',mtWarning,[mbyes,mbno],0)<>mryes then Exit; try frm_main.db.BeginTrans; Close;sql.Clear; sql.Add('Select t_workflow_step.WI_ID,t_workflow_step.W_ID,t_workflow_step.顺序,t_workflow_step.步骤名称,t_workflow_step.是否最后一步,t_workflow_step_emp.姓名'); sql.Add('from t_workflow_step'); sql.Add('left join t_workflow_step_emp on t_workflow_step.WI_ID=t_workflow_step_emp.WI_ID'); sql.Add('where t_workflow_step.W_ID=:W_ID and 顺序=1'); Parameters.ParamByName('W_ID').Value:=ID_WordFlow; Open;First; while not Eof do begin aadoQueryInsert.Close; aadoQueryInsert.Parameters.ParamByName('W_ID').Value:=fieldbyname('W_ID').value; aadoQueryInsert.Parameters.ParamByName('WI_ID').Value:=fieldbyname('WI_ID').value; aadoQueryInsert.Parameters.ParamByName('OR_ID').Value:=t_op_seae_order.fieldbyname('OR_ID').value; aadoQueryInsert.Parameters.ParamByName('是否最后一步').Value:=fieldbyname('是否最后一步').value; aadoQueryInsert.Parameters.ParamByName('审核人').Value:=fieldbyname('姓名').value; aadoQueryInsert.Parameters.ParamByName('当前状态').Value:='审核中'; aadoQueryInsert.Parameters.ParamByName('顺序').Value:=fieldbyname('顺序').value; aadoQueryInsert.ExecSQL; Next; end; t_op_seae_order.edit; t_op_seae_order.FieldByName('状态').AsString:='提交审核'; t_op_seae_order.post; frm_main.db.CommitTrans; finally if frm_main.db.InTransaction then begin showmessage('提交审核失败!!'); end; end; Send_saleorder_shen('销售订舱提交审核,委托编号:'+t_op_seae_order.FieldByName('订舱编号').AsString,employee) finally Free; end; //// Send_saleorder_shen('销售订舱提交审核,委托编号:'+t_op_seae_order.FieldByName('订舱编号').AsString,employee); end; procedure Tfrm_op_seae_weituo_wf.bsSkinButton4Click(Sender: TObject); begin if not if_Edit_delete then begin ShowMessage('状态为:'+t_op_seae_order.FieldByName('状态').AsString+'不能操作'); Abort; end; table_delete(t_op_seae_order); end; procedure Tfrm_op_seae_weituo_wf.bsSkinButton3Click(Sender: TObject); begin table_cancel(t_op_seae_order); end; procedure Tfrm_op_seae_weituo_wf.bsSkinButton38Click(Sender: TObject); var book1:Tbookmark; begin book1:=t_op_seae_order.GetBookmark; t_op_seae_order.Requery; t_op_seae_order.GotoBookmark(book1); end; procedure Tfrm_op_seae_weituo_wf.FormShow(Sender: TObject); var str,str1:widestring; begin t_bz_balance.close; t_bz_balance.open; setconcolor; 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:=28; frm_sys_progress.bsSkinGauge1.MinValue:=0; frm_sys_progress.bsSkinGauge1.Value:=0; frm_sys_progress.Update; bsSkinPageControl1.ActivePageIndex:=0; t_op_seae_order.Close; t_op_seae_order.SQL.clear; t_op_seae_order.SQL.Add('select * from t_op_seae_order where (状态=''新建订舱'' or 状态=''驳回订舱'') and ' +open_data('0021','揽货人','录入人','no','no','no') +' order by 录入日期'); t_op_seae_order.open; t_op_seae_order.FieldByName('揽货人').OnChange:=t_billsalescharge; t_op_seae_order.FieldByName('默认揽货人').OnChange:=t_billsalescharge; t_ch_accept.Close; t_ch_accept.Open; t_ch_pay.Close; t_ch_pay.Open; t_billsalescharge(nil); loadreggrid(dxdbgrid1,false,caption); loadwwgrid(wwDBGrid1,'销售应收'); loadwwgrid(wwDBGrid2,'销售应付'); frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_sys_progress.close; frm_sys_progress:=nil; if strtobool(get_parameters_value(161,'true')) then bsSkinButton11.Caption:='提交审核' else bsSkinButton11.Caption:='确认订舱'; str:='where 客户性质<>'+''''+'目标'+''''; str:=str+'and 委托单位=1 '; t_crm_client_weituo.close; t_crm_client_weituo.sql.clear; t_crm_client_weituo.sql.add('select * from t_crm_client '+str+' order by 代码'); // t_crm_client_weituo.sql.add('select * from t_crm_client '+str+' and '+open_data('0008','录入人','揽货人','客服员','no','no')+' order by 代码'); t_crm_client_weituo.open; str:='where 客户性质<>'+''''+'目标'+''''; str:=str+'and (船公司=1 or 场站=1 or 车队=1 or 报关行=1 or 代理=1 or 货代=1 or 航空公司=1 or 其他客户=1 or 快递公司=1 or 国内代理=1 or 仓库=1)'; // str:=str+'and (委托单位<>1 or 委托单位 is null)'; if t_ch_accept.Active then begin t_ch_accept.FieldByName('客户名称').OnChange:=t_ch_acceptcrmcharge; t_ch_accept.FieldByName('不含税价').OnChange:=DatasetNOPricecharge; t_ch_accept.FieldByName('税率').OnChange:=DatasetNOPricecharge; t_ch_accept.FieldByName('金额').OnChange:=DatasetAmtcharge; t_ch_accept.FieldByName('财务税率').OnChange:=DatasetAmtcharge; t_ch_accept.FieldByName('单价').OnChange:=t_ch_acceptdjoncharge; t_ch_accept.FieldByName('数量').OnChange:=t_ch_acceptdjoncharge; TNumericField(t_ch_accept.FieldByName('税率')).DisplayFormat:='#.####"%";#.####"%";0'; TNumericField(t_ch_accept.FieldByName('税率')).EditFormat:=';;'; TNumericField(t_ch_accept.FieldByName('财务税率')).DisplayFormat:='#.####"%";#.####"%";0'; TNumericField(t_ch_accept.FieldByName('财务税率')).EditFormat:=';;'; t_ch_accept.FieldByName('佣金比例').OnChange:=t_ch_acceptdjoncharge; TNumericField(t_ch_accept.FieldByName('佣金比例')).DisplayFormat:='#,##0.00"%";-#,##0.00"%";#'; TNumericField(t_ch_accept.FieldByName('佣金比例')).EditFormat:='0.00;-0.00;0.00'; end; if t_ch_pay.Active then begin t_ch_pay.FieldByName('客户名称').OnChange:=t_ch_acceptcrmcharge; t_ch_pay.FieldByName('不含税价').OnChange:=DatasetNOPricecharge; t_ch_pay.FieldByName('税率').OnChange:=DatasetNOPricecharge; t_ch_pay.FieldByName('单价').OnChange:=t_ch_paydjoncharge; t_ch_pay.FieldByName('数量').OnChange:=t_ch_paydjoncharge; t_ch_pay.FieldByName('金额').OnChange:=DatasetAmtcharge; t_ch_pay.FieldByName('财务税率').OnChange:=DatasetAmtcharge; t_ch_pay.FieldByName('佣金比例').OnChange:=t_ch_paydjoncharge; TNumericField(t_ch_pay.FieldByName('佣金比例')).DisplayFormat:='#,##0.00"%";-#,##0.00"%";#'; TNumericField(t_ch_pay.FieldByName('佣金比例')).EditFormat:='0.00;-0.00;0.00'; TNumericField(t_ch_pay.FieldByName('税率')).DisplayFormat:='#.####"%";#.####"%";0'; TNumericField(t_ch_pay.FieldByName('税率')).EditFormat:=';;'; TNumericField(t_ch_pay.FieldByName('财务税率')).DisplayFormat:='#.####"%";#.####"%";0'; TNumericField(t_ch_pay.FieldByName('财务税率')).EditFormat:=';;'; end; if t_ch_accept.Active then begin wwDBGrid1.ColumnByName('财务税额').ReadOnly:=true; wwDBGrid1.ColumnByName('财务不含税价').ReadOnly:=true; wwDBGrid1.ColumnByName('税额').ReadOnly:=true; wwDBGrid1.ColumnByName('不含税金额').ReadOnly:=true; wwDBGrid1.ColumnByName('录入日期').ReadOnly:=true; wwDBGrid1.ColumnByName('录入人').ReadOnly:=true; end; if t_ch_pay.Active then begin wwDBGrid2.ColumnByName('财务税额').ReadOnly:=true; wwDBGrid2.ColumnByName('财务不含税价').ReadOnly:=true; wwDBGrid2.ColumnByName('税额').ReadOnly:=true; wwDBGrid2.ColumnByName('不含税金额').ReadOnly:=true; wwDBGrid2.ColumnByName('录入日期').ReadOnly:=true; wwDBGrid2.ColumnByName('录入人').ReadOnly:=true; end; end; procedure Tfrm_op_seae_weituo_wf.t_op_seae_orderBeforeCancel(DataSet: TDataSet); begin delete_no(t_op_seae_order); end; procedure Tfrm_op_seae_weituo_wf.t_op_seae_orderPostError(DataSet: TDataSet; E: EDatabaseError; var Action: TDataAction); var str:widestring; begin end; procedure Tfrm_op_seae_weituo_wf.bsSkinButton10Click(Sender: TObject); var str:string; begin str:=' and '+open_data('0021','揽货人','录入人','no','no','no'); if Edit1.text<>''then str:=str+' and 订舱编号 like '+''''+'%'+Edit1.text+'%'+''''; if wwDBComboBox44.text<>''then str:=str+' and 状态='+''''+wwDBComboBox44.text+''''; if RxDBLookupCombo2.DisplayValues[1]<>''then str:=str+' and 委托单位='+''''+RxDBLookupCombo2.DisplayValues[1]+''''; if RxDBLookupCombo3.DisplayValues[1]<>''then str:=str+' and 揽货人='+''''+RxDBLookupCombo3.DisplayValues[1]+''''; if RxDBLookupCombo11.DisplayValues[1]<>''then str:=str+' and 运费确认人='+''''+RxDBLookupCombo11.DisplayValues[1]+''''; if wwDBDateTimePicker1.text<>''then str:=str+' and 开船日期>='+''''+wwDBDateTimePicker1.text+''''; if wwDBDateTimePicker3.text<>''then str:=str+' and 开船日期<='+''''+wwDBDateTimePicker3.text+''''; if wwDBDateTimePicker5.text<>''then str:=str+' and 录入日期>='+''''+wwDBDateTimePicker5.text+''''; if wwDBDateTimePicker6.text<>''then str:=str+' and 录入日期<='+''''+wwDBDateTimePicker6.text+''''; if bsSkinCheckRadioBox1.Checked then str:=str+' and 状态<>''已退舱'''; t_op_seae_order.Close; t_op_seae_order.SQL.clear; t_op_seae_order.SQL.Add('select * from t_op_seae_order where 1=1 ' +str +' order by 录入日期'); t_op_seae_order.open; end; procedure Tfrm_op_seae_weituo_wf.t_op_seae_orderBeforePost(DataSet: TDataSet); begin table_before_post(t_op_seae_order,'录入日期'); table_before_post(t_op_seae_order,'委托单位'); table_before_post(t_op_seae_order,'揽货人'); table_before_post(t_op_seae_order,'付费方式'); table_before_post(t_op_seae_order,'录入日期'); table_before_post(t_op_seae_order,'装货港'); table_before_post(t_op_seae_order,'卸货港'); table_before_post(t_op_seae_order,'目的地'); table_before_post(t_op_seae_order,'运费确认人'); table_before_post(t_op_seae_order,'船公司'); table_before_post(t_op_seae_order,'业务方式'); table_before_post(t_op_seae_order,'业务来源'); table_before_post(t_op_seae_order,'开船日期'); if bsSkinDBCheckRadioBox1.Checked then begin table_before_post(t_op_seae_order,'报关行'); end; if bsSkinDBCheckRadioBox4.Checked then begin table_before_post(t_op_seae_order,'承运车队'); end; if t_op_seae_order.fieldbyname('业务方式').AsString='普通' then table_before_post(t_op_seae_order,'场站'); if t_op_seae_order.fieldbyname('业务方式').AsString='离岸' then begin if Pos('HK:',t_op_seae_order.fieldbyname('订舱编号').AsString)<=0 then begin ShowMessage('离岸业务的委托编号不存在HK,不能保存'); abort; end; end; if (t_op_seae_order.fieldbyname('业务方式').AsString='普通') or (t_op_seae_order.fieldbyname('业务方式').AsString='代派') then begin if Pos('HK:',t_op_seae_order.fieldbyname('订舱编号').AsString)>0 then begin ShowMessage('普通,代派 业务的委托编号存在HK,不能保存'); abort; end; end; if Trim(frm_data_share.t_sys_noset.fieldbyname('日期规则').Asstring)='业务日期' then begin if t_op_seae_order.FieldByName('订舱编号').IsNull or (trim(t_op_seae_order['订舱编号'])='') then t_op_seae_order['订舱编号']:=getwtno(1,subComp,department,employee,t_op_seae_order['开船日期']); end else begin if t_op_seae_order.FieldByName('订舱编号').IsNull or (trim(t_op_seae_order['订舱编号'])='') then t_op_seae_order['订舱编号']:=getwtno(1,subComp,department,employee,t_op_seae_order.fieldbyname('录入日期').AsDateTime); end; end; procedure Tfrm_op_seae_weituo_wf.t_op_seae_orderBeforeEdit(DataSet: TDataSet); begin if (t_op_seae_order.FieldByName('录入人').AsString<>employee) and (t_op_seae_order.FieldByName('揽货人').AsString<>employee) then begin MessageDlg('只有自己的业务才能修改和删除!',mtWarning,[mbyes],0); abort; end; if not if_Edit_delete then begin ShowMessage('状态为:'+t_op_seae_order.FieldByName('状态').AsString+'不能操作'); abort; end; if t_op_seae_order.FieldByName('状态').AsString='接受订舱' then begin MessageDlg('已接受订舱不能修改!',mtWarning,[mbyes],0); abort; end; if t_op_seae_order.FieldByName('状态').AsString='已退舱' then begin MessageDlg('已退舱不能修改!',mtWarning,[mbyes],0); abort; end; if t_op_seae_order.FieldByName('状态').AsString='审核通过' then begin MessageDlg('已退舱不能修改!',mtWarning,[mbyes],0); abort; end; if t_op_seae_order.State in [dsedit,dsinsert] then t_op_seae_order.post; end; procedure Tfrm_op_seae_weituo_wf.bsSkinButton15Click(Sender: TObject); begin Edit1.text:=''; wwDBComboBox44.text:=''; RxDBLookupCombo2.ClearValue; RxDBLookupCombo3.ClearValue; wwDBDateTimePicker1.text:=''; wwDBDateTimePicker3.text:=''; wwDBDateTimePicker5.text:=''; wwDBDateTimePicker6.text:=''; end; procedure Tfrm_op_seae_weituo_wf.DBEdit5Click(Sender: TObject); begin if t_op_seae_order.IsEmpty then exit; if (t_op_seae_order.State=dsinsert)then t_op_seae_order.post; try frm_opor_ctn:=tfrm_opor_ctn.Create (self); frm_opor_ctn.t_op_ctn.DataSource:=t_op_seae_order1; frm_opor_ctn_type:=true; frm_opor_ctn.ShowModal; finally frm_opor_ctn.Free; end; end; procedure Tfrm_op_seae_weituo_wf.dxDBGrid1DblClick(Sender: TObject); begin bsSkinPageControl1.ActivePageIndex:=1; end; procedure Tfrm_op_seae_weituo_wf.RxDBLookupCombo12Change(Sender: TObject); begin if RxDBLookupCombo12.DisplayValue='' then exit; if frm_data_share.t_sys_employee.locate('姓名',RxDBLookupCombo12.DisplayValue,[]) then t_op_seae_order['销售部门']:=frm_data_share.t_sys_employee['部门名称']; end; procedure Tfrm_op_seae_weituo_wf.RxDBLookupCombo1Enter(Sender: TObject); begin RxLookupComboEnter_All(RxDBLookupCombo1); end; procedure Tfrm_op_seae_weituo_wf.RxDBLookupCombo8Enter(Sender: TObject); begin RxLookupComboEnter(RxDBLookupCombo8); end; procedure Tfrm_op_seae_weituo_wf.RxDBLookupCombo1Exit(Sender: TObject); begin RxLookupComboExit(RxDBLookupCombo1); end; procedure Tfrm_op_seae_weituo_wf.RxDBLookupCombo8Exit(Sender: TObject); begin RxLookupComboExit(RxDBLookupCombo8); end; procedure Tfrm_op_seae_weituo_wf.RxDBLookupCombo4Change(Sender: TObject); begin if (t_op_seae_order.State=dsinsert)or(t_op_seae_order.State=dsedit)then begin if RxDBLookupCombo4.DisplayValue<>'' then t_op_seae_order['发货人代码']:=frm_data_share.t_crm_client_shiper.fieldbyname('快捷代码').asstring; end; end; procedure Tfrm_op_seae_weituo_wf.RxDBLookupCombo5Change(Sender: TObject); begin if (t_op_seae_order.State=dsinsert)or(t_op_seae_order.State=dsedit)then begin if RxDBLookupCombo5.DisplayValue<>'' then t_op_seae_order['收货人代码']:=frm_data_share.t_crm_client_shouhuo.fieldbyname('快捷代码').asstring; end; end; procedure Tfrm_op_seae_weituo_wf.RxDBLookupCombo6Change(Sender: TObject); begin if (t_op_seae_order.State=dsinsert)or(t_op_seae_order.State=dsedit)then begin if RxDBLookupCombo6.DisplayValue<>'' then t_op_seae_order['通知人代码']:=frm_data_share.t_crm_client_tongzhi.fieldbyname('快捷代码').asstring; end; end; procedure Tfrm_op_seae_weituo_wf.DBMemo40Change(Sender: TObject); begin if (t_op_seae_order.state=dsedit)or(t_op_seae_order.state=dsinsert)then begin t_op_seae_order['件数']:=total_num(DBMemo40); t_op_seae_order['包装']:=total_package(dbmemo40); t_op_seae_order['件数大写'] :='SAY:'+ntoc(t_op_seae_order.FieldByName('件数').asfloat,true) +t_op_seae_order.FieldByName('包装').asstring+' ONLY.'; end; end; procedure Tfrm_op_seae_weituo_wf.DBMemo41Change(Sender: TObject); begin if (t_op_seae_order.state=dsedit)or(t_op_seae_order.state=dsinsert)then begin t_op_seae_order['重量']:=total_num(DBMemo41); end; end; procedure Tfrm_op_seae_weituo_wf.DBMemo42Change(Sender: TObject); begin if (t_op_seae_order.state=dsedit)or(t_op_seae_order.state=dsinsert)then begin t_op_seae_order['尺码']:=total_num(DBMemo42); end; end; procedure Tfrm_op_seae_weituo_wf.wwDBLookupCombo6Change(Sender: TObject); begin if frm_data_share.t_code_code.locate('代码',wwDBLookupCombo6.text,[]) then begin t_op_seae_order.edit; t_op_seae_order['发货人代码']:=frm_data_share.t_code_code.fieldbyname('内容').asstring; end; end; procedure Tfrm_op_seae_weituo_wf.wwDBLookupCombo7Change(Sender: TObject); begin if frm_data_share.t_code_code.locate('代码',wwDBLookupCombo7.text,[]) then begin t_op_seae_order.edit; t_op_seae_order['收货人代码']:=frm_data_share.t_code_code.fieldbyname('内容').asstring; end; end; procedure Tfrm_op_seae_weituo_wf.wwDBLookupCombo8Change(Sender: TObject); begin if frm_data_share.t_code_code.locate('代码',wwDBLookupCombo8.text,[]) then begin t_op_seae_order.edit; t_op_seae_order['通知人代码']:=frm_data_share.t_code_code.fieldbyname('内容').asstring; end; end; procedure Tfrm_op_seae_weituo_wf.wwDBLookupCombo6Exit(Sender: TObject); begin wwDBLookupCombo6.Clear; end; procedure Tfrm_op_seae_weituo_wf.wwDBLookupCombo7Exit(Sender: TObject); begin wwDBLookupCombo7.Clear; end; procedure Tfrm_op_seae_weituo_wf.wwDBLookupCombo8Exit(Sender: TObject); begin wwDBLookupCombo8.Clear; end; procedure Tfrm_op_seae_weituo_wf.N1Click(Sender: TObject); begin t_op_seae_order.Insert; t_op_seae_order['揽货人']:=employee; t_op_seae_order['录入人']:=employee; t_op_seae_order['录入日期']:=date; t_op_seae_order['销售部门']:=department; t_op_seae_order['状态']:='新建订舱'; t_op_seae_order['装运方式']:='整箱'; t_op_seae_order['报关服务']:=0; t_op_seae_order['报验服务']:=0; t_op_seae_order['拖车服务']:=0; t_op_seae_order['接货服务']:=0; t_op_seae_order['分单']:=0; t_op_seae_order['代理']:=0; t_op_seae_order['请求派车']:=0; t_op_seae_order['是否退佣']:=0; t_op_seae_order['是否美金结算']:=0; t_op_seae_order['箱型1']:=0; t_op_seae_order['箱型2']:=0; t_op_seae_order['箱型3']:=0; t_op_seae_order['箱型4']:=0; t_op_seae_order['箱型5']:=0; t_op_seae_order['箱型6']:=0; t_op_seae_order['箱型7']:=0; t_op_seae_order['箱型8']:=0; t_op_seae_order['箱型9']:=0; t_op_seae_order['箱型10']:=0; t_op_seae_order['其他箱型']:=0; t_op_seae_order['箱TEU']:=0; t_op_seae_order['集装箱']:=''; t_op_seae_order['箱数大写']:=''; t_op_seae_order['报检操作']:=''; t_op_seae_order['装货港']:=get_parameters_value(14,'QINGDAO,CHINA'); t_op_seae_order['原始编号']:=''; bsSkinPageControl1.ActivePageIndex:=1; end; procedure Tfrm_op_seae_weituo_wf.bsSkinButton1Click(Sender: TObject); var Pnt:Tpoint; begin if t_op_seae_order.State in [dsedit,dsinsert] then t_op_seae_order.post; Pnt:=bsSkinButton1.ClientToScreen(Point(0,bsSkinButton1.Height)); PopupMenu1.Popup(Pnt.x,Pnt.y); end; procedure Tfrm_op_seae_weituo_wf.N3Click(Sender: TObject); var afield,afieldfee : variant; aOR_ID:integer; aQuery:TAdoQuery; i:integer; s:string; Boolean_Ctn:Boolean; begin if t_op_seae_order.IsEmpty then begin exit; MessageDlg('没有复制的信息,不能复制添加!',mtWarning,[mbok],0); end; Boolean_Ctn:=false; afield := vararraycreate([0,t_op_seae_order.fieldcount-1],varvariant); for i := 0 to (t_op_seae_order.fieldcount-1) do begin afield[i] :=t_op_seae_order.fields[i].value ; end; aOR_ID:=t_op_seae_order.fieldbyname('OR_ID').AsInteger; s:=t_op_seae_order.fieldbyname('集装箱').AsString; t_op_seae_order.append; for i := 0 to (t_op_seae_order.fieldcount-1) do begin if t_op_seae_order.fields[i].FieldName<>'OR_ID' then t_op_seae_order.fields[i].value := afield[i] ; end; t_op_seae_order.fieldbyname('揽货人').Value:=employee; t_op_seae_order.fieldbyname('录入人').Value:=employee; t_op_seae_order.fieldbyname('录入日期').Value:=date; t_op_seae_order.fieldbyname('开船日期').Value:=null; t_op_seae_order.fieldbyname('海运费').Value:=0; t_op_seae_order.fieldbyname('销售部门').Value:=department; t_op_seae_order.fieldbyname('状态').Value:='新建订舱'; t_op_seae_order.fieldbyname('驳回原因').Value:=''; t_op_seae_order.fieldbyname('驳回原因').Value:=''; t_op_seae_order.fieldbyname('订舱编号').Value:=''; t_op_seae_order.fieldbyname('状态').Value:='新建订舱'; t_op_seae_order.fieldbyname('编号').Value:=''; t_op_seae_order.fieldbyname('业务编号').Value:=''; t_op_seae_order.fieldbyname('提交人').Value:=''; t_op_seae_order.fieldbyname('提交时间').Value:=null; t_op_seae_order.fieldbyname('审核人').Value:=''; t_op_seae_order.fieldbyname('审核时间').Value:=null; t_op_seae_order.fieldbyname('主提单号').Value:=''; t_op_seae_order.fieldbyname('复核人').Value:=''; t_op_seae_order.fieldbyname('复核时间').Value:=null; t_op_seae_order.fieldbyname('原始编号').Value:=''; t_op_seae_order.fieldbyname('集装箱').Value:=s; t_op_seae_order.fieldbyname('报检操作').Value:=''; t_op_seae_order.fieldbyname('海运费').Value:=0; t_op_seae_order.fieldbyname('毛利润').Value:=0; t_op_seae_order.fieldbyname('利润率').Value:=''; t_op_seae_order.fieldbyname('船公司').Value:=''; t_op_seae_order.fieldbyname('场站').Value:=''; t_op_seae_order.fieldbyname('默认场站').Value:=''; // t_op_seae_order.Post; bsSkinPageControl1.ActivePageIndex:=1; { aQuery:=CreateAdoQuery; try with aQuery do begin close;sql.clear; sql.Add('select * from t_opor_ctn where OR_ID='+inttostr(aOR_ID)); open; if not t_op_ctn.active then t_op_ctn.Open; first; while not eof do begin Boolean_Ctn:=true; t_op_ctn.Insert; t_op_ctn.fieldbyname('代码').AsString:=aQuery.fieldbyname('代码').AsString; t_op_ctn.fieldbyname('尺寸').AsString:=aQuery.fieldbyname('尺寸').AsString; t_op_ctn.fieldbyname('箱型').AsString:=aQuery.fieldbyname('箱型').AsString; t_op_ctn.fieldbyname('数量').Asinteger:=aQuery.fieldbyname('数量').Asinteger; t_op_ctn.fieldbyname('TEU').Asinteger:=aQuery.fieldbyname('TEU').Asinteger; t_op_ctn.fieldbyname('件数').Asinteger:=aQuery.fieldbyname('件数').Asinteger; t_op_ctn.fieldbyname('重量').Asfloat:=aQuery.fieldbyname('重量').Asfloat; t_op_ctn.fieldbyname('尺码').Asfloat:=aQuery.fieldbyname('尺码').Asfloat; t_op_ctn.fieldbyname('表现形式').AsString:=aQuery.fieldbyname('表现形式').AsString; t_op_ctn.fieldbyname('箱号').AsString:=aQuery.fieldbyname('箱号').AsString; t_op_ctn.fieldbyname('封号').AsString:=aQuery.fieldbyname('封号').AsString; t_op_ctn.fieldbyname('包装').AsString:=aQuery.fieldbyname('包装').AsString; t_op_ctn.fieldbyname('品名').AsString:=aQuery.fieldbyname('品名').AsString; t_op_ctn.fieldbyname('唛头').AsString:=aQuery.fieldbyname('唛头').AsString; t_op_ctn.fieldbyname('备注').AsString:=aQuery.fieldbyname('备注').AsString; t_op_ctn.Post; next; end; end; finally freeandnil(aQuery); end; } // t_op_seae_order.Edit; // t_op_seae_order['开船日期']:=null; t_op_seae_order['状态']:='新建订舱'; t_op_seae_order['编号']:=''; t_op_seae_order['业务编号']:=''; t_op_seae_order['提交人']:=''; t_op_seae_order['提交时间']:=null; t_op_seae_order['审核人']:=''; t_op_seae_order['审核时间']:=null; t_op_seae_order['主提单号']:=''; if not Boolean_Ctn then t_op_seae_order['集装箱']:=''; // t_op_seae_order['集装箱']:=s; // t_op_seae_order.post; end; procedure Tfrm_op_seae_weituo_wf.N10Click(Sender: TObject); begin update_grid_view_no(dxdbgrid1); end; procedure Tfrm_op_seae_weituo_wf.N16Click(Sender: TObject); begin grid_save_xls(dxdbgrid1); end; procedure Tfrm_op_seae_weituo_wf.N14Click(Sender: TObject); begin update_grid_view_all(dxdbgrid1); end; procedure Tfrm_op_seae_weituo_wf.N12Click(Sender: TObject); begin update_grid(dxdbgrid1,209); end; procedure Tfrm_op_seae_weituo_wf.RxDBLookupCombo1Change(Sender: TObject); begin if t_op_seae_order.State in [dsedit,dsinsert] then begin if frm_data_share.t_crm_client_weituo.Locate('客户简称',RxDBLookupCombo1.DisplayValues[1],[])then begin if frm_data_share.t_crm_client_weituo.fieldbyname('揽货人').asstring<>''then begin t_op_seae_order['揽货人']:=frm_data_share.t_crm_client_weituo.fieldbyname('揽货人').asstring; end else t_op_seae_order['揽货人']:=''; end; end; end; procedure Tfrm_op_seae_weituo_wf.t_billsalescharge(Sender: TField); begin end; procedure Tfrm_op_seae_weituo_wf.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin table_post(t_op_seae_order); end; procedure Tfrm_op_seae_weituo_wf.dxDBGrid1Column9CustomDraw(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[dxDBGrid1Column9.Index]='驳回订舱' then AColor:=clRed; if ANode.Strings[dxDBGrid1Column9.Index]='审核通过' then AColor:=clYellow; if ANode.Strings[dxDBGrid1Column9.Index]='接受订舱' then AColor:=clGreen; AFont.Color:=clblack; end; procedure Tfrm_op_seae_weituo_wf.dxDBGrid1CustomDraw(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 trim(ANode.Strings[dxDBGrid1Column9.Index])='已退舱' then begin AFont.Style:=AFont.Style+[fsStrikeOut]; AFont.Color:=clred; end; if trim(ANode.Strings[dxDBGrid1Column9.Index])='已推航次' then begin // AFont.Style:=AFont.Style+[fsStrikeOut]; AColor:=clFuchsia; end; if trim(ANode.Strings[dxDBGrid1Column9.Index])='已改港' then begin // AFont.Style:=AFont.Style+[fsStrikeOut]; AColor:=clYellow; end; end; procedure Tfrm_op_seae_weituo_wf.wwDBLookupCombo52Change(Sender: TObject); begin if t_op_seae_order1.DataSet=nil then exit; if (t_op_seae_order1.DataSet.state=dsedit)or(t_op_seae_order1.DataSet.state=dsinsert)then begin if frm_data_share.t_code_disport.Locate('英文名',wwDBLookupCombo52.text,[]) then begin t_op_seae_order1.DataSet['目的地']:=wwDBLookupCombo52.text; end; end; end; procedure Tfrm_op_seae_weituo_wf.bsSkinButton21Click(Sender: TObject); begin frm_main.view_momo(t_op_seae_order1,'备注'); end; procedure Tfrm_op_seae_weituo_wf.wwDBLookupCombo1Change(Sender: TObject); begin //费用名称更改 if (t_ch_accept.state=dsinsert)or(t_ch_accept.state=dsedit) then begin if not frm_data_share.t_code_fee.IsEmpty then if frm_data_share.t_code_fee.locate('代码',wwDBLookupCombo1.text,[]) then begin t_ch_accept['币别']:=frm_data_share.t_code_fee.fieldbyname('默认币别').asstring; t_ch_accept['标准']:=frm_data_share.t_code_fee.fieldbyname('标准').asstring; t_ch_accept['费用英文名称']:=frm_data_share.t_code_fee.fieldbyname('英文名').asstring; end; end; end; procedure Tfrm_op_seae_weituo_wf.wwDBLookupCombo1KeyPress(Sender: TObject; var Key: Char); begin //应收费用名称更改 if key=#13 then begin if (t_ch_accept.state=dsinsert)or(t_ch_accept.state=dsedit) then begin if t_ch_accept.FieldByName('费用名称').asstring<>t_ch_accept.FieldByName('费用名称').OldValue then begin if not frm_data_share.t_code_fee.IsEmpty then if frm_data_share.t_code_fee.locate('中文名',t_ch_accept.FieldByName('费用名称').asstring,[]) then begin t_ch_accept['币别']:=frm_data_share.t_code_fee.fieldbyname('默认币别').asstring; t_ch_accept['标准']:=frm_data_share.t_code_fee.fieldbyname('标准').asstring; end; end; end; end; end; procedure Tfrm_op_seae_weituo_wf.wwDBLookupCombo5Exit(Sender: TObject); begin if t_ch_accept.FieldByName('结算单位').asstring<>''then begin if (t_ch_accept.FieldByName('结算单位').asstring='订舱代理') or (t_ch_accept.FieldByName('结算单位').asstring='卸货代理') then begin frm_data_share.t_crm_client.Filtered:=false; frm_data_share.t_crm_client.Filter:='货代=1'; frm_data_share.t_crm_client.Filtered:=true; end else begin frm_data_share.t_crm_client.Filtered:=false; frm_data_share.t_crm_client.Filter:=t_ch_accept.FieldByName('结算单位').asstring+'=1'; frm_data_share.t_crm_client.Filtered:=true; end; end else begin frm_data_share.t_crm_client.Filtered:=false; end; end; procedure Tfrm_op_seae_weituo_wf.wwDBLookupCombo3Change(Sender: TObject); begin //币别更改 if (t_ch_accept.state=dsinsert)or(t_ch_accept.state=dsedit) then begin IF frm_data_share.t_code_currency.Locate('币别',wwDBLookupCombo3.text,[])THEN begin if wwDBLookupCombo3.text='USD' then begin if strtobool(get_parameters_value(145,'true')) then begin if not strtobool(get_parameters_value(184,'true')) then begin t_ch_accept['汇率']:=getUsdExRate(t_ch_accept.datasource.dataset.fieldbyname('开船日期').asstring,wwDBLookupCombo3.text) end else begin t_ch_accept['汇率']:=getUsdExRate(t_ch_accept.datasource.dataset.fieldbyname('开船日期').asstring,wwDBLookupCombo3.text) end; end else begin t_ch_accept['汇率']:=getUsdExRate(t_ch_accept.datasource.dataset.fieldbyname('会计期间').asstring,wwDBLookupCombo3.text) end; end else t_ch_accept['汇率']:=frm_data_share.t_code_currency.fieldbyname('汇率').asfloat; end; end; end; procedure Tfrm_op_seae_weituo_wf.wwDBLookupCombo3KeyPress(Sender: TObject; var Key: Char); begin if key=#13 then begin //币别 if (t_ch_accept.state=dsinsert)or(t_ch_accept.state=dsedit) then begin IF frm_data_share.t_code_currency.Locate('币别',wwDBLookupCombo10.text,[])THEN begin if wwDBLookupCombo3.text='USD' then begin if strtobool(get_parameters_value(145,'true')) then begin if not strtobool(get_parameters_value(184,'true')) then begin t_ch_accept['汇率']:=getUsdExRate(t_ch_accept.datasource.dataset.fieldbyname('开船日期').asstring,wwDBLookupCombo3.text) end else begin if t_ch_accept.datasource.dataset.fieldbyname('业务类型').asstring='普通货' then begin t_ch_accept['汇率']:=getUsdExRate(t_ch_accept.datasource.dataset.fieldbyname('开船日期').asstring,wwDBLookupCombo3.text) end else begin t_ch_accept['汇率']:=getUsdExRate(t_ch_accept.datasource.dataset.fieldbyname('会计期间').asstring,wwDBLookupCombo3.text) end; end; end else begin t_ch_accept['汇率']:=getUsdExRate(t_ch_accept.datasource.dataset.fieldbyname('会计期间').asstring,wwDBLookupCombo3.text) end; end else t_ch_accept['汇率']:=frm_data_share.t_code_currency.fieldbyname('汇率').asfloat; end; end; end; end; procedure Tfrm_op_seae_weituo_wf.t_ch_acceptAfterInsert(DataSet: TDataSet); begin //应收新增费用 t_ch_accept['OR_ID']:=t_ch_accept.DataSource.DataSet['OR_ID']; t_ch_accept['类型']:='收'; t_ch_accept['费用状态']:='录入状态'; t_ch_accept['客户名称']:=''; t_ch_accept['结算金额']:=0; t_ch_accept['不含税价']:=0; t_ch_accept['税率']:=0; t_ch_accept['税额']:=0; t_ch_accept['不含税金额']:=0; t_ch_accept['财务税率']:=0; t_ch_accept['财务税额']:=0; t_ch_accept['财务不含税价']:=0; t_ch_accept['金额']:=0; t_ch_accept['开票金额']:=0; t_ch_accept['冲抵金额']:=0; t_ch_accept['申请金额']:=0; t_ch_accept['申请开票']:=0; t_ch_accept['录入日期']:=now; t_ch_accept['录入人']:=employee; t_ch_accept['是否对帐']:=0; t_ch_accept['是否垫付']:=0; t_ch_accept['不开发票']:=0; t_ch_accept['预提成本']:=0; t_ch_accept['冲抵成本']:=0; t_ch_accept['客户名称']:=t_ch_accept.DataSource.DataSet.fieldbyname('委托单位').AsString; t_ch_accept['顺序']:=t_ch_accept.RecordCount+1; t_ch_accept['机密']:=0; t_ch_accept.FieldByName('费用名称').FocusControl; end; procedure Tfrm_op_seae_weituo_wf.t_ch_acceptBeforePost(DataSet: TDataSet); begin try t_ch_accept.FieldByName('金额').OnChange:=nil; if (t_ch_accept.fieldbyname('单价').asfloat<>0) and (t_ch_accept.fieldbyname('数量').asfloat<>0)then begin if (t_ch_accept.fieldbyname('佣金比例').asfloat<>0) then t_ch_accept['金额']:=s_w(strtoint(apointnum),t_ch_accept.fieldbyname('单价').asfloat*t_ch_accept.fieldbyname('数量').asfloat*(1-t_ch_accept.fieldbyname('佣金比例').asfloat/100)) else t_ch_accept['金额']:=s_w(strtoint(apointnum),t_ch_accept.fieldbyname('单价').asfloat*t_ch_accept.fieldbyname('数量').asfloat); end; t_ch_accept['金额']:=s_w(strtoint(apointnum),t_ch_accept['金额']); DataSet.fieldbyname('税额').asfloat:=s_w(strtoint(apointnum),DataSet.fieldbyname('金额').asfloat/(1+DataSet.fieldbyname('税率').asfloat/100)*DataSet.fieldbyname('税率').asfloat/100); DataSet.fieldbyname('不含税金额').asfloat:=s_w(strtoint(apointnum),DataSet.fieldbyname('金额').asfloat-DataSet.fieldbyname('税额').asfloat); DataSet.fieldbyname('财务税额').asfloat:=s_w(strtoint(apointnum),DataSet.fieldbyname('金额').asfloat/(1+DataSet.fieldbyname('财务税率').asfloat/100)*DataSet.fieldbyname('财务税率').asfloat/100); DataSet.fieldbyname('财务不含税价').asfloat:=s_w(strtoint(apointnum),DataSet.fieldbyname('金额').asfloat-DataSet.fieldbyname('财务税额').asfloat); finally // t_ch_accept.FieldByName('金额').OnChange:=DatasetAmtcharge; end; if t_ch_accept.fieldbyname('币别').asstring<>'' then begin IF not frm_data_share.t_code_currency.Locate('币别',t_ch_accept.fieldbyname('币别').asstring,[])THEN begin showmessage('对不起,费用币别不正确!'); abort; end else begin if not strtobool(get_parameters_value(38,'true')) then begin if t_ch_accept.FieldByName('币别').AsString<>'RMB' then begin if strtobool(get_parameters_value(145,'true')) then begin if not strtobool(get_parameters_value(184,'true')) then begin t_ch_accept['汇率']:=getUsdExRate(t_ch_accept.datasource.dataset.fieldbyname('开船日期').asstring,t_ch_accept.FieldByName('币别').AsString) end else begin t_ch_accept['汇率']:=getUsdExRate(t_ch_accept.datasource.dataset.fieldbyname('开船日期').asstring,t_ch_accept.FieldByName('币别').AsString) end; end else begin t_ch_accept['汇率']:=getUsdExRate(t_ch_accept.datasource.dataset.fieldbyname('开船日期').asstring,t_ch_accept.FieldByName('币别').AsString) end; end else t_ch_accept['汇率']:=frm_data_share.t_code_currency.fieldbyname('汇率').asfloat; end; end; end; end; procedure Tfrm_op_seae_weituo_wf.bsSkinButton8Click(Sender: TObject); begin if t_op_seae_order.State in [dsedit,dsinsert] then t_op_seae_order.post; t_ch_accept.Append; end; procedure Tfrm_op_seae_weituo_wf.bsSkinButton12Click(Sender: TObject); begin if t_ch_accept.IsEmpty then exit; table_post(t_ch_accept); end; procedure Tfrm_op_seae_weituo_wf.bsSkinButton13Click(Sender: TObject); begin t_ch_accept.delete; end; procedure Tfrm_op_seae_weituo_wf.bsSkinButton14Click(Sender: TObject); begin table_cancel(t_ch_accept); end; procedure Tfrm_op_seae_weituo_wf.wwDBLookupCombo4Change(Sender: TObject); begin //费用名称更改 if (t_ch_pay.state=dsinsert)or(t_ch_pay.state=dsedit) then begin if not frm_data_share.t_code_fee.IsEmpty then if frm_data_share.t_code_fee.locate('代码',wwDBLookupCombo4.text,[]) then begin t_ch_pay['币别']:=frm_data_share.t_code_fee.fieldbyname('默认币别').asstring; t_ch_pay['标准']:=frm_data_share.t_code_fee.fieldbyname('标准').asstring; t_ch_pay['费用英文名称']:=frm_data_share.t_code_fee.fieldbyname('英文名').asstring; end; end; end; procedure Tfrm_op_seae_weituo_wf.wwDBLookupCombo4KeyPress(Sender: TObject; var Key: Char); begin //应收费用名称更改 if key=#13 then begin if (t_ch_pay.state=dsinsert)or(t_ch_pay.state=dsedit) then begin if t_ch_pay.FieldByName('费用名称').asstring<>t_ch_pay.FieldByName('费用名称').OldValue then begin if not frm_data_share.t_code_fee.IsEmpty then if frm_data_share.t_code_fee.locate('中文名',t_ch_pay.FieldByName('费用名称').asstring,[]) then begin t_ch_pay['币别']:=frm_data_share.t_code_fee.fieldbyname('默认币别').asstring; t_ch_pay['标准']:=frm_data_share.t_code_fee.fieldbyname('标准').asstring; end; end; end; end; end; procedure Tfrm_op_seae_weituo_wf.wwDBLookupCombo14Change(Sender: TObject); begin //币别更改 if (t_ch_pay.state=dsinsert)or(t_ch_pay.state=dsedit) then begin IF frm_data_share.t_code_currency.Locate('币别',wwDBLookupCombo3.text,[])THEN begin if wwDBLookupCombo14.text='USD' then begin if strtobool(get_parameters_value(145,'true')) then begin if not strtobool(get_parameters_value(184,'true')) then begin t_ch_pay['汇率']:=getUsdExRate(t_ch_pay.datasource.dataset.fieldbyname('开船日期').asstring,wwDBLookupCombo14.text) end else begin t_ch_pay['汇率']:=getUsdExRate(t_ch_pay.datasource.dataset.fieldbyname('开船日期').asstring,wwDBLookupCombo14.text) end; end else begin t_ch_pay['汇率']:=getUsdExRate(t_ch_pay.datasource.dataset.fieldbyname('会计期间').asstring,wwDBLookupCombo14.text) end; end else t_ch_pay['汇率']:=frm_data_share.t_code_currency.fieldbyname('汇率').asfloat; end; end; end; procedure Tfrm_op_seae_weituo_wf.wwDBLookupCombo14KeyPress(Sender: TObject; var Key: Char); begin if key=#13 then begin //币别 if (t_ch_pay.state=dsinsert)or(t_ch_pay.state=dsedit) then begin IF frm_data_share.t_code_currency.Locate('币别',wwDBLookupCombo14.text,[])THEN begin if wwDBLookupCombo3.text='USD' then begin if strtobool(get_parameters_value(145,'true')) then begin if not strtobool(get_parameters_value(184,'true')) then begin t_ch_pay['汇率']:=getUsdExRate(t_ch_pay.datasource.dataset.fieldbyname('开船日期').asstring,wwDBLookupCombo14.text) end else begin if t_ch_pay.datasource.dataset.fieldbyname('业务类型').asstring='普通货' then begin t_ch_pay['汇率']:=getUsdExRate(t_ch_pay.datasource.dataset.fieldbyname('开船日期').asstring,wwDBLookupCombo14.text) end else begin t_ch_pay['汇率']:=getUsdExRate(t_ch_pay.datasource.dataset.fieldbyname('会计期间').asstring,wwDBLookupCombo14.text) end; end; end else begin t_ch_pay['汇率']:=getUsdExRate(t_ch_pay.datasource.dataset.fieldbyname('会计期间').asstring,wwDBLookupCombo14.text) end; end else t_ch_pay['汇率']:=frm_data_share.t_code_currency.fieldbyname('汇率').asfloat; end; end; end; end; procedure Tfrm_op_seae_weituo_wf.t_ch_payAfterInsert(DataSet: TDataSet); begin //应收新增费用 DataSet['OR_ID']:=DataSet.DataSource.DataSet['OR_ID']; DataSet['类型']:='付'; DataSet['费用状态']:='录入状态'; DataSet['客户名称']:=''; DataSet['结算金额']:=0; DataSet['不含税价']:=0; DataSet['税率']:=0; DataSet['税额']:=0; DataSet['不含税金额']:=0; DataSet['财务税率']:=0; DataSet['财务税额']:=0; DataSet['财务不含税价']:=0; DataSet['金额']:=0; DataSet['开票金额']:=0; DataSet['冲抵金额']:=0; DataSet['申请金额']:=0; DataSet['申请开票']:=0; DataSet['录入日期']:=now; DataSet['录入人']:=employee; DataSet['是否对帐']:=0; DataSet['是否垫付']:=0; DataSet['不开发票']:=0; DataSet['预提成本']:=0; DataSet['冲抵成本']:=0; DataSet['结算单位']:=''; DataSet['顺序']:=DataSet.RecordCount+1; DataSet['机密']:=0; DataSet.FieldByName('费用名称').FocusControl; end; procedure Tfrm_op_seae_weituo_wf.t_ch_payBeforePost(DataSet: TDataSet); begin try DataSet.FieldByName('金额').OnChange:=nil; if (DataSet.fieldbyname('单价').asfloat<>0) and (DataSet.fieldbyname('数量').asfloat<>0)then begin if (DataSet.fieldbyname('佣金比例').asfloat<>0) then DataSet['金额']:=s_w(strtoint(apointnum),DataSet.fieldbyname('单价').asfloat*DataSet.fieldbyname('数量').asfloat*(1-DataSet.fieldbyname('佣金比例').asfloat/100)) else DataSet['金额']:=s_w(strtoint(apointnum),DataSet.fieldbyname('单价').asfloat*DataSet.fieldbyname('数量').asfloat); end; DataSet['金额']:=s_w(strtoint(apointnum),DataSet['金额']); DataSet.fieldbyname('税额').asfloat:=s_w(strtoint(apointnum),DataSet.fieldbyname('金额').asfloat/(1+DataSet.fieldbyname('税率').asfloat/100)*DataSet.fieldbyname('税率').asfloat/100); DataSet.fieldbyname('不含税金额').asfloat:=s_w(strtoint(apointnum),DataSet.fieldbyname('金额').asfloat-DataSet.fieldbyname('税额').asfloat); DataSet.fieldbyname('财务税额').asfloat:=s_w(strtoint(apointnum),DataSet.fieldbyname('金额').asfloat/(1+DataSet.fieldbyname('财务税率').asfloat/100)*DataSet.fieldbyname('财务税率').asfloat/100); DataSet.fieldbyname('财务不含税价').asfloat:=s_w(strtoint(apointnum),DataSet.fieldbyname('金额').asfloat-DataSet.fieldbyname('财务税额').asfloat); finally // t_ch_accept.FieldByName('金额').OnChange:=DatasetAmtcharge; end; if DataSet.fieldbyname('币别').asstring<>'' then begin IF not frm_data_share.t_code_currency.Locate('币别',DataSet.fieldbyname('币别').asstring,[])THEN begin showmessage('对不起,费用币别不正确!'); abort; end else begin if not strtobool(get_parameters_value(38,'true')) then begin if DataSet.FieldByName('币别').AsString<>'RMB' then begin if strtobool(get_parameters_value(145,'true')) then begin if not strtobool(get_parameters_value(184,'true')) then begin DataSet['汇率']:=getUsdExRate(DataSet.datasource.dataset.fieldbyname('开船日期').asstring,DataSet.FieldByName('币别').AsString) end else begin DataSet['汇率']:=getUsdExRate(DataSet.datasource.dataset.fieldbyname('开船日期').asstring,DataSet.FieldByName('币别').AsString) end; end else begin DataSet['汇率']:=getUsdExRate(DataSet.datasource.dataset.fieldbyname('开船日期').asstring,DataSet.FieldByName('币别').AsString) end; end else DataSet['汇率']:=frm_data_share.t_code_currency.fieldbyname('汇率').asfloat; end; end; end; end; procedure Tfrm_op_seae_weituo_wf.t_ch_acceptAfterPost(DataSet: TDataSet); var aQuery:TAdOQuery; AmtDr,AmtCr,HYF:double; begin AmtDr:=0; AmtCr:=0; aQuery:=CreateAdoQuery; try with aQuery do begin sql.add('select '); sql.add('sum(case when 类型=''收'' and 费用名称=''海运费'' then 财务不含税价 else 0 end) USDDR'); sql.add(',sum(case when 类型=''付'' and 费用名称=''海运费'' then 财务不含税价 else 0 end) USDCR'); sql.add('from t_ch_fee_order'); sql.add('where OR_ID=:OR_ID'); Parameters.ParamByName('OR_ID').Value:=DataSet.fieldbyname('OR_ID').AsInteger; open;First; if not IsEmpty then begin HYF:=fieldbyname('USDDR').AsFloat-fieldbyname('USDCR').AsFloat; end else begin HYF:=0; end; close;sql.clear; sql.add('select sum(财务不含税价*汇率) as 应收金额 from t_ch_fee_order where 类型=''收'' and 金额<>0 and OR_ID='+DataSet.fieldbyname('OR_ID').AsString); open; AmtDr:=fieldbyname('应收金额').AsFloat; close;sql.clear; sql.add('select sum(财务不含税价*汇率) as 应付金额 from t_ch_fee_order where 类型=''付'' and 金额<>0 and OR_ID='+DataSet.fieldbyname('OR_ID').AsString); open; AmtCr:=fieldbyname('应付金额').AsFloat; close;sql.clear; sql.add('Update t_op_seae_order set 海运费=:海运费,毛利润=:毛利润,利润率=:利润率'); sql.add('where OR_ID=:OR_ID'); Parameters.ParamByName('OR_ID').Value:=DataSet.fieldbyname('OR_ID').AsInteger; Parameters.ParamByName('海运费').Value:=HYF; Parameters.ParamByName('毛利润').Value:=AmtDr-AmtCr; if AmtDr<>0 then Parameters.ParamByName('利润率').Value:=StrToFloat(FormatFloat('0.00;-0.00;0',(AmtDr-AmtCr)/AmtDr)) else Parameters.ParamByName('利润率').Value:=0; ExecSQL; end; finally freeandnil(aQuery); end; end; procedure Tfrm_op_seae_weituo_wf.t_ch_payAfterPost(DataSet: TDataSet); var aQuery:TAdOQuery; AmtDr,AmtCr,HYF:double; begin AmtDr:=0; AmtCr:=0; aQuery:=CreateAdoQuery; try with aQuery do begin sql.add('select '); sql.add('sum(case when 类型=''收'' and 费用名称=''海运费'' then 财务不含税价 else 0 end) USDDR'); sql.add(',sum(case when 类型=''付'' and 费用名称=''海运费'' then 财务不含税价 else 0 end) USDCR'); sql.add('from t_ch_fee_order'); sql.add('where OR_ID=:OR_ID'); Parameters.ParamByName('OR_ID').Value:=DataSet.fieldbyname('OR_ID').AsInteger; open;First; if not IsEmpty then begin HYF:=fieldbyname('USDDR').AsFloat-fieldbyname('USDCR').AsFloat; end else begin HYF:=0; end; close;sql.clear; sql.add('select sum(财务不含税价*汇率) as 应收金额 from t_ch_fee_order where 类型=''收'' and 金额<>0 and OR_ID='+DataSet.fieldbyname('OR_ID').AsString); open; AmtDr:=fieldbyname('应收金额').AsFloat; close;sql.clear; sql.add('select sum(财务不含税价*汇率) as 应付金额 from t_ch_fee_order where 类型=''付'' and 金额<>0 and OR_ID='+DataSet.fieldbyname('OR_ID').AsString); open; AmtCr:=fieldbyname('应付金额').AsFloat; close;sql.clear; sql.add('Update t_op_seae_order set 海运费=:海运费,毛利润=:毛利润,利润率=:利润率'); sql.add('where OR_ID=:OR_ID'); Parameters.ParamByName('OR_ID').Value:=DataSet.fieldbyname('OR_ID').AsInteger; Parameters.ParamByName('海运费').Value:=HYF; Parameters.ParamByName('毛利润').Value:=AmtDr-AmtCr; if AmtDr<>0 then Parameters.ParamByName('利润率').Value:=StrToFloat(FormatFloat('0.00;-0.00;0',(AmtDr-AmtCr)/AmtDr)) else Parameters.ParamByName('利润率').Value:=0; ExecSQL; end; finally freeandnil(aQuery); end; end; procedure Tfrm_op_seae_weituo_wf.RxDBLookupCombo10Enter(Sender: TObject); begin RxLookupComboEnter(RxDBLookupCombo10); end; procedure Tfrm_op_seae_weituo_wf.RxDBLookupCombo10Exit(Sender: TObject); begin RxLookupComboExit(RxDBLookupCombo10); end; procedure Tfrm_op_seae_weituo_wf.RxDBLookupCombo20Enter(Sender: TObject); begin RxDBLookupCombo20.LookupDisplay:='航线代码;航线'; end; procedure Tfrm_op_seae_weituo_wf.RxDBLookupCombo20Exit(Sender: TObject); begin RxDBLookupCombo20.LookupDisplay:='航线'; end; procedure Tfrm_op_seae_weituo_wf.bsSkinButton17Click(Sender: TObject); begin if t_ch_pay.IsEmpty then exit; table_post(t_ch_pay); end; procedure Tfrm_op_seae_weituo_wf.bsSkinButton16Click(Sender: TObject); var Pnt:Tpoint; begin Pnt:=bsSkinButton16.ClientToScreen(Point(0,bsSkinButton16.Height)); PopupMenu4.Popup(Pnt.x,Pnt.y); end; procedure Tfrm_op_seae_weituo_wf.bsSkinButton18Click(Sender: TObject); begin t_ch_pay.delete; end; procedure Tfrm_op_seae_weituo_wf.bsSkinButton19Click(Sender: TObject); begin table_cancel(t_ch_pay); end; procedure Tfrm_op_seae_weituo_wf.bsSkinButton20Click(Sender: TObject); var aadoquery:TADOQuery; begin if t_op_seae_order.State in [dsedit,dsinsert] then t_op_seae_order.post; aadoquery:=CreateAdoQuery; with aadoquery do try Close;SQL.Clear; sql.Add('select count(*) c from t_ch_project_order'); sql.Add('where 船公司=:船公司'); Parameters.ParamByName('船公司').Value:=t_op_seae_order.FieldByName('船公司').AsString; Open;First; if FieldByName('c').AsInteger<=0 then begin ShowMessage(t_op_seae_order.FieldByName('船公司').AsString+' 没有费率方案'); exit; end; finally Free; end; try if not assigned(frm_code_fee_project_order_add) then frm_code_fee_project_order_add:=tfrm_code_fee_project_order_add.Create (self); frm_code_fee_project_order_add.op_type.text:='1'; frm_code_fee_project_order_add.fee_type.text:='付费'; frm_code_fee_project_order_add.t_ch_project.Filtered:=False; if t_op_seae_order.FieldByName('场站').AsString<>''then frm_code_fee_project_order_add.t_ch_project.Filter:='船公司='+''''+t_op_seae_order.FieldByName('船公司').AsString+''''+' and 场站='+''''+t_op_seae_order.FieldByName('场站').AsString+'''' else frm_code_fee_project_order_add.t_ch_project.Filter:='船公司='+''''+t_op_seae_order.FieldByName('船公司').AsString+''''; frm_code_fee_project_order_add.t_ch_project.Filtered:=true; frm_code_fee_project_order_add.t_op_bill1.Enabled:=false; frm_code_fee_project_order_add.t_op_bill1.DataSet:=t_ch_pay.DataSource.DataSet; frm_code_fee_project_order_add.t_op_bill1.Enabled:=true; frm_code_fee_project_order_add.t_ch_fee1.Enabled:=false; frm_code_fee_project_order_add.t_ch_fee1.DataSet:=t_ch_pay; frm_code_fee_project_order_add.t_ch_fee1.Enabled:=true; frm_code_fee_project_order_add.ShowModal; finally frm_code_fee_project_order_add.free; frm_code_fee_project_order_add:=nil; end; end; procedure Tfrm_op_seae_weituo_wf.t_op_seae_orderAfterInsert( DataSet: TDataSet); begin DataSet['船公司']:=''; DataSet['场站']:=''; DataSet['航线']:=''; DataSet['是否退佣']:=0; DataSet['毛利润']:=0; DataSet['业务方式']:='普通'; end; procedure Tfrm_op_seae_weituo_wf.t_ch_payBeforeEdit(DataSet: TDataSet); begin if not if_Edit_delete then begin ShowMessage('状态为:'+t_op_seae_order.FieldByName('状态').AsString+'不能操作'); Abort; end; end; procedure Tfrm_op_seae_weituo_wf.t_ch_acceptBeforeEdit(DataSet: TDataSet); begin if not if_Edit_delete then begin ShowMessage('状态为:'+t_op_seae_order.FieldByName('状态').AsString+'不能操作'); Abort; end; end; procedure Tfrm_op_seae_weituo_wf.bsSkinButton22Click(Sender: TObject); var aadoQuery:TadoQuery; begin if bsSkinExPanel1.Visible then bsSkinExPanel1.Visible:=false else bsSkinExPanel1.Visible:=True; with ADOQuery_wf do try Close;sql.Clear; sql.Add('Select t_workflow_do.当前状态,t_workflow_do.审核人,t_workflow_do.审核日期,t_workflow_step.步骤名称,t_workflow.路径名称'); sql.Add('from t_workflow_do'); sql.Add('Left join t_workflow_step on t_workflow_do.WI_ID=t_workflow_step.WI_ID'); sql.Add('Left join t_workflow on t_workflow_do.W_ID=t_workflow.W_ID'); sql.Add('where t_workflow_do.or_id=:or_id'); Parameters.ParamByName('or_id').Value:=t_op_seae_order.fieldbyname('or_id').AsInteger; Open;First; finally end; end; procedure Tfrm_op_seae_weituo_wf.wwDBLookupCombo5KeyPress(Sender: TObject; var Key: Char); begin if key=#13 then begin //币别 if (t_ch_accept.state=dsinsert)or(t_ch_accept.state=dsedit) then begin IF frm_data_share.t_code_currency.Locate('币别',wwDBLookupCombo5.text,[])THEN begin if wwDBLookupCombo5.text='USD' then begin if strtobool(get_parameters_value(145,'true')) then begin if not strtobool(get_parameters_value(184,'true')) then begin t_ch_accept['汇率']:=getUsdExRate(t_ch_accept.datasource.dataset.fieldbyname('开船日期').asstring,wwDBLookupCombo5.text) end else begin if t_ch_accept.datasource.dataset.fieldbyname('业务类型').asstring='普通货' then begin t_ch_accept['汇率']:=getUsdExRate(t_ch_accept.datasource.dataset.fieldbyname('开船日期').asstring,wwDBLookupCombo5.text) end else begin t_ch_accept['汇率']:=getUsdExRate(t_ch_accept.datasource.dataset.fieldbyname('会计期间').asstring,wwDBLookupCombo5.text) end; end; end else begin t_ch_accept['汇率']:=getUsdExRate(t_ch_accept.datasource.dataset.fieldbyname('会计期间').asstring,wwDBLookupCombo5.text) end; end else t_ch_accept['汇率']:=frm_data_share.t_code_currency.fieldbyname('汇率').asfloat; end; end; end; end; procedure Tfrm_op_seae_weituo_wf.wwDBLookupCombo5Change(Sender: TObject); begin //币别更改 if (t_ch_accept.state=dsinsert)or(t_ch_accept.state=dsedit) then begin IF frm_data_share.t_code_currency.Locate('币别',wwDBLookupCombo5.text,[])THEN begin if wwDBLookupCombo5.text='USD' then begin if strtobool(get_parameters_value(145,'true')) then begin if not strtobool(get_parameters_value(184,'true')) then begin t_ch_accept['汇率']:=getUsdExRate(t_ch_accept.datasource.dataset.fieldbyname('开船日期').asstring,wwDBLookupCombo5.text) end else begin t_ch_accept['汇率']:=getUsdExRate(t_ch_accept.datasource.dataset.fieldbyname('开船日期').asstring,wwDBLookupCombo5.text) end; end else begin t_ch_accept['汇率']:=getUsdExRate(t_ch_accept.datasource.dataset.fieldbyname('会计期间').asstring,wwDBLookupCombo5.text) end; end else t_ch_accept['汇率']:=frm_data_share.t_code_currency.fieldbyname('汇率').asfloat; end; end; end; procedure Tfrm_op_seae_weituo_wf.bsSkinButton23Click(Sender: TObject); var aadoquery:TADOQuery; begin if t_op_seae_order.State in [dsedit,dsinsert] then t_op_seae_order.post; { aadoquery:=CreateAdoQuery; with aadoquery do try Close;SQL.Clear; sql.Add('select count(*) c from t_ch_project_order'); sql.Add('where 船公司=:船公司'); Parameters.ParamByName('船公司').Value:=t_op_seae_order.FieldByName('船公司').AsString; Open;First; if FieldByName('c').AsInteger<=0 then begin ShowMessage(t_op_seae_order.FieldByName('船公司').AsString+' 没有费率方案'); exit; end; finally Free; end; } try if not assigned(frm_code_fee_project_order_add) then frm_code_fee_project_order_add:=tfrm_code_fee_project_order_add.Create (self); frm_code_fee_project_order_add.op_type.text:='1'; frm_code_fee_project_order_add.fee_type.text:='收费'; { frm_code_fee_project_order_add.t_ch_project.Filtered:=False; frm_code_fee_project_order_add.t_ch_project.Filter:='船公司='+''''+t_op_seae_order.FieldByName('船公司').AsString+''''+' and 场站='+''''+t_op_seae_order.FieldByName('场站').AsString+''''; frm_code_fee_project_order_add.t_ch_project.Filtered:=true; } frm_code_fee_project_order_add.t_op_bill1.Enabled:=false; frm_code_fee_project_order_add.t_op_bill1.DataSet:=t_ch_pay.DataSource.DataSet; frm_code_fee_project_order_add.t_op_bill1.Enabled:=true; frm_code_fee_project_order_add.t_ch_fee1.Enabled:=false; frm_code_fee_project_order_add.t_ch_fee1.DataSet:=t_ch_pay; frm_code_fee_project_order_add.t_ch_fee1.Enabled:=true; frm_code_fee_project_order_add.ShowModal; finally frm_code_fee_project_order_add.free; frm_code_fee_project_order_add:=nil; end; end; procedure Tfrm_op_seae_weituo_wf.RxDBLookupCombo7Change(Sender: TObject); var aQuery:TAdOQuery; begin if t_op_seae_order.State in [dsedit,dsinsert] then begin aQuery:=CreateAdoQuery; with aQuery do try Close;sql.Clear; sql.Add('Select * from t_crm_client_yard'); sql.Add('where 客户简称=:客户简称 and 是否默认=1'); Parameters.ParamByName('客户简称').Value:=RxDBLookupCombo7.DisplayValues[1]; Open;First; if not IsEmpty then begin t_op_seae_order['场站']:=fieldbyname('场站').asstring; t_op_seae_order['默认场站']:=fieldbyname('场站').asstring; end else begin t_op_seae_order['场站']:=''; t_op_seae_order['默认场站']:=''; end; finally Free; end; end; end; procedure Tfrm_op_seae_weituo_wf.RxDBLookupCombo7Enter(Sender: TObject); begin RxLookupComboEnter(RxDBLookupCombo7); end; procedure Tfrm_op_seae_weituo_wf.RxDBLookupCombo7Exit(Sender: TObject); begin RxLookupComboExit(RxDBLookupCombo7); end; procedure Tfrm_op_seae_weituo_wf.N5Click(Sender: TObject); var afield,afieldfee : variant; aOR_ID:integer; aQuery:TAdoQuery; i:integer; s,poNO:string; Boolean_Ctn:Boolean; begin if t_op_seae_order.IsEmpty then begin exit; MessageDlg('没有复制的信息,不能复制添加!',mtWarning,[mbok],0); end; if t_op_seae_order.fieldbyname('状态').Value<>'接受订舱' then begin MessageDlg('只有原始业务接受订舱才可以做离岸业务!',mtWarning,[mbok],0); exit; end; Boolean_Ctn:=false; afield := vararraycreate([0,t_op_seae_order.fieldcount-1],varvariant); for i := 0 to (t_op_seae_order.fieldcount-1) do begin afield[i] :=t_op_seae_order.fields[i].value ; end; aOR_ID:=t_op_seae_order.fieldbyname('OR_ID').AsInteger; s:=t_op_seae_order.fieldbyname('集装箱').AsString; poNO:=t_op_seae_order.fieldbyname('订舱编号').AsString; t_op_seae_order.append; for i := 0 to (t_op_seae_order.fieldcount-1) do begin if t_op_seae_order.fields[i].FieldName<>'OR_ID' then t_op_seae_order.fields[i].value := afield[i] ; end; t_op_seae_order.fieldbyname('揽货人').Value:=employee; t_op_seae_order.fieldbyname('录入人').Value:=employee; t_op_seae_order.fieldbyname('录入日期').Value:=date; t_op_seae_order.fieldbyname('开船日期').Value:=date; t_op_seae_order.fieldbyname('海运费').Value:=0; t_op_seae_order.fieldbyname('销售部门').Value:=department; t_op_seae_order.fieldbyname('状态').Value:='新建订舱'; t_op_seae_order.fieldbyname('驳回原因').Value:=''; t_op_seae_order.fieldbyname('驳回原因').Value:=''; t_op_seae_order.fieldbyname('订舱编号').Value:='HK:'+poNO; t_op_seae_order.fieldbyname('状态').Value:='新建订舱'; t_op_seae_order.fieldbyname('编号').Value:=''; t_op_seae_order.fieldbyname('业务编号').Value:=''; t_op_seae_order.fieldbyname('提交人').Value:=''; t_op_seae_order.fieldbyname('提交时间').Value:=null; t_op_seae_order.fieldbyname('审核人').Value:=''; t_op_seae_order.fieldbyname('审核时间').Value:=null; t_op_seae_order.fieldbyname('主提单号').Value:=''; t_op_seae_order.fieldbyname('复核人').Value:=''; t_op_seae_order.fieldbyname('复核时间').Value:=null; t_op_seae_order.fieldbyname('集装箱').Value:=s; t_op_seae_order.fieldbyname('报检操作').Value:=''; t_op_seae_order.fieldbyname('海运费').Value:=0; t_op_seae_order.fieldbyname('毛利润').Value:=0; t_op_seae_order.fieldbyname('利润率').Value:=''; t_op_seae_order.fieldbyname('业务方式').Value:='离岸'; t_op_seae_order.Post; bsSkinPageControl1.ActivePageIndex:=1; aQuery:=CreateAdoQuery; try with aQuery do begin close;sql.clear; sql.Add('select * from t_opor_ctn where OR_ID='+inttostr(aOR_ID)); open; if not t_op_ctn.active then t_op_ctn.Open; first; while not eof do begin Boolean_Ctn:=true; t_op_ctn.Insert; t_op_ctn.fieldbyname('代码').AsString:=aQuery.fieldbyname('代码').AsString; t_op_ctn.fieldbyname('尺寸').AsString:=aQuery.fieldbyname('尺寸').AsString; t_op_ctn.fieldbyname('箱型').AsString:=aQuery.fieldbyname('箱型').AsString; t_op_ctn.fieldbyname('数量').Asinteger:=aQuery.fieldbyname('数量').Asinteger; t_op_ctn.fieldbyname('TEU').Asinteger:=aQuery.fieldbyname('TEU').Asinteger; t_op_ctn.fieldbyname('件数').Asinteger:=aQuery.fieldbyname('件数').Asinteger; t_op_ctn.fieldbyname('重量').Asfloat:=aQuery.fieldbyname('重量').Asfloat; t_op_ctn.fieldbyname('尺码').Asfloat:=aQuery.fieldbyname('尺码').Asfloat; t_op_ctn.fieldbyname('表现形式').AsString:=aQuery.fieldbyname('表现形式').AsString; t_op_ctn.fieldbyname('箱号').AsString:=aQuery.fieldbyname('箱号').AsString; t_op_ctn.fieldbyname('封号').AsString:=aQuery.fieldbyname('封号').AsString; t_op_ctn.fieldbyname('包装').AsString:=aQuery.fieldbyname('包装').AsString; t_op_ctn.fieldbyname('品名').AsString:=aQuery.fieldbyname('品名').AsString; t_op_ctn.fieldbyname('唛头').AsString:=aQuery.fieldbyname('唛头').AsString; t_op_ctn.fieldbyname('备注').AsString:=aQuery.fieldbyname('备注').AsString; t_op_ctn.Post; next; end; end; finally freeandnil(aQuery); end; t_op_seae_order.Edit; // t_op_seae_order['开船日期']:=null; t_op_seae_order['状态']:='新建订舱'; t_op_seae_order['编号']:=''; t_op_seae_order['业务编号']:=''; t_op_seae_order['提交人']:=''; t_op_seae_order['提交时间']:=null; t_op_seae_order['审核人']:=''; t_op_seae_order['审核时间']:=null; t_op_seae_order['主提单号']:=''; if not Boolean_Ctn then t_op_seae_order['集装箱']:=''; // t_op_seae_order['集装箱']:=s; t_op_seae_order.post; end; procedure Tfrm_op_seae_weituo_wf.MenuItem1Click(Sender: TObject); begin if t_op_seae_order.State in [dsedit,dsinsert] then t_op_seae_order.post; t_ch_pay.Append; end; procedure Tfrm_op_seae_weituo_wf.N75Click(Sender: TObject); var i,k:integer; begin //应付所选复制到应收 if t_ch_pay.IsEmpty then exit; try t_ch_accept.FieldByName('客户名称').OnChange:=nil; t_ch_accept.FieldByName('不含税价').OnChange:=nil; t_ch_accept.FieldByName('税率').OnChange:=nil; t_ch_accept.FieldByName('金额').OnChange:=nil; t_ch_accept.FieldByName('财务税率').OnChange:=nil; t_ch_accept.FieldByName('单价').OnChange:=nil; t_ch_accept.FieldByName('数量').OnChange:=nil; t_ch_accept.FieldByName('佣金比例').OnChange:=nil; t_ch_pay.FieldByName('客户名称').OnChange:=nil; t_ch_pay.FieldByName('不含税价').OnChange:=nil; t_ch_pay.FieldByName('税率').OnChange:=nil; t_ch_pay.FieldByName('单价').OnChange:=nil; t_ch_pay.FieldByName('数量').OnChange:=nil; t_ch_pay.FieldByName('佣金比例').OnChange:=nil; t_ch_pay.FieldByName('金额').OnChange:=nil; t_ch_pay.FieldByName('财务税率').OnChange:=nil; if wwDBGrid2.SelectedList.Count>=1 then begin for i:=0 to wwDBGrid2.SelectedList.Count-1 do begin t_ch_pay.GotoBookmark(pointer(wwDBGrid2.SelectedList[i])); t_ch_accept.append; for k:= 0 to (t_ch_pay.fieldcount-1) do begin if t_ch_accept.FindField(t_ch_pay.fields[k].FieldName)<>nil then if (t_ch_pay.fields[k].FieldName<>'CH_ID') and (t_ch_pay.fields[k].DataType<>ftDateTime) then t_ch_accept.FindField(t_ch_pay.fields[k].FieldName).value:=t_ch_pay.fields[k].value ; end; t_ch_accept['费用状态']:='录入状态'; t_ch_accept['类型']:='收'; t_ch_accept['费用原因']:=null; t_ch_accept['结算单位']:='委托单位'; t_ch_accept['客户名称']:=t_ch_accept.DataSource.DataSet.fieldbyname('委托单位').asstring; t_ch_accept['结算金额']:=0; t_ch_accept['开票金额']:=0; t_ch_accept['申请开票']:=0; t_ch_accept['冲抵金额']:=0; t_ch_accept['申请金额']:=0; t_ch_accept['提交日期']:=null; t_ch_accept['审核人']:=null; t_ch_accept['审核日期']:=null; t_ch_accept['一级审核人']:=null; t_ch_accept['一级审核日期']:=null; t_ch_accept['录入人']:=employee; t_ch_accept['录入日期']:=now; t_ch_accept['是否对帐']:=0; t_ch_accept['对帐编号']:=''; t_ch_accept['顺序']:=t_ch_accept.RecordCount+1; t_ch_accept['机密']:=0; t_ch_accept['预提成本']:=0; t_ch_accept['冲抵成本']:=0; t_ch_accept.post; end; end else begin t_ch_accept.append; for k:= 0 to (t_ch_pay.fieldcount-1) do begin if t_ch_accept.FindField(t_ch_pay.fields[k].FieldName)<>nil then if (t_ch_pay.fields[k].FieldName<>'CH_ID') and (t_ch_pay.fields[k].DataType<>ftDateTime) then t_ch_accept.FindField(t_ch_pay.fields[k].FieldName).value:=t_ch_pay.fields[k].value ; end; t_ch_accept['费用状态']:='录入状态'; t_ch_accept['类型']:='收'; t_ch_accept['费用原因']:=null; t_ch_accept['结算单位']:='委托单位'; t_ch_accept['客户名称']:=t_ch_accept.DataSource.DataSet.fieldbyname('委托单位').asstring; t_ch_accept['结算金额']:=0; t_ch_accept['开票金额']:=0; t_ch_accept['申请开票']:=0; t_ch_accept['申请金额']:=0; t_ch_accept['提交日期']:=null; t_ch_accept['审核人']:=null; t_ch_accept['审核日期']:=null; t_ch_accept['一级审核人']:=null; t_ch_accept['一级审核日期']:=null; t_ch_accept['录入人']:=employee; t_ch_accept['录入日期']:=now; t_ch_accept['是否对帐']:=0; t_ch_accept['对帐编号']:=''; t_ch_accept['顺序']:=t_ch_accept.RecordCount+1; t_ch_accept['机密']:=0; t_ch_accept.post; end; finally t_ch_accept.FieldByName('客户名称').OnChange:=t_ch_acceptcrmcharge; t_ch_accept.FieldByName('不含税价').OnChange:=DatasetNOPricecharge; t_ch_accept.FieldByName('税率').OnChange:=DatasetNOPricecharge; t_ch_accept.FieldByName('金额').OnChange:=DatasetAmtcharge; t_ch_accept.FieldByName('财务税率').OnChange:=DatasetAmtcharge; t_ch_accept.FieldByName('单价').OnChange:=t_ch_acceptdjoncharge; t_ch_accept.FieldByName('数量').OnChange:=t_ch_acceptdjoncharge; t_ch_accept.FieldByName('佣金比例').OnChange:=t_ch_acceptdjoncharge; t_ch_pay.FieldByName('客户名称').OnChange:=t_ch_acceptcrmcharge; t_ch_pay.FieldByName('不含税价').OnChange:=DatasetNOPricecharge; t_ch_pay.FieldByName('税率').OnChange:=DatasetNOPricecharge; t_ch_pay.FieldByName('单价').OnChange:=t_ch_paydjoncharge; t_ch_pay.FieldByName('数量').OnChange:=t_ch_paydjoncharge; t_ch_pay.FieldByName('佣金比例').OnChange:=t_ch_paydjoncharge; t_ch_pay.FieldByName('金额').OnChange:=DatasetAmtcharge; t_ch_pay.FieldByName('财务税率').OnChange:=DatasetAmtcharge; end; end; procedure Tfrm_op_seae_weituo_wf.N77Click(Sender: TObject); var k:integer; begin //应付复制到应收 if t_ch_pay.IsEmpty then exit; try t_ch_pay.DisableControls; if t_ch_accept.Active then begin t_ch_accept.FieldByName('客户名称').OnChange:=nil; t_ch_accept.FieldByName('不含税价').OnChange:=nil; t_ch_accept.FieldByName('税率').OnChange:=nil; t_ch_accept.FieldByName('金额').OnChange:=nil; t_ch_accept.FieldByName('财务税率').OnChange:=nil; t_ch_accept.FieldByName('单价').OnChange:=nil; t_ch_accept.FieldByName('数量').OnChange:=nil; t_ch_accept.FieldByName('佣金比例').OnChange:=nil; t_ch_accept.AfterPost:=nil; end; t_ch_pay.first; while not t_ch_pay.eof do begin t_ch_accept.append; for k:= 0 to (t_ch_pay.fieldcount-1) do begin if t_ch_accept.FindField(t_ch_pay.fields[k].FieldName)<>nil then if (t_ch_pay.fields[k].FieldName<>'CH_ID') and (t_ch_pay.fields[k].DataType<>ftDateTime) then t_ch_accept.FindField(t_ch_pay.fields[k].FieldName).value:=t_ch_pay.fields[k].value ; end; t_ch_accept['费用状态']:='录入状态'; t_ch_accept['类型']:='收'; t_ch_accept['费用原因']:=null; t_ch_accept['结算单位']:='委托单位'; t_ch_accept['客户名称']:=t_ch_accept.DataSource.DataSet.fieldbyname('委托单位').asstring; if t_ch_accept['税率']<=0 then begin if frm_data_share.t_crm_client.Locate('客户简称',t_ch_accept['客户名称'],[]) then begin if not frm_data_share.t_crm_client.fieldbyname('税率').IsNull then t_ch_accept['税率']:=frm_data_share.t_crm_client.fieldbyname('税率').AsFloat end; t_ch_accept.fieldbyname('单价').asfloat:=t_ch_accept.fieldbyname('不含税价').asfloat*t_ch_accept.fieldbyname('税率').asfloat/100+t_ch_accept.fieldbyname('不含税价').asfloat; t_ch_accept['金额']:=s_w(strtoint(apointnum),t_ch_accept.fieldbyname('单价').asfloat*t_ch_accept.fieldbyname('数量').asfloat); t_ch_accept['税额']:=s_w(strtoint(apointnum),t_ch_accept.fieldbyname('不含税价').asfloat*t_ch_accept.fieldbyname('税率').asfloat/100*t_ch_accept.fieldbyname('数量').asfloat); t_ch_accept['不含税金额']:=s_w(strtoint(apointnum),t_ch_accept.fieldbyname('金额').asfloat-t_ch_accept.fieldbyname('税额').asfloat); t_ch_accept['财务税额']:=s_w(strtoint(apointnum),t_ch_accept.fieldbyname('金额').asfloat/(1+t_ch_accept.fieldbyname('财务税率').asfloat/100)*t_ch_accept.fieldbyname('财务税率').asfloat/100); t_ch_accept['财务不含税价']:=s_w(strtoint(apointnum),t_ch_accept.fieldbyname('金额').asfloat-t_ch_accept.fieldbyname('财务税额').asfloat); end; t_ch_accept['结算金额']:=0; t_ch_accept['开票金额']:=0; t_ch_accept['申请开票']:=0; t_ch_accept['冲抵金额']:=0; t_ch_accept['申请金额']:=0; t_ch_accept['提交日期']:=null; t_ch_accept['审核人']:=null; t_ch_accept['审核日期']:=null; t_ch_accept['一级审核人']:=null; t_ch_accept['一级审核日期']:=null; t_ch_accept['录入人']:=employee; t_ch_accept['录入日期']:=now; t_ch_accept['是否对帐']:=0; t_ch_accept['对帐编号']:=''; t_ch_accept['顺序']:=t_ch_accept.RecordCount+1; t_ch_accept['机密']:=0; t_ch_accept['预提成本']:=0; t_ch_accept['冲抵成本']:=0; t_ch_accept.post; t_ch_pay.next; end; finally t_ch_pay.EnableControls; if t_ch_accept.Active then begin t_ch_accept.FieldByName('客户名称').OnChange:=t_ch_acceptcrmcharge; t_ch_accept.FieldByName('不含税价').OnChange:=DatasetNOPricecharge; t_ch_accept.FieldByName('税率').OnChange:=DatasetNOPricecharge; t_ch_accept.FieldByName('金额').OnChange:=DatasetAmtcharge; t_ch_accept.FieldByName('财务税率').OnChange:=DatasetAmtcharge; t_ch_accept.FieldByName('单价').OnChange:=t_ch_acceptdjoncharge; t_ch_accept.FieldByName('数量').OnChange:=t_ch_acceptdjoncharge; t_ch_accept.FieldByName('佣金比例').OnChange:=t_ch_acceptdjoncharge; t_ch_accept.AfterPost:=t_ch_acceptAfterPost; t_ch_accept.Edit; t_ch_accept.Post; // t_op_seae_order.Refresh; end; end; end; procedure Tfrm_op_seae_weituo_wf.bsSkinButton24Click(Sender: TObject); var aadoquery:TADOQuery; begin if t_op_seae_order.State in [dsedit,dsinsert] then t_op_seae_order.post; aadoquery:=CreateAdoQuery; with aadoquery do try Close;SQL.Clear; sql.Add('select count(*) c from t_ch_project_order'); sql.Add('where 船公司='''''); Open;First; if FieldByName('c').AsInteger<=0 then begin ShowMessage(t_op_seae_order.FieldByName('船公司').AsString+' 没有费率方案'); exit; end; finally Free; end; try if not assigned(frm_code_fee_project_order_add) then frm_code_fee_project_order_add:=tfrm_code_fee_project_order_add.Create (self); frm_code_fee_project_order_add.op_type.text:='1'; frm_code_fee_project_order_add.fee_type.text:='付费'; frm_code_fee_project_order_add.t_ch_project.Filtered:=False; frm_code_fee_project_order_add.t_ch_project.Filter:='船公司='+''''''; // ShowMessage(frm_code_fee_project_order_add.t_ch_project.Filter); frm_code_fee_project_order_add.t_ch_project.Filtered:=true; frm_code_fee_project_order_add.t_op_bill1.Enabled:=false; frm_code_fee_project_order_add.t_op_bill1.DataSet:=t_ch_pay.DataSource.DataSet; frm_code_fee_project_order_add.t_op_bill1.Enabled:=true; frm_code_fee_project_order_add.t_ch_fee1.Enabled:=false; frm_code_fee_project_order_add.t_ch_fee1.DataSet:=t_ch_pay; frm_code_fee_project_order_add.t_ch_fee1.Enabled:=true; frm_code_fee_project_order_add.ShowModal; finally frm_code_fee_project_order_add.free; frm_code_fee_project_order_add:=nil; end; end; procedure Tfrm_op_seae_weituo_wf.dxDBGrid1Column40CustomDraw( 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 strtofloatdef(AText,0)<=0 then AColor:=clRed; end; procedure Tfrm_op_seae_weituo_wf.wwDBLookupCombo15DropDown( Sender: TObject); var str_list:Tstringlist; i,k:Integer; begin t_bz_balance.close; t_bz_balance.open; t_bz_balance.Append; t_bz_balance['one']:='1-单票'; t_bz_balance['two']:='单票'; t_bz_balance['three']:=1; t_bz_balance.post; t_bz_balance.Append; t_bz_balance['one']:='2-重量'; t_bz_balance['two']:='重量'; t_bz_balance['three']:=s_w(4,t_ch_accept.DataSource.DataSet.fieldbyname('重量').asfloat/1000); t_bz_balance.post; t_bz_balance.Append; t_bz_balance['one']:='3-尺码'; t_bz_balance['two']:='尺码'; if t_ch_accept.DataSource.DataSet.fieldbyname('尺码').asfloat>1 then t_bz_balance['three']:=t_ch_accept.DataSource.DataSet.fieldbyname('尺码').asfloat else t_bz_balance['three']:=1; t_bz_balance.post; t_bz_balance.Append; t_bz_balance['one']:='4-TEU'; t_bz_balance['two']:='TEU'; t_bz_balance['three']:=t_ch_accept.DataSource.DataSet.fieldbyname('箱TEU').asinteger; t_bz_balance.post; try t_bz_balance.Append; t_bz_balance['one']:='5-计费吨'; t_bz_balance['two']:='计费吨'; if s_w(4,t_ch_accept.DataSource.DataSet.fieldbyname('重量').asfloat/1000)>t_ch_accept.DataSource.DataSet.fieldbyname('尺码').asfloat then begin if s_w(4,t_ch_accept.DataSource.DataSet.fieldbyname('重量').asfloat/1000)>1 then t_bz_balance['three']:=s_w(4,t_ch_accept.DataSource.DataSet.fieldbyname('重量').asfloat/1000) else t_bz_balance['three']:=1; end else begin if t_ch_accept.DataSource.DataSet.fieldbyname('尺码').asfloat>1 then t_bz_balance['three']:=t_ch_accept.DataSource.DataSet.fieldbyname('尺码').asfloat else t_bz_balance['three']:=1; end; t_bz_balance.post; str_list:=Tstringlist.Create(); str_list.Text:=t_ch_accept.DataSource.DataSet.fieldbyname('计费标准').asstring; for i:=0 to str_list.Count-1 do begin t_bz_balance.Append; t_bz_balance['one']:=inttostr(i+k+6)+'-'+copy(str_list[i],1,pos('*',str_list[i])-1); t_bz_balance['two']:=copy(str_list[i],pos('-',str_list[i])+1,length(str_list[i])+1-pos('-',str_list[i])); t_bz_balance['three']:=strtofloat(copy(str_list[i],pos('*',str_list[i])+1,pos('-',str_list[i])-pos('*',str_list[i])-1)); t_bz_balance.post; end; except ; end; end; procedure Tfrm_op_seae_weituo_wf.wwDBLookupCombo15Change(Sender: TObject); var AAdoQuery : TADOQuery; begin if (t_ch_accept.state=dsinsert)or(t_ch_accept.state=dsedit) then begin if not t_bz_balance.IsEmpty then if t_bz_balance.Locate('one',wwDBLookupCombo15.text,[])then begin t_ch_accept['数量']:=t_bz_balance.fieldbyname('three').asfloat; end; end; end; procedure Tfrm_op_seae_weituo_wf.wwDBLookupCombo16Change(Sender: TObject); var AAdoQuery : TADOQuery; begin if (t_ch_pay.state=dsinsert)or(t_ch_pay.state=dsedit) then begin if not t_bz_balance.IsEmpty then if t_bz_balance.Locate('one',wwDBLookupCombo16.text,[])then begin t_ch_pay['数量']:=t_bz_balance.fieldbyname('three').asfloat; end; end; end; procedure Tfrm_op_seae_weituo_wf.wwDBLookupCombo16DropDown( Sender: TObject); var str_list:Tstringlist; i,k:Integer; begin t_bz_balance.close; t_bz_balance.open; t_bz_balance.Append; t_bz_balance['one']:='1-单票'; t_bz_balance['two']:='单票'; t_bz_balance['three']:=1; t_bz_balance.post; t_bz_balance.Append; t_bz_balance['one']:='2-重量'; t_bz_balance['two']:='重量'; t_bz_balance['three']:=s_w(4,t_ch_accept.DataSource.DataSet.fieldbyname('重量').asfloat/1000); t_bz_balance.post; t_bz_balance.Append; t_bz_balance['one']:='3-尺码'; t_bz_balance['two']:='尺码'; if t_ch_accept.DataSource.DataSet.fieldbyname('尺码').asfloat>1 then t_bz_balance['three']:=t_ch_accept.DataSource.DataSet.fieldbyname('尺码').asfloat else t_bz_balance['three']:=1; t_bz_balance.post; t_bz_balance.Append; t_bz_balance['one']:='4-TEU'; t_bz_balance['two']:='TEU'; t_bz_balance['three']:=t_ch_accept.DataSource.DataSet.fieldbyname('箱TEU').asinteger; t_bz_balance.post; try t_bz_balance.Append; t_bz_balance['one']:='5-计费吨'; t_bz_balance['two']:='计费吨'; if s_w(4,t_ch_accept.DataSource.DataSet.fieldbyname('重量').asfloat/1000)>t_ch_accept.DataSource.DataSet.fieldbyname('尺码').asfloat then begin if s_w(4,t_ch_accept.DataSource.DataSet.fieldbyname('重量').asfloat/1000)>1 then t_bz_balance['three']:=s_w(4,t_ch_accept.DataSource.DataSet.fieldbyname('重量').asfloat/1000) else t_bz_balance['three']:=1; end else begin if t_ch_accept.DataSource.DataSet.fieldbyname('尺码').asfloat>1 then t_bz_balance['three']:=t_ch_accept.DataSource.DataSet.fieldbyname('尺码').asfloat else t_bz_balance['three']:=1; end; t_bz_balance.post; str_list:=Tstringlist.Create(); str_list.Text:=t_ch_accept.DataSource.DataSet.fieldbyname('计费标准').asstring; for i:=0 to str_list.Count-1 do begin t_bz_balance.Append; t_bz_balance['one']:=inttostr(i+k+6)+'-'+copy(str_list[i],1,pos('*',str_list[i])-1); t_bz_balance['two']:=copy(str_list[i],pos('-',str_list[i])+1,length(str_list[i])+1-pos('-',str_list[i])); t_bz_balance['three']:=strtofloat(copy(str_list[i],pos('*',str_list[i])+1,pos('-',str_list[i])-pos('*',str_list[i])-1)); t_bz_balance.post; end; except ; end; end; procedure Tfrm_op_seae_weituo_wf.t_ch_payBeforeDelete(DataSet: TDataSet); begin if not if_Edit_delete then begin ShowMessage('状态为:'+t_op_seae_order.FieldByName('状态').AsString+'不能操作'); Abort; end; end; procedure Tfrm_op_seae_weituo_wf.t_ch_acceptBeforeInsert( DataSet: TDataSet); begin if not if_Edit_delete then begin ShowMessage('状态为:'+t_op_seae_order.FieldByName('状态').AsString+'不能操作'); Abort; end; end; procedure Tfrm_op_seae_weituo_wf.t_ch_acceptBeforeDelete( DataSet: TDataSet); begin if not if_Edit_delete then begin ShowMessage('状态为:'+t_op_seae_order.FieldByName('状态').AsString+'不能操作'); Abort; end; end; procedure Tfrm_op_seae_weituo_wf.t_ch_payBeforeInsert(DataSet: TDataSet); begin if not if_Edit_delete then begin ShowMessage('状态为:'+t_op_seae_order.FieldByName('状态').AsString+'不能操作'); Abort; end; end; procedure Tfrm_op_seae_weituo_wf.RxDBLookupCombo14Enter(Sender: TObject); begin RxLookupComboEnter(RxDBLookupCombo14); end; procedure Tfrm_op_seae_weituo_wf.RxDBLookupCombo14Exit(Sender: TObject); begin RxLookupComboEnter(RxDBLookupCombo14); end; procedure Tfrm_op_seae_weituo_wf.RxDBLookupCombo16Enter(Sender: TObject); begin RxLookupComboEnter(RxDBLookupCombo16); end; procedure Tfrm_op_seae_weituo_wf.RxDBLookupCombo16Exit(Sender: TObject); begin RxLookupComboEnter(RxDBLookupCombo16); end; end.