<!DOCTYPE html>
<html lang="si">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Evrixy | Business Management Suite</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
background: radial-gradient(circle at 10% 20%, #0a0f1e, #03060c);
font-family: 'Segoe UI', 'Poppins', system-ui, -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
color: #edf2ff;
padding: 24px 20px;
}
/* container */
.evrixy-container {
max-width: 1600px;
margin: 0 auto;
}
/* header */
.header {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
margin-bottom: 30px;
padding-bottom: 15px;
border-bottom: 1px solid rgba(139, 92, 246, 0.4);
}
.logo h1 {
font-size: 2.1rem;
background: linear-gradient(130deg, #c084fc, #a855f7, #7c3aed);
-webkit-background-clip: text;
background-clip: text;
color: transparent;
letter-spacing: -0.5px;
}
.logo p {
font-size: 0.8rem;
color: #a78bfa;
}
.date-badge {
background: #1e1a3a;
padding: 10px 20px;
border-radius: 60px;
font-weight: 500;
border: 1px solid #5b3e9e;
}
/* grid */
.grid-3 {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
gap: 24px;
margin-bottom: 30px;
}
.grid-2 {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
gap: 24px;
margin-bottom: 30px;
}
/* cards */
.card {
background: rgba(18, 22, 45, 0.75);
backdrop-filter: blur(8px);
border-radius: 36px;
padding: 1.3rem;
border: 1px solid #2d2a5c;
box-shadow: 0 20px 35px -12px rgba(0, 0, 0, 0.5);
transition: all 0.2s ease;
}
.card:hover {
border-color: #a855f7;
background: rgba(25, 30, 55, 0.85);
}
.card h2 {
font-size: 1.4rem;
margin-bottom: 1rem;
border-left: 4px solid #c084fc;
padding-left: 14px;
display: flex;
align-items: center;
gap: 8px;
}
hr {
margin: 15px 0;
border-color: #2d2b4e;
}
/* inputs & buttons */
input, select, textarea {
background: #0c0f23;
border: 1px solid #39376b;
border-radius: 28px;
padding: 10px 16px;
color: white;
width: 100%;
margin: 6px 0;
font-size: 0.9rem;
transition: 0.2s;
}
input:focus, select:focus, textarea:focus {
outline: none;
border-color: #b77eff;
}
button, .btn-sm {
background: #2a235a;
border: none;
padding: 8px 16px;
border-radius: 32px;
color: white;
font-weight: 500;
cursor: pointer;
margin: 4px 4px 0 0;
transition: 0.2s;
font-size: 0.8rem;
}
button:hover {
background: #5b3e9e;
transform: scale(1.02);
}
.danger-btn {
background: #792828;
}
.danger-btn:hover {
background: #a13e3e;
}
.success-btn {
background: #1f6d5c;
}
/* lists */
.task-item, .expense-item, .inv-item {
background: #0b0e20;
margin: 8px 0;
padding: 10px 14px;
border-radius: 28px;
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 8px;
}
.delete-btn {
background: #561c1c;
padding: 4px 14px;
font-size: 0.7rem;
}
.badge {
background: #1f3b5c;
padding: 4px 10px;
border-radius: 30px;
font-size: 0.7rem;
}
.summary-panel {
display: flex;
justify-content: space-between;
flex-wrap: wrap;
gap: 12px;
margin-top: 12px;
}
.stat-box {
background: #0a0c1a;
border-radius: 24px;
padding: 8px 14px;
text-align: center;
flex: 1;
}
footer {
text-align: center;
margin-top: 40px;
font-size: 0.7rem;
opacity: 0.6;
}
@media (max-width: 700px) {
body { padding: 12px; }
}
</style>
</head>
<body>
<!-- LOCK SCREEN (password only for you) -->
<div id="lockScreen" style="position:fixed; top:0; left:0; width:100%; height:100%; background:#010115e6; backdrop-filter: blur(16px); display:flex; align-items:center; justify-content:center; z-index:9999;">
<div style="background:#12142b; padding: 2rem; border-radius: 3rem; text-align: center; border:1px solid #a473f0; width: 320px;">
<h2 style="color:#d9b4ff;">🔐 EVRIXY</h2>
<p>ව්යාපාරික කළමනාකරණ පිවිසුම</p>
<input type="password" id="accessPassword" placeholder="Enter master key" style="margin:15px 0; text-align:center;">
<br><button onclick="verifyPassword()">ඇතුල් වන්න</button>
<p style="font-size:11px; margin-top:18px;">* ඔබට පමණක් ප්රවේශ විය හැක</p>
</div>
</div>
<!-- MAIN DASHBOARD (hidden until pass) -->
<div id="mainApp" style="display: none;">
<div class="evrixy-container">
<div class="header">
<div class="logo">
<h1>🔷 EVRIXY</h1>
<p>Business Intelligence | Time + Finance + Planning</p>
</div>
<div class="date-badge" id="liveDate"></div>
</div>
<!-- ROW 1: TIME BLOCKS (6 blocks custom) + DAILY TASKS -->
<div class="grid-2">
<!-- TIME BLOCKS MODULE -->
<div class="card">
<h2>⏱️ 24h TIME BLOCKS</h2>
<div id="timeBlocksPanel"></div>
<div style="display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px;">
<button onclick="saveTimeBlocks()">💾 Save Blocks</button>
<button onclick="exportBlocksCSV()">📥 CSV Export</button>
</div>
</div>
<!-- DAILY TASK MANAGER -->
<div class="card">
<h2>✅ Daily Tasks</h2>
<div style="display:flex; gap:8px; flex-wrap:wrap;">
<input type="text" id="taskInput" placeholder="නව කාර්යයක් ...">
<button onclick="addTask()">➕ Add</button>
</div>
<div id="taskListContainer"></div>
<div style="margin-top: 10px;">
<button onclick="exportTasksCSV()">📋 Tasks CSV</button>
<button onclick="clearCompletedTasks()" class="btn-sm">✔️ Clear Done</button>
</div>
</div>
</div>
<!-- ROW 2: EXPENSES + CASH FLOW + INVENTORY (ඉන්වෙන්ටරි) -->
<div class="grid-3">
<!-- Daily Expenses -->
<div class="card">
<h2>💰 Daily Expenses</h2>
<div style="display:flex; gap:6px; flex-wrap:wrap;">
<input type="text" id="expName" placeholder="වියදම (උද: ඉන්ධන)" style="flex:2">
<input type="number" id="expAmount" placeholder="මුදල" style="flex:1">
<button onclick="addExpense()">➕ Add</button>
</div>
<div id="expenseListContainer"></div>
<div><strong>අද එකතුව: Rs. <span id="todayExpTotal">0</span></strong></div>
<div><strong>මෙම මාසය: Rs. <span id="monthExpTotal">0</span></strong></div>
<button onclick="exportExpensesCSV()" class="btn-sm">📊 Export Expenses</button>
</div>
<!-- Cash Flow / Income Tracker (ආදායම්) -->
<div class="card">
<h2>📈 Cash Flow (Income)</h2>
<div style="display:flex; gap:6px; flex-wrap:wrap;">
<input type="text" id="incomeSource" placeholder="මූලාශ්රය (ව්යාපාර/රැකියා)" style="flex:2">
<input type="number" id="incomeAmount" placeholder="Rs." style="flex:1">
<button onclick="addIncome()">➕ Add Income</button>
</div>
<div id="incomeListContainer"></div>
<div><strong>මාසික ඉපැයීම්: Rs. <span id="monthlyIncomeTotal">0</span></strong></div>
<div><strong>ශුද්ධ ලාභය: Rs. <span id="netProfit">0</span></strong></div>
<button onclick="exportIncomeCSV()">📥 Income CSV</button>
</div>
<!-- Simple Inventory (Stock) -->
<div class="card">
<h2>📦 Inventory (භාණ්ඩ තොග)</h2>
<div style="display:flex; gap:6px;">
<input type="text" id="itemName" placeholder="භාණ්ඩය">
<input type="number" id="itemQty" placeholder="ප්රමාණය">
<button onclick="addInventoryItem()">➕ Add</button>
</div>
<div id="inventoryContainer"></div>
<button onclick="exportInventoryCSV()">📄 Stock CSV</button>
</div>
</div>
<!-- ROW 3: MONTHLY PLANNER + NOTES + PASSWORD BACKUP -->
<div class="grid-2">
<!-- Business planning / monthly goals -->
<div class="card">
<h2>📅 Strategic Planning</h2>
<label>මාසික ඉලක්කගත ආදායම (Rs)</label>
<input type="number" id="monthlyTargetIncome" placeholder="අරමුණ">
<label>මාසික වියදම් සීමාව (Rs)</label>
<input type="number" id="monthlyBudgetLimit" placeholder="වියදම් සීමාව">
<button onclick="savePlanningGoals()">💾 Save Goals</button>
<hr>
<div class="summary-panel">
<div class="stat-box">🎯 Target: <span id="displayTarget">0</span></div>
<div class="stat-box">⚠️ Budget: <span id="displayBudget">0</span></div>
</div>
<div id="alertMsg" style="margin-top: 12px; font-size:0.8rem;"></div>
</div>
<!-- Daily & Business Notes + Export All -->
<div class="card">
<h2>📝 Notes & Data Security</h2>
<textarea id="businessNote" rows="2" placeholder="ව්යාපාරික සටහන් / අදහස් / reminders ..."></textarea>
<button onclick="saveNote()">💾 Save Note</button>
<hr>
<button onclick="exportFullBackup()" class="success-btn">🛡️ සම්පූර්ණ Backup (CSV)</button>
<button onclick="resetAllEvrixyData()" class="danger-btn">⚠️ Reset සියල්ල මකන්න</button>
<div style="margin-top:10px;"><span class="badge">🔒 දත්ත ඔබගේ බ්රවුසරයේ සුරකිනු ලැබේ</span></div>
</div>
</div>
<footer>Evrixy Business Suite | Time + Accounts + Planning 2025–2028</footer>
</div>
</div>
<script>
// ======================= PASSWORD ==========================
function verifyPassword() {
let pwd = document.getElementById("accessPassword").value;
if(pwd === "EvrixyAdmin2025") {
document.getElementById("lockScreen").style.display = "none";
document.getElementById("mainApp").style.display = "block";
loadAllEvrixyData();
startRealTimeClock();
} else {
alert("මුරපදය වැරදියි. ඔබට පමණි.");
}
}
// ======================= GLOBAL DATA =======================
let tasks = []; // { text, completed }
let expenses = []; // { name, amount, date (YYYY-MM-DD) }
let incomes = []; // { source, amount, date }
let inventory = []; // { item, quantity }
let timeBlocks = [
{ time: "12am – 04am", task: "Sleep / Rest" },
{ time: "04am – 08am", task: "Morning + Family" },
{ time: "08am – 12pm", task: "Tyer Work / Business" },
{ time: "12pm – 04pm", task: "Core Work / Business" },
{ time: "04pm – 08pm", task: "Break + Cleaning" },
{ time: "08pm – 12am", task: "Evrixy Business" }
];
let monthlyTarget = 50000;
let monthlyBudgetLimit = 30000;
let businessNote = "";
// helpers
function getToday() { let d = new Date(); return d.toISOString().split('T')[0]; }
function getCurrentMonth() { return getToday().slice(0,7); }
// ========== TIME BLOCKS ==========
function renderTimeBlocks() {
let container = document.getElementById("timeBlocksPanel");
if(!container) return;
let html = `<table style="width:100%; border-collapse:collapse;">`;
timeBlocks.forEach((block, idx) => {
html += `<tr>
<td style="padding:6px; width:35%;">${block.time}</td>
<td><input type="text" id="blockEdit${idx}" value="${escapeHtml(block.task)}" style="width:100%"></td>
</tr>`;
});
html += `</table>`;
container.innerHTML = html;
}
function saveTimeBlocks() {
for(let i=0; i<timeBlocks.length; i++) {
let newVal = document.getElementById(`blockEdit${i}`).value;
if(newVal) timeBlocks[i].task = newVal;
}
localStorage.setItem("evrixy_timeblocks", JSON.stringify(timeBlocks));
alert("Time blocks saved");
}
function exportBlocksCSV() {
let csv = "TimeBlock,Activity\n"+timeBlocks.map(b=>`"${b.time}","${b.task}"`).join("\n");
downloadCSV(csv, "Evrixy_TimeBlocks.csv");
}
// ========== TASKS ==========
function renderTasks() {
let container = document.getElementById("taskListContainer");
if(tasks.length===0){ container.innerHTML="<i>කාර්යයන් නැත</i>"; return; }
let html="";
tasks.forEach((t,idx)=>{
let checked = t.completed ? "checked" : "";
html+=`<div class="task-item"><label style="display:flex; gap:12px;"><input type="checkbox" ${checked} onchange="toggleTask(${idx})"><span style="${t.completed ? 'text-decoration:line-through; opacity:0.7':''}">${escapeHtml(t.text)}</span></label><button class="delete-btn" onclick="deleteTask(${idx})">🗑️</button></div>`;
});
container.innerHTML=html;
updateTaskPercent();
}
function addTask(){ let inp=document.getElementById("taskInput"); if(inp.value.trim()==="") return; tasks.push({text:inp.value.trim(),completed:false}); inp.value=""; saveTasks(); renderTasks();}
function toggleTask(idx){ tasks[idx].completed=!tasks[idx].completed; saveTasks(); renderTasks();}
function deleteTask(idx){ tasks.splice(idx,1); saveTasks(); renderTasks();}
function clearCompletedTasks(){ tasks = tasks.filter(t=>!t.completed); saveTasks(); renderTasks();}
function updateTaskPercent(){ let total=tasks.length, done=tasks.filter(t=>t.completed).length; let percent=(total===0?0:Math.round((done/total)*100)); document.getElementById("taskCompletionPercent")?document.getElementById("taskCompletionPercent").innerText=percent:null;}
function saveTasks(){ localStorage.setItem("evrixy_tasks", JSON.stringify(tasks)); }
// ========== EXPENSES ==========
function renderExpenses(){
let today = getToday();
let todays = expenses.filter(e=>e.date===today);
let container=document.getElementById("expenseListContainer");
if(todays.length===0){ container.innerHTML="<i>අද වියදම් නැත</i>"; }
else{
let html="";
todays.forEach((exp,idx_orig)=>{
let originalIdx = expenses.findIndex(e=>e===exp);
html+=`<div class="expense-item"><span>${escapeHtml(exp.name)} - Rs.${exp.amount}</span><button class="delete-btn" onclick="deleteExpense(${originalIdx})">🗑️</button></div>`;
});
container.innerHTML=html;
}
let dailyTotal = todays.reduce((s,e)=>s+e.amount,0);
document.getElementById("todayExpTotal").innerText=dailyTotal;
let monthTotal = expenses.filter(e=>e.date.startsWith(getCurrentMonth())).reduce((s,e)=>s+e.amount,0);
document.getElementById("monthExpTotal").innerText=monthTotal;
updateProfit();
}
function addExpense(){
let name=document.getElementById("expName").value.trim();
let amt=parseFloat(document.getElementById("expAmount").value);
if(name==="" || isNaN(amt)){ alert("නම සහ මුදල ඇතුලත් කරන්න"); return; }
expenses.push({name, amount:amt, date:getToday()});
document.getElementById("expName").value="";
document.getElementById("expAmount").value="";
saveExpenses();
renderExpenses();
}
function deleteExpense(idx){ expenses.splice(idx,1); saveExpenses(); renderExpenses(); }
function saveExpenses(){ localStorage.setItem("evrixy_expenses", JSON.stringify(expenses)); }
// ========== INCOMES ==========
function renderIncomes(){
let container=document.getElementById("incomeListContainer");
let monthIncomes = incomes.filter(i=>i.date && i.date.startsWith(getCurrentMonth()));
if(monthIncomes.length===0){ container.innerHTML="<i>මෙම මාසයේ ආදායම් නැත</i>"; }
else{
let html="";
monthIncomes.forEach((inc,idx_global)=>{
let original = incomes.findIndex(inn=>inn===inc);
html+=`<div class="expense-item"><span>${escapeHtml(inc.source)} - Rs.${inc.amount}</span><button class="delete-btn" onclick="deleteIncome(${original})">🗑️</button></div>`;
});
container.innerHTML=html;
}
let monthTotal = monthIncomes.reduce((s,i)=>s+i.amount,0);
document.getElementById("monthlyIncomeTotal").innerText=monthTotal;
updateProfit();
}
function addIncome(){
let src=document.getElementById("incomeSource").value.trim();
let amt=parseFloat(document.getElementById("incomeAmount").value);
if(src==="" || isNaN(amt)){ alert("ආදායම් මූලාශ්රය සහ මුදල ඇතුලත් කරන්න"); return; }
incomes.push({source:src, amount:amt, date:getToday()});
document.getElementById("incomeSource").value="";
document.getElementById("incomeAmount").value="";
saveIncomes();
renderIncomes();
}
function deleteIncome(idx){ incomes.splice(idx,1); saveIncomes(); renderIncomes(); }
function saveIncomes(){ localStorage.setItem("evrixy_incomes", JSON.stringify(incomes)); }
function updateProfit(){
let monthExp = expenses.filter(e=>e.date.startsWith(getCurrentMonth())).reduce((s,e)=>s+e.amount,0);
let monthInc = incomes.filter(i=>i.date && i.date.startsWith(getCurrentMonth())).reduce((s,i)=>s+i.amount,0);
let profit = monthInc - monthExp;
document.getElementById("netProfit").innerText = profit;
// alert if over budget
let budget = monthlyBudgetLimit;
if(monthExp > budget) document.getElementById("alertMsg").innerHTML = `<span style="color:#f8a6a6;">⚠️ වියදම් සීමාව ඉක්මවා ඇත! අයවැය පාලනය කරන්න.</span>`;
else document.getElementById("alertMsg").innerHTML = `✅ වියදම් සීමාව තුළයි.`;
let target = monthlyTarget;
if(monthInc < target) document.getElementById("alertMsg").innerHTML += `<br>🎯 ඉලක්කගත ආදායමට වඩා අඩුයි.`;
}
// ========== INVENTORY ==========
function renderInventory(){
let container=document.getElementById("inventoryContainer");
if(inventory.length===0){ container.innerHTML="<i>තොග භාණ්ඩ නැත</i>"; return; }
let html="";
inventory.forEach((item,idx)=>{
html+=`<div class="inv-item"><span>📦 ${escapeHtml(item.item)} x ${item.quantity}</span><button class="delete-btn" onclick="deleteInventoryItem(${idx})">🗑️</button></div>`;
});
container.innerHTML=html;
}
function addInventoryItem(){
let itm=document.getElementById("itemName").value.trim();
let qty=parseInt(document.getElementById("itemQty").value);
if(itm==="" || isNaN(qty)){ alert("භාණ්ඩය සහ ප්රමාණය ඇතුලත් කරන්න"); return; }
inventory.push({item:itm, quantity:qty});
document.getElementById("itemName").value="";
document.getElementById("itemQty").value="";
saveInventory();
renderInventory();
}
function deleteInventoryItem(idx){ inventory.splice(idx,1); saveInventory(); renderInventory(); }
function saveInventory(){ localStorage.setItem("evrixy_inventory", JSON.stringify(inventory)); }
// ========== PLANNING GOALS ==========
function savePlanningGoals(){
monthlyTarget = parseFloat(document.getElementById("monthlyTargetIncome").value) || 50000;
monthlyBudgetLimit = parseFloat(document.getElementById("monthlyBudgetLimit").value) || 30000;
localStorage.setItem("evrixy_monthlyTarget", monthlyTarget);
localStorage.setItem("evrixy_budgetLimit", monthlyBudgetLimit);
document.getElementById("displayTarget").innerText = monthlyTarget;
document.getElementById("displayBudget").innerText = monthlyBudgetLimit;
updateProfit();
alert("Goals saved");
}
// ========== NOTES ==========
function saveNote(){
businessNote = document.getElementById("businessNote").value;
localStorage.setItem("evrixy_note", businessNote);
alert("Note saved");
}
// ========== EXPORT / BACKUP ==========
function exportFullBackup(){
let backup = {
tasks, expenses, incomes, inventory, timeBlocks, monthlyTarget, monthlyBudgetLimit, businessNote, backupDate: new Date().toISOString()
};
let csvRows = [];
csvRows.push("Section,Name,Value,Date");
tasks.forEach(t=>csvRows.push(`Task,${t.text},${t.completed},`));
expenses.forEach(e=>csvRows.push(`Expense,${e.name},${e.amount},${e.date}`));
incomes.forEach(i=>csvRows.push(`Income,${i.source},${i.amount},${i.date}`));
inventory.forEach(iv=>csvRows.push(`Inventory,${iv.item},${iv.quantity},`));
downloadCSV(csvRows.join("\n"), "Evrixy_FullBackup.csv");
}
function resetAllEvrixyData(){
if(confirm("සියලු දත්ත ස්ථිරවම මැකේවි. ප්රවේශම් වන්න!")){
tasks=[]; expenses=[]; incomes=[]; inventory=[];
businessNote="";
monthlyTarget=50000; monthlyBudgetLimit=30000;
timeBlocks = [
{ time: "12am – 04am", task: "Sleep / Rest" },
{ time: "04am – 08am", task: "Morning + Family" },
{ time: "08am – 12pm", task: "Tyer Work / Business" },
{ time: "12pm – 04pm", task: "Core Work / Business" },
{ time: "04pm – 08pm", task: "Break + Cleaning" },
{ time: "08pm – 12am", task: "Evrixy Business" }
];
saveAllLocal();
renderAll();
alert("සියල්ල නැවත සකසන ලදී.");
}
}
function saveAllLocal(){
localStorage.setItem("evrixy_tasks", JSON.stringify(tasks));
localStorage.setItem("evrixy_expenses", JSON.stringify(expenses));
localStorage.setItem("evrixy_incomes", JSON.stringify(incomes));
localStorage.setItem("evrixy_inventory", JSON.stringify(inventory));
localStorage.setItem("evrixy_timeblocks", JSON.stringify(timeBlocks));
localStorage.setItem("evrixy_note", businessNote);
localStorage.setItem("evrixy_monthlyTarget", monthlyTarget);
localStorage.setItem("evrixy_budgetLimit", monthlyBudgetLimit);
}
function loadAllEvrixyData(){
let storedTasks = localStorage.getItem("evrixy_tasks"); if(storedTasks) tasks = JSON.parse(storedTasks);
let storedExp = localStorage.getItem("evrixy_expenses"); if(storedExp) expenses = JSON.parse(storedExp);
let storedInc = localStorage.getItem("evrixy_incomes"); if(storedInc) incomes = JSON.parse(storedInc);
let storedInv = localStorage.getItem("evrixy_inventory"); if(storedInv) inventory = JSON.parse(storedInv);
let storedBlocks = localStorage.getItem("evrixy_timeblocks"); if(storedBlocks) timeBlocks = JSON.parse(storedBlocks);
let storedNote = localStorage.getItem("evrixy_note"); if(storedNote) businessNote = storedNote;
let storedTarget = localStorage.getItem("evrixy_monthlyTarget"); if(storedTarget) monthlyTarget = parseFloat(storedTarget);
let storedBudget = localStorage.getItem("evrixy_budgetLimit"); if(storedBudget) monthlyBudgetLimit = parseFloat(storedBudget);
document.getElementById("businessNote").value = businessNote;
document.getElementById("monthlyTargetIncome").value = monthlyTarget;
document.getElementById("monthlyBudgetLimit").value = monthlyBudgetLimit;
document.getElementById("displayTarget").innerText = monthlyTarget;
document.getElementById("displayBudget").innerText = monthlyBudgetLimit;
renderAll();
}
function renderAll(){
renderTimeBlocks();
renderTasks();
renderExpenses();
renderIncomes();
renderInventory();
updateProfit();
}
function exportTasksCSV(){ let csv="Task,Completed\n"+tasks.map(t=>`${t.text},${t.completed}`).join("\n"); downloadCSV(csv,"Evrixy_Tasks.csv");}
function exportExpensesCSV(){ let csv="Name,Amount,Date\n"+expenses.map(e=>`${e.name},${e.amount},${e.date}`).join("\n"); downloadCSV(csv,"Evrixy_Expenses.csv");}
function exportIncomeCSV(){ let csv="Source,Amount,Date\n"+incomes.map(i=>`${i.source},${i.amount},${i.date}`).join("\n"); downloadCSV(csv,"Evrixy_Income.csv");}
function exportInventoryCSV(){ let csv="Item,Quantity\n"+inventory.map(i=>`${i.item},${i.quantity}`).join("\n"); downloadCSV(csv,"Evrixy_Inventory.csv");}
function downloadCSV(csvStr, filename){
let blob = new Blob([csvStr], {type:"text/csv"}); let a=document.createElement("a");
a.href=URL.createObjectURL(blob); a.download=filename; a.click(); URL.revokeObjectURL(a.href);
}
function escapeHtml(str){ return str.replace(/[&<>]/g, function(m){ if(m==='&') return '&'; if(m==='<') return '<'; if(m==='>') return '>'; return m;}); }
function startRealTimeClock(){
let dateElem = document.getElementById("liveDate");
setInterval(()=>{
let now = new Date();
dateElem.innerText = now.toLocaleDateString('si-LK', { year:'numeric', month:'long', day:'numeric' }) + " | " + now.toLocaleTimeString();
},1000);
}
</script>
</body>
</html>