import { Column, Entity, JoinColumn, ManyToOne, PrimaryGeneratedColumn, } from "typeorm"; import { Company, Local, User } from ".."; import { jsonTransformer } from "../transformers/jsonTransformer"; @Entity({ comment: "Personalización de las facturas de los pedidos para los restaurantes/empresas.", name: "receipt_config", }) export class ReceiptConfig { @PrimaryGeneratedColumn({ type: "int", comment: "ID único de cada registro.", }) id: number; @ManyToOne(() => Company, (company) => company.receipts_company_config, { onDelete: "CASCADE", onUpdate: "NO ACTION", nullable: true, }) @JoinColumn({ name: "company" }) company: Company | null; @ManyToOne(() => Local, (local) => local.receipts_local_config, { onDelete: "CASCADE", onUpdate: "NO ACTION", nullable: true, }) @JoinColumn({ name: "local" }) local: Local | null; @Column({ default: 1, type: "int", width: 1, comment: "Para saber sí mostramos el logo en la factura:\r\n0: No.\r\n1: Sí.", }) is_logo: number; @Column({ default: 1, type: "int", nullable: true, width: 1, comment: "Columna para saber si el logo va a ir redondeado o no:\r\n1. Redondeado.\r\n2. Cuadrado.", }) logo_type: number | null; @Column({ default: 1, type: "int", width: 1, comment: "Para saber sí mostramos la dirección del restaurante:\r\n0: No.\r\n1: Sí.", }) is_address: number; @Column({ default: 1, type: "int", width: 1, comment: "Para saber sí mostramos la el número de teléfono del restaurante:\r\n0: No.\r\n1: Sí.", }) is_phone: number; @Column({ length: 50, type: "varchar", default: "yyyy-mm-dd hh:mm:ss", comment: "Formato de la fecha que se va a mostrar. Este formato viene de la interfaz TFormatTypeDate que está en utils.ts", }) format_date: string; @Column({ length: 4, type: "varchar", default: "80mm", comment: "Tamaño que va a tener la impresión de facturas:\r\n1: 80mm.\r\n2: 58mm.", }) ticket_width_mm: string; @Column({ default: 1, type: "int", width: 1, comment: "Mostrar información del usuario que recibe el pago y entrega las cuentas:\r\n1: Sí.\r\n0: No.", }) is_show_user_box: number; @Column({ default: 1, type: "int", width: 1, comment: "Mostrar el precio unitario de los productos:\r\n1: Sí.\r\n0: No.", }) is_show_unit_price: number; @Column({ default: 1, type: "int", width: 1, comment: "Dividir en columnas separadas el nombre y la cantidad del producto:\r\n1: Sí.\r\n0: No.", }) is_divide_name_and_quantity: number; @Column({ type: "text", nullable: true, default: null, transformer: jsonTransformer, comment: "Comentarios a mostrar en la factura, esto será un elemento de tipo html por si el usuario lo quiere personalizar.", }) custom_message_below: any | null; @Column({ type: "text", nullable: true, default: null, transformer: jsonTransformer, comment: "Comentarios a mostrar en la factura, esto será un elemento de tipo html por si el usuario lo quiere personalizar.", }) custom_message_top: any | null; @Column({ type: "mediumtext", nullable: true, default: null, transformer: jsonTransformer, comment: "Columna creada por si se necesitan agregar más elementos adicionales para personalizar la factura.", }) details: any | null; @Column({ type: "datetime", comment: "Fecha de creación del registro.", default: () => "CURRENT_TIMESTAMP", }) created: Date; @Column({ type: "datetime", nullable: true, default: null, comment: "Fecha de actualización del registro.", onUpdate: "CURRENT_TIMESTAMP", }) updated: Date | null; @ManyToOne(() => User, (user) => user.receipts_user_config, { onDelete: "NO ACTION", onUpdate: "NO ACTION", }) @JoinColumn({ name: "updated_by" }) updated_by: User; @Column({ default: 1, type: "int", width: 1, comment: "Estado en el que se encuentra el registro:\r\n0: Inactivo.\r\n1: Activo.", }) status: number; }