/* eslint-disable @typescript-eslint/no-unnecessary-condition */ import { AbstractDto } from '../../../common/dto/abstract.dto'; import { DateField, NumberField, StringField, StringFieldOptional, } from '../../../decorators'; import { type MonthlyRecordEntity } from '../monthly-record.entity'; export class MonthlyRecordDto extends AbstractDto { @DateField() date!: Date; @StringField() employeeName!: string; @NumberField() restDayWages!: number; @NumberField() advance!: number; @NumberField() cleaningFee!: number; @NumberField() allowance!: number; @NumberField() epf!: number; @NumberField() eis!: number; @NumberField() socso!: number; @NumberField() levy!: number; @NumberField() deduct!: number; @NumberField() addition!: number; @StringFieldOptional() remark?: string; constructor(monthlyRecord: MonthlyRecordEntity) { super(monthlyRecord); this.restDayWages = monthlyRecord.restDayWages; this.advance = monthlyRecord.advance; this.cleaningFee = monthlyRecord.cleaningFee; this.epf = monthlyRecord.epf; this.eis = monthlyRecord.eis; this.socso = monthlyRecord.socso; this.levy = monthlyRecord.levy; this.allowance = monthlyRecord.monthlyAllowance; this.deduct = monthlyRecord.deduct; this.addition = monthlyRecord.addition; this.date = monthlyRecord.date; this.remark = monthlyRecord.remark; this.employeeName = monthlyRecord.employee && monthlyRecord.employee.name; } }