summaryrefslogtreecommitdiff
path: root/maconomy_hours.py
blob: 1001964a980db16d33787ce66c0e2aa6a2165da6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from maconomy import cli, Employee, Timesheet, create_db, TimeRegistrationRepository

def main(config, dry_run):
    db = create_db(config)
    timereg_repo = TimeRegistrationRepository(db)

    for employee, timesheet in timereg_repo.all_active():
        if timesheet.is_missing():
            print u"Timesheet for {} has not been created".format(employee)
        elif not timesheet.is_submitted():
            print u"Missing time sheet for {}".format(employee)
        elif not timesheet.is_approved():
            print u"Timesheet for {} not approved".format(employee)

    timereg_repo.close()
    db.close()

if __name__ == '__main__':
    args = cli.parse()
    config = cli.load_config(args.config)
    main(config, args.dry)