<?php session_start();
include('../accesscheck2.php');
require_once('../Connections/courier.php'); 

$process_claim_no = $_GET['num'];
$receiptno = $_GET['receipt'];
$typeofvisit = $_GET['visit'];
$patient_no = $_GET['patient_no'];
$currency = "GHS";
$print_options = $_GET['print_options'];

if (count($print_options) > 0) {
    foreach ($print_options as $print_option) {
        $receipt_no_qry .= "receipt_number=" . $print_option . ' OR ';
        $receipt_text .= $print_option.' & ';
    }
} else {
    $receipt_no_qry = "receipt_number=" . $receiptno . ' OR ';
    $receipt_text .= $receiptno.' & ';
}

$receipt_no_qry = substr($receipt_no_qry, 0, -4);
$receipt_text = substr($receipt_text, 0,-3);

if ($typeofvisit != 'Guest') {
    $query_claim = "select * from claims_details where process_claim_no='$process_claim_no' and ($receipt_no_qry) order by id desc;";
    $patient_info = mysql_fetch_assoc(mysql_query("SELECT * FROM patient_information WHERE card_number='$patient_no'"));
} else {
    $query_claim = "select * from claims_details where process_claim_no='$process_claim_no' and ($receipt_no_qry) order by id desc;";
    $patient_info = mysql_fetch_assoc(mysql_query("SELECT * FROM guest_patients WHERE card_number='$patient_no'"));
}



?>


<head>
        <meta charset="utf-8" />
        <title> Receipt Print Out </title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta content="width=device-width, initial-scale=1" name="viewport" />
        <meta content="" name="description" />
        <meta content="" name="author" />
        <link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=all" rel="stylesheet" type="text/css" />
        <link href="../assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
</head>
<style type="text/css">
    .text-danger strong {
    		color: #9f181c;
		}
		.receipt-main {
			background: #ffffff none repeat scroll 0 0;
			border-bottom: 12px solid #333333;
			border-top: 12px solid #9f181c;
			margin-top: 50px;
			margin-bottom: 50px;
			padding: 40px 30px !important;
			position: relative;
			box-shadow: 0 1px 21px #acacac;
			color: #333333;
			font-family: open sans;
		}
		.receipt-main p {
			color: #333333;
			font-family: open sans;
			line-height: 1.42857;
		}
		.receipt-footer h1 {
			font-size: 15px;
			font-weight: 400 !important;
			margin: 0 !important;
		}
		.receipt-main::after {
			background: #414143 none repeat scroll 0 0;
			content: "";
			height: 5px;
			left: 0;
			position: absolute;
			right: 0;
			top: -13px;
		}
		.receipt-main thead {
			background: #414143 none repeat scroll 0 0;
		}
		.receipt-main thead th {
			color:#fff;
		}
		.receipt-right h5 {
			font-size: 16px;
			font-weight: bold;
			margin: 0 0 7px 0;
		}
		.receipt-right p {
			font-size: 12px;
			margin: 0px;
		}
		.receipt-right p i {
			text-align: center;
			width: 18px;
		}
		.receipt-main td {
			padding: 9px 20px !important;
		}
		.receipt-main th {
			padding: 12px 15px !important;
		}
		.receipt-main td {
			font-size: 13px;
			font-weight: initial !important;
		}
		.receipt-main td p:last-child {
			margin: 0;
			padding: 0;
		}	
		.receipt-main td h2 {
			font-size: 20px;
			font-weight: 900;
			margin: 0;
			text-transform: uppercase;
		}
		.receipt-header-mid .receipt-left h1 {
			font-weight: 100;
			margin: 34px 0 0;
			text-align: right;
			text-transform: uppercase;
		}
		.receipt-header-mid {
			margin: 24px 0;
			overflow: hidden;
		}
		
		#container {
			background-color: #dcdcdc;
		}
</style>



