CRM0109 Create Invoice orders (with references to the store transactions)

Basic Information

Module Crm.Sales
Code CRM0109
Parent Document Sales Order
Sub-document Invoice Order
Full Name Create Invoice orders (with references to the store transactions)
Status NEW
Deterministic YES
Supports Transitional Documents YES
Supports Single Execution YES
Replaces -
Orphan Rows Ignore
Split Function NO
Introduced In Version
Date of Suspension -

Business Logic

This Generation is used to create Invoice Orders with references to the store transaction. The generation procedure will create lines for all products from the current Sale Order no matter if the products are stocked (Product.ProductType.IsStocked = True/False) or are shipped (Product.ProductType.IsShipped = True/False). However, if the product is stocked, the generation procedure will wait for the store transaction to be executed in order to create references to their lines. This references are crucial for the correct data in the "Analyze Invoiced Sales" report.

Fulfillments

Name SalesOrderLineToInvoiceOrderLine
Parent Entity SalesOrderLine
Child Entity InvoiceOrderLine
Parent / Child Relationship InvoiceOrderLine.ParentDocument = SalesOrder; InvoiceOrderLine.ParentLineNo = SalesOrderLine.LineNo
Name StoreTransactionLineToInvoiceOrderLine
Parent Entity StoreTransactionLine
Child Entity InvoiceOrderLine
Parent / Child Relationship InvoiceOrderLine.ParentDocument = StoreTransaction; InvoiceOrderLine.ParentLineNo = StoreTransactionLine.LineNo

Metrics

Fulfillment Name Metric Name Measurement Unit Parent Value Child Value New Record
SalesOrderLineToInvoiceOrderLine MStandardQuantityBase/NonStockedPrd SalesOrderLine.Product.BaseMeasurementUnit SalesOrderLine.StandardQuantityBase InvoiceOrderLine.StandardQuantityBase YES
SalesOrderLineToInvoiceOrderLine MQuantity/NonStockedPrd SalesOrderLine.QuantityUnit SalesOrderLine.Quantity InvoiceOrderLine.Quantity NO
SalesOrderLineToInvoiceOrderLine MQuantityBase/NonStockedPrd SalesOrderLine.Product.BaseMeasurementUnit SalesOrderLine.QuantityBase InvoiceOrderLine.QuantityBase NO
StoreTransactionLineToInvoiceOrderLine MStandardQuantityBase/StockedPrd StoreTransactionLine.Product.BaseMeasurementUnit StoreTransactionLine.StandardQuantityBase InvoiceOrderLine.StandardQuantityBase YES
StoreTransactionLineToInvoiceOrderLine MQuantity/StockedPrd StoreTransactionLine.QuantityUnit StoreTransactionLine.Quantity InvoiceOrderLine.Quantity NO
StoreTransactionLineToInvoiceOrderLine MQuantityBase/StockedPrd StoreTransactionLine.Product.BaseMeasurementUnit StoreTransactionLine.QuantityBase InvoiceOrderLine.QuantityBase NO

UnitPrice = If ((Quantity == SalesOrderLine.Quantity) && (QuantityUnit ==SalesOrderLine.QuantityUnit)

, then UnitPrice = SalesOrderLine.UnitPrice

, else Determine Unit Price and Line Amount in Invoice Orders

LineAmount = if (InvoiceOrder.StandardQuantity == MStandardQuantityBase/NonStockedPrd)

, then RemainingInvoiceOrder.LineAmount

, else SalesOrder.LineAmount * InvoiceOrder.StandardQuantity/SalesOrder.StandardQuantity 260lv * 4pcs / 19pcs = 54.73684210526316лв ~ 54.74lv;