This commit is contained in:
Hillel Coren 2019-11-10 21:52:08 +02:00
parent 82d00cfb6f
commit 4f1715acb3
5 changed files with 5 additions and 55 deletions

View File

@ -439,14 +439,6 @@ abstract class InvoiceEntity extends Object
..taxName1 = taxRate.name);
}
if (taxRate.isInclusive) {
invoice = invoice.rebuild((b) => b
..lineItems.replace(lineItems
.map((item) => item.rebuild(
(b) => b.cost = round(b.cost / (100 + taxRate.rate) * 100, 2)))
.toList()));
}
return invoice;
}
@ -602,11 +594,6 @@ abstract class InvoiceItemEntity
..taxName1 = taxRate.name);
}
if (taxRate.isInclusive) {
item = item.rebuild(
(b) => b..cost = round(b.cost / (100 + taxRate.rate) * 100, 2));
}
return item;
}

View File

@ -431,14 +431,6 @@ abstract class QuoteEntity extends Object
..taxName1 = taxRate.name);
}
if (taxRate.isInclusive) {
quote = quote.rebuild((b) => b
..lineItems.replace(lineItems
.map((item) => item.rebuild(
(b) => b.cost = round(b.cost / (100 + taxRate.rate) * 100, 2)))
.toList()));
}
return quote;
}

View File

@ -65,10 +65,6 @@ abstract class TaxRateEntity extends Object
double get rate;
@nullable
@BuiltValueField(wireName: 'is_inclusive')
bool get isInclusive;
@override
String get listDisplayName {
return name;

View File

@ -123,12 +123,6 @@ class _$TaxRateEntitySerializer implements StructuredSerializer<TaxRateEntity> {
'rate',
serializers.serialize(object.rate, specifiedType: const FullType(double)),
];
if (object.isInclusive != null) {
result
..add('is_inclusive')
..add(serializers.serialize(object.isInclusive,
specifiedType: const FullType(bool)));
}
if (object.isChanged != null) {
result
..add('isChanged')
@ -200,10 +194,6 @@ class _$TaxRateEntitySerializer implements StructuredSerializer<TaxRateEntity> {
result.rate = serializers.deserialize(value,
specifiedType: const FullType(double)) as double;
break;
case 'is_inclusive':
result.isInclusive = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool;
break;
case 'isChanged':
result.isChanged = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool;
@ -438,8 +428,6 @@ class _$TaxRateEntity extends TaxRateEntity {
@override
final double rate;
@override
final bool isInclusive;
@override
final bool isChanged;
@override
final int createdAt;
@ -462,7 +450,6 @@ class _$TaxRateEntity extends TaxRateEntity {
_$TaxRateEntity._(
{this.name,
this.rate,
this.isInclusive,
this.isChanged,
this.createdAt,
this.updatedAt,
@ -493,7 +480,6 @@ class _$TaxRateEntity extends TaxRateEntity {
return other is TaxRateEntity &&
name == other.name &&
rate == other.rate &&
isInclusive == other.isInclusive &&
isChanged == other.isChanged &&
createdAt == other.createdAt &&
updatedAt == other.updatedAt &&
@ -513,11 +499,7 @@ class _$TaxRateEntity extends TaxRateEntity {
$jc(
$jc(
$jc(
$jc(
$jc(
$jc($jc(0, name.hashCode),
rate.hashCode),
isInclusive.hashCode),
$jc($jc($jc(0, name.hashCode), rate.hashCode),
isChanged.hashCode),
createdAt.hashCode),
updatedAt.hashCode),
@ -533,7 +515,6 @@ class _$TaxRateEntity extends TaxRateEntity {
return (newBuiltValueToStringHelper('TaxRateEntity')
..add('name', name)
..add('rate', rate)
..add('isInclusive', isInclusive)
..add('isChanged', isChanged)
..add('createdAt', createdAt)
..add('updatedAt', updatedAt)
@ -558,10 +539,6 @@ class TaxRateEntityBuilder
double get rate => _$this._rate;
set rate(double rate) => _$this._rate = rate;
bool _isInclusive;
bool get isInclusive => _$this._isInclusive;
set isInclusive(bool isInclusive) => _$this._isInclusive = isInclusive;
bool _isChanged;
bool get isChanged => _$this._isChanged;
set isChanged(bool isChanged) => _$this._isChanged = isChanged;
@ -602,7 +579,6 @@ class TaxRateEntityBuilder
if (_$v != null) {
_name = _$v.name;
_rate = _$v.rate;
_isInclusive = _$v.isInclusive;
_isChanged = _$v.isChanged;
_createdAt = _$v.createdAt;
_updatedAt = _$v.updatedAt;
@ -635,7 +611,6 @@ class TaxRateEntityBuilder
new _$TaxRateEntity._(
name: name,
rate: rate,
isInclusive: isInclusive,
isChanged: isChanged,
createdAt: createdAt,
updatedAt: updatedAt,

View File

@ -18,7 +18,7 @@ class QuoteRepository {
Future<InvoiceEntity> loadItem(
Credentials credentials, String entityId) async {
final dynamic response = await webClient.get(
'${credentials.url}/invoices/$entityId?include=invitations',
'${credentials.url}/quotes/$entityId?include=invitations',
credentials.token);
final InvoiceItemResponse quoteResponse =
@ -30,7 +30,7 @@ class QuoteRepository {
Future<BuiltList<InvoiceEntity>> loadList(
Credentials credentials, int updatedAt) async {
String url = credentials.url +
'/invoices?include=invitations&invoice_type_id=2&is_recurring=0';
'/quotes?include=invitations&invoice_type_id=2&is_recurring=0';
if (updatedAt > 0) {
url += '&updated_at=${updatedAt - kUpdatedAtBufferSeconds}';
@ -77,10 +77,10 @@ class QuoteRepository {
if (quote.isNew) {
response = await webClient.post(
credentials.url + '/invoices?include=invitations', credentials.token,
credentials.url + '/quotes?include=invitations', credentials.token,
data: json.encode(data));
} else {
var url = '${credentials.url}/invoices/${quote.id}';
var url = '${credentials.url}/quotes/${quote.id}';
if (action != null) {
url += '?action=' + action.toString();
}