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

37 lines
1.6 KiB
PHP

<?php
error_reporting(E_ERROR | E_PARSE);
include('includes/config/config.php');
include('includes/functions.php');
$data_arr = explode("/", $_POST['indent']);
$indent_id = $data_arr[0];
$grn_no = $data_arr[1];
$sql_requisition_items="select a.*,b.*,c.item_code,trim(concat(ifnull(d.form_name,''),' ',c.item_name)) itemwithformname,b.vendor_rate from indent_master a left join grn_items b on a.indent_id = b.indent_id left join tbl_items c on c.item_id = b.item_id left join medicine_form d on d.form_id = c.item_form_id where a.indent_id='".$indent_id."' and b.status='GRN_APPROVED' and b.item_grn_no='".$grn_no."' and b.delivery_location='".$_SESSION['current_ohcttype']."'" ;
error_log("get indent query:".$sql_requisition_items);
if (!$result_requisition_items = @mysqli_query($conn,$sql_requisition_items)) {
exit(mysqli_error($conn));
}
$data = array();
if(mysqli_num_rows($result_requisition_items) > 0) {
while ($row_requisition_items = mysqli_fetch_assoc($result_requisition_items)) {
//extract($row);
$po_item_id=$row_requisition_items['po_item_id'];
error_log('po '.$po_item_id);
$qt=getTableFieldValue('po_items','quotation_no','po_item_id',$po_item_id);
error_log('qt '.$qt);
$row_requisition_items['discount']=getTableFieldValue('quotation_list','discount','quotation_no','"'.$qt.'"' ,'item_id',$row_requisition_items['item_id'] );
error_log('dis '.$row_requisition_items['discount']);
$data[] = $row_requisition_items;
}
}
else
{
$data['status'] = 200;
$data['message'] = "Data not found!";
}
// error_log("data:".print_r($data,true));
echo json_encode($data);