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