Settings
This commit is contained in:
parent
82d00cfb6f
commit
4f1715acb3
|
|
@ -439,14 +439,6 @@ abstract class InvoiceEntity extends Object
|
||||||
..taxName1 = taxRate.name);
|
..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;
|
return invoice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -602,11 +594,6 @@ abstract class InvoiceItemEntity
|
||||||
..taxName1 = taxRate.name);
|
..taxName1 = taxRate.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (taxRate.isInclusive) {
|
|
||||||
item = item.rebuild(
|
|
||||||
(b) => b..cost = round(b.cost / (100 + taxRate.rate) * 100, 2));
|
|
||||||
}
|
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -431,14 +431,6 @@ abstract class QuoteEntity extends Object
|
||||||
..taxName1 = taxRate.name);
|
..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;
|
return quote;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,10 +65,6 @@ abstract class TaxRateEntity extends Object
|
||||||
|
|
||||||
double get rate;
|
double get rate;
|
||||||
|
|
||||||
@nullable
|
|
||||||
@BuiltValueField(wireName: 'is_inclusive')
|
|
||||||
bool get isInclusive;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get listDisplayName {
|
String get listDisplayName {
|
||||||
return name;
|
return name;
|
||||||
|
|
|
||||||
|
|
@ -123,12 +123,6 @@ class _$TaxRateEntitySerializer implements StructuredSerializer<TaxRateEntity> {
|
||||||
'rate',
|
'rate',
|
||||||
serializers.serialize(object.rate, specifiedType: const FullType(double)),
|
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) {
|
if (object.isChanged != null) {
|
||||||
result
|
result
|
||||||
..add('isChanged')
|
..add('isChanged')
|
||||||
|
|
@ -200,10 +194,6 @@ class _$TaxRateEntitySerializer implements StructuredSerializer<TaxRateEntity> {
|
||||||
result.rate = serializers.deserialize(value,
|
result.rate = serializers.deserialize(value,
|
||||||
specifiedType: const FullType(double)) as double;
|
specifiedType: const FullType(double)) as double;
|
||||||
break;
|
break;
|
||||||
case 'is_inclusive':
|
|
||||||
result.isInclusive = serializers.deserialize(value,
|
|
||||||
specifiedType: const FullType(bool)) as bool;
|
|
||||||
break;
|
|
||||||
case 'isChanged':
|
case 'isChanged':
|
||||||
result.isChanged = serializers.deserialize(value,
|
result.isChanged = serializers.deserialize(value,
|
||||||
specifiedType: const FullType(bool)) as bool;
|
specifiedType: const FullType(bool)) as bool;
|
||||||
|
|
@ -438,8 +428,6 @@ class _$TaxRateEntity extends TaxRateEntity {
|
||||||
@override
|
@override
|
||||||
final double rate;
|
final double rate;
|
||||||
@override
|
@override
|
||||||
final bool isInclusive;
|
|
||||||
@override
|
|
||||||
final bool isChanged;
|
final bool isChanged;
|
||||||
@override
|
@override
|
||||||
final int createdAt;
|
final int createdAt;
|
||||||
|
|
@ -462,7 +450,6 @@ class _$TaxRateEntity extends TaxRateEntity {
|
||||||
_$TaxRateEntity._(
|
_$TaxRateEntity._(
|
||||||
{this.name,
|
{this.name,
|
||||||
this.rate,
|
this.rate,
|
||||||
this.isInclusive,
|
|
||||||
this.isChanged,
|
this.isChanged,
|
||||||
this.createdAt,
|
this.createdAt,
|
||||||
this.updatedAt,
|
this.updatedAt,
|
||||||
|
|
@ -493,7 +480,6 @@ class _$TaxRateEntity extends TaxRateEntity {
|
||||||
return other is TaxRateEntity &&
|
return other is TaxRateEntity &&
|
||||||
name == other.name &&
|
name == other.name &&
|
||||||
rate == other.rate &&
|
rate == other.rate &&
|
||||||
isInclusive == other.isInclusive &&
|
|
||||||
isChanged == other.isChanged &&
|
isChanged == other.isChanged &&
|
||||||
createdAt == other.createdAt &&
|
createdAt == other.createdAt &&
|
||||||
updatedAt == other.updatedAt &&
|
updatedAt == other.updatedAt &&
|
||||||
|
|
@ -513,11 +499,7 @@ class _$TaxRateEntity extends TaxRateEntity {
|
||||||
$jc(
|
$jc(
|
||||||
$jc(
|
$jc(
|
||||||
$jc(
|
$jc(
|
||||||
$jc(
|
$jc($jc($jc(0, name.hashCode), rate.hashCode),
|
||||||
$jc(
|
|
||||||
$jc($jc(0, name.hashCode),
|
|
||||||
rate.hashCode),
|
|
||||||
isInclusive.hashCode),
|
|
||||||
isChanged.hashCode),
|
isChanged.hashCode),
|
||||||
createdAt.hashCode),
|
createdAt.hashCode),
|
||||||
updatedAt.hashCode),
|
updatedAt.hashCode),
|
||||||
|
|
@ -533,7 +515,6 @@ class _$TaxRateEntity extends TaxRateEntity {
|
||||||
return (newBuiltValueToStringHelper('TaxRateEntity')
|
return (newBuiltValueToStringHelper('TaxRateEntity')
|
||||||
..add('name', name)
|
..add('name', name)
|
||||||
..add('rate', rate)
|
..add('rate', rate)
|
||||||
..add('isInclusive', isInclusive)
|
|
||||||
..add('isChanged', isChanged)
|
..add('isChanged', isChanged)
|
||||||
..add('createdAt', createdAt)
|
..add('createdAt', createdAt)
|
||||||
..add('updatedAt', updatedAt)
|
..add('updatedAt', updatedAt)
|
||||||
|
|
@ -558,10 +539,6 @@ class TaxRateEntityBuilder
|
||||||
double get rate => _$this._rate;
|
double get rate => _$this._rate;
|
||||||
set rate(double rate) => _$this._rate = 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 _isChanged;
|
||||||
bool get isChanged => _$this._isChanged;
|
bool get isChanged => _$this._isChanged;
|
||||||
set isChanged(bool isChanged) => _$this._isChanged = isChanged;
|
set isChanged(bool isChanged) => _$this._isChanged = isChanged;
|
||||||
|
|
@ -602,7 +579,6 @@ class TaxRateEntityBuilder
|
||||||
if (_$v != null) {
|
if (_$v != null) {
|
||||||
_name = _$v.name;
|
_name = _$v.name;
|
||||||
_rate = _$v.rate;
|
_rate = _$v.rate;
|
||||||
_isInclusive = _$v.isInclusive;
|
|
||||||
_isChanged = _$v.isChanged;
|
_isChanged = _$v.isChanged;
|
||||||
_createdAt = _$v.createdAt;
|
_createdAt = _$v.createdAt;
|
||||||
_updatedAt = _$v.updatedAt;
|
_updatedAt = _$v.updatedAt;
|
||||||
|
|
@ -635,7 +611,6 @@ class TaxRateEntityBuilder
|
||||||
new _$TaxRateEntity._(
|
new _$TaxRateEntity._(
|
||||||
name: name,
|
name: name,
|
||||||
rate: rate,
|
rate: rate,
|
||||||
isInclusive: isInclusive,
|
|
||||||
isChanged: isChanged,
|
isChanged: isChanged,
|
||||||
createdAt: createdAt,
|
createdAt: createdAt,
|
||||||
updatedAt: updatedAt,
|
updatedAt: updatedAt,
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ class QuoteRepository {
|
||||||
Future<InvoiceEntity> loadItem(
|
Future<InvoiceEntity> loadItem(
|
||||||
Credentials credentials, String entityId) async {
|
Credentials credentials, String entityId) async {
|
||||||
final dynamic response = await webClient.get(
|
final dynamic response = await webClient.get(
|
||||||
'${credentials.url}/invoices/$entityId?include=invitations',
|
'${credentials.url}/quotes/$entityId?include=invitations',
|
||||||
credentials.token);
|
credentials.token);
|
||||||
|
|
||||||
final InvoiceItemResponse quoteResponse =
|
final InvoiceItemResponse quoteResponse =
|
||||||
|
|
@ -30,7 +30,7 @@ class QuoteRepository {
|
||||||
Future<BuiltList<InvoiceEntity>> loadList(
|
Future<BuiltList<InvoiceEntity>> loadList(
|
||||||
Credentials credentials, int updatedAt) async {
|
Credentials credentials, int updatedAt) async {
|
||||||
String url = credentials.url +
|
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) {
|
if (updatedAt > 0) {
|
||||||
url += '&updated_at=${updatedAt - kUpdatedAtBufferSeconds}';
|
url += '&updated_at=${updatedAt - kUpdatedAtBufferSeconds}';
|
||||||
|
|
@ -77,10 +77,10 @@ class QuoteRepository {
|
||||||
|
|
||||||
if (quote.isNew) {
|
if (quote.isNew) {
|
||||||
response = await webClient.post(
|
response = await webClient.post(
|
||||||
credentials.url + '/invoices?include=invitations', credentials.token,
|
credentials.url + '/quotes?include=invitations', credentials.token,
|
||||||
data: json.encode(data));
|
data: json.encode(data));
|
||||||
} else {
|
} else {
|
||||||
var url = '${credentials.url}/invoices/${quote.id}';
|
var url = '${credentials.url}/quotes/${quote.id}';
|
||||||
if (action != null) {
|
if (action != null) {
|
||||||
url += '?action=' + action.toString();
|
url += '?action=' + action.toString();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue