/* Set to read-only */
$j('#ttc, #tva2').prop('readonly', true);

/* calcul du prix de vente */

$j('#tht, #tva, #tva2, #ttc').change(function(){
	
var montantV = parseFloat($j('#tht').val()) || 0;

var ttva = parseFloat($j('#tva').val()) || 0;

var stva = parseFloat($j('#tva2').val()) || 0;

var mnet = parseFloat($j('#ttc').val()) || 0;



// calcul de la TVA
var calcultva = montantV * ttva / 100;

var mttc = montantV - calcultva;

$j('#tva2').val(calcultva);

$j('#ttc').val(mttc);

});

/* calculate total price on opening the detail view form*/
$j('#tht').change();
$j('#tva').change();