Spaces:
Sleeping
Sleeping
Commit
·
c280f45
1
Parent(s):
b193519
add: new styles
Browse files
script.js
CHANGED
@@ -111,26 +111,121 @@ if (typeof document !== 'undefined') {
|
|
111 |
const paisePart = Math.round((total - rupeePart) * 100);
|
112 |
const rupeeWords = numberToWords(rupeePart);
|
113 |
const paiseWords = paisePart > 0 ? numberToWords(paisePart) : '';
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
html
|
118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
items.forEach((item, idx) => {
|
120 |
-
html +=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
});
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
html +=
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
134 |
output.innerHTML = html;
|
135 |
output.style.display = 'block';
|
136 |
document.getElementById('form-container').style.display = 'none';
|
|
|
111 |
const paisePart = Math.round((total - rupeePart) * 100);
|
112 |
const rupeeWords = numberToWords(rupeePart);
|
113 |
const paiseWords = paisePart > 0 ? numberToWords(paisePart) : '';
|
114 |
+
const rOff = 0; // Or get from a form field if you add one
|
115 |
+
const finalTotal = total - rOff;
|
116 |
+
|
117 |
+
let html = `
|
118 |
+
<div class="quotation-print">
|
119 |
+
<div class="header">
|
120 |
+
<div class="company-details">
|
121 |
+
<strong>${company.name}</strong><br>
|
122 |
+
{{address}}<br>
|
123 |
+
GST NO. : <br>
|
124 |
+
CONTACT NO : ${company.phone}
|
125 |
+
</div>
|
126 |
+
<div class="quotation-title">
|
127 |
+
<h1>QUOTATION</h1>
|
128 |
+
<table class="quote-meta">
|
129 |
+
<tr>
|
130 |
+
<td>QUO. NO</td>
|
131 |
+
<td>${quotationNumber}</td>
|
132 |
+
</tr>
|
133 |
+
<tr>
|
134 |
+
<td>DATE</td>
|
135 |
+
<td>${quotationDate}</td>
|
136 |
+
</tr>
|
137 |
+
</table>
|
138 |
+
</div>
|
139 |
+
</div>
|
140 |
+
|
141 |
+
<div class="customer-info">
|
142 |
+
<strong>CUSTOMER INFO</strong><br>
|
143 |
+
${customer.name}
|
144 |
+
</div>
|
145 |
+
|
146 |
+
<table class="items-table-print">
|
147 |
+
<thead>
|
148 |
+
<tr>
|
149 |
+
<th>SL NO</th>
|
150 |
+
<th>DESCRIPTION</th>
|
151 |
+
<th>HSN CODE</th>
|
152 |
+
<th>QTY</th>
|
153 |
+
<th>UNIT PRICE</th>
|
154 |
+
<th>DISCOUNT</th>
|
155 |
+
<th>AMOUNT</th>
|
156 |
+
</tr>
|
157 |
+
</thead>
|
158 |
+
<tbody>
|
159 |
+
`;
|
160 |
items.forEach((item, idx) => {
|
161 |
+
html += `
|
162 |
+
<tr>
|
163 |
+
<td>${idx + 1}</td>
|
164 |
+
<td>${item.description}</td>
|
165 |
+
<td>${item.hsn}</td>
|
166 |
+
<td>${item.qty}</td>
|
167 |
+
<td>${item.price.toFixed(2)}</td>
|
168 |
+
<td>${item.discount.toFixed(2)}%</td>
|
169 |
+
<td>${item.amount.toFixed(2)}</td>
|
170 |
+
</tr>
|
171 |
+
`;
|
172 |
});
|
173 |
+
// Add empty rows to fill the page
|
174 |
+
for (let i = items.length; i < 10; i++) {
|
175 |
+
html += '<tr><td> </td><td></td><td></td><td></td><td></td><td></td><td></td></tr>';
|
176 |
+
}
|
177 |
+
|
178 |
+
html += `
|
179 |
+
</tbody>
|
180 |
+
</table>
|
181 |
+
|
182 |
+
<div class="footer">
|
183 |
+
<div class="notes-and-total">
|
184 |
+
<div class="notes">
|
185 |
+
SPECIAL NOTES:<br><br>
|
186 |
+
AMOUNT IN WORDS:<br>
|
187 |
+
<strong>${rupeeWords}${paiseWords ? ' and ' + paiseWords + ' Paise' : ''} only</strong><br><br>
|
188 |
+
Delivery : 7 To 10 working days after receiving PO<br><br>
|
189 |
+
BANK DETAILS FOR RTGS/ NEFT ${bank.name}, BRANCH: ${bank.branch}<br>
|
190 |
+
A/C NO: ${bank.account}<br>
|
191 |
+
IFSC CODE: ${bank.ifsc}
|
192 |
+
</div>
|
193 |
+
<div class="totals">
|
194 |
+
<table>
|
195 |
+
<tr>
|
196 |
+
<td>SUB TOTAL</td>
|
197 |
+
<td>${subtotal.toFixed(2)}</td>
|
198 |
+
</tr>
|
199 |
+
<tr>
|
200 |
+
<td>FREIGHT CHARGES</td>
|
201 |
+
<td>${freightCharges.toFixed(2)}</td>
|
202 |
+
</tr>
|
203 |
+
<tr>
|
204 |
+
<td>IGST</td>
|
205 |
+
<td>${igstAmount.toFixed(2)}</td>
|
206 |
+
</tr>
|
207 |
+
<tr>
|
208 |
+
<td>R/OFF</td>
|
209 |
+
<td>${rOff.toFixed(2)}</td>
|
210 |
+
</tr>
|
211 |
+
<tr>
|
212 |
+
<td><strong>TOTAL</strong></td>
|
213 |
+
<td><strong>${finalTotal.toFixed(2)}</strong></td>
|
214 |
+
</tr>
|
215 |
+
</table>
|
216 |
+
</div>
|
217 |
+
</div>
|
218 |
+
<div class="disclaimer">
|
219 |
+
This quotation is not a contract or a bill. It is our best guess at the total price for the service and goods described above. The customer will be billed after indicating acceptance of this quote. Payment will be due prior to the delivery of service and goods. Please fax or mail the signed quote to the address listed above.
|
220 |
+
</div>
|
221 |
+
<div class="thank-you">
|
222 |
+
Thank you for your business!
|
223 |
+
</div>
|
224 |
+
</div>
|
225 |
+
<button onclick="window.print()">Print / Save as PDF</button>
|
226 |
+
</div>
|
227 |
+
`;
|
228 |
+
html = html.replace('{{address}}', company.address.replace(/\n/g, '<br>'));
|
229 |
output.innerHTML = html;
|
230 |
output.style.display = 'block';
|
231 |
document.getElementById('form-container').style.display = 'none';
|
style.css
CHANGED
@@ -45,6 +45,8 @@ button {
|
|
45 |
.quotation-print {
|
46 |
max-width: 800px;
|
47 |
margin: auto;
|
|
|
|
|
48 |
}
|
49 |
|
50 |
.quotation-print h2 {
|
@@ -59,23 +61,107 @@ button {
|
|
59 |
.totals table {
|
60 |
float: right;
|
61 |
border: none;
|
|
|
|
|
62 |
}
|
63 |
|
64 |
.totals td {
|
65 |
-
|
66 |
-
|
67 |
}
|
68 |
|
69 |
.disclaimer {
|
70 |
-
font-size: 0.9em;
|
71 |
color: #555;
|
72 |
margin-top: 20px;
|
|
|
|
|
|
|
|
|
73 |
}
|
74 |
|
75 |
.quote-meta {
|
76 |
text-align: right;
|
77 |
}
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
@media screen and (width <=768px) {
|
80 |
#items-table thead {
|
81 |
display: none;
|
|
|
45 |
.quotation-print {
|
46 |
max-width: 800px;
|
47 |
margin: auto;
|
48 |
+
border: 1px solid #000;
|
49 |
+
padding: 20px;
|
50 |
}
|
51 |
|
52 |
.quotation-print h2 {
|
|
|
61 |
.totals table {
|
62 |
float: right;
|
63 |
border: none;
|
64 |
+
width: 100%;
|
65 |
+
border-collapse: collapse;
|
66 |
}
|
67 |
|
68 |
.totals td {
|
69 |
+
border: 1px solid #000;
|
70 |
+
padding: 8px;
|
71 |
}
|
72 |
|
73 |
.disclaimer {
|
|
|
74 |
color: #555;
|
75 |
margin-top: 20px;
|
76 |
+
font-size: 10px;
|
77 |
+
text-align: justify;
|
78 |
+
border-top: 1px solid #000;
|
79 |
+
padding-top: 10px;
|
80 |
}
|
81 |
|
82 |
.quote-meta {
|
83 |
text-align: right;
|
84 |
}
|
85 |
|
86 |
+
.header {
|
87 |
+
display: flex;
|
88 |
+
justify-content: space-between;
|
89 |
+
margin-bottom: 20px;
|
90 |
+
}
|
91 |
+
|
92 |
+
.company-details {
|
93 |
+
font-size: 14px;
|
94 |
+
}
|
95 |
+
|
96 |
+
.quotation-title h1 {
|
97 |
+
margin: 0;
|
98 |
+
font-size: 24px;
|
99 |
+
color: #036;
|
100 |
+
text-align: right;
|
101 |
+
}
|
102 |
+
|
103 |
+
.quote-meta table {
|
104 |
+
border-collapse: collapse;
|
105 |
+
width: 100%;
|
106 |
+
}
|
107 |
+
|
108 |
+
.quote-meta td {
|
109 |
+
border: 1px solid #000;
|
110 |
+
padding: 5px;
|
111 |
+
}
|
112 |
+
|
113 |
+
.customer-info {
|
114 |
+
border: 1px solid #000;
|
115 |
+
padding: 10px;
|
116 |
+
margin-bottom: 20px;
|
117 |
+
}
|
118 |
+
|
119 |
+
.items-table-print {
|
120 |
+
width: 100%;
|
121 |
+
border-collapse: collapse;
|
122 |
+
margin-bottom: 20px;
|
123 |
+
}
|
124 |
+
|
125 |
+
.items-table-print th,
|
126 |
+
.items-table-print td {
|
127 |
+
border: 1px solid #000;
|
128 |
+
padding: 8px;
|
129 |
+
text-align: left;
|
130 |
+
}
|
131 |
+
|
132 |
+
.items-table-print thead th {
|
133 |
+
background-color: #e0f2f7;
|
134 |
+
}
|
135 |
+
|
136 |
+
.footer {
|
137 |
+
margin-top: 20px;
|
138 |
+
}
|
139 |
+
|
140 |
+
.notes-and-total {
|
141 |
+
display: flex;
|
142 |
+
justify-content: space-between;
|
143 |
+
}
|
144 |
+
|
145 |
+
.notes {
|
146 |
+
width: 60%;
|
147 |
+
font-size: 12px;
|
148 |
+
}
|
149 |
+
|
150 |
+
.totals {
|
151 |
+
width: 35%;
|
152 |
+
}
|
153 |
+
|
154 |
+
.totals td:first-child {
|
155 |
+
text-align: right;
|
156 |
+
}
|
157 |
+
|
158 |
+
.thank-you {
|
159 |
+
text-align: center;
|
160 |
+
margin-top: 20px;
|
161 |
+
font-weight: bold;
|
162 |
+
}
|
163 |
+
|
164 |
+
|
165 |
@media screen and (width <=768px) {
|
166 |
#items-table thead {
|
167 |
display: none;
|