- Free Trial
Bug Tracker Incident #15639
Thanks for this feedback, Keith. Closing based on feedback.
I have tested this on 3.7.4 and it behaves as it should, dividing the discountfromcust value returned by formatPrcnt by 100 to arrive at a correct value of f_discountfromcust.
change metasql salesOrderItems-list as described (correctly scale f_discountfromcust)
The MetaSQL statement “salesOrderItems" (type “list”) uses the coitem.custprice and coitem.price fields to calculate the customer discount, since the entered discount is not stored on coitem.
It uses the following CASE statement to do the calculation in the FROM clause of the query:
CASE WHEN (coitem_custprice = 0.0) THEN 100.0
This results in “discountfromcust” being equal to a number between 0 and 100.
In the SELECT clause of the query, the query checks for the existence of parameter “includeFormatted”. If the parameter does not exist, the query sets the returned value of f_discountfromcust to discountfromcust, and that is correct. However, if the parameter does exist, the query sets the returned value of f_discountfromcust to be formatPrcnt(discountfromcust). This is not correct, because the formatPrcnt function returns a value of SELECT formatNumeric( * 100, 'percent') as its result, which when using discountfromcust (a number between 0 and 100) as its parameter, returns a value between 0 and 10,000. In effect, because the initial calculation of discountfromcust multiplies by 100, and the formatting function also multiplies by 100, the end result is 100 times higher than it should be. For instance, if price is and custprice is 0, then discountfromcust is 10, but f_discountfromcust when “includeFormatted” exists is 1,000.
The problem shows itself when one adds f_discountfromcust to a Sales Order Acknowledgement report generated from the Sales Order entry window. In this case, xTuple must pass “includeFormatted” as a parameter to the report, because f_discountfromcust is always shown at a value 100 times higher than it should be.
This took a lot to describe, but it’s a quick fix, as shown in the attached TXT file with an updated salesOrderList MetaSQL query. When “includeFormatted” exists, the query needs to return f_discountfromcust as formatPrcnt(discountfromcust / 100), not formatPrcnt(discountfromcust).
Steps to Reproduce:
Change the Customer Order Acknowledgement report to include Discount on the detail line.
Create a sales order and enter a customer discount of 10% on the sales order line item. Print the sales order using the updated Customer Order Acknowledgement. The discount shown will be 1000, not 10.
|Incident||1326||Exchange Rates and Effectivity Dates in 2.2.1 affecting Aging reports / invoices||Related to||x|
|Incident||1355||Create a Package||Related to||x|
|Project||XTUPLEAPPS||Ported From Mantis||x|
SubscribersYou do not have permission to view subscribers.
No history available