From bceec1cbef013fa62067589d5c07d35bffdee13e Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 22 Jun 2012 14:32:56 +0530 Subject: [PATCH] error fixed in cost center wise expense report --- .../cost_center_wise_expense.sql | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/erpnext/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.sql b/erpnext/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.sql index 5b22add275..b5fbb7c85b 100644 --- a/erpnext/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.sql +++ b/erpnext/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.sql @@ -1,12 +1,20 @@ -SELECT `tabGL Entry`.`cost_center`,`tabAccount`.`parent_account`,sum(`tabGL Entry`.`debit`),sum(`tabGL Entry`.`credit`),sum(`tabGL Entry`.`debit`)-sum(`tabGL Entry`.`credit`) - FROM `tabGL Entry`,`tabAccount` - WHERE `tabGL Entry`.`account`=`tabAccount`.`name` - AND ifnull(`tabGL Entry`.`is_cancelled`,'No')='No' - AND `tabAccount`.is_pl_account='Yes' - AND `tabAccount`.debit_or_credit='Debit' - AND `tabGL Entry`.`posting_date`>='%(posting_date)s' - AND `tabGL Entry`.`posting_date`<='%(posting_date1)s' - AND `tabGL Entry`.`company` LIKE '%(company)s%%' - AND `tabAccount`.`parent_account` LIKE '%(account)s%%' - AND `tabGL Entry`.`cost_center` LIKE '%(cost_center)s%%' - GROUP BY `tabGL Entry`.`cost_center` , `tabAccount`.`parent_account` \ No newline at end of file +SELECT + `tabGL Entry`.`cost_center`, + `tabAccount`.`parent_account`, + sum(ifnull(`tabGL Entry`.`debit`, 0)), + sum(ifnull(`tabGL Entry`.`credit`, 0)), + sum(ifnull(`tabGL Entry`.`debit`,0))-sum(ifnull(`tabGL Entry`.`credit`, 0)) + FROM + `tabGL Entry`,`tabAccount` + WHERE + `tabGL Entry`.`account`=`tabAccount`.`name` + AND ifnull(`tabGL Entry`.`is_cancelled`,'No')='No' + AND `tabAccount`.is_pl_account='Yes' + AND `tabAccount`.debit_or_credit='Debit' + AND `tabGL Entry`.`posting_date`>='%(posting_date)s' + AND `tabGL Entry`.`posting_date`<='%(posting_date1)s' + AND `tabGL Entry`.`company` LIKE '%(company)s%%' + AND `tabAccount`.`parent_account` LIKE '%(account)s%%' + AND `tabGL Entry`.`cost_center` LIKE '%(cost_center)s%%' + GROUP BY + `tabGL Entry`.`cost_center` , `tabAccount`.`parent_account` \ No newline at end of file