diff --git a/src/components/CreateProject/CreateProject.tsx b/src/components/CreateProject/CreateProject.tsx index 1842f9a..a7ada1b 100644 --- a/src/components/CreateProject/CreateProject.tsx +++ b/src/components/CreateProject/CreateProject.tsx @@ -533,6 +533,7 @@ const CreateProject: React.FC = ({ const expectedProjectFee = formProps.watch("expectedProjectFee"); const ratePerManhour = formProps.watch("ratePerManhour"); const totalManhour = formProps.watch("totalManhour"); + const subContractFee = formProps.watch("subContractFee"); const firstLoadedRef = useRef(false); useEffect(() => { if ( @@ -542,12 +543,12 @@ const CreateProject: React.FC = ({ ) { formProps.setValue( "totalManhour", - Math.ceil(expectedProjectFee / ratePerManhour), + Math.ceil((expectedProjectFee - (subContractFee ?? 0)) / ratePerManhour), ); } else { firstLoadedRef.current = true; } - }, [expectedProjectFee, ratePerManhour]); + }, [expectedProjectFee, subContractFee, ratePerManhour]); useEffect(() => { if ( @@ -557,7 +558,7 @@ const CreateProject: React.FC = ({ ) { formProps.setValue( "totalManhour", - Math.ceil(expectedProjectFee / ratePerManhour), + Math.ceil((expectedProjectFee - (subContractFee ?? 0)) / ratePerManhour), ); } }, [totalManhour]); diff --git a/src/components/Report/FinancialStatusReportGen/FinancialStatusReportGen.tsx b/src/components/Report/FinancialStatusReportGen/FinancialStatusReportGen.tsx index ce58748..7deecc8 100644 --- a/src/components/Report/FinancialStatusReportGen/FinancialStatusReportGen.tsx +++ b/src/components/Report/FinancialStatusReportGen/FinancialStatusReportGen.tsx @@ -58,8 +58,8 @@ const GenFinancialStatusReport: React.FC & SubComponents = ({ projects, t setLoading(true) let postData = { teamLeadId: -1, - startMonth: "1970-01-01", - endMonth: dayjs().format("YYYY-MM-DD").toString() + startMonth: "1970-01", + endMonth: dayjs().format("YYYY-MM").toString() } if(query.targetDate){ postData.startMonth = query.targetDate