Documentation Index

Fetch the complete documentation index at: https://kb.lasernetgroup.com/llms.txt

Use this file to discover all available pages before exploring further.

How Do I Post SalesInvoice (FormLetter) to Lasernet Destinations from Code?

Prev Next

This article provides a code sample for posting SalesInvoice (FormLetter) to Lasernet Destinations from code.

In general, it does not matter which report the code is applied to. Our sample is based on the SalesInvoice.ReportResolution.

staticvoidLAC_SalesInvoiceUpdate(Args _args)

{

 SalesFormLetter salesFormLetter;

 SalesTable salesTable;

 SRSPrintDestinationSettings printSettings;

 LACDestinationSettings LACDestinationSettings =newLACDestinationSettings();

 ;

 salesTable = SalesTable::find("000740");

 salesFormLetter = SalesFormLetter::construct(DocumentStatus::Invoice);

 SalesFormLetter.getLast();

 

 printSettings =newSRSPrintDestinationSettings();

 printSettings.printMediumType(SRSPrintMediumType::LAC);

 

/* use the following if the destination should be Fax -->

 LACDestinationSettings.destTypes4Print(LACDestTypes4Print::Fax);

 LACDestinationSettings.fax('fax number');

 <-- Fax */

 

/* use the following if the destination should be Custom port -->

 LACDestinationSettings.destTypes4Print(LACDestTypes4Print::CustomPort);

 LACDestinationSettings.customPort('value for customport');

 <-- Custom port */

 

/* use the following if the destination should be Email --> */

 LACDestinationSettings.destTypes4Print(LACDestTypes4Print::Email);

 LACDestinationSettings.emailTo('The emailaddress');

 LACDestinationSettings.emailBcc('Bcc emailaddress');

 LACDestinationSettings.emailSubject('Text for email subject');

 LACDestinationSettings.emailBody('Text for Email body');

 LACDestinationSettings.emailFrom('From emailaddress');

 LACDestinationSettings.emailFromName('From email name');

/* <-- Email destination */

 

/* use the following if the destination should be Printer -->

 LACDestinationSettings.destTypes4Print(LACDestTypes4Print::Printer);

 LACDestinationSettings.printer('LaserNet Printername');

 LACDestinationSettings.printerProfile('LaserNet Printer profile');

 <-- Printer */

 

/* use the following if the predefined destinations should be used with fallback -->

 LACDestinationSettings.destTypes4Print(LACDestTypes4Print::UsePredefinedDest);

 LACDestinationSettings.defaultDestTypes4Print(LACDestTypes4DefaultPrint::Printer); // Fallback destination type

 LACDestinationSettings.printer('Fallback printername');

 LACDestinationSettings.printerProfile('Fallback Printer profile');

 <-- Predefined destinations */

 

/* The following control the docu-attachment type and restriction -->

 LACDestinationSettings.docuType();

 LACDestinationSettings.docuRestriction();

 <-- Docu-attachment and restriction */

 

/* The following control which overlayId to use -->

 LACDestinationSettings.overlayId();

 LACDestinationSettings.forceReRun(NoYes::Yes);

 <-- Overlay (watermark) */

 

 printSettings.lacDestinationSettings(LACDestinationSettings);

 

 if (salesTable)

 {

 salesFormLetter.updatePrinterSettingsFormLetter(PrintSettings.pack());

 salesFormLetter.update(salesTable,

SystemDateGet(),

 SalesUpdate::All,

 AccountOrder::None,

 NoYes::Yes,

 NoYes::Yes);

 }

 

}

Was this page helpful? Let us know at knowledgebase.feedback@lasernetgroup.com