<?php
require('validate.php');
require('functions.php');
$getpage =$_SERVER['QUERY_STRING']; 
//echo $getpage;
$explode= explode('=',$getpage);
$mrno=$explode[1];
//echo $orderno;exit;


$query="SELECT id,order_no,trans_date,mode,cardno,paid  FROM ".$prefix2."order_payment WHERE money_receipt_no=$mrno";
//echo $query;exit;
$result=mysqli_query($linkid,$query);
$getdata=mysqli_fetch_row($result);
$orderid=$getdata[1];

//$query="SELECT * FROM ".$prefix."accounts_journal WHERE id=$vid";
$query="SELECT order_no,reference,ord_date,contact_phone,contact_email,deliver_to,delivery_date,total,b.name,b.address FROM ".$prefix."sales_orders AS a,".$prefix."debtors_master AS b WHERE a.debtor_no=b.debtor_no  AND a.order_no=$orderid";
//echo $query;exit;
$resultType=mysqli_query($linkid,$query);
$orderData=mysqli_fetch_array($resultType);



$query="SELECT stk_code,unit_price,quantity,long_description FROM ".$prefix."sales_order_details AS a,".$prefix."stock_master AS b WHERE a.stk_code=b.stock_id AND a.order_no=$orderid";
$resultOrder=mysqli_query($linkid,$query);



/*...................................input by user name..........................................*/



?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>MONERY RECEIPT CONFIRMATION</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- Bootstrap framework -->
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" href="bootstrap/css/bootstrap-responsive.min.css" />
<link rel="stylesheet" href="css/print.css" type="text/css" media="print" />
<link rel="shortcut icon" href="img/favicon.ico" />
<style type="text/css">

.tableborder { border-collapse: collapse; border : 1px solid #CCC; }

.tableborder td,th { border-left: 1px solid #CCC; }

.tableborder th { border-bottom: 1px solid #CCC; }

.tableborder td:first-child { border-left: none; }

</style>
</head>
<body>
<!--<div>&nbsp;</div>-->
<div>&nbsp;</div>
<table width="85%" border="1" align="center" style="border:1px #999 dotted;font-size:12px">
  <tr>
    <td><table width="98%" border="0" align="center">
        <tr>
          <td colspan="2" align="left"><h4 class="heading">MONERY RECEIPT</h4></td>
        </tr>
        <tr>
          <td width="50%" align="left"><table width="100%" border="0">
              <tr>
                <td colspan="2"><strong>No. : </strong><?php echo "SS01-MR-".$mrno;?></td>
                <td width="41%"><strong>Date :</strong> <?php echo $getdata[2];?></td>
              </tr>
              <tr>
                <td width="50%"><strong>Customer Name</strong> </td>
                <td width="9%">:</td>
                <td><?php echo $orderData['name'];?></td>
              </tr>
              <tr>
                <td><strong>Address</strong></td>
                <td>:</td>
                <td><?php echo $orderData['address'];?></td>
              </tr>
              <tr>
                <td><strong>Contact No</strong> </td>
                <td>:</td>
                <td><?php echo $orderData['contact_phone'];?></td>
              </tr>
              <tr>
                <td><strong>Sales Person</strong></td>
                <td>:</td>
                <td><?php echo $name;?></td>
              </tr>
      
            </table></td>
          <td width="50%" align="right">&nbsp;</td>
        </tr>
        <tr>
          <td colspan="2">&nbsp;</td>
        </tr>
        <tr>
          <td colspan="2"><table width="100%" class="tableborder">
              <tr>
                <th align="left"><strong>Description </strong></th>
                <th align="right"><strong>Amount(Tk.)</strong></th>
              </tr>
              <tr>
                <td align="left" valign="top">Received with thanks as part/full payment against
				<p>Profit Center Day Collection  :SR01</p>
				<p>Profit Center Customer  :SR01</p>
				<p>Order/Bill No :RETAIL</p>
				</td>
                <td align="right" valign="top"><?php echo $getdata[5];?></td>
              </tr>
			   <tr>
                <td align="left" valign="top">Mode of Payment  : <?php echo $getdata[3];?> -  <?php echo $getdata[4];?> </td>
                <td align="right" valign="top"></td>
              </tr>
			              
              <tr style="border-top: 1px solid #CCC;">
                <td align="right"><b>Total</b></td>
                <td align="right"><strong><?php echo number_format($getdata[5],2);?></strong></td>
              </tr>             
            </table></td>
        </tr>
        <tr>
          <td colspan="2" align="left"><b>Amount In Words :</b>
            <?php  $num =$getdata[5];

 $test = convertNumber($num);

 echo ucwords($test)." Only";?>
          </td>
        </tr>
        <tr>
          <td colspan="2" valign="top"><table width="100%" border="0">
              
              <tr>
                <td colspan="2"><br>
                  <strong>Terms & Conditions</strong> : This receipt is valid subject to realization of the cheque/DD/Payorder.</td>
              </tr>
              <tr>
                <td colspan="2"><table width="100%" border="0">
                    <tr>
                      <!--<td><br>
                        ....................................................<br>
                        <strong>Customer's Signature</strong></td>-->
                      <td align="center"><br><b><?php echo $name;?></b><br>
                        ....................................................<br>
                        <strong>Prepared by :  </b></strong></td>
                      <td align="center"><br>
                        ....................................................<br>
                        <strong>Received by: </strong></td>
                    </tr>
                  </table></td>
              </tr>
            </table></td>
        </tr>
      </table></td>
  </tr>
</table>
</body>
</html>
