Improve auto-taxes
This commit is contained in:
parent
7685d4e87f
commit
c8157694be
|
|
@ -18,11 +18,12 @@ abstract class TaxDataEntity
|
|||
geoState: '',
|
||||
stateSalesTax: 0,
|
||||
taxSales: 0,
|
||||
districtSalesTax: 0,
|
||||
/*
|
||||
cityUseTax: 0,
|
||||
countyUseTax: 0,
|
||||
district1Code: '',
|
||||
district1SalesTax: 0,
|
||||
district1Code: '',
|
||||
district1UseTax: 0,
|
||||
district2Code: '',
|
||||
district2SalesTax: 0,
|
||||
|
|
@ -36,7 +37,6 @@ abstract class TaxDataEntity
|
|||
district5Code: '',
|
||||
district5SalesTax: 0,
|
||||
district5UseTax: 0,
|
||||
districtSalesTax: 0,
|
||||
districtUseTax: 0,
|
||||
originDestination: '',
|
||||
stateUseTax: 0,
|
||||
|
|
@ -59,13 +59,13 @@ abstract class TaxDataEntity
|
|||
String get cityTaxCode;
|
||||
double get countySalesTax;
|
||||
String get countyTaxCode;
|
||||
double get districtSalesTax;
|
||||
//double get taxUse;
|
||||
//String get txbService;
|
||||
//String get txbFreight;
|
||||
//double get stateUseTax;
|
||||
//double get cityUseTax;
|
||||
//double get countyUseTax;
|
||||
//double get districtSalesTax;
|
||||
//double get districtUseTax;
|
||||
//String get district1Code;
|
||||
//double get district1SalesTax;
|
||||
|
|
@ -95,12 +95,13 @@ abstract class TaxDataEntity
|
|||
..geoPostalCode = ''
|
||||
..geoState = ''
|
||||
..stateSalesTax = 0
|
||||
..taxSales = 0;
|
||||
..taxSales = 0
|
||||
..districtSalesTax = 0;
|
||||
/*
|
||||
..cityUseTax = 0
|
||||
..countyUseTax = 0
|
||||
..district1Code = ''
|
||||
..district1SalesTax = 0
|
||||
..district1Code = ''
|
||||
..district1UseTax = 0
|
||||
..district2Code = ''
|
||||
..district2SalesTax = 0
|
||||
|
|
@ -114,7 +115,6 @@ abstract class TaxDataEntity
|
|||
..district5Code = ''
|
||||
..district5SalesTax = 0
|
||||
..district5UseTax = 0
|
||||
..districtSalesTax = 0
|
||||
..districtUseTax = 0
|
||||
..originDestination = ''
|
||||
..stateUseTax = 0
|
||||
|
|
|
|||
|
|
@ -55,6 +55,9 @@ class _$TaxDataEntitySerializer implements StructuredSerializer<TaxDataEntity> {
|
|||
'countyTaxCode',
|
||||
serializers.serialize(object.countyTaxCode,
|
||||
specifiedType: const FullType(String)),
|
||||
'districtSalesTax',
|
||||
serializers.serialize(object.districtSalesTax,
|
||||
specifiedType: const FullType(double)),
|
||||
];
|
||||
|
||||
return result;
|
||||
|
|
@ -112,6 +115,10 @@ class _$TaxDataEntitySerializer implements StructuredSerializer<TaxDataEntity> {
|
|||
result.countyTaxCode = serializers.deserialize(value,
|
||||
specifiedType: const FullType(String)) as String;
|
||||
break;
|
||||
case 'districtSalesTax':
|
||||
result.districtSalesTax = serializers.deserialize(value,
|
||||
specifiedType: const FullType(double)) as double;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -341,6 +348,8 @@ class _$TaxDataEntity extends TaxDataEntity {
|
|||
final double countySalesTax;
|
||||
@override
|
||||
final String countyTaxCode;
|
||||
@override
|
||||
final double districtSalesTax;
|
||||
|
||||
factory _$TaxDataEntity([void Function(TaxDataEntityBuilder) updates]) =>
|
||||
(new TaxDataEntityBuilder()..update(updates))._build();
|
||||
|
|
@ -355,7 +364,8 @@ class _$TaxDataEntity extends TaxDataEntity {
|
|||
this.citySalesTax,
|
||||
this.cityTaxCode,
|
||||
this.countySalesTax,
|
||||
this.countyTaxCode})
|
||||
this.countyTaxCode,
|
||||
this.districtSalesTax})
|
||||
: super._() {
|
||||
BuiltValueNullFieldError.checkNotNull(
|
||||
geoPostalCode, r'TaxDataEntity', 'geoPostalCode');
|
||||
|
|
@ -376,6 +386,8 @@ class _$TaxDataEntity extends TaxDataEntity {
|
|||
countySalesTax, r'TaxDataEntity', 'countySalesTax');
|
||||
BuiltValueNullFieldError.checkNotNull(
|
||||
countyTaxCode, r'TaxDataEntity', 'countyTaxCode');
|
||||
BuiltValueNullFieldError.checkNotNull(
|
||||
districtSalesTax, r'TaxDataEntity', 'districtSalesTax');
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
@ -398,7 +410,8 @@ class _$TaxDataEntity extends TaxDataEntity {
|
|||
citySalesTax == other.citySalesTax &&
|
||||
cityTaxCode == other.cityTaxCode &&
|
||||
countySalesTax == other.countySalesTax &&
|
||||
countyTaxCode == other.countyTaxCode;
|
||||
countyTaxCode == other.countyTaxCode &&
|
||||
districtSalesTax == other.districtSalesTax;
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
@ -414,6 +427,7 @@ class _$TaxDataEntity extends TaxDataEntity {
|
|||
_$hash = $jc(_$hash, cityTaxCode.hashCode);
|
||||
_$hash = $jc(_$hash, countySalesTax.hashCode);
|
||||
_$hash = $jc(_$hash, countyTaxCode.hashCode);
|
||||
_$hash = $jc(_$hash, districtSalesTax.hashCode);
|
||||
_$hash = $jf(_$hash);
|
||||
return _$hash;
|
||||
}
|
||||
|
|
@ -430,7 +444,8 @@ class _$TaxDataEntity extends TaxDataEntity {
|
|||
..add('citySalesTax', citySalesTax)
|
||||
..add('cityTaxCode', cityTaxCode)
|
||||
..add('countySalesTax', countySalesTax)
|
||||
..add('countyTaxCode', countyTaxCode))
|
||||
..add('countyTaxCode', countyTaxCode)
|
||||
..add('districtSalesTax', districtSalesTax))
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -483,7 +498,14 @@ class TaxDataEntityBuilder
|
|||
set countyTaxCode(String countyTaxCode) =>
|
||||
_$this._countyTaxCode = countyTaxCode;
|
||||
|
||||
TaxDataEntityBuilder();
|
||||
double _districtSalesTax;
|
||||
double get districtSalesTax => _$this._districtSalesTax;
|
||||
set districtSalesTax(double districtSalesTax) =>
|
||||
_$this._districtSalesTax = districtSalesTax;
|
||||
|
||||
TaxDataEntityBuilder() {
|
||||
TaxDataEntity._initializeBuilder(this);
|
||||
}
|
||||
|
||||
TaxDataEntityBuilder get _$this {
|
||||
final $v = _$v;
|
||||
|
|
@ -498,6 +520,7 @@ class TaxDataEntityBuilder
|
|||
_cityTaxCode = $v.cityTaxCode;
|
||||
_countySalesTax = $v.countySalesTax;
|
||||
_countyTaxCode = $v.countyTaxCode;
|
||||
_districtSalesTax = $v.districtSalesTax;
|
||||
_$v = null;
|
||||
}
|
||||
return this;
|
||||
|
|
@ -538,7 +561,8 @@ class TaxDataEntityBuilder
|
|||
cityTaxCode, r'TaxDataEntity', 'cityTaxCode'),
|
||||
countySalesTax:
|
||||
BuiltValueNullFieldError.checkNotNull(countySalesTax, r'TaxDataEntity', 'countySalesTax'),
|
||||
countyTaxCode: BuiltValueNullFieldError.checkNotNull(countyTaxCode, r'TaxDataEntity', 'countyTaxCode'));
|
||||
countyTaxCode: BuiltValueNullFieldError.checkNotNull(countyTaxCode, r'TaxDataEntity', 'countyTaxCode'),
|
||||
districtSalesTax: BuiltValueNullFieldError.checkNotNull(districtSalesTax, r'TaxDataEntity', 'districtSalesTax'));
|
||||
replace(_$result);
|
||||
return _$result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ class ClientRepository {
|
|||
|
||||
final dynamic response = await webClient.get(url, credentials.token);
|
||||
|
||||
//debugPrint('## CLIENTS: $response');
|
||||
|
||||
final ClientListResponse clientResponse = await compute<dynamic, dynamic>(
|
||||
SerializationUtils.deserializeWith,
|
||||
<dynamic>[ClientListResponse.serializer, response]);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import 'package:flutter_redux/flutter_redux.dart';
|
|||
import 'package:invoiceninja_flutter/data/models/invoice_model.dart';
|
||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
||||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||
import 'package:invoiceninja_flutter/utils/strings.dart';
|
||||
|
||||
class InvoiceTaxDetails extends StatelessWidget {
|
||||
const InvoiceTaxDetails({
|
||||
|
|
@ -16,31 +17,74 @@ class InvoiceTaxDetails extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
final localization = AppLocalization.of(context);
|
||||
final state = StoreProvider.of<AppState>(context).state;
|
||||
final client = state.clientState.get(invoice.id);
|
||||
final client = state.clientState.get(invoice.clientId);
|
||||
final taxData = invoice.isNew ? client.taxData : invoice.taxData;
|
||||
|
||||
return AlertDialog(
|
||||
title: Text(localization.taxDetails),
|
||||
content: Table(
|
||||
content: SizedBox(
|
||||
width: 400,
|
||||
child: DataTable(
|
||||
columns: [
|
||||
DataColumn(label: Text(localization.region)),
|
||||
DataColumn(label: Text(localization.name)),
|
||||
DataColumn(label: Text(localization.tax)),
|
||||
],
|
||||
rows: [
|
||||
DataRow(cells: [
|
||||
DataCell(Text(localization.state)),
|
||||
DataCell(Text(taxData.geoState)),
|
||||
DataCell(Text('${taxData.stateSalesTax}')),
|
||||
]),
|
||||
DataRow(cells: [
|
||||
DataCell(Text(localization.county)),
|
||||
DataCell(Text(toTitleCase(taxData.geoCounty))),
|
||||
DataCell(Text('${taxData.countySalesTax}')),
|
||||
]),
|
||||
DataRow(cells: [
|
||||
DataCell(Text(localization.city)),
|
||||
DataCell(Text(toTitleCase(taxData.geoCity))),
|
||||
DataCell(Text('${taxData.citySalesTax}')),
|
||||
]),
|
||||
DataRow(cells: [
|
||||
DataCell(Text(localization.district)),
|
||||
DataCell(Text('')),
|
||||
DataCell(Text('${taxData.districtSalesTax}')),
|
||||
]),
|
||||
DataRow(cells: [
|
||||
DataCell(Text(localization.total)),
|
||||
DataCell(Text('')),
|
||||
DataCell(Text('${taxData.taxSales}')),
|
||||
]),
|
||||
],
|
||||
),
|
||||
/*
|
||||
child: Table(
|
||||
children: [
|
||||
TableRow(children: [
|
||||
TableCell(child: Text(localization.state)),
|
||||
TableCell(child: Text(taxData.geoState)),
|
||||
TableCell(child: Text('')),
|
||||
]),
|
||||
TableRow(children: [
|
||||
TableCell(child: Text(localization.county)),
|
||||
TableCell(child: Text(toTitleCase(taxData.geoCounty))),
|
||||
TableCell(child: Text('')),
|
||||
]),
|
||||
TableRow(children: [
|
||||
TableCell(child: Text(localization.city)),
|
||||
TableCell(child: Text(toTitleCase(taxData.geoCity))),
|
||||
TableCell(child: Text('')),
|
||||
]),
|
||||
TableRow(children: [
|
||||
TableCell(child: Text(localization.total)),
|
||||
TableCell(child: Text('')),
|
||||
TableCell(child: Text('')),
|
||||
]),
|
||||
],
|
||||
),
|
||||
*/
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
static final Map<String, Map<String, String>> _localizedValues = {
|
||||
'en': {
|
||||
// STARTER: lang key - do not remove comment
|
||||
'district': 'District',
|
||||
'region': 'Region',
|
||||
'county': 'County',
|
||||
'tax_details': 'Tax Details',
|
||||
'activity_10_online':
|
||||
|
|
@ -105934,6 +105936,13 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
_localizedValues[localeCode]['county'] ??
|
||||
_localizedValues['en']['county'];
|
||||
|
||||
String get region =>
|
||||
_localizedValues[localeCode]['region'] ??
|
||||
_localizedValues['en']['region'];
|
||||
|
||||
String get district =>
|
||||
_localizedValues[localeCode]['district'] ??
|
||||
_localizedValues['en']['district'];
|
||||
|
||||
// STARTER: lang field - do not remove comment
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue