| Server IP : 66.29.146.62 / Your IP : 216.73.216.152 Web Server : LiteSpeed System : Linux premium231.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64 User : dokkdzvi ( 925) PHP Version : 8.1.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/dokkdzvi/./www/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'];
$phone = $row['phone'];
$location = $row['location'] .'-'. $row['street'];
$payment = $row['payment'];
$first_batch = $row['first_batch'] != 'نقدا' ? $row['first_batch']: 'نقدا';
}
}
$query = "SELECT * FROM users WHERE id = 2";
$result = $db->dbQuery($query);
if($db->dbNumRows( $result)){
$rows = $db->dbFetchResult($result);
foreach($rows as $row){
$Whatsapp = $row['Whatsapp'];
$email = $row['email'];
}
}
$currentDate = date('Y/m/d');
?>
<html lang="ar" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=0.4">
<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: 12px;
font-weight: 500;
}
:root
{
--main-color:#643543
}
body
{
padding: 10px;
--main-color:#000
}
.page_invoce
{
/* width: 550px; */
margin: 0 auto;
height: auto;
background-color: #fff;
padding: 10px 20px;
}
.Heading_info img
{
width: 40px;
}
.flex
{
display: flex;
align-items: center;
justify-content: space-between;
}
.center
{
display: flex;
align-items: center;
gap: 5px;
}
.NameSite , .Date
{
color: var(--main-color);
font-weight: bold;
font-size: 15px;
}
.info_customer
{
margin-top: 5px;
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: 0px;
border-collapse: collapse;
width: 100%;
}
.table thead tr
{
background-color: var(--main-color);
color: #fff;
}
.table thead tr th
{
padding: 0.8px;
}
.table thead tr th
{
background-color: #1fa2d8;
color: #fff;
height: 5px;
padding: 0 2px;
line-height: 3;
}
tbody tr
{
/*background-color: #e3e3e3;*/
color: var(--main-color);
font-size: 10px;
border-top: 1px solid #fff;
}
tbody tr td
{
padding: 0.3px;
text-align: center;
}
tbody tr:nth-child(even)
{
/*background-color: #f2f2f2;*/
}
.table td, .table th{
padding: .1rem;
vertical-align: top;
border-top: 1px solid #dee2e6;
}
footer
{
padding: 5px;
background-color: var(--main-color) !important;
margin-top: 5px;
}
footer div
{
color: #fff;
}
</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>
<div id="main" style="padding: 5px;max-width:80%;margin:auto;">
<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">دكان فون ستور</span> </div>
<div class="Logo center"><img style="width: 125px;" src="../uploads/125880420_8054567753_3398744478_taroisa.png"></div>
<div class="Logo center"><span class="NameSite">DokkanPhone STORE</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> <?= $phone ?> </div>
</div>
<div class="info_cus">
<div style="text-align: right;"><span>التاريخ : </span> <?= $currentDate ?></div>
<div style="text-align: right;"><span>العنوان : </span> <?= $location ?> </div>
</div>
</div>
<hr style="margin-top: 5px;">
<div class="table" style="margin-top: 10px;">
<div class="table_Res">
<table class="table">
<thead>
<tr>
<th>#</th>
<th>اسم المنتج </th>
<th>الكمية</th>
<th>السعر</th>
</tr>
</thead>
<tbody>
<?php
$totel_price = 0;
$query = "SELECT product_id,quantity 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'];
$query = "SELECT * FROM `products` WHERE product_id = $product_id";
$result = $db->dbQuery($query);
if($db->dbNumRows($result)){
$rows = $db->dbFetchResult($result);
foreach($rows as $rowp){
$count += 1;
if ($rowp['dec'] == 0) {
$totel_price += $rowp['price'];
}else {
$totel_price += $rowp['dec'];
}
?>
<tr>
<td><?= $count ?></td>
<td> <?= $rowp['name'] ?> </td>
<td> <?= $row['quantity'] ?> </td>
<td> <?= $rowp['dec'] == 0 ? $rowp['price'] : $rowp['dec']?> </td>
</tr>
<?php }
}
}
}
?>
</tbody>
</table>
</div>
</div>
<div class="table" style="margin-top: 5px;">
<div class="text_info_table flex" style="align-items: flex-start;">
<div>
<div style="text-align: right;"><span>مدة الأقساط : </span> <?= $first_batch ?> </div>
<div style="text-align: right; color: #f00"><span>المبلغ الكلي : </span> <?= $totel_price ?> ر.س </div>
</div>
<div>
<div style="text-align: right;"><span>الدفعة الأولى : </span> <?= $payment ?> ر.س</div>
<div style="text-align: right;dispaly:block;margin-top:10px;"><span>الختم : </span> </div>
</div>
</div>
</div>
<div class="table" style="margin-top: 10px;margin-bottom:20px;">
<div>
<div style="text-align: left;"><img style="width: 60px;margin: -15px 13px;transform: rotate(-20deg);" src="../uploads/pow.png"> </div>
</div>
</div>
<?php if($first_batch != 'نقدا'){
?>
<div>
<table class="table" style="width:100%;margin-top:10px;">
<thead>
<tr>
<th>#</th>
<th>المبلغ</th>
<th>تاريخ الاستحقاق</th>
</tr>
</thead>
<tbody>
<tr>
<th>1</th>
<th><?php print($payment) ?></th>
<th><?php print($currentDate)?></th>
</tr>
<?php
$first = $first_batch ;
$toootal = $totel_price - $payment;
$ee = $toootal/($first);
$formatted_number = number_format($ee, 2);
for ($i = 1; $i < $first; $i++) {
$new_date = date("Y/m/d", strtotime($currentDate . " +$i months"));
;
?>
<tr>
<th><?php print($i +1) ?></th>
<th><?php print($formatted_number) ?></th>
<th><?php echo "$new_date<br>"?></th>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Side-by-Side Photos</title>
<style>
/* Center the container */
.table {
text-align: center;
}
/* Style each photo-with-text div */
.photos {
display: flex;
justify-content: center; /* Center the items horizontally */
align-items: flex-start; /* Align items at the start (top) */
}
.photo-with-text {
margin: 0 20px; /* Add spacing between photos */
text-align: center; /* Center the text */
}
/* Style the text above the photos */
.photo-with-text p {
margin: 5px; /* Remove default paragraph margin */
font-weight: bold;
}
</style>
</head>
<body>
<div class="table">
<!-- Add a new div for the photos with text above -->
<div class="photos">
<div class="photo-with-text">
<p>لرؤية السجل التجاري</p>
<a href="url_to_your_first_image_page.html">
<img src="../uploads/dok.jpg" alt="First Image" style="width: 100px; height: auto;">
</a>
</div>
<div class="photo-with-text">
<p>موثق لدى معروف</p>
<a href="url_to_your_second_image_page.html">
<img src="../uploads/mar.png" alt="Second Image" style="width: 100px; height: auto;">
</a>
</div>
</div>
</div>
</body>
</html>
<?php } ?>
<div class="info_customer flex" style="align-items: flex-start; margin-bottom: 10px;">
<div class="info_cus" style="border-left: 1px solid #919191; width: 50%; padding-right: 10px;">
<div><span>التوصيل من خلال شركة ارامكس خلال 24 ساعة من تاريخ الفاتورة</span></div>
</div>
<div class="info_cus" style="width: 50%; padding-left: 10px;">
<div style="text-align: left;"><span>I have received the above device in good condition </span></div>
</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>
</body>
</html>