<?php echo $this->load->view("common/header"); ?>
<!-- end: HEAD -->

<!-- start: CSS REQUIRED FOR THIS PAGE ONLY -->
<!--<link rel="stylesheet" type="text/css" href="<?php echo asset_url(); ?>plugins/select2/select2.css" />
<link rel="stylesheet" href="<?php echo asset_url(); ?>plugins/DataTables/media/css/DT_bootstrap.css" />
<link href="<?php echo asset_url(); ?>plugins/bootstrap-modal/css/bootstrap-modal-bs3patch.css" rel="stylesheet" type="text/css"/>
<link href="<?php echo asset_url(); ?>plugins/bootstrap-modal/css/bootstrap-modal.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" href="<?php echo asset_url(); ?>plugins/bootstrap-fileupload/bootstrap-fileupload.min.css">
<link rel="stylesheet" href="<?php echo asset_url(); ?>plugins/select2/select2.css">-->


<!--<link rel="stylesheet" href="<?php echo asset_url(); ?>plugins/select2/select2.css">
<link rel="stylesheet" href="<?php echo asset_url(); ?>plugins/datepicker/css/datepicker.css">
<link rel="stylesheet" href="<?php echo asset_url(); ?>plugins/bootstrap-timepicker/css/bootstrap-timepicker.min.css">
<link rel="stylesheet" href="<?php echo asset_url(); ?>plugins/bootstrap-daterangepicker/daterangepicker-bs3.css">
<link rel="stylesheet" href="<?php echo asset_url(); ?>plugins/bootstrap-colorpicker/css/bootstrap-colorpicker.css">
<link rel="stylesheet" href="<?php echo asset_url(); ?>plugins/jQuery-Tags-Input/jquery.tagsinput.css">
<link rel="stylesheet" href="<?php echo asset_url(); ?>plugins/bootstrap-fileupload/bootstrap-fileupload.min.css">
<link rel="stylesheet" href="<?php echo asset_url(); ?>plugins/summernote/build/summernote.css">-->

<style type="text/css">
    .table > thead:first-child > tr:first-child > th, .table > thead:first-child > tr:first-child > td, .table-striped thead tr.primary:nth-child(2n+1) th {
        background-color: #428bca;
        border-color: #357ebd;
        border-top: 1px solid #357ebd;
        color: white;
        text-align: center;
    }
.sl_des_table td{
	padding:2px;
	
}
</style>
<!-- end: CSS REQUIRED FOR THIS PAGE ONLY -->
<!-- end: HEAD -->
<!-- start: BODY -->

