<?php require "_header.php";   
include "Numbers/Words.php"; ?>
<script language="javascript" type="text/javascript">
//document.getElementById("main-content").style.display = 'none';
</script>

<div id="main-report" align="center">

<?php 
$height=200;
$nw = new Numbers_Words();
if($_SESSION["cCompany_id"]!="" && isset($_SESSION["cCompany_id"]))
{ 

		
		$agencyid = $_SESSION["cCompany_id"];

		$qry = " SELECT * FROM lms_operatorinvoice,lms_operator 
					where lms_operatorinvoice.operator_id = lms_operator.operator_id  and  `invoice_no` LIKE '%MP%'
					  ";
	//	echo $qry; exit;
		//$ObjagencymasterMgmt = new agencymasterMgmt(); ".$_REQUEST['nro_no']. "
		 
	 	$rs = dbQuery($qry);
		$rs1=dbQuery($qry);
		
		$count=dbRows($rs);
		$j=0;
		$custome_height = 240;
		///extract($row);
		ob_start();
		$page_break=1;
		$i=0;
		$sno=1;
		$net_amount = 0;
if($count> 0)
	{
	
		  
			
	   ?>
<style>	   
		 .container table {
  border-spacing: 0;
  border-top: solid 1px #000;
  border-left: solid 1px #000;
}
.container table td {
  border-right: solid 1px #000;
  border-bottom: solid 1px #000;
}
.container .no-border-right {
  border-right: none;
  color: red;
   
}
.container .no-border-right1 {
  border-bottom: none;
  color: red;
   
}

.container .no-border-right + td {
  border-left: none;
}
</style>

    <?php
   	while($row = dbArray($rs))
	{
		
	?>
		<div class="container">
		<table  width="100%" border="1"  >
        <tr>
		<td  class="no-border-right" width="40%" ></td>
		<td height="20px;" width="10%" class="no-border-right1"></td>	
		<td height="20px;" width="50%" colspan="2">Address</td>	
		</tr>	
		<tr>
		<td height="20px;"><b>Name : <?php print $row['operator_name'];?></b></td>	
		<td height="20px;" class="no-border-right1"></td>	
		<td height="20px;" colspan="2"><center><b>Address<b></center></td>	
		</tr>
		<tr>
		<td height="20px;"  class="no-border-right"></td>	
		<td height="20px;"></td>	
		<td height="20px;" colspan="2"><?php print $row['operator_address'];?></td>	
		</tr>
	</div>		
		<tr>
		<td colspan="5"><center><b><font size="5">Invoice</font><b></center><br/></td>
		</tr>
			
		<tr>
		<td colspan="2" align="left"><b><font size="2">&nbsp;&nbsp;Bill To,<font></b></td>
		<td align="left"><b><font size="2">&nbsp;&nbsp;Invoice No:<font></b></td>
		<td align="left"><b><font size="2">&nbsp;&nbsp;<?php print $row['invoice_no'];?><font></b></td>
		</tr>
		<tr>
		<td colspan="2" align="left" >Aum Imagineering Pvt Ltd</td>
		<td align="left" >Date</td>
		<td align="left" ><?php  print date("d/m/Y",strtotime($row['billdate']));?></td>
		</tr>
		<tr>
		<td colspan="2" align="left" >602-603/A, Shapath-1</td>
		<td align="left" >PAN No</td>
		<td align="left" ><?php print $row['operator_panno'];?></td>
		</tr>
		<tr>
		<td colspan="2" align="left" >S.G.Highway,</td>
		<td align="left" >Aadhar No</td>
		<td align="left" ><?php print $row['operator_aadharno'];?></td>
		</tr>
		<tr>
		<td colspan="2" align="left" >Opposite Rajpath Club, Satellite,</td>
		<td align="left" >Mobile No</td>
		<td align="left" ><?php print $row['operator_mobile'];?></td>
		</tr>
		<tr>
		<td colspan="2" align="left" >Ahmedabad, Gujarat - 380015</td>
		<td align="left"></td>
		<td align="left"></td>
		</tr>
		<tr>
		<td colspan="2" align="left" >PAN No : AAJCA3252C</td>
		<td align="left" ></td>
		<td align="left" ></td>
		</tr>

                 <tr><td align="center" colspan="5">
			<table width="100%" cellpadding="0" cellspacing="0" class="report" frame="box" border="0" cellpadding="0" cellspacing="0"  >
			<tr style="font-weight:bold">
			<td align="center" width="2%" >SR. NO</td>
			<td align="center" width="12%" >PARTICULARS</td>
			<td align="center" width="6%">Total</td>
			
			</tr>
                
                
                  <tr>
                    <td  style="text-align:left;" width="10%">
                      1
                     </td>
                     <td  style="text-align:left;" width="40%">
                      <?php echo $row['product_name']; ?>
                     </td>
                     
                     
                   
                    
                    
                      <td  style="text-align:center;" width="22%">
                      <?php 
					  echo $row['tamount'] ?>
                     </td>
                     
                     
                 </tr>
               <?php
			   		$height=$height-25;
					 $sno++;
					 $net_amount=$row['tamount'];
					 	
			 
			    ?>  
                <tr style="height:30px">
               <td></td>
                </tr>
				<tr>
                   <td  style="text-align:center;" colspan="2">
                      GRAND TOTAL
                     </td>
               
				<td align="center" >
                  	
                   <?php echo ' Rs. '.number_format(round($net_amount),2); ?>
                  </td>
                </td>
				</tr>
			  <tr>
				<td colspan="5" height="20px;"></td>
			  </tr>
               <tr style="height:35px;vertical-align:middle">
                
                   <td align="left" width="71%" colspan="5"> 
                   Amount in Words : 
                  <?php  echo strtoupper($nw->toWords($net_amount)." Rupees Only");?>
                  </td>
                </tr>
				
			 <tr style="height:70px;vertical-align:middle">
                
                   <td  width="71%" colspan="5" style="padding-top:50px;padding-left:500px;"> 
                   Authorized Signatory
                  
                  </td>
                </tr>	
				
				
				
       	</table>
		</td>
		</tr>
         </br>
		   </br>
		   </br>
		
		   
		  <?php 
		   if($page_break%2==0){
			   
			 ?>
			   </table>
			 
		 
		     <div class="break">&nbsp;</div>
			   <table cellpadding="0" cellspacing="0" width="95%" >
		<?php
		   }
		   $page_break++;
		   ?>
		


		<?php

		
	}
	
	?>
</div>
         
			<?php 
	}
		
	
	   
		
			 ?>		
       
          
          		
	   <?php  
	   $HtmlCode= ob_get_contents();
			ob_end_flush();
			$HtmlUrl 	=	"customerbill-report-". $_SESSION["eAgencyId"].".html";
			$HtmlPath 	=	"report/".$HtmlUrl;		
			createHTMLReportPage($header_row_string,$HtmlUrl,$HtmlPath,$HtmlCode,true); 		
		?>		
		<br />
<br /><br />
		<form name="frm" id="frm" action="" method="post">		
<input type="hidden" name="txtFile" id="txtFile" value="<?php echo $HtmlUrl ;?>" />
<input type="button" name="btnPdf" id="btnPdf" value="Print" onClick="SetPageAction('PRINT');"/>
<input type="button" name="btnPdf" id="btnPdf" value="Create PDF" onClick="SetPageAction('PDF');"/>
<input type="button" name="btnHtml" id="btnHtml" value="Create HTML" onClick="SetPageAction('HTML');"/>
<input type="button" name="btnWord" id="btnWord" value="Create WORD" onClick="SetPageAction('WORD');"/>
<input type="button" name="btnExcel" id="btnExcel" value="Create EXCEL" onClick="SetPageAction('Excel');"/>
		</form>
		<script language="javascript" type="text/javascript">
			function SetPageAction(varAction) {
				
				if(varAction=="PRINT"){			
                        document.frm.action="print/create-print.php";
                        document.frm.submit();
                    }
			   else if(varAction=="PDF"){			
					document.frm.action="convertpdf/create-pdf.php";
					document.frm.target = "_blank";
					document.frm.submit();
				}
				else if(varAction=="HTML"){
					document.frm.action="<?php echo $HtmlPath ;?>";
					document.frm.target = "_blank";
					document.frm.submit();
				}
				else if(varAction=="WORD"){
					document.frm.action="convertword/create-word.php";
					document.frm.target="_blank";
					document.frm.submit();
				}
				else if(varAction=="Excel"){
					document.frm.action="convertword/create-excel.php";
					document.frm.target="_blank";
					document.frm.submit();
				}
			}
		</script> 
<?php } ?> 
</div>
<?php require "_footer.php";?>