Fixed Company Default Currency in Accounts Browser

This commit is contained in:
Ravi Dey 2011-06-28 14:48:19 +05:30
parent 8d3f4b6fd8
commit bb24e5ff06
2 changed files with 27 additions and 13 deletions

View File

@ -31,9 +31,12 @@ class DocType:
#for r in ret: #for r in ret:
# inc = get_value('Account','Income - '+r[1], 'balance') # inc = get_value('Account','Income - '+r[1], 'balance')
# exp = get_value('Account','Expenses - '+r[1], 'balance') # exp = get_value('Account','Expenses - '+r[1], 'balance')
# pl[r[0]] = flt(flt(inc) - flt(exp)) # pl[r[0]] = flt(flt(inc) - flt(exp))
return {'cl':[r[0] for r in ret]}#, 'pl':pl} return {'cl':[r[0] for r in ret]}#, 'pl':pl}
def get_company_currency(self,arg=''):
ret = sql("select default_currency from tabCompany where name=%s and docstatus != 2", arg)
return ret[0]
# Get current balance # Get current balance
# -------------------- # --------------------

View File

@ -68,15 +68,15 @@ pscript.make_chart = function(b) {
// select company // select company
add_sel_options(sel, ['Loading...']); add_sel_options(sel, ['Loading...']);
var callback = function(r,rt) { var callback = function(r,rt) {
empty_select(sel); empty_select(sel);
add_sel_options(sel,r.message.cl,sys_defaults.company); add_sel_options(sel,r.message.cl,sys_defaults.company);
set_tree(); set_tree();
sel.onchange = function() { set_tree(); } sel.onchange = function() { set_tree(); }
} }
$c_obj('GL Control', 'get_companies', '', callback); $c_obj('GL Control', 'get_companies', '', callback);
pscript.ab_company_sel = sel; pscript.ab_company_sel = sel;
pscript.make_ac_head(); pscript.make_ac_head();
pscript.make_group_area(); pscript.make_group_area();
@ -175,15 +175,20 @@ pscript.make_ac_head = function() {
// Group / Ledger Area - set properties in the right column // Group / Ledger Area - set properties in the right column
//--------------------------------------------------------- //---------------------------------------------------------
pscript.set_ac_head = function(parent_account, r,type) { pscript.set_ac_head = function(parent_account, r,type) {
var d = pscript.ac_head_area; var d = pscript.ac_head_area;
d.main_head.innerHTML = r.account_name; d.main_head.innerHTML = r.account_name;
$ds(d.sub_head); $ds(d.sub_head);
$ds(d.balance_area); $ds(d.balance_area);
var callback = function(r,rt) {
dcc = r.message;
}
$c_obj('GL Control', 'get_company_currency', pscript.ab_company_sel.value, callback);
if(r.name!='Root Node') { if(r.name!='Root Node') {
// Account group/ledger area // Account group/ledger area
if(type=='Account'){ if(type=='Account'){
d.sub_head.dt = 'Account'; d.sub_head.dn = r.name 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_head1.innerHTML = r.debit_or_credit + ' - ' + r.group_or_ledger;
@ -198,8 +203,14 @@ pscript.set_ac_head = function(parent_account, r,type) {
$ds(pscript.group_area); $ds(pscript.group_area);
$ds(pscript.acc_add_btn); $ds(pscript.acc_add_btn);
$dh(pscript.cc_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');
var callback = function(r,rt) {
dcc = r.message;
}
$c_obj('GL Control', 'get_company_currency', pscript.ab_company_sel.value, callback);
d.balance.innerHTML = (dcc ? dcc : sys_defaults.currency)+ ' ' + (r.balance ? fmt_money(r.balance) :'0.00');
} }
//cost center group/ledger area //cost center group/ledger area
else{ else{