jp-shared 1.1.16 → 1.1.18
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.
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const { salesModel } = require("./sales-model");
|
|
2
|
+
|
|
1
3
|
module.exports = {
|
|
2
4
|
ActiveRecruiterModel: require("./active-model"),
|
|
3
5
|
PendingRecruiterModel: require("./pending-model"),
|
|
@@ -7,5 +9,6 @@ module.exports = {
|
|
|
7
9
|
RequestRecruiterModel: require("./request-model"),
|
|
8
10
|
VerificationRecruiterModel: require("./verification-model"),
|
|
9
11
|
RecruiterMobileOTPModel: require("./mobileOTP-model"),
|
|
12
|
+
SalesModel : require("./sales-model"),
|
|
10
13
|
RecruiterEmailOTPModel: require("./emailOTP-model")
|
|
11
14
|
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const mongoose = require("mongoose");
|
|
2
|
+
const { getDatabaseName } = require("../../constants");
|
|
3
|
+
|
|
4
|
+
const schema = new mongoose.Schema({
|
|
5
|
+
lookingFor: {
|
|
6
|
+
type: String,
|
|
7
|
+
required: true
|
|
8
|
+
},
|
|
9
|
+
name:{
|
|
10
|
+
type: String,
|
|
11
|
+
required: true
|
|
12
|
+
},
|
|
13
|
+
contactNumber:{
|
|
14
|
+
type: Number,
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
companyName:{
|
|
18
|
+
type: String,
|
|
19
|
+
required: true
|
|
20
|
+
},
|
|
21
|
+
designation:{
|
|
22
|
+
type: String,
|
|
23
|
+
required: true
|
|
24
|
+
},
|
|
25
|
+
email:{
|
|
26
|
+
type: String,
|
|
27
|
+
required: true
|
|
28
|
+
},
|
|
29
|
+
city:{
|
|
30
|
+
type: String,
|
|
31
|
+
required: true
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
const myDB = mongoose.connection.useDb(getDatabaseName());
|
|
36
|
+
|
|
37
|
+
const SalesModel = myDB.model("sales", schema);
|
|
38
|
+
|
|
39
|
+
module.exports = { SalesModel };
|
package/package.json
CHANGED
package/utils/invoiceTemplate.js
CHANGED
|
@@ -6,7 +6,7 @@ module.exports.invoiceEmailTemplate = ({
|
|
|
6
6
|
totalAmount = "470.82",
|
|
7
7
|
totalAmountWords = "Four Hundred Seventy Rupees and Eighty-Two Paise Only",
|
|
8
8
|
gstPercentage = "18",
|
|
9
|
-
gstAmount ,
|
|
9
|
+
gstAmount = "6",
|
|
10
10
|
companyAddress,
|
|
11
11
|
companyName,
|
|
12
12
|
gstNumber,
|
|
@@ -14,7 +14,6 @@ module.exports.invoiceEmailTemplate = ({
|
|
|
14
14
|
supportEmail,
|
|
15
15
|
supportMobile,
|
|
16
16
|
termsUrl,
|
|
17
|
-
|
|
18
17
|
}) => {
|
|
19
18
|
return `
|
|
20
19
|
<!DOCTYPE html>
|
|
@@ -78,7 +77,7 @@ module.exports.invoiceEmailTemplate = ({
|
|
|
78
77
|
item.description
|
|
79
78
|
}</td>
|
|
80
79
|
<td style="border: 1px solid #000; padding: 10px; text-align: center;">${
|
|
81
|
-
item.amount
|
|
80
|
+
Number(item.amount).toFixed(2)
|
|
82
81
|
}</td>
|
|
83
82
|
</tr>`
|
|
84
83
|
)
|
|
@@ -89,9 +88,7 @@ module.exports.invoiceEmailTemplate = ({
|
|
|
89
88
|
</tr>
|
|
90
89
|
<tr>
|
|
91
90
|
<td colspan="2" style="text-align: right; border: 1px solid #000; padding: 10px;"><strong>Total Amount</strong></td>
|
|
92
|
-
<td style="border: 1px solid #000; padding: 10px; text-align: center;"><strong>${
|
|
93
|
-
Number(totalAmount).toFixed(2)
|
|
94
|
-
}</strong></td>
|
|
91
|
+
<td style="border: 1px solid #000; padding: 10px; text-align: center;"><strong>${totalAmount}</strong></td>
|
|
95
92
|
</tr>
|
|
96
93
|
</tbody>
|
|
97
94
|
</table>
|
|
@@ -53,17 +53,15 @@ const sendInvoice = async (invoiceInput) => {
|
|
|
53
53
|
// Destructure the validated value
|
|
54
54
|
const {
|
|
55
55
|
recruiterEmail,
|
|
56
|
-
|
|
56
|
+
gstAmount,
|
|
57
|
+
totalAmount,
|
|
57
58
|
amount,
|
|
59
|
+
gstPercentage,
|
|
58
60
|
billNumber,
|
|
59
61
|
jobId,
|
|
60
62
|
planName,
|
|
61
63
|
} = value;
|
|
62
64
|
|
|
63
|
-
// Calculate GST and total amount
|
|
64
|
-
const gstAmount = parseFloat(((amount * gstPercentage) / 100).toFixed(2));
|
|
65
|
-
const totalAmount = parseFloat((amount + gstAmount).toFixed(2));
|
|
66
|
-
|
|
67
65
|
// Check if the required environment variables are set
|
|
68
66
|
if (!process.env.EMAIL || !process.env.EMAIL_PASSWORD) {
|
|
69
67
|
const errorMsg = "Email credentials are not set in environment variables.";
|
|
@@ -82,10 +80,10 @@ const totalAmount = parseFloat((amount + gstAmount).toFixed(2));
|
|
|
82
80
|
billNo: billNumber,
|
|
83
81
|
jobId,
|
|
84
82
|
items: [{ description: `${planName}`, amount: `${amount}` }],
|
|
85
|
-
totalAmount
|
|
83
|
+
totalAmount,
|
|
86
84
|
totalAmountWords: toWords.convert(totalAmount, { currency: true }),
|
|
87
85
|
gstPercentage,
|
|
88
|
-
gstAmount
|
|
86
|
+
gstAmount,
|
|
89
87
|
...OUR_ORG_INFO,
|
|
90
88
|
};
|
|
91
89
|
|