R29743 SalesOrder - Set Fiscal Sales Number And Increment Sequence

Code R29743
Entity Crm.Sales.SalesOrders Entity
Name SetFiscalSalesNumberAndIncrementSequence
Attribute FiscalSalesNumber
Layer Back-End
Events Commit
Priority Normal
Modify YES
Applicable Legislations BG (EnterpriseCompany.Company)
Action If ((SalesOrdersOptions [DocumentType=SalesOrder.DocumentType].AllowedDirections != SalesReturn) && (FiscalSalesNumber = NULL) && (PosOperator != NULL ) && (PosFiscalPrinter != NULL) && (PosSequences[(PosDevice == SalesOrder.PosFiscalPrinter) && (Active == True)].Count() == 1))

, then:

(1) set a value: FiscalSalesNumber = CONCAT('PosFiscalPrinter.DeviceRegistrationNo' + '-' + 'PosOperator.PosOperatorCode' + '-' + 'FIRST(PosSequences[(PosDevice == SalesOrder.PosFiscalPrinter) && (Active == True)]).NextNo')

(2) set a value: FIRST(PosSequences[(PosDevice == SalesOrder.PosFiscalPrinter) && (Active == True)]).NextNo = INCNUM(NextNo) |
Description When a POS Sales Order is created into database, according to the Bulgarian legislation the software must generate a unique sales number, which is formed as follows:

'Individual Number of the Fiscal Printer - Operator code - Next number of the Sales Order'.

In EnterpriseOne the unique sales number is filled in the Sales Order's field Fiscal Sales Number.

The purpose of the current rule is to create a unique sales number for the POS Sales Orders based on the required format, to set the value in the Fiscal Sales Number field and to increment the POS Sequence's Next No.

Note that the rule activates only for the normal sales orders and not for sales return, for more information about normal and return sales, see Sales order row types.
Message -
Introduced In Version 2019.1
Revocable NO

* For more information about the Business Rules Documentation Template and a short explanation of each column, see topic System Business Rules.