<?php   include('techsyn_header.php'); ?>
<!-- Main Content Container for side bar and body-->
<div class="main-container ace-save-state" id="main-container">
		<script type="text/javascript">
			try{ace.settings.loadState('main-container')}catch(e){}
		</script>
<?php   include('techsyn_sidebar.php'); ?> 
<!--breadcrumb-->
<div class="main-content">
    <div class="main-content-inner">
        <div class="breadcrumbs ace-save-state" id="breadcrumbs">
            <ul class="breadcrumb">
                <li>
                    <i class="ace-icon fa fa-home home-icon"></i>
                    <a href="#">Home</a>
                </li>
                <li class="active"><a href="task_list.php">Report Master</a></li>
            </ul>
			
        </div>
<!-- End of breadcrumb -->


										
	<div class="page-content">
				<div class="box box-primary center"
					style="padding: 10px; margin: 2px 0px 50px 5px; width: 99.5%; " >
					<form id="report_form" method="post">	
						<!-- box-body-->
						<div class="box-body">
							

							<div class="row" >
							
							<div class="col-sm-12">
							 <table id="myTable center" class="table table-bordered order-list" width:100%">
									<thead>
										<tr>
											<th style="padding-right: 50px; margin: 2px 0px 50px 5px; width: 20%; "> Report Code</th>
											<th style="padding-left: 10px; margin: 2px 0px 50px 5px; width: 20%; ">Report Name</th>
											<th style="padding-left: 10px; margin: 2px 0px 50px 5px; width: 30%; ">Report Type</th>
											<th style="padding-left: 10px; margin: 2px 0px 50px 5px; width: 30%; ">URL</th>
											<th style="padding-left: 10px; margin: 2px 0px 50px 5px; width: 30%; ">Function Name</th>
										</tr>
									</thead>
									
									
									<?php 
										$row=null;
										if(isset($_REQUEST['flex_id'])){
												$sql="select * from   report_master  where report_id='".$_REQUEST['flex_id']."'";
													$result = @mysqli_query($conn,$sql);	
													$num_rows=@mysqli_num_rows($result);
													$row=@mysqli_fetch_array($result);
										}
												do{							
												?>
									<tbody>
										
										<tr id="main-form">
										 
											<td style="width:8%">
												<input type="hidden" name="report_id" id="report_id" value="<?php  echo $row['report_id']?>" />				
									             
											
												<input type="text" style="width:100%" name="report_code" value="<?php  echo $row['report_code']?>" id="report_code" maxlength="100"  class="form-control"/>
										
												
													
														
												
											</td>

											<td style="width:25%">
											<input type="text" style="width:100%" name="report_name" value="<?php  echo $row['report_name']?>" id="report_name" maxlength="100" class="form-control"/>
								
											</td>
											
											<td style="width:1%">
												<select name="report_type" value="<?php  echo $row['report_type']?>" id="report_type"  class="form-control">
												<option selected>Select</option>
												<option value='R'>Report</option>
												<option value='D' >Dashboard</option>
												</select>
											
											</td>
										
											
												
                                         <td style="width:8%">
												<input type="text" name="report_url" value="<?php  echo $row['report_url']?>" id="report_url" maxlength="100"  class="form-control"/>
											
											</td>
											<td style="width:8%">
												<input type="text" name="fun_name" value="<?php  echo $row['fun_name']?>" id="fun_name" maxlength="500" class=""/>
											
											</td>
											
										</tr>

										
										<?php  
									   }while($row=@mysqli_fetch_array($result))//end of while
									   ?>
										
									    </tbody>
									    			
								<tfoot>
									
									<tr>
									</tr>
								</tfoot>
										

                                </table>
								
                         </div>

							</div>

						</div>
						<!-- End box-body-->
							<!--box-footer-->
						<div class="box-footer" style="text-align: center;">
                            	<button class="btn btn-success new_button" id="new_button" type="reset" onclick="show_save_button();">
									<i class="ace-icon fa fa-plus-square-o bigger-110"></i>
									New
								</button>

								&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;   

                                <button class="btn btn-info save_button" id="save_button" type="button" onclick="validate();">
									<i class="ace-icon fa fa-floppy-o bigger-110"></i>
									Save
								</button>

								&nbsp; &nbsp; &nbsp;
								<button class="btn btn-warning" type="reset">
									<i class="ace-icon fa fa-undo bigger-110"></i>
									Reset
								</button>
              </div>
						<!--End box-footer-->
						
					</form>
				</div>


