Update 1.html

This commit is contained in:
jagrit007 2025-10-11 19:25:09 +00:00
parent 5f8542c0d7
commit 3b3749fdbf

56
1.html
View File

@ -14,7 +14,7 @@
body {
font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
padding: 30px 40px;
padding: 20px 40px;
color: #1a1a1a;
line-height: 1.6;
max-width: 850px;
@ -254,7 +254,7 @@
@media print {
body {
padding: 20px;
padding: 10px 20px;
}
.items-table tbody tr:hover {
@ -262,6 +262,58 @@
}
}
</style>
<script>
// Format numbers with Indian comma system (lakhs and crores)
function formatIndianNumber(num) {
if (!num) return num;
// Remove existing formatting
let numStr = num.toString().replace(/,/g, '');
// Check if it's a number
if (isNaN(numStr)) return num;
// Split into integer and decimal parts
let parts = numStr.split('.');
let intPart = parts[0];
let decPart = parts[1] ? '.' + parts[1] : '';
// Indian numbering system: last 3 digits, then groups of 2
let lastThree = intPart.substring(intPart.length - 3);
let otherNumbers = intPart.substring(0, intPart.length - 3);
if (otherNumbers !== '') {
lastThree = ',' + lastThree;
}
let formatted = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ',') + lastThree + decPart;
return formatted;
}
// Format all numbers when page loads
document.addEventListener('DOMContentLoaded', function() {
// Format all table cells with numbers
document.querySelectorAll('.items-table td').forEach(function(cell) {
let text = cell.textContent.trim();
let formatted = formatIndianNumber(text);
if (formatted !== text) {
cell.textContent = formatted;
}
});
// Format totals section
document.querySelectorAll('.totals-section .total-row span').forEach(function(span) {
let text = span.textContent.trim();
// Don't format if it contains currency or labels
if (!text.includes('Subtotal') && !text.includes('Tax') && !text.includes('Total')) {
let formatted = formatIndianNumber(text.replace(/[^\d.]/g, ''));
if (formatted !== text && formatted) {
span.textContent = text.replace(/[\d,]+\.?\d*/g, formatted);
}
}
});
});
</script>
</head>
<body>
<div class="header">