From 315bd034f947c8c5deebe5deb601b8d79984ecfb Mon Sep 17 00:00:00 2001 From: gayathri1990 Date: Wed, 4 Jul 2018 13:29:03 +0530 Subject: [PATCH] bankstatement --- application/config/routes.php | 1 + application/controllers/cashbook.php | 22 +- application/models/cashbook_model.php | 45 ++- application/views/bankamountpaid.php | 146 +++---- application/views/bankamountreceived.php | 7 +- application/views/bankdebit.php | 414 ++++++++++++-------- application/views/bankinvoicesettlement.php | 6 +- application/views/banksettlement.php | 170 ++++---- 8 files changed, 468 insertions(+), 343 deletions(-) diff --git a/application/config/routes.php b/application/config/routes.php index 184fb1c4..2b84208d 100755 --- a/application/config/routes.php +++ b/application/config/routes.php @@ -232,6 +232,7 @@ $route['Bankingstatement']= "cashbook/bankdata"; $route['Debitstatement']= "cashbook/bankdebitdata"; $route['Cashstatement']= "cashbook/cashreceipt"; $route['BankingFile']= "cashbook/bankfileupload"; +$route['Filelist']="cashbook/filelist"; //$route['Bankingrecord']= "cashbook/bankdata"; $route['Bankamountpaid']= "cashbook/amountpaid"; $route['Bankamountreceived']= "cashbook/amountreceived"; diff --git a/application/controllers/cashbook.php b/application/controllers/cashbook.php index 0f9b43c4..0ecac413 100755 --- a/application/controllers/cashbook.php +++ b/application/controllers/cashbook.php @@ -933,7 +933,14 @@ class cashbook extends BaseController $this->loadViews("bankinvoice", $this->global,$data,NULL); - } + } + public function filelist() + { + $pono= $this->input->post('pono'); + $data = $this->cashbook_model->debitimage($pono); + echo json_encode($data); + + } public function mappingpo() { @@ -949,12 +956,8 @@ class cashbook extends BaseController $data['balancetoclear'] =$_GET['balancetoclear']; $data['mappingcashbook']=$this->cashbook_model->mappingcash($SupplierName,$fdate,$tdate,$bankid); $data['mapping'] = $this->cashbook_model->debitpolist($bankid); - //print_r($data['mapping']); - //die(); - $data['mappingimage'] = $this->cashbook_model->debitimage($bankid); - //print_r( $data['mappingimage']);die(); - - $data['paidcbook'] = $this->cashbook_model->cashbookamount($bankid); + // $data['mappingimage'] = $this->cashbook_model->debitimage($bankid); + $data['paidcbook'] = $this->cashbook_model->cashbookamount($bankid); $data['paidpoamount'] = $this->cashbook_model->poamonut($bankid); $data['supplier'] = $this->cashbook_model->getsupplier(); $this->loadViews("banksettlement", $this->global,$data,NULL); @@ -1348,6 +1351,7 @@ class cashbook extends BaseController $updatebalancetoclear=$Amount+$balancetoclear; $data['$bankmappingamount'] = $this->cashbook_model->gettotalbankmappingpo($igrno); $amountpaid=$data['$bankmappingamount'][0]->Amountpaid; + //$data['$totallineitemamount']=$this->cashbook_model->gettotallineitem($igrno); if($amountpaid==$totalamount) @@ -1401,6 +1405,10 @@ class cashbook extends BaseController $receivedstatus=PARTIALLY_RECEIVED; } $IsActive=0; + // $data['$latestamount'] = $this->cashbook_model->getlatestamount($invoiceno); + //print_r($data['$latestamount']); + //die(); + $balancetoreceived=$data['$latestamount'][0]->balancetoreceived; $result1=$this->cashbook_model->UpdateIpinvoiceStatus($invoiceno,$receivedstatus); $result2= $this->cashbook_model->deletemappinginvoice($mappingid,$IsActive); $updatebalancetoreceived=$balancetoreceived+$amountreceived; diff --git a/application/models/cashbook_model.php b/application/models/cashbook_model.php index 2ff80d6f..8b43d265 100755 --- a/application/models/cashbook_model.php +++ b/application/models/cashbook_model.php @@ -369,17 +369,15 @@ function receiptdata() function debitpolist($bankid) { - $this->db->select('bp.id,bp.mid,bp.Podate,bp.PONO,bp.Suppliername,bp.Totalpoamount, - bp.Balancetopay,bp.Amountpaid,bp.IGRNO,bp.IGRLineItemNo,igrm.file'); + $this->db->select('bp.id,bp.mid,igrm.MaterialRcvdDate,bp.PONO,bp.Suppliername,bp.Totalpoamount, + bp.Balancetopay,bp.Amountpaid,bp.IGRNO,bp.IGRLineItemNo,igrm.file,bu.FilePath'); $this->db->from ('T_Bankmappingpo bp'); - $this->db->join ('T_IGR_Master igrm','bp.IGRNO = igrm.IGRNO'); - //$this->db->join ('T_IGR_Details igrde','igrde.IGRNO=igrm.IGRNO','left'); - - // $this->db->join ('T_PurchaseOrder_BillUpload bu','bu.PONO = bp.PONO','left'); + $this->db->join ('T_IGR_Master igrm','bp.IGRNO = igrm.IGRNO','left'); + $this->db->join ('T_PurchaseOrder_BillUpload bu','bu.PONO = bp.PONO'); $this->db->where('bp.IsActive',1); $this->db->where('bp.mid',$bankid); // $this->db->where('igrde.BankStatus !=','ST072'); - //$this->db->group_by('igrm.IGRNO'); + $this->db->group_by('bp.id'); $query = $this->db->get(); return $query->result(); @@ -387,11 +385,12 @@ function debitpolist($bankid) //function for image - function debitimage($bankid){ + function debitimage($pono) + { $this->db->select('bp.PONO,bp.mid,bu.FilePath,bu.BillNo,bu.IGRNO'); $this->db->from ('T_Bankmappingpo bp'); - $this->db->join ('T_PurchaseOrder_BillUpload bu','bp.PONO = bu.PONO'); - $this->db->where('bp.mid',$bankid); + $this->db->join ('T_PurchaseOrder_BillUpload bu','bp.PONO = bu.PONO','left'); + $this->db->where('bp.PONO',$pono); $this->db->group_by('bu.BillNo'); $query = $this->db->get(); return $query->result(); @@ -402,11 +401,11 @@ function debitpolist($bankid) function debitpolistfilter($SupplierName,$fdate,$tdate) { - $this->db->select('bm.id,bm.mid,bm.Podate,bm.PONO,bm.Suppliername,bm.Totalpoamount, - bm.Balancetopay,bm.Amountpaid,bm.IGRNO,igrm.file,igrde.IGRItemNo,br.Clearbalance,br.Balancetocleared,bu.FilePath,bu.BillNo,bu.IGRNO'); + $this->db->select('bm.id,bm.mid,igrm.MaterialRcvdDate,bm.PONO,bm.Suppliername,bm.Totalpoamount, + bm.Balancetopay,bm.Amountpaid,bm.IGRNO,igrm.file,bm.IGRLineItemNo,br.Clearbalance,br.Balancetocleared,bu.FilePath,bu.BillNo,bu.IGRNO'); $this->db->from ('T_Bankmappingpo bm'); $this->db->join ('T_IGR_Master igrm','igrm.IGRNO = bm.IGRNO'); - $this->db->join ('T_IGR_Details igrde','igrde.IGRNO=igrm.IGRNO'); + //$this->db->join ('T_IGR_Details igrde','igrde.IGRNO=igrm.IGRNO'); $this->db->join ('T_SupplierDetailsN sd','sd.SupplierName = bm.Suppliername'); $this->db->join ('T_bankreport br','br.ID=bm.mid'); $this->db->join ('T_PurchaseOrder_BillUpload bu','bm.PONO=bu.PONO'); @@ -420,7 +419,7 @@ function debitpolist($bankid) } $this->db->where('bm.IsActive',1);; - $this->db->group_by('PONO'); + $this->db->group_by('bm.IGRLineItemNo'); $query = $this->db->get(); return $query->result(); @@ -911,6 +910,24 @@ function debitpolist($bankid) $this->db->group_by('T_Bankmappingpo.IGRLineItemNo'); $query = $this->db->get(); return $query->result(); + } + function getlatestamount($mappingid,$invoiceno) + { + $this->db->select('min(balancetoreceived)as balancetoreceived'); + $this->db->from ('T_Bankmappingiv'); + $this->db->where('ID',$mappingid); + $this->db->where('invoiceno',$invoiceno); + $this->db->where('IsActive',1); + //$this->db->group_by('T_Bankmappingpo.IGRLineItemNo'); + $query = $this->db->get(); + return $query->result(); + } + function getlatest($invoiceno) + { + $sql="select ID,balancetoreceived from T_Bankmappingiv where invoiceno='$invoiceno' and + ID in(select max(ID) from T_Bankmappingiv group by invoiceno)"; + $query =$this->db->query($sql); + return $query->result(); } function deletecashbookdata($Bankid,$updatebankamount,$clearbalance) { diff --git a/application/views/bankamountpaid.php b/application/views/bankamountpaid.php index 9f1abe1e..4a142cd5 100644 --- a/application/views/bankamountpaid.php +++ b/application/views/bankamountpaid.php @@ -58,77 +58,37 @@ if(!empty($amountpaid))
-
-