GWM : po pdf changes
This commit is contained in:
parent
ee79d1f546
commit
c37ff28833
@ -372,17 +372,22 @@ const buildPoPdfPayload = (po, company) => {
|
|||||||
},
|
},
|
||||||
brand: { name: po.brand?.name || '-' },
|
brand: { name: po.brand?.name || '-' },
|
||||||
warehouse: { name: po.warehouse?.name || '-' },
|
warehouse: { name: po.warehouse?.name || '-' },
|
||||||
items: (po.items || []).map((line) => ({
|
items: (po.items || []).map((line) => {
|
||||||
line_no: line.line_no,
|
const orderedQty = toNum(line.ordered_qty);
|
||||||
item_name: line.item?.item_name || '-',
|
const rate = toNum(line.rate);
|
||||||
remarks: line.remarks || null,
|
return {
|
||||||
uom: line.uom?.code || line.uom?.name || '-',
|
line_no: line.line_no,
|
||||||
ordered_qty: toNum(line.ordered_qty),
|
item_name: line.item?.item_name || '-',
|
||||||
rate: toNum(line.rate),
|
hsn_code: line.hsn_code?.code || '-',
|
||||||
discount_pct: toNum(line.discount_pct),
|
remarks: line.remarks || null,
|
||||||
gst_rate_pct: toNum(line.gst_rate?.rate_pct),
|
uom: line.uom?.code || line.uom?.name || '-',
|
||||||
line_total: toNum(line.line_total),
|
ordered_qty: orderedQty,
|
||||||
})),
|
rate,
|
||||||
|
discount_pct: toNum(line.discount_pct),
|
||||||
|
gst_rate_pct: toNum(line.gst_rate?.rate_pct),
|
||||||
|
amount: orderedQty * rate,
|
||||||
|
};
|
||||||
|
}),
|
||||||
totals: {
|
totals: {
|
||||||
sub_total: toNum(po.sub_total),
|
sub_total: toNum(po.sub_total),
|
||||||
tax_total: toNum(po.tax_total),
|
tax_total: toNum(po.tax_total),
|
||||||
|
|||||||
@ -47,33 +47,36 @@ const getDummyPoData = () => ({
|
|||||||
{
|
{
|
||||||
line_no: 1,
|
line_no: 1,
|
||||||
item_name: 'TMT steel bars 12mm',
|
item_name: 'TMT steel bars 12mm',
|
||||||
|
hsn_code: '72142090',
|
||||||
uom: 'MT',
|
uom: 'MT',
|
||||||
ordered_qty: 25,
|
ordered_qty: 25,
|
||||||
rate: 4250,
|
rate: 4250,
|
||||||
discount_pct: 2,
|
discount_pct: 2,
|
||||||
gst_rate_pct: 18,
|
gst_rate_pct: 18,
|
||||||
line_total: 124215,
|
amount: 106250,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
line_no: 2,
|
line_no: 2,
|
||||||
item_name: 'Cement OPC 53 grade',
|
item_name: 'Cement OPC 53 grade',
|
||||||
|
hsn_code: '25232930',
|
||||||
uom: 'Bag',
|
uom: 'Bag',
|
||||||
ordered_qty: 500,
|
ordered_qty: 500,
|
||||||
rate: 380,
|
rate: 380,
|
||||||
discount_pct: 0,
|
discount_pct: 0,
|
||||||
gst_rate_pct: 28,
|
gst_rate_pct: 28,
|
||||||
line_total: 243200,
|
amount: 190000,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
line_no: 3,
|
line_no: 3,
|
||||||
item_name: 'River sand',
|
item_name: 'River sand',
|
||||||
|
hsn_code: '25051000',
|
||||||
remarks: 'Confirm bag count on delivery',
|
remarks: 'Confirm bag count on delivery',
|
||||||
uom: 'CFT',
|
uom: 'CFT',
|
||||||
ordered_qty: 1200,
|
ordered_qty: 1200,
|
||||||
rate: 45,
|
rate: 45,
|
||||||
discount_pct: 5,
|
discount_pct: 5,
|
||||||
gst_rate_pct: 5,
|
gst_rate_pct: 5,
|
||||||
line_total: 53865,
|
amount: 54000,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
totals: {
|
totals: {
|
||||||
@ -128,6 +131,10 @@ const generatePoHtml = (inputData = getDummyPoData()) => {
|
|||||||
const remarks = item.remarks
|
const remarks = item.remarks
|
||||||
? `<div class="item-note">*${escapeHtml(item.remarks)}</div>`
|
? `<div class="item-note">*${escapeHtml(item.remarks)}</div>`
|
||||||
: '';
|
: '';
|
||||||
|
const amount =
|
||||||
|
item.amount != null
|
||||||
|
? Number(item.amount)
|
||||||
|
: Number(item.ordered_qty || 0) * Number(item.rate || 0);
|
||||||
return `
|
return `
|
||||||
<tr>
|
<tr>
|
||||||
<td class="col-no">${item.line_no || index + 1}</td>
|
<td class="col-no">${item.line_no || index + 1}</td>
|
||||||
@ -135,12 +142,13 @@ const generatePoHtml = (inputData = getDummyPoData()) => {
|
|||||||
<div class="item-name">${escapeHtml(item.item_name || '-')}</div>
|
<div class="item-name">${escapeHtml(item.item_name || '-')}</div>
|
||||||
${remarks}
|
${remarks}
|
||||||
</td>
|
</td>
|
||||||
|
<td class="col-hsn">${escapeHtml(item.hsn_code || '-')}</td>
|
||||||
<td class="col-qty text-right">${qtyDisplay(item.ordered_qty)}</td>
|
<td class="col-qty text-right">${qtyDisplay(item.ordered_qty)}</td>
|
||||||
<td class="col-uom">${escapeHtml(item.uom || '-')}</td>
|
<td class="col-uom">${escapeHtml(item.uom || '-')}</td>
|
||||||
<td class="col-rate text-right">${formatCurrency(item.rate)}</td>
|
<td class="col-rate text-right">${formatCurrency(item.rate)}</td>
|
||||||
<td class="col-disc text-right">${Number(item.discount_pct || 0).toFixed(0)}%</td>
|
<td class="col-disc text-right">${Number(item.discount_pct || 0).toFixed(0)}%</td>
|
||||||
<td class="col-gst text-right">${Number(item.gst_rate_pct || 0).toFixed(0)}%</td>
|
<td class="col-gst text-right">${Number(item.gst_rate_pct || 0).toFixed(0)}%</td>
|
||||||
<td class="col-amt text-right">${formatCurrency(item.line_total)}</td>
|
<td class="col-amt text-right">${formatCurrency(amount)}</td>
|
||||||
</tr>
|
</tr>
|
||||||
`;
|
`;
|
||||||
})
|
})
|
||||||
@ -286,13 +294,14 @@ const generatePoHtml = (inputData = getDummyPoData()) => {
|
|||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
}
|
}
|
||||||
.col-no { width: 4%; color: #666666; }
|
.col-no { width: 4%; color: #666666; }
|
||||||
.col-item { width: 36%; }
|
.col-item { width: 26%; }
|
||||||
.col-qty { width: 8%; }
|
.col-hsn { width: 10%; }
|
||||||
.col-uom { width: 8%; }
|
.col-qty { width: 7%; }
|
||||||
|
.col-uom { width: 7%; }
|
||||||
.col-rate { width: 12%; }
|
.col-rate { width: 12%; }
|
||||||
.col-disc { width: 8%; }
|
.col-disc { width: 7%; }
|
||||||
.col-gst { width: 8%; }
|
.col-gst { width: 7%; }
|
||||||
.col-amt { width: 16%; }
|
.col-amt { width: 14%; }
|
||||||
.item-name { font-weight: 600; }
|
.item-name { font-weight: 600; }
|
||||||
.item-note {
|
.item-note {
|
||||||
margin-top: 2px;
|
margin-top: 2px;
|
||||||
@ -466,6 +475,7 @@ const generatePoHtml = (inputData = getDummyPoData()) => {
|
|||||||
<tr>
|
<tr>
|
||||||
<th class="col-no">#</th>
|
<th class="col-no">#</th>
|
||||||
<th class="col-item">Item description</th>
|
<th class="col-item">Item description</th>
|
||||||
|
<th class="col-hsn">HSN</th>
|
||||||
<th class="col-qty text-right">Qty</th>
|
<th class="col-qty text-right">Qty</th>
|
||||||
<th class="col-uom">UOM</th>
|
<th class="col-uom">UOM</th>
|
||||||
<th class="col-rate text-right">Rate</th>
|
<th class="col-rate text-right">Rate</th>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user