MOON
Server: Apache
System: Linux nserver.cafsindia.com 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: cafsindia (1002)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: /home/cafsindia/uds.cafsinfotech.in/application/views/pre_audit_manual_salary/manage.php
<?php 
	$this->load->view("partial/header"); 
	$access_data    = $this->session->userdata('access_data');
	$access_add     = (int)$access_data[$controller_name]['access_add'];
	$access_update  = (int)$access_data[$controller_name]['access_update'];
	$access_delete  = (int)$access_data[$controller_name]['access_delete'];
	$access_search  = (int)$access_data[$controller_name]['access_search']; 
	$access_export  = (int)$access_data[$controller_name]['access_export'];
	$access_import  = (int)$access_data[$controller_name]['access_import'];
	$page_name      = ucwords(str_replace("_"," ",$controller_name));
	$prime_id       = "prime_".$controller_name."_id";
	$search_url     = site_url($controller_name ."/search");
	$view_url       = site_url($controller_name ."/view/");
	$import_url     = site_url($controller_name ."/import/");
	
	/* PAGE TITLE AND BUTTONS- START */
	$breadcrumb     = "";
	$quick_link     = explode(",",$quick_link->quicklink);
	$link_li_line   = "";
	foreach($quick_link as $link){
		if($link){
			$url    = site_url("$link");
			$name   = ucwords(str_replace("_"," ",$link));
			$link_li_line .= "<li><a href='$url'> <i class='fa fa-angle-double-right fa-lg' aria-hidden='true'></i> $name</a></li>";
		}
	}
	if($link_li_line){
		$breadcrumb .= "<li class='dropdown'>
							<a class='btn btn-xs btn-primary dropdown-toggle' type='button' id='dropdownMenu2' data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>
								<i class='fa fa-plus-circle' aria-hidden='true'></i> Quick Links
							</a>
							<ul class='dropdown-menu dropdown-menu-left' aria-labelledby='dropdownMenu2'>
								$link_li_line
							</ul>
						</li>";
	}
	$breadcrumb     .="<li><a href='$site_url#Home'>Home</a></li>
					<li><a href='".site_url($controller_name)."#$controller_name'>$page_name</a></li>
					<li class='active'>List</li>";
					
	
	/* PAGE TITLE AND BUTTONS- END */
?>
<style type="text/css">
	body{
		overflow-x: hidden;
	}
	.form-inline .form-group {
		display: inline-block;
		vertical-align: middle;
		margin-left: 30px;
		margin-bottom: 10px;
		width: 16.5%;
	}
	.form-group {
		display: inline-block;
		vertical-align: middle;
		margin-left: 30px;
		margin-bottom: 10px;
		width: 16.5%;
	}
	.display th, .display td {
		white-space: nowrap !important;
	    max-width: 500px !important;
	}
	.bootstrap-datetimepicker-widget {
		position: fixed;
	}
	#table_foot tr th{
		text-align:center !important;
	}
	#table tbody tr td{
		text-align:center !important;
	}
	.table-hover thead tr th{
		text-align:center !important;
	}
	.audit_app_entry {
		background-color:#a2f1a2 !important;
	}
	.display th, .display td {
		white-space: nowrap !important;
		max-width: 500px !important;
	}
	table.dataTable tr th:nth-child(1),table.dataTable tr td:nth-child(1){
		position: sticky !important;
		left: 0px;
		width: 0px;
		min-width: 0px;
	}
	table.dataTable tr th:nth-child(2),table.dataTable tr td:nth-child(2){
		position: sticky !important;
		left: 85px;
		width: 70px;
		min-width: 70px;
	}
	table.dataTable tr th:nth-child(3),table.dataTable tr td:nth-child(3){
		position: sticky !important;
		left: 208px;
		width: 70px;
		min-width: 70px;
	}
	table.dataTable tr td:nth-child(1),table.dataTable tr td:nth-child(2),table.dataTable tr td:nth-child(3) {
		background-color: #f2f2f2;
	}
	table.dataTable tfoot tr th:nth-child(1),table.dataTable tfoot tr th:nth-child(2),table.dataTable tfoot tr th:nth-child(3) {
   		background-color: #f2f2f2;
   		position: sticky;
   		z-index: 2; 
	}
	table.dataTable tfoot tr th {
   		line-height: 20px;
   		position: sticky;
   		bottom: 0;
   		top: 0;
	}
