mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-22 14:25:47 +00:00
refactor(FE): Use egg production as remaining columns
This commit is contained in:
@@ -234,12 +234,6 @@ const createPDFDocument = (
|
||||
<View style={[pdfStyles.tableCellHeaderRight, { flex: 1.2 }]}>
|
||||
<Text>Rata-Rata Bobot (Kg)</Text>
|
||||
</View>
|
||||
<View style={[pdfStyles.tableCellHeaderRight, { flex: 1 }]}>
|
||||
<Text>Produksi Telur (Butir)</Text>
|
||||
</View>
|
||||
<View style={[pdfStyles.tableCellHeaderRight, { flex: 1 }]}>
|
||||
<Text>Produksi Telur (Kg)</Text>
|
||||
</View>
|
||||
<View style={[pdfStyles.tableCellHeader, { flex: 1.5 }]}>
|
||||
<Text>Feed (Supplier)</Text>
|
||||
</View>
|
||||
@@ -249,12 +243,6 @@ const createPDFDocument = (
|
||||
<View style={[pdfStyles.tableCellHeaderRight, { flex: 1.2 }]}>
|
||||
<Text>Rata-Rata Harga DOC</Text>
|
||||
</View>
|
||||
<View style={[pdfStyles.tableCellHeaderRight, { flex: 1.2 }]}>
|
||||
<Text>Nilai Nominal Telur</Text>
|
||||
</View>
|
||||
<View style={[pdfStyles.tableCellHeaderRight, { flex: 1 }]}>
|
||||
<Text>HPP Telur</Text>
|
||||
</View>
|
||||
<View style={[pdfStyles.tableCellHeaderRight, { flex: 1.2 }]}>
|
||||
<Text>HPP Telur (RP/KG)</Text>
|
||||
</View>
|
||||
@@ -278,23 +266,15 @@ const createPDFDocument = (
|
||||
<View style={[pdfStyles.tableCellCenter, { flex: 1.2 }]}>
|
||||
<Text>{group.label}</Text>
|
||||
</View>
|
||||
<View style={[pdfStyles.tableCellRight, { flex: 1 }]}>
|
||||
<Text>{formatNumber(group.remaining_chicken_birds)}</Text>
|
||||
</View>
|
||||
<View style={[pdfStyles.tableCellRight, { flex: 1 }]}>
|
||||
<Text>
|
||||
{formatNumber(group.remaining_chicken_weight_kg)}
|
||||
</Text>
|
||||
</View>
|
||||
<View style={[pdfStyles.tableCellRight, { flex: 1.2 }]}>
|
||||
<Text>{formatNumber(group.avg_weight_kg)}</Text>
|
||||
</View>
|
||||
<View style={[pdfStyles.tableCellRight, { flex: 1 }]}>
|
||||
<Text>{formatNumber(group.egg_production_pieces)}</Text>
|
||||
</View>
|
||||
<View style={[pdfStyles.tableCellRight, { flex: 1 }]}>
|
||||
<Text>{formatNumber(group.egg_production_kg)}</Text>
|
||||
</View>
|
||||
<View style={[pdfStyles.tableCellRight, { flex: 1.2 }]}>
|
||||
<Text>{formatNumber(group.avg_weight_kg)}</Text>
|
||||
</View>
|
||||
<View style={[pdfStyles.tableCell, { flex: 1.5 }]}>
|
||||
<Text>
|
||||
{group.feed_suppliers
|
||||
@@ -318,17 +298,11 @@ const createPDFDocument = (
|
||||
<View style={[pdfStyles.tableCellRight, { flex: 1.2 }]}>
|
||||
<Text>{formatCurrency(group.average_doc_price_rp)}</Text>
|
||||
</View>
|
||||
<View style={[pdfStyles.tableCellRight, { flex: 1.2 }]}>
|
||||
<Text>{formatCurrency(group.egg_value_rp)}</Text>
|
||||
</View>
|
||||
<View style={[pdfStyles.tableCellRight, { flex: 1 }]}>
|
||||
<Text>{formatCurrency(group.hpp_rp)}</Text>
|
||||
</View>
|
||||
<View style={[pdfStyles.tableCellRight, { flex: 1.2 }]}>
|
||||
<Text>{formatCurrency(group.egg_hpp_rp_per_kg)}</Text>
|
||||
</View>
|
||||
<View style={[pdfStyles.tableCellRight, { flex: 1.2 }]}>
|
||||
<Text>{formatCurrency(group.remaining_value_rp)}</Text>
|
||||
<Text>{formatCurrency(group.egg_value_rp)}</Text>
|
||||
</View>
|
||||
</View>
|
||||
)
|
||||
@@ -361,12 +335,6 @@ const createPDFDocument = (
|
||||
<View style={[pdfStyles.tableCellHeaderRight, { flex: 0.8 }]}>
|
||||
<Text>Sisa Kg (Telur)</Text>
|
||||
</View>
|
||||
<View style={[pdfStyles.tableCellHeaderRight, { flex: 0.8 }]}>
|
||||
<Text>Produksi Telur (Butir)</Text>
|
||||
</View>
|
||||
<View style={[pdfStyles.tableCellHeaderRight, { flex: 0.8 }]}>
|
||||
<Text>Produksi Telur (Kg)</Text>
|
||||
</View>
|
||||
<View style={[pdfStyles.tableCellHeader, { flex: 1.2 }]}>
|
||||
<Text>Feed (Supplier)</Text>
|
||||
</View>
|
||||
@@ -376,12 +344,6 @@ const createPDFDocument = (
|
||||
<View style={[pdfStyles.tableCellHeaderRight, { flex: 1.2 }]}>
|
||||
<Text>Rata-Rata Harga DOC</Text>
|
||||
</View>
|
||||
<View style={[pdfStyles.tableCellHeaderRight, { flex: 1.2 }]}>
|
||||
<Text>Nilai Nominal Telur</Text>
|
||||
</View>
|
||||
<View style={[pdfStyles.tableCellHeaderRight, { flex: 0.8 }]}>
|
||||
<Text>HPP Telur</Text>
|
||||
</View>
|
||||
<View style={[pdfStyles.tableCellHeaderRight, { flex: 1 }]}>
|
||||
<Text>HPP Telur (RP/KG)</Text>
|
||||
</View>
|
||||
@@ -416,12 +378,6 @@ const createPDFDocument = (
|
||||
<View style={[pdfStyles.tableCellRight, { flex: 1 }]}>
|
||||
<Text>{formatNumber(item.avg_weight_kg)}</Text>
|
||||
</View>
|
||||
<View style={[pdfStyles.tableCellRight, { flex: 0.8 }]}>
|
||||
<Text>{formatNumber(item.remaining_chicken_birds)}</Text>
|
||||
</View>
|
||||
<View style={[pdfStyles.tableCellRight, { flex: 0.8 }]}>
|
||||
<Text>{formatNumber(item.remaining_chicken_weight_kg)}</Text>
|
||||
</View>
|
||||
<View style={[pdfStyles.tableCellRight, { flex: 0.8 }]}>
|
||||
<Text>{formatNumber(item.egg_production_pieces)}</Text>
|
||||
</View>
|
||||
@@ -451,17 +407,11 @@ const createPDFDocument = (
|
||||
<View style={[pdfStyles.tableCellRight, { flex: 1.2 }]}>
|
||||
<Text>{formatCurrency(item.average_doc_price_rp)}</Text>
|
||||
</View>
|
||||
<View style={[pdfStyles.tableCellRight, { flex: 1.2 }]}>
|
||||
<Text>{formatCurrency(item.egg_value_rp)}</Text>
|
||||
</View>
|
||||
<View style={[pdfStyles.tableCellRight, { flex: 0.8 }]}>
|
||||
<Text>{formatCurrency(item.hpp_rp)}</Text>
|
||||
</View>
|
||||
<View style={[pdfStyles.tableCellRight, { flex: 1 }]}>
|
||||
<Text>{formatCurrency(item.egg_hpp_rp_per_kg)}</Text>
|
||||
</View>
|
||||
<View style={[pdfStyles.tableCellRight, { flex: 1.2 }]}>
|
||||
<Text>{formatCurrency(item.remaining_value_rp)}</Text>
|
||||
<Text>{formatCurrency(item.egg_value_rp)}</Text>
|
||||
</View>
|
||||
</View>
|
||||
))}
|
||||
|
||||
@@ -335,10 +335,8 @@ const HppPerKandangTab = () => {
|
||||
? `${formatNumber(item.weight_range.weight_min)} - ${formatNumber(item.weight_range.weight_max)}`
|
||||
: '',
|
||||
'Rata-Rata Bobot (KG)': item.avg_weight_kg || 0,
|
||||
'Sisa Telur (Butir)': item.remaining_chicken_birds || 0,
|
||||
'Sisa Telur (KG)': item.remaining_chicken_weight_kg || 0,
|
||||
'Produksi Telur (Butir)': item.egg_production_pieces || 0,
|
||||
'Produksi Telur (KG)': item.egg_production_kg || 0,
|
||||
'Sisa Telur (Butir)': item.egg_production_pieces || 0,
|
||||
'Sisa Telur (KG)': item.egg_production_kg || 0,
|
||||
'Feed (Supplier)':
|
||||
item.feed_suppliers
|
||||
?.map((s: { alias?: string; name: string }) => s.alias || s.name)
|
||||
@@ -348,10 +346,8 @@ const HppPerKandangTab = () => {
|
||||
?.map((s: { alias?: string; name: string }) => s.alias || s.name)
|
||||
.join(' | ') || '',
|
||||
'Rata-Rata Harga DOC (RP)': item.average_doc_price_rp || 0,
|
||||
'Nilai Nominal Telur (RP)': item.egg_value_rp || 0,
|
||||
'HPP Telur (RP)': item.hpp_rp || 0,
|
||||
'HPP Telur (RP/KG)': item.egg_hpp_rp_per_kg || 0,
|
||||
'Nilai Nominal Sisa Telur (RP)': item.remaining_value_rp || 0,
|
||||
'Nilai Nominal Sisa Telur (RP)': item.egg_value_rp || 0,
|
||||
})
|
||||
);
|
||||
|
||||
@@ -360,20 +356,14 @@ const HppPerKandangTab = () => {
|
||||
Kandang: 'ALL',
|
||||
'Rentang Bobot': '-',
|
||||
'Rata-Rata Bobot (KG)': summaryTotal?.average_weight_kg || 0,
|
||||
'Sisa Telur (Butir)': summaryTotal?.total_remaining_chicken_birds || 0,
|
||||
'Sisa Telur (KG)': summaryTotal?.total_remaining_chicken_weight_kg || 0,
|
||||
'Produksi Telur (Butir)':
|
||||
summaryTotal?.total_egg_production_pieces || 0,
|
||||
'Produksi Telur (KG)': summaryTotal?.total_egg_production_kg || 0,
|
||||
'Sisa Telur (Butir)': summaryTotal?.total_egg_production_pieces || 0,
|
||||
'Sisa Telur (KG)': summaryTotal?.total_egg_production_kg || 0,
|
||||
'Feed (Supplier)': allFeedSuppliers,
|
||||
'DOC (Supplier)': allDocSuppliers,
|
||||
'Rata-Rata Harga DOC (RP)':
|
||||
summaryTotal?.total_average_doc_price_rp || 0,
|
||||
'Nilai Nominal Telur (RP)': summaryTotal?.total_egg_value_rp || 0,
|
||||
'HPP Telur (RP)': summaryTotal?.total_hpp_rp || 0,
|
||||
'HPP Telur (RP/KG)': summaryTotal?.average_egg_hpp_rp_per_kg || 0,
|
||||
'Nilai Nominal Sisa Telur (RP)':
|
||||
summaryTotal?.total_remaining_value_rp || 0,
|
||||
'Nilai Nominal Sisa Telur (RP)': summaryTotal?.total_egg_value_rp || 0,
|
||||
});
|
||||
|
||||
const worksheet = XLSX.utils.json_to_sheet(excelData);
|
||||
@@ -385,13 +375,9 @@ const HppPerKandangTab = () => {
|
||||
{ wch: 18 }, // Rata-Rata Bobot (KG)
|
||||
{ wch: 15 }, // Sisa Telur (Butir)
|
||||
{ wch: 15 }, // Sisa Telur (KG)
|
||||
{ wch: 18 }, // Produksi Telur (Butir)
|
||||
{ wch: 18 }, // Produksi Telur (KG)
|
||||
{ wch: 20 }, // Feed (Supplier)
|
||||
{ wch: 20 }, // DOC (Supplier)
|
||||
{ wch: 20 }, // Rata-Rata Harga DOC (RP)
|
||||
{ wch: 20 }, // Nilai Nominal Telur (RP)
|
||||
{ wch: 15 }, // HPP Telur (RP)
|
||||
{ wch: 18 }, // HPP Telur (RP/KG)
|
||||
{ wch: 25 }, // Nilai Nominal Sisa Telur (RP)
|
||||
];
|
||||
@@ -533,37 +519,9 @@ const HppPerKandangTab = () => {
|
||||
</div>
|
||||
),
|
||||
},
|
||||
{
|
||||
id: 'remaining_chicken_birds',
|
||||
header: 'Sisa Telur (Butir)',
|
||||
accessorKey: 'remaining_chicken_birds',
|
||||
cell: (props) => {
|
||||
const value = props.row.original.remaining_chicken_birds;
|
||||
return <div className='text-right'>{formatNumber(value)}</div>;
|
||||
},
|
||||
footer: () => (
|
||||
<div className='text-right font-semibold text-gray-900'>
|
||||
{formatNumber(summaryTotal?.total_remaining_chicken_birds || 0)}
|
||||
</div>
|
||||
),
|
||||
},
|
||||
{
|
||||
id: 'remaining_chicken_weight_kg',
|
||||
header: 'Sisa Telur (KG)',
|
||||
accessorKey: 'remaining_chicken_weight_kg',
|
||||
cell: (props) => {
|
||||
const value = props.row.original.remaining_chicken_weight_kg;
|
||||
return <div className='text-right'>{formatNumber(value)}</div>;
|
||||
},
|
||||
footer: () => (
|
||||
<div className='text-right font-semibold text-gray-900'>
|
||||
{formatNumber(summaryTotal?.total_remaining_chicken_weight_kg || 0)}
|
||||
</div>
|
||||
),
|
||||
},
|
||||
{
|
||||
id: 'egg_production_pieces',
|
||||
header: 'Produksi Telur (Butir)',
|
||||
header: 'Sisa Telur (Butir)',
|
||||
accessorKey: 'egg_production_pieces',
|
||||
cell: (props) => {
|
||||
const value = props.row.original.egg_production_pieces;
|
||||
@@ -577,7 +535,7 @@ const HppPerKandangTab = () => {
|
||||
},
|
||||
{
|
||||
id: 'egg_production_kg',
|
||||
header: 'Produksi Telur (KG)',
|
||||
header: 'Sisa Telur (KG)',
|
||||
accessorKey: 'egg_production_kg',
|
||||
cell: (props) => {
|
||||
const value = props.row.original.egg_production_kg;
|
||||
@@ -585,7 +543,7 @@ const HppPerKandangTab = () => {
|
||||
},
|
||||
footer: () => (
|
||||
<div className='text-right font-semibold text-gray-900'>
|
||||
{formatNumber(summaryTotal?.total_remaining_chicken_weight_kg || 0)}
|
||||
{formatNumber(summaryTotal?.total_egg_production_kg || 0)}
|
||||
</div>
|
||||
),
|
||||
},
|
||||
@@ -639,34 +597,6 @@ const HppPerKandangTab = () => {
|
||||
</div>
|
||||
),
|
||||
},
|
||||
{
|
||||
id: 'egg_value_rp',
|
||||
header: 'Nilai Nominal Telur (RP)',
|
||||
accessorKey: 'egg_value_rp',
|
||||
cell: (props) => {
|
||||
const value = props.row.original.egg_value_rp;
|
||||
return <div className='text-right'>{formatCurrency(value)}</div>;
|
||||
},
|
||||
footer: () => (
|
||||
<div className='text-right font-semibold text-gray-900'>
|
||||
{formatCurrency(summaryTotal?.total_egg_value_rp || 0)}
|
||||
</div>
|
||||
),
|
||||
},
|
||||
{
|
||||
id: 'hpp_rp',
|
||||
header: 'HPP Telur (RP)',
|
||||
accessorKey: 'hpp_rp',
|
||||
cell: (props) => {
|
||||
const value = props.row.original.hpp_rp;
|
||||
return <div className='text-right'>{formatCurrency(value)}</div>;
|
||||
},
|
||||
footer: () => (
|
||||
<div className='text-right font-semibold text-gray-900'>
|
||||
{formatCurrency(summaryTotal?.total_hpp_rp || 0)}
|
||||
</div>
|
||||
),
|
||||
},
|
||||
{
|
||||
id: 'egg_hpp_rp_per_kg',
|
||||
header: 'HPP Telur (RP/KG)',
|
||||
@@ -682,16 +612,16 @@ const HppPerKandangTab = () => {
|
||||
),
|
||||
},
|
||||
{
|
||||
id: 'remaining_value_rp',
|
||||
id: 'egg_value_rp',
|
||||
header: 'Nilai Nominal Sisa Telur (RP)',
|
||||
accessorKey: 'remaining_value_rp',
|
||||
accessorKey: 'egg_value_rp',
|
||||
cell: (props) => {
|
||||
const value = props.row.original.remaining_value_rp;
|
||||
const value = props.row.original.egg_value_rp;
|
||||
return <div className='text-right'>{formatCurrency(value)}</div>;
|
||||
},
|
||||
footer: () => (
|
||||
<div className='text-right font-semibold text-gray-900'>
|
||||
{formatCurrency(summaryTotal?.total_remaining_value_rp || 0)}
|
||||
{formatCurrency(summaryTotal?.total_egg_value_rp || 0)}
|
||||
</div>
|
||||
),
|
||||
},
|
||||
@@ -725,7 +655,7 @@ const HppPerKandangTab = () => {
|
||||
key={'rekapitulasi-row'}
|
||||
>
|
||||
<td
|
||||
colSpan={15}
|
||||
colSpan={11}
|
||||
className='px-4 py-3 text-gray-900 text-center font-semibold'
|
||||
>
|
||||
Rekapitulasi per rentang bobot
|
||||
@@ -747,12 +677,6 @@ const HppPerKandangTab = () => {
|
||||
<td className='text-right'>
|
||||
{formatNumber(item.avg_weight_kg)}
|
||||
</td>
|
||||
<td className='text-right'>
|
||||
{formatNumber(item.remaining_chicken_birds)}
|
||||
</td>
|
||||
<td className='text-right'>
|
||||
{formatNumber(item.remaining_chicken_weight_kg)}
|
||||
</td>
|
||||
<td className='text-right'>
|
||||
{formatNumber(item.egg_production_pieces)}
|
||||
</td>
|
||||
@@ -772,15 +696,11 @@ const HppPerKandangTab = () => {
|
||||
<td className='text-right'>
|
||||
{formatCurrency(item.average_doc_price_rp)}
|
||||
</td>
|
||||
<td className='text-right'>
|
||||
{formatCurrency(item.egg_value_rp)}
|
||||
</td>
|
||||
<td className='text-right'>{formatCurrency(item.hpp_rp)}</td>
|
||||
<td className='text-right'>
|
||||
{formatCurrency(item.egg_hpp_rp_per_kg)}
|
||||
</td>
|
||||
<td className='text-right'>
|
||||
{formatCurrency(item.remaining_value_rp)}
|
||||
{formatCurrency(item.egg_value_rp)}
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
|
||||
-12
@@ -9,8 +9,6 @@ export type HppPerKandangRow = {
|
||||
weight_min: number;
|
||||
weight_max: number;
|
||||
};
|
||||
remaining_chicken_birds: number;
|
||||
remaining_chicken_weight_kg: number;
|
||||
avg_weight_kg: number;
|
||||
egg_production_pieces: number;
|
||||
egg_production_kg: number;
|
||||
@@ -19,20 +17,14 @@ export type HppPerKandangRow = {
|
||||
feed_suppliers: Supplier[];
|
||||
doc_suppliers: Supplier[];
|
||||
average_doc_price_rp: number;
|
||||
hpp_rp: number;
|
||||
remaining_value_rp: number;
|
||||
};
|
||||
|
||||
export type HppPerKandangSummaryTotal = {
|
||||
total_remaining_chicken_birds: number;
|
||||
total_remaining_chicken_weight_kg: number;
|
||||
average_weight_kg: number;
|
||||
total_remaining_value_rp: number;
|
||||
total_egg_production_pieces: number;
|
||||
total_egg_production_kg: number;
|
||||
average_egg_hpp_rp_per_kg: number;
|
||||
total_egg_value_rp: number;
|
||||
total_hpp_rp: number;
|
||||
total_average_doc_price_rp: number;
|
||||
};
|
||||
|
||||
@@ -43,8 +35,6 @@ export type HppPerKandangPerWeightRange = {
|
||||
weight_max: number;
|
||||
};
|
||||
label: string;
|
||||
remaining_chicken_birds: number;
|
||||
remaining_chicken_weight_kg: number;
|
||||
avg_weight_kg: number;
|
||||
egg_production_pieces: number;
|
||||
egg_production_kg: number;
|
||||
@@ -53,8 +43,6 @@ export type HppPerKandangPerWeightRange = {
|
||||
feed_suppliers: Supplier[];
|
||||
doc_suppliers: Supplier[];
|
||||
average_doc_price_rp: number;
|
||||
hpp_rp: number;
|
||||
remaining_value_rp: number;
|
||||
};
|
||||
|
||||
export type HppPerKandangSummary = {
|
||||
|
||||
Reference in New Issue
Block a user