Beispiel #1
0
    def buildJoinedModels(self, model, row):
        keys = row.keys()
        model.tipoRenda = TipoRenda(
            id=row['tipo_renda_id'],
            desc=row['desc'] if 'desc' in keys else None,
            auto=row['auto'] if 'auto' in keys else None)

        model.month = Month(id=row['month_id'] if 'month_id' in keys else None,
                            month=row['month'] if 'month' in keys else None)
Beispiel #2
0
def ls_renda(params=None):
    rendas = RendaProcessor(month=month).find()
    rendaHeader = Renda()
    print(rendaHeader.defOutputStrHeader())
    print(rendaHeader.defOutputHr())
    total = 0.0
    for r in rendas:
        total += r.val if not r.tipoRenda.auto else 0.0
        print(r.defOutputStr())

    rendaTotal = Renda(TipoRenda(desc='Total'), val=total)
    print(rendaHeader.defOutputHr())
    print(rendaTotal.defOutputStr())
    print()
Beispiel #3
0
    def updateReserva(self):
        rendaDAO = RendaDAO()
        tipoRenda = TipoRenda(auto = 1)
        tipoRenda = TipoRendaDAO().find(tipoRenda)[0]
        renda = Renda(month = self.month, tipoRenda = tipoRenda)
        result = rendaDAO.find(renda)

        update = False
        if len(result) > 0:
            renda = result[0]
            update = True
                    
        renda.val = self.calculateReserva()
        if update:
            self.rendaDAO.update(renda)
        else:
            self.rendaDAO.add(renda)
Beispiel #4
0
def rm_renda(params=None):
    renda = Renda(tipoRenda=TipoRenda(id=params[0]))
    RendaProcessor(month=month).delete(renda)
Beispiel #5
0
 def __init__(self, tipoRenda=None, val=None, month=None, taxable=None):
     self.tipoRenda = tipoRenda if tipoRenda else TipoRenda()
     self.val = val
     self.month = month
     self.taxable = taxable
Beispiel #6
0
 def getTestRowFilterModel(self):
     return Renda(tipoRenda=TipoRenda(id='reserva'), month='2018-02-01')
Beispiel #7
0
 def testAdd(self):
     renda = Renda(tipoRenda=TipoRenda(id='reserva'),
                   val=1800,
                   month='2018-02-01')
     self.rendaDAO.add(renda)
     print(self.getJustifiedSuccessMsg('add'))
Beispiel #8
0
 def testFind(self):
     result = self.tipoRendaDAO.find(TipoRenda())
     assert len(result) == 6, "there must be 6 TipoRenda rows"
     assert type(result[0]).__name__ == 'TipoRenda'
     print("first row: {}".format(result[0]))
     print(self.getJustifiedSuccessMsg("find"))