<body>
    <!-- start: HEADER -->
    <div class="navbar navbar-inverse navbar-fixed-top">
        <!-- start: TOP NAVIGATION CONTAINER -->
        <div class="container">
            <div class="navbar-header">
                <!-- start: RESPONSIVE MENU TOGGLER -->
                <button data-target=".navbar-collapse" data-toggle="collapse" class="navbar-toggle" type="button">
                    <span class="clip-list-2"></span>
                </button>
                <!-- end: RESPONSIVE MENU TOGGLER -->
                <!-- start: LOGO -->
                <?php $this->load->view("common/logo"); ?>
                <!-- end: LOGO -->
            </div>
            <div class="navbar-tools">
                <!-- start: TOP NAVIGATION MENU -->
                <?php $this->load->view("common/notifications.php"); ?>
                <!-- end: TOP NAVIGATION MENU -->
            </div>
        </div>
        <!-- end: TOP NAVIGATION CONTAINER -->
    </div>
    <!-- end: HEADER -->
    <!-- start: MAIN CONTAINER -->
    <div class="main-container">
        <div class="navbar-content">
            <!-- start: SIDEBAR -->
            <?php $this->load->view("common/navigation"); ?>
            <!-- end: SIDEBAR -->
        </div>
        <!-- start: PAGE -->
        <div class="main-content">
            <!-- end: SPANEL CONFIGURATION MODAL FORM -->
            <div class="container">
                <!-- start: PAGE HEADER -->
                <div class="row">
                    <div class="col-sm-12">
                        <!-- start: PAGE TITLE & BREADCRUMB -->
                        <ol class="breadcrumb">
                            <li>
                                <a href="<?php echo base_url('dashboard'); ?>">
                                    Dashboard 
                                </a>
                            </li>
                            <li>
                                <a href="#">
                                    Pay Role 
                                </a>
                            </li>

                            <li class="active">
                               Attendants Finalize 
                            </li>
                            <li class="search-box">
                                <form class="sidebar-search">
                                    <div class="form-group">
                                        <input type="text" placeholder="Start Searching...">
                                        <button class="submit">
                                            <i class="clip-search-3"></i>
                                        </button>
                                    </div>
                                </form>
                            </li>
                        </ol>
                        <div class="page-header">
                            <h1>Attendants Finalize </h1>
                        </div>

                        <p>Please use the table below to navigate or filter the results. </p>
                    </div>
                </div>
                <!-- end: PAGE HEADER -->
                <!-- start: PAGE CONTENT 
                <!-- start grid -->
                <div class="row">
                    <div class="col-md-12">
 
 
 
 <!--start salary finalize-->
 <?php if ($this->session->userdata('ss_group_id')==1 || $this->session->userdata('ss_group_id')==2){ ?>
    <div class="panel panel-default">
								<div class="panel-heading">
									<i class="fa fa-money"></i>
									Attendants Finalize
									<div class="panel-tools">
										<a class="btn btn-xs btn-link panel-collapse collapses" href="#">
										</a>
										
										<a class="btn btn-xs btn-link panel-refresh" href="#">
											<i class="fa fa-refresh"></i>
										</a>
										<a class="btn btn-xs btn-link panel-expand" href="#">
											<i class="fa fa-resize-full"></i>
										</a>
										<a class="btn btn-xs btn-link panel-close" href="#">
											<i class="fa fa-times"></i>
										</a>
									</div>
								</div>
								<div class="panel-body">
									
                           <!--start search-->                       
<div class="col-md-12">
<!-- style="display:none"-->
<div style="height:50px; display:none" id="lording_bar">
Please wait...
<div class="progress progress-striped active progress-sm">
<!---->
										<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 100%">
											<span class="sr-only"> 60% Complete (warning)</span>
										</div>
</div>									</div>


<div class="col-sm-3" style="display:none">
<div class="form-group">
<label>Warehouse </label>
<select id="srh_warehouse_id" class="form-control" name="srh_warehouse_id">

<?php 
$ss_warehouse_id=$this->session->userdata('ss_warehouse_id'); 
foreach ($warehouse_list as $row)
{
$sel='';
if($ss_warehouse_id==$row->id)
{
$sel=' selected="selected"';
}
?>  

<option value="<?php echo $row->id; ?>" <?php echo $sel; ?>>
<?php echo $row->name; ?>
</option>
<?php }?>

</select>                                          
</div>
</div>


<div class="col-sm-3">
<div class="form-group">
<label>Employee </label>

<input type="text" id="srh_user_id_s"  name="srh_user_id_s" class="js-data-user-ajax-srh form-control" style="padding:0px 0px; border: none; box-shadow: none" placeholder="-Select Employee-" />

<!--<select id="srh_user_id_s" class="form-control search-select" name="srh_user_id_s">
 
 <option value="">-- Sales Employee--</option>

                                                                    <?php 						
						foreach ($user_list as $row)
							{?>
                            
                            <option  value="<?php echo $row->user_id;?>">												
							
							<?php echo $row->user_first_name;?>                                                       
                            </option>				   
                            
							<?php }  ?>
                            
                            
                            
                          			 
						     						
</select>-->                                      
</div>
</div>

<div class="col-sm-3">
<div class="form-group">
<label>Month </label>

<select id='month_id' name="month_id"class="form-control">
    <option value=''>--Select Month--</option>
    <option value='1'>Janaury</option>
    <option value='2'>February</option>
    <option value='3'>March</option>
    <option value='4'>April</option>
    <option value='5'>May</option>
    <option value='6'>June</option>
    <option value='7'>July</option>
    <option value='8'>August</option>
    <option value='9'>September</option>
    <option value='10'>October</option>
    <option value='11'>November</option>
    <option value='12'>December</option>
    </select>                                         
</div>
</div>

 


                                                        <div class="col-sm-3">

                                                      	<div class="form-group">

															<label for="s2id_autogen1">Finalize Date </label>

                                                             <input id="srh_fd_date" name="srh_fd_date" type='text' class="form-control date" value="" data-bv-field="date"/>                                         
                   

                                                            

														</div>

													</div>
                                                    
                                                
                                                    
                                                    
                                                    <div class="col-md-4 pull-right" style="margin-top:21px;">
                  <input class="btn btn-warning" value="Attendants Finalize" name="search" id="search" type="submit" onClick="finalize_attendants()"> 
                 <!-- <input name="add_category" value="Print Pay Sheet" class="btn btn-green" onClick="print_pay_sheet()" type="submit">-->
                  
                  <input name="add_category" value="Reset" class="btn btn-danger" onClick="location.reload()" type="submit">
                  </div> 
                  
                 
</div> 
<!--end search-->           
                                    
								</div>
							</div>
    
    <?php }?>   
 <!--end salary finalize-->
                    
  <!--start search box-->  
    <div class="panel panel-default">
								<div class="panel-heading">
									<i class="fa fa-search"></i>
									Details
									<div class="panel-tools">
										<a class="btn btn-xs btn-link panel-collapse collapses" href="#">
										</a>
										
										<a class="btn btn-xs btn-link panel-refresh" href="#">
											<i class="fa fa-refresh"></i>
										</a>
										<a class="btn btn-xs btn-link panel-expand" href="#">
											<i class="fa fa-resize-full"></i>
										</a>
										<a class="btn btn-xs btn-link panel-close" href="#">
											<i class="fa fa-times"></i>
										</a>
									</div>
								</div>
								<div class="panel-body">
									
                           <!--start search-->                       
