csrtechnew.ohctech.in/stock_update.php

43 lines
1.3 KiB
PHP
Raw Permalink Normal View History

2025-04-14 13:28:09 +05:30
<?php
include('includes/config/config.php');
include ('includes/functions.php');
include ('log_entry.php');
error_log ( "Start Printing Request Attributes" );
$requestStr="";
foreach ( $_REQUEST as $key => $value ) {
$requestStr.=$key . " : " . $value . "\n";
error_log ( $key . " : " . $value . "<br />\r\n" );
}
error_log ( "End Printing Request Attributes" );
save_log($requestStr,'Dispensary Stock','SAVE','stock_update.php');
$itemId = $_POST['stock_item_id'];
echo $itemId;
$stock_qty = $_POST['stock_qty'];
$check_item="select item_id from item_stock_dispensary where item_id='".$itemId."' and ohc_location_id='".$_SESSION['current_ohcttype']."' ";
$check_items=mysqli_query($conn,$check_item);
$row_check =@mysqli_num_rows ( $check_items );
$query="";
if($row_check>0)
{
$query = "update item_stock_dispensary set stock_qty = '$stock_qty' where item_id='".$itemId."' and ohc_location_id='".$_SESSION['current_ohcttype']."'";
}
else{
$query = "insert into item_stock_dispensary set item_id = '$itemId',stock_qty = '$stock_qty' , ohc_location_id='".$_SESSION['current_ohcttype']."'";
}
if (!$result = @mysqli_query($conn,$query)) {
error_log("Error saving Item stock".mysqli_error($conn).". Error Query:".$query);
exit(mysqli_error($conn));
}
?>