Current File : /home/inlingua/public_html/sensoriumpsychologists.com/diagnostics/admin/treatment_week_day.php
<?php require_once("../franchise_between/admin_constants.php");?>
<?php require_once("../franchise_between/check_admin.php");?>
<?php require_once("../franchise_between/user_details_msg_setup.php");?>
<?php require_once("../franchise_back/connection.php");?>
<?php require_once("../franchise_back/database_admin.php");?>
<?php require_once("../franchise_back/validate_admin.php");?>
<?php require_once("../franchise_between/admin.php");?>
<?php
if(!isset($_GET['code']) || ($_GET['code']=="") || !isset($_GET['std']) || ($_GET['std']=="") || !isset($_GET['month']) || ($_GET['month']==""))
{
	header('location:index.php');
	exit(EXIT_ERROR);
}

if(isset($_POST['to_delete']) && ($_POST['to_delete']!=""))
{
	$fetch_obj_temp=new admin;
	$response=$fetch_obj_temp->delete_treatment($_POST['to_delete']);
	
	if($response=="ok")
	{
		$msg_print="Deleted successfully...!!!";
	}
	else
	{
		$msg_print=$response;
	}
	$temp_filename=urlencode("treatment_week_day.php?code=".$_GET['code']."&std=".$_GET['std']."&month=".$_GET['month']);
	header("location:redirect_msg.php?q=".$temp_filename."&msg=".$msg_print);
	exit(EXIT_ERROR);
}

$page_no=0;
$pages_return=0;
if(isset($_GET['page_no']))
{
	$page_no = $_GET['page_no'];
}
$fetch_obj=new admin;
$result=$fetch_obj->all_treatment_week_day($_GET['code'],$_GET['std'],$_GET['month'],$page_no,$pages_return);
?>
<!DOCTYPE html>
<html>
  <head>
    <?php require("common/head_links.php");?>
    
  </head>
  <body class="hold-transition skin-blue sidebar-mini">
    <div class="wrapper">

      <?php require("common/header.php");?>
      
      <?php require("common/left_side_bar.php");?>

      <!-- Content Wrapper. Contains page content -->
      <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1>
            Treatment for<br>
            Code - <?php echo($_GET['code']);?><br>
            Std - <?php echo($_GET['std']);?><br>
            Month - <?php echo($_GET['month']);?>
          </h1><br>
          <a href="treatment_months.php?code=<?php echo($_GET['code']);?>&std=<?php echo($_GET['std']);?>"><div class="btn btn-danger">Back</div></a>
          <a href="add_treatment_1.php?code=<?php echo($_GET['code']);?>&std=<?php echo($_GET['std']);?>&month=<?php echo($_GET['month']);?>"><div class="btn btn-primary">Add New Treatment</div></a>
        </section>

      <form action="" method="get" role="form" class="form-inline" name="filter_form" onSubmit="return submit_form()">
      <input type="hidden" name="page_no" id="page_no" value="<?=$page_no?>" />
      </form>   
        <!-- Main content -->
        <section class="content">
        	<div class="row" style="margin-top:20px;">
        <div class="col-xs-12">
          <div class="box box-primary">
            <div class="box-body table-responsive">
              <table id="example2" class="table table-bordered table-hover">
                <thead>
                  <tr>
                    <th style="width:30px;">S.NO</th>
                    <th>WEEK</th>
                    <th>DAY</th>
                    <th>TREATMENT</th>
                  </tr>
                </thead>
                <tbody>
                  <?php	
				  if($result==="not found")
				  {
				  ?>
                  <tr>
                  	<td colspan="6" style="color:#F00;">No records found...</td>
                  </tr>
                  <?php
				  }
				  else
				  {
					 $x=1;
					 while($DATA = $result->fetch_assoc())
					 {
		 				$sno=$page_no*PER_PAGE_TREATMENT_CODES+$x;
   				?>
				
							  <tr>
									<td><?php echo $sno; ?></td>
									<td><?php echo $DATA['for_week'];?></td>
									<td><?php echo $DATA['for_day'];?></td>
									<td><?php echo "<a target=\"_blank\" href=\"treatment_actual.php?treatment_id=".$DATA['table_id'].'&code='.$_GET['code'] .'&std='.$_GET['std']. '&month='.$_GET['month'] .'&for_week='.$DATA['for_week'].'&for_day='.$DATA['for_day']."\">View Treatment</a>";?></td>
									<td><?php echo "<a href=\"javascript:delete_func('".$DATA['table_id']."')\">Delete Treatment</a>";?></td>
								  </tr>
								  <?php
					  $x++;
					  }
				  }
	  ?>
                </tbody>
              </table>
            </div>
            <!-- /.box-body --> 
            
            <?php
			if($pages_return>1)
			{
			?>
                <div class="box-footer clearfix">
                  <ul class="pagination pagination-sm no-margin pull-right">
                  	<?php
					if($page_no==0)
					{
						echo("<li class=\"disabled\"><a href=\"#\">&laquo;</a></li>");
					}
					else
					{
						echo("<li><a href=\"javascript:submit_form_page_no('".($page_no-1)."')\">&laquo;</a></li>");
					}
					?>
                    <?php
					for($i=1;$i<=$pages_return;$i++)
					{
						$j=$i-1;
						echo("<li");
						if($j==$page_no)echo(" class=\"active\"");
						echo("><a href=\"javascript:submit_form_page_no('".$j."')\">".$i."</a></li>");
					}
					?>
                  	<?php
					if(($page_no+1)==$pages_return)
					{
						echo("<li class=\"disabled\"><a href=\"#\">&raquo;</a></li>");
					}
					else
					{
						echo("<li><a href=\"javascript:submit_form_page_no('".($page_no+1)."')\">&raquo;</a></li>");
					}
					?>
                  </ul>
                </div>
            <?php
			}
			?>
            
            
          </div>
          <!-- /.box --> 
        </div>
        <!-- /.col --> 
      </div>
        </section><!-- /.content -->
      </div><!-- /.content-wrapper -->
      <?php require("common/footer.php");?>

      

    </div><!-- ./wrapper -->
<?php require("common/footer_links.php");?>


<form method="post" name="delete_form">
	<input type="hidden" name="to_delete" id="to_delete" value="" />
</form>
<script>
function submit_form_page_no(temp_val)
{
	$("#page_no").val(temp_val);
	submit_form();
}
function submit_form()
{
	$("#blackout").css({'visibility':'visible'});
	document.filter_form.submit();
}
function delete_func(val)
{
	var ans=confirm("Delete permanently?");
	if(ans==true)
	{
		$("#to_delete").val(val);
		$("#blackout").css({'visibility':'visible'});
		document.delete_form.submit();
	}
	else
	{
		return false;
	}
}
</script>
  </body>
</html>