@tomei/finance 0.2.15 → 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/.commitlintrc.json +22 -22
- package/.eslintrc.js +72 -72
- package/.husky/commit-msg +4 -4
- package/.husky/pre-commit +4 -4
- package/.prettierrc +4 -4
- package/CONTRIBUTING.md +30 -30
- package/LICENSE +21 -21
- package/README.md +13 -41
- package/dist/account/account.d.ts +38 -38
- package/dist/account/account.js +129 -116
- package/dist/account/account.js.map +1 -1
- package/dist/account/account.repository.d.ts +16 -16
- package/dist/account/account.repository.js +46 -46
- package/dist/account/account.repository.js.map +1 -1
- package/dist/account/entities/account.entity.d.ts +26 -26
- package/dist/account/entities/account.entity.js +198 -198
- package/dist/account/entities/fee-associated-object.entity.d.ts +6 -0
- package/dist/account/entities/fee-associated-object.entity.js +52 -0
- package/dist/account/entities/fee-associated-object.entity.js.map +1 -0
- package/dist/account/index.d.ts +6 -6
- package/dist/account/index.js +9 -9
- package/dist/account/interfaces/account-attr.interface.d.ts +21 -21
- package/dist/account/interfaces/account-attr.interface.js +2 -2
- package/dist/account/interfaces/account.repository.interface.d.ts +3 -3
- package/dist/account/interfaces/account.repository.interface.js +2 -2
- package/dist/account-system-entity/account-system-entity.d.ts +21 -21
- package/dist/account-system-entity/account-system-entity.js +96 -75
- package/dist/account-system-entity/account-system-entity.js.map +1 -1
- package/dist/account-system-entity/index.d.ts +2 -2
- package/dist/account-system-entity/index.js +5 -5
- package/dist/account-system-entity/post-history.entity.d.ts +11 -11
- package/dist/account-system-entity/post-history.entity.js +64 -64
- package/dist/account-system-entity/post-history.repository.d.ts +5 -5
- package/dist/account-system-entity/post-history.repository.js +11 -12
- package/dist/account-system-entity/post-history.repository.js.map +1 -1
- package/dist/base/account-system.interface.d.ts +7 -7
- package/dist/base/account-system.interface.js +2 -2
- package/dist/base/address.base.abstract.d.ts +4 -0
- package/dist/base/address.base.abstract.js +10 -0
- package/dist/base/address.base.abstract.js.map +1 -0
- package/dist/base/base.address.d.ts +8 -0
- package/dist/base/base.address.js +15 -0
- package/dist/base/base.address.js.map +1 -0
- package/dist/base/base.object.d.ts +7 -0
- package/dist/base/base.object.js +14 -0
- package/dist/base/base.object.js.map +1 -0
- package/dist/base/base.owner.d.ts +23 -0
- package/dist/base/base.owner.js +34 -0
- package/dist/base/base.owner.js.map +1 -0
- package/dist/base/base.repository.abstract.d.ts +12 -12
- package/dist/base/base.repository.abstract.js +21 -21
- package/dist/base/base.repository.interface.d.ts +9 -9
- package/dist/base/base.repository.interface.js +2 -2
- package/dist/base/index.d.ts +4 -6
- package/dist/base/index.js +9 -7
- package/dist/base/index.js.map +1 -1
- package/dist/base/object/base.object.abstract.d.ts +5 -5
- package/dist/base/object/base.object.abstract.js +6 -6
- package/dist/base/object/base.object.d.ts +7 -0
- package/dist/base/object/base.object.js +14 -0
- package/dist/base/object/base.object.js.map +1 -0
- package/dist/base/object/object.interface.d.ts +4 -4
- package/dist/base/object/object.interface.js +2 -2
- package/dist/base/object.base.abstract.d.ts +5 -0
- package/dist/base/object.base.abstract.js +11 -0
- package/dist/base/object.base.abstract.js.map +1 -0
- package/dist/base/owner/base.owner.abstract.d.ts +20 -20
- package/dist/base/owner/base.owner.abstract.js +7 -7
- package/dist/base/owner/base.owner.d.ts +22 -0
- package/dist/base/owner/base.owner.js +31 -0
- package/dist/base/owner/base.owner.js.map +1 -0
- package/dist/base/owner/owner.interface.d.ts +19 -19
- package/dist/base/owner/owner.interface.js +2 -2
- package/dist/base/person.base.abstract.d.ts +21 -0
- package/dist/base/person.base.abstract.js +17 -0
- package/dist/base/person.base.abstract.js.map +1 -0
- package/dist/base/repository/base.repository.abstract.d.ts +12 -0
- package/dist/base/repository/base.repository.abstract.js +22 -0
- package/dist/base/repository/base.repository.abstract.js.map +1 -0
- package/dist/base/repository/base.repository.interface.d.ts +9 -0
- package/dist/base/repository/base.repository.interface.js +3 -0
- package/dist/base/repository/base.repository.interface.js.map +1 -0
- package/dist/config.d.ts +34 -34
- package/dist/config.js +148 -148
- package/dist/customer/customer.d.ts +28 -27
- package/dist/customer/customer.js +65 -52
- package/dist/customer/customer.js.map +1 -1
- package/dist/customer/customer.repository.d.ts +0 -0
- package/dist/customer/customer.repository.js +1 -0
- package/dist/customer/customer.repository.js.map +1 -0
- package/dist/customer/entities/customer.entity.d.ts +13 -13
- package/dist/customer/entities/customer.entity.js +110 -110
- package/dist/customer/finance-customer.repository.d.ts +10 -10
- package/dist/customer/finance-customer.repository.js +37 -37
- package/dist/customer/finance-customer.repository.js.map +1 -1
- package/dist/customer/index.d.ts +7 -7
- package/dist/customer/index.js +9 -9
- package/dist/customer/interfaces/customer.repository.interface.d.ts +3 -3
- package/dist/customer/interfaces/customer.repository.interface.js +2 -2
- package/dist/customer/interfaces/finance-customer-attr.interface.d.ts +10 -10
- package/dist/customer/interfaces/finance-customer-attr.interface.js +2 -2
- package/dist/customer/interfaces/finance-customer.repository.interface.d.ts +3 -3
- package/dist/customer/interfaces/finance-customer.repository.interface.js +2 -2
- 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 +22 -22
- package/dist/document/document-item.js +6 -6
- package/dist/document/document-item.repository.d.ts +17 -17
- package/dist/document/document-item.repository.js +50 -50
- package/dist/document/document-item.repository.js.map +1 -1
- package/dist/document/document.d.ts +66 -44
- package/dist/document/document.js +276 -141
- package/dist/document/document.js.map +1 -1
- package/dist/document/document.repository.d.ts +16 -16
- package/dist/document/document.repository.js +46 -46
- package/dist/document/document.repository.js.map +1 -1
- package/dist/document/entities/document-item.entity.d.ts +27 -27
- package/dist/document/entities/document-item.entity.js +173 -173
- package/dist/document/entities/document.entity.d.ts +22 -22
- package/dist/document/entities/document.entity.js +138 -138
- package/dist/document/index.d.ts +11 -11
- package/dist/document/index.js +19 -19
- package/dist/document/interfaces/document-attr.interface.d.ts +25 -19
- package/dist/document/interfaces/document-attr.interface.js +6 -6
- package/dist/document/interfaces/document-attr.interface.js.map +1 -1
- package/dist/document/interfaces/document-item-attr.interface.d.ts +22 -22
- package/dist/document/interfaces/document-item-attr.interface.js +6 -6
- package/dist/document/interfaces/document-item.repository.interface.d.ts +3 -3
- package/dist/document/interfaces/document-item.repository.interface.js +2 -2
- package/dist/document/interfaces/document.repository.interface.d.ts +3 -3
- package/dist/document/interfaces/document.repository.interface.js +2 -2
- package/dist/enum/doc-type.enum.d.ts +8 -7
- package/dist/enum/doc-type.enum.js +12 -11
- package/dist/enum/doc-type.enum.js.map +1 -1
- package/dist/enum/document-status.enum.d.ts +5 -4
- package/dist/enum/document-status.enum.js +9 -8
- package/dist/enum/document-status.enum.js.map +1 -1
- package/dist/enum/document-type.enum.d.ts +7 -0
- package/dist/enum/document-type.enum.js +12 -0
- package/dist/enum/document-type.enum.js.map +1 -0
- package/dist/enum/index.d.ts +7 -7
- package/dist/enum/index.js +15 -15
- package/dist/enum/intuit-client.enum.d.ts +13 -0
- package/dist/enum/intuit-client.enum.js +19 -0
- package/dist/enum/intuit-client.enum.js.map +1 -0
- package/dist/enum/payment-method.enum.d.ts +3 -3
- package/dist/enum/payment-method.enum.js +7 -7
- package/dist/enum/payment-type.enum.d.ts +4 -4
- package/dist/enum/payment-type.enum.js +8 -8
- package/dist/enum/quick-book-client-scopes.enum.d.ts +13 -13
- package/dist/enum/quick-book-client-scopes.enum.js +18 -18
- package/dist/enum/transaction-type.enum.d.ts +4 -4
- package/dist/enum/transaction-type.enum.js +8 -8
- package/dist/finance-company/entities/finance-company.entity.d.ts +13 -0
- package/dist/finance-company/entities/finance-company.entity.js +113 -0
- package/dist/finance-company/entities/finance-company.entity.js.map +1 -0
- package/dist/finance-company/finance-company.d.ts +42 -36
- package/dist/finance-company/finance-company.entity.d.ts +13 -13
- package/dist/finance-company/finance-company.entity.js +65 -65
- package/dist/finance-company/finance-company.js +254 -210
- package/dist/finance-company/finance-company.js.map +1 -1
- package/dist/finance-company/finance-company.repository.d.ts +5 -5
- package/dist/finance-company/finance-company.repository.js +11 -12
- package/dist/finance-company/finance-company.repository.js.map +1 -1
- package/dist/finance-company/index.d.ts +3 -3
- package/dist/finance-company/index.js +7 -7
- package/dist/finance-company/interfaces/finance-company-attr.interface.d.ts +10 -0
- package/dist/finance-company/interfaces/finance-company-attr.interface.js +3 -0
- package/dist/finance-company/interfaces/finance-company-attr.interface.js.map +1 -0
- package/dist/finance-company/interfaces/finance-company.repository.interface.d.ts +3 -0
- package/dist/finance-company/interfaces/finance-company.repository.interface.js +3 -0
- package/dist/finance-company/interfaces/finance-company.repository.interface.js.map +1 -0
- package/dist/index.d.ts +12 -9
- package/dist/index.js +22 -27
- package/dist/index.js.map +1 -1
- package/dist/interfaces/account-system-entity.interface.d.ts +7 -7
- package/dist/interfaces/account-system-entity.interface.js +2 -2
- package/dist/interfaces/account-system.interface.d.ts +13 -13
- package/dist/interfaces/account-system.interface.js +2 -2
- package/dist/interfaces/customer.repository.interface.d.ts +3 -0
- package/dist/interfaces/customer.repository.interface.js +3 -0
- package/dist/interfaces/customer.repository.interface.js.map +1 -0
- package/dist/interfaces/finance-customer.repository.interface.d.ts +3 -0
- package/dist/interfaces/finance-customer.repository.interface.js +3 -0
- package/dist/interfaces/finance-customer.repository.interface.js.map +1 -0
- package/dist/interfaces/index.d.ts +2 -2
- package/dist/interfaces/index.js +2 -2
- package/dist/interfaces/systemConfig.interface.d.ts +0 -0
- package/dist/interfaces/systemConfig.interface.js +1 -0
- package/dist/interfaces/systemConfig.interface.js.map +1 -0
- package/dist/intuit-client/client.d.ts +14 -0
- package/dist/intuit-client/client.js +44 -0
- package/dist/intuit-client/client.js.map +1 -0
- package/dist/journal-entry/entities/journal-entry.entity.d.ts +16 -16
- package/dist/journal-entry/entities/journal-entry.entity.js +128 -128
- package/dist/journal-entry/index.d.ts +6 -6
- package/dist/journal-entry/index.js +9 -9
- package/dist/journal-entry/interfaces/journal-entry-attr.interface.d.ts +11 -11
- package/dist/journal-entry/interfaces/journal-entry-attr.interface.js +2 -2
- package/dist/journal-entry/interfaces/journal-entry.repository.interface.d.ts +10 -10
- package/dist/journal-entry/interfaces/journal-entry.repository.interface.js +2 -2
- package/dist/journal-entry/journal-entry.d.ts +45 -45
- package/dist/journal-entry/journal-entry.js +152 -137
- package/dist/journal-entry/journal-entry.js.map +1 -1
- package/dist/journal-entry/journal-entry.repository.d.ts +15 -15
- package/dist/journal-entry/journal-entry.repository.js +44 -44
- package/dist/journal-entry/journal-entry.repository.js.map +1 -1
- package/dist/ledger-transaction/entities/ledger-transaction.entity.d.ts +19 -19
- package/dist/ledger-transaction/entities/ledger-transaction.entity.js +156 -156
- package/dist/ledger-transaction/index.d.ts +6 -6
- package/dist/ledger-transaction/index.js +9 -9
- package/dist/ledger-transaction/interfaces/ledger-transaction-attr.interface.d.ts +18 -18
- package/dist/ledger-transaction/interfaces/ledger-transaction-attr.interface.js +2 -2
- package/dist/ledger-transaction/interfaces/ledger-transaction.repository.interface.d.ts +5 -5
- package/dist/ledger-transaction/interfaces/ledger-transaction.repository.interface.js +2 -2
- package/dist/ledger-transaction/ledger-transaction.d.ts +35 -35
- package/dist/ledger-transaction/ledger-transaction.js +83 -70
- package/dist/ledger-transaction/ledger-transaction.js.map +1 -1
- package/dist/ledger-transaction/ledger-transaction.repository.d.ts +10 -10
- package/dist/ledger-transaction/ledger-transaction.repository.js +38 -38
- 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/entities/payment-item.entity.d.ts +10 -10
- package/dist/payment/entities/payment-item.entity.js +61 -61
- package/dist/payment/entities/payment.entity.d.ts +25 -25
- package/dist/payment/entities/payment.entity.js +151 -151
- package/dist/payment/index.d.ts +10 -10
- package/dist/payment/index.js +17 -17
- package/dist/payment/interfaces/payment-attr.interface.d.ts +20 -20
- package/dist/payment/interfaces/payment-attr.interface.js +6 -6
- package/dist/payment/interfaces/payment-item-attr.interface.d.ts +7 -7
- package/dist/payment/interfaces/payment-item-attr.interface.js +6 -6
- package/dist/payment/interfaces/payment-item.repository.interface.d.ts +3 -3
- package/dist/payment/interfaces/payment-item.repository.interface.js +2 -2
- package/dist/payment/interfaces/payment-params.interface.d.ts +7 -7
- package/dist/payment/interfaces/payment-params.interface.js +2 -2
- package/dist/payment/interfaces/payment.repository.interface.d.ts +3 -3
- package/dist/payment/interfaces/payment.repository.interface.js +2 -2
- package/dist/payment/payment-item.repository.d.ts +17 -17
- package/dist/payment/payment-item.repository.js +50 -50
- package/dist/payment/payment-item.repository.js.map +1 -1
- package/dist/payment/payment.d.ts +52 -52
- package/dist/payment/payment.js +153 -138
- package/dist/payment/payment.js.map +1 -1
- package/dist/payment/payment.repository.d.ts +16 -16
- package/dist/payment/payment.repository.js +46 -46
- package/dist/payment/payment.repository.js.map +1 -1
- package/dist/quickbook-client/client.d.ts +39 -26
- package/dist/quickbook-client/client.js +204 -90
- package/dist/quickbook-client/client.js.map +1 -1
- package/dist/quickbook-client/constant.d.ts +1 -1
- package/dist/quickbook-client/constant.js +4 -4
- package/dist/quickbook-client/index.d.ts +5 -5
- package/dist/quickbook-client/index.js +5 -9
- package/dist/quickbook-client/index.js.map +1 -1
- package/dist/quickbook-client/interfaces/quickbook-client-call-options.interface.d.ts +6 -6
- package/dist/quickbook-client/interfaces/quickbook-client-call-options.interface.js +2 -2
- package/dist/quickbook-client/interfaces/quickbook-client-create-account-options.interface.d.ts +9 -0
- package/dist/quickbook-client/interfaces/quickbook-client-create-account-options.interface.js +3 -0
- package/dist/quickbook-client/interfaces/quickbook-client-create-account-options.interface.js.map +1 -0
- package/dist/quickbook-client/interfaces/quickbook-client-create-customer-options.interface.d.ts +7 -0
- package/dist/quickbook-client/interfaces/quickbook-client-create-customer-options.interface.js +3 -0
- package/dist/quickbook-client/interfaces/quickbook-client-create-customer-options.interface.js.map +1 -0
- package/dist/quickbook-client/interfaces/quickbook-client-options.interface.d.ts +8 -8
- package/dist/quickbook-client/interfaces/quickbook-client-options.interface.js +2 -2
- package/dist/quickbook-client/quickbook-client.module-definition.d.ts +2 -2
- package/dist/quickbook-client/quickbook-client.module-definition.js +8 -8
- package/dist/quickbook-client/quickbook-client.module.d.ts +6 -6
- package/dist/quickbook-client/quickbook-client.module.js +33 -33
- package/dist/test.d.ts +1 -1
- package/dist/test.js +7 -7
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/img.png +0 -0
- package/img_1.png +0 -0
- package/invoice-template/assets/css/style.css.map +12 -12
- package/invoice-template/assets/css/style.min.css +1 -1
- package/invoice-template/assets/img/arrow_bg.svg +11 -11
- package/invoice-template/assets/img/coffy_shop_img.svg +18 -18
- package/invoice-template/assets/img/logo_accent.svg +3 -3
- package/invoice-template/assets/img/logo_white.svg +4 -4
- package/invoice-template/assets/img/sign.svg +12 -12
- package/invoice-template/assets/js/html2canvas.min.js +10379 -10379
- package/invoice-template/assets/js/jquery.min.js +1 -1
- package/invoice-template/assets/sass/common/_color_variable.scss +12 -12
- package/invoice-template/assets/sass/common/_typography.scss +178 -178
- package/invoice-template/assets/sass/style.scss +12 -12
- package/migrations/finance-account-migration.js +83 -83
- package/migrations/finance-company-migration.js +43 -43
- package/migrations/finance-customer-migration.js +51 -51
- package/migrations/finance-document-item-migration.js +111 -111
- package/migrations/finance-document-migration.js +108 -77
- package/migrations/finance-payment-item-migration.js +39 -39
- package/migrations/finance-payment-migration.js +89 -89
- package/migrations/finance-post-history-migration.js +45 -45
- package/nest-cli.json +19 -19
- package/package.json +79 -76
- package/src/account/account.repository.ts +44 -44
- package/src/account/account.ts +158 -157
- package/src/account/interfaces/account-attr.interface.ts +23 -23
- package/src/account/interfaces/account.repository.interface.ts +4 -4
- package/src/account-system-entity/account-system-entity.ts +106 -102
- package/src/account-system-entity/post-history.repository.ts +11 -12
- package/src/config.ts +178 -178
- package/src/customer/customer.ts +99 -92
- package/src/customer/finance-customer.repository.ts +30 -30
- package/src/customer/interfaces/customer.repository.interface.ts +3 -3
- package/src/customer/interfaces/finance-customer-attr.interface.ts +10 -10
- package/src/customer/interfaces/finance-customer.repository.interface.ts +4 -4
- package/src/database.ts +15 -0
- package/src/document/document-item.repository.ts +49 -49
- package/src/document/document-item.ts +2 -2
- package/src/document/document.repository.ts +41 -41
- package/src/document/document.ts +281 -76
- package/src/document/interfaces/document-attr.interface.ts +26 -20
- package/src/document/interfaces/document-item-attr.interface.ts +22 -22
- package/src/document/interfaces/document-item.repository.interface.ts +4 -4
- package/src/document/interfaces/document.repository.interface.ts +4 -4
- package/src/enum/doc-type.enum.ts +8 -7
- package/src/enum/document-status.enum.ts +3 -2
- package/src/enum/index.ts +15 -15
- package/src/enum/payment-method.enum.ts +3 -3
- package/src/enum/payment-type.enum.ts +4 -4
- package/src/finance-company/finance-company.repository.ts +11 -12
- package/src/finance-company/finance-company.ts +69 -31
- package/src/index.ts +22 -9
- package/src/interfaces/account-system.interface.ts +20 -14
- package/src/interfaces/index.ts +3 -3
- 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 +171 -171
- package/src/{customer/entities → models}/customer.entity.ts +93 -93
- package/src/{document/entities → models}/document-item.entity.ts +143 -143
- package/src/models/document.entity.ts +193 -0
- package/src/{finance-company → models}/finance-company.entity.ts +41 -41
- 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 +47 -47
- package/src/{payment/entities → models}/payment.entity.ts +125 -125
- package/src/{account-system-entity → models}/post-history.entity.ts +41 -41
- package/src/payment/interfaces/payment-attr.interface.ts +21 -21
- package/src/payment/interfaces/payment-item-attr.interface.ts +7 -7
- package/src/payment/interfaces/payment-item.repository.interface.ts +4 -4
- package/src/payment/interfaces/payment-params.interface.ts +8 -8
- package/src/payment/interfaces/payment.repository.interface.ts +4 -4
- package/src/payment/payment-item.repository.ts +49 -49
- package/src/payment/payment.repository.ts +41 -41
- package/src/payment/payment.ts +204 -203
- package/tsconfig.build.json +4 -4
- package/tsconfig.json +22 -30
- package/tslint.json +18 -18
- 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,51 +1,51 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.DocumentItemRepository = void 0;
|
|
16
|
-
const common_1 = require("@nestjs/common");
|
|
17
|
-
const sequelize_1 = require("@nestjs/sequelize");
|
|
18
|
-
const general_1 = require("@tomei/general");
|
|
19
|
-
const document_item_entity_1 = require("
|
|
20
|
-
let DocumentItemRepository = class DocumentItemRepository extends general_1.BaseRepository {
|
|
21
|
-
constructor(documentItemModel) {
|
|
22
|
-
super(documentItemModel);
|
|
23
|
-
this.documentItemModel = documentItemModel;
|
|
24
|
-
}
|
|
25
|
-
create(data, options) {
|
|
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.
|
|
48
|
-
__metadata("design:paramtypes", [Object])
|
|
49
|
-
], DocumentItemRepository);
|
|
50
|
-
exports.DocumentItemRepository = DocumentItemRepository;
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.DocumentItemRepository = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const sequelize_1 = require("@nestjs/sequelize");
|
|
18
|
+
const general_1 = require("@tomei/general");
|
|
19
|
+
const document_item_entity_1 = require("../models/document-item.entity");
|
|
20
|
+
let DocumentItemRepository = class DocumentItemRepository extends general_1.BaseRepository {
|
|
21
|
+
constructor(documentItemModel) {
|
|
22
|
+
super(documentItemModel);
|
|
23
|
+
this.documentItemModel = documentItemModel;
|
|
24
|
+
}
|
|
25
|
+
create(data, options) {
|
|
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);
|
|
50
|
+
exports.DocumentItemRepository = DocumentItemRepository;
|
|
51
51
|
//# 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":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,iDAAgD;AAChD,4CAAgD;AAChD,
|
|
1
|
+
{"version":3,"file":"document-item.repository.js","sourceRoot":"","sources":["../../src/document/document-item.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAA4C;AAC5C,iDAAgD;AAChD,4CAAgD;AAChD,yEAA+D;AAKxD,IAAM,sBAAsB,GAA5B,MAAM,sBACX,SAAQ,wBAAiC;IAGzC,YAEmB,iBAA2C;QAE5D,KAAK,CAAC,iBAAiB,CAAC,CAAC;QAFR,sBAAiB,GAAjB,iBAAiB,CAA0B;IAG9D,CAAC;IAED,MAAM,CACJ,IAAuB,EACvB,OAAa;QAEb,OAAO,IAAI,CAAC,iBAAiB,CAAC,MAAM,mBAAM,IAAI,GAAI,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED,UAAU,CAAC,IAAyB,EAAE,OAAa;QACjD,MAAM,OAAO,GAAQ,CAAC,GAAG,IAAI,CAAC,CAAC;QAC/B,OAAO,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC7D,CAAC;IAED,OAAO,CAAC,OAAY;QAClB,OAAO,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC;IAED,qBAAqB,CACnB,OAAY;QAEZ,OAAO,IAAI,CAAC,iBAAiB,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACzD,CAAC;IAED,OAAO,CAAC,OAAY;QAClB,OAAO,IAAI,CAAC,iBAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACjD,CAAC;IAED,MAAM,CAAC,IAAuB,EAAE,OAAa;QAC3C,OAAO,IAAI,CAAC,iBAAiB,CAAC,MAAM,mBAAM,IAAI,GAAI,OAAO,CAAC,CAAC;IAC7D,CAAC;CACF,CAAA;AAxCY,sBAAsB;IADlC,IAAA,mBAAU,GAAE;IAMR,WAAA,IAAA,uBAAW,EAAC,8BAAiB,CAAC,CAAA;;GALtB,sBAAsB,CAwClC;AAxCY,wDAAsB"}
|
|
@@ -1,44 +1,66 @@
|
|
|
1
|
-
/// <reference types="multer" />
|
|
2
|
-
import { IBaseRepository } from '@tomei/general';
|
|
3
|
-
import { IMediasRepository, CommonService as MediaCommonService } from '@tomei/media';
|
|
4
|
-
import { DocType } from '../enum';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { AccountSystemEntity } from '../account-system-entity';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
private
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
get
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
1
|
+
/// <reference types="multer" />
|
|
2
|
+
import { IBaseRepository } from '@tomei/general';
|
|
3
|
+
import { IMediasRepository, CommonService as MediaCommonService, MediasModel } from '@tomei/media';
|
|
4
|
+
import { DocumentStatus, DocType } from '../enum';
|
|
5
|
+
import { IDocumentAttr } from './interfaces/document-attr.interface';
|
|
6
|
+
import { DocumentItemRepository } from './document-item.repository';
|
|
7
|
+
import { DocumentItem } from './document-item';
|
|
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';
|
|
11
|
+
export declare class Document extends AccountSystemEntity {
|
|
12
|
+
DocNo: string;
|
|
13
|
+
private _DocType;
|
|
14
|
+
private _DocDate;
|
|
15
|
+
Currency: string;
|
|
16
|
+
Amount: number;
|
|
17
|
+
Description: string;
|
|
18
|
+
IssuedById: string;
|
|
19
|
+
IssuedToId: string;
|
|
20
|
+
IssuedToType: string;
|
|
21
|
+
CreatedById: string;
|
|
22
|
+
CreatedAt: Date;
|
|
23
|
+
UpdatedById?: string;
|
|
24
|
+
UpdatedAt?: Date;
|
|
25
|
+
UseAccSystemDocYN: string;
|
|
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;
|
|
34
|
+
private IsNewRecord;
|
|
35
|
+
private _DocumentItems;
|
|
36
|
+
documentRepository: IDocumentRepository;
|
|
37
|
+
documentItemRepository: DocumentItemRepository;
|
|
38
|
+
mediaRepository: IMediasRepository;
|
|
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);
|
|
55
|
+
get DocumentItems(): any;
|
|
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>;
|
|
60
|
+
init(params: IDocumentAttr): void;
|
|
61
|
+
generateInvoice(userId?: string): Promise<{
|
|
62
|
+
HTMLMedia: MediasModel;
|
|
63
|
+
PDFMedia: MediasModel;
|
|
64
|
+
}>;
|
|
65
|
+
newDocumentItem(): Promise<DocumentItem>;
|
|
66
|
+
}
|
|
@@ -1,142 +1,277 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
|
|
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
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Document = void 0;
|
|
13
|
+
const util = require("util");
|
|
14
|
+
const fs = require("fs");
|
|
15
|
+
const puppeteer_1 = require("puppeteer");
|
|
16
|
+
const general_1 = require("@tomei/general");
|
|
17
|
+
const media_1 = require("@tomei/media");
|
|
18
|
+
const enum_1 = require("../enum");
|
|
19
|
+
const document_item_1 = require("./document-item");
|
|
20
|
+
const account_system_entity_1 = require("../account-system-entity/account-system-entity");
|
|
21
|
+
const document_entity_1 = require("../models/document.entity");
|
|
22
|
+
class Document extends account_system_entity_1.AccountSystemEntity {
|
|
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;
|
|
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
|
+
}
|
|
105
|
+
}
|
|
106
|
+
get DocumentItems() {
|
|
107
|
+
if (this._DocumentItems === null) {
|
|
108
|
+
if (!this.IsNewRecord) {
|
|
109
|
+
this.documentItemRepository
|
|
110
|
+
.findAll({
|
|
111
|
+
where: {
|
|
112
|
+
DocNo: this.DocNo,
|
|
113
|
+
},
|
|
114
|
+
})
|
|
115
|
+
.then((allDocumentItems) => {
|
|
116
|
+
this._DocumentItems = allDocumentItems;
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return this._DocumentItems;
|
|
121
|
+
}
|
|
122
|
+
static DEFAULT_INVOICE_TEMPLATE_HTML() {
|
|
123
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
124
|
+
const HTMLTemplateFilePath = './invoice-template/index.html';
|
|
125
|
+
const readFileContent = util.promisify(fs.readFile);
|
|
126
|
+
const htmlBuffer = yield readFileContent(HTMLTemplateFilePath);
|
|
127
|
+
const htmlStream = {
|
|
128
|
+
buffer: htmlBuffer,
|
|
129
|
+
fieldname: 'FileStream',
|
|
130
|
+
originalname: 'index.html',
|
|
131
|
+
mimetype: 'text/html',
|
|
132
|
+
size: htmlBuffer.length,
|
|
133
|
+
encoding: '8bit',
|
|
134
|
+
filename: 'sample-invoice.html',
|
|
135
|
+
destination: '',
|
|
136
|
+
path: '',
|
|
137
|
+
stream: null,
|
|
138
|
+
};
|
|
139
|
+
return htmlStream;
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
static DEFAULT_INVOICE_TEMPLATE_PDF() {
|
|
143
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
144
|
+
const HTMLTemplateFilePath = './invoice-template/index.html';
|
|
145
|
+
const readFileContent = util.promisify(fs.readFile);
|
|
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
|
+
});
|
|
170
|
+
const pdfStream = {
|
|
171
|
+
buffer: pdfBuffer,
|
|
172
|
+
fieldname: 'FileStream',
|
|
173
|
+
originalname: 'sample-invoice.pdf',
|
|
174
|
+
mimetype: 'application/pdf',
|
|
175
|
+
size: pdfBuffer.length,
|
|
176
|
+
encoding: '8bit',
|
|
177
|
+
filename: 'sample-invoice.pdf',
|
|
178
|
+
destination: '',
|
|
179
|
+
path: '',
|
|
180
|
+
stream: null,
|
|
181
|
+
};
|
|
182
|
+
return pdfStream;
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
get DocumentFileInHTML() {
|
|
186
|
+
return (() => __awaiter(this, void 0, void 0, function* () {
|
|
187
|
+
const { HTMLMedia } = yield this.generateInvoice();
|
|
188
|
+
return HTMLMedia;
|
|
189
|
+
}))();
|
|
190
|
+
}
|
|
191
|
+
get DocumentFileInPDF() {
|
|
192
|
+
return (() => __awaiter(this, void 0, void 0, function* () {
|
|
193
|
+
const { PDFMedia } = yield this.generateInvoice();
|
|
194
|
+
return PDFMedia;
|
|
195
|
+
}))();
|
|
196
|
+
}
|
|
197
|
+
init(params) {
|
|
198
|
+
this.DocNo = params.DocNo;
|
|
199
|
+
this.DocType = params.DocType;
|
|
200
|
+
this.DocDate = params.DocDate;
|
|
201
|
+
this.CompanyId = params.CompanyId;
|
|
202
|
+
this.Currency = params.Currency;
|
|
203
|
+
this.Amount = params.Amount;
|
|
204
|
+
this.Description = params.Description;
|
|
205
|
+
this.Status = params.Status;
|
|
206
|
+
this.IssuedById = params.IssuedById;
|
|
207
|
+
this.IssuedToId = params.IssuedToId;
|
|
208
|
+
this.IssuedToType = params.IssuedToType;
|
|
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;
|
|
216
|
+
this.PostedToAccSystemYN = params.PostedToAccSystemYN;
|
|
217
|
+
this.PostedById = params.PostedById;
|
|
218
|
+
this.PostedDateTime = params.PostedDateTime;
|
|
219
|
+
this.UseAccSystemDocYN = params.UseAccSystemDocYN;
|
|
220
|
+
}
|
|
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
|
+
});
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
exports.Document = Document;
|
|
142
277
|
//# sourceMappingURL=document.js.map
|