469 lines
15 KiB
PHP
469 lines
15 KiB
PHP
|
<!doctype html>
|
||
|
<html lang="en">
|
||
|
|
||
|
<?php
|
||
|
include('includes/config/config.php');
|
||
|
include('includes/functions.php');
|
||
|
include('log_entry.php');
|
||
|
function debug_to_console($data)
|
||
|
{
|
||
|
$output = $data;
|
||
|
if (is_array($output))
|
||
|
$output = implode(',', $output);
|
||
|
|
||
|
echo "<script>console.log('Debug Objects: " . $output . "' );</script>";
|
||
|
};
|
||
|
|
||
|
?>
|
||
|
|
||
|
<head>
|
||
|
<!-- Required meta tags -->
|
||
|
<meta charset="utf-8">
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||
|
|
||
|
<!-- Bootstrap CSS -->
|
||
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
|
||
|
<!-- Font Awesome -->
|
||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css">
|
||
|
<!-- Custom Style -->
|
||
|
<style>
|
||
|
:root {
|
||
|
--body-bg: rgb(204, 204, 204);
|
||
|
--white: #ffffff;
|
||
|
--darkWhite: #ccc;
|
||
|
--black: #000000;
|
||
|
--dark: #615c60;
|
||
|
--themeColor: #22b8d1;
|
||
|
--pageShadow: 0 0 0.5cm rgba(0, 0, 0, 0.5);
|
||
|
}
|
||
|
|
||
|
/* Font Include */
|
||
|
@import url('https://fonts.googleapis.com/css2?family=Rajdhani:wght@600&display=swap');
|
||
|
|
||
|
/* body {
|
||
|
background-color: var(--body-bg);
|
||
|
} */
|
||
|
|
||
|
.page {
|
||
|
background: var(--white);
|
||
|
display: block;
|
||
|
margin: 0 auto;
|
||
|
position: relative;
|
||
|
box-shadow: var(--pageShadow);
|
||
|
}
|
||
|
|
||
|
.page[size="A4"] {
|
||
|
width: 21cm;
|
||
|
height: 29.7cm;
|
||
|
overflow: hidden;
|
||
|
}
|
||
|
|
||
|
.bb {
|
||
|
border-bottom: 3px solid var(--darkWhite);
|
||
|
}
|
||
|
|
||
|
/* Top Section */
|
||
|
.top-content {
|
||
|
padding-bottom: 15px;
|
||
|
}
|
||
|
|
||
|
.logo img {
|
||
|
height: 80px;
|
||
|
}
|
||
|
|
||
|
.top-left p {
|
||
|
margin: 0;
|
||
|
}
|
||
|
|
||
|
.top-left .graphic-path {
|
||
|
height: 40px;
|
||
|
position: relative;
|
||
|
}
|
||
|
|
||
|
.top-left .graphic-path::before {
|
||
|
content: "";
|
||
|
height: 20px;
|
||
|
background-color: var(--dark);
|
||
|
position: absolute;
|
||
|
left: 15px;
|
||
|
right: 0;
|
||
|
top: -15px;
|
||
|
z-index: 2;
|
||
|
}
|
||
|
|
||
|
.top-left .graphic-path::after {
|
||
|
content: "";
|
||
|
height: 22px;
|
||
|
width: 17px;
|
||
|
background: var(--black);
|
||
|
position: absolute;
|
||
|
top: -13px;
|
||
|
left: 6px;
|
||
|
transform: rotate(45deg);
|
||
|
}
|
||
|
|
||
|
.top-left .graphic-path p {
|
||
|
color: var(--white);
|
||
|
height: 40px;
|
||
|
left: 0;
|
||
|
right: -100px;
|
||
|
text-transform: uppercase;
|
||
|
background-color: var(--themeColor);
|
||
|
font: 26px;
|
||
|
z-index: 3;
|
||
|
position: absolute;
|
||
|
padding-left: 10px;
|
||
|
}
|
||
|
|
||
|
/* User Store Section */
|
||
|
.store-user {
|
||
|
padding-bottom: 25px;
|
||
|
}
|
||
|
|
||
|
.store-user p {
|
||
|
margin: 0;
|
||
|
font-weight: 600;
|
||
|
}
|
||
|
|
||
|
.store-user .address {
|
||
|
font-weight: 400;
|
||
|
}
|
||
|
|
||
|
.store-user h2 {
|
||
|
color: var(--themeColor);
|
||
|
font-family: 'Rajdhani', sans-serif;
|
||
|
}
|
||
|
|
||
|
.extra-info p span {
|
||
|
font-weight: 400;
|
||
|
}
|
||
|
|
||
|
/* Product Section */
|
||
|
thead {
|
||
|
/* color: whitesmoke; */
|
||
|
background: var(--themeColor);
|
||
|
/* -webkit-print-color-adjust: exact; */
|
||
|
}
|
||
|
|
||
|
|
||
|
.table td,
|
||
|
.table th {
|
||
|
text-align: center;
|
||
|
vertical-align: middle;
|
||
|
}
|
||
|
|
||
|
tr th:first-child,
|
||
|
tr td:first-child {
|
||
|
text-align: left;
|
||
|
}
|
||
|
|
||
|
.media img {
|
||
|
height: 60px;
|
||
|
width: 60px;
|
||
|
}
|
||
|
|
||
|
.media p {
|
||
|
font-weight: 400;
|
||
|
margin: 0;
|
||
|
}
|
||
|
|
||
|
.media p.title {
|
||
|
font-weight: 600;
|
||
|
}
|
||
|
|
||
|
/* Balance Info Section */
|
||
|
.balance-info .table td,
|
||
|
.balance-info .table th {
|
||
|
padding: 0;
|
||
|
border: 0;
|
||
|
}
|
||
|
|
||
|
.balance-info tr td:first-child {
|
||
|
font-weight: 600;
|
||
|
}
|
||
|
|
||
|
tfoot {
|
||
|
border-top: 2px solid var(--darkWhite);
|
||
|
}
|
||
|
|
||
|
tfoot td {
|
||
|
font-weight: 600;
|
||
|
}
|
||
|
|
||
|
/* Footer Section */
|
||
|
footer {
|
||
|
text-align: center;
|
||
|
position: absolute;
|
||
|
bottom: 30px;
|
||
|
left: 75px;
|
||
|
right: 35px;
|
||
|
background-color: blanchedalmond;
|
||
|
}
|
||
|
|
||
|
footer hr {
|
||
|
margin-bottom: -22px;
|
||
|
border-top: 3px solid var(--darkWhite);
|
||
|
}
|
||
|
|
||
|
footer a {
|
||
|
color: var(--themeColor);
|
||
|
}
|
||
|
|
||
|
footer p {
|
||
|
padding: 6px;
|
||
|
border: 3px solid var(--darkWhite);
|
||
|
background-color: var(--white);
|
||
|
display: inline-block;
|
||
|
}
|
||
|
|
||
|
@media print {
|
||
|
#printPageButton {
|
||
|
display: none;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
</style>
|
||
|
|
||
|
<!-- <title>Invoice!</title> -->
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
|
||
|
<div align="center">
|
||
|
|
||
|
<button align="center" id="printPageButton" style="background-color:#22b8d1;" class="btn btn-success my-3" onClick="window.print();">Print</button>
|
||
|
</div>
|
||
|
|
||
|
<?php
|
||
|
|
||
|
$query_for_company = "select * from company_profile ";
|
||
|
//echo $query_for_company;
|
||
|
$result_for_company = @mysqli_query($conn, $query_for_company);
|
||
|
if ($row_for_company = @mysqli_fetch_array($result_for_company)) {
|
||
|
$addres = $row_for_company['billing_address'];
|
||
|
$website = $row_for_company['company_website'];
|
||
|
$email = $row_for_company['primary_email'];
|
||
|
$phn = $row_for_company['primary_phone'];
|
||
|
@extract($row_for_company);
|
||
|
|
||
|
|
||
|
$logo = getFieldFromTable('ohc_logo', 'ohc_type', 'ohc_type_id', $_SESSION['current_ohcttype']);
|
||
|
}
|
||
|
?>
|
||
|
|
||
|
|
||
|
<?php
|
||
|
$bill_id = $_REQUEST['bill_id'];
|
||
|
|
||
|
error_log("values:" . $address . " " . $phn . " " . $email . " " . $website);
|
||
|
|
||
|
$sql = "SELECT b.*, pm.* FROM bill_master b INNER JOIN patient_master pm ON b.patient_id=pm.id where bill_id=$bill_id";
|
||
|
|
||
|
error_log("bill master pdf:" . $sql);
|
||
|
|
||
|
$result = mysqli_query($conn, $sql);
|
||
|
|
||
|
$row_bill = mysqli_fetch_assoc($result);
|
||
|
// debug_to_console($row_bill['patient_id']);
|
||
|
|
||
|
@extract($row_bill);
|
||
|
|
||
|
|
||
|
$patient_name = $row_bill['patient_name'];
|
||
|
$client_name = getFieldFromTable('client_name', 'client_master', 'client_id', $row_bill['client_id']);
|
||
|
$gender = $row_bill['gender'];
|
||
|
if ($gender == 'M' || $gender == 'm') {
|
||
|
$gender = 'Male';
|
||
|
} else if ($gender == 'F' || $gender == 'f') {
|
||
|
$gender = 'Female';
|
||
|
}
|
||
|
$date = date_format(date_create($row_bill['bill_date']), "M d Y");
|
||
|
$bill_no = $row_bill['bill_no'];
|
||
|
|
||
|
$age = "";
|
||
|
if (!empty($row_bill['dob'])) {
|
||
|
$dob = $row_bill['dob'];
|
||
|
$age = (date('Y') - date('Y', strtotime($dob)));
|
||
|
}
|
||
|
// error_log($client_name);
|
||
|
// debug_to_console($client_name);
|
||
|
// $gstin = getFieldFromTable('gstin', 'client_master', 'client_id', $row_bill['client_id']);
|
||
|
// $village = getFieldFromTable('village', 'patient_master', 'id', $row_bill['patient_id']);
|
||
|
// $district = getFieldFromTable('district', 'patient_master', 'id', $row_bill['patient_id']);
|
||
|
// $state = getFieldFromTable('state', 'patient_master', 'id', $row_bill['patient_id']);
|
||
|
// $address = getFieldFromTable('address', 'patient_master', 'id', $row_bill['patient_id']);
|
||
|
$final_bill_amount = $row_bill['final_bill_amount'];
|
||
|
$amount_paid_patient = $row_bill['amount_paid_patient'];
|
||
|
|
||
|
$amount_pending_company = $row_bill['amount_pending_company'];
|
||
|
|
||
|
if ($row_bill['amount_pending_company'] == '0' || $row_bill['amount_paid_patient'] == $row_bill['final_bill_amount']) {
|
||
|
$ispaid = "YES";
|
||
|
} else {
|
||
|
$ispaid = "NO";
|
||
|
}
|
||
|
|
||
|
$discount_voucher = getFieldFromTable('voucher_name', 'voucher_master', 'voucher_id', $row_bill['discount_voucher']);
|
||
|
$pay_mod = $row_bill['Pay_mod'];
|
||
|
|
||
|
|
||
|
|
||
|
if ($row_bill['amount_pending_company'] == '0' || $row_bill['amount_paid_patient'] == $row_bill['final_bill_amount']) {
|
||
|
$bill_status = "PAID";
|
||
|
} else {
|
||
|
$bill_status = "PARTIALLY PAID";
|
||
|
}
|
||
|
|
||
|
|
||
|
?>
|
||
|
|
||
|
<div class="my-5 page" size="A4">
|
||
|
<div class="p-5">
|
||
|
<section class="top-content bb d-flex flex-row-reverse">
|
||
|
<div class="logo">
|
||
|
<img src="data:image/jpeg;base64,<?= base64_encode($logo) ?>" alt="" class="img-fluid"><br><br>
|
||
|
<!-- <span>(A Unit of My Health Education Private Limited) <br>
|
||
|
(An ISO 9001:2016 Certified Organisation)</span> -->
|
||
|
</div>
|
||
|
<!-- <div class="top-left">
|
||
|
<div class="graphic-path">
|
||
|
<p>Invoice</p>
|
||
|
</div>
|
||
|
<div class="position-relative">
|
||
|
<p>Invoice No. <span><?= $bill_no ?></span></p>
|
||
|
</div>
|
||
|
</div> -->
|
||
|
</section>
|
||
|
|
||
|
<section class="store-user mt-2">
|
||
|
<div class="col-12">
|
||
|
<div class="row bb pb-3">
|
||
|
<div class="col-7">
|
||
|
<p>Patient</p>
|
||
|
<h2><?= $patient_name ?></h2>
|
||
|
<div class="txn mt-2">Age: <span><?= $age ?></span></div>
|
||
|
<div class="txn mt-2">Gender: <span><?= $gender ?></span></div>
|
||
|
<div class="txn mt-2">Bill No: <span><?= $bill_no ?></span></div>
|
||
|
<div class="extra-info pt-3 mt-2">
|
||
|
<p>Date: <span><?= $date ?></span></p>
|
||
|
</div>
|
||
|
<div></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</div>
|
||
|
</section>
|
||
|
|
||
|
<section class="product-area mt-2">
|
||
|
<table class="table table-hover">
|
||
|
<thead>
|
||
|
<tr>
|
||
|
<td>SR NO.</td>
|
||
|
<td>Test Name</td>
|
||
|
<!-- <td>Hsn Code</td> -->
|
||
|
<td>Price</td>
|
||
|
<td>Quantity</td>
|
||
|
<td>Total</td>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody>
|
||
|
<?php
|
||
|
$sql_service = "select b.*,p.*,bd.qty from bill_master b left join bill_details bd on b.bill_id = bd.bill_id left join product_service_master p on p.product_id = bd.product_list where b.bill_id = $bill_id";
|
||
|
|
||
|
error_log("2nd bill query:" . $sql_service);
|
||
|
$service_result = mysqli_query($conn, $sql_service);
|
||
|
|
||
|
while ($row_bill1 = mysqli_fetch_assoc($service_result)) {
|
||
|
$total = $row_bill1['qty'] * $row_bill1['rate_per_unit'];
|
||
|
?>
|
||
|
<tr>
|
||
|
<td>
|
||
|
<?= ++$count ?>
|
||
|
</td>
|
||
|
<td style="text-align: center;"><?= $row_bill1['product_name'] ?></td>
|
||
|
<!-- <td style="text-align: left;"><?= $row_bill1['hsn_code'] ?></td> -->
|
||
|
<td><?= $row_bill1['rate_per_unit'] ?></td>
|
||
|
<td><?= $row_bill1['qty'] ?></td>
|
||
|
|
||
|
<td><?= $total ?></td>
|
||
|
</tr>
|
||
|
<?php } ?>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</section>
|
||
|
|
||
|
<?php
|
||
|
$sql_payment = "select b.*,bd.tax_rate1,bd.tax_rate2,bd.total_tax from bill_master b left join bill_details bd on b.bill_id = bd.bill_id where b.bill_id = $bill_id";
|
||
|
$result = mysqli_query($conn, $sql_payment);
|
||
|
$row_bill2 = mysqli_fetch_assoc($result);
|
||
|
@extract($row_bill2);
|
||
|
?>
|
||
|
|
||
|
<section class="balance-info">
|
||
|
<div class="row justify-content-end">
|
||
|
<!-- <div class="col-8">
|
||
|
<p class="m-0 font-weight-bold"> Paid: </p>
|
||
|
<p><?= $row_bill2['amount_paid_patient'] ?></p>
|
||
|
<p class="m-0 font-weight-bold"> Due: </p>
|
||
|
<p><?= $row_bill2['amount_pending_company'] ?></p>
|
||
|
<p class="m-0 font-weight-bold"> Payment Mode: </p>
|
||
|
<p><?= $row_bill['Pay_mod'] ?></p>
|
||
|
</div> -->
|
||
|
<div class="col-4">
|
||
|
<table class="table border-0 table-hover">
|
||
|
<!-- <tr>
|
||
|
<td>Sub Total:</td>
|
||
|
<td><?= $row_bill2['total_amount_bf_discount'] ?></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>CGST:</td>
|
||
|
<td><?= $row_bill2['tax_rate1'] ?></td>
|
||
|
</tr>
|
||
|
<tr>
|
||
|
<td>SGST:</td>
|
||
|
<td><?= $row_bill2['tax_rate2'] ?></td>
|
||
|
</tr> -->
|
||
|
|
||
|
<tfoot>
|
||
|
<tr>
|
||
|
<td>Grand Total:</td>
|
||
|
<td><?= $row_bill2['final_bill_amount'] ?></td>
|
||
|
</tr>
|
||
|
</tfoot>
|
||
|
</table>
|
||
|
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
</section>
|
||
|
|
||
|
<!-- <footer>
|
||
|
<hr>
|
||
|
<p class="m-0 text-center" style="background-color:ivory;">
|
||
|
Multi-Specialty Medical Consultations | Osteopathy & Physiotherapy <br> Day Care &Laboratory | Corporate/School Health & CSR Service | Health Education Seminars
|
||
|
</p>
|
||
|
<div class="social pt-3">
|
||
|
<span class="pr-1">
|
||
|
<i class="fas fa-mobile-alt"></i>
|
||
|
<span><?= strtolower($phn) ?></span>
|
||
|
</span>
|
||
|
<span class="pr-1">
|
||
|
<i class="fas fa-envelope"></i>
|
||
|
<span><?= strtolower($email) ?></span>
|
||
|
</span>
|
||
|
<span class="pr-1">
|
||
|
<i class="fas fa-address-book"></i>
|
||
|
<span><?= strtolower($addres) ?></span>
|
||
|
</span>
|
||
|
<span class="pr-1">
|
||
|
<i class="fa fa-home"></i>
|
||
|
<span><?= strtolower($website) ?></span>
|
||
|
</span>
|
||
|
</div>
|
||
|
</footer> -->
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</body>
|
||
|
|
||
|
</html>
|