update fields invoice, payment approval, realization recap

This commit is contained in:
fadlydev
2025-01-31 03:12:00 +07:00
parent 28e2d701c5
commit 68ea1a1fa8
3 changed files with 45 additions and 109 deletions

View File

@ -5,12 +5,8 @@ import {
CreateDateColumn,
UpdateDateColumn,
DeleteDateColumn,
ManyToOne,
JoinColumn,
} from 'typeorm';
import { RequestOrder } from './request_orders';
export enum PaymentStatus {
PAID = 'PAID',
UNPAID = 'UNPAID',
@ -35,117 +31,57 @@ export class Invoice {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column({
nullable: false,
length: 128,
})
@Column({ nullable: false, length: 128 })
invoice_number: string;
@Column({
nullable: false,
type: 'date',
})
@Column({ nullable: false, type: 'date' })
invoice_date: Date;
@Column({
nullable: false,
type: 'date',
})
@Column({ nullable: false, type: 'date' })
due_date: Date;
@Column({
nullable: false,
type: 'uuid',
})
@Column({ nullable: false, type: 'uuid' })
supplier_id: string;
@ManyToOne(() => RequestOrder, (requestOrder) => requestOrder.id, { nullable: false })
@JoinColumn({ name: 'request_order_id' })
requestOrder: RequestOrder;
@Column({
nullable: false,
type: 'uuid',
})
@Column({ nullable: false, type: 'uuid' })
request_order_id: string;
@Column({
nullable: false,
type: 'decimal',
precision: 12,
scale: 2,
})
@Column({ nullable: false, type: 'decimal', precision: 12, scale: 2 })
total_amount: number;
@Column({
nullable: false,
type: 'decimal',
precision: 12,
scale: 2,
})
@Column({ nullable: false, type: 'decimal', precision: 12, scale: 2 })
tax_amount: number;
@Column({
nullable: false,
length: 3,
})
@Column({ nullable: false, length: 3 })
currency: string;
@Column({
nullable: true,
type: 'decimal',
precision: 12,
scale: 2,
})
@Column({ nullable: true, type: 'decimal', precision: 12, scale: 2 })
discount: number;
@Column({
nullable: false,
type: 'decimal',
precision: 12,
scale: 2,
})
@Column({ nullable: false, type: 'decimal', precision: 12, scale: 2 })
net_amount: number;
@Column({
nullable: true,
type: 'text',
})
@Column({ nullable: true, type: 'text' })
payment_terms: string;
@Column({
nullable: true,
type: 'enum',
enum: PaymentMethod,
})
@Column({ nullable: true, type: 'enum', enum: PaymentMethod })
payment_method: PaymentMethod;
@Column({
nullable: false,
type: 'uuid',
})
@Column({ nullable: false, type: 'uuid' })
issued_by: string;
@Column({
nullable: true,
type: 'text',
})
@Column({ nullable: true, type: 'text' })
remarks: string;
@Column({
nullable: false,
type: 'enum',
enum: PaymentStatus,
})
@Column({ nullable: false, type: 'enum', enum: PaymentStatus })
payment_status: PaymentStatus;
@Column({
nullable: false,
type: 'enum',
enum: InvoiceStatus,
})
@Column({ nullable: false, type: 'enum', enum: InvoiceStatus })
invoice_status: InvoiceStatus;
@Column({ nullable: true, type: 'text' })
invoice_evidence: string;
@Column()
@CreateDateColumn()
created_at: Date;

View File

@ -5,12 +5,9 @@ import {
CreateDateColumn,
UpdateDateColumn,
DeleteDateColumn,
ManyToOne,
JoinColumn,
OneToMany,
} from 'typeorm';
import { Department } from './department';
import { AssetRealization } from './asset_realizations';
@Entity('asset_realization_recaps')
@ -44,22 +41,18 @@ export class AssetRealizationRecap {
})
total_value: number;
@ManyToOne(() => Department, (department) => department.id, { nullable: false })
@JoinColumn({ name: 'department_id' })
department: Department;
@Column({
nullable: false,
type: 'uuid',
})
department_id: string;
@Column({
nullable: false,
type: 'uuid',
})
created_by: string;
@Column({
nullable: false,
type: 'uuid',
})
journal_id: string;
@OneToMany(() => AssetRealization, (realization) => realization.id)
assetRealizations: AssetRealization[];

View File

@ -42,19 +42,26 @@ export class PaymentApproval {
})
approved_amount: number;
// General Manager Approval
@Column({
type: 'uuid',
nullable: true,
})
approved_by_gm: string | null;
@Column({
type: 'timestamp',
nullable: true,
})
gm_approval_date: Date | null;
@Column({
nullable: false,
type: 'enum',
enum: ApprovalStatus,
default: ApprovalStatus.PENDING,
})
finance_approval_status: ApprovalStatus;
gm_approval_status: ApprovalStatus;
@Column({
nullable: true,
type: 'uuid',
})
approved_by: string;
@OneToMany(() => AssetJournalEntry, (journalEntry) => journalEntry.paymentApproval)
journalEntries: AssetJournalEntry[];