سامانه صدور فاکتور و حسابداری
Mirrored from https://github.com/davoodmehraban89/Factor-easy.git
Synced Dec 3, 22:00 UTC
Route automatic postings through activity-specific starter accounts
davoodmehraban89 committed
Sep 29, 2026 at 22:41 UTC
8972838dfa9a4d853f78933864d712bbe383da7e
1 file changed
+3
-2
js/journal-engine.js
+3
-2
@@ -11,8 +11,9 @@ function jeFindAccountByTitle(words){const A=getMyAccounts().filter(x=>x.active!
11
function jeCashAccount(){return jeAccountByCode('1101')||jeFindAccountByTitle(['صندوق','بانک','نقد'])}
12
function jeReceivableAccount(){return jeAccountByCode('1102')||jeFindAccountByTitle(['دریافتنی','بدهکاران'])}
13
function jePayableAccount(){return jeAccountByCode('2101')||jeFindAccountByTitle(['پرداختنی','بستانکاران'])}
14
-function jeRevenueAccount(){return jeAccountByCode('4101')||jeAccountByCode('4107')||jeAccountByCode('4106')||jeFindAccountByTitle(['فروش','درآمد خدمات'])}
15
-function jePurchaseAccount(){return jeAccountByCode('5101')||jeAccountByCode('5102')||jeFindAccountByTitle(['بهای تمام','خرید'])}
14
+function jeTemplateType(){if(typeof getMyCompanies!=='function')return'';const cid=afCompanyId(),c=getMyCompanies().find(x=>x.id===cid);return c?.accountingTemplate?.type||c?.activityType||''}
15
+function jeRevenueAccount(){const special={trading:'4107',service:'4106',retail:'4102',distribution:'4103',nonprofit:'4104',professional:'4105'}[jeTemplateType()];return(special&&jeAccountByCode(special))||jeAccountByCode('4101')||jeAccountByCode('4107')||jeAccountByCode('4106')||jeFindAccountByTitle(['فروش','درآمد خدمات'])}
16
+function jePurchaseAccount(){const special=jeTemplateType()==='trading'?'5102':'';return(special&&jeAccountByCode(special))||jeAccountByCode('5101')||jeAccountByCode('5102')||jeFindAccountByTitle(['بهای تمام','خرید'])}
17
function jeExpenseAccount(){return jeAccountByCode('6103')||jeFindAccountByTitle(['هزینه عمومی','هزینه'])}
18
function jeOtherIncomeAccount(){return jeAccountByCode('4201')||jeFindAccountByTitle(['سایر درآمد'])}
19
function jeVatPayableAccount(){return jeAccountByCode('2102')||jeFindAccountByTitle(['مالیات و عوارض پرداختنی'])}