hrms-api-salary/src/entities/SalaryOrgEmployee.ts

157 lines
3.2 KiB
TypeScript

import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany, Double } from "typeorm";
import { EntityBase } from "./base/Base";
import { SalaryPeriod } from "./SalaryPeriod";
import { SalaryProfileEmployee } from "./SalaryProfileEmployee";
@Entity("salaryOrgEmployee")
export class SalaryOrgEmployee extends EntityBase {
@Column({
comment: "คีย์นอก(FK)ของตาราง salaryPeriod",
length: 40,
})
salaryPeriodId: string;
@Column({
comment: "สถานะ",
})
status: string;
@Column({
comment: "คีย์นอก(FK)ของตาราง orgRoot",
length: 40,
})
rootId: string;
@Column({
nullable: true,
comment: "orgRoot",
length: 255,
})
root: string;
@Column({
nullable: true,
comment: "คีย์นอก(FK)ของตาราง orgRevision",
length: 40,
})
revisionId: string;
@Column({
comment: "รอบการ Snapshot",
length: 20,
default: "SNAP1",
})
snapshot: string;
@Column({
default: 0,
comment: "จำนวนคนทั้งหมด",
})
total: number;
@Column({
default: 0,
comment: "15%ของจำนวนคน(จำนวนเต็ม)",
})
fifteenPercent: number;
@Column({
comment: "15%ของจำนวนคน(จุดทศนิยม)",
type: "double",
default: 0,
})
fifteenPoint: number;
@Column({
comment: "กลุ่ม GROUP1->กลุ่ม1 GROUP2->กลุ่ม2",
length: 10,
})
group: string;
@Column({
comment: "เลือกไปแล้ว",
default: 0,
})
quantityUsed: number;
@Column({
comment: "คงเหลือโควตา",
default: 0,
})
remainQuota: number;
@Column({
comment: "จำนวนเงินคนครองปัจจุบัน",
type: "double",
default: 0,
})
currentAmount: number;
@Column({
comment: "วงเงิน6%",
type: "double",
default: 0,
})
sixPercentAmount: number;
@Column({
comment: "ยอดเงินที่ใช้ไป",
type: "double",
default: 0,
})
spentAmount: number;
@Column({
comment: "ใช้ไปเท่าไหร่",
type: "double",
default: 0,
})
useAmount: number;
@Column({
comment: "เหลือเท่าไหร่",
type: "double",
default: 0,
})
remainingAmount: number;
@Column({
nullable: true,
comment: "คำแนะนำ สกจ",
length: 255,
})
ownerRecommend: string;
@Column({
nullable: true,
comment: "คำแนะนำ ผอ",
length: 255,
})
headRecommend: string;
@ManyToOne(() => SalaryPeriod, (salaryPeriod) => salaryPeriod.salaryOrgs)
@JoinColumn({ name: "salaryPeriodId" })
salaryPeriod: SalaryPeriod;
@OneToMany(() => SalaryProfileEmployee, (salaryProfile) => salaryProfile.salaryOrg)
salaryProfiles: SalaryProfileEmployee[];
}
export class CreateSalaryOrgEmployee {
@Column("uuid")
salaryPeriodId: string;
@Column()
status: string;
@Column("uuid")
rootId: string;
@Column()
total: number;
@Column()
fifteenPercent: number;
}
export type UpdateSalaryOrgEmployee = Partial<CreateSalaryOrgEmployee>;