fixes as per xl-sheet : ps

This commit is contained in:
Sanjeev 2020-10-31 20:21:29 +05:30
parent f9fc3679bf
commit ea01651e30

View File

@ -1053,12 +1053,18 @@ 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
// $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'));
$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'));
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));
//and T_DayBookMaster.Isdaybook=?
$expense = $query->result();