function createcodes() {
var cols=0;
var returnStr="";

    $('#pumpreading tbody tr').each(function () {
        //processing this row
        //how to process each cell(table td) where there is checkbox
        cols=cols+1;
        //alert("Column "+cols);
        var pumpname='';
        var tankname='';
        var elec_cash=0;
        var elec_ltrs=0;
        var man_cash=0;
        var man_ltrs=0;
        var rtt=0;
        var dp=0;
        var dipltrs='';
        var crs_ltrs='';
        var doneby='';
        var shiftno='';
        var x=0;
        $(this).find('td input:text').each(function () {
          x=x+1;

          if(x==1){
            pumpname=$(this).val();
          }else if (x==2) {
            tankname=$(this).val();
          }else if (x==3) {
            elec_cash=$(this).val();
          }else if (x==4) {
              elec_ltrs=$(this).val();
          }else if (x==5) {
              man_cash=$(this).val();
          }else if (x==6) {
              man_ltrs=$(this).val();
          }else if (x==7) {
              rtt=$(this).val();
          }else if (x==8) {
              dp=$(this).val();
          }else if (x==9) {
              dipltrs=$(this).val();
          }else if (x==10) {
              crs_ltrs=$(this).val();
          }else if (x==11) {
              doneby=$(this).val();

          }else {
            shiftno=$(this).val();
              save_packData(pumpname,tankname,elec_cash,elec_ltrs,man_cash,man_ltrs,rtt,dp,dipltrs,crs_ltrs,shiftno,doneby);
          }

          //alert("Variance "+variance);
             // it is checked, your code here...
        });
    });

    $("#btn_save").html("Save Pump Data");
    $("#spinoff").removeClass("glyphicon-refresh glyphicon-refresh-animate");
    var alerted="<div class='alert alert-success'><strong>Success!</strong>Data Successfully Saved.</div>";
    $("#tablezone").html(alerted);

}





function save_packData(pumpname,tankname,elec_cash,elec_ltrs,man_cash,man_ltrs,rtt,dp,dipltrs,crs_ltrs,shiftno,doneby){

var itemData="pumpname="+pumpname+"&tankname="+tankname+"&elec_cash="+elec_cash+"&elec_ltrs="+elec_ltrs+"&man_cash="+man_cash+"&man_ltrs="+man_ltrs+"&rtt="+rtt+"&dp="+dp+"&dipltrs="+dipltrs+"&crs_ltrs="+crs_ltrs+"&shiftno="+shiftno+"&doneby="+doneby;
//alert(itemData);
  $.ajax({
      type:"POST",url:"post-edit.php",data:itemData,cache:false,
      success:function(response){
alert(response);
      }
  });


}


function looptable(){
  /*
  var row=0;
  $('#pumpreading tr').each(function(){
        //var cell = 'table tr:nth-child(' + row + ') td:nth-child(8)';
      //  alert(cell.text());
        row = row + 1;
    });
alert(row);
*/
createcodes();
}
