1let subResObj = { 2 "revenue": 0, 3 "costs_sold": 0, 4 "op_expense": 0 5}; 6let calcFunct = () => { 7 var gross_profit = subResObj.revenue - subResObj.costs_sold; 8 var net_profit = gross_profit - subResObj.op_expense; 9 10 if (gross_profit >= 0) 11 jQuery(".gross_profit").text("$" + gross_profit.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")); 12 else 13 jQuery(".gross_profit").text("- $" + gross_profit.toString().replaceAll("-", "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); 14 15 if (net_profit >= 0) 16 jQuery(".net_profit").text("$" + net_profit.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")); 17 else 18 jQuery(".net_profit").text("- $" + net_profit.toString().replaceAll("-", "").replace(/\B(?=(\d{3})+(?!\d))/g, ",")); 19}; 20 21let inptChngDefoult = (element) => { 22 var startValue = element.val().replaceAll("$", "").replaceAll(",", "").replaceAll(".", "").replaceAll(/\s+/g, ''); 23 var elClassName = element.attr("class"); 24 var f_startValue = parseFloat(startValue); 25 26 if (!isNaN(f_startValue) && f_startValue >= 0) { 27 element.css("border-color", "rgb(21, 48, 47)"); 28 subResObj[elClassName] = f_startValue; 29 30 element.val("$" + startValue.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",")); 31 32 setTimeout(function () { 33 var error = 0; 34 jQuery("#income_calc input").each(function () { 35 if (jQuery(this).css("border-color") == "rgb(251, 77, 48)") 36 error = 1; 37 }); 38 if (error == 0) 39 calcFunct(); 40 }, 200); 41 } else { 42 element.css("border-color", "rgb(251, 77, 48)"); 43 } 44}; 45 46jQuery(document).ready(function () { 47 jQuery("#income_calc input").on('input', function () { 48 inptChngDefoult(jQuery(this)); 49 }); 50});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.