diff --git a/application/views/bankdebit.php b/application/views/bankdebit.php
index 2747d356..2d4e1312 100644
--- a/application/views/bankdebit.php
+++ b/application/views/bankdebit.php
@@ -46,11 +46,11 @@ foreach($financialyear as $item)
- | Payment ID |
- Payment Mode |
- Payment Amount (₹) |
- Payment date |
- Narration |
+ Payment ID |
+ Payment Mode |
+ Payment Amount (₹) |
+ Payment date |
+ Narration |
@@ -58,10 +58,10 @@ foreach($financialyear as $item)
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
@@ -281,202 +293,432 @@ foreach($financialyear as $item)
var i;
$.each(res1, function( index, value )
{
- var res2 = value.split('-');
- var bid=res2[0];
- var bam=res2[1];
-
- $('#bankid').val(bid);
- document.getElementById("bid").innerHTML=bid;
- });/** foreach closed */
- $.fn.dataTable.moment( 'DD-MM-YYYY' );
- table = $('#req').DataTable( {
+ var res2 = value.split('-');
+
+ var bid=res2[0];
+ var bam=res2[1];
+ //alert(bid);
+ //alert(bam);
+ $('#bankid').val(bid);
+ document.getElementById("bid").innerHTML='Payment ID:' +bid;
+ });
+
+ //alert(res2);
+ //alert(res[1]);
+ //var text = $('#debitamount').text();
+
+
+ //alert($data['cash']);
+ // $('#debitamount').val('10');
+ table = $('#req').DataTable( {
"dom": "<'row'<'col-md-6'l><'col-md-6'Bf>>" +
- "<'row'<'col-md-6'><'col-md-6'>>" +
- "<'row'<'col-md-12't>><'row'<'col-md-4'i><'col-md-8'p>>",
- buttons: [
- {
+"<'row'<'col-md-6'><'col-md-6'>>" +
+"<'row'<'col-md-12't>><'row'<'col-md-4'i><'col-md-8'p>>",
+ buttons: [
+
+ {
extend: 'excelHtml5',
footer: 'true',
messageTop: $('h3').text(),
title: 'cashbook Overall Report',
exportOptions: {
- columns: ':visible'
+ columns: ':visible'
+
}
},
'colvis'
]
- } );/** datatable closed */
-} );/** ready closed */
-
-var temppo=[]; // temppo - This array for PO with its value.
-var tempTotal = []; // tempTotal - This array for get value from "temppo" to calculate grandtotal
-var intex = 1;
-var row = 0;
+ } );
+} );
+//alert(pono+'array');
+var temppo=[];
+var tot=0;
+var tot1=0;
+var intex=1;
+var row=0;
+var j=1;
+var addvalue=0;
+var tott=0;
+var total=0;
function GetPayment(i)
{
-
+ //alert('check');
+ var value=i;
var bankdebitamount=$('#debitamount').val();
var totalvalue=$('#addvalue').val();
var balanceamount=bankdebitamount-totalvalue;
- var x = document.getElementById('checkboxcheckbox'+i).checked;
+ var x = document.getElementById('checkboxcheckbox'+i).checked;
- var amount= parseFloat( $('#invoicepaymet'+i).val() == '' ? '0.00' : $('#invoicepaymet'+i).val())
-
- var negative=0;
- if(amount<0)
- {
+ var amount= parseFloat( $('#invoicepaymet'+i).val() == '' ? '0.00' : $('#invoicepaymet'+i).val())
+ //alert(amount+'inv');
+ var negative=0;
+ if(amount<0)
+ {
negative=1;
alert('Invalid Amount');
- }
-
- temp=intex;
-
+ // $('#invoicepaymet'+i).val('');
+
+ }
+ temp=intex;
+ //alert(temp+'temp');success
if(x==true)
{
- row = parseInt(row)+1;
+ //alert(x);
+ var bankdebitamount=$('#debitamount').val();
+ var totalvalue=$('#addvalue').val();
+ var balanceamount=bankdebitamount-totalvalue;
+
+ if(bankdebitamount==totalvalue)
+ {
+ //alert('you have remaining'+balanceamount);
+ //alert('your amount is equal to debit amount');
+ $(".checkboxcheckbox").prop("disabled", true);
+ }
+
+ else
+ {
+ //document.getElementById('checkboxcheckbox'+i).checked = false;
+ ('your checkbox is disabled beacause already mapped amount')
+ }
+
+ row= parseInt(row)+1;
$('#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 date= document.getElementById ( "date"+i ).innerText;
+ var pono =document.getElementById ( "pono"+i ).innerText;
+ var poamount =document.getElementById ( "qw"+i ).innerText;
+ 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
- $('#invoicepaymet'+i).val(invoicepayment);//to copy the value from 'balance to pay' to 'amount paid'
-
+ var tta= $('#totala').val();
+ var tempid = "debited"+value;
+ //var credit=parseFloat(document.getElementById(tempid).innerText);
+ var t ="totala"+value;
+ var poamount1 =$(t).val();
+ //alert(poamount1+'amt');
+ var ponovalue = igrlineitem+','+poamount;
+ temppo.push(ponovalue);
+ console.log(temppo);
+ var total=0;
+ $.each(temppo, function( index, value )
+ {
+ var res2 = value.split(',');
+
+ var pono=res2[0];
+ //alert(pono+'pono');
+ var bam=res2[1];
+ //alert(bam+'bam');
+ total=parseFloat(bam)+parseFloat(total);
+ $('#addvalue').val(parseFloat(total).toFixed(2));
+ });
+
+ //console.log(temppo);
+ var supname =document.getElementById ("sn"+i ).innerText;
+ var totalordervalue =document.getElementById ("tov"+i ).innerText;
+ var invoicepayment =document.getElementById ( "qw"+i ).innerText;
+ $('#invoicepaymet'+i).val(invoicepayment);
+ var RowCount= $('#Rowid').val();
$('
').attr({
type:'hidden',
- name:'hidedate'+i,
- id:'hidedate'+i,
+ name:'date1'+j,
+ id:'date1'+j,
value:date
- }).appendTo('#HideDateDiv');
+ }).appendTo('#date1');
$('
').attr({
type:'hidden',
- name:'hidepono'+i,
- id:'hidepono'+i,
+ name:'purchaseono'+j,
+ id:'purchaseono'+j,
value:pono
- }).appendTo('#HidePONODiv');
+ }).appendTo('#purchaseono');
$('
').attr({
type:'hidden',
- name:'hideigrno'+i,
- id:'hideigrno'+i,
+ name:'hideigrno'+j,
+ id:'hideigrno'+j,
value:igrno
}).appendTo('#HideIGRDiv');
$('
').attr({
type:'hidden',
- name:'hideigrline'+i,
- id:'hideigrline'+i,
+ name:'hideigrline'+j,
+ id:'hideigrline'+j,
value:igrlineitem
- }).appendTo('#HideIGRLineItem');
+ }).appendTo('#hideigrline');
$('
').attr({
type:'hidden',
- name:'hidesupname'+i,
- id:'hidesupname'+i,
+ name:'supname'+j,
+ id:'supname'+j,
value:supname
- }).appendTo('#HideSuppDiv');
+ }).appendTo('#supname');
$('
').attr({
type:'hidden',
- name:'hidettlPoamt'+i,
- id:'hidettlPoamt'+i,
- value:totalordervalue
- }).appendTo('#HideTtlPoAmtDiv');
-
- $('
').attr({
- type:'hidden',
- name:'hideamtpaid'+i,
- id:'hideamtpaid'+i,
+ name:'totala'+j,
+ id:'totala'+j,
value:invoicepayment
- }).appendTo('#HideAmtPaidDiv');
+ }).appendTo('#totala');
- var poamount = $('#hideamtpaid'+i).val();
- var ponovalue = i+','+igrlineitem+','+poamount;
- temppo.push(ponovalue);
- //console.log(temppo);
+
+ $('
').attr({
+ type:'hidden',
+ name:'ttamnt'+j,
+ id:'ttamnt'+j,
+ value:totalordervalue
+ }).appendTo('#ttamnt');
+
+
+ intex = parseInt(intex)+1;
+ j=parseInt(j)+1;
+ //alert(j+'j');
+ var to=0;
+ // for(t=1;t
=parseFloat(bankdebitamount))
- // {
- // alert('your checkbox is disabled beacause already mapped amount');
- // $(".checkboxcheckbox").prop("disabled", true);
- // }
+
+ // GetAmount(i);
}
else
{
-
- var rr = $('#Rowid').val();
- row = parseInt(rr)-1;
+ //alert(i)
+ var rr= $('#Rowid').val();
+ var ro= parseInt(rr)-1;
- var Payment = parseFloat( $('#invoicepaymet'+i).val() == '' ? '0.00' : $('#invoicepaymet'+i).val());
+ var Payment= parseFloat( $('#invoicepaymet'+i).val() == '' ? '0.00' : $('#invoicepaymet'+i).val());
var Inid = document.getElementById ('igrlineitem'+i ).innerText
- var ponovalue = i+','+Inid+','+Payment;
-
- $.each(temppo,function(i,val){
-
+ var ponovalue = Inid+','+Payment;
var a = temppo.indexOf(ponovalue);
- var b = tempTotal.indexOf(Payment);
- //console.log(a);
- if(a != -1){
- //sconsole.log('if');
- temppo.splice(a,1);
- //console.log(temppo);
- }
- if(b!=-1)
+ //console.log(a);
+ if(a!=-1)
{
- tempTotal.splice(ponovalue,1);
- //console.log(tempTotal);
+ temppo.splice(a,1);
+ console.log(temppo);
}
-});
-
- calculategrandtotal();
+//alert(Inid)
+ for(s=1;s<=j;s++)
+ {
+ // alert(j+'else');
+ var ch= $('#hideigrline'+s).val();
+ if(Inid==ch)
+ {
+
+ var w=s;
+ delamount= $('#totala'+w).val();
+ break;
+ }
+
+ }
+
+ // //alert(w);
+ var tote= $('#addvalue').val();
+ var afterdeltot= parseFloat(tote)- parseFloat(delamount);
+ tot=parseFloat(tot)- parseFloat(Payment);
$('#invoicepaymet'+i).val('');
-
+ $('#addvalue').val(parseFloat(afterdeltot).toFixed(2));
- $('#Rowid').val(row);
-
+
+ //alert(ro);
+
+ $('#Rowid').val(ro);
+ //$('#addvalue').val('');
$('#invoicepaymet'+i).val('');
- $('#hidedate'+i).val('');
- $('#hidepono'+i).val('');
- $('#hideigrno'+i).val('');
$('#hideigrline'+i).val('');
- $('#hidesupname'+i).val('');
- $('#hidettlPoamt'+i).val('');
- $('#hideamtpaid'+i).val('');
-
- //$('#invoicepaymet'+i).remove();
- $('#hidedate'+i).remove();
- $('#hidepono'+i).remove();
- $('#hideigrno'+i).remove();
- $('#hideigrline'+i).remove();
- $('#hidesupname'+i).remove();
- $('#hidettlPoamt'+i).remove();
- $('#hideamtpaid'+i).remove();
+ $('#date1'+i).val('');
+ $('#purchaseono'+i).val('');
+ $('#supname'+i).val('');
+ $('#ttamnt'+i).val('');
+ $('#totala'+i).val('');
+ //$('#aa'+i).val('');
}
}
+
+function GetAmount(i)
+{
+ //alert('text');
+ var amount= parseFloat( $('#invoicepaymet'+i).val() == '' ? '0.00' : $('#invoicepaymet'+i).val())
+ //alert(amount);
+ var negative=0;
+ if(amount<0)
+ {
+ negative=1;
+ alert("Invalid Amount")
+ $('#invoicepaymet'+i).val('');
+ }
+ var x = document.getElementById('checkboxcheckbox'+i).checked;
+
+
+ if(x==true )
+ {
+ //alert(x);
+ 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;
+
+ for(k=1;k<=j-1;k++)
+ {
+ //alert(k)
+ var idcheck=$('#hideigrline'+k).val();
+ // alert(idcheck)
+
+ if(igrlineitem==idcheck)
+ {
+ var cid=k;
+ //alert(cid+'if');
+ //die();
+ break;
+
+ }
+
+ }
+
+
+ if(amount<=totalordervalue)
+ {
+ //alert(cid+'cid');
+ $('#date1').val(date);
+ $('#hideigrline'+cid).val(igrlineitem);
+ $('#supname'+cid).val(supname);
+ $('#ttamnt'+cid).val(totalordervalue);
+ $('#totala'+cid).val(amount);
+ var totalvalue=$('#addvalue').val();
+ var bid=$('#bankid').val();
+ //$('#inv_total'+cid).val(invoicepayment);
+ }
+
+ else
+ {
+ alert('You are exceeding the payment get!!');
+ $('#invoicepaymet'+i).val(amount)
+ location.reload();
+
+ }
+
+ var tot11=0
+ for(l=1;l=parseFloat(totalvalue))
+ {
+//alert(date+'date');
+//die();
+ //alert('you have remainining'+balnceamount);
+ $.ajax(
+ {
+ 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:"cashbook/receipt",
+ success:function(data)
+ {
+ if(data)
+ {
+ window.location.href ="Bankingstatement";
+ //location.reload();
+
+ }
+ }
+ });
+
+ }
+ }
+
+
+
+ else{
+
+ alert('You are payment exceeding');
+ location.reload();
+ }
+
+
+ }
+ }
+
function isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : evt.keyCode;
@@ -489,194 +731,6 @@ function isNumberKey(evt)
return true;
}
-function GetAmount(i)
-{
- //alert("onchnage function getamount"+i);
- var amount = parseFloat( $('#invoicepaymet'+i).val() == '' ? '0.00' : $('#invoicepaymet'+i).val())
-
- var negative=0;
- if(amount<0)
- {
- negative=1;
- alert("Invalid Amount")
- $('#invoicepaymet'+i).val('');
- }
-
- var x = document.getElementById('checkboxcheckbox'+i).checked;
-
-
- if(x==true )
- {
-
- 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;
-
- for(k=1;k<=i;k++)
- {
- //alert(k);
- var idcheck=$('#igrlineitem'+k).val();
-
- if(igrlineitem == idcheck)
- {
- var cid=k;
- break;
- }
-
- }
-
-
- if(amount<=balancetopay)//amount paid value is less than or equal to total amount paid value means
- {
-
- $('#hidedate'+cid).val(date);
- $('#hidepono'+cid).val(pono);
- $('#hidesupname'+cid).val(supname);
- $('#hidettlPoamt'+cid).val(totalordervalue);
- $('#hideamtpaid'+cid).val(amount);
- $('#hideigrno'+cid).val(igr);
- $('#hideigrline'+cid).val(igrlineitem);
-
- var totalvalue=$('#addvalue').val();
- var bid=$('#bankid').val();
-
- }
- else
- {
- alert('You are exceeding the payment get!!');
- $('#invoicepaymet'+i).val(amount)
- // location.reload();
-
- }
-
- $.each(temppo, function( index, value )
- {
- var res2 = value.split(',');
- if(res2[1] == igrlineitem){
-
- temppo[index] = i+','+igrlineitem+','+amount;
- }
-
- });
- calculategrandtotal()
-
- }
-
-}
-
-
-/** To calculate the overall total and store the value in table's footer */
-function calculategrandtotal(){
-
- $.each(temppo, function( index, value )
- {
-
- var res2 = value.split(',');
- tempTotal[index]=parseFloat(res2[2]);
- //alert(tempTotal[index]);
- });
-
- var sum = 0;
-
- for (var i = 0; i < tempTotal.length; i++) {
-
- sum += tempTotal[i];
-
- }
- $('#addvalue').val(parseFloat(sum).toFixed(2));
- // console.log(tempTotal);
-}
-
-function Save()
-{
-
- $('#content').loader('show');
- var rowCount= $('#Rowid').val();
- var check= 0;
- var rw= 0;
- for(i=1;i<=rowCount;i++)
- {
- var arrval = temppo[i-1];
- var number = arrval.split(',');
- number = number[0];
- //alert('rowcount'+i+'selectedcheckboxnumber'+number+'tempinvoice'+arrval);
- rw= parseFloat(rw)+1;
- // alert('rwval'+'-'+rw);
- check = parseFloat(check)+1;
- var bankdebitamount=$('#debitamount').val();
- // alert('bankdebitamountval'+'-'+bankdebitamount);
- var bid =$('#bankid').val();
-
- // alert('bidval'+'-'+bid);
- var date =$('#hidedate'+number).val();
- // alert('dateval'+'-'+date);
- var pono =$('#hidepono'+number).val();
- //alert('ponoval'+'-'+pono);
- var igrno =$('#hideigrno'+number).val();
- // alert('igrnoval'+'-'+igrno);
-
- var igrlineitem =$('#hideigrline'+number).val();
- // alert('igrlineitemval'+'-'+igrlineitem);
-
- var suppliername=$('#hidesupname'+number).val();
- // alert('suppliernameval'+'-'+suppliername);
-
- var totalordervalue=$('#hidettlPoamt'+number).val();
- // alert('totalordervalueval'+'-'+totalordervalue);
-
- var amountpaid=$('#hideamtpaid'+number).val();
- // alert('amountpaidval'+'-'+amountpaid);
-
- var invoicepaymet=$('#invoicepaymet'+number).val();
- //alert(invoicepaymet);
-
-
- var totalvalue=$('#addvalue').val();
- // alert('totalvalueval'+'-'+totalvalue);
-
- var payment = parseFloat(amountpaid);
- //alert('paymentval'+'-'+payment);
-
- var balnceamount=bankdebitamount-totalvalue;
- // alert('balnceamountval'+'-'+balnceamount);
-
-
- if(parseFloat(bankdebitamount)>=parseFloat(totalvalue))
- {
-
- $.ajax(
- {
- data:{podate:date,pono:pono,igrno:igrno,igrlineitem:igrlineitem,sname:suppliername,tot:totalordervalue,aa:invoicepaymet,rc:rowCount,tpv:totalvalue,bda:bankdebitamount,bi:bid,check:check,rw:rw},
- type:"POST",
- url:"cashbook/receipt",
- success:function(data)
- {
-
- if(data)
- {
- //$('#content').loader('hide');
- //alert(data);
- window.location.href ="Bankingstatement";
- //location.reload();
-
- }
- }
- });
-
- }
- else{
-
- alert('Your payment exceeding ');
- location.reload();
- }
-
-
- }
-}
+