<?php
/**
 * Created by PhpStorm.
 * User: sunusi
 * Date: 2019-02-01
 * Time: 14:35
 */

if (isset($URL[2])) {
    $id = $URL[2];
    $patientId = $URL[1];
    if (!empty($id)) {
        //detecting patient details
        $receipt = $query->getOne("

            SELECT udut_payments.*,
                   udut_visits.*,
                   udut_payments_status.*,
                   udut_scan_types.*,
                   udut_payments_types.*
            FROM udut_payments
            JOIN udut_visits
            ON udut_payments.paymentId = udut_visits.paymentId 
            JOIN udut_payments_status
            ON udut_payments.paymentStatusId = udut_payments_status.paymentStatusId
            JOIN udut_payments_types
            ON udut_payments.paymentTypeId = udut_payments_types.paymentTypeId
            JOIN udut_scan_types
            ON udut_payments.typeId = udut_scan_types.typeId
            WHERE udut_payments.patientId = '" . $patientId . "' AND udut_payments.paymentId = '" . $id . "'    
          
        ");

        $receiptNo = str_pad($receipt['paymentId'], 7, "0", STR_PAD_LEFT);

    } else {
        require path() . "about-patient";
    }
}

