238 lines
8.6 KiB
PHP
238 lines
8.6 KiB
PHP
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
|
|
<link href="includes/css-js/admin.css" rel="stylesheet" type="text/css" />
|
|
|
|
<?php
|
|
include('includes/config/config.php');
|
|
include('includes/functions.php');
|
|
|
|
$stock_issue_id = isset($_REQUEST['stock_issue_id']) ? $_REQUEST['stock_issue_id'] : null;
|
|
|
|
if ($stock_issue_id) {
|
|
// Use prepared statements for better security
|
|
$stmt = $conn->prepare("SELECT stock_issue_id, issue_ref_no, req_id, issue_date, remarks, sub_center, ohc_location_id, issue_ohc_type_id, status, batch_name,beneficiary, distribution_vendor, activity_name, program_name, payment_method,modified_by FROM stock_issue WHERE stock_issue_id = ?");
|
|
$stmt->bind_param("i", $stock_issue_id);
|
|
$stmt->execute();
|
|
$result = $stmt->get_result();
|
|
|
|
if ($result->num_rows > 0) {
|
|
$row = $result->fetch_assoc();
|
|
extract($row);
|
|
} else {
|
|
// Handle case where no rows are returned
|
|
echo "No records found.";
|
|
exit;
|
|
}
|
|
$stmt->close();
|
|
} else {
|
|
// Handle case where stock_issue_id is not set
|
|
echo "Invalid request.";
|
|
exit;
|
|
}
|
|
?>
|
|
|
|
<style>
|
|
table,
|
|
td,
|
|
th {
|
|
font-family: Arial, Helvetica, sans-serif;
|
|
font-size: 10px;
|
|
color: #000000;
|
|
line-height: 12px;
|
|
}
|
|
|
|
hr {
|
|
margin: 10px 0;
|
|
border: 0;
|
|
border-top: 1px solid #000;
|
|
}
|
|
|
|
#details,
|
|
#main-table {
|
|
width: 100%;
|
|
border-collapse: collapse;
|
|
border: 1px solid black;
|
|
font-size: 11px;
|
|
}
|
|
|
|
#details td,
|
|
#main-table td {
|
|
padding: 5px;
|
|
border: 1px solid black;
|
|
}
|
|
|
|
#main-table tr:nth-child(even) {
|
|
background-color: lightgoldenrodyellow;
|
|
}
|
|
|
|
#main-table tr:last-child {
|
|
background-color: lightgreen;
|
|
}
|
|
</style>
|
|
|
|
<html>
|
|
|
|
<body>
|
|
<?php include('pdf_ohc_header.php');
|
|
?>
|
|
<div id="pdfModal">
|
|
<div class="panel-body">
|
|
<?php
|
|
$unitMap = getKeyValueMap('unit_master', 'unit_id', 'unit_name');
|
|
$query = "SELECT * FROM company_profile";
|
|
$result = mysqli_query($conn, $query);
|
|
$row_company = mysqli_fetch_array($result);
|
|
extract($row_company);
|
|
?>
|
|
<?php if ($distribution_vendor > 0) { ?>
|
|
<table style="width: 100%;">
|
|
<tr>
|
|
<td style="text-align: left;"><b>GST No.: <?= getFieldFromTable('gst_no', 'agency', 'id', $distribution_vendor) ?: ''; ?></b></td>
|
|
<td style="text-align: right;"><b>Fertilizer Lic. No.: <?= getFieldFromTable('fertilizer_l_no', 'agency', 'id', $distribution_vendor) ?: ''; ?></b></td>
|
|
</tr>
|
|
<tr>
|
|
<td style="text-align: left;"></td>
|
|
<td style="text-align: right;"><b>Pesticides Lic. No.: <?= getFieldFromTable('pesticides_lic_no', 'agency', 'id', $distribution_vendor) ?: ''; ?></b></td>
|
|
</tr>
|
|
<tr>
|
|
<td style="text-align: left;"></td>
|
|
<td style="text-align: right;"><b>Seed Lic. No.: <?= getFieldFromTable('seed_lic_no', 'agency', 'id', $distribution_vendor) ?: ''; ?></b></td>
|
|
</tr>
|
|
</table>
|
|
<?php } ?>
|
|
|
|
<br>
|
|
<table style="width: 100%;">
|
|
<tr>
|
|
<td style="text-align: center; font-size: 20px;"><b><?= getFieldFromTable('agency_name', 'agency', 'id', $distribution_vendor); ?></b></td>
|
|
</tr>
|
|
</table>
|
|
<br>
|
|
<table style="width: 100%;">
|
|
<tr>
|
|
<td style="text-align: center; font-size: 10px;"><b><?= getFieldFromTable('agency_address', 'agency', 'id', $distribution_vendor); ?></b></td>
|
|
</tr>
|
|
</table>
|
|
<br>
|
|
|
|
<table style="width: 95%;">
|
|
<tr>
|
|
<td style="text-align: center;">
|
|
<h5>Center: <?= getFieldFromTable('ohc_type_name', 'ohc_type', 'ohc_type_id', $issue_ohc_type_id) ?></h5>
|
|
<h5><b>RETAIL INVOICE</b></h5>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<table id="details" class="table">
|
|
<tr>
|
|
<td><b>Cource Name:</b> <?= getFieldFromTable('name','courses','id',getFieldFromTable('training_program_id','training_batch_master','batch_id',$row['batch_name'])); ?></td>
|
|
<td><b>Batch Name:</b> <?= getFieldFromTable('batch_name','training_batch_master','batch_id',$row['batch_name']); ?></td>
|
|
<td><b>Issue Date:</b> <?= date_format(date_create($row['issue_date']), "d-M-Y"); ?></td>
|
|
<td><b>Bill No:</b> <?= $issue_ref_no; ?></td>
|
|
</tr>
|
|
<tr>
|
|
<td><b>Beneficiary Name:</b> <?= getFieldFromTable('patient_name','patient_master','id',$row['beneficiary']); ?></td>
|
|
<td><b>Mobile No:</b> <?= getFieldFromTable('aadhar_phone', 'patient_master', 'id', $row['beneficiary']); ?></td>
|
|
<td><b>Address:</b>
|
|
<?php
|
|
// $address = getFieldFromTable('patient_name','patient_master','id',$row['beneficiary']);
|
|
$village_id = getFieldFromTable('village', 'patient_master', 'id', $row['beneficiary']);
|
|
$state_id = getFieldFromTable('state', 'patient_master', 'id', $row['beneficiary']);
|
|
$taluka_id = getFieldFromTable('tehsil', 'patient_master', 'id', $row['beneficiary']);
|
|
$district_id = getFieldFromTable('district', 'patient_master', 'id', $row['beneficiary']);
|
|
$village = getFieldFromTable('village', 'village', 'id', $village_id);
|
|
$state = getFieldFromTable('name', 'states', 'id', $state_id);
|
|
$tehsil = getFieldFromTable('name', 'tehsils', 'id', $taluka_id);
|
|
$district = getFieldFromTable('name', 'districts', 'id', $district_id);
|
|
echo "$village,$tehsil, $district, $state";
|
|
?>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<br><br>
|
|
|
|
<table border="1" width="100%" id="reqPdfTable">
|
|
<tr style="background-color:cadetblue;">
|
|
<td align="center"><b>Sr</b></td>
|
|
<td align="center"><b>Item Description</b></td>
|
|
<td align="center"><b>Unit</b></td>
|
|
<td align="center"><b>Issue Qty</b></td>
|
|
<td align="center"><b>Rate Per Unit</b></td>
|
|
<td align="center"><b>Total Rate Per Unit</b></td>
|
|
<td align="center"><b>Total Price</b></td>
|
|
</tr>
|
|
|
|
<?php
|
|
$count = 1;
|
|
$sum_cp = 0;
|
|
$total_price = 0;
|
|
$sql_stock_issue_items = "SELECT stock_issue_item_id, subsidy_percent, payable_price, stock_issue_id, item_id, req_id, req_item_id, issue_qty, req_qty, item_batch_no, per_unit_rate FROM stock_issue_items WHERE stock_issue_id=?";
|
|
$stmt_items = $conn->prepare($sql_stock_issue_items);
|
|
$stmt_items->bind_param("i", $stock_issue_id);
|
|
$stmt_items->execute();
|
|
$result_stock_issue = $stmt_items->get_result();
|
|
|
|
while ($row_stock_issue = $result_stock_issue->fetch_assoc()) {
|
|
$total = ($row_stock_issue['per_unit_rate'] * $row_stock_issue['issue_qty']) - $row_stock_issue['subsidy_percent'];
|
|
$sum_cp += $total;
|
|
$t_price = $row_stock_issue['per_unit_rate'] * $row_stock_issue['issue_qty'];
|
|
$total_price += $t_price;
|
|
?>
|
|
<tr>
|
|
<td align="center"><?= $count++; ?></td>
|
|
<td><?= getTableFieldValue('tbl_items', 'item_name', 'item_id', $row_stock_issue['item_id']) ?></td>
|
|
<td align="center"><?= $unitMap[$row_stock_issue['unit_id']] ?? ''; ?></td>
|
|
<td align="center"><?= $row_stock_issue['issue_qty']; ?></td>
|
|
<td align="center"><?= number_format($row_stock_issue['per_unit_rate'], 2); ?></td>
|
|
<td align="center"><?= number_format($total, 2); ?></td>
|
|
<td align="center"><?= number_format($t_price, 2); ?></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
$stmt_items->close();
|
|
?>
|
|
<tr>
|
|
<td colspan="5" align="right"><b>Total Amount:</b></td>
|
|
<td align="center"><b><?= number_format($sum_cp, 2); ?></b></td>
|
|
<td align="center"><b><?= number_format($total_price, 2); ?></b></td>
|
|
</tr>
|
|
</table>
|
|
|
|
<br><br>
|
|
|
|
<table style="width: 95%;">
|
|
<tr>
|
|
<td style="text-align: left;">
|
|
<p><b>Remarks:</b> <?= $remarks; ?></p>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
|
|
<div style="display: flex; justify-content: space-between; align-items: flex-start;">
|
|
|
|
|
|
<div style="text-align: left;padding-top: 5px;">
|
|
<?php
|
|
$query = "SELECT * FROM employee_signature WHERE emp_id='" . mysqli_real_escape_string($conn, $modified_by) . "'";
|
|
$result1 = mysqli_query($conn, $query);
|
|
$sign_row = mysqli_fetch_array($result1);
|
|
$user_name= getFieldFromTable('staff_name', 'staff_master', 'staff_id',getFieldFromTable('emp_id', 'tbl_users', 'user_id',$row['modified_by']));
|
|
?>
|
|
<img id='sign' style="width: 120px; height: 60px;" src="data:<?= htmlspecialchars($sign_row['image_type']); ?>;base64,<?= base64_encode($sign_row['emp_sign']) ?>" alt="Signature"><br>
|
|
<p style="margin-top: 10px;"><?=$user_name ?></p>
|
|
<p style="font-size: 15px; font-weight: bold;">Issued by:</p>
|
|
</div>
|
|
<div style="text-align: right;">
|
|
<p><?= getTableFieldValue('sub_center', 'shg_owner', 'id', $sub_center); ?></p>
|
|
<p style="font-size: 15px; font-weight: bold;margin-top: 15px;">Received by:</p>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</body>
|
|
|
|
</html>
|