Example #1
0
 def load_ingresos(self,  year,  month):
     self.viewIncomes.pie.clear()
     self.viewIncomes.pie.setTitle(self.tr("Concepts chart"))   
     
     (self.incomeslist, totalincomes,  totalaverageincomes)=self.incomes.percentage_monthly(year, month)
     self.mqtwIncomes.table.setColumnCount(4)
     self.mqtwIncomes.table.setHorizontalHeaderItem(0, qcenter(self.tr("Concept" )))
     self.mqtwIncomes.table.setHorizontalHeaderItem(1, qcenter(self.tr("Monthly expenses" )))
     self.mqtwIncomes.table.setHorizontalHeaderItem(2, qcenter(self.tr("% Monthly expenses" )))
     self.mqtwIncomes.table.setHorizontalHeaderItem(3, qcenter(self.tr("Monthly average" )))
     self.mqtwIncomes.applySettings()
     self.mqtwIncomes.table.clearContents()
     self.mqtwIncomes.table.setRowCount(len(self.incomeslist)+1)
     
     for i, a in enumerate(self.incomeslist):
         self.mqtwIncomes.table.setItem(i, 0, qleft(a[0].name))
         self.mqtwIncomes.table.setItem(i, 1, self.mem.localmoney(a[1]).qtablewidgetitem())
         self.mqtwIncomes.table.setItem(i, 2, Percentage(a[2], 100).qtablewidgetitem())#tpc
         self.mqtwIncomes.table.setItem(i, 3, self.mem.localmoney(a[3]).qtablewidgetitem())
         
         if a[1]!=0:
             if a[1]>a[3]:
                 self.mqtwIncomes.table.item(i, 1).setBackground( eQColor.Green)          
             else:
                 self.mqtwIncomes.table.item(i, 1).setBackground( eQColor.Red)      
             self.viewIncomes.pie.appendData(a[0].name.upper(), a[1])
     self.viewIncomes.display()
     self.mqtwIncomes.table.setItem(len(self.incomeslist), 0, qleft(self.tr('TOTAL')))
     self.mqtwIncomes.table.setItem(len(self.incomeslist), 1, self.mem.localmoney(totalincomes).qtablewidgetitem())
     self.mqtwIncomes.table.setItem(len(self.incomeslist), 2, Percentage(1, 1).qtablewidgetitem())
     self.mqtwIncomes.table.setItem(len(self.incomeslist), 3, self.mem.localmoney(totalaverageincomes).qtablewidgetitem())
Example #2
0
 def myqtablewidget(self, wdg):
     wdg.table.setColumnCount(6)
     wdg.table.setHorizontalHeaderItem(0, qcenter(self.tr("Year")))
     wdg.table.setHorizontalHeaderItem(1, qcenter(self.tr("Estimation")))
     wdg.table.setHorizontalHeaderItem(2, qcenter(self.tr("PER")))
     wdg.table.setHorizontalHeaderItem(3,
                                       qcenter(self.tr("Estimation date")))
     wdg.table.setHorizontalHeaderItem(4, qcenter(self.tr("Source")))
     wdg.table.setHorizontalHeaderItem(5, qcenter(self.tr("Manual")))
     self.sort()
     wdg.applySettings()
     wdg.table.clearContents()
     wdg.table.setRowCount(len(self.arr))
     for i, e in enumerate(self.arr):
         wdg.table.setItem(i, 0, qcenter(str(e.year)))
         wdg.table.setItem(
             i, 1,
             self.product.money(e.estimation).qtablewidgetitem())
         wdg.table.setItem(
             i, 2,
             qnumber(
                 e.PER(
                     Quote(self.mem).init__from_query(
                         self.product,
                         dtaware_day_end_from_date(
                             date(e.year, 12, 31),
                             self.product.stockmarket.zone.name)))))
         wdg.table.setItem(i, 3, qdate(e.date_estimation))
         wdg.table.setItem(i, 4, qleft(e.source))
         wdg.table.setCellWidget(i, 5, wdgBool(e.manual))
     wdg.table.setCurrentCell(len(self.arr) - 1, 0)
     wdg.table.setFocus()
