procedure TForm3.BitBtn3Click(Sender: TObject);
var
StringList: TStringList;
lig :string;
i,x :integer;
y:Real;
begin
adotable1.close;
ADOQuery1.close;
ADOQuery2.close;
adotable1.open;
ADOQuery1.open;
ADOQuery2.open;
ADOQuery1.active:=false;
ADOQuery2.active:=false;
ADOQuery1.active:=true;
ADOQuery2.active:=true;
StringList:= TStringList.Create;
try
edit5.text:= ExtractNumberInString(cxDBCurrencyEdit1.text);
lig:= ('*'+'00000000'+Format('%.10d',[strtoint(edit4.text)])+Format('%.2d',[strtoint(edit7.text)])+Format('%.13d',[strtoint(edit5.text)])+Format('%.7d',[strtoint(cxDBSpinEdit1.text)])+FormatFloat('00', strtofloat(edit2.Text))+edit3.Text+' '+'0');
StringList.Append(lig);
//هدا الكود لانشاء راس الملف النصي الدي يحتوي على تاريخ الراتب الشهري وعدد المستفيدين من الراتب و بعض المعلومات
//**************************//
و هدا الكود لانشاء بقية الملف النصي ويدرس بعض الاحتمالات الخاصة بالفاصلة
//*************************//
ADOTable1.DisableControls;
ADOTable1.First;
while not ADOTable1.Eof do
begin
Edt1.Text:= ADOTable1.FieldByName('net_a_payer').AsString;
y:= strtofloat(Edt1.Text)- (int(strtofloat(Edt1.Text)) ) ;
if (y)=0 then
begin
StringList.Append( '*'+ '00000000' +
Format('%.10d',[strtoint(ADOTable1.FieldByName('compte').AsString )])
+
Format('%.2d',[(ADOTable1.FieldByName('clé').Asinteger)])
+
Format('%.13d',[strtoint(ExtractNumberInString((ADOTable1.FieldByName('net_a_payer').AsString)+'.'+'00'))])
+
concatblanch(ADOTable1.FieldByName('nom').AsString)
+ '1'
);
end
else
begin
if (y>0) and (y<(0.9)) then
begin
StringList.Append( '*'+ '00000000' +
Format('%.10d',[strtoint(ADOTable1.FieldByName('compte').AsString )])
+
Format('%.2d',[(ADOTable1.FieldByName('clé').Asinteger)])
+
Format('%.13d',[strtoint(ExtractNumberInString((ADOTable1.FieldByName('net_a_payer').AsString)+'0'))])
+
concatblanch(ADOTable1.FieldByName('nom').AsString)
+ '1'
);
end
else
begin
// ADOTable1.FieldByName('net_a_payer').Value:=Edit6.Text;
StringList.Append( '*'+ '00000000' +
Format('%.10d',[strtoint(ADOTable1.FieldByName('compte').AsString )])
+
Format('%.2d',[(ADOTable1.FieldByName('clé').Asinteger)])
+
Format('%.13d',[strtoint(ExtractNumberInString(ADOTable1.FieldByName('net_a_payer').AsString))])
+
concatblanch(ADOTable1.FieldByName('nom').AsString)
+ '1'
);
end;
end ;
//showmessage (ADOTable1.FieldByName('net_a_payer').AsString);
ADOTable1.Next;
end;
ADOTable1.EnableControls;
StringList.SaveToFile(edit1.text+'\paie'+''+'mois'+''+edit2.text+edit3.text+'.txt');
showmessage ('le fichier text été criée avec succeé');
StringList.Free;
except
showmessage('ereur ');
end;
end;