csrtechnew.ohctech.in/grn_master_pdf.php
2025-04-14 13:28:09 +05:30

264 lines
8.4 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 grn_master where grn_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>
<?php
$unitMap = getKeyValueMap('unit_master', 'unit_id', 'unit_name');
?>
<table width="100%">
<tr>
<td style="text-align: center;">
<b style="font-size: 15px;">GOODS RECEIVED NOTE</b>
</td>
</tr>
</table>
<hr />
<table border="0" width="100%">
<tr>
<td width="15%" align="left">GRN No:</td>
<td width="45%" align="left">
<b>
<div id="reqStore"><?php echo $item_grn_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($num_rows['approve_date']), "d-M-Y"); ?></div>
</b>
</td>
</tr>
</table>
<br>
<hr>
<?php
$count = 1;
$unitMap = getKeyValueMap('unit_master', 'unit_id', 'unit_name');
$sql_stock_issue_items = "select a.* FROM grn_items a right join grn_master b on a.grn_id = b.grn_id where a.grn_id='" . $_REQUEST['flex_indent_id'] . "' ";
error_log($sql_stock_issue_items."data from grn_items");
// echo ( $sql_stock_issue_items);
$result_stock_issue = @mysqli_query($conn, $sql_stock_issue_items);
?>
<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="30%">GRN NO.</td>
<td bgcolor="#eeeeee" border="1" align="center" width="20%">Indent NO.</td>
<td bgcolor="#eeeeee" border="1" align="right" width="10%">Approver</td>
<td bgcolor="#eeeeee" border="1" align="right" width="10%">Approved Date</td>
<td bgcolor="#eeeeee" border="1" align="right" width="10%" >Status</td>
</tr>
<tr>
<td align="center"></td>
<td align="left"></td>
<td align="right"></td>
</tr>
<?php
$po_status=0;
while ($row_stock_issue = @mysqli_fetch_assoc($result_stock_issue)) {
?>
<tr>
<td align="center"><?php echo $count; ?></td>
<td align="left"><?php echo $row_stock_issue['item_grn_no']; ?></td>
<td align="center">
<?php echo getFieldFromTable('indent_ref_no', 'indent_master', 'indent_id', $row_stock_issue['indent_id']); ?>
</td>
<td align="right">
<?php
$generated_emp = getFieldFromTable('emp_id', 'tbl_users', 'user_id', $row_stock_issue['approver']);
$generated_by = getFieldFromTable('staff_name', 'staff_master', 'staff_id', $generated_emp);
echo $generated_by;
?>
</td>
<td align="right">
<?php echo date_format(date_create($row_stock_issue['approve_date']), "d-M-Y ") ?>
</td>
<td align="right" class="po_data">
<?php echo ($row_stock_issue['status']) ?>
</td>
</tr>
<?php
$count++;
}
?>
</table>
<br>
<br>
<br>
<?
$sql_sign = "select * from indent_master a left join indent_items b on a.indent_id=b.indent_id where b.item_po_no='" . $_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>
<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>
</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();
});
var po_status = '<?= $po_status?>'
if (po_status == 1) {
$(".po_data").show();
}
function generateReqPdf() {
var content = $("#pdfModal").html();
$("#htmlText").val(content);
document.reqPDFForm.action = "dynamic_pdf.php";
document.reqPDFForm.method = "POST";
document.getElementById("reqPDFForm").submit();
}
</script>