| Server IP : 46.202.172.170 / Your IP : 216.73.216.59 Web Server : LiteSpeed System : Linux fr-int-web1904.main-hosting.eu 5.14.0-503.34.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Mar 27 06:00:50 EDT 2025 x86_64 User : u627918583 ( 627918583) PHP Version : 8.2.28 Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail MySQL : OFF | cURL : ON | WGET : ON | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /home/u627918583/domains/techtime-om.com/public_html/controlPanel/ |
Upload File : |
<?php
include 'Database.php';
$db = new Database();
$user = $_GET['id'];
$query = "SELECT * FROM `orders` WHERE user = '$user'";
$result = $db->dbQuery($query);
if($db->dbNumRows( $result)){
$rows = $db->dbFetchResult($result);
foreach($rows as $row){
$name = $row['name'];
$whatsapp = $row['whatsapp'];
$addres = $row['country'] .'-'. $row['city'] .'-'. $row['neighborhood_name'];
$payment = $row['FirstBatch'];
$first_batch = $row['Installment'] != 0 ? $row['Installment']: 'نقدا';
$coin = $row['coin'];
}
}
$item = '';
if ($coin == 'kw') {
$item = 'د.ك';
}elseif ($coin == 'qa') {
$item = 'ر.ق';
}elseif ($coin == 'om') {
$item = 'ر.عُ';
}elseif ($coin == 'sa') {
$item = 'ر.س';
}elseif ($coin == 'ae') {
$item = 'د.إ';
}
$query = "SELECT * FROM users WHERE id = 1";
$result = $db->dbQuery($query);
if($db->dbNumRows( $result)){
$rows = $db->dbFetchResult($result);
foreach($rows as $row){
if ($coin == 'kw') {
$Whatsapp = $row['Whatsapp_kw'];
}elseif ($coin == 'qa') {
$Whatsapp = $row['Whatsapp_qa'];
}elseif ($coin == 'om') {
$Whatsapp = $row['Whatsapp_om'];
}elseif ($coin == 'sa') {
$Whatsapp = $row['Whatsapp'];
}elseif ($coin == 'ae') {
$Whatsapp = $row['Whatsapp_ae'];
}
$email = $row['email'];
}
}
$query = "SELECT * FROM `website` WHERE `id` = 1";
$result = $db->dbQuery($query);
if($db->dbNumRows( $result)){
$rows = $db->dbFetchResult($result);
foreach($rows as $row){
$name_site = $row['name_site'];
$name_site_E = $row['name_site_E'];
$link = $row['link'];
$logo = $row['logo'];
$seal = $row['seal'];
}
}
$currentDate = date('Y/m/d');
?>
<html lang="ar" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>فاتورة بيع ضربية</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/html2pdf.js/0.10.1/html2pdf.bundle.min.js"></script>
<script>
function pafD(){
let filePDF = this.document.getElementById('main');
html2pdf().from(filePDF).save();
setTimeout(function() {
window.history.back();
}, 1000);
}
</script>
<style>
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@200;300;400;500;700;800;900&display=swap');
*{
padding: 0;
margin: 0;
box-sizing: border-box;
font-family: 'Tajawal', sans-serif;
font-size: 10px;
}
:root
{
--main-color:#643543
}
body
{
padding: 20px;
--main-color:#000
}
.page_invoce
{
/* width: 550px; */
margin: 0 auto;
height: auto;
background-color: #fff;
padding: 10px 20px;
}
.Heading_info img
{
width: 50px;
}
.flex
{
display: flex;
align-items: center;
justify-content: space-between;
}
.center
{
display: flex;
align-items: center;
gap: 10px;
}
.NameSite , .Date
{
color: var(--main-color);
font-weight: bold;
font-size: 15px;
}
.info_customer
{
margin-top: 20px;
border: 1px solid #989898;
padding: 15px 10px;
border-radius: 10px;
}
.info_customer span , .text_info_table span
{
color:#777;
font-weight: bold;
}
.info_customer div , .text_info_table div
{
color: var(--main-color);
font-weight: bold;
}
.table table
{
margin-top: 15px;
border-collapse: collapse;
width: 100%;
}
.table table thead tr
{
background-color: var(--main-color);
color: #fff;
}
.table table thead tr th
{
padding: 7px;
}
.table table thead tr th
{
background-color: #1fa2d8;
color: #fff;
height: 25px;
padding: 0 5px;
}
tbody tr
{
background-color: #e3e3e3;
color: var(--main-color);
font-size: 17px;
border-top: 1px solid #fff;
}
tbody tr td
{
padding: 7px;
text-align: center;
}
tbody tr:nth-child(even)
{
background-color: #f2f2f2;
}
footer
{
padding: 10px;
background-color: var(--main-color) !important;
margin-top: 10px;
}
footer div
{
color: #fff;
}
#printButton {
padding: 10px 20px;
background-color: #3498db;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
}
#printButton:hover {
background-color: #2980b9;
}
</style>
</head>
<body>
<!-- <pre></pre> -->
<!-- <button onclick="pafD()" style="width: 100px; height: 40px; background-color: #00a8ff; border: 1px solid; color: #ffffff; font-size: 15px;">تحميل</button> -->
<button id="printButton">فاتورة</button>
<div id="main" style="padding: 5px;">
<div class="page_invoce" style="border: 1px solid #000;border-radius: 10px;padding: 30px;">
<div class="Heading_info flex">
<div class="Logo center"><span class="NameSite"><?= $name_site ?></span> </div>
<div class="Logo center"><img style="width: 100px;" src="../BEqq/<?= $logo ?>"></div>
<div class="Logo center"><span class="NameSite"><?= $name_site_E ?></span> </div>
</div>
<div class="info_customer flex" style="align-items: flex-start;">
<div class="info_cus">
<div style="color: #f00;"><span>رقم الفاتورة : </span> <?= $user?># </div>
<div><span>اسم العميل : </span> <?= $name ?> </div>
<div><span>رقم الهاتف : </span> <?= $whatsapp ?> </div>
</div>
<div class="info_cus">
<div style="text-align: right;"><span>التاريخ : </span> <?= $currentDate ?></div>
<div style="text-align: right;"><span>العنوان : </span> <?= $addres ?> </div>
</div>
</div>
<hr style="margin-top: 10px;">
<div class="table" style="margin-top: 10px;">
<h4 style="text-align: center;">تفاصيل الطلب</h4>
<div class="table_Res">
<table>
<thead>
<tr>
<th>#</th>
<th>اسم المنتج </th>
<th>الكمية</th>
<th>السعر</th>
</tr>
</thead>
<tbody>
<?php
$totel_price = 0;
$query = "SELECT product_id,quantity,color_id FROM `cart` WHERE user = $user";
$result = $db->dbQuery($query);
$count = 0;
if($db->dbNumRows( $result)){
$rows = $db->dbFetchResult($result);
foreach($rows as $row){
$product_id = $row['product_id'];
$color_id = $row['color_id'];
$query = "SELECT * FROM `products` WHERE id = $product_id";
$result = $db->dbQuery($query);
if($db->dbNumRows($result)){
$rows = $db->dbFetchResult($result);
foreach($rows as $rowp){
$count += 1;
if ($coin == 'kw') {
if ($rowp['decPrice_kw'] == 0) {
$totel_price += $rowp['price_kw'];
}else {
$totel_price += $rowp['decPrice_kw'];
}
}elseif ($coin == 'qa') {
if ($rowp['decPrice_qa'] == 0) {
$totel_price += $rowp['price_qa'];
}else {
$totel_price += $rowp['decPrice_qa'];
}
}elseif ($coin == 'om') {
if ($rowp['decPrice_om'] == 0) {
$totel_price += $rowp['price_om'];
}else {
$totel_price += $rowp['decPrice_om'];
}
}elseif ($coin == 'sa') {
if ($rowp['decPrice'] == 0) {
$totel_price += $rowp['price'];
}else {
$totel_price += $rowp['decPrice'];
}
}elseif ($coin == 'ae') {
if ($rowp['decPrice_ae'] == 0) {
$totel_price += $rowp['price_ae'];
}else {
$totel_price += $rowp['decPrice_ae'];
}
}
?>
<tr>
<td><?= $count ?></td>
<?php
if ($rowp['subclass'] == 'الايفون') {
$query = "SELECT * FROM `colors` WHERE id = $color_id";
$result = $db->dbQuery($query);
if($db->dbNumRows($result)){
$rowd = $db->dbFetchResult($result);
foreach($rowd as $rowg){ ?>
<td> <?= $rowp['name'] . ' اللون ' . $rowg['color'] ?> </td>
<?php }
}
}else { ?>
<td> <?= $rowp['name'] ?> </td>
<?php }
?>
<td> <?= $row['quantity'] ?> </td>
<td>
<?php
if ($coin == 'kw') {
echo $rowp['decPrice_kw'] == 0 ? $rowp['price_kw'] : $rowp['decPrice_kw'];
}elseif ($coin == 'qa') {
echo $rowp['decPrice_qa'] == 0 ? $rowp['price_qa'] : $rowp['decPrice_qa'];
}elseif ($coin == 'om') {
echo $rowp['decPrice_om'] == 0 ? $rowp['price_om'] : $rowp['decPrice_om'];
}elseif ($coin == 'sa') {
echo $rowp['decPrice'] == 0 ? $rowp['price'] : $rowp['decPrice'];
}elseif ($coin == 'ae') {
echo $rowp['decPrice_ae'] == 0 ? $rowp['price_ae'] : $rowp['decPrice_ae'];
}
?>
</td>
</tr>
<?php }
}
}
}
?>
</tbody>
</table>
</div>
</div>
<div class="table" style="margin-top: 10px;">
<div class="text_info_table flex" style="align-items: flex-start;">
<div>
<div style="text-align: right;"><span>مدة الأقساط : </span> <?php
if ($first_batch == 'نقدا') {
echo $first_batch;
}elseif ($first_batch <= 10 AND $first_batch != 'نقدا') {
echo $first_batch .' أشهر';
}elseif ($first_batch > 10) {
echo $first_batch .' شهر';
}
?> </div>
<div style="text-align: right; color: #f00"><span>المبلغ الكلي : </span> <?= $payment ?> <?= $item; ?> + مصاريف الشحن</div>
</div>
<div>
<div style="text-align: right;"><span>الدفعة الأولى : </span> <?= $first_batch == 'نقدا' ? $payment : $payment / $first_batch; ?> <?= $item; ?></div>
<div style="text-align: right;"><span>الختم : </span> </div>
</div>
</div>
</div>
<div class="table" style="margin-top: 10px;">
<div>
<div style="text-align: left;"><img style="width: 100px;margin: -10px 10px;transform: rotate(-20deg);" src="img/<?= $seal ?>"> </div>
</div>
</div>
<div class="info_customer flex" style="align-items: flex-start;">
<div class="info_cus" style="border-left: 1px solid #919191;width: 50%;">
<div><span>التوصيل خلال 24 ساعة من تاريخ الفاتورة</span></div>
</div>
<div class="info_cus" style="width: 50%;">
<div style="text-align: left;"><span>Ihave recived the above devive in good<br>
condition with all collected accessories
</span></div>
</div>
</div>
</div>
<br>
<hr>
<footer class="flex">
<div>
<span> <?= $Whatsapp ?> </span>
</div>
<div>
<span> <?= $email ?> </span>
</div>
</footer>
<!-- <div> -->
</div>
<script>
let tbody = document.querySelector(".Table_Tackset table tbody");
let ini = document.getElementById("by").value;
let firstpay = document.getElementById("firstpay").value;
let toatl = document.getElementById("toatl").value;
let cur = document.getElementById("cur").value;
let Resultpay = parseFloat(toatl) - parseFloat(firstpay);
let valFirstpay = Resultpay / ini;
let numpay = 1;
var Toatalpay = parseFloat(firstpay);
var d = new Date();
for(let x = 0 ; x <ini ; x++ )
{
Toatalpay+=valFirstpay;
d.setMonth(d.getMonth() + 1);
var strDate = d.getFullYear() + "/" + (d.getMonth()+1) + "/" + d.getDate();
let temp = `<tr> <td>الدفعة ${x + 1}</td> <td>${strDate}</td> <td>${valFirstpay.toFixed(2)}</td> <td class = "Toatl">${Toatalpay.toFixed(2)}</td> </tr>`;
tbody.innerHTML += temp;
}
</script>
<script>
// تعريف الوظيفة التي سيتم تنفيذها عند النقر على الزر
function printInvoice() {
window.print(); // يطبع الصفحة الحالية
}
// الحصول على الزر
const printButton = document.getElementById('printButton');
// إضافة استماع للنقر على الزر لتنفيذ الوظيفة
printButton.addEventListener('click', printInvoice);
</script>
</body>
</html>