Example #1
0
class factuurList(Container):
    def __init__(self, width, height, facturen, manager):
        super(factuurList, self).__init__(width, height)
        if 'vereniging_id' in facturen[0]:
            self.name = getVerenigingNaam(facturen[0]['vereniging_id']).encode('utf-8')
        else:
            self.name = "Leveranciers en overige"
        self.manager = manager
        self.header = Label(width, 1, self.name, curses.A_REVERSE)
        self.factuurListbox = Listbox(width, height-2)
        for factuur in reversed(facturen):
            self.factuurListbox.append(factuurListItem(width, factuur, manager))

        self.factuurListboxIndex = self.addChild(0,2, self.factuurListbox)
        self.headerIndex = self.addChild(0,0, self.header)

    def keyEvent(self, key):
        if key == curses.KEY_BACKSPACE:
            self.manager.pop()
        else:
            super(factuurList,self).keyEvent(key)

    def resize(self, width, height):
        self.width = width
        self.height = height
        self.header.resize(width, 1)
        self.factuurListbox.resize(width, height-2)
Example #2
0
class factuurOverigeList(Container):
    def __init__(self, width, height, facturen, manager):
        super(factuurOverigeList, self).__init__(width, height)
        self.manager = manager
        self.header = Label(width, 1, "Leveranciers en overige", curses.A_REVERSE)
        self.factuurOverigeListbox = Listbox(width, height-2)
        self.groups = {}
        self.ordering = []
        for factuur in reversed(facturen):
            if factuur["leverancier"] not in self.groups.keys():
                self.groups[factuur["leverancier"]] = []
                self.ordering.append(factuur["leverancier"])
            self.groups[factuur["leverancier"]].append(factuur)
        for key in self.ordering:
            self.factuurOverigeListbox.append(factuurOverigeListItem(width, str(key), self.groups[key][::-1], manager))

        self.factuurOverigeListboxIndex = self.addChild(0,2, self.factuurOverigeListbox)
        self.headerIndex = self.addChild(0,0, self.header)

    def keyEvent(self, key):
        if key == curses.KEY_BACKSPACE:
            self.manager.pop()
        else:
            super(factuurOverigeList,self).keyEvent(key)

    def resize(self, width, height):
        self.width = width
        self.height = height
        self.header.resize(width, 1)
        self.factuurOverigeListbox.resize(width, height-2)
Example #3
0
    def __init__(self, width, height, facturen, manager):
        super(factuurList, self).__init__(width, height)
        self.manager = manager
        self.factuurListbox = Listbox(width, height)
        for factuur in facturen:
            self.factuurListbox.append(factuurListItem(width, factuur,
                                                       manager))

        self.factuurListboxIndex = self.addChild(0, 0, self.factuurListbox)
Example #4
0
    def __init__(self, width, height, vereniging_list, manager):
        super(verenigingList, self).__init__(width, height)
        self.manager = manager
        self.listbox = Listbox(width, height)
        for vereniging_info in vereniging_list:
            self.listbox.append(
                verenigingListItem(width, vereniging_info, manager))
        self.listbox.append(leverancierListItem(width, manager))

        self.listboxId = self.addChild(0, 0, self.listbox)
Example #5
0
 def __init__(self, width, height, vereniging_list, manager):
     super(verenigingList, self).__init__(width, height)
     self.manager = manager
     self.header = Label(width, 1, "Madmin ReTeX", curses.A_REVERSE)
     self.listbox = Listbox(width, height - 2)
     for vereniging_info in vereniging_list:
         self.listbox.append(
             verenigingListItem(width, vereniging_info, manager))
     self.headerId = self.addChild(0, 0, self.header)
     self.listboxId = self.addChild(0, 2, self.listbox)
Example #6
0
    def __init__(self, width, height, facturen, budget, manager):
        super(factuurList, self).__init__(width, height)
        self.manager = manager
        self.factuurListbox = Listbox(width, height)
        self.facturen = facturen[::-1]
        self.budget = budget
        for a in range(len(self.facturen)):
            self.factuurListbox.append(
                factuurListItem(width, self.facturen[a], manager, a, self))

        self.factuurListboxIndex = self.addChild(0, 0, self.factuurListbox)
Example #7
0
    def __init__(self, width, height, facturen, manager):
        super(factuurList, self).__init__(width, height)
        if 'vereniging_id' in facturen[0]:
            self.name = getVerenigingNaam(facturen[0]['vereniging_id']).encode('utf-8')
        else:
            self.name = "Leveranciers en overige"
        self.manager = manager
        self.header = Label(width, 1, self.name, curses.A_REVERSE)
        self.factuurListbox = Listbox(width, height-2)
        for factuur in reversed(facturen):
            self.factuurListbox.append(factuurListItem(width, factuur, manager))

        self.factuurListboxIndex = self.addChild(0,2, self.factuurListbox)
        self.headerIndex = self.addChild(0,0, self.header)
Example #8
0
    def __init__(self, width, height, facturen, manager):
        super(factuurOverigeList, self).__init__(width, height)
        self.manager = manager
        self.header = Label(width, 1, "Leveranciers en overige", curses.A_REVERSE)
        self.factuurOverigeListbox = Listbox(width, height-2)
        self.groups = {}
        self.ordering = []
        for factuur in reversed(facturen):
            if factuur["leverancier"] not in self.groups.keys():
                self.groups[factuur["leverancier"]] = []
                self.ordering.append(factuur["leverancier"])
            self.groups[factuur["leverancier"]].append(factuur)
        for key in self.ordering:
            self.factuurOverigeListbox.append(factuurOverigeListItem(width, str(key), self.groups[key][::-1], manager))

        self.factuurOverigeListboxIndex = self.addChild(0,2, self.factuurOverigeListbox)
        self.headerIndex = self.addChild(0,0, self.header)
Example #9
0
    def __init__(self, width, height, vereniging_list, manager):
        super(verenigingList, self).__init__(width, height)
        self.manager = manager
        self.listbox = Listbox(width, height)
        for vereniging_info in vereniging_list:
            self.listbox.append(verenigingListItem(width,vereniging_info,manager))
        self.listbox.append(leverancierListItem(width,manager))

        self.listboxId = self.addChild(0,0,self.listbox)
