Commit graph

52 commits

Author SHA1 Message Date
John Wiegley
991e3a3eaf Split commodity.h/cc into three files
commodity.h - code for commodity_t
annotate.h  - commodity annotations
pool.h      - commodity pool management
2009-06-24 16:43:46 +01:00
John Wiegley
dabbd2c974 Fixes to the 'xact' command (used to be 'entry') 2009-06-19 00:00:57 +01:00
John Wiegley
110f0b8023 Enabled use of pre-compiled headers by default 2009-03-10 17:02:03 -04:00
John Wiegley
2728e4d55e Changed the way that account balances are computed 2009-03-06 00:27:29 -04:00
John Wiegley
c11d325712 Reduced the #include dependency tree to a minimum 2009-03-04 23:53:43 -04:00
John Wiegley
9d4e888ef5 Cured several harmless compiler warnings 2009-03-04 04:31:34 -04:00
John Wiegley
2d63c9364a Changed many assert() calls to VERIFY() 2009-03-04 04:29:10 -04:00
John Wiegley
1540ccec01 Gather account details in a details_t structure 2009-03-03 20:28:09 -04:00
John Wiegley
38122c2224 Corrected warnings g++-4.3.3 was complaining about 2009-02-28 04:54:54 -04:00
John Wiegley
cbd66ba1c9 Changed "priced" to "cost_calculated" for clarity 2009-02-27 15:32:38 -04:00
John Wiegley
f1795e628b Fixed bugs relating to sign and rounding of costs 2009-02-27 03:45:32 -04:00
John Wiegley
06365aac05 Fixed the way item state is parsed and managed 2009-02-27 02:35:51 -04:00
John Wiegley
a0d8d84b87 Print more context if an automated xact fails 2009-02-26 05:39:13 -04:00
John Wiegley
238bd7f8a5 Marked all strings needing internationalization
These strings are now collected automagically in the file po/ledger.pot.
If you'd like to produce a translation, just run this command after
building Ledger:

    msginit -l LOCALE -o LANG.po -i po/ledger.pot

Where LOCALE is a string like de or en_GB, and LANG is a short
descriptive word for your language.

Then send me this .po file so I can commit it to the Ledger sources
(alternatively, you could maintain the file in a fork on GitHub), and
setup the build script to format and install your new message catalog
during a "make install".
2009-02-25 03:51:42 -04:00
John Wiegley
38dd1b8655 Fixed an issue involving costs and reduced values 2009-02-24 13:29:08 -04:00
John Wiegley
eb364f4183 Improved the way that entries are balanced 2009-02-24 03:03:04 -04:00
John Wiegley
625b94cf04 Switched from using POST_AUTO to ITEM_GENERATED 2009-02-24 02:23:20 -04:00
John Wiegley
cb751913ef Fixed a minor bug in handling of automated xacts
There was a if statement with an inverse boolean meaning, which caused
some automated transaction postings to have a null amount.
2009-02-23 19:20:57 -04:00
John Wiegley
944c63e6f2 The Great Renaming, Part II
The last commit did not contain the majority of changes because of a
slight mishap.  This contains the real changeset.
2009-02-23 19:07:30 -04:00
John Wiegley
9f53efbf5f Many fixes to both --market and --exchange 2009-02-23 01:51:23 -04:00
John Wiegley
e124811d8a Added --exchange (-x) option
This is like -V, except it lets you specify the goal commodity to report
in terms of, for example:

    reg -x CAD
2009-02-22 04:51:11 -04:00
John Wiegley
1f39d4148e Create a new interactive_t helper class
The purpose of this class is much like Emacs' (interactive) form: it
allows a value expression function to declare exactly how many
arguments, and of what type, it intends to receive.  It then offers
type-safe access to theese arguments in a consistent manner.

An example value expression function definition in C++:

    value_t fn_foo(call_scope_t& scope) {
      // We expect a string, an integer, and an optional date
      interactive_t args(scope, "sl&d");

      std::cout << "String  = " << args.get<string>(0)
                << "Integer = " << args.get<long>(1) << std::endl;

      if (args.has(2)) // was a date provided?
        std::cout << "Date    = " << args.get<date_t>(2) << std::endl;

      return NULL_VALUE;
    }

There is also an in_context_t<T> template, which finds the context type
T in the current scope hierarchy.  The in_context_t then also acts as a
smart pointer to reference this context object, in addition to serving
the same duty as interactive_t.  This combination of intent is solely
for the sake of brevity.

    value_t fn_bar(call_scope_t& scope) {
      in_context_t<account_t> env(scope, "sl&d");
      std::cout << "Account name = " << env->fullname()
                << "String arg   = " << env.get<string>(0)
                << std::endl;
      return NULL_VALUE;
    }

