From 54fbc8e4e6ae18da3b7854ef0bd2fc461f5f8a61 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 25 Aug 2011 14:12:17 +0530 Subject: [PATCH 1/7] fixed test case --- hr/doctype/salary_manager/test_salary_manager.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hr/doctype/salary_manager/test_salary_manager.py b/hr/doctype/salary_manager/test_salary_manager.py index 1a0b48a18e..e3df804b0d 100644 --- a/hr/doctype/salary_manager/test_salary_manager.py +++ b/hr/doctype/salary_manager/test_salary_manager.py @@ -57,7 +57,7 @@ class TestSalarySlip(unittest.TestCase): self.assertTrue(ss[0][0]==67) def test_submit(self): - self.sm.submit_sal_slip() + self.sm.submit_salary_slip() ss = webnotes.conn.sql(""" select docstatus from `tabSalary Slip` @@ -112,7 +112,8 @@ emp1 = Document(fielddata={ 'grade':'grade1', 'naming_series':'EMP/', 'status':'Active', - 'docstatus':0 + 'docstatus':0, + 'employee_name':'emp1' }) emp2 = Document(fielddata={ @@ -135,7 +136,8 @@ ss1 = [ 'employee':'emp1', 'is_active':'Yes', 'department': 'dep1', - 'designation' : 'des1' + 'designation' : 'des1', + 'employee_name': 'emp1' }), Document(fielddata={ 'parenttype':'Salary Structure', From 9292ac773ee3b15ef70c370c844505d5e5a3b51e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 25 Aug 2011 16:21:58 +0530 Subject: [PATCH 2/7] Email will be sent on submit --- hr/doctype/salary_manager/salary_manager.py | 16 ++- hr/doctype/salary_slip/salary_slip.py | 112 ++++++++++---------- 2 files changed, 67 insertions(+), 61 deletions(-) diff --git a/hr/doctype/salary_manager/salary_manager.py b/hr/doctype/salary_manager/salary_manager.py index ec8fba271a..50710568e8 100644 --- a/hr/doctype/salary_manager/salary_manager.py +++ b/hr/doctype/salary_manager/salary_manager.py @@ -68,9 +68,9 @@ class DocType: emp_list = self.get_emp_list() log = "" if emp_list: - log = "" + log = "
Following Salary Slip has been created:
SAL SLIP IDEMPLOYEE NAME
" else: - log = "
Following Salary Slip has been created:
SAL SLIP IDEMPLOYEE NAME
" + log = "
No employee found for the above selected criteria
" for emp in emp_list: if not sql("""select name from `tabSalary Slip` @@ -119,9 +119,17 @@ class DocType: ss_list = self.get_sal_slip_list() log = "" if ss_list: - log = "
No employee found for the above selected criteria
" + log = """
Following Salary Slip has been submitted:
SAL SLIP IDEMPLOYEE NAME
+ + + + + + + + """ else: - log = "
Following Salary Slip has been submitted:
SAL SLIP IDEMPLOYEE NAME
" + log = "
No salary slip found to submit for the above selected criteria
" for ss in ss_list: ss_obj = get_obj("Salary Slip",ss[0],with_children=1) diff --git a/hr/doctype/salary_slip/salary_slip.py b/hr/doctype/salary_slip/salary_slip.py index 0cdc898673..6a1705054e 100644 --- a/hr/doctype/salary_slip/salary_slip.py +++ b/hr/doctype/salary_slip/salary_slip.py @@ -175,9 +175,9 @@ class DocType(TransactionBase): emailid_ret=sql("select company_email from `tabEmployee` where name = '%s'"%self.doc.employee) if emailid_ret: receiver = cstr(emailid_ret[0][0]) - subj = 'Salary Slip ' + cstr(self.doc.month) +' '+cstr(self.doc.year) - earn_ret=sql("select e_type,e_amount from `tabSS Earning Detail` where parent = '%s'"%self.doc.name) - ded_ret=sql("select d_type,d_amount from `tabSS Deduction Detail` where parent = '%s'"%self.doc.name) + subj = 'Salary Slip - ' + cstr(self.doc.month) +'/'+cstr(self.doc.fiscal_year) + earn_ret=sql("select e_type,e_modified_amount from `tabSS Earning Detail` where parent = '%s'"%self.doc.name) + ded_ret=sql("select d_type,d_modified_amount from `tabSS Deduction Detail` where parent = '%s'"%self.doc.name) earn_table = '' ded_table = '' @@ -207,62 +207,60 @@ class DocType(TransactionBase): if not letter_head: letter_head = '' - msg = ''' %s
+ msg = '''
%s
+
No salary slip found to submit for the above selected criteria
+ + + + + + + + + + + +

Salary Slip

Employee Code : %sEmployee Name : %s
Month : %sFiscal Year : %s
- - - - - - - - - - - - - - - - + + + + + + + + + - - - - - + + + + - - - - - - - - - - - - -

- - - - - - - - -
- - - - - - - - -

Salary Slip

Employee Code : %sEmployee Name : %s
Month : %sYear : %sFiscal Year : %s
Department : %sBranch : %sDesignation : %s
Department : %sBranch : %sDesignation : %s
Grade : %sBank Account No. : %sBank Name : %s
Grade : %sBank Account No. : %sBank Name : %s
Arrear Amount : %sPayment days : %s
PF No. : %sESIC No. : %sArrear Amount : %s
Total days in month : %sLeave Without Pay : %sPayment days : %s
EarningDeduction
%s%s
Gross Pay : %sTotal Deduction : %s
Net Pay : %sNet Pay (in words) : %s
'''%(cstr(letter_head[0][0]),cstr(self.doc.employee),self.doc.employee_name,cstr(self.doc.month),cstr(self.doc.year),cstr(self.doc.fiscal_year),self.doc.department,self.doc.branch,self.doc.designation,self.doc.grade,cstr(self.doc.bank_account_no),self.doc.bank_name,cstr(self.doc.pf_no),cstr(self.doc.esic_no),cstr(self.doc.arrear_amount),cstr(self.doc.total_days_in_month),cstr(self.doc.leave_without_pay),cstr(self.doc.payment_days),earn_table,ded_table,cstr(self.doc.gross_pay),cstr(self.doc.total_deduction),cstr(self.doc.net_pay),cstr(self.doc.net_pay_in_words)) - sendmail([receiver], sender='automail@webnotestech.com', subject=subj, parts=[['text/plain', msg]]) + + + + + + + + + + + +
EarningDeduction
%s%s
+ + + + + + + + + + + +
Gross Pay : %sTotal Deduction : %s
Net Pay : %s
Net Pay(in words) : %s
'''%(cstr(letter_head[0][0]),cstr(self.doc.employee), cstr(self.doc.employee_name), cstr(self.doc.month), cstr(self.doc.fiscal_year), cstr(self.doc.department), cstr(self.doc.branch), cstr(self.doc.designation), cstr(self.doc.grade), cstr(self.doc.bank_account_no), cstr(self.doc.bank_name), cstr(self.doc.arrear_amount), cstr(self.doc.payment_days), earn_table, ded_table, cstr(self.doc.gross_pay), cstr(self.doc.total_deduction), cstr(self.doc.net_pay), cstr(self.doc.total_in_words)) + sendmail([receiver], sender='automail@erpnext.com', subject=subj, parts=[['text/plain', msg]]) else: msgprint("Company Email ID not found.") From fc69354c7cca2b2d236474e5a5dc1edf6546445a Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 25 Aug 2011 16:55:05 +0530 Subject: [PATCH 3/7] updated las_patch no --- patches/patch.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patches/patch.py b/patches/patch.py index dcd019b429..616be63f76 100644 --- a/patches/patch.py +++ b/patches/patch.py @@ -1,7 +1,7 @@ # REMEMBER to update this # ======================== -last_patch = 344 +last_patch = 346 #------------------------------------------- def execute(patch_no): @@ -257,4 +257,4 @@ def execute(patch_no): delete_doc('DocType', 'Profile') reload_doc('core', 'doctype', 'profile') - \ No newline at end of file + From 29a75c4d7a59c5a7ff55919ae7881ed4889c9f4f Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 25 Aug 2011 19:17:44 +0530 Subject: [PATCH 4/7] added dashboard --- home/page/dashboard/__init__.py | 0 home/page/dashboard/dashboard.css | 12 ++ home/page/dashboard/dashboard.html | 8 ++ home/page/dashboard/dashboard.js | 139 +++++++++++++++++++ home/page/dashboard/dashboard.py | 216 +++++++++++++++++++++++++++++ home/page/dashboard/dashboard.txt | 49 +++++++ 6 files changed, 424 insertions(+) create mode 100644 home/page/dashboard/__init__.py create mode 100644 home/page/dashboard/dashboard.css create mode 100644 home/page/dashboard/dashboard.html create mode 100644 home/page/dashboard/dashboard.js create mode 100644 home/page/dashboard/dashboard.py create mode 100644 home/page/dashboard/dashboard.txt diff --git a/home/page/dashboard/__init__.py b/home/page/dashboard/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/home/page/dashboard/dashboard.css b/home/page/dashboard/dashboard.css new file mode 100644 index 0000000000..d8e8b54d18 --- /dev/null +++ b/home/page/dashboard/dashboard.css @@ -0,0 +1,12 @@ +div.dashboard_table td { + width: 50%; +} + +div.dashboard-title { + font-weight: bold; + padding: '3px 0px'; +} + +div.dashboard-graph { + height: 180px; +} \ No newline at end of file diff --git a/home/page/dashboard/dashboard.html b/home/page/dashboard/dashboard.html new file mode 100644 index 0000000000..5ffef2f7b2 --- /dev/null +++ b/home/page/dashboard/dashboard.html @@ -0,0 +1,8 @@ +
+
+
+ +
Loading...
+
+
+
\ No newline at end of file diff --git a/home/page/dashboard/dashboard.js b/home/page/dashboard/dashboard.js new file mode 100644 index 0000000000..c5dd36150e --- /dev/null +++ b/home/page/dashboard/dashboard.js @@ -0,0 +1,139 @@ +pscript.onload_dashboard = function() { + // load jqplot + $.scriptPath = 'js/' + $.require(['jquery/jquery.jqplot.min.js', + 'jquery/jqplot-plugins/jqplot.barRenderer.js', + 'jquery/jqplot-plugins/jqplot.canvasAxisTickRenderer.min.js', + 'jquery/jqplot-plugins/jqplot.canvasTextRenderer.min.js', + 'jquery/jqplot-plugins/jqplot.categoryAxisRenderer.min.js']); + + + pscript.dashboard_settings = { + company: sys_defaults.company, + start: dateutil.obj_to_str(dateutil.add_days(new Date(), -60)), + end: dateutil.obj_to_str(new Date()), + interval: 7 + } + + var ph = new PageHeader($('.dashboard .header').get(0), 'Dashboards'); + var db = new Dashboard(); + + ph.add_button('Settings', db.show_settings); + + db.refresh(); + +} + +Dashboard = function() { + var me = this; + $.extend(me, { + refresh: function() { + $('.dashboard .help_box').css('display', 'block'); + $c_page('home', 'dashboard', 'load_dashboard', JSON.stringify(pscript.dashboard_settings), function(r,rt) { + $('.dashboard .help_box').css('display', 'none'); + me.render(r.message); + }) + }, + + render: function(data) { + $('.dashboard_table').html(''); + var t = make_table($('.dashboard_table').get(0), 4, 2, '100%', ['50%', '50%'], {padding: '5px'}); + var ridx=0; var cidx=0; + for(var i=0; i< data.length; i++) { + // switch columns and rows + if(cidx==2) { cidx=0; ridx++} + + // give an id! + var cell = $td(t,ridx,cidx); + var title = $a(cell, 'div', 'dashboard-title', '', data[i][0].title); + var parent = $a(cell, 'div', 'dashboard-graph') + + parent.id = '_dashboard' + ridx + '-' + cidx; + + // render graph + me.render_graph(parent.id, data[i][1]); + cidx++; + } + }, + + render_graph: function(parent, values) { + var vl = []; + $.each(values, function(i,v) { + vl.push([dateutil.str_to_user(v[0]), v[1]]); + }); + $.jqplot(parent, [vl], { + seriesDefaults:{ + renderer:$.jqplot.BarRenderer, + rendererOptions: {fillToZero: true}, + }, + axes: { + // Use a category axis on the x axis and use our custom ticks. + xaxis: { + min: 0, + renderer: $.jqplot.CategoryAxisRenderer, + tickRenderer: $.jqplot.CanvasAxisTickRenderer, + tickOptions: { + angle: -30, + fontSize: '8pt' + } + }, + // Pad the y axis just a little so bars can get close to, but + // not touch, the grid boundaries. 1.2 is the default padding. + yaxis: { + min: 0, + pad: 1.05, + tickOptions: {formatString: '%d'} + } + } + }); + }, + + show_settings: function() { + var d = new wn.widgets.Dialog({ + title: 'Set Company Settings', + width: 500, + fields: [ + { + label:'Company', + reqd: 1, + fieldname:'company', + fieldtype:'Link', + options: 'Company' + }, + { + label:'Start Date', + reqd: 1, + fieldname:'start', + fieldtype:'Date', + }, + { + label:'End Date', + reqd: 1, + fieldname:'end', + fieldtype:'Date', + }, + { + label:'Interval', + reqd: 1, + fieldname:'interval', + fieldtype:'Int' + }, + { + label:'Regenerate', + fieldname:'refresh', + fieldtype:'Button' + } + ] + }); + d.onshow = function() { + d.set_values(pscript.dashboard_settings); + } + d.fields_dict.refresh.input.onclick = function() { + pscript.dashboard_settings = d.get_values(); + me.refresh(); + d.hide(); + } + d.show(); + } + }) +} diff --git a/home/page/dashboard/dashboard.py b/home/page/dashboard/dashboard.py new file mode 100644 index 0000000000..3ce3b0c37d --- /dev/null +++ b/home/page/dashboard/dashboard.py @@ -0,0 +1,216 @@ +dashboards = [ + { + 'type': 'account', + 'account': 'Income', + 'title': 'Income' + }, + + { + 'type': 'account', + 'account': 'Expenses', + 'title': 'Expenses' + }, + + { + 'type': 'from_company', + 'account': 'receivables_group', + 'title': 'Receivables' + }, + + { + 'type': 'from_company', + 'account': 'payables_group', + 'title': 'Payables' + }, + + { + 'type': 'cash', + 'debit_or_credit': 'Debit', + 'title': 'Cash Inflow' + }, + + { + 'type': 'cash', + 'debit_or_credit': 'Credit', + 'title': 'Cash Outflow' + }, + + { + 'type': 'creation', + 'doctype': 'Quotation', + 'title': 'New Quotations' + }, + + { + 'type': 'creation', + 'doctype': 'Sales Order', + 'title': 'New Orders' + } +] + + +class DashboardWidget: + def __init__(self, company, start, end, interval): + import webnotes + from webnotes.utils import getdate + from webnotes.model.code import get_obj + + self.company = company + self.abbr = webnotes.conn.get_value('Company', company, 'abbr') + self.start = getdate(start) + self.end = getdate(end) + + self.interval = interval + self.fiscal_year = webnotes.conn.sql(""" + select name from `tabFiscal Year` + where year_start_date <= %s and + DATE_ADD(year_start_date, INTERVAL 1 YEAR) >= %s + """, (start, start))[0][0] + self.glc = get_obj('GL Control') + self.cash_accounts = [d[0] for d in webnotes.conn.sql(""" + select name from tabAccount + where account_type='Bank or Cash' + and company = %s and docstatus = 0 + """, company)] + + def timeline(self): + """ + get the timeline for the dashboard + """ + import webnotes + from webnotes.utils import add_days + tl = [] + + if self.start > self.end: + webnotes.msgprint("Start must be before end", raise_exception=1) + + curr = self.start + tl.append(curr) + + while curr < self.end: + curr = add_days(curr, self.interval, 'date') + tl.append(curr) + + tl.append(self.end) + + return tl + + def generate(self, opts): + """ + Generate the dasboard + """ + tl = self.timeline() + self.out = [] + + for i in range(len(tl)-1): + self.out.append([tl[i+1].strftime('%Y-%m-%d'), self.value(opts, tl[i], tl[i+1]) or 0]) + + return self.out + + def get_account_balance(self, acc, start): + """ + Get as on account balance + """ + import webnotes + # add abbreviation to company + + if not acc.endswith(self.abbr): + acc += ' - ' + self.abbr + + # get other reqd parameters + try: + globals().update(webnotes.conn.sql('select debit_or_credit, lft, rgt from tabAccount where name=%s', acc, as_dict=1)[0]) + except Exception,e: + webnotes.msgprint('Wrongly defined account: ' + acc) + print acc + raise e + + return self.glc.get_as_on_balance(acc, self.fiscal_year, start, debit_or_credit, lft, rgt) + + def get_creation_trend(self, doctype, start, end): + """ + Get creation # of creations in period + """ + import webnotes + return int(webnotes.conn.sql(""" + select count(*) from `tab%s` where creation between %s and %s and docstatus=1 + """ % (doctype, '%s','%s'), (start, end))[0][0]) + + def get_account_amt(self, acc, start, end): + """ + Get debit, credit over a period + """ + import webnotes + # add abbreviation to company + + if not acc.endswith(self.abbr): + acc += ' - ' + self.abbr + + ret = webnotes.conn.sql(""" + select ifnull(sum(ifnull(t1.debit,0)),0), ifnull(sum(ifnull(t1.credit,0)),0) + from `tabGL Entry` t1, tabAccount t2 + where t1.account = t2.name + and t2.is_pl_account = 'Yes' + and t2.debit_or_credit=%s + and ifnull(t1.is_cancelled, 'No')='No' + and t1.posting_date between %s and %s + """, (acc=='Income' and 'Credit' or 'Debit', start, end))[0] + + return acc=='Income' and (ret[1]-ret[0]) or (ret[0]-ret[1]) + + def value(self, opts, start, end): + """ + Value of the series on a particular date + """ + import webnotes + if opts['type']=='account': + bal = self.get_account_amt(opts['account'], start, end) + + elif opts['type']=='from_company': + acc = webnotes.conn.get_value('Company', self.company, \ + opts['account'].split('.')[-1]) + + return self.get_account_balance(acc, start)[2] + + elif opts['type']=='cash': + if type=='Credit': + return sum([self.get_account_balance(acc, start)[1] for acc in self.cash_accounts]) or 0 + if type=='Debit': + return sum([self.get_account_balance(acc, start)[0] for acc in self.cash_accounts]) or 0 + + elif opts['type']=='creation': + return self.get_creation_trend(opts['doctype'], start, end) + + +def load_dashboard(args): + """ + Get dashboard based on + 1. Company (default company) + 2. Start Date (last 3 months) + 3. End Date (today) + 4. Interval (7 days) + """ + dl = [] + import json + args = json.loads(args) + dw = DashboardWidget(args['company'], args['start'], args['end'], int(args['interval'])) + + # render the dashboards + for d in dashboards: + dl.append([d, dw.generate(d)]) + + return dl + +if __name__=='__main__': + import sys + sys.path.append('/var/www/webnotes/wnframework/cgi-bin') + from webnotes.db import Database + import webnotes + webnotes.conn = Database(use_default=1) + webnotes.session = {'user':'Administrator'} + print load_dashboard("""{ + "company": "My Test", + "start": "2011-05-01", + "end": "2011-08-01", + "interval": "7" + }""") \ No newline at end of file diff --git a/home/page/dashboard/dashboard.txt b/home/page/dashboard/dashboard.txt new file mode 100644 index 0000000000..46bc2bc0bc --- /dev/null +++ b/home/page/dashboard/dashboard.txt @@ -0,0 +1,49 @@ +# Page, dashboard +[ + + # These values are common in all dictionaries + { + 'creation': '2011-08-25 16:22:44', + 'docstatus': 0, + 'modified': '2011-08-25 16:22:54', + 'modified_by': 'Administrator', + 'owner': 'Administrator' + }, + + # These values are common for all Page + { + 'category': 'Standard', + 'doctype': 'Page', + 'module': 'Home', + 'name': '__common__', + 'page_name': 'Dashboard', + 'standard': 'Yes' + }, + + # These values are common for all Page Role + { + 'doctype': 'Page Role', + 'name': '__common__', + 'parent': 'dashboard', + 'parentfield': 'roles', + 'parenttype': 'Page' + }, + + # Page, dashboard + { + 'doctype': 'Page', + 'name': 'dashboard' + }, + + # Page Role + { + 'doctype': 'Page Role', + 'role': 'System Manager' + }, + + # Page Role + { + 'doctype': 'Page Role', + 'role': 'Accounts Manager' + } +] \ No newline at end of file From ac3aff5d29185181f41b71d0ae8aac520f2354c2 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 25 Aug 2011 19:24:34 +0530 Subject: [PATCH 5/7] dashboard fixes --- home/page/dashboard/dashboard.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/home/page/dashboard/dashboard.py b/home/page/dashboard/dashboard.py index 3ce3b0c37d..940bb50b94 100644 --- a/home/page/dashboard/dashboard.py +++ b/home/page/dashboard/dashboard.py @@ -173,9 +173,9 @@ class DashboardWidget: return self.get_account_balance(acc, start)[2] elif opts['type']=='cash': - if type=='Credit': + if opts['debit_or_credit']=='Credit': return sum([self.get_account_balance(acc, start)[1] for acc in self.cash_accounts]) or 0 - if type=='Debit': + elif opts['debit_or_credit']=='Debit': return sum([self.get_account_balance(acc, start)[0] for acc in self.cash_accounts]) or 0 elif opts['type']=='creation': From 0a187bece62f1f984220ce2bc3bd927e29ea24cb Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 25 Aug 2011 19:28:02 +0530 Subject: [PATCH 6/7] dashboard fixes --- home/page/dashboard/dashboard.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/home/page/dashboard/dashboard.py b/home/page/dashboard/dashboard.py index 940bb50b94..2f860dff8c 100644 --- a/home/page/dashboard/dashboard.py +++ b/home/page/dashboard/dashboard.py @@ -136,7 +136,7 @@ class DashboardWidget: select count(*) from `tab%s` where creation between %s and %s and docstatus=1 """ % (doctype, '%s','%s'), (start, end))[0][0]) - def get_account_amt(self, acc, start, end): + def get_account_amt(self, acc, start, end, debit_or_credit): """ Get debit, credit over a period """ @@ -154,9 +154,9 @@ class DashboardWidget: and t2.debit_or_credit=%s and ifnull(t1.is_cancelled, 'No')='No' and t1.posting_date between %s and %s - """, (acc=='Income' and 'Credit' or 'Debit', start, end))[0] + """, (debit_or_credit, start, end))[0] - return acc=='Income' and (ret[1]-ret[0]) or (ret[0]-ret[1]) + return debit_or_credit=='Credit' and (ret[1]-ret[0]) or (ret[0]-ret[1]) def value(self, opts, start, end): """ @@ -164,7 +164,11 @@ class DashboardWidget: """ import webnotes if opts['type']=='account': - bal = self.get_account_amt(opts['account'], start, end) + debit_or_credit = 'Debit' + if opts['account']=='Income': + debit_or_credit = 'Credit' + + return self.get_account_amt(opts['account'], start, end, debit_or_credit) elif opts['type']=='from_company': acc = webnotes.conn.get_value('Company', self.company, \ @@ -174,9 +178,9 @@ class DashboardWidget: elif opts['type']=='cash': if opts['debit_or_credit']=='Credit': - return sum([self.get_account_balance(acc, start)[1] for acc in self.cash_accounts]) or 0 + return sum([self.get_account_amt(acc, start, end, opts['debit_or_credit']) for acc in self.cash_accounts]) or 0 elif opts['debit_or_credit']=='Debit': - return sum([self.get_account_balance(acc, start)[0] for acc in self.cash_accounts]) or 0 + return sum([self.get_account_amt(acc, start, end, opts['debit_or_credit']) for acc in self.cash_accounts]) or 0 elif opts['type']=='creation': return self.get_creation_trend(opts['doctype'], start, end) From c91f88c5c503abff4fa22861661e52da7948a49c Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 25 Aug 2011 19:28:56 +0530 Subject: [PATCH 7/7] dashboard fixes --- home/page/dashboard/dashboard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/home/page/dashboard/dashboard.py b/home/page/dashboard/dashboard.py index 2f860dff8c..2c76b15630 100644 --- a/home/page/dashboard/dashboard.py +++ b/home/page/dashboard/dashboard.py @@ -156,7 +156,7 @@ class DashboardWidget: and t1.posting_date between %s and %s """, (debit_or_credit, start, end))[0] - return debit_or_credit=='Credit' and (ret[1]-ret[0]) or (ret[0]-ret[1]) + return debit_or_credit=='Credit' and float(ret[1]-ret[0]) or float(ret[0]-ret[1]) def value(self, opts, start, end): """