mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-24 15:25:46 +00:00
Merge branch 'development' of gitlab.com:mbugroup/lti-web-client into dev/restu
This commit is contained in:
@@ -96,11 +96,6 @@ const ClosingProductionDataTabContent = ({
|
|||||||
value={formatNumber(purchase.feed_used)}
|
value={formatNumber(purchase.feed_used)}
|
||||||
unit='Kg'
|
unit='Kg'
|
||||||
/>
|
/>
|
||||||
<DataRow
|
|
||||||
label='Pakan Terpakai per Ekor'
|
|
||||||
value={formatNumber(purchase.feed_used_per_head)}
|
|
||||||
unit='Kg'
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -124,14 +119,12 @@ const ClosingProductionDataTabContent = ({
|
|||||||
/>
|
/>
|
||||||
<DataRow
|
<DataRow
|
||||||
label='Bobot Rata-Rata'
|
label='Bobot Rata-Rata'
|
||||||
value={formatNumber(sales.chicken.average_weight)}
|
value={formatNumber(sales.chicken.avg_weight)}
|
||||||
unit='Kg/Ekor'
|
unit='Kg/Ekor'
|
||||||
/>
|
/>
|
||||||
<DataRow
|
<DataRow
|
||||||
label='Harga Jual Rata-Rata'
|
label='Harga Jual Rata-Rata'
|
||||||
value={formatNumber(
|
value={formatNumber(sales.chicken.avg_selling_price)}
|
||||||
sales.chicken.chicken_average_selling_price
|
|
||||||
)}
|
|
||||||
unit='Rupiah'
|
unit='Rupiah'
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -148,17 +141,17 @@ const ClosingProductionDataTabContent = ({
|
|||||||
/>
|
/>
|
||||||
<DataRow
|
<DataRow
|
||||||
label='Telur (Kg)'
|
label='Telur (Kg)'
|
||||||
value={formatNumber(sales.egg.egg_mass_kg)}
|
value={formatNumber(sales.egg.egg_mass)}
|
||||||
unit='Kg'
|
unit='Kg'
|
||||||
/>
|
/>
|
||||||
<DataRow
|
<DataRow
|
||||||
label='Berat Telur Rata-Rata'
|
label='Berat Telur Rata-Rata'
|
||||||
value={formatNumber(sales.egg.average_egg_weight_kg)}
|
value={formatNumber(sales.egg.avg_egg_weight)}
|
||||||
unit='Kg'
|
unit='Kg'
|
||||||
/>
|
/>
|
||||||
<DataRow
|
<DataRow
|
||||||
label='Harga Jual Telur Rata-Rata'
|
label='Harga Jual Telur Rata-Rata'
|
||||||
value={formatNumber(sales.egg.egg_average_selling_price)}
|
value={formatNumber(sales.egg.avg_selling_price)}
|
||||||
unit='Rupiah'
|
unit='Rupiah'
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -191,17 +184,37 @@ const ClosingProductionDataTabContent = ({
|
|||||||
/>
|
/>
|
||||||
<DataRow
|
<DataRow
|
||||||
label='Mortalitas Std'
|
label='Mortalitas Std'
|
||||||
value={formatNumber(performance.mortality_std)}
|
value={formatNumber(performance.mor_std)}
|
||||||
unitClassName='hidden'
|
unitClassName='hidden'
|
||||||
/>
|
/>
|
||||||
<DataRow
|
<DataRow
|
||||||
label='Mortalitas Act'
|
label='Mortalitas Act'
|
||||||
value={formatNumber(performance.mortality_act)}
|
value={formatNumber(performance.mor_act)}
|
||||||
unitClassName='hidden'
|
unitClassName='hidden'
|
||||||
/>
|
/>
|
||||||
<DataRow
|
<DataRow
|
||||||
label='DEFF Mortalitas'
|
label='DEFF Mortalitas'
|
||||||
value={formatNumber(performance.deff_mortality)}
|
value={formatNumber(performance.mor_diff)}
|
||||||
|
unitClassName='hidden'
|
||||||
|
/>
|
||||||
|
<DataRow
|
||||||
|
label='AWG Std'
|
||||||
|
value={formatNumber(performance.awg_std)}
|
||||||
|
unit='Gr/Hari'
|
||||||
|
/>
|
||||||
|
<DataRow
|
||||||
|
label='AWG Act'
|
||||||
|
value={formatNumber(performance.awg_act)}
|
||||||
|
unit='Gr/Hari'
|
||||||
|
/>
|
||||||
|
<DataRow
|
||||||
|
label='Feed Intake Std'
|
||||||
|
value={formatNumber(performance.feed_intake_std)}
|
||||||
|
unitClassName='hidden'
|
||||||
|
/>
|
||||||
|
<DataRow
|
||||||
|
label='Feed Intake Act'
|
||||||
|
value={formatNumber(performance.feed_intake)}
|
||||||
unitClassName='hidden'
|
unitClassName='hidden'
|
||||||
/>
|
/>
|
||||||
<DataRow
|
<DataRow
|
||||||
@@ -216,14 +229,70 @@ const ClosingProductionDataTabContent = ({
|
|||||||
/>
|
/>
|
||||||
<DataRow
|
<DataRow
|
||||||
label='DEFF FCR'
|
label='DEFF FCR'
|
||||||
value={formatNumber(performance.deff_fcr)}
|
value={formatNumber(performance.fcr_diff)}
|
||||||
unitClassName='hidden'
|
unitClassName='hidden'
|
||||||
/>
|
/>
|
||||||
<DataRow
|
|
||||||
label='AWG'
|
{/* Laying Specific Fields */}
|
||||||
value={formatNumber(performance.awg)}
|
{performance.hen_day_act !== undefined && (
|
||||||
unit='Gr/Hari'
|
<>
|
||||||
/>
|
<DataRow
|
||||||
|
label='Hen Day Std'
|
||||||
|
value={formatNumber(performance.hen_day_std!)}
|
||||||
|
unit='%'
|
||||||
|
/>
|
||||||
|
<DataRow
|
||||||
|
label='Hen Day Act'
|
||||||
|
value={formatNumber(performance.hen_day_act)}
|
||||||
|
unit='%'
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{performance.egg_mass !== undefined && (
|
||||||
|
<>
|
||||||
|
<DataRow
|
||||||
|
label='Egg Mass Std'
|
||||||
|
value={formatNumber(performance.egg_mass_std!)}
|
||||||
|
unit='Kg'
|
||||||
|
/>
|
||||||
|
<DataRow
|
||||||
|
label='Egg Mass Act'
|
||||||
|
value={formatNumber(performance.egg_mass)}
|
||||||
|
unit='Kg'
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{performance.egg_weight !== undefined && (
|
||||||
|
<>
|
||||||
|
<DataRow
|
||||||
|
label='Egg Weight Std'
|
||||||
|
value={formatNumber(performance.egg_weight_std!)}
|
||||||
|
unit='Gr'
|
||||||
|
/>
|
||||||
|
<DataRow
|
||||||
|
label='Egg Weight Act'
|
||||||
|
value={formatNumber(performance.egg_weight)}
|
||||||
|
unit='Gr'
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{performance.hen_housed_act !== undefined && (
|
||||||
|
<>
|
||||||
|
<DataRow
|
||||||
|
label='Hen Housed Std'
|
||||||
|
value={formatNumber(performance.hen_housed_std!)}
|
||||||
|
unit='%'
|
||||||
|
/>
|
||||||
|
<DataRow
|
||||||
|
label='Hen Housed Act'
|
||||||
|
value={formatNumber(performance.hen_housed_act)}
|
||||||
|
unit='%'
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ const FinanceDetail = ({ finance }: { finance: Finance }) => {
|
|||||||
</Button>
|
</Button>
|
||||||
</RequirePermission>
|
</RequirePermission>
|
||||||
)}
|
)}
|
||||||
<RequirePermission permissions='lti.finance.transaction.delete'>
|
<RequirePermission permissions='lti.finance.transactions.delete'>
|
||||||
<Button
|
<Button
|
||||||
color='error'
|
color='error'
|
||||||
className='min-w-24'
|
className='min-w-24'
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ const RowOptionsMenu = ({
|
|||||||
}) => {
|
}) => {
|
||||||
return (
|
return (
|
||||||
<RowOptionsMenuWrapper type={type}>
|
<RowOptionsMenuWrapper type={type}>
|
||||||
<RequirePermission permissions='lti.finance.transaction.detail'>
|
<RequirePermission permissions='lti.finance.transactions.detail'>
|
||||||
<Button
|
<Button
|
||||||
href={`/finance/detail?financeId=${props.row.original.id}`}
|
href={`/finance/detail?financeId=${props.row.original.id}`}
|
||||||
variant='ghost'
|
variant='ghost'
|
||||||
@@ -109,7 +109,7 @@ const RowOptionsMenu = ({
|
|||||||
</RequirePermission>
|
</RequirePermission>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<RequirePermission permissions='lti.finance.transaction.delete'>
|
<RequirePermission permissions='lti.finance.transactions.delete'>
|
||||||
<Button
|
<Button
|
||||||
onClick={deleteClickHandler}
|
onClick={deleteClickHandler}
|
||||||
variant='ghost'
|
variant='ghost'
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import {
|
|||||||
import { ProjectFlockKandang } from '@/types/api/production/project-flock-kandang';
|
import { ProjectFlockKandang } from '@/types/api/production/project-flock-kandang';
|
||||||
import { isResponseError } from '@/lib/api-helper';
|
import { isResponseError } from '@/lib/api-helper';
|
||||||
import Pagination from '@/components/Pagination';
|
import Pagination from '@/components/Pagination';
|
||||||
|
import { ProductionResultReportApi } from '@/services/api/report/production-result';
|
||||||
|
|
||||||
const ProductionResultContent = () => {
|
const ProductionResultContent = () => {
|
||||||
const [projectFlockKandangs, setProjectFlockKandangs] = useState<
|
const [projectFlockKandangs, setProjectFlockKandangs] = useState<
|
||||||
@@ -145,8 +146,11 @@ const ProductionResultContent = () => {
|
|||||||
|
|
||||||
const exportToExcelHandler = async () => {
|
const exportToExcelHandler = async () => {
|
||||||
setIsLoadingExportingToExcel(true);
|
setIsLoadingExportingToExcel(true);
|
||||||
// TODO: Implement export functionality in API service first if needed
|
|
||||||
toast.error('Fitur export belum tersedia');
|
await ProductionResultReportApi.exportProductionResultToExcel(
|
||||||
|
projectFlockKandangs
|
||||||
|
);
|
||||||
|
|
||||||
setIsLoadingExportingToExcel(false);
|
setIsLoadingExportingToExcel(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -319,7 +323,13 @@ const ProductionResultContent = () => {
|
|||||||
align='end'
|
align='end'
|
||||||
direction='bottom'
|
direction='bottom'
|
||||||
trigger={
|
trigger={
|
||||||
<Button>
|
<Button
|
||||||
|
disabled={
|
||||||
|
!selectedArea ||
|
||||||
|
!selectedLocation ||
|
||||||
|
!selectedProjectFlock
|
||||||
|
}
|
||||||
|
>
|
||||||
Export{' '}
|
Export{' '}
|
||||||
<Icon
|
<Icon
|
||||||
icon='heroicons-outline:download'
|
icon='heroicons-outline:download'
|
||||||
|
|||||||
+1
-1
@@ -352,7 +352,7 @@ const ProductionResultProjectFlockKandangTable = ({
|
|||||||
productionResults?.data?.length === 0,
|
productionResults?.data?.length === 0,
|
||||||
}),
|
}),
|
||||||
headerColumnClassName:
|
headerColumnClassName:
|
||||||
'px-4 py-3 border-base-content/10 text-base-content/50',
|
'px-4 py-3 border-x border-base-content/10 text-base-content/50',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -75,8 +75,8 @@ export const ROUTE_PERMISSIONS: Record<string, string[]> = {
|
|||||||
'/expense/realization/edit/': ['lti.expense.update.realization'],
|
'/expense/realization/edit/': ['lti.expense.update.realization'],
|
||||||
|
|
||||||
// Finance
|
// Finance
|
||||||
'/finance/': ['lti.finance.transaction.list'],
|
'/finance/': ['lti.finance.transactions.list'],
|
||||||
'/finance/detail/': ['lti.finance.transaction.detail'],
|
'/finance/detail/': ['lti.finance.transactions.detail'],
|
||||||
'/finance/add/': ['lti.finance.payments.create'],
|
'/finance/add/': ['lti.finance.payments.create'],
|
||||||
'/finance/detail/edit/': ['lti.finance.payments.update'],
|
'/finance/detail/edit/': ['lti.finance.payments.update'],
|
||||||
'/finance/add/initial-balance/': ['lti.finance.initial_balances.create'],
|
'/finance/add/initial-balance/': ['lti.finance.initial_balances.create'],
|
||||||
@@ -94,10 +94,7 @@ export const ROUTE_PERMISSIONS: Record<string, string[]> = {
|
|||||||
'/report/logistic-stock/': ['lti.repport.purchasesupplier.list'],
|
'/report/logistic-stock/': ['lti.repport.purchasesupplier.list'],
|
||||||
'/report/expense/': ['lti.repport.expense.list'],
|
'/report/expense/': ['lti.repport.expense.list'],
|
||||||
'/report/marketing/': ['lti.repport.delivery.list'],
|
'/report/marketing/': ['lti.repport.delivery.list'],
|
||||||
|
'/report/production-result/': ['lti.repport.production_result.list'],
|
||||||
// TODO: change to real permission
|
|
||||||
// '/report/production-result/': ['lti.repport.production_result.list'],
|
|
||||||
'/report/production-result/': ['lti.repport.delivery.list'],
|
|
||||||
|
|
||||||
// Inventory
|
// Inventory
|
||||||
'/inventory/adjustment/': ['lti.inventory.list'],
|
'/inventory/adjustment/': ['lti.inventory.list'],
|
||||||
|
|||||||
@@ -1,145 +1,12 @@
|
|||||||
import { sleep } from '@/lib/helper';
|
import * as XLSX from 'xlsx';
|
||||||
|
import toast from 'react-hot-toast';
|
||||||
|
import { formatDate } from '@/lib/helper';
|
||||||
|
import { isResponseSuccess } from '@/lib/api-helper';
|
||||||
import { BaseApiService } from '@/services/api/base';
|
import { BaseApiService } from '@/services/api/base';
|
||||||
import { httpClientFetcher } from '@/services/http/client';
|
import { httpClient, httpClientFetcher } from '@/services/http/client';
|
||||||
import { BaseApiResponse } from '@/types/api/api-general';
|
import { BaseApiResponse } from '@/types/api/api-general';
|
||||||
import { ProductionResult } from '@/types/api/report/production-result';
|
import { ProductionResult } from '@/types/api/report/production-result';
|
||||||
|
import { BaseProjectFlockKandang } from '@/types/api/production/project-flock-kandang';
|
||||||
// TODO: delete this dummy data
|
|
||||||
const PRODUCTION_RESULT_DUMMY_DATA: BaseApiResponse<ProductionResult[]> = {
|
|
||||||
code: 200,
|
|
||||||
status: 'success',
|
|
||||||
message: 'Get Laporan Hasil Produksi successfully',
|
|
||||||
meta: {
|
|
||||||
page: 1,
|
|
||||||
limit: 1,
|
|
||||||
total_pages: 2,
|
|
||||||
total_results: 2,
|
|
||||||
},
|
|
||||||
data: [
|
|
||||||
{
|
|
||||||
created_user: {
|
|
||||||
id: 1,
|
|
||||||
id_user: 1001,
|
|
||||||
email: 'user@example.com',
|
|
||||||
name: 'John Doe',
|
|
||||||
},
|
|
||||||
project_flock: {
|
|
||||||
id: 1,
|
|
||||||
name: 'PROJECT',
|
|
||||||
category: 'LAYING',
|
|
||||||
kandang: {
|
|
||||||
id: 1,
|
|
||||||
name: 'Cikaum',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
created_at: '2025-01-01T08:00:00Z',
|
|
||||||
updated_at: '2025-01-02T10:30:00Z',
|
|
||||||
|
|
||||||
woa: 25,
|
|
||||||
|
|
||||||
bw: 62.5,
|
|
||||||
std_bw: 60,
|
|
||||||
uniformity: 88,
|
|
||||||
std_uniformity: '90% up',
|
|
||||||
|
|
||||||
dep_kum: 3.2,
|
|
||||||
dep_std: 2.5,
|
|
||||||
|
|
||||||
butiran_utuh: 850,
|
|
||||||
butiran_putih: 50,
|
|
||||||
butiran_retak: 70,
|
|
||||||
butiran_pecah: 30,
|
|
||||||
butiran_jumlah: 1000,
|
|
||||||
total_butir: 1000,
|
|
||||||
|
|
||||||
kg_utuh: 52.3,
|
|
||||||
kg_putih: 3.1,
|
|
||||||
kg_retak: 4.2,
|
|
||||||
kg_pecah: 1.9,
|
|
||||||
kg_jumlah: 61.5,
|
|
||||||
total_kg: 61.5,
|
|
||||||
|
|
||||||
persen_utuh: 85,
|
|
||||||
persen_putih: 5,
|
|
||||||
persen_retak: 7,
|
|
||||||
persen_pecah: 3,
|
|
||||||
|
|
||||||
hd: 92,
|
|
||||||
hd_std: 90,
|
|
||||||
fi: 115,
|
|
||||||
fi_std: 667,
|
|
||||||
em: 85,
|
|
||||||
em_std: 83,
|
|
||||||
ew: 62,
|
|
||||||
ew_std: 60,
|
|
||||||
fcr: 2.1,
|
|
||||||
fcr_std: 2.0,
|
|
||||||
hh: 96,
|
|
||||||
hh_std: 95,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
created_user: {
|
|
||||||
id: 1,
|
|
||||||
id_user: 1001,
|
|
||||||
email: 'user@example.com',
|
|
||||||
name: 'John Doe',
|
|
||||||
},
|
|
||||||
project_flock: {
|
|
||||||
id: 1,
|
|
||||||
name: 'PROJECT',
|
|
||||||
category: 'LAYING',
|
|
||||||
kandang: {
|
|
||||||
id: 1,
|
|
||||||
name: 'Cikaum',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
created_at: '2025-01-01T08:00:00Z',
|
|
||||||
updated_at: '2025-01-02T10:30:00Z',
|
|
||||||
|
|
||||||
woa: 25,
|
|
||||||
|
|
||||||
bw: 62.5,
|
|
||||||
std_bw: 60,
|
|
||||||
uniformity: 88,
|
|
||||||
std_uniformity: '90% up',
|
|
||||||
|
|
||||||
dep_kum: 3.2,
|
|
||||||
dep_std: 2.5,
|
|
||||||
|
|
||||||
butiran_utuh: 850,
|
|
||||||
butiran_putih: 50,
|
|
||||||
butiran_retak: 70,
|
|
||||||
butiran_pecah: 30,
|
|
||||||
butiran_jumlah: 1000,
|
|
||||||
total_butir: 1000,
|
|
||||||
|
|
||||||
kg_utuh: 52.3,
|
|
||||||
kg_putih: 3.1,
|
|
||||||
kg_retak: 4.2,
|
|
||||||
kg_pecah: 1.9,
|
|
||||||
kg_jumlah: 61.5,
|
|
||||||
total_kg: 61.5,
|
|
||||||
|
|
||||||
persen_utuh: 85,
|
|
||||||
persen_putih: 5,
|
|
||||||
persen_retak: 7,
|
|
||||||
persen_pecah: 3,
|
|
||||||
|
|
||||||
hd: 92,
|
|
||||||
hd_std: 90,
|
|
||||||
fi: 115,
|
|
||||||
fi_std: 110,
|
|
||||||
em: 85,
|
|
||||||
em_std: 83,
|
|
||||||
ew: 62,
|
|
||||||
ew_std: 60,
|
|
||||||
fcr: 2.1,
|
|
||||||
fcr_std: 2.0,
|
|
||||||
hh: 96,
|
|
||||||
hh_std: 95,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
export class ProductionResultReportApiService extends BaseApiService<
|
export class ProductionResultReportApiService extends BaseApiService<
|
||||||
ProductionResult,
|
ProductionResult,
|
||||||
@@ -153,14 +20,117 @@ export class ProductionResultReportApiService extends BaseApiService<
|
|||||||
async getAllProductionResultFetcher(
|
async getAllProductionResultFetcher(
|
||||||
endpoint: string
|
endpoint: string
|
||||||
): Promise<BaseApiResponse<ProductionResult[]>> {
|
): Promise<BaseApiResponse<ProductionResult[]>> {
|
||||||
// return await httpClientFetcher<BaseApiResponse<ProductionResult[]>>(
|
return await httpClientFetcher<BaseApiResponse<ProductionResult[]>>(
|
||||||
// endpoint
|
endpoint
|
||||||
// );
|
);
|
||||||
|
}
|
||||||
|
|
||||||
await sleep(1000);
|
async exportProductionResultToExcel(
|
||||||
|
projectFlockKandangs: BaseProjectFlockKandang[] | null
|
||||||
|
) {
|
||||||
|
try {
|
||||||
|
const mappedProductionResults: {
|
||||||
|
projectFlockKandang: BaseProjectFlockKandang;
|
||||||
|
productionResult: ProductionResult[] | null;
|
||||||
|
}[] = [];
|
||||||
|
|
||||||
return PRODUCTION_RESULT_DUMMY_DATA;
|
projectFlockKandangs?.forEach(async (projectFlockKandang) => {
|
||||||
|
const getProductionResultPath = `${this.basePath}/${projectFlockKandang.id}?page=1&limit=99999999`;
|
||||||
|
const getProductionResultRes = await httpClient<
|
||||||
|
BaseApiResponse<ProductionResult[]>
|
||||||
|
>(getProductionResultPath);
|
||||||
|
|
||||||
|
mappedProductionResults.push({
|
||||||
|
projectFlockKandang,
|
||||||
|
productionResult: isResponseSuccess(getProductionResultRes)
|
||||||
|
? getProductionResultRes.data
|
||||||
|
: null,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const rows = mappedProductionResults;
|
||||||
|
if (!rows || rows.length === 0) {
|
||||||
|
toast.error('Tidak ada data untuk diexport.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Group by Project Flock Kandang Name
|
||||||
|
const groupedData: Record<
|
||||||
|
string,
|
||||||
|
Record<string, string | number | undefined>[]
|
||||||
|
> = {};
|
||||||
|
|
||||||
|
rows.forEach((row) => {
|
||||||
|
const kandangName = row.projectFlockKandang.kandang.name || 'Unknown';
|
||||||
|
if (!groupedData[kandangName]) {
|
||||||
|
groupedData[kandangName] = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
row.productionResult?.forEach((productionResult) => {
|
||||||
|
groupedData[kandangName].push({
|
||||||
|
woa: productionResult.woa,
|
||||||
|
bw: productionResult.bw,
|
||||||
|
std_bw: productionResult.std_bw,
|
||||||
|
uniformity: productionResult.uniformity,
|
||||||
|
std_uniformity: productionResult.std_uniformity,
|
||||||
|
dep_kum: productionResult.dep_kum,
|
||||||
|
dep_std: productionResult.dep_std,
|
||||||
|
butiran_utuh: productionResult.butiran_utuh,
|
||||||
|
butiran_putih: productionResult.butiran_putih,
|
||||||
|
butiran_retak: productionResult.butiran_retak,
|
||||||
|
butiran_pecah: productionResult.butiran_pecah,
|
||||||
|
butiran_jumlah: productionResult.butiran_jumlah,
|
||||||
|
total_butir: productionResult.total_butir,
|
||||||
|
kg_utuh: productionResult.kg_utuh,
|
||||||
|
kg_putih: productionResult.kg_putih,
|
||||||
|
kg_retak: productionResult.kg_retak,
|
||||||
|
kg_pecah: productionResult.kg_pecah,
|
||||||
|
kg_jumlah: productionResult.kg_jumlah,
|
||||||
|
total_kg: productionResult.total_kg,
|
||||||
|
persen_utuh: productionResult.persen_utuh,
|
||||||
|
persen_putih: productionResult.persen_putih,
|
||||||
|
persen_retak: productionResult.persen_retak,
|
||||||
|
persen_pecah: productionResult.persen_pecah,
|
||||||
|
hd: productionResult.hd,
|
||||||
|
hd_std: productionResult.hd_std,
|
||||||
|
fi: productionResult.fi,
|
||||||
|
fi_std: productionResult.fi_std,
|
||||||
|
em: productionResult.em,
|
||||||
|
em_std: productionResult.em_std,
|
||||||
|
ew: productionResult.ew,
|
||||||
|
ew_std: productionResult.ew_std,
|
||||||
|
fcr: productionResult.fcr,
|
||||||
|
fcr_std: productionResult.fcr_std,
|
||||||
|
hh: productionResult.hh,
|
||||||
|
hh_std: productionResult.hh_std,
|
||||||
|
project_flock_name: productionResult.project_flock.name,
|
||||||
|
project_flock_category: productionResult.project_flock.category,
|
||||||
|
kandang_name: productionResult.project_flock.kandang.name,
|
||||||
|
created_at: formatDate(productionResult.created_at, 'YYYY-MM-DD'),
|
||||||
|
updated_at: formatDate(productionResult.updated_at, 'YYYY-MM-DD'),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
const wb = XLSX.utils.book_new();
|
||||||
|
|
||||||
|
Object.keys(groupedData).forEach((sheetName) => {
|
||||||
|
const ws = XLSX.utils.json_to_sheet(groupedData[sheetName]);
|
||||||
|
// Sheet names cannot exceed 31 chars
|
||||||
|
const safeSheetName = sheetName.substring(0, 31);
|
||||||
|
XLSX.utils.book_append_sheet(wb, ws, safeSheetName);
|
||||||
|
});
|
||||||
|
|
||||||
|
const productionResultExcelFileName = `laporan-hasil-produksi-${formatDate(Date.now(), 'YYYY-MM-DD')}-${rows[0].projectFlockKandang.project_flock.flock_name}.xlsx`;
|
||||||
|
|
||||||
|
XLSX.writeFile(wb, productionResultExcelFileName);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
toast.error('Gagal melakukan export laporan hasil produksi! Coba lagi.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ProductionResultReportApi = new ProductionResultReportApiService();
|
export const ProductionResultReportApi = new ProductionResultReportApiService(
|
||||||
|
'/reports/production-result'
|
||||||
|
);
|
||||||
|
|||||||
Vendored
+22
-14
@@ -112,34 +112,42 @@ export type ClosingProductionData = {
|
|||||||
final_population: number;
|
final_population: number;
|
||||||
feed_in: number;
|
feed_in: number;
|
||||||
feed_used: number;
|
feed_used: number;
|
||||||
feed_used_per_head: number;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
sales: {
|
sales: {
|
||||||
chicken: {
|
chicken: {
|
||||||
sales_population: number;
|
sales_population: number;
|
||||||
sales_weight: number;
|
sales_weight: number;
|
||||||
average_weight: number;
|
avg_weight: number;
|
||||||
chicken_average_selling_price: number;
|
avg_selling_price: number;
|
||||||
};
|
};
|
||||||
egg?: {
|
egg?: {
|
||||||
egg_pieces: number;
|
egg_pieces: number;
|
||||||
egg_mass_kg: number;
|
egg_mass: number;
|
||||||
average_egg_weight_kg: number;
|
avg_egg_weight: number;
|
||||||
egg_average_selling_price: number;
|
avg_selling_price: number;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
performance: {
|
performance: {
|
||||||
depletion: number;
|
depletion: number;
|
||||||
age_day: number;
|
age_day: number;
|
||||||
mortality_std: number;
|
mor_std: number;
|
||||||
mortality_act: number;
|
mor_act: number;
|
||||||
deff_mortality: number;
|
mor_diff: number;
|
||||||
fcr_std: number;
|
awg_act: number;
|
||||||
|
awg_std: number;
|
||||||
|
feed_intake: number;
|
||||||
|
feed_intake_std: number;
|
||||||
fcr_act: number;
|
fcr_act: number;
|
||||||
deff_fcr: number;
|
fcr_std: number;
|
||||||
awg: number;
|
fcr_diff: number;
|
||||||
|
hen_day_act?: number;
|
||||||
|
hen_day_std?: number;
|
||||||
|
egg_mass?: number;
|
||||||
|
egg_mass_std?: number;
|
||||||
|
egg_weight?: number;
|
||||||
|
egg_weight_std?: number;
|
||||||
|
hen_housed_act?: number;
|
||||||
|
hen_housed_std?: number;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user