コード例 #1
0
ファイル: clientes.py プロジェクト: vallemrv/tpvB3
 def rellena_list(self):
     self.listDirecciones.rm_all_widgets()
     for l in self.db.direcciones:
         btn = LabelClicable(text=l['direccion'])
         btn.tag = l
         btn.bind(on_press=self.sel_dir)
         self.listDirecciones.add_linea(btn)
コード例 #2
0
 def onPress(self, btn):
     self.pedido.rm_all_widgets()
     self.selected = btn.tag
     lineas = self.selected["db"]['lineas']
     total = 0
     for item in lineas:
         btn = LabelClicable(bgColor="#444444",
                             font_size = '16dp',
                             color = "#ffffff")
         tl = item['precio']
         total += float(tl)
         btn.text = "{2: >3} {0}   {1:.2f} €".format(item['text'], float(tl), item['cant'])
         self.pedido.add_linea(btn)
     self.precio = total
コード例 #3
0
 def onPress(self, btn):
     self.pedido.rm_all_widgets()
     self.selected = btn
     lineas = self.selected.tag.get("db")["lineaspedido"]
     total = 0
     for item in lineas:
         btn = LabelClicable(bgColor="#444444",
                             font_size = '16dp',
                             color = "#ffffff")
         tl = float(item['total'])
         total += tl
         tipo = "" if not item['tipo'] in ("pizzas", "burger") else item['tipo']
         if tipo.endswith("s"):
             tipo = tipo[:-1]
         btn.text = "{0: >4}  {4} {1} {2: <30}  {3:.2f} €".format(item['cant'], item['text'],
                                                                 item['des'].lower(), tl, tipo)
         self.pedido.add_linea(btn)
     self.precio = total
コード例 #4
0
 def onPress(self, btn):
     self.pedido.rm_all_widgets()
     self.selected = btn
     db = self.selected.tag.get("db")
     lineas = db.lineaspedido_set.get()
     total = 0
     for item in lineas:
         btn = LabelClicable(bgColor="#444444",
                             font_size='16dp',
                             color="#ffffff")
         tl = item.total
         total += tl
         tipo = "" if not item.tipo in ("pizzas", "burger") else item.tipo
         if tipo.endswith("s"):
             tipo = tipo[:-1]
         btn.text = "{0: >4}  {4} {1} {2: <30}  {3:.2f} €".format(
             item.cant, item.text, item.des.lower(), tl, tipo)
         self.pedido.add_linea(btn)
     self.precio = total
コード例 #5
0
    def run_mostrar_lista(self):

        for db in Pedidos.filter(query="estado LIKE 'NPG_%'"):
            if db.id in self.db_lista:
                continue
            self.db_lista.append(db.id)
            clientes = db.clientes_set.get()
            direccion = ""
            if len(clientes) > 0:
                id = clientes[0].id
                direccion = ""
                if id != None:
                    direcciones = clientes[0].direcciones_set.get()
                if len(direcciones) > 0:
                    direccion = direcciones[0].direccion
            else:
                direccion = ""

            btn = LabelClicable(bgColor="#444444",
                                font_size="16dp",
                                color="#ffffff")
            btn.tag = {"db": db}
            if type(db.fecha) is datetime:
                fecha = db.fecha.strftime("%H:%M:%S")
            else:
                fecha = datetime.strptime(db.fecha, "%Y-%m-%d %H:%M:%S.%f")
                fecha = fecha.strftime("%H:%M:%S")

            texto = "{0: <10}  Total: {1:5.2f} €   {3: <20} {2: <30} ".format(
                fecha, db.total, direccion, db.para_llevar)
            btn.text = texto
            btn.bind(on_press=self.onPress)
            self.lista.add_linea(btn)
        self.tpv.hide_spin()
