<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport"…
- Usercode
- Assistant
- User
give ending code also
- Assistant
- User
- Assistant
- User
- Assistant
give ending code also
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Poppins', sans-serif;
background-color: #f1f5f9;
color: var(--dark);
line-height: 1.6;
}
/* Header styles */
.header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 1rem 2rem;
background-color: var(--white);
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.logo {
font-size: 1.5rem;
font-weight: 700;
color: var(--primary);
display: flex;
align-items: center;
gap: 0.5rem;
}
/* Main content styles */
.container {
max-width: 1280px;
margin: 2rem auto;
padding: 0 1rem;
}
.card {
background-color: var(--white);
border-radius: 0.5rem;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
padding: 1.5rem;
margin-bottom: 1.5rem;
}
.card-title {
font-size: 1.25rem;
font-weight: 600;
margin-bottom: 1rem;
color: var(--dark);
display: flex;
align-items: center;
gap: 0.5rem;
}
/* Upload area styles */
.upload-area {
border: 2px dashed var(--gray-light);
border-radius: 0.5rem;
padding: 2rem;
text-align: center;
cursor: pointer;
transition: all 0.3s ease;
}
.upload-area:hover {
border-color: var(--primary);
}
.upload-icon {
font-size: 3rem;
color: var(--primary);
margin-bottom: 1rem;
}
.upload-text {
font-size: 1rem;
color: var(--gray);
margin-bottom: 1rem;
}
.upload-btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
background-color: var(--primary);
color: var(--white);
padding: 0.75rem 1.5rem;
border-radius: 0.375rem;
font-weight: 500;
cursor: pointer;
transition: background-color 0.3s ease;
border: none;
}
.upload-btn:hover {
background-color: var(--primary-dark);
}
/* Tab styles */
.tabs {
display: flex;
border-bottom: 1px solid var(--gray-light);
margin-bottom: 1.5rem;
}
.tab {
padding: 0.75rem 1.5rem;
cursor: pointer;
font-weight: 500;
border-bottom: 2px solid transparent;
transition: all 0.3s ease;
}
.tab.active {
color: var(--primary);
border-bottom: 2px solid var(--primary);
}
/* Table styles */
.table-container {
overflow-x: auto;
margin-top: 1rem;
}
table {
width: 100%;
border-collapse: collapse;
text-align: left;
font-size: 0.875rem;
}
th {
background-color: #f8fafc;
padding: 0.75rem 1rem;
font-weight: 600;
border-bottom: 1px solid var(--gray-light);
}
td {
padding: 0.75rem 1rem;
border-bottom: 1px solid var(--gray-light);
}
tr:last-child td {
border-bottom: none;
}
tr:hover {
background-color: #f1f5f9;
}
/* Button styles */
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
padding: 0.5rem 1rem;
border-radius: 0.375rem;
font-weight: 500;
cursor: pointer;
transition: all 0.3s ease;
border: none;
}
.btn-primary {
background-color: var(--primary);
color: var(--white);
}
.btn-primary:hover {
background-color: var(--primary-dark);
}
.btn-secondary {
background-color: var(--white);
color: var(--dark);
border: 1px solid var(--gray-light);
}
.btn-secondary:hover {
background-color: #f1f5f9;
}
.btn-success {
background-color: var(--success);
color: var(--white);
}
.btn-success:hover {
background-color: #15803d;
}
/* Dashboard styles */
.dashboard {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 1rem;
margin-bottom: 1.5rem;
}
.stat-card {
background-color: var(--white);
border-radius: 0.5rem;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
padding: 1.5rem;
display: flex;
flex-direction: column;
}
.stat-title {
font-size: 0.875rem;
color: var(--gray);
margin-bottom: 0.5rem;
}
.stat-value {
font-size: 1.5rem;
font-weight: 700;
margin-bottom: 0.25rem;
}
.stat-change {
font-size: 0.875rem;
display: flex;
align-items: center;
gap: 0.25rem;
}
.stat-change.positive {
color: var(--success);
}
.stat-change.negative {
color: var(--danger);
}
.chart-container {
height: 300px;
margin-top: 1rem;
}
/* Badge styles */
.badge {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0.25rem 0.5rem;
border-radius: 9999px;
font-size: 0.75rem;
font-weight: 500;
}
.badge-success {
background-color: #dcfce7;
color: #166534;
}
.badge-warning {
background-color: #fef9c3;
color: #854d0e;
}
.badge-danger {
background-color: #fee2e2;
color: #b91c1c;
}
/* Utility classes */
.flex {
display: flex;
}
.flex-col {
flex-direction: column;
}
.items-center {
align-items: center;
}
.justify-between {
justify-content: space-between;
}
.gap-2 {
gap: 0.5rem;
}
.mt-4 {
margin-top: 1rem;
}
.mb-4 {
margin-bottom: 1rem;
}
.hidden {
display: none;
}
/* Loading indicator */
.loader {
border: 3px solid rgba(0,0,0,0.1);
border-top: 3px solid var(--primary);
border-radius: 50%;
width: 24px;
height: 24px;
animation: spin 1s linear infinite;
margin: 0 auto;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* Responsive table for narrow screens */
@media (max-width: 768px) {
.desktop-only {
display: none;
}
.dashboard {
grid-template-columns: 1fr;
}
}
<div id="resultsSection" class="hidden">
<div class="dashboard">
<div class="stat-card">
<div class="stat-title">Total Invoices</div>
<div class="stat-value" id="totalInvoices">0</div>
<div class="flex items-center justify-between">
<div class="stat-change positive">
<i class="fas fa-arrow-up"></i>
<span>4.75%</span>
</div>
<span class="text-gray-500 text-sm">vs. last month</span>
</div>
</div>
<div class="stat-card">
<div class="stat-title">Total GST Amount</div>
<div class="stat-value" id="totalGST">₹0.00</div>
<div class="flex items-center justify-between">
<div class="stat-change positive">
<i class="fas fa-arrow-up"></i>
<span>2.5%</span>
</div>
<span class="text-gray-500 text-sm">vs. last month</span>
</div>
</div>
<div class="stat-card">
<div class="stat-title">Total Taxable Value</div>
<div class="stat-value" id="totalTaxable">₹0.00</div>
<div class="flex items-center justify-between">
<div class="stat-change positive">
<i class="fas fa-arrow-up"></i>
<span>3.2%</span>
</div>
<span class="text-gray-500 text-sm">vs. last month</span>
</div>
</div>
<div class="stat-card">
<div class="stat-title">Total Gross Amount</div>
<div class="stat-value" id="totalGross">₹0.00</div>
<div class="flex items-center justify-between">
<div class="stat-change positive">
<i class="fas fa-arrow-up"></i>
<span>5.1%</span>
</div>
<span class="text-gray-500 text-sm">vs. last month</span>
</div>
</div>
</div>
<div class="card">
<div class="flex items-center justify-between mb-4">
<h2 class="card-title"><i class="fas fa-chart-pie"></i> GST Summary</h2>
<button class="btn btn-secondary">
<i class="fas fa-download"></i>
Export
</button>
</div>
<div class="flex flex-col md:flex-row gap-2">
<div class="chart-container" style="flex: 1;">
<canvas id="gstDistributionChart"></canvas>
</div>
<div class="chart-container" style="flex: 1;">
<canvas id="monthlyTrendChart"></canvas>
</div>
</div>
</div>
<div class="card">
<div class="tabs">
<div class="tab active" data-tab="invoiceData">Invoice Data</div>
<div class="tab" data-tab="gstData">GST Data</div>
<div class="tab" data-tab="misReports">MIS Reports</div>
</div>
<div id="invoiceData" class="tab-content">
<div class="flex items-center justify-between mb-4">
<div class="flex items-center gap-2">
<input type="text" placeholder="Search invoices..." class="px-3 py-2 border border-gray-300 rounded-md">
<button class="btn btn-secondary">
<i class="fas fa-search"></i>
Search
</button>
</div>
<div class="flex items-center gap-2">
<button class="btn btn-secondary">
<i class="fas fa-filter"></i>
Filter
</button>
<button class="btn btn-success">
<i class="fas fa-download"></i>
Export
</button>
</div>
</div>
<div class="table-container">
<table id="invoiceTable">
<thead>
<tr>
<th>S.No</th>
<th>Date</th>
<th>Party Name</th>
<th>GSTIN</th>
<th>Invoice No.</th>
<th>Commodity</th>
<th>Qty</th>
<th>Taxable Value</th>
<th>GST</th>
<th>Gross Amount</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<!-- This will be populated by JavaScript -->
</tbody>
</table>
</div>
<div class="flex items-center justify-between mt-4">
<div>
<span>Showing 1-10 of 100 entries</span>
</div>
<div class="flex items-center gap-2">
<button class="btn btn-secondary">Previous</button>
<button class="btn btn-primary">Next</button>
</div>
</div>
</div>
<div id="gstData" class="tab-content hidden">
<div class="flex items-center justify-between mb-4">
<div class="flex items-center gap-2">
<select class="px-3 py-2 border border-gray-300 rounded-md">
<option>All Tax Rates</option>
<option>5%</option>
<option>12%</option>
<option>18%</option>
<option>28%</option>
</select>
<button class="btn btn-secondary">
<i class="fas fa-filter"></i>
Apply
</button>
</div>
<div>
<button class="btn btn-success">
<i class="fas fa-download"></i>
Export GST Report
</button>
</div>
</div>
<div class="table-container">
<table id="gstTable">
<thead>
<tr>
<th>S.No</th>
<th>GSTIN</th>
<th>Party Name</th>
<th>Invoice No.</th>
<th>Date</th>
<th>HSN Code</th>
<th>Tax Rate</th>
<th>Taxable Value</th>
<th>CGST</th>
<th>SGST</th>
<th>IGST</th>
<th>Total GST</th>
</tr>
</thead>
<tbody>
<!-- This will be populated by JavaScript -->
</tbody>
</table>
</div>
</div>
<div id="misReports" class="tab-content hidden">
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
<div class="card">
<h3 class="card-title"><i class="fas fa-tag"></i> HSN-wise Summary</h3>
<div class="table-container">
<table id="hsnTable">
<thead>
<tr>
<th>HSN Code</th>
<th>Description</th>
<th>Total Qty</th>
<th>Total Value</th>
<th>Total GST</th>
</tr>
</thead>
<tbody>
<!-- This will be populated by JavaScript -->
</tbody>
</table>
</div>
</div>
<div class="card">
<h3 class="card-title"><i class="fas fa-percentage"></i> Tax Rate Summary</h3>
<div class="table-container">
<table id="taxRateTable">
<thead>
<tr>
<th>Tax Rate</th>
<th>Taxable Value</th>
<th>CGST</th>
<th>SGST</th>
<th>IGST</th>
<th>Total Tax</th>
</tr>
</thead>
<tbody>
<!-- This will be populated by JavaScript -->
</tbody>
</table>
</div>
</div>
</div>
<div class="card">
<h3 class="card-title"><i class="fas fa-user"></i> Party-wise Summary</h3>
<div class="table-container">
<table id="partyTable">
<thead>
<tr>
<th>Party Name</th>
<th>GSTIN</th>
<th>No. of Invoices</th>
<th>Total Taxable Value</th>
<th>Total GST</th>
<th>Total Gross</th>
</tr>
</thead>
<tbody>
<!-- This will be populated by JavaScript -->
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
Certainly! Below is the completed JavaScript code including the finishing part of the MIS reports updateMISReports function, chart rendering (drawCharts), and any missing functionalities such as the export button on GST Summary, along with integrating everything properly into the page you provided.
I have:
updateMISReports function.drawCharts function: renders GST Distribution and Monthly Trend charts.Here is the full JavaScript code continuation and completion:
// ... (existing code)
// Update MIS reports
function updateMISReports(data) {
// Clear existing rows
hsnTable.innerHTML = '';
taxRateTable.innerHTML = '';
partyTable.innerHTML = '';
// HSN-wise summary
const hsnSummary = {};
data.forEach(item => {
const hsnCode = item['HSN Code'] || 'N/A';
if (!hsnSummary[hsnCode]) {
hsnSummary[hsnCode] = {
description: item['Description'] || '-',
totalQty: 0,
totalValue: 0,
totalGST: 0
};
}
hsnSummary[hsnCode].totalQty += parseFloat(item['Qty'] || 0);
hsnSummary[hsnCode].totalValue += parseFloat(item['Taxable Value'] || 0);
hsnSummary[hsnCode].totalGST += parseFloat(item['CGST'] || 0) + parseFloat(item['SGST'] || 0) + parseFloat(item['IGST'] || 0);
});
Object.keys(hsnSummary).forEach((hsnCode) => {
const row = hsnTable.insertRow();
const hsnCodeCell = row.insertCell(0);
const descriptionCell = row.insertCell(1);
const totalQtyCell = row.insertCell(2);
const totalValueCell = row.insertCell(3);
const totalGSTCell = row.insertCell(4);
hsnCodeCell.textContent = hsnCode;
descriptionCell.textContent = hsnSummary[hsnCode].description;
totalQtyCell.textContent = hsnSummary[hsnCode].totalQty.toLocaleString(undefined, {maximumFractionDigits: 2});
totalValueCell.textContent = '₹' + hsnSummary[hsnCode].totalValue.toLocaleString('en-IN', { maximumFractionDigits: 2 });
totalGSTCell.textContent = '₹' + hsnSummary[hsnCode].totalGST.toLocaleString('en-IN', { maximumFractionDigits: 2 });
});
// Tax rate summary
const taxRateSummary = {};
data.forEach(item => {
const taxRate = item['Tax Rate'] || 'N/A';
if (!taxRateSummary[taxRate]) {
taxRateSummary[taxRate] = {
taxableValue: 0,
cgst: 0,
sgst: 0,
igst: 0,
totalTax: 0
};
}
taxRateSummary[taxRate].taxableValue += parseFloat(item['Taxable Value'] || 0);
taxRateSummary[taxRate].cgst += parseFloat(item['CGST'] || 0);
taxRateSummary[taxRate].sgst += parseFloat(item['SGST'] || 0);
taxRateSummary[taxRate].igst += parseFloat(item['IGST'] || 0);
});
// Compute totalTax for each taxRate
Object.keys(taxRateSummary).forEach(rate => {
const summary = taxRateSummary[rate];
summary.totalTax = summary.cgst + summary.sgst + summary.igst;
});
Object.keys(taxRateSummary).forEach((rate) => {
const row = taxRateTable.insertRow();
const taxRateCell = row.insertCell(0);
const taxableCell = row.insertCell(1);
const cgstCell = row.insertCell(2);
const sgstCell = row.insertCell(3);
const igstCell = row.insertCell(4);
const totalTaxCell = row.insertCell(5);
taxRateCell.textContent = rate;
taxableCell.textContent = '₹' + taxRateSummary[rate].taxableValue.toLocaleString('en-IN', { maximumFractionDigits: 2 });
cgstCell.textContent = '₹' + taxRateSummary[rate].cgst.toLocaleString('en-IN', { maximumFractionDigits: 2 });
sgstCell.textContent = '₹' + taxRateSummary[rate].sgst.toLocaleString('en-IN', { maximumFractionDigits: 2 });
igstCell.textContent = '₹' + taxRateSummary[rate].igst.toLocaleString('en-IN', { maximumFractionDigits: 2 });
totalTaxCell.textContent = '₹' + taxRateSummary[rate].totalTax.toLocaleString('en-IN', { maximumFractionDigits: 2 });
});
// Party-wise summary
const partySummary = {};
data.forEach(item => {
const partyName = item['Party Name'] || 'N/A';
const gstin = item['GSTIN'] || 'N/A';
const key = gstin + '|' + partyName; // Unique key to avoid duplicate parties with same name
if (!partySummary[key]) {
partySummary[key] = {
partyName: partyName,
gstin: gstin,
invoiceCount: 0,
totalTaxable: 0,
totalGST: 0,
totalGross: 0
};
}
partySummary[key].invoiceCount++;
partySummary[key].totalTaxable += parseFloat(item['Taxable Value'] || 0);
partySummary[key].totalGST += parseFloat(item['CGST'] || 0) + parseFloat(item['SGST'] || 0) + parseFloat(item['IGST'] || 0);
partySummary[key].totalGross += parseFloat(item['Gross Amount'] || 0);
});
Object.keys(partySummary).forEach(key => {
const summary = partySummary[key];
const row = partyTable.insertRow();
const partyNameCell = row.insertCell(0);
const gstinCell = row.insertCell(1);
const invoiceCountCell = row.insertCell(2);
const totalTaxableCell = row.insertCell(3);
const totalGSTCell = row.insertCell(4);
const totalGrossCell = row.insertCell(5);
partyNameCell.textContent = summary.partyName;
gstinCell.textContent = summary.gstin;
invoiceCountCell.textContent = summary.invoiceCount;
totalTaxableCell.textContent = '₹' + summary.totalTaxable.toLocaleString('en-IN', { maximumFractionDigits: 2 });
totalGSTCell.textContent = '₹' + summary.totalGST.toLocaleString('en-IN', { maximumFractionDigits: 2 });
totalGrossCell.textContent = '₹' + summary.totalGross.toLocaleString('en-IN', { maximumFractionDigits: 2 });
});
}
// Draw Charts
let gstDistributionChartInstance = null;
let monthlyTrendChartInstance = null;
function drawCharts(data) {
// Prepare data for GST Distribution chart (Pie chart by Tax Rate)
// Sum taxable value by tax rate
const gstDistData = {};
data.forEach(item => {
const taxRateKey = item['Tax Rate'] || 'N/A';
if (!gstDistData[taxRateKey]) {
gstDistData[taxRateKey] = 0;
}
gstDistData[taxRateKey] += parseFloat(item['Taxable Value'] || 0);
});
const gstDistLabels = Object.keys(gstDistData);
const gstDistValues = gstDistLabels.map(rate => gstDistData[rate]);
const gstDistColors = [
'#4f46e5', // primary
'#12b886', // teal
'#f59e0b', // yellow
'#ef4444', // red
'#3b82f6', // blue
'#db2777', // pink
];
// Prepare data for monthly trend chart (Bar chart)
// Group by month-year
const monthlyData = {};
data.forEach(item => {
let dateStr = item['Date'];
if (!dateStr) return;
// Try to convert Excel date values and strings to Date object
let d = parseDate(dateStr);
if (!d) return;
let monthYear = `${d.getFullYear()}-${('0' + (d.getMonth() + 1)).slice(-2)}`;
if (!monthlyData[monthYear]) {
monthlyData[monthYear] = {
totalTaxable: 0,
totalGST: 0,
totalGross: 0
};
}
monthlyData[monthYear].totalTaxable += parseFloat(item['Taxable Value'] || 0);
monthlyData[monthYear].totalGST += (parseFloat(item['CGST'] || 0) + parseFloat(item['SGST'] || 0) + parseFloat(item['IGST'] || 0));
monthlyData[monthYear].totalGross += parseFloat(item['Gross Amount'] || 0);
});
// Sort the months ascending
const sortedMonths = Object.keys(monthlyData).sort();
const monthlyTaxable = [];
const monthlyGST = [];
const monthlyGross = [];
sortedMonths.forEach(month => {
monthlyTaxable.push(monthlyData[month].totalTaxable);
monthlyGST.push(monthlyData[month].totalGST);
monthlyGross.push(monthlyData[month].totalGross);
});
// Format months to "MMM YYYY"
const formattedMonths = sortedMonths.map(m => {
const parts = m.split('-');
const year = parts[0];
const month = parts[1];
return new Date(year, parseInt(month) -1).toLocaleString('en-US', { month: 'short', year: 'numeric' });
});
// Destroy existing charts if exist
if (gstDistributionChartInstance) {
gstDistributionChartInstance.destroy();
}
if (monthlyTrendChartInstance) {
monthlyTrendChartInstance.destroy();
}
// Create GST Distribution Pie Chart
const ctx1 = document.getElementById('gstDistributionChart').getContext('2d');
gstDistributionChartInstance = new Chart(ctx1, {
type: 'pie',
data: {
labels: gstDistLabels,
datasets: [{
data: gstDistValues,
backgroundColor: gstDistColors.slice(0, gstDistLabels.length),
borderWidth: 1,
}]
},
options: {
responsive: true,
plugins: {
legend: {
position: 'bottom',
},
tooltip: {
callbacks: {
label: function(context) {
let label = context.label || '';
let value = context.parsed || 0;
let percent = 0;
const sum = context.chart._metasets[context.datasetIndex].total;
if (sum) {
percent = ((value / sum) * 100).toFixed(2);
}
return `${label}: ₹${value.toLocaleString('en-IN', {maximumFractionDigits:2})} (${percent}%)`;
}
}
}
}
}
});
// Create Monthly Trend Bar Chart
const ctx2 = document.getElementById('monthlyTrendChart').getContext('2d');
monthlyTrendChartInstance = new Chart(ctx2, {
type: 'bar',
data: {
labels: formattedMonths,
datasets: [
{
label: 'Taxable Value',
data: monthlyTaxable,
backgroundColor: '#4f46e5'
},
{
label: 'GST',
data: monthlyGST,
backgroundColor: '#ef4444'
},
{
label: 'Gross Amount',
data: monthlyGross,
backgroundColor: '#f97316'
}
]
},
options: {
responsive: true,
scales: {
y: {
beginAtZero: true,
ticks: {
// Use Indian Rupee format
callback: function(value) {
return '₹' + value.toLocaleString('en-IN');
}
}
}
},
plugins: {
legend: {
position: 'bottom',
},
tooltip: {
callbacks: {
label: function(context) {
let val = context.parsed.y || 0;
return context.dataset.label + ': ₹' + val.toLocaleString('en-IN', {maximumFractionDigits:2});
}
}
}
}
}
});
}
// Utility - Parse date string or Excel date to JS Date
function parseDate(dateVal) {
// If it's a number, treat as Excel date (days since 1900-01-01)
if (typeof dateVal === 'number') {
// Excel incorrectly assumes 1900 is a leap year, so subtract 1 for days after 28 Feb 1900
const offset = (dateVal > 59) ? dateVal - 1 : dateVal;
const excelEpoch = new Date(1899, 11, 30); // Dec 30, 1899
const date = new Date(excelEpoch.getTime() + offset * 24 * 3600 * 1000);
return date;
}
// If already Date object
if (dateVal instanceof Date) return dateVal;
// Otherwise, try to parse string
const parsed = new Date(dateVal);
if (!isNaN(parsed)) {
return parsed;
}
// Could not parse
return null;
}
// GST Summary Export button (export GST summary related data)
const gstSummaryExportBtn = document.querySelector('.card .btn-secondary i.fa-download').parentElement;
gstSummaryExportBtn.addEventListener('click', () => {
// Prepare summary data for export (most relevant is tax rate summary)
const wb = XLSX.utils.book_new();
// GST Distribution sheet (tax rate summary)
const gstDistributionData = [['Tax Rate', 'Taxable Value']];
for (const [rate, obj] of Object.entries(getGSTDistributionData(invoiceData))) {
gstDistributionData.push([rate, obj.toFixed(2)]);
}
const ws1 = XLSX.utils.aoa_to_sheet(gstDistributionData);
XLSX.utils.book_append_sheet(wb, ws1, 'GST Distribution');
// Monthly Trends sheet
const monthlyTrend = getMonthlyTrendData(invoiceData);
const ws2 = XLSX.utils.aoa_to_sheet(monthlyTrend);
XLSX.utils.book_append_sheet(wb, ws2, 'Monthly Trend');
XLSX.writeFile(wb, 'GST_Summary.xlsx');
});
// Helper: get GST Distribution Data for export
function getGSTDistributionData(data) {
const gstDist = {};
data.forEach(item => {
const taxRateKey = item['Tax Rate'] || 'N/A';
if (!gstDist[taxRateKey]) gstDist[taxRateKey] = 0;
gstDist[taxRateKey] += parseFloat(item['Taxable Value'] || 0);
});
return gstDist;
}
// Helper: Prepare monthly trend data for export (array of arrays)
function getMonthlyTrendData(data) {
// Group by month-year
const monthlyData = {};
data.forEach(item => {
let dateStr = item['Date'];
if (!dateStr) return;
let d = parseDate(dateStr);
if (!d) return;
let monthYear = `${d.getFullYear()}-${('0' + (d.getMonth() + 1)).slice(-2)}`;
if (!monthlyData[monthYear]) {
monthlyData[monthYear] = {
totalTaxable: 0,
totalGST: 0,
totalGross: 0
};
}
monthlyData[monthYear].totalTaxable += parseFloat(item['Taxable Value'] || 0);
monthlyData[monthYear].totalGST += (parseFloat(item['CGST'] || 0) + parseFloat(item['SGST'] || 0) + parseFloat(item['IGST'] || 0));
monthlyData[monthYear].totalGross += parseFloat(item['Gross Amount'] || 0);
});
const sortedMonths = Object.keys(monthlyData).sort();
const result = [['Month-Year', 'Taxable Value', 'GST', 'Gross Amount']];
sortedMonths.forEach(month => {
const d = new Date(month.split('-')[0], parseInt(month.split('-')[1]) - 1);
const label = d.toLocaleString('en-US', { month: 'short', year: 'numeric' });
const v = monthlyData[month];
result.push([
label,
v.totalTaxable.toFixed(2),
v.totalGST.toFixed(2),
v.totalGross.toFixed(2)
]);
});
return result;
}
parseDate function handles Excel serial dates and string dates.invoiceData array and filtering it.Please add the above code just after your existing JavaScript code block (inside the <script> tag) to complete your page functionality.
If you'd like me to provide the full combined code or help integrate it in a particular way, please let me know!
Certainly! Here’s the complete ending JavaScript code to add after your existing script, which completes the updateMISReports function, adds chart rendering, and ties up export buttons — everything wrapped up neatly:
// Update MIS reports
function updateMISReports(data) {
// Clear existing rows
hsnTable.innerHTML = '';
taxRateTable.innerHTML = '';
partyTable.innerHTML = '';
// HSN-wise summary
const hsnSummary = {};
data.forEach(item => {
const hsnCode = item['HSN Code'] || 'N/A';
if (!hsnSummary[hsnCode]) {
hsnSummary[hsnCode] = {
description: item['Description'] || '-',
totalQty: 0,
totalValue: 0,
totalGST: 0
};
}
hsnSummary[hsnCode].totalQty += parseFloat(item['Qty'] || 0);
hsnSummary[hsnCode].totalValue += parseFloat(item['Taxable Value'] || 0);
hsnSummary[hsnCode].totalGST += parseFloat(item['CGST'] || 0) + parseFloat(item['SGST'] || 0) + parseFloat(item['IGST'] || 0);
});
Object.keys(hsnSummary).forEach(hsnCode => {
const row = hsnTable.insertRow();
row.insertCell(0).textContent = hsnCode;
row.insertCell(1).textContent = hsnSummary[hsnCode].description;
row.insertCell(2).textContent = hsnSummary[hsnCode].totalQty.toLocaleString(undefined, { maximumFractionDigits: 2 });
row.insertCell(3).textContent = '₹' + hsnSummary[hsnCode].totalValue.toLocaleString('en-IN', { maximumFractionDigits: 2 });
row.insertCell(4).textContent = '₹' + hsnSummary[hsnCode].totalGST.toLocaleString('en-IN', { maximumFractionDigits: 2 });
});
// Tax rate summary
const taxRateSummary = {};
data.forEach(item => {
const taxRate = item['Tax Rate'] || 'N/A';
if (!taxRateSummary[taxRate]) {
taxRateSummary[taxRate] = {
taxableValue: 0,
cgst: 0,
sgst: 0,
igst: 0
};
}
taxRateSummary[taxRate].taxableValue += parseFloat(item['Taxable Value'] || 0);
taxRateSummary[taxRate].cgst += parseFloat(item['CGST'] || 0);
taxRateSummary[taxRate].sgst += parseFloat(item['SGST'] || 0);
taxRateSummary[taxRate].igst += parseFloat(item['IGST'] || 0);
});
Object.keys(taxRateSummary).forEach(rate => {
const s = taxRateSummary[rate];
const row = taxRateTable.insertRow();
row.insertCell(0).textContent = rate;
row.insertCell(1).textContent = '₹' + s.taxableValue.toLocaleString('en-IN', { maximumFractionDigits: 2 });
row.insertCell(2).textContent = '₹' + s.cgst.toLocaleString('en-IN', { maximumFractionDigits: 2 });
row.insertCell(3).textContent = '₹' + s.sgst.toLocaleString('en-IN', { maximumFractionDigits: 2 });
row.insertCell(4).textContent = '₹' + s.igst.toLocaleString('en-IN', { maximumFractionDigits: 2 });
row.insertCell(5).textContent = '₹' + (s.cgst + s.sgst + s.igst).toLocaleString('en-IN', { maximumFractionDigits: 2 });
});
// Party-wise summary
const partySummary = {};
data.forEach(item => {
const partyName = item['Party Name'] || 'N/A';
const gstin = item['GSTIN'] || 'N/A';
const key = gstin + '|' + partyName;
if (!partySummary[key]) {
partySummary[key] = {
partyName,
gstin,
invoiceCount: 0,
totalTaxable: 0,
totalGST: 0,
totalGross: 0
};
}
partySummary[key].invoiceCount++;
partySummary[key].totalTaxable += parseFloat(item['Taxable Value'] || 0);
partySummary[key].totalGST += parseFloat(item['CGST'] || 0) + parseFloat(item['SGST'] || 0) + parseFloat(item['IGST'] || 0);
partySummary[key].totalGross += parseFloat(item['Gross Amount'] || 0);
});
Object.values(partySummary).forEach(summary => {
const row = partyTable.insertRow();
row.insertCell(0).textContent = summary.partyName;
row.insertCell(1).textContent = summary.gstin;
row.insertCell(2).textContent = summary.invoiceCount;
row.insertCell(3).textContent = '₹' + summary.totalTaxable.toLocaleString('en-IN', { maximumFractionDigits: 2 });
row.insertCell(4).textContent = '₹' + summary.totalGST.toLocaleString('en-IN', { maximumFractionDigits: 2 });
row.insertCell(5).textContent = '₹' + summary.totalGross.toLocaleString('en-IN', { maximumFractionDigits: 2 });
});
}
// Chart.js instances
let gstDistributionChartInstance = null;
let monthlyTrendChartInstance = null;
function drawCharts(data) {
// GST Distribution by Tax Rate
const gstDist = {};
data.forEach(item => {
const rate = item['Tax Rate'] || 'N/A';
gstDist[rate] = (gstDist[rate] || 0) + parseFloat(item['Taxable Value'] || 0);
});
const distLabels = Object.keys(gstDist);
const distValues = distLabels.map(label => gstDist[label]);
const colors = ['#4f46e5', '#12b886', '#f59e0b', '#ef4444', '#3b82f6', '#db2777'];
// Monthly trend data
const monthlyData = {};
data.forEach(item => {
const dateObj = parseDate(item['Date']);
if (!dateObj) return;
const monthKey = `${dateObj.getFullYear()}-${('0' + (dateObj.getMonth() + 1)).slice(-2)}`;
if (!monthlyData[monthKey]) monthlyData[monthKey] = { taxable: 0, gst: 0, gross: 0 };
monthlyData[monthKey].taxable += parseFloat(item['Taxable Value'] || 0);
monthlyData[monthKey].gst += (parseFloat(item['CGST'] || 0) + parseFloat(item['SGST'] || 0) + parseFloat(item['IGST'] || 0));
monthlyData[monthKey].gross += parseFloat(item['Gross Amount'] || 0);
});
const monthsSorted = Object.keys(monthlyData).sort();
const monthLabels = monthsSorted.map(m => {
const parts = m.split('-');
const date = new Date(parts[0], parts[1] - 1);
return date.toLocaleString('en-US', { month: 'short', year: 'numeric' });
});
const taxableVals = monthsSorted.map(m => monthlyData[m].taxable);
const gstVals = monthsSorted.map(m => monthlyData[m].gst);
const grossVals = monthsSorted.map(m => monthlyData[m].gross);
// Destroy old charts if any
if (gstDistributionChartInstance) gstDistributionChartInstance.destroy();
if (monthlyTrendChartInstance) monthlyTrendChartInstance.destroy();
// Pie Chart for GST Distribution
gstDistributionChartInstance = new Chart(document.getElementById('gstDistributionChart').getContext('2d'), {
type: 'pie',
data: {
labels: distLabels,
datasets: [{
data: distValues,
backgroundColor: colors.slice(0, distLabels.length),
borderWidth: 1
}]
},
options: {
responsive: true,
plugins: {
legend: { position: 'bottom' },
tooltip: {
callbacks: {
label: ctx => {
const label = ctx.label || '';
const val = ctx.parsed || 0;
const sum = ctx.dataset.data.reduce((a,b) => a+b, 0);
const percent = sum ? ((val / sum) * 100).toFixed(2) : 0;
return `${label}: ₹${val.toLocaleString('en-IN', { maximumFractionDigits: 2 })} (${percent}%)`;
}
}
}
}
}
});
// Bar Chart for Monthly Trend
monthlyTrendChartInstance = new Chart(document.getElementById('monthlyTrendChart').getContext('2d'), {
type: 'bar',
data: {
labels: monthLabels,
datasets: [
{ label: 'Taxable Value', data: taxableVals, backgroundColor: '#4f46e5' },
{ label: 'GST', data: gstVals, backgroundColor: '#ef4444' },
{ label: 'Gross Amount', data: grossVals, backgroundColor: '#f97316' }
]
},
options: {
responsive: true,
scales: {
y: {
beginAtZero: true,
ticks: {
callback: val => '₹' + val.toLocaleString('en-IN')
}
}
},
plugins: {
legend: { position: 'bottom' },
tooltip: {
callbacks: {
label: ctx => `${ctx.dataset.label}: ₹${ctx.parsed.y.toLocaleString('en-IN', { maximumFractionDigits: 2 })}`
}
}
}
}
});
}
// Date parsing helper
function parseDate(value) {
if (typeof value === 'number') {
const offset = (value > 59) ? value - 1 : value; // Excel leap year bug fix
const excelEpoch = new Date(1899, 11, 30);
return new Date(excelEpoch.getTime() + offset * 86400000);
}
if (value instanceof Date) return value;
const parsed = new Date(value);
return isNaN(parsed) ? null : parsed;
}
// GST Summary Export button handler
const gstSummaryExportBtn = document.querySelector('.card .btn-secondary i.fa-download').parentElement;
gstSummaryExportBtn.addEventListener('click', () => {
const wb = XLSX.utils.book_new();
// GST Distribution Sheet
const gstDistData = [['Tax Rate', 'Taxable Value']];
const gstDist = {};
invoiceData.forEach(item => {
const rate = item['Tax Rate'] || 'N/A';
gstDist[rate] = (gstDist[rate] || 0) + parseFloat(item['Taxable Value'] || 0);
});
Object.entries(gstDist).forEach(([rate, val]) => {
gstDistData.push([rate, val.toFixed(2)]);
});
const wsDist = XLSX.utils.aoa_to_sheet(gstDistData);
XLSX.utils.book_append_sheet(wb, wsDist, 'GST Distribution');
// Monthly Trend Sheet
const monthlyData = {};
invoiceData.forEach(item => {
const d = parseDate(item['Date']);
if (!d) return;
const monthKey = `${d.getFullYear()}-${('0' + (d.getMonth() + 1)).slice(-2)}`;
if (!monthlyData[monthKey]) monthlyData[monthKey] = { taxableValue: 0, gst: 0, gross: 0 };
monthlyData[monthKey].taxableValue += parseFloat(item['Taxable Value'] || 0);
monthlyData[monthKey].gst += (parseFloat(item['CGST'] || 0) + parseFloat(item['SGST'] || 0) + parseFloat(item['IGST'] || 0));
monthlyData[monthKey].gross += parseFloat(item['Gross Amount'] || 0);
});
const monthsSorted = Object.keys(monthlyData).sort();
const monthlyTrendData = [['Month-Year', 'Taxable Value', 'GST', 'Gross Amount']];
monthsSorted.forEach(month => {
const date = new Date(month.split('-')[0], month.split('-')[1] - 1);
const label = date.toLocaleString('en-US', { month: 'short', year: 'numeric' });
monthlyTrendData.push([
label,
monthlyData[month].taxableValue.toFixed(2),
monthlyData[month].gst.toFixed(2),
monthlyData[month].gross.toFixed(2)
]);
});
const wsTrend = XLSX.utils.aoa_to_sheet(monthlyTrendData);
XLSX.utils.book_append_sheet(wb, wsTrend, 'Monthly Trend');
XLSX.writeFile(wb, 'GST_Summary.xlsx');
});
Add this code at the end of your existing <script> tag to fully enable all features of your GST Invoice Processor page.
If you want me to combine everything into one script or have any other question, just ask!
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Poppins', sans-serif;
background-color: #f1f5f9;
color: var(--dark);
line-height: 1.6;
}
/* Header styles */
.header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 1rem 2rem;
background-color: var(--white);
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.logo {
font-size: 1.5rem;
font-weight: 700;
color: var(--primary);
display: flex;
align-items: center;
gap: 0.5rem;
}
/* Main content styles */
.container {
max-width: 1280px;
margin: 2rem auto;
padding: 0 1rem;
}
.card {
background-color: var(--white);
border-radius: 0.5rem;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
padding: 1.5rem;
margin-bottom: 1.5rem;
}
.card-title {
font-size: 1.25rem;
font-weight: 600;
margin-bottom: 1rem;
color: var(--dark);
display: flex;
align-items: center;
gap: 0.5rem;
}
/* Upload area styles */
.upload-area {
border: 2px dashed var(--gray-light);
border-radius: 0.5rem;
padding: 2rem;
text-align: center;
cursor: pointer;
transition: all 0.3s ease;
}
.upload-area:hover {
border-color: var(--primary);
}
.upload-icon {
font-size: 3rem;
color: var(--primary);
margin-bottom: 1rem;
}
.upload-text {
font-size: 1rem;
color: var(--gray);
margin-bottom: 1rem;
}
.upload-btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
background-color: var(--primary);
color: var(--white);
padding: 0.75rem 1.5rem;
border-radius: 0.375rem;
font-weight: 500;
cursor: pointer;
transition: background-color 0.3s ease;
border: none;
}
.upload-btn:hover {
background-color: var(--primary-dark);
}
/* Tab styles */
.tabs {
display: flex;
border-bottom: 1px solid var(--gray-light);
margin-bottom: 1.5rem;
}
.tab {
padding: 0.75rem 1.5rem;
cursor: pointer;
font-weight: 500;
border-bottom: 2px solid transparent;
transition: all 0.3s ease;
}
.tab.active {
color: var(--primary);
border-bottom: 2px solid var(--primary);
}
/* Table styles */
.table-container {
overflow-x: auto;
margin-top: 1rem;
}
table {
width: 100%;
border-collapse: collapse;
text-align: left;
font-size: 0.875rem;
}
th {
background-color: #f8fafc;
padding: 0.75rem 1rem;
font-weight: 600;
border-bottom: 1px solid var(--gray-light);
}
td {
padding: 0.75rem 1rem;
border-bottom: 1px solid var(--gray-light);
}
tr:last-child td {
border-bottom: none;
}
tr:hover {
background-color: #f1f5f9;
}
/* Button styles */
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
padding: 0.5rem 1rem;
border-radius: 0.375rem;
font-weight: 500;
cursor: pointer;
transition: all 0.3s ease;
border: none;
}
.btn-primary {
background-color: var(--primary);
color: var(--white);
}
.btn-primary:hover {
background-color: var(--primary-dark);
}
.btn-secondary {
background-color: var(--white);
color: var(--dark);
border: 1px solid var(--gray-light);
}
.btn-secondary:hover {
background-color: #f1f5f9;
}
.btn-success {
background-color: var(--success);
color: var(--white);
}
.btn-success:hover {
background-color: #15803d;
}
/* Dashboard styles */
.dashboard {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 1rem;
margin-bottom: 1.5rem;
}
.stat-card {
background-color: var(--white);
border-radius: 0.5rem;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
padding: 1.5rem;
display: flex;
flex-direction: column;
}
.stat-title {
font-size: 0.875rem;
color: var(--gray);
margin-bottom: 0.5rem;
}
.stat-value {
font-size: 1.5rem;
font-weight: 700;
margin-bottom: 0.25rem;
}
.stat-change {
font-size: 0.875rem;
display: flex;
align-items: center;
gap: 0.25rem;
}
.stat-change.positive {
color: var(--success);
}
.stat-change.negative {
color: var(--danger);
}
.chart-container {
height: 300px;
margin-top: 1rem;
}
/* Badge styles */
.badge {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0.25rem 0.5rem;
border-radius: 9999px;
font-size: 0.75rem;
font-weight: 500;
}
.badge-success {
background-color: #dcfce7;
color: #166534;
}
.badge-warning {
background-color: #fef9c3;
color: #854d0e;
}
.badge-danger {
background-color: #fee2e2;
color: #b91c1c;
}
/* Utility classes */
.flex {
display: flex;
}
.flex-col {
flex-direction: column;
}
.items-center {
align-items: center;
}
.justify-between {
justify-content: space-between;
}
.gap-2 {
gap: 0.5rem;
}
.mt-4 {
margin-top: 1rem;
}
.mb-4 {
margin-bottom: 1rem;
}
.hidden {
display: none;
}
/* Loading indicator */
.loader {
border: 3px solid rgba(0,0,0,0.1);
border-top: 3px solid var(--primary);
border-radius: 50%;
width: 24px;
height: 24px;
animation: spin 1s linear infinite;
margin: 0 auto;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* Responsive table for narrow screens */
@media (max-width: 768px) {
.desktop-only {
display: none;
}
.dashboard {
grid-template-columns: 1fr;
}
}
Certainly! Here's the complete and final JavaScript code that you should place inside your <script> tag (after your existing code above) to fully complete your GST Invoice Processor functionality:
// Continue from where you left off...
// Update MIS reports - fills HSN, Tax Rate, and Party summary tables
function updateMISReports(data) {
hsnTable.innerHTML = '';
taxRateTable.innerHTML = '';
partyTable.innerHTML = '';
// HSN-wise summary aggregation
const hsnSummary = {};
data.forEach(item => {
const hsnCode = item['HSN Code'] || 'N/A';
if (!hsnSummary[hsnCode]) {
hsnSummary[hsnCode] = {
description: item['Description'] || '-',
totalQty: 0,
totalValue: 0,
totalGST: 0
};
}
hsnSummary[hsnCode].totalQty += parseFloat(item['Qty'] || 0);
hsnSummary[hsnCode].totalValue += parseFloat(item['Taxable Value'] || 0);
hsnSummary[hsnCode].totalGST += (parseFloat(item['CGST'] || 0) + parseFloat(item['SGST'] || 0) + parseFloat(item['IGST'] || 0));
});
Object.entries(hsnSummary).forEach(([hsnCode, summary]) => {
const row = hsnTable.insertRow();
row.insertCell(0).textContent = hsnCode;
row.insertCell(1).textContent = summary.description;
row.insertCell(2).textContent = summary.totalQty.toLocaleString(undefined, { maximumFractionDigits: 2 });
row.insertCell(3).textContent = '₹' + summary.totalValue.toLocaleString('en-IN', { maximumFractionDigits: 2 });
row.insertCell(4).textContent = '₹' + summary.totalGST.toLocaleString('en-IN', { maximumFractionDigits: 2 });
});
// Tax Rate summary aggregation
const taxRateSummary = {};
data.forEach(item => {
const taxRate = item['Tax Rate'] || 'N/A';
if (!taxRateSummary[taxRate]) {
taxRateSummary[taxRate] = {
taxableValue: 0,
cgst: 0,
sgst: 0,
igst: 0,
};
}
taxRateSummary[taxRate].taxableValue += parseFloat(item['Taxable Value'] || 0);
taxRateSummary[taxRate].cgst += parseFloat(item['CGST'] || 0);
taxRateSummary[taxRate].sgst += parseFloat(item['SGST'] || 0);
taxRateSummary[taxRate].igst += parseFloat(item['IGST'] || 0);
});
Object.entries(taxRateSummary).forEach(([rate, summary]) => {
const totalTax = summary.cgst + summary.sgst + summary.igst;
const row = taxRateTable.insertRow();
row.insertCell(0).textContent = rate;
row.insertCell(1).textContent = '₹' + summary.taxableValue.toLocaleString('en-IN', { maximumFractionDigits: 2 });
row.insertCell(2).textContent = '₹' + summary.cgst.toLocaleString('en-IN', { maximumFractionDigits: 2 });
row.insertCell(3).textContent = '₹' + summary.sgst.toLocaleString('en-IN', { maximumFractionDigits: 2 });
row.insertCell(4).textContent = '₹' + summary.igst.toLocaleString('en-IN', { maximumFractionDigits: 2 });
row.insertCell(5).textContent = '₹' + totalTax.toLocaleString('en-IN', { maximumFractionDigits: 2 });
});
// Party-wise summary aggregation
const partySummary = {};
data.forEach(item => {
const partyName = item['Party Name'] || 'N/A';
const gstin = item['GSTIN'] || 'N/A';
const key = gstin + '|' + partyName;
if (!partySummary[key]) {
partySummary[key] = {
partyName,
gstin,
invoiceCount: 0,
totalTaxable: 0,
totalGST: 0,
totalGross: 0
};
}
partySummary[key].invoiceCount++;
partySummary[key].totalTaxable += parseFloat(item['Taxable Value'] || 0);
partySummary[key].totalGST += parseFloat(item['CGST'] || 0) + parseFloat(item['SGST'] || 0) + parseFloat(item['IGST'] || 0);
partySummary[key].totalGross += parseFloat(item['Gross Amount'] || 0);
});
Object.values(partySummary).forEach(summary => {
const row = partyTable.insertRow();
row.insertCell(0).textContent = summary.partyName;
row.insertCell(1).textContent = summary.gstin;
row.insertCell(2).textContent = summary.invoiceCount;
row.insertCell(3).textContent = '₹' + summary.totalTaxable.toLocaleString('en-IN', { maximumFractionDigits: 2 });
row.insertCell(4).textContent = '₹' + summary.totalGST.toLocaleString('en-IN', { maximumFractionDigits: 2 });
row.insertCell(5).textContent = '₹' + summary.totalGross.toLocaleString('en-IN', { maximumFractionDigits: 2 });
});
}
// Chart instances
let gstDistributionChartInstance = null;
let monthlyTrendChartInstance = null;
function drawCharts(data) {
// GST Distribution by Tax Rate (Pie Chart)
const gstDist = {};
data.forEach(item => {
const rate = item['Tax Rate'] || 'N/A';
gstDist[rate] = (gstDist[rate] || 0) + parseFloat(item['Taxable Value'] || 0);
});
const labels = Object.keys(gstDist);
const values = labels.map(l => gstDist[l]);
const colors = ['#4f46e5', '#12b886', '#f59e0b', '#ef4444', '#3b82f6', '#db2777'];
// Monthly Trend data (Bar Chart)
const monthly = {};
data.forEach(item => {
const dt = parseDate(item['Date']);
if (!dt) return;
const key = `${dt.getFullYear()}-${String(dt.getMonth() + 1).padStart(2,'0')}`;
if (!monthly[key]) monthly[key] = { taxable: 0, gst: 0, gross: 0 };
monthly[key].taxable += parseFloat(item['Taxable Value'] || 0);
monthly[key].gst += parseFloat(item['CGST'] || 0) + parseFloat(item['SGST'] || 0) + parseFloat(item['IGST'] || 0);
monthly[key].gross += parseFloat(item['Gross Amount'] || 0);
});
const monthsSorted = Object.keys(monthly).sort();
const monthLabels = monthsSorted.map(m => {
const [year, mon] = m.split('-');
const date = new Date(year, mon - 1);
return date.toLocaleString('en-US', { month: 'short', year: 'numeric' });
});
const taxableVals = monthsSorted.map(m => monthly[m].taxable);
const gstVals = monthsSorted.map(m => monthly[m].gst);
const grossVals = monthsSorted.map(m => monthly[m].gross);
if (gstDistributionChartInstance) gstDistributionChartInstance.destroy();
if (monthlyTrendChartInstance) monthlyTrendChartInstance.destroy();
const ctxGSTDist = document.getElementById('gstDistributionChart').getContext('2d');
gstDistributionChartInstance = new Chart(ctxGSTDist, {
type: 'pie',
data: {
labels,
datasets: [{
data: values,
backgroundColor: colors.slice(0, labels.length),
borderWidth: 1
}]
},
options: {
responsive: true,
plugins: {
legend: { position: 'bottom' },
tooltip: {
callbacks: {
label: ctx => {
const label = ctx.label || '';
const val = ctx.parsed || 0;
const total = ctx.dataset.data.reduce((a,b) => a+b,0);
const percent = total ? ((val/total)*100).toFixed(2) : 0;
return `${label}: ₹${val.toLocaleString('en-IN', {maximumFractionDigits: 2})} (${percent}%)`;
}
}
}
}
}
});
const ctxMonthly = document.getElementById('monthlyTrendChart').getContext('2d');
monthlyTrendChartInstance = new Chart(ctxMonthly, {
type: 'bar',
data: {
labels: monthLabels,
datasets: [
{ label: 'Taxable Value', data: taxableVals, backgroundColor: '#4f46e5' },
{ label: 'GST', data: gstVals, backgroundColor: '#ef4444' },
{ label: 'Gross Amount', data: grossVals, backgroundColor: '#f97316' }
]
},
options: {
responsive: true,
scales: {
y: {
beginAtZero: true,
ticks: {
callback: val => '₹' + val.toLocaleString('en-IN')
}
}
},
plugins: {
legend: { position: 'bottom' },
tooltip: {
callbacks: {
label: ctx => `${ctx.dataset.label}: ₹${ctx.parsed.y.toLocaleString('en-IN', { maximumFractionDigits: 2 })}`
}
}
}
}
});
}
function parseDate(dateVal) {
if (typeof dateVal === 'number') {
const offset = (dateVal > 59) ? dateVal - 1 : dateVal; // Excel leap year bug fix
const epoch = new Date(Date.UTC(1899, 11, 30));
return new Date(epoch.getTime() + offset * 86400 * 1000);
}
if (dateVal instanceof Date) return dateVal;
const parsed = new Date(dateVal);
return isNaN(parsed) ? null : parsed;
}
// GST Summary Export button
const gstSummaryExportBtn = document.querySelector('.card .btn-secondary i.fa-download').parentElement;
gstSummaryExportBtn.addEventListener('click', () => {
const wb = XLSX.utils.book_new();
// GST Distribution
const gstDistData = [['Tax Rate', 'Taxable Value']];
const gstDist = {};
invoiceData.forEach(item => {
const rate = item['Tax Rate'] || 'N/A';
gstDist[rate] = (gstDist[rate] || 0) + parseFloat(item['Taxable Value'] || 0);
});
Object.entries(gstDist).forEach(([rate, val]) => gstDistData.push([rate, val.toFixed(2)]));
XLSX.utils.book_append_sheet(wb, XLSX.utils.aoa_to_sheet(gstDistData), 'GST Distribution');
// Monthly Trend
const monthly = {};
invoiceData.forEach(item => {
const dt = parseDate(item['Date']);
if (!dt) return;
const key = `${dt.getFullYear()}-${String(dt.getMonth() + 1).padStart(2, '0')}`;
if (!monthly[key]) monthly[key] = { taxable: 0, gst: 0, gross: 0 };
monthly[key].taxable += parseFloat(item['Taxable Value'] || 0);
monthly[key].gst += parseFloat(item['CGST'] || 0) + parseFloat(item['SGST'] || 0) + parseFloat(item['IGST'] || 0);
monthly[key].gross += parseFloat(item['Gross Amount'] || 0);
});
const monthsSorted = Object.keys(monthly).sort();
const monthlyData = [['Month-Year', 'Taxable Value', 'GST', 'Gross Amount']];
monthsSorted.forEach(m => {
const [year, mon] = m.split('-');
const dateLabel = new Date(year, mon - 1).toLocaleString('en-US', { month: 'short', year: 'numeric' });
const vals = monthly[m];
monthlyData.push([
dateLabel,
vals.taxable.toFixed(2),
vals.gst.toFixed(2),
vals.gross.toFixed(2)
]);
});
XLSX.utils.book_append_sheet(wb, XLSX.utils.aoa_to_sheet(monthlyData), 'Monthly Trend');
XLSX.writeFile(wb, 'GST_Summary.xlsx');
});
If you want the fully combined HTML + JS or have any further customization requests, feel free to ask!
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Poppins', sans-serif;
background-color: #f1f5f9;
color: var(--dark);
line-height: 1.6;
}
/* Header styles */
.header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 1rem 2rem;
background-color: var(--white);
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.logo {
font-size: 1.5rem;
font-weight: 700;
color: var(--primary);
display: flex;
align-items: center;
gap: 0.5rem;
}
/* Main content styles */
.container {
max-width: 1280px;
margin: 2rem auto;
padding: 0 1rem;
}
.card {
background-color: var(--white);
border-radius: 0.5rem;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
padding: 1.5rem;
margin-bottom: 1.5rem;
}
.card-title {
font-size: 1.25rem;
font-weight: 600;
margin-bottom: 1rem;
color: var(--dark);
display: flex;
align-items: center;
gap: 0.5rem;
}
/* Upload area styles */
.upload-area {
border: 2px dashed var(--gray-light);
border-radius: 0.5rem;
padding: 2rem;
text-align: center;
cursor: pointer;
transition: all 0.3s ease;
}
.upload-area:hover {
border-color: var(--primary);
}
.upload-icon {
font-size: 3rem;
color: var(--primary);
margin-bottom: 1rem;
}
.upload-text {
font-size: 1rem;
color: var(--gray);
margin-bottom: 1rem;
}
.upload-btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
background-color: var(--primary);
color: var(--white);
padding: 0.75rem 1.5rem;
border-radius: 0.375rem;
font-weight: 500;
cursor: pointer;
transition: background-color 0.3s ease;
border: none;
}
.upload-btn:hover {
background-color: var(--primary-dark);
}
/* Tab styles */
.tabs {
display: flex;
border-bottom: 1px solid var(--gray-light);
margin-bottom: 1.5rem;
}
.tab {
padding: 0.75rem 1.5rem;
cursor: pointer;
font-weight: 500;
border-bottom: 2px solid transparent;
transition: all 0.3s ease;
}
.tab.active {
color: var(--primary);
border-bottom: 2px solid var(--primary);
}
/* Table styles */
.table-container {
overflow-x: auto;
margin-top: 1rem;
}
table {
width: 100%;
border-collapse: collapse;
text-align: left;
font-size: 0.875rem;
}
th {
background-color: #f8fafc;
padding: 0.75rem 1rem;
font-weight: 600;
border-bottom: 1px solid var(--gray-light);
}
td {
padding: 0.75rem 1rem;
border-bottom: 1px solid var(--gray-light);
}
tr:last-child td {
border-bottom: none;
}
tr:hover {
background-color: #f1f5f9;
}
/* Button styles */
.btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
padding: 0.5rem 1rem;
border-radius: 0.375rem;
font-weight: 500;
cursor: pointer;
transition: all 0.3s ease;
border: none;
}
.btn-primary {
background-color: var(--primary);
color: var(--white);
}
.btn-primary:hover {
background-color: var(--primary-dark);
}
.btn-secondary {
background-color: var(--white);
color: var(--dark);
border: 1px solid var(--gray-light);
}
.btn-secondary:hover {
background-color: #f1f5f9;
}
.btn-success {
background-color: var(--success);
color: var(--white);
}
.btn-success:hover {
background-color: #15803d;
}
/* Dashboard styles */
.dashboard {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 1rem;
margin-bottom: 1.5rem;
}
.stat-card {
background-color: var(--white);
border-radius: 0.5rem;
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
padding: 1.5rem;
display: flex;
flex-direction: column;
}
.stat-title {
font-size: 0.875rem;
color: var(--gray);
margin-bottom: 0.5rem;
}
.stat-value {
font-size: 1.5rem;
font-weight: 700;
margin-bottom: 0.25rem;
}
.stat-change {
font-size: 0.875rem;
display: flex;
align-items: center;
gap: 0.25rem;
}
.stat-change.positive {
color: var(--success);
}
.stat-change.negative {
color: var(--danger);
}
.chart-container {
height: 300px;
margin-top: 1rem;
}
/* Badge styles */
.badge {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0.25rem 0.5rem;
border-radius: 9999px;
font-size: 0.75rem;
font-weight: 500;
}
.badge-success {
background-color: #dcfce7;
color: #166534;
}
.badge-warning {
background-color: #fef9c3;
color: #854d0e;
}
.badge-danger {
background-color: #fee2e2;
color: #b91c1c;
}
/* Utility classes */
.flex {
display: flex;
}
.flex-col {
flex-direction: column;
}
.items-center {
align-items: center;
}
.justify-between {
justify-content: space-between;
}
.gap-2 {
gap: 0.5rem;
}
.mt-4 {
margin-top: 1rem;
}
.mb-4 {
margin-bottom: 1rem;
}
.hidden {
display: none;
}
/* Loading indicator */
.loader {
border: 3px solid rgba(0,0,0,0.1);
border-top: 3px solid var(--primary);
border-radius: 50%;
width: 24px;
height: 24px;
animation: spin 1s linear infinite;
margin: 0 auto;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* Responsive table for narrow screens */
@media (max-width: 768px) {
.desktop-only {
display: none;
}
.dashboard {
grid-template-columns: 1fr;
}
}
Your provided code is already quite comprehensive and near complete. I'll provide the remaining JavaScript to fully enable all functionality and ensure the page works as intended — including connecting the export button in GST Summary, fixing any missing exports handlers from tabs, and ensuring everything is tied together smoothly.
// Wrap in DOMContentLoaded for safe initialization (already inside)
// 1. To ensure GST Summary Export button works properly, confirm the query selector:
const gstSummaryExportBtn = document.querySelector('.card .btn-secondary i.fa-download').closest('button');
if (gstSummaryExportBtn) {
gstSummaryExportBtn.addEventListener('click', () => {
const wb = XLSX.utils.book_new();
// GST Distribution sheet data as [Tax Rate, Taxable Value]
const gstDistributionData = [['Tax Rate', 'Taxable Value']];
const gstDist = {};
invoiceData.forEach(item => {
const rate = item['Tax Rate'] || 'N/A';
gstDist[rate] = (gstDist[rate] || 0) + parseFloat(item['Taxable Value'] || 0);
});
Object.entries(gstDist).forEach(([rate, val]) => gstDistributionData.push([rate, val.toFixed(2)]));
XLSX.utils.book_append_sheet(wb, XLSX.utils.aoa_to_sheet(gstDistributionData), 'GST Distribution');
// Monthly Trend data as [Month-Year, Taxable Value, GST, Gross Amount]
const monthly = {};
invoiceData.forEach(item => {
const dt = parseDate(item['Date']);
if (!dt) return;
const key = `${dt.getFullYear()}-${String(dt.getMonth() + 1).padStart(2, '0')}`;
if (!monthly[key]) monthly[key] = { taxable: 0, gst: 0, gross: 0 };
monthly[key].taxable += parseFloat(item['Taxable Value'] || 0);
monthly[key].gst += parseFloat(item['CGST'] || 0) + parseFloat(item['SGST'] || 0) + parseFloat(item['IGST'] || 0);
monthly[key].gross += parseFloat(item['Gross Amount'] || 0);
});
const monthsSorted = Object.keys(monthly).sort();
const monthlyData = [['Month-Year', 'Taxable Value', 'GST', 'Gross Amount']];
monthsSorted.forEach(m => {
const [year, mon] = m.split('-');
const dateLabel = new Date(year, mon - 1).toLocaleString('en-US', { month: 'short', year: 'numeric' });
const vals = monthly[m];
monthlyData.push([
dateLabel,
vals.taxable.toFixed(2),
vals.gst.toFixed(2),
vals.gross.toFixed(2)
]);
});
XLSX.utils.book_append_sheet(wb, XLSX.utils.aoa_to_sheet(monthlyData), 'Monthly Trend');
XLSX.writeFile(wb, 'GST_Summary.xlsx');
});
}
// 2. Add Export for GST Data tab (GST Data Export)
const gstDataExportBtn = document.querySelector('#gstData .btn-success');
if (gstDataExportBtn) {
gstDataExportBtn.addEventListener('click', () => {
exportTableToExcel('gstTable', 'GST_Data');
});
}
// 3. (Optional) Implement Filter on Invoice Data Search Input on "Enter" key press as well
invoiceSearchInput.addEventListener('keypress', e => {
if (e.key === 'Enter') invoiceSearchBtn.click();
});
// 4. Handle "Choose File" button click inside upload area (already the whole upload area triggers file input click, so this is covered)
// 5. Pagination Buttons (Stub handlers - implement pagination logic if desired)
const prevBtn = document.querySelector('#invoiceData .btn-secondary:nth-last-child(2)');
const nextBtn = document.querySelector('#invoiceData .btn-primary');
if (prevBtn) {
prevBtn.addEventListener('click', () => {
alert('Previous page pagination can be implemented.');
});
}
if (nextBtn) {
nextBtn.addEventListener('click', () => {
alert('Next page pagination can be implemented.');
});
}
// 6. Filter button inside Invoice Data tab is present but no code; you might want to implement custom filters if needed
// 7. (Optional) For better UX: Clear 'View' button listener closure issue by using data attributes or ES6 closure (already fine)
// -- All other code & functionality appears implemented and wired --
}); // End DOMContentLoaded
If you'd like me to package the entire page code (HTML+CSS+JS) together or have any further customization requests — please feel free to ask!
Not yet included in a published release.
<div id="resultsSection" class="hidden">
<div class="dashboard">
<div class="stat-card">
<div class="stat-title">Total Invoices</div>
<div class="stat-value" id="totalInvoices">0</div>
<div class="flex items-center justify-between">
<div class="stat-change positive">
<i class="fas fa-arrow-up"></i>
<span>4.75%</span>
</div>
<span class="text-gray-500 text-sm">vs. last month</span>
</div>
</div>
<div class="stat-card">
<div class="stat-title">Total GST Amount</div>
<div class="stat-value" id="totalGST">₹0.00</div>
<div class="flex items-center justify-between">
<div class="stat-change positive">
<i class="fas fa-arrow-up"></i>
<span>2.5%</span>
</div>
<span class="text-gray-500 text-sm">vs. last month</span>
</div>
</div>
<div class="stat-card">
<div class="stat-title">Total Taxable Value</div>
<div class="stat-value" id="totalTaxable">₹0.00</div>
<div class="flex items-center justify-between">
<div class="stat-change positive">
<i class="fas fa-arrow-up"></i>
<span>3.2%</span>
</div>
<span class="text-gray-500 text-sm">vs. last month</span>
</div>
</div>
<div class="stat-card">
<div class="stat-title">Total Gross Amount</div>
<div class="stat-value" id="totalGross">₹0.00</div>
<div class="flex items-center justify-between">
<div class="stat-change positive">
<i class="fas fa-arrow-up"></i>
<span>5.1%</span>
</div>
<span class="text-gray-500 text-sm">vs. last month</span>
</div>
</div>
</div>
<div class="card">
<div class="flex items-center justify-between mb-4">
<h2 class="card-title"><i class="fas fa-chart-pie"></i> GST Summary</h2>
<button class="btn btn-secondary">
<i class="fas fa-download"></i>
Export
</button>
</div>
<div class="flex flex-col md:flex-row gap-2">
<div class="chart-container" style="flex: 1;">
<canvas id="gstDistributionChart"></canvas>
</div>
<div class="chart-container" style="flex: 1;">
<canvas id="monthlyTrendChart"></canvas>
</div>
</div>
</div>
<div class="card">
<div class="tabs">
<div class="tab active" data-tab="invoiceData">Invoice Data</div>
<div class="tab" data-tab="gstData">GST Data</div>
<div class="tab" data-tab="misReports">MIS Reports</div>
</div>
<div id="invoiceData" class="tab-content">
<div class="flex items-center justify-between mb-4">
<div class="flex items-center gap-2">
<input type="text" placeholder="Search invoices..." class="px-3 py-2 border border-gray-300 rounded-md">
<button class="btn btn-secondary">
<i class="fas fa-search"></i>
Search
</button>
</div>
<div class="flex items-center gap-2">
<button class="btn btn-secondary">
<i class="fas fa-filter"></i>
Filter
</button>
<button class="btn btn-success">
<i class="fas fa-download"></i>
Export
</button>
</div>
</div>
<div class="table-container">
<table id="invoiceTable">
<thead>
<tr>
<th>S.No</th>
<th>Date</th>
<th>Party Name</th>
<th>GSTIN</th>
<th>Invoice No.</th>
<th>Commodity</th>
<th>Qty</th>
<th>Taxable Value</th>
<th>GST</th>
<th>Gross Amount</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<!-- This will be populated by JavaScript -->
</tbody>
</table>
</div>
<div class="flex items-center justify-between mt-4">
<div>
<span>Showing 1-10 of 100 entries</span>
</div>
<div class="flex items-center gap-2">
<button class="btn btn-secondary">Previous</button>
<button class="btn btn-primary">Next</button>
</div>
</div>
</div>
<div id="gstData" class="tab-content hidden">
<div class="flex items-center justify-between mb-4">
<div class="flex items-center gap-2">
<select class="px-3 py-2 border border-gray-300 rounded-md">
<option>All Tax Rates</option>
<option>5%</option>
<option>12%</option>
<option>18%</option>
<option>28%</option>
</select>
<button class="btn btn-secondary">
<i class="fas fa-filter"></i>
Apply
</button>
</div>
<div>
<button class="btn btn-success">
<i class="fas fa-download"></i>
Export GST Report
</button>
</div>
</div>
<div class="table-container">
<table id="gstTable">
<thead>
<tr>
<th>S.No</th>
<th>GSTIN</th>
<th>Party Name</th>
<th>Invoice No.</th>
<th>Date</th>
<th>HSN Code</th>
<th>Tax Rate</th>
<th>Taxable Value</th>
<th>CGST</th>
<th>SGST</th>
<th>IGST</th>
<th>Total GST</th>
</tr>
</thead>
<tbody>
<!-- This will be populated by JavaScript -->
</tbody>
</table>
</div>
</div>
<div id="misReports" class="tab-content hidden">
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
<div class="card">
<h3 class="card-title"><i class="fas fa-tag"></i> HSN-wise Summary</h3>
<div class="table-container">
<table id="hsnTable">
<thead>
<tr>
<th>HSN Code</th>
<th>Description</th>
<th>Total Qty</th>
<th>Total Value</th>
<th>Total GST</th>
</tr>
</thead>
<tbody>
<!-- This will be populated by JavaScript -->
</tbody>
</table>
</div>
</div>
<div class="card">
<h3 class="card-title"><i class="fas fa-percentage"></i> Tax Rate Summary</h3>
<div class="table-container">
<table id="taxRateTable">
<thead>
<tr>
<th>Tax Rate</th>
<th>Taxable Value</th>
<th>CGST</th>
<th>SGST</th>
<th>IGST</th>
<th>Total Tax</th>
</tr>
</thead>
<tbody>
<!-- This will be populated by JavaScript -->
</tbody>
</table>
</div>
</div>
</div>
<div class="card">
<h3 class="card-title"><i class="fas fa-user"></i> Party-wise Summary</h3>
<div class="table-container">
<table id="partyTable">
<thead>
<tr>
<th>Party Name</th>
<th>GSTIN</th>
<th>No. of Invoices</th>
<th>Total Taxable Value</th>
<th>Total GST</th>
<th>Total Gross</th>
</tr>
</thead>
<tbody>
<!-- This will be populated by JavaScript -->
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<div id="resultsSection" class="hidden">
<div class="dashboard">
<div class="stat-card">
<div class="stat-title">Total Invoices</div>
<div class="stat-value" id="totalInvoices">0</div>
<div class="flex items-center justify-between">
<div class="stat-change positive">
<i class="fas fa-arrow-up"></i>
<span>4.75%</span>
</div>
<span class="text-gray-500 text-sm">vs. last month</span>
</div>
</div>
<div class="stat-card">
<div class="stat-title">Total GST Amount</div>
<div class="stat-value" id="totalGST">₹0.00</div>
<div class="flex items-center justify-between">
<div class="stat-change positive">
<i class="fas fa-arrow-up"></i>
<span>2.5%</span>
</div>
<span class="text-gray-500 text-sm">vs. last month</span>
</div>
</div>
<div class="stat-card">
<div class="stat-title">Total Taxable Value</div>
<div class="stat-value" id="totalTaxable">₹0.00</div>
<div class="flex items-center justify-between">
<div class="stat-change positive">
<i class="fas fa-arrow-up"></i>
<span>3.2%</span>
</div>
<span class="text-gray-500 text-sm">vs. last month</span>
</div>
</div>
<div class="stat-card">
<div class="stat-title">Total Gross Amount</div>
<div class="stat-value" id="totalGross">₹0.00</div>
<div class="flex items-center justify-between">
<div class="stat-change positive">
<i class="fas fa-arrow-up"></i>
<span>5.1%</span>
</div>
<span class="text-gray-500 text-sm">vs. last month</span>
</div>
</div>
</div>
<div class="card">
<div class="flex items-center justify-between mb-4">
<h2 class="card-title"><i class="fas fa-chart-pie"></i> GST Summary</h2>
<button class="btn btn-secondary">
<i class="fas fa-download"></i>
Export
</button>
</div>
<div class="flex flex-col md:flex-row gap-2">
<div class="chart-container" style="flex: 1;">
<canvas id="gstDistributionChart"></canvas>
</div>
<div class="chart-container" style="flex: 1;">
<canvas id="monthlyTrendChart"></canvas>
</div>
</div>
</div>
<div class="card">
<div class="tabs">
<div class="tab active" data-tab="invoiceData">Invoice Data</div>
<div class="tab" data-tab="gstData">GST Data</div>
<div class="tab" data-tab="misReports">MIS Reports</div>
</div>
<div id="invoiceData" class="tab-content">
<div class="flex items-center justify-between mb-4">
<div class="flex items-center gap-2">
<input type="text" placeholder="Search invoices..." class="px-3 py-2 border border-gray-300 rounded-md">
<button class="btn btn-secondary">
<i class="fas fa-search"></i>
Search
</button>
</div>
<div class="flex items-center gap-2">
<button class="btn btn-secondary">
<i class="fas fa-filter"></i>
Filter
</button>
<button class="btn btn-success">
<i class="fas fa-download"></i>
Export
</button>
</div>
</div>
<div class="table-container">
<table id="invoiceTable">
<thead>
<tr>
<th>S.No</th>
<th>Date</th>
<th>Party Name</th>
<th>GSTIN</th>
<th>Invoice No.</th>
<th>Commodity</th>
<th>Qty</th>
<th>Taxable Value</th>
<th>GST</th>
<th>Gross Amount</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<!-- This will be populated by JavaScript -->
</tbody>
</table>
</div>
<div class="flex items-center justify-between mt-4">
<div>
<span>Showing 1-10 of 100 entries</span>
</div>
<div class="flex items-center gap-2">
<button class="btn btn-secondary">Previous</button>
<button class="btn btn-primary">Next</button>
</div>
</div>
</div>
<div id="gstData" class="tab-content hidden">
<div class="flex items-center justify-between mb-4">
<div class="flex items-center gap-2">
<select class="px-3 py-2 border border-gray-300 rounded-md">
<option>All Tax Rates</option>
<option>5%</option>
<option>12%</option>
<option>18%</option>
<option>28%</option>
</select>
<button class="btn btn-secondary">
<i class="fas fa-filter"></i>
Apply
</button>
</div>
<div>
<button class="btn btn-success">
<i class="fas fa-download"></i>
Export GST Report
</button>
</div>
</div>
<div class="table-container">
<table id="gstTable">
<thead>
<tr>
<th>S.No</th>
<th>GSTIN</th>
<th>Party Name</th>
<th>Invoice No.</th>
<th>Date</th>
<th>HSN Code</th>
<th>Tax Rate</th>
<th>Taxable Value</th>
<th>CGST</th>
<th>SGST</th>
<th>IGST</th>
<th>Total GST</th>
</tr>
</thead>
<tbody>
<!-- This will be populated by JavaScript -->
</tbody>
</table>
</div>
</div>
<div id="misReports" class="tab-content hidden">
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
<div class="card">
<h3 class="card-title"><i class="fas fa-tag"></i> HSN-wise Summary</h3>
<div class="table-container">
<table id="hsnTable">
<thead>
<tr>
<th>HSN Code</th>
<th>Description</th>
<th>Total Qty</th>
<th>Total Value</th>
<th>Total GST</th>
</tr>
</thead>
<tbody>
<!-- This will be populated by JavaScript -->
</tbody>
</table>
</div>
</div>
<div class="card">
<h3 class="card-title"><i class="fas fa-percentage"></i> Tax Rate Summary</h3>
<div class="table-container">
<table id="taxRateTable">
<thead>
<tr>
<th>Tax Rate</th>
<th>Taxable Value</th>
<th>CGST</th>
<th>SGST</th>
<th>IGST</th>
<th>Total Tax</th>
</tr>
</thead>
<tbody>
<!-- This will be populated by JavaScript -->
</tbody>
</table>
</div>
</div>
</div>
<div class="card">
<h3 class="card-title"><i class="fas fa-user"></i> Party-wise Summary</h3>
<div class="table-container">
<table id="partyTable">
<thead>
<tr>
<th>Party Name</th>
<th>GSTIN</th>
<th>No. of Invoices</th>
<th>Total Taxable Value</th>
<th>Total GST</th>
<th>Total Gross</th>
</tr>
</thead>
<tbody>
<!-- This will be populated by JavaScript -->
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>