سامانه صدور فاکتور و حسابداری
Assign floating-detail codes to counterparties
davoodmehraban89 committed
Oct 1, 2026 at 20:26 UTC
60c994aee1c92419d60b7fbdaeb27d47f72bd125
1 file changed
+3
-3
js/contacts.js
+3
-3
@@ -15,7 +15,7 @@ function commitSaveContact(){
15
const project_mode=projectModeEl?projectModeEl.value:'single';
16
if(!raw_name.trim()){alert('نام طرف حساب الزامی است.');return;}
17
const formatted_name=formatEntityName(raw_name,entity_type,custom_prefix);
18
- datastore.contacts.push({id:'C_'+Date.now(),ownerUserId:currentUser.id,entity_type,name:formatted_name,role,mobile,national_id,economic_code,reg_number,postal_code,address,balance:0,project_mode,projects:[]});
18
+ datastore.contacts.push({id:'C_'+Date.now(),ownerUserId:currentUser.id,floatingCode:(typeof afNextFloatingCode==='function'?afNextFloatingCode(2,1):''),entity_type,name:formatted_name,role,mobile,national_id,economic_code,reg_number,postal_code,address,balance:0,project_mode,projects:[]});
19
saveDatastore();
20
alert('طرف حساب ثبت شد.');
21
document.getElementById('contact-name-input').value='';
@@ -56,7 +56,7 @@ function saveQuickContact(){
56
const raw_name=document.getElementById('quick-c-name').value;
57
if(!raw_name.trim()){alert('نام الزامی است.');return;}
58
const newId='C_'+Date.now();
59
- datastore.contacts.push({id:newId,ownerUserId:currentUser.id,entity_type,name:formatEntityName(raw_name,entity_type,prefix),role:'customer',mobile:document.getElementById('quick-c-mobile').value,national_id:document.getElementById('quick-c-national').value,economic_code:(entity_type==='natural')?'':document.getElementById('quick-c-economic').value,reg_number:(entity_type==='natural')?'':document.getElementById('quick-c-reg').value,postal_code:document.getElementById('quick-c-postal').value,address:document.getElementById('quick-c-address').value,balance:0,project_mode:'single',projects:[]});
59
+ datastore.contacts.push({id:newId,ownerUserId:currentUser.id,floatingCode:(typeof afNextFloatingCode==='function'?afNextFloatingCode(2,1):''),entity_type,name:formatEntityName(raw_name,entity_type,prefix),role:'customer',mobile:document.getElementById('quick-c-mobile').value,national_id:document.getElementById('quick-c-national').value,economic_code:(entity_type==='natural')?'':document.getElementById('quick-c-economic').value,reg_number:(entity_type==='natural')?'':document.getElementById('quick-c-reg').value,postal_code:document.getElementById('quick-c-postal').value,address:document.getElementById('quick-c-address').value,balance:0,project_mode:'single',projects:[]});
60
saveDatastore();
61
closeQuickContactModal();
62
refreshAllSurfaces();
@@ -84,7 +84,7 @@ function importContactsFromExcel(event){
84
const raw_name=r["نام شخص یا شرکت"]||r["نام"];
85
if(raw_name){
86
const entity_type=(r["نوع (حقیقی/حقوقی)"]||'').includes('حقوقی')?'legal':'natural';
87
- datastore.contacts.push({id:'C_'+Date.now()+'_'+idx,ownerUserId:currentUser.id,entity_type,name:formatEntityName(raw_name.toString(),entity_type,'آقا/خانم'),role:'customer',mobile:(r["شماره همراه"]||'').toString(),national_id:(r["شناسه یا کد ملی"]||'').toString(),economic_code:(entity_type==='legal'?(r["کد اقتصادی"]||''):'').toString(),reg_number:(entity_type==='legal'?(r["شماره ثبت"]||''):'').toString(),postal_code:(r["کد پستی"]||'').toString(),address:(r["نشانی"]||'').toString(),balance:0});
87
+ datastore.contacts.push({id:'C_'+Date.now()+'_'+idx,ownerUserId:currentUser.id,floatingCode:(typeof afNextFloatingCode==='function'?afNextFloatingCode(2,1):''),entity_type,name:formatEntityName(raw_name.toString(),entity_type,'آقا/خانم'),role:'customer',mobile:(r["شماره همراه"]||'').toString(),national_id:(r["شناسه یا کد ملی"]||'').toString(),economic_code:(entity_type==='legal'?(r["کد اقتصادی"]||''):'').toString(),reg_number:(entity_type==='legal'?(r["شماره ثبت"]||''):'').toString(),postal_code:(r["کد پستی"]||'').toString(),address:(r["نشانی"]||'').toString(),balance:0});
88
}
89
});
90
saveDatastore();refreshAllSurfaces();