<script>
$().ready(function() {
    $(document).on("change", "#partid4", function() {
        var partid = parseFloat($("#partid4").val());
        var diawidth = parseFloat($("#diawidth4").val());
        var length = parseFloat($("#length4").val());
        var thickness = parseFloat($("#thickness4").val());
        var density = parseFloat($("#density4").val());
        var qty = parseFloat($("#qty4").val());
        var surfacearea = parseFloat($("#surfacearea4").val());
        var labrate = parseFloat($("#labrate4").val());
        var matrate = parseFloat($("#matrate4").val());
        var weight = parseFloat($("#weight4").val());

        if(partid == 1){ // shell
            var getsurfaceArea = 3.14 * length * qty * ((diawidth + (2 * thickness)));
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 5){ // flat dish
            var getsurfaceArea = 3.14 * qty * diawidth;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 9){ // bottom dish flat dish
            var getsurfaceArea = 3.14 * qty * diawidth;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 10){ // baffles
            var getsurfaceArea = diawidth * length * qty;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 11){ // baffles cleats
            var getsurfaceArea = diawidth * length * qty;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 12){ // L/COIL 40
            var getsurfaceArea = length * 0.07536;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 13){ // L/COIL 80
            var getsurfaceArea = length * 0.1395;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 14){ // jacket ribs
            var getsurfaceArea = length * 0.04;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else{
            var surfaceArea = parseFloat($("#surfacearea4").val(0));
        }
    });
    // press keyup quantity
    $(document).on("keyup", "#qty4", function() {
    console.log('hooo');

        var partid = parseFloat($("#partid4").val());
        var diawidth = parseFloat($("#diawidth4").val());
        var length = parseFloat($("#length4").val());
        var thickness = parseFloat($("#thickness4").val());
        var density = parseFloat($("#density4").val());
        var qty = parseFloat($("#qty4").val());
        var surfacearea = parseFloat($("#surfacearea4").val());
        var weight = parseFloat($("#weight4").val());
        var labrate = parseFloat($("#labrate4").val());
        var matrate = parseFloat($("#matrate4").val());

        if(partid == 1){ // shell
            var getsurfaceArea = 3.14 * length * qty * ((diawidth + (2 * thickness)));
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 5){ // flat dish
            var getsurfaceArea = 3.14 * qty * diawidth;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 9){ // bottom dish flat dish
            var getsurfaceArea = 3.14 * qty * diawidth;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 10){ // baffles
            var getsurfaceArea = diawidth * length * qty;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 11){ // baffles cleats
            var getsurfaceArea = diawidth * length * qty;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 12){ // L/COIL 40
            var getsurfaceArea = length * 0.07536;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 13){ // L/COIL 80
            var getsurfaceArea = length * 0.1395;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 14){ // jacket ribs
            var getsurfaceArea = length * 0.04;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else{
            var surfaceArea = parseFloat($("#surfacearea4").val(0));
        }
    });
    // diameter keyup calcualte
    $(document).on("keyup", "#diawidth4", function() {
        var partid = parseFloat($("#partid4").val());
        var diawidth = parseFloat($("#diawidth4").val());
        var length = parseFloat($("#length4").val());
        var thickness = parseFloat($("#thickness4").val());
        var density = parseFloat($("#density4").val());
        var qty = parseFloat($("#qty4").val());
        var surfacearea = parseFloat($("#surfacearea4").val());
        var weight = parseFloat($("#weight4").val());
        var labrate = parseFloat($("#labrate4").val());
        var matrate = parseFloat($("#matrate4").val());

        if(partid == 1){ // shell
            var getsurfaceArea = 3.14 * length * qty * ((diawidth + (2 * thickness)));
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 5){ // flat dish
            var getsurfaceArea = 3.14 * qty * diawidth;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 9){ // bottom dish flat dish
            var getsurfaceArea = 3.14 * qty * diawidth;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 10){ // baffles
            var getsurfaceArea = diawidth * length * qty;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 11){ // baffles cleats
            var getsurfaceArea = diawidth * length * qty;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 12){ // L/COIL 40
            var getsurfaceArea = length * 0.07536;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 13){ // L/COIL 80
            var getsurfaceArea = length * 0.1395;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 14){ // jacket ribs
            var getsurfaceArea = length * 0.04;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else{
            var surfaceArea = parseFloat($("#surfacearea4").val(0));
        }
    });
    // length keyup calcualte
    $(document).on("keyup", "#length4", function() {
        var partid = parseFloat($("#partid4").val());
        var diawidth = parseFloat($("#diawidth4").val());
        var length = parseFloat($("#length4").val());
        var thickness = parseFloat($("#thickness4").val());
        var density = parseFloat($("#density4").val());
        var qty = parseFloat($("#qty4").val());
        var surfacearea = parseFloat($("#surfacearea4").val());
        var weight = parseFloat($("#weight4").val());
        var labrate = parseFloat($("#labrate4").val());
        var matrate = parseFloat($("#matrate4").val());

        if(partid == 1){ // shell
            var getsurfaceArea = 3.14 * length * qty * ((diawidth + (2 * thickness)));
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 5){ // flat dish
            var getsurfaceArea = 3.14 * qty * diawidth;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 9){ // bottom dish flat dish
            var getsurfaceArea = 3.14 * qty * diawidth;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 10){ // baffles
            var getsurfaceArea = diawidth * length * qty;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 11){ // baffles cleats
            var getsurfaceArea = diawidth * length * qty;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 12){ // L/COIL 40
            var getsurfaceArea = length * 0.07536;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 13){ // L/COIL 80
            var getsurfaceArea = length * 0.1395;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 14){ // jacket ribs
            var getsurfaceArea = length * 0.04;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else{
            var surfaceArea = parseFloat($("#surfacearea4").val(0));
        }
    });
    // thickness keyup calculate
    $(document).on("keyup", "#thickness4", function() {
        var partid = parseFloat($("#partid4").val());
        var diawidth = parseFloat($("#diawidth4").val());
        var length = parseFloat($("#length4").val());
        var thickness = parseFloat($("#thickness4").val());
        var density = parseFloat($("#density4").val());
        var qty = parseFloat($("#qty4").val());
        var surfacearea = parseFloat($("#surfacearea4").val());
        var weight = parseFloat($("#weight4").val());
        var labrate = parseFloat($("#labrate4").val());
        var matrate = parseFloat($("#matrate4").val());

        if(partid == 1){ // shell
            var getsurfaceArea = 3.14 * length * qty * ((diawidth + (2 * thickness)));
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 5){ // flat dish
            var getsurfaceArea = 3.14 * qty * diawidth;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 9){ // bottom dish flat dish
            var getsurfaceArea = 3.14 * qty * diawidth;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 10){ // baffles
            var getsurfaceArea = diawidth * length * qty;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 11){ // baffles cleats
            var getsurfaceArea = diawidth * length * qty;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 12){ // L/COIL 40
            var getsurfaceArea = length * 0.07536;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 13){ // L/COIL 80
            var getsurfaceArea = length * 0.1395;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 14){ // jacket ribs
            var getsurfaceArea = length * 0.04;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else{
            var surfaceArea = parseFloat($("#surfacearea4").val(0));
        }
    });
    // lab rate keyup calculate
    $(document).on("keyup", "#labrate4", function() {
        var partid = parseFloat($("#partid4").val());
        var diawidth = parseFloat($("#diawidth4").val());
        var length = parseFloat($("#length4").val());
        var thickness = parseFloat($("#thickness4").val());
        var density = parseFloat($("#density4").val());
        var qty = parseFloat($("#qty4").val());
        var surfacearea = parseFloat($("#surfacearea4").val());
        var weight = parseFloat($("#weight4").val());
        var labrate = parseFloat($("#labrate4").val());
        var matrate = parseFloat($("#matrate4").val());

        if(partid == 1){ // shell
            var getsurfaceArea = 3.14 * length * qty * ((diawidth + (2 * thickness)));
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 5){ // flat dish
            var getsurfaceArea = 3.14 * qty * diawidth;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 9){ // bottom dish flat dish
            var getsurfaceArea = 3.14 * qty * diawidth;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 10){ // baffles
            var getsurfaceArea = diawidth * length * qty;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 11){ // baffles cleats
            var getsurfaceArea = diawidth * length * qty;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 12){ // L/COIL 40
            var getsurfaceArea = length * 0.07536;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 13){ // L/COIL 80
            var getsurfaceArea = length * 0.1395;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 14){ // jacket ribs
            var getsurfaceArea = length * 0.04;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else{
            var surfaceArea = parseFloat($("#surfacearea4").val(0));
        }
    });
    // mat rate keyup calculate
    $(document).on("keyup", "#matrate4", function() {
        var partid = parseFloat($("#partid4").val());
        var diawidth = parseFloat($("#diawidth4").val());
        var length = parseFloat($("#length4").val());
        var thickness = parseFloat($("#thickness4").val());
        var density = parseFloat($("#density4").val());
        var qty = parseFloat($("#qty4").val());
        var surfacearea = parseFloat($("#surfacearea4").val());
        var weight = parseFloat($("#weight4").val());
        var labrate = parseFloat($("#labrate4").val());
        var matrate = parseFloat($("#matrate4").val());

        if(partid == 1){ // shell
            var getsurfaceArea = 3.14 * length * qty * ((diawidth + (2 * thickness)));
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 5){ // flat dish
            var getsurfaceArea = 3.14 * qty * diawidth;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 9){ // bottom dish flat dish
            var getsurfaceArea = 3.14 * qty * diawidth;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 10){ // baffles
            var getsurfaceArea = diawidth * length * qty;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 11){ // baffles cleats
            var getsurfaceArea = diawidth * length * qty;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 12){ // L/COIL 40
            var getsurfaceArea = length * 0.07536;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 13){ // L/COIL 80
            var getsurfaceArea = length * 0.1395;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else if(partid == 14){ // jacket ribs
            var getsurfaceArea = length * 0.04;
            if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                var surfaceArea = parseFloat($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").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($("#surfacearea4").val(0));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }else{
                var surfaceArea = parseFloat($("#surfacearea4").val(getsurfaceArea));
                var getlabrate = weight * labrate;
                var getmatrate = weight * matrate;
                let total = getlabrate + getmatrate;
                var totalrate = parseFloat($("#totalrate4").val(total));
            }
        }else{
            var surfaceArea = parseFloat($("#surfacearea4").val(0));
        }
    });
    // Moc select option click
    $(document).on("change", "#moc4", function() {
        var moc = parseFloat($("#moc4").val());
        $.ajax({
            url:'{{ route("getmocvalue") }}',
            method:'POST',
            dataType:"json",
            data: {
                "_token": "{{ csrf_token() }}",
                id:moc,
            },
            success:function(response){
                // var moc = parseFloat($("#moc4").val());
                var partid = parseFloat($("#partid4").val());
                var diawidth = parseFloat($("#diawidth4").val());
                var length = parseFloat($("#length4").val());
                var thickness = parseFloat($("#thickness4").val());
                var density = parseFloat($("#density4").val(response));
                var qty = parseFloat($("#qty4").val());
                var surfacearea = parseFloat($("#surfacearea4").val());
                var labrate = parseFloat($("#labrate4").val());
                var matrate = parseFloat($("#matrate4").val());
                // var totalrate = parseFloat($("#totalrate4").val());

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

                        var totalrate = parseFloat($("#totalrate4").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($("#weight4").val(0));
                    }else{
                        var surfaceArea = parseFloat($("#weight4").val(getsurfaceArea));
                        var getlabrate = getsurfaceArea * labrate;
                        var getmatrate = getsurfaceArea * matrate;
                        let total = getlabrate + getmatrate;
                        var totalrate = parseFloat($("#totalrate4").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($("#weight4").val(0));
                    }else{
                        var surfaceArea = parseFloat($("#weight4").val(getsurfaceArea));
                        var getlabrate = getsurfaceArea * labrate;
                        var getmatrate = getsurfaceArea * matrate;
                        let total = getlabrate + getmatrate;
                        var totalrate = parseFloat($("#totalrate4").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($("#weight4").val(0));
                    }else{
                        var surfaceArea = parseFloat($("#weight4").val(getsurfaceArea));
                        var getlabrate = getsurfaceArea * labrate;
                        var getmatrate = getsurfaceArea * matrate;
                        let total = getlabrate + getmatrate;
                        var totalrate = parseFloat($("#totalrate4").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($("#weight4").val(0));
                    }else{
                        var surfaceArea = parseFloat($("#weight4").val(getsurfaceArea));
                        var getlabrate = getsurfaceArea * labrate;
                        var getmatrate = getsurfaceArea * matrate;
                        let total = getlabrate + getmatrate;
                        var totalrate = parseFloat($("#totalrate4").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($("#weight4").val(0));
                    }else{
                        var surfaceArea = parseFloat($("#weight4").val(getsurfaceArea));
                        var getlabrate = getsurfaceArea * labrate;
                        var getmatrate = getsurfaceArea * matrate;
                        let total = getlabrate + getmatrate;
                        var totalrate = parseFloat($("#totalrate4").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($("#weight4").val(0));
                    }else{
                        var surfaceArea = parseFloat($("#weight4").val(getsurfaceArea));
                        var getlabrate = getsurfaceArea * labrate;
                        var getmatrate = getsurfaceArea * matrate;
                        let total = getlabrate + getmatrate;
                        var totalrate = parseFloat($("#totalrate4").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($("#weight4").val(0));
                    }else{
                        var surfaceArea = parseFloat($("#weight4").val(getsurfaceArea));
                        var getlabrate = getsurfaceArea * labrate;
                        var getmatrate = getsurfaceArea * matrate;
                        let total = getlabrate + getmatrate;
                        var totalrate = parseFloat($("#totalrate4").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($("#weight4").val(0));
                    }else{
                        var surfaceArea = parseFloat($("#weight4").val(getsurfaceArea));
                        var getlabrate = getsurfaceArea * labrate;
                        var getmatrate = getsurfaceArea * matrate;
                        let total = getlabrate + getmatrate;
                        var totalrate = parseFloat($("#totalrate4").val(total));
                    }
                }else if(partid == 10){ // baffles
                    let getsurfaceArea = diawidth * length * thickness * response * qty;
                    if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                        var surfaceArea = parseFloat($("#weight4").val(0));
                    }else{
                        var surfaceArea = parseFloat($("#weight4").val(getsurfaceArea));
                        var getlabrate = getsurfaceArea * labrate;
                        var getmatrate = getsurfaceArea * matrate;
                        let total = getlabrate + getmatrate;
                        var totalrate = parseFloat($("#totalrate4").val(total));
                    }
                }else if(partid == 11){ // baffles cleats
                    let getsurfaceArea = diawidth * length * thickness * response * qty;
                    if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                        var surfaceArea = parseFloat($("#weight4").val(0));
                    }else{
                        var surfaceArea = parseFloat($("#weight4").val(getsurfaceArea));
                        var getlabrate = getsurfaceArea * labrate;
                        var getmatrate = getsurfaceArea * matrate;
                        let total = getlabrate + getmatrate;
                        var totalrate = parseFloat($("#totalrate4").val(total));
                    }
                }else if(partid == 12){ // L/COIL 40
                    var getsurfaceArea = length * 0.07536 * thickness * response;
                    if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                        var surfaceArea = parseFloat($("#weight4").val(0));
                    }else{
                        var surfaceArea = parseFloat($("#weight4").val(getsurfaceArea));
                        var getlabrate = getsurfaceArea * labrate;
                        var getmatrate = getsurfaceArea * matrate;
                        let total = getlabrate + getmatrate;
                        var totalrate = parseFloat($("#totalrate4").val(total));
                    }
                }else if(partid == 13){ // L/COIL 80
                    var getsurfaceArea = length * 0.1395 * thickness * response;
                    if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                        var surfaceArea = parseFloat($("#weight4").val(0));
                    }else{
                        var surfaceArea = parseFloat($("#weight4").val(getsurfaceArea));
                        var getlabrate = getsurfaceArea * labrate;
                        var getmatrate = getsurfaceArea * matrate;
                        let total = getlabrate + getmatrate;
                        var totalrate = parseFloat($("#totalrate4").val(total));
                    }
                }else if(partid == 14){ // jacket ribs
                    var getsurfaceArea = length * 0.04 * thickness * response;
                    if (getsurfaceArea === 0 || isNaN(getsurfaceArea)) {
                        var surfaceArea = parseFloat($("#weight4").val(0));
                    }else{
                        var surfaceArea = parseFloat($("#weight4").val(getsurfaceArea));
                        var getlabrate = getsurfaceArea * labrate;
                        var getmatrate = getsurfaceArea * matrate;
                        let total = getlabrate + getmatrate;
                        var totalrate = parseFloat($("#totalrate4").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($("#weight4").val(0));
                    }else{
                        var surfaceArea = parseFloat($("#weight4").val(getsurfaceArea));
                        var getlabrate = getsurfaceArea * labrate;
                        var getmatrate = getsurfaceArea * matrate;
                        let total = getlabrate + getmatrate;
                        var totalrate = parseFloat($("#totalrate4").val(total));
                    }
                }else{
                    var surfaceArea = parseFloat($("#surfacearea4").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>
