2025-04-14 13:28:09 +05:30
< ? php
include ( 'includes/config/config.php' );
include ( 'includes/functions.php' );
$ohc = mysqli_real_escape_string ( $conn , $_POST [ 'pohcid' ]);
$program_name = mysqli_real_escape_string ( $conn , $_POST [ 'program_name' ]);
$activity_name = mysqli_real_escape_string ( $conn , $_POST [ 'activity_name' ]);
$role_type = mysqli_real_escape_string ( $conn , $_POST [ 'center_type' ]);
$from_date1 = date ( 'Y-m-d' , strtotime ( $_POST [ 'procurement_date1' ]));
$from_date2 = date ( 'Y-m-d' , strtotime ( $_POST [ 'procurement_date2' ]));
?>
< body >
< table width = " 100% " >
< tr align = " right " >
< td style = " font-size: 12px " >
< strong > Selected Location : < ? php if ( $ohc == 'All' ) {
echo 'All' ;
} else {
echo htmlspecialchars ( getFieldFromTable ( 'ohc_type_name' , 'ohc_type' , 'ohc_type_id' , $ohc ));
} ?> </strong>
</ td >
</ tr >
</ table >
< br >
< table width = " 100% " >
< tr >
< td style = " font-size: 15px; " >
< strong style = " margin-left: 500px " > Indent Report - < ? php echo $role_type ?> </strong>
</ td >
</ tr >
< tr >
< td align = " left " style = " font-size: 12px " >
< strong >
From Date : < ? = date ( " d-M-Y " , strtotime ( $from_date1 )) ?>
& nbsp ; & nbsp ; & nbsp ; To Date : < ? = date ( " d-M-Y " , strtotime ( $from_date2 )) ?>
</ strong >
</ td >
< td align = " right " style = " font-size: 15px " >
< button id = " printPageButton " class = " btn btn-success " onclick = " window.print(); " > Print </ button >
</ td >
</ tr >
</ table >
< br >
< table border = " 1 " width = " 100% " cellspacing = " 0 " >
< tr bgcolor = " #eeeeee " >
< td align = " left " width = " 2% " > Sr .</ td >
< td align = " left " width = " 12% " > Location </ td >
< td align = " left " width = " 12% " > Item Name </ td >
2025-08-29 16:30:39 +05:30
< td align = " left " width = " 12% " > Specifications </ td >
< td align = " left " width = " 12% " > Make </ td >
2025-04-14 13:28:09 +05:30
< td align = " left " width = " 12% " > Indent Ref No </ td >
< td align = " left " width = " 10% " > Indent Date </ td >
< td align = " left " width = " 8% " > Indent Qty </ td >
2025-08-29 16:30:39 +05:30
< td align = " left " width = " 8% " > Item Rate </ td >
2025-04-14 13:28:09 +05:30
< td align = " left " width = " 10% " > RFQ No </ td >
< td align = " left " width = " 10% " > PO Ref No </ td >
< td align = " left " width = " 10% " > PO Date </ td >
2025-10-16 15:19:10 +05:30
< td align = " left " width = " 10% " > Payment Terms </ td >
2025-04-14 13:28:09 +05:30
< td align = " left " width = " 10% " > Vendor Name </ td >
< td align = " left " width = " 13% " > GRN Ref No </ td >
</ tr >
< ? php
$ohc_filter = ( $ohc == 'All' ) ? '' : " ohc_type_id = ' $ohc ' AND " ;
$sql = " SELECT * FROM indent_master WHERE $ohc_filter role_type = ' $role_type ' AND indent_date BETWEEN ' $from_date1 ' AND ' $from_date2 ' ORDER BY indent_date DESC " ;
$result = mysqli_query ( $conn , $sql );
$count = 1 ;
while ( $row = mysqli_fetch_assoc ( $result )) {
$items_sql = " SELECT item_id,indent_qty FROM indent_items WHERE indent_id = ' " . $row [ 'indent_id' ] . " ' " ;
$items_result = mysqli_query ( $conn , $items_sql );
while ( $item_row = mysqli_fetch_assoc ( $items_result )) {
$item_name = getFieldFromTable ( 'item_name' , 'tbl_items' , 'item_id' , $item_row [ 'item_id' ]);
2025-08-29 16:30:39 +05:30
$specifications = getFieldFromTable ( 'specifications' , 'tbl_items' , 'item_id' , $item_row [ 'item_id' ]);
$make = getFieldFromTable ( 'make' , 'tbl_items' , 'item_id' , $item_row [ 'item_id' ]);
2025-04-14 13:28:09 +05:30
$indent_qty = $item_row [ 'indent_qty' ];
$po_sql = " SELECT DISTINCT pm.po_date, pm.po_no, pi.vendor_id, pi.item_id
FROM po_master pm
JOIN po_items pi ON pm . po_id = pi . po_id
WHERE pm . indent_id = '" . $row[' indent_id '] . "'
AND pi . item_id = '" . $item_row[' item_id '] . "' " ;
error_log ( $po_sql . " dipak mali " );
$po_result = mysqli_query ( $conn , $po_sql );
$pos = " " ;
$po_date = " " ;
$vendor_name = " " ;
$vendor_id = " " ;
while ( $po_row = mysqli_fetch_assoc ( $po_result )) {
$pos .= $po_row [ 'po_no' ] . " " ;
$po_date = $po_row [ 'po_date' ];
$vendor_id = $po_row [ 'vendor_id' ];
}
2025-08-29 16:30:39 +05:30
$grn_sql = " SELECT DISTINCT gm.vendor_id, gm.item_grn_no, gi.vendor_rate, gi.item_id
FROM grn_master gm
JOIN grn_items gi ON gm . grn_id = gi . grn_id
WHERE gm . indent_id = '" . $row[' indent_id '] . "'
AND gi . item_id = '" . $item_row[' item_id '] . "' " ;
2025-04-14 13:28:09 +05:30
$grn_result = mysqli_query ( $conn , $grn_sql );
$grns = " " ;
2025-08-29 16:30:39 +05:30
2025-04-14 13:28:09 +05:30
$vendor_name = " " ;
2025-08-29 16:30:39 +05:30
2025-04-14 13:28:09 +05:30
while ( $grn_row = mysqli_fetch_assoc ( $grn_result )) {
2025-08-29 16:30:39 +05:30
$grns .= $grn_row [ 'item_grn_no' ] . " " ;
2025-04-14 13:28:09 +05:30
}
$rfq_sql = " SELECT DISTINCT(rfq_no) FROM quotation_list WHERE indent_id = ' " . $row [ 'indent_id' ] . " ' " ;
$rfq_result = mysqli_query ( $conn , $rfq_sql );
$rfqs = " " ;
while ( $rfq_row = mysqli_fetch_assoc ( $rfq_result )) {
$rfqs .= $rfq_row [ 'rfq_no' ] . " " ;
}
2025-08-29 16:30:39 +05:30
$vendor_rates = '' ;
2025-10-16 15:19:10 +05:30
$rate_sql = " SELECT vendor_rate,payment_terms,rfq_qty,per_unit_rate FROM quotation_list
2025-08-29 16:30:39 +05:30
WHERE indent_id = '" . $row[' indent_id '] . "'
AND item_id = '" . $item_row[' item_id '] . "'
AND vendor_id = '$vendor_id'
ORDER BY quotation_id DESC LIMIT 1 " ;
error_log ( $rate_sql . " dushant mali " );
$rate_result = mysqli_query ( $conn , $rate_sql );
if ( $rate_row = mysqli_fetch_assoc ( $rate_result )) {
$raw_rate = $rate_row [ 'vendor_rate' ] / $rate_row [ 'rfq_qty' ];
$vendor_rates = round ( $raw_rate , 3 );
}
2025-04-14 13:28:09 +05:30
?>
< tr >
< td >< ? = $count ?> </td>
< ? php $indent_location = getFieldFromTable ( 'ohc_type_id' , 'indent_master' , 'indent_ref_no' , $row [ 'indent_ref_no' ]); ?>
< td >< ? = getFieldFromTable ( 'ohc_type_name' , 'ohc_type' , 'ohc_type_id' , $indent_location ) ?> </td>
< td >< ? = htmlspecialchars ( $item_name ) ?> </td>
2025-08-29 16:30:39 +05:30
< td >< ? = htmlspecialchars ( $specifications ) ?> </td>
< td >< ? = htmlspecialchars ( $make ) ?> </td>
2025-04-14 13:28:09 +05:30
< td >< ? = htmlspecialchars ( $row [ 'indent_ref_no' ]) ?> </td>
< td >< ? = date ( " d-m-Y " , strtotime ( $row [ 'indent_date' ])) ?> </td>
< td >< ? = $indent_qty ?> </td>
2025-08-29 16:30:39 +05:30
< td >< ? = $vendor_rates ?> </td>
2025-04-14 13:28:09 +05:30
< td >< ? = $rfqs ?> </td>
< td >< ? = $pos ?> </td>
< td >< ? php if ( $po_date ) {
echo date ( " d-m-Y " , strtotime ( $po_date ));
} ?> </td>
2025-10-16 15:19:10 +05:30
< td >< ? php echo $rate_row [ 'payment_terms' ] ?> </td>
2025-04-14 13:28:09 +05:30
< td >< ? = getFieldFromTable ( 'employer_contractor_name' , 'employer_contractor' , 'id' , $vendor_id ) ?> </td>
< td >< ? = $grns ?> </td>
</ tr >
< ? php
$count ++ ;
}
}
?>
</ table >
< div style = " text-align: center; margin-top: 20px; " >
< button id = " printPageButton " class = " btn btn-success " onclick = " window.print(); " > Print </ button >
</ div >
</ body >