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.

596 lines
22 KiB
Plaintext

unit u_lcxunit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,Wwdbgrid,u_fee_modify,RxMemDS,ADODB,
StdCtrls, DBCtrls,inifiles,Winsock,math,Db,Menus,
bsSkinCtrls, dxDBGrid,u_data_share,u_main,u_op_memo,t_ch_rate, dxExEdtr,
dxDBTLCl,dxGrClms, dxTL, dxDBCtrl, dxCntner,my_sys_chat,
u_sys_progress, RxLookup, wwdbdatetimepicker,
wwdblook, Wwdbcomb, bsdbctrls,DateUtils,IdFTPCommon;
function getfield(ywstr:string):string;
procedure fee_Recheck_all(limited_str:string;table:Tadoquery;rechkstr,ywlb:string);//费用审核
procedure fee_Reback(limited_str:string;fee_table:Tadoquery;wwDBGrid:TwwDBGrid;rechkstr,ywlb:string);//费用驳回提交
procedure fee_Recheck_part(limited_str:string;table:Tadoquery;wwDBGrid:TwwDBGrid;rechkstr,ywlb:string);//费用部分审核
procedure fee_shen_check_reok(limited_str:string;table:Tadoquery;table_delete:Tadoquery;
table_old:Tadoquery;table_new:Tadoquery;rechkstr,ywlb:string);//费用批准申请
implementation
uses my_sys_function ;
procedure fee_Recheck_all(limited_str:string;table:Tadoquery;rechkstr,ywlb:string);//费用审核
var
if_do:boolean;
feestatus:string ;
begin
if table.IsEmpty then exit;
try
frm_main.db.BeginTrans;
table.first;
while not table.eof do
begin
if (table.fieldbyname('费用状态').asstring='提交复核') or
(table.FieldByName('费用状态').asstring='复核驳回') then
begin
table.edit;
table['费用状态']:='审核通过';
table['审核人']:=employee;
table['审核日期']:=now;
table.post;
if_do:=true;
end;
table.next;
end;
if if_do then
table.Refresh;
if if_do then begin
if strtobool(get_parameters_value(62,'false')) then
begin
if table.DataSource.DataSet.FieldByName('业务状态').asstring<>'业务封帐' then
begin
table.DataSource.DataSet.edit;
table.DataSource.DataSet['业务状态']:='业务封帐';
table.DataSource.DataSet.post;
end;
end;
if strtobool(get_parameters_value(121,'false')) then
begin
if table.DataSource.DataSet.FieldByName('费用状态').asstring<>'费用封帐' then
begin
table.DataSource.DataSet.edit;
table.DataSource.DataSet['费用状态']:='费用封帐';
table.DataSource.DataSet.post;
end;
end;
frm_main.db.CommitTrans;
end;
except
frm_main.db.RollbackTrans;
showmessage('费用审核失败!');
exit;
end;
end;
procedure fee_Reback(limited_str:string;fee_table:Tadoquery;wwDBGrid:TwwDBGrid;rechkstr,ywlb:string);//费用驳回提交
var
i:integer;
str:widestring;
tmpstr,feestatus: string ; //费用状态 审核通过 提交复核
begin
if fee_table.IsEmpty then exit;
if wwDBGrid.SelectedList.Count>=1 then
begin
for i:=0 to wwDBGrid.SelectedList.Count-1 do
begin
fee_table.GotoBookmark(pointer(wwDBGrid.SelectedList[i]));
if not ((fee_table.FieldByName('费用状态').asstring='审核通过') or
(fee_table.FieldByName('费用状态').asstring='提交复核')) then
begin
showmessage('费用状态只有在“提交复核”、“审核通过”才能驳回,请重新选择要驳回的费用!');
exit;
end;
if (fee_table.FieldByName('开票金额').asfloat+fee_table.FieldByName('申请开票').asfloat)<>0 then
begin
if fee_table.fieldbyname('类型').asstring='付' then begin
showmessage('费用信息已经申请支付不可以驳回!!');
end else begin
showmessage('费用信息已经申请开票不可以驳回!!');
end;
exit;
end;
if (rechkstr='FALSE') then
begin
showmessage('没有定义复核功能,不能驳回') ;
exit ;
end ;
if (rechkstr='CHKPART') and (fee_table.FieldByName('费用状态').asstring='审核通过') then
begin
tmpstr:=isrechk(fee_table.fieldbyname('ch_id').asinteger,
fee_table.DataSource.DataSet.fieldbyname('编号').asstring,
ywlb+'应'+fee_table.fieldbyname('类型').asstring) ;
if tmpstr<>'提交复核' then
begin
showmessage('费用不是复核通过,不能驳回') ;
exit ;
end ;
end ;
end ;
end
else
begin
if not ((fee_table.FieldByName('费用状态').asstring='审核通过') or
(fee_table.FieldByName('费用状态').asstring='提交复核')) then
begin
showmessage('费用状态只有在“提交复核”、“审核通过”才能驳回,请重新选择要驳回的费用!');
exit;
end;
if (fee_table.FieldByName('开票金额').asfloat+fee_table.FieldByName('申请开票').asfloat)<>0 then
begin
if fee_table.fieldbyname('类型').asstring='付' then begin
showmessage('费用信息已经申请支付不可以驳回!!');
end else begin
showmessage('费用信息已经申请开票不可以驳回!!');
end;
exit;
end;
if (rechkstr='FALSE') then
begin
showmessage('没有定义复核功能,不能驳回') ;
exit ;
end ;
if (rechkstr='CHKPART') and (fee_table.FieldByName('费用状态').asstring='审核通过') then
begin
tmpstr:=isrechk(fee_table.fieldbyname('ch_id').asinteger,
fee_table.DataSource.DataSet.fieldbyname('编号').asstring,
ywlb+'应'+fee_table.fieldbyname('类型').asstring) ;
if tmpstr<>'提交复核' then
begin
showmessage('该费用不用复核,不能复核驳回') ;
exit ;
end ;
end ;
if fee_table.DataSource.DataSet.FieldByName('费用状态').AsString='费用封帐'then
begin
showmessage('费用已经封帐,不能驳回!!');
exit;
end;
str:=trim(InputBox('请输入驳回原因', '驳回原因:', ''));
if str=''then
begin
showmessage('驳回原因不能为空,驳回失败!!');
exit;
end
else if str=''then
begin
exit;
end;
end ;
try
frm_main.db.BeginTrans;
if wwDBGrid.SelectedList.Count>=1 then
begin
for i:=0 to wwDBGrid.SelectedList.Count-1 do
begin
fee_table.GotoBookmark(pointer(wwDBGrid.SelectedList[i]));
fee_table.edit;
fee_table['费用状态']:='复核驳回';
fee_table['费用原因']:=str;
fee_table['审核人']:=employee;
fee_table['审核日期']:=now;
fee_table.post;
end;
end
else
begin
fee_table.edit;
fee_table['费用状态']:='复核驳回';
fee_table['费用原因']:=str;
fee_table['审核人']:=employee;
fee_table['审核日期']:=now;
fee_table.post;
end;
fee_table.Refresh;
frm_main.db.CommitTrans;
except
frm_main.db.RollbackTrans;
showmessage('费用驳回提交失败!');
exit;
end;
showmessage('驳回提交成功!');
wwDBGrid.SelectedList.Clear;
end;
procedure fee_Recheck_part(limited_str:string;table:Tadoquery;wwDBGrid:TwwDBGrid;rechkstr,ywlb:string);//费用部分审核
var
i:integer;
begin
if table.IsEmpty then exit;
if wwDBGrid.SelectedList.Count>=1 then
begin
for i:=0 to wwDBGrid.SelectedList.Count-1 do
begin
table.GotoBookmark(pointer(wwDBGrid.SelectedList[i]));
if not ((table.FieldByName('费用状态').asstring='提交复核') or
(table.FieldByName('费用状态').asstring='复核驳回')) then
begin
showmessage('费用状态只有在“提交复核”、“复核驳回”才能审核,请重新选择要审核的费用!');
exit;
end;
end;
end
else
begin
if not ((table.FieldByName('费用状态').asstring='提交复核') or
(table.FieldByName('费用状态').asstring='复核驳回')) then
begin
showmessage('费用状态只有在“提交复核”、“复核驳回”才能审核,请重新选择要审核的费用!');
exit;
end;
end;
try
frm_main.db.BeginTrans;
if wwDBGrid.SelectedList.Count>=1 then
begin
for i:=0 to wwDBGrid.SelectedList.Count-1 do
begin
table.GotoBookmark(pointer(wwDBGrid.SelectedList[i]));
table.edit;
table['费用状态']:='审核通过';
table['审核人']:=employee;
table['审核日期']:=now;
table.post;
end;
end
else
begin
table.edit;
table['费用状态']:='审核通过';
table['审核人']:=employee;
table['审核日期']:=now;
table.post;
end;
table.Refresh;
if strtobool(get_parameters_value(62,'false')) then
begin
if table.DataSource.DataSet.FieldByName('业务状态').asstring<>'业务封帐' then
begin
table.DataSource.DataSet.edit;
table.DataSource.DataSet['业务状态']:='业务封帐';
table.DataSource.DataSet.post;
end;
end;
if strtobool(get_parameters_value(121,'false')) then
begin
if table.DataSource.DataSet.FieldByName('费用状态').asstring<>'费用封帐' then
begin
table.DataSource.DataSet.edit;
table.DataSource.DataSet['费用状态']:='费用封帐';
table.DataSource.DataSet.post;
end;
end;
frm_main.db.CommitTrans;
except
frm_main.db.RollbackTrans;
showmessage('费用审核失败!');
exit;
end;
wwDBGrid.SelectedList.Clear;
end;
function getfield(ywstr:string):string;
begin
if copy(ywstr,1,8)='海运出口' then result:='开船日期'
else if copy(ywstr,1,8)='海运进口' then result:='进口日期'
else if copy(ywstr,1,8)='空运出口' then result:='一程开航日期'
else if copy(ywstr,1,8)='空运进口' then result:='进口日期' ;
end ;
procedure fee_shen_check_reok(limited_str:string;table:Tadoquery;table_delete:Tadoquery;
table_old:Tadoquery;table_new:Tadoquery;rechkstr,ywlb:string);//费用批准申请
var feestatus:string ;
begin
if not do_data(limited_str,table.DataSource.DataSet.FieldByName('录入人').asstring
,table.DataSource.DataSet.FieldByName('操作员').asstring
,table.DataSource.DataSet.FieldByName('揽货人').asstring
,table.DataSource.DataSet.FieldByName('客服员').asstring
,'no','no') then
begin
showmessage('对不起你无权操作数据!');
exit;
end;
if table.IsEmpty then
exit;
if (table.FieldByName('费用状态').asstring<>'申请删除')and(table.FieldByName('费用状态').asstring<>'申请修改')and(table.FieldByName('费用状态').asstring<>'申请添加') then
begin
showmessage('没有申请信息!!');
exit;
end;
if table.FieldByName('费用状态').asstring='申请删除' then
begin
if application.MessageBox('您确定要批准删除费用吗?','警告:',MB_OKCANCEL)<>IDOK then
exit;
try
frm_main.db.BeginTrans;
table_delete.Edit;
table_delete['申请状态']:='批准申请';
table_delete['审核人']:=employee;
table_delete['审核日期']:=now;
table_delete.post;
table.Delete;
{
if strtobool(get_parameters_value(62,'false')) then
begin
if table.DataSource.DataSet.FieldByName('业务状态').asstring<>'业务封帐' then
begin
table.DataSource.DataSet.edit;
table.DataSource.DataSet['业务状态']:='业务封帐';
table.DataSource.DataSet.post;
end;
end;
if strtobool(get_parameters_value(121,'false')) then
begin
if table.DataSource.DataSet.FieldByName('费用状态').asstring<>'费用封帐' then
begin
table.DataSource.DataSet.edit;
table.DataSource.DataSet['费用状态']:='费用封帐';
table.DataSource.DataSet.post;
end;
end;
}
if copy(table.DataSource.DataSet.fieldbyname('业务编号').asstring,1,2)=get_parameters_value(67,'SE') then
begin
Send_fee_check('海运出口应'+table.fieldbyname('类型').asstring
+'批准删除,业务编号:'+table.DataSource.DataSet.fieldbyname('业务编号').AsString
+',主提单号:'+table.DataSource.DataSet.fieldbyname('主提单号').AsString
,'13',table.fieldbyname('录入人').asstring
,table.DataSource.DataSet.fieldbyname('操作员').AsString
,table.DataSource.DataSet.fieldbyname('客服员').AsString
,table.DataSource.DataSet.fieldbyname('揽货人').AsString);
end
else if copy(table.DataSource.DataSet.fieldbyname('业务编号').asstring,1,2)=get_parameters_value(68,'SI') then
begin
Send_fee_check('海运进口应'+table.fieldbyname('类型').asstring
+'批准删除,业务编号:'+table.DataSource.DataSet.fieldbyname('业务编号').AsString
+',主提单号:'+table.DataSource.DataSet.fieldbyname('主提单号').AsString
,'13',table.fieldbyname('录入人').asstring
,table.DataSource.DataSet.fieldbyname('操作员').AsString
,table.DataSource.DataSet.fieldbyname('客服员').AsString
,table.DataSource.DataSet.fieldbyname('揽货人').AsString);
end
else if copy(table.DataSource.DataSet.fieldbyname('业务编号').asstring,1,2)=get_parameters_value(69,'AE') then
begin
Send_fee_check('空运出口应'+table.fieldbyname('类型').asstring
+'批准删除,业务编号:'+table.DataSource.DataSet.fieldbyname('业务编号').AsString
+',主运单号:'+table.DataSource.DataSet.fieldbyname('主运单号').AsString
,'13',table.fieldbyname('录入人').asstring
,table.DataSource.DataSet.fieldbyname('操作员').AsString
,table.DataSource.DataSet.fieldbyname('客服员').AsString
,table.DataSource.DataSet.fieldbyname('揽货人').AsString);
end
else if copy(table.DataSource.DataSet.fieldbyname('业务编号').asstring,1,2)=get_parameters_value(70,'AI') then
begin
Send_fee_check('空运进口应'+table.fieldbyname('类型').asstring
+'批准删除,业务编号:'+table.DataSource.DataSet.fieldbyname('业务编号').AsString
+',主运单号:'+table.DataSource.DataSet.fieldbyname('主运单号').AsString
,'13',table.fieldbyname('录入人').asstring
,table.DataSource.DataSet.fieldbyname('操作员').AsString
,table.DataSource.DataSet.fieldbyname('客服员').AsString
,table.DataSource.DataSet.fieldbyname('揽货人').AsString);
end;
frm_main.db.CommitTrans;
except
frm_main.db.RollbackTrans;
showmessage('批准删除费用失败!!');
end;
exit;
end;
if table.FieldByName('费用状态').asstring='申请修改' then
begin
if application.MessageBox('您确定要批准修改费用吗?','警告:',MB_OKCANCEL)<>IDOK then
exit;
if rechkstr='FALSE' then feestatus:='审核通过'
else if rechkstr='TRUE' then feestatus:='提交复核'
else if rechkstr='CHKPART' then
feestatus:=isrechk(table.fieldbyname('ch_id').asinteger,
table.DataSource.DataSet.fieldbyname('编号').asstring,
ywlb+'应'+table.fieldbyname('类型').asstring) ;
try
frm_main.db.BeginTrans;
table.edit;
table['费用名称']:=table_new['费用名称'];
table['结算单位']:=table_new['结算单位'];
table['客户名称']:=table_new['客户名称'];
table['标准']:=table_new['标准'];
table['单价']:=table_new['单价'];
table['数量']:=table_new['数量'];
table['金额']:=table_new['金额'];
table['币别']:=table_new['币别'];
table['汇率']:=table_new['汇率'];
table['备注']:=table_new['备注'];
table['审核人']:=employee;
table['费用状态']:=feestatus ; //'审核通过';
table['旧状态']:='申请修改';
table['审核日期']:=now;
table.Post;
table.Refresh;
table_old.Edit;
table_old['申请状态']:='批准申请';
table_old['审核人']:=employee;
table_old['审核日期']:=now;
table_old.post;
table_new.Edit;
table_new['申请状态']:='批准申请';
table_new['审核人']:=employee;
table_new['审核日期']:=now;
table_new.post;
table.Refresh;
{
if strtobool(get_parameters_value(62,'false')) then
begin
if table.DataSource.DataSet.FieldByName('业务状态').asstring<>'业务封帐' then
begin
table.DataSource.DataSet.edit;
table.DataSource.DataSet['业务状态']:='业务封帐';
table.DataSource.DataSet.post;
end;
end;
if strtobool(get_parameters_value(121,'false')) then
begin
if table.DataSource.DataSet.FieldByName('费用状态').asstring<>'费用封帐' then
begin
table.DataSource.DataSet.edit;
table.DataSource.DataSet['费用状态']:='费用封帐';
table.DataSource.DataSet.post;
end;
end;
}
if copy(table.DataSource.DataSet.fieldbyname('业务编号').asstring,1,2)=get_parameters_value(67,'SE') then
begin
Send_fee_check('海运出口应'+table.fieldbyname('类型').asstring
+'批准修改,业务编号:'+table.DataSource.DataSet.fieldbyname('业务编号').AsString
+',主提单号:'+table.DataSource.DataSet.fieldbyname('主提单号').AsString
,'11',table.fieldbyname('录入人').asstring
,table.DataSource.DataSet.fieldbyname('操作员').AsString
,table.DataSource.DataSet.fieldbyname('客服员').AsString
,table.DataSource.DataSet.fieldbyname('揽货人').AsString);
end
else if copy(table.DataSource.DataSet.fieldbyname('业务编号').asstring,1,2)=get_parameters_value(68,'SI') then
begin
Send_fee_check('海运进口应'+table.fieldbyname('类型').asstring
+'批准修改,业务编号:'+table.DataSource.DataSet.fieldbyname('业务编号').AsString
+',主提单号:'+table.DataSource.DataSet.fieldbyname('主提单号').AsString
,'11',table.fieldbyname('录入人').asstring
,table.DataSource.DataSet.fieldbyname('操作员').AsString
,table.DataSource.DataSet.fieldbyname('客服员').AsString
,table.DataSource.DataSet.fieldbyname('揽货人').AsString);
end
else if copy(table.DataSource.DataSet.fieldbyname('业务编号').asstring,1,2)=get_parameters_value(69,'AE') then
begin
Send_fee_check('空运出口应'+table.fieldbyname('类型').asstring
+'批准修改,业务编号:'+table.DataSource.DataSet.fieldbyname('业务编号').AsString
+',主运单号:'+table.DataSource.DataSet.fieldbyname('主运单号').AsString
,'11',table.fieldbyname('录入人').asstring
,table.DataSource.DataSet.fieldbyname('操作员').AsString
,table.DataSource.DataSet.fieldbyname('客服员').AsString
,table.DataSource.DataSet.fieldbyname('揽货人').AsString);
end
else if copy(table.DataSource.DataSet.fieldbyname('业务编号').asstring,1,2)=get_parameters_value(70,'AI') then
begin
Send_fee_check('空运进口应'+table.fieldbyname('类型').asstring
+'批准修改,业务编号:'+table.DataSource.DataSet.fieldbyname('业务编号').AsString
+',主运单号:'+table.DataSource.DataSet.fieldbyname('主运单号').AsString
,'11',table.fieldbyname('录入人').asstring
,table.DataSource.DataSet.fieldbyname('操作员').AsString
,table.DataSource.DataSet.fieldbyname('客服员').AsString
,table.DataSource.DataSet.fieldbyname('揽货人').AsString);
end;
frm_main.db.CommitTrans;
except
frm_main.db.RollbackTrans;
showmessage('批准修改费用失败!!');
end;
exit;
end;
if table.FieldByName('费用状态').asstring='申请添加' then
begin
if application.MessageBox('您确定要批准添加费用吗?','警告:',MB_OKCANCEL)<>IDOK then
exit;
if rechkstr='FALSE' then feestatus:='审核通过'
else if rechkstr='TRUE' then feestatus:='提交复核'
else if rechkstr='CHKPART' then
feestatus:=isrechk(table.fieldbyname('ch_id').asinteger,
table.DataSource.DataSet.fieldbyname('编号').asstring,
ywlb+'应'+table.fieldbyname('类型').asstring) ;
try
frm_main.db.BeginTrans;
table.edit;
table['审核人']:=employee;
table['费用状态']:=feestatus ; //'审核通过';
table['审核日期']:=now;
table.Post;
table.Refresh;
table.Refresh;
{
if strtobool(get_parameters_value(62,'false')) then
begin
if table.DataSource.DataSet.FieldByName('业务状态').asstring<>'业务封帐' then
begin
table.DataSource.DataSet.edit;
table.DataSource.DataSet['业务状态']:='业务封帐';
table.DataSource.DataSet.post;
end;
end;
if strtobool(get_parameters_value(121,'false')) then
begin
if table.DataSource.DataSet.FieldByName('费用状态').asstring<>'费用封帐' then
begin
table.DataSource.DataSet.edit;
table.DataSource.DataSet['费用状态']:='费用封帐';
table.DataSource.DataSet.post;
end;
end;
}
if copy(table.DataSource.DataSet.fieldbyname('业务编号').asstring,1,2)=get_parameters_value(67,'SE') then
begin
Send_fee_check('海运出口应'+table.fieldbyname('类型').asstring
+'批准添加,业务编号:'+table.DataSource.DataSet.fieldbyname('业务编号').AsString
+',主提单号:'+table.DataSource.DataSet.fieldbyname('主提单号').AsString
,'11',table.fieldbyname('录入人').asstring
,table.DataSource.DataSet.fieldbyname('操作员').AsString
,table.DataSource.DataSet.fieldbyname('客服员').AsString
,table.DataSource.DataSet.fieldbyname('揽货人').AsString);
end
else if copy(table.DataSource.DataSet.fieldbyname('业务编号').asstring,1,2)=get_parameters_value(68,'SI') then
begin
Send_fee_check('海运进口应'+table.fieldbyname('类型').asstring
+'批准添加,业务编号:'+table.DataSource.DataSet.fieldbyname('业务编号').AsString
+',主提单号:'+table.DataSource.DataSet.fieldbyname('主提单号').AsString
,'11',table.fieldbyname('录入人').asstring
,table.DataSource.DataSet.fieldbyname('操作员').AsString
,table.DataSource.DataSet.fieldbyname('客服员').AsString
,table.DataSource.DataSet.fieldbyname('揽货人').AsString);
end
else if copy(table.DataSource.DataSet.fieldbyname('业务编号').asstring,1,2)=get_parameters_value(69,'AE') then
begin
Send_fee_check('空运出口应'+table.fieldbyname('类型').asstring
+'批准添加,业务编号:'+table.DataSource.DataSet.fieldbyname('业务编号').AsString
+',主运单号:'+table.DataSource.DataSet.fieldbyname('主运单号').AsString
,'11',table.fieldbyname('录入人').asstring
,table.DataSource.DataSet.fieldbyname('操作员').AsString
,table.DataSource.DataSet.fieldbyname('客服员').AsString
,table.DataSource.DataSet.fieldbyname('揽货人').AsString);
end
else if copy(table.DataSource.DataSet.fieldbyname('业务编号').asstring,1,2)=get_parameters_value(70,'AI') then
begin
Send_fee_check('空运进口应'+table.fieldbyname('类型').asstring
+'批准添加,业务编号:'+table.DataSource.DataSet.fieldbyname('业务编号').AsString
+',主运单号:'+table.DataSource.DataSet.fieldbyname('主运单号').AsString
,'11',table.fieldbyname('录入人').asstring
,table.DataSource.DataSet.fieldbyname('操作员').AsString
,table.DataSource.DataSet.fieldbyname('客服员').AsString
,table.DataSource.DataSet.fieldbyname('揽货人').AsString);
end;
frm_main.db.CommitTrans;
except
frm_main.db.RollbackTrans;
showmessage('批准添加费用失败!!');
end;
exit;
end;
end;
end.