fix query insert t barcode barang -> add stock ID
This commit is contained in:
@@ -1923,33 +1923,6 @@ class ReceiveItemPOAsset extends MY_Controller
|
|||||||
'BNP',
|
'BNP',
|
||||||
$item['ReceiveOrderPoItemID']
|
$item['ReceiveOrderPoItemID']
|
||||||
);
|
);
|
||||||
$sql_insert_barcode = "INSERT INTO t_barcode_barang(
|
|
||||||
T_BarcodeBarangReceiveOrderPoID,
|
|
||||||
T_BarcodeBarangReceiveOrderPoDetailID,
|
|
||||||
T_BarcodeBarangRefType,
|
|
||||||
T_BarcodeBarangM_ItemID,
|
|
||||||
T_BarcodeBarangItemUnitID,
|
|
||||||
T_BarcodeBarangNumber,
|
|
||||||
T_BarcodeBarangM_RuanganID,
|
|
||||||
T_BarcodeBarangM_BranchID,
|
|
||||||
T_BarcodeBarangIsActive,
|
|
||||||
T_BarcodeBarangUserID,
|
|
||||||
T_BarcodeBarangCreated
|
|
||||||
) VALUES(?,?,'PO',?,?,?,?,?,'Y',?,NOW())";
|
|
||||||
$que_insert_barcode = $this->db->query($sql_insert_barcode, [
|
|
||||||
$param['receiveOrderPoID'],
|
|
||||||
$item['ReceiveOrderPoDetailID'],
|
|
||||||
$item['ReceiveOrderPoItemID'],
|
|
||||||
$item['ReceiveOrderPoItemUnitID'],
|
|
||||||
$noBarcode,
|
|
||||||
$param['ruanganID'],
|
|
||||||
$user['M_BranchID'],
|
|
||||||
$user['M_UserID'],
|
|
||||||
]);
|
|
||||||
if (!$que_insert_barcode) {
|
|
||||||
throw new Exception('failed insert into t barcode barang', 1);
|
|
||||||
}
|
|
||||||
$barcodeID = $this->db->insert_id();
|
|
||||||
|
|
||||||
// check if item already in stock #
|
// check if item already in stock #
|
||||||
$sql_cekstock = "SELECT StockID
|
$sql_cekstock = "SELECT StockID
|
||||||
@@ -1969,6 +1942,36 @@ class ReceiveItemPOAsset extends MY_Controller
|
|||||||
}
|
}
|
||||||
$stockID = $que_cekstock->row_array()['StockID'];
|
$stockID = $que_cekstock->row_array()['StockID'];
|
||||||
|
|
||||||
|
$sql_insert_barcode = "INSERT INTO t_barcode_barang(
|
||||||
|
T_BarcodeBarangStockID,
|
||||||
|
T_BarcodeBarangReceiveOrderPoID,
|
||||||
|
T_BarcodeBarangReceiveOrderPoDetailID,
|
||||||
|
T_BarcodeBarangRefType,
|
||||||
|
T_BarcodeBarangM_ItemID,
|
||||||
|
T_BarcodeBarangItemUnitID,
|
||||||
|
T_BarcodeBarangNumber,
|
||||||
|
T_BarcodeBarangM_RuanganID,
|
||||||
|
T_BarcodeBarangM_BranchID,
|
||||||
|
T_BarcodeBarangIsActive,
|
||||||
|
T_BarcodeBarangUserID,
|
||||||
|
T_BarcodeBarangCreated
|
||||||
|
) VALUES(?,?,?,'PO',?,?,?,?,?,'Y',?,NOW())";
|
||||||
|
$que_insert_barcode = $this->db->query($sql_insert_barcode, [
|
||||||
|
$stockID,
|
||||||
|
$param['receiveOrderPoID'],
|
||||||
|
$item['ReceiveOrderPoDetailID'],
|
||||||
|
$item['ReceiveOrderPoItemID'],
|
||||||
|
$item['ReceiveOrderPoItemUnitID'],
|
||||||
|
$noBarcode,
|
||||||
|
$param['ruanganID'],
|
||||||
|
$user['M_BranchID'],
|
||||||
|
$user['M_UserID'],
|
||||||
|
]);
|
||||||
|
if (!$que_insert_barcode) {
|
||||||
|
throw new Exception('failed insert into t barcode barang', 1);
|
||||||
|
}
|
||||||
|
$barcodeID = $this->db->insert_id();
|
||||||
|
|
||||||
/* insert into table stock asset */
|
/* insert into table stock asset */
|
||||||
$sql_stockasset = 'INSERT INTO stock_asset (
|
$sql_stockasset = 'INSERT INTO stock_asset (
|
||||||
StockAssetStockID,
|
StockAssetStockID,
|
||||||
|
|||||||
@@ -2693,36 +2693,6 @@ class ReceiveItemPoInventaris extends MY_Controller
|
|||||||
|
|
||||||
# generate barcode number each inventory item #
|
# generate barcode number each inventory item #
|
||||||
$noBarcode = $this->generateNoBarcode($user, $param['ruanganID'], 'BNP', $item['ReceiveOrderPoItemID']);
|
$noBarcode = $this->generateNoBarcode($user, $param['ruanganID'], 'BNP', $item['ReceiveOrderPoItemID']);
|
||||||
$sql_insert_barcode = "INSERT INTO t_barcode_barang(
|
|
||||||
T_BarcodeBarangReceiveOrderPoID,
|
|
||||||
T_BarcodeBarangReceiveOrderPoDetailID,
|
|
||||||
T_BarcodeBarangRefType,
|
|
||||||
T_BarcodeBarangM_ItemID,
|
|
||||||
T_BarcodeBarangItemUnitID,
|
|
||||||
T_BarcodeBarangNumber,
|
|
||||||
T_BarcodeBarangM_RuanganID,
|
|
||||||
T_BarcodeBarangM_BranchID,
|
|
||||||
T_BarcodeBarangIsActive,
|
|
||||||
T_BarcodeBarangUserID,
|
|
||||||
T_BarcodeBarangCreated
|
|
||||||
) VALUES(?,?,'PO',?,?,?,?,?,'Y',?,NOW())";
|
|
||||||
$que_insert_barcode = $this->db->query($sql_insert_barcode, [
|
|
||||||
$param['receiveOrderPoID'],
|
|
||||||
$item['ReceiveOrderPoDetailID'],
|
|
||||||
$item['ReceiveOrderPoItemID'],
|
|
||||||
$item['ReceiveOrderPoItemUnitID'],
|
|
||||||
$noBarcode,
|
|
||||||
$param['ruanganID'],
|
|
||||||
$user['M_BranchID'],
|
|
||||||
$user['M_UserID']
|
|
||||||
]);
|
|
||||||
if (!$que_insert_barcode) {
|
|
||||||
$this->db->trans_rollback();
|
|
||||||
$this->sys_error_db("[Error] insert no barcode invetaris");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$barcodeID = $this->db->insert_id();
|
|
||||||
|
|
||||||
# check if item already in stock #
|
# check if item already in stock #
|
||||||
$sql_cekstock = "SELECT StockID
|
$sql_cekstock = "SELECT StockID
|
||||||
@@ -2744,6 +2714,39 @@ class ReceiveItemPoInventaris extends MY_Controller
|
|||||||
}
|
}
|
||||||
$stockID = $que_cekstock->row_array()['StockID'];
|
$stockID = $que_cekstock->row_array()['StockID'];
|
||||||
|
|
||||||
|
$sql_insert_barcode = "INSERT INTO t_barcode_barang(
|
||||||
|
T_BarcodeBarangStockID,
|
||||||
|
T_BarcodeBarangReceiveOrderPoID,
|
||||||
|
T_BarcodeBarangReceiveOrderPoDetailID,
|
||||||
|
T_BarcodeBarangRefType,
|
||||||
|
T_BarcodeBarangM_ItemID,
|
||||||
|
T_BarcodeBarangItemUnitID,
|
||||||
|
T_BarcodeBarangNumber,
|
||||||
|
T_BarcodeBarangM_RuanganID,
|
||||||
|
T_BarcodeBarangM_BranchID,
|
||||||
|
T_BarcodeBarangIsActive,
|
||||||
|
T_BarcodeBarangUserID,
|
||||||
|
T_BarcodeBarangCreated
|
||||||
|
) VALUES(?,?,?,'PO',?,?,?,?,?,'Y',?,NOW())";
|
||||||
|
$que_insert_barcode = $this->db->query($sql_insert_barcode, [
|
||||||
|
$stockID,
|
||||||
|
$param['receiveOrderPoID'],
|
||||||
|
$item['ReceiveOrderPoDetailID'],
|
||||||
|
$item['ReceiveOrderPoItemID'],
|
||||||
|
$item['ReceiveOrderPoItemUnitID'],
|
||||||
|
$noBarcode,
|
||||||
|
$param['ruanganID'],
|
||||||
|
$user['M_BranchID'],
|
||||||
|
$user['M_UserID']
|
||||||
|
]);
|
||||||
|
if (!$que_insert_barcode) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
$this->sys_error_db("[Error] insert no barcode invetaris");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$barcodeID = $this->db->insert_id();
|
||||||
|
|
||||||
# insert stock inventaris #
|
# insert stock inventaris #
|
||||||
$sql_stockinventaris = "INSERT INTO stock_inventory (
|
$sql_stockinventaris = "INSERT INTO stock_inventory (
|
||||||
StockInventoryStockID,
|
StockInventoryStockID,
|
||||||
|
|||||||
Reference in New Issue
Block a user