Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
a6a8d57914
@ -1,2 +0,0 @@
|
||||
|
||||
cur_frm.cscript['Export Report']=function(doc,cdt,cdn){$c_obj_csv(make_doclist(cdt,cdn),'get_report_data','');}
|
@ -1,44 +0,0 @@
|
||||
|
||||
pscript['onload_Accounts Browser']=function(){var parent=$i('ab_body');parent.innerHTML='Please select your chart: '
|
||||
var sel=$a(parent,'select');add_sel_options(sel,['Account','Cost Center'],'Account');var btn=$btn(parent,'Go',function(){pscript.make_chart(sel_val(sel));},{marginTop:'8px'});}
|
||||
pscript.make_chart=function(b){pscript.chart_type=b;$i('ab_header').innerHTML='';$i('ab_body').innerHTML='';var comment=$a($i('ab_body'),'div','comment',{marginBottom:"8px"});comment.innerHTML="Note: Explore and click on the tree node to add a new child";var select_area=$a('ab_body','div','',{margin:'8px 0px'});var ac_main_grid=make_table($i('ab_body'),1,2,'100%',['60%','40%'],{border:"0px",padding:"4px",tableLayout:"fixed",borderCollapse:"collapse"});$y($td(ac_main_grid,0,0),{border:"1px solid #dddddd",padding:"8px"});pscript.account_tree=$a($td(ac_main_grid,0,0),'div');$y($td(ac_main_grid,0,1),{border:"1px solid #DDD"});pscript.la=$a($td(ac_main_grid,0,1),'div');pscript.acc_period_bal=$a($td(ac_main_grid,0,1),'div');if(pscript.chart_type=='Account'){var footer=$a($i('ab_body'),'div','',{backgroundColor:"#FFD",padding:"8px",color:"#444",fontSize:"12px",marginTop:"14px"});var help1=$a(footer,'span');help1.innerHTML="<strong>Note:</strong> To create accounts for Customers and Suppliers, please create <a href='#Page/Selling'>Customer</a> and <a href='#Page/Buying'>Supplier</a>"
|
||||
+" Masters. This will ensure that the accounts are linked to your Selling and Buying Processes. The Account Heads for Customer and Supplier will automatically be created."}
|
||||
var h1='Chart of '+pscript.chart_type+'s';if(pscript.chart_type=='Account')var d='accounting';else var d='cost center';var desc='Manage multiple companies and the '+d+' structures of each company.';$i('ab_body').page_head=new PageHeader('ab_header',h1,desc);var tab=make_table(select_area,1,2,null,[],{verticalAlign:'middle',padding:'2px'});$td(tab,0,0).innerHTML='Select Company'.bold();var sel=$a($td(tab,0,1),'select','',{width:'160px'});var set_tree=function(){if(pscript.ac_tree){pscript.ac_tree.body.innerHTML='';}
|
||||
pscript.make_ac_tree();var cn=sel_val(sel);var n=pscript.ac_tree.addNode(null,cn,null,pscript.ac_tree.std_onclick,pscript.ac_tree.std_onexp);n.rec={};n.rec.name='Root Node';n.rec.account_name=cn;n.rec.cost_center_name=cn;pscript.set_ac_head('',n.rec);$ds(pscript.ac_head_area);}
|
||||
add_sel_options(sel,['Loading...']);var callback=function(r,rt){empty_select(sel);add_sel_options(sel,r.message.cl,sys_defaults.company);set_tree();sel.onchange=function(){set_tree();}}
|
||||
$c_obj('GL Control','get_companies','',callback);pscript.ab_company_sel=sel;pscript.make_ac_head();pscript.make_group_area();pscript.make_ledger_area();pscript.make_new_acc_dialog();pscript.make_new_comp();pscript.make_new_cost_center_dialog();}
|
||||
pscript.make_new_comp=function(){$i('ab_body').page_head.add_button('New Company',function(){new_doc('Company');},0,'ui-icon-plus');}
|
||||
pscript.make_ac_tree=function(){var type=pscript.chart_type;var tree=new Tree(pscript.account_tree,'90%');pscript.ac_tree=tree;tree.std_onclick=function(node){pscript.cur_node=node;pscript.set_ac_head(node.parent_account,node.rec,type);}
|
||||
tree.std_onexp=function(node){if(node.expanded_once)return;$ds(node.loading_div);var callback=function(r,rt){$dh(node.loading_div);var n=tree.allnodes[r.message.parent_acc_name];var cl=r.message.cl;if(type=='Account'){for(var i=0;i<cl.length;i++){var imgsrc=null;var has_children=true;if(cl[i].group_or_ledger=='Ledger'){var imgsrc='images/icons/page.gif';has_children=false;}
|
||||
var t=tree.addNode(n,cl[i].account_name,imgsrc,tree.std_onclick,has_children?tree.std_onexp:null);t.rec=cl[i];t.parent_account=r.message.parent;}}
|
||||
else{for(var i=0;i<cl.length;i++){var imgsrc=null;var has_children=true;if(cl[i].group_or_ledger=='Ledger'){var imgsrc='images/icons/page.gif';has_children=false;}
|
||||
var t=tree.addNode(n,cl[i].cost_center_name,imgsrc,tree.std_onclick,has_children?tree.std_onexp:null);t.rec=cl[i];t.parent_account=r.message.parent;}}}
|
||||
if(type=='Account'){var arg=[node.rec.name,node.rec.account_name,sel_val(pscript.ab_company_sel),pscript.chart_type];}else{var arg=[node.rec.name,node.rec.cost_center_name,sel_val(pscript.ab_company_sel),pscript.chart_type];}
|
||||
$c_obj('GL Control','get_cl',arg.join(','),callback);}}
|
||||
pscript.make_ac_head=function(){var div=$a(pscript.la,'div','ac_head');div.main_head=$a(div,'h3','',{padding:'4px',margin:'0px',backgroundColor:'#EEEEEE',borderBottom:'1px solid #AAAAAA'});div.sub_head1=$a(div,'div');div.sub_head2=$a(div,'div');div.balance_area=$a(div,'div');$a(div.balance_area,'span','sectionHeading').innerHTML="Balance:";div.balance=$a(div.balance_area,'span','ac_balance');div.sub_head=$btn(div,'Edit',function(){loaddoc(this.dt,this.dn);});pscript.ac_head_area=div;}
|
||||
pscript.set_ac_head=function(parent_account,r,type){var d=pscript.ac_head_area;d.main_head.innerHTML=r.account_name;$ds(d.sub_head);$ds(d.balance_area);if(r.name!='Root Node'){if(type=='Account'){d.sub_head.dt='Account';d.sub_head.dn=r.name
|
||||
d.sub_head1.innerHTML=r.debit_or_credit+' - '+r.group_or_ledger;d.sub_head2.innerHTML='Group: '+parent_account;if(r.group_or_ledger=='Ledger'){$ds(pscript.ledger_area);$ds(pscript.gl_rep);$dh(pscript.cc_rep);$dh(pscript.group_area);}else{$dh(pscript.ledger_area);$ds(pscript.group_area);$ds(pscript.acc_add_btn);$dh(pscript.cc_add_btn);}
|
||||
d.balance.innerHTML=(sys_defaults.currency?sys_defaults.currency:'Rs')+' '+(r.balance?fmt_money(r.balance):'0.00');}
|
||||
else{$dh(d.balance_area);d.main_head.innerHTML=r.cost_center_name;d.sub_head.dt='Cost Center';d.sub_head.dn=r.name
|
||||
d.sub_head1.innerHTML='';d.sub_head2.innerHTML='Group: '+parent_account;if(r.group_or_ledger=='Ledger'){$ds(pscript.ledger_area);$dh(pscript.gl_rep);$ds(pscript.cc_rep);$dh(pscript.group_area);}else{$dh(pscript.ledger_area);$ds(pscript.group_area);$ds(pscript.cc_add_btn);$dh(pscript.acc_add_btn);}
|
||||
d.balance.innerHTML='';}}else{$dh(d.sub_head);$dh(pscript.ledger_area);$dh(pscript.group_area);$dh(d.balance_area);d.sub_head1.innerHTML='';d.sub_head2.innerHTML='Explore tree on your left to see details';}
|
||||
pscript.acc_period_bal.innerHTML='';}
|
||||
pscript.make_group_area=function(type){pscript.group_area=$a(pscript.la,'div','ac_ledger');ref_btn=$a(pscript.group_area,'div','',{fontSize:'14px',marginBottom:'8px',marginTop:'24px',fontWeight:'bold'});ref_btn.innerHTML='<img src="images/icons/page_refresh.gif" style="margin-right: 8px"><span class="link_type">Refresh Tree</span>';ref_btn.onclick=function(){pscript.cur_node.clear_child_nodes();pscript.cur_node.expand();}
|
||||
pscript.group_area.ref_btn=ref_btn;pscript.acc_add_btn=$btn(pscript.group_area,'+ Add a child Account',function(){pscript.new_acc_dialog.show();});pscript.cc_add_btn=$btn(pscript.group_area,'+ Add a child Cost Center',null);pscript.cc_add_btn.onclick=function(){pscript.cc_dialog.widgets['Create'].onclick=function(){if(!pscript.cc_dialog.widgets['New Cost Center Name'].value){msgprint('Please enter New Cost Center Name');return;}
|
||||
if(!sel_val(pscript.cc_dialog.widgets['Group or Ledger'])){msgprint('Please specify cost center is group or ledger');return;}
|
||||
args={'cost_center_name':pscript.cc_dialog.widgets['New Cost Center Name'].value,'parent_cost_center':pscript.cur_node.rec.name,'group_or_ledger':sel_val(pscript.cc_dialog.widgets['Group or Ledger']),'company_name':sel_val(pscript.ab_company_sel),'company_abbr':'','old_parent':''}
|
||||
$c_obj('GL Control','add_cc',docstring(args),function(r,rt){pscript.cc_dialog.widgets['New Cost Center Name'].value='';pscript.cc_dialog.hide();pscript.group_area.ref_btn.onclick();});}
|
||||
pscript.new_cost_center_dialog.show();}}
|
||||
pscript.make_ledger_area=function(){pscript.ledger_area=$a(pscript.la,'div','ac_ledger');pscript.gl_rep=$a(pscript.ledger_area,'div','',{fontSize:'14px',marginBottom:'8px',fontWeight:'bold'});pscript.gl_rep.innerHTML='<img src="images/icons/report.png" style="margin-right: 8px"><span class="link_type">Open Ledger</span>';pscript.gl_rep.onclick=function(){pscript.make_report('gl');}}
|
||||
pscript.make_report=function(flag){if(flag=='gl'){var callback=function(report){report.set_filter('GL Entry','Account',pscript.cur_node.rec.name)
|
||||
report.dt.run();}
|
||||
loadreport('GL Entry','General Ledger',callback);}}
|
||||
pscript.make_new_acc_dialog=function(){var d=new Dialog(300,400,'Create A New Account');d.make_body([['HTML','Heading'],['Data','New Account Name'],['Select','Group or Ledger','Specify whether the new account is a Ledger or Group'],['Select','Account Type','[Optional] Specify the type of this account'],['Data','Tax Rate','Specify the default tax rate'],['Select','Master Type','Specify the master type of this account'],['Button','Create']]);add_sel_options(d.widgets['Group or Ledger'],['Group','Ledger'],'Group');add_sel_options(d.widgets['Account Type'],['','Fixed Asset Account','Bank or Cash','Expense Account','Tax','Income Account','Chargeable'],'');add_sel_options(d.widgets['Master Type'],['NA','Supplier','Customer','Employee'],'NA');d.widgets['Group or Ledger'].onchange=function(){if(sel_val(this)=='Ledger')$ds(d.rows['Account Type']);else $dh(d.rows['Account Type']);}
|
||||
d.widgets['Account Type'].onchange=function(){if(sel_val(this)=='Tax'||sel_val(this)=='Chargeable')$ds(d.rows['Tax Rate']);else $dh(d.rows['Tax Rate']);}
|
||||
d.onshow=function(){$dh(this.rows['Account Type']);$dh(this.rows['Tax Rate']);this.widgets['Group or Ledger'].selectedIndex=0;this.widgets['Account Type'].selectedIndex=0;this.widgets['Master Type'].selectedIndex=0;d.widgets['New Account Name'].value='';d.widgets['Tax Rate'].value='';}
|
||||
d.widgets['Create'].onclick=function(){if(!d.widgets['New Account Name'].value){msgprint('Please enter New Account Name');return;}
|
||||
if(!sel_val(d.widgets['Master Type'])){msgprint('Please enter master type of this new account');return;}
|
||||
args={'account_name':d.widgets['New Account Name'].value,'parent_account':pscript.cur_node.rec.name,'group_or_ledger':sel_val(d.widgets['Group or Ledger']),'company':sel_val(pscript.ab_company_sel),'account_type':sel_val(d.widgets['Account Type']),'tax_rate':d.widgets['Tax Rate'].value,'master_type':sel_val(d.widgets['Master Type'])}
|
||||
$c_obj('GL Control','add_ac',docstring(args),function(r,rt){d.hide();pscript.group_area.ref_btn.onclick();});}
|
||||
pscript.new_acc_dialog=d;}
|
||||
pscript.make_new_cost_center_dialog=function(){pscript.cc_dialog=new Dialog(300,400,'Create A New Cost Center');pscript.cc_dialog.make_body([['HTML','Heading'],['Data','New Cost Center Name'],['Select','Group or Ledger','Specify whether the new cost center is a Ledger or Group'],['Button','Create']]);add_sel_options(pscript.cc_dialog.widgets['Group or Ledger'],['Group','Ledger'],'Group');pscript.new_cost_center_dialog=pscript.cc_dialog;}
|
@ -1,38 +0,0 @@
|
||||
|
||||
$import(SMS Control)
|
||||
cur_frm.cscript.refresh=function(doc,cdt,cdn){if(!doc.docstatus){hide_field(['Update Follow up']);hide_field(['email_id1','cc_to','subject','message','Attachment Html','Create New File','enquiry_attachment_detail','Send Email']);}
|
||||
else{unhide_field(['Update Follow up']);unhide_field(['email_id1','cc_to','subject','message','Attachment Html','Create New File','enquiry_attachment_detail','Send Email']);}
|
||||
cur_frm.clear_custom_buttons();if(doc.docstatus==1){cur_frm.add_custom_button('Create Quotation',cur_frm.cscript['Create Quotation']);cur_frm.add_custom_button('Enquiry Lost',cur_frm.cscript['Declare Enquiry Lost']);cur_frm.add_custom_button('Send SMS',cur_frm.cscript['Send SMS']);}}
|
||||
cur_frm.cscript.onload=function(doc,cdt,cdn){if(!doc.enquiry_from)hide_field(['customer','customer_address','contact_person','customer_name','lead','lead_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);if(!doc.status)set_multiple(cdt,cdn,{status:'Draft'});if(!doc.date)doc.transaction_date=date.obj_to_str(new Date());if(!doc.company&&sys_defaults.company)set_multiple(cdt,cdn,{company:sys_defaults.company});if(!doc.fiscal_year&&sys_defaults.fiscal_year)set_multiple(cdt,cdn,{fiscal_year:sys_defaults.fiscal_year});if(doc.enquiry_from){if(doc.enquiry_from=='Customer'){hide_field(['lead','lead_name']);}
|
||||
else if(doc.enquiry_from=='Lead'){hide_field(['customer','customer_address','contact_person','customer_name','contact_display','customer_group']);}}
|
||||
if(doc.enquiry_from=='Lead'&&doc.lead){cur_frm.cscript.lead(doc,cdt,cdn);}
|
||||
cur_frm.cscript.set_fetch();}
|
||||
cur_frm.cscript.set_fetch=function(){cur_frm.add_fetch('item_code','item_name','item_name');cur_frm.add_fetch('item_code','stock_uom','uom');cur_frm.add_fetch('item_code','description','description');cur_frm.add_fetch('item_code','item_group','item_group');cur_frm.add_fetch('item_code','brand','brand');}
|
||||
cur_frm.cscript.enquiry_from=function(doc,cdt,cdn){cur_frm.cscript.lead_cust_show(doc,cdt,cdn);}
|
||||
cur_frm.cscript.lead_cust_show=function(doc,cdt,cdn){if(doc.enquiry_from=='Lead'){unhide_field(['lead']);hide_field(['lead_name','customer','customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);doc.lead=doc.lead_name=doc.customer=doc.customer_address=doc.contact_person=doc.address_display=doc.contact_display=doc.contact_mobile=doc.contact_email=doc.territory=doc.customer_group="";}
|
||||
else if(doc.enquiry_from=='Customer'){unhide_field(['customer']);hide_field(['lead','lead_name','address_display','contact_display','contact_mobile','contact_email','territory']);doc.lead=doc.lead_name=doc.customer=doc.customer_address=doc.contact_person=doc.address_display=doc.contact_display=doc.contact_mobile=doc.contact_email=doc.territory=doc.customer_group="";}}
|
||||
cur_frm.cscript.customer=function(doc,dt,dn){if(doc.customer)get_server_fields('get_default_customer_address',JSON.stringify({customer:doc.customer}),'',doc,dt,dn,1);if(doc.customer)unhide_field(['customer_name','customer_address','contact_person','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);}
|
||||
cur_frm.cscript.customer_address=cur_frm.cscript.contact_person=function(doc,dt,dn){if(doc.customer)get_server_fields('get_customer_address',JSON.stringify({customer:doc.customer,address:doc.customer_address,contact:doc.contact_person}),'',doc,dt,dn,1);}
|
||||
cur_frm.fields_dict.customer_address.on_new=function(dn){locals['Address'][dn].customer=locals[cur_frm.doctype][cur_frm.docname].customer;locals['Address'][dn].customer_name=locals[cur_frm.doctype][cur_frm.docname].customer_name;}
|
||||
cur_frm.fields_dict.contact_person.on_new=function(dn){locals['Contact'][dn].customer=locals[cur_frm.doctype][cur_frm.docname].customer;locals['Contact'][dn].customer_name=locals[cur_frm.doctype][cur_frm.docname].customer_name;}
|
||||
cur_frm.fields_dict['customer_address'].get_query=function(doc,cdt,cdn){return'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+doc.customer+'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';}
|
||||
cur_frm.fields_dict['contact_person'].get_query=function(doc,cdt,cdn){return'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+doc.customer+'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';}
|
||||
cur_frm.fields_dict['lead'].get_query=function(doc,cdt,cdn){return'SELECT `tabLead`.name, `tabLead`.lead_name FROM `tabLead` WHERE `tabLead`.%(key)s LIKE "%s" ORDER BY `tabLead`.`name` ASC LIMIT 50';}
|
||||
cur_frm.cscript.lead=function(doc,cdt,cdn){if(doc.lead)get_server_fields('get_lead_details',doc.lead,'',doc,cdt,cdn,1);if(doc.lead)unhide_field(['lead_name','address_display','contact_mobile','contact_email','territory']);}
|
||||
cur_frm.fields_dict['enquiry_details'].grid.get_field('item_code').get_query=function(doc,cdt,cdn){if(doc.enquiry_type=='Maintenance')
|
||||
return'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_service_item="Yes" AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") AND tabItem.%(key)s LIKE "%s" LIMIT 50';else
|
||||
return'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_sales_item="Yes" AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") AND tabItem.%(key)s LIKE "%s" LIMIT 50';}
|
||||
cur_frm.cscript.item_code=function(doc,cdt,cdn){var d=locals[cdt][cdn];if(d.item_code){get_server_fields('get_item_details',d.item_code,'enquiry_details',doc,cdt,cdn,1);}}
|
||||
cur_frm.cscript['Create New File']=function(doc){var fl=LocalDB.create('File');fl=locals['File'][fl];loaddoc('File',fl.name);}
|
||||
cur_frm.cscript['Update Follow up']=function(doc,cdt,cdn){$c_obj(make_doclist(doc.doctype,doc.name),'update_follow_up','',function(r,rt){refresh_field('follow_up');doc.__unsaved=0;cur_frm.refresh_header();});}
|
||||
cur_frm.cscript['Create Quotation']=function(){n=createLocal("Quotation");$c('dt_map',args={'docs':compress_doclist([locals["Quotation"][n]]),'from_doctype':'Enquiry','to_doctype':'Quotation','from_docname':cur_frm.docname,'from_to_list':"[['Enquiry', 'Quotation'],['Enquiry Detail','Quotation Detail']]"},function(r,rt){loaddoc("Quotation",n);});}
|
||||
cur_frm.cscript['Declare Enquiry Lost']=function(){var e_lost_dialog;set_e_lost_dialog=function(){e_lost_dialog=new Dialog(400,150,'Add Enquiry Lost Reason');e_lost_dialog.make_body([['HTML','Message','<div class="comment">Please add enquiry lost reason</div>'],['Text','Enquiry Lost Reason'],['HTML','Response','<div class = "comment" id="update_enquiry_dialog_response"></div>'],['HTML','Add Reason','<div></div>']]);var add_reason_btn1=$a($i(e_lost_dialog.widgets['Add Reason']),'button','button');add_reason_btn1.innerHTML='Add';add_reason_btn1.onclick=function(){e_lost_dialog.add();}
|
||||
var add_reason_btn2=$a($i(e_lost_dialog.widgets['Add Reason']),'button','button');add_reason_btn2.innerHTML='Cancel';$y(add_reason_btn2,{marginLeft:'4px'});add_reason_btn2.onclick=function(){e_lost_dialog.hide();}
|
||||
e_lost_dialog.onshow=function(){e_lost_dialog.widgets['Enquiry Lost Reason'].value='';$i('update_enquiry_dialog_response').innerHTML='';}
|
||||
e_lost_dialog.add=function(){$i('update_enquiry_dialog_response').innerHTML='Processing...';var arg=strip(e_lost_dialog.widgets['Enquiry Lost Reason'].value);var call_back=function(r,rt){if(r.message=='true'){$i('update_enquiry_dialog_response').innerHTML='Done';e_lost_dialog.hide();}}
|
||||
if(arg){$c_obj(make_doclist(cur_frm.doc.doctype,cur_frm.doc.name),'declare_enquiry_lost',arg,call_back);}
|
||||
else{msgprint("Please add enquiry lost reason");}}}
|
||||
if(!e_lost_dialog){set_e_lost_dialog();}
|
||||
e_lost_dialog.show();}
|
||||
cur_frm.fields_dict['territory'].get_query=function(doc,cdt,cdn){return'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';}
|
||||
cur_frm.cscript.validate=function(doc,cdt,cdn){}
|
@ -1,18 +0,0 @@
|
||||
|
||||
$import(SMS Control)
|
||||
cur_frm.cscript.onload=function(doc,cdt,cdn){if(user=='Guest'){hide_field(['status','naming_series','order_lost_reason','customer','rating','fax','website','territory','TerritoryHelp','address_line1','address_line2','city','state','country','pincode','address','lead_owner','market_segment','industry','campaign_name','interested_in','company','fiscal_year','contact_by','contact_date','last_contact_date','contact_date_ref','to_discuss','More Info','follow_up','Communication History','cc_to','subject','message','Attachment Html','Create New File','lead_attachment_detail','Send Email','Email','Create Customer','Create Enquiry','Next Steps','transaction_date','type','source']);doc.source='Website';}
|
||||
if(!doc.status)set_multiple(dt,dn,{status:'Open'});if(!doc.date){doc.date=date.obj_to_str(new Date());}
|
||||
if(user=='Guest')doc.naming_series='WebLead';cur_frm.add_fetch('customer','customer_name','company_name');}
|
||||
cur_frm.cscript.refresh=function(doc,cdt,cdn){cur_frm.clear_custom_buttons()
|
||||
if(!doc.__islocal&&!in_list(['Converted','Lead Lost'],doc.status)){cur_frm.add_custom_button('Create Customer',cur_frm.cscript['Create Customer']);cur_frm.add_custom_button('Create Enquiry',cur_frm.cscript['Create Enquiry']);cur_frm.add_custom_button('Send SMS',cur_frm.cscript['Send SMS']);}}
|
||||
cur_frm.cscript.status=function(doc,cdt,cdn){cur_frm.cscript.refresh(doc,cdt,cdn);}
|
||||
cur_frm.cscript.TerritoryHelp=function(doc,dt,dn){var call_back=function(){var sb_obj=new SalesBrowser();sb_obj.set_val('Territory');}
|
||||
loadpage('Sales Browser',call_back);}
|
||||
cur_frm.cscript['Create New File']=function(doc){new_doc("File");}
|
||||
cur_frm.cscript.item_code=function(doc,cdt,cdn){var d=locals[cdt][cdn];if(d.item_code){get_server_fields('get_item_detail',d.item_code,'lead_item_detail',doc,cdt,cdn,1);}}
|
||||
cur_frm.cscript['Create Customer']=function(){var doc=cur_frm.doc;$c('runserverobj',args={'method':'check_status','docs':compress_doclist([doc])},function(r,rt){if(r.message=='Converted'){msgprint("This lead is already converted to customer");}
|
||||
else{n=createLocal("Customer");$c('dt_map',args={'docs':compress_doclist([locals["Customer"][n]]),'from_doctype':'Lead','to_doctype':'Customer','from_docname':doc.name,'from_to_list':"[['Lead', 'Customer']]"},function(r,rt){loaddoc("Customer",n);});}});}
|
||||
cur_frm.cscript['Send Email']=function(doc,cdt,cdn){if(doc.__islocal!=1){$c_obj(make_doclist(doc.doctype,doc.name),'send_mail','',function(r,rt){});}else{msgprint("Please save lead first before sending email")}}
|
||||
cur_frm.cscript['Create Enquiry']=function(){var doc=cur_frm.doc;$c('runserverobj',args={'method':'check_status','docs':compress_doclist([doc])},function(r,rt){if(r.message=='Converted'){msgprint("This lead is now converted to customer. Please create enquiry on behalf of customer");}
|
||||
else{n=createLocal("Enquiry");$c('dt_map',args={'docs':compress_doclist([locals["Enquiry"][n]]),'from_doctype':'Lead','to_doctype':'Enquiry','from_docname':doc.name,'from_to_list':"[['Lead', 'Enquiry']]"},function(r,rt){loaddoc("Enquiry",n);});}});}
|
||||
cur_frm.fields_dict['territory'].get_query=function(doc,cdt,cdn){return'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';}
|
@ -1,40 +0,0 @@
|
||||
|
||||
cur_frm.cscript.tname="Quotation Detail";cur_frm.cscript.fname="quotation_details";cur_frm.cscript.other_fname="other_charges";cur_frm.cscript.sales_team_fname="sales_team";$import(Sales Common)
|
||||
$import(Other Charges)
|
||||
$import(SMS Control)
|
||||
cur_frm.cscript.onload=function(doc,cdt,cdn){if(!doc.quotation_to)hide_field(['customer','customer_address','contact_person','customer_name','lead','lead_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);if(!doc.price_list_name)set_multiple(cdt,cdn,{price_list_name:sys_defaults.price_list_name});if(!doc.status)set_multiple(cdt,cdn,{status:'Draft'});if(!doc.transaction_date)set_multiple(cdt,cdn,{transaction_date:get_today()});if(!doc.conversion_rate)set_multiple(cdt,cdn,{conversion_rate:'1.00'});if(!doc.currency&&sys_defaults.currency)set_multiple(cdt,cdn,{currency:sys_defaults.currency});if(!doc.company&&sys_defaults.company)set_multiple(cdt,cdn,{company:sys_defaults.company});if(!doc.fiscal_year&&sys_defaults.fiscal_year)set_multiple(cdt,cdn,{fiscal_year:sys_defaults.fiscal_year});if(doc.__islocal&&!getchildren('RV Tax Detail',doc.name,'other_charges',doc.doctype).length)cur_frm.cscript.load_taxes(doc,cdt,cdn);if(doc.__islocal==1){cur_frm.cscript.price_list_name(doc,cdt,cdn);}
|
||||
if(doc.quotation_to){if(doc.quotation_to=='Customer'){hide_field(['lead','lead_name']);}
|
||||
else if(doc.quotation_to=='Lead'){hide_field(['customer','customer_address','contact_person','customer_name','contact_display','customer_group']);}}}
|
||||
cur_frm.cscript.lead_cust_show=function(doc,cdt,cdn){if(doc.quotation_to=='Lead'){unhide_field(['lead']);hide_field(['lead_name','customer','customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);doc.lead=doc.lead_name=doc.customer=doc.customer_address=doc.contact_person=doc.address_display=doc.contact_display=doc.contact_mobile=doc.contact_email=doc.territory=doc.customer_group="";}
|
||||
else if(doc.quotation_to=='Customer'){unhide_field(['customer']);hide_field(['lead','lead_name','address_display','contact_display','contact_mobile','contact_email','territory']);doc.lead=doc.lead_name=doc.customer=doc.customer_address=doc.contact_person=doc.address_display=doc.contact_display=doc.contact_mobile=doc.contact_email=doc.territory=doc.customer_group="";}}
|
||||
cur_frm.cscript.quotation_to=function(doc,cdt,cdn){cur_frm.cscript.lead_cust_show(doc,cdt,cdn);}
|
||||
cur_frm.cscript.refresh=function(doc,cdt,cdn){cur_frm.clear_custom_buttons();if(doc.docstatus==1&&doc.status!='Order Lost'){cur_frm.add_custom_button('Make Sales Order',cur_frm.cscript['Make Sales Order']);cur_frm.add_custom_button('Set as Lost',cur_frm.cscript['Declare Order Lost']);cur_frm.add_custom_button('Send SMS',cur_frm.cscript['Send SMS']);}
|
||||
if(!doc.docstatus)hide_field(['Update Follow up']);else unhide_field(['Update Follow up']);}
|
||||
cur_frm.cscript.customer=function(doc,dt,dn){if(doc.customer)get_server_fields('get_default_customer_address',JSON.stringify({customer:doc.customer}),'',doc,dt,dn,1);if(doc.customer)unhide_field(['customer_address','contact_person','customer_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);}
|
||||
cur_frm.cscript.customer_address=cur_frm.cscript.contact_person=function(doc,dt,dn){if(doc.customer)get_server_fields('get_customer_address',JSON.stringify({customer:doc.customer,address:doc.customer_address,contact:doc.contact_person}),'',doc,dt,dn,1);}
|
||||
cur_frm.fields_dict.customer_address.on_new=function(dn){locals['Address'][dn].customer=locals[cur_frm.doctype][cur_frm.docname].customer;locals['Address'][dn].customer_name=locals[cur_frm.doctype][cur_frm.docname].customer_name;}
|
||||
cur_frm.fields_dict.contact_person.on_new=function(dn){locals['Contact'][dn].customer=locals[cur_frm.doctype][cur_frm.docname].customer;locals['Contact'][dn].customer_name=locals[cur_frm.doctype][cur_frm.docname].customer_name;}
|
||||
cur_frm.fields_dict['customer_address'].get_query=function(doc,cdt,cdn){return'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+doc.customer+'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';}
|
||||
cur_frm.fields_dict['contact_person'].get_query=function(doc,cdt,cdn){return'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+doc.customer+'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';}
|
||||
cur_frm.fields_dict['lead'].get_query=function(doc,cdt,cdn){return'SELECT `tabLead`.name, `tabLead`.lead_name FROM `tabLead` WHERE `tabLead`.%(key)s LIKE "%s" ORDER BY `tabLead`.`name` ASC LIMIT 50';}
|
||||
cur_frm.cscript.lead=function(doc,cdt,cdn){if(doc.lead)get_server_fields('get_lead_details',doc.lead,'',doc,cdt,cdn,1);if(doc.lead)unhide_field(['lead_name','address_display','contact_mobile','contact_email','territory']);}
|
||||
cur_frm.fields_dict['enq_no'].get_query=function(doc,cdt,cdn){var cond='';var cond1='';if(doc.order_type)cond='ifnull(`tabEnquiry`.enquiry_type, "") = "'+doc.order_type+'" AND';if(doc.customer)cond1='`tabEnquiry`.customer = "'+doc.customer+'" AND';else if(doc.lead)cond1='`tabEnquiry`.lead = "'+doc.lead+'" AND';return repl('SELECT `tabEnquiry`.`name` FROM `tabEnquiry` WHERE `tabEnquiry`.`docstatus` = 1 AND `tabEnquiry`.status = "Submitted" AND %(cond)s %(cond1)s `tabEnquiry`.`name` LIKE "%s" ORDER BY `tabEnquiry`.`name` ASC LIMIT 50',{cond:cond,cond1:cond1});}
|
||||
cur_frm.cscript['Make Sales Order']=function(){var doc=cur_frm.doc;if(doc.docstatus==1){var n=createLocal("Sales Order");$c('dt_map',args={'docs':compress_doclist([locals["Sales Order"][n]]),'from_doctype':'Quotation','to_doctype':'Sales Order','from_docname':doc.name,'from_to_list':"[['Quotation', 'Sales Order'], ['Quotation Detail', 'Sales Order Detail'],['RV Tax Detail','RV Tax Detail'], ['Sales Team', 'Sales Team'], ['TC Detail', 'TC Detail']]"},function(r,rt){loaddoc("Sales Order",n);});}}
|
||||
cur_frm.cscript['Pull Enquiry Detail']=function(doc,cdt,cdn){var callback=function(r,rt){if(r.message){doc.quotation_to=r.message;if(doc.quotation_to=='Lead'){unhide_field(['lead','lead_name','address_display','contact_mobile','contact_email','territory']);}
|
||||
else if(doc.quotation_to=='Customer'){unhide_field(['customer','customer_address','contact_person','address_display','contact_display','contact_mobile','contact_email','territory','customer_group']);}
|
||||
refresh_many(['quotation_details','quotation_to','customer','customer_address','contact_person','lead','lead_name','address_display','contact_display','contact_mobile','contact_email','territory','customer_group','order_type']);}}
|
||||
$c_obj(make_doclist(doc.doctype,doc.name),'pull_enq_details','',callback);}
|
||||
cur_frm.cscript['Update Follow up']=function(doc){$c_obj(make_doclist(doc.doctype,doc.name),'update_followup_details','',function(r,rt){refresh_field('follow_up');doc.__unsaved=0;cur_frm.refresh_header();});}
|
||||
cur_frm.cscript['Declare Order Lost']=function(){var qtn_lost_dialog;set_qtn_lost_dialog=function(doc,cdt,cdn){qtn_lost_dialog=new Dialog(400,400,'Add Quotation Lost Reason');qtn_lost_dialog.make_body([['HTML','Message','<div class="comment">Please add quotation lost reason</div>'],['Text','Quotation Lost Reason'],['HTML','Response','<div class = "comment" id="update_quotation_dialog_response"></div>'],['HTML','Add Reason','<div></div>']]);var add_reason_btn1=$a($i(qtn_lost_dialog.widgets['Add Reason']),'button','button');add_reason_btn1.innerHTML='Add';add_reason_btn1.onclick=function(){qtn_lost_dialog.add();}
|
||||
var add_reason_btn2=$a($i(qtn_lost_dialog.widgets['Add Reason']),'button','button');add_reason_btn2.innerHTML='Cancel';$y(add_reason_btn2,{marginLeft:'4px'});add_reason_btn2.onclick=function(){qtn_lost_dialog.hide();}
|
||||
qtn_lost_dialog.onshow=function(){qtn_lost_dialog.widgets['Quotation Lost Reason'].value='';$i('update_quotation_dialog_response').innerHTML='';}
|
||||
qtn_lost_dialog.add=function(){$i('update_quotation_dialog_response').innerHTML='Processing...';var arg=strip(qtn_lost_dialog.widgets['Quotation Lost Reason'].value);var call_back=function(r,rt){if(r.message=='true'){$i('update_quotation_dialog_response').innerHTML='Done';qtn_lost_dialog.hide();}}
|
||||
if(arg)$c_obj(make_doclist(cur_frm.doc.doctype,cur_frm.doc.name),'declare_order_lost',arg,call_back);else msgprint("Please add Quotation lost reason");}}
|
||||
if(!qtn_lost_dialog){set_qtn_lost_dialog(doc,cdt,cdn);}
|
||||
qtn_lost_dialog.show();}
|
||||
cur_frm.cscript['Get Report']=function(doc,cdt,cdn){var callback=function(report){report.set_filter('Sales Order Detail','Quotation No.',doc.name)
|
||||
report.dt.run();}
|
||||
loadreport('Sales Order Detail','Itemwise Sales Details',callback);}
|
||||
cur_frm.cscript.quot_to_validate=function(doc,cdt,cdn){if(doc.quotation_to=='Lead'){if(!doc.lead){alert("Lead is mandatory.");validated=false;}}
|
||||
else if(doc.quotation_to=='Customer'){if(!doc.customer){alert("Customer is mandatory.");validated=false;}}}
|
||||
cur_frm.cscript.validate=function(doc,cdt,cdn){cur_frm.cscript.quot_to_validate(doc,cdt,cdn);}
|
@ -1,74 +0,0 @@
|
||||
|
||||
cur_frm.cscript.load_taxes=function(doc,cdt,cdn){if(doc.customer)return;$c_obj([doc],'load_default_taxes','',function(r,rt){refresh_field('other_charges');});}
|
||||
cur_frm.add_fetch('company','default_currency','currency');cur_frm.cscript.customer=function(doc,cdt,cdn){if(doc.customer){if(!doc.company){msgprint("Please select company to proceed");doc.customer='';refresh_field('customer');}else{var callback=function(r,rt){cur_frm.refresh();}
|
||||
$c_obj(make_doclist(doc.doctype,doc.name),'get_customer_details','',callback);}}}
|
||||
cur_frm.cscript.TerritoryHelp=function(doc,dt,dn){var call_back=function(){var sb_obj=new SalesBrowser();sb_obj.set_val('Territory');}
|
||||
loadpage('Sales Browser',call_back);}
|
||||
cur_frm.cscript.CGHelp=function(doc,dt,dn){var call_back=function(){var sb_obj=new SalesBrowser();sb_obj.set_val('Customer Group');}
|
||||
loadpage('Sales Browser',call_back);}
|
||||
cur_frm.cscript.currency=function(doc,cdt,cdn){cur_frm.cscript.price_list_name(doc,cdt,cdn);}
|
||||
cur_frm.cscript.price_list_name=function(doc,cdt,cdn){var fname=cur_frm.cscript.fname;if(doc.price_list_name&&doc.currency){$c_obj(make_doclist(doc.doctype,doc.name),'get_adj_percent','',function(r,rt){refresh_field(fname);var doc=locals[cdt][cdn];cur_frm.cscript.recalc(doc,3);});}}
|
||||
cur_frm.cscript.conversion_rate=function(doc,cdt,cdn){cur_frm.cscript.recalc(doc,3);}
|
||||
cur_frm.fields_dict[cur_frm.cscript.fname].grid.get_field("item_code").get_query=function(doc,cdt,cdn){if(doc.order_type=='Maintenance')
|
||||
return'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_service_item="Yes" AND tabItem.docstatus != 2 AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") AND tabItem.%(key)s LIKE "%s" LIMIT 50';else
|
||||
return'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_sales_item="Yes" AND tabItem.docstatus != 2 AND (ifnull(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` > NOW() OR `tabItem`.`end_of_life`="0000-00-00") AND tabItem.%(key)s LIKE "%s" LIMIT 50';}
|
||||
cur_frm.cscript.item_code=function(doc,cdt,cdn){var fname=cur_frm.cscript.fname;var d=locals[cdt][cdn];if(d.item_code){if(!doc.company){msgprint("Please select company to proceed");d.item_code='';refresh_field('item_code',d.name,fname);}else{var callback=function(r,rt){cur_frm.cscript.recalc(doc,1);}
|
||||
get_server_fields('get_item_details',d.item_code,fname,doc,cdt,cdn,1,callback);}}
|
||||
if(cur_frm.cscript.custom_item_code){cur_frm.cscript.custom_item_code(doc,cdt,cdn);}}
|
||||
cur_frm.cscript.qty=function(doc,cdt,cdn){cur_frm.cscript.recalc(doc,1);}
|
||||
cur_frm.cscript.adj_rate=function(doc,cdt,cdn){cur_frm.cscript.recalc(doc,1);}
|
||||
cur_frm.cscript.ref_rate=function(doc,cdt,cdn){var d=locals[cdt][cdn];set_multiple(cur_frm.cscript.tname,d.name,{'export_rate':flt(d.ref_rate)*(100-flt(d.adj_rate))/100},cur_frm.cscript.fname);cur_frm.cscript.recalc(doc,3);}
|
||||
cur_frm.cscript.basic_rate=function(doc,cdt,cdn){var fname=cur_frm.cscript.fname;var d=locals[cdt][cdn];;if(!d.qty)
|
||||
{d.qty=1;refresh_field('qty',d.name,fname);}
|
||||
cur_frm.cscript.recalc(doc,2);}
|
||||
cur_frm.cscript.export_rate=function(doc,cdt,cdn){cur_frm.cscript.recalc(doc,3);}
|
||||
cur_frm.fields_dict.charge.get_query=function(doc){return'SELECT DISTINCT `tabOther Charges`.name FROM `tabOther Charges` WHERE `tabOther Charges`.company = "'+doc.company+'" AND `tabOther Charges`.company is not NULL AND `tabOther Charges`.docstatus != 2 AND `tabOther Charges`.%(key)s LIKE "%s" ORDER BY `tabOther Charges`.name LIMIT 50';}
|
||||
cur_frm.cscript['Get Charges']=function(doc,cdt,cdn){$c_obj(make_doclist(doc.doctype,doc.name),'get_other_charges','',function(r,rt){cur_frm.cscript['Calculate Charges'](doc,cdt,cdn);});}
|
||||
cur_frm.cscript.recalc=function(doc,n){if(!n)n=0;doc=locals[doc.doctype][doc.name];var tname=cur_frm.cscript.tname;var fname=cur_frm.cscript.fname;var sales_team=cur_frm.cscript.sales_team_fname;var other_fname=cur_frm.cscript.other_fname;if(!flt(doc.conversion_rate)){doc.conversion_rate=1;refresh_field('conversion_rate');}
|
||||
if(n>0)cur_frm.cscript.update_fname_table(doc,tname,fname,n);if(flt(doc.net_total)>0){var cl=getchildren('RV Tax Detail',doc.name,other_fname,doc.doctype);for(var i=0;i<cl.length;i++){cl[i].total_tax_amount=0;cl[i].total_amount=0;cl[i].tax_amount=0;cl[i].total=0;cl[i].item_wise_tax_detail="";if(in_list(['On Previous Row Amount','On Previous Row Total'],cl[i].charge_type)&&!cl[i].row_id){alert("Please Enter Row on which amount needs to be calculated for row : "+cl[i].idx);validated=false;}}
|
||||
cur_frm.cscript.calc_other_charges(doc,tname,fname,other_fname);}
|
||||
cur_frm.cscript.calc_doc_values(doc,cdt,cdn,tname,fname,other_fname);cl=getchildren('Sales Team',doc.name,sales_team);for(var i=0;i<cl.length;i++){if(cl[i].allocated_percentage){cl[i].allocated_amount=flt(flt(doc.net_total)*flt(cl[i].allocated_percentage)/100);refresh_field('allocated_amount',cl[i].name,sales_team);}}
|
||||
doc.in_words='';doc.in_words_export='';refresh_many(['total_discount_rate','total_discount','net_total','total_commission','grand_total','rounded_total','grand_total_export','rounded_total_export','in_words','in_words_export','other_charges','other_charges_total']);if(cur_frm.cscript.custom_recalc)cur_frm.cscript.custom_recalc(doc);}
|
||||
cur_frm.cscript.calc_doc_values=function(doc,cdt,cdn,tname,fname,other_fname){doc=locals[doc.doctype][doc.name];var net_total=0;var other_charges_total=0;var cl=getchildren(tname,doc.name,fname);for(var i=0;i<cl.length;i++){net_total+=flt(cl[i].amount);}
|
||||
var d=getchildren('RV Tax Detail',doc.name,other_fname,doc.doctype);for(var j=0;j<d.length;j++){other_charges_total+=flt(d[j].amount);}
|
||||
doc.net_total=flt(net_total);doc.other_charges_total=flt(other_charges_total);doc.grand_total=flt(flt(net_total)+flt(other_charges_total));doc.rounded_total=Math.round(doc.grand_total);doc.grand_total_export=flt(flt(doc.grand_total)/flt(doc.conversion_rate));doc.rounded_total_export=Math.round(doc.grand_total_export);doc.total_commission=flt(flt(net_total)*flt(doc.commission_rate)/100);}
|
||||
cur_frm.cscript.calc_other_charges=function(doc,tname,fname,other_fname){doc=locals[doc.doctype][doc.name];cur_frm.fields_dict['Other Charges Calculation'].disp_area.innerHTML='<b style="padding: 8px 0px;">Calculation Details for Other Charges:</b>';var cl=getchildren(tname,doc.name,fname);var tax=getchildren('RV Tax Detail',doc.name,other_fname,doc.doctype);var otc=make_table(cur_frm.fields_dict['Other Charges Calculation'].disp_area,cl.length+1,tax.length+1,'90%',[],{border:'1px solid #AAA',padding:'2px'});$y(otc,{marginTop:'8px'});var tax_desc={};var tax_desc_rates=[];var net_total=0;for(var i=0;i<cl.length;i++){net_total+=flt(flt(cl[i].qty)*flt(cl[i].basic_rate));var prev_total=flt(cl[i].amount);if(cl[i].item_tax_rate)
|
||||
var check_tax=eval('var a='+cl[i].item_tax_rate+';a');$td(otc,i+1,0).innerHTML=cl[i].item_code?cl[i].item_code:cl[i].description;var tax=getchildren('RV Tax Detail',doc.name,other_fname,doc.doctype);var total=net_total;for(var t=0;t<tax.length;t++){var account=tax[t].account_head;$td(otc,0,t+1).innerHTML=account?account:'';if(cl[i].item_tax_rate&&check_tax[account]!=null){rate=flt(check_tax[account]);}
|
||||
else
|
||||
rate=flt(tax[t].rate);var tax_amount=cur_frm.cscript.check_charge_type_and_get_tax_amount(doc,tax,t,cl[i],rate);item_wise_tax_detail=cur_frm.cscript.get_item_wise_tax_detail(doc,rate,cl,i,tax,t);if(tax[t].charge_type!="Actual")tax[t].item_wise_tax_detail+=item_wise_tax_detail;tax[t].total_amount=flt(tax_amount.toFixed(2));tax[t].total_tax_amount=flt(prev_total.toFixed(2));tax[t].tax_amount+=flt(tax_amount.toFixed(2));var total_amount=flt(tax[t].tax_amount);total_tax_amount=flt(tax[t].total_tax_amount)+flt(total_amount);set_multiple('RV Tax Detail',tax[t].name,{'item_wise_tax_detail':tax[t].item_wise_tax_detail,'amount':total_amount,'total':flt(total)+flt(tax[t].tax_amount)},other_fname);prev_total+=flt(tax[t].total_amount);total+=flt(tax[t].tax_amount);if(tax[t].charge_type=='Actual')
|
||||
$td(otc,i+1,t+1).innerHTML=fmt_money(tax[t].total_amount);else
|
||||
$td(otc,i+1,t+1).innerHTML='('+fmt_money(rate)+'%) '+fmt_money(tax[t].total_amount);}}}
|
||||
cur_frm.cscript.check_charge_type_and_get_tax_amount=function(doc,tax,t,cl,rate,print_amt){doc=locals[doc.doctype][doc.name];if(!print_amt)print_amt=0;var tax_amount=0;if(tax[t].charge_type=='Actual'){var value=flt(tax[t].rate)/flt(doc.net_total);return tax_amount=flt(value)*flt(cl.amount);}
|
||||
else if(tax[t].charge_type=='On Net Total'){if(flt(print_amt)==1){doc.excise_rate=flt(rate);doc.total_excise_rate+=flt(rate);refresh_field('excise_rate');refresh_field('total_excise_rate');return}
|
||||
return tax_amount=(flt(rate)*flt(cl.amount)/100);}
|
||||
else if(tax[t].charge_type=='On Previous Row Amount'){if(flt(print_amt)==1){doc.total_excise_rate+=flt(flt(doc.excise_rate)*0.01*flt(rate));refresh_field('total_excise_rate');return}
|
||||
var row_no=(tax[t].row_id).toString();var row=(row_no).split("+");for(var r=0;r<row.length;r++){var id=cint(row[r].replace(/^\s+|\s+$/g,""));tax_amount+=(flt(rate)*flt(tax[id-1].total_amount)/100);}
|
||||
var row_id=row_no.indexOf("/");if(row_id!=-1){rate='';var row=(row_no).split("/");if(row.length>2)alert("You cannot enter more than 2 nos. for division");var id1=cint(row[0].replace(/^\s+|\s+$/g,""));var id2=cint(row[1].replace(/^\s+|\s+$/g,""));tax_amount=flt(tax[id1-1].total_amount)/flt(tax[id2-1].total_amount);}
|
||||
return tax_amount}
|
||||
else if(tax[t].charge_type=='On Previous Row Total'){if(flt(print_amt)==1){doc.sales_tax_rate+=flt(rate);refresh_field('sales_tax_rate');return}
|
||||
var row=cint(tax[t].row_id);return tax_amount=flt(rate)*(flt(tax[row-1].total_tax_amount)+flt(tax[row-1].total_amount))/100;}}
|
||||
cur_frm.cscript.update_fname_table=function(doc,tname,fname,n){doc=locals[doc.doctype][doc.name]
|
||||
var net_total=0
|
||||
var cl=getchildren(tname,doc.name,fname);for(var i=0;i<cl.length;i++){if(n==1){if(flt(cl[i].ref_rate)>0)
|
||||
set_multiple(tname,cl[i].name,{'export_rate':flt(flt(cl[i].ref_rate)*(100-flt(cl[i].adj_rate))/100)},fname);set_multiple(tname,cl[i].name,{'export_amount':flt(flt(cl[i].qty)*flt(cl[i].export_rate)),'basic_rate':flt(flt(cl[i].export_rate)*flt(doc.conversion_rate)),'amount':flt((flt(cl[i].export_rate)*flt(doc.conversion_rate))*flt(cl[i].qty))},fname);}
|
||||
else if(n==2){if(flt(cl[i].ref_rate)>0)
|
||||
set_multiple(tname,cl[i].name,{'adj_rate':100-flt(flt(cl[i].basic_rate)*100/(flt(cl[i].ref_rate)*flt(doc.conversion_rate)))},fname);set_multiple(tname,cl[i].name,{'amount':flt(flt(cl[i].qty)*flt(cl[i].basic_rate)),'export_rate':flt(flt(cl[i].basic_rate)/flt(doc.conversion_rate)),'export_amount':flt((flt(cl[i].basic_rate)/flt(doc.conversion_rate))*flt(cl[i].qty))},fname);}
|
||||
else if(n==3){set_multiple(tname,cl[i].name,{'basic_rate':flt(flt(cl[i].export_rate)*flt(doc.conversion_rate))},fname);set_multiple(tname,cl[i].name,{'amount':flt(flt(cl[i].basic_rate)*flt(cl[i].qty)),'export_amount':flt(flt(cl[i].export_rate)*flt(cl[i].qty))},fname);if(cl[i].ref_rate>0)
|
||||
set_multiple(tname,cl[i].name,{'adj_rate':100-flt(flt(cl[i].export_rate)*100/flt(cl[i].ref_rate)),'base_ref_rate':flt(flt(cl[i].ref_rate)*flt(doc.conversion_rate))},fname);}
|
||||
net_total+=flt(flt(cl[i].qty)*flt(cl[i].basic_rate));}
|
||||
doc.net_total=net_total;refresh_field('net_total');}
|
||||
cur_frm.cscript.get_item_wise_tax_detail=function(doc,rate,cl,i,tax,t){doc=locals[doc.doctype][doc.name];var detail='';detail=cl[i].item_code+" : "+cstr(rate)+NEWLINE;return detail;}
|
||||
cur_frm.cscript['Re-Calculate Values']=function(doc,cdt,cdn){cur_frm.cscript['Calculate Charges'](doc,cdt,cdn);}
|
||||
cur_frm.cscript['Calculate Charges']=function(doc,cdt,cdn){var other_fname=cur_frm.cscript.other_fname;var cl=getchildren('RV Tax Detail',doc.name,other_fname,doc.doctype);for(var i=0;i<cl.length;i++){cl[i].total_tax_amount=0;cl[i].total_amount=0;cl[i].tax_amount=0;cl[i].total=0;if(in_list(['On Previous Row Amount','On Previous Row Total'],cl[i].charge_type)&&!cl[i].row_id){alert("Please Enter Row on which amount needs to be calculated for row : "+cl[i].idx);validated=false;}}
|
||||
cur_frm.cscript.recalc(doc,1);}
|
||||
cur_frm.cscript.sales_partner=function(doc,cdt,cdn){if(doc.sales_partner){get_server_fields('get_comm_rate',doc.sales_partner,'',doc,cdt,cdn,1);}}
|
||||
cur_frm.cscript.commission_rate=function(doc,cdt,cdn){if(doc.commission_rate>100){alert("Commision rate cannot be greater than 100.");doc.total_commission=0;doc.commission_rate=0;}
|
||||
else
|
||||
doc.total_commission=doc.net_total*doc.commission_rate/100;refresh_many(['total_commission','commission_rate']);}
|
||||
cur_frm.cscript.total_commission=function(doc,cdt,cdn){if(doc.net_total){if(doc.net_total<doc.total_commission){alert("Total commission cannot be greater than net total.");doc.total_commission=0;doc.commission_rate=0;}
|
||||
else
|
||||
doc.commission_rate=doc.total_commission*100/doc.net_total;refresh_many(['total_commission','commission_rate']);}}
|
||||
cur_frm.cscript.allocated_percentage=function(doc,cdt,cdn){var fname=cur_frm.cscript.sales_team_fname;var d=locals[cdt][cdn];if(d.allocated_percentage){d.allocated_amount=flt(flt(doc.net_total)*flt(d.allocated_percentage)/100);refresh_field('allocated_amount',d.name,fname);}}
|
||||
cur_frm.cscript.validate=function(doc,cdt,cdn){cur_frm.cscript.validate_items(doc);var cl=getchildren('Other Charges',doc.name,'other_charges');for(var i=0;i<cl.length;i++){if(!cl[i].amount){alert("Please Enter Amount in Row no. "+cl[i].idx+" in Other Charges table");validated=false;}}
|
||||
cur_frm.cscript['Calculate Charges'](doc,cdt,cdn);if(cur_frm.cscript.calc_adjustment_amount)cur_frm.cscript.calc_adjustment_amount(doc);}
|
||||
cur_frm.cscript.validate_items=function(doc){var cl=getchildren(cur_frm.cscript.tname,doc.name,cur_frm.cscript.fname);if(!cl.length){alert("Please enter Items for "+doc.doctype);validated=false;}}
|
@ -1,2 +0,0 @@
|
||||
|
||||
cur_frm.add_fetch('customer','customer_name','customer_name');cur_frm.add_fetch('customer','address','customer_address');
|
@ -1,3 +0,0 @@
|
||||
|
||||
pscript.onload_customers=function(){make_customer_tab($i('dcv_customers'));}
|
||||
function make_customer_tab(parent){pscript.dcv_customers=new wn.widgets.DocColumnView('Customers',parent,['Customer Group','Customer','Contact'],{'Customer Group':{show_fields:['name'],create_fields:['name'],search_fields:['name'],next_col:'Customer'},'Customer':{show_fields:['name','customer_name'],create_fields:['name','customer_name'],search_fields:['customer_name'],filter_by:['Customer Group','customer_group'],next_col:'Contact'},'Contact':{show_fields:['name','first_name','last_name'],create_fields:['name','first_name','last_name'],search_fields:['first_name','last_name'],conditions:['is_customer=1'],set_values:{'is_customer':1},filter_by:['Customer','customer']},})}
|
@ -1,23 +0,0 @@
|
||||
|
||||
KBItemToolbar=function(args,kb){$.extend(this,args);var me=this;this.make=function(){this.wrapper=$a(this.parent,'div','',{});this.line1=$a(this.wrapper,'div','',{color:'#888',fontSize:'11px',margin:'7px 0px'});this.line2=$a(this.wrapper,'div','',{marginBottom:'7px'});this.make_timestamp();this.make_vote();if(this.with_tags)
|
||||
this.make_tags();}
|
||||
this.make_timestamp=function(){this.line1.innerHTML=repl('By %(name)s | %(when)s',{name:wn.utils.full_name(this.det.first_name,this.det.last_name),when:wn.datetime.comment_when(this.det.modified)})}
|
||||
this.make_vote=function(){new KBPoints(this.line2,this.det.points,this.det._users_voted,this.doctype,this.det.name,this.det.owner);}
|
||||
this.make_tags=function(){this.tags_area=$a(this.line2,'span','kb-tags')
|
||||
this.tags=new TagList(this.tags_area,this.det._user_tags&&(this.det._user_tags.split(',')),this.doctype,this.det.name,0,kb.set_tag_filter)}
|
||||
this.make();}
|
||||
KBPoints=function(parent,points,voted,dt,dn,owner){var me=this;voted=voted?voted.split(','):[];this.wrapper=$a(parent,'span','',{fontSize:'11px',marginRight:'13px'});this.render_points=function(p){if(!this.points_area)
|
||||
this.points_area=$a(this.wrapper,'span');this.points_area.innerHTML=cint(p)+' point'+(p>1?'s':'');}
|
||||
this.render_points(points);if(user!='Guest'&&!in_list(voted,user)&&user!=owner){this.vote_up=$a(this.wrapper,'img','images/ui/vote_up.gif',{margin:'0px 0px -2px 7px',cursor:'pointer'});this.vote_down=$a(this.wrapper,'img','images/ui/vote_down.gif',{margin:'0px 0px -3px 0px',cursor:'pointer'});this.vote_up.title='Vote Up';this.vote_down.title='Vote Down';var callback=function(r,rt){if(r.exc){msgprint(r.exc);return;}
|
||||
$dh(me.vote_up);$dh(me.vote_down);me.render_points(r.message);}
|
||||
this.vote_up.onclick=function(){$c_page('knowledge_base','questions','vote',{vote:'up',dn:dn,dt:dt},callback);}
|
||||
this.vote_down.onclick=function(){$c_page('knowledge_base','questions','vote',{vote:'down',dn:dn,dt:dt},callback);}}}
|
||||
EditableText=function(args){$.extend(this,args);var me=this;this.display=$a(me.parent,'div',me.disp_class,'',me.text);this.input=$a(me.parent,'textarea',me.inp_class,{display:'none'});var div=$a(me.parent,'div','',{marginTop:'5px',height:'23px'});this.edit_btn=$a(div,'span','',{color:'#333',marginLeft:'-2px',cursor:'pointer',padding:'3px',backgroundColor:'#ddd',cssFloat:'left'});$br(this.edit_btn,'3px')
|
||||
$a(this.edit_btn,'div','wn-icon ic-pencil',{marginBottom:'-2px',cssFloat:'left'});$a(this.edit_btn,'span','link_type',{marginLeft:'3px',color:'#555',fontSize:'11px'},'Edit');this.edit_btn.onclick=function(){me.input.value=me.display.innerHTML;me.show_as_input();}
|
||||
this.save_btn=$btn(div,'Save',function(){var v=me.rich_text?wn.tinymce.get_value(me.input):me.input.value;if(!v){msgprint('Please write something!');return;}
|
||||
me.save_btn.set_working();$c_page('knowledge_base','question_view','update_item',{dt:me.dt,dn:me.dn,fn:me.fieldname,text:v},function(r,rt){me.save_btn.done_working();if(r.exc){msgprint(r.exc);return;}
|
||||
me.display.innerHTML=v;me.show_as_text();});},{display:'none'});this.cancel_btn=$a(div,'span','link_type',{color:'#555',display:'none'},'Cancel',{marginLeft:'7px'});this.cancel_btn.onclick=function(){me.show_as_text();}
|
||||
this.show_as_text=function(){$ds(me.display);$ds(me.edit_btn);if(me.rich_text)
|
||||
wn.tinymce.remove(me.input);$dh(me.input);$dh(me.save_btn);$dh(me.cancel_btn);}
|
||||
this.show_as_input=function(){$ds(me.input);$ds(me.save_btn);$ds(me.cancel_btn);$dh(me.edit_btn);$dh(me.display);if(me.rich_text)
|
||||
wn.tinymce.add_simple(me.input,'300px');}}
|
@ -1,24 +0,0 @@
|
||||
|
||||
pscript['onload_question-view']=function(){var w=page_body.pages['question-view'];w.className='layout_wrapper';new PageHeader(w,'Knowledge Base');w.link=$ln($a(w,'div'),'< Back to all questions',function(){loadpage('questions');})
|
||||
w.body=$a(w,'div','qv-body');}
|
||||
pscript['refresh_question-view']=function(){var qid=window.location.hash.split('/')[1];if(qid){pscript.question_view(qid);}}
|
||||
pscript.question_view=function(qid,qtext){var w=page_body.pages['question-view'];new KBQuestionView(w,qid,qtext);}
|
||||
KBQuestionView=function(w,qid,qtext){var me=this;w.body.innerHTML='';w.question_area=$a(w.body,'div','social qv-question-wrapper');w.answer_area=$a(w.body,'div','social qv-answer-wrapper');w.add_answer_link=$a(w.body,'div','',{margin:'3px 0px'});w.add_answer_area=$a(w.body,'div','qv-add-answer');this.make_question=function(){new EditableText({parent:w.question_area,dt:'Question',dn:qid,fieldname:'question',text:qtext,inp_class:'qv-input',disp_class:'qv-text'});}
|
||||
this.make_answer_list=function(){this.ans_list=new KBAnswerList({parent:w.answer_area,qid:qid})}
|
||||
this.make_add_answer=function(){$c_page('knowledge_base','question_view','has_answered',qid,function(r,rt){if(r.message=='No'){me.make_answer_box_link();}});}
|
||||
this.make_answer_box_link=function(){$a(w.add_answer_link,'span','link_type',null,'+ Add your answer',function(){$dh(w.add_answer_link);me.make_answer_box();});}
|
||||
this.make_answer_box=function(){$ds(w.add_answer_area);$a(w.add_answer_area,'h3','',{},'Add Your Answer')
|
||||
this.input=$a(w.add_answer_area,'textarea');wn.tinymce.add_simple(this.input);this.btn=$btn($a(w.add_answer_area,'div'),'Post',function(){var v=wn.tinymce.get_value(me.input);if(!v){msgprint('Write something!');return;}
|
||||
me.btn.set_working();$c_page('knowledge_base','question_view','add_answer',{qid:qid,answer:v},function(r,rt){me.btn.done_working();me.ans_list.list.run();$dh(w.add_answer_area);});});}
|
||||
this.setup=function(){if(qtext){this.make();}
|
||||
else{$c_page('knowledge_base','question_view','get_question',qid,function(r,rt){qtext=r.message;me.make();});}}
|
||||
this.make=function(){set_title(qtext);this.make_question();this.make_answer_list();this.make_add_answer();}
|
||||
this.setup();}
|
||||
KBAnswerList=function(args){var me=this;$.extend(this,args);this.make_list=function(){this.list=new wn.widgets.Listing({parent:me.parent,as_dict:1,no_results_message:'No answers yet, be the first one to answer!',render_row:function(body,data){new KBAnswer(body,data)},get_query:function(){return repl("SELECT t1.name, t1.owner, t1.answer, t1.points, t1._users_voted, t2.first_name, "
|
||||
+"t2.last_name, t1.modified from tabAnswer t1, tabProfile t2 "
|
||||
+"where question='%(qid)s' and t1.owner = t2.name "
|
||||
+"order by t1.points desc, t1.modified desc",{qid:me.qid})}});this.list.run();}
|
||||
this.make_list();}
|
||||
KBAnswer=function(body,data){body.className='qv-answer';new EditableText({parent:body,dt:'Answer',dn:data.name,fieldname:'answer',text:data.answer,inp_class:'qv-ans-input',disp_class:'qv-ans-text',rich_text:1});var div=$a(body,'div','',{})
|
||||
new KBItemToolbar({parent:div,det:data,with_tags:0,doctype:'Answer'},null)}
|
||||
$import(knowledge_base.kb_common);
|
@ -1,27 +0,0 @@
|
||||
|
||||
pscript.onload_questions=function(){var w=page_body.pages['questions'];var tab=make_table(w,1,2,'100%',['75%','25%'],{});var body=$a($td(tab,0,0),'div','layout_wrapper');new PageHeader(body,'Knowledge Base');var kb=new KnowledgeBase(body);$y($td(tab,0,1),{paddingTop:'53px'});this.sidebar=new wn.widgets.PageSidebar($td(tab,0,1),{sections:[{title:'Top Tags',render:function(body){new wn.widgets.TagCloud(body,'Question',function(tag){kb.set_tag_filter(tag)});}}]});set_title('Knowledge Base');}
|
||||
function KnowledgeBase(w){var me=this;this.sort_by='modified';this.tag_filter_dict={};this.make_search_bar=function(){this.search=$a($a(w,'div','kb-search-wrapper'),'textarea');$(this.search).add_default_text('Enter keywords or a new Question');var div=$a(w,'div','kb-btn-wrapper');$btn(div,'Search',function(){me.run()},{fontSize:'14px'});$btn(div,'Ask',function(){me.ask()},{fontSize:'14px'});}
|
||||
this.ask=function(){if(this.search.value==$(this.search).attr('default_text')){msgprint('Please enter some text');return;}
|
||||
this.suggest();}
|
||||
this.suggest=function(){this.dialog=new wn.widgets.Dialog({title:'Suggest a users',width:400,fields:[{fieldtype:'HTML',options:'Optional: Suggest a few users who can help you answer this question<br>'},{fieldtype:'Link',fieldname:'profile1',label:'1st User',options:'Profile'},{fieldtype:'Link',fieldname:'profile2',label:'2nd User',options:'Profile'},{fieldtype:'Link',fieldname:'profile3',label:'3rd User',options:'Profile'},{fieldtype:'Button',fieldname:'ask',label:'Add the Question'}]});this.dialog.fields_dict.ask.input.onclick=function(){me.dialog.hide();me.add_question(values(me.dialog.get_values()));}
|
||||
this.dialog.show();}
|
||||
this.add_question=function(suggest_list){$c_page('knowledge_base','questions','add_question',{question:this.search.value,suggest:suggest_list},function(r,rt){$(me.search).val('').blur();me.run();})}
|
||||
this.make_tag_filter_area=function(){this.tag_filters=$a(w,'div','kb-tag-filter-area');$a(this.tag_filters,'span','',{marginRight:'4px',color:'#442'},'<i>Showing for:</i>');this.tag_area=$a(this.tag_filters,'span');}
|
||||
this.make_list=function(){this.make_tag_filter_area();this.list_area=$a(w,'div','',{marginRight:'13px'})
|
||||
this.no_result=$a(w,'div','help_box',{display:'none'},'No questions asked yet! Be the first one to ask')
|
||||
this.list=new wn.widgets.Listing({parent:this.list_area,no_results_message:'No questions found. Ask a new question!',as_dict:1,get_query:function(){var v=me.search.value==$(me.search).attr('default_text')?'':me.search.value;cond=v?(' and t1.question like "%'+v+'%"'):'';if(me.tag_filter_dict){for(f in me.tag_filter_dict){cond+=' and t1.`_user_tags` like "%'+f+'%"'}}
|
||||
return repl('select t1.name, t1.owner, t1.question, t1.points, t1.modified, t1._user_tags, '
|
||||
+'t1._users_voted, t2.first_name, t2.last_name '
|
||||
+'from tabQuestion t1, tabProfile t2 '
|
||||
+'where t1.docstatus!=2 '
|
||||
+'and t1.owner = t2.name'
|
||||
+'%(cond)s order by t1.modified desc',{user:user,cond:cond})},render_row:function(parent,data,listing){new KBQuestion(parent,data,me);}});this.list.run();}
|
||||
this.set_tag_filter=function(tag){if(in_list(keys(me.tag_filter_dict),tag.label))return;var filter_tag=new SingleTag({parent:me.tag_area,label:tag.label,dt:'Question',color:tag.color});filter_tag.remove=function(tag_remove){$(tag_remove.body).fadeOut();delete me.tag_filter_dict[tag_remove.label];if(!keys(me.tag_filter_dict).length){$(me.tag_filters).slideUp();}
|
||||
me.run();}
|
||||
me.tag_filter_dict[tag.label]=filter_tag;$ds(me.tag_filters);me.run();}
|
||||
this.run=function(){this.list.run();}
|
||||
this.make_search_bar();this.make_list();}
|
||||
KBQuestion=function(parent,det,kb){this.make=function(){this.wrapper=$a(parent,'div','kb-question-wrapper');this.q_area=$a($a(this.wrapper,'div'),'h3','kb-questions link_type',{display:'inline',textDecoration:'none'},det.question);this.q_area.onclick=function(){var q=this;window.location.href='#!question-view/'+q.id;}
|
||||
this.q_area.id=det.name;this.q_area.txt=det.question;new KBItemToolbar({parent:this.wrapper,det:det,with_tags:1,doctype:'Question'},kb)}
|
||||
this.make()}
|
||||
$import(knowledge_base.kb_common);
|
25
material_management/doctype/delivery_note/tests.py
Normal file
25
material_management/doctype/delivery_note/tests.py
Normal file
@ -0,0 +1,25 @@
|
||||
import unittest
|
||||
import webnotes
|
||||
|
||||
from webnotes.model.code import get_obj
|
||||
|
||||
class SubmissionTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.dn = webnotes.testing.create('Delivery Note')
|
||||
self.dn_items = []
|
||||
|
||||
# get a line item for testing
|
||||
for d in self.dn.doclist:
|
||||
if d.doctype=='Delivery Note Detail':
|
||||
self.dn_items.append(d)
|
||||
|
||||
self.old_bin = get_obj('Warehouse', self.line_item[0].warehouse).get_bin(self.line_item[0].item_code)
|
||||
self.dn.on_submit()
|
||||
|
||||
def test_bin_is_updated(self):
|
||||
"tests if bin quantity is affected when on submission"
|
||||
bin = get_obj('Warehouse', self.line_item.warehouse).get_bin(self.line_item[0].item_code)
|
||||
self.assertTrue(bin.actual_qty == self.old_bin.actual_qty - self.line_item[0].qty)
|
||||
|
||||
def test_sales_order_is_updated(self):
|
||||
"tests if"
|
10
material_management/tests.py
Normal file
10
material_management/tests.py
Normal file
@ -0,0 +1,10 @@
|
||||
import unittest
|
||||
|
||||
import sys
|
||||
sys.path.append('/Users/rushabh/Workbench/www/wnframework/cgi-bin/')
|
||||
sys.path.append('/Users/rushabh/Workbench/www/erpnext/')
|
||||
|
||||
from material_management.doctype.delivery_note.tests import *
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
@ -1,11 +0,0 @@
|
||||
|
||||
cur_frm.cscript.onload=function(doc,dt,dn){if(!doc.posting_date)set_multiple(dt,dn,{posting_date:get_today()});}
|
||||
cur_frm.add_fetch('employee','employee_name','employee_name');cur_frm.cscript.employee=function(doc,dt,dn){calculate_total_leaves_allocated(doc,dt,dn);}
|
||||
cur_frm.cscript.leave_type=function(doc,dt,dn){calculate_total_leaves_allocated(doc,dt,dn);}
|
||||
cur_frm.cscript.fiscal_year=function(doc,dt,dn){calculate_total_leaves_allocated(doc,dt,dn);}
|
||||
cur_frm.cscript.carry_forward=function(doc,dt,dn){calculate_total_leaves_allocated(doc,dt,dn);}
|
||||
cur_frm.cscript.carry_forwarded_leaves=function(doc,dt,dn){set_multiple(dt,dn,{total_leaves_allocated:flt(doc.carry_forwarded_leaves)+flt(doc.new_leaves_allocated)});}
|
||||
cur_frm.cscript.new_leaves_allocated=function(doc,dt,dn){set_multiple(dt,dn,{total_leaves_allocated:flt(doc.carry_forwarded_leaves)+flt(doc.new_leaves_allocated)});}
|
||||
calculate_total_leaves_allocated=function(doc,dt,dn){if(cint(doc.carry_forward)==1&&doc.leave_type&&doc.fiscal_year&&doc.employee){var callback=function(){refresh_field('carry_forward');}
|
||||
get_server_fields('get_carry_forwarded_leaves','','',doc,dt,dn,1,callback);}
|
||||
else if(cint(doc.carry_forward)==0){set_multiple(dt,dn,{carry_forwarded_leaves:0,total_leaves_allocated:flt(doc.new_leaves_allocated)});}}
|
@ -1,14 +0,0 @@
|
||||
|
||||
cur_frm.cscript.onload=function(doc,dt,dn){if(!doc.posting_date)set_multiple(dt,dn,{posting_date:get_today()});}
|
||||
cur_frm.add_fetch('employee','employee_name','employee_name');cur_frm.cscript.employee=function(doc,dt,dn){get_leave_balance(doc,dt,dn);}
|
||||
cur_frm.cscript.fiscal_year=function(doc,dt,dn){get_leave_balance(doc,dt,dn);}
|
||||
cur_frm.cscript.leave_type=function(doc,dt,dn){get_leave_balance(doc,dt,dn);}
|
||||
cur_frm.cscript.half_day=function(doc,dt,dn){if(doc.from_date){set_multiple(dt,dn,{to_date:doc.from_date});calculate_total_days(doc,dt,dn);}}
|
||||
cur_frm.cscript.from_date=function(doc,dt,dn){if(cint(doc.half_day)==1){set_multiple(dt,dn,{to_date:doc.from_date});}
|
||||
calculate_total_days(doc,dt,dn);}
|
||||
cur_frm.cscript.to_date=function(doc,dt,dn){if(cint(doc.half_day)==1&&doc.from_date&&doc.from_date!=doc.to_date){msgprint("To Date should be same as From Date for Half Day leave");return;}
|
||||
if(cint(doc.half_day)==1){set_multiple(dt,dn,{to_date:doc.from_date});}
|
||||
calculate_total_days(doc,dt,dn);}
|
||||
get_leave_balance=function(doc,dt,dn){if(doc.employee&&doc.leave_type&&doc.fiscal_year)
|
||||
get_server_fields('get_leave_balance','','',doc,dt,dn,1);}
|
||||
calculate_total_days=function(doc,dt,dn){if(doc.from_date&&doc.to_date){if(cint(doc.half_day)==1)set_multiple(dt,dn,{total_leave_days:0.5});else{get_server_fields('get_total_leave_days','','',doc,dt,dn,1);}}}
|
@ -1,16 +0,0 @@
|
||||
|
||||
cur_frm.cscript.onload=function(doc,cdt,cdn){if(!doc.senders_name){doc.senders_name=user_fullname;doc.senders_email=user;refresh_many(['senders_name','senders_email']);}
|
||||
if(doc.__islocal){doc.status='Open';doc.opening_date=get_today();refresh_many(['status','opening_date']);}
|
||||
else{if(!doc.opening_date){doc.opening_date=dateutil.str_to_user(only_date(doc.creation));refresh_field('opening_date');}}
|
||||
if(doc.status=='Open')doc.review_date=doc.closing_date='';else if(doc.status=='Pending Review')doc.closing_date='';refresh_many(['closing_date','review_date']);if(doc.project)cur_frm.cscript.project(doc,cdt,cdn);}
|
||||
cur_frm.cscript.refresh=function(doc,cdt,cdn){cur_frm.clear_custom_buttons();if(doc.status=='Pending Review'&&(doc.senders_name==user_fullname||doc.senders_email==user)){cur_frm.add_custom_button('Declare Completed',cur_frm.cscript['Declare Completed']);cur_frm.add_custom_button('Reopen Task',cur_frm.cscript['Reopen Task']);}
|
||||
if(doc.status=='Open'&&!doc.__islocal){cur_frm.add_custom_button('Cancel Task',cur_frm.cscript['Cancel Task']);if(doc.allocated_to==user)cur_frm.add_custom_button('Get Approval',cur_frm.cscript['Get Approval']);}}
|
||||
cur_frm.fields_dict['project'].get_query=function(doc,cdt,cdn){var cond='';if(doc.customer)cond='ifnull(`tabProject`.customer, "") = "'+doc.customer+'" AND';return repl('SELECT distinct `tabProject`.`name` FROM `tabProject` WHERE %(cond)s `tabProject`.`name` LIKE "%s" ORDER BY `tabProject`.`name` ASC LIMIT 50',{cond:cond});}
|
||||
cur_frm.cscript.project=function(doc,cdt,cdn){if(doc.project)get_server_fields('get_project_details','','',doc,cdt,cdn,1);}
|
||||
cur_frm.fields_dict['customer'].get_query=function(doc,cdt,cdn){var cond='';if(doc.project)cond='ifnull(`tabProject`.customer, "") = `tabCustomer`.name AND ifnull(`tabProject`.name, "") = "'+doc.project+'" AND';return repl('SELECT distinct `tabCustomer`.`name` FROM `tabCustomer`, `tabProject` WHERE %(cond)s `tabCustomer`.`name` LIKE "%s" ORDER BY `tabCustomer`.`name` ASC LIMIT 50',{cond:cond});}
|
||||
cur_frm.cscript.customer=function(doc,cdt,cdn){if(doc.customer)get_server_fields('get_customer_details','','',doc,cdt,cdn,1);else doc.customer_name='';}
|
||||
cur_frm.cscript.allocated_to=function(doc,cdt,cdn){get_server_fields('get_allocated_to_name','','',doc,cdt,cdn,1);}
|
||||
cur_frm.cscript['Get Approval']=function(){$c_obj(make_doclist(cur_frm.doc.doctype,cur_frm.doc.name),'set_for_review','',function(r,rt){if(r.message=='true'){doc.status='Pending Review';refresh_many(['review_date','status']);cur_frm.cscript.refresh(cur_frm.doc,cur_frm.doc.doctype,cur_frm.doc.name);}});}
|
||||
cur_frm.cscript['Reopen Task']=function(){$c_obj(make_doclist(cur_frm.doc.doctype,cur_frm.doc.name),'reopen_task','',function(r,rt){if(r.message=='true'){doc.status='Open';refresh_many(['status']);cur_frm.cscript.refresh(cur_frm.doc,cur_frm.doc.doctype,cur_frm.doc.name);}});}
|
||||
cur_frm.cscript['Cancel Task']=function(){$c_obj(make_doclist(cur_frm.doc.doctype,cur_frm.doc.name),'cancel_task','',function(r,rt){if(r.message=='true'){doc.status='Cancelled';refresh_many(['status']);cur_frm.cscript.refresh(cur_frm.doc,cur_frm.doc.doctype,cur_frm.doc.name);}});}
|
||||
cur_frm.cscript['Declare Completed']=function(){$c_obj(make_doclist(cur_frm.doc.doctype,cur_frm.doc.name),'declare_completed','',function(r,rt){if(r.message=='true'){doc.status='Closed';refresh_many(['review_date','closing_date','status']);cur_frm.cscript.refresh(cur_frm.doc,cur_frm.doc.doctype,cur_frm.doc.name);}});}
|
@ -1,29 +0,0 @@
|
||||
|
||||
pscript.queries_bg_dict={'Urgent':'RED','High':'ORANGE','Low':'BLUE','Closed':'GREEN','Pending Review':'YELLOW'}
|
||||
pscript.onload_Projects=function(){var d=$i('projects_div');new PageHeader(d,'Gantt Chart');new GanttChart($a(d,'div','',{margin:'16px'}));}
|
||||
GanttChart=function(parent){this.wrapper=$a(parent,'div');this.toolbar_area=$a(this.wrapper,'div','',{padding:'16px',border:'1px solid #AAF',});$bg(this.toolbar_area,'#EEF');$br(this.toolbar_area,'3px');this.toolbar_tab=make_table(this.toolbar_area,1,4,'100%',['25%','25%','25%','25%']);this.grid_area=$a(this.wrapper,'div','',{margin:'16px 0px'});this.no_task_message=$a(this.wrapper,'div','help_box',{textAign:'center',fontSize:'14px'},'Select your criteria and click on "Make" to show the Gantt Chart')
|
||||
this.get_init_data();}
|
||||
GanttChart.prototype.get_init_data=function(){var me=this;var callback=function(r,rt){me.pl=r.message.pl.sort();me.rl=r.message.rl.sort();me.make_toolbar();}
|
||||
$c_obj('Project Control','get_init_data','',callback);}
|
||||
GanttChart.prototype.make_filter=function(label,idx){var w=$a($td(this.toolbar_tab,0,idx),'div','',{marginBottom:'8px'});var l=$a(w,'div','',{fontSize:'11px'});l.innerHTML=label;return w;}
|
||||
GanttChart.prototype.make_select=function(label,options,idx){var w=this.make_filter(label,idx);var s=$a(w,'select','',{width:'100px'});add_sel_options(s,add_lists(['All'],options));return s;}
|
||||
GanttChart.prototype.make_date=function(label,idx){var w=this.make_filter(label,idx);var i=$a(w,'input');var user_fmt=locals['Control Panel']['Control Panel'].date_format;if(!this.user_fmt)this.user_fmt='dd-mm-yy';$(i).datepicker({dateFormat:user_fmt.replace('yyyy','yy'),altFormat:'yy-mm-dd',changeYear:true});return i;}
|
||||
GanttChart.prototype.make_toolbar=function(){this.r_sel=this.make_select('Resource',this.rl,0);this.p_sel=this.make_select('Project',this.pl,1);this.s_date=this.make_date('Start Date',2);this.s_date.value=date.str_to_user(date.month_start());this.e_date=this.make_date('End Date',3);this.e_date.value=date.str_to_user(date.month_end());var me=this;$btn(this.toolbar_area,'Make',function(){me.refresh();},null,'green',1);this.print_btn=$btn(this.toolbar_area,'Print',function(){me.print();},{display:'none'},null);}
|
||||
GanttChart.prototype.print=function(){$(this.grid_area).printElement();}
|
||||
GanttChart.prototype.get_data=function(){var me=this;var callback=function(r,rt){me.tasks=r.message;if(me.tasks.length){$dh(me.no_task_message);$ds(me.grid_area);me.show_tasks();$di(me.print_btn);}else{$dh(me.grid_area);$ds(me.no_task_message);$dh(me.print_btn);me.no_task_message.innerHTML='Nothing allocated for the above criteria'}}
|
||||
$c_obj('Project Control','get_tasks',[date.user_to_str(this.s_date.value),date.user_to_str(this.e_date.value),sel_val(this.p_sel),sel_val(this.r_sel)].join('~~~'),callback)}
|
||||
GanttChart.prototype.make_grid=function(){this.grid_area.innerHTML='';this.grid=new GanttGrid(this,this.s_date.value,this.e_date.value);}
|
||||
GanttChart.prototype.refresh=function(){this.get_data();}
|
||||
GanttChart.prototype.show_tasks=function(){this.make_grid();for(var i=0;i<this.tasks.length;i++){new GanttTask(this.grid,this.tasks[i],i)}}
|
||||
GanttGrid=function(chart,s_date,e_date){this.chart=chart;this.s_date=s_date;this.wrapper=$a(chart.grid_area,'div');this.start_date=date.str_to_obj(date.user_to_str(s_date));this.end_date=date.str_to_obj(date.user_to_str(e_date));this.n_days=date.get_diff(this.end_date,this.start_date)+1;this.g_width=100/this.n_days+'%';this.make();}
|
||||
GanttGrid.prototype.make_grid=function(){var ht=this.chart.tasks.length*40+'px';this.grid=$a($td(this.body,0,1),'div','',{border:'2px solid #888',height:ht,position:'relative'});this.grid_tab=make_table(this.grid,1,this.n_days,'100%',[],{width:this.g_width,borderLeft:'1px solid #DDD',height:ht});$y(this.grid_tab,{tableLayout:'fixed'});this.task_area=$a(this.grid,'div','',{position:'absolute',height:ht,width:'100%',top:'0px'});}
|
||||
GanttGrid.prototype.make_labels=function(){this.x_labels=$a($td(this.body,0,1),'div','',{marginTop:'8px'});this.x_lab_tab=make_table(this.x_labels,1,this.n_days,'100%',[],{width:this.g_width,fontSize:'10px'});$y(this.x_lab_tab,{tableLayout:'fixed'});var d=this.start_date;var today=new Date();for(var i=0;i<this.n_days;i++){if(d.getDay()==0){$td(this.x_lab_tab,0,i).innerHTML=d.getDate()+'-'+month_list[d.getMonth()];$y($td(this.grid_tab,0,i),{borderLeft:'1px solid RED'})}
|
||||
if(d.getDate()==today.getDate()&&d.getMonth()==today.getMonth()&&d.getYear()==today.getYear()){$y($td(this.grid_tab,0,i),{borderLeft:'2px solid #000'})}
|
||||
var d=date.add_days(this.start_date,1);}
|
||||
this.start_date=date.str_to_obj(date.user_to_str(this.s_date));}
|
||||
GanttGrid.prototype.make=function(){this.body=make_table(this.wrapper,1,2,'100%',['30%','70%']);this.make_grid();this.make_labels();this.y_labels=$a($td(this.body,0,0),'div','',{marginTop:'2px',position:'relative'});}
|
||||
GanttGrid.prototype.get_x=function(dt){var d=date.str_to_obj(dt);return flt(date.get_diff(d,this.start_date)+1)/flt(date.get_diff(this.end_date,this.start_date)+1)*100;}
|
||||
GanttTask=function(grid,data,idx){this.start_date=data[3];this.end_date=data[4];this.label=$a(grid.y_labels,'div','',{'top':(idx*40)+'px',overflow:'hidden',position:'absolute','width':'100%',height:'40px'});var l1=$a($a(this.label,'div'),'span','link_type');l1.innerHTML=data[0];l1.dn=data[7];l1.onclick=function(){loaddoc('Ticket',this.dn)};var l2=$a(this.label,'div','',{fontSize:'10px'});l2.innerHTML=data[1];var col=pscript.queries_bg_dict[data[5]];if(data[6]!='Open')col=pscript.queries_bg_dict[data[6]];if(!col)col='BLUE';this.body=$a(grid.task_area,'div','',{backgroundColor:col,height:'12px',position:'absolute'});this.body_info=$a(this.body,'div','',{backgroundColor:'#CCC',position:'absolute',zIndex:20});var x1=grid.get_x(this.start_date);var x2=grid.get_x(this.end_date);if(x1<=0)x1=0;else x1-=100/flt(date.get_diff(grid.end_date,grid.start_date)+1);if(x2>=100)x2=100;$y(this.body,{top:idx*40+14+'px',left:x1+'%',width:(x2-x1)+'%',zIndex:1,cursor:'pointer'})
|
||||
if(idx){var d1=$a(grid.task_area,'div','',{borderBottom:'1px solid #AAA',position:'absolute',width:'100%',top:(idx*40)+'px'});var d2=$a(grid.y_labels,'div','',{borderBottom:'1px solid #AAA',position:'absolute',width:'100%',top:(idx*40)+'px'});}
|
||||
this.make_tooltip(data);}
|
||||
GanttTask.prototype.make_tooltip=function(d){var t='<div>';if(d[0])t+='<b>Task: </b>'+d[0];if(d[5])t+='<br><b>Priority: </b>'+d[5];if(d[6])t+='<br><b>Status: </b>'+d[6];if(d[1])t+='<br><b>Allocated To: </b>'+d[1];if(d[2])t+='<br><b>Project: </b>'+d[2];if(d[3])t+='<br><b>From: </b>'+date.str_to_user(d[3]);if(d[4])t+='<br><b>To: </b>'+date.str_to_user(d[4]);t+='</div>';$(this.body).qtip({content:t,position:{corner:{tooltip:'topMiddle',target:'bottomMiddle'}},style:{border:{width:5,radius:10},padding:10,tip:true,name:'green'}})}
|
@ -1,29 +0,0 @@
|
||||
|
||||
cur_frm.cscript.onload=function(doc,cdt,cdn){}
|
||||
cur_frm.pformat.other_charges=function(doc){var make_row=function(title,val,bold){var bstart='<b>';var bend='</b>';return'<tr><td style="width:50%;">'+(bold?bstart:'')+title+(bold?bend:'')+'</td>'
|
||||
+'<td style="width:25%;text-align:right;">'+doc.currency+'</td>'
|
||||
+'<td style="width:25%;text-align:right;">'+val+'</td>'
|
||||
+'</tr>'}
|
||||
function convert_rate(val){var new_val=flt(val)/flt(doc.conversion_rate);return new_val;}
|
||||
out='';if(!doc.print_without_amount){var cl=getchildren('RV Tax Detail',doc.name,'other_charges');var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 60%"></td><td>';out+='<table class="noborder" style="width:100%">'+make_row('Net Total',fmt_money(convert_rate(doc.net_total)),1);if(cl.length){for(var i=0;i<cl.length;i++){if(fmt_money(convert_rate(cl[i].tax_amount))!=0)
|
||||
out+=make_row(cl[i].description,fmt_money(convert_rate(cl[i].tax_amount)),0);}}
|
||||
out+=make_row('Grand Total',fmt_money(doc.grand_total_export),1)+make_row('Rounded Total',fmt_money(doc.rounded_total_export),1)
|
||||
if(doc.in_words_export){out+='</table></td></tr>';out+='<tr><td colspan = "2">';out+='<table><tr><td style="width:25%;"><b>In Words</b></td>'
|
||||
out+='<td style="width:50%;">'+doc.in_words_export+'</td></tr>'}
|
||||
out+='</table></td></tr></table></div>';}
|
||||
return out;}
|
||||
cur_frm.cscript.charge_type=function(doc,cdt,cdn){var d=locals[cdt][cdn];if(d.idx==1&&(d.charge_type=='On Previous Row Amount'||d.charge_type=='On Previous Row Total')){alert("You cannot select Charge Type as 'On Previous Row Amount' or 'On Previous Row Total' for first row");d.charge_type='';}
|
||||
validated=false;refresh_field('charge_type',d.name,'other_charges');cur_frm.cscript.row_id(doc,cdt,cdn);cur_frm.cscript.rate(doc,cdt,cdn);cur_frm.cscript.tax_amount(doc,cdt,cdn);}
|
||||
cur_frm.cscript.row_id=function(doc,cdt,cdn){var d=locals[cdt][cdn];if(!d.charge_type&&d.row_id){alert("Please select Charge Type first");d.row_id='';}
|
||||
else if((d.charge_type=='Actual'||d.charge_type=='On Net Total')&&d.row_id){alert("You can Enter Row only if your Charge Type is 'On Previous Row Amount' or ' Previous Row Total'");d.row_id='';}
|
||||
else if((d.charge_type=='On Previous Row Amount'||d.charge_type=='On Previous Row Total')&&d.row_id){if(d.row_id>=d.idx){alert("You cannot Enter Row no. greater than or equal to current row no. for this Charge type");d.row_id='';}}
|
||||
validated=false;refresh_field('row_id',d.name,'other_charges');}
|
||||
cur_frm.fields_dict['other_charges'].grid.get_field("account_head").get_query=function(doc,cdt,cdn){return'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND (tabAccount.account_type = "Tax" OR tabAccount.account_type = "Chargeable") AND tabAccount.company = "'+doc.company+'" AND tabAccount.name LIKE "%s"'}
|
||||
cur_frm.cscript.account_head=function(doc,cdt,cdn){var d=locals[cdt][cdn];if(!d.charge_type&&d.account_head){alert("Please select Charge Type first");validated=false;d.account_head='';}
|
||||
else if(d.account_head&&d.charge_type){arg="{'charge_type' : '"+d.charge_type+"', 'account_head' : '"+d.account_head+"'}";get_server_fields('get_rate',arg,'other_charges',doc,cdt,cdn,1);}
|
||||
refresh_field('account_head',d.name,'other_charges');}
|
||||
cur_frm.cscript.rate=function(doc,cdt,cdn){var d=locals[cdt][cdn];if(!d.charge_type&&d.rate){alert("Please select Charge Type first");d.rate='';}
|
||||
validated=false;refresh_field('rate',d.name,'other_charges');}
|
||||
cur_frm.cscript.tax_amount=function(doc,cdt,cdn){var d=locals[cdt][cdn];if(!d.charge_type&&d.tax_amount){alert("Please select Charge Type first");d.tax_amount='';}
|
||||
else if(d.charge_type&&d.tax_amount){alert("You cannot directly enter Amount and if your Charge Type is Actual enter your amount in Rate");d.tax_amount='';}
|
||||
validated=false;refresh_field('tax_amount',d.name,'other_charges');}
|
@ -145,7 +145,7 @@ class DocType:
|
||||
pr = Document('Profile')
|
||||
pr.first_name = user_fname
|
||||
pr.last_name = user_lname
|
||||
pr.email = user_email
|
||||
pr.name = pr.email = user_email
|
||||
pr.enabled = 1
|
||||
pr.save(1)
|
||||
self.add_roles(pr)
|
||||
@ -158,9 +158,9 @@ class DocType:
|
||||
d.save(1)
|
||||
|
||||
# Add roles to Administrator profile
|
||||
pr_obj = get_obj('Profile','Administrator')
|
||||
pr = Document('Profile','Administrator')
|
||||
for r in roles_list:
|
||||
d = addchild(pr_obj.doc,'userroles', 'UserRole', 1)
|
||||
d = addchild(pr,'userroles', 'UserRole', 1)
|
||||
d.role = r
|
||||
d.save(1)
|
||||
|
||||
|
@ -1,50 +0,0 @@
|
||||
|
||||
pscript.onload_people=function(){make_customer_tab($i('crm_home'));}
|
||||
function make_customer_tab(parent){new DocColumnView('Customers',parent,['Customer Group','Customer','Contact'],{'Customer Group':{show_fields:['name'],create_fields:['name'],search_fields:['name'],next_col:'Customer'},'Customer':{show_fields:['name','customer_name'],create_fields:['name','customer_name'],search_fields:['customer_name'],filter_by:['Customer Group','customer_group'],next_col:'Contact'},'Contact':{show_fields:['name','first_name','last_name'],create_fields:['name','first_name','last_name'],search_fields:['first_name','last_name'],conditions:['is_customer=1'],filter_by:['Customer','customer']},})}
|
||||
function DocColumnView(title,parent,items,opts){this.columns={};this.items=items;this.page_head=new PageHeader(parent,title);this.make_columns(items.length,parent);for(var i=0;i<items.length;i++){var c=opts[items[i]];this.columns[items[i]]=new List2(this,$td(this.tab,0,i),items[i],c);}
|
||||
this.columns[items[0]].run();}
|
||||
DocColumnView.prototype.make_columns=function(n,parent){var cl=[];for(var i=0;i<n;i++){cl.push(cint(100/n)+'%')}
|
||||
this.tab=make_table(parent,1,n,'100%',cl)
|
||||
this.tab.className='dcv-tab';}
|
||||
DocColumnView.prototype.refresh=function(){this.columns[this.items[0]].run();}
|
||||
function List2(dcv,parent,doctype,opts){this.dcv=dcv;this.doctype=doctype;this.opts=opts;this.dtl=get_doctype_label(doctype);this.make_body(parent);this.selected_item=null;}
|
||||
List2.prototype.make_body=function(parent){this.make_toolbar(parent);this.make_search(parent);this.make_message(parent);this.make_list(parent);this.clear();}
|
||||
List2.prototype.make_toolbar=function(parent){var me=this;this.head=$a(parent,'div','list2-head');$gr(this.head,'#EEE','#CCC');var t=make_table(this.head,1,2,'100%',['60%','40%'],{verticalAlign:'middle'});var span=$a($td(t,0,0),'span','',{cssFloat:'left'},this.dtl);var refresh_icon=$a($td(t,0,0),'div','wn-icon ic-playback_reload',{marginLeft:'7px',cssFloat:'left'});refresh_icon.onclick=function(){me.run();}
|
||||
this.btn=$btn($td(t,0,1),'+ New',function(){me.make_new();},{fontWeight:'bold',cssFloat:'right'},'green');}
|
||||
List2.prototype.make_search=function(parent){var me=this;this.searchbar=$a(parent,'div','list2-search');this.search_inp=$a_input(this.searchbar,'text');this.search_btn=$a(this.searchbar,'img','',{cursor:'pointer',marginLeft:'8px',marginBottom:'-3px'});this.search_btn.src='images/icons/magnifier.png';this.search_btn.onclick=function(){me.run();}}
|
||||
List2.prototype.make_message=function(parent){this.clear_message=$a(parent,'div','help_box',{margin:'4px',display:'none'},(this.opts.filter_by?('Select '+get_doctype_label(this.opts.filter_by[0])+' to see list'):''));this.no_result_message=$a(parent,'div','help_box',{margin:'4px',display:'none'},'No '+this.dtl+' created yet!');}
|
||||
List2.prototype.make_new=function(){var me=this;newdoc(this.doctype,function(dn){if(me.opts.filter_by){var val=me.dcv.columns[me.opts.filter_by[0]].get_selected();if(val)
|
||||
locals[me.doctype][dn][me.opts.filter_by[1]]=val;}});}
|
||||
List2.prototype.clear=function(){$dh(this.lst_area);$ds(this.clear_message)
|
||||
$dh(this.no_result_message);this.clear_next();}
|
||||
List2.prototype.show_list=function(){$ds(this.lst_area);$dh(this.clear_message)
|
||||
$dh(this.no_result_message);}
|
||||
List2.prototype.show_no_result=function(){if(!this.search_inp.value){$dh(this.lst_area);$dh(this.clear_message);$ds(this.no_result_message);}}
|
||||
List2.prototype.clear_next=function(){if(this.opts.next_col&&this.dcv.columns[this.opts.next_col])this.dcv.columns[this.opts.next_col].clear();}
|
||||
List2.prototype.make_list=function(parent){var me=this;this.lst_area=$a(parent,'div','list2-list-area');this.lst=new Listing('Profiles',1);this.lst.opts.hide_refresh=1;this.lst.opts.cell_style={padding:'0px'};this.lst.colwidths=['100%'];this.lst.get_query=function(){var q=me.build_query();this.query=q[0];this.query_max=q[1];}
|
||||
this.lst.make(this.lst_area);this.lst.show_cell=function(cell,ri,ci,d){new List2Item(cell,d[ri],me);}
|
||||
this.lst.onrun=function(){me.show_list();me.clear_next();if(!me.lst.has_data())me.show_no_result();}}
|
||||
List2.prototype.run=function(){$dh(this.lst.results);this.lst.run();}
|
||||
List2.prototype.build_query=function(){var args={fields:this.opts.show_fields.join(', '),doctype:this.doctype,cond:''}
|
||||
var cl=this.build_search_conditions();cl=this.add_filter_condition(cl);if(cl.length)args.cond=' AND '+cl.join(' AND ');var query=repl('SELECT %(fields)s FROM `tab%(doctype)s` WHERE docstatus < 2 %(cond)s',args)
|
||||
var query_max=repl('SELECT COUNT(*) FROM `tab%(doctype)s` WHERE docstatus < 2 %(cond)s',args)
|
||||
return[query,query_max]}
|
||||
List2.prototype.build_search_conditions=function(){var cl=new Array();if(this.opts.conditions){for(var i=0;i<this.opts.conditions.length;i++)cl.push(this.opts.conditions);}
|
||||
if(this.search_inp.value&&this.search_inp.value!='Search'){for(var i=0;i<this.opts.search_fields.length;i++){cl.push(repl('`%(field)s` LIKE "%(txt)s"',{field:this.opts.search_fields[i],txt:'%'+this.search_inp.value+'%'}));}}
|
||||
return cl;}
|
||||
List2.prototype.add_filter_condition=function(cl){if(this.opts.filter_by){cl.push(repl('`%(filter)s` = "%(val)s"',{filter:this.opts.filter_by[1],val:this.dcv.columns[this.opts.filter_by[0]].get_selected()}));}
|
||||
return cl;}
|
||||
List2.prototype.get_selected=function(){if(this.selected_item)return this.selected_item.det[0];else return'';}
|
||||
List2Item=function(cell,det,list2){this.det=det;this.list2=list2;this.make_body(cell);this.show_text();this.show_more_info();}
|
||||
List2Item.prototype.make_body=function(cell){var me=this;this.body=$a(cell,'div','list2-item-div')
|
||||
if(me.list2.opts.next_col){this.make_with_icon();}else{this.content=this.body;}
|
||||
this.body.onclick=function(){me.select();if(me.list2.opts.next_col)me.list2.dcv.columns[me.list2.opts.next_col].run();}}
|
||||
List2Item.prototype.make_with_icon=function(){var t=make_table(this.body,1,2,'100%',['','18px'])
|
||||
$y($td(t,0,1),{verticalAlign:'middle'})
|
||||
var img=$a($td(t,0,1),'img');img.src='images/icons/control_play.png';this.content=$td(t,0,0);}
|
||||
List2Item.prototype.show_text=function(){var me=this;this.label=$a(this.content,'div','list2-item-title','',this.det[0]);var span=$a(this.label,'span','link_type list2-edit-link','','[Edit]');span.onclick=function(){loaddoc(me.list2.doctype,me.det[0]);}}
|
||||
List2Item.prototype.show_more_info=function(){var det=this.det;if(det.length>1){var l=[];for(var i=1;i<det.length;i++){if(det[i]&&det[i]!=det[0])l.push(det[i]);}
|
||||
if(l.length)
|
||||
this.more_info=$a(this.content,'div','list2-item-more-info','',l.join(', '))}}
|
||||
List2Item.prototype.select=function(){if(this.list2.selected_item)this.list2.selected_item.deselect();this.body.className='list2-item-div list2-item-selected';this.list2.selected_item=this;}
|
||||
List2Item.prototype.deselect=function(){this.body.className='list2-item-div';}
|
@ -1,75 +0,0 @@
|
||||
|
||||
pscript['onload_Permission Engine']=function(){var h=new PageHeader('pe_header','Permissions Manager','Set specific permissions for Roles')
|
||||
if(!pscript.perm_engine)pscript.perm_engine=new pscript.PermEngine();}
|
||||
pscript.PermEngine=function(){this.wrapper=$i('perm_engine_div');this.head=$a(this.wrapper,'div');this.body=$a(this.wrapper,'div');this.footer=$a(this.wrapper,'div');var lab=$a(this.body,'div','',{backgroundColor:'#FFD',padding:'8px',margin:'16px 0px'});lab.innerHTML='Please select the item for which you want to set permissions';this.make_head();this.load_options();}
|
||||
pscript.PermEngine.prototype.make_head=function(){var me=this;var make_select=function(label){var w=$a(me.head,'div','',{margin:'8px 0px'});var t=make_table(w,1,2,'300px',['50%','50%']);$td(t,0,0).innerHTML=label;var s=$a($td(t,0,1),'select','',{width:'140px'});s.wrapper=w;return s;}
|
||||
var make_button=function(label,parent,green){return $btn(parent,label,null,{margin:'8px 0px',display:'none'},(green?'green':null));}
|
||||
this.type_select=make_select('Set Permissions For');this.type_select.onchange=function(){me.get_permissions();}
|
||||
this.add_button=make_button('+ Add A New Rule',this.head,0);this.add_button.onclick=function(){me.add_permission();}
|
||||
this.update_button=make_button('Update',this.footer,1);this.update_button.onclick=function(){me.update_permissions();}}
|
||||
pscript.PermEngine.prototype.add_permission=function(){var me=this;if(!this.add_permission_dialog){var d=new Dialog(400,400,'Add Permission');d.make_body([['Select','Role'],['Select','Level'],['Button','Add']])
|
||||
add_sel_options(d.widgets['Role'],this.roles,'');add_sel_options(d.widgets['Level'],[0,1,2,3,4,5,6,7,8,9],0);d.widgets['Add'].onclick=function(){if(!sel_val(d.widgets['Role'])){msgprint('Please select Role');return;}
|
||||
var callback=function(r,rt){me.get_permissions();d.hide();}
|
||||
$c_obj('Permission Control','add_permission',JSON.stringify([sel_val(me.type_select),sel_val(d.widgets['Role']),sel_val(d.widgets['Level'])]),callback);}
|
||||
this.add_permission_dialog=d;}
|
||||
this.add_permission_dialog.show();}
|
||||
pscript.PermEngine.prototype.hide_fields=function(){$dh(this.role_select.wrapper);this.type_select.disabled=false;this.body.innerHTML='';}
|
||||
pscript.PermEngine.prototype.load_options=function(){var me=this;$dh(me.update_button);$dh(me.add_button);$c_obj('Permission Control','get_doctype_list','',function(r,rt){me.roles=r.message.roles;empty_select(me.type_select);add_sel_options(me.type_select,add_lists([''],r.message.doctypes));});}
|
||||
pscript.PermEngine.prototype.get_permissions=function(){var me=this;if(!sel_val(me.type_select)){msgprint('Please select a type first!');return;}
|
||||
$c_obj('Permission Control','get_permissions',sel_val(me.type_select),function(r,rt){if(r.message.perms.length)me.get_results(r.message);else me.body.innerHTML='<div style = "color : red; margin:8px 0px;">No Records Found</div>'});}
|
||||
pscript.PermEngine.prototype.get_results=function(r){var perms=r.perms;var me=this;var doctype=sel_val(me.type_select);$ds(me.update_button);$ds(me.add_button);this.body.innerHTML=''
|
||||
pscript.all_checkboxes=[];pscript.all_matches=[];var head=$a(this.body,'h3');head.innerHTML='Rules for '+doctype;var permt=make_table(me.body,perms.length+1,9,'80%',[],{border:'1px solid #AAA',padding:'3px',verticalAlign:'middle',height:'30px'});var col_labels=['Role','Level','Read','Write','Create','Submit','Cancel','Amend','Restrict By']
|
||||
for(var n=0;n<col_labels.length;n++){$y($td(permt,0,n),{backgroundColor:'#DDD',width:(n==0?'30%':(n==8?'21%':'7%'))})
|
||||
$td(permt,0,n).innerHTML=col_labels[n];$td(permt,0,n).fieldname=col_labels[n].toLowerCase();}
|
||||
for(var j=0;j<perms.length;j++){var plevel=$a($td(permt,j+1,1),'span','link_type');plevel.innerHTML=perms[j].permlevel;plevel.doctype=doctype;plevel.value=perms[j].permlevel;plevel.onclick=function(){me.get_fields(this.doctype,this.value)}
|
||||
$td(permt,j+1,0).innerHTML=perms[j].role;}
|
||||
for(var l=0;l<perms.length;l++){for(var m=0;m<6;m++){var chk=$a_input($td(permt,l+1,m+2),'checkbox');var val=perms[l][$td(permt,0,m+2).fieldname];if(val==1)chk.checked=1;else chk.checked=0;chk.doctype=doctype;chk.permlevel=perms[l].permlevel;chk.perm_type=col_labels[m+2].toLowerCase();chk.role=perms[l].role;pscript.all_checkboxes.push(chk);}}
|
||||
me.add_match_select(r,perms,permt,doctype);}
|
||||
pscript.PermEngine.prototype.add_match_select=function(r,perms,permt,doctype){var me=this;for(var i=0;i<perms.length;i++){if(perms[i].permlevel==0){var sel=$a($td(permt,i+1,8),'select','',{width:'100%'});add_sel_options(sel,r.fields);sel.details=perms[i];sel.details.parent=doctype;sel.onchange=function(){if(sel_val(this)&&sel_val(this)!='owner')$ds(this.div);else $dh(this.div);}
|
||||
var div=$a($td(permt,i+1,8),'div','link_type',{marginTop:'2px',fontSize:'10px',display:'none'});div.onclick=function(){this.details.match=sel_val(this.sel);me.show_match_dialog(this.details);}
|
||||
div.innerHTML='Set Users / Roles';div.details=perms[i];sel.div=div;div.sel=sel;if(perms[i].match){sel.value=perms[i].match;$ds(div);}
|
||||
pscript.all_matches.push(sel);}}}
|
||||
pscript.PermEngine.prototype.show_match_dialog=function(details){if(!this.match_defaults_dialog){var d=new Dialog(750,500,'Permission Applies To');d.make_body([['HTML','Body']]);var w=d.widgets['Body'];$y(w,{height:'350px',overflow:'auto'});this.match_defaults_dialog=d;}
|
||||
this.match_defaults_dialog.show();var me=this;var callback=function(r,rt){me.render_match_dialog(r,details);}
|
||||
$c_obj('Permission Control','get_defaults',details.match+'~~~'+(this.profiles?'No':'Yes'),callback);}
|
||||
pscript.PermEngine.prototype.render_match_dialog=function(r,details){var d=this.match_defaults_dialog;var w=d.widgets['Body'];w.innerHTML='<div style="background-color:#FFD; padding: 4px; color: #440; margin-bottom:16px">Please Note: Any action will also affect other permissions with similar rules!</div>'
|
||||
var t=make_table($a(w,'div','',{borderBottom:'1px solid #AAA'}),1,3,'90%',['40%','40%','20%'],{fontWeight:'bold',padding:'3px',fontSize:'14px'});$td(t,0,0).innerHTML='Who?';$td(t,0,1).innerHTML='Is allowed if '+details.match+' equals';var dl=r.message.dl;this.options=r.message.ol;if(!this.profiles){this.profiles=r.message.pl;}
|
||||
for(var i=0;i<dl.length;i++){new MatchDefaultValue(this,w,dl[i],details.match);}
|
||||
this.add_new_match_row(details.match);}
|
||||
pscript.PermEngine.prototype.add_new_match_row=function(fieldname){new MatchDefaultValue(this,this.match_defaults_dialog.widgets['Body'],null,fieldname,1);}
|
||||
MatchDefaultValue=function(pe,parent,details,fieldname,editable){this.pe=pe;this.wrapper=$a(parent,'div','',{margin:'4px'});this.clear();this.details=details;this.fieldname=fieldname;this.render(editable);}
|
||||
MatchDefaultValue.prototype.clear=function(){this.wrapper.innerHTML='';this.tab=make_table(this.wrapper,1,3,'90%',['40%','40%','20%'],{verticalAlign:'middle',padding:'3px'});}
|
||||
MatchDefaultValue.prototype.render=function(editable){if(editable){this.render_editable();}else{this.render_static();}}
|
||||
MatchDefaultValue.prototype.render_editable=function(){var me=this;this.profile_or_role=$a($td(this.tab,0,0),'select','',{width:'60px',marginRight:'8px'});add_sel_options(this.profile_or_role,['Profile','Role'],'Profile');this.profile_or_role.onchange=function(){if(sel_val(this)=='Profile'){$di(me.profile_sel);$dh(me.role_sel);}
|
||||
else{$dh(me.profile_sel);$di(me.role_sel);}}
|
||||
this.role_sel=$a($td(this.tab,0,0),'select','',{width:'100px',display:'none'});add_sel_options(this.role_sel,this.pe.roles);this.profile_sel=$a($td(this.tab,0,0),'select','',{width:'100px'});add_sel_options(this.profile_sel,this.pe.profiles);this.options_sel=$a($td(this.tab,0,1),'select','',{width:'120px'});add_sel_options(this.options_sel,this.pe.options);var span=$a($td(this.tab,0,2),'span','link_type',{marginLeft:'8px'});span.innerHTML='Add'
|
||||
span.onclick=function(){me.save();}}
|
||||
MatchDefaultValue.prototype.render_static=function(){var me=this;$td(this.tab,0,0).innerHTML=this.details.parenttype;$td(this.tab,0,0).innerHTML+=' '+this.details.parent;$td(this.tab,0,1).innerHTML=this.details.defvalue;var span=$a($td(this.tab,0,2),'span','link_type',{marginLeft:'8px'});span.innerHTML='Cancel'
|
||||
span.onclick=function(){me.delete_def();}}
|
||||
MatchDefaultValue.prototype.delete_def=function(){var me=this;this.wrapper.innerHTML='<div style="color: #888; padding: 3px;">Deleting...</div>';var callback=function(r,rt){$dh(me.wrapper);if(r.exc)msgprint('There were errors!')}
|
||||
$c_obj('Permission Control','delete_default',[this.details.parent,this.fieldname,this.details.defvalue].join('~~~'),callback)}
|
||||
MatchDefaultValue.prototype.save=function(){var me=this;var callback=function(r,rt){me.details=r.message;me.clear();me.render();me.pe.add_new_match_row(me.fieldname);}
|
||||
if(sel_val(this.profile_or_role)=='Profile'){var parent=sel_val(this.profile_sel);var parenttype='Profile';}
|
||||
else{var parent=sel_val(this.role_sel);var parenttype='Role';}
|
||||
if(!sel_val(this.options_sel)||!parent){msgprint("Please select all values");return;}
|
||||
$c_obj('Permission Control','add_default',[parent,parenttype,this.fieldname,sel_val(this.options_sel)].join('~~~'),callback);this.wrapper.innerHTML='<div style="color: #888; padding: 3px;">Adding...</div>';}
|
||||
pscript.PermEngine.prototype.make_fields_dialog=function(){if(!pscript.get_field_dialog){pscript.get_field_dialog=new Dialog(750,500,'Fields');pscript.get_field_dialog.make_body([['HTML','Fields','<div id="perm_engine_get_fields"></div>'],['Button','OK']]);}
|
||||
else $i('perm_engine_get_fields').innerHTML='';}
|
||||
pscript.PermEngine.prototype.get_fields=function(dt,permlevel){var me=this;var callback=function(r,rt){var parent_fields_dict=r.message.parent_fields_dict;var table_fields_dict=r.message.table_fields_dict;me.make_fields_dialog();me.make_fields_table(dt,parent_fields_dict,table_fields_dict,permlevel);pscript.get_field_dialog.show();pscript.get_field_dialog.widgets['OK'].onclick=function(){pscript.get_field_dialog.hide();}}
|
||||
var args="{'dt':'"+dt+"','permlevel':"+permlevel+"}"
|
||||
$c_obj('Permission Control','get_fields',args,callback);}
|
||||
pscript.PermEngine.prototype.make_fields_table=function(dt,parent_fields_dict,table_fields_dict,permlevel){var make_grid=function(table,fields_dict){var col_labels=['Label','Fieldtype','Fieldname','Options'];for(var n=0;n<col_labels.length;n++){$a_input(($td(table,0,n)),'data');$td(table,0,n).innerHTML='<b>'+col_labels[n]+'</b>';$td(table,0,n).fieldname=col_labels[n].toLowerCase();}
|
||||
for(var i=0;i<keys(fields_dict).length;i++){for(var j=0;j<4;j++){$a_input(($td(table,i+1,j)),'data');$td(table,i+1,j).innerHTML=cstr(fields_dict[i][$td(table,0,j).fieldname])}}}
|
||||
$i('perm_engine_get_fields').innerHTML='<b>'+dt+' Fields at Level '+permlevel+':</b><br><br>';var parent_field_table=make_table('perm_engine_get_fields',keys(parent_fields_dict).length+1,4,'100%',['25%','25%','25%','25%'],{border:'1px solid #AAA',padding:'2px'});make_grid(parent_field_table,parent_fields_dict);child_tables=keys(table_fields_dict)
|
||||
if(child_tables.length>0){for(var k=0;k<child_tables.length;k++){var tab_fields_det=table_fields_dict[child_tables[k]];if(keys(tab_fields_det).length>0){$i('perm_engine_get_fields').innerHTML+='<br><b>'+child_tables[k]+' Fields at Level '+permlevel+':</b><br><br>'
|
||||
var child_field_table=make_table('perm_engine_get_fields',keys(tab_fields_det).length+1,4,'100%',['25%','25%','25%','25%'],{border:'1px solid #AAA',padding:'2px'});make_grid(child_field_table,tab_fields_det);}}}}
|
||||
pscript.PermEngine.prototype.update_permissions=function(){var me=this;var out={};var add_to_out=function(doctype,permlevel,role,key,value){if(!out[doctype])out[doctype]={};if(!out[doctype][permlevel])out[doctype][permlevel]={};if(!out[doctype][permlevel][role])out[doctype][permlevel][role]={};out[doctype][permlevel][role][key]=value;}
|
||||
for(i in pscript.all_checkboxes){c=pscript.all_checkboxes[i];add_to_out(c.doctype,c.permlevel,c.role,c.perm_type,c.checked?1:0);}
|
||||
for(var i=0;i<pscript.all_matches.length;i++){var s=pscript.all_matches[i];if(sel_val(s))
|
||||
add_to_out(s.details.parent,s.details.permlevel,s.details.role,'match',sel_val(s));}
|
||||
var args="{'perm_dict': "+JSON.stringify(out)+"}"
|
||||
$c_obj('Permission Control','update_permissions',args,function(r,rt){});}
|
||||
pscript.PermEngine.prototype.update_page_roles=function(){var me=this;var out={};for(i in pscript.all_pg_checkboxes){c=pscript.all_pg_checkboxes[i];out[c.page_name]=c.checked?1:0}
|
||||
var args="{'page_role_dict': "+JSON.stringify(out)+", 'role': '"+sel_val(me.role_select)+"'}"
|
||||
$c_obj('Permission Control','update_page_role',args,function(r,rt){});}
|
||||
pscript.PermEngine.prototype.reset_perm_engine=function(){this.type_select.selectedIndex=0;this.load_options();}
|
@ -1,32 +0,0 @@
|
||||
|
||||
pscript.onload_Setup=function(){var parent=$i('setup_div');add_space_holder(parent);var callback=function(r,rt){parent.page_head=new PageHeader(parent,'Setup');var setup_data=new SetupData(r.message);pscript.setup_make_sections(setup_data);remove_space_holder();}
|
||||
$c_obj('Setup Wizard Control','get_country','',callback);}
|
||||
pscript.setup_set_height=function(){var parent=$i('setup_div');$y(parent.tray.body,{height:get_window_height()-parent.page_head.wrapper.offsetHeight+'px',overflow:'auto'})}
|
||||
pscript.setup_make_sections=function(setup_data){var parent=$i('setup_div');parent.tray=new TrayPage(parent)
|
||||
var lst=[setup_data.system,setup_data.general,setup_data.accounts,setup_data.selling,setup_data.buying,setup_data.stock,setup_data.hr,setup_data.maintenance,setup_data.production];for(var s=0;s<lst.length;s++){var lbl=keys(lst[s])[0];var ti=parent.tray.add_item(lbl,null,null,1)
|
||||
new SetupItem(ti.body,lbl,lst[s][lbl]);if(s==0)ti.expand();}
|
||||
setTimeout(pscript.setup_set_height,100);resize_observers.push(pscript.setup_set_height);}
|
||||
SetupItem=function(parent,lbl,link_list){this.icons={'System':'back_img Setup','General':'back_img Home','Accounts':'back_img Accounts','Selling':'back_img Selling','Stock':'back_img Stock','Buying':'back_img Buying','Maintenance':'back_img Maintenance','Production':'back_img Production','HR':'back_img HR'};this.make_item_body(parent,lbl,link_list);}
|
||||
SetupItem.prototype.make_item_body=function(parent,lbl,link_list){this.link_area=parent;this.render_item_body(lbl,link_list);}
|
||||
SetupItem.prototype.render_item_body=function(lbl,link_list){var me=this;link_list.sort(function(a,b){return a[0]>b[0];});for(var i=0;i<link_list.length;i++){var wrapper=$a(this.link_area,'div','',{marginBottom:'4px',padding:'2px'});$(wrapper).hover(function(){$y(this,{backgroundColor:'#EEF'})},function(){$y(this,{backgroundColor:''})})
|
||||
var tab=make_table($a(wrapper,'div'),1,2,'100%',[200/7+'%',500/7+'%'])
|
||||
var dt=$a($td(tab,0,0),'span','link_type');dt.innerHTML=link_list[i][0];dt.label=link_list[i][0];dt.arg=link_list[i][1];dt.nm=link_list[i][2];if(dt.arg==1)dt.cn=link_list[i][3];else if(dt.arg==2)dt.cb=link_list[i][3];dt.onclick=function(){me.link_action(this)}
|
||||
$y($td(tab,0,1),{color:'#777'});$td(tab,0,1).innerHTML=link_list[i][4];}}
|
||||
SetupItem.prototype.link_action=function(obj){var me=this;var obj=obj;if(obj.arg==1){if(in_list(profile.can_read,obj.nm)){if(obj.cn!='')
|
||||
loaddocbrowser(obj.nm,obj.nm,obj.cn);else
|
||||
loaddocbrowser(obj.nm);}
|
||||
else
|
||||
msgprint('No read permission',1);}
|
||||
else if(obj.arg==2){me.show_page(obj);}
|
||||
else if(obj.arg==3){newdoc(obj.nm);}}
|
||||
SetupItem.prototype.show_page=function(obj){var me=obj;var callback=function(r,rt)
|
||||
{if(r.message){if(me.cb=='')
|
||||
loadpage(me.nm);else
|
||||
show_chart_browser(me.nm,me.cb);}
|
||||
else
|
||||
msgprint('No read permission',1);}
|
||||
$c_obj('Setup Wizard Control','get_page_lst',me.nm,callback);}
|
||||
SetupData=function(cnty){this.system={'System':[['Global Defaults',3,'Manage Account','','Set global default values'],['Manage Series',3,'Naming Series','','Manage numbering series for transactions'],['Custom Field',1,'Custom Field','dt'+NEWLINE+'label'+NEWLINE+'fieldtype'+NEWLINE+'options','Add and manage custom fields on forms'],['Email Settings',3,'Email Settings','','Outgoing email server and address'],['Notification Settings',3,'Notification Control','','Automatic emails set at selected events'],['Company',1,'Company','id'+NEWLINE+'is_active'+NEWLINE+'email','Manage list of companies'],['Fiscal Year',1,'Fiscal Year','id'+NEWLINE+'company'+NEWLINE+'is_active'+NEWLINE+'year','Manage list of fiscal years'],['Personalize',3,'Personalize','','Set your banner'],['Manage Trash',2,'Trash','','Restore trashed items'],['Import Data',2,'Import Data','','Import data from CSV files'],['Manage Users',2,'My Company','','Add / remove users and manage their roles'],['Web Forms',2,'Webforms','','Code to embed forms in yor website'],['Permissions Manager',2,'Permission Engine','','Manage all permissions from one tool (beta)'],['Property Setter',1,'Property Setter','','Customize properties of a Form (DocType) or Field'],['Letter Head',1,'Letter Head','','Manage different letter heads for Prints'],['SMS Settings',3,'SMS Settings','','Integrate your personalized SMS gateway which support http web service'],['SMS Center',3,'SMS Center','','Send mass sms to your leads, contacts and partners']]};this.general={'General':[['Authorization Rule',1,'Authorization Rule','','Set rules based on amounts'],['Print Heading',1,'Print Heading','','Manage headings for printing transactions'],['Term',1,'Term','','Manage template of standard Terms for order / invoices etc'],['Currency',1,'Currency','','Manage list of currencies'],['Country',1,'Country','','Country master'],['State',1,'State','','State master'],['Activty Type',1,'Activity Type','','Types of activities that you can select in your Timesheet'],['City',1,'City','','City master']]};this.selling={'Selling':[['Customer Group',2,'Sales Browser','Customer Group','Manage customer categories'],['Territory',2,'Sales Browser','Territory','Manage sales territories'],['Customer',1,'Customer','customer_group'+NEWLINE+'country','Customer master'],['Sales Person',2,'Sales Browser','Sales Person','Manage sales persons'],['Sales Partner',1,'Sales Partner','','Manage sales partners'],['Campaign',1,'Campaign','id'+NEWLINE+'campaign_name'+NEWLINE+'description','Manage sales / marketing campaigns'],['Sales BOM',1,'Sales BOM','id'+NEWLINE+'is_active'+NEWLINE+'new_item_name'+NEWLINE+'description'+NEWLINE+'item_group','Manage Sales Bill of Material (Main item + accessories)'],['Price List',1,'Price List','','Price list master']]};this.accounts={'Accounts':[['Chart of Accounts',2,'Accounts Browser','Account','Manage chart of accounts'],['Chart of Cost Centers',2,'Accounts Browser','Cost Center','Manage chart of cost centers'],['POS Setting',1,'POS Setting','','Manage Point of Sales default Settings.']]};if(cnty=='India'){var lst1=[['TDS Rate Chart',1,'TDS Rate Chart','','TDS rate master'],['TDS Category',1,'TDS Category','id'+NEWLINE+'module','TDS categories']];for(var i=0;i<lst1.length;i++)
|
||||
this.accounts['Accounts'].push(lst1[i]);}
|
||||
var lst=[['Monthly Distribution',1,'Budget Distribution','id'+NEWLINE+'fiscal_year'+NEWLINE+'distribution_id','Manage budget distributions (seasonalities)'],['Sales Other Charges',1,'Other Charges','','Manage your charge structures (taxes + charges) for sales'],['Purchase Other Charges',1,'Purchase Other Charges','','Manage your charge structures (taxes + charges) for purchase'],['Mode of Payment',1,'Mode of Payment','','Mode of payment master']];for(var i=0;i<lst.length;i++)
|
||||
this.accounts['Accounts'].push(lst[i]);this.stock={'Stock':[['Item Group',2,'Sales Browser','Item Group','Manage item classifications'],['Item',1,'Item','name'+NEWLINE+'item_group'+NEWLINE+'description','Item master'],['Brand',1,'Brand','id'+NEWLINE+'description','Brand master'],['Batch',1,'Batch','name'+NEWLINE+'start_date'+NEWLINE+'item'+NEWLINE+'expiry_date','Manage batches'],['Price List',1,'Price List','','Price list master'],['UOM',1,'UOM','','Unit of measure (UOM) master'],['Warehouse Type',1,'Warehouse Type','','Warehouse classifications'],['Warehouse',1,'Warehouse','','Warehouse master']]};this.buying={'Buying':[['Supplier Type',1,'Supplier Type','','Manage supplier classifications'],['Supplier',1,'Supplier','id'+NEWLINE+'supplier_type'+NEWLINE+'supplier_status'+NEWLINE+'company','Supplier master']]};this.maintenance={'Maintenance':[['Serial No',1,'Serial No','item_code'+NEWLINE+'status'+NEWLINE+'pr_no'+NEWLINE+'delivery_note_no'+NEWLINE+'customer_name','Manage unique serial numbers for items'],['Purpose of Service',1,'Purpose of Service','','Purpose of service master']]};this.production={'Production':[['Bill of Materials',1,'Bill Of Materials','id'+NEWLINE+'item'+NEWLINE+'description'+NEWLINE+'operating_cost'+NEWLINE+'maintained_by','Muti-level bill of materials and operations'],['Workstation',1,'Workstation','id'+NEWLINE+'workstation_name'+NEWLINE+'warehouse'+NEWLINE+'description','Workstation master']]};this.hr={'HR':[['Department',1,'Department','','Company department master'],['Designation',1,'Designation','','Company designation master'],['Branch',1,'Branch','','Manage branches for your company'],['Grade',1,'Grade','','Manage employee grades'],['Employment Type',1,'Employment Type','','Manage types of employment'],['Employee',1,'Employee','employee_name'+NEWLINE+'employment_type'+NEWLINE+'status'+NEWLINE+'branch'+NEWLINE+'designation'+NEWLINE+'department'+NEWLINE+'grade'+NEWLINE+'reports_to','Employee master'],['Earning Type',1,'Earning Type','taxable'+NEWLINE+'exemption_limit','Types of salary earning master'],['Deduction Type',1,'Deduction Type','','Types of salary deduction master'],['Expense Type',1,'Expense Type','','Types of expense master'],['Salary Structure',1,'Salary Structure','employee'+NEWLINE+'is_active'+NEWLINE+'fiscal_year'+NEWLINE+'from_date'+NEWLINE+'ctc'+NEWLINE+'total_earning'+NEWLINE+'total_deduction'+NEWLINE+'total','Salary structure template'],['Holiday List',1,'Holiday List','fiscal_year','List of holidays'],['Leave Type',1,'Leave Type','max_days_allowed'+NEWLINE+'is_carry_forward'+NEWLINE+'is_encash','Leave type master'],['KRA Template',1,'KRA Template','','Template of Key Result Areas (KRAs)']]};}
|
@ -1,2 +0,0 @@
|
||||
|
||||
cur_frm.cscript.onload=function(doc,cdt,cdn){if(doc.customer)cur_frm.add_fetch('customer','customer_name','customer_name');if(doc.supplier)cur_frm.add_fetch('supplier','supplier_name','supplier_name');}
|
Loading…
x
Reference in New Issue
Block a user