/** * Budget Report Sections are included here as functions. This * prevents repeated calls for the same import statements and * reduces the number of files in the directory. * * * IMPORTANT: All functions that return data, such as and * * must have   prior to and after, since * *   fails to print a space whenreturned from * * atoms/CommonFormats. * */ import { Document, Page, StyleSheet, Text, View, Image } from '@react-pdf/renderer'; import React from 'react'; import { TBudgetPDF, TBudgetResponse, TResponseCoverPage } from '../../../../types/api'; import { PdfCash, PdfPercent } from '../../../atoms'; import ReportHeader from '../../../atoms/Pdf/ReportHeader'; import UserInfo from '../../../atoms/Pdf/UserInfo'; import logo from '../../../../images/christee-logo.png'; const headerStyles = StyleSheet.create({ titleContainer: { flexDirection: 'row', marginTop: 10, marginBottom: 5, }, reportTitle: { color: '#000000', fontSize: 12, }, }); interface TitleProps { title: string; } const ReportTitle: React.FC = function ({ title }) { return ( {title} ); }; const styles = StyleSheet.create({ body: { // fontFamily: 'Roboto', paddingTop: 10, paddingBottom: 25, paddingHorizontal: 30, }, pageNumber: { position: 'absolute', fontSize: 9, bottom: 15, left: 0, right: 0, textAlign: 'center', color: 'black', }, image: { width: 70, height: 20, }, header: { fontSize: 12, marginBottom: 20, textAlign: 'center', color: 'grey', }, textbold: { // fontFamily: 'RobotoBold', fontWeight: 900, fontSize: 9, }, description: { textAlign: 'left', width: '100%', fontSize: 9, }, tableContainer: { flexDirection: 'row', flexWrap: 'wrap', marginTop: 10, }, row: { flexDirection: 'row', alignItems: 'center', height: 16, }, logo: { width: 65, height: 15, position: 'absolute', bottom: 11, left: 65, }, copy: { fontSize: 9, position: 'absolute', bottom: 13, left: 10, }, }); /** * State Maryland: Selected Area: AnneĀ Arundel * Christee Monthly Budget Based upon purchase of $300000 home * State Selected Maryland Area within State AnneĀ Arundel * (A) Taxable Mo Income $7083.33 (B) Tax Free Mo Income $166.67 (C) Total Mo Income $7250.00 * (D) User Entered LTV 0.8 (E) Max Loan Set by User $225000 (F) Credit Score 800 */ const SectionHeader = function (pdf: TBudgetPDF) { return ( State:  {pdf.state_sel}  Selected Area:  {pdf.area} Christee Monthly Budget Based upon purchase of Based upon purchase of    home. State Selected:  {pdf.state_sel}  Area within State:  {pdf.area} (A) Taxable Mo Income:   (B) Tax Free Mo Income:   (C) Total Mo Income:  {pdf.pdf_h4}   {pdf.pdf_h5}  (F) Credit Score:  {pdf.inputcred} ); }; /** * 1. Mortgage Details Conventional Loan Percent of Income 18.87% * Base Loan $225000 75.00% LTV Total Loan $225000 Interest Rate: 2.75% * Total Mortgage Payment $1368.04 Principal & Interest $918.54 * Monthly Mortgage Insurance $0 Monthly Property Taxes $248.25 * Monthly Property Insurance $101.25 Condo / HOA Fees 100 * Potential Monthly Fed Tax Savings $166.92 Estimated Net Mortgage Payment $1201.12 */ const SectionOne = function (pdf: TBudgetPDF) { return ( 1. Mortgage Details:  {pdf.dis_mtge}  Loan Percent of Income:  Base Loan:     LTV Total Loan:   Interest Rate:  Total Mortgage Payment:   Principal & Interest:  Monthly Mortgage Insurance:   Monthly Property Taxes:  Monthly Property Insurance:   Condo / HOA Fees:  Potential Monthly Fed Tax Savings:   Estimated Net Mortgage Payment:  ); }; /** * 2. Federal & State Income Taxes $2257.04 Effective Tax Rate 31.00% * Estimated Federal Taxes $1391.4 Tax Bracket 22% * Estimated Interest and Property Tax Deduction $9105 * Estimated Social Security $439.16 Rate 6.20% * Estimated Medicare Tax $102.7 Rate 1.45% * Estimated State Income Tax $323.79 Rate 4.75% */ const SectionTwo = function (pdf: TBudgetPDF) { return ( 2. Federal & State Income Taxes:   Effective Tax Rate:  Estimated Federal Taxes:   Tax Bracket:  Estimated Interest and Property Tax Deduction:  Estimated Social Security:   Rate:  Estimated Medicare Tax:   Rate:  Estimated State Income Tax:   Rate:  ); }; /** * 3. Monthly Debt Obligations $3108 Percent of Income 42.86% * Alimony $200 Cable / Wifi $90 Car Payments $415 * Cell Phone $60 Child Care $50 Child Support $100 * Credit Cards $100 Food $900 Actual * Insurance Health $200 Insurance Auto $100 * Pet Expenses $50 Retirement Fund Monthly $300 School Tuition $75 * Utilities Monthly $250 Actual Sample $100 */ const SectionThree = function (pdf: TBudgetPDF) { return ( 3. Monthly Debt Obligations:   Percent of Income:  Alimony:    Cable / Wifi:   Car Payments:  Cell Phone:   Child Care:   Child Support:  Credit Cards:   Food:    {pdf.dis_food} Insurance Health:   Insurance Auto:  Pet Expenses:   Retirement Fund Monthly:   School Tuition:  Utilities Monthly:    {pdf.dis_util}   {pdf.otherd} ); }; /** * 4. Monthly Summary * Total Monthly Obligations $6733.09 Percent of Income 92.87% * Discretionary Monthly Cash $516.9 Percent Discretionary Cash 7.13% * The information contained herein though believed accurate is not guaranteed. This is not a pre-approval */ const SectionFour = function (pdf: TBudgetPDF) { return ( 4. Monthly Summary Total Monthly Obligations:   Percent of Income:  Discretionary Monthly Cash:   Percent Discretionary Cash:  {pdf.pdf_bottom} ); }; /** * Fragment that is sent to react-pdf. */ type ReportContainerProps = { pdf: TBudgetPDF; coverPage: TResponseCoverPage; }; const ReportContainer = function ({ pdf, coverPage }: ReportContainerProps) { return ( {!!(coverPage?.name && coverPage?.email) && } Powered By `${pageNumber} / ${totalPages}`} fixed /> ); }; /** * This is the exported function it takes the dat and * title from pdf.button. */ interface Props { dat: TBudgetResponse; } const PdfReport: React.FC = function ({ dat: { pdf, coverPage } }) { return ( ); }; export default PdfReport;