<div class="col-md-12">


<div class="col-md-12">
<button class="btn btn-blue dropdown-toggle pull-right" data-toggle="dropdown" id="excel">
<i class="fa fa-fw" aria-hidden="true" title="Copy to use file-excel-o"></i>
</button> 
 
 <button onClick="printDiv('printableArea')" class="btn btn-blue dropdown-toggle pull-right" data-toggle="dropdown" style="margin-right:10px;">
<i class="fa fa-print"></i>
</button> 
 </div>                                                   
 <div id="printableArea">                                                   
  <div class="col-md-12" id="return_msg_wap">
  
  
  </div>  
  </div> 
          
                                    
								</div>
							</div>
    
    <!--end search box-->                    
                    
                    
   
                  
                    
                    
                    
                    
                    
                        <!-- start: DYNAMIC TABLE PANEL -->
                       
                        
                    </div>
                    <!-- end: DYNAMIC TABLE PANEL -->
                </div>
            </div>

            <!-- end grid -->


        </div>
        <!-- end: PAGE -->
    </div>
    <!-- end: MAIN CONTAINER -->
    <!-- start: FOOTER -->
    <div class="footer clearfix">
        <div class="footer-inner">
          
        </div>
        <div class="footer-items">
            <span class="go-top"><i class="clip-chevron-up"></i></span>
        </div>
    </div>
    <!-- end: FOOTER -->

    <!-- start ajax model -->
    <div id="ajax-modal" class="modal fade" data-backdrop="static" data-keyboard="false" tabindex="-1" style="display: none;"></div>
    <!-- end ajax model -->

    <!-- start: MAIN JAVASCRIPTS -->
    <?php $this->load->view("common/footer"); ?>
    <!-- end: MAIN JAVASCRIPTS -->
   
  
   <script src="<?php echo asset_url(); ?>js/jquery-ui.js" ></script>		

		<script src="<?php echo asset_url(); ?>js/moment-with-locales.js"></script>

		<script type="text/javascript" src="<?php echo asset_url(); ?>js/bootstrap-datetimepicker.js"></script>
        <script type="text/javascript" src="<?php echo asset_url(); ?>js/jquery.dataTables.min.js"></script>
         <script type="text/javascript" src="<?php echo asset_url(); ?>js/dataTables.bootstrap.min.js"></script>
         
         
	<script type="text/javascript" language="javascript" src="<?php echo asset_url(); ?>/js/dataTables.buttons.min.js">
	</script>
	<script type="text/javascript" language="javascript" src="<?php echo asset_url(); ?>/js/buttons.print.min.js">
	</script>
	<script type="text/javascript" language="javascript" src="<?php echo asset_url(); ?>/js/buttons.flash.min.js">
	</script>
	
    <script type="text/javascript" language="javascript" src="<?php echo asset_url(); ?>js/jszip.min.js"></script>
	<script type="text/javascript" language="javascript" src="<?php echo asset_url(); ?>/js/pdfmake.min.js">
	</script>
	<script type="text/javascript" language="javascript" src="<?php echo asset_url(); ?>/js/vfs_fonts.js">
	</script>
	<script type="text/javascript" language="javascript" src="<?php echo asset_url(); ?>/js/buttons.html5.min.js">
	</script>
	<script type="text/javascript" language="javascript" src="<?php echo asset_url(); ?>/js/buttons.print.min.js"></script>
   
   <script type="text/javascript" src="<?php echo asset_url(); ?>js/accounting.js"></script>

          <script type="text/javascript" src="<?php echo asset_url(); ?>js/accounting.min.js"></script>     
          
          <script src="<?php echo asset_url(); ?>/plugins/select2/select2.min.js"></script>  
          <script type="text/javascript" src="<?php echo asset_url(); ?>js/bootbox.min.js"></script>
    <script>
	
	 $('#srh_from_date').datetimepicker({
        format: 'YYYY-MM-DD',

         <?php
//if (isset($salary_byid['sl_date']))
 {
    $d = date("Y, m-2, d", strtotime(date("Y-m-d"))); //(1985,01,01)
    ?>
            defaultDate: new Date (<?php echo $d ?>)
<?php }
// else
 { ?>
           // defaultDate: new Date()
<?php } ?>

        });
		
		 $('#srh_to_date').datetimepicker({
        format: 'YYYY-MM-DD',

            defaultDate: new Date()


        });
		 $('#srh_fd_date').datetimepicker({
        format: 'YYYY-MM-DD',

            defaultDate: new Date()


        });
		
		
	
	jQuery(document).ready(function() {
//FormElements.init();
//var tomorrow = new Date();
//currentDate=tomorrow.setDate(tomorrow.getDate() + 1);
loadGrid();
});

		function printDiv(divName) {
     var printContents = document.getElementById(divName).innerHTML;
     var originalContents = document.body.innerHTML;

     document.body.innerHTML = printContents;

     window.print();

     document.body.innerHTML = originalContents;
}

