Re: Profit calculation and balance report in XML

2017-09-23 Thread Yuri Khan
On Sun, Sep 24, 2017 at 6:42 AM, Ivanov Dmitry  wrote:
> Suppose, we have the following ledger file:
>
> 2017-03-01 *
> Assets:Bank account $1000
> Equity:Opening Balances
>
> 2017-03-02
> Expenses:Materials  $200
> Assets:Bank account
>
> 2017-03-04
> Expenses:Salary $300
> Assets:Bank account
>
> 2017-03-04
> Assets:Bank account $600
> Income
>
> Can ledger calculate the profit earned by formula: -Income - Sum(Expenses)?
>
> So, it will be: Profit = -(-600) - 500 = 600 - 500 = 100

You can use the “ledger register” command with a query to limit the
report to income and expenses accounts.

$ ledger -f test.ledger reg '^Expenses|^Income'
2017-03-02   Expenses:Materials  $200   $200
2017-03-04   Expenses:Salary $300   $500
2017-03-04   Income $-600  $-100

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Opening Balances problem

2017-09-23 Thread Richard Lawrence

Hi Filipo,

Filipo V  writes:

Hi all, I'm new to ledger and I'm frustrated I can't figure out 
what I've  done wrong to begin with. 

Here is part of my file: 

2015/05/27 * Opening Balance 
Assets:BankA:Current 482.40 Equity:Opening Balances 

Now, when I try to run the basic balance command, I get this: 

While parsing file "myledger.dat", line 6: Error: Posting with 
null amount's account may be misspelled: 
  "Assets:BankA:Current 482.40" 

Can anyone help? 


Looks like the problem here is that you only have one space 
between the account name and the amount.  Since spaces are allowed 
in account names, you must have at least two spaces between the 
account name and the amount.


Hope that helps!

--
Best,
Richard

--

--- 
You received this message because you are subscribed to the Google Groups "Ledger" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Profit calculation and balance report in XML

2017-09-23 Thread Ivanov Dmitry
Suppose, we have the following ledger file:

2017-03-01 *
Assets:Bank account $1000
Equity:Opening Balances

2017-03-02
Expenses:Materials  $200
Assets:Bank account

2017-03-04
Expenses:Salary $300
Assets:Bank account

2017-03-04
Assets:Bank account $600
Income

Can ledger calculate the profit earned by formula: -Income - Sum(Expenses)?

So, it will be: Profit = -(-600) - 500 = 600 - 500 = 100

Or can ledger give me a balance report in xml or other machine readable 
format, so I could write a program that will do the calculation?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Opening Balances problem

2017-09-23 Thread Filipo V
Hi all, I'm new to ledger and I'm frustrated I can't figure out what I've 
done wrong to begin with.

Here is part of my file:

2015/05/27 * Opening Balance
Assets:BankA:Current 482.40
Equity:Opening Balances

Now, when I try to run the basic balance command, I get this:

While parsing file "myledger.dat", line 6:
Error: Posting with null amount's account may be misspelled:
  "Assets:BankA:Current 482.40"

Can anyone help?

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: transaction with multiple tags

2017-09-23 Thread John Wiegley
> "JW" == Justin Woody  writes:

JW> I got that output by breaking it into 2 transactions:
JW> 2017/03/07 (1000) Check from Customer
JW> ; INV: 0001
JW> Assets:Accounts Receivable:Customer   $-1000.00
JW> Assets:Checking:FOO

I wonder if part of the problem is that you're mixing transaction tags with
posting tags:

2017/03/07 (1000) Check from Customer
; INV: 0001
Assets:Accounts Receivable:Customer   $-1000.00
; INV: 0001
Assets:Checking:FOO

Here the first metadata is apply to every posting in the transaction; in the
second case, it's only applied to the first posting.

And thanks, I'm glad you're enjoying Ledger! :)

-- 
John Wiegley  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com  60E1 46C4 BD1A 7AC1 4BA2

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: transaction with multiple tags

2017-09-23 Thread Justin Woody
Something like this:
$ ledger -f foo.dat bal '--account=tag("INV")'
   0  0001
$1000.00Assets:Checking:FOO
   $-1000.00Income:Customer
   0  0002
$1200.00Assets:Checking:FOO
   $-1200.00Income:Customer
 $250.00  Assets:Checking:FOO
$-250.00  Equity:Opening Balances

   0

I got that output by breaking it into 2 transactions:
2017/03/07 (1000) Check from Customer
; INV: 0001
Assets:Accounts Receivable:Customer   $-1000.00
Assets:Checking:FOO

