bankstatement edit option

This commit is contained in:
gayathri1990 2018-06-21 13:51:43 +05:30
parent b0852aeaa1
commit 04447482aa
8 changed files with 527 additions and 139 deletions

View File

@ -140,6 +140,9 @@ define('PARTIALLY_PAID', 'ST059');
define('AMOUNT_RECEIVED', 'ST065');
define('NO_RECEIVED', 'ST066');
define('PARTIALLY_RECEIVED', 'ST067');
define('AMOUNT_PAIDIGR', 'ST070');
define('PARTIALLY_PAIDIGR', 'ST071');
define('NO_PAIDIGR', 'ST072');
/* Work status code */
define('SERVICE_COMPLETED', 'ST046');

View File

@ -239,6 +239,8 @@ $route['Receipt']= "cashbook/cashreceipt";
$route['Payment']= "cashbook/cashpayment";
$route['Invoice']= "cashbook/bankinvoice";
$route['Bankcash']= "cashbook/cashbanking";
$route['DeleteInvoice']="cashbook/deletemappingiv";
$route['MappingInvoice']="cashbook/mappinginvoice";
$route['qualityreportlist'] = "quality/reportList";
$route['qualityreportlistinward'] = "quality/reportListInward";
//<-------------Store page----------------->

View File

@ -441,8 +441,9 @@ class cashbook extends BaseController
$option=Cash;
}
$balance=$totalbankamount-$totalamount;
$IsActive=1;
$created_by = $this->session->userdata('userId');
$addincomexpense = array('type'=>$accounttype,'account_code'=>$accountcode,'date'=>$date,'towhom'=>$towhome,'Supplier_id'=>$supplier,'invoice_no'=>$invoiceno,'merchant'=>$merchantname,'merchant_gst'=>$mergstno,'HSN'=>$hsn ,'value_before_gst'=>$beforegst,'sgst'=>$sgst,'cgst'=>$cgst,'igst'=>$igst,'total'=>$totalamount,'description'=>$description,'document'=>$document,'Created_By'=>$created_by,'cashtype'=>$option,'bankid'=>$bankid,'totalbankamount'=>$totalbankamount,'balance'=>$balance,'gststatus'=>(!empty($gsttoggle)?'1':'0'),'amounttype'=>$amounttype);
$addincomexpense = array('type'=>$accounttype,'account_code'=>$accountcode,'date'=>$date,'towhom'=>$towhome,'Supplier_id'=>$supplier,'invoice_no'=>$invoiceno,'merchant'=>$merchantname,'merchant_gst'=>$mergstno,'HSN'=>$hsn ,'value_before_gst'=>$beforegst,'sgst'=>$sgst,'cgst'=>$cgst,'igst'=>$igst,'total'=>$totalamount,'description'=>$description,'document'=>$document,'Created_By'=>$created_by,'cashtype'=>$option,'bankid'=>$bankid,'totalbankamount'=>$totalbankamount,'balance'=>$balance,'gststatus'=>(!empty($gsttoggle)?'1':'0'),'amounttype'=>$amounttype,'IsActive'=>$IsActive);
//print_r($addincomexpense);
//die();
if($balance=='0')
@ -495,11 +496,11 @@ class cashbook extends BaseController
//echo "<script>alert('Saved Successfully!');window.location.href='ViewIncomeExpense';</script>";
echo "<script>alert('Saved Successfully!');</script>";
if($amounttype == '')//Redirct To Listing Screen
if($amounttype == ' ')//Redirct To Listing Screen
{
redirect('ViewIncomeExpense','refresh');
}
else if($amounttype != '')//Redirct To Bank Report Screen
else if($amounttype != ' ')//Redirct To Bank Report Screen
{
redirect('Bankingstatement','refresh');
}
@ -534,7 +535,7 @@ class cashbook extends BaseController
$bankcash1 = array('cdate'=>$bankdate,'mid'=>$bankid,'btype'=>$type,'amount'=>$alreadypaid,'boption'=>$option,'mappingamount'=>$forstatus,'totalamount'=>$amount,'amounttype'=>$bankamounttype,'alreadycreditpaid'=>$alreadycreditpaid);
//print_r($bankcash1);
//die();
$res1 = $this->cashbook_model->addcashbook($bankcash1);
// $res1 = $this->cashbook_model->addcashbook($bankcash1);
}
@ -938,12 +939,14 @@ class cashbook extends BaseController
{
// $this->global['pageTitle'] = 'Siddharth : Cashbook Listing';
$this->global['pageTitle'] = 'Siddharth : Bank Report - Debited Settlements';
$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');
$tdate = $this->input->post('to_date');
$bankid= $_GET['d'];
$data['clearbalance']= $_GET['clearbalance'];
$data['balancetoclear'] =$_GET['balancetoclear'];
$data['mappingcashbook']=$this->cashbook_model->mappingcash($SupplierName,$fdate,$tdate,$bankid);
$data['mapping'] = $this->cashbook_model->debitpolist($bankid);
$data['paidcbook'] = $this->cashbook_model->cashbookamount($bankid);
@ -962,11 +965,14 @@ class cashbook extends BaseController
$fdate = $this->input->post('from_date');
$tdate = $this->input->post('to_date');
$bankid= $_GET['d'];
$data['clearbalance']=$_GET['cb'];
$data['balancetoclear']=$_GET['btc'];
$data['mappingcashbook']=$this->cashbook_model->mappingcash($SupplierName,$fdate,$tdate,$bankid);
$data['mappingiv'] = $this->cashbook_model->creditinvoicelist($bankid);
$data['paidcbook'] = $this->cashbook_model->cashbookamount($bankid);
$data['invoiceramount'] = $this->cashbook_model->invoiceamonut($bankid);
$data['invoiceramount'] = $this->cashbook_model->invoiceamonut($bankid);
$data['supplier'] = $this->cashbook_model->getsupplier();
//redirect('Bankingstatement','refresh');
$this->loadViews("bankinvoicesettlement", $this->global,$data,NULL);
}
@ -1001,17 +1007,15 @@ class cashbook extends BaseController
public function receipt()
{
// die();
$this->global['pageTitle'] = 'Siddharth : Bank Report - Store Debited Details';
$check = $this->input->post('check');
$rw = $this->input->post('rw');
//$this->global['pageTitle'] = 'Siddharth : Cashbook Listing';
$this->global['pageTitle'] = 'Siddharth : Bank Report - Store Debited Details';
$date = $this->input->post('podate');
$date = date_create($date);//,'Y-m-d');
$date = $this->input->post('podate');
$date = date_create($date);
$date = date_format($date,'Y-m-d');
//echo $date;
$pono = $this->input->post('pono');
$pono = $this->input->post('pono');
$igrno=$this->input->post('igrno');
$igrlineitem=$this->input->post('igrlineitem');
$sname = $this->input->post('sname');
$tot = $this->input->post('tot');
$rowcount = $this->input->post('rc');
@ -1076,13 +1080,13 @@ class cashbook extends BaseController
$amtpaid= ($ip+$ePay);
$IsActive=1;
$podata1 = array('Podate'=>$date,'PONO'=>$pono,'Suppliername'=>$sname,'Totalpoamount'=>$tot,'Amountpaid'=>$ip,'Balancetopay'=>$balancetopay,'mid'=>$bankid);
$podata1 = array('Podate'=>$date,'PONO'=>$pono,'IGRNO'=>$igrno,'Suppliername'=>$sname,'Totalpoamount'=>$tot,'Amountpaid'=>$ip,'Balancetopay'=>$balancetopay,'mid'=>$bankid,'IGRLineItemNo'=>$igrlineitem,'IsActive'=>$IsActive);
//print_r($podata1);
//die();
$podata = array('Podate'=>$date,'PONO'=>$pono,'Suppliername'=>$sname,'Totalpoamount'=>$tot,'Amountpaid'=>$amtpaid,'Balancetopay'=>$balancetopay,'mid'=>$bankid);
$podata = array('Podate'=>$date,'PONO'=>$pono,'IGRNO'=>$igrno,'Suppliername'=>$sname,'Totalpoamount'=>$tot,'Amountpaid'=>$amtpaid,'Balancetopay'=>$balancetopay,'mid'=>$bankid,'IGRLineItemNo'=>$igrlineitem);
//die();
$result3 = $this->cashbook_model->getpono($pono);
@ -1104,18 +1108,29 @@ class cashbook extends BaseController
echo "Saved Successfully!";
}
if($balancetopay==0)
{
$status=AMOUNT_PAID;
// if($balancetopay==0)
// {
// $status=AMOUNT_PAID;
// }
// else
// {
// $status=PARTIALLY_PAID;
// }
// $pomaster= array('Paymentstatus'=>$status);
if($balancetopay==0)
{
$igrstatus=AMOUNT_PAIDIGR;
}
else
{
$status=PARTIALLY_PAID;
$igrstatus=PARTIALLY_PAIDIGR;
}
$pomaster= array('Paymentstatus'=>$status);
$result1 = $this->cashbook_model->poamountstatus($pomaster,$pono);
//$this->loadViews("bankstatement", $this->global,$data, NULL);
$igrdetails=array('BankStatus'=>$igrstatus);
$result1 = $this->cashbook_model->igrdetailstatus($igrdetails,$igrlineitem);
//$result1 = $this->cashbook_model->poamountstatus($pomaster,$pono);
$this->loadViews("bankstatement", $this->global,$data, NULL);
}
public function invoiceamount1()
{
@ -1196,10 +1211,10 @@ class cashbook extends BaseController
$amtpaid= ($ip+$eRec);
$updateamount=($totalpaidamount+$eRec);
$IsActive=1;
$invoicedata1 = array('indate'=>$date,'invoiceno'=>$invid,'customername'=>$cname,'totinvoiceamount'=>$invamount,'balancetoreceived'=>$balancetoreceived1,'amountreceived'=>$amtpaid,'bankid'=>$bankid);
$invoicedata = array('indate'=>$date,'invoiceno'=>$invid,'customername'=>$cname,'totinvoiceamount'=>$invamount,'balancetoreceived'=>$balancetoreceived1,'amountreceived'=>$ip,'bankid'=>$bankid);
$invoicedata = array('indate'=>$date,'invoiceno'=>$invid,'customername'=>$cname,'totinvoiceamount'=>$invamount,'balancetoreceived'=>$balancetoreceived1,'amountreceived'=>$ip,'bankid'=>$bankid,'IsActive'=>$IsActive);
// //print_r ($invoicedata);
// //die();
@ -1209,7 +1224,7 @@ class cashbook extends BaseController
if(count($result3)<=0)
{
//echo "insert";
$result = $this->cashbook_model->invoicedata($invoicedata);
$result = $this->cashbook_model->invoicedata($invoicedata1);
}
else
@ -1228,8 +1243,7 @@ class cashbook extends BaseController
$status=PARTIALLY_RECEIVED;
}
$invoicemaster= array('receivedstatus'=>$status);
print_r($invoicemaster);
//die();
$result1 = $this->cashbook_model->invoiceamountstatus($invoicemaster,$invid);
echo "<script>alert('Saved Successfully!');window.location.href='Bankingstatement';</script>";
@ -1250,12 +1264,11 @@ class cashbook extends BaseController
$data['bankdebit'] = $this->cashbook_model->debitpolistfilter($SupplierName,$fdate,$tdate);
}
$data['amountpaid'] = $this->cashbook_model->paided();
$data['amountpaid'] = $this->cashbook_model->paided();
$data['supplier'] = $this->cashbook_model->getsupplier();
$this->loadViews("bankamountpaid", $this->global,$data, NULL);
$this->loadViews("bankamountpaid", $this->global,$data, NULL);
}
public function amountreceived()
{
@ -1279,13 +1292,125 @@ class cashbook extends BaseController
public function cashbanking()
{
$data['dropdownvalues'] = $this->cashbook_model->getAccounTypes();
$data['cashbanking'] = $this->cashbook_model->newcashbook();
//$data['cashbanking'] = $this->cashbook_model->newcashbook();
$data['getsupplier'] = $this->cashbook_model->getsupplier();
$this->global['pageTitle'] ='Siddharth :bankcashbook';
$this->loadViews("bankcashnew", $this->global,$data,NULL);
}
}
public function Deletemappingpo()
{
$totalamount = $_GET['Totalpoamount'];
$Bankid = $_GET['bankid'];
$Amount = $_GET['amount'];
$igrno = $_GET['igrno'];
$balancetoclear=$_GET['balancetoclear'];
$bankamount=$_GET['bankamount'];
$updateamount=$bankamount-$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=$_GET['balancetopay'];
$totalbalancetopay=$Amount + $balancetopay;
//$updateamount=0;
$IsActive=0;
$result2= $this->cashbook_model->deleteBankmappingpo($igrno,$Bankid,$IsActive);
//for update mapping amount inT_Bankporeport table//
$result3= $this->cashbook_model->updateBankporeportpo($igrno,$totalbalancetopay,$updateamount,$Bankid);
if(count($result2)>0)
{
redirect('Bankingstatement','refresh');
}
}
public function deletemappingiv()
{
$this->global['pageTitle'] = 'Siddharth : Bank Report - Delete Mapping Invoice';
$invoiceno = $this->input->post('invoiceno');
$bankid = $this->input->post('bankid');
$amountreceived = $this->input->post('amountreceived');
$bankingclear = $this->input->post('bankingclear');
$bankingbalclear = $this->input->post('bankingbalclear');
$totinvoiceamount = $this->input->post('totinvoiceamount');
$balancetoreceived = $this->input->post('balancetoreceived');
$updatebalancetoclear=$amountreceived+$bankingbalclear;
$updateclearbalance=$bankingclear-$amountreceived;
$bankstatement=array('cbalancetocleared'=>$updatebalancetoclear,'cclearbalance'=>$updateclearbalance);
$result1= $this->cashbook_model->updatebankreportiv($bankid,$bankstatement);
print_r($result1);
//die();
$IsActive=0;
$result2= $this->cashbook_model->deletemappinginvoice($bankid,$invoiceno,$IsActive);
$updatebalancetoreceived=$balancetoreceived+$amountreceived;
$updateamountreceived=$totinvoiceamount-$updatebalancetoreceived;
$result3= $this->cashbook_model->updatebankinvoicereport($invoiceno,$bankid,$updatebalancetoreceived,$updateamountreceived);
$this->loadViews("bankstatement", $this->global,$data, NULL);
// if(count($result2)>0)
// {
// redirect('Bankingstatement','refresh');
// }
}
public function Deletemappingcashbook()
{
$bankamount=$_GET['bankamount'];
$Bankid = $_GET['bankid'];
$Amount = $_GET['amount'];
$accountname = $_GET['accountname'];
$IsActive=0;
$balancetoclear=$_GET['balancetoclear'];
$clearbalance =$bankamount-$Amount;
$updatebankamount= $Amount+$balancetoclear;
$data['$accountcode'] = $this->cashbook_model->getaccountcode($accountname);
$accountcode=$data['$accountcode'][0]->code;
$result=$this->cashbook_model->deletecashbookdata($Bankid,$updatebankamount,$clearbalance,$IsActive);
$result1=$this->cashbook_model->StatusUpadateCashbook($Bankid,$accountcode,$IsActive);
if(count($result1)>0)
{
redirect('Bankingstatement','refresh');
}
}
public function Deletemappingcashbookcredit()
{
$bankamount=$_GET['bankamount'];
$Bankid = $_GET['bankid'];
$Amount = $_GET['amount'];
$accountname = $_GET['accountname'];
$IsActive=0;
$balancetoclear=$_GET['balancetoclear'];
$clearbalance =$_GET['clearbalance'];
$updateclearbalance=$clearbalance-$Amount;
$updatebalancetoclear=$balancetoclear+$Amount;
$data['$accountcode'] = $this->cashbook_model->getaccountcode($accountname);
$accountcode=$data['$accountcode'][0]->code;
$result=$this->cashbook_model->deletecashbookdatacredit($Bankid,$updateclearbalance,$updatebalancetoclear);
$result1=$this->cashbook_model->StatusUpadateCashbook($Bankid,$accountcode,$IsActive);
if(count($result1)>0)
{
// $this->loadViews("Bankingstatement", $this->global,$result1, NULL);
//echo "<script>alert('Deleted Successfully!');window.location.href='Bankingstatement';</script>";
redirect('Bankingstatement','refresh');
}
}
public function convertNumber($amt){
//echo $amt;die();

View File

@ -291,19 +291,20 @@ function clearedbalance(){
//die();
//$Supplierid;
$this->db->distinct();
$this->db->select('POM.PONO,POM.Paymentstatus,supp.SupplierName,igr.CreatedDate,
POM.TotalOrderValue,POM.ServiceDescription,BR.Balancetopay,BR.Amountpaid,
POM.POType,POM.ReleasedBy,POM.IsQualityChkReqired,POM.POType,POM.CapitalRange,POM.Status,
PUADV.AdvanceAmount');
$this->db->from ('T_PurchaseOrder_Master POM');
$this->db->join('T_IGR_Master igr','igr.PONO = POM.PONO');
$this->db->join('T_SupplierDetailsN supp','supp.SupplierID = POM.SupplierID');
$this->db->join('T_PurchaseOrder_AdvanceRequest PUADV','POM.PONO=PUADV.PONO','left');
$this->db->join ('T_Bankporeport BR','BR.PONO = POM.PONO','left');
$this->db->select('igr.PONO,supp.SupplierName,igrli.CreatedDate,igrli.IGRItemNo,igr.IGRNO,BR.Balancetopay,BR.Amountpaid,pom.Status,poli.ReceivedQuantity,poli.Rate');
$this->db->from ('T_IGR_Details igrli');
$this->db->join('T_IGR_Master igr','igrli.IGRNO = igr.IGRNO');
$this->db->join('T_PurchaseOrder_Master pom','igr.PONO =pom.PONO');
$this->db->join('T_PurchaseOrder_LineItem poli','pom.PONO= poli.PONO');
$this->db->join('T_SupplierDetailsN supp','pom.SupplierID =supp.SupplierID');
$this->db->join ('T_Bankporeport BR','pom.PONO = BR.PONO','left');
// $this->db->where_in('POM.Status',[ST044,ST056]);
// $this->db->where('POM.Paymentstatus !=','ST057');
// $sql='select distinct T_IGR_Master.PONO,T_IGR_Details.IGRNO,T_PurchaseOrder_LineItem.Quantity,T_PurchaseOrder_LineItem.Rate,T_SupplierDetailsN.SupplierName from T_IGR_Master
// INNER JOIN T_IGR_Details ON T_IGR_Details.IGRNO=T_IGR_Master.IGRNO
// INNER JOIN T_PurchaseOrder_Master ON T_PurchaseOrder_Master.PONO=T_IGR_Master.PONO
// INNER JOIN T_SupplierDetailsN ON T_SupplierDetailsN.SupplierID = T_PurchaseOrder_Master.SupplierID
// INNER JOIN T_PurchaseOrder_LineItem ON T_PurchaseOrder_LineItem.PONO=T_IGR_Master.PONO ';
if ($fdate and $tdate != ''){
$fromdate= date("Y-m-d",strtotime($fdate));
@ -315,9 +316,11 @@ function clearedbalance(){
if ($Supplierid != ''){
$this->db->where('supp.SupplierID',$Supplierid);
}
$this->db->where_in('POM.Status',[ST044,ST056]);
$this->db->group_by('POM.PONO');
$this->db->where_in('pom.Status',[ST044,ST056]);
$this->db->where('igrli.BankStatus !=','ST070');
//$this->db->group_by('pom.PONO');
//$this->db->group_by('igrli.IGRItemNo');
//$this->db->group_by('igr.IGRNO');
$query = $this->db->get();
return $query->result();
@ -378,10 +381,14 @@ function receiptdata()
function debitpolist($bankid)
{
$this->db->select('bp.mid,bp.Podate,bp.PONO,bp.Suppliername,bp.Totalpoamount,
bp.Balancetopay,bp.Amountpaid,bu.FilePath');
bp.Balancetopay,bp.Amountpaid,bp.IGRNO,igrm.file,igrde.IGRItemNo');
$this->db->from ('T_Bankmappingpo bp');
$this->db->join ('T_PurchaseOrder_BillUpload bu','bu.PONO = bp.PONO','left');
$this->db->join ('T_IGR_Master igrm','igrm.IGRNO = bp.IGRNO','left');
$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('mid',$bankid);
$this->db->where('igrde.BankStatus !=','ST072');
//$this->db->group_by('PONO');
$query = $this->db->get();
return $query->result();
@ -412,9 +419,10 @@ function debitpolist($bankid)
function creditinvoicelist($bankid)
{
$this->db->select('indate,invoiceno,customername,totinvoiceamount,bankid,
balancetoreceived,amountreceived');
balancetoreceived,amountreceived');
$this->db->from ('T_Bankmappingiv');
$this->db->where('bankid',$bankid);
$this->db->where('IsActive',1);
//$this->db->group_by('invoiceno');
$query = $this->db->get();
return $query->result();
@ -445,6 +453,7 @@ function debitpolist($bankid)
$this->db->select('sum(amountreceived)as amountreceived');
$this->db->from ('T_Bankmappingiv');
$this->db->where('bankid',$bankid);
$this->db->where('IsActive',1);
//$this->db->group_by('invoiceno');
$query = $this->db->get();
return $query->result();
@ -466,6 +475,7 @@ function debitpolist($bankid)
$this->db->select('sum(total)as total');
$this->db->from ('t_income_expense');
$this->db->where('bankid',$bankid);
$this->db->where('IsActive',1);
//$this->db->group_by('invoiceno');
$query = $this->db->get();
return $query->result();
@ -478,7 +488,7 @@ function debitpolist($bankid)
$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->where('IsActive',1);
//$this->db->group_by('mid');
$query = $this->db->get();
return $query->result();
@ -742,12 +752,12 @@ function debitpolist($bankid)
return $result;
}
function poamountstatus($pomaster,$pono)
function igrdetailstatus($igrdetails,$igrlineitem)
{
//echo $pomaster;
//echo $pono;
$this->db->where('PONO', $pono);
$this->db->update('T_PurchaseOrder_Master',$pomaster);
$this->db->where('IGRItemNo', $igrlineitem);
$this->db->update('T_IGR_Details',$igrdetails);
$r = $this->db->affected_rows();
return $r;
@ -805,6 +815,115 @@ function debitpolist($bankid)
}
}
function deletemapping($Bankid,$updateamount,$updatebalancetoclear)
{
$this->db->set('Clearbalance',$updateamount);
$this->db->set('Balancetocleared',$updatebalancetoclear);
$this->db->where('ID',$Bankid);
$this->db->update('T_bankreport');
$r = $this->db->affected_rows();
return $r;
}
function updatebankreportiv($bankid,$bankstatement)
{
$this->db->where('ID',$bankid);
$this->db->update('T_bankreport',$bankstatement);
$r = $this->db->affected_rows();
return $r;
}
function IgrDetailsStatusUpdate($igrno,$BankStatus)
{
$this->db->set('BankStatus',$BankStatus);
$this->db->where('IGRItemNo',$igrno);
$this->db->update('T_IGR_Details');
$r = $this->db->affected_rows();
return $r;
}
function deleteBankmappingpo($igrno,$Bankid,$IsActive)
{
$this->db->set('IsActive',$IsActive);
$this->db->where('IGRLineItemNo',$igrno);
$this->db->where('mid',$Bankid);
$this->db->update('T_Bankmappingpo');
$r = $this->db->affected_rows();
return $r;
}
function deletemappinginvoice($bankid,$invoiceno,$IsActive)
{ $this->db->set('IsActive',$IsActive);
$this->db->where('invoiceno',$invoiceno);
$this->db->where('bankid',$bankid);
$this->db->update('T_Bankmappingiv');
$r = $this->db->affected_rows();
return $r;
}
function updateBankporeportpo($igrno,$totalbalancetopay,$updateamount,$Bankid)
{
$this->db->set('Balancetopay',$totalbalancetopay);
$this->db->set('Amountpaid',$updateamount);
$this->db->where('IGRLineItemNo',$igrno);
$this->db->where('mid',$Bankid);
$this->db->update('T_Bankporeport');
$r = $this->db->affected_rows();
return $r;
}
function updatebankinvoicereport($invoiceno,$bankid,$updatebalancetoreceived,$updateamountreceived)
{
$this->db->set('balancetoreceived',$updatebalancetoreceived);
$this->db->set('amountreceived',$updateamountreceived);
$this->db->where('invoiceno',$invoiceno);
$this->db->where('bankid',$bankid);
$this->db->update('T_Bankinvoicereport');
$r = $this->db->affected_rows();
return $r;
}
function gettotalbankmappingpo($igrno)
{
$this->db->select('sum(Amountpaid)as Amountpaid');
$this->db->from ('T_Bankmappingpo');
$this->db->where('IGRLineItemNo',$igrno);
$this->db->where('IsActive',1);
$this->db->group_by('T_Bankmappingpo.IGRLineItemNo');
$query = $this->db->get();
return $query->result();
}
function deletecashbookdata($Bankid,$updatebankamount,$clearbalance)
{
$this->db->set('Clearbalance',$clearbalance);
$this->db->set('Balancetocleared',$updatebankamount);
$this->db->where('ID',$Bankid);
$this->db->update('T_bankreport');
$r = $this->db->affected_rows();
return $r;
}
function deletecashbookdatacredit($Bankid,$updateclearbalance,$updatebalancetoclear)
{
$this->db->set('cclearbalance',$updateclearbalance);
$this->db->set('cbalancetocleared',$updatebalancetoclear);
$this->db->where('ID',$Bankid);
$this->db->update('T_bankreport');
$r = $this->db->affected_rows();
return $r;
}
function getaccountcode($accountname)
{
$this->db->select('code');
$this->db->from ('t_accountcode');
$this->db->where('name',$accountname);
$query = $this->db->get();
return $query->result();
}
function StatusUpadateCashbook($Bankid,$accountcode,$IsActive)
{
$this->db->set('IsActive',$IsActive);
$this->db->where('bankid',$Bankid);
$this->db->where('account_code',$accountcode);
$this->db->update('t_income_expense');
$r = $this->db->affected_rows();
return $r;
}
}

View File

@ -155,14 +155,16 @@ foreach($financialyear as $item)
<th>Select</th>
<th>Date</th>
<th>PONO</th>
<th>IGRNO</th>
<th>IGR Item No</th>
<th>Supplier Name</th>
<th>Total PO Amount (&#8377;)</th>
<th>IGR Amount (&#8377;)</th>
<th>Balance payable (&#8377;)</th>
<th>Amount Paid (&#8377;)</th>
</tr>
</thead>
<tbody>
<?php
<?php
$i=1;
$ti=0.00;
$tvt=0.00;
@ -172,6 +174,9 @@ foreach($financialyear as $item)
$status=$t->Paymentstatus;
$balancetopay=$t->Balancetopay;
$ReceivedQuantity=$t->ReceivedQuantity;
$rate=$t->Rate;
$value=$ReceivedQuantity*$rate;
if($status !='ST057')
{
?>
@ -180,9 +185,11 @@ foreach($financialyear as $item)
<td data-name="sell"><input type="checkbox" class="checkboxcheckbox" onchange="GetPayment(<?php echo $i ?>) "id="checkboxcheckbox<?php echo $i ?>" name="checkbox<?php echo $i ?>";></td>
<td align="left" id="date<?php echo $i ?>"><span><?php echo date_format(date_create($t->CreatedDate),'d-m-Y');?></span></td>
<td align="left" id="pono<?php echo $i ?>"><a href="<?= base_url() ?>cashbook/mappingdebit?sid=<?php echo $t->PONO;?>"><span><?php echo $t->PONO?></span></a></td>
<td align="left" id="igrno<?php echo $i ?>"><a href="<?= base_url() ?>cashbook/mappingdebit?sid=<?php echo $t->IGRNO;?>"><span><?php echo $t->IGRNO?></span></a></td>
<td align="left" id="igrlineitem<?php echo $i ?>" ><span><?php echo $t->IGRItemNo?></span></td>
<td align="left" id="sn<?php echo $i ?>" ><span><?php echo $t->SupplierName?></span></td>
<td align="left" id="tov<?php echo $i ?>" ><span><?php echo $t->TotalOrderValue?></span></td>
<td align="left" id="qw<?php echo $i ?>" ><span><?php echo ($t->TotalOrderValue-$t->Amountpaid)?></span></td>
<td align="left" id="tov<?php echo $i ?>" ><span><?php echo $value?></span></td>
<td align="left" id="qw<?php echo $i ?>" ><span><?php echo ($value-$t->Amountpaid)?></span></td>
<td data-name="sel"><input type="text" onkeypress="return isNumberKey(event)" onchange="GetAmount(<?php echo $i ?>)" id="invoicepaymet<?php echo $i ?>"></td>
</tr>
@ -200,6 +207,8 @@ foreach($financialyear as $item)
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td class="amount">
<strong><input type="text" id="addvalue" name="addvalue">
</strong>
@ -222,6 +231,10 @@ foreach($financialyear as $item)
<div class="col-md-12" id="HideDateDiv"></div>
<div class="col-md-12" id="HidePONODiv"></div>
<div class="col-md-12" id="HideIGRDiv"></div>
<div class="col-md-12" id="HideIGRLineItem"></div>
<div class="col-md-12" id="HideSuppDiv"></div>
@ -326,7 +339,8 @@ function GetPayment(i)
$('#Rowid').val(row);
var date= document.getElementById ( "date"+i ).innerText;//value taken from table, col name : date
var pono =document.getElementById ( "pono"+i ).innerText;//value taken from table, col name : purchase order no
var igrno =document.getElementById ( "igrno"+i ).innerText;
var igrlineitem=document.getElementById ( "igrlineitem"+i ).innerText;
var supname =document.getElementById ("sn"+i ).innerText;//value taken from table col name : suppliername
var totalordervalue =document.getElementById ("tov"+i ).innerText;//value taken from table col name : total po amount
var invoicepayment =document.getElementById ( "qw"+i ).innerText;//value taken from table col name : Balance to pay
@ -346,6 +360,20 @@ function GetPayment(i)
id:'hidepono'+i,
value:pono
}).appendTo('#HidePONODiv');
$('<input>').attr({
type:'hidden',
name:'hideigrno'+i,
id:'hideigrno'+i,
value:igrno
}).appendTo('#HideIGRDiv');
$('<input>').attr({
type:'hidden',
name:'hideigrline'+i,
id:'hideigrline'+i,
value:igrlineitem
}).appendTo('#HideIGRLineItem');
$('<input>').attr({
type:'hidden',
@ -425,6 +453,8 @@ else
$('#invoicepaymet'+i).val('');
$('#hidedate'+i).val('');
$('#hidepono'+i).val('');
$('#hideigrno'+i).val('');
$('#hideigrline'+i).val('');
$('#hidesupname'+i).val('');
$('#hidettlPoamt'+i).val('');
$('#hideamtpaid'+i).val('');
@ -432,6 +462,8 @@ else
//$('#invoicepaymet'+i).remove();
$('#hidedate'+i).remove();
$('#hidepono'+i).remove();
$('#hideigrno'+i).remove();
$('#hideigrline'+i).remove();
$('#hidesupname'+i).remove();
$('#hidettlPoamt'+i).remove();
$('#hideamtpaid'+i).remove();
@ -472,6 +504,8 @@ function GetAmount(i)
var date= document.getElementById ( "date"+i ).innerText;
var pono =document.getElementById ( "pono"+i ).innerText;
var igr =document.getElementById ( "igrno"+i ).innerText;
var igrlineitem=document.getElementById ( "igrlineitem"+i ).innerText;
var supname =document.getElementById ("sn"+i ).innerText;
var totalordervalue =document.getElementById ("tov"+i ).innerText;
var balancetopay =document.getElementById ( "qw"+i ).innerText;
@ -568,6 +602,10 @@ function Save()
var pono =$('#hidepono'+number).val();
var igrno =$('#hideigrno'+number).val();
var igrlineitem =$('#hideigrline'+number).val();
var suppliername=$('#hidesupname'+number).val();
var totalordervalue=$('#hidettlPoamt'+number).val();
@ -588,7 +626,7 @@ function Save()
$.ajax(
{
data:{podate:date,pono:pono,sname:suppliername,tot:totalordervalue,aa:amountpaid,ip:invoicepaymet,rc:rowCount,tpv:totalvalue,bda:bankdebitamount,bi:bid,check:check,rw:rw},
data:{podate:date,pono:pono,igrno:igrno,igrlineitem:igrlineitem,sname:suppliername,tot:totalordervalue,aa:amountpaid,ip:invoicepaymet,rc:rowCount,tpv:totalvalue,bda:bankdebitamount,bi:bid,check:check,rw:rw},
type:"POST",
url:"<?php echo base_url() ?>cashbook/receipt",
success:function(data)

View File

@ -51,45 +51,61 @@ foreach($financialyear as $item)
<div class="box box-info">
<?php
if(!empty($mappingiv)){
foreach($mappingiv as $ap)
{
$bankid=$ap->id;
}
}
if(!empty($mappingcashbook))
{
foreach($mappingcashbook as $mc)
{
$bankid=$mc->bankid;
}
}
if(!empty($paidcbook)){
if(!empty($mappingiv)){
foreach($mappingiv as $ap)
{
$bankid=$ap->id;
}
}
if(!empty($mappingcashbook))
{
foreach($mappingcashbook as $mc)
{
$bankid=$mc->bankid;
}
}
if(!empty($paidcbook)){
foreach($paidcbook as $pc)
{
$pcamount=$pc->total;
}
}
foreach($paidcbook as $pc)
{
$pcamount=$pc->total;
}
}
if(!empty($invoiceramount))
{
foreach($invoiceramount as $ia)
{
$inamount=$ia->amountreceived;
if(!empty($clearbalance)){
$bankclear=$clearbalance;
}
}
$totalamount=$pcamount+$inamount;
?>
}
if(!empty($balancetoclear)){
$bankbaltoclear=$balancetoclear;
}
if(!empty($invoiceramount))
{
foreach($invoiceramount as $ia)
{
$inamount=$ia->amountreceived;
}
}
$totalamount=$pcamount+$inamount;
//echo $totalamount;
?>
<form method="post" action="<?php echo base_url($this->uri->uri_string()); ?>">
<center><h3 class="box-title"><p style="color:#3c8dbc"><b>Bank Credit Amount Paid Report</b></p></h3></center>
<br>
@ -127,12 +143,13 @@ foreach($financialyear as $item)
<table class="table table-bordered table-hover" id="req" style="table-layout:auto;">
<thead>
<tr>
<th>Date</th>
<th>INVOICE NO</th>
<th>Customer Name</th>
<th>Total Amount (&#8377;)</th>
<th>Balance To Received</th>
<th>Received Amount</th>
<th>Date</th>
<th>INVOICE NO</th>
<th>Customer Name</th>
<th>Total Amount (&#8377;)</th>
<th>Balance To Received</th>
<th>Received Amount</th>
<th>Action</th>
@ -148,15 +165,31 @@ foreach($financialyear as $item)
{
?>
<tr>
<input type="hidden" name="bankingbalclear" id="bankingbalclear" value="<?php echo $bankbaltoclear; ?>"/>
<input type="hidden" name="bankingclear" id="bankingclear" value="<?php echo $bankclear; ?>"/>
<input type="hidden" name="bankingid" id="bankingid" value="<?php echo $ap->bankid; ?>"/>
<td align="left" id="tov"><span><?php echo date_format(date_create($ap->indate),'d-m-Y');?></span></td>
<td align="left" id="invno"><?php echo $ap->invoiceno?></span></td>
<td align="left" id="aa"><span><?php echo $ap->customername?></span></td>
<td align="left" id="totinvoiceamount"><span><?php echo $ap->totinvoiceamount?></span></td>
<td align="left" id="balancetoreceived"><span><?php echo $ap->balancetoreceived?></span></td>
<td align="left" id="amountreceived"><span><?php echo $ap->amountreceived?></span></td>
<td>
<a data-toggle="tooltip" ><i class="fa fa-trash" data-toggle="tooltip" title="<?php echo $record->AdjustmentId; ?> - Click here to Delete details" onclick="invoice()"></i>&nbsp;&nbsp;&nbsp;</a>
</td>
<td align="left" id="tov"><span><?php echo date_format(date_create($ap->indate),'d-m-Y');?></span></td>
<td align="left" id="invno"><span><?php echo $ap->invoiceno?></span></td>
<td align="left" id="aa"><span><?php echo $ap->customername?></span></td>
<td align="left" id="aa"><span><?php echo $ap->totinvoiceamount?></span></td>
<td align="left" id="aa"><span><?php echo $ap->balancetoreceived?></span></td>
<td align="left" id="aa"><span><?php echo $ap->amountreceived?></span></td>
</tr>
</tr>
<?php
$i++;
}
@ -173,12 +206,13 @@ foreach($financialyear as $item)
<tr>
<th>Date</th>
<th>Account Name</th>
<th>Bankid</th>
<th>Amount Type</th>
<th>Total Amount (&#8377;)</th>
<th>Option (&#8377;)</th>
<th>Account Name</th>
<th>Bankid</th>
<th>Amount Type</th>
<th>Total Amount (&#8377;)</th>
<!--<th>Advance PO Amount (&#8377;)</th>-->
<th>Option (&#8377;)</th>
<th>Action</th>
</tr>
</thead>
@ -192,16 +226,25 @@ foreach($financialyear as $item)
foreach($mappingcashbook as $mc)
{
?>
<tr>
<td align="left" id="date"><span><?php echo $mc->date?></span></td>
<td align="left" id="date"><span><?php echo $mc->name?></span></td>
<td align="left" id="sn"><span><?php echo $mc->bankid?></span></td>
<td align="left" id="tov"><span><?php echo $mc->amounttype?></span></td>
<td align="left" id="aa"><span><?php echo $mc->total?></span></td>
<td align="left" id="aa"><span><?php echo $mc->cashtype?></span></td>
<tr>
<td align="left" id="date"><span><?php echo $mc->date?></span></td>
<td align="left" id="date"><span><?php echo $mc->name?></span></td>
<!--<td align="left" id="pono"><a href="<?= base_url() ?>cashbook/receipt?sid=<?php echo $ap->PONO;?>"><span><?php echo $ap->PONO?></span></a></td>-->
<!--<td align="left"><a href="<?= base_url() ?>cashbook/bankreceipt?sid=<?php echo $t->PONO;?>"><span><?php echo $t->PONO?></span></a></td>-->
<td align="left" id="bankid"><span><?php echo $mc->bankid?></span></td>
<td align="left" id="tov"><span><?php echo $mc->amounttype?></span></td>
<td align="left" id="aa"><span><?php echo $mc->total?></span></td>
<td align="left" id="aa"><span><?php echo $mc->cashtype?></span></td>
<td>
<a data-toggle="tooltip" href="<?php echo base_url().'cashbook/Deletemappingcashbookcredit?bankid='.$mc->bankid; ?>&amount=<?php echo $mc->total?>&balancetoclear=<?php echo $balancetoclear?>&clearbalance=<?php echo $bankclear?>&accountname=<?php echo $mc->name?>&amounttype=<?php echo $mc->amounttype?>"><i class="fa fa-trash" data-toggle="tooltip" title="<?php echo $record->AdjustmentId; ?> - Click here to Delete details"></i>&nbsp;&nbsp;&nbsp;</a>
</td>
</tr>
<?php
@ -233,6 +276,39 @@ foreach($financialyear as $item)
<script src="https://cdn.datatables.net/buttons/1.4.2/js/buttons.colVis.min.js"></script>
<script>
function invoice()
{
$('#content').loader('show');
var totinvoiceamount=$('#totinvoiceamount').text();
var balancetoreceived=$('#balancetoreceived').text();
var invoiceno=$('#invno').text();
var bankid=$('#bankingid').val();
var amountreceived=$('#amountreceived').text();
var bankingclear=$('#bankingclear').val();
var bankingbalclear=$('#bankingbalclear').val();
$.ajax(
{
data:{invoiceno:invoiceno,bankid:bankid,amountreceived:amountreceived,bankingclear:bankingclear,bankingbalclear:bankingbalclear,totinvoiceamount:totinvoiceamount,balancetoreceived:balancetoreceived},
type:"POST",
url:"<?php echo base_url() ?>DeleteInvoice",
success:function(data)
{
if(data)
{
window.location.href ="Bankingstatement";
//location.reload();
}
}
});
}
$(document).ready(function() {
table = $('#req').DataTable( {
"dom": "<'row'<'col-md-6'l><'col-md-6'Bf>>" +

View File

@ -66,7 +66,18 @@ if(!empty($mapping))
<!-- /.box-header -->
<?php
//for update bank amount//
if(!empty($clearbalance)){
$bankamount=$clearbalance;
}
if(!empty($balancetoclear))
{
$balancetoclear=$balancetoclear;
}
if(!empty($mappingcashbook)){
foreach($mappingcashbook as $mc)
@ -202,12 +213,15 @@ if(!empty($mapping))
<th>Date</th>
<th>PONO</th>
<th>IGR NO</th>
<th>IGR Item NO</th>
<th>Supplier Name</th>
<th>Total PO Amount (&#8377;)</th>
<!--<th>Advance PO Amount (&#8377;)</th>-->
<th>Balance To Pay (&#8377;)</th>
<th>Amount Paid (&#8377;)</th>
<th>File</th>
<th>Action</th>
</tr>
@ -229,6 +243,8 @@ if(!empty($mapping))
<td align="left" id="date"><span><?php echo date_format(date_create($ap->Podate),'d-m-Y');?></span></td>
<td align="left" id="pono"><a href="<?= base_url() ?>cashbook/mappingdebit?sid=<?php echo $ap->PONO;?>"><span><?php echo $ap->PONO?></span></a></td>
<td align="left" id="igrno"><a href="<?= base_url() ?>cashbook/mappingdebit?sid=<?php echo $ap->IGRNO;?>"><span><?php echo $ap->IGRNO?></span></a></td>
<td align="left" id="sn"><span><?php echo $ap->IGRItemNo?></span></td>
<!--<td align="left"><a href="<?= base_url() ?>cashbook/bankreceipt?sid=<?php echo $t->PONO;?>"><span><?php echo $t->PONO?></span></a></td>-->
<!--<a target="_blank" href="<?php echo base_url().'uploads/BillFiles/'?><?php echo $rel->file ?>"-->
<td align="left" id="sn"><span><?php echo $ap->Suppliername?></span></td>
@ -249,11 +265,14 @@ if(!empty($mapping))
?>
<td> <a target="_blank" href="<?php echo base_url().'uploads/BillFiles/'?><?php echo $ap->FilePath ?>"><i class="fa fa-download" ></i></a></td>
<?php
}
?>
<td>
<a data-toggle="tooltip" href="<?php echo base_url().'cashbook/Deletemappingpo?bankid='.$ap->mid; ?>&amount=<?php echo $ap->Amountpaid?>&bankamount=<?php echo $bankamount?>&balancetoclear=<?php echo$balancetoclear?>&igrno=<?php echo $ap->IGRItemNo?>&balancetopay=<?php echo $ap->Balancetopay?>&totalpoamount=<?php echo $ap->Totalpoamount?>"><i class="fa fa-trash" data-toggle="tooltip" title="<?php echo $record->AdjustmentId; ?> - Click here to Delete details"></i>&nbsp;&nbsp;&nbsp;</a>
</td>
@ -314,6 +333,7 @@ if(!empty($mapping))
<th>Total Amount (&#8377;)</th>
<!--<th>Advance PO Amount (&#8377;)</th>-->
<th>Option (&#8377;)</th>
<th>Action</th>
@ -346,7 +366,9 @@ if(!empty($mapping))
<td align="left" id="tov"><span><?php echo $mc->amounttype?></span></td>
<td align="left" id="aa"><span><?php echo $mc->total?></span></td>
<td align="left" id="aa"><span><?php echo $mc->cashtype?></span></td>
<td>
<a data-toggle="tooltip" href="<?php echo base_url().'cashbook/Deletemappingcashbook?bankid='.$mc->bankid; ?>&amount=<?php echo $mc->total?>&balancetoclear=<?php echo $balancetoclear?>&bankamount=<?php echo $bankamount?>&accountname=<?php echo $mc->name?>&amounttype=<?php echo $mc->amounttype?>"><i class="fa fa-trash" data-toggle="tooltip" title="<?php echo $record->AdjustmentId; ?> - Click here to Delete details"></i>&nbsp;&nbsp;&nbsp;</a>
</td>

View File

@ -300,7 +300,7 @@ $Bankname = $t->Bankname;
$clearbalance=$t->Clearbalance;
?>
<td align="left" id="totalpaid<?php echo $i?>"><a href="<?php echo base_url() ?>cashbook/mappingpo?d=<?php echo $t->ID?>"><?php echo $clearbalance?></a></td>
<td align="left" id="totalpaid<?php echo $i?>"><a href="<?php echo base_url() ?>cashbook/mappingpo?d=<?php echo $t->ID?>&clearbalance=<?php echo $clearbalance;?>&balancetoclear=<?php echo $t->Debit-$clearbalance;?>"><span><?php echo $clearbalance?></a></span></td>
<?php
if($status=='CLOSE')
@ -312,10 +312,11 @@ $Bankname = $t->Bankname;
}
else
{
?>
<td align="left" id="btc<?php echo $i ?>"><span><?php echo $t->Debit-$clearbalance?></span></td>
?>
<td align="left" id="btc<?php echo $i ?>"><?php echo $t->Debit-$clearbalance?></span></td>
<?php
}
?>
@ -331,10 +332,12 @@ $Bankname = $t->Bankname;
<?php
$clearbalance=$t->cclearbalance;
$credit=$t->Credit;
$balanctoclear=$credit-$clearbalance;
?>
<td align="left" id="credit2<?php echo $i ?>"><a href="<?php echo base_url() ?>cashbook/mappinginvoice?d=<?php echo $t->ID?>"><?php echo $clearbalance?></a></td>
<td align="left" id="credit2<?php echo $i ?>"><a href="<?php echo base_url() ?>MappingInvoice?d=<?php echo $t->ID?>&cb=<?php echo $clearbalance?>&btc=<?php echo $balanctoclear?>"><span><?php echo $clearbalance?></a></span></td>
<td align="left" id="credited<?php echo $i ?>"><span><?php echo ($t->Credit)-($t->cclearbalance);?></span></td>