payroll, payroll monthly

This commit is contained in:
Narul Hidayah
2026-01-02 00:07:19 +07:00
parent e1f61cf31d
commit 26a4b5965e
3 changed files with 135 additions and 4 deletions

View File

@ -37,11 +37,26 @@ export class HrmsPayroll {
@Column({ type: "decimal", precision: 15, scale: 2, nullable: false, default: 0 })
subsidy: number;
@Column({ type: "decimal", precision: 5, scale: 2, nullable: false, default: 4.0 })
niss_percentage: number;
@Column({ type: "decimal", precision: 15, scale: 2, nullable: false, default: 0 })
total_gross: number;
@Column({ type: "decimal", precision: 5, scale: 2, nullable: false, default: 10.0 })
tax_percentage: number;
@Column({ type: "decimal", precision: 15, scale: 2, nullable: false, default: 0 })
ss_4_percent: number;
@Column({ type: "decimal", precision: 15, scale: 2, nullable: false, default: 0 })
ss_6_percent: number;
@Column({ type: "decimal", precision: 15, scale: 2, nullable: false, default: 0 })
ss_total: number;
@Column({ type: "decimal", precision: 15, scale: 2, nullable: false, default: 0 })
tax_amount: number;
@Column({ type: "decimal", precision: 15, scale: 2, nullable: false, default: 0 })
total_deduct: number;
@Column({ type: "decimal", precision: 15, scale: 2, nullable: false, default: 0 })
total_nett: number;
@Column({ length: 64 })
status: Status;

View File

@ -0,0 +1,115 @@
import {
Entity,
PrimaryGeneratedColumn,
Column,
CreateDateColumn,
UpdateDateColumn,
DeleteDateColumn,
ManyToOne,
JoinColumn,
Index,
} from "typeorm";
import { Status } from "../../types/status";
import { HrmsEmployee } from "./hrms_employee";
import { HrmsPayroll } from "./hrms_payroll";
@Entity("hrms_payroll_monthly", { schema: "hrms" })
@Index(["employee", "period_month", "period_year"], { unique: true })
export class HrmsPayrollMonthly {
@PrimaryGeneratedColumn("uuid")
id: string;
@ManyToOne(() => HrmsEmployee, { onDelete: "RESTRICT", nullable: false })
@JoinColumn({ name: "employee_id" })
employee: HrmsEmployee;
@ManyToOne(() => HrmsPayroll, { onDelete: "RESTRICT", nullable: true })
@JoinColumn({ name: "payroll_setup_id" })
payroll_setup: HrmsPayroll;
@Column({ type: "int", nullable: false })
period_month: number; // 1-12
@Column({ type: "int", nullable: false })
period_year: number; // e.g., 2026
// Payroll Setup Data (snapshot at the time of generation)
@Column({ type: "decimal", precision: 15, scale: 2, nullable: false })
basic_salary: number;
@Column({ type: "decimal", precision: 15, scale: 2, nullable: false, default: 0 })
subsidy: number;
// Working Days Calculation
@Column({ type: "int", nullable: false })
working_days_in_month: number;
@Column({ type: "int", nullable: false, default: 0 })
days_present: number;
@Column({ type: "int", nullable: false, default: 0 })
days_absent: number;
@Column({ type: "int", nullable: false, default: 0 })
unpaid_leave_days: number;
// Deductions for Absences
@Column({ type: "decimal", precision: 15, scale: 2, nullable: false, default: 0 })
deduction_absence: number;
@Column({ type: "decimal", precision: 15, scale: 2, nullable: false, default: 0 })
deduction_unpaid_leave: number;
@Column({ type: "decimal", precision: 15, scale: 2, nullable: false, default: 0 })
total_attendance_deduction: number;
// Recalculated Amounts
@Column({ type: "decimal", precision: 15, scale: 2, nullable: false })
adjusted_basic_salary: number;
@Column({ type: "decimal", precision: 15, scale: 2, nullable: false })
total_gross: number;
@Column({ type: "decimal", precision: 15, scale: 2, nullable: false, default: 0 })
ss_4_percent: number;
@Column({ type: "decimal", precision: 15, scale: 2, nullable: false, default: 0 })
ss_6_percent: number;
@Column({ type: "decimal", precision: 15, scale: 2, nullable: false, default: 0 })
ss_total: number;
@Column({ type: "decimal", precision: 15, scale: 2, nullable: false, default: 0 })
tax_amount: number;
@Column({ type: "decimal", precision: 15, scale: 2, nullable: false, default: 0 })
total_deduct: number;
@Column({ type: "decimal", precision: 15, scale: 2, nullable: false, default: 0 })
total_nett: number;
@Column({ length: 64 })
status: Status;
@Column({ type: "text", nullable: true })
notes: string;
@CreateDateColumn()
created_at: Date;
@Column({ nullable: true, length: 256 })
created_by: string;
@UpdateDateColumn({ nullable: true })
updated_at: Date;
@Column({ nullable: true, length: 256 })
updated_by: string;
@DeleteDateColumn({ nullable: true })
deleted_at: Date;
@Column({ nullable: true, length: 256 })
deleted_by: string;
}

View File

@ -12,5 +12,6 @@ export * from "../entity/hrms/hrms_training";
export * from "../entity/hrms/hrms_training_participant";
export * from "../entity/hrms/hrms_bank";
export * from "../entity/hrms/hrms_payroll";
export * from "../entity/hrms/hrms_payroll_monthly";
export * from "../types/hrms";