سامانه صدور فاکتور و حسابداری

fix(finance): watermark draft invoice print and block pre-posting taxpayer official print

davoodmehraban89 committed Oct 11, 2026 at 21:01 UTC 657f0fd1656e82f8ef6f44c1764b55de10373904
1 file changed +4 -1
js/print.js
+4 -1
@@ -260,6 +260,7 @@ function buildElectronicDocPage(inv,edoc,seller,contact){
260
261 function printElectronicDoc(invId){
262 const inv=getMyInvoices().find(i=>i.id===invId);
263 + if(inv&&typeof invoiceDocumentStatus==='function'&&invoiceDocumentStatus(inv)==='draft'){alert('سند رسمی مؤدیان فقط پس از قطعی‌سازی قابل چاپ است.');return;}
264 if(!inv||!inv.electronicDoc){
265 alert('سند الکترونیکی برای این فاکتور ثبت نشده است.');
266 return;
@@ -564,5 +565,7 @@ function renderAndPrintDirect(invId){
565 const totalPages=pageGroups.length;
566 const containerHtml=pageGroups.map((g,idx)=>builder(g.items,seller,contact,inv,{pageNum:idx+1,totalPages,isFirstPage:g.isFirstPage,isLastPage:g.isLastPage,cumulativeBefore:g.cumulativeBefore,cumulativeSubtotal:g.cumulativeSubtotal,cumulativeDiscount:g.cumulativeDiscount,cumulativeVat:g.cumulativeVat,cumulativeNet:g.cumulativeNet})).join('');
567 const spec=getInvoicePrintSpec(inv);
567 - stageInvoicePrint(containerHtml,spec);
568 + const unposted=typeof invoiceDocumentStatus==='function'&&invoiceDocumentStatus(inv)==='draft';
569 + const draftMark=unposted?'<div style="position:fixed;top:16mm;left:28%;font-size:19pt;font-weight:900;opacity:.24;transform:rotate(-12deg);z-index:1000;pointer-events:none">پیش‌نویس — غیرقطعی</div>':'';
570 + stageInvoicePrint(draftMark+containerHtml,spec);
571 }