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;
|
||||
}
|
||||
|
||||
InvoiceItemEntity applyTax(TaxRateEntity taxRate) {
|
||||
InvoiceItemEntity item = rebuild((b) => b
|
||||
..taxRate1 = taxRate.rate
|
||||
..taxName1 = taxRate.name);
|
||||
InvoiceItemEntity applyTax(TaxRateEntity taxRate, {bool isSecond = false}) {
|
||||
InvoiceItemEntity item;
|
||||
|
||||
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) {
|
||||
item = item.rebuild(
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ class ItemEditDetailsState extends State<ItemEditDetails> {
|
|||
? TaxRateDropdown(
|
||||
taxRates: company.taxRates,
|
||||
onSelected: (taxRate) => viewModel.onChangedInvoiceItem(
|
||||
invoiceItem.applyTax(taxRate), widget.index),
|
||||
invoiceItem.applyTax(taxRate, isSecond: true), widget.index),
|
||||
labelText: localization.tax,
|
||||
initialTaxName: invoiceItem.taxName2,
|
||||
initialTaxRate: invoiceItem.taxRate2,
|
||||
|
|
|
|||
Loading…
Reference in New Issue