def on_guardar_clicked(self, *args): venta_id = self.venta_id.get_text() nro_cliente = str(self.nro_cliente.get_text()) cliente_id = self.cliente_id.get_text() emision = str(self.emision.get_text()) bruto = coma_punto(self.bruto.get_text()) impuestos = coma_punto(self.impuestos.get_text()) total = coma_punto(self.total.get_text()) lleno = self.campos_llenos(venta_id, cliente_id, bruto, impuestos, total) filas = len(self.lista) if lleno == 1: insertado = Model().agregar_venta(venta_id, cliente_id, emision, bruto, impuestos, total) Model().insertar_nro_cliente(nro_cliente, venta_id) if filas >= 1: for i in self.lista: cantidad = coma_punto(i[0]) articulo_id = i[1] precio = coma_punto(i[3]) monto_iva_venta = coma_punto(i[5]) subtotal = coma_punto(i[6]) articulos_insertados = Model().agregar_venta_detalles( venta_id, cantidad, articulo_id, precio, monto_iva_venta, subtotal) #~ #~ if insertado == 1 and articulos_insertados == filas: info('Factura en transito guardada') self.limpiar_todo()
def on_aceptar_clicked(self, *args): venta_id = self.venta_id.get_text() cliente_id = self.cliente_id.get_text() emision = self.emision.get_text() bruto = coma_punto(self.bruto.get_text()) impuestos = coma_punto(self.impuestos.get_text()) total = coma_punto(self.total.get_text()) lleno = self.campos_llenos(venta_id, cliente_id, bruto, impuestos, total) filas = len(self.lista) if lleno == 1: insertado = Model().agregar_venta(venta_id, cliente_id, emision, bruto, impuestos, total) if filas >= 1: for i in self.lista: cantidad = coma_punto(i[0]) articulo_id = i[1] precio = coma_punto(i[3]) monto_iva_venta = coma_punto(i[5]) subtotal = coma_punto(i[6]) articulos_insertados = Model().agregar_venta_detalles(venta_id, emision, cantidad, articulo_id, precio, monto_iva_venta, subtotal) else: info('Debe agregar un articulo para la compra') self.agregar.grab_focus() else: info('Debe seleccionar un proveedor') self.buscar_cliente.grab_focus() if insertado == 1 and articulos_insertados >= 1: self.limpiar_todo()
def mostrar_dialogo_con_datos(self, l, d): dlg = DlgReceta() if l: dlg.receta_id.set_text(l[0]) dlg.receta.set_text(l[1]) dlg.articulo_id.set_text(l[2]) dlg.articulo.set_text(l[3]) dlg.masa.set_text(punto_coma(l[4])) dlg.pesada.set_text(punto_coma(l[5])) dlg.porciones.set_text(punto_coma(l[6])) dlg.tacos.set_text(punto_coma(l[7])) dlg.operador.set_active(l[8]) dlg.factor.set_text(punto_coma(l[9])) dlg.peso_taco.set_text(punto_coma(l[10])) dlg.panes.set_text(punto_coma(l[11])) dlg.costo_pan.set_text(punto_coma(l[12])) dlg.bruto.set_text(punto_coma(l[13])) dlg.impuestos.set_text(punto_coma(l[14])) dlg.mano_obra.set_text(punto_coma(l[15])) dlg.total.set_text(punto_coma(l[16])) dlg.empaque.set_text(l[17]) dlg.costo_empaque.set_text(punto_coma(l[18])) dlg.cantidad_empaques.set_text(punto_coma(l[19])) total_empaque = l[18] * l[19] dlg.total_empaque.set_text(punto_coma(total_empaque)) else: info('No existe la receta') if d: dlg.cargar_detalles(d) else: info('No hay ingredientes para mostrar') response = dlg.dialogo.run() if response == gtk.RESPONSE_OK: self.lista.clear() self.lista_ordenada_por_id()
def campos_llenos(self, codigo, cliente, tipo_id, zona_id, telefono): ok = 0 if codigo == '': info("Debe colocar un codigo al cliente") return if cliente == '': info("Debe colocar un nombre al cliente") return if tipo_id == '': info("Debe seleccionar un tipo de cliente") return if zona_id == '': info('Debe seleccionar una zona para el cliente') return if telefono == '': info("Debe colocar un telefono al cliente") return if codigo != '' and cliente != '' and tipo_id != '' and zona_id != '' and telefono != '': ok = 1 else: ok = 0 return ok
def campos_llenos(self, codigo, rif, empresa, direccion, telefonos): ok = 0 if codigo == '': info("Debe colocar un codigo a la empresa") return if rif == '': info("Debe colocar un rif a la empresa") return if empresa == '': info("Debe colocar un nombre a la empresa") return if direccion == '': info("Debe colocarle una dirección a la empresa") return if telefonos == '': info("Debe colocar un teléfono a la empresa") return if codigo != '' and rif!='' and empresa != '' and direccion != '' and telefonos != '': ok = 1 else: ok = 0 return ok
def campos_llenos(self, fecha, estado, ): ok = 0 if receta_id == '': info("Debe colocar un codigo a la receta") return if tipo_receta_id == '': info("Debe seleccionar una categoria de la receta") return if nombre == '': info("Debe colocar un nombre a la receta") return if articulo_id == '': info("Debe colocar un articulo de producción") return if mano_obra == 0.00 or mano_obra == '': info("Debe colocar el costo de la mano de obra") return if receta_id != '' and tipo_receta_id !='' and nombre != '' and articulo_id != '' and mano_obra != 0: ok = 1 else: ok = 0 return ok
def cargar_lista(self, tupla): self.lista.clear() if tupla: for f in range(len(tupla)): self.lista.append([tupla[f][0],tupla[f][1], tupla[f][2], tupla[f][3]]) else: info('No hay registros en produccion')
def campos_llenos(self, fecha, estado, harina_arroba, harina_kg, harina_bultos, costos): ok = 0 if fecha == '': info("Debe colocar una fecha") return if estado == '': info("Debe colocar un estado a la producción") return if harina_arroba == '': return if harina_kg == '': return if harina_bultos == '': return if costos == '': return if fecha != '' and estado !='' and harina_arroba != '' and harina_bultos != '' and costos != '': ok = 1 else: ok = 0 return ok
def on_costos_clicked(self, *args): articulo_id = self.codigo.get_text() articulo = self.articulo.get_text() if articulo_id: wCostosPorArticulo(articulo_id, articulo) else: info('Debe colocarle un código al artículo')
def on_proveedores_clicked(self, *args): articulo_id = self.codigo.get_text() articulo = self.articulo.get_text() if articulo_id: ArticulosAsociadosAProveedores(articulo_id, articulo) else: info('Debe colocarle un código al artículo')
def campos_llenos(self, compra_id, proveedor_id, bruto, impuestos, total): ok = 0 if compra_id == '': info("Debe colocar un codigo a la compra") return if proveedor_id == '': info("Debe seleccionar un proveedor") return if bruto == '': info('Debe existir un monto bruto') return if impuestos == '': info("Debe existir un monto de los impuestos") return if total == '': info("Debe colocar articulos") return if compra_id != '' and proveedor_id !='' and bruto != '' and impuestos != '' and total != '': ok = 1 else: ok = 0 return ok
def on_articulos_clicked(self, *args): proveedor_id = self.codigo.get_text() proveedor = self.proveedor.get_text() if proveedor_id: ArticulosPorProveedor(proveedor_id, proveedor) else: info('Debe colocarle un código al artículo')
def campos_llenos(self, codigo, proveedor, tipo_id, zona_id, telefono): ok = 0 if codigo == '': info("Debe colocar un codigo al proveedor") return if proveedor == '': info("Debe colocar un nombre al proveedor") return if tipo_id == '': info("Debe seleccionar un tipo de proveedor") return if zona_id == '': info('Debe seleccionar una zona para el proveedor') return if telefono == '': info("Debe colocar un telefono al proveedor") return if codigo != '' and proveedor != '' and tipo_id != '' and zona_id != '' and telefono != '': ok = 1 else: ok = 0 return ok
def on_articulo_id_changed(self, *args): codigo = self.articulo_id.get_text() movimiento = self.movimiento.get_active() l = Model().buscar_id_articulo(codigo) if l: self.articulo.set_text(l[0][1]) if l[0][16] == 0 and movimiento == 1: mensaje = 'El Articulo ' + l[0][1] + ' no posee existencia' info(mensaje)
def on_aceptar_clicked(self, *args): receta_id = self.receta_id.get_text() nombre = self.receta.get_text() tipo_receta_id = self.tipo_receta_id.get_text() articulo_id = self.articulo_id.get_text() masa = coma_punto(self.masa.get_text()) pesada = coma_punto(self.pesada.get_text()) porciones = coma_punto(self.porciones.get_text()) tacos = coma_punto(self.tacos.get_text()) peso_taco = coma_punto(self.peso_taco.get_text()) panes = coma_punto(self.panes.get_text()) costo = coma_punto(self.costo_pan.get_text()) bruto = coma_punto(self.bruto.get_text()) impuestos = coma_punto(self.impuestos.get_text()) mano_obra = coma_punto(self.mano_obra.get_text()) total = coma_punto(self.total.get_text()) mano_obra = coma_punto(self.mano_obra.get_text()) lleno = self.campos_llenos(receta_id, tipo_receta_id, nombre, articulo_id, mano_obra) filas = len(self.lista) existe = Model().buscar_id_receta(receta_id) if not existe: if lleno == 1 and filas >= 1: insertado = Model().agregar_receta(receta_id, nombre, tipo_receta_id, articulo_id, masa, pesada, porciones, tacos, peso_taco, panes, costo, bruto, impuestos, mano_obra, total) for i in self.lista: cantidad = coma_punto(i[0]) articulo_id = i[1] total_neto = coma_punto(i[7]) ingredientes_insertados = Model().agregar_recetas_detalles( receta_id, cantidad, articulo_id, total_neto) if lleno == 1 and filas == 0: info('Debe agregar un ingrediente para la receta') self.agregar.grab_focus() if insertado == 1 and ingredientes_insertados >= 1: Model().establecer_costo(articulo_id, costo_pan) self.limpiar_todo() else: modificado = Model().modificar_receta(nombre, tipo_receta_id, articulo_id, masa, pesada, porciones, tacos, peso_taco, panes, costo, bruto, impuestos, mano_obra, total, receta_id) if modificado == 1: info('Receta actualizada')
def revisar_existencias(self, receta_id, harina): harina_arroba = coma_punto(harina) receta = list(Model().buscar_detalles_id_receta_arroba(receta_id)) movimiento = 'Salida' for i in receta: articulo_id = i[1] nombre_articulo_id = i[2] cantidad = i[0] * harina_arroba status = Model().verificar_existencia_detallada(articulo_id, cantidad, movimiento) if status == 0: info('No hay existencia del articulo %s con código %s' % nombre_articulo, articulo_id)
def on_buscar_clicked(self, *args): if self.criterio.get_active() == 0: self.resultado = Model().buscar_id_deposito(self.valor.get_text()) self.cargar_lista(self.resultado) elif self.criterio.get_active() == 1: self.resultado = Model().buscar_nombre_deposito(self.valor.get_text()) self.cargar_lista(self.resultado) elif self.criterio.get_active() == -1: info('Debe seleccionar un criterio de búsqueda') return
def campos_llenos(self, empleado_id): ok = 0 if empleado_id == '': info("Debe seleccionar un empleado") return if empleado_id != '': ok = 1 else: ok = 0 return ok
def campos_llenos(self, responsable, concepto, movimiento, operacion_id): ok = 0 if responsable == '': info("Debe colocar un responsable del movimiento") return if concepto == '': info("Debe colocar un concepto al movimiento") return if movimiento == '': info("Debe seleccionar un tipo de movimiento") return if operacion_id == '': info("Debe seleccionar un tipo de operación") return if responsable != '' and concepto != '' and operacion_id != '': ok = 1 else: ok = 0 return ok
def campos_llenos(self, articulo_id, nombre, deposito_id, grupo_id): ok = 0 if articulo_id == '': info("Debe colocar un codigo al artículo") return if nombre == '': info("Debe colocar un nombre al artículo") reurn if deposito_id == '': info("Debe seleccionar un depósito para el artículo") return if grupo_id == '': info('Debe seleccionar un grupo de inventario para el artículo') return if articulo_id != '' and nombre != '' and deposito_id != '' and grupo_id != '': ok = 1 else: ok = 0 return ok
def campos_llenos(self, receta_id, nombre, articulo_id, mano_obra): ok = 0 if receta_id == '': info("Debe colocar un codigo a la receta") return if nombre == '': info("Debe colocar un nombre a la receta") return if articulo_id == '': info("Debe colocar un articulo de producción") return if mano_obra == 0.00 or mano_obra == '': info("Debe colocar el costo de la mano de obra") return if receta_id != '' and nombre != '' and articulo_id != '' and mano_obra != 0: ok = 1 else: ok = 0 return ok
def campos_llenos(self, codigo, inicio, fin, turno): ok = 0 if codigo == '': info("Debe colocar un codigo al turno") return if inicio == '': info("Debe colocar una hora de inicio al turno") return if fin == '': info("Debe colocar una hora de finalización al turno") return if turno == '': info("Debe colocar una descripción al turno") return if codigo != '' and inicio != '' and fin != '' and turno != '': ok = 1 else: ok = 0 return ok
def campos_llenos(self, codigo, nombre, plural, simbolo): ok = 0 if codigo == '': info("Debe colocar un codigo a la moneda") return if nombre == '': info("Debe colocar un nombre a la moneda") return if plural == '': info("Debe especificar un plural a la moneda") return if simbolo == '': info("Debe colocar un símbolo a la moneda") return if codigo != '' and nombre != '': ok = 1 else: ok = 0 return ok
def on_aceptar_clicked(self, *args): compra_id = self.compra_id.get_text() proveedor_id = self.proveedor_id.get_text() orden = self.orden.get_text() deposito_id = self.deposito_id.get_text() emision = self.emision.get_text() vence = self.vence.get_text() bruto = coma_punto(self.bruto.get_text()) impuestos = coma_punto(self.impuestos.get_text()) total = coma_punto(self.total.get_text()) lleno = self.campos_llenos(compra_id, proveedor_id, bruto, impuestos, total) filas = len(self.lista) if lleno == 1: insertado = Model().agregar_compra(compra_id, proveedor_id, orden, deposito_id, emision, vence, bruto, impuestos, total) emision = str(date.today()) responsable = 'Encargado del deposito' concepto = 'Compra a Proveedor' tipo_movimiento = 'Entrada' operacion_id = '01' mov = Model().agregar_movimiento(emision, responsable, concepto, tipo_movimiento, operacion_id, compra_id, 'COMPRA') if filas >= 1: for i in self.lista: cantidad = coma_punto(i[0]) articulo_id = i[1] costo = coma_punto(i[3]) monto_iva = coma_punto(i[5]) total_neto = coma_punto(i[6]) articulo_insertado = Model().agregar_compra_detalles( compra_id, emision, cantidad, articulo_id, costo, monto_iva, total_neto) Model().agregar_movimiento_detalles( int(mov[0]), 'Entrada', cantidad, articulo_id, total_neto) filas_insertadas += articulo_insertado else: info('Debe agregar un articulo para la compra') self.agregar.grab_focus() else: info('Debe seleccionar un proveedor') self.buscar_proveedor.grab_focus() if insertado == 1 and filas_insertadas == fias: self.limpiar_todo()
def campos_llenos(self, empleado_id, empleado): ok = 0 if empleado_id == '': info("Debe colocar un código de empleado") return if empleado == '': info("Debe colocar un nombre empleado") return if empleado_id != '' and empleado != '': ok = 1 else: ok = 0 return ok
def campos_llenos(self, codigo, nombre): ok = 0 if codigo == '': info("Debe colocar un codigo al grupo") return if nombre == '': info("Debe colocar un nombre al grupo") return if codigo != '' and nombre != '': ok = 1 else: ok = 0 return ok
def campos_llenos(self, codigo, tipo): ok = 0 if codigo == '': info("Debe colocar un codigo al tipo de empleado") return if tipo == '': info("Debe colocar un valor al tipo de empleado") return if codigo != '' and tipo != '': ok = 1 else: ok = 0 return ok
def campos_llenos(self, codigo, nombre): ok = 0 if codigo == '': info("Debe colocar un codigo al tipo de operación") return if nombre == '': info("Debe colocar una descripcion a la operacion") return if codigo != '' and nombre != '': ok = 1 else: ok = 0 return ok
def on_aceptar_clicked(self, *args): fecha = self.fecha.get_text() estado = self.estado.get_text() harina_arroba = coma_punto(self.harina_arroba.get_text()) harina_kg = coma_punto(self.harina_kg.get_text()) harina_bultos = coma_punto(self.harina_bultos.get_text()) costos = coma_punto(self.costos.get_text()) lleno = self.campos_llenos(fecha, estado, harina_arroba, harina_kg, harina_bultos, costos) filas = len(self.lista) existe = self.produccion_id.get_text() if existe is None or existe == '': if lleno == 1 and filas >= 1: produccion = Model().agregar_produccion_panaderia( fecha, estado, harina_arroba, harina_kg, harina_bultos, costos) self.codigo = int(produccion[0]) if self.produccion_id != 0: for i in self.lista: receta_id = i[0] harina = coma_punto(i[2]) unidades = coma_punto(i[3]) costo = coma_punto(i[4]) nombre_empleado = i[5] empleado = Model().buscar_un_nombre_de_empleado( nombre_empleado) empleado_id = empleado[0] elaboraciones_insertadas = Model( ).agregar_produccion_detalles_panaderia( self.codigo, receta_id, harina, unidades, costo, empleado_id) else: info('Ocurrio un error en la inserción de datos') if lleno == 1 and filas == 0: info('Debe agregar una receta') self.agregar.grab_focus() if self.codigo != 0 and elaboraciones_insertadas == filas: self.despachar() self.on_dialogo_destroy() else: modificado = Model().modificar_produccion_panaderia(existe)
def mostrar_dialogo_con_datos(self, l, d): dlg = DlgProduccion() if l: dlg.produccion_id.set_text(str(l[0])) dlg.fecha.set_text(str(l[1])) dlg.estado.set_text(l[2]) dlg.harina_arroba.set_text(punto_coma(l[3])) dlg.harina_kg.set_text(punto_coma(l[4])) dlg.harina_bultos.set_text(punto_coma(l[5])) dlg.costos.set_text(punto_coma(l[6])) else: info('No existe registro de producción') if d: dlg.cargar_detalles(d) else: info('No hay recetas registradas en la producción') response = dlg.dialogo.run() if response == gtk.RESPONSE_OK: self.lista.clear() self.lista_ordenada_por_id()