Пример #1
0
    def _setup_summary_labels(self):
        value_format = "<b>%s</b>"
        total_label = "<b>%s</b>" % api.escape(_("Total:"))
        total_summary_label = SummaryLabel(klist=self.payments_list,
                                           column='value',
                                           label=total_label,
                                           value_format=value_format)
        total_summary_label.show()
        self.payments_vbox.pack_start(total_summary_label, False, True, 0)

        total_label = "<b>%s</b>" % api.escape(_("Total paid:"))
        total_paid_summary_label = SummaryLabel(klist=self.payments_list,
                                                column='paid_value',
                                                label=total_label,
                                                value_format=value_format)
        total_paid_summary_label.show()
        self.payments_vbox.pack_start(total_paid_summary_label, False, True, 0)

        total_label = "<b>%s</b>" % api.escape(_("Total:"))
        transaction_summary_label = SummaryLabel(
            klist=self.stock_transactions_list,
            column='total',
            label=total_label,
            value_format=value_format)
        transaction_summary_label.show()
        self.stock_transactions_vbox.pack_start(transaction_summary_label,
                                                False, True, 0)

        total_label = "<b>%s</b>" % api.escape(_("Total:"))
        sale_summary_label = SummaryLabel(klist=self.sales_list,
                                          column='total',
                                          label=total_label,
                                          value_format=value_format)
        sale_summary_label.show()
        self.sales_vbox.pack_start(sale_summary_label, False, True, 0)
Пример #2
0
    def _setup_widgets(self):
        is_package = self.model.product.is_package
        component_list = list(self._get_products(additional_query=is_package))
        if component_list:
            self.component_combo.prefill(component_list)
        else:
            self.sort_components_check.set_sensitive(False)

        self.yield_quantity.set_adjustment(
            gtk.Adjustment(lower=0, upper=MAX_INT, step_incr=1))

        self.component_tree.set_columns(self._get_columns())
        self._populate_component_tree()
        self.component_label = SummaryLabel(klist=self.component_tree,
                                            column='total_production_cost',
                                            label='<b>%s</b>' %
                                            api.escape(_(u'Total:')),
                                            value_format='<b>%s</b>')
        self.component_label.show()
        self.component_tree_vbox.pack_start(self.component_label, False)
        self.info_label.set_bold(True)
        self._update_widgets()
        if self.visual_mode:
            self.component_combo.set_sensitive(False)
            self.add_button.set_sensitive(False)
            self.sort_components_check.set_sensitive(False)
Пример #3
0
 def _setup_summary_labels(self):
     summary_label = SummaryLabel(klist=self.payments_list,
                                  column='paid_value',
                                  label='<b>%s</b>' % api.escape(_(u"Total:")),
                                  value_format='<b>%s</b>')
     summary_label.show()
     self.payments_vbox.pack_start(summary_label, False)
Пример #4
0
 def _setup_summary_labels(self):
     order_summary_label = SummaryLabel(klist=self.ordered_items,
                                        column='total',
                                        label='<b>%s</b>' %
                                        api.escape(_(u"Total")),
                                        value_format='<b>%s</b>')
     order_summary_label.show()
     self.ordered_vbox.pack_start(order_summary_label, False)
Пример #5
0
 def _setup_summary(self):
     # FIXME: Move this into AdditionListSlave
     if not self.summary_label_column:
         self.summary = None
         return
     self.summary = SummaryLabel(klist=self.slave.klist,
                                 column=self.summary_label_column,
                                 label=self.summary_label_text,
                                 value_format='<b>%s</b>')
     self.summary.show()
     self.slave.list_vbox.pack_start(self.summary, False, True, 0)
Пример #6
0
    def setup_widgets(self):
        value_format = '<b>%s</b>'
        balance_label = "<b>%s</b>" % api.escape(_("Balance:"))

        account_summary_label = SummaryLabel(klist=self.klist,
                                             column='paid_value',
                                             label=balance_label,
                                             value_format=value_format,
                                             data_func=lambda p: p.is_outpayment())

        account_summary_label.show()
        self.pack_start(account_summary_label, False)
