Files

277 lines
6.3 KiB
JavaScript

const URL = "/one-api/mockup/masterdata/accounting/";
export async function getPeriode(prm) {
try {
var resp = await axios.post(URL + "journalarv2/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 search(
token,
xdate,
periodeid,
current_page,
search,
branchCode,
regionalId
) {
try {
var resp = await axios.post(URL + "journalarv2/search", {
token: token,
xdate: xdate,
periodeid: periodeid,
current_page: current_page,
search: search,
branchCode: branchCode,
regionalId: regionalId
});
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 insertAr(branchCode, date, jurnalID) {
try {
var resp = await axios.get(
URL + `mediajurnalauto/insertAr/${branchCode}/${date}/1/${jurnalID}`
);
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 getRegional(prm) {
try {
var resp = await axios.post(URL + "journalarv2/getRegional", 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 getBranch(prm) {
try {
var resp = await axios.post(URL + "journalarv2/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 getUserApproveLevel(params) {
try {
var resp = await axios.post(URL + "journalarv2/getUserApproveLevel", params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
};
}
}
export async function getListingCOA(params) {
try {
var resp = await axios.post(URL + "journalarv2/getListingCOA", params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
};
}
}
export async function requestEditJurnal(params) {
try {
const resp = await axios.post(URL + "JournalVerifEdit/requestEditJurnal", params);
if (resp.status !== 200) {
return {
status: "ERR",
message: resp.statusText
};
}
const data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
};
}
}
export async function saveEditJurnal(params) {
try {
var resp = await axios.post(URL + "JournalVerifEdit/saveEditJurnal", params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
};
}
}
export async function changeJurnalToPosted(params) {
try {
var resp = await axios.post(URL + "journalarv2/changeJurnalToPosted", params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
};
}
}
export async function getTotalJurnalNotPostedPerPeriod(params) {
try {
var resp = await axios.post(URL + "journalarv2/getTotalJurnalNotPostedPerPeriod", params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
};
}
}
export async function closeJurnalPerPeriode(params) {
try {
var resp = await axios.post(URL + "journalarv2/closeJurnalPerPeriode", params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
};
}
}
export async function getDataJurnalNotClosedPerPeriod(params) {
try {
var resp = await axios.post(URL + "journalarv2/getDataJurnalNotClosedPerPeriod", params);
if (resp.status != 200) {
return {
status: "ERR",
message: resp.statusText
};
}
let data = resp.data;
return data;
} catch (error) {
return {
status: "ERR",
message: error.message
};
}
}