Example #10
0
    def __init__(self, width, height, facturen, budget, manager):
        super(factuurList, self).__init__(width, height)
        self.manager = manager
        self.factuurListbox = Listbox(width, height)
        self.facturen = facturen[::-1]
        self.budget = budget
        for a in range(len(self.facturen)):
            self.factuurListbox.append(factuurListItem(width, self.facturen[a], manager, a, self))

        self.factuurListboxIndex = self.addChild(0,0, self.factuurListbox)
Example #11
0
class factuurList(Container):
    def __init__(self, width, height, facturen, manager):
        super(factuurList, self).__init__(width, height)
        self.manager = manager
        self.factuurListbox = Listbox(width, height)
        for factuur in facturen:
            self.factuurListbox.append(factuurListItem(width, factuur,
                                                       manager))

        self.factuurListboxIndex = self.addChild(0, 0, self.factuurListbox)

    def keyEvent(self, key):
        if key == curses.KEY_BACKSPACE:
            self.manager.pop()
        else:
            super(factuurList, self).keyEvent(key)

    def resize(self, width, height):
        self.width = width
        self.height = height
        self.factuurListbox.resize(width, height)
Example #12
0
class factuurList(Container):
    def __init__(self, width, height, facturen, budget, manager):
        super(factuurList, self).__init__(width, height)
        self.manager = manager
        self.factuurListbox = Listbox(width, height)
        self.facturen = facturen[::-1]
        self.budget = budget
        for a in range(len(self.facturen)):
            self.factuurListbox.append(factuurListItem(width, self.facturen[a], manager, a, self))

        self.factuurListboxIndex = self.addChild(0,0, self.factuurListbox)

    def keyEvent(self, key):
        if key == curses.KEY_BACKSPACE:
            self.manager.pop()
        else:
            super(factuurList,self).keyEvent(key)

    def resize(self, width, height):
        self.width = width
        self.height = height
        self.factuurListbox.resize(width, height)
Example #13
0
class factuurList(Container):
    def __init__(self, width, height, facturen, budget, manager):
        super(factuurList, self).__init__(width, height)
        self.manager = manager
        self.factuurListbox = Listbox(width, height)
        self.facturen = facturen[::-1]
        self.budget = budget
        for a in range(len(self.facturen)):
            self.factuurListbox.append(
                factuurListItem(width, self.facturen[a], manager, a, self))

        self.factuurListboxIndex = self.addChild(0, 0, self.factuurListbox)

    def keyEvent(self, key):
        if key == curses.KEY_BACKSPACE:
            self.manager.pop()
        else:
            super(factuurList, self).keyEvent(key)

    def resize(self, width, height):
        self.width = width
        self.height = height
        self.factuurListbox.resize(width, height)
Example #14
0
class verenigingList(Container):
    def __init__(self, width, height, vereniging_list, manager):
        super(verenigingList, self).__init__(width, height)
        self.manager = manager
        self.listbox = Listbox(width, height)
        for vereniging_info in vereniging_list:
            self.listbox.append(verenigingListItem(width,vereniging_info,manager))
        self.listbox.append(leverancierListItem(width,manager))

        self.listboxId = self.addChild(0,0,self.listbox)

    def resize(self, width, height):
        self.width = width
        self.height = height
        self.listbox.resize(width, height)
Example #15
0
class verenigingList(Container):
    def __init__(self, width, height, vereniging_list, manager):
        super(verenigingList, self).__init__(width, height)
        self.manager = manager
        self.listbox = Listbox(width, height)
        for vereniging_info in vereniging_list:
            self.listbox.append(
                verenigingListItem(width, vereniging_info, manager))
        self.listbox.append(leverancierListItem(width, manager))

        self.listboxId = self.addChild(0, 0, self.listbox)

    def resize(self, width, height):
        self.width = width
        self.height = height
        self.listbox.resize(width, height)
Example #16
0
class verenigingList(Container):
    def __init__(self, width, height, vereniging_list, manager):
        super(verenigingList, self).__init__(width, height)
        self.manager = manager
        self.header = Label(width, 1, "Madmin Factuurinfo", curses.A_REVERSE)
        self.listbox = Listbox(width, height - 2)
        for vereniging_info in vereniging_list:
            self.listbox.append(verenigingListItem(width,vereniging_info,manager))
        self.listbox.append(leverancierListItem(width,manager))
        self.headerId = self.addChild(0,0, self.header)
        self.listboxId = self.addChild(0,2,self.listbox)

    def resize(self, width, height):
        self.width = width
        self.height = height
        self.header.resize(width, 1)
        self.listbox.resize(width, height-2)
