@tomei/finance 0.3.1 → 0.3.2
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/account/account.d.ts +3 -5
- package/dist/account/account.js +65 -33
- package/dist/account/account.js.map +1 -1
- package/dist/document/document-item.d.ts +1 -0
- package/dist/document/document-item.js +1 -0
- package/dist/document/document-item.js.map +1 -1
- package/dist/document/document-item.repository.d.ts +3 -15
- package/dist/document/document-item.repository.js +4 -43
- package/dist/document/document-item.repository.js.map +1 -1
- package/dist/document/document.d.ts +9 -10
- package/dist/document/document.js +73 -54
- package/dist/document/document.js.map +1 -1
- package/dist/enum/transaction-type.enum.d.ts +2 -2
- package/dist/enum/transaction-type.enum.js +2 -2
- package/dist/enum/transaction-type.enum.js.map +1 -1
- package/dist/finance-company/finance-company.d.ts +13 -5
- package/dist/finance-company/finance-company.js +463 -15
- package/dist/finance-company/finance-company.js.map +1 -1
- package/dist/journal-entry/journal-entry.d.ts +8 -10
- package/dist/journal-entry/journal-entry.js +75 -26
- package/dist/journal-entry/journal-entry.js.map +1 -1
- package/dist/ledger-transaction/interfaces/ledger-transaction-attr.interface.d.ts +0 -4
- package/dist/ledger-transaction/ledger-transaction.d.ts +5 -4
- package/dist/ledger-transaction/ledger-transaction.js +5 -7
- package/dist/ledger-transaction/ledger-transaction.js.map +1 -1
- package/dist/ledger-transaction/ledger-transaction.repository.d.ts +3 -8
- package/dist/ledger-transaction/ledger-transaction.repository.js +5 -32
- package/dist/ledger-transaction/ledger-transaction.repository.js.map +1 -1
- package/dist/payment/payment.d.ts +6 -8
- package/dist/payment/payment.js +67 -57
- package/dist/payment/payment.js.map +1 -1
- package/dist/payment-item/payment-item.d.ts +0 -3
- package/dist/payment-item/payment-item.js +1 -1
- package/dist/payment-item/payment-item.js.map +1 -1
- package/dist/payment-method/payment-method.d.ts +11 -4
- package/dist/payment-method/payment-method.js +71 -3
- package/dist/payment-method/payment-method.js.map +1 -1
- package/dist/payment-method/payment-method.repository.d.ts +1 -1
- package/dist/payment-method/payment-method.repository.js +1 -1
- package/dist/payment-method/payment-method.repository.js.map +1 -1
- package/dist/payment-method-type/payment-method-type.d.ts +5 -4
- package/dist/payment-method-type/payment-method-type.js +43 -3
- package/dist/payment-method-type/payment-method-type.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/migrations/finance-payment-method-migration.js +1 -1
- package/package.json +1 -1
- package/src/account/account.ts +80 -42
- package/src/document/document-item.repository.ts +4 -42
- package/src/document/document-item.ts +4 -0
- package/src/document/document.ts +101 -59
- package/src/enum/transaction-type.enum.ts +2 -2
- package/src/finance-company/finance-company.ts +680 -31
- package/src/journal-entry/journal-entry.ts +150 -47
- package/src/ledger-transaction/interfaces/ledger-transaction-attr.interface.ts +0 -5
- package/src/ledger-transaction/ledger-transaction.repository.ts +5 -24
- package/src/ledger-transaction/ledger-transaction.ts +7 -11
- package/src/payment/payment.ts +90 -59
- package/src/payment-item/payment-item.ts +1 -5
- package/src/payment-method/payment-method.repository.ts +1 -1
- package/src/payment-method/payment-method.ts +83 -8
- package/src/payment-method-type/payment-method-type.ts +46 -12
|
@@ -17,9 +17,7 @@ export default class Account extends AccountSystemEntity {
|
|
|
17
17
|
UpdatedAt: Date;
|
|
18
18
|
UpdatedById: string;
|
|
19
19
|
private static _RepositoryBase;
|
|
20
|
-
|
|
21
|
-
_ObjectId: string;
|
|
22
|
-
_ObjectName: string;
|
|
20
|
+
private _DbTransaction;
|
|
23
21
|
private _IsNewRecord;
|
|
24
22
|
private get IsNewRecord();
|
|
25
23
|
private set IsNewRecord(value);
|
|
@@ -27,8 +25,8 @@ export default class Account extends AccountSystemEntity {
|
|
|
27
25
|
get ObjectId(): string;
|
|
28
26
|
get ObjectName(): string;
|
|
29
27
|
get TableName(): string;
|
|
30
|
-
constructor(dbTransaction
|
|
31
|
-
|
|
28
|
+
constructor(dbTransaction?: any, accountNo?: string);
|
|
29
|
+
static Account(): Promise<void>;
|
|
32
30
|
validateAccountValue(): void;
|
|
33
31
|
isParentAccountExists(): boolean;
|
|
34
32
|
save(AccSystemRefId: string, userId: string, dbTransaction?: any): Promise<AccountModel>;
|
package/dist/account/account.js
CHANGED
|
@@ -12,6 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
const general_1 = require("@tomei/general");
|
|
13
13
|
const account_system_entity_1 = require("../account-system-entity/account-system-entity");
|
|
14
14
|
const account_repository_1 = require("./account.repository");
|
|
15
|
+
const { getConfig } = require('../config');
|
|
15
16
|
class Account extends account_system_entity_1.AccountSystemEntity {
|
|
16
17
|
get IsNewRecord() {
|
|
17
18
|
return this._IsNewRecord;
|
|
@@ -34,41 +35,72 @@ class Account extends account_system_entity_1.AccountSystemEntity {
|
|
|
34
35
|
constructor(dbTransaction, accountNo) {
|
|
35
36
|
super();
|
|
36
37
|
this._IsNewRecord = true;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
38
|
+
if (dbTransaction) {
|
|
39
|
+
this._DbTransaction = dbTransaction;
|
|
40
|
+
}
|
|
41
|
+
if (accountNo) {
|
|
42
|
+
this.RepositoryBase.findOne({
|
|
43
|
+
where: {
|
|
44
|
+
AccountNo: accountNo,
|
|
45
|
+
},
|
|
46
|
+
transaction: dbTransaction,
|
|
47
|
+
})
|
|
48
|
+
.then((accountData) => {
|
|
49
|
+
if (accountData) {
|
|
50
|
+
this.IsNewRecord = false;
|
|
51
|
+
this.CompanyId = accountData.CompanyId;
|
|
52
|
+
this.ParentAccountNo = accountData.ParentAccountNo;
|
|
53
|
+
this.Name = accountData.Name;
|
|
54
|
+
this.Description = accountData.Description;
|
|
55
|
+
this.AccountType = accountData.AccountType;
|
|
56
|
+
this.AccountSubtype = accountData.AccountSubType;
|
|
57
|
+
this.OwnerId = accountData.OwnerId;
|
|
58
|
+
this.OwnerType = accountData.OwnerType;
|
|
59
|
+
this.RelatedObjectId = accountData.RelatedObjectId;
|
|
60
|
+
this.RelatedObjectType = accountData.RelatedObjectType;
|
|
61
|
+
this.CreatedById = accountData.CreatedById;
|
|
62
|
+
this.CreatedAt = accountData.CreatedAt;
|
|
63
|
+
this.UpdatedById = accountData.UpdatedById;
|
|
64
|
+
this.UpdatedAt = accountData.UpdatedAt;
|
|
65
|
+
this.AccSystemRefId = accountData.AccSystemRefId;
|
|
66
|
+
this.PostedToAccSystemYN = accountData.PostedToAccSystemYN;
|
|
67
|
+
this.PostedById = accountData.PostedById;
|
|
68
|
+
this.PostedDateTime = accountData.PostedDateTime;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
const notFoundError = new general_1.RecordNotFoundError('No Record Found.');
|
|
72
|
+
throw notFoundError;
|
|
73
|
+
}
|
|
74
|
+
})
|
|
75
|
+
.catch((err) => {
|
|
76
|
+
console.log('Account Class constructor err: ', err);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
static Account() {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
const dbTransaction = null;
|
|
83
|
+
let DefaultAccountReceivable = null;
|
|
84
|
+
let DefaultAccountPayable = null;
|
|
85
|
+
try {
|
|
86
|
+
DefaultAccountReceivable = new Account(dbTransaction, 'EZC-AR');
|
|
87
|
+
}
|
|
88
|
+
catch (err) {
|
|
89
|
+
DefaultAccountReceivable = new Account(dbTransaction);
|
|
90
|
+
DefaultAccountReceivable.AccountNo = null;
|
|
91
|
+
DefaultAccountReceivable.AccountType = 'Account Receivable';
|
|
92
|
+
DefaultAccountReceivable.OwnerId = 'System';
|
|
93
|
+
DefaultAccountReceivable.OwnerType = '';
|
|
94
|
+
}
|
|
95
|
+
try {
|
|
96
|
+
DefaultAccountPayable = new Account(dbTransaction, 'EZC-AP');
|
|
64
97
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
98
|
+
catch (err) {
|
|
99
|
+
DefaultAccountPayable = new Account(dbTransaction);
|
|
100
|
+
DefaultAccountPayable.AccountNo = null;
|
|
101
|
+
DefaultAccountPayable.AccountType = 'Account Payable';
|
|
102
|
+
DefaultAccountPayable.OwnerId = 'System';
|
|
68
103
|
}
|
|
69
|
-
})
|
|
70
|
-
.catch((err) => {
|
|
71
|
-
console.log('Account Class constructor err: ', err);
|
|
72
104
|
});
|
|
73
105
|
}
|
|
74
106
|
validateAccountValue() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/account/account.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,4CAAqD;AACrD,0FAAqF;AAErF,6DAAyD;
|
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../src/account/account.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,4CAAqD;AACrD,0FAAqF;AAErF,6DAAyD;AAGzD,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAE3C,MAAqB,OAAQ,SAAQ,2CAAmB;IAqBtD,IAAY,WAAW;QACrB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,IAAY,WAAW,CAAC,MAAe;QACrC,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC;IAC7B,CAAC;IAGD,IAAI,cAAc;QAChB,OAAO,OAAO,CAAC,eAAe,CAAC;IACjC,CAAC;IAGD,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CA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1
|
-
{"version":3,"file":"document-item.js","sourceRoot":"","sources":["../../src/document/document-item.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"document-item.js","sourceRoot":"","sources":["../../src/document/document-item.ts"],"names":[],"mappings":";;AAEA,MAAqB,YAAY;IAsB/B,YAAY,aAAmB,EAAE,cAAuB,IAAG,CAAC;CAC7D;AAvBD,+BAuBC"}
|
|
@@ -1,17 +1,5 @@
|
|
|
1
|
-
import { RepositoryBase } from '@tomei/general';
|
|
1
|
+
import { RepositoryBase, IRepositoryBase } from '@tomei/general';
|
|
2
2
|
import DocumentItemModel from '../models/document-item.entity';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export declare class DocumentItemRepository extends RepositoryBase<DocumentItemModel> implements IDocumentItemRepository {
|
|
6
|
-
private readonly documentItemModel;
|
|
7
|
-
constructor(documentItemModel: typeof DocumentItemModel);
|
|
8
|
-
create(data: IDocumentItemAttr, options?: any): Promise<DocumentItemModel> | any;
|
|
9
|
-
bulkCreate(data: IDocumentItemAttr[], options?: any): any;
|
|
10
|
-
findAll(options: any): Promise<DocumentItemModel[]>;
|
|
11
|
-
findAllWithPagination(options: any): Promise<{
|
|
12
|
-
count: number;
|
|
13
|
-
rows: DocumentItemModel[];
|
|
14
|
-
}>;
|
|
15
|
-
findOne(options: any): Promise<DocumentItemModel>;
|
|
16
|
-
update(data: IDocumentItemAttr, options?: any): any;
|
|
3
|
+
export declare class DocumentItemRepository extends RepositoryBase<DocumentItemModel> implements IRepositoryBase<DocumentItemModel> {
|
|
4
|
+
constructor();
|
|
17
5
|
}
|
|
@@ -1,51 +1,12 @@
|
|
|
1
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
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
3
|
exports.DocumentItemRepository = void 0;
|
|
16
|
-
const common_1 = require("@nestjs/common");
|
|
17
|
-
const sequelize_1 = require("@nestjs/sequelize");
|
|
18
4
|
const general_1 = require("@tomei/general");
|
|
19
5
|
const document_item_entity_1 = require("../models/document-item.entity");
|
|
20
|
-
|
|
21
|
-
constructor(
|
|
22
|
-
super(
|
|
23
|
-
this.documentItemModel = documentItemModel;
|
|
6
|
+
class DocumentItemRepository extends general_1.RepositoryBase {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(document_item_entity_1.default);
|
|
24
9
|
}
|
|
25
|
-
|
|
26
|
-
return this.documentItemModel.create(Object.assign({}, data), options);
|
|
27
|
-
}
|
|
28
|
-
bulkCreate(data, options) {
|
|
29
|
-
const payload = [...data];
|
|
30
|
-
return this.documentItemModel.bulkCreate(payload, options);
|
|
31
|
-
}
|
|
32
|
-
findAll(options) {
|
|
33
|
-
return this.documentItemModel.findAll(options);
|
|
34
|
-
}
|
|
35
|
-
findAllWithPagination(options) {
|
|
36
|
-
return this.documentItemModel.findAndCountAll(options);
|
|
37
|
-
}
|
|
38
|
-
findOne(options) {
|
|
39
|
-
return this.documentItemModel.findOne(options);
|
|
40
|
-
}
|
|
41
|
-
update(data, options) {
|
|
42
|
-
return this.documentItemModel.update(Object.assign({}, data), options);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
DocumentItemRepository = __decorate([
|
|
46
|
-
(0, common_1.Injectable)(),
|
|
47
|
-
__param(0, (0, sequelize_1.InjectModel)(document_item_entity_1.default)),
|
|
48
|
-
__metadata("design:paramtypes", [Object])
|
|
49
|
-
], DocumentItemRepository);
|
|
10
|
+
}
|
|
50
11
|
exports.DocumentItemRepository = DocumentItemRepository;
|
|
51
12
|
//# sourceMappingURL=document-item.repository.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-item.repository.js","sourceRoot":"","sources":["../../src/document/document-item.repository.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"document-item.repository.js","sourceRoot":"","sources":["../../src/document/document-item.repository.ts"],"names":[],"mappings":";;;AAAA,4CAAiE;AACjE,yEAA+D;AAE/D,MAAa,sBACX,SAAQ,wBAAiC;IAGzC;QACE,KAAK,CAAC,8BAAiB,CAAC,CAAC;IAC3B,CAAC;CACF;AAPD,wDAOC"}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import { IMediasRepository, CommonService as MediaCommonService, MediasModel } from '@tomei/media';
|
|
3
3
|
import { DocumentStatus, DocType } from '../enum';
|
|
4
4
|
import { IDocumentAttr } from './interfaces/document-attr.interface';
|
|
5
|
-
import { DocumentItemRepository } from './document-item.repository';
|
|
6
5
|
import DocumentItem from './document-item';
|
|
7
6
|
import { AccountSystemEntity } from '../account-system-entity/account-system-entity';
|
|
8
7
|
import { DocumentRepository } from './document.repository';
|
|
8
|
+
import FinanceCustomerBase from '../customer/customer';
|
|
9
9
|
export default class Document extends AccountSystemEntity {
|
|
10
10
|
DocNo: string;
|
|
11
11
|
private _DocType;
|
|
@@ -25,18 +25,16 @@ export default class Document extends AccountSystemEntity {
|
|
|
25
25
|
private _DocHTMLFileMediaId;
|
|
26
26
|
private _DocPDFFileMediaId;
|
|
27
27
|
private static _RepositoryBase;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
_ObjectName: string;
|
|
28
|
+
private static _DocumentItemRepository;
|
|
29
|
+
private _DbTransaction;
|
|
31
30
|
private _IsNewRecord;
|
|
32
31
|
private _DocumentItems;
|
|
33
|
-
documentItemRepository: DocumentItemRepository;
|
|
34
32
|
mediaRepository: IMediasRepository;
|
|
35
33
|
mediaCommonService: MediaCommonService;
|
|
36
34
|
private get IsNewRecord();
|
|
37
35
|
private set IsNewRecord(value);
|
|
38
36
|
get DocType(): DocType;
|
|
39
|
-
|
|
37
|
+
set DocType(docType: DocType);
|
|
40
38
|
get DocDate(): Date;
|
|
41
39
|
private set DocDate(value);
|
|
42
40
|
get DocHTMLFileMediaId(): string;
|
|
@@ -49,16 +47,17 @@ export default class Document extends AccountSystemEntity {
|
|
|
49
47
|
get ObjectId(): string;
|
|
50
48
|
get ObjectName(): string;
|
|
51
49
|
get TableName(): string;
|
|
52
|
-
constructor(dbTransaction
|
|
53
|
-
get DocumentItems():
|
|
50
|
+
constructor(dbTransaction?: any, docNo?: string);
|
|
51
|
+
get DocumentItems(): Promise<DocumentItem[]>;
|
|
54
52
|
static DEFAULT_INVOICE_TEMPLATE_HTML(): Promise<Express.Multer.File>;
|
|
55
53
|
static DEFAULT_INVOICE_TEMPLATE_PDF(): Promise<Express.Multer.File>;
|
|
56
54
|
get DocumentFileInHTML(): Promise<MediasModel>;
|
|
57
55
|
get DocumentFileInPDF(): Promise<MediasModel>;
|
|
58
56
|
init(params: IDocumentAttr): void;
|
|
59
|
-
generateInvoice(userId?: string): Promise<{
|
|
57
|
+
generateInvoice(userId?: string, customer?: FinanceCustomerBase): Promise<{
|
|
60
58
|
HTMLMedia: MediasModel;
|
|
61
59
|
PDFMedia: MediasModel;
|
|
62
60
|
}>;
|
|
63
|
-
|
|
61
|
+
generateCreditNote(userId?: string, customer?: FinanceCustomerBase): Promise<void>;
|
|
62
|
+
get NewDocumentItem(): DocumentItem;
|
|
64
63
|
}
|
|
@@ -15,6 +15,7 @@ const puppeteer_1 = require("puppeteer");
|
|
|
15
15
|
const general_1 = require("@tomei/general");
|
|
16
16
|
const media_1 = require("@tomei/media");
|
|
17
17
|
const enum_1 = require("../enum");
|
|
18
|
+
const document_item_repository_1 = require("./document-item.repository");
|
|
18
19
|
const document_item_1 = require("./document-item");
|
|
19
20
|
const account_system_entity_1 = require("../account-system-entity/account-system-entity");
|
|
20
21
|
const document_repository_1 = require("./document.repository");
|
|
@@ -73,62 +74,77 @@ class Document extends account_system_entity_1.AccountSystemEntity {
|
|
|
73
74
|
this._Status = enum_1.DocumentStatus.UNPAID;
|
|
74
75
|
this._IsNewRecord = true;
|
|
75
76
|
this._DocumentItems = null;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
77
|
+
if (dbTransaction) {
|
|
78
|
+
this._DbTransaction = dbTransaction;
|
|
79
|
+
}
|
|
80
|
+
if (docNo) {
|
|
81
|
+
this.RepositoryBase.findOne({
|
|
82
|
+
where: {
|
|
83
|
+
DocNo: docNo,
|
|
84
|
+
},
|
|
85
|
+
transaction: dbTransaction,
|
|
86
|
+
})
|
|
87
|
+
.then((documentData) => {
|
|
88
|
+
if (documentData) {
|
|
89
|
+
this.IsNewRecord = false;
|
|
90
|
+
this.DocType = documentData.DocType;
|
|
91
|
+
this.DocDate = documentData.DocDate;
|
|
92
|
+
this.CompanyId = documentData.CompanyId;
|
|
93
|
+
this.Currency = documentData.Currency;
|
|
94
|
+
this.Amount = documentData.Amount;
|
|
95
|
+
this.Description = documentData.Description;
|
|
96
|
+
this.Status = documentData.Status;
|
|
97
|
+
this.IssuedById = documentData.IssuedById;
|
|
98
|
+
this.IssuedToId = documentData.IssuedToId;
|
|
99
|
+
this.IssuedToType = documentData.IssuedToType;
|
|
100
|
+
this.CreatedById = documentData.CreatedById;
|
|
101
|
+
this.CreatedAt = documentData.CreatedAt;
|
|
102
|
+
this.UpdatedById = documentData.UpdatedById;
|
|
103
|
+
this.UpdatedAt = documentData.UpdatedAt;
|
|
104
|
+
this.DocPDFFileMediaId = documentData.DocPDFFileMediaId;
|
|
105
|
+
this.DocHTMLFileMediaId = documentData.DocHTMLFileMediaId;
|
|
106
|
+
this.AccSystemRefId = documentData.AccSystemRefId;
|
|
107
|
+
this.PostedToAccSystemYN = documentData.PostedToAccSystemYN;
|
|
108
|
+
this.PostedById = documentData.PostedById;
|
|
109
|
+
this.PostedDateTime = documentData.PostedDateTime;
|
|
110
|
+
this.UseAccSystemDocYN = documentData.UseAccSystemDocYN;
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
const notFoundError = new general_1.RecordNotFoundError('No Record Found.');
|
|
114
|
+
throw notFoundError;
|
|
115
|
+
}
|
|
116
|
+
})
|
|
117
|
+
.catch((err) => {
|
|
118
|
+
console.log('Document Class constructor err: ', err);
|
|
119
|
+
});
|
|
120
|
+
}
|
|
115
121
|
}
|
|
116
122
|
get DocumentItems() {
|
|
117
|
-
|
|
118
|
-
this._DocumentItems = new Array();
|
|
123
|
+
return new Promise((resolve, reject) => {
|
|
119
124
|
if (!this.IsNewRecord) {
|
|
120
|
-
|
|
125
|
+
Document._DocumentItemRepository
|
|
121
126
|
.findAll({
|
|
122
127
|
where: {
|
|
123
128
|
DocNo: this.DocNo,
|
|
124
129
|
},
|
|
130
|
+
transaction: this._DbTransaction,
|
|
125
131
|
})
|
|
126
|
-
.then((
|
|
127
|
-
|
|
132
|
+
.then((documentItems) => {
|
|
133
|
+
const documentItemObjects = documentItems.map((documentItem) => {
|
|
134
|
+
new document_item_1.default(this._DbTransaction, documentItem.DocumentItemId);
|
|
135
|
+
});
|
|
136
|
+
return Promise.all(documentItemObjects);
|
|
137
|
+
})
|
|
138
|
+
.then((documentItemObjects) => {
|
|
139
|
+
this._DocumentItems = documentItemObjects;
|
|
140
|
+
resolve(this._DocumentItems);
|
|
141
|
+
})
|
|
142
|
+
.catch((err) => {
|
|
143
|
+
reject(err);
|
|
128
144
|
});
|
|
129
145
|
}
|
|
130
|
-
|
|
131
|
-
|
|
146
|
+
resolve(this._DocumentItems);
|
|
147
|
+
});
|
|
132
148
|
}
|
|
133
149
|
static DEFAULT_INVOICE_TEMPLATE_HTML() {
|
|
134
150
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -229,9 +245,10 @@ class Document extends account_system_entity_1.AccountSystemEntity {
|
|
|
229
245
|
this.PostedDateTime = params.PostedDateTime;
|
|
230
246
|
this.UseAccSystemDocYN = params.UseAccSystemDocYN;
|
|
231
247
|
}
|
|
232
|
-
generateInvoice(userId) {
|
|
248
|
+
generateInvoice(userId, customer) {
|
|
233
249
|
return __awaiter(this, void 0, void 0, function* () {
|
|
234
250
|
const media = new media_1.Medias(this.mediaRepository, this.mediaCommonService);
|
|
251
|
+
console.log(customer || 'no customer provided', '<< customer');
|
|
235
252
|
const htmlPayload = {
|
|
236
253
|
ObjectId: this.DocNo,
|
|
237
254
|
ObjectType: this.DocType,
|
|
@@ -275,15 +292,17 @@ class Document extends account_system_entity_1.AccountSystemEntity {
|
|
|
275
292
|
};
|
|
276
293
|
});
|
|
277
294
|
}
|
|
278
|
-
|
|
279
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
295
|
+
generateCreditNote(userId, customer) {
|
|
296
|
+
return __awaiter(this, void 0, void 0, function* () { });
|
|
297
|
+
}
|
|
298
|
+
get NewDocumentItem() {
|
|
299
|
+
const documentItem = new document_item_1.default();
|
|
300
|
+
documentItem.DocNo = this.DocNo;
|
|
301
|
+
this._DocumentItems.push(documentItem);
|
|
302
|
+
return documentItem;
|
|
285
303
|
}
|
|
286
304
|
}
|
|
287
305
|
exports.default = Document;
|
|
288
306
|
Document._RepositoryBase = new document_repository_1.DocumentRepository();
|
|
307
|
+
Document._DocumentItemRepository = new document_item_repository_1.DocumentItemRepository();
|
|
289
308
|
//# sourceMappingURL=document.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.js","sourceRoot":"","sources":["../../src/document/document.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,6BAA6B;AAC7B,yBAAyB;AACzB,yCAAkC;AAClC,4CAAqD;AACrD,wCAOsB;AACtB,kCAAkD;
|
|
1
|
+
{"version":3,"file":"document.js","sourceRoot":"","sources":["../../src/document/document.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,6BAA6B;AAC7B,yBAAyB;AACzB,yCAAkC;AAClC,4CAAqD;AACrD,wCAOsB;AACtB,kCAAkD;AAElD,yEAAoE;AACpE,mDAA2C;AAC3C,0FAAqF;AACrF,+DAA2D;AAI3D,MAAqB,QAAS,SAAQ,2CAAmB;IA8BvD,IAAY,WAAW;QACrB,OAAO,IAAI,CAAC,YAAY,CAAC;IAC3B,CAAC;IAED,IAAY,WAAW,CAAC,MAAe;QACrC,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC;IAC7B,CAAC;IAED,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,IAAW,OAAO,CAAC,OAAgB;QACjC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,IAAY,OAAO,CAAC,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;YAEF,IAAI;gBACF,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;oBACjD,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;IAEK,kBAAkB,CAAC,MAAe,EAAE,QAA8B;8DAAG,CAAC;KAAA;IAO5E,IAAI,eAAe;QACjB,MAAM,YAAY,GAAG,IAAI,uBAAY,EAAE,CAAC;QACxC,YAAY,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAChC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACvC,OAAO,YAAY,CAAC;IACtB,CAAC;;AAnbH,2BAobC;AAhagB,wBAAe,GAAG,IAAI,wCAAkB,EAAE,CAAC;AAC3C,gCAAuB,GAAG,IAAI,iDAAsB,EAAE,CAAC"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.TransactionTypeOptions = void 0;
|
|
4
4
|
var TransactionTypeOptions;
|
|
5
5
|
(function (TransactionTypeOptions) {
|
|
6
|
-
TransactionTypeOptions[
|
|
7
|
-
TransactionTypeOptions[
|
|
6
|
+
TransactionTypeOptions["DEBIT"] = "Debit";
|
|
7
|
+
TransactionTypeOptions["CREDIT"] = "Credit";
|
|
8
8
|
})(TransactionTypeOptions = exports.TransactionTypeOptions || (exports.TransactionTypeOptions = {}));
|
|
9
9
|
//# sourceMappingURL=transaction-type.enum.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-type.enum.js","sourceRoot":"","sources":["../../src/enum/transaction-type.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,sBAGX;AAHD,WAAY,sBAAsB;IAChC,
|
|
1
|
+
{"version":3,"file":"transaction-type.enum.js","sourceRoot":"","sources":["../../src/enum/transaction-type.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,sBAGX;AAHD,WAAY,sBAAsB;IAChC,yCAAe,CAAA;IACf,2CAAiB,CAAA;AACnB,CAAC,EAHW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAGjC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { LoginUserBase, ObjectBase } from '@tomei/general';
|
|
2
|
-
import { IAccountSystem } from '../interfaces';
|
|
3
|
-
import { FinanceCustomerRepository } from '../customer/finance-customer.repository';
|
|
4
|
-
import { JournalEntryRepository } from '../journal-entry/journal-entry.repository';
|
|
5
2
|
import Account from '../account/account';
|
|
6
3
|
import JournalEntry from '../journal-entry/journal-entry';
|
|
7
|
-
import { LedgerTransactionRepository } from '../ledger-transaction/ledger-transaction.repository';
|
|
8
4
|
import FinanceCustomerBase from '../customer/customer';
|
|
5
|
+
import Document from '../document/document';
|
|
6
|
+
import { IAccountSystem } from '../interfaces';
|
|
7
|
+
import { FinanceCustomerRepository } from '../customer/finance-customer.repository';
|
|
8
|
+
import { LedgerTransactionRepository } from '../ledger-transaction/ledger-transaction.repository';
|
|
9
|
+
import Payment from '../payment/payment';
|
|
9
10
|
export default class FinanceCompany extends ObjectBase {
|
|
10
11
|
private _CompanyId;
|
|
11
12
|
private _CompSystemCode;
|
|
@@ -14,7 +15,10 @@ export default class FinanceCompany extends ObjectBase {
|
|
|
14
15
|
private static _htFinanceCompanyIds;
|
|
15
16
|
private static _htFinanceCompanies;
|
|
16
17
|
private static _financeCompanyRepository;
|
|
17
|
-
|
|
18
|
+
private static _PaymentRepository;
|
|
19
|
+
private static _PaymentItemRepository;
|
|
20
|
+
private static _DocumentRepository;
|
|
21
|
+
private static _DocumentItemRepository;
|
|
18
22
|
financeCustomerRepository: FinanceCustomerRepository;
|
|
19
23
|
ledgerTransactionRepository: LedgerTransactionRepository;
|
|
20
24
|
AccountingSystem: IAccountSystem;
|
|
@@ -36,4 +40,8 @@ export default class FinanceCompany extends ObjectBase {
|
|
|
36
40
|
createCustomer(dbTransaction: any, custSystemCode: string, custSystemRefId: string, customer: FinanceCustomerBase): Promise<FinanceCustomerBase>;
|
|
37
41
|
postJournal(dbTransaction: any, journalEntry: JournalEntry): Promise<void>;
|
|
38
42
|
createAccount(dbTransaction: any, account: Account): Promise<Account>;
|
|
43
|
+
issueInvoice(dbTransaction: any, loginUser: LoginUserBase, invoice: Document, customer: FinanceCustomerBase, dtAccountNo?: string): Promise<Document>;
|
|
44
|
+
issueDebitNote(dbTransaction: any, loginUser: LoginUserBase, invoice: Document, customer: FinanceCustomerBase, dtAccountNo?: string): Promise<Document>;
|
|
45
|
+
issueCreditNote(dbTransaction: any, loginUser: LoginUserBase, creditNote: Document, customer: FinanceCustomerBase, ctAccountNo?: string): Promise<Document>;
|
|
46
|
+
collectPayment(dbTransaction: any, loginUser: LoginUserBase, payment: Payment, customer: FinanceCustomerBase, ctAccountNo?: string): Promise<Payment>;
|
|
39
47
|
}
|