-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenereted.py
611 lines (552 loc) · 24.4 KB
/
genereted.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
from kivymd.uix.screen import MDScreen
from kivymd.app import MDApp
from kivymd.uix.list import ThreeLineAvatarIconListItem, IconRightWidget,IconLeftWidget
import app as manage
class Add_invent(MDScreen):
def on_enter(self):
app = MDApp.get_running_app()
self.ids.label1.text = app.nombre
self.ids.label2.text = app.tipo
class Edit_invent(MDScreen):
def on_enter(self):
app = MDApp.get_running_app()
self.ids.label1.text = app.nombre
self.ids.label2.text = app.tipo
def buscar(self):
app = MDApp.get_running_app()
app.nombre
invent_id = self.ids.search.text
if invent_id is not None:
invent = manage.obtener_invent("./base.db", invent_id, app.nombre)
if invent is not None:
self.ids.nombre.text = invent[1]
self.ids.mail.text = invent[2]
self.ids.telefono.text = invent[3]
self.ids.address.text = invent[4]
self.ids.nit.text = invent[5]
self.ids.comentario.text = invent[6]
else:
# Si no se encontró el invent, asigna "No se encontró" a todos los campos
self.ids.nombre.text = "No se encontró"
self.ids.mail.text = "No se encontró"
self.ids.telefono.text = "No se encontró"
self.ids.address.text = "No se encontró"
self.ids.nit.text = "No se encontró"
self.ids.comentario.text = "No se encontró"
class List_invent(MDScreen):
def eliminar_invent(self, instance):
print("borrando ")
item = instance.parent.parent
self.ids.lista.remove_widget(item)
invent_id = int(item.text.split(":")[0])
print(invent_id)
manage.eliminar_invent("./base.db", invent_id)
def on_enter(self):
app = MDApp.get_running_app()
self.ids.label1.text = app.nombre
self.ids.label2.text = app.tipo
print(app.nombre, app.tipo)
consulta = """ SELECT DISTINCT
i.productoid,
i.existencia,
i.fecha_ultima_actualizacion,
p.nombre,
p.Categoría
FROM inventario AS i
INNER JOIN productos AS p ON i.productoid = p.productoid
WHERE i.activo = 1
AND p.activo = 1"""
rows = manage.consulta_general("./base.db",consulta)
print(rows)
print(len(rows))
for row in rows:
self.ids.lista.add_widget(
ThreeLineAvatarIconListItem(
IconLeftWidget(
icon="account"
),
IconRightWidget(
icon="delete",
on_release=lambda instance: self.eliminar_invent(instance)
),
radius=[20, 20, 20, 0],
bg_color=(0, 0.6, 0.4, 1),
text="ID:"+str(row[0])+" Nombre:"+str(row[3]),
secondary_text="Categoria"+str(row[4])+" existencia:"+str(row[1]),
tertiary_text="Actualizacio en:"+str(row[2]),
)
)
class View_invent(MDScreen):
def on_enter(self):
app = MDApp.get_running_app()
self.ids.label1.text = app.nombre
self.ids.label2.text = app.tipo
def buscar(self):
app = MDApp.get_running_app()
app.nombre
myid = self.ids.myid.text
if myid is not None:
invent = manage.obtener_invent("./base.db", myid, app.nombre)
if invent is not None:
id_ = str(invent[0])
self.ids.invent_id_.text="Id: "+ id_
self.ids.nombre.text = "Nombre: "+invent[1]
self.ids.mail.text ="Correo Electronico: "+ invent[2]
self.ids.telefono.text = "Telefono: "+invent[3]
self.ids.address.text = "Direccion: "+invent[4]
self.ids.nit.text = "NIT: "+invent[5]
self.ids.comentario.text ="Estado: "+ invent[6]
self.ids.fecha_creacion.text ="fecha ingreso: "+ str(invent[8])
self.ids.myid.text = ""
else:
self.ids.myid.text =""
self.ids.invent_id_.text = "no se encontró"
self.ids.nombre.text = "No se encontró"
self.ids.mail.text = "No se encontró"
self.ids.telefono.text = "No se encontró"
self.ids.address.text = "No se encontró"
self.ids.nit.text = "No se encontró"
self.ids.comentario.text = "No se encontró"
self.ids.fecha_creacion.text= "no se encontró"
class Add_buy(MDScreen):
def on_enter(self):
app = MDApp.get_running_app()
self.ids.label1.text = app.nombre
self.ids.label2.text = app.tipo
class Edit_buy(MDScreen):
def on_enter(self):
app = MDApp.get_running_app()
self.ids.label1.text = app.nombre
self.ids.label2.text = app.tipo
def buscar(self):
app = MDApp.get_running_app()
app.nombre
buy_id = self.ids.search.text
if buy_id is not None:
buy = manage.obtener_buy("./base.db", buy_id, app.nombre)
if buy is not None:
self.ids.nombre.text = buy[1]
self.ids.mail.text = buy[2]
self.ids.telefono.text = buy[3]
self.ids.address.text = buy[4]
self.ids.nit.text = buy[5]
self.ids.comentario.text = buy[6]
else:
# Si no se encontró el buy, asigna "No se encontró" a todos los campos
self.ids.nombre.text = "No se encontró"
self.ids.mail.text = "No se encontró"
self.ids.telefono.text = "No se encontró"
self.ids.address.text = "No se encontró"
self.ids.nit.text = "No se encontró"
self.ids.comentario.text = "No se encontró"
class List_buy(MDScreen):
def eliminar_buy(self, instance):
print("borrando ")
item = instance.parent.parent
self.ids.lista.remove_widget(item)
buy_id = int(item.secondary_text.split("|")[0])
manage.eliminar_buy("./base.db", buy_id)
def on_enter(self):
app = MDApp.get_running_app()
self.ids.label1.text = app.nombre
self.ids.label2.text = app.tipo
print(app.nombre, app.tipo)
rows = manage.consulta_general("./base.db","SELECT * FROM compras where toempresa = '"+app.nombre+"' and activo = 1")
for row in rows:
self.ids.lista.add_widget(
ThreeLineAvatarIconListItem(
IconLeftWidget(
icon="account"
),
IconRightWidget(
icon="delete",
on_release=lambda instance: self.eliminar_buy(instance)
),
radius=[20, 20, 20, 0],
bg_color=(0, 0.6, 0.4, 1),
text=row[1]+" | "+row[3],
secondary_text=row[0].__str__()+" | "+row[6],
tertiary_text=row[2],
)
)
class View_buy(MDScreen):
def on_enter(self):
app = MDApp.get_running_app()
self.ids.label1.text = app.nombre
self.ids.label2.text = app.tipo
def buscar(self):
app = MDApp.get_running_app()
app.nombre
myid = self.ids.myid.text
if myid is not None:
buy = manage.obtener_buy("./base.db", myid, app.nombre)
if buy is not None:
id_ = str(buy[0])
self.ids.buy_id_.text="Id: "+ id_
self.ids.nombre.text = "Nombre: "+buy[1]
self.ids.mail.text ="Correo Electronico: "+ buy[2]
self.ids.telefono.text = "Telefono: "+buy[3]
self.ids.address.text = "Direccion: "+buy[4]
self.ids.nit.text = "NIT: "+buy[5]
self.ids.comentario.text ="Estado: "+ buy[6]
self.ids.fecha_creacion.text ="fecha ingreso: "+ str(buy[8])
self.ids.myid.text = ""
else:
self.ids.myid.text =""
self.ids.buy_id_.text = "no se encontró"
self.ids.nombre.text = "No se encontró"
self.ids.mail.text = "No se encontró"
self.ids.telefono.text = "No se encontró"
self.ids.address.text = "No se encontró"
self.ids.nit.text = "No se encontró"
self.ids.comentario.text = "No se encontró"
self.ids.fecha_creacion.text= "no se encontró"
class Add_provider(MDScreen):
def on_enter(self):
app = MDApp.get_running_app()
self.ids.label1.text = app.nombre
self.ids.label2.text = app.tipo
class Edit_provider(MDScreen):
def on_enter(self):
app = MDApp.get_running_app()
self.ids.label1.text = app.nombre
self.ids.label2.text = app.tipo
def buscar(self):
app = MDApp.get_running_app()
app.nombre
provider_id = self.ids.search.text
if provider_id is not None:
provider = manage.obtener_provider("./base.db", provider_id, app.nombre)
if provider is not None:
self.ids.nombre.text = provider[1]
self.ids.mail.text = provider[2]
self.ids.telefono.text = provider[3]
self.ids.address.text = provider[4]
self.ids.nit.text = provider[5]
self.ids.comentario.text = provider[6]
else:
# Si no se encontró el provider, asigna "No se encontró" a todos los campos
self.ids.nombre.text = "No se encontró"
self.ids.mail.text = "No se encontró"
self.ids.telefono.text = "No se encontró"
self.ids.address.text = "No se encontró"
self.ids.nit.text = "No se encontró"
self.ids.comentario.text = "No se encontró"
class List_provider(MDScreen):
def eliminar_provider(self, instance):
print("borrando ")
item = instance.parent.parent
self.ids.lista.remove_widget(item)
provider_id = int(item.secondary_text.split("|")[0])
manage.eliminar_provider("./base.db", provider_id)
def on_enter(self):
app = MDApp.get_running_app()
self.ids.label1.text = app.nombre
self.ids.label2.text = app.tipo
print(app.nombre, app.tipo)
rows = manage.consulta_general("./base.db","SELECT * FROM proveedores where toempresa = '"+app.nombre+"' and activo = 1")
for row in rows:
self.ids.lista.add_widget(
ThreeLineAvatarIconListItem(
IconLeftWidget(
icon="account"
),
IconRightWidget(
icon="delete",
on_release=lambda instance: self.eliminar_provider(instance)
),
radius=[20, 20, 20, 0],
bg_color=(0, 0.6, 0.4, 1),
text=row[1]+" | "+row[3],
secondary_text=row[0].__str__()+" | "+row[6],
tertiary_text=row[2],
)
)
class View_provider(MDScreen):
def on_enter(self):
app = MDApp.get_running_app()
self.ids.label1.text = app.nombre
self.ids.label2.text = app.tipo
def buscar(self):
app = MDApp.get_running_app()
app.nombre
myid = self.ids.myid.text
if myid is not None:
provider = manage.obtener_provider("./base.db", myid, app.nombre)
if provider is not None:
id_ = str(provider[0])
self.ids.provider_id_.text="Id: "+ id_
self.ids.nombre.text = "Nombre: "+provider[1]
self.ids.mail.text ="Correo Electronico: "+ provider[2]
self.ids.telefono.text = "Telefono: "+provider[3]
self.ids.address.text = "Direccion: "+provider[4]
self.ids.nit.text = "NIT: "+provider[5]
self.ids.comentario.text ="Estado: "+ provider[6]
self.ids.fecha_creacion.text ="fecha ingreso: "+ str(provider[8])
self.ids.myid.text = ""
else:
self.ids.myid.text =""
self.ids.provider_id_.text = "no se encontró"
self.ids.nombre.text = "No se encontró"
self.ids.mail.text = "No se encontró"
self.ids.telefono.text = "No se encontró"
self.ids.address.text = "No se encontró"
self.ids.nit.text = "No se encontró"
self.ids.comentario.text = "No se encontró"
self.ids.fecha_creacion.text= "no se encontró"
class Add_product(MDScreen):
def on_enter(self):
app = MDApp.get_running_app()
self.ids.label1.text = app.nombre
self.ids.label2.text = app.tipo
class Edit_product(MDScreen):
def on_enter(self):
app = MDApp.get_running_app()
self.ids.label1.text = app.nombre
self.ids.label2.text = app.tipo
def buscar(self):
app = MDApp.get_running_app()
app.nombre
product_id = self.ids.search.text
if product_id is not None:
product = manage.obtener_product("./base.db", product_id, app.nombre)
if product is not None:
self.ids.nombre.text = product[1]
self.ids.mail.text = product[2]
self.ids.telefono.text = product[3]
self.ids.address.text = product[4]
self.ids.nit.text = product[5]
self.ids.comentario.text = product[6]
else:
# Si no se encontró el product, asigna "No se encontró" a todos los campos
self.ids.nombre.text = "No se encontró"
self.ids.mail.text = "No se encontró"
self.ids.telefono.text = "No se encontró"
self.ids.address.text = "No se encontró"
self.ids.nit.text = "No se encontró"
self.ids.comentario.text = "No se encontró"
class List_product(MDScreen):
def eliminar_product(self, instance):
print("borrando ")
item = instance.parent.parent
self.ids.lista.remove_widget(item)
product_id = int(item.secondary_text.split("|")[0])
manage.eliminar_product("./base.db", product_id)
def on_enter(self):
app = MDApp.get_running_app()
self.ids.label1.text = app.nombre
self.ids.label2.text = app.tipo
print(app.nombre, app.tipo)
rows = manage.consulta_general("./base.db","SELECT * FROM productos where toempresa = '"+app.nombre+"' and activo = 1")
for row in rows:
self.ids.lista.add_widget(
ThreeLineAvatarIconListItem(
IconLeftWidget(
icon="account"
),
IconRightWidget(
icon="delete",
on_release=lambda instance: self.eliminar_product(instance)
),
radius=[20, 20, 20, 0],
bg_color=(0, 0.6, 0.4, 1),
text=row[1]+" | "+row[3],
secondary_text=row[0].__str__()+" | "+row[6],
tertiary_text=row[2],
)
)
class View_product(MDScreen):
def on_enter(self):
app = MDApp.get_running_app()
self.ids.label1.text = app.nombre
self.ids.label2.text = app.tipo
def buscar(self):
app = MDApp.get_running_app()
app.nombre
myid = self.ids.myid.text
if myid is not None:
product = manage.obtener_product("./base.db", myid, app.nombre)
if product is not None:
id_ = str(product[0])
self.ids.product_id_.text="Id: "+ id_
self.ids.nombre.text = "Nombre: "+product[1]
self.ids.mail.text ="Correo Electronico: "+ product[2]
self.ids.telefono.text = "Telefono: "+product[3]
self.ids.address.text = "Direccion: "+product[4]
self.ids.nit.text = "NIT: "+product[5]
self.ids.comentario.text ="Estado: "+ product[6]
self.ids.fecha_creacion.text ="fecha ingreso: "+ str(product[8])
self.ids.myid.text = ""
else:
self.ids.myid.text =""
self.ids.product_id_.text = "no se encontró"
self.ids.nombre.text = "No se encontró"
self.ids.mail.text = "No se encontró"
self.ids.telefono.text = "No se encontró"
self.ids.address.text = "No se encontró"
self.ids.nit.text = "No se encontró"
self.ids.comentario.text = "No se encontró"
self.ids.fecha_creacion.text= "no se encontró"
class Add_facture(MDScreen):
def on_enter(self):
app = MDApp.get_running_app()
self.ids.label1.text = app.nombre
self.ids.label2.text = app.tipo
class Edit_facture(MDScreen):
def on_enter(self):
app = MDApp.get_running_app()
self.ids.label1.text = app.nombre
self.ids.label2.text = app.tipo
def buscar(self):
app = MDApp.get_running_app()
app.nombre
facture_id = self.ids.search.text
if facture_id is not None:
facture = manage.obtener_facture("./base.db", facture_id, app.nombre)
if facture is not None:
self.ids.nombre.text = facture[1]
self.ids.mail.text = facture[2]
self.ids.telefono.text = facture[3]
self.ids.address.text = facture[4]
self.ids.nit.text = facture[5]
self.ids.comentario.text = facture[6]
else:
# Si no se encontró el facture, asigna "No se encontró" a todos los campos
self.ids.nombre.text = "No se encontró"
self.ids.mail.text = "No se encontró"
self.ids.telefono.text = "No se encontró"
self.ids.address.text = "No se encontró"
self.ids.nit.text = "No se encontró"
self.ids.comentario.text = "No se encontró"
class List_facture(MDScreen):
def eliminar_facture(self, instance):
print("borrando ")
item = instance.parent.parent
self.ids.lista.remove_widget(item)
facture_id = int(item.secondary_text.split("|")[0])
manage.eliminar_facture("./base.db", facture_id)
def on_enter(self):
app = MDApp.get_running_app()
self.ids.label1.text = app.nombre
self.ids.label2.text = app.tipo
print(app.nombre, app.tipo)
rows = manage.consulta_general("./base.db","SELECT * FROM facturas where toempresa = '"+app.nombre+"' and activo = 1")
for row in rows:
self.ids.lista.add_widget(
ThreeLineAvatarIconListItem(
IconLeftWidget(
icon="account"
),
IconRightWidget(
icon="delete",
on_release=lambda instance: self.eliminar_facture(instance)
),
radius=[20, 20, 20, 0],
bg_color=(0, 0.6, 0.4, 1),
text=row[1]+" | "+row[3],
secondary_text=row[0].__str__()+" | "+row[6],
tertiary_text=row[2],
)
)
class View_facture(MDScreen):
def on_enter(self):
app = MDApp.get_running_app()
self.ids.label1.text = app.nombre
self.ids.label2.text = app.tipo
def buscar(self):
app = MDApp.get_running_app()
app.nombre
myid = self.ids.myid.text
if myid is not None:
facture = manage.obtener_facture("./base.db", myid, app.nombre)
if facture is not None:
id_ = str(facture[0])
self.ids.facture_id_.text="Id: "+ id_
self.ids.nombre.text = "Nombre: "+facture[1]
self.ids.mail.text ="Correo Electronico: "+ facture[2]
self.ids.telefono.text = "Telefono: "+facture[3]
self.ids.address.text = "Direccion: "+facture[4]
self.ids.nit.text = "NIT: "+facture[5]
self.ids.comentario.text ="Estado: "+ facture[6]
self.ids.fecha_creacion.text ="fecha ingreso: "+ str(facture[8])
self.ids.myid.text = ""
else:
self.ids.myid.text =""
self.ids.facture_id_.text = "no se encontró"
self.ids.nombre.text = "No se encontró"
self.ids.mail.text = "No se encontró"
self.ids.telefono.text = "No se encontró"
self.ids.address.text = "No se encontró"
self.ids.nit.text = "No se encontró"
self.ids.comentario.text = "No se encontró"
self.ids.fecha_creacion.text= "no se encontró"
class Add_report(MDScreen):
def on_enter(self):
app = MDApp.get_running_app()
self.ids.label1.text = app.nombre
self.ids.label2.text = app.tipo
class Edit_report(MDScreen):
def on_enter(self):
app = MDApp.get_running_app()
self.ids.label1.text = app.nombre
self.ids.label2.text = app.tipo
def buscar(self):
app = MDApp.get_running_app()
app.nombre
report_id = self.ids.search.text
if report_id is not None:
report = manage.obtener_report("./base.db", report_id, app.nombre)
if report is not None:
self.ids.nombre.text = report[1]
self.ids.mail.text = report[2]
self.ids.telefono.text = report[3]
self.ids.address.text = report[4]
self.ids.nit.text = report[5]
self.ids.comentario.text = report[6]
else:
# Si no se encontró el report, asigna "No se encontró" a todos los campos
self.ids.nombre.text = "No se encontró"
self.ids.mail.text = "No se encontró"
self.ids.telefono.text = "No se encontró"
self.ids.address.text = "No se encontró"
self.ids.nit.text = "No se encontró"
self.ids.comentario.text = "No se encontró"
class List_report(MDScreen):
def eliminar_report(self, instance):
print("borrando ")
item = instance.parent.parent
self.ids.lista.remove_widget(item)
report_id = int(item.secondary_text.split("|")[0])
manage.eliminar_report("./base.db", report_id)
class View_report(MDScreen):
def on_enter(self):
app = MDApp.get_running_app()
self.ids.label1.text = app.nombre
self.ids.label2.text = app.tipo
def buscar(self):
app = MDApp.get_running_app()
app.nombre
myid = self.ids.myid.text
if myid is not None:
report = manage.obtener_report("./base.db", myid, app.nombre)
if report is not None:
id_ = str(report[0])
self.ids.report_id_.text="Id: "+ id_
self.ids.nombre.text = "Nombre: "+report[1]
self.ids.mail.text ="Correo Electronico: "+ report[2]
self.ids.telefono.text = "Telefono: "+report[3]
self.ids.address.text = "Direccion: "+report[4]
self.ids.nit.text = "NIT: "+report[5]
self.ids.comentario.text ="Estado: "+ report[6]
self.ids.fecha_creacion.text ="fecha ingreso: "+ str(report[8])
self.ids.myid.text = ""
else:
self.ids.myid.text =""
self.ids.report_id_.text = "no se encontró"
self.ids.nombre.text = "No se encontró"
self.ids.mail.text = "No se encontró"
self.ids.telefono.text = "No se encontró"
self.ids.address.text = "No se encontró"
self.ids.nit.text = "No se encontró"
self.ids.comentario.text = "No se encontró"
self.ids.fecha_creacion.text= "no se encontró"