예제 #1
0
파일: verify.py 프로젝트: sychov/conditer
        def b_verify(self):
            """Срабатывает при нажатии кнопки "Сверить список".
            Проводит предварительную сверку количества товаров."""

            if tkMessageBox.askokcancel('Внимание!',
                          'Вы действительно хотите сверить список со складом?'):

                self.button_del.configure(state=NORMAL)
                for cath in queries.cathegories():
                    for eat in queries.real_items_in_cathegory_shown(cath):

                        storage_quantity = int(queries.items_in_storage(eat))
                        if storage_quantity and (eat not in self.bill):
                            self.bill.append(eat)
                            self.quantity.append(0)
                            string = u' %-' + unicode(VERIFY_WIDTH -
                                                     30) + u's %8d %3s (%s %3s)'
                            string = string % (eat.name, 0, eat.measure,
                                                  storage_quantity, eat.measure)
                            self.listbox.insert(END, string)
                            self.listbox.itemconfig(END, {'fg':'red'})

                #и для Ингредиентов
                for eat in queries.real_items_in_cathegory_shown(None):
                    storage_quantity = int(queries.items_in_storage(eat))
                    if storage_quantity and (eat not in self.bill):
                        self.bill.append(eat)
                        self.quantity.append(0)
                        string = u' %-' + unicode(VERIFY_WIDTH -
                                                 30) + u's %8d %3s (%s %3s)'
                        string = string % (eat.name, 0, eat.measure,
                                              storage_quantity, eat.measure)
                        self.listbox.insert(END, string)
                        self.listbox.itemconfig(END, {'fg':'red'})
예제 #2
0
파일: verify.py 프로젝트: sychov/conditer
        def b_accept(self):
            """Срабатывает при нажатии "Провести операцию" на панели списка.
            Полностью проводит приход по бухгалтерии, добавляя излишки товара и
            списывая недостачу. Изменяет базу данных"""

            if not self.bill:
                tkMessageBox.showwarning('Однако!',
                                       'Список пуст, инвентаризировать нечего.')

            elif tkMessageBox.askokcancel('Внимание!',
                                   'Вы утверждаете результаты инвентаризации?'):

                #Проводим сверку инвентаризационного списка со складом
                for cath in queries.cathegories():
                    for eat in queries.real_items_in_cathegory_shown(cath):

                        storage_quantity = int(queries.items_in_storage(eat))
                        if storage_quantity and (eat not in self.bill):
                            self.bill.append(eat)
                            self.quantity.append(0)
                            string = u' %-' + unicode(VERIFY_WIDTH -
                                                     30) + u's %8d %3s (%s %3s)'
                            string = string % (eat.name, 0, eat.measure,
                                                  storage_quantity, eat.measure)
                            self.listbox.insert(END, string)
                            self.listbox.itemconfig(END, {'fg':'red'})

                #...и для ингредиентов
                for eat in queries.real_items_in_cathegory_shown(None):
                    storage_quantity = int(queries.items_in_storage(eat))
                    if storage_quantity and (eat not in self.bill):
                        self.bill.append(eat)
                        self.quantity.append(0)
                        string = u' %-' + unicode(VERIFY_WIDTH -
                                                 30) + u's %8d %3s (%s %3s)'
                        string = string % (eat.name, 0, eat.measure,
                                              storage_quantity, eat.measure)
                        self.listbox.insert(END, string)
                        self.listbox.itemconfig(END, {'fg':'red'})

                if not tkMessageBox.askyesno('Внимание!',
              'Будете ознакамливаться с окончательным списком (после сверки)?'):
                    queries.execute_inventarize(self.bill, self.quantity,
                                                         self.memo.get(1.0,END))
                    self.bill = []
                    self.quantity = []
                    self.listbox.delete(0, END)
                    self.button_del.configure(state=DISABLED)

                    show_verify.master.destroy()
                    incomingBottomFrame = Canvas(MasterFrame,
                                                           highlightthickness=0)
                    show_verify.master = incomingBottomFrame

                    if USE_BACKGROUND:
                        incomingBottomFrame.create_image(0,0, anchor='nw',
                                                               image=data.photo)
                    incomingBottomFrame.pack(side=LEFT, fill=BOTH, expand=YES)
                    show_verify_cathegory(incomingBottomFrame)
예제 #3
0
파일: verify.py 프로젝트: sychov/conditer
    def show_verify_eat(master, cath):
        """Заполняет нижний фрейм списком еды (кнопками с надписями)"""

        small_butons = []
        small_butons.append(Button(master, text='...',
                            width=SELL_WORD_WIDTH, style='Eat.TButton',
                            command = lambda:press_eat(master, eat='')))

        # ---Первую кнопку кладем отдельно для определения количества по ширине-
        small_butons[0].grid(column=0, row=0,padx=SELL_WORD_PADX,
                                                    pady=SELL_WORD_PADY)
        master.update()
        x1 = master.winfo_width()
        x2 = small_butons[0].winfo_width()
        SELL_WORD_COUNT = x1/(x2+SELL_WORD_PADX*2)
        # ----------------------------------------------------------------------

        goods = queries.real_items_in_cathegory_shown(cath)
        for item in goods:
            if cath:            #Для ингредиентов еще выводим единицы измерения
                spaces = (SELL_WORD_WIDTH - len(item.name)) * ' '
                text = item.name + spaces
            else:
                spaces = (SELL_WORD_WIDTH - len(item.name) - 4) * ' '
                text = item.name + spaces + ' %-4s' % item.measure

            small_butons.append(Button(master, text=text,
                        width=SELL_WORD_WIDTH, style=('Eat.TButton'),
                        command = lambda eat=item: press_eat(master, eat)))

        for q in range (1, len(small_butons)):
            small_butons[q].grid(column=q%SELL_WORD_COUNT,
                row=q//SELL_WORD_COUNT,padx=SELL_WORD_PADX, pady=SELL_WORD_PADY)
예제 #4
0
파일: verify.py 프로젝트: sychov/conditer
    def show_verify_cathegory(master):
        """Заполняет нижний фрейм списком категорий товаров (кнопками с
        картинками). """

        big_buttons = []
        for cathegory in queries.cathegories():
            if cathegory.name <> u'Акции':
                big_buttons.append(Button(master,
                            text=cathegory.name,
                            image=data.IMAGES[cathegory.picture],
                            compound="top", style='Default.TButton',
                            command=lambda cath=cathegory:
                                           press_cathegory(master, cath)))

                if not queries.real_items_in_cathegory_shown(cathegory):
                    big_buttons[-1].configure(state=DISABLED)

        # + одну кнопку для "голых" индредиентов
        big_buttons.append(Button(master,
                        text=u'Ингредиенты',
                        image=data.IMAGES[u'Ингредиенты'],
                        compound="top", style='Default.TButton',
                        command=lambda cath=None:
                                       press_cathegory(master, cath)))

        big_buttons[0].grid(column=0, row=0,
                        padx=SELL_BUTTON_PADX, pady=SELL_BUTTON_PADY)

        master.update()
        x1 = master.winfo_width()
        x2 = big_buttons[0].winfo_width()
        SELL_BUTTON_COUNT = x1//(x2+SELL_BUTTON_PADX*2)
        if SELL_BUTTON_COUNT:
            for q in range (1, len(big_buttons)):
                big_buttons[q].grid(column=q%SELL_BUTTON_COUNT,
                                    row=q//SELL_BUTTON_COUNT,
                                    padx=SELL_BUTTON_PADX,
                                    pady=SELL_BUTTON_PADY)