</style>
<div class='row title_content' id='input_text'>
	<div class='col-md-2 col-xs-4'>
		<h1 class='page_txt'>MSAL Audit</h1>
	</div>		
</div>
<div id="toolbar" class="form-inline">	 <!-- min-height: 400px; -->
	<fieldset>
		<div class='col-md-12' style='padding:8px;'>
			<?php echo form_open("$controller_name/view_report",array('id'=>'pre_audit_manual_form','autocomplete'=>'off')); ?>
			<div class="form-group">
				<?php
					echo form_label($this->lang->line('select_month'), 'search_month', array('class' => 'required'));
					echo form_input(array('name' => 'search_month', 'id' => 'search_month', 'class' => 'form-control input-sm mon_datepicker','placeholder' => 'Select Month', 'value'=>'')); 
				?>
			</div>
			<div class="form-group">
				<?php
					echo form_label('Personal Area', 'personal_code', array('class' => 'required'));
					echo form_dropdown(array( 'name' => 'personal_code', 'id' => 'personal_code', 'class' => 'form-control input-sm select2'), $per_area_list);
				?>
			</div>
			<div class="form-group">
				<?php
					echo form_label('Project', 'project', array('class' => 'required'));
					echo form_dropdown(array( 'name' => 'project', 'id' => 'project', 'class' => 'form-control input-sm select2'));
				?>
			</div>
			<div class="form-group" id = 'wbs_element_div'>
			<!-- style="display: none;" -->
				<?php
					echo form_label('Wbs Element', 'fil_wbs_element', array('class' => ''));
					echo form_dropdown(array( 'name' => 'fil_wbs_element[]', 'multiple id' => 'fil_wbs_element', 'class' => 'form-control input-sm select2'));
				?>
			</div>
			<div class="form-group">
				<?php
					echo form_label("Pay Type", 'pay_type', array('class' => ''));
					echo form_dropdown(array("name" =>'pay_type',"id" =>'pay_type',"class" =>'form-control input-sm select2'),$pay_type_list);
				?>
			</div>
			<div class="form-group">
				<?php
					$process_mode = array("" => "---- Select Type ----","1" => "Audit","2" => "View");
					echo form_label("Process Mode", 'process_mode', array('class' => 'required'));
					echo form_dropdown(array("name" =>'process_mode',"id" =>'process_mode',"class" =>'form-control input-sm select2'),$process_mode);
				?>
			</div>
			
			<!-- jquery form validation function -->
			<?php 
				$validation_rule .=  "search_month:{required: true },personal_code:{required: true },project:{required: true },process_mode:{required: true }";
			?>

			<div class="form-group">
				<button class='btn btn-primary btn-sm' id="search"><i class='fa fa-send-o' aria-hidden='true'></i> View </button>
			</div>
			<?php 
				echo form_close(); 
			?>
		</div>
	</fieldset>
</div>	
<div class="row" style='margin:0px;width: 100%;'>	 <!-- display: none; -->	
	<div class='col-md-12' id='table_div' style='padding:8px;min-height: 600px;display: none;' >	
		<div class='dataTables_length' id='table_length' style='display: -webkit-inline-box;display:none;'>
			<table>
				<td><button class='btn btn-xs btn-info approve' id='manual_approve' style='margin:5px;'><i class='fa fa-floppy-o' aria-hidden='true'></i> Approve</button></td>			
				<td><button class='btn btn-xs btn-danger reject' id='manual_reject' style='margin:5px;'><i class='fa fa-trash-o' aria-hidden='true'></i> Reject</button></td>			
			</table>
		</div>
		<!-- class='row' -->
		<div style="overflow:auto;height:600px;">
			<table id="table" class='table-hover display' style='width:100% !important;'></table>
		</div>
	</div>
</div>

