Axaptapedia is now maintained by AgileCadence For more information please click here.
SalesFormLetter class
From Axaptapedia
		
		
		
SalesFormLetter class is a base class for processing various documents on sales orders. Each kind of document is represented as a descendant of this class. For example it is SalesFormLetter_Invoice for invoice.
Contents
See also[edit]
- PurchFormLetter - the similar class for purchase form letters
- Business Logic
Description[edit]
The class do the following way (see the method main):
- creates a instance for the particular document (construct method)
- constructs records in parameter tables: SalesParmTable, SalesParmLine, SalesParmUpdate with the new unique id (can be accessed via parmID property)
- displays it contents to user to let some tweaks (via SalesEditLines form - see dialog method)
- processes particular document
Examples[edit]
Printing proforma for the sales invoice[edit]
<xpp> static void Test_SalesFormLetter(Args _args) {
   SalesFormLetter letter=SalesFormLetter::construct(DocumentStatus::Invoice);
   SalesTable sale = SalesTable::find('ORDR00000229');
ttsBegin; letter.update(sale, systemDateGet(), SalesUpdate::PickingList, AccountOrder::None, true, true); ttsCommit;
} </xpp>
The same with tweaking lines qty[edit]
<xpp> static void Test_SalesFormLetter(Args _args) {
   SalesFormLetter letter=SalesFormLetter::construct(DocumentStatus::Invoice);
   SalesTable sale = SalesTable::find('S00000274');
   SalesParmLine parmLine;
ttsBegin; letter.salesTable(sale); letter.transDate (systemDateGet()); letter.specQty (SalesUpdate::PickingList); letter.proforma (true); letter.printFormLetter (true); //letter.printCODLabel (NoYes::No); //letter.printFreightSlip (NoYes::No); //letter.printShippingLabel (NoYes::No); //letter.printBillOfExchange(NoYes::No);
letter.createParmUpdate();
   letter.initParameters(letter.salesParmUpdate(),
                       PrintOut::Current);  // Printout
   info(letter.parmId());
   letter.giroType(sale.giroType);
   letter.initLinesQuery();
   while select forUpdate parmLine where parmLine.ParmId == letter.parmId()
   {
       // changed the Qty
       parmLine.DeliverNow = 3;
       // the following is stollen from the SalesEditLines form (field modified method)
       parmLine.setQty(parmLine.salesParmTable().ordering, letter.SalesParmUpdate().creditRemaining);
       parmLine.setInventDeliverNow();
       parmLine.setLineAmount();
       if (parmLine.closed)
       {
           parmLine.remainAfter = 0;
           parmLine.setRemainAfterInvent();
       }
parmLine.calcPackingUnitQty();
parmLine.update(); }
letter.run(); ttsCommit;
} </xpp>
Methods[edit]
chooseLines[edit]
Constructs SalesParmTable and SalesParmLine tables records for

