417 lines
16 KiB
PHP
417 lines
16 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);
|
|
}
|
|
|
|
|
|
// $ven_q='';
|
|
// if(($_REQUEST['vendor_id'])!='' || ($_REQUEST['vendor_id'])!=null){
|
|
// $ven_q='and a.vendor_id="'.$_REQUEST['vendor_id'].'"';
|
|
// }
|
|
?>
|
|
|
|
<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);
|
|
}
|
|
|
|
?>
|
|
<form name="f1" method="post" action="" id="flex_form_indent">
|
|
|
|
<input type="hidden" name="indent_id" id="indent_id" />
|
|
<input type="hidden" name="qt_id" id="qt_id" />
|
|
<input type="hidden" name="ind_loc" id="ind_loc" />
|
|
<input type="hidden" name="flex_indent_id" id="flex_indent_id" />
|
|
<input type="hidden" name="vendor_id" id="vendor_id" />
|
|
</form>
|
|
|
|
<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($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>
|
|
<?php
|
|
$count = 1;
|
|
$unitMap = getKeyValueMap('unit_master', 'unit_id', 'unit_name');
|
|
$sql_stock_issue_items = "select a.*,a.item_rfq_no as state,a.item_po_no as po,b.remarks,b.approval_remarks,a.status FROM indent_items a right join indent_master b on a.indent_id = b.indent_id where b.indent_id='" . $indent_id . "' " ;
|
|
// echo ('indent_pdf'.$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="center" width="20%">Item
|
|
Description</td>
|
|
<td bgcolor="#eeeeee" border="1" align="center" width="10%">Specifications</td>
|
|
<td bgcolor="#eeeeee" border="1" align="center" width="5%">Make</td>
|
|
|
|
<td bgcolor="#eeeeee" border="1" align="center" width="10%">
|
|
Status</td>
|
|
<td bgcolor="#eeeeee" border="1" align="center" width="10%" style="display: none;" class="ven_data">
|
|
Vendor</td>
|
|
<td bgcolor="#eeeeee" border="1" align="center" width="10%" style="display: none;" class="ven_data">
|
|
RFQ No.</td>
|
|
|
|
<td bgcolor="#eeeeee" border="1" align="center" width="10%">
|
|
Indent Qty</td>
|
|
<td bgcolor="#eeeeee" border="1" align="center" width="10%">
|
|
Per Unit Rate</td>
|
|
<td bgcolor="#eeeeee" border="1" align="center" width="10%"> Price</td>
|
|
<td bgcolor="#eeeeee" border="1" align="center" width="10%" style="display: none;" class="ven_data">
|
|
Vendor Rate</td>
|
|
<td bgcolor="#eeeeee" border="1" align="center" width="10%" style="display: none;" class="ven_data">
|
|
Vendor Price</td>
|
|
<td bgcolor="#eeeeee" border="1" align="center" class='price' style="display:none" width="10%">Final
|
|
Price
|
|
</td>
|
|
|
|
|
|
<tr>
|
|
<td align="center"></td>
|
|
<td align="left"></td>
|
|
<td align="right"></td>
|
|
|
|
</tr>
|
|
<?php
|
|
$state=0;
|
|
$status=0;
|
|
$totalPrice = 0;
|
|
while ($row_stock_issue = @mysqli_fetch_assoc($result_stock_issue)) {
|
|
$sql_po = "select a.*,q.rfq_no FROM po_items a left join po_master b on a.po_id = b.po_id left join quotation_list q on (a.item_id=q.item_id and a.quotation_no=q.quotation_no) where b.indent_id='" . $indent_id . "' and a.item_id='".$row_stock_issue['item_id']."' and a.status='APPROVED' " ;
|
|
// echo ('indent_pdf'.$sql_po);
|
|
$result_po = @mysqli_query($conn, $sql_po);
|
|
$rfq_no='';
|
|
while( $row_po = @mysqli_fetch_assoc($result_po)){
|
|
$rfq_no.=',  '. "<a href=\"#\" class=\"red\" onclick=\"open_rfq_items_pdf('" . $indent_id . "','" . $row_po['vendor_id'] . "');\">" . $row_po['rfq_no'] . "</a>  ";
|
|
}
|
|
|
|
|
|
if($row_stock_issue['state']!='' || $row_stock_issue['state']!=null){
|
|
$state=1;
|
|
}
|
|
if($row_stock_issue['po']!='' || $row_stock_issue['po']!=null){
|
|
$status=1;
|
|
}
|
|
$item_status=$row_stock_issue['status'];
|
|
|
|
?>
|
|
<tr>
|
|
<td align="center"><?php echo $count; ?></td>
|
|
<td align="left"><?php echo getItemWithFormName($row_stock_issue['item_id']); ?></td>
|
|
<td align="left"> <?php
|
|
echo $row_stock_issue['specifications'];
|
|
// echo getFieldFromTable('specifications','tbl_items','item_id',$row_stock_issue['item_id']);
|
|
?></td>
|
|
<td align="left"> <?php
|
|
// echo getFieldFromTable('make','tbl_items','item_id',$row_stock_issue['item_id']);
|
|
echo $row_stock_issue['make'];
|
|
?></td>
|
|
<td align="center"><?php echo getIndentItemStatus($item_status).$rfq_no; ?></td>
|
|
<td align="center" style="display: none;" class="ven_data">
|
|
<?php if($row_stock_issue['vendor_id']==0 || $row_stock_issue['vendor_id']==null){echo '';}
|
|
else {echo getTableFieldValue('employer_contractor','employer_contractor_name','id',$row_stock_issue['vendor_id']);} ?>
|
|
</td>
|
|
<td align="center" style="display: none;" class="ven_data">
|
|
<?php echo $row_stock_issue['item_rfq_no']; ?>
|
|
</td>
|
|
|
|
<td align="center">
|
|
<?php echo $row_stock_issue['indent_qty'] ?> <?php echo $unitMap[getTableFieldValue('tbl_items', 'unit_id', 'item_id', $row_stock_issue['item_id'])]; ?>
|
|
</td>
|
|
|
|
|
|
<td align="center">
|
|
<?php
|
|
|
|
$rate=number_format( (float)(getTableFieldValue('item_rate','item_rate','item_id',$row_stock_issue['item_id'])),2);
|
|
|
|
if($rate!='' || $rate!=null){
|
|
echo $rate ;}?>
|
|
</td>
|
|
<td align="center">
|
|
|
|
<?php
|
|
if($rate!='' && $rate!=null){
|
|
|
|
$pri=getTableFieldValue('item_rate','item_rate','item_id',$row_stock_issue['item_id'])*$row_stock_issue['indent_qty'];
|
|
// }
|
|
// echo number_format((float)($pri),2);
|
|
echo $pri;
|
|
$totalPrice += $pri;
|
|
}
|
|
?>
|
|
</td>
|
|
|
|
|
|
<td align="center" style="display: none;" class="ven_data">
|
|
<?php echo (float)($row_stock_issue['vendor_rate']/$row_stock_issue['indent_qty']) ?>
|
|
</td>
|
|
<td align="center" style="display: none;" class="ven_data">
|
|
<?php echo (float)($row_stock_issue['vendor_rate']) ?>
|
|
</td>
|
|
|
|
<td align="center" class='price' style="display:none" width="10%">
|
|
<?php echo round($row_stock_issue['vendor_rate'],2) ?></td>
|
|
</tr>
|
|
<?php
|
|
|
|
$count++;
|
|
}
|
|
|
|
?>
|
|
<tr>
|
|
<td colspan="5">Total Price</td>
|
|
<td style="text-align: center;">
|
|
<?=$totalPrice?>
|
|
</td>
|
|
</tr>
|
|
|
|
|
|
</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 =$row_sign['generated_by'];
|
|
$doc_emp_id =$row_sign['approving_doc_id1'];
|
|
$doc_emp_id1 =$row_sign['approving_doc_id2'];
|
|
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);
|
|
|
|
$sql_signature2 = "select * from employee_signature where emp_id = '" . $doc_emp_id1 . "'";
|
|
|
|
$result_signature2 = mysqli_query($conn, $sql_signature2);
|
|
|
|
$row_signature2 = mysqli_fetch_array($result_signature2);
|
|
|
|
?>
|
|
<table style="width: 100%; line-height:10px;">
|
|
<td style="width: 30%;">Generated By:-
|
|
<?php if($row_signature['emp_sign']!=null || $row_signature['emp_sign']!=''){ ?>
|
|
<img src="data:<?= $row_signature['image_type'] ?>;base64,<?= base64_encode($row_signature['emp_sign']) ?>"
|
|
style="width: 150px; height: 60px; margin: 0px; padding: 0px;">
|
|
<?php }?>
|
|
</td>
|
|
<td style="width: 40%; ">
|
|
|
|
<?php if($row_signature1!='' && $row_signature1!=null){ ?>
|
|
Administrative Head :-
|
|
<img src="data:<?= $row_signature1['image_type'] ?>;base64,<?= base64_encode($row_signature1['emp_sign']) ?>"
|
|
style="width: 150px; height: 60px; margin: 0px; padding: 0px;">
|
|
<?php }?>
|
|
</td>
|
|
<td style="width: 30%; ">
|
|
<?php if($row_signature2!='' && $row_signature2!=null){ ?>
|
|
Commercial Purchase/HOD:-
|
|
<img src="data:<?= $row_signature2['image_type'] ?>;base64,<?= base64_encode($row_signature2['emp_sign']) ?>"
|
|
style="width: 150px; height: 60px; margin: 0px; padding: 0px;">
|
|
<?php }?>
|
|
</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();
|
|
|
|
|
|
var status = '<?php echo $status?>';
|
|
//alert(status);
|
|
if ('<?=$state?>' == 1) {
|
|
$('.ven_data').show();
|
|
}
|
|
if (status == 1) {
|
|
$('.price').show();
|
|
}
|
|
|
|
function generateReqPdf() {
|
|
|
|
var content = $("#pdfModal").html();
|
|
$("#htmlText").val(content);
|
|
document.reqPDFForm.action = "dynamic_pdf.php";
|
|
document.reqPDFForm.method = "POST";
|
|
document.getElementById("reqPDFForm").submit();
|
|
|
|
|
|
}
|
|
|
|
|
|
function open_rfq_items_pdf(indent_id, vendor_id) {
|
|
// alert(indent_id+ vendor_id);
|
|
$("#flex_indent_id").val('"' + indent_id + '"');
|
|
$("#vendor_id").val(vendor_id);
|
|
$("#flex_form_indent").attr('target', '_blank');
|
|
$("#flex_form_indent").attr('method', 'POST');
|
|
$("#flex_form_indent").attr('action', 'rfq_pdf.php');
|
|
$("#flex_form_indent").submit();
|
|
}
|
|
</script>
|