262 lines
8.1 KiB
PHP
Executable File

<?php
$id = $_GET['id'];
$get_invoices_sql = mysqli_query($db, "SELECT invoices_back.id, invoices_back.invoice_id, invoices_back.progress, invoices_back.price, invoices_back.how, invoices_back.from_where, invoices_back.account_name, invoices_back.account_number, invoices_back.IBAN, invoices_back.date_time, invoices_back.user_id, invoices_back.date_time_send, booking.id AS booking_id, invoices.discount, tretment.name, tretment.number, services.service, invoices.price, invoices.price_vat
FROM invoices_back
LEFT JOIN invoices ON invoices_back.invoice_id = invoices.id
LEFT JOIN booking ON invoices.booking_id = booking.id
LEFT JOIN tretment ON booking.tretment_id = tretment.id
LEFT JOIN booking_details ON booking_details.booking_id = booking.id
LEFT JOIN services ON booking_details.the_service = services.id
LEFT JOIN user ON invoices.user_id = user.id
WHERE invoices_back.id = $id AND booking_details.date_time IN (SELECT MAX(date_time) FROM booking_details WHERE booking_details.state = 8 OR booking_details.state = 9 GROUP BY booking_id)");
$invoices_row = mysqli_fetch_assoc($get_invoices_sql);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>طلب استرجاع</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/paper-css/0.3.0/paper.css">
<link href="https://fonts.googleapis.com/css?family=Tangerine:700" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="assets/css/mo2_style.css">
<style>
body {
font-family: 'Cairo', sans-serif !important;
}
</style>
<style>
@page { size: A4 }
body { font-size: 21pt; font-weight: 700; }
.mo_border { border-bottom: #000 solid 1px; padding-bottom: 15px; margin-bottom:15px; }
</style>
</head>
<body onload="print_f()" class="A4" dir="rtl" style="margin: 0 320px;">
<section>
<article>
<table width="100%" border="0">
<tbody>
<tr>
<td colspan="4" height="25px" align="center">
</td>
</tr>
<tr>
<td><img src="<?=$campany_info['logo-sm']?>" style="margin-left: 25px;width: 100%;"></td>
<td colspan="3">
<div class="mo_border"><h3><?=$campany_info['company_name']?></h3></div>
<div class="mo_border"><b>الرقم الضريبي</b> : <?=$campany_info['vat_number']?></div>
<div class="mo_border"><b>طريقة الإسترجاع</b> :
<?php
switch ($invoices_row['how']) {
case 0:
echo "كاش";
break;
case 1:
echo "تحويل";
break;
}
?>
</div>
</td>
</tr>
<tr>
<td colspan="4" height="25px" align="center">
</td>
</tr>
</tbody>
</table>
<div style="text-align: center;">
<h1>طلب إسترجاع مبلغ</h1>
<h3>Refund request</h3>
</div>
<table width="100%" border="0">
<tbody>
<tr>
<td colspan="5" height="25px" align="center">
</td>
</tr>
<tr>
<td class="mo_border"><b>رقم الطلب</b></td>
<td class="mo_border"><b>للفاتورة</b></td>
<td class="mo_border"><b>التاريخ</b></td>
<td class="mo_border"><b>العميل</b></td>
<td class="mo_border"><b>جوال العميل</b></td>
</tr>
<tr>
<td class="mo_border"><b><?=$invoices_row['id']?></b></td>
<td class="mo_border"><b><?=$invoices_row['invoice_id']?></b></td>
<td class="mo_border"><?=date('d-m-Y h:i A', strtotime($invoices_row['date_time']))?></td>
<td class="mo_border"><?=$invoices_row['name']?></td>
<td class="mo_border">0<?=$invoices_row['number']?></td>
</tr>
</tbody>
</table>
<table width="100%" border="0">
<tbody>
<tr>
<td colspan="2" height="25px" align="center">
</td>
</tr>
<tr>
<td class="mo_border"><b>اسم صاحب الحساب</b></td>
<td class="mo_border"><b>رقم الحساب</b></td>
</tr>
<tr>
<td class="mo_border"><b><?=$invoices_row['name']?></b></td>
<td class="mo_border"><b><?=$invoices_row['account_number']?></b></td>
</tr>
<tr>
<td colspan="2" class="mo_border" align="center"><b>IBAN</b></td>
</tr>
<tr>
<td colspan="2" class="mo_border" align="center"><b><?=$invoices_row['IBAN']?></b></td>
</tr>
<tr>
<td colspan="2" height="25px" align="center">
</td>
</tr>
</tbody>
</table>
<table width="100%" border="0">
<tbody>
<tr>
<td colspan="4" height="25px" align="center">
</td>
</tr>
<tr>
<td class="mo_border" width="9%"><b>#</b></td>
<td class="mo_border" width="25%"><b>نوع الخدمة</b></td>
<td class="mo_border"><b>السعر</b></td>
<td class="mo_border" width="25%"><b>الإجمالي غير شامل الضريبة</b></td>
</tr>
<?php
if (!empty($invoices_row['discount'])) {
?>
<tr>
<td class="mo_border">1</td>
<td class="mo_border"><?=$invoices_row['service']?></td>
<td class="mo_border"><?=round($invoices_row['price'],2)?></td>
<td class="mo_border"><?=round($invoices_row['price'],2)?></td>
</tr>
<tr>
<td class="mo_border"></td>
<td class="mo_border">خصم</td>
<td class="mo_border">-<?php if(round($invoices_row['price_vat'] + ($invoices_row['price'] - $invoices_row['discount']),2) == 0) {echo round($invoices_row['price'],2);}else {echo round($invoices_row['discount'],2);}?></td>
<td class="mo_border"><?php if(round($invoices_row['price_vat'] + ($invoices_row['price'] - $invoices_row['discount']),2) == 0) {echo 0;}else {echo round($invoices_row['price'] - $invoices_row['discount'],2);}?></td>
</tr>
<?php
} else {
?>
<tr>
<td class="mo_border">1</td>
<td class="mo_border"><?=$invoices_row['service']?></td>
<td class="mo_border"><?=round($invoices_row['price'],2)?></td>
<td class="mo_border"><?=round($invoices_row['price'],2)?></td>
</tr>
<?php
}
?>
<tr>
<td class="mo_border"></td>
<td class="mo_border"></td>
<td class="mo_border">ضريبة القيمة المضافة <br> V.A.T 15%</td>
<td class="mo_border"><?php if(round($invoices_row['price_vat'] + ($invoices_row['price'] - $invoices_row['discount']),2) == 0) {echo 0;}else {echo round($invoices_row['price_vat'],2);}?></td>
</tr>
<tr>
<td class="mo_border"></td>
<td class="mo_border"></td>
<td class="mo_border">الإجمالي شامل ضريبة القيمة المضافة <br></td>
<td class="mo_border">
<b><?=round($invoices_row['price_vat'] + ($invoices_row['price'] - $invoices_row['discount']),2)?> ريال سعودي</b>
</td>
</tr>
<tr>
<td colspan="4" height="75px" align="center">
</td>
</tr>
<?php
$__QR = "https://footcare.cc/print.php?booking_id=" . $invoices_row['booking_id'] . "&canceled=1";
?>
<tr>
<td colspan="4" align="center" height="35px">
<div class="mo_border"><h3>لعرض الفاتورة</h3></div>
<img src="https://chart.googleapis.com/chart?chs=215x215&cht=qr&chl=<?=$__QR?>&chld=L|0&choe=UTF-8" width="215" height="215">
<br>
--- Check Closed ---
</td>
</tr>
<tr>
<td colspan="4" align="center">
<h3>شكراً لزيارتكم</h3>
<h3></h3>
</td>
</tr>
<tr>
<td colspan="4" height="75px" align="center">
</td>
</tr>
<tr>
<td colspan="4" align="center">
<?=$campany_info['link']?>
</td>
</tr>
<tr>
<td style="direction: ltr;" colspan="4" height="35px" align="center">
<?= date('d-m-Y h:i A', strtotime($date_time));?>
</td>
</tr>
</tbody>
</table>
</article>
</section>
<script type="text/javascript">
window.onafterprint = function(e){
closePrintView();
};
function print_f(){
window.print();
}
function closePrintView() {
window.close();
}
</script>
</body>
</html>