<?php
session_name('CAKEPHP'); session_start();
include('config.php');
include('includes/ConnectDB.inc');
include('includes/function_lib.php');
include('includes/LanguageSetup.php');
include('includes/DateFunctions.inc');
$sql=DB_query("select * from rgp_tab where id='".$_REQUEST['id']."'",$db);
$row1=DB_fetch_array($sql);
extract($row1);
?>

<link href="css/professional/default.css" rel="stylesheet" type="text/css" />

<h3>Challan</h3>
 <div id="foo">
<p align="right" style="margin-right:20px;"> <a href="#" onclick="javascript:toggle_visibility('foo');" ><strong>Print</strong></a> </p>
</div>

<table border="0" cellpadding="3" cellspacing="0"  width="100%">
<tr>		
<td width="18%" bgcolor="#e2e2e2" style="border:#999999 1px solid; text-align:center;"><strong><?php echo $rgp_no; ?> </strong></td>
<td align="center" style="font-size:14px; text-align:center;"><strong>Challan</strong></td> 
 <td width="15%" height="30" align="center" valign="middle" bgcolor="#e2e2e2" style="border:#999999 1px solid; text-align:center;"><strong>ORIGINAL</td>
</tr>
	<tr>
	  <td height="30" colspan="3" align="center" style="font-size:12px; text-align:justify;">For movement of Inputs or patially processed/semi finished goods under Rule {4(5)(a)(b)
of Cenvat Credit Rule, 2002 from one factory to another factory for further processing/operation.</td>
	  </tr>
  </table>

<?php

$company=DB_query("select * from companies where CompanyId='".$_SESSION['ACGCompanyId']."'",$db);
$company_row=DB_fetch_array($company);

?>

 
<table width="100%" border="1" cellspacing="1" cellpadding="2" align="center" style="border-bottom:none;">
 <tr><td height="70" colspan="7" align="center" valign="top"><strong>
   <h2 align="center" style="margin-bottom:0px;"><font color="#006699">
    <?php echo $company_row['CompanyName']; ?>
   <br /><?php echo $s->getField('locations','loccode',$branch,'locationname'); ?> </font></h2></strong>
  <P align="center"> 
       <strong><?php echo $s->getField('locations','loccode',$branch,'deladd1'); ?>
	   <?php echo $s->getField('locations','loccode',$branch,'deladd2'); ?>
	   <br />
       <strong>Ph.</strong> : <?php echo $s->getField('locations','loccode',$branch,'mobile'); ?>
	
	  ,<strong>TIN No.</strong> :  <?php echo $s->getField('locations','loccode',$branch,'tin_no'); ?> 
	 
	  ,<strong>Email ID</strong> :  <?php echo $s->getField('locations','loccode',$branch,'email'); ?> 
	  <br />
	
	  
	  </p>

 </td></tr> 
  <tr>
    <th width="25%" scope="row"><strong>Description of Goods (1)</strong></th>
    <th width="15%">Identification Marks (2)</th>
    <th width="15%"><strong>Quantity (3) </strong></th>
    <th width="10%">Unit</th>
     <th width="15%"><strong>Value (4)</strong></th>
    <th>Total (5)</th>
  </tr>
  <?php 
  $sql1=DB_query("select * from rgp_tab_details where parent_id='".$_REQUEST['id']."'",$db);
  while($row=DB_fetch_array($sql1))
  {
  ?>
  <tr>
    <th scope="row"><strong><?php echo $s->getField('item_master','id',$row['mst_itemid'],'item_name'); ?></strong></th>
    <td><?php echo $s->getField('item_master','id',$row['mst_itemid'],'StockID'); 	?></td>
    <td align="right"><?php echo $row['qty']; 
	$a[]=$row['qty']; ?></td>
    <td align="center"><?php  $unit= $s->getField('item_master','id',$row['mst_itemid'],'unit'); 
	echo $s->getField('unitsofmeasure','unitid',$unit,'unitname');
	?></td>
    
    <td><strong><?php echo $row['job_rate'];
	$b[]=$row['job_rate'];
	?></strong></td>
    <td><?php echo $row['jobvalue'];
	$c[]=$row['jobvalue'];
	?></td>
  </tr>
  <?php } ?>
  
 
  <tr>
    <td colspan="2">&nbsp;</td>
    <td align="right" valign="top"><?php echo array_sum($a); ?></td>
    <td  align="center">&nbsp;</td>
    <td align="left"><strong><?php echo array_sum($b); ?></strong></td>
	 <td align="left"><strong><?php echo array_sum($c); ?></strong></td>
  </tr>
</table>
<p ></p>
 <table width="100%%"  cellpadding="4" cellspacing="0" border="1">
  <tr>
    <td width="26%" align="left" valign="top" bgcolor="#e2e2e2"><strong>Date &amp; time of issue Vehicle</strong></td>
    <td width="36%"><?php echo $row1['remove_date']; ?></td>
    <td><table width="100%%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="10%" align="left">Time</td>
    <td align="left"><?php echo $row1['remove_time']; ?></td>
  </tr>
</table></td>
  </tr>
  
  <tr>
    <td align="left" valign="top" bgcolor="#e2e2e2"><strong>Name of Vendor</strong></td>
    <td colspan="2">
	
	<strong><?php echo $s->getField('suppliers','id',$row1['supplier'],'vendor_name'); ?><br />
    </strong><?php echo   $s->getField('suppliers','id',$row1['supplier'],'adrress1');?>

, <?php echo  $s->getField('suppliers','id',$row1['supplier'],'adrress2');?>
<br />
<?php  echo $s->getField('suppliers','id',$row1['supplier'],'address3');?>
<br />
TIN NO. <?php echo  $s->getField('suppliers','id',$row1['supplier'],'tin_no');?> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ECC No. <?php echo  $s->getField('suppliers','id',$row1['supplier'],'pan_no');?></td>
   </tr>
  <tr>
    <td align="left" valign="top" bgcolor="#e2e2e2"><strong>Expected duration of processing Remarks</strong></td>
    <td colspan="2"><?php echo  $row1['expected_time'];?>  Days</td>
   </tr>
  <tr>
    <td align="left" valign="top" bgcolor="#e2e2e2"><strong>Place</strong></td>
   <td colspan="2"><strong><?php echo  $s->getField('locations','loccode',$branch,'locationname'); ?></strong></td>
   </tr>
  <tr>
    <td align="left" valign="top" bgcolor="#e2e2e2"><strong>Date</strong></td>
    <td>&nbsp;</td>
    <td>Authorised Signatory</td>
  </tr>
</table>
<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>