proflores-db-model 0.2.45 → 0.2.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/entities/Bank/BankAccount.d.ts +2 -0
- package/dist/entities/Bank/BankAccount.js +5 -0
- package/dist/entities/Bank/TransactionBank.d.ts +2 -0
- package/dist/entities/Bank/TransactionBank.js +7 -0
- package/dist/entities/Payment.d.ts +35 -0
- package/dist/entities/Payment.js +139 -0
- package/dist/entities/PaymentCfdi.d.ts +41 -0
- package/dist/entities/PaymentCfdi.js +176 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -1
- package/dist/models/apu/Budget.d.ts +2 -0
- package/dist/models/apu/Budget.js +5 -0
- package/dist/models/apu/Client.d.ts +2 -0
- package/dist/models/apu/Client.js +5 -0
- package/package.json +1 -1
- package/src/entities/Bank/BankAccount.ts +4 -0
- package/src/entities/Bank/TransactionBank.ts +6 -0
- package/src/entities/Payment.ts +109 -0
- package/src/entities/PaymentCfdi.ts +134 -0
- package/src/index.ts +2 -0
- package/src/models/apu/Budget.ts +4 -0
- package/src/models/apu/Client.ts +5 -1
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { ObjectLiteral } from "typeorm";
|
|
2
2
|
import { TransactionBank } from "./TransactionBank";
|
|
3
|
+
import { Payment } from "../Payment";
|
|
3
4
|
export declare class BankAccount implements ObjectLiteral {
|
|
4
5
|
idBankAccount: number;
|
|
5
6
|
name: string;
|
|
6
7
|
accountNumber: string;
|
|
7
8
|
initialBalance: number;
|
|
8
9
|
transactions: TransactionBank[];
|
|
10
|
+
payments?: Payment[];
|
|
9
11
|
}
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.BankAccount = void 0;
|
|
13
13
|
const typeorm_1 = require("typeorm");
|
|
14
14
|
const TransactionBank_1 = require("./TransactionBank");
|
|
15
|
+
const Payment_1 = require("../Payment");
|
|
15
16
|
let BankAccount = class BankAccount {
|
|
16
17
|
};
|
|
17
18
|
exports.BankAccount = BankAccount;
|
|
@@ -35,6 +36,10 @@ __decorate([
|
|
|
35
36
|
(0, typeorm_1.OneToMany)(() => TransactionBank_1.TransactionBank, (transaction) => transaction.bankAccount),
|
|
36
37
|
__metadata("design:type", Array)
|
|
37
38
|
], BankAccount.prototype, "transactions", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, typeorm_1.OneToMany)(() => Payment_1.Payment, (payment) => payment.bankAccount),
|
|
41
|
+
__metadata("design:type", Array)
|
|
42
|
+
], BankAccount.prototype, "payments", void 0);
|
|
38
43
|
exports.BankAccount = BankAccount = __decorate([
|
|
39
44
|
(0, typeorm_1.Entity)("bank_accounts")
|
|
40
45
|
], BankAccount);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ObjectLiteral } from "typeorm";
|
|
2
2
|
import { BankAccount } from "./BankAccount";
|
|
3
3
|
import { ExpenseTransaction } from "../ExpenseTransaction";
|
|
4
|
+
import { Payment } from "../Payment";
|
|
4
5
|
export declare class TransactionBank implements ObjectLiteral {
|
|
5
6
|
idTransactionBank: number;
|
|
6
7
|
amount: number;
|
|
@@ -8,4 +9,5 @@ export declare class TransactionBank implements ObjectLiteral {
|
|
|
8
9
|
transactionDate: Date;
|
|
9
10
|
bankAccount: BankAccount;
|
|
10
11
|
expenseTransaction?: ExpenseTransaction;
|
|
12
|
+
payment?: Payment;
|
|
11
13
|
}
|
|
@@ -13,6 +13,7 @@ exports.TransactionBank = void 0;
|
|
|
13
13
|
const typeorm_1 = require("typeorm");
|
|
14
14
|
const BankAccount_1 = require("./BankAccount");
|
|
15
15
|
const ExpenseTransaction_1 = require("../ExpenseTransaction");
|
|
16
|
+
const Payment_1 = require("../Payment");
|
|
16
17
|
let TransactionBank = class TransactionBank {
|
|
17
18
|
};
|
|
18
19
|
exports.TransactionBank = TransactionBank;
|
|
@@ -46,6 +47,12 @@ __decorate([
|
|
|
46
47
|
(0, typeorm_1.JoinColumn)({ name: "expenseTransactionId" }),
|
|
47
48
|
__metadata("design:type", ExpenseTransaction_1.ExpenseTransaction)
|
|
48
49
|
], TransactionBank.prototype, "expenseTransaction", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, typeorm_1.OneToOne)(() => Payment_1.Payment, (payment) => payment.transactionBank, {
|
|
52
|
+
nullable: true
|
|
53
|
+
}),
|
|
54
|
+
__metadata("design:type", Payment_1.Payment)
|
|
55
|
+
], TransactionBank.prototype, "payment", void 0);
|
|
49
56
|
exports.TransactionBank = TransactionBank = __decorate([
|
|
50
57
|
(0, typeorm_1.Entity)("transactions_bank")
|
|
51
58
|
], TransactionBank);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ObjectLiteral } from "typeorm";
|
|
2
|
+
import { Budget } from "../models/apu/Budget";
|
|
3
|
+
import { Client } from "../models/apu/Client";
|
|
4
|
+
import { TransactionBank } from "./Bank/TransactionBank";
|
|
5
|
+
import { BankAccount } from "./Bank/BankAccount";
|
|
6
|
+
import { PaymentCfdi } from "./PaymentCfdi";
|
|
7
|
+
export declare class Payment implements ObjectLiteral {
|
|
8
|
+
idPayment: number;
|
|
9
|
+
budget: Budget;
|
|
10
|
+
client: Client;
|
|
11
|
+
amount: number;
|
|
12
|
+
totalBudgetAmount: number;
|
|
13
|
+
previousPayments: number;
|
|
14
|
+
remainingAmount: number;
|
|
15
|
+
paymentDate: Date;
|
|
16
|
+
paymentMethod: "CASH" | "BANK_TRANSFER" | "CARD" | "CHECK" | "OTHER";
|
|
17
|
+
status: "PENDING" | "CONFIRMED" | "CANCELLED" | "REFUNDED";
|
|
18
|
+
referenceNumber?: string | null;
|
|
19
|
+
invoiceNumber?: string | null;
|
|
20
|
+
invoiceUuid?: string | null;
|
|
21
|
+
notes?: string | null;
|
|
22
|
+
receiptUrl?: string | null;
|
|
23
|
+
currency: string;
|
|
24
|
+
exchangeRate?: number | null;
|
|
25
|
+
isPartialPayment: boolean;
|
|
26
|
+
paymentNumber?: number | null;
|
|
27
|
+
bankAccount?: BankAccount | null;
|
|
28
|
+
transactionBank?: TransactionBank | null;
|
|
29
|
+
createdAt: Date;
|
|
30
|
+
updatedAt: Date;
|
|
31
|
+
createdBy?: string | null;
|
|
32
|
+
confirmedBy?: string | null;
|
|
33
|
+
confirmedAt?: Date | null;
|
|
34
|
+
paymentCfdis?: PaymentCfdi[];
|
|
35
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Payment = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const Budget_1 = require("../models/apu/Budget");
|
|
15
|
+
const Client_1 = require("../models/apu/Client");
|
|
16
|
+
const TransactionBank_1 = require("./Bank/TransactionBank");
|
|
17
|
+
const BankAccount_1 = require("./Bank/BankAccount");
|
|
18
|
+
const PaymentCfdi_1 = require("./PaymentCfdi");
|
|
19
|
+
let Payment = class Payment {
|
|
20
|
+
};
|
|
21
|
+
exports.Payment = Payment;
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, typeorm_1.PrimaryGeneratedColumn)("increment"),
|
|
24
|
+
__metadata("design:type", Number)
|
|
25
|
+
], Payment.prototype, "idPayment", void 0);
|
|
26
|
+
__decorate([
|
|
27
|
+
(0, typeorm_1.ManyToOne)(() => Budget_1.Budget, { nullable: false, onDelete: "RESTRICT" }),
|
|
28
|
+
(0, typeorm_1.JoinColumn)({ name: "idBudget" }),
|
|
29
|
+
__metadata("design:type", Budget_1.Budget)
|
|
30
|
+
], Payment.prototype, "budget", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, typeorm_1.ManyToOne)(() => Client_1.Client, { nullable: false, onDelete: "RESTRICT" }),
|
|
33
|
+
(0, typeorm_1.JoinColumn)({ name: "idClient" }),
|
|
34
|
+
__metadata("design:type", Client_1.Client)
|
|
35
|
+
], Payment.prototype, "client", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, typeorm_1.Column)("decimal", { precision: 12, scale: 2, nullable: false }),
|
|
38
|
+
__metadata("design:type", Number)
|
|
39
|
+
], Payment.prototype, "amount", void 0);
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, typeorm_1.Column)("decimal", { precision: 12, scale: 2, nullable: false }),
|
|
42
|
+
__metadata("design:type", Number)
|
|
43
|
+
], Payment.prototype, "totalBudgetAmount", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, typeorm_1.Column)("decimal", { precision: 12, scale: 2, default: 0 }),
|
|
46
|
+
__metadata("design:type", Number)
|
|
47
|
+
], Payment.prototype, "previousPayments", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, typeorm_1.Column)("decimal", { precision: 12, scale: 2 }),
|
|
50
|
+
__metadata("design:type", Number)
|
|
51
|
+
], Payment.prototype, "remainingAmount", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, typeorm_1.Column)("date", { nullable: false }),
|
|
54
|
+
__metadata("design:type", Date)
|
|
55
|
+
], Payment.prototype, "paymentDate", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, typeorm_1.Column)("varchar", { length: 32, nullable: false }),
|
|
58
|
+
__metadata("design:type", String)
|
|
59
|
+
], Payment.prototype, "paymentMethod", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, typeorm_1.Column)("varchar", { length: 32, nullable: false, default: "PENDING" }),
|
|
62
|
+
__metadata("design:type", String)
|
|
63
|
+
], Payment.prototype, "status", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, typeorm_1.Column)("varchar", { length: 255, nullable: true }),
|
|
66
|
+
__metadata("design:type", Object)
|
|
67
|
+
], Payment.prototype, "referenceNumber", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
(0, typeorm_1.Column)("varchar", { length: 255, nullable: true }),
|
|
70
|
+
__metadata("design:type", Object)
|
|
71
|
+
], Payment.prototype, "invoiceNumber", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, typeorm_1.Column)("varchar", { length: 255, nullable: true }),
|
|
74
|
+
__metadata("design:type", Object)
|
|
75
|
+
], Payment.prototype, "invoiceUuid", void 0);
|
|
76
|
+
__decorate([
|
|
77
|
+
(0, typeorm_1.Column)("text", { nullable: true }),
|
|
78
|
+
__metadata("design:type", Object)
|
|
79
|
+
], Payment.prototype, "notes", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
(0, typeorm_1.Column)("varchar", { length: 255, nullable: true }),
|
|
82
|
+
__metadata("design:type", Object)
|
|
83
|
+
], Payment.prototype, "receiptUrl", void 0);
|
|
84
|
+
__decorate([
|
|
85
|
+
(0, typeorm_1.Column)("varchar", { length: 3, default: "MXN" }),
|
|
86
|
+
__metadata("design:type", String)
|
|
87
|
+
], Payment.prototype, "currency", void 0);
|
|
88
|
+
__decorate([
|
|
89
|
+
(0, typeorm_1.Column)("decimal", { precision: 10, scale: 4, nullable: true }),
|
|
90
|
+
__metadata("design:type", Object)
|
|
91
|
+
], Payment.prototype, "exchangeRate", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
(0, typeorm_1.Column)("boolean", { default: false }),
|
|
94
|
+
__metadata("design:type", Boolean)
|
|
95
|
+
], Payment.prototype, "isPartialPayment", void 0);
|
|
96
|
+
__decorate([
|
|
97
|
+
(0, typeorm_1.Column)("integer", { nullable: true }),
|
|
98
|
+
__metadata("design:type", Object)
|
|
99
|
+
], Payment.prototype, "paymentNumber", void 0);
|
|
100
|
+
__decorate([
|
|
101
|
+
(0, typeorm_1.ManyToOne)(() => BankAccount_1.BankAccount, { nullable: true }),
|
|
102
|
+
(0, typeorm_1.JoinColumn)({ name: "idBankAccount" }),
|
|
103
|
+
__metadata("design:type", Object)
|
|
104
|
+
], Payment.prototype, "bankAccount", void 0);
|
|
105
|
+
__decorate([
|
|
106
|
+
(0, typeorm_1.OneToOne)(() => TransactionBank_1.TransactionBank, { nullable: true, cascade: true }),
|
|
107
|
+
(0, typeorm_1.JoinColumn)({ name: "idTransactionBank" }),
|
|
108
|
+
__metadata("design:type", Object)
|
|
109
|
+
], Payment.prototype, "transactionBank", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
(0, typeorm_1.CreateDateColumn)({ type: "timestamp" }),
|
|
112
|
+
__metadata("design:type", Date)
|
|
113
|
+
], Payment.prototype, "createdAt", void 0);
|
|
114
|
+
__decorate([
|
|
115
|
+
(0, typeorm_1.UpdateDateColumn)({ type: "timestamp" }),
|
|
116
|
+
__metadata("design:type", Date)
|
|
117
|
+
], Payment.prototype, "updatedAt", void 0);
|
|
118
|
+
__decorate([
|
|
119
|
+
(0, typeorm_1.Column)("varchar", { length: 255, nullable: true }),
|
|
120
|
+
__metadata("design:type", Object)
|
|
121
|
+
], Payment.prototype, "createdBy", void 0);
|
|
122
|
+
__decorate([
|
|
123
|
+
(0, typeorm_1.Column)("varchar", { length: 255, nullable: true }),
|
|
124
|
+
__metadata("design:type", Object)
|
|
125
|
+
], Payment.prototype, "confirmedBy", void 0);
|
|
126
|
+
__decorate([
|
|
127
|
+
(0, typeorm_1.Column)("timestamp", { nullable: true }),
|
|
128
|
+
__metadata("design:type", Object)
|
|
129
|
+
], Payment.prototype, "confirmedAt", void 0);
|
|
130
|
+
__decorate([
|
|
131
|
+
(0, typeorm_1.OneToMany)(() => PaymentCfdi_1.PaymentCfdi, (paymentCfdi) => paymentCfdi.payment, { cascade: true }),
|
|
132
|
+
__metadata("design:type", Array)
|
|
133
|
+
], Payment.prototype, "paymentCfdis", void 0);
|
|
134
|
+
exports.Payment = Payment = __decorate([
|
|
135
|
+
(0, typeorm_1.Entity)("payments"),
|
|
136
|
+
(0, typeorm_1.Index)(["budget", "paymentDate"]),
|
|
137
|
+
(0, typeorm_1.Index)(["client", "paymentDate"]),
|
|
138
|
+
(0, typeorm_1.Index)(["status"])
|
|
139
|
+
], Payment);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ObjectLiteral } from "typeorm";
|
|
2
|
+
import { Payment } from "./Payment";
|
|
3
|
+
export declare class PaymentCfdi implements ObjectLiteral {
|
|
4
|
+
idPaymentCfdi: number;
|
|
5
|
+
payment: Payment;
|
|
6
|
+
uuid: string;
|
|
7
|
+
fiscalApiId: string;
|
|
8
|
+
series?: string | null;
|
|
9
|
+
number?: string | null;
|
|
10
|
+
cfdiDate: Date;
|
|
11
|
+
typeCode: string;
|
|
12
|
+
status: "ACTIVE" | "CANCELLED" | "PENDING";
|
|
13
|
+
certificateNumber?: string | null;
|
|
14
|
+
base64Xml?: string | null;
|
|
15
|
+
base64QrCode?: string | null;
|
|
16
|
+
base64Seal?: string | null;
|
|
17
|
+
signatureDate?: Date | null;
|
|
18
|
+
satCertificateNumber?: string | null;
|
|
19
|
+
satBase64Seal?: string | null;
|
|
20
|
+
issuerTin?: string | null;
|
|
21
|
+
issuerLegalName?: string | null;
|
|
22
|
+
recipientTin?: string | null;
|
|
23
|
+
recipientLegalName?: string | null;
|
|
24
|
+
recipientZipCode?: string | null;
|
|
25
|
+
cfdiUseCode?: string | null;
|
|
26
|
+
paymentAmount: number;
|
|
27
|
+
paymentCurrency: string;
|
|
28
|
+
paymentMethod?: string | null;
|
|
29
|
+
relatedInvoiceUuid?: string | null;
|
|
30
|
+
installmentNumber?: number | null;
|
|
31
|
+
previousBalance?: number | null;
|
|
32
|
+
paidAmount?: number | null;
|
|
33
|
+
remainingBalance?: number | null;
|
|
34
|
+
fiscalApiResponse?: string | null;
|
|
35
|
+
cancelledBy?: string | null;
|
|
36
|
+
cancelledAt?: Date | null;
|
|
37
|
+
cancellationReason?: string | null;
|
|
38
|
+
cancellationUuid?: string | null;
|
|
39
|
+
createdAt: Date;
|
|
40
|
+
updatedAt: Date;
|
|
41
|
+
}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.PaymentCfdi = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const Payment_1 = require("./Payment");
|
|
15
|
+
let PaymentCfdi = class PaymentCfdi {
|
|
16
|
+
};
|
|
17
|
+
exports.PaymentCfdi = PaymentCfdi;
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, typeorm_1.PrimaryGeneratedColumn)("increment"),
|
|
20
|
+
__metadata("design:type", Number)
|
|
21
|
+
], PaymentCfdi.prototype, "idPaymentCfdi", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, typeorm_1.ManyToOne)(() => Payment_1.Payment, (payment) => payment.paymentCfdis, {
|
|
24
|
+
nullable: false,
|
|
25
|
+
onDelete: "CASCADE"
|
|
26
|
+
}),
|
|
27
|
+
(0, typeorm_1.JoinColumn)({ name: "idPayment" }),
|
|
28
|
+
__metadata("design:type", Payment_1.Payment)
|
|
29
|
+
], PaymentCfdi.prototype, "payment", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, typeorm_1.Column)("varchar", { length: 255, unique: true }),
|
|
32
|
+
__metadata("design:type", String)
|
|
33
|
+
], PaymentCfdi.prototype, "uuid", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, typeorm_1.Column)("varchar", { length: 255, unique: true }),
|
|
36
|
+
__metadata("design:type", String)
|
|
37
|
+
], PaymentCfdi.prototype, "fiscalApiId", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, typeorm_1.Column)("varchar", { length: 10, nullable: true }),
|
|
40
|
+
__metadata("design:type", Object)
|
|
41
|
+
], PaymentCfdi.prototype, "series", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, typeorm_1.Column)("varchar", { length: 50, nullable: true }),
|
|
44
|
+
__metadata("design:type", Object)
|
|
45
|
+
], PaymentCfdi.prototype, "number", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, typeorm_1.Column)("timestamp", { nullable: false }),
|
|
48
|
+
__metadata("design:type", Date)
|
|
49
|
+
], PaymentCfdi.prototype, "cfdiDate", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, typeorm_1.Column)("varchar", { length: 10, default: "P" }),
|
|
52
|
+
__metadata("design:type", String)
|
|
53
|
+
], PaymentCfdi.prototype, "typeCode", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, typeorm_1.Column)("varchar", { length: 32, default: "ACTIVE" }),
|
|
56
|
+
__metadata("design:type", String)
|
|
57
|
+
], PaymentCfdi.prototype, "status", void 0);
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, typeorm_1.Column)("varchar", { length: 255, nullable: true }),
|
|
60
|
+
__metadata("design:type", Object)
|
|
61
|
+
], PaymentCfdi.prototype, "certificateNumber", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, typeorm_1.Column)("text", { nullable: true }),
|
|
64
|
+
__metadata("design:type", Object)
|
|
65
|
+
], PaymentCfdi.prototype, "base64Xml", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
(0, typeorm_1.Column)("text", { nullable: true }),
|
|
68
|
+
__metadata("design:type", Object)
|
|
69
|
+
], PaymentCfdi.prototype, "base64QrCode", void 0);
|
|
70
|
+
__decorate([
|
|
71
|
+
(0, typeorm_1.Column)("text", { nullable: true }),
|
|
72
|
+
__metadata("design:type", Object)
|
|
73
|
+
], PaymentCfdi.prototype, "base64Seal", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, typeorm_1.Column)("timestamp", { nullable: true }),
|
|
76
|
+
__metadata("design:type", Object)
|
|
77
|
+
], PaymentCfdi.prototype, "signatureDate", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, typeorm_1.Column)("varchar", { length: 255, nullable: true }),
|
|
80
|
+
__metadata("design:type", Object)
|
|
81
|
+
], PaymentCfdi.prototype, "satCertificateNumber", void 0);
|
|
82
|
+
__decorate([
|
|
83
|
+
(0, typeorm_1.Column)("text", { nullable: true }),
|
|
84
|
+
__metadata("design:type", Object)
|
|
85
|
+
], PaymentCfdi.prototype, "satBase64Seal", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
(0, typeorm_1.Column)("varchar", { length: 13, nullable: true }),
|
|
88
|
+
__metadata("design:type", Object)
|
|
89
|
+
], PaymentCfdi.prototype, "issuerTin", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
(0, typeorm_1.Column)("varchar", { length: 255, nullable: true }),
|
|
92
|
+
__metadata("design:type", Object)
|
|
93
|
+
], PaymentCfdi.prototype, "issuerLegalName", void 0);
|
|
94
|
+
__decorate([
|
|
95
|
+
(0, typeorm_1.Column)("varchar", { length: 13, nullable: true }),
|
|
96
|
+
__metadata("design:type", Object)
|
|
97
|
+
], PaymentCfdi.prototype, "recipientTin", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
(0, typeorm_1.Column)("varchar", { length: 255, nullable: true }),
|
|
100
|
+
__metadata("design:type", Object)
|
|
101
|
+
], PaymentCfdi.prototype, "recipientLegalName", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
(0, typeorm_1.Column)("varchar", { length: 10, nullable: true }),
|
|
104
|
+
__metadata("design:type", Object)
|
|
105
|
+
], PaymentCfdi.prototype, "recipientZipCode", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
(0, typeorm_1.Column)("varchar", { length: 10, nullable: true }),
|
|
108
|
+
__metadata("design:type", Object)
|
|
109
|
+
], PaymentCfdi.prototype, "cfdiUseCode", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
(0, typeorm_1.Column)("decimal", { precision: 12, scale: 2, nullable: false }),
|
|
112
|
+
__metadata("design:type", Number)
|
|
113
|
+
], PaymentCfdi.prototype, "paymentAmount", void 0);
|
|
114
|
+
__decorate([
|
|
115
|
+
(0, typeorm_1.Column)("varchar", { length: 3, default: "MXN" }),
|
|
116
|
+
__metadata("design:type", String)
|
|
117
|
+
], PaymentCfdi.prototype, "paymentCurrency", void 0);
|
|
118
|
+
__decorate([
|
|
119
|
+
(0, typeorm_1.Column)("varchar", { length: 50, nullable: true }),
|
|
120
|
+
__metadata("design:type", Object)
|
|
121
|
+
], PaymentCfdi.prototype, "paymentMethod", void 0);
|
|
122
|
+
__decorate([
|
|
123
|
+
(0, typeorm_1.Column)("varchar", { length: 255, nullable: true }),
|
|
124
|
+
__metadata("design:type", Object)
|
|
125
|
+
], PaymentCfdi.prototype, "relatedInvoiceUuid", void 0);
|
|
126
|
+
__decorate([
|
|
127
|
+
(0, typeorm_1.Column)("integer", { nullable: true }),
|
|
128
|
+
__metadata("design:type", Object)
|
|
129
|
+
], PaymentCfdi.prototype, "installmentNumber", void 0);
|
|
130
|
+
__decorate([
|
|
131
|
+
(0, typeorm_1.Column)("decimal", { precision: 12, scale: 2, nullable: true }),
|
|
132
|
+
__metadata("design:type", Object)
|
|
133
|
+
], PaymentCfdi.prototype, "previousBalance", void 0);
|
|
134
|
+
__decorate([
|
|
135
|
+
(0, typeorm_1.Column)("decimal", { precision: 12, scale: 2, nullable: true }),
|
|
136
|
+
__metadata("design:type", Object)
|
|
137
|
+
], PaymentCfdi.prototype, "paidAmount", void 0);
|
|
138
|
+
__decorate([
|
|
139
|
+
(0, typeorm_1.Column)("decimal", { precision: 12, scale: 2, nullable: true }),
|
|
140
|
+
__metadata("design:type", Object)
|
|
141
|
+
], PaymentCfdi.prototype, "remainingBalance", void 0);
|
|
142
|
+
__decorate([
|
|
143
|
+
(0, typeorm_1.Column)("text", { nullable: true }),
|
|
144
|
+
__metadata("design:type", Object)
|
|
145
|
+
], PaymentCfdi.prototype, "fiscalApiResponse", void 0);
|
|
146
|
+
__decorate([
|
|
147
|
+
(0, typeorm_1.Column)("varchar", { length: 255, nullable: true }),
|
|
148
|
+
__metadata("design:type", Object)
|
|
149
|
+
], PaymentCfdi.prototype, "cancelledBy", void 0);
|
|
150
|
+
__decorate([
|
|
151
|
+
(0, typeorm_1.Column)("timestamp", { nullable: true }),
|
|
152
|
+
__metadata("design:type", Object)
|
|
153
|
+
], PaymentCfdi.prototype, "cancelledAt", void 0);
|
|
154
|
+
__decorate([
|
|
155
|
+
(0, typeorm_1.Column)("text", { nullable: true }),
|
|
156
|
+
__metadata("design:type", Object)
|
|
157
|
+
], PaymentCfdi.prototype, "cancellationReason", void 0);
|
|
158
|
+
__decorate([
|
|
159
|
+
(0, typeorm_1.Column)("varchar", { length: 255, nullable: true }),
|
|
160
|
+
__metadata("design:type", Object)
|
|
161
|
+
], PaymentCfdi.prototype, "cancellationUuid", void 0);
|
|
162
|
+
__decorate([
|
|
163
|
+
(0, typeorm_1.CreateDateColumn)({ type: "timestamp" }),
|
|
164
|
+
__metadata("design:type", Date)
|
|
165
|
+
], PaymentCfdi.prototype, "createdAt", void 0);
|
|
166
|
+
__decorate([
|
|
167
|
+
(0, typeorm_1.UpdateDateColumn)({ type: "timestamp" }),
|
|
168
|
+
__metadata("design:type", Date)
|
|
169
|
+
], PaymentCfdi.prototype, "updatedAt", void 0);
|
|
170
|
+
exports.PaymentCfdi = PaymentCfdi = __decorate([
|
|
171
|
+
(0, typeorm_1.Entity)("payment_cfdi"),
|
|
172
|
+
(0, typeorm_1.Index)(["payment", "createdAt"]),
|
|
173
|
+
(0, typeorm_1.Index)(["uuid"], { unique: true }),
|
|
174
|
+
(0, typeorm_1.Index)(["fiscalApiId"], { unique: true }),
|
|
175
|
+
(0, typeorm_1.Index)(["status"])
|
|
176
|
+
], PaymentCfdi);
|
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ export { Branch } from "./entities/Branches";
|
|
|
19
19
|
export { BranchImage } from "./entities/BranchImage";
|
|
20
20
|
export { SupplierImage } from "./entities/SupplierImage";
|
|
21
21
|
export { InventoryImage } from "./entities/InventoryImage";
|
|
22
|
+
export { Payment } from "./entities/Payment";
|
|
23
|
+
export { PaymentCfdi } from "./entities/PaymentCfdi";
|
|
22
24
|
export * from "./types";
|
|
23
25
|
export * from "./models/technical-sheet";
|
|
24
26
|
export * from "./models/apu";
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.InventoryImage = exports.SupplierImage = exports.BranchImage = exports.Branch = exports.InventoryMovement = exports.Inventory = exports.Product = exports.ProductImage = exports.TransactionBank = exports.BankAccount = exports.UnitOfMeasure = exports.CategoryForPlantType = exports.CategoryForCosting = exports.Supplier = exports.ContainerType = exports.InventoryItem = exports.ExpenseTransaction = exports.User = exports.ProjectOrder = exports.ExpenseType = exports.ExpenseDetail = void 0;
|
|
17
|
+
exports.PaymentCfdi = exports.Payment = exports.InventoryImage = exports.SupplierImage = exports.BranchImage = exports.Branch = exports.InventoryMovement = exports.Inventory = exports.Product = exports.ProductImage = exports.TransactionBank = exports.BankAccount = exports.UnitOfMeasure = exports.CategoryForPlantType = exports.CategoryForCosting = exports.Supplier = exports.ContainerType = exports.InventoryItem = exports.ExpenseTransaction = exports.User = exports.ProjectOrder = exports.ExpenseType = exports.ExpenseDetail = void 0;
|
|
18
18
|
var ExpenseDetail_1 = require("./entities/ExpenseDetail");
|
|
19
19
|
Object.defineProperty(exports, "ExpenseDetail", { enumerable: true, get: function () { return ExpenseDetail_1.ExpenseDetail; } });
|
|
20
20
|
var ExpenseType_1 = require("./entities/ExpenseType");
|
|
@@ -57,6 +57,10 @@ var SupplierImage_1 = require("./entities/SupplierImage");
|
|
|
57
57
|
Object.defineProperty(exports, "SupplierImage", { enumerable: true, get: function () { return SupplierImage_1.SupplierImage; } });
|
|
58
58
|
var InventoryImage_1 = require("./entities/InventoryImage");
|
|
59
59
|
Object.defineProperty(exports, "InventoryImage", { enumerable: true, get: function () { return InventoryImage_1.InventoryImage; } });
|
|
60
|
+
var Payment_1 = require("./entities/Payment");
|
|
61
|
+
Object.defineProperty(exports, "Payment", { enumerable: true, get: function () { return Payment_1.Payment; } });
|
|
62
|
+
var PaymentCfdi_1 = require("./entities/PaymentCfdi");
|
|
63
|
+
Object.defineProperty(exports, "PaymentCfdi", { enumerable: true, get: function () { return PaymentCfdi_1.PaymentCfdi; } });
|
|
60
64
|
__exportStar(require("./types"), exports);
|
|
61
65
|
__exportStar(require("./models/technical-sheet"), exports);
|
|
62
66
|
__exportStar(require("./models/apu"), exports);
|
|
@@ -2,6 +2,7 @@ import { ObjectLiteral } from "typeorm";
|
|
|
2
2
|
import { Project } from "./Project";
|
|
3
3
|
import { BudgetItem } from "./BudgetItem";
|
|
4
4
|
import { BudgetCancellationFolio } from "./BudgetCancellationFolio";
|
|
5
|
+
import { Payment } from "../../entities/Payment";
|
|
5
6
|
export declare class Budget implements ObjectLiteral {
|
|
6
7
|
idBudget: number;
|
|
7
8
|
project: Project;
|
|
@@ -17,4 +18,5 @@ export declare class Budget implements ObjectLiteral {
|
|
|
17
18
|
fiscalApiId?: string | null;
|
|
18
19
|
items?: BudgetItem[];
|
|
19
20
|
cancellationFolios?: BudgetCancellationFolio[];
|
|
21
|
+
payments?: Payment[];
|
|
20
22
|
}
|
|
@@ -15,6 +15,7 @@ const typeorm_1 = require("typeorm");
|
|
|
15
15
|
const Project_1 = require("./Project");
|
|
16
16
|
const BudgetItem_1 = require("./BudgetItem");
|
|
17
17
|
const BudgetCancellationFolio_1 = require("./BudgetCancellationFolio");
|
|
18
|
+
const Payment_1 = require("../../entities/Payment");
|
|
18
19
|
let Budget = class Budget {
|
|
19
20
|
};
|
|
20
21
|
exports.Budget = Budget;
|
|
@@ -75,6 +76,10 @@ __decorate([
|
|
|
75
76
|
(0, typeorm_1.OneToMany)(() => BudgetCancellationFolio_1.BudgetCancellationFolio, (bcf) => bcf.budget, { cascade: true }),
|
|
76
77
|
__metadata("design:type", Array)
|
|
77
78
|
], Budget.prototype, "cancellationFolios", void 0);
|
|
79
|
+
__decorate([
|
|
80
|
+
(0, typeorm_1.OneToMany)(() => Payment_1.Payment, (payment) => payment.budget),
|
|
81
|
+
__metadata("design:type", Array)
|
|
82
|
+
], Budget.prototype, "payments", void 0);
|
|
78
83
|
exports.Budget = Budget = __decorate([
|
|
79
84
|
(0, typeorm_1.Entity)("budgets"),
|
|
80
85
|
(0, typeorm_1.Index)(["project"])
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ObjectLiteral } from "typeorm";
|
|
2
|
+
import { Payment } from "../../entities/Payment";
|
|
2
3
|
export declare class Client implements ObjectLiteral {
|
|
3
4
|
idClient: number;
|
|
4
5
|
displayName: string;
|
|
@@ -12,4 +13,5 @@ export declare class Client implements ObjectLiteral {
|
|
|
12
13
|
state?: string | null;
|
|
13
14
|
country?: string | null;
|
|
14
15
|
postalCode?: string | null;
|
|
16
|
+
payments?: Payment[];
|
|
15
17
|
}
|
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.Client = void 0;
|
|
13
13
|
// apu/entities/Client.ts
|
|
14
14
|
const typeorm_1 = require("typeorm");
|
|
15
|
+
const Payment_1 = require("../../entities/Payment");
|
|
15
16
|
let Client = class Client {
|
|
16
17
|
};
|
|
17
18
|
exports.Client = Client;
|
|
@@ -63,6 +64,10 @@ __decorate([
|
|
|
63
64
|
(0, typeorm_1.Column)("varchar", { length: 16, nullable: true }),
|
|
64
65
|
__metadata("design:type", Object)
|
|
65
66
|
], Client.prototype, "postalCode", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
(0, typeorm_1.OneToMany)(() => Payment_1.Payment, (payment) => payment.client),
|
|
69
|
+
__metadata("design:type", Array)
|
|
70
|
+
], Client.prototype, "payments", void 0);
|
|
66
71
|
exports.Client = Client = __decorate([
|
|
67
72
|
(0, typeorm_1.Entity)("clients")
|
|
68
73
|
], Client);
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Entity, PrimaryGeneratedColumn, Column, OneToMany, ObjectLiteral } from "typeorm";
|
|
2
2
|
import { TransactionBank } from "./TransactionBank";
|
|
3
|
+
import { Payment } from "../Payment";
|
|
3
4
|
|
|
4
5
|
@Entity("bank_accounts")
|
|
5
6
|
export class BankAccount implements ObjectLiteral {
|
|
@@ -17,4 +18,7 @@ export class BankAccount implements ObjectLiteral {
|
|
|
17
18
|
|
|
18
19
|
@OneToMany(() => TransactionBank, (transaction) => transaction.bankAccount)
|
|
19
20
|
transactions!: TransactionBank[];
|
|
21
|
+
|
|
22
|
+
@OneToMany(() => Payment, (payment) => payment.bankAccount)
|
|
23
|
+
payments?: Payment[];
|
|
20
24
|
}
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from "typeorm";
|
|
10
10
|
import { BankAccount } from "./BankAccount";
|
|
11
11
|
import { ExpenseTransaction } from "../ExpenseTransaction";
|
|
12
|
+
import { Payment } from "../Payment";
|
|
12
13
|
|
|
13
14
|
@Entity("transactions_bank")
|
|
14
15
|
export class TransactionBank implements ObjectLiteral {
|
|
@@ -34,5 +35,10 @@ import {
|
|
|
34
35
|
})
|
|
35
36
|
@JoinColumn({ name: "expenseTransactionId" })
|
|
36
37
|
expenseTransaction?: ExpenseTransaction;
|
|
38
|
+
|
|
39
|
+
@OneToOne(() => Payment, (payment) => payment.transactionBank, {
|
|
40
|
+
nullable: true
|
|
41
|
+
})
|
|
42
|
+
payment?: Payment;
|
|
37
43
|
}
|
|
38
44
|
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Entity,
|
|
3
|
+
PrimaryGeneratedColumn,
|
|
4
|
+
Column,
|
|
5
|
+
ManyToOne,
|
|
6
|
+
OneToOne,
|
|
7
|
+
OneToMany,
|
|
8
|
+
JoinColumn,
|
|
9
|
+
ObjectLiteral,
|
|
10
|
+
CreateDateColumn,
|
|
11
|
+
UpdateDateColumn,
|
|
12
|
+
Index
|
|
13
|
+
} from "typeorm";
|
|
14
|
+
import { Budget } from "../models/apu/Budget";
|
|
15
|
+
import { Client } from "../models/apu/Client";
|
|
16
|
+
import { TransactionBank } from "./Bank/TransactionBank";
|
|
17
|
+
import { BankAccount } from "./Bank/BankAccount";
|
|
18
|
+
import { PaymentCfdi } from "./PaymentCfdi";
|
|
19
|
+
|
|
20
|
+
@Entity("payments")
|
|
21
|
+
@Index(["budget", "paymentDate"])
|
|
22
|
+
@Index(["client", "paymentDate"])
|
|
23
|
+
@Index(["status"])
|
|
24
|
+
export class Payment implements ObjectLiteral {
|
|
25
|
+
@PrimaryGeneratedColumn("increment")
|
|
26
|
+
idPayment!: number;
|
|
27
|
+
|
|
28
|
+
@ManyToOne(() => Budget, { nullable: false, onDelete: "RESTRICT" })
|
|
29
|
+
@JoinColumn({ name: "idBudget" })
|
|
30
|
+
budget!: Budget;
|
|
31
|
+
|
|
32
|
+
@ManyToOne(() => Client, { nullable: false, onDelete: "RESTRICT" })
|
|
33
|
+
@JoinColumn({ name: "idClient" })
|
|
34
|
+
client!: Client;
|
|
35
|
+
|
|
36
|
+
@Column("decimal", { precision: 12, scale: 2, nullable: false })
|
|
37
|
+
amount!: number;
|
|
38
|
+
|
|
39
|
+
@Column("decimal", { precision: 12, scale: 2, nullable: false })
|
|
40
|
+
totalBudgetAmount!: number;
|
|
41
|
+
|
|
42
|
+
@Column("decimal", { precision: 12, scale: 2, default: 0 })
|
|
43
|
+
previousPayments!: number;
|
|
44
|
+
|
|
45
|
+
@Column("decimal", { precision: 12, scale: 2 })
|
|
46
|
+
remainingAmount!: number;
|
|
47
|
+
|
|
48
|
+
@Column("date", { nullable: false })
|
|
49
|
+
paymentDate!: Date;
|
|
50
|
+
|
|
51
|
+
@Column("varchar", { length: 32, nullable: false })
|
|
52
|
+
paymentMethod!: "CASH" | "BANK_TRANSFER" | "CARD" | "CHECK" | "OTHER";
|
|
53
|
+
|
|
54
|
+
@Column("varchar", { length: 32, nullable: false, default: "PENDING" })
|
|
55
|
+
status!: "PENDING" | "CONFIRMED" | "CANCELLED" | "REFUNDED";
|
|
56
|
+
|
|
57
|
+
@Column("varchar", { length: 255, nullable: true })
|
|
58
|
+
referenceNumber?: string | null;
|
|
59
|
+
|
|
60
|
+
@Column("varchar", { length: 255, nullable: true })
|
|
61
|
+
invoiceNumber?: string | null;
|
|
62
|
+
|
|
63
|
+
@Column("varchar", { length: 255, nullable: true })
|
|
64
|
+
invoiceUuid?: string | null;
|
|
65
|
+
|
|
66
|
+
@Column("text", { nullable: true })
|
|
67
|
+
notes?: string | null;
|
|
68
|
+
|
|
69
|
+
@Column("varchar", { length: 255, nullable: true })
|
|
70
|
+
receiptUrl?: string | null;
|
|
71
|
+
|
|
72
|
+
@Column("varchar", { length: 3, default: "MXN" })
|
|
73
|
+
currency!: string;
|
|
74
|
+
|
|
75
|
+
@Column("decimal", { precision: 10, scale: 4, nullable: true })
|
|
76
|
+
exchangeRate?: number | null;
|
|
77
|
+
|
|
78
|
+
@Column("boolean", { default: false })
|
|
79
|
+
isPartialPayment!: boolean;
|
|
80
|
+
|
|
81
|
+
@Column("integer", { nullable: true })
|
|
82
|
+
paymentNumber?: number | null;
|
|
83
|
+
|
|
84
|
+
@ManyToOne(() => BankAccount, { nullable: true })
|
|
85
|
+
@JoinColumn({ name: "idBankAccount" })
|
|
86
|
+
bankAccount?: BankAccount | null;
|
|
87
|
+
|
|
88
|
+
@OneToOne(() => TransactionBank, { nullable: true, cascade: true })
|
|
89
|
+
@JoinColumn({ name: "idTransactionBank" })
|
|
90
|
+
transactionBank?: TransactionBank | null;
|
|
91
|
+
|
|
92
|
+
@CreateDateColumn({ type: "timestamp" })
|
|
93
|
+
createdAt!: Date;
|
|
94
|
+
|
|
95
|
+
@UpdateDateColumn({ type: "timestamp" })
|
|
96
|
+
updatedAt!: Date;
|
|
97
|
+
|
|
98
|
+
@Column("varchar", { length: 255, nullable: true })
|
|
99
|
+
createdBy?: string | null;
|
|
100
|
+
|
|
101
|
+
@Column("varchar", { length: 255, nullable: true })
|
|
102
|
+
confirmedBy?: string | null;
|
|
103
|
+
|
|
104
|
+
@Column("timestamp", { nullable: true })
|
|
105
|
+
confirmedAt?: Date | null;
|
|
106
|
+
|
|
107
|
+
@OneToMany(() => PaymentCfdi, (paymentCfdi) => paymentCfdi.payment, { cascade: true })
|
|
108
|
+
paymentCfdis?: PaymentCfdi[];
|
|
109
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Entity,
|
|
3
|
+
PrimaryGeneratedColumn,
|
|
4
|
+
Column,
|
|
5
|
+
ManyToOne,
|
|
6
|
+
JoinColumn,
|
|
7
|
+
ObjectLiteral,
|
|
8
|
+
CreateDateColumn,
|
|
9
|
+
UpdateDateColumn,
|
|
10
|
+
Index
|
|
11
|
+
} from "typeorm";
|
|
12
|
+
import { Payment } from "./Payment";
|
|
13
|
+
|
|
14
|
+
@Entity("payment_cfdi")
|
|
15
|
+
@Index(["payment", "createdAt"])
|
|
16
|
+
@Index(["uuid"], { unique: true })
|
|
17
|
+
@Index(["fiscalApiId"], { unique: true })
|
|
18
|
+
@Index(["status"])
|
|
19
|
+
export class PaymentCfdi implements ObjectLiteral {
|
|
20
|
+
@PrimaryGeneratedColumn("increment")
|
|
21
|
+
idPaymentCfdi!: number;
|
|
22
|
+
|
|
23
|
+
@ManyToOne(() => Payment, (payment) => payment.paymentCfdis, {
|
|
24
|
+
nullable: false,
|
|
25
|
+
onDelete: "CASCADE"
|
|
26
|
+
})
|
|
27
|
+
@JoinColumn({ name: "idPayment" })
|
|
28
|
+
payment!: Payment;
|
|
29
|
+
|
|
30
|
+
@Column("varchar", { length: 255, unique: true })
|
|
31
|
+
uuid!: string;
|
|
32
|
+
|
|
33
|
+
@Column("varchar", { length: 255, unique: true })
|
|
34
|
+
fiscalApiId!: string;
|
|
35
|
+
|
|
36
|
+
@Column("varchar", { length: 10, nullable: true })
|
|
37
|
+
series?: string | null;
|
|
38
|
+
|
|
39
|
+
@Column("varchar", { length: 50, nullable: true })
|
|
40
|
+
number?: string | null;
|
|
41
|
+
|
|
42
|
+
@Column("timestamp", { nullable: false })
|
|
43
|
+
cfdiDate!: Date;
|
|
44
|
+
|
|
45
|
+
@Column("varchar", { length: 10, default: "P" })
|
|
46
|
+
typeCode!: string;
|
|
47
|
+
|
|
48
|
+
@Column("varchar", { length: 32, default: "ACTIVE" })
|
|
49
|
+
status!: "ACTIVE" | "CANCELLED" | "PENDING";
|
|
50
|
+
|
|
51
|
+
@Column("varchar", { length: 255, nullable: true })
|
|
52
|
+
certificateNumber?: string | null;
|
|
53
|
+
|
|
54
|
+
@Column("text", { nullable: true })
|
|
55
|
+
base64Xml?: string | null;
|
|
56
|
+
|
|
57
|
+
@Column("text", { nullable: true })
|
|
58
|
+
base64QrCode?: string | null;
|
|
59
|
+
|
|
60
|
+
@Column("text", { nullable: true })
|
|
61
|
+
base64Seal?: string | null;
|
|
62
|
+
|
|
63
|
+
@Column("timestamp", { nullable: true })
|
|
64
|
+
signatureDate?: Date | null;
|
|
65
|
+
|
|
66
|
+
@Column("varchar", { length: 255, nullable: true })
|
|
67
|
+
satCertificateNumber?: string | null;
|
|
68
|
+
|
|
69
|
+
@Column("text", { nullable: true })
|
|
70
|
+
satBase64Seal?: string | null;
|
|
71
|
+
|
|
72
|
+
@Column("varchar", { length: 13, nullable: true })
|
|
73
|
+
issuerTin?: string | null;
|
|
74
|
+
|
|
75
|
+
@Column("varchar", { length: 255, nullable: true })
|
|
76
|
+
issuerLegalName?: string | null;
|
|
77
|
+
|
|
78
|
+
@Column("varchar", { length: 13, nullable: true })
|
|
79
|
+
recipientTin?: string | null;
|
|
80
|
+
|
|
81
|
+
@Column("varchar", { length: 255, nullable: true })
|
|
82
|
+
recipientLegalName?: string | null;
|
|
83
|
+
|
|
84
|
+
@Column("varchar", { length: 10, nullable: true })
|
|
85
|
+
recipientZipCode?: string | null;
|
|
86
|
+
|
|
87
|
+
@Column("varchar", { length: 10, nullable: true })
|
|
88
|
+
cfdiUseCode?: string | null;
|
|
89
|
+
|
|
90
|
+
@Column("decimal", { precision: 12, scale: 2, nullable: false })
|
|
91
|
+
paymentAmount!: number;
|
|
92
|
+
|
|
93
|
+
@Column("varchar", { length: 3, default: "MXN" })
|
|
94
|
+
paymentCurrency!: string;
|
|
95
|
+
|
|
96
|
+
@Column("varchar", { length: 50, nullable: true })
|
|
97
|
+
paymentMethod?: string | null;
|
|
98
|
+
|
|
99
|
+
@Column("varchar", { length: 255, nullable: true })
|
|
100
|
+
relatedInvoiceUuid?: string | null;
|
|
101
|
+
|
|
102
|
+
@Column("integer", { nullable: true })
|
|
103
|
+
installmentNumber?: number | null;
|
|
104
|
+
|
|
105
|
+
@Column("decimal", { precision: 12, scale: 2, nullable: true })
|
|
106
|
+
previousBalance?: number | null;
|
|
107
|
+
|
|
108
|
+
@Column("decimal", { precision: 12, scale: 2, nullable: true })
|
|
109
|
+
paidAmount?: number | null;
|
|
110
|
+
|
|
111
|
+
@Column("decimal", { precision: 12, scale: 2, nullable: true })
|
|
112
|
+
remainingBalance?: number | null;
|
|
113
|
+
|
|
114
|
+
@Column("text", { nullable: true })
|
|
115
|
+
fiscalApiResponse?: string | null;
|
|
116
|
+
|
|
117
|
+
@Column("varchar", { length: 255, nullable: true })
|
|
118
|
+
cancelledBy?: string | null;
|
|
119
|
+
|
|
120
|
+
@Column("timestamp", { nullable: true })
|
|
121
|
+
cancelledAt?: Date | null;
|
|
122
|
+
|
|
123
|
+
@Column("text", { nullable: true })
|
|
124
|
+
cancellationReason?: string | null;
|
|
125
|
+
|
|
126
|
+
@Column("varchar", { length: 255, nullable: true })
|
|
127
|
+
cancellationUuid?: string | null;
|
|
128
|
+
|
|
129
|
+
@CreateDateColumn({ type: "timestamp" })
|
|
130
|
+
createdAt!: Date;
|
|
131
|
+
|
|
132
|
+
@UpdateDateColumn({ type: "timestamp" })
|
|
133
|
+
updatedAt!: Date;
|
|
134
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -19,6 +19,8 @@ export { Branch } from "./entities/Branches";
|
|
|
19
19
|
export { BranchImage } from "./entities/BranchImage";
|
|
20
20
|
export { SupplierImage } from "./entities/SupplierImage";
|
|
21
21
|
export { InventoryImage } from "./entities/InventoryImage";
|
|
22
|
+
export { Payment } from "./entities/Payment";
|
|
23
|
+
export { PaymentCfdi } from "./entities/PaymentCfdi";
|
|
22
24
|
|
|
23
25
|
export * from "./types";
|
|
24
26
|
export * from "./models/technical-sheet";
|
package/src/models/apu/Budget.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
import { Project } from "./Project";
|
|
6
6
|
import { BudgetItem } from "./BudgetItem";
|
|
7
7
|
import { BudgetCancellationFolio } from "./BudgetCancellationFolio";
|
|
8
|
+
import { Payment } from "../../entities/Payment";
|
|
8
9
|
|
|
9
10
|
@Entity("budgets")
|
|
10
11
|
@Index(["project"])
|
|
@@ -51,4 +52,7 @@ export class Budget implements ObjectLiteral {
|
|
|
51
52
|
|
|
52
53
|
@OneToMany(() => BudgetCancellationFolio, (bcf) => bcf.budget, { cascade: true })
|
|
53
54
|
cancellationFolios?: BudgetCancellationFolio[];
|
|
55
|
+
|
|
56
|
+
@OneToMany(() => Payment, (payment) => payment.budget)
|
|
57
|
+
payments?: Payment[];
|
|
54
58
|
}
|
package/src/models/apu/Client.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// apu/entities/Client.ts
|
|
2
|
-
import { Entity, PrimaryGeneratedColumn, Column, ObjectLiteral } from "typeorm";
|
|
2
|
+
import { Entity, PrimaryGeneratedColumn, Column, ObjectLiteral, OneToMany } from "typeorm";
|
|
3
|
+
import { Payment } from "../../entities/Payment";
|
|
3
4
|
|
|
4
5
|
@Entity("clients")
|
|
5
6
|
export class Client implements ObjectLiteral {
|
|
@@ -38,4 +39,7 @@ export class Client implements ObjectLiteral {
|
|
|
38
39
|
|
|
39
40
|
@Column("varchar", { length: 16, nullable: true })
|
|
40
41
|
postalCode?: string | null;
|
|
42
|
+
|
|
43
|
+
@OneToMany(() => Payment, (payment) => payment.client)
|
|
44
|
+
payments?: Payment[];
|
|
41
45
|
}
|