#!/bin/bash -e

org2tc "$@"
    | ledger -f - --day-break print > /tmp/work.dat

echo
echo Daily totals
echo ================================================================================

ledger -f /tmp/work.dat                          \
    --columns=80 --day-break --daily            \
    --base --total='(1.00 hrs*amount)/3600'     \
    --sort date --collapse reg

echo
echo Daily breakdown
echo ================================================================================

ledger -f /tmp/work.dat                          \
    --columns=80 --day-break --daily            \
    --base --total='(1.00 hrs*amount)/3600'     \
    --sort date reg

echo
echo Weekly totals
echo ================================================================================

ledger -f /tmp/work.dat --weekly                 \
    --columns=80 --day-break                    \
    --base --total='(1.00 hrs*total)/3600'      \
    --sort date bal

echo

echo Allocations
echo ================================================================================

ledger -f /tmp/work.dat bal --base --percent --depth=1
echo

ledger -f /tmp/work.dat bal --base --percent --depth=2 55AJK