From 1c25428aa75911762be5c3371eb8066ede5f7f55 Mon Sep 17 00:00:00 2001 From: gayathri1990 Date: Thu, 21 Dec 2017 19:20:57 +0530 Subject: [PATCH] alignment changes --- application/controllers/report.php | 18 +++-- application/logs/log-2017-12-21.php | 18 +++++ application/models/dahsboard_model.php | 78 +++++++++++++------- application/views/cashbookall.php | 32 ++++++-- application/views/cashbookyearlyexpenses.php | 61 ++++++++++++--- 5 files changed, 158 insertions(+), 49 deletions(-) create mode 100644 application/logs/log-2017-12-21.php diff --git a/application/controllers/report.php b/application/controllers/report.php index 2876f999..54e1894f 100755 --- a/application/controllers/report.php +++ b/application/controllers/report.php @@ -1092,9 +1092,15 @@ class report extends BaseController $this->global['pageTitle'] = 'Cashbook - yearly expenses Reports - '; - + $fyear = $this->input->post('financialyear'); + + $fa=substr( $fyear,0,-5); + $aa=substr( $fyear,5,5); + //echo $fyear; //$data['yearlyincreport']=$this->dahsboard_Model->yearincomereport(); - $data['yearlyreport']=$this->dahsboard_Model->yearexpensereport(); + $data['yearlyreport']=$this->dahsboard_Model->yearexpensereport($fa,$aa); + $data['financialyear']=$this->dahsboard_Model->cashbookfinyear(); + //print_r($data['finyear']); $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); if($this->DEPCode == MANAGEMENT) @@ -1171,9 +1177,11 @@ class report extends BaseController $this->global['pageTitle'] = 'Cashbook - AllReport '; $fdate = $this->input->post('from_date'); $tdate = $this->input->post('to_date'); - //echo $fdate; - //echo $tdate; - $data['depmenu']=$this->dahsboard_Model->departmentmenu($fdate,$tdate); + $finyear = $this->input->post('financialyear'); + $fa=substr( $finyear,0,-5); + $aa=substr( $finyear,5,5); + $data['depmenu']=$this->dahsboard_Model->departmentmenu($fdate,$tdate,$fa,$aa); + $data['financialyear']=$this->dahsboard_Model->cashbookfinyear(); $data['Indiancurrency']=$this->dahsboard_Model->INRSymbol(); $this->loadviews("cashbookall",$this->global,$data, NULL); } diff --git a/application/logs/log-2017-12-21.php b/application/logs/log-2017-12-21.php new file mode 100644 index 00000000..95da80d5 --- /dev/null +++ b/application/logs/log-2017-12-21.php @@ -0,0 +1,18 @@ + + +ERROR - 2017-12-21 14:49:05 --> Severity: Notice --> Undefined variable: cash C:\xampp\htdocs\siddharth_application\application\views\reportcashbook.php 230 +ERROR - 2017-12-21 14:49:05 --> Severity: Notice --> Trying to get property of non-object C:\xampp\htdocs\siddharth_application\application\views\reportcashbook.php 230 +ERROR - 2017-12-21 14:49:05 --> Severity: Notice --> Undefined variable: cash C:\xampp\htdocs\siddharth_application\application\views\reportcashbook.php 230 +ERROR - 2017-12-21 14:49:05 --> Severity: Notice --> Trying to get property of non-object C:\xampp\htdocs\siddharth_application\application\views\reportcashbook.php 230 +ERROR - 2017-12-21 14:49:13 --> Severity: Notice --> Undefined variable: cash C:\xampp\htdocs\siddharth_application\application\views\cashbookall.php 167 +ERROR - 2017-12-21 14:49:13 --> Severity: Notice --> Trying to get property of non-object C:\xampp\htdocs\siddharth_application\application\views\cashbookall.php 167 +ERROR - 2017-12-21 14:49:13 --> Severity: Notice --> Undefined variable: cash C:\xampp\htdocs\siddharth_application\application\views\cashbookall.php 167 +ERROR - 2017-12-21 14:49:13 --> Severity: Notice --> Trying to get property of non-object C:\xampp\htdocs\siddharth_application\application\views\cashbookall.php 167 +ERROR - 2017-12-21 14:49:13 --> Severity: Notice --> Undefined variable: cash C:\xampp\htdocs\siddharth_application\application\views\cashbookall.php 167 +ERROR - 2017-12-21 14:49:13 --> Severity: Notice --> Trying to get property of non-object C:\xampp\htdocs\siddharth_application\application\views\cashbookall.php 167 +ERROR - 2017-12-21 14:49:13 --> Severity: Notice --> Undefined variable: cash C:\xampp\htdocs\siddharth_application\application\views\cashbookall.php 167 +ERROR - 2017-12-21 14:49:13 --> Severity: Notice --> Trying to get property of non-object C:\xampp\htdocs\siddharth_application\application\views\cashbookall.php 167 +ERROR - 2017-12-21 14:49:29 --> Severity: Notice --> Undefined variable: cash C:\xampp\htdocs\siddharth_application\application\views\cashbookall.php 167 +ERROR - 2017-12-21 14:49:29 --> Severity: Notice --> Trying to get property of non-object C:\xampp\htdocs\siddharth_application\application\views\cashbookall.php 167 +ERROR - 2017-12-21 14:49:29 --> Severity: Notice --> Undefined variable: cash C:\xampp\htdocs\siddharth_application\application\views\cashbookall.php 167 +ERROR - 2017-12-21 14:49:29 --> Severity: Notice --> Trying to get property of non-object C:\xampp\htdocs\siddharth_application\application\views\cashbookall.php 167 diff --git a/application/models/dahsboard_model.php b/application/models/dahsboard_model.php index 371db0e0..df67fa36 100755 --- a/application/models/dahsboard_model.php +++ b/application/models/dahsboard_model.php @@ -1943,7 +1943,7 @@ if ($fa and $aa != ''){ $query = $this->db->query($sql); return $query->result(); } - + //home --this month// function monthexpensereport() { $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date, @@ -1968,31 +1968,22 @@ if ($fa and $aa != ''){ return $query->result(); } - - function yearexpensereport() - { - $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date, - ifnull(case - when tinc.type = 'PAYMENT' - then tinc.total - end,'0') as expense, - ifnull(case - when tinc.type = 'RECEIPT' - then tinc.total - end, '0') as income, - ifnull(case - when tinc.type = 'PAYMENT' - then tinc.towhom - end,'-') as paymentname, - ifnull(case - when tinc.type = 'RECEIPT' - then tinc.towhom - end, '-') as receiptname, - date_format(date,'%d-%m-%Y')as date,tinc.type,sum(tinc.total)as total,tinc.towhom,tinc.description,tinc.account_code,monthname(tinc.date)as month FROM t_income_expense tinc where year(date)= year(current_date()) group by month order by total desc limit 10 "; + //home--this year// + function yearexpensereport($fa,$aa) + { + $sql="select monthname(date) as month, + sum(if(type='PAYMENT',total,0)) as exp, + sum(if(type='RECEIPT',total,0)) as inc, + sum(total) as total + from t_income_expense + where date >= '".$fa."-04-01' and date <= '".$aa."-03-31' + group by month "; $query = $this->db->query($sql); return $query->result(); } + + //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"; @@ -2046,6 +2037,7 @@ if ($fa and $aa != ''){ return $query->result(); } + //yearwise/month// function yearmonthwise($sid='') { $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date, @@ -2099,6 +2091,22 @@ function INRSymbol() $query=$this->db->query($sql); return $query->result(); } + + function cashbookfinyear(){ + + + $sql="SELECT + CASE WHEN MONTH(date)>=4 THEN + concat(YEAR(date), '-',YEAR(date)+1) + ELSE concat(YEAR(date)-1,'-', YEAR(date)) END AS financial_year + FROM t_income_expense + GROUP BY financial_year"; + $query = $this->db->query($sql); + return $query->result(); + + + + } function today() { $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date, @@ -2128,7 +2136,7 @@ function INRSymbol() // $query = $this->db->query($sql); // return $query->result(); //} - //for menu link in monthly payments// + function monthlypayments() { $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date,tinc.type,tinc.total,tinc.towhom,.tinc.description, ac.name FROM t_income_expense tinc join t_accountcode ac on ac.code=tinc.account_code WHERE MONTH(date) = MONTH(curdate()) group by account_code"; @@ -2137,10 +2145,11 @@ function INRSymbol() return $query->result(); } - function departmentmenu($fdate,$tdate) + + //home page --Reports// + function departmentmenu($fdate,$tdate,$fa,$aa) { - $fdate= date("Y-m-d",strtotime($fdate)); - $tdate=date("Y-m-d",strtotime($tdate)); + $sql="SELECT date_format(tinc.date,'%d-%m-%Y')as date, ifnull(case when tinc.type = 'PAYMENT' @@ -2158,10 +2167,25 @@ function INRSymbol() when tinc.type = 'RECEIPT' then tinc.towhom end, '-') as receiptname, - tinc.total,tinc.towhom,tinc.description,tinc.type,tinc.account_code,ac.name FROM t_income_expense tinc join t_accountcode ac on ac.code=tinc.account_code where tinc.date >= '".$fdate."' and tinc.date <= '".$tdate."'"; + tinc.total,tinc.towhom,tinc.description,tinc.type,tinc.account_code,ac.name FROM t_income_expense tinc join t_accountcode ac on ac.code=tinc.account_code where tinc.date !=0 "; + if ($fdate and $tdate != ''){ + $fdate= date("Y-m-d",strtotime($fdate)); + $tdate=date("Y-m-d",strtotime($tdate)); + + $sql.="and date(tinc.date) >= '".$fdate."' + and date(tinc.date) <= '".$tdate."'"; + } + if ($fa and $aa != ''){ + + $sql.=" and (tinc.date >= '".$fa."-04-01' and tinc.date <= '".$aa."-03-31')"; + + } + + $query = $this->db->query($sql); //echo $fdate; //print_r($this->db->last_query()); + //echo $sql; return $query->result(); } diff --git a/application/views/cashbookall.php b/application/views/cashbookall.php index 3a87726f..cf0fcc58 100755 --- a/application/views/cashbookall.php +++ b/application/views/cashbookall.php @@ -19,9 +19,14 @@ if(!empty($depmenu)) { $inrsymbol = $inr->FontCode2000; }} + foreach($financialyear as $item) + + { + $finyear = $item->financial_year; + + } ?> -?>