diff --git a/application/controllers/cashbook.php b/application/controllers/cashbook.php index 73b5d2b6..8f835c59 100755 --- a/application/controllers/cashbook.php +++ b/application/controllers/cashbook.php @@ -313,12 +313,11 @@ class cashbook extends BaseController $narration = $sheet->getCell('D'.$x)->getValue(); $cod =$sheet->getCell('E'.$x)->getValue(); $debit =$sheet->getCell('F'.$x)->getValue(); - - $credit=$sheet->getCell('G'.$x)->getValue(); + $credit=$sheet->getCell('G'.$x)->getValue(); $balance=$sheet->getCell('H'.$x)->getValue(); // $IsActive=0; - $filedataupload= array('reportdate'=>$Date1,'valuedate'=>$Date2,'chequeNo'=>$cod,'Narration'=>$narration,'Cod'=> $chqno,'Debit'=>$debit,'Credit'=>$credit,'Balance'=>$balance,'Bankname'=>$bank,'IsActive'=> $IsActive); + $filedataupload= array('reportdate'=>$Date1,'valuedate'=>$Date2,'chequeNo'=>$cod,'Narration'=>$narration,'Cod'=> $chqno,'Debit'=>$debit,'Credit'=>$credit,'cbalancetocleared'=>$credit,'Balance'=>$balance,'Bankname'=>$bank,'IsActive'=> $IsActive); @@ -1008,36 +1007,13 @@ 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); - - // } - - - /*this function used to array merge files view*/ - function IGRFilelist() - { - $igrno= $this->input->post('igrno'); - $igrsingle = $this->cashbook_model->igrmastersingle($igrno); - $igrmultiple =$this->cashbook_model->igrmastermultiple($igrno); - $data = array_merge($igrsingle,$igrmultiple); - echo json_encode($data); - - - } - /*end*/ - - - public function filelist() + public function filelist() { - $igrno= $this->input->post('igrno'); - $data = $this->cashbook_model->debitimage($igrno); + $pono= $this->input->post('pono'); + $data = $this->cashbook_model->debitimage($pono); echo json_encode($data); - } + } public function mappingpo() { @@ -1521,14 +1497,16 @@ class cashbook extends BaseController $bankingbalclear = $this->input->post('bankingbalclear'); $totinvoiceamount = $this->input->post('totinvoiceamount'); $balancetoreceived = $this->input->post('balancetoreceived'); - $updatebalancetoclear=$amountreceived+$bankingbalclear; + if($amountreceived<0) { - $updateclearbalance=$bankingclear+$amountreceived; + $updatebalancetoclear=$amountreceived+$bankingbalclear; + $updateclearbalance=$amountreceived+$bankingclear; } else { - $updateclearbalance=$bankingclear-$amountreceived; + $updatebalancetoclear=$bankingbalclear+$amountreceived; + $updateclearbalance=$bankingclear+$amountreceived; } //update Isactive field in T_Bankreport ////// diff --git a/application/models/cashbook_model.php b/application/models/cashbook_model.php index 19cd1d0f..df930005 100755 --- a/application/models/cashbook_model.php +++ b/application/models/cashbook_model.php @@ -428,53 +428,15 @@ function receiptdata() return $query->result(); } - - - function igrmastersingle($igrno){ - $this->db->select('IGRNO,file,PONO as pono'); - $this->db->from('T_IGR_Master'); - $this->db->where('IGRNO',$igrno); - $query = $this->db->get(); - return $query->result(); - } - function igrmastermultiple($igrno){ - - $this->db->select('BillNo,IGRNO,FilePath,PONO'); - $this->db->from('T_Inwardgateregister_fileupload'); - $this->db->where('IGRNO',$igrno); - $query = $this->db->get(); - return $query->result(); - - } -// function debitpolist($bankid) -// { -// $this->db->select('bp.id,bp.mid,igrm.MaterialRcvdDate,bp.PONO,bp.Suppliername,bp.Totalpoamount,br.Debit, -// 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','left'); -// $this->db->join ('T_PurchaseOrder_BillUpload bu','bu.PONO = bp.PONO','left'); -// $this->db->join ('T_bankreport br','br.ID=bp.mid'); -// $this->db->where('bp.IsActive',1); -// $this->db->where('bp.mid',$bankid); -// // $this->db->where('igrde.BankStatus !=','ST072'); -// $this->db->group_by('bp.id'); -// $query = $this->db->get(); -// return $query->result(); - -// } - - function debitpolist($bankid) { $this->db->select('bp.id,bp.mid,igrm.MaterialRcvdDate,bp.PONO,bp.Suppliername,bp.Totalpoamount,br.Debit, - bp.Balancetopay,bp.Amountpaid,bp.IGRNO,bp.IGRLineItemNo,igrm.file,bu.FilePath,inward.FilePath as Fpath'); + 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','left'); $this->db->join ('T_PurchaseOrder_BillUpload bu','bu.PONO = bp.PONO','left'); - $this->db->join('T_Inwardgateregister_fileupload inward','inward.IGRNO =igrm.IGRNO','left'); $this->db->join ('T_bankreport br','br.ID=bp.mid'); - $this->db->where('bp.IsActive',1); $this->db->where('bp.mid',$bankid); // $this->db->where('igrde.BankStatus !=','ST072'); @@ -486,69 +448,29 @@ function debitpolist($bankid) //function for image - // 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','left'); - // $this->db->where('bp.PONO',$pono); - // $this->db->group_by('bu.BillNo'); - // $query = $this->db->get(); - // return $query->result(); - - // } - - function debitimage($igrno) + function debitimage($pono) { - $this->db->select('*'); - $this->db->from ('T_PurchaseOrder_BillUpload'); - $this->db->where('IGRNO',$igrno); - $query = $this->db->get(); - $result = $query->result(); - return $result; + $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','left'); + $this->db->where('bp.PONO',$pono); + $this->db->group_by('bu.BillNo'); + $query = $this->db->get(); + return $query->result(); } - // function debitpolistfilter($SupplierName,$fdate,$tdate) - // { - // $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'); - // $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_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','left'); - // if($fdate!='' && $tdate!='') - // { - // $this->db->where('bm.Podate BETWEEN "'. date('Y-m-d', strtotime($fdate)). '" and "'. date('Y-m-d', strtotime($tdate)).'"'); - // } - // if($SupplierName!='') - // { - // $this->db->where('sd.SupplierID',$SupplierName); - // } - - // $this->db->where('bm.IsActive',1); - // $this->db->group_by('bm.id'); - // $query = $this->db->get(); - // return $query->result(); - - // } - - - function debitpolistfilter($SupplierName,$fdate,$tdate) { $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,inward.FilePath as Fpath'); + bm.Balancetopay,bm.Amountpaid,bm.IGRNO,igrm.file,bm.IGRLineItemNo,br.Clearbalance,br.Balancetocleared,bu.FilePath,bu.BillNo'); $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_SupplierDetailsN sd','sd.SupplierName = bm.Suppliername'); - $this->db->join ('T_bankreport br','br.ID=bm.mid'); - $this->db->join('T_Inwardgateregister_fileupload inward','inward.IGRNO =igrm.IGRNO','left'); + $this->db->join ('T_bankreport br','br.ID=bm.mid'); $this->db->join ('T_PurchaseOrder_BillUpload bu','bm.PONO=bu.PONO','left'); if($fdate!='' && $tdate!='') { @@ -565,7 +487,7 @@ function debitpolist($bankid) return $query->result(); } - + function creditinvoicelist($bankid) { $this->db->select('bm.indate,bm.invoiceno,bm.customername,bm.totinvoiceamount,bm.bankid, diff --git a/application/views/bankinvoicesettlement.php b/application/views/bankinvoicesettlement.php index 768cf2f0..0b81b857 100644 --- a/application/views/bankinvoicesettlement.php +++ b/application/views/bankinvoicesettlement.php @@ -129,7 +129,7 @@ foreach($financialyear as $item)