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/.trash/application_bkold/views/worksheet_generation/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));
	$uniqueId       = "prime_".$controller_name."_id";	
	$start_date     =  $financial_info[0]->start_date;
	$end_date       =  $financial_info[0]->end_date;	
?>
<script type="text/javascript">
    $(document).ready(function (){
        <?php $this->load->view('partial/bootstrap_tables_locale'); ?>
		$(function(){
			$(".datepicker").datetimepicker({
				format: 'MM-YYYY'
			});
		});	
					
		$(function(){
			$('.select2').select2({
				placeholder: '---- Select ----',
			});
			$('.select2-tags').select2({
				tags: true,
				tokenSeparators: [',']
			});
		});		
	$('#process_type').change(function(){
		process_type   = $("#process_type").val();
		employee_code  = $('#process_emp_id').val();
		$('#process_emp_id,#process_role').parent().hide();
		$('#process_emp_id').val("");
		$('#process_role').val("");
		if(process_type === "1"){
			$('#process_emp_id').parent().show();
		}else
		if(process_type === "2"){
			$('#process_role').parent().show();
		}else{
			$('#process_emp_id,#process_role').parent().hide();
		}
	});
	
	$('#process_emp_id').autocomplete({
		 source: function(request, response) {
			$.getJSON('<?php echo site_url("$controller_name/emp_suggest");?>',{term:request.term},response);
		},
		minChars:2,
		autoFocus: true,
		delay:10,
		scroll: true,
		appendTo: '.append_div',
		select: function(e, ui) {
			$('#process_emp_id').val(ui.item.value);
			return false;
		}
	});
		
	$('#process_tax').validate($.extend({
		submitHandler: function (form){
			$("#process_tax_btn").html("<i class='fa fa-spinner fa-spin'></i> Processing...");
			$('#process_tax_btn').attr('disabled','disabled');
			// $('#pdf_tbl').DataTable();
			$('#rslt_info').hide();
			$('#rslts_info').hide();
			$('.myProgress').show();
			$(form).ajaxSubmit({
				success: function (response){
					$('.myProgress').hide();
					$("#loader").css("display", "none");
					$('#process_tax_btn').attr('disabled',false);
					$("#process_tax_btn").html("Submit");
					jQuery("body").prepend('<div id="preloader">Loading...</div>');
					if(response.success == false){
						toastr.error(response.msg);
						$('#process_tax')[0].reset();
					}else{
						if(response.msg != "process work sheet generated"){
							$('#rslts_info').hide();
							$('#rslt_info').show();
							$('#rslt_info').html(response.table_data);
							$('#table_info').DataTable({
								dom: 'Bfrtip',
								language:{
									searchPlaceholder: "Search records",
									search: "",
								},
						        select: true,
						        colReorder: true,
						        buttons: [
						            {
						                extend: 'collection',
						                text: 'Export',
						                buttons: [
						                    'copy',
						                    'excel',
						                    'csv',
						                    'pdf',
						                    'print'
						                ]
						            }
						        ]
							});
							$('input[type=search]').addClass('form-control input-sm');
						}else {
							var category  = response.category;
							$('#rslt_info').hide();
							var tbl_tot_count = response.count;
							// $("#rslt_info *").removeAttr("id");
							$.when(
							$.each(response.pdf_data, function(code, html) {
							generate_pdf(code,html['table_data'],category,tbl_tot_count,html['password_column']);
							})
							).then(function(){
								setTimeout(function(){
								toastr.success("Tax Processed Successfully"); 
								}, 1800);
							});	
						}
					}
					jQuery("#preloader").remove();
				},
				dataType: 'json'
			});	
		},
		rules:{
			process_month: "required",
			process_type: "required",
			process_emp_id: "required",
			process_role: "required",
			process_mode: "required",
		}
	}));
	// $('#rslt_info').hide();
});

function generate_pdf(code,html,category,tbl_tot_count,password_column){
	var process_month = $('#process_month').val();
	if(html){
		$.ajax({
			type: "POST",
			url: '<?php echo site_url($controller_name . "/generate_pdf"); ?>',
			data: {code:code,html:html,process_month:process_month,category:category,password_column:password_column},
			success: function(data){
				if(data){
					$("#myBar").css({"width": "0%", "background-color": "#001630","text-align": "center","line-height": "20px","color": "white","border-radius": "10px"});
					$('#rslts_info').show();
					$('.pdf_count_loader').show();
					$('#myProgress').show();
					trline = "<tr><td>"+process_month+"</td><td>"+code+"</td><td><a onclick=pdf_viewer('"+$.trim(data)+"')>View</a></td></tr>";
	    			var table = $('#pdf_tbl').DataTable().row.add($(trline)).draw();
	    			var total_tr = table.rows().count();
	    			var progress_val = total_tr/tbl_tot_count;
	    			var progress_val = progress_val*100;
	    			var progress_value = parseInt(progress_val)+"%";
	    			if(parseInt(progress_val) <100){
		    			$("#myBar").html(progress_value);
		    			$("#myBar").css({"width": progress_value, "background-color": "#001630","text-align": "center","line-height": "20px","color": "white","border-radius": "10px"});
		    		}
		    		if(tbl_tot_count === total_tr){
	    				$('#myProgress').hide();
	    				$('#process_tax_btn').attr('disabled',false);
						$("#process_tax_btn").html("Submit");
	    			}
		    		if(parseInt(progress_val) === 100){
						$('#myProgress').hide();
						// timer2 = '';
						var interval = setInterval(function() {
							clearInterval(interval,0);
						}, 1000);
					}
	    			
				}
			},
		});
		$('#pdf_tbl').DataTable().row().remove();
	}
}
function view_tax(employee_code,process_month) {
	$.ajax({
			type: "POST",
			url: '<?php echo site_url($controller_name . "/view_tax"); ?>',
			data: {employee_code:employee_code,process_month:process_month},
			success: function(data){
				var rslt = JSON.parse(data);
				console.log(rslt.view_table_data);
				if(rslt.success){
					$('#example1').html(rslt.view_table_data);
					$("#myModal").modal("show");
					// $('#view_table_info').DataTable({
					// 	dom: 'Bfrtip',
					// 	language:{
					// 		searchPlaceholder: "Search records",
					// 		search: "",
					// 	},
				 //        buttons: 'pdf'
					// });
					$('input[type=search]').addClass('form-control input-sm');
				}
			},
		});
}
function pdf_viewer(url){
	PDFObject.embed(url, "#example1");
	$("#myModal").modal("show");
}
</script>
<div class='row title_content'>
	<div class='col-md-2 col-xs-4'>
		<h1 class='page_txt'><?php echo $page_name;?></h1>
	</div>
	<div class='col-md-10 col-xs-8'>
	</div>
