@davoodmehraban89 / Factor-easy-2 Mirror · read-only / commits / 86597b7
Fork 0

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

Mirrored from https://github.com/davoodmehraban89/Factor-easy.git

Synced Dec 3, 18:15 UTC

fix(finance): exclude unposted sales drafts from inventory, receivables and revenue reporting

davoodmehraban89 committed Oct 11, 2026 at 20:59 UTC 86597b77a7e761f5ba24606bcef411b2f0039d27
1 file changed +1 -1
js/phase5-enterprise.js
+1 -1
@@ -23,7 +23,7 @@ function p5OperationalEvents(productId,warehouseId){
23 const wh=p5DefaultWarehouse();if(!wh||warehouseId!==wh.id)return[];
24 const out=[];
25 getMyPurchases().forEach(d=>{if((d.warehouseId||wh.id)!==warehouseId)return;(d.items||[]).forEach(i=>{if((i.prodId||i.productId)===productId)out.push({delta:Number(i.qty??i.quantity)||0,qty:Number(i.qty??i.quantity)||0,unitCost:Number(i.price??i.unitPrice)||0,date:d.date||'',source:'purchase',sourceId:d.id})})});
26 - getMyInvoices().filter(d=>typeof invoiceCreatesAccountingEntry!=='function'||invoiceCreatesAccountingEntry(d.kind)).forEach(d=>{if((d.warehouseId||wh.id)!==warehouseId)return;(d.items||[]).forEach(i=>{if((i.prodId||i.productId)===productId)out.push({delta:-(Number(i.qty??i.quantity)||0),qty:Number(i.qty??i.quantity)||0,unitCost:0,date:d.date||'',source:'sale',sourceId:d.id})})});
26 + getMyInvoices().filter(d=>(typeof invoiceCreatesAccountingEntry!=='function'||invoiceCreatesAccountingEntry(d.kind))&&typeof invoiceDocumentStatus==='function'&&invoiceDocumentStatus(d)==='posted').forEach(d=>{if((d.warehouseId||wh.id)!==warehouseId)return;(d.items||[]).forEach(i=>{if((i.prodId||i.productId)===productId)out.push({delta:-(Number(i.qty??i.quantity)||0),qty:Number(i.qty??i.quantity)||0,unitCost:0,date:d.date||'',source:'sale',sourceId:d.id})})});
27 return out;
28 }
29 function p5ManualEvents(productId,warehouseId){