示例#1
0
    def run(self):
        self.logger.debug("start")
        sd = datetime.date(
            SapyValues.get_value("date").year,
            SapyValues.get_value("date").month, 1)

        ed = datetime.date(
            SapyValues.get_value("date").year,
            SapyValues.get_value("date").month,
            calendar.monthrange(
                SapyValues.get_value("date").year,
                SapyValues.get_value("date").month)[0])

        print("objectives this month was:")
        for o in objs.get_objs(self.logger):
            if o.duedate.month == SapyValues.get_value("date").month:
                print("|\t{}\t|\t{}\t|".format(o.description, o.duedate))

        #TODO ask for complete objectives

        l_real = loms.get_lom(name="real")

        l_b = l_real.balance(start_date=sd, end_date=ed)

        l_planned = loms.get_lom(name="expected")

        p_b = l_planned.balance(start_date=sd, end_date=ed)

        print("============================")
        print("expected balance :", p_b)
        print("real balance :", l_b)
        print("============================")

        self.logger.debug("end")
示例#2
0
    def toggle_visible_list(self, widget, path):
        self.lists_store[path][3] = not self.lists_store[path][3]
        lom = loms.get_lom(id=self.lists_store[path][1])

        lom.set_visible(self.lists_store[path][3])

        self.update_plot()
示例#3
0
    def run(self):
        self.logger.debug("start")

        l = loms.get_lom(name=self.name)

        if l:
            SapyValues.set_value('lom', l)

        self.logger.debug("end")
示例#4
0
    def rm_lom(self):
        l = loms.get_lom(id=self.id2rm)

        mlist = l.get_moms()

        for m in mlist:
            m.delete()

        l.delete()
示例#5
0
    def del_lom(self):
        for lom_row in self.lists_store:
            if lom_row[0]:
                del_lom = loms.get_lom(id=lom_row[1])

                if del_lom:
                    self.view.gtkWindow.controller.remove_lom_page(del_lom.name)
                    del_lom.delete()

                self.lists_store.remove(lom_row.iter)
示例#6
0
    def on_button_clicked(self, widget):
        if self.home_ctrl.has_lom_selected():
            for lom_row in self.home_ctrl.lists_store:
                if lom_row[0] == True:
                    lom = loms.get_lom(id=lom_row[1])

                    dialog = Update_Lom_Dialog_View(self.gtkWindow, lom)

                    if dialog.run() == Gtk.ResponseType.OK:
                        dialog.controller.run_update_lom()

                    dialog.destroy()
        else:
            dialog = No_Item_Selected(self.gtkWindow)
            dialog.run()
            dialog.destroy()
        self.home_ctrl.update_loms()
        self.home_ctrl.update_plot()
示例#7
0
    def run(self):
        self.logger.debug("start")
        print("objectives for next month are:")
        for o in objs.get_objs(self.logger):
            if o.duedate.month == datetime.today().month:
                print("|\t{}\t|\t{}\t|".format(o.description,o.duedate))

        print("do you want add objectives for this new month ?[Y/n]")
        r = '.'
        while r != 'Y' and r != 'n' and '' != r:
            r = input().strip() 

        if r == 'Y' or r == '':
            flag = True
            while flag:
                SetCause(input("insert description:").strip()).run()
                date = input("insert due date:").strip()
                if len(date) > 8:
                    SetDate(date).run()
                RunAdd('obj').run()
                r = input('continue? [Y/n]').strip()
                if r != 'Y' and r != '':
                    flag=False
        
        print("incomes for next month are:")
        for m in loms.get_lom(name="expected").get_moms():
           if m.time.month == datetime.today().month and m.value > 0 :
                print("|\t{}\t|\t{}\t|\t{}\t|".format(m.cause,m.value,m.time))

        print("are you aware if incomes for the next month ?[Y/n]")
        r = '.'
        while r != 'Y' and r != 'n' and '' != r:
            r = input().strip() 

        if r == 'Y' or r == '':
            flag = True
            while flag:
                SetLom("expected")
                SetCause(input("insert cause:").strip()).run()
                SetValue(input("insert value:").strip()).run()
                date = input("insert due date:").strip()
                if len(date) > 8:
                    SetDate(date).run()
                RunAdd('mom').run()

                r = input('continue? [Y/n]').strip()
                if r != 'Y' and r != '':
                    flag=False

        self.logger.debug("end")

        print("outcomes for next month are:")
        for m in loms.get_lom(name="expected").get_moms():
           if m.time.month == datetime.today().month and m.value < 0 :
                print("|\t{}\t|\t{}\t|\t{}\t|".format(m.cause,m.value,m.time))


        print("are you aware if outcomes for the next month ?[Y/n]")
        r = '.'
        while r != 'Y' and r != 'n' and '' != r:
            r = input().strip() 

        if r == 'Y' or r == '':
            flag = True
            while flag:
                SetLom("expected")
                SetCause(input("insert cause:").strip()).run()
                SetValue(input("insert value:").strip()).run()
                date = input("insert due date:").strip()
                if len(date) > 8:
                    SetDate(date).run()
                RunAdd('mom').run()

                r = input('continue? [Y/n]').strip()
                if r != 'Y' and r != '':
                    flag=False

        self.logger.debug("end")

        
示例#8
0
    def run(self):
        self.logger.debug("start")
        se = (datetime.today() - timedelta(days=7)).date()
        ed = datetime.today().date()

        print("objectives for this month are:")
        SetStart(str(se))
        SetEnd(str(ed))
        RunList("obj")

        # TODO: add ask for import them from file

        print("outcomes for this week:")
        for m in loms.get_lom(name="expected").get_moms():
            if m.time <= ed and m.time > se and m.value < 0:
                print("|\t{}\t|\t{}\t|\t{}\t|".format(m.cause, m.value,
                                                      m.time))

        print("did you have incomes this week?[Y/n]")
        r = '.'
        while r != 'Y' and r != 'n' and '' != r:
            r = input().strip()

        if r == 'Y' or r == '':
            flag = True
            while flag:
                SetLom("real")
                SetCause(input("insert cause:").strip()).run()
                SetValue(input("insert value:").strip()).run()
                date = input("insert due date:").strip()
                if len(date) > 8:
                    SetDate(date).run()
                RunAdd('mom').run()

                r = input('continue? [Y/n]').strip()
                if r != 'Y' and r != '':
                    flag = False

        self.logger.debug("end")

        print("outcomes for this week:")
        for m in loms.get_lom(name="expected").get_moms():
            if m.time <= ed and m.time > se and m.value < 0:
                print("|\t{}\t|\t{}\t|\t{}\t|".format(m.cause, m.value,
                                                      m.time))

        print("did you have outcomes this week ?[Y/n]")
        r = '.'
        while r != 'Y' and r != 'n' and '' != r:
            r = input().strip()

        if r == 'Y' or r == '':
            flag = True
            while flag:
                SetLom("real")
                SetCause(input("insert cause:").strip()).run()
                SetValue(input("insert value:").strip()).run()
                date = input("insert due date:").strip()
                if len(date) > 8:
                    SetDate(date).run()
                RunAdd('mom').run()

                r = input('continue? [Y/n]').strip()
                if r != 'Y' and r != '':
                    flag = False

        self.logger.debug("end")