@hisaabo/cli 0.5.0 → 0.7.5
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/.turbo/turbo-typecheck.log +1 -1
- package/dist/bin/{audit-trail-5LOCJ7XZ.js → audit-trail-DLSSSM4T.js} +3 -3
- package/dist/bin/{categories-64WWZTND.js → categories-63QR6WCV.js} +2 -2
- package/dist/bin/{check-slug-FLHHUDYS.js → check-slug-NXO55WKH.js} +2 -2
- package/dist/bin/{chunk-FIMJZAS4.js → chunk-7MJDOL6B.js} +18 -1
- package/dist/bin/{chunk-4MEL44QX.js → chunk-M42SETRZ.js} +243 -0
- package/dist/bin/{chunk-T63VQXNM.js → chunk-ZPYC767N.js} +1 -0
- package/dist/bin/{client-5NZ23GML.js → client-T32CIZA3.js} +1 -1
- package/dist/bin/{collection-efficiency-U56XNVEE.js → collection-efficiency-T6PWNTZO.js} +3 -3
- package/dist/bin/{config-335MN4I7.js → config-V4QFCONN.js} +3 -1
- package/dist/bin/{create-RPDEORDD.js → create-NUKHDWLK.js} +2 -2
- package/dist/bin/{default-account-AE6EXZZR.js → default-account-JWFPHMRF.js} +2 -2
- package/dist/bin/{expenses-5N2QSG54.js → expenses-2UWUZVLI.js} +3 -3
- package/dist/bin/{export-QICOQK34.js → export-XSX7WQH7.js} +2 -2
- package/dist/bin/{factory-KOCW2AQM.js → factory-BWOKRIP4.js} +3 -3
- package/dist/bin/{get-A43QCI2S.js → get-CHNTG3IM.js} +2 -2
- package/dist/bin/{get-GWH6S5SJ.js → get-ZSZ6SL3N.js} +3 -3
- package/dist/bin/hisaabo.js +901 -59
- package/dist/bin/{invitations-P3EEN5WI.js → invitations-H2SL3XAD.js} +2 -2
- package/dist/bin/{invite-T3CKX53E.js → invite-EW73UIBE.js} +2 -2
- package/dist/bin/{invoice-breakdown-FN5BEFJD.js → invoice-breakdown-XP4QATCF.js} +3 -3
- package/dist/bin/{items-2OOCQKVF.js → items-DPD6EFTP.js} +3 -3
- package/dist/bin/{items-toggle-SKZWCGJH.js → items-toggle-R4OPSE4W.js} +2 -2
- package/dist/bin/{list-T74SN6IR.js → list-KLEHBMQ2.js} +2 -2
- package/dist/bin/{list-A2RKI3ZG.js → list-PKHBE475.js} +3 -3
- package/dist/bin/{list-NRMBMKMI.js → list-UR7OOJVF.js} +2 -2
- package/dist/bin/{members-W2GW3ODT.js → members-XA3TF4IQ.js} +3 -3
- package/dist/bin/{monthly-comparison-T34ZFOHL.js → monthly-comparison-OLVS5HEY.js} +3 -3
- package/dist/bin/{order-cancel-TI27JYYD.js → order-cancel-MXMJFFRR.js} +2 -2
- package/dist/bin/{order-confirm-VMRAMNTD.js → order-confirm-IXU45Q4L.js} +2 -2
- package/dist/bin/{order-get-C2RBUR4O.js → order-get-RDXMHLJ7.js} +3 -3
- package/dist/bin/{order-update-RE3HATNF.js → order-update-KGIPBEJX.js} +3 -3
- package/dist/bin/{payment-modes-WOOT22I7.js → payment-modes-CZL35SVS.js} +3 -3
- package/dist/bin/{profit-loss-T4RESJ32.js → profit-loss-M332OSC5.js} +3 -3
- package/dist/bin/{receivables-aging-6XMENEWS.js → receivables-aging-OXRHGMBF.js} +3 -3
- package/dist/bin/{remove-6QZI4JCY.js → remove-I5HD2Y4K.js} +2 -2
- package/dist/bin/{revoke-AVEMPAC7.js → revoke-MFLWGCMP.js} +2 -2
- package/dist/bin/{revoke-YUCFZFNR.js → revoke-OC6AOMIZ.js} +2 -2
- package/dist/bin/{revoke-all-LFW5WBHO.js → revoke-all-FSAPBB3P.js} +2 -2
- package/dist/bin/{revoke-invitation-DTGQRJR4.js → revoke-invitation-JXDPXTOW.js} +2 -2
- package/dist/bin/{sales-trend-ZYBRUDUU.js → sales-trend-KK63WNDL.js} +3 -3
- package/dist/bin/{sequence-FPOJTI2P.js → sequence-IQ4HUJ3W.js} +2 -2
- package/dist/bin/{store-IOB4Y67C.js → store-6QT6HKG2.js} +3 -3
- package/dist/bin/{summary-5KYBA4ZO.js → summary-3FTF5B4A.js} +3 -3
- package/dist/bin/{top-customers-WSQ2UEJL.js → top-customers-HNYGXBQZ.js} +3 -3
- package/dist/bin/{top-items-RWQPDGLN.js → top-items-JUDG3BVW.js} +3 -3
- package/dist/bin/{top-outstanding-QAMO2E7Y.js → top-outstanding-WK26ZNE5.js} +3 -3
- package/dist/bin/{unpaid-invoices-WB3TK5B4.js → unpaid-invoices-RYFIIIK7.js} +3 -3
- package/dist/bin/{untracked-H733MYJL.js → untracked-FAFS3KCK.js} +3 -3
- package/dist/bin/{update-TLBUIC5J.js → update-5YSPXIWO.js} +3 -3
- package/dist/bin/{update-H6LPO2Z4.js → update-I46XLU77.js} +2 -2
- package/dist/bin/{update-JU2X3XU5.js → update-NAW2JWZS.js} +3 -3
- package/dist/bin/{update-role-QST7BVFX.js → update-role-5GV42MSN.js} +2 -2
- package/dist/bin/{update-settings-Q2EGRLKZ.js → update-settings-KYSQDIEO.js} +2 -2
- package/package.json +1 -1
- package/src/bin/hisaabo.ts +10 -0
- package/src/bin/registrars/bank-recon.ts +34 -0
- package/src/bin/registrars/einvoice.ts +46 -0
- package/src/bin/registrars/ewb.ts +37 -0
- package/src/bin/registrars/gst.ts +17 -1
- package/src/bin/registrars/itc.ts +56 -0
- package/src/bin/registrars/journal.ts +47 -0
- package/src/bin/registrars/report.ts +44 -0
- package/src/client.ts +269 -1
- package/src/commands/bank-recon/index.ts +127 -0
- package/src/commands/einvoice/index.ts +109 -0
- package/src/commands/ewb/index.ts +108 -0
- package/src/commands/gst/index.ts +79 -1
- package/src/commands/invoice/get.ts +9 -1
- package/src/commands/itc/index.ts +163 -0
- package/src/commands/journal/index.ts +156 -0
- package/src/commands/report/index.ts +171 -0
- package/src/config.ts +24 -0
- package/src/format.ts +1 -0
package/dist/bin/hisaabo.js
CHANGED
|
@@ -11,18 +11,18 @@ import {
|
|
|
11
11
|
monthStart,
|
|
12
12
|
quarterRange,
|
|
13
13
|
todayISO
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-ZPYC767N.js";
|
|
15
15
|
import {
|
|
16
16
|
HisaaboApiError,
|
|
17
17
|
HisaaboClient
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-M42SETRZ.js";
|
|
19
19
|
import {
|
|
20
20
|
clearConfig,
|
|
21
21
|
getConfig,
|
|
22
22
|
getConfigPath,
|
|
23
23
|
requireAuth,
|
|
24
24
|
setConfig
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-7MJDOL6B.js";
|
|
26
26
|
import {
|
|
27
27
|
EXIT,
|
|
28
28
|
fatalError,
|
|
@@ -390,19 +390,19 @@ function registerAuthCommands(program2) {
|
|
|
390
390
|
function registerDashboardCommands(program2) {
|
|
391
391
|
const dash = program2.command("dashboard").alias("dash").description("Business dashboard & analytics");
|
|
392
392
|
dash.command("summary").description("Financial summary overview (FY to date)").option("--json", "JSON output").action(async (opts) => {
|
|
393
|
-
const { dashboardCommand } = await import("./summary-
|
|
393
|
+
const { dashboardCommand } = await import("./summary-3FTF5B4A.js");
|
|
394
394
|
await dashboardCommand({ json: opts.json });
|
|
395
395
|
});
|
|
396
396
|
dash.command("sales-trend").description("Sales trend over time").option("--months <n>", "Number of months to show", (v) => parseInt(v, 10)).option("--from <date>", "Start date (YYYY-MM-DD)").option("--to <date>", "End date (YYYY-MM-DD)").option("--granularity <g>", "daily | weekly | monthly").option("--json", "JSON output").option("--format <format>", "table | tsv | csv").action(async (opts) => {
|
|
397
|
-
const { dashboardSalesTrendCommand } = await import("./sales-trend-
|
|
397
|
+
const { dashboardSalesTrendCommand } = await import("./sales-trend-KK63WNDL.js");
|
|
398
398
|
await dashboardSalesTrendCommand(opts);
|
|
399
399
|
});
|
|
400
400
|
dash.command("top-outstanding").description("Parties with highest outstanding balances").option("--limit <n>", "Max rows to show", (v) => parseInt(v, 10)).option("--json", "JSON output").option("--format <format>", "table | tsv | csv").action(async (opts) => {
|
|
401
|
-
const { dashboardTopOutstandingCommand } = await import("./top-outstanding-
|
|
401
|
+
const { dashboardTopOutstandingCommand } = await import("./top-outstanding-WK26ZNE5.js");
|
|
402
402
|
await dashboardTopOutstandingCommand(opts);
|
|
403
403
|
});
|
|
404
404
|
dash.command("top-customers").description("Top customers by revenue").option("--limit <n>", "Max rows to show", (v) => parseInt(v, 10)).option("--from <date>", "Start date (YYYY-MM-DD)").option("--to <date>", "End date (YYYY-MM-DD)").option("--this-month", "Filter to current calendar month").option("--this-fy", "Filter to current financial year").option("--json", "JSON output").option("--format <format>", "table | tsv | csv").action(async (opts) => {
|
|
405
|
-
const { dashboardTopCustomersCommand } = await import("./top-customers-
|
|
405
|
+
const { dashboardTopCustomersCommand } = await import("./top-customers-HNYGXBQZ.js");
|
|
406
406
|
await dashboardTopCustomersCommand({
|
|
407
407
|
limit: opts.limit,
|
|
408
408
|
from: opts.from,
|
|
@@ -414,7 +414,7 @@ function registerDashboardCommands(program2) {
|
|
|
414
414
|
});
|
|
415
415
|
});
|
|
416
416
|
dash.command("top-items").description("Top selling items by revenue and quantity").option("--limit <n>", "Max rows to show", (v) => parseInt(v, 10)).option("--type <type>", "Item type filter (product | service)").option("--from <date>", "Start date (YYYY-MM-DD)").option("--to <date>", "End date (YYYY-MM-DD)").option("--this-month", "Filter to current calendar month").option("--this-fy", "Filter to current financial year").option("--json", "JSON output").option("--format <format>", "table | tsv | csv").action(async (opts) => {
|
|
417
|
-
const { dashboardTopItemsCommand } = await import("./top-items-
|
|
417
|
+
const { dashboardTopItemsCommand } = await import("./top-items-JUDG3BVW.js");
|
|
418
418
|
await dashboardTopItemsCommand({
|
|
419
419
|
limit: opts.limit,
|
|
420
420
|
type: opts.type,
|
|
@@ -427,7 +427,7 @@ function registerDashboardCommands(program2) {
|
|
|
427
427
|
});
|
|
428
428
|
});
|
|
429
429
|
const expensesCmd = dash.command("expenses").description("Expenses broken down by category").option("--from <date>", "Start date (YYYY-MM-DD)").option("--to <date>", "End date (YYYY-MM-DD)").option("--this-month", "Filter to current calendar month").option("--this-fy", "Filter to current financial year").option("--json", "JSON output").option("--format <format>", "table | tsv | csv").action(async (opts) => {
|
|
430
|
-
const { dashboardExpensesCommand } = await import("./expenses-
|
|
430
|
+
const { dashboardExpensesCommand } = await import("./expenses-2UWUZVLI.js");
|
|
431
431
|
await dashboardExpensesCommand({
|
|
432
432
|
from: opts.from,
|
|
433
433
|
to: opts.to,
|
|
@@ -439,7 +439,7 @@ function registerDashboardCommands(program2) {
|
|
|
439
439
|
});
|
|
440
440
|
expensesCmd.alias("expenses-by-category");
|
|
441
441
|
dash.command("invoice-breakdown").description("Invoice count and amounts by status").option("--from <date>", "Start date (YYYY-MM-DD)").option("--to <date>", "End date (YYYY-MM-DD)").option("--this-month", "Filter to current calendar month").option("--this-fy", "Filter to current financial year").option("--json", "JSON output").action(async (opts) => {
|
|
442
|
-
const { dashboardInvoiceBreakdownCommand } = await import("./invoice-breakdown-
|
|
442
|
+
const { dashboardInvoiceBreakdownCommand } = await import("./invoice-breakdown-XP4QATCF.js");
|
|
443
443
|
await dashboardInvoiceBreakdownCommand({
|
|
444
444
|
from: opts.from,
|
|
445
445
|
to: opts.to,
|
|
@@ -449,7 +449,7 @@ function registerDashboardCommands(program2) {
|
|
|
449
449
|
});
|
|
450
450
|
});
|
|
451
451
|
const plCmd = dash.command("profit-loss").description("Profit & Loss statement").option("--from <date>", "Start date (YYYY-MM-DD, default: FY start)").option("--to <date>", "End date (YYYY-MM-DD, default: today)").option("--this-month", "Scope to current calendar month").option("--this-fy", "Scope to current financial year").option("--json", "JSON output").action(async (opts) => {
|
|
452
|
-
const { dashboardProfitLossCommand } = await import("./profit-loss-
|
|
452
|
+
const { dashboardProfitLossCommand } = await import("./profit-loss-M332OSC5.js");
|
|
453
453
|
await dashboardProfitLossCommand({
|
|
454
454
|
from: opts.from,
|
|
455
455
|
to: opts.to,
|
|
@@ -460,11 +460,11 @@ function registerDashboardCommands(program2) {
|
|
|
460
460
|
});
|
|
461
461
|
plCmd.alias("pl");
|
|
462
462
|
dash.command("receivables-aging").description("Receivables aging buckets (current / 1-30 / 31-60 / 61-90 / 90+)").option("--json", "JSON output").option("--format <format>", "table | tsv | csv").action(async (opts) => {
|
|
463
|
-
const { dashboardReceivablesAgingCommand } = await import("./receivables-aging-
|
|
463
|
+
const { dashboardReceivablesAgingCommand } = await import("./receivables-aging-OXRHGMBF.js");
|
|
464
464
|
await dashboardReceivablesAgingCommand({ json: opts.json, format: opts.format });
|
|
465
465
|
});
|
|
466
466
|
dash.command("payment-modes").description("Payment mode breakdown (cash / UPI / bank transfer / etc.)").option("--from <date>", "Start date (YYYY-MM-DD)").option("--to <date>", "End date (YYYY-MM-DD)").option("--this-month", "Filter to current calendar month").option("--this-fy", "Filter to current financial year").option("--json", "JSON output").option("--format <format>", "table | tsv | csv").action(async (opts) => {
|
|
467
|
-
const { dashboardPaymentModesCommand } = await import("./payment-modes-
|
|
467
|
+
const { dashboardPaymentModesCommand } = await import("./payment-modes-CZL35SVS.js");
|
|
468
468
|
await dashboardPaymentModesCommand({
|
|
469
469
|
from: opts.from,
|
|
470
470
|
to: opts.to,
|
|
@@ -475,7 +475,7 @@ function registerDashboardCommands(program2) {
|
|
|
475
475
|
});
|
|
476
476
|
});
|
|
477
477
|
dash.command("collection-efficiency").description("Collection rate, DSO, and aging breakdown").option("--from <date>", "Start date (YYYY-MM-DD)").option("--to <date>", "End date (YYYY-MM-DD)").option("--this-month", "Filter to current calendar month").option("--this-fy", "Filter to current financial year").option("--json", "JSON output").option("--format <format>", "table | tsv | csv").action(async (opts) => {
|
|
478
|
-
const { dashboardCollectionEfficiencyCommand } = await import("./collection-efficiency-
|
|
478
|
+
const { dashboardCollectionEfficiencyCommand } = await import("./collection-efficiency-T6PWNTZO.js");
|
|
479
479
|
await dashboardCollectionEfficiencyCommand({
|
|
480
480
|
from: opts.from,
|
|
481
481
|
to: opts.to,
|
|
@@ -486,7 +486,7 @@ function registerDashboardCommands(program2) {
|
|
|
486
486
|
});
|
|
487
487
|
});
|
|
488
488
|
dash.command("monthly-comparison").description("Month-over-month comparison of sales, expenses, profit, and collections").option("--json", "JSON output").option("--format <format>", "table | tsv | csv").action(async (opts) => {
|
|
489
|
-
const { dashboardMonthlyComparisonCommand } = await import("./monthly-comparison-
|
|
489
|
+
const { dashboardMonthlyComparisonCommand } = await import("./monthly-comparison-OLVS5HEY.js");
|
|
490
490
|
await dashboardMonthlyComparisonCommand({ json: opts.json, format: opts.format });
|
|
491
491
|
});
|
|
492
492
|
}
|
|
@@ -670,7 +670,12 @@ async function invoiceGetCommand(id, opts) {
|
|
|
670
670
|
`);
|
|
671
671
|
line2(`Total:`, (hasColor() ? chalk.bold(formatAmount(inv.totalAmount)) : formatAmount(inv.totalAmount)).padStart(16));
|
|
672
672
|
line2(`Paid:`, formatAmount(inv.amountPaid).padStart(16));
|
|
673
|
-
|
|
673
|
+
if (inv.totalAdjusted && parseFloat(inv.totalAdjusted) > 0)
|
|
674
|
+
line2(`Adjusted:`, ("-" + formatAmount(inv.totalAdjusted)).padStart(16));
|
|
675
|
+
const balance = inv.totalAdjusted && parseFloat(inv.totalAdjusted) > 0 ? String(parseFloat(inv.totalAmount) - parseFloat(inv.amountPaid) - parseFloat(inv.totalAdjusted)) : inv.balanceDue;
|
|
676
|
+
line2(`Balance:`, formatAmount(balance).padStart(16));
|
|
677
|
+
if (inv.status === "adjusted")
|
|
678
|
+
line2(`(Settled via credit note / sales return)`);
|
|
674
679
|
if (inv.notes || inv.termsAndConditions) {
|
|
675
680
|
divider2();
|
|
676
681
|
if (inv.notes) line2(`Notes: ${inv.notes}`);
|
|
@@ -1813,11 +1818,11 @@ function registerPaymentCommands(program2) {
|
|
|
1813
1818
|
await paymentDeleteCommand(id, { yes: opts.yes, json: opts.json });
|
|
1814
1819
|
});
|
|
1815
1820
|
payment.command("get <id>").description("Get payment details").option("--json", "JSON output").action(async (id, opts) => {
|
|
1816
|
-
const { paymentGetCommand } = await import("./get-
|
|
1821
|
+
const { paymentGetCommand } = await import("./get-ZSZ6SL3N.js");
|
|
1817
1822
|
await paymentGetCommand(id, { json: opts.json });
|
|
1818
1823
|
});
|
|
1819
1824
|
payment.command("update <id>").description("Update a payment").option("--amount <amount>", "New amount").option("--mode <mode>", "Payment mode: cash, upi, bank, cheque, other").option("--date <YYYY-MM-DD>", "Payment date").option("--reference <ref>", "Reference number (empty string to clear)").option("--notes <text>", "Notes (empty string to clear)").option("--json", "JSON output").action(async (id, opts) => {
|
|
1820
|
-
const { paymentUpdateCommand } = await import("./update-
|
|
1825
|
+
const { paymentUpdateCommand } = await import("./update-NAW2JWZS.js");
|
|
1821
1826
|
await paymentUpdateCommand(id, {
|
|
1822
1827
|
json: opts.json,
|
|
1823
1828
|
amount: opts.amount,
|
|
@@ -1828,11 +1833,11 @@ function registerPaymentCommands(program2) {
|
|
|
1828
1833
|
});
|
|
1829
1834
|
});
|
|
1830
1835
|
payment.command("unpaid-invoices <partyId>").description("List unpaid invoices for a party").option("--json", "JSON output").option("--format <format>", "Output format: table, tsv, csv").action(async (partyId, opts) => {
|
|
1831
|
-
const { paymentUnpaidInvoicesCommand } = await import("./unpaid-invoices-
|
|
1836
|
+
const { paymentUnpaidInvoicesCommand } = await import("./unpaid-invoices-RYFIIIK7.js");
|
|
1832
1837
|
await paymentUnpaidInvoicesCommand(partyId, { json: opts.json, format: opts.format });
|
|
1833
1838
|
});
|
|
1834
1839
|
payment.command("untracked").description("List payments not linked to a bank account").option("--page <n>", "Page number", parseInt).option("--limit <n>", "Items per page", parseInt).option("--json", "JSON output").option("--format <format>", "Output format: table, tsv, csv").action(async (opts) => {
|
|
1835
|
-
const { paymentUntrackedCommand } = await import("./untracked-
|
|
1840
|
+
const { paymentUntrackedCommand } = await import("./untracked-FAFS3KCK.js");
|
|
1836
1841
|
await paymentUntrackedCommand({
|
|
1837
1842
|
json: opts.json,
|
|
1838
1843
|
format: opts.format,
|
|
@@ -1841,7 +1846,7 @@ function registerPaymentCommands(program2) {
|
|
|
1841
1846
|
});
|
|
1842
1847
|
});
|
|
1843
1848
|
payment.command("default-account").description("Show recommended bank account for payments").option("--party-id <id>", "Party UUID to scope recommendation").option("--json", "JSON output").action(async (opts) => {
|
|
1844
|
-
const { paymentDefaultAccountCommand } = await import("./default-account-
|
|
1849
|
+
const { paymentDefaultAccountCommand } = await import("./default-account-JWFPHMRF.js");
|
|
1845
1850
|
await paymentDefaultAccountCommand({ json: opts.json, partyId: opts.partyId });
|
|
1846
1851
|
});
|
|
1847
1852
|
}
|
|
@@ -1980,7 +1985,7 @@ function registerExpenseCommands(program2) {
|
|
|
1980
1985
|
await expenseDeleteCommand(id, { yes: opts.yes, json: opts.json });
|
|
1981
1986
|
});
|
|
1982
1987
|
expense.command("update <id>").description("Update an expense").option("--amount <amount>", "New amount").option("--category <cat>", "Expense category").option("--date <YYYY-MM-DD>", "Expense date").option("--description <text>", "Description").option("--payment-mode <mode>", "Payment mode: cash, upi, bank, cheque, other").option("--reference <ref>", "Reference number").option("--json", "JSON output").action(async (id, opts) => {
|
|
1983
|
-
const { expenseUpdateCommand } = await import("./update-
|
|
1988
|
+
const { expenseUpdateCommand } = await import("./update-5YSPXIWO.js");
|
|
1984
1989
|
await expenseUpdateCommand(id, {
|
|
1985
1990
|
json: opts.json,
|
|
1986
1991
|
amount: opts.amount,
|
|
@@ -1992,7 +1997,7 @@ function registerExpenseCommands(program2) {
|
|
|
1992
1997
|
});
|
|
1993
1998
|
});
|
|
1994
1999
|
expense.command("categories").description("List all expense categories").option("--json", "JSON output").action(async (opts) => {
|
|
1995
|
-
const { expenseCategoriesCommand } = await import("./categories-
|
|
2000
|
+
const { expenseCategoriesCommand } = await import("./categories-63QR6WCV.js");
|
|
1996
2001
|
await expenseCategoriesCommand({ json: opts.json });
|
|
1997
2002
|
});
|
|
1998
2003
|
}
|
|
@@ -2091,6 +2096,71 @@ async function gstR1CsvCommand(opts) {
|
|
|
2091
2096
|
fatalError(String(e instanceof Error ? e.message : e));
|
|
2092
2097
|
}
|
|
2093
2098
|
}
|
|
2099
|
+
async function gstR9Command(financialYear, opts) {
|
|
2100
|
+
const cfg = requireAuth();
|
|
2101
|
+
const client = new HisaaboClient(cfg);
|
|
2102
|
+
try {
|
|
2103
|
+
const report = await client.gst.gstr9({ financialYear });
|
|
2104
|
+
if (opts.json) {
|
|
2105
|
+
outputJSON(report);
|
|
2106
|
+
return;
|
|
2107
|
+
}
|
|
2108
|
+
console.log(`
|
|
2109
|
+
GSTR-9 Annual Return \u2014 FY ${financialYear}`);
|
|
2110
|
+
console.log(` ${"\u2550".repeat(60)}
|
|
2111
|
+
`);
|
|
2112
|
+
const r = report;
|
|
2113
|
+
if (r["summary"] && typeof r["summary"] === "object") {
|
|
2114
|
+
const s = r["summary"];
|
|
2115
|
+
if (s["totalTurnover"]) console.log(` Total Turnover: ${formatAmount(String(s["totalTurnover"]))}`);
|
|
2116
|
+
if (s["totalTax"]) console.log(` Total Tax: ${formatAmount(String(s["totalTax"]))}`);
|
|
2117
|
+
if (s["totalITC"]) console.log(` Total ITC: ${formatAmount(String(s["totalITC"]))}`);
|
|
2118
|
+
}
|
|
2119
|
+
console.log();
|
|
2120
|
+
console.log(" Use --json for full GSTR-9 data.\n");
|
|
2121
|
+
} catch (e) {
|
|
2122
|
+
if (e instanceof HisaaboApiError) {
|
|
2123
|
+
const err = e.hisaaboError;
|
|
2124
|
+
if (err.code === "unauthorized") fatalError("Session expired. Run: hisaabo login", EXIT.AUTH);
|
|
2125
|
+
if (err.code === "network_error") fatalError(err.message, EXIT.NETWORK);
|
|
2126
|
+
}
|
|
2127
|
+
fatalError(String(e instanceof Error ? e.message : e));
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2130
|
+
async function gstr2bUploadsCommand(opts) {
|
|
2131
|
+
const cfg = requireAuth();
|
|
2132
|
+
const client = new HisaaboClient(cfg);
|
|
2133
|
+
try {
|
|
2134
|
+
const result = await client.gst.gstr2bUploads();
|
|
2135
|
+
if (opts.json) {
|
|
2136
|
+
outputJSON(result);
|
|
2137
|
+
return;
|
|
2138
|
+
}
|
|
2139
|
+
const uploads = Array.isArray(result) ? result : Array.isArray(result?.data) ? result.data : [];
|
|
2140
|
+
console.log("\n GSTR-2B Uploads\n");
|
|
2141
|
+
console.log(` ${"\u2550".repeat(60)}
|
|
2142
|
+
`);
|
|
2143
|
+
if (uploads.length === 0) {
|
|
2144
|
+
console.log(" No uploads found.\n");
|
|
2145
|
+
return;
|
|
2146
|
+
}
|
|
2147
|
+
for (const up of uploads) {
|
|
2148
|
+
const id = String(up["id"] ?? "-").slice(0, 8);
|
|
2149
|
+
const period = String(up["period"] ?? up["returnPeriod"] ?? "-").padEnd(10);
|
|
2150
|
+
const date = formatDate(String(up["uploadedAt"] ?? up["createdAt"] ?? ""));
|
|
2151
|
+
const records = String(up["totalRecords"] ?? up["records"] ?? "-").padStart(8);
|
|
2152
|
+
console.log(` ${id} ${period} ${date.padEnd(13)} Records: ${records}`);
|
|
2153
|
+
}
|
|
2154
|
+
console.log();
|
|
2155
|
+
} catch (e) {
|
|
2156
|
+
if (e instanceof HisaaboApiError) {
|
|
2157
|
+
const err = e.hisaaboError;
|
|
2158
|
+
if (err.code === "unauthorized") fatalError("Session expired. Run: hisaabo login", EXIT.AUTH);
|
|
2159
|
+
if (err.code === "network_error") fatalError(err.message, EXIT.NETWORK);
|
|
2160
|
+
}
|
|
2161
|
+
fatalError(String(e instanceof Error ? e.message : e));
|
|
2162
|
+
}
|
|
2163
|
+
}
|
|
2094
2164
|
|
|
2095
2165
|
// src/bin/registrars/gst.ts
|
|
2096
2166
|
function registerGstCommands(program2) {
|
|
@@ -2104,6 +2174,12 @@ function registerGstCommands(program2) {
|
|
|
2104
2174
|
gst.command("r1-csv").description("Download GSTR-1 as GSTN-compatible CSV").option("--quarter <q>", "Quarter").option("--month <n>", "Month", parseInt).option("--year <n>", "Year", parseInt).option("--output <path>", "Output file path").action(async (opts) => {
|
|
2105
2175
|
await gstR1CsvCommand({ quarter: opts.quarter, month: opts.month, year: opts.year, output: opts.output });
|
|
2106
2176
|
});
|
|
2177
|
+
gst.command("gstr9 <fy>").description("GSTR-9 annual return (e.g. 2023-24)").option("--json", "JSON output").action(async (fy, opts) => {
|
|
2178
|
+
await gstR9Command(fy, { json: opts.json });
|
|
2179
|
+
});
|
|
2180
|
+
gst.command("gstr2b-uploads").description("List GSTR-2B uploaded periods").option("--json", "JSON output").action(async (opts) => {
|
|
2181
|
+
await gstr2bUploadsCommand({ json: opts.json });
|
|
2182
|
+
});
|
|
2107
2183
|
}
|
|
2108
2184
|
|
|
2109
2185
|
// src/commands/report/index.ts
|
|
@@ -2514,6 +2590,149 @@ async function reportCashFlowCommand(opts) {
|
|
|
2514
2590
|
fatalError(String(e instanceof Error ? e.message : e));
|
|
2515
2591
|
}
|
|
2516
2592
|
}
|
|
2593
|
+
async function reportTrialBalanceCommand(opts) {
|
|
2594
|
+
const cfg = requireAuth();
|
|
2595
|
+
const client = new HisaaboClient(cfg);
|
|
2596
|
+
const { from: _from, to } = resolveRange(opts);
|
|
2597
|
+
try {
|
|
2598
|
+
const result = await client.reports.trialBalance({ asOfDate: to });
|
|
2599
|
+
if (opts.json) {
|
|
2600
|
+
outputJSON(result);
|
|
2601
|
+
return;
|
|
2602
|
+
}
|
|
2603
|
+
console.log(`
|
|
2604
|
+
Trial Balance as of ${to}
|
|
2605
|
+
`);
|
|
2606
|
+
console.log(` ${"\u2550".repeat(70)}
|
|
2607
|
+
`);
|
|
2608
|
+
const rows = Array.isArray(result?.accounts) ? result.accounts : Array.isArray(result?.rows) ? result.rows : Array.isArray(result) ? result : [];
|
|
2609
|
+
for (const row of rows) {
|
|
2610
|
+
const name = String(row["accountName"] ?? row["name"] ?? "-").padEnd(30);
|
|
2611
|
+
const debit = String(row["debit"] ?? "0");
|
|
2612
|
+
const credit = String(row["credit"] ?? "0");
|
|
2613
|
+
const dr = parseFloat(debit) !== 0 ? formatAmount(debit) : "-";
|
|
2614
|
+
const cr = parseFloat(credit) !== 0 ? formatAmount(credit) : "-";
|
|
2615
|
+
console.log(` ${name} ${dr.padStart(14)} ${cr.padStart(14)}`);
|
|
2616
|
+
}
|
|
2617
|
+
console.log();
|
|
2618
|
+
} catch (e) {
|
|
2619
|
+
if (e instanceof HisaaboApiError) {
|
|
2620
|
+
const err = e.hisaaboError;
|
|
2621
|
+
if (err.code === "unauthorized") fatalError("Session expired. Run: hisaabo login", EXIT.AUTH);
|
|
2622
|
+
if (err.code === "network_error") fatalError(err.message, EXIT.NETWORK);
|
|
2623
|
+
}
|
|
2624
|
+
fatalError(String(e instanceof Error ? e.message : e));
|
|
2625
|
+
}
|
|
2626
|
+
}
|
|
2627
|
+
async function reportBalanceSheetCommand(opts) {
|
|
2628
|
+
const cfg = requireAuth();
|
|
2629
|
+
const client = new HisaaboClient(cfg);
|
|
2630
|
+
const { to } = resolveRange(opts);
|
|
2631
|
+
try {
|
|
2632
|
+
const result = await client.reports.balanceSheet({ asOfDate: to });
|
|
2633
|
+
if (opts.json) {
|
|
2634
|
+
outputJSON(result);
|
|
2635
|
+
return;
|
|
2636
|
+
}
|
|
2637
|
+
const r = result;
|
|
2638
|
+
console.log(`
|
|
2639
|
+
Balance Sheet as of ${to}
|
|
2640
|
+
`);
|
|
2641
|
+
console.log(` ${"\u2550".repeat(60)}
|
|
2642
|
+
`);
|
|
2643
|
+
const assets = String(r["totalAssets"] ?? r["assets"] ?? "0");
|
|
2644
|
+
const liabilities = String(r["totalLiabilities"] ?? r["liabilities"] ?? "0");
|
|
2645
|
+
const equity = String(r["totalEquity"] ?? r["equity"] ?? "0");
|
|
2646
|
+
console.log(` Total Assets: ${formatAmount(assets).padStart(14)}`);
|
|
2647
|
+
console.log(` Total Liabilities: ${formatAmount(liabilities).padStart(14)}`);
|
|
2648
|
+
console.log(` Total Equity: ${formatAmount(equity).padStart(14)}`);
|
|
2649
|
+
console.log();
|
|
2650
|
+
console.log(" Use --json for full balance sheet breakdown.\n");
|
|
2651
|
+
} catch (e) {
|
|
2652
|
+
if (e instanceof HisaaboApiError) {
|
|
2653
|
+
const err = e.hisaaboError;
|
|
2654
|
+
if (err.code === "unauthorized") fatalError("Session expired. Run: hisaabo login", EXIT.AUTH);
|
|
2655
|
+
if (err.code === "network_error") fatalError(err.message, EXIT.NETWORK);
|
|
2656
|
+
}
|
|
2657
|
+
fatalError(String(e instanceof Error ? e.message : e));
|
|
2658
|
+
}
|
|
2659
|
+
}
|
|
2660
|
+
async function reportCashFlowStatementCommand(opts) {
|
|
2661
|
+
const cfg = requireAuth();
|
|
2662
|
+
const client = new HisaaboClient(cfg);
|
|
2663
|
+
const { from, to } = resolveRange(opts);
|
|
2664
|
+
try {
|
|
2665
|
+
const result = await client.reports.cashFlowStatement({ fromDate: from, toDate: to });
|
|
2666
|
+
if (opts.json) {
|
|
2667
|
+
outputJSON(result);
|
|
2668
|
+
return;
|
|
2669
|
+
}
|
|
2670
|
+
const r = result;
|
|
2671
|
+
console.log(`
|
|
2672
|
+
Cash Flow Statement ${from} \u2192 ${to}
|
|
2673
|
+
`);
|
|
2674
|
+
console.log(` ${"\u2550".repeat(60)}
|
|
2675
|
+
`);
|
|
2676
|
+
const operating = String(r["operatingActivities"] ?? r["operations"] ?? "0");
|
|
2677
|
+
const investing = String(r["investingActivities"] ?? r["investing"] ?? "0");
|
|
2678
|
+
const financing = String(r["financingActivities"] ?? r["financing"] ?? "0");
|
|
2679
|
+
const net = String(r["netCashFlow"] ?? r["net"] ?? "0");
|
|
2680
|
+
console.log(` Operating Activities: ${formatAmount(operating).padStart(14)}`);
|
|
2681
|
+
console.log(` Investing Activities: ${formatAmount(investing).padStart(14)}`);
|
|
2682
|
+
console.log(` Financing Activities: ${formatAmount(financing).padStart(14)}`);
|
|
2683
|
+
console.log(` Net Cash Flow: ${formatAmount(net).padStart(14)}`);
|
|
2684
|
+
console.log();
|
|
2685
|
+
} catch (e) {
|
|
2686
|
+
if (e instanceof HisaaboApiError) {
|
|
2687
|
+
const err = e.hisaaboError;
|
|
2688
|
+
if (err.code === "unauthorized") fatalError("Session expired. Run: hisaabo login", EXIT.AUTH);
|
|
2689
|
+
if (err.code === "network_error") fatalError(err.message, EXIT.NETWORK);
|
|
2690
|
+
}
|
|
2691
|
+
fatalError(String(e instanceof Error ? e.message : e));
|
|
2692
|
+
}
|
|
2693
|
+
}
|
|
2694
|
+
async function reportGeneralLedgerCommand(accountId, opts) {
|
|
2695
|
+
const cfg = requireAuth();
|
|
2696
|
+
const client = new HisaaboClient(cfg);
|
|
2697
|
+
const { from, to } = resolveRange(opts);
|
|
2698
|
+
try {
|
|
2699
|
+
const result = await client.reports.generalLedger({ accountId, fromDate: from, toDate: to });
|
|
2700
|
+
if (opts.json) {
|
|
2701
|
+
outputJSON(result);
|
|
2702
|
+
return;
|
|
2703
|
+
}
|
|
2704
|
+
const r = result;
|
|
2705
|
+
const accountName = String(r["accountName"] ?? r["account"] ?? accountId);
|
|
2706
|
+
console.log(`
|
|
2707
|
+
General Ledger \u2014 ${accountName} ${from} \u2192 ${to}
|
|
2708
|
+
`);
|
|
2709
|
+
console.log(` ${"\u2550".repeat(75)}
|
|
2710
|
+
`);
|
|
2711
|
+
const opening = String(r["openingBalance"] ?? "0");
|
|
2712
|
+
console.log(` Opening Balance: ${formatAmount(opening).padStart(14)}
|
|
2713
|
+
`);
|
|
2714
|
+
const entries = Array.isArray(r["entries"]) ? r["entries"] : Array.isArray(r["rows"]) ? r["rows"] : [];
|
|
2715
|
+
for (const entry of entries) {
|
|
2716
|
+
const date = formatDate(String(entry["date"] ?? "")).padEnd(13);
|
|
2717
|
+
const narration = String(entry["narration"] ?? entry["description"] ?? "-").slice(0, 25).padEnd(25);
|
|
2718
|
+
const debit = parseFloat(String(entry["debit"] ?? "0")) !== 0 ? formatAmount(String(entry["debit"])) : "-";
|
|
2719
|
+
const credit = parseFloat(String(entry["credit"] ?? "0")) !== 0 ? formatAmount(String(entry["credit"])) : "-";
|
|
2720
|
+
const balance = formatAmount(String(entry["balance"] ?? "0"));
|
|
2721
|
+
console.log(` ${date} ${narration} ${debit.padStart(12)} ${credit.padStart(12)} ${balance.padStart(14)}`);
|
|
2722
|
+
}
|
|
2723
|
+
const closing = String(r["closingBalance"] ?? r["balance"] ?? "0");
|
|
2724
|
+
console.log(`
|
|
2725
|
+
Closing Balance: ${formatAmount(closing).padStart(14)}
|
|
2726
|
+
`);
|
|
2727
|
+
} catch (e) {
|
|
2728
|
+
if (e instanceof HisaaboApiError) {
|
|
2729
|
+
const err = e.hisaaboError;
|
|
2730
|
+
if (err.code === "unauthorized") fatalError("Session expired. Run: hisaabo login", EXIT.AUTH);
|
|
2731
|
+
if (err.code === "network_error") fatalError(err.message, EXIT.NETWORK);
|
|
2732
|
+
}
|
|
2733
|
+
fatalError(String(e instanceof Error ? e.message : e));
|
|
2734
|
+
}
|
|
2735
|
+
}
|
|
2517
2736
|
async function reportCollectionEfficiencyCommand(opts) {
|
|
2518
2737
|
const cfg = requireAuth();
|
|
2519
2738
|
const client = new HisaaboClient(cfg);
|
|
@@ -2586,6 +2805,18 @@ function registerReportCommands(program2) {
|
|
|
2586
2805
|
report.command("collection-efficiency").description("Collection efficiency metrics").option("--json", "JSON output").option("--from <date>", "From date").option("--to <date>", "To date").option("--this-month", "Current month").option("--this-fy", "Current financial year").action(async (opts) => {
|
|
2587
2806
|
await reportCollectionEfficiencyCommand(opts);
|
|
2588
2807
|
});
|
|
2808
|
+
report.command("trial-balance").description("Trial balance report").option("--json", "JSON output").option("--to <date>", "As of date").option("--this-fy", "Current financial year").action(async (opts) => {
|
|
2809
|
+
await reportTrialBalanceCommand(opts);
|
|
2810
|
+
});
|
|
2811
|
+
report.command("balance-sheet").description("Balance sheet").option("--json", "JSON output").option("--to <date>", "As of date").option("--this-fy", "Current financial year").action(async (opts) => {
|
|
2812
|
+
await reportBalanceSheetCommand(opts);
|
|
2813
|
+
});
|
|
2814
|
+
report.command("cash-flow-statement").description("Cash flow statement (operating/investing/financing)").option("--json", "JSON output").option("--from <date>", "From date").option("--to <date>", "To date").option("--this-fy", "Current financial year").action(async (opts) => {
|
|
2815
|
+
await reportCashFlowStatementCommand(opts);
|
|
2816
|
+
});
|
|
2817
|
+
report.command("general-ledger <accountId>").description("General ledger for a specific account").option("--json", "JSON output").option("--from <date>", "From date").option("--to <date>", "To date").option("--this-fy", "Current financial year").action(async (accountId, opts) => {
|
|
2818
|
+
await reportGeneralLedgerCommand(accountId, opts);
|
|
2819
|
+
});
|
|
2589
2820
|
}
|
|
2590
2821
|
|
|
2591
2822
|
// src/commands/bank/index.ts
|
|
@@ -3221,11 +3452,11 @@ function registerTargetCommands(program2) {
|
|
|
3221
3452
|
function registerStoreCommands(program2) {
|
|
3222
3453
|
const store = program2.command("store").description("Online store management");
|
|
3223
3454
|
store.command("settings").description("Show store settings").option("--json", "JSON output").action(async (opts) => {
|
|
3224
|
-
const { storeSettingsCommand } = await import("./store-
|
|
3455
|
+
const { storeSettingsCommand } = await import("./store-6QT6HKG2.js");
|
|
3225
3456
|
await storeSettingsCommand({ json: opts.json });
|
|
3226
3457
|
});
|
|
3227
3458
|
store.command("update-settings").description("Update store settings").option("--slug <slug>", "Store URL slug").option("--tagline <text>", "Store tagline / description").option("--enabled <bool>", "Enable or disable store (true/false)").option("--json", "JSON output").action(async (opts) => {
|
|
3228
|
-
const { storeUpdateSettingsCommand } = await import("./update-settings-
|
|
3459
|
+
const { storeUpdateSettingsCommand } = await import("./update-settings-KYSQDIEO.js");
|
|
3229
3460
|
await storeUpdateSettingsCommand({
|
|
3230
3461
|
slug: opts.slug,
|
|
3231
3462
|
tagline: opts.tagline,
|
|
@@ -3234,11 +3465,11 @@ function registerStoreCommands(program2) {
|
|
|
3234
3465
|
});
|
|
3235
3466
|
});
|
|
3236
3467
|
store.command("items").description("List items available in the store").option("--json", "JSON output").option("--format <format>", "Output format: table, tsv, csv").action(async (opts) => {
|
|
3237
|
-
const { storeItemsCommand } = await import("./items-
|
|
3468
|
+
const { storeItemsCommand } = await import("./items-DPD6EFTP.js");
|
|
3238
3469
|
await storeItemsCommand({ json: opts.json, format: opts.format });
|
|
3239
3470
|
});
|
|
3240
3471
|
store.command("items-toggle").description("Bulk enable / disable store items").option("--enable <ids>", "Comma-separated item IDs to enable").option("--disable <ids>", "Comma-separated item IDs to disable").option("--json", "JSON output").action(async (opts) => {
|
|
3241
|
-
const { storeItemsToggleCommand } = await import("./items-toggle-
|
|
3472
|
+
const { storeItemsToggleCommand } = await import("./items-toggle-R4OPSE4W.js");
|
|
3242
3473
|
await storeItemsToggleCommand({
|
|
3243
3474
|
enable: opts.enable,
|
|
3244
3475
|
disable: opts.disable,
|
|
@@ -3246,7 +3477,7 @@ function registerStoreCommands(program2) {
|
|
|
3246
3477
|
});
|
|
3247
3478
|
});
|
|
3248
3479
|
store.command("orders").description("List store orders").option("--json", "JSON output").option("--status <status>", "Filter by order status").option("--page <n>", "Page number", parseInt).option("--limit <n>", "Items per page", parseInt).action(async (opts) => {
|
|
3249
|
-
const { storeOrdersCommand } = await import("./store-
|
|
3480
|
+
const { storeOrdersCommand } = await import("./store-6QT6HKG2.js");
|
|
3250
3481
|
await storeOrdersCommand({
|
|
3251
3482
|
json: opts.json,
|
|
3252
3483
|
status: opts.status,
|
|
@@ -3255,15 +3486,15 @@ function registerStoreCommands(program2) {
|
|
|
3255
3486
|
});
|
|
3256
3487
|
});
|
|
3257
3488
|
store.command("order-get <id>").description("Get order details").option("--json", "JSON output").action(async (id, opts) => {
|
|
3258
|
-
const { storeOrderGetCommand } = await import("./order-get-
|
|
3489
|
+
const { storeOrderGetCommand } = await import("./order-get-RDXMHLJ7.js");
|
|
3259
3490
|
await storeOrderGetCommand(id, { json: opts.json });
|
|
3260
3491
|
});
|
|
3261
3492
|
store.command("order-confirm <id>").description("Confirm a pending order").option("-y, --yes", "Skip confirmation prompt").option("--json", "JSON output").action(async (id, opts) => {
|
|
3262
|
-
const { storeOrderConfirmCommand } = await import("./order-confirm-
|
|
3493
|
+
const { storeOrderConfirmCommand } = await import("./order-confirm-IXU45Q4L.js");
|
|
3263
3494
|
await storeOrderConfirmCommand(id, { json: opts.json, yes: opts.yes });
|
|
3264
3495
|
});
|
|
3265
3496
|
store.command("order-cancel <id>").description("Cancel an order").option("-y, --yes", "Skip confirmation prompt").option("--reason <text>", "Cancellation reason").option("--json", "JSON output").action(async (id, opts) => {
|
|
3266
|
-
const { storeOrderCancelCommand } = await import("./order-cancel-
|
|
3497
|
+
const { storeOrderCancelCommand } = await import("./order-cancel-MXMJFFRR.js");
|
|
3267
3498
|
await storeOrderCancelCommand(id, {
|
|
3268
3499
|
json: opts.json,
|
|
3269
3500
|
yes: opts.yes,
|
|
@@ -3271,11 +3502,11 @@ function registerStoreCommands(program2) {
|
|
|
3271
3502
|
});
|
|
3272
3503
|
});
|
|
3273
3504
|
store.command("order-update <id>").description("Update order status").option("--status <status>", "New status: preparing, ready, delivered").option("--json", "JSON output").action(async (id, opts) => {
|
|
3274
|
-
const { storeOrderUpdateCommand } = await import("./order-update-
|
|
3505
|
+
const { storeOrderUpdateCommand } = await import("./order-update-KGIPBEJX.js");
|
|
3275
3506
|
await storeOrderUpdateCommand(id, { json: opts.json, status: opts.status });
|
|
3276
3507
|
});
|
|
3277
3508
|
store.command("check-slug <slug>").description("Check store slug availability").option("--json", "JSON output").action(async (slug, opts) => {
|
|
3278
|
-
const { storeCheckSlugCommand } = await import("./check-slug-
|
|
3509
|
+
const { storeCheckSlugCommand } = await import("./check-slug-NXO55WKH.js");
|
|
3279
3510
|
await storeCheckSlugCommand(slug, { json: opts.json });
|
|
3280
3511
|
});
|
|
3281
3512
|
}
|
|
@@ -4042,23 +4273,23 @@ function registerBusinessCommands(program2) {
|
|
|
4042
4273
|
}
|
|
4043
4274
|
});
|
|
4044
4275
|
business.command("get").description("Show current business details").option("--json", "JSON output").action(async (opts) => {
|
|
4045
|
-
const { businessGetCommand } = await import("./get-
|
|
4276
|
+
const { businessGetCommand } = await import("./get-CHNTG3IM.js");
|
|
4046
4277
|
await businessGetCommand(opts);
|
|
4047
4278
|
});
|
|
4048
4279
|
business.command("update").description("Update business settings").option("--name <name>", "Business name").option("--gstin <gstin>", "GSTIN").option("--address <address>", "Address").option("--state <state>", "State").option("--phone <phone>", "Phone number").option("--email <email>", "Email address").option("--financial-year-start <month>", "Financial year start month (1\u201312)").option("--json", "JSON output").action(async (opts) => {
|
|
4049
|
-
const { businessUpdateCommand } = await import("./update-
|
|
4280
|
+
const { businessUpdateCommand } = await import("./update-I46XLU77.js");
|
|
4050
4281
|
await businessUpdateCommand(opts);
|
|
4051
4282
|
});
|
|
4052
4283
|
business.command("sequence").description("Update invoice sequence number / prefix").requiredOption("--type <type>", "Document type: sale or purchase").option("--prefix <prefix>", "Invoice prefix (e.g. INV-)").option("--next-number <n>", "Next sequence number").option("--json", "JSON output").action(async (opts) => {
|
|
4053
|
-
const { businessSequenceCommand } = await import("./sequence-
|
|
4284
|
+
const { businessSequenceCommand } = await import("./sequence-IQ4HUJ3W.js");
|
|
4054
4285
|
await businessSequenceCommand(opts);
|
|
4055
4286
|
});
|
|
4056
4287
|
business.command("audit-trail").description("View audit log for this business").option("--page <n>", "Page number", "1").option("--limit <n>", "Results per page", "25").option("--json", "JSON output").option("--format <fmt>", "Output format: table, tsv, csv").action(async (opts) => {
|
|
4057
|
-
const { businessAuditTrailCommand } = await import("./audit-trail-
|
|
4288
|
+
const { businessAuditTrailCommand } = await import("./audit-trail-DLSSSM4T.js");
|
|
4058
4289
|
await businessAuditTrailCommand(opts);
|
|
4059
4290
|
});
|
|
4060
4291
|
business.command("export").description("Export all business data").option("--yes", "Skip confirmation prompt").option("--json", "JSON output").action(async (opts) => {
|
|
4061
|
-
const { businessExportCommand } = await import("./export-
|
|
4292
|
+
const { businessExportCommand } = await import("./export-XSX7WQH7.js");
|
|
4062
4293
|
await businessExportCommand(opts);
|
|
4063
4294
|
});
|
|
4064
4295
|
business.command("switch").description("Switch active business").option("--json", "JSON output").action(async (opts) => {
|
|
@@ -4140,29 +4371,29 @@ function registerDocumentCommands(program2) {
|
|
|
4140
4371
|
for (const dt of DOC_TYPES) {
|
|
4141
4372
|
const parent = program2.command(dt.cmd).description(`${dt.label} management`);
|
|
4142
4373
|
parent.command("list").description(`List ${dt.label.toLowerCase()}s`).option("--json", "JSON output").option("--format <format>", "Output format: table, tsv, csv, ids").option("--status <status>", `Filter by status: ${dt.statuses.join(", ")}`).option("--party <search>", "Filter by party name").option("--from <date>", "Start date (YYYY-MM-DD)").option("--to <date>", "End date (YYYY-MM-DD)").option("--this-month", "Current month").option("--this-fy", "Current financial year").option("--page <n>", "Page number", parseInt).option("--limit <n>", "Items per page", parseInt).action(async (opts) => {
|
|
4143
|
-
const { docListCommand } = await import("./factory-
|
|
4374
|
+
const { docListCommand } = await import("./factory-BWOKRIP4.js");
|
|
4144
4375
|
await docListCommand(dt, opts);
|
|
4145
4376
|
});
|
|
4146
4377
|
parent.command("get <id>").description(`Get ${dt.label.toLowerCase()} details`).option("--json", "JSON output").action(async (id, opts) => {
|
|
4147
|
-
const { docGetCommand } = await import("./factory-
|
|
4378
|
+
const { docGetCommand } = await import("./factory-BWOKRIP4.js");
|
|
4148
4379
|
await docGetCommand(dt, id, opts);
|
|
4149
4380
|
});
|
|
4150
4381
|
parent.command("create").description(`Create a new ${dt.label.toLowerCase()}`).option("--json", "JSON output").option("--party-id <id>", "Party UUID").option("--party <name>", "Party search name").option("--date <date>", "Document date (YYYY-MM-DD)").option("--due-date <date>", "Due date (YYYY-MM-DD)").option("--item <desc>", "Item description (repeatable)", (v, a) => [...a, v], []).option("--qty <n>", "Quantity per item (repeatable)", (v, a) => [...a, v], []).option("--rate <n>", "Rate per item (repeatable)", (v, a) => [...a, v], []).option("--notes <text>", "Notes").option("--discount <pct>", "Discount percent").option("-y, --yes", "Skip confirmation").action(async (opts) => {
|
|
4151
|
-
const { docCreateCommand } = await import("./factory-
|
|
4382
|
+
const { docCreateCommand } = await import("./factory-BWOKRIP4.js");
|
|
4152
4383
|
await docCreateCommand(dt, opts);
|
|
4153
4384
|
});
|
|
4154
4385
|
parent.command("update-status <id> <status>").description(`Update ${dt.label.toLowerCase()} status (${dt.statuses.join(", ")})`).option("--json", "JSON output").action(async (id, status, opts) => {
|
|
4155
|
-
const { docStatusCommand } = await import("./factory-
|
|
4386
|
+
const { docStatusCommand } = await import("./factory-BWOKRIP4.js");
|
|
4156
4387
|
await docStatusCommand(dt, id, status, opts);
|
|
4157
4388
|
});
|
|
4158
4389
|
parent.command("delete <id>").description(`Delete a ${dt.label.toLowerCase()}`).option("-y, --yes", "Skip confirmation").option("--json", "JSON output").action(async (id, opts) => {
|
|
4159
|
-
const { docDeleteCommand } = await import("./factory-
|
|
4390
|
+
const { docDeleteCommand } = await import("./factory-BWOKRIP4.js");
|
|
4160
4391
|
await docDeleteCommand(dt, id, opts);
|
|
4161
4392
|
});
|
|
4162
4393
|
}
|
|
4163
4394
|
program2.command("document").description("Document conversion operations").command("convert").description("Convert one document type to another").requiredOption("--from-type <type>", "Source type (quotation, proforma, delivery-challan, etc.)").requiredOption("--from-id <id>", "Source document ID").requiredOption("--to-type <type>", "Target type (invoice, credit-note, etc.)").option("--json", "JSON output").option("-y, --yes", "Skip confirmation").action(async (opts) => {
|
|
4164
|
-
const { HisaaboClient: HisaaboClient2, HisaaboApiError: HisaaboApiError2 } = await import("./client-
|
|
4165
|
-
const { requireAuth: requireAuth2 } = await import("./config-
|
|
4395
|
+
const { HisaaboClient: HisaaboClient2, HisaaboApiError: HisaaboApiError2 } = await import("./client-T32CIZA3.js");
|
|
4396
|
+
const { requireAuth: requireAuth2 } = await import("./config-V4QFCONN.js");
|
|
4166
4397
|
const { fatalError: fatalError2, outputJSON: outputJSON2, success: success2, EXIT: EXIT2 } = await import("./output-NUOL7KJW.js");
|
|
4167
4398
|
const cfg = requireAuth2();
|
|
4168
4399
|
const client = new HisaaboClient2(cfg);
|
|
@@ -4214,31 +4445,31 @@ function registerDocumentCommands(program2) {
|
|
|
4214
4445
|
function registerTenantCommands(program2) {
|
|
4215
4446
|
const tenant = program2.command("tenant").description("Tenant / workspace management");
|
|
4216
4447
|
tenant.command("list").description("List tenants / organizations you belong to").option("--json", "JSON output").action(async (opts) => {
|
|
4217
|
-
const { tenantListCommand } = await import("./list-
|
|
4448
|
+
const { tenantListCommand } = await import("./list-KLEHBMQ2.js");
|
|
4218
4449
|
await tenantListCommand({ json: opts.json });
|
|
4219
4450
|
});
|
|
4220
4451
|
tenant.command("members").description("List members of the current tenant").option("--json", "JSON output").option("--format <format>", "Output format: table, tsv, csv").action(async (opts) => {
|
|
4221
|
-
const { tenantMembersCommand } = await import("./members-
|
|
4452
|
+
const { tenantMembersCommand } = await import("./members-XA3TF4IQ.js");
|
|
4222
4453
|
await tenantMembersCommand({ json: opts.json, format: opts.format });
|
|
4223
4454
|
});
|
|
4224
4455
|
tenant.command("invite <email>").description("Invite a user to the tenant").option("--role <role>", "Role: admin, seller_manager, seller, accountant (default: seller)").option("--json", "JSON output").action(async (email, opts) => {
|
|
4225
|
-
const { tenantInviteCommand } = await import("./invite-
|
|
4456
|
+
const { tenantInviteCommand } = await import("./invite-EW73UIBE.js");
|
|
4226
4457
|
await tenantInviteCommand(email, { role: opts.role, json: opts.json });
|
|
4227
4458
|
});
|
|
4228
4459
|
tenant.command("remove <userId>").description("Remove a member from the tenant").option("-y, --yes", "Skip confirmation").option("--json", "JSON output").action(async (userId, opts) => {
|
|
4229
|
-
const { tenantRemoveCommand } = await import("./remove-
|
|
4460
|
+
const { tenantRemoveCommand } = await import("./remove-I5HD2Y4K.js");
|
|
4230
4461
|
await tenantRemoveCommand(userId, { yes: opts.yes, json: opts.json });
|
|
4231
4462
|
});
|
|
4232
4463
|
tenant.command("update-role <userId> <role>").description("Update a member's role (admin, seller_manager, seller, accountant)").option("--json", "JSON output").action(async (userId, role, opts) => {
|
|
4233
|
-
const { tenantUpdateRoleCommand } = await import("./update-role-
|
|
4464
|
+
const { tenantUpdateRoleCommand } = await import("./update-role-5GV42MSN.js");
|
|
4234
4465
|
await tenantUpdateRoleCommand(userId, role, { json: opts.json });
|
|
4235
4466
|
});
|
|
4236
4467
|
tenant.command("invitations").description("List pending invitations").option("--json", "JSON output").action(async (opts) => {
|
|
4237
|
-
const { listInvitationsCommand } = await import("./invitations-
|
|
4468
|
+
const { listInvitationsCommand } = await import("./invitations-H2SL3XAD.js");
|
|
4238
4469
|
await listInvitationsCommand(opts);
|
|
4239
4470
|
});
|
|
4240
4471
|
tenant.command("revoke-invitation <invitationId>").description("Revoke a pending invitation").option("--json", "JSON output").action(async (invitationId, opts) => {
|
|
4241
|
-
const { revokeInvitationCommand } = await import("./revoke-invitation-
|
|
4472
|
+
const { revokeInvitationCommand } = await import("./revoke-invitation-JXDPXTOW.js");
|
|
4242
4473
|
await revokeInvitationCommand(invitationId, opts);
|
|
4243
4474
|
});
|
|
4244
4475
|
}
|
|
@@ -4247,15 +4478,15 @@ function registerTenantCommands(program2) {
|
|
|
4247
4478
|
function registerApiKeyCommands(program2) {
|
|
4248
4479
|
const apiKey = program2.command("api-key").alias("key").description("API key management");
|
|
4249
4480
|
apiKey.command("list").description("List all API keys").option("--json", "JSON output").option("--format <fmt>", "Output format: table, tsv, csv").action(async (opts) => {
|
|
4250
|
-
const { apiKeyListCommand } = await import("./list-
|
|
4481
|
+
const { apiKeyListCommand } = await import("./list-PKHBE475.js");
|
|
4251
4482
|
await apiKeyListCommand(opts);
|
|
4252
4483
|
});
|
|
4253
4484
|
apiKey.command("create").description("Create a new API key").requiredOption("--name <name>", "Name / label for this key").option("--json", "JSON output").action(async (opts) => {
|
|
4254
|
-
const { apiKeyCreateCommand } = await import("./create-
|
|
4485
|
+
const { apiKeyCreateCommand } = await import("./create-NUKHDWLK.js");
|
|
4255
4486
|
await apiKeyCreateCommand(opts);
|
|
4256
4487
|
});
|
|
4257
4488
|
apiKey.command("revoke <id>").description("Revoke an API key by ID").option("--yes", "Skip confirmation prompt").option("--json", "JSON output").action(async (id, opts) => {
|
|
4258
|
-
const { apiKeyRevokeCommand } = await import("./revoke-
|
|
4489
|
+
const { apiKeyRevokeCommand } = await import("./revoke-OC6AOMIZ.js");
|
|
4259
4490
|
await apiKeyRevokeCommand(id, opts);
|
|
4260
4491
|
});
|
|
4261
4492
|
}
|
|
@@ -4264,22 +4495,628 @@ function registerApiKeyCommands(program2) {
|
|
|
4264
4495
|
function registerSessionCommands(program2) {
|
|
4265
4496
|
const session = program2.command("session").description("Manage active sessions");
|
|
4266
4497
|
session.command("list").description("List active sessions").option("--expired", "Show expired sessions instead").option("--json", "JSON output").action(async (opts) => {
|
|
4267
|
-
const { listSessionsCommand } = await import("./list-
|
|
4498
|
+
const { listSessionsCommand } = await import("./list-UR7OOJVF.js");
|
|
4268
4499
|
await listSessionsCommand(opts);
|
|
4269
4500
|
});
|
|
4270
4501
|
session.command("revoke <sessionId>").description("Revoke a specific session").option("--json", "JSON output").action(async (sessionId, opts) => {
|
|
4271
|
-
const { revokeSessionCommand } = await import("./revoke-
|
|
4502
|
+
const { revokeSessionCommand } = await import("./revoke-MFLWGCMP.js");
|
|
4272
4503
|
await revokeSessionCommand(sessionId, opts);
|
|
4273
4504
|
});
|
|
4274
4505
|
session.command("revoke-all").description("Sign out from all devices").action(async () => {
|
|
4275
|
-
const { revokeAllSessionsCommand } = await import("./revoke-all-
|
|
4506
|
+
const { revokeAllSessionsCommand } = await import("./revoke-all-FSAPBB3P.js");
|
|
4276
4507
|
await revokeAllSessionsCommand();
|
|
4277
4508
|
});
|
|
4278
4509
|
}
|
|
4279
4510
|
|
|
4511
|
+
// src/commands/journal/index.ts
|
|
4512
|
+
function handleError(e) {
|
|
4513
|
+
if (e instanceof HisaaboApiError) {
|
|
4514
|
+
const err = e.hisaaboError;
|
|
4515
|
+
if (err.code === "unauthorized") fatalError("Session expired. Run: hisaabo login", EXIT.AUTH);
|
|
4516
|
+
if (err.code === "network_error") fatalError(err.message, EXIT.NETWORK);
|
|
4517
|
+
}
|
|
4518
|
+
fatalError(String(e instanceof Error ? e.message : e));
|
|
4519
|
+
}
|
|
4520
|
+
async function journalListCommand(opts) {
|
|
4521
|
+
const cfg = requireAuth();
|
|
4522
|
+
const client = new HisaaboClient(cfg);
|
|
4523
|
+
try {
|
|
4524
|
+
const result = await client.journal.list({
|
|
4525
|
+
page: opts.page ?? 1,
|
|
4526
|
+
limit: opts.limit ?? 25,
|
|
4527
|
+
fromDate: opts.from,
|
|
4528
|
+
toDate: opts.to
|
|
4529
|
+
});
|
|
4530
|
+
if (opts.json) {
|
|
4531
|
+
outputJSON(result);
|
|
4532
|
+
return;
|
|
4533
|
+
}
|
|
4534
|
+
const entries = Array.isArray(result) ? result : Array.isArray(result?.data) ? result.data : [];
|
|
4535
|
+
console.log(`
|
|
4536
|
+
Journal Entries
|
|
4537
|
+
`);
|
|
4538
|
+
console.log(` ${"\u2550".repeat(70)}
|
|
4539
|
+
`);
|
|
4540
|
+
if (entries.length === 0) {
|
|
4541
|
+
console.log(" No journal entries found.\n");
|
|
4542
|
+
return;
|
|
4543
|
+
}
|
|
4544
|
+
for (const entry of entries) {
|
|
4545
|
+
const date = formatDate(String(entry["date"] ?? entry["journalDate"] ?? ""));
|
|
4546
|
+
const number = String(entry["number"] ?? entry["voucherNumber"] ?? "-");
|
|
4547
|
+
const narration = String(entry["narration"] ?? entry["description"] ?? "").slice(0, 40);
|
|
4548
|
+
const status = String(entry["status"] ?? "").padEnd(8);
|
|
4549
|
+
console.log(` ${date.padEnd(13)} ${number.padEnd(14)} ${status} ${narration}`);
|
|
4550
|
+
}
|
|
4551
|
+
console.log();
|
|
4552
|
+
} catch (e) {
|
|
4553
|
+
handleError(e);
|
|
4554
|
+
}
|
|
4555
|
+
}
|
|
4556
|
+
async function journalGetCommand(id, opts) {
|
|
4557
|
+
const cfg = requireAuth();
|
|
4558
|
+
const client = new HisaaboClient(cfg);
|
|
4559
|
+
try {
|
|
4560
|
+
const result = await client.journal.getById(id);
|
|
4561
|
+
if (opts.json) {
|
|
4562
|
+
outputJSON(result);
|
|
4563
|
+
return;
|
|
4564
|
+
}
|
|
4565
|
+
const r = result;
|
|
4566
|
+
console.log(`
|
|
4567
|
+
Journal Entry \u2014 ${String(r["number"] ?? r["voucherNumber"] ?? id)}
|
|
4568
|
+
`);
|
|
4569
|
+
console.log(` ${"\u2550".repeat(60)}
|
|
4570
|
+
`);
|
|
4571
|
+
console.log(` Date: ${formatDate(String(r["date"] ?? r["journalDate"] ?? ""))}`);
|
|
4572
|
+
console.log(` Narration: ${String(r["narration"] ?? r["description"] ?? "-")}`);
|
|
4573
|
+
console.log(` Status: ${String(r["status"] ?? "-")}`);
|
|
4574
|
+
console.log();
|
|
4575
|
+
const lines = r["lines"] ?? r["entries"] ?? r["lineItems"];
|
|
4576
|
+
if (lines && Array.isArray(lines)) {
|
|
4577
|
+
console.log(" Lines:\n");
|
|
4578
|
+
for (const line of lines) {
|
|
4579
|
+
const account = String(line["accountName"] ?? line["account"] ?? "-").padEnd(28);
|
|
4580
|
+
const debit = String(line["debit"] ?? "0");
|
|
4581
|
+
const credit = String(line["credit"] ?? "0");
|
|
4582
|
+
console.log(` ${account} Dr: ${debit.padStart(12)} Cr: ${credit.padStart(12)}`);
|
|
4583
|
+
}
|
|
4584
|
+
}
|
|
4585
|
+
console.log();
|
|
4586
|
+
} catch (e) {
|
|
4587
|
+
handleError(e);
|
|
4588
|
+
}
|
|
4589
|
+
}
|
|
4590
|
+
async function journalVoidCommand(id, opts) {
|
|
4591
|
+
const cfg = requireAuth();
|
|
4592
|
+
const client = new HisaaboClient(cfg);
|
|
4593
|
+
try {
|
|
4594
|
+
const result = await client.journal.void(id);
|
|
4595
|
+
if (opts.json) {
|
|
4596
|
+
outputJSON(result);
|
|
4597
|
+
return;
|
|
4598
|
+
}
|
|
4599
|
+
console.log(` Journal entry ${id} voided.
|
|
4600
|
+
`);
|
|
4601
|
+
} catch (e) {
|
|
4602
|
+
handleError(e);
|
|
4603
|
+
}
|
|
4604
|
+
}
|
|
4605
|
+
async function journalTemplatesCommand(opts) {
|
|
4606
|
+
const cfg = requireAuth();
|
|
4607
|
+
const client = new HisaaboClient(cfg);
|
|
4608
|
+
try {
|
|
4609
|
+
const result = await client.journal.templateList();
|
|
4610
|
+
if (opts.json) {
|
|
4611
|
+
outputJSON(result);
|
|
4612
|
+
return;
|
|
4613
|
+
}
|
|
4614
|
+
const templates = Array.isArray(result) ? result : Array.isArray(result?.data) ? result.data : [];
|
|
4615
|
+
console.log(`
|
|
4616
|
+
Journal Templates
|
|
4617
|
+
`);
|
|
4618
|
+
console.log(` ${"\u2550".repeat(50)}
|
|
4619
|
+
`);
|
|
4620
|
+
if (templates.length === 0) {
|
|
4621
|
+
console.log(" No templates found.\n");
|
|
4622
|
+
return;
|
|
4623
|
+
}
|
|
4624
|
+
for (const t of templates) {
|
|
4625
|
+
const id = String(t["id"] ?? "-").slice(0, 8);
|
|
4626
|
+
const name = String(t["name"] ?? "-").padEnd(30);
|
|
4627
|
+
console.log(` ${id} ${name}`);
|
|
4628
|
+
}
|
|
4629
|
+
console.log();
|
|
4630
|
+
} catch (e) {
|
|
4631
|
+
handleError(e);
|
|
4632
|
+
}
|
|
4633
|
+
}
|
|
4634
|
+
|
|
4635
|
+
// src/bin/registrars/journal.ts
|
|
4636
|
+
function registerJournalCommands(program2) {
|
|
4637
|
+
const journal = program2.command("journal").description("Journal entries and templates");
|
|
4638
|
+
journal.command("list").description("List journal entries").option("--json", "JSON output").option("--page <n>", "Page number", parseInt).option("--limit <n>", "Results per page", parseInt).option("--from <date>", "From date").option("--to <date>", "To date").action(async (opts) => {
|
|
4639
|
+
await journalListCommand(opts);
|
|
4640
|
+
});
|
|
4641
|
+
journal.command("get <id>").description("Get journal entry details").option("--json", "JSON output").action(async (id, opts) => {
|
|
4642
|
+
await journalGetCommand(id, { json: opts.json });
|
|
4643
|
+
});
|
|
4644
|
+
journal.command("void <id>").description("Void a journal entry").option("--json", "JSON output").action(async (id, opts) => {
|
|
4645
|
+
await journalVoidCommand(id, { json: opts.json });
|
|
4646
|
+
});
|
|
4647
|
+
journal.command("templates").description("List journal entry templates").option("--json", "JSON output").action(async (opts) => {
|
|
4648
|
+
await journalTemplatesCommand({ json: opts.json });
|
|
4649
|
+
});
|
|
4650
|
+
}
|
|
4651
|
+
|
|
4652
|
+
// src/commands/itc/index.ts
|
|
4653
|
+
function handleError2(e) {
|
|
4654
|
+
if (e instanceof HisaaboApiError) {
|
|
4655
|
+
const err = e.hisaaboError;
|
|
4656
|
+
if (err.code === "unauthorized") fatalError("Session expired. Run: hisaabo login", EXIT.AUTH);
|
|
4657
|
+
if (err.code === "network_error") fatalError(err.message, EXIT.NETWORK);
|
|
4658
|
+
}
|
|
4659
|
+
fatalError(String(e instanceof Error ? e.message : e));
|
|
4660
|
+
}
|
|
4661
|
+
async function itcDashboardCommand(opts) {
|
|
4662
|
+
const cfg = requireAuth();
|
|
4663
|
+
const client = new HisaaboClient(cfg);
|
|
4664
|
+
try {
|
|
4665
|
+
const result = await client.itc.dashboard({ fromDate: opts.from, toDate: opts.to });
|
|
4666
|
+
if (opts.json) {
|
|
4667
|
+
outputJSON(result);
|
|
4668
|
+
return;
|
|
4669
|
+
}
|
|
4670
|
+
const r = result;
|
|
4671
|
+
console.log("\n ITC Dashboard\n");
|
|
4672
|
+
console.log(` ${"\u2550".repeat(50)}
|
|
4673
|
+
`);
|
|
4674
|
+
const eligible = String(r["totalEligible"] ?? r["eligible"] ?? "0");
|
|
4675
|
+
const blocked = String(r["totalBlocked"] ?? r["blocked"] ?? "0");
|
|
4676
|
+
const utilized = String(r["totalUtilized"] ?? r["utilized"] ?? "0");
|
|
4677
|
+
const available = String(r["availableBalance"] ?? r["available"] ?? "0");
|
|
4678
|
+
console.log(` Eligible ITC: ${formatAmount(eligible).padStart(14)}`);
|
|
4679
|
+
console.log(` Blocked ITC: ${formatAmount(blocked).padStart(14)}`);
|
|
4680
|
+
console.log(` Utilized ITC: ${formatAmount(utilized).padStart(14)}`);
|
|
4681
|
+
console.log(` Available Balance:${formatAmount(available).padStart(14)}`);
|
|
4682
|
+
console.log();
|
|
4683
|
+
} catch (e) {
|
|
4684
|
+
handleError2(e);
|
|
4685
|
+
}
|
|
4686
|
+
}
|
|
4687
|
+
async function itcLedgerCommand(opts) {
|
|
4688
|
+
const cfg = requireAuth();
|
|
4689
|
+
const client = new HisaaboClient(cfg);
|
|
4690
|
+
try {
|
|
4691
|
+
const result = await client.itc.ledger({ fromDate: opts.from, toDate: opts.to });
|
|
4692
|
+
if (opts.json) {
|
|
4693
|
+
outputJSON(result);
|
|
4694
|
+
return;
|
|
4695
|
+
}
|
|
4696
|
+
const entries = Array.isArray(result) ? result : Array.isArray(result?.data) ? result.data : Array.isArray(result?.entries) ? result.entries : [];
|
|
4697
|
+
console.log("\n ITC Ledger\n");
|
|
4698
|
+
console.log(` ${"\u2550".repeat(70)}
|
|
4699
|
+
`);
|
|
4700
|
+
for (const entry of entries) {
|
|
4701
|
+
const date = String(entry["date"] ?? "-").slice(0, 10);
|
|
4702
|
+
const supplier = String(entry["supplierName"] ?? entry["supplier"] ?? "-").padEnd(22);
|
|
4703
|
+
const gstin = String(entry["gstin"] ?? "-").padEnd(16);
|
|
4704
|
+
const igst = formatAmount(String(entry["igst"] ?? "0")).padStart(12);
|
|
4705
|
+
const cgst = formatAmount(String(entry["cgst"] ?? "0")).padStart(12);
|
|
4706
|
+
const sgst = formatAmount(String(entry["sgst"] ?? "0")).padStart(12);
|
|
4707
|
+
console.log(` ${date.padEnd(12)} ${supplier} ${gstin} IGST:${igst} CGST:${cgst} SGST:${sgst}`);
|
|
4708
|
+
}
|
|
4709
|
+
console.log();
|
|
4710
|
+
} catch (e) {
|
|
4711
|
+
handleError2(e);
|
|
4712
|
+
}
|
|
4713
|
+
}
|
|
4714
|
+
async function itcAgingCommand(opts) {
|
|
4715
|
+
const cfg = requireAuth();
|
|
4716
|
+
const client = new HisaaboClient(cfg);
|
|
4717
|
+
try {
|
|
4718
|
+
const result = await client.itc.agingAlerts();
|
|
4719
|
+
if (opts.json) {
|
|
4720
|
+
outputJSON(result);
|
|
4721
|
+
return;
|
|
4722
|
+
}
|
|
4723
|
+
const alerts = Array.isArray(result) ? result : Array.isArray(result?.data) ? result.data : Array.isArray(result?.alerts) ? result.alerts : [];
|
|
4724
|
+
console.log("\n ITC Aging Alerts\n");
|
|
4725
|
+
console.log(` ${"\u2550".repeat(60)}
|
|
4726
|
+
`);
|
|
4727
|
+
if (alerts.length === 0) {
|
|
4728
|
+
console.log(" No aging alerts.\n");
|
|
4729
|
+
return;
|
|
4730
|
+
}
|
|
4731
|
+
for (const alert of alerts) {
|
|
4732
|
+
const supplier = String(alert["supplierName"] ?? alert["supplier"] ?? "-").padEnd(25);
|
|
4733
|
+
const amount = formatAmount(String(alert["amount"] ?? "0")).padStart(14);
|
|
4734
|
+
const days = String(alert["daysOld"] ?? alert["age"] ?? "-").padStart(6);
|
|
4735
|
+
console.log(` ${supplier} ${amount} ${days} days`);
|
|
4736
|
+
}
|
|
4737
|
+
console.log();
|
|
4738
|
+
} catch (e) {
|
|
4739
|
+
handleError2(e);
|
|
4740
|
+
}
|
|
4741
|
+
}
|
|
4742
|
+
async function itcBlockCommand(invoiceId, opts) {
|
|
4743
|
+
const cfg = requireAuth();
|
|
4744
|
+
const client = new HisaaboClient(cfg);
|
|
4745
|
+
try {
|
|
4746
|
+
const result = await client.itc.markBlocked({ invoiceId });
|
|
4747
|
+
if (opts.json) {
|
|
4748
|
+
outputJSON(result);
|
|
4749
|
+
return;
|
|
4750
|
+
}
|
|
4751
|
+
console.log(` ITC for invoice ${invoiceId} marked as blocked.
|
|
4752
|
+
`);
|
|
4753
|
+
} catch (e) {
|
|
4754
|
+
handleError2(e);
|
|
4755
|
+
}
|
|
4756
|
+
}
|
|
4757
|
+
async function itcUnblockCommand(invoiceId, opts) {
|
|
4758
|
+
const cfg = requireAuth();
|
|
4759
|
+
const client = new HisaaboClient(cfg);
|
|
4760
|
+
try {
|
|
4761
|
+
const result = await client.itc.markEligible({ invoiceId });
|
|
4762
|
+
if (opts.json) {
|
|
4763
|
+
outputJSON(result);
|
|
4764
|
+
return;
|
|
4765
|
+
}
|
|
4766
|
+
console.log(` ITC for invoice ${invoiceId} marked as eligible.
|
|
4767
|
+
`);
|
|
4768
|
+
} catch (e) {
|
|
4769
|
+
handleError2(e);
|
|
4770
|
+
}
|
|
4771
|
+
}
|
|
4772
|
+
|
|
4773
|
+
// src/bin/registrars/itc.ts
|
|
4774
|
+
function registerItcCommands(program2) {
|
|
4775
|
+
const itc = program2.command("itc").description("Input Tax Credit tracking");
|
|
4776
|
+
itc.command("dashboard").description("ITC summary dashboard").option("--json", "JSON output").option("--from <date>", "From date").option("--to <date>", "To date").action(async (opts) => {
|
|
4777
|
+
await itcDashboardCommand(opts);
|
|
4778
|
+
});
|
|
4779
|
+
itc.command("ledger").description("ITC ledger \u2014 all eligible purchase credits").option("--json", "JSON output").option("--from <date>", "From date").option("--to <date>", "To date").action(async (opts) => {
|
|
4780
|
+
await itcLedgerCommand(opts);
|
|
4781
|
+
});
|
|
4782
|
+
itc.command("aging").description("ITC aging alerts \u2014 credits at risk of reversal").option("--json", "JSON output").action(async (opts) => {
|
|
4783
|
+
await itcAgingCommand({ json: opts.json });
|
|
4784
|
+
});
|
|
4785
|
+
itc.command("block <invoiceId>").description("Mark ITC for an invoice as blocked").option("--json", "JSON output").action(async (invoiceId, opts) => {
|
|
4786
|
+
await itcBlockCommand(invoiceId, { json: opts.json });
|
|
4787
|
+
});
|
|
4788
|
+
itc.command("unblock <invoiceId>").description("Mark ITC for an invoice as eligible").option("--json", "JSON output").action(async (invoiceId, opts) => {
|
|
4789
|
+
await itcUnblockCommand(invoiceId, { json: opts.json });
|
|
4790
|
+
});
|
|
4791
|
+
}
|
|
4792
|
+
|
|
4793
|
+
// src/commands/bank-recon/index.ts
|
|
4794
|
+
function handleError3(e) {
|
|
4795
|
+
if (e instanceof HisaaboApiError) {
|
|
4796
|
+
const err = e.hisaaboError;
|
|
4797
|
+
if (err.code === "unauthorized") fatalError("Session expired. Run: hisaabo login", EXIT.AUTH);
|
|
4798
|
+
if (err.code === "network_error") fatalError(err.message, EXIT.NETWORK);
|
|
4799
|
+
}
|
|
4800
|
+
fatalError(String(e instanceof Error ? e.message : e));
|
|
4801
|
+
}
|
|
4802
|
+
async function bankReconImportsCommand(opts) {
|
|
4803
|
+
const cfg = requireAuth();
|
|
4804
|
+
const client = new HisaaboClient(cfg);
|
|
4805
|
+
try {
|
|
4806
|
+
const result = await client.bankRecon.importList();
|
|
4807
|
+
if (opts.json) {
|
|
4808
|
+
outputJSON(result);
|
|
4809
|
+
return;
|
|
4810
|
+
}
|
|
4811
|
+
const imports = Array.isArray(result) ? result : Array.isArray(result?.data) ? result.data : [];
|
|
4812
|
+
console.log("\n Bank Reconciliation Imports\n");
|
|
4813
|
+
console.log(` ${"\u2550".repeat(65)}
|
|
4814
|
+
`);
|
|
4815
|
+
if (imports.length === 0) {
|
|
4816
|
+
console.log(" No imports found.\n");
|
|
4817
|
+
return;
|
|
4818
|
+
}
|
|
4819
|
+
for (const imp of imports) {
|
|
4820
|
+
const id = String(imp["id"] ?? "-").slice(0, 8);
|
|
4821
|
+
const date = formatDate(String(imp["createdAt"] ?? imp["importDate"] ?? ""));
|
|
4822
|
+
const account = String(imp["accountName"] ?? imp["bankAccount"] ?? "-").padEnd(20);
|
|
4823
|
+
const lines = String(imp["totalLines"] ?? imp["lineCount"] ?? "-").padStart(6);
|
|
4824
|
+
const matched = String(imp["matchedLines"] ?? imp["matched"] ?? "-").padStart(8);
|
|
4825
|
+
const status = String(imp["status"] ?? "-").padEnd(10);
|
|
4826
|
+
console.log(` ${id} ${date.padEnd(13)} ${account} Lines:${lines} Matched:${matched} ${status}`);
|
|
4827
|
+
}
|
|
4828
|
+
console.log();
|
|
4829
|
+
} catch (e) {
|
|
4830
|
+
handleError3(e);
|
|
4831
|
+
}
|
|
4832
|
+
}
|
|
4833
|
+
async function bankReconSummaryCommand(importId, opts) {
|
|
4834
|
+
const cfg = requireAuth();
|
|
4835
|
+
const client = new HisaaboClient(cfg);
|
|
4836
|
+
try {
|
|
4837
|
+
const result = await client.bankRecon.summary(importId);
|
|
4838
|
+
if (opts.json) {
|
|
4839
|
+
outputJSON(result);
|
|
4840
|
+
return;
|
|
4841
|
+
}
|
|
4842
|
+
const r = result;
|
|
4843
|
+
console.log(`
|
|
4844
|
+
Bank Recon Summary \u2014 ${importId}
|
|
4845
|
+
`);
|
|
4846
|
+
console.log(` ${"\u2550".repeat(55)}
|
|
4847
|
+
`);
|
|
4848
|
+
const total = String(r["totalLines"] ?? r["total"] ?? "0");
|
|
4849
|
+
const matched = String(r["matchedLines"] ?? r["matched"] ?? "0");
|
|
4850
|
+
const unmatched = String(r["unmatchedLines"] ?? r["unmatched"] ?? "0");
|
|
4851
|
+
const ignored = String(r["ignoredLines"] ?? r["ignored"] ?? "0");
|
|
4852
|
+
const openingBalance = String(r["openingBalance"] ?? "0");
|
|
4853
|
+
const closingBalance = String(r["closingBalance"] ?? "0");
|
|
4854
|
+
console.log(` Total Lines: ${total.padStart(8)}`);
|
|
4855
|
+
console.log(` Matched: ${matched.padStart(8)}`);
|
|
4856
|
+
console.log(` Unmatched: ${unmatched.padStart(8)}`);
|
|
4857
|
+
console.log(` Ignored: ${ignored.padStart(8)}`);
|
|
4858
|
+
console.log(` Opening Balance: ${formatAmount(openingBalance).padStart(14)}`);
|
|
4859
|
+
console.log(` Closing Balance: ${formatAmount(closingBalance).padStart(14)}`);
|
|
4860
|
+
console.log();
|
|
4861
|
+
} catch (e) {
|
|
4862
|
+
handleError3(e);
|
|
4863
|
+
}
|
|
4864
|
+
}
|
|
4865
|
+
async function bankReconRulesCommand(opts) {
|
|
4866
|
+
const cfg = requireAuth();
|
|
4867
|
+
const client = new HisaaboClient(cfg);
|
|
4868
|
+
try {
|
|
4869
|
+
const result = await client.bankRecon.ruleList();
|
|
4870
|
+
if (opts.json) {
|
|
4871
|
+
outputJSON(result);
|
|
4872
|
+
return;
|
|
4873
|
+
}
|
|
4874
|
+
const rules = Array.isArray(result) ? result : Array.isArray(result?.data) ? result.data : [];
|
|
4875
|
+
console.log("\n Bank Recon Rules\n");
|
|
4876
|
+
console.log(` ${"\u2550".repeat(60)}
|
|
4877
|
+
`);
|
|
4878
|
+
if (rules.length === 0) {
|
|
4879
|
+
console.log(" No rules configured.\n");
|
|
4880
|
+
return;
|
|
4881
|
+
}
|
|
4882
|
+
for (const rule of rules) {
|
|
4883
|
+
const id = String(rule["id"] ?? "-").slice(0, 8);
|
|
4884
|
+
const name = String(rule["name"] ?? "-").padEnd(25);
|
|
4885
|
+
const condition = String(rule["condition"] ?? rule["matchPattern"] ?? "-").padEnd(20);
|
|
4886
|
+
const action = String(rule["action"] ?? "-").padEnd(12);
|
|
4887
|
+
console.log(` ${id} ${name} ${condition} ${action}`);
|
|
4888
|
+
}
|
|
4889
|
+
console.log();
|
|
4890
|
+
} catch (e) {
|
|
4891
|
+
handleError3(e);
|
|
4892
|
+
}
|
|
4893
|
+
}
|
|
4894
|
+
|
|
4895
|
+
// src/bin/registrars/bank-recon.ts
|
|
4896
|
+
function registerBankReconCommands(program2) {
|
|
4897
|
+
const bankRecon = program2.command("bank-recon").description("Bank reconciliation");
|
|
4898
|
+
bankRecon.command("imports").description("List bank statement imports").option("--json", "JSON output").action(async (opts) => {
|
|
4899
|
+
await bankReconImportsCommand({ json: opts.json });
|
|
4900
|
+
});
|
|
4901
|
+
bankRecon.command("summary <importId>").description("Summary for a bank statement import").option("--json", "JSON output").action(async (importId, opts) => {
|
|
4902
|
+
await bankReconSummaryCommand(importId, { json: opts.json });
|
|
4903
|
+
});
|
|
4904
|
+
bankRecon.command("rules").description("List auto-matching rules").option("--json", "JSON output").action(async (opts) => {
|
|
4905
|
+
await bankReconRulesCommand({ json: opts.json });
|
|
4906
|
+
});
|
|
4907
|
+
}
|
|
4908
|
+
|
|
4909
|
+
// src/commands/einvoice/index.ts
|
|
4910
|
+
function handleError4(e) {
|
|
4911
|
+
if (e instanceof HisaaboApiError) {
|
|
4912
|
+
const err = e.hisaaboError;
|
|
4913
|
+
if (err.code === "unauthorized") fatalError("Session expired. Run: hisaabo login", EXIT.AUTH);
|
|
4914
|
+
if (err.code === "network_error") fatalError(err.message, EXIT.NETWORK);
|
|
4915
|
+
}
|
|
4916
|
+
fatalError(String(e instanceof Error ? e.message : e));
|
|
4917
|
+
}
|
|
4918
|
+
async function eInvoiceDashboardCommand(opts) {
|
|
4919
|
+
const cfg = requireAuth();
|
|
4920
|
+
const client = new HisaaboClient(cfg);
|
|
4921
|
+
try {
|
|
4922
|
+
const result = await client.eInvoice.dashboard({ fromDate: opts.from, toDate: opts.to });
|
|
4923
|
+
if (opts.json) {
|
|
4924
|
+
outputJSON(result);
|
|
4925
|
+
return;
|
|
4926
|
+
}
|
|
4927
|
+
const r = result;
|
|
4928
|
+
console.log("\n E-Invoice Dashboard\n");
|
|
4929
|
+
console.log(` ${"\u2550".repeat(50)}
|
|
4930
|
+
`);
|
|
4931
|
+
const generated = String(r["totalGenerated"] ?? r["generated"] ?? "0");
|
|
4932
|
+
const cancelled = String(r["totalCancelled"] ?? r["cancelled"] ?? "0");
|
|
4933
|
+
const failed = String(r["totalFailed"] ?? r["failed"] ?? "0");
|
|
4934
|
+
const pending = String(r["pending"] ?? "0");
|
|
4935
|
+
console.log(` Generated: ${generated.padStart(8)}`);
|
|
4936
|
+
console.log(` Cancelled: ${cancelled.padStart(8)}`);
|
|
4937
|
+
console.log(` Failed: ${failed.padStart(8)}`);
|
|
4938
|
+
console.log(` Pending: ${pending.padStart(8)}`);
|
|
4939
|
+
console.log();
|
|
4940
|
+
} catch (e) {
|
|
4941
|
+
handleError4(e);
|
|
4942
|
+
}
|
|
4943
|
+
}
|
|
4944
|
+
async function eInvoiceGenerateCommand(invoiceId, opts) {
|
|
4945
|
+
const cfg = requireAuth();
|
|
4946
|
+
const client = new HisaaboClient(cfg);
|
|
4947
|
+
try {
|
|
4948
|
+
const result = await client.eInvoice.generate({ invoiceId });
|
|
4949
|
+
if (opts.json) {
|
|
4950
|
+
outputJSON(result);
|
|
4951
|
+
return;
|
|
4952
|
+
}
|
|
4953
|
+
const r = result;
|
|
4954
|
+
const irn = String(r["irn"] ?? r["invoiceReferenceNumber"] ?? "-");
|
|
4955
|
+
const ackNo = String(r["ackNo"] ?? r["acknowledgementNumber"] ?? "-");
|
|
4956
|
+
console.log(` E-Invoice generated.
|
|
4957
|
+
`);
|
|
4958
|
+
console.log(` IRN: ${irn}`);
|
|
4959
|
+
console.log(` ACK: ${ackNo}`);
|
|
4960
|
+
console.log();
|
|
4961
|
+
} catch (e) {
|
|
4962
|
+
handleError4(e);
|
|
4963
|
+
}
|
|
4964
|
+
}
|
|
4965
|
+
async function eInvoiceCancelCommand(invoiceId, opts) {
|
|
4966
|
+
const cfg = requireAuth();
|
|
4967
|
+
const client = new HisaaboClient(cfg);
|
|
4968
|
+
try {
|
|
4969
|
+
const result = await client.eInvoice.cancel({ invoiceId, cancelReason: opts.reason ?? "1" });
|
|
4970
|
+
if (opts.json) {
|
|
4971
|
+
outputJSON(result);
|
|
4972
|
+
return;
|
|
4973
|
+
}
|
|
4974
|
+
console.log(` E-Invoice for ${invoiceId} cancelled.
|
|
4975
|
+
`);
|
|
4976
|
+
} catch (e) {
|
|
4977
|
+
handleError4(e);
|
|
4978
|
+
}
|
|
4979
|
+
}
|
|
4980
|
+
async function eInvoiceRetryCommand(invoiceId, opts) {
|
|
4981
|
+
const cfg = requireAuth();
|
|
4982
|
+
const client = new HisaaboClient(cfg);
|
|
4983
|
+
try {
|
|
4984
|
+
const result = await client.eInvoice.retryFailed({ invoiceId });
|
|
4985
|
+
if (opts.json) {
|
|
4986
|
+
outputJSON(result);
|
|
4987
|
+
return;
|
|
4988
|
+
}
|
|
4989
|
+
const r = result;
|
|
4990
|
+
const status = String(r["status"] ?? "queued");
|
|
4991
|
+
console.log(` Retry queued for invoice ${invoiceId}. Status: ${status}
|
|
4992
|
+
`);
|
|
4993
|
+
} catch (e) {
|
|
4994
|
+
handleError4(e);
|
|
4995
|
+
}
|
|
4996
|
+
}
|
|
4997
|
+
|
|
4998
|
+
// src/bin/registrars/einvoice.ts
|
|
4999
|
+
function registerEInvoiceCommands(program2) {
|
|
5000
|
+
const einvoice = program2.command("einvoice").description("E-Invoice (IRP) management");
|
|
5001
|
+
einvoice.command("dashboard").description("E-invoice generation summary").option("--json", "JSON output").option("--from <date>", "From date").option("--to <date>", "To date").action(async (opts) => {
|
|
5002
|
+
await eInvoiceDashboardCommand(opts);
|
|
5003
|
+
});
|
|
5004
|
+
einvoice.command("generate <invoiceId>").description("Generate an e-invoice (get IRN from IRP)").option("--json", "JSON output").action(async (invoiceId, opts) => {
|
|
5005
|
+
await eInvoiceGenerateCommand(invoiceId, { json: opts.json });
|
|
5006
|
+
});
|
|
5007
|
+
einvoice.command("cancel <invoiceId>").description("Cancel an e-invoice").option("--json", "JSON output").option("--reason <code>", "Cancel reason code (1-4)").action(async (invoiceId, opts) => {
|
|
5008
|
+
await eInvoiceCancelCommand(invoiceId, { json: opts.json, reason: opts.reason });
|
|
5009
|
+
});
|
|
5010
|
+
einvoice.command("retry <invoiceId>").description("Retry a failed e-invoice generation").option("--json", "JSON output").action(async (invoiceId, opts) => {
|
|
5011
|
+
await eInvoiceRetryCommand(invoiceId, { json: opts.json });
|
|
5012
|
+
});
|
|
5013
|
+
}
|
|
5014
|
+
|
|
5015
|
+
// src/commands/ewb/index.ts
|
|
5016
|
+
function handleError5(e) {
|
|
5017
|
+
if (e instanceof HisaaboApiError) {
|
|
5018
|
+
const err = e.hisaaboError;
|
|
5019
|
+
if (err.code === "unauthorized") fatalError("Session expired. Run: hisaabo login", EXIT.AUTH);
|
|
5020
|
+
if (err.code === "network_error") fatalError(err.message, EXIT.NETWORK);
|
|
5021
|
+
}
|
|
5022
|
+
fatalError(String(e instanceof Error ? e.message : e));
|
|
5023
|
+
}
|
|
5024
|
+
async function ewbDashboardCommand(opts) {
|
|
5025
|
+
const cfg = requireAuth();
|
|
5026
|
+
const client = new HisaaboClient(cfg);
|
|
5027
|
+
try {
|
|
5028
|
+
const result = await client.ewayBill.dashboard({ fromDate: opts.from, toDate: opts.to });
|
|
5029
|
+
if (opts.json) {
|
|
5030
|
+
outputJSON(result);
|
|
5031
|
+
return;
|
|
5032
|
+
}
|
|
5033
|
+
const r = result;
|
|
5034
|
+
console.log("\n E-Way Bill Dashboard\n");
|
|
5035
|
+
console.log(` ${"\u2550".repeat(50)}
|
|
5036
|
+
`);
|
|
5037
|
+
const generated = String(r["totalGenerated"] ?? r["generated"] ?? "0");
|
|
5038
|
+
const cancelled = String(r["totalCancelled"] ?? r["cancelled"] ?? "0");
|
|
5039
|
+
const expired = String(r["totalExpired"] ?? r["expired"] ?? "0");
|
|
5040
|
+
const active = String(r["active"] ?? "0");
|
|
5041
|
+
console.log(` Generated: ${generated.padStart(8)}`);
|
|
5042
|
+
console.log(` Active: ${active.padStart(8)}`);
|
|
5043
|
+
console.log(` Cancelled: ${cancelled.padStart(8)}`);
|
|
5044
|
+
console.log(` Expired: ${expired.padStart(8)}`);
|
|
5045
|
+
console.log();
|
|
5046
|
+
} catch (e) {
|
|
5047
|
+
handleError5(e);
|
|
5048
|
+
}
|
|
5049
|
+
}
|
|
5050
|
+
async function ewbGenerateCommand(invoiceId, opts) {
|
|
5051
|
+
const cfg = requireAuth();
|
|
5052
|
+
const client = new HisaaboClient(cfg);
|
|
5053
|
+
try {
|
|
5054
|
+
const result = await client.ewayBill.generate({ invoiceId });
|
|
5055
|
+
if (opts.json) {
|
|
5056
|
+
outputJSON(result);
|
|
5057
|
+
return;
|
|
5058
|
+
}
|
|
5059
|
+
const r = result;
|
|
5060
|
+
const ewbNo = String(r["eWayBillNo"] ?? r["ewbNumber"] ?? r["ewbNo"] ?? "-");
|
|
5061
|
+
const validUpto = String(r["validUpto"] ?? r["validTill"] ?? "-");
|
|
5062
|
+
console.log(` E-Way Bill generated.
|
|
5063
|
+
`);
|
|
5064
|
+
console.log(` EWB No: ${ewbNo}`);
|
|
5065
|
+
console.log(` Valid Upto: ${validUpto}`);
|
|
5066
|
+
console.log();
|
|
5067
|
+
} catch (e) {
|
|
5068
|
+
handleError5(e);
|
|
5069
|
+
}
|
|
5070
|
+
}
|
|
5071
|
+
async function ewbExpiringCommand(opts) {
|
|
5072
|
+
const cfg = requireAuth();
|
|
5073
|
+
const client = new HisaaboClient(cfg);
|
|
5074
|
+
try {
|
|
5075
|
+
const result = await client.ewayBill.expiringList({ withinDays: opts.days ?? 3 });
|
|
5076
|
+
if (opts.json) {
|
|
5077
|
+
outputJSON(result);
|
|
5078
|
+
return;
|
|
5079
|
+
}
|
|
5080
|
+
const bills = Array.isArray(result) ? result : Array.isArray(result?.data) ? result.data : [];
|
|
5081
|
+
console.log(`
|
|
5082
|
+
Expiring E-Way Bills (within ${opts.days ?? 3} days)
|
|
5083
|
+
`);
|
|
5084
|
+
console.log(` ${"\u2550".repeat(65)}
|
|
5085
|
+
`);
|
|
5086
|
+
if (bills.length === 0) {
|
|
5087
|
+
console.log(" No expiring e-way bills.\n");
|
|
5088
|
+
return;
|
|
5089
|
+
}
|
|
5090
|
+
for (const bill of bills) {
|
|
5091
|
+
const ewbNo = String(bill["eWayBillNo"] ?? bill["ewbNumber"] ?? "-").padEnd(14);
|
|
5092
|
+
const invoiceNo = String(bill["invoiceNumber"] ?? bill["invoice"] ?? "-").padEnd(14);
|
|
5093
|
+
const party = String(bill["partyName"] ?? bill["party"] ?? "-").padEnd(22);
|
|
5094
|
+
const validUpto = formatDate(String(bill["validUpto"] ?? bill["validTill"] ?? ""));
|
|
5095
|
+
console.log(` ${ewbNo} ${invoiceNo} ${party} Expires: ${validUpto}`);
|
|
5096
|
+
}
|
|
5097
|
+
console.log();
|
|
5098
|
+
} catch (e) {
|
|
5099
|
+
handleError5(e);
|
|
5100
|
+
}
|
|
5101
|
+
}
|
|
5102
|
+
|
|
5103
|
+
// src/bin/registrars/ewb.ts
|
|
5104
|
+
function registerEwbCommands(program2) {
|
|
5105
|
+
const ewb = program2.command("ewb").description("E-Way Bill management");
|
|
5106
|
+
ewb.command("dashboard").description("E-way bill summary dashboard").option("--json", "JSON output").option("--from <date>", "From date").option("--to <date>", "To date").action(async (opts) => {
|
|
5107
|
+
await ewbDashboardCommand(opts);
|
|
5108
|
+
});
|
|
5109
|
+
ewb.command("generate <invoiceId>").description("Generate an e-way bill for an invoice").option("--json", "JSON output").action(async (invoiceId, opts) => {
|
|
5110
|
+
await ewbGenerateCommand(invoiceId, { json: opts.json });
|
|
5111
|
+
});
|
|
5112
|
+
ewb.command("expiring").description("List e-way bills expiring soon").option("--json", "JSON output").option("--days <n>", "Within N days (default: 3)", parseInt).action(async (opts) => {
|
|
5113
|
+
await ewbExpiringCommand({ json: opts.json, days: opts.days });
|
|
5114
|
+
});
|
|
5115
|
+
}
|
|
5116
|
+
|
|
4280
5117
|
// src/bin/hisaabo.ts
|
|
4281
5118
|
var program = new Command();
|
|
4282
|
-
var cliVersion = true ? "0.5
|
|
5119
|
+
var cliVersion = true ? "0.7.5" : "dev";
|
|
4283
5120
|
program.name("hisaabo").description("Hisaabo CLI \u2014 Invoicing and business management").version(cliVersion);
|
|
4284
5121
|
registerAuthCommands(program);
|
|
4285
5122
|
registerDashboardCommands(program);
|
|
@@ -4301,6 +5138,11 @@ registerDocumentCommands(program);
|
|
|
4301
5138
|
registerTenantCommands(program);
|
|
4302
5139
|
registerApiKeyCommands(program);
|
|
4303
5140
|
registerSessionCommands(program);
|
|
5141
|
+
registerJournalCommands(program);
|
|
5142
|
+
registerItcCommands(program);
|
|
5143
|
+
registerBankReconCommands(program);
|
|
5144
|
+
registerEInvoiceCommands(program);
|
|
5145
|
+
registerEwbCommands(program);
|
|
4304
5146
|
program.parseAsync(process.argv).catch((err) => {
|
|
4305
5147
|
fatalError(String(err instanceof Error ? err.message : err));
|
|
4306
5148
|
});
|