@apptimate/ui 6.7.0 → 6.9.0
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.
package/package.json
CHANGED
|
@@ -269,8 +269,8 @@ export function replaceTokens(text: string, entityData: any): string {
|
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
// Format specific currency properties gracefully if they are numbers
|
|
272
|
-
if (val !== undefined && val !== null && (path.includes("amount") || path.includes("total") || path.includes("cost") || path.includes("price"))) {
|
|
273
|
-
if (!isNaN(Number(val))
|
|
272
|
+
if (val !== undefined && val !== null && (path.includes("amount") || path.includes("total") || path.includes("cost") || path.includes("price") || path.includes("due") || path.includes("tax"))) {
|
|
273
|
+
if (!isNaN(Number(val))) {
|
|
274
274
|
val = `${data.currency_code ? data.currency_code + ' ' : ''}${Number(val).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`;
|
|
275
275
|
}
|
|
276
276
|
}
|
|
@@ -462,11 +462,11 @@ function LineRenderer({ line, defaultFont, defaultColor, defaultFontSize, entity
|
|
|
462
462
|
if (!Array.isArray(rowsData)) rowsData = [];
|
|
463
463
|
|
|
464
464
|
return (
|
|
465
|
-
<div style={{ marginTop: `${line.spacing_before || 0}px`, marginBottom: `${line.spacing_after || 0}px`, border: outerBorder ? `1px solid ${borderColor}` : "none", borderRadius: line.border_radius || "0", overflow: "hidden", fontFamily: line.font_family || defaultFont }}>
|
|
465
|
+
<div style={{ width: "100%", marginTop: `${line.spacing_before || 0}px`, marginBottom: `${line.spacing_after || 0}px`, border: outerBorder ? `1px solid ${borderColor}` : "none", borderRadius: line.border_radius || "0", overflow: "hidden", fontFamily: line.font_family || defaultFont }}>
|
|
466
466
|
{showHeader && (
|
|
467
467
|
<div style={{ display: "flex", flexWrap: "wrap", backgroundColor: headerBg, padding: ec.header_padding || "6px 8px" }}>
|
|
468
468
|
{cols.map((col: any, i: number) => (
|
|
469
|
-
<div key={i} style={{ width: `${col.header_width_percent || col.width_percent}%`, color: headerFc, fontSize: `${headerFs}px`, fontWeight: ec.header_bold !== false ? 700 : (isA4 === false ? 600 : 400), textAlign: col.align || "left", whiteSpace: "pre-wrap" }}>
|
|
469
|
+
<div key={i} style={{ boxSizing: "border-box", padding: "0 2px", width: `${col.header_width_percent || col.width_percent}%`, color: headerFc, fontSize: `${headerFs}px`, fontWeight: ec.header_bold !== false ? 700 : (isA4 === false ? 600 : 400), textAlign: col.align || "left", whiteSpace: "pre-wrap", display: col.label ? "block" : "none" }}>
|
|
470
470
|
{typeof col.label === 'string' ? col.label.split('\n').map((t: string, ti: number) => <div key={ti}>{t || <br />}</div>) : col.label}
|
|
471
471
|
</div>
|
|
472
472
|
))}
|
|
@@ -480,8 +480,8 @@ function LineRenderer({ line, defaultFont, defaultColor, defaultFontSize, entity
|
|
|
480
480
|
|
|
481
481
|
const rowDataCtx = {
|
|
482
482
|
...row,
|
|
483
|
-
index: ri + 1,
|
|
484
|
-
description: row.item?.name || row.item_name || "Item",
|
|
483
|
+
index: row.index !== undefined ? row.index : ri + 1,
|
|
484
|
+
description: row.description || row.item?.name || row.item_name || "Item",
|
|
485
485
|
specification: row.item?.code || "",
|
|
486
486
|
|
|
487
487
|
// Rich item details for multi-line support
|
|
@@ -489,14 +489,14 @@ function LineRenderer({ line, defaultFont, defaultColor, defaultFontSize, entity
|
|
|
489
489
|
type: row.receipt_type ? (row.receipt_type === 'bulk' ? 'BULK / LOT' : String(row.receipt_type).replace(/_/g, ' ').toUpperCase()) : (row.item?.item_type ? row.item.item_type.replace('_', ' ').toUpperCase() : (row.item_class || row.item?.item_class ? String(row.item_class || row.item?.item_class).replace('_', ' ').toUpperCase() : (row.item_type || "BULK / LOT").toUpperCase())),
|
|
490
490
|
// New richer fields for GRN matching UI
|
|
491
491
|
material_purity_rich: `${(row.material_type || row.item?.material_type)?.name || "Gold"}\n${row.purity?.purity_percentage || row.purity_percentage || "99.8"}% (${row.purity?.karat || row.purity?.purity_code || "24K"})\nRate: ${fmtCurrency(row.rate_per_gram || row.unit_price)} / g`,
|
|
492
|
-
qty: fmtQty(row.quantity || row.received_quantity || 1),
|
|
492
|
+
qty: row.qty !== undefined ? row.qty : fmtQty(row.quantity || row.received_quantity || 1),
|
|
493
493
|
gross_wt: fmtNum(row.gross_weight || row.weight_grams || row.metal_weight || row.sale_weight || row.weight, ""),
|
|
494
494
|
weight: fmtNum(row.sale_weight || row.weight || row.gross_weight || row.weight_grams || row.metal_weight, ""),
|
|
495
495
|
material_wt: fmtNum(row.sale_weight || row.metal_weight || row.weight || row.gross_weight || row.weight_grams, ""),
|
|
496
496
|
weight_display: (row.weight_grams || row.net_weight || row.estimated_weight || row.material_weight || row.sale_weight || row.weight) && Number(row.weight_grams || row.net_weight || row.estimated_weight || row.material_weight || row.sale_weight || row.weight) > 0 ? `${parseFloat(Number(row.weight_grams || row.net_weight || row.estimated_weight || row.material_weight || row.sale_weight || row.weight).toFixed(4))}g` : "",
|
|
497
497
|
stone_wt: fmtNum(row.sale_stone_weight || row.stone_weight, ""),
|
|
498
498
|
stone_rich: row.stone_weight && Number(row.stone_weight) > 0 ? `${fmtNum(row.stone_weight, "g")}\n@ ${fmtCurrency(row.stone_cost || row.stone_amount)}` : "—",
|
|
499
|
-
item_value: fmtCurrency(row.item_value || row.subtotal || row.
|
|
499
|
+
item_value: row.unit_price !== undefined ? row.unit_price : fmtCurrency(row.item_value || row.subtotal || row.amount),
|
|
500
500
|
charges_rich: [
|
|
501
501
|
(row.making_charge || row.making_charge_value) && Number(row.making_charge || row.making_charge_value) > 0 ? `MC: ${row.making_charge || row.making_charge_value} (${row.making_charge_type || 'fixed'})` : null,
|
|
502
502
|
(row.wastage || row.wastage_value) && Number(row.wastage || row.wastage_value) > 0 ? `W: ${row.wastage || row.wastage_value} (${row.wastage_type || 'fixed'})` : null,
|
|
@@ -504,7 +504,7 @@ function LineRenderer({ line, defaultFont, defaultColor, defaultFontSize, entity
|
|
|
504
504
|
(row.tax_rate || row.tax_percentage) && Number(row.tax_rate || row.tax_percentage) > 0 ? `Tax: ${row.tax_rate || row.tax_percentage}%` : null
|
|
505
505
|
].filter(Boolean).join("\n") || "—",
|
|
506
506
|
|
|
507
|
-
amount: fmtCurrency(row.estimated_total_cost || row.subtotal || row.line_total || row.total_cost || row.
|
|
507
|
+
amount: row.amount !== undefined ? row.amount : fmtCurrency(row.estimated_total_cost || row.subtotal || row.line_total || row.total_cost || row.grand_total),
|
|
508
508
|
amount_num: (row.estimated_total_cost || row.subtotal || row.line_total || row.total_cost || row.amount || row.grand_total)
|
|
509
509
|
? Number(row.estimated_total_cost || row.subtotal || row.line_total || row.total_cost || row.amount || row.grand_total).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })
|
|
510
510
|
: "—"
|
|
@@ -531,7 +531,7 @@ function LineRenderer({ line, defaultFont, defaultColor, defaultFontSize, entity
|
|
|
531
531
|
}
|
|
532
532
|
|
|
533
533
|
return (
|
|
534
|
-
<div key={ci} style={{ width: `${col.width_percent}%`, fontSize: `${rowFs}px`, color: line.font_color || defaultColor, fontWeight: line.font_weight === "bold" ? 700 : line.font_weight === "light" ? 300 : (isA4 === false ? 600 : 400), textAlign: col.align || "left", whiteSpace: "pre-wrap", fontStyle: line.is_italic ? "italic" : "normal", textDecoration: line.is_underline ? "underline" : "none" }}>
|
|
534
|
+
<div key={ci} style={{ boxSizing: "border-box", padding: "0 2px", width: `${col.width_percent}%`, fontSize: `${rowFs}px`, color: line.font_color || defaultColor, fontWeight: line.font_weight === "bold" ? 700 : line.font_weight === "light" ? 300 : (isA4 === false ? 600 : 400), textAlign: col.align || "left", whiteSpace: "pre-wrap", fontStyle: line.is_italic ? "italic" : "normal", textDecoration: line.is_underline ? "underline" : "none" }}>
|
|
535
535
|
{typeof cellVal === 'string' ? cellVal.split('\n').map((t: string, ti: number) => <div key={ti}>{t || <br />}</div>) : cellVal}
|
|
536
536
|
</div>
|
|
537
537
|
);
|
|
@@ -190,7 +190,7 @@ export function ProductTransactionScreen({
|
|
|
190
190
|
|
|
191
191
|
const variantPriceField = config.priceField === 'default_cost_price' ? 'cost_price' : 'sale_price';
|
|
192
192
|
const batchPriceField = config.priceField === 'default_cost_price' ? 'cost_price' : 'selling_price';
|
|
193
|
-
const batchPrice = ['sales', 'quotation'].includes(config.type) && extra?.batches?.[0] ? (extra.batches[0] as any)[batchPriceField] : undefined;
|
|
193
|
+
const batchPrice = ['sales', 'quotation', 'pos'].includes(config.type) && extra?.batches?.[0] ? (extra.batches[0] as any)[batchPriceField] : undefined;
|
|
194
194
|
const basePrice = (batchPrice !== undefined && batchPrice !== null)
|
|
195
195
|
? Number(batchPrice)
|
|
196
196
|
: (actualVariant ? Number(actualVariant[variantPriceField] || itemWithVariants[config.priceField] || 0) : Number(itemWithVariants[config.priceField] || 0));
|