csrtechnew.ohctech.in/mob_vet_rec_pdf.php
2025-08-29 16:30:39 +05:30

252 lines
8.8 KiB
PHP

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Veterinary Visit Receipt</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 40px;
background-color: #f9f9f9;
/* Uncomment and update URL to use a background image */
/* background: url('your-background-image.jpg') no-repeat center center fixed;
background-size: cover; */
}
.header {
text-align: center;
position: relative;
}
.header h2 {
margin: 5px;
}
.logo {
position: absolute;
top: 0;
right: 0;
}
.logo img {
height: 80px;
margin: 10px;
}
.section {
margin-top: 20px;
font-size: 15px;
}
.section table {
width: 100%;
border-collapse: collapse;
font-size: 14px;
}
.section table,
.section th,
.section td {
border: 1px solid #000;
}
.section th,
.section td {
padding: 8px;
text-align: left;
}
.section th {
background-color: #e0e0e0;
}
.section td {
background-color: #fff;
}
.note {
margin-top: 30px;
font-style: italic;
font-size: 14px;
}
.signature {
margin-top: 40px;
display: flex;
justify-content: space-between;
font-size: 14px;
}
h3 {
margin-bottom: 10px;
font-size: 16px;
}
</style>
</head>
<body>
<?php
include('includes/config/config.php');
include('includes/functions.php');
if (isset($_REQUEST['stock_issue_id'])) {
$sql = "SELECT stock_issue_id,animal,animal_type,animal_tag,diagnosis,issue_ref_no,req_id,issue_date,remarks,ohc_location_id,issue_ohc_type_id,status,beneficiary,distribution_vendor,activity_name,program_name,payment_method FROM stock_issue where stock_issue_id='" . $_REQUEST['stock_issue_id'] . "'";
$result = mysqli_query($conn, $sql);
$row = mysqli_num_rows($result) > 0 ? mysqli_fetch_array($result) : null;
extract($row);
}
?>
<?php
$max_total = 0;
$max_scored = 0;
$queryc = "SELECT * FROM company_profile";
$resultc = mysqli_query($conn, $queryc);
$row_company = mysqli_fetch_array($resultc);
@extract($row_company);
?>
<div class="header">
<div class="logo">
<?php if (isset($row_company['company_logo']) && $row_company['company_logo'] != null) { ?>
<img src="data:<?php echo $row_company['image_type'] ?>;base64,<?php echo base64_encode($row_company['company_logo']) ?>" alt="Company Logo">
<?php } ?>
</div>
<h2>G.H.C.L. FOUNDATION</h2>
<div>Project: Green Field Project - Bada</div>
<div>Taluka: Mandvi-Kachchh Mobile: 8200978052</div>
</div>
<div class="section">
<table style="width: 100%;">
<tr>
<td style="width: 35%;"><strong>Receipt No.:</strong> <?php echo $issue_ref_no; ?></td>
<td style="width: 35%;"><strong>Date:</strong> <?php echo date_format(date_create($row['issue_date']), "d-M-Y"); ?></td>
<td style="width: 35%;"><strong>Place:</strong> <?php $village_id = getFieldFromTable('village', 'patient_master', 'id', $beneficiary);
echo getFieldFromTable('village', 'village', 'id', $village_id); ?></td>
</tr>
</table>
</div>
<div class="section">
<p><strong>1. Livestock Owner's Name:</strong> <?php echo getFieldFromTable('patient_name', 'patient_master', 'id', $beneficiary); ?></p>
<p><strong>2. Mobile Number:</strong> <?php echo getFieldFromTable('aadhar_phone', 'patient_master', 'id', $beneficiary); ?></p>
<p><strong>4. Animal:</strong> <?php echo getFieldFromTable('animal_type_name', 'animal_type', 'id', $animal); ?></p>
<p><strong>5. Animal Type:</strong> <?php echo $animal_type; ?> animal</p>
<p><strong>6. Animal Tag:</strong> <?php echo $animal_tag; ?></p>
<p><strong>7. Diagnosis:</strong> <?php echo getFieldFromTable('ailment_name', 'ailment', 'ailment_id', $diagnosis); ?></p>
</div>
<div class="section">
<h3>Treatment Details</h3>
<table>
<tr>
<th>Sr</th>
<th>Item Description</th>
<th>Unit</th>
<th>Issue Qty</th>
<th>Per Unit Rate</th>
<th>Total Price</th>
<th>GHCL FT Subsidy</th>
<th>Beneficiary Contribution</th>
</tr>
<?php
$count = 1;
$unitMap = getKeyValueMap('unit_master', 'unit_id', 'unit_name');
$sql_stock_issue_items = "SELECT * FROM stock_issue_items WHERE stock_issue_id=$stock_issue_id";
$result_stock_issue = mysqli_query($conn, $sql_stock_issue_items);
$total_price = $grand_total = $grand_subsidy = 0;
while ($row_stock_issue = mysqli_fetch_assoc($result_stock_issue)) {
$t_price = $row_stock_issue['per_unit_rate'] * $row_stock_issue['issue_qty'];
$subsidy = $row_stock_issue['subsidy_percent'];
$farmer = $t_price - $subsidy;
$total_price += $t_price;
$grand_subsidy += $subsidy;
$grand_total += $farmer;
?>
<tr>
<td align="center"><?php echo $count++; ?></td>
<td>
<?php echo getTableFieldValue('tbl_items', 'item_name', 'item_id', $row_stock_issue['item_id']); ?>
(Batch: <?php echo $row_stock_issue['item_batch_no']; ?>,
Expiry: <?php echo date_format(date_create(getStoreItemExpiryDate($row_stock_issue['item_id'], $row_stock_issue['item_batch_no'])), "M-Y"); ?>)
</td>
<td align="center"><?php echo $unitMap[getTableFieldValue('tbl_items', 'unit_id', 'item_id', $row_stock_issue['item_id'])]; ?></td>
<td align="right"><?php echo $row_stock_issue['issue_qty']; ?></td>
<td align="right"><?php echo number_format($row_stock_issue['per_unit_rate'], 2); ?></td>
<td align="right"><?php echo number_format($t_price, 2); ?></td>
<td align="right"><?php echo number_format($subsidy, 2); ?></td>
<td align="right"><?php echo number_format($farmer, 2); ?></td>
</tr>
<?php } ?>
<tr>
<th colspan="5" style="text-align: right;">Total</th>
<th style="text-align: right;"><?php echo number_format($total_price, 2); ?></th>
<th style="text-align: right;"><?php echo number_format($grand_subsidy, 2); ?></th>
<th style="text-align: right;"><?php echo number_format($grand_total, 2); ?></th>
</tr>
</table>
</div>
<div class="section">
<h3>Visit Charges</h3>
<table>
<tr>
<th>Particulars</th>
<th>Amount (₹)</th>
</tr>
<tr>
<td>Veterinary Visit Fee</td>
<td><?php if($animal_type=='street'){ echo 0; }else{echo 100;}?> </td>
</tr>
</table>
</div>
<?
$sql_sign = "SELECT * FROM stock_issue where stock_issue_id=$stock_issue_id ";
$result_sign = mysqli_query($conn, $sql_sign);
$row_sign = mysqli_fetch_assoc($result_sign);
@extract($row_sign);
error_log("sign:" . $sql_sign);
$sql_signature = "select * from employee_signature where emp_id = '" . $row_sign['stock_issue_emp_id'] . "'";
$result_signature = mysqli_query($conn, $sql_signature);
$row_signature = mysqli_fetch_array($result_signature);
$sql_signature1 = "select * from employee_signature where emp_id = '" . $row_sign['approving_doc_emp_id'] . "'";
$result_signature1 = mysqli_query($conn, $sql_signature1);
$row_signature1 = mysqli_fetch_array($result_signature1);
?>
<div class="note">
<p><strong>Note:</strong> In case of death of the animal post-treatment, the responsibility lies with the livestock owner.</p>
</div>
<div class="signature">
<div><strong></strong></div>
<div style="text-align: center;">
<div>
<img src="data:<?= $row_signature['image_type'] ?>;base64,<?= base64_encode($row_signature['emp_sign']) ?>"
style="width: 150px; height: 60px; margin: 0px; padding: 0px;">
</div>
<div>
<strong>Signature of Veterinary Doctor</strong>
</div>
</div>
</div>
</body>
</html>