Tax fixes

This commit is contained in:
Hillel Coren 2021-08-10 12:02:44 +03:00
parent 822c733d71
commit 1544e1fa91
2 changed files with 11 additions and 0 deletions

View File

@ -60,6 +60,7 @@ abstract class CalculateInvoiceTotal {
lineItems.forEach((item) { lineItems.forEach((item) {
final double taxRate1 = round(item.taxRate1, 3); final double taxRate1 = round(item.taxRate1, 3);
final double taxRate2 = round(item.taxRate2, 3); final double taxRate2 = round(item.taxRate2, 3);
final double taxRate3 = round(item.taxRate3, 3);
final lineTotal = getItemTaxable(item, total, precision); final lineTotal = getItemTaxable(item, total, precision);
@ -159,6 +160,7 @@ abstract class CalculateInvoiceTotal {
final double itemDiscount = round(item.discount, precision); final double itemDiscount = round(item.discount, precision);
final double taxRate1 = round(item.taxRate1, 3); final double taxRate1 = round(item.taxRate1, 3);
final double taxRate2 = round(item.taxRate2, 3); final double taxRate2 = round(item.taxRate2, 3);
final double taxRate3 = round(item.taxRate3, 3);
double lineTotal = qty * cost; double lineTotal = qty * cost;
if (itemDiscount != 0) { if (itemDiscount != 0) {
@ -182,6 +184,9 @@ abstract class CalculateInvoiceTotal {
if (taxRate2 != 0) { if (taxRate2 != 0) {
itemTax += round(lineTotal * taxRate2 / 100, precision); itemTax += round(lineTotal * taxRate2 / 100, precision);
} }
if (taxRate3 != 0) {
itemTax += round(lineTotal * taxRate3 / 100, precision);
}
}); });
if (discount != 0.0) { if (discount != 0.0) {

View File

@ -50,6 +50,12 @@ class InvoiceItemListTile extends StatelessWidget {
subtitle += '$taxRate2 ${invoiceItem.taxName2}'; subtitle += '$taxRate2 ${invoiceItem.taxName2}';
} }
if (invoiceItem.taxRate3 != 0) {
final taxRate3 = formatNumber(invoiceItem.taxRate3, context,
formatNumberType: FormatNumberType.percent);
subtitle += '$taxRate3 ${invoiceItem.taxName3}';
}
final List<String> parts = []; final List<String> parts = [];
if (invoiceItem.customValue1.isNotEmpty) { if (invoiceItem.customValue1.isNotEmpty) {
parts.add(formatCustomValue( parts.add(formatCustomValue(