<?php
include '../include/ini_set.php'; include '../include/data_config.php'; ?>
<?php include '../include/webconfig.php';?>
<?php include "../language/{$webConfig["LANG"]}.php";?>
<?php  $webName = $webConfig["webName"]; $webLogo = "../uploads/".$webConfig["webLogo"]; $replyTo = $webConfig["replyTo"]; $webLink = $_SERVER["SERVER_NAME"]; if(!empty($webConfig["webLink"])){ $webLink = $webConfig["webLink"]; } ?>
<?php
$id= $_GET['id']; $id = preg_replace("/[^0-9]/", "", "$id"); $sql = "SELECT gateway_response, payment_method, id,service_id,amount,phone,email,status,fee,reg_date FROM recharge WHERE id ='$id'"; $result = $conn->query($sql); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { $id = $row["id"]; $amount = $row["amount"]; $phone = $row["phone"]; $paymentMethod = $row["payment_method"]; $serviceId = $row["service_id"]; $email = $row["email"]; $status = $row["status"]; $fee = $row["fee"]; $regDate = $row["reg_date"]; $gatewayResponse = $row["gateway_response"]; } } ?>
<?php  $sql = "SELECT display_name, image FROM service WHERE id='$serviceId' OR name = '$serviceId'"; $result = $conn->query($sql); if ($result->num_rows > 0) { $serviceValue = $result->fetch_assoc(); }else{ $serviceValue["notFound"] = true; } ?>
<?php
 ?>
<?php
 require('../fpdf181/fpdf.php'); $pdf = new FPDF('P','mm','A4'); $pdf->AddPage(); $pdf->SetFont('Arial','B',10); $logo = "../uploads/service/".$serviceValue["image"]; $barcode = 'https://chart.googleapis.com/chart?chs=300x300&cht=qr&chl='.$webLink.'/transaction/view.php?id='.$id; $y = $pdf->GetY(); $ph = $pdf->GetPageHeight(); $pw = $pdf->GetPageWidth(); $date = date("l, jS F Y  @ h:ma (T) ",$regDate); $pdf->SetDrawColor(34,139,34); $headerSize = $pw/2; $pdf->SetAutoPageBreak(false); $pdf->SetFont('Arial','B',18); $y = $pdf->GetY(); $pdf->MultiCell(170,8, $LANG["payment_receipt"],0,'C'); $pdf->SetFont('Arial','',5); $pdf->SetY($y-1); $pdf->Image($barcode,null,null,40,40,'PNG'); $pdf->Image($logo,$pw-70,10,60,33); $pdf->Image($webLogo,$pw/3,20,60,20); $pdf->SetXY(5,$y-1.5); $pdf->Cell(50,5, strtoupper($LANG["scan_barcode_to_confirm"]) ,0,1,"C"); $pdf->Rect(13.5,12,33,34); $pdf->SetXY(-70,$y+32); $pdf->SetFont('Arial','B',10); $pdf->MultiCell(60, 8, strtoupper("$bene") ,"","C"); $pdf->SetY(47); $y = $pdf->GetY(); $pdf->SetFillColor(34,139,34); $pdf->SetTextColor(255,255,255); $pdf->SetFont('Arial','B',12); $pdf->Cell(0,8, strtoupper($LANG["transaction_details"]),"L,B,T,R",1,"L",true); $pdf->SetTextColor(0,0,0); $pdf->SetFont('Arial','',10); $pdf->Cell($headerSize,8, strtoupper($LANG["transaction_id"]),"L,B,R",0,"L"); $pdf->Cell(0,8,$id,"R,B,T",1,"L"); $pdf->Cell($headerSize,8, strtoupper($LANG["service"]),"L,B,R",0,"L"); $pdf->Cell(0,8,$serviceValue["display_name"],"R,B,T",1,"L"); if(!empty($phone)){ $pdf->Cell($headerSize,8, strtoupper($LANG["phone"]),"L,B,R",0,"L"); $pdf->Cell(0,8,$phone,"R,B",1,"L"); } if(!empty($email)){ $pdf->Cell($headerSize,8, strtoupper($LANG["email"]),"L,R,B",0,"L"); $pdf->Cell(0,8,$email,"R,B",1,"L"); } $pdf->Cell($headerSize,8, strtoupper($LANG["status"]),"L,B,R",0,"L"); $pdf->Cell(0,8,strtoupper($LANG[$status]),"R,B",1,"L"); $pdf->Cell($headerSize,8, strtoupper($LANG["date"]),"L,R,B",0,"L"); $pdf->Cell(0,8,$date,"R,B",1,"L"); $pdf->Cell($headerSize,8, strtoupper($LANG["amount"]),"L,R,B",0,"L"); $pdf->Cell(0,8,$webConfig["currency"]["code"].$amount,"R,B",1,"L"); $pdf->Cell($headerSize,8, strtoupper($LANG["fee"]),"L,R,B",0,"L"); $pdf->Cell(0,8,$webConfig["currency"]["code"].$fee,"R,B",1,"L"); if($paymentMethod == "card"){ $cardFee = $conn->query("SELECT fee FROM guest_payment WHERE transaction_id='$id'")->fetch_assoc()["fee"]; $pdf->Cell($headerSize,8, strtoupper($LANG["card_processing_fee"]),"L,R,B",0,"L"); $pdf->Cell(0,8,$webConfig["currency"]["code"].$cardFee,"R,B",1,"L"); } $gatewayResponse= json_decode($gatewayResponse,true); $sql = "SELECT value, name FROM form WHERE name='system-load-display-value' AND service='$serviceId'"; $result = $conn->query($sql); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { if($row["name"]=="system-load-display-value"){ $displayValueContents = json_decode(file_get_contents($row["value"]),true); if($displayValueContents==null || !is_array($displayValueContents)){ $loadDisplayValue = false; }else{ $loadDisplayValue = true; $displayValue = $displayValueContents; } } } } $sql = "SELECT name, display_name FROM display_value WHERE active='1' AND service='$serviceId'"; $result = $conn->query($sql); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { $displayValue[] = $row; } } if(is_array($displayValue)){ foreach($displayValue as $row){ if(!empty($gatewayResponse[$row["name"]])){ $pdf->Cell($headerSize,8, strtoupper($row["display_name"]),"L,R,B",0,"L"); $pdf->Cell(0,8,$gatewayResponse[$row["name"]],"R,B",1,"L"); } } } $pdf->SetX(100); $pdf->MultiCell(100,5,"\n$webName www.$webLink",0,'R'); $pdf->SetTitle("Receipt-$id"); $pdf->output(); ?>