import React from 'react'; import { Card, CardContent, CardHeader, CardTitle, CardDescription } from '@/Components/ui/card'; import { Button } from '@/Components/ui/button'; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@/Components/ui/table'; import { FileSpreadsheet, FileDown, AlertTriangle, ChevronLeft, ChevronRight } from 'lucide-react'; import { ProjectWizardData } from '../../../types/project-wizard'; interface Step6EstimationProps { project: ProjectWizardData; isUnprofitableEst: boolean; calculatedMaterialsCost: number; calculatedLaborCost: number; calculatedEquipmentCost: number; totalEstimatedCost: number; grossMarginVal: number; grossMarginPct: number; contractValueNum: number; formatCurrency: (v: string | number) => string; handleBack: () => void; onNext: () => void; } export default function Step6Estimation({ project, isUnprofitableEst, calculatedMaterialsCost, calculatedLaborCost, calculatedEquipmentCost, totalEstimatedCost, grossMarginVal, grossMarginPct, contractValueNum, formatCurrency, handleBack, onNext }: Step6EstimationProps) { return (
Step 6: Financial Estimation Margin Summary Review total projected costs, contract margins, and flag checks before locking for approval.
{/* Gross Margin Health Banner */} {isUnprofitableEst && (

Special Handle: Profit Margin Risk / Overrun Warn

This project's estimated costs exceed its contract value, resulting in a negative projected margin. The unprofitable warning will flag this project in procurement logs and approval cycles.

)}
Contract Value

{formatCurrency(project.contract_value)}

Total Est. Cost

{formatCurrency(totalEstimatedCost)}

Projected Margin

= 0 ? 'text-emerald-700' : 'text-rose-600'}`}> {formatCurrency(grossMarginVal)}

Margin %

= 0 ? 'text-emerald-700' : 'text-rose-600'}`}> {grossMarginPct.toFixed(2)}%

{/* Itemized Breakdown Card */} Itemized Cost Breakdown Cost Center Estimated Cost % of Contract Materials Cost (Step 3) {formatCurrency(calculatedMaterialsCost)} {contractValueNum > 0 ? ((calculatedMaterialsCost / contractValueNum) * 100).toFixed(1) : 0}% Labor Manpower Cost (Step 4) {formatCurrency(calculatedLaborCost)} {contractValueNum > 0 ? ((calculatedLaborCost / contractValueNum) * 100).toFixed(1) : 0}% Equipment Machinery Cost (Step 5) {formatCurrency(calculatedEquipmentCost)} {contractValueNum > 0 ? ((calculatedEquipmentCost / contractValueNum) * 100).toFixed(1) : 0}% Total Summed Estimation {formatCurrency(totalEstimatedCost)} {contractValueNum > 0 ? ((totalEstimatedCost / contractValueNum) * 100).toFixed(1) : 0}%
); }