CRM0706 Create Offers
Basic Information
Module | Applications.Service |
---|---|
Code | CRM0706 |
Parent Document | Service Activity |
Sub-document | Offer |
Full Name | Create Offers |
Status | NEW |
Deterministic/Non-deterministic | YES |
Transitional Documents | NO |
Replace Generation Procedures | GenerateOffer |
Processing Orphan Rows | None |
Introduced In Version | |
Date of Suspension | - |
Business Logic
The generation procedure creates Offer which purpose is to offer to the customer the used materials and the completed services listed in the service activity. The generation includes only materials and services which are not covered by the guarantee determined by the Service Agreements.
The offer header is based on the service activity header as follows:
Offer.Customer = ServiceActivity.Customer
Offer.ShipToCustomer = ServiceActivity.ShipToCustomer
Offer.Store = ServiceActivity.Store
Offer.DocumentCurrency = ServiceActivity.EnterpriseCompany.BaseCurrency
When the customer is filled in the offer a validation is performed which secures that the customer has up to date conditions in its definition (or that the Offer date is included in the period of those conditions) and the customer has no up to date condition - the generation procedure stops and throws an error. Up to date customer conditions are conditions where:
- (Offer.DocumentDate >= Customer.FromDate || Customer.FromDate == null ) && (Offer.DocumentDate <= Customer.thruDate || Customer.ThruDate == null)
The Offer Lines are created according to the calculations of the non agreed materials and services (as described in Non Agreed Services And Materials). So for each material of the current Service Activity the non agreed quantity of the material is calculated and the calculation for the services is a bit more complicated - for each service and for each product which invoice the service (these products are listed in the service definition), the non agreed quantity of the product is calculated.
Thus for each material ServiceActivityMaterial which has CoveredByGuarantee = false, the non agreed quantity is defined - NonagreedQuantity - and if it is not 0, a new OfferLine is created in the new Offer as follows:
OfferLine.LineNo = new line number
OfferLine.Product = ServiceActivityMaterial.Product
OfferLine.Quantity = ServiceActivityMaterial.NonagreedQuantity
OfferLine.QuantityUnit = ServiceActivityMaterial.QuantityUnit
OfferLine.LineStore = ServiceActivityMaterial.LineStore
OfferLine.ParentLineNo = ServiceActivityMaterial.LineNo
Note
The attributes which are not specified here are filled in as described in Standard Document Attributes
The new store order is saved then and only when there is at least one line in it.
Then for each service ServiceActivityService which has CoveredByGuarantee = false, and for each product InvoicingProduct - which invoice the current service (the products are listed as ServiceInvoicing where Service = current service), the non agreed quantity is defined - NonagreedQuantity - and if it is not 0, a new OfferLine in the new Offer is added as follows:
OfferLine.LineNo = new line number
OfferLine.Product = InvoicingProduct
OfferLine.Quantity = NonagreedQuantity
OfferLine.QuantityUnit = InvoicingProduct.BaseMeasurementUnit
OfferLine.ParentLineNo = ServiceActivityService.LineNo
Fulfillments
No fulfilments and metrics are used for the current generation procedure. Each time the procedure is started, it creates new sub-document no matter if there are documents already created from previous procedure executions.