def cargar_grilla(self):
    if self.campo_buscar in ("FechaHora", "FechaHoraExp", "FechaNacimiento"):
        opcion = "" if len(self.obj("txt_buscar").get_text()) == 0 else \
        " WHERE " + self.campo_buscar + " BETWEEN '" + self.fecha_ini + "' AND '" + self.fecha_fin + "'"
    else:
        opcion = "" if len(self.obj("txt_buscar").get_text()) == 0 else \
        " WHERE " + self.campo_buscar + " LIKE '%" + self.obj("txt_buscar").get_text() + "%'"

    conexion = Op.conectar(self.datos_conexion)
    cursor = Op.consultar(conexion, "idAnticipo, NroContrato, idEmpleado, " +
        "idTipoDocumento, NroDocumento, NombreApellido, FechaNacimiento, " +
        "Edad, Cargo, NroComprobante, FechaHoraExp, Monto, FechaHora, " +
        "Observaciones, Alias, NroDocUsuario, NombreUsuario",
        self.tabla + "_s", opcion + " ORDER BY NroContrato, " + self.campoid)
    datos = cursor.fetchall()
    cant = cursor.rowcount
    conexion.close()  # Finaliza la conexión

    lista = self.obj("grilla").get_model()
    lista.clear()

    for i in range(0, cant):
        fechanac = "" if datos[i][6] is None else Cal.mysql_fecha(datos[i][6])
        fechacomp = "" if datos[i][10] is None else Cal.mysql_fecha_hora(datos[i][10])
        fechaexp = "" if datos[i][12] is None else Cal.mysql_fecha_hora(datos[i][12])

        lista.append([datos[i][0], datos[i][1], datos[i][2], datos[i][3],
            datos[i][4], datos[i][5], fechanac, datos[i][7], datos[i][8],
            datos[i][9], fechacomp, datos[i][11], fechaexp, datos[i][13],
            datos[i][14], datos[i][15], datos[i][16], str(datos[i][6]),
            str(datos[i][10]), str(datos[i][12])])

    cant = str(cant) + " registro encontrado." if cant == 1 \
        else str(cant) + " registros encontrados."
    self.obj("barraestado").push(0, cant)
    def cargar_grilla_buscar(self):
        if self.campo_buscar == "FechaHora":
            opcion = "" if len(self.obj("txt_buscar").get_text()) == 0 else \
            " WHERE " + self.campo_buscar + " = '" + self.fecha + "%'"
        else:
            opcion = "" if len(self.obj("txt_buscar").get_text()) == 0 else \
            " WHERE " + self.campo_buscar + " LIKE '%" + self.obj("txt_buscar").get_text() + "%'"

        opcion += " WHERE " if len(opcion) == 0 else " AND "
        opcion += "Anulado <> 1"

        cursor = Op.consultar(
            self.conexion, "NroTimbrado, NroNotaDebito, " +
            "FechaHora, NroTimbradoFact, NroFactura, idTipoDocCliente, NroDocCliente, "
            + "RazonSocial, DireccionPrincipal, Total, TotalLiquidacionIVA, " +
            "Alias, NroDocUsuario, NombreApellido, Anulado, idCliente",
            "notadebitoventas_s", opcion + " ORDER BY FechaHora DESC")
        datos = cursor.fetchall()
        cant = cursor.rowcount

        lista = self.obj("grilla_buscar").get_model()
        lista.clear()

        for i in range(0, cant):
            lista.append([
                datos[i][0], datos[i][1],
                Cal.mysql_fecha_hora(datos[i][2]), datos[i][3], datos[i][4],
                datos[i][5], datos[i][6], datos[i][7], datos[i][8],
                datos[i][9], datos[i][10], datos[i][11], datos[i][12],
                datos[i][13], datos[i][14], datos[i][2], datos[i][15]
            ])

        cant = str(cant) + " registro encontrado." if cant == 1 \
        else str(cant) + " registros encontrados."
        self.obj("barraestado").push(0, cant)
