Beispiel #1
0
def command(timebook, config, start, end, billing, money, **kwargs):
    # get the db
    cfg=parse_config(config)
    db=Database(timebook, cfg)

    start_timestamp = parse_date_time(start) if start else None
    end_timestamp = parse_date_time(end) if end else None

    full(db, start_timestamp, end_timestamp, billing, money)
Beispiel #2
0
def command(timebook, config, sheet, start, end, billing, format, money, **kwargs):
    # get the db
    cfg=parse_config(config)
    db=Database(timebook, cfg)

    sheet = sheet or db.get_current_sheet()

    start_timestamp = parse_date_time(start) if start else None
    end_timestamp = parse_date_time(end) if end else None

    if billing:
        if start or end:
            parser.error('if you specify --billing, you cannot specify a start ' \
                'or end ')

        billing_time = db.get_billing_start_time(sheet)

        if billing_time:
            start_timestamp = billing_time

    display(db, sheet, start_timestamp, end_timestamp, format, money)
Beispiel #3
0
def command(timebook, config, switch, start_time, end_time, messages, **kwargs):
    # get the db
    cfg=parse_config(config)
    db=Database(timebook, cfg)

    if switch:
        commands.switch.switch(db, switch)
        sheet = switch
    else:
        sheet = db.get_current_sheet()

    timestamp_in=parse_date_time(start_time)
    timestamp_out=parse_date_time(end_time)

    current_start = db.get_start_time(sheet)
    if current_start:
        if timestamp_out > current_start[1]:
            parser.error('cannot put this entry into the timesheet because ' \
                'it may cause overlap with the active timer - clock out first')

    message = ' '.join(messages)

    put(db, sheet, timestamp_in, timestamp_out, message)