add invoice
This commit is contained in:
@ -19,6 +19,19 @@ export enum PaymentStatus {
|
|||||||
PARTIALLY_PAID = 'PARTIALLY_PAID',
|
PARTIALLY_PAID = 'PARTIALLY_PAID',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum InvoiceStatus {
|
||||||
|
ISSUED = 'ISSUED',
|
||||||
|
PENDING = 'PENDING',
|
||||||
|
CANCELED = 'CANCELED',
|
||||||
|
SETTLED = 'SETTLED',
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum PaymentMethod {
|
||||||
|
BANK_TRANSFER = 'BANK_TRANSFER',
|
||||||
|
CREDIT_CARD = 'CREDIT_CARD',
|
||||||
|
PAYPAL = 'PAYPAL',
|
||||||
|
}
|
||||||
|
|
||||||
@Entity('invoices')
|
@Entity('invoices')
|
||||||
export class Invoice {
|
export class Invoice {
|
||||||
@PrimaryGeneratedColumn('uuid')
|
@PrimaryGeneratedColumn('uuid')
|
||||||
@ -36,6 +49,12 @@ export class Invoice {
|
|||||||
})
|
})
|
||||||
invoice_date: Date;
|
invoice_date: Date;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
type: 'date',
|
||||||
|
})
|
||||||
|
due_date: Date;
|
||||||
|
|
||||||
@ManyToOne(() => Supplier, (supplier) => supplier.id, { nullable: false })
|
@ManyToOne(() => Supplier, (supplier) => supplier.id, { nullable: false })
|
||||||
@JoinColumn({ name: 'supplier_id' })
|
@JoinColumn({ name: 'supplier_id' })
|
||||||
supplier: Supplier;
|
supplier: Supplier;
|
||||||
@ -64,6 +83,49 @@ export class Invoice {
|
|||||||
})
|
})
|
||||||
total_amount: number;
|
total_amount: number;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
type: 'decimal',
|
||||||
|
precision: 12,
|
||||||
|
scale: 2,
|
||||||
|
})
|
||||||
|
tax_amount: number;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
length: 3,
|
||||||
|
})
|
||||||
|
currency: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: 'decimal',
|
||||||
|
precision: 12,
|
||||||
|
scale: 2,
|
||||||
|
})
|
||||||
|
discount: number;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
type: 'decimal',
|
||||||
|
precision: 12,
|
||||||
|
scale: 2,
|
||||||
|
})
|
||||||
|
net_amount: number;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: 'text',
|
||||||
|
})
|
||||||
|
payment_terms: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
type: 'enum',
|
||||||
|
enum: PaymentMethod,
|
||||||
|
})
|
||||||
|
payment_method: PaymentMethod;
|
||||||
|
|
||||||
@ManyToOne(() => User, (user) => user.id, { nullable: false })
|
@ManyToOne(() => User, (user) => user.id, { nullable: false })
|
||||||
@JoinColumn({ name: 'issued_by' })
|
@JoinColumn({ name: 'issued_by' })
|
||||||
issuedBy: User;
|
issuedBy: User;
|
||||||
@ -87,6 +149,13 @@ export class Invoice {
|
|||||||
})
|
})
|
||||||
payment_status: PaymentStatus;
|
payment_status: PaymentStatus;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: false,
|
||||||
|
type: 'enum',
|
||||||
|
enum: InvoiceStatus,
|
||||||
|
})
|
||||||
|
invoice_status: InvoiceStatus;
|
||||||
|
|
||||||
@Column()
|
@Column()
|
||||||
@CreateDateColumn()
|
@CreateDateColumn()
|
||||||
created_at: Date;
|
created_at: Date;
|
||||||
|
|||||||
@ -35,7 +35,7 @@ export class Goods {
|
|||||||
@Column({
|
@Column({
|
||||||
nullable: false,
|
nullable: false,
|
||||||
length: 64,
|
length: 64,
|
||||||
unique: true, // Ensure the item code is unique
|
unique: true,
|
||||||
})
|
})
|
||||||
item_code: string;
|
item_code: string;
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ export class Goods {
|
|||||||
@JoinColumn({ name: 'supplier_id' })
|
@JoinColumn({ name: 'supplier_id' })
|
||||||
supplier: Supplier;
|
supplier: Supplier;
|
||||||
|
|
||||||
@ManyToOne(() => GoodsReceipt, (goodsReceipt) => goodsReceipt.goods, { nullable: false })
|
@ManyToOne(() => GoodsReceipt, (goodsReceipt) => goodsReceipt.goods, { nullable: true })
|
||||||
@JoinColumn({ name: 'goods_receipt_id' })
|
@JoinColumn({ name: 'goods_receipt_id' })
|
||||||
goodsReceipt: GoodsReceipt;
|
goodsReceipt: GoodsReceipt;
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ export class Goods {
|
|||||||
goods_receipt_id: string;
|
goods_receipt_id: string;
|
||||||
@Index()
|
@Index()
|
||||||
@Column({
|
@Column({
|
||||||
nullable: false,
|
nullable: true,
|
||||||
type: 'uuid',
|
type: 'uuid',
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user