From 3f69e01cdf17c70c44d0d6080f362a8b1a4b3182 Mon Sep 17 00:00:00 2001 From: gayathri1990 Date: Sat, 23 Jun 2018 18:13:12 +0530 Subject: [PATCH] bank statement bankreport --- application/config/routes.php | 1 + application/controllers/cashbook.php | 42 ++++++++++- application/models/cashbook_model.php | 26 ++++--- application/views/bankamountpaid.php | 80 ++++++++++++++++----- application/views/bankamountreceived.php | 68 +++++++++++++----- application/views/bankinvoicesettlement.php | 2 + 6 files changed, 172 insertions(+), 47 deletions(-) diff --git a/application/config/routes.php b/application/config/routes.php index e37f5697..184fb1c4 100755 --- a/application/config/routes.php +++ b/application/config/routes.php @@ -240,6 +240,7 @@ $route['Payment']= "cashbook/cashpayment"; $route['Invoice']= "cashbook/bankinvoice"; $route['Bankcash']= "cashbook/cashbanking"; $route['DeleteInvoice']="cashbook/deletemappingiv"; +$route['DeletePo']="cashbook/Deletemappingporeport"; $route['MappingInvoice']="cashbook/mappinginvoice"; $route['qualityreportlist'] = "quality/reportList"; $route['qualityreportlistinward'] = "quality/reportListInward"; diff --git a/application/controllers/cashbook.php b/application/controllers/cashbook.php index 79d830dd..7867050d 100755 --- a/application/controllers/cashbook.php +++ b/application/controllers/cashbook.php @@ -939,7 +939,7 @@ class cashbook extends BaseController { - $this->global['pageTitle'] = 'Siddharth : Cashbook Listing'; + $this->global['pageTitle'] = 'Siddharth : Bank Report - Debited Settlements'; $SupplierName = $this->input->post('SupplierName'); $fdate = $this->input->post('from_date'); @@ -1298,6 +1298,44 @@ class cashbook extends BaseController $this->loadViews("bankcashnew", $this->global,$data,NULL); } + public function Deletemappingporeport() + { + $totalamount =$this->input->post('Totalpoamount'); + + $Amount = $this->input->post('paidamount'); + + $igrno = $this->input->post('igrno'); + $Bankid = $this->input->post('bankid'); + $balancetoclear=$this->input->post('balancetobankingclear'); + $clearedbalance=$this->input->post('clearbalance'); + $updateamount=$clearedbalance-$Amount; + $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) + { + $BankStatus=NO_PAIDIGR; + } + else + { + $BankStatus=PARTIALLY_PAIDIGR; + } + + $result= $this->cashbook_model->IgrDetailsStatusUpdate($igrno,$BankStatus); + $result1= $this->cashbook_model->deletemapping($Bankid,$updateamount,$updatebalancetoclear); + //for update mapping amount in t_bankmappingpo table// + $balancetopay=$this->input->post('balancetopay'); + $totalbalancetopay=$Amount+$balancetopay; + //$updateamount=0; + $IsActive=0; + $result2= $this->cashbook_model->deleteBankmappingpo($igrno,$Bankid,$IsActive); + //for update mapping amount inT_Bankporeport table// + //die(); + $result3= $this->cashbook_model->updateBankporeportpo($igrno,$totalbalancetopay,$updateamount,$Bankid); + $this->loadViews("bankstatement", $this->global,$data, NULL); + } public function Deletemappingpo() { $totalamount = $_GET['Totalpoamount']; @@ -1353,7 +1391,7 @@ class cashbook extends BaseController $updateclearbalance=$bankingclear-$amountreceived; $bankstatement=array('cbalancetocleared'=>$updatebalancetoclear,'cclearbalance'=>$updateclearbalance); $result1= $this->cashbook_model->updatebankreportiv($bankid,$bankstatement); - print_r($result1); + //print_r($result1); //die(); $IsActive=0; $result2= $this->cashbook_model->deletemappinginvoice($bankid,$invoiceno,$IsActive); diff --git a/application/models/cashbook_model.php b/application/models/cashbook_model.php index ea4a492d..0b008ff7 100755 --- a/application/models/cashbook_model.php +++ b/application/models/cashbook_model.php @@ -387,6 +387,7 @@ function debitpolist($bankid) $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->where('IsActive',1); $this->db->where('mid',$bankid); $this->db->where('igrde.BankStatus !=','ST072'); //$this->db->group_by('PONO'); @@ -398,9 +399,12 @@ function debitpolist($bankid) function debitpolistfilter($SupplierName,$fdate,$tdate) { $this->db->select('bm.mid,bm.Podate,bm.PONO,bm.Suppliername,bm.Totalpoamount, - bm.Balancetopay,bm.Amountpaid'); + bm.Balancetopay,bm.Amountpaid,bm.IGRNO,igrm.file,igrde.IGRItemNo,br.Clearbalance,br.Balancetocleared'); $this->db->from ('T_Bankmappingpo bm'); - $this->db->join ('T_SupplierDetailsN sd','sd.SupplierName = bm.Suppliername','left'); + $this->db->join ('T_IGR_Master igrm','igrm.IGRNO = bm.IGRNO','left'); + $this->db->join ('T_IGR_Details igrde','igrde.IGRNO=igrm.IGRNO','left'); + $this->db->join ('T_SupplierDetailsN sd','sd.SupplierName = bm.Suppliername','left'); + $this->db->join ('T_bankreport br','br.ID=bm.mid'); if($fdate!='' && $tdate!='') { $this->db->where('bm.Podate BETWEEN "'. date('Y-m-d', strtotime($fdate)). '" and "'. date('Y-m-d', strtotime($tdate)).'"'); @@ -409,6 +413,7 @@ function debitpolist($bankid) { $this->db->where('sd.SupplierID',$SupplierName); } + // $this->db->where('mid',$bankid); $this->db->group_by('PONO'); $query = $this->db->get(); @@ -430,10 +435,12 @@ function debitpolist($bankid) } function creditinvoicelistfilter($Customer,$fdate,$tdate) { - $this->db->select('bm.indate,bm.invoiceno,bm.customername,bm.totinvoiceamount,bm.bankid, - bm.balancetoreceived,bm.amountreceived'); + $this->db->select('bm.ID,bm.indate,bm.invoiceno,bm.customername,bm.totinvoiceamount,bm.bankid, + bm.balancetoreceived,bm.amountreceived,br.cclearbalance,br.cbalancetocleared'); $this->db->from ('T_Bankmappingiv bm'); + $this->db->where('bm.IsActive',1); $this->db->join ('ip_clients ic','ic.client_name = bm.customername','left'); + $this->db->join('T_bankreport br','br.ID = bm.bankid'); if($fdate!='' && $tdate!='') { $this->db->where('bm.indate BETWEEN "'. date('Y-m-d', strtotime($fdate)). '" and "'. date('Y-m-d', strtotime($tdate)).'"'); @@ -443,6 +450,7 @@ function debitpolist($bankid) $this->db->where('ic.client_id',$Customer); } //$this->db->group_by('invoiceno'); + $query = $this->db->get(); return $query->result(); @@ -461,15 +469,16 @@ function debitpolist($bankid) } //for cashbook edit screen and update bankreport// function poamonut($bankid) - { - $this->db->select('sum(Amountpaid)as amountpaid'); + { + $this->db->select('sum(Amountpaid)as amountpaid'); $this->db->from ('T_Bankmappingpo'); $this->db->where('mid',$bankid); + $this->db->where('IsActive',1); //$this->db->group_by('invoiceno'); $query = $this->db->get(); return $query->result(); - } + } function cashbookamount($bankid) { $this->db->select('sum(total)as total'); @@ -523,7 +532,8 @@ function debitpolist($bankid) $this->db->select('bmp.bankid,bmp.invoiceno,bmp.amountreceived,br.Narration'); $this->db->from ('T_Bankmappingiv as bmp'); $this->db->join('T_bankreport br','br.ID = bmp.bankid'); - $this->db->where('invoiceno',$invno); + $this->db->where('invoiceno',$invno); + $this->db->where('bmp.IsActive',1); //$this->db->group_by('invoiceno'); $query = $this->db->get(); return $query->result(); diff --git a/application/views/bankamountpaid.php b/application/views/bankamountpaid.php index aadc2907..9c8e1f08 100644 --- a/application/views/bankamountpaid.php +++ b/application/views/bankamountpaid.php @@ -58,6 +58,7 @@ if(!empty($amountpaid))
+
@@ -129,11 +130,14 @@ if(!empty($amountpaid)) Date PONO + IGR NO + IGRItemNo Supplier Name Total PO Amount (₹) Balance To Pay (₹) Amount Paid (₹) + Action @@ -152,21 +156,22 @@ if(!empty($amountpaid)) - + + + - - - Podate); - $Podate = $dt->format('d-m-Y'); echo $Podate ?> - + Podate?> PONO?> - + IGRNO?> + IGRItemNo?> Suppliername?> - Totalpoamount?> - Balancetopay?> - Amountpaid?> - + Totalpoamount?> + Balancetopay?> + Amountpaid?> + +     + @@ -186,7 +191,9 @@ if(!empty($amountpaid))
-
+ + + @@ -199,17 +206,52 @@ if(!empty($amountpaid)) - - - -