Пример #7
0
    def _setup_widgets(self):
        self._setup_status()

        self.product_list.set_columns(self._get_product_columns())
        products = self.store.find(TransferOrderItem, transfer_order=self.model)
        self.product_list.add_list(list(products))

        value_format = '<b>%s</b>'
        total_label = value_format % api.escape(_("Total:"))
        products_summary_label = SummaryLabel(klist=self.product_list,
                                              column='total',
                                              label=total_label,
                                              value_format=value_format)
        products_summary_label.show()
        self.products_vbox.pack_start(products_summary_label, False, True, 0)
Пример #8
0
    def _create_summary_label(self, report, column='value', label=None):
        # Setting tha data
        obj_list = getattr(self, report + '_list')
        box = getattr(self, report + '_vbox')
        if label is None:
            label = _('Total:')
        label = '<b>%s</b>' % api.escape(label)
        value_format = '<b>%s</b>'

        # Creating the label
        label = SummaryLabel(klist=obj_list, column=column, label=label,
                             value_format=value_format)

        # Displaying the label
        box.pack_start(label, False, False, 0)
        label.show()
        return label
Пример #9
0
    def _setup_widgets(self):
        # We cant remove cash if closing till from a previous day
        self.value.set_sensitive(not self._previous_day)
        if self._previous_day:
            value = 0
        else:
            value = self.model.get_balance()
        self.value.update(value)

        self.day_history.set_columns(self._get_columns())
        self.day_history.connect('row-activated', lambda olist, row: self.confirm())
        self.day_history.add_list(self._get_day_history())
        summary_day_history = SummaryLabel(
            klist=self.day_history,
            column='value',
            label='<b>%s</b>' % api.escape(_(u'Total balance:')))
        summary_day_history.show()
        self.day_history_box.pack_start(summary_day_history, False, True, 0)
Пример #10
0
    def setup_widgets(self):
        value_format = '<b>%s</b>'
        total_label = "<b>%s</b>" % api.escape(_("Total:"))
        sales_summary_label = SummaryLabel(klist=self.klist,
                                           column='total',
                                           label=total_label,
                                           value_format=value_format)
        sales_summary_label.show()
        self.pack_start(sales_summary_label, False)

        self.has_open_inventory = self._has_open_inventory()

        if len(self.klist):
            return_button = gtk.Button(_('Return sale'))
            self.button_box.pack_start(return_button)
            return_button.set_sensitive(bool(self.klist.get_selected()))
            return_button.show()

            self.button_box.return_button = return_button
            return_button.connect('clicked', self._on_return_button__clicked)
Пример #11
0
    def _setup_widgets(self):
        self.product_list.set_columns(self._get_product_columns())
        # if the parameter is on we have to build the summary
        if api.sysparam.get_bool("CREATE_PAYMENTS_ON_STOCK_DECREASE"):
            value_format = '<b>%s</b>'
            total_cost_label = value_format % stoq_api.escape(_("Total cost:"))
            products_cost_summary_label = SummaryLabel(klist=self.product_list,
                                                       column='total_cost',
                                                       label=total_cost_label,
                                                       value_format=value_format)
            products_cost_summary_label.show()
            self.products_vbox.pack_start(products_cost_summary_label, False, True, 0)
        products = self.store.find(StockDecreaseItem, stock_decrease=self.model)
        self.product_list.add_list(list(products))

        if self.model.group:
            self.payment_list.set_columns(self._get_payment_columns())
            self.payment_list.add_list(list(self.model.group.payments))
        else:
            self.notebook.remove_page(2)
Пример #12
0
    def _setup_widgets(self):
        self.purchases_list.set_columns(self._get_purchase_columns())
        self.product_list.set_columns(self._get_product_columns())
        self.payments_list.set_columns(self._get_payments_columns())

        purchases = self.model.get_supplier_purchases()
        self.purchases_list.add_list(purchases)

        self._build_data(purchases)
        self.product_list.add_list(self.products)
        self.payments_list.add_list(self.payments)

        value_format = '<b>%s</b>'
        total_label = "<b>%s</b>" % api.escape(_("Total:"))
        purchases_summary_label = SummaryLabel(klist=self.purchases_list,
                                               column='total',
                                               label=total_label,
                                               value_format=value_format)

        purchases_summary_label.show()
        self.purchases_vbox.pack_start(purchases_summary_label, False, True, 0)
