report : ps

This commit is contained in:
Sanjeev 2020-12-28 19:55:42 +05:30
parent 7928228ff2
commit 90ddd84e6e

View File

@ -1192,15 +1192,14 @@ class DayBook_model extends CI_Model
public function getIncome_Details($from,$to,$incid,$branch)
{
$fromd= date("Y-m-d",strtotime($from));
$tod=date("Y-m-d",strtotime($to));
$fromd= date("d-m-Y",strtotime($from));
$tod=date("d-m-Y",strtotime($to));
$expid = 'I001';
if($from != null && $to != null){
$where="str_to_date(Date,'%d-%m-%Y')>=".$fromd." and str_to_date(Date,'%d-%m-%Y')<=".$tod." and";
}else{
$where="str_to_date(Date,'%d-%m-%Y')>=str_to_date('".$fromd."','%d-%m-%Y') and str_to_date(Date,'%d-%m-%Y')<=str_to_date('".$tod."','%d-%m-%Y') and";
}else{
$where="";
}
}
// $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
@ -1215,7 +1214,6 @@ class DayBook_model extends CI_Model
where ".$where." 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('Cancel',$branch));
// print_r($subQuery);die();
$expense = $query->result();
@ -1238,7 +1236,7 @@ class DayBook_model extends CI_Model
$expenseNon = $queryNon->result();
// print_r($this->db->last_query());die();
if(count($expenseNon)>0)
{
@ -1255,8 +1253,9 @@ class DayBook_model extends CI_Model
public function GetPLexcelDetails($from,$to,$branch)
{
$fromd= date("Y-m-d",strtotime($from));
$tod=date("Y-m-d",strtotime($to));
$fromd= date("d-m-Y",strtotime($from));
$tod=date("d-m-Y",strtotime($to));
// $subQuery='select Name,ListName,Date,T_Income_Outcome_Master.ID,T_Income_Outcome_Master.TypeID as OrgType,T_Income_Outcome_Master.TypeName,
// SUM(IF(p.Name=? ,Amount,0)) AS OperationalIncome,
@ -1309,10 +1308,8 @@ public function GetPLexcelDetails($from,$to,$branch)
// $query = $this->db->query($subQuery,array('I002','I002','I001','I001','I002','I002','I001','I001','%d-%m-%Y',$fromd,'%d-%m-%Y',$tod,$branch,'%d-%m-%Y'));
if($from != null && $to != null){
$where="str_to_date(Date,'%d-%m-%Y')>=".$fromd." and str_to_date(Date,'%d-%m-%Y')<=".$tod." and";
}else{
$where="";
}
$where="str_to_date(Date,'%d-%m-%Y')>=str_to_date('".$fromd."','%d-%m-%Y') and str_to_date(Date,'%d-%m-%Y')<=str_to_date('".$tod."','%d-%m-%Y') and";
}else{$where="";}
$subQuery='select Name,ListName,q.Date as dat,month(str_to_date(Date,?)) as month,year(str_to_date(Date,?)) as Year,
T_Income_Outcome_Master.ID,T_Income_Outcome_Master.TypeID as OrgType,T_Income_Outcome_Master.TypeName,