<?php
define('DOCUMENT_ROOT_CLASS','../');
define('DOCUMENT_ROOT_INC_FOLDER','');
$filepath = realpath(dirname(__FILE__));
require "../inc/header.php";
$msg = Session::get('msg');
Session::set("msg", NULL);
?>
<style type="text/css">
	.select2-container{
		width: 100% !important;
	}
</style>
<style>@page { size: A5;margin-top:0px;margin-bottom:0px; }</style>
    <?php 
        $rand = @$_GET["receipt_id"];
    ?>
    <div class="row">
        <div class="col-sm-12">
            <div class="page-title-box">
                <div class="row">
                    <div class="col">
                        <h4 class="page-title"><?php echo ($_GET['state'] != "list")?"View Payment Voucher":" Payment Voucher List "; ?></h4>
                        <ol class="breadcrumb">
                            <li class="breadcrumb-item"><a href="javascript:void(0);">Generate Payment Voucher</a></li>
                            <li class="breadcrumb-item"><a href="javascript:void(0);"><?php echo ($_GET['state'] != "list")?"$rand":"Payment Voucher"; ?></a></li>
                        </ol>
                    </div><!--end col-->
                    <div class="col-auto align-self-center">
                        <a href="javascript:void(0);" class="btn btn-secondary btn-sm" onclick='printDiv();'>
                            <i class="fas fa-print align-self-center icon-xs"></i> Print
                        </a>
                    	<a href="payment-voucher.php?state=list"><button type="button" class="btn btn-danger btn-sm">Back to Payment Voucher List </button></a>

                        <!-- <button type="button" class="btn btn-primary save_form" id="save_form">
                            <i class="fa fa-save align-self-center icon-xs"></i> Save Payment Voucher
                        </button> -->
                    </div><!--end col-->  
                </div><!--end row-->                                                              
            </div><!--end page-title-box-->
        </div><!--end col-->
    </div><!--end row-->
    <!-- end page title end breadcrumb -->
    <?php if(@$_GET['state'] == "view"): ?>
    <div class="row">
        <div class="col-12">
            <div class="row justify-content-center">
                <div class="col-md-12 col-lg-12" id="DivIdToPrint">
                    <div class="card report-card">
                        <div class="card-body" >
                            <div class="row d-flex justify-content-center">
                                <style type="text/css">
                                    .receipt-logo{ height: 9em; }
                                </style>

                                <table border="0" cellpadding="0" cellspacing="0" style="width:100%;">
                                    <tr>
                                        <?php $orgData = $commonFunctions->getRowData("sys_erp_organaization",""); ?>
                                        <td style="width:30%">
                                            <img src="<?php echo DOCUMENT_ROOT_CLASS;?>uploads/admin-setting/company/<?php echo @$orgData['erp_sys_org_logo'];?>" class="receipt-logo">
                                        </td>
                                        <td>
                                            <h2 style="text-align: center;" ><?php echo @$orgData['erp_sys_org_name'];?></h2>
                                            <h5 style="text-align: center;"><?php echo @$orgData['erp_sys_org_address'];?> <br><?php echo $commonFunctions->getName(@$orgData['erp_sys_org_country'],'sys_erp_adm_countries','label','rowid');?>, <?php echo $orgData['erp_sys_org_city'];?><br>P.O.Box - <?php echo $orgData['erp_sys_org_province'];?></h5>
                                            <h5 style="text-align: center;">CASH/CHEQUE RECEIPT VOUCHER</h5>
                                        </td>
                                        <td style="text-align: right;">
                                            <!-- <h4>Receipt No. <?php echo $rand;?> </h4> -->
                                            <img alt='barcode' src='../lib/barcode.php?codetype=Code128&size=40&text=<?php echo $rand;?>&print=true' style="border: 1px solid;padding-top: 1em;" />
                                            <h4>Date: <?php $date = $commonFunctions->getName(@$_GET["receipt_id"],'fin_accnt_pymt_vchr','CreatedDate','PaymentVoucherNo');
                                            echo date("jS M Y", strtotime($date));
                                            ?></h4>

                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width: 25%;">
                                            <h4>Payment Voucher No. <?php echo $rand;?> </h4>
                                        </td>
                                        <td>
                                            <table border="1" cellpadding="0" cellspacing="0" style="width:100%;">
                                                <tr>
                                                    <td style="width: 25%;padding: 0.3em;"><h4>Amount Paid</h4></td>
                                                    <td style="padding: 0.3em;">
                                                        <h4><?php echo $commonFunctions->getName(@$_GET["receipt_id"],'fin_accnt_pymt_vchr','AmountPaid','PaymentVoucherNo');?> /- QAR</h4>
                                                    </td>
                                                </tr>
                                            </table>
                                            <br>
                                        </td>
                                        <td style="text-align: right;">
                                            
                                        </td>
                                        <!-- <td style="text-align: right;">
                                            <h4>Date: <?php $date = $commonFunctions->getName(@$_GET["receipt_id"],'fin_accnt_pymt_vchr','CreatedDate','PaymentVoucherNo');
                                            echo date("jS M Y", strtotime($date));
                                            ?></h4>
                                        </td> -->
                                    </tr>
                                </table>
                                <table border="2" cellpadding="5" cellspacing="5" style="width:100%;">
                                    <tr>
                                        <td>
                                            <table border="0" cellpadding="0" cellspacing="0" style="width:100%;">
                                                <tr>
                                                    <td style="width:20%;">
                                                        <h4>Customer Name </h4> 
                                                    </td>
                                                    <td colspan="2">
                                                        <h4 style="width: 100%;border-bottom: 2px dotted; text-align: center;"><?php echo $commonFunctions->getName(@$_GET["receipt_id"],'fin_accnt_pymt_vchr','CustomerName','PaymentVoucherNo');?></h4> 
                                                    </td>
                                                    <td style="width:20%;text-align: right;font-size: 20px; font-weight:600;">
                                                        <h4>إسم العميل </h4> 
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="width:20%;">
                                                        <h4>Customer Mobile Number</h4> 
                                                    </td>
                                                    <td colspan="2">
                                                        <h4 style="width: 100%;border-bottom: 2px dotted; text-align: center;"><?php echo $commonFunctions->getName(@$_GET["receipt_id"],'fin_accnt_pymt_vchr','CustomerMobileNumber','PaymentVoucherNo');?></h4> 
                                                    </td>
                                                    <td style="width:20%;text-align: right;font-size: 20px; font-weight:600;">
                                                        <h4>رقم هاتف العميل </h4> 
                                                    </td> 
                                                </tr>
                                                <tr style="display: none;">
                                                    <td style="width:20%;">
                                                        <h4>Membership Number </h4> 
                                                    </td>
                                                    <td colspan="2">
                                                        <h4 style="width: 100%;border-bottom: 2px dotted; text-align: center;"><?php echo $commonFunctions->getName(@$_GET["receipt_id"],'fin_accnt_pymt_vchr','MembershipNumber','PaymentVoucherNo');?></h4> 
                                                    </td>
                                                    <td style="width:20%;text-align: right;font-size: 20px; font-weight:600;">
                                                        <h4>رقم عضوية المشارك</h4> 
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="width:20%;">
                                                        <h4>Amount Paid</h4> 
                                                    </td>
                                                    <td colspan="2">
                                                        <h4 style="width: 100%;border-bottom: 2px dotted; text-align: center;"><?php echo $commonFunctions->getName(@$_GET["receipt_id"],'fin_accnt_pymt_vchr','AmountPaid','PaymentVoucherNo');?></h4> 
                                                    </td>
                                                    <td style="width:20%;text-align: right;font-size: 20px; font-weight:600;">
                                                        <h4>المبلغ</h4> 
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="width:20%;">
                                                        <h4>Payment Type  </h4> 
                                                    </td>
                                                    <td colspan="2">
                                                        <h4 style="width: 100%;border-bottom: 2px dotted; text-align: center;"><?php echo $commonFunctions->getName(@$_GET["receipt_id"],'fin_accnt_pymt_vchr','PaymentType','PaymentVoucherNo');?></h4>  
                                                    </td>
                                                    <td style="width:20%;text-align: right;font-size: 20px; font-weight:600;">
                                                        <h4>نوع الدفع  </h4> 
                                                    </td>
                                                </tr>
                                                <tr style="display: none;">
                                                    <td style="width:20%;">
                                                        <h4>Service Type </h4> 
                                                    </td>
                                                    <td colspan="2">
                                                        <h4 style="width: 100%;border-bottom: 2px dotted; text-align: center;"><?php echo $commonFunctions->getName(@$_GET["receipt_id"],'fin_accnt_pymt_vchr','ServiceType','PaymentVoucherNo');?></h4>  
                                                    </td>
                                                    <td style="width:20%;text-align: right;font-size: 20px; font-weight:600;">
                                                        <h4>الفحص المطلوب </h4> 
                                                    </td>
                                                </tr>
                                                <tr style="display: none;">
                                                    <td style="width:20%;">
                                                        <h4>Appointment Date </h4> 
                                                    </td>
                                                    <td colspan="2">
                                                        <h4 style="width: 100%;border-bottom: 2px dotted; text-align: center;"><?php echo $commonFunctions->getName(@$_GET["receipt_id"],'fin_accnt_pymt_vchr','AppointmentDate','PaymentVoucherNo');?></h4>  
                                                    </td>
                                                    <td style="width:20%;text-align: right;font-size: 20px; font-weight:600;">
                                                        <h4>تاريخ الموعد </h4> 
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td style="width:20%;">
                                                        <h4>Amount Paid Against </h4> 
                                                    </td>
                                                    <td colspan="2">
                                                        <h4 style="width: 100%;border-bottom: 2px dotted; text-align: center;"><?php echo $commonFunctions->getName(@$_GET["receipt_id"],'fin_accnt_pymt_vchr','AmountPaidAgainst','PaymentVoucherNo');?></h4>  
                                                    </td>
                                                    <td style="width:20%;text-align: right;font-size: 20px; font-weight:600;">
                                                        <h4></h4> 
                                                    </td>
                                                </tr>
                                                <tr >
                                                    <td style="width:20%;">
                                                        <h4>Remark </h4> 
                                                    </td>
                                                    <td colspan="2">
                                                        <h4 style="width: 100%;border-bottom: 2px dotted; text-align: center;"><?php echo $commonFunctions->getName(@$_GET["receipt_id"],'fin_accnt_pymt_vchr','Remark','PaymentVoucherNo');?></h4>  
                                                    </td>
                                                    <td style="width:20%;text-align: right;font-size: 20px; font-weight:600;">
                                                        <h4></h4> 
                                                    </td>
                                                </tr>
                                            </table>
                                            <table border="0" cellspacing="0" cellpadding="0" style="width: 100%;">
                                                <tr>
                                                    <td style="width: 20%;text-align: center;"> 
                                                        <br><br><br><h4>Receiver Sign</h4><br><br>
                                                        <h4 style="border-bottom: 3px dotted;"></h4>
                                                    </td>
                                                    <td style="width: 60%;">

                                                    </td>
                                                    <td style="width: 20%;text-align: center;"> 
                                                        <br><br><br><h4>Accountant Sign</h4><br><br>
                                                        <h4 style="border-bottom: 3px dotted;"></h4>
                                                    </td>
                                                </tr>

                                            </table>                
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>  
                <!-- <div class="col-lg-12 col-xl-12">
                    <div class="float-right d-print-none">
                        <button type="button" class="btn btn-primary btn-sm save_form" id="save_form">
                            <i class="fa fa-save align-self-center icon-xs"></i> Save Receipt
                        </button>
                         
                    </div>
                </div>  -->

            </div>
        </div>
    </div>
    <?php endif; ?>
        
<?php require "../inc/footer.php"; ?>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.15.1/jquery.validate.min.js"></script>
<script type="text/javascript">
function printDiv(){
    var printContents = document.getElementById('DivIdToPrint').innerHTML;
    var originalContents = document.body.innerHTML;
    document.body.innerHTML = printContents;
    window.print();
    document.body.innerHTML = originalContents;
}
</script>