add PO
This commit is contained in:
131
src/entity/procurement/procurement_purchase_order.ts
Normal file
131
src/entity/procurement/procurement_purchase_order.ts
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn, DeleteDateColumn, ManyToOne, OneToMany, JoinColumn } from "typeorm";
|
||||||
|
|
||||||
|
import { ProcurementTender } from "./procurement_tender";
|
||||||
|
import { ProcurementVendor } from "./procurement_vendor";
|
||||||
|
import { ProcurementPOStatus } from "../../types/procurement";
|
||||||
|
import { HrmsEmployee } from "../hrms/hrms_employee";
|
||||||
|
import { FinancePurchaseRequest } from "../finance/finance_purchase_requests";
|
||||||
|
import { FinanceCpv } from "../finance/finance_cpvs";
|
||||||
|
import { ProcurementPurchaseOrderItem } from "./procurement_purchase_order_item";
|
||||||
|
|
||||||
|
@Entity("procurement_purchase_order", { schema: "procurement" })
|
||||||
|
export class ProcurementPurchaseOrder {
|
||||||
|
@PrimaryGeneratedColumn("uuid")
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => ProcurementTender, { nullable: false })
|
||||||
|
@JoinColumn()
|
||||||
|
tender: ProcurementTender; // Tender
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 50, unique: true })
|
||||||
|
code: string; // Po Code Automaticaly
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 50, unique: true })
|
||||||
|
po_number: string; // Numero Ordem de Compra
|
||||||
|
|
||||||
|
@Column({ type: "date" })
|
||||||
|
po_date: Date; // Data Ordem de Compra
|
||||||
|
|
||||||
|
@Column({ type: "text", nullable: true })
|
||||||
|
address: string; // Morada / Address
|
||||||
|
|
||||||
|
@Column({ type: "text", nullable: true })
|
||||||
|
attention_to: string; // Send all queries about this order to the procurement office marked to
|
||||||
|
|
||||||
|
@Column({ type: "text", nullable: true })
|
||||||
|
amandement_number: string; // NNumero de Emenda
|
||||||
|
|
||||||
|
// =========================
|
||||||
|
// DELIVERY INFO
|
||||||
|
// =========================
|
||||||
|
|
||||||
|
@Column({ type: "text", nullable: true })
|
||||||
|
delivery_to: string; // Entregar a / Delivery to
|
||||||
|
|
||||||
|
@Column({ type: "date", nullable: true })
|
||||||
|
delivery_start_date: Date; // Data de Entrage / Delivery Date start
|
||||||
|
|
||||||
|
@Column({ type: "date", nullable: true })
|
||||||
|
delivery_end_date: Date; // Data de Entrage / Delivery Date end
|
||||||
|
|
||||||
|
@Column({ type: "text", nullable: true })
|
||||||
|
delivery_terms: string; // Pontos & termos de entrega
|
||||||
|
|
||||||
|
@ManyToOne(() => ProcurementVendor, { nullable: false })
|
||||||
|
@JoinColumn()
|
||||||
|
vendor: ProcurementVendor; // Vendedor / Vendor
|
||||||
|
|
||||||
|
@Column({ type: "text", nullable: true })
|
||||||
|
status: ProcurementPOStatus; // Approved / Rejected / Pending
|
||||||
|
|
||||||
|
// =========================
|
||||||
|
// APPROVAL
|
||||||
|
// =========================
|
||||||
|
|
||||||
|
@ManyToOne(() => HrmsEmployee, { onDelete: "NO ACTION", nullable: true })
|
||||||
|
@JoinColumn()
|
||||||
|
prepared_by: HrmsEmployee; // Preparado por
|
||||||
|
|
||||||
|
@Column({ type: "text", nullable: true })
|
||||||
|
prepared_by_signature_image: string;
|
||||||
|
|
||||||
|
@Column({ type: "text", nullable: true })
|
||||||
|
prepared_by_signature_hash: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => HrmsEmployee, { onDelete: "NO ACTION", nullable: true })
|
||||||
|
@JoinColumn()
|
||||||
|
approved_by: HrmsEmployee; // Aprovado por
|
||||||
|
|
||||||
|
@Column({ type: "text", nullable: true })
|
||||||
|
approved_by_signature_image: string;
|
||||||
|
|
||||||
|
@Column({ type: "text", nullable: true })
|
||||||
|
approved_by_signature_hash: string;
|
||||||
|
|
||||||
|
// =========================
|
||||||
|
// Requisitioner
|
||||||
|
// =========================
|
||||||
|
|
||||||
|
@Column({ type: "text", nullable: true })
|
||||||
|
requisitioner: string; // Requisitante / Requisitioner
|
||||||
|
|
||||||
|
@ManyToOne(() => FinancePurchaseRequest, { onDelete: "NO ACTION", nullable: true })
|
||||||
|
@JoinColumn()
|
||||||
|
pr_number: FinancePurchaseRequest; // Numero de Requisicao de Compra
|
||||||
|
|
||||||
|
@ManyToOne(() => FinanceCpv, { onDelete: "NO ACTION", nullable: true })
|
||||||
|
@JoinColumn()
|
||||||
|
cpv: FinanceCpv; // Numero de FCP / CPV Number :
|
||||||
|
|
||||||
|
// =========================
|
||||||
|
// RELATION
|
||||||
|
// =========================
|
||||||
|
|
||||||
|
@OneToMany(() => ProcurementPurchaseOrderItem, (item) => item.purchase_order, { cascade: true })
|
||||||
|
items: ProcurementPurchaseOrderItem[];
|
||||||
|
|
||||||
|
@Column({ type: "float8", default: 0 })
|
||||||
|
total_amount_usd: number; // Total Montante (USD)
|
||||||
|
|
||||||
|
// =========================
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
27
src/entity/procurement/procurement_purchase_order_item.ts
Normal file
27
src/entity/procurement/procurement_purchase_order_item.ts
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
import { Entity, PrimaryGeneratedColumn, Column, ManyToOne, JoinColumn } from "typeorm";
|
||||||
|
import { ProcurementPurchaseOrder } from "./procurement_purchase_order";
|
||||||
|
|
||||||
|
@Entity("procurement_purchase_order_item", { schema: "procurement" })
|
||||||
|
export class ProcurementPurchaseOrderItem {
|
||||||
|
@PrimaryGeneratedColumn("uuid")
|
||||||
|
id: string;
|
||||||
|
|
||||||
|
@ManyToOne(() => ProcurementPurchaseOrder, (po) => po.items, { onDelete: "CASCADE" })
|
||||||
|
@JoinColumn()
|
||||||
|
purchase_order: ProcurementPurchaseOrder;
|
||||||
|
|
||||||
|
@Column({ type: "text" })
|
||||||
|
description: string; // Descricao / Description
|
||||||
|
|
||||||
|
@Column({ type: "varchar", length: 50, nullable: true })
|
||||||
|
unit: string; // Unidade
|
||||||
|
|
||||||
|
@Column({ type: "int" })
|
||||||
|
quantity: number; // Quantidade
|
||||||
|
|
||||||
|
@Column({ type: "float8" })
|
||||||
|
unit_price_usd: number; // Preco Unitario (USD)
|
||||||
|
|
||||||
|
@Column({ type: "float8" })
|
||||||
|
amount_usd: number; // Montante (qty * unit price)
|
||||||
|
}
|
||||||
@ -6,5 +6,7 @@ export * from "../entity/procurement/procurement_checklist_payment";
|
|||||||
export * from "../entity/procurement/procurement_checklist_payment_item";
|
export * from "../entity/procurement/procurement_checklist_payment_item";
|
||||||
export * from "../entity/procurement/procurement_checklist_payment_document";
|
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_item";
|
||||||
|
|
||||||
export * from "../types/procurement";
|
export * from "../types/procurement";
|
||||||
|
|||||||
@ -63,3 +63,9 @@ export enum ProcurementChecklistPaymentType {
|
|||||||
SALARY_PAYMENT = "salary_payment",
|
SALARY_PAYMENT = "salary_payment",
|
||||||
DIRECT_PAYMENT = "direct_payment",
|
DIRECT_PAYMENT = "direct_payment",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum ProcurementPOStatus {
|
||||||
|
APPROVED = "APPROVED",
|
||||||
|
REJECTED = "REJECTED",
|
||||||
|
PENDING = "PENDING",
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user