$(function(){
    $('#excel').click(function(){
        var url='data:application/vnd.ms-excel,' + encodeURIComponent($('#printableArea').html()) 
        location.href=url
        return false
    })
})


function print_pay_sheet(){
	var srh_to_date=$("#srh_to_date").val();
	var srh_from_date=$("#srh_from_date").val();
	var srh_user_id=$("#srh_user_id").val();
	
	//alert(srh_user_id);
	if(!srh_user_id){
		 bootbox.alert('Please select user', function () {
		 });
	}else{
		  u = location.href;
            t = document.title;

            window.open('<?php echo base_url() ?>reports/paysheet_print?user_id=' + srh_user_id+'&srh_from_date='+srh_from_date+'&srh_to_date='+srh_to_date, 'sharer', 'toolbar=0,status=0,width=520,height=600, left=10, top=10,scrollbars=yes');
            return false;
	
	}
}

function print_pay_sheet_sel_user(srh_user_id){
		var srh_to_date=$("#srh_to_date").val();
	var srh_from_date=$("#srh_from_date").val();
	//var srh_user_id=$("#srh_user_id").val();
	
	//alert(srh_user_id);
	if(!srh_user_id){
		 bootbox.alert('Please select user', function () {
		 });
	}else{
		  u = location.href;
            t = document.title;

            window.open('<?php echo base_url() ?>reports/paysheet_print?user_id=' + srh_user_id+'&srh_from_date='+srh_from_date+'&srh_to_date='+srh_to_date, 'sharer', 'toolbar=0,status=0,width=520,height=600, left=10, top=10,scrollbars=yes');
            return false;
	
	}
}

function search_by_custum_value(){
	//alert();
	loadGrid();
}

