<style>
	.container{
	width:100%;
	}
	.div_cls{
	margin-top:50px;
	}
</style>
<div class="col-lg-12 ">
	<section class="panel">
		
		<div class="panel-body">
			<div class="col-lg-12">
				<ul class="nav nav-tabs">
					<li class="nav-item active">
						<a class="nav-link"  data-toggle="tab" href="#vehi_e_f_l">VEHICLE ENTRY FORM (LOADING)</a>
					</li>
					<li class="nav-item">
						<a class="nav-link"  data-toggle="tab" href="#auth_f_l">AUTHORIZATION FORM(LOADING)</a>
					</li>
					<li class="nav-item">
						<a class="nav-link"  data-toggle="tab" href="#vehi_s_f_l">VEHICLE SLIP FORM(LOADING)</a>
					</li>
					<li class="nav-item">
						<a class="nav-link"  data-toggle="tab" href="#vehi_s_r_f_l">VEHICLE SLIP RETURN FORM(AFTER LOADING)</a>
					</li>
                    <li class="nav-item">
						<a class="nav-link"  data-toggle="tab" href="#dele_g_pass_l">DELIVERY NOTE/GATE PASS(LOADING)</a>
					</li>
				</ul>
				<div class="tab-content">

                    <div id="vehi_e_f_l" class="container tab-pane active col-lg-10 col-lg-offset-1">
                        <section class="panel">
                            <header class="panel-heading" style="min-height:120px">
                                <div class="col-lg-3"> <span>Date : <?php echo $se_list['lul_date'];?></span> </div>
                                <div class="col-lg-6">
                                    <h4 class="text-center"><i class="fa fa-truck truck_icon"></i><br/> <b>ETC Cargo Limited - Vehicle Entry Form (Loading)</b></h4></div>
                                <div class="col-lg-3"><span>Tocken No : <?php echo $se_list['lul_token_no'];?></span></div>
                            </header>
                            <div class="clear"></div>
                            <div class="panel-body">
                                <form class="form-horizontal" method="post" action="<?php echo base_url();?>search_ctrl/update_loaading_details/<?php echo $token_val;?>/<?php echo $se_list['lul_id'];?>">
                                    <div class="col-lg-12">
                                        <div class="form-group col-md-6">
                                            <label class="col-lg-4 col-sm-4">Customer Name</label>
                                            <div class="col-lg-8">

                                                
                                                <select class="form-control" name="lul_cl_id" required>
                                                    <option value="">--Select--</option>
                                                    <?php
                                                        foreach($cl_list as $cl_row){
                                                    ?>
                                                            <option value="<?php echo $cl_row['cl_id']; ?>" <?php if(isset($se_list['lul_cl_id']) && $se_list['lul_cl_id']==$cl_row['cl_id']){ echo "selected=selected";}?>><?php echo $cl_row['cl_name']; ?></option>
                                                            
                                                    <?php
                                                        }
                                                    ?>
                                                </select>

                                            </div>
                                        </div>

                                        <div class="form-group col-md-6">
                                            <label class="col-lg-4 col-sm-4">Commodity</label>
                                            <div class="col-lg-8">
                                                <select class="form-control" name="lul_com_id" required>
                                                    <option value="">--Select--</option>
                                                    <?php
                                                        foreach($com_list as $com_row){
                                                    ?>
                                                            <option value="<?php echo $com_row['com_id']; ?>" <?php if(isset($se_list['lul_com_id']) && $se_list['lul_com_id']==$com_row['com_id']){ echo "selected=selected";}?>><?php echo $com_row['com_name']; ?></option>
                                                            
                                                    <?php
                                                        }
                                                    ?>
                                                </select>

                                            </div>
                                        </div>
                                        <div class="form-group col-md-6">
                                            <label class="col-lg-4 col-sm-4">Truck No</label>
                                            <div class="col-lg-8">
                                                <input type="text" class="form-control" name="lul_truck_no" value="<?php if(isset($se_list['lul_truck_no'])){ echo $se_list['lul_truck_no'];}?>" required>

                                            </div>
                                        </div>

                                        <div class="form-group col-md-6">
                                            <label class="col-lg-4 col-sm-4 ">Trailer No</label>
                                            <div class="col-lg-8">
                                                <input type="text" class="form-control" name="lul_trailer_no" value="<?php if(isset($se_list['lul_trailer_no'])){ echo $se_list['lul_trailer_no'];}?>"required>

                                            </div>
                                        </div>
                                        <div class="form-group col-md-6">
                                            <label class="col-lg-4 col-sm-4">Transporter</label>
                                            <div class="col-lg-8">
                                                <select class="form-control" name="lul_tl_id" required>
                                                    <option value="">--Select--</option>
                                                    <?php
                                                        foreach($tl_list as $tl_row){
                                                    ?>
                                                            <option value="<?php echo $tl_row['tl_id']; ?>" <?php if(isset($se_list['lul_tl_id']) && $se_list['lul_tl_id']==$tl_row['tl_id']){ echo "selected=selected";}?>><?php echo $tl_row['tl_name']; ?></option>
                                                            
                                                    <?php
                                                        }
                                                    ?>
                                                </select>

                                            </div>
                                        </div>
                                        <div class="form-group col-md-6">
                                            <label class="col-lg-4 col-sm-4">Driver Name</label>
                                            <div class="col-lg-8">
                                                <input type="text" class="form-control" name="lul_driver_name" value="<?php if(isset($se_list['lul_driver_name'])){ echo $se_list['lul_driver_name'];}?>" required>

                                            </div>
                                        </div>
                                        <div class="form-group col-md-6">
                                            <label class="col-lg-4 col-sm-4 ">Driver Ph</label>
                                            <div class="col-lg-8">
                                                <input type="text" class="form-control" name="lul_driver_ph_no" value="<?php if(isset($se_list['lul_driver_ph_no'])){ echo $se_list['lul_driver_ph_no'];}?>" required>

                                            </div>
                                        </div>
                                        <div class="form-group col-md-6">
                                            <label class="col-lg-4 col-sm-4 ">Driver Lic</label>
                                            <div class="col-lg-8">
                                                <input type="text" class="form-control" name="lul_lic" value="<?php if(isset($se_list['lul_lic'])){ echo $se_list['lul_lic'];}?>" required>

                                            </div>
                                        </div>
                                    
                                        

                                        <div class="form-group col-md-6">
                                            <label class="col-lg-4 col-sm-4 ">Destination (To)</label>
                                            <div class="col-lg-8">
                                                <input type="text" class="form-control" name="lul_destination" value="<?php if(isset($se_list['lul_destination'])){ echo $se_list['lul_destination'];}?>" required>

                                            </div>
                                        </div>

                                        
                                        <div class="form-group col-md-6">
                                            <div class="col-lg-offset-4 col-lg-8">
                                                <button type="submit" class="btn btn-success pull-right">Save</button>
                                            </div>
                                        </div>

                                    </div>
                                    <!---->

                                </form>
                            </div>
                        </section>

                    </div>


                    <div id="auth_f_l" class="container tab-pane"class="col-lg-10 col-lg-offset-1">
                        <div class="col-lg-12">
                            <form class="form-horizontal" method="post" action="<?php echo base_url();?>search_ctrl/update_appvoved_loading_meterials/<?php echo $token_val;?>/<?php echo $se_list['lul_id'];?>">

                                <section class="panel">
                                    <header class="panel-heading" style="min-height:120px">
                                        <div class="col-lg-3"> <span>Date : <?php if(isset($se_list['lul_date'])){ echo $se_list['lul_date'];}?> </span> </div>
                                        <div class="col-lg-6">
                                            <h4 class="text-center"><i class="fa fa-truck truck_icon"></i><br/> <b>ETC Cargo Limited - Authorization Form(<?php echo $se_list['lul_type'];?>)</b></h4></div>
                                        <div class="col-lg-3"><span>Tocken No : <?php if(isset($se_list['lul_token_no'])){ echo $se_list['lul_token_no'];} ?></span></div>
                                    </header>
                                    <div class="clear"></div>
                                    <div class="panel-body">
                                        <div class="col-lg-12">
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">Customer Name</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['cl_name']; ?>" readonly>
                                                </div>
                                            </div>

                                        

                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">Transporter</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['tl_name'];?>" readonly>
                                                </div>
                                            </div>

                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">Truck No</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_truck_no'];?>" readonly>

                                                </div>
                                            </div>

                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">Trailer No</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_trailer_no'];?>" readonly>

                                                </div>
                                            </div>
                                            

                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">Driver Name</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_driver_name'];?>" readonly>

                                                </div>
                                            </div>
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">Driver Ph</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_driver_ph_no'];?>" readonly>

                                                </div>
                                            </div>

                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">Time In</label>
                                                <div class="col-lg-8">
                                                    <input type="text" id='timepicker' class="form-control" value="<?php echo $se_list['lul_time_in'];?>" readonly>

                                                </div>
                                            </div>
                                            

                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">Initiated By</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['ul_name'];?>" readonly>

                                                </div>
                                            </div>

                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">No of Bags</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" id="total_bag_id" name="lul_no_of_bag" readonly required>

                                                </div>
                                            </div>

                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">Tons</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" id="total_ton_id" name="lul_ton" readonly required>

                                                </div>
                                            </div>

                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">Commodity</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['com_name']; ?>" readonly>
                                                </div>
                                            </div>

                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">Destination (To)</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_destination'];?>" readonly>

                                                </div>
                                            </div>

                                            
                                            

                                        </div>
                                        <!---->

                                    </div>
                                    <header class="panel-heading">
                                        <h4 class="text-center"> 
                                            <b>Commodity Details</b>
                                            <a class="btn btn-sm btn-default pull-right" id="add_more_ml_id">Add more</a>                        
                                        </h4>
                                    </header>

                                    <div class="panel-body">
                                        <section id="unseen">
                                            <table class="table table-bordered table-striped table-condensed col-md-12">
                                                <thead>
                                                    <tr>
                                                        <th class="col-md-3">Material Name</th>
                                                        <th class="numeric col-md-3">UOM</th>
                                                        <th class="col-md-3">Total Weight</th>
                                                        <th class="col-md-3">No of Bags / Bales</th>
                                                        <th class="col-md-3"> &nbsp;</th>

                                                    </tr>
                                                </thead>
                                                <tbody id="tbody_id">     
                                                <?php 
                                                    foreach($luml_data as $luml_key=>$luml_row){
                                                ?>
                                                        <tr class="tbody_tr_cls" id="tbody_tr_id_<?php echo $luml_key;?>">
                                                            <td>
                                                                <div class="form-group col-md-12" style="margin-left: -5px; padding: 0;">
                                                                    <select class="form-control ml_details_cls" name="luml_ml_id[]" id="ml_details_id_<?php echo $luml_key;?>" data-common_num="<?php echo $luml_key;?>">
                                                                        <option selected="">--Select--</option>
                                                                        <?php 
                                                                            foreach($ml_list as $ml_key=>$ml_row){
                                                                                if($se_list['lul_com_id']==$ml_row['ml_com_id']){
                                                                        ?>
                                                                                    <option value="<?php echo $ml_row['ml_id'];?>" <?php if($luml_row['luml_ml_id']==$ml_row['ml_id']){echo "selected=selected";}?>><?php echo $ml_row['ml_name'];?></option>
                                                                        <?php
                                                                                }
                                                                            }
                                                                        ?>
                                                                    </select>
                                                                </div>
                                                            </td>
                                                            <td>
                                                                <div class="form-group col-md-12" style="margin-left: -5px; padding: 0;">
                                                                    <select class="form-control" name="luml_unl_id[]">
                                                                        <option value="">--Select Unit--</option>
                                                                        <?php 
                                                                            foreach($unl_list as $unl_key=>$unl_row){
                                                                        ?>
                                                                                <option value="<?php echo $unl_row['unl_id'];?>" <?php if($luml_row['luml_unl_id']==$unl_row['unl_id']){echo "selected=selected";}?> ><?php echo $unl_row['unl_unit'];?></option>
                                                                        <?php
                                                                            }
                                                                        ?>
                                                                    </select>
                                                                </div>
                                                            </td>
                                                            <td>
                                                                <input type="text" class="form-control enter_total_wit_cls" name="luml_total_weight[]" data-common_num_wit="<?php echo $luml_key;?>" value="<?php echo $luml_row['luml_total_weight'];?>">
                                                            </td>
                                                            <td id="tbody_tr_td_num_bal_bag_id_<?php echo $luml_key;?>">
                                                                <input type="hidden" class="form-control enter_total_bag_cls" name="luml_no_of_bag[]" id="enter_total_bag_id_<?php echo $luml_key;?>" value="<?php echo $luml_row['luml_no_of_bag'];?>">
                                                                &nbsp;<p  id="enter_total_wit_id_<?php echo $luml_key;?>" ><?php echo $luml_row['luml_no_of_bag'];?></p>

                                                                <input type="hidden" class="form-control" name="luml_id[]" value="<?php echo $luml_row['luml_id'];?>">
                                                                
                                                            </td>
                                                            <td class="" >
                                                                <a class="btn btn-sm btn-danger fa fa-times " href="<?php echo base_url();?>search_ctrl/delete_luml_details/<?php echo $token_val;?>/<?php echo $luml_row['luml_id'];?>"></a>
                                                            </td>
                                                        </tr>
                                                <?php
                                                    }
                                                ?>
                                                </tbody>
                                            </table>

                                            <div class=" col-lg-offset-5">
                                                <div class="col-lg-2">
                                                    <button type="submit" class="btn btn-success"> <i class="fa fa-thumbs-up"></i>&nbsp; Authorize</button>
                                                </div>

                                            </div>

                                        </section>
                                    </div>

                                </section>
                            </form>

                        </div>
                    </div>


                    <div id="vehi_s_f_l" class="container tab-pane"class="col-lg-10 col-lg-offset-1">
                        <div class="col-lg-12">
                            <form class="form-horizontal" method="post" action="<?php echo base_url();?>search_ctrl/update_vehicle_slip/<?php echo $token_val;?>/<?php echo $se_list['lul_id'];?>">

                                <section class="panel">
                                    <header class="panel-heading" style="min-height:120px">
                                        <div class="col-lg-3"> <span>Date : <?php if(isset($se_list['lul_date'])){ echo $se_list['lul_date'];}?> </span> </div>
                                        <div class="col-lg-6">
                                            <h4 class="text-center"><i class="fa fa-truck truck_icon"></i><br/> <b>ETC Cargo Limited - Vehicle Slip Form(<?php echo $se_list['lul_type'];?>)</b></h4></div>
                                        <div class="col-lg-3"><span>Tocken No : <?php if(isset($se_list['lul_token_no'])){ echo $se_list['lul_token_no'];} ?></span></div>
                                    </header>
                                    <div class="clear"></div>
                                    <div class="panel-body">
                                        <div class="col-lg-12">
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">Customer Name</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['cl_name']; ?>" readonly>
                                                </div>
                                            </div>

                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">W/Bridge Ticket No</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" name="lul_W_Bridge_Ticket_No" value="<?php echo $se_list['lul_W_Bridge_Ticket_No'];?>">

                                                </div>
                                            </div>
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">W/B Gross(KG) </label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" name="lul_w_bridge_gross" value="<?php echo $se_list['lul_w_bridge_gross'];?>" readonly value="0">

                                                </div>
                                            </div>
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">W/B Tare(KG) </label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" name="lul_w_bridge_tare" value="<?php echo $se_list['lul_w_bridge_tare'];?>" id="w_b_tare_id" >

                                                </div>
                                            </div>

                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">W/B Net(KG) </label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" name="lul_w_bridge_net" value="<?php echo $se_list['lul_w_bridge_net'];?>" readonly   id="w_b_net_id">

                                                </div>
                                            </div>

                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">Truck No</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_truck_no'];?>" readonly>

                                                </div>
                                            </div>

                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">Trailer No</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_trailer_no'];?>" readonly>

                                                </div>
                                            </div> 
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">No of Bags</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control"value="<?php echo $se_list['lul_no_of_bag'];?>" readonly>

                                                </div>
                                            </div>

                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">Tons</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_ton'];?>" readonly>

                                                </div>
                                            </div>


                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">Driver Name</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_driver_name'];?>" readonly>

                                                </div>
                                            </div>


                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">Driver Ph</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_driver_ph_no'];?>" readonly>

                                                </div>
                                            </div>  

                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">Transporter</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['tl_name'];?>" readonly>
                                                </div>
                                            </div>

                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">Authorised By</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['authorize_name'];?>" readonly>

                                                </div>
                                            </div> 
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">Bl No </label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" name="lul_bl_no" value="<?php echo $se_list['lul_bl_no'];?>">

                                                </div>
                                            </div>     
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">Destination (To)</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_destination'];?>" readonly>

                                                </div>
                                            </div>                

                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">Commodity</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['com_name']; ?>" readonly>
                                                </div>
                                            </div>

                                            

                                        </div>
                                        <!---->

                                    </div>
                                    <header class="panel-heading">
                                        <h4 class="text-center"> 
                                                        
                                        </h4>
                                    </header>

                                    <div class="panel-body">
                                        <section id="unseen">
                                            <table class="table table-bordered table-striped table-condensed col-md-12">
                                                <thead>
                                                    <tr>
                                                        <th class="col-md-3">Material Name</th>
                                                        <th class="numeric col-md-3">Bag Weight</th>
                                                        <th class="col-md-3">No of Bags</th>
                                                        <th class="col-md-3">Total Weight</th>
                                                    </tr>
                                                </thead>
                                                <tbody id="tbody_id">     
                                                    <?php
                                                        foreach($luml_data as $luml_rows){
                                                    ?>
                                                            <tr>
                                                                <td> <?php echo $luml_rows['ml_name'];?> </td>
                                                                <td> <?php echo $luml_rows['ml_unit_kg'];?> </td>
                                                                <td> <?php echo $luml_rows['luml_no_of_bag'];?> </td>
                                                                <td> <?php echo $luml_rows['luml_total_weight'];?> </td>
                                                            </tr>
                                                    <?php
                                                        }
                                                    ?>

                                                </tbody>
                                            </table>

                                            <div class=" col-lg-offset-5">
                                                <div class="col-lg-2">
                                                    <button type="submit" class="btn btn-success"> <i class="fa fa-thumbs-up"></i>&nbsp; Save</button>
                                                </div>

                                            </div>

                                        </section>
                                    </div>

                                </section>
                            </form>

                        </div>
                    </div>


                    <div id="vehi_s_r_f_l" class="container tab-pane"class="col-lg-10 col-lg-offset-1">
                        <div class="col-lg-12">
                            <form class="form-horizontal" method="post" action="<?php echo base_url();?>search_ctrl/update_vehicle_slip_return_form/<?php echo $token_val;?>/<?php if(isset($se_list['lul_id'])){ echo $se_list['lul_id'];}?>">
                                <section class="panel">
                                    <header class="panel-heading" style="min-height:120px">
                                        <div class="col-lg-3"> <span>Date : <?php if(isset($se_list['lul_date'])){ echo $se_list['lul_date'];}?> </span> </div>
                                        <div class="col-lg-6">
                                            <h4 class="text-center"><i class="fa fa-truck truck_icon"></i><br/> <b>ETC Cargo Limited - Vehicle Slip Return Form(After <?php echo $se_list['lul_type'];?>)</b></h4>
                                        </div>
                                        <div class="col-lg-3"><span>Tocken No : <?php if(isset($se_list['lul_token_no'])){ echo $se_list['lul_token_no'];} ?></span></div>
                                    </header>
                                    <div class="clear"></div>
                                    <div class="panel-body">
                                        <div class="col-lg-12">
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">Customer Name</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['cl_name']; ?>" readonly>
                                                </div>
                                            </div>
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">W/Bridge Ticket No</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_W_Bridge_Ticket_No']; ?>" readonly>
                                                </div>
                                            </div>

                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">W/B Gross(KG) </label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" name="lul_w_bridge_gross" value="<?php echo $se_list['lul_w_bridge_gross']; ?>" id="w_b_gross_id" required>
                                                </div>
                                            </div>

                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">W/B Tare(KG) </label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_w_bridge_tare']; ?>" id="w_b_tare_r_id" readonly>
                                                </div>
                                            </div>

                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">W/B Net(KG) </label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" name="lul_w_bridge_net"  value="<?php echo $se_list['lul_w_bridge_net']; ?>" id="w_b_net_r_id" readonly>
                                                </div>
                                            </div>


                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">Truck No</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_truck_no'];?>" readonly>
                                                </div>
                                            </div>

                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">Trailer No</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_trailer_no'];?>" readonly>
                                                </div>
                                            </div>
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">No of Bags</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control"value="<?php echo $se_list['lul_no_of_bag'];?>" readonly>
                                                </div>
                                            </div>
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">Tons</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_ton'];?>" readonly>
                                                </div>
                                            </div>
                                            
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">Driver Name</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_driver_name'];?>" readonly>
                                                </div>
                                            </div>
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">Driver Ph</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_driver_ph_no'];?>" readonly>
                                                </div>
                                            </div>
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">Transporter</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['tl_name'];?>" readonly>
                                                </div>
                                            </div>
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">Authorised By</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['authorize_name'];?>" readonly>
                                                </div>
                                            </div>
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">Bl No </label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_bl_no'];?>" readonly>

                                                </div>
                                            </div>     
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">Destination (To)</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_destination'];?>" readonly>

                                                </div>
                                            </div>   
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">Container No </label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" name="lul_container_no" value="<?php echo $se_list['lul_container_no'];?>">

                                                </div>
                                            </div>
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">TRA Seal No  </label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" name="lul_tra_seal_no" value="<?php echo $se_list['lul_tra_seal_no'];?>">

                                                </div>
                                            </div>
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">Container Tare Wt </label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" name="lul_container_tare_wt" value="<?php echo $se_list['lul_container_tare_wt'];?>">

                                                </div>
                                            </div>
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">Shipping Line   </label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" name="lul_shipping_line" value="<?php echo $se_list['lul_shipping_line'];?>">

                                                </div>
                                            </div>


                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">Commodity</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['com_name']; ?>" readonly>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="clear"></div>
                                        <!-------------------Form------------------>
                                        <div class="for_form">
                                            <div class="col-lg-6">
                                                <div class="form-group">
                                                    <label class="col-lg-4 col-sm-4">Load By</label>
                                                    <div class="col-lg-8">
                                                        <input type="text" class="form-control" name="lul_load_by" value="<?php echo $se_list['lul_load_by']; ?>">
                                                    </div>
                                                </div>
                                                <div class="form-group">
                                                    <label class="col-lg-4 col-sm-4">Bags Loaded</label>
                                                    <div class="col-lg-8">
                                                        <input type="text" class="form-control" name="lul_bag_loaded" value="<?php echo $se_list['lul_bag_loaded']; ?>">
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="col-lg-6">
                                                <div class="form-group">
                                                    <label class="col-lg-4 col-sm-4">Name</label>
                                                    <div class="col-lg-8">
                                                        <input type="text" class="form-control" name="lul_l_name" value="<?php echo $se_list['lul_l_name']; ?>">
                                                    </div>
                                                </div>
                                                <div class="col-lg-6" style="padding:0px">
                                                    <div class="form-group">
                                                        <label class="col-lg-4 col-sm-4">Bags(Short)</label>
                                                        <div class="col-lg-8">
                                                            <input type="text" class="form-control" name="lul_bag_short" value="<?php echo $se_list['lul_bag_short']; ?>">
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="col-lg-6" style="padding:0px 10px">
                                                    <div class="form-group">
                                                        <label class="col-lg-4 col-sm-4">KGS</label>
                                                        <div class="col-lg-8">
                                                            <input type="text" class="form-control" name="lul_kgs" value="<?php echo $se_list['lul_kgs']; ?>">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <header class="panel-heading">
                                        <h4 class="text-center"> 
                                        </h4>
                                    </header>
                                    <div class="panel-body">
                                        <section id="unseen">
                                            <table class="table table-bordered table-striped table-condensed col-md-12">
                                                <thead>
                                                    <tr>
                                                        <th class="col-md-3">Material Name</th>
                                                        <th class="numeric col-md-3">Bag Weight</th>
                                                        <th class="col-md-3">No of Bags</th>
                                                        <th class="col-md-3">Total Weight</th>
                                                    </tr>
                                                </thead>
                                                <tbody id="tbody_id">
                                                    <?php
                                                        foreach($luml_data as $luml_rows){
                                                        ?>
                                                    <tr>
                                                        <td> <?php echo $luml_rows['ml_name'];?> </td>
                                                        <td> <?php echo $luml_rows['ml_unit_kg'];?> </td>
                                                        <td> <?php echo $luml_rows['luml_no_of_bag'];?> </td>
                                                        <td> <?php echo $luml_rows['luml_total_weight'];?> </td>
                                                    </tr>
                                                    <?php
                                                        }
                                                        ?>
                                                </tbody>
                                            </table>
                                            <div class=" col-lg-offset-5">
                                                <div class="col-lg-2">
                                                    <button type="submit" class="btn btn-success"> <i class="fa fa-thumbs-up"></i>&nbsp; Save </button>
                                                </div>
                                            </div>
                                        </section>
                                    </div>
                                </section>
                            </form>
                        </div>
                    </div>

                    <div id="dele_g_pass_l" class="container tab-pane"class="col-lg-10 col-lg-offset-1">
                        <div class="col-lg-12">
                            <form class="form-horizontal" method="post" action="<?php echo base_url();?>search_ctrl/update_delevery_not_gate_pass/<?php if(isset($se_list['lul_id'])){ echo $se_list['lul_id'];}?>">
                                <section class="panel">
                                    <header class="panel-heading" style="min-height:120px">
                                        <div class="col-lg-3"> <span>Date : <?php if(isset($se_list['lul_date'])){ echo $se_list['lul_date'];}?> </span> </div>
                                        <div class="col-lg-6">
                                            <h4 class="text-center"><i class="fa fa-truck truck_icon"></i><br/> <b>ETC Cargo Limited - DELIVERY NOTE/GATE PASS(<?php echo $se_list['lul_d_no'];?>)</b></h4>
                                        </div>
                                        <div class="col-lg-3"><span>D. No : <?php echo $se_list['lul_d_no'];?> </span></div>
                                    </header>
                                    <div class="clear"></div>
                                    <div class="panel-body">
                                        <div class="col-lg-12">
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">Token No</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_token_no']; ?>" readonly>
                                                </div>
                                            </div>
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">Customer Name</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['cl_name']; ?>" readonly>
                                                </div>
                                            </div>
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">W/Bridge Ticket No</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_W_Bridge_Ticket_No']; ?>" readonly>
                                                </div>
                                            </div>

                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">W/B Gross </label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_w_bridge_gross']; ?>" readonly>
                                                </div>
                                            </div>

                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">W/B Tare </label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_w_bridge_tare']; ?>" readonly>
                                                </div>
                                            </div>

                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">W/B Net </label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_w_bridge_net']; ?>" readonly>
                                                </div>
                                            </div>


                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">Truck No</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_truck_no'];?>" readonly>
                                                </div>
                                            </div>

                                            
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">Trailer No</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_trailer_no'];?>" readonly>
                                                </div>
                                            </div>

                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">No of Bags</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control"value="<?php echo $se_list['lul_no_of_bag'];?>" readonly>
                                                </div>
                                            </div>
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">Tons</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_ton'];?>" readonly>
                                                </div>
                                            </div>
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">Driver Name</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_driver_name'];?>" readonly>
                                                </div>
                                            </div>
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">Driver Ph</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_driver_ph_no'];?>" readonly>
                                                </div>
                                            </div>

                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">Driver License</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_lic'];?>" readonly>
                                                </div>
                                            </div>

                                            
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">Transporter</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['tl_name'];?>" readonly>
                                                </div>
                                            </div>

                                            

                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">Bl No </label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_bl_no'];?>" readonly>

                                                </div>
                                            </div>     
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">Destination (To) </label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_destination'];?>" readonly>

                                                </div>
                                            </div>   
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">Container No </label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control"  value="<?php echo $se_list['lul_container_no'];?>" readonly>

                                                </div>
                                            </div>
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">TRA Seal No  </label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control"  value="<?php echo $se_list['lul_tra_seal_no'];?>" readonly>

                                                </div>
                                            </div>
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">Container Tare Wt </label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control"  value="<?php echo $se_list['lul_container_tare_wt'];?>" readonly>

                                                </div>
                                            </div>
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">Shipping Line   </label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control"  value="<?php echo $se_list['lul_shipping_line'];?>" readonly>

                                                </div>
                                            </div>

                                            
                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">Time IN</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['lul_time_in'];?>" readonly>
                                                </div>
                                            </div>

                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4 ">Time OUT</label>
                                                <div class="col-lg-8">
                                                    <?php
                                                        date_default_timezone_set("Africa/Nairobi");
                                                        $date = date('h:i A', time());
                                                    ?>
                                                    <input type="text" class="form-control" id="timepicker_out1" value="<?php echo $date;?>" readonly required >
                                                </div>
                                            </div>

                                            <div class="form-group col-md-6">
                                                <label class="col-lg-4 col-sm-4">Commodity</label>
                                                <div class="col-lg-8">
                                                    <input type="text" class="form-control" value="<?php echo $se_list['com_name']; ?>" readonly>
                                                </div>
                                            </div>	

                                            
                                        </div>
                                        <div class="clear"></div> 

                                        <div class="for_form">
                                            <div class="col-lg-6">
                                                <div class="form-group">
                                                    <label class="col-lg-4 col-sm-4">Load By</label>
                                                    <div class="col-lg-8">
                                                        <input type="text" class="form-control"  value="<?php echo $se_list['lul_load_by']; ?>" readonly>
                                                    </div>
                                                </div>
                                                <div class="form-group">
                                                    <label class="col-lg-4 col-sm-4">Bags Loaded</label>
                                                    <div class="col-lg-8">
                                                        <input type="text" class="form-control"  value="<?php echo $se_list['lul_bag_loaded']; ?>" readonly>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="col-lg-6">
                                                <div class="form-group">
                                                    <label class="col-lg-4 col-sm-4">Name</label>
                                                    <div class="col-lg-8">
                                                        <input type="text" class="form-control"  value="<?php echo $se_list['lul_l_name']; ?>" readonly>
                                                    </div>
                                                </div>
                                                <div class="col-lg-6" style="padding:0px">
                                                    <div class="form-group">
                                                        <label class="col-lg-4 col-sm-4">Bags(Short)</label>
                                                        <div class="col-lg-8">
                                                            <input type="text" class="form-control"  value="<?php echo $se_list['lul_bag_short']; ?>" readonly>
                                                        </div>
                                                    </div>
                                                </div>
                                                <div class="col-lg-6" style="padding:0px 10px">
                                                    <div class="form-group">
                                                        <label class="col-lg-4 col-sm-4">KGS</label>
                                                        <div class="col-lg-8">
                                                            <input type="text" class="form-control"value="<?php echo $se_list['lul_kgs']; ?>" readonly>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        
                                    </div>
                                    <header class="panel-heading">
                                        <h4 class="text-center">  <b>Commodity Details </b> </h4>
                                    </header>
                                    <div class="panel-body">
                                        <section id="unseen">
                                            <table class="table table-bordered table-striped table-condensed col-md-12">
                                                <thead>
                                                    <tr>
                                                        <th class="col-md-3">Material Name</th>
                                                        <th class="numeric col-md-3">Bag Weight</th>
                                                        <th class="col-md-3">No of Bags</th>
                                                        <th class="col-md-3">Total Weight</th>
                                                    </tr>
                                                </thead>
                                                <tbody id="tbody_id">
                                                    <?php
                                                        foreach($luml_data as $luml_rows){
                                                        ?>
                                                    <tr>
                                                        <td> <?php echo $luml_rows['ml_name'];?> </td>
                                                        <td> <?php echo $luml_rows['ml_unit_kg'];?> </td>
                                                        <td> <?php echo $luml_rows['luml_no_of_bag'];?> </td>
                                                        <td> <?php echo $luml_rows['luml_total_weight'];?> </td>
                                                    </tr>
                                                    <?php
                                                        }
                                                        ?>
                                                </tbody>
                                            </table>
                                            <!-- <div class=" col-lg-offset-5">
                                                <div class="col-lg-2">
                                                    <button type="submit" class="btn btn-success"> <i class="fa fa-thumbs-up"></i>&nbsp; Save </button>
                                                </div>
                                            </div> -->
                                        </section>
                                    </div>
                                </section>
                            </form>
                        </div>
                    </div>




                    <script>
                        $(document).ready(function(){
                            $('#w_b_gross_id').on('keypress keyup keypress', function() {
                                gross = $(this).val();
                                tare = $('#w_b_tare_r_id').val();
                                get_w_b_net(gross,tare);
                            });
                            
                            function get_w_b_net(g,t){
                                net = g-t;
                                console.log(net);
                                $('#w_b_net_r_id').val(net);
                            }
                        });
                    </script>

                    <script>
                        $(document).ready(function(){
                            $('#w_b_tare_id').on('keypress keyup keypress', function() {
                                tare = $(this).val();
                                $('#w_b_net_id').val(tare);
                                // gross = $('#w_b_gross_id').val();
                                // get_w_b_net(gross,tare);
                            });
                            function get_w_b_net(g,t){
                                net = g-t;
                                console.log(net);
                                $('#w_b_net_id').val(net);
                            }
                        });
                    </script>

                    <script type='text/javascript'>
                        se_list    = <?php echo json_encode($se_list);?>;
                        ml_list     = <?php echo json_encode($ml_list);?>;
                        unl_list    = <?php echo json_encode($unl_list);?>;
                        
                        $('#add_more_ml_id').click(function(){
                            var numcls = $('.tbody_tr_cls').length
                            append1 = '<tr class="tbody_tr_cls" id="tbody_tr_id_'+numcls+'">'+
                                        '<td><div class="form-group col-md-12" style="margin-left: -5px; padding: 0;">'+
                                        '<select class="form-control ml_details_cls" name="luml_ml_id[]" id="ml_details_id_'+numcls+'" data-common_num="'+numcls+'">'+
                                        '<option selected="">--Select--</option>';
                            append2 = '';
                            $.each(ml_list,function(i,n){
                                if(se_list.lul_com_id==n.ml_com_id){
                                    append2 += '<option value="'+n.ml_id+'">'+n.ml_name+'</option>';
                                }
                            });
                            append3 = '</select></div></td><td>'+
                                        '<div class="form-group col-md-12" style="margin-left: -5px; padding: 0;">'+
                                        '<select class="form-control" name="luml_unl_id[]">'+
                                        '<option value="">--Select Unit--</option>';
                            append4 = '';
                            $.each(unl_list,function(i1,n1){
                                append4 += '<option value="'+n1.unl_id+'">'+n1.unl_unit+'</option>'
                            });
                            append5 = '</select></div></td><td>'+
                                        '<input type="text" class="form-control enter_total_wit_cls" name="luml_total_weight[]" data-common_num_wit="'+numcls+'">'+
                                        '</td><td id="tbody_tr_td_num_bal_bag_id_'+numcls+'">'+
                                        '<input type="hidden" class="form-control enter_total_bag_cls" name="luml_no_of_bag[]" id="enter_total_bag_id_'+numcls+'">'+
                                        '&nbsp;<p  id="enter_total_wit_id_'+numcls+'" ></p>'+
                                        '<input type="hidden" class="form-control" name="luml_id[]" value="0"></td>'+
                                        '<td class="" >'+
                                        '<a class="btn btn-sm btn-danger fa fa-times tr_close_cls" data-common_num_close="'+numcls+'" id="tbody_tr_close_id_'+numcls+'"></a></td></tr>';
                            $('#tbody_id').append(''+append1+''+append2+''+append3+''+append4+''+append5+'');
                        });

                        $('body').on('change','.ml_details_cls',function(){
                            this_id                 = $(this).attr('id');
                            this_ml_val             = $('#'+this_id+'').val();
                            this_common_num_val     = $('#'+this_id+'').data('common_num');        
                            $.each(ml_list,function(i,n){
                                if(this_ml_val==n.ml_id){
                                    // $('#enter_total_wit_id_'+this_common_num_val).append(''+n.ml_total_stock+'');
                                }
                            });
                        });

                        $('body').on('keyup keydown','.enter_total_wit_cls',function(){
                            this_common_num_val     = $(this).data('common_num_wit');
                            this_ml_val             = $('#ml_details_id_'+this_common_num_val).val();
                            this_val                = $(this).val();
                            $('#enter_total_bag_id_'+this_common_num_val).val('');
                            $('#enter_total_wit_id_'+this_common_num_val).html('');
                            $.each(ml_list,function(i,n){
                                if(this_ml_val==n.ml_id){
                                    bal_c   = this_val/n.ml_unit_kg;
                                    bal     = n.ml_total_stock-bal_c;
                                    // $('#enter_total_wit_id_'+this_common_num_val).append(''+n.ml_total_stock+' / '+bal);
                                    $('#enter_total_wit_id_'+this_common_num_val).append(''+bal_c+'');
                                    $('#enter_total_bag_id_'+this_common_num_val).val(''+bal_c);
                                    // $('#enter_bal_bag_id_'+this_common_num_val).val(''+bal);
                                }
                            });
                            check_total_bg_and_ton();
                        });

                        $('body').on('click','.tr_close_cls',function(){
                            this_id                 = $(this).attr('id');
                            this_common_num_val     = $('#'+this_id+'').data('common_num_close');  
                            $( "#tbody_tr_id_"+this_common_num_val+'').remove();

                        });


                        function check_total_bg_and_ton(){
                            total_bag = 0;
                            total_wit = 0;
                            total_ton = 0;
                            $('.enter_total_wit_cls').each(function(i,n){
                                this_t_wit = $(this).val();
                                iNum = parseFloat(this_t_wit);
                                total_wit = total_wit+iNum;
                            });
                            total_ton = total_wit/1000;
                            
                            $('#total_ton_id').val(total_ton);



                            $('.enter_total_bag_cls').each(function(i,n){
                                this_t_bag = $(this).val();
                                total_bag = total_bag+parseInt(this_t_bag,10);
                            });
                            
                            $('#total_bag_id').val(total_bag);

                        }

                    </script>
                </div>
            </div>                
        </div>
    </section>
</div>