Untitled

mail@pastecode.io avatar
unknown
plain_text
5 months ago
1.3 kB
1
Indexable
 // Default to 0 if no income is provided
  let monthlyIncome = 0;

  // Determine the income type and calculate monthly income accordingly
  const incomeType = answerMap['fd669da3-bc01-4af3-8b06-143b0e9208ad'].label;
  if (incomeType === 'I Know My Hourly Wage') {
    const hourlyWage = parseFloat(answerMap['3dddeb65-eb31-402c-ad52-05517abdcd52']);
    const hoursPerWeek = parseFloat(answerMap['e11c2e00-a168-4c4f-835f-66a0a2a18137']);
    monthlyIncome = hourlyWage * hoursPerWeek * 4; // Assuming 4 weeks in a month
  } else if (incomeType === 'I Know My Annual Income') {
    const annualIncome = parseFloat(answerMap['545a0bdd-f053-4e94-9c6a-d95cd76aa4ab']);
    monthlyIncome = annualIncome / 12;
  } else if (incomeType === 'I Know My Monthly Income') {
    monthlyIncome = parseFloat(answerMap['04206c99-bf7d-482c-a1ca-afc1172aefa1']);
  } else if (incomeType === 'I Know The Amount of My Last Pay') {
    const lastPayAmount = parseFloat(answerMap['b3a2e732-e3a2-4932-92c1-80a87bb01b40']);
    const payFrequency = answerMap['17aa58b9-67dd-4403-aec6-71130403b6c5'].label;
    if (payFrequency === 'Weekly') {
      monthlyIncome = lastPayAmount * 4;
    } else if (payFrequency === 'Bi-Weekly') {
      monthlyIncome = lastPayAmount * 2;
    } else if (payFrequency === 'Monthly') {
      monthlyIncome = lastPayAmount;
    }
  }
Leave a Comment