1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
function TfrmFactureV2.CreateDocument(Mode: integer) : Boolean;
var
sDest, sProjectFile,
sBACK1, sBACK2, sBACK3, sCOLOR, sNID : String;
sText : String;
begin
With DMFactuV2 do
begin
With TIniFile.Create(GAPPPATH + sIniFile) do
try
sDest := ReadString('DIRSECTION','FACTDIR',GAPPREPORT);
sProjectFile := ReadString('DIRSECTION','FCTFDIR',GAPPDATA + 'factu.rav');
sBACK1 := ReadString('ADRBASSECTION','BACK1','');
sBACK2 := ReadString('ADRBASSECTION','BACK2','');
sBACK3 := ReadString('ADRBASSECTION','BACK3','');
sCOLOR := ReadString('DIVERSSECTION','COLOR','');
sNID := ReadString('DIVERSSECTION','NID','');
finally
free;
end;
With RvProject1 do
try
ProjectFile := sProjectFile;
Open;
SetParam('PBack1',sBACK1);
SetParam('PBack2',sBACK2);
SetParam('PBack3',sBACK3);
SetParam('PColor',sCOLOR);
SetParam('PNID',sNID);
SetParam('PPORT','0');
SetParam('PACOMPTE','0');
Close;
RvSystem1.SystemSetups := RvSystem1.SystemSetups - [ssAllowSetup];
case Mode of
MODE_PREVIEW: begin // Cfg de prévisualisation
RvSystem1.RenderObject := RvRenderPreview1;
RvSystem1.DefaultDest := rdPreview;
sText := 'Génération de la Preview : ';
end;
MODE_PDF: begin // cfg pour la génération d'un PDF
RvSystem1.RenderObject := RvRenderPDF1;
RvSystem1.DefaultDest := rdFile;
sText := 'Génération du PDF : ';
end;
MODE_PRINT: begin // Cfg Pour l'impression
RvSystem1.RenderObject := RvRenderPrinter1;
RvSystem1.DefaultDest := rdPrinter;
sText := 'Impression : ';
end;
end;
RvSystem1.DoNativeOutput := false;
RvSystem1.OutputFileName := sDest + '\' + adoQTmp.FieldByName('NomFacture').AsString + '.pdf';
ExecuteReport('FTReportFacture');
Memo1.Lines.Add(FormatDateTime('[dd/mm/yyyy hh:mm:ss] :',now) +
sText + 'OK');
Result := True;
Except on E:Exception do
begin
Memo1.Lines.Add(FormatDateTime('[dd/mm/yyyy hh:mm:ss] :',now) +
sText + E.Message);
Result := False;
end;
end;
end;
end; |
Partager