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

View File

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

View File

@ -42,19 +42,26 @@ export class PaymentApproval {
}) })
approved_amount: number; 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({ @Column({
nullable: false,
type: 'enum', type: 'enum',
enum: ApprovalStatus, enum: ApprovalStatus,
default: ApprovalStatus.PENDING, default: ApprovalStatus.PENDING,
}) })
finance_approval_status: ApprovalStatus; gm_approval_status: ApprovalStatus;
@Column({
nullable: true,
type: 'uuid',
})
approved_by: string;
@OneToMany(() => AssetJournalEntry, (journalEntry) => journalEntry.paymentApproval) @OneToMany(() => AssetJournalEntry, (journalEntry) => journalEntry.paymentApproval)
journalEntries: AssetJournalEntry[]; journalEntries: AssetJournalEntry[];