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.

444 lines
14 KiB
Plaintext

unit u_ch_fee_se;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, u_fee, Menus, Grids, DBGrids, DB, ADODB,IniFiles;
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_fee1N7Click(Sender: TObject);
procedure fra_fee1bsSkinButton10Click(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);
var inifile1:Tinifile;
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 200 * 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 200 * 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 200 * 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; //6
fra_fee1.t_ch_accept.open;
end;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1; //7
fra_fee1.a_shen_delete.open;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
fra_fee1.a_shen_modify_old.open;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
fra_fee1.a_shen_modify_new.open;
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.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
frm_sys_progress.bsSkinGauge1.ProgressText:='加载应付数据';
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 200 * 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 200 * 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 200 * 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.ProgressText:='加载修改数据';
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
fra_fee1.p_shen_modify_old.open;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
frm_sys_progress.bsSkinGauge1.ProgressText:='加载修改旧数据';
fra_fee1.p_shen_modify_new.open;
frm_sys_progress.bsSkinGauge1.Value:=frm_sys_progress.bsSkinGauge1.Value+1;
fra_fee1.Panel1.visible:=true;
frm_sys_progress.bsSkinGauge1.ProgressText:='加载合计数据';
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:='加载利润数据';
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.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.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;
if strtobool(get_parameters_value(190,'false')) then
begin
fra_fee1.bsSkinButton20.Visible:=true;
fra_fee1.bsSkinButton21.Visible:=true;
end
else
begin
fra_fee1.bsSkinButton20.Visible:=False;
fra_fee1.bsSkinButton21.Visible:=False;
end;
frm_sys_progress.bsSkinGauge1.ProgressText:='加载客户数据';
frm_data_share.t_crm_client.requery;
frm_data_share.t_code_currency.requery;
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
if strtoint(get_parameters_value(197,'0'))<>0 then
fra_fee1.bsSkinComboBox1.ItemIndex:=strtoint(get_parameters_value(197,'0'))-1
else fra_fee1.bsSkinComboBox1.ItemIndex:=inifile1.ReadInteger('FEE','FEEVAT',0);
// fra_fee1.bsSkinComboBox1.ItemIndex:=inifile1.ReadInteger('FEE','FEEVAT',0);
finally
frm_sys_progress.close;
frm_sys_progress:=nil;
inifile1.free;
end;
end;
procedure Tfrm_ch_fee_sea.fra_fee1bsSkinButton1Click(Sender: TObject);
begin
if strtobool(get_parameters_value(307,'false')) then
begin
if (trim(frm_op_seae.t_op_seae2.DataSet.FieldByName('业务类型').AsString)='更改单')
and (frm_op_seae.t_op_seae2.DataSet.FieldByName('更改单状态').AsString<>'审核通过') then
begin
if frm_op_seae.t_op_seae2.DataSet.FieldByName('更改单状态').AsString='提交审核' then
begin
showmessage('已经提交审核,审核通过后可以录入费用');
exit;
end
else
begin
if MessageDlg('更改单需要先提交审核才可以录入费用,是否提交',mtWarning,[mbYes,mbNo],0)=mrYes 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.Post;
end
else
begin
showmessage('更改单必须审核通过,才能录入费用');
exit;
end;
end;
end;
end;
if strtobool(get_parameters_value(307,'false')) then
begin
if (trim(frm_op_seae.t_op_seae2.DataSet.FieldByName('业务类型').AsString)='更改单')
and (frm_op_seae.t_op_seae2.DataSet.FieldByName('更改单状态').AsString='审核通过') then
begin
end
else
if (trim(frm_op_seae.t_op_seae2.DataSet.FieldByName('业务类型').AsString)='更改单')
and (frm_op_seae.t_op_seae2.DataSet.FieldByName('更改单状态').AsString<>'审核通过') then
begin
showmessage('没有审核通过,不能录入费用');
exit;
end;
end;
fra_fee1.bsSkinButton1Click(Sender);
end;
procedure Tfrm_ch_fee_sea.fra_fee1bsSkinButton11Click(Sender: TObject);
begin
fra_fee1.bsSkinButton11Click(Sender);
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);
begin
fra_fee1.bsSkinButton12Click(Sender);
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_fee1N7Click(Sender: TObject);
begin
fra_fee1.N7Click(Sender);
end;
procedure Tfrm_ch_fee_sea.fra_fee1bsSkinButton10Click(Sender: TObject);
begin
if strtobool(get_parameters_value(307,'false')) then
begin
if (trim(frm_op_seae.t_op_seae2.DataSet.FieldByName('业务类型').AsString)='更改单')
and (frm_op_seae.t_op_seae2.DataSet.FieldByName('更改单状态').AsString<>'审核通过') then
begin
if frm_op_seae.t_op_seae2.DataSet.FieldByName('更改单状态').AsString='提交审核' then
begin
showmessage('已经提交审核,审核通过后可以录入费用');
exit;
end
else
begin
if MessageDlg('更改单需要先提交审核才可以录入费用,是否提交',mtWarning,[mbYes,mbNo],0)=mrYes 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.Post;
end
else
begin
showmessage('更改单必须审核通过,才能录入费用');
exit;
end;
end;
end;
end;
if strtobool(get_parameters_value(307,'false')) then
begin
if (trim(frm_op_seae.t_op_seae2.DataSet.FieldByName('业务类型').AsString)='更改单')
and (frm_op_seae.t_op_seae2.DataSet.FieldByName('更改单状态').AsString='审核通过') then
begin
end
else
if (trim(frm_op_seae.t_op_seae2.DataSet.FieldByName('业务类型').AsString)='更改单')
and (frm_op_seae.t_op_seae2.DataSet.FieldByName('更改单状态').AsString<>'审核通过') then
begin
showmessage('没有审核通过,不能录入费用');
exit;
end;
end;
fra_fee1.bsSkinButton10Click(Sender);
end;
end.