Exemplo n.º 1
0
    def turnover_projections(self):
        """
            Return a query for turnover projections
        """
        query = TurnoverProjection.query()
        query = query.filter(
            TurnoverProjection.company_id == self.request.context.id)
        result = query.filter(TurnoverProjection.year == self.year)

        return result
Exemplo n.º 2
0
    def turnover_projections(self):
        """
            Return a query for turnover projections
        """
        query = TurnoverProjection.query()
        query = query.filter(
            TurnoverProjection.company_id==self.request.context.id
            )
        result = query.filter(TurnoverProjection.year==self.year)

        return result
Exemplo n.º 3
0
    def submit_success(self, appstruct):
        """
            Add/Edit a turnover projection in the database
        """
        appstruct['year'] = self.year
        appstruct['company_id'] = self.request.context.id

        query = self.turnover_projections()
        query = query.filter(TurnoverProjection.month == appstruct['month'])
        result = query.first()

        projection = result or TurnoverProjection()

        projection = merge_session_with_post(projection, appstruct)
        if projection.id is not None:
            projection = self.request.dbsession.merge(projection)
        else:
            self.request.dbsession.add(projection)
        url = get_current_url(self.request)
        return HTTPFound(url)
Exemplo n.º 4
0
def getOne():
    return TurnoverProjection.query().first()
Exemplo n.º 5
0
def getOne():
    return TurnoverProjection.query().first()