Add project_id to invoices
This commit is contained in:
parent
72fc611089
commit
010c2cefd3
|
|
@ -143,6 +143,7 @@ abstract class InvoiceEntity extends Object
|
||||||
discount: 0,
|
discount: 0,
|
||||||
taxAmount: 0,
|
taxAmount: 0,
|
||||||
poNumber: '',
|
poNumber: '',
|
||||||
|
projectId: '',
|
||||||
date: convertDateTimeToSqlDate(),
|
date: convertDateTimeToSqlDate(),
|
||||||
dueDate: '',
|
dueDate: '',
|
||||||
publicNotes: '',
|
publicNotes: '',
|
||||||
|
|
@ -249,6 +250,7 @@ abstract class InvoiceEntity extends Object
|
||||||
..paidToDate = 0
|
..paidToDate = 0
|
||||||
..remainingCycles = -1
|
..remainingCycles = -1
|
||||||
..invoiceId = ''
|
..invoiceId = ''
|
||||||
|
..projectId = ''
|
||||||
..subscriptionId = ''
|
..subscriptionId = ''
|
||||||
..number = ''
|
..number = ''
|
||||||
..date = convertDateTimeToSqlDate()
|
..date = convertDateTimeToSqlDate()
|
||||||
|
|
@ -311,6 +313,9 @@ abstract class InvoiceEntity extends Object
|
||||||
@BuiltValueField(wireName: 'client_id')
|
@BuiltValueField(wireName: 'client_id')
|
||||||
String get clientId;
|
String get clientId;
|
||||||
|
|
||||||
|
@BuiltValueField(wireName: 'project_id')
|
||||||
|
String get projectId;
|
||||||
|
|
||||||
@BuiltValueField(wireName: 'subscription_id')
|
@BuiltValueField(wireName: 'subscription_id')
|
||||||
String get subscriptionId;
|
String get subscriptionId;
|
||||||
|
|
||||||
|
|
@ -1203,6 +1208,7 @@ abstract class InvoiceEntity extends Object
|
||||||
static void _initializeBuilder(InvoiceEntityBuilder builder) => builder
|
static void _initializeBuilder(InvoiceEntityBuilder builder) => builder
|
||||||
..activities.replace(BuiltList<ActivityEntity>())
|
..activities.replace(BuiltList<ActivityEntity>())
|
||||||
..paidToDate = 0
|
..paidToDate = 0
|
||||||
|
..projectId = ''
|
||||||
..autoBillEnabled = false
|
..autoBillEnabled = false
|
||||||
..subscriptionId = '';
|
..subscriptionId = '';
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -138,6 +138,9 @@ class _$InvoiceEntitySerializer implements StructuredSerializer<InvoiceEntity> {
|
||||||
'client_id',
|
'client_id',
|
||||||
serializers.serialize(object.clientId,
|
serializers.serialize(object.clientId,
|
||||||
specifiedType: const FullType(String)),
|
specifiedType: const FullType(String)),
|
||||||
|
'project_id',
|
||||||
|
serializers.serialize(object.projectId,
|
||||||
|
specifiedType: const FullType(String)),
|
||||||
'subscription_id',
|
'subscription_id',
|
||||||
serializers.serialize(object.subscriptionId,
|
serializers.serialize(object.subscriptionId,
|
||||||
specifiedType: const FullType(String)),
|
specifiedType: const FullType(String)),
|
||||||
|
|
@ -439,6 +442,10 @@ class _$InvoiceEntitySerializer implements StructuredSerializer<InvoiceEntity> {
|
||||||
result.clientId = serializers.deserialize(value,
|
result.clientId = serializers.deserialize(value,
|
||||||
specifiedType: const FullType(String)) as String;
|
specifiedType: const FullType(String)) as String;
|
||||||
break;
|
break;
|
||||||
|
case 'project_id':
|
||||||
|
result.projectId = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(String)) as String;
|
||||||
|
break;
|
||||||
case 'subscription_id':
|
case 'subscription_id':
|
||||||
result.subscriptionId = serializers.deserialize(value,
|
result.subscriptionId = serializers.deserialize(value,
|
||||||
specifiedType: const FullType(String)) as String;
|
specifiedType: const FullType(String)) as String;
|
||||||
|
|
@ -1387,6 +1394,8 @@ class _$InvoiceEntity extends InvoiceEntity {
|
||||||
@override
|
@override
|
||||||
final String clientId;
|
final String clientId;
|
||||||
@override
|
@override
|
||||||
|
final String projectId;
|
||||||
|
@override
|
||||||
final String subscriptionId;
|
final String subscriptionId;
|
||||||
@override
|
@override
|
||||||
final String statusId;
|
final String statusId;
|
||||||
|
|
@ -1525,6 +1534,7 @@ class _$InvoiceEntity extends InvoiceEntity {
|
||||||
this.balance,
|
this.balance,
|
||||||
this.paidToDate,
|
this.paidToDate,
|
||||||
this.clientId,
|
this.clientId,
|
||||||
|
this.projectId,
|
||||||
this.subscriptionId,
|
this.subscriptionId,
|
||||||
this.statusId,
|
this.statusId,
|
||||||
this.number,
|
this.number,
|
||||||
|
|
@ -1597,6 +1607,8 @@ class _$InvoiceEntity extends InvoiceEntity {
|
||||||
paidToDate, 'InvoiceEntity', 'paidToDate');
|
paidToDate, 'InvoiceEntity', 'paidToDate');
|
||||||
BuiltValueNullFieldError.checkNotNull(
|
BuiltValueNullFieldError.checkNotNull(
|
||||||
clientId, 'InvoiceEntity', 'clientId');
|
clientId, 'InvoiceEntity', 'clientId');
|
||||||
|
BuiltValueNullFieldError.checkNotNull(
|
||||||
|
projectId, 'InvoiceEntity', 'projectId');
|
||||||
BuiltValueNullFieldError.checkNotNull(
|
BuiltValueNullFieldError.checkNotNull(
|
||||||
subscriptionId, 'InvoiceEntity', 'subscriptionId');
|
subscriptionId, 'InvoiceEntity', 'subscriptionId');
|
||||||
BuiltValueNullFieldError.checkNotNull(
|
BuiltValueNullFieldError.checkNotNull(
|
||||||
|
|
@ -1701,6 +1713,7 @@ class _$InvoiceEntity extends InvoiceEntity {
|
||||||
balance == other.balance &&
|
balance == other.balance &&
|
||||||
paidToDate == other.paidToDate &&
|
paidToDate == other.paidToDate &&
|
||||||
clientId == other.clientId &&
|
clientId == other.clientId &&
|
||||||
|
projectId == other.projectId &&
|
||||||
subscriptionId == other.subscriptionId &&
|
subscriptionId == other.subscriptionId &&
|
||||||
statusId == other.statusId &&
|
statusId == other.statusId &&
|
||||||
number == other.number &&
|
number == other.number &&
|
||||||
|
|
@ -1787,7 +1800,7 @@ class _$InvoiceEntity extends InvoiceEntity {
|
||||||
$jc(
|
$jc(
|
||||||
$jc(
|
$jc(
|
||||||
$jc(
|
$jc(
|
||||||
$jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc(0, amount.hashCode), balance.hashCode), paidToDate.hashCode), clientId.hashCode), subscriptionId.hashCode), statusId.hashCode), number.hashCode), discount.hashCode), poNumber.hashCode), date.hashCode), dueDate.hashCode), publicNotes.hashCode), privateNotes.hashCode), terms.hashCode), footer.hashCode), designId.hashCode), usesInclusiveTaxes.hashCode), taxName1.hashCode), taxRate1.hashCode), taxName2.hashCode), taxRate2.hashCode), taxName3.hashCode), taxRate3.hashCode), isAmountDiscount.hashCode), partial.hashCode), taxAmount.hashCode), partialDueDate.hashCode), autoBill.hashCode), customValue1.hashCode), customValue2.hashCode), customValue3.hashCode), customValue4.hashCode), customSurcharge1.hashCode), customSurcharge2.hashCode), customSurcharge3.hashCode), customSurcharge4.hashCode), customTaxes1.hashCode), customTaxes2.hashCode), customTaxes3.hashCode), customTaxes4.hashCode), exchangeRate.hashCode), reminder1Sent.hashCode), reminder2Sent.hashCode), reminder3Sent.hashCode), reminderLastSent.hashCode), frequencyId.hashCode), lastSentDate.hashCode), nextSendDate.hashCode),
|
$jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc(0, amount.hashCode), balance.hashCode), paidToDate.hashCode), clientId.hashCode), projectId.hashCode), subscriptionId.hashCode), statusId.hashCode), number.hashCode), discount.hashCode), poNumber.hashCode), date.hashCode), dueDate.hashCode), publicNotes.hashCode), privateNotes.hashCode), terms.hashCode), footer.hashCode), designId.hashCode), usesInclusiveTaxes.hashCode), taxName1.hashCode), taxRate1.hashCode), taxName2.hashCode), taxRate2.hashCode), taxName3.hashCode), taxRate3.hashCode), isAmountDiscount.hashCode), partial.hashCode), taxAmount.hashCode), partialDueDate.hashCode), autoBill.hashCode), customValue1.hashCode), customValue2.hashCode), customValue3.hashCode), customValue4.hashCode), customSurcharge1.hashCode), customSurcharge2.hashCode), customSurcharge3.hashCode), customSurcharge4.hashCode), customTaxes1.hashCode), customTaxes2.hashCode), customTaxes3.hashCode), customTaxes4.hashCode), exchangeRate.hashCode), reminder1Sent.hashCode), reminder2Sent.hashCode), reminder3Sent.hashCode), reminderLastSent.hashCode), frequencyId.hashCode), lastSentDate.hashCode), nextSendDate.hashCode),
|
||||||
remainingCycles.hashCode),
|
remainingCycles.hashCode),
|
||||||
dueDateDays.hashCode),
|
dueDateDays.hashCode),
|
||||||
invoiceId.hashCode),
|
invoiceId.hashCode),
|
||||||
|
|
@ -1816,6 +1829,7 @@ class _$InvoiceEntity extends InvoiceEntity {
|
||||||
..add('balance', balance)
|
..add('balance', balance)
|
||||||
..add('paidToDate', paidToDate)
|
..add('paidToDate', paidToDate)
|
||||||
..add('clientId', clientId)
|
..add('clientId', clientId)
|
||||||
|
..add('projectId', projectId)
|
||||||
..add('subscriptionId', subscriptionId)
|
..add('subscriptionId', subscriptionId)
|
||||||
..add('statusId', statusId)
|
..add('statusId', statusId)
|
||||||
..add('number', number)
|
..add('number', number)
|
||||||
|
|
@ -1905,6 +1919,10 @@ class InvoiceEntityBuilder
|
||||||
String get clientId => _$this._clientId;
|
String get clientId => _$this._clientId;
|
||||||
set clientId(String clientId) => _$this._clientId = clientId;
|
set clientId(String clientId) => _$this._clientId = clientId;
|
||||||
|
|
||||||
|
String _projectId;
|
||||||
|
String get projectId => _$this._projectId;
|
||||||
|
set projectId(String projectId) => _$this._projectId = projectId;
|
||||||
|
|
||||||
String _subscriptionId;
|
String _subscriptionId;
|
||||||
String get subscriptionId => _$this._subscriptionId;
|
String get subscriptionId => _$this._subscriptionId;
|
||||||
set subscriptionId(String subscriptionId) =>
|
set subscriptionId(String subscriptionId) =>
|
||||||
|
|
@ -2202,6 +2220,7 @@ class InvoiceEntityBuilder
|
||||||
_balance = $v.balance;
|
_balance = $v.balance;
|
||||||
_paidToDate = $v.paidToDate;
|
_paidToDate = $v.paidToDate;
|
||||||
_clientId = $v.clientId;
|
_clientId = $v.clientId;
|
||||||
|
_projectId = $v.projectId;
|
||||||
_subscriptionId = $v.subscriptionId;
|
_subscriptionId = $v.subscriptionId;
|
||||||
_statusId = $v.statusId;
|
_statusId = $v.statusId;
|
||||||
_number = $v.number;
|
_number = $v.number;
|
||||||
|
|
@ -2297,14 +2316,15 @@ class InvoiceEntityBuilder
|
||||||
paidToDate, 'InvoiceEntity', 'paidToDate'),
|
paidToDate, 'InvoiceEntity', 'paidToDate'),
|
||||||
clientId: BuiltValueNullFieldError.checkNotNull(
|
clientId: BuiltValueNullFieldError.checkNotNull(
|
||||||
clientId, 'InvoiceEntity', 'clientId'),
|
clientId, 'InvoiceEntity', 'clientId'),
|
||||||
|
projectId: BuiltValueNullFieldError.checkNotNull(
|
||||||
|
projectId, 'InvoiceEntity', 'projectId'),
|
||||||
subscriptionId: BuiltValueNullFieldError.checkNotNull(
|
subscriptionId: BuiltValueNullFieldError.checkNotNull(
|
||||||
subscriptionId, 'InvoiceEntity', 'subscriptionId'),
|
subscriptionId, 'InvoiceEntity', 'subscriptionId'),
|
||||||
statusId: BuiltValueNullFieldError.checkNotNull(
|
statusId: BuiltValueNullFieldError.checkNotNull(
|
||||||
statusId, 'InvoiceEntity', 'statusId'),
|
statusId, 'InvoiceEntity', 'statusId'),
|
||||||
number: BuiltValueNullFieldError.checkNotNull(
|
number: BuiltValueNullFieldError.checkNotNull(
|
||||||
number, 'InvoiceEntity', 'number'),
|
number, 'InvoiceEntity', 'number'),
|
||||||
discount: BuiltValueNullFieldError.checkNotNull(
|
discount: BuiltValueNullFieldError.checkNotNull(discount, 'InvoiceEntity', 'discount'),
|
||||||
discount, 'InvoiceEntity', 'discount'),
|
|
||||||
poNumber: BuiltValueNullFieldError.checkNotNull(poNumber, 'InvoiceEntity', 'poNumber'),
|
poNumber: BuiltValueNullFieldError.checkNotNull(poNumber, 'InvoiceEntity', 'poNumber'),
|
||||||
date: BuiltValueNullFieldError.checkNotNull(date, 'InvoiceEntity', 'date'),
|
date: BuiltValueNullFieldError.checkNotNull(date, 'InvoiceEntity', 'date'),
|
||||||
dueDate: BuiltValueNullFieldError.checkNotNull(dueDate, 'InvoiceEntity', 'dueDate'),
|
dueDate: BuiltValueNullFieldError.checkNotNull(dueDate, 'InvoiceEntity', 'dueDate'),
|
||||||
|
|
|
||||||
|
|
@ -273,7 +273,9 @@ void handleProjectAction(
|
||||||
createEntity(
|
createEntity(
|
||||||
context: context,
|
context: context,
|
||||||
entity: InvoiceEntity(state: state, client: client)
|
entity: InvoiceEntity(state: state, client: client)
|
||||||
.rebuild((b) => b..lineItems.addAll(items)));
|
.rebuild((b) => b..lineItems.addAll(items)
|
||||||
|
//..projectId = project.id
|
||||||
|
));
|
||||||
break;
|
break;
|
||||||
case EntityAction.newExpense:
|
case EntityAction.newExpense:
|
||||||
createEntity(
|
createEntity(
|
||||||
|
|
|
||||||
|
|
@ -360,11 +360,21 @@ void handleTaskAction(
|
||||||
.map((task) => convertTaskToInvoiceItem(task: task, context: context))
|
.map((task) => convertTaskToInvoiceItem(task: task, context: context))
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
|
String projectId = '';
|
||||||
|
for (var each in tasks) {
|
||||||
|
final task = each as TaskEntity;
|
||||||
|
if (task.projectId.isNotEmpty) {
|
||||||
|
//projectId = task.projectId;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (items.isNotEmpty) {
|
if (items.isNotEmpty) {
|
||||||
createEntity(
|
createEntity(
|
||||||
context: context,
|
context: context,
|
||||||
entity: InvoiceEntity(state: state, client: client)
|
entity: InvoiceEntity(state: state, client: client).rebuild((b) => b
|
||||||
.rebuild((b) => b..lineItems.addAll(items)));
|
..lineItems.addAll(items)
|
||||||
|
..projectId = projectId));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EntityAction.clone:
|
case EntityAction.clone:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue