diff --git a/application/controllers/cashbook.php b/application/controllers/cashbook.php index 9aeab5c4..c25a50ac 100755 --- a/application/controllers/cashbook.php +++ b/application/controllers/cashbook.php @@ -382,6 +382,16 @@ class cashbook extends BaseController { $statu='OPEN'; } + $debitbalance=$totalbankamount-$total; + if($debitbalance==0) + + { + $statu1='CLOSE'; + } + else + { + $statu1='OPEN'; + } //$clearbalance=$totalbankamount- if($amounttype=='CREDIT') { @@ -392,7 +402,7 @@ class cashbook extends BaseController } else { - $cashbookstatus = array('Clearbalance'=>$total,'Status'=>$stat); + $cashbookstatus = array('Clearbalance'=>$total,'Status'=>$statu1); $res23 = $this->cashbook_model->cashbankupdate($cashbookstatus,$bankid); } @@ -750,20 +760,26 @@ class cashbook extends BaseController //} } - public function bankdata() - { - - - $this->global['pageTitle'] = 'Siddharth : bankstatement'; - - $fdate = $this->input->post('from_date'); - $tdate = $this->input->post('to_date'); - $data['bankreport'] = $this->cashbook_model->bankstatement($fdate,$tdate); - - - $this->loadViews("bankstatement", $this->global, $data,NULL); - - } + public function bankdata() + { + + 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); + + $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); + + + $this->loadViews("bankstatement", $this->global, $data,NULL); + + } public function bankdebitdata() { if ($this->input->post('btn_submit')) diff --git a/application/models/cashbook_model.php b/application/models/cashbook_model.php index 53abec2a..87073a56 100755 --- a/application/models/cashbook_model.php +++ b/application/models/cashbook_model.php @@ -146,23 +146,35 @@ class cashbook_model extends CI_Model return $r; } } - function bankstatement($fdate,$tdate){ +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 reportdate !=0 group by(br.ID)"; - if ($fdate and $tdate != ''){ - $fdate= date("Y-m-d",strtotime($fdate)); - $tdate=date("Y-m-d",strtotime($tdate)); - - $sql.="and date(reportdate) >= '".$fdate."' - and date(reportdate) <= '".$tdate."'"; - } - $query = $this->db->query($sql); - return $query->result(); - - - - } + + $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 ($fdate and $tdate != '') + { + + $fdate= date("Y-m-d",strtotime($fdate)); + $tdate=date("Y-m-d",strtotime($tdate)); + + $sql.= " and date(reportdate) >= '".$fdate."' + and date(reportdate) <= '".$tdate."'"; + } + + + + + $sql.=" group by(br.ID) "."ORDER BY br.ID+0 DESC "; + // $sql.=" ORDER BY br.ID+0 DESC "; + + + + + $query = $this->db->query($sql); + return $query->result(); + + + +} function debitbankstatemet($Supplierid,$fdate,$tdate) { @@ -351,9 +363,9 @@ function debitpolist($bankid) function mappingcash($SupplierName,$fdate,$tdate,$bankid) { - $this->db->select('date,bankid,cashtype,amounttype,total,account_code,totalbankamount'); - $this->db->from ('t_income_expense'); - //$this->db->join ('t_income_expense ie','ie.bankid = bmc.mid','left'); + $this->db->select('ie.date,ie.bankid,ie.cashtype,ie.amounttype,ie.total,ac.name,totalbankamount'); + $this->db->from ('t_income_expense as ie'); + $this->db->join ('t_accountcode ac ','ac.code = ie.account_code','left'); $this->db->where('bankid',$bankid); //$this->db->group_by('mid'); diff --git a/application/views/bankdebit.php b/application/views/bankdebit.php index a86f97d0..0596469e 100644 --- a/application/views/bankdebit.php +++ b/application/views/bankdebit.php @@ -131,10 +131,7 @@ value="View Report"> -