سامانه صدور فاکتور و حسابداری
Mirrored from https://github.com/davoodmehraban89/Factor-easy.git
Synced Dec 3, 23:15 UTC
Gate account classification and chart UI contract
davoodmehraban89 committed
Sep 29, 2026 at 22:17 UTC
e89268760fe14f78db19ebb22889629f33aa534d
1 file changed
+3
-3
scripts/phase2-check.mjs
+3
-3
@@ -10,11 +10,11 @@ const journal=fs.readFileSync('js/journal-engine.js','utf8');
10
const phase4=fs.readFileSync('js/phase4-contracting.js','utf8');
11
const sync=fs.readFileSync('js/sync.js','utf8');
12
const must=(src,needles,label)=>{for(const n of needles)if(!src.includes(n))throw new Error(label+' missing '+n)};
13
-must(af,['AF_COMPANY_TYPES','AF_BASE_ACCOUNTS','AF_SPECIAL_ACCOUNTS','afApplyTemplate','afDimensionValuePostable','afDimensionHasValues','afDimensionValueReferenced','afChangeDimensionDepth','depthLocked','maxDepth','startDate>=endDate','afNormalizeAccountImportRows','afImportAccountsFromExcel','downloadAccountsExcelTemplate',"'CONTRACT','قرارداد / پیمان','contract',1,4",'slot:Number(slot)||0'],'accounting foundation');
13
+must(af,['AF_COMPANY_TYPES','AF_BASE_ACCOUNTS','AF_SPECIAL_ACCOUNTS','afApplyTemplate','afDimensionValuePostable','afDimensionHasValues','afDimensionValueReferenced','afChangeDimensionDepth','depthLocked','maxDepth','startDate>=endDate','afNormalizeAccountImportRows','afImportAccountsFromExcel','downloadAccountsExcelTemplate',"'CONTRACT','قرارداد / پیمان','contract',1,4",'slot:Number(slot)||0','afAccountTypeForCode','accountType'],'accounting foundation');
14
must(render,['afDimensionValuePostable','afChangeDimensionDepth','عمق قفل شده','قابل ثبت','گروه/غیرقابل ثبت','تفصیلی شناور'],'dimension rendering');
15
must(companies,['company-activity-type','company-accounting-template','afApplyTemplate(newComp.id,activityType)'],'company onboarding');
16
must(index,['company-activity-type','company-accounting-template','بازرگانی','خدماتی','تولیدی','پیمانکاری','فروشگاهی','پخش','غیرانتفاعی','خدمات حرفهای'],'company activity UI');
17
-must(fs.readFileSync('js/accounting-foundation-ui.js','utf8'),['ورود کدینگ از Excel','نمونه Excel کدینگ','شناور ۱ شعبه','شناور ۴ قرارداد/پیمان','value="contract"'],'accounting contract UI');
17
+must(fs.readFileSync('js/accounting-foundation-ui.js','utf8'),['ورود کدینگ از Excel','نمونه Excel کدینگ','شناور ۱ شعبه','شناور ۴ قرارداد/پیمان','value="contract"','af-account-type','<th>نوع</th>'],'accounting contract UI');
18
must(journal,["t.sourceEntity==='contract'","contractId:source.contractId||''"],'contract analytic posting context');
19
must(phase4,['contractId:c.id'],'contracting analytic source context');
20
for(const coll of ['fiscalYears','accounts','dimensionTypes','dimensionValues','accountDimensionRules','branches','projects','projectLinks']){
@@ -29,7 +29,7 @@ const imported=vm.runInContext(`afNormalizeAccountImportRows([
29
{'کد':'11','عنوان':'دارایی جاری','سطح':'معین','کد والد':'1','ماهیت':'بدهکار'},
30
{'کد':'1101','عنوان':'بانک','سطح':'تفصیلی','کد والد':'11','ماهیت':'بدهکار'}
31
])`,ctx);
32
-if(imported.length!==3||imported[2].level!=='detail'||imported[2].parentCode!=='11')throw new Error('Chart Excel normalization behavior failed');
32
+if(imported.length!==3||imported[2].level!=='detail'||imported[2].parentCode!=='11'||imported[2].normalBalance!=='debit')throw new Error('Chart Excel normalization behavior failed');
33
let badParent=false;try{vm.runInContext(`afNormalizeAccountImportRows([{'کد':'1101','عنوان':'بانک','سطح':'تفصیلی','کد والد':'99'}])`,ctx)}catch(_){badParent=true}
34
if(!badParent)throw new Error('Chart import must reject invalid hierarchy');
35
console.log('Phase 2 accounting foundation invariants passed.');