def update_status(self, id, status, customer_id): current_date = dateentry.DateEntry().getDateObject() ch = config.db.session.query(Cheque).filter(Cheque.chqId == id).first() ch_history = ChequeHistory(ch.chqId, ch.chqAmount, ch.chqWrtDate, ch.chqDueDate, ch.chqSerial, status, customer_id, ch.chqAccount, ch.chqTransId, ch.chqDesc, current_date) config.db.session.add(ch_history) config.db.session.commit() ch.chqHistoryId = ch_history.Id ch.chqStatus = status ch.chqCust = customer_id
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, 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 = numberentry.NumberEntry() 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.TEXT_DIR_LTR) if gtk.widget_get_default_direction() == gtk.TEXT_DIR_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.SELECTION_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.DIALOG_MODAL, gtk.MESSAGE_WARNING, gtk.BUTTONS_OK_CANCEL, msg) msgbox.set_title(_("No Documents found")) result = msgbox.run() msgbox.destroy() if result == gtk.RESPONSE_CANCEL: return else: self.builder.get_object("docnumber").set_text (numstring) self.treeview.set_model(self.liststore) self.window.show_all() if self.cl_document.permanent: self.builder.get_object("editable").hide() self.builder.get_object("non-editable").show() else: self.builder.get_object("editable").show() self.builder.get_object("non-editable").hide() self.builder.connect_signals(self)
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, number=0): 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 = numberentry.NumberEntry() 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.TEXT_DIR_LTR) if gtk.widget_get_default_direction() == gtk.TEXT_DIR_RTL: halign = 1 else: halign = 0 self.liststore = gtk.ListStore(str, str, str, str, str, str) column = gtk.TreeViewColumn(_("Index"), gtk.CellRendererText(), text=0) column.set_alignment(halign) column.set_spacing(5) column.set_resizable(True) self.treeview.append_column(column) column = gtk.TreeViewColumn(_("Subject Code"), gtk.CellRendererText(), text=1) column.set_alignment(halign) column.set_spacing(5) column.set_resizable(True) self.treeview.append_column(column) column = gtk.TreeViewColumn(_("Subject Name"), gtk.CellRendererText(), text=2) column.set_alignment(halign) 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_alignment(halign) column.set_spacing(5) column.set_resizable(True) self.treeview.append_column(column) column = gtk.TreeViewColumn(_("Credit"), money_cell_renderer, text=4) column.set_alignment(halign) column.set_spacing(5) column.set_resizable(True) self.treeview.append_column(column) column = gtk.TreeViewColumn(_("Description"), gtk.CellRendererText(), text=5) column.set_alignment(halign) column.set_spacing(5) column.set_resizable(True) self.treeview.append_column(column) self.treeview.get_selection().set_mode(gtk.SELECTION_SINGLE) # self.session = config.db.session self.debt_sum = 0 self.credit_sum = 0 self.numrows = 0 self.permanent = False if number > 0: query = config.db.session.query(Bill).select_from(Bill) bill = query.filter(Bill.number == number).first() self.docnumber = number if bill == None: numstring = str(number) if config.digittype == 1: numstring = utility.convertToPersian(numstring) msg = _( "No document found with number %s\nDo you want to register a document with this number?" ) % numstring msgbox = gtk.MessageDialog(self.window, gtk.DIALOG_MODAL, gtk.MESSAGE_WARNING, gtk.BUTTONS_OK_CANCEL, msg) msgbox.set_title(_("No Documents found")) result = msgbox.run() msgbox.destroy() if result == gtk.RESPONSE_CANCEL: return else: self.docid = 0 docnum = str(self.docnumber) if config.digittype == 1: docnum = utility.convertToPersian(docnum) self.builder.get_object("docnumber").set_text(docnum) else: self.showRows(number) self.permanent = bill.permanent self.window.set_title(_("Edit document")) else: self.docnumber = 0 self.docid = 0 self.treeview.set_model(self.liststore) self.window.show_all() if self.permanent: self.builder.get_object("editable").hide() self.builder.get_object("non-editable").show() else: self.builder.get_object("editable").show() self.builder.get_object("non-editable").hide() self.builder.connect_signals(self)
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): self.builder = get_builder("chequereport") self.window = self.builder.get_object("windowChequeReport") self.window.set_title(_("Cheques Report")) self.treeviewIncoming = self.builder.get_object("treeviewIncoming") self.treeviewOutgoing = self.builder.get_object("treeviewOutgoing") self.treeviewNotPassed = self.builder.get_object("treeviewNotPassed") self.treeviewNotCashed = self.builder.get_object("treeviewNotCashed") self.treeviewDeleted = self.builder.get_object("treeviewDeleted") self.treeviewCashed = self.builder.get_object("treeviewCashed") self.treeviewPassed = self.builder.get_object("treeviewPassed") self.treeviewSpent = self.builder.get_object("treeviewSpent") self.treeviewBounced = self.builder.get_object("treeviewBounced") self.treeviewBouncedP = self.builder.get_object("treeviewBouncedP") self.treeviewReturnedT = self.builder.get_object("treeviewReturnedT") self.treeviewReturnedF = self.builder.get_object("treeviewReturnedF") self.treeviewFloat = self.builder.get_object("treeviewFloat") self.treestoreIncoming = Gtk.TreeStore(str, str, str, str, str, str, str, str, str, str) self.treestoreOutgoing = Gtk.TreeStore(str, str, str, str, str, str, str, str, str, str) self.treestoreNotPassed = Gtk.TreeStore(str, str, str, str, str, str, str, str, str, str) self.treestoreNotCashed = Gtk.TreeStore(str, str, str, str, str, str, str, str, str, str) self.treestoreDeleted = Gtk.TreeStore(str, str, str, str, str, str, str, str, str, str) self.treestorePassed = Gtk.TreeStore(str, str, str, str, str, str, str, str, str, str) self.treestoreCashed = Gtk.TreeStore(str, str, str, str, str, str, str, str, str, str) self.treestoreSpent = Gtk.TreeStore(str, str, str, str, str, str, str, str, str, str) self.treestoreBounced = Gtk.TreeStore(str, str, str, str, str, str, str, str, str, str) self.treestoreBouncedP = Gtk.TreeStore(str, str, str, str, str, str, str, str, str, str) self.treestoreReturnedT = Gtk.TreeStore(str, str, str, str, str, str, str, str, str, str) self.treestoreReturnedF = Gtk.TreeStore(str, str, str, str, str, str, str, str, str, str) self.treestoreFloat = Gtk.TreeStore(str, str, str, str, str, str, str, str, str, str) self.treeviewIncoming.set_model(self.treestoreIncoming) self.treeviewOutgoing.set_model(self.treestoreOutgoing) self.treeviewNotPassed.set_model(self.treestoreNotPassed) self.treeviewNotCashed.set_model(self.treestoreNotCashed) self.treeviewDeleted.set_model(self.treestoreDeleted) self.treeviewPassed.set_model(self.treestorePassed) self.treeviewCashed.set_model(self.treestoreCashed) self.treeviewSpent.set_model(self.treestoreSpent) self.treeviewBounced.set_model(self.treestoreBounced) self.treeviewBouncedP.set_model(self.treestoreBouncedP) self.treeviewReturnedT.set_model(self.treestoreReturnedT) self.treeviewReturnedF.set_model(self.treestoreReturnedF) self.treeviewFloat.set_model(self.treestoreFloat) headers = (_("ID"), _("Amount"), _("Write Date"), _("Due Date"), _("Serial"), _("Customer Name"), _("Account"), _("Description"), _("Bill ID"), _("Status")) for treeview in self.treeviews: i = 0 for header in headers: column = Gtk.TreeViewColumn(str(header), Gtk.CellRendererText(), text=i) column.set_spacing(5) column.set_resizable(True) column.set_sort_column_id(i) column.set_sort_indicator(True) self.builder.get_object(treeview).append_column(column) i += 1 self.window.show_all() self.builder.connect_signals(self) dateFromEntry = self.builder.get_object("dateFromSearchentry") dateToEntry = self.builder.get_object("dateToSearchentry") dateFromEntry1 = self.builder.get_object("dateFromSearchentry1") dateToEntry1 = self.builder.get_object("dateToSearchentry1") if share.config.datetypes[share.config.datetype] == "jalali": (year, month, day) = ("1397", "12", "20") else: (year, month, day) = ("2018", "12", "20") datelist = ["", "", ""] datelist[share.config.datefields["year"]] = year datelist[share.config.datefields["month"]] = month datelist[share.config.datefields["day"]] = day delimiter = share.config.datedelims[share.config.datedelim] placeH = datelist[0] + delimiter + datelist[1] + delimiter + datelist[2] dateToEntry.set_placeholder_text(placeH) dateFromEntry.set_placeholder_text(placeH) dateToEntry1.set_placeholder_text(placeH) dateFromEntry1.set_placeholder_text(placeH) self.date_entry = dateentry.DateEntry() self.current_time = self.date_entry.getDateObject() self.createHistoryTreeview()
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)