<!-- Main Content Container for side bar and body-->
<div class="main-container ace-save-state" id="main-container">
		<script type="text/javascript">
			try{ace.settings.loadState('main-container')}catch(e){}
		</script>
 




<!--breadcrumb-->
<div class="main-content">
    <div class="main-content-inner">
        
        <!-- End of breadcrumb -->
           
        	<div class="page-content" style="margin-top: -47px">
			<div id="flexigridDiv" class="table-responsive">
			
					<form name="f1" method="post" id="flex_appointment_form" action="bio_medical_waste_generation_excel.php">
					<div id="flex1" style="width:100%">
				     <input type="hidden" name="flex_ambulance_id" id="flex_ambulance_id"/>
					</div>
					
				</form>	
				
				<form name="export_form" method="post" id="export_form" action="">
				   
					    <input type="hidden" name="pdf_actions" id="pdf_actions" value="bio_medical_waste_generation_pdf.php"/>
						<input type="hidden" name="excel_actions" id="excel_actions" value="bio_medical_waste_generation_excel.php"/>
						<input type="hidden" name="pdf_action" id="pdf_action" value="biowaste_pdf.php"/>
						<input type="hidden" name="excel_action" id="excel_action" value="excel_ambulance.php"/>
				</form>	


			</div>
			</div>



    </div><!-- /.page-content -->
</div>
</div><!-- /.main-content -->

  
<script type="text/javascript">
$(function() {
	var w=screen.width*.90;
	var h =0;
 	 h =(window.innerHeight-($("#navbar").height()+$(".breadcrumbs").height()))*.75;
    $("#flex1").flexigrid({
            url: 'report_master_list_script.php',
            dataType: 'json',
            colModel : [
                    {display: 'Sr', name : 'count', width : w*.05, sortable : false, align: 'left'},
					               {display: 'Report Code', name : 'report_code', width : w*.0, sortable : true, align: 'left'},
					               {display: 'Report Name', name : 'report_name', width : w*.20, sortable : true, align: 'left'},
					               {display: 'Report Type', name : 'report_type', width : w*.10, sortable : true, align: 'left'},
					               {display: 'Report URL', name : 'report_url', width : w*.15, sortable : true, align: 'left'},
					               {display: 'Function names', name : 'report_url', width : w*.30, sortable : true, align: 'left'},
					               {display: '', name : 'link', width : w*.1, sortable : false, align: 'left'}
                    ],
                    buttons : [
         
              // {name: 'Add', bclass: 'add', onpress : add},
        			   //{separator: true},
			   //{name: 'PDFReport', bclass: 'print', onpress : pdfReport},
			  // {separator: true},
			   {name: 'PDF', bclass: 'print', onpress : pdf},
			   {separator: true},
			   {name: 'Excel', bclass: 'print_excel', onpress : excel},
               {separator: true}
            ],
            searchitems : [
					
					{display: 'Report Code', name : 'report_code'},
					{display: 'Report Name', name : 'report_name'},
					{display: 'Report Type', name : 'report_type'},
					{display: 'Report URL', name : 'report_url'},
					
            ],
            sortname: "report_id",
            sortorder: "asc",
            usepager: true,//pagination
			//title:"Employee OPD",
            useRp: true,
            rp: 50,//records per page
            showTableToggleBtn: false,//toggle button for the whole table
            resizable: true,
		//	width: w, 
            height: h,
            singleSelect: true
    });
});

	
// }
function delete_report_master(report_id){
	
	$.ajax({
		url : 'delete_report_master.php',
	     data:{report_id:report_id},	
		type : 'POST',
		dataType:'json',
		success : function(data) {
             
            if(data=='SUCCESS')	{

            	BootstrapDialog.alert('Report Master Deleted Successfully!'); 																		 
    			$("#flex1").flexReload();
    			return;
            }									
			
			
		
				
		},
		error : function(data) {
			BootstrapDialog.alert('Error: Report Master Not Deleted!');
			return;
		}
	});

}


function show_save_button(){
	$("#save_button").show()
	$("#id").val("");
}



function open_report_master(report_id,access){
	if(access=='V'){
		 $("#save_button").hide()
	}else if(access=='E')
	 $("#save_button").show()

	$.ajax({
		url : 'select_report_master.php',
	    data:{report_id:report_id},	
		type : 'POST',
		dataType:'json',
		success : function(data) {
			          $("#report_id").val(data.report_id);
                      $("#report_code").val(data.report_code);
					  $('#report_name').val(data.report_name)
                      $("#report_type").val(data.report_type);
                      $("#report_url").val(data.report_url);
                       $("#fun_name").val(data.fun_name);
            
												
            
           		
			// $('#modal-add-ambulance-form').modal("show");				
		},
		error : function(data) {
			BootstrapDialog.alert('Error Populating Task Details');
			return;
		}
	});


	
}

