Accounting Calendar - Unix

This is a discussion on Accounting Calendar - Unix ; Could any one let me know command for accounting calendar in unix? Thx, Badri...

+ Reply to Thread
Results 1 to 8 of 8

Thread: Accounting Calendar

  1. Accounting Calendar

    Could any one let me know command for accounting calendar in unix?

    Thx,
    Badri


  2. Re: Accounting Calendar

    kr.badrinath@gmail.com said the following, on 10/20/05 12:37:
    > Could any one let me know command for accounting calendar in unix?
    >


    If you would like an answer to your question, I think you are going to
    have to clarify what it is that you want.

    I personally do not have a clue what you mean by "command for accounting
    calendar". Perhaps you could give a simple example of how you would use
    whatever it is.


    --
    Rich Gibbs
    richg74@gmail.com
    "You can observe a lot by watching." -- Yogi Berra


  3. Re: Accounting Calendar

    The calendar should have full week data and ideally it should look like
    below

    Oct
    S M Tu W Th F S
    2 3 4 5 6 7 8
    9 10 11 12 13 14 15
    16 17 18 19 20 21 22
    23 24 25 26 27 28 29

    Nov
    S M Tu W Th F S
    30 31 1 2 3 4 5
    6 7 8 9 10 11 12
    13 14 15 16 17 18 19
    20 21 22 23 24 25 26


  4. Re: Accounting Calendar



    kr.badrinath@gmail.com wrote:
    > The calendar should have full week data and ideally it should look like
    > below
    >
    > Oct
    > S M Tu W Th F S
    > 2 3 4 5 6 7 8
    > 9 10 11 12 13 14 15
    > 16 17 18 19 20 21 22
    > 23 24 25 26 27 28 29
    >
    > Nov
    > S M Tu W Th F S
    > 30 31 1 2 3 4 5
    > 6 7 8 9 10 11 12
    > 13 14 15 16 17 18 19
    > 20 21 22 23 24 25 26
    >


    "cal" does that:

    $ where cal
    /usr/bin/cal
    $ cal
    October 2005
    S M Tu W Th F S
    1
    2 3 4 5 6 7 8
    9 10 11 12 13 14 15
    16 17 18 19 20 21 22
    23 24 25 26 27 28 29
    30 31

    "cm" also provides something like that on Solaris.

    Ed.

  5. Re: Accounting Calendar

    Ed,

    I need to have complete weeks as I have given above.
    It should not have incomplete weekdates(ie first row and fifth row in
    your example).

    I would appreciate if you can help me.

    Thx,
    Badri


  6. Re: Accounting Calendar



    kr.badrinath@gmail.com wrote:
    > Ed,
    >
    > I need to have complete weeks as I have given above.
    > It should not have incomplete weekdates(ie first row and fifth row in
    > your example).
    >
    > I would appreciate if you can help me.
    >
    > Thx,
    > Badri
    >


    Please read these before posting anything else:

    http://cfaj.freeshell.org/google
    http://en.wikipedia.org/wiki/Top-posting
    http://en.wikipedia.org/wiki/Netiquette

    Now, your example showed:

    > The calendar should have full week data and ideally it should look like
    > below
    >
    > Oct
    > S M Tu W Th F S
    > 2 3 4 5 6 7 8
    > 9 10 11 12 13 14 15
    > 16 17 18 19 20 21 22
    > 23 24 25 26 27 28 29
    >
    > Nov
    > S M Tu W Th F S
    > 30 31 1 2 3 4 5
    > 6 7 8 9 10 11 12
    > 13 14 15 16 17 18 19
    > 20 21 22 23 24 25 26


    When you say "I need to have complete weeks as I have given above.",
    that's inconsistent since you show partial weeks at the end of each
    month. I think what you mean to say is that you want to show the full
    week for only each week that ends before or on the end date of each
    month. Is that correct?

    Ed.

  7. Re: Accounting Calendar

    There is no standard for accounting periods. They are defined by the company
    using them.
    As far as I know, no unix command is available that will generate a 4-4-5
    style accounting calendar.


    wrote in message
    news:1130343110.677586.29530@g47g2000cwa.googlegro ups.com...
    > Ed,
    >
    > I need to have complete weeks as I have given above.
    > It should not have incomplete weekdates(ie first row and fifth row in
    > your example).
    >
    > I would appreciate if you can help me.
    >
    > Thx,
    > Badri
    >




  8. Re: Accounting Calendar

    On 2005-10-26, kr.badrinath@gmail.com wrote:
    > The calendar should have full week data and ideally it should look like
    > below
    >
    > Oct
    > S M Tu W Th F S
    > 2 3 4 5 6 7 8
    > 9 10 11 12 13 14 15
    > 16 17 18 19 20 21 22
    > 23 24 25 26 27 28 29
    >
    > Nov
    > S M Tu W Th F S
    > 30 31 1 2 3 4 5
    > 6 7 8 9 10 11 12
    > 13 14 15 16 17 18 19
    > 20 21 22 23 24 25 26


    Without any arguments, the following script will print the current
    month in (approximately) the above format:

    $ acal
    October 2005
    Sun Mon Tue Wed Thu Fri Sat
    25 26 27 28 29 30 1
    2 3 4 5 6 7 8
    9 10 11 12 13 14 15
    16 17 18 19 20 21 22
    23 24 25 26 27 28 29


    A different month and/or year may be specified; the month may be
    given as a number or the name of the month (3 letters minimum).

    $ acal jan 2006
    January 2006
    Sun Mon Tue Wed Thu Fri Sat
    1 2 3 4 5 6 7
    8 9 10 11 12 13 14
    15 16 17 18 19 20 21
    22 23 24 25 26 27 28


    The -w and -l options may be used to adjust the spacing of the
    calendar:

    $ acal -w 8 -l 2 2007

    October 2007

    Sun Mon Tue Wed Thu Fri Sat

    30 1 2 3 4 5 6

    7 8 9 10 11 12 13

    14 15 16 17 18 19 20

    21 22 23 24 25 26 27


    $ acal -w2 3
    March 2005
    Su Mo Tu We Th Fr Sa
    27 28 1 2 3 4 5
    6 7 8 9 10 11 12
    13 14 15 16 17 18 19
    20 21 22 23 24 25 26


    The script:

    ############################# BoS #############################
    ### Add shebang to your POSIX shell, if necessary
    ## NAME: acal
    ## AUTHOR: Chris F.A. Johnson, copyright 2005
    ## USAGE: acal [OPTIONS] [month] [year]
    ## OPTIONS: -w N - Use N columns per day
    ## -l N - Print N newlines between rows

    .. date-funcs || exit 5

    daynames="Sun Mon Tue Wed Thu Fri Sat"
    days='1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
    18 19 20 21 22 23 24 25 26 27 28 29 30 31'
    NLs=$NL
    lines=1

    while getopts w:l: opt
    do
    case $opt in
    w) width=$OPTARG ;;
    l) lines=$OPTARG ;;
    esac
    done
    shift $(( $OPTIND - 1 ))

    case $1 in
    "") eval "$(date "+year=%Y month=%m day=%d doy=%a")" ;;
    *[!0-9]*)
    _monthnum ${1#0}
    month=$_ZP_MONTHNUM
    year=${2:-$(date +%Y)}
    ;;
    *) month=${1#0}
    if [ ${month:-13} -le 12 ]
    then
    year=${2:-$(date +%Y)}
    else
    year=${1:-$(date +%Y)}
    month=
    fi
    ;;
    esac

    ## Adjust line spacing
    while [ ${#NLs} -lt "$lines" ]
    do
    NLs=$NLs$NL
    done

    ## Find number of days in desired and previous months
    _days_in_month $month $year
    _date2julian $year-$month-01
    day_of_week=$(( ($_DATE2JULIAN + 1) % 7 ))
    days_in_month=$(( ($_DAYS_IN_MONTH - ($_DAYS_IN_MONTH + $day_of_week) % 7) ))
    _julian2date $(( $_DATE2JULIAN - 1 ))
    last_of_last=$j2d_day

    ## Store the days to be printed in the positional parameters
    set -f -- ${days%$(( $last_of_last + 1 ))*}
    shift $(( $# - $day_of_week ))
    set -- $* ${days%$(( $days_in_month + 1 ))*}

    _monthname "$month"

    ## Set widths and format string
    wd=${width:-3}
    [ $wd -lt 2 ] && wd=2
    w=$(( ($wd * 7 + ${#_MONTHNAME} + 11) / 2 ))
    dfmt=%${wd}.${wd}s
    fmt="$dfmt $dfmt $dfmt $dfmt $dfmt $dfmt $dfmt${NLs}"

    ## Print it
    [ $lines -ge 2 ] && mnl=$NL || mnl=
    printf "$mnl%${w}.${w}s$mnl\n" "$_MONTHNAME $year" ## Print month and year
    printf "$fmt" ${daynames} ## Print day names
    printf "$fmt" $* ##"${days[@]}" ## Print calendar

    ########################### EoS #################################


    The script requires the date-funcs library from Chapter 8 of my
    book, "Shell Scripting Recipes", as well as the standard-funcs and
    standard-vars scripts from Chapter 1. The entire Chapter 8 is
    available on line, as is all the code from the book. You can reach
    the site through the URL in my .sig.


    --
    Chris F.A. Johnson | Author:
    | Shell Scripting Recipes:
    Any code in this post is released | A Problem-Solution Approach,
    under the GNU General Public Licence | 2005, Apress

+ Reply to Thread