function finalize_attendants(){
	$('#return_msg_wap').html('');
	var user_id=$("#srh_user_id_s").val();
	//alert(user_id);
	var month_id=$("#month_id").val();
	var srh_fd_date=$("#srh_fd_date").val();
	var srh_warehouse_id=$("#srh_warehouse_id").val();
	if(month_id=='') {
		bootbox.confirm("Please seelct month", function(result){ 
		
		 });	
		return false;	
	}
	var month_name=$("#month_id option:selected").text();
	bootbox.confirm("Please confirm to finalize "+month_name+ " manth attendants", function(result){ 
	
	//alert(result);
if(result===true){	
$("#lording_bar").show();
	
	
	$.post( "<?php echo base_url();?>attendants/finalize_attendants_add", {user_id:user_id,month_id:month_id,srh_fd_date:srh_fd_date,srh_warehouse_id:srh_warehouse_id,month_name:month_name})

		     .done(function( data ) {
				 $("#lording_bar").hide();

		     var obj = jQuery.parseJSON(data);

			 if(obj.status==1)// load customer data

			 {
				
			 displayNotice('page','Successfully completed!');
			 var warehouse_name=$( "#srh_warehouse_id option:selected" ).text();
			var details="<div  style='text-align:center'>  <h3>"+warehouse_name+"</h3><h4>"+month_name+" Month Attendants Finalize Details </h4><h5>Created : <?php echo display_date_time_format(date("Y-m-d H:i:s")); ?></h5></div>";
			
			 
			 
			 
			 $('#return_msg_wap').html(details+obj.return_msg);
			 

			 //setTimeout(function(){location.reload();},1000);

			 }

			 if(obj.status==0)// load customer data

			 { 

			 displayNotice('page','Error!');
			  $('#return_msg_wap').html('');
			

			 }

	      });

	    }
		else{
			 $("#lording_bar").hide();	
		}

	 });	
}

        function loadGrid() {
			var warehouse_name=$( "#srh_warehouse_id option:selected" ).text();
			
			var warehouse_id=$("#warehouse_id").val();
			var srh_to_date=$("#srh_to_date").val();
			var srh_from_date=$("#srh_from_date").val();
			
			var srh_user_name='';
			var data = $('#srh_user_id').select2('data');
			if(data) {
				srh_user_name=data.text;
			}	
			var srh_group_name='';
			var data = $('#group_id').select2('data');
			if(data) {
				srh_group_name=data.text;
			}			
			var srh_user_id=$("#srh_user_id").val();
			var group_id=$("#group_id").val();
			//alert(srh_user_name);
			//alert(srh_user_id);
			var message="<div  style='text-align:center'>  <h2>"+warehouse_name+"</h2><h4>User Salary Details</h4><h5>Group : "+srh_group_name+"</h5><h5>Employee : "+srh_user_name+"</h5><h5>From Date: "+srh_from_date+" , To Date: "+srh_to_date+"</h5></div>";
			
			
			
			
			
			
			//alert(srh_user_id);
            $('#products_table').DataTable({
				
				"sDom": '<"top"lfB>rt<"bottom"ip><"clear">',
							
					buttons: [
       { extend: 'print', text: 'Print',footer: true, message: message,title: '',
	   exportOptions:{
		stripHtml:false
	},
	   },
       { extend: 'excel', text: 'Save as Excel',footer: true, message: message,title: ''},
	
    ],
				"bProcessing": true,
        		"serverSide": true,
				"ajax": {
								 'type': 'POST',
								 'url': '<?php echo base_url('reports/get_list_user') ?>',
								 'data': {
								 srh_user_id: srh_user_id,
								 warehouse_id:warehouse_id,
								 srh_to_date:srh_to_date,
								 srh_from_date:srh_from_date,
								  group_id:group_id
								}
							 },
              
                "bDestroy": true,
                "iDisplayLength": -1,
				 "lengthMenu": [[-1,50,150,-1], ['All',10,50,150]],
                "order": [[2, "asc"]],"footerCallback": function ( row, data, start, end, display ) {
				var api = this.api(), data;	 
				// Remove the formatting to get integer data for summation
				var intVal = function ( i ) {
					//alert(i);
					return typeof i === 'string' ? i.replace(/[\$,]/g, '')*1 : typeof i === 'number' ?	i : 0;
				};
	 
				
				var col_1=0;
				var table = $('#products_table').DataTable();
				
				
				
				<!---->
			
				col_1 = api.column(7).data().reduce( function (a, b) {
					return intVal(a) + intVal(b);
				},0 );
				
				if(col_1){
				var column = table.column(7);
				$( column.footer() ).html(
				column.data().reduce( function (a,b) {
					return "<span style='text-align: right;'>"+accounting.formatMoney(col_1, "", 2, ",", ".")+"<span>";
				} )
				
				);
				}
				<!---->
				
				<!---->
			
				col_1 = api.column(3).data().reduce( function (a, b) {
					return intVal(a) + intVal(b);
				},0 );
				
				if(col_1){
				var column = table.column(3);
				$( column.footer() ).html(
				column.data().reduce( function (a,b) {
					return "<span style='text-align: right;'>"+accounting.formatMoney(col_1, "", 2, ",", ".")+"<span>";
				} )
				
				);
				}
				<!---->
				
				<!---->
			
				col_1 = api.column(4).data().reduce( function (a, b) {
					return intVal(a) + intVal(b);
				},0 );
				
				if(col_1){
				var column = table.column(4);
				$( column.footer() ).html(
				column.data().reduce( function (a,b) {
					return "<span style='text-align: right;'>"+accounting.formatMoney(col_1, "", 2, ",", ".")+"<span>";
				} )
				
				);
				}
				<!---->
				
				<!---->
			
				col_1 = api.column(5).data().reduce( function (a, b) {
					return intVal(a) + intVal(b);
				},0 );
				
				if(col_1){
				var column = table.column(5);
				$( column.footer() ).html(
				column.data().reduce( function (a,b) {
					return "<span style='text-align: right;'>"+accounting.formatMoney(col_1, "", 2, ",", ".")+"<span>";
				} )
				
				);
				}
				<!---->
				
				<!---->
			
				col_1 = api.column(6).data().reduce( function (a, b) {
					return intVal(a) + intVal(b);
				},0 );
				
				if(col_1){
				var column = table.column(6);
				$( column.footer() ).html(
				column.data().reduce( function (a,b) {
					return "<span style='text-align: right;'>"+accounting.formatMoney(col_1, "", 2, ",", ".")+"<span>";
				} )
				
				);
				}
				<!---->
				
				<!---->
				/*col_1 = api.column(6).data().reduce( function (a, b) {
					return intVal(a) + intVal(b);
				},0 );
				
				
				if(col_1){
				var column = table.column(6);
				$( column.footer() ).html(
				column.data().reduce( function (a,b) {
					return "<span style='text-align: right;'>"+accounting.formatMoney(col_1, "", 2, ",", ".")+"<span>";
				} )
				
				);
				}*/
				<!---->
				
				
				<?php
				//}
				?>

				
					
					},
            });

        }

        $('a#modal_ajax_salary_payment_btn').on('click', function () {
            $('body').modalmanager('loading');
            setTimeout(function () {
                $modal.load('<?php echo base_url("salary_payment/create_salary_payment"); ?>', '', function () {

                    $modal.modal();

                });
            });
        });


