710 lines
31 KiB
JavaScript
710 lines
31 KiB
JavaScript
import * as api from "../api/a_coa.js"
|
|
|
|
export default {
|
|
namespaced: true,
|
|
state: {
|
|
MapNatGroup_ID:0,
|
|
a_errors_save_coa: [],
|
|
a_selected_a_coa: {},
|
|
a_coas: [],
|
|
a_save_status: 0,
|
|
a_save_error_message: '',
|
|
a_msg_success: '',
|
|
a_msg_info: '',
|
|
a_open_dialog_info: false,
|
|
a_alert_error: false,
|
|
a_alert_success: false,
|
|
a_loading_coa_list: false,
|
|
a_loading_nat_group: false,
|
|
e_loading_nat_group: false,
|
|
|
|
a_loading_coa_uang_muka: false,
|
|
e_loading_coa_uang_muka: false,
|
|
a_loading_coa_hutang: false,
|
|
e_loading_coa_hutang: false,
|
|
a_loading_coa_disc_pendapatan: false,
|
|
e_loading_coa_disc_pendapatan: false,
|
|
a_loading_coa_retur_pendapatan: false,
|
|
dialog_add_coa: false,
|
|
dialog_edit_coa: false,
|
|
// search table
|
|
a_x_search: '',
|
|
a_current_page: 1,
|
|
a_last_id: -1,
|
|
a_total_coa: 0,
|
|
// search table
|
|
// dropdown add nat_group
|
|
a_nat_group_list: [],
|
|
a_nat_group: {},
|
|
e_nat_group_list:[],
|
|
e_nat_group: {},
|
|
// dropdown add nat_group
|
|
// ac add uang muka
|
|
a_coa_uang_muka_list: [],
|
|
a_coa_uang_muka: {},
|
|
a_coa_search_uang_muka: '',
|
|
e_coa_uang_muka_list: [],
|
|
e_coa_uang_muka: {},
|
|
// ac add uang muka
|
|
// ac add hutang
|
|
a_coa_hutang_list: [],
|
|
a_coa_hutang: {},
|
|
a_coa_search_hutang: '',
|
|
e_coa_hutang_list: [],
|
|
e_coa_hutang: {},
|
|
// ac add hutang
|
|
// ac add disc pendapatan
|
|
a_coa_disc_pendapatan_list: [],
|
|
a_coa_disc_pendapatan: {},
|
|
a_coa_search_disc_pendapatan: '',
|
|
|
|
e_coa_disc_pendapatan_list: [],
|
|
e_coa_disc_pendapatan: {},
|
|
// ac add disc pendapatan
|
|
// ac add retur pendapatan
|
|
a_coa_retur_pendapatan_list: [],
|
|
a_coa_retur_pendapatan: {},
|
|
a_coa_search_retur_pendapatan: '',
|
|
|
|
e_coa_retur_pendapatan_list: [],
|
|
e_coa_retur_pendapatan: {},
|
|
// ac add retur pendapatan
|
|
|
|
},
|
|
mutations: {
|
|
update_MapNatGroup_ID(state,val){
|
|
state.MapNatGroup_ID = val
|
|
},
|
|
update_a_errors_save_coa(state, val){
|
|
state.a_errors_save_coa = val
|
|
},
|
|
update_a_search_error_message(state, val) {
|
|
state.a_search_error_message = val
|
|
},
|
|
update_a_search_status(state, val) {
|
|
state.a_search_status = val
|
|
},
|
|
update_a_selected_a_coa(state, val) {
|
|
state.a_selected_a_coa = val
|
|
},
|
|
update_a_a_coas(state, val) {
|
|
state.a_coas = val
|
|
},
|
|
update_a_open_dialog_info(state, val) {
|
|
state.a_open_dialog_info = val
|
|
},
|
|
update_a_msg_info(state, val) {
|
|
state.a_msg_info = val
|
|
},
|
|
update_a_x_search(state, val) {
|
|
state.a_x_search = val
|
|
},
|
|
update_a_current_page(state, val) {
|
|
state.a_current_page = val
|
|
},
|
|
update_a_last_id(state, val) {
|
|
state.a_last_id = val
|
|
},
|
|
update_a_total_coa(state, val) {
|
|
state.a_total_coa = val
|
|
},
|
|
update_a_msg_success(state, val) {
|
|
state.a_msg_success = val
|
|
},
|
|
update_a_save_status(state, val) {
|
|
state.a_save_status = val
|
|
},
|
|
update_a_save_error_message(state, val) {
|
|
state.a_save_error_message = val
|
|
},
|
|
update_a_alert_success(state, val) {
|
|
state.a_alert_success = val
|
|
},
|
|
update_a_alert_error(state, val) {
|
|
state.a_alert_error = val
|
|
},
|
|
update_dialog_add_coa(state, val) {
|
|
state.dialog_add_coa = val
|
|
},
|
|
update_dialog_edit_coa(state, val) {
|
|
state.dialog_edit_coa = val
|
|
},
|
|
update_a_loading_nat_group(state, val) {
|
|
state.a_loading_nat_group = val
|
|
},
|
|
update_e_loading_nat_group(state, val) {
|
|
state.e_loading_nat_group = val
|
|
},
|
|
update_a_nat_group(state, val) {
|
|
state.a_nat_group = val
|
|
},
|
|
update_e_nat_group(state, val) {
|
|
state.e_nat_group = val
|
|
},
|
|
update_a_nat_group_list(state, val) {
|
|
state.a_nat_group_list = val
|
|
},
|
|
update_e_nat_group_list(state, val) {
|
|
state.e_nat_group_list = val
|
|
},
|
|
// uang muka
|
|
update_a_loading_coa_uang_muka(state, val) {
|
|
state.a_loading_coa_uang_muka = val
|
|
},
|
|
update_e_loading_coa_uang_muka(state, val) {
|
|
state.e_loading_coa_uang_muka = val
|
|
},
|
|
update_a_coa_uang_muka(state, val) {
|
|
state.a_coa_uang_muka = val
|
|
},
|
|
update_e_coa_uang_muka(state, val) {
|
|
state.e_coa_uang_muka = val
|
|
},
|
|
update_a_coa_uang_muka_list(state, val) {
|
|
state.a_coa_uang_muka_list = val
|
|
},
|
|
update_e_coa_uang_muka_list(state, val) {
|
|
state.e_coa_uang_muka_list = val
|
|
},
|
|
update_a_coa_search_uang_muka(state, val) {
|
|
state.a_coa_search_uang_muka = val
|
|
},
|
|
// hutang
|
|
update_a_coa_hutang(state, val) {
|
|
state.a_coa_hutang = val
|
|
},
|
|
update_a_coa_hutang_list(state, val) {
|
|
state.a_coa_hutang_list = val
|
|
},
|
|
update_a_coa_search_hutang(state, val) {
|
|
state.a_coa_search_hutang = val
|
|
},
|
|
update_a_loading_coa_hutang(state, val) {
|
|
state.a_loading_coa_hutang = val
|
|
},
|
|
|
|
update_e_coa_hutang(state, val) {
|
|
state.e_coa_hutang = val
|
|
},
|
|
update_e_coa_hutang_list(state, val) {
|
|
state.e_coa_hutang_list = val
|
|
},
|
|
update_e_loading_coa_hutang(state, val) {
|
|
state.e_loading_coa_hutang = val
|
|
},
|
|
|
|
// disc. pendapatan
|
|
update_a_coa_disc_pendapatan(state, val) {
|
|
state.a_coa_disc_pendapatan = val
|
|
},
|
|
update_a_coa_disc_pendapatan_list(state, val) {
|
|
state.a_coa_disc_pendapatan_list = val
|
|
},
|
|
update_a_coa_search_disc_pendapatan(state, val) {
|
|
state.a_coa_search_disc_pendapatan = val
|
|
},
|
|
update_a_loading_coa_disc_pendapatan(state, val) {
|
|
state.a_loading_coa_disc_pendapatan = val
|
|
},
|
|
|
|
update_e_coa_disc_pendapatan(state, val) {
|
|
state.e_coa_disc_pendapatan = val
|
|
},
|
|
update_e_coa_disc_pendapatan_list(state, val) {
|
|
state.e_coa_disc_pendapatan_list = val
|
|
},
|
|
update_e_loading_coa_disc_pendapatan(state, val) {
|
|
state.e_loading_coa_disc_pendapatan = val
|
|
},
|
|
|
|
// retur
|
|
update_a_coa_retur_pendapatan(state, val) {
|
|
state.a_coa_retur_pendapatan = val
|
|
},
|
|
update_a_coa_retur_pendapatan_list(state, val) {
|
|
state.a_coa_retur_pendapatan_list = val
|
|
},
|
|
update_a_coa_search_retur_pendapatan(state, val) {
|
|
state.a_coa_search_retur_pendapatan = val
|
|
},
|
|
update_a_loading_coa_retur_pendapatan(state, val) {
|
|
state.a_loading_coa_retur_pendapatan = val
|
|
},
|
|
|
|
update_e_coa_retur_pendapatan(state, val) {
|
|
state.e_coa_retur_pendapatan = val
|
|
},
|
|
update_e_coa_retur_pendapatan_list(state, val) {
|
|
state.e_coa_retur_pendapatan_list = val
|
|
},
|
|
update_e_loading_coa_retur_pendapatan(state, val) {
|
|
state.e_loading_coa_retur_pendapatan = val
|
|
},
|
|
|
|
update_a_loading_coa_list(state, val) {
|
|
state.a_loading_coa_list = val
|
|
},
|
|
},
|
|
actions: {
|
|
// get nat_group from api
|
|
async open_add_nat_group(context) {
|
|
context.commit("update_a_loading_nat_group", true)
|
|
try {
|
|
let prm = {};
|
|
prm.token = one_token()
|
|
let resp = await api.getNatGroup(prm)
|
|
// console.log('data nat_group ',resp)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_a_loading_nat_group", false)
|
|
} else {
|
|
// console.log('data nat_group ',resp.data)
|
|
context.commit("update_a_loading_nat_group", false)
|
|
context.commit("update_a_nat_group_list", resp.data)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_a_loading_nat_group", false)
|
|
}
|
|
},
|
|
// get ac uang muka from api
|
|
async open_add_coa_uang_muka(context, payload) {
|
|
context.commit("update_a_loading_coa_uang_muka", true)
|
|
try {
|
|
let prm = {};
|
|
prm.token = one_token()
|
|
prm.search = payload.search
|
|
let resp = await api.getAcUangMuka(prm)
|
|
// console.log('data nat_group ',resp)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_a_loading_coa_uang_muka", false)
|
|
} else {
|
|
// console.log('data nat_group ',resp.data)
|
|
context.commit("update_a_loading_coa_uang_muka", false)
|
|
context.commit("update_a_coa_uang_muka_list", resp.data)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_a_loading_coa_uang_muka", false)
|
|
}
|
|
},
|
|
|
|
async open_edit_coa_uang_muka(context, payload) {
|
|
context.commit("update_e_loading_coa_uang_muka", true)
|
|
try {
|
|
let prm = {};
|
|
prm.token = one_token()
|
|
prm.search = payload.search
|
|
let resp = await api.getAcUangMuka(prm)
|
|
// console.log('data nat_group ',resp)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_e_loading_coa_uang_muka", false)
|
|
} else {
|
|
// console.log('data nat_group ',resp.data)
|
|
context.commit("update_e_loading_coa_uang_muka", false)
|
|
context.commit("update_e_coa_uang_muka_list", resp.data)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_e_loading_coa_uang_muka", false)
|
|
}
|
|
},
|
|
// get ac hutang from api
|
|
async open_add_coa_hutang(context, payload) {
|
|
context.commit("update_a_loading_coa_hutang", true)
|
|
try {
|
|
let prm = {};
|
|
prm.token = one_token()
|
|
prm.search = payload.search
|
|
let resp = await api.getAcHutang(prm)
|
|
// console.log('data nat_group ',resp)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_a_loading_coa_hutang", false)
|
|
} else {
|
|
// console.log('data nat_group ',resp.data)
|
|
context.commit("update_a_loading_coa_hutang", false)
|
|
context.commit("update_a_coa_hutang_list", resp.data)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_a_loading_coa_hutang", false)
|
|
}
|
|
},
|
|
|
|
async open_edit_coa_hutang(context, payload) {
|
|
context.commit("update_e_loading_coa_hutang", true)
|
|
try {
|
|
let prm = {};
|
|
prm.token = one_token()
|
|
prm.search = payload.search
|
|
let resp = await api.getAcHutang(prm)
|
|
// console.log('data nat_group ',resp)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_e_loading_coa_hutang", false)
|
|
} else {
|
|
// console.log('data nat_group ',resp.data)
|
|
context.commit("update_e_loading_coa_hutang", false)
|
|
context.commit("update_e_coa_hutang_list", resp.data)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_e_loading_coa_hutang", false)
|
|
}
|
|
},
|
|
// get ac disc pendapatan from api
|
|
async open_add_coa_disc_pendapatan(context, payload) {
|
|
context.commit("update_a_loading_coa_disc_pendapatan", true)
|
|
try {
|
|
let prm = {};
|
|
prm.token = one_token()
|
|
prm.search = payload.search
|
|
let resp = await api.getAcDiscPendapatan(prm)
|
|
// console.log('data nat_group ',resp)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_a_loading_coa_disc_pendapatan", false)
|
|
} else {
|
|
// console.log('data nat_group ',resp.data)
|
|
context.commit("update_a_loading_coa_disc_pendapatan", false)
|
|
context.commit("update_a_coa_disc_pendapatan_list", resp.data)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_a_loading_coa_disc_pendapatan", false)
|
|
}
|
|
},
|
|
|
|
async open_edit_coa_disc_pendapatan(context, payload) {
|
|
context.commit("update_e_loading_coa_disc_pendapatan", true)
|
|
try {
|
|
let prm = {};
|
|
prm.token = one_token()
|
|
prm.search = payload.search
|
|
let resp = await api.getAcDiscPendapatan(prm)
|
|
// console.log('data nat_group ',resp)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_e_loading_coa_disc_pendapatan", false)
|
|
} else {
|
|
// console.log('data nat_group ',resp.data)
|
|
context.commit("update_e_loading_coa_disc_pendapatan", false)
|
|
context.commit("update_e_coa_disc_pendapatan_list", resp.data)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_e_loading_coa_disc_pendapatan", false)
|
|
}
|
|
},
|
|
// get ac retur pendapatan from api
|
|
async open_add_coa_retur_pendapatan(context, payload) {
|
|
context.commit("update_a_loading_coa_retur_pendapatan", true)
|
|
try {
|
|
let prm = {};
|
|
prm.token = one_token()
|
|
prm.search = payload.search
|
|
let resp = await api.getAcReturPendapatan(prm)
|
|
// console.log('data nat_group ',resp)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_a_loading_coa_retur_pendapatan", false)
|
|
} else {
|
|
// console.log('data nat_group ',resp.data)
|
|
context.commit("update_a_loading_coa_retur_pendapatan", false)
|
|
context.commit("update_a_coa_retur_pendapatan_list", resp.data)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_a_loading_coa_retur_pendapatan", false)
|
|
}
|
|
},
|
|
|
|
async open_edit_coa_retur_pendapatan(context, payload) {
|
|
context.commit("update_e_loading_coa_retur_pendapatan", true)
|
|
try {
|
|
let prm = {};
|
|
prm.token = one_token()
|
|
prm.search = payload.search
|
|
let resp = await api.getAcReturPendapatan(prm)
|
|
// console.log('data nat_group ',resp)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_e_loading_coa_retur_pendapatan", false)
|
|
} else {
|
|
// console.log('data nat_group ',resp.data)
|
|
context.commit("update_e_loading_coa_retur_pendapatan", false)
|
|
context.commit("update_e_coa_retur_pendapatan_list", resp.data)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_e_loading_coa_retur_pendapatan", false)
|
|
}
|
|
},
|
|
// search
|
|
async search(context, prm) {
|
|
context.commit("update_a_search_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.search(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_a_search_status", 3)
|
|
context.commit("update_a_search_error_message", resp.message)
|
|
context.commit("update_a_msg_info", resp.message)
|
|
context.commit("update_a_open_dialog_info", true)
|
|
} else {
|
|
context.commit("update_a_search_status", 2)
|
|
context.commit("update_a_search_error_message", "")
|
|
context.commit("update_a_msg_info", resp.message)
|
|
let data = {
|
|
records: resp.data.records,
|
|
total: resp.data.total
|
|
}
|
|
|
|
context.commit("update_a_a_coas", data.records)
|
|
context.commit("update_a_total_coa", data.total)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_a_search_status", 3)
|
|
context.commit("update_a_search_error_message", e.message)
|
|
context.commit("update_a_msg_info", e.message)
|
|
context.commit("update_a_open_dialog_info", true)
|
|
}
|
|
},
|
|
// add data
|
|
async add_data(context, payload) {
|
|
context.commit("update_a_save_status", 1)
|
|
try {
|
|
let prm = {};
|
|
prm.token = one_token()
|
|
prm.a_nat_group = payload.a_nat_group_param
|
|
prm.a_coa_uang_muka = payload.a_coa_uang_muka_param
|
|
prm.a_coa_hutang = payload.a_coa_hutang_param
|
|
prm.a_coa_disc_pendapatan = payload.a_coa_disc_pendapatan_param
|
|
prm.a_coa_retur_pendapatan = payload.a_coa_retur_pendapatan_param
|
|
|
|
let resp = await api.addData(prm)
|
|
// console.log('data nat_group ',resp)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_a_save_status", 3)
|
|
context.commit("update_a_save_error_message", resp.message)
|
|
context.commit("update_a_alert_error", true)
|
|
} else {
|
|
context.commit("update_a_save_status", 2)
|
|
context.commit("update_a_save_error_message", resp.message)
|
|
let data = {
|
|
total: resp.data.total
|
|
}
|
|
|
|
if (data.total !== -1) {
|
|
context.commit("update_a_alert_success", true)
|
|
var msg = " Add Data COA Mapping Sukses"
|
|
context.commit("update_a_msg_success", msg)
|
|
context.commit('update_dialog_add_coa', false)
|
|
context.dispatch("search", {
|
|
current_page: context.state.a_current_page,
|
|
search: context.state.a_x_search,
|
|
last_id: -1
|
|
})
|
|
} else {
|
|
context.commit("update_a_errors_save_coa", [])
|
|
}
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_a_save_status", 3)
|
|
context.commit("update_a_save_error_message", e.message)
|
|
context.commit("update_a_alert_error", true)
|
|
}
|
|
},
|
|
// delete data
|
|
async delete_data(context, prm) {
|
|
context.commit("update_a_save_status", 1)
|
|
try {
|
|
prm.token = one_token()
|
|
let resp = await api.deleteData(prm)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_a_save_status", 3)
|
|
context.commit("update_a_save_error_message", resp.message)
|
|
context.commit("update_a_alert_error", true)
|
|
} else {
|
|
context.commit("update_a_save_status", 2)
|
|
context.commit("update_a_save_error_message", resp.message)
|
|
let data = {
|
|
total: resp.data.total
|
|
}
|
|
|
|
if (data.total !== -1) {
|
|
context.commit("update_a_alert_success", true)
|
|
var msg = " Coa " + prm.Nat_GroupName + " berhasil dihapus"
|
|
context.commit("update_a_msg_success", msg)
|
|
context.dispatch("search", {
|
|
current_page: context.state.a_current_page,
|
|
search: context.state.a_x_search,
|
|
last_id: -1
|
|
})
|
|
} else {
|
|
context.commit("update_a_errors_save_coa", [])
|
|
}
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_a_save_status", 3)
|
|
context.commit("update_a_save_error_message", e.message)
|
|
context.commit("update_a_alert_error", true)
|
|
}
|
|
},
|
|
// get_by_id
|
|
async get_by_id(context, payload) {
|
|
context.commit("update_e_loading_nat_group", true)
|
|
try {
|
|
let prm = {};
|
|
prm.token = one_token()
|
|
// map group
|
|
prm.MapNatGroup_ID = payload.MapNatGroup_ID
|
|
// group
|
|
prm.MapNatGroup_NatGroupID = payload.MapNatGroup_NatGroupID
|
|
// uang muka
|
|
prm.MapNatGroup_Dp_coaID = payload.MapNatGroup_Dp_coaID
|
|
// hutang
|
|
prm.MapNatGroup_Debt_coaID = payload.MapNatGroup_Debt_coaID
|
|
// disc pendapatan
|
|
prm.MapNatGroup_Disc_coaID = payload.MapNatGroup_Disc_coaID
|
|
// retur
|
|
prm.MapNatGroup_Retur_coaID = payload.MapNatGroup_Retur_coaID
|
|
|
|
let resp = await api.getByID(prm)
|
|
// console.log('data nat_group ',resp)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_e_loading_nat_group", false)
|
|
} else {
|
|
// console.log('data nat_group ',resp.data)
|
|
context.commit("update_e_loading_nat_group", true)
|
|
|
|
// MapNatGroup_ID
|
|
context.commit("update_MapNatGroup_ID", resp.data.record_map_nat_group[0].MapNatGroup_ID)
|
|
|
|
// nat_group
|
|
context.commit("update_e_nat_group_list", resp.data.records_group_all)
|
|
context.commit("update_e_nat_group",{
|
|
Nat_GroupCode: resp.data.records_group[0].Nat_GroupCode,
|
|
Nat_GroupID: resp.data.records_group[0].Nat_GroupID,
|
|
Nat_GroupName: resp.data.records_group[0].Nat_GroupName
|
|
})
|
|
|
|
// uang muka
|
|
context.commit("update_e_coa_uang_muka_list", resp.data.records_uang_muka)
|
|
context.commit("update_e_coa_uang_muka",{
|
|
coaID: resp.data.records_uang_muka[0].coaID,
|
|
coaAccountNo: resp.data.records_uang_muka[0].coaAccountNo,
|
|
coaDescription: resp.data.records_uang_muka[0].coaDescription,
|
|
coaSubDescription: resp.data.records_uang_muka[0].coaSubDescription,
|
|
coaAccountType: resp.data.records_uang_muka[0].coaAccountType,
|
|
coaSpecialAccountType: resp.data.records_uang_muka[0].coaSpecialAccountType,
|
|
coaIsInput: resp.data.records_uang_muka[0].coaIsInput,
|
|
coaReportSchedule: resp.data.records_uang_muka[0].coaReportSchedule,
|
|
coaCurrencyCode: resp.data.records_uang_muka[0].coaCurrencyCode,
|
|
coaCashFlowCategory: resp.data.records_uang_muka[0].coaCashFlowCategory,
|
|
coaCreated: resp.data.records_uang_muka[0].coaCreated,
|
|
coaLastUpdated: resp.data.records_uang_muka[0].coaLastUpdated,
|
|
coaIsActive: resp.data.records_uang_muka[0].coaIsActive,
|
|
coaLevel: resp.data.records_uang_muka[0].coaLevel
|
|
})
|
|
|
|
// hutang
|
|
context.commit("update_e_coa_hutang_list", resp.data.records_hutang)
|
|
context.commit("update_e_coa_hutang",{
|
|
coaID: resp.data.records_hutang[0].coaID,
|
|
coaAccountNo: resp.data.records_hutang[0].coaAccountNo,
|
|
coaDescription: resp.data.records_hutang[0].coaDescription,
|
|
coaSubDescription: resp.data.records_hutang[0].coaSubDescription,
|
|
coaAccountType: resp.data.records_hutang[0].coaAccountType,
|
|
coaSpecialAccountType: resp.data.records_hutang[0].coaSpecialAccountType,
|
|
coaIsInput: resp.data.records_hutang[0].coaIsInput,
|
|
coaReportSchedule: resp.data.records_hutang[0].coaReportSchedule,
|
|
coaCurrencyCode: resp.data.records_hutang[0].coaCurrencyCode,
|
|
coaCashFlowCategory: resp.data.records_hutang[0].coaCashFlowCategory,
|
|
coaCreated: resp.data.records_hutang[0].coaCreated,
|
|
coaLastUpdated: resp.data.records_hutang[0].coaLastUpdated,
|
|
coaIsActive: resp.data.records_hutang[0].coaIsActive,
|
|
coaLevel: resp.data.records_hutang[0].coaLevel
|
|
})
|
|
|
|
// disc. pendapatan
|
|
context.commit("update_e_coa_disc_pendapatan_list", resp.data.records_disc)
|
|
context.commit("update_e_coa_disc_pendapatan",{
|
|
coaID: resp.data.records_disc[0].coaID,
|
|
coaAccountNo: resp.data.records_disc[0].coaAccountNo,
|
|
coaDescription: resp.data.records_disc[0].coaDescription,
|
|
coaSubDescription: resp.data.records_disc[0].coaSubDescription,
|
|
coaAccountType: resp.data.records_disc[0].coaAccountType,
|
|
coaSpecialAccountType: resp.data.records_disc[0].coaSpecialAccountType,
|
|
coaIsInput: resp.data.records_disc[0].coaIsInput,
|
|
coaReportSchedule: resp.data.records_disc[0].coaReportSchedule,
|
|
coaCurrencyCode: resp.data.records_disc[0].coaCurrencyCode,
|
|
coaCashFlowCategory: resp.data.records_disc[0].coaCashFlowCategory,
|
|
coaCreated: resp.data.records_disc[0].coaCreated,
|
|
coaLastUpdated: resp.data.records_disc[0].coaLastUpdated,
|
|
coaIsActive: resp.data.records_disc[0].coaIsActive,
|
|
coaLevel: resp.data.records_disc[0].coaLevel
|
|
})
|
|
|
|
// retur
|
|
context.commit("update_e_coa_retur_pendapatan_list", resp.data.records_retur)
|
|
context.commit("update_e_coa_retur_pendapatan",{
|
|
coaID: resp.data.records_retur[0].coaID,
|
|
coaAccountNo: resp.data.records_retur[0].coaAccountNo,
|
|
coaDescription: resp.data.records_retur[0].coaDescription,
|
|
coaSubDescription: resp.data.records_retur[0].coaSubDescription,
|
|
coaAccountType: resp.data.records_retur[0].coaAccountType,
|
|
coaSpecialAccountType: resp.data.records_retur[0].coaSpecialAccountType,
|
|
coaIsInput: resp.data.records_retur[0].coaIsInput,
|
|
coaReportSchedule: resp.data.records_retur[0].coaReportSchedule,
|
|
coaCurrencyCode: resp.data.records_retur[0].coaCurrencyCode,
|
|
coaCashFlowCategory: resp.data.records_retur[0].coaCashFlowCategory,
|
|
coaCreated: resp.data.records_retur[0].coaCreated,
|
|
coaLastUpdated: resp.data.records_retur[0].coaLastUpdated,
|
|
coaIsActive: resp.data.records_retur[0].coaIsActive,
|
|
coaLevel: resp.data.records_retur[0].coaLevel
|
|
})
|
|
|
|
context.commit("update_dialog_edit_coa",true)
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_e_loading_nat_group", false)
|
|
}
|
|
},
|
|
|
|
// edit data
|
|
async edit_data(context, payload) {
|
|
context.commit("update_a_save_status", 1)
|
|
try {
|
|
let prm = {};
|
|
prm.token = one_token()
|
|
prm.MapNatGroup_ID = payload.MapNatGroup_ID
|
|
prm.e_nat_group = payload.e_nat_group_param
|
|
prm.e_coa_uang_muka = payload.e_coa_uang_muka_param
|
|
prm.e_coa_hutang = payload.e_coa_hutang_param
|
|
prm.e_coa_disc_pendapatan = payload.e_coa_disc_pendapatan_param
|
|
prm.e_coa_retur_pendapatan = payload.e_coa_retur_pendapatan_param
|
|
|
|
let resp = await api.editData(prm)
|
|
// console.log('data nat_group ',resp)
|
|
if (resp.status != "OK") {
|
|
context.commit("update_a_save_status", 3)
|
|
context.commit("update_a_save_error_message", resp.message)
|
|
context.commit("update_a_alert_error", true)
|
|
} else {
|
|
context.commit("update_a_save_status", 2)
|
|
context.commit("update_a_save_error_message", resp.message)
|
|
let data = {
|
|
total: resp.data.total
|
|
}
|
|
|
|
if (data.total !== -1) {
|
|
context.commit("update_a_alert_success", true)
|
|
var msg = " Edit Data COA Mapping Sukses"
|
|
context.commit("update_a_msg_success", msg)
|
|
context.commit('update_dialog_edit_coa', false)
|
|
context.dispatch("search", {
|
|
current_page: context.state.a_current_page,
|
|
search: context.state.a_x_search,
|
|
last_id: -1
|
|
})
|
|
} else {
|
|
context.commit("update_a_errors_save_coa", [])
|
|
}
|
|
|
|
}
|
|
} catch (e) {
|
|
context.commit("update_a_save_status", 3)
|
|
context.commit("update_a_save_error_message", e.message)
|
|
context.commit("update_a_alert_error", true)
|
|
}
|
|
},
|
|
},
|
|
} |