diff --git a/application/controllers/cashbook.php b/application/controllers/cashbook.php index e92612bd..74d092ff 100644 --- a/application/controllers/cashbook.php +++ b/application/controllers/cashbook.php @@ -1077,10 +1077,14 @@ class cashbook extends BaseController $bankid= $_GET['d']; $data['clearbalance']=$_GET['cb']; $data['balancetoclear']=$_GET['btc']; + $data['mappingiv'] = $this->cashbook_model->creditinvoicelist($bankid); + //print_r($data['mappingiv']); + $data['invoiceramount'] = $this->cashbook_model->invoiceamonut($bankid); $data['mappingcashbook']=$this->cashbook_model->mappingcashcreditbankid($bankid); $data['paidcbook'] = $this->cashbook_model->cashbookamount($bankid); - $data['mappingiv'] = $this->cashbook_model->creditinvoicelist($bankid); - $data['invoiceramount'] = $this->cashbook_model->invoiceamonut($bankid); + + + $data['supplier'] = $this->cashbook_model->getsupplier(); //redirect('Bankingstatement','refresh'); $this->loadViews("bankinvoicesettlement", $this->global,$data,NULL); @@ -1281,6 +1285,7 @@ class cashbook extends BaseController { $arec = $ar->cclearbalance; } + } if($check == 1) @@ -1318,6 +1323,23 @@ class cashbook extends BaseController $earlyreceived = 0; //echo $earlypaid; $earlyreceived = $this->cashbook_model->getearlyamountcredit($invid); + $earlyreceivedmappingiv = $this->cashbook_model->getearlymappingiv($invid);//new change + + if(empty($earlyreceivedmappingiv)) + { + $eRec1=0; + } + else + { + + foreach($earlyreceived as $ar) + { + $eRec1 = $ar->amountreceived; + } + $updatenew=($invamount-($eRec1+$invoicetext)); + } + // echo $earlyreceivedmappingiv; + // die(); if(empty($earlyreceived)) { $eRec=0; @@ -1338,7 +1360,7 @@ class cashbook extends BaseController $IsActive=1; $invoicedata1 = array('indate'=>$date,'invoiceno'=>$invid,'customername'=>$cname,'customerid'=>$cid,'totinvoiceamount'=>$invamount,'balancetoreceived'=>$balancetoreceived1,'amountreceived'=>$amtpaid,'bankid'=>$bankid,'IsActive'=>$IsActive); - $invoicedata = array('indate'=>$date,'invoiceno'=>$invid,'customername'=>$cname,'customerid'=>$cid,'totinvoiceamount'=>$invamount,'balancetoreceived'=>$balancetoreceived1,'amountreceived'=>$ip,'bankid'=>$bankid,'IsActive'=>$IsActive); + $invoicedata = array('indate'=>$date,'invoiceno'=>$invid,'customername'=>$cname,'customerid'=>$cid,'totinvoiceamount'=>$invamount,'balancetoreceived'=>$updatenew,'amountreceived'=>$ip,'bankid'=>$bankid,'IsActive'=>$IsActive); // //print_r ($invoicedata); // //die(); @@ -1496,7 +1518,7 @@ class cashbook extends BaseController $data['m']=$m; $data['fdate']=$fdate; $data['tdate']=$tdate; - $data['bankmappingcash'] = $this->cashbook_model->mappingcashreceivedfilter($accountcode,$fa,$aa,$m,$fdate,$tdate); + $data['bankmappingcashreceived'] = $this->cashbook_model->mappingcashreceivedfilter($accountcode,$fa,$aa,$m,$fdate,$tdate); } else @@ -1515,7 +1537,7 @@ class cashbook extends BaseController $data['m']=$m; $data['fdate']=$fdate; $data['tdate']=$tdate; - $data['bankmappingcash'] = $this->cashbook_model->mappingcashreceived($accountcode,$fa,$aa,$m,$fdate,$tdate); + $data['bankmappingcashreceived'] = $this->cashbook_model->mappingcashreceived($accountcode,$fa,$aa,$m,$fdate,$tdate); } $data['finyear']=$this->cashbook_model->report_cashbook(); $this->loadViews("banksettlementcredit", $this->global,$data, NULL); @@ -1965,6 +1987,10 @@ class cashbook extends BaseController { $result1=$this->cashbook_model->UpdateIpinvoiceStatus($invoiceno,$receivedstatus); $result2= $this->cashbook_model->deletemappinginvoice($mappingid,$IsActive); + // if(count($result2)>0) + // { + // $result4= $this->cashbook_model->updatemappinginvoice($invoiceno,$amountreceived); + // } } $this->loadViews("bankstatement", $this->global,$data, NULL); diff --git a/application/models/cashbook_model.php b/application/models/cashbook_model.php index 35906c79..182a82db 100644 --- a/application/models/cashbook_model.php +++ b/application/models/cashbook_model.php @@ -1131,6 +1131,7 @@ function receiptdata() // $this->db->where('igrde.BankStatus !=','ST072'); $this->db->group_by('bp.id'); $query = $this->db->get(); + return $query->result(); } @@ -1138,14 +1139,20 @@ function receiptdata() function creditinvoicelist($bankid) { + $this->db->select('bm.indate,bm.invoiceno,bm.customername,bm.totinvoiceamount,bm.bankid, - bm.balancetoreceived,bm.amountreceived,bm.ID,br.Credit,br.cclearbalance,br.cbalancetocleared'); + bm.balancetoreceived,bm.amountreceived,bm.ID,br.Credit,br.cclearbalance,br.cbalancetocleared'); $this->db->from ('T_Bankmappingiv bm'); $this->db->join('T_bankreport br','br.ID=bm.bankid'); - $this->db->where('bm.bankid',$bankid); + $this->db->where('bm.bankid',(int)$bankid); $this->db->where('bm.IsActive',1); + $this->db->group_by('bm.ID'); //$this->db->group_by('invoiceno'); $query = $this->db->get(); + // $str = $this->db->last_query(); + // print_r($str); + + //print_r($query); return $query->result(); } @@ -1320,12 +1327,13 @@ function receiptdata() } function mappingcashreceived($accountcode,$fdate,$tdate,$fa,$aa,$m) { - $this->db->select('ie.date,ie.bankid,ie.cashtype,ie.amounttype,ie.total,ac.name,totalbankamount,ie.id'); + $this->db->select('ie.date,ie.bankid,ie.cashtype,ie.amounttype,ie.total,ac.name,totalbankamount,ie.id,sd.SupplierName'); $this->db->from ('t_income_expense as ie'); $this->db->join ('t_accountcode ac ','ac.code = ie.account_code','left'); + $this->db->join ('T_SupplierDetailsN sd ','sd.SupplierID = ie.Supplier_id','left'); $this->db->where('ie.account_code',$accountcode); $this->db->where('ie.amounttype','CREDIT'); - $this->db->where('IsActive',1); + $this->db->where('ie.IsActive',1); if ($fa and $aa != ''){ //$sql.=" and (im.CreatedDate >= '".$fa."-04-01' and im.CreatedDate <= '".$aa."-03-31')"; @@ -1618,6 +1626,17 @@ function receiptdata() // print_r( $this->db->last_query()); return $query->result(); + } + public function getearlymappingiv($invid) + { + $this->db->select('sum(amountreceived) as amountreceived'); + $this->db->from('T_Bankmappingiv'); + $this->db->where('invoiceno',$invid); + $this->db->where('IsActive',1); + $query = $this->db->get(); + // print_r( $this->db->last_query()); + return $query->result(); + } public function getalreadypaid($bankid) { @@ -1689,7 +1708,7 @@ function receiptdata() and date(bm.Podate) <= '".$todate."'"; $this->db->where($date); } - //$this->db->group_by('bm.IGRLineItemNo'); + $this->db->group_by('bm.IGRLineItemNo'); $query = $this->db->get(); return $query->result(); @@ -1990,7 +2009,7 @@ function receiptdata() $this->db->join ('T_Bankinvoicereport BI',' iv.invoice_number =BI.invoiceno','left'); $this->db->where('iv.receivedstatus','ST066'); $this->db->where('iv.invoice_status_id','2'); - $this->db->where('bm.IsActive',1); + // $this->db->where('bm.customername',$Customer); if ($fa and $aa != ''){ @@ -2134,6 +2153,17 @@ function receiptdata() $r = $this->db->affected_rows(); return $r; } + // function updatemappinginvoice($invoiceno,$amountreceived) + // { + // $this->db->set('balancetoreceived',$amountreceived+'balancetoreceived'); + // $this->db->where('invoiceno',$invoiceno); + // $this->db->where('IsActive',1); + // $this->db->update('T_Bankmappingiv'); + // $query = $this->db->get(); + // print_r(this->db->last_query()); + // $r = $this->db->affected_rows(); + // return $r; + // } function updateBankporeportpo($igrno,$totalbalancetopay,$updatebankpoamount,$Bankid,$IsActive) { $this->db->set('Balancetopay',$totalbalancetopay); diff --git a/application/views/bankdebit.php b/application/views/bankdebit.php index 871ce673..c48ae5f0 100644 --- a/application/views/bankdebit.php +++ b/application/views/bankdebit.php @@ -511,6 +511,7 @@ function isNumberKey(evt) } function GetAmount(i) { + //alert("onchnage function getamount"+i); var amount = parseFloat( $('#invoicepaymet'+i).val() == '' ? '0.00' : $('#invoicepaymet'+i).val()) @@ -543,8 +544,8 @@ function GetAmount(i) for(k=1;k<=i;k++) { //alert(k); - var idcheck1=$('#igrlineitem'+k).val(); - var idcheck=idcheck1.trim(); + var idcheck=$('#hideigrline'+k).val(); + //var idcheck=idcheck1.trim(); if(igrlineitem == idcheck) { @@ -648,7 +649,8 @@ function Save() // alert('igrnoval'+'-'+igrno); - var igrlineitem =$('#hideigrline'+number).val(); + var igrlineitem1 =$('#hideigrline'+number).val(); + var igrlineitem=igrlineitem1.trim(); var suppliername=$('#hidesupname'+number).val(); diff --git a/application/views/bankinvoice.php b/application/views/bankinvoice.php index aebcee3c..df2e1185 100644 --- a/application/views/bankinvoice.php +++ b/application/views/bankinvoice.php @@ -622,7 +622,8 @@ function Save() var customerid=$('#hidecustomerid'+number).val(); - var invoiceamount=$('#hideinvoiceamount'+number).val(); + var invoiceamount1=$('#hideinvoiceamount'+number).val(); + var invoiceamount=invoiceamount1.trim(); var amountreceived=$('#hideinvoicerecd'+number).val(); diff --git a/application/views/bankinvoicesettlement.php b/application/views/bankinvoicesettlement.php index cc9172f8..ffe68ead 100644 --- a/application/views/bankinvoicesettlement.php +++ b/application/views/bankinvoicesettlement.php @@ -148,8 +148,9 @@ foreach($financialyear as $item) INVOICE NO Customer Name Total Amount (₹) + Received Amount Balance To Received - Received Amount + Action @@ -177,9 +178,11 @@ foreach($financialyear as $item) invoiceno?> customername?> totinvoiceamount?> - totinvoiceamount-$ap->amountreceived?> amountreceived?> - + + + balancetoreceived?> +     @@ -283,12 +286,14 @@ function invoice(i) { $('#content').loader('show'); -var totinvoiceamount=$('#totinvoiceamount'+i).text(); +var totinvoiceamount=$('#totinvoiceamount'+i).text(); + var balancetoreceived=$('#balancetoreceived'+i).text(); var invoiceno=$('#invno'+i).text(); //alert(invoiceno); var bankid=$('#bankingid'+i).val(); var amountreceived=$('#amountreceived'+i).text(); + var bankingclear=$('#bankingclear'+i).val(); var mappingid=$('#mappingid'+i).val(); var credit=$('#credit'+i).val(); diff --git a/application/views/bankreceivedsupp.php b/application/views/bankreceivedsupp.php index f22d4d54..2ad0ce59 100644 --- a/application/views/bankreceivedsupp.php +++ b/application/views/bankreceivedsupp.php @@ -265,7 +265,7 @@ foreach($financialyear as $item) -

