Page 1 of 1

Print invoice when salesorder.Process() is done

PostPosted: Fri Dec 10, 2021 2:16 pm
by DannyC
I've got some plugin code which does a sales order process to close it when & as appropriate.

Stupid question...

I notice that the .Process() has some parameters
process.png
process.png (2.46 KiB) Viewed 1007 times


I'm assuming I can specify during the process to print an invoice (or delivery docket or whatever) by adding relevant parameters. I just can't get the right syntax.
Any examples?

Re: Print invoice when salesorder.Process() is done

PostPosted: Fri Dec 10, 2021 2:54 pm
by SBarnes
The run number can be an empty string and report collection is the possible reports for printing as normal.

Re: Print invoice when salesorder.Process() is done  Topic is solved

PostPosted: Fri Dec 10, 2021 4:29 pm
by pricerc
DannyC wrote:I've got some plugin code which does a sales order process to close it when & as appropriate.

Stupid question...

I notice that the .Process() has some parameters
process.png


I'm assuming I can specify during the process to print an invoice (or delivery docket or whatever) by adding relevant parameters. I just can't get the right syntax.
Any examples?


Code: Select all
    public static void PrintInvoice(SalesOrder salesOrder, string formatName)
    {
        foreach (SalesOrderReport salesOrderReport in salesOrder.GetCandidateReportsToPrint())
        {
            if (salesOrderReport.Name == formatName && salesOrderReport.BillingType == salesOrder.BillType)
            {
                salesOrder.Print(new JiwaCollection<SalesOrderReport>() { salesOrderReport });
                return;
            }
        }
        // missing handling for formatName not found.
    }