mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-06-11 11:01:43 +00:00
feat: migrate depreciation report to V2 API with daily breakdown view
- Add V2 types (ReportDepreciationV2Item, DepreciationV2Meta, DepreciationV2Response) for the new per-day response shape - Add DepreciationReportV2Api service pointing to /reports/expense/v2/depreciation - Require projectFlock in filter (was optional); auto-open filter modal on first load when none is selected - Replace multi-card farm loop with a single project flock card showing farm_name and period only in the header - Replace kandang sub-table with daily depreciation rows: date, day_n, chickin_date, depreciation_value, pullet_cost_day_n_total, multiplication_percentage, total_value_pullet_after_depreciation - Add Total Hari (limit) NumberInput field (default 10) to filter modal; remove pagination - Switch storeName to report-depreciation-v2-table to avoid loading stale localStorage state Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import { Icon } from '@iconify/react';
|
|||||||
import Modal from '@/components/Modal';
|
import Modal from '@/components/Modal';
|
||||||
import Button from '@/components/Button';
|
import Button from '@/components/Button';
|
||||||
import DateInput from '@/components/input/DateInput';
|
import DateInput from '@/components/input/DateInput';
|
||||||
|
import NumberInput from '@/components/input/NumberInput';
|
||||||
import SelectInput, {
|
import SelectInput, {
|
||||||
OptionType,
|
OptionType,
|
||||||
useSelect,
|
useSelect,
|
||||||
@@ -24,13 +25,20 @@ export type ReportDepreciationFilterValues = {
|
|||||||
location?: OptionType<string>;
|
location?: OptionType<string>;
|
||||||
projectFlock?: OptionType<string>;
|
projectFlock?: OptionType<string>;
|
||||||
period: string | null;
|
period: string | null;
|
||||||
|
totalDays: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ReportDepreciationFilterSchema = yup.object({
|
export const ReportDepreciationFilterSchema = yup.object({
|
||||||
area: yup.mixed<OptionType<string>>().optional(),
|
area: yup.mixed<OptionType<string>>().optional(),
|
||||||
location: yup.mixed<OptionType<string>>().optional(),
|
location: yup.mixed<OptionType<string>>().optional(),
|
||||||
projectFlock: yup.mixed<OptionType<string>>().optional(),
|
projectFlock: yup
|
||||||
|
.mixed<OptionType<string>>()
|
||||||
|
.required('Project Flock wajib dipilih'),
|
||||||
period: yup.string().nullable().required('Periode wajib dipilih'),
|
period: yup.string().nullable().required('Periode wajib dipilih'),
|
||||||
|
totalDays: yup
|
||||||
|
.number()
|
||||||
|
.min(1, 'Minimal 1 hari')
|
||||||
|
.required('Total Hari wajib diisi'),
|
||||||
});
|
});
|
||||||
|
|
||||||
interface ReportDepreciationFilterModalProps {
|
interface ReportDepreciationFilterModalProps {
|
||||||
@@ -47,6 +55,7 @@ const defaultInitialValues: (
|
|||||||
location: undefined,
|
location: undefined,
|
||||||
projectFlock: undefined,
|
projectFlock: undefined,
|
||||||
period: initialValues?.period ?? null,
|
period: initialValues?.period ?? null,
|
||||||
|
totalDays: initialValues?.totalDays ?? 10,
|
||||||
});
|
});
|
||||||
|
|
||||||
const ReportDepreciationFilterModal = ({
|
const ReportDepreciationFilterModal = ({
|
||||||
@@ -196,6 +205,14 @@ const ReportDepreciationFilterModal = ({
|
|||||||
isClearable
|
isClearable
|
||||||
isSearchable={true}
|
isSearchable={true}
|
||||||
className={{ wrapper: 'w-full' }}
|
className={{ wrapper: 'w-full' }}
|
||||||
|
isError={
|
||||||
|
formik.touched.projectFlock && !!formik.errors.projectFlock
|
||||||
|
}
|
||||||
|
errorMessage={
|
||||||
|
formik.touched.projectFlock
|
||||||
|
? (formik.errors.projectFlock as string)
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<DateInput
|
<DateInput
|
||||||
@@ -210,6 +227,31 @@ const ReportDepreciationFilterModal = ({
|
|||||||
required
|
required
|
||||||
isNestedModal
|
isNestedModal
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<NumberInput
|
||||||
|
label='Total Hari'
|
||||||
|
name='totalDays'
|
||||||
|
placeholder='Masukkan total hari'
|
||||||
|
value={formik.values.totalDays}
|
||||||
|
onChange={(e) => {
|
||||||
|
const val = Number(e.target.value);
|
||||||
|
formik.setFieldValue(
|
||||||
|
'totalDays',
|
||||||
|
isNaN(val) || val < 1 ? 1 : Math.floor(val)
|
||||||
|
);
|
||||||
|
}}
|
||||||
|
onBlur={formik.handleBlur}
|
||||||
|
decimalScale={0}
|
||||||
|
allowNegative={false}
|
||||||
|
thousandSeparator=''
|
||||||
|
isError={formik.touched.totalDays && !!formik.errors.totalDays}
|
||||||
|
errorMessage={
|
||||||
|
formik.touched.totalDays
|
||||||
|
? (formik.errors.totalDays as string)
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
|
className={{ wrapper: 'w-full' }}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className='p-4 flex justify-between gap-4 border-t border-base-content/10 bg-gray-50'>
|
<div className='p-4 flex justify-between gap-4 border-t border-base-content/10 bg-gray-50'>
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import React, { useEffect, useMemo } from 'react';
|
import React, { useEffect, useMemo, useRef } from 'react';
|
||||||
import useSWR from 'swr';
|
import useSWR from 'swr';
|
||||||
import { ColumnDef } from '@tanstack/react-table';
|
import { ColumnDef } from '@tanstack/react-table';
|
||||||
|
|
||||||
import { Icon } from '@iconify/react';
|
import { Icon } from '@iconify/react';
|
||||||
import Card from '@/components/Card';
|
import Card from '@/components/Card';
|
||||||
import Pagination from '@/components/Pagination';
|
|
||||||
import Table from '@/components/Table';
|
import Table from '@/components/Table';
|
||||||
import ButtonFilter from '@/components/helper/ButtonFilter';
|
import ButtonFilter from '@/components/helper/ButtonFilter';
|
||||||
import ReportExpenseSkeleton from '@/components/pages/report/expense/skeleton/ReportExpenseSkeleton';
|
import ReportExpenseSkeleton from '@/components/pages/report/expense/skeleton/ReportExpenseSkeleton';
|
||||||
@@ -14,11 +13,14 @@ import { useModal } from '@/components/Modal';
|
|||||||
import ReportDepreciationFilterModal from '@/components/pages/report/expense/tab/ReportDepreciationFilterModal';
|
import ReportDepreciationFilterModal from '@/components/pages/report/expense/tab/ReportDepreciationFilterModal';
|
||||||
|
|
||||||
import { useTabActionsStore } from '@/stores/tab-actions/tab-actions.store';
|
import { useTabActionsStore } from '@/stores/tab-actions/tab-actions.store';
|
||||||
import { ReportDepreciation } from '@/types/api/report/report-expense';
|
import {
|
||||||
import { DepreciationReportApi } from '@/services/api/report/expense-report';
|
DepreciationV2Response,
|
||||||
|
ReportDepreciationV2Item,
|
||||||
|
} from '@/types/api/report/report-expense';
|
||||||
|
import { DepreciationReportV2Api } from '@/services/api/report/expense-report';
|
||||||
import { useTableFilter } from '@/services/hooks/useTableFilter';
|
import { useTableFilter } from '@/services/hooks/useTableFilter';
|
||||||
import { OptionType } from '@/components/input/SelectInput';
|
import { OptionType } from '@/components/input/SelectInput';
|
||||||
import { isResponseSuccess } from '@/lib/api-helper';
|
import { httpClientFetcher } from '@/services/http/client';
|
||||||
import { formatCurrency, formatDate, formatNumber } from '@/lib/helper';
|
import { formatCurrency, formatDate, formatNumber } from '@/lib/helper';
|
||||||
|
|
||||||
interface ReportDepreciationTabProps {
|
interface ReportDepreciationTabProps {
|
||||||
@@ -29,8 +31,6 @@ const ReportDepreciationTab = ({ tabId }: ReportDepreciationTabProps) => {
|
|||||||
const {
|
const {
|
||||||
state: tableFilterState,
|
state: tableFilterState,
|
||||||
updateFilter,
|
updateFilter,
|
||||||
setPage,
|
|
||||||
setPageSize,
|
|
||||||
toQueryString: getTableFilterQueryString,
|
toQueryString: getTableFilterQueryString,
|
||||||
reset: resetFilter,
|
reset: resetFilter,
|
||||||
} = useTableFilter<{
|
} = useTableFilter<{
|
||||||
@@ -38,56 +38,73 @@ const ReportDepreciationTab = ({ tabId }: ReportDepreciationTabProps) => {
|
|||||||
location?: OptionType<string>;
|
location?: OptionType<string>;
|
||||||
projectFlock?: OptionType<string>;
|
projectFlock?: OptionType<string>;
|
||||||
period: string;
|
period: string;
|
||||||
|
totalDays: number;
|
||||||
}>({
|
}>({
|
||||||
initial: {
|
initial: {
|
||||||
area: undefined,
|
area: undefined,
|
||||||
location: undefined,
|
location: undefined,
|
||||||
projectFlock: undefined,
|
projectFlock: undefined,
|
||||||
period: formatDate(Date.now(), 'YYYY-MM-DD'),
|
period: formatDate(Date.now(), 'YYYY-MM-DD'),
|
||||||
|
totalDays: 10,
|
||||||
},
|
},
|
||||||
paramMap: {
|
paramMap: {
|
||||||
pageSize: 'limit',
|
|
||||||
area: 'area_id',
|
area: 'area_id',
|
||||||
location: 'location_id',
|
location: 'location_id',
|
||||||
projectFlock: 'project_flock_id',
|
projectFlock: 'project_flock_id',
|
||||||
period: 'period',
|
period: 'period',
|
||||||
|
totalDays: 'limit',
|
||||||
},
|
},
|
||||||
persist: true,
|
persist: true,
|
||||||
storeName: 'report-depreciation-table',
|
storeName: 'report-depreciation-v2-table',
|
||||||
});
|
});
|
||||||
|
|
||||||
const { data: depreciationsResponse, isLoading: isLoadingDepreciations } =
|
const swrKey = tableFilterState.projectFlock
|
||||||
useSWR(
|
? `${DepreciationReportV2Api.basePath}${getTableFilterQueryString()}`
|
||||||
`${DepreciationReportApi.basePath}${getTableFilterQueryString()}`,
|
: null;
|
||||||
DepreciationReportApi.getAllFetcher
|
|
||||||
);
|
|
||||||
|
|
||||||
const depreciations = isResponseSuccess(depreciationsResponse)
|
const { data: depreciationsResponse, isLoading: isLoadingDepreciations } =
|
||||||
|
useSWR<DepreciationV2Response>(swrKey, httpClientFetcher);
|
||||||
|
|
||||||
|
const depreciationMeta =
|
||||||
|
depreciationsResponse?.status === 'success'
|
||||||
|
? depreciationsResponse.meta
|
||||||
|
: null;
|
||||||
|
const depreciationData =
|
||||||
|
depreciationsResponse?.status === 'success'
|
||||||
? depreciationsResponse.data
|
? depreciationsResponse.data
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
const filterModal = useModal();
|
const filterModal = useModal();
|
||||||
const { ref: filterModalRef } = filterModal;
|
const { ref: filterModalRef } = filterModal;
|
||||||
|
|
||||||
|
const initialOpenRef = useRef(false);
|
||||||
|
useEffect(() => {
|
||||||
|
if (!initialOpenRef.current) {
|
||||||
|
initialOpenRef.current = true;
|
||||||
|
if (!tableFilterState.projectFlock) {
|
||||||
|
filterModal.openModal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
const setTabActions = useTabActionsStore((state) => state.setTabActions);
|
const setTabActions = useTabActionsStore((state) => state.setTabActions);
|
||||||
const clearTabActions = useTabActionsStore((state) => state.clearTabActions);
|
const clearTabActions = useTabActionsStore((state) => state.clearTabActions);
|
||||||
|
|
||||||
const depreciationKandangColumns: ColumnDef<
|
const depreciationColumns: ColumnDef<ReportDepreciationV2Item>[] = useMemo(
|
||||||
ReportDepreciation['components']['kandang'][0]
|
() => [
|
||||||
>[] = [
|
|
||||||
{
|
{
|
||||||
accessorKey: 'kandang_name',
|
accessorKey: 'date',
|
||||||
header: 'Kandang',
|
header: 'Tanggal',
|
||||||
|
cell: ({ row }) => formatDate(row.original.date, 'DD MMM YYYY'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: 'house_type',
|
accessorKey: 'day_n',
|
||||||
header: 'Tipe Kandang',
|
header: 'Hari ke-',
|
||||||
cell: ({ row }) => row.original.house_type.toUpperCase(),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: 'depreciation_percent',
|
accessorKey: 'chickin_date',
|
||||||
header: 'Persentase Depresiasi',
|
header: 'Tanggal Chick-in',
|
||||||
cell: ({ row }) => row.original.depreciation_percent + '%',
|
cell: ({ row }) => formatDate(row.original.chickin_date, 'DD MMM YYYY'),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: 'depreciation_value',
|
accessorKey: 'depreciation_value',
|
||||||
@@ -95,21 +112,43 @@ const ReportDepreciationTab = ({ tabId }: ReportDepreciationTabProps) => {
|
|||||||
cell: ({ row }) => formatCurrency(row.original.depreciation_value),
|
cell: ({ row }) => formatCurrency(row.original.depreciation_value),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: 'depreciation_source',
|
accessorKey: 'pullet_cost_day_n_total',
|
||||||
header: 'Asal Depresiasi',
|
header: 'Total Harga Pullet Hari ke-N',
|
||||||
cell: ({ row }) => row.original.depreciation_source.toUpperCase(),
|
cell: ({ row }) =>
|
||||||
|
formatCurrency(
|
||||||
|
row.original.pullet_cost_day_n_total,
|
||||||
|
'IDR',
|
||||||
|
'id-ID',
|
||||||
|
0,
|
||||||
|
10
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: 'cutover_date',
|
accessorKey: 'multiplication_percentage',
|
||||||
header: 'Tanggal Cutover',
|
header: 'Persentase Multiplikasi',
|
||||||
cell: ({ row }) => formatDate(row.original.cutover_date, 'DD MMM YYYY'),
|
cell: ({ row }) =>
|
||||||
|
formatNumber(
|
||||||
|
row.original.multiplication_percentage * 100,
|
||||||
|
'en-US',
|
||||||
|
0,
|
||||||
|
4
|
||||||
|
) + '%',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
accessorKey: 'origin_date',
|
accessorKey: 'total_value_pullet_after_depreciation',
|
||||||
header: 'Tanggal Origin',
|
header: 'Total Nilai Pullet Setelah Depresiasi',
|
||||||
cell: ({ row }) => formatDate(row.original.origin_date, 'DD MMM YYYY'),
|
cell: ({ row }) =>
|
||||||
|
formatCurrency(
|
||||||
|
row.original.total_value_pullet_after_depreciation,
|
||||||
|
'IDR',
|
||||||
|
'id-ID',
|
||||||
|
0,
|
||||||
|
10
|
||||||
|
),
|
||||||
},
|
},
|
||||||
];
|
],
|
||||||
|
[]
|
||||||
|
);
|
||||||
|
|
||||||
const tabActionsElement = useMemo(
|
const tabActionsElement = useMemo(
|
||||||
() => (
|
() => (
|
||||||
@@ -145,9 +184,27 @@ const ReportDepreciationTab = ({ tabId }: ReportDepreciationTabProps) => {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{!isLoadingDepreciations && depreciations.length === 0 && (
|
{!isLoadingDepreciations && !tableFilterState.projectFlock && (
|
||||||
<ReportExpenseSkeleton
|
<ReportExpenseSkeleton
|
||||||
columns={depreciationKandangColumns}
|
columns={depreciationColumns}
|
||||||
|
icon={
|
||||||
|
<Icon
|
||||||
|
icon='heroicons:chart-bar'
|
||||||
|
className='text-white'
|
||||||
|
width={20}
|
||||||
|
height={20}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
title='Pilih Project Flock'
|
||||||
|
subtitle='Silakan pilih Project Flock pada filter untuk melihat data depresiasi.'
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{!isLoadingDepreciations &&
|
||||||
|
tableFilterState.projectFlock &&
|
||||||
|
depreciationData.length === 0 && (
|
||||||
|
<ReportExpenseSkeleton
|
||||||
|
columns={depreciationColumns}
|
||||||
icon={
|
icon={
|
||||||
<Icon
|
<Icon
|
||||||
icon='heroicons:chart-bar'
|
icon='heroicons:chart-bar'
|
||||||
@@ -161,18 +218,16 @@ const ReportDepreciationTab = ({ tabId }: ReportDepreciationTabProps) => {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{!isLoadingDepreciations && depreciations.length > 0 && (
|
{!isLoadingDepreciations &&
|
||||||
<>
|
depreciationData.length > 0 &&
|
||||||
{depreciations.map((depreciationItem, idx) => (
|
depreciationMeta && (
|
||||||
<Card
|
<Card
|
||||||
key={idx}
|
title={depreciationMeta.farm_name}
|
||||||
title={depreciationItem.farm_name}
|
subtitle={`Periode: ${formatDate(depreciationMeta.period, 'DD MMM YYYY')}`}
|
||||||
subtitle={`Period: ${formatDate(depreciationItem.period, 'DD MMM YYYY')} | Depresiasi Efektif: ${formatNumber(depreciationItem.depreciation_percent_effective, 'en-US', 0, 10)}% | Nilai Depresiasi: ${formatCurrency(depreciationItem.depreciation_value)} | Total Pullet Cost: ${formatCurrency(depreciationItem.pullet_cost_day_n_total, 'IDR', 'id-ID', 0, 10)}`}
|
|
||||||
className={{
|
className={{
|
||||||
wrapper: 'w-full rounded-lg border-none',
|
wrapper: 'w-full rounded-lg border-none',
|
||||||
body: 'p-0',
|
body: 'p-0',
|
||||||
title:
|
title: 'px-2 py-1.5 font-normal text-sm bg-primary text-white',
|
||||||
'px-2 py-1.5 font-normal text-sm bg-primary text-white',
|
|
||||||
subtitle:
|
subtitle:
|
||||||
'px-2 pb-1.5 bg-primary text-white text-xs font-normal',
|
'px-2 pb-1.5 bg-primary text-white text-xs font-normal',
|
||||||
collapsible: 'rounded-lg',
|
collapsible: 'rounded-lg',
|
||||||
@@ -181,21 +236,11 @@ const ReportDepreciationTab = ({ tabId }: ReportDepreciationTabProps) => {
|
|||||||
collapsible={true}
|
collapsible={true}
|
||||||
>
|
>
|
||||||
<Table
|
<Table
|
||||||
data={depreciationItem.components.kandang}
|
data={depreciationData}
|
||||||
columns={depreciationKandangColumns}
|
columns={depreciationColumns}
|
||||||
pageSize={tableFilterState.pageSize}
|
pageSize={depreciationData.length}
|
||||||
page={
|
page={1}
|
||||||
isResponseSuccess(depreciationsResponse)
|
totalItems={depreciationData.length}
|
||||||
? depreciationsResponse?.meta?.page
|
|
||||||
: 0
|
|
||||||
}
|
|
||||||
totalItems={
|
|
||||||
isResponseSuccess(depreciationsResponse)
|
|
||||||
? depreciationsResponse?.meta?.total_results
|
|
||||||
: 0
|
|
||||||
}
|
|
||||||
onPageChange={setPage}
|
|
||||||
onPageSizeChange={setPageSize}
|
|
||||||
isLoading={isLoadingDepreciations}
|
isLoading={isLoadingDepreciations}
|
||||||
className={{
|
className={{
|
||||||
containerClassName: 'w-full mb-0!',
|
containerClassName: 'w-full mb-0!',
|
||||||
@@ -218,27 +263,6 @@ const ReportDepreciationTab = ({ tabId }: ReportDepreciationTabProps) => {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Card>
|
</Card>
|
||||||
))}
|
|
||||||
|
|
||||||
<Pagination
|
|
||||||
totalItems={
|
|
||||||
isResponseSuccess(depreciationsResponse)
|
|
||||||
? (depreciationsResponse?.meta?.total_results ?? 0)
|
|
||||||
: 0
|
|
||||||
}
|
|
||||||
itemsPerPage={tableFilterState.pageSize}
|
|
||||||
currentPage={
|
|
||||||
isResponseSuccess(depreciationsResponse)
|
|
||||||
? (depreciationsResponse?.meta?.page ?? 0)
|
|
||||||
: 0
|
|
||||||
}
|
|
||||||
onPrevPage={() => setPage(tableFilterState.page - 1)}
|
|
||||||
onNextPage={() => setPage(tableFilterState.page + 1)}
|
|
||||||
onPageChange={setPage}
|
|
||||||
rowOptions={[10, 20, 50, 100]}
|
|
||||||
onRowChange={setPageSize}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -255,6 +279,7 @@ const ReportDepreciationTab = ({ tabId }: ReportDepreciationTabProps) => {
|
|||||||
values.period ? formatDate(values.period, 'YYYY-MM-DD') : '',
|
values.period ? formatDate(values.period, 'YYYY-MM-DD') : '',
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
updateFilter('totalDays', values.totalDays ?? 10, true);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { httpClient, httpClientFetcher } from '@/services/http/client';
|
|||||||
import { BaseApiResponse } from '@/types/api/api-general';
|
import { BaseApiResponse } from '@/types/api/api-general';
|
||||||
import {
|
import {
|
||||||
ReportDepreciation,
|
ReportDepreciation,
|
||||||
|
ReportDepreciationV2Item,
|
||||||
ReportExpense,
|
ReportExpense,
|
||||||
} from '@/types/api/report/report-expense';
|
} from '@/types/api/report/report-expense';
|
||||||
|
|
||||||
@@ -57,3 +58,9 @@ export const DepreciationReportApi = new BaseApiService<
|
|||||||
unknown,
|
unknown,
|
||||||
unknown
|
unknown
|
||||||
>('/reports/expense/depreciation');
|
>('/reports/expense/depreciation');
|
||||||
|
|
||||||
|
export const DepreciationReportV2Api = new BaseApiService<
|
||||||
|
ReportDepreciationV2Item,
|
||||||
|
unknown,
|
||||||
|
unknown
|
||||||
|
>('/reports/expense/v2/depreciation');
|
||||||
|
|||||||
+60
@@ -90,3 +90,63 @@ export type ReportDepreciationSearchParams = {
|
|||||||
farm: string | null;
|
farm: string | null;
|
||||||
period: string | null;
|
period: string | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type ReportDepreciationV2KandangItem = {
|
||||||
|
kandang_id: number;
|
||||||
|
kandang_name: string;
|
||||||
|
transfer_id: number;
|
||||||
|
depreciation_percent: number;
|
||||||
|
pullet_cost_day_n: number;
|
||||||
|
depreciation_value: number;
|
||||||
|
chickin_date: string;
|
||||||
|
project_flock_kandang_id: number;
|
||||||
|
depreciation_source: string;
|
||||||
|
transfer_date: string;
|
||||||
|
source_project_flock_id: number;
|
||||||
|
house_type: string;
|
||||||
|
multiplication_percentage: number;
|
||||||
|
cutover_date: string;
|
||||||
|
origin_date: string;
|
||||||
|
standard_effective_date: string;
|
||||||
|
population: number;
|
||||||
|
transfer_qty: number;
|
||||||
|
total_value_pullet_after_depreciation: number;
|
||||||
|
manual_input_id: number;
|
||||||
|
start_schedule_day: number;
|
||||||
|
day_n: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type ReportDepreciationV2Item = {
|
||||||
|
date: string;
|
||||||
|
depreciation_percent_effective: number;
|
||||||
|
depreciation_value: number;
|
||||||
|
pullet_cost_day_n_total: number;
|
||||||
|
multiplication_percentage: number;
|
||||||
|
day_n: number;
|
||||||
|
chickin_date: string;
|
||||||
|
total_value_pullet_after_depreciation: number;
|
||||||
|
standard_effective_date: string;
|
||||||
|
total_population: number;
|
||||||
|
components: {
|
||||||
|
kandang_count: number;
|
||||||
|
total_population: number;
|
||||||
|
kandang: ReportDepreciationV2KandangItem[];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export type DepreciationV2Meta = {
|
||||||
|
project_flock_id: number;
|
||||||
|
farm_name: string;
|
||||||
|
location_id: number;
|
||||||
|
period: string;
|
||||||
|
limit: number;
|
||||||
|
total_days: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type DepreciationV2Response = {
|
||||||
|
code: number;
|
||||||
|
status: string;
|
||||||
|
message: string;
|
||||||
|
meta: DepreciationV2Meta;
|
||||||
|
data: ReportDepreciationV2Item[];
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user