As you can see here, 'env' acts as a smart pointer to the required
context, and an object to extract the typed arguments.
2009-02-21 18:49:43 -04:00
John Wiegley
1c616f8626 If a transaction's total is null, return 0 instead 2009-02-19 15:51:14 -04:00
John Wiegley
db0689f547 Added a "commodity" valexpr variable for xacts 2009-02-16 20:56:50 -04:00
John Wiegley
053ecc9366 Fixed a possible problem with xact_t::date() 2009-02-16 18:06:30 -04:00
John Wiegley
e32129b25c Provide a "depth" variable for xacts 2009-02-15 22:36:12 -04:00
John Wiegley
fcd7f4f73b Removed "total_cost" valexpr, and value_t::cost
Since cost reports are now calculated by setting the amount_ expression,
there is no need to track a separate "total cost" entity.
2009-02-15 16:26:26 -04:00
John Wiegley
5fc1f9dce9 Corrected double problem in period reports
xact_t::add_to_value, in cases where the xact had a "compound" total,
was adding transaction values to the running total twice.
2009-02-15 15:43:13 -04:00
John Wiegley
03219d910f Added xact_t::count member
This allows reports to access the "whicheth" index of the reported
transaction.  It's used mainly by the --average report, which divides
the running total by this count to get the arithmetic mean.
2009-02-15 15:41:24 -04:00
John Wiegley
ee5e0600aa xact metadata searches get passed up to the entry
That is, if a metadata tag cannot be found in a transaction, look in the
parent entry to see if it was set there.  Transactions "inherit"
notational details from their entries.
2009-02-14 05:37:53 -04:00
John Wiegley
1933bb2ead Restored the --actual and --real options 2009-02-14 04:46:53 -04:00
John Wiegley
b345a45c9b Don't print an xact's amount if it was calculated
That is, if the user didn't enter an amount for that transaction in
their ledger journal, don't print one out either.
2009-02-13 18:33:28 -04:00
John Wiegley
c8cd2c468e Re-enabled some code, and removed a bunch of deadwood. 2009-02-12 03:30:41 -04:00
John Wiegley
1a030da55d Rewrote the "entry" command. It's ALIVE! 2009-02-11 19:14:23 -04:00
John Wiegley
8a855f9b44 Fix to handling of effective dates in xact_t::date(). 2009-02-09 18:11:58 -04:00
John Wiegley
02110394b4 Use the report's amount_expr everywhere that computes an xact's amount. 2009-02-09 14:53:29 -04:00
John Wiegley
ffba456113 Several fixes to get the state flags to appear right in "print". 2009-02-07 23:30:40 -04:00
John Wiegley
aea84dd9c5 Added two comments, to remind myself to check something. 2009-02-06 23:37:25 -04:00
John Wiegley
2d941730b1 Largely removed all of Ledger's use of global variables, for the REPL's sake. 2009-02-04 19:55:27 -04:00
John Wiegley
9540406af1 Simplified error context handling. 2009-02-02 00:24:26 -04:00
John Wiegley
fb5428ce85 Added support for metadata and tagging, and made regexs a first-class type. 2009-02-01 22:10:32 -04:00
John Wiegley
05c77351e4 Stopped using the generic "unsigned int" in favor of more specific types. 2009-01-29 18:23:57 -04:00
John Wiegley
887828a40c Increased copyright range to include 2009. 2009-01-20 01:53:31 -04:00
John Wiegley
14b3eb89f5 Added methods for getting the cost of an xact. 2009-01-19 22:23:45 -04:00
John Wiegley
091144e5e8 Don't look for an xact's state in its entry if there isn't one. 2009-01-19 22:23:27 -04:00
John Wiegley
fdc7a4e4c5 Factored common parts of entry_t and xact_t into new item_t 2008-09-19 08:06:20 -04:00
John Wiegley
24e64c202e Added the 'note' value expression identifier. 2008-09-17 21:08:54 -04:00
John Wiegley
41c33a2442 Restored --cleared, --pending, --uncleared, -X and -Y. 2008-09-16 05:05:23 -04:00
John Wiegley
9a98beab38 Added 'code' value expression function for xacts and entries. 2008-09-14 19:39:26 -04:00
John Wiegley
6a82e12ab4 get_amount should return the xdata value if the EXT_COMPOUND flag is on. 2008-08-14 02:40:09 -04:00