This article provides a code sample on how to post SalesInvoice (FormLetter) to Lasernet Destinations from code. In general, it doesn't matter which report it is. Our sample is based on the SalesInvoice.ReportResolution.
CODE
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); } }
Add a comment
Please log in or register to submit a comment.