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.
365 lines
12 KiB
Plaintext
365 lines
12 KiB
Plaintext
unit u_check_modify;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
Dialogs, BusinessSkinForm, bsSkinCtrls, DB, ADODB, StdCtrls, Mask,
|
|
DBCtrls, wwdblook, RxLookup, RxMemDS;
|
|
|
|
type
|
|
Tfrm_check_modify = class(TForm)
|
|
bsBusinessSkinForm1: TbsBusinessSkinForm;
|
|
bsSkinGroupBox2: TbsSkinGroupBox;
|
|
Label47: TLabel;
|
|
Label49: TLabel;
|
|
Label50: TLabel;
|
|
Label51: TLabel;
|
|
Label52: TLabel;
|
|
Label53: TLabel;
|
|
Label54: TLabel;
|
|
Label55: TLabel;
|
|
wwDBLookupCombo4: TwwDBLookupCombo;
|
|
wwDBLookupCombo3: TwwDBLookupCombo;
|
|
RxDBLookupCombo1: TRxDBLookupCombo;
|
|
RxDBLookupCombo2: TRxDBLookupCombo;
|
|
Edit1: TEdit;
|
|
Edit2: TEdit;
|
|
Edit3: TEdit;
|
|
Edit4: TEdit;
|
|
table_new1: TDataSource;
|
|
t_bz_balance: TRxMemoryData;
|
|
RxMemoryData1: TRxMemoryData;
|
|
ywlb: TEdit;
|
|
chk_pay: TEdit;
|
|
bsSkinButton16: TbsSkinButton;
|
|
bsSkinButton17: TbsSkinButton;
|
|
p_op_gain: TADOStoredProc;
|
|
procedure bsSkinButton16Click(Sender: TObject);
|
|
procedure FormShow(Sender: TObject);
|
|
procedure wwDBLookupCombo3Change(Sender: TObject);
|
|
procedure wwDBLookupCombo4Change(Sender: TObject);
|
|
procedure Edit2Change(Sender: TObject);
|
|
private
|
|
{ Private declarations }
|
|
public
|
|
{ Public declarations }
|
|
end;
|
|
|
|
var
|
|
frm_check_modify: Tfrm_check_modify;
|
|
|
|
implementation
|
|
|
|
uses u_main, u_data_share, my_sys_function;
|
|
|
|
{$R *.dfm}
|
|
|
|
procedure Tfrm_check_modify.bsSkinButton16Click(Sender: TObject);
|
|
var
|
|
feestatus,msgs: string ; //费用状态 审核通过 提交复核
|
|
begin
|
|
if chk_pay.Text='FALSE' then feestatus:='审核通过'
|
|
else if chk_pay.Text='TRUE' then feestatus:='提交复核'
|
|
else if chk_pay.Text='CHKPART' then
|
|
feestatus:=isrechk(table_new1.DataSet.fieldbyname('ch_id').asinteger,
|
|
table_new1.DataSet.fieldbyname('编号').asstring,
|
|
ywlb.text+'应'+table_new1.DataSet.fieldbyname('类型').asstring) ;
|
|
|
|
if (Trim(Edit3.text)='') or (Trim(Edit3.text)='0') then
|
|
begin
|
|
msgs:='费用不能为0或空';
|
|
end;
|
|
|
|
if RxDBLookupCombo1.Value='' then
|
|
begin
|
|
msgs:=msgs+#13#10+'费用名称不能为空';
|
|
end;
|
|
|
|
if RxDBLookupCombo2.Value='' then
|
|
begin
|
|
msgs:=msgs+#13#10+'客户名称不能为空';
|
|
end;
|
|
if wwDBLookupCombo4.Value='' then
|
|
begin
|
|
msgs:=msgs+#13#10+'标准不能为空';
|
|
end;
|
|
|
|
if wwDBLookupCombo3.Value='' then
|
|
begin
|
|
msgs:=msgs+#13#10+'币别不能为空';
|
|
end;
|
|
|
|
if table_new1.DataSet.Locate('客户名称','元增(付费)',[]) then
|
|
begin
|
|
msgs:=msgs+#13#10+'费用已经添加';
|
|
end;
|
|
|
|
if RxDBLookupCombo2.Value<>'元增(付费)' then
|
|
begin
|
|
if MessageDlg('客户名称不等于元增(付费),是否继续添加',mtWarning,[mbyes,mbno],0)<>mryes then
|
|
begin
|
|
msgs:=msgs+#13#10+'客户名称不对';
|
|
end;
|
|
|
|
end;
|
|
|
|
|
|
if msgs<>'' then
|
|
begin
|
|
MessageDlg(msgs, mtConfirmation, [mbYes],0);
|
|
exit;
|
|
end;
|
|
|
|
|
|
table_new1.DataSet.Insert;
|
|
table_new1.DataSet['编号']:=table_new1.DataSet['编号'];
|
|
table_new1.DataSet['标准']:=wwDBLookupCombo4.Value;
|
|
table_new1.DataSet['类型']:='付';
|
|
table_new1.DataSet['费用状态']:=feestatus;
|
|
table_new1.DataSet['审核人']:=employee;
|
|
table_new1.DataSet['审核日期']:=now;
|
|
table_new1.DataSet['录入人']:=employee;
|
|
table_new1.DataSet['录入日期']:=now;
|
|
table_new1.DataSet['提交日期']:=now;
|
|
table_new1.DataSet['币别']:=wwDBLookupCombo3.Value;
|
|
table_new1.DataSet['数量']:=1;
|
|
table_new1.DataSet['汇率']:=FormatFloat('0.00;-0.00;0',StrToFloat(Edit4.text));
|
|
table_new1.DataSet['单价']:=FormatFloat('0.00;-0.00;0',StrToFloat(Edit2.text));
|
|
table_new1.DataSet['金额']:=FormatFloat('0.00;-0.00;0',StrToFloat(Edit3.text));
|
|
table_new1.DataSet['客户名称']:=RxDBLookupCombo2.Value;
|
|
table_new1.DataSet['费用名称']:=RxDBLookupCombo1.Value;
|
|
table_new1.DataSet['结算金额']:=0;
|
|
table_new1.DataSet['开票金额']:=0;
|
|
table_new1.DataSet['申请开票']:=0;
|
|
table_new1.DataSet['申请金额']:=0;
|
|
table_new1.DataSet['冲抵金额']:=0;
|
|
table_new1.DataSet['是否对帐']:=0;
|
|
table_new1.DataSet['是否垫付']:=0;
|
|
table_new1.DataSet['不开发票']:=0;
|
|
table_new1.DataSet['机密']:=0;
|
|
table_new1.DataSet.Post;
|
|
|
|
p_op_gain.Parameters.ParamByName('@con_no').value:=table_new1.DataSet.fieldbyname('编号').asstring;
|
|
p_op_gain.ExecProc;
|
|
|
|
end;
|
|
|
|
procedure Tfrm_check_modify.FormShow(Sender: TObject);
|
|
var
|
|
str_list:Tstringlist;
|
|
i,k,j:integer;
|
|
begin
|
|
wwDBLookupCombo3.Text:='USD';
|
|
//进费用模块需处理
|
|
//生成数据集录入费用时自动计算数量,客户名称
|
|
//海运业务
|
|
if (ywlb.Text='海运出口')or(ywlb.Text='海运进口') then
|
|
begin
|
|
frm_data_share.t_code_fee_unit.Filtered:=false;
|
|
frm_data_share.t_code_fee_unit.Filter:='海运=1';
|
|
frm_data_share.t_code_fee_unit.Filtered:=true;
|
|
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,table_new1.DataSet.DataSource.DataSet.fieldbyname('重量').asfloat/1000);
|
|
t_bz_balance.post;
|
|
t_bz_balance.Append;
|
|
t_bz_balance['one']:='3-尺码';
|
|
t_bz_balance['two']:='尺码';
|
|
if table_new1.DataSet.DataSource.DataSet.fieldbyname('尺码').asfloat>1 then
|
|
t_bz_balance['three']:=table_new1.DataSet.DataSource.DataSet.fieldbyname('尺码').asfloat
|
|
else
|
|
t_bz_balance['three']:=1;
|
|
t_bz_balance.post;
|
|
try
|
|
t_bz_balance.Append;
|
|
t_bz_balance['one']:='4-计费吨';
|
|
t_bz_balance['two']:='计费吨';
|
|
if s_w(4,table_new1.DataSet.DataSource.DataSet.fieldbyname('重量').asfloat/1000)>table_new1.DataSet.DataSource.DataSet.fieldbyname('尺码').asfloat then
|
|
begin
|
|
if s_w(4,table_new1.DataSet.DataSource.DataSet.fieldbyname('重量').asfloat/1000)>1 then
|
|
t_bz_balance['three']:=s_w(4,table_new1.DataSet.DataSource.DataSet.fieldbyname('重量').asfloat/1000)
|
|
else
|
|
t_bz_balance['three']:=1;
|
|
end
|
|
else
|
|
begin
|
|
if table_new1.DataSet.DataSource.DataSet.fieldbyname('尺码').asfloat>1 then
|
|
t_bz_balance['three']:=table_new1.DataSet.DataSource.DataSet.fieldbyname('尺码').asfloat
|
|
else
|
|
t_bz_balance['three']:=1;
|
|
end;
|
|
k:=0;
|
|
t_bz_balance.post;
|
|
t_bz_balance.Append;
|
|
t_bz_balance['one']:='5-TEU';
|
|
t_bz_balance['two']:='TEU';
|
|
t_bz_balance['three']:=table_new1.DataSet.DataSource.DataSet.fieldbyname('箱TEU').asinteger;
|
|
t_bz_balance.post;
|
|
|
|
str_list:=Tstringlist.Create;
|
|
str_list.Text:=table_new1.DataSet.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;
|
|
finally
|
|
str_list.free;
|
|
end;
|
|
|
|
frm_data_share.t_code_fee_unit.First;
|
|
while not frm_data_share.t_code_fee_unit.eof do begin
|
|
t_bz_balance.Append;
|
|
t_bz_balance['one']:=frm_data_share.t_code_fee_unit.fieldbyname('代码').asstring+'-'+frm_data_share.t_code_fee_unit.fieldbyname('标准名称').asstring;
|
|
t_bz_balance['two']:=frm_data_share.t_code_fee_unit.fieldbyname('标准名称').asstring;
|
|
t_bz_balance['three']:=frm_data_share.t_code_fee_unit.fieldbyname('默认数量').asfloat;
|
|
t_bz_balance.post;
|
|
frm_data_share.t_code_fee_unit.next;
|
|
end;
|
|
end;
|
|
|
|
//空运业务
|
|
if (ywlb.Text='空运出口')or(ywlb.Text='空运进口') then
|
|
begin
|
|
try
|
|
frm_data_share.t_code_fee_unit.Filtered:=false;
|
|
frm_data_share.t_code_fee_unit.Filter:='空运=1';
|
|
frm_data_share.t_code_fee_unit.Filtered:=true;
|
|
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,table_new1.DataSet.DataSource.DataSet.fieldbyname('计价重量').asfloat);
|
|
t_bz_balance.post;
|
|
t_bz_balance.Append;
|
|
t_bz_balance['one']:='3-件数';
|
|
t_bz_balance['two']:='件数';
|
|
t_bz_balance['three']:=table_new1.DataSet.DataSource.DataSet.fieldbyname('件数').asfloat;
|
|
t_bz_balance.post;
|
|
|
|
t_bz_balance.Append;
|
|
t_bz_balance['one']:='4-尺码';
|
|
t_bz_balance['two']:='尺码';
|
|
t_bz_balance['three']:=table_new1.DataSet.DataSource.DataSet.fieldbyname('尺码').asfloat;
|
|
t_bz_balance.post;
|
|
frm_data_share.t_code_fee_unit.First;
|
|
while not frm_data_share.t_code_fee_unit.eof do begin
|
|
t_bz_balance.Append;
|
|
t_bz_balance['one']:=frm_data_share.t_code_fee_unit.fieldbyname('代码').asstring+'-'+frm_data_share.t_code_fee_unit.fieldbyname('标准名称').asstring;
|
|
t_bz_balance['two']:=frm_data_share.t_code_fee_unit.fieldbyname('标准名称').asstring;
|
|
t_bz_balance['three']:=frm_data_share.t_code_fee_unit.fieldbyname('默认数量').asfloat;
|
|
t_bz_balance.post;
|
|
frm_data_share.t_code_fee_unit.next;
|
|
end;
|
|
|
|
finally
|
|
;
|
|
end;
|
|
end;
|
|
|
|
//监管车业务
|
|
|
|
if (ywlb.Text='监管车业务') then
|
|
begin
|
|
try
|
|
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,table_new1.DataSet.DataSource.DataSet.fieldbyname('重量').asfloat);
|
|
t_bz_balance.post;
|
|
t_bz_balance.Append;
|
|
t_bz_balance['one']:='3-件数';
|
|
t_bz_balance['two']:='件数';
|
|
t_bz_balance['three']:=table_new1.DataSet.DataSource.DataSet.fieldbyname('件数').asfloat;
|
|
t_bz_balance.post;
|
|
finally
|
|
;
|
|
end;
|
|
end;
|
|
//铁路业务
|
|
if (ywlb.Text='铁路业务') then
|
|
begin
|
|
try
|
|
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']:=table_new1.DataSet.DataSource.DataSet.fieldbyname('件数').asfloat;
|
|
t_bz_balance.post;
|
|
finally
|
|
;
|
|
end;
|
|
end;
|
|
|
|
end;
|
|
|
|
procedure Tfrm_check_modify.wwDBLookupCombo3Change(Sender: TObject);
|
|
begin
|
|
{
|
|
IF frm_data_share.t_code_currency.Locate('币别',wwDBLookupCombo3.text,[])THEN
|
|
begin
|
|
Edit4.text:=FormatFloat('0.00;-0.00;0',frm_data_share.t_code_currency.fieldbyname('汇率').asfloat);
|
|
end;
|
|
}
|
|
if frm_data_share.t_code_currency.Locate('币别',trim(wwDBLookupCombo3.text),[])THEN
|
|
begin
|
|
if trim(wwDBLookupCombo3.text)='USD' then
|
|
begin
|
|
Edit4.text:=FormatFloat('0.00;-0.00;0',getUsdExRate(table_new1.DataSet.DataSource.DataSet.fieldbyname('开船日期').asstring));
|
|
end
|
|
else
|
|
Edit4.text:=FormatFloat('0.00;-0.00;0',frm_data_share.t_code_currency.fieldbyname('汇率').asfloat);
|
|
end;
|
|
end;
|
|
|
|
procedure Tfrm_check_modify.wwDBLookupCombo4Change(Sender: TObject);
|
|
begin
|
|
if not wwDBLookupCombo4.LookupTable.IsEmpty then
|
|
if wwDBLookupCombo4.LookupTable.Locate('one',wwDBLookupCombo4.text,[])then
|
|
begin
|
|
Edit1.Text:=FormatFloat('0.00;-0.00;0', wwDBLookupCombo4.LookupTable.fieldbyname('three').asfloat);
|
|
end;
|
|
|
|
end;
|
|
|
|
procedure Tfrm_check_modify.Edit2Change(Sender: TObject);
|
|
var aQty,aPrice:Double;
|
|
begin
|
|
aQty:=strtoFloat(Edit1.text);
|
|
aPrice:=strtoFloat(Edit2.text);
|
|
Edit3.Text:=FormatFloat('0.00;-0.00;0',aQty*aPrice);
|
|
end;
|
|
|
|
end.
|