<?php 
$ref_name ="";
$ref_date = "";
$ref_payment_type_desc ="";
$paymentInfoShow = "";
$sqlPaymentInfo = "select payments.id, payments_paymenttype_bridge.ref_no, payment_type.payment_type_desc from payments 
				inner join payments_paymenttype_bridge on payments.id = payments_paymenttype_bridge.payment_id
				inner join payment_type on payments_paymenttype_bridge.payment_type_id = payment_type.id where payments.id = $payment_id
				";
$runPaymentInfo = mysqli_query($link, $sqlPaymentInfo);
if($runPaymentInfo === FALSE){
	die(mysqli_error($link));
}
$countRowPaymentInfo = mysqli_num_rows($runPaymentInfo);
if($countRowPaymentInfo == 1 ){
	$resultPaymentInfo = mysqli_fetch_assoc($runPaymentInfo);
	$payment_type_desc = $resultPaymentInfo["payment_type_desc"];
	$ref_no = $resultPaymentInfo["ref_no"];
	if($payment_type_desc != 'Cash'){
		$paymentInfoShow = "(". $payment_type_desc . "-Ref. No: " . $ref_no .")";
		$paymentInfoShow_refNo_split =  explode("-", $ref_no);
		$ref_name = $paymentInfoShow_refNo_split[0];
        $ref_date = $paymentInfoShow_refNo_split[1];
        $ref_payment_type_desc = $payment_type_desc . "-Ref. No: ";
	}
	
}
/* if(strpos($info, 'payment') !== false)
		$paymentInfoShow = "(". $payment_type_desc . "-Ref. No: " . $ref_no .")"; */
?>