Fix for second tax rate
This commit is contained in:
parent
5ca7f8af18
commit
ae765c77f5
|
|
@ -440,10 +440,19 @@ abstract class InvoiceEntity extends Object
|
|||
return actions..addAll(getBaseActions(user: user));
|
||||
}
|
||||
|
||||
InvoiceEntity applyTax(TaxRateEntity taxRate) {
|
||||
InvoiceEntity invoice = rebuild((b) => b
|
||||
..taxRate1 = taxRate.rate
|
||||
..taxName1 = taxRate.name);
|
||||
InvoiceEntity applyTax(TaxRateEntity taxRate, {bool isSecond = false}) {
|
||||
|
||||
InvoiceEntity invoice;
|
||||
|
||||
if (isSecond) {
|
||||
invoice = rebuild((b) => b
|
||||
..taxRate2 = taxRate.rate
|
||||
..taxName2 = taxRate.name);
|
||||
} else {
|
||||
invoice = rebuild((b) => b
|
||||
..taxRate1 = taxRate.rate
|
||||
..taxName1 = taxRate.name);
|
||||
}
|
||||
|
||||
if (taxRate.isInclusive) {
|
||||
invoice = invoice.rebuild((b) => b
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:invoiceninja_flutter/.env.dart';
|
||||
|
|
|
|||
|
|
@ -300,8 +300,8 @@ class InvoiceEditDetailsState extends State<InvoiceEditDetails> {
|
|||
company.enableInvoiceTaxes && company.enableSecondTaxRate
|
||||
? TaxRateDropdown(
|
||||
taxRates: company.taxRates,
|
||||
onSelected: (taxRate) =>
|
||||
viewModel.onChanged(invoice.applyTax(taxRate)),
|
||||
onSelected: (taxRate) => viewModel
|
||||
.onChanged(invoice.applyTax(taxRate, isSecond: true)),
|
||||
labelText: localization.tax,
|
||||
initialTaxName: invoice.taxName2,
|
||||
initialTaxRate: invoice.taxRate2,
|
||||
|
|
|
|||
Loading…
Reference in New Issue