payment request

This commit is contained in:
Rizki
2026-01-29 15:15:48 +07:00
parent 4687c7154c
commit 5eb3460ab5
3 changed files with 224 additions and 0 deletions

View File

@ -0,0 +1,216 @@
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, ManyToOne, JoinColumn } from "typeorm";
import { ProcurementPurchaseOrder } from "./procurement_purchase_order";
import { ProcurementVendor } from "./procurement_vendor";
import { FinancePurchaseRequest } from "../finance/finance_purchase_requests";
import { FinanceCpv } from "../finance/finance_cpvs";
import { HrmsEmployee } from "../hrms/hrms_employee";
import { ProcurementPRCStatus } from "../../types/procurement";
@Entity("procurement_payment_request", { schema: "procurement" })
export class ProcurementPaymentRequest {
@PrimaryGeneratedColumn("uuid")
id: string;
// =========================
// HEADER
// =========================
@Column({ type: "varchar", length: 50, unique: true })
code: string; // PRC Code Automaticaly
@Column({ type: "varchar", length: 50, unique: true })
prc_number: string; // Payment Request Number (2025-0177)
@Column({ type: "date" })
prc_date: Date; // Payment Request Date
@Column({ type: "varchar", length: 150, nullable: true })
to: string; // To (Director Finance)
@Column({ type: "varchar", length: 150, nullable: true })
from: string; // From (Procurement Unit)
@Column({ type: "varchar", length: 100, nullable: true })
payment_type: string; // Payment for Procurement
@Column({ type: "varchar", length: 50, nullable: true })
status: ProcurementPRCStatus; // Draft / Received / Approved / Rejected
// =========================
// REFERENCES
// =========================
@ManyToOne(() => FinanceCpv, { nullable: true, onDelete: "NO ACTION" })
@JoinColumn()
cpv: FinanceCpv; // CPV Number
@Column({ type: "float8", nullable: true })
cpv_amount_usd: number;
@ManyToOne(() => ProcurementPurchaseOrder, { nullable: true, onDelete: "NO ACTION" })
@JoinColumn()
po: ProcurementPurchaseOrder; // PO Number
@Column({ type: "float8", nullable: true })
po_amount_usd: number;
@ManyToOne(() => FinancePurchaseRequest, { nullable: true, onDelete: "NO ACTION" })
@JoinColumn()
pr: FinancePurchaseRequest; // PR Number
@Column({ type: "float8", nullable: true })
pr_amount_usd: number;
@Column({ type: "varchar", length: 100, nullable: true })
contract_number: string; // Contract Number
@Column({ type: "date", nullable: true })
contract_date: Date;
// =========================
// PAYMENT REQUEST DETAIL
// =========================
@Column({ type: "text", nullable: true })
payment_description: string; // Payment Request Description
@ManyToOne(() => ProcurementVendor, { nullable: true })
@JoinColumn()
vendor: ProcurementVendor; // Supplier / Contractor
@Column({ type: "varchar", length: 100, nullable: true })
invoice_number: string;
@Column({ type: "date", nullable: true })
invoice_date: Date;
@Column({ type: "varchar", length: 20, nullable: true })
currency: string; // USD
@Column({ type: "float8", nullable: true })
amount_claimed: number;
// =========================
// DEDUCTIONS
// =========================
@Column({ type: "float8", nullable: true })
advance_payment_percent: number;
@Column({ type: "float8", nullable: true })
advance_payment_amount: number;
@Column({ type: "float8", nullable: true })
retention_percent: number;
@Column({ type: "float8", nullable: true })
retention_amount: number;
@Column({ type: "float8", nullable: true })
deduction_tax_percent: number;
@Column({ type: "float8", nullable: true })
deduction_tax_amount: number;
@Column({ type: "float8", nullable: true })
deduction_penalty_percent: number;
@Column({ type: "float8", nullable: true })
deduction_penalty_amount: number;
@Column({ type: "float8", nullable: true })
net_amount_paid: number; // NET TO BE PAID
// =========================
// PAYMENT STATUS
// =========================
@Column({ type: "boolean", default: false })
is_partial: boolean; // Partial (YES/NO)
@Column({ type: "boolean", default: false })
is_final: boolean; // Final (YES/NO)
@Column({ type: "float8", nullable: true })
balance_remaining: number; // Balance excluding outstanding PRC
// =========================
// BANKING DETAILS
// =========================
@Column({ type: "varchar", length: 150, nullable: true })
bank_name: string;
@Column({ type: "varchar", length: 100, nullable: true })
bank_swift_aba_bsb: string;
@Column({ type: "text", nullable: true })
bank_account_name: string;
@Column({ type: "varchar", length: 150, nullable: true })
bank_account_number: string;
// =========================
// DEDUCTION ACCOUNT
// =========================
@Column({ type: "varchar", length: 150, nullable: true })
deduction_bank_name: string;
@Column({ type: "text", nullable: true })
deduction_bank_address: string;
@Column({ type: "varchar", length: 50, nullable: true })
deduction_account_no: string;
@Column({ type: "varchar", length: 150, nullable: true })
deduction_account_name: string;
// =========================
// APPROVAL FLOW
// =========================
@ManyToOne(() => HrmsEmployee, { nullable: true })
@JoinColumn()
prepared_by: HrmsEmployee;
@Column({ type: "varchar", length: 150, nullable: true })
prepared_by_position: string;
@ManyToOne(() => HrmsEmployee, { nullable: true })
@JoinColumn()
verified_by: HrmsEmployee;
@Column({ type: "varchar", length: 150, nullable: true })
verified_by_position: string;
@ManyToOne(() => HrmsEmployee, { nullable: true })
@JoinColumn()
certified_by: HrmsEmployee;
@Column({ type: "varchar", length: 150, nullable: true })
certified_by_position: string;
// =========================
// AUDIT
// =========================
@CreateDateColumn()
created_at: Date;
@Column({ nullable: true })
created_by: string;
@UpdateDateColumn({ nullable: true })
updated_at: Date;
@Column({ nullable: true })
updated_by: string;
@DeleteDateColumn({ nullable: true })
deleted_at: Date;
@Column({ nullable: true })
deleted_by: string;
}

View File

@ -8,5 +8,6 @@ export * from "../entity/procurement/procurement_checklist_payment_document";
export * from "../entity/procurement/procurement_checklist_payment_approval"; export * from "../entity/procurement/procurement_checklist_payment_approval";
export * from "../entity/procurement/procurement_purchase_order"; export * from "../entity/procurement/procurement_purchase_order";
export * from "../entity/procurement/procurement_purchase_order_item"; export * from "../entity/procurement/procurement_purchase_order_item";
export * from "../entity/procurement/procurement_payment_request";
export * from "../types/procurement"; export * from "../types/procurement";

View File

@ -69,3 +69,10 @@ export enum ProcurementPOStatus {
REJECTED = "REJECTED", REJECTED = "REJECTED",
PENDING = "PENDING", PENDING = "PENDING",
} }
export enum ProcurementPRCStatus {
DRAFT = "DRAFT",
APPROVED = "APPROVED",
REJECTED = "REJECTED",
RECEIVED = "RECEIVED",
}