proflores-db-model 0.3.3 → 0.3.6
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/ExtraExpense.d.ts +15 -0
- package/dist/entities/ExtraExpense.js +69 -0
- package/dist/entities/ExtraExpenseDetail.d.ts +11 -0
- package/dist/entities/ExtraExpenseDetail.js +52 -0
- package/dist/entities/Inventory.d.ts +2 -0
- package/dist/entities/Inventory.js +5 -0
- package/dist/entities/InventoryExpense.d.ts +19 -0
- package/dist/entities/InventoryExpense.js +86 -0
- package/dist/entities/InventoryExpenseDetail.d.ts +11 -0
- package/dist/entities/InventoryExpenseDetail.js +52 -0
- package/dist/entities/InventoryExpenseDistribution.d.ts +11 -0
- package/dist/entities/InventoryExpenseDistribution.js +52 -0
- package/dist/entities/index.d.ts +5 -0
- package/dist/entities/index.js +12 -1
- package/dist/types/ExtraExpenseStatus.d.ts +5 -0
- package/dist/types/ExtraExpenseStatus.js +9 -0
- package/dist/types/InventoryExpenseStatus.d.ts +5 -0
- package/dist/types/InventoryExpenseStatus.js +9 -0
- package/dist/types/InventoryExpenseType.d.ts +8 -0
- package/dist/types/InventoryExpenseType.js +12 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.js +9 -1
- package/package.json +1 -1
- package/src/entities/ExtraExpense.ts +53 -0
- package/src/entities/ExtraExpenseDetail.ts +37 -0
- package/src/entities/Inventory.ts +4 -0
- package/src/entities/InventoryExpense.ts +68 -0
- package/src/entities/InventoryExpenseDetail.ts +37 -0
- package/src/entities/InventoryExpenseDistribution.ts +38 -0
- package/src/entities/index.ts +7 -0
- package/src/types/ExtraExpenseStatus.ts +5 -0
- package/src/types/InventoryExpenseStatus.ts +5 -0
- package/src/types/InventoryExpenseType.ts +8 -0
- package/src/types/index.ts +8 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ObjectLiteral } from "typeorm";
|
|
2
|
+
import { ExtraExpenseStatus } from "../types/ExtraExpenseStatus";
|
|
3
|
+
import { ExtraExpenseDetail } from "./ExtraExpenseDetail";
|
|
4
|
+
export declare class ExtraExpense implements ObjectLiteral {
|
|
5
|
+
idExtraExpense: number;
|
|
6
|
+
description: string;
|
|
7
|
+
totalAmount: number;
|
|
8
|
+
expenseDate: Date;
|
|
9
|
+
status: ExtraExpenseStatus;
|
|
10
|
+
paymentMethod?: string | null;
|
|
11
|
+
notes?: string | null;
|
|
12
|
+
createdAt: Date;
|
|
13
|
+
updatedAt: Date;
|
|
14
|
+
details?: ExtraExpenseDetail[];
|
|
15
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
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.ExtraExpense = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const ExtraExpenseStatus_1 = require("../types/ExtraExpenseStatus");
|
|
15
|
+
const ExtraExpenseDetail_1 = require("./ExtraExpenseDetail");
|
|
16
|
+
let ExtraExpense = class ExtraExpense {
|
|
17
|
+
};
|
|
18
|
+
exports.ExtraExpense = ExtraExpense;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, typeorm_1.PrimaryGeneratedColumn)("increment"),
|
|
21
|
+
__metadata("design:type", Number)
|
|
22
|
+
], ExtraExpense.prototype, "idExtraExpense", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, typeorm_1.Column)("varchar", { length: 255, nullable: false }),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], ExtraExpense.prototype, "description", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, typeorm_1.Column)("decimal", { precision: 14, scale: 2, nullable: false, default: 0 }),
|
|
29
|
+
__metadata("design:type", Number)
|
|
30
|
+
], ExtraExpense.prototype, "totalAmount", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, typeorm_1.Column)("date", { nullable: false }),
|
|
33
|
+
__metadata("design:type", Date)
|
|
34
|
+
], ExtraExpense.prototype, "expenseDate", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, typeorm_1.Column)({
|
|
37
|
+
type: "enum",
|
|
38
|
+
enum: ExtraExpenseStatus_1.ExtraExpenseStatus,
|
|
39
|
+
default: ExtraExpenseStatus_1.ExtraExpenseStatus.PENDING,
|
|
40
|
+
}),
|
|
41
|
+
__metadata("design:type", String)
|
|
42
|
+
], ExtraExpense.prototype, "status", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, typeorm_1.Column)("varchar", { length: 32, nullable: true }),
|
|
45
|
+
__metadata("design:type", Object)
|
|
46
|
+
], ExtraExpense.prototype, "paymentMethod", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, typeorm_1.Column)("text", { nullable: true }),
|
|
49
|
+
__metadata("design:type", Object)
|
|
50
|
+
], ExtraExpense.prototype, "notes", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, typeorm_1.CreateDateColumn)({ type: "timestamp" }),
|
|
53
|
+
__metadata("design:type", Date)
|
|
54
|
+
], ExtraExpense.prototype, "createdAt", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, typeorm_1.UpdateDateColumn)({ type: "timestamp" }),
|
|
57
|
+
__metadata("design:type", Date)
|
|
58
|
+
], ExtraExpense.prototype, "updatedAt", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
(0, typeorm_1.OneToMany)(() => ExtraExpenseDetail_1.ExtraExpenseDetail, (detail) => detail.extraExpense, {
|
|
61
|
+
cascade: true,
|
|
62
|
+
}),
|
|
63
|
+
__metadata("design:type", Array)
|
|
64
|
+
], ExtraExpense.prototype, "details", void 0);
|
|
65
|
+
exports.ExtraExpense = ExtraExpense = __decorate([
|
|
66
|
+
(0, typeorm_1.Entity)("extra_expenses"),
|
|
67
|
+
(0, typeorm_1.Index)(["expenseDate"]),
|
|
68
|
+
(0, typeorm_1.Index)(["status"])
|
|
69
|
+
], ExtraExpense);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ObjectLiteral } from "typeorm";
|
|
2
|
+
import { ExtraExpense } from "./ExtraExpense";
|
|
3
|
+
export declare class ExtraExpenseDetail implements ObjectLiteral {
|
|
4
|
+
idExtraExpenseDetail: number;
|
|
5
|
+
extraExpense: ExtraExpense;
|
|
6
|
+
concept: string;
|
|
7
|
+
quantity: number;
|
|
8
|
+
unitPrice: number;
|
|
9
|
+
subtotal: number;
|
|
10
|
+
notes?: string | null;
|
|
11
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
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.ExtraExpenseDetail = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const ExtraExpense_1 = require("./ExtraExpense");
|
|
15
|
+
let ExtraExpenseDetail = class ExtraExpenseDetail {
|
|
16
|
+
};
|
|
17
|
+
exports.ExtraExpenseDetail = ExtraExpenseDetail;
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, typeorm_1.PrimaryGeneratedColumn)("increment"),
|
|
20
|
+
__metadata("design:type", Number)
|
|
21
|
+
], ExtraExpenseDetail.prototype, "idExtraExpenseDetail", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, typeorm_1.ManyToOne)(() => ExtraExpense_1.ExtraExpense, (expense) => expense.details, {
|
|
24
|
+
nullable: false,
|
|
25
|
+
onDelete: "CASCADE",
|
|
26
|
+
}),
|
|
27
|
+
(0, typeorm_1.JoinColumn)({ name: "idExtraExpense" }),
|
|
28
|
+
__metadata("design:type", ExtraExpense_1.ExtraExpense)
|
|
29
|
+
], ExtraExpenseDetail.prototype, "extraExpense", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, typeorm_1.Column)("varchar", { length: 255, nullable: false }),
|
|
32
|
+
__metadata("design:type", String)
|
|
33
|
+
], ExtraExpenseDetail.prototype, "concept", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, typeorm_1.Column)("decimal", { precision: 12, scale: 4, nullable: false, default: 1 }),
|
|
36
|
+
__metadata("design:type", Number)
|
|
37
|
+
], ExtraExpenseDetail.prototype, "quantity", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, typeorm_1.Column)("decimal", { precision: 14, scale: 4, nullable: false }),
|
|
40
|
+
__metadata("design:type", Number)
|
|
41
|
+
], ExtraExpenseDetail.prototype, "unitPrice", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, typeorm_1.Column)("decimal", { precision: 14, scale: 2, nullable: false }),
|
|
44
|
+
__metadata("design:type", Number)
|
|
45
|
+
], ExtraExpenseDetail.prototype, "subtotal", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, typeorm_1.Column)("text", { nullable: true }),
|
|
48
|
+
__metadata("design:type", Object)
|
|
49
|
+
], ExtraExpenseDetail.prototype, "notes", void 0);
|
|
50
|
+
exports.ExtraExpenseDetail = ExtraExpenseDetail = __decorate([
|
|
51
|
+
(0, typeorm_1.Entity)("extra_expense_details")
|
|
52
|
+
], ExtraExpenseDetail);
|
|
@@ -8,6 +8,7 @@ import { InventoryImage } from "./InventoryImage";
|
|
|
8
8
|
import { InventoryMovement } from "./InventoryMovement";
|
|
9
9
|
import { PlantTechnicalSheet } from "../models/technical-sheet/PlantTechnicalSheet";
|
|
10
10
|
import { InventoryTechnicalSheet } from "../models/technical-sheet/inventory-technical-sheet.entity";
|
|
11
|
+
import { InventoryExpenseDistribution } from "./InventoryExpenseDistribution";
|
|
11
12
|
export declare class Inventory implements ObjectLiteral {
|
|
12
13
|
idInventory: number;
|
|
13
14
|
product?: Product | null;
|
|
@@ -23,4 +24,5 @@ export declare class Inventory implements ObjectLiteral {
|
|
|
23
24
|
supplier?: Supplier | null;
|
|
24
25
|
images: InventoryImage[] | null;
|
|
25
26
|
movements: InventoryMovement[];
|
|
27
|
+
expenseDistributions?: InventoryExpenseDistribution[];
|
|
26
28
|
}
|
|
@@ -20,6 +20,7 @@ const InventoryImage_1 = require("./InventoryImage");
|
|
|
20
20
|
const InventoryMovement_1 = require("./InventoryMovement");
|
|
21
21
|
const PlantTechnicalSheet_1 = require("../models/technical-sheet/PlantTechnicalSheet");
|
|
22
22
|
const inventory_technical_sheet_entity_1 = require("../models/technical-sheet/inventory-technical-sheet.entity");
|
|
23
|
+
const InventoryExpenseDistribution_1 = require("./InventoryExpenseDistribution");
|
|
23
24
|
let Inventory = class Inventory {
|
|
24
25
|
};
|
|
25
26
|
exports.Inventory = Inventory;
|
|
@@ -89,6 +90,10 @@ __decorate([
|
|
|
89
90
|
(0, typeorm_1.OneToMany)(() => InventoryMovement_1.InventoryMovement, (movement) => movement.inventory),
|
|
90
91
|
__metadata("design:type", Array)
|
|
91
92
|
], Inventory.prototype, "movements", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
(0, typeorm_1.OneToMany)(() => InventoryExpenseDistribution_1.InventoryExpenseDistribution, (dist) => dist.inventory),
|
|
95
|
+
__metadata("design:type", Array)
|
|
96
|
+
], Inventory.prototype, "expenseDistributions", void 0);
|
|
92
97
|
exports.Inventory = Inventory = __decorate([
|
|
93
98
|
(0, typeorm_1.Entity)("inventory")
|
|
94
99
|
], Inventory);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ObjectLiteral } from "typeorm";
|
|
2
|
+
import { InventoryExpenseType } from "../types/InventoryExpenseType";
|
|
3
|
+
import { InventoryExpenseStatus } from "../types/InventoryExpenseStatus";
|
|
4
|
+
import { InventoryExpenseDetail } from "./InventoryExpenseDetail";
|
|
5
|
+
import { InventoryExpenseDistribution } from "./InventoryExpenseDistribution";
|
|
6
|
+
export declare class InventoryExpense implements ObjectLiteral {
|
|
7
|
+
idInventoryExpense: number;
|
|
8
|
+
expenseType: InventoryExpenseType;
|
|
9
|
+
description: string;
|
|
10
|
+
totalAmount: number;
|
|
11
|
+
expenseDate: Date;
|
|
12
|
+
status: InventoryExpenseStatus;
|
|
13
|
+
paymentMethod?: string | null;
|
|
14
|
+
notes?: string | null;
|
|
15
|
+
createdAt: Date;
|
|
16
|
+
updatedAt: Date;
|
|
17
|
+
distributions: InventoryExpenseDistribution[];
|
|
18
|
+
details?: InventoryExpenseDetail[];
|
|
19
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
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.InventoryExpense = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const InventoryExpenseType_1 = require("../types/InventoryExpenseType");
|
|
15
|
+
const InventoryExpenseStatus_1 = require("../types/InventoryExpenseStatus");
|
|
16
|
+
const InventoryExpenseDetail_1 = require("./InventoryExpenseDetail");
|
|
17
|
+
const InventoryExpenseDistribution_1 = require("./InventoryExpenseDistribution");
|
|
18
|
+
let InventoryExpense = class InventoryExpense {
|
|
19
|
+
};
|
|
20
|
+
exports.InventoryExpense = InventoryExpense;
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, typeorm_1.PrimaryGeneratedColumn)("increment"),
|
|
23
|
+
__metadata("design:type", Number)
|
|
24
|
+
], InventoryExpense.prototype, "idInventoryExpense", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, typeorm_1.Column)({
|
|
27
|
+
type: "enum",
|
|
28
|
+
enum: InventoryExpenseType_1.InventoryExpenseType,
|
|
29
|
+
nullable: false,
|
|
30
|
+
}),
|
|
31
|
+
__metadata("design:type", String)
|
|
32
|
+
], InventoryExpense.prototype, "expenseType", void 0);
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, typeorm_1.Column)("varchar", { length: 255, nullable: false }),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], InventoryExpense.prototype, "description", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, typeorm_1.Column)("decimal", { precision: 14, scale: 2, nullable: false, default: 0 }),
|
|
39
|
+
__metadata("design:type", Number)
|
|
40
|
+
], InventoryExpense.prototype, "totalAmount", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, typeorm_1.Column)("date", { nullable: false }),
|
|
43
|
+
__metadata("design:type", Date)
|
|
44
|
+
], InventoryExpense.prototype, "expenseDate", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, typeorm_1.Column)({
|
|
47
|
+
type: "enum",
|
|
48
|
+
enum: InventoryExpenseStatus_1.InventoryExpenseStatus,
|
|
49
|
+
default: InventoryExpenseStatus_1.InventoryExpenseStatus.PENDING,
|
|
50
|
+
}),
|
|
51
|
+
__metadata("design:type", String)
|
|
52
|
+
], InventoryExpense.prototype, "status", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, typeorm_1.Column)("varchar", { length: 32, nullable: true }),
|
|
55
|
+
__metadata("design:type", Object)
|
|
56
|
+
], InventoryExpense.prototype, "paymentMethod", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, typeorm_1.Column)("text", { nullable: true }),
|
|
59
|
+
__metadata("design:type", Object)
|
|
60
|
+
], InventoryExpense.prototype, "notes", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
(0, typeorm_1.CreateDateColumn)({ type: "timestamp" }),
|
|
63
|
+
__metadata("design:type", Date)
|
|
64
|
+
], InventoryExpense.prototype, "createdAt", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, typeorm_1.UpdateDateColumn)({ type: "timestamp" }),
|
|
67
|
+
__metadata("design:type", Date)
|
|
68
|
+
], InventoryExpense.prototype, "updatedAt", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
(0, typeorm_1.OneToMany)(() => InventoryExpenseDistribution_1.InventoryExpenseDistribution, (dist) => dist.inventoryExpense, {
|
|
71
|
+
cascade: true,
|
|
72
|
+
}),
|
|
73
|
+
__metadata("design:type", Array)
|
|
74
|
+
], InventoryExpense.prototype, "distributions", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
(0, typeorm_1.OneToMany)(() => InventoryExpenseDetail_1.InventoryExpenseDetail, (detail) => detail.inventoryExpense, {
|
|
77
|
+
cascade: true,
|
|
78
|
+
}),
|
|
79
|
+
__metadata("design:type", Array)
|
|
80
|
+
], InventoryExpense.prototype, "details", void 0);
|
|
81
|
+
exports.InventoryExpense = InventoryExpense = __decorate([
|
|
82
|
+
(0, typeorm_1.Entity)("inventory_expenses"),
|
|
83
|
+
(0, typeorm_1.Index)(["expenseDate"]),
|
|
84
|
+
(0, typeorm_1.Index)(["status"]),
|
|
85
|
+
(0, typeorm_1.Index)(["expenseType"])
|
|
86
|
+
], InventoryExpense);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ObjectLiteral } from "typeorm";
|
|
2
|
+
import { InventoryExpense } from "./InventoryExpense";
|
|
3
|
+
export declare class InventoryExpenseDetail implements ObjectLiteral {
|
|
4
|
+
idInventoryExpenseDetail: number;
|
|
5
|
+
inventoryExpense: InventoryExpense;
|
|
6
|
+
concept: string;
|
|
7
|
+
quantity: number;
|
|
8
|
+
unitPrice: number;
|
|
9
|
+
subtotal: number;
|
|
10
|
+
notes?: string | null;
|
|
11
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
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.InventoryExpenseDetail = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const InventoryExpense_1 = require("./InventoryExpense");
|
|
15
|
+
let InventoryExpenseDetail = class InventoryExpenseDetail {
|
|
16
|
+
};
|
|
17
|
+
exports.InventoryExpenseDetail = InventoryExpenseDetail;
|
|
18
|
+
__decorate([
|
|
19
|
+
(0, typeorm_1.PrimaryGeneratedColumn)("increment"),
|
|
20
|
+
__metadata("design:type", Number)
|
|
21
|
+
], InventoryExpenseDetail.prototype, "idInventoryExpenseDetail", void 0);
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, typeorm_1.ManyToOne)(() => InventoryExpense_1.InventoryExpense, (expense) => expense.details, {
|
|
24
|
+
nullable: false,
|
|
25
|
+
onDelete: "CASCADE",
|
|
26
|
+
}),
|
|
27
|
+
(0, typeorm_1.JoinColumn)({ name: "idInventoryExpense" }),
|
|
28
|
+
__metadata("design:type", InventoryExpense_1.InventoryExpense)
|
|
29
|
+
], InventoryExpenseDetail.prototype, "inventoryExpense", void 0);
|
|
30
|
+
__decorate([
|
|
31
|
+
(0, typeorm_1.Column)("varchar", { length: 255, nullable: false }),
|
|
32
|
+
__metadata("design:type", String)
|
|
33
|
+
], InventoryExpenseDetail.prototype, "concept", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, typeorm_1.Column)("decimal", { precision: 12, scale: 4, nullable: false, default: 1 }),
|
|
36
|
+
__metadata("design:type", Number)
|
|
37
|
+
], InventoryExpenseDetail.prototype, "quantity", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, typeorm_1.Column)("decimal", { precision: 14, scale: 4, nullable: false }),
|
|
40
|
+
__metadata("design:type", Number)
|
|
41
|
+
], InventoryExpenseDetail.prototype, "unitPrice", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, typeorm_1.Column)("decimal", { precision: 14, scale: 2, nullable: false }),
|
|
44
|
+
__metadata("design:type", Number)
|
|
45
|
+
], InventoryExpenseDetail.prototype, "subtotal", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, typeorm_1.Column)("text", { nullable: true }),
|
|
48
|
+
__metadata("design:type", Object)
|
|
49
|
+
], InventoryExpenseDetail.prototype, "notes", void 0);
|
|
50
|
+
exports.InventoryExpenseDetail = InventoryExpenseDetail = __decorate([
|
|
51
|
+
(0, typeorm_1.Entity)("inventory_expense_details")
|
|
52
|
+
], InventoryExpenseDetail);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ObjectLiteral } from "typeorm";
|
|
2
|
+
import { InventoryExpense } from "./InventoryExpense";
|
|
3
|
+
import { Inventory } from "./Inventory";
|
|
4
|
+
export declare class InventoryExpenseDistribution implements ObjectLiteral {
|
|
5
|
+
idDistribution: number;
|
|
6
|
+
inventoryExpense: InventoryExpense;
|
|
7
|
+
inventory: Inventory;
|
|
8
|
+
percentage: number;
|
|
9
|
+
amount: number;
|
|
10
|
+
notes?: string | null;
|
|
11
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
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.InventoryExpenseDistribution = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const InventoryExpense_1 = require("./InventoryExpense");
|
|
15
|
+
const Inventory_1 = require("./Inventory");
|
|
16
|
+
let InventoryExpenseDistribution = class InventoryExpenseDistribution {
|
|
17
|
+
};
|
|
18
|
+
exports.InventoryExpenseDistribution = InventoryExpenseDistribution;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, typeorm_1.PrimaryGeneratedColumn)("increment"),
|
|
21
|
+
__metadata("design:type", Number)
|
|
22
|
+
], InventoryExpenseDistribution.prototype, "idDistribution", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, typeorm_1.ManyToOne)(() => InventoryExpense_1.InventoryExpense, (expense) => expense.distributions, {
|
|
25
|
+
nullable: false,
|
|
26
|
+
onDelete: "CASCADE",
|
|
27
|
+
}),
|
|
28
|
+
(0, typeorm_1.JoinColumn)({ name: "idInventoryExpense" }),
|
|
29
|
+
__metadata("design:type", InventoryExpense_1.InventoryExpense)
|
|
30
|
+
], InventoryExpenseDistribution.prototype, "inventoryExpense", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, typeorm_1.ManyToOne)(() => Inventory_1.Inventory, (inventory) => inventory.expenseDistributions, {
|
|
33
|
+
nullable: false,
|
|
34
|
+
}),
|
|
35
|
+
(0, typeorm_1.JoinColumn)({ name: "idInventory" }),
|
|
36
|
+
__metadata("design:type", Inventory_1.Inventory)
|
|
37
|
+
], InventoryExpenseDistribution.prototype, "inventory", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
(0, typeorm_1.Column)("decimal", { precision: 5, scale: 2, nullable: false }),
|
|
40
|
+
__metadata("design:type", Number)
|
|
41
|
+
], InventoryExpenseDistribution.prototype, "percentage", void 0);
|
|
42
|
+
__decorate([
|
|
43
|
+
(0, typeorm_1.Column)("decimal", { precision: 14, scale: 2, nullable: false }),
|
|
44
|
+
__metadata("design:type", Number)
|
|
45
|
+
], InventoryExpenseDistribution.prototype, "amount", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
(0, typeorm_1.Column)("text", { nullable: true }),
|
|
48
|
+
__metadata("design:type", Object)
|
|
49
|
+
], InventoryExpenseDistribution.prototype, "notes", void 0);
|
|
50
|
+
exports.InventoryExpenseDistribution = InventoryExpenseDistribution = __decorate([
|
|
51
|
+
(0, typeorm_1.Entity)("inventory_expense_distributions")
|
|
52
|
+
], InventoryExpenseDistribution);
|
package/dist/entities/index.d.ts
CHANGED
|
@@ -10,6 +10,9 @@ export { Inventory } from "./Inventory";
|
|
|
10
10
|
export { InventoryItem } from "./InventoryItem";
|
|
11
11
|
export { InventoryImage } from "./InventoryImage";
|
|
12
12
|
export { InventoryMovement } from "./InventoryMovement";
|
|
13
|
+
export { InventoryExpense } from "./InventoryExpense";
|
|
14
|
+
export { InventoryExpenseDetail } from "./InventoryExpenseDetail";
|
|
15
|
+
export { InventoryExpenseDistribution } from "./InventoryExpenseDistribution";
|
|
13
16
|
export { ContainerType } from "./ContainerType";
|
|
14
17
|
export { Supplier } from "./Suppliers";
|
|
15
18
|
export { SupplierImage } from "./SupplierImage";
|
|
@@ -22,6 +25,8 @@ export { Income } from "./Income";
|
|
|
22
25
|
export { Expenditure } from "./Expenditure";
|
|
23
26
|
export { ExpenditureDetail } from "./ExpenditureDetail";
|
|
24
27
|
export { Dividend } from "./Dividend";
|
|
28
|
+
export { ExtraExpense } from "./ExtraExpense";
|
|
29
|
+
export { ExtraExpenseDetail } from "./ExtraExpenseDetail";
|
|
25
30
|
export { ProjectOrder } from "./ProjectOrder";
|
|
26
31
|
export { UnitOfMeasure } from "./UnitOfMesure";
|
|
27
32
|
export { User } from "./User";
|
package/dist/entities/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.User = exports.UnitOfMeasure = exports.ProjectOrder = exports.Dividend = exports.ExpenditureDetail = exports.Expenditure = exports.Income = exports.PaymentCfdi = exports.Payment = exports.ExpenseType = exports.ExpenseTransaction = exports.ExpenseDetail = exports.SupplierImage = exports.Supplier = exports.ContainerType = exports.InventoryMovement = exports.InventoryImage = exports.InventoryItem = exports.Inventory = exports.ProductImage = exports.Product = exports.BranchImage = exports.Branch = exports.CategoryForPlantType = exports.CategoryForCosting = exports.TransactionBank = exports.BankAccount = void 0;
|
|
3
|
+
exports.User = exports.UnitOfMeasure = exports.ProjectOrder = exports.ExtraExpenseDetail = exports.ExtraExpense = exports.Dividend = exports.ExpenditureDetail = exports.Expenditure = exports.Income = exports.PaymentCfdi = exports.Payment = exports.ExpenseType = exports.ExpenseTransaction = exports.ExpenseDetail = exports.SupplierImage = exports.Supplier = exports.ContainerType = exports.InventoryExpenseDistribution = exports.InventoryExpenseDetail = exports.InventoryExpense = exports.InventoryMovement = exports.InventoryImage = exports.InventoryItem = exports.Inventory = exports.ProductImage = exports.Product = exports.BranchImage = exports.Branch = exports.CategoryForPlantType = exports.CategoryForCosting = exports.TransactionBank = exports.BankAccount = void 0;
|
|
4
4
|
// Bank
|
|
5
5
|
var BankAccount_1 = require("./Bank/BankAccount");
|
|
6
6
|
Object.defineProperty(exports, "BankAccount", { enumerable: true, get: function () { return BankAccount_1.BankAccount; } });
|
|
@@ -29,6 +29,12 @@ var InventoryImage_1 = require("./InventoryImage");
|
|
|
29
29
|
Object.defineProperty(exports, "InventoryImage", { enumerable: true, get: function () { return InventoryImage_1.InventoryImage; } });
|
|
30
30
|
var InventoryMovement_1 = require("./InventoryMovement");
|
|
31
31
|
Object.defineProperty(exports, "InventoryMovement", { enumerable: true, get: function () { return InventoryMovement_1.InventoryMovement; } });
|
|
32
|
+
var InventoryExpense_1 = require("./InventoryExpense");
|
|
33
|
+
Object.defineProperty(exports, "InventoryExpense", { enumerable: true, get: function () { return InventoryExpense_1.InventoryExpense; } });
|
|
34
|
+
var InventoryExpenseDetail_1 = require("./InventoryExpenseDetail");
|
|
35
|
+
Object.defineProperty(exports, "InventoryExpenseDetail", { enumerable: true, get: function () { return InventoryExpenseDetail_1.InventoryExpenseDetail; } });
|
|
36
|
+
var InventoryExpenseDistribution_1 = require("./InventoryExpenseDistribution");
|
|
37
|
+
Object.defineProperty(exports, "InventoryExpenseDistribution", { enumerable: true, get: function () { return InventoryExpenseDistribution_1.InventoryExpenseDistribution; } });
|
|
32
38
|
var ContainerType_1 = require("./ContainerType");
|
|
33
39
|
Object.defineProperty(exports, "ContainerType", { enumerable: true, get: function () { return ContainerType_1.ContainerType; } });
|
|
34
40
|
// Suppliers
|
|
@@ -59,6 +65,11 @@ Object.defineProperty(exports, "ExpenditureDetail", { enumerable: true, get: fun
|
|
|
59
65
|
// Dividends
|
|
60
66
|
var Dividend_1 = require("./Dividend");
|
|
61
67
|
Object.defineProperty(exports, "Dividend", { enumerable: true, get: function () { return Dividend_1.Dividend; } });
|
|
68
|
+
// Extra Expenses
|
|
69
|
+
var ExtraExpense_1 = require("./ExtraExpense");
|
|
70
|
+
Object.defineProperty(exports, "ExtraExpense", { enumerable: true, get: function () { return ExtraExpense_1.ExtraExpense; } });
|
|
71
|
+
var ExtraExpenseDetail_1 = require("./ExtraExpenseDetail");
|
|
72
|
+
Object.defineProperty(exports, "ExtraExpenseDetail", { enumerable: true, get: function () { return ExtraExpenseDetail_1.ExtraExpenseDetail; } });
|
|
62
73
|
// Others
|
|
63
74
|
var ProjectOrder_1 = require("./ProjectOrder");
|
|
64
75
|
Object.defineProperty(exports, "ProjectOrder", { enumerable: true, get: function () { return ProjectOrder_1.ProjectOrder; } });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ExtraExpenseStatus = void 0;
|
|
4
|
+
var ExtraExpenseStatus;
|
|
5
|
+
(function (ExtraExpenseStatus) {
|
|
6
|
+
ExtraExpenseStatus["PENDING"] = "PENDING";
|
|
7
|
+
ExtraExpenseStatus["PAID"] = "PAID";
|
|
8
|
+
ExtraExpenseStatus["CANCELLED"] = "CANCELLED";
|
|
9
|
+
})(ExtraExpenseStatus || (exports.ExtraExpenseStatus = ExtraExpenseStatus = {}));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InventoryExpenseStatus = void 0;
|
|
4
|
+
var InventoryExpenseStatus;
|
|
5
|
+
(function (InventoryExpenseStatus) {
|
|
6
|
+
InventoryExpenseStatus["PENDING"] = "PENDING";
|
|
7
|
+
InventoryExpenseStatus["PAID"] = "PAID";
|
|
8
|
+
InventoryExpenseStatus["CANCELLED"] = "CANCELLED";
|
|
9
|
+
})(InventoryExpenseStatus || (exports.InventoryExpenseStatus = InventoryExpenseStatus = {}));
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InventoryExpenseType = void 0;
|
|
4
|
+
var InventoryExpenseType;
|
|
5
|
+
(function (InventoryExpenseType) {
|
|
6
|
+
InventoryExpenseType["PURCHASE"] = "PURCHASE";
|
|
7
|
+
InventoryExpenseType["TRANSPORT"] = "TRANSPORT";
|
|
8
|
+
InventoryExpenseType["MAINTENANCE"] = "MAINTENANCE";
|
|
9
|
+
InventoryExpenseType["OPERATIONAL"] = "OPERATIONAL";
|
|
10
|
+
InventoryExpenseType["STORAGE"] = "STORAGE";
|
|
11
|
+
InventoryExpenseType["OTHER"] = "OTHER";
|
|
12
|
+
})(InventoryExpenseType || (exports.InventoryExpenseType = InventoryExpenseType = {}));
|
package/dist/types/index.d.ts
CHANGED
|
@@ -13,3 +13,6 @@ export { ExpenditureType } from "./ExpenditureType";
|
|
|
13
13
|
export { ExpenditureStatus } from "./ExpenditureStatus";
|
|
14
14
|
export { CostType } from "./CostType";
|
|
15
15
|
export { DividendStatus } from "./DividendStatus";
|
|
16
|
+
export { ExtraExpenseStatus } from "./ExtraExpenseStatus";
|
|
17
|
+
export { InventoryExpenseType } from "./InventoryExpenseType";
|
|
18
|
+
export { InventoryExpenseStatus } from "./InventoryExpenseStatus";
|
package/dist/types/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DividendStatus = exports.CostType = exports.ExpenditureStatus = exports.ExpenditureType = exports.IncomeStatus = exports.IncomeType = exports.QualityGrade = exports.CropActivityType = exports.GrowthStage = exports.CropLotStatus = exports.MovementType = void 0;
|
|
3
|
+
exports.InventoryExpenseStatus = exports.InventoryExpenseType = exports.ExtraExpenseStatus = exports.DividendStatus = exports.CostType = exports.ExpenditureStatus = exports.ExpenditureType = exports.IncomeStatus = exports.IncomeType = exports.QualityGrade = exports.CropActivityType = exports.GrowthStage = exports.CropLotStatus = exports.MovementType = void 0;
|
|
4
4
|
var MovementType_1 = require("./MovementType");
|
|
5
5
|
Object.defineProperty(exports, "MovementType", { enumerable: true, get: function () { return MovementType_1.MovementType; } });
|
|
6
6
|
// Production enums
|
|
@@ -28,3 +28,11 @@ Object.defineProperty(exports, "CostType", { enumerable: true, get: function ()
|
|
|
28
28
|
// Dividend enums
|
|
29
29
|
var DividendStatus_1 = require("./DividendStatus");
|
|
30
30
|
Object.defineProperty(exports, "DividendStatus", { enumerable: true, get: function () { return DividendStatus_1.DividendStatus; } });
|
|
31
|
+
// Extra Expense enums
|
|
32
|
+
var ExtraExpenseStatus_1 = require("./ExtraExpenseStatus");
|
|
33
|
+
Object.defineProperty(exports, "ExtraExpenseStatus", { enumerable: true, get: function () { return ExtraExpenseStatus_1.ExtraExpenseStatus; } });
|
|
34
|
+
// Inventory Expense enums
|
|
35
|
+
var InventoryExpenseType_1 = require("./InventoryExpenseType");
|
|
36
|
+
Object.defineProperty(exports, "InventoryExpenseType", { enumerable: true, get: function () { return InventoryExpenseType_1.InventoryExpenseType; } });
|
|
37
|
+
var InventoryExpenseStatus_1 = require("./InventoryExpenseStatus");
|
|
38
|
+
Object.defineProperty(exports, "InventoryExpenseStatus", { enumerable: true, get: function () { return InventoryExpenseStatus_1.InventoryExpenseStatus; } });
|
package/package.json
CHANGED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Entity,
|
|
3
|
+
PrimaryGeneratedColumn,
|
|
4
|
+
Column,
|
|
5
|
+
OneToMany,
|
|
6
|
+
ObjectLiteral,
|
|
7
|
+
Index,
|
|
8
|
+
CreateDateColumn,
|
|
9
|
+
UpdateDateColumn,
|
|
10
|
+
} from "typeorm";
|
|
11
|
+
import { ExtraExpenseStatus } from "../types/ExtraExpenseStatus";
|
|
12
|
+
import { ExtraExpenseDetail } from "./ExtraExpenseDetail";
|
|
13
|
+
|
|
14
|
+
@Entity("extra_expenses")
|
|
15
|
+
@Index(["expenseDate"])
|
|
16
|
+
@Index(["status"])
|
|
17
|
+
export class ExtraExpense implements ObjectLiteral {
|
|
18
|
+
@PrimaryGeneratedColumn("increment")
|
|
19
|
+
idExtraExpense!: number;
|
|
20
|
+
|
|
21
|
+
@Column("varchar", { length: 255, nullable: false })
|
|
22
|
+
description!: string;
|
|
23
|
+
|
|
24
|
+
@Column("decimal", { precision: 14, scale: 2, nullable: false, default: 0 })
|
|
25
|
+
totalAmount!: number;
|
|
26
|
+
|
|
27
|
+
@Column("date", { nullable: false })
|
|
28
|
+
expenseDate!: Date;
|
|
29
|
+
|
|
30
|
+
@Column({
|
|
31
|
+
type: "enum",
|
|
32
|
+
enum: ExtraExpenseStatus,
|
|
33
|
+
default: ExtraExpenseStatus.PENDING,
|
|
34
|
+
})
|
|
35
|
+
status!: ExtraExpenseStatus;
|
|
36
|
+
|
|
37
|
+
@Column("varchar", { length: 32, nullable: true })
|
|
38
|
+
paymentMethod?: string | null;
|
|
39
|
+
|
|
40
|
+
@Column("text", { nullable: true })
|
|
41
|
+
notes?: string | null;
|
|
42
|
+
|
|
43
|
+
@CreateDateColumn({ type: "timestamp" })
|
|
44
|
+
createdAt!: Date;
|
|
45
|
+
|
|
46
|
+
@UpdateDateColumn({ type: "timestamp" })
|
|
47
|
+
updatedAt!: Date;
|
|
48
|
+
|
|
49
|
+
@OneToMany(() => ExtraExpenseDetail, (detail) => detail.extraExpense, {
|
|
50
|
+
cascade: true,
|
|
51
|
+
})
|
|
52
|
+
details?: ExtraExpenseDetail[];
|
|
53
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Entity,
|
|
3
|
+
PrimaryGeneratedColumn,
|
|
4
|
+
Column,
|
|
5
|
+
ManyToOne,
|
|
6
|
+
JoinColumn,
|
|
7
|
+
ObjectLiteral,
|
|
8
|
+
} from "typeorm";
|
|
9
|
+
import { ExtraExpense } from "./ExtraExpense";
|
|
10
|
+
|
|
11
|
+
@Entity("extra_expense_details")
|
|
12
|
+
export class ExtraExpenseDetail implements ObjectLiteral {
|
|
13
|
+
@PrimaryGeneratedColumn("increment")
|
|
14
|
+
idExtraExpenseDetail!: number;
|
|
15
|
+
|
|
16
|
+
@ManyToOne(() => ExtraExpense, (expense) => expense.details, {
|
|
17
|
+
nullable: false,
|
|
18
|
+
onDelete: "CASCADE",
|
|
19
|
+
})
|
|
20
|
+
@JoinColumn({ name: "idExtraExpense" })
|
|
21
|
+
extraExpense!: ExtraExpense;
|
|
22
|
+
|
|
23
|
+
@Column("varchar", { length: 255, nullable: false })
|
|
24
|
+
concept!: string;
|
|
25
|
+
|
|
26
|
+
@Column("decimal", { precision: 12, scale: 4, nullable: false, default: 1 })
|
|
27
|
+
quantity!: number;
|
|
28
|
+
|
|
29
|
+
@Column("decimal", { precision: 14, scale: 4, nullable: false })
|
|
30
|
+
unitPrice!: number;
|
|
31
|
+
|
|
32
|
+
@Column("decimal", { precision: 14, scale: 2, nullable: false })
|
|
33
|
+
subtotal!: number;
|
|
34
|
+
|
|
35
|
+
@Column("text", { nullable: true })
|
|
36
|
+
notes?: string | null;
|
|
37
|
+
}
|
|
@@ -16,6 +16,7 @@ import { InventoryImage } from "./InventoryImage";
|
|
|
16
16
|
import { InventoryMovement } from "./InventoryMovement";
|
|
17
17
|
import { PlantTechnicalSheet } from "../models/technical-sheet/PlantTechnicalSheet";
|
|
18
18
|
import { InventoryTechnicalSheet } from "../models/technical-sheet/inventory-technical-sheet.entity";
|
|
19
|
+
import { InventoryExpenseDistribution } from "./InventoryExpenseDistribution";
|
|
19
20
|
|
|
20
21
|
@Entity("inventory")
|
|
21
22
|
export class Inventory implements ObjectLiteral {
|
|
@@ -74,4 +75,7 @@ export class Inventory implements ObjectLiteral {
|
|
|
74
75
|
|
|
75
76
|
@OneToMany(() => InventoryMovement, (movement) => movement.inventory)
|
|
76
77
|
movements!: InventoryMovement[];
|
|
78
|
+
|
|
79
|
+
@OneToMany(() => InventoryExpenseDistribution, (dist) => dist.inventory)
|
|
80
|
+
expenseDistributions?: InventoryExpenseDistribution[];
|
|
77
81
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Entity,
|
|
3
|
+
PrimaryGeneratedColumn,
|
|
4
|
+
Column,
|
|
5
|
+
OneToMany,
|
|
6
|
+
ObjectLiteral,
|
|
7
|
+
Index,
|
|
8
|
+
CreateDateColumn,
|
|
9
|
+
UpdateDateColumn,
|
|
10
|
+
} from "typeorm";
|
|
11
|
+
import { InventoryExpenseType } from "../types/InventoryExpenseType";
|
|
12
|
+
import { InventoryExpenseStatus } from "../types/InventoryExpenseStatus";
|
|
13
|
+
import { InventoryExpenseDetail } from "./InventoryExpenseDetail";
|
|
14
|
+
import { InventoryExpenseDistribution } from "./InventoryExpenseDistribution";
|
|
15
|
+
|
|
16
|
+
@Entity("inventory_expenses")
|
|
17
|
+
@Index(["expenseDate"])
|
|
18
|
+
@Index(["status"])
|
|
19
|
+
@Index(["expenseType"])
|
|
20
|
+
export class InventoryExpense implements ObjectLiteral {
|
|
21
|
+
@PrimaryGeneratedColumn("increment")
|
|
22
|
+
idInventoryExpense!: number;
|
|
23
|
+
|
|
24
|
+
@Column({
|
|
25
|
+
type: "enum",
|
|
26
|
+
enum: InventoryExpenseType,
|
|
27
|
+
nullable: false,
|
|
28
|
+
})
|
|
29
|
+
expenseType!: InventoryExpenseType;
|
|
30
|
+
|
|
31
|
+
@Column("varchar", { length: 255, nullable: false })
|
|
32
|
+
description!: string;
|
|
33
|
+
|
|
34
|
+
@Column("decimal", { precision: 14, scale: 2, nullable: false, default: 0 })
|
|
35
|
+
totalAmount!: number;
|
|
36
|
+
|
|
37
|
+
@Column("date", { nullable: false })
|
|
38
|
+
expenseDate!: Date;
|
|
39
|
+
|
|
40
|
+
@Column({
|
|
41
|
+
type: "enum",
|
|
42
|
+
enum: InventoryExpenseStatus,
|
|
43
|
+
default: InventoryExpenseStatus.PENDING,
|
|
44
|
+
})
|
|
45
|
+
status!: InventoryExpenseStatus;
|
|
46
|
+
|
|
47
|
+
@Column("varchar", { length: 32, nullable: true })
|
|
48
|
+
paymentMethod?: string | null;
|
|
49
|
+
|
|
50
|
+
@Column("text", { nullable: true })
|
|
51
|
+
notes?: string | null;
|
|
52
|
+
|
|
53
|
+
@CreateDateColumn({ type: "timestamp" })
|
|
54
|
+
createdAt!: Date;
|
|
55
|
+
|
|
56
|
+
@UpdateDateColumn({ type: "timestamp" })
|
|
57
|
+
updatedAt!: Date;
|
|
58
|
+
|
|
59
|
+
@OneToMany(() => InventoryExpenseDistribution, (dist) => dist.inventoryExpense, {
|
|
60
|
+
cascade: true,
|
|
61
|
+
})
|
|
62
|
+
distributions!: InventoryExpenseDistribution[];
|
|
63
|
+
|
|
64
|
+
@OneToMany(() => InventoryExpenseDetail, (detail) => detail.inventoryExpense, {
|
|
65
|
+
cascade: true,
|
|
66
|
+
})
|
|
67
|
+
details?: InventoryExpenseDetail[];
|
|
68
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Entity,
|
|
3
|
+
PrimaryGeneratedColumn,
|
|
4
|
+
Column,
|
|
5
|
+
ManyToOne,
|
|
6
|
+
JoinColumn,
|
|
7
|
+
ObjectLiteral,
|
|
8
|
+
} from "typeorm";
|
|
9
|
+
import { InventoryExpense } from "./InventoryExpense";
|
|
10
|
+
|
|
11
|
+
@Entity("inventory_expense_details")
|
|
12
|
+
export class InventoryExpenseDetail implements ObjectLiteral {
|
|
13
|
+
@PrimaryGeneratedColumn("increment")
|
|
14
|
+
idInventoryExpenseDetail!: number;
|
|
15
|
+
|
|
16
|
+
@ManyToOne(() => InventoryExpense, (expense) => expense.details, {
|
|
17
|
+
nullable: false,
|
|
18
|
+
onDelete: "CASCADE",
|
|
19
|
+
})
|
|
20
|
+
@JoinColumn({ name: "idInventoryExpense" })
|
|
21
|
+
inventoryExpense!: InventoryExpense;
|
|
22
|
+
|
|
23
|
+
@Column("varchar", { length: 255, nullable: false })
|
|
24
|
+
concept!: string;
|
|
25
|
+
|
|
26
|
+
@Column("decimal", { precision: 12, scale: 4, nullable: false, default: 1 })
|
|
27
|
+
quantity!: number;
|
|
28
|
+
|
|
29
|
+
@Column("decimal", { precision: 14, scale: 4, nullable: false })
|
|
30
|
+
unitPrice!: number;
|
|
31
|
+
|
|
32
|
+
@Column("decimal", { precision: 14, scale: 2, nullable: false })
|
|
33
|
+
subtotal!: number;
|
|
34
|
+
|
|
35
|
+
@Column("text", { nullable: true })
|
|
36
|
+
notes?: string | null;
|
|
37
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Entity,
|
|
3
|
+
PrimaryGeneratedColumn,
|
|
4
|
+
Column,
|
|
5
|
+
ManyToOne,
|
|
6
|
+
JoinColumn,
|
|
7
|
+
ObjectLiteral,
|
|
8
|
+
} from "typeorm";
|
|
9
|
+
import { InventoryExpense } from "./InventoryExpense";
|
|
10
|
+
import { Inventory } from "./Inventory";
|
|
11
|
+
|
|
12
|
+
@Entity("inventory_expense_distributions")
|
|
13
|
+
export class InventoryExpenseDistribution implements ObjectLiteral {
|
|
14
|
+
@PrimaryGeneratedColumn("increment")
|
|
15
|
+
idDistribution!: number;
|
|
16
|
+
|
|
17
|
+
@ManyToOne(() => InventoryExpense, (expense) => expense.distributions, {
|
|
18
|
+
nullable: false,
|
|
19
|
+
onDelete: "CASCADE",
|
|
20
|
+
})
|
|
21
|
+
@JoinColumn({ name: "idInventoryExpense" })
|
|
22
|
+
inventoryExpense!: InventoryExpense;
|
|
23
|
+
|
|
24
|
+
@ManyToOne(() => Inventory, (inventory) => inventory.expenseDistributions, {
|
|
25
|
+
nullable: false,
|
|
26
|
+
})
|
|
27
|
+
@JoinColumn({ name: "idInventory" })
|
|
28
|
+
inventory!: Inventory;
|
|
29
|
+
|
|
30
|
+
@Column("decimal", { precision: 5, scale: 2, nullable: false })
|
|
31
|
+
percentage!: number;
|
|
32
|
+
|
|
33
|
+
@Column("decimal", { precision: 14, scale: 2, nullable: false })
|
|
34
|
+
amount!: number;
|
|
35
|
+
|
|
36
|
+
@Column("text", { nullable: true })
|
|
37
|
+
notes?: string | null;
|
|
38
|
+
}
|
package/src/entities/index.ts
CHANGED
|
@@ -17,6 +17,9 @@ export { Inventory } from "./Inventory";
|
|
|
17
17
|
export { InventoryItem } from "./InventoryItem";
|
|
18
18
|
export { InventoryImage } from "./InventoryImage";
|
|
19
19
|
export { InventoryMovement } from "./InventoryMovement";
|
|
20
|
+
export { InventoryExpense } from "./InventoryExpense";
|
|
21
|
+
export { InventoryExpenseDetail } from "./InventoryExpenseDetail";
|
|
22
|
+
export { InventoryExpenseDistribution } from "./InventoryExpenseDistribution";
|
|
20
23
|
export { ContainerType } from "./ContainerType";
|
|
21
24
|
|
|
22
25
|
// Suppliers
|
|
@@ -42,6 +45,10 @@ export { ExpenditureDetail } from "./ExpenditureDetail";
|
|
|
42
45
|
// Dividends
|
|
43
46
|
export { Dividend } from "./Dividend";
|
|
44
47
|
|
|
48
|
+
// Extra Expenses
|
|
49
|
+
export { ExtraExpense } from "./ExtraExpense";
|
|
50
|
+
export { ExtraExpenseDetail } from "./ExtraExpenseDetail";
|
|
51
|
+
|
|
45
52
|
// Others
|
|
46
53
|
export { ProjectOrder } from "./ProjectOrder";
|
|
47
54
|
export { UnitOfMeasure } from "./UnitOfMesure";
|
package/src/types/index.ts
CHANGED
|
@@ -22,4 +22,11 @@ export { ExpenditureStatus } from "./ExpenditureStatus";
|
|
|
22
22
|
export { CostType } from "./CostType";
|
|
23
23
|
|
|
24
24
|
// Dividend enums
|
|
25
|
-
export { DividendStatus } from "./DividendStatus";
|
|
25
|
+
export { DividendStatus } from "./DividendStatus";
|
|
26
|
+
|
|
27
|
+
// Extra Expense enums
|
|
28
|
+
export { ExtraExpenseStatus } from "./ExtraExpenseStatus";
|
|
29
|
+
|
|
30
|
+
// Inventory Expense enums
|
|
31
|
+
export { InventoryExpenseType } from "./InventoryExpenseType";
|
|
32
|
+
export { InventoryExpenseStatus } from "./InventoryExpenseStatus";
|