def data( self, index, role = Qt.DisplayRole ):
        """
        darle formato a los campos de la tabla
        """
        if not index.isValid() or not ( 0 <= index.row() < len( self.lines ) ):
            return ""
        line = self.lines[index.row()]
        column = index.column()
        if role == Qt.DisplayRole:
            if column == IDARTICULO:
                return line.itemId
#            Esto es lo que se muestra en la tabla
            elif column == DESCRIPCION:
                return line.itemDescription
            elif column == CANTIDAD:
                return line.quantity if line.quantity != 0 else ""
            elif column == UNIDADES:
                return line.units if line.units != 0 else ""
            elif column == PRECIO:
                return moneyfmt( line.itemPrice , 4, "C$" ) if line.itemPrice != 0 else ""
            elif column == TOTALPROD:
                return moneyfmt( line.total , 4, "C$" ) if line.itemId != 0 else ""
        elif role == Qt.EditRole:
            if column == PRECIO:
                return line.itemPrice
        elif role == Qt.TextAlignmentRole:
#            if column==:
#                return Qt.AlignHCenter | Qt.AlignVCenter
            if column in ( CANTIDAD, UNIDADES, PRECIO, TOTALPROD ):
                return Qt.AlignRight | Qt.AlignVCenter
        elif role == Qt.ToolTipRole:
            if column == CANTIDAD:
                return u"Máximo %d" % line.existencia
 def data( self, index, role = Qt.DisplayRole ):
     """
     darle formato a los campos de la tabla
     """
     value = super( SingleSelectionModel, self ).data( index, role )
     if role == Qt.DisplayRole:
         if index.column() == PRECIOEX :
             return moneyfmt( Decimal( value.toString() ), 4, "US$" )
         elif index.column() == COSTOEX:
             return moneyfmt( Decimal( value.toString() ), 4, "C$" )
         else:
             return value
     return value
Beispiel #3
0
 def data(self, index, role):
     if role == Qt.TextAlignmentRole:
         return int(Qt.AlignTop | Qt.AlignLeft)
     
     if role != Qt.DisplayRole:
         return None
     node = self.nodeFromIndex(index)
     assert node is not None
     if isinstance(node,BranchNode):
         return node.toString() if index.column() == 0 else QString("")
     column = index.column()
     if column == 1:
         return moneyfmt(Decimal((node.field(index.column()))),2,"C$ ")
     else:
         return node.field(index.column())
    def data(self, index, role):
        if role == Qt.TextAlignmentRole:
            return int(Qt.AlignTop | Qt.AlignLeft)

        if role != Qt.DisplayRole:
            return None
        node = self.nodeFromIndex(index)
        assert node is not None
        if isinstance(node, BranchNode):
            return node.toString() if index.column() == 0 else QString("")
        column = index.column()
        if column == 1:
            return moneyfmt(Decimal((node.field(index.column()))), 2, "C$ ")
        else:
            return node.field(index.column())
Beispiel #5
0
    def imprimir(self,printer):
        
        leftMargin = 72
        widthCol = 100

        
        arialFont = QFont("Helvetica",16,3)
        
        fuente =QFontMetrics(arialFont)
        arialLineHeight = fuente.height()
        
        fondo = QPixmap(":/images/res/fondo.png")     
        painter = QPainter(printer)
        pageRect = printer.pageRect()
        page = 1
        
        painter.save()
        if self.vistaprevia:
            painter.drawPixmap(0, 0, 530, 830, fondo)
        
        painter.setFont(arialFont)
        
        y = 180
        x = 35
        painter.drawText(x,y,self.editmodel.fecha.toString("dd   MM   yy"))
        
        y = 210
        x = 85
        
        painter.drawText(x,y, self.editmodel.cliente)
        
        painter.setFont(arialFont)

        
        cajasFont = QFont("Helvetica",10,2)
        x = -5
        y = 295
         
        painter.setFont(cajasFont)
        painter.drawText(x,y - arialLineHeight - 1,"Cajas")
        
        
        for row in self.editmodel.lines:
            painter.setFont(cajasFont)
            x = 2
            painter.drawText(x,y,row.cantidad())

            painter.setFont(arialFont)
            total = moneyfmt(row.total,2,"")
            x = 470 - fuente.width(total)
            painter.drawText(x,y,total)
            
            x =310
            painter.drawText(x,y,moneyfmt(row.itemPrice,2,""))
            


            x = 30                                
            painter.drawText(x,y,row.unidades())
            
            
            x = 80
            painter.drawText(x,y,row.itemDescription)            

            
            
            y+= arialLineHeight
            
        
        total = moneyfmt(self.editmodel.total,2,"")
        y= 690
        x = 470 - fuente.width(total)   
        painter.drawText(x,y,total)
        
        
        painter.setPen(Qt.black)
#        printer.newPage()
        painter.restore()
Beispiel #6
0
 def updateLabels( self ):
     self.lbltotal.setText( moneyfmt( self.editmodel.total, 2, "C$ " ) )
Beispiel #7
0
    def imprimir(self, printer):

        leftMargin = 72
        widthCol = 100

        arialFont = QFont("Helvetica", 16, 3)

        fuente = QFontMetrics(arialFont)
        arialLineHeight = fuente.height()

        fondo = QPixmap(":/images/res/fondo.png")
        painter = QPainter(printer)
        pageRect = printer.pageRect()
        page = 1

        painter.save()
        if self.vistaprevia:
            painter.drawPixmap(0, 0, 530, 830, fondo)

        painter.setFont(arialFont)

        y = 180
        x = 35
        painter.drawText(x, y, self.editmodel.fecha.toString("dd   MM   yy"))

        y = 210
        x = 85

        painter.drawText(x, y, self.editmodel.cliente)

        painter.setFont(arialFont)

        cajasFont = QFont("Helvetica", 10, 2)
        x = -5
        y = 295

        painter.setFont(cajasFont)
        painter.drawText(x, y - arialLineHeight - 1, "Cajas")

        for row in self.editmodel.lines:
            painter.setFont(cajasFont)
            x = 2
            painter.drawText(x, y, row.cantidad())

            painter.setFont(arialFont)
            total = moneyfmt(row.total, 2, "")
            x = 470 - fuente.width(total)
            painter.drawText(x, y, total)

            x = 310
            painter.drawText(x, y, moneyfmt(row.itemPrice, 2, ""))

            x = 30
            painter.drawText(x, y, row.unidades())

            x = 80
            painter.drawText(x, y, row.itemDescription)

            y += arialLineHeight

        total = moneyfmt(self.editmodel.total, 2, "")
        y = 690
        x = 470 - fuente.width(total)
        painter.drawText(x, y, total)

        painter.setPen(Qt.black)
        #        printer.newPage()
        painter.restore()
Beispiel #8
0
 def updateLabels(self):
     self.lbltotal.setText(moneyfmt(self.editmodel.total, 2, "C$ "))