Created
October 24, 2018 08:41
-
-
Save Macadoshis/ac863e86efe77ac7eb5ca1a8894c20df to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private getTotalPriceWithoutVat(qwis: CWIE[], includeShippingCost: boolean = false): QuotationPrice { | |
if (!this._serviceFolder.Refused) { | |
const quotationPrice: QuotationPrice = <QuotationPrice>({ public: 0, sales: 0 }); | |
// Sum all prices of selected work instructions | |
qwis | |
.filter((qwi: CWIE) => this.filterWorkInstructionForTotalPrice(qwi)) | |
.forEach((qwie: CWIE) => { | |
quotationPrice.public += (qwie.PublicPriceWithDiscount || 0); | |
quotationPrice.sales += (qwie.SalesPriceWithDiscount || 0); | |
qwie.ChargeSpareParts.forEach((qsp: CSP) => { | |
const qspe: CSPE = <CSPE><any>(qsp); | |
quotationPrice.public += (qspe.PublicPriceWithDiscount || 0) * qspe.EstimationSparePart.Quantity; | |
quotationPrice.sales += (qspe.SalesPriceWithDiscount || 0) * qspe.EstimationSparePart.Quantity; | |
}); | |
}); | |
if (includeShippingCost) { | |
// Add shipping costs | |
quotationPrice.public += this.quotation.ShippingPublic || 0; | |
quotationPrice.sales += this.quotation.ShippingSales || 0; | |
} | |
return quotationPrice; | |
} else { | |
<QuotationPrice>({ public: this.quotation.TotalWithVATPublic, sales: this.quotation.TotalWithVATSales }); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
à tester 😝