def __init__(self): customergroup.Group.__init__(self) self.custgrpentry = numberentry.NumberEntry(10) self.builder.get_object("custGrpBox").add(self.custgrpentry) self.custgrpentry.show() self.custIntroducerEntry = numberentry.NumberEntry(10) self.builder.get_object("custIntroducerBox").add( self.custIntroducerEntry) self.custIntroducerEntry.show() self.boxCommissionRateEntry = decimalentry.DecimalEntry(10) self.builder.get_object("boxCommissionRateEntry").add( self.boxCommissionRateEntry) self.boxCommissionRateEntry.show() self.boxDiscRateEntry = decimalentry.DecimalEntry(10) self.builder.get_object("boxDiscRateEntry").add(self.boxDiscRateEntry) self.boxDiscRateEntry.show() self.boxBalanceEntry = decimalentry.DecimalEntry(10) self.builder.get_object("boxBalanceEntry").add(self.boxBalanceEntry) self.boxBalanceEntry.show() self.boxCreditEntry = decimalentry.DecimalEntry(10) self.builder.get_object("boxCreditEntry").add(self.boxCreditEntry) self.boxCreditEntry.show()
def __init__(self): productgroup.ProductGroup.__init__(self) self.qntyEntry = decimalentry.DecimalEntry() self.builder.get_object("qntyBox").add(self.qntyEntry) self.qntyEntry.show() self.qntyWrnEntry = decimalentry.DecimalEntry() self.builder.get_object("qntyWrnBox").add(self.qntyWrnEntry) self.qntyWrnEntry.show() self.purchPriceEntry = decimalentry.DecimalEntry() self.builder.get_object("purchPriceBox").add(self.purchPriceEntry) self.purchPriceEntry.show() self.sellPriceEntry = decimalentry.DecimalEntry() self.builder.get_object("sellPriceBox").add(self.sellPriceEntry) self.sellPriceEntry.show()
def __init__(self): productgroup.ProductGroup.__init__(self) self.qntyEntry = decimalentry.DecimalEntry() self.builder.get_object("qntyBox").add(self.qntyEntry) self.qntyEntry.show() self.qntyWrnEntry = decimalentry.DecimalEntry() self.builder.get_object("qntyWrnBox").add(self.qntyWrnEntry) self.qntyWrnEntry.show() self.purchPriceEntry = decimalentry.DecimalEntry() self.builder.get_object("purchPriceBox").add(self.purchPriceEntry) self.purchPriceEntry.show() self.sellPriceEntry = decimalentry.DecimalEntry() self.builder.get_object("sellPriceBox").add(self.sellPriceEntry) self.sellPriceEntry.show() self.treeview = self.builder.get_object("productsTreeView") self.treestore = Gtk.TreeStore(str, str, str, str, str, str, int)
def initChequeForm(self): self.addPymntDlg = self.builder.get_object("addPaymentDlg") self.pymntAmntEntry = decimalentry.DecimalEntry() self.builder.get_object("pymntAmntBox").add(self.pymntAmntEntry) self.pymntAmntEntry.show() self.dueDateEntry = dateentry.DateEntry() self.builder.get_object("pymntDueDateBox").add(self.dueDateEntry) self.dueDateEntry.show() self.writeDateEntry = dateentry.DateEntry() self.builder.get_object("pymntWritingDateBox").add(self.writeDateEntry) self.writeDateEntry.show() self.pymntDescEntry = self.builder.get_object("pymntDescEntry") self.bankEntry = self.builder.get_object("bankEntry") page = self.builder.get_object("notebook1").get_current_page() sellFlag = None if page == 0: sellFlag = True elif page == 1: sellFlag = False self.builder.get_object("payerLbl").set_text("Payid to:") self.builder.get_object("chooseBankBtn").set_sensitive(False) self.bankCombo = self.builder.get_object('bank_names_combo') model = Gtk.ListStore(str) self.bankCombo.set_model(model) if sellFlag: # other's cheque banks = self.bankaccounts_class.get_bank_names() else: banks = self.bankaccounts_class.get_all_accounts() for item in banks: iter = model.append() name = item.Name if sellFlag else item.accName model.set(iter, 0, name) cell = Gtk.CellRendererText() self.bankCombo.pack_start(cell, True) self.serialNoEntry = self.builder.get_object("serialNoEntry") self.payerEntry = self.builder.get_object("payerNameEntry") self.customerNameLbl = self.builder.get_object("customerNameLbl") self.addPymntDlg.show_all()
def __init__(self, transId=0, sellFlag=1, spendCheque=False): #temp for vackground self.bank_names_count = 0 self.sellFlag = sellFlag self.chequesList = [] self.lastChqID = 0 #self.background = Gtk.Fixed() #self.background.put(Gtk.Image.new_from_file(os.path.join(config.data_path, "media", "background.png")), 0, 0) # not working ! #self.background.show_all() GObject.GObject.__init__(self) self.session = config.db.session self.builder = get_builder("cheque") self.window = self.builder.get_object("showPymnts") self.addPymntDlg = self.builder.get_object("addPaymentDlg") #self.spendCheque = spendCheque if spendCheque: # if is from automatic accounting-> spend cheque self.builder.get_object("addpaymentBtn").set_sensitive(False) self.builder.get_object("editPaymentBtn").set_sensitive(False) self.builder.get_object("selectPayBtn").set_sensitive(True) if transId: # if is from adding/editing factors self.builder.get_object("selectPayBtn").set_sensitive(True) self.totalAmount = 0 self.numrecpts = 0 self.numcheqs = 0 self.transId = transId self.payer = None self.pymntAmntEntry = decimalentry.DecimalEntry() self.builder.get_object("pymntAmntBox").add(self.pymntAmntEntry) self.pymntAmntEntry.show() self.dueDateEntry = dateentry.DateEntry() self.builder.get_object("pymntDueDateBox").add(self.dueDateEntry) self.dueDateEntry.show() self.writeDateEntry = dateentry.DateEntry() self.builder.get_object("pymntWritingDateBox").add(self.writeDateEntry) self.writeDateEntry.show() self.chequeStatusLbl = self.builder.get_object("chequeStatusLbl") self.isCheque = self.builder.get_object("chequeRadioButton") self.pymntDescEntry = self.builder.get_object("pymntDescEntry") self.bankEntry = self.builder.get_object("bankEntry") if not self.sellFlag: self.builder.get_object("chooseBankBtn").set_sensitive(False) # add for bankcombo 23/11/92 self.bankaccounts_class = class_bankaccounts.BankAccountsClass() self.bankCombo = self.builder.get_object('bank_names_combo') model = Gtk.ListStore(str) self.bankCombo.set_model(model) cell = Gtk.CellRendererText() self.bankCombo.pack_start(cell, True) # self.bankCombo.add_attribute(cell, 'text', 0) self.serialNoEntry = self.builder.get_object("serialNoEntry") self.payerEntry = self.builder.get_object("payerNameEntry") self.customerNameLbl = self.builder.get_object("customerNameLbl") self.cheqTreeView = self.builder.get_object("chequeTreeView") self.cheqListStore = Gtk.ListStore(str, str, str, str, str, str, str, str, str, str) self.cheqListStore.clear() self.cheqTreeView.set_model(self.cheqListStore) payByTo = _("Payid by") if sellFlag else _("Payid to") cheqHeaders = (_("ID"), _("No."), payByTo, _("Amount"), _("Writing date"), _("Due Date"), _("Bank"), _("Serial No."), _("Status"), _("Description")) txt = 0 for header in cheqHeaders: column = Gtk.TreeViewColumn(header, Gtk.CellRendererText(), text=txt) column.set_spacing(5) column.set_resizable(True) self.cheqTreeView.append_column(column) txt += 1 self.chqSltWindow = self.builder.get_object("selectCheque") self.freeChequesTreeview = self.builder.get_object( "freeChequesTreeview") self.sltCheqListStore = Gtk.ListStore(str, str, str, str, str, str, str, str, str, str) self.sltCheqListStore.clear() self.freeChequesTreeview.set_model(self.sltCheqListStore) payByTo = "Customer" cheqHeaders = (_("ID"), _("No."), payByTo, _("Amount"), _("Writing date"), _("Due Date"), _("Bank"), _("Serial No."), _("Status"), _("Description")) txt = 0 for header in cheqHeaders: column = Gtk.TreeViewColumn(header, Gtk.CellRendererText(), text=txt) column.set_spacing(5) column.set_resizable(True) self.freeChequesTreeview.append_column(column) txt += 1 self.builder.connect_signals(self)
def __init__(self): self.mode = None self.liststore = None # Chosen Type self.type_index = None self.from_id = self.to_id = -1 self.from_code = self.to_code = "" self.from_name = self.to_name = "" self.builder = helpers.get_builder('automaticaccounting') self.builder.connect_signals(self) self.chequeui = chequeui.ChequeUI(self.builder.get_object('non-cash-payment-label'),self.builder.get_object('spend-cheque-label')) # Date entry date_box = self.builder.get_object('date-box') self.date_entry = dateentry.DateEntry() date_box.pack_start(self.date_entry, False, False) self.current_time = self.date_entry.getDateObject() # type combo type_combo = self.builder.get_object('select-type') model = gtk.ListStore(str, str) type_combo.set_model(model) cell = gtk.CellRendererText() cell.set_visible(False) type_combo.pack_start(cell) type_combo.add_attribute(cell, 'text', 0) cell = gtk.CellRendererText() type_combo.pack_start(cell) type_combo.add_attribute(cell, 'text', 1) for item in self.type_names: iter = model.append() model.set(iter, 0, item[0], 1, item[1]) # payment table table = self.builder.get_object('payment-table') self.cash_payment_entry = decimalentry.DecimalEntry() self.cash_payment_entry.connect('changed', self.on_cash_payment_entry_change) table.attach(self.cash_payment_entry, 1, 2, 0, 1) self.discount_entry = decimalentry.DecimalEntry() self.discount_entry.connect('changed', self.on_discount_entry_change) table.attach(self.discount_entry, 1, 2, 3, 4) # names table table = self.builder.get_object('names-table') self.from_entry = gtk.Entry() self.from_entry.set_sensitive(False) table.attach(self.from_entry, 1, 2, 0, 1) self.to_entry = gtk.Entry() self.to_entry.set_sensitive(False) table.attach(self.to_entry, 1, 2, 1, 2) self.total_credit_entry = decimalentry.DecimalEntry() self.total_credit_entry.connect('changed', self.on_total_credit_entry_change) table.attach(self.total_credit_entry, 1, 2, 2, 3) # choose first type type_combo.set_active(0)
def __init__(self, non_cash_label=None, spend_label=None): ## A list contains information about new cheques # # to remove all cheques for reseting form cheques_ui_obj.new_cheques = [] self.cheque_class = class_cheque.ClassCheque() self.new_cheques = [] #self.is_edit is a var that check the form called by add function or edit function ## a list contains informations about selected cheques for spending #self.spend_cheques only keep serial of cheque and values self.spend_cheques = [] self.is_edit = 0 self.non_cash_payment_label = non_cash_label self.spend_label = spend_label self.mode = 'our' self.bank_accounts = class_bankaccounts.BankAccountsClass() # User Interface self.builder = helpers.get_builder('cheque') self.builder.connect_signals(self) self.amount_entry = decimalentry.DecimalEntry() self.write_date = dateentry.DateEntry() self.due_date = dateentry.DateEntry() add_table = self.builder.get_object('add_table') add_table.attach(self.amount_entry, 1, 2, 1, 2, gtk.EXPAND | gtk.FILL, gtk.SHRINK) add_table.attach(self.write_date, 1, 2, 3, 4, gtk.EXPAND | gtk.FILL, gtk.SHRINK) add_table.attach(self.due_date, 1, 2, 4, 5, gtk.EXPAND | gtk.FILL, gtk.SHRINK) self.builder.get_object('list_cheque_window').resize(400, 1) self.builder.get_object('desc_frame').set_size_request(0, 100) model = gtk.ListStore(str, str, str, str, str, str, str) treeview = self.builder.get_object('list_cheque_treeview') treeview.set_model(model) column = gtk.TreeViewColumn(_("Customer"), gtk.CellRendererText(), text=0) treeview.append_column(column) column = gtk.TreeViewColumn(_("Bank Account"), gtk.CellRendererText(), text=1) treeview.append_column(column) column = gtk.TreeViewColumn(_("Bank/Branch"), gtk.CellRendererText(), text=2) treeview.append_column(column) column = gtk.TreeViewColumn(_("Serial"), gtk.CellRendererText(), text=3) treeview.append_column(column) column = gtk.TreeViewColumn(_("Amount"), gtk.CellRendererText(), text=4) treeview.append_column(column) self.new_cheques = [] column = gtk.TreeViewColumn(_("Due Date"), gtk.CellRendererText(), text=5) treeview.append_column(column) model = gtk.ListStore(str, str, str) combo = self.builder.get_object('bank_accounts') combo.set_model(model) cell = gtk.CellRendererText() cell.set_visible(False) combo.pack_start(cell, True) combo.add_attribute(cell, 'text', 0) cell = gtk.CellRendererText() combo.pack_start(cell, True) combo.add_attribute(cell, 'text', 1) cell = gtk.CellRendererText() combo.pack_start(cell, True) combo.add_attribute(cell, 'text', 2)
def __init__(self, transId=0, billId=0, transCode=0): #temp for vackground self.bank_names_count = 0 self.background = gtk.Fixed() self.background.put( gtk.image_new_from_file( os.path.join(config.data_path, "media", "background.png")), 0, 0) self.background.show_all() gobject.GObject.__init__(self) self.session = config.db.session self.builder = get_builder("SellingForm") self.window = self.builder.get_object("showPymnts") self.totalAmount = 0 self.numrecpts = 0 self.numcheqs = 0 self.transId = transId self.billId = billId self.transCode = transCode self.payer = None self.pymntAmntEntry = decimalentry.DecimalEntry() self.builder.get_object("pymntAmntBox").add(self.pymntAmntEntry) self.pymntAmntEntry.show() self.dueDateEntry = dateentry.DateEntry() self.builder.get_object("pymntDueDateBox").add(self.dueDateEntry) self.dueDateEntry.show() self.writeDateEntry = dateentry.DateEntry() self.builder.get_object("pymntWritingDateBox").add(self.writeDateEntry) self.writeDateEntry.show() self.cheqStatusList = self.builder.get_object("cheqStatusComboBox") comboInsertItems(self.cheqStatusList, self.chequeStatus) self.cheqStatusList.set_active(0) self.isCheque = self.builder.get_object("chequeRadioButton") self.isRecpt = self.builder.get_object("recieptRadioButton") self.pymntDescEntry = self.builder.get_object("pymntDescEntry") self.bankEntry = self.builder.get_object("bankEntry") # add for bankcombo 23/11/92 self.bankaccounts_class = class_bankaccounts.BankAccountsClass() self.bankCombo = self.builder.get_object('bank_names_combo') model = gtk.ListStore(str) self.bankCombo.set_model(model) cell = gtk.CellRendererText() self.bankCombo.pack_start(cell) self.bankCombo.add_attribute(cell, 'text', 0) for item in self.bankaccounts_class.get_bank_names(): iter = model.append() model.set(iter, 0, item.Name) self.bank_names_count += 1 self.serialNoEntry = self.builder.get_object("serialNoEntry") self.payerEntry = self.builder.get_object("payerNameEntry") self.payerEntry.set_sensitive(False) self.builder.get_object("choose Payer").set_sensitive(False) self.trackingCodeEntry = self.builder.get_object("trackingCodeEntry") self.bankAccountEntry = self.builder.get_object("bankAccountEntry") self.paysTreeView = self.builder.get_object("receiptTreeView") self.paysListStore = gtk.ListStore(str, str, str, str, str, str, str, str, str) self.paysListStore.clear() self.paysTreeView.set_model(self.paysListStore) self.cheqTreeView = self.builder.get_object("chequeTreeView") self.cheqListStore = gtk.ListStore(str, str, str, str, str, str, str, str, str) self.cheqListStore.clear() self.cheqTreeView.set_model(self.cheqListStore) payHeaders = (_("No."), _("Paid by"), _("Amount"), _("Writing date"), _("Due Date"), _("Bank"), _("Serial No."), _("Track Code"), _("Description")) txt = 0 for header in payHeaders: column = gtk.TreeViewColumn(header, gtk.CellRendererText(), text=txt) column.set_spacing(5) column.set_resizable(True) self.paysTreeView.append_column(column) txt += 1 cheqHeaders = (_("No."), _("Paid by"), _("Amount"), _("Writing date"), _("Due Date"), _("Bank"), _("Serial No."), _("Status"), _("Description")) txt = 0 for header in cheqHeaders: column = gtk.TreeViewColumn(header, gtk.CellRendererText(), text=txt) column.set_spacing(5) column.set_resizable(True) self.cheqTreeView.append_column(column) txt += 1 self.builder.connect_signals(self)
def __init__(self, number=0, background=None): self.main_window_background = background self.new_items = [] self.deleted_items = [] self.edit_items = [] self.builder = get_builder("document") self.window = self.builder.get_object("window1") # self.window.set_title(_("Register new document")) self.date = dateentry.DateEntry() box = self.builder.get_object("datebox") box.add(self.date) self.date.show() self.code = numberentry.NumberEntry() box = self.builder.get_object("codebox") box.add(self.code) self.code.show() self.code.connect("activate", self.selectSubject) self.code.set_tooltip_text(_("Press Enter to see available subjects.")) self.amount = decimalentry.DecimalEntry() box = self.builder.get_object("amountbox") box.add(self.amount) self.amount.set_activates_default(True) self.amount.show() self.treeview = self.builder.get_object("treeview") #self.treeview.set_direction(Gtk.TextDirection.LTR) # if Gtk.widget_get_default_direction() == Gtk.TextDirection.RTL : # halign = 1 # else: # halign = 0 self.liststore = Gtk.ListStore(str, str, str, str, str, str, str) column = Gtk.TreeViewColumn(_("Index"), Gtk.CellRendererText(), text=0) column.set_spacing(5) column.set_resizable(True) self.treeview.append_column(column) column = Gtk.TreeViewColumn(_("Subject Code"), Gtk.CellRendererText(), text=1) column.set_spacing(5) column.set_resizable(True) self.treeview.append_column(column) column = Gtk.TreeViewColumn(_("Subject Name"), Gtk.CellRendererText(), text=2) column.set_spacing(5) column.set_resizable(True) money_cell_renderer = Gtk.CellRendererText() #money_cell_renderer.set_alignment(1.0, 0.5) #incompatible with pygtk2.16 self.treeview.append_column(column) column = Gtk.TreeViewColumn(_("Debt"), money_cell_renderer, text=3) column.set_spacing(5) column.set_resizable(True) self.treeview.append_column(column) column = Gtk.TreeViewColumn(_("Credit"), money_cell_renderer, text=4) column.set_spacing(5) column.set_resizable(True) self.treeview.append_column(column) column = Gtk.TreeViewColumn(_("Description"), Gtk.CellRendererText(), text=5) column.set_spacing(5) column.set_resizable(True) self.treeview.append_column(column) #column = Gtk.TreeViewColumn(_("Notebook ID") , Gtk.CellRendererText(), text=6) #column.set_alignment(halign) #column.set_spacing(5) #column.set_resizable(True) #self.treeview.append_column(column) self.treeview.get_selection().set_mode(Gtk.SelectionMode.SINGLE) self.debt_sum = 0 self.credit_sum = 0 self.numrows = 0 self.auto_win = None self.cl_document = class_document.Document() if number > 0: if self.cl_document.set_bill(number): self.showRows() self.window.set_title(_("Edit document")) else: numstring = utility.LN(number) msg = _( "No document found with number %s\nDo you want to register a document with this number?" ) % numstring msgbox = Gtk.MessageDialog(self.window, Gtk.DialogFlags.MODAL, Gtk.MessageType.WARNING, Gtk.ButtonsType.OK_CANCEL, msg) msgbox.set_title(_("No Documents found")) result = msgbox.run() msgbox.destroy() if result == Gtk.ResponseType.CANCEL: return else: self.builder.get_object("docnumber").set_text(numstring) self.treeview.set_model(self.liststore) self.window.show_all() self.builder.get_object("editable").hide() self.builder.get_object("non-editable").hide() if self.cl_document.permanent: # Pbill = config.db.session.query(Notebook).filter(Notebook.bill_id ==1).filter(or_(Notebook.chqId != 0 , Notebook.factorId != 0 ) ).first() # if Pbill : if number != 1: self.builder.get_object("non-editable").show() else: self.builder.get_object("editable").show() self.builder.connect_signals(self)