
PK 
<?php
ob_start();
//error_reporting(E_ALL ^ E_NOTICE);
@session_start();
ini_set('allow_url_include',1);
date_default_timezone_set("Asia/Kolkata");
set_time_limit(600);
ini_set('max_execution_time',600);
require_once 'includes/settings/PDODB.php';
include 'includes/modules/functions.php';
// Include autoloader
require_once 'dompdf/autoload.inc.php';
$function = new FUNCTIONS();
// Include autoloader
require_once 'dompdf/autoload.inc.php';
// Reference the Dompdf namespace
use Dompdf\Dompdf;
// Instantiate and use the dompdf class
$dompdf = new Dompdf();
// Load HTML content
//$dompdf->loadHtml('<h1>Welcome to CodexWorld.com</h1>');
//$html = file_get_contents("thanks.php");
if(empty($_SESSION['adminId_cheesyBites'])){
header("Location: index.php");
exit();
}
$inventoryData = $function->getInventory($id = NULL, $itemCode = NULL, $itemType = NULL, $isActive = 1,$orderBy=NULL);
$purchaseData = $function->getPurchase($pId = $_GET['id'], $customer_contactno = NULL, $isActive = 1,$orderBy='ASC'); //echo "v3"; exit;
$purchaseItemData = $function->getPurchaseItems($id = NULL, $purchaseId = $_GET['id'],$inventoryId = NULL,$isActive = 1,$orderBy = NULL);
$txndate = date('d-m-Y h:i:s A', strtotime($purchaseData[0]['invoiceDate']));
$orderid = $purchaseData[0]['invoiceId'];
$html = "<!DOCTYPE html>
<html>
<head>
<title>Invoice</title>
</head>
<body style='font-family:Arial, Helvetica, sans-serif; align:left;'>
<div style='width: 58mm; margin: 0 auto;'>
<center style='border-bottom: 1px solid #000; padding-bottom: 15px;'>
<div>
<h2>Cheesy Bite</h2>
<p style='font-size: 11px; margin: 0px;'>D32, Block D, Near Sachdeva Marriage Home, Bhajanpura, Shahdara, Delhi, 110053</p>
<p style='font-size: 11px; margin: 10px 0px 0px 0px;'><b>Date:</b> $txndate</p>
</div>
</center>
<div>
<div>
<h2 style='font-size: 12px; border-bottom: 1px solid #000; padding-bottom: 15px;'>Order No: $orderid</h2>
<table cellpadding='0' cellspacing='0' style='width: 100%; margin: 0px auto; vertical-align: top; font-family: Arial, Helvetica, sans-serif; font-size: 15px; line-height: 16px; padding-bottom: 15px;' border='1'>
<thead>
<tr>
<th>Item Name</th>
<th>Rate</th>
<th>Qty</th>
<th>Total</th>
</tr>
</thead>
<tbody>";
$total_amt = 0;
foreach ($purchaseItemData as $key => $value) {
$total_amt += (float)$value['total'];
$itemName = $itemCode = $hsnCode = $gstRate = $inventoryid = '';
foreach ($inventoryData as $isKey => $isValue) {
if ($value['inventoryId'] == $isValue['id']) {
$itemName = $isValue['itemName'];
$itemCode = $isValue['itemCode'];
$hsnCode = $isValue['hsnCode'];
$gstRate = $isValue['gstRate'];
$inventoryid = $isValue['id'];
}
}
$html .= "
<tr>
<td style='padding: 3px;'>$itemName</td>
<td style='padding: 3px; width:10%'>{$value['rateperunit']}</td>
<td style='padding: 3px;width:10%'>{$value['qty']}</td>
<td style='padding: 3px;'>{$value['total']}</td>
</tr>";
}
// Add total amount to the table footer
$html .= "
</tbody>
<tfoot>
<tr>
<td colspan='3' align='right'><strong>Total Amount:</strong></td>
<td><strong>$total_amt</strong></td>
</tr>
</tfoot>
</table>
</div>
</div>
<div>
<div style='border-top: 1px solid #000;'>
<p style='font-size: 10px;'>This is a computerized receipt, hence signatures are not required.</p>
</div>
</div>
</div>
</body>
</html>";
//echo $html;
?>
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="https://printjs-4de6.kxcdn.com/print.min.js"></script>
<style type="text/css">
/* CSS */
.button-print {
align-items: center;
background-clip: padding-box;
background-color: #358106;
border: 1px solid transparent;
border-radius: .25rem;
box-shadow: rgba(0, 0, 0, 0.02) 0 1px 3px 0;
box-sizing: border-box;
color: #fff;
cursor: pointer;
display: inline-flex;
font-family: system-ui,-apple-system,system-ui,"Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 16px;
font-weight: 600;
justify-content: center;
line-height: 1.25;
margin: 0;
min-height: 3rem;
padding: calc(.875rem - 1px) calc(1.5rem - 1px);
position: relative;
text-decoration: none;
transition: all 250ms;
user-select: none;
-webkit-user-select: none;
touch-action: manipulation;
vertical-align: baseline;
width: auto;
}
.button-print:hover,
.button-print:focus {
background-color: #fb8332;
box-shadow: rgba(0, 0, 0, 0.1) 0 4px 12px;
}
.button-print:hover {
transform: translateY(-1px);
}
.button-print:active {
background-color: #c85000;
box-shadow: rgba(0, 0, 0, .06) 0 2px 4px;
transform: translateY(0);
}
.button-dashboard {
align-items: center;
background-clip: padding-box;
background-color: #fa002e;
border: 1px solid transparent;
border-radius: .25rem;
box-shadow: rgba(0, 0, 0, 0.02) 0 1px 3px 0;
box-sizing: border-box;
color: #fff;
cursor: pointer;
display: inline-flex;
font-family: system-ui,-apple-system,system-ui,"Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 16px;
font-weight: 600;
justify-content: center;
line-height: 1.25;
margin: 0;
min-height: 3rem;
padding: calc(.875rem - 1px) calc(1.5rem - 1px);
position: relative;
text-decoration: none;
transition: all 250ms;
user-select: none;
-webkit-user-select: none;
touch-action: manipulation;
vertical-align: baseline;
width: auto;
}
.button-dashboard:hover,
.button-dashboard:focus {
background-color: #fb8332;
box-shadow: rgba(0, 0, 0, 0.1) 0 4px 12px;
}
.button-dashboard:hover {
transform: translateY(-1px);
}
.button-dashboard:active {
background-color: #c85000;
box-shadow: rgba(0, 0, 0, .06) 0 2px 4px;
transform: translateY(0);
}
</style>
</head>
<body>
<div id="printJS-form">
<?php echo $html; ?>
</div>
<center style="padding-top: 20px;">
<button class="button-print" type="button" onclick="printJS('printJS-form', 'html')">
Print
</button>
<a class="button-dashboard" href="purchase/purchase-create-new.php">
New Order
</a>
</center>
</body>
</html>


PK 99