@things-factory/worksheet-base 4.2.0 → 4.2.3
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/constants/template.js +1 -0
- package/dist-server/constants/template.js.map +1 -1
- package/dist-server/controllers/index.js +1 -0
- package/dist-server/controllers/index.js.map +1 -1
- package/dist-server/controllers/render-po.js +147 -0
- package/dist-server/controllers/render-po.js.map +1 -0
- package/dist-server/routes.js +8 -0
- package/dist-server/routes.js.map +1 -1
- package/package.json +7 -7
- package/server/constants/template.ts +1 -0
- package/server/controllers/index.ts +2 -0
- package/server/controllers/render-po.ts +170 -0
- package/server/routes.ts +12 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../server/constants/template.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG;IAC3B,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,aAAa;IAC1B,YAAY,EAAE,cAAc;IAC5B,YAAY,EAAE,cAAc;IAC5B,iBAAiB,EAAE,mBAAmB;IACtC,gBAAgB,EAAE,kBAAkB;IACpC,GAAG,EAAE,KAAK;IACV,SAAS,EAAE,WAAW;IACtB,IAAI,EAAE,MAAM;CACb,CAAA"}
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../server/constants/template.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG;IAC3B,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,aAAa;IAC1B,YAAY,EAAE,cAAc;IAC5B,YAAY,EAAE,cAAc;IAC5B,iBAAiB,EAAE,mBAAmB;IACtC,gBAAgB,EAAE,kBAAkB;IACpC,WAAW,EAAC,aAAa;IACzB,GAAG,EAAE,KAAK;IACV,SAAS,EAAE,WAAW;IACtB,IAAI,EAAE,MAAM;CACb,CAAA"}
|
|
@@ -20,6 +20,7 @@ __exportStar(require("./render-orientage-grn"), exports);
|
|
|
20
20
|
__exportStar(require("./render-orientage-do"), exports);
|
|
21
21
|
__exportStar(require("./render-seebuu-grn"), exports);
|
|
22
22
|
__exportStar(require("./render-manifest"), exports);
|
|
23
|
+
__exportStar(require("./render-po"), exports);
|
|
23
24
|
/* Worksheet Controllers */
|
|
24
25
|
__exportStar(require("./worksheet-controller"), exports);
|
|
25
26
|
__exportStar(require("./ecommerce"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/controllers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAA8B;AAC9B,+CAA4B;AAC5B,qDAAkC;AAClC,qDAAkC;AAClC,qDAAkC;AAClC,sDAAmC;AACnC,yDAAsC;AACtC,wDAAqC;AACrC,sDAAmC;AACnC,oDAAiC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/controllers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAA8B;AAC9B,+CAA4B;AAC5B,qDAAkC;AAClC,qDAAkC;AAClC,qDAAkC;AAClC,sDAAmC;AACnC,yDAAsC;AACtC,wDAAqC;AACrC,sDAAmC;AACnC,oDAAiC;AACjC,8CAA2B;AAG3B,2BAA2B;AAC3B,yDAAsC;AACtC,8CAA2B;AAC3B,4CAAyB;AACzB,4CAAyB;AACzB,6CAA0B;AAC1B,wCAAqB"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.renderPO = void 0;
|
|
7
|
+
const form_data_1 = __importDefault(require("form-data"));
|
|
8
|
+
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
9
|
+
const typeorm_1 = require("typeorm");
|
|
10
|
+
const attachment_base_1 = require("@things-factory/attachment-base");
|
|
11
|
+
const env_1 = require("@things-factory/env");
|
|
12
|
+
const sales_base_1 = require("@things-factory/sales-base");
|
|
13
|
+
const shell_1 = require("@things-factory/shell");
|
|
14
|
+
const constants_1 = require("../constants");
|
|
15
|
+
const datetime_util_1 = require("../utils/datetime-util");
|
|
16
|
+
const REPORT_API_URL = env_1.config.get('reportApiUrl', 'http://localhost:8888/rest/report/show_html');
|
|
17
|
+
async function renderPO({ req, timezoneOffSet }, context) {
|
|
18
|
+
try {
|
|
19
|
+
const domain = await (0, typeorm_1.getRepository)(shell_1.Domain).findOne({
|
|
20
|
+
where: { id: context.state.domain.id }
|
|
21
|
+
});
|
|
22
|
+
let result = await Promise.all(req.poIds.map(async (poId) => {
|
|
23
|
+
try {
|
|
24
|
+
const qb = await (0, typeorm_1.getRepository)(sales_base_1.PurchaseOrder)
|
|
25
|
+
.createQueryBuilder('po')
|
|
26
|
+
.innerJoinAndSelect('po.domain', 'domain')
|
|
27
|
+
.innerJoinAndSelect('po.bizplace', 'bizplace')
|
|
28
|
+
.innerJoinAndSelect('bizplace.domain', 'bizplace_domain')
|
|
29
|
+
.innerJoinAndSelect('bizplace.company', 'company')
|
|
30
|
+
.innerJoinAndSelect('company.domain', 'company_domain')
|
|
31
|
+
.leftJoinAndSelect('contact_points', 'cp', 'po.supplier_id = cp.id')
|
|
32
|
+
.where('po.id = :poId')
|
|
33
|
+
.andWhere('po.domain = :domainId')
|
|
34
|
+
.setParameters({ poId, domainId: domain.id });
|
|
35
|
+
let record = await qb.getRawOne();
|
|
36
|
+
if (record) {
|
|
37
|
+
const partnerBiz = {
|
|
38
|
+
id: record.bizplace_id,
|
|
39
|
+
name: record.bizplace_name,
|
|
40
|
+
address: record.bizplace_address,
|
|
41
|
+
domain: { id: record.bizplace_domain_id }
|
|
42
|
+
};
|
|
43
|
+
const foundTemplate = await (0, typeorm_1.getRepository)(attachment_base_1.Attachment).findOne({
|
|
44
|
+
where: { domain: partnerBiz.domain, category: constants_1.TEMPLATE_TYPE.PO_TEMPLATE }
|
|
45
|
+
});
|
|
46
|
+
const foundLogo = await (0, typeorm_1.getRepository)(attachment_base_1.Attachment).findOne({
|
|
47
|
+
where: {
|
|
48
|
+
domain: partnerBiz.domain,
|
|
49
|
+
category: constants_1.TEMPLATE_TYPE.LOGO
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
let logo = null;
|
|
53
|
+
if (foundLogo === null || foundLogo === void 0 ? void 0 : foundLogo.path) {
|
|
54
|
+
logo = 'data:' + foundLogo.mimetype + ';base64,' + (await attachment_base_1.STORAGE.readFile(foundLogo.path, 'base64'));
|
|
55
|
+
}
|
|
56
|
+
const template = await attachment_base_1.STORAGE.readFile(foundTemplate.path, 'utf-8');
|
|
57
|
+
const poocQb = await (0, typeorm_1.getRepository)(sales_base_1.PurchaseOrderOtherCharge)
|
|
58
|
+
.createQueryBuilder('pooc')
|
|
59
|
+
.where('pooc.purchase_order_id = :poId')
|
|
60
|
+
.andWhere('pooc.apply_in_items = false')
|
|
61
|
+
.setParameters({ poId });
|
|
62
|
+
let poOtherCharges = await poocQb.getRawMany();
|
|
63
|
+
const qb = await (0, typeorm_1.getRepository)(sales_base_1.OrderProduct)
|
|
64
|
+
.createQueryBuilder('op')
|
|
65
|
+
.innerJoin('domains', 'd', 'op.domain_id = d.id')
|
|
66
|
+
.leftJoinAndSelect('purchase_orders', 'po', 'po.id = op.purchase_order_id')
|
|
67
|
+
.leftJoinAndSelect('products', 'p', 'op.product_id = p.id')
|
|
68
|
+
.where('op.purchase_order_id = :poId')
|
|
69
|
+
.andWhere('op.domain = :domainId')
|
|
70
|
+
.setParameters({ poId, domainId: domain.id });
|
|
71
|
+
let items = await qb.getRawMany();
|
|
72
|
+
const product_list = items.map((item, idx) => {
|
|
73
|
+
return {
|
|
74
|
+
list_no: idx + 1,
|
|
75
|
+
product_sku: item.p_sku,
|
|
76
|
+
product_name: item.p_name,
|
|
77
|
+
product_desc: item.p_description,
|
|
78
|
+
product_qty: item.op_pack_qty,
|
|
79
|
+
product_uom: item.op_uom,
|
|
80
|
+
product_other_charges: item.ip_other_charges,
|
|
81
|
+
product_unit_price: (item.op_unit_price).toFixed(2),
|
|
82
|
+
product_total_price: ((((item.op_unit_price || 0) * item.op_pack_qty) - (item.op_discount_amt || 0)) * (1 + (item.op_tax_rate / 100))).toFixed(2),
|
|
83
|
+
product_tax_rate: item.op_tax_rate,
|
|
84
|
+
product_disc_amt: item.op_discount_amt
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
let date = datetime_util_1.DateTimeConverter.date(new Date(record.po_created_at - timezoneOffSet));
|
|
88
|
+
let eta = datetime_util_1.DateTimeConverter.date(new Date(record.po_eta_date));
|
|
89
|
+
let subtotal = getRoundedValue(product_list.reduce((init, item) => {
|
|
90
|
+
return (init += parseFloat(item.product_total_price));
|
|
91
|
+
}, 0) || 0);
|
|
92
|
+
const data = {
|
|
93
|
+
logo_url: logo,
|
|
94
|
+
company_name: record.company_description,
|
|
95
|
+
company_address: record.company_address,
|
|
96
|
+
company_postal_code: record.company_postal_code,
|
|
97
|
+
po_number: record.po_name,
|
|
98
|
+
po_order_date: date,
|
|
99
|
+
po_delivery_date: eta,
|
|
100
|
+
ref_no: record.po_ref_no,
|
|
101
|
+
cp_company_name: record.cp_company_name,
|
|
102
|
+
cp_address: record.cp_address2 ? [record.cp_address, record.cp_address2].join(', ') : record.cp_address,
|
|
103
|
+
cp_contact_name: record.cp_name,
|
|
104
|
+
cp_email: record.cp_email,
|
|
105
|
+
cp_phone_number: record.cp_phone,
|
|
106
|
+
product_list,
|
|
107
|
+
charges_list: [
|
|
108
|
+
{
|
|
109
|
+
field: 'SUBTOTAL', value: subtotal.toFixed(2)
|
|
110
|
+
},
|
|
111
|
+
...poOtherCharges.map(itm => { return { field: itm.pooc_name.toUpperCase(), value: itm.pooc_total_amt.toFixed(2) }; }),
|
|
112
|
+
{
|
|
113
|
+
field: 'TOTAL', value: (poOtherCharges.reduce((init, item) => {
|
|
114
|
+
return init += (item.pooc_total_amt);
|
|
115
|
+
}, subtotal) || 0).toFixed(2),
|
|
116
|
+
},
|
|
117
|
+
]
|
|
118
|
+
};
|
|
119
|
+
const formData = new form_data_1.default();
|
|
120
|
+
formData.append('template', template);
|
|
121
|
+
formData.append('jsonString', JSON.stringify(data));
|
|
122
|
+
const response = await (0, node_fetch_1.default)(REPORT_API_URL, {
|
|
123
|
+
method: 'POST',
|
|
124
|
+
body: formData
|
|
125
|
+
});
|
|
126
|
+
return await response.text();
|
|
127
|
+
}
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
catch (ex) {
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
}));
|
|
134
|
+
if (result.filter(x => x != null).length <= 0) {
|
|
135
|
+
throw Error('No purchase order found!');
|
|
136
|
+
}
|
|
137
|
+
return result.join();
|
|
138
|
+
}
|
|
139
|
+
catch (ex) {
|
|
140
|
+
throw ex;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
exports.renderPO = renderPO;
|
|
144
|
+
function getRoundedValue(value = 0) {
|
|
145
|
+
return Math.round((value + Number.EPSILON) * 100) / 100;
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=render-po.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-po.js","sourceRoot":"","sources":["../../server/controllers/render-po.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAgC;AAChC,4DAA8B;AAC9B,qCAA2D;AAE3D,qEAAqE;AAErE,6CAA4C;AAC5C,2DAA+H;AAE/H,iDAA8C;AAE9C,4CAA4C;AAC5C,0DAA0D;AAE1D,MAAM,cAAc,GAAG,YAAM,CAAC,GAAG,CAAC,cAAc,EAAE,6CAA6C,CAAC,CAAA;AAEzF,KAAK,UAAU,QAAQ,CAAC,EAAE,GAAG,EAAE,cAAc,EAAE,EAAE,OAAY;IAClE,IAAI;QACF,MAAM,MAAM,GAAW,MAAM,IAAA,uBAAa,EAAC,cAAM,CAAC,CAAC,OAAO,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G,GAAG,CAAA;AACzD,CAAC"}
|
package/dist-server/routes.js
CHANGED
|
@@ -11,6 +11,7 @@ const render_orientage_grn_1 = require("./controllers/render-orientage-grn");
|
|
|
11
11
|
const render_ro_do_1 = require("./controllers/render-ro-do");
|
|
12
12
|
const render_seebuu_grn_1 = require("./controllers/render-seebuu-grn");
|
|
13
13
|
const render_invoices_1 = require("./controllers/render-invoices");
|
|
14
|
+
const render_po_1 = require("./controllers/render-po");
|
|
14
15
|
process.on('bootstrap-module-domain-private-route', (app, routes) => {
|
|
15
16
|
routes.get('/view_document_ro_do/:doNo', async (context, next) => {
|
|
16
17
|
context.body = await (0, render_ro_do_1.renderRODO)(context.params, context);
|
|
@@ -49,5 +50,12 @@ process.on('bootstrap-module-domain-private-route', (app, routes) => {
|
|
|
49
50
|
context.type = 'application/json';
|
|
50
51
|
context.body = data;
|
|
51
52
|
});
|
|
53
|
+
routes.post('/view_purchase_orders/:timezoneOffSet', async (context, next) => {
|
|
54
|
+
let req = context.request.body || {};
|
|
55
|
+
let timezoneOffSet = context.params.timezoneOffSet || 0;
|
|
56
|
+
let data = await (0, render_po_1.renderPO)({ req, timezoneOffSet }, context);
|
|
57
|
+
context.type = 'application/json';
|
|
58
|
+
context.body = data;
|
|
59
|
+
});
|
|
52
60
|
});
|
|
53
61
|
//# sourceMappingURL=routes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../server/routes.ts"],"names":[],"mappings":";;AAAA,qEAA+D;AAC/D,yDAAoD;AACpD,qEAA+D;AAC/D,uEAAiE;AACjE,mEAA8D;AAC9D,qEAA+D;AAC/D,2EAAqE;AACrE,6EAAuE;AACvE,6DAAuD;AACvD,uEAAiE;AACjE,mEAA8D;
|
|
1
|
+
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../server/routes.ts"],"names":[],"mappings":";;AAAA,qEAA+D;AAC/D,yDAAoD;AACpD,qEAA+D;AAC/D,uEAAiE;AACjE,mE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cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,IAAI,CAAC,CAAA;QAEvD,IAAI,IAAI,GAAG,MAAM,IAAA,gCAAc,EAAC,EAAE,GAAG,EAAE,cAAc,EAAE,EAAE,OAAO,CAAC,CAAA;QAEjE,OAAO,CAAC,IAAI,GAAG,kBAAkB,CAAA;QACjC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAA;IACrB,CAAC,CAAC,CAAA;IAEF,MAAM,CAAC,IAAI,CAAC,uCAAuC,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QAC3E,IAAI,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAA;QACpC,IAAI,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,IAAI,CAAC,CAAA;QAEvD,IAAI,IAAI,GAAG,MAAM,IAAA,oBAAQ,EAAC,EAAE,GAAG,EAAE,cAAc,EAAE,EAAE,OAAO,CAAC,CAAA;QAE3D,OAAO,CAAC,IAAI,GAAG,kBAAkB,CAAA;QACjC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAA;IACrB,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/worksheet-base",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.3",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -29,16 +29,16 @@
|
|
|
29
29
|
"@things-factory/document-template-base": "^4.1.40",
|
|
30
30
|
"@things-factory/id-rule-base": "^4.2.0",
|
|
31
31
|
"@things-factory/integration-lmd": "^4.1.40",
|
|
32
|
-
"@things-factory/integration-marketplace": "^4.2.
|
|
33
|
-
"@things-factory/integration-sellercraft": "^4.2.
|
|
32
|
+
"@things-factory/integration-marketplace": "^4.2.3",
|
|
33
|
+
"@things-factory/integration-sellercraft": "^4.2.3",
|
|
34
34
|
"@things-factory/integration-sftp": "^4.1.40",
|
|
35
|
-
"@things-factory/marketplace-base": "^4.2.
|
|
35
|
+
"@things-factory/marketplace-base": "^4.2.3",
|
|
36
36
|
"@things-factory/notification": "^4.1.40",
|
|
37
|
-
"@things-factory/sales-base": "^4.2.
|
|
37
|
+
"@things-factory/sales-base": "^4.2.3",
|
|
38
38
|
"@things-factory/setting-base": "^4.1.40",
|
|
39
39
|
"@things-factory/shell": "^4.1.40",
|
|
40
40
|
"@things-factory/transport-base": "^4.2.0",
|
|
41
|
-
"@things-factory/warehouse-base": "^4.2.
|
|
41
|
+
"@things-factory/warehouse-base": "^4.2.3"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "38faf657cf86a08d942c4ada9b36b2f62fb94cce"
|
|
44
44
|
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import FormData from 'form-data'
|
|
2
|
+
import fetch from 'node-fetch'
|
|
3
|
+
import { getRepository, SelectQueryBuilder } from 'typeorm'
|
|
4
|
+
|
|
5
|
+
import { Attachment, STORAGE } from '@things-factory/attachment-base'
|
|
6
|
+
import { Bizplace } from '@things-factory/biz-base'
|
|
7
|
+
import { config } from '@things-factory/env'
|
|
8
|
+
import { InvoiceProduct, ReleaseGood, PurchaseOrder, PurchaseOrderOtherCharge, OrderProduct } from '@things-factory/sales-base'
|
|
9
|
+
|
|
10
|
+
import { Domain } from '@things-factory/shell'
|
|
11
|
+
|
|
12
|
+
import { TEMPLATE_TYPE } from '../constants'
|
|
13
|
+
import { DateTimeConverter } from '../utils/datetime-util'
|
|
14
|
+
|
|
15
|
+
const REPORT_API_URL = config.get('reportApiUrl', 'http://localhost:8888/rest/report/show_html')
|
|
16
|
+
|
|
17
|
+
export async function renderPO({ req, timezoneOffSet }, context: any) {
|
|
18
|
+
try {
|
|
19
|
+
const domain: Domain = await getRepository(Domain).findOne({
|
|
20
|
+
where: { id: context.state.domain.id }
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
let result = await Promise.all(
|
|
24
|
+
req.poIds.map(async poId => {
|
|
25
|
+
try {
|
|
26
|
+
const qb: SelectQueryBuilder<PurchaseOrder> = await getRepository(PurchaseOrder)
|
|
27
|
+
.createQueryBuilder('po')
|
|
28
|
+
.innerJoinAndSelect('po.domain', 'domain')
|
|
29
|
+
.innerJoinAndSelect('po.bizplace', 'bizplace')
|
|
30
|
+
.innerJoinAndSelect('bizplace.domain', 'bizplace_domain')
|
|
31
|
+
.innerJoinAndSelect('bizplace.company', 'company')
|
|
32
|
+
.innerJoinAndSelect('company.domain', 'company_domain')
|
|
33
|
+
.leftJoinAndSelect('contact_points', 'cp', 'po.supplier_id = cp.id')
|
|
34
|
+
.where('po.id = :poId')
|
|
35
|
+
.andWhere('po.domain = :domainId')
|
|
36
|
+
.setParameters({ poId, domainId: domain.id })
|
|
37
|
+
|
|
38
|
+
let record: any = await qb.getRawOne()
|
|
39
|
+
|
|
40
|
+
if (record) {
|
|
41
|
+
const partnerBiz: Partial<Bizplace> = {
|
|
42
|
+
id: record.bizplace_id,
|
|
43
|
+
name: record.bizplace_name,
|
|
44
|
+
address: record.bizplace_address,
|
|
45
|
+
domain: { id: record.bizplace_domain_id }
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const foundTemplate: Attachment = await getRepository(Attachment).findOne({
|
|
49
|
+
where: { domain: partnerBiz.domain, category: TEMPLATE_TYPE.PO_TEMPLATE }
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
const foundLogo: Attachment = await getRepository(Attachment).findOne({
|
|
53
|
+
where: {
|
|
54
|
+
domain: partnerBiz.domain,
|
|
55
|
+
category: TEMPLATE_TYPE.LOGO
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
let logo = null
|
|
60
|
+
if (foundLogo?.path) {
|
|
61
|
+
logo = 'data:' + foundLogo.mimetype + ';base64,' + (await STORAGE.readFile(foundLogo.path, 'base64'))
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const template = await STORAGE.readFile(foundTemplate.path, 'utf-8')
|
|
65
|
+
|
|
66
|
+
const poocQb: SelectQueryBuilder<PurchaseOrderOtherCharge> = await getRepository(PurchaseOrderOtherCharge)
|
|
67
|
+
.createQueryBuilder('pooc')
|
|
68
|
+
.where('pooc.purchase_order_id = :poId')
|
|
69
|
+
.andWhere('pooc.apply_in_items = false')
|
|
70
|
+
.setParameters({ poId })
|
|
71
|
+
|
|
72
|
+
let poOtherCharges: any[] = await poocQb.getRawMany()
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
const qb: SelectQueryBuilder<OrderProduct> = await getRepository(OrderProduct)
|
|
76
|
+
.createQueryBuilder('op')
|
|
77
|
+
.innerJoin('domains', 'd', 'op.domain_id = d.id')
|
|
78
|
+
.leftJoinAndSelect('purchase_orders', 'po', 'po.id = op.purchase_order_id')
|
|
79
|
+
.leftJoinAndSelect('products', 'p', 'op.product_id = p.id')
|
|
80
|
+
.where('op.purchase_order_id = :poId')
|
|
81
|
+
.andWhere('op.domain = :domainId')
|
|
82
|
+
.setParameters({ poId, domainId: domain.id })
|
|
83
|
+
|
|
84
|
+
let items: any[] = await qb.getRawMany()
|
|
85
|
+
|
|
86
|
+
const product_list = items.map((item, idx) => {
|
|
87
|
+
return {
|
|
88
|
+
list_no: idx + 1,
|
|
89
|
+
product_sku: item.p_sku,
|
|
90
|
+
product_name: item.p_name,
|
|
91
|
+
product_desc: item.p_description,
|
|
92
|
+
product_qty: item.op_pack_qty,
|
|
93
|
+
product_uom: item.op_uom,
|
|
94
|
+
product_other_charges: item.ip_other_charges,
|
|
95
|
+
product_unit_price: (item.op_unit_price).toFixed(2),
|
|
96
|
+
product_total_price: ((((item.op_unit_price || 0) * item.op_pack_qty) - (item.op_discount_amt || 0)) * (1 + (item.op_tax_rate / 100))).toFixed(2),
|
|
97
|
+
product_tax_rate: item.op_tax_rate,
|
|
98
|
+
product_disc_amt: item.op_discount_amt
|
|
99
|
+
}
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
let date = DateTimeConverter.date(new Date(record.po_created_at - timezoneOffSet))
|
|
104
|
+
let eta = DateTimeConverter.date(new Date(record.po_eta_date))
|
|
105
|
+
|
|
106
|
+
let subtotal = getRoundedValue(
|
|
107
|
+
product_list.reduce((init, item) => {
|
|
108
|
+
return (init += parseFloat(item.product_total_price))
|
|
109
|
+
}, 0) || 0
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
const data = {
|
|
113
|
+
logo_url: logo,
|
|
114
|
+
company_name: record.company_description,
|
|
115
|
+
company_address: record.company_address,
|
|
116
|
+
company_postal_code: record.company_postal_code,
|
|
117
|
+
po_number: record.po_name,
|
|
118
|
+
po_order_date: date,
|
|
119
|
+
po_delivery_date: eta,
|
|
120
|
+
ref_no: record.po_ref_no,
|
|
121
|
+
cp_company_name: record.cp_company_name,
|
|
122
|
+
cp_address: record.cp_address2 ? [record.cp_address, record.cp_address2].join(', ') : record.cp_address,
|
|
123
|
+
cp_contact_name: record.cp_name,
|
|
124
|
+
cp_email: record.cp_email,
|
|
125
|
+
cp_phone_number: record.cp_phone,
|
|
126
|
+
product_list,
|
|
127
|
+
charges_list: [
|
|
128
|
+
{
|
|
129
|
+
field: 'SUBTOTAL', value: subtotal.toFixed(2)
|
|
130
|
+
},
|
|
131
|
+
...poOtherCharges.map(itm => { return { field: itm.pooc_name.toUpperCase(), value: itm.pooc_total_amt.toFixed(2) } }),
|
|
132
|
+
{
|
|
133
|
+
field: 'TOTAL', value: (poOtherCharges.reduce((init, item) => {
|
|
134
|
+
return init += (item.pooc_total_amt)
|
|
135
|
+
}, subtotal) || 0).toFixed(2),
|
|
136
|
+
},
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const formData = new FormData()
|
|
141
|
+
formData.append('template', template)
|
|
142
|
+
formData.append('jsonString', JSON.stringify(data))
|
|
143
|
+
|
|
144
|
+
const response = await fetch(REPORT_API_URL, {
|
|
145
|
+
method: 'POST',
|
|
146
|
+
body: formData
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
return await response.text()
|
|
150
|
+
}
|
|
151
|
+
return null
|
|
152
|
+
} catch (ex) {
|
|
153
|
+
return null
|
|
154
|
+
}
|
|
155
|
+
})
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
if (result.filter(x => x != null).length <= 0) {
|
|
159
|
+
throw Error('No purchase order found!')
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return result.join()
|
|
163
|
+
} catch (ex) {
|
|
164
|
+
throw ex
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function getRoundedValue(value = 0) {
|
|
169
|
+
return Math.round((value + Number.EPSILON) * 100) / 100
|
|
170
|
+
}
|
package/server/routes.ts
CHANGED
|
@@ -9,6 +9,8 @@ import { renderOrientageGRN } from './controllers/render-orientage-grn'
|
|
|
9
9
|
import { renderRODO } from './controllers/render-ro-do'
|
|
10
10
|
import { renderSeebuuGRN } from './controllers/render-seebuu-grn'
|
|
11
11
|
import { renderInvoices } from './controllers/render-invoices'
|
|
12
|
+
import { renderPO } from './controllers/render-po'
|
|
13
|
+
|
|
12
14
|
|
|
13
15
|
process.on('bootstrap-module-domain-private-route' as any, (app, routes) => {
|
|
14
16
|
routes.get('/view_document_ro_do/:doNo', async (context, next) => {
|
|
@@ -60,4 +62,14 @@ process.on('bootstrap-module-domain-private-route' as any, (app, routes) => {
|
|
|
60
62
|
context.type = 'application/json'
|
|
61
63
|
context.body = data
|
|
62
64
|
})
|
|
65
|
+
|
|
66
|
+
routes.post('/view_purchase_orders/:timezoneOffSet', async (context, next) => {
|
|
67
|
+
let req = context.request.body || {}
|
|
68
|
+
let timezoneOffSet = context.params.timezoneOffSet || 0
|
|
69
|
+
|
|
70
|
+
let data = await renderPO({ req, timezoneOffSet }, context)
|
|
71
|
+
|
|
72
|
+
context.type = 'application/json'
|
|
73
|
+
context.body = data
|
|
74
|
+
})
|
|
63
75
|
})
|