Skip to content

Commit

Permalink
Merge branch 'development' into econ-sense-vite-press
Browse files Browse the repository at this point in the history
  • Loading branch information
Chuiantw1212 committed May 12, 2024
2 parents 702de1b + 111d03d commit de9620a
Show file tree
Hide file tree
Showing 16 changed files with 1,515 additions and 862 deletions.
4 changes: 2 additions & 2 deletions components/calculator/career/government.vue
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ function calculateCareer(options: any = { propagate: true }) {
calculateMonthlyTotal()
calculateHealthInsurance()
calculateCareerInsurance()
calculatePension()
calculateGovernmentPension()
calculateMonthlySaving()
debounce(() => {
drawChartAndCalculateIncome(propagate)
Expand Down Expand Up @@ -251,7 +251,7 @@ function calculateCareerInsurance() {
const { premiumRate, employeeContributionRate } = civilServantInsurance
civilServantInsurance.expense = Math.round(monthlyBasicSalary * premiumRate / 100 * employeeContributionRate / 100)
}
function calculatePension() {
function calculateGovernmentPension() {
const { payPoint, pension } = career.value
if (payPoint) {
const index = pointOfPayOptions.findIndex(item => {
Expand Down
44 changes: 38 additions & 6 deletions components/calculator/career/labor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,16 @@
</el-form-item>
</el-col>
</el-row>
<el-row v-if="profile.careerInsuranceType === 'entrepreneur'">
<el-col :span="12">
<el-form-item label="自備退休金">
<el-input-number v-model="career.pension.monthlyContributionSelf" :min="0"
:disabled="!career.monthlyBasicSalary" :step="1000" @change="calculateCareer($event)" />
</el-form-item>
</el-col>
<el-col :span="12">
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label="月支出" required>
Expand All @@ -121,7 +131,7 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="月實領 - 月支出">
<el-form-item label="定期定額">
<el-text>{{ Number(career.monthlySaving).toLocaleString() }}</el-text>
</el-form-item>
</el-col>
Expand Down Expand Up @@ -242,6 +252,9 @@ function calculateCareer(options: any = { propagate: true }) {
debounce(() => {
drawChartAndCalculateIncome(propagate)
})(propagate)
if (propagate) {
emits('update:modelValue', career.value)
}
} catch (error) {
console.log(error.message || error)
}
Expand Down Expand Up @@ -285,6 +298,10 @@ function calculateEmployeeWelfareFund() {
}
function calculateHealthPremium() {
const { monthlyBasicSalary, headCount } = career.value
if (!monthlyBasicSalary) {
healInsurance.contribution = 0
return
}
const { insuredUnit } = career.value
let healthSalaryMin = monthlyBasicSalary
if (insuredUnit === 'company') {
Expand Down Expand Up @@ -382,17 +399,25 @@ function calculateCareerPensionContribution() {
switch (careerInsuranceType) {
case 'employee':
career.value.pension.monthlyContribution = Math.floor(laborInsuranceSalary * (6 + rate) / 100)
career.value.pension.monthlyContributionSelf = 0
break;
case 'entrepreneur':
// 實際從事勞動之雇主僅得個人自願提繳退休金,事業單位不得為其提繳退休金,雇主自願提繳率不得高於薪資6%,自願提繳金額會存入退休金個人專戶。
career.value.pension.monthlyContribution = Math.floor(laborInsuranceSalary * (rate) / 100)
break;
}
}
// 投資計算
function calculateMonthlySaving() {
const { monthlyNetPay = 0, monthlyExpense = 0, monthlyNetPayEstimated } = career.value
const { monthlyNetPay = 0, monthlyExpense = 0, monthlyNetPayEstimated, pension } = career.value
const { careerInsuranceType } = props.profile

const monthlyNetPayBasis = monthlyNetPay || monthlyNetPayEstimated
career.value.monthlySaving = Math.floor(monthlyNetPayBasis - monthlyExpense)
let monthlySaving = Math.floor(monthlyNetPayBasis - monthlyExpense)
if (careerInsuranceType === 'entrepreneur') {
monthlySaving -= pension.monthlyContributionSelf
}
career.value.monthlySaving = monthlySaving
}
// 畫圖
let incomeChartInstance = ref<Chart>()
Expand Down Expand Up @@ -471,6 +496,16 @@ function drawChartAndCalculateIncome(propagate = false) {
datasetIndex: 0,
})

if (career.value.pension.monthlyContributionSelf) {
pv = fv
fv -= career.value.pension.monthlyContributionSelf
dataAndDataIndex.push({
label: '自備退休金',
data: [pv, fv],
datasetIndex: 1,
})
}

if (career.value.monthlyExpense) {
pv = fv
fv -= career.value.monthlyExpense
Expand Down Expand Up @@ -522,9 +557,6 @@ function drawChartAndCalculateIncome(propagate = false) {
},
]
}
if (propagate) {
emits('update:modelValue', career.value)
}

if (incomeChartInstance.value) {
incomeChartInstance.value.data = data
Expand Down
Loading

0 comments on commit de9620a

Please sign in to comment.