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

168 lines
3.3 KiB
TypeScript
Raw Normal View History

import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany, Double } from "typeorm";
2024-02-23 17:17:19 +07:00
import { EntityBase } from "./base/Base";
import { SalaryPeriod } from "./SalaryPeriod";
import { SalaryProfile } from "./SalaryProfile";
2024-02-23 17:17:19 +07:00
@Entity("salaryOrg")
export class SalaryOrg extends EntityBase {
@Column({
2024-03-08 14:36:57 +07:00
comment: "คีย์นอก(FK)ของตาราง salaryPeriod",
2024-02-23 17:17:19 +07:00
length: 40,
})
salaryPeriodId: string;
2024-02-23 17:17:19 +07:00
@Column({
comment: "สถานะ",
2024-02-23 17:17:19 +07:00
})
status: string;
@Column({
2024-03-08 14:36:57 +07:00
comment: "คีย์นอก(FK)ของตาราง orgRoot",
2024-02-23 17:17:19 +07:00
length: 40,
})
rootId: string;
2024-02-23 17:17:19 +07:00
2025-02-04 10:13:40 +07:00
@Column({
2025-02-04 17:38:21 +07:00
nullable: true,
2025-02-04 10:13:40 +07:00
comment: "คีย์นอก(FK)ของตาราง orgRoot Dna",
length: 40,
})
rootDnaId: string;
2024-03-27 16:39:45 +07:00
@Column({
nullable: true,
comment: "orgRoot",
length: 255,
})
root: string;
@Column({
nullable: true,
2024-03-08 14:36:57 +07:00
comment: "คีย์นอก(FK)ของตาราง orgRevision",
length: 40,
})
revisionId: string;
@Column({
comment: "รอบการ Snapshot",
length: 20,
default: "SNAP1",
})
snapshot: string;
2024-02-23 17:17:19 +07:00
@Column({
2024-02-28 14:46:17 +07:00
default: 0,
comment: "จำนวนคนทั้งหมด",
2024-02-23 17:17:19 +07:00
})
total: number;
2024-02-23 17:17:19 +07:00
@Column({
2024-02-28 14:46:17 +07:00
default: 0,
comment: "15%ของจำนวนคน(จำนวนเต็ม)",
2024-02-23 17:17:19 +07:00
})
fifteenPercent: number;
2024-02-23 17:17:19 +07:00
@Column({
comment: "15%ของจำนวนคน(จุดทศนิยม)",
type: "double",
default: 0,
})
fifteenPoint: number;
@Column({
comment: "กลุ่ม GROUP1->กลุ่ม1 GROUP2->กลุ่ม2",
length: 10,
})
group: string;
2024-02-28 16:27:36 +07:00
@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;
2024-02-23 17:17:19 +07:00
@OneToMany(() => SalaryProfile, (salaryProfile) => salaryProfile.salaryOrg)
salaryProfiles: SalaryProfile[];
2024-02-23 17:17:19 +07:00
}
export class CreateSalaryOrg {
@Column("uuid")
salaryPeriodId: string;
2024-02-23 17:17:19 +07:00
@Column()
status: string;
@Column("uuid")
rootId: string;
2024-02-23 17:17:19 +07:00
2024-03-27 16:39:45 +07:00
@Column()
root: string;
2024-02-23 17:17:19 +07:00
@Column()
total: number;
2024-02-23 17:17:19 +07:00
@Column()
fifteenPercent: number;
2024-02-23 17:17:19 +07:00
}
export type UpdateSalaryOrg = Partial<CreateSalaryOrg>;