Example #17
0
class factuurDetail(Container):
    def __init__(self, width, height, factuur, manager):
        super(factuurDetail, self).__init__(width, height)

        #Associated data object
        self.factuur = factuur
        self.manager = manager

        self.infobox = factuurInfobox(width,0,factuur)
        self.infoboxIdx = self.addChild(0,0,self.infobox)

        self.factuurRegelHeader = factuurRegelHeader(width,1)
        self.factuurRegelHeaderIdx = self.addChild(0,0,self.factuurRegelHeader)

        self.factuurRegelBox = Listbox(width, 0)
        self.factuurRegelBoxIdx = self.addChild(0,0,self.factuurRegelBox)

        self.factuurBorrelTotaal = 0
        self.factuurBorrelmargeTotaal = 0
        self.factuurKantineTotaal = 0
        self.factuurEmballageTotaal = 0
        self.factuurOverigeTotaal = 0
        self.factuurBorrelTotaalOnafgerond = 0
        self.factuurKantineTotaalOnafgerond = 0
        self.factuurEmballageTotaalOnafgerond = 0
        self.factuurOverigeTotaalOnafgerond = 0

        for regel in factuur['regels']:
            self.factuurRegelBox.append(factuurRegel(width,1,regel))
            if 'prd_id' in regel:
                type = getProductType(regel['prd_id'])
                if type=='kantine':
                    self.factuurKantineTotaal += copysign(regel['totaalprijs'], regel['aantal'])
                    self.factuurKantineTotaalOnafgerond += regel['stukprijs'] * regel['aantal']
                elif type=='borrel':
                    self.factuurBorrelTotaal += copysign(regel['totaalprijs'], regel['aantal'])
                    self.factuurBorrelTotaalOnafgerond += regel['stukprijs'] * regel['aantal']
                    self.factuurBorrelmargeTotaal += floor(regel['stukprijs']/1.03) * regel['aantal']
                elif type=='emballage':
                    self.factuurEmballageTotaal += copysign(regel['totaalprijs'], regel['aantal'])
                    self.factuurEmballageTotaalOnafgerond += regel['stukprijs'] * regel['aantal']
                else:
                    self.factuurOverigeTotaal += copysign(regel['totaalprijs'], regel['aantal'])
                    self.factuurOverigeTotaalOnafgerond += regel['stukprijs'] * regel['aantal']
            else:
                self.factuurOverigeTotaal += copysign(regel['totaalprijs'], regel['aantal'])
                self.factuurOverigeTotaalOnafgerond += regel['stukprijs'] * regel['aantal']

        self.factuurBorrelTotaalLabel = Label(0,0,"Borreltotaal: " + moneyConvert(int(self.factuurBorrelTotaal)))
        self.factuurBorrelTotaalLabelIdx = self.addChild(0,0,self.factuurBorrelTotaalLabel)
        self.factuurBorrelmargeTotaalLabel = Label(0,0,"Borrelmargetotaal: " + moneyConvert(int(self.factuurBorrelmargeTotaal)))
        self.factuurBorrelmargeTotaalLabelIdx = self.addChild(0,0,self.factuurBorrelmargeTotaalLabel)
        self.factuurKantineTotaalLabel = Label(0,0,"Kantinetotaal: " + moneyConvert(int(self.factuurKantineTotaal)))
        self.factuurKantineTotaalLabelIdx = self.addChild(0,0,self.factuurKantineTotaalLabel)
        self.factuurEmballageTotaalLabel = Label(0,0,"Emballagetotaal: " + moneyConvert(int(self.factuurEmballageTotaal)))
        self.factuurEmballageTotaalLabelIdx = self.addChild(0,0,self.factuurEmballageTotaalLabel)
        self.factuurOverigeTotaalLabel = Label(0,0,"Overigetotaal: " + moneyConvert(int(self.factuurOverigeTotaal)))
        self.factuurOverigeTotaalLabelIdx = self.addChild(0,0,self.factuurOverigeTotaalLabel)
        self.factuurTotaalLabel = Label(0,0,"Totaal: " + moneyConvert(int(self.factuurBorrelTotaal+self.factuurKantineTotaal+self.factuurEmballageTotaal+self.factuurOverigeTotaal)))
        self.factuurTotaalLabelIdx = self.addChild(0,0,self.factuurTotaalLabel)

        # added details:

        self.factuurBorrelTotaalOnafgerondLabel = Label(0,0,"Borreltotaal-onafgerond: " + moneyConvert(int(self.factuurBorrelTotaalOnafgerond)))
        self.factuurBorrelTotaalOnafgerondLabelIdx = self.addChild(0,0,self.factuurBorrelTotaalOnafgerondLabel)
        self.factuurKantineTotaalOnafgerondLabel = Label(0,0,"Kantinetotaal-onafgerond: " + moneyConvert(int(self.factuurKantineTotaalOnafgerond)))
        self.factuurKantineTotaalOnafgerondLabelIdx = self.addChild(0,0,self.factuurKantineTotaalOnafgerondLabel)
        self.factuurEmballageTotaalOnafgerondLabel = Label(0,0,"Emballagetotaal-onafgerond: " + moneyConvert(int(self.factuurEmballageTotaalOnafgerond)))
        self.factuurEmballageTotaalOnafgerondLabelIdx = self.addChild(0,0,self.factuurEmballageTotaalOnafgerondLabel)
        self.factuurOverigeTotaalOnafgerondLabel = Label(0,0,"Overigetotaal-onafgerond: " + moneyConvert(int(self.factuurOverigeTotaalOnafgerond)))
        self.factuurOverigeTotaalOnafgerondLabelIdx = self.addChild(0,0,self.factuurOverigeTotaalOnafgerondLabel)
        self.factuurTotaalOnafgerondLabel = Label(0,0,"Totaal-onafgerond: " + moneyConvert(int(self.factuurBorrelTotaalOnafgerond+self.factuurKantineTotaalOnafgerond+self.factuurEmballageTotaalOnafgerond+self.factuurOverigeTotaalOnafgerond)))
        self.factuurTotaalOnafgerondLabelIdx = self.addChild(0,0,self.factuurTotaalOnafgerondLabel)

        self.factuurAfrondingLabel = Label(0,0,"Afronding: " + moneyConvert(int(self.factuurBorrelTotaalOnafgerond - self.factuurBorrelTotaal + self.factuurKantineTotaalOnafgerond - self.factuurKantineTotaal + self.factuurEmballageTotaalOnafgerond - self.factuurEmballageTotaal + self.factuurOverigeTotaalOnafgerond - self.factuurOverigeTotaal)))
        self.factuurAfrondingLabelIdx = self.addChild(0,0,self.factuurAfrondingLabel)

        self.resize(width, height)

    def keyEvent(self, key):
        if key == curses.KEY_BACKSPACE:
            self.manager.pop()
        elif key == ord('c'):
            print "test"
        else:
            super(factuurDetail,self).keyEvent(key)

    def resize(self, width, height):
        self.width = width
        self.height = height
        swidth = int(width/3.)
        hwidth = 2*int(width/3.)
        voffset = 0
        self.infobox.resize(width, 0)
        self.setChildPos(self.infoboxIdx,0,voffset)
        voffset += self.infobox.size()[1]
        self.factuurRegelHeader.resize(width, 1)
        self.setChildPos(self.factuurRegelHeaderIdx, 0, voffset)
        voffset += 1
        self.factuurRegelBox.resize(width, height - voffset - 4)
        self.setChildPos(self.factuurRegelBoxIdx, 0, voffset)

        # left colomn
        self.factuurBorrelTotaalLabel.resize(swidth, 1)
        self.setChildPos(self.factuurBorrelTotaalLabelIdx, 0, height-4)
        self.factuurKantineTotaalLabel.resize(swidth, 1)
        self.setChildPos(self.factuurKantineTotaalLabelIdx, 0, height-3)
        self.factuurEmballageTotaalLabel.resize(swidth, 1)
        self.setChildPos(self.factuurEmballageTotaalLabelIdx, 0, height-2)
        self.factuurOverigeTotaalLabel.resize(swidth, 1)
        self.setChildPos(self.factuurOverigeTotaalLabelIdx, 0, height-1)

        # middle column
        self.factuurBorrelTotaalOnafgerondLabel.resize(swidth, 1)
        self.setChildPos(self.factuurBorrelTotaalOnafgerondLabelIdx, swidth, height-4)
        self.factuurKantineTotaalOnafgerondLabel.resize(swidth, 1)
        self.setChildPos(self.factuurKantineTotaalOnafgerondLabelIdx, swidth, height-3)
        self.factuurEmballageTotaalOnafgerondLabel.resize(swidth, 1)
        self.setChildPos(self.factuurEmballageTotaalOnafgerondLabelIdx, swidth, height-2)
        self.factuurOverigeTotaalOnafgerondLabel.resize(swidth, 1)
        self.setChildPos(self.factuurOverigeTotaalOnafgerondLabelIdx, swidth, height-1)

        #right column

        self.factuurBorrelmargeTotaalLabel.resize(swidth, 1)
        self.setChildPos(self.factuurBorrelmargeTotaalLabelIdx, hwidth, height-4)
        self.factuurTotaalLabel.resize(swidth, 1)
        self.setChildPos(self.factuurTotaalLabelIdx, hwidth, height-3)
        self.factuurTotaalOnafgerondLabel.resize(swidth, 1)
        self.setChildPos(self.factuurTotaalOnafgerondLabelIdx, hwidth, height-2)
        self.factuurAfrondingLabel.resize(swidth, 1)
        self.setChildPos(self.factuurAfrondingLabelIdx, hwidth, height-1)
