Quotation builder
Pick items from the dropdown above to start building your quotation.
Subtotal£0.00
VAT (20%)£0.00
Total£0.00
Payment terms and notes
`; const w=window.open('','_blank','width=800,height=1000'); if(!w){alert('Pop-up blocked. Please allow pop-ups for this page and try again.');return;} w.document.open(); w.document.write(html); w.document.close(); let printed=false; function doPrint(){if(printed)return;printed=true;w.focus();w.print();} w.onload=function(){setTimeout(doPrint,400);} setTimeout(doPrint,1200); } // Remember company name on blur document.getElementById('f_company').addEventListener('blur',function(){ if(this.value.trim()) localStorage.setItem('mbm_company',this.value.trim()); }); document.getElementById('vatToggle').addEventListener('change',calcTotals); document.getElementById('vatPct').addEventListener('change',calcTotals); document.getElementById('discInput').addEventListener('input',calcTotals); // Allow Enter key in picker and modal document.getElementById('itemPicker').addEventListener('keydown',function(e){ if(e.key==='Enter') addFromPicker(); }); document.getElementById('customName').addEventListener('keydown',function(e){ if(e.key==='Enter') addCustomItem(); }); // Close modal on overlay click document.getElementById('customModal').addEventListener('click',function(e){ if(e.target===this) closeCustomModal(); }); // Init buildPicker(); const today=new Date(); document.getElementById('f_date').value=today.toISOString().split('T')[0]; // Load saved data or set defaults const loaded=loadLocal(); if(!loaded){ // Restore remembered company name const savedCompany=localStorage.getItem('mbm_company'); if(savedCompany) document.getElementById('f_company').value=savedCompany; // Auto-generate quote ref (don't increment counter on first visit) document.getElementById('f_ref').value=generateRef(false); render(); }