1 | # -*- coding: utf-8 -*-
|
---|
2 | from django.db import models
|
---|
3 | from django.db.models import Sum
|
---|
4 | from django.core.exceptions import ObjectDoesNotExist
|
---|
5 | from datetime import *
|
---|
6 | from decimal import *
|
---|
7 |
|
---|
8 |
|
---|
9 | class Kostenstelle(models.Model):
|
---|
10 | id = models.AutoField(primary_key=True)
|
---|
11 | name = models.CharField(max_length=60, blank=True)
|
---|
12 |
|
---|
13 | class Meta:
|
---|
14 | db_table = u'kostenstelle'
|
---|
15 |
|
---|
16 |
|
---|
17 | class Code(models.Model):
|
---|
18 | id = models.BigIntegerField(primary_key=True)
|
---|
19 | text = models.CharField(max_length=60, blank=True)
|
---|
20 | grenzwert = models.DecimalField(null=True, max_digits=5, decimal_places=2, blank=True)
|
---|
21 |
|
---|
22 | class Meta:
|
---|
23 | db_table = u'code'
|
---|
24 |
|
---|
25 |
|
---|
26 | class Mitarbeiter(models.Model):
|
---|
27 | id = models.AutoField(primary_key=True)
|
---|
28 | key = models.CharField(max_length=10, unique=True)
|
---|
29 |
|
---|
30 | geburtstag = models.DateField()
|
---|
31 | eintritt = models.DateField()
|
---|
32 | sperre = models.DateField(null=True, blank=True)
|
---|
33 |
|
---|
34 | name = models.CharField(max_length=80)
|
---|
35 | vorname = models.CharField(max_length=80)
|
---|
36 | code = models.ForeignKey(Code, db_column='code')
|
---|
37 |
|
---|
38 | class Meta:
|
---|
39 | db_table = u'mitarbeiter'
|
---|
40 | ordering = ['name', 'vorname']
|
---|
41 |
|
---|
42 |
|
---|
43 | class Status(models.Model):
|
---|
44 | id = models.AutoField(primary_key=True)
|
---|
45 | status = models.CharField(max_length=45, blank=True)
|
---|
46 | statustext = models.CharField(max_length=8, blank=True)
|
---|
47 |
|
---|
48 | class Meta:
|
---|
49 | db_table = u'status'
|
---|
50 | ordering = ['id']
|
---|
51 |
|
---|
52 |
|
---|
53 | class Erfasst(models.Model):
|
---|
54 | id = models.AutoField(primary_key=True)
|
---|
55 | key = models.ForeignKey(Mitarbeiter, db_column='key', to_field='key')
|
---|
56 |
|
---|
57 | datum = models.DateField()
|
---|
58 | code = models.ForeignKey(Code, db_column='code')
|
---|
59 | status = models.ForeignKey(Status, db_column='status')
|
---|
60 | realkst = models.ForeignKey(Kostenstelle, db_column='realkst')
|
---|
61 |
|
---|
62 | class Meta:
|
---|
63 | db_table = u'erfasst'
|
---|