unit u_op_truck; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, dxExEdtr, XPMenu, Menus, DB, ADODB, dxDBTLCl, dxGrClms, dxDBCtrl, dxDBGrid, dxTL, dxCntner, Mask, wwdbedit, Wwdotdot, Wwdbcomb, wwdblook, RxLookup, wwdbdatetimepicker, StdCtrls, bsSkinCtrls, ExtCtrls, DBCtrls, ComCtrls, bsSkinTabs, u_fee, cxControls, cxContainer, cxEdit, cxTextEdit, cxMemo, cxDBEdit, bsSkinBoxCtrls; type Tfrm_op_truck = class(TForm) Panel2: TPanel; XPMenu1: TXPMenu; t_op_letter_pc: TADOQuery; t_op_letter_pc1: TDataSource; bsSkinPageControl1: TbsSkinPageControl; bsSkinTabSheet1: TbsSkinTabSheet; dxDBGrid1: TdxDBGrid; dxDBGrid1Column4: TdxDBGridMaskColumn; dxDBGrid1Column14: TdxDBGridMaskColumn; dxDBGrid1Column15: TdxDBGridMaskColumn; dxDBGrid1Column16: TdxDBGridDateColumn; dxDBGrid1Column63: TdxDBGridMaskColumn; dxDBGrid1Column64: TdxDBGridMaskColumn; dxDBGrid1Column65: TdxDBGridDateColumn; bsSkinTabSheet2: TbsSkinTabSheet; bsSkinPanel5: TbsSkinPanel; Label19: TLabel; Label22: TLabel; DBEdit10: TDBEdit; DBEdit12: TDBEdit; bsSkinPanel1: TbsSkinPanel; Label1: TLabel; bsSkinButton10: TbsSkinButton; bsSkinButton6: TbsSkinButton; bsSkinButton5: TbsSkinButton; bsSkinButton15: TbsSkinButton; bsSkinButton16: TbsSkinButton; Label26: TLabel; DBEdit3: TDBEdit; Label27: TLabel; DBEdit4: TDBEdit; DBText1: TDBText; Edit1: TEdit; Label2: TLabel; DBEdit1: TDBEdit; bsSkinButton1: TbsSkinButton; bsSkinButton2: TbsSkinButton; dxDBGrid1Column10: TdxDBGridColumn; Label8: TLabel; bsSkinPanel2: TbsSkinPanel; bsSkinSpeedButton1: TbsSkinSpeedButton; wwDBComboBox31: TwwDBComboBox; Label11: TLabel; Label12: TLabel; Label13: TLabel; DBEdit13: TDBEdit; Label16: TLabel; DBEdit14: TDBEdit; Label14: TLabel; bsSkinGroupBox1: TbsSkinGroupBox; Label9: TLabel; DBEdit9: TDBEdit; Label10: TLabel; DBEdit11: TDBEdit; bsSkinSpeedButton2: TbsSkinSpeedButton; bsSkinSpeedButton3: TbsSkinSpeedButton; bsSkinSpeedButton4: TbsSkinSpeedButton; bsSkinSpeedButton5: TbsSkinSpeedButton; Label6: TLabel; DBEdit7: TDBEdit; t_op_seae: TADOQuery; t_op_seaeAmend: TADOQuery; Label7: TLabel; DBEdit8: TDBEdit; bsSkinMemo1: TbsSkinMemo; t_ch_fee: TADOQuery; dxDBGrid1Column11: TdxDBGridColumn; dxDBGrid1Column12: TdxDBGridColumn; dxDBGrid1Column13: TdxDBGridColumn; dxDBGrid1Column17: TdxDBGridColumn; dxDBGrid1Column18: TdxDBGridColumn; fra_fee1: Tfra_fee; t_op_seae2: TDataSource; Label5: TLabel; Edit2: TEdit; wwDBComboBox44: TwwDBComboBox; Label15: TLabel; DBMemo1: TDBMemo; RxDBLookupCombo14: TRxDBLookupCombo; t_sys_employee1: TDataSource; t_sys_employee: TADOQuery; Label3: TLabel; wwDBDateTimePicker1: TwwDBDateTimePicker; Label4: TLabel; wwDBDateTimePicker2: TwwDBDateTimePicker; Label17: TLabel; DBEdit2: TDBEdit; dxDBGrid1Column20: TdxDBGridColumn; dxDBGrid1Column21: TdxDBGridColumn; bsSkinButton3: TbsSkinButton; dxDBGrid1Column22: TdxDBGridColumn; dxDBGrid1Column23: TdxDBGridColumn; dxDBGrid1Column24: TdxDBGridColumn; dxDBGrid1Column25: TdxDBGridColumn; dxDBGrid1Column26: TdxDBGridColumn; dxDBGrid1Column27: TdxDBGridColumn; dxDBGrid1Column28: TdxDBGridColumn; dxDBGrid1Column29: TdxDBGridColumn; Label18: TLabel; wwDBDateTimePicker3: TwwDBDateTimePicker; Label20: TLabel; wwDBDateTimePicker4: TwwDBDateTimePicker; Label21: TLabel; wwDBComboBox7: TwwDBComboBox; Edit4: TEdit; procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure bsSkinButton5Click(Sender: TObject); procedure bsSkinButton10Click(Sender: TObject); procedure bsSkinButton6Click(Sender: TObject); procedure dxDBGrid1ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); procedure FormShow(Sender: TObject); procedure Edit1KeyPress(Sender: TObject; var Key: Char); procedure Button1Click(Sender: TObject); procedure dxDBGrid1DblClick(Sender: TObject); procedure bsSkinButton15Click(Sender: TObject); procedure t_op_letter_pcBeforeEdit(DataSet: TDataSet); procedure t_op_letter_pcBeforeDelete(DataSet: TDataSet); procedure bsSkinButton16Click(Sender: TObject); procedure bsSkinButton1Click(Sender: TObject); procedure DBEdit10KeyPress(Sender: TObject; var Key: Char); procedure bsSkinButton2Click(Sender: TObject); procedure t_op_letter_pcAfterInsert(DataSet: TDataSet); procedure bsSkinSpeedButton1Click(Sender: TObject); procedure bsSkinSpeedButton2Click(Sender: TObject); procedure bsSkinSpeedButton3Click(Sender: TObject); procedure bsSkinSpeedButton4Click(Sender: TObject); procedure bsSkinSpeedButton5Click(Sender: TObject); procedure bsSkinPageControl1Change(Sender: TObject); procedure dxDBGrid1Column11CustomDraw(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 DBEdit13Change(Sender: TObject); procedure bsSkinButton3Click(Sender: TObject); procedure dxDBGrid1Column25CustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean); private procedure LoadFee(); procedure UnLoadFee(); { Private declarations } public { Public declarations } end; var frm_op_truck: Tfrm_op_truck; frm_op_truck_insert:boolean=false; implementation uses u_main, u_data_share, u_code_send_head, u_code_truck_client, u_code_truck_changzhan, my_sys_function,u_ch_fee_se_truck, u_sys_progress; {$R *.dfm} procedure Tfrm_op_truck.FormClose(Sender: TObject; var Action: TCloseAction); begin frm_op_truck.Hide; frm_op_truck.ManualFloat(frm_op_truck.BoundsRect ); frm_main.freeTabs('frm_op_truck'); action:=cafree; frm_op_truck:=nil; end; procedure Tfrm_op_truck.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_op_truck.bsSkinButton10Click(Sender: TObject); var str:widestring; begin str:=str+' where 1=1 '; if Edit1.text<>''then str:=str+' and t.主提单号 like '+''''+'%'+Edit1.text+'%'+''''; if if_open('422') then begin end else if if_open('420') then begin str:=str+' and (t.申请人 in (select 姓名 from t_sys_employee where 部门名称='+''''+department+''')'; str:=str+' or t.申请人 in (select 姓名 from t_sys_employee where 部门名称 in (select 部门名称 from t_sys_department where 部门经理='+''''+employee+'''))) '; end else if if_open('421') then begin str:=str+' and t.冲销类别=''财务审批'' '; end else begin str:=str+' and t.申请人='+''''+employee+''''; end; if Edit2.text<>''then str:=str+' and t.更改单业务编号 like '+''''+'%'+Edit2.text+'%'+''''; if wwDBComboBox44.text<>'' then str:=str+' and t.状态='+''''+wwDBComboBox44.Text+''''; if wwDBDateTimePicker1.text<>''then begin str:=str+' and t.审核日期>='+''''+wwDBDateTimePicker1.text+''''; end; if wwDBDateTimePicker2.text<>''then begin str:=str+' and t.审核日期<='+''''+wwDBDateTimePicker2.text+''''; end; if wwDBDateTimePicker3.text<>''then begin str:=str+' and a.会计期间>='+''''+wwDBDateTimePicker3.text+''''; end; if wwDBDateTimePicker4.text<>''then begin str:=str+' and a.会计期间<='+''''+wwDBDateTimePicker4.text+''''; end; if (Edit4.Text<>'') and (wwDBComboBox7.Text<>'') then begin if (wwDBComboBox7.Text='大于') then begin str:=str+' and g.毛利润>'+floattostr(strtofloatdef(Edit4.Text,0)); end; if (wwDBComboBox7.Text='小于') then begin str:=str+' and g.毛利润<'+floattostr(strtofloatdef(Edit4.Text,0)); end; if (wwDBComboBox7.Text='等于') then begin str:=str+' and g.毛利润='+floattostr(strtofloatdef(Edit4.Text,0)); end; if (wwDBComboBox7.Text='不等于') then begin str:=str+' and g.毛利润<>'+floattostr(strtofloatdef(Edit4.Text,0)); end; end; t_op_letter_pc.close; t_op_letter_pc.sql.clear; t_op_letter_pc.sql.add('select t.*,g.利润RMB 冲销金额RMB,g.利润USD 冲销金额USD,g.毛利润 冲销合计,a.会计期间,a.委托单位,(SELECT 部门名称 from t_sys_employee where 姓名=t.申请人) 部门名称,tt.利润RMB 合计利润RMB,tt.利润USD 合计利润USD,tt.毛利润 合计利润 '); t_op_letter_pc.sql.add('from t_op_gain_cx t left join t_op_gain g on (g.编号=t.更改单编号) '); t_op_letter_pc.sql.add('left join t_op_seae a on (a.编号=t.更改单编号) '); t_op_letter_pc.sql.add('left join (select 主提单号,sum(利润RMB) 利润RMB,sum(利润USD) 利润USD,sum(毛利润) 毛利润 from v_op_bscard group by 主提单号)tt on (tt.主提单号=t.主提单号) '); t_op_letter_pc.sql.add(str); t_op_letter_pc.sql.add(' order by 申请日期 desc'); t_op_letter_pc.open; { t_op_letter_pc.close; t_op_letter_pc.sql.clear; t_op_letter_pc.sql.add('select t.*,''RMB:''+CONVERT(VARCHAR(19),g.利润RMB)+'' USD:''+CONVERT(VARCHAR(19),g.利润USD) 更改单利润 from t_op_gain_cx t left join t_op_gain g on (g.编号=t.更改单编号) '+str); t_op_letter_pc.sql.add(' order by 申请日期 desc'); t_op_letter_pc.open; } t_op_seaeAmend.Close; t_op_seaeAmend.SQL.Text:='select top 1 * from t_op_seae where 编号='''+t_op_letter_pc.fieldbyname('更改单编号').AsString+''''; t_op_seaeAmend.Open; end; procedure Tfrm_op_truck.bsSkinButton6Click(Sender: TObject); begin Edit1.text:=''; Edit2.text:=''; wwDBComboBox44.text:=''; end; procedure Tfrm_op_truck.dxDBGrid1ColumnSorting(Sender: TObject; Column: TdxDBTreeListColumn; var Allow: Boolean); begin // Column_sort(Column,t_op_seae,'业务编号'); end; procedure Tfrm_op_truck.FormShow(Sender: TObject); var str:string; begin if if_open('420') or if_open('421') then begin bsSkinSpeedButton4.Visible:=true; bsSkinSpeedButton5.Visible:=True; Label16.Visible:=true; RxDBLookupCombo14.Visible:=true; end else begin bsSkinSpeedButton4.Visible:=false; bsSkinSpeedButton5.Visible:=false; Label16.Visible:=false; RxDBLookupCombo14.Visible:=false; end; bsSkinPageControl1.ActivePageIndex:=0; frm_op_truck_insert:=true; str:=str+' where t.状态<>''审核通过'' '; if if_open('422') then begin end else if if_open('420') then begin str:=str+' and (t.申请人 in (select 姓名 from t_sys_employee where 部门名称='+''''+department+''')'; str:=str+' or t.申请人 in (select 姓名 from t_sys_employee where 部门名称 in (select 部门名称 from t_sys_department where 部门经理='+''''+employee+'''))) '; end else if if_open('421') then begin str:=str+' and t.冲销类别=''财务审批'' '; end else begin str:=str+' and t.申请人='+''''+employee+''''; end; { t_op_letter_pc.close; t_op_letter_pc.sql.clear; t_op_letter_pc.sql.add('select top 100 t.*,''RMB:''+CONVERT(VARCHAR(19),g.利润RMB)+'' USD:''+CONVERT(VARCHAR(19),g.利润USD) 更改单利润 from t_op_gain_cx t left join t_op_gain g on (g.编号=t.更改单编号) '+str); t_op_letter_pc.sql.add(' order by 申请日期 desc'); t_op_letter_pc.open; } t_op_letter_pc.close; t_op_letter_pc.sql.clear; t_op_letter_pc.sql.add('select top 100 t.*,g.利润RMB 冲销金额RMB,g.利润USD 冲销金额USD,g.毛利润 冲销合计,a.会计期间,a.委托单位,(SELECT 部门名称 from t_sys_employee where 姓名=t.申请人) 部门名称,tt.利润RMB 合计利润RMB,tt.利润USD 合计利润USD,tt.毛利润 合计利润 '); t_op_letter_pc.sql.add('from t_op_gain_cx t left join t_op_gain g on (g.编号=t.更改单编号) '); t_op_letter_pc.sql.add('left join t_op_seae a on (a.编号=t.更改单编号) '); t_op_letter_pc.sql.add('left join (select 主提单号,sum(利润RMB) 利润RMB,sum(利润USD) 利润USD,sum(毛利润) 毛利润 from v_op_bscard group by 主提单号)tt on (tt.主提单号=t.主提单号) '); t_op_letter_pc.sql.add(str); t_op_letter_pc.sql.add(' order by 申请日期 desc'); t_op_letter_pc.open; t_op_seaeAmend.Close; t_op_seaeAmend.SQL.Text:='select top 1 * from t_op_seae where 编号='''+t_op_letter_pc.fieldbyname('更改单编号').AsString+''''; t_op_seaeAmend.Open; if if_open('422') then begin t_sys_employee.Close; t_sys_employee.SQL.Clear; t_sys_employee.SQL.Add(' select 部门经理 as 姓名 from t_sys_department where 部门经理<>'''''); t_sys_employee.SQL.Add(' union select 姓名 from t_sys_employee where 是否主管=''是'' '); t_sys_employee.SQL.Add(' union select ''田力弘'' as 姓名 '); t_sys_employee.SQL.Add(' union select ''刘逢春'' as 姓名 '); t_sys_employee.SQL.Add(' union select ''赵静'' as 姓名 '); t_sys_employee.Open; end else if if_open('421') then begin t_sys_employee.Close; t_sys_employee.SQL.Clear; t_sys_employee.SQL.Add(' select ''刘逢春'' as 姓名 '); t_sys_employee.Open; end else begin t_sys_employee.Close; t_sys_employee.SQL.Clear; t_sys_employee.SQL.Add(' select 部门经理 as 姓名 from t_sys_department where 部门名称='''+department+''''); t_sys_employee.SQL.Add(' union select 姓名 from t_sys_employee where 是否主管=''是'' and 部门名称='''+department+''''); t_sys_employee.SQL.Add(' union select ''田力弘'' as 姓名 '); t_sys_employee.SQL.Add(' union select ''赵静'' as 姓名 '); t_sys_employee.Open; end; end; procedure Tfrm_op_truck.Edit1KeyPress(Sender: TObject; var Key: Char); begin if key=#13 then begin key:=#0; frm_op_truck.bsSkinButton10Click(Sender); end; end; procedure Tfrm_op_truck.Button1Click(Sender: TObject); begin if t_op_letter_pc.IsEmpty then exit; end; procedure Tfrm_op_truck.dxDBGrid1DblClick(Sender: TObject); begin if (not fra_fee1.t_ch_accept.Active) then LoadFee(); t_op_seaeAmend.Close; t_op_seaeAmend.SQL.Text:='select top 1 * from t_op_seae where 编号='''+t_op_letter_pc.fieldbyname('更改单编号').AsString+''''; t_op_seaeAmend.Open; bsSkinTabSheet2.Show; end; procedure Tfrm_op_truck.bsSkinButton15Click(Sender: TObject); var aQuery:TADOQuery; begin if t_op_letter_pc.state in [dsedit,dsinsert] then t_op_letter_pc.post; { if not t_op_letter_pc.FieldByName('是否打印').asboolean then begin t_op_letter_pc.Edit; t_op_letter_pc['是否打印']:=1; t_op_letter_pc.post; end; } sys_print('利润冲销',2,nil,nil,nil,nil,t_op_letter_pc1,nil,nil,nil,nil,nil,nil); aQuery:=CreateAdoQuery; try With aQuery do begin close;SQL.Clear; SQL.Add('update t_op_gain_cx set 是否打印=1 where LE_ID='+t_op_letter_pc.fieldbyname('LE_ID').AsString); ExecSQL; end; finally FreeAndNil(aQuery); end; end; procedure Tfrm_op_truck.t_op_letter_pcBeforeEdit(DataSet: TDataSet); begin { if t_op_letter_pc.FieldByName('是否打印').AsBoolean then begin showmessage('当前业务以及打印,不能修改!!'); abort; end; } if (t_op_letter_pc.FieldByName('状态').AsString='审核通过') then begin showmessage('当前状态,不能修改!!'); abort; end; end; procedure Tfrm_op_truck.t_op_letter_pcBeforeDelete(DataSet: TDataSet); begin { if t_op_letter_pc.FieldByName('是否打印').AsBoolean then begin showmessage('当前业务以及打印,不能修改!!'); abort; end; } if t_op_letter_pc.FieldByName('状态').AsString='审核通过' then begin showmessage('当前状态,不能删除!!'); abort; end; if (t_op_letter_pc.FieldByName('申请人').AsString<>employee) then begin showmessage('只有申请人本人才能删除!!'); abort; end; end; procedure Tfrm_op_truck.bsSkinButton16Click(Sender: TObject); begin if (t_op_letter_pc.State=dsinsert)or(t_op_letter_pc.State=dsedit) then t_op_letter_pc.Post; end; procedure Tfrm_op_truck.bsSkinButton1Click(Sender: TObject); begin t_op_letter_pc.insert; t_op_seaeAmend.Close; t_op_seaeAmend.SQL.Text:='select top 0 * from t_op_seae'; t_op_seaeAmend.Open; if (not fra_fee1.t_ch_accept.Active) then LoadFee(); bsSkinTabSheet2.Show; end; procedure Tfrm_op_truck.DBEdit10KeyPress(Sender: TObject; var Key: Char); var aAdoQuery:TAdoQuery; begin if key=#13 then begin key:=#0; if not t_op_letter_pc.FieldByName('是否打印').AsBoolean then begin if (t_op_letter_pc.State=dsinsert)or(t_op_letter_pc.State=dsedit) then t_op_letter_pc.Post; aAdoQuery:=CreateAdoQuery; with aAdoQuery do try Close;SQL.Clear; SQL.Add('select * from t_op_seae'); SQL.Add('where 主提单号=:主提单号 and 业务类型=''普通货'' and (费用状态=''提交财务'' or 费用状态=''费用封帐'') '); Parameters.ParamByName('主提单号').Value:=t_op_letter_pc.FieldByName('主提单号').AsString; Open; if not IsEmpty then begin t_op_letter_pc.Edit; t_op_letter_pc.FieldByName('船名').AsString:=FieldByName('船名').AsString; t_op_letter_pc.FieldByName('航次').AsString:=FieldByName('航次').AsString; t_op_letter_pc.FieldByName('开船日期').value:=FieldByName('开船日期').value; t_op_letter_pc.FieldByName('集装箱').value:=FieldByName('集装箱').value; t_op_letter_pc.FieldByName('装货港').value:=FieldByName('装货港').value; t_op_letter_pc.FieldByName('卸货港').value:=FieldByName('卸货港').value; t_op_letter_pc.FieldByName('业务编号').value:=FieldByName('业务编号').value; t_op_letter_pc['申请人']:=employee; t_op_letter_pc['申请日期']:=date; t_op_letter_pc['状态']:='新建'; Close;SQL.Clear; SQL.Add('select '); SQL.Add(' SUM(CASE t_ch_fee.类型 WHEN ''收'' THEN (case t_ch_fee.币别 when ''USD'' then 金额 else 0 end) ELSE 0 END ) as 应收USD'); SQL.Add(','); SQL.Add(' SUM(CASE t_ch_fee.类型 WHEN ''收'' THEN (case t_ch_fee.币别 when ''RMB'' then 金额 else 0 end) ELSE 0 END ) as 应收RMB'); SQL.Add(','); SQL.Add('SUM(CASE t_ch_fee.类型 WHEN ''付'' THEN (case t_ch_fee.币别 when ''USD'' then 金额 else 0 end) ELSE 0 END ) as 应付USD'); SQL.Add(','); SQL.Add(' SUM(CASE t_ch_fee.类型 WHEN ''付'' THEN (case t_ch_fee.币别 when ''RMB'' then 金额 else 0 end) ELSE 0 END ) as 应付RMB'); SQL.Add('from t_ch_fee'); SQL.Add('where 编号 in (select 编号 from t_op_seae where 主提单号='+''''+t_op_letter_pc.FieldByName('主提单号').AsString+''')'); Open; t_op_letter_pc.FieldByName('利润').value:='RMB:'+FloatToStr(FieldByName('应收RMB').AsFloat-FieldByName('应付RMB').AsFloat)+' USD:'+ FloatToStr(FieldByName('应收USD').AsFloat-FieldByName('应付USD').AsFloat); t_op_letter_pc.Post; end else begin ShowMessage('此票货不存在揽货人是自己,或没有提交财务!'); end; finally Free; end; //showmessage('当前业务以及打印,不能修改!!'); end; end; end; procedure Tfrm_op_truck.bsSkinButton2Click(Sender: TObject); var aQuery:TADOQuery; begin if t_op_letter_pc.FieldByName('状态').AsString='审核通过' then begin showmessage('当前状态,不能删除!!'); exit; end; if (t_op_letter_pc.FieldByName('申请人').AsString<>employee) then begin showmessage('只有申请人本人才能删除!!'); exit; end; t_ch_fee.close; t_ch_fee.SQL.Text:='select * from t_ch_fee where (是否对帐=1 or 结算金额<>0 or 开票金额<>0 or 申请金额<>0 or 冲抵金额<>0) and 编号='''+t_op_letter_pc.fieldbyname('更改单编号').AsString+''''; t_ch_fee.open; if not t_ch_fee.IsEmpty then begin application.MessageBox('业务存在费用,已对账或申请、结算、开票等状态不能直接删除!','警告:',MB_OKCANCEL); t_ch_fee.close; exit; end; t_ch_fee.First; while not t_ch_fee.Eof do begin t_ch_fee.Delete; end; aQuery:=CreateAdoQuery; try with aQuery do begin Close;sql.clear; sql.add('delete from t_op_seae where 编号='''+t_op_letter_pc.fieldbyname('更改单编号').AsString+''''); ExecSQL; Close;sql.clear; sql.add('delete from t_op_gain_cx where LE_ID='+t_op_letter_pc.fieldbyname('LE_ID').AsString); ExecSQL; end; finally FreeAndNil(aQuery); end; t_op_letter_pc.Close; t_op_letter_pc.Open; if t_op_letter_pc.IsEmpty then begin t_op_seaeAmend.Close; t_op_seaeAmend.SQL.Text:='select top 0 * from t_op_seae '; t_op_seaeAmend.Open; end else begin t_op_seaeAmend.Close; t_op_seaeAmend.SQL.Text:='select top 1 * from t_op_seae where 编号='''+t_op_letter_pc.fieldbyname('更改单编号').AsString+''''; t_op_seaeAmend.Open; end; end; procedure Tfrm_op_truck.t_op_letter_pcAfterInsert(DataSet: TDataSet); begin t_op_letter_pc['申请人']:=employee; t_op_letter_pc['申请日期']:=date; end; procedure Tfrm_op_truck.bsSkinSpeedButton1Click(Sender: TObject); var afield : variant; i: Integer; PNO:string; function getamendBsNo(wtbsno:string;mblno:string):string; var aQuery:TAdoQuery; begin aQuery:=CreateAdoQuery; try with aQuery do begin Close;sql.clear; sql.add('select top 1 委托编号 from t_op_seae where 委托编号 like '''+wtbsno+'%'' and 主提单号='''+mblno+''' order by 委托编号 desc '); open; if IsEmpty then Result:=wtbsno else Result:=FieldByName('委托编号').AsString; end; finally FreeAndNil(aQuery); end; end; begin if (DBEdit9.Text<>'') then begin ShowMessage('已生成更改单,不允许重复生成!'); exit; end; if t_op_letter_pc.FieldByName('状态').AsString<>'新建' then begin showmessage('当前状态,不能生成!!'); exit; end; if (t_op_letter_pc.FieldByName('申请人').AsString<>employee) then begin showmessage('只有申请人本人才能修改!!'); abort; end; t_op_seae.Close; t_op_seae.SQL.Clear; t_op_seae.SQL.Text:='select top 1 * from t_op_seae where 业务编号='''+t_op_letter_pc.fieldbyname('业务编号').AsString+''''; t_op_seae.open; if t_op_seae.IsEmpty then begin showmessage('业务不存在,不能生成更改单!'); exit; end; t_op_seaeAmend.Close; t_op_seaeAmend.SQL.Text:='select top 0 * from t_op_seae'; t_op_seaeAmend.Open; afield := vararraycreate([0,t_op_seae.fieldcount-1],varvariant); for i := 0 to (t_op_seae.fieldcount-1) do begin afield[i] :=t_op_seae.fields[i].value ; end; t_op_seaeAmend.append; for i := 0 to (t_op_seae.fieldcount-1) do begin t_op_seaeAmend.fields[i].value := afield[i] ; end; t_op_seaeAmend['周次']:=WeekofYear(Date); t_op_seaeAmend['业务类型']:='更改单'; PNO:=Trim(t_op_seae.FieldByName('委托编号').AsString); t_op_seaeAmend['会计期间']:=date; if (strtoint(get_parameters_value(158,'0'))=1) then begin if t_op_seaeAmend['会计期间']>logininfo.endday then t_op_seaeAmend['开船日期']:=t_op_seaeAmend['会计期间']; end; if Trim(PNO)<>'' then t_op_seaeAmend.FieldByName('委托编号').AsString:=getamendBsNo(PNO,t_op_seae.FieldByName('主提单号').AsString)+'*'; t_op_seaeAmend['业务编号']:=get_no(t_op_seaeAmend.fieldbyname('会计期间').AsDateTime,getbsno(Logininfo.SeaExpBsNo,'SE')); t_op_seaeAmend['编号']:=get_id; t_op_seaeAmend['主编号']:=t_op_seaeAmend['编号']; t_op_seaeAmend['装运方式']:='拼箱分票'; t_op_seaeAmend['箱型1']:=0; t_op_seaeAmend['箱型2']:=0; t_op_seaeAmend['箱型3']:=0; t_op_seaeAmend['箱型4']:=0; t_op_seaeAmend['箱型5']:=0; t_op_seaeAmend['箱型6']:=0; t_op_seaeAmend['箱型7']:=0; t_op_seaeAmend['箱型8']:=0; t_op_seaeAmend['箱型9']:=0; t_op_seaeAmend['箱型10']:=0; t_op_seaeAmend['其他箱型']:=0; t_op_seaeAmend['箱TEU']:=0; t_op_seaeAmend['集装箱']:=''; t_op_seaeAmend['箱数大写']:=''; t_op_seaeAmend['计费标准']:=''; t_op_seaeAmend['报关日期']:=null; t_op_seaeAmend['报关员']:=''; t_op_seaeAmend['报关单号']:=''; t_op_seaeAmend['核销单号']:=''; t_op_seaeAmend['手册号']:=''; t_op_seaeAmend['是否退税']:=0; t_op_seaeAmend['退税日期']:=null; t_op_seaeAmend['是否通关']:=0; t_op_seaeAmend['通关日期']:=null; t_op_seaeAmend['危险品分类']:=''; t_op_seaeAmend['危险品编号']:=null; t_op_seaeAmend['冷藏通风量']:=''; t_op_seaeAmend['温度单位']:=''; t_op_seaeAmend['设置温度']:=''; t_op_seaeAmend['最低温度']:=''; t_op_seaeAmend['最高温度']:=''; t_op_seaeAmend['二程开船日期']:=null; t_op_seaeAmend['三程开船日期']:=null; t_op_seaeAmend['二程港口']:=''; t_op_seaeAmend['二程船名']:=''; t_op_seaeAmend['二程航次']:=''; t_op_seaeAmend['箱号封号']:=''; t_op_seaeAmend['分单列表']:=''; t_op_seaeAmend['发票号']:=''; t_op_seaeAmend['商品编码']:=''; t_op_seaeAmend['是否签单']:=0; t_op_seaeAmend['签回日期']:=null; t_op_seaeAmend['请求派车']:=0; t_op_seaeAmend['是否派车']:=0; t_op_seaeAmend['派车日期']:=null; t_op_seaeAmend['是否解锁']:=0; t_op_seaeAmend['解锁日期']:=null; t_op_seaeAmend['解锁人']:=''; t_op_seaeAmend['应收陆运']:=0; t_op_seaeAmend['应付陆运']:=0; t_op_seaeAmend['陆运利润']:=0; t_op_seaeAmend['是否退税']:=0; t_op_seaeAmend['是否通关']:=0; t_op_seaeAmend['是否签单']:=0; t_op_seaeAmend['是否退舱']:=0; t_op_seaeAmend['退税日期']:=null; t_op_seaeAmend['签单日期']:=null; t_op_seaeAmend['派车日期']:=null; t_op_seaeAmend['寄单日期']:=null; t_op_seaeAmend['是否寄单']:=0; t_op_seaeAmend['FEE']:=0; t_op_seaeAmend['FEE2']:=0; t_op_seaeAmend['业务状态']:='接受委托'; t_op_seaeAmend['费用状态']:='录入状态'; t_op_seaeAmend['封帐前状态']:='接受委托'; if t_op_seaeAmend['船公司']<>'CMA' THEN t_op_seaeAmend['运输方式']:=''; t_op_seaeAmend['海尔联系部门']:=''; t_op_seaeAmend['提单签发状态']:=''; t_op_seaeAmend['凭证日期']:=null; t_op_seaeAmend['财务']:=0; t_op_seaeAmend['财务凭证']:=''; t_op_seaeAmend['备案号']:=''; t_op_seaeAmend['运抵国']:=''; t_op_seaeAmend['境内货源地']:=''; t_op_seaeAmend['批准文号']:=''; t_op_seaeAmend['成交方式']:=''; t_op_seaeAmend['净重']:=0; t_op_seaeAmend['单价']:=''; t_op_seaeAmend['总价']:=''; t_op_seaeAmend['商品名称']:=''; t_op_seaeAmend['数量单位']:=''; t_op_seaeAmend['接单日期']:=null; t_op_seaeAmend['报检日期']:=null; t_op_seaeAmend['报检单号']:=''; t_op_seaeAmend['验货时间']:=null; t_op_seaeAmend['实验时间']:=null; t_op_seaeAmend['熏蒸时间']:=null; t_op_seaeAmend['出证时间']:=null; t_op_seaeAmend['实验内容']:=''; t_op_seaeAmend['币制']:=''; t_op_seaeAmend['财务']:=0; t_op_seaeAmend['财务凭证2']:=''; t_op_seaeAmend['是否打印']:=0; t_op_seaeAmend['费用封帐日期']:=null; t_op_seaeAmend['提交财务日期']:=null; t_op_seaeAmend['总价']:='0'; t_op_seaeAmend['第二通知人']:=''; t_op_seaeAmend['内部航次号']:=''; t_op_seaeAmend['DOOR地址']:=''; t_op_seaeAmend['自责更改']:='0'; t_op_seaeAmend['应收海运费']:=0; t_op_seaeAmend['应付海运费']:=0; t_op_seaeAmend['船公司代理费']:=0; t_op_seaeAmend['捷丰代理费']:=0; t_op_seaeAmend['拖车数']:=0; t_op_seaeAmend['报关数']:=0; t_op_seaeAmend['代理数']:=0; t_op_seaeAmend['拼箱整箱']:=0; t_op_seaeAmend['舱单申报']:=''; t_op_seaeAmend['合计20']:=0; t_op_seaeAmend['合计40']:=0; t_op_seaeAmend['合计40H']:=0; t_op_seaeAmend['合计45']:=0; t_op_seaeAmend['集团成本']:=0; t_op_seaeAmend['主提单标准']:=t_op_seaeAmend['编号']; t_op_seaeAmend['分提单标准']:=t_op_seaeAmend['编号']; t_op_seaeAmend['委托标准']:=t_op_seaeAmend['编号']; t_op_seaeAmend['核销标准']:=t_op_seaeAmend['编号']; t_op_seaeAmend['报关标准']:=t_op_seaeAmend['编号']; t_op_seaeAmend['报检标准']:=t_op_seaeAmend['编号']; t_op_seaeAmend.Post; t_op_letter_pc.Edit; t_op_letter_pc.FieldByName('更改单编号').Value:=t_op_seaeAmend['编号']; t_op_letter_pc.FieldByName('更改单业务编号').Value:=t_op_seaeAmend['业务编号']; t_op_letter_pc.FieldByName('更改单委托编号').Value:=t_op_seaeAmend['委托编号']; t_op_letter_pc.post; t_op_seaeAmend.Close; t_op_seaeAmend.SQL.Text:='select top 1 * from t_op_seae where 编号='''+t_op_letter_pc.FieldByName('更改单编号').AsString+''''; t_op_seaeAmend.Open; end; procedure Tfrm_op_truck.bsSkinSpeedButton2Click(Sender: TObject); var isfee:Boolean; znjamount:Double; begin if (t_op_letter_pc.FieldByName('状态').AsString<>'新建') and (t_op_letter_pc.FieldByName('状态').AsString<>'驳回提交') then begin showmessage('当前状态,不能生成!!'); exit; end; if t_op_letter_pc.FieldByName('冲销类别').AsString='' then begin showmessage('冲销类别不能为空!!'); exit; end; if t_op_letter_pc.FieldByName('备注').AsString='' then begin showmessage('冲销原因不能为空!!'); exit; end; if (fra_fee1.t_ch_accept.RecordCount=0) and (fra_fee1.t_ch_pay.RecordCount=0) then begin showmessage('费用明细不能为空!!'); exit; end; isfee:=False; fra_fee1.t_ch_accept.first; while not fra_fee1.t_ch_accept.eof do begin if (fra_fee1.t_ch_accept.fieldbyname('费用名称').asstring='')or (fra_fee1.t_ch_accept.fieldbyname('客户名称').asstring='')or (fra_fee1.t_ch_accept.fieldbyname('币别').asstring='') then begin ShowMessage('客户名称,费用名称,币别不能为空!'); isfee:=True; end; if (fra_fee1.t_ch_accept.fieldbyname('单价').asfloat=0) or (fra_fee1.t_ch_accept.fieldbyname('数量').asfloat=0) or (fra_fee1.t_ch_accept.fieldbyname('金额').asfloat=0) or ((fra_fee1.t_ch_accept.fieldbyname('币别').asstring='RMB') and (fra_fee1.t_ch_accept.fieldbyname('汇率').asfloat<>1)) or ((fra_fee1.t_ch_accept.fieldbyname('币别').asstring<>'RMB') and (fra_fee1.t_ch_accept.fieldbyname('汇率').asfloat=1)) or ((fra_fee1.t_ch_accept.fieldbyname('币别').asstring<>'RMB') AND (fra_fee1.t_ch_accept.fieldbyname('币别').asstring<>'USD') ) then begin ShowMessage('单价或数量、金额为0、汇率输入不正确!'); isfee:=True; end; if (fra_fee1.t_ch_accept.fieldbyname('费用名称').asstring='滞纳金') then begin znjamount:=znjamount+fra_fee1.t_ch_accept.fieldbyname('金额').asfloat*fra_fee1.t_ch_accept.fieldbyname('汇率').asfloat; end; fra_fee1.t_ch_accept.Next; end; fra_fee1.t_ch_pay.first; while not fra_fee1.t_ch_pay.eof do begin if (fra_fee1.t_ch_pay.fieldbyname('费用名称').asstring='')or (fra_fee1.t_ch_pay.fieldbyname('客户名称').asstring='')or (fra_fee1.t_ch_pay.fieldbyname('币别').asstring='') then begin ShowMessage('客户名称,费用名称,币别不能为空!'); isfee:=True; end; if (fra_fee1.t_ch_pay.fieldbyname('单价').asfloat=0) or (fra_fee1.t_ch_pay.fieldbyname('数量').asfloat=0) or (fra_fee1.t_ch_pay.fieldbyname('金额').asfloat=0) or ((fra_fee1.t_ch_pay.fieldbyname('币别').asstring='RMB') and (fra_fee1.t_ch_pay.fieldbyname('汇率').asfloat<>1)) or ((fra_fee1.t_ch_pay.fieldbyname('币别').asstring<>'RMB') and (fra_fee1.t_ch_pay.fieldbyname('汇率').asfloat=1)) or ((fra_fee1.t_ch_pay.fieldbyname('币别').asstring<>'RMB') AND (fra_fee1.t_ch_pay.fieldbyname('币别').asstring<>'USD') ) then begin ShowMessage('单价或数量、金额为0、汇率输入不正确!'); isfee:=True; end; if (fra_fee1.t_ch_accept.fieldbyname('费用名称').asstring='滞纳金') then begin znjamount:=znjamount-(fra_fee1.t_ch_accept.fieldbyname('金额').asfloat*fra_fee1.t_ch_accept.fieldbyname('汇率').asfloat); end; fra_fee1.t_ch_pay.Next; end; if (znjamount<0) then begin ShowMessage('滞纳金利润不能小于0!'); exit; end; if isfee then begin Exit; end; t_op_letter_pc.Edit; t_op_letter_pc.FieldByName('状态').Value:='提交审核'; t_op_letter_pc.post; end; procedure Tfrm_op_truck.bsSkinSpeedButton3Click(Sender: TObject); begin if t_op_letter_pc.FieldByName('状态').AsString<>'提交审核' then begin showmessage('当前状态,不能生成!!'); exit; end; t_op_letter_pc.Edit; t_op_letter_pc.FieldByName('状态').Value:='新建'; t_op_letter_pc.post; end; procedure Tfrm_op_truck.bsSkinSpeedButton4Click(Sender: TObject); var i,LE_ID:integer; aAdoQuery:TAdoQuery; begin if t_op_letter_pc.FieldByName('状态').AsString<>'提交审核' then begin showmessage('当前状态,不能审核!!'); exit; end; if trim(RxDBLookupCombo14.DisplayValue)='' then begin showmessage('审核人不能为空!!'); exit; end; UpdateopseaeStatus(t_op_seaeAmend.fieldbyname('编号').AsString,'公司货',trim(RxDBLookupCombo14.DisplayValue)); fra_fee1.t_ch_accept.Close; fra_fee1.t_ch_accept.open; fra_fee1.t_ch_pay.Close; fra_fee1.t_ch_pay.open; fra_fee1.t_op_gain.Close; fra_fee1.t_op_gain.open; aAdoQuery:=CreateadoQuery; with aAdoQuery do try { Close;sql.Clear; SQL.Add('Update t_op_seae set 费用状态=''费用封帐'''); SQL.Add('where 编号=:编号'); Parameters.ParamByName('编号').Value:=t_op_seaeAmend.fieldbyname('编号').AsString; ExecSQL; } Close;sql.Clear; SQL.Add('Update t_op_gain_cx set 状态=''审核通过'',审核人=:审核人,审核日期='''+formatdatetime('YYYY-MM-DD',date)+''''); SQL.Add('where LE_ID=:LE_ID'); Parameters.ParamByName('审核人').Value:=trim(RxDBLookupCombo14.DisplayValue); Parameters.ParamByName('LE_ID').Value:=t_op_letter_pc.fieldbyname('LE_ID').Value; ExecSQL; finally Free; end; t_op_seaeAmend.Close; t_op_seaeAmend.Open; LE_ID:=t_op_letter_pc.fieldbyname('LE_ID').Value; t_op_letter_pc.close; t_op_letter_pc.Open; t_op_letter_pc.Locate('LE_ID',LE_ID,[]); { book1:=t_op_letter_pc.GetBookmark; t_op_letter_pc.Refresh; t_op_letter_pc.GotoBookmark(book1); } end; procedure Tfrm_op_truck.bsSkinSpeedButton5Click(Sender: TObject); var i,LE_ID:integer; aAdoQuery:TAdoQuery; book1:Tbookmark; begin if (t_op_letter_pc.FieldByName('状态').AsString<>'审核通过') and (t_op_letter_pc.FieldByName('状态').AsString<>'提交审核') then begin showmessage('当前状态,不能驳回!!'); exit; end; if (t_op_seae2.DataSet.FieldByName('费用状态').AsString='费用封帐') or (t_op_seae2.DataSet.FieldByName('费用状态').AsString='提交财务') then begin showmessage('费用已经提交财务或封帐,不能驳回!!'); abort; end; aAdoQuery:=CreateadoQuery; with aAdoQuery do try if t_op_letter_pc.FieldByName('状态').AsString='审核通过' then begin Close;sql.Clear; SQL.Add('Update t_op_seae set 业务状态=''接受委托'',费用状态=''录入费用'''); SQL.Add('where 编号=:编号'); Parameters.ParamByName('编号').Value:=t_op_seae2.DataSet.FieldByName('编号').Value; ExecSQL; end; Close;sql.Clear; SQL.Add('Update t_op_gain_cx set 状态=''驳回提交'' '); SQL.Add('where LE_ID=:LE_ID'); Parameters.ParamByName('LE_ID').Value:=t_op_letter_pc.FieldByName('LE_ID').Value; ExecSQL; Close;sql.Clear; SQL.Add('select * from t_ch_fee '); SQL.Add('where (是否对帐=0 or 是否对帐 is null) and 结算金额=0 and 开票金额=0 and 申请金额=0 and 冲抵金额=0 and 编号=:编号'); Parameters.ParamByName('编号').Value:=t_op_seaeAmend.fieldbyname('编号').AsString; open; first; while not eof do begin aAdoQuery.edit; aAdoQuery.fieldbyname('费用状态').AsString:='驳回提交'; aAdoQuery.post; Next; end; finally Free; end; fra_fee1.t_ch_accept.Close; fra_fee1.t_ch_accept.open; fra_fee1.t_ch_pay.Close; fra_fee1.t_ch_pay.open; fra_fee1.t_op_gain.Close; fra_fee1.t_op_gain.open; LE_ID:=t_op_letter_pc.fieldbyname('LE_ID').Value; t_op_letter_pc.close; t_op_letter_pc.Open; t_op_letter_pc.Locate('LE_ID',LE_ID,[]); end; procedure Tfrm_op_truck.LoadFee; begin try 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:=23; frm_sys_progress.bsSkinGauge1.MinValue:=0; frm_sys_progress.bsSkinGauge1.Value:=0; frm_sys_progress.Update; frm_sys_progress.bsSkinGauge1.ProgressText:='加载出口应收列表'; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; //1 loadwwgrid(fra_fee1.wwDBGrid1,'海运出口应收'); frm_sys_progress.bsSkinGauge1.ProgressText:='加载出口应付列表'; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; //2 loadwwgrid(fra_fee1.wwDBGrid2,'海运出口应付'); frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; //3 fra_fee1.edit_type.text:='1'; fra_fee1.edit_data.text:='0001'; fra_fee1.edit_report.text:='海运出口'; fra_fee1.t_ch_accept.DataSource:=t_op_seae2; if strtobool(get_parameters_value(150,'false')) then fra_fee1.bsSkinPanel3.Visible:=true; fra_fee1.DBEdit48.DataSource:=t_op_seae2; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; //4 if if_open('293') then begin fra_fee1.t_ch_accept.DataSource:=t_op_seae2; frm_sys_progress.bsSkinGauge1.ProgressText:='加载出口应收数据'; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; //5 if (strtobool(get_parameters_value(153,'false'))=true) then begin if (strtobool(get_parameters_value(64,'false'))=true) and (if_open('206')=false) then begin fra_fee1.t_ch_accept.close; fra_fee1.t_ch_accept.SQL.Clear; fra_fee1.t_ch_accept.SQL.Add('select top 100 * from t_ch_fee where 类型=' +''''+'收'+''''+' and 编号=:编号 and (录入人=' +''''+employee+''''+' or (录入人<>'+''''+employee+'''' +' and 机密<>1) ) and '+open_data('7000','录入人','no','no','no','no') +' order by 顺序,CH_ID'); end else begin fra_fee1.t_ch_accept.close; fra_fee1.t_ch_accept.SQL.Clear; fra_fee1.t_ch_accept.SQL.Add('select top 100 * from t_ch_fee where 类型=' +''''+'收'+''''+' and 编号=:编号 and ' +open_data('7000','录入人','no','no','no','no') +' order by 顺序,CH_ID'); end; fra_fee1.t_ch_accept.open; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; //6 end else begin if (strtobool(get_parameters_value(64,'false'))=true) and (if_open('206')=false) then begin fra_fee1.t_ch_accept.close; fra_fee1.t_ch_accept.SQL.Clear; fra_fee1.t_ch_accept.SQL.Add('select top 100 * from t_ch_fee where 类型=' +''''+'收'+''''+' and 编号=:编号 and (录入人=' +''''+employee+''''+' or (录入人<>'+''''+employee+'''' +' and 机密<>1) ) order by 顺序,CH_ID'); end; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; fra_fee1.t_ch_accept.open; end; frm_sys_progress.bsSkinGauge1.ProgressText:='加载申请数据'; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; fra_fee1.a_shen_delete.open; frm_sys_progress.bsSkinGauge1.ProgressText:='加载修改旧数据'; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; fra_fee1.a_shen_modify_old.open; frm_sys_progress.bsSkinGauge1.ProgressText:='加载修改新数据'; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; fra_fee1.a_shen_modify_new.open; frm_sys_progress.bsSkinGauge1.ProgressText:='加载修合计数据'; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; fra_fee1.Panel3.visible:=true; end else fra_fee1.Panel3.visible:=false; frm_sys_progress.bsSkinGauge1.ProgressText:='加载应付数据'; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; if if_open('294') then begin fra_fee1.t_ch_pay.DataSource:=t_op_seae2; if (strtobool(get_parameters_value(153,'false'))=true) then begin if (strtobool(get_parameters_value(64,'false'))=true) and (if_open('206')=false) then begin fra_fee1.t_ch_pay.close; fra_fee1.t_ch_pay.SQL.Clear; fra_fee1.t_ch_pay.SQL.Add('select top 100 * from t_ch_fee where 类型=' +''''+'付'+''''+' and 编号=:编号 and (录入人=' +''''+employee+''''+' or (录入人<>'+''''+employee+'''' +' and 机密<>1) ) and '+open_data('7000','录入人','no','no','no','no') +' order by 顺序,CH_ID'); end else begin fra_fee1.t_ch_pay.close; fra_fee1.t_ch_pay.SQL.Clear; fra_fee1.t_ch_pay.SQL.Add('select top 100 * from t_ch_fee where 类型=' +''''+'付'+''''+' and 编号=:编号 and ' +open_data('7000','录入人','no','no','no','no') +' order by 顺序,CH_ID'); end; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; fra_fee1.t_ch_pay.open; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; end else begin if (strtobool(get_parameters_value(64,'false'))=true) and (if_open('206')=false) then begin fra_fee1.t_ch_pay.close; fra_fee1.t_ch_pay.SQL.Clear; fra_fee1.t_ch_pay.SQL.Add('select top 100 * from t_ch_fee where 类型=' +''''+'付'+''''+' and 编号=:编号 and (录入人=' +''''+employee+''''+' or (录入人<>'+''''+employee+'''' +' and 机密<>1) ) order by 顺序,CH_ID'); end; fra_fee1.t_ch_pay.open; end; frm_sys_progress.bsSkinGauge1.ProgressText:='加载申请数据'; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; fra_fee1.p_shen_delete.open; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_sys_progress.bsSkinGauge1.ProgressText:='加载修改旧数据'; fra_fee1.p_shen_modify_old.open; frm_sys_progress.bsSkinGauge1.ProgressText:='加载修改新数据'; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; fra_fee1.p_shen_modify_new.open; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; frm_sys_progress.bsSkinGauge1.ProgressText:='加载合计数据'; fra_fee1.Panel1.visible:=true; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; end else fra_fee1.Panel1.visible:=false; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; if fra_fee1.Panel1.visible and fra_fee1.Panel3.visible then begin if if_open('226') then fra_fee1.Panel8.Visible:=true else fra_fee1.Panel8.Visible:=false; frm_sys_progress.bsSkinGauge1.ProgressText:='加载利润1数据'; fra_fee1.t_op_gain.DataSource:=t_op_seae2; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; fra_fee1.t_op_gain.open; frm_sys_progress.bsSkinGauge1.ProgressText:='加载利润2数据'; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; fra_fee1.DBEdit43.DataSource:=t_op_seae2; fra_fee1.t_op_gain_main.DataSource:=t_op_seae2; frm_sys_progress.bsSkinGauge1.ProgressText:='加载利润3数据'; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; fra_fee1.t_op_gain_main.open; frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; end else begin fra_fee1.Panel8.Visible:=false; end; // frm_data_share.t_crm_client.requery; // frm_data_share.t_code_currency.requery; finally frm_sys_progress.close; frm_sys_progress:=nil; end; end; procedure Tfrm_op_truck.UnLoadFee; begin end; procedure Tfrm_op_truck.bsSkinPageControl1Change(Sender: TObject); begin if (frm_op_truck_insert) then begin if (bsSkinPageControl1.TabIndex=1) then begin if (not fra_fee1.t_ch_accept.Active) then LoadFee(); t_op_seaeAmend.Close; t_op_seaeAmend.SQL.Text:='select top 1 * from t_op_seae where 编号='''+t_op_letter_pc.fieldbyname('更改单编号').AsString+''''; t_op_seaeAmend.Open; end; end; end; procedure Tfrm_op_truck.dxDBGrid1Column11CustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean); var strstatus:string; begin strstatus:=ANode.Strings[dxDBGrid1Column11.Index]; if strstatus='审核通过' then AColor:=$0080FF00 else if strstatus='提交审核' then AColor:=clyellow else if strstatus='驳回提交' then AColor:=clred else AColor:=clwhite; AFont.Color:=clblack; end; procedure Tfrm_op_truck.DBEdit13Change(Sender: TObject); var strstatus:string; begin strstatus:=DBEdit13.Text; if strstatus='审核通过' then DBEdit13.Color:=$0080FF00 else if strstatus='提交审核' then DBEdit13.Color:=clyellow else if strstatus='驳回提交' then DBEdit13.Color:=clred else DBEdit13.Color:=clwhite; end; procedure Tfrm_op_truck.bsSkinButton3Click(Sender: TObject); begin grid_save_xls(dxdbgrid1); end; procedure Tfrm_op_truck.dxDBGrid1Column25CustomDraw(Sender: TObject; ACanvas: TCanvas; ARect: TRect; ANode: TdxTreeListNode; AColumn: TdxDBTreeListColumn; const AText: String; AFont: TFont; var AColor: TColor; ASelected, AFocused: Boolean; var ADone: Boolean); var ttllr:Double; begin if (Trim(ANode.Strings[dxDBGrid1Column22.Index])='大客户组') or (Trim(ANode.Strings[dxDBGrid1Column22.Index])='订舱代理1组') or (Trim(ANode.Strings[dxDBGrid1Column22.Index])='订舱代理2组') then begin if strtofloatdef(AText,0)<=-5000 then AColor:=clRed else if strtofloatdef(AText,0)<=-2000 then AColor:=clyellow; end else begin ttllr:=StrToFloatDef(Trim(ANode.Strings[dxDBGrid1Column28.Index]),0); if ttllr<0 then begin if strtofloatdef(AText,0)<=-1500 then AColor:=clRed else if strtofloatdef(AText,0)<=-800 then AColor:=clyellow; end else begin if strtofloatdef(AText,0)<=-4000 then AColor:=clRed else if strtofloatdef(AText,0)<=-2000 then AColor:=clyellow; end; end; end; end.