Add tax classification

This commit is contained in:
Hillel Coren 2023-09-11 22:51:12 +03:00
parent 3613efa854
commit 33b2f64b53
7 changed files with 96 additions and 6 deletions

View File

@ -214,6 +214,14 @@ const kTaxCategories = {
kTaxCategoryReverseTax: 'reverse_tax',
};
const String kTaxClassificationIndividual = 'individual';
const String kTaxClassificationCompany = 'company';
const String kTaxClassificationPartnership = 'partnership';
const String kTaxClassificationTrust = 'trust';
const String kTaxClassificationCharity = 'charity';
const String kTaxClassificationGovernment = 'government';
const String kTaxClassificationOther = 'other';
const String kEInvoiceTypeEN16931 = 'EN16931';
const String kEInvoiceTypeXInvoice_2_2 = 'XInvoice_2_2';
const String kEInvoiceTypeXInvoice_2_1 = 'XInvoice_2_1';

View File

@ -107,6 +107,7 @@ class ClientFields {
static const String group = 'group';
static const String routingId = 'routing_id';
static const String isTaxExempt = 'tax_exempt';
static const String classification = 'classification';
}
abstract class ClientEntity extends Object
@ -157,6 +158,7 @@ abstract class ClientEntity extends Object
customValue4: '',
routingId: '',
isTaxExempt: false,
classification: '',
taxData: TaxDataEntity(),
contacts: BuiltList<ClientContactEntity>(
<ClientContactEntity>[
@ -318,6 +320,8 @@ abstract class ClientEntity extends Object
@BuiltValueField(wireName: 'tax_info')
TaxDataEntity get taxData;
String get classification;
BuiltList<ClientContactEntity> get contacts;
@override
@ -781,7 +785,8 @@ abstract class ClientEntity extends Object
..routingId = ''
..isTaxExempt = false
..taxData.replace(TaxDataEntity())
..paymentBalance = 0;
..paymentBalance = 0
..classification = kTaxClassificationCompany;
static Serializer<ClientEntity> get serializer => _$clientEntitySerializer;
}

View File

@ -224,6 +224,9 @@ class _$ClientEntitySerializer implements StructuredSerializer<ClientEntity> {
'tax_info',
serializers.serialize(object.taxData,
specifiedType: const FullType(TaxDataEntity)),
'classification',
serializers.serialize(object.classification,
specifiedType: const FullType(String)),
'contacts',
serializers.serialize(object.contacts,
specifiedType: const FullType(
@ -465,6 +468,10 @@ class _$ClientEntitySerializer implements StructuredSerializer<ClientEntity> {
result.taxData.replace(serializers.deserialize(value,
specifiedType: const FullType(TaxDataEntity)) as TaxDataEntity);
break;
case 'classification':
result.classification = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'contacts':
result.contacts.replace(serializers.deserialize(value,
specifiedType: const FullType(
@ -1024,6 +1031,8 @@ class _$ClientEntity extends ClientEntity {
@override
final TaxDataEntity taxData;
@override
final String classification;
@override
final BuiltList<ClientContactEntity> contacts;
@override
final BuiltList<ActivityEntity> activities;
@ -1095,6 +1104,7 @@ class _$ClientEntity extends ClientEntity {
this.routingId,
this.isTaxExempt,
this.taxData,
this.classification,
this.contacts,
this.activities,
this.ledger,
@ -1176,6 +1186,8 @@ class _$ClientEntity extends ClientEntity {
BuiltValueNullFieldError.checkNotNull(
isTaxExempt, r'ClientEntity', 'isTaxExempt');
BuiltValueNullFieldError.checkNotNull(taxData, r'ClientEntity', 'taxData');
BuiltValueNullFieldError.checkNotNull(
classification, r'ClientEntity', 'classification');
BuiltValueNullFieldError.checkNotNull(
contacts, r'ClientEntity', 'contacts');
BuiltValueNullFieldError.checkNotNull(
@ -1245,6 +1257,7 @@ class _$ClientEntity extends ClientEntity {
routingId == other.routingId &&
isTaxExempt == other.isTaxExempt &&
taxData == other.taxData &&
classification == other.classification &&
contacts == other.contacts &&
activities == other.activities &&
ledger == other.ledger &&
@ -1304,6 +1317,7 @@ class _$ClientEntity extends ClientEntity {
_$hash = $jc(_$hash, routingId.hashCode);
_$hash = $jc(_$hash, isTaxExempt.hashCode);
_$hash = $jc(_$hash, taxData.hashCode);
_$hash = $jc(_$hash, classification.hashCode);
_$hash = $jc(_$hash, contacts.hashCode);
_$hash = $jc(_$hash, activities.hashCode);
_$hash = $jc(_$hash, ledger.hashCode);
@ -1364,6 +1378,7 @@ class _$ClientEntity extends ClientEntity {
..add('routingId', routingId)
..add('isTaxExempt', isTaxExempt)
..add('taxData', taxData)
..add('classification', classification)
..add('contacts', contacts)
..add('activities', activities)
..add('ledger', ledger)
@ -1551,6 +1566,11 @@ class ClientEntityBuilder
_$this._taxData ??= new TaxDataEntityBuilder();
set taxData(TaxDataEntityBuilder taxData) => _$this._taxData = taxData;
String _classification;
String get classification => _$this._classification;
set classification(String classification) =>
_$this._classification = classification;
ListBuilder<ClientContactEntity> _contacts;
ListBuilder<ClientContactEntity> get contacts =>
_$this._contacts ??= new ListBuilder<ClientContactEntity>();
@ -1666,6 +1686,7 @@ class ClientEntityBuilder
_routingId = $v.routingId;
_isTaxExempt = $v.isTaxExempt;
_taxData = $v.taxData.toBuilder();
_classification = $v.classification;
_contacts = $v.contacts.toBuilder();
_activities = $v.activities.toBuilder();
_ledger = $v.ledger.toBuilder();
@ -1751,6 +1772,7 @@ class ClientEntityBuilder
routingId: BuiltValueNullFieldError.checkNotNull(routingId, r'ClientEntity', 'routingId'),
isTaxExempt: BuiltValueNullFieldError.checkNotNull(isTaxExempt, r'ClientEntity', 'isTaxExempt'),
taxData: taxData.build(),
classification: BuiltValueNullFieldError.checkNotNull(classification, r'ClientEntity', 'classification'),
contacts: contacts.build(),
activities: activities.build(),
ledger: ledger.build(),
@ -1773,6 +1795,7 @@ class ClientEntityBuilder
_$failedField = 'taxData';
taxData.build();
_$failedField = 'contacts';
contacts.build();
_$failedField = 'activities';

View File

@ -1000,6 +1000,9 @@ abstract class SettingsEntity
@BuiltValueField(wireName: 'default_expense_payment_type_id')
String get defaultExpensePaymentTypeId;
@nullable
String get classification;
bool get hasAddress => address1 != null && address1.isNotEmpty;
bool get hasLogo => companyLogo != null && companyLogo.isNotEmpty;

View File

@ -1534,6 +1534,13 @@ class _$SettingsEntitySerializer
..add(serializers.serialize(value,
specifiedType: const FullType(String)));
}
value = object.classification;
if (value != null) {
result
..add('classification')
..add(serializers.serialize(value,
specifiedType: const FullType(String)));
}
return result;
}
@ -2426,6 +2433,10 @@ class _$SettingsEntitySerializer
result.defaultExpensePaymentTypeId = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'classification':
result.classification = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
}
}
@ -2940,6 +2951,8 @@ class _$SettingsEntity extends SettingsEntity {
final String eInvoiceType;
@override
final String defaultExpensePaymentTypeId;
@override
final String classification;
factory _$SettingsEntity([void Function(SettingsEntityBuilder) updates]) =>
(new SettingsEntityBuilder()..update(updates))._build();
@ -3162,7 +3175,8 @@ class _$SettingsEntity extends SettingsEntity {
this.showTaskItemDescription,
this.enableEInvoice,
this.eInvoiceType,
this.defaultExpensePaymentTypeId})
this.defaultExpensePaymentTypeId,
this.classification})
: super._();
@override
@ -3399,7 +3413,8 @@ class _$SettingsEntity extends SettingsEntity {
showTaskItemDescription == other.showTaskItemDescription &&
enableEInvoice == other.enableEInvoice &&
eInvoiceType == other.eInvoiceType &&
defaultExpensePaymentTypeId == other.defaultExpensePaymentTypeId;
defaultExpensePaymentTypeId == other.defaultExpensePaymentTypeId &&
classification == other.classification;
}
int __hashCode;
@ -3625,6 +3640,7 @@ class _$SettingsEntity extends SettingsEntity {
_$hash = $jc(_$hash, enableEInvoice.hashCode);
_$hash = $jc(_$hash, eInvoiceType.hashCode);
_$hash = $jc(_$hash, defaultExpensePaymentTypeId.hashCode);
_$hash = $jc(_$hash, classification.hashCode);
_$hash = $jf(_$hash);
return __hashCode ??= _$hash;
}
@ -3854,7 +3870,8 @@ class _$SettingsEntity extends SettingsEntity {
..add('showTaskItemDescription', showTaskItemDescription)
..add('enableEInvoice', enableEInvoice)
..add('eInvoiceType', eInvoiceType)
..add('defaultExpensePaymentTypeId', defaultExpensePaymentTypeId))
..add('defaultExpensePaymentTypeId', defaultExpensePaymentTypeId)
..add('classification', classification))
.toString();
}
}
@ -4933,6 +4950,11 @@ class SettingsEntityBuilder
set defaultExpensePaymentTypeId(String defaultExpensePaymentTypeId) =>
_$this._defaultExpensePaymentTypeId = defaultExpensePaymentTypeId;
String _classification;
String get classification => _$this._classification;
set classification(String classification) =>
_$this._classification = classification;
SettingsEntityBuilder();
SettingsEntityBuilder get _$this {
@ -5156,6 +5178,7 @@ class SettingsEntityBuilder
_enableEInvoice = $v.enableEInvoice;
_eInvoiceType = $v.eInvoiceType;
_defaultExpensePaymentTypeId = $v.defaultExpensePaymentTypeId;
_classification = $v.classification;
_$v = null;
}
return this;
@ -5398,7 +5421,8 @@ class SettingsEntityBuilder
showTaskItemDescription: showTaskItemDescription,
enableEInvoice: enableEInvoice,
eInvoiceType: eInvoiceType,
defaultExpensePaymentTypeId: defaultExpensePaymentTypeId);
defaultExpensePaymentTypeId: defaultExpensePaymentTypeId,
classification: classification);
} catch (_) {
String _$failedField;
try {

View File

@ -82,6 +82,7 @@ class VendorFields {
static const String postalCity = 'postal_city';
static const String lastLoginAt = 'last_login_at';
static const String contactEmail = 'contact_email';
static const String classification = 'classification';
}
abstract class VendorEntity extends Object
@ -124,6 +125,7 @@ abstract class VendorEntity extends Object
createdUserId: '',
createdAt: 0,
lastLogin: 0,
classification: '',
documents: BuiltList<DocumentEntity>(),
);
}
@ -217,6 +219,8 @@ abstract class VendorEntity extends Object
@BuiltValueField(wireName: 'last_login')
int get lastLogin;
String get classification;
BuiltList<VendorContactEntity> get contacts;
@override
@ -512,7 +516,8 @@ abstract class VendorEntity extends Object
static void _initializeBuilder(VendorEntityBuilder builder) => builder
..activities.replace(BuiltList<ActivityEntity>())
..lastLogin = 0
..languageId = '';
..languageId = ''
..classification = kTaxClassificationCompany;
static Serializer<VendorEntity> get serializer => _$vendorEntitySerializer;
}

View File

@ -173,6 +173,9 @@ class _$VendorEntitySerializer implements StructuredSerializer<VendorEntity> {
'last_login',
serializers.serialize(object.lastLogin,
specifiedType: const FullType(int)),
'classification',
serializers.serialize(object.classification,
specifiedType: const FullType(String)),
'contacts',
serializers.serialize(object.contacts,
specifiedType: const FullType(
@ -334,6 +337,10 @@ class _$VendorEntitySerializer implements StructuredSerializer<VendorEntity> {
result.lastLogin = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
break;
case 'classification':
result.classification = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'contacts':
result.contacts.replace(serializers.deserialize(value,
specifiedType: const FullType(
@ -820,6 +827,8 @@ class _$VendorEntity extends VendorEntity {
@override
final int lastLogin;
@override
final String classification;
@override
final BuiltList<VendorContactEntity> contacts;
@override
final BuiltList<ActivityEntity> activities;
@ -868,6 +877,7 @@ class _$VendorEntity extends VendorEntity {
this.customValue3,
this.customValue4,
this.lastLogin,
this.classification,
this.contacts,
this.activities,
this.documents,
@ -916,6 +926,8 @@ class _$VendorEntity extends VendorEntity {
customValue4, r'VendorEntity', 'customValue4');
BuiltValueNullFieldError.checkNotNull(
lastLogin, r'VendorEntity', 'lastLogin');
BuiltValueNullFieldError.checkNotNull(
classification, r'VendorEntity', 'classification');
BuiltValueNullFieldError.checkNotNull(
contacts, r'VendorEntity', 'contacts');
BuiltValueNullFieldError.checkNotNull(
@ -963,6 +975,7 @@ class _$VendorEntity extends VendorEntity {
customValue3 == other.customValue3 &&
customValue4 == other.customValue4 &&
lastLogin == other.lastLogin &&
classification == other.classification &&
contacts == other.contacts &&
activities == other.activities &&
documents == other.documents &&
@ -1002,6 +1015,7 @@ class _$VendorEntity extends VendorEntity {
_$hash = $jc(_$hash, customValue3.hashCode);
_$hash = $jc(_$hash, customValue4.hashCode);
_$hash = $jc(_$hash, lastLogin.hashCode);
_$hash = $jc(_$hash, classification.hashCode);
_$hash = $jc(_$hash, contacts.hashCode);
_$hash = $jc(_$hash, activities.hashCode);
_$hash = $jc(_$hash, documents.hashCode);
@ -1042,6 +1056,7 @@ class _$VendorEntity extends VendorEntity {
..add('customValue3', customValue3)
..add('customValue4', customValue4)
..add('lastLogin', lastLogin)
..add('classification', classification)
..add('contacts', contacts)
..add('activities', activities)
..add('documents', documents)
@ -1149,6 +1164,11 @@ class VendorEntityBuilder
int get lastLogin => _$this._lastLogin;
set lastLogin(int lastLogin) => _$this._lastLogin = lastLogin;
String _classification;
String get classification => _$this._classification;
set classification(String classification) =>
_$this._classification = classification;
ListBuilder<VendorContactEntity> _contacts;
ListBuilder<VendorContactEntity> get contacts =>
_$this._contacts ??= new ListBuilder<VendorContactEntity>();
@ -1230,6 +1250,7 @@ class VendorEntityBuilder
_customValue3 = $v.customValue3;
_customValue4 = $v.customValue4;
_lastLogin = $v.lastLogin;
_classification = $v.classification;
_contacts = $v.contacts.toBuilder();
_activities = $v.activities.toBuilder();
_documents = $v.documents.toBuilder();
@ -1297,6 +1318,7 @@ class VendorEntityBuilder
customValue3: BuiltValueNullFieldError.checkNotNull(customValue3, r'VendorEntity', 'customValue3'),
customValue4: BuiltValueNullFieldError.checkNotNull(customValue4, r'VendorEntity', 'customValue4'),
lastLogin: BuiltValueNullFieldError.checkNotNull(lastLogin, r'VendorEntity', 'lastLogin'),
classification: BuiltValueNullFieldError.checkNotNull(classification, r'VendorEntity', 'classification'),
contacts: contacts.build(),
activities: activities.build(),
documents: documents.build(),