Example #18
0
    def __init__(self, width, height, factuur, manager):
        super(factuurDetail, self).__init__(width, height)

        #Associated data object
        self.factuur = factuur
        self.manager = manager

        self.infobox = factuurInfobox(width, 0, factuur)
        self.infoboxIdx = self.addChild(0, 0, self.infobox)

        self.factuurRegelHeader = factuurRegelHeader(width, 1)
        self.factuurRegelHeaderIdx = self.addChild(0, 0,
                                                   self.factuurRegelHeader)

        self.factuurRegelBox = Listbox(width, 0)
        self.factuurRegelBoxIdx = self.addChild(0, 0, self.factuurRegelBox)

        self.factuurBorrelTotaal = 0
        self.factuurKantineTotaal = 0
        self.factuurEmballageTotaal = 0
        self.factuurOverigeTotaal = 0
        self.factuurBorrelTotaalOnafgerond = 0
        self.factuurKantineTotaalOnafgerond = 0
        self.factuurEmballageTotaalOnafgerond = 0
        self.factuurOverigeTotaalOnafgerond = 0

        for regel in factuur['regels']:
            self.factuurRegelBox.append(factuurRegel(width, 1, regel))
            if 'prd_id' in regel:
                type = getProductType(regel['prd_id'])
                if type == 'kantine':
                    self.factuurKantineTotaal += copysign(
                        regel['totaalprijs'], regel['aantal'])
                    self.factuurKantineTotaalOnafgerond += regel[
                        'stukprijs'] * regel['aantal']
                elif type == 'borrel':
                    self.factuurBorrelTotaal += copysign(
                        regel['totaalprijs'], regel['aantal'])
                    self.factuurBorrelTotaalOnafgerond += regel[
                        'stukprijs'] * regel['aantal']
                elif type == 'emballage':
                    self.factuurEmballageTotaal += copysign(
                        regel['totaalprijs'], regel['aantal'])
                    self.factuurEmballageTotaalOnafgerond += regel[
                        'stukprijs'] * regel['aantal']
                else:
                    self.factuurOverigeTotaal += copysign(
                        regel['totaalprijs'], regel['aantal'])
                    self.factuurOverigeTotaalOnafgerond += regel[
                        'stukprijs'] * regel['aantal']
            else:
                self.factuurOverigeTotaal += copysign(regel['totaalprijs'],
                                                      regel['aantal'])
                self.factuurOverigeTotaalOnafgerond += regel[
                    'stukprijs'] * regel['aantal']

        self.factuurBorrelTotaalLabel = Label(
            0, 0,
            "Borreltotaal: " + moneyConvert(int(self.factuurBorrelTotaal)))
        self.factuurBorrelTotaalLabelIdx = self.addChild(
            0, 0, self.factuurBorrelTotaalLabel)
        self.factuurBorrelmargeTotaalLabel = Label(
            0, 0, "Borrelmargetotaal: " +
            moneyConvert(int(floor(self.factuurBorrelTotaal / 1.03))))
        self.factuurBorrelmargeTotaalLabelIdx = self.addChild(
            0, 0, self.factuurBorrelmargeTotaalLabel)
        self.factuurKantineTotaalLabel = Label(
            0, 0,
            "Kantinetotaal: " + moneyConvert(int(self.factuurKantineTotaal)))
        self.factuurKantineTotaalLabelIdx = self.addChild(
            0, 0, self.factuurKantineTotaalLabel)
        self.factuurEmballageTotaalLabel = Label(
            0, 0, "Emballagetotaal: " +
            moneyConvert(int(self.factuurEmballageTotaal)))
        self.factuurEmballageTotaalLabelIdx = self.addChild(
            0, 0, self.factuurEmballageTotaalLabel)
        self.factuurOverigeTotaalLabel = Label(
            0, 0,
            "Overigetotaal: " + moneyConvert(int(self.factuurOverigeTotaal)))
        self.factuurOverigeTotaalLabelIdx = self.addChild(
            0, 0, self.factuurOverigeTotaalLabel)
        self.factuurTotaalLabel = Label(
            0, 0, "Totaal: " + moneyConvert(
                int(self.factuurBorrelTotaal + self.factuurKantineTotaal +
                    self.factuurEmballageTotaal + self.factuurOverigeTotaal)))
        self.factuurTotaalLabelIdx = self.addChild(0, 0,
                                                   self.factuurTotaalLabel)

        # added details:

        self.factuurBorrelTotaalOnafgerondLabel = Label(
            0, 0, "Borreltotaal-onafgerond: " +
            moneyConvert(int(self.factuurBorrelTotaalOnafgerond)))
        self.factuurBorrelTotaalOnafgerondLabelIdx = self.addChild(
            0, 0, self.factuurBorrelTotaalOnafgerondLabel)
        self.factuurKantineTotaalOnafgerondLabel = Label(
            0, 0, "Kantinetotaal-onafgerond: " +
            moneyConvert(int(self.factuurKantineTotaalOnafgerond)))
        self.factuurKantineTotaalOnafgerondLabelIdx = self.addChild(
            0, 0, self.factuurKantineTotaalOnafgerondLabel)
        self.factuurEmballageTotaalOnafgerondLabel = Label(
            0, 0, "Emballagetotaal-onafgerond: " +
            moneyConvert(int(self.factuurEmballageTotaalOnafgerond)))
        self.factuurEmballageTotaalOnafgerondLabelIdx = self.addChild(
            0, 0, self.factuurEmballageTotaalOnafgerondLabel)
        self.factuurOverigeTotaalOnafgerondLabel = Label(
            0, 0, "Overigetotaal-onafgerond: " +
            moneyConvert(int(self.factuurOverigeTotaalOnafgerond)))
        self.factuurOverigeTotaalOnafgerondLabelIdx = self.addChild(
            0, 0, self.factuurOverigeTotaalOnafgerondLabel)
        self.factuurTotaalOnafgerondLabel = Label(
            0, 0, "Totaal-onafgerond: " + moneyConvert(
                int(self.factuurBorrelTotaalOnafgerond +
                    self.factuurKantineTotaalOnafgerond +
                    self.factuurEmballageTotaalOnafgerond +
                    self.factuurOverigeTotaalOnafgerond)))
        self.factuurTotaalOnafgerondLabelIdx = self.addChild(
            0, 0, self.factuurTotaalOnafgerondLabel)

        self.factuurAfrondingLabel = Label(
            0, 0, "Afronding: " + moneyConvert(
                int(self.factuurBorrelTotaalOnafgerond -
                    self.factuurBorrelTotaal +
                    self.factuurKantineTotaalOnafgerond -
                    self.factuurKantineTotaal +
                    self.factuurEmballageTotaalOnafgerond -
                    self.factuurEmballageTotaal +
                    self.factuurOverigeTotaalOnafgerond -
                    self.factuurOverigeTotaal)))
        self.factuurAfrondingLabelIdx = self.addChild(
            0, 0, self.factuurAfrondingLabel)

        self.resize(width, height)
