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.

366 lines
15 KiB
Plaintext

11 months ago
unit u_seai_sf_xsf;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, dxExEdtr, dxDBGrid, dxDBTLCl, dxGrClms, dxTL, dxDBCtrl, dxCntner,
DB, ADODB, StdCtrls, Mask, bsSkinBoxCtrls, bsSkinCtrls, kbmMemTable,DateUtils,
RxLookup;
type
Tfrm_seai_sf_xsf = class(TForm)
t_op_ctn: TADOQuery;
t_op_ctn1: TDataSource;
dxDBGrid1: TdxDBGrid;
dxDBGrid1Column1: TdxDBGridMaskColumn;
dxDBGrid1Column2: TdxDBGridColumn;
dxDBGrid1Column3: TdxDBGridColumn;
bsSkinPanel1: TbsSkinPanel;
bsSkinButton1: TbsSkinButton;
kmltbl: TkbmMemTable;
kmltblField: TStringField;
kmltblField2: TStringField;
kmltblField3: TStringField;
kmltblField4: TIntegerField;
kmltblField5: TFloatField;
dxDBGrid1Column4: TdxDBGridColumn;
dxDBGrid1Column5: TdxDBGridColumn;
dxDBGrid1Column6: TdxDBGridColumn;
kmltblField7: TStringField;
dxDBGrid1Column7: TdxDBGridColumn;
kmltblField8: TIntegerField;
dxDBGrid1Column8: TdxDBGridColumn;
bsSkinButton2: TbsSkinButton;
Label131: TLabel;
Edit2: TEdit;
Label213: TLabel;
RxDBLookupCombo57: TRxDBLookupCombo;
Label12: TLabel;
RxDBLookupCombo1: TRxDBLookupCombo;
dxDBGrid1Column10: TdxDBGridColumn;
dxDBGrid1Column11: TdxDBGridColumn;
kmltblField10: TIntegerField;
kmltblField6: TStringField;
kmltblField9: TStringField;
procedure FormShow(Sender: TObject);
procedure bsSkinButton1Click(Sender: TObject);
procedure bsSkinButton2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
function GetCQFEE(bsNo,Carrer:string;CQDay,Days,FreeDays:Integer):Double;
end;
var
frm_seai_sf_xsf: Tfrm_seai_sf_xsf;
implementation
uses my_sys_function;
{$R *.dfm}
function Tfrm_seai_sf_xsf.GetCQFEE(bsNo,Carrer:string;CQDay,Days,FreeDays:Integer):Double;
var aAdoQuery,bAdoQuery:TAdoQuery;
begin
result:=0;
aAdoQuery:=CreateAdoQuery;
bAdoQuery:=CreateAdoQuery;
with bAdoQuery do
begin
Close;SQL.Clear;
SQL.Add('select *');
SQL.Add('from t_ctn_cqfee');
SQL.Add('where <20>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>=:<3A>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD> and <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ=:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ');
end;
with aAdoQuery do
try
Close;SQL.Clear;
SQL.Add('select *');
SQL.Add('from t_op_ctn');
SQL.Add('where <20><><EFBFBD><EFBFBD>=:<3A><><EFBFBD><EFBFBD>');
Parameters.ParamByName('<27><><EFBFBD><EFBFBD>').Value:=bsNo;
Open;First;
while not Eof do
begin
bAdoQuery.Close;
bAdoQuery.Parameters.ParamByName('<27>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD>').Value:=Carrer;
bAdoQuery.Parameters.ParamByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ').Value:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ').Value;
bAdoQuery.Open;
if bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>').asFloat=0 then
begin
if CQDay<=bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>1').AsInteger then
begin
result:=result+CQDay*bAdoQuery.FieldByName('<27><>ʹ<EFBFBD><CAB9>1').asFloat;
end
else
if (CQDay>bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>1').AsInteger) and (CQDay<=bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>2').AsInteger) then
begin
result:=result+CQDay*bAdoQuery.FieldByName('<27><>ʹ<EFBFBD><CAB9>2').asFloat;
end
else
if (CQDay>bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>2').AsInteger) and (CQDay<=bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>3').AsInteger) then
begin
result:=result+CQDay*bAdoQuery.FieldByName('<27><>ʹ<EFBFBD><CAB9>3').asFloat;
end
else
if (CQDay>bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>3').AsInteger) and (CQDay<=bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>4').AsInteger) then
begin
result:=result+CQDay*bAdoQuery.FieldByName('<27><>ʹ<EFBFBD><CAB9>4').asFloat;
end
else
if (CQDay>bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>4').AsInteger) and (CQDay<=bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>5').AsInteger) then
begin
result:=result+CQDay*bAdoQuery.FieldByName('<27><>ʹ<EFBFBD><CAB9>5').asFloat;
end
else
if CQDay>bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>5').AsInteger then
begin
result:=result+CQDay*bAdoQuery.FieldByName('<27><>ʹ<EFBFBD><CAB9>5').asFloat;
end;
end
else //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
begin
if (Days>bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>5').AsInteger) then
begin
if FreeDays<Days then
begin
result:=result+(Days-FreeDays)*bAdoQuery.FieldByName('<27><>ʹ<EFBFBD><CAB9>5').asFloat;
end;
end
else
if (Days>bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>4').AsInteger) and (Days<=bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>5').AsInteger) then
begin
if (FreeDays>bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>4').AsInteger) and (FreeDays<=bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>5').AsInteger) then
begin
if FreeDays<Days then
begin
result:=result+(Days-FreeDays)*bAdoQuery.FieldByName('<27><>ʹ<EFBFBD><CAB9>5').asFloat;
end;
end
else
if (FreeDays>bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>3').AsInteger) and (FreeDays<=bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>4').AsInteger) then
begin
result:=result+(Days-bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>4').AsInteger)*bAdoQuery.FieldByName('<27><>ʹ<EFBFBD><CAB9>5').asFloat;
if FreeDays<bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>4').AsInteger then
begin
result:=result+(bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>4').AsInteger-FreeDays)*bAdoQuery.FieldByName('<27><>ʹ<EFBFBD><CAB9>4').asFloat;
end;
end
else
if (FreeDays>bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>2').AsInteger) and (FreeDays<=bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>3').AsInteger) then
begin
result:=result+(Days-bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>4').AsInteger)*bAdoQuery.FieldByName('<27><>ʹ<EFBFBD><CAB9>5').asFloat;
result:=result+(bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>4').AsInteger-bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>3').AsInteger)*bAdoQuery.FieldByName('<27><>ʹ<EFBFBD><CAB9>4').asFloat;
if FreeDays<bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>3').AsInteger then
begin
result:=result+(bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>3').AsInteger-FreeDays)*bAdoQuery.FieldByName('<27><>ʹ<EFBFBD><CAB9>3').asFloat;
end;
end
else
if (FreeDays>bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>1').AsInteger) and (FreeDays<=bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>2').AsInteger) then
begin
result:=result+(Days-bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>4').AsInteger)*bAdoQuery.FieldByName('<27><>ʹ<EFBFBD><CAB9>5').asFloat;
result:=result+(bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>4').AsInteger-bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>3').AsInteger)*bAdoQuery.FieldByName('<27><>ʹ<EFBFBD><CAB9>4').asFloat;
result:=result+(bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>3').AsInteger-bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>2').AsInteger)*bAdoQuery.FieldByName('<27><>ʹ<EFBFBD><CAB9>3').asFloat;
if FreeDays<bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>2').AsInteger then
begin
result:=result+(bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>2').AsInteger-FreeDays)*bAdoQuery.FieldByName('<27><>ʹ<EFBFBD><CAB9>2').asFloat;
end;
end;
end
else
if (Days>bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>3').AsInteger) and (Days<=bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>4').AsInteger) then
begin
if (FreeDays>bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>3').AsInteger) and (FreeDays<=bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>4').AsInteger) then
begin
if FreeDays<Days then
begin
result:=result+(Days-FreeDays)*bAdoQuery.FieldByName('<27><>ʹ<EFBFBD><CAB9>4').asFloat;
end;
end
else
if (FreeDays>bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>2').AsInteger) and (FreeDays<=bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>3').AsInteger) then
begin
result:=result+(Days-bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>3').AsInteger)*bAdoQuery.FieldByName('<27><>ʹ<EFBFBD><CAB9>4').asFloat;
if FreeDays<bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>3').AsInteger then
begin
result:=result+(bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>3').AsInteger-FreeDays)*bAdoQuery.FieldByName('<27><>ʹ<EFBFBD><CAB9>3').asFloat;
end;
end
else
if (FreeDays>bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>1').AsInteger) and (FreeDays<=bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>2').AsInteger) then
begin
result:=result+(Days-bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>3').AsInteger)*bAdoQuery.FieldByName('<27><>ʹ<EFBFBD><CAB9>4').asFloat;
result:=result+(bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>3').AsInteger-bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>2').AsInteger)*bAdoQuery.FieldByName('<27><>ʹ<EFBFBD><CAB9>3').asFloat;
if FreeDays<bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>2').AsInteger then
begin
result:=result+(bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>2').AsInteger-FreeDays)*bAdoQuery.FieldByName('<27><>ʹ<EFBFBD><CAB9>2').asFloat;
end;
end;
end
else
if (Days>bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>2').AsInteger) and (Days<=bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>3').AsInteger) then
begin
if (FreeDays>bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>2').AsInteger) and (FreeDays<=bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>3').AsInteger) then
begin
if FreeDays<Days then
begin
result:=result+(Days-FreeDays)*bAdoQuery.FieldByName('<27><>ʹ<EFBFBD><CAB9>3').asFloat;
end;
end
else
if (FreeDays>bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>1').AsInteger) and (FreeDays<=bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>2').AsInteger) then
begin
result:=result+(Days-bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>2').AsInteger)*bAdoQuery.FieldByName('<27><>ʹ<EFBFBD><CAB9>3').asFloat;
if FreeDays<bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>2').AsInteger then
begin
result:=result+(bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>2').AsInteger-FreeDays)*bAdoQuery.FieldByName('<27><>ʹ<EFBFBD><CAB9>2').asFloat;
end;
end;
end
else
if (Days>bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>1').AsInteger) and (Days<=bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>2').AsInteger) then
begin
if FreeDays<bAdoQuery.FieldByName('<27><><EFBFBD><EFBFBD>2').AsInteger then
begin
result:=result+(Days-FreeDays)*bAdoQuery.FieldByName('<27><>ʹ<EFBFBD><CAB9>2').asFloat;
end;
end;
end;
Next;
end;
finally
aAdoQuery.Free;
bAdoQuery.Free;
end;
end;
procedure Tfrm_seai_sf_xsf.FormShow(Sender: TObject);
var YYYY,MM,DD:Word;
begin
DecodeDate(Date,YYYY,MM,DD);
{
bsSkinDateEdit1.Date:=EncodeDate(YYYY,MM,1);
bsSkinDateEdit2.Date:=Date;
}
// t_op_ctn.Close;
// t_op_ctn.Open;
end;
procedure Tfrm_seai_sf_xsf.bsSkinButton1Click(Sender: TObject);
var days:integer;
begin
kmltbl.EmptyTable;
kmltbl.Open;
with t_op_ctn do
begin
Close;SQL.Clear;
SQL.Add('select t_op_seai.<2E><><EFBFBD><EFBFBD>,t_op_seai.ί<>е<EFBFBD>λ,t_op_seai.<2E><><EFBFBD><EFBFBD><E1B5A5>,t_op_seai.<2E><><EFBFBD><EFBFBD>Ա,t_op_seai.<2E><><EFBFBD><EFBFBD>˾,t_op_seai.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,t_op_seai.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>,t_op_seai.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,t_op_seai.<2E>Ż<EFBFBD><C5BB><EFBFBD><EFBFBD><EFBFBD>');
SQL.Add('from t_op_seai');
SQL.Add('where t_op_seai.װ<>˷<EFBFBD>ʽ=''<27><><EFBFBD><EFBFBD>'' and not <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> is null and datediff(day,t_op_seai.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,getdate())>=t_op_seai.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD> and t_op_seai.<2E>Ż<EFBFBD><C5BB><EFBFBD><EFBFBD><EFBFBD> is null');
if Trim(RxDBLookupCombo57.DisplayValues[1])<>'' then
begin
SQL.Add('and t_op_seai.ί<>е<EFBFBD>λ=:ί<>е<EFBFBD>λ');
Parameters.ParamByName('ί<>е<EFBFBD>λ').Value:=Trim(RxDBLookupCombo57.DisplayValues[1]);
end;
if Trim(RxDBLookupCombo1.DisplayValues[1])<>'' then
begin
SQL.Add('and t_op_seai.<2E><><EFBFBD><EFBFBD>˾=:<3A><><EFBFBD><EFBFBD>˾');
Parameters.ParamByName('<27><><EFBFBD><EFBFBD>˾').Value:=Trim(RxDBLookupCombo1.DisplayValues[1]);
end;
if Trim(Edit2.Text)<>'' then
begin
SQL.Add('and t_op_seai.<2E><><EFBFBD><EFBFBD><E1B5A5> like '+''''+'%'+Edit2.text+'%'+'''');
end;
Open;First;
while not Eof do
begin
kmltbl.Insert;
kmltbl.FieldByName('ί<>е<EFBFBD>λ').Value:=FieldByName('ί<>е<EFBFBD>λ').Value;
kmltbl.FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').Value:=FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').Value;
kmltbl.FieldByName('<27><><EFBFBD><EFBFBD>Ա').Value:=FieldByName('<27><><EFBFBD><EFBFBD>Ա').Value;
kmltbl.FieldByName('<27><><EFBFBD><EFBFBD>˾').Value:=FieldByName('<27><><EFBFBD><EFBFBD>˾').Value;
kmltbl.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=FormatDateTime('YYYY-MM-DD',FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value);
kmltbl.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=FieldByName('<27>Ż<EFBFBD><C5BB><EFBFBD><EFBFBD><EFBFBD>').Value;
kmltbl.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>').Value:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>').Value;
if FieldByName('<27>Ż<EFBFBD><C5BB><EFBFBD><EFBFBD><EFBFBD>').IsNull then
begin
kmltbl.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=daysBetween(Date,FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value)-FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>').AsInteger;
days:=daysBetween(Date,FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value);
end
else
begin
kmltbl.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=daysBetween(FieldByName('<27>Ż<EFBFBD><C5BB><EFBFBD><EFBFBD><EFBFBD>').AsDateTime,FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value)-FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>').AsInteger;
days:=daysBetween(FieldByName('<27>Ż<EFBFBD><C5BB><EFBFBD><EFBFBD><EFBFBD>').AsDateTime,FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value);
end;
if days>FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>').AsInteger then
kmltbl.FieldByName('<27><><EFBFBD>ڽ<EFBFBD><DABD><EFBFBD>').Value:=GetCQFEE(FieldByName('<27><><EFBFBD><EFBFBD>').AsString,FieldByName('<27><><EFBFBD><EFBFBD>˾').AsString,kmltbl.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger,days,FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>').Asinteger)
else kmltbl.FieldByName('<27><><EFBFBD>ڽ<EFBFBD><DABD><EFBFBD>').Value:=0;
kmltbl.FieldByName('ʵ<><CAB5>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=days;
kmltbl.Post;
Next;
end;
end;
end;
procedure Tfrm_seai_sf_xsf.bsSkinButton2Click(Sender: TObject);
var days:integer;
begin
kmltbl.EmptyTable;
kmltbl.Open;
with t_op_ctn do
begin
Close;SQL.Clear;
SQL.Add('select t_op_seai.<2E><><EFBFBD><EFBFBD>,t_op_seai.ί<>е<EFBFBD>λ,t_op_seai.<2E><><EFBFBD><EFBFBD><E1B5A5>,t_op_seai.<2E><><EFBFBD><EFBFBD>Ա,t_op_seai.<2E><><EFBFBD><EFBFBD>˾,t_op_seai.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>,t_op_seai.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,t_op_seai.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,t_op_seai.<2E>Ż<EFBFBD><C5BB><EFBFBD><EFBFBD><EFBFBD>');
SQL.Add('from t_op_seai');
SQL.Add('where t_op_seai.װ<>˷<EFBFBD>ʽ=''<27><><EFBFBD><EFBFBD>'' and not <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> is null ');
Open;First;
while not Eof do
begin
kmltbl.Insert;
kmltbl.FieldByName('ί<>е<EFBFBD>λ').Value:=FieldByName('ί<>е<EFBFBD>λ').AsString;
kmltbl.FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').Value:=FieldByName('<27><><EFBFBD><EFBFBD><E1B5A5>').AsString;
kmltbl.FieldByName('<27><><EFBFBD><EFBFBD>Ա').Value:=FieldByName('<27><><EFBFBD><EFBFBD>Ա').AsString;
kmltbl.FieldByName('<27><><EFBFBD><EFBFBD>˾').Value:=FieldByName('<27><><EFBFBD><EFBFBD>˾').AsString;
kmltbl.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value:=FormatDateTime('YYYY-MM-DD',FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value);
kmltbl.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>').Value:=FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>').Value;
if FieldByName('<27>Ż<EFBFBD><C5BB><EFBFBD><EFBFBD><EFBFBD>').IsNull then
begin
kmltbl.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger:=daysBetween(Date,FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value)-FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>').AsInteger;
days:=daysBetween(Date,FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value);
end
else
begin
kmltbl.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger:=daysBetween(FieldByName('<27>Ż<EFBFBD><C5BB><EFBFBD><EFBFBD><EFBFBD>').AsDateTime,FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').Value)-FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>').AsInteger;
days:=daysBetween(Date,FieldByName('<27>Ż<EFBFBD><C5BB><EFBFBD><EFBFBD><EFBFBD>').Value);
end;
if days>FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>').AsInteger then
kmltbl.FieldByName('<27><><EFBFBD>ڽ<EFBFBD><DABD><EFBFBD>').value:=GetCQFEE(FieldByName('<27><><EFBFBD><EFBFBD>').AsString,FieldByName('<27><><EFBFBD><EFBFBD>˾').AsString,kmltbl.FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger,days,FieldByName('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>').Asinteger)
else kmltbl.FieldByName('<27><><EFBFBD>ڽ<EFBFBD><DABD><EFBFBD>').AsInteger:=0;
kmltbl.FieldByName('ʵ<><CAB5>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>').AsInteger:=days;
kmltbl.Post;
Next;
end;
end;
end;
end.