Compare commits
17 Commits
c125289b92
...
feat/inv-c
| Author | SHA1 | Date | |
|---|---|---|---|
| 33666a2f5f | |||
| b29ba9f225 | |||
| c83c42698a | |||
| 009aff7d44 | |||
| 6dbe0e400b | |||
| 0ea56f09fa | |||
| a6412c9688 | |||
| bcb553ea56 | |||
| 2874fab71d | |||
| 752c372c2f | |||
| 7e88cf247b | |||
| 7af9fb2ca4 | |||
| 77fc97e964 | |||
| 834f23f26e | |||
| dc88589c78 | |||
| 3871a680dd | |||
| 9c87e9ce25 |
113
application/controllers/map/InventarisCoaMapping.http
Normal file
113
application/controllers/map/InventarisCoaMapping.http
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
@token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJNX1VzZXJJRCI6IjM4MCIsIk1fVXNlclVzZXJuYW1lIjoicmVnc2J5IiwiTV9Vc2VyR3JvdXBEYXNoYm9hcmQiOiJvbmUtdWlcL3Rlc3RcL3Z1ZXhcL2FjYy1vbmUtanVybmFsXC8iLCJNX1VzZXJEZWZhdWx0VF9TYW1wbGVTdGF0aW9uSUQiOiIwIiwiTV9TdGFmZk5hbWUiOiJTdGFmZiBSZWdpb25hbCIsImlzX2NvdXJpZXIiOiJOIiwidGltZV9hdXRvbG9nb3V0IjoiMTIwIiwiTV9Vc2VyTG9jYXRpb25JRCI6IjM3IiwiTV9Vc2VyTG9jYXRpb25GbGFnIjoiUiIsIlNfUmVnaW9uYWxOYW1lIjoiU3VyYWJheWEgUmF5YSIsIlNfUmVnaW9uYWxJRCI6IjYiLCJNX0JyYW5jaE5hbWUiOiIiLCJNX0JyYW5jaENvZGUiOiIiLCJNX0JyYW5jaElEIjoiMCIsImxvZ2luTGV2ZWwiOiJyZWdpb25hbCIsIk1fQnJhbmNoQ29tcGFueUlEIjoiMSIsIk1fQnJhbmNoQ29tcGFueU5hbWUiOiJQVCBQUkFNSVRBIiwiaXAiOiIxMzkuMTk1LjEyMi4yMzUiLCJhZ2VudCI6Ik1vemlsbGFcLzUuMCAoWDExOyBMaW51eCB4ODZfNjQ7IHJ2OjEzNy4wKSBHZWNrb1wvMjAxMDAxMDEgRmlyZWZveFwvMTM3LjAiLCJ2ZXJzaW9uIjoidjIiLCJsYXN0LWxvZ2luIjoiMjAyNS0wNi0wNCAxMzoyMDowNSIsIk1fU2F0ZWxsaXRlSUQiOjB9.hm6JtstjaQOzb7oDSXQ-oMWuX_jFQZH-HDr3r3OzPac"
|
||||||
|
|
||||||
|
@host = accone.aplikasi.web.id/one-api
|
||||||
|
|
||||||
|
###
|
||||||
|
// create inventaris coa mapping
|
||||||
|
POST https://{{host}}/map/InventarisCoaMapping/createInvCoaMapping/
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"token": {{token}},
|
||||||
|
"M_InventarisGolID": 1,
|
||||||
|
"CoaInventarisID": 101,
|
||||||
|
"CoaHutangID": 102,
|
||||||
|
"CoaPembelianID": 103,
|
||||||
|
"CoaBebanPenyusutanID": 104,
|
||||||
|
"CoaAkumulasiPenyusutanID": 105,
|
||||||
|
"CoaLabaPelepasanID": 106,
|
||||||
|
"CoaRugiPelepasanID": 107
|
||||||
|
}
|
||||||
|
|
||||||
|
###
|
||||||
|
// get inventaris coa mapping by ID
|
||||||
|
POST https://{{host}}/map/InventarisCoaMapping/getInvCoaMapping/
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"token": {{token}},
|
||||||
|
"M_InventarisCoaMappingID": 1
|
||||||
|
}
|
||||||
|
|
||||||
|
###
|
||||||
|
// edit inventaris coa mapping
|
||||||
|
POST https://{{host}}/map/InventarisCoaMapping/editInvCoaMapping/
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"token": {{token}},
|
||||||
|
"M_InventarisCoaMappingID": 1,
|
||||||
|
"M_InventarisGolID": 2,
|
||||||
|
"CoaInventarisID": 201,
|
||||||
|
"CoaHutangID": 202,
|
||||||
|
"CoaPembelianID": 203,
|
||||||
|
"CoaBebanPenyusutanID": 204,
|
||||||
|
"CoaAkumulasiPenyusutanID": 205,
|
||||||
|
"CoaLabaPelepasanID": 206,
|
||||||
|
"CoaRugiPelepasanID": 207
|
||||||
|
}
|
||||||
|
|
||||||
|
###
|
||||||
|
// delete inventaris coa mapping
|
||||||
|
POST https://{{host}}/map/InventarisCoaMapping/deleteInvCoaMapping/
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"token": {{token}},
|
||||||
|
"M_InventarisCoaMappingID": 1
|
||||||
|
}
|
||||||
|
|
||||||
|
###
|
||||||
|
// create inventaris item coa mapping
|
||||||
|
POST https://{{host}}/map/InventarisCoaMapping/createInvItemCoaMapping/
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"token": {{token}},
|
||||||
|
"M_ItemID": 10,
|
||||||
|
"CoaInventarisID": 201,
|
||||||
|
"CoaHutangID": 202,
|
||||||
|
"CoaPembelianID": 203,
|
||||||
|
"CoaBebanPenyusutanID": 204,
|
||||||
|
"CoaAkumulasiPenyusutanID": 205,
|
||||||
|
"CoaLabaPelepasanID": 206,
|
||||||
|
"CoaRugiPelepasanID": 207
|
||||||
|
}
|
||||||
|
|
||||||
|
###
|
||||||
|
// get inventaris item coa mapping by ID
|
||||||
|
POST https://{{host}}/map/InventarisCoaMapping/getInvItemCoaMapping/
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"token": {{token}},
|
||||||
|
"M_InventarisItemCoaMappingID": 1
|
||||||
|
}
|
||||||
|
|
||||||
|
###
|
||||||
|
// edit inventaris item coa mapping
|
||||||
|
POST https://{{host}}/map/InventarisCoaMapping/editInvItemCoaMapping/
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"token": {{token}},
|
||||||
|
"M_InventarisItemCoaMappingID": 1,
|
||||||
|
"M_ItemID": 11,
|
||||||
|
"CoaInventarisID": 301,
|
||||||
|
"CoaHutangID": 302,
|
||||||
|
"CoaPembelianID": 303,
|
||||||
|
"CoaBebanPenyusutanID": 304,
|
||||||
|
"CoaAkumulasiPenyusutanID": 305,
|
||||||
|
"CoaLabaPelepasanID": 306,
|
||||||
|
"CoaRugiPelepasanID": 307
|
||||||
|
}
|
||||||
|
|
||||||
|
###
|
||||||
|
// delete inventaris item coa mapping
|
||||||
|
POST https://{{host}}/map/InventarisCoaMapping/deleteInvItemCoaMapping/
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"token": {{token}},
|
||||||
|
"M_InventarisItemCoaMappingID": 1
|
||||||
|
}
|
||||||
361
application/controllers/map/InventarisCoaMapping.php
Normal file
361
application/controllers/map/InventarisCoaMapping.php
Normal file
@@ -0,0 +1,361 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
class InventarisCoaMapping extends MY_Controller {
|
||||||
|
var $db;
|
||||||
|
public function index() {
|
||||||
|
echo "Inventaris COA Mapping API";
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
## MUTATIONS ##
|
||||||
|
public function createInvCoaMapping() {
|
||||||
|
try {
|
||||||
|
if (!$this->isLogin) {
|
||||||
|
$this->sys_error("invalid token");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->trans_begin();
|
||||||
|
|
||||||
|
$para = $this->sys_input;
|
||||||
|
$user = $this->sys_user;
|
||||||
|
|
||||||
|
$sql = "INSERT INTO m_inventaris_coa_mapping (
|
||||||
|
M_InventarisCoaMappingM_InventarisGolID,
|
||||||
|
M_InventarisCoaMappingCoaInventarisID,
|
||||||
|
M_InventarisCoaMappingCoaHutangID,
|
||||||
|
M_InventarisCoaMappingCoaPembelianID,
|
||||||
|
M_InventarisCoaMappingCoaBebanPenyusutanID,
|
||||||
|
M_InventarisCoaMappingCoaAkumulasiPenyusutanID,
|
||||||
|
M_InventarisCoaMappingCoaLabaPelepasanID,
|
||||||
|
M_InventarisCoaMappingCoaRugiPelepasanID,
|
||||||
|
M_InventarisCoaMappingCreatedUserID,
|
||||||
|
M_InventarisCoaMappingCreated,
|
||||||
|
M_InventarisCoaMappingLastUpdated
|
||||||
|
) VALUES (?,?,?,?,?,?,?,?,?,NOW(),NOW())";
|
||||||
|
$query = $this->db->query($sql, [
|
||||||
|
$para['M_InventarisGolID'],
|
||||||
|
$para['CoaInventarisID'],
|
||||||
|
$para['CoaHutangID'],
|
||||||
|
$para['CoaPembelianID'],
|
||||||
|
$para['CoaBebanPenyusutanID'],
|
||||||
|
$para['CoaAkumulasiPenyusutanID'],
|
||||||
|
$para['CoaLabaPelepasanID'],
|
||||||
|
$para['CoaRugiPelepasanID'],
|
||||||
|
$user['M_UserID']
|
||||||
|
]);
|
||||||
|
if (!$query) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
$this->sys_error_db("[Error] insert into table m_inventaris_coa_mapping");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$insertID = $this->db->insert_id();
|
||||||
|
|
||||||
|
$this->db->trans_commit();
|
||||||
|
$this->sys_ok($insertID);
|
||||||
|
} catch (Exception $exc) {
|
||||||
|
$msg = $exc->getMessage();
|
||||||
|
$this->sys_error($msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
## QUERY ##
|
||||||
|
public function getInvCoaMapping() {
|
||||||
|
try {
|
||||||
|
if (!$this->isLogin) {
|
||||||
|
$this->sys_error("invalid token");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$para = $this->sys_input;
|
||||||
|
|
||||||
|
$sql = "SELECT
|
||||||
|
M_InventarisCoaMappingID,
|
||||||
|
M_InventarisCoaMappingM_InventarisGolID,
|
||||||
|
M_InventarisCoaMappingCoaInventarisID,
|
||||||
|
M_InventarisCoaMappingCoaHutangID,
|
||||||
|
M_InventarisCoaMappingCoaPembelianID,
|
||||||
|
M_InventarisCoaMappingCoaBebanPenyusutanID,
|
||||||
|
M_InventarisCoaMappingCoaAkumulasiPenyusutanID,
|
||||||
|
M_InventarisCoaMappingCoaLabaPelepasanID,
|
||||||
|
M_InventarisCoaMappingCoaRugiPelepasanID,
|
||||||
|
M_InventarisCoaMappingCreatedUserID,
|
||||||
|
M_InventarisCoaMappingCreated,
|
||||||
|
M_InventarisCoaMappingLastUpdated
|
||||||
|
FROM m_inventaris_coa_mapping
|
||||||
|
WHERE M_InventarisCoaMappingIsActive = 'Y'
|
||||||
|
AND M_InventarisCoaMappingID = ?";
|
||||||
|
$query = $this->db->query($sql, [$para['M_InventarisCoaMappingID']]);
|
||||||
|
if (!$query) {
|
||||||
|
$this->sys_error_db("[Error] get data m_inventaris_coa_mapping");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$data = $query->row_array();
|
||||||
|
|
||||||
|
$this->sys_ok($data);
|
||||||
|
} catch (Exception $exc) {
|
||||||
|
$msg = $exc->getMessage();
|
||||||
|
$this->sys_error($msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
## MUTATIONS ##
|
||||||
|
public function editInvCoaMapping() {
|
||||||
|
try {
|
||||||
|
if (!$this->isLogin) {
|
||||||
|
$this->sys_error("invalid token");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->trans_begin();
|
||||||
|
|
||||||
|
$para = $this->sys_input;
|
||||||
|
$user = $this->sys_user;
|
||||||
|
|
||||||
|
$sql = "UPDATE m_inventaris_coa_mapping SET
|
||||||
|
M_InventarisCoaMappingM_InventarisGolID = ?,
|
||||||
|
M_InventarisCoaMappingCoaInventarisID = ?,
|
||||||
|
M_InventarisCoaMappingCoaHutangID = ?,
|
||||||
|
M_InventarisCoaMappingCoaPembelianID = ?,
|
||||||
|
M_InventarisCoaMappingCoaBebanPenyusutanID = ?,
|
||||||
|
M_InventarisCoaMappingCoaAkumulasiPenyusutanID = ?,
|
||||||
|
M_InventarisCoaMappingCoaLabaPelepasanID = ?,
|
||||||
|
M_InventarisCoaMappingCoaRugiPelepasanID = ?,
|
||||||
|
M_InventarisCoaMappingLastUpdated = NOW()
|
||||||
|
WHERE M_InventarisCoaMappingIsActive = 'Y'
|
||||||
|
AND M_InventarisCoaMappingID = ?";
|
||||||
|
$query = $this->db->query($sql, [
|
||||||
|
$para['M_InventarisGolID'],
|
||||||
|
$para['CoaInventarisID'],
|
||||||
|
$para['CoaHutangID'],
|
||||||
|
$para['CoaPembelianID'],
|
||||||
|
$para['CoaBebanPenyusutanID'],
|
||||||
|
$para['CoaAkumulasiPenyusutanID'],
|
||||||
|
$para['CoaLabaPelepasanID'],
|
||||||
|
$para['CoaRugiPelepasanID'],
|
||||||
|
$para['M_InventarisCoaMappingID']
|
||||||
|
]);
|
||||||
|
if (!$query) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
$this->sys_error_db("[Error] update table m_inventaris_coa_mapping");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->trans_commit();
|
||||||
|
$this->sys_ok("[Success] update data inventaris coa mapping");
|
||||||
|
} catch (Exception $exc) {
|
||||||
|
$msg = $exc->getMessage();
|
||||||
|
$this->sys_error($msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteInvCoaMapping() {
|
||||||
|
try {
|
||||||
|
if (!$this->isLogin) {
|
||||||
|
$this->sys_error("invalid token");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->trans_begin();
|
||||||
|
|
||||||
|
$para = $this->sys_input;
|
||||||
|
|
||||||
|
$sql = "UPDATE m_inventaris_coa_mapping SET
|
||||||
|
M_InventarisCoaMappingIsActive = 'N',
|
||||||
|
M_InventarisCoaMappingLastUpdated = NOW()
|
||||||
|
WHERE M_InventarisCoaMappingIsActive = 'Y'
|
||||||
|
AND M_InventarisCoaMappingID = ?";
|
||||||
|
$query = $this->db->query($sql, [$para['M_InventarisCoaMappingID']]);
|
||||||
|
if (!$query) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
$this->sys_error_db("[Error] soft delete data m_inventaris_coa_mapping");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->trans_commit();
|
||||||
|
$this->sys_ok("[Success] delete data inventaris coa mapping");
|
||||||
|
} catch (Exception $exc) {
|
||||||
|
$msg = $exc->getMessage();
|
||||||
|
$this->sys_error($msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
## MUTATIONS ITEM ##
|
||||||
|
public function createInvItemCoaMapping() {
|
||||||
|
try {
|
||||||
|
if (!$this->isLogin) {
|
||||||
|
$this->sys_error("invalid token");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->trans_begin();
|
||||||
|
|
||||||
|
$para = $this->sys_input;
|
||||||
|
$user = $this->sys_user;
|
||||||
|
|
||||||
|
$sql = "INSERT INTO m_inventaris_item_coa_mapping (
|
||||||
|
M_InventarisItemCoaMappingM_ItemID,
|
||||||
|
M_InventarisItemCoaMappingCoaInventarisID,
|
||||||
|
M_InventarisItemCoaMappingCoaHutangID,
|
||||||
|
M_InventarisItemCoaMappingCoaPembelianID,
|
||||||
|
M_InventarisItemCoaMappingCoaBebanPenyusutanID,
|
||||||
|
M_InventarisItemCoaMappingCoaAkumulasiPenyusutanID,
|
||||||
|
M_InventarisItemCoaMappingCoaLabaPelepasanID,
|
||||||
|
M_InventarisItemCoaMappingCoaRugiPelepasanID,
|
||||||
|
M_InventarisItemCoaMappingCreatedUserID,
|
||||||
|
M_InventarisItemCoaMappingCreated,
|
||||||
|
M_InventarisItemCoaMappingLastUpdated
|
||||||
|
) VALUES (?,?,?,?,?,?,?,?,?,NOW(),NOW())";
|
||||||
|
$query = $this->db->query($sql, [
|
||||||
|
$para['M_ItemID'],
|
||||||
|
$para['CoaInventarisID'],
|
||||||
|
$para['CoaHutangID'],
|
||||||
|
$para['CoaPembelianID'],
|
||||||
|
$para['CoaBebanPenyusutanID'],
|
||||||
|
$para['CoaAkumulasiPenyusutanID'],
|
||||||
|
$para['CoaLabaPelepasanID'],
|
||||||
|
$para['CoaRugiPelepasanID'],
|
||||||
|
$user['M_UserID']
|
||||||
|
]);
|
||||||
|
if (!$query) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
$this->sys_error_db("[Error] insert into table m_inventaris_item_coa_mapping");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$insertID = $this->db->insert_id();
|
||||||
|
|
||||||
|
$this->db->trans_commit();
|
||||||
|
$this->sys_ok($insertID);
|
||||||
|
} catch (Exception $exc) {
|
||||||
|
$msg = $exc->getMessage();
|
||||||
|
$this->sys_error($msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
## QUERY ITEM ##
|
||||||
|
public function getInvItemCoaMapping() {
|
||||||
|
try {
|
||||||
|
if (!$this->isLogin) {
|
||||||
|
$this->sys_error("invalid token");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$para = $this->sys_input;
|
||||||
|
|
||||||
|
$sql = "SELECT
|
||||||
|
M_InventarisItemCoaMappingID,
|
||||||
|
M_InventarisItemCoaMappingM_ItemID,
|
||||||
|
M_InventarisItemCoaMappingCoaInventarisID,
|
||||||
|
M_InventarisItemCoaMappingCoaHutangID,
|
||||||
|
M_InventarisItemCoaMappingCoaPembelianID,
|
||||||
|
M_InventarisItemCoaMappingCoaBebanPenyusutanID,
|
||||||
|
M_InventarisItemCoaMappingCoaAkumulasiPenyusutanID,
|
||||||
|
M_InventarisItemCoaMappingCoaLabaPelepasanID,
|
||||||
|
M_InventarisItemCoaMappingCoaRugiPelepasanID,
|
||||||
|
M_InventarisItemCoaMappingCreatedUserID,
|
||||||
|
M_InventarisItemCoaMappingCreated,
|
||||||
|
M_InventarisItemCoaMappingLastUpdated
|
||||||
|
FROM m_inventaris_item_coa_mapping
|
||||||
|
WHERE M_InventarisItemCoaMappingIsActive = 'Y'
|
||||||
|
AND M_InventarisItemCoaMappingID = ?";
|
||||||
|
$query = $this->db->query($sql, [$para['M_InventarisItemCoaMappingID']]);
|
||||||
|
if (!$query) {
|
||||||
|
$this->sys_error_db("[Error] get data m_inventaris_item_coa_mapping");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$data = $query->row_array();
|
||||||
|
|
||||||
|
$this->sys_ok($data);
|
||||||
|
} catch (Exception $exc) {
|
||||||
|
$msg = $exc->getMessage();
|
||||||
|
$this->sys_error($msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
## MUTATIONS ITEM ##
|
||||||
|
public function editInvItemCoaMapping() {
|
||||||
|
try {
|
||||||
|
if (!$this->isLogin) {
|
||||||
|
$this->sys_error("invalid token");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->trans_begin();
|
||||||
|
|
||||||
|
$para = $this->sys_input;
|
||||||
|
$user = $this->sys_user;
|
||||||
|
|
||||||
|
$sql = "UPDATE m_inventaris_item_coa_mapping SET
|
||||||
|
M_InventarisItemCoaMappingM_ItemID = ?,
|
||||||
|
M_InventarisItemCoaMappingCoaInventarisID = ?,
|
||||||
|
M_InventarisItemCoaMappingCoaHutangID = ?,
|
||||||
|
M_InventarisItemCoaMappingCoaPembelianID = ?,
|
||||||
|
M_InventarisItemCoaMappingCoaBebanPenyusutanID = ?,
|
||||||
|
M_InventarisItemCoaMappingCoaAkumulasiPenyusutanID = ?,
|
||||||
|
M_InventarisItemCoaMappingCoaLabaPelepasanID = ?,
|
||||||
|
M_InventarisItemCoaMappingCoaRugiPelepasanID = ?,
|
||||||
|
M_InventarisItemCoaMappingLastUpdated = NOW()
|
||||||
|
WHERE M_InventarisItemCoaMappingIsActive = 'Y'
|
||||||
|
AND M_InventarisItemCoaMappingID = ?";
|
||||||
|
$query = $this->db->query($sql, [
|
||||||
|
$para['M_ItemID'],
|
||||||
|
$para['CoaInventarisID'],
|
||||||
|
$para['CoaHutangID'],
|
||||||
|
$para['CoaPembelianID'],
|
||||||
|
$para['CoaBebanPenyusutanID'],
|
||||||
|
$para['CoaAkumulasiPenyusutanID'],
|
||||||
|
$para['CoaLabaPelepasanID'],
|
||||||
|
$para['CoaRugiPelepasanID'],
|
||||||
|
$para['M_InventarisItemCoaMappingID']
|
||||||
|
]);
|
||||||
|
if (!$query) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
$this->sys_error_db("[Error] update table m_inventaris_item_coa_mapping");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->trans_commit();
|
||||||
|
$this->sys_ok("[Success] update data inventaris item coa mapping");
|
||||||
|
} catch (Exception $exc) {
|
||||||
|
$msg = $exc->getMessage();
|
||||||
|
$this->sys_error($msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteInvItemCoaMapping() {
|
||||||
|
try {
|
||||||
|
if (!$this->isLogin) {
|
||||||
|
$this->sys_error("invalid token");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->trans_begin();
|
||||||
|
|
||||||
|
$para = $this->sys_input;
|
||||||
|
|
||||||
|
$sql = "UPDATE m_inventaris_item_coa_mapping SET
|
||||||
|
M_InventarisItemCoaMappingIsActive = 'N',
|
||||||
|
M_InventarisItemCoaMappingLastUpdated = NOW()
|
||||||
|
WHERE M_InventarisItemCoaMappingIsActive = 'Y'
|
||||||
|
AND M_InventarisItemCoaMappingID = ?";
|
||||||
|
$query = $this->db->query($sql, [$para['M_InventarisItemCoaMappingID']]);
|
||||||
|
if (!$query) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
$this->sys_error_db("[Error] soft delete data m_inventaris_item_coa_mapping");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->trans_commit();
|
||||||
|
$this->sys_ok("[Success] delete data inventaris item coa mapping");
|
||||||
|
} catch (Exception $exc) {
|
||||||
|
$msg = $exc->getMessage();
|
||||||
|
$this->sys_error($msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -236,6 +236,17 @@ Content-Type: application/json
|
|||||||
"poID": 1
|
"poID": 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
###
|
||||||
|
// update approval PO — verifikasi manager (level 1)
|
||||||
|
POST https://{{host}}/mockup/purchase/order/PurchaseOrderAset/updateApprovalPO/
|
||||||
|
Content-Type: application/json
|
||||||
|
|
||||||
|
{
|
||||||
|
"token": {{token}},
|
||||||
|
"poID": 1,
|
||||||
|
"approvelevel": "1"
|
||||||
|
}
|
||||||
|
|
||||||
###
|
###
|
||||||
// get data kontrak po asset
|
// get data kontrak po asset
|
||||||
POST https://{{host}}/mockup/purchase/order/PurchaseOrderAset/getDataKontrakPoAset/
|
POST https://{{host}}/mockup/purchase/order/PurchaseOrderAset/getDataKontrakPoAset/
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class PurchaseOrderAset extends MY_Controller
|
class PurchaseOrderAset extends MY_Controller {
|
||||||
{
|
|
||||||
var $db;
|
var $db;
|
||||||
public function index()
|
public function index() {
|
||||||
{
|
|
||||||
echo "Purchase Order Aset API";
|
echo "Purchase Order Aset API";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -14,11 +12,11 @@ class PurchaseOrderAset extends MY_Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
## QUERY ##
|
## QUERY ##
|
||||||
public function getListSupplier()
|
public function getListSupplier() {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
if (!$this->isLogin) {
|
if (!$this->isLogin) {
|
||||||
throw new Exception('Invalid token');
|
$this->sys_error("invalid token");
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
@@ -28,31 +26,26 @@ class PurchaseOrderAset extends MY_Controller
|
|||||||
WHERE SupplierIsActive = 'Y'";
|
WHERE SupplierIsActive = 'Y'";
|
||||||
$que = $this->db->query($sql, []);
|
$que = $this->db->query($sql, []);
|
||||||
if (!$que) {
|
if (!$que) {
|
||||||
throw new Exception('failed to query list supplier', 1);
|
$this->sys_error_db("[Error] get data supplier");
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = $que->result_array();
|
$data = $que->result_array();
|
||||||
$this->sys_ok($data);
|
$this->sys_ok($data);
|
||||||
} catch (Exception $exc) {
|
} catch (Exception $exc) {
|
||||||
$msg = '[Error] ' . $exc->getMessage();
|
$this->sys_error($exc->getMessage());
|
||||||
$code = $exc->getCode();
|
|
||||||
if ($code == 0) {
|
|
||||||
$this->sys_error($msg);
|
|
||||||
} else {
|
|
||||||
$this->sys_error_db($msg);
|
|
||||||
}
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getListCabang()
|
public function getListCabang() {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
if (!$this->isLogin) {
|
if (!$this->isLogin) {
|
||||||
throw new Exception('Invalid token');
|
$this->sys_error("invalid token");
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = $this->sys_user;
|
$user = $this->sys_user;
|
||||||
|
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
M_BranchID,
|
M_BranchID,
|
||||||
M_BranchCode,
|
M_BranchCode,
|
||||||
@@ -62,28 +55,22 @@ class PurchaseOrderAset extends MY_Controller
|
|||||||
AND M_BranchS_RegionalID = ?";
|
AND M_BranchS_RegionalID = ?";
|
||||||
$que = $this->db->query($sql, [$user['S_RegionalID']]);
|
$que = $this->db->query($sql, [$user['S_RegionalID']]);
|
||||||
if (!$que) {
|
if (!$que) {
|
||||||
throw new Exception('failed to query list cabang', 1);
|
$this->sys_error_db("[Error] failed get list cabang");
|
||||||
}
|
|
||||||
$data = $que->result_array();
|
|
||||||
|
|
||||||
$this->sys_ok($data);
|
|
||||||
} catch (Exception $exc) {
|
|
||||||
$msg = '[Error] ' . $exc->getMessage();
|
|
||||||
$code = $exc->getCode();
|
|
||||||
if ($code == 0) {
|
|
||||||
$this->sys_error($msg);
|
|
||||||
} else {
|
|
||||||
$this->sys_error_db($msg);
|
|
||||||
}
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$data = $que->result_array();
|
||||||
|
$this->sys_ok($data);
|
||||||
|
} catch (Exception $exc) {
|
||||||
|
$this->sys_error($exc->getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function searchRequestAset()
|
public function searchRequestAset() {
|
||||||
{
|
|
||||||
try {
|
try {
|
||||||
if (!$this->isLogin) {
|
if (!$this->isLogin) {
|
||||||
throw new Exception('Invalid token');
|
$this->sys_error("invalid token");
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$para = $this->sys_input;
|
$para = $this->sys_input;
|
||||||
@@ -145,25 +132,22 @@ class PurchaseOrderAset extends MY_Controller
|
|||||||
|
|
||||||
$sql_data = $sql . " LIMIT ? OFFSET ? ";
|
$sql_data = $sql . " LIMIT ? OFFSET ? ";
|
||||||
$que_data = $this->db->query($sql_data, [
|
$que_data = $this->db->query($sql_data, [
|
||||||
$para['branchcode'],
|
$para['branchcode'], $keyword, $para['supplierID'],
|
||||||
$keyword,
|
$limit, $offset
|
||||||
$para['supplierID'],
|
|
||||||
$limit,
|
|
||||||
$offset
|
|
||||||
]);
|
]);
|
||||||
if (!$que_data) {
|
if (!$que_data) {
|
||||||
throw new Exception('failed to query data request order aset', 1);
|
$this->sys_error_db("[Error] get daftar request data");
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
$data = $que_data->result_array();
|
$data = $que_data->result_array();
|
||||||
|
|
||||||
$sql_total = "SELECT COUNT(*) AS total FROM ($sql) AS x";
|
$sql_total = "SELECT COUNT(*) AS total FROM ($sql) AS x";
|
||||||
$que_total = $this->db->query($sql_total, [
|
$que_total = $this->db->query($sql_total, [
|
||||||
$para['branchcode'],
|
$para['branchcode'], $keyword, $para['supplierID']
|
||||||
$keyword,
|
|
||||||
$para['supplierID']
|
|
||||||
]);
|
]);
|
||||||
if (!$que_total) {
|
if (!$que_total) {
|
||||||
throw new Exception('failed to query total request order aset', 1);
|
$this->sys_error_db("[Error] get total request aset");
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
$total = $que_total->row_array()['total'];
|
$total = $que_total->row_array()['total'];
|
||||||
|
|
||||||
@@ -174,14 +158,7 @@ class PurchaseOrderAset extends MY_Controller
|
|||||||
|
|
||||||
$this->sys_ok($out);
|
$this->sys_ok($out);
|
||||||
} catch (Exception $exc) {
|
} catch (Exception $exc) {
|
||||||
$msg = '[Error] ' . $exc->getMessage();
|
$this->sys_error($exc->getMessage());
|
||||||
$code = $exc->getCode();
|
|
||||||
if ($code == 0) {
|
|
||||||
$this->sys_error($msg);
|
|
||||||
} else {
|
|
||||||
$this->sys_error_db($msg);
|
|
||||||
}
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1125,33 +1102,91 @@ class PurchaseOrderAset extends MY_Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function updateApprovalPO() {
|
||||||
|
try {
|
||||||
|
if (!$this->isLogin) {
|
||||||
|
$this->sys_error("invalid token");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->trans_begin();
|
||||||
|
$para = $this->sys_input;
|
||||||
|
$user = $this->sys_user;
|
||||||
|
$approvelevel = $para['approvelevel'];
|
||||||
|
|
||||||
|
/* request purchase order */
|
||||||
|
if ($approvelevel == '0') {
|
||||||
|
$sql = "UPDATE purchase_order SET
|
||||||
|
PurchaseOrderStatus = 'Pending',
|
||||||
|
PurchaseOrderLastUpdated = NOW()
|
||||||
|
WHERE PurchaseOrderID = ?
|
||||||
|
AND PurchaseOrderIsActive = 'Y'";
|
||||||
|
$que = $this->db->query($sql, [$para['poID']]);
|
||||||
|
if (!$que) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
$this->sys_error_db("[Error] failed update table purchase order request");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* verifikasi oleh manager */
|
||||||
|
if ($approvelevel == '1') {
|
||||||
|
$sql = "UPDATE purchase_order SET
|
||||||
|
PurchaseOrderApprovedManagerUserID = ?,
|
||||||
|
PurchaseOrderLastUpdated = NOW()
|
||||||
|
WHERE PurchaseOrderID = ?
|
||||||
|
AND PurchaseOrderIsActive = 'Y'";
|
||||||
|
$que = $this->db->query($sql, [$user['M_UserID'], $para['poID']]);
|
||||||
|
if (!$que) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
$this->sys_error_db("[Error] failed update table purchase order verif");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* approval oleh kepala regional */
|
||||||
|
if ($approvelevel == '2') {
|
||||||
|
$sql = "UPDATE purchase_order SET
|
||||||
|
PurchaseOrderStatus = 'Approved',
|
||||||
|
PurchaseOrderLastUpdated = NOW(),
|
||||||
|
PurchaseOrderApprovedUserID = ?
|
||||||
|
WHERE PurchaseOrderID = ?
|
||||||
|
AND PurchaseOrderIsActive = 'Y'";
|
||||||
|
$que = $this->db->query($sql, [$user['M_UserID'], $para['poID']]);
|
||||||
|
if (!$que) {
|
||||||
|
$this->db->trans_rollback();
|
||||||
|
$this->sys_error_db("[Error] failed update table purchase order approve");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->trans_commit();
|
||||||
|
$this->sys_ok("[Success] success update status PO Asset");
|
||||||
|
} catch (Exception $exc) {
|
||||||
|
$msg = $exc->getMessage();
|
||||||
|
$this->sys_error($msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function getUserApproveLevel() {
|
public function getUserApproveLevel() {
|
||||||
try {
|
try {
|
||||||
if (!$this->isLogin) {
|
if (!$this->isLogin) {
|
||||||
throw new Exception('Invalid token');
|
$this->sys_error("invalid token");
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = $this->sys_user;
|
$user = $this->sys_user;
|
||||||
$sql = "SELECT M_UserM_ApproveLevelID
|
$sql = "SELECT M_UserM_ApproveLevelID FROM m_user
|
||||||
FROM m_user
|
WHERE M_UserIsActive = 'Y' AND M_UserID = ? ";
|
||||||
WHERE M_UserIsActive = 'Y'
|
|
||||||
AND M_UserID = ? ";
|
|
||||||
$que = $this->db->query($sql, [$user['M_UserID']]);
|
$que = $this->db->query($sql, [$user['M_UserID']]);
|
||||||
if (!$que) {
|
if (!$que) {
|
||||||
throw new Exception('failed to query approval level', 1);
|
$this->sys_error_db("[Error] failed get approval level user");
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
$data = $que->row_array();
|
$data = $que->row_array();
|
||||||
|
|
||||||
$this->sys_ok($data);
|
$this->sys_ok($data);
|
||||||
} catch (Exception $exc) {
|
} catch (Exception $exc) {
|
||||||
$msg = '[Error] ' . $exc->getMessage();
|
$this->sys_error($exc->getMessage());
|
||||||
$code = $exc->getCode();
|
|
||||||
if ($code == 0) {
|
|
||||||
$this->sys_error($msg);
|
|
||||||
} else {
|
|
||||||
$this->sys_error_db($msg);
|
|
||||||
}
|
|
||||||
exit;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user