Example #19
0
class factuurDetail(Container):
    def __init__(self, width, height, factuur, manager):
        super(factuurDetail, self).__init__(width, height)

        #Associated data object
        self.factuur = factuur
        self.manager = manager

        self.infobox = factuurInfobox(width, 0, factuur)
        self.infoboxIdx = self.addChild(0, 0, self.infobox)

        self.factuurRegelHeader = factuurRegelHeader(width, 1)
        self.factuurRegelHeaderIdx = self.addChild(0, 0,
                                                   self.factuurRegelHeader)

        self.factuurRegelBox = Listbox(width, 0)
        self.factuurRegelBoxIdx = self.addChild(0, 0, self.factuurRegelBox)

        self.factuurBorrelTotaal = 0
        self.factuurKantineTotaal = 0
        self.factuurEmballageTotaal = 0
        self.factuurOverigeTotaal = 0
        self.factuurBorrelTotaalOnafgerond = 0
        self.factuurKantineTotaalOnafgerond = 0
        self.factuurEmballageTotaalOnafgerond = 0
        self.factuurOverigeTotaalOnafgerond = 0

        for regel in factuur['regels']:
            self.factuurRegelBox.append(factuurRegel(width, 1, regel))
            if 'prd_id' in regel:
                type = getProductType(regel['prd_id'])
                if type == 'kantine':
                    self.factuurKantineTotaal += copysign(
                        regel['totaalprijs'], regel['aantal'])
                    self.factuurKantineTotaalOnafgerond += regel[
                        'stukprijs'] * regel['aantal']
                elif type == 'borrel':
                    self.factuurBorrelTotaal += copysign(
                        regel['totaalprijs'], regel['aantal'])
                    self.factuurBorrelTotaalOnafgerond += regel[
                        'stukprijs'] * regel['aantal']
                elif type == 'emballage':
                    self.factuurEmballageTotaal += copysign(
                        regel['totaalprijs'], regel['aantal'])
                    self.factuurEmballageTotaalOnafgerond += regel[
                        'stukprijs'] * regel['aantal']
                else:
                    self.factuurOverigeTotaal += copysign(
                        regel['totaalprijs'], regel['aantal'])
                    self.factuurOverigeTotaalOnafgerond += regel[
                        'stukprijs'] * regel['aantal']
            else:
                self.factuurOverigeTotaal += copysign(regel['totaalprijs'],
                                                      regel['aantal'])
                self.factuurOverigeTotaalOnafgerond += regel[
                    'stukprijs'] * regel['aantal']

        self.factuurBorrelTotaalLabel = Label(
            0, 0,
            "Borreltotaal: " + moneyConvert(int(self.factuurBorrelTotaal)))
        self.factuurBorrelTotaalLabelIdx = self.addChild(
            0, 0, self.factuurBorrelTotaalLabel)
        self.factuurBorrelmargeTotaalLabel = Label(
            0, 0, "Borrelmargetotaal: " +
            moneyConvert(int(floor(self.factuurBorrelTotaal / 1.03))))
        self.factuurBorrelmargeTotaalLabelIdx = self.addChild(
            0, 0, self.factuurBorrelmargeTotaalLabel)
        self.factuurKantineTotaalLabel = Label(
            0, 0,
            "Kantinetotaal: " + moneyConvert(int(self.factuurKantineTotaal)))
        self.factuurKantineTotaalLabelIdx = self.addChild(
            0, 0, self.factuurKantineTotaalLabel)
        self.factuurEmballageTotaalLabel = Label(
            0, 0, "Emballagetotaal: " +
            moneyConvert(int(self.factuurEmballageTotaal)))
        self.factuurEmballageTotaalLabelIdx = self.addChild(
            0, 0, self.factuurEmballageTotaalLabel)
        self.factuurOverigeTotaalLabel = Label(
            0, 0,
            "Overigetotaal: " + moneyConvert(int(self.factuurOverigeTotaal)))
        self.factuurOverigeTotaalLabelIdx = self.addChild(
            0, 0, self.factuurOverigeTotaalLabel)
        self.factuurTotaalLabel = Label(
            0, 0, "Totaal: " + moneyConvert(
                int(self.factuurBorrelTotaal + self.factuurKantineTotaal +
                    self.factuurEmballageTotaal + self.factuurOverigeTotaal)))
        self.factuurTotaalLabelIdx = self.addChild(0, 0,
                                                   self.factuurTotaalLabel)

        # added details:

        self.factuurBorrelTotaalOnafgerondLabel = Label(
            0, 0, "Borreltotaal-onafgerond: " +
            moneyConvert(int(self.factuurBorrelTotaalOnafgerond)))
        self.factuurBorrelTotaalOnafgerondLabelIdx = self.addChild(
            0, 0, self.factuurBorrelTotaalOnafgerondLabel)
        self.factuurKantineTotaalOnafgerondLabel = Label(
            0, 0, "Kantinetotaal-onafgerond: " +
            moneyConvert(int(self.factuurKantineTotaalOnafgerond)))
        self.factuurKantineTotaalOnafgerondLabelIdx = self.addChild(
            0, 0, self.factuurKantineTotaalOnafgerondLabel)
        self.factuurEmballageTotaalOnafgerondLabel = Label(
            0, 0, "Emballagetotaal-onafgerond: " +
            moneyConvert(int(self.factuurEmballageTotaalOnafgerond)))
        self.factuurEmballageTotaalOnafgerondLabelIdx = self.addChild(
            0, 0, self.factuurEmballageTotaalOnafgerondLabel)
        self.factuurOverigeTotaalOnafgerondLabel = Label(
            0, 0, "Overigetotaal-onafgerond: " +
            moneyConvert(int(self.factuurOverigeTotaalOnafgerond)))
        self.factuurOverigeTotaalOnafgerondLabelIdx = self.addChild(
            0, 0, self.factuurOverigeTotaalOnafgerondLabel)
        self.factuurTotaalOnafgerondLabel = Label(
            0, 0, "Totaal-onafgerond: " + moneyConvert(
                int(self.factuurBorrelTotaalOnafgerond +
                    self.factuurKantineTotaalOnafgerond +
                    self.factuurEmballageTotaalOnafgerond +
                    self.factuurOverigeTotaalOnafgerond)))
        self.factuurTotaalOnafgerondLabelIdx = self.addChild(
            0, 0, self.factuurTotaalOnafgerondLabel)

        self.factuurAfrondingLabel = Label(
            0, 0, "Afronding: " + moneyConvert(
                int(self.factuurBorrelTotaalOnafgerond -
                    self.factuurBorrelTotaal +
                    self.factuurKantineTotaalOnafgerond -
                    self.factuurKantineTotaal +
                    self.factuurEmballageTotaalOnafgerond -
                    self.factuurEmballageTotaal +
                    self.factuurOverigeTotaalOnafgerond -
                    self.factuurOverigeTotaal)))
        self.factuurAfrondingLabelIdx = self.addChild(
            0, 0, self.factuurAfrondingLabel)

        self.resize(width, height)

    def keyEvent(self, key):
        if key == curses.KEY_BACKSPACE:
            self.manager.pop()
        elif key == ord('c'):
            print "test"
        else:
            super(factuurDetail, self).keyEvent(key)

    def resize(self, width, height):
        self.width = width
        self.height = height
        swidth = int(width / 3.)
        hwidth = 2 * int(width / 3.)
        voffset = 0
        self.infobox.resize(width, 0)
        self.setChildPos(self.infoboxIdx, 0, voffset)
        voffset += self.infobox.size()[1]
        self.factuurRegelHeader.resize(width, 1)
        self.setChildPos(self.factuurRegelHeaderIdx, 0, voffset)
        voffset += 1
        self.factuurRegelBox.resize(width, height - voffset - 4)
        self.setChildPos(self.factuurRegelBoxIdx, 0, voffset)

        # left colomn
        self.factuurBorrelTotaalLabel.resize(swidth, 1)
        self.setChildPos(self.factuurBorrelTotaalLabelIdx, 0, height - 4)
        self.factuurKantineTotaalLabel.resize(swidth, 1)
        self.setChildPos(self.factuurKantineTotaalLabelIdx, 0, height - 3)
        self.factuurEmballageTotaalLabel.resize(swidth, 1)
        self.setChildPos(self.factuurEmballageTotaalLabelIdx, 0, height - 2)
        self.factuurOverigeTotaalLabel.resize(swidth, 1)
        self.setChildPos(self.factuurOverigeTotaalLabelIdx, 0, height - 1)

        # middle column
        self.factuurBorrelTotaalOnafgerondLabel.resize(swidth, 1)
        self.setChildPos(self.factuurBorrelTotaalOnafgerondLabelIdx, swidth,
                         height - 4)
        self.factuurKantineTotaalOnafgerondLabel.resize(swidth, 1)
        self.setChildPos(self.factuurKantineTotaalOnafgerondLabelIdx, swidth,
                         height - 3)
        self.factuurEmballageTotaalOnafgerondLabel.resize(swidth, 1)
        self.setChildPos(self.factuurEmballageTotaalOnafgerondLabelIdx, swidth,
                         height - 2)
        self.factuurOverigeTotaalOnafgerondLabel.resize(swidth, 1)
        self.setChildPos(self.factuurOverigeTotaalOnafgerondLabelIdx, swidth,
                         height - 1)

        #right column

        self.factuurBorrelmargeTotaalLabel.resize(swidth, 1)
        self.setChildPos(self.factuurBorrelmargeTotaalLabelIdx, hwidth,
                         height - 4)
        self.factuurTotaalLabel.resize(swidth, 1)
        self.setChildPos(self.factuurTotaalLabelIdx, hwidth, height - 3)
        self.factuurTotaalOnafgerondLabel.resize(swidth, 1)
        self.setChildPos(self.factuurTotaalOnafgerondLabelIdx, hwidth,
                         height - 2)
        self.factuurAfrondingLabel.resize(swidth, 1)
        self.setChildPos(self.factuurAfrondingLabelIdx, hwidth, height - 1)
