feat: add tab debt
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 7s

This commit is contained in:
Thanaphon Frappet 2025-03-10 10:44:46 +07:00
parent d428ac3ec5
commit d6fa8e5b4b
6 changed files with 101 additions and 1 deletions

View file

@ -8,6 +8,7 @@ import {
ReportQuotation,
ReportSale,
ReportProfit,
CustomerDept,
} from './types';
import { baseUrl } from '../utils';
import { getToken } from 'src/services/keycloak';
@ -146,6 +147,14 @@ export async function getReportProfit(params?: {
return null;
}
export async function getReportDept() {
const res = await api.get<CustomerDept[]>(`/${ENDPOINT}/customer-dept`);
if (res.status < 400) {
return res.data;
}
return null;
}
export const useReportStore = defineStore('report-store', () => {
const dataReportQuotation = ref<ReportQuotation[]>([]);
const dataReportInvoice = ref<Report[]>([]);
@ -154,6 +163,7 @@ export const useReportStore = defineStore('report-store', () => {
const dataReportProduct = ref<ReportProduct[]>([]);
const dataReportPayment = ref<ReportPayment[]>([]);
const dataReportProfit = ref<ReportProfit>();
const detaReportDept = ref<CustomerDept[]>([]);
return {
dataReportQuotation,
@ -163,6 +173,7 @@ export const useReportStore = defineStore('report-store', () => {
dataReportProduct,
dataReportPayment,
dataReportProfit,
detaReportDept,
downloadReportQuotation,
getReportQuotation,
@ -176,5 +187,6 @@ export const useReportStore = defineStore('report-store', () => {
getReportProduct,
getReportPayment,
getReportProfit,
getReportDept,
};
});

View file

@ -63,3 +63,9 @@ export type ReportProfit = {
expenses: number;
income: number;
};
export type CustomerDept = {
customerBranch: CustomerBranch;
unpaid: number;
paid: number;
};