@things-factory/sales-base 4.0.36 → 4.0.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/dist-server/controllers/ecommerce/sellercraft-controller.js +4 -3
  2. package/dist-server/controllers/ecommerce/sellercraft-controller.js.map +1 -1
  3. package/dist-server/service/arrival-notice/arrival-notice-mutation.js +42 -35
  4. package/dist-server/service/arrival-notice/arrival-notice-mutation.js.map +1 -1
  5. package/dist-server/service/arrival-notice/arrival-notice-query.js +91 -79
  6. package/dist-server/service/arrival-notice/arrival-notice-query.js.map +1 -1
  7. package/dist-server/service/arrival-notice/arrival-notice-types.js +8 -0
  8. package/dist-server/service/arrival-notice/arrival-notice-types.js.map +1 -1
  9. package/dist-server/service/arrival-notice/arrival-notice.js +20 -15
  10. package/dist-server/service/arrival-notice/arrival-notice.js.map +1 -1
  11. package/dist-server/service/delivery-order/delivery-order-mutation.js +28 -26
  12. package/dist-server/service/delivery-order/delivery-order-mutation.js.map +1 -1
  13. package/dist-server/service/delivery-order/delivery-order-query.js +14 -14
  14. package/dist-server/service/delivery-order/delivery-order-query.js.map +1 -1
  15. package/dist-server/service/delivery-order/delivery-order-summary-report.js +145 -0
  16. package/dist-server/service/delivery-order/delivery-order-summary-report.js.map +1 -0
  17. package/dist-server/service/delivery-order/delivery-order.js +16 -13
  18. package/dist-server/service/delivery-order/delivery-order.js.map +1 -1
  19. package/dist-server/service/delivery-order/index.js +3 -1
  20. package/dist-server/service/delivery-order/index.js.map +1 -1
  21. package/dist-server/service/index.js +12 -4
  22. package/dist-server/service/index.js.map +1 -1
  23. package/dist-server/service/invoice/invoice-mutation.js +21 -3
  24. package/dist-server/service/invoice/invoice-mutation.js.map +1 -1
  25. package/dist-server/service/invoice/invoice-query.js +5 -7
  26. package/dist-server/service/invoice/invoice-query.js.map +1 -1
  27. package/dist-server/service/invoice/invoice-types.js +302 -20
  28. package/dist-server/service/invoice/invoice-types.js.map +1 -1
  29. package/dist-server/service/invoice/invoice.js +190 -26
  30. package/dist-server/service/invoice/invoice.js.map +1 -1
  31. package/dist-server/service/invoice-product/index.js +21 -0
  32. package/dist-server/service/invoice-product/index.js.map +1 -0
  33. package/dist-server/service/invoice-product/invoice-product-mutation.js +70 -0
  34. package/dist-server/service/invoice-product/invoice-product-mutation.js.map +1 -0
  35. package/dist-server/service/invoice-product/invoice-product-query.js +95 -0
  36. package/dist-server/service/invoice-product/invoice-product-query.js.map +1 -0
  37. package/dist-server/service/invoice-product/invoice-product-types.js +125 -0
  38. package/dist-server/service/invoice-product/invoice-product-types.js.map +1 -0
  39. package/dist-server/service/invoice-product/invoice-product.js +117 -0
  40. package/dist-server/service/invoice-product/invoice-product.js.map +1 -0
  41. package/dist-server/service/order-inventory/order-inventory-query.js +9 -7
  42. package/dist-server/service/order-inventory/order-inventory-query.js.map +1 -1
  43. package/dist-server/service/order-inventory/order-inventory-types.js +11 -11
  44. package/dist-server/service/order-inventory/order-inventory-types.js.map +1 -1
  45. package/dist-server/service/order-inventory/order-inventory.js +31 -25
  46. package/dist-server/service/order-inventory/order-inventory.js.map +1 -1
  47. package/dist-server/service/order-product/order-product.js +26 -21
  48. package/dist-server/service/order-product/order-product.js.map +1 -1
  49. package/dist-server/service/order-vas/order-vas.js +34 -27
  50. package/dist-server/service/order-vas/order-vas.js.map +1 -1
  51. package/dist-server/service/others/other-query.js +4 -2
  52. package/dist-server/service/others/other-query.js.map +1 -1
  53. package/dist-server/service/others/other-types.js +42 -0
  54. package/dist-server/service/others/other-types.js.map +1 -1
  55. package/dist-server/service/purchase-order/purchase-order-mutation.js +23 -36
  56. package/dist-server/service/purchase-order/purchase-order-mutation.js.map +1 -1
  57. package/dist-server/service/release-good/release-good-mutation.js +84 -82
  58. package/dist-server/service/release-good/release-good-mutation.js.map +1 -1
  59. package/dist-server/service/release-good/release-good-query.js +8 -9
  60. package/dist-server/service/release-good/release-good-query.js.map +1 -1
  61. package/dist-server/service/release-good/release-good.js +2 -0
  62. package/dist-server/service/release-good/release-good.js.map +1 -1
  63. package/dist-server/service/return-order/return-order-mutation.js +21 -6
  64. package/dist-server/service/return-order/return-order-mutation.js.map +1 -1
  65. package/dist-server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory-type.js +9 -5
  66. package/dist-server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory-type.js.map +1 -1
  67. package/dist-server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory.js +3 -2
  68. package/dist-server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory.js.map +1 -1
  69. package/dist-server/utils/order-no-generator.js +7 -0
  70. package/dist-server/utils/order-no-generator.js.map +1 -1
  71. package/package.json +12 -12
  72. package/server/controllers/ecommerce/sellercraft-controller.ts +2 -1
  73. package/server/service/arrival-notice/arrival-notice-mutation.ts +11 -15
  74. package/server/service/arrival-notice/arrival-notice-query.ts +94 -78
  75. package/server/service/arrival-notice/arrival-notice-types.ts +6 -0
  76. package/server/service/arrival-notice/arrival-notice.ts +6 -1
  77. package/server/service/delivery-order/delivery-order-mutation.ts +4 -8
  78. package/server/service/delivery-order/delivery-order-query.ts +4 -4
  79. package/server/service/delivery-order/delivery-order-summary-report.ts +152 -0
  80. package/server/service/delivery-order/delivery-order.ts +4 -1
  81. package/server/service/delivery-order/index.ts +3 -1
  82. package/server/service/index.ts +20 -12
  83. package/server/service/invoice/invoice-mutation.ts +45 -7
  84. package/server/service/invoice/invoice-query.ts +6 -6
  85. package/server/service/invoice/invoice-types.ts +231 -18
  86. package/server/service/invoice/invoice.ts +154 -20
  87. package/server/service/invoice-product/index.ts +9 -0
  88. package/server/service/invoice-product/invoice-product-mutation.ts +54 -0
  89. package/server/service/invoice-product/invoice-product-query.ts +55 -0
  90. package/server/service/invoice-product/invoice-product-types.ts +80 -0
  91. package/server/service/invoice-product/invoice-product.ts +93 -0
  92. package/server/service/order-inventory/order-inventory-query.ts +3 -1
  93. package/server/service/order-inventory/order-inventory-types.ts +11 -11
  94. package/server/service/order-inventory/order-inventory.ts +11 -13
  95. package/server/service/order-product/order-product.ts +13 -13
  96. package/server/service/order-vas/order-vas.ts +15 -15
  97. package/server/service/others/other-query.ts +9 -15
  98. package/server/service/others/other-types.ts +31 -0
  99. package/server/service/purchase-order/purchase-order-mutation.ts +19 -21
  100. package/server/service/release-good/release-good-mutation.ts +64 -58
  101. package/server/service/release-good/release-good-query.ts +6 -12
  102. package/server/service/release-good/release-good.ts +2 -0
  103. package/server/service/return-order/return-order-mutation.ts +30 -6
  104. package/server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory-type.ts +8 -5
  105. package/server/service/reverse-kitting-order-inventory/reverse-kitting-order-inventory.ts +3 -2
  106. package/server/utils/order-no-generator.ts +11 -0
