Skip to content
Snippets Groups Projects
Commit 4fac1365 authored by Sebastian Pongratz's avatar Sebastian Pongratz :ping_pong:
Browse files

Merge branch 'sales_2003968_offerreport_brackets' into '2021.2.4'

[Projekt: xRM-Sales][TicketNr.: 2003968][Angebot zu viele Klammern bei nicht opt. Posten]

See merge request xrm/basic!1656
parents 4783b1ea abd26091
No related branches found
No related tags found
No related merge requests found
...@@ -233,39 +233,36 @@ OfferUtils.buildOfferReport = function (pOfferID, pExclDiscountGroupcodes) ...@@ -233,39 +233,36 @@ OfferUtils.buildOfferReport = function (pOfferID, pExclDiscountGroupcodes)
offeritemData = offeritemData.map(function (offeritem) offeritemData = offeritemData.map(function (offeritem)
{ {
if (!offeritem[5].includes(".")) //only if it's no child //quantity * price
{ fullPrice = eMath.mulDec(parseFloat(offeritem[9]), parseFloat(offeritem[10])); //price without discount
//quantity * price
fullPrice = eMath.mulDec(parseFloat(offeritem[9]), parseFloat(offeritem[10])); //price without discount
//itemSum = (fullPrice * (100 - discount)) / 100 //itemSum = (fullPrice * (100 - discount)) / 100
itemSum = eMath.roundDec(eMath.divDec(eMath.mulDec(fullPrice, eMath.subDec(100, offeritem[11])), 100), 2, eMath.ROUND_HALF_EVEN); //sum of the item (with discount) itemSum = eMath.roundDec(eMath.divDec(eMath.mulDec(fullPrice, eMath.subDec(100, offeritem[11])), 100), 2, eMath.ROUND_HALF_EVEN); //sum of the item (with discount)
if(!Utils.toBoolean(parseInt(offeritem[4])))//is optional if(!Utils.toBoolean(parseInt(offeritem[4])))//is optional
{ {
sumItemSum += itemSum; //total sum (without vat) sumItemSum += itemSum; //total sum (without vat)
} }
let excluded = -1 let excluded = -1
if(pExclDiscountGroupcodes) if(pExclDiscountGroupcodes)
{ {
excluded = pExclDiscountGroupcodes.indexOf(offeritem[15]) excluded = pExclDiscountGroupcodes.indexOf(offeritem[15])
} }
//vatsum = itemSum * vat / 100 //vatsum = itemSum * vat / 100
if(printHeadDiscount && offerData[16] && excluded == -1) if(printHeadDiscount && offerData[16] && excluded == -1)
{ {
vatsum = ItemUtils.prototype.getItemVAT(offeritem[9], offeritem[10], offeritem[11], offeritem[12], offeritem[4]); vatsum = ItemUtils.prototype.getItemVAT(offeritem[9], offeritem[10], offeritem[11], offeritem[12], offeritem[4]);
vatsum = eMath.subDec(vatsum, eMath.divDec(eMath.mulDec(vatsum, offerData[16]), "100")); vatsum = eMath.subDec(vatsum, eMath.divDec(eMath.mulDec(vatsum, offerData[16]), "100"));
} }
else else
{ {
vatsum = ItemUtils.prototype.getItemVAT(offeritem[9], offeritem[10], offeritem[11], offeritem[12], offeritem[4]) vatsum = ItemUtils.prototype.getItemVAT(offeritem[9], offeritem[10], offeritem[11], offeritem[12], offeritem[4])
} }
if (offeritem[12] > 0) if (offeritem[12] > 0)
{ {
sums.push([offeritem[12], vatsum]); //Prepare VAT for map sums.push([offeritem[12], vatsum]); //Prepare VAT for map
}
} }
// sumItemSum + vat // sumItemSum + vat
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment