mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-25 07:45:47 +00:00
chore: add total props in DailyMarketingReportPDFProps and adjust data type
This commit is contained in:
@@ -9,11 +9,15 @@ import {
|
|||||||
View,
|
View,
|
||||||
} from '@react-pdf/renderer';
|
} from '@react-pdf/renderer';
|
||||||
|
|
||||||
import { DailyMarketingReport } from '@/types/api/report/marketing';
|
import {
|
||||||
|
DailyMarketingReport,
|
||||||
|
SalesSummary,
|
||||||
|
} from '@/types/api/report/marketing';
|
||||||
import { formatCurrency, formatDate, formatNumber } from '@/lib/helper';
|
import { formatCurrency, formatDate, formatNumber } from '@/lib/helper';
|
||||||
|
|
||||||
interface DailyMarketingReportPDFProps {
|
interface DailyMarketingReportPDFProps {
|
||||||
data?: DailyMarketingReport;
|
data?: DailyMarketingReport;
|
||||||
|
total?: SalesSummary;
|
||||||
}
|
}
|
||||||
|
|
||||||
const DailyMarketingReportPDFStyle = StyleSheet.create({
|
const DailyMarketingReportPDFStyle = StyleSheet.create({
|
||||||
@@ -267,9 +271,12 @@ const DailyMarketingReportPDFStyle = StyleSheet.create({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const DailyMarketingReportPDF = ({ data }: DailyMarketingReportPDFProps) => {
|
const DailyMarketingReportPDF = ({
|
||||||
const rows = data?.rows || [];
|
data,
|
||||||
const summary = data?.summary;
|
total,
|
||||||
|
}: DailyMarketingReportPDFProps) => {
|
||||||
|
const rows = data || [];
|
||||||
|
const summary = total;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Document>
|
<Document>
|
||||||
@@ -409,7 +416,7 @@ const DailyMarketingReportPDF = ({ data }: DailyMarketingReportPDFProps) => {
|
|||||||
</View>
|
</View>
|
||||||
<View style={DailyMarketingReportPDFStyle.colDoDate}>
|
<View style={DailyMarketingReportPDFStyle.colDoDate}>
|
||||||
<Text style={DailyMarketingReportPDFStyle.cellText}>
|
<Text style={DailyMarketingReportPDFStyle.cellText}>
|
||||||
{formatDate(row.do_date, 'DD/MM/YYYY')}
|
{formatDate(row.realization_date, 'DD/MM/YYYY')}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={DailyMarketingReportPDFStyle.colAging}>
|
<View style={DailyMarketingReportPDFStyle.colAging}>
|
||||||
@@ -429,7 +436,7 @@ const DailyMarketingReportPDF = ({ data }: DailyMarketingReportPDFProps) => {
|
|||||||
</View>
|
</View>
|
||||||
<View style={DailyMarketingReportPDFStyle.colSales}>
|
<View style={DailyMarketingReportPDFStyle.colSales}>
|
||||||
<Text style={DailyMarketingReportPDFStyle.cellText}>
|
<Text style={DailyMarketingReportPDFStyle.cellText}>
|
||||||
{row.sales}
|
{row.sales.name}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
<View style={DailyMarketingReportPDFStyle.colProduct}>
|
<View style={DailyMarketingReportPDFStyle.colProduct}>
|
||||||
@@ -518,6 +525,19 @@ const DailyMarketingReportPDF = ({ data }: DailyMarketingReportPDFProps) => {
|
|||||||
{formatCurrency(summary?.total_sales_amount ?? 0)}
|
{formatCurrency(summary?.total_sales_amount ?? 0)}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
|
<View
|
||||||
|
style={[
|
||||||
|
DailyMarketingReportPDFStyle.summaryRow,
|
||||||
|
{ borderBottomWidth: 0 },
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Text style={DailyMarketingReportPDFStyle.summaryLabel}>
|
||||||
|
Total HPP Per KG:
|
||||||
|
</Text>
|
||||||
|
<Text style={DailyMarketingReportPDFStyle.summaryValue}>
|
||||||
|
{formatCurrency(summary?.total_hpp_price_per_kg ?? 0)}
|
||||||
|
</Text>
|
||||||
|
</View>
|
||||||
<View
|
<View
|
||||||
style={[
|
style={[
|
||||||
DailyMarketingReportPDFStyle.summaryRow,
|
DailyMarketingReportPDFStyle.summaryRow,
|
||||||
|
|||||||
Reference in New Issue
Block a user