Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Issue #22856:fix nulls and divide by zero #130

Merged
merged 1 commit into from

2 participants

@garyhgohoos
Collaborator

No description provided.

@gpazo gpazo merged commit 7cfc113 into xtuple:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 21, 2014
  1. @garyhgohoos
This page is out of date. Refresh to see the latest.
View
2  dbscripts/functions/calcinvoiceamt.sql
@@ -37,7 +37,7 @@ BEGIN
WHERE (invcitem_invchead_id=pInvcheadid);
IF (pType IN ('T', 'X')) THEN
- SELECT ROUND(SUM(taxdetail_tax), 2) INTO _tax
+ SELECT COALESCE(ROUND(SUM(taxdetail_tax), 2), 0.0) INTO _tax
FROM calculateTaxDetailSummary('I', pInvcheadid, 'T');
END IF;
View
2  dbscripts/functions/calcpurchaseorderamt.sql
@@ -34,7 +34,7 @@ BEGIN
WHERE (poitem_pohead_id=pPoheadid);
SELECT COALESCE(SUM(tax), 0) INTO _tax
- FROM ( SELECT ROUND(SUM(taxdetail_tax), 2) AS tax
+ FROM ( SELECT COALESCE(ROUND(SUM(taxdetail_tax), 2), 0.0) AS tax
FROM tax JOIN calculateTaxDetailSummary('PO', pPoheadid, 'T') ON (taxdetail_tax_id=tax_id)
GROUP BY tax_id ) AS data;
View
2  dbscripts/functions/calcquoteamt.sql
@@ -36,7 +36,7 @@ BEGIN
WHERE (quitem_quhead_id=pQuheadid);
IF (pType IN ('T', 'X')) THEN
- SELECT ROUND(SUM(taxdetail_tax), 2) INTO _tax
+ SELECT COALESCE(ROUND(SUM(taxdetail_tax), 2), 0.0) INTO _tax
FROM calculateTaxDetailSummary('Q', pQuheadid, 'T');
END IF;
View
5 dbscripts/metasql/invoices-detail.mql
@@ -29,7 +29,10 @@ SELECT invchead_id, cust_id,
invchead_invcnumber AS docnumber,
findCustomerForm(cust_id, 'I') AS reportname,
<? endif ?>
- (calcInvoiceAmt(invchead_id,'M') / calcInvoiceAmt(invchead_id,'S')) AS marginpercent,
+ CASE WHEN (calcInvoiceAmt(invchead_id,'S') != 0.0)
+ THEN (calcInvoiceAmt(invchead_id,'M') / calcInvoiceAmt(invchead_id,'S'))
+ ELSE 1.0
+ END AS marginpercent,
'percent' AS marginpercent_xtnumericrole,
'curr' AS extprice_xtnumericrole,
'curr' AS balance_xtnumericrole,
Something went wrong with that request. Please try again.