2017/03/07 (1000) Check from Customer
; INV: 0002
Assets:Accounts Receivable:Customer   $-1200.00
Assets:Checking:FOO

Thanks for the quick reply. Ledger is great btw, appreciate all the work 
you've put into it.

Justin


On Saturday, September 23, 2017 at 10:58:44 AM UTC-4, John Wiegley wrote:
>
> > "JW" == Justin Woody  writes: 
>
> JW> The output for individual invoices gets a little confusing: 
> JW> $ ledger -f foo.dat bal '--account=tag("INV")' 
> JW> $2200.00  0001 
> JW> $3200.00Assets 
> JW> $1000.00  Accounts Receivable:Customer 
> JW> $2200.00  Checking:FOO 
> JW>$-1000.00Income:Customer 
> JW>$-1000.00  0002 
> JW>  $200.00Assets:Accounts Receivable:Customer 
> JW>$-1200.00Income:Customer 
> JW> $-950.00  Assets 
> JW>$-1200.00Accounts Receivable:Customer 
> JW>  $250.00Checking:FOO 
> JW> $-250.00  Equity:Opening Balances 
> JW>  
> JW>0 
> JW> Is there a way to accomplish this in a single transaction and have the 
> JW> respective amounts applied to the invoices? Appreciate the help. 
>
> What output did you want to see? 
>
> -- 
> John Wiegley  GPG fingerprint = 4710 CF98 AF9B 327B B80F 
> http://newartisans.com  60E1 46C4 BD1A 7AC1 4BA2 
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: transaction with multiple tags

2017-09-23 Thread John Wiegley
> "JW" == Justin Woody  writes:

JW> The output for individual invoices gets a little confusing:
JW> $ ledger -f foo.dat bal '--account=tag("INV")'
JW> $2200.00  0001
JW> $3200.00Assets
JW> $1000.00  Accounts Receivable:Customer
JW> $2200.00  Checking:FOO
JW>$-1000.00Income:Customer
JW>$-1000.00  0002
JW>  $200.00Assets:Accounts Receivable:Customer
JW>$-1200.00Income:Customer
JW> $-950.00  Assets
JW>$-1200.00Accounts Receivable:Customer
JW>  $250.00Checking:FOO
JW> $-250.00  Equity:Opening Balances
JW> 
JW>0
JW> Is there a way to accomplish this in a single transaction and have the 
JW> respective amounts applied to the invoices? Appreciate the help.

What output did you want to see?

-- 
John Wiegley  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com  60E1 46C4 BD1A 7AC1 4BA2

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


transaction with multiple tags

2017-09-23 Thread Justin Woody
Hi there,

I've been trying to work through a reporting scenario with tags and haven't 
found a solution. Sometimes a customer will pay multiple invoices at one 
time and I'd like to be able to report on invoices individually or 
collectively:
$ cat foo.dat 
2017/01/01 Opening Balance
Assets:Checking:FOO  $250.00
Equity:Opening Balances

2017/01/31=2017/03/07 Customer invoice 
; INV: 0001
Assets:Accounts Receivable:Customer$1000.00
Income:Customer

2017/02/28=2017/03/07 Customer invoice 
; INV: 0002
Assets:Accounts Receivable:Customer$1200.00
Income:Customer

2017/03/07 (1000) Check from Customer
Assets:Checking:FOO$2200.00
; INV: 0001
Assets:Accounts Receivable:Customer   $-1000.00
; INV: 0002
Assets:Accounts Receivable:Customer   $-1200.00
 
This balances correctly:
$ ledger -f foo.dat bal
$2450.00  Assets:Checking:FOO
$-250.00  Equity:Opening Balances
   $-2200.00  Income:Customer

   0

The output for individual invoices gets a little confusing:
$ ledger -f foo.dat bal '--account=tag("INV")'
$2200.00  0001
$3200.00Assets
$1000.00  Accounts Receivable:Customer
$2200.00  Checking:FOO
   $-1000.00Income:Customer
   $-1000.00  0002
 $200.00Assets:Accounts Receivable:Customer
   $-1200.00Income:Customer
$-950.00  Assets
   $-1200.00Accounts Receivable:Customer
 $250.00Checking:FOO
$-250.00  Equity:Opening Balances

   0
Is there a way to accomplish this in a single transaction and have the 
respective amounts applied to the invoices? Appreciate the help.

Justin

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ledger-cli+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.