From aefb19c98b357d841b35915895be95683edeb28a Mon Sep 17 00:00:00 2001 From: David Whiting Date: Sat, 12 Aug 2023 16:10:02 +0100 Subject: [PATCH] Added additional expansion formats Added expansion formats for amount1 and amount2, and date1 and date2. These can be used to find transactions with exact amounts or on exact dates, or in ranges. For example, to show transactions between two dates, in the ledger reports you can use: %(binary) -f %(ledger-file) reg %(account) --display 'd>= [%(date1)] and d <= [%(date2)]' --- ledger-report.el | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/ledger-report.el b/ledger-report.el index f628e893..29acd7bb 100644 --- a/ledger-report.el +++ b/ledger-report.el @@ -70,6 +70,10 @@ specifier." ("payee" . ledger-report-payee-format-specifier) ("account" . ledger-report-account-format-specifier) ("month" . ledger-report-month-format-specifier) + ("amount1" . ledger-report-amount1-format-specifier) + ("amount2" . ledger-report-amount2-format-specifier) + ("date1" . ledger-report-date1-format-specifier) + ("date2" . ledger-report-date2-format-specifier) ("tagname" . ledger-report-tagname-format-specifier) ("tagvalue" . ledger-report-tagvalue-format-specifier)) "An alist mapping ledger report format specifiers to implementing functions. @@ -253,6 +257,22 @@ See documentation for the function `ledger-master-file'") ;; values, but it remains to be implemented. (ledger-read-string-with-default "Tag Value: " nil)) +(defun ledger-report-amount1-format-specifier () + "Return an amount." + (ledger-read-string-with-default "Amount: " nil)) + +(defun ledger-report-amount2-format-specifier () + "Return an amount." + (ledger-read-string-with-default "Second amount: " nil)) + +(defun ledger-report-date1-format-specifier () + "Return a date." + (ledger-read-string-with-default "Date: " nil)) + +(defun ledger-report-date2-format-specifier () + "Return a date." + (ledger-read-string-with-default "Second date: " nil)) + (defun ledger-report-read-name () "Read the name of a ledger report to use, with completion.