예제 #1
0
 def cargarviewtintas(self):
     self.modelTinta = QtSql.QSqlTableModel(self)
     self.modelTinta.setTable("tinta")
     listaref = self.cadenadereferencias(DAO.TintaFicha().leerTintaEnFicha(
         self.edicion))
     self.modelTinta.setFilter("idTinta  in {0}".format(listaref))
     self.modelTinta.setEditStrategy(QtSql.QSqlTableModel.OnManualSubmit)
     self.modelTinta.select()
     self.ui.viewTintas.setModel(self.modelTinta)
     self.ui.viewTintas.hideColumn(0)
     pass
예제 #2
0
    def deleteRecordsTintas(self):
        try:
            fila = []
            for col in range(self.modelTinta.columnCount()):
                index = self.modelTinta.index(
                    self.ui.viewTintas.currentIndex().row(), col)
                fila.append(str(self.modelTinta.data(index).toString()))
            tin = DTO.Tinta()
            tin.setIdTinta(fila[0])
            DAO.TintaFicha().eliminarReferencia(fila[0], self.edicion)
            DAO.Tinta(tin).eliminarTinta()

        except Exception as e:
            MostrarError(str(e.message))
        else:
            self.modelTinta.submitAll()
예제 #3
0
    def insertRecordsTintas(self):
        try:
            tin = DTO.Tinta()
            tin.setColor(self.ui.leColorTintaMod.text())
            tin.setTipo(self.ui.leTipoTintaMod.text())
            tin.setAnilox(self.ui.leAniloxTintaMod.text())
            tin.setProveedor1(self.ui.leProveedorTintaMod.text())
            tin.setProveedor2(self.ui.leProveedorTinta2Mod.text())
            tin.setProveedor3(self.ui.leProveedorTinta3Mod.text())

            DAO.Tinta(tin).ingresarTinta()
            "crear referencia de forma inmediata"
            tf = DAO.TintaFicha()
            tf.setIdFicha(self.edicion)
            tf.setIdTinta(DAO.Tinta().idUltimaTinta())
            tf.insertarTintaFicha()
            self.cargarviewtintas()
            ""
        except Exception as e:
            MostrarError(str(e.message))

        else:
            self.modelTinta.submitAll()
            "limpiarFormulario"