<script>
$().ready(function() {
    $('#add_rowA').on('click', function() {
        var row_countA = $('#row_countA').val();
        row_countA++;
        // console.log(row_countA, 'row_countA');
        var content =
        '<tr id="rowA'+row_countA+'">\
            <td><select style="width: 100%;padding: 2.1px;" name="items['+row_countA+'][partid]" id="partid'+row_countA+'">\
                <option selected value="">Choose...</option>\
                <?php $__currentLoopData = $parts; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $part): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>\
                <option value="<?php echo e($part->id); ?>"><?php echo e($part->partname); ?></option>\
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></select></td>\
            <td><input type="text" style="width: 100%;" name="items['+row_countA+'][dia_width]" id="diawidth'+row_countA+'"></td>\
            <td><input type="text" style="width: 100%;" name="items['+row_countA+'][length]" id="length'+row_countA+'"></td>\
            <td><input type="text" style="width: 100%;" name="items['+row_countA+'][thickness]" id="thickness'+row_countA+'"></td>\
            <td><select style="width: 100%;padding: 2.1px;" name="items['+row_countA+'][moc]" id="moc'+row_countA+'">\
                <option selected value="">Choose...</option>\
                <?php $__currentLoopData = $mocs; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $moc): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>\
                <option value="<?php echo e($moc->id); ?>"><?php echo e($moc->mocname); ?></option>\
                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?></select></td>\
            <td><input type="text" style="width: 100%;" name="items['+row_countA+'][density]" id="density'+row_countA+'" value="0" readonly></td>\
            <td><input type="text" style="width: 100%;" name="items['+row_countA+'][qty]" id="qty'+row_countA+'"></td>\
            <td><input type="text" style="width: 100%;" name="items['+row_countA+'][surface_area]" id="surfacearea'+row_countA+'" value="0" readonly></td>\
            <td><input type="text" style="width: 100%;" name="items['+row_countA+'][weight]" id="weight'+row_countA+'" value="0" readonly></td>\
            <td><input type="text" style="width: 100%;" name="items['+row_countA+'][labrate]" id="labrate'+row_countA+'" value="0"></td>\
            <td><input type="text" style="width: 100%;" name="items['+row_countA+'][matrate]" id="matrate'+row_countA+'" value="0"></td>\
            <td><input type="text" style="width: 100%;" name="items['+row_countA+'][totalrate]" id="totalrate'+row_countA+'" value="0" readonly></td>\
            <td class="table-option"><a href="javascript:void(0);" class="w-100 remove_row btn btn-danger btn-sm" data-row="'+row_countA+'"><i class="lni lni-trash"></i></a></td>\
        </tr>';
        $('#row_body3').append(content);
        $('#row_countA').val(row_countA);

		$(document).on("change", "#partid"+row_countA, function() {
            var partid = parseFloat($("#partid"+row_countA).val());
			var diawidth = parseFloat($("#diawidth"+row_countA).val());
			var length = parseFloat($("#length"+row_countA).val());
			var thickness = parseFloat($("#thickness"+row_countA).val());
			var density = parseFloat($("#density"+row_countA).val());
		   	var qty = parseFloat($("#qty"+row_countA).val());
            var surfacearea = parseFloat($("#surfacearea"+row_countA).val());
            var labrate = parseFloat($("#labrate"+row_countA).val());
            var matrate = parseFloat($("#matrate"+row_countA).val());
            var weight = parseFloat($("#weight"+row_countA).val());

            if(partid == 1){ // shell
                var getsurfaceArea = 3.14 * length * qty * ((diawidth + (2 * thickness)));
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 2){ // top dish ellipsoidal
                var getqty = 0.785 * qty;
                var percentage = diawidth*17/100 +diawidth+0.1;
                var getsurfaceArea = getqty * percentage * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 3){ // top dish torispherical
                var getqty = 0.785 * qty;
                var percentage = diawidth*10/100 +diawidth+0.1;
                var getsurfaceArea = getqty * percentage * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 4){ // top dish cone roof
                var getqty = 3.14 * qty;
                var percentage = diawidth / 2 * diawidth / 2 + length;
                var getsurfaceArea = getqty * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 5){ // flat dish
                var getsurfaceArea = 3.14 * qty * diawidth;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 6){ // bottom dish ellipsoidal
                var getqty = 3.14 * qty;
                var percentage = diawidth*17/100 + diawidth + 0.1;
                var getsurfaceArea = getqty * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 7){ // bottom dish torispherical
                var getqty = 3.14 * qty;
                var percentage = diawidth*10/100 + diawidth + 0.1;
                var getsurfaceArea = getqty * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 8){ // bottom dish cone roof
                var getqty = 3.14 * qty;
                var sum = diawidth / 2 + length;
                var percentage = diawidth / 2 * sum;
                var getsurfaceArea = getqty * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 9){ // bottom dish flat dish
                var getsurfaceArea = 3.14 * qty * diawidth;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 10){ // baffles
                var getsurfaceArea = diawidth * length * qty;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 11){ // baffles cleats
                var getsurfaceArea = diawidth * length * qty;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 12){ // L/COIL 40
                var getsurfaceArea = length * 0.07536;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 13){ // L/COIL 80
                var getsurfaceArea = length * 0.1395;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 14){ // jacket ribs
                var getsurfaceArea = length * 0.04;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 15){ // lug
                var firstCal = diawidth * length * thickness * density;
                var secondCal = thickness + 0.01;
                var thirdCal = diawidth * length * secondCal * density;
                var fourthCal = thickness + 0.006;
                var fiveCal = diawidth * length * fourthCal * density;
                var sixCal = firstCal + thirdCal + fiveCal;
                var sevenCal = sixCal * 20 / 100;
                var getsurfaceArea = sevenCal;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else{
                var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
            }
		});
        // press keyup quantity
		$(document).on("keyup", "#qty"+row_countA, function() {
        console.log('hooo');

			var partid = parseFloat($("#partid"+row_countA).val());
			var diawidth = parseFloat($("#diawidth"+row_countA).val());
			var length = parseFloat($("#length"+row_countA).val());
			var thickness = parseFloat($("#thickness"+row_countA).val());
			var density = parseFloat($("#density"+row_countA).val());
		   	var qty = parseFloat($("#qty"+row_countA).val());
            var surfacearea = parseFloat($("#surfacearea"+row_countA).val());
            var weight = parseFloat($("#weight"+row_countA).val());
            var labrate = parseFloat($("#labrate"+row_countA).val());
            var matrate = parseFloat($("#matrate"+row_countA).val());

            if(partid == 1){ // shell
                var getsurfaceArea = 3.14 * length * qty * ((diawidth + (2 * thickness)));
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 2){ // top dish ellipsoidal
                var getqty = 0.785 * qty;
                var percentage = diawidth*17/100 +diawidth+0.1;
                var getsurfaceArea = getqty * percentage * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 3){ // top dish torispherical
                var getqty = 0.785 * qty;
                var percentage = diawidth*10/100 +diawidth+0.1;
                var getsurfaceArea = getqty * percentage * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 4){ // top dish cone roof
                var getqty = 3.14 * qty;
                var percentage = diawidth / 2 * diawidth / 2 + length;
                var getsurfaceArea = getqty * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 5){ // flat dish
                var getsurfaceArea = 3.14 * qty * diawidth;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 6){ // bottom dish ellipsoidal
                var getqty = 3.14 * qty;
                var percentage = diawidth*17/100 + diawidth + 0.1;
                var getsurfaceArea = getqty * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 7){ // bottom dish torispherical
                var getqty = 3.14 * qty;
                var percentage = diawidth*10/100 + diawidth + 0.1;
                var getsurfaceArea = getqty * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 8){ // bottom dish cone roof
                var getqty = 3.14 * qty;
                var sum = diawidth / 2 + length;
                var percentage = diawidth / 2 * sum;
                var getsurfaceArea = getqty * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 9){ // bottom dish flat dish
                var getsurfaceArea = 3.14 * qty * diawidth;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 10){ // baffles
                var getsurfaceArea = diawidth * length * qty;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 11){ // baffles cleats
                var getsurfaceArea = diawidth * length * qty;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 12){ // L/COIL 40
                var getsurfaceArea = length * 0.07536;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 13){ // L/COIL 80
                var getsurfaceArea = length * 0.1395;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 14){ // jacket ribs
                var getsurfaceArea = length * 0.04;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 15){ // lug
                var firstCal = diawidth * length * thickness * density;
                var secondCal = thickness + 0.01;
                var thirdCal = diawidth * length * secondCal * density;
                var fourthCal = thickness + 0.006;
                var fiveCal = diawidth * length * fourthCal * density;
                var sixCal = firstCal + thirdCal + fiveCal;
                var sevenCal = sixCal * 20 / 100;
                var getsurfaceArea = sevenCal;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else{
                var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
            }
		});
        // diameter keyup calcualte
		$(document).on("keyup", "#diawidth"+row_countA, function() {
			var partid = parseFloat($("#partid"+row_countA).val());
			var diawidth = parseFloat($("#diawidth"+row_countA).val());
			var length = parseFloat($("#length"+row_countA).val());
			var thickness = parseFloat($("#thickness"+row_countA).val());
			var density = parseFloat($("#density"+row_countA).val());
		   	var qty = parseFloat($("#qty"+row_countA).val());
            var surfacearea = parseFloat($("#surfacearea"+row_countA).val());
            var weight = parseFloat($("#weight"+row_countA).val());
            var labrate = parseFloat($("#labrate"+row_countA).val());
            var matrate = parseFloat($("#matrate"+row_countA).val());

            if(partid == 1){ // shell
                var getsurfaceArea = 3.14 * length * qty * ((diawidth + (2 * thickness)));
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 2){ // top dish ellipsoidal
                var getqty = 0.785 * qty;
                var percentage = diawidth*17/100 +diawidth+0.1;
                var getsurfaceArea = getqty * percentage * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 3){ // top dish torispherical
                var getqty = 0.785 * qty;
                var percentage = diawidth*10/100 +diawidth+0.1;
                var getsurfaceArea = getqty * percentage * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 4){ // top dish cone roof
                var getqty = 3.14 * qty;
                var percentage = diawidth / 2 * diawidth / 2 + length;
                var getsurfaceArea = getqty * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 5){ // flat dish
                var getsurfaceArea = 3.14 * qty * diawidth;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 6){ // bottom dish ellipsoidal
                var getqty = 3.14 * qty;
                var percentage = diawidth*17/100 + diawidth + 0.1;
                var getsurfaceArea = getqty * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 7){ // bottom dish torispherical
                var getqty = 3.14 * qty;
                var percentage = diawidth*10/100 + diawidth + 0.1;
                var getsurfaceArea = getqty * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 8){ // bottom dish cone roof
                var getqty = 3.14 * qty;
                var sum = diawidth / 2 + length;
                var percentage = diawidth / 2 * sum;
                var getsurfaceArea = getqty * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 9){ // bottom dish flat dish
                var getsurfaceArea = 3.14 * qty * diawidth;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 10){ // baffles
                var getsurfaceArea = diawidth * length * qty;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 11){ // baffles cleats
                var getsurfaceArea = diawidth * length * qty;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 12){ // L/COIL 40
                var getsurfaceArea = length * 0.07536;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 13){ // L/COIL 80
                var getsurfaceArea = length * 0.1395;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 14){ // jacket ribs
                var getsurfaceArea = length * 0.04;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 15){ // lug
                var firstCal = diawidth * length * thickness * density;
                var secondCal = thickness + 0.01;
                var thirdCal = diawidth * length * secondCal * density;
                var fourthCal = thickness + 0.006;
                var fiveCal = diawidth * length * fourthCal * density;
                var sixCal = firstCal + thirdCal + fiveCal;
                var sevenCal = sixCal * 20 / 100;
                var getsurfaceArea = sevenCal;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else{
                var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
            }
		});
        // length keyup calcualte
        $(document).on("keyup", "#length"+row_countA, function() {
			var partid = parseFloat($("#partid"+row_countA).val());
			var diawidth = parseFloat($("#diawidth"+row_countA).val());
			var length = parseFloat($("#length"+row_countA).val());
			var thickness = parseFloat($("#thickness"+row_countA).val());
			var density = parseFloat($("#density"+row_countA).val());
		   	var qty = parseFloat($("#qty"+row_countA).val());
            var surfacearea = parseFloat($("#surfacearea"+row_countA).val());
            var weight = parseFloat($("#weight"+row_countA).val());
            var labrate = parseFloat($("#labrate"+row_countA).val());
            var matrate = parseFloat($("#matrate"+row_countA).val());

            if(partid == 1){ // shell
                var getsurfaceArea = 3.14 * length * qty * ((diawidth + (2 * thickness)));
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 2){ // top dish ellipsoidal
                var getqty = 0.785 * qty;
                var percentage = diawidth*17/100 +diawidth+0.1;
                var getsurfaceArea = getqty * percentage * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 3){ // top dish torispherical
                var getqty = 0.785 * qty;
                var percentage = diawidth*10/100 +diawidth+0.1;
                var getsurfaceArea = getqty * percentage * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 4){ // top dish cone roof
                var getqty = 3.14 * qty;
                var percentage = diawidth / 2 * diawidth / 2 + length;
                var getsurfaceArea = getqty * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 5){ // flat dish
                var getsurfaceArea = 3.14 * qty * diawidth;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 6){ // bottom dish ellipsoidal
                var getqty = 3.14 * qty;
                var percentage = diawidth*17/100 + diawidth + 0.1;
                var getsurfaceArea = getqty * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 7){ // bottom dish torispherical
                var getqty = 3.14 * qty;
                var percentage = diawidth*10/100 + diawidth + 0.1;
                var getsurfaceArea = getqty * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 8){ // bottom dish cone roof
                var getqty = 3.14 * qty;
                var sum = diawidth / 2 + length;
                var percentage = diawidth / 2 * sum;
                var getsurfaceArea = getqty * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 9){ // bottom dish flat dish
                var getsurfaceArea = 3.14 * qty * diawidth;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 10){ // baffles
                var getsurfaceArea = diawidth * length * qty;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 11){ // baffles cleats
                var getsurfaceArea = diawidth * length * qty;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 12){ // L/COIL 40
                var getsurfaceArea = length * 0.07536;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 13){ // L/COIL 80
                var getsurfaceArea = length * 0.1395;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 14){ // jacket ribs
                var getsurfaceArea = length * 0.04;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 15){ // lug
                var firstCal = diawidth * length * thickness * density;
                var secondCal = thickness + 0.01;
                var thirdCal = diawidth * length * secondCal * density;
                var fourthCal = thickness + 0.006;
                var fiveCal = diawidth * length * fourthCal * density;
                var sixCal = firstCal + thirdCal + fiveCal;
                var sevenCal = sixCal * 20 / 100;
                var getsurfaceArea = sevenCal;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else{
                var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
            }
		});
        // thickness keyup calculate
        $(document).on("keyup", "#thickness"+row_countA, function() {
			var partid = parseFloat($("#partid"+row_countA).val());
			var diawidth = parseFloat($("#diawidth"+row_countA).val());
			var length = parseFloat($("#length"+row_countA).val());
			var thickness = parseFloat($("#thickness"+row_countA).val());
			var density = parseFloat($("#density"+row_countA).val());
		   	var qty = parseFloat($("#qty"+row_countA).val());
            var surfacearea = parseFloat($("#surfacearea"+row_countA).val());
            var weight = parseFloat($("#weight"+row_countA).val());
            var labrate = parseFloat($("#labrate"+row_countA).val());
            var matrate = parseFloat($("#matrate"+row_countA).val());

            if(partid == 1){ // shell
                var getsurfaceArea = 3.14 * length * qty * ((diawidth + (2 * thickness)));
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 2){ // top dish ellipsoidal
                var getqty = 0.785 * qty;
                var percentage = diawidth*17/100 +diawidth+0.1;
                var getsurfaceArea = getqty * percentage * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 3){ // top dish torispherical
                var getqty = 0.785 * qty;
                var percentage = diawidth*10/100 +diawidth+0.1;
                var getsurfaceArea = getqty * percentage * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 4){ // top dish cone roof
                var getqty = 3.14 * qty;
                var percentage = diawidth / 2 * diawidth / 2 + length;
                var getsurfaceArea = getqty * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 5){ // flat dish
                var getsurfaceArea = 3.14 * qty * diawidth;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 6){ // bottom dish ellipsoidal
                var getqty = 3.14 * qty;
                var percentage = diawidth*17/100 + diawidth + 0.1;
                var getsurfaceArea = getqty * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 7){ // bottom dish torispherical
                var getqty = 3.14 * qty;
                var percentage = diawidth*10/100 + diawidth + 0.1;
                var getsurfaceArea = getqty * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 8){ // bottom dish cone roof
                var getqty = 3.14 * qty;
                var sum = diawidth / 2 + length;
                var percentage = diawidth / 2 * sum;
                var getsurfaceArea = getqty * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 9){ // bottom dish flat dish
                var getsurfaceArea = 3.14 * qty * diawidth;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 10){ // baffles
                var getsurfaceArea = diawidth * length * qty;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 11){ // baffles cleats
                var getsurfaceArea = diawidth * length * qty;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 12){ // L/COIL 40
                var getsurfaceArea = length * 0.07536;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 13){ // L/COIL 80
                var getsurfaceArea = length * 0.1395;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 14){ // jacket ribs
                var getsurfaceArea = length * 0.04;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 15){ // lug
                var firstCal = diawidth * length * thickness * density;
                var secondCal = thickness + 0.01;
                var thirdCal = diawidth * length * secondCal * density;
                var fourthCal = thickness + 0.006;
                var fiveCal = diawidth * length * fourthCal * density;
                var sixCal = firstCal + thirdCal + fiveCal;
                var sevenCal = sixCal * 20 / 100;
                var getsurfaceArea = sevenCal;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else{
                var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
            }
		});
        // lab rate keyup calculate
        $(document).on("keyup", "#labrate"+row_countA, function() {
			var partid = parseFloat($("#partid"+row_countA).val());
			var diawidth = parseFloat($("#diawidth"+row_countA).val());
			var length = parseFloat($("#length"+row_countA).val());
			var thickness = parseFloat($("#thickness"+row_countA).val());
			var density = parseFloat($("#density"+row_countA).val());
		   	var qty = parseFloat($("#qty"+row_countA).val());
            var surfacearea = parseFloat($("#surfacearea"+row_countA).val());
            var weight = parseFloat($("#weight"+row_countA).val());
            var labrate = parseFloat($("#labrate"+row_countA).val());
            var matrate = parseFloat($("#matrate"+row_countA).val());

            if(partid == 1){ // shell
                var getsurfaceArea = 3.14 * length * qty * ((diawidth + (2 * thickness)));
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 2){ // top dish ellipsoidal
                var getqty = 0.785 * qty;
                var percentage = diawidth*17/100 +diawidth+0.1;
                var getsurfaceArea = getqty * percentage * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 3){ // top dish torispherical
                var getqty = 0.785 * qty;
                var percentage = diawidth*10/100 +diawidth+0.1;
                var getsurfaceArea = getqty * percentage * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 4){ // top dish cone roof
                var getqty = 3.14 * qty;
                var percentage = diawidth / 2 * diawidth / 2 + length;
                var getsurfaceArea = getqty * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 5){ // flat dish
                var getsurfaceArea = 3.14 * qty * diawidth;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 6){ // bottom dish ellipsoidal
                var getqty = 3.14 * qty;
                var percentage = diawidth*17/100 + diawidth + 0.1;
                var getsurfaceArea = getqty * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 7){ // bottom dish torispherical
                var getqty = 3.14 * qty;
                var percentage = diawidth*10/100 + diawidth + 0.1;
                var getsurfaceArea = getqty * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 8){ // bottom dish cone roof
                var getqty = 3.14 * qty;
                var sum = diawidth / 2 + length;
                var percentage = diawidth / 2 * sum;
                var getsurfaceArea = getqty * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 9){ // bottom dish flat dish
                var getsurfaceArea = 3.14 * qty * diawidth;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 10){ // baffles
                var getsurfaceArea = diawidth * length * qty;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 11){ // baffles cleats
                var getsurfaceArea = diawidth * length * qty;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 12){ // L/COIL 40
                var getsurfaceArea = length * 0.07536;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 13){ // L/COIL 80
                var getsurfaceArea = length * 0.1395;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 14){ // jacket ribs
                var getsurfaceArea = length * 0.04;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 15){ // lug
                var firstCal = diawidth * length * thickness * density;
                var secondCal = thickness + 0.01;
                var thirdCal = diawidth * length * secondCal * density;
                var fourthCal = thickness + 0.006;
                var fiveCal = diawidth * length * fourthCal * density;
                var sixCal = firstCal + thirdCal + fiveCal;
                var sevenCal = sixCal * 20 / 100;
                var getsurfaceArea = sevenCal;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else{
                var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
            }
		});
        // mat rate keyup calculate
        $(document).on("keyup", "#matrate"+row_countA, function() {
			var partid = parseFloat($("#partid"+row_countA).val());
			var diawidth = parseFloat($("#diawidth"+row_countA).val());
			var length = parseFloat($("#length"+row_countA).val());
			var thickness = parseFloat($("#thickness"+row_countA).val());
			var density = parseFloat($("#density"+row_countA).val());
		   	var qty = parseFloat($("#qty"+row_countA).val());
            var surfacearea = parseFloat($("#surfacearea"+row_countA).val());
            var weight = parseFloat($("#weight"+row_countA).val());
            var labrate = parseFloat($("#labrate"+row_countA).val());
            var matrate = parseFloat($("#matrate"+row_countA).val());

            if(partid == 1){ // shell
                var getsurfaceArea = 3.14 * length * qty * ((diawidth + (2 * thickness)));
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 2){ // top dish ellipsoidal
                var getqty = 0.785 * qty;
                var percentage = diawidth*17/100 +diawidth+0.1;
                var getsurfaceArea = getqty * percentage * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 3){ // top dish torispherical
                var getqty = 0.785 * qty;
                var percentage = diawidth*10/100 +diawidth+0.1;
                var getsurfaceArea = getqty * percentage * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 4){ // top dish cone roof
                var getqty = 3.14 * qty;
                var percentage = diawidth / 2 * diawidth / 2 + length;
                var getsurfaceArea = getqty * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 5){ // flat dish
                var getsurfaceArea = 3.14 * qty * diawidth;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 6){ // bottom dish ellipsoidal
                var getqty = 3.14 * qty;
                var percentage = diawidth*17/100 + diawidth + 0.1;
                var getsurfaceArea = getqty * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 7){ // bottom dish torispherical
                var getqty = 3.14 * qty;
                var percentage = diawidth*10/100 + diawidth + 0.1;
                var getsurfaceArea = getqty * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 8){ // bottom dish cone roof
                var getqty = 3.14 * qty;
                var sum = diawidth / 2 + length;
                var percentage = diawidth / 2 * sum;
                var getsurfaceArea = getqty * percentage;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 9){ // bottom dish flat dish
                var getsurfaceArea = 3.14 * qty * diawidth;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 10){ // baffles
                var getsurfaceArea = diawidth * length * qty;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 11){ // baffles cleats
                var getsurfaceArea = diawidth * length * qty;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 12){ // L/COIL 40
                var getsurfaceArea = length * 0.07536;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 13){ // L/COIL 80
                var getsurfaceArea = length * 0.1395;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 14){ // jacket ribs
                var getsurfaceArea = length * 0.04;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else if(partid == 15){ // lug
                var firstCal = diawidth * length * thickness * density;
                var secondCal = thickness + 0.01;
                var thirdCal = diawidth * length * secondCal * density;
                var fourthCal = thickness + 0.006;
                var fiveCal = diawidth * length * fourthCal * density;
                var sixCal = firstCal + thirdCal + fiveCal;
                var sevenCal = sixCal * 20 / 100;
                var getsurfaceArea = sevenCal;
                if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }else{
                    var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(getsurfaceArea));
                    var getlabrate = weight * labrate;
                    var getmatrate = weight * matrate;
                    let total = getlabrate + getmatrate;
                    var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                }
            }else{
                var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
            }
		});
        // Moc select option click
        $(document).on("change", "#moc"+row_countA, function() {
            var moc = parseFloat($("#moc"+row_countA).val());
            $.ajax({
                url:'<?php echo e(route("getmocvalue")); ?>',
                method:'POST',
                dataType:"json",
                data: {
                    "_token": "<?php echo e(csrf_token()); ?>",
                    id:moc,
                },
                success:function(response){
                    // var moc = parseFloat($("#moc"+row_countA).val());
                    var partid = parseFloat($("#partid"+row_countA).val());
                    var diawidth = parseFloat($("#diawidth"+row_countA).val());
                    var length = parseFloat($("#length"+row_countA).val());
                    var thickness = parseFloat($("#thickness"+row_countA).val());
                    var density = parseFloat($("#density"+row_countA).val(response));
                    var qty = parseFloat($("#qty"+row_countA).val());
                    var surfacearea = parseFloat($("#surfacearea"+row_countA).val());
                    var labrate = parseFloat($("#labrate"+row_countA).val());
                    var matrate = parseFloat($("#matrate"+row_countA).val());
                    // var totalrate = parseFloat($("#totalrate"+row_countA).val());

                    if(partid == 1){ // shell
                        var getweight = thickness * response * surfacearea;
                        if (getweight === 0 || isNaN(getweight)) {
                            var weight = parseFloat($("#weight"+row_countA).val(0));
                        }else{
                            var weight = parseFloat($("#weight"+row_countA).val(getweight));
                            var getlabrate = getweight * labrate;
                            var getmatrate = getweight * matrate;
                            let total = getlabrate + getmatrate;
                            console.log(getweight,getlabrate, getmatrate, total, 'data');

                            var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                        }
                    }else if(partid == 2){ // top dish ellipsoidal
                        var percentage = diawidth*17/100 +diawidth+0.1;
                        var getden = thickness * response;
                        var getsurfaceArea = getden * percentage * percentage;
                        if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                            var surfaceArea = parseFloat($("#weight"+row_countA).val(0));
                        }else{
                            var surfaceArea = parseFloat($("#weight"+row_countA).val(getsurfaceArea));
                            var getlabrate = getsurfaceArea * labrate;
                            var getmatrate = getsurfaceArea * matrate;
                            let total = getlabrate + getmatrate;
                            var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                        }
                    }else if(partid == 3){ // top dish torispherical
                        var percentage = diawidth*10/100 +diawidth+0.1;
                        var getden = thickness * response;
                        var getsurfaceArea = getden * percentage * percentage;
                        if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                            var surfaceArea = parseFloat($("#weight"+row_countA).val(0));
                        }else{
                            var surfaceArea = parseFloat($("#weight"+row_countA).val(getsurfaceArea));
                            var getlabrate = getsurfaceArea * labrate;
                            var getmatrate = getsurfaceArea * matrate;
                            let total = getlabrate + getmatrate;
                            var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                        }
                    }else if(partid == 4){ // top dish cone roof
                        var getqty = 3.14 * qty;
                        var percentage = diawidth / 2 * diawidth / 2 + length;
                        var getsurfaceArea = getqty * percentage * thickness * response;
                        if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                            var surfaceArea = parseFloat($("#weight"+row_countA).val(0));
                        }else{
                            var surfaceArea = parseFloat($("#weight"+row_countA).val(getsurfaceArea));
                            var getlabrate = getsurfaceArea * labrate;
                            var getmatrate = getsurfaceArea * matrate;
                            let total = getlabrate + getmatrate;
                            var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                        }
                    }else if(partid == 5){ // top dish flat dish
                        var getsurfaceArea = 3.14 * qty * diawidth * thickness * response;
                        if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                            var surfaceArea = parseFloat($("#weight"+row_countA).val(0));
                        }else{
                            var surfaceArea = parseFloat($("#weight"+row_countA).val(getsurfaceArea));
                            var getlabrate = getsurfaceArea * labrate;
                            var getmatrate = getsurfaceArea * matrate;
                            let total = getlabrate + getmatrate;
                            var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                        }
                    }else if(partid == 6){ // bottom dish ellipsoidal
                        var percentage = diawidth*17/100 +diawidth+0.1;
                        var getden = thickness * response;
                        var getsurfaceArea = qty * getden * percentage * percentage;
                        if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                            var surfaceArea = parseFloat($("#weight"+row_countA).val(0));
                        }else{
                            var surfaceArea = parseFloat($("#weight"+row_countA).val(getsurfaceArea));
                            var getlabrate = getsurfaceArea * labrate;
                            var getmatrate = getsurfaceArea * matrate;
                            let total = getlabrate + getmatrate;
                            var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                        }
                    }else if(partid == 7){ // bottom dish torispherical
                        var percentage = diawidth*10/100 +diawidth+0.1;
                        var getden = thickness * response;
                        var getsurfaceArea = qty * getden * percentage * percentage;
                        if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                            var surfaceArea = parseFloat($("#weight"+row_countA).val(0));
                        }else{
                            var surfaceArea = parseFloat($("#weight"+row_countA).val(getsurfaceArea));
                            var getlabrate = getsurfaceArea * labrate;
                            var getmatrate = getsurfaceArea * matrate;
                            let total = getlabrate + getmatrate;
                            var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                        }
                    }else if(partid == 8){ // bottom dish cone roof
                        var getqty = 3.14 * qty;
                        var percentageOne = diawidth / 2;
                        var percentageTwo = diawidth / 2 + length;
                        var getsurfaceArea = getqty * percentageOne * percentageTwo * thickness * response;
                        if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                            var surfaceArea = parseFloat($("#weight"+row_countA).val(0));
                        }else{
                            var surfaceArea = parseFloat($("#weight"+row_countA).val(getsurfaceArea));
                            var getlabrate = getsurfaceArea * labrate;
                            var getmatrate = getsurfaceArea * matrate;
                            let total = getlabrate + getmatrate;
                            var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                        }
                    }else if(partid == 9){ // bottom dish flat dish
                        let getsurfaceArea = 3.14 * qty * diawidth * thickness * response;
                        if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                            var surfaceArea = parseFloat($("#weight"+row_countA).val(0));
                        }else{
                            var surfaceArea = parseFloat($("#weight"+row_countA).val(getsurfaceArea));
                            var getlabrate = getsurfaceArea * labrate;
                            var getmatrate = getsurfaceArea * matrate;
                            let total = getlabrate + getmatrate;
                            var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                        }
                    }else if(partid == 10){ // baffles
                        let getsurfaceArea = diawidth * length * thickness * response * qty;
                        if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                            var surfaceArea = parseFloat($("#weight"+row_countA).val(0));
                        }else{
                            var surfaceArea = parseFloat($("#weight"+row_countA).val(getsurfaceArea));
                            var getlabrate = getsurfaceArea * labrate;
                            var getmatrate = getsurfaceArea * matrate;
                            let total = getlabrate + getmatrate;
                            var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                        }
                    }else if(partid == 11){ // baffles cleats
                        let getsurfaceArea = diawidth * length * thickness * response * qty;
                        if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                            var surfaceArea = parseFloat($("#weight"+row_countA).val(0));
                        }else{
                            var surfaceArea = parseFloat($("#weight"+row_countA).val(getsurfaceArea));
                            var getlabrate = getsurfaceArea * labrate;
                            var getmatrate = getsurfaceArea * matrate;
                            let total = getlabrate + getmatrate;
                            var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                        }
                    }else if(partid == 12){ // L/COIL 40
                        var getsurfaceArea = length * 0.07536 * thickness * response;
                        if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                            var surfaceArea = parseFloat($("#weight"+row_countA).val(0));
                        }else{
                            var surfaceArea = parseFloat($("#weight"+row_countA).val(getsurfaceArea));
                            var getlabrate = getsurfaceArea * labrate;
                            var getmatrate = getsurfaceArea * matrate;
                            let total = getlabrate + getmatrate;
                            var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                        }
                    }else if(partid == 13){ // L/COIL 80
                        var getsurfaceArea = length * 0.1395 * thickness * response;
                        if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                            var surfaceArea = parseFloat($("#weight"+row_countA).val(0));
                        }else{
                            var surfaceArea = parseFloat($("#weight"+row_countA).val(getsurfaceArea));
                            var getlabrate = getsurfaceArea * labrate;
                            var getmatrate = getsurfaceArea * matrate;
                            let total = getlabrate + getmatrate;
                            var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                        }
                    }else if(partid == 14){ // jacket ribs
                        var getsurfaceArea = length * 0.04 * thickness * response;
                        if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                            var surfaceArea = parseFloat($("#weight"+row_countA).val(0));
                        }else{
                            var surfaceArea = parseFloat($("#weight"+row_countA).val(getsurfaceArea));
                            var getlabrate = getsurfaceArea * labrate;
                            var getmatrate = getsurfaceArea * matrate;
                            let total = getlabrate + getmatrate;
                            var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                        }
                    }else if(partid == 15){ // lug
                        var firstCal = diawidth * length * thickness * response;
                        var secondCal = thickness + 0.01;
                        var thirdCal = diawidth * length * secondCal * response;
                        var fourthCal = thickness + 0.006;
                        var fiveCal = diawidth * length * fourthCal * response;
                        var sixCal = fiveCal * 20 / 100;
                        var sevenCal = firstCal + thirdCal + sixCal;
                        var getsurfaceArea = sevenCal;
                        if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                            var surfaceArea = parseFloat($("#weight"+row_countA).val(0));
                        }else{
                            var surfaceArea = parseFloat($("#weight"+row_countA).val(getsurfaceArea));
                            var getlabrate = getsurfaceArea * labrate;
                            var getmatrate = getsurfaceArea * matrate;
                            let total = getlabrate + getmatrate;
                            var totalrate = parseFloat($("#totalrate"+row_countA).val(total));
                        }
                    }else{
                        var surfaceArea = parseFloat($("#surfacearea"+row_countA).val(0));
                    }
                }
            })
		});
        // if click delete button removed row
        $(document).on('click', '.remove_row', function() {
            var row_countA = $(this).attr('data-row');
            $('#rowA'+row_countA).remove();
        });
    })
});
</script>
<?php /**PATH /home/ubmomanc/public_html/yugum.ubmoman.com/resources/views/mainbody/mainbodyjs.blade.php ENDPATH**/ ?>