def scriptTipos(self): self.viewTipo.clear() for t in self.mem.types.arr: total = Money(self.mem, 0, self.mem.localcurrency) for i in self.mem.data.investments_active().arr: if i.product.type == t: if self.radCurrent.isChecked(): total = total + i.balance().local() else: total = total + i.invertido().local() if t.id == 11: #Accounts total = total + self.accounts if total.isGTZero(): if t.id == 11: #Accounts self.viewTipo.pie.appendData(t.name.upper(), total, True) else: self.viewTipo.pie.appendData(t.name.upper(), total) if self.radCurrent.isChecked(): self.viewTipo.pie.setTitle( self.tr("Investment current balance by product type")) else: self.viewTipo.pie.setTitle( self.tr("Invested balance by product type")) self.viewTipo.display()
def scriptCountry(self): self.viewCountry.clear() for c in self.mem.countries.arr: total = Money(self.mem, 0, self.mem.localcurrency) for i in self.mem.data.investments_active().arr: if i.product.stockmarket.country == c: if self.radCurrent.isChecked(): total = total + i.balance().local() else: total = total + i.invertido().local() if total.isGTZero(): self.viewCountry.pie.appendData(c.name.upper(), total) if self.radCurrent.isChecked(): self.viewCountry.pie.setTitle( self.tr("Investment current balance by country")) else: self.viewCountry.pie.setTitle( self.tr("Invested balance by country")) self.viewCountry.display()
def scriptTPC(self): self.viewTPC.clear() for r in range(0, 11): total = Money(self.mem, 0, self.mem.localcurrency) for i in self.mem.data.investments_active().arr: if ceil(i.product.percentage / 10.0) == r: if self.radCurrent.isChecked(): total = total + i.balance().local() else: total = total + i.invertido().local() if r == 0: total = total + self.accounts if total.isGTZero(): self.viewTPC.pie.appendData("{0}% variable".format(r * 10), total) if self.radCurrent.isChecked(): self.viewTPC.pie.setTitle( self.tr("Investment current balance by variable percentage")) else: self.viewTPC.pie.setTitle( self.tr("Invested balance by variable percentage")) self.viewTPC.display()
def scriptApalancado(self): self.viewApalancado.clear() for a in self.mem.leverages.arr: total = Money(self.mem, 0, self.mem.localcurrency) for i in self.mem.data.investments_active().arr: if i.product.leveraged == a: if self.radCurrent.isChecked(): total = total + i.balance().local() else: total = total + i.invertido().local() if a.id == eLeverageType.NotLeveraged: #Accounts total = total + self.accounts if total.isGTZero(): self.viewApalancado.pie.appendData(a.name.upper(), total) if self.radCurrent.isChecked(): self.viewApalancado.pie.setTitle( self.tr("Investment current balance by leverage")) else: self.viewApalancado.pie.setTitle( self.tr("Invested balance by leverage")) self.viewApalancado.display()