Tax calculation

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
Moh Youba
Veteran Member
Posts: 228
Joined: 2017-03-12 09:31

Tax calculation

Post by Moh Youba » 2018-02-18 10:58

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

R Tammam
Veteran Member
Posts: 113
Joined: 2017-08-26 15:35

Re: Tax calculation

Post by R Tammam » 2018-02-25 03:58

Hello Moh Youba,
Do you want to make the sells price auto filled with equation's value?

Moh Youba
Veteran Member
Posts: 228
Joined: 2017-03-12 09:31

Re: Tax calculation

Post by Moh Youba » 2018-02-25 22:10

Hello Tammam
Thank you for your reply. Yes it is what I want
Thank you

Moh Youba
Veteran Member
Posts: 228
Joined: 2017-03-12 09:31

Re: Tax calculation

Post by Moh Youba » 2018-03-14 13:01

Hello guys

Any idea for my problem !!!

Thank you

Moh Youba
Veteran Member
Posts: 228
Joined: 2017-03-12 09:31

Re: Tax calculation

Post by Moh Youba » 2018-03-14 21:40

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

xbox2007
Veteran Member
Posts: 129
Joined: 2016-12-16 16:49

Re: Tax calculation

Post by xbox2007 » 2018-03-24 17:32

thanks a lot

R Tammam
Veteran Member
Posts: 113
Joined: 2017-08-26 15:35

Re: Tax calculation

Post by R Tammam » 2018-03-26 06:56

Hello Moh Youba,

Sorry for the late reply , and i happy that you could solve your problem easily , good luck :)

Post Reply