</div>
<div id="holder" class="form-inline" style="margin-top:20px;">
	<div class='col-md-12'style='margin:15px 0px;border-radius:2px;box-shadow:0 2px 2px 0 rgba(0,0,0,0.14),0 3px 1px -2px rgba(0,0,0,0.12),0 1px 5px 0 rgba(0,0,0,0.2);padding:15px 0px;'>
	<?php  echo  form_open("$controller_name/process_tax/",array("id"=>"process_tax","class"=>"form-inline")); ?>
		<div class="form-group">
			<?php
				$process_type = array(""=>"---- Select Process Type ----","1"=>"Process By Employee","2"=>"Process By Role");
				echo form_label("Process Type", 'process_type', array('class' => 'required'));
				echo form_dropdown(array("name" =>'process_type',"id" =>'process_type',"class" =>'form-control input-sm'),$process_type);
			?>
		</div>    
		<div class="form-group" style='display:none;max-height: 50px;!important'>
			<?php
				echo form_label("Search Employee", 'process_emp_id', array('class' => 'required'));
				echo form_input(array('name' =>'process_emp_id','id' =>'process_emp_id','class' => 'form-control input-sm','value'=>'','placeholder'=>"Search by Employee Code")); 
			?>
			<div class='append_div'></div>
		</div>
		<div class="form-group" style='display:none;'>
			<?php
				echo form_label("Process Role", 'process_role', array('class' => 'required'));
				echo form_dropdown(array("name" =>'process_role',"id" =>'process_role',"class" =>'form-control input-sm'),$process_role);
			?>
		</div>
		<div class="form-group">
			<?php
				echo form_label("Process Month", 'process_month', array('class' => 'required'));
				echo form_input(array('name' => 'process_month','id' => 'process_month','class' => 'form-control input-sm datepicker','value'=>'')); 
			?>
		</div>	
		<label>
			<input name='annexure_sts' id='annexure_sts' type="checkbox"> With Annexure Data
		</label>			
		</div>
		<div class="form-group">
			<button class='btn btn-primary btn-sm' id="process_tax_btn">Submit</button>
		</div>
	<?php  echo form_close(); ?>
	<div class="myProgress" style ="z-index: 10000; text-align: center;display:none;padding:50px;color:#4b6fa2;">
	<i class="fa fa-spinner fa-spin fa-2x fa-fw" ></i>Please wait processing....
	</div>
	<div class="pdf_count_loader" style="display: none;"></div>
	<div id="myProgress" style="display: none;" class='col-md-12'>
	  <div id="myBar">10%</div>
	</div>
	<div style="margin:20px !important; padding:15px;background-color: #f2f2f2; display:none;" id='rslt_info'>
	</div>
	<div style="margin:20px !important; padding:15px;background-color: #f2f2f2; display:none;" id='rslts_info'>

		<table class="table table-hover" id="pdf_tbl">
			<thead>
				<tr>
				<th>Process Month</th>
				<th>Employee Code</th>
				<th>Option</th>
			</tr>
			</thead>
			<tbody id="pdf_files">
			</tbody>
		</table>
	</div>
	<div class="modal" id="myModal">
	  <div class="modal-dialog">
	    <div class="modal-content">
	      <div class="modal-header">
	        <h4 class="modal-title">Income</h4>
	        <button type="button" class="close" data-dismiss="modal">&times;</button>
	      </div>

	      <div class="modal-body" id="example1">
	      </div>
	      <div class="modal-footer">
	        <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
	      </div>
	    </div>
	  </div>
	</div>
</div>

<style>
	.pdfobject-container { height: 70rem; border: 1rem solid rgba(0,0,0,.1); }
	.pull-right.search {
		display: none !important;
	}
	.columns.columns-right.btn-group.pull-right {
		display: none !important;
	}
	<?php 
		if($access_search === 1){
			echo ".pull-right.search { display: block !important; }";
		}
		if($access_export === 1){
			echo ".columns.columns-right.btn-group.pull-right{display: block !important;}";
		}
	?>
</style>
<?php $this->load->view("partial/footer"); ?>