<script type="text/javascript">
$(document).ready(function (){
	$(".mon_datepicker").datetimepicker({format: 'MM-YYYY',});
	$('.select2').select2({placeholder: '---- Select ----',});

	var pay_type_arr  = <?php echo json_encode($pay_type_arr); ?>;

	//DR CODE FOR PROJECT ID FETCH BASED ON PERSONAL CODE
	$(document).on('change','#personal_code',function(e){
		let personal_code    = $('#personal_code').val();
		let search_month     = $('#search_month').val();
		project_id_fetch(search_month,personal_code);
	});
	$(document).on('dp.hide','#search_month',function(e) {
		let personal_code    = $('#personal_code').val();
		let search_month     = $('#search_month').val();
		project_id_fetch(search_month,personal_code);
	});
	//Get WBS Data based on month and project - BSK
	$(document).on('change','#project',function(e){
		let personal_code = $('#personal_code').val();
		let project       = $('#project').val();
		let search_month  = $('#search_month').val();
		fil_wbs_fetch(personal_code,project,search_month);
	});

	// CLICK BACK TO FORM BUTTON
	$(document).on('click', '#show_form', function(e) {
		$('#table_div,#show_form').hide();
		$('#toolbar').show();
		$('#input_text').html("<div class='col-md-2 col-xs-4'><h1 class='page_txt'>MSAL Audit</h1></div>");
	});

	//View Report
	$('#pre_audit_manual_form').submit(function(event){ event.preventDefault(); }).validate({
		ignore: ".ignore",
		rules:{
			<?php echo $validation_rule; ?>
		},
		submitHandler: function(form){
			$('#search').html("<i class='fa fa-spinner fa-spin'></i> Processing...");
			$('#search').attr('disabled','disabled');
			//Encrypted
			let formData           = new FormData(form);
			// Convert FormData to JSON object
			let jsonData           = Object.fromEntries(formData.entries());
			var encKey             = '<?php echo $encKey; ?>';
			var encData            = encrypt(encKey,jsonData);
			$.ajax({
				type: "POST",
				url: '<?php echo site_url($controller_name . "/view_report"); ?>',
				data:encData,				
				contentType: 'text/plain',
				success: function (response){
				if(response.status){
					var personal_text = $('#personal_code option:selected').text();
					var project_text  = $('#project option:selected').text();
					var search_month  = $('#search_month').val();
					var tbl_text      = "<tr><td><h1 class='page_txt'>MSAL Audit</h1></td><td style='text-align: center;'><span style='color:#f78223 !important;font-size:13px;'>Process Month</span><br>"+search_month+"</td><td style='text-align: center;'><span style='color:#f78223 !important;font-size:13px;'>Personal Code</span><br>"+personal_text+"</td><td style='text-align: center;'><span style='color:#f78223 !important;font-size:13px;'>Project</span><br>"+project_text+"</td><td><button class='btn btn-xs btn-primary table_view'  title='Back to Form' id='show_form'> <span class='fa fa-arrow-right'>&nbsp</span>Back to Form</button></td></tr>";
					$('#input_text').html("<div class='col-md-12 col-xs-12'  style='padding: 8px;'><table class='table' style='font-weight: bold;'><tbody>"+tbl_text+"</tbody></table></div>");
					$('#table_div').show();
					$('#toolbar').hide();
					table_draw(response.table_head,response.result_data);
				}else{
					toastr.error(response.message);
				}
				$('#search').attr('disabled',false);
				$('#search').html("<i class='fa fa-send-o' aria-hidden='true'></i>  View");
				},
				dataType: 'json'
			});
		}
	});

	//Approve All Data
	$(document).on('click','#manual_approve',function(e){
		$.confirm({
			onOpen: function(){
				var search_month = $('#search_month').val();
				search_month     = moment('01-'+search_month,'DD-MM-YYYY').format('YYYY-MM');
		    	$(".posting_month").datetimepicker({
					format: 'MM-YYYY',
					minDate:search_month ,
					maxDate:search_month,
				});
            },
            onClose: function(){
                $(".posting_month").datetimepicker("destroy");
            },
		    title: 'Are You Sure You want to Approve all the rows..!',
		    content: '' +
		    '<form action="" class="formName">' +		    
		    '<label>Enter Your Remarks here</label>' +
		    '<input type="text" placeholder="Your Remarks" class="remarks form-control" required />' +
		    '</form>',
		    buttons: {
		        formSubmit: {
		            text: 'Submit',
		            btnClass: 'btn-blue',
		            action: function () {
		                //var posting_month = this.$content.find('.posting_month').val();
		                var remarks       = this.$content.find('.remarks').val();
		               /* if(!posting_month){
		                    $.alert('Provide a valid Posting Month');
		                    return false;
		                }else*/
		                if(!remarks){
		                    $.alert('provide a valid Remarks');
		                    return false;
		                }else{
		                	update_status(remarks,'approve');
		                }			               
		            }
		        },
		        cancel: function () {
		            //close
		        },
		    }
		});		
	});
	//reject Functionality
	$(document).on('click','#manual_reject',function(e){
		$.confirm({
		    title: 'Are You Sure You want to reject the selected rows..!',
		    content: '' +
		    '<form action = "" class = "formName">' +
		    '<label>Enter Your Remarks here</label>' +
		    '<input type  = "text" placeholder = "Your Remarks" class = "remarks form-control" required />' +
		    '</form>',
		    buttons: {
		        formSubmit: {
		            text: 'Submit',
		            btnClass: 'btn-blue',
		            action: function(){
		                var remarks = this.$content.find('.remarks').val();
		                if(!remarks){
		                    $.alert('provide a valid Remarks');
		                    return false;
		                }else{
		                	update_status(remarks,'reject');
		                }			               
		            }
		        },
		        cancel: function () {
		            //close
		        },
		    }
		});	
	});
	//DR CODE START FOR WBS ELEMENT MULTIPICKLIST PASTE DATA FETCH @30AUG22@
	var current_pin	    = [];
	$(document).on('paste','#wbs_element_div', function(e){
		var pastedData  = e.originalEvent.clipboardData.getData('text').trim();
		tokens = pastedData.split(/\r\n|\r|\n/g);
		$('#fil_wbs_element > option').each(function(){
			var wbs_arr             = $(this).text().split('~');
			var key                 = this.value;
			current_pin[wbs_arr[0]] = key;
		});

		var found_pin    = [];
		$.each(tokens, function(key, value) {
			found_pin.push(current_pin[value]);
		});
		$('.select2-search__field').val('');
		$('#wbs_element_div').find('select').attr('class');
		$('#fil_wbs_element').val('');
		$("#fil_wbs_element").val(found_pin).trigger("change");
	});
	//DR CODE END FOR WBS ELEMENT MULTIPICKLIST PASTE DATA FETCH @30AUG22@
});
//------------------- FUNCTION MODE START -------------------------------------