Пример #13
0
    def _setup_widgets(self):
        # We cant remove cash if closing till from a previous day
        self.value.set_sensitive(not self._previous_day)
        if self._previous_day:
            value = 0
        else:
            value = self.model.get_balance()
        self.value.update(value)

        self.day_history.set_columns(self._get_columns())
        if not self._blind_close:
            self.day_history.add_list(self._get_day_history())
            summary_day_history = SummaryLabel(
                klist=self.day_history,
                column='system_value',
                label='<b>%s</b>' % api.escape(_(u'Total balance:')))
            summary_day_history.show()
            self.day_history_box.pack_start(summary_day_history, False, True,
                                            0)
        else:
            self.totals_grid.hide()
            self.day_history.add_list(self.till.create_day_summary())
Пример #14
0
    def _setup_widgets(self):
        component_list = list(self._get_products())
        if component_list:
            self.component_combo.prefill(component_list)
        else:
            self.sort_components_check.set_sensitive(False)

        self.component_tree.set_columns(self._get_columns())
        self._populate_component_tree()
        self.component_label = SummaryLabel(klist=self.component_tree,
                                            column='total_production_cost',
                                            label='<b>%s</b>' %
                                            api.escape(_(u'Total:')),
                                            value_format='<b>%s</b>')
        self.component_label.show()
        self.component_tree_vbox.pack_start(self.component_label, False)
        self.info_label.set_bold(True)
        self._update_widgets()
        if self.visual_mode:
            self.component_combo.set_sensitive(False)
            self.add_button.set_sensitive(False)
            self.sort_components_check.set_sensitive(False)
Пример #15
0
    def _setup_widgets(self):
        self.product_list.set_columns(self._get_product_columns())
        products = self.model.get_items(with_children=False)
        # XXX Just a precaution
        self.product_list.clear()
        for product in products:
            self.product_list.append(None, product)
            for child in product.children_items:
                self.product_list.append(product, child)

        value_format = '<b>%s</b>'
        total_label = value_format % api.escape(_("Total:"))
        products_summary_label = SummaryLabel(klist=self.product_list,
                                              column='total',
                                              label=total_label,
                                              value_format=value_format)

        products_summary_label.show()
        self.products_vbox.pack_start(products_summary_label, False, True, 0)

        label = self.print_labels.get_children()[0]
        label = label.get_children()[0].get_children()[1]
        label.set_label(_(u'Print labels'))
Пример #16
0
    def set_summary_label(self, column, label='Total:', format='%s'):
        """
        Adds a summary label to the result set
        @param column: the column to sum from
        @param label: the label to use, defaults to 'Total:'
        @param format: the format, defaults to '%%s', must include '%%s'
        """
        if not '%s' in format:
            raise ValueError("format must contain %s")

        try:
            self.results.get_column_by_name(column)
        except LookupError:
            raise ValueError("%s is not a valid column" % (column,))

        if self._summary_label:
            self._summary_label.parent.remove(self._summary_label)
        self._summary_label = SummaryLabel(klist=self.results,
                                           column=column,
                                           label=label,
                                           value_format=format)
        self.pack_end(self._summary_label, False, False)
        self.reorder_child(self._summary_label, 1)
        self._summary_label.show()
Пример #17
0
 def _setup_summary(self):
     self.summary = SummaryLabel(klist=self.product_list,
                                 column='total_received',
                                 value_format='<b>%s</b>')
     self.summary.show()
     self.vbox1.pack_start(self.summary, expand=False)
Пример #18
0
data = (Person('Evandro', 23,
               'Belo Horizonte'), Person('Daniel', 22, 'São Carlos'),
        Person('Henrique', 21,
               'São Carlos'), Person('Gustavo', 23, 'São Jose do Santos'),
        Person('Johan', 23, 'Göteborg'), Person('Lorenzo', 26, 'Granada'))

win = Gtk.Window()
win.set_size_request(850, 300)
win.connect('destroy', Gtk.main_quit)

