mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-06 05:39:12 +00:00
Sourced wnframework-modules from Google Code as erpnext
This commit is contained in:
0
accounts/page/__init__.py
Normal file
0
accounts/page/__init__.py
Normal file
0
accounts/page/accounts_browser/__init__.py
Normal file
0
accounts/page/accounts_browser/__init__.py
Normal file
44
accounts/page/accounts_browser/accounts_browser.comp.js
Normal file
44
accounts/page/accounts_browser/accounts_browser.comp.js
Normal file
@@ -0,0 +1,44 @@
|
||||
|
||||
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;}
|
||||
9
accounts/page/accounts_browser/accounts_browser.css
Normal file
9
accounts/page/accounts_browser/accounts_browser.css
Normal file
@@ -0,0 +1,9 @@
|
||||
h1 { padding: 8px 0px; margin: 0px; }
|
||||
#ledger_area { padding: 16px;}
|
||||
.ac_head { display: none; }
|
||||
.ac_head div { padding: 2px; }
|
||||
.ac_ledger { display: none; padding: 8px; margin-top: 8px; border-top: 1px solid #DDD; }
|
||||
.ac_balance { margin-left: 4px; font-size: 16px; font-weight: bold; background-color: #FFFAB0; }
|
||||
|
||||
.ac_page_sel_tab { width:90%; background-color: #EEE; margin-bottom: 8px }
|
||||
.ac_page_sel_tab td { vertical-align: middle; padding: 3px; }
|
||||
4
accounts/page/accounts_browser/accounts_browser.html
Normal file
4
accounts/page/accounts_browser/accounts_browser.html
Normal file
@@ -0,0 +1,4 @@
|
||||
<div class="layout_wrapper">
|
||||
<div id="ab_header"></div>
|
||||
<div id="ab_body" style="margin: 16px"></div>
|
||||
</div>
|
||||
403
accounts/page/accounts_browser/accounts_browser.js
Normal file
403
accounts/page/accounts_browser/accounts_browser.js
Normal file
@@ -0,0 +1,403 @@
|
||||
pscript['onload_Accounts Browser'] = function(){
|
||||
// if the user directly loads the page, ask to select the chart
|
||||
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 ='';
|
||||
|
||||
//===============comment area========================================
|
||||
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'});
|
||||
|
||||
//================== table body======================================
|
||||
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');
|
||||
|
||||
//=====================footer area ==================================
|
||||
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."
|
||||
}
|
||||
|
||||
// header and toolbar
|
||||
// ------------------
|
||||
|
||||
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);
|
||||
|
||||
// select company
|
||||
// --------------
|
||||
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'});
|
||||
|
||||
// set tree
|
||||
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);
|
||||
}
|
||||
|
||||
// select company
|
||||
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();
|
||||
|
||||
}
|
||||
//New company link
|
||||
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= sel_val($i('chart_type'))
|
||||
var type= pscript.chart_type;
|
||||
var tree = new Tree(pscript.account_tree, '90%');
|
||||
pscript.ac_tree = tree;
|
||||
|
||||
// on click
|
||||
tree.std_onclick = function(node) {
|
||||
|
||||
|
||||
pscript.cur_node = node;
|
||||
|
||||
// show ledger
|
||||
pscript.set_ac_head(node.parent_account, node.rec,type);
|
||||
}
|
||||
|
||||
// on expand
|
||||
tree.std_onexp = function(node) {
|
||||
if(node.expanded_once)return;
|
||||
$ds(node.loading_div);
|
||||
//set_ac_head
|
||||
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;
|
||||
}
|
||||
|
||||
// Group / Ledger Area - set properties in the right column
|
||||
//---------------------------------------------------------
|
||||
|
||||
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') {
|
||||
// Account group/ledger area
|
||||
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');
|
||||
}
|
||||
//cost center group/ledger area
|
||||
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 = '';
|
||||
}
|
||||
|
||||
// Group Area
|
||||
// ----------
|
||||
|
||||
pscript.make_group_area = function(type) {
|
||||
pscript.group_area = $a(pscript.la,'div','ac_ledger');
|
||||
|
||||
// refresh
|
||||
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;
|
||||
|
||||
// button for acc adding
|
||||
pscript.acc_add_btn = $btn(pscript.group_area, '+ Add a child Account', function(){ pscript.new_acc_dialog.show(); });
|
||||
|
||||
// button for cost center adding
|
||||
pscript.cc_add_btn = $btn(pscript.group_area, '+ Add a child Cost Center', null);
|
||||
|
||||
//showing new cost center dialog
|
||||
pscript.cc_add_btn.onclick = function(){
|
||||
|
||||
// check for cost center name & group or ledger
|
||||
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 making
|
||||
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':''
|
||||
}
|
||||
|
||||
//create cost center -- server to gl control
|
||||
$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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Ledger Area
|
||||
// ----------
|
||||
|
||||
pscript.make_ledger_area = function() {
|
||||
pscript.ledger_area = $a(pscript.la,'div','ac_ledger');
|
||||
|
||||
//General ledger report link
|
||||
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'); }
|
||||
|
||||
//Budget report link
|
||||
/*pscript.cc_rep = $a(pscript.ledger_area, 'div','', {fontSize: '14px',marginBottom: '8px', fontWeight: 'bold'});
|
||||
pscript.cc_rep.innerHTML = '<img src="images/icons/report.png" style="margin-right: 8px"><span class="link_type">Budget vs Actual Analysis Report</span>';
|
||||
pscript.cc_rep.onclick = function(){ pscript.make_report('budget'); }*/
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
/*else {
|
||||
loadreport('Budget Detail','Periodical Budget Report',function(f){
|
||||
f.set_filter('Cost Center','ID',pscript.cur_node.rec.name);
|
||||
f.dt.run();
|
||||
});
|
||||
}*/
|
||||
}
|
||||
|
||||
// New Account
|
||||
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');
|
||||
|
||||
// hide / show account type
|
||||
d.widgets['Group or Ledger'].onchange = function() {
|
||||
if(sel_val(this)=='Ledger')$ds(d.rows['Account Type']);
|
||||
else $dh(d.rows['Account Type']);
|
||||
}
|
||||
|
||||
// hide / show tax rate
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
// New Cost Center
|
||||
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
accounts/page/accounts_browser/accounts_browser.txt
Normal file
1
accounts/page/accounts_browser/accounts_browser.txt
Normal file
@@ -0,0 +1 @@
|
||||
[{'creation': '2009-03-12 12:09:24', 'module': 'Accounts', 'doctype': 'Page', 'owner': 'Administrator', 'style': None, 'modified_by': 'nabin@webnotestech.com', 'script': None, 'show_in_menu': 0, 'content': None, 'page_name': 'Accounts Browser', 'menu_index': None, 'docstatus': 0, 'parent': None, 'standard': 'Yes', 'icon': '', 'name': 'Accounts Browser', 'idx': None, 'static_content': None, 'modified': '2010-11-18 17:00:21', 'parenttype': None, 'parent_node': None, 'parentfield': None}, {'modified_by': 'nabin@webnotestech.com', 'name': 'PR000004', 'parent': 'Accounts Browser', 'creation': '2009-03-12 12:09:24', 'modified': '2010-11-18 17:00:21', 'doctype': 'Page Role', 'idx': 1, 'parenttype': 'Page', 'role': 'Accounts User', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': 'roles'}]
|
||||
0
accounts/page/financial_statements/__init__.py
Normal file
0
accounts/page/financial_statements/__init__.py
Normal file
31
accounts/page/financial_statements/financial_statements.html
Normal file
31
accounts/page/financial_statements/financial_statements.html
Normal file
@@ -0,0 +1,31 @@
|
||||
<div class="layout_wrapper">
|
||||
<div id="fs_header"></div>
|
||||
</div>
|
||||
<!-- table.statement td { vertical-align: middle; } table.statement td select { width: 100px; } table.stmt_table { table-layout: fixed; border-collapse: collapse; } table.stmt_table td { vertical-align: middle; padding: 2px; } td.stmt_level0 { font-weight: bold; font-size: 14px; border-bottom: 1px solid #AAA; } td.stmt_level1 { font-weight: bold; font-size: 12px; } td.stmt_level2 { font-size: 11px; } td.stmt_level3 { font-size: 11px; } td.stmt_level4 { font-size: 12px; font-weight: bold; border-bottom: 1px solid #000; } td.stmt_level5 { color: BLUE; font-size: 11px; } --> <!--
|
||||
<div style="border: 1px solid #cccccc; padding: 4px; margin-top: 8px; background-color: #eeeeee; width: 98%;">
|
||||
<table class="statement" border="0" cellspacing="2px">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Statement:</td>
|
||||
<td style="padding-right: 8px;" mce_style="padding-right: 8px;"><select id="stmt_type"></select></td>
|
||||
<td>Company:</td>
|
||||
<td style="padding-right: 8px;" mce_style="padding-right: 8px;"><select id="stmt_company"></select></td>
|
||||
<td>Period Type:</td>
|
||||
<td style="padding-right: 8px;" mce_style="padding-right: 8px;"><select id="stmt_period"></select></td>
|
||||
<td>Fiscal Year:</td>
|
||||
<td style="padding-right: 8px;" mce_style="padding-right: 8px;"><select id="stmt_fiscal_year"></select></td>
|
||||
<td style="padding-right: 8px;" mce_style="padding-right: 8px;">
|
||||
<div id="stmt_new"></div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
--> <!--
|
||||
<div style="margin:10px 0px 10px 0px" mce_style="margin:10px 0px 10px 0px"><button class="button" onclick="pscript.print_statement();">Print</button></div>
|
||||
-->
|
||||
<div id="print_html">
|
||||
<div id="stmt_title1" style="margin:16px 0px 4px 0px; font-size: 16px; font-weight: bold; color: #888;"></div>
|
||||
<div id="stmt_title2" style="margin:0px 0px 8px 0px; font-size: 16px; font-weight: bold;"></div>
|
||||
<div id="stmt_tree" style="margin: 0px 0px 16px; overflow: auto; display: none; width: 100%;"></div>
|
||||
</div>
|
||||
147
accounts/page/financial_statements/financial_statements.js
Normal file
147
accounts/page/financial_statements/financial_statements.js
Normal file
@@ -0,0 +1,147 @@
|
||||
pscript['onload_Financial Statements'] = function() {
|
||||
|
||||
// header and toolbar
|
||||
var h = new PageHeader('fs_header','Financial Statements','Profit & Loss and Balance Sheet Builder across multiple years');
|
||||
//$y(h.toolbar_area,{padding:'8px'});
|
||||
|
||||
var dv = $a(h.toolbar_area,'div','',{margin:'4px 0px'});
|
||||
|
||||
var t = make_table(dv,1,4,'640px', [], {padding:'4px', width:'160px'});
|
||||
|
||||
var sel = $a($td(t,0,0),'select','',{width:'160px'});
|
||||
sel.id = 'stmt_type';
|
||||
|
||||
var sel = $a($td(t,0,1),'select','',{width:'160px'});
|
||||
sel.id = 'stmt_company';
|
||||
|
||||
var sel = $a($td(t,0,2),'select','',{width:'160px'});
|
||||
sel.id = 'stmt_period';
|
||||
|
||||
var sel = $a($td(t,0,3),'select','',{width:'160px'});
|
||||
sel.id = 'stmt_fiscal_year';
|
||||
|
||||
h.add_button('Create',function(){ pscript.stmt_new(); },0,'ui-icon-document');
|
||||
h.add_button('Print', function(){ _p.go($i('print_html').innerHTML); }, 0, 'ui-icon-print');
|
||||
/*
|
||||
var btn = $a($td(t,1,0),'button');
|
||||
btn.onclick = function(){ pscript.stmt_new(); }
|
||||
btn.innerHTML = 'Create';
|
||||
|
||||
var btn = $a($td(t,1,1),'button');
|
||||
btn.onclick = function(){ alert('print'); }
|
||||
btn.innerHTML = 'Print';
|
||||
|
||||
//Button to create new
|
||||
var btn = $a('stmt_new', 'button');
|
||||
btn.onclick = function() { pscript.stmt_new(); }
|
||||
btn.innerHTML = 'Create';*/
|
||||
|
||||
// select for statement
|
||||
add_sel_options($i('stmt_type'), ['Select Statement...','Balance Sheet','Profit & Loss']);
|
||||
|
||||
// select for companies
|
||||
add_sel_options($i('stmt_company'), ['Loading Companies...']);
|
||||
|
||||
|
||||
// load companies
|
||||
$c_obj('MIS Control','get_comp','', function(r,rt) {
|
||||
// company
|
||||
empty_select($i('stmt_company'));
|
||||
add_sel_options($i('stmt_company'), add_lists(['Select Company...'], r.message.company), 'Select Company...');
|
||||
|
||||
|
||||
// period
|
||||
empty_select($i('stmt_period'));
|
||||
//add_sel_options($i('stmt_period'), add_lists(['Select Period...'], r.message.period), 'Select period...');
|
||||
add_sel_options($i('stmt_period'), add_lists(['Select Period...'], ['Annual', 'Quarterly', 'Monthly']), 'Select period...');
|
||||
|
||||
// fiscal-year
|
||||
empty_select($i('stmt_fiscal_year'));
|
||||
add_sel_options($i('stmt_fiscal_year'), add_lists(['Select Year...'], r.message.fiscal_year), 'Select fiscal year...');
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
pscript.stmt_new = function(stmt,company_name,level,period,year) {
|
||||
|
||||
$i('stmt_tree').innerHTML = 'Refreshing....';
|
||||
$i('stmt_tree').style.display = 'block';
|
||||
|
||||
var arg = {
|
||||
statement:sel_val($i('stmt_type'))
|
||||
,company:sel_val($i('stmt_company'))
|
||||
,period:sel_val($i('stmt_period'))
|
||||
,year:sel_val($i('stmt_fiscal_year'))
|
||||
}
|
||||
|
||||
$c_obj('MIS Control', 'get_statement', docstring(arg), function(r,rt) {
|
||||
var nl = r.message;
|
||||
var t = $i('stmt_tree');
|
||||
var stmt_type = sel_val($i('stmt_type'));
|
||||
t.innerHTML = '';
|
||||
var tab = $a($a(t, 'div'),'table','stmt_table');
|
||||
tab.style.tableLayout = 'fixed';
|
||||
tab.style.width = '100%';
|
||||
|
||||
$i('stmt_title1').innerHTML = sel_val($i('stmt_company'));
|
||||
$i('stmt_title2').innerHTML = sel_val($i('stmt_type')) + ' - ' + sel_val($i('stmt_fiscal_year'));
|
||||
for(i=0;i<nl.length;i++) {
|
||||
tab.insertRow(i);
|
||||
|
||||
tab.rows[i].style.height = '20px';
|
||||
|
||||
// heads
|
||||
var per = tab.rows[i].insertCell(0);
|
||||
// var acc_width = (sel_val($i('stmt_period'))=='Monthly')? 12 : 20;
|
||||
// per.style.width = acc_width+'%';
|
||||
per.style.width = '150px';
|
||||
per.innerHTML = pscript.space_reqd(nl[i][0])+cstr(nl[i][1]);
|
||||
per.className = 'stmt_level' + nl[i][0];
|
||||
|
||||
// Make Title Bold
|
||||
if(nl[i][0] == 0 || nl[i][0] == 1 || nl[i][0] == 4){
|
||||
per.innerHTML = (pscript.space_reqd(nl[i][0])+cstr(nl[i][1])+'').bold();
|
||||
per.style.fontSize = '12px';
|
||||
}
|
||||
|
||||
for(j=2;j<nl[i].length;j++){
|
||||
var per = tab.rows[i].insertCell(j-1);
|
||||
// per.style.width = (100-acc_width)/(nl[i].length-2) +'%';
|
||||
per.style.width = '150px';
|
||||
per.style.textAlign = "right";
|
||||
per.className = 'stmt_level' + nl[i][0];
|
||||
if (i==0) {
|
||||
per.style.fontSize = '14px';
|
||||
per.style.textAlign = "right";
|
||||
}
|
||||
if (nl[i][0]==5) {
|
||||
if(flt(nl[i][j])<0.0) per.style.color = "RED";
|
||||
else per.style.color = "GREEN";
|
||||
}
|
||||
if(nl[i][0] != 0){
|
||||
if(nl[i][j]) {
|
||||
if (i==0) per.innerHTML = (nl[i][j]+'').bold();
|
||||
else if(nl[i][0] == 1 || nl[i][0] == 4) per.innerHTML = (cstr(fmt_money(nl[i][j]))+'').bold();
|
||||
else per.innerHTML = fmt_money(nl[i][j])
|
||||
} else
|
||||
per.innerHTML = '-';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
$i('stmt_tree').style.display = 'block';
|
||||
}
|
||||
|
||||
//printing statement
|
||||
pscript.print_statement = function(){
|
||||
print_go($i('print_html').innerHTML);
|
||||
}
|
||||
|
||||
//determine space to be given
|
||||
pscript.space_reqd = function(val){
|
||||
if(val == 1) return ' ';
|
||||
else if(val == 2) return ' ';
|
||||
else if(val == 3) return ' ';
|
||||
else return '';
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
[{'creation': '2009-03-12 12:09:24', 'module': 'Accounts', 'doctype': 'Page', 'owner': 'Administrator', 'style': None, 'modified_by': 'Administrator', 'script': None, 'show_in_menu': 0, 'content': None, 'page_name': 'Financial Statements', 'menu_index': None, 'docstatus': 0, 'parent': None, 'standard': 'Yes', 'icon': '', 'name': 'Financial Statements', 'idx': None, 'static_content': None, 'modified': '2010-09-25 00:00:00', 'parenttype': None, 'parent_node': None, 'parentfield': None}, {'modified_by': 'Administrator', 'name': 'PR000005', 'parent': 'Financial Statements', 'creation': '2009-03-12 12:09:24', 'modified': '2010-04-08 12:28:01', 'doctype': 'Page Role', 'idx': 1, 'parenttype': 'Page', 'role': 'Accounts User', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': 'roles'}, {'modified_by': 'Administrator', 'name': 'PR000016', 'parent': 'Financial Statements', 'creation': '2009-06-04 15:16:31', 'modified': '2010-03-29 13:40:15', 'doctype': 'Page Role', 'idx': 2, 'parenttype': 'Page', 'role': 'Administrator', 'owner': 'Administrator', 'docstatus': 0, 'parentfield': 'roles'}, {'modified_by': 'Administrator', 'name': 'PR000051', 'parent': 'Financial Statements', 'creation': '2009-09-23 16:34:18', 'modified': '2010-03-29 13:40:15', 'doctype': 'Page Role', 'idx': 3, 'parenttype': 'Page', 'role': 'Accounts Manager', 'owner': 'nabin@webnotestech.com', 'docstatus': 0, 'parentfield': 'roles'}]
|
||||
Reference in New Issue
Block a user