mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-26 00:05:45 +00:00
feat(FE): Add TOTAL row to HppPerkandang PDF export
This commit is contained in:
@@ -356,12 +356,7 @@ const createPDFDocument = (
|
|||||||
{data.rows.map((item: HppPerKandangRow, index: number) => (
|
{data.rows.map((item: HppPerKandangRow, index: number) => (
|
||||||
<View
|
<View
|
||||||
key={index}
|
key={index}
|
||||||
style={[
|
style={[pdfStyles.tableRow, pdfStyles.tableBorderBottom]}
|
||||||
pdfStyles.tableRow,
|
|
||||||
index < data.rows.length - 1
|
|
||||||
? pdfStyles.tableBorderBottom
|
|
||||||
: {},
|
|
||||||
]}
|
|
||||||
>
|
>
|
||||||
<View style={[pdfStyles.tableCellCenter, { flex: 0.5 }]}>
|
<View style={[pdfStyles.tableCellCenter, { flex: 0.5 }]}>
|
||||||
<Text>{index + 1}</Text>
|
<Text>{index + 1}</Text>
|
||||||
@@ -415,6 +410,138 @@ const createPDFDocument = (
|
|||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
))}
|
))}
|
||||||
|
|
||||||
|
{/* TOTAL Row */}
|
||||||
|
{data.summary?.total && (
|
||||||
|
<View style={pdfStyles.tableRow}>
|
||||||
|
<View
|
||||||
|
style={[
|
||||||
|
pdfStyles.tableCellHeader,
|
||||||
|
{ flex: 0.5, backgroundColor: '#F5F5F5' },
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Text>TOTAL</Text>
|
||||||
|
</View>
|
||||||
|
<View
|
||||||
|
style={[
|
||||||
|
pdfStyles.tableCellHeader,
|
||||||
|
{ flex: 1.5, backgroundColor: '#F5F5F5' },
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Text>ALL</Text>
|
||||||
|
</View>
|
||||||
|
<View
|
||||||
|
style={[
|
||||||
|
pdfStyles.tableCellHeader,
|
||||||
|
{ flex: 1, backgroundColor: '#F5F5F5' },
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Text>-</Text>
|
||||||
|
</View>
|
||||||
|
<View
|
||||||
|
style={[
|
||||||
|
pdfStyles.tableCellHeaderRight,
|
||||||
|
{ flex: 1, backgroundColor: '#F5F5F5' },
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Text>
|
||||||
|
{formatNumber(data.summary.total.average_weight_kg)}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
<View
|
||||||
|
style={[
|
||||||
|
pdfStyles.tableCellHeaderRight,
|
||||||
|
{ flex: 0.8, backgroundColor: '#F5F5F5' },
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Text>
|
||||||
|
{formatNumber(
|
||||||
|
data.summary.total.total_egg_production_pieces
|
||||||
|
)}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
<View
|
||||||
|
style={[
|
||||||
|
pdfStyles.tableCellHeaderRight,
|
||||||
|
{ flex: 0.8, backgroundColor: '#F5F5F5' },
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Text>
|
||||||
|
{formatNumber(data.summary.total.total_egg_production_kg)}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
<View
|
||||||
|
style={[
|
||||||
|
pdfStyles.tableCellHeader,
|
||||||
|
{ flex: 1.2, backgroundColor: '#F5F5F5' },
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Text>
|
||||||
|
{data.rows
|
||||||
|
.flatMap((row: HppPerKandangRow) =>
|
||||||
|
row.feed_suppliers?.map(
|
||||||
|
(s: { alias?: string; name: string }) =>
|
||||||
|
s.alias || s.name
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.filter((v: string, i: number, a: string[]) => a.indexOf(v) === i)
|
||||||
|
.join(' | ') || '-'}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
<View
|
||||||
|
style={[
|
||||||
|
pdfStyles.tableCellHeader,
|
||||||
|
{ flex: 1, backgroundColor: '#F5F5F5' },
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Text>
|
||||||
|
{data.rows
|
||||||
|
.flatMap((row: HppPerKandangRow) =>
|
||||||
|
row.doc_suppliers?.map(
|
||||||
|
(s: { alias?: string; name: string }) =>
|
||||||
|
s.alias || s.name
|
||||||
|
)
|
||||||
|
)
|
||||||
|
.filter((v: string, i: number, a: string[]) => a.indexOf(v) === i)
|
||||||
|
.join(' | ') || '-'}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
<View
|
||||||
|
style={[
|
||||||
|
pdfStyles.tableCellHeaderRight,
|
||||||
|
{ flex: 1.2, backgroundColor: '#F5F5F5' },
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Text>
|
||||||
|
{formatCurrency(
|
||||||
|
data.summary.total.total_average_doc_price_rp
|
||||||
|
)}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
<View
|
||||||
|
style={[
|
||||||
|
pdfStyles.tableCellHeaderRight,
|
||||||
|
{ flex: 1, backgroundColor: '#F5F5F5' },
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Text>
|
||||||
|
{formatCurrency(
|
||||||
|
data.summary.total.average_egg_hpp_rp_per_kg
|
||||||
|
)}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
<View
|
||||||
|
style={[
|
||||||
|
pdfStyles.tableCellHeaderRight,
|
||||||
|
{ flex: 1.2, backgroundColor: '#F5F5F5' },
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Text>
|
||||||
|
{formatCurrency(data.summary.total.total_egg_value_rp)}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
|
</View>
|
||||||
|
)}
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</Page>
|
</Page>
|
||||||
|
|||||||
Reference in New Issue
Block a user