<?php
include('iframe-header.php');
?>
 <?php
$maintitle="Schedule";
$page="schedule.php";
$table="tbl_schedule";
$field_id="scheduleid";
$mode=$_REQUEST['mode'];
$content_id=$_REQUEST['scheduleid']; 

if(isset($_REQUEST['start'])){
$start=$_REQUEST['start']-1;
}
else {
$start=0;
}
?>

   
<section class="content">
    
     <div class="row">
 <!-- Add / Edit / Delete --> 
          <div class="col-sm-12"> 
          <div class="box box-success">
         <div class="box-header">
              <i class="fa fa-building-o"></i>
              <h3 class="box-title"><?php echo $maintitle;?></h3>
              <div class="box-tools pull-right">
                <div class="btn-group">
                <a href="<?php echo $page;?>"><button class="btn btn-danger btn-flat">&nbsp; <?php echo AL_LISTALL;?> <?php echo $maintitle;?></button></a>
                   
                </div>
              </div>
            </div> 
            </div> 
            </div>
<?php 
$contentdetails=$helper->select($table,"*",array($field_id=>$content_id));
?>
 <!-- Add / Edit / Delete --> 


     <div class="col-md-12">
          <!-- Horizontal Form -->
          <div class="box box-info">
           <form class="form-horizontal" action="" method="post" enctype="multipart/form-data">             
              <div class="box-body">
                  <div id="print">
               <table width="700px" height="600px" cellpadding="10" cellspacing="10" border="1" class="printtable">
               <tr><td colspan="3" height="110px" style="text-align:center;"><img src="images/logoreport.png" align="center"/></td></tr>
               <tr><th>Project Details</th>
                   <th>Building Details</th>
                   <th>Client Details</th></tr>
               <tr><td width="30%">
                   <?php 
                   $projectdetails=$helper->select("tbl_projects","*",array("projectid"=>$contentdetails[0]['projectid']));     
                   $servicedetails=$helper->select("tbl_services","*",array("serviceid"=>$projectdetails[0]['service']));  
                    ?>
                             <p><b><?php echo $projectdetails[0]['title'];?></b><br/>
                                  <?php
                                 $services=$helper->displayservices($contentdetails[0]['projectid']);
                                 
                                 ?>
                              <b>Services:</b> <?php
                              foreach($services as $service){
                                  echo $service['title'];echo "<br/>";
                              }
                              ?>
                               <br/> 
                              <?php
                              $protype=$helper->select("tbl_project_type","*",array("typeid"=>$projectdetails[0]['projecttype']));
                              ?>
                              <b>Project Type:</b> <?php echo $protype[0]['title'];?><br/>
                              <?php
                              if($projectdetails[0]['projecttype']==1){
                                 ?>
                              <b>Package:</b> <?php echo $projectdetails[0]['package'];?>
                                 <?php
                              }
                              ?>
                              <br/><?php echo  $projectdetails[0]['description'];?><br/><b>Start Date:</b><?php echo  $projectdetails[0]['startdate'];?><br/>
                              <b>End Date:</b> <?php echo  $projectdetails[0]['enddate'];?></p>
                   </td>
                   <td width="30%">
                     <?php 
                   $branchdetails=$helper->select("tbl_branch","*",array("branchid"=>$projectdetails[0]['branchid'])); 
                    ?> 
                       <p><b><?php echo $branchdetails[0]['branchname'];?></b><br/>
                        <b>Contact:</b> <?php echo $branchdetails[0]['firstname'];?><br/>
                        <b>Ph:</b> <?php echo $branchdetails[0]['phone'];?><br/>
                         <b>Mob:</b> <?php echo $branchdetails[0]['mobile'];?><br/>
                         <b>Address:</b> <?php echo $branchdetails[0]['address'];?><br/>
                         <b>City:</b> <?php echo $branchdetails[0]['city'];?><br/>
                       </p>
                   </td>
                   <td width="30%">
                     <?php 
                   $clientdetails=$helper->select("tbl_client","*",array("clientid"=>$branchdetails[0]['clientid']));  
                    ?>
                       <p><b><?php echo $clientdetails[0]['companyname'];?></b><br/>
                        <b>Contact:</b> <?php echo $clientdetails[0]['firstname'];?><br/>
                        <b>Email:</b> <?php echo $clientdetails[0]['email'];?><br/>
                        <b>Ph:</b> <?php echo $clientdetails[0]['phone'];?><br/>
                         <b>Mob:</b> <?php echo $clientdetails[0]['mobile'];?><br/>
                         <b>Address:</b> <?php echo $clientdetails[0]['address'];?><br/>
                         <b>City:</b> <?php echo $clientdetails[0]['city'];?><br/>
                       </p>
                   </td>
               </tr>
               <tr><td colspan="3">
               			<table width="700px" cellpadding="10" cellspacing="10" border="0">
                                    <tr><td width="150px"><b>Schedule Date</b></td><td>:</td><td><?php echo $contentdetails[0]['scheduledate'];?></td></tr>
                         <tr><td><b>Task Details</b></td><td>:</td><td><?php echo $contentdetails[0]['description'];?></td></tr>
                        <tr><td><b>Work Details</b></td><td>:</td><td><?php echo $contentdetails[0]['workdetails'];?></td></tr>
                         <tr><td><b>Task Status</b></td><td>:</td><td><?php echo $contentdetails[0]['status'];?></td></tr>
                         <tr><td><b>After Maintainance</b></td><td>:</td>
                             <td>
                              <?php
							   $allimages= $helper->select("tbl_after_images","*",array("scheduleid"=>$content_id));
							   if(count($allimages)>0){                                 
				                               foreach($allimages as $image){
                                                                   ?>
                                                                   <a class="imglist"><img class="img-responsive" src="<?php echo $site_url;?>thumb.php?src=<?php echo $site_url;?>images/gallery/<?php echo $image['image'];?>&w=80&h=80"/></a>
                                                              <?php
                                                                   }
				 
							   }
							  ?>
                             </td>
                         </tr>
                         <tr><td><b>Before Maintainance</b></td><td>:</td>
                             <td>
                              <?php
							   $allimages= $helper->select("tbl_before_images","*",array("scheduleid"=>$content_id));
							   if(count($allimages)>0){                                 
				                               foreach($allimages as $image){
                                                                   ?>
                                                                   <a class="imglist"><img class="img-responsive" src="<?php echo $site_url;?>thumb.php?src=<?php echo $site_url;?>images/gallery/<?php echo $image['image'];?>&w=80&h=80"/></a>
                                                              <?php
                                                                   }
				 
							   }
							  ?>
                             </td>
                         </tr>
                        </table>
                    
               
               </td></tr>
               </table>
              </div>
                  <style type="text/css">
.print_button {
	background:#000;
	width:auto;
	padding:5px 10px;
	color:#fff;
	font-weight:bold;
	border:none;
	}
</style>
<p style="text-align:center;"><br/><button class="print_button" onclick="javascript:printDiv('print')"/>Print Report</button></p>
<script language="javascript" type="text/javascript">
        function printDiv(divID) {
            //Get the HTML of div
            var divElements = document.getElementById(divID).innerHTML;
            //Get the HTML of whole page
            var oldPage = document.body.innerHTML;

            //Reset the page's HTML with div's HTML only
            document.body.innerHTML = 
              "<html><head><title></title></head><body>" + 
              divElements + "</body>";

            //Print Page
            window.print();

            //Restore orignal HTML
            document.body.innerHTML = oldPage;

          
        }
    </script>
                </div>
           </form>
                
                
          </div>
         
        </div>
        </div>
        

    </section>
   <?php
   include('iframe-footer.php');
   ?>