//PROJECT ID FETCH DEPENDES ON PERSONAL CODE
function project_id_fetch(search_month,personal_code){
	if(search_month && personal_code){
		// Encryption
		var encKey  = '<?php echo $encKey; ?>';
		var data    = {personal_code:personal_code,search_month:search_month};
		var encData = encrypt(encKey,data);
		$.ajax({
			type: 'POST',
			url: '<?php echo site_url("$this->control_name/project_id_fetch");?>',
			data:encData,				
			contentType: 'text/plain',
			beforeSend: function () {
				$('#project').next('span').attr('id', 'project_span');
				$('#project_span').html('<span style=\"color:#CC3366\";><i class=\"fa fa-spinner fa-spin fa-2x fa-fw\"></i><br/>Loading...</span>');  
			},
			success: function(data){
				let rslt   = JSON.parse(data);
				$('#project_span').empty();
				let option = '<option value>--- Select Project---</option>';

				$.each(rslt, function(key, value) {
					option += '<option value='+value.pro_id+'>'+value.pro_id+' - '+value.pro_desc+'</option>';
				});
				$('#project').html(option);
				$('.select2').select2({
					placeholder: '---- Select ----',
					allowClear: true,
					//dropdownParent: $('.modal-dialog')
				});
			}
		});
	}
}

//DR CODE FOR WBS ELEMENT FILTER 29AUG22
function fil_wbs_fetch(personal_code,project,search_month){
	// Encryption
	var encKey  = '<?php echo $encKey; ?>';
	var data    = {personal_code:personal_code,project:project,search_month:search_month};
	var encData = encrypt(encKey,data);
	$.ajax({
		url : '<?php echo site_url("$this->control_name/fil_wbs_fetch");?>',
		type: 'POST',
		dataType: "html",
		data:encData,				
		contentType: 'text/plain',
		beforeSend: function () {
			$('#fil_wbs_element').next('span').attr('id', 'project_span');
			$('#fil_wbs_element_span').html('<span style=\"color:#CC3366\";><i class=\"fa fa-spinner fa-spin fa-2x fa-fw\"></i><br/>Loading...</span>');  
		},
		success: function(data){
			let rslt   = JSON.parse(data);
			let option = '<option value>--- Select Wbs Element---</option>';

			//LOOP FOR OPTION VALUE FETCH IN SELECT DROPDOWN FILED
			$.each(rslt, function(key, value) {
				option += '<option value='+value.wbs_id+'>'+value.wbs_id+'~'+value.wbs_desc+'</option>';
			});

			$('#fil_wbs_element').html(option);
			$('#fil_wbs_element_span').empty();
			$('.select2').select2({
				placeholder: '---- Select ----',
				allowClear: true,
			});
		}
	});
}
//DR CODE WBS FETCH FUNCTION END 29AUG22

