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.
395 lines
14 KiB
Plaintext
395 lines
14 KiB
Plaintext
unit u_op_close_all;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
Dialogs, DB,ADODB,bsSkinCtrls, BusinessSkinForm, StdCtrls,inifiles,
|
|
wwdbdatetimepicker;
|
|
|
|
type
|
|
Tfrm_op_close_all = class(TForm)
|
|
bsBusinessSkinForm1: TbsBusinessSkinForm;
|
|
bsSkinCheckRadioBox1: TbsSkinCheckRadioBox;
|
|
bsSkinCheckRadioBox2: TbsSkinCheckRadioBox;
|
|
bsSkinCheckRadioBox3: TbsSkinCheckRadioBox;
|
|
bsSkinButton1: TbsSkinButton;
|
|
bsSkinButton5: TbsSkinButton;
|
|
yewu: TDataSource;
|
|
accept: TDataSource;
|
|
pay: TDataSource;
|
|
bsSkinCheckRadioBox4: TbsSkinCheckRadioBox;
|
|
wwDBDateTimePicker1: TwwDBDateTimePicker;
|
|
procedure bsSkinButton5Click(Sender: TObject);
|
|
procedure bsSkinButton1Click(Sender: TObject);
|
|
procedure select_feng_all(); //业务和费用同时封帐
|
|
procedure select_feng_op();//业务封帐
|
|
procedure select_feng_fee(); //费用封帐
|
|
procedure FormShow(Sender: TObject);
|
|
private
|
|
gdo,xdo,xetddo:smallint;
|
|
|
|
{ Private declarations }
|
|
public
|
|
{ Public declarations }
|
|
end;
|
|
|
|
var
|
|
frm_op_close_all: Tfrm_op_close_all;
|
|
|
|
implementation
|
|
|
|
uses my_sys_function;
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
procedure Tfrm_op_close_all.select_feng_all();
|
|
var
|
|
can_do:boolean;
|
|
bookmark:tbookmark;
|
|
rc:integer;
|
|
begin
|
|
bookmark:=yewu.dataset.GetBookmark;
|
|
// accept.DataSet.DisableControls;
|
|
// pay.DataSet.DisableControls;
|
|
yewu.DataSet.DisableControls;
|
|
rc:=0;
|
|
try
|
|
|
|
yewu.DataSet.First;
|
|
while not yewu.DataSet.eof do
|
|
begin
|
|
if yewu.DataSet.fieldbyname('业务状态').asstring<>'业务封帐' then
|
|
begin
|
|
yewu.DataSet.edit;
|
|
yewu.DataSet['业务状态']:='业务封帐';
|
|
yewu.DataSet.post;
|
|
end;
|
|
if yewu.DataSet.fieldbyname('费用状态').asstring<>'费用封帐' then
|
|
begin
|
|
can_do:=true;
|
|
accept.DataSet.close;
|
|
accept.DataSet.open;
|
|
accept.DataSet.first;
|
|
while not accept.DataSet.eof do
|
|
begin
|
|
if can_do then
|
|
begin
|
|
if (accept.DataSet.FieldByName('费用状态').asstring<>'审核通过') and
|
|
(accept.DataSet.FieldByName('费用状态').asstring<>'部分结算') and
|
|
(accept.DataSet.FieldByName('费用状态').asstring<>'结算完毕') and
|
|
(accept.DataSet.FieldByName('费用状态').asstring<>'禁止删除') and
|
|
(accept.DataSet.FieldByName('费用状态').asstring<>'禁止修改')then
|
|
begin
|
|
can_do:=false;
|
|
end;
|
|
end;
|
|
accept.DataSet.next;
|
|
end;
|
|
if can_do then
|
|
begin
|
|
pay.DataSet.close;
|
|
pay.DataSet.open;
|
|
pay.DataSet.first;
|
|
while not pay.DataSet.eof do
|
|
begin
|
|
if can_do then
|
|
begin
|
|
if (pay.DataSet.FieldByName('费用状态').asstring<>'审核通过') and
|
|
(pay.DataSet.FieldByName('费用状态').asstring<>'部分结算') and
|
|
(pay.DataSet.FieldByName('费用状态').asstring<>'结算完毕') and
|
|
(pay.DataSet.FieldByName('费用状态').asstring<>'禁止删除') and
|
|
(pay.DataSet.FieldByName('费用状态').asstring<>'禁止修改')then
|
|
begin
|
|
can_do:=false;
|
|
end;
|
|
end;
|
|
pay.DataSet.next;
|
|
end;
|
|
end;
|
|
if can_do then
|
|
begin
|
|
yewu.DataSet.edit;
|
|
yewu.DataSet['费用状态']:='费用封帐';
|
|
yewu.DataSet['费用封帐日期']:=Now;
|
|
//更改会计期间
|
|
if bsSkinCheckRadioBox4.Checked then
|
|
yewu.DataSet['会计期间']:=wwDBDateTimePicker1.date;
|
|
|
|
if (gdo<>0) or (xdo<>0) then begin
|
|
if trim(yewu.DataSet.fieldbyname('业务类型').AsString)='普通货' then begin
|
|
if gdo=1 then begin
|
|
if uppercase(yewu.DataSet.name)='T_OP_SEAE' then begin
|
|
if yewu.DataSet['开船日期']>logininfo.endday then
|
|
yewu.DataSet['会计期间']:=yewu.DataSet['开船日期'];
|
|
end else if uppercase(yewu.DataSet.name)='T_OP_SEAI' then begin
|
|
if yewu.DataSet['进口日期']>logininfo.endday then
|
|
yewu.DataSet['会计期间']:=yewu.DataSet['进口日期']
|
|
end else if uppercase(yewu.DataSet.name)='T_OP_AIRE' then begin
|
|
if yewu.DataSet['一程开航日期']>logininfo.endday then
|
|
yewu.DataSet['会计期间']:=yewu.DataSet['一程开航日期']
|
|
end else if uppercase(yewu.DataSet.name)='T_OP_AIRI' then begin
|
|
if yewu.DataSet['进口日期']>logininfo.endday then
|
|
yewu.DataSet['会计期间']:=yewu.DataSet['进口日期']
|
|
end else if uppercase(yewu.DataSet.name)='T_OP_RAILWAY' then begin
|
|
if yewu.DataSet['发车日期']>logininfo.endday then
|
|
yewu.DataSet['会计期间']:=yewu.DataSet['发车日期']
|
|
end;
|
|
end;
|
|
end else if trim(yewu.DataSet.fieldbyname('业务类型').asstring)='更改单' then begin
|
|
if xdo=1 then
|
|
begin
|
|
if xetddo=0 then
|
|
if yewu.DataSet['录入日期']>Logininfo.endday then
|
|
yewu.DataSet['会计期间']:=yewu.DataSet['录入日期'];
|
|
end
|
|
else //0
|
|
begin
|
|
if xetddo=1 then
|
|
AmendAccDate(yewu.DataSet.name,yewu);
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
yewu.DataSet.post;
|
|
end else rc:=rc+1;
|
|
end;
|
|
yewu.DataSet.next;
|
|
end;
|
|
finally
|
|
// accept.DataSet.EnableControls;
|
|
// pay.DataSet.EnableControls;
|
|
yewu.DataSet.EnableControls;
|
|
TAdoQuery(yewu.DataSet).requery;
|
|
yewu.DataSet.GotoBookmark(bookmark);
|
|
end;
|
|
if rc<>0 then
|
|
MessageDlg('封帐完毕,其中有'+inttostr(rc)+'票业务没有被费用封帐,请注意!',mtWarning,[mbyes],0);
|
|
|
|
end;
|
|
|
|
procedure Tfrm_op_close_all.select_feng_op();
|
|
var
|
|
bookmark:tbookmark;
|
|
begin
|
|
bookmark:=yewu.dataset.GetBookmark;
|
|
yewu.DataSet.DisableControls;
|
|
try
|
|
yewu.DataSet.first;
|
|
while not yewu.DataSet.eof do
|
|
begin
|
|
if yewu.DataSet.fieldbyname('业务状态').asstring<>'业务封帐' then
|
|
begin
|
|
yewu.DataSet.edit;
|
|
yewu.DataSet['业务状态']:='业务封帐';
|
|
if bsSkinCheckRadioBox4.Checked then
|
|
yewu.DataSet['会计期间']:=wwDBDateTimePicker1.date;
|
|
|
|
yewu.DataSet.post;
|
|
end;
|
|
yewu.DataSet.Next;
|
|
end;
|
|
finally
|
|
yewu.DataSet.EnableControls;
|
|
TAdoQuery(yewu.DataSet).requery;
|
|
yewu.DataSet.GotoBookmark(bookmark);
|
|
end;
|
|
end;
|
|
|
|
procedure Tfrm_op_close_all.select_feng_fee();
|
|
var
|
|
can_do:boolean;
|
|
bookmark:tbookmark;
|
|
rc:integer;
|
|
begin
|
|
bookmark:=yewu.dataset.GetBookmark;
|
|
|
|
// pay.DataSet.DisableControls;
|
|
// accept.DataSet.DisableControls;
|
|
yewu.DataSet.DisableControls;
|
|
rc:=0;
|
|
try
|
|
yewu.DataSet.first;
|
|
while not yewu.DataSet.eof do
|
|
begin
|
|
if yewu.DataSet.fieldbyname('费用状态').asstring<>'费用封帐' then
|
|
begin
|
|
can_do:=true;
|
|
accept.DataSet.close;
|
|
accept.DataSet.open;
|
|
accept.DataSet.first;
|
|
while not accept.DataSet.eof do
|
|
begin
|
|
if can_do then
|
|
begin
|
|
if (accept.DataSet.FieldByName('费用状态').asstring<>'审核通过') and
|
|
(accept.DataSet.FieldByName('费用状态').asstring<>'部分结算') and
|
|
(accept.DataSet.FieldByName('费用状态').asstring<>'结算完毕') and
|
|
(accept.DataSet.FieldByName('费用状态').asstring<>'禁止删除') and
|
|
(accept.DataSet.FieldByName('费用状态').asstring<>'禁止修改')then
|
|
begin
|
|
can_do:=false;
|
|
end;
|
|
end;
|
|
accept.DataSet.next;
|
|
end;
|
|
if can_do then
|
|
begin
|
|
pay.DataSet.close;
|
|
pay.DataSet.open;
|
|
pay.DataSet.first;
|
|
while not pay.DataSet.eof do
|
|
begin
|
|
if can_do then
|
|
begin
|
|
if (pay.DataSet.FieldByName('费用状态').asstring<>'审核通过') and
|
|
(pay.DataSet.FieldByName('费用状态').asstring<>'部分结算') and
|
|
(pay.DataSet.FieldByName('费用状态').asstring<>'结算完毕') and
|
|
(pay.DataSet.FieldByName('费用状态').asstring<>'禁止删除') and
|
|
(pay.DataSet.FieldByName('费用状态').asstring<>'禁止修改')then
|
|
begin
|
|
can_do:=false;
|
|
end;
|
|
end;
|
|
pay.DataSet.next;
|
|
end;
|
|
end;
|
|
if can_do then
|
|
begin
|
|
yewu.DataSet.edit;
|
|
yewu.DataSet['费用状态']:='费用封帐';
|
|
yewu.DataSet['费用封帐日期']:=Now;
|
|
if bsSkinCheckRadioBox4.Checked then
|
|
yewu.DataSet['会计期间']:=wwDBDateTimePicker1.date;
|
|
|
|
if (gdo<>0) or (xdo<>0) then begin
|
|
if trim(yewu.DataSet.fieldbyname('业务类型').AsString)='普通货' then begin
|
|
if gdo=1 then begin
|
|
if uppercase(yewu.DataSet.name)='T_OP_SEAE' then begin
|
|
if yewu.DataSet['开船日期']>logininfo.endday then
|
|
yewu.DataSet['会计期间']:=yewu.DataSet['开船日期'];
|
|
end else if uppercase(yewu.DataSet.name)='T_OP_SEAI' then begin
|
|
if yewu.DataSet['进口日期']>logininfo.endday then
|
|
yewu.DataSet['会计期间']:=yewu.DataSet['进口日期']
|
|
end else if uppercase(yewu.DataSet.name)='T_OP_AIRE' then begin
|
|
if yewu.DataSet['一程开航日期']>logininfo.endday then
|
|
yewu.DataSet['会计期间']:=yewu.DataSet['一程开航日期']
|
|
end else if uppercase(yewu.DataSet.name)='T_OP_AIRI' then begin
|
|
if yewu.DataSet['进口日期']>logininfo.endday then
|
|
yewu.DataSet['会计期间']:=yewu.DataSet['进口日期']
|
|
end else if uppercase(yewu.DataSet.name)='T_OP_RAILWAY' then begin
|
|
if yewu.DataSet['发车日期']>logininfo.endday then
|
|
yewu.DataSet['会计期间']:=yewu.DataSet['发车日期']
|
|
end;
|
|
end;
|
|
end else if trim(yewu.DataSet.fieldbyname('业务类型').asstring)='更改单' then begin
|
|
if xdo=1 then
|
|
begin
|
|
if xetddo=0 then
|
|
if yewu.DataSet['录入日期']>Logininfo.endday then
|
|
yewu.DataSet['会计期间']:=yewu.DataSet['录入日期'];
|
|
end
|
|
else //0
|
|
begin
|
|
if xetddo=1 then
|
|
AmendAccDate(yewu.DataSet.name,yewu);
|
|
end;
|
|
{
|
|
if xdo=1 then
|
|
begin
|
|
if yewu.DataSet['录入日期']>Logininfo.endday then
|
|
yewu.DataSet['会计期间']:=yewu.DataSet['录入日期'];
|
|
end;
|
|
}
|
|
end;
|
|
end;
|
|
|
|
yewu.DataSet.post;
|
|
{
|
|
Send_op_do('费用封帐,业务编号:'+yewu.DataSet.fieldbyname('业务编号').AsString,'42',
|
|
yewu.DataSet.fieldbyname('操作员').AsString,
|
|
yewu.DataSet.fieldbyname('客服员').AsString,
|
|
yewu.DataSet.fieldbyname('揽货人').AsString);
|
|
}
|
|
end else rc:=rc+1;
|
|
end;
|
|
yewu.DataSet.next;
|
|
end;
|
|
finally
|
|
yewu.DataSet.EnableControls;
|
|
// pay.DataSet.EnableControls;
|
|
// accept.DataSet.EnableControls;
|
|
TAdoQuery(yewu.DataSet).requery;
|
|
yewu.DataSet.GotoBookmark(bookmark);
|
|
end;
|
|
if rc<>0 then
|
|
MessageDlg('封帐完毕,其中有'+inttostr(rc)+'票业务没有被费用封帐,请注意!',mtWarning,[mbyes],0);
|
|
|
|
end;
|
|
|
|
procedure Tfrm_op_close_all.bsSkinButton5Click(Sender: TObject);
|
|
begin
|
|
close;
|
|
end;
|
|
|
|
procedure Tfrm_op_close_all.bsSkinButton1Click(Sender: TObject);
|
|
var
|
|
inifile1:tinifile ;
|
|
begin
|
|
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
|
|
if bsSkinCheckRadioBox4.Checked then begin
|
|
if (wwDBDateTimePicker1.text='') then
|
|
begin
|
|
showmessage('请输入新的会计期间!!');
|
|
exit;
|
|
end;
|
|
inifile1.WriteBool('other','closeusedate',true);
|
|
inifile1.WriteDate('other','closedate',wwDBDateTimePicker1.Date);
|
|
end else begin
|
|
inifile1.WriteBool('other','closeusedate',false);
|
|
|
|
end;
|
|
inifile1.free;
|
|
|
|
|
|
if bsSkinCheckRadioBox3.Checked then
|
|
begin
|
|
frm_op_close_all.select_feng_all();
|
|
close;
|
|
exit;
|
|
end;
|
|
if bsSkinCheckRadioBox1.Checked then
|
|
begin
|
|
frm_op_close_all.select_feng_op();
|
|
close;
|
|
exit;
|
|
end;
|
|
if bsSkinCheckRadioBox2.Checked then
|
|
begin
|
|
frm_op_close_all.select_feng_fee();
|
|
close;
|
|
exit;
|
|
end;
|
|
end;
|
|
|
|
procedure Tfrm_op_close_all.FormShow(Sender: TObject);
|
|
var
|
|
inifile1:tinifile ;
|
|
ab:boolean;
|
|
begin
|
|
inifile1:=Tinifile.Create(ExtractFilePath(application.ExeName)+'main.ini');
|
|
ab:=inifile1.readBool('other','closeusedate',false);
|
|
bsSkinCheckRadioBox4.Checked:=ab;
|
|
if ab then
|
|
wwDBDateTimePicker1.Date:=inifile1.readDate('other','closedate',date);
|
|
inifile1.free;
|
|
|
|
gdo:=strtoint(get_parameters_value(137,'0'));
|
|
xdo:=strtoint(get_parameters_value(138,'0'));
|
|
xetddo:=strtoint(get_parameters_value(158,'0'));
|
|
end;
|
|
|
|
end.
|