add query insert into table stock_inventory in func savehandover receiveitempo inventaris
This commit is contained in:
@@ -2736,15 +2736,46 @@ class ReceiveItemPoInventaris extends MY_Controller
|
|||||||
|
|
||||||
$barcodeID = $this->db->insert_id();
|
$barcodeID = $this->db->insert_id();
|
||||||
|
|
||||||
|
# check if item already in stock #
|
||||||
|
$sql_cekstock = "SELECT StockID
|
||||||
|
FROM stock
|
||||||
|
JOIN warehouse ON WarehouseID = StockWarehouseID
|
||||||
|
AND WarehouseIsActive = 'Y'
|
||||||
|
WHERE WarehouseM_BranchID = ?
|
||||||
|
AND StockItemID = ?
|
||||||
|
AND StockItemUnitID = ?";
|
||||||
|
$que_cekstock = $this->db->query($sql_cekstock, [
|
||||||
|
$user['M_BranchID'],
|
||||||
|
$item['ReceiveOrderPoItemID'],
|
||||||
|
$item['ReceiveOrderPoItemUnitID'],
|
||||||
|
]);
|
||||||
|
if (!$que_cekstock) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
$this->sys_error_db("[Error] query cek stock");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$stockID = $que_cekstock->row_array()['StockID'];
|
||||||
|
|
||||||
# insert stock inventaris #
|
# insert stock inventaris #
|
||||||
$sql_stockinventaris = "INSERT INTO stock_inventaris (
|
$sql_stockinventaris = "INSERT INTO stock_inventory (
|
||||||
StockInventoryStockID,
|
StockInventoryStockID,
|
||||||
StockInventoryRuanganID,
|
StockInventoryRuanganID,
|
||||||
StockInventoryBarcode,
|
StockInventoryBarcode,
|
||||||
StockInventoryCabangID,
|
StockInventoryBranchID,
|
||||||
StockInventoryCreatedUserID
|
StockInventoryCreatedUserID
|
||||||
) VALUES (?,?,?,?,?)";
|
) VALUES (?,?,?,?,?)";
|
||||||
$que_stockinventaris = $this->db->query($sql_stockinventaris, []);
|
$que_stockinventaris = $this->db->query($sql_stockinventaris, [
|
||||||
|
$stockID,
|
||||||
|
$param['ruanganID'],
|
||||||
|
$noBarcode,
|
||||||
|
$user['M_BranchID'],
|
||||||
|
$user['M_UserID']
|
||||||
|
]);
|
||||||
|
if (!$que_stockinventaris) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
$this->sys_error_db("[Error] insert into table stock inventaris");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
# insert each inventory handover detail #
|
# insert each inventory handover detail #
|
||||||
$sql_insert_handover_detail = "INSERT INTO asset_handover_detail(
|
$sql_insert_handover_detail = "INSERT INTO asset_handover_detail(
|
||||||
|
|||||||
Reference in New Issue
Block a user