From bf0eca549a57dd7b789dc0eef9c0adec1c0f97b0 Mon Sep 17 00:00:00 2001 From: gandhimathi Date: Tue, 8 May 2018 17:00:57 +0530 Subject: [PATCH] year filter desc --- application/controllers/cashbook.php | 14 +++++----- application/models/cashbook_model.php | 37 ++++++++++++++++++++++----- application/views/bankamountpaid.php | 2 +- application/views/bankstatement.php | 4 +-- 4 files changed, 42 insertions(+), 15 deletions(-) diff --git a/application/controllers/cashbook.php b/application/controllers/cashbook.php index c25a50ac..99995a15 100755 --- a/application/controllers/cashbook.php +++ b/application/controllers/cashbook.php @@ -766,15 +766,17 @@ class cashbook extends BaseController if ($this->input->post('btn_submit')) { $this->global['pageTitle'] = 'Siddharth : bankstatement'; - // $ab=$this->input->post('financialyear'); - // $fa=substr($ab,0,-5); - // $aa=substr($ab,5,5); - + $ab=$this->input->post('financialyear'); + + $fa=substr($ab,0,-5); + $aa=substr($ab,5,5); + + $fdate = $this->input->post('from_date'); $tdate = $this->input->post('to_date'); } - // $data['finyear']=$this->cashbook_model->report_finyear(); - $data['bankreport'] = $this->cashbook_model->bankstatement($fdate,$tdate); + $data['finyear']=$this->cashbook_model->report_finyear(); + $data['bankreport'] = $this->cashbook_model->bankstatement($fdate,$tdate,$fa,$aa); $this->loadViews("bankstatement", $this->global, $data,NULL); diff --git a/application/models/cashbook_model.php b/application/models/cashbook_model.php index 87073a56..25592b25 100755 --- a/application/models/cashbook_model.php +++ b/application/models/cashbook_model.php @@ -146,10 +146,37 @@ class cashbook_model extends CI_Model return $r; } } -function bankstatement($fdate,$tdate,$fa,$aa){ + + + +function report_finyear(){ + + $sql="SELECT +CASE WHEN MONTH(reportdate)>=4 THEN + concat(YEAR(reportdate), '-',YEAR(reportdate)+1) +ELSE concat(YEAR(reportdate)-1,'-', YEAR(reportdate)) END AS financial_year +FROM T_bankreport +GROUP BY financial_year"; + $query = $this->db->query($sql); + return $query->result(); + + + +} + +function bankstatement($fdate,$tdate,$fa,$aa){ + + - $sql="SELECT *,date_format(reportdate,'%d-%m-%Y')as date,tie.total,date_format(valuedate,'%d-%m-%Y')as valuedate from T_bankreport as br left join t_income_expense as tie on tie.bankid=br.ID where br.reportdate !=0 "; + $sql="SELECT *,date_format(reportdate,'%d-%m-%Y')as date,tie.total,date_format(valuedate,'%d-%m-%Y')as valuedate from T_bankreport as br left join t_income_expense as tie on tie.bankid=br.ID where br.reportdate !=0 "; + + + if ($fa and $aa != ''){ + + $sql.=" and (reportdate >= '".$fa."-04-01' and reportdate<= '".$aa."-03-31')"; + + } if ($fdate and $tdate != '') { @@ -163,11 +190,9 @@ function bankstatement($fdate,$tdate,$fa,$aa){ - $sql.=" group by(br.ID) "."ORDER BY br.ID+0 DESC "; - // $sql.=" ORDER BY br.ID+0 DESC "; - + $sql.=" group by(br.ID) "; + $sql.=" ORDER BY br.ID+0 DESC "; - $query = $this->db->query($sql); return $query->result(); diff --git a/application/views/bankamountpaid.php b/application/views/bankamountpaid.php index 58b42a88..b0536759 100644 --- a/application/views/bankamountpaid.php +++ b/application/views/bankamountpaid.php @@ -74,7 +74,7 @@ if(!empty($amountpaid))
-

Bankss Debit Amount Paid Reports

+

Banks Debit Amount Paid Reports

diff --git a/application/views/bankstatement.php b/application/views/bankstatement.php index 7143fe3c..589b076f 100644 --- a/application/views/bankstatement.php +++ b/application/views/bankstatement.php @@ -108,7 +108,7 @@