NAME

outgoing - A script to help with financial planning


SYNOPSIS

outgoing [-hdvS] [-o out] [-c file] [-T time]

OutGoing is a hacked together perl script designed to aid in financial planning. It is designed to take in a list of your regular monthly outgoings and generate a lump of HTML which shows:

o
The total amount of money going out for the month

o
A break down on a week-by-week basis of the money which goes out

o
Shows you what payments are left to go out during the remainder of the month


OPTIONS

Supported options are:

-h
Display usage information

-v
Verbose mode

-d
Debugging mode; shows even more output than verbose mode. Also enables verbose mode.

-S
Disable time-shifting of direct debit and standing orders. By default any direct debits or standing orders which fall on a weekend are shifted to the start of the next week. Specify this option to disable this.

-o out
Write output to the named file rather than standard out

-c file
The configuration file to use; the default is called outgoing.pl within the current working directory.

-T time
Specify the current time. The default is the time now. The time can be specified in a number of ways:
o
Specify the date exactly:
+
YYYY/MM/DD

+
YYYY-MM-DD

+
YYYYMMDD

o
Specify the month and day to use within the current year: MMDD

o
Specify the day to use within the current month and year: DD

p
Specify a modifier to the current date by using the following:
  [+-]{number}(d|w|y)

This can be used to specify a number of days (d), weeks (w) or years (y) to go forward to backwards from the current date. If the sign is not given then + is assumed.


RUNNING

This script is designed to be either run by hand or by cron in the following manner:

  outgoing -c config -o html

My current prefered way of working is for cron to run the script across my configuration file at 3am every morning; it would perhaps make more sense to run it on every monday morning since changes only happen week to week. Thus the following crontab entry could be suitable:

  # Work out outgoing money, 3am every monday morning
  0 3 * * 1 /usr/local/bin/outgoing -c /home/user/outgoing.pl -o /home/user/outgoing.html


CONFIGURATION FILE

The configuration file for this script is actually a lump of perl which is require()'ed into being within the script. As such it needs to follow all of the normal perl syntax rules and since it is pulled in using require() the file should have a 1; on its last line.

Currently there are three variables which should be defined:

$MonthStart
The day the month is considered to start; ie when your pay day is.

$MoneyIn
How much money you have coming in; ie generally the amount you are paid every month. If this is set to a numeric value then the amount of money ``spare'' for that month will be displayed. Set this to undef to disable this.

$CURR
The text used to denote your currency. This is just placed within the HTML generated so you should use suitable HTML for your currency symbol, ie for a UK pound sign you'd use: £ and for US dollars you'd just use \$ - note the escape of the $ since the normal quoting rules of perl apply.

@Out
This is the important part of the configuration file. This is a list where each node is a hash which describes an outgoing item. The required keys in these hashs are:
  name - The name given to the outgoing item. Blank values
         will be ignored
  stmt - What is shown on your bank statement. If this is not valid
         for the entry (ie its cash) then use undef.
  when - When the payment occurs. This can be one of two
         things:
          "m" - A monthly payment, requires a "date" key
          "w" - A weekly payment
  date - When in the month the payment occurs. This is
         only valid for "when" values of "m". Use undef for any
         other value of "when".
  type - The type of payment. This can be one of:
          "c"  - Cash
          "cc" - Credit card
          "dd" - Direct debit
          "so" - Standing order
          "tr" - Money transfer
  amt  - The amount of money which is paid out

For example the following configuration file is for someone in the UK who gets paid on the 25th of every month.

  $MonthStart = 25;

  $CURR = "£";

  @Out = (
          {
                  name    =>      "Water rates",
                  stmt    =>      "The Water Co",
                  when    =>      "m",
                  date    =>      "7",
                  type    =>      "dd",
                  amt     =>      20,
          },
          {
                  name    =>      "Gas",
                  stmt    =>      "The Gas Co",
                  when    =>      "m",
                  date    =>      "20",
                  type    =>      "dd",
                  amt     =>      40,
          },
          {
                  name    =>      "Council tax",
                  stmt    =>      "Local City Cou",
                  when    =>      "m",
                  date    =>      "7",
                  type    =>      "dd",
                  amt     =>      100,
          },
          {
                  name    =>      "Food shopping",
                  stmt    =>      undef,
                  when    =>      "w",
                  date    =>      undef,
                  type    =>      "c",
                  amt     =>      60,
          },
          {
                  name    =>      "Petrol",
                  stmt    =>      undef,
                  when    =>      "w",
                  date    =>      undef,
                  type    =>      "c",
                  amt     =>      30,
          },
  );

  1;

It should be noted that entries with a blank ``name'' value will be ignored.


DESCRIPTION

This script is designed to help with week-by-week financial planning by showing you how much money needs to be paid out over the month on a week-by-week basis.

It takes a perl-based configuration file and outputs HTML to either its standard output or a file. The features it currently supports are:

o
A starting point of your pay day. Note that pay is traditionally given to employees on a monthly basis in the UK.

o
Routine credit card payments

o
Routine direct debits

o
Payments made every week (ie food shopping)

o
Detection of months which contain five weeks; this does make some sense if you think about it. For example if you have a look at the following months from 2003:
           Aug                    Sep
   S  M Tu  W Th  F  S    S  M Tu  W Th  F  S
                  1  2       1  2  3  4  5  6
   3  4  5  6  7  8  9    7  8  9 10 11 12 13
  10 11 12 13 14 15 16   14 15 16 17 18 19 20
  17 18 19 20 21 22 23   21 22 23 24 25 26 27
  24 25 26 27 28 29 30   28 29 30
  31

If you are paid on the 25th of each month then full weeks you have to worry about having money for start on:

 o 25th August
 o 1st September
 o 8th September
 o 15th September
 o 22th September

In other words, a five week month.


DATE SHIFTING

``Date Shifting'' is the name I've given to the process whereby certain types of payments have their payment date shifted automatically.

In the UK standing orders and direct debits are generally not processed on a weekend so if the normal payment date for these types of transactions falls on a weekend then the payments for the week they should fall in and the week that they actually fall in will be incorrect.

When in date shifting mode the script will automatically move direct debit and standing order payments which fall on a weekend to the start of the next week.

It should be noted that if the next week happens to be within the next month then the payments will not be shown.

Payments which have been date shifted will have the text [was DATE]`` placed under the date they are predicted to go out, where DATE is the original date for the payment.

This funtionality can be disabled by calling this script with the -S flag.


AUTHOR

Simon Burr <simes@bpfh.net>


LICENSE

Copyright (c) 2003, Simon Burr <simes@bpfh.net> All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  * Redistributions of source code must retain the above copyright notice,
    this list of conditions and the following disclaimer. 
  * Redistributions in binary form must reproduce the above copyright
    notice, this list of conditions and the following disclaimer in the
    documentation and/or other materials provided with the distribution. 
  * Neither the name of the author nor the names of its contributors may
    be used to endorse or promote products derived from this software
    without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.