invoicing 3

Lite Invoice — Blue

Lite Invoice

Blue theme • Local only

Invoice

Items

ItemQtyPriceLine Total
Subtotal
0.00
Discount
0.00
Tax
0.00
Total
0.00

Actions

Tip: Saved invoices appear in the Invoices tab. Printing uses your browser (choose “Save as PDF” to download).

Pick an Item

Pick a Client

`; w.document.write(html); w.document.close(); }; // ----- Clients & Items ----- const renderClients=()=>{ fillClientsSelect(); const cs=store.get(LS_KEYS.CLIENT,[]); const tb=$('#clientTable tbody'); tb.innerHTML=''; cs.forEach(c=>{ const tr=document.createElement('tr'); tr.innerHTML=`${c.name}${c.email||''}${c.address||''} `; tr.querySelector('.btn.warn').onclick=()=>{ if(confirm('Delete client?')){ store.set(LS_KEYS.CLIENT,cs.filter(x=>x.id!==c.id)); renderClients(); } }; tb.appendChild(tr); }); }; const renderItems=()=>{ const its=store.get(LS_KEYS.ITEM,[]); const tb=$('#itemTable tbody'); tb.innerHTML=''; its.forEach(it=>{ const tr=document.createElement('tr'); tr.innerHTML=`${it.name}${fmt(it.price)} `; tr.querySelector('.btn.warn').onclick=()=>{ if(confirm('Delete item?')){ store.set(LS_KEYS.ITEM,its.filter(x=>x.id!==it.id)); renderItems(); } }; tb.appendChild(tr); }); }; $('#addClient').onclick=()=>{ const name=$('#clientName').value.trim(); if(!name) return alert('Client name required.'); const email=$('#clientEmail').value.trim(); const address=$('#clientAddress').value.trim(); const cs=store.get(LS_KEYS.CLIENT,[]); cs.unshift({id:id(),name,email,address}); store.set(LS_KEYS.CLIENT,cs); $('#clientName').value=$('#clientEmail').value=$('#clientAddress').value=''; renderClients(); }; $('#addItem').onclick=()=>{ const name=$('#itemName').value.trim(); const price=+$('#itemPrice').value||0; if(!name) return alert('Item name required.'); const its=store.get(LS_KEYS.ITEM,[]); its.unshift({id:id(),name,price}); store.set(LS_KEYS.ITEM,its); $('#itemName').value=''; $('#itemPrice').value=''; renderItems(); }; // ----- Utilities ----- const escapeHtml=(s)=>String(s||'').replace(/[&<>"']/g,m=>({ '&':'&','<':'<','>':'>','"':'"',"'":''' }[m])); // ----- Init ----- ensureSeeds(); fillClientsSelect(); $('#invDate').value = new Date().toISOString().slice(0,10); $('#bizName').value = store.get('lite_biz',''); $('#bizName').addEventListener('input',e=>store.set('lite_biz',e.target.value)); addRow(); })();

Comments

Popular posts from this blog

How to Leverage AI for Better Graphic Design

"The Rise of the Global Brain in 2025: A Vision Inspired by Arthur C. Clarke" How does it affect you?

Attendance sheet version 7