dahsboard_model.php
This commit is contained in:
parent
366794633a
commit
210ea79e56
@ -2267,7 +2267,7 @@ if ($cname!= ''){
|
||||
|
||||
}
|
||||
|
||||
//home--report--Day Wise Report //
|
||||
/** //home--report--Day Wise Report //
|
||||
function today_data($value='')
|
||||
{
|
||||
$sql="SELECT type,Sum(total) as todaydata FROM t_income_expense WHERE type = ? AND DATE(date) = CURRENT_DATE";
|
||||
@ -2300,7 +2300,50 @@ if ($cname!= ''){
|
||||
$query = $this->db->query($sql,array($value));
|
||||
return $query->result();
|
||||
|
||||
}
|
||||
}**/
|
||||
//home--report--Day Wise Report //
|
||||
function today_data()
|
||||
{
|
||||
$sql="SELECT sum(if(type = 'RECEIPT',total,0)) as daily_income_amt,
|
||||
sum(if(type = 'PAYMENT',total,0)) as daily_expenses_amt
|
||||
FROM t_income_expense
|
||||
WHERE DATE(date) = CURRENT_DATE";
|
||||
$query = $this->db->query($sql);
|
||||
return $query->result();
|
||||
|
||||
}
|
||||
|
||||
function monthwise_data()
|
||||
{
|
||||
//$sql="SELECT type,Sum(total) as monthlydata FROM t_income_expense WHERE type = ? AND MONTH(date) = MONTH(curdate())";
|
||||
$sql="SELECT sum(if(type = 'RECEIPT',total,0)) as monthly_income_amt,
|
||||
sum(if(type = 'PAYMENT',total,0)) as monthly_expenses_amt
|
||||
FROM t_income_expense
|
||||
WHERE YEAR(date) = YEAR(curdate()) AND MONTH(date) = MONTH(curdate())";
|
||||
$query = $this->db->query($sql);
|
||||
//,array($value));
|
||||
return $query->result();
|
||||
|
||||
}
|
||||
function yearwise_data()
|
||||
{
|
||||
if (date('m') >= 4) {
|
||||
$yearl = date('Y').'-'.(date('Y')+1);
|
||||
} else {
|
||||
$yearl = (date('Y')-1).'-'.date('Y');
|
||||
}
|
||||
$ab=$yearl;
|
||||
$fa=substr($ab,0,-5);
|
||||
$aa=substr($ab,5,5);
|
||||
|
||||
$sql="SELECT sum(if(type = 'RECEIPT',total,0)) as yearly_income_amt,
|
||||
sum(if(type = 'PAYMENT',total,0)) as yearly_expenses_amt
|
||||
FROM t_income_expense
|
||||
WHERE (date >= '".$fa."-04-01' and date <= '".$aa."-03-31')";
|
||||
$query = $this->db->query($sql);
|
||||
return $query->result();
|
||||
|
||||
}
|
||||
function departmentwise($sid='',$d='',$c='')
|
||||
{
|
||||
$sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,
|
||||
@ -2547,7 +2590,7 @@ function INRSymbol()
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function monthbeforetotal($month,$year){
|
||||
/** function monthbeforetotal($month,$year){
|
||||
|
||||
$sql="SELECT month(date) as monthnum ,year(date) as yearnum,
|
||||
sum(if(type = 'PAYMENT',total,0)) as payment_amt,
|
||||
@ -2580,7 +2623,41 @@ function daybeforetotal($yesterday){
|
||||
where date = ? ";
|
||||
$query = $this->db->query($sql,array($yesterday));
|
||||
return $query->result();
|
||||
}
|
||||
}**/
|
||||
|
||||
|
||||
function getYearlyOpeningAmt($prev_year){
|
||||
$sql="SELECT min(date),(sum(if(type = 'RECEIPT',total,0)) - sum(if(type = 'PAYMENT',total,0)) ) as opening_amt
|
||||
FROM t_income_expense
|
||||
WHERE date >= (select min(date) from t_income_expense) and date <= '".$prev_year."-03-31' ";
|
||||
$query = $this->db->query($sql);
|
||||
return $query->result();
|
||||
//print_r($query->result());
|
||||
|
||||
}
|
||||
|
||||
//function monthbeforetotal($month,$year){
|
||||
function getMonthlyOpeningAmt($dateformat){
|
||||
|
||||
$sql="SELECT month('".$dateformat."') as monthnum ,year('".$dateformat."') as yearnum,
|
||||
(sum(if(type = 'RECEIPT',total,0)) - sum(if(type = 'PAYMENT',total,0))) as opening_amt
|
||||
FROM t_income_expense
|
||||
WHERE date >= (select min(date) from t_income_expense) and date <= '".$dateformat."'";
|
||||
//WHERE month(date) between (select month(min(date)) from t_income_expense) and '".$month."' and year(date) = '".$year."'";
|
||||
$query = $this->db->query($sql);
|
||||
return $query->result();
|
||||
|
||||
}
|
||||
|
||||
|
||||
//function daybeforetotal($yesterday){
|
||||
function getDailyOpeningAmt($yesterday){
|
||||
$sql="select date,(sum(if(type = 'RECEIPT',total,0)) - sum(if(type = 'PAYMENT',total,0))) as opening_amt
|
||||
from t_income_expense
|
||||
where date between (select min(date) from t_income_expense) and '".$yesterday."'";
|
||||
$query = $this->db->query($sql);
|
||||
return $query->result();
|
||||
}
|
||||
|
||||
function accountname()
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user