@react-pakistan/util-functions 1.24.19 → 1.24.21
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.
|
@@ -148,7 +148,11 @@ var postQuoteInvoice = function (_a) { return __awaiter(void 0, [_a], void 0, fu
|
|
|
148
148
|
}
|
|
149
149
|
if (!(customerId || companyId)) return [3 /*break*/, 3];
|
|
150
150
|
return [4 /*yield*/, prisma.quoteInvoice.create({
|
|
151
|
-
data: __assign({ category: category
|
|
151
|
+
data: __assign(__assign(__assign(__assign(__assign({ category: category }, (companyId && {
|
|
152
|
+
companyId: companyId,
|
|
153
|
+
})), { currency: currency }), (customerId && {
|
|
154
|
+
customerId: customerId,
|
|
155
|
+
})), { date: date, discount: discount, discountUnit: discountUnit, expiryDate: expiryDate, invoiceStatus: invoiceStatus, note: note, quoteStatus: quoteStatus, ref: ref, subTotal: subTotal, taxValue: taxValue, total: total }), (mappedServices && {
|
|
152
156
|
services: {
|
|
153
157
|
createMany: {
|
|
154
158
|
data: mappedServices,
|
|
@@ -183,23 +187,11 @@ var postQuoteInvoice = function (_a) { return __awaiter(void 0, [_a], void 0, fu
|
|
|
183
187
|
_e.sent();
|
|
184
188
|
return [3 /*break*/, 5];
|
|
185
189
|
case 3: return [4 /*yield*/, prisma.quoteInvoice.create({
|
|
186
|
-
data: {
|
|
187
|
-
category: category,
|
|
190
|
+
data: __assign(__assign(__assign(__assign({ category: category }, (companyId && {
|
|
188
191
|
companyId: companyId,
|
|
189
|
-
|
|
192
|
+
})), { currency: currency }), (customerId && {
|
|
190
193
|
customerId: customerId,
|
|
191
|
-
|
|
192
|
-
discount: discount,
|
|
193
|
-
discountUnit: discountUnit,
|
|
194
|
-
expiryDate: expiryDate,
|
|
195
|
-
invoiceStatus: invoiceStatus,
|
|
196
|
-
note: note,
|
|
197
|
-
quoteStatus: quoteStatus,
|
|
198
|
-
ref: ref,
|
|
199
|
-
subTotal: subTotal,
|
|
200
|
-
taxValue: taxValue,
|
|
201
|
-
total: total,
|
|
202
|
-
customer: {
|
|
194
|
+
})), { date: date, discount: discount, discountUnit: discountUnit, expiryDate: expiryDate, invoiceStatus: invoiceStatus, note: note, quoteStatus: quoteStatus, ref: ref, subTotal: subTotal, taxValue: taxValue, total: total, customer: {
|
|
203
195
|
create: {
|
|
204
196
|
address: address,
|
|
205
197
|
city: city,
|
|
@@ -209,13 +201,11 @@ var postQuoteInvoice = function (_a) { return __awaiter(void 0, [_a], void 0, fu
|
|
|
209
201
|
lastName: lastName,
|
|
210
202
|
phone: phone,
|
|
211
203
|
},
|
|
212
|
-
},
|
|
213
|
-
services: {
|
|
204
|
+
}, services: {
|
|
214
205
|
createMany: {
|
|
215
206
|
data: mappedServices,
|
|
216
207
|
},
|
|
217
|
-
},
|
|
218
|
-
},
|
|
208
|
+
} }),
|
|
219
209
|
})];
|
|
220
210
|
case 4:
|
|
221
211
|
quoteInvoice = _e.sent();
|
package/general/generate-ref.js
CHANGED
|
@@ -5,7 +5,7 @@ var uuid_1 = require("uuid");
|
|
|
5
5
|
var constants_1 = require("../constants");
|
|
6
6
|
var generateRef = function (_a) {
|
|
7
7
|
var _b = _a.refLength, refLength = _b === void 0 ? 5 : _b;
|
|
8
|
-
var ref = (0, uuid_1.v4)().slice(0, refLength);
|
|
8
|
+
var ref = (0, uuid_1.v4)().toUpperCase().slice(0, refLength);
|
|
9
9
|
var currentYear = new Date().getFullYear().toString().slice(-2);
|
|
10
10
|
return "".concat(ref).concat(constants_1.VALUE_DELIMITER.SLASH).concat(currentYear);
|
|
11
11
|
};
|