Page 1 of 1
Tax calculation
Posted: 2018-02-18 10:58
by Moh Youba
Hi guys.
Hope you are all doing well. Please I need some help
I have a table with these fields:
- Description
- Purchase price
- Tax (in percentage %)
- Sells price
I want to make this calculation
- Purchase price + tax = sells price
Example:
- Purchase price = 4000
- Tax = 3%
- Sells price = 4120
Thank you
Re: Tax calculation
Posted: 2018-02-25 03:58
by R Tammam
Hello Moh Youba,
Do you want to make the sells price auto filled with equation's value?
Re: Tax calculation
Posted: 2018-02-25 22:10
by Moh Youba
Hello Tammam
Thank you for your reply. Yes it is what I want
Thank you
Re: Tax calculation
Posted: 2018-03-14 13:01
by Moh Youba
Hello guys
Any idea for my problem !!!
Thank you
Re: Tax calculation
Posted: 2018-03-14 21:40
by Moh Youba
Hi there. Thanks to all for assistance. I am sharing here with you the solution I found by following Appgini course. The solution was really easy than I though, here what I do.
I just create a file "credits-dv.js" on hooks folder and add these code
"
function show_error(field, msg){
modal_window({
message: '<div class="alert alert-danger">' + msg + '</div>',
title: 'Error in ' + field,
close: function(){
$j('#' + field).focus();
$j('#' + field).parents('.form-group').addClass('has-error');
}
});
return false;
}
$j(function(){
$j('#update, #insert').click(function(){
/* Make sure Taux is valid */
var taux = $j('#taux').val();
if(isNaN(taux) || taux < 0 || taux > 100){
return show_error('taux', 'Le taux doit etre entre 0 et 100.');
}
});
/* Set montant a payer to read-only */
$j('#montant_a_payer').prop('readonly', true);
/* calculer le total */
$j('#montant_credit, #taux').change(function(){
var montantCredit = parseFloat($j('#montant_credit').val()) || 0;
var taux = parseFloat($j('#taux').val()) || 0;
var montantPayer = montantCredit * taux / 100 + montantCredit;
$j('#montant_a_payer').val(montantPayer);
});
})
"
Thank to all
Re: Tax calculation
Posted: 2018-03-24 17:32
by xbox2007
thanks a lot
Re: Tax calculation
Posted: 2018-03-26 06:56
by R Tammam
Hello Moh Youba,
Sorry for the late reply , and i happy that you could solve your problem easily , good luck