[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: RE: [ubl-dev] Modeling question re: multifaceted price calculation
Thanks, Fulton, for taking the time to answer! At 2008-04-25 04:32 -0400, Fulton Wilcox wrote: >In all likelihood, the best arrangement would be to stay with the >mainstream, with the invoice line item including unit price (daily rent >rate, in absolute terms) and quantity (number of days charged). Oh, of course I want to stay with "the mainstream" ... there is a risk when defining an extension point that it will be abused. In fact the root of my question was "how much of the following information is "mainstream" so that I can use UBL constructs only, yet still be able to format an instance when I'm done. >In your line item 1 and 3 examples, you are implicitly expressing unit price >as a function: Yep! And I couldn't see where all of the parts would fit. Nor could I see where to put the dates. >daily rental unit price = rented item value * rental charge % >of item value* 1/30 days in a month). What you put into unit price (2.5%)is >in fact not unit price, and it is a monthly rather than daily figure. Absent >customization, most payables system will try to multiply whatever number is >in the unit price field (in your line item 1 example 2.5%) times the number >of units (5 days) and of course the result will be meaningless. Unless what was reflected in the "unit price" was the result of the calculation of everything except the number of units ... then "unit price times units = line extension amount". Which means, then, that those facets of calculation could be expressed as properties of the item! >Presumably the unit rental rate is determined by a function of asset value >was previously expressed in quotes, orders, etc. If not (e.g., it is a >floating value related to, say, LIBOR, or as a reminder to the accounts >payable organization, putting it into a comments field is more appropriate. I'm not fond of putting it into a comments field as that is unstructured. Also, note that while the cbc:Note is 0..n, it is only repeatable so that the one note could be expressed in multiple languages. That cbc:Note is repeatable is *not* an opportunity to create, say, multiple notes in English. So ... if I take a stab at this below using facets of the item description, perhaps folks could comment collaboratively on how this would work. I did change the third item in order to introduce yet another calculation of the rental cost. -----Original Message----- From: G. Ken Holman [mailto:gkholman@CraneSoftwrights.com] Sent: Friday, April 25, 2008 12:49 AM To: UBL-Dev Subject: [ubl-dev] Modeling question re: multifaceted price calculation ... Invoice period: April 1, 2008 to April 30, 2008 Item: 1 Description: Thing-one Quantity: 7 Base cost: $1000. Rental rate each: 2.5% per month Shipped to site: April 15, 2008 Removed from site: April 20, 2008 Days on site: 5 Rental fee: $29.17 (=1000*.025/30*5*7) Item: 2 Description: Thing-two Quantity: 3 Base cost each: $2000. Rental rate: $30 per month Shipped to site: April 10, 2008 Removed from site: N/A (still on site) Days on site: 20 Rental fee: $60 (=30/30*20*3) Item: 3 Description: Thing-three Quantity: 1 Base cost each: $5000. Rental rate: .5% per day (was 1% per month, but changed for the example) Shipped to site: N/A (was on site) Removed from site: N/A (still on site) Days on site: 30 Rental fee: $750 (=5000*.005*30*1) -----End Original Message----- This morning I found cac:ItemInstance and I think that resolves all of my questions, but I'm not sure if I'm using it properly. It does mean that I can avoid extensions altogether, which is great(!!) because the objective of this email originally was to determine how to use extensions ... but it is better not to have to use extensions. For those items with "Monthly Rental Rate", the unit price is calculated as: Base Cost Amount * Monthly Rental Rate / Monthly Days Applicable * Monthly Rental Rate DurationMeasure in days For those items with "Monthly Rental Fee", the unit price is calculated as: Monthly Rental Fee / Monthly Days Applicable * Monthly Rental Fee DurationMeasure in days For those items with "Daily Rental Rate", the unit price is calculated as: Base Cost Amount * Daily Rental Rate * Daily Rental Rate DurationMeasure in days For a while I thought I needed something like the following: <cac:InvoicePeriod> <cbc:StartDate>2008-04-01</cbc:StartDate> <cbc:EndDate>2008-04-30</cbc:EndDate> <cbc:DurationMeasure unitCode="DAY">30</cbc:DurationMeasure> </cac:InvoicePeriod> So that if the invoice were based on business days in the month instead of calendar days in the month I could then use the following: <cac:InvoicePeriod> <cbc:StartDate>2008-04-01</cbc:StartDate> <cbc:EndDate>2008-04-30</cbc:EndDate> <cbc:DurationMeasure unitCode="DAY">22</cbc:DurationMeasure> </cac:InvoicePeriod> But I ruled that out because for different rented items this basis of calculation may be different, so I just created "Monthly Days Applicable" as another facet of the item to differentiate that the basis of the rate or fee is "work days" or "calendar days" during the month. I'm using UsabilityPeriod as a property of the rental rate or fee. If the start date is absent, it was already there from before the beginning of the month. If the end date is absent, it is already there after the end of the month. The duration is there explicitly to again handle the difference above of "work days" vs. "calendar days" during the period. I now note, however, that there is a UBL rule stating "the absence of information must not mean anything" ... so I guess that means I am obliged to have both start date and end date. Note that in deployment I would constrain the item property names to a controlled vocabulary so that sender and receiver are using precisely the same terminology for all facets. I'm going to suggest in 2.1 that we add an optional ID to ItemProperty so that the Name can be textual and the ID be from a controlled vocabulary. Also, there would be a business rule that when "Monthly Rental Fee" or "Monthly Rental Rate" is being used that "Monthly Days Applicable" must also be present. And that every InvoiceLine with a "Base Cost Amount" value that there also be a "Base Cost Currency" value. And that there be a start date and an end date for all the durations. So I think the following (which validates to UBL 2.0 Invoice, but I haven't written the constrained vocabulary or business rules yet) accurately reflects all of the information required in the instance (except for the "already on site" and "left on site" concepts ... I would have to check if that has to be known explicitly or not ... if so, I can just create two true/false facets). However, the value in cac:ItemProperty is text and not constrainable such as amounts, so it is still tempting to use an extension. Note how I have to have the business rule for maintaining the two aspects of the base cost amount. But before I recommend the following to a UBL novice, I would very much appreciate a critique suggesting a better way of doing it. Thanks again, Fulton, and to anyone else who can also give guidance! . . . . . . . . . . Ken <?xml version="1.0" encoding="UTF-8"?> <Invoice xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:udt="urn:un:unece:uncefact:data:draft:UnqualifiedDataTypesSchemaModule:2"> <cbc:ID>A123</cbc:ID> <cbc:CopyIndicator>false</cbc:CopyIndicator> <cbc:IssueDate>2008-04-30</cbc:IssueDate> <cbc:DocumentCurrencyCode>CAD</cbc:DocumentCurrencyCode> <cac:InvoicePeriod> <cbc:StartDate>2008-04-01</cbc:StartDate> <cbc:EndDate>2008-04-30</cbc:EndDate> </cac:InvoicePeriod> <cac:AccountingSupplierParty> <cac:Party> <cac:PartyName> <cbc:Name>The supplier</cbc:Name> </cac:PartyName> </cac:Party> </cac:AccountingSupplierParty> <cac:AccountingCustomerParty> <cac:Party> <cac:PartyName> <cbc:Name>The buyer</cbc:Name> </cac:PartyName> </cac:Party> </cac:AccountingCustomerParty> <cac:LegalMonetaryTotal> <cbc:PayableAmount currencyID="CAD">839.17</cbc:PayableAmount> </cac:LegalMonetaryTotal> <cac:InvoiceLine> <cbc:ID>1</cbc:ID> <cbc:InvoicedQuantity>7</cbc:InvoicedQuantity> <cbc:LineExtensionAmount currencyID="CAD">29.17</cbc:LineExtensionAmount> <cac:Item> <cbc:Description>Thing-one</cbc:Description> <cac:ItemInstance> <cac:AdditionalItemProperty> <cbc:Name>Base Cost Currency</cbc:Name> <cbc:Value>CAD</cbc:Value> </cac:AdditionalItemProperty> <cac:AdditionalItemProperty> <cbc:Name>Base Cost Amount</cbc:Name> <cbc:Value>1000</cbc:Value> </cac:AdditionalItemProperty> <cac:AdditionalItemProperty> <cbc:Name>Monthly Days Applicable</cbc:Name> <cbc:Value>30</cbc:Value> </cac:AdditionalItemProperty> <cac:AdditionalItemProperty> <cbc:Name>Monthly Rental Rate</cbc:Name> <cbc:Value>.025</cbc:Value> <cac:UsabilityPeriod> <cbc:StartDate>2008-04-15</cbc:StartDate> <cbc:EndDate>2008-04-20</cbc:EndDate> <cbc:DurationMeasure unitCode="DAY">5</cbc:DurationMeasure> </cac:UsabilityPeriod> </cac:AdditionalItemProperty> </cac:ItemInstance> </cac:Item> <cac:Price> <cbc:PriceAmount currencyID="CAD">4.17</cbc:PriceAmount> </cac:Price> </cac:InvoiceLine> <cac:InvoiceLine> <cbc:ID>2</cbc:ID> <cbc:InvoicedQuantity>3</cbc:InvoicedQuantity> <cbc:LineExtensionAmount currencyID="CAD">60</cbc:LineExtensionAmount> <cac:Item> <cbc:Description>Thing-two</cbc:Description> <cac:ItemInstance> <cac:AdditionalItemProperty> <cbc:Name>Base Cost Currency</cbc:Name> <cbc:Value>CAD</cbc:Value> </cac:AdditionalItemProperty> <cac:AdditionalItemProperty> <cbc:Name>Base Cost Amount</cbc:Name> <cbc:Value>2000</cbc:Value> </cac:AdditionalItemProperty> <cac:AdditionalItemProperty> <cbc:Name>Monthly Days Applicable</cbc:Name> <cbc:Value>30</cbc:Value> </cac:AdditionalItemProperty> <cac:AdditionalItemProperty> <cbc:Name>Monthly Rental Fee</cbc:Name> <cbc:Value>30</cbc:Value> <cac:UsabilityPeriod> <cbc:StartDate>2008-04-10</cbc:StartDate> <cbc:EndDate>2008-04-30</cbc:EndDate> <cbc:DurationMeasure unitCode="DAY">20</cbc:DurationMeasure> </cac:UsabilityPeriod> </cac:AdditionalItemProperty> </cac:ItemInstance> </cac:Item> <cac:Price> <cbc:PriceAmount currencyID="CAD">20</cbc:PriceAmount> </cac:Price> </cac:InvoiceLine> <cac:InvoiceLine> <cbc:ID>3</cbc:ID> <cbc:InvoicedQuantity>1</cbc:InvoicedQuantity> <cbc:LineExtensionAmount currencyID="CAD">750</cbc:LineExtensionAmount> <cac:Item> <cbc:Description>Thing-one</cbc:Description> <cac:ItemInstance> <cac:AdditionalItemProperty> <cbc:Name>Base Cost Currency</cbc:Name> <cbc:Value>CAD</cbc:Value> </cac:AdditionalItemProperty> <cac:AdditionalItemProperty> <cbc:Name>Base Cost Amount</cbc:Name> <cbc:Value>5000</cbc:Value> </cac:AdditionalItemProperty> <cac:AdditionalItemProperty> <cbc:Name>Daily Rental Rate</cbc:Name> <cbc:Value>.005</cbc:Value> <cac:UsabilityPeriod> <cbc:StartDate>2008-04-01</cbc:StartDate> <cbc:EndDate>2008-04-30</cbc:EndDate> <cbc:DurationMeasure unitCode="DAY">30</cbc:DurationMeasure> </cac:UsabilityPeriod> </cac:AdditionalItemProperty> </cac:ItemInstance> </cac:Item> <cac:Price> <cbc:PriceAmount currencyID="CAD">4.17</cbc:PriceAmount> </cac:Price> </cac:InvoiceLine> </Invoice> -- Upcoming: UBL Apr.22,24; genericode code lists Apr.23; Rome,Italy World-wide corporate, govt. & user group XML, XSL and UBL training RSS feeds: publicly-available developer resources and training G. Ken Holman mailto:gkholman@CraneSoftwrights.com Crane Softwrights Ltd. http://www.CraneSoftwrights.com/u/ Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995) Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/u/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]