{$INCLUDE t_main.inc} unit u_op_close_select; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs,ADODB, BusinessSkinForm, bsSkinCtrls, DB, StdCtrls,inifiles, wwdbdatetimepicker; type Tfrm_op_close_select = 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_select: Tfrm_op_close_select; close_select_num:integer; implementation uses u_main, u_op_seae_close, u_op_seai_close, my_sys_function{$IFDEF JGCHE}{$ENDIF}; {$R *.dfm} procedure Tfrm_op_close_select.select_feng_all(); var i,rc:integer; can_do:boolean; bookmark:tbookmark; begin case close_select_num of 1: begin rc:=0; if (frm_op_seae_close.dxdbgrid1.SelectedCount>=1) and (frm_op_seae_close.bsSkinPageControl1.TabIndex=0) then begin bookmark:=yewu.dataset.GetBookmark; try for i:=0 to frm_op_seae_close.dxdbgrid1.SelectedCount-1 do begin yewu.DataSet.GotoBookmark(pointer(frm_op_seae_close.dxdbgrid1.selectedrows[i])); 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 yewu.DataSet['开船日期']>Logininfo.endday then yewu.DataSet['会计期间']:=yewu.DataSet['开船日期']; 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; end else rc:=rc+1; end; end; finally TAdoQuery(yewu.DataSet).requery; yewu.DataSet.GotoBookmark(bookmark); end; end else 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 yewu.DataSet['开船日期']>Logininfo.endday then yewu.DataSet['会计期间']:=yewu.DataSet['开船日期']; 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:=1; end; TAdoQuery(yewu.DataSet).Refresh; end; if rc<>0 then MessageDlg('封帐完毕,其中有'+inttostr(rc)+'票业务没有被费用封帐,请注意!',mtWarning,[mbyes],0); end; 2: begin rc:=0; if (frm_op_seai_close.dxdbgrid1.SelectedCount>=1) and (frm_op_seai_close.bsSkinPageControl1.TabIndex=0) then begin bookmark:=yewu.dataset.GetBookmark; try for i:=0 to frm_op_seai_close.dxdbgrid1.SelectedCount-1 do begin yewu.DataSet.GotoBookmark(pointer(frm_op_seai_close.dxdbgrid1.selectedrows[i])); if yewu.DataSet.fieldbyname('业务状态').asstring<>'业务封帐' then begin yewu.DataSet.edit; yewu.DataSet['业务状态']:='业务封帐'; yewu.DataSet.post; { Send_op_do('海运进口业务封帐,业务编号:'+yewu.DataSet.fieldbyname('业务编号').AsString +',主提单号:'+yewu.DataSet.fieldbyname('主提单号').AsString,'41', yewu.DataSet.fieldbyname('操作员').AsString, yewu.DataSet.fieldbyname('客服员').AsString, yewu.DataSet.fieldbyname('揽货人').AsString); } 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 yewu.DataSet['进口日期']>Logininfo.endday then yewu.DataSet['会计期间']:=yewu.DataSet['进口日期']; 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 +',主提单号:'+yewu.DataSet.fieldbyname('主提单号').AsString,'42', yewu.DataSet.fieldbyname('操作员').AsString, yewu.DataSet.fieldbyname('客服员').AsString, yewu.DataSet.fieldbyname('揽货人').AsString); } end else rc:=rc+1; end; end; finally TAdoQuery(yewu.DataSet).requery; yewu.DataSet.GotoBookmark(bookmark); end; end else begin if yewu.DataSet.fieldbyname('业务状态').asstring<>'业务封帐' then begin yewu.DataSet.edit; yewu.DataSet['业务状态']:='业务封帐'; yewu.DataSet.post; { Send_op_do('海运进口业务封帐,业务编号:'+yewu.DataSet.fieldbyname('业务编号').AsString +',主提单号:'+yewu.DataSet.fieldbyname('主提单号').AsString,'41', yewu.DataSet.fieldbyname('操作员').AsString, yewu.DataSet.fieldbyname('客服员').AsString, yewu.DataSet.fieldbyname('揽货人').AsString); } 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 yewu.DataSet['进口日期']>Logininfo.endday then yewu.DataSet['会计期间']:=yewu.DataSet['进口日期']; 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 +',主提单号:'+yewu.DataSet.fieldbyname('主提单号').AsString,'42', yewu.DataSet.fieldbyname('操作员').AsString, yewu.DataSet.fieldbyname('客服员').AsString, yewu.DataSet.fieldbyname('揽货人').AsString); } end else rc:=1; end; TAdoQuery(yewu.DataSet).Refresh; end; if rc<>0 then MessageDlg('封帐完毕,其中有'+inttostr(rc)+'票业务没有被费用封帐,请注意!',mtWarning,[mbyes],0); end; 3: begin { rc:=0; if (frm_op_aire_close.dxdbgrid1.SelectedCount>=1) and (frm_op_aire_close.bsSkinPageControl1.TabIndex=0) then begin bookmark:=yewu.dataset.GetBookmark; try for i:=0 to frm_op_aire_close.dxdbgrid1.SelectedCount-1 do begin yewu.DataSet.GotoBookmark(pointer(frm_op_aire_close.dxdbgrid1.selectedrows[i])); 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 yewu.DataSet['一程开航日期']>Logininfo.endday then yewu.DataSet['会计期间']:=yewu.DataSet['一程开航日期']; 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; end; finally TAdoQuery(yewu.DataSet).requery; yewu.DataSet.GotoBookmark(bookmark); end; end else 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 yewu.DataSet['一程开航日期']>Logininfo.endday then yewu.DataSet['会计期间']:=yewu.DataSet['一程开航日期']; 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:=1; end; TAdoQuery(yewu.DataSet).Refresh; end; if rc<>0 then MessageDlg('封帐完毕,其中有'+inttostr(rc)+'票业务没有被费用封帐,请注意!',mtWarning,[mbyes],0); } end; 4: begin { rc:=0; if (frm_op_airi_close.dxdbgrid1.SelectedCount>=1) and (frm_op_airi_close.bsSkinPageControl1.TabIndex=0) then begin bookmark:=yewu.dataset.GetBookmark; try for i:=0 to frm_op_airi_close.dxdbgrid1.SelectedCount-1 do begin yewu.DataSet.GotoBookmark(pointer(frm_op_airi_close.dxdbgrid1.selectedrows[i])); 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 yewu.DataSet['进口日期']>Logininfo.endday then yewu.DataSet['会计期间']:=yewu.DataSet['进口日期']; 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; end; finally TAdoQuery(yewu.DataSet).requery; yewu.DataSet.GotoBookmark(bookmark); end; end else 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 yewu.DataSet['进口日期']>Logininfo.endday then yewu.DataSet['会计期间']:=yewu.DataSet['进口日期']; 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:=1; end; TAdoQuery(yewu.DataSet).Refresh; end; if rc<>0 then MessageDlg('封帐完毕,其中有'+inttostr(rc)+'票业务没有被费用封帐,请注意!',mtWarning,[mbyes],0); } end; {$IFDEF JGCHE} 5: begin rc:=0; { if (frm_op_airtruck_close.dxdbgrid1.SelectedCount>=1) and (frm_op_airtruck_close.bsSkinPageControl1.TabIndex=0) then begin bookmark:=yewu.dataset.GetBookmark; try for i:=0 to frm_op_airtruck_close.dxdbgrid1.SelectedCount-1 do begin yewu.DataSet.GotoBookmark(pointer(frm_op_airtruck_close.dxdbgrid1.selectedrows[i])); 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 yewu.DataSet['发车日期']>Logininfo.endday then yewu.DataSet['会计期间']:=yewu.DataSet['发车日期']; 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; end; finally TAdoQuery(yewu.DataSet).requery; yewu.DataSet.GotoBookmark(bookmark); end; end else 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 yewu.DataSet['发车日期']>Logininfo.endday then yewu.DataSet['会计期间']:=yewu.DataSet['发车日期']; 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:=1; end; TAdoQuery(yewu.DataSet).Refresh; end; if rc<>0 then MessageDlg('封帐完毕,其中有'+inttostr(rc)+'票业务没有被费用封帐,请注意!',mtWarning,[mbyes],0); } end; {$ENDIF} 6: begin { rc:=0; if (frm_op_railway_close.dxdbgrid1.SelectedCount>=1) and (frm_op_railway_close.bsSkinPageControl1.TabIndex=0) then begin bookmark:=yewu.dataset.GetBookmark; try for i:=0 to frm_op_railway_close.dxdbgrid1.SelectedCount-1 do begin yewu.DataSet.GotoBookmark(pointer(frm_op_railway_close.dxdbgrid1.selectedrows[i])); 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 yewu.DataSet['发车日期']>Logininfo.endday then yewu.DataSet['会计期间']:=yewu.DataSet['发车日期']; 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; end; finally TAdoQuery(yewu.DataSet).requery; yewu.DataSet.GotoBookmark(bookmark); end; end else 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 yewu.DataSet['发车日期']>Logininfo.endday then yewu.DataSet['会计期间']:=yewu.DataSet['发车日期']; 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:=1; end; TAdoQuery(yewu.DataSet).Refresh; end; if rc<>0 then MessageDlg('封帐完毕,其中有'+inttostr(rc)+'票业务没有被费用封帐,请注意!',mtWarning,[mbyes],0); } end; end; end; procedure Tfrm_op_close_select.select_feng_op(); var i:integer; bookmark:tbookmark; begin case close_select_num of 1: begin if (frm_op_seae_close.dxdbgrid1.SelectedCount>=1) and (frm_op_seae_close.bsSkinPageControl1.TabIndex=0) then begin bookmark:=yewu.dataset.GetBookmark; try for i:=0 to frm_op_seae_close.dxdbgrid1.SelectedCount-1 do begin yewu.DataSet.GotoBookmark(pointer(frm_op_seae_close.dxdbgrid1.selectedrows[i])); if yewu.DataSet.fieldbyname('业务状态').asstring<>'业务封帐' then begin yewu.DataSet.edit; yewu.DataSet['业务状态']:='业务封帐'; if bsSkinCheckRadioBox4.Checked then yewu.DataSet['会计期间']:=wwDBDateTimePicker1.date; yewu.DataSet.post; { Send_op_do('海运出口业务封帐,业务编号:'+yewu.DataSet.fieldbyname('业务编号').AsString +',主提单号:'+yewu.DataSet.fieldbyname('主提单号').AsString,'41', yewu.DataSet.fieldbyname('操作员').AsString, yewu.DataSet.fieldbyname('客服员').AsString, yewu.DataSet.fieldbyname('揽货人').AsString); } end; end; finally TAdoQuery(yewu.DataSet).requery; yewu.DataSet.GotoBookmark(bookmark); end; end else begin if yewu.DataSet.fieldbyname('业务状态').asstring<>'业务封帐' then begin yewu.DataSet.edit; yewu.DataSet['业务状态']:='业务封帐'; if bsSkinCheckRadioBox4.Checked then yewu.DataSet['会计期间']:=wwDBDateTimePicker1.date; yewu.DataSet.post; TAdoQuery(yewu.DataSet).Refresh; end; end; end; 2: begin if (frm_op_seai_close.dxdbgrid1.SelectedCount>=1) and (frm_op_seai_close.bsSkinPageControl1.TabIndex=0) then begin bookmark:=yewu.dataset.GetBookmark; try for i:=0 to frm_op_seai_close.dxdbgrid1.SelectedCount-1 do begin yewu.DataSet.GotoBookmark(pointer(frm_op_seai_close.dxdbgrid1.selectedrows[i])); if yewu.DataSet.fieldbyname('业务状态').asstring<>'业务封帐' then begin yewu.DataSet.edit; yewu.DataSet['业务状态']:='业务封帐'; if bsSkinCheckRadioBox4.Checked then yewu.DataSet['会计期间']:=wwDBDateTimePicker1.date; yewu.DataSet.post; { Send_op_do('海运进口业务封帐,业务编号:'+yewu.DataSet.fieldbyname('业务编号').AsString +',主提单号:'+yewu.DataSet.fieldbyname('主提单号').AsString,'41', yewu.DataSet.fieldbyname('操作员').AsString, yewu.DataSet.fieldbyname('客服员').AsString, yewu.DataSet.fieldbyname('揽货人').AsString); } end; end; finally TAdoQuery(yewu.DataSet).requery; yewu.DataSet.GotoBookmark(bookmark); end; end else begin if yewu.DataSet.fieldbyname('业务状态').asstring<>'业务封帐' then begin yewu.DataSet.edit; yewu.DataSet['业务状态']:='业务封帐'; if bsSkinCheckRadioBox4.Checked then yewu.DataSet['会计期间']:=wwDBDateTimePicker1.date; yewu.DataSet.post; TAdoQuery(yewu.DataSet).Refresh; end; end; end; 3: begin { if (frm_op_aire_close.dxdbgrid1.SelectedCount>=1) and (frm_op_aire_close.bsSkinPageControl1.TabIndex=0) then begin bookmark:=yewu.dataset.GetBookmark; try for i:=0 to frm_op_aire_close.dxdbgrid1.SelectedCount-1 do begin yewu.DataSet.GotoBookmark(pointer(frm_op_aire_close.dxdbgrid1.selectedrows[i])); if yewu.DataSet.fieldbyname('业务状态').asstring<>'业务封帐' then begin yewu.DataSet.edit; yewu.DataSet['业务状态']:='业务封帐'; if bsSkinCheckRadioBox4.Checked then yewu.DataSet['会计期间']:=wwDBDateTimePicker1.date; yewu.DataSet.post; end; end; finally TAdoQuery(yewu.DataSet).requery; yewu.DataSet.GotoBookmark(bookmark); end; end else begin if yewu.DataSet.fieldbyname('业务状态').asstring<>'业务封帐' then begin yewu.DataSet.edit; yewu.DataSet['业务状态']:='业务封帐'; if bsSkinCheckRadioBox4.Checked then yewu.DataSet['会计期间']:=wwDBDateTimePicker1.date; yewu.DataSet.post; TAdoQuery(yewu.DataSet).Refresh; end; end; } end; 4: begin { if (frm_op_airi_close.dxdbgrid1.SelectedCount>=1) and (frm_op_airi_close.bsSkinPageControl1.TabIndex=0) then begin bookmark:=yewu.dataset.GetBookmark; try for i:=0 to frm_op_airi_close.dxdbgrid1.SelectedCount-1 do begin yewu.DataSet.GotoBookmark(pointer(frm_op_airi_close.dxdbgrid1.selectedrows[i])); if yewu.DataSet.fieldbyname('业务状态').asstring<>'业务封帐' then begin yewu.DataSet.edit; yewu.DataSet['业务状态']:='业务封帐'; if bsSkinCheckRadioBox4.Checked then yewu.DataSet['会计期间']:=wwDBDateTimePicker1.date; yewu.DataSet.post; end; end; finally TAdoQuery(yewu.DataSet).requery; yewu.DataSet.GotoBookmark(bookmark); end; end else begin if yewu.DataSet.fieldbyname('业务状态').asstring<>'业务封帐' then begin yewu.DataSet.edit; yewu.DataSet['业务状态']:='业务封帐'; if bsSkinCheckRadioBox4.Checked then yewu.DataSet['会计期间']:=wwDBDateTimePicker1.date; yewu.DataSet.post; TAdoQuery(yewu.DataSet).Refresh; end; end; } end; {$IFDEF JGCHE} 5: begin { if (frm_op_airtruck_close.dxdbgrid1.SelectedCount>=1) and (frm_op_airtruck_close.bsSkinPageControl1.TabIndex=0) then begin bookmark:=yewu.dataset.GetBookmark; try for i:=0 to frm_op_airtruck_close.dxdbgrid1.SelectedCount-1 do begin yewu.DataSet.GotoBookmark(pointer(frm_op_airtruck_close.dxdbgrid1.selectedrows[i])); if yewu.DataSet.fieldbyname('业务状态').asstring<>'业务封帐' then begin yewu.DataSet.edit; yewu.DataSet['业务状态']:='业务封帐'; if bsSkinCheckRadioBox4.Checked then yewu.DataSet['会计期间']:=wwDBDateTimePicker1.date; yewu.DataSet.post; end; end; finally TAdoQuery(yewu.DataSet).requery; yewu.DataSet.GotoBookmark(bookmark); end; end else begin if yewu.DataSet.fieldbyname('业务状态').asstring<>'业务封帐' then begin yewu.DataSet.edit; yewu.DataSet['业务状态']:='业务封帐'; if bsSkinCheckRadioBox4.Checked then yewu.DataSet['会计期间']:=wwDBDateTimePicker1.date; yewu.DataSet.post; TAdoQuery(yewu.DataSet).Refresh; end; end; } end; {$ENDIF} 6: begin { if (frm_op_railway_close.dxdbgrid1.SelectedCount>=1) and (frm_op_railway_close.bsSkinPageControl1.TabIndex=0) then begin bookmark:=yewu.dataset.GetBookmark; try for i:=0 to frm_op_railway_close.dxdbgrid1.SelectedCount-1 do begin yewu.DataSet.GotoBookmark(pointer(frm_op_railway_close.dxdbgrid1.selectedrows[i])); if yewu.DataSet.fieldbyname('业务状态').asstring<>'业务封帐' then begin yewu.DataSet.edit; yewu.DataSet['业务状态']:='业务封帐'; if bsSkinCheckRadioBox4.Checked then yewu.DataSet['会计期间']:=wwDBDateTimePicker1.date; yewu.DataSet.post; end; end; finally TAdoQuery(yewu.DataSet).requery; yewu.DataSet.GotoBookmark(bookmark); end; end else begin if yewu.DataSet.fieldbyname('业务状态').asstring<>'业务封帐' then begin yewu.DataSet.edit; yewu.DataSet['业务状态']:='业务封帐'; if bsSkinCheckRadioBox4.Checked then yewu.DataSet['会计期间']:=wwDBDateTimePicker1.date; yewu.DataSet.post; TAdoQuery(yewu.DataSet).Refresh; end; end; } end; end; end; procedure Tfrm_op_close_select.select_feng_fee(); var i,rc:integer; can_do:boolean; bookmark:tbookmark; begin case close_select_num of 1: begin rc:=0; if (frm_op_seae_close.dxdbgrid1.SelectedCount>=1) and (frm_op_seae_close.bsSkinPageControl1.TabIndex=0) then begin bookmark:=yewu.dataset.GetBookmark; try for i:=0 to frm_op_seae_close.dxdbgrid1.SelectedCount-1 do begin yewu.DataSet.GotoBookmark(pointer(frm_op_seae_close.dxdbgrid1.selectedrows[i])); 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 yewu.DataSet['开船日期']>Logininfo.endday then yewu.DataSet['会计期间']:=yewu.DataSet['开船日期']; 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 +',主提单号:'+yewu.DataSet.fieldbyname('主提单号').AsString,'42', yewu.DataSet.fieldbyname('操作员').AsString, yewu.DataSet.fieldbyname('客服员').AsString, yewu.DataSet.fieldbyname('揽货人').AsString); } end else rc:=rc+1; end; end; finally TAdoQuery(yewu.DataSet).requery; yewu.DataSet.GotoBookmark(bookmark); end; end else 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 yewu.DataSet['开船日期']>Logininfo.endday then yewu.DataSet['会计期间']:=yewu.DataSet['开船日期']; 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 +',主提单号:'+yewu.DataSet.fieldbyname('主提单号').AsString,'42', yewu.DataSet.fieldbyname('操作员').AsString, yewu.DataSet.fieldbyname('客服员').AsString, yewu.DataSet.fieldbyname('揽货人').AsString); } end else rc:=1; end; TAdoQuery(yewu.DataSet).Refresh; end; if rc<>0 then MessageDlg('封帐完毕,其中有'+inttostr(rc)+'票业务没有被费用封帐,请注意!',mtWarning,[mbyes],0); end; 2: begin rc:=0; if (frm_op_seai_close.dxdbgrid1.SelectedCount>=1) and (frm_op_seai_close.bsSkinPageControl1.TabIndex=0) then begin bookmark:=yewu.dataset.GetBookmark; try for i:=0 to frm_op_seai_close.dxdbgrid1.SelectedCount-1 do begin yewu.DataSet.GotoBookmark(pointer(frm_op_seai_close.dxdbgrid1.selectedrows[i])); 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 yewu.DataSet['进口日期']>Logininfo.endday then yewu.DataSet['会计期间']:=yewu.DataSet['进口日期']; 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 +',主提单号:'+yewu.DataSet.fieldbyname('主提单号').AsString,'42', yewu.DataSet.fieldbyname('操作员').AsString, yewu.DataSet.fieldbyname('客服员').AsString, yewu.DataSet.fieldbyname('揽货人').AsString); } end else rc:=rc+1; end; end; finally TAdoQuery(yewu.DataSet).requery; yewu.DataSet.GotoBookmark(bookmark); end; end else 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 yewu.DataSet['进口日期']>Logininfo.endday then yewu.DataSet['会计期间']:=yewu.DataSet['进口日期']; 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 +',主提单号:'+yewu.DataSet.fieldbyname('主提单号').AsString,'42', yewu.DataSet.fieldbyname('操作员').AsString, yewu.DataSet.fieldbyname('客服员').AsString, yewu.DataSet.fieldbyname('揽货人').AsString); } end else rc:=1; end; TAdoQuery(yewu.DataSet).Refresh; end; if rc<>0 then MessageDlg('封帐完毕,其中有'+inttostr(rc)+'票业务没有被费用封帐,请注意!',mtWarning,[mbyes],0); end; 3: begin { rc:=0; if (frm_op_aire_close.dxdbgrid1.SelectedCount>=1) and (frm_op_aire_close.bsSkinPageControl1.TabIndex=0) then begin bookmark:=yewu.dataset.GetBookmark; try for i:=0 to frm_op_aire_close.dxdbgrid1.SelectedCount-1 do begin yewu.DataSet.GotoBookmark(pointer(frm_op_aire_close.dxdbgrid1.selectedrows[i])); 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 yewu.DataSet['一程开航日期']>Logininfo.endday then yewu.DataSet['会计期间']:=yewu.DataSet['一程开航日期']; 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; end; finally TAdoQuery(yewu.DataSet).requery; yewu.DataSet.GotoBookmark(bookmark); end; end else 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 yewu.DataSet['一程开航日期']>Logininfo.endday then yewu.DataSet['会计期间']:=yewu.DataSet['一程开航日期']; 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:=1; end; TAdoQuery(yewu.DataSet).Refresh; end; if rc<>0 then MessageDlg('封帐完毕,其中有'+inttostr(rc)+'票业务没有被费用封帐,请注意!',mtWarning,[mbyes],0); } end; 4: begin { rc:=0; if (frm_op_airi_close.dxdbgrid1.SelectedCount>=1) and (frm_op_airi_close.bsSkinPageControl1.TabIndex=0) then begin bookmark:=yewu.dataset.GetBookmark; try for i:=0 to frm_op_airi_close.dxdbgrid1.SelectedCount-1 do begin yewu.DataSet.GotoBookmark(pointer(frm_op_airi_close.dxdbgrid1.selectedrows[i])); 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 yewu.DataSet['进口日期']>Logininfo.endday then yewu.DataSet['会计期间']:=yewu.DataSet['进口日期']; 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; end; finally TAdoQuery(yewu.DataSet).requery; yewu.DataSet.GotoBookmark(bookmark); end; end else 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 yewu.DataSet['进口日期']>Logininfo.endday then yewu.DataSet['会计期间']:=yewu.DataSet['进口日期']; 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:=1; end; TAdoQuery(yewu.DataSet).Refresh; end; if rc<>0 then MessageDlg('封帐完毕,其中有'+inttostr(rc)+'票业务没有被费用封帐,请注意!',mtWarning,[mbyes],0); } end; {$IFDEF JGCHE} 5: begin rc:=0; { if (frm_op_airtruck_close.dxdbgrid1.SelectedCount>=1) and (frm_op_airtruck_close.bsSkinPageControl1.TabIndex=0) then begin bookmark:=yewu.dataset.GetBookmark; try for i:=0 to frm_op_airtruck_close.dxdbgrid1.SelectedCount-1 do begin yewu.DataSet.GotoBookmark(pointer(frm_op_airtruck_close.dxdbgrid1.selectedrows[i])); 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 yewu.DataSet['发车日期']>Logininfo.endday then yewu.DataSet['会计期间']:=yewu.DataSet['发车日期']; 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; end; finally TAdoQuery(yewu.DataSet).requery; yewu.DataSet.GotoBookmark(bookmark); end; end else 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 yewu.DataSet['发车日期']>Logininfo.endday then yewu.DataSet['会计期间']:=yewu.DataSet['发车日期']; 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:=1; end; TAdoQuery(yewu.DataSet).Refresh; end; if rc<>0 then MessageDlg('封帐完毕,其中有'+inttostr(rc)+'票业务没有被费用封帐,请注意!',mtWarning,[mbyes],0); } end; {$ENDIF} 6: begin { rc:=0; if (frm_op_railway_close.dxdbgrid1.SelectedCount>=1) and (frm_op_railway_close.bsSkinPageControl1.TabIndex=0) then begin bookmark:=yewu.dataset.GetBookmark; try for i:=0 to frm_op_railway_close.dxdbgrid1.SelectedCount-1 do begin yewu.DataSet.GotoBookmark(pointer(frm_op_railway_close.dxdbgrid1.selectedrows[i])); 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 yewu.DataSet['发车期']>Logininfo.endday then yewu.DataSet['会计期间']:=yewu.DataSet['发车日期']; 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; end; finally TAdoQuery(yewu.DataSet).requery; yewu.DataSet.GotoBookmark(bookmark); end; end else 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 yewu.DataSet['发车日期']>Logininfo.endday then yewu.DataSet['会计期间']:=yewu.DataSet['发车日期']; 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:=1; end; TAdoQuery(yewu.DataSet).Refresh; end; if rc<>0 then MessageDlg('封帐完毕,其中有'+inttostr(rc)+'票业务没有被费用封帐,请注意!',mtWarning,[mbyes],0); } end; end; end; procedure Tfrm_op_close_select.bsSkinButton5Click(Sender: TObject); begin close; end; procedure Tfrm_op_close_select.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_select.select_feng_all(); close; exit; end; if bsSkinCheckRadioBox1.Checked then begin frm_op_close_select.select_feng_op(); close; exit; end; if bsSkinCheckRadioBox2.Checked then begin frm_op_close_select.select_feng_fee(); close; exit; end; end; procedure Tfrm_op_close_select.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.