Example #20
0
class factuurDetail(Container):
    def __init__(self, width, height, factuur, manager):
        super(factuurDetail, self).__init__(width, height)

        #Associated data object
        self.factuur = factuur
        self.manager = manager

        self.infobox = factuurInfobox(width, 0, factuur)
        self.infoboxIdx = self.addChild(0, 0, self.infobox)

        self.factuurRegelHeader = factuurRegelHeader(width, 1)
        self.factuurRegelHeaderIdx = self.addChild(0, 0,
                                                   self.factuurRegelHeader)

        self.factuurRegelBox = Listbox(width, 0)
        self.factuurRegelBoxIdx = self.addChild(0, 0, self.factuurRegelBox)

        self.factuurBorrelTotaal = 0
        self.factuurKantineTotaal = 0
        self.factuurEmballageTotaal = 0
        self.factuurOverigeTotaal = 0

        for regel in factuur['regels']:
            self.factuurRegelBox.append(factuurRegel(width, 1, regel))
            if 'prd_id' in regel:
                type = getProductType(regel['prd_id'])
                if type == 'kantine':
                    self.factuurKantineTotaal += copysign(
                        regel['totaalprijs'], regel['aantal'])
                elif type == 'borrel':
                    self.factuurBorrelTotaal += copysign(
                        regel['totaalprijs'], regel['aantal'])
                elif type == 'emballage':
                    self.factuurEmballageTotaal += copysign(
                        regel['totaalprijs'], regel['aantal'])
                else:
                    self.factuurOverigeTotaal += copysign(
                        regel['totaalprijs'], regel['aantal'])
            else:
                self.factuurOverigeTotaal += copysign(regel['totaalprijs'],
                                                      regel['aantal'])

        self.factuurBorrelTotaalLabel = Label(
            0, 0,
            "Borreltotaal: " + moneyConvert(int(self.factuurBorrelTotaal)))
        self.factuurBorrelTotaalLabelIdx = self.addChild(
            0, 0, self.factuurBorrelTotaalLabel)
        self.factuurBorrelmargeTotaalLabel = Label(
            0, 0, "Borrelmargetotaal: " +
            moneyConvert(int(round(self.factuurBorrelTotaal / 1.03))))
        self.factuurBorrelmargeTotaalLabelIdx = self.addChild(
            0, 0, self.factuurBorrelmargeTotaalLabel)
        self.factuurKantineTotaalLabel = Label(
            0, 0,
            "Kantinetotaal: " + moneyConvert(int(self.factuurKantineTotaal)))
        self.factuurKantineTotaalLabelIdx = self.addChild(
            0, 0, self.factuurKantineTotaalLabel)
        self.factuurEmballageTotaalLabel = Label(
            0, 0, "Emballagetotaal: " +
            moneyConvert(int(self.factuurEmballageTotaal)))
        self.factuurEmballageTotaalLabelIdx = self.addChild(
            0, 0, self.factuurEmballageTotaalLabel)
        self.factuurOverigeTotaalLabel = Label(
            0, 0,
            "Overigetotaal: " + moneyConvert(int(self.factuurOverigeTotaal)))
        self.factuurOverigeTotaalLabelIdx = self.addChild(
            0, 0, self.factuurOverigeTotaalLabel)
        self.factuurTotaalLabel = Label(
            0, 0, "Totaal: " + moneyConvert(
                int(self.factuurBorrelTotaal + self.factuurKantineTotaal +
                    self.factuurEmballageTotaal + self.factuurOverigeTotaal)))
        self.factuurTotaalLabelIdx = self.addChild(0, 0,
                                                   self.factuurTotaalLabel)

        self.resize(width, height)

    def keyEvent(self, key):
        if key == curses.KEY_BACKSPACE:
            self.manager.pop()
        else:
            super(factuurDetail, self).keyEvent(key)

    def resize(self, width, height):
        self.width = width
        self.height = height
        hwidth = int(width / 2.)
        voffset = 0
        self.infobox.resize(width, 0)
        self.setChildPos(self.infoboxIdx, 0, voffset)
        voffset += self.infobox.size()[1]
        self.factuurRegelHeader.resize(width, 1)
        self.setChildPos(self.factuurRegelHeaderIdx, 0, voffset)
        voffset += 1
        self.factuurRegelBox.resize(width, height - voffset - 3)
        self.setChildPos(self.factuurRegelBoxIdx, 0, voffset)
        self.factuurBorrelTotaalLabel.resize(hwidth, 1)
        self.setChildPos(self.factuurBorrelTotaalLabelIdx, 0, height - 3)
        self.factuurBorrelmargeTotaalLabel.resize(hwidth, 1)
        self.setChildPos(self.factuurBorrelmargeTotaalLabelIdx, hwidth,
                         height - 3)
        self.factuurKantineTotaalLabel.resize(hwidth, 1)
        self.setChildPos(self.factuurKantineTotaalLabelIdx, 0, height - 2)
        self.factuurEmballageTotaalLabel.resize(hwidth, 1)
        self.setChildPos(self.factuurEmballageTotaalLabelIdx, hwidth,
                         height - 2)
        self.factuurOverigeTotaalLabel.resize(hwidth, 1)
        self.setChildPos(self.factuurOverigeTotaalLabelIdx, 0, height - 1)
        self.factuurTotaalLabel.resize(hwidth, 1)
        self.setChildPos(self.factuurTotaalLabelIdx, hwidth, height - 1)
