From 32db33d774df78ae4996ae0c58ff1b9d45e3291d Mon Sep 17 00:00:00 2001 From: Sanjeev Date: Mon, 2 Nov 2020 17:05:38 +0530 Subject: [PATCH] Phase1 Issues xl - report 5A : sanjeev --- Apollo/api/application/models/DayBook_model.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Apollo/api/application/models/DayBook_model.php b/Apollo/api/application/models/DayBook_model.php index 145b2545..5530104c 100644 --- a/Apollo/api/application/models/DayBook_model.php +++ b/Apollo/api/application/models/DayBook_model.php @@ -1192,14 +1192,21 @@ class DayBook_model extends CI_Model $expid = 'I001'; - $subQuery='select Name,sum(Amount) as Total,T_DayBookMaster.ID,T_Income_Outcome_Master.ID as SubID,T_Income_Outcome_Master.TypeID as OrgType,T_Income_Outcome_Master.TypeName,T_DayBookMaster.Date,Reason,T_DayBookMaster.Description,ListName from T_DayBookMaster -left join T_Income_Outcome_Master on T_Income_Outcome_Master.ID = T_DayBookMaster.Type -join T_PickListDetails on T_PickListDetails.ListCode = T_Income_Outcome_Master.TypeID -where str_to_date(date,?)>=? and str_to_date(date,?)<=? and Status!=? and T_DayBookMaster.BranchCode=? and (T_DayBookMaster.ModeOfPayment != ? and T_DayBookMaster.ModeOfPayment != ?and T_DayBookMaster.Status !=?) group by Type,Name'; +// $subQuery='select Name,sum(Amount) as Total,T_DayBookMaster.ID,T_Income_Outcome_Master.ID as SubID,T_Income_Outcome_Master.TypeID as OrgType,T_Income_Outcome_Master.TypeName,T_DayBookMaster.Date,Reason,T_DayBookMaster.Description,ListName from T_DayBookMaster +// left join T_Income_Outcome_Master on T_Income_Outcome_Master.ID = T_DayBookMaster.Type +// join T_PickListDetails on T_PickListDetails.ListCode = T_Income_Outcome_Master.TypeID +// where str_to_date(date,?)>=? and str_to_date(date,?)<=? and Status!=? and T_DayBookMaster.BranchCode=? and (T_DayBookMaster.ModeOfPayment != ? and T_DayBookMaster.ModeOfPayment != ?and T_DayBookMaster.Status !=?) group by Type,Name'; -$query = $this->db->query($subQuery,array('%d-%m-%Y',$fromd,'%d-%m-%Y',$tod,'Cancel',$branch,'WAIVER','REFERRAL','Pending')); +// $query = $this->db->query($subQuery,array('%d-%m-%Y',$fromd,'%d-%m-%Y',$tod,'Cancel',$branch,'WAIVER','REFERRAL','Pending')); //and T_DayBookMaster.Isdaybook=? + $subQuery="select Name,sum(Amount) as Total,T_DayBookMaster.ID,T_Income_Outcome_Master.ID as SubID,T_Income_Outcome_Master.TypeID as OrgType,T_Income_Outcome_Master.TypeName,T_DayBookMaster.Date,Reason,T_DayBookMaster.Description,ListName from T_DayBookMaster +left join T_Income_Outcome_Master on T_Income_Outcome_Master.ID = T_DayBookMaster.Type +join T_PickListDetails on T_PickListDetails.ListCode = T_Income_Outcome_Master.TypeID +where str_to_date(date,?)>=? and str_to_date(date,?)<=? and Status!=? and T_DayBookMaster.BranchCode=? and (case when ListName = 'Income' then T_DayBookMaster.ModeOfPayment != 'WAIVER' and T_DayBookMaster.ModeOfPayment != 'REFERRAL'and T_DayBookMaster.Status !='Pending' and T_Income_Outcome_Master.TypeName NOT LIKE '%BY CASH%' + when ListName = 'Expense' then T_DayBookMaster.Status !='Pending' and T_Income_Outcome_Master.TypeName != 'FEES' and T_Income_Outcome_Master.TypeName NOT LIKE '%CASH TO%' end) group by Type,Name"; +$query = $this->db->query($subQuery,array('%d-%m-%Y',$fromd,'%d-%m-%Y',$tod,'Cancel',$branch)); + $expense = $query->result();