first commit

This commit is contained in:
Isuru Bimsara
2026-08-14 22:46:02 +05:30
commit 81d0e65686
132 changed files with 24398 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
/**
* Copyright (c) 2026 Niolla
* All rights reserved.
*
* This source code is proprietary and confidential.
* Unauthorized copying, modification, distribution, or use
* of this file, via any medium, is strictly prohibited.
*/
// app/utils/id/confirmOrder.util.js
const { nextSequence, pad } = require("../referenceNumber.util");
const { sequelize } = require("../../models");
const generateOrderNumber = async () => {
const now = new Date();
const yy = String(now.getFullYear()).slice(-2);
const mm = String(now.getMonth() + 1).padStart(2, "0");
const period = `${yy}${mm}`;
const sequenceKey = `ORD-${period}`;
return await sequelize.transaction(async (transaction) => {
const nextNo = await nextSequence(sequenceKey, transaction);
return `OSC/${period}/${pad(nextNo)}`;
});
};
module.exports = { generateOrderNumber };
+26
View File
@@ -0,0 +1,26 @@
/**
* Copyright (c) 2026 Niolla
* All rights reserved.
*
* This source code is proprietary and confidential.
* Unauthorized copying, modification, distribution, or use
* of this file, via any medium, is strictly prohibited.
*/
// app/utils/id/dispatchNote.util.js
const { nextSequence, pad } = require("../referenceNumber.util");
const { sequelize } = require("../../models");
const generateDeliveryNote = async (orderNo) => {
const sequenceKey = `DN-${orderNo}`;
return await sequelize.transaction(async (transaction) => {
const nextNo = await nextSequence(sequenceKey, transaction);
return `DN/${orderNo}/${String(nextNo).padStart(2, "0")}`;
});
};
module.exports = { generateDeliveryNote };
+29
View File
@@ -0,0 +1,29 @@
/**
* Copyright (c) 2026 Niolla
* All rights reserved.
*
* This source code is proprietary and confidential.
* Unauthorized copying, modification, distribution, or use
* of this file, via any medium, is strictly prohibited.
*/
// app/utils/id/inquiry.util.js
const { nextSequence, pad } = require("../referenceNumber.util");
const { sequelize } = require("../../models");
const {log} = require("../consoleLog.utill");
const generateInquiryNumber = async (port) => {
const year = new Date().getFullYear();
const sequenceKey = `INQ-${year}-${port}`;
return await sequelize.transaction(async (transaction) => {
const nextNo = await nextSequence(sequenceKey, transaction);
log(`Generated inquiry number: OSC/INQ/${year}/${port}/${pad(nextNo)}`);
return `OSC/INQ/${year}/${port}/${pad(nextNo)}`;
});
};
module.exports = { generateInquiryNumber };
+25
View File
@@ -0,0 +1,25 @@
/**
* Copyright (c) 2026 Niolla
* All rights reserved.
*
* This source code is proprietary and confidential.
* Unauthorized copying, modification, distribution, or use
* of this file, via any medium, is strictly prohibited.
*/
// app/utils/id/po.util.js
const { nextSequence, pad } = require("../referenceNumber.util");
const { sequelize } = require("../../models");
const generatePONumber = async (orderNo) => {
const sequenceKey = `PO-${orderNo}`;
return await sequelize.transaction(async (transaction) => {
const nextVendor = await nextSequence(sequenceKey, transaction);
return `PO/${orderNo}/V${String(nextVendor).padStart(2, "0")}`;
});
};
module.exports = { generatePONumber };
+32
View File
@@ -0,0 +1,32 @@
/**
* Copyright (c) 2026 Niolla
* All rights reserved.
*
* This source code is proprietary and confidential.
* Unauthorized copying, modification, distribution, or use
* of this file, via any medium, is strictly prohibited.
*/
// app/utils/id/quotation.util.js
const { nextSequence, pad } = require("../referenceNumber.util");
const { sequelize } = require("../../models");
const generateRFQNumber = async () => {
const now = new Date();
const yy = String(now.getFullYear()).slice(-2);
const mm = String(now.getMonth() + 1).padStart(2, "0");
const period = `${yy}${mm}`;
const sequenceKey = `RFQ-${period}`;
return await sequelize.transaction(async (transaction) => {
const nextNo = await nextSequence(sequenceKey, transaction);
return `RFQ/OSC/${period}/${pad(nextNo)}`;
});
};
module.exports = { generateRFQNumber };