add modules folder based on s_menu
This commit is contained in:
184
test/vuex/acc-one-jurnal/api/jpbreg.js
Normal file
184
test/vuex/acc-one-jurnal/api/jpbreg.js
Normal file
@@ -0,0 +1,184 @@
|
||||
const URL = "/one-api/mockup/masterdata/accounting/Jurnalsendreg";
|
||||
|
||||
export async function getJurnalType(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/getJurnalType', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function searchPeriode(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/searchPeriode', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function searchCoa(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/searchCoa', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function searchCoaDetail(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/searchCoaDetail', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function searchBranchPercent(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/searchBranchPercent', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function getDefaultBranch(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/getBranch', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function saveJurnal(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/saveJurnal', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function editJurnal(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/editJurnal', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function getDetail(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/getDetail', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function deleteJurnal(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/deleteJurnal', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
165
test/vuex/acc-one-jurnal/api/jurnalbiaya.js
Normal file
165
test/vuex/acc-one-jurnal/api/jurnalbiaya.js
Normal file
@@ -0,0 +1,165 @@
|
||||
// https://accone.aplikasi.web.id/one-api/mockup/masterdata/accounting/Jurnalgaji/searchCoa
|
||||
const URL = "/one-api/mockup/masterdata/accounting/Jurnalbiaya";
|
||||
|
||||
export async function getJurnalType(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/getJurnalType', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function searchPeriode(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/searchPeriode', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function searchCoa(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/searchCoa', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function searchCoaDetail(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/searchCoaDetail', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function searchBranchPercent(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/searchBranchPercent', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function getDefaultBranch(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/getBranch', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function saveJurnalBiaya(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/saveJurnalBiaya', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function getDetail(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/getDetail', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function deleteJurnalBiaya(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/deleteJurnalBiaya', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
165
test/vuex/acc-one-jurnal/api/jurnalgaji.js
Normal file
165
test/vuex/acc-one-jurnal/api/jurnalgaji.js
Normal file
@@ -0,0 +1,165 @@
|
||||
// https://accone.aplikasi.web.id/one-api/mockup/masterdata/accounting/Jurnalgaji/searchCoa
|
||||
const URL = "/one-api/mockup/masterdata/accounting/Jurnalgaji";
|
||||
|
||||
export async function getJurnalType(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/getJurnalType', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function searchPeriode(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/searchPeriode', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function searchCoa(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/searchCoa', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function searchCoaDetail(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/searchCoaDetail', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function searchBranchPercent(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/searchBranchPercent', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function getDefaultBranch(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/getBranch', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function saveJurnalGaji(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/saveJurnalGaji', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function getDetail(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/getDetail', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function deleteJurnalgaji(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/deleteJurnalgaji', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
142
test/vuex/acc-one-jurnal/api/jurnalumum.js
Normal file
142
test/vuex/acc-one-jurnal/api/jurnalumum.js
Normal file
@@ -0,0 +1,142 @@
|
||||
const URL = "/one-api/mockup/masterdata/accounting/";
|
||||
|
||||
export async function search(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + "jurnalumum/search", prm);
|
||||
if (resp.status !== 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText,
|
||||
};
|
||||
}
|
||||
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function getjurnaltype(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'jurnalumum/getjurnaltype', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function getperiode(token, prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'jurnalumum/getperiode', {
|
||||
token: token,
|
||||
search: prm
|
||||
});
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function searchcoa(token, prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'jurnalumum/searchcoa', {
|
||||
token: token,
|
||||
search: prm
|
||||
});
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function savejurnalumum(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'jurnalumum/savejurnalumum', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function editjurnalumum(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'jurnalumum/editjurnalumum', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export async function deletejurnalumum(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'jurnalumum/deletejurnalumum', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
97
test/vuex/acc-one-jurnal/api/pengeluaranbarang.js
Normal file
97
test/vuex/acc-one-jurnal/api/pengeluaranbarang.js
Normal file
@@ -0,0 +1,97 @@
|
||||
const URL = "/one-api/mockup/masterdata/accounting/jurnalpengeluaranbarang/"
|
||||
|
||||
export async function get_periode(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'getperiode', params)
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.message
|
||||
}
|
||||
}
|
||||
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function get_coa(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'searchcoa', params)
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.message
|
||||
}
|
||||
}
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function simpanjurnal(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'simpanjurnal', params)
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.message
|
||||
}
|
||||
}
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function getdetailjurnal(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'getdetailjurnal', params)
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.message
|
||||
}
|
||||
}
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function editdetailjurnal(params) {
|
||||
try {
|
||||
var resp = await axios.post(URL + 'editjurnal', params)
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.message
|
||||
}
|
||||
}
|
||||
let data = resp.data
|
||||
return data
|
||||
} catch (error) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: error.message
|
||||
}
|
||||
}
|
||||
}
|
||||
133
test/vuex/acc-one-jurnal/api/terimaBarang.js
Normal file
133
test/vuex/acc-one-jurnal/api/terimaBarang.js
Normal file
@@ -0,0 +1,133 @@
|
||||
const URL = "/one-api/mockup/masterdata/accounting/Journalterimabarang";
|
||||
|
||||
export async function getJurnalType(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/getTipeJurnal', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
export async function searchPeriode(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/getPeriode', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function searchSupplier(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/getSupplier', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function searchCoa(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/getCoa', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function saveJurnal(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/createJurnal', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function loadEditDialog(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/loadEditDialog', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export async function updateJurnal(prm) {
|
||||
try {
|
||||
var resp = await axios.post(URL + '/updateJurnal', prm);
|
||||
if (resp.status != 200) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: resp.statusText
|
||||
};
|
||||
}
|
||||
let data = resp.data;
|
||||
return data;
|
||||
} catch (e) {
|
||||
return {
|
||||
status: "ERR",
|
||||
message: e.message
|
||||
};
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
921
test/vuex/acc-one-jurnal/components/accountDialogJurnalUmum.vue
Normal file
921
test/vuex/acc-one-jurnal/components/accountDialogJurnalUmum.vue
Normal file
@@ -0,0 +1,921 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-dialog v-model="dialog" persistent width="70vw">
|
||||
<v-card>
|
||||
<v-card-title class="headline grey lighten-2" primary-title>
|
||||
FORM JURNAL UMUM
|
||||
</v-card-title>
|
||||
|
||||
<v-card-text>
|
||||
<v-layout wrap>
|
||||
<v-flex xs12>
|
||||
<v-layout>
|
||||
<v-flex xs6 class="px-1 mb-2">
|
||||
<v-text-field
|
||||
label="COMPANY"
|
||||
v-model="user.M_BranchCompanyName"
|
||||
readonly
|
||||
hide-details
|
||||
outline
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs6 class="px-1 mb-2">
|
||||
<v-text-field
|
||||
label="JURNAL TYPE"
|
||||
v-model="selected_jurnaltype.JurnalTypeName"
|
||||
readonly
|
||||
hide-details
|
||||
outline
|
||||
></v-text-field>
|
||||
<p v-if="checkErrorFormJurnal('requireitemjurnaltype')" class="error pl-2 pr-2" style="color:#fff">Jurnal type harus dipilih</p>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
<v-flex xs12>
|
||||
<v-layout>
|
||||
<v-flex xs6 class="px-1 mb-2">
|
||||
<v-text-field
|
||||
label="REGIONAL"
|
||||
v-model="user.S_RegionalName"
|
||||
readonly
|
||||
hide-details
|
||||
outline
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs6 class="px-1 mb-2">
|
||||
<v-layout>
|
||||
<v-flex xs6>
|
||||
<v-menu v-model="menufilterdate" :close-on-content-click="false" :nudge-right="40" lazy
|
||||
transition="scale-transition" offset-y full-width max-width="290px" min-width="290px"
|
||||
:disabled="!isPeriodeSelected">
|
||||
<template v-slot:activator="{ on }">
|
||||
<v-text-field v-model="filterComputedDateFormatted" class="mr-2" label="Tanggal"
|
||||
outline hide-details readonly v-on="on"
|
||||
:disabled="!isPeriodeSelected"
|
||||
@blur="date = deFormatedDate(filterComputedDateFormatted)"></v-text-field>
|
||||
</template>
|
||||
<v-date-picker no-title v-model="xdate"
|
||||
:min="periodeStartDate"
|
||||
:max="periodeEndDate"
|
||||
@input="menufilterdate = false"></v-date-picker>
|
||||
</v-menu>
|
||||
</v-flex>
|
||||
<v-flex xs6>
|
||||
<v-autocomplete label="Periode" :items="xperiode" v-model="selected_periode"
|
||||
:search-input.sync="search_item_periode" hide-details
|
||||
auto-select-first no-filter item-text="periodeName" outline return-object
|
||||
:disabled="this.$store.state.jurnalumum.is_posted === 'Y'"
|
||||
:loading="isLoading" no-data-text="Pilih Peridoe">
|
||||
<template slot="item" slot-scope="{ item }">
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title v-text="item.periodeName"></v-list-tile-title>
|
||||
<v-list-tile-sub-title
|
||||
v-text="item.periode"
|
||||
></v-list-tile-sub-title>
|
||||
</v-list-tile-content>
|
||||
</template>
|
||||
</v-autocomplete>
|
||||
<p v-if="checkErrorFormJurnal('requireitemperiode')" class="error pl-2 pr-2" style="color:#fff">Periode harus dipilih</p>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
<v-flex xs12>
|
||||
<v-layout>
|
||||
<v-flex xs6 class="px-1 mb-2">
|
||||
<v-text-field
|
||||
label="BRANCH"
|
||||
v-model="user.M_BranchName"
|
||||
readonly
|
||||
hide-details
|
||||
outline
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs6 class="px-1 mb-2">
|
||||
<v-text-field
|
||||
label="JUDUL"
|
||||
v-model="xtitle"
|
||||
hide-details
|
||||
outline
|
||||
:disabled="this.$store.state.jurnalumum.is_posted === 'Y'"
|
||||
></v-text-field>
|
||||
<p v-if="checkErrorFormJurnal('requireitemtitle')" class="error pl-2 pr-2" style="color:#fff">Judul harus diisi</p>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
<v-flex>
|
||||
<v-layout>
|
||||
<v-textarea
|
||||
v-model="xdeskripsi"
|
||||
name="input-7-1"
|
||||
label="DESKRIPSI"
|
||||
hide-detials
|
||||
outline
|
||||
:disabled="this.$store.state.jurnalumum.is_posted === 'Y'"
|
||||
></v-textarea>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
<v-layout class="pt-3 pb-1">
|
||||
<v-flex text-xs-right>
|
||||
<v-btn :disabled="this.$store.state.jurnalumum.is_posted === 'Y'" color="blue" class="white--text" @click="opendialogdetail()">TAMBAH</v-btn>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12>
|
||||
<v-data-table
|
||||
:headers="headers"
|
||||
:items="jurnaldetails"
|
||||
hide-actions
|
||||
class="elevation-1"
|
||||
>
|
||||
<template slot="items" slot-scope="props">
|
||||
<td
|
||||
class="text-xs-center pa-2"
|
||||
>
|
||||
{{ props.item.account }}
|
||||
</td>
|
||||
<td
|
||||
class="text-xs-left pa-2"
|
||||
>
|
||||
{{ props.item.description }}
|
||||
</td>
|
||||
<td
|
||||
class="text-xs-right pa-2"
|
||||
>
|
||||
{{ oneMoney(props.item.debit) }}
|
||||
</td>
|
||||
<td
|
||||
class="text-xs-right pa-2"
|
||||
>
|
||||
{{ oneMoney(props.item.credit) }}
|
||||
</td>
|
||||
<td
|
||||
class="text-xs-center pa-2"
|
||||
>
|
||||
<v-icon small @click="deleteDetailJurnal(props.item)"
|
||||
>delete</v-icon
|
||||
>
|
||||
</td>
|
||||
</template>
|
||||
|
||||
<template v-slot:footer>
|
||||
<tr>
|
||||
<td colspan="2" class="font-weight-bold pa-2">TOTAL</td>
|
||||
|
||||
<td class="text-xs-right pa-2 font-weight-bold">
|
||||
{{ oneMoney(xsummary.debit) }}
|
||||
</td>
|
||||
<td class="text-xs-right pa-2 font-weight-bold">
|
||||
{{ oneMoney(xsummary.credit) }}
|
||||
</td>
|
||||
<td width="5%" class="font-weight-bold text-xs-right pa-2"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" class="font-weight-bold pa-2">BALANCE</td>
|
||||
<td width="15%" class="text-xs-right pa-2 font-weight-bold">
|
||||
{{ oneMoney(xsummary.balance) }}
|
||||
</td>
|
||||
<td width="5%" class="font-weight-bold text-xs-right pa-2"></td>
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
|
||||
<v-divider></v-divider>
|
||||
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="error" flat @click="closeDialog()">
|
||||
TUTUP
|
||||
</v-btn>
|
||||
<v-btn v-if="xact === 'add'" color="primary" @click="saveJurnalUmum()">SIMPAN</v-btn>
|
||||
<v-btn v-if="xact === 'edit'" :disabled="this.$store.state.jurnalumum.is_posted === 'Y'" color="primary" @click="saveEditJurnalUmum()">SIMPAN PERUBAHAN</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
<template>
|
||||
<v-dialog v-model="dialogdetail" persistent width="40vw">
|
||||
<v-card>
|
||||
<v-card-title class="headline grey lighten-2" primary-title>
|
||||
FORM DETAIL
|
||||
</v-card-title>
|
||||
|
||||
<v-card-text>
|
||||
<v-layout wrap>
|
||||
<v-flex xs12 class="px-1 mb-2">
|
||||
<v-autocomplete label="COA" :items="xcoalist" v-model="selected_coa"
|
||||
:search-input.sync="search_item_coa" hide-details
|
||||
auto-select-first no-filter item-text="coaDescription" outline return-object
|
||||
:loading="isLoading" no-data-text="Pilih Coa" clearable>
|
||||
<template slot="item" slot-scope="{ item }">
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title v-text="item.coaDescription"></v-list-tile-title>
|
||||
<v-list-tile-sub-title v-text="item.coaAccountNo"></v-list-tile-sub-title>
|
||||
</v-list-tile-content>
|
||||
</template>
|
||||
</v-autocomplete>
|
||||
<p v-if="checkErrorFormDetail('requireitemcoa')" class="error pl-2 pr-2" style="color:#fff">Coa harus dipilih</p>
|
||||
</v-flex>
|
||||
<v-flex xs12 class="px-1 mb-2">
|
||||
<v-text-field
|
||||
prefix="Rp"
|
||||
label="DEBET"
|
||||
v-model="formattedxdebet"
|
||||
hide-details
|
||||
outline
|
||||
@focus="clearXdebet"
|
||||
@blur="resetXdebet"
|
||||
>
|
||||
</v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs12 class="px-1 mb-2">
|
||||
<v-text-field
|
||||
prefix="Rp"
|
||||
label="KREDIT"
|
||||
v-model="formattedxkredit"
|
||||
hide-details
|
||||
outline
|
||||
@focus="clearXkredit"
|
||||
@blur="resetXkredit"
|
||||
>
|
||||
</v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
|
||||
<v-divider></v-divider>
|
||||
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="error" flat @click="closeDialogDetail()">
|
||||
BATAL
|
||||
</v-btn>
|
||||
<v-btn color="primary" @click="addDetailJurnal()">TAMBAHKAN</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<template>
|
||||
<one-dialog-detail-info :status="opendialogdetailinfo" :msg="msgdetailinfo" @close-dialog-info="opendialogdetailinfo = false"></one-dialog-detail-info>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
||||
<script>
|
||||
module.exports = {
|
||||
name: "JurnalUmum",
|
||||
components: {
|
||||
'one-dialog-detail-info':httpVueLoader('../../common/oneDialogInfo.vue'),
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch("jurnalumum/getjurnaltype")
|
||||
this.$store.dispatch("jurnalumum/getperiode", this.search_item_periode)
|
||||
this.$store.dispatch("jurnalumum/searchcoa", this.search_item_coa)
|
||||
},
|
||||
data: () => ({
|
||||
menufilterdate: false,
|
||||
date: new Date().toISOString().substr(0, 10),
|
||||
search_item_periode: "",
|
||||
search_item_coa: "",
|
||||
xdebet: 0,
|
||||
xkredit: 0,
|
||||
headers: [
|
||||
{
|
||||
text: "AKUN",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "action",
|
||||
width: "30%",
|
||||
class: "pa-2 pl-2 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "DESKRIPSI",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "35%",
|
||||
class: "pa-2 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "DEBET",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "lab",
|
||||
width: "15%",
|
||||
class: "pa-2 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "KREDIT",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "lab",
|
||||
width: "15%",
|
||||
class: "pa-2 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "AKSI",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "lab",
|
||||
width: "5%",
|
||||
class: "pa-2 blue lighten-3 white--text",
|
||||
},
|
||||
],
|
||||
}),
|
||||
computed: {
|
||||
formattedxdebet: {
|
||||
get() {
|
||||
return this.oneMoney(this.xdebet);
|
||||
},
|
||||
set(value) {
|
||||
// Hilangkan titik dan koma, ubah jadi number
|
||||
let raw = value.replace(/\./g, '').replace(',', '.');
|
||||
this.xdebet = parseFloat(raw) || 0;
|
||||
}
|
||||
},
|
||||
formattedxkredit: {
|
||||
get() {
|
||||
return this.oneMoney(this.xkredit);
|
||||
},
|
||||
set(value) {
|
||||
// Hilangkan titik dan koma, ubah jadi number
|
||||
let raw = value.replace(/\./g, '').replace(',', '.');
|
||||
this.xkredit = parseFloat(raw) || 0;
|
||||
}
|
||||
},
|
||||
isPeriodeSelected() {
|
||||
return this.$store.state.jurnalumum.periodeStartDate && this.$store.state.jurnalumum.periodeEndDate;
|
||||
},
|
||||
user() {
|
||||
return this.$store.state.jurnalumum.user;
|
||||
},
|
||||
dialog: {
|
||||
get() {
|
||||
return this.$store.state.jurnalumum.dialog_is_active
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("jurnalumum/update_dialog_is_active", val);
|
||||
},
|
||||
},
|
||||
xjurnaltype() {
|
||||
return this.$store.state.jurnalumum.jurnaltypes
|
||||
},
|
||||
selected_jurnaltype() {
|
||||
if (this.xact == "edit") {
|
||||
return this.$store.state.jurnalumum.selected_jurnaltype
|
||||
} else {
|
||||
return this.$store.state.jurnalumum.x_drop_tipe_jurnal;
|
||||
}
|
||||
},
|
||||
// selected_jurnaltype: {
|
||||
// get() {
|
||||
// return this.$store.state.jurnalumum.selected_jurnaltype
|
||||
// },
|
||||
// set(val) {
|
||||
// this.$store.commit("jurnalumum/update_selected_jurnaltype", val);
|
||||
// },
|
||||
// },
|
||||
xdate: {
|
||||
get() {
|
||||
return this.$store.state.jurnalumum.xdate
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("jurnalumum/update_xdate", val)
|
||||
}
|
||||
},
|
||||
filterComputedDateFormatted() {
|
||||
return this.formatDate(this.xdate)
|
||||
},
|
||||
xperiode() {
|
||||
return this.$store.state.jurnalumum.periodes
|
||||
},
|
||||
selected_periode: {
|
||||
get() {
|
||||
return this.$store.state.jurnalumum.selected_periode
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("jurnalumum/update_selected_periode", val);
|
||||
this.$store.commit("jurnalumum/update_periodeStartDate", val.periodeStartDate);
|
||||
this.$store.commit("jurnalumum/update_periodeEndDate", val.periodeEndDate);
|
||||
},
|
||||
},
|
||||
isLoading() {
|
||||
return this.$store.state.jurnalumum.autocomplete_status == 1
|
||||
},
|
||||
dialogdetail: {
|
||||
get() {
|
||||
return this.$store.state.jurnalumum.dialogdetail
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("jurnalumum/update_dialogdetail",val)
|
||||
}
|
||||
},
|
||||
xcoalist() {
|
||||
return this.$store.state.jurnalumum.coalist
|
||||
},
|
||||
selected_coa: {
|
||||
get() {
|
||||
return this.$store.state.jurnalumum.selected_coa
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("jurnalumum/update_selected_coa",val)
|
||||
}
|
||||
},
|
||||
xsummary() {
|
||||
return this.$store.state.jurnalumum.xsummary
|
||||
},
|
||||
opendialogdetailinfo: {
|
||||
get() {
|
||||
return this.$store.state.jurnalumum.open_dialog_detail_info
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("jurnalumum/update_open_dialog_detail_info",val)
|
||||
}
|
||||
},
|
||||
msgdetailinfo: {
|
||||
get() {
|
||||
return this.$store.state.jurnalumum.msg_detail_info
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("jurnalumum/update_msg_detail_info",val)
|
||||
}
|
||||
},
|
||||
xact: {
|
||||
get() {
|
||||
return this.$store.state.jurnalumum.act
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("jurnalumum/update_act", val)
|
||||
}
|
||||
},
|
||||
xtitle: {
|
||||
get() {
|
||||
return this.$store.state.jurnalumum.title
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("jurnalumum/update_title", val)
|
||||
}
|
||||
},
|
||||
xdeskripsi: {
|
||||
get() {
|
||||
return this.$store.state.jurnalumum.deskripsi
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("jurnalumum/update_deskripsi", val)
|
||||
}
|
||||
},
|
||||
jurnaldetails() {
|
||||
return this.$store.state.jurnalumum.jurnaldetails
|
||||
},
|
||||
selected_jurnaldetail: {
|
||||
get() {
|
||||
return this.$store.state.jurnalumum.selected_jurnaldetail
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("jurnalumum/update_selected_jurnaldetail", val)
|
||||
}
|
||||
},
|
||||
periodeStartDate: {
|
||||
get() {
|
||||
return this.$store.state.jurnalumum.periodeStartDate
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("jurnalumum/update_periodeStartDate", val)
|
||||
}
|
||||
},
|
||||
periodeEndDate: {
|
||||
get() {
|
||||
return this.$store.state.jurnalumum.periodeEndDate
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("jurnalumum/update_periodeEndDate", val)
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
roundToThreeSignificantDigits(num) {
|
||||
if (num === 0) return 0;
|
||||
|
||||
// Hitung jumlah digit
|
||||
const absNum = Math.abs(num);
|
||||
const magnitude = Math.floor(Math.log10(absNum)) + 1;
|
||||
|
||||
// Jika kurang dari 3 digit, tidak perlu dibulatkan
|
||||
if (magnitude <= 3) return num;
|
||||
|
||||
// Hitung faktor pembulatan
|
||||
const factor = Math.pow(10, magnitude - 3);
|
||||
|
||||
// Bulatkan
|
||||
return Math.round(num / factor) * factor;
|
||||
},
|
||||
oneMoney(value){
|
||||
//return one_money(value);
|
||||
let splitValue = value.toString().split(".");
|
||||
if(splitValue.length > 1) {
|
||||
let val = splitValue[0]
|
||||
return val.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".") + "," + this.roundToThreeSignificantDigits(splitValue[1]);
|
||||
} else {
|
||||
return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
||||
}
|
||||
},
|
||||
convertMoney(money){
|
||||
return one_money(money)
|
||||
},
|
||||
formatAngka(nilai) {
|
||||
// Jika tidak ada nilai
|
||||
if (!nilai) return '';
|
||||
|
||||
try {
|
||||
// Ubah ke string
|
||||
let strNilai = String(nilai);
|
||||
|
||||
// Jika berisi titik desimal
|
||||
if (strNilai.includes('.')) {
|
||||
// Split bagian utama dan desimal
|
||||
let bagian = strNilai.split('.');
|
||||
let utama = bagian[0];
|
||||
let desimal = bagian[1];
|
||||
|
||||
// Format bagian utama
|
||||
utama = utama.replace(/\B(?=(\d{3})+(?!\d))/g, '.');
|
||||
|
||||
// Kembalikan gabungan
|
||||
return utama + ',' + desimal;
|
||||
} else {
|
||||
// Tidak ada desimal, hanya format bagian utama
|
||||
return strNilai.replace(/\B(?=(\d{3})+(?!\d))/g, '.');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error formatting:", error);
|
||||
return nilai;
|
||||
}
|
||||
},
|
||||
getCurrentYearStartDate() {
|
||||
const currentYear = new Date().getFullYear();
|
||||
return new Date(currentYear, 0, 1); // 01 Januari tahun berjalan
|
||||
},
|
||||
clearXkredit() {
|
||||
if (this.xkredit === 0) {
|
||||
this.xkredit = '';
|
||||
}
|
||||
},
|
||||
resetXkredit() {
|
||||
if (this.xkredit === '' || this.xkredit === null) {
|
||||
this.xkredit = 0;
|
||||
}
|
||||
},
|
||||
clearXdebet() {
|
||||
if (this.xdebet === 0) {
|
||||
this.xdebet = '';
|
||||
}
|
||||
},
|
||||
resetXdebet() {
|
||||
if (this.xdebet === '' || this.xdebet === null) {
|
||||
this.xdebet = 0;
|
||||
}
|
||||
},
|
||||
selectMe(sc) {
|
||||
this.selected_jurnaldetail = sc
|
||||
},
|
||||
closeDialog() {
|
||||
if (this.xact === "add") {
|
||||
this.$store.commit("jurnalumum/update_dialog_is_active", false);
|
||||
this.$store.commit("jurnalumum/update_selected_jurnaltype", this.$store.state.jurnalumum.selected_jurnaltype_u);
|
||||
this.$store.commit("jurnalumum/update_jurnaldetails", [])
|
||||
this.$store.commit("jurnalumum/update_errors_save_jurnal",[])
|
||||
this.$store.commit("jurnalumum/update_selected_periode",{})
|
||||
this.$store.commit("jurnalumum/update_title","")
|
||||
this.$store.commit("jurnalumum/update_deskripsi","")
|
||||
this.$store.commit("jurnalumum/update_xdate",moment(new Date()).format('YYYY-MM-DD'))
|
||||
this.$store.commit("jurnalumum/update_xsummary",{"debit": 0, "credit": 0, "balance": 0})
|
||||
this.$store.commit("jurnalumum/update_periodeStartDate", null);
|
||||
this.$store.commit("jurnalumum/update_periodeEndDate", null);
|
||||
this.$store.commit("jurnalumum/update_x_drop_tipe_jurnal", {})
|
||||
} else if (this.xact === "edit") {
|
||||
this.$store.commit("jurnalumum/update_dialog_is_active", false);
|
||||
this.$store.commit("jurnalumum/update_selected_jurnaltype", this.$store.state.jurnalumum.selected_jurnaltype_u);
|
||||
this.$store.commit("jurnalumum/update_jurnaldetails", [])
|
||||
this.$store.commit("jurnalumum/update_errors_save_jurnal",[])
|
||||
this.$store.commit("jurnalumum/update_selected_periode",{})
|
||||
this.$store.commit("jurnalumum/update_title","")
|
||||
this.$store.commit("jurnalumum/update_deskripsi","")
|
||||
this.$store.commit("jurnalumum/update_xdate",moment(new Date()).format('YYYY-MM-DD'))
|
||||
this.$store.commit("jurnalumum/update_xsummary",{"debit": 0, "credit": 0, "balance": 0})
|
||||
this.$store.commit("jurnalumum/update_periodeStartDate", this.$store.state.jurnalumum.selected_periode.periodeStartDate);
|
||||
this.$store.commit("jurnalumum/update_periodeEndDate", this.$store.state.jurnalumum.selected_periode.periodeEndDate);
|
||||
this.$store.dispatch("jurnalumum/search", {
|
||||
regionalid: this.$store.state.jurnalumum.user.S_RegionalID,
|
||||
branchid: this.$store.state.jurnalumum.user.M_BranchID,
|
||||
current_page: this.$store.state.jurnalumum.current_page,
|
||||
search: this.$store.state.jurnalumum.x_search,
|
||||
startdate: this.$store.state.jurnalumum.start_date,
|
||||
enddate: this.$store.state.jurnalumum.end_date,
|
||||
last_id: -1
|
||||
})
|
||||
}
|
||||
},
|
||||
formatDate(date) {
|
||||
if (!date) return null
|
||||
|
||||
const [year, month, day] = date.split('-')
|
||||
return `${day}-${month}-${year}`
|
||||
},
|
||||
deFormatedDate(date) {
|
||||
if (!date) return null
|
||||
|
||||
const [day, month, year] = date.split('-')
|
||||
return `${year}-${month.padStart(2, '0')}-${day.padStart(2, '0')}`
|
||||
},
|
||||
thr_search_periode: _.debounce(function () {
|
||||
this.$store.dispatch("jurnalumum/getperiode", this.search_item_periode)
|
||||
}, 2000),
|
||||
thr_search_coa: _.debounce(function () {
|
||||
this.$store.dispatch("jurnalumum/searchcoa", this.search_item_coa)
|
||||
}, 2000),
|
||||
opendialogdetail() {
|
||||
this.$store.commit("jurnalumum/update_errors_save_jurnal",[])
|
||||
var errorssj = this.$store.state.jurnalumum.errors_save_jurnal
|
||||
|
||||
if(_.isEmpty(this.$store.state.jurnalumum.selected_jurnaltype)) {
|
||||
errorssj.push("requireitemjurnaltype")
|
||||
}
|
||||
if(_.isEmpty(this.$store.state.jurnalumum.selected_periode)) {
|
||||
errorssj.push("requireitemperiode")
|
||||
}
|
||||
if(_.isEmpty(this.$store.state.jurnalumum.title)) {
|
||||
errorssj.push("requireitemtitle")
|
||||
}
|
||||
// cek error
|
||||
if (errorssj.length === 0) {
|
||||
// cek rentang periode
|
||||
if (this.$store.state.jurnalumum.periodeStartDate && this.$store.state.jurnalumum.periodeEndDate) {
|
||||
let startDate = new Date(this.$store.state.jurnalumum.periodeStartDate);
|
||||
let endDate = new Date(this.$store.state.jurnalumum.periodeEndDate);
|
||||
let selectedDate = new Date(this.xdate);
|
||||
|
||||
if (selectedDate < startDate || selectedDate > endDate) {
|
||||
let msg = "Tanggal tidak sesuai rentang periode, silahkan pilih tanggal sesuai rentang periode";
|
||||
this.$store.commit("jurnalumum/update_msg_detail_info", msg);
|
||||
this.$store.commit("jurnalumum/update_open_dialog_detail_info", true);
|
||||
} else {
|
||||
this.$store.commit("jurnalumum/update_coalist", [])
|
||||
this.$store.commit("jurnalumum/update_dialogdetail",true)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
closeDialogDetail() {
|
||||
this.$store.commit("jurnalumum/update_dialogdetail",false)
|
||||
this.$store.commit("jurnalumum/update_errors",[])
|
||||
this.$store.commit("jurnalumum/update_selected_coa",{})
|
||||
this.xkredit = 0
|
||||
this.xdebet = 0
|
||||
},
|
||||
checkErrorFormDetail(value) {
|
||||
var errors = this.$store.state.jurnalumum.errors
|
||||
if (errors.includes(value)) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
},
|
||||
checkErrorFormJurnal(value) {
|
||||
var errorssj = this.$store.state.jurnalumum.errors_save_jurnal
|
||||
if (errorssj.includes(value)) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
},
|
||||
addDetailJurnal() {
|
||||
this.$store.commit("jurnalumum/update_errors",[])
|
||||
var errors = this.$store.state.jurnalumum.errors
|
||||
if(_.isEmpty(this.selected_coa)) {
|
||||
errors.push("requireitemcoa")
|
||||
}
|
||||
|
||||
if (errors.length === 0) {
|
||||
this.$store.commit("jurnalumum/update_errors",[])
|
||||
let jurnaldetails = this.jurnaldetails
|
||||
jurnaldetails.push({
|
||||
coaid: this.selected_coa.coaID,
|
||||
account: this.selected_coa.coaAccountNo,
|
||||
description: this.selected_coa.coaDescription,
|
||||
debit: this.xdebet,
|
||||
credit: this.xkredit
|
||||
})
|
||||
|
||||
if (this.jurnaldetails.length > 0) {
|
||||
this.$store.commit("jurnalumum/update_dialogdetail",false)
|
||||
this.selected_coa = ""
|
||||
this.xdebet = 0
|
||||
this.xkredit = 0
|
||||
}
|
||||
|
||||
let totalDebit = 0
|
||||
let totalKredit = 0
|
||||
for (let item = 0; item < this.jurnaldetails.length; item++) {
|
||||
const element = this.jurnaldetails[item];
|
||||
totalDebit += parseFloat(element.debit)
|
||||
totalKredit += parseFloat(element.credit)
|
||||
}
|
||||
|
||||
let totalBalance = totalDebit - totalKredit;
|
||||
let summary = {
|
||||
"debit": totalDebit,
|
||||
"credit": totalKredit,
|
||||
"balance": totalBalance
|
||||
}
|
||||
this.$store.commit("jurnalumum/update_xsummary",summary)
|
||||
}
|
||||
},
|
||||
formatCurrency(val) {
|
||||
// Format the price above to USD using the locale, style, and currency.
|
||||
let price = parseFloat(val);
|
||||
let USDollar = new Intl.NumberFormat("id-ID", {
|
||||
style: "currency",
|
||||
currency: "IDR",
|
||||
});
|
||||
|
||||
// console.log(
|
||||
// `The formated version of ${price} is ${USDollar.format(price)}`
|
||||
// );
|
||||
return `${USDollar.format(price)}`;
|
||||
},
|
||||
deleteDetailJurnal(item) {
|
||||
let indexid = this.$store.state.jurnalumum.jurnaldetails.findIndex(
|
||||
(detail) => detail.coaid === item.coaid
|
||||
);
|
||||
|
||||
if (indexid !== -1) {
|
||||
let arrjurnaldetails = this.$store.state.jurnalumum.jurnaldetails
|
||||
arrjurnaldetails.splice(indexid, 1)
|
||||
this.$store.state.jurnalumum.jurnaldetails = arrjurnaldetails
|
||||
|
||||
let totalDebit = 0
|
||||
let totalKredit = 0
|
||||
for (let item = 0; item < this.$store.state.jurnalumum.jurnaldetails.length; item++) {
|
||||
const element = this.$store.state.jurnalumum.jurnaldetails[item];
|
||||
totalDebit += parseFloat(element.debit)
|
||||
totalKredit += parseFloat(element.credit)
|
||||
}
|
||||
|
||||
let totalBalance = totalDebit - totalKredit;
|
||||
let summary = {
|
||||
"debit": totalDebit,
|
||||
"credit": totalKredit,
|
||||
"balance": totalBalance
|
||||
}
|
||||
this.$store.commit("jurnalumum/update_xsummary",summary)
|
||||
}
|
||||
|
||||
},
|
||||
saveJurnalUmum() {
|
||||
this.$store.commit("jurnalumum/update_errors_save_jurnal",[])
|
||||
var errorssj = this.$store.state.jurnalumum.errors_save_jurnal
|
||||
|
||||
if(_.isEmpty(this.$store.state.jurnalumum.selected_jurnaltype)) {
|
||||
errorssj.push("requireitemjurnaltype")
|
||||
}
|
||||
if(_.isEmpty(this.$store.state.jurnalumum.selected_periode)) {
|
||||
errorssj.push("requireitemperiode")
|
||||
}
|
||||
if(_.isEmpty(this.$store.state.jurnalumum.title)) {
|
||||
errorssj.push("requireitemtitle")
|
||||
}
|
||||
|
||||
// cek error
|
||||
if (errorssj.length === 0) {
|
||||
this.$store.commit("jurnalumum/update_errors_save_jurnal",[])
|
||||
// cek debit dan credit harus balance
|
||||
if (this.$store.state.jurnalumum.xsummary.debit > this.$store.state.jurnalumum.xsummary.credit || this.$store.state.jurnalumum.xsummary.credit > this.$store.state.jurnalumum.xsummary.debit) {
|
||||
var msg = "Total debit dan kredit harus balance"
|
||||
this.$store.commit("jurnalumum/update_msg_detail_info",msg)
|
||||
this.$store.commit("jurnalumum/update_open_dialog_detail_info", true)
|
||||
} else {
|
||||
// cek rentang periode
|
||||
if (this.$store.state.jurnalumum.periodeStartDate && this.$store.state.jurnalumum.periodeEndDate) {
|
||||
let startDate = new Date(this.$store.state.jurnalumum.periodeStartDate);
|
||||
let endDate = new Date(this.$store.state.jurnalumum.periodeEndDate);
|
||||
let selectedDate = new Date(this.xdate);
|
||||
|
||||
if (selectedDate < startDate || selectedDate > endDate) {
|
||||
let msg = "Tanggal tidak sesuai rentang periode, silahkan pilih tanggal sesuai rentang periode";
|
||||
this.$store.commit("jurnalumum/update_msg_detail_info", msg);
|
||||
this.$store.commit("jurnalumum/update_open_dialog_detail_info", true);
|
||||
} else {
|
||||
let prm = {
|
||||
branchcompanyid: this.$store.state.jurnalumum.user.M_BranchCompanyID,
|
||||
regionalid: this.$store.state.jurnalumum.user.S_RegionalID,
|
||||
branchid: this.$store.state.jurnalumum.user.M_BranchID,
|
||||
periodeid: this.$store.state.jurnalumum.selected_periode.periodeID,
|
||||
title: this.$store.state.jurnalumum.title,
|
||||
description: this.$store.state.jurnalumum.deskripsi,
|
||||
date: this.$store.state.jurnalumum.xdate,
|
||||
typeid: this.$store.state.jurnalumum.selected_jurnaltype.JurnalTypeID,
|
||||
detailjurnal: this.$store.state.jurnalumum.jurnaldetails,
|
||||
current_page: this.$store.state.jurnalumum.current_page,
|
||||
search: this.$store.state.jurnalumum.x_search,
|
||||
startdate: this.$store.state.jurnalumum.start_date,
|
||||
enddate: this.$store.state.jurnalumum.end_date,
|
||||
last_id: -1
|
||||
}
|
||||
|
||||
this.$store.dispatch("jurnalumum/savejurnalumum",prm)
|
||||
this.$store.commit("jurnalumum/update_dialog_is_active", false);
|
||||
this.$store.commit("jurnalumum/update_selected_jurnaltype", this.$store.state.jurnalumum.selected_jurnaltype_u);
|
||||
this.$store.commit("jurnalumum/update_jurnaldetails", [])
|
||||
this.$store.commit("jurnalumum/update_selected_periode",{})
|
||||
this.$store.commit("jurnalumum/update_title","")
|
||||
this.$store.commit("jurnalumum/update_deskripsi","")
|
||||
this.$store.commit("jurnalumum/update_xdate",moment(new Date()).format('YYYY-MM-DD'))
|
||||
this.$store.commit("jurnalumum/update_xsummary",{"debit": 0, "credit": 0, "balance": 0})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
saveEditJurnalUmum() {
|
||||
this.$store.commit("jurnalumum/update_errors_save_jurnal",[])
|
||||
var errorssj = this.$store.state.jurnalumum.errors_save_jurnal
|
||||
|
||||
if(_.isEmpty(this.$store.state.jurnalumum.selected_jurnaltype)) {
|
||||
errorssj.push("requireitemjurnaltype")
|
||||
}
|
||||
if(_.isEmpty(this.$store.state.jurnalumum.selected_periode)) {
|
||||
errorssj.push("requireitemperiode")
|
||||
}
|
||||
if(_.isEmpty(this.$store.state.jurnalumum.title)) {
|
||||
errorssj.push("requireitemtitle")
|
||||
}
|
||||
|
||||
if (errorssj.length === 0) {
|
||||
this.$store.commit("jurnalumum/update_errors_save_jurnal",[])
|
||||
if (this.$store.state.jurnalumum.xsummary.debit > this.$store.state.jurnalumum.xsummary.credit || this.$store.state.jurnalumum.xsummary.credit > this.$store.state.jurnalumum.xsummary.debit) {
|
||||
var msg = "Total debit dan kredit harus balance"
|
||||
this.$store.commit("jurnalumum/update_msg_detail_info",msg)
|
||||
this.$store.commit("jurnalumum/update_open_dialog_detail_info", true)
|
||||
} else {
|
||||
let prm = {
|
||||
id: this.$store.state.jurnalumum.selected_jurnalumum.id,
|
||||
branchcompanyid: this.$store.state.jurnalumum.user.M_BranchCompanyID,
|
||||
regionalid: this.$store.state.jurnalumum.user.S_RegionalID,
|
||||
branchid: this.$store.state.jurnalumum.user.M_BranchID,
|
||||
periodeid: this.$store.state.jurnalumum.selected_periode.periodeID,
|
||||
title: this.$store.state.jurnalumum.title,
|
||||
description: this.$store.state.jurnalumum.deskripsi,
|
||||
date: this.$store.state.jurnalumum.xdate,
|
||||
typeid: this.$store.state.jurnalumum.selected_jurnaltype.JurnalTypeID,
|
||||
detailjurnal: this.$store.state.jurnalumum.jurnaldetails,
|
||||
current_page: this.$store.state.jurnalumum.current_page,
|
||||
search: this.$store.state.jurnalumum.x_search,
|
||||
startdate: this.$store.state.jurnalumum.start_date,
|
||||
enddate: this.$store.state.jurnalumum.end_date,
|
||||
last_id: -1
|
||||
}
|
||||
|
||||
this.$store.dispatch("jurnalumum/editjurnalumum",prm)
|
||||
this.$store.commit("jurnalumum/update_dialog_is_active", false);
|
||||
this.$store.commit("jurnalumum/update_selected_jurnaltype", this.$store.state.jurnalumum.selected_jurnaltype_u);
|
||||
this.$store.commit("jurnalumum/update_jurnaldetails", [])
|
||||
this.$store.commit("jurnalumum/update_selected_periode",{})
|
||||
this.$store.commit("jurnalumum/update_title","")
|
||||
this.$store.commit("jurnalumum/update_deskripsi","")
|
||||
this.$store.commit("jurnalumum/update_xsummary",{"debit": 0, "credit": 0, "balance": 0})
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
search_item_periode(val, old) {
|
||||
if (val == old) return;
|
||||
if (!val) return;
|
||||
if (val.length < 1) return;
|
||||
if (this.$store.state.jurnalumum.update_autocomplete_status == 1) return;
|
||||
this.thr_search_periode();
|
||||
},
|
||||
search_item_coa(val, old) {
|
||||
if (val == old) return;
|
||||
if (!val) return;
|
||||
if (val.length < 1) return;
|
||||
if (this.$store.state.jurnalumum.update_autocomplete_status == 1) return;
|
||||
this.thr_search_coa();
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
1066
test/vuex/acc-one-jurnal/components/accountOneJurnalList.vue
Normal file
1066
test/vuex/acc-one-jurnal/components/accountOneJurnalList.vue
Normal file
File diff suppressed because it is too large
Load Diff
1530
test/vuex/acc-one-jurnal/components/jurnalbiaya.vue
Normal file
1530
test/vuex/acc-one-jurnal/components/jurnalbiaya.vue
Normal file
File diff suppressed because it is too large
Load Diff
1525
test/vuex/acc-one-jurnal/components/jurnalgaji.vue
Normal file
1525
test/vuex/acc-one-jurnal/components/jurnalgaji.vue
Normal file
File diff suppressed because it is too large
Load Diff
629
test/vuex/acc-one-jurnal/components/pengeluaranBarangDialog.vue
Normal file
629
test/vuex/acc-one-jurnal/components/pengeluaranBarangDialog.vue
Normal file
@@ -0,0 +1,629 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-dialog v-model="pengeluaranbarang_dialog" persistent width="70vw">
|
||||
<v-card>
|
||||
<v-card-title class="headline grey lighten-2" primary-title>
|
||||
{{ opp_type == "add" ? 'FORM JURNAL PENGELUARAN BARANG': 'EDIT FORM JURNAL PENGELUARAN BARANG' }}
|
||||
</v-card-title>
|
||||
|
||||
<v-card-text>
|
||||
<v-layout wrap>
|
||||
<v-flex xs12>
|
||||
<v-layout>
|
||||
<v-flex xs6 class="px-1 mb-2">
|
||||
<v-text-field
|
||||
label="COMPANY" v-model="input_company"
|
||||
readonly hide-details outline
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex class="px-1 mb-2">
|
||||
<v-text-field
|
||||
label="TIPE JURNAL" v-model="selected_jurnal_type.JurnalTypeName"
|
||||
readonly hide-details outline
|
||||
></v-text-field>
|
||||
<p v-if="alert_kosong && selected_jurnal_type.JurnalTypeName == ''" class="error pl-2 pr-2" style="color:#fff">Tipe jurnal kosong</p>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
<v-flex xs12>
|
||||
<v-layout>
|
||||
<v-flex xs6 class="px-1 mb-2">
|
||||
<v-text-field
|
||||
label="REGIONAL" v-model="input_regional"
|
||||
readonly hide-details outline
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex class="px-1 mb-2">
|
||||
<v-layout>
|
||||
<v-flex xs6>
|
||||
<v-menu
|
||||
v-model="menufilterdate" :close-on-content-click="false" :nudge-right="40" lazy
|
||||
transition="scale-transition" offset-y full-width max-width="290px"
|
||||
min-width="290px" :disabled="!IsPeriodeSelected"
|
||||
>
|
||||
<template v-slot:activator="{ on }">
|
||||
<v-text-field
|
||||
v-model="filterComputedDateFormatted" class="mr-2" label="Tanggal"
|
||||
outline hide-details readonly v-on="on" :disabled="!IsPeriodeSelected"
|
||||
@blur="date = deFormatedDate(filterComputedDateFormatted)"
|
||||
></v-text-field>
|
||||
</template>
|
||||
<v-date-picker
|
||||
no-title v-model="input_date" @input="menufilterdate = false"
|
||||
:min="periode_start_date" :max="periode_end_date"
|
||||
></v-date-picker>
|
||||
</v-menu>
|
||||
</v-flex>
|
||||
<v-flex>
|
||||
<v-autocomplete
|
||||
label="Periode" :items="list_periode" v-model="selected_periode"
|
||||
:search-input.sync="search_periode" hide-details
|
||||
auto-select-first no-filter item-text="periodeName" outline
|
||||
return-object :loading="search_status" no-data-text="Pilih Periode"
|
||||
>
|
||||
<template slot="item" slot-scope="{ item }">
|
||||
<v-list-tile-content>
|
||||
<v-list-tile-title v-text="item.periodeName"></v-list-tile-title>
|
||||
<v-list-tile-sub-title v-text="item.periode"></v-list-tile-sub-title>
|
||||
</v-list-tile-content>
|
||||
</template>
|
||||
</v-autocomplete>
|
||||
<p v-if="alert_kosong && Object.keys(selected_periode).length == 0" class="error pl-2 pr-2" style="color:#fff">Periode masih kosong</p>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
<v-flex xs12>
|
||||
<v-layout>
|
||||
<v-flex xs6 class="px-1 mb-2">
|
||||
<v-text-field
|
||||
label="CABANG" v-model="input_cabang"
|
||||
readonly hide-details outline
|
||||
></v-text-field>
|
||||
</v-flex>
|
||||
<v-flex class="px-1 mb-2">
|
||||
<v-text-field
|
||||
label="JUDUL" v-model="input_title"
|
||||
hide-details outline
|
||||
></v-text-field>
|
||||
<p v-if="alert_kosong && input_title == ''" class="error pl-2 pr-2" style="color:#fff">Title masih kosong</p>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
<v-flex>
|
||||
<v-layout>
|
||||
<v-textarea
|
||||
v-model="input_description" name="input-7-1" label="DESKRIPSI"
|
||||
hide-details outline
|
||||
></v-textarea>
|
||||
</v-layout>
|
||||
</v-flex>
|
||||
|
||||
</v-layout>
|
||||
|
||||
<v-layout class="pt-3 pb-1">
|
||||
<v-flex text-xs-right>
|
||||
<v-btn
|
||||
color="blue"
|
||||
class="white--text" @click="openDetailDialog()"
|
||||
>TAMBAH</v-btn>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12>
|
||||
<v-data-table
|
||||
:headers="table_headers" :items="table_detail"
|
||||
hide-actions class="elevation-1"
|
||||
>
|
||||
<template slot="items" slot-scope="props">
|
||||
<td class="text-xs-center pa-2">{{ props.item.coano }}</td>
|
||||
<td class="text-xs-center pa-2">{{ props.item.coadesc }}</td>
|
||||
<td class="text-xs-center pa-2">{{ oneMoney(props.item.debet) }}</td>
|
||||
<td class="text-xs-center pa-2">{{ oneMoney(props.item.kredit) }}</td>
|
||||
<td class="text-xs-center pa-2">
|
||||
<v-icon small @click="deleteDetail(props.index)">delete</v-icon>
|
||||
</td>
|
||||
</template>
|
||||
<template v-slot:footer>
|
||||
<tr>
|
||||
<td colspan="2" width="65%" class="pa-2 font-weight-bold">TOTAL</td>
|
||||
<td width="15%" class="text-xs-center pa-2 font-weight-bold">{{ oneMoney(summary_detail.total_debet) }}</td>
|
||||
<td width="15%" class="text-xs-center pa-2 font-weight-bold">{{ oneMoney(summary_detail.total_kredit) }}</td>
|
||||
<td width="5%" class="text-xs-right pa-2 font-weight-bold"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3" class="font-weight-bold pa-2">BALANCE</td>
|
||||
<td width="15%" class="text-xs-right pa-2 font-weight-bold">{{ oneMoney(summary_detail.total_balance) }}</td>
|
||||
<td width="5%" class="font-weight-bold text-xs-right pa-2"></td>
|
||||
</tr>
|
||||
</template>
|
||||
</v-data-table>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
|
||||
<v-divider></v-divider>
|
||||
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="error" flat @click="closeDialog()">TUTUP</v-btn>
|
||||
<v-btn color="primary" @click="simpanJurnal()">SIMPAN</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
|
||||
<template>
|
||||
<v-dialog v-model="detail_dialog" persistent width="40vw">
|
||||
<v-card>
|
||||
<v-card-title class="headline grey lighten-2" primary-title>FORM DETAIL</v-card-title>
|
||||
<v-card-text>
|
||||
<v-layout wrap>
|
||||
<v-flex xs12 class="px-1 mb-2">
|
||||
<v-autocomplete
|
||||
label="COA" :items="list_coa" v-model="selected_coa"
|
||||
:search-input.sync="search_coa" hide-details
|
||||
no-filter item-text="display" outline return-object
|
||||
:loading="search_status" no-data-text="Pilih Coa"
|
||||
>
|
||||
</v-autocomplete>
|
||||
<p v-if="alert_kosong && Object.keys(selected_coa).length == 0" class="error pl-2 pr-2" style="color:#fff">Coa masih kosong</p>
|
||||
</v-flex>
|
||||
<v-flex xs12 class="px-1 mb-2">
|
||||
<v-text-field
|
||||
prefix="Rp"
|
||||
label="DEBET" v-model="formatted_input_detail_debet"
|
||||
outline hide-details>
|
||||
</v-text-field>
|
||||
</v-flex>
|
||||
<v-flex xs12 class="px-1 mb-2">
|
||||
<v-text-field
|
||||
prefix="Rp"
|
||||
label="KREDIT" v-model="formatted_input_detail_kredit"
|
||||
outline hide-details>
|
||||
</v-text-field>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-card-text>
|
||||
<v-divider></v-divider>
|
||||
|
||||
<v-card-actions>
|
||||
<v-spacer></v-spacer>
|
||||
<v-btn color="error" flat @click="closeDetailDialog()">
|
||||
BATAL
|
||||
</v-btn>
|
||||
<v-btn color="primary" @click="tambahDetail()">TAMBAH</v-btn>
|
||||
</v-card-actions>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
|
||||
<v-snackbar v-model="crud_jurnal.state" :timeout="5000" :multi-line="false" :vertical="false" :top="true" :color="crud_jurnal.color">
|
||||
{{ crud_jurnal.msg }}
|
||||
<v-btn flat @click="closeSnackbar(false)">Tutup</v-btn>
|
||||
</v-snackbar>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
||||
<style scoped></style>
|
||||
|
||||
<script>
|
||||
module.exports= {
|
||||
name: "pengeluaranBarang",
|
||||
components: {
|
||||
|
||||
},
|
||||
mounted() {
|
||||
this.$store.dispatch("pengeluaranbarang/getperiode", {search: ""})
|
||||
},
|
||||
data: () => ({
|
||||
menufilterdate: false,
|
||||
search_periode: "",
|
||||
search_coa: "",
|
||||
date: new Date().toISOString().substr(0, 10),
|
||||
table_headers: [
|
||||
{
|
||||
text: "AKUN",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "action",
|
||||
width: "30%",
|
||||
class: "pa-2 pl-2 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "DESKRIPSI",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "mr",
|
||||
width: "35%",
|
||||
class: "pa-2 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "DEBET",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "lab",
|
||||
width: "15%",
|
||||
class: "pa-2 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "KREDIT",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "lab",
|
||||
width: "15%",
|
||||
class: "pa-2 blue lighten-3 white--text",
|
||||
},
|
||||
{
|
||||
text: "AKSI",
|
||||
align: "center",
|
||||
sortable: false,
|
||||
value: "lab",
|
||||
width: "5%",
|
||||
class: "pa-2 blue lighten-3 white--text",
|
||||
},
|
||||
],
|
||||
alert_kosong: false,
|
||||
}),
|
||||
computed: {
|
||||
formatted_input_detail_debet: {
|
||||
get() {
|
||||
return this.oneMoney(this.input_detail_debet);
|
||||
},
|
||||
set(value) {
|
||||
// Hilangkan titik dan koma, ubah jadi number
|
||||
let raw = value.replace(/\./g, '').replace(',', '.');
|
||||
this.input_detail_debet = parseFloat(raw) || 0;
|
||||
}
|
||||
},
|
||||
formatted_input_detail_kredit: {
|
||||
get() {
|
||||
return this.oneMoney(this.input_detail_kredit);
|
||||
},
|
||||
set(value) {
|
||||
// Hilangkan titik dan koma, ubah jadi number
|
||||
let raw = value.replace(/\./g, '').replace(',', '.');
|
||||
this.input_detail_kredit = parseFloat(raw) || 0;
|
||||
}
|
||||
},
|
||||
opp_type() {
|
||||
return this.$store.state.pengeluaranbarang.opp_type
|
||||
},
|
||||
user() {
|
||||
return this.$store.state.pengeluaranbarang.user;
|
||||
},
|
||||
input_company() {
|
||||
return this.$store.state.pengeluaranbarang.input_company
|
||||
},
|
||||
input_regional() {
|
||||
return this.$store.state.pengeluaranbarang.input_regional
|
||||
},
|
||||
input_cabang() {
|
||||
return this.$store.state.pengeluaranbarang.input_cabang
|
||||
},
|
||||
pengeluaranbarang_dialog: {
|
||||
get() {
|
||||
return this.$store.state.pengeluaranbarang.keluar_barang_dialog;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("pengeluaranbarang/update_pengeluaran_barang_dialog", val)
|
||||
}
|
||||
},
|
||||
search_status() {
|
||||
return this.$store.state.pengeluaranbarang.search_status == 1
|
||||
},
|
||||
selected_jurnal_type() {
|
||||
return this.$store.state.pengeluaranbarang.selected_jurnal_type
|
||||
},
|
||||
periode_start_date: {
|
||||
get() {
|
||||
return this.$store.state.pengeluaranbarang.periode_start_date;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("pengeluaranbarang/update_periode_start_date", val)
|
||||
}
|
||||
},
|
||||
periode_end_date: {
|
||||
get() {
|
||||
return this.$store.state.pengeluaranbarang.periode_end_date;
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("pengeluaranbarang/update_periode_end_date", val)
|
||||
}
|
||||
},
|
||||
input_date: {
|
||||
get() {
|
||||
return this.$store.state.pengeluaranbarang.input_date
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("pengeluaranbarang/update_input_date", val)
|
||||
}
|
||||
},
|
||||
input_title: {
|
||||
get() {
|
||||
return this.$store.state.pengeluaranbarang.input_title
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("pengeluaranbarang/update_input_title", val)
|
||||
}
|
||||
},
|
||||
input_description: {
|
||||
get() {
|
||||
return this.$store.state.pengeluaranbarang.input_description
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("pengeluaranbarang/update_input_description", val)
|
||||
}
|
||||
},
|
||||
filterComputedDateFormatted() {
|
||||
return this.formatDate(this.input_date)
|
||||
},
|
||||
IsPeriodeSelected() {
|
||||
return this.periode_start_date && this.periode_end_date
|
||||
},
|
||||
list_periode() {
|
||||
return this.$store.state.pengeluaranbarang.list_periode
|
||||
},
|
||||
selected_periode: {
|
||||
get() {
|
||||
return this.$store.state.pengeluaranbarang.selected_periode
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("pengeluaranbarang/update_selected_periode", val)
|
||||
}
|
||||
},
|
||||
detail_dialog: {
|
||||
get() {
|
||||
return this.$store.state.pengeluaranbarang.detail_dialog
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("pengeluaranbarang/update_detail_dialog", val)
|
||||
}
|
||||
},
|
||||
table_detail() {
|
||||
return this.$store.state.pengeluaranbarang.table_detail
|
||||
},
|
||||
summary_detail() {
|
||||
return this.$store.state.pengeluaranbarang.summary_detail
|
||||
},
|
||||
list_coa(){
|
||||
return this.$store.state.pengeluaranbarang.list_coa
|
||||
},
|
||||
selected_coa: {
|
||||
get() {
|
||||
return this.$store.state.pengeluaranbarang.selected_coa
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("pengeluaranbarang/update_selected_coa", val)
|
||||
}
|
||||
},
|
||||
input_detail_debet: {
|
||||
get() {
|
||||
return this.$store.state.pengeluaranbarang.input_detail_debet
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("pengeluaranbarang/update_input_detail_debet", val)
|
||||
}
|
||||
},
|
||||
input_detail_kredit: {
|
||||
get() {
|
||||
return this.$store.state.pengeluaranbarang.input_detail_kredit
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("pengeluaranbarang/update_input_detail_kredit", val)
|
||||
}
|
||||
},
|
||||
crud_jurnal_status: {
|
||||
get() {
|
||||
return this.$store.state.pengeluaranbarang.crud_jurnal_status
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("pengeluaranbarang/update_crud_jurnal_status", val)
|
||||
}
|
||||
},
|
||||
crud_jurnal: {
|
||||
get() {
|
||||
return this.$store.state.pengeluaranbarang.crud_jurnal
|
||||
},
|
||||
set(val) {
|
||||
this.$store.commit("pengeluaranbarang/update_crud_jurnal", val)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
roundToThreeSignificantDigits(num) {
|
||||
if (num === 0) return 0;
|
||||
|
||||
// Hitung jumlah digit
|
||||
const absNum = Math.abs(num);
|
||||
const magnitude = Math.floor(Math.log10(absNum)) + 1;
|
||||
|
||||
// Jika kurang dari 3 digit, tidak perlu dibulatkan
|
||||
if (magnitude <= 3) return num;
|
||||
|
||||
// Hitung faktor pembulatan
|
||||
const factor = Math.pow(10, magnitude - 3);
|
||||
|
||||
// Bulatkan
|
||||
return Math.round(num / factor) * factor;
|
||||
},
|
||||
oneMoney(value){
|
||||
//return one_money(value);
|
||||
let splitValue = value.toString().split(".");
|
||||
if(splitValue.length > 1) {
|
||||
let val = splitValue[0]
|
||||
return val.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".") + "," + this.roundToThreeSignificantDigits(splitValue[1]);
|
||||
} else {
|
||||
return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
||||
}
|
||||
},
|
||||
convertMoney(money){
|
||||
return one_money(money)
|
||||
},
|
||||
formatAngka(nilai) {
|
||||
// Jika tidak ada nilai
|
||||
if (!nilai) return '';
|
||||
|
||||
try {
|
||||
// Ubah ke string
|
||||
let strNilai = String(nilai);
|
||||
|
||||
// Jika berisi titik desimal
|
||||
if (strNilai.includes('.')) {
|
||||
// Split bagian utama dan desimal
|
||||
let bagian = strNilai.split('.');
|
||||
let utama = bagian[0];
|
||||
let desimal = bagian[1];
|
||||
|
||||
// Format bagian utama
|
||||
utama = utama.replace(/\B(?=(\d{3})+(?!\d))/g, '.');
|
||||
|
||||
// Kembalikan gabungan
|
||||
return utama + ',' + desimal;
|
||||
} else {
|
||||
// Tidak ada desimal, hanya format bagian utama
|
||||
return strNilai.replace(/\B(?=(\d{3})+(?!\d))/g, '.');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Error formatting:", error);
|
||||
return nilai;
|
||||
}
|
||||
},
|
||||
closeDialog() {
|
||||
this.alert_kosong = false
|
||||
this.$store.commit("pengeluaranbarang/update_selected_jurnal_type", {})
|
||||
this.$store.commit("pengeluaranbarang/update_selected_periode", {})
|
||||
this.$store.commit("pengeluaranbarang/update_input_title", "")
|
||||
this.$store.commit("pengeluaranbarang/update_input_description", "")
|
||||
this.selected_coa = {}
|
||||
this.input_detail_debet = 0
|
||||
this.input_detail_kredit = 0
|
||||
this.$store.commit("pengeluaranbarang/update_pengeluaran_barang_dialog", false)
|
||||
this.$store.commit("jurnalumum/update_x_drop_tipe_jurnal", {});
|
||||
},
|
||||
openDetailDialog() {
|
||||
let tipejurnal = this.selected_jurnal_type
|
||||
let periode = this.selected_periode
|
||||
let title = this.input_title
|
||||
if (Object.keys(tipejurnal).length == 0 || Object.keys(periode).length == 0 || title == "") {
|
||||
this.alert_kosong = true
|
||||
return
|
||||
}
|
||||
|
||||
this.$store.commit("pengeluaranbarang/update_list_coa", [])
|
||||
this.selected_coa = {}
|
||||
this.input_detail_debet = 0
|
||||
this.input_detail_kredit = 0
|
||||
this.detail_dialog = true
|
||||
this.alert_kosong = false
|
||||
},
|
||||
closeDetailDialog() {
|
||||
this.selected_coa = {}
|
||||
this.input_detail_debet = 0
|
||||
this.input_detail_kredit = 0
|
||||
this.detail_dialog = false
|
||||
},
|
||||
closeSnackbar(state) {
|
||||
let a = {
|
||||
state: state,
|
||||
msg: "",
|
||||
color: ""
|
||||
}
|
||||
this.crud_jurnal = a
|
||||
},
|
||||
simpanJurnal() {
|
||||
if (this.summary_detail.total_kredit != this.summary_detail.total_debet) {
|
||||
let a = {
|
||||
state: true,
|
||||
msg: "Balance kredit dan debet tidak sama",
|
||||
color: "warning"
|
||||
}
|
||||
this.crud_jurnal = a
|
||||
return
|
||||
}
|
||||
|
||||
let obj = {
|
||||
periodeid: this.selected_periode.periodeID,
|
||||
title: this.input_title,
|
||||
description: this.input_description,
|
||||
date: this.input_date,
|
||||
jurnaltypeid: this.selected_jurnal_type.JurnalTypeID,
|
||||
detail: this.table_detail
|
||||
}
|
||||
|
||||
let operation = this.$store.state.pengeluaranbarang.opp_type
|
||||
if (operation == "add") {
|
||||
this.$store.dispatch("pengeluaranbarang/simpan_jurnal", obj)
|
||||
} else if (operation == "edit") {
|
||||
obj.jurnalid = this.$store.state.pengeluaranbarang.current_jurnal.jurnalID
|
||||
this.$store.dispatch("pengeluaranbarang/simpan_edit_jurnal", obj)
|
||||
}
|
||||
},
|
||||
tambahDetail() {
|
||||
if (Object.keys(this.selected_coa).length == 0) {
|
||||
this.alert_kosong = true
|
||||
return
|
||||
}
|
||||
|
||||
let obj = {
|
||||
coaid: this.selected_coa.id,
|
||||
coano: this.selected_coa.number,
|
||||
coadesc: this.selected_coa.keterangan,
|
||||
debet: this.input_detail_debet,
|
||||
kredit: this.input_detail_kredit
|
||||
}
|
||||
|
||||
this.$store.dispatch("pengeluaranbarang/add_detail_table", obj)
|
||||
this.alert_kosong = false
|
||||
this.detail_dialog = false
|
||||
},
|
||||
deleteDetail(index) {
|
||||
this.$store.dispatch("pengeluaranbarang/del_detail_table", index)
|
||||
},
|
||||
formatDate(date) {
|
||||
if (!date) return null
|
||||
|
||||
const [year, month, day] = date.split('-')
|
||||
return `${day}-${month}-${year}`
|
||||
},
|
||||
deFormatedDate(date) {
|
||||
if (!date) return null
|
||||
|
||||
const [day, month, year] = date.split('-')
|
||||
return `${year}-${month.padStart(2, '0')}-${day.padStart(2, '0')}`
|
||||
},
|
||||
fn_search_periode: _.debounce(function () {
|
||||
this.$store.dispatch("pengeluaranbarang/getperiode", {search: this.search_periode})
|
||||
}, 1000),
|
||||
fn_search_coa: _.debounce(function() {
|
||||
this.$store.dispatch("pengeluaranbarang/getcoa", {search: this.search_coa})
|
||||
}, 1000),
|
||||
formatCurrency(val) {
|
||||
let price = parseFloat(val);
|
||||
let IDR = new Intl.NumberFormat("id-ID", {
|
||||
style: "currency",
|
||||
currency: "IDR",
|
||||
});
|
||||
return `${IDR.format(price)}`;
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
search_periode(val, old) {
|
||||
if (val == old) return;
|
||||
if (!val) return;
|
||||
if (val.length < 1) return;
|
||||
if (this.$store.state.pengeluaranbarang.search_status == 1) return;
|
||||
this.fn_search_periode();
|
||||
},
|
||||
search_coa(val, old) {
|
||||
if (val == old) return;
|
||||
if (!val) return;
|
||||
if (val.length < 1) return;
|
||||
if (this.$store.state.pengeluaranbarang.search_status == 1) return;
|
||||
this.fn_search_coa();
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
1028
test/vuex/acc-one-jurnal/components/terimaBarangForm.vue
Normal file
1028
test/vuex/acc-one-jurnal/components/terimaBarangForm.vue
Normal file
File diff suppressed because it is too large
Load Diff
69
test/vuex/acc-one-jurnal/index.php
Normal file
69
test/vuex/acc-one-jurnal/index.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<link rel="stylesheet" href="../../../libs/vendor/css/google-fonts.css">
|
||||
<link rel="stylesheet" href="../../../libs/vendor/css/icomoon-fonts.css">
|
||||
<link rel="stylesheet" href="../../../libs/vendor/css/vuetify.min.css">
|
||||
<title>One</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div v-cloak id="app">
|
||||
<v-app id="smartApp">
|
||||
<one-navbar></one-navbar>
|
||||
<v-content style="background: #F5E8DF!important">
|
||||
<v-container fluid fill-height class="pl-1 pr-1 pt-2 pb-2">
|
||||
<v-layout row wrap>
|
||||
<v-flex xs12 class="left" fill-height pa-1>
|
||||
<one-jurnal-list></one-jurnal-list>
|
||||
</v-flex>
|
||||
</v-layout>
|
||||
</v-container>
|
||||
</v-content>
|
||||
<one-footer> </one-footer>
|
||||
</v-app>
|
||||
</div>
|
||||
|
||||
<!-- Vendor -->
|
||||
<script src="../../../libs/vendor/moment.min.js"></script>
|
||||
<script src="../../../libs/vendor/numeral.min.js"></script>
|
||||
<script src="../../../libs/vendor/moment-locale-id.js"></script>
|
||||
<script src="../../../libs/vendor/lodash.js"></script>
|
||||
<script src="../../../libs/vendor/axios.min.js"></script>
|
||||
<script src="../../../libs/vendor/vue.js"></script>
|
||||
<script src="../../../libs/vendor/vuex.js"></script>
|
||||
<script src="../../../libs/vendor/vuetify.js"></script>
|
||||
<script src="../../../libs/vendor/httpVueLoader.js"></script>
|
||||
<script src="../../../libs/one_global.js"></script>
|
||||
|
||||
<!-- App Script -->
|
||||
<script type="module">
|
||||
import {
|
||||
store
|
||||
} from './store.js';
|
||||
window.store = store;
|
||||
new Vue({
|
||||
store,
|
||||
el: '#app',
|
||||
methods: {
|
||||
|
||||
},
|
||||
components: {
|
||||
'one-navbar': httpVueLoader('../../../apps/components/oneNavbarComponent.vue'),
|
||||
'one-footer': httpVueLoader('../../../apps/components/oneFooter.vue'),
|
||||
'one-jurnal-list': httpVueLoader('./components/accountOneJurnalList.vue')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style>
|
||||
[v-cloak] {
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
898
test/vuex/acc-one-jurnal/modules/jpbreg.js
Normal file
898
test/vuex/acc-one-jurnal/modules/jpbreg.js
Normal file
@@ -0,0 +1,898 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/jpbreg.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
last_id: -1,
|
||||
loading: false,
|
||||
dialogForm: false,
|
||||
dialogType: 'N',
|
||||
startDate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
endDate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
selectedDate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
user: one_user(),
|
||||
jurnalTypeList: [],
|
||||
selectedJurnalType: {},
|
||||
balance: {
|
||||
debet: 0,
|
||||
kredit: 0,
|
||||
balance: 0,
|
||||
},
|
||||
balanceRegional: {
|
||||
debet: 0,
|
||||
kredit: 0,
|
||||
balance: 0,
|
||||
},
|
||||
defaultJurnalType: {},
|
||||
loading: false,
|
||||
periodeList: [],
|
||||
searchPeriode: '',
|
||||
selectedPeriode: {},
|
||||
loadingAutocomplete: false,
|
||||
title: '',
|
||||
coaList: [],
|
||||
searchCoa: '',
|
||||
selectedCoa: {},
|
||||
sallary: 0,
|
||||
description: '',
|
||||
branchPercentList: [],
|
||||
selectedBranchPercent: {},
|
||||
defaultBranch: [],
|
||||
detailJurnalGaji: [],
|
||||
detailJurnalGajiRegional: [],
|
||||
dialogAddDetail: false,
|
||||
coaListDetail: [],
|
||||
selectedCoaDetail: {},
|
||||
searchCoaDetail: '',
|
||||
coaListKas: [],
|
||||
selectedCoaKas: {},
|
||||
searchCoaKas: '',
|
||||
selectedBranchDetail: {},
|
||||
kreditDetail: 0,
|
||||
debetDetail: 0,
|
||||
snackbar: {
|
||||
state: false,
|
||||
color: 'success',
|
||||
msg: ''
|
||||
},
|
||||
idEdit: 0,
|
||||
isEdit: 'N',
|
||||
jurnalNumber: "",
|
||||
},
|
||||
mutations: {
|
||||
update_jurnalNumber(state, val) {
|
||||
state.jurnalNumber = val
|
||||
},
|
||||
update_debetDetail(state, val) {
|
||||
state.debetDetail = val
|
||||
},
|
||||
update_dialogType(state, val) {
|
||||
state.dialogType = val
|
||||
},
|
||||
update_idEdit(state, val) {
|
||||
state.idEdit = val
|
||||
},
|
||||
update_balance(state, val) {
|
||||
state.balance = val
|
||||
},
|
||||
update_balanceRegional(state, val) {
|
||||
state.balanceRegional = val
|
||||
},
|
||||
update_snackbar(state, val) {
|
||||
state.snackbar = val
|
||||
},
|
||||
update_kreditDetail(state, val) {
|
||||
state.kreditDetail = val
|
||||
},
|
||||
update_selectedBranchDetail(state, val) {
|
||||
state.selectedBranchDetail = val
|
||||
},
|
||||
update_coaListKas(state, val) {
|
||||
state.coaListKas = val
|
||||
},
|
||||
update_searchCoaKas(state, val) {
|
||||
state.searchCoaKas = val
|
||||
},
|
||||
update_selectedCoaKas(state, val) {
|
||||
state.selectedCoaKas = val
|
||||
},
|
||||
update_coaListDetail(state, val) {
|
||||
state.coaListDetail = val
|
||||
},
|
||||
update_searchCoaDetail(state, val) {
|
||||
state.searchCoaDetail = val
|
||||
},
|
||||
update_selectedCoaDetail(state, val) {
|
||||
state.selectedCoaDetail = val
|
||||
},
|
||||
update_detailJurnalGaji(state, val) {
|
||||
state.detailJurnalGaji = val
|
||||
},
|
||||
update_detailJurnalGajiRegional(state, val) {
|
||||
state.detailJurnalGajiRegional = val
|
||||
},
|
||||
update_dialogAddDetail(state, val) {
|
||||
state.dialogAddDetail = val
|
||||
},
|
||||
update_title(state, val) {
|
||||
state.title = val
|
||||
},
|
||||
update_defaultBranch(state, val) {
|
||||
state.defaultBranch = val
|
||||
},
|
||||
update_branchPercentList(state, val) {
|
||||
state.branchPercentList = val
|
||||
},
|
||||
update_selectedBranchPercent(state, val) {
|
||||
state.selectedBranchPercent = val
|
||||
},
|
||||
update_selectedDate(state, val) {
|
||||
state.selectedDate = val
|
||||
},
|
||||
update_loadingAutocomplete(state, val) {
|
||||
state.loadingAutocomplete = val
|
||||
},
|
||||
update_coaList(state, val) {
|
||||
state.coaList = val
|
||||
},
|
||||
update_searchCoa(state, val) {
|
||||
state.searchCoa = val
|
||||
},
|
||||
update_selectedCoa(state, val) {
|
||||
state.selectedCoa = val
|
||||
},
|
||||
update_selectedPeriode(state, val) {
|
||||
state.selectedPeriode = val
|
||||
},
|
||||
update_searchPeriode(state, val) {
|
||||
state.searchPeriode = val
|
||||
},
|
||||
update_periodeList(state, val) {
|
||||
state.periodeList = val
|
||||
},
|
||||
update_loading(state, val) {
|
||||
state.loading = val
|
||||
},
|
||||
update_defaultJurnalType(state, val) {
|
||||
state.defaultJurnalType = val
|
||||
},
|
||||
update_selectedJurnalType(state, val) {
|
||||
state.selectedJurnalType = val
|
||||
},
|
||||
update_jurnalTypeList(state, val) {
|
||||
state.jurnalTypeList = val
|
||||
},
|
||||
update_dialogForm(state, val) {
|
||||
state.dialogForm = val
|
||||
},
|
||||
update_startDate(state, val) {
|
||||
state.startDate = val
|
||||
},
|
||||
update_endDate(state, val) {
|
||||
state.endDate = val
|
||||
},
|
||||
update_sallary(state, val) {
|
||||
state.sallary = val
|
||||
},
|
||||
update_description(state, val) {
|
||||
state.description = val
|
||||
},
|
||||
update_isEdit(state, val) {
|
||||
state.isEdit = val
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
countSummary(context) {
|
||||
let kredit = 0;
|
||||
let debet = 0;
|
||||
context.state.detailJurnalGaji.forEach((e) => {
|
||||
if (e.type === "D") {
|
||||
debet = parseFloat(e.debet) + debet;
|
||||
}
|
||||
if (e.type === "K") {
|
||||
kredit = parseFloat(e.kredit) + kredit;
|
||||
}
|
||||
});
|
||||
let total = debet - kredit;
|
||||
|
||||
let summary = {
|
||||
debet: debet,
|
||||
kredit: kredit,
|
||||
balance: total,
|
||||
};
|
||||
context.commit("update_balance", summary)
|
||||
// this.balance = summary;
|
||||
},
|
||||
countSummaryRegional(context) {
|
||||
let kredit = 0;
|
||||
let debet = 0;
|
||||
context.state.detailJurnalGajiRegional.forEach((e) => {
|
||||
if (e.type === "D") {
|
||||
debet = parseFloat(e.debet) + debet;
|
||||
}
|
||||
if (e.type === "K") {
|
||||
kredit = parseFloat(e.kredit) + kredit;
|
||||
}
|
||||
});
|
||||
let total = debet - kredit;
|
||||
|
||||
let summary = {
|
||||
debet: debet,
|
||||
kredit: kredit,
|
||||
balance: total,
|
||||
};
|
||||
context.commit("update_balanceRegional", summary)
|
||||
|
||||
},
|
||||
async getDetail(context, prm) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.getDetail(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading", false)
|
||||
console.log(resp);
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
} else {
|
||||
console.log(resp.data);
|
||||
// setTimeout(() => {
|
||||
// // Tambahkan logika yang ingin dijalankan setelah 3 detik di sini
|
||||
// console.log("Timer selesai, menjalankan sesuatu setelah 3 detik");
|
||||
// context.commit("update_loading", false)
|
||||
// }, 3000);
|
||||
context.commit("update_selectedPeriode", resp.data.periode)
|
||||
context.commit("update_searchPeriode", resp.data.periode.display)
|
||||
context.commit("update_title", resp.data.title)
|
||||
context.commit("update_selectedDate", resp.data.date)
|
||||
// context.commit("update_selectedCoa", resp.data.coa)
|
||||
// context.commit("update_searchCoa", resp.data.coa.display)
|
||||
// context.commit("update_selectedCoaKas", resp.data.coaKas)
|
||||
// context.commit("update_searchCoaKas", resp.data.coaKas.display ?? '')
|
||||
// context.commit("update_sallary", resp.data.sallary)
|
||||
context.commit("update_isEdit", resp.data.isEdit)
|
||||
context.commit("update_jurnalNumber", resp.data.jurnal.jurnalNo)
|
||||
context.commit("update_selectedBranchDetail", resp.data.destination)
|
||||
context.commit("update_description", resp.data.description)
|
||||
context.commit("update_detailJurnalGaji", resp.data.jurnalDetail)
|
||||
// context.commit("update_detailJurnalGajiRegional", resp.data.jurnalDetailRegional)
|
||||
// context.commit("update_dialogType", resp.data.type)
|
||||
// context.commit("update_selectedBranchPercent", resp.data.branchPrecent)
|
||||
context.dispatch("countSummary")
|
||||
context.dispatch("countSummaryRegional")
|
||||
context.commit("update_loading", false)
|
||||
|
||||
// let snackbar = {
|
||||
// state: true,
|
||||
// color: 'success',
|
||||
// msg: 'Berhasil tambah jurnal gaji regional'
|
||||
// }
|
||||
// context.commit("update_snackbar", snackbar)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading", false)
|
||||
console.log(e)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: e.message
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
}
|
||||
},
|
||||
async saveJurnal(context, prm) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
|
||||
prm.token = one_token()
|
||||
let resp = await api.saveJurnal(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading", false)
|
||||
console.log(resp);
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loading", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'success',
|
||||
msg: 'Berhasil tambah jurnal pengiriman barang ke cabang ' + prm.branchName
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
|
||||
context.commit("update_selectedPeriode", {})
|
||||
context.commit("update_selectedCoa", {})
|
||||
context.commit("update_selectedCoaDetail", {})
|
||||
context.commit("update_coaList", [])
|
||||
context.commit("update_coaListKas", [])
|
||||
context.commit("update_selectedCoaKas", {})
|
||||
context.commit("update_selectedBranchPercent", {})
|
||||
context.commit("update_selectedBranchDetail", {})
|
||||
|
||||
context.commit("update_detailJurnalGaji", [])
|
||||
context.commit("update_detailJurnalGajiRegional", [])
|
||||
context.commit("jurnalumum/update_x_drop_tipe_jurnal", {}, {root: true});
|
||||
|
||||
let blc = {
|
||||
debet: 0,
|
||||
kredit: 0,
|
||||
balance: 0,
|
||||
};
|
||||
context.commit("update_balance", blc)
|
||||
context.commit("update_balanceRegional", blc)
|
||||
context.commit("update_sallary", 0)
|
||||
context.commit("update_searchCoa", '')
|
||||
context.commit("update_searchCoaKas", '')
|
||||
context.commit("update_title", '')
|
||||
context.commit("update_description", '')
|
||||
context.commit("update_dialogForm", false)
|
||||
const jurnalumumState = context.rootState.jurnalumum;
|
||||
|
||||
context.dispatch("jurnalumum/search", {
|
||||
regionalid: jurnalumumState.user.S_RegionalID,
|
||||
branchid: jurnalumumState.user.M_BranchID,
|
||||
current_page: jurnalumumState.current_page,
|
||||
search: jurnalumumState.x_search,
|
||||
startdate: jurnalumumState.start_date,
|
||||
enddate: jurnalumumState.end_date,
|
||||
last_id: -1,
|
||||
}, { root: true });
|
||||
|
||||
|
||||
// this.sallary = 0;
|
||||
// this.searchCoa = "";
|
||||
// this.searchCoaKas = "";
|
||||
// this.title = "";
|
||||
// this.description = "";
|
||||
// console.log("close dialogs");
|
||||
// this.$emit("update:show", false);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading", false)
|
||||
console.log(e)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: e.message
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
}
|
||||
},
|
||||
async editJurnal(context, prm) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
|
||||
prm.token = one_token()
|
||||
let resp = await api.editJurnal(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading", false)
|
||||
console.log(resp);
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loading", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'success',
|
||||
msg: 'Berhasil ubah jurnal pengiriman barang ke cabang ' + prm.branchName
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
|
||||
context.commit("update_selectedPeriode", {})
|
||||
context.commit("update_selectedCoa", {})
|
||||
context.commit("update_selectedCoaDetail", {})
|
||||
context.commit("update_coaList", [])
|
||||
context.commit("update_coaListKas", [])
|
||||
context.commit("update_selectedCoaKas", {})
|
||||
context.commit("update_selectedBranchPercent", {})
|
||||
context.commit("update_selectedBranchDetail", {})
|
||||
|
||||
context.commit("update_detailJurnalGaji", [])
|
||||
context.commit("update_detailJurnalGajiRegional", [])
|
||||
context.commit("jurnalumum/update_x_drop_tipe_jurnal", {}, {root: true});
|
||||
|
||||
let blc = {
|
||||
debet: 0,
|
||||
kredit: 0,
|
||||
balance: 0,
|
||||
};
|
||||
context.commit("update_balance", blc)
|
||||
context.commit("update_balanceRegional", blc)
|
||||
context.commit("update_sallary", 0)
|
||||
context.commit("update_searchCoa", '')
|
||||
context.commit("update_searchCoaKas", '')
|
||||
context.commit("update_title", '')
|
||||
context.commit("update_description", '')
|
||||
const jurnalumumState = context.rootState.jurnalumum;
|
||||
|
||||
context.dispatch("jurnalumum/search", {
|
||||
regionalid: jurnalumumState.user.S_RegionalID,
|
||||
branchid: jurnalumumState.user.M_BranchID,
|
||||
current_page: jurnalumumState.current_page,
|
||||
search: jurnalumumState.x_search,
|
||||
startdate: jurnalumumState.start_date,
|
||||
enddate: jurnalumumState.end_date,
|
||||
last_id: -1,
|
||||
}, { root: true });
|
||||
context.commit("update_dialogForm", false)
|
||||
|
||||
|
||||
// this.sallary = 0;
|
||||
// this.searchCoa = "";
|
||||
// this.searchCoaKas = "";
|
||||
// this.title = "";
|
||||
// this.description = "";
|
||||
// console.log("close dialogs");
|
||||
// this.$emit("update:show", false);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading", false)
|
||||
console.log(e)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: e.message
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
}
|
||||
},
|
||||
async getJurnalType(context) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.token = one_token()
|
||||
let resp = await api.getJurnalType(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading", false)
|
||||
console.log(resp);
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loading", false)
|
||||
// let cek = 0;
|
||||
// if (parseInt(resp.data) > 0) {
|
||||
// cek = true
|
||||
// }
|
||||
context.commit("update_jurnalTypeList", resp.data.records)
|
||||
context.commit("update_selectedJurnalType", resp.data.default)
|
||||
context.commit("update_defaultJurnalType", resp.data.default)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getDefaultBranch(context) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.token = one_token()
|
||||
prm.company = context.state.user.M_BranchCompanyID
|
||||
prm.regional = context.state.user.S_RegionalID
|
||||
let resp = await api.getDefaultBranch(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading", false)
|
||||
console.log(resp);
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loading", false)
|
||||
// let cek = 0;
|
||||
// if (parseInt(resp.data) > 0) {
|
||||
// cek = true
|
||||
// }
|
||||
context.commit("update_defaultBranch", resp.data)
|
||||
// context.commit("update_selectedJurnalType", resp.data.default)
|
||||
// context.commit("update_defaultJurnalType", resp.data.default)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async deleteJurnal(context, prm) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
|
||||
prm.token = one_token()
|
||||
let resp = await api.deleteJurnal(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading", false)
|
||||
console.log(resp);
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loading", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'success',
|
||||
msg: 'Berhasil delete jurnal gaji regional'
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
|
||||
context.commit("update_snackbar", snackbar)
|
||||
|
||||
context.commit("update_selectedPeriode", {})
|
||||
context.commit("update_selectedCoa", {})
|
||||
context.commit("update_selectedCoaDetail", {})
|
||||
context.commit("update_coaList", [])
|
||||
context.commit("update_coaListKas", [])
|
||||
context.commit("update_selectedCoaKas", {})
|
||||
context.commit("update_selectedBranchPercent", {})
|
||||
context.commit("update_selectedBranchDetail", {})
|
||||
|
||||
context.commit("update_detailJurnalGaji", [])
|
||||
context.commit("update_detailJurnalGajiRegional", [])
|
||||
|
||||
let blc = {
|
||||
debet: 0,
|
||||
kredit: 0,
|
||||
balance: 0,
|
||||
};
|
||||
context.commit("update_balance", blc)
|
||||
context.commit("update_balanceRegional", blc)
|
||||
context.commit("update_sallary", 0)
|
||||
context.commit("update_searchCoa", '')
|
||||
context.commit("update_searchCoaKas", '')
|
||||
context.commit("update_title", '')
|
||||
context.commit("update_description", '')
|
||||
context.commit("update_dialogForm", false)
|
||||
|
||||
const jurnalumumState = context.rootState.jurnalumum;
|
||||
|
||||
context.dispatch("jurnalumum/search", {
|
||||
regionalid: jurnalumumState.user.S_RegionalID,
|
||||
branchid: jurnalumumState.user.M_BranchID,
|
||||
current_page: jurnalumumState.current_page,
|
||||
search: jurnalumumState.x_search,
|
||||
startdate: jurnalumumState.start_date,
|
||||
enddate: jurnalumumState.end_date,
|
||||
last_id: -1,
|
||||
}, { root: true });
|
||||
|
||||
|
||||
|
||||
|
||||
// this.sallary = 0;
|
||||
// this.searchCoa = "";
|
||||
// this.searchCoaKas = "";
|
||||
// this.title = "";
|
||||
// this.description = "";
|
||||
// console.log("close dialogs");
|
||||
// this.$emit("update:show", false);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading", false)
|
||||
console.log(e)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: e.message
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
}
|
||||
},
|
||||
async getBranchpercent(context) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.token = one_token()
|
||||
prm.regional = context.state.user.S_RegionalID
|
||||
let resp = await api.searchBranchPercent(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading", false)
|
||||
console.log(resp);
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loading", false)
|
||||
// let cek = 0;
|
||||
// if (parseInt(resp.data) > 0) {
|
||||
// cek = true
|
||||
// }
|
||||
context.commit("update_branchPercentList", resp.data)
|
||||
// context.commit("update_selectedJurnalType", resp.data.default)
|
||||
// context.commit("update_defaultJurnalType", resp.data.default)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getPeriode(context) {
|
||||
context.commit("update_loadingAutocomplete", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.search = context.state.searchPeriode;
|
||||
prm.token = one_token()
|
||||
let resp = await api.searchPeriode(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(resp);
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
// let cek = 0;
|
||||
// if (parseInt(resp.data) > 0) {
|
||||
// cek = true
|
||||
// }
|
||||
context.commit("update_periodeList", resp.data)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getCoa(context) {
|
||||
context.commit("update_loadingAutocomplete", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.search = context.state.searchCoa;
|
||||
prm.company = context.state.user.M_BranchCompanyID
|
||||
prm.regional = context.state.user.S_RegionalID
|
||||
|
||||
prm.token = one_token()
|
||||
let resp = await api.searchCoa(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(resp);
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
// let cek = 0;
|
||||
// if (parseInt(resp.data) > 0) {
|
||||
// cek = true
|
||||
// }
|
||||
context.commit("update_coaList", resp.data)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getCoaKas(context) {
|
||||
context.commit("update_loadingAutocomplete", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.search = context.state.searchCoaKas;
|
||||
prm.company = context.state.user.M_BranchCompanyID
|
||||
prm.regional = context.state.user.S_RegionalID
|
||||
|
||||
prm.token = one_token()
|
||||
let resp = await api.searchCoa(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(resp);
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
// let cek = 0;
|
||||
// if (parseInt(resp.data) > 0) {
|
||||
// cek = true
|
||||
// }
|
||||
context.commit("update_coaListKas", resp.data)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getCoaDetail(context) {
|
||||
context.commit("update_loadingAutocomplete", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.search = context.state.searchCoaDetail;
|
||||
prm.company = context.state.user.M_BranchCompanyID
|
||||
prm.regional = context.state.user.S_RegionalID
|
||||
prm.branch = context.state.selectedBranchDetail.branchID
|
||||
prm.token = one_token()
|
||||
let resp = await api.searchCoa(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(resp);
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
// let cek = 0;
|
||||
// if (parseInt(resp.data) > 0) {
|
||||
// cek = true
|
||||
// }
|
||||
context.commit("update_coaListDetail", resp.data)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async searchKredit(context) {
|
||||
context.commit("update_loadingAutocomplete", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.search = context.state.searchKredit;
|
||||
prm.token = one_token()
|
||||
let resp = await api.searchkredit(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(resp);
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
// let cek = 0;
|
||||
// if (parseInt(resp.data) > 0) {
|
||||
// cek = true
|
||||
// }
|
||||
context.commit("update_kreditList", resp.data)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async search(context) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
let prm = {}
|
||||
prm.search = context.state.searchTemplate
|
||||
prm.page = context.state.page
|
||||
prm.token = one_token()
|
||||
let resp = await api.search(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading", false)
|
||||
} else {
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_templateList", resp.data.records)
|
||||
context.commit("update_total", resp.data.total)
|
||||
console.log(resp.data);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async insertTemplate(context, prm) {
|
||||
context.commit("update_loadingSave", true)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.insertTemplate(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingSave", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
console.log(resp)
|
||||
} else {
|
||||
context.dispatch("search");
|
||||
context.commit("update_dialogForm", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'success',
|
||||
msg: 'Berhasil tambah data'
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
|
||||
context.commit("update_loadingSave", false)
|
||||
|
||||
console.log(resp.data);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingSave", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: 'Error add data'
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
console.log('error add data')
|
||||
}
|
||||
},
|
||||
async updateTemplate(context, prm) {
|
||||
context.commit("update_loadingSave", true)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.updateTemplate(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingSave", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
console.log(resp)
|
||||
} else {
|
||||
context.dispatch("search");
|
||||
context.commit("update_dialogForm", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'success',
|
||||
msg: 'Berhasil edit data'
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
|
||||
context.commit("update_loadingSave", false)
|
||||
|
||||
console.log(resp.data);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingSave", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: 'Error edit data'
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
console.log('error edit data')
|
||||
}
|
||||
},
|
||||
async deleteTemplate(context, prm) {
|
||||
context.commit("update_loadingSave", true)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.deleteTemplate(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingSave", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
console.log(resp)
|
||||
} else {
|
||||
context.dispatch("search");
|
||||
context.commit("update_dialogAlert", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'success',
|
||||
msg: 'Berhasil delete data'
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
|
||||
context.commit("update_loadingSave", false)
|
||||
|
||||
console.log(resp.data);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingSave", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: 'Error edit data'
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
console.log('error delete data')
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
821
test/vuex/acc-one-jurnal/modules/jurnalbiaya.js
Normal file
821
test/vuex/acc-one-jurnal/modules/jurnalbiaya.js
Normal file
@@ -0,0 +1,821 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/jurnalbiaya.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
last_id: -1,
|
||||
loading: false,
|
||||
dialogForm: false,
|
||||
dialogType: 'N',
|
||||
startDate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
endDate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
selectedDate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
user: one_user(),
|
||||
jurnalTypeList: [],
|
||||
selectedJurnalType: {},
|
||||
balance: {
|
||||
debet: 0,
|
||||
kredit: 0,
|
||||
balance: 0,
|
||||
},
|
||||
balanceRegional: {
|
||||
debet: 0,
|
||||
kredit: 0,
|
||||
balance: 0,
|
||||
},
|
||||
defaultJurnalType: {},
|
||||
loading: false,
|
||||
periodeList: [],
|
||||
searchPeriode: '',
|
||||
selectedPeriode: {},
|
||||
loadingAutocomplete: false,
|
||||
title: '',
|
||||
coaList: [],
|
||||
searchCoa: '',
|
||||
selectedCoa: {},
|
||||
costs: 0,
|
||||
description: '',
|
||||
branchCostPercentList: [],
|
||||
selectedBranchCostPercent: {},
|
||||
defaultBranch: [],
|
||||
detailJurnalBiaya: [],
|
||||
detailJurnalBiayaRegional: [],
|
||||
dialogAddDetail: false,
|
||||
coaListDetail: [],
|
||||
selectedCoaDetail: {},
|
||||
searchCoaDetail: '',
|
||||
coaListKas: [],
|
||||
selectedCoaKas: {},
|
||||
searchCoaKas: '',
|
||||
coaListReg: [],
|
||||
selectedCoaReg: {},
|
||||
searchCoaReg: '',
|
||||
selectedBranchDetail: {},
|
||||
kreditDetail: 0,
|
||||
snackbar: {
|
||||
state: false,
|
||||
color: 'success',
|
||||
msg: ''
|
||||
},
|
||||
idEdit: 0,
|
||||
},
|
||||
mutations: {
|
||||
update_dialogType(state, val) {
|
||||
state.dialogType = val
|
||||
},
|
||||
update_idEdit(state, val) {
|
||||
state.idEdit = val
|
||||
},
|
||||
update_balance(state, val) {
|
||||
state.balance = val
|
||||
},
|
||||
update_balanceRegional(state, val) {
|
||||
state.balanceRegional = val
|
||||
},
|
||||
update_snackbar(state, val) {
|
||||
state.snackbar = val
|
||||
},
|
||||
update_kreditDetail(state, val) {
|
||||
state.kreditDetail = val
|
||||
},
|
||||
update_selectedBranchDetail(state, val) {
|
||||
state.selectedBranchDetail = val
|
||||
},
|
||||
update_coaListKas(state, val) {
|
||||
state.coaListKas = val
|
||||
},
|
||||
update_searchCoaKas(state, val) {
|
||||
state.searchCoaKas = val
|
||||
},
|
||||
update_selectedCoaKas(state, val) {
|
||||
state.selectedCoaKas = val
|
||||
},
|
||||
update_coaListReg(state, val) {
|
||||
state.coaListReg = val
|
||||
},
|
||||
update_searchCoaReg(state, val) {
|
||||
state.searchCoaReg = val
|
||||
},
|
||||
update_selectedCoaReg(state, val) {
|
||||
state.selectedCoaReg = val
|
||||
},
|
||||
update_coaListDetail(state, val) {
|
||||
state.coaListDetail = val
|
||||
},
|
||||
update_searchCoaDetail(state, val) {
|
||||
state.searchCoaDetail = val
|
||||
},
|
||||
update_selectedCoaDetail(state, val) {
|
||||
state.selectedCoaDetail = val
|
||||
},
|
||||
update_detailJurnalBiaya(state, val) {
|
||||
state.detailJurnalBiaya = val
|
||||
},
|
||||
update_detailJurnalBiayaRegional(state, val) {
|
||||
state.detailJurnalBiayaRegional = val
|
||||
},
|
||||
update_dialogAddDetail(state, val) {
|
||||
state.dialogAddDetail = val
|
||||
},
|
||||
update_title(state, val) {
|
||||
state.title = val
|
||||
},
|
||||
update_defaultBranch(state, val) {
|
||||
state.defaultBranch = val
|
||||
},
|
||||
update_branchCostPercentList(state, val) {
|
||||
state.branchCostPercentList = val
|
||||
},
|
||||
update_selectedBranchCostPercent(state, val) {
|
||||
state.selectedBranchCostPercent = val
|
||||
},
|
||||
update_selectedDate(state, val) {
|
||||
state.selectedDate = val
|
||||
},
|
||||
update_loadingAutocomplete(state, val) {
|
||||
state.loadingAutocomplete = val
|
||||
},
|
||||
update_coaList(state, val) {
|
||||
state.coaList = val
|
||||
},
|
||||
update_searchCoa(state, val) {
|
||||
state.searchCoa = val
|
||||
},
|
||||
update_selectedCoa(state, val) {
|
||||
state.selectedCoa = val
|
||||
},
|
||||
update_selectedPeriode(state, val) {
|
||||
state.selectedPeriode = val
|
||||
},
|
||||
update_searchPeriode(state, val) {
|
||||
state.searchPeriode = val
|
||||
},
|
||||
update_periodeList(state, val) {
|
||||
state.periodeList = val
|
||||
},
|
||||
update_loading(state, val) {
|
||||
state.loading = val
|
||||
},
|
||||
update_defaultJurnalType(state, val) {
|
||||
state.defaultJurnalType = val
|
||||
},
|
||||
update_selectedJurnalType(state, val) {
|
||||
state.selectedJurnalType = val
|
||||
},
|
||||
update_jurnalTypeList(state, val) {
|
||||
state.jurnalTypeList = val
|
||||
},
|
||||
update_dialogForm(state, val) {
|
||||
state.dialogForm = val
|
||||
},
|
||||
update_startDate(state, val) {
|
||||
state.startDate = val
|
||||
},
|
||||
update_endDate(state, val) {
|
||||
state.endDate = val
|
||||
},
|
||||
update_costs(state, val) {
|
||||
state.costs = val
|
||||
},
|
||||
update_description(state, val) {
|
||||
state.description = val
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
countSummary(context) {
|
||||
let kredit = 0;
|
||||
let debet = 0;
|
||||
context.state.detailJurnalBiaya.forEach((e) => {
|
||||
if (e.type === "D") {
|
||||
debet = parseFloat(e.debet) + debet;
|
||||
}
|
||||
if (e.type === "K") {
|
||||
kredit = parseFloat(e.kredit) + kredit;
|
||||
}
|
||||
});
|
||||
let total = debet - kredit;
|
||||
|
||||
let summary = {
|
||||
debet: debet,
|
||||
kredit: kredit,
|
||||
balance: total,
|
||||
};
|
||||
context.commit("update_balance", summary)
|
||||
// this.balance = summary;
|
||||
},
|
||||
countSummaryRegional(context) {
|
||||
let kredit = 0;
|
||||
let debet = 0;
|
||||
context.state.detailJurnalBiayaRegional.forEach((e) => {
|
||||
if (e.type === "D") {
|
||||
debet = parseFloat(e.debet) + debet;
|
||||
}
|
||||
if (e.type === "K") {
|
||||
kredit = parseFloat(e.kredit) + kredit;
|
||||
}
|
||||
});
|
||||
let total = debet - kredit;
|
||||
|
||||
let summary = {
|
||||
debet: debet,
|
||||
kredit: kredit,
|
||||
balance: total,
|
||||
};
|
||||
context.commit("update_balanceRegional", summary)
|
||||
|
||||
},
|
||||
async getDetail(context, prm) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.getDetail(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading", false)
|
||||
console.log(resp);
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
} else {
|
||||
console.log(resp.data);
|
||||
// setTimeout(() => {
|
||||
// // Tambahkan logika yang ingin dijalankan setelah 3 detik di sini
|
||||
// console.log("Timer selesai, menjalankan sesuatu setelah 3 detik");
|
||||
// context.commit("update_loading", false)
|
||||
// }, 3000);
|
||||
context.commit("update_selectedPeriode", resp.data.periode)
|
||||
context.commit("update_searchPeriode", resp.data.periode.display)
|
||||
context.commit("update_title", resp.data.title)
|
||||
context.commit("update_selectedDate", resp.data.date)
|
||||
context.commit("update_selectedCoa", resp.data.coa)
|
||||
context.commit("update_searchCoa", resp.data.coa.display)
|
||||
context.commit("update_selectedCoaKas", resp.data.coaKas)
|
||||
context.commit("update_searchCoaKas", resp.data.coaKas.display ?? '')
|
||||
context.commit("update_selectedCoaReg", resp.data.coaReg)
|
||||
context.commit("update_searchCoaReg", resp.data.coaReg.display ?? '')
|
||||
context.commit("update_costs", resp.data.costs)
|
||||
context.commit("update_description", resp.data.description)
|
||||
context.commit("update_detailJurnalBiaya", resp.data.jurnalDetail)
|
||||
context.commit("update_detailJurnalBiayaRegional", resp.data.jurnalDetailRegional)
|
||||
context.commit("update_dialogType", resp.data.type)
|
||||
context.commit("update_selectedBranchCostPercent", resp.data.branchPrecent)
|
||||
context.dispatch("countSummary")
|
||||
context.dispatch("countSummaryRegional")
|
||||
context.commit("update_loading", false)
|
||||
|
||||
// let snackbar = {
|
||||
// state: true,
|
||||
// color: 'success',
|
||||
// msg: 'Berhasil tambah jurnal gaji regional'
|
||||
// }
|
||||
// context.commit("update_snackbar", snackbar)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading", false)
|
||||
console.log(e)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: e.message
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
}
|
||||
},
|
||||
async saveJurnalBiaya(context, prm) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
|
||||
prm.token = one_token()
|
||||
let resp = await api.saveJurnalBiaya(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading", false)
|
||||
console.log(resp);
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loading", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'success',
|
||||
msg: 'Berhasil tambah jurnal biaya regional'
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
|
||||
context.commit("update_selectedPeriode", {})
|
||||
context.commit("update_selectedCoa", {})
|
||||
context.commit("update_coaList", [])
|
||||
context.commit("update_coaListKas", [])
|
||||
context.commit("update_selectedCoaKas", {})
|
||||
context.commit("update_selectedBranchCostPercent", {})
|
||||
|
||||
context.commit("update_detailJurnalBiaya", [])
|
||||
context.commit("update_detailJurnalBiayaRegional", [])
|
||||
|
||||
let blc = {
|
||||
debet: 0,
|
||||
kredit: 0,
|
||||
balance: 0,
|
||||
};
|
||||
context.commit("update_balance", blc)
|
||||
context.commit("update_balanceRegional", blc)
|
||||
context.commit("update_costs", 0)
|
||||
context.commit("update_searchCoa", '')
|
||||
context.commit("update_searchCoaKas", '')
|
||||
context.commit("update_searchCoaReg", '')
|
||||
context.commit("update_title", '')
|
||||
context.commit("update_description", '')
|
||||
context.commit("update_dialogForm", false)
|
||||
context.commit("jurnalumum/update_x_drop_tipe_jurnal", {}, {root: true});
|
||||
const jurnalumumState = context.rootState.jurnalumum;
|
||||
|
||||
context.dispatch("jurnalumum/search", {
|
||||
regionalid: jurnalumumState.user.S_RegionalID,
|
||||
branchid: jurnalumumState.user.M_BranchID,
|
||||
current_page: jurnalumumState.current_page,
|
||||
search: jurnalumumState.x_search,
|
||||
startdate: jurnalumumState.start_date,
|
||||
enddate: jurnalumumState.end_date,
|
||||
last_id: -1,
|
||||
}, { root: true });
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading", false)
|
||||
console.log(e)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: e.message
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
}
|
||||
},
|
||||
async deleteJurnalBiaya(context, prm) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
|
||||
prm.token = one_token()
|
||||
let resp = await api.deleteJurnalBiaya(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading", false)
|
||||
console.log(resp);
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loading", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'success',
|
||||
msg: 'Berhasil delete jurnal biaya regional'
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
|
||||
context.commit("update_selectedPeriode", {})
|
||||
context.commit("update_selectedCoa", {})
|
||||
context.commit("update_coaList", [])
|
||||
context.commit("update_coaListKas", [])
|
||||
context.commit("update_selectedCoaKas", {})
|
||||
context.commit("update_selectedBranchCostPercent", {})
|
||||
|
||||
context.commit("update_detailJurnalBiaya", [])
|
||||
context.commit("update_detailJurnalBiayaRegional", [])
|
||||
|
||||
let blc = {
|
||||
debet: 0,
|
||||
kredit: 0,
|
||||
balance: 0,
|
||||
};
|
||||
|
||||
const jurnalumumState = context.rootState.jurnalumum;
|
||||
|
||||
context.dispatch("jurnalumum/search", {
|
||||
regionalid: jurnalumumState.user.S_RegionalID,
|
||||
branchid: jurnalumumState.user.M_BranchID,
|
||||
current_page: jurnalumumState.current_page,
|
||||
search: jurnalumumState.x_search,
|
||||
startdate: jurnalumumState.start_date,
|
||||
enddate: jurnalumumState.end_date,
|
||||
last_id: -1,
|
||||
}, { root: true });
|
||||
|
||||
|
||||
|
||||
|
||||
// this.costs = 0;
|
||||
// this.searchCoa = "";
|
||||
// this.searchCoaKas = "";
|
||||
// this.title = "";
|
||||
// this.description = "";
|
||||
// console.log("close dialogs");
|
||||
// this.$emit("update:show", false);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading", false)
|
||||
console.log(e)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: e.message
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
}
|
||||
},
|
||||
async getJurnalType(context) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.token = one_token()
|
||||
let resp = await api.getJurnalType(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading", false)
|
||||
console.log(resp);
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loading", false)
|
||||
// let cek = 0;
|
||||
// if (parseInt(resp.data) > 0) {
|
||||
// cek = true
|
||||
// }
|
||||
context.commit("update_jurnalTypeList", resp.data.records)
|
||||
context.commit("update_selectedJurnalType", resp.data.default)
|
||||
context.commit("update_defaultJurnalType", resp.data.default)
|
||||
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getDefaultBranch(context) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.token = one_token()
|
||||
prm.company = context.state.user.M_BranchCompanyID
|
||||
prm.regional = context.state.user.S_RegionalID
|
||||
let resp = await api.getDefaultBranch(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading", false)
|
||||
console.log(resp);
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loading", false)
|
||||
// let cek = 0;
|
||||
// if (parseInt(resp.data) > 0) {
|
||||
// cek = true
|
||||
// }
|
||||
context.commit("update_defaultBranch", resp.data)
|
||||
// context.commit("update_selectedJurnalType", resp.data.default)
|
||||
// context.commit("update_defaultJurnalType", resp.data.default)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getBranchpercent(context) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.token = one_token()
|
||||
prm.regional = context.state.user.S_RegionalID
|
||||
let resp = await api.searchBranchPercent(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading", false)
|
||||
console.log(resp);
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loading", false)
|
||||
// let cek = 0;
|
||||
// if (parseInt(resp.data) > 0) {
|
||||
// cek = true
|
||||
// }
|
||||
context.commit("update_branchCostPercentList", resp.data)
|
||||
// context.commit("update_selectedJurnalType", resp.data.default)
|
||||
// context.commit("update_defaultJurnalType", resp.data.default)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getPeriode(context) {
|
||||
context.commit("update_loadingAutocomplete", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.search = context.state.searchPeriode;
|
||||
prm.token = one_token()
|
||||
let resp = await api.searchPeriode(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(resp);
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
// let cek = 0;
|
||||
// if (parseInt(resp.data) > 0) {
|
||||
// cek = true
|
||||
// }
|
||||
context.commit("update_periodeList", resp.data)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getCoa(context) {
|
||||
context.commit("update_loadingAutocomplete", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.search = context.state.searchCoa;
|
||||
prm.company = context.state.user.M_BranchCompanyID
|
||||
prm.regional = context.state.user.S_RegionalID
|
||||
|
||||
prm.token = one_token()
|
||||
let resp = await api.searchCoa(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(resp);
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
// let cek = 0;
|
||||
// if (parseInt(resp.data) > 0) {
|
||||
// cek = true
|
||||
// }
|
||||
context.commit("update_coaList", resp.data)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getCoaKas(context) {
|
||||
context.commit("update_loadingAutocomplete", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.search = context.state.searchCoaKas;
|
||||
prm.company = context.state.user.M_BranchCompanyID
|
||||
prm.regional = context.state.user.S_RegionalID
|
||||
|
||||
prm.token = one_token()
|
||||
let resp = await api.searchCoa(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(resp);
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
// let cek = 0;
|
||||
// if (parseInt(resp.data) > 0) {
|
||||
// cek = true
|
||||
// }
|
||||
context.commit("update_coaListKas", resp.data)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getCoaReg(context) {
|
||||
context.commit("update_loadingAutocomplete", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.search = context.state.searchCoaReg;
|
||||
prm.company = context.state.user.M_BranchCompanyID
|
||||
prm.regional = context.state.user.S_RegionalID
|
||||
|
||||
prm.token = one_token()
|
||||
let resp = await api.searchCoa(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(resp);
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
// let cek = 0;
|
||||
// if (parseInt(resp.data) > 0) {
|
||||
// cek = true
|
||||
// }
|
||||
context.commit("update_coaListReg", resp.data)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getCoaDetail(context) {
|
||||
context.commit("update_loadingAutocomplete", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.search = context.state.searchCoaDetail;
|
||||
prm.company = context.state.user.M_BranchCompanyID
|
||||
prm.regional = context.state.user.S_RegionalID
|
||||
prm.branch = context.state.selectedBranchDetail.branchID
|
||||
prm.token = one_token()
|
||||
let resp = await api.searchCoaDetail(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(resp);
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
// let cek = 0;
|
||||
// if (parseInt(resp.data) > 0) {
|
||||
// cek = true
|
||||
// }
|
||||
context.commit("update_coaListDetail", resp.data)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async searchKredit(context) {
|
||||
context.commit("update_loadingAutocomplete", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.search = context.state.searchKredit;
|
||||
prm.token = one_token()
|
||||
let resp = await api.searchkredit(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(resp);
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
// let cek = 0;
|
||||
// if (parseInt(resp.data) > 0) {
|
||||
// cek = true
|
||||
// }
|
||||
context.commit("update_kreditList", resp.data)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async search(context) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
let prm = {}
|
||||
prm.search = context.state.searchTemplate
|
||||
prm.page = context.state.page
|
||||
prm.token = one_token()
|
||||
let resp = await api.search(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading", false)
|
||||
} else {
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_templateList", resp.data.records)
|
||||
context.commit("update_total", resp.data.total)
|
||||
console.log(resp.data);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async insertTemplate(context, prm) {
|
||||
context.commit("update_loadingSave", true)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.insertTemplate(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingSave", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
console.log(resp)
|
||||
} else {
|
||||
context.dispatch("search");
|
||||
context.commit("update_dialogForm", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'success',
|
||||
msg: 'Berhasil tambah data'
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
|
||||
context.commit("update_loadingSave", false)
|
||||
|
||||
console.log(resp.data);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingSave", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: 'Error add data'
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
console.log('error add data')
|
||||
}
|
||||
},
|
||||
async updateTemplate(context, prm) {
|
||||
context.commit("update_loadingSave", true)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.updateTemplate(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingSave", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
console.log(resp)
|
||||
} else {
|
||||
context.dispatch("search");
|
||||
context.commit("update_dialogForm", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'success',
|
||||
msg: 'Berhasil edit data'
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
|
||||
context.commit("update_loadingSave", false)
|
||||
|
||||
console.log(resp.data);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingSave", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: 'Error edit data'
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
console.log('error edit data')
|
||||
}
|
||||
},
|
||||
async deleteTemplate(context, prm) {
|
||||
context.commit("update_loadingSave", true)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.deleteTemplate(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingSave", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
console.log(resp)
|
||||
} else {
|
||||
context.dispatch("search");
|
||||
context.commit("update_dialogAlert", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'success',
|
||||
msg: 'Berhasil delete data'
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
|
||||
context.commit("update_loadingSave", false)
|
||||
|
||||
console.log(resp.data);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingSave", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: 'Error edit data'
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
console.log('error delete data')
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
841
test/vuex/acc-one-jurnal/modules/jurnalgaji.js
Normal file
841
test/vuex/acc-one-jurnal/modules/jurnalgaji.js
Normal file
@@ -0,0 +1,841 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/jurnalgaji.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
last_id: -1,
|
||||
loading: false,
|
||||
dialogForm: false,
|
||||
dialogType: 'N',
|
||||
startDate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
endDate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
selectedDate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
user: one_user(),
|
||||
jurnalTypeList: [],
|
||||
selectedJurnalType: {},
|
||||
balance: {
|
||||
debet: 0,
|
||||
kredit: 0,
|
||||
balance: 0,
|
||||
},
|
||||
balanceRegional: {
|
||||
debet: 0,
|
||||
kredit: 0,
|
||||
balance: 0,
|
||||
},
|
||||
defaultJurnalType: {},
|
||||
loading: false,
|
||||
periodeList: [],
|
||||
searchPeriode: '',
|
||||
selectedPeriode: {},
|
||||
loadingAutocomplete: false,
|
||||
title: '',
|
||||
coaList: [],
|
||||
searchCoa: '',
|
||||
selectedCoa: {},
|
||||
sallary: 0,
|
||||
description: '',
|
||||
branchPercentList: [],
|
||||
selectedBranchPercent: {},
|
||||
defaultBranch: [],
|
||||
detailJurnalGaji: [],
|
||||
detailJurnalGajiRegional: [],
|
||||
dialogAddDetail: false,
|
||||
coaListDetail: [],
|
||||
selectedCoaDetail: {},
|
||||
searchCoaDetail: '',
|
||||
coaListKas: [],
|
||||
selectedCoaKas: {},
|
||||
searchCoaKas: '',
|
||||
coaListReg: [],
|
||||
selectedCoaReg: {},
|
||||
searchCoaReg: '',
|
||||
selectedBranchDetail: {},
|
||||
kreditDetail: 0,
|
||||
snackbar: {
|
||||
state: false,
|
||||
color: 'success',
|
||||
msg: ''
|
||||
},
|
||||
idEdit: 0,
|
||||
},
|
||||
mutations: {
|
||||
update_dialogType(state, val) {
|
||||
state.dialogType = val
|
||||
},
|
||||
update_idEdit(state, val) {
|
||||
state.idEdit = val
|
||||
},
|
||||
update_balance(state, val) {
|
||||
state.balance = val
|
||||
},
|
||||
update_balanceRegional(state, val) {
|
||||
state.balanceRegional = val
|
||||
},
|
||||
update_snackbar(state, val) {
|
||||
state.snackbar = val
|
||||
},
|
||||
update_kreditDetail(state, val) {
|
||||
state.kreditDetail = val
|
||||
},
|
||||
update_selectedBranchDetail(state, val) {
|
||||
state.selectedBranchDetail = val
|
||||
},
|
||||
update_coaListKas(state, val) {
|
||||
state.coaListKas = val
|
||||
},
|
||||
update_searchCoaKas(state, val) {
|
||||
state.searchCoaKas = val
|
||||
},
|
||||
update_coaListReg(state, val) {
|
||||
state.coaListReg = val
|
||||
},
|
||||
update_searchCoaReg(state, val) {
|
||||
state.searchCoaReg = val
|
||||
},
|
||||
update_selectedCoaReg(state, val) {
|
||||
state.selectedCoaReg = val
|
||||
},
|
||||
update_selectedCoaKas(state, val) {
|
||||
state.selectedCoaKas = val
|
||||
},
|
||||
update_coaListDetail(state, val) {
|
||||
state.coaListDetail = val
|
||||
},
|
||||
update_searchCoaDetail(state, val) {
|
||||
state.searchCoaDetail = val
|
||||
},
|
||||
update_selectedCoaDetail(state, val) {
|
||||
state.selectedCoaDetail = val
|
||||
},
|
||||
update_detailJurnalGaji(state, val) {
|
||||
state.detailJurnalGaji = val
|
||||
},
|
||||
update_detailJurnalGajiRegional(state, val) {
|
||||
state.detailJurnalGajiRegional = val
|
||||
},
|
||||
update_dialogAddDetail(state, val) {
|
||||
state.dialogAddDetail = val
|
||||
},
|
||||
update_title(state, val) {
|
||||
state.title = val
|
||||
},
|
||||
update_defaultBranch(state, val) {
|
||||
state.defaultBranch = val
|
||||
},
|
||||
update_branchPercentList(state, val) {
|
||||
state.branchPercentList = val
|
||||
},
|
||||
update_selectedBranchPercent(state, val) {
|
||||
state.selectedBranchPercent = val
|
||||
},
|
||||
update_selectedDate(state, val) {
|
||||
state.selectedDate = val
|
||||
},
|
||||
update_loadingAutocomplete(state, val) {
|
||||
state.loadingAutocomplete = val
|
||||
},
|
||||
update_coaList(state, val) {
|
||||
state.coaList = val
|
||||
},
|
||||
update_searchCoa(state, val) {
|
||||
state.searchCoa = val
|
||||
},
|
||||
update_selectedCoa(state, val) {
|
||||
state.selectedCoa = val
|
||||
},
|
||||
update_selectedPeriode(state, val) {
|
||||
state.selectedPeriode = val
|
||||
},
|
||||
update_searchPeriode(state, val) {
|
||||
state.searchPeriode = val
|
||||
},
|
||||
update_periodeList(state, val) {
|
||||
state.periodeList = val
|
||||
},
|
||||
update_loading(state, val) {
|
||||
state.loading = val
|
||||
},
|
||||
update_defaultJurnalType(state, val) {
|
||||
state.defaultJurnalType = val
|
||||
},
|
||||
update_selectedJurnalType(state, val) {
|
||||
state.selectedJurnalType = val
|
||||
},
|
||||
update_jurnalTypeList(state, val) {
|
||||
state.jurnalTypeList = val
|
||||
},
|
||||
update_dialogForm(state, val) {
|
||||
state.dialogForm = val
|
||||
},
|
||||
update_startDate(state, val) {
|
||||
state.startDate = val
|
||||
},
|
||||
update_endDate(state, val) {
|
||||
state.endDate = val
|
||||
},
|
||||
update_sallary(state, val) {
|
||||
state.sallary = val
|
||||
},
|
||||
update_description(state, val) {
|
||||
state.description = val
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
countSummary(context) {
|
||||
let kredit = 0;
|
||||
let debet = 0;
|
||||
context.state.detailJurnalGaji.forEach((e) => {
|
||||
if (e.type === "D") {
|
||||
debet = parseFloat(e.debet) + debet;
|
||||
}
|
||||
if (e.type === "K") {
|
||||
kredit = parseFloat(e.kredit) + kredit;
|
||||
}
|
||||
});
|
||||
let total = debet - kredit;
|
||||
|
||||
let summary = {
|
||||
debet: debet,
|
||||
kredit: kredit,
|
||||
balance: total,
|
||||
};
|
||||
context.commit("update_balance", summary)
|
||||
// this.balance = summary;
|
||||
},
|
||||
countSummaryRegional(context) {
|
||||
let kredit = 0;
|
||||
let debet = 0;
|
||||
context.state.detailJurnalGajiRegional.forEach((e) => {
|
||||
if (e.type === "D") {
|
||||
debet = parseFloat(e.debet) + debet;
|
||||
}
|
||||
if (e.type === "K") {
|
||||
kredit = parseFloat(e.kredit) + kredit;
|
||||
}
|
||||
});
|
||||
let total = debet - kredit;
|
||||
|
||||
let summary = {
|
||||
debet: debet,
|
||||
kredit: kredit,
|
||||
balance: total,
|
||||
};
|
||||
context.commit("update_balanceRegional", summary)
|
||||
|
||||
},
|
||||
async getDetail(context, prm) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.getDetail(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading", false)
|
||||
console.log(resp);
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
} else {
|
||||
console.log(resp.data);
|
||||
// setTimeout(() => {
|
||||
// // Tambahkan logika yang ingin dijalankan setelah 3 detik di sini
|
||||
// console.log("Timer selesai, menjalankan sesuatu setelah 3 detik");
|
||||
// context.commit("update_loading", false)
|
||||
// }, 3000);
|
||||
context.commit("update_selectedPeriode", resp.data.periode)
|
||||
context.commit("update_searchPeriode", resp.data.periode.display)
|
||||
context.commit("update_title", resp.data.title)
|
||||
context.commit("update_selectedDate", resp.data.date)
|
||||
context.commit("update_selectedCoa", resp.data.coa)
|
||||
context.commit("update_searchCoa", resp.data.coa.display)
|
||||
context.commit("update_selectedCoaKas", resp.data.coaKas)
|
||||
context.commit("update_searchCoaKas", resp.data.coaKas.display ?? '')
|
||||
context.commit("update_selectedCoaReg", resp.data.coaReg)
|
||||
context.commit("update_searchCoaReg", resp.data.coaReg.display ?? '')
|
||||
context.commit("update_sallary", resp.data.sallary)
|
||||
context.commit("update_description", resp.data.description)
|
||||
context.commit("update_detailJurnalGaji", resp.data.jurnalDetail)
|
||||
context.commit("update_detailJurnalGajiRegional", resp.data.jurnalDetailRegional)
|
||||
context.commit("update_dialogType", resp.data.type)
|
||||
context.commit("update_selectedBranchPercent", resp.data.branchPrecent)
|
||||
context.dispatch("countSummary")
|
||||
context.dispatch("countSummaryRegional")
|
||||
context.commit("update_loading", false)
|
||||
|
||||
// let snackbar = {
|
||||
// state: true,
|
||||
// color: 'success',
|
||||
// msg: 'Berhasil tambah jurnal gaji regional'
|
||||
// }
|
||||
// context.commit("update_snackbar", snackbar)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading", false)
|
||||
console.log(e)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: e.message
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
}
|
||||
},
|
||||
async saveJurnalGaji(context, prm) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
|
||||
prm.token = one_token()
|
||||
let resp = await api.saveJurnalGaji(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading", false)
|
||||
console.log(resp);
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loading", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'success',
|
||||
msg: 'Berhasil tambah jurnal gaji regional'
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
|
||||
context.commit("update_selectedPeriode", {})
|
||||
context.commit("update_selectedCoa", {})
|
||||
context.commit("update_coaList", [])
|
||||
context.commit("update_coaListKas", [])
|
||||
context.commit("update_selectedCoaKas", {})
|
||||
context.commit("update_selectedBranchPercent", {})
|
||||
|
||||
context.commit("update_detailJurnalGaji", [])
|
||||
context.commit("update_detailJurnalGajiRegional", [])
|
||||
|
||||
let blc = {
|
||||
debet: 0,
|
||||
kredit: 0,
|
||||
balance: 0,
|
||||
};
|
||||
context.commit("update_balance", blc)
|
||||
context.commit("update_balanceRegional", blc)
|
||||
context.commit("update_sallary", 0)
|
||||
context.commit("update_searchCoa", '')
|
||||
context.commit("update_searchCoaKas", '')
|
||||
context.commit("update_searchCoaReg", '')
|
||||
context.commit("update_title", '')
|
||||
context.commit("update_description", '')
|
||||
context.commit("update_dialogForm", false)
|
||||
context.commit("jurnalumum/update_x_drop_tipe_jurnal", {}, {root: true});
|
||||
const jurnalumumState = context.rootState.jurnalumum;
|
||||
// console.log("Data Jurnal Umum:", jurnalumumState);
|
||||
// this.$store.dispatch("jurnalumum/search", {
|
||||
// regionalid: this.$store.state.jurnalumum.user.S_RegionalID,
|
||||
// branchid: this.$store.state.jurnalumum.user.M_BranchID,
|
||||
// current_page: this.$store.state.jurnalumum.current_page,
|
||||
// search: this.$store.state.jurnalumum.x_search,
|
||||
// startdate: this.$store.state.jurnalumum.start_date,
|
||||
// enddate: this.$store.state.jurnalumum.end_date,
|
||||
// last_id: -1,
|
||||
// });
|
||||
context.dispatch("jurnalumum/search", {
|
||||
regionalid: jurnalumumState.user.S_RegionalID,
|
||||
branchid: jurnalumumState.user.M_BranchID,
|
||||
current_page: jurnalumumState.current_page,
|
||||
search: jurnalumumState.x_search,
|
||||
startdate: jurnalumumState.start_date,
|
||||
enddate: jurnalumumState.end_date,
|
||||
last_id: -1,
|
||||
}, { root: true });
|
||||
|
||||
|
||||
|
||||
|
||||
// this.sallary = 0;
|
||||
// this.searchCoa = "";
|
||||
// this.searchCoaKas = "";
|
||||
// this.title = "";
|
||||
// this.description = "";
|
||||
// console.log("close dialogs");
|
||||
// this.$emit("update:show", false);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading", false)
|
||||
console.log(e)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: e.message
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
}
|
||||
},
|
||||
async deleteJurnalgaji(context, prm) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
|
||||
prm.token = one_token()
|
||||
let resp = await api.deleteJurnalgaji(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading", false)
|
||||
console.log(resp);
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loading", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'success',
|
||||
msg: 'Berhasil delete jurnal gaji regional'
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
|
||||
context.commit("update_selectedPeriode", {})
|
||||
context.commit("update_selectedCoa", {})
|
||||
context.commit("update_coaList", [])
|
||||
context.commit("update_coaListKas", [])
|
||||
context.commit("update_selectedCoaKas", {})
|
||||
context.commit("update_selectedBranchPercent", {})
|
||||
|
||||
context.commit("update_detailJurnalGaji", [])
|
||||
context.commit("update_detailJurnalGajiRegional", [])
|
||||
|
||||
let blc = {
|
||||
debet: 0,
|
||||
kredit: 0,
|
||||
balance: 0,
|
||||
};
|
||||
|
||||
const jurnalumumState = context.rootState.jurnalumum;
|
||||
|
||||
context.dispatch("jurnalumum/search", {
|
||||
regionalid: jurnalumumState.user.S_RegionalID,
|
||||
branchid: jurnalumumState.user.M_BranchID,
|
||||
current_page: jurnalumumState.current_page,
|
||||
search: jurnalumumState.x_search,
|
||||
startdate: jurnalumumState.start_date,
|
||||
enddate: jurnalumumState.end_date,
|
||||
last_id: -1,
|
||||
}, { root: true });
|
||||
|
||||
|
||||
|
||||
|
||||
// this.sallary = 0;
|
||||
// this.searchCoa = "";
|
||||
// this.searchCoaKas = "";
|
||||
// this.title = "";
|
||||
// this.description = "";
|
||||
// console.log("close dialogs");
|
||||
// this.$emit("update:show", false);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading", false)
|
||||
console.log(e)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: e.message
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
}
|
||||
},
|
||||
async getJurnalType(context) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.token = one_token()
|
||||
let resp = await api.getJurnalType(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading", false)
|
||||
console.log(resp);
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loading", false)
|
||||
// let cek = 0;
|
||||
// if (parseInt(resp.data) > 0) {
|
||||
// cek = true
|
||||
// }
|
||||
context.commit("update_jurnalTypeList", resp.data.records)
|
||||
context.commit("update_selectedJurnalType", resp.data.default)
|
||||
context.commit("update_defaultJurnalType", resp.data.default)
|
||||
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getDefaultBranch(context) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.token = one_token()
|
||||
prm.company = context.state.user.M_BranchCompanyID
|
||||
prm.regional = context.state.user.S_RegionalID
|
||||
let resp = await api.getDefaultBranch(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading", false)
|
||||
console.log(resp);
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loading", false)
|
||||
// let cek = 0;
|
||||
// if (parseInt(resp.data) > 0) {
|
||||
// cek = true
|
||||
// }
|
||||
context.commit("update_defaultBranch", resp.data)
|
||||
// context.commit("update_selectedJurnalType", resp.data.default)
|
||||
// context.commit("update_defaultJurnalType", resp.data.default)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getBranchpercent(context) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.token = one_token()
|
||||
prm.regional = context.state.user.S_RegionalID
|
||||
let resp = await api.searchBranchPercent(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading", false)
|
||||
console.log(resp);
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loading", false)
|
||||
// let cek = 0;
|
||||
// if (parseInt(resp.data) > 0) {
|
||||
// cek = true
|
||||
// }
|
||||
context.commit("update_branchPercentList", resp.data)
|
||||
// context.commit("update_selectedJurnalType", resp.data.default)
|
||||
// context.commit("update_defaultJurnalType", resp.data.default)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getPeriode(context) {
|
||||
context.commit("update_loadingAutocomplete", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.search = context.state.searchPeriode;
|
||||
prm.token = one_token()
|
||||
let resp = await api.searchPeriode(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(resp);
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
// let cek = 0;
|
||||
// if (parseInt(resp.data) > 0) {
|
||||
// cek = true
|
||||
// }
|
||||
context.commit("update_periodeList", resp.data)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getCoa(context) {
|
||||
context.commit("update_loadingAutocomplete", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.search = context.state.searchCoa;
|
||||
prm.company = context.state.user.M_BranchCompanyID
|
||||
prm.regional = context.state.user.S_RegionalID
|
||||
|
||||
prm.token = one_token()
|
||||
let resp = await api.searchCoa(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(resp);
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
// let cek = 0;
|
||||
// if (parseInt(resp.data) > 0) {
|
||||
// cek = true
|
||||
// }
|
||||
context.commit("update_coaList", resp.data)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getCoaKas(context) {
|
||||
context.commit("update_loadingAutocomplete", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.search = context.state.searchCoaKas;
|
||||
prm.company = context.state.user.M_BranchCompanyID
|
||||
prm.regional = context.state.user.S_RegionalID
|
||||
|
||||
prm.token = one_token()
|
||||
let resp = await api.searchCoa(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(resp);
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
// let cek = 0;
|
||||
// if (parseInt(resp.data) > 0) {
|
||||
// cek = true
|
||||
// }
|
||||
context.commit("update_coaListKas", resp.data)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getCoaReg(context) {
|
||||
context.commit("update_loadingAutocomplete", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.search = context.state.searchCoaReg;
|
||||
prm.company = context.state.user.M_BranchCompanyID
|
||||
prm.regional = context.state.user.S_RegionalID
|
||||
|
||||
prm.token = one_token()
|
||||
let resp = await api.searchCoa(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(resp);
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
// let cek = 0;
|
||||
// if (parseInt(resp.data) > 0) {
|
||||
// cek = true
|
||||
// }
|
||||
context.commit("update_coaListReg", resp.data)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async getCoaDetail(context) {
|
||||
context.commit("update_loadingAutocomplete", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.search = context.state.searchCoaDetail;
|
||||
prm.company = context.state.user.M_BranchCompanyID
|
||||
prm.regional = context.state.user.S_RegionalID
|
||||
prm.branch = context.state.selectedBranchDetail.branchID
|
||||
prm.token = one_token()
|
||||
let resp = await api.searchCoaDetail(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(resp);
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
// let cek = 0;
|
||||
// if (parseInt(resp.data) > 0) {
|
||||
// cek = true
|
||||
// }
|
||||
context.commit("update_coaListDetail", resp.data)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async searchKredit(context) {
|
||||
context.commit("update_loadingAutocomplete", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.search = context.state.searchKredit;
|
||||
prm.token = one_token()
|
||||
let resp = await api.searchkredit(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(resp);
|
||||
} else {
|
||||
console.log(resp);
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
// let cek = 0;
|
||||
// if (parseInt(resp.data) > 0) {
|
||||
// cek = true
|
||||
// }
|
||||
context.commit("update_kreditList", resp.data)
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async search(context) {
|
||||
context.commit("update_loading", true)
|
||||
try {
|
||||
let prm = {}
|
||||
prm.search = context.state.searchTemplate
|
||||
prm.page = context.state.page
|
||||
prm.token = one_token()
|
||||
let resp = await api.search(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading", false)
|
||||
} else {
|
||||
context.commit("update_loading", false)
|
||||
context.commit("update_templateList", resp.data.records)
|
||||
context.commit("update_total", resp.data.total)
|
||||
console.log(resp.data);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
async insertTemplate(context, prm) {
|
||||
context.commit("update_loadingSave", true)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.insertTemplate(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingSave", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
console.log(resp)
|
||||
} else {
|
||||
context.dispatch("search");
|
||||
context.commit("update_dialogForm", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'success',
|
||||
msg: 'Berhasil tambah data'
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
|
||||
context.commit("update_loadingSave", false)
|
||||
|
||||
console.log(resp.data);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingSave", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: 'Error add data'
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
console.log('error add data')
|
||||
}
|
||||
},
|
||||
async updateTemplate(context, prm) {
|
||||
context.commit("update_loadingSave", true)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.updateTemplate(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingSave", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
console.log(resp)
|
||||
} else {
|
||||
context.dispatch("search");
|
||||
context.commit("update_dialogForm", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'success',
|
||||
msg: 'Berhasil edit data'
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
|
||||
context.commit("update_loadingSave", false)
|
||||
|
||||
console.log(resp.data);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingSave", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: 'Error edit data'
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
console.log('error edit data')
|
||||
}
|
||||
},
|
||||
async deleteTemplate(context, prm) {
|
||||
context.commit("update_loadingSave", true)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.deleteTemplate(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingSave", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
console.log(resp)
|
||||
} else {
|
||||
context.dispatch("search");
|
||||
context.commit("update_dialogAlert", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'success',
|
||||
msg: 'Berhasil delete data'
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
|
||||
context.commit("update_loadingSave", false)
|
||||
|
||||
console.log(resp.data);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingSave", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: 'Error edit data'
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
console.log('error delete data')
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
}
|
||||
446
test/vuex/acc-one-jurnal/modules/jurnalumum.js
Normal file
446
test/vuex/acc-one-jurnal/modules/jurnalumum.js
Normal file
@@ -0,0 +1,446 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
|
||||
import * as api from "../api/jurnalumum.js";
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
// state listing
|
||||
search_status: 0,
|
||||
current_page: 1,
|
||||
x_search: "",
|
||||
search_error_message: "",
|
||||
last_id: -1,
|
||||
jurnalumums: [],
|
||||
total_jurnalumum: 0,
|
||||
selected_jurnalumum: {},
|
||||
start_date: moment(new Date().getFullYear() + '-01-01').format('YYYY-MM-DD'),
|
||||
end_date: moment(new Date()).format('YYYY-MM-DD'),
|
||||
open_dialog_info: false,
|
||||
msg_info: "",
|
||||
drop_tipe_jurnal: [],
|
||||
x_drop_tipe_jurnal: {},
|
||||
dialogjurnaltype: false,
|
||||
open_print: false,
|
||||
|
||||
// state jurnal umum
|
||||
user: one_user(),
|
||||
dialog_is_active: false,
|
||||
loading_jurnaltype: false,
|
||||
jurnaltypes: [],
|
||||
selected_jurnaltype: {},
|
||||
selected_jurnaltype_u: {},
|
||||
xdate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
periodes: [],
|
||||
selected_periode: {},
|
||||
autocomplete_status: 0,
|
||||
dialogdetail: false,
|
||||
coalist: [],
|
||||
selected_coa: {},
|
||||
errors: [],
|
||||
errors_save_jurnal: [],
|
||||
xsummary: { "debit": 0, "credit": 0, "balance": 0 },
|
||||
open_dialog_detail_info: false,
|
||||
msg_detail_info: "",
|
||||
save_status: 0,
|
||||
save_error_message: "",
|
||||
alert_error: false,
|
||||
alert_success: false,
|
||||
msg_success: "",
|
||||
act: "",
|
||||
title: "",
|
||||
deskripsi: "",
|
||||
jurnaldetails: [],
|
||||
selected_jurnaldetail: {},
|
||||
periodeStartDate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
periodeEndDate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
is_posted: ""
|
||||
},
|
||||
mutations: {
|
||||
update_search_status(state, val) {
|
||||
state.search_status = val
|
||||
},
|
||||
update_current_page(state, val) {
|
||||
state.current_page = val
|
||||
},
|
||||
update_x_search(state, val) {
|
||||
state.x_search = val
|
||||
state.current_page = 1
|
||||
},
|
||||
update_search_error_message(state, val) {
|
||||
state.search_error_message = val
|
||||
},
|
||||
update_last_id(state, val) {
|
||||
state.last_id = val
|
||||
},
|
||||
update_jurnalumums(state, val) {
|
||||
state.jurnalumums = val
|
||||
},
|
||||
update_total_jurnalumum(state, val) {
|
||||
state.total_jurnalumum = val
|
||||
},
|
||||
update_selected_jurnalumum(state, val) {
|
||||
state.selected_jurnalumum = val
|
||||
},
|
||||
update_start_date(state, val) {
|
||||
state.start_date = val
|
||||
},
|
||||
update_end_date(state, val) {
|
||||
state.end_date = val
|
||||
},
|
||||
update_open_dialog_info(state, val) {
|
||||
state.open_dialog_info = val
|
||||
},
|
||||
update_msg_info(state, val) {
|
||||
state.msg_info = val
|
||||
},
|
||||
update_drop_tipe_jurnal(state, val) {
|
||||
state.drop_tipe_jurnal = val
|
||||
},
|
||||
update_x_drop_tipe_jurnal(state, val) {
|
||||
state.x_drop_tipe_jurnal = val
|
||||
},
|
||||
update_open_print(state, value) {
|
||||
state.open_print = value
|
||||
},
|
||||
|
||||
// state jurnal umum
|
||||
update_user(state, val) {
|
||||
state.user = val
|
||||
},
|
||||
update_dialog_is_active(state, val) {
|
||||
state.dialog_is_active = val
|
||||
},
|
||||
update_loading_jurnaltype(state, val) {
|
||||
state.loading_jurnaltype = val
|
||||
},
|
||||
update_jurnaltypes(state, val) {
|
||||
state.jurnaltypes = val
|
||||
},
|
||||
update_selected_jurnaltype(state, val) {
|
||||
state.selected_jurnaltype = val
|
||||
},
|
||||
update_selected_jurnaltype_u(state, val) {
|
||||
state.selected_jurnaltype_u = val
|
||||
},
|
||||
update_xdate(state, val) {
|
||||
state.xdate = val
|
||||
},
|
||||
update_periodes(state, val) {
|
||||
state.periodes = val
|
||||
},
|
||||
update_selected_periode(state, val) {
|
||||
state.selected_periode = val
|
||||
},
|
||||
update_autocomplete_status(state, val) {
|
||||
state.update_autocomplete_status = val
|
||||
},
|
||||
update_dialogdetail(state, val) {
|
||||
state.dialogdetail = val
|
||||
},
|
||||
update_coalist(state, val) {
|
||||
state.coalist = val
|
||||
},
|
||||
update_selected_coa(state, val) {
|
||||
state.selected_coa = val
|
||||
},
|
||||
update_errors(state, val) {
|
||||
state.errors = val
|
||||
},
|
||||
update_errors_save_jurnal(state, val) {
|
||||
state.errors_save_jurnal = val
|
||||
},
|
||||
update_xsummary(state, val) {
|
||||
state.xsummary = val
|
||||
},
|
||||
update_open_dialog_detail_info(state, val) {
|
||||
state.open_dialog_detail_info = val
|
||||
},
|
||||
update_msg_detail_info(state, val) {
|
||||
state.msg_detail_info = val
|
||||
},
|
||||
update_msg_detail_info(state, val) {
|
||||
state.msg_detail_info = val
|
||||
},
|
||||
update_save_status(state, val) {
|
||||
state.save_status = val
|
||||
},
|
||||
update_save_error_message(state, val) {
|
||||
state.save_error_message = val
|
||||
},
|
||||
update_alert_error(state, val) {
|
||||
state.alert_error = val
|
||||
},
|
||||
update_alert_success(state, val) {
|
||||
state.alert_success = val
|
||||
},
|
||||
update_msg_success(state, val) {
|
||||
state.msg_success = val
|
||||
},
|
||||
update_act(state, val) {
|
||||
state.act = val
|
||||
},
|
||||
update_title(state, val) {
|
||||
state.title = val
|
||||
},
|
||||
update_deskripsi(state, val) {
|
||||
state.deskripsi = val
|
||||
},
|
||||
update_jurnaldetails(state, val) {
|
||||
state.jurnaldetails = val
|
||||
},
|
||||
update_selected_jurnaldetail(state, val) {
|
||||
state.selected_jurnaldetail = val
|
||||
},
|
||||
update_periodeStartDate(state, val) {
|
||||
state.periodeStartDate = val
|
||||
},
|
||||
update_periodeEndDate(state, val) {
|
||||
state.periodeEndDate = val
|
||||
},
|
||||
update_is_posted(state, val) {
|
||||
state.is_posted = val
|
||||
},
|
||||
update_dialogjurnaltype(state, val) {
|
||||
state.dialogjurnaltype = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async search(context, prm) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.search(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
context.commit("update_msg_info", resp.message)
|
||||
context.commit("update_open_dialog_info", true)
|
||||
} else {
|
||||
context.commit("update_search_status", 2)
|
||||
context.commit("update_search_error_message", "")
|
||||
context.commit("update_msg_info", resp.message)
|
||||
let data = {
|
||||
records: resp.data.records,
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
context.commit("update_jurnalumums", data.records)
|
||||
context.commit("update_total_jurnalumum", data.total)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_search_status", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
context.commit("update_msg_info", e.message)
|
||||
context.commit("update_open_dialog_info", true)
|
||||
}
|
||||
},
|
||||
|
||||
async openjurnaltype(context) {
|
||||
context.commit("update_loading_jurnaltype", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.token = one_token()
|
||||
let resp = await api.getjurnaltype(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading_jurnaltype", false)
|
||||
} else {
|
||||
context.commit("update_loading_jurnaltype", false)
|
||||
context.commit("update_drop_tipe_jurnal", resp.data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading_jurnaltype", false)
|
||||
}
|
||||
},
|
||||
|
||||
// jurnal umum
|
||||
async getjurnaltype(context) {
|
||||
context.commit("update_loading_jurnaltype", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.token = one_token()
|
||||
let resp = await api.getjurnaltype(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loading_jurnaltype", false)
|
||||
} else {
|
||||
context.commit("update_loading_jurnaltype", false)
|
||||
context.commit("update_jurnaltypes", resp.data.records)
|
||||
context.commit("update_selected_jurnaltype", resp.data.defaultju)
|
||||
context.commit("update_selected_jurnaltype_u", resp.data.defaultju)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loading_jurnaltype", false)
|
||||
}
|
||||
},
|
||||
|
||||
async getperiode(context, prm) {
|
||||
context.commit("update_autocomplete_status", 1)
|
||||
try {
|
||||
let resp = await api.getperiode(one_token(), prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_autocomplete_status", 2)
|
||||
context.commit("update_search_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records
|
||||
}
|
||||
|
||||
context.commit("update_periodes", data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
}
|
||||
},
|
||||
|
||||
async searchcoa(context, prm) {
|
||||
context.commit("update_autocomplete_status", 1)
|
||||
try {
|
||||
let resp = await api.searchcoa(one_token(), prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
context.commit("update_search_error_message", resp.message)
|
||||
} else {
|
||||
context.commit("update_autocomplete_status", 2)
|
||||
context.commit("update_search_error_message", "")
|
||||
let data = {
|
||||
records: resp.data.records
|
||||
}
|
||||
|
||||
context.commit("update_coalist", data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_autocomplete_status", 3)
|
||||
context.commit("update_search_error_message", e.message)
|
||||
}
|
||||
},
|
||||
|
||||
async savejurnalumum(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.savejurnalumum(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
context.commit("update_alert_error", true)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
let data = {
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
if (data.total !== -1) {
|
||||
context.commit("update_alert_success", true)
|
||||
var msg = " Journal " + prm.title + " berhasil di ditambahkan"
|
||||
context.commit("update_msg_success", msg)
|
||||
context.dispatch("search", {
|
||||
regionalid: context.state.user.S_RegionalID,
|
||||
branchid: context.state.user.M_BranchID,
|
||||
current_page: context.state.current_page,
|
||||
search: context.state.x_search,
|
||||
startdate: context.state.start_date,
|
||||
enddate: context.state.end_date,
|
||||
last_id: -1
|
||||
})
|
||||
} else {
|
||||
context.commit("update_errors_save_jurnal", [])
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
context.commit("update_alert_error", true)
|
||||
}
|
||||
},
|
||||
|
||||
async editjurnalumum(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.editjurnalumum(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
context.commit("update_alert_error", true)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
let data = {
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
if (data.total !== -1) {
|
||||
context.commit("update_alert_success", true)
|
||||
var msg = " Journal " + prm.title + " berhasil di diupdate"
|
||||
context.commit("update_msg_success", msg)
|
||||
context.dispatch("search", {
|
||||
regionalid: context.state.user.S_RegionalID,
|
||||
branchid: context.state.user.M_BranchID,
|
||||
current_page: context.state.current_page,
|
||||
search: context.state.x_search,
|
||||
startdate: context.state.start_date,
|
||||
enddate: context.state.end_date,
|
||||
last_id: -1
|
||||
})
|
||||
} else {
|
||||
context.commit("update_errors_save_jurnal", [])
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
context.commit("update_alert_error", true)
|
||||
}
|
||||
},
|
||||
|
||||
async deletejurnalumum(context, prm) {
|
||||
context.commit("update_save_status", 1)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.deletejurnalumum(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
context.commit("update_alert_error", true)
|
||||
} else {
|
||||
context.commit("update_save_status", 2)
|
||||
context.commit("update_save_error_message", resp.message)
|
||||
let data = {
|
||||
total: resp.data.total
|
||||
}
|
||||
|
||||
if (data.total !== -1) {
|
||||
context.commit("update_alert_success", true)
|
||||
var msg = " Journal " + prm.title + " berhasil dihapus"
|
||||
context.commit("update_msg_success", msg)
|
||||
context.dispatch("search", {
|
||||
regionalid: context.state.user.S_RegionalID,
|
||||
branchid: context.state.user.M_BranchID,
|
||||
current_page: context.state.current_page,
|
||||
search: context.state.x_search,
|
||||
startdate: context.state.start_date,
|
||||
enddate: context.state.end_date,
|
||||
last_id: -1
|
||||
})
|
||||
} else {
|
||||
context.commit("update_errors_save_jurnal", [])
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_save_status", 3)
|
||||
context.commit("update_save_error_message", e.message)
|
||||
context.commit("update_alert_error", true)
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
404
test/vuex/acc-one-jurnal/modules/pengeluaranbarang.js
Normal file
404
test/vuex/acc-one-jurnal/modules/pengeluaranbarang.js
Normal file
@@ -0,0 +1,404 @@
|
||||
import * as api from "../api/pengeluaranbarang.js";
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
search_status: 0,
|
||||
insert_status: 0,
|
||||
insert_error: '',
|
||||
current_page: 1,
|
||||
|
||||
user: one_user(),
|
||||
keluar_barang_dialog: false,
|
||||
selected_jurnal_type: {},
|
||||
periode_start_date: moment(new Date()).format('YYYY-MM-DD'),
|
||||
periode_end_date: moment(new Date()).format('YYYY-MM-DD'),
|
||||
|
||||
input_company: one_user().M_BranchCompanyName,
|
||||
input_regional: one_user().S_RegionalName,
|
||||
input_cabang: one_user().M_BranchName,
|
||||
input_date: moment(new Date()).format('YYYY-MM-DD'),
|
||||
input_title: "",
|
||||
input_description: "",
|
||||
list_periode: [],
|
||||
selected_periode: {},
|
||||
|
||||
|
||||
detail_dialog: false,
|
||||
table_detail: [],
|
||||
list_coa: [],
|
||||
selected_coa: {},
|
||||
input_detail_debet: 0,
|
||||
input_detail_kredit: 0,
|
||||
summary_detail: {
|
||||
total_debet: 0,
|
||||
total_kredit: 0,
|
||||
total_balance: 0
|
||||
},
|
||||
|
||||
opp_type: "add",
|
||||
crud_jurnal_status: 0,
|
||||
crud_jurnal: {
|
||||
state: false,
|
||||
msg: "",
|
||||
color: "error"
|
||||
},
|
||||
|
||||
current_jurnal: {}
|
||||
},
|
||||
mutations: {
|
||||
update_search_status(state, val) {
|
||||
state.search_status = val
|
||||
},
|
||||
update_insert_status(state, val) {
|
||||
state.insert_status = val
|
||||
},
|
||||
update_insert_error(state, val) {
|
||||
state.insert_error = val
|
||||
},
|
||||
update_current_page(state, val) {
|
||||
state.current_page = val
|
||||
},
|
||||
update_user(state, val) {
|
||||
state.user = val
|
||||
},
|
||||
update_pengeluaran_barang_dialog(state, val) {
|
||||
state.keluar_barang_dialog = val
|
||||
},
|
||||
update_selected_jurnal_type(state, val) {
|
||||
state.selected_jurnal_type = val
|
||||
},
|
||||
update_periode_start_date(state, val) {
|
||||
state.periode_start_date = val
|
||||
},
|
||||
update_periode_end_date(state, val) {
|
||||
state.periode_end_date = val
|
||||
},
|
||||
update_input_company(state, val) {
|
||||
state.input_company = val
|
||||
},
|
||||
update_input_regional(state, val) {
|
||||
state.input_regional = val
|
||||
},
|
||||
update_input_cabang(state, val) {
|
||||
state.input_cabang = val
|
||||
},
|
||||
update_input_date(state, val) {
|
||||
state.input_date = val
|
||||
},
|
||||
update_input_title(state, val) {
|
||||
state.input_title = val
|
||||
},
|
||||
update_input_description(state, val) {
|
||||
state.input_description = val
|
||||
},
|
||||
update_list_periode(state, val) {
|
||||
state.list_periode = val
|
||||
},
|
||||
update_selected_periode(state, val) {
|
||||
state.selected_periode = val
|
||||
},
|
||||
update_list_coa(state, val) {
|
||||
state.list_coa = val
|
||||
},
|
||||
update_selected_coa(state, val) {
|
||||
state.selected_coa = val
|
||||
},
|
||||
update_detail_dialog(state, val) {
|
||||
state.detail_dialog = val
|
||||
},
|
||||
update_table_detail(state, val) {
|
||||
state.table_detail = val
|
||||
},
|
||||
update_summary_detail(state, val) {
|
||||
state.summary_detail = val
|
||||
},
|
||||
update_input_detail_debet(state, val) {
|
||||
state.input_detail_debet = val
|
||||
},
|
||||
update_input_detail_kredit(state, val) {
|
||||
state.input_detail_kredit = val
|
||||
},
|
||||
update_crud_jurnal_status(state, val) {
|
||||
state.crud_jurnal_status = val
|
||||
},
|
||||
update_crud_jurnal(state, val) {
|
||||
state.crud_jurnal = val
|
||||
},
|
||||
update_opp_type(state, val) {
|
||||
state.opp_type = val
|
||||
},
|
||||
update_current_jurnal(state, val) {
|
||||
state.current_jurnal = val
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async getperiode(context, params) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
params.token = one_token()
|
||||
let resp = await api.get_periode(params)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_status", 3)
|
||||
} else {
|
||||
context.commit("update_list_periode", resp.data.records)
|
||||
context.commit("update_search_status", 2)
|
||||
}
|
||||
} catch (error) {
|
||||
context.commit("update_search_status", 3)
|
||||
}
|
||||
},
|
||||
async getcoa(context, params) {
|
||||
context.commit("update_search_status", 1)
|
||||
try {
|
||||
params.token = one_token()
|
||||
let resp = await api.get_coa(params)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_search_status", 3)
|
||||
} else {
|
||||
context.commit("update_list_coa", resp.data.records)
|
||||
context.commit("update_search_status", 2)
|
||||
}
|
||||
} catch (error) {
|
||||
context.commit("update_search_status", 3)
|
||||
}
|
||||
},
|
||||
async add_detail_table(context, params) {
|
||||
context.commit("update_insert_status", 1)
|
||||
try {
|
||||
let curr_detail = context.state.table_detail
|
||||
curr_detail.push(params)
|
||||
|
||||
let k = 0
|
||||
let d = 0
|
||||
curr_detail.forEach(item => {
|
||||
d += parseFloat(Number(item.debet).toFixed(2))
|
||||
k += parseFloat(Number(item.kredit).toFixed(2))
|
||||
});
|
||||
|
||||
let summary = {
|
||||
total_kredit: k,
|
||||
total_debet: d,
|
||||
total_balance: (d - k)
|
||||
}
|
||||
|
||||
|
||||
context.commit("update_table_detail", curr_detail)
|
||||
context.commit("update_summary_detail", summary)
|
||||
context.commit("update_insert_status", 2)
|
||||
} catch (error) {
|
||||
context.commit("update_insert_error", "error insert detail jurnal")
|
||||
context.commit("update_insert_status", 3)
|
||||
}
|
||||
},
|
||||
async del_detail_table(context, params) {
|
||||
context.commit("update_insert_status", 1)
|
||||
try {
|
||||
let curr_detail = context.state.table_detail
|
||||
if (params > -1) {
|
||||
curr_detail.splice(params, 1)
|
||||
}
|
||||
|
||||
let k = 0
|
||||
let d = 0
|
||||
if (Object.keys(curr_detail).length > 0) {
|
||||
curr_detail.forEach(item => {
|
||||
d += parseFloat(Number(item.debet).toFixed(2))
|
||||
k += parseFloat(Number(item.kredit).toFixed(2))
|
||||
})
|
||||
}
|
||||
|
||||
let summary = {
|
||||
total_kredit: k,
|
||||
total_debet: d,
|
||||
total_balance: (d - k)
|
||||
}
|
||||
|
||||
context.commit("update_table_detail", curr_detail)
|
||||
context.commit("update_summary_detail", summary)
|
||||
context.commit("update_insert_status", 2)
|
||||
} catch (error) {
|
||||
context.commit("update_insert_error", "error delete detail jurnal")
|
||||
context.commit("update_insert_status", 3)
|
||||
}
|
||||
},
|
||||
async simpan_jurnal(context, params) {
|
||||
context.commit("update_crud_jurnal_status", 1)
|
||||
try {
|
||||
params.token = one_token()
|
||||
let resp = await api.simpanjurnal(params)
|
||||
if (resp.status != "OK") {
|
||||
let a = {
|
||||
state: true,
|
||||
msg: resp.message,
|
||||
color: "error"
|
||||
}
|
||||
context.commit("update_crud_jurnal", a)
|
||||
context.commit("update_crud_jurnal_status", 3)
|
||||
} else {
|
||||
let a = {
|
||||
state: true,
|
||||
msg: "Sukses",
|
||||
color: "success"
|
||||
}
|
||||
context.commit("update_crud_jurnal", a)
|
||||
context.commit("update_crud_jurnal_status", 2)
|
||||
context.commit("update_pengeluaran_barang_dialog", false)
|
||||
|
||||
context.dispatch('jurnalumum/search', {
|
||||
current_page: context.rootState.jurnalumum.current_page,
|
||||
search: context.rootState.jurnalumum.x_search,
|
||||
startdate: context.rootState.jurnalumum.start_date,
|
||||
enddate: context.rootState.jurnalumum.end_date,
|
||||
regionalid: context.rootState.jurnalumum.user.S_RegionalID,
|
||||
branchid: context.rootState.jurnalumum.user.M_BranchID,
|
||||
last_id: -1
|
||||
}, { root: true })
|
||||
}
|
||||
} catch (error) {
|
||||
let a = {
|
||||
state: true,
|
||||
msg: error.message,
|
||||
color: "error"
|
||||
}
|
||||
context.commit("update_crud_jurnal", a)
|
||||
context.commit("update_crud_jurnal_status", 3)
|
||||
}
|
||||
},
|
||||
async load_jurnal(context, params) {
|
||||
try {
|
||||
params.token = one_token()
|
||||
let resp = await api.getdetailjurnal(params)
|
||||
if (resp.status != "OK") {
|
||||
|
||||
} else {
|
||||
let sel_jurnal = {
|
||||
JurnalTypeID: resp.data.jurnal.JurnalTypeID,
|
||||
JurnalTypeCode: resp.data.jurnal.JurnalTypeCode,
|
||||
JurnalTypeName: resp.data.jurnal.JurnalTypeName,
|
||||
JurnalTypeAccesRight: resp.data.jurnal.JurnalTypeAccesRight,
|
||||
JurnalTypeIsActive: resp.data.jurnal.JurnalTypeIsActive
|
||||
}
|
||||
context.commit("update_selected_jurnal_type", sel_jurnal)
|
||||
|
||||
let sel_periode = resp.data.periode
|
||||
context.commit("update_selected_periode", sel_periode)
|
||||
|
||||
let in_title = resp.data.jurnal.jurnalTitle
|
||||
context.commit("update_input_title", in_title)
|
||||
let in_desc = resp.data.jurnal.jurnalDescription
|
||||
context.commit("update_input_description", in_desc)
|
||||
let in_date = resp.data.jurnal.jurnalDate
|
||||
context.commit("update_input_date", in_date)
|
||||
|
||||
let j_detail = resp.data.jurnaldetail
|
||||
context.commit("update_table_detail", j_detail)
|
||||
|
||||
let k = 0
|
||||
let d = 0
|
||||
j_detail.forEach(item => {
|
||||
d += parseFloat(Number(item.debet).toFixed(2))
|
||||
k += parseFloat(Number(item.kredit).toFixed(2))
|
||||
})
|
||||
|
||||
let summary = {
|
||||
total_kredit: k,
|
||||
total_debet: d,
|
||||
total_balance: (d - k)
|
||||
}
|
||||
context.commit("update_summary_detail", summary)
|
||||
context.commit("update_current_jurnal", resp.data.jurnal)
|
||||
}
|
||||
} catch (error) {
|
||||
let a = {
|
||||
state: true,
|
||||
msg: error.message,
|
||||
color: "error"
|
||||
}
|
||||
context.commit("update_crud_jurnal", a)
|
||||
context.commit("update_crud_jurnal_status", 3)
|
||||
}
|
||||
},
|
||||
async edit_jurnal(context, params) {
|
||||
try {
|
||||
context.commit("update_opp_type", "edit")
|
||||
context.dispatch("load_jurnal", params)
|
||||
context.commit("update_pengeluaran_barang_dialog", true)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
},
|
||||
async simpan_edit_jurnal(context, params) {
|
||||
context.commit("update_crud_jurnal_status", 1)
|
||||
try {
|
||||
params.token = one_token()
|
||||
let resp = await api.editdetailjurnal(params)
|
||||
if (resp.status != "OK") {
|
||||
let a = {
|
||||
state: true,
|
||||
msg: resp.message,
|
||||
color: "error"
|
||||
}
|
||||
context.commit("update_crud_jurnal", a)
|
||||
context.commit("update_crud_jurnal_status", 3)
|
||||
} else {
|
||||
let a = {
|
||||
state: true,
|
||||
msg: "Sukses",
|
||||
color: "success"
|
||||
}
|
||||
context.commit("update_crud_jurnal", a)
|
||||
context.commit("update_crud_jurnal_status", 2)
|
||||
context.commit("update_pengeluaran_barang_dialog", false)
|
||||
|
||||
context.dispatch('jurnalumum/search', {
|
||||
current_page: context.rootState.jurnalumum.current_page,
|
||||
search: context.rootState.jurnalumum.x_search,
|
||||
startdate: context.rootState.jurnalumum.start_date,
|
||||
enddate: context.rootState.jurnalumum.end_date,
|
||||
regionalid: context.rootState.jurnalumum.user.S_RegionalID,
|
||||
branchid: context.rootState.jurnalumum.user.M_BranchID,
|
||||
last_id: -1
|
||||
}, { root: true })
|
||||
}
|
||||
} catch (error) {
|
||||
let a = {
|
||||
state: true,
|
||||
msg: error.message,
|
||||
color: "error"
|
||||
}
|
||||
context.commit("update_crud_jurnal", a)
|
||||
context.commit("update_crud_jurnal_status", 3)
|
||||
}
|
||||
},
|
||||
async add_jurnal(context) {
|
||||
try {
|
||||
context.commit("update_opp_type", "add")
|
||||
|
||||
context.commit("update_input_company", context.state.user.M_BranchCompanyName)
|
||||
context.commit("update_input_regional", context.state.user.S_RegionalName)
|
||||
context.commit("update_input_cabang", context.state.user.M_BranchName)
|
||||
context.commit("update_selected_jurnal_type", context.rootState.jurnalumum.x_drop_tipe_jurnal)
|
||||
|
||||
context.commit("update_selected_periode", {})
|
||||
context.commit("update_input_date", moment(new Date()).format('YYYY-MM-DD'))
|
||||
context.commit("update_input_title", "")
|
||||
context.commit("update_input_description", "")
|
||||
|
||||
context.commit("update_table_detail", [])
|
||||
context.commit("update_selected_coa", {})
|
||||
context.commit("update_input_detail_debet", 0)
|
||||
context.commit("update_input_detail_kredit", 0)
|
||||
let summary = {
|
||||
total_kredit: 0,
|
||||
total_debet: 0,
|
||||
total_balance: 0
|
||||
}
|
||||
context.commit("update_summary_detail", summary)
|
||||
context.commit("update_pengeluaran_barang_dialog", true)
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
382
test/vuex/acc-one-jurnal/modules/terimaBarang.js
Normal file
382
test/vuex/acc-one-jurnal/modules/terimaBarang.js
Normal file
@@ -0,0 +1,382 @@
|
||||
// 1 => LOADING
|
||||
// 2 => DONE
|
||||
// 3 => ERROR
|
||||
import * as api from "../api/terimaBarang.js"
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
user: one_user(),
|
||||
dialogJurnalTerimaBarang: false,
|
||||
selectedJurnalType: {},
|
||||
jurnalTypeList: [],
|
||||
defaultJurnalType: {},
|
||||
selectedDate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
searchPeriode: '',
|
||||
selectedPeriode: {},
|
||||
periodeList: [],
|
||||
loadingAutocomplete: false,
|
||||
searchSupplier: '',
|
||||
supplierList: [],
|
||||
selectedSupplier: {},
|
||||
jurnalTitle: '',
|
||||
grniValue: '',
|
||||
invoiceValue: '',
|
||||
jurnalDescription: '',
|
||||
searchCoa: '',
|
||||
selectedCoa: {},
|
||||
coaList: [],
|
||||
kreditValue: 0,
|
||||
debitValue: 0,
|
||||
errorsAddDetail: [],
|
||||
errorsAddJurnal: [],
|
||||
detailsJurnalTerimaBarang: [],
|
||||
detailSum: { debit: 0, credit: 0, balance: 0 },
|
||||
loadingSave: false,
|
||||
dialogForm: false,
|
||||
snackbar: {
|
||||
state: false,
|
||||
color: 'success',
|
||||
msg: ''
|
||||
},
|
||||
act: "",
|
||||
// Untuk Edit Dialog
|
||||
companyInfo: {},
|
||||
isPosted: false,
|
||||
selectedJurnal: {},
|
||||
|
||||
last_id: -1,
|
||||
loading: false,
|
||||
startDate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
endDate: moment(new Date()).format('YYYY-MM-DD'),
|
||||
loading: false,
|
||||
sallary: 0,
|
||||
description: '',
|
||||
branchPercentList: [],
|
||||
selectedBranchPercent: {},
|
||||
},
|
||||
mutations: {
|
||||
update_dialogJurnalTerimaBarang(state, val) {
|
||||
state.dialogJurnalTerimaBarang = val
|
||||
},
|
||||
update_selectedJurnalType(state, val) {
|
||||
state.selectedJurnalType = val
|
||||
},
|
||||
update_jurnalTypeList(state, val) {
|
||||
state.jurnalTypeList = val
|
||||
},
|
||||
update_defaultJurnalType(state, val) {
|
||||
state.defaultJurnalType = val
|
||||
},
|
||||
update_selectedDate(state, val) {
|
||||
state.selectedDate = val
|
||||
},
|
||||
update_searchPeriode(state, val) {
|
||||
state.searchPeriode = val
|
||||
},
|
||||
update_selectedPeriode(state, val) {
|
||||
state.selectedPeriode = val
|
||||
},
|
||||
update_periodeList(state, val) {
|
||||
state.periodeList = val
|
||||
},
|
||||
update_loadingAutocomplete(state, val) {
|
||||
state.loadingAutocomplete = val
|
||||
},
|
||||
update_searchSupplier(state, val) {
|
||||
state.searchSupplier = val
|
||||
},
|
||||
update_selectedSupplier(state, val) {
|
||||
state.selectedSupplier = val
|
||||
},
|
||||
update_supplierList(state, val) {
|
||||
state.supplierList = val
|
||||
},
|
||||
update_jurnalTitle(state, val) {
|
||||
state.jurnalTitle = val
|
||||
},
|
||||
update_grniValue(state, val) {
|
||||
state.grniValue = val
|
||||
},
|
||||
update_invoiceValue(state, val) {
|
||||
state.invoiceValue = val
|
||||
},
|
||||
update_debitValue(state, val) {
|
||||
state.debitValue = val
|
||||
},
|
||||
update_jurnalDescription(state, val) {
|
||||
state.jurnalDescription = val
|
||||
},
|
||||
update_kreditValue(state, val) {
|
||||
state.kreditValue = val
|
||||
},
|
||||
update_coaList(state, val) {
|
||||
state.coaList = val
|
||||
},
|
||||
update_searchCoa(state, val) {
|
||||
state.searchCoa = val
|
||||
},
|
||||
update_selectedCoa(state, val) {
|
||||
state.selectedCoa = val
|
||||
},
|
||||
update_errorsAddDetail(state, val) {
|
||||
state.errorsAddDetail = val
|
||||
},
|
||||
update_errorsAddJurnal(state, val) {
|
||||
state.errorsAddJurnal = val
|
||||
},
|
||||
update_detailsJurnalTerimaBarang(state, val) {
|
||||
state.detailsJurnalTerimaBarang = val
|
||||
},
|
||||
update_detailSum(state, val) {
|
||||
state.detailSum = val
|
||||
},
|
||||
update_loadingSave(state, val) {
|
||||
state.loadingSave = val
|
||||
},
|
||||
update_snackbar(state, val) {
|
||||
state.snackbar = val
|
||||
},
|
||||
update_actForm(state, val) {
|
||||
state.act = val
|
||||
},
|
||||
update_companyInfo(state, val) {
|
||||
state.companyInfo = val
|
||||
},
|
||||
update_isPosted(state, val) {
|
||||
state.isPosted = val
|
||||
},
|
||||
update_selectedJurnal(state, val) {
|
||||
state.selectedJurnal = val
|
||||
},
|
||||
|
||||
|
||||
/* NOT USED YET */
|
||||
update_defaultBranch(state, val) {
|
||||
state.defaultBranch = val
|
||||
},
|
||||
update_branchPercentList(state, val) {
|
||||
state.branchPercentList = val
|
||||
},
|
||||
update_selectedBranchPercent(state, val) {
|
||||
state.selectedBranchPercent = val
|
||||
},
|
||||
update_loading(state, val) {
|
||||
state.loading = val
|
||||
},
|
||||
update_dialogForm(state, val) {
|
||||
state.dialogForm = val
|
||||
},
|
||||
update_startDate(state, val) {
|
||||
state.startDate = val
|
||||
},
|
||||
update_endDate(state, val) {
|
||||
state.endDate = val
|
||||
},
|
||||
update_sallary(state, val) {
|
||||
state.sallary = val
|
||||
},
|
||||
|
||||
},
|
||||
actions: {
|
||||
async getJurnalType(context) {
|
||||
context.commit("update_loadingAutocomplete", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.token = one_token()
|
||||
let resp = await api.getJurnalType(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
} else {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
context.commit("update_jurnalTypeList", resp.data.records)
|
||||
context.commit("update_selectedJurnalType", resp.data.default)
|
||||
context.commit("update_defaultJurnalType", resp.data.default)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
|
||||
async getPeriode(context) {
|
||||
context.commit("update_loadingAutocomplete", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.search = context.state.searchPeriode;
|
||||
prm.token = one_token()
|
||||
let resp = await api.searchPeriode(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
} else {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
context.commit("update_periodeList", resp.data)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
|
||||
async getSupplier(context) {
|
||||
context.commit("update_loadingAutocomplete", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.search = context.state.searchSupplier;
|
||||
prm.token = one_token()
|
||||
let resp = await api.searchSupplier(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
} else {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
context.commit("update_supplierList", resp.data)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
|
||||
async getCoa(context) {
|
||||
context.commit("update_loadingAutocomplete", true)
|
||||
try {
|
||||
let prm = {};
|
||||
prm.search = context.state.searchCoa;
|
||||
prm.token = one_token()
|
||||
let resp = await api.searchCoa(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
} else {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
context.commit("update_coaList", resp.data.records)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingAutocomplete", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
|
||||
async saveJurnal(context, prm) {
|
||||
context.commit("update_loadingSave", true)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.saveJurnal(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingSave", false)
|
||||
context.commit("jurnalumum/update_save_error_message", resp.message, { root: true })
|
||||
context.commit("jurnalumum/update_alert_error", true, { root: true })
|
||||
console.log(resp);
|
||||
} else {
|
||||
context.commit("jurnalumum/update_alert_success", true, { root: true })
|
||||
var msg = " Journal " + prm.jurnalTitle + " berhasil disimpan"
|
||||
context.commit("jurnalumum/update_msg_success", msg, { root: true })
|
||||
|
||||
context.dispatch('jurnalumum/search', {
|
||||
current_page: context.rootState.jurnalumum.current_page,
|
||||
search: context.rootState.jurnalumum.x_search,
|
||||
startdate: context.rootState.jurnalumum.start_date,
|
||||
enddate: context.rootState.jurnalumum.end_date,
|
||||
regionalid: context.rootState.jurnalumum.user.S_RegionalID,
|
||||
branchid: context.rootState.jurnalumum.user.M_BranchID,
|
||||
last_id: -1
|
||||
}, { root: true })
|
||||
|
||||
context.commit("update_dialogForm", false)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingSave", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
|
||||
async loadEditDialog(context, prm) {
|
||||
context.commit("update_loadingSave", true)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.loadEditDialog(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingSave", false)
|
||||
let snackbar = {
|
||||
state: true,
|
||||
color: 'error',
|
||||
msg: resp.message
|
||||
}
|
||||
context.commit("update_snackbar", snackbar)
|
||||
console.log(resp)
|
||||
} else {
|
||||
context.commit("update_loadingSave", false)
|
||||
|
||||
context.commit("update_selectedJurnal", resp.data.jurnalHead)
|
||||
context.commit("update_selectedJurnalType", {
|
||||
JurnalTypeID: resp.data.jurnalHead.JurnalTypeID,
|
||||
JurnalTypeName: resp.data.jurnalHead.JurnalTypeName
|
||||
})
|
||||
context.commit("update_selectedDate", resp.data.jurnalHead.jurnalDate)
|
||||
context.commit("update_jurnalTitle", resp.data.jurnalHead.jurnalTitle)
|
||||
context.commit("update_jurnalDescription", resp.data.jurnalHead.jurnalDescription)
|
||||
context.commit("update_grniValue", resp.data.jurnalHead.GRNIGR ? resp.data.jurnalHead.GRNIGR : '')
|
||||
context.commit("update_invoiceValue", resp.data.jurnalHead.INVGR ? resp.data.jurnalHead.INVGR : '')
|
||||
context.commit("update_isPosted", resp.data.jurnalHead.jurnalIsPosted)
|
||||
|
||||
context.commit("update_selectedSupplier", resp.data.supplier)
|
||||
context.commit("update_selectedPeriode", resp.data.periode)
|
||||
context.commit("update_detailsJurnalTerimaBarang", resp.data.details)
|
||||
|
||||
// Hitung sum
|
||||
let totalDebit = 0, totalCredit = 0
|
||||
resp.data.details.forEach((item) => {
|
||||
totalDebit += parseFloat(item.jurnalTxDebit)
|
||||
totalCredit += parseFloat(item.jurnalTxCredit)
|
||||
})
|
||||
let totalBalance = totalDebit - totalCredit
|
||||
context.commit("update_detailSum", {
|
||||
debit: totalDebit,
|
||||
credit: totalCredit,
|
||||
balance: totalBalance
|
||||
})
|
||||
|
||||
context.commit("update_dialogJurnalTerimaBarang", true)
|
||||
context.commit("update_actForm", 'edit')
|
||||
console.log(resp.data);
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingSave", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
|
||||
async updateJurnal(context, prm) {
|
||||
context.commit("update_loadingSave", true)
|
||||
try {
|
||||
prm.token = one_token()
|
||||
let resp = await api.updateJurnal(prm)
|
||||
if (resp.status != "OK") {
|
||||
context.commit("update_loadingSave", false)
|
||||
context.commit("jurnalumum/update_save_error_message", resp.message, { root: true })
|
||||
context.commit("jurnalumum/update_alert_error", true, { root: true })
|
||||
console.log(resp)
|
||||
} else {
|
||||
context.commit("update_loadingSave", false)
|
||||
context.commit("jurnalumum/update_alert_success", true, { root: true })
|
||||
var msg = " Journal " + prm.jurnalTitle + " berhasil diupdate"
|
||||
context.commit("jurnalumum/update_msg_success", msg, { root: true })
|
||||
context.dispatch('jurnalumum/search', {
|
||||
current_page: context.rootState.jurnalumum.current_page,
|
||||
search: context.rootState.jurnalumum.x_search,
|
||||
startdate: context.rootState.jurnalumum.start_date,
|
||||
enddate: context.rootState.jurnalumum.end_date,
|
||||
regionalid: context.rootState.jurnalumum.user.S_RegionalID,
|
||||
branchid: context.rootState.jurnalumum.user.M_BranchID,
|
||||
last_id: -1
|
||||
}, { root: true })
|
||||
console.log(resp)
|
||||
}
|
||||
} catch (e) {
|
||||
context.commit("update_loadingSave", false)
|
||||
console.log(e)
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
22
test/vuex/acc-one-jurnal/store.js
Normal file
22
test/vuex/acc-one-jurnal/store.js
Normal file
@@ -0,0 +1,22 @@
|
||||
import jurnalumum from "./modules/jurnalumum.js";
|
||||
import terimaBarang from "./modules/terimaBarang.js";
|
||||
import system from "../../../apps/modules/system/system.js";
|
||||
import jurnalgaji from "./modules/jurnalgaji.js";
|
||||
import pengeluaranbarang from "./modules/pengeluaranbarang.js";
|
||||
import jpbreg from "./modules/jpbreg.js";
|
||||
import jurnalbiaya from "./modules/jurnalbiaya.js";
|
||||
|
||||
export const store = new Vuex.Store({
|
||||
modules: {
|
||||
jurnalumum: jurnalumum,
|
||||
jurnalgaji: jurnalgaji,
|
||||
terimaBarang: terimaBarang,
|
||||
pengeluaranbarang: pengeluaranbarang,
|
||||
jpbreg: jpbreg,
|
||||
jurnalbiaya: jurnalbiaya,
|
||||
system: system
|
||||
},
|
||||
state: {},
|
||||
mutations: {},
|
||||
actions: {},
|
||||
});
|
||||
Reference in New Issue
Block a user