<?php 
session_start();
ob_start(); 
include "../common/inc/config.inc.php";
//$objIms->Semifinisheditem_alter();
?>
<!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>Untitled Document</title>
<style type="text/css">
<!--
input{ border:#CCCCCC solid 1px; border-radius:5px; height:22px; width:200px; padding-left:5px;}
select{ border:#CCCCCC solid 1px; border-radius:5px; height:27px; width:200px;}
.table_bg{ border:#CCCCCC solid 1px; border-radius:5px; height:auto; width:auto; padding:20px; margin-bottom:10px;}
.text_style{ font-family:Arial, Helvetica, sans-serif; font-size:12px;}
.text_style1{ font-family:Arial, Helvetica, sans-serif; font-weight:bold; font-size:12px;}
.style14 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 18px;
	font-weight: bold;
}
.style16 {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 24px;
	font-weight: bold;
}

-->
</style>
</head>

<?php
if(isset($_GET["sid"]))
{
$sid=$_GET["sid"];
  $sql_viewtmp1="select * from tbl_supplier where md5(id)='$sid' and session_login_id = '".$_SESSION['login_id']."'";
				$res_viewtmp1=mysql_query($sql_viewtmp1);
$rows1=mysql_fetch_assoc($res_viewtmp1);

	 $sql_viewtmp2="select * from tbl_account where session_login_id = '".$_SESSION['login_id']."' and mas_id in(select id from tbl_purchase_master where supplier_id = '".$rows1['id']."' and session_login_id = '".$_SESSION['login_id']."') and sales_type='Purchase' and Dr_Amt !='0' and cancel_status='0' and payment_mode!='Due'";
				$res_viewtmp2=mysql_query($sql_viewtmp2);
				
				
	 $sql_viewtmp3="select * from tbl_account where session_login_id = '".$_SESSION['login_id']."' and mas_id  = '".$rows1['id']."' and sales_type='Purchase Paid' and Dr_Amt !='0' and cancel_status='0'";
				$res_viewtmp3=mysql_query($sql_viewtmp3);
					
	}
?>

<script type="text/javascript">
 
function printDiv(divName) {
     var printContents = document.getElementById(divName).innerHTML;
     var originalContents = document.body.innerHTML;

     document.body.innerHTML = printContents;

     window.print();

     document.body.innerHTML = originalContents;
}

</script>
<body>



<div id="printableArea">
<div style="width:210mm; height:297mm; margin:auto; text-align:center">
<table width="100%" border="0">
  <tr>
    <td align="center"><p><span class="style14" style="background:#666666; color:#FFFFFF; "><?php echo $_SESSION['org_name'];?> </span><br />
        <span ><?php echo $_SESSION['address'];?>, <?php echo $_SESSION['city'];?>, <?php echo $_SESSION['state'];?></span><br /> 
		<span>Contact No.:<?php echo $_SESSION['phone'];?>         </span><br />     
        <?php if($sales_type=="Tax Invoice"){?>
        <span>GSTIN:<?php echo $_SESSION['gstin'];?>         </span>
        <?php }?>
    </p>
      <table width="100%" border="1">
        <tr>
          <td colspan="16"><div align="center">PAYMENT DETAILS FOR (<?php echo $rows1['supplier_name']; ?>)</div></td>
          </tr>
       <tr>
	   <td>Date</td>
	   <td>Paid Amount</td>
	   <td>Payment Mode</td>
	   </tr>
	   <?php
	   while($rows2=mysql_fetch_assoc($res_viewtmp2)){
	   ?>
	   <tr>
	   <td><?php $t_date = $rows2['trans_date']; echo $trans_date=$objIms->IntToDate($t_date);?></td>
	   <td><?php echo $rows2['Dr_Amt'];?></td>
	   <td><?php echo $rows2['payment_mode'];?>
	   </td>
	   </tr>
	   <?php }?>
	   
	    <?php
	   while($rows3=mysql_fetch_assoc($res_viewtmp3)){
	   ?>
	   <tr>
	   <td><?php $t_date2 = $rows3['trans_date']; echo $trans_date2=$objIms->IntToDate($t_date2);?></td>
	   <td><?php echo $rows3['Dr_Amt'];?></td>
	   <td><?php echo $rows3['payment_mode']; if($rows3['payment_mode']=='Cheque'){
	   $acc_id = $rows3['id'];
	     $sql_viewtmpck="select * from tbl_cheque_detail where account_id='$acc_id' and session_login_id = '".$_SESSION['login_id']."'";
				$res_viewtmpck=mysql_query($sql_viewtmpck);
$rows_ck=mysql_fetch_assoc($res_viewtmpck);

	   ?> <hr /><br />
	   <p><span>Bank Name: <?php echo $rows_ck['bank_name'];?></span><br /><span>Branch : <?php echo $rows_ck['branch_name'];?></span><br /><span>Cheque No: <?php echo $rows_ck['checque_no'];?></span><br /><span>Cheque Date: <?php echo $rows_ck['checque_date'];?></span></p>
	   
	   <?php }?></td>
	   </tr>
	   <?php }?>
</table>

</div>


<div align="center"><span class="btn btn-info" onClick="printDiv('printableArea')">Print</span></div>

  

</body>
</html>