//        function update_fix_assets(fxd_ass_id) {
////alert(fxd_ass_id);	
//            var $modal = $('#ajax-modal');
//            $('body').modalmanager('loading');
//            setTimeout(function () {
//                $modal.load('<?php // echo base_url("fixed_assets/create_fixed_assets?fxd_ass_id=");    ?>' + fxd_ass_id, '', function () {
//                    $modal.modal();
//                    /*$("#country_id").select2();
//                     $(".search-select").select2({
//                     placeholder: "Select a State",
//                     allowClear: true
//                     });*/
//                });
//            }, 1000);
//        }
    </script>
    <script>
        jQuery(document).ready(function () {
			
			//$("#srh_user_id_s").select2();
			
			$("#group_id").select2();

            //conirm
            $("#conirm").click(function () {
                var sel_pay_id = $('#sel_pay_id').val();
                var popup_type = $('#popup_type').val();
                var page = $('#page').val();
                var id = sel_pay_id;

                if (page == 'salary_list') {
                    if (popup_type == 'delete') {
                        $.post("<?php echo base_url('salary_payment/delete') ?>", {id: id})
                                .done(function (data) {
                                    var obj = jQuery.parseJSON(data);
                                    loadGrid();// load supplier data
                                    displayNotice('page', 'Salary payment has been deleted successfully!');
                                    location.reload(true);
                                });
                    }
                } //end page check
            });


        });


        function deleteSalaryPaymentData(id) {
            $("#myModal4").modal();
            $('#sel_pay_id').val(id);
            $('#popup_type').val('delete');
            $('#page').val('salary_pay_list');
            $("#label").text("Are you sure you want to delete this Salary Payment?");
        }
        function click_salary_payment_btn(id) {

            var $modal = $('#ajax-modal');
            $('body').modalmanager('loading');

            setTimeout(function () {
                $modal.load('<?php echo base_url("salary_payment/create_salary_payment?mstr_sal_pay_id="); ?>' + id, '', function () {
                    $modal.modal();
                });
            }, 1000);
        }
		
        $(".js-data-user-ajax-srh").select2({
        ajax: {
        url: "<?php echo base_url('salary/getUser') ?>",
                dataType: 'json',
                delay: 10,
                data: function (query) {
                if (!query)
                        query = '';
                return {
                search_string: query,
                        format: 'json'
                };
                },
                results: function (data) {
                return {
                results: $.map(data, function (item) {
                var text1 = item.user_first_name + "  (" + item.user_group_name + ")";
                return {
                text: text1,
                        slug: item.user_first_name,
                        id: item.user_id
                };
                })
                };
                },
                cache: true
        }
        });
    </script>
</body>