Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function hitungRatio() {
- var locale = 'en';
- var options = {minimumFractionDigits: 3, maximumFractionDigits: 3};
- var formatter = new Intl.NumberFormat(locale, options);
- var myForm = document.formInput;
- var Ratio = myForm.ratio.value;
- Ratio = Ratio.replace(/[,]/g, '');
- Ratio = parseFloat(Ratio);
- // Jumlah Value Ratio Item
- var coating_ratio_id = <?=$detailcoating->coating_ratio_id;?>;
- var coating_ratio_value = <?=$detailcoating->coating_ratio_value;?>;
- $.ajax({
- url:"<?=site_url('admin/color/jumlah_ratio/');?>"+coating_ratio_id,
- type: "GET",
- dataType: "JSON",
- success: function(data) {
- if (data.total_ratio===null) {
- var total = Ratio;
- console.log(total);
- } else {
- var total = (data.total_ratio+Ratio);
- console.log(total);
- }
- },
- });
- // console.log(total, coating_ratio_value, Ratio);
- var Consumption = ((Ratio*coating_ratio_value)/total);
- if (isNaN(Consumption)) {
- myForm.consumption.value = 0;
- } else {
- myForm.consumption.value = formatter.format(Consumption);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement