diff --git a/src/entity/asset_invoice.ts b/src/entity/asset_invoice.ts index d49134f..6f63e72 100644 --- a/src/entity/asset_invoice.ts +++ b/src/entity/asset_invoice.ts @@ -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; diff --git a/src/entity/asset_realization_recaps.ts b/src/entity/asset_realization_recaps.ts index 384ca4e..b865db2 100644 --- a/src/entity/asset_realization_recaps.ts +++ b/src/entity/asset_realization_recaps.ts @@ -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[]; diff --git a/src/entity/payment_approval.ts b/src/entity/payment_approval.ts index dfbeab2..f67bd21 100644 --- a/src/entity/payment_approval.ts +++ b/src/entity/payment_approval.ts @@ -42,19 +42,26 @@ export class PaymentApproval { }) approved_amount: number; - @Column({ - nullable: false, - type: 'enum', - enum: ApprovalStatus, - default: ApprovalStatus.PENDING, - }) - finance_approval_status: ApprovalStatus; - - @Column({ - nullable: true, - type: 'uuid', - }) - approved_by: string; + // General Manager Approval + @Column({ + type: 'uuid', + nullable: true, + }) + approved_by_gm: string | null; + + @Column({ + type: 'timestamp', + nullable: true, + }) + gm_approval_date: Date | null; + + @Column({ + type: 'enum', + enum: ApprovalStatus, + default: ApprovalStatus.PENDING, + }) + gm_approval_status: ApprovalStatus; + @OneToMany(() => AssetJournalEntry, (journalEntry) => journalEntry.paymentApproval) journalEntries: AssetJournalEntry[];