Beispiel #3
0
    def cargar_grilla_buscar(self):
        if self.campo_buscar == "FechaHora":
            opcion = "" if len(self.obj("txt_buscar").get_text()) == 0 else \
            " WHERE " + self.campo_buscar + " BETWEEN '" + self.fecha_ini + "' AND '" + self.fecha_fin + "'"
        else:
            opcion = "" if len(self.obj("txt_buscar").get_text()) == 0 else \
            " WHERE " + self.campo_buscar + " LIKE '%" + self.obj("txt_buscar").get_text() + "%'"

        conexion = Op.conectar(self.origen.datos_conexion)
        cursor = Op.consultar(
            conexion, "NroPedidoVenta, FechaHora, " +
            "idTipoDocCliente, NroDocCliente, RazonSocial, CantItems, " +
            "Total, Alias, NroDocUsuario, NombreApellido, idCliente",
            "pedidoventas_s", opcion + " ORDER BY FechaHora DESC")
        datos = cursor.fetchall()
        cant = cursor.rowcount
        conexion.close()  # Finaliza la conexión

        lista = self.obj("grilla_buscar").get_model()
        lista.clear()

        for i in range(0, cant):
            lista.append([
                datos[i][0],
                Cal.mysql_fecha_hora(datos[i][1]), datos[i][2], datos[i][3],
                datos[i][4], datos[i][5], datos[i][6], datos[i][7],
                datos[i][8], datos[i][9], datos[i][10],
                str(datos[i][1])
            ])

        cant = str(cant) + " registro encontrado." if cant == 1 \
            else str(cant) + " registros encontrados."
        self.obj("barraestado").push(0, cant)
Beispiel #4
0
def cargar_grilla(self):
    if self.campo_buscar == "FechaHora":
        opcion = "" if len(self.obj("txt_buscar").get_text()) == 0 else \
        " WHERE " + self.campo_buscar + " BETWEEN '" + self.fecha_ini + "' AND '" + self.fecha_fin + "'"
    else:
        opcion = "" if len(self.obj("txt_buscar").get_text()) == 0 else \
        " WHERE " + self.campo_buscar + " LIKE '%" + self.obj("txt_buscar").get_text() + "%'"

    conexion = Op.conectar(self.datos_conexion)
    cursor = Op.consultar(
        conexion,
        self.campoid + ", FechaHora, CantItems, " + "Alias, NombreApellido",
        self.tabla + "_s", opcion + " ORDER BY FechaHora DESC")
    datos = cursor.fetchall()
    cant = cursor.rowcount
    conexion.close()  # Finaliza la conexión

    lista = self.obj("grilla").get_model()
    lista.clear()

    for i in range(0, cant):
        lista.append([
            datos[i][0],
            Cal.mysql_fecha_hora(datos[i][1]), datos[i][2], datos[i][3],
            datos[i][4],
            str(datos[i][1])
        ])

    cant = str(cant) + " registro encontrado." if cant == 1 \
        else str(cant) + " registros encontrados."
    self.obj("barraestado").push(0, cant)