//Draw Table
function table_draw(table_head,result){
	var pay_type_arr     = <?php echo json_encode($pay_type_arr); ?>;

	var process_mode     = $('#process_mode').val();
	if(parseInt(process_mode) === 2){
		$('.dataTables_length').find('table').hide();
	}else{
		$('.dataTables_length').find('table').show();
	}
	var cols             = [];  
    $.each(table_head, function(key,value) {
    	if(key !== "sub_date" && key !== "checker_date" && key !== "chk_date"){
			if(key === "man_pay_type"){
				cols.push({
					title: value,
					data: key,
					render:function(data, type, row, meta) {
						var rslt    = pay_type_arr[data];
						if(rslt){
							return rslt;
						}else{
							return "";
						}
					}
					//optionally do some type detection here for render function
				});
			}else
			if(key === "audit_status"){
				cols.push({
					title: value,
					data: key,
					render:function(data, type, row, meta) {
						if(parseInt(data) === 1){
							return "Approved";
						}else{
							return "";
						}
					}
					//optionally do some type detection here for render function
				});
			}else if(key === "trans_created_date" || key === "msal_approve_date" || key === "msal_reject_date"){
				cols.push({
					title: value,
					data: key,
					render:function(data, type, row, meta){
						if(data){
							if(data === '' || data === '0000-00-00' || data === null || data === '1970-01-01 05:30:00') return '';
								return moment(data).format('DD/MM/YYYY HH:mm:ss');
							}else{
								return '';
							}
						}
					//optionally do some type detection here for render function
				});
			}else{
				cols.push({
					title: value,
					data: key
					//optionally do some type detection here for render function
				});
			}
		}	
	});
	//Datatable fetch records
	$table  = $('#table').DataTable({
		destroy: true,
		lengthMenu: [[50,100,500,1000,-1],[50,100,500,1000,"All"]],
       	// fixedColumns:{leftColumns: 3},
		scrollX:true,
		language:{				                    
            searchPlaceholder: "Search Records",
            search: "",
        },	
		data:result,
		columns: cols,
		//IF ENTRY STATUS 2 THEN SHOULD ADD A COLOR FOR TR
		rowCallback: function (row, data) {
			var audit_status   = parseInt(data.audit_status);
			if(audit_status === 1){
				$(row).addClass('audit_app_entry');
			}
		},
		//FOOTER PROCESS START
		"initComplete": function (settings, json) {
			var api = this.api();
			CalculateTableSummary(this);
		},
		"footerCallback": function (row, data, start, end, display) {
			var api = this.api(), data;  
			CalculateTableSummary(this);   
		}
		//FOOTER PROCESS END
	});
	if(result.length > 0){
		$('#table_length').show();
		var table_option = "<table><tr><td id='export' style='padding:8px 2px;'></td></tr></table>";
		$("#table_filter").append(table_option);
		var buttons = new $.fn.dataTable.Buttons(table,{
			buttons: [{
				extend: 'collection',
				text: 'Export',
				buttons: [				
					{extend:'excel',exportOptions:{modifier:{order :'index',page: 'All',search:'none'},columns:':visible'},customizeData: function ( data ) {
		            for (var i=0; i<data.body.length; i++){
		                for (var j=0; j<data.body[i].length; j++ ){
		                	if(data.body[i][j].length > 14){
		                		data.body[i][j] = '\u200C' + data.body[i][j];
		                	}                        
		                }
		            }
		        },title:'Manual payment('+moment().format('MMMM-YYYY')+')',filename: "Manual payment -"+moment().format('MMMM-YYYY')},
				]
			}]
		}).container().appendTo($('#export'));		
	}
	$('input[type=search]').addClass('form-control input-sm');
	$("select[name='table_length']" ).addClass('form-control input-sm');
}

