-
Notifications
You must be signed in to change notification settings - Fork 0
/
envanter.py
3493 lines (2569 loc) · 159 KB
/
envanter.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
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# This program is made by Hasan Senyurt for ISTAC A.S. - Inventory Management Software
from tkinter import *
import pandas as pd
from tkinter import ttk
from tkinter import messagebox
from datetime import datetime
import getpass
############################################################
# Arranging row colors of the tables.
def coloring3():
for i in table3.get_children():
if int(table3.index(i)) % 2 == 0:
table3.item(i,tags=("even"))
else:
table3.item(i,tags=("odd"))
table3.tag_configure("even",background="Azure2")
table3.tag_configure("odd",background="ghost white")
def coloring2():
for i in table2.get_children():
if int(table2.index(i)) % 2 == 0:
table2.item(i,tags=("even"))
else:
table2.item(i,tags=("odd"))
table2.tag_configure("even",background="Azure2")
table2.tag_configure("odd",background="ghost white")
def coloring():
for i in table.get_children():
if int(table.index(i)) % 2 == 0:
table.item(i,tags=("even"))
else:
table.item(i,tags=("odd"))
table.tag_configure("even",background="Azure2")
table.tag_configure("odd",background="ghost white")
############################################################
############################################################
# Keeping log records.
def logs():
global logfile
logfile = open("logs.log","a")
logfile.write(str(datetime.now())[:19]+"\t"+format(getpass.getuser(),"20s"))
def logsclose():
logfile.close()
############################################################
############################################################
# Saving changed data before quiting program.
def beforeExit():
if messagebox.askokcancel("Çıkış", "Çıkış yapmak istiyor musunuz?"):
if filter_cancel['state'] == ACTIVE:
returnTable()
if filter_cancel2['state'] == ACTIVE:
returnTable2()
if filter_cancel3['state'] == ACTIVE:
returnTable3()
export("local")
export2("local")
export3("local")
window.destroy()
############################################################
############################################################
# Saving changes on table to data file after every operation.
def updateTable(tablo,liste):
global p,p2,p3
if p != 1 and liste == "Depo Listesi.xlsx":
for i in tablo.get_children():
tablo.delete(i)
data = pd.read_excel("Tablolar/"+liste)
data = data.fillna('')
for i in range(0,len(data)):
tablo.insert(parent = '', index='end',id=i+1, values=[data.loc[i][j] for j in range(0,len(data.columns))])
coloring()
if p2 != 1 and liste == "Zimmet Listesi.xlsx":
for i in tablo.get_children():
tablo.delete(i)
data = pd.read_excel("Tablolar/"+liste)
data = data.fillna('')
for i in range(0,len(data)):
tablo.insert(parent = '', index='end',id=i+1, values=[data.loc[i][j] for j in range(0,len(data.columns))])
coloring2()
if p3 != 1 and liste == "Hurda Listesi.xlsx":
for i in tablo.get_children():
tablo.delete(i)
data = pd.read_excel("Tablolar/"+liste)
data = data.fillna('')
for i in range(0,len(data)):
tablo.insert(parent = '', index='end',id=i+1, values=[data.loc[i][j] for j in range(0,len(data.columns))])
coloring3()
############################################################
############################################################
# Loading data to both three tables from data files.
def importExcel3():
global items3
items3 = pd.read_excel("Tablolar/Hurda Listesi.xlsx")
global columns3
columns3 = list()
for i in items3.columns:
columns3.append(i)
table3['columns'] = columns3
table3.column("#0", width=0, stretch=NO)
for i in range(0,len(columns3)):
if(i ==4):
table3.column(columns3[i],width=428,minwidth=750) #392
elif i==0:
table3.column(columns3[i],width=100,minwidth=100)
elif i == 1:
table3.column(columns3[i],width=300,minwidth=300)
else:
table3.column(columns3[i],width=100,minwidth=100)
table3.heading("#0", text="")
for i in range(0,len(columns3)):
table3.heading(columns3[i],text=columns3[i],anchor="w")
items3 = items3.fillna('')
items3['Açıklama'] = items3['Açıklama'].astype(str)
for i in range(0,len(items3)):
table3.insert(parent = '', index='end',id=i+1, values=[items3.loc[i][j] for j in range(0,len(items3.columns))])
coloring3()
def importExcel2():
global items2
items2 = pd.read_excel("Tablolar/Zimmet Listesi.xlsx")
global columns2
columns2 = list()
for i in items2.columns:
columns2.append(i)
table2['columns'] = columns2
table2.column("#0", width=0, stretch=NO)
for i in range(0,len(columns2)):
if(i==1):
table2.column(columns2[i],width=260,minwidth=260)
elif i ==7:
table2.column(columns2[i],width=126,minwidth=750)
elif i==0:
table2.column(columns2[i],width=90,minwidth=90)
elif i ==5 or i ==6:
table2.column(columns2[i],width=134,minwidth=134)
elif i ==4:
table2.column(columns2[i],width=134,minwidth=134)
else:
table2.column(columns2[i],width=75,minwidth=75)
table2.heading("#0", text="")
for i in range(0,len(columns2)):
table2.heading(columns2[i],text=columns2[i],anchor="w")
items2 = items2.fillna('')
items2['Tarih'] = items2['Tarih'].astype(str)
items2['Açıklama'] = items2['Açıklama'].astype(str)
for i in range(0,len(items2)):
table2.insert(parent = '', index='end',id=i+1, values=[items2.loc[i][j] for j in range(0,len(items2.columns))])
coloring2()
def importExcel():
global items
items = pd.read_excel("Tablolar/Depo Listesi.xlsx")
global columns
columns = list()
for i in items.columns:
columns.append(i)
table['columns'] = columns
table.column("#0", width=0, stretch=NO)
for i in range(0,len(columns)):
if(i ==4):
table.column(columns[i],width=378,minwidth=750) #392
elif i==0:
table.column(columns[i],width=100,minwidth=100)
elif i == 1:
table.column(columns[i],width=300,minwidth=300)
else:
table.column(columns[i],width=75,minwidth=75)
table.heading("#0", text="")
for i in range(0,len(columns)):
table.heading(columns[i],text=columns[i],anchor="w")
items = items.fillna('')
items['Açıklama'] = items['Açıklama'].astype(str)
for i in range(0,len(items)):
table.insert(parent = '', index='end',id=i+1, values=[items.loc[i][j] for j in range(0,len(items.columns))])
coloring()
############################################################
############################################################
# Solving problem because of upper 'i' character in Turkish alphabet.
def entryUpper(entry):
up = str()
for i in entry:
if i == 'i':
up = up + 'İ'
else:
up = up + i.upper()
return up
############################################################
############################################################
# Clearing all items on junk table.
def removeAll():
for i in table3.get_children():
table3.delete(i)
logs()
logfile.write("HURDA LİSTESİ"+"\t"+"TEMİZLEME"+" "+"HURDA LİSTESİ TEMİZLENDİ."+"\n")
logsclose()
export3("local")
############################################################
############################################################
# Cancelling filter option to return normal sized table.
def returnTable3():
global p3
p3 = 0
for i in table3.get_children():
table3.delete(i)
for i in range(0,len(new_table3)):
table3.insert(parent = '', index=index3[i],id=i+1, values=[new_table3[i][j] for j in range(0,len(new_table3[0]))])
filter_button3['state'] = ACTIVE
filter_cancel3['state'] = DISABLED
excel_button3['state'] = ACTIVE
export3("local")
updateTable(table3,"Hurda Listesi.xlsx")
def returnTable2():
global p2
p2=0
extratable = []
for i in table2.get_children():
extratable.append(table2.item(i).get("values"))
for i in table2.get_children():
table2.delete(i)
newlist = filtertable + extratable
for i in range(0,len(newlist)):
table2.insert(parent = '', index='end',id=i+1, values=[newlist[i][j] for j in range(0,len(newlist[0]))])
sorting(table2)
filter_button2['state'] = ACTIVE
filter_cancel2['state'] = DISABLED
excel_button2['state'] = ACTIVE
export2("local")
updateTable(table2,"Zimmet Listesi.xlsx")
def returnTable():
global p
p = 0
extratable = []
for i in table.get_children():
extratable.append(table.item(i).get("values"))
for i in table.get_children():
table.delete(i)
newlist = new_table + extratable
for i in range(0,len(newlist)):
table.insert(parent = '', index='end',id=i+1, values=[newlist[i][j] for j in range(0,len(newlist[0]))])
sorting(table)
filter_button['state'] = ACTIVE
filter_cancel['state'] = DISABLED
excel_button['state'] = ACTIVE
export("local")
updateTable(table,"Depo Listesi.xlsx")
############################################################
############################################################
# Filtering products by their name or person.
def filter3():
global p3
p3 = 0
flag = False
if category_entry3.get().isspace() or category_entry3.get() == '':
messagebox.showwarning("UYARI","Lütfen Ürün İsmi Girin!")
flag = True
global new_table3,index3
new_table3 = []
index3 = []
if flag == False:
p3 = 1
for i in table3.get_children():
index3.append(table3.index(i))
for i in table3.get_children():
if str(entryUpper(category_entry3.get())) not in str(entryUpper(table3.item(i).get("values")[1])):
new_table3.append(table3.item(i).get("values"))
table3.delete(i)
else:
new_table3.append(table3.item(i).get("values"))
filter_button3['state'] = DISABLED
filter_cancel3['state'] = ACTIVE
excel_button3['state'] = DISABLED
def filter2():
global filtertable
global p2
p2 = 0
if control_menu.get() == "Seç:":
messagebox.showwarning("UYARI","Lütfen Kategori Seçiniz!")
elif control_menu.get() == "Ürün: ":
ctrl = False
filtertable = []
if category_entry2.get().isspace() or category_entry2.get() == '':
messagebox.showwarning("UYARI","Lütfen Ürün İsmi Girin!")
ctrl = True
if ctrl == False:
p2 = 1
for i in table2.get_children():
if str(entryUpper(category_entry2.get())) not in str(entryUpper(table2.item(i).get("values")[1])):
filtertable.append(table2.item(i).get("values"))
table2.delete(i)
filter_button2['state'] = DISABLED
filter_cancel2['state'] = ACTIVE
excel_button2['state'] = DISABLED
elif control_menu.get() == "Kişi: ":
ctrl = False
filtertable = []
if category_entry2.get().isspace() or category_entry2.get() == '':
messagebox.showwarning("UYARI","Lütfen Kişi İsmi Girin!")
ctrl = True
if ctrl == False:
p2= 1
for i in table2.get_children():
if str(entryUpper(category_entry2.get())) not in str(entryUpper(table2.item(i).get("values")[4])) and str(entryUpper(category_entry2.get())) not in str(entryUpper(table2.item(i).get("values")[5])):
filtertable.append(table2.item(i).get("values"))
table2.delete(i)
filter_button2['state'] = DISABLED
filter_cancel2['state'] = ACTIVE
excel_button2['state'] = DISABLED
def filter():
global p
p = 0
flag = False
if category_entry.get().isspace() or category_entry.get() == '':
messagebox.showwarning("UYARI","Lütfen Ürün İsmi Girin!")
flag = True
global new_table
new_table = []
if flag == False:
p = 1
for i in table.get_children():
if str(entryUpper(category_entry.get())) not in str(entryUpper(table.item(i).get("values")[1])):
new_table.append(table.item(i).get("values"))
table.delete(i)
filter_button['state'] = DISABLED
filter_cancel['state'] = ACTIVE
excel_button['state'] = DISABLED
#print(entryUpper(category_entry))
############################################################
############################################################
# Prevents entring nonnumeric values to amount of product entries.
def testVal(inStr,acttyp):
if acttyp == '1': #insert
if not inStr.isdigit():
return False
return True
############################################################
############################################################
# Adding product back to inventory from registered list by clicking with mouse.
def addBack2():
flag = False
flag2 = False
try:
iselected = table2.focus()
for o in table.get_children():
if(str(table.item(o).get("values")[0]) == str(table2.item(iselected).get("values")[0])
and str(table.item(o).get("values")[1]) == str(table2.item(iselected).get("values")[1])
and str(table.item(o).get("values")[3]) == str(table2.item(iselected).get("values")[3])
and str(table.item(o).get("values")[4]) == aciklama02.get()):
flag2 = True
break
if miktar02.get().isspace() or miktar02.get() == '':
messagebox.showwarning("UYARI!","Lütfen Miktar Girin!")
flag = True
else:
if (str(table2.item(iselected).get("values")[0]) == str(malzeme0x.cget("text"))
and str(table2.item(iselected).get("values")[1]) == str(malzeme_metin0x.cget("text"))
and str(table2.item(iselected).get("values")[3]) == str(olcu0x.cget("text"))
and str(table2.item(iselected).get("values")[4]) == str(veren0x.cget("text"))
and str(table2.item(iselected).get("values")[5]) == str(alan0x.cget("text"))
and str(table2.item(iselected).get("values")[6]) == str(tarih0x.cget("text"))):
if flag2 == True:
if int(miktar02.get()) >= int(table2.item(iselected).get("values")[2]):
table.item(o,values=(table.item(o).get("values")[0],table.item(o).get("values")[1],int(table.item(o).get("values")[2])
+int(table2.item(iselected).get("values")[2]),table.item(o).get("values")[3],table.item(o).get("values")[4]))
logs()
logfile.write("ZİMMET LİSTESİ"+"\t"+"GERİ EKLEME"+" "+str(table2.item(iselected).get("values")[0])+" - "+str(table2.item(iselected).get("values")[1])+" - "
+str(table2.item(iselected).get("values")[2])+" - "+str(table2.item(iselected).get("values")[3])+" - "+str(table2.item(iselected).get("values")[4])
+" - "+str(table2.item(iselected).get("values")[5])+" - "+str(table2.item(iselected).get("values")[6])+" - "+str(table2.item(iselected).get("values")[7])+"\n")
logsclose()
else:
table.item(o,values=(table.item(o).get("values")[0],table.item(o).get("values")[1],int(table.item(o).get("values")[2])
+int(miktar02.get()),table.item(o).get("values")[3],table.item(o).get("values")[4]))
logs()
logfile.write("ZİMMET LİSTESİ"+"\t"+"GERİ EKLEME"+" "+str(table2.item(iselected).get("values")[0])+" - "+str(table2.item(iselected).get("values")[1])+" - "
+miktar02.get()+" - "+str(table2.item(iselected).get("values")[3])+" - "+str(table2.item(iselected).get("values")[4])
+" - "+str(table2.item(iselected).get("values")[5])+" - "+str(table2.item(iselected).get("values")[6])+" - "+str(table2.item(iselected).get("values")[7])+"\n")
logsclose()
else:
if int(miktar02.get()) >= int(table2.item(iselected).get("values")[2]):
try:
table.insert(parent = '', index="end",id=max([int(q) for q in table.get_children()])+1,values=(str(table2.item(iselected).get("values")[0]),
table2.item(iselected).get("values")[1],int(table2.item(iselected).get("values")[2]),table2.item(iselected).get("values")[3],aciklama02.get()))
sorting(table)
except:
table.insert(parent = '', index="end",id=1,values=(table2.item(iselected).get("values")[0],table2.item(iselected).get("values")[1]
,int(table2.item(iselected).get("values")[2]),table2.item(iselected).get("values")[3],aciklama02.get()))
sorting(table)
logs()
logfile.write("ZİMMET LİSTESİ"+"\t"+"GERİ EKLEME"+" "+str(table2.item(iselected).get("values")[0])+" - "+str(table2.item(iselected).get("values")[1])+" - "
+str(table2.item(iselected).get("values")[2])+" - "+str(table2.item(iselected).get("values")[3])+" - "+str(table2.item(iselected).get("values")[4])
+" - "+str(table2.item(iselected).get("values")[5])+" - "+str(table2.item(iselected).get("values")[6])+" - "+aciklama02.get()+"\n")
logsclose()
else:
try:
table.insert(parent = '', index="end",id=1,values=(table2.item(iselected).get("values")[0],table2.item(iselected).get("values")[1]
,miktar02.get(),table2.item(iselected).get("values")[3],aciklama02.get()))
sorting(table)
except:
table.insert(parent = '', index="end",id=max([int(q) for q in table.get_children()])+1,values=(str(table2.item(iselected).get("values")[0]),
table2.item(iselected).get("values")[1],miktar02.get(),table2.item(iselected).get("values")[3],aciklama02.get()))
sorting(table)
logs()
logfile.write("ZİMMET LİSTESİ"+"\t"+"GERİ EKLEME"+" "+str(table2.item(iselected).get("values")[0])+" - "+str(table2.item(iselected).get("values")[1])+" - "
+miktar02.get()+" - "+str(table2.item(iselected).get("values")[3])+" - "+str(table2.item(iselected).get("values")[4])
+" - "+str(table2.item(iselected).get("values")[5])+" - "+str(table2.item(iselected).get("values")[6])+" - "+aciklama02.get()+"\n")
logsclose()
if(int(miktar02.get())) >= int(table2.item(int(iselected)).get("values")[2]):
real_table3 = []
indexlist = []
table2.delete(iselected)
for i in table2.get_children():
real_table3.append(table2.item(i).get("values"))
indexlist.append(i)
for x in table2.get_children():
table2.delete(x)
for l in range(0,len(real_table3)):
table2.insert(parent = '', index='end',id=indexlist[l],values=[real_table3[l][a] for a in range (0,len(real_table3[0]))])
sorting(table2)
else:
table2.item(iselected, text="",values=(table2.item(iselected).get("values")[0],table2.item(iselected).get("values")[1],
table2.item(iselected).get("values")[2]-int(miktar02.get())
,table2.item(iselected).get("values")[3],table2.item(iselected).get("values")[4],table2.item(iselected).get("values")[5],
table2.item(iselected).get("values")[6],table2.item(iselected).get("values")[7]))
export("local")
export2("local")
else:
messagebox.showwarning("UYARI","Farklı Bir Ürün Seçili!")
except IndexError:
messagebox.showwarning("UYARI","Ürün Seçili Değil!")
############################################################
############################################################
# Adding product back to inventory from registered list by its product number.
def addBack():
try:
global real_table6
real_table6 = []
flag = False
flag2 = False
for j in table2.get_children():
if(malzeme0.get() == str(table2.item(j).get("values")[0]) and veren0.get() == str(table2.item(j).get("values")[4])
and alan0.get() == str(table2.item(j).get("values")[5])):
flag = True
break
if flag == True:
for i in table2.get_children():
if(malzeme0.get().isspace() or malzeme0.get() == '' or miktar0.get().isspace() or miktar0.get() == ''
or veren0.get().isspace() or veren0.get() == '' or alan0.get().isspace() or alan0.get() == ''):
messagebox.showwarning("UYARI","Parametreleri lütfen doldurun!")
break
elif(str(table2.item(i).get("values")[0]) == malzeme0.get()):
for o in table.get_children():
if(str(table.item(o).get("values")[0]) == str(table2.item(i).get("values")[0])
and str(table.item(o).get("values")[1]) == str(table2.item(i).get("values")[1])
and str(table.item(o).get("values")[3]) == str(table2.item(i).get("values")[3])
and str(table.item(o).get("values")[4]) == aciklama0.get()):
flag2 = True
break
if(table2.item(i).get("values")[2] - int(miktar0.get())) <=0:
if flag2 == True:
if int(miktar0.get()) >= int(table2.item(i).get("values")[2]):
table.item(o,values=(table.item(o).get("values")[0],table.item(o).get("values")[1],int(table.item(o).get("values")[2])
+int(table2.item(i).get("values")[2]),table.item(o).get("values")[3],table.item(o).get("values")[4]))
logs()
logfile.write("ZİMMET LİSTESİ"+"\t"+"GERİ EKLEME"+" "+str(table2.item(i).get("values")[0])+" - "+str(table2.item(i).get("values")[1])+" - "
+str(table2.item(i).get("values")[2])+" - "+str(table2.item(i).get("values")[3])+" - "+str(table2.item(i).get("values")[4])
+" - "+str(table2.item(i).get("values")[5])+" - "+str(table2.item(i).get("values")[6])+" - "+aciklama0.get()+"\n")
logsclose()
else:
table.item(o,values=(table.item(o).get("values")[0],table.item(o).get("values")[1],int(table.item(o).get("values")[2])
+int(miktar0.get()),table.item(o).get("values")[3],table.item(o).get("values")[4]))
logs()
logfile.write("ZİMMET LİSTESİ"+"\t"+"GERİ EKLEME"+" "+str(table2.item(i).get("values")[0])+" - "+str(table2.item(i).get("values")[1])+" - "
+miktar0.get()+" - "+str(table2.item(i).get("values")[3])+" - "+str(table2.item(i).get("values")[4])
+" - "+str(table2.item(i).get("values")[5])+" - "+str(table2.item(i).get("values")[6])+" - "+aciklama0.get()+"\n")
logsclose()
else:
if int(miktar0.get()) >= int(table2.item(i).get("values")[2]):
if aciklama0.get().isspace() or aciklama0.get() == '':
try:
table.insert(parent='',index = 'end',id = max([int(q) for q in table.get_children()])+1,values=(table2.item(i).get("values")[0],
table2.item(i).get("values")[1],int(table2.item(i).get("values")[2]),table2.item(i).get("values")[3],table2.item(i).get("values")[7]))
except:
table.insert(parent='',index = 'end',id = 1,values=(table2.item(i).get("values")[0],
table2.item(i).get("values")[1],int(table2.item(i).get("values")[2]),table2.item(i).get("values")[3],table2.item(i).get("values")[7]))
logs()
logfile.write("ZİMMET LİSTESİ"+"\t"+"GERİ EKLEME"+" "+str(table2.item(i).get("values")[0])+" - "+str(table2.item(i).get("values")[1])+" - "
+str(table2.item(i).get("values")[2])+" - "+str(table2.item(i).get("values")[3])+" - "+str(table2.item(i).get("values")[4])
+" - "+str(table2.item(i).get("values")[5])+" - "+str(table2.item(i).get("values")[6])+" - "+str(table2.item(i).get("values")[7])+"\n")
logsclose()
else:
try:
table.insert(parent='',index = 'end',id = max([int(q) for q in table.get_children()])+1,values=(table2.item(i).get("values")[0],
table2.item(i).get("values")[1],int(table2.item(i).get("values")[2]),table2.item(i).get("values")[3],aciklama0.get()))
except:
table.insert(parent='',index = 'end',id = 1,values=(table2.item(i).get("values")[0],
table2.item(i).get("values")[1],int(table2.item(i).get("values")[2]),table2.item(i).get("values")[3],aciklama0.get()))
logs()
logfile.write("ZİMMET LİSTESİ"+"\t"+"GERİ EKLEME"+" "+str(table2.item(i).get("values")[0])+" - "+str(table2.item(i).get("values")[1])+" - "
+str(table2.item(i).get("values")[2])+" - "+str(table2.item(i).get("values")[3])+" - "+str(table2.item(i).get("values")[4])
+" - "+str(table2.item(i).get("values")[5])+" - "+str(table2.item(i).get("values")[6])+" - "+aciklama0.get()+"\n")
logsclose()
else:
if aciklama0.get().isspace() or aciklama0.get() == '':
try:
table.insert(parent='',index = 'end',id = max([int(q) for q in table.get_children()])+1,values=(table2.item(i).get("values")[0],
table2.item(i).get("values")[1],int(miktar0.get()),table2.item(i).get("values")[3],table2.item(i).get("values")[7]))
except:
table.insert(parent='',index = 'end',id = 1,values=(table2.item(i).get("values")[0],
table2.item(i).get("values")[1],int(miktar0.get()),table2.item(i).get("values")[3],table2.item(i).get("values")[7]))
logs()
logfile.write("ZİMMET LİSTESİ"+"\t"+"GERİ EKLEME"+" "+str(table2.item(i).get("values")[0])+" - "+str(table2.item(i).get("values")[1])+" - "
+miktar0.get()+" - "+str(table2.item(i).get("values")[3])+" - "+str(table2.item(i).get("values")[4])
+" - "+str(table2.item(i).get("values")[5])+" - "+str(table2.item(i).get("values")[6])+" - "+str(table2.item(i).get("values")[7])+"\n")
logsclose()
else:
try:
table.insert(parent='',index = 'end',id = max([int(q) for q in table.get_children()])+1,values=(table2.item(i).get("values")[0],
table2.item(i).get("values")[1],int(miktar0.get()),table2.item(i).get("values")[3],aciklama0.get()))
except:
table.insert(parent='',index = 'end',id = 1,values=(table2.item(i).get("values")[0],
table2.item(i).get("values")[1],int(miktar0.get()),table2.item(i).get("values")[3],aciklama0.get()))
logs()
logfile.write("ZİMMET LİSTESİ"+"\t"+"GERİ EKLEME"+" "+str(table2.item(i).get("values")[0])+" - "+str(table2.item(i).get("values")[1])+" - "
+miktar0.get()+" - "+str(table2.item(i).get("values")[3])+" - "+str(table2.item(i).get("values")[4])
+" - "+str(table2.item(i).get("values")[5])+" - "+str(table2.item(i).get("values")[6])+" - "+aciklama0.get()+"\n")
logsclose()
real_table3 = []
indexlist = []
table2.delete(i)
for c in table2.get_children():
real_table3.append(table2.item(c).get("values"))
indexlist.append(c)
for x in table2.get_children():
table2.delete(x)
for l in range(0,len(real_table3)):
table2.insert(parent = '', index='end',id=indexlist[l],values=[real_table3[l][a] for a in range (0,len(real_table3[0]))])
sorting(table)
sorting(table2)
break
else:
## insert kısmı
if flag2 == True:
table.item(o,values=(table.item(o).get("values")[0],table.item(o).get("values")[1],int(table.item(o).get("values")[2])
+int(miktar0.get()),table.item(o).get("values")[3],table.item(o).get("values")[4]))
logs()
logfile.write("ZİMMET LİSTESİ"+"\t"+"GERİ EKLEME"+" "+str(table2.item(i).get("values")[0])+" - "+str(table2.item(i).get("values")[1])+" - "
+miktar0.get()+" - "+str(table2.item(i).get("values")[3])+" - "+str(table2.item(i).get("values")[4])
+" - "+str(table2.item(i).get("values")[5])+" - "+str(table2.item(i).get("values")[6])+" - "+aciklama0.get()+"\n")
logsclose()
else:
if aciklama0.get().isspace() or aciklama0.get() == '':
try:
table.insert(parent='',index = 'end',id = max([int(q) for q in table.get_children()])+1,values=(table2.item(i).get("values")[0],
table2.item(i).get("values")[1],int(miktar0.get()),table2.item(i).get("values")[3],table2.item(i).get("values")[7]))
except:
table.insert(parent='',index = 'end',id = 1,values=(table2.item(i).get("values")[0],
table2.item(i).get("values")[1],int(miktar0.get()),table2.item(i).get("values")[3],table2.item(i).get("values")[7]))
logs()
logfile.write("ZİMMET LİSTESİ"+"\t"+"GERİ EKLEME"+" "+str(table2.item(i).get("values")[0])+" - "+str(table2.item(i).get("values")[1])+" - "
+miktar0.get()+" - "+str(table2.item(i).get("values")[3])+" - "+str(table2.item(i).get("values")[4])
+" - "+str(table2.item(i).get("values")[5])+" - "+str(table2.item(i).get("values")[6])+" - "+str(table2.item(i).get("values")[7])+"\n")
logsclose()
else:
try:
table.insert(parent='',index = 'end',id = max([int(q) for q in table.get_children()])+1,values=(table2.item(i).get("values")[0],
table2.item(i).get("values")[1],int(miktar0.get()),table2.item(i).get("values")[3],aciklama0.get()))
except:
table.insert(parent='',index = 'end',id = 1,values=(table2.item(i).get("values")[0],
table2.item(i).get("values")[1],int(miktar0.get()),table2.item(i).get("values")[3],aciklama0.get()))
logs()
logfile.write("ZİMMET LİSTESİ"+"\t"+"GERİ EKLEME"+" "+str(table2.item(i).get("values")[0])+" - "+str(table2.item(i).get("values")[1])+" - "
+miktar0.get()+" - "+str(table2.item(i).get("values")[3])+" - "+str(table2.item(i).get("values")[4])
+" - "+str(table2.item(i).get("values")[5])+" - "+str(table2.item(i).get("values")[6])+" - "+aciklama0.get()+"\n")
logsclose()
##
table2.item(i,values=(table2.item(i).get("values")[0],table2.item(i).get("values")[1],table2.item(i).get("values")[2]
-int(miktar0.get()),table2.item(i).get("values")[3],table2.item(i).get("values")[4],table2.item(i).get("values")[5]
,table2.item(i).get("values")[6],table2.item(i).get("values")[7]))
#table.item(i).get("values")[2] +=1
sorting(table)
sorting(table2)
break
break
export("local")
export2("local")
elif flag == False:
messagebox.showwarning("UYARI","Böyle Bir Ürün Yok!")
except IndexError:
messagebox.showwarning("UYARI","Böyle Bir Ürün Yok!")
except ValueError:
messagebox.showwarning("UYARI","Böyle Bir Ürün Yok!")
############################################################
############################################################
# Sorting products according to their product id on the tables.
def sorting(table_list):
if p != 1 and p2 !=1:
try:
sort_list = [table_list.item(a).get("values") for a in table_list.get_children()]
intlist = []
strlist = []
for i in range(0,len(sort_list)):
if type(sort_list[i][0]) == int:
intlist.append(int(sort_list[i][0]))
else:
strlist.append(sort_list[i][0])
intlist.sort()
real_table4 = []
sortlist2 = []
for i in range(0,len(intlist)):
for j in table_list.get_children():
if str(intlist[i]) == str(table_list.item(j).get("values")[0]):
sortlist2.append(table_list.item(j).get("values"))
table_list.delete(j)
break
for i in range(0,len(strlist)):
for j in table_list.get_children():
if str(strlist[i]) == str(table_list.item(j).get("values")[0]):
sortlist2.append(table_list.item(j).get("values"))
table_list.delete(j)
break
for x in table_list.get_children():
table_list.delete(x)
for i in range(0,len(sortlist2)):
table_list.insert(parent = '', index='end',id=i+1, values=[sortlist2[i][j] for j in range(0,len(sortlist2[0]))])
except:
print("Sorting Sorunu")
coloring()
coloring2()
coloring3()
############################################################
############################################################
# Editting mouse-selected registered product.
def edit4():
logs()
logfile.write("ZİMMET LİSTESİ"+"\t"+"DÜZENLEME"+" "+str(table2.item(selectedItemx).get("values")[0])+" - "+str(table2.item(selectedItemx).get("values")[1])+" - "
+str(table2.item(selectedItemx).get("values")[2])+" - "+str(table2.item(selectedItemx).get("values")[3])+" - "+str(table2.item(selectedItemx).get("values")[4]
+" - "+str(table2.item(selectedItemx).get("values")[5])+" - "+str(table2.item(selectedItemx).get("values")[6])+" - "+str(table2.item(selectedItemx).get("values")[7])))
table2.item(selectedItemx, text="",values=(malzemet.get(),malzeme_metint.get()
,miktart.get(),olcut.get(),verent.get(),alant.get(),tariht.get(),aciklamat.get()))
logfile.write(" -------YENİ ÜRÜN:------- "+malzemet.get()+" - "+malzeme_metint.get()+" - "
+miktart.get()+" - "+olcut.get()+" - "+verent.get()+" - "+alant.get()+" - "+tariht.get()+" - "+aciklamat.get()+"\n")
logsclose()
sorting(table2)
export2("local")
############################################################
############################################################
# Selecting product with mouse to edit it.
def selectReg():
try:
global selectedItemx
selectedItemx = table2.focus()
malzemet.delete(0,END)
malzeme_metint.delete(0,END)
miktart.delete(0,END)
olcut.delete(0,END)
verent.delete(0,END)
alant.delete(0,END)
tariht.delete(0,END)
aciklamat.delete(0,END)
malzemet.insert(0,str(table2.item(selectedItemx).get("values")[0]))
malzeme_metint.insert(0,str(table2.item(selectedItemx).get("values")[1]))
miktart.insert(0,str(table2.item(selectedItemx).get("values")[2]))
olcut.insert(0,str(table2.item(selectedItemx).get("values")[3]))
verent.insert(0,str(table2.item(selectedItemx).get("values")[4]))
alant.insert(0,str(table2.item(selectedItemx).get("values")[5]))
tariht.insert(0,str(table2.item(selectedItemx).get("values")[6]))
aciklamat.insert(0,str(table2.item(selectedItemx).get("values")[7]))
duzenlet['state'] = ACTIVE
except IndexError:
messagebox.showwarning("UYARI","Lütfen Ürün Seçin!")
############################################################
############################################################
# Editting registered product which searched by its product number.
def edit3():
logs()
logfile.write("ZİMMET LİSTESİ"+"\t"+"DÜZENLEME"+" "+str(table2.item(productR).get("values")[0])+" - "+str(table2.item(productR).get("values")[1])+" - "
+str(table2.item(productR).get("values")[2])+" - "+str(table2.item(productR).get("values")[3])+" - "+str(table2.item(productR).get("values")[4]
+" - "+str(table2.item(productR).get("values")[5])+" - "+str(table2.item(productR).get("values")[6])+" - "+str(table2.item(productR).get("values")[7])))
table2.item(productR, text="",values=(malzemeq2.get(),malzeme_metinq.get()
,miktarq.get(),olcuq.get(),verenq.get(),alanq.get(),tarihq.get(),aciklamaq.get()))
logfile.write(" -------YENİ ÜRÜN:------- "+malzemeq2.get()+" - "+malzeme_metinq.get()+" - "
+miktarq.get()+" - "+olcuq.get()+" - "+verenq.get()+" - "+alanq.get()+" - "+tarihq.get()+" - "+aciklamaq.get()+"\n")
logsclose()
sorting(table2)
export2("local")
############################################################
# Searching product by its product id.
def searchRegist():
try:
ctrl = False
global productR
productR = 0
for i in table2.get_children():
if(malzemeq.get() == str(table2.item(i).get("values")[0])):
productR = i
malzemeq['state'] = DISABLED
malzemeq2.delete(0,END)
malzeme_metinq.delete(0,END)
miktarq.delete(0,END)
olcuq.delete(0,END)
aciklamaq.delete(0,END)
verenq.delete(0,END)
alanq.delete(0,END)
tarihq.delete(0,END)
duzenleq['state'] = ACTIVE
malzemeq2.insert(0,str(table2.item(i).get("values")[0]))
malzeme_metinq.insert(0,str(table2.item(i).get("values")[1]))
miktarq.insert(0,str(table2.item(i).get("values")[2]))
olcuq.insert(0,str(table2.item(i).get("values")[3]))
aciklamaq.insert(0,str(table2.item(i).get("values")[7]))
verenq.insert(0,str(table2.item(i).get("values")[4]))
alanq.insert(0,str(table2.item(i).get("values")[5]))
tarihq.insert(0,str(table2.item(i).get("values")[6]))
ctrl = True
break
if ctrl == False:
messagebox.showwarning("UYARI","Ürün Mevcut Değil!")
except IndexError:
messagebox.showwarning("UYARI","Ürün Bulunamadı!")
except ValueError:
messagebox.showwarning("UYARI","Ürün Bulunamadı!")
############################################################
############################################################