	<?php
	ob_start();
	session_name('CAKEPHP'); @session_start();
	$PageSecurity = 1;
	include('config.php');
	include('includes/ConnectDB.inc');
	include('includes/function_lib.php');
	include('includes/LanguageSetup.php');
	include('includes/DateFunctions.inc');
	include('includes/SQL_CommonFunctions.inc');
	function convertDate($Dt)
	{
		$dateBRK=explode('-',$Dt);
		$newFormat=$dateBRK[2]."/".$dateBRK[1]."/".$dateBRK[0];
		return $newFormat;
	}
	
	$sql="SELECT * FROM material_slip_against_job_card WHERE id='".$_REQUEST['printid']."'";
	$result=DB_query($sql,$db);
	$myrow=DB_fetch_assoc($result);
	//echo '<pre>';
	//print_r($myrow);
	$Compamies=DB_query("select * from companies",$db);
	$CompamiesRow=DB_fetch_array($Compamies);
	?>
	
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
	<title>Material Requirement Slip</title>
	
<style type="text/css"> 
@print {size:A4; margin:20px 20px;}

@media print{
body{ margin:0px; padding:0px;  font-size:10px; font-family: Arial, Helvetica, sans-serif; color:#000; font-weight:normal;}

h1,h2,h3,h4,h5,p{ margin:0px; padding:0px;}
p{ text-align:left;}

h1{
  font-size: 18px; line-height: 22px;
  font-weight:normal;
  font-family:Arial, Helvetica, sans-serif !important;
  color:#000; 
}
h2{
  font-size: 18px;
  font-weight:normal;
  font-family:Arial, Helvetica, sans-serif !important;
}
.wrapper{width:100%; height: auto; float:left; border:#000000 1px solid; border-bottom:#000000 1px solid;}
.div_first, .div_first .full{
  width: 100%; height: auto;
  /*border-bottom: #000000 1px solid;
  border-top: #000000 1px solid;*/
  /*border-left: #000000 1px solid;
  border-right: #000000 1px solid;*/
  float: left;
}
.div_first .full{text-align: center; border:0;}
.div_first .left
        {
          width:10%; text-align:left; height:auto; vertical-align:middle; height:auto; padding: 10px; position: absolute; left: 0; top: 0;
        }
        .div_first .middle
        {
          width:60%; text-align:center; padding: 10px; margin:0 auto; position: relative;
        }
        .div_first .right
        {
          width:20%;text-align:right; padding: 10px; position: absolute; right: 0; top: 0;
        }
.div_second, .div_third, .div_forth, .div_fifth{
  width: 100%;
  height:auto;
  border-top: #000000 1px solid;
  /*border-bottom: #000000 1px solid;*/
  /*border-left: #000000 1px solid;
  border-right: #000000 1px solid;*/
  float: left;
}
.div_second table tr th, .div_second table tr td{border-right:#000000 1px solid; border-bottom:#000000 1px solid;}
.div_second table tr th{text-align: left;}
.div_second table tr th:last-child, .div_second table tr td:last-child{border-right:0;}
.div_second table tr:last-child td{border-bottom:0;}
.div_second table tr td > table tr td{border-right:#000000 1px solid; border-bottom:#000000 1px solid;}
.div_second table tr td > table tr td:last-child{border-right:0;}
.div_second table tr td > table tr:last-child td{border-bottom:0;}

.div_third table tr th, .div_third table tr td{ border-bottom:#000 1px solid; border-right:#000 0px solid;}
.div_third table tr th{background-color:transparent; text-align: left;}
.div_third table tr th:last-child, .div_third table tr td:last-child{border-right:none;}
.div_third table tr:last-child td{border-bottom:none;}

.div_forth table tr th, .div_forth table tr td{ border-bottom:#000 1px solid; border-right:#000 0px solid;}
.div_forth table tr th{background-color: #ccc; text-align: left;}
.div_forth table tr th:last-child, .div_forth table tr td:last-child{border-right:none;}
.div_forth table tr:last-child td{border-bottom:none;}

.div_fifth table tr th, .div_fifth table tr td{ border-bottom:#000 1px solid; border-right:#000 1px solid;}
.div_fifth table tr th:last-child, .div_fifth table tr td:last-child{border-right:none;}

.f12{ font-weight: bold; color:#000; font-size:12px;}
.f11{color:#000; font-size:12px; font-weight: normal; line-height:18px;}
.f14{color:#000; font-size:18px;}
.mt26{margin-top:4px; width:90%;}
.mt27{margin-top:0px; width:62%;}
.mt28{margin-top:0px; width:100%;}
.border_top{border-top:#000 1px solid;}
.border_bottom{border-bottom:#000 1px solid;}
.wdt1{width:8%;}
.wdt2{width:100px;}
.wdt3{width: 66px;}
.wdt4{width: 80px;}
.wdt5{width: 52px;}
.wdt6{width: 60px;}
}

@media screen{
/* CSS Document */
body{ margin:0px; padding:0px; background-color:#fff; font-size:12px; line-height: 18px; font-family: Arial, Helvetica, sans-serif; color:#000; font-weight:normal;}
h1,h2,h3,h4,h5,p{ margin:0px; padding:0px;}
p{ text-align:left;}

#foo{width:1070px; height: auto; margin:0px auto;}
.wrapper{width:1070px; height: auto; margin:10px auto; border-top:#000000 1px solid;}

h1{
  font-size: 24px; line-height: 28px;
  font-weight:bold;
  font-family:Arial, Helvetica, sans-serif !important;
  color:#006699;  
}
h2{
  font-size: 18px; line-height: 22px;
  font-weight:normal;
  font-family:Arial, Helvetica, sans-serif !important;  
}
.div_first, .div_first .full{
  width: 100%; height: auto;
  /*border-bottom: #000000 1px solid;
  border-top: #000000 1px solid;*/
  border-left: #000000 1px solid;
  border-right: #000000 1px solid;
  float: left; position: relative; display: table;
}
.div_first .full{text-align: center; border: 0; margin:10px 0 0;}
.div_first .left, .div_first .middle, .div_first .right{float: left; display: table-cell; vertical-align: middle;}
.div_first .left
        {
          width:8%; text-align:center; height:auto; vertical-align:middle; padding: 1%; 
        }
        .div_first .middle
        {
          width:78%; text-align:center; padding: 1%; position: relative;
        }
        .div_first .right
        {
          width:8%; text-align:center; padding:1%; 
        }
.div_second, .div_third, .div_forth, .div_fifth{
  width: 100%; height: auto;
  /*border-bottom: #000000 1px solid;*/
  border-top: #000000 1px solid;
  border-left: #000000 1px solid;
  border-right: #000000 1px solid;
  float: left;
}
.div_second table tr th, .div_second table tr td{border-right:#000000 1px solid; border-bottom:#000000 1px solid;}
.div_second table tr th{background-color: #ccc; text-align: left;}
.div_second table tr th:last-child, .div_second table tr td:last-child{border-right:0;}
.div_second table tr:last-child td{border-bottom:0;}
.div_second table tr td > table tr td{border-right:#000000 1px solid; border-bottom:#000000 1px solid;}
.div_second table tr td > table tr td:last-child{border-right:0;}
.div_second table tr td > table tr:last-child td{border-bottom:0;}

.div_third table tr th, .div_third table tr td{ border-bottom:#000 1px solid; border-right:#000 0px solid;}
.div_third table tr th{background-color: #ccc; text-align: left;}
.div_third table tr th:last-child, .div_third table tr td:last-child{border-right:none;}
.div_third table tr:last-child td{border-bottom:none;}

.div_forth table tr th, .div_forth table tr td{ border-bottom:#000 1px solid; border-right:#000 0px solid;}
.div_forth table tr th{background-color: #ccc; text-align: left;}
.div_forth table tr th:last-child, .div_forth table tr td:last-child{border-right:none;}
/*.div_forth table tr:last-child td{border-bottom:none;}*/

.div_fifth table tr th, .div_fifth table tr td{ border-bottom:#000 1px solid; border-right:#000 1px solid;}
.div_fifth table tr th:last-child, .div_fifth table tr td:last-child{border-right:none;}

.f12{font-weight: bold; color:#000; font-size:12px;}
.f11{ color:#000; font-size:12px; font-weight: normal; line-height:18px;}
.f14{ color:#000; font-size:18px;}
.mt26{margin-top:4px; width:90%;}
.mt27{margin-top:0px; width:52%;}
.mt28{margin-top:0px; width:90%;}
.border_top{border-top:#000 1px solid;}
.border_bottom{border-bottom:#000 1px solid;}
.wdt1{width:10%;}
.wdt2{width:180px;}
.wdt3{width: 66px;}
.wdt4{width: 120px;}
.wdt5{width: 52px;}
.wdt6{width: 70px;}
}
</style>
	</head>
	<body>
<div id="foo">
  <p style="text-align:right;"><input type="button" onclick="javascript:toggle_visibility('foo');" value="Print" /></p>
</div>

<div class="wrapper">
    	<div class="div_first">
			<?php $logoImage=($CompamiesRow['CompanyLogo']=='')?'Final_Logo_RM.png':$CompamiesRow['CompanyLogo']; ?>
			<div class="left"><img src="css/professional/images/login/<?php echo $logoImage;  ?>" class="mt26" /></div>
	      	<div class="middle"><h1>Ayodhya Eye Hospital</h1>
	      	<span class="f12">A Unit of Mani Mandir Sewa Nyas Samiti</span> <br>
	       	<span class="f12">Tulsibari, Praikrma Marg, Ayodhya - 224123, Dist. - Faizabad</span>
	       	<div class="full"><h2>Raw Material Item Details</h2>
	       	<span class="f11"><?php echo $company_row['Address1'].", ". $company_row['Address2']. ", ".$company_row['Address3'].", ". $company_row['City']. ", ". $company_row['State'].", ". $company_row['Country'].", ".$company_row['Zipcode'] ; ?></span></div>
	      	</div>
	      	<div class="right"><img src="images/eye-logo-blue.png" vspace="10" width="100%" /></div>
    	</div>
		
        <div class="div_second">
        <table width="100%" border="0" cellpadding="3" cellspacing="0">
<tr>
	  <td class="f12" width="12%">Branch</td>
		<td class="f11">
		<?php 
		 echo $s->getField('locations','loccode',$myrow['branch_id'],'locationname'); ?>
		</td>
	<td width="12%" class="f12">Material Slip No.</td>
    <td width="20%" class="f11"><?php echo $myrow['mat_slip_no']; ?></td>
</tr>

<tr >
  <td class="f12" >From Store</td>
    <td class="f11">
		<?php  echo $s->getField('storetype','id',$myrow['from_store'],'StoreName'); ?>
	  </td>
    <td class="f12" >To Store</td>
    <td class="f11"><?php echo $s->getField('storetype','id',$myrow['to_store'],'StoreName'); ?></td>
  </tr>

 <tr >
	<td class="f12">Remarks</td>
	<td class="f11" colspan="3"><?php echo $myrow['remarks']; ?>&nbsp;</td>
 </tr> 

		<table  width="100%" border="0" cellspacing="0" cellpadding="3">
	  <tr>
		<th width="5%" align="left" class="f12">S.No.</th>
		<th width="15%" align="left" class="f12">Item Code</th>
		<th align="left" class="f12">Item Name </th>
		<!-- <th width="12%" align="left" class="f12">Unit</th> -->
		<th width="12%" align="left" class="f12">Total Req Qty</th>
	  </tr>
	   <?php 
	 
			
			$sql="Select * from material_job_item where material_slip_id='".$_REQUEST['printid']."'";
			$result=DB_query($sql,$db);
			$i=1;
			while($myrow1=DB_fetch_array($result))
			{
				$item_name = $s->getField('item_master','id',$myrow1['mst_itemid'],'item_name');
				$item_code = $s->getField('item_master','id',$myrow1['mst_itemid'],'StockID');

	   ?>
		<tr>
		<td class="f11"><?php echo $i;?></td>
		<td class="f11"><?php echo $item_code;?></td>
		<td class="f11"><?php echo $item_name;?></td> 
		<!-- <td class="f11"><?php echo $myrow1['unit'];?></td> -->
		<td class="f11" style="text-align:right;"><?php echo $myrow1['primary_qty'];?></td>
		 </tr>
	  <?php $i++;} ?>
	</table>
	</div>
	<div class="div_third">
	<?php if($myrow['remarks']!=''){ ?>
	<table width="100%" border="0" cellspacing="0" cellpadding="3">
					<tr>
					  <td width="10%" class="f12">Remarks :</td>
					  <td class="f11"><?php echo $myrow['remarks']; ?></td>
					</tr></table> 
	<?php } ?>
	
		</div>
		<div class="div_forth">
		<table width="100%" border="0" cellspacing="0" cellpadding="3">
					<tr>
					  <td height="80" valign="bottom" style="text-align:left;" width="25%" class="f12"><?php $username=DB_fetch_array(DB_query("select realname from www_users where id='".$myrow['created_by']."' ",$db));    echo $username['realname']; ?><br />(Prepared By)</td>
					  <td valign="bottom" width="25%" class="f12" style="text-align:center;">(Checked By)</td>
					  <td valign="bottom" width="25%" class="f12" style="text-align:center;">(Approved By)</td>
					  <td valign="bottom" class="f12" style="text-align:right;">(Accepted By)</td>
					</tr>
				</table>
			</div>
		<div>
	</div>
	<script type="text/javascript" language="javascript">
  function toggle_visibility(id) {
       var e = document.getElementById(id);
        e.style.display = 'none';
           //alert(e.style.display);
         window.print();
    }
  
</script>
	</body>
	</html>
	
