def on_actionActive_triggered(self): from xulpymoney.ui.wdgProducts import wdgProducts self.w.close() self.w = wdgProducts( self.mem, "select * from products where obsolete=false order by name") self.layout.addWidget(self.w) self.w.show()
def on_actionProductsUser_triggered(self): from xulpymoney.ui.wdgProducts import wdgProducts self.w.close() arrInt = [] for p in self.mem.data.products.arr: if p.id < 0: arrInt.append(p.id) self.w = wdgProducts(self.mem, arrInt) self.layout.addWidget(self.w) self.w.show()
def on_actionProductsInvalidISIN_triggered(self): from xulpymoney.ui.wdgProducts import wdgProducts self.w.close() arrInt = [] for p in self.mem.data.products.arr: if p.isin != None and is_valid(p.isin) == False: arrInt.append(p.id) self.w = wdgProducts(self.mem, arrInt) self.layout.addWidget(self.w) self.w.show()
def on_actionIndexesObsolete_triggered(self): from xulpymoney.ui.wdgProducts import wdgProducts self.w.close() arrInt = [] for p in self.mem.data.products.arr: if p.type.id == eProductType.Index and p.obsolete == True: arrInt.append(p.id) self.w = wdgProducts(self.mem, arrInt) self.layout.addWidget(self.w) self.w.show()
def on_actionWarrantsInline_triggered(self): from xulpymoney.ui.wdgProducts import wdgProducts self.w.close() arrInt = [] for p in self.mem.data.products.arr: if p.type.id == eProductType.Warrant and p.mode.id == 'i' and p.obsolete == False: arrInt.append(p.id) self.w = wdgProducts(self.mem, arrInt) self.layout.addWidget(self.w) self.w.show()
def on_actionXetra_triggered(self): from xulpymoney.ui.wdgProducts import wdgProducts self.w.close() arrInt = [] for p in self.mem.data.products.arr: if p.agrupations.dbstring().find( "|DAX|") != -1 and p.obsolete == False: arrInt.append(p.id) self.w = wdgProducts(self.mem, arrInt) self.layout.addWidget(self.w) self.w.show()
def on_actionFavorites_triggered(self): from xulpymoney.ui.wdgProducts import wdgProducts favorites = self.mem.settingsdb.value_list_of_integers( "mem/favorites", "") if len(favorites) == 0: qmessagebox(self.tr("There aren't favorite products")) return self.w.close() self.w = wdgProducts(self.mem, favorites) self.layout.addWidget(self.w) self.w.show()
def on_actionBondsObsolete_triggered(self): from xulpymoney.ui.wdgProducts import wdgProducts self.w.close() arrInt = [] for p in self.mem.data.products.arr: if p.type.id in (eProductType.PrivateBond, eProductType.PublicBond) and p.obsolete == True: arrInt.append(p.id) self.w = wdgProducts(self.mem, arrInt) self.layout.addWidget(self.w) self.w.show()
def on_actionDividends_triggered(self): """Shows products with current year estimations_dps and with quotes in current year""" from xulpymoney.ui.wdgProducts import wdgProducts self.w.close() prod = ProductManager(self.mem) prod.load_from_db( "select * from products where id in (select products_id from estimations_dps where year=date_part('year',now()) and estimation is not null) and id in (select distinct(id) from quotes where date_part('year', datetime)=date_part('year',now()))" ) self.w = wdgProducts(self.mem, prod.array_of_ids()) self.layout.addWidget(self.w) self.w.on_actionSortDividend_triggered() self.w.show()
def on_actionProductsWithoutISIN_triggered(self): from xulpymoney.ui.wdgProducts import wdgProducts self.w.close() prod = ProductManager(self.mem) prod.load_from_db( "select * from products where obsolete=false and (isin is null or isin ='') order by name,id" ) arrInt = [] for p in prod.arr: arrInt.append(p.id) self.w = wdgProducts(self.mem, arrInt) self.layout.addWidget(self.w) self.w.show()
def on_actionProductsInvestmentInactive_triggered(self): from xulpymoney.ui.wdgProducts import wdgProducts self.w.close() prod = ProductManager(self.mem) prod.load_from_db( "select * from products where id in (select products_id from investments where active=false) order by name" ) arrInt = [] for p in prod.arr: arrInt.append(p.id) self.w = wdgProducts(self.mem, arrInt) self.layout.addWidget(self.w) self.w.show()
def on_actionProductsWithOldPrice_triggered(self): from xulpymoney.ui.wdgProducts import wdgProducts self.w.close() prod = ProductManager(self.mem) prod.load_from_db( "select p.* from products p, quote(p.id, now()) q where p.id=q.id and q.datetime<now() -interval '30 day' and obsolete=False order by name" ) arrInt = [] for p in prod.arr: arrInt.append(p.id) self.w = wdgProducts(self.mem, arrInt) self.layout.addWidget(self.w) self.w.show()
def on_actionProductsNotAutoUpdate_triggered(self): from xulpymoney.ui.wdgProducts import wdgProducts self.w.close() prod = ProductManager(self.mem) prod.load_from_db("""select * from products where obsolete=false and id not in ({}) order by name """.format(list2string(list(self.mem.autoupdate)))) arrInt = [] for p in prod.arr: arrInt.append(p.id) self.w = wdgProducts(self.mem, arrInt) self.layout.addWidget(self.w) self.w.show()
def on_actionISINDuplicado_triggered(self): from xulpymoney.ui.wdgProducts import wdgProducts self.w.close() cur = self.mem.con.cursor() #ßaca los isin duplicados buscando distintct isin, bolsa con mas de dos registros cur.execute( "select isin, stockmarkets_id, count(*) as num from products where isin!='' group by isin, stockmarkets_id having count(*)>1 order by num desc;" ) isins = set([]) for row in cur: isins.add(row['isin']) arrInt = [] if len(isins) > 0: for p in self.mem.data.products.arr: if p.isin in isins: arrInt.append(p.id) self.w = wdgProducts(self.mem, arrInt) self.layout.addWidget(self.w) self.w.show()
def on_actionProductsWithPriceVariation_triggered(self): from xulpymoney.ui.wdgProducts import wdgProducts self.w.close() d = MyModalQDialog() d.setWindowTitle(self.tr("Price variation")) d.setSettings(self.mem.settings, "frmMain", "mqdProductsWithPriceVariation") lblDays = QLabel("Days") txtDays = myQLineEdit(d) txtDays.setText(90) lblVariation = QLabel("Variation") txtVariation = myQLineEdit(d) txtVariation.setText(-10) d.setWidgets(lblDays, txtDays, lblVariation, txtVariation) d.exec_() sql = "select * from products where is_price_variation_in_time(id, {}, now()::timestamptz-interval '{} day')=true and obsolete=False order by name".format( txtVariation.text(), txtDays.text()) print(sql) self.w = wdgProducts(self.mem, sql) self.layout.addWidget(self.w) self.w.show()
def on_actionSearch_triggered(self): from xulpymoney.ui.wdgProducts import wdgProducts self.w.close() self.w = wdgProducts(self.mem) self.layout.addWidget(self.w)