コード例 #6
0
 def mostrar_lista(self):
     self.lista.rm_all_widgets()
     self.pedido.rm_all_widgets()
     listado = glob("../db/parking/*.json")
     for f in listado:
         db = JsonStore(f)
         pedido = db.get("db")
         btn = LabelClicable(bgColor="#444444",
                             font_size="16dp",
                             color="#ffffff")
         btn.tag = {"db": pedido, "fl": f}
         basename = os.path.basename(f).replace(".json","")
         texto = "{0: >25}  Total: {1:5.2f} €".format(basename, pedido['total'])
         btn.text = texto
         btn.bind(on_press=self.onPress)
         self.lista.add_linea(btn)
コード例 #7
0
ファイル: listadowidget.py プロジェクト: vallemrv/tpvB3
 def rellenar_pedidos(self, pedidos):
     if len(pedidos) < len(self.pd_lista):
         self.pd_lista = []
         self.lista.rm_all_widgets()
     for db in pedidos:
         if db['id'] in self.pd_lista:
             continue
         self.pd_lista.append(db['id'])
         btn = LabelClicable(bgColor="#444444",
                             font_size='20dp',
                             color="#ffffff")
         btn.tag = {"db": db}
         fecha = datetime.strptime(db['fecha'].replace("T", " "),
                                   "%Y-%m-%d %H:%M:%S.%f")
         texto = "{0: <10}   Avisador: {1: <26}  {2}  Total: {3:5.2f} €".format(
             fecha.strftime("%H:%M:%S"), db['num_avisador'],
             db['modo_pago'], float(db['total']))
         btn.text = texto
         btn.bind(on_release=self.onPress)
         self.lista.add_linea(btn)
     self.tpv.hide_spin()
コード例 #8
0
    def run_mostrar_lista(self, req, result):
        if result["success"] == True:
            result["get"]["pedidos"].reverse()
            pedidos = result["get"]["pedidos"]
            if len(pedidos) < len(self.db_lista):
                self.db_lista = []
                self.lista.rm_all_widgets()
            for db in pedidos:
                if db["id"] in self.db_lista:
                    continue
                self.db_lista.append(db['id'])
                direccion = ""
                if "clientes" in db:
                    if len(db["clientes"]) > 0:
                        cl = db["clientes"][0]
                        if "direcciones" in cl:
                            direcciones = cl["direcciones"]
                            if len(direcciones) > 0:
                                direccion = direcciones[0]['direccion']
                            for l in direcciones:
                                if cl["direccion"] == l["id"]:
                                    direccion = l["direccion"]

                btn = LabelClicable(bgColor="#444444",
                                    font_size="16dp",
                                    color="#ffffff")
                btn.tag = {"db": db}
                if type(db['fecha']) is datetime:
                    fecha = db['fecha'].strftime("%H:%M:%S")
                else:
                    fecha = datetime.strptime(db['fecha'].replace("T", " "), "%Y-%m-%d %H:%M:%S.%f")
                    fecha = fecha.strftime("%H:%M:%S")

                texto = "{0: <10}  Total: {1:5.2f} €   {3: <20} {2: <30} ".format(fecha, float(db['total']),
                                                                          direccion, db['para_llevar'])
                btn.text = texto
                btn.bind(on_press=self.onPress)
                self.lista.add_linea(btn)
        self.tpv.hide_spin()
コード例 #9
0
ファイル: listadowidget.py プロジェクト: vallemrv/tpvB3
 def rellenar_pedidos(self):
     pedidos = Pedidos().filter(query="estado LIKE '%PG_%'")
     if len(pedidos) < len(self.pd_lista):
         self.pd_lista = []
         self.lista.rm_all_widgets()
     for db in pedidos:
         if db.id in self.pd_lista:
             continue
         self.pd_lista.append(db.id)
         btn = LabelClicable(bgColor="#444444",
                             font_size='20dp',
                             color="#ffffff")
         btn.tag = {"db": db}
         fecha = db.fecha
         texto = "{0: <10}   Avisador: {1: <26}  {2}  Total: {3:5.2f} €".format(
             fecha.strftime("%H:%M:%S"), db.num_avisador, db.modo_pago,
             float(db.total))
         btn.text = texto
         btn.bind(on_release=self.onPress)
         self.lista.add_linea(btn)
         time.sleep(.1)
     self.lista.scroll_up(0)
     self.tpv.hide_spin()