<div class="container">
	<div class="row">
		
        <div class="receipt-main col-xs-10 col-sm-10 col-md-6 col-xs-offset-1 col-sm-offset-1 col-md-offset-3">
            <div class="row">
    			<div class="receipt-header">
					<div class="col-xs-6 col-sm-6 col-md-6">
						<div class="receipt-left">
							<img class="img-responsive" src="../images/app_pics/rns_logo.jpeg" style="width: 71px;">
						</div>
					</div>
					<div class="col-xs-6 col-sm-6 col-md-6 text-right">
						<div class="receipt-right">
							<h5>ROBERT AND SON LTD.</h5>
							<p>+233034789/09678909 <i class="fa fa-phone"></i></p>
							<p>INFO@ROBERTANDSON.COM <i class="fa fa-envelope-o"></i></p>
							<p>ADABRAKA BRANCH <i class="fa fa-location-arrow"></i></p>
						</div>
					</div>
				</div>
            </div>
			
			<div class="row">
				<div class="receipt-header receipt-header-mid">
					<div class="col-xs-8 col-sm-8 col-md-8 text-left">
						<div class="receipt-right">
							<h5> <?php echo $patient_info['othernames'].' '.$patient_info['surname']; ?> <small>  |   Visit No : <?php echo $process_claim_no; ?> </small></h5>
							<p><b>Mobile :</b> <?php echo $patient_info['tel']; ?> </p>
                                                        <p><b>Email :</b> <?php if(!empty($patient_info['email'])){echo $patient_info['email'];}else{echo 'N/A';} ?></p>
							<p><b>Visit No. :</b> <?php echo $process_claim_no; ?></p>
							<p><b>Receipt #. :</b> <?php echo $receipt_text; ?></p>
						</div>
					</div>
					<div class="col-xs-4 col-sm-4 col-md-4">
						<div class="receipt-left">
							<h1>Receipt</h1>
						</div>
					</div>
				</div>
            </div>
			
            <div>
                <table class="table table-bordered">
                    <thead>
                        <tr>
                            <th>Description</th>
                            <th>Price</th>
                            <th>Qty</th>
                            <th>Amount</th>
                        </tr>
                    </thead>
                    <tbody>
                        <?php 
                        if($total_count > 0){
                            while($row = mysql_fetch_assoc($query_claim)){ ?>
                        <tr>
                            <td class="col-md-7"> <?php echo $row['item'];?> </td>
                            <td class="col-md-1"><i class="fa fa-inr"></i> <?php echo number_format($row['unit_price'],2);?> </td>
                            <td class="col-md-1"><i class="fa fa-inr"></i> <?php echo $row['qty']; ?> </td>
                            <td class="col-md-3"><i class="fa fa-inr"></i> <?php echo number_format($row['qty']*$row['unit_price'],2);?> </td>
                        </tr>
                        <?php } } ?>
                        <tr>
                            <td class="text-right" colspan="3">
                            <p>
                                <strong>Total Amount: </strong>
                            </p>
                            <p>
                                <strong>Late Fees: </strong>
                            </p>
							<p>
                                <strong>Payable Amount: </strong>
                            </p>
							<p>
                                <strong>Balance Due: </strong>
                            </p>
			    </td>
                                                        <td colspan="">
                            <p>
                                <strong><i class="fa fa-inr"></i> 65,500/-</strong>
                            </p>
                            <p>
                                <strong><i class="fa fa-inr"></i> 500/-</strong>
                            </p>
							<p>
                                <strong><i class="fa fa-inr"></i> 1300/-</strong>
                            </p>
							<p>
                                <strong><i class="fa fa-inr"></i> 9500/-</strong>
                            </p>
							</td>
                        </tr>
                        <tr>
                           
                            <td class="text-right" colspan="3"><h2><strong>Total: </strong></h2></td>
                            <td class="text-left text-danger"><h2><strong><i class="fa fa-inr"></i> 31.566/-</strong></h2></td>
                        </tr>
                    </tbody>
                </table>
            </div>
			
			<div class="row">
				<div class="receipt-header receipt-header-mid receipt-footer">
					<div class="col-xs-8 col-sm-8 col-md-8 text-left">
						<div class="receipt-right">
							<p><b>Date :</b> 15 Aug 2016</p>
							<h5 style="color: rgb(140, 140, 140);">Thank you for your business!</h5>
						</div>
					</div>
					<div class="col-xs-4 col-sm-4 col-md-4">
						<div class="receipt-left">
							<h1>Signature</h1>
						</div>
					</div>
				</div>
            </div>
			
        </div>    
	</div>
</div>