@tomei/finance 0.2.14 → 0.3.0
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/README.md +8 -36
- package/dist/account/account.d.ts +2 -2
- package/dist/account/account.js +52 -39
- package/dist/account/account.js.map +1 -1
- package/dist/account/account.repository.d.ts +1 -1
- package/dist/account/account.repository.js +2 -2
- package/dist/account/account.repository.js.map +1 -1
- package/dist/account/interfaces/account.repository.interface.d.ts +1 -1
- package/dist/account-system-entity/account-system-entity.js +51 -30
- package/dist/account-system-entity/account-system-entity.js.map +1 -1
- package/dist/account-system-entity/post-history.repository.d.ts +1 -1
- package/dist/account-system-entity/post-history.repository.js +2 -3
- package/dist/account-system-entity/post-history.repository.js.map +1 -1
- package/dist/customer/customer.d.ts +6 -5
- package/dist/customer/customer.js +32 -19
- package/dist/customer/customer.js.map +1 -1
- package/dist/customer/finance-customer.repository.d.ts +1 -1
- package/dist/customer/finance-customer.repository.js +2 -2
- package/dist/customer/finance-customer.repository.js.map +1 -1
- package/dist/customer/interfaces/finance-customer.repository.interface.d.ts +1 -1
- package/dist/database.d.ts +4 -0
- package/dist/database.js +15 -0
- package/dist/database.js.map +1 -0
- package/dist/document/document-item.d.ts +2 -2
- package/dist/document/document-item.repository.d.ts +1 -1
- package/dist/document/document-item.repository.js +2 -2
- package/dist/document/document-item.repository.js.map +1 -1
- package/dist/document/document.d.ts +43 -21
- package/dist/document/document.js +202 -67
- package/dist/document/document.js.map +1 -1
- package/dist/document/document.repository.d.ts +1 -1
- package/dist/document/document.repository.js +2 -2
- package/dist/document/document.repository.js.map +1 -1
- package/dist/document/interfaces/document-attr.interface.d.ts +10 -4
- package/dist/document/interfaces/document-attr.interface.js.map +1 -1
- package/dist/document/interfaces/document-item-attr.interface.d.ts +2 -2
- package/dist/document/interfaces/document-item.repository.interface.d.ts +1 -1
- package/dist/document/interfaces/document.repository.interface.d.ts +1 -1
- package/dist/enum/doc-type.enum.d.ts +1 -0
- package/dist/enum/doc-type.enum.js +1 -0
- package/dist/enum/doc-type.enum.js.map +1 -1
- package/dist/enum/document-status.enum.d.ts +3 -2
- package/dist/enum/document-status.enum.js +3 -2
- package/dist/enum/document-status.enum.js.map +1 -1
- package/dist/finance-company/finance-company.d.ts +14 -8
- package/dist/finance-company/finance-company.js +195 -151
- package/dist/finance-company/finance-company.js.map +1 -1
- package/dist/finance-company/finance-company.repository.d.ts +1 -1
- package/dist/finance-company/finance-company.repository.js +2 -3
- package/dist/finance-company/finance-company.repository.js.map +1 -1
- package/dist/index.d.ts +12 -9
- package/dist/index.js +20 -25
- package/dist/index.js.map +1 -1
- package/dist/interfaces/account-system.interface.d.ts +4 -4
- package/dist/journal-entry/journal-entry.d.ts +3 -3
- package/dist/journal-entry/journal-entry.js +52 -37
- package/dist/journal-entry/journal-entry.js.map +1 -1
- package/dist/journal-entry/journal-entry.repository.d.ts +1 -1
- package/dist/journal-entry/journal-entry.repository.js +2 -2
- package/dist/journal-entry/journal-entry.repository.js.map +1 -1
- package/dist/ledger-transaction/ledger-transaction.js +39 -26
- package/dist/ledger-transaction/ledger-transaction.js.map +1 -1
- package/dist/ledger-transaction/ledger-transaction.repository.d.ts +1 -1
- package/dist/ledger-transaction/ledger-transaction.repository.js +2 -2
- package/dist/ledger-transaction/ledger-transaction.repository.js.map +1 -1
- package/dist/models/account.entity.d.ts +26 -0
- package/dist/models/account.entity.js +198 -0
- package/dist/models/account.entity.js.map +1 -0
- package/dist/models/customer.entity.d.ts +13 -0
- package/dist/models/customer.entity.js +110 -0
- package/dist/models/customer.entity.js.map +1 -0
- package/dist/models/document-item.entity.d.ts +27 -0
- package/dist/models/document-item.entity.js +173 -0
- package/dist/models/document-item.entity.js.map +1 -0
- package/dist/models/document.entity.d.ts +30 -0
- package/dist/models/document.entity.js +222 -0
- package/dist/models/document.entity.js.map +1 -0
- package/dist/models/finance-company.entity.d.ts +13 -0
- package/dist/models/finance-company.entity.js +65 -0
- package/dist/models/finance-company.entity.js.map +1 -0
- package/dist/models/journal-entry.entity.d.ts +16 -0
- package/dist/models/journal-entry.entity.js +128 -0
- package/dist/models/journal-entry.entity.js.map +1 -0
- package/dist/models/ledger-transaction.entity.d.ts +19 -0
- package/dist/models/ledger-transaction.entity.js +156 -0
- package/dist/models/ledger-transaction.entity.js.map +1 -0
- package/dist/models/payment-item.entity.d.ts +10 -0
- package/dist/models/payment-item.entity.js +61 -0
- package/dist/models/payment-item.entity.js.map +1 -0
- package/dist/models/payment.entity.d.ts +25 -0
- package/dist/models/payment.entity.js +151 -0
- package/dist/models/payment.entity.js.map +1 -0
- package/dist/models/post-history.entity.d.ts +11 -0
- package/dist/models/post-history.entity.js +64 -0
- package/dist/models/post-history.entity.js.map +1 -0
- package/dist/payment/interfaces/payment-item.repository.interface.d.ts +1 -1
- package/dist/payment/interfaces/payment.repository.interface.d.ts +1 -1
- package/dist/payment/payment-item.repository.d.ts +1 -1
- package/dist/payment/payment-item.repository.js +2 -2
- package/dist/payment/payment-item.repository.js.map +1 -1
- package/dist/payment/payment.d.ts +4 -4
- package/dist/payment/payment.js +92 -77
- package/dist/payment/payment.js.map +1 -1
- package/dist/payment/payment.repository.d.ts +1 -1
- package/dist/payment/payment.repository.js +2 -2
- package/dist/payment/payment.repository.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/img.png +0 -0
- package/img_1.png +0 -0
- package/migrations/finance-document-item-migration.js +2 -2
- package/migrations/finance-document-migration.js +44 -13
- package/package.json +7 -4
- package/src/account/account.repository.ts +1 -1
- package/src/account/account.ts +3 -2
- package/src/account/interfaces/account.repository.interface.ts +1 -1
- package/src/account-system-entity/account-system-entity.ts +7 -3
- package/src/account-system-entity/post-history.repository.ts +2 -3
- package/src/customer/customer.ts +12 -5
- package/src/customer/finance-customer.repository.ts +1 -1
- package/src/customer/interfaces/finance-customer.repository.interface.ts +1 -1
- package/src/database.ts +15 -0
- package/src/document/document-item.repository.ts +1 -1
- package/src/document/document-item.ts +2 -2
- package/src/document/document.repository.ts +1 -1
- package/src/document/document.ts +281 -76
- package/src/document/interfaces/document-attr.interface.ts +10 -4
- package/src/document/interfaces/document-item-attr.interface.ts +2 -2
- package/src/document/interfaces/document-item.repository.interface.ts +1 -1
- package/src/document/interfaces/document.repository.interface.ts +1 -1
- package/src/enum/doc-type.enum.ts +2 -1
- package/src/enum/document-status.enum.ts +3 -2
- package/src/finance-company/finance-company.repository.ts +2 -3
- package/src/finance-company/finance-company.ts +69 -31
- package/src/index.ts +22 -9
- package/src/interfaces/account-system.interface.ts +10 -4
- package/src/journal-entry/journal-entry.repository.ts +1 -1
- package/src/journal-entry/journal-entry.ts +4 -4
- package/src/ledger-transaction/ledger-transaction.repository.ts +1 -1
- package/src/{account/entities → models}/account.entity.ts +5 -5
- package/src/{customer/entities → models}/customer.entity.ts +2 -2
- package/src/{document/entities → models}/document-item.entity.ts +5 -5
- package/src/models/document.entity.ts +193 -0
- package/src/{finance-company → models}/finance-company.entity.ts +2 -2
- package/src/{journal-entry/entities → models}/journal-entry.entity.ts +3 -3
- package/src/{ledger-transaction/entities → models}/ledger-transaction.entity.ts +3 -3
- package/src/{payment/entities → models}/payment-item.entity.ts +2 -2
- package/src/{payment/entities → models}/payment.entity.ts +4 -4
- package/src/{account-system-entity → models}/post-history.entity.ts +1 -1
- package/src/payment/interfaces/payment-item.repository.interface.ts +1 -1
- package/src/payment/interfaces/payment.repository.interface.ts +1 -1
- package/src/payment/payment-item.repository.ts +1 -1
- package/src/payment/payment.repository.ts +1 -1
- package/src/payment/payment.ts +7 -6
- package/tsconfig.json +1 -9
- package/src/account/index.ts +0 -17
- package/src/account-system-entity/index.ts +0 -3
- package/src/customer/index.ts +0 -15
- package/src/document/entities/document.entity.ts +0 -106
- package/src/document/index.ts +0 -23
- package/src/finance-company/index.ts +0 -4
- package/src/journal-entry/index.ts +0 -13
- package/src/ledger-transaction/index.ts +0 -13
- package/src/payment/index.ts +0 -21
|
@@ -1,44 +1,66 @@
|
|
|
1
1
|
/// <reference types="multer" />
|
|
2
2
|
import { IBaseRepository } from '@tomei/general';
|
|
3
|
-
import { IMediasRepository, CommonService as MediaCommonService } from '@tomei/media';
|
|
4
|
-
import { DocType } from '../enum';
|
|
5
|
-
import { DocumentRepository } from './document.repository';
|
|
3
|
+
import { IMediasRepository, CommonService as MediaCommonService, MediasModel } from '@tomei/media';
|
|
4
|
+
import { DocumentStatus, DocType } from '../enum';
|
|
6
5
|
import { IDocumentAttr } from './interfaces/document-attr.interface';
|
|
7
6
|
import { DocumentItemRepository } from './document-item.repository';
|
|
8
7
|
import { DocumentItem } from './document-item';
|
|
9
|
-
import {
|
|
8
|
+
import { IDocumentRepository } from './interfaces/document.repository.interface';
|
|
9
|
+
import { AccountSystemEntity } from '../account-system-entity/account-system-entity';
|
|
10
|
+
import DocumentModel from '../models/document.entity';
|
|
10
11
|
export declare class Document extends AccountSystemEntity {
|
|
11
|
-
protected BaseRepository: IBaseRepository;
|
|
12
|
-
ObjectId: string;
|
|
13
|
-
ObjectName: string;
|
|
14
|
-
TableName: string;
|
|
15
12
|
DocNo: string;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
SystemCode: string;
|
|
13
|
+
private _DocType;
|
|
14
|
+
private _DocDate;
|
|
19
15
|
Currency: string;
|
|
20
16
|
Amount: number;
|
|
21
17
|
Description: string;
|
|
22
18
|
IssuedById: string;
|
|
23
19
|
IssuedToId: string;
|
|
24
20
|
IssuedToType: string;
|
|
25
|
-
|
|
21
|
+
CreatedById: string;
|
|
22
|
+
CreatedAt: Date;
|
|
23
|
+
UpdatedById?: string;
|
|
24
|
+
UpdatedAt?: Date;
|
|
26
25
|
UseAccSystemDocYN: string;
|
|
27
|
-
private
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
private _documentRepository;
|
|
27
|
+
protected _BaseRepository: IBaseRepository;
|
|
28
|
+
_ObjectId: string;
|
|
29
|
+
_ObjectName: string;
|
|
30
|
+
_TableName: string;
|
|
31
|
+
private _DocHTMLFileMediaId;
|
|
32
|
+
private _DocPDFFileMediaId;
|
|
33
|
+
private _Status;
|
|
30
34
|
private IsNewRecord;
|
|
31
35
|
private _DocumentItems;
|
|
32
|
-
documentRepository:
|
|
36
|
+
documentRepository: IDocumentRepository;
|
|
33
37
|
documentItemRepository: DocumentItemRepository;
|
|
34
38
|
mediaRepository: IMediasRepository;
|
|
35
39
|
mediaCommonService: MediaCommonService;
|
|
40
|
+
get DocType(): DocType;
|
|
41
|
+
private set DocType(value);
|
|
42
|
+
get DocDate(): Date;
|
|
43
|
+
private set DocDate(value);
|
|
44
|
+
get DocHTMLFileMediaId(): string;
|
|
45
|
+
private set DocHTMLFileMediaId(value);
|
|
46
|
+
get DocPDFFileMediaId(): string;
|
|
47
|
+
private set DocPDFFileMediaId(value);
|
|
48
|
+
get Status(): DocumentStatus;
|
|
49
|
+
private set Status(value);
|
|
50
|
+
get BaseRepository(): IBaseRepository<DocumentModel>;
|
|
51
|
+
get ObjectId(): string;
|
|
52
|
+
get ObjectName(): string;
|
|
53
|
+
get TableName(): string;
|
|
54
|
+
constructor(dbTransaction: any);
|
|
36
55
|
get DocumentItems(): any;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
get
|
|
40
|
-
get
|
|
56
|
+
static DEFAULT_INVOICE_TEMPLATE_HTML(): Promise<Express.Multer.File>;
|
|
57
|
+
static DEFAULT_INVOICE_TEMPLATE_PDF(): Promise<Express.Multer.File>;
|
|
58
|
+
get DocumentFileInHTML(): Promise<MediasModel>;
|
|
59
|
+
get DocumentFileInPDF(): Promise<MediasModel>;
|
|
41
60
|
init(params: IDocumentAttr): void;
|
|
42
|
-
generateInvoice(userId?: string): Promise<
|
|
61
|
+
generateInvoice(userId?: string): Promise<{
|
|
62
|
+
HTMLMedia: MediasModel;
|
|
63
|
+
PDFMedia: MediasModel;
|
|
64
|
+
}>;
|
|
43
65
|
newDocumentItem(): Promise<DocumentItem>;
|
|
44
66
|
}
|
|
@@ -1,15 +1,107 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.Document = void 0;
|
|
4
13
|
const util = require("util");
|
|
5
14
|
const fs = require("fs");
|
|
15
|
+
const puppeteer_1 = require("puppeteer");
|
|
16
|
+
const general_1 = require("@tomei/general");
|
|
6
17
|
const media_1 = require("@tomei/media");
|
|
18
|
+
const enum_1 = require("../enum");
|
|
7
19
|
const document_item_1 = require("./document-item");
|
|
8
|
-
const account_system_entity_1 = require("../account-system-entity");
|
|
20
|
+
const account_system_entity_1 = require("../account-system-entity/account-system-entity");
|
|
21
|
+
const document_entity_1 = require("../models/document.entity");
|
|
9
22
|
class Document extends account_system_entity_1.AccountSystemEntity {
|
|
10
|
-
|
|
11
|
-
|
|
23
|
+
get DocType() {
|
|
24
|
+
return this._DocType;
|
|
25
|
+
}
|
|
26
|
+
set DocType(docType) {
|
|
27
|
+
this._DocType = docType;
|
|
28
|
+
}
|
|
29
|
+
get DocDate() {
|
|
30
|
+
return this._DocDate;
|
|
31
|
+
}
|
|
32
|
+
set DocDate(date) {
|
|
33
|
+
this._DocDate = date;
|
|
34
|
+
}
|
|
35
|
+
get DocHTMLFileMediaId() {
|
|
36
|
+
return this._DocHTMLFileMediaId;
|
|
37
|
+
}
|
|
38
|
+
set DocHTMLFileMediaId(mediaId) {
|
|
39
|
+
this._DocHTMLFileMediaId = mediaId;
|
|
40
|
+
}
|
|
41
|
+
get DocPDFFileMediaId() {
|
|
42
|
+
return this._DocPDFFileMediaId;
|
|
43
|
+
}
|
|
44
|
+
set DocPDFFileMediaId(mediaId) {
|
|
45
|
+
this._DocPDFFileMediaId = mediaId;
|
|
46
|
+
}
|
|
47
|
+
get Status() {
|
|
48
|
+
return this._Status;
|
|
49
|
+
}
|
|
50
|
+
set Status(status) {
|
|
51
|
+
this._Status = status;
|
|
52
|
+
}
|
|
53
|
+
get BaseRepository() {
|
|
54
|
+
return this._documentRepository;
|
|
55
|
+
}
|
|
56
|
+
get ObjectId() {
|
|
57
|
+
return this.DocNo;
|
|
58
|
+
}
|
|
59
|
+
get ObjectName() {
|
|
60
|
+
return this.DocNo;
|
|
61
|
+
}
|
|
62
|
+
get TableName() {
|
|
63
|
+
return 'finance_Document';
|
|
64
|
+
}
|
|
65
|
+
constructor(dbTransaction, docNo) {
|
|
66
|
+
super();
|
|
67
|
+
this._DocDate = new Date();
|
|
68
|
+
this._documentRepository = new document_entity_1.default();
|
|
69
|
+
this._Status = enum_1.DocumentStatus.UNPAID;
|
|
12
70
|
this.IsNewRecord = true;
|
|
71
|
+
const documentData = this.BaseRepository.findOne({
|
|
72
|
+
where: {
|
|
73
|
+
DocNo: docNo,
|
|
74
|
+
},
|
|
75
|
+
transaction: dbTransaction,
|
|
76
|
+
});
|
|
77
|
+
if (documentData) {
|
|
78
|
+
this.IsNewRecord = false;
|
|
79
|
+
this.DocType = documentData.DocType;
|
|
80
|
+
this.DocDate = documentData.DocDate;
|
|
81
|
+
this.CompanyId = documentData.CompanyId;
|
|
82
|
+
this.Currency = documentData.Currency;
|
|
83
|
+
this.Amount = documentData.Amount;
|
|
84
|
+
this.Description = documentData.Description;
|
|
85
|
+
this.Status = documentData.Status;
|
|
86
|
+
this.IssuedById = documentData.IssuedById;
|
|
87
|
+
this.IssuedToId = documentData.IssuedToId;
|
|
88
|
+
this.IssuedToType = documentData.IssuedToType;
|
|
89
|
+
this.CreatedById = documentData.CreatedById;
|
|
90
|
+
this.CreatedAt = documentData.CreatedAt;
|
|
91
|
+
this.UpdatedById = documentData.UpdatedById;
|
|
92
|
+
this.UpdatedAt = documentData.UpdatedAt;
|
|
93
|
+
this.DocPDFFileMediaId = documentData.DocPDFFileMediaId;
|
|
94
|
+
this.DocHTMLFileMediaId = documentData.DocHTMLFileMediaId;
|
|
95
|
+
this.AccSystemRefId = documentData.AccSystemRefId;
|
|
96
|
+
this.PostedToAccSystemYN = documentData.PostedToAccSystemYN;
|
|
97
|
+
this.PostedById = documentData.PostedById;
|
|
98
|
+
this.PostedDateTime = documentData.PostedDateTime;
|
|
99
|
+
this.UseAccSystemDocYN = documentData.UseAccSystemDocYN;
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
const notFoundError = new general_1.RecordNotFoundError('No Record Found.');
|
|
103
|
+
throw notFoundError;
|
|
104
|
+
}
|
|
13
105
|
}
|
|
14
106
|
get DocumentItems() {
|
|
15
107
|
if (this._DocumentItems === null) {
|
|
@@ -27,11 +119,11 @@ class Document extends account_system_entity_1.AccountSystemEntity {
|
|
|
27
119
|
}
|
|
28
120
|
return this._DocumentItems;
|
|
29
121
|
}
|
|
30
|
-
|
|
31
|
-
return (
|
|
32
|
-
|
|
122
|
+
static DEFAULT_INVOICE_TEMPLATE_HTML() {
|
|
123
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
124
|
+
const HTMLTemplateFilePath = './invoice-template/index.html';
|
|
33
125
|
const readFileContent = util.promisify(fs.readFile);
|
|
34
|
-
const htmlBuffer =
|
|
126
|
+
const htmlBuffer = yield readFileContent(HTMLTemplateFilePath);
|
|
35
127
|
const htmlStream = {
|
|
36
128
|
buffer: htmlBuffer,
|
|
37
129
|
fieldname: 'FileStream',
|
|
@@ -45,17 +137,40 @@ class Document extends account_system_entity_1.AccountSystemEntity {
|
|
|
45
137
|
stream: null,
|
|
46
138
|
};
|
|
47
139
|
return htmlStream;
|
|
48
|
-
})
|
|
140
|
+
});
|
|
49
141
|
}
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
|
|
142
|
+
static DEFAULT_INVOICE_TEMPLATE_PDF() {
|
|
143
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
144
|
+
const HTMLTemplateFilePath = './invoice-template/index.html';
|
|
53
145
|
const readFileContent = util.promisify(fs.readFile);
|
|
54
|
-
const
|
|
146
|
+
const htmlString = yield readFileContent(HTMLTemplateFilePath, 'utf8');
|
|
147
|
+
const browser = yield puppeteer_1.default.launch();
|
|
148
|
+
const page = yield browser.newPage();
|
|
149
|
+
if (HTMLTemplateFilePath) {
|
|
150
|
+
yield page.goto(HTMLTemplateFilePath, {
|
|
151
|
+
waitUntil: 'networkidle2',
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
else if (htmlString) {
|
|
155
|
+
yield page.setContent(htmlString);
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
yield browser.close();
|
|
159
|
+
}
|
|
160
|
+
const pdfBuffer = yield page.pdf({
|
|
161
|
+
format: 'a4',
|
|
162
|
+
printBackground: true,
|
|
163
|
+
margin: {
|
|
164
|
+
left: '0px',
|
|
165
|
+
top: '0px',
|
|
166
|
+
right: '0px',
|
|
167
|
+
bottom: '0px',
|
|
168
|
+
},
|
|
169
|
+
});
|
|
55
170
|
const pdfStream = {
|
|
56
171
|
buffer: pdfBuffer,
|
|
57
172
|
fieldname: 'FileStream',
|
|
58
|
-
originalname: 'sample-invoice.
|
|
173
|
+
originalname: 'sample-invoice.pdf',
|
|
59
174
|
mimetype: 'application/pdf',
|
|
60
175
|
size: pdfBuffer.length,
|
|
61
176
|
encoding: '8bit',
|
|
@@ -65,19 +180,25 @@ class Document extends account_system_entity_1.AccountSystemEntity {
|
|
|
65
180
|
stream: null,
|
|
66
181
|
};
|
|
67
182
|
return pdfStream;
|
|
68
|
-
})
|
|
183
|
+
});
|
|
69
184
|
}
|
|
70
|
-
get
|
|
71
|
-
return this
|
|
185
|
+
get DocumentFileInHTML() {
|
|
186
|
+
return (() => __awaiter(this, void 0, void 0, function* () {
|
|
187
|
+
const { HTMLMedia } = yield this.generateInvoice();
|
|
188
|
+
return HTMLMedia;
|
|
189
|
+
}))();
|
|
72
190
|
}
|
|
73
|
-
get
|
|
74
|
-
return this
|
|
191
|
+
get DocumentFileInPDF() {
|
|
192
|
+
return (() => __awaiter(this, void 0, void 0, function* () {
|
|
193
|
+
const { PDFMedia } = yield this.generateInvoice();
|
|
194
|
+
return PDFMedia;
|
|
195
|
+
}))();
|
|
75
196
|
}
|
|
76
197
|
init(params) {
|
|
77
198
|
this.DocNo = params.DocNo;
|
|
78
199
|
this.DocType = params.DocType;
|
|
79
200
|
this.DocDate = params.DocDate;
|
|
80
|
-
this.
|
|
201
|
+
this.CompanyId = params.CompanyId;
|
|
81
202
|
this.Currency = params.Currency;
|
|
82
203
|
this.Amount = params.Amount;
|
|
83
204
|
this.Description = params.Description;
|
|
@@ -85,57 +206,71 @@ class Document extends account_system_entity_1.AccountSystemEntity {
|
|
|
85
206
|
this.IssuedById = params.IssuedById;
|
|
86
207
|
this.IssuedToId = params.IssuedToId;
|
|
87
208
|
this.IssuedToType = params.IssuedToType;
|
|
88
|
-
this.
|
|
209
|
+
this.CreatedById = params.CreatedById;
|
|
210
|
+
this.CreatedAt = params.CreatedAt;
|
|
211
|
+
this.UpdatedById = params.UpdatedById;
|
|
212
|
+
this.UpdatedAt = params.UpdatedAt;
|
|
213
|
+
this.DocPDFFileMediaId = params.DocPDFFileMediaId;
|
|
214
|
+
this.DocHTMLFileMediaId = params.DocHTMLFileMediaId;
|
|
215
|
+
this.AccSystemRefId = params.AccSystemRefId;
|
|
89
216
|
this.PostedToAccSystemYN = params.PostedToAccSystemYN;
|
|
217
|
+
this.PostedById = params.PostedById;
|
|
218
|
+
this.PostedDateTime = params.PostedDateTime;
|
|
90
219
|
this.UseAccSystemDocYN = params.UseAccSystemDocYN;
|
|
91
|
-
this.DocPDFFilePath = params.DocPDFFilePath;
|
|
92
|
-
this.DocHTMLFilePath = params.DocHTMLFilePath;
|
|
93
|
-
}
|
|
94
|
-
async generateInvoice(userId) {
|
|
95
|
-
const media = new media_1.Medias(this.mediaRepository, this.mediaCommonService);
|
|
96
|
-
const htmlPayload = {
|
|
97
|
-
ObjectId: this.DocNo,
|
|
98
|
-
ObjectType: this.DocType,
|
|
99
|
-
Type: media_1.MediaType.Document,
|
|
100
|
-
FileName: `${this.DocType}-${this.DocNo}`,
|
|
101
|
-
FileStream: '',
|
|
102
|
-
FileExtension: 'HTML',
|
|
103
|
-
Title: `${this.DocType}-${this.DocNo}.html`,
|
|
104
|
-
Description: `HTML ${this.DocType}`,
|
|
105
|
-
IsEncryptedYN: 'N',
|
|
106
|
-
};
|
|
107
|
-
await media.postInternal(await this.InvoiceInHTML, htmlPayload, userId !== null && userId !== void 0 ? userId : 'System');
|
|
108
|
-
const pdfPayload = {
|
|
109
|
-
ObjectId: this.DocNo,
|
|
110
|
-
ObjectType: this.DocType,
|
|
111
|
-
Type: media_1.MediaType.Document,
|
|
112
|
-
FileName: `${this.DocType}-${this.DocNo}`,
|
|
113
|
-
FileStream: '',
|
|
114
|
-
FileExtension: 'PDF',
|
|
115
|
-
Title: `${this.DocType}-${this.DocNo}.pdf`,
|
|
116
|
-
Description: `PDF ${this.DocType}`,
|
|
117
|
-
IsEncryptedYN: 'N',
|
|
118
|
-
};
|
|
119
|
-
await media.postInternal(await this.InvoiceInPDF, pdfPayload, userId !== null && userId !== void 0 ? userId : 'System');
|
|
120
|
-
try {
|
|
121
|
-
const document = await this.documentRepository.findOne({
|
|
122
|
-
where: {
|
|
123
|
-
DocNo: this.DocNo,
|
|
124
|
-
},
|
|
125
|
-
});
|
|
126
|
-
document.DocHTMLFilePath = this.DocHTMLFilePath;
|
|
127
|
-
document.DocPDFFilePath = this.DocPDFFilePath;
|
|
128
|
-
await document.save();
|
|
129
|
-
}
|
|
130
|
-
catch (err) {
|
|
131
|
-
console.log(err);
|
|
132
|
-
}
|
|
133
220
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
221
|
+
generateInvoice(userId) {
|
|
222
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
223
|
+
const media = new media_1.Medias(this.mediaRepository, this.mediaCommonService);
|
|
224
|
+
const htmlPayload = {
|
|
225
|
+
ObjectId: this.DocNo,
|
|
226
|
+
ObjectType: this.DocType,
|
|
227
|
+
Type: media_1.MediaType.Document,
|
|
228
|
+
FileName: `${this.DocType}-${this.DocNo}`,
|
|
229
|
+
FileStream: yield Document.DEFAULT_INVOICE_TEMPLATE_HTML(),
|
|
230
|
+
FileExtension: 'html',
|
|
231
|
+
Title: `${this.DocType}-${this.DocNo}.html`,
|
|
232
|
+
Description: `HTML ${this.DocType}`,
|
|
233
|
+
IsEncryptedYN: 'N',
|
|
234
|
+
};
|
|
235
|
+
const HTMLInvoiceMedia = yield media.postInternal(yield Document.DEFAULT_INVOICE_TEMPLATE_HTML(), htmlPayload, userId !== null && userId !== void 0 ? userId : 'System');
|
|
236
|
+
const pdfPayload = {
|
|
237
|
+
ObjectId: this.DocNo,
|
|
238
|
+
ObjectType: this.DocType,
|
|
239
|
+
Type: media_1.MediaType.Document,
|
|
240
|
+
FileName: `${this.DocType}-${this.DocNo}`,
|
|
241
|
+
FileStream: yield Document.DEFAULT_INVOICE_TEMPLATE_PDF(),
|
|
242
|
+
FileExtension: 'pdf',
|
|
243
|
+
Title: `${this.DocType}-${this.DocNo}.pdf`,
|
|
244
|
+
Description: `PDF ${this.DocType}`,
|
|
245
|
+
IsEncryptedYN: 'N',
|
|
246
|
+
};
|
|
247
|
+
const PDFInvoiceMedia = yield media.postInternal(yield Document.DEFAULT_INVOICE_TEMPLATE_PDF(), pdfPayload, userId !== null && userId !== void 0 ? userId : 'System');
|
|
248
|
+
try {
|
|
249
|
+
const document = yield this.documentRepository.findOne({
|
|
250
|
+
where: {
|
|
251
|
+
DocNo: this.DocNo,
|
|
252
|
+
},
|
|
253
|
+
});
|
|
254
|
+
document.DocHTMLFileMediaId = HTMLInvoiceMedia.MediaId;
|
|
255
|
+
document.DocPDFFileMediaId = PDFInvoiceMedia.MediaId;
|
|
256
|
+
yield document.save();
|
|
257
|
+
}
|
|
258
|
+
catch (err) {
|
|
259
|
+
console.log(err);
|
|
260
|
+
}
|
|
261
|
+
return {
|
|
262
|
+
HTMLMedia: HTMLInvoiceMedia,
|
|
263
|
+
PDFMedia: PDFInvoiceMedia,
|
|
264
|
+
};
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
newDocumentItem() {
|
|
268
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
269
|
+
const documentItem = new document_item_1.DocumentItem();
|
|
270
|
+
documentItem.DocNo = this.DocNo;
|
|
271
|
+
this.DocumentItems.push(documentItem);
|
|
272
|
+
return documentItem;
|
|
273
|
+
});
|
|
139
274
|
}
|
|
140
275
|
}
|
|
141
276
|
exports.Document = Document;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.js","sourceRoot":"","sources":["../../src/document/document.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"document.js","sourceRoot":"","sources":["../../src/document/document.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6BAA6B;AAC7B,yBAAyB;AACzB,yCAAkC;AAClC,4CAAsE;AACtE,wCAOsB;AACtB,kCAAkD;AAGlD,mDAA+C;AAE/C,0FAAqF;AACrF,+DAAsD;AAEtD,MAAa,QAAS,SAAQ,2CAAmB;IAoC/C,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,IAAY,OAAO,CAAC,OAAgB;QAClC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,IAAY,OAAO,CAAC,IA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,KAAK,EAAE,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,MAAM;gBAC1C,WAAW,EAAE,OAAO,IAAI,CAAC,OAAO,EAAE;gBAClC,aAAa,EAAE,GAAG;aACnB,CAAC;YAGF,MAAM,eAAe,GAAG,MAAM,KAAK,CAAC,YAAY,CAC9C,MAAM,QAAQ,CAAC,4BAA4B,EAAE,EAC7C,UAAU,EACV,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,QAAQ,CACnB,CAAC;YAEF,IAAI;gBACF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC;oBACrD,KAAK,EAAE;wBACL,KAAK,EAAE,IAAI,CAAC,KAAK;qBAClB;iBACF,CAAC,CAAC;gBAGH,QAAQ,CAAC,kBAAkB,GAAG,gBAAgB,CAAC,OAAO,CAAC;gBACvD,QAAQ,CAAC,iBAAiB,GAAG,eAAe,CAAC,OAAO,CAAC;gBACrD,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;aACvB;YAAC,OAAO,GAAG,EAAE;gBAEZ,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;aAClB;YAED,OAAO;gBACL,SAAS,EAAE,gBAAgB;gBAC3B,QAAQ,EAAE,eAAe;aAC1B,CAAC;QACJ,CAAC;KAAA;IAOK,eAAe;;YACnB,MAAM,YAAY,GAAG,IAAI,4BAAY,EAAE,CAAC;YACxC,YAAY,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;YAChC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACtC,OAAO,YAAY,CAAC;QACtB,CAAC;KAAA;CACF;AAhYD,4BAgYC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseRepository } from '@tomei/general';
|
|
2
|
-
import
|
|
2
|
+
import DocumentModel from '../models/document.entity';
|
|
3
3
|
import { IDocumentAttr } from './interfaces/document-attr.interface';
|
|
4
4
|
import { IDocumentRepository } from './interfaces/document.repository.interface';
|
|
5
5
|
export declare class DocumentRepository extends BaseRepository<DocumentModel> implements IDocumentRepository {
|
|
@@ -16,7 +16,7 @@ exports.DocumentRepository = void 0;
|
|
|
16
16
|
const common_1 = require("@nestjs/common");
|
|
17
17
|
const sequelize_1 = require("@nestjs/sequelize");
|
|
18
18
|
const general_1 = require("@tomei/general");
|
|
19
|
-
const document_entity_1 = require("
|
|
19
|
+
const document_entity_1 = require("../models/document.entity");
|
|
20
20
|
let DocumentRepository = class DocumentRepository extends general_1.BaseRepository {
|
|
21
21
|
constructor(documentModel) {
|
|
22
22
|
super(documentModel);
|
|
@@ -40,7 +40,7 @@ let DocumentRepository = class DocumentRepository extends general_1.BaseReposito
|
|
|
40
40
|
};
|
|
41
41
|
DocumentRepository = __decorate([
|
|
42
42
|
(0, common_1.Injectable)(),
|
|
43
|
-
__param(0, (0, sequelize_1.InjectModel)(document_entity_1.
|
|
43
|
+
__param(0, (0, sequelize_1.InjectModel)(document_entity_1.default)),
|
|
44
44
|
__metadata("design:paramtypes", [Object])
|
|
45
45
|
], DocumentRepository);
|
|
46
46
|
exports.DocumentRepository = DocumentRepository;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.repository.js","sourceRoot":"","sources":["../../src/document/document.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,iDAAgD;AAChD,4CAAgD;AAChD
|
|
1
|
+
{"version":3,"file":"document.repository.js","sourceRoot":"","sources":["../../src/document/document.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,iDAAgD;AAChD,4CAAgD;AAChD,+DAAsD;AAK/C,IAAM,kBAAkB,GAAxB,MAAM,kBACX,SAAQ,wBAA6B;IAGrC,YAEmB,aAAmC;QAEpD,KAAK,CAAC,aAAa,CAAC,CAAC;QAFJ,kBAAa,GAAb,aAAa,CAAsB;IAGtD,CAAC;IAED,MAAM,CAAC,IAAmB,EAAE,OAAa;QACvC,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,mBAAM,IAAI,GAAI,OAAO,CAAC,CAAC;IACzD,CAAC;IAED,OAAO,CAAC,OAAY;QAClB,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;IAED,qBAAqB,CACnB,OAAY;QAEZ,OAAO,IAAI,CAAC,aAAa,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACrD,CAAC;IAED,OAAO,CAAC,OAAY;QAClB,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;IAED,MAAM,CAAC,IAAmB,EAAE,OAAa;QACvC,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,mBAAM,IAAI,GAAI,OAAO,CAAC,CAAC;IACzD,CAAC;CACF,CAAA;AAhCY,kBAAkB;IAD9B,IAAA,mBAAU,GAAE;IAMR,WAAA,IAAA,uBAAW,EAAC,yBAAa,CAAC,CAAA;;GALlB,kBAAkB,CAgC9B;AAhCY,gDAAkB"}
|
|
@@ -3,7 +3,7 @@ export declare class IDocumentAttr {
|
|
|
3
3
|
DocNo: string;
|
|
4
4
|
DocType: DocType;
|
|
5
5
|
DocDate: Date;
|
|
6
|
-
|
|
6
|
+
CompanyId: string;
|
|
7
7
|
Currency: string;
|
|
8
8
|
Amount: number;
|
|
9
9
|
Description: string;
|
|
@@ -11,9 +11,15 @@ export declare class IDocumentAttr {
|
|
|
11
11
|
IssuedById: string;
|
|
12
12
|
IssuedToId: string;
|
|
13
13
|
IssuedToType: string;
|
|
14
|
-
|
|
14
|
+
CreatedById: string;
|
|
15
|
+
CreatedAt: Date;
|
|
16
|
+
UpdatedById?: string;
|
|
17
|
+
UpdatedAt?: Date;
|
|
18
|
+
DocPDFFileMediaId?: string;
|
|
19
|
+
DocHTMLFileMediaId?: string;
|
|
20
|
+
AccSystemRefId?: string;
|
|
15
21
|
PostedToAccSystemYN: string;
|
|
22
|
+
PostedById?: string;
|
|
23
|
+
PostedDateTime?: Date;
|
|
16
24
|
UseAccSystemDocYN: string;
|
|
17
|
-
DocPDFFilePath: string;
|
|
18
|
-
DocHTMLFilePath: string;
|
|
19
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-attr.interface.js","sourceRoot":"","sources":["../../../src/document/interfaces/document-attr.interface.ts"],"names":[],"mappings":";;;AAEA,MAAa,aAAa;
|
|
1
|
+
{"version":3,"file":"document-attr.interface.js","sourceRoot":"","sources":["../../../src/document/interfaces/document-attr.interface.ts"],"names":[],"mappings":";;;AAEA,MAAa,aAAa;CAuBzB;AAvBD,sCAuBC"}
|
|
@@ -7,6 +7,7 @@ var DocType;
|
|
|
7
7
|
DocType["DEBIT_NOTE"] = "Debit Note";
|
|
8
8
|
DocType["CREDIT_NOTE"] = "Credit Note";
|
|
9
9
|
DocType["QUOTATION"] = "Quotation";
|
|
10
|
+
DocType["PURCHASEORDER"] = "Purchase Order";
|
|
10
11
|
DocType["RECEIPT"] = "Receipt";
|
|
11
12
|
})(DocType = exports.DocType || (exports.DocType = {}));
|
|
12
13
|
//# sourceMappingURL=doc-type.enum.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doc-type.enum.js","sourceRoot":"","sources":["../../src/enum/doc-type.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,
|
|
1
|
+
{"version":3,"file":"doc-type.enum.js","sourceRoot":"","sources":["../../src/enum/doc-type.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,OAOX;AAPD,WAAY,OAAO;IACjB,8BAAmB,CAAA;IACnB,oCAAyB,CAAA;IACzB,sCAA2B,CAAA;IAC3B,kCAAuB,CAAA;IACvB,2CAAgC,CAAA;IAChC,8BAAmB,CAAA;AACrB,CAAC,EAPW,OAAO,GAAP,eAAO,KAAP,eAAO,QAOlB"}
|
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DocumentStatus = void 0;
|
|
4
4
|
var DocumentStatus;
|
|
5
5
|
(function (DocumentStatus) {
|
|
6
|
-
DocumentStatus["
|
|
7
|
-
DocumentStatus["
|
|
6
|
+
DocumentStatus["UNPAID"] = "Unpaid";
|
|
7
|
+
DocumentStatus["PAID"] = "Paid";
|
|
8
|
+
DocumentStatus["CANCELLED"] = "Cancelled";
|
|
8
9
|
})(DocumentStatus = exports.DocumentStatus || (exports.DocumentStatus = {}));
|
|
9
10
|
//# sourceMappingURL=document-status.enum.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-status.enum.js","sourceRoot":"","sources":["../../src/enum/document-status.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,
|
|
1
|
+
{"version":3,"file":"document-status.enum.js","sourceRoot":"","sources":["../../src/enum/document-status.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,cAIX;AAJD,WAAY,cAAc;IACxB,mCAAiB,CAAA;IACjB,+BAAa,CAAA;IACb,yCAAuB,CAAA;AACzB,CAAC,EAJW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAIzB"}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
import { IBaseRepository, LoginUserBase } from '@tomei/general';
|
|
1
|
+
import { IBaseRepository, LoginUserBase, ObjectBase } from '@tomei/general';
|
|
2
2
|
import { IAccountSystem } from '../interfaces';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { Account } from '../account';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
3
|
+
import { FinanceCustomerRepository } from '../customer/finance-customer.repository';
|
|
4
|
+
import { JournalEntryRepository } from '../journal-entry/journal-entry.repository';
|
|
5
|
+
import { Account } from '../account/account';
|
|
6
|
+
import { LedgerTransactionRepository } from '../ledger-transaction/ledger-transaction.repository';
|
|
7
|
+
import { FinanceCustomerBase } from '../customer/customer';
|
|
8
|
+
import { JournalEntry } from '../journal-entry/journal-entry';
|
|
9
|
+
export default class FinanceCompany extends ObjectBase {
|
|
10
|
+
private _CompanyId;
|
|
9
11
|
private _CompSystemCode;
|
|
10
12
|
private _CompSystemRefId;
|
|
11
13
|
private _AccSystemCode;
|
|
14
|
+
private _AccSystemRefId;
|
|
12
15
|
protected BaseRepository: IBaseRepository;
|
|
13
16
|
private static _htFinanceCompanyIds;
|
|
14
17
|
private static _htFinanceCompanies;
|
|
@@ -23,14 +26,17 @@ export declare class FinanceCompany extends AccountSystemEntity {
|
|
|
23
26
|
set CompSystemRefId(id: string);
|
|
24
27
|
get AccSystemCode(): string;
|
|
25
28
|
private set AccSystemCode(value);
|
|
29
|
+
get AccSystemRefId(): string;
|
|
30
|
+
get CompanyId(): string;
|
|
26
31
|
get ObjectId(): string;
|
|
32
|
+
private set ObjectId(value);
|
|
27
33
|
get ObjectName(): string;
|
|
28
34
|
get TableName(): string;
|
|
29
35
|
private constructor();
|
|
30
36
|
static getFinanceCompanyId(compSystemCode: string, compSystemRefId: string, accSystemCode: string): Promise<string>;
|
|
31
37
|
static getFinanceCompany(companyId: string): Promise<FinanceCompany>;
|
|
32
38
|
static createFinanceCompany(dbTransaction: any, loginUser: LoginUserBase, compSystemCode: string, compSystemRefId: string, accSystemCode: string): Promise<void>;
|
|
33
|
-
createCustomer(dbTransaction: any, custSystemCode: string, custSystemRefId: string, customer:
|
|
39
|
+
createCustomer(dbTransaction: any, custSystemCode: string, custSystemRefId: string, customer: FinanceCustomerBase): Promise<FinanceCustomerBase>;
|
|
34
40
|
postJournal(dbTransaction: any, journalEntry: JournalEntry): Promise<void>;
|
|
35
41
|
createAccount(dbTransaction: any, account: Account): Promise<Account>;
|
|
36
42
|
}
|