سامانه صدور فاکتور و حسابداری
Carry project attribution into invoice settlements
davoodmehraban89 committed
Sep 28, 2026 at 15:12 UTC
8719af27c15c2675c1a158ad5183a64b1ce676fc
1 file changed
+1
-1
js/payments.js
+1
-1
@@ -60,7 +60,7 @@ function commitSavePayment(){
60
if(invoiceId&&amount>outstanding){alert('مبلغ از مانده فاکتور بیشتر است.');return;}
61
const contact=getMyContacts().find(c=>c.id===contactId);
62
const companies=getMyCompanies(),active=getMySettings().default_company_id||companies[0]?.id||'';
63
- const payload={id:old?.id||('PAY-'+Date.now()),ownerUserId:currentUser.id,companyId:active,contactId,contactName:contact?.name||'',direction,amount,method:document.getElementById('pay-method')?.value||'bank',reference:(document.getElementById('pay-reference')?.value||'').trim(),note:(document.getElementById('pay-note')?.value||'').trim(),invoiceType,invoiceId,date:old?.date||new Date().toISOString()};
63
+ const payload={id:old?.id||('PAY-'+Date.now()),ownerUserId:currentUser.id,companyId:active,contactId,contactName:contact?.name||'',direction,amount,method:document.getElementById('pay-method')?.value||'bank',reference:(document.getElementById('pay-reference')?.value||'').trim(),note:(document.getElementById('pay-note')?.value||'').trim(),invoiceType,invoiceId,projectId:(invoiceType==='sale'?getMyInvoices().find(i=>i.id===invoiceId)?.projectId:getMyPurchases().find(i=>i.id===invoiceId)?.costCenterId)||'',date:old?.date||new Date().toISOString()};
64
if(old)Object.assign(old,payload);else datastore.payments.push(payload);
65
saveDatastore();resetPaymentForm();refreshAllSurfaces();renderPayments();
66
}