//Update Approve Status
function update_status(remarks,type){
	var search_month       = $('#search_month').val();
	var personal_code      = $('#personal_code').val();
	var project            = $('#project').val();
	var process_mode       = $('#process_mode').val();
	var pay_type           = $('#pay_type').val();
	var fil_wbs_element    = $('#fil_wbs_element').val();
	if(search_month){
		// Encryption
		var encKey  = '<?php echo $encKey; ?>';
		var data    = {remarks:remarks,type:type,search_month:search_month,personal_code:personal_code,project:project,process_mode:process_mode,pay_type:pay_type,fil_wbs_element:fil_wbs_element};
		var encData = encrypt(encKey,data);
		$.ajax({
			type: 'POST',
			url: '<?php echo site_url("$this->control_name/update_status");?>',
			data:encData,				
			contentType: 'text/plain',
			success: function(data){				
				var rslt = JSON.parse(data);
				if(rslt.status){					
					toastr.success(rslt.message);
					// table_draw(rslt.result_data);
					// table_draw(rslt.table_head,rslt.result_data);
				}else{
					toastr.error(rslt.message);
					//IF ANY APPROVE RECORDS PENDING THEN SHOW IN TABLE
					// if(rslt.datatable){
					// 	table_draw(rslt.table_head,rslt.result_data);
					// }else{
						//NO DATQA FOR APPROVE THEN OPEN A HOME PAGE (LIKE (BACK TO FORM) BUTTON PROCESS FLOW)
						// $('#table_div,#show_form').hide();
						// $('#toolbar').show();
						// $('#input_text').html("<div class='col-md-2 col-xs-4'><h1 class='page_txt'>MSAL Audit</h1></div>");
					// }
				}
				$('#table_div,#show_form').hide();
				$('#toolbar').show();
				$('#input_text').html("<div class='col-md-2 col-xs-4'><h1 class='page_txt'>MSAL Audit</h1></div>");
			}
		});
	}
}

//DR DATATABLE FOOTER FUNCTION START
function CalculateTableSummary(table){
    try{
		//api object 
        var api         = table.api();
        var intVal      = function (i) {
            return typeof i === 'string' ?
                    i.replace(/[\$,]/g, '') * 1 :
                    typeof i === 'number' ?
                        i : 0;
        };

		var table_id    = $(table).attr("id");
		var visible     = "";
		var input_num   = "";
		var col_len     = api.context[0]["aoColumns"].length;

		var tab_row     = "<tfoot id='"+table_id+"_foot'><tr>";
		var hide_col_id = [];
		//TABLE CREATE PROCESS START
		var i = 1;
		var bg = '';
		var text_align = "";  
		api.context[0]["aoColumns"].reduce(function (a,b){
			if(i <=3){ //Footer background color for freeze columns
				bg = 'background-color:#f2f2f2;'
			}
			if(a !== undefined){
				visible     = a["bVisible"];
				input_num   = a["sClass"];
				if(visible){
					if(table_id === "checker_table"){
						text_align = "text-align:center !important;";
					}
					tab_row += "<th style = 'white-space: nowrap !important;max-width: 500px !important;"+text_align+bg+"'></th>";
				}else{
					hide_col_id.push(a["idx"]);
				}
			}else{
				visible     = b["bVisible"];
				input_num   = b["sClass"];
				if(visible){
					if(table_id === "checker_table"){
						text_align = "text-align:center !important;";
					}
					tab_row += "<th style = 'white-space: nowrap !important;max-width: 500px !important;"+text_align+bg+"'></th>";
				}else{
					hide_col_id.push(b["idx"]);
				}
			}
			i++;
		});
		tab_row += "<th style='white-space: nowrap !important;max-width: 500px !important;background-color:#f2f2f2;padding-left:4px;'></th></tr></tfoot>";
		$("#" + table_id + "_foot").remove();
		$(table).append(tab_row);
		//TABLE CREATE PROCESS END

        // Calculate and display the sum in the footer for each visible column
		var un_visible_arr = [];
		api.columns().every(function (){
		    var column     = this;
		    // Skip frozen columns 
		    if(column.index() <= 2 ){ return; }
		    // Check if all data in the column is numeric
		    var allNumeric = column.data().toArray().every(function (value){
		        return !isNaN(parseFloat(value)) && isFinite(value);
		    });
		    if(allNumeric){
		        var sum = column.data().toArray().reduce(function (a, b){
		            return intVal(a) + intVal(b);
		        }, 0);
		        var sum_count  = isNaN(sum) ? 0 : sum.toFixed(2);
		        un_visible_arr = hide_col_id.filter(function (id) {
		            return id <= column.index();
		        });
		        var visible_count  = un_visible_arr.length;
		        var foot_col_index = column.index() - visible_count;
		        $("#" + table_id + "_foot tr th").eq(foot_col_index).text('' + sum_count);
		    }
		});
    }catch(e){
        console.log('Error in CalculateTableSummary');
        console.log(e);
    }
}

//DATATABLE FOOTER FUNCTION END
</script>
<?php $this->load->view("partial/footer"); ?>