You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

390 lines
14 KiB
Plaintext

unit u_ch_fee_se;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, u_fee, Menus;
type
Tfrm_ch_fee_sea = class(TForm)
fra_fee1: Tfra_fee;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormShow(Sender: TObject);
procedure fra_fee1bsSkinButton1Click(Sender: TObject);
procedure fra_fee1bsSkinButton11Click(Sender: TObject);
procedure fra_fee1bsSkinButton9Click(Sender: TObject);
procedure fra_fee1N31Click(Sender: TObject);
procedure fra_fee1N127Click(Sender: TObject);
procedure fra_fee1bsSkinButton14Click(Sender: TObject);
procedure fra_fee1bsSkinButton12Click(Sender: TObject);
procedure fra_fee1bsSkinButton6Click(Sender: TObject);
procedure fra_fee1bsSkinButton5Click(Sender: TObject);
procedure fra_fee1DBEdit48Change(Sender: TObject);
procedure fra_fee1Memo1Change(Sender: TObject);
procedure fra_fee1bsSkinDBEdit17Change(Sender: TObject);
procedure fra_fee1N55Click(Sender: TObject);
procedure fra_fee1bsSkinButton7Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
frm_ch_fee_sea: Tfrm_ch_fee_sea;
implementation
uses my_sys_function, u_op_seae, u_data_share, u_main, u_sys_progress;
{$R *.dfm}
procedure Tfrm_ch_fee_sea.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
savewwgrid(fra_fee1.wwDBGrid1,'海运出口应收');
savewwgrid(fra_fee1.wwDBGrid2,'海运出口应付');
frm_ch_fee_sea.Hide;
frm_ch_fee_sea.ManualFloat(frm_ch_fee_sea.BoundsRect );
action:=cafree;
frm_ch_fee_sea:=nil;
end;
procedure Tfrm_ch_fee_sea.FormShow(Sender: TObject);
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:=frm_op_seae.t_op_seae2;
if strtobool(get_parameters_value(150,'false')) then
fra_fee1.bsSkinPanel3.Visible:=true;
fra_fee1.DBEdit48.DataSource:=frm_op_seae.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:=frm_op_seae.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 500 * from t_ch_fee With(NoLock) 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 500 * from t_ch_fee With(NoLock) 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 500 * from t_ch_fee With(NoLock) 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
frm_ch_fee_sea.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:=frm_op_seae.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 500 * from t_ch_fee With(NoLock) 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 500 * from t_ch_fee With(NoLock) 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 500 * from t_ch_fee With(NoLock) 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:=frm_op_seae.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:=frm_op_seae.t_op_seae2;
fra_fee1.t_op_gain_main.DataSource:=frm_op_seae.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_ch_fee_sea.fra_fee1bsSkinButton1Click(Sender: TObject);
begin
fra_fee1.bsSkinButton1Click(Sender);
end;
procedure Tfrm_ch_fee_sea.fra_fee1bsSkinButton11Click(Sender: TObject);
var Reasons:string;
begin
if pos('舱单',employee)>0 then
fra_fee1.bsSkinButton11Click(Sender)
else
if (frm_op_seae.t_op_seae2.DataSet.FieldByName('费用状态').AsString='录入状态')
or (frm_op_seae.t_op_seae2.DataSet.FieldByName('费用状态').AsString='录入费用')
or (frm_op_seae.t_op_seae2.DataSet.FieldByName('费用状态').AsString='提交审核')
then
begin
if GetopseaeStatus(False,frm_op_seae.t_op_seae2.DataSet.FieldByName('编号').AsString,Trim(frm_op_seae.t_op_seae2.DataSet.FieldByName('揽货人').AsString),Trim(frm_op_seae.t_op_seae2.DataSet.FieldByName('主提单号').AsString),Trim(frm_op_seae.t_op_seae2.DataSet.FieldByName('船名').AsString),Trim(frm_op_seae.t_op_seae2.DataSet.FieldByName('航次').AsString),Trim(frm_op_seae.t_op_seae2.DataSet.FieldByName('场站').AsString),Trim(frm_op_seae.t_op_seae2.DataSet.FieldByName('业务类型').AsString),Reasons,Trim(frm_op_seae.t_op_seae2.DataSet.FieldByName('委托单位').AsString),Trim(frm_op_seae.t_op_seae2.DataSet.FieldByName('分提单号').AsString)) then
begin
ShowMessage('费用信息不符合要求,不能提交财务原因如下'+#13#10+Reasons);
end
else
begin
fra_fee1.bsSkinButton11Click(Sender);
end;
end
else
begin
ShowMessage('费用状态为:'+frm_op_seae.t_op_seae2.DataSet.FieldByName('费用状态').AsString+',不能提交财务');
end;
end;
procedure Tfrm_ch_fee_sea.fra_fee1bsSkinButton9Click(Sender: TObject);
begin
fra_fee1.bsSkinButton9Click(Sender);
end;
procedure Tfrm_ch_fee_sea.fra_fee1N31Click(Sender: TObject);
begin
fra_fee1.N31Click(Sender);
end;
procedure Tfrm_ch_fee_sea.fra_fee1N127Click(Sender: TObject);
begin
fra_fee1.N127Click(Sender);
end;
procedure Tfrm_ch_fee_sea.fra_fee1bsSkinButton14Click(Sender: TObject);
begin
fra_fee1.bsSkinButton14Click(Sender);
end;
procedure Tfrm_ch_fee_sea.fra_fee1bsSkinButton12Click(Sender: TObject);
var Reasons:string;
begin
if pos('舱单',employee)>0 then
fra_fee1.bsSkinButton12Click(Sender)
else
if (frm_op_seae.t_op_seae2.DataSet.FieldByName('费用状态').AsString='录入状态')
or (frm_op_seae.t_op_seae2.DataSet.FieldByName('费用状态').AsString='录入费用')
or (frm_op_seae.t_op_seae2.DataSet.FieldByName('费用状态').AsString='提交审核')
then
begin
if (trim(frm_op_seae.t_op_seae2.DataSet.FieldByName('业务类型').AsString)<>'更改单') then begin
if (trim(frm_op_seae.t_op_seae2.DataSet.FieldByName('客服员').AsString)<>trim(frm_op_seae.t_op_seae2.DataSet.FieldByName('操作员').AsString)) then
begin
if GetopseaeStatus_cr(False,frm_op_seae.t_op_seae2.DataSet.FieldByName('编号').AsString,Trim(frm_op_seae.t_op_seae2.DataSet.FieldByName('揽货人').AsString),Trim(frm_op_seae.t_op_seae2.DataSet.FieldByName('主提单号').AsString),Trim(frm_op_seae.t_op_seae2.DataSet.FieldByName('船名').AsString),Trim(frm_op_seae.t_op_seae2.DataSet.FieldByName('航次').AsString),Reasons,Trim(frm_op_seae.t_op_seae2.DataSet.FieldByName('委托单位').AsString)) then
begin
if frm_op_seae.t_op_seae2.DataSet.FieldByName('业务状态').AsString<>'业务封帐' then
begin
frm_op_seae.t_op_seae2.DataSet.Edit;
frm_op_seae.t_op_seae2.DataSet.FieldByName('业务状态').AsString:='应付完毕';
frm_op_seae.t_op_seae2.DataSet.FieldByName('二程到港日期').AsDateTime:=now;
frm_op_seae.t_op_seae2.DataSet.Post;
end;
ShowMessage('费用信息不符合要求,不能提交财务原因如下'+#13#10+Reasons+#13#10+'业务状态自动改为应付完毕');
end
else
begin
fra_fee1.bsSkinButton12Click(Sender);
end;
end
else
begin
fra_fee1.bsSkinButton12Click(Sender);
end;
end else begin
fra_fee1.bsSkinButton12Click(Sender);
end;
end
else
begin
ShowMessage('费用状态为:'+frm_op_seae.t_op_seae2.DataSet.FieldByName('费用状态').AsString+',不能提交财务');
end;
end;
procedure Tfrm_ch_fee_sea.fra_fee1bsSkinButton6Click(Sender: TObject);
begin
fra_fee1.bsSkinButton6Click(Sender);
end;
procedure Tfrm_ch_fee_sea.fra_fee1bsSkinButton5Click(Sender: TObject);
begin
fra_fee1.bsSkinButton5Click(Sender);
end;
procedure Tfrm_ch_fee_sea.fra_fee1DBEdit48Change(Sender: TObject);
begin
fra_fee1.DBEdit48Change(Sender);
end;
procedure Tfrm_ch_fee_sea.fra_fee1Memo1Change(Sender: TObject);
begin
// fra_fee1.fra_fee1Memo1Change(Sender);
end;
procedure Tfrm_ch_fee_sea.fra_fee1bsSkinDBEdit17Change(Sender: TObject);
begin
///
end;
procedure Tfrm_ch_fee_sea.fra_fee1N55Click(Sender: TObject);
begin
fra_fee1.N53Click(Sender);
end;
procedure Tfrm_ch_fee_sea.fra_fee1bsSkinButton7Click(Sender: TObject);
begin
fra_fee1.bsSkinButton7Click(Sender);
end;
end.