Example #21
0
    def __init__(self, width, height, factuur, manager):
        super(factuurDetail, self).__init__(width, height)

        #Associated data object
        self.factuur = factuur
        self.manager = manager

        self.infobox = factuurInfobox(width,0,factuur)
        self.infoboxIdx = self.addChild(0,0,self.infobox)

        self.factuurRegelHeader = factuurRegelHeader(width,1)
        self.factuurRegelHeaderIdx = self.addChild(0,0,self.factuurRegelHeader)

        self.factuurRegelBox = Listbox(width, 0)
        self.factuurRegelBoxIdx = self.addChild(0,0,self.factuurRegelBox)

        self.factuurBorrelTotaal = 0
        self.factuurBorrelmargeTotaal = 0
        self.factuurKantineTotaal = 0
        self.factuurEmballageTotaal = 0
        self.factuurOverigeTotaal = 0
        self.factuurBorrelTotaalOnafgerond = 0
        self.factuurKantineTotaalOnafgerond = 0
        self.factuurEmballageTotaalOnafgerond = 0
        self.factuurOverigeTotaalOnafgerond = 0

        for regel in factuur['regels']:
            self.factuurRegelBox.append(factuurRegel(width,1,regel))
            if 'prd_id' in regel:
                type = getProductType(regel['prd_id'])
                if type=='kantine':
                    self.factuurKantineTotaal += copysign(regel['totaalprijs'], regel['aantal'])
                    self.factuurKantineTotaalOnafgerond += regel['stukprijs'] * regel['aantal']
                elif type=='borrel':
                    self.factuurBorrelTotaal += copysign(regel['totaalprijs'], regel['aantal'])
                    self.factuurBorrelTotaalOnafgerond += regel['stukprijs'] * regel['aantal']
                    self.factuurBorrelmargeTotaal += floor(regel['stukprijs']/1.03) * regel['aantal']
                elif type=='emballage':
                    self.factuurEmballageTotaal += copysign(regel['totaalprijs'], regel['aantal'])
                    self.factuurEmballageTotaalOnafgerond += regel['stukprijs'] * regel['aantal']
                else:
                    self.factuurOverigeTotaal += copysign(regel['totaalprijs'], regel['aantal'])
                    self.factuurOverigeTotaalOnafgerond += regel['stukprijs'] * regel['aantal']
            else:
                self.factuurOverigeTotaal += copysign(regel['totaalprijs'], regel['aantal'])
                self.factuurOverigeTotaalOnafgerond += regel['stukprijs'] * regel['aantal']

        self.factuurBorrelTotaalLabel = Label(0,0,"Borreltotaal: " + moneyConvert(int(self.factuurBorrelTotaal)))
        self.factuurBorrelTotaalLabelIdx = self.addChild(0,0,self.factuurBorrelTotaalLabel)
        self.factuurBorrelmargeTotaalLabel = Label(0,0,"Borrelmargetotaal: " + moneyConvert(int(self.factuurBorrelmargeTotaal)))
        self.factuurBorrelmargeTotaalLabelIdx = self.addChild(0,0,self.factuurBorrelmargeTotaalLabel)
        self.factuurKantineTotaalLabel = Label(0,0,"Kantinetotaal: " + moneyConvert(int(self.factuurKantineTotaal)))
        self.factuurKantineTotaalLabelIdx = self.addChild(0,0,self.factuurKantineTotaalLabel)
        self.factuurEmballageTotaalLabel = Label(0,0,"Emballagetotaal: " + moneyConvert(int(self.factuurEmballageTotaal)))
        self.factuurEmballageTotaalLabelIdx = self.addChild(0,0,self.factuurEmballageTotaalLabel)
        self.factuurOverigeTotaalLabel = Label(0,0,"Overigetotaal: " + moneyConvert(int(self.factuurOverigeTotaal)))
        self.factuurOverigeTotaalLabelIdx = self.addChild(0,0,self.factuurOverigeTotaalLabel)
        self.factuurTotaalLabel = Label(0,0,"Totaal: " + moneyConvert(int(self.factuurBorrelTotaal+self.factuurKantineTotaal+self.factuurEmballageTotaal+self.factuurOverigeTotaal)))
        self.factuurTotaalLabelIdx = self.addChild(0,0,self.factuurTotaalLabel)

        # added details:

        self.factuurBorrelTotaalOnafgerondLabel = Label(0,0,"Borreltotaal-onafgerond: " + moneyConvert(int(self.factuurBorrelTotaalOnafgerond)))
        self.factuurBorrelTotaalOnafgerondLabelIdx = self.addChild(0,0,self.factuurBorrelTotaalOnafgerondLabel)
        self.factuurKantineTotaalOnafgerondLabel = Label(0,0,"Kantinetotaal-onafgerond: " + moneyConvert(int(self.factuurKantineTotaalOnafgerond)))
        self.factuurKantineTotaalOnafgerondLabelIdx = self.addChild(0,0,self.factuurKantineTotaalOnafgerondLabel)
        self.factuurEmballageTotaalOnafgerondLabel = Label(0,0,"Emballagetotaal-onafgerond: " + moneyConvert(int(self.factuurEmballageTotaalOnafgerond)))
        self.factuurEmballageTotaalOnafgerondLabelIdx = self.addChild(0,0,self.factuurEmballageTotaalOnafgerondLabel)
        self.factuurOverigeTotaalOnafgerondLabel = Label(0,0,"Overigetotaal-onafgerond: " + moneyConvert(int(self.factuurOverigeTotaalOnafgerond)))
        self.factuurOverigeTotaalOnafgerondLabelIdx = self.addChild(0,0,self.factuurOverigeTotaalOnafgerondLabel)
        self.factuurTotaalOnafgerondLabel = Label(0,0,"Totaal-onafgerond: " + moneyConvert(int(self.factuurBorrelTotaalOnafgerond+self.factuurKantineTotaalOnafgerond+self.factuurEmballageTotaalOnafgerond+self.factuurOverigeTotaalOnafgerond)))
        self.factuurTotaalOnafgerondLabelIdx = self.addChild(0,0,self.factuurTotaalOnafgerondLabel)

        self.factuurAfrondingLabel = Label(0,0,"Afronding: " + moneyConvert(int(self.factuurBorrelTotaalOnafgerond - self.factuurBorrelTotaal + self.factuurKantineTotaalOnafgerond - self.factuurKantineTotaal + self.factuurEmballageTotaalOnafgerond - self.factuurEmballageTotaal + self.factuurOverigeTotaalOnafgerond - self.factuurOverigeTotaal)))
        self.factuurAfrondingLabelIdx = self.addChild(0,0,self.factuurAfrondingLabel)

        self.resize(width, height)