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

11 months ago
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(); //ҵ<><D2B5><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD>ͬʱ<CDAC><CAB1><EFBFBD><EFBFBD>
procedure select_feng_op();//ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
procedure select_feng_fee(); //<2F><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>
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('ҵ<><D2B5>״̬').asstring<>'ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
yewu.DataSet.edit;
yewu.DataSet['ҵ<><D2B5>״̬']:='ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
yewu.DataSet.post;
end;
if yewu.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>' 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('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>') and
(accept.DataSet.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>') and
(accept.DataSet.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') and
(accept.DataSet.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><>ֹɾ<D6B9><C9BE>') and
(accept.DataSet.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><>ֹ<EFBFBD>޸<EFBFBD>')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('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>') and
(pay.DataSet.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>') and
(pay.DataSet.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') and
(pay.DataSet.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><>ֹɾ<D6B9><C9BE>') and
(pay.DataSet.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><>ֹ<EFBFBD>޸<EFBFBD>')then
begin
can_do:=false;
end;
end;
pay.DataSet.next;
end;
end;
if can_do then
begin
yewu.DataSet.edit;
yewu.DataSet['<27><><EFBFBD><EFBFBD>״̬']:='<27><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>';
yewu.DataSet['<27><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=Now;
//<2F><><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD>ڼ<EFBFBD>
if bsSkinCheckRadioBox4.Checked then
yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>']:=wwDBDateTimePicker1.date;
if (gdo<>0) or (xdo<>0) then begin
if trim(yewu.DataSet.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString)='<27><>ͨ<EFBFBD><CDA8>' then begin
if gdo=1 then begin
if uppercase(yewu.DataSet.name)='T_OP_SEAE' then begin
if yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']>logininfo.endday then
yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>']:=yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
end else if uppercase(yewu.DataSet.name)='T_OP_SEAI' then begin
if yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']>logininfo.endday then
yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>']:=yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']
end else if uppercase(yewu.DataSet.name)='T_OP_AIRE' then begin
if yewu.DataSet['һ<>̿<EFBFBD><CCBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']>logininfo.endday then
yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>']:=yewu.DataSet['һ<>̿<EFBFBD><CCBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']
end else if uppercase(yewu.DataSet.name)='T_OP_AIRI' then begin
if yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']>logininfo.endday then
yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>']:=yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']
end else if uppercase(yewu.DataSet.name)='T_OP_RAILWAY' then begin
if yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']>logininfo.endday then
yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>']:=yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']
end;
end;
end else if trim(yewu.DataSet.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='<27><><EFBFBD>ĵ<EFBFBD>' then begin
if xdo=1 then
begin
if xetddo=0 then
if yewu.DataSet['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']>Logininfo.endday then
yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>']:=yewu.DataSet['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
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('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+inttostr(rc)+'Ʊҵ<C6B1><D2B5>û<EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>,<2C><>ע<EFBFBD>⣡',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('ҵ<><D2B5>״̬').asstring<>'ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' then
begin
yewu.DataSet.edit;
yewu.DataSet['ҵ<><D2B5>״̬']:='ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>';
if bsSkinCheckRadioBox4.Checked then
yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>']:=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('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>' 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('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>') and
(accept.DataSet.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>') and
(accept.DataSet.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') and
(accept.DataSet.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><>ֹɾ<D6B9><C9BE>') and
(accept.DataSet.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><>ֹ<EFBFBD>޸<EFBFBD>')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('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>') and
(pay.DataSet.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><><EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>') and
(pay.DataSet.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>') and
(pay.DataSet.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><>ֹɾ<D6B9><C9BE>') and
(pay.DataSet.FieldByName('<27><><EFBFBD><EFBFBD>״̬').asstring<>'<27><>ֹ<EFBFBD>޸<EFBFBD>')then
begin
can_do:=false;
end;
end;
pay.DataSet.next;
end;
end;
if can_do then
begin
yewu.DataSet.edit;
yewu.DataSet['<27><><EFBFBD><EFBFBD>״̬']:='<27><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>';
yewu.DataSet['<27><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']:=Now;
if bsSkinCheckRadioBox4.Checked then
yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>']:=wwDBDateTimePicker1.date;
if (gdo<>0) or (xdo<>0) then begin
if trim(yewu.DataSet.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString)='<27><>ͨ<EFBFBD><CDA8>' then begin
if gdo=1 then begin
if uppercase(yewu.DataSet.name)='T_OP_SEAE' then begin
if yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']>logininfo.endday then
yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>']:=yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
end else if uppercase(yewu.DataSet.name)='T_OP_SEAI' then begin
if yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']>logininfo.endday then
yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>']:=yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']
end else if uppercase(yewu.DataSet.name)='T_OP_AIRE' then begin
if yewu.DataSet['һ<>̿<EFBFBD><CCBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']>logininfo.endday then
yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>']:=yewu.DataSet['һ<>̿<EFBFBD><CCBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']
end else if uppercase(yewu.DataSet.name)='T_OP_AIRI' then begin
if yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']>logininfo.endday then
yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>']:=yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']
end else if uppercase(yewu.DataSet.name)='T_OP_RAILWAY' then begin
if yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']>logininfo.endday then
yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>']:=yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']
end;
end;
end else if trim(yewu.DataSet.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').asstring)='<27><><EFBFBD>ĵ<EFBFBD>' then begin
if xdo=1 then
begin
if xetddo=0 then
if yewu.DataSet['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']>Logininfo.endday then
yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>']:=yewu.DataSet['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
end
else //0
begin
if xetddo=1 then
AmendAccDate(yewu.DataSet.name,yewu);
end;
{
if xdo=1 then
begin
if yewu.DataSet['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>']>Logininfo.endday then
yewu.DataSet['<27><><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD>']:=yewu.DataSet['¼<><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'];
end;
}
end;
end;
yewu.DataSet.post;
{
Send_op_do('<27><><EFBFBD>÷<EFBFBD><C3B7><EFBFBD><><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:'+yewu.DataSet.fieldbyname('ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsString,'42',
yewu.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD>Ա').AsString,
yewu.DataSet.fieldbyname('<27>ͷ<EFBFBD>Ա').AsString,
yewu.DataSet.fieldbyname('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').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('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>'+inttostr(rc)+'Ʊҵ<C6B1><D2B5>û<EFBFBD>б<EFBFBD><D0B1><EFBFBD><EFBFBD>÷<EFBFBD><C3B7><EFBFBD>,<2C><>ע<EFBFBD>⣡',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('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µĻ<C2B5><C4BB><EFBFBD><EFBFBD>ڼ䣡<DABC><E4A3A1>');
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.