How to print sales Invoice ?


public void printInvoiceReport(PurchId _purchId)
{
    ReportRun report;
    RecordSortedList List = new RecordSortedList(tableNum(VendInvoiceJour));

    VendInvoiceJour VendInvoiceJour = VendInvoiceJour::findFromPurchId(_purchId);
    PurchFormLetter PurchFormLetter;
    ;

    if (VendInvoiceJour.RecId)
    {

        report = new ReportRun(new Args(ReportStr(PurchInvoice)));

        List.ins(VendInvoiceJour);
        report.args().object(List);
        report.query().interactive(false);
        report.report().interactive(false);
        report.args().parmEnum(0);
        report.args().parmEnumType(920);

        report.args().name("KeepSettings");
        report.args().caller(PurchFormLetter);
        report.setTarget(PrintMedium::Screen);
        report.printJobSettings().setTarget(PrintMedium::Screen);
        report.printJobSettings().preferredTarget(PrintMedium::Screen);

        PurchFormLetter     =   PurchFormLetter::construct(DocumentStatus::Invoice);
        PurchFormLetter.updatePrinterSettingsFormLetter(report.printJobSettings().packPrintJobSettings(), PrintSetupOriginalCopy::Original);
        PurchFormLetter.updatePrinterSettingsFormLetter(report.printJobSettings().packPrintJobSettings(), PrintSetupOriginalCopy::Copy);

        // print invoice
        VendInvoiceJour.printJournal(PurchFormLetter);
    }
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.