diff --git a/Apollo/api/application/models/DayBook_model.php b/Apollo/api/application/models/DayBook_model.php index bddc0216..bc727a60 100644 --- a/Apollo/api/application/models/DayBook_model.php +++ b/Apollo/api/application/models/DayBook_model.php @@ -1055,14 +1055,16 @@ $subQuery='select Name,ListName,q.Date as dat,month(str_to_date(Date,?)) as mont SUM(IF(q.Name=? and TypeID =?,Amount,0)) AS OperationalIncome, SUM(IF(q.Name=? and TypeID = ?,Amount,0)) AS OperationalExpense, SUM(IF(q.Name=? and TypeID != ?,Amount,0)) AS NonOperationalIncome, - SUM(IF(q.Name=? and TypeID != ?,Amount,0)) AS NonOperationalExpense + SUM(IF(q.Name=? and TypeID != ?,Amount,0)) AS NonOperationalExpense, + (SUM(IF(q.Name=? and TypeID =?,Amount,0))+SUM(IF(q.Name=? and TypeID != ?,Amount,0)))- + (SUM(IF(q.Name=? and TypeID = ?,Amount,0))+SUM(IF(q.Name=? and TypeID != ?,Amount,0))) as Net from T_NonOperationalMaster as q left Join T_Income_Outcome_Master on T_Income_Outcome_Master.ID= q.Type left Join T_PickListDetails on T_PickListDetails.ListCode=q.Name where str_to_date(Date,?)>=? and str_to_date(Date,?)<=? and q.BranchCode=? group by month'; - $query = $this->db->query($subQuery,array('%d-%m-%Y','%d-%m-%Y','I002','I002','I001','I001','I002','I002','I001','I001','%d-%m-%Y',$fromd,'%d-%m-%Y',$tod,$branch)); + $query = $this->db->query($subQuery,array('%d-%m-%Y','%d-%m-%Y','I002','I002','I001','I001','I002','I002','I001','I001','I002','I002','I002','I002','I001','I001','I001','I001','%d-%m-%Y',$fromd,'%d-%m-%Y',$tod,$branch)); // print_r($this->db->last_query()); die(); diff --git a/Apollo/assets/js/controllers/income_reportCtrl.js b/Apollo/assets/js/controllers/income_reportCtrl.js index ed02c17a..a6cf52bd 100644 --- a/Apollo/assets/js/controllers/income_reportCtrl.js +++ b/Apollo/assets/js/controllers/income_reportCtrl.js @@ -378,8 +378,8 @@ app.controller('income_reportCtrl', ["$scope","$rootScope","toaster", "$filter", $scope.grandTot = { - OperationalExpense:"Grand Total", - NonOperationalExpense: $scope.Net_Total + NonOperationalExpense:"Grand Total", + Net: $scope.Net_Total } $scope.expense = $scope.PLexceldetails.concat($scope.grandTot); @@ -387,7 +387,7 @@ app.controller('income_reportCtrl', ["$scope","$rootScope","toaster", "$filter", for (var i = 0; i < $scope.PLexceldetails.length; i++) $scope.expense[i].SL_NO = i + 1; - alasql('SELECT SL_NO,concat(month,"/",Year)as Date,OperationalIncome,NonOperationalIncome,OperationalExpense,NonOperationalExpense INTO XLS("Income Expense report.xls",?) FROM ?',[mystyle,$scope.expense]); + alasql('SELECT SL_NO,concat(month,"/",Year)as Date,OperationalIncome,NonOperationalIncome,OperationalExpense,NonOperationalExpense,Net as Profit_or_Loss INTO XLS("Income Expense report.xls",?) FROM ?',[mystyle,$scope.expense]); };