@tomei/finance 0.6.112 → 0.8.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/dist/account/account.d.ts +2 -2
- package/dist/account/account.d.ts.map +1 -0
- package/dist/account/account.js +1 -1
- package/dist/account/account.js.map +1 -1
- package/dist/account/account.repository.d.ts +1 -0
- package/dist/account/account.repository.d.ts.map +1 -0
- package/dist/account/account.repository.js +4 -1
- package/dist/account/account.repository.js.map +1 -1
- package/dist/account/interfaces/account-attr.interface.d.ts +1 -0
- package/dist/account/interfaces/account-attr.interface.d.ts.map +1 -0
- package/dist/account-system-entity/account-system-entity.d.ts +1 -0
- package/dist/account-system-entity/account-system-entity.d.ts.map +1 -0
- package/dist/account-system-entity/account-system-entity.js +4 -1
- package/dist/account-system-entity/account-system-entity.js.map +1 -1
- package/dist/account-system-entity/post-history.repository.d.ts +1 -0
- package/dist/account-system-entity/post-history.repository.d.ts.map +1 -0
- package/dist/account-system-entity/post-history.repository.js +4 -1
- package/dist/account-system-entity/post-history.repository.js.map +1 -1
- package/dist/config.d.ts +1 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +17 -4
- package/dist/config.js.map +1 -1
- package/dist/customer/customer.d.ts +1 -0
- package/dist/customer/customer.d.ts.map +1 -0
- package/dist/customer/customer.js +38 -2
- package/dist/customer/customer.js.map +1 -1
- package/dist/customer/finance-customer.repository.d.ts +1 -0
- package/dist/customer/finance-customer.repository.d.ts.map +1 -0
- package/dist/customer/finance-customer.repository.js +4 -1
- package/dist/customer/finance-customer.repository.js.map +1 -1
- package/dist/customer/interfaces/customer.repository.interface.d.ts +1 -0
- package/dist/customer/interfaces/customer.repository.interface.d.ts.map +1 -0
- package/dist/customer/interfaces/finance-customer-attr.interface.d.ts +1 -0
- package/dist/customer/interfaces/finance-customer-attr.interface.d.ts.map +1 -0
- package/dist/customer/interfaces/finance-customer.repository.interface.d.ts +1 -0
- package/dist/customer/interfaces/finance-customer.repository.interface.d.ts.map +1 -0
- package/dist/database.d.ts +1 -0
- package/dist/database.d.ts.map +1 -0
- package/dist/database.js +18 -15
- package/dist/database.js.map +1 -1
- package/dist/document/document-item.d.ts +3 -2
- package/dist/document/document-item.d.ts.map +1 -0
- package/dist/document/document-item.js +1 -1
- package/dist/document/document-item.js.map +1 -1
- package/dist/document/document-item.repository.d.ts +1 -0
- package/dist/document/document-item.repository.d.ts.map +1 -0
- package/dist/document/document-item.repository.js +4 -1
- package/dist/document/document-item.repository.js.map +1 -1
- package/dist/document/document.d.ts +2 -1
- package/dist/document/document.d.ts.map +1 -0
- package/dist/document/document.js +242 -191
- package/dist/document/document.js.map +1 -1
- package/dist/document/document.repository.d.ts +1 -0
- package/dist/document/document.repository.d.ts.map +1 -0
- package/dist/document/document.repository.js +4 -1
- package/dist/document/document.repository.js.map +1 -1
- package/dist/document/interfaces/document-attr.interface.d.ts +1 -0
- package/dist/document/interfaces/document-attr.interface.d.ts.map +1 -0
- package/dist/document/interfaces/document-find-all.interface.d.ts +1 -0
- package/dist/document/interfaces/document-find-all.interface.d.ts.map +1 -0
- package/dist/document/interfaces/document-item-attr.interface.d.ts +1 -0
- package/dist/document/interfaces/document-item-attr.interface.d.ts.map +1 -0
- package/dist/document/interfaces/document-item.repository.interface.d.ts +1 -0
- package/dist/document/interfaces/document-item.repository.interface.d.ts.map +1 -0
- package/dist/document-tag/document-tag.d.ts +19 -0
- package/dist/document-tag/document-tag.d.ts.map +1 -0
- package/dist/document-tag/document-tag.js +68 -0
- package/dist/document-tag/document-tag.js.map +1 -0
- package/dist/document-tag/document-tag.repository.d.ts +6 -0
- package/dist/document-tag/document-tag.repository.d.ts.map +1 -0
- package/dist/document-tag/document-tag.repository.js +15 -0
- package/dist/document-tag/document-tag.repository.js.map +1 -0
- package/dist/document-tag/interfaces/document-tag-attr.interface.d.ts +8 -0
- package/dist/document-tag/interfaces/document-tag-attr.interface.d.ts.map +1 -0
- package/dist/document-tag/interfaces/document-tag-attr.interface.js +3 -0
- package/dist/document-tag/interfaces/document-tag-attr.interface.js.map +1 -0
- package/dist/enum/collect-payment-type.d.ts +1 -0
- package/dist/enum/collect-payment-type.d.ts.map +1 -0
- package/dist/enum/doc-type.enum.d.ts +1 -0
- package/dist/enum/doc-type.enum.d.ts.map +1 -0
- package/dist/enum/document-status.enum.d.ts +1 -0
- package/dist/enum/document-status.enum.d.ts.map +1 -0
- package/dist/enum/index.d.ts +2 -2
- package/dist/enum/index.d.ts.map +1 -0
- package/dist/enum/index.js +1 -3
- package/dist/enum/index.js.map +1 -1
- package/dist/enum/payment-method.enum.d.ts +1 -0
- package/dist/enum/payment-method.enum.d.ts.map +1 -0
- package/dist/enum/payment-status.enum.d.ts +1 -0
- package/dist/enum/payment-status.enum.d.ts.map +1 -0
- package/dist/enum/payment-type.enum.d.ts +1 -0
- package/dist/enum/payment-type.enum.d.ts.map +1 -0
- package/dist/enum/quick-book-client-scopes.enum.d.ts +1 -0
- package/dist/enum/quick-book-client-scopes.enum.d.ts.map +1 -0
- package/dist/enum/quick-book-client-scopes.enum.js +34 -1
- package/dist/enum/quick-book-client-scopes.enum.js.map +1 -1
- package/dist/enum/transaction-type.enum.d.ts +1 -0
- package/dist/enum/transaction-type.enum.d.ts.map +1 -0
- package/dist/finance-company/finance-company.d.ts +21 -18
- package/dist/finance-company/finance-company.d.ts.map +1 -0
- package/dist/finance-company/finance-company.js +89 -23
- package/dist/finance-company/finance-company.js.map +1 -1
- package/dist/finance-company/finance-company.repository.d.ts +1 -0
- package/dist/finance-company/finance-company.repository.d.ts.map +1 -0
- package/dist/finance-company/finance-company.repository.js +4 -1
- package/dist/finance-company/finance-company.repository.js.map +1 -1
- package/dist/helpers/login-user.d.ts +1 -0
- package/dist/helpers/login-user.d.ts.map +1 -0
- package/dist/helpers/typeof.d.ts +1 -0
- package/dist/helpers/typeof.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -15
- package/dist/index.js.map +1 -1
- package/dist/interfaces/account-system.interface.d.ts +4 -0
- package/dist/interfaces/account-system.interface.d.ts.map +1 -0
- package/dist/interfaces/index.d.ts +1 -0
- package/dist/interfaces/index.d.ts.map +1 -0
- package/dist/journal-entry/interfaces/journal-entry-attr.interface.d.ts +1 -0
- package/dist/journal-entry/interfaces/journal-entry-attr.interface.d.ts.map +1 -0
- package/dist/journal-entry/journal-entry.d.ts +1 -0
- package/dist/journal-entry/journal-entry.d.ts.map +1 -0
- package/dist/journal-entry/journal-entry.js +4 -1
- package/dist/journal-entry/journal-entry.js.map +1 -1
- package/dist/journal-entry/journal-entry.repository.d.ts +1 -0
- package/dist/journal-entry/journal-entry.repository.d.ts.map +1 -0
- package/dist/journal-entry/journal-entry.repository.js +4 -1
- package/dist/journal-entry/journal-entry.repository.js.map +1 -1
- package/dist/ledger-transaction/interfaces/ledger-transaction-attr.interface.d.ts +1 -0
- package/dist/ledger-transaction/interfaces/ledger-transaction-attr.interface.d.ts.map +1 -0
- package/dist/ledger-transaction/interfaces/ledger-transaction.repository.interface.d.ts +1 -0
- package/dist/ledger-transaction/interfaces/ledger-transaction.repository.interface.d.ts.map +1 -0
- package/dist/ledger-transaction/ledger-transaction.d.ts +1 -0
- package/dist/ledger-transaction/ledger-transaction.d.ts.map +1 -0
- package/dist/ledger-transaction/ledger-transaction.repository.d.ts +1 -0
- package/dist/ledger-transaction/ledger-transaction.repository.d.ts.map +1 -0
- package/dist/ledger-transaction/ledger-transaction.repository.js +4 -1
- package/dist/ledger-transaction/ledger-transaction.repository.js.map +1 -1
- package/dist/models/account.entity.d.ts +1 -0
- package/dist/models/account.entity.d.ts.map +1 -0
- package/dist/models/account.entity.js +7 -4
- package/dist/models/account.entity.js.map +1 -1
- package/dist/models/customer.entity.d.ts +1 -0
- package/dist/models/customer.entity.d.ts.map +1 -0
- package/dist/models/customer.entity.js +4 -1
- package/dist/models/customer.entity.js.map +1 -1
- package/dist/models/document-item.entity.d.ts +1 -0
- package/dist/models/document-item.entity.d.ts.map +1 -0
- package/dist/models/document-item.entity.js +5 -2
- package/dist/models/document-item.entity.js.map +1 -1
- package/dist/models/document-tag.entity.d.ts +14 -0
- package/dist/models/document-tag.entity.d.ts.map +1 -0
- package/dist/models/document-tag.entity.js +64 -0
- package/dist/models/document-tag.entity.js.map +1 -0
- package/dist/models/document.entity.d.ts +3 -0
- package/dist/models/document.entity.d.ts.map +1 -0
- package/dist/models/document.entity.js +12 -4
- package/dist/models/document.entity.js.map +1 -1
- package/dist/models/finance-company.entity.d.ts +1 -0
- package/dist/models/finance-company.entity.d.ts.map +1 -0
- package/dist/models/finance-company.entity.js +5 -2
- package/dist/models/finance-company.entity.js.map +1 -1
- package/dist/models/journal-entry.entity.d.ts +1 -0
- package/dist/models/journal-entry.entity.d.ts.map +1 -0
- package/dist/models/journal-entry.entity.js +5 -2
- package/dist/models/journal-entry.entity.js.map +1 -1
- package/dist/models/ledger-transaction.entity.d.ts +1 -0
- package/dist/models/ledger-transaction.entity.d.ts.map +1 -0
- package/dist/models/ledger-transaction.entity.js +7 -4
- package/dist/models/ledger-transaction.entity.js.map +1 -1
- package/dist/models/payment-item.entity.d.ts +1 -0
- package/dist/models/payment-item.entity.d.ts.map +1 -0
- package/dist/models/payment-item.entity.js +4 -1
- package/dist/models/payment-item.entity.js.map +1 -1
- package/dist/models/payment-method-type.entity.d.ts +1 -0
- package/dist/models/payment-method-type.entity.d.ts.map +1 -0
- package/dist/models/payment-method-type.entity.js +5 -2
- package/dist/models/payment-method-type.entity.js.map +1 -1
- package/dist/models/payment-method.entity.d.ts +1 -0
- package/dist/models/payment-method.entity.d.ts.map +1 -0
- package/dist/models/payment-method.entity.js +5 -2
- package/dist/models/payment-method.entity.js.map +1 -1
- package/dist/models/payment-paid-with.entity.d.ts +1 -0
- package/dist/models/payment-paid-with.entity.d.ts.map +1 -0
- package/dist/models/payment-paid-with.entity.js +5 -2
- package/dist/models/payment-paid-with.entity.js.map +1 -1
- package/dist/models/payment.entity.d.ts +1 -0
- package/dist/models/payment.entity.d.ts.map +1 -0
- package/dist/models/payment.entity.js +6 -3
- package/dist/models/payment.entity.js.map +1 -1
- package/dist/models/post-history.entity.d.ts +1 -0
- package/dist/models/post-history.entity.d.ts.map +1 -0
- package/dist/models/tag-group.entity.d.ts +16 -0
- package/dist/models/tag-group.entity.d.ts.map +1 -0
- package/dist/models/tag-group.entity.js +95 -0
- package/dist/models/tag-group.entity.js.map +1 -0
- package/dist/models/tag.entity.d.ts +17 -0
- package/dist/models/tag.entity.d.ts.map +1 -0
- package/dist/models/tag.entity.js +100 -0
- package/dist/models/tag.entity.js.map +1 -0
- package/dist/models/tax.entity.d.ts +1 -0
- package/dist/models/tax.entity.d.ts.map +1 -0
- package/dist/models/tax.entity.js +4 -1
- package/dist/models/tax.entity.js.map +1 -1
- package/dist/payment/interfaces/payment-attr.interface.d.ts +1 -0
- package/dist/payment/interfaces/payment-attr.interface.d.ts.map +1 -0
- package/dist/payment/interfaces/payment-params.interface.d.ts +1 -0
- package/dist/payment/interfaces/payment-params.interface.d.ts.map +1 -0
- package/dist/payment/payment.d.ts +1 -0
- package/dist/payment/payment.d.ts.map +1 -0
- package/dist/payment/payment.js +5 -2
- package/dist/payment/payment.js.map +1 -1
- package/dist/payment/payment.repository.d.ts +1 -0
- package/dist/payment/payment.repository.d.ts.map +1 -0
- package/dist/payment/payment.repository.js +4 -1
- package/dist/payment/payment.repository.js.map +1 -1
- package/dist/payment-item/interfaces/payment-item-attr.interface.d.ts +1 -0
- package/dist/payment-item/interfaces/payment-item-attr.interface.d.ts.map +1 -0
- package/dist/payment-item/payment-item.d.ts +1 -0
- package/dist/payment-item/payment-item.d.ts.map +1 -0
- package/dist/payment-item/payment-item.js +4 -4
- package/dist/payment-item/payment-item.repository.d.ts +1 -0
- package/dist/payment-item/payment-item.repository.d.ts.map +1 -0
- package/dist/payment-item/payment-item.repository.js +4 -1
- package/dist/payment-item/payment-item.repository.js.map +1 -1
- package/dist/payment-method/interfaces/payment-method-attr.interface.d.ts +1 -0
- package/dist/payment-method/interfaces/payment-method-attr.interface.d.ts.map +1 -0
- package/dist/payment-method/payment-method.d.ts +1 -0
- package/dist/payment-method/payment-method.d.ts.map +1 -0
- package/dist/payment-method/payment-method.js +4 -1
- package/dist/payment-method/payment-method.js.map +1 -1
- package/dist/payment-method/payment-method.repository.d.ts +1 -0
- package/dist/payment-method/payment-method.repository.d.ts.map +1 -0
- package/dist/payment-method/payment-method.repository.js +4 -1
- package/dist/payment-method/payment-method.repository.js.map +1 -1
- package/dist/payment-method-type/interfaces/payment-method-type-attr.interface.d.ts +1 -0
- package/dist/payment-method-type/interfaces/payment-method-type-attr.interface.d.ts.map +1 -0
- package/dist/payment-method-type/payment-method-type.d.ts +1 -0
- package/dist/payment-method-type/payment-method-type.d.ts.map +1 -0
- package/dist/payment-method-type/payment-method-type.repository.d.ts +1 -0
- package/dist/payment-method-type/payment-method-type.repository.d.ts.map +1 -0
- package/dist/payment-method-type/payment-method-type.repository.js +4 -1
- package/dist/payment-method-type/payment-method-type.repository.js.map +1 -1
- package/dist/payment-paid-with/interfaces/payment-paid-with.interface.d.ts +1 -0
- package/dist/payment-paid-with/interfaces/payment-paid-with.interface.d.ts.map +1 -0
- package/dist/payment-paid-with/payment-paid-with.d.ts +1 -0
- package/dist/payment-paid-with/payment-paid-with.d.ts.map +1 -0
- package/dist/payment-paid-with/payment-paid-with.repository.d.ts +1 -0
- package/dist/payment-paid-with/payment-paid-with.repository.d.ts.map +1 -0
- package/dist/payment-paid-with/payment-paid-with.repository.js +4 -1
- package/dist/payment-paid-with/payment-paid-with.repository.js.map +1 -1
- package/dist/tag/interfaces/tag-attr.interface.d.ts +14 -0
- package/dist/tag/interfaces/tag-attr.interface.d.ts.map +1 -0
- package/dist/tag/interfaces/tag-attr.interface.js +3 -0
- package/dist/tag/interfaces/tag-attr.interface.js.map +1 -0
- package/dist/tag/tag.d.ts +26 -0
- package/dist/tag/tag.d.ts.map +1 -0
- package/dist/tag/tag.js +110 -0
- package/dist/tag/tag.js.map +1 -0
- package/dist/tag/tag.repository.d.ts +6 -0
- package/dist/tag/tag.repository.d.ts.map +1 -0
- package/dist/tag/tag.repository.js +15 -0
- package/dist/tag/tag.repository.js.map +1 -0
- package/dist/tag-group/interfaces/tag-group-attr.interface.d.ts +13 -0
- package/dist/tag-group/interfaces/tag-group-attr.interface.d.ts.map +1 -0
- package/dist/tag-group/interfaces/tag-group-attr.interface.js +3 -0
- package/dist/tag-group/interfaces/tag-group-attr.interface.js.map +1 -0
- package/dist/tag-group/tag-group.d.ts +24 -0
- package/dist/tag-group/tag-group.d.ts.map +1 -0
- package/dist/tag-group/tag-group.js +82 -0
- package/dist/tag-group/tag-group.js.map +1 -0
- package/dist/tag-group/tag-group.repository.d.ts +6 -0
- package/dist/tag-group/tag-group.repository.d.ts.map +1 -0
- package/dist/tag-group/tag-group.repository.js +15 -0
- package/dist/tag-group/tag-group.repository.js.map +1 -0
- package/dist/tax/interfaces/tax-attr.interface.d.ts +1 -0
- package/dist/tax/interfaces/tax-attr.interface.d.ts.map +1 -0
- package/dist/tax/tax.d.ts +1 -0
- package/dist/tax/tax.d.ts.map +1 -0
- package/dist/tax/tax.repository.d.ts +1 -0
- package/dist/tax/tax.repository.d.ts.map +1 -0
- package/dist/tax/tax.repository.js +4 -1
- package/dist/tax/tax.repository.js.map +1 -1
- package/dist/test-document.d.ts +1 -0
- package/dist/test-document.d.ts.map +1 -0
- package/dist/test.d.ts +1 -0
- package/dist/test.d.ts.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/migrations/finance-document-tag-migration.js +46 -0
- package/migrations/finance-tag-group-migration.js +53 -0
- package/migrations/finance-tag-migration.js +63 -0
- package/package.json +18 -18
- package/.gitlab-ci.yml +0 -16
- package/.husky/commit-msg +0 -13
- package/.husky/pre-commit +0 -4
- package/.prettierrc +0 -5
- package/CONTRIBUTING.md +0 -31
- package/README.md +0 -13
- package/eslint.config.mjs +0 -58
- package/nest-cli.json +0 -19
- package/sonar-project.properties +0 -13
- package/src/account/account.repository.ts +0 -11
- package/src/account/account.ts +0 -307
- package/src/account/interfaces/account-attr.interface.ts +0 -31
- package/src/account-system-entity/account-system-entity.ts +0 -66
- package/src/account-system-entity/post-history.repository.ts +0 -11
- package/src/config.ts +0 -382
- package/src/customer/customer.ts +0 -311
- package/src/customer/finance-customer.repository.ts +0 -13
- package/src/customer/interfaces/customer.repository.interface.ts +0 -3
- package/src/customer/interfaces/finance-customer-attr.interface.ts +0 -10
- package/src/customer/interfaces/finance-customer.repository.interface.ts +0 -4
- package/src/database.ts +0 -48
- package/src/document/document-item.repository.ts +0 -11
- package/src/document/document-item.ts +0 -146
- package/src/document/document.repository.ts +0 -11
- package/src/document/document.ts +0 -1328
- package/src/document/interfaces/document-attr.interface.ts +0 -28
- package/src/document/interfaces/document-find-all.interface.ts +0 -14
- package/src/document/interfaces/document-item-attr.interface.ts +0 -26
- package/src/document/interfaces/document-item.repository.interface.ts +0 -4
- package/src/enum/collect-payment-type.ts +0 -4
- package/src/enum/doc-type.enum.ts +0 -8
- package/src/enum/document-status.enum.ts +0 -6
- package/src/enum/index.ts +0 -19
- package/src/enum/payment-method.enum.ts +0 -3
- package/src/enum/payment-status.enum.ts +0 -11
- package/src/enum/payment-type.enum.ts +0 -4
- package/src/enum/quick-book-client-scopes.enum.ts +0 -14
- package/src/enum/transaction-type.enum.ts +0 -4
- package/src/finance-company/finance-company.repository.ts +0 -11
- package/src/finance-company/finance-company.ts +0 -2434
- package/src/helpers/login-user.ts +0 -38
- package/src/helpers/typeof.ts +0 -35
- package/src/index.ts +0 -32
- package/src/interfaces/account-system.interface.ts +0 -51
- package/src/interfaces/index.ts +0 -3
- package/src/journal-entry/interfaces/journal-entry-attr.interface.ts +0 -12
- package/src/journal-entry/journal-entry.repository.ts +0 -17
- package/src/journal-entry/journal-entry.ts +0 -264
- package/src/ledger-transaction/interfaces/ledger-transaction-attr.interface.ts +0 -18
- package/src/ledger-transaction/interfaces/ledger-transaction.repository.interface.ts +0 -7
- package/src/ledger-transaction/ledger-transaction.repository.ts +0 -17
- package/src/ledger-transaction/ledger-transaction.ts +0 -182
- package/src/models/account.entity.ts +0 -206
- package/src/models/customer.entity.ts +0 -93
- package/src/models/document-item.entity.ts +0 -167
- package/src/models/document.entity.ts +0 -211
- package/src/models/finance-company.entity.ts +0 -69
- package/src/models/journal-entry.entity.ts +0 -110
- package/src/models/ledger-transaction.entity.ts +0 -148
- package/src/models/payment-item.entity.ts +0 -60
- package/src/models/payment-method-type.entity.ts +0 -70
- package/src/models/payment-method.entity.ts +0 -51
- package/src/models/payment-paid-with.entity.ts +0 -133
- package/src/models/payment.entity.ts +0 -165
- package/src/models/post-history.entity.ts +0 -41
- package/src/models/tax.entity.ts +0 -75
- package/src/payment/interfaces/payment-attr.interface.ts +0 -23
- package/src/payment/interfaces/payment-params.interface.ts +0 -8
- package/src/payment/payment.repository.ts +0 -11
- package/src/payment/payment.ts +0 -236
- package/src/payment-item/interfaces/payment-item-attr.interface.ts +0 -10
- package/src/payment-item/payment-item.repository.ts +0 -11
- package/src/payment-item/payment-item.ts +0 -134
- package/src/payment-method/interfaces/payment-method-attr.interface.ts +0 -5
- package/src/payment-method/payment-method.repository.ts +0 -11
- package/src/payment-method/payment-method.ts +0 -146
- package/src/payment-method-type/interfaces/payment-method-type-attr.interface.ts +0 -8
- package/src/payment-method-type/payment-method-type.repository.ts +0 -11
- package/src/payment-method-type/payment-method-type.ts +0 -79
- package/src/payment-paid-with/interfaces/payment-paid-with.interface.ts +0 -20
- package/src/payment-paid-with/payment-paid-with.repository.ts +0 -11
- package/src/payment-paid-with/payment-paid-with.ts +0 -74
- package/src/tax/interfaces/tax-attr.interface.ts +0 -10
- package/src/tax/tax.repository.ts +0 -11
- package/src/tax/tax.ts +0 -68
- package/src/test-document.ts +0 -25
- package/src/test.ts +0 -3
- package/tsconfig.build.json +0 -4
- package/tsconfig.json +0 -23
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { LoginUserBase } from '@tomei/general';
|
|
2
|
-
|
|
3
|
-
export class LoginUser extends LoginUserBase {
|
|
4
|
-
ObjectId: string;
|
|
5
|
-
ObjectName: string;
|
|
6
|
-
TableName: string;
|
|
7
|
-
Roles: string[];
|
|
8
|
-
Privileges: string[];
|
|
9
|
-
private _ObjectType: 'LoginUser';
|
|
10
|
-
|
|
11
|
-
get ObjectType() {
|
|
12
|
-
return this._ObjectType;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
checkPrivileges(
|
|
16
|
-
SystemCode: string,
|
|
17
|
-
PrivilegeName: string,
|
|
18
|
-
): boolean | Promise<boolean> {
|
|
19
|
-
if (this.Privileges.includes(PrivilegeName)) {
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
CheckRole(SystemCode: string, RoleName: string): boolean | Promise<boolean> {
|
|
26
|
-
if (this.Roles.includes(RoleName)) {
|
|
27
|
-
return true;
|
|
28
|
-
}
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
constructor(objectId: string, objectName: string, tableName: string) {
|
|
33
|
-
super();
|
|
34
|
-
this.ObjectId = objectId;
|
|
35
|
-
this.ObjectName = objectName;
|
|
36
|
-
this.TableName = tableName;
|
|
37
|
-
}
|
|
38
|
-
}
|
package/src/helpers/typeof.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export function type(value: any): string {
|
|
2
|
-
if (value === null) {
|
|
3
|
-
return 'null';
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
const baseType = typeof value;
|
|
7
|
-
|
|
8
|
-
if (!['object', 'function'].includes(baseType)) {
|
|
9
|
-
return baseType;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// if value is object and have propery ObjectType: string return ObjectType instead.
|
|
13
|
-
if (baseType === 'object' && value.ObjectType) {
|
|
14
|
-
return value.ObjectType;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const tag = value[Symbol.toStringTag];
|
|
18
|
-
if (typeof tag === 'string') {
|
|
19
|
-
return tag;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if (
|
|
23
|
-
baseType === 'function' &&
|
|
24
|
-
Function.prototype.toString.call(value).startsWith('class')
|
|
25
|
-
) {
|
|
26
|
-
return Function.prototype.toString.call(value).split(' ')[1];
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const className = value.constructor.name;
|
|
30
|
-
if (typeof className === 'string' && className !== '') {
|
|
31
|
-
return className;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return baseType;
|
|
35
|
-
}
|
package/src/index.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import Account from './account/account';
|
|
2
|
-
import FinanceCompany from './finance-company/finance-company';
|
|
3
|
-
import FinanceCustomerBase from './customer/customer';
|
|
4
|
-
import Document from './document/document';
|
|
5
|
-
import DocumentItem from './document/document-item';
|
|
6
|
-
import JournalEntry from './journal-entry/journal-entry';
|
|
7
|
-
import LedgerTransaction from './ledger-transaction/ledger-transaction';
|
|
8
|
-
import Payment from './payment/payment';
|
|
9
|
-
import PaymentItem from './payment-item/payment-item';
|
|
10
|
-
import PaymentMethod from './payment-method/payment-method';
|
|
11
|
-
import PaymentMethodType from './payment-method-type/payment-method-type';
|
|
12
|
-
import PaymentPaidWith from './payment-paid-with/payment-paid-with';
|
|
13
|
-
import { TestDocument } from './test-document';
|
|
14
|
-
|
|
15
|
-
export {
|
|
16
|
-
FinanceCompany,
|
|
17
|
-
Account,
|
|
18
|
-
FinanceCustomerBase,
|
|
19
|
-
Document,
|
|
20
|
-
DocumentItem,
|
|
21
|
-
JournalEntry,
|
|
22
|
-
LedgerTransaction,
|
|
23
|
-
Payment,
|
|
24
|
-
PaymentItem,
|
|
25
|
-
PaymentMethod,
|
|
26
|
-
PaymentMethodType,
|
|
27
|
-
PaymentPaidWith,
|
|
28
|
-
TestDocument,
|
|
29
|
-
};
|
|
30
|
-
export * as FinanceEnum from './enum';
|
|
31
|
-
export * as FinanceInterfaces from './interfaces';
|
|
32
|
-
export * as FinanceDb from './database';
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import Payment from '../payment/payment';
|
|
2
|
-
import FinanceCustomerBase from '../customer/customer';
|
|
3
|
-
import Account from '../account/account';
|
|
4
|
-
import JournalEntry from '../journal-entry/journal-entry';
|
|
5
|
-
import Document from '../document/document';
|
|
6
|
-
import { DocumentStatus } from '../enum/document-status.enum';
|
|
7
|
-
|
|
8
|
-
export interface IAccountSystem {
|
|
9
|
-
createAccount(Account: Account, dbTransaction?: any): Promise<string>;
|
|
10
|
-
createInvoice(
|
|
11
|
-
payload: {
|
|
12
|
-
customer: FinanceCustomerBase;
|
|
13
|
-
invoice: Document;
|
|
14
|
-
paymentMode: 'cash' | 'credit';
|
|
15
|
-
},
|
|
16
|
-
dbTransaction?: any,
|
|
17
|
-
): Promise<{
|
|
18
|
-
invoiceRefId: string;
|
|
19
|
-
invoiceItems: {
|
|
20
|
-
name: string;
|
|
21
|
-
itemRefId: string;
|
|
22
|
-
}[];
|
|
23
|
-
invoiceNo: string;
|
|
24
|
-
}>;
|
|
25
|
-
createDebitNote(payload: any, dbTransaction?: any): Promise<any>;
|
|
26
|
-
createCreditNote(payload: any, dbTransaction?: any): Promise<any>;
|
|
27
|
-
postTransaction(
|
|
28
|
-
journalEntry: JournalEntry,
|
|
29
|
-
dbTransaction?: any,
|
|
30
|
-
): Promise<any>;
|
|
31
|
-
createCustomer(
|
|
32
|
-
customer: FinanceCustomerBase,
|
|
33
|
-
dbTransaction?: any,
|
|
34
|
-
): Promise<string>;
|
|
35
|
-
updateCustomer(
|
|
36
|
-
customer: FinanceCustomerBase,
|
|
37
|
-
dbTransaction?: any,
|
|
38
|
-
): Promise<any>;
|
|
39
|
-
makePayment(
|
|
40
|
-
customer: FinanceCustomerBase,
|
|
41
|
-
paymentInfo: Payment,
|
|
42
|
-
dbTransaction?: any,
|
|
43
|
-
): Promise<string>;
|
|
44
|
-
collectPayments(
|
|
45
|
-
customer: FinanceCustomerBase,
|
|
46
|
-
paymentInfo: Payment,
|
|
47
|
-
dbTransaction?: any,
|
|
48
|
-
): Promise<string>;
|
|
49
|
-
postJournalEntry(payload: any): Promise<string>;
|
|
50
|
-
getInvoiceStatus(AccSystemRefId: any): Promise<DocumentStatus>;
|
|
51
|
-
}
|
package/src/interfaces/index.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export interface IJournalEntryAttr {
|
|
2
|
-
CompanyId?: string;
|
|
3
|
-
JournalEntryId?: string;
|
|
4
|
-
Date?: Date;
|
|
5
|
-
Name?: string;
|
|
6
|
-
Description?: string;
|
|
7
|
-
AccSystemRefId?: string;
|
|
8
|
-
PostedToAccSystemYN?: string;
|
|
9
|
-
PostedById?: string;
|
|
10
|
-
PostedDateTime?: Date;
|
|
11
|
-
dbTransaction?: any;
|
|
12
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { RepositoryBase, IRepositoryBase } from '@tomei/general';
|
|
2
|
-
import JournalEntryModel from '../models/journal-entry.entity';
|
|
3
|
-
|
|
4
|
-
export class JournalEntryRepository
|
|
5
|
-
extends RepositoryBase<JournalEntryModel>
|
|
6
|
-
implements IRepositoryBase<JournalEntryModel>
|
|
7
|
-
{
|
|
8
|
-
constructor() {
|
|
9
|
-
super(JournalEntryModel);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
async count(dbTransaction?: any) {
|
|
13
|
-
return await JournalEntryModel.count({
|
|
14
|
-
transaction: dbTransaction,
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
import { IJournalEntryAttr } from './interfaces/journal-entry-attr.interface';
|
|
2
|
-
import { TransactionTypeOptions } from '../enum';
|
|
3
|
-
import JournalEntryModel from '../models/journal-entry.entity';
|
|
4
|
-
import { AccountSystemEntity } from '../account-system-entity/account-system-entity';
|
|
5
|
-
import { LedgerTransactionRepository } from '../ledger-transaction/ledger-transaction.repository';
|
|
6
|
-
import LedgerTransaction from '../ledger-transaction/ledger-transaction';
|
|
7
|
-
import { JournalEntryRepository } from './journal-entry.repository';
|
|
8
|
-
import { RecordNotFoundError } from '@tomei/general/dist/class/exceptions/record-not-found.error';
|
|
9
|
-
|
|
10
|
-
export default class JournalEntry extends AccountSystemEntity {
|
|
11
|
-
private _JournalEntryId = 'New';
|
|
12
|
-
Date = new Date();
|
|
13
|
-
Name = '';
|
|
14
|
-
Description = '';
|
|
15
|
-
protected _ObjectType: 'JournalEntry';
|
|
16
|
-
|
|
17
|
-
private static _RepositoryBase = new JournalEntryRepository();
|
|
18
|
-
private static _LedgerTransactionRepository =
|
|
19
|
-
new LedgerTransactionRepository();
|
|
20
|
-
|
|
21
|
-
private _DbTransaction: any;
|
|
22
|
-
private _DebitTransactions: LedgerTransaction[] = [];
|
|
23
|
-
private _CreditTransactions: LedgerTransaction[] = [];
|
|
24
|
-
|
|
25
|
-
get JournalEntryId() {
|
|
26
|
-
return this._JournalEntryId;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
private set JournalEntryId(id: string) {
|
|
30
|
-
this._JournalEntryId = id;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
get ObjectType() {
|
|
34
|
-
return this._ObjectType;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
get RepositoryBase() {
|
|
38
|
-
return JournalEntry._RepositoryBase;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
get TableName() {
|
|
42
|
-
return 'finance_JournalEntry';
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
get ObjectName() {
|
|
46
|
-
return this.Name;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
get ObjectId() {
|
|
50
|
-
return this._JournalEntryId;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
constructor(dbTransaction?: any, journalEntryId?: string) {
|
|
54
|
-
super();
|
|
55
|
-
if (dbTransaction) {
|
|
56
|
-
this._DbTransaction = dbTransaction;
|
|
57
|
-
}
|
|
58
|
-
if (!journalEntryId) {
|
|
59
|
-
this.init({
|
|
60
|
-
JournalEntryId: 'New',
|
|
61
|
-
CompanyId: '',
|
|
62
|
-
Date: new Date(),
|
|
63
|
-
Name: '',
|
|
64
|
-
Description: '',
|
|
65
|
-
AccSystemRefId: '',
|
|
66
|
-
PostedToAccSystemYN: 'N',
|
|
67
|
-
PostedById: '',
|
|
68
|
-
PostedDateTime: null,
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
public static async initJournalEntry(
|
|
74
|
-
dbTransaction?: any,
|
|
75
|
-
journalEntryId?: string,
|
|
76
|
-
): Promise<JournalEntry> {
|
|
77
|
-
try {
|
|
78
|
-
if (journalEntryId) {
|
|
79
|
-
const journalEntryData = await JournalEntry._RepositoryBase.findOne({
|
|
80
|
-
where: {
|
|
81
|
-
JournalEntryId: journalEntryId,
|
|
82
|
-
},
|
|
83
|
-
transaction: dbTransaction,
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
if (journalEntryData) {
|
|
87
|
-
const journalEntry = new JournalEntry();
|
|
88
|
-
journalEntry.init({
|
|
89
|
-
JournalEntryId: journalEntryData.JournalEntryId,
|
|
90
|
-
CompanyId: journalEntryData.CompanyId,
|
|
91
|
-
Date: new Date(),
|
|
92
|
-
Name: journalEntryData.Name,
|
|
93
|
-
Description: journalEntryData.Description,
|
|
94
|
-
AccSystemRefId: journalEntryData.AccSystemRefId,
|
|
95
|
-
PostedToAccSystemYN: journalEntryData.PostedToAccSystemYN,
|
|
96
|
-
PostedById: journalEntryData.PostedById,
|
|
97
|
-
PostedDateTime: journalEntryData.PostedDateTime,
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
return journalEntry;
|
|
101
|
-
} else {
|
|
102
|
-
const notFoundError = new RecordNotFoundError(
|
|
103
|
-
'JournalEntryErrMsg',
|
|
104
|
-
'No Record Found.',
|
|
105
|
-
);
|
|
106
|
-
throw notFoundError;
|
|
107
|
-
}
|
|
108
|
-
} else {
|
|
109
|
-
const journalEntry = new JournalEntry(dbTransaction);
|
|
110
|
-
|
|
111
|
-
return journalEntry;
|
|
112
|
-
}
|
|
113
|
-
} catch (error) {
|
|
114
|
-
throw error;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
get DebitTransactions(): Promise<LedgerTransaction[]> {
|
|
119
|
-
return new Promise((resolve, reject) => {
|
|
120
|
-
if (this.JournalEntryId !== 'New') {
|
|
121
|
-
JournalEntry._LedgerTransactionRepository
|
|
122
|
-
.findAll({
|
|
123
|
-
where: {
|
|
124
|
-
TransactionType: TransactionTypeOptions.DEBIT,
|
|
125
|
-
},
|
|
126
|
-
transaction: this._DbTransaction,
|
|
127
|
-
})
|
|
128
|
-
.then((debitTransactions) => {
|
|
129
|
-
const debitTransactionObjects = debitTransactions.map(
|
|
130
|
-
(debitTransactionData) =>
|
|
131
|
-
new LedgerTransaction(
|
|
132
|
-
this._DbTransaction,
|
|
133
|
-
debitTransactionData.LedgerNo,
|
|
134
|
-
),
|
|
135
|
-
);
|
|
136
|
-
return Promise.all(debitTransactionObjects);
|
|
137
|
-
})
|
|
138
|
-
.then((debitTransactionObjects) => {
|
|
139
|
-
this._DebitTransactions = debitTransactionObjects;
|
|
140
|
-
resolve(this._DebitTransactions);
|
|
141
|
-
})
|
|
142
|
-
.catch((err) => {
|
|
143
|
-
reject(err);
|
|
144
|
-
});
|
|
145
|
-
} else {
|
|
146
|
-
resolve(this._DebitTransactions);
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
get CreditTransactions(): Promise<LedgerTransaction[]> {
|
|
152
|
-
return new Promise((resolve, reject) => {
|
|
153
|
-
if (this.JournalEntryId !== 'New') {
|
|
154
|
-
JournalEntry._LedgerTransactionRepository
|
|
155
|
-
.findAll({
|
|
156
|
-
where: {
|
|
157
|
-
TransactionType: TransactionTypeOptions.CREDIT,
|
|
158
|
-
},
|
|
159
|
-
transaction: this._DbTransaction,
|
|
160
|
-
})
|
|
161
|
-
.then((creditTransaction) => {
|
|
162
|
-
const creditTransactionObjects = creditTransaction.map(
|
|
163
|
-
(creditTransactionData) =>
|
|
164
|
-
new LedgerTransaction(
|
|
165
|
-
this._DbTransaction,
|
|
166
|
-
creditTransactionData.LedgerNo,
|
|
167
|
-
),
|
|
168
|
-
);
|
|
169
|
-
return Promise.all(creditTransactionObjects);
|
|
170
|
-
})
|
|
171
|
-
.then((creditTransactionObjects) => {
|
|
172
|
-
this._CreditTransactions = creditTransactionObjects;
|
|
173
|
-
resolve(this._CreditTransactions);
|
|
174
|
-
})
|
|
175
|
-
.catch((err) => {
|
|
176
|
-
reject(err);
|
|
177
|
-
});
|
|
178
|
-
} else {
|
|
179
|
-
resolve(this._CreditTransactions);
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
init(params: IJournalEntryAttr) {
|
|
185
|
-
if (params.JournalEntryId) this.JournalEntryId = params.JournalEntryId;
|
|
186
|
-
if (params.CompanyId) this.CompanyId = params.CompanyId;
|
|
187
|
-
if (params.Date) this.Date = params.Date;
|
|
188
|
-
if (params.Name) this.Name = params.Name;
|
|
189
|
-
if (params.Description) this.Description = params.Description;
|
|
190
|
-
if (params.PostedById) this.PostedById = params.PostedById;
|
|
191
|
-
if (params.PostedToAccSystemYN)
|
|
192
|
-
this.PostedToAccSystemYN = params.PostedToAccSystemYN;
|
|
193
|
-
if (params.PostedDateTime) this.PostedDateTime = params.PostedDateTime;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
getData() {
|
|
197
|
-
return {
|
|
198
|
-
JournalEntryId: this.JournalEntryId,
|
|
199
|
-
Date: this.Date,
|
|
200
|
-
Name: this.Name,
|
|
201
|
-
Description: this.Description,
|
|
202
|
-
PostedById: this.PostedById,
|
|
203
|
-
PostedToAccSystemYN: this.PostedToAccSystemYN,
|
|
204
|
-
PostedDateTime: this.PostedDateTime,
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
async create(dbTransaction?: any) {
|
|
209
|
-
return await this.RepositoryBase.create(this.getData, {
|
|
210
|
-
transaction: dbTransaction,
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
async save(userId: string, dbTransaction?: any): Promise<JournalEntryModel> {
|
|
215
|
-
try {
|
|
216
|
-
const count = await this.RepositoryBase.count(dbTransaction);
|
|
217
|
-
this.JournalEntryId = `${count + 1}`;
|
|
218
|
-
|
|
219
|
-
const data = await this.RepositoryBase.create(
|
|
220
|
-
{
|
|
221
|
-
JournalEntryId: this.JournalEntryId,
|
|
222
|
-
CompanyId: this.CompanyId,
|
|
223
|
-
Date: this.Date,
|
|
224
|
-
Name: this.Name,
|
|
225
|
-
Description: this.Description,
|
|
226
|
-
PostedById: this.PostedToAccSystemYN == 'Y' ? userId : null,
|
|
227
|
-
PostedToAccSystemYN: this.PostedToAccSystemYN,
|
|
228
|
-
PostedDateTime:
|
|
229
|
-
this.PostedToAccSystemYN == 'Y' ? this.PostedDateTime : null,
|
|
230
|
-
},
|
|
231
|
-
{ transaction: dbTransaction },
|
|
232
|
-
);
|
|
233
|
-
return data;
|
|
234
|
-
} catch (error) {
|
|
235
|
-
throw error;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* Create a new LedgerTransaction
|
|
241
|
-
*
|
|
242
|
-
*
|
|
243
|
-
* @param transactionType - Indicating the type of ledger transaction to create
|
|
244
|
-
*
|
|
245
|
-
* @returns {LedgerTransaction}
|
|
246
|
-
*/
|
|
247
|
-
async newLedgerTransaction(
|
|
248
|
-
transactionType: TransactionTypeOptions,
|
|
249
|
-
): Promise<LedgerTransaction> {
|
|
250
|
-
const ledgerTransaction = new LedgerTransaction(
|
|
251
|
-
transactionType,
|
|
252
|
-
this._DbTransaction,
|
|
253
|
-
);
|
|
254
|
-
ledgerTransaction.JournalEntryId = this.JournalEntryId;
|
|
255
|
-
|
|
256
|
-
if (transactionType === TransactionTypeOptions.DEBIT) {
|
|
257
|
-
this._DebitTransactions.push(ledgerTransaction);
|
|
258
|
-
} else if (transactionType === TransactionTypeOptions.CREDIT) {
|
|
259
|
-
this._CreditTransactions.push(ledgerTransaction);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
return ledgerTransaction;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { TransactionTypeOptions } from '../../enum';
|
|
2
|
-
|
|
3
|
-
export interface ILedgerTransactionAttr {
|
|
4
|
-
LedgerNo?: string;
|
|
5
|
-
TransactionType?: TransactionTypeOptions;
|
|
6
|
-
JournalEntryId?: string;
|
|
7
|
-
AccountNo?: string;
|
|
8
|
-
Date?: Date;
|
|
9
|
-
Name?: string;
|
|
10
|
-
Description?: string;
|
|
11
|
-
Currency?: string;
|
|
12
|
-
DebitAmount?: number;
|
|
13
|
-
CreditAmount?: number;
|
|
14
|
-
RelatedObjectId?: string;
|
|
15
|
-
RelatedObjectType?: string;
|
|
16
|
-
RelatedDocNo?: string;
|
|
17
|
-
RelatedPaymentId?: string;
|
|
18
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import LedgerTransactionModel from '../models/ledger-transaction.entity';
|
|
2
|
-
import { RepositoryBase, IRepositoryBase } from '@tomei/general';
|
|
3
|
-
|
|
4
|
-
export class LedgerTransactionRepository
|
|
5
|
-
extends RepositoryBase<LedgerTransactionModel>
|
|
6
|
-
implements IRepositoryBase<LedgerTransactionModel>
|
|
7
|
-
{
|
|
8
|
-
constructor() {
|
|
9
|
-
super(LedgerTransactionModel);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
async count(dbTransaction?: any) {
|
|
13
|
-
return await LedgerTransactionModel.count({
|
|
14
|
-
transaction: dbTransaction,
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import { ILedgerTransactionAttr } from './interfaces/ledger-transaction-attr.interface';
|
|
2
|
-
import { TransactionTypeOptions } from '../enum/transaction-type.enum';
|
|
3
|
-
import { LedgerTransactionRepository } from './ledger-transaction.repository';
|
|
4
|
-
import LedgerTransactionModel from '../models/ledger-transaction.entity';
|
|
5
|
-
import { ObjectBase } from '@tomei/general';
|
|
6
|
-
|
|
7
|
-
export default class LedgerTransaction extends ObjectBase {
|
|
8
|
-
ObjectName: string;
|
|
9
|
-
TableName: string;
|
|
10
|
-
ObjectType = 'LedgerTransaction';
|
|
11
|
-
ObjectId = 'New';
|
|
12
|
-
TransactionType = TransactionTypeOptions.DEBIT;
|
|
13
|
-
JournalEntryId = '';
|
|
14
|
-
AccountNo = '';
|
|
15
|
-
Date = new Date();
|
|
16
|
-
Name = '';
|
|
17
|
-
Description = '';
|
|
18
|
-
Currency = 'MYR';
|
|
19
|
-
DebitAmount = 0;
|
|
20
|
-
CreditAmount = 0;
|
|
21
|
-
RelatedObjectId = '';
|
|
22
|
-
RelatedObjectType = '';
|
|
23
|
-
RelatedDocNo = '';
|
|
24
|
-
RelatedPaymentId = '';
|
|
25
|
-
|
|
26
|
-
get LedgerNo() {
|
|
27
|
-
return this.ObjectId;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
set LedgerNo(id: string) {
|
|
31
|
-
this.ObjectId = id;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
private _DbTransaction: any;
|
|
35
|
-
|
|
36
|
-
private static _LedgerTransactionRepository =
|
|
37
|
-
new LedgerTransactionRepository();
|
|
38
|
-
|
|
39
|
-
constructor(
|
|
40
|
-
transactionType: TransactionTypeOptions,
|
|
41
|
-
dbTransaction?: any,
|
|
42
|
-
LedgerNo?: string,
|
|
43
|
-
) {
|
|
44
|
-
super();
|
|
45
|
-
this.TransactionType = transactionType;
|
|
46
|
-
if (dbTransaction) {
|
|
47
|
-
this._DbTransaction = dbTransaction;
|
|
48
|
-
}
|
|
49
|
-
if (LedgerNo) {
|
|
50
|
-
this.LedgerNo = LedgerNo;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
init(params?: ILedgerTransactionAttr) {
|
|
55
|
-
if (params.LedgerNo) this.LedgerNo = params.LedgerNo;
|
|
56
|
-
if (params.TransactionType) this.TransactionType = params.TransactionType;
|
|
57
|
-
if (params.JournalEntryId) this.JournalEntryId = params.JournalEntryId;
|
|
58
|
-
if (params.AccountNo) this.AccountNo = params.AccountNo;
|
|
59
|
-
if (params.Date) this.Date = params.Date;
|
|
60
|
-
if (params.Description) this.Description = params.Description;
|
|
61
|
-
if (params.Currency) this.Currency = params.Currency;
|
|
62
|
-
if (params.DebitAmount) this.DebitAmount = params.DebitAmount;
|
|
63
|
-
if (params.CreditAmount) this.CreditAmount = params.CreditAmount;
|
|
64
|
-
if (params.RelatedObjectId) this.RelatedObjectId = params.RelatedObjectId;
|
|
65
|
-
if (params.RelatedObjectType)
|
|
66
|
-
this.RelatedObjectType = params.RelatedObjectType;
|
|
67
|
-
if (params.Name) this.Name = params.Name;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
getData() {
|
|
71
|
-
return {
|
|
72
|
-
LedgerNo: this.LedgerNo,
|
|
73
|
-
TransactionType: this.TransactionType,
|
|
74
|
-
JournalEntryId: this.JournalEntryId,
|
|
75
|
-
AccountNo: this.AccountNo,
|
|
76
|
-
Date: this.Date,
|
|
77
|
-
Name: this.Name,
|
|
78
|
-
Description: this.Description,
|
|
79
|
-
Currency: this.Currency,
|
|
80
|
-
DebitAmount: this.DebitAmount,
|
|
81
|
-
CreditAmount: this.CreditAmount,
|
|
82
|
-
RelatedObjectId: this.RelatedObjectId,
|
|
83
|
-
RelatedObjectType: this.RelatedObjectType,
|
|
84
|
-
RelatedDocNo: this.RelatedDocNo,
|
|
85
|
-
RelatedPaymentId: this.RelatedPaymentId,
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
async save(dbTransaction?: any): Promise<LedgerTransactionModel> {
|
|
90
|
-
try {
|
|
91
|
-
const count =
|
|
92
|
-
await LedgerTransaction._LedgerTransactionRepository.count(
|
|
93
|
-
dbTransaction,
|
|
94
|
-
);
|
|
95
|
-
this.LedgerNo = `${count + 1}`;
|
|
96
|
-
|
|
97
|
-
return await LedgerTransaction._LedgerTransactionRepository.create(
|
|
98
|
-
{
|
|
99
|
-
LedgerNo: this.LedgerNo,
|
|
100
|
-
TransactionType: this.TransactionType,
|
|
101
|
-
JournalEntryId: this.JournalEntryId,
|
|
102
|
-
AccountNo: this.AccountNo,
|
|
103
|
-
Date: this.Date,
|
|
104
|
-
Name: this.Name,
|
|
105
|
-
Description: this.Description,
|
|
106
|
-
Currency: this.Currency,
|
|
107
|
-
DebitAmount: this.DebitAmount,
|
|
108
|
-
CreditAmount: this.CreditAmount,
|
|
109
|
-
RelatedObjectId: this.RelatedObjectId || undefined,
|
|
110
|
-
RelatedObjectType: this.RelatedObjectType || undefined,
|
|
111
|
-
RelatedDocNo: this.RelatedDocNo || undefined,
|
|
112
|
-
RelatedPaymentId: this.RelatedPaymentId || undefined,
|
|
113
|
-
},
|
|
114
|
-
{ transaction: dbTransaction },
|
|
115
|
-
);
|
|
116
|
-
} catch (error) {
|
|
117
|
-
throw error;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
async create() {
|
|
122
|
-
return await LedgerTransaction._LedgerTransactionRepository.create(
|
|
123
|
-
this.getData,
|
|
124
|
-
{ transaction: this._DbTransaction },
|
|
125
|
-
);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
async findAll(options: any) {
|
|
129
|
-
return await LedgerTransaction._LedgerTransactionRepository.findAll(
|
|
130
|
-
options,
|
|
131
|
-
);
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
async findAllWithPagination(options: any) {
|
|
135
|
-
return await LedgerTransaction._LedgerTransactionRepository.findAllWithPagination(
|
|
136
|
-
options,
|
|
137
|
-
);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
async accountTransactionHistory(accountNo: string) {
|
|
141
|
-
return await this.findAll({
|
|
142
|
-
where: {
|
|
143
|
-
AccountNo: accountNo,
|
|
144
|
-
},
|
|
145
|
-
order: [['Date', 'DESC']],
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
async newLedgerTransaction(
|
|
150
|
-
transactionType: TransactionTypeOptions,
|
|
151
|
-
journalEntryId?: string,
|
|
152
|
-
): Promise<any> {
|
|
153
|
-
this.init({
|
|
154
|
-
LedgerNo: this.createId(),
|
|
155
|
-
TransactionType: transactionType,
|
|
156
|
-
JournalEntryId: journalEntryId,
|
|
157
|
-
// Name: journalEntry.Name,
|
|
158
|
-
// AccountNo: '',
|
|
159
|
-
// Date: new Date(),
|
|
160
|
-
// Description: journalEntry.Description,
|
|
161
|
-
// Currency: 'MYR',
|
|
162
|
-
// DebitAmount: 0,
|
|
163
|
-
// CreditAmount: 0,
|
|
164
|
-
// RelatedObjectId: '',
|
|
165
|
-
// RelatedObjectType: '',
|
|
166
|
-
// RelatedDocNo: '',
|
|
167
|
-
// RelatedPaymentId: '',
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
if (transactionType === TransactionTypeOptions.DEBIT) {
|
|
171
|
-
this.TransactionType = TransactionTypeOptions.DEBIT;
|
|
172
|
-
} else if (transactionType === TransactionTypeOptions.CREDIT) {
|
|
173
|
-
this.TransactionType = TransactionTypeOptions.CREDIT;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
if (journalEntryId) {
|
|
177
|
-
this.JournalEntryId = journalEntryId;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
return await this.create();
|
|
181
|
-
}
|
|
182
|
-
}
|