<?php 
session_start();
ob_start();
include("../../../pidbco/pidbjoin.php");

$bill = strip_tags(base64_decode($_GET['bill']));
$sq = mysqli_query($con, "SELECT * FROM `p_billing` WHERE `bid` = '$bill' ");
$rs = mysqli_fetch_array($sq);

$comid = $rs['bcomp'];
$sq1 = mysqli_query($con,"SELECT c_comp FROM `p_company` WHERE `cid`='$comid' ");
$rs1 = mysqli_fetch_array($sq1); 

$border_no = $rs['border_no'];
$sq2 = mysqli_query($con, "SELECT * FROM `p_orders` WHERE `order_id`='$border_no' ");
$rs2 = mysqli_fetch_array($sq2);

$bcust = $rs['bcust'];
$sq3 = mysqli_query($con, "SELECT cname FROM `p_customers` WHERE `cid`='$bcust' ");
$rs3 = mysqli_fetch_array($sq3);
?>
<!DOCTYPE html>
<html>

    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Programers</title>
        
        <style type="text/css">
			table { width:100%; border:none; font-size:11px;}
			.head > div { float:left; border-right:solid 1px #666666; text-align:center; line-height:30px; font-weight:bold; border-bottom:solid 1px #666666; }
			.head > div:last-child { border-right:none; width:13%;}
			.head > div:nth-child(1) { width:5%;}
			.head > div:nth-child(2) { width:64.38%;}
			.head > div:nth-child(3) { width:5%;}
			.head > div:nth-child(4) { width:12%;}
			
			.head-body > div { float:left; border-right:solid 1px #666666; text-align:center; line-height:30px;  height:300px;  }
			.head-body > div:last-child { border-right:none; width:13%; text-align:right;}
			.head-body > div:nth-child(1) { width:5%;}
			.head-body > div:nth-child(2) { width:64.38%; text-align:left;}
			.head-body > div:nth-child(3) { width:5%;}
			.head-body > div:nth-child(4) { width:12%; text-align:right;}
			
			.head-body-content { overflow:hidden; line-height:20px;}
			.head-body-content > div { float:left; text-align:center; line-height:30px; margin:10px 0px;}
			.head-body-content > div:last-child {  width:13.62%; text-align:right;}
			.head-body-content > div:nth-child(1) { width:5%;}
			.head-body-content > div:nth-child(2) { width:63.38%; text-align:left; text-transform:uppercase; line-height:15px; font-size:10px;}
			.head-body-content > div:nth-child(3) { width:5%;}
			.head-body-content > div:nth-child(4) { width:12%; text-align:right;}
			
			.head-body-total {border:solid 1px #666666; overflow:hidden; border-top:none;}
			.head-body-total > div { float:left; text-align:right; line-height:20px; }
			.head-body-total > div:last-child {  width:12.86%; float:right; }
			.head-body-total > div:nth-child(1) { width:68%;padding-right:10px; font-size:10px;}
			
		</style>
        
    </head>

	<body style="font-family:Arial, Helvetica, sans-serif; font-size:11px; margin:0px; padding:10px;" onLoad="print();">
	
        <div style="width:100%; height:100%; overflow:hidden; top:0px; bottom:0px; left:0px; right:0px; margin:auto;">
            
            <div style="width:49.9%;float:left; min-height:250px; overflow:hidden; border-right:dotted 1px #CCCCCC;">
            	
                <div style="padding-right:25px;">
                	
                    <table>
                    <tr>
                    
                        <td style="width:50%;">
                            <img src="images/logo.png" width="245px" style="" />
                        </td>
                        
                        <td style="width:50%;">
                            <div style="line-height:20px; color:#000; text-align:right; font-weight:bold; font-size:12px;">
                             <?php echo $rs['bbranch']; ?>
                            
                            </div>
                        </td>
                    
                    </tr>
                    </table>
                    <br />
                    
                    <table>
                    <tr>
                    	
                        <td style="width:35%;">
                        	
                            <table style="line-height:20px;">
                            
                            	<tr>
                                    <td style="width:35%;"><b>Order No.</b></td>
                                    <td style="text-align:center; width:10px;">:</td>
                                    <td><?php echo $rs['border_no']; ?></td>
                                    </tr>
                                <tr>
                                    <td><b>Date</b></td>
                                    <td style="text-align:center; width:10px;">:</td>
                                    <td><?php 
                                    $taskdat = $rs2['ordr_date']; 
                                    $exp = explode("/",$taskdat);
	                                echo $taskdate = $exp[2].'/'.$exp[1].'/'.$exp[0];
                                      ?></td>
                            	</tr>
                                
                            </table>
                            
                        </td>
                        
                        <td style="width:40%;">
                        	
                            <div style="width:100%; border:solid 1px #999999; border-radius:7px; text-align:center; line-height:35px; font-weight:bold; font-size:12px; margin:0px auto;">
                            PERFORMA / INVOICE
                            </div>
                            
                        </td>
                        
                        <td style="width:25%; text-align:right; line-height:20px;">
                        	
                            <b style="font-size:12px;">ORIGINAL</b><br />
                            <b>Invoice No.</b> : <?php echo $rs['bill_no']; ?>
                            
                        </td>
                        
                    </tr>
                    </table>
                    
                    <div style="width:100%; margin-bottom:5px; border-top:solid 1px #666666; padding-top:5px;">
                    	<b>To</b> : <span style="text-transform:uppercase;"><?php echo $rs3['cname']; ?></span>
                    </div>
                                       
                    <div style="width:99.7%; border:solid 1px #666666; overflow:hidden; height:330px;">
                    	
                        <div class="head">
                        	
                            <div>#</div>
                            <div>Description</div>
                            <div>Qty.</div>
                            <div>Rate</div>
                            <div style="width:11.95%;">Amount</div>
                            
                        </div>
                        <div style="clear:both;"></div>
                        <div class="head-body">
                        	
                            <div></div>
                            <div></div>
                            <div></div>
                            <div></div>
                            <div></div>
                            
                        </div>
                        
                        <div style="position:absolute; width:47.5%;">
                        <?php
                        $suj = mysqli_query($con, "SELECT * FROM `p_billing` WHERE `bid` = '$bill' ");
						$k=1;
                        while($ressuj = mysqli_fetch_array($suj)){
                          $border_no = $ressuj['border_no'];
                          $sq22 = mysqli_query($con, "SELECT * FROM `p_orders` WHERE `order_id`='$border_no' ");
                          $rs22 = mysqli_fetch_array($sq22);        
                        ?>
                            <div class="head-body-content">
                                <div><?php echo $k; ?></div>
                                <div>
                                <div style="padding-left:15px;padding-top: 8px;">
                                    <?php echo $rs22['bill_head']; ?>
                                </div></div>
                                <div>1</div>
                                <div><?php echo number_format($rs22['ordr_amt'],2); ?> &nbsp;&nbsp;</div>
                                <div><?php echo number_format($rs22['ordr_amt'],2); ?> &nbsp;&nbsp;</div>
                            </div>
                            <div style="clear:both;"></div>
                        <?php $k=$k+1; } ?>    
                       
                        
                        </div>
                        
                    </div>
                    
                    <div style="margin-top:-62px;">
                    <div class="head-body-total">
                        	
                        <div>
                        	DISCOUNT<br /><br />
                            TAX  	
                            
                        </div>
                        <div>
                        	<span style="display:block; border-bottom:solid 1px #666666;"><?php echo number_format($rs['bdiscount'],2); ?> &nbsp;</span>
                            <span style="display:block; font-weight:bold;"><?php echo number_format($rs['bnet'],2); ?> &nbsp;</span>
                            <span style="display:block;">00.00 &nbsp;</span>
                        </div>
                        
                    </div>
                    <div style="clear:both;"></div>
                    </div>
                    
                    <div class="head-body-total">
                        	
                        <div>
                        	<b>TOTAL</b>
                        </div>
                        <div>
                        	<b><?php echo number_format($rs['bnet'],2); ?> </b> &nbsp;
                        </div>
                        
                    </div>
                    <div style="clear:both;"></div>
                    
                    
                    <table style="margin-top:10px;">
                    <tr>
                    	
                        <td>
                        	<img src="images/seal.jpg" alt="" style="width:60px;" /><br />
                            (Seal)
                        </td>
                        
                        <td style="text-align:right;">
                        	For Programers<br />
                            <img src="images/signature.jpg" alt="" style="width:75px;" /><br /> 
                            (Authorised Signature)
                        </td>
                        
                    </tr>
                    </table>
                    
                    <div style="padding:5px; text-align:justify; font-size:10px; border:solid 1px #666666; margin:10px 0px;">
                    	All Payments should be made by cheque or demand draft payable to company name (Add Rs.250 for non-MICR cheque). Our responsibility ceases the moment the products hosted to server and claim of not function etc. will be accepted. Claims if any, to be settled in Thrissur - Kerala jurisdiction only. Interest at 12% will be charged on bill if not paid within 15 days from the date of invoice.
                    </div>
                    
                    <div style="text-align:center;">
                    	4th Floor, Park House, Round North, Thrissur<br />
                        Ph : +91 487 2336982/83, +91 9447151442, info@programers.in, programers.in 
                    </div>
                    
                </div>
                
            </div>
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            <div style="width:49.9%; float:right; min-height:250px; overflow:hidden;">
            	
                <div style="padding-left:25px;">
                	
                    <table>
                    <tr>
                    
                        <td style="width:50%;">
                            <img src="images/logo.png" width="245px" style="" />
                        </td>
                        
                        <td style="width:50%;">
                            <div style="line-height:20px; color:#000; text-align:right; font-weight:bold; font-size:12px;">
                            <?php echo $rs['bbranch']; ?>
                            
                            </div>
                        </td>
                    
                    </tr>
                    </table>
                    <br />
                    
                    <table>
                    <tr>
                    	
                        <td style="width:35%;">
                        	
                            <table style="line-height:20px;">
                            
                            	<tr>
                                    <td style="width:35%;"><b>Order No.</b></td>
                                    <td style="text-align:center; width:10px;">:</td>
                                    <td><?php echo $rs['border_no']; ?></td>
                                    </tr>
                                <tr>
                                    <td><b>Date</b></td>
                                    <td style="text-align:center; width:10px;">:</td>
                                    <td><?php 
                                     $taskdat = $rs2['ordr_date']; 
                                    $exp = explode("/",$taskdat);
	                                echo $taskdate = $exp[2].'/'.$exp[1].'/'.$exp[0];
                                    ?></td>
                            	</tr>
                                
                            </table>
                            
                        </td>
                        
                        <td style="width:40%;">
                        	
                            <div style="width:100%; border:solid 1px #999999; border-radius:7px; text-align:center; line-height:35px; font-weight:bold; font-size:12px; margin:0px auto;">
                            PERFORMA / INVOICE
                            </div>
                            
                        </td>
                        
                        <td style="width:25%; text-align:right; line-height:20px;">
                        	
                            <b style="font-size:12px;">DUPLICATE</b><br />
                            <b>Invoice No.</b> : <?php echo $rs['bill_no']; ?>
                            
                        </td>
                        
                    </tr>
                    </table>
                    
                    <div style="width:100%; margin-bottom:5px; border-top:solid 1px #666666; padding-top:5px;">
                    	<b>To</b> : <span style="text-transform:uppercase;"><?php echo $rs3['cname']; ?></span>
                    </div>
                                       
                    <div style="width:99.7%; border:solid 1px #666666; overflow:hidden; height:330px;">
                    	
                        <div class="head">
                        	
                            <div>#</div>
                            <div>Description</div>
                            <div>Qty.</div>
                            <div>Rate</div>
                            <div style="width:11.95%;">Amount</div>
                            
                        </div>
                        <div style="clear:both;"></div>
                        <div class="head-body">
                        	
                            <div></div>
                            <div></div>
                            <div></div>
                            <div></div>
                            <div></div>
                            
                        </div>
                        
                        <div style="position:absolute; width:47.5%;">
                        <?php
                        $suj = mysqli_query($con,"SELECT * FROM `p_billing` WHERE `bid` = '$bill'");
						$k=1;
                        while($ressuj = mysqli_fetch_array($suj)){
                          $border_no = $ressuj['border_no'];
                          $sq22 = mysqli_query($con,"SELECT * FROM `p_orders` WHERE `order_id`='$border_no'");
                          $rs22 = mysqli_fetch_array($sq22);        
                        ?>
                            <div class="head-body-content">
                                <div><?php echo $k; ?></div>
                                <div>
                                <div style="padding-left:15px;padding-top: 8px;">
                                   <?php echo $rs22['bill_head']; ?>
                                </div></div>
                                <div>1</div>
                                <div><?php echo number_format($rs22['ordr_amt'],2); ?> &nbsp;&nbsp;</div>
                                <div><?php echo number_format($rs22['ordr_amt'],2); ?> &nbsp;&nbsp;</div>
                                
                            </div>
                            <div style="clear:both;"></div>
                           <?php $k=$k+1; } ?> 
                           
                        
                        </div>
                        
                    </div>
                    
                    <div style="margin-top:-62px;">
                    <div class="head-body-total">
                        	
                        <div>
                        	DISCOUNT<br /><br />
                            TAX 
                        </div>
                        <div>
                        	<span style="display:block; border-bottom:solid 1px #666666;"><?php echo number_format($rs['bdiscount'],2); ?> &nbsp;</span>
                            <span style="display:block; font-weight:bold;"><?php echo number_format($rs['bnet'],2); ?> &nbsp;</span>
                            <span style="display:block;">00.00 &nbsp;</span>
                        </div>
                        
                    </div>
                    <div style="clear:both;"></div>
                    </div>
                    
                    <div class="head-body-total">
                        	
                        <div>
                        	<b>TOTAL</b>
                        </div>
                        <div>
                        	<b><?php echo number_format($rs['bnet'],2); ?></b> &nbsp;
                        </div>
                        
                    </div>
                    <div style="clear:both;"></div>
                    
                    
                    <table style="margin-top:10px;">
                    <tr>
                    	
                        <td>
                        	<img src="images/seal.jpg" alt="" style="width:60px;" /><br />
                            (Seal)
                        </td>
                        
                        <td style="text-align:right;">
                        	For Programers<br />
                            <img src="images/signature.jpg" alt="" style="width:75px;" /><br /> 
                            (Authorised Signature)
                        </td>
                        
                        
                    </tr>
                    </table>
                    
                    <div style="padding:5px; text-align:justify; font-size:10px; border:solid 1px #666666; margin:10px 0px;">
                    	All Payments should be made by cheque or demand draft payable to company name (Add Rs.250 for non-MICR cheque). Our responsibility ceases the moment the products hosted to server and claim of not function etc. will be accepted. Claims if any, to be settled in Thrissur - Kerala jurisdiction only. Interest at 12% will be charged on bill if not paid within 15 days from the date of invoice.
                    </div>
                    
                    <div style="text-align:center;">
                    	4th Floor, Park House, Round North, Thrissur<br />
                        Ph : +91 487 2336982/83, +91 9447151442, info@programers.in, programers.in 
                    </div>
                    
                </div>
                
            </div>
            
        </div>
	
	</body>
    
</html>
