Fix for second tax rate
This commit is contained in:
parent
cbbc812417
commit
516d74b9d8
|
|
@ -574,10 +574,18 @@ abstract class InvoiceItemEntity extends Object
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
InvoiceItemEntity applyTax(TaxRateEntity taxRate) {
|
InvoiceItemEntity applyTax(TaxRateEntity taxRate, {bool isSecond = false}) {
|
||||||
InvoiceItemEntity item = rebuild((b) => b
|
InvoiceItemEntity item;
|
||||||
..taxRate1 = taxRate.rate
|
|
||||||
..taxName1 = taxRate.name);
|
if (isSecond) {
|
||||||
|
item = rebuild((b) => b
|
||||||
|
..taxRate2 = taxRate.rate
|
||||||
|
..taxName2 = taxRate.name);
|
||||||
|
} else {
|
||||||
|
item = rebuild((b) => b
|
||||||
|
..taxRate1 = taxRate.rate
|
||||||
|
..taxName1 = taxRate.name);
|
||||||
|
}
|
||||||
|
|
||||||
if (taxRate.isInclusive) {
|
if (taxRate.isInclusive) {
|
||||||
item = item.rebuild(
|
item = item.rebuild(
|
||||||
|
|
|
||||||
|
|
@ -300,7 +300,7 @@ class ItemEditDetailsState extends State<ItemEditDetails> {
|
||||||
? TaxRateDropdown(
|
? TaxRateDropdown(
|
||||||
taxRates: company.taxRates,
|
taxRates: company.taxRates,
|
||||||
onSelected: (taxRate) => viewModel.onChangedInvoiceItem(
|
onSelected: (taxRate) => viewModel.onChangedInvoiceItem(
|
||||||
invoiceItem.applyTax(taxRate), widget.index),
|
invoiceItem.applyTax(taxRate, isSecond: true), widget.index),
|
||||||
labelText: localization.tax,
|
labelText: localization.tax,
|
||||||
initialTaxName: invoiceItem.taxName2,
|
initialTaxName: invoiceItem.taxName2,
|
||||||
initialTaxRate: invoiceItem.taxRate2,
|
initialTaxRate: invoiceItem.taxRate2,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue