Files

267 lines
6.4 KiB
JavaScript

const URL = "/one-api/mockup/masterdata/accounting/";
export async function getPeriode(prm) {
try {
var resp = await axios.post(URL + 'journalpv/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 + 'journalpv/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 insertSales(branchCode, date, jurnalno) {
try {
var resp = await axios.get(URL + `mediajurnalauto/insertSales/${branchCode}/${date}?isregen=1&jurnalno=${jurnalno}`);
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 + "journalpv/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 + "journalpv/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,
};
}
}
// edit jurnal section
export async function getUserApproveLevel(params) {
try {
var resp = await axios.post(URL + "journalpv/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 + "journalpv/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 + "journalpv/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 + "journalpv/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 + "journalpv/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 + "journalpv/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
}
}
}