سامانه صدور فاکتور و حسابداری
fix(expense): retain legacy Phase 3 posting source contract in original-record path
davoodmehraban89 committed
Oct 14, 2026 at 11:51 UTC
fb441b3e9a66ea37a750e5ff2c7c3916f3b27788
1 file changed
+2
-1
js/expenses.js
+2
-1
@@ -159,13 +159,14 @@ function commitSaveExpense(){
159
}
160
if(!Number.isFinite(form.amount)||form.amount<=0){alert('مبلغ معتبر نیست.');return;}
161
if(!['expense','income'].includes(form.kind)){alert('نوع سند معتبر نیست.');return;}
162
+ const kind=form.kind;
163
const record={id:afId('TRX'),ownerUserId:currentUser.id,
164
companyId:typeof afCompanyId==='function'?afCompanyId():'',
165
kind:form.kind,category:form.category,amount:form.amount,desc:form.desc,
166
contactId:form.contactId,projectId:form.projectId,date:getJalaliNumeric(),accountingVersion:1};
167
datastore.expenses.push(record);
168
if(typeof jePostSourceRecord==='function'){
168
- try{jePostSourceRecord(form.kind,record);}
169
+ try{jePostSourceRecord(kind,record);}
170
catch(e){datastore.expenses=datastore.expenses.filter(x=>x.id!==record.id);
171
alert('هزینه/درآمد ثبت نشد: '+e.message);return;}
172
}