Skip to main content

Show Posts

This section allows you to view all Show Posts made by this member. Note that you can only see Show Posts made in areas you currently have access to.

Messages - guchan

1
Questions / Re: Decimal Doesnt Work
found the answer thanks @willvin
$('#ctrl-eftpos, #ctrl-app_payment, #ctrl-discount, #ctrl-cash').on('input', function(){


    var $eftpos = $(this).closest('form').find('#ctrl-eftpos').val();
    var $app_payment = $(this).closest('form').find('#ctrl-app_payment').val();
    var $discount = $(this).closest('form').find('#ctrl-discount').val();
    var $cash = $(this).closest('form').find('#ctrl-cash').val();
   
    var $gross_sales_dom = $(this).closest('form').find('#ctrl-gross_sales');
   
    $gross_sales = (parseFloat($eftpos) + parseFloat($app_payment) + parseFloat($discount) + parseFloat($cash));
   
    $gross_sales_dom.val($gross_sales);
   
});
2
Questions / Re: Decimal Doesnt Work
Quote
$('#ctrl-eftpos, #ctrl-app_payment, #ctrl-discount, #ctrl-cash').on('input', function(){


    var $eftpos = $(this).closest('form').find('#ctrl-eftpos').val();
    var $app_payment = $(this).closest('form').find('#ctrl-app_payment').val();
    var $discount = $(this).closest('form').find('#ctrl-discount').val();
    var $cash = $(this).closest('form').find('#ctrl-cash').val();
   
    var $gross_sales_dom = $(this).closest('form').find('#ctrl-gross_sales');
   
    $gross_sales = parseFloat($eftpos) + parseFloat($app_payment) + parseFloat($discount) + parseFloat($cash);
   
    $gross_sales_dom.val($gross_sales);

is this the correct way to do it ?
3
Questions / Decimal Doesnt Work
hi there i have a problem here. i try to use client event in my phprad , it should calculate a decimal data type,  my database data type are already decimal 7,2
change the value step to 0.01

but when ever i put the decimal number from 1 field to another , the calculation doesnt work.





here is my script
$('#ctrl-eftpos, #ctrl-app_payment, #ctrl-discount, #ctrl-cash').on('input', function(){


    var $eftpos = $(this).closest('form').find('#ctrl-eftpos').val();
    var $app_payment = $(this).closest('form').find('#ctrl-app_payment').val();
    var $discount = $(this).closest('form').find('#ctrl-discount').val();
    var $cash = $(this).closest('form').find('#ctrl-cash').val();
   
    var $gross_sales_dom = $(this).closest('form').find('#ctrl-gross_sales');
   
    $gross_sales = ($eftpos + $app_payment + $discount + $cash);
   
    $gross_sales_dom.val($gross_sales);
   
});

any help or explanation will be much appreciated

thanks