Skip to content

Latest commit

 

History

History
61 lines (59 loc) · 6.48 KB

R30383-25.md

File metadata and controls

61 lines (59 loc) · 6.48 KB
erp.type erp.entity
front-end-business-rule
Crm.Invoicing.InvoiceLines

R30383-25 InvoiceLine - Load Standard Unit Price

+----------------------+-----------------------------------------------------------------------------------------------+ | Code | 30383-25 | +----------------------+-----------------------------------------------------------------------------------------------+ | Entity | @Crm.Invoicing.InvoiceLines | +----------------------+-----------------------------------------------------------------------------------------------+ | Name | LoadStandardUnitPrice | +----------------------+-----------------------------------------------------------------------------------------------+ | Attribute | UnitPrice | +----------------------+-----------------------------------------------------------------------------------------------+ | Layer | Front-End | +----------------------+-----------------------------------------------------------------------------------------------+ | Events | AttributeChanged(Product) | +----------------------+-----------------------------------------------------------------------------------------------+ | Priority | Normal | +----------------------+-----------------------------------------------------------------------------------------------+ | Modify | YES | +----------------------+-----------------------------------------------------------------------------------------------+ | **Applicable | ALL // no condition needed | | Legislations** | | +----------------------+-----------------------------------------------------------------------------------------------+ | Action | if (Product != null AND QuantityUnit != null AND Invoice.DocumentCurrency != null) | | | muRatio = Product.GetRatioToBaseOrDefault(QuantityUnit) | | |

| | | pricePerUnit = (Product.StandardPricePerLot * muRatio.Divisor) / | | | (Product.StandardLotSizeBase* muRatio.Multiplier) | | |

| | | //convert the product price to the document currency | | | productCurrency = Product.CostingCurrency or if null CurrentEnterpriseCompany.BaseCurrency | | |

| | | if (productCurrency != null AND productCurrency != Invoice.DocumentCurrency) | | |

| | | if (Invoice.CurrencyDirectory == null) => can't calculate | | | if (Invoice.CurrencyDirectory != null) => pricePerUnit = | | | pricePerUnit.ConvertTo(Invoice.DocumentCurrency, Invoice.CurrencyDirectory) | | |

| | | UnitPrice = pricePerUnit | +----------------------+-----------------------------------------------------------------------------------------------+ | Description | When Product is changed, Unit Price should be calculated using the Standard Price Per Lot | | | from the product's definition. The standard price per lot is first converted to the | | | measurement unit set as Quantity Unit in the line, then divided by the Standard Lot Size of | | | the product. If the Product has a Costing Currency set and it is different from the Base | | | Currency of the current Enterprise Company, then the calculated price per unit should be | | | converted to the product's costing currency. If the convertion can't be done, because the | | | document's Currency Directory is null, the action is terminated. Finally the Unit price is | | | set to the calculated price per unit. | +----------------------+-----------------------------------------------------------------------------------------------+ | Message | | +----------------------+-----------------------------------------------------------------------------------------------+ | Version | Introduced: 2020 | +----------------------+-----------------------------------------------------------------------------------------------+ | Revocable | YES | +----------------------+-----------------------------------------------------------------------------------------------+

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