diff --git a/1.html b/1.html
index c2962a4..767c774 100644
--- a/1.html
+++ b/1.html
@@ -324,6 +324,28 @@
}
}
}
+
+ // Fix subtotal calculation when tax is present
+ let subtotalRow = document.querySelector('.total-row.subtotal span:last-child');
+ let taxRow = document.querySelector('.total-row:not(.subtotal):not(.grand-total) span:last-child');
+ let totalRow = document.querySelector('.total-row.grand-total span:last-child');
+
+ if (subtotalRow && taxRow && totalRow) {
+ // Extract numeric values
+ let subtotalText = subtotalRow.textContent.trim().replace(/[^\d.]/g, '');
+ let taxText = taxRow.textContent.trim().replace(/[^\d.]/g, '');
+ let totalText = totalRow.textContent.trim().split(' ')[0].replace(/[^\d.]/g, '');
+
+ let subtotalNum = parseFloat(subtotalText);
+ let taxNum = parseFloat(taxText);
+ let totalNum = parseFloat(totalText);
+
+ // If subtotal equals total, calculate actual subtotal (total - tax)
+ if (Math.abs(subtotalNum - totalNum) < 0.01 && taxNum > 0) {
+ let actualSubtotal = totalNum - taxNum;
+ subtotalRow.textContent = formatIndianNumber(actualSubtotal.toFixed(2));
+ }
+ }
});