ESH/indent_pdf.php
2024-10-23 18:28:06 +05:30

269 lines
8.2 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" />
<style type="text/css">
table,
td,
th {
font-family:
Arial,
Helvetica,
sans-serif;
font-size:
10px;
font-weight:
normal;
color:
#000000;
text-decoration:
none;
line-height:
12px;
}
</style>
<?php
include('includes/config/config.php');
include('includes/functions.php');
if (isset($_REQUEST['flex_indent_id'])) {
$sql = "select * from indent_master where indent_id='" . $_REQUEST['flex_indent_id'] . "'";
// echo "query:".$sql;
error_log("INDENT QUERY::" . $sql);
$result = mysqli_query($conn, $sql);
$num_rows = @mysqli_num_rows($result);
$row = null;
if ($num_rows > 0) {
$row = @mysqli_fetch_array($result);
}
@extract($row);
}
?>
<style>
hr {
margin-top: 10px;
margin-bottom: 10px;
padding: 0px;
border: 0;
border-top: 1px solid #000;
}
</style>
<html>
<body>
<div id="pdfModal">
<div class="panel-body">
<?php
$query_for_company = "select company_name, company_logo, image_type,address 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)) {
@extract($row_for_company);
}
?>
<table cellspacing="0" width="100%">
<?php include('pdf_ohc_header.php')?>
</table>
<table cellspacing="0" width="100%">
<tr>
<td width="25%" align="left"> Run Date : <?php echo date("d-M-Y"); ?>
<td width="75%" align="right"> User : <?php echo $username ?></td>
</tr>
</table>
<?php
$unitMap = getKeyValueMap('unit_master', 'unit_id', 'unit_name');
?>
<table width="100%">
<tr>
<td style="text-align: center;">
<b style="font-size: 15px;">INDENT VOUCHER</b>
</td>
</tr>
</table>
<hr />
<table border="0" width="100%">
<tr>
<td width="15%" align="left">Indent Voucher No:</td>
<td width="45%" align="left">
<b>
<div id="reqStore"><?php echo $indent_ref_no; ?></div>
</b>
</td>
<td width="15%" align="left">Generated Date :</td>
<td width="45%" align="left">
<b>
<div id="reqRequestedBy">
<?php echo date_format(date_create($row['indent_date']), "d-M-Y"); ?></div>
</b>
</td>
</tr>
<tr>
<td width="15%" align="left">Remarks: </td>
<td width="22.5%" align="left">
<b>
<div id="reqRefNo"><?php echo $remarks; ?></div>
</b>
</td>
<td width="15%" align="left">Approval Remarks: </td>
<td width="20%" align="left">
<b>
<div id="reqReqDate"> <?php echo $approval_remarks; ?></div>
</b>
</td>
</tr>
</table>
<br>
<hr>
<table border="1" width="100%" id="reqPdfTable">
<tr>
<td bgcolor="#eeeeee" border="1" align="center" width="3%">Sr</td>
<td bgcolor="#eeeeee" border="1" align="left" width="50%">Item
Description</td>
<td bgcolor="#eeeeee" border="1" align="right" width="10%">Indent Qty</td>
</tr>
<tr>
<td align="center"></td>
<td align="left"></td>
<td align="right"></td>
</tr>
<?php
$count = 1;
$unitMap = getKeyValueMap('unit_master', 'unit_id', 'unit_name');
$sql_stock_issue_items = "select a.*,b.remarks,b.approval_remarks FROM indent_items a right join indent_master b on a.indent_id = b.indent_id where b.indent_id='" . $indent_id . "'";
//echo $sql_stock_issue_items;
$result_stock_issue = @mysqli_query($conn, $sql_stock_issue_items);
while ($row_stock_issue = @mysqli_fetch_assoc($result_stock_issue)) {
?>
<tr>
<td align="center"><?php echo $count; ?></td>
<td align="left"><?php echo getItemWithFormName($row_stock_issue['item_id']); ?></td>
<td align="right">
<?php echo $row_stock_issue['indent_qty'] ?>&nbsp;&nbsp;<?php echo $unitMap[getTableFieldValue('tbl_items', 'unit_id', 'item_id', $row_stock_issue['item_id'])]; ?>
</td>
</tr>
<?php
$count++;
}
?>
</table>
<br>
<br>
<br>
<?
$sql_sign = "SELECT * FROM indent_master where indent_id='" . $_REQUEST['flex_indent_id'] . "' ";
$result_sign = mysqli_query($conn, $sql_sign);
$row_sign = mysqli_fetch_assoc($result_sign);
@extract($row_sign);
$emp_id = getFieldFromTable('emp_id', 'tbl_users', 'user_id', $row_sign['generated_by']);
$doc_emp_id = getFieldFromTable('emp_id', 'tbl_users', 'user_id', $row_sign['approving_doc_id']);
error_log("sign:" . $sql_sign);
error_log("emp_id" . $emp_id);
error_log("doc_id" . $doc_emp_id);
$sql_signature = "select * from employee_signature where emp_id = '" . $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 = '" . $doc_emp_id . "'";
$result_signature1 = mysqli_query($conn, $sql_signature1);
$row_signature1 = mysqli_fetch_array($result_signature1);
?>
<table style="width: 100%; line-height:10px;">
<td style="width: 30%;">Generated By:- <img
src="data:<?= $row_signature['image_type'] ?>;base64,<?= base64_encode($row_signature['emp_sign']) ?>"
style="width: 150px; height: 60px; margin: 0px; padding: 0px;"></td>
<?php if($row_stock_issue["status"]=='APPROVED') {?>
<td style="width: 40%; ">Approved by:- <img
src="data:<?= $row_signature1['image_type'] ?>;base64,<?= base64_encode($row_signature1['emp_sign']) ?>"
style="width: 150px; height: 60px; margin: 0px; padding: 0px;"></td>
<?php }?>
</table>
</div>
</form>
</div>
<style>
.modal-dialog {
padding: 15px;
width: 90%;
}
@media print {
@page {
margin: 0;
}
body {
margin: 1.6cm;
}
}
</style>
<form class="form" id="reqPDFForm" name="reqPDFForm" method="post">
<input type="hidden" name="htmlText" id="htmlText">
</form>
</body>
</html>
<script>
//generateReqPdf();
$(document).ready(function() {
window.print();
});
function generateReqPdf() {
var content = $("#pdfModal").html();
$("#htmlText").val(content);
document.reqPDFForm.action = "dynamic_pdf.php";
document.reqPDFForm.method = "POST";
document.getElementById("reqPDFForm").submit();
}
</script>