281 lines
6.1 KiB
PHP
281 lines
6.1 KiB
PHP
<?php
|
|
|
|
|
|
$inv_id = $_GET['inv_id'];
|
|
if (empty($inv_id)) {
|
|
$booking_id = $_GET['book_id'];
|
|
$get_invoices_has_book_sql = mysqli_query($db,
|
|
"SELECT `invoices_id` FROM `invoices_has_book` WHERE `book_id` = $booking_id LIMIT 1"
|
|
);
|
|
|
|
$invoices_has_book_row = mysqli_fetch_assoc($get_invoices_has_book_sql);
|
|
$inv_id = $invoices_has_book_row['invoices_id'];
|
|
}
|
|
|
|
|
|
|
|
$get_book_id_sql = mysqli_query($db,
|
|
"SELECT `book_id` FROM `invoices_has_book` WHERE `invoices_id` = $inv_id LIMIT 1"
|
|
);
|
|
$book_id_row = mysqli_fetch_assoc($get_book_id_sql);
|
|
$book_id = $book_id_row['book_id'];
|
|
|
|
$get_tretment_sql = mysqli_query($db,
|
|
"SELECT
|
|
`tretment`.`name`,
|
|
`tretment`.`number`
|
|
|
|
FROM `book`
|
|
LEFT JOIN `tretment` ON `book`.`tretment_id` = `tretment`.`id`
|
|
WHERE `book`.`id` = $book_id"
|
|
);
|
|
$tretment_row = mysqli_fetch_assoc($get_tretment_sql);
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>طباعة الفاتورة</title>
|
|
|
|
<!-- Normalize or reset CSS with your favorite library -->
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/7.0.0/normalize.min.css">
|
|
|
|
<!-- Load paper.css for happy printing -->
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/paper-css/0.3.0/paper.css">
|
|
|
|
<!-- Custom styles for this document -->
|
|
<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; }
|
|
/*
|
|
@media print{
|
|
div#display {
|
|
display: flex;
|
|
height: auto;
|
|
width: 100%;
|
|
align-items: center;
|
|
}
|
|
}
|
|
*/
|
|
</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> : مركز اقدامي النسائي</div>
|
|
<div class="mo_border"><b>الرقم الضريبي</b> : <?=$campany_info['vat_number']?></div>
|
|
<div class="mo_border" style="display: flex;justify-content: space-between;"><span><b>الموظف</b> : رؤى </span></div>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td colspan="4" height="25px" align="center">
|
|
</td>
|
|
</tr>
|
|
</tbody></table>
|
|
|
|
<div style="text-align: center;">
|
|
<h1>فاتورة ضريبية مبسطة</h1>
|
|
<h3>Simplified Tax Invoice</h3>
|
|
</div>
|
|
|
|
<table width="100%" border="0">
|
|
<tbody>
|
|
<tr>
|
|
<td colspan="4" 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>22B000231</b></td>
|
|
<td class="mo_border"><?=date('d-m-y', strtotime($date_time))?></td>
|
|
<td class="mo_border"><?=date((date("H", strtotime($date_time)) > 11) ? 'h:i \م' : 'h:i \ص', strtotime($date_time))?></td>
|
|
<td class="mo_border"><?=$tretment_row['name']?></td>
|
|
<td class="mo_border">0<?=$tretment_row['number']?></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="35%"><b>نوع الخدمة</b></td>
|
|
<td class="mo_border" width="25%"><b>الإجمالي شامل الضريبة</b></td>
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
<td class="mo_border">1</td>
|
|
<td class="mo_border">باقة 4 جلسات اقدام</td>
|
|
<?php
|
|
if (!empty($vat)) {
|
|
?>
|
|
<td class="mo_border">500</td>
|
|
<?php
|
|
}
|
|
?>
|
|
</tr>
|
|
|
|
|
|
<tr>
|
|
<td class="mo_border"></td>
|
|
<td class="mo_border">الإجمالي</td>
|
|
<?php
|
|
if (!empty($vat)) {
|
|
?>
|
|
<td class="mo_border"><?=round(($total - $total_des) + (($total - $total_des)*$vat/100),2)?></td>
|
|
<?php
|
|
}
|
|
?>
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
<td colspan="4" height="75px" align="center">
|
|
</td>
|
|
</tr>
|
|
|
|
|
|
|
|
<?php
|
|
/*
|
|
* QR Encoding Functions
|
|
*/
|
|
|
|
function __getLength($value) {
|
|
return strlen($value);
|
|
}
|
|
|
|
function __toHex($value) {
|
|
return pack("H*", sprintf("%02X", $value));
|
|
}
|
|
|
|
function __toString($__tag, $__value, $__length) {
|
|
$value = (string) $__value;
|
|
return __toHex($__tag) . __toHex($__length) . $value;
|
|
}
|
|
|
|
function __getTLV($dataToEncode) {
|
|
$__TLVS = '';
|
|
for ($i = 0; $i < count($dataToEncode); $i++) {
|
|
$__tag = $dataToEncode[$i][0];
|
|
$__value = $dataToEncode[$i][1];
|
|
$__length = __getLength($__value);
|
|
$__TLVS .= __toString($__tag, $__value, $__length);
|
|
}
|
|
|
|
return $__TLVS;
|
|
}
|
|
|
|
|
|
|
|
$dataToEncode = [
|
|
[1, $campany_info['company_name']],
|
|
[2, $campany_info['vat_number']],
|
|
[3, date("Y-m-d\TH:i:s",strtotime($invoices_row['date_time']))],
|
|
[4, round(($total - $total_des) + (($total - $total_des)*$vat/100),2)],
|
|
[5, round((($total - $total_des)*$vat/100),2)]
|
|
];
|
|
|
|
$__TLV = __getTLV($dataToEncode);
|
|
$__QR = base64_encode($__TLV);
|
|
|
|
?>
|
|
|
|
<td colspan="4" align="center" height="35px">
|
|
<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>
|
|
<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>
|