Exemple #1
0
def hours(db, args, extra=None):
    payperiod_class = 'MonthlyOnSecondToLastFriday'
    current_sheet = dbutil.get_current_sheet(db)
    if db.config.has_option(current_sheet, 'payperiod_type'):
        payperiod_class = db.config.get(current_sheet, 'payperiod_type')

    parser = optparse.OptionParser()
    parser.add_option("--param", type="string", dest="param", default=None)
    parser.add_option(
        "--payperiod-type", type="string",
        dest="payperiod_type", default=payperiod_class
    )
    (options, args, ) = parser.parse_args()

    ppu = PayPeriodUtil(db, options.payperiod_type)
    hour_info = ppu.get_hours_details()
    if options.param and options.param in hour_info.keys():
        param = hour_info[options.param]
        if isinstance(param, datetime):
            param = int(time.mktime(param.timetuple()))
        print param
    else:
        print "Period: %s through %s" % (
                hour_info['begin_period'].strftime("%Y-%m-%d"),
                hour_info['end_period'].strftime("%Y-%m-%d"),
                )

        if(hour_info['actual'] > hour_info['expected']):
            print "%.2f hour SURPLUS" % (
                    hour_info['actual'] - hour_info['expected'],
                )
            print "%s hours unpaid" % (hour_info['unpaid'],)
            print "%s hours vacation" % (hour_info['vacation'], )
            print "%s hours adjustment" % (hour_info['adjustments'], )
            print ""
            print "You should have left at %s today to maintain hours." % (
                    hour_info['out_time'].strftime("%H:%M"),
                )
        else:
            print "%.2f hour DEFICIT" % (
                    hour_info['expected'] - hour_info['actual']
                )
            print "%s hours unpaid" % (hour_info['unpaid'])
            print "%s hours vacation" % (hour_info['vacation'], )
            print "%s hours adjustment" % (hour_info['adjustments'], )
            print ""
            print "You should leave at %s today to maintain hours." % (
                    hour_info['out_time'].strftime("%H:%M"),
                )
Exemple #2
0
def hours(db, args, extra=None):
    payperiod_class = 'MonthlyOnSecondToLastFriday'
    current_sheet = dbutil.get_current_sheet(db)
    if db.config.has_option(current_sheet, 'payperiod_type'):
        payperiod_class = db.config.get(current_sheet, 'payperiod_type')

    parser = optparse.OptionParser()
    parser.add_option("--param", type="string", dest="param", default=None)
    parser.add_option("--payperiod-type",
                      type="string",
                      dest="payperiod_type",
                      default=payperiod_class)
    (
        options,
        args,
    ) = parser.parse_args()

    ppu = PayPeriodUtil(db, options.payperiod_type)
    hour_info = ppu.get_hours_details()
    if options.param and options.param in hour_info.keys():
        param = hour_info[options.param]
        if isinstance(param, datetime):
            param = int(time.mktime(param.timetuple()))
        print param
    else:
        print "Period: %s through %s" % (
            hour_info['begin_period'].strftime("%Y-%m-%d"),
            hour_info['end_period'].strftime("%Y-%m-%d"),
        )

        if (hour_info['actual'] > hour_info['expected']):
            print "%.2f hour SURPLUS" % (hour_info['actual'] -
                                         hour_info['expected'], )
            print "%s hours unpaid" % (hour_info['unpaid'], )
            print "%s hours vacation" % (hour_info['vacation'], )
            print "%s hours adjustment" % (hour_info['adjustments'], )
            print ""
            print "You should have left at %s today to maintain hours." % (
                hour_info['out_time'].strftime("%H:%M"), )
        else:
            print "%.2f hour DEFICIT" % (hour_info['expected'] -
                                         hour_info['actual'])
            print "%s hours unpaid" % (hour_info['unpaid'])
            print "%s hours vacation" % (hour_info['vacation'], )
            print "%s hours adjustment" % (hour_info['adjustments'], )
            print ""
            print "You should leave at %s today to maintain hours." % (
                hour_info['out_time'].strftime("%H:%M"), )
def hours(db, args, extra=None):
    parser = optparse.OptionParser()
    parser.add_option("--param", type="string", dest="param", default=None)
    (options, args, ) = parser.parse_args()

    ppu = PayPeriodUtil(db)
    hour_info = ppu.get_hours_details()
    if options.param and options.param in hour_info.keys():
        param = hour_info[options.param]
        if isinstance(param, datetime):
            param = int(time.mktime(param.timetuple()))
        print param
    else:
        print "Period: %s through %s" % (
                hour_info['begin_period'].strftime("%Y-%m-%d"),
                hour_info['end_period'].strftime("%Y-%m-%d"),
                )

        if(hour_info['actual'] > hour_info['expected']):
            print "%.2f hour SURPLUS" % (
                    hour_info['actual'] - hour_info['expected'],
                )
            print "%s hours unpaid" % (hour_info['unpaid'],)
            print "%s hours vacation" % (hour_info['vacation'], )
            print ""
            print "You should have left at %s today to maintain hours." % (
                    hour_info['out_time'].strftime("%H:%M"),
                )
        else:
            print "%.2f hour DEFICIT" % (
                    hour_info['expected'] - hour_info['actual']
                )
            print "%s hours unpaid" % (hour_info['unpaid'])
            print "%s hours vacation" % (hour_info['vacation'], )
            print ""
            print "You should leave at %s today to maintain hours." % (
                    hour_info['out_time'].strftime("%H:%M"),
                )
def hours(db, args, extra=None):
    parser = optparse.OptionParser()
    parser.add_option("--param", type="string", dest="param", default=None)
    (
        options,
        args,
    ) = parser.parse_args()

    ppu = PayPeriodUtil(db)
    hour_info = ppu.get_hours_details()
    if options.param and options.param in hour_info.keys():
        param = hour_info[options.param]
        if isinstance(param, datetime):
            param = int(time.mktime(param.timetuple()))
        print param
    else:
        print "Period: %s through %s" % (
            hour_info['begin_period'].strftime("%Y-%m-%d"),
            hour_info['end_period'].strftime("%Y-%m-%d"),
        )

        if (hour_info['actual'] > hour_info['expected']):
            print "%.2f hour SURPLUS" % (hour_info['actual'] -
                                         hour_info['expected'], )
            print "%s hours unpaid" % (hour_info['unpaid'], )
            print "%s hours vacation" % (hour_info['vacation'], )
            print ""
            print "You should have left at %s today to maintain hours." % (
                hour_info['out_time'].strftime("%H:%M"), )
        else:
            print "%.2f hour DEFICIT" % (hour_info['expected'] -
                                         hour_info['actual'])
            print "%s hours unpaid" % (hour_info['unpaid'])
            print "%s hours vacation" % (hour_info['vacation'], )
            print ""
            print "You should leave at %s today to maintain hours." % (
                hour_info['out_time'].strftime("%H:%M"), )