proflores-db-model 0.2.42 → 0.2.44
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/models/apu/Budget.d.ts +3 -0
- package/dist/models/apu/Budget.js +9 -0
- package/dist/models/apu/BudgetCancellation.d.ts +10 -0
- package/dist/models/apu/BudgetCancellation.js +46 -0
- package/dist/models/apu/BudgetItem.d.ts +1 -0
- package/dist/models/apu/BudgetItem.js +4 -0
- package/dist/models/apu/Concept.d.ts +2 -0
- package/dist/models/apu/Concept.js +8 -0
- package/dist/models/apu/index.d.ts +1 -0
- package/dist/models/apu/index.js +3 -1
- package/package.json +1 -1
- package/src/models/apu/Budget.ts +7 -0
- package/src/models/apu/BudgetCancellation.ts +27 -0
- package/src/models/apu/BudgetItem.ts +3 -0
- package/src/models/apu/Concept.ts +6 -0
- package/src/models/apu/index.ts +1 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ObjectLiteral } from "typeorm";
|
|
2
2
|
import { Project } from "./Project";
|
|
3
3
|
import { BudgetItem } from "./BudgetItem";
|
|
4
|
+
import { BudgetCancellation } from "./BudgetCancellation";
|
|
4
5
|
export declare class Budget implements ObjectLiteral {
|
|
5
6
|
idBudget: number;
|
|
6
7
|
project: Project;
|
|
@@ -9,9 +10,11 @@ export declare class Budget implements ObjectLiteral {
|
|
|
9
10
|
createdAt: Date;
|
|
10
11
|
currency: string;
|
|
11
12
|
vatPct: number;
|
|
13
|
+
discountPct: number;
|
|
12
14
|
status: "DRAFT" | "SENT" | "APPROVED" | "REJECTED" | "BILLED" | string;
|
|
13
15
|
notes?: string | null;
|
|
14
16
|
invoiceUuid?: string | null;
|
|
15
17
|
fiscalApiId?: string | null;
|
|
16
18
|
items?: BudgetItem[];
|
|
19
|
+
cancellations?: BudgetCancellation[];
|
|
17
20
|
}
|
|
@@ -14,6 +14,7 @@ exports.Budget = void 0;
|
|
|
14
14
|
const typeorm_1 = require("typeorm");
|
|
15
15
|
const Project_1 = require("./Project");
|
|
16
16
|
const BudgetItem_1 = require("./BudgetItem");
|
|
17
|
+
const BudgetCancellation_1 = require("./BudgetCancellation");
|
|
17
18
|
let Budget = class Budget {
|
|
18
19
|
};
|
|
19
20
|
exports.Budget = Budget;
|
|
@@ -46,6 +47,10 @@ __decorate([
|
|
|
46
47
|
(0, typeorm_1.Column)("decimal", { precision: 5, scale: 4, default: 0.16 }),
|
|
47
48
|
__metadata("design:type", Number)
|
|
48
49
|
], Budget.prototype, "vatPct", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
(0, typeorm_1.Column)("decimal", { precision: 5, scale: 4, default: 0 }),
|
|
52
|
+
__metadata("design:type", Number)
|
|
53
|
+
], Budget.prototype, "discountPct", void 0);
|
|
49
54
|
__decorate([
|
|
50
55
|
(0, typeorm_1.Column)("varchar", { length: 32, default: "DRAFT" }),
|
|
51
56
|
__metadata("design:type", String)
|
|
@@ -66,6 +71,10 @@ __decorate([
|
|
|
66
71
|
(0, typeorm_1.OneToMany)(() => BudgetItem_1.BudgetItem, (bi) => bi.budget, { cascade: true }),
|
|
67
72
|
__metadata("design:type", Array)
|
|
68
73
|
], Budget.prototype, "items", void 0);
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, typeorm_1.OneToMany)(() => BudgetCancellation_1.BudgetCancellation, (bc) => bc.budget, { cascade: true }),
|
|
76
|
+
__metadata("design:type", Array)
|
|
77
|
+
], Budget.prototype, "cancellations", void 0);
|
|
69
78
|
exports.Budget = Budget = __decorate([
|
|
70
79
|
(0, typeorm_1.Entity)("budgets"),
|
|
71
80
|
(0, typeorm_1.Index)(["project"])
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ObjectLiteral } from "typeorm";
|
|
2
|
+
import { Budget } from "./Budget";
|
|
3
|
+
export declare class BudgetCancellation implements ObjectLiteral {
|
|
4
|
+
idBudgetCancellation: number;
|
|
5
|
+
budget: Budget;
|
|
6
|
+
cancellationFolio: string;
|
|
7
|
+
cancellationDate: Date;
|
|
8
|
+
reason?: string | null;
|
|
9
|
+
notes?: string | null;
|
|
10
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
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.BudgetCancellation = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const Budget_1 = require("./Budget");
|
|
15
|
+
let BudgetCancellation = class BudgetCancellation {
|
|
16
|
+
};
|
|
17
|
+
exports.BudgetCancellation = BudgetCancellation;
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, typeorm_1.PrimaryGeneratedColumn)("increment"),
|
|
20
|
+
__metadata("design:type", Number)
|
|
21
|
+
], BudgetCancellation.prototype, "idBudgetCancellation", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, typeorm_1.ManyToOne)(() => Budget_1.Budget, { nullable: false, onDelete: "CASCADE" }),
|
|
24
|
+
(0, typeorm_1.JoinColumn)({ name: "idBudget" }),
|
|
25
|
+
__metadata("design:type", Budget_1.Budget)
|
|
26
|
+
], BudgetCancellation.prototype, "budget", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, typeorm_1.Column)("varchar", { length: 255 }),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], BudgetCancellation.prototype, "cancellationFolio", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, typeorm_1.CreateDateColumn)({ type: "timestamp" }),
|
|
33
|
+
__metadata("design:type", Date)
|
|
34
|
+
], BudgetCancellation.prototype, "cancellationDate", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, typeorm_1.Column)("varchar", { length: 255, nullable: true }),
|
|
37
|
+
__metadata("design:type", Object)
|
|
38
|
+
], BudgetCancellation.prototype, "reason", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, typeorm_1.Column)("text", { nullable: true }),
|
|
41
|
+
__metadata("design:type", Object)
|
|
42
|
+
], BudgetCancellation.prototype, "notes", void 0);
|
|
43
|
+
exports.BudgetCancellation = BudgetCancellation = __decorate([
|
|
44
|
+
(0, typeorm_1.Entity)("budget_cancellations"),
|
|
45
|
+
(0, typeorm_1.Index)(["budget"])
|
|
46
|
+
], BudgetCancellation);
|
|
@@ -45,6 +45,10 @@ __decorate([
|
|
|
45
45
|
(0, typeorm_1.Column)("decimal", { precision: 14, scale: 4, nullable: true }),
|
|
46
46
|
__metadata("design:type", Object)
|
|
47
47
|
], BudgetItem.prototype, "unitPriceSnapshot", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, typeorm_1.Column)("decimal", { precision: 5, scale: 4, default: 0 }),
|
|
50
|
+
__metadata("design:type", Number)
|
|
51
|
+
], BudgetItem.prototype, "discountPct", void 0);
|
|
48
52
|
__decorate([
|
|
49
53
|
(0, typeorm_1.Column)("text", { nullable: true }),
|
|
50
54
|
__metadata("design:type", Object)
|
|
@@ -39,6 +39,14 @@ __decorate([
|
|
|
39
39
|
(0, typeorm_1.JoinColumn)({ name: "idUnitOfMeasure" }),
|
|
40
40
|
__metadata("design:type", UnitOfMesure_1.UnitOfMeasure)
|
|
41
41
|
], Concept.prototype, "unit", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, typeorm_1.Column)("varchar", { length: 64, nullable: true }),
|
|
44
|
+
__metadata("design:type", Object)
|
|
45
|
+
], Concept.prototype, "satClave", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, typeorm_1.Column)("varchar", { length: 64, nullable: true }),
|
|
48
|
+
__metadata("design:type", Object)
|
|
49
|
+
], Concept.prototype, "satUnit", void 0);
|
|
42
50
|
__decorate([
|
|
43
51
|
(0, typeorm_1.Column)("varchar", { length: 64, nullable: true }),
|
|
44
52
|
__metadata("design:type", Object)
|
|
@@ -2,6 +2,7 @@ export { Apu } from './Apu';
|
|
|
2
2
|
export { ApuItem } from './ApuItem';
|
|
3
3
|
export { Budget } from './Budget';
|
|
4
4
|
export { BudgetItem } from './BudgetItem';
|
|
5
|
+
export { BudgetCancellation } from './BudgetCancellation';
|
|
5
6
|
export { Client } from './Client';
|
|
6
7
|
export { Company } from './Company';
|
|
7
8
|
export { Concept } from './Concept';
|
package/dist/models/apu/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BudgetSnapshot = exports.ResourceType = exports.ResourcePrice = exports.Resource = exports.Project = exports.PriceList = exports.Concept = exports.Company = exports.Client = exports.BudgetItem = exports.Budget = exports.ApuItem = exports.Apu = void 0;
|
|
3
|
+
exports.BudgetSnapshot = exports.ResourceType = exports.ResourcePrice = exports.Resource = exports.Project = exports.PriceList = exports.Concept = exports.Company = exports.Client = exports.BudgetCancellation = exports.BudgetItem = exports.Budget = exports.ApuItem = exports.Apu = void 0;
|
|
4
4
|
var Apu_1 = require("./Apu"); //
|
|
5
5
|
Object.defineProperty(exports, "Apu", { enumerable: true, get: function () { return Apu_1.Apu; } });
|
|
6
6
|
var ApuItem_1 = require("./ApuItem"); //
|
|
@@ -9,6 +9,8 @@ var Budget_1 = require("./Budget");
|
|
|
9
9
|
Object.defineProperty(exports, "Budget", { enumerable: true, get: function () { return Budget_1.Budget; } });
|
|
10
10
|
var BudgetItem_1 = require("./BudgetItem");
|
|
11
11
|
Object.defineProperty(exports, "BudgetItem", { enumerable: true, get: function () { return BudgetItem_1.BudgetItem; } });
|
|
12
|
+
var BudgetCancellation_1 = require("./BudgetCancellation");
|
|
13
|
+
Object.defineProperty(exports, "BudgetCancellation", { enumerable: true, get: function () { return BudgetCancellation_1.BudgetCancellation; } });
|
|
12
14
|
var Client_1 = require("./Client");
|
|
13
15
|
Object.defineProperty(exports, "Client", { enumerable: true, get: function () { return Client_1.Client; } });
|
|
14
16
|
var Company_1 = require("./Company");
|
package/package.json
CHANGED
package/src/models/apu/Budget.ts
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
} from "typeorm";
|
|
5
5
|
import { Project } from "./Project";
|
|
6
6
|
import { BudgetItem } from "./BudgetItem";
|
|
7
|
+
import { BudgetCancellation } from "./BudgetCancellation";
|
|
7
8
|
|
|
8
9
|
@Entity("budgets")
|
|
9
10
|
@Index(["project"])
|
|
@@ -30,6 +31,9 @@ export class Budget implements ObjectLiteral {
|
|
|
30
31
|
@Column("decimal", { precision: 5, scale: 4, default: 0.16 })
|
|
31
32
|
vatPct!: number; // IVA 0..1
|
|
32
33
|
|
|
34
|
+
@Column("decimal", { precision: 5, scale: 4, default: 0 })
|
|
35
|
+
discountPct!: number; // Descuento global 0..1
|
|
36
|
+
|
|
33
37
|
@Column("varchar", { length: 32, default: "DRAFT" })
|
|
34
38
|
status!: "DRAFT" | "SENT" | "APPROVED" | "REJECTED" | "BILLED" | string;
|
|
35
39
|
|
|
@@ -44,4 +48,7 @@ export class Budget implements ObjectLiteral {
|
|
|
44
48
|
|
|
45
49
|
@OneToMany(() => BudgetItem, (bi) => bi.budget, { cascade: true })
|
|
46
50
|
items?: BudgetItem[];
|
|
51
|
+
|
|
52
|
+
@OneToMany(() => BudgetCancellation, (bc) => bc.budget, { cascade: true })
|
|
53
|
+
cancellations?: BudgetCancellation[];
|
|
47
54
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Entity, PrimaryGeneratedColumn, Column, ObjectLiteral, ManyToOne, JoinColumn, CreateDateColumn, Index,
|
|
3
|
+
} from "typeorm";
|
|
4
|
+
import { Budget } from "./Budget";
|
|
5
|
+
|
|
6
|
+
@Entity("budget_cancellations")
|
|
7
|
+
@Index(["budget"])
|
|
8
|
+
export class BudgetCancellation implements ObjectLiteral {
|
|
9
|
+
@PrimaryGeneratedColumn("increment")
|
|
10
|
+
idBudgetCancellation!: number;
|
|
11
|
+
|
|
12
|
+
@ManyToOne(() => Budget, { nullable: false, onDelete: "CASCADE" })
|
|
13
|
+
@JoinColumn({ name: "idBudget" })
|
|
14
|
+
budget!: Budget;
|
|
15
|
+
|
|
16
|
+
@Column("varchar", { length: 255 })
|
|
17
|
+
cancellationFolio!: string;
|
|
18
|
+
|
|
19
|
+
@CreateDateColumn({ type: "timestamp" })
|
|
20
|
+
cancellationDate!: Date;
|
|
21
|
+
|
|
22
|
+
@Column("varchar", { length: 255, nullable: true })
|
|
23
|
+
reason?: string | null;
|
|
24
|
+
|
|
25
|
+
@Column("text", { nullable: true })
|
|
26
|
+
notes?: string | null;
|
|
27
|
+
}
|
|
@@ -30,6 +30,9 @@ export class BudgetItem implements ObjectLiteral {
|
|
|
30
30
|
@Column("decimal", { precision: 14, scale: 4, nullable: true })
|
|
31
31
|
unitPriceSnapshot?: number | null; // si no hay, se puede recalcular al vuelo
|
|
32
32
|
|
|
33
|
+
@Column("decimal", { precision: 5, scale: 4, default: 0 })
|
|
34
|
+
discountPct!: number; // Descuento específico por item 0..1
|
|
35
|
+
|
|
33
36
|
@Column("text", { nullable: true })
|
|
34
37
|
notes?: string | null;
|
|
35
38
|
|
|
@@ -25,6 +25,12 @@ export class Concept implements ObjectLiteral {
|
|
|
25
25
|
@JoinColumn({ name: "idUnitOfMeasure" })
|
|
26
26
|
unit!: UnitOfMeasure;
|
|
27
27
|
|
|
28
|
+
@Column("varchar", { length: 64, nullable: true })
|
|
29
|
+
satClave?: string | null;
|
|
30
|
+
|
|
31
|
+
@Column("varchar", { length: 64, nullable: true })
|
|
32
|
+
satUnit?: string | null;
|
|
33
|
+
|
|
28
34
|
@Column("varchar", { length: 64, nullable: true })
|
|
29
35
|
category?: string | null;
|
|
30
36
|
|
package/src/models/apu/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ export { Apu } from './Apu'; //
|
|
|
2
2
|
export { ApuItem } from './ApuItem'; //
|
|
3
3
|
export { Budget } from './Budget';
|
|
4
4
|
export { BudgetItem } from './BudgetItem';
|
|
5
|
+
export { BudgetCancellation } from './BudgetCancellation';
|
|
5
6
|
export { Client } from './Client';
|
|
6
7
|
export { Company } from './Company';
|
|
7
8
|
export { Concept } from './Concept';
|