EVOLUTION-NINJA
Edit File: multiple_site_level.php
<?php $this->load->view('includes/header'); ?> <!----------------------------- Left MENU END ---------------------------------------------------> <!-- Content Wrapper. Contains page content --> <script src="https://cdnjs.cloudflare.com/ajax/libs/colresizable/1.6.0/colResizable-1.6.min.js" crossorigin="anonymous"></script> <div class="" > <div class="content-header"> <div class="container-fluid"> <div class="row mb-2"> <div class="col-sm-6"> <?php $id = $this->session->userdata('id');?> </div> <div class="col-sm-6"> <ol class="breadcrumb float-sm-right"> <li class="breadcrumb-item"><a href="#">Design</a></li> <li class="breadcrumb-item"> New Design </li> </ol> </div> </div> </div> </div> <section class="content"> <form class="add_form" enctype="multipart/form-data" style="padding-top:1%; !important;"> <input type="hidden" class="click_ids" > <input type="hidden" class="type" > <div class="row"> <div class="col-sm-1"> </div> <div class="col-sm-2" style="text-align: center;"> </div> <div class="col-sm-2"> <div class="form-group" style="text-align: right; padding-top: 13px;"> <label for="name">Design Name:</label> </div> </div> <div class="col-sm-3"> <div class="form-group"> <input type="text" class="form-control heading_table" name="heading_table" required="required"> </div> </div> <div class="col-sm-1"> </div> </div> <div class="row"> <div class="col-sm-1"> </div> <div class="col-sm-1" style="text-align: center;"> <label style="padding-top: 45px;">GF</label> </div> <div class="col-sm-3"> <div class="form-group"> <label>Built Up</label> <div class="yes_form"> <input type="text" class="form-control gf_built_up" name="gf_built_up" > </div> </div> </div> <div class="col-sm-3"> <div class="form-group"> <label>Semi Buildup Area</label> <div class="yes_form"> <input style="" type="text" class="form-control gf_balcony" name="gf_balcony" > </div> </div> </div> <div class="col-sm-3"> <div class="form-group"> <label>Days</label> <div class="yes_form"> <input type="text" class="form-control gf_days" name="gf_days" > </div> </div> </div> <div class="col-sm-1"> </div> </div> <div class="row"> <div class="col-sm-1"> </div> <div class="col-sm-1" style="text-align: center;"> <label style="padding-top: 45px;">GF+MF</label> </div> <div class="col-sm-3"> <div class="form-group"> <label></label> <div class="yes_form"> <input type="text" class="form-control gf_mf_built_up" name="gf_mf_built_up" value="0"> </div> </div> </div> <div class="col-sm-3"> <div class="form-group"> <label ></label> <div class="yes_form"> <input type="text" class="form-control gf_mf_balcony" name="gf_mf_balcony" value="0"> </div> </div> </div> <div class="col-sm-3"> <div class="form-group"> <label ></label> <div class="yes_form"> <input type="text" class="form-control gf_mf_days" name="gf_mf_days" > </div> </div> </div> <div class="col-sm-1"> </div> </div> <!------row---> <div class="row"> <!--<div class="col-sm-1"> </div>--> <div class="append_div_resp"> <div class="append_div"> <div class="table-responsive"> <table id="normal" > <thead> <tr> <th style="display: flex; border: none !important;white-space: newrap;font-size: 13px;"> <a class="add_new_item" style="padding-right: 5px;"> <label class="texttype first_div">A</label> </a> <a class="add_new_item first_div"><label class="texttype">T</a> </th> <th style="font-size: 13px;">Add / Remove</th> <th style="font-size: 13px;width: 40px;">TYPE</th> <th style="font-size: 13px;width: 40px;">WORK NAME</th> <th style="font-size: 13px;width: 40px;">LEVEL</th> <th style="font-size: 13px;width: 30px;">PRODUCT TYPE</th> <th style="font-size: 13px;width: 30px;">MATERIAL</th> <th style="font-size: 13px;width: 100px;">L</th> <th style="font-size: 13px;width: 100px;">B</th> <th style="font-size: 13px;width: 100px;">D</th> <th style="font-size: 13px;width: 100px;">NO</th> <th style="font-size: 13px;width: 40px;">TOTAL</th> <th style="font-size: 13px;width: 00px;">UNIT/TOTAL</th> <th style="font-size: 13px;width: 00px;">RATIO/UNIT</th> <th style="font-size: 13px;width: 40px;">R.F</th> <th style="font-size: 13px;width: 40px;">QTY</th> <th style="font-size: 13px;width: 40px;">UNIT/QTY</th> <th style="font-size: 13px;width: 40px;">RATE/UNIT</th> <th style="font-size: 13px;width: 40px;">TAMT</th> <th style="width: 50px;">GST</th> <th style="font-size: 13px;width: 40px;">GST AMT</th> <th style="font-size: 13px;width: 40px;">FINAL AMOUNT</th> <!-- <th>LABOUR CHARGES WITOUT GST</th> <th>LABOUR CHARGES 40% WITOUT GST</th> --> </tr> </thead> <tbody> </tbody> </table> </div> <div class="append_submit"></div> </div> </div> <!--<div class="col-sm-1"> </div>--> </div> </form> </section> <!-- /.content --> </div> <!-- /.content-wrapper --> <script> $("#normal").colResizable({ liveDrag:true, gripInnerHtml:"<div class='grip'></div>", draggingClass:"dragging", resizeMode:'fit' }); $(document).keypress( function(event){ if (event.which == '13') { event.preventDefault(); } }); var inc_num=1; var click_count = 0 ; $('.add_new_item').click(function(e) { e.preventDefault(); var seleted_data = $(this).find('.texttype').text(); if(seleted_data!='') { var con=''; if(seleted_data=='T') { $.ajax({ type : 'post', url : '<?php echo site_url("get-level")?>', success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { $('.first_div').hide(); con+='<tr>'; con+='<td style="text-align: center;white-space: newrap;"><a class="second_add_new_item aaa'+click_count+' bbb" style="padding-right:10px; " number='+click_count+'><label class="texttype">A</label></a><a class="second_add_new_item aaa'+click_count+' bbb" number='+click_count+'><label class="texttype">T</a></td>'; con+='<td style="text-align: center"><input type="hidden" name="row_count[]" class="row_count" value="'+inc_num+'"><a><i onclick="add_row('+click_count+',1);" class="fa fa-plus-circle add-officer-row'+inc_num+' append_officer_row'+click_count+'" aria-hidden="true" style="color:#C90000"></i></a</td>'; con+='<td> <select style="width:45px;" name="select_type[]" class="selection_data'+click_count+'" id="selection_data" ><option value="" disabled>Select</option><option value="Type of work" selected>Type of work</option><option value="Annexure" disabled>Annexure</option></select></td>'; con+='<td><input type="text" class="type_of_work_name'+click_count+'" name="type_of_work_name[]" style="width:65px;background-color:white !important;height:30px;"></td>'; con+='<td><select name="level_id[]" style="width:120px;" class="level_id'+click_count+'">'; con+= '<option value="">Select</option>'; $.each(response.message,function(index,val) { con+= '<option value="'+val.id+'">'+val.level_name+'</option>'; }); con+='</td>'; con+='<td> <select name="product_group_id[]" class="product_group_id'+click_count+'" style="width: 180px;" number='+click_count+'>'; con+= '<option value="">Select</option>'; $.each(response.products,function(index,val) { con+= '<option value="'+val.product_group_id+'">'+val.product_group_name+'</option>'; }); con+='</td>'; con+='<td style="width: 80px; border: initial;" class="product_id'+click_count+'" number='+click_count+'></td>'; con+='<td style="padding:0 !important;"><input type="text" class="l_name'+inc_num+'" onkeyup="total_calculate('+inc_num+')" name="l_name[]" style="width: 100%; border: initial; background-color:white !important;height:25px;" placeholder="Length"></td>'; con+='<td><input type="text" class="b_name'+inc_num+'" onkeyup="total_calculate('+inc_num+')" name="b_name[]" placeholder="Breadth" style="width: 100%; border: initial; background-color:white !important;height:25px;"></td>'; con+='<td><input type="text" class="d_name'+inc_num+'" name="d_name[]" placeholder="Depth" onkeyup="total_calculate('+inc_num+')" style="width: 100%; border: initial; background-color:white !important;height:25px;"></td>'; con+='<td><input type="text" class="no_name'+inc_num+'" onkeyup="total_calculate('+inc_num+')" name="no_name[]" placeholder="Number" style="width: 100%; border: initial; background-color:white !important;height:25px;"></td>'; con+='<td><input type="text" class="total_name'+inc_num+'" name="total_name[]" placeholder="Total" onkeyup="total_calculate('+inc_num+')" style="width: 100%; border: initial;height:25px;" readonly></td>'; con+='<td style="width: 80px; border: initial;"><input type="text" class="first_unit_ids_'+click_count+' unit_name'+inc_num+'" number='+click_count+' name="unit_id[]" style="width: 100%; border: initial; background-color:white !important;height:30px;;" placeholder="Unit/Total" onkeyup="total_calculate('+inc_num+')" ></td>'; con+='<td><input type="text" class="ratio_unit'+inc_num+'" name="ratio_name[]" style="width: 100%; border: initial; background-color:white !important;height:25px;" placeholder="Ratio/Unit" onkeyup="total_calculate('+inc_num+')"></td>'; con+='<td><input type="text"class="rf'+inc_num+'" name="rf_name[]" style="width: 100%; border: initial; background-color:white !important;height:25px;" placeholder="R.F" onkeyup="total_calculate('+inc_num+')" ></td>'; con+='<td><input type="text" class="qty_name'+inc_num+'" name="qty_name[]" placeholder="QTY" style="width: 100%; border: initial;height:25px;" readonly></td>'; con+='<td><input type="text" class="first_unit_ids_'+click_count+'" number='+click_count+' name="unit_qty_name[]" placeholder="Unit/QTY" style="width: 100%; border: initial;height:30px;" readonly>'; /*<select name="unit_qty_name[]" class="first_unit_ids_'+click_count+'" number='+click_count+' style="width:120px;" readonly>'; con+= '<option value="">Select</option>'; $.each(response.unit,function(index,val) { con+= '<option value="'+val.unit_name+'">'+val.unit_name+'</option>'; }); con+='</td>';*/ con+='<td><input type="text" class="rate_unit_name'+inc_num+' unit_rate'+click_count+'" onkeyup="total_calculate('+inc_num+')" name="rate_unit_name[]" style="width: 100%; border: initial;background-color:white !important;height:30px;" placeholder="Rate/Unit" ></td>'; con+='<td><input type="text" class="tamt_name'+inc_num+'" name="tamt_name[]" style="width: 100%; border: initial;height:25px;" placeholder="TAMT" readonly></td>'; con+='<td style="display:flex; border-bottom: none !important; border-left: none !important; border-right: none !important;background-color:white !important;height:25px;"><input type="text" class="gst_name'+inc_num+' gst'+click_count+'" onkeyup="total_calculate('+inc_num+')" name="gst_name[]" style="width: 100%; border: initial;background-color:white !important;height:25px;" placeholder="GST" >%</td>'; con+='<td><input type="text" class="gst_amt_name'+inc_num+'" name="gst_amt_name[]" style="width: 100%; border: initial;height:25px;" placeholder="GST AMT" readonly></td>'; con+='<td><input type="text" class="final_amount_name'+inc_num+'" name="final_amount_name[]" style="width: 100%; border: initial;height:25px;" placeholder="Final AMT" readonly><input type="hidden" class="" name="meterial[]" value="0"></td>'; con +='</tr>'; $('table tbody').append(con); $(document).on('change','.product_group_id'+click_count,function(e) { var number = $(this).attr('number'); var product_group_id = $(this).val(); $.ajax({ url:"<?php echo site_url('Get-products-based-product-group')?>", type:"POST", data:{'product_group_id':product_group_id}, async:false, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { var content = ''; content += '<select class="second_product'+number+'" name="product_id[]" style="width:180px;" number='+number+'>' content += '<option>Select</option>'; $.each(response.message,function(idx,vx) { content += '<option value="'+vx.product_id+'">'+vx.product_name+'</option>'; }); content += '</select>'; $('.product_id'+number).empty(); $('.product_id'+number).append(content); } else { $('.product_id'+number).empty(); toastr['error']('No Products Added'); } } }); }); $(document).on('change','.second_product'+click_count,function(e) { var number = $(this).attr('number'); var product_id = $(this).val(); $.ajax({ url:"<?php echo site_url('Get-product-based-units')?>", type:"POST", data:{'product_id':product_id}, async:false, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { var unit_price = []; $.each(response.message,function(idx,vx) { var cgst = vx.cgst; var sgst = vx.sgst; var igst = vx.igst; var total_gst = parseFloat(cgst)+parseFloat(sgst)+parseFloat(igst); $('.gst'+number).empty(); $('.gst'+number).val(total_gst); var unit_name = vx.unit_name; $('.first_unit_ids_'+number).empty(); $('.first_unit_ids_'+number).val(unit_name); unit_price.push(vx.vendor_unit_price); }); var higthest_unit_price= Math.max.apply(Math,unit_price); $('.unit_rate'+number).empty(); $('.unit_rate'+number).val(higthest_unit_price); } else { $('.gst'+number).empty(); $('.unit_rate'+number).empty(); $('.first_unit_ids_'+number).empty(); toastr['error']('No Units Added'); } } }); }); click_count++; } } }); } else { $('.first_div').hide(); con+=' <tr>'; con+='<td style="text-align: center;white-space: newrap;""><a class="second_add_new_item aaa'+click_count+'" style="padding-right:10px;" number='+click_count+'><label class="texttype">A</label></a><a class="second_add_new_item '+click_count+'" number='+click_count+'><label class="texttype">T</a></td>';con+='<td style="text-align: center"><input type="hidden" name="row_count[]" class="row_count" value="'+inc_num+'"><a><i onclick="add_row('+click_count+',0);" class="fa fa-plus-circle add-officer-row'+inc_num+' append_officer_row'+click_count+'" aria-hidden="true" style="color:#C90000"></i></a></td>'; con +='<td><select style= "width:45px;" name="select_type[]" class="selection_data'+click_count+'" id="selection_data" ><option value="" disabled>Select</option><option value="Type of work" disabled>Type of work</option><option value="Annexure" selected>Annexure</option></select></td>'; con+='<td><input type="text" class="anexture_name'+click_count+'" name="type_of_work_name[]" style="width:65px;background-color:white !important;height:30px;" ></td>'; con +='<td colspan="17"><textarea class="form-control" name="meterial[]" style="background-color:white!important;height:50px;" placeholder="texting all the text"></textarea>'; con+='<input type="hidden" class="" name="l_name[]"><input type="hidden" class="" name="b_name[]"><input type="hidden" class="" name="d_name[]"><input type="hidden" class="" name="no_name[]"><input type="hidden" class="" name="total_name[]"><input type="hidden" class="" name="unit_id[]"><input type="hidden" class="" name="ratio_name[]"><input type="hidden" class="" name="rf_name[]"><input type="hidden" class="" name="qty_name[]"><input type="hidden" class="" name="unit_qty_name[]"><input type="hidden" name="rate_unit_name[]"><input type="hidden" class="" name="tamt_name[]"><input type="hidden" class="" name="gst_name[]"><input type="hidden" class="" name="gst_amt_name[]"><input type="hidden" class="" name="final_amount_name[]"><input type="hidden" class="" name="l_c_without_gst_name[]"><input type="hidden" class="" name="l_c_fourty_without_gst_name[]"><input type="hidden" class="" name="product_id[]"><input type="hidden" class="" name="product_group_id[]"><input type="hidden" class="" name="level_id[]">'; con+='</td>'; con+='<td></td>'; con +='</tr>'; } $('table tbody').append(con); $('.append_submit').empty(); var con2 =''; con2 +='<div class="row">'; con2 +='<div class="col-sm-12" style="text-align:center; margin-top:20px;">'; con2 +='<button type="submit" class="btn btn-primary add_new_item">Submit</button>'; con2 +='</div>'; con2 +='</div>'; $('.append_submit').append(con2); inc_num++; var inputs = $(".row_count"); for(var i = 0; i < inputs.length; i++) { $(inputs[i]).val(''); var f_index=i+1; var id = $(inputs[i]).val(f_index); } } else { alert('Please select any option'); } }); var clicks = 0; $(document).on('click','.second_add_new_item',function(e) { e.preventDefault(); var seleted_data = $(this).find('.texttype').text(); var number = $(this).attr('number'); clicks++; if(seleted_data!='') { var con=''; if(seleted_data=='T') { $.ajax({ type : 'post', url : '<?php echo site_url("get-level")?>', success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { $('.first_div').hide(); con+='<tr>'; con+='<td style="text-align: center"><a class="second_add_new_item bbb'+clicks+'" style="padding-right:10px;" number='+clicks+'><label class="texttype">A</label></a><a class="second_add_new_item bbb'+clicks+'" number='+clicks+'><label class="texttype">T</a></td>'; con+='<td style="text-align: center"><input type="hidden" name="row_count[]" class="row_count" value="'+inc_num+'"><a><i onclick="add_row('+clicks+',1);" class="fa fa-plus-circle add-officer-row'+inc_num+' append_officer_row'+clicks+'" aria-hidden="true" style="color:#C90000"></i></a> <a><i onclick="remove_row('+inc_num+');" class="fa fa-minus-circle remove-officer-button'+inc_num+'" aria-hidden="true" style="color:purple"></i></a></td>'; con+='<td> <select style= "width:45px;" name="select_type[]" class="selection_data'+clicks+'" id="selection_data" ><option value="" disabled>Select</option><option value="Type of work" selected>Type of work</option><option value="Annexure" disabled>Annexure</option></select></td>'; con+='<td><input type="text" class="type_of_work_name'+clicks+'" name="type_of_work_name[]" placeholder="Work Name" style="width:65px;background-color:white !important;height:30px;"></td>'; con+='<td><select name="level_id[]" style="width:120px;" class="level_id'+clicks+'">'; con+= '<option value="">Select</option>'; $.each(response.message,function(index,val) { con+= '<option value="'+val.id+'">'+val.level_name+'</option>'; }); con+='</td>'; con+='<td> <select name="product_group_id[]" class="product_group_ids'+clicks+'" number='+clicks+' style="width: 120px;">'; con+= '<option value="">Select</option>'; $.each(response.products,function(index,val) { con+= '<option value="'+val.product_group_id+'">'+val.product_group_name+'</option>'; }); con+='</td>'; con+='<td style="width:50px; border: initial;" class="product_ids_'+clicks+'" number='+clicks+'></td>'; con+='<td><input type="text" class="l_name'+inc_num+'" onkeyup="total_calculate('+inc_num+')" name="l_name[]" style="width: 100%; border: initial; background-color:white !important;height:25px;" placeholder="Length"></td>'; con+='<td><input type="text" class="b_name'+inc_num+'" onkeyup="total_calculate('+inc_num+')" name="b_name[]" style="width: 100%; border: initial;background-color:white !important;height:25px;" placeholder="Breadth"></td>'; con+='<td><input type="text" class="d_name'+inc_num+'" name="d_name[]" style="width: 100%; border: initial;background-color:white !important;height:25px;" placeholder="Depth" onkeyup="total_calculate('+inc_num+')"></td>'; con+='<td><input type="text" class="no_name'+inc_num+'" onkeyup="total_calculate('+inc_num+')" name="no_name[]" style="width: 100%; border: initial;background-color:white !important;height:25px;" placeholder="Number"></td>'; con+='<td><input type="text" class="total_name'+inc_num+'" name="total_name[]" style="width: 100%; border: initial;height:30px;" placeholder="Total" onkeyup="total_calculate('+inc_num+')" readonly></td>'; con+='<td style="width: 80px; border: initial;"><input type="text" name="unit_id[]" style="width: 100%; border: initial;background-color:white !important;height:30px;" class="second_unit_ids_'+clicks+' unit_name'+inc_num+'" number='+clicks+' placeholder="Unit/Total"></td>'; //con+='<td><input type="text" class="" name="unit_name[]" style="width: 100%; border: initial;"></td>'; con+='<td><input type="text" class="ratio_unit'+inc_num+'" name="ratio_name[]" style="width: 100%; border: initial;background-color:white !important;height:25px;" placeholder="Ratio/Unit" onkeyup="total_calculate('+inc_num+')"></td>'; con+='<td><input type="text" class="rf'+inc_num+'" name="rf_name[]" style="width: 100%; border: initial;background-color:white !important;height:25px;" placeholder="R.F" onkeyup="total_calculate('+inc_num+')"></td>'; con+='<td><input type="text" class="qty_name'+inc_num+'" name="qty_name[]" style="width: 80px; border: initial;height:25px;" placeholder="QTY" onkeyup="total_calculate('+inc_num+')" readonly></td>'; con+='<td><input type="text" class="second_unit_ids_'+clicks+'" name="unit_qty_name[]" style="width: 100%; border: initial;" placeholder="Unit/QTY" readonly></td>'; /*con+='<td><select name="unit_qty_name[]" style="width:120px;">'; con+= '<option value="">Select</option>'; $.each(response.unit,function(index,val) { con+= '<option value="'+val.unit_name+'">'+val.unit_name+'</option>'; }); con+='</td>';*/ con+='<td><input type="text" class="rate_unit_name'+inc_num+' second_unit_rate'+clicks+'" onkeyup="total_calculate('+inc_num+')" name="rate_unit_name[]" style="width: 100%; border: initial;background-color:white !important;height:25px;" placeholder="Rate/Unit" ></td>'; con+='<td><input type="text" class="tamt_name'+inc_num+'" name="tamt_name[]" style="width: 100%; border: initial;height:25px;" placeholder="TAMT" readonly></td>'; con+='<td style="display:flex; border-bottom: none !important; border-left: none !important; border-right: none !important;"><input type="text" class="gst_name'+inc_num+' second_gst'+clicks+'" onkeyup="total_calculate('+inc_num+')" name="gst_name[]" style="width: 100%; border: initial;background-color:white !important;height:25px;" placeholder="GST">%</td>'; con+='<td><input type="text" class="gst_amt_name'+inc_num+'" name="gst_amt_name[]" style="width: 100%; border: initial;height:25px;" placeholder="GST AMT" readonly></td>'; con+='<td><input type="text" class="final_amount_name'+inc_num+'" name="final_amount_name[]" style="width: 100%; border: initial;height:25px;" placeholder="Final AMT" readonly><input type="hidden" class="" name="meterial[]" value="0"></td>'; con +='</tr>'; /*$(document).ready(function() { $("#product_name" ).autocomplete({ source: '<?php echo site_url("auto-complete-product-name"); ?>', }); });*/ //$('table tbody').append(con); $('.aaa'+number).closest('tr').after(con); $('.bbb'+number).closest('tr').after(con); // $('.aaa').closest('tr').after(con); $('.product_group_ids'+clicks).on('change',function() { var number = $(this).attr('number'); var product_group_id = $(this).val(); $.ajax({ url:"<?php echo site_url('Get-products-based-product-group')?>", type:"POST", data:{'product_group_id':product_group_id}, async:false, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { var content1 = ''; content1 += '<select class="second_product'+number+'" style="width:180px;" number='+number+' name="product_id[]">'; content1 += '<option>Select</option>'; $.each(response.message,function(idx,vx1) { content1 += '<option value="'+vx1.product_id+'">'+vx1.product_name+'</option>'; }); content1 += '</select>'; $('.product_ids_'+number).empty(); $('.product_ids_'+number).append(content1); } else { $('.product_ids_'+number).empty(); toastr['error']('No Products Added'); } } }); }); $(document).on('change','.second_product'+clicks,function(e) { var number = $(this).attr('number'); var product_id = $(this).val(); $.ajax({ url:"<?php echo site_url('Get-product-based-units')?>", type:"POST", data:{'product_id':product_id}, async:false, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { var unit_price = []; $.each(response.message,function(idx,vx) { var cgst = vx.cgst; var sgst = vx.sgst; var igst = vx.igst; var total_gst = parseFloat(cgst)+parseFloat(sgst)+parseFloat(igst); $('.second_gst'+number).empty(); $('.second_gst'+number).val(total_gst); var unit_name = vx.unit_name; $('.second_unit_ids_'+number).empty(); $('.second_unit_ids_'+number).val(unit_name); unit_price.push(vx.vendor_unit_price); }); var higthest_unit_price= Math.max.apply(Math,unit_price); $('.second_unit_rate'+number).empty(); $('.second_unit_rate'+number).val(higthest_unit_price); } else { $('.second_gst'+number).empty(); $('.second_unit_rate'+number).empty(); $('.second_unit_ids_'+number).empty(); toastr['error']('No Units Added'); } } }); }); } } }); } else { con+=' <tr>'; con+='<td style="text-align: center"><a class="second_add_new_item bbb'+clicks+'" style="padding-right:10px;" number='+clicks+'><label class="texttype">A</label></a><a class="second_add_new_item bbb'+clicks+'" number='+clicks+'><label class="texttype">T</a></td>'; con+='<td style="text-align: center"><input type="hidden" name="row_count[]" class="row_count" value="'+inc_num+'"><a><i onclick="add_row('+clicks+',0);" class="fa fa-plus-circle add-officer-row'+inc_num+' append_officer_row'+clicks+'" aria-hidden="true" style="color:#C90000"></i></a> <a><i onclick="remove_row('+inc_num+');" class="fa fa-minus-circle remove-officer-button'+inc_num+'" aria-hidden="true" style="color:purple"></i></a></td>'; con +='<td><select style= "width:45px;" name="select_type[]" class="selection_data'+clicks+'" id="selection_data" ><option value="" disabled>Select</option><option value="Type of work" disabled>Type of work</option><option value="Annexure" selected>Annexure</option></select></td>'; con+='<td><input type="text" class="anexture_name'+clicks+'" name="type_of_work_name[]" style="width:65px;background-color:white !important;height:30px;"></td>'; con +='<td colspan="17"><textarea class="form-control" name="meterial[]" style="background-color:white!important;height:50px;" placeholder="texting all the text"></textarea>'; con+='<input type="hidden" class="" name="l_name[]"><input type="hidden" class="" name="b_name[]"><input type="hidden" class="" name="d_name[]"><input type="hidden" class="" name="no_name[]"><input type="hidden" class="" name="total_name[]"><input type="hidden" class="" name="unit_id[]"><input type="hidden" class="" name="ratio_name[]"><input type="hidden" class="" name="rf_name[]"><input type="hidden" class="" name="qty_name[]"><input type="hidden" class="" name="unit_qty_name[]"><input type="hidden" name="rate_unit_name[]"><input type="hidden" class="" name="tamt_name[]"><input type="hidden" class="" name="gst_name[]"><input type="hidden" class="" name="gst_amt_name[]"><input type="hidden" class="" name="final_amount_name[]"><input type="hidden" class="" name="l_c_without_gst_name[]"><input type="hidden" class="" name="l_c_fourty_without_gst_name[]"><input type="hidden" class="" name="product_id[]"><input type="hidden" class="" name="product_group_id[]"><input type="hidden" class="" name="level_id[]">'; con+='</td>'; con +='</tr>'; } $('.aaa'+number).closest('tr').after(con); $('.bbb'+number).closest('tr').after(con); $('.append_submit').empty(); var con2 =''; con2 +='<div class="row">'; con2 +='<div class="col-sm-12" style="text-align:center; margin-top:20px;">'; con2 +='<button type="submit" class="btn btn-primary add_new_item">Submit</button>'; con2 +='</div>'; con2 +='</div>'; $('.append_submit').append(con2); inc_num++; var inputs = $(".row_count"); for(var i = 0; i < inputs.length; i++) { $(inputs[i]).val(''); var f_index=i+1; var id = $(inputs[i]).val(f_index); } } else { alert('Please select any option'); } }); $(document).on('click','.remove-officer-button',function(e) { var number = $(this).attr('number'); var whichtr = $('.remove_officer_row'+number).closest("tr"); whichtr.remove(); var inputs = $(".row_count"); for(var i = 0; i < inputs.length; i++) { $(inputs[i]).val(''); var f_index=i+1; var id = $(inputs[i]).val(f_index); } }); $(document).on('click','.officer_second_add_new_item',function(e) { e.preventDefault(); var seleted_data = $(this).find('.texttype').text(); var number = $(this).attr('number'); officer_click++; if(seleted_data!='') { var con=''; if(seleted_data=='T') { $.ajax({ type : 'post', url : '<?php echo site_url("get-level")?>', success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { con+='<tr>'; con+='<td style="text-align: center"><a class="officer_second_add_new_item third_row'+officer_click+'" style="padding-right:10px;" number='+officer_click+'><label class="texttype">A</label></a><a class="officer_second_add_new_item third_row'+officer_click+'" number='+officer_click+'><label class="texttype">T</a></td>'; con+='<td style="text-align: center"><input type="hidden" name="row_count[]" class="row_count" value="'+inc_num+'"><a><i onclick="add_row('+officer_click+',1);" class="fa fa-plus-circle add-officer-row'+inc_num+' append_officer_row'+officer_click+'" aria-hidden="true" style="color:#C90000"></i></a> <a><i onclick="remove_row('+inc_num+');" class="fa fa-minus-circle remove-officer-button'+inc_num+'" aria-hidden="true" style="color:purple"></i></a></td>'; con+='<td> <select style= "width:45px;" name="select_type[]" class=" selection_data" id="selection_data" ><option value="" disabled>Select</option><option value="Type of work" selected>Type of work</option><option value="Annexure" disabled>Annexure</option></select></td>'; con+='<td><input type="text" class="type_of_work_name'+officer_click+'" name="type_of_work_name[]" placeholder="Work Name" style="width:65px;background-color:white !important;height:30px;"></td>'; con+='<td><select name="level_id[]" style="width:120px;" class="level_id'+officer_click+'">'; con+= '<option value="">Select</option>'; $.each(response.message,function(index,val) { con+= '<option value="'+val.id+'">'+val.level_name+'</option>'; }); con+='</td>'; con+='<td> <select name="product_group_id[]" class="product_group_ids'+officer_click+'" number='+officer_click+' style="width: 180px;">'; con+= '<option value="">Select</option>'; $.each(response.products,function(index,val) { con+= '<option value="'+val.product_group_id+'">'+val.product_group_name+'</option>'; }); con+='</td>'; con+='<td style="width: 80px; border: initial;" class="product_ids_'+officer_click+'" number='+officer_click+'></td>'; con+='<td><input type="text" class="l_name'+inc_num+'" onkeyup="total_calculate('+inc_num+')" name="l_name[]" style="width: 100%; border: initial;background-color:white !important;height:25px;" placeholder="Length"></td>'; con+='<td><input type="text" class="b_name'+inc_num+'" onkeyup="total_calculate('+inc_num+')" name="b_name[]" style="width: 100%; border: initial;background-color:white !important;height:25px;" placeholder="Breadth"></td>'; con+='<td><input type="text" class="d_name'+inc_num+'" name="d_name[]" style="width: 100%; border: initial;background-color:white !important;height:25px;" placeholder="Depth" onkeyup="total_calculate('+inc_num+')"></td>'; con+='<td><input type="text" class="no_name'+inc_num+'" onkeyup="total_calculate('+inc_num+')" name="no_name[]" style="width: 100%; border: initial;background-color:white !important;height:25px;" placeholder="Number"></td>'; con+='<td><input type="text" class="total_name'+inc_num+'" name="total_name[]" style="width: 100%; border: initial;height:25px;" placeholder="Total" readonly></td>'; con+='<td style="width: 80px; border: initial;"><input type="text" name="unit_id[]" style="width: 100%; border: initial;background-color:white !important;height:25px;" class="second_unit_ids_'+officer_click+' unit_name'+inc_num+'" number='+officer_click+' placeholder="Unit/Total" ></td>'; con+='<td><input type="text" class="ratio_unit'+inc_num+'" name="ratio_name[]" style="width: 100%; border: initial;background-color:white !important;height:25px;" placeholder="Ratioo/Unit" onkeyup="total_calculate('+inc_num+')"></td>'; con+='<td><input type="text" class="rf'+inc_num+'" name="rf_name[]" style="width: 100%; border: initial;background-color:white !important;height:25px;" placeholder="R.F" onkeyup="total_calculate('+inc_num+')"></td>'; con+='<td><input type="text" class="qty_name'+inc_num+'" name="qty_name[]" style="width: 80px; border: initial;height:25px;" placeholder="QTY" readonly></td>'; con+='<td><input type="text" class="second_unit_ids_'+officer_click+'" name="unit_qty_name[]" style="width: 100%; border: initial;" readonly placeholder="Unit/QTY" ></td>'; /* con+='<td><select name="unit_qty_name[]" style="width:120px;" >'; con+= '<option value="">Select</option>'; $.each(response.unit,function(index,val) { con+= '<option value="'+val.unit_name+'">'+val.unit_name+'</option>'; }); con+='</td>';*/ con+='<td><input type="text" class="rate_unit_name'+inc_num+' second_unit_rates'+officer_click+'" onkeyup="total_calculate('+inc_num+')" name="rate_unit_name[]" style="width: 100%; border: initial;background-color:white !important;height:25px;" placeholder="Rate/Unit" onkeyup="total_calculate('+inc_num+')"></td>'; con+='<td><input type="text" class="tamt_name'+inc_num+'" name="tamt_name[]" style="width: 100%; border: initial;height:25px;" placeholder="TAMT" readonly></td>'; con+='<td style="display:flex; border-bottom: none !important; border-left: none !important; border-right: none !important;"><input type="text" class="gst_name'+inc_num+' fourth_gst'+officer_click+'" onkeyup="total_calculate('+inc_num+')" name="gst_name[]" style="width: 100%; border: initial;background-color:white !important;height:25px;" placeholder="GST">%</td>'; con+='<td><input type="text" class="gst_amt_name'+inc_num+'" name="gst_amt_name[]" style="width: 100%; border: initial;height:25px;" placeholder="GST AMT" readonly></td>'; con+='<td><input type="text" class="final_amount_name'+inc_num+'" name="final_amount_name[]" style="width: 100%; border: initial;height:25px;" placeholder="Final AMT" readonly><input type="hidden" class="" name="meterial[]" value="0"></td>'; con +='</tr>'; $('.third_row'+number).closest('tr').after(con); $('.second_rows'+number).closest('tr').after(con); $('.product_group_ids'+officer_click).on('change',function() { var number = $(this).attr('number'); var product_group_id = $(this).val(); $.ajax({ url:"<?php echo site_url('Get-products-based-product-group')?>", type:"POST", data:{'product_group_id':product_group_id}, async:false, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { var content1 = ''; content1 += '<select class="second_product'+number+'" style="width:180px;" number='+number+' name="product_id[]">'; content1 += '<option>Select</option>'; $.each(response.message,function(idx,vx1) { content1 += '<option value="'+vx1.product_id+'">'+vx1.product_name+'</option>'; }); content1 += '</select>'; $('.product_ids_'+number).empty(); $('.product_ids_'+number).append(content1); } else { $('.product_ids_'+number).empty(); toastr['error']('No Products Added'); } } }); }); $(document).on('change','.second_product'+officer_click,function(e) { var number = $(this).attr('number'); var product_id = $(this).val(); $.ajax({ url:"<?php echo site_url('Get-product-based-units')?>", type:"POST", data:{'product_id':product_id}, async:false, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { var unit_price = []; $.each(response.message,function(idx,vx) { var cgst = vx.cgst; var sgst = vx.sgst; var igst = vx.igst; var total_gst = parseFloat(cgst)+parseFloat(sgst)+parseFloat(igst); $('.fourth_gst'+number).empty(); $('.fourth_gst'+number).val(total_gst); var unit_name = vx.unit_name; $('.second_unit_ids_'+number).empty(); $('.second_unit_ids_'+number).val(unit_name); unit_price.push(vx.vendor_unit_price); }); var higthest_unit_price= Math.max.apply(Math,unit_price); $('.second_unit_rates'+number).empty(); $('.second_unit_rates'+number).val(higthest_unit_price); } else { $('.fourth_gst'+number).empty(); $('.second_unit_rates'+number).empty(); $('.second_unit_ids_'+number).empty(); toastr['error']('No Units Added'); } } }); }); } } }); } else { con+=' <tr>'; con+='<td style="text-align: center"><a class="officer_second_add_new_item third_row'+officer_click+'" style="padding-right:10px;" number='+officer_click+'><label class="texttype">A</label></a><a class="officer_second_add_new_item third_row'+officer_click+'" number='+officer_click+'><label class="texttype">T</a></td>'; con+='<td style="text-align: center"><input type="hidden" name="row_count[]" class="row_count" value="'+inc_num+'"><a><i onclick="add_row('+officer_click+',0);" class="fa fa-plus-circle add-officer-row'+inc_num+' append_officer_row'+officer_click+'" aria-hidden="true" style="color:#C90000"></i></a> <a><i onclick="remove_row('+inc_num+');" class="fa fa-minus-circle remove-officer-button'+inc_num+'" aria-hidden="true" style="color:purple"></i></a></td>'; con +='<td><select style= "width:45px;" name="select_type[]" class="selection_data" id="selection_data" ><option value="" disabled>Select</option><option value="Type of work" disabled>Type of work</option><option value="Annexure" selected>Annexure</option></select></td>'; con+='<td><input type="text" class="anexture_name'+officer_click+'" name="type_of_work_name[]" style="width:65px;background-color:white !important;height:30px;"></td>'; con +='<td colspan="17"><textarea class="form-control" name="meterial[]" style="background-color:white!important;height:50px;" placeholder="texting all the text"></textarea>'; con+='<input type="hidden" class="" name="l_name[]"><input type="hidden" class="" name="b_name[]"><input type="hidden" class="" name="d_name[]"><input type="hidden" class="" name="no_name[]"><input type="hidden" class="" name="total_name[]"><input type="hidden" class="" name="unit_id[]"><input type="hidden" class="" name="ratio_name[]"><input type="hidden" class="" name="rf_name[]"><input type="hidden" class="" name="qty_name[]"><input type="hidden" class="" name="unit_qty_name[]"><input type="hidden" name="rate_unit_name[]"><input type="hidden" class="" name="tamt_name[]"><input type="hidden" class="" name="gst_name[]"><input type="hidden" class="" name="gst_amt_name[]"><input type="hidden" class="" name="final_amount_name[]"><input type="hidden" class="" name="l_c_without_gst_name[]"><input type="hidden" class="" name="l_c_fourty_without_gst_name[]"><input type="hidden" class="" name="product_id[]"><input type="hidden" class="" name="product_group_id[]"><input type="hidden" class="" name="level_id[]">'; con+='</td>'; con +='</tr>'; } $('.third_row'+number).closest('tr').after(con); $('.second_rows'+number).closest('tr').after(con); $('.append_submit').empty(); var con2 =''; con2 +='<div class="row">'; con2 +='<div class="col-sm-12" style="text-align:center; margin-top:20px;">'; con2 +='<button type="submit" class="btn btn-primary add_new_item">Submit</button>'; con2 +='</div>'; con2 +='</div>'; $('.append_submit').append(con2); inc_num++; var inputs = $(".row_count"); for(var i = 0; i < inputs.length; i++) { $(inputs[i]).val(''); var f_index=i+1; var id = $(inputs[i]).val(f_index); } } else { alert('Please select any option'); } }); var officer_click = 0; function add_row(id,type) { var levels = $('.level_id'+id).val(); var type_of_work_name = $('.type_of_work_name'+id).val(); var anexture_name = $('.anexture_name'+id).val(); var ids = id; var type = type; officer_click++; var con=''; if(type== 1) { $.ajax({ type : 'post', url : '<?php echo site_url("get-level")?>', success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result==1) { con+='<tr>'; con+='<td style="text-align: center"><a class="officer_second_add_new_item second_rows'+officer_click+'" style="padding-right:10px;" number='+officer_click+'><label class="texttype">A</label></a><a class="officer_second_add_new_item second_rows'+officer_click+'" number='+officer_click+'><label class="texttype">T</a></td>'; con+='<td style="text-align: center"><input type="hidden" name="row_count[]" class="row_count" value="'+officer_click+'"><a><i onclick="remove_row('+inc_num+');" class="fa fa-minus-circle remove-officer-button'+inc_num+'" aria-hidden="true" style="color:purple"></i></a></td>'; con+='<td> <select style="width:45px;" name="select_type[]" class=" selection_data" id="selection_data" ><option value="" disabled>Select</option><option value="Type of work" selected>Type of work</option><option value="Annexure" disabled>Annexure</option></select></td>'; con+='<td><input type="text" class="type_of_work_name'+officer_click+'" name="type_of_work_name[]" placeholder="Work Name" value="'+type_of_work_name+'" style="width:65px;background-color:white !important;height:30px;"></td>'; con+='<td><select name="level_id[]" style="width:120px;" class="level_id'+officer_click+'">'; con+= '<option value="">Select</option>'; $.each(response.message,function(index,val) { if(levels == val.id) { con+= '<option value="'+val.id+'" selected>'+val.level_name+'</option>'; } else { con+= '<option value="'+val.id+'">'+val.level_name+'</option>'; } }); con+='</td>'; con+='<td> <select name="product_group_id[]" class="product_gp_ids'+officer_click+'" number='+officer_click+' style="width: 180px;">'; con+= '<option value="">Select</option>'; $.each(response.products,function(index,val) { con+= '<option value="'+val.product_group_id+'">'+val.product_group_name+'</option>'; }); con+='</td>'; con+='<td style="width: 80px; border: initial;" class="officer_product_ids_'+officer_click+'" number='+officer_click+'></td>'; con+='<td><input type="text" class="l_name'+inc_num+'" onkeyup="total_calculate('+inc_num+')" name="l_name[]" style="width: 100%; border: initial;background-color:white !important;height:25px;" placeholder="Length"></td>'; con+='<td><input type="text" class="b_name'+inc_num+'" onkeyup="total_calculate('+inc_num+')" name="b_name[]" style="width: 100%; border: initial;background-color:white !important;height:25px;" placeholder="Breadth"></td>'; con+='<td><input type="text" class="d_name'+inc_num+'" name="d_name[]" style="width: 100%; border: initial;background-color:white !important;height:25px;" placeholder="Depth" onkeyup="total_calculate('+inc_num+')"></td>'; con+='<td><input type="text" class="no_name'+inc_num+'" onkeyup="total_calculate('+inc_num+')" name="no_name[]" style="width: 100%; border: initial;background-color:white !important;height:25px;" placeholder="Number"></td>'; con+='<td><input type="text" class="total_name'+inc_num+'" name="total_name[]" style="width: 100%; border: initial;height:25px;" placeholder="Total" readonly></td>'; con+='<td style="width: 80px; border: initial;" ><input type="text" class="unit_ids_'+officer_click+' unit_name'+inc_num+'" number='+officer_click+' name="unit_id[]" placeholder="Unit/Total" style="width: 100%; border: initial;background-color:white !important;height:25px;" ></td>'; con+='<td><input type="text" class="ratio_unit'+inc_num+'" name="ratio_name[]" placeholder="Ratio/Unit" style="width: 100%; border: initial;background-color:white !important;height:25px;" onkeyup="total_calculate('+inc_num+')"></td>'; con+='<td><input type="text" class="rf'+inc_num+'" name="rf_name[]" placeholder="R.F" style="width: 100%; border: initial;background-color:white !important;height:25px;" onkeyup="total_calculate('+inc_num+')"></td>'; con+='<td><input type="text" class="qty_name'+inc_num+'" name="qty_name[]" placeholder="QTY" style="width: 100%; border: initial;height:25px;" readonly></td>'; /* con+='<td><input type="text" class="" name="unit_qty_name[]"></td>';*/ con+='<td><input type="text" class="unit_ids_'+officer_click+'" name="unit_qty_name[]" style="width: 100%; border: initial;" readonly placeholder="Unit/QTY"></td>'; /* con+='<td><select name="unit_qty_name[]" style="width:120px;">'; con+= '<option value="">Select</option>'; $.each(response.unit,function(index,val) { con+= '<option value="'+val.unit_name+'">'+val.unit_name+'</option>'; }); con+='</td>';*/ con+='<td><input type="text" class="rate_unit_name'+inc_num+' unit_rates'+officer_click+'" onkeyup="total_calculate('+inc_num+')" name="rate_unit_name[]" placeholder="Rate/Unit" style="width: 100%; border: initial;background-color:white !important;height:25px;" onkeyup="total_calculate('+inc_num+')"></td>'; con+='<td><input type="text" class="tamt_name'+inc_num+'" name="tamt_name[]" placeholder="TAMT" style="width: 100%; border: initial;height:25px;" readonly></td>'; con+='<td style="display:flex; border-bottom: none !important; border-left: none !important; border-right: none !important;"><input type="text" class="gst_name'+inc_num+' third_gst'+officer_click+'" onkeyup="total_calculate('+inc_num+')" name="gst_name[]" style="width: 100%; border: initial;background-color:white !important;height:25px;" placeholder="GST">%</td>'; con+='<td><input type="text" class="gst_amt_name'+inc_num+'" name="gst_amt_name[]" placeholder="GST AMT" style="width: 100%; border: initial;height:25px;" readonly></td>'; con+='<td><input type="text" class="final_amount_name'+inc_num+'" name="final_amount_name[]" placeholder="Final AMT" style="width: 100%; border: initial;height:25px;" readonly><input type="hidden" class="" name="meterial[]" value="0"></td>'; con +='</tr>'; } //var id = $('.click_ids').val(); $('.append_officer_row'+ids).closest('tr').after(con); //$('.ccc'+number).closest('tr').after(con); $('.product_gp_ids'+officer_click).on('change',function() { var number = $(this).attr('number'); var product_group_id = $(this).val(); $.ajax({ url:"<?php echo site_url('Get-products-based-product-group')?>", type:"POST", data:{'product_group_id':product_group_id}, async:false, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { var content1 = ''; content1 += '<select class="officer_product'+number+'" style="width:180px;" number='+number+' name="product_id[]">'; content1 += '<option>Select</option>'; $.each(response.message,function(idx,vx1) { content1 += '<option value="'+vx1.product_id+'">'+vx1.product_name+'</option>'; }); content1 += '</select>'; $('.officer_product_ids_'+number).empty(); $('.officer_product_ids_'+number).append(content1); } else { $('.officer_product_ids_'+number).empty(); toastr['error']('No Products Added'); } } }); }); $(document).on('change','.officer_product'+officer_click,function(e) { var number = $(this).attr('number'); var product_id = $(this).val(); $.ajax({ url:"<?php echo site_url('Get-product-based-units')?>", type:"POST", data:{'product_id':product_id}, async:false, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { var unit_price = []; $.each(response.message,function(idx,vx) { var cgst = vx.cgst; var sgst = vx.sgst; var igst = vx.igst; var total_gst = parseFloat(cgst)+parseFloat(sgst)+parseFloat(igst); $('.third_gst'+number).empty(); $('.third_gst'+number).val(total_gst); var unit_name = vx.unit_name; $('.unit_ids_'+number).empty(); $('.unit_ids_'+number).val(unit_name); unit_price.push(vx.vendor_unit_price); }); var higthest_unit_price= Math.max.apply(Math,unit_price); $('.unit_rates'+number).empty(); $('.unit_rates'+number).val(higthest_unit_price); } else { $('.third_gst'+number).empty(); $('.unit_rates'+number).empty(); $('.unit_ids_'+number).empty(); toastr['error']('No Units Added'); } } }); }); } }); } else { con+=' <tr>'; con+='<td style="text-align: center"><a class="officer_second_add_new_item second_rows'+officer_click+'" style="padding-right:10px;" number='+officer_click+'><label class="texttype">A</label></a><a class="officer_second_add_new_item second_rows'+officer_click+'" number='+officer_click+'><label class="texttype">T</a></td>'; /* con+='<td style="text-align: center"><input type="hidden" name="row_count[]" class="row_count" value="'+officer_click+'"><a><i onclick="add_row('+officer_click+',0);" class="fa fa-plus-circle add-officer-row'+inc_num+' append_officer_row'+officer_click+'" aria-hidden="true" style="color:#C90000"></i></a> <a><i onclick="remove_row('+inc_num+');" class="fa fa-minus-circle remove-officer-button'+inc_num+'" aria-hidden="true" style="color:purple"></i></a></td>';*/ con+='<td style="text-align: center"><input type="hidden" name="row_count[]" class="row_count" value="'+officer_click+'"><a><i onclick="remove_row('+inc_num+');" class="fa fa-minus-circle remove-officer-button'+inc_num+'" aria-hidden="true" style="color:purple"></i></a></td>'; con +='<td><select style="width:45px;" name="select_type[]" class="selection_data" id="selection_data" ><option value="" disabled>Select</option><option value="Type of work" disabled>Type of work</option><option value="Annexure" selected>Annexure</option></select></td>'; con+='<td><input type="text" class="anexture_name'+officer_click+'" name="type_of_work_name[]" style="width:65px;background-color:white !important;height:30px;" value="'+anexture_name+'"></td>'; con +='<td colspan="17"><textarea class="form-control" name="meterial[]" style="background-color:white!important;height:50px;" placeholder="texting all the text"></textarea> '; con+='<input type="hidden" class="" name="l_name[]"><input type="hidden" class="" name="b_name[]"><input type="hidden" class="" name="d_name[]"><input type="hidden" class="" name="no_name[]"><input type="hidden" class="" name="total_name[]"><input type="hidden" class="" name="unit_id[]"><input type="hidden" class="" name="ratio_name[]"><input type="hidden" class="" name="rf_name[]"><input type="hidden" class="" name="qty_name[]"><input type="hidden" class="" name="unit_qty_name[]"><input type="hidden" name="rate_unit_name[]"><input type="hidden" class="" name="tamt_name[]"><input type="hidden" class="" name="gst_name[]"><input type="hidden" class="" name="gst_amt_name[]"><input type="hidden" class="" name="final_amount_name[]"><input type="hidden" class="" name="l_c_without_gst_name[]"><input type="hidden" class="" name="l_c_fourty_without_gst_name[]"><input type="hidden" class="" name="product_id[]"><input type="hidden" class="" name="product_group_id[]"><input type="hidden" class="" name="level_id[]">'; con+='</td>'; con +='</tr>'; } $('.append_officer_row'+ids).closest('tr').after(con); inc_num++; var inputs = $(".row_count"); for(var i = 0; i < inputs.length; i++) { $(inputs[i]).val(''); var f_index=i+1; var id = $(inputs[i]).val(f_index); } } /*function remove_row(id)*/ var officer_click = 0; $('.add_form').submit(function(e){ e.preventDefault(); formdata = new FormData($(this)[0]); swal({ title: "Are you sure?", text: "You want to Save this?", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "Yes!", cancelButtonText: "No, cancel plz!", closeOnConfirm: false, closeOnCancel: false }, function(isConfirm){ if (isConfirm) { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); $.ajax({ type : 'post', url : "<?php echo site_url('add-multilevel-budget');?>", data : formdata, contentType: false, processData: false, success:function(response) { response=jQuery.parseJSON(response); console.log(response); if(response.result == 1) { toastr["success"](response.message); setTimeout(function wait(){ window.location = '<?php echo site_url("budgets-new")?>'; }, 1000); } else { toastr["error"](response.message); } } }); } else { $(".sweet-alert").hide(); $(".sweet-overlay").hide(); } }); }); function remove_row(id) { var whichtr = $('.remove-officer-button'+id).closest("tr"); whichtr.remove(); var inputs = $(".row_count"); for(var i = 0; i < inputs.length; i++) { $(inputs[i]).val(''); var f_index=i+1; var id = $(inputs[i]).val(f_index); } } function total_calculate(id) { var l_name=parseFloat($('.l_name'+id).val()); var b_name=parseFloat($('.b_name'+id).val()); var d_name=parseFloat($('.d_name'+id).val()); var no_name=parseFloat($('.no_name'+id).val()); var unit=$('.unit_name'+id).val(); var ratio_unit=$('.ratio_unit'+id).val(); var rf=$('.rf'+id).val(); var total_name=parseFloat($('.total_name'+id).val()); if(l_name==''||(isNaN(l_name)) ) { var l_name=""; } if(b_name==''||(isNaN(b_name))) { var b_name=""; } if(no_name=='' ||(isNaN(no_name))) { var no_name=""; } if(d_name=='' ||(isNaN(d_name))) { var d_name=""; } if(ratio_unit==''||(isNaN(ratio_unit)) ) { var ratio_unit=""; } if(unit == "AREA") { var total=(parseFloat(l_name)+parseFloat(b_name))*(parseFloat(no_name)); var quantity =(parseFloat(total)*parseFloat(no_name)); $('.total_name'+id).val(total.toFixed(2)); $('.qty_name'+id).val(quantity.toFixed(2)); } else { if(l_name =="") { var total=(parseFloat(b_name)*parseFloat(no_name)*parseFloat(d_name)); } else if(b_name=="") { var total=(parseFloat(l_name)*parseFloat(no_name)*parseFloat(d_name)); } else if(no_name == "") { var total=(parseFloat(l_name)*parseFloat(b_name)*parseFloat(d_name)); } else if(d_name == "") { var total=(parseFloat(l_name)*parseFloat(b_name)*parseFloat(no_name)); } else { var total=(parseFloat(l_name)*parseFloat(b_name)*parseFloat(no_name)*parseFloat(d_name)); } var quantity =((parseFloat(total)*parseFloat(ratio_unit)))/(parseFloat(rf)); $('.total_name'+id).val(total.toFixed(2)); $('.qty_name'+id).val(quantity.toFixed(2)); } var rate_unit=$('.rate_unit_name'+id).val(); if(rate_unit==''||(isNaN(rate_unit))) { var rate_unit=0; } var f_qty=parseFloat(quantity)*parseFloat(rate_unit); $('.tamt_name'+id).val(f_qty.toFixed(2)); var gst=$('.gst_name'+id).val(); if(gst=='' ||(isNaN(gst))) { var gst=0; } var total_gst = parseFloat(gst)/100; var gst_amt=parseFloat(f_qty)*parseFloat(total_gst); $('.gst_amt_name'+id).val(gst_amt.toFixed(2)); var final_amount=parseFloat(f_qty)+parseFloat(gst_amt); $('.final_amount_name'+id).val(final_amount.toFixed(2)); //labour charges //$('.l_c_without_gst_name'+id).val(total_amount); } </script> <?php $this->load->view('includes/footer'); ?> <style type="text/css"> body { background: #eeeeee; } .table th, .jsgrid .jsgrid-table th, .table td, .jsgrid .jsgrid-table td { padding: 5px !important; vertical-align: top; border-top: 1px solid #f3f3f3; font-size: 11px !important; } table, td, th { border: 1px solid black !important; border-collapse: collapse; } label { line-height: 0; } .append_div table input{ background: none !important; border: initial; } .append_div table select{ background: none !important; border: initial; } .append_div table textarea{ background: none !important; border: initial; } .our-scroll { height: 300px; overflow-y: scroll; } .scroll{ overflow:scroll; max-width:100%; position:relative; } #normal thead tr th{ font-size: 14px; font-weight: 400; } #normal tbody tr td{ font-size: 14px; font-weight: 400; } .append_div_resp{ padding-left: 30px; padding-right: 30px; } </style>