vbox = Gtk.VBox()
win.add(vbox)

l = ObjectList(columns, mode=Gtk.SelectionMode.MULTIPLE)
l.extend(data)
l.append(Person('Nando', 29 + len(l), 'Santos'))

# add an extra person

vbox.pack_start(l, True, True, 0)

label = SummaryLabel(klist=l,
                     column='salary',
                     label='<b>Total:</b>',
                     value_format='<b>%s</b>')
vbox.pack_start(label, False, True, 6)

win.show_all()

Gtk.main()
Пример #19
0
    def _setup_widgets(self):
        if self._is_batch:
            self._add_batches_tab()

        self.receiving_list.set_columns(self._get_receiving_columns())
        self.sales_list.set_columns(self._get_sale_columns())
        self.transfer_list.set_columns(self._get_transfer_columns())
        self.loan_list.set_columns(self._get_loan_columns())
        self.decrease_list.set_columns(self._get_decrease_columns())
        self.inventory_list.set_columns(self._get_inventory_columns())
        self.returned_list.set_columns(self._get_returned_columns())

        current_branch = api.get_current_branch(self.store)
        items = self.store.find(ReceivingItemView, sellable_id=self.model.id)
        if api.sysparam.get_bool('SYNCHRONIZED_MODE'):
            items = items.find(Branch.id == current_branch.id)
        self.receiving_list.add_list(list(items))

        items = SaleItemsView.find_confirmed(self.store, sellable=self.model)
        if api.sysparam.get_bool('SYNCHRONIZED_MODE'):
            items = items.find(Branch.id == current_branch.id)
        self.sales_list.add_list(list(items))

        items = TransferItemView.find_by_branch(self.store, self.model,
                                                current_branch)
        self.transfer_list.add_list(list(items))

        items = self.store.find(LoanItemView, sellable_id=self.model.id)
        if api.sysparam.get_bool('SYNCHRONIZED_MODE'):
            items = items.find(Branch.id == current_branch.id)
        self.loan_list.add_list(list(items))

        items = self.store.find(StockDecreaseItemsView, sellable=self.model.id)
        if api.sysparam.get_bool('SYNCHRONIZED_MODE'):
            items = items.find(Branch.id == current_branch.id)
        self.decrease_list.add_list(list(items))

        items = InventoryItemsView.find_by_product(self.store,
                                                   self.model.product)
        if api.sysparam.get_bool('SYNCHRONIZED_MODE'):
            items = items.find(Branch.id == current_branch.id)
        self.inventory_list.add_list(items)

        items = self.store.find(ReturnedSaleItemsView,
                                sellable_id=self.model.id)
        if api.sysparam.get_bool('SYNCHRONIZED_MODE'):
            items = items.find(Branch.id == current_branch.id)
        self.returned_list.add_list(items)

        value_format = '<b>%s</b>'
        total_label = "<b>%s</b>" % api.escape(_("Total:"))
        receiving_summary_label = SummaryLabel(klist=self.receiving_list,
                                               column='quantity',
                                               label=total_label,
                                               value_format=value_format)
        receiving_summary_label.show()
        self.receiving_vbox.pack_start(receiving_summary_label, False)

        sales_summary_label = SummaryLabel(klist=self.sales_list,
                                           column='quantity',
                                           label=total_label,
                                           value_format=value_format)
        sales_summary_label.show()
        self.sales_vbox.pack_start(sales_summary_label, False)

        transfer_summary_label = SummaryLabel(klist=self.transfer_list,
                                              column='item_quantity',
                                              label=total_label,
                                              value_format=value_format)
        transfer_summary_label.show()
        self.transfer_vbox.pack_start(transfer_summary_label, False)

        loan_summary_label = SummaryLabel(klist=self.loan_list,
                                          column='quantity',
                                          label=total_label,
                                          value_format=value_format)
        self.loan_vbox.pack_start(loan_summary_label, False)

        decrease_summary_label = SummaryLabel(klist=self.decrease_list,
                                              column='quantity',
                                              label=total_label,
                                              value_format=value_format)
        decrease_summary_label.show()
        self.decrease_vbox.pack_start(decrease_summary_label, False)