Beispiel #5
0
def cargar_grilla(self):
    if self.campo_buscar == "FechaHora":
        opcion = "" if len(self.obj("txt_buscar").get_text()) == 0 else \
        " WHERE " + self.campo_buscar + " BETWEEN '" + self.fecha_ini + "' AND '" + self.fecha_fin + "'"
    else:
        opcion = "" if len(self.obj("txt_buscar").get_text()) == 0 else \
        " WHERE " + self.campo_buscar + " LIKE '%" + self.obj("txt_buscar").get_text() + "%'"

    if self.obj("rad_act").get_active() or self.obj("rad_ina").get_active():
        aprobado = "1" if self.obj("rad_act").get_active() else "0"
        opcion += " WHERE " if len(opcion) == 0 else " AND "
        opcion += "Aprobado = " + aprobado

    condicion = ""
    if len(self.condicion) > 0:
        condicion = " WHERE " + self.condicion if len(opcion) == 0 \
        else " AND " + self.condicion

    conexion = Op.conectar(self.datos_conexion)
    cursor = Op.consultar(
        conexion, self.campoid + ", FechaHora, " +
        "NroDocProveedor, RazonSocial, DireccionPrincipal, TelefonoPrincipal, CantItems, "
        +
        "idFormaPago, FormaPago, Alias, NroDocUsuario, NombreApellido, Aprobado, "
        + "idProveedor, idTipoDocProveedor, NroPedidoCompra",
        self.tabla + "_s", opcion + condicion + " ORDER BY FechaHora DESC")
    datos = cursor.fetchall()
    cant = cursor.rowcount
    conexion.close()  # Finaliza la conexión

    lista = self.obj("grilla").get_model()
    lista.clear()

    for i in range(0, cant):
        lista.append([
            datos[i][0],
            Cal.mysql_fecha_hora(datos[i][1]), datos[i][2], datos[i][3],
            datos[i][4], datos[i][5], datos[i][6], datos[i][7], datos[i][8],
            datos[i][9], datos[i][10], datos[i][11], datos[i][12],
            str(datos[i][1]), datos[i][13], datos[i][14], datos[i][15]
        ])

    cant = str(cant) + " registro encontrado." if cant == 1 \
        else str(cant) + " registros encontrados."
    self.obj("barraestado").push(0, cant)
    def on_factura_focus_out_event(self, objeto, evento):
        if len(self.obj("txt_02").get_text()) == 0 or len(
                self.obj("txt_02_1").get_text()) == 0:
            self.obj("barraestado").push(0, "")
        else:
            fact = self.obj("txt_02").get_text()
            timb = self.obj("txt_02_1").get_text()

            cursor = Op.consultar(
                self.conexion, "FechaHora, idCliente, " +
                "idTipoDocCliente, NroDocCliente, RazonSocial, DireccionPrincipal",
                "facturaventas_s",
                " WHERE NroTimbrado = " + timb + " AND NroFactura = " + fact)

            if cursor.rowcount > 0:
                datos = cursor.fetchall()
                self.obj("txt_02_2").set_text(Cal.mysql_fecha_hora(
                    datos[0][0]))

                # Asignación de Tipo de Documento en Combo
                model, i = self.obj("cmb_tipo_doc").get_model(), 0
                while model[i][0] != datos[0][2]:
                    i += 1
                self.obj("cmb_tipo_doc").set_active(i)

                # Cliente de la Factura seleccionada
                self.cod_per = datos[0][1]
                self.obj("txt_03_1").set_text(datos[0][3])
                self.obj("txt_03_2").set_text(datos[0][4])
                direc = "" if datos[0][5] is None else datos[0][5]
                self.obj("txt_03_3").set_text(direc)

                self.obj("barraestado").push(0, "")
                self.verificacion(0)
            else:
                self.estadoguardar(False)
                self.obj("txt_02").grab_focus()
                self.obj("barraestado").push(
                    0, "El Nro. Factura introducido no es válido (NO EXISTE).")
                self.obj("txt_02_2").set_text("")
    def cargar_grilla_vacaciones(self):
        cursor = Op.consultar(
            self.conexion, "idToma, FechaInicio, FechaFin, " +
            "CantDias, NroComprobante, FechaHoraExp", "vacacionestomadas_s",
            " WHERE idVacacion = " + self.obj("txt_00").get_text() +
            " AND NroContrato = " + self.obj("txt_02").get_text() +
            " ORDER BY idToma")
        datos = cursor.fetchall()
        cant = cursor.rowcount

        maximo = int(self.obj("txt_03_2").get_text())
        dias = 0  # Cantidad de Días asignados

        lista = self.obj("grilla").get_model()
        lista.clear()

        for i in range(0, cant):
            comprobante = "" if datos[i][4] is None else str(datos[i][4])
            fechaexp = "" if datos[i][5] is None else Cal.mysql_fecha_hora(
                datos[i][5])
            dias += datos[i][3]

            lista.append([
                datos[i][0],
                Cal.mysql_fecha(datos[i][1]),
                Cal.mysql_fecha(datos[i][2]), datos[i][3], comprobante,
                fechaexp,
                str(datos[i][1]),
                str(datos[i][2]),
                str(datos[i][5])
            ])

        self.obj("txt_03_3").set_text(str(maximo - dias))
        cant = str(cant) + " registro encontrado." if cant == 1 \
            else str(cant) + " registros encontrados."
        self.obj("barraestado").push(0, cant)
    def cargar_grilla(self, grilla, barraestado):
        condicion = ""

        if self.obj("chk_01").get_active():  # Nro. de Timbrado
            condicion += "NroTimbrado = " + self.obj("txt_timb").get_text()

        if self.obj("chk_02").get_active():  # Nro. de Nota de Debito
            if len(condicion) > 0:
                condicion += " AND "
            condicion += "NroNotaDebito >= " + str(self.obj("txt_nro_ini").get_value_as_int()) + \
                " AND NroNotaDebito <= " + str(self.obj("txt_nro_fin").get_value_as_int())

        if self.obj("chk_03").get_active():  # Cliente
            if len(condicion) > 0:
                condicion += " AND "
            condicion += "idCliente = " + self.obj("txt_cliente_01").get_text()

        if self.obj("chk_04").get_active():  # Vendedor
            if len(condicion) > 0:
                condicion += " AND "
            condicion += "idVendedor = " + self.obj(
                "txt_vendedor_01").get_text()

        if self.obj("chk_05").get_active():  # Fecha
            if len(condicion) > 0:
                condicion += " AND "
            condicion += "FechaHora BETWEEN '" + self.fecha_ini + "%'" + \
                " AND '" + self.fecha_fin + "%'"

        if self.obj("chk_06").get_active():  # Total
            if len(condicion) > 0:
                condicion += " AND "
            condicion += "Total "
            total = str(self.obj("txt_total_ini").get_value())

            if self.idTotal == 1:  # Entre
                condicion += "> " + total + \
                " AND Total < " + str(self.obj("txt_total_fin").get_value())
            elif self.idTotal == 2:  # Mayor que
                condicion += "> " + total
            elif self.idTotal == 3:  # Mayor o igual que
                condicion += ">= " + total
            elif self.idTotal == 4:  # Menor que
                condicion += "< " + total
            elif self.idTotal == 5:  # Menor o igual que
                condicion += "<= " + total

        if self.obj("rad_vigentes").get_active():
            if len(condicion) > 0:
                condicion += " AND "
            condicion += "Anulado <> 1"

        # Obtener datos de Nota de Debito por Ventas
        conexion = conectar(self.datos_conexion)
        cursor = consultar(
            conexion, "NroTimbrado, NroEstablecimiento, " +
            "NroPuntoExpedicion, NroNotaDebito, FechaHora, NroDocCliente, RazonSocial, "
            + "Total", "notadebitoventas_s", " WHERE " + condicion)
        datos = cursor.fetchall()
        cant = cursor.rowcount
        conexion.close()  # Finaliza la conexión

        lista = grilla.get_model()
        lista.clear()

        for i in range(0, cant):
            lista.append([
                datos[i][0],
                cad(datos[i][1], 3) + "-" + cad(datos[i][2], 3) + "-" +
                cad(datos[i][3], 7),
                mysql_fecha_hora(datos[i][4]), datos[i][5], datos[i][6],
                datos[i][7]
            ])

        cant = str(cant) + " registro encontrado." if cant == 1 \
            else str(cant) + " registros encontrados."
        barraestado.push(0, cant)