@davoodmehraban89 / Factor-easy-2 Mirror · read-only / commits / 6bb2dab
Fork 0

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

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

Synced Dec 3, 22:00 UTC

Post expense and income sources into the accounting ledger

davoodmehraban89 committed Sep 29, 2026 at 22:21 UTC 6bb2dabd3f609df0a6be12bd94ccff9274069b62
1 file changed +4 -2
js/expenses.js
+4 -2
@@ -3,9 +3,11 @@ function commitSaveExpense(){
3 if(!currentUser)return;
4 const amount=parseFormattedNumber(document.getElementById('trx-amount-input').value);
5 if(amount<=0){alert('مبلغ معتبر نیست.');return;}
6 - datastore.expenses.push({id:'TRX_'+Date.now(),ownerUserId:currentUser.id,kind:document.getElementById('trx-kind-input').value,category:document.getElementById('trx-category-input').value,amount,desc:document.getElementById('trx-desc-input').value});
6 + const kind=document.getElementById('trx-kind-input').value,contactId=document.getElementById('trx-contact-select')?.value||'',projectId=document.getElementById('trx-project-select')?.value||'',record={id:'TRX_'+Date.now(),ownerUserId:currentUser.id,companyId:typeof afCompanyId==='function'?afCompanyId():'',kind,category:document.getElementById('trx-category-input').value,amount,desc:document.getElementById('trx-desc-input').value,contactId,projectId,date:getJalaliNumeric(),accountingVersion:1};
7 + datastore.expenses.push(record);
8 + if(typeof jePostSourceRecord==='function'){try{jePostSourceRecord(kind,record);}catch(e){datastore.expenses=datastore.expenses.filter(x=>x.id!==record.id);alert('هزینه/درآمد ثبت نشد: '+e.message);return;}}
9 saveDatastore();
8 - alert('سند ثبت شد.');
10 + alert('هزینه/درآمد و سند حسابداری با موفقیت ثبت شد.');
11 refreshAllSurfaces();
12 }
13 function renderExpenses(){