Example #3
0
    def myqtablewidget(self, wdg):
        wdg.table.setColumnCount(6)
        wdg.table.setHorizontalHeaderItem(0, qcenter(self.tr("Year")))
        wdg.table.setHorizontalHeaderItem(1, qcenter(self.tr("Estimation")))
        wdg.table.setHorizontalHeaderItem(2, qcenter(self.tr("Percentage")))
        wdg.table.setHorizontalHeaderItem(3,
                                          qcenter(self.tr("Estimation date")))
        wdg.table.setHorizontalHeaderItem(4, qcenter(self.tr("Source")))
        wdg.table.setHorizontalHeaderItem(5, qcenter(self.tr("Manual")))
        self.sort()
        wdg.applySettings()
        wdg.table.clearContents()
        wdg.table.setRowCount(len(self.arr))
        for i, e in enumerate(self.arr):
            wdg.table.setItem(i, 0, qcenter(str(e.year)))
            wdg.table.setItem(
                i, 1,
                self.product.money(e.estimation).qtablewidgetitem(6))
            wdg.table.setItem(i, 2, e.percentage().qtablewidgetitem())
            wdg.table.setItem(i, 3, qdate(e.date_estimation))
            wdg.table.setItem(i, 4, qleft(e.source))
            wdg.table.setCellWidget(i, 5, wdgBool(e.manual))

        wdg.table.setCurrentCell(len(self.arr) - 1, 0)
        wdg.table.setFocus()
Example #4
0
    def myqtablewidget(self, wdg, emoneycurrency, current=True):
        wdg.table.setColumnCount(7)
        wdg.table.setHorizontalHeaderItem(0, qcenter(self.tr("Date")))
        wdg.table.setHorizontalHeaderItem(1, qcenter(self.tr("Concept")))
        wdg.table.setHorizontalHeaderItem(2, qcenter(self.tr("Gross")))
        wdg.table.setHorizontalHeaderItem(3, qcenter(self.tr("Withholding")))
        wdg.table.setHorizontalHeaderItem(4, qcenter(self.tr("Comission")))
        wdg.table.setHorizontalHeaderItem(5, qcenter(self.tr("Net")))
        wdg.table.setHorizontalHeaderItem(6, qcenter(self.tr("DPS")))
        #DATA
        wdg.applySettings()
        wdg.table.clearContents()

        currency = self.investment.resultsCurrency(emoneycurrency)

        wdg.table.setRowCount(self.length() + 1)
        sumneto = Money(self.mem, 0, currency)
        sumbruto = Money(self.mem, 0, currency)
        sumretencion = Money(self.mem, 0, currency)
        sumcomision = Money(self.mem, 0, currency)
        for i, d in enumerate(self.arr):
            if current == True and self.investment.op_actual.length(
            ) > 0 and d.datetime < self.investment.op_actual.first().datetime:
                wdg.table.hideRow(i)
                continue
            else:
                wdg.table.showRow(i)
            sumneto = sumneto + d.net(emoneycurrency)
            sumbruto = sumbruto + d.gross(emoneycurrency)
            sumretencion = sumretencion + d.retention(emoneycurrency)
            sumcomision = sumcomision + d.commission(emoneycurrency)
            wdg.table.setItem(i, 0,
                              qdatetime(d.datetime, self.mem.localzone_name))
            wdg.table.setItem(i, 1, qleft(d.opercuenta.concept.name))
            wdg.table.setItem(i, 2, d.gross(emoneycurrency).qtablewidgetitem())
            wdg.table.setItem(i, 3,
                              d.retention(emoneycurrency).qtablewidgetitem())
            wdg.table.setItem(i, 4,
                              d.commission(emoneycurrency).qtablewidgetitem())
            wdg.table.setItem(i, 5, d.net(emoneycurrency).qtablewidgetitem())
            wdg.table.setItem(i, 6, d.dps(emoneycurrency).qtablewidgetitem())
        wdg.table.setItem(self.length(), 1, qleft(self.tr("TOTAL")))
        wdg.table.setItem(self.length(), 2, sumbruto.qtablewidgetitem())
        wdg.table.setItem(self.length(), 3, sumretencion.qtablewidgetitem())
        wdg.table.setItem(self.length(), 4, sumcomision.qtablewidgetitem())
        wdg.table.setItem(self.length(), 5, sumneto.qtablewidgetitem())
        return (sumneto, sumbruto, sumretencion, sumcomision)
Example #5
0
    def myqtablewidget(self, wdg):
        """Section es donde guardar en el config file, coincide con el nombre del formulario en el que está la table
        Devuelve sumatorios"""

        wdg.table.setColumnCount(4)
        wdg.table.setHorizontalHeaderItem(0, qcenter(self.tr("Date")))
        wdg.table.setHorizontalHeaderItem(1, qcenter(self.tr("Before")))
        wdg.table.setHorizontalHeaderItem(2, qcenter(self.tr("After")))
        wdg.table.setHorizontalHeaderItem(3, qcenter(self.tr("Comment")))
        #DATA
        wdg.applySettings()
        wdg.table.clearContents()

        wdg.table.setRowCount(len(self.arr))
        for i, o in enumerate(self.arr):
            wdg.table.setItem(i, 0,
                              qdatetime(o.datetime, self.mem.localzone_name))
            wdg.table.setItem(i, 1, qright(o.before))
            wdg.table.setItem(i, 2, qright(o.after))
            wdg.table.setItem(i, 3, qleft(o.comment))