예제 #1
0
    def add_category(self):
        if self.category.get() != '':
            cat = self.category.get()
            query = fn.insertDB('category', 1)

            fn.run_query(query, parameters=(cat, ))
            self.close_add_category()
        else:
            messagebox.showerror(
                title='Error', message='Casilla de texto no puede estar vacia')
예제 #2
0
 def update_category(self):
     if self.category.get() != '':
         category = self.category.get()
         iid = self.iid
         col = [
             'name',
         ]
         query = fn.updateBD('category', col)
         parameters = (category, iid)
         fn.run_query(query, parameters)
         messagebox.showinfo(title='Exito',
                             message='La categoria ha sido actualizada')
         self.master.destroy()
예제 #3
0
    def update_bank_acount(self):
        iid = self.tree.item(self.tree.selection())['text']
        col = ['name', 'cbu', 'balance']
        query = fn.updateBD('bankacount', iid, col)

        num = self.number.get()
        cbu = self.cbu.get()
        balance = self.balance.get()

        parameters = (num, cbu, balance, iid)
        fn.run_query(query, parameters)

        self.get_bank_acount()
        self.disable_edit()
예제 #4
0
    def update_expense(self):
        if self.name.get() != '' and self.category.get() != '':
            name = self.name.get()
            iid= fn.get_id('expenses', name)
            category = fn.get_id('category', self.category.get())
            col = ['name', 'id_category']
            query = fn.updateBD('expenses', col)
            parameters = [name, category, iid]

            fn.run_query(query, parameters)
            messagebox.showinfo(title = 'Éxito', message = 'La subcategoria a sido actualizada con exito', parent = self.master)
            self.close_edit_expenses()
        else:
            messagebox.showwarning(title = 'Atención!!!', message = 'Las entradas no pueden estar vacias')
예제 #5
0
    def update_card(self):
        name = self.name.get()
        deadline = self.deadline.get()
        duedate = self.duedate.get()
        balance = self.balance.get()

        if name != '' and deadline != '' and duedate != '' and balance != '':
            iid = fn.get_id('creditcards', name)
            col = ['name', 'deadline', 'duedate', 'balance']
            query = fn.updateBD('creditcards', col)
            parameters = (name, deadline, duedate, balance, iid)
            fn.run_query(query, parameters)
            self.close_edit_card()
        else:
            messagebox.showerror(title='Error',
                                 message='No puede haber ningun dato vacio')
예제 #6
0
 def add_bank_acount(self):
     if self.validar():
         idtype = fn.get_id('acountype', self.typeacount.get())
         idbank = fn.get_id('banks', self.bank.get())
         parameters = (self.name.get(), idtype, idbank, self.cbu.get(),
                       self.balance.get())
         fn.run_query(fn.insertDB('bankacount', 5), parameters)
         messagebox.showinfo(title='Éxito',
                             message='Cuenta agregada con éxito',
                             parent=self.master)
         self.master.destroy()
         ba.BankAcount.get_bank_acount(self)
     else:
         messagebox.showwarning(title='Error',
                                message='No pueden haber datos incompletos',
                                parent=self.master)
예제 #7
0
    def get_bank(self):
        query = fn.selectDB('banks', 'ASC')
        db_rows = fn.run_query(query)
        ls_banks = []
        for row in db_rows:
            ls_banks.append(row[1])

        return ls_banks
예제 #8
0
    def get_type_acount(self):
        query = fn.selectDB('acountype', 'ASC')
        db_rows = fn.run_query(query)
        ls_acount = []
        for row in db_rows:
            ls_acount.append(row[1])

        return ls_acount
예제 #9
0
    def add_expense(self):
        if self.name.get() != '' and self.category.get() != '':
            name = self.name.get()
            category = fn.get_id('category', self.category.get())

            query = fn.insertDB('expenses', 2)
            parameters = [name, category]

            fn.run_query(query, parameters)
            messagebox.showinfo(
                title='Éxito',
                message='La subcategoria a sido agregada con exito',
                parent=self.master)
            self.close_add_expenses()
        else:
            messagebox.showwarning(
                title='Atención!!!',
                message='Las entradas no pueden estar vacias')
예제 #10
0
    def get_category(self):
        records = self.tree.get_children()
        for elements in records:
            self.tree.delete(elements)

        db_rows = fn.run_query(fn.selectDB('category', 'DESC'))

        for row in db_rows:
            self.tree.insert('', 0, text=row[0], values=row[1:])
예제 #11
0
    def update_cards(self):
        if fn.validateDateFormat(
                self.deadline.get()) and fn.validateDateFormat(
                    self.duedate.get()):
            iid = self.item('id')
            col = ['name', 'deadline', 'duedate', 'balance']
            query = fn.updateBD('creditcards', col)

            name = self.name.get()
            deadline = self.deadline.get()
            duedate = self.duedate.get()
            balance = self.balance.get()

            parameters = (name, deadline, duedate, balance, iid)
            fn.run_query(query, parameters)

            self.get_cards()
            # self.tree.selection_remove()
            self.disable_edit()
        else:
            messagebox.showerror(
                title='formato invalido',
                message='La fecha debe tener el formato aaaa-mm-dd')
예제 #12
0
    def get_cards(self):
        records = self.tree.get_children()
        for elements in records:
            self.tree.delete(elements)

        db_rows = fn.run_query(fn.selectDB('creditcards', 'DESC'))

        suma = 0

        for row in db_rows:
            id = row[0]
            name = row[1]
            deadline = fn.format_date(row[2])
            duedate = fn.format_date(row[3])
            balance = fn.format_currency(row[4])
            suma += row[4]

            xRow = [id, name, deadline, duedate, balance]
            self.tree.insert('', 0, text=xRow[0], values=xRow[1:])
        self.total.delete(0, tk.END)
        total = '{:.2f}'.format(suma)
        self.total.insert(0, fn.format_currency(total))
예제 #13
0
    def get_bank_acount(self):
        records = self.tree.get_children()
        for elements in records:
            self.tree.delete(elements)

        db_rows = fn.run_query(fn.selectDB('bankacount', 'DESC'))
        suma = 0

        for row in db_rows:
            id = row[0]
            name = row[1]
            typeacc = fn.get_name('acountype', row[2])
            bank = fn.get_name('banks', row[3])
            cbu = str(row[4])
            balance = fn.format_currency(row[5])
            suma += row[5]

            xRow = [id, name, typeacc, bank, cbu, balance]
            self.tree.insert('', 0, text=xRow[0], values=xRow[1:])

        total = '{:.2f}'.format(suma)
        self.total.delete(0, tk.END)
        self.total.insert(0, fn.format_currency(total))