shutro-erp 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -10
- package/dist/account_portal/.kosh/bindings.d.ts +22 -0
- package/dist/account_portal/.kosh/bindings.js +15 -0
- package/dist/account_portal/.kosh/schema.d.ts +1350 -0
- package/dist/account_portal/index.d.ts +3 -0
- package/dist/account_portal/index.js +73 -0
- package/dist/account_portal/module.d.ts +5983 -0
- package/dist/account_portal/module.js +18 -0
- package/dist/accounting/.kosh/bindings.js +1 -1
- package/dist/accounting/.kosh/schema.d.ts +142 -9
- package/dist/accounting/chart.d.ts +40 -8
- package/dist/accounting/chart.js +124 -30
- package/dist/accounting/closing.d.ts +6 -1
- package/dist/accounting/closing.js +5 -1
- package/dist/accounting/demo.js +6 -5
- package/dist/accounting/index.d.ts +3 -3
- package/dist/accounting/index.js +200 -23
- package/dist/accounting/module.d.ts +3326 -1086
- package/dist/accounting/module.js +408 -66
- package/dist/accounting/payments.d.ts +25 -0
- package/dist/accounting/payments.js +96 -4
- package/dist/accounting/web/RegisterPayment.d.ts +3 -2
- package/dist/accounting/web/RegisterPayment.js +39 -6
- package/dist/accounting/web/SettingsPage.js +5 -1
- package/dist/accounting/web/messages.js +10 -0
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/init.d.ts +5 -0
- package/dist/cli/init.js +195 -53
- package/dist/cli/launch.d.ts +16 -0
- package/dist/cli/launch.js +138 -0
- package/dist/cli/prompt.d.ts +35 -0
- package/dist/cli/prompt.js +46 -0
- package/dist/cli/templates.d.ts +11 -3
- package/dist/cli/templates.js +32 -7
- package/dist/cli/tui.d.ts +7 -0
- package/dist/cli/tui.js +254 -0
- package/dist/cli/ui.d.ts +25 -5
- package/dist/cli/ui.js +49 -9
- package/dist/contacts/.kosh/bindings.js +1 -1
- package/dist/contacts/.kosh/schema.d.ts +3 -1
- package/dist/contacts/index.js +24 -1
- package/dist/contacts/module.d.ts +42 -0
- package/dist/contacts/module.js +3 -1
- package/dist/import/convert.d.ts +55 -0
- package/dist/import/convert.js +224 -0
- package/dist/import/csv.d.ts +28 -0
- package/dist/import/csv.js +115 -0
- package/dist/import/index.d.ts +33 -0
- package/dist/import/index.js +60 -0
- package/dist/import/mapping.d.ts +15 -0
- package/dist/import/mapping.js +33 -0
- package/dist/import/match.d.ts +24 -0
- package/dist/import/match.js +60 -0
- package/dist/import/models.d.ts +2 -0
- package/dist/import/models.js +102 -0
- package/dist/import/routes.d.ts +13 -0
- package/dist/import/routes.js +392 -0
- package/dist/import/run.d.ts +131 -0
- package/dist/import/run.js +568 -0
- package/dist/import/service.d.ts +153 -0
- package/dist/import/service.js +367 -0
- package/dist/import/web/ImportButton.d.ts +7 -0
- package/dist/import/web/ImportButton.js +31 -0
- package/dist/import/web/ImportWizard.d.ts +75 -0
- package/dist/import/web/ImportWizard.js +217 -0
- package/dist/import/web/index.d.ts +13 -0
- package/dist/import/web/index.js +18 -0
- package/dist/import/web/messages.d.ts +2 -0
- package/dist/import/web/messages.js +139 -0
- package/dist/import/worker.d.ts +3 -0
- package/dist/import/worker.js +52 -0
- package/dist/import/xlsx.d.ts +20 -0
- package/dist/import/xlsx.js +192 -0
- package/dist/l10n_bd/.kosh/bindings.d.ts +22 -0
- package/dist/l10n_bd/.kosh/bindings.js +15 -0
- package/dist/l10n_bd/.kosh/schema.d.ts +1281 -0
- package/dist/l10n_bd/documents.d.ts +8 -0
- package/dist/l10n_bd/documents.js +183 -0
- package/dist/l10n_bd/index.d.ts +8 -0
- package/dist/l10n_bd/index.js +156 -0
- package/dist/l10n_bd/module.d.ts +5705 -0
- package/dist/l10n_bd/module.js +163 -0
- package/dist/l10n_bd/mushak.d.ts +67 -0
- package/dist/l10n_bd/mushak.js +139 -0
- package/dist/l10n_bd/routes.d.ts +3 -0
- package/dist/l10n_bd/routes.js +205 -0
- package/dist/l10n_bd/web/MushakPage.d.ts +7 -0
- package/dist/l10n_bd/web/MushakPage.js +53 -0
- package/dist/l10n_bd/web/index.d.ts +13 -0
- package/dist/l10n_bd/web/index.js +18 -0
- package/dist/l10n_bd/web/messages.d.ts +2 -0
- package/dist/l10n_bd/web/messages.js +101 -0
- package/dist/l10n_in/.kosh/bindings.d.ts +22 -0
- package/dist/l10n_in/.kosh/bindings.js +15 -0
- package/dist/l10n_in/.kosh/schema.d.ts +1343 -0
- package/dist/l10n_in/documents.d.ts +8 -0
- package/dist/l10n_in/documents.js +114 -0
- package/dist/l10n_in/einvoice.d.ts +253 -0
- package/dist/l10n_in/einvoice.js +485 -0
- package/dist/l10n_in/gstr.d.ts +109 -0
- package/dist/l10n_in/gstr.js +430 -0
- package/dist/l10n_in/index.d.ts +20 -0
- package/dist/l10n_in/index.js +232 -0
- package/dist/l10n_in/module.d.ts +7823 -0
- package/dist/l10n_in/module.js +427 -0
- package/dist/l10n_in/routes-einvoice.d.ts +15 -0
- package/dist/l10n_in/routes-einvoice.js +124 -0
- package/dist/l10n_in/routes.d.ts +17 -0
- package/dist/l10n_in/routes.js +282 -0
- package/dist/l10n_in/web/EInvoicePanel.d.ts +8 -0
- package/dist/l10n_in/web/EInvoicePanel.js +63 -0
- package/dist/l10n_in/web/GstPage.d.ts +7 -0
- package/dist/l10n_in/web/GstPage.js +57 -0
- package/dist/l10n_in/web/GstSettings.d.ts +10 -0
- package/dist/l10n_in/web/GstSettings.js +36 -0
- package/dist/l10n_in/web/index.d.ts +15 -0
- package/dist/l10n_in/web/index.js +22 -0
- package/dist/l10n_in/web/messages.d.ts +2 -0
- package/dist/l10n_in/web/messages.js +166 -0
- package/dist/modules-sdk/demo.d.ts +2 -0
- package/dist/modules-sdk/demo.js +7 -3
- package/dist/modules-sdk/index.d.ts +2 -2
- package/dist/modules-sdk/index.js +1 -1
- package/dist/modules-sdk/manifest.d.ts +132 -0
- package/dist/modules-sdk/manifest.js +22 -0
- package/dist/notify/inbox.js +21 -0
- package/dist/notify/messages.js +4 -0
- package/dist/notify/models.d.ts +1 -1
- package/dist/notify/models.js +2 -0
- package/dist/notify/web/messages.js +4 -0
- package/dist/portal/.kosh/bindings.d.ts +22 -0
- package/dist/portal/.kosh/bindings.js +15 -0
- package/dist/portal/.kosh/schema.d.ts +346 -0
- package/dist/portal/announce.d.ts +16 -0
- package/dist/portal/announce.js +117 -0
- package/dist/portal/documents.d.ts +17 -0
- package/dist/portal/documents.js +61 -0
- package/dist/portal/index.d.ts +20 -0
- package/dist/portal/index.js +65 -0
- package/dist/portal/module.d.ts +1405 -0
- package/dist/portal/module.js +84 -0
- package/dist/portal/routes-documents.d.ts +2 -0
- package/dist/portal/routes-documents.js +391 -0
- package/dist/portal/routes.d.ts +13 -0
- package/dist/portal/routes.js +313 -0
- package/dist/portal/rules.d.ts +11 -0
- package/dist/portal/rules.js +25 -0
- package/dist/portal/web/PortalAccess.d.ts +8 -0
- package/dist/portal/web/PortalAccess.js +66 -0
- package/dist/portal/web/index.d.ts +12 -0
- package/dist/portal/web/index.js +17 -0
- package/dist/portal/web/messages.d.ts +2 -0
- package/dist/portal/web/messages.js +33 -0
- package/dist/product/.kosh/bindings.js +1 -1
- package/dist/product/.kosh/schema.d.ts +12 -3
- package/dist/product/demo.js +6 -5
- package/dist/product/index.d.ts +1 -0
- package/dist/product/index.js +17 -4
- package/dist/product/module.d.ts +346 -14
- package/dist/product/module.js +48 -18
- package/dist/product/taxes.d.ts +59 -0
- package/dist/product/taxes.js +61 -0
- package/dist/project/.kosh/bindings.js +1 -1
- package/dist/project/.kosh/schema.d.ts +3 -1
- package/dist/project/module.d.ts +20 -0
- package/dist/project_portal/.kosh/bindings.d.ts +22 -0
- package/dist/project_portal/.kosh/bindings.js +15 -0
- package/dist/project_portal/.kosh/schema.d.ts +671 -0
- package/dist/project_portal/index.d.ts +9 -0
- package/dist/project_portal/index.js +42 -0
- package/dist/project_portal/module.d.ts +2142 -0
- package/dist/project_portal/module.js +22 -0
- package/dist/purchase/.kosh/bindings.js +1 -1
- package/dist/purchase/.kosh/schema.d.ts +15 -4
- package/dist/purchase/demo.js +3 -3
- package/dist/purchase/index.js +1 -1
- package/dist/purchase/module.d.ts +232 -8
- package/dist/purchase/module.js +51 -9
- package/dist/purchase_account/.kosh/bindings.js +1 -1
- package/dist/purchase_account/.kosh/schema.d.ts +144 -10
- package/dist/purchase_account/module.d.ts +2008 -641
- package/dist/purchase_account/module.js +2 -2
- package/dist/purchase_portal/.kosh/bindings.d.ts +22 -0
- package/dist/purchase_portal/.kosh/bindings.js +15 -0
- package/dist/purchase_portal/.kosh/schema.d.ts +822 -0
- package/dist/purchase_portal/index.d.ts +9 -0
- package/dist/purchase_portal/index.js +53 -0
- package/dist/purchase_portal/module.d.ts +2758 -0
- package/dist/purchase_portal/module.js +18 -0
- package/dist/reporting/documents.js +20 -3
- package/dist/reporting/index.d.ts +1 -0
- package/dist/reporting/index.js +1 -0
- package/dist/reporting/routes-documents.js +9 -2
- package/dist/reporting/words.d.ts +11 -0
- package/dist/reporting/words.js +229 -0
- package/dist/sale_account/.kosh/bindings.js +1 -1
- package/dist/sale_account/.kosh/schema.d.ts +144 -10
- package/dist/sale_account/module.d.ts +2008 -641
- package/dist/sale_account/module.js +3 -3
- package/dist/sale_portal/.kosh/bindings.d.ts +22 -0
- package/dist/sale_portal/.kosh/bindings.js +15 -0
- package/dist/sale_portal/.kosh/schema.d.ts +736 -0
- package/dist/sale_portal/index.d.ts +9 -0
- package/dist/sale_portal/index.js +71 -0
- package/dist/sale_portal/module.d.ts +2718 -0
- package/dist/sale_portal/module.js +19 -0
- package/dist/sale_project/.kosh/bindings.js +1 -1
- package/dist/sale_project/.kosh/schema.d.ts +15 -4
- package/dist/sale_project/module.d.ts +390 -10
- package/dist/sales/.kosh/bindings.js +1 -1
- package/dist/sales/.kosh/schema.d.ts +15 -4
- package/dist/sales/demo.js +3 -3
- package/dist/sales/index.js +67 -1
- package/dist/sales/module.d.ts +232 -8
- package/dist/sales/module.js +51 -12
- package/dist/server/auth/base.js +2 -0
- package/dist/server/auth/service.d.ts +2 -0
- package/dist/server/auth/service.js +7 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/server.js +26 -1
- package/dist/ui/api.d.ts +2 -0
- package/dist/ui/app.js +1 -1
- package/dist/ui/context.d.ts +3 -1
- package/dist/ui/context.js +2 -2
- package/dist/ui/index.d.ts +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/ui/lib/format.d.ts +2 -0
- package/dist/ui/lib/format.js +3 -1
- package/dist/ui/views/FormView.js +19 -6
- package/package.json +50 -2
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The GST documents (RFC 0016 step 5), as document templates (RFC 0005): the tax invoice with what rule 46 of the
|
|
3
|
+
* CGST Rules asks for — supplier and recipient with their GSTIN, the place of supply, each line's HSN / SAC, taxable
|
|
4
|
+
* value, rate and CGST / SGST / IGST / cess, whether tax is payable under reverse charge, the total in words — and
|
|
5
|
+
* the credit and debit notes. The company's to change in the designer.
|
|
6
|
+
*/
|
|
7
|
+
import type { DocumentSpec } from '../modules-sdk/index.js';
|
|
8
|
+
export declare const GST_DOCUMENTS: readonly DocumentSpec[];
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
const parties = {
|
|
2
|
+
kind: 'columns',
|
|
3
|
+
id: 'parties',
|
|
4
|
+
left: [
|
|
5
|
+
{
|
|
6
|
+
kind: 'fields',
|
|
7
|
+
id: 'supplier',
|
|
8
|
+
items: [
|
|
9
|
+
{ label: 'Supplier', bind: 'company.name' },
|
|
10
|
+
{ label: 'GSTIN', bind: 'company.gstin' },
|
|
11
|
+
{ label: 'State', bind: 'company.state' },
|
|
12
|
+
],
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
right: [
|
|
16
|
+
{
|
|
17
|
+
kind: 'fields',
|
|
18
|
+
id: 'recipient',
|
|
19
|
+
items: [
|
|
20
|
+
{ label: 'Recipient', bind: 'partner.name' },
|
|
21
|
+
{ label: 'GSTIN', bind: 'partner.gstin' },
|
|
22
|
+
{ label: 'Address', bind: 'partner.street' },
|
|
23
|
+
{ label: 'City', bind: 'partner.city' },
|
|
24
|
+
{ label: 'State', bind: 'partner.state' },
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
};
|
|
29
|
+
const lines = {
|
|
30
|
+
kind: 'table',
|
|
31
|
+
id: 'lines',
|
|
32
|
+
bind: 'invoiceLines',
|
|
33
|
+
columns: [
|
|
34
|
+
{ label: 'Description', bind: 'name' },
|
|
35
|
+
{ label: 'HSN / SAC', bind: 'product.hsnCode' },
|
|
36
|
+
{ label: 'Qty', bind: 'quantity', align: 'end' },
|
|
37
|
+
{ label: 'Rate', bind: 'priceUnit', align: 'end' },
|
|
38
|
+
{ label: 'Taxable value', bind: 'subtotal', align: 'end', sum: true },
|
|
39
|
+
{ label: 'GST %', bind: 'gstRate', align: 'end' },
|
|
40
|
+
{ label: 'CGST', bind: 'cgstAmount', align: 'end', sum: true },
|
|
41
|
+
{ label: 'SGST', bind: 'sgstAmount', align: 'end', sum: true },
|
|
42
|
+
{ label: 'IGST', bind: 'igstAmount', align: 'end', sum: true },
|
|
43
|
+
{ label: 'Cess', bind: 'cessAmount', align: 'end', sum: true },
|
|
44
|
+
{ label: 'Total', bind: 'totalWithGst', align: 'end', sum: true },
|
|
45
|
+
],
|
|
46
|
+
};
|
|
47
|
+
const totals = {
|
|
48
|
+
kind: 'fields',
|
|
49
|
+
id: 'totals',
|
|
50
|
+
columns: 3,
|
|
51
|
+
items: [
|
|
52
|
+
{ label: 'Taxable value', bind: 'amountUntaxed' },
|
|
53
|
+
{ label: 'GST and cess', bind: 'amountTax' },
|
|
54
|
+
{ label: 'Total', bind: 'amountTotal' },
|
|
55
|
+
],
|
|
56
|
+
};
|
|
57
|
+
const signature = {
|
|
58
|
+
kind: 'signature',
|
|
59
|
+
id: 'signature',
|
|
60
|
+
labels: ['For the supplier: authorised signatory'],
|
|
61
|
+
};
|
|
62
|
+
const document = (key, name, title, extra) => ({
|
|
63
|
+
key,
|
|
64
|
+
name,
|
|
65
|
+
model: 'account.move',
|
|
66
|
+
layout: {
|
|
67
|
+
paper: 'A4',
|
|
68
|
+
orientation: 'landscape',
|
|
69
|
+
header: '{{company.name}} · GSTIN {{company.gstin}}',
|
|
70
|
+
footer: `${title} · Page {{page}} of {{pages}}`,
|
|
71
|
+
blocks: [
|
|
72
|
+
{ kind: 'heading', id: 'title', text: title, level: 1 },
|
|
73
|
+
// Once registered with the IRP (e-invoicing): the IRN and its acknowledgement.
|
|
74
|
+
{
|
|
75
|
+
kind: 'fields',
|
|
76
|
+
id: 'irn',
|
|
77
|
+
columns: 3,
|
|
78
|
+
items: [
|
|
79
|
+
{ label: 'IRN', bind: 'irn' },
|
|
80
|
+
{ label: 'Ack. no.', bind: 'irnAckNo' },
|
|
81
|
+
{ label: 'Ack. date', bind: 'irnAckDate' },
|
|
82
|
+
],
|
|
83
|
+
},
|
|
84
|
+
parties,
|
|
85
|
+
{
|
|
86
|
+
kind: 'fields',
|
|
87
|
+
id: 'document',
|
|
88
|
+
columns: 3,
|
|
89
|
+
items: [
|
|
90
|
+
{ label: 'Number', bind: 'name' },
|
|
91
|
+
{ label: 'Date', bind: 'date' },
|
|
92
|
+
{ label: 'Place of supply', bind: 'placeOfSupply' },
|
|
93
|
+
{ label: 'Tax payable on reverse charge', bind: 'gstReverseCharge' },
|
|
94
|
+
...extra,
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
lines,
|
|
98
|
+
totals,
|
|
99
|
+
{ kind: 'text', id: 'in_words', text: 'In words: {{amountTotal|words}}' },
|
|
100
|
+
signature,
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
export const GST_DOCUMENTS = [
|
|
105
|
+
document('gst_tax_invoice', 'Tax invoice (GST)', 'Tax invoice', []),
|
|
106
|
+
document('gst_credit_note', 'Credit note (GST)', 'Credit note', [
|
|
107
|
+
{ label: 'Against invoice', bind: 'reversalOf.name' },
|
|
108
|
+
{ label: 'Reason', bind: 'ref' },
|
|
109
|
+
]),
|
|
110
|
+
document('gst_debit_note', 'Debit note (GST)', 'Debit note', [
|
|
111
|
+
{ label: 'Against invoice', bind: 'debitOf.name' },
|
|
112
|
+
{ label: 'Reason', bind: 'ref' },
|
|
113
|
+
]),
|
|
114
|
+
];
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import type { Env } from './.kosh/bindings.js';
|
|
2
|
+
/** An item of the IRP payload. */
|
|
3
|
+
export interface EInvoiceItem {
|
|
4
|
+
readonly SlNo: string;
|
|
5
|
+
readonly PrdDesc: string;
|
|
6
|
+
readonly IsServc: 'Y' | 'N';
|
|
7
|
+
readonly HsnCd: string;
|
|
8
|
+
readonly Qty: number;
|
|
9
|
+
readonly Unit: string;
|
|
10
|
+
readonly UnitPrice: number;
|
|
11
|
+
readonly TotAmt: number;
|
|
12
|
+
readonly Discount: number;
|
|
13
|
+
readonly AssAmt: number;
|
|
14
|
+
readonly GstRt: number;
|
|
15
|
+
readonly IgstAmt: number;
|
|
16
|
+
readonly CgstAmt: number;
|
|
17
|
+
readonly SgstAmt: number;
|
|
18
|
+
readonly CesAmt: number;
|
|
19
|
+
readonly TotItemVal: number;
|
|
20
|
+
}
|
|
21
|
+
/** The IRP's e-invoice schema (version 1.1), as far as Kosh fills it. */
|
|
22
|
+
export interface EInvoicePayload {
|
|
23
|
+
readonly Version: '1.1';
|
|
24
|
+
readonly TranDtls: {
|
|
25
|
+
readonly TaxSch: 'GST';
|
|
26
|
+
readonly SupTyp: 'B2B' | 'EXPWP' | 'EXPWOP';
|
|
27
|
+
readonly RegRev: 'Y' | 'N';
|
|
28
|
+
readonly IgstOnIntra: 'N';
|
|
29
|
+
};
|
|
30
|
+
readonly DocDtls: {
|
|
31
|
+
readonly Typ: 'INV' | 'CRN' | 'DBN';
|
|
32
|
+
readonly No: string;
|
|
33
|
+
readonly Dt: string;
|
|
34
|
+
};
|
|
35
|
+
readonly SellerDtls: {
|
|
36
|
+
readonly Gstin: string;
|
|
37
|
+
readonly LglNm: string;
|
|
38
|
+
readonly Addr1: string;
|
|
39
|
+
readonly Loc: string;
|
|
40
|
+
readonly Pin: number;
|
|
41
|
+
readonly Stcd: string;
|
|
42
|
+
};
|
|
43
|
+
readonly BuyerDtls: {
|
|
44
|
+
readonly Gstin: string;
|
|
45
|
+
readonly LglNm: string;
|
|
46
|
+
readonly Pos: string;
|
|
47
|
+
readonly Addr1: string;
|
|
48
|
+
readonly Loc: string;
|
|
49
|
+
readonly Pin: number;
|
|
50
|
+
readonly Stcd: string;
|
|
51
|
+
};
|
|
52
|
+
readonly ItemList: readonly EInvoiceItem[];
|
|
53
|
+
readonly ValDtls: {
|
|
54
|
+
readonly AssVal: number;
|
|
55
|
+
readonly CgstVal: number;
|
|
56
|
+
readonly SgstVal: number;
|
|
57
|
+
readonly IgstVal: number;
|
|
58
|
+
readonly CesVal: number;
|
|
59
|
+
readonly TotInvVal: number;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/** The e-way bill: part A from the invoice, part B the transport. */
|
|
63
|
+
export interface EwayBillPayload {
|
|
64
|
+
readonly supplyType: 'O';
|
|
65
|
+
readonly docType: 'INV' | 'CHL';
|
|
66
|
+
readonly docNo: string;
|
|
67
|
+
readonly docDate: string;
|
|
68
|
+
readonly fromGstin: string;
|
|
69
|
+
readonly fromPincode: number;
|
|
70
|
+
readonly fromStateCode: number;
|
|
71
|
+
readonly toGstin: string;
|
|
72
|
+
readonly toPincode: number;
|
|
73
|
+
readonly toStateCode: number;
|
|
74
|
+
readonly totInvValue: number;
|
|
75
|
+
readonly transMode: '1' | '2' | '3' | '4';
|
|
76
|
+
readonly transDistance: number;
|
|
77
|
+
readonly transporterId: string;
|
|
78
|
+
readonly vehicleNo: string;
|
|
79
|
+
/** The IRN, when the invoice was e-invoiced. */
|
|
80
|
+
readonly irn?: string;
|
|
81
|
+
}
|
|
82
|
+
/** What a provider answers, or refuses with {@link GstProviderError}. */
|
|
83
|
+
export interface GstProvider {
|
|
84
|
+
readonly name: string;
|
|
85
|
+
registerInvoice(payload: EInvoicePayload): Promise<{
|
|
86
|
+
irn: string;
|
|
87
|
+
ackNo: string;
|
|
88
|
+
ackDate: string;
|
|
89
|
+
signedQr: string;
|
|
90
|
+
}>;
|
|
91
|
+
cancelInvoice(seller: string, irn: string, reason: string, remark: string): Promise<{
|
|
92
|
+
cancelledAt: string;
|
|
93
|
+
}>;
|
|
94
|
+
generateEwayBill(payload: EwayBillPayload): Promise<{
|
|
95
|
+
ewbNo: string;
|
|
96
|
+
ewbDate: string;
|
|
97
|
+
validUntil: string;
|
|
98
|
+
}>;
|
|
99
|
+
cancelEwayBill(seller: string, ewbNo: string, reason: string, remark: string): Promise<{
|
|
100
|
+
cancelledAt: string;
|
|
101
|
+
}>;
|
|
102
|
+
}
|
|
103
|
+
/** A refusal of the IRP or the e-way bill system: its code and message, kept on the document. */
|
|
104
|
+
export declare class GstProviderError extends Error {
|
|
105
|
+
readonly code: string;
|
|
106
|
+
constructor(code: string, message: string);
|
|
107
|
+
}
|
|
108
|
+
/** The financial year (April–March) of `iso` as the IRN uses it: `2026-27`. */
|
|
109
|
+
export declare function financialYear(iso: string): string;
|
|
110
|
+
/** The IRN of a document: SHA-256 of the seller's GSTIN, the financial year, the document type and number. */
|
|
111
|
+
export declare function irnOf(gstin: string, docType: string, docNo: string, iso: string): string;
|
|
112
|
+
/** A provider answering like the IRP and the e-way bill system, in memory (tests, demonstrations). */
|
|
113
|
+
export declare function createFakeGstProvider(now?: () => Date): GstProvider & {
|
|
114
|
+
readonly invoices: Map<string, {
|
|
115
|
+
cancelled: boolean;
|
|
116
|
+
ackDate: string;
|
|
117
|
+
}>;
|
|
118
|
+
};
|
|
119
|
+
/** The provider the environment names (`KOSH_GST_PROVIDER=fake`), or none: e-invoicing is then unavailable. */
|
|
120
|
+
export declare function gstProviderFromEnv(env?: NodeJS.ProcessEnv): GstProvider | undefined;
|
|
121
|
+
/** A document's payload for the IRP, or the reasons the IRP would refuse it. */
|
|
122
|
+
export declare function einvoicePayload(env: Env, id: number): Promise<{
|
|
123
|
+
payload: EInvoicePayload | null;
|
|
124
|
+
problems: string[];
|
|
125
|
+
seller: string;
|
|
126
|
+
}>;
|
|
127
|
+
/** The state of a document's e-invoice and e-way bill (what the screen shows). */
|
|
128
|
+
export declare function einvoiceState(env: Env, id: number): Promise<{
|
|
129
|
+
status: "cancelled" | "failed" | "registered" | null;
|
|
130
|
+
irn: string | null;
|
|
131
|
+
ackNo: string | null;
|
|
132
|
+
ackDate: Date | null;
|
|
133
|
+
signedQr: string | null;
|
|
134
|
+
cancelledAt: Date | null;
|
|
135
|
+
error: string | null;
|
|
136
|
+
ewayBill: {
|
|
137
|
+
status: "cancelled" | "failed" | "generated" | null;
|
|
138
|
+
number: string | null;
|
|
139
|
+
date: Date | null;
|
|
140
|
+
validUntil: Date | null;
|
|
141
|
+
vehicleNo: string | null;
|
|
142
|
+
transporterId: string | null;
|
|
143
|
+
distanceKm: number | null;
|
|
144
|
+
mode: "air" | "rail" | "road" | "ship" | null;
|
|
145
|
+
error: string | null;
|
|
146
|
+
};
|
|
147
|
+
}>;
|
|
148
|
+
/**
|
|
149
|
+
* Registers a document with the IRP. The document must be readable and the user may post (the right to e-invoice
|
|
150
|
+
* goes with it). A refusal, here or by the IRP, is kept on the document and answered with 422.
|
|
151
|
+
*/
|
|
152
|
+
export declare function registerEInvoice(env: Env, provider: GstProvider | undefined, id: number): Promise<{
|
|
153
|
+
status: "cancelled" | "failed" | "registered" | null;
|
|
154
|
+
irn: string | null;
|
|
155
|
+
ackNo: string | null;
|
|
156
|
+
ackDate: Date | null;
|
|
157
|
+
signedQr: string | null;
|
|
158
|
+
cancelledAt: Date | null;
|
|
159
|
+
error: string | null;
|
|
160
|
+
ewayBill: {
|
|
161
|
+
status: "cancelled" | "failed" | "generated" | null;
|
|
162
|
+
number: string | null;
|
|
163
|
+
date: Date | null;
|
|
164
|
+
validUntil: Date | null;
|
|
165
|
+
vehicleNo: string | null;
|
|
166
|
+
transporterId: string | null;
|
|
167
|
+
distanceKm: number | null;
|
|
168
|
+
mode: "air" | "rail" | "road" | "ship" | null;
|
|
169
|
+
error: string | null;
|
|
170
|
+
};
|
|
171
|
+
}>;
|
|
172
|
+
/** The IRP's reasons to cancel an IRN. */
|
|
173
|
+
export declare const CANCEL_REASONS: Readonly<Record<string, string>>;
|
|
174
|
+
/** Cancels a document's IRN, within 24 hours of its acknowledgement. The document itself is reversed separately. */
|
|
175
|
+
export declare function cancelEInvoice(env: Env, provider: GstProvider | undefined, id: number, reason: string, remark: string): Promise<{
|
|
176
|
+
status: "cancelled" | "failed" | "registered" | null;
|
|
177
|
+
irn: string | null;
|
|
178
|
+
ackNo: string | null;
|
|
179
|
+
ackDate: Date | null;
|
|
180
|
+
signedQr: string | null;
|
|
181
|
+
cancelledAt: Date | null;
|
|
182
|
+
error: string | null;
|
|
183
|
+
ewayBill: {
|
|
184
|
+
status: "cancelled" | "failed" | "generated" | null;
|
|
185
|
+
number: string | null;
|
|
186
|
+
date: Date | null;
|
|
187
|
+
validUntil: Date | null;
|
|
188
|
+
vehicleNo: string | null;
|
|
189
|
+
transporterId: string | null;
|
|
190
|
+
distanceKm: number | null;
|
|
191
|
+
mode: "air" | "rail" | "road" | "ship" | null;
|
|
192
|
+
error: string | null;
|
|
193
|
+
};
|
|
194
|
+
}>;
|
|
195
|
+
declare const MODES: {
|
|
196
|
+
readonly road: '1';
|
|
197
|
+
readonly rail: '2';
|
|
198
|
+
readonly air: '3';
|
|
199
|
+
readonly ship: '4';
|
|
200
|
+
};
|
|
201
|
+
/** Generates the e-way bill of a posted invoice with its transport (part B). */
|
|
202
|
+
export declare function generateEwayBill(env: Env, provider: GstProvider | undefined, id: number, transport: {
|
|
203
|
+
readonly mode: keyof typeof MODES;
|
|
204
|
+
readonly distanceKm: number;
|
|
205
|
+
readonly vehicleNo: string;
|
|
206
|
+
readonly transporterId?: string | undefined;
|
|
207
|
+
}): Promise<{
|
|
208
|
+
status: "cancelled" | "failed" | "registered" | null;
|
|
209
|
+
irn: string | null;
|
|
210
|
+
ackNo: string | null;
|
|
211
|
+
ackDate: Date | null;
|
|
212
|
+
signedQr: string | null;
|
|
213
|
+
cancelledAt: Date | null;
|
|
214
|
+
error: string | null;
|
|
215
|
+
ewayBill: {
|
|
216
|
+
status: "cancelled" | "failed" | "generated" | null;
|
|
217
|
+
number: string | null;
|
|
218
|
+
date: Date | null;
|
|
219
|
+
validUntil: Date | null;
|
|
220
|
+
vehicleNo: string | null;
|
|
221
|
+
transporterId: string | null;
|
|
222
|
+
distanceKm: number | null;
|
|
223
|
+
mode: "air" | "rail" | "road" | "ship" | null;
|
|
224
|
+
error: string | null;
|
|
225
|
+
};
|
|
226
|
+
}>;
|
|
227
|
+
/** Cancels an e-way bill within 24 hours of its generation. */
|
|
228
|
+
export declare function cancelEwayBill(env: Env, provider: GstProvider | undefined, id: number, reason: string, remark: string): Promise<{
|
|
229
|
+
status: "cancelled" | "failed" | "registered" | null;
|
|
230
|
+
irn: string | null;
|
|
231
|
+
ackNo: string | null;
|
|
232
|
+
ackDate: Date | null;
|
|
233
|
+
signedQr: string | null;
|
|
234
|
+
cancelledAt: Date | null;
|
|
235
|
+
error: string | null;
|
|
236
|
+
ewayBill: {
|
|
237
|
+
status: "cancelled" | "failed" | "generated" | null;
|
|
238
|
+
number: string | null;
|
|
239
|
+
date: Date | null;
|
|
240
|
+
validUntil: Date | null;
|
|
241
|
+
vehicleNo: string | null;
|
|
242
|
+
transporterId: string | null;
|
|
243
|
+
distanceKm: number | null;
|
|
244
|
+
mode: "air" | "rail" | "road" | "ship" | null;
|
|
245
|
+
error: string | null;
|
|
246
|
+
};
|
|
247
|
+
}>;
|
|
248
|
+
/**
|
|
249
|
+
* After posting (`account.move.posted`): customer documents of companies with e-invoicing on are registered, those
|
|
250
|
+
* to registered recipients and abroad; a refusal stays on the document for the user to fix and retry.
|
|
251
|
+
*/
|
|
252
|
+
export declare function registerPosted(env: Env, provider: GstProvider, id: number): Promise<void>;
|
|
253
|
+
export {};
|