diff --git a/application/controllers/cashbook.php b/application/controllers/cashbook.php index addcf7a6..564cb58a 100755 --- a/application/controllers/cashbook.php +++ b/application/controllers/cashbook.php @@ -1259,7 +1259,7 @@ class cashbook extends BaseController } else { - $clearedblnce=($arec-(-$totalpaidamount)); + $clearedblnce=-$totalpaidamount-(-$arec); } $balancetoreceived =($bankcreditamount-$totalpaidamount); $check =1; @@ -1499,8 +1499,14 @@ class cashbook extends BaseController $totinvoiceamount = $this->input->post('totinvoiceamount'); $balancetoreceived = $this->input->post('balancetoreceived'); $updatebalancetoclear=$amountreceived+$bankingbalclear; + if($amountreceived<0) + { + $updateclearbalance=$bankingclear+$amountreceived; + } + else + { $updateclearbalance=$bankingclear-$amountreceived; - + } //update Isactive field in T_Bankreport ////// $mapped=$balancetoreceived+$amountreceived; @@ -1523,15 +1529,18 @@ class cashbook extends BaseController $receivedstatus=PARTIALLY_RECEIVED; } $IsActive=0; - // $data['$latestamount'] = $this->cashbook_model->getlatestamount($invoiceno); + //$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; + //$balancetoreceived1=$data['$latestamount'][0]->balancetoreceived; + $updatebalancetoreceived=$balancetoreceived+$amountreceived; $updateamountreceived=$totinvoiceamount-$updatebalancetoreceived; $result3= $this->cashbook_model->updatebankinvoicereport($invoiceno,$bankid,$updatebalancetoreceived,$updateamountreceived); + if(count($result3)>0) + { + $result1=$this->cashbook_model->UpdateIpinvoiceStatus($invoiceno,$receivedstatus); + $result2= $this->cashbook_model->deletemappinginvoice($mappingid,$IsActive); + } $this->loadViews("bankstatement", $this->global,$data, NULL); // if(count($result2)>0) diff --git a/application/views/bankdebit.php b/application/views/bankdebit.php index d43c7ea0..533589a1 100644 --- a/application/views/bankdebit.php +++ b/application/views/bankdebit.php @@ -553,7 +553,7 @@ function GetAmount(i) { //alert('text'); var amount= parseFloat( $('#invoicepaymet'+i).val() == '' ? '0.00' : $('#invoicepaymet'+i).val()) - alert(amount); + var negative=0; if(amount<0) { @@ -620,7 +620,7 @@ function GetAmount(i) { var Payingamount=parseFloat( $('#totala'+l).val() == '' ? '0.00' : $('#totala'+l).val()); tot11= parseFloat(tot11)+parseFloat(Payingamount); - alert(tot11); + $('#addvalue').val(parseFloat(tot11).toFixed(2)); } diff --git a/application/views/bankinvoice.php b/application/views/bankinvoice.php index 10b96bf5..cc13521e 100644 --- a/application/views/bankinvoice.php +++ b/application/views/bankinvoice.php @@ -483,9 +483,7 @@ function GetAmount(i) } - - if(amount<=invoiceamount)//amount value is less than or equal to invoice received value means - { + $('#hideinvoicedate').val(date); $('#hideinvoiceid'+cid).val(invid); @@ -495,14 +493,7 @@ function GetAmount(i) var totalvalue=$('#addvalue').val(); //alert(totalvalue); var bid=$('#bankid').val(); - } - else - { - alert('You are exceeding the payment get!!'); - $('#invoicereceived'+i).val(amount) - location.reload(); - - } + $.each(tempinvoice, function( index, value )