@@ -1,13 +1,3 @@
1
- /* IMPORT ENTITIES AND RESOLVERS */
2
- import { entities as ManifestEntities, resolvers as ManifestResolvers } from './manifest'
3
- import {
4
- entities as ReverseKittingOrderInventoryEntities,
5
- resolvers as ReverseKittingOrderInventoryResolvers
6
- } from './reverse-kitting-order-inventory'
7
- import {
8
- entities as ReverseKittingOrderEntities,
9
- resolvers as ReverseKittingOrderResolvers
10
- } from './reverse-kitting-order'
11
1
  import { entities as ArrivalNoticeEntity, resolvers as ArrivalNoticeResolvers } from './arrival-notice'
12
2
  import { entities as ClaimEntity, resolvers as ClaimResolvers } from './claim'
13
3
  import { entities as ClaimDetailEntity, resolvers as ClaimDetailResolvers } from './claim-detail'
@@ -17,7 +7,10 @@ import { entities as DeliveryOrderEntity, resolvers as DeliveryOrderResolvers }
17
7
  import { entities as GoodsReceivalNoteEntity, resolvers as GoodsReceivalNoteResolvers } from './goods-receival-note'
18
8
  import { entities as InventoryCheckEntity, resolvers as InventoryCheckResolvers } from './inventory-check'