function pdf(){
	window.open('report_master_pdf.php','Report List');
}
function excel(){
	window.open('report_master_excel.php','Report List');
} 

$("#new_button").on("click", function() {
	$("id").val("");
});

				
</script>

<?php   include('techsyn_footer.php'); ?> 



			</div>
			

			<!-- End of page-content -->
		</div>
	</div>
</div>
												
<script>


function validate(){
	
	var report_code = $('#report_code').val();

if(report_code == ''){

	BootstrapDialog.alert('Please Enter Report Code.!!!');

	return false;

}

var report_name = $('#report_name').val();

if(report_name == ''){

	BootstrapDialog.alert('Please Enter Report Name.!!!');

	return false;

}

var report_url = $('#report_url').val();

if(report_url == ''){

	BootstrapDialog.alert('Please Enter Report Url.!!!');

	return false;

}


var fun_name = $('#fun_name').val();

if(fun_name == ''){

	BootstrapDialog.alert('Please Enter Function Name.!!!');

	return false;

}
		
save();
}

</script>

<style>
#modal-add-vaccine{
	overflow-y:scroll;
}
</style>
				

  
<?php   include('techsyn_footer.php'); ?>    
	<script type="text/javascript">
	
	
			function save(){
				$.ajax({
						url : 'save_report_master.php ',
						type : "POST",
						data : $("#report_form").serialize(),
						success : function(data) {
							// alert(data);
							BootstrapDialog.alert('Report Master Saved Successfully.');
							$("#flex1").flexReload();
							return;
						},
						error : function(data) {
							BootstrapDialog.alert('Error Report Master vaccine');
							return;
						}
				});
				$('.close').click();
			}
          $('.date-picker').datepicker({
			  autoclose:true,
			  format:'dd/mm/yyyy'
		  }).next().on(ace.click_event,function(){
			  $(this).prev().focus();
		  });
		  
		</script>
		<!-- bootstrap & fontawesome -->
<link rel="stylesheet" href="assets/font-awesome/4.5.0/css/font-awesome.min.css" />

		<!-- page specific plugin styles -->
<link rel="stylesheet" href="assets/css/jquery-ui.custom.min.css" />
<link rel="stylesheet" href="assets/css/chosen.min.css" />
<link rel="stylesheet" href="assets/css/bootstrap-datepicker3.min.css" />
<link rel="stylesheet" href="assets/css/bootstrap-timepicker.min.css" />
<link rel="stylesheet" href="assets/css/daterangepicker.min.css" />
<link rel="stylesheet" href="assets/css/bootstrap-datetimepicker.min.css" />
<link rel="stylesheet" href="assets/css/bootstrap-colorpicker.min.css" />
<script  type="text/javascript" src="js/typeahead.bundle.js"></script>
<script src="assets/js/jquery-ui.custom.min.js"></script>
<script src="assets/js/jquery.ui.touch-punch.min.js"></script>
<script src="assets/js/chosen.jquery.min.js"></script>
<script src="assets/js/spinbox.min.js"></script>
<script src="assets/js/bootstrap-datepicker.min.js"></script>
<script src="assets/js/bootstrap-timepicker.min.js"></script>
	<script src="assets/js/jquery.dataTables.min.js"></script>
		<script src="assets/js/jquery.dataTables.bootstrap.min.js"></script>
		<script src="assets/js/dataTables.buttons.min.js"></script>
		<script src="assets/js/buttons.flash.min.js"></script>
		<script src="assets/js/buttons.html5.min.js"></script>
		<script src="assets/js/buttons.print.min.js"></script>
		<script src="assets/js/buttons.colVis.min.js"></script>
		<script src="assets/js/dataTables.select.min.js"></script>


<script src="assets/js/moment.min.js"></script>
<script src="assets/js/daterangepicker.min.js"></script>
<script src="assets/js/bootstrap-datetimepicker.min.js"></script>
<script src="assets/js/bootstrap-colorpicker.min.js"></script>
<script src="assets/js/jquery.knob.min.js"></script>
<script src="assets/js/autosize.min.js"></script>
<script src="assets/js/jquery.inputlimiter.min.js"></script>
<script src="assets/js/jquery.maskedinput.min.js"></script>
<script src="assets/js/bootstrap-tag.min.js"></script>
<script src="assets/js/ace-elements.min.js"></script>