@things-factory/sales-base 3.8.25 → 3.8.29
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.
- package/dist-server/entities/index.js +6 -3
- package/dist-server/entities/index.js.map +1 -1
- package/dist-server/entities/invoice-product.js +94 -0
- package/dist-server/entities/invoice-product.js.map +1 -0
- package/dist-server/entities/invoice.js +163 -24
- package/dist-server/entities/invoice.js.map +1 -1
- package/dist-server/entities/release-good.js +3 -1
- package/dist-server/entities/release-good.js.map +1 -1
- package/dist-server/graphql/resolvers/index.js +3 -0
- package/dist-server/graphql/resolvers/index.js.map +1 -1
- package/dist-server/graphql/resolvers/invoice/create-invoice.js +17 -2
- package/dist-server/graphql/resolvers/invoice/create-invoice.js.map +1 -1
- package/dist-server/graphql/resolvers/invoice-product/create-invoice-product.js +12 -0
- package/dist-server/graphql/resolvers/invoice-product/create-invoice-product.js.map +1 -0
- package/dist-server/graphql/resolvers/invoice-product/delete-invoice-product.js +13 -0
- package/dist-server/graphql/resolvers/invoice-product/delete-invoice-product.js.map +1 -0
- package/dist-server/graphql/resolvers/invoice-product/delete-invoice-products.js +16 -0
- package/dist-server/graphql/resolvers/invoice-product/delete-invoice-products.js.map +1 -0
- package/dist-server/graphql/resolvers/invoice-product/index.js +12 -0
- package/dist-server/graphql/resolvers/invoice-product/index.js.map +1 -0
- package/dist-server/graphql/resolvers/invoice-product/invoice-product-query.js +33 -0
- package/dist-server/graphql/resolvers/invoice-product/invoice-product-query.js.map +1 -0
- package/dist-server/graphql/resolvers/invoice-product/update-invoice-product.js +16 -0
- package/dist-server/graphql/resolvers/invoice-product/update-invoice-product.js.map +1 -0
- package/dist-server/graphql/resolvers/invoice-product/update-multiple-invoice-product.js +31 -0
- package/dist-server/graphql/resolvers/invoice-product/update-multiple-invoice-product.js.map +1 -0
- package/dist-server/graphql/resolvers/purchase-order/create-purchase-order.js +5 -5
- package/dist-server/graphql/resolvers/purchase-order/create-purchase-order.js.map +1 -1
- package/dist-server/graphql/resolvers/purchase-order/update-purchase-order.js +12 -23
- package/dist-server/graphql/resolvers/purchase-order/update-purchase-order.js.map +1 -1
- package/dist-server/graphql/resolvers/purchase-order/upsert-purchase-order.js +5 -7
- package/dist-server/graphql/resolvers/purchase-order/upsert-purchase-order.js.map +1 -1
- package/dist-server/graphql/types/index.js +4 -0
- package/dist-server/graphql/types/index.js.map +1 -1
- package/dist-server/graphql/types/invoice/invoice-patch.js +38 -5
- package/dist-server/graphql/types/invoice/invoice-patch.js.map +1 -1
- package/dist-server/graphql/types/invoice/invoice.js +38 -4
- package/dist-server/graphql/types/invoice/invoice.js.map +1 -1
- package/dist-server/graphql/types/invoice/new-invoice.js +42 -8
- package/dist-server/graphql/types/invoice/new-invoice.js.map +1 -1
- package/dist-server/graphql/types/invoice-product/index.js +21 -0
- package/dist-server/graphql/types/invoice-product/index.js.map +1 -0
- package/dist-server/graphql/types/invoice-product/invoice-product-list.js +14 -0
- package/dist-server/graphql/types/invoice-product/invoice-product-list.js.map +1 -0
- package/dist-server/graphql/types/invoice-product/invoice-product-patch.js +21 -0
- package/dist-server/graphql/types/invoice-product/invoice-product-patch.js.map +1 -0
- package/dist-server/graphql/types/invoice-product/invoice-product.js +27 -0
- package/dist-server/graphql/types/invoice-product/invoice-product.js.map +1 -0
- package/dist-server/graphql/types/invoice-product/new-invoice-product.js +21 -0
- package/dist-server/graphql/types/invoice-product/new-invoice-product.js.map +1 -0
- package/dist-server/graphql/types/invoice-product/product-input.js +13 -0
- package/dist-server/graphql/types/invoice-product/product-input.js.map +1 -0
- package/dist-server/graphql/types/purchase-order/index.js +1 -1
- package/dist-server/graphql/types/purchase-order/index.js.map +1 -1
- package/dist-server/utils/order-no-generator.js +7 -0
- package/dist-server/utils/order-no-generator.js.map +1 -1
- package/package.json +6 -6
- package/server/entities/index.ts +6 -3
- package/server/entities/invoice-product.ts +64 -0
- package/server/entities/invoice.ts +127 -19
- package/server/entities/release-good.ts +2 -0
- package/server/graphql/resolvers/index.ts +3 -0
- package/server/graphql/resolvers/invoice/create-invoice.ts +43 -6
- package/server/graphql/resolvers/invoice-product/create-invoice-product.ts +16 -0
- package/server/graphql/resolvers/invoice-product/delete-invoice-product.ts +13 -0
- package/server/graphql/resolvers/invoice-product/delete-invoice-products.ts +16 -0
- package/server/graphql/resolvers/invoice-product/index.ts +18 -0
- package/server/graphql/resolvers/invoice-product/invoice-product-query.ts +38 -0
- package/server/graphql/resolvers/invoice-product/update-invoice-product.ts +19 -0
- package/server/graphql/resolvers/invoice-product/update-multiple-invoice-product.ts +46 -0
- package/server/graphql/resolvers/purchase-order/create-purchase-order.ts +33 -32
- package/server/graphql/resolvers/purchase-order/update-purchase-order.ts +10 -8
- package/server/graphql/resolvers/purchase-order/upsert-purchase-order.ts +21 -32
- package/server/graphql/types/index.ts +4 -0
- package/server/graphql/types/invoice/invoice-patch.ts +38 -5
- package/server/graphql/types/invoice/invoice.ts +38 -4
- package/server/graphql/types/invoice/new-invoice.ts +42 -8
- package/server/graphql/types/invoice-product/index.ts +20 -0
- package/server/graphql/types/invoice-product/invoice-product-list.ts +8 -0
- package/server/graphql/types/invoice-product/invoice-product-patch.ts +15 -0
- package/server/graphql/types/invoice-product/invoice-product.ts +21 -0
- package/server/graphql/types/invoice-product/new-invoice-product.ts +15 -0
- package/server/graphql/types/invoice-product/product-input.ts +7 -0
- package/server/graphql/types/purchase-order/index.ts +1 -4
- package/server/utils/order-no-generator.ts +11 -0
|
@@ -1,21 +1,30 @@
|
|
|
1
|
+
import { FileUpload } from 'graphql-upload'
|
|
2
|
+
import { EntityManager, getRepository, Repository } from 'typeorm'
|
|
3
|
+
|
|
1
4
|
import { Attachment, createAttachments } from '@things-factory/attachment-base'
|
|
2
|
-
import { Bizplace, ContactPoint, getMyBizplace, getOutletBizplace, getPermittedBizplaces } from '@things-factory/biz-base'
|
|
3
|
-
import { Location } from '@things-factory/warehouse-base'
|
|
4
|
-
import { generateId } from '@things-factory/id-rule-base'
|
|
5
5
|
import { User } from '@things-factory/auth-base'
|
|
6
|
-
import {
|
|
7
|
-
|
|
6
|
+
import {
|
|
7
|
+
Bizplace,
|
|
8
|
+
ContactPoint,
|
|
9
|
+
getMyBizplace,
|
|
10
|
+
getOutletBizplace,
|
|
11
|
+
getPermittedBizplaces
|
|
12
|
+
} from '@things-factory/biz-base'
|
|
13
|
+
import { generateId } from '@things-factory/id-rule-base'
|
|
8
14
|
import { Setting } from '@things-factory/setting-base'
|
|
15
|
+
import { Domain } from '@things-factory/shell'
|
|
16
|
+
import { Location } from '@things-factory/warehouse-base'
|
|
17
|
+
|
|
9
18
|
import {
|
|
19
|
+
ATTACHMENT_TYPE,
|
|
10
20
|
ORDER_NUMBER_RULE_TYPE,
|
|
11
21
|
ORDER_NUMBER_SETTING_KEY,
|
|
12
|
-
PURCHASE_ORDER_STATUS
|
|
13
|
-
ATTACHMENT_TYPE
|
|
22
|
+
PURCHASE_ORDER_STATUS
|
|
14
23
|
} from '../../../constants'
|
|
15
|
-
import { ArrivalNotice,
|
|
24
|
+
import { ArrivalNotice, OrderProduct, PurchaseOrder, PurchaseOrderOtherCharge } from '../../../entities'
|
|
16
25
|
import { OrderNoGenerator } from '../../../utils/order-no-generator'
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
26
|
+
import { confirmArrivalNoticeFunction, generateArrivalNoticeFunction } from '../arrival-notice/index'
|
|
27
|
+
import { upsertPurchaseOrderProducts } from './index'
|
|
19
28
|
|
|
20
29
|
export const createPurchaseOrder = {
|
|
21
30
|
async createPurchaseOrder(_: any, { purchaseOrder }, context: any) {
|
|
@@ -33,7 +42,7 @@ export const createPurchaseOrder = {
|
|
|
33
42
|
export async function createPurchaseOrderFunction(
|
|
34
43
|
_: any,
|
|
35
44
|
purchaseOrder: any,
|
|
36
|
-
|
|
45
|
+
files: FileUpload[],
|
|
37
46
|
context: any,
|
|
38
47
|
tx?: EntityManager
|
|
39
48
|
): Promise<PurchaseOrder> {
|
|
@@ -54,24 +63,23 @@ export async function createPurchaseOrderFunction(
|
|
|
54
63
|
if (!foundPermittedBizplace) throw new Error(`This user does not permitted for this company`)
|
|
55
64
|
|
|
56
65
|
purchaseOrder.bizplace = foundPermittedBizplace
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
66
|
+
} else {
|
|
59
67
|
arrError.push(`No bizplace was selected`)
|
|
60
68
|
}
|
|
61
69
|
|
|
62
|
-
if(purchaseOrder?.supplier?.id){
|
|
63
|
-
purchaseOrder.supplier = await getRepository(ContactPoint).findOne({id: purchaseOrder.supplier.id})
|
|
64
|
-
}else{
|
|
70
|
+
if (purchaseOrder?.supplier?.id) {
|
|
71
|
+
purchaseOrder.supplier = await getRepository(ContactPoint).findOne({ id: purchaseOrder.supplier.id })
|
|
72
|
+
} else {
|
|
65
73
|
arrError.push(`No supplier was selected`)
|
|
66
74
|
}
|
|
67
75
|
|
|
68
|
-
if(purchaseOrder?.bufferLocation?.id){
|
|
69
|
-
purchaseOrder.bufferLocation = await getRepository(Location).findOne({id: purchaseOrder.bufferLocation.id})
|
|
70
|
-
}else{
|
|
76
|
+
if (purchaseOrder?.bufferLocation?.id) {
|
|
77
|
+
purchaseOrder.bufferLocation = await getRepository(Location).findOne({ id: purchaseOrder.bufferLocation.id })
|
|
78
|
+
} else {
|
|
71
79
|
arrError.push(`No buffer location was selected`)
|
|
72
80
|
}
|
|
73
81
|
|
|
74
|
-
if(arrError.length > 0){
|
|
82
|
+
if (arrError.length > 0) {
|
|
75
83
|
throw new Error(arrError.join(', '))
|
|
76
84
|
}
|
|
77
85
|
|
|
@@ -98,16 +106,9 @@ export async function createPurchaseOrderFunction(
|
|
|
98
106
|
creator: user,
|
|
99
107
|
updater: user
|
|
100
108
|
})
|
|
101
|
-
|
|
109
|
+
|
|
102
110
|
// // 2. Create purchase order product
|
|
103
|
-
await upsertPurchaseOrderProducts(
|
|
104
|
-
domain,
|
|
105
|
-
purchaseOrder.bizplace,
|
|
106
|
-
createdPurchaseOrder,
|
|
107
|
-
orderProducts,
|
|
108
|
-
user,
|
|
109
|
-
tx
|
|
110
|
-
)
|
|
111
|
+
await upsertPurchaseOrderProducts(domain, purchaseOrder.bizplace, createdPurchaseOrder, orderProducts, user, tx)
|
|
111
112
|
|
|
112
113
|
// // 3. Create purchase order misc charges
|
|
113
114
|
for await (let oc of otherCharges) {
|
|
@@ -122,8 +123,8 @@ export async function createPurchaseOrderFunction(
|
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
// // 4. Create Attacments
|
|
125
|
-
if (
|
|
126
|
-
const attachments: Attachment[] =
|
|
126
|
+
if (files?.length) {
|
|
127
|
+
const attachments: Attachment[] = files.map(attachment => {
|
|
127
128
|
return {
|
|
128
129
|
file: attachment,
|
|
129
130
|
refBy: createdPurchaseOrder.id,
|
|
@@ -132,6 +133,6 @@ export async function createPurchaseOrderFunction(
|
|
|
132
133
|
})
|
|
133
134
|
await createAttachments(_, { attachments }, context)
|
|
134
135
|
}
|
|
135
|
-
|
|
136
|
+
|
|
136
137
|
return createdPurchaseOrder
|
|
137
138
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FileUpload } from 'graphql-upload'
|
|
2
|
+
import { EntityManager, getRepository, Repository } from 'typeorm'
|
|
3
|
+
|
|
4
|
+
import { Attachment, createAttachments, deleteAttachmentsByRef } from '@things-factory/attachment-base'
|
|
2
5
|
import { User } from '@things-factory/auth-base'
|
|
3
6
|
import { Bizplace, ContactPoint, getPermittedBizplaces } from '@things-factory/biz-base'
|
|
4
7
|
import { Domain } from '@things-factory/shell'
|
|
5
8
|
import { Location } from '@things-factory/warehouse-base'
|
|
6
|
-
|
|
9
|
+
|
|
7
10
|
import { ATTACHMENT_TYPE } from '../../../constants'
|
|
8
11
|
import { OrderProduct, PurchaseOrder, PurchaseOrderOtherCharge } from '../../../entities'
|
|
9
12
|
import { getPurchaseOrderFunction, upsertPurchaseOrderProducts } from './index'
|
|
@@ -28,7 +31,7 @@ export const updatePurchaseOrder = {
|
|
|
28
31
|
export async function updatePurchaseOrderFunction(
|
|
29
32
|
_: any,
|
|
30
33
|
purchaseOrder: any,
|
|
31
|
-
|
|
34
|
+
files: FileUpload[],
|
|
32
35
|
context: any,
|
|
33
36
|
tx?: EntityManager
|
|
34
37
|
): Promise<PurchaseOrder> {
|
|
@@ -100,14 +103,13 @@ export async function updatePurchaseOrderFunction(
|
|
|
100
103
|
})
|
|
101
104
|
|
|
102
105
|
// // 6. Remove All Attachment
|
|
103
|
-
|
|
104
|
-
await
|
|
106
|
+
if (foundAttachments?.length) {
|
|
107
|
+
await deleteAttachmentsByRef(_, { refBys: foundAttachments.map(file => file.refBy) }, context)
|
|
105
108
|
}
|
|
106
109
|
|
|
107
110
|
// // 7. Add New Attachment
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
const attachments: Attachment[] = newAttachments.map(attachment => {
|
|
111
|
+
if (files?.length > 0) {
|
|
112
|
+
const attachments: Attachment[] = files.map(attachment => {
|
|
111
113
|
return {
|
|
112
114
|
file: attachment,
|
|
113
115
|
refBy: updatePurchaseOrder.id,
|
|
@@ -1,30 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { Setting } from '@things-factory/setting-base'
|
|
7
|
-
import { Domain } from '@things-factory/shell'
|
|
8
|
-
import { Location } from '@things-factory/warehouse-base'
|
|
9
|
-
import { EntityManager, getRepository, Repository } from 'typeorm'
|
|
10
|
-
import {
|
|
11
|
-
ORDER_NUMBER_RULE_TYPE,
|
|
12
|
-
ORDER_NUMBER_SETTING_KEY,
|
|
13
|
-
PURCHASE_ORDER_STATUS,
|
|
14
|
-
ATTACHMENT_TYPE
|
|
15
|
-
} from '../../../constants'
|
|
16
|
-
import { ArrivalNotice, PurchaseOrder, OrderProduct } from '../../../entities'
|
|
17
|
-
import { OrderNoGenerator } from '../../../utils/order-no-generator'
|
|
18
|
-
import { updatePurchaseOrderFunction, createPurchaseOrderFunction} from './index'
|
|
19
|
-
import { generateArrivalNoticeFunction, confirmArrivalNoticeFunction } from '../arrival-notice/index'
|
|
1
|
+
import { FileUpload } from 'graphql-upload'
|
|
2
|
+
import { EntityManager } from 'typeorm'
|
|
3
|
+
|
|
4
|
+
import { PurchaseOrder } from '../../../entities'
|
|
5
|
+
import { createPurchaseOrderFunction, updatePurchaseOrderFunction } from './index'
|
|
20
6
|
|
|
21
7
|
export const upsertPurchaseOrder = {
|
|
22
|
-
async upsertPurchaseOrder(_: any, { purchaseOrder,
|
|
8
|
+
async upsertPurchaseOrder(_: any, { purchaseOrder, files }, context: any) {
|
|
23
9
|
try {
|
|
24
10
|
const { tx }: { tx: EntityManager } = context.state
|
|
25
|
-
const createdPurchaseOrder: PurchaseOrder = await upsertPurchaseOrderFunction(
|
|
26
|
-
|
|
27
|
-
|
|
11
|
+
const createdPurchaseOrder: PurchaseOrder = await upsertPurchaseOrderFunction(
|
|
12
|
+
_,
|
|
13
|
+
purchaseOrder,
|
|
14
|
+
files,
|
|
15
|
+
context,
|
|
16
|
+
tx
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
return createdPurchaseOrder
|
|
28
20
|
} catch (error) {
|
|
29
21
|
throw error
|
|
30
22
|
}
|
|
@@ -34,18 +26,15 @@ export const upsertPurchaseOrder = {
|
|
|
34
26
|
export async function upsertPurchaseOrderFunction(
|
|
35
27
|
_: any,
|
|
36
28
|
purchaseOrder: any,
|
|
37
|
-
|
|
29
|
+
files: FileUpload[],
|
|
38
30
|
context: any,
|
|
39
31
|
tx?: EntityManager
|
|
40
32
|
): Promise<PurchaseOrder> {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
purchaseOrder = await createPurchaseOrderFunction(_, purchaseOrder, file, context, tx)
|
|
46
|
-
}else{
|
|
47
|
-
purchaseOrder = await updatePurchaseOrderFunction(_, purchaseOrder, file, context, tx)
|
|
33
|
+
if (!purchaseOrder.id) {
|
|
34
|
+
purchaseOrder = await createPurchaseOrderFunction(_, purchaseOrder, files, context, tx)
|
|
35
|
+
} else {
|
|
36
|
+
purchaseOrder = await updatePurchaseOrderFunction(_, purchaseOrder, files, context, tx)
|
|
48
37
|
}
|
|
49
|
-
|
|
38
|
+
|
|
50
39
|
return purchaseOrder
|
|
51
40
|
}
|
|
@@ -7,6 +7,7 @@ import * as DeliveryOrder from './delivery-order'
|
|
|
7
7
|
import * as GoodsReceivalNote from './goods-receival-note'
|
|
8
8
|
import * as InventoryCheck from './inventory-check'
|
|
9
9
|
import * as Invoice from './invoice'
|
|
10
|
+
import * as InvoiceProduct from './invoice-product'
|
|
10
11
|
import * as JobSheet from './job-sheet'
|
|
11
12
|
import * as Manifest from './manifest'
|
|
12
13
|
import * as OrderInventory from './order-inventory'
|
|
@@ -29,6 +30,7 @@ export const queries = [
|
|
|
29
30
|
RetailReplenishmentOrder.Query,
|
|
30
31
|
TransferOrder.Query,
|
|
31
32
|
Invoice.Query,
|
|
33
|
+
InvoiceProduct.Query,
|
|
32
34
|
InventoryCheck.Query,
|
|
33
35
|
JobSheet.Query,
|
|
34
36
|
PurchaseOrder.Query,
|
|
@@ -58,6 +60,7 @@ export const mutations = [
|
|
|
58
60
|
RetailReplenishmentOrder.Mutation,
|
|
59
61
|
TransferOrder.Mutation,
|
|
60
62
|
Invoice.Mutation,
|
|
63
|
+
InvoiceProduct.Mutation,
|
|
61
64
|
InventoryCheck.Mutation,
|
|
62
65
|
JobSheet.Mutation,
|
|
63
66
|
PurchaseOrder.Mutation,
|
|
@@ -86,6 +89,7 @@ export const types = [
|
|
|
86
89
|
...RetailReplenishmentOrder.Types,
|
|
87
90
|
...TransferOrder.Types,
|
|
88
91
|
...Invoice.Types,
|
|
92
|
+
...InvoiceProduct.Types,
|
|
89
93
|
...InventoryCheck.Types,
|
|
90
94
|
...JobSheet.Types,
|
|
91
95
|
...PurchaseOrder.Types,
|
|
@@ -3,12 +3,45 @@ import gql from 'graphql-tag'
|
|
|
3
3
|
export const InvoicePatch = gql`
|
|
4
4
|
input InvoicePatch {
|
|
5
5
|
name: String
|
|
6
|
-
|
|
6
|
+
refNo1: String
|
|
7
|
+
refNo2: String
|
|
8
|
+
refNo3: String
|
|
7
9
|
issuedOn: String
|
|
10
|
+
contactPointRefId: String
|
|
11
|
+
from: String
|
|
12
|
+
fromContactPhone: String
|
|
13
|
+
fromAddress1: String
|
|
14
|
+
fromAddress2: String
|
|
15
|
+
fromAddress3: String
|
|
16
|
+
fromAddress4: String
|
|
17
|
+
fromAddress5: String
|
|
18
|
+
fromPostcode: String
|
|
19
|
+
fromCity: String
|
|
20
|
+
fromState: String
|
|
21
|
+
fromCountry: String
|
|
22
|
+
deliverTo: String
|
|
23
|
+
deliverToPhone: String
|
|
24
|
+
deliveryAddress1: String
|
|
25
|
+
deliveryAddress2: String
|
|
26
|
+
deliveryAddress3: String
|
|
27
|
+
deliveryAddress4: String
|
|
28
|
+
deliveryAddress5: String
|
|
29
|
+
deliveryCity: String
|
|
30
|
+
deliveryState: String
|
|
31
|
+
deliveryCountry: String
|
|
32
|
+
billTo: String
|
|
33
|
+
billToPhone: String
|
|
34
|
+
billingAddress1: String
|
|
35
|
+
billingAddress2: String
|
|
36
|
+
billingAddress3: String
|
|
37
|
+
billingAddress4: String
|
|
38
|
+
billingAddress5: String
|
|
39
|
+
billingPostcode: String
|
|
40
|
+
billingCity: String
|
|
41
|
+
billingState: String
|
|
42
|
+
billingCountry: String
|
|
8
43
|
paymentDue: String
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
state: String
|
|
12
|
-
description: String
|
|
44
|
+
invoiceProducts: [ObjectRef]
|
|
45
|
+
releaseGood: ObjectRef
|
|
13
46
|
}
|
|
14
47
|
`
|
|
@@ -5,12 +5,46 @@ export const Invoice = gql`
|
|
|
5
5
|
id: String
|
|
6
6
|
domain: Domain
|
|
7
7
|
name: String
|
|
8
|
-
|
|
8
|
+
refNo1: String
|
|
9
|
+
refNo2: String
|
|
10
|
+
refNo3: String
|
|
9
11
|
issuedOn: String
|
|
12
|
+
contactPointRefId: String
|
|
13
|
+
from: String
|
|
14
|
+
fromContactPhone: String
|
|
15
|
+
fromAddress1: String
|
|
16
|
+
fromAddress2: String
|
|
17
|
+
fromAddress3: String
|
|
18
|
+
fromAddress4: String
|
|
19
|
+
fromAddress5: String
|
|
20
|
+
fromPostcode: String
|
|
21
|
+
fromCity: String
|
|
22
|
+
fromState: String
|
|
23
|
+
fromCountry: String
|
|
24
|
+
deliverTo: String
|
|
25
|
+
deliverToPhone: String
|
|
26
|
+
deliveryAddress1: String
|
|
27
|
+
deliveryAddress2: String
|
|
28
|
+
deliveryAddress3: String
|
|
29
|
+
deliveryAddress4: String
|
|
30
|
+
deliveryAddress5: String
|
|
31
|
+
deliveryCity: String
|
|
32
|
+
deliveryState: String
|
|
33
|
+
deliveryCountry: String
|
|
34
|
+
billTo: String
|
|
35
|
+
billToPhone: String
|
|
36
|
+
billingAddress1: String
|
|
37
|
+
billingAddress2: String
|
|
38
|
+
billingAddress3: String
|
|
39
|
+
billingAddress4: String
|
|
40
|
+
billingAddress5: String
|
|
41
|
+
billingPostcode: String
|
|
42
|
+
billingCity: String
|
|
43
|
+
billingState: String
|
|
44
|
+
billingCountry: String
|
|
10
45
|
paymentDue: String
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
state: String
|
|
46
|
+
invoiceProducts: [InvoiceProduct]
|
|
47
|
+
releaseGood: ReleaseGood
|
|
14
48
|
description: String
|
|
15
49
|
creator: User
|
|
16
50
|
updater: User
|
|
@@ -2,13 +2,47 @@ import gql from 'graphql-tag'
|
|
|
2
2
|
|
|
3
3
|
export const NewInvoice = gql`
|
|
4
4
|
input NewInvoice {
|
|
5
|
-
name: String
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
name: String
|
|
6
|
+
refNo1: String
|
|
7
|
+
refNo2: String
|
|
8
|
+
refNo3: String
|
|
9
|
+
issuedOn: String
|
|
10
|
+
contactPointRefId: String
|
|
11
|
+
from: String
|
|
12
|
+
fromContactPhone: String
|
|
13
|
+
fromAddress1: String
|
|
14
|
+
fromAddress2: String
|
|
15
|
+
fromAddress3: String
|
|
16
|
+
fromAddress4: String
|
|
17
|
+
fromAddress5: String
|
|
18
|
+
fromPostcode: String
|
|
19
|
+
fromCity: String
|
|
20
|
+
fromState: String
|
|
21
|
+
fromCountry: String
|
|
22
|
+
deliverTo: String
|
|
23
|
+
deliverToPhone: String
|
|
24
|
+
deliveryAddress1: String
|
|
25
|
+
deliveryAddress2: String
|
|
26
|
+
deliveryAddress3: String
|
|
27
|
+
deliveryAddress4: String
|
|
28
|
+
deliveryAddress5: String
|
|
29
|
+
deliveryCity: String
|
|
30
|
+
deliveryState: String
|
|
31
|
+
deliveryCountry: String
|
|
32
|
+
deliveryPostcode: String
|
|
33
|
+
billTo: String
|
|
34
|
+
billToPhone: String
|
|
35
|
+
billingAddress1: String
|
|
36
|
+
billingAddress2: String
|
|
37
|
+
billingAddress3: String
|
|
38
|
+
billingAddress4: String
|
|
39
|
+
billingAddress5: String
|
|
40
|
+
billingPostcode: String
|
|
41
|
+
billingCity: String
|
|
42
|
+
billingState: String
|
|
43
|
+
billingCountry: String
|
|
44
|
+
paymentDue: String
|
|
45
|
+
invoiceProducts: [NewInvoiceProduct]
|
|
46
|
+
releaseGood: ObjectRef
|
|
13
47
|
}
|
|
14
48
|
`
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { InvoiceProduct } from './invoice-product'
|
|
2
|
+
import { InvoiceProductList } from './invoice-product-list'
|
|
3
|
+
import { InvoiceProductPatch } from './invoice-product-patch'
|
|
4
|
+
import { NewInvoiceProduct } from './new-invoice-product'
|
|
5
|
+
import { ProductInput } from './product-input'
|
|
6
|
+
|
|
7
|
+
export const Mutation = `
|
|
8
|
+
createInvoiceProduct (invoiceProduct: NewInvoiceProduct!): InvoiceProduct
|
|
9
|
+
updateInvoiceProduct (name: String! patch: InvoiceProductPatch!): InvoiceProduct
|
|
10
|
+
updateMultipleInvoiceProduct (patches: [InvoiceProductPatch]!): [InvoiceProduct]
|
|
11
|
+
deleteInvoiceProduct (name: String!): Boolean
|
|
12
|
+
deleteInvoiceProducts (names: [String]!): Boolean
|
|
13
|
+
`
|
|
14
|
+
|
|
15
|
+
export const Query = `
|
|
16
|
+
invoiceProducts(filters: [Filter], pagination: Pagination, sortings: [Sorting]): InvoiceProductList
|
|
17
|
+
invoiceProduct(name: String!): InvoiceProduct
|
|
18
|
+
`
|
|
19
|
+
|
|
20
|
+
export const Types = [InvoiceProduct, NewInvoiceProduct, InvoiceProductPatch, InvoiceProductList, ProductInput]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import gql from 'graphql-tag'
|
|
2
|
+
|
|
3
|
+
export const InvoiceProductPatch = gql`
|
|
4
|
+
input InvoiceProductPatch {
|
|
5
|
+
id: String
|
|
6
|
+
name: String
|
|
7
|
+
description: String
|
|
8
|
+
invoice: ObjectRef
|
|
9
|
+
product: ObjectRef
|
|
10
|
+
qty: Int
|
|
11
|
+
otherCharges: Float
|
|
12
|
+
unitPrice: Float
|
|
13
|
+
paidPrice: Float
|
|
14
|
+
}
|
|
15
|
+
`
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import gql from 'graphql-tag'
|
|
2
|
+
|
|
3
|
+
export const InvoiceProduct = gql`
|
|
4
|
+
type InvoiceProduct {
|
|
5
|
+
id: String
|
|
6
|
+
sku: String
|
|
7
|
+
name: String
|
|
8
|
+
domain: Domain
|
|
9
|
+
description: String
|
|
10
|
+
invoice: Invoice
|
|
11
|
+
product: Product
|
|
12
|
+
qty: Int
|
|
13
|
+
otherCharges: Float
|
|
14
|
+
unitPrice: Float
|
|
15
|
+
paidPrice: Float
|
|
16
|
+
updater: User
|
|
17
|
+
creator: User
|
|
18
|
+
updatedAt: String
|
|
19
|
+
createdAt: String
|
|
20
|
+
}
|
|
21
|
+
`
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import gql from 'graphql-tag'
|
|
2
|
+
|
|
3
|
+
export const NewInvoiceProduct = gql`
|
|
4
|
+
input NewInvoiceProduct {
|
|
5
|
+
sku: String
|
|
6
|
+
name: String!
|
|
7
|
+
description: String
|
|
8
|
+
invoice: ObjectRef
|
|
9
|
+
product: ProductInput
|
|
10
|
+
qty: Int
|
|
11
|
+
otherCharges: Float
|
|
12
|
+
unitPrice: Float
|
|
13
|
+
paidPrice: Float
|
|
14
|
+
}
|
|
15
|
+
`
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import gql from 'graphql-tag'
|
|
2
|
-
|
|
3
1
|
import { NewPurchaseOrder } from './new-purchase-order'
|
|
4
2
|
import { PurchaseOrder } from './purchase-order'
|
|
5
3
|
import { PurchaseOrderList } from './purchase-order-list'
|
|
6
4
|
import { PurchaseOrderPatch } from './purchase-order-patch'
|
|
7
5
|
|
|
8
|
-
|
|
9
6
|
export const Mutation = `
|
|
10
7
|
upsertPurchaseOrder (
|
|
11
8
|
purchaseOrder: PurchaseOrderPatch!
|
|
12
|
-
|
|
9
|
+
files: [Upload!]
|
|
13
10
|
): PurchaseOrder @privilege(category: "order_customer", privilege: "mutation") @transaction
|
|
14
11
|
|
|
15
12
|
approvePurchaseOrder (
|
|
@@ -58,6 +58,10 @@ export class OrderNoGenerator {
|
|
|
58
58
|
return `OP-${uuid()}`
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
+
static invoiceProduct() {
|
|
62
|
+
return `IP-${uuid()}`
|
|
63
|
+
}
|
|
64
|
+
|
|
61
65
|
static orderVas() {
|
|
62
66
|
return `OV-${uuid()}`
|
|
63
67
|
}
|
|
@@ -121,4 +125,11 @@ export class OrderNoGenerator {
|
|
|
121
125
|
currentDate.getMonth() + 1
|
|
122
126
|
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
123
127
|
}
|
|
128
|
+
|
|
129
|
+
static invoice() {
|
|
130
|
+
const currentDate = new Date()
|
|
131
|
+
return `INV-${currentDate.getFullYear()}${
|
|
132
|
+
currentDate.getMonth() + 1
|
|
133
|
+
}${currentDate.getDate()}${currentDate.getHours()}${currentDate.getMinutes()}${currentDate.getSeconds()}${currentDate.getMilliseconds()}`
|
|
134
|
+
}
|
|
124
135
|
}
|