19
9
  import { entities as InvoiceEntity, resolvers as InvoiceResolvers } from './invoice'
10
+ import { entities as InvoiceProductEntity, resolvers as InvoiceProductResolvers } from './invoice-product'
20
11
  import { entities as JobSheetEntity, resolvers as JobSheetResolvers } from './job-sheet'
12
+ /* IMPORT ENTITIES AND RESOLVERS */
13
+ import { entities as ManifestEntities, resolvers as ManifestResolvers } from './manifest'
21
14
  import { entities as OrderInventoryEntity, resolvers as OrderInventoryResolvers } from './order-inventory'
22
15
  import { entities as OrderProductEntity, resolvers as OrderProductResolvers } from './order-product'
23
16
  import { entities as OrderVasEntity, resolvers as OrderVasResolvers } from './order-vas'
@@ -33,6 +26,14 @@ import {
33
26
  resolvers as RetailReplenishmentOrderResolvers
34
27
  } from './retail-replenishment-order'
35
28
  import { entities as ReturnOrderEntity, resolvers as ReturnOrderResolvers } from './return-order'
29
+ import {
30
+ entities as ReverseKittingOrderEntities,
31
+ resolvers as ReverseKittingOrderResolvers
32
+ } from './reverse-kitting-order'
33
+ import {
34
+ entities as ReverseKittingOrderInventoryEntities,
35
+ resolvers as ReverseKittingOrderInventoryResolvers
36
+ } from './reverse-kitting-order-inventory'
36
37
  import { entities as ShippingOrderEntity, resolvers as ShippingOrderResolvers } from './shipping-order'
37
38
  import { entities as TransferOrderEntity, resolvers as TransferOrderResolvers } from './transfer-order'
38
39
  import { entities as VasEntity, resolvers as VasResolvers } from './vas'
@@ -51,6 +52,7 @@ export * from './delivery-order/delivery-order'
51
52
  export * from './goods-receival-note/goods-receival-note'
52
53
  export * from './inventory-check/inventory-check'
53
54
  export * from './invoice/invoice'
55
+ export * from './invoice-product/invoice-product'
54
56
  export * from './job-sheet/job-sheet'
55
57
  export * from './order-inventory/order-inventory'
56
58
  export * from './order-product/order-product'
@@ -75,6 +77,7 @@ export * from './delivery-order/delivery-order-types'
75
77
  export * from './goods-receival-note/goods-receival-note-types'
76
78
  export * from './inventory-check/inventory-check-types'
77
79
  export * from './invoice/invoice-types'
80
+ export * from './invoice-product/invoice-product-types'
78
81
  export * from './job-sheet/job-sheet-types'
79
82
  export * from './order-inventory/order-inventory-types'
80
83
  export * from './order-product/order-product-types'
@@ -100,6 +103,7 @@ export * from './delivery-order/delivery-order-mutation'
100
103
  export * from './goods-receival-note/goods-receival-note-mutation'
101
104
  export * from './inventory-check/inventory-check-mutation'
102
105
  export * from './invoice/invoice-mutation'
106
+ export * from './invoice-product/invoice-product-mutation'
103
107
  export * from './job-sheet/job-sheet-mutation'
104
108
  export * from './order-inventory/order-inventory-mutation'
105
109
  export * from './order-product/order-product-mutation'
@@ -121,9 +125,11 @@ export * from './claim-order/claim-order-query'
121
125
  export * from './claim/claim-query'
122
126
  export * from './collection-order/collection-order-query'
123
127
  export * from './delivery-order/delivery-order-query'
128
+ export * from './delivery-order/delivery-order-summary-report'
124
129
  export * from './goods-receival-note/goods-receival-note-query'
125
130
  export * from './inventory-check/inventory-check-query'
126
131
  export * from './invoice/invoice-query'
132
+ export * from './invoice-product/invoice-product-query'
127
133
  export * from './job-sheet/job-sheet-query'
128
134
  export * from './order-inventory/order-inventory-query'
129
135
  export * from './order-product/order-product-query'
@@ -141,7 +147,7 @@ export * from './vas/vas-query'
141
147
 
142
148
  export const entities = [
143
149
  /* ENTITIES */
144
- ...ManifestEntities,
150
+ ...ManifestEntities,
145
151
  ...ReverseKittingOrderInventoryEntities,
146
152
  ...ReverseKittingOrderEntities,
147
153
  ...ArrivalNoticeEntity,
@@ -153,6 +159,7 @@ export const entities = [
153
159
  ...GoodsReceivalNoteEntity,
154
160
  ...InventoryCheckEntity,
155
161
  ...InvoiceEntity,
162
+ ...InvoiceProductEntity,
156
163
  ...JobSheetEntity,
157
164
  ...OrderInventoryEntity,
158
165
  ...OrderProductEntity,
@@ -171,7 +178,7 @@ export const entities = [
171
178
  export const schema = {
172
179
  resolverClasses: [
173
180
  /* RESOLVER CLASSES */
174
- ...ManifestResolvers,
181
+ ...ManifestResolvers,
175
182
  ...ReverseKittingOrderInventoryResolvers,
176
183
  ...ReverseKittingOrderResolvers,
177
184
  ...ArrivalNoticeResolvers,
@@ -183,6 +190,7 @@ export const schema = {
183
190
  ...GoodsReceivalNoteResolvers,
184
191
  ...InventoryCheckResolvers,
185
192
  ...InvoiceResolvers,
193
+ ...InvoiceProductResolvers,
186
194
  ...JobSheetResolvers,
187
195
  ...OrderInventoryResolvers,
188
196
  ...OrderProductResolvers,
@@ -1,8 +1,13 @@
1
+ import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'
2
+ import { EntityManager, getRepository, Repository } from 'typeorm'
3
+
1
4
  import { User } from '@things-factory/auth-base'
5
+ import { Product } from '@things-factory/product-base'
2
6
  import { Domain } from '@things-factory/shell'
3
- import { Arg, Ctx, Directive, Mutation, Resolver } from 'type-graphql'
4
- import { EntityManager } from 'typeorm'
7
+
5
8
  import { InvoicePatch, NewInvoice } from '../'
9
+ import { OrderNoGenerator } from '../../utils'
10
+ import { InvoiceProduct } from '../invoice-product/invoice-product'
6
11
  import { Invoice } from './invoice'
7
12
 
8
13
  @Resolver(Invoice)
@@ -10,14 +15,20 @@ export class InvoiceMutation {
10
15
  @Mutation(returns => Invoice)
11
16
  @Directive('@transaction')
12
17
  async createInvoice(@Arg('invoice', type => NewInvoice) invoice: NewInvoice, @Ctx() context: any): Promise<Invoice> {
13
- const { tx }: { tx: EntityManager } = context.state
18
+ const { tx, domain, user }: { tx: EntityManager; domain: Domain; user: User } = context.state
19
+ let invoiceProducts: any[] = invoice.invoiceProducts
14
20
 
15
- return await tx.getRepository(Invoice).save({
21
+ let createdInvoice: Invoice = await tx.getRepository(Invoice).save({
16
22
  ...invoice,
17
- domain: context.state.domain,
18
- creator: context.state.user,
19
- updater: context.state.user
23
+ domain,
24
+ name: OrderNoGenerator.invoice(),
25
+ // releaseGood: await tx.getRepository(ReleaseGood).findOne(invoice?.releaseGood.id),
26
+ creator: user
20
27
  })
28
+
29
+ await addInvoiceProducts(domain, createdInvoice, invoiceProducts, user, tx)
30
+
31
+ return createdInvoice
21
32
  }
22
33
 
23
34
  @Mutation(returns => Invoice)
@@ -50,3 +61,30 @@ export class InvoiceMutation {
50
61
  return true
51
62
  }
52
63
  }
64
+
65
+ export async function addInvoiceProducts(
66
+ domain: Domain,
67
+ invoice: Invoice,
68
+ invoiceProducts: any[],
69
+ user: User,
70
+ tx?: EntityManager
71
+ ): Promise<void> {
72
+ const productRepo: Repository<Product> = tx?.getRepository(Product) || getRepository(Product)
73
+ const invoiceProductRepo: Repository<InvoiceProduct> =
74
+ tx?.getRepository(InvoiceProduct) || getRepository(InvoiceProduct)
75
+
76
+ const createdInvoiceProducts: InvoiceProduct[] = await Promise.all(
77
+ invoiceProducts.map(async (invoiceProduct: InvoiceProduct) => {
78
+ return {
79
+ name: OrderNoGenerator.invoiceProduct(),
80
+ ...invoiceProduct,
81
+ domain,
82
+ product: await productRepo.findOne(invoiceProduct?.product.id),
83
+ invoice,
84
+ creator: user
85
+ }
86
+ })
87
+ )
88
+
89
+ await invoiceProductRepo.save(createdInvoiceProducts)
90
+ }
@@ -1,9 +1,11 @@
1
- import { User } from '@things-factory/auth-base'
2
- import { buildQuery, Domain, Filter, Pagination, Sorting } from '@things-factory/shell'
3
1
  import { Arg, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'
4
2
  import { getRepository } from 'typeorm'
5
- import { InvoiceList } from '../'
3
+
4
+ import { User } from '@things-factory/auth-base'
5
+ import { buildQuery, Domain, Filter, Pagination, Sorting } from '@things-factory/shell'
6
+
6
7
  import { Invoice } from './invoice'
8
+ import { InvoiceList } from './invoice-types'
7
9
 
8
10
  @Resolver(Invoice)
9
11
  export class InvoiceQuery {
@@ -18,8 +20,6 @@ export class InvoiceQuery {
18
20
  buildQuery(queryBuilder, { filters, pagination, sortings }, context)
19
21
  const [items, total] = await queryBuilder
20
22
  .leftJoinAndSelect('Invoice.domain', 'Domain')
21
- .leftJoinAndSelect('Invoice.customer', 'Bizplace')
22
- .leftJoinAndSelect('Invoice.purchaseOrder', 'PurchaseOrder')
23
23
  .leftJoinAndSelect('Invoice.creator', 'Creator')
24
24
  .leftJoinAndSelect('Invoice.updater', 'Updater')
25
25
  .getManyAndCount()
@@ -33,7 +33,7 @@ export class InvoiceQuery {
33
33
 
34
34
  return await getRepository(Invoice).findOne({
35
35
  where: { domain, name },
36
- relations: ['domain', 'customer', 'purchaseOrder', 'creator', 'updater']
36
+ relations: ['domain', 'creator', 'updater']
37
37
  })
38
38
  }
39
39
 
@@ -1,5 +1,8 @@
1
1
  import { Field, InputType, Int, ObjectType } from 'type-graphql'
2
- import { PurchaseOrderPatch } from '../purchase-order/purchase-order-types'
2
+
3
+ import { ObjectRef } from '@things-factory/shell'
4
+
5
+ import { InvoiceProductPatch, NewInvoiceProduct } from '../invoice-product/invoice-product-types'
3
6
  import { Invoice } from './invoice'
4
7
 
5
8
  @ObjectType()
@@ -17,25 +20,130 @@ export class NewInvoice {
17
20
  name: string
18
21
 
19
22
  @Field()
20
- customer: string
23
+ refNo1: string
24
+
25
+ @Field()
26
+ refNo2: string
27
+
28
+ @Field()
29
+ refNo3: string
21
30
 
22
31
  @Field()
23
32
  issuedOn: string
24
33
 
25
34
  @Field()
26
- paymentDue: string
35
+ contactPointRefId: string
36
+
37
+ @Field()
38
+ from: string
39
+
40
+ @Field()
41
+ fromContactPhone: string
42
+
43
+ @Field()
44
+ fromAddress1: string
45
+
46
+ @Field()
47
+ fromAddress2: string
48
+
49
+ @Field()
50
+ fromAddress3: string
51
+
52
+ @Field()
53
+ fromAddress4: string
54
+
55
+ @Field()
56
+ fromAddress5: string
57
+
58
+ @Field()
59
+ fromPostcode: string
60
+
61
+ @Field()
62
+ fromCity: string
27
63
 
28
64
  @Field()
29
- version: string
65
+ fromState: string
30
66
 
31
- @Field(type => PurchaseOrderPatch)
32
- purchaseOrder: PurchaseOrderPatch
67
+ @Field()
68
+ fromCountry: string
69
+
70
+ @Field()
71
+ deliverTo: string
72
+
73
+ @Field()
74
+ deliverToPhone: string
33
75
 
34
76
  @Field()
35
- state: string
77
+ deliveryAddress1: string
78
+
79
+ @Field()
80
+ deliveryAddress2: string
81
+
82
+ @Field()
83
+ deliveryAddress3: string
84
+
85
+ @Field()
86
+ deliveryAddress4: string
87
+
88
+ @Field()
89
+ deliveryAddress5: string
90
+
91
+ @Field()
92
+ deliveryCity: string
93
+
94
+ @Field()
95
+ deliveryState: string
96
+
97
+ @Field()
98
+ deliveryCountry: string
99
+
100
+ @Field()
101
+ deliveryPostcode: string
102
+
103
+ @Field()
104
+ billTo: string
105
+
106
+ @Field()
107
+ billToPhone: string
108
+
109
+ @Field()
110
+ billingAddress1: string
111
+
112
+ @Field()
113
+ billingAddress2: string
114
+
115
+ @Field()
116
+ billingAddress3: string
117
+
118
+ @Field()
119
+ billingAddress4: string
120
+
121
+ @Field()
122
+ billingAddress5: string
123
+
124
+ @Field()
125
+ billingPostcode: string
126
+
127
+ @Field()
128
+ billingCity: string
129
+
130
+ @Field()
131
+ billingState: string
132
+
133
+ @Field()
134
+ billingCountry: string
135
+
136
+ @Field()
137
+ paymentDue: String
36
138
 
37
139
  @Field({ nullable: true })
38
140
  description: string
141
+
142
+ @Field(type => [NewInvoiceProduct])
143
+ invoiceProducts: NewInvoiceProduct[]
144
+
145
+ @Field(type => ObjectRef)
146
+ releaseGood: ObjectRef
39
147
  }
40
148
 
41
149
  @InputType()
@@ -43,24 +151,129 @@ export class InvoicePatch {
43
151
  @Field({ nullable: true })
44
152
  name: string
45
153
 
46
- @Field({ nullable: true })
47
- customer: string
154
+ @Field()
155
+ refNo1: string
48
156
 
49
- @Field({ nullable: true })
157
+ @Field()
158
+ refNo2: string
159
+
160
+ @Field()
161
+ refNo3: string
162
+
163
+ @Field()
50
164
  issuedOn: string
51
165
 
52
- @Field({ nullable: true })
53
- paymentDue: string
166
+ @Field()
167
+ contactPointRefId: string
54
168
 
55
- @Field({ nullable: true })
56
- version: string
169
+ @Field()
170
+ from: string
57
171
 
58
- @Field(type => PurchaseOrderPatch, { nullable: true })
59
- purchaseOrder: PurchaseOrderPatch
172
+ @Field()
173
+ fromContactPhone: string
60
174
 
61
- @Field({ nullable: true })
62
- state: string
175
+ @Field()
176
+ fromAddress1: string
177
+
178
+ @Field()
179
+ fromAddress2: string
180
+
181
+ @Field()
182
+ fromAddress3: string
183
+
184
+ @Field()
185
+ fromAddress4: string
186
+
187
+ @Field()
188
+ fromAddress5: string
189
+
190
+ @Field()
191
+ fromPostcode: string
192
+
193
+ @Field()
194
+ fromCity: string
195
+
196
+ @Field()
197
+ fromState: string
198
+
199
+ @Field()
200
+ fromCountry: string
201
+
202
+ @Field()
203
+ deliverTo: string
204
+
205
+ @Field()
206
+ deliverToPhone: string
207
+
208
+ @Field()
209
+ deliveryAddress1: string
210
+
211
+ @Field()
212
+ deliveryAddress2: string
213
+
214
+ @Field()
215
+ deliveryAddress3: string
216
+
217
+ @Field()
218
+ deliveryAddress4: string
219
+
220
+ @Field()
221
+ deliveryAddress5: string
222
+
223
+ @Field()
224
+ deliveryCity: string
225
+
226
+ @Field()
227
+ deliveryState: string
228
+
229
+ @Field()
230
+ deliveryCountry: string
231
+
232
+ @Field()
233
+ deliveryPostcode: string
234
+
235
+ @Field()
236
+ billTo: string
237
+
238
+ @Field()
239
+ billToPhone: string
240
+
241
+ @Field()
242
+ billingAddress1: string
243
+
244
+ @Field()
245
+ billingAddress2: string
246
+
247
+ @Field()
248
+ billingAddress3: string
249
+
250
+ @Field()
251
+ billingAddress4: string
252
+
253
+ @Field()
254
+ billingAddress5: string
255
+
256
+ @Field()
257
+ billingPostcode: string
258
+
259
+ @Field()
260
+ billingCity: string
261
+
262
+ @Field()
263
+ billingState: string
264
+
265
+ @Field()
266
+ billingCountry: string
267
+
268
+ @Field()
269
+ paymentDue: String
63
270
 
64
271
  @Field({ nullable: true })
65
272
  description: string
273
+
274
+ @Field(type => [InvoiceProductPatch], { nullable: true })
275
+ invoiceProducts: InvoiceProductPatch[]
276
+
277
+ @Field(type => ObjectRef, { nullable: true })
278
+ releaseGood: ObjectRef
66
279
  }
@@ -1,6 +1,3 @@
1
- import { User } from '@things-factory/auth-base'
2
- import { Bizplace } from '@things-factory/biz-base'
3
- import { Domain } from '@things-factory/shell'
4
1
  import { Field, ID, ObjectType } from 'type-graphql'
5
2
  import {
6
3
  Column,
@@ -9,15 +6,21 @@ import {
9
6
  Index,
10
7
  JoinColumn,
11
8
  ManyToOne,
9
+ OneToMany,
12
10
  OneToOne,
13
11
  PrimaryGeneratedColumn,
14
12
  RelationId,
15
13
  UpdateDateColumn
16
14
  } from 'typeorm'
17
- import { PurchaseOrder } from '../'
15
+
16
+ import { User } from '@things-factory/auth-base'
17
+ import { Domain } from '@things-factory/shell'
18
+
19
+ import { InvoiceProduct } from '../invoice-product/invoice-product'
20
+ import { ReleaseGood } from '../release-good/release-good'
18
21
 
19
22
  @Entity()
20
- @Index('ix_invoice_0', (invoice: Invoice) => [invoice.domain, invoice.name, invoice.customer])
23
+ @Index('ix_invoice_0', (invoice: Invoice) => [invoice.id], { unique: true })
21
24
  @ObjectType()
22
25
  export class Invoice {
23
26
  @PrimaryGeneratedColumn('uuid')
@@ -35,37 +38,168 @@ export class Invoice {
35
38
  @Field()
36
39
  name: string
37
40
 
38
- @ManyToOne(type => Bizplace)
39
- @Field(type => Bizplace, { nullable: true })
40
- customer: Bizplace
41
+ @Column({ nullable: true })
42
+ @Field({ nullable: true })
43
+ description: string
44
+
45
+ @OneToMany(type => InvoiceProduct, invoiceProduct => invoiceProduct.invoice)
46
+ invoiceProducts: InvoiceProduct[]
47
+
48
+ @OneToOne(type => ReleaseGood, { nullable: true })
49
+ @JoinColumn()
50
+ releaseGood: ReleaseGood
51
+
52
+ @Column({ default: '' })
53
+ @Field()
54
+ refNo1: string
55
+
56
+ @Column({ default: '' })
57
+ @Field()
58
+ refNo2: string
41
59
 
42
- @RelationId((invoice: Invoice) => invoice.customer)
43
- customerId: string
60
+ @Column({ default: '' })
61
+ @Field()
62
+ refNo3: string
44
63
 
45
- @Column('date')
64
+ @Column({ nullable: true })
46
65
  @Field()
47
66
  issuedOn: Date
48
67
 
49
- @Column('date')
68
+ @Column({ type: 'uuid', nullable: true })
69
+ @Field({ nullable: true })
70
+ contactPointRefId: string
71
+
72
+ @Column()
50
73
  @Field()
51
- paymentDue: Date
74
+ from: string
52
75
 
53
76
  @Column()
54
77
  @Field()
55
- version: string
78
+ fromContactPhone: string
56
79
 
57
- @OneToOne(type => PurchaseOrder)
58
- @JoinColumn()
59
- @Field(type => PurchaseOrder, { nullable: true })
60
- purchaseOrder: PurchaseOrder
80
+ @Column({ nullable: true })
81
+ @Field({ nullable: true })
82
+ fromAddress1: string
83
+
84
+ @Column({ nullable: true })
85
+ @Field({ nullable: true })
86
+ fromAddress2: string
87
+
88
+ @Column({ nullable: true })
89
+ @Field({ nullable: true })
90
+ fromAddress3: string
91
+
92
+ @Column({ nullable: true })
93
+ @Field({ nullable: true })
94
+ fromAddress4: string
95
+
96
+ @Column({ nullable: true })
97
+ @Field({ nullable: true })
98
+ fromAddress5: string
99
+
100
+ @Column({ nullable: true })
101
+ @Field({ nullable: true })
102
+ fromPostcode: string
103
+
104
+ @Column({ nullable: true })
105
+ @Field({ nullable: true })
106
+ fromCity: string
107
+
108
+ @Column({ nullable: true })
109
+ @Field({ nullable: true })
110
+ fromState: string
111
+
112
+ @Column({ nullable: true })
113
+ @Field({ nullable: true })
114
+ fromCountry: string
61
115
 
62
116
  @Column()
63
117
  @Field()
64
- state: string
118
+ deliverTo: string
119
+
120
+ @Column()
121
+ @Field()
122
+ deliverToPhone: string
123
+
124
+ @Column()
125
+ @Field()
126
+ deliveryAddress1: string
65
127
 
66
128
  @Column({ nullable: true })
67
129
  @Field({ nullable: true })
68
- description: string
130
+ deliveryAddress2: string
131
+
132
+ @Column({ nullable: true })
133
+ @Field({ nullable: true })
134
+ deliveryAddress3: string
135
+
136
+ @Column({ nullable: true })
137
+ @Field({ nullable: true })
138
+ deliveryAddress4: string
139
+
140
+ @Column({ nullable: true })
141
+ @Field({ nullable: true })
142
+ deliveryAddress5: string
143
+
144
+ @Column()
145
+ @Field()
146
+ deliveryPostcode: string
147
+
148
+ @Column()
149
+ @Field()
150
+ deliveryCity: string
151
+
152
+ @Column()
153
+ @Field()
154
+ deliveryState: string
155
+
156
+ @Column()
157
+ @Field()
158
+ deliveryCountry: string
159
+
160
+ @Column()
161
+ @Field()
162
+ billTo: string
163
+
164
+ @Column()
165
+ @Field()
166
+ billToPhone: string
167
+
168
+ @Column()
169
+ @Field()
170
+ billingAddress1: string
171
+
172
+ @Column({ nullable: true })
173
+ @Field({ nullable: true })
174
+ billingAddress2: string
175
+
176
+ @Column({ nullable: true })
177
+ @Field({ nullable: true })
178
+ billingAddress3: string
179
+
180
+ @Column({ nullable: true })
181
+ @Field({ nullable: true })
182
+ billingAddress4: string
183
+
184
+ @Column({ nullable: true })
185
+ @Field({ nullable: true })
186
+ billingAddress5: string
187
+
188
+ @Column()
189
+ @Field()
190
+ billingPostcode: string
191
+
192
+ @Column()
193
+ @Field()
194
+ billingCity: string
195
+
196
+ @Column()
197
+ @Field()
198
+ billingState: string
199
+
200
+ @Column()
201
+ @Field()
202
+ billingCountry: string
69
203
 
70
204
  @CreateDateColumn()
71
205
  @Field()