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