CashBook(

CashBook   )

+ ?>

diff --git a/application/views/banksettlementcredit.php b/application/views/banksettlementcredit.php index 0c5ad805..438a4c3b 100644 --- a/application/views/banksettlementcredit.php +++ b/application/views/banksettlementcredit.php @@ -230,6 +230,7 @@ if(!empty($mapping)) + @@ -248,9 +249,9 @@ if(!empty($mapping)) $i=1; $ti=0.00; $tvt=0.00; - if(!empty($bankmappingcash)){ + if(!empty($bankmappingcashreceived)){ - foreach($bankmappingcash as $mc) + foreach($bankmappingcashreceived as $mc) { $id=$mc->id; $rate=$mc->total; @@ -263,6 +264,7 @@ if(!empty($mapping)) + @@ -290,7 +292,7 @@ if(!empty($mapping)) - +
Date Account NameSupplier Name Total Amount (₹)date?> name?>SupplierName?>
Total    diff --git a/application/views/bankunreceivedsupp.php b/application/views/bankunreceivedsupp.php index 36712516..9b8aa170 100644 --- a/application/views/bankunreceivedsupp.php +++ b/application/views/bankunreceivedsupp.php @@ -35,7 +35,7 @@
-

Sundry Debtors(

Sundry Debtors   )

+ ?>