def voidentry(self, *args): index = self.transaction_grid.GetGridCursorRow() if index < 0: errorMsg = "index out of bounds in void - %d: ignored" % (index) self.DisplayMsg(errorMsg) else: transaction = self.transactions[index] if transaction.get_state() != "void": msg = "Really void this transaction?" title = "Really void?" void = True else: msg = "Really unvoid this transaction?" title = "Really unvoid?" void = False d = wx.MessageDialog(self, msg, title, wx.YES_NO) if d.ShowModal() == wx.ID_YES: self.edited = True today_date = Date.get_curr_date(self.parent) # Toggle values so if it was void make it active and if active make it void if void: transaction.set_payee("VOID: " + transaction.get_payee()) transaction.set_memo("voided %s" % today_date) transaction.set_prev_state(transaction.get_state()) transaction.set_state("void") else: new_payee = transaction.get_payee()[5:] transaction.set_payee(new_payee) unvoid_msg = "; unvoided %s" % today_date transaction.set_memo(transaction.get_memo() + unvoid_msg) new_state = transaction.get_prev_state() transaction.set_state(new_state) proj_value = self.transactions.update_current_and_projected_values( 0) self.transactions.parent.set_value_proj(proj_value) for i in range(index, len(self.transactions)): self.transaction_grid.setValue( i, "Value", str(round(self.transactions[i].get_current_value(), 2))) self.redraw_all() # redraw only [index:]
def make_date_grid(self, panel): self.currDateLabel = wx.StaticText(panel, label="Curr Date") dates = Date(self, self.dateFormat, self.payType, self.ref_date) self.curr_date = dates.get_curr_date() self.currDate = wx.StaticText(panel, label=self.curr_date["str"]) self.projDateLabel = wx.StaticText(panel, label="Proj Date") displayDateFormat = self.dateFormat.replace("%m", "mm").replace( "%d", "dd").replace("%y", "yy").replace("%Y", "yyyy") self.projDateInput = wx.TextCtrl(panel, style=wx.TE_PROCESS_ENTER, value=displayDateFormat) self.currPayDateLabel = wx.StaticText(panel, label="Current Pay Date") self.currPayDate = dates.get_curr_paydate() self.currPayDateOutput = wx.StaticText(panel, label=str(self.currPayDate)) self.nextPayDateLabel = wx.StaticText(panel, label="Next Pay Date") self.nextPayDate = dates.get_next_paydate() self.nextPayDateOutput = wx.StaticText(panel, label=str(self.nextPayDate)) self.projDateInput.Bind(wx.EVT_TEXT_ENTER, self.onProjDateEntered)