radboy 0.0.348__py3-none-any.whl → 0.0.350__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of radboy might be problematic. Click here for more details.

radboy/DB/Prompt.py CHANGED
@@ -28,6 +28,23 @@ from Crypto.Cipher import AES
28
28
  from Crypto.Util.Padding import pad, unpad
29
29
  from decimal import Decimal
30
30
  import biip
31
+ import signal
32
+
33
+ def getExtras(entryId,extras):
34
+ if not extras:
35
+ return
36
+ with db.Session(db.ENGINE) as session:
37
+ msg=f'{Fore.light_green}-----------|{Fore.light_yellow}For EntryId: {entryId} {Fore.light_green}|-----------{Style.reset}\n'
38
+ extras_items=session.query(db.EntryDataExtras).filter(db.EntryDataExtras.EntryId==entryId).all()
39
+ extras_ct=len(extras_items)
40
+ mtext=[]
41
+ for n,e in enumerate(extras_items):
42
+ mtext.append(f"\t- {Fore.orange_red_1}{e.field_name}:{Fore.light_steel_blue}{e.field_type}={Fore.light_yellow}{e.field_value} {Fore.cyan}ede_id={e.ede_id} {Fore.light_magenta}doe={e.doe}{Style.reset}")
43
+ mtext='\n'.join(mtext)
44
+ msg+=mtext
45
+
46
+ print(msg)
47
+ return msg
31
48
 
32
49
  def getSuperTotal(results,location_fields,colormapped):
33
50
  with db.Session(db.ENGINE) as session:
@@ -790,252 +807,263 @@ class Prompt(object):
790
807
 
791
808
 
792
809
  def __init2__(self,func,ptext='do what',helpText='',data={},noHistory=False,qc=None,replace_ptext=None):
793
- lastTime=db.detectGetOrSet("PromptLastDTasFloat",datetime.now().timestamp())
794
- buffer=[]
795
810
  while True:
796
- color1=Style.bold+Fore.medium_violet_red
797
- color2=Fore.sea_green_2
798
- color3=Fore.pale_violet_red_1
799
- color4=color1
800
- split_len=int(os.get_terminal_size().columns/2)
801
- whereAmI=[str(Path.cwd())[i:i+split_len] for i in range(0, len(str(Path.cwd())), split_len)]
802
- helpText2=f'''
811
+ try:
812
+ lastTime=db.detectGetOrSet("PromptLastDTasFloat",datetime.now().timestamp())
813
+ buffer=[]
814
+ while True:
815
+ color1=Style.bold+Fore.medium_violet_red
816
+ color2=Fore.sea_green_2
817
+ color3=Fore.pale_violet_red_1
818
+ color4=color1
819
+ split_len=int(os.get_terminal_size().columns/2)
820
+ whereAmI=[str(Path.cwd())[i:i+split_len] for i in range(0, len(str(Path.cwd())), split_len)]
821
+ helpText2=f'''
803
822
  {Fore.light_salmon_3a}DT:{Fore.light_salmon_1}{datetime.now()}{Style.reset}
804
823
  {Fore.orchid}PATH:{Fore.dark_sea_green_5a}{'#'.join(whereAmI)}{Style.reset}
805
824
  {Fore.light_salmon_1}System Version: {Back.grey_70}{Style.bold}{Fore.red}{VERSION}{Style.reset}'''.replace('#','\n')
806
-
807
- default_list=''
808
- with db.Session(db.ENGINE) as session:
809
- results=session.query(db.SystemPreference).filter(db.SystemPreference.name=="DefaultLists").all()
810
- ct=len(results)
811
- n=None
812
- if ct <= 0:
813
- pass
814
- #print("no default tags")
825
+
826
+ default_list=''
827
+ with db.Session(db.ENGINE) as session:
828
+ results=session.query(db.SystemPreference).filter(db.SystemPreference.name=="DefaultLists").all()
829
+ ct=len(results)
830
+ n=None
831
+ if ct <= 0:
832
+ pass
833
+ #print("no default tags")
834
+ else:
835
+ for num,r in enumerate(results):
836
+ try:
837
+ if r.default:
838
+ default_list=','.join(json.loads(r.value_4_Json2DictString).get("DefaultLists"))
839
+ break
840
+ except Exception as e:
841
+ print(e)
842
+
843
+ #{Back.dark_orange_3b}
844
+ now=datetime.now()
845
+ nowFloat=now.timestamp()
846
+ timeInshellStart=datetime.fromtimestamp(db.detectGetOrSet("InShellStart",nowFloat))
847
+ InShellElapsed=datetime.now()-timeInshellStart
848
+ lastCmdDT=None
849
+ with db.Session(db.ENGINE) as session:
850
+ lastCMD=session.query(db.PH).order_by(db.PH.dtoe.desc()).limit(2).all()
851
+ if len(lastCMD) >= 2:
852
+ lastCmdDT=lastCMD[1].dtoe
853
+ if lastCmdDT != None:
854
+ duration=now-lastCmdDT
815
855
  else:
816
- for num,r in enumerate(results):
817
- try:
818
- if r.default:
819
- default_list=','.join(json.loads(r.value_4_Json2DictString).get("DefaultLists"))
820
- break
821
- except Exception as e:
822
- print(e)
856
+ duration=None
857
+ def lineTotal():
858
+ total=0
859
+ if not Path("STDOUT.TXT").exists():
860
+ with Path("STDOUT.TXT").open("w") as log:
861
+ log.write("")
823
862
 
824
- #{Back.dark_orange_3b}
825
- now=datetime.now()
826
- nowFloat=now.timestamp()
827
- timeInshellStart=datetime.fromtimestamp(db.detectGetOrSet("InShellStart",nowFloat))
828
- InShellElapsed=datetime.now()-timeInshellStart
829
- lastCmdDT=None
830
- with db.Session(db.ENGINE) as session:
831
- lastCMD=session.query(db.PH).order_by(db.PH.dtoe.desc()).limit(2).all()
832
- if len(lastCMD) >= 2:
833
- lastCmdDT=lastCMD[1].dtoe
834
- if lastCmdDT != None:
835
- duration=now-lastCmdDT
836
- else:
837
- duration=None
838
- def lineTotal():
839
- total=0
840
- if not Path("STDOUT.TXT").exists():
841
- with Path("STDOUT.TXT").open("w") as log:
842
- log.write("")
843
-
844
- with open(Path("STDOUT.TXT"),"r") as log:
845
- total=len(log.readlines())
846
- return total
847
-
848
- isit=now in HOLI
849
- holiname=HOLI.get(now.strftime("%m/%d/%Y"))
850
-
851
- if not holiname:
852
- holiname=f"""{Fore.orange_4b}Not a Holiday {Style.reset}"""
853
- cwd=str(Path().cwd())
854
- if callable(replace_ptext):
855
- ptext=replace_ptext()
856
- else:
857
- ptext=ptext
858
- holidate=f'{Fore.light_cyan}CWD:{cwd}\n{msg_holidate}\n{Fore.light_magenta}Holiday: {Fore.dark_goldenrod}{isit} | {Fore.light_sea_green}{holiname}{Style.reset}'
859
- m=f"{holidate}|{Fore.light_blue}DUR="+str(datetime.now()-datetime.fromtimestamp(lastTime)).split(".")[0]
860
- cmd=input(f'''{Fore.light_sea_green+((os.get_terminal_size().columns)-len(m))*'*'}
863
+ with open(Path("STDOUT.TXT"),"r") as log:
864
+ total=len(log.readlines())
865
+ return total
866
+
867
+ isit=now in HOLI
868
+ holiname=HOLI.get(now.strftime("%m/%d/%Y"))
869
+
870
+ if not holiname:
871
+ holiname=f"""{Fore.orange_4b}Not a Holiday {Style.reset}"""
872
+ cwd=str(Path().cwd())
873
+ if callable(replace_ptext):
874
+ ptext=replace_ptext()
875
+ else:
876
+ ptext=ptext
877
+ holidate=f'{Fore.light_cyan}CWD:{cwd}\n{msg_holidate}\n{Fore.light_magenta}Holiday: {Fore.dark_goldenrod}{isit} | {Fore.light_sea_green}{holiname}{Style.reset}'
878
+ m=f"{holidate}|{Fore.light_blue}DUR="+str(datetime.now()-datetime.fromtimestamp(lastTime)).split(".")[0]
879
+ cmd=input(f'''{Fore.light_sea_green+((os.get_terminal_size().columns)-len(m))*'*'}
861
880
  {Back.dark_red_1}{Fore.light_yellow}{ptext}{Style.reset}
862
881
  {Fore.light_steel_blue+os.get_terminal_size().columns*'*'}
863
882
  {m}{Fore.black}{Back.grey_70} P_CMDS SncLstCmd:{str(duration).split(".")[0]} {Style.reset}|{Fore.black}{Back.grey_50} TmInShl:{str(InShellElapsed).split(".")[0]}|DT:{now.ctime()}| {Fore.dark_blue}{Style.bold}{Style.underline}Week {datetime.now().strftime("%W")} {Style.reset}|{Fore.light_magenta}#RPLC#={Fore.tan}rplc {Fore.light_magenta}#RPLC#{Fore.tan} frm {Fore.light_red}CB{Fore.orange_3}.{Fore.light_green}default={Fore.light_yellow}True{Fore.light_steel_blue} or by {Fore.light_red}CB{Fore.orange_3}.{Fore.light_green}doe={Fore.light_yellow}Newest{Style.reset}|{Fore.light_salmon_1}c2c=calc2cmd={Fore.sky_blue_2}clctr rslt to inpt{Style.reset}|b={color2}back|{Fore.light_red}h={color3}help{color4}|{Fore.light_red}h+={color3}help+{color4}|{Fore.light_magenta}i={color3}info|{Fore.light_green}{Fore.light_steel_blue}CMD#c2cb[{Fore.light_red}e{Fore.light_steel_blue}]{Fore.light_green}{Fore.light_red}|{Fore.orange_3}c2cb[{Fore.light_red}e{Fore.orange_3}]#CMD{Fore.light_green} - copy CMD to cb and set default | Note: optional [{Fore.light_red}e{Fore.light_green}] executes after copy{Style.reset} {Fore.light_steel_blue}NTE: cmd ends/start-swith [{Fore.light_red}#clr|clr#{Fore.light_green}{Fore.light_steel_blue}] clrs crnt ln 4 a rtry{Style.reset} {Fore.orange_red_1}|c{Fore.light_steel_blue}=calc|{Fore.spring_green_3a}cb={Fore.light_blue}clipboard{Style.reset}|{Fore.light_salmon_1}cdp={Fore.green_yellow}paste cb dflt {Fore.green}|q={Fore.green_yellow}Quit Menu (qm)
864
883
  {Fore.light_red+os.get_terminal_size().columns*'.'}
865
884
  {Fore.rgb(55,191,78)}HFL:{Fore.rgb(55,130,191)}{lineTotal()}{Fore.light_red} ->{Fore.light_green}{Back.grey_15}''')
866
- db.logInput(cmd)
867
- print(f"{Fore.medium_violet_red}{os.get_terminal_size().columns*'.'}{Style.reset}",end='')
868
-
869
- def preProcess_RPLC(cmd):
870
- if '#RPLC#' in cmd:
871
- with db.Session(db.ENGINE) as session:
872
- dflt=session.query(db.ClipBoord).filter(db.ClipBoord.defaultPaste==True).order_by(db.ClipBoord.doe.desc()).first()
873
- if dflt:
874
- print(f"""{Fore.orange_red_1}using #RPLC#='{Fore.light_blue}{dflt.cbValue}{Fore.orange_red_1}'
875
- in {Fore.light_yellow}'{cmd.replace('#RPLC#',dflt.cbValue)}'{Style.reset}""")
876
- return cmd.replace('#RPLC#',dflt.cbValue)
885
+
886
+ def strip_null(text):
887
+ if '\0' in text:
888
+ return text.replace("\00","").replace("\0","")
877
889
  else:
878
- return cmd
879
- print(f"{Fore.orange_red_1}nothing to use to replace {Fore.orange_4b}#RPLC#!{Style.reset}")
880
- else:
881
- return cmd
882
- cmd=preProcess_RPLC(cmd)
883
- def shelfCodeDetected(code):
884
- try:
885
- with db.Session(db.ENGINE) as session:
886
- results=session.query(db.Entry).filter(db.Entry.Code==code).all()
887
- ct=len(results)
888
- except Exception as e:
889
- print(e)
890
- ct=0
891
- return f"{Fore.light_red}[{Fore.light_green}{Style.bold}Shelf{Style.reset}{Fore.light_green} CD FND{Fore.light_red}] {Fore.orange_red_1}{Style.underline}{code}{Style.reset} {Fore.light_green}{ct}{Fore.light_steel_blue} Found!{Style.reset}"
892
-
893
- def shelfBarcodeDetected(code):
894
- try:
895
- with db.Session(db.ENGINE) as session:
896
- results=session.query(db.Entry).filter(db.Entry.Barcode==code).all()
897
- ct=len(results)
898
- #extra_data#
899
- if len(code) in range(6,14):
900
- pc.run(db.ENGINE,CODE=code)
901
- except Exception as e:
902
- print(e)
903
- ct=0
904
- if ct > 0:
905
- return f"{Fore.light_red}[{Fore.light_green}{Style.bold}Entry{Style.reset}{Fore.light_green} BCD FND{Fore.light_red}] {Fore.orange_red_1}{Style.underline}{code}{Style.reset} {Fore.light_green}{ct}{Fore.light_steel_blue} Found!{Style.reset}"
906
- else:
907
- return ''
908
- def shelfPCCodeDetected(code):
909
- try:
910
- with db.Session(db.ENGINE) as session:
911
- results=session.query(db.PairCollection).filter(db.PairCollection.Code==code).all()
912
- ct=len(results)
913
- except Exception as e:
914
- print(e)
915
- ct=0
916
- return f"{Fore.light_red}[{Fore.light_green}{Style.bold}Shelf{Style.reset}{Fore.light_green} CD FND in PC{Fore.light_red}] {Fore.orange_red_1}{Style.underline}{code}{Style.reset} {Fore.light_green}{ct}{Fore.light_steel_blue} Found!{Style.reset}"
917
-
918
- def shelfPCBarcodeDetected(code):
919
- try:
920
- with db.Session(db.ENGINE) as session:
921
- results=session.query(db.PairCollection).filter(db.PairCollection.Barcode==code).all()
922
- ct=len(results)
923
- except Exception as e:
924
- print(e)
925
- ct=0
926
- if ct > 0:
927
- return f"{Fore.light_red}[{Fore.light_green}{Style.bold}PC{Style.reset}{Fore.light_green} BCD FND{Fore.light_red}] {Fore.orange_red_1}{Style.underline}{code}{Style.reset} {Fore.light_green}{ct}{Fore.light_steel_blue} Found!{Style.reset}"
928
- else:
929
- return ''
930
-
890
+ return text
891
+ cmd=strip_null(cmd)
931
892
 
893
+ db.logInput(cmd)
894
+ print(f"{Fore.medium_violet_red}{os.get_terminal_size().columns*'.'}{Style.reset}",end='')
895
+
932
896
 
933
- def detectShelfCode(cmd):
934
- if cmd.startswith('*') and cmd.endswith('*') and len(cmd) - 2 == 8:
935
- pattern=r"\*\d*\*"
936
- shelfPattern=re.findall(pattern,cmd)
937
- if len(shelfPattern) > 0:
938
- #extra for shelf tag code
939
- scMsg=f'{shelfCodeDetected(cmd[1:-1])}:{shelfPCCodeDetected(cmd[1:-1])}'
940
- print(scMsg)
941
- return cmd[1:-1]
942
- else:
943
- return cmd
944
- else:
945
- return cmd
946
- bcdMsg=f'{shelfPCBarcodeDetected(cmd)}:{shelfBarcodeDetected(cmd)}'
947
- print(bcdMsg)
948
-
949
- def GetAsciiOnly(cmd):
950
- hws='\x1bOP\x1bOP'
951
- #hws='OPOP'
952
- tmp=cmd
953
- stripped=''
954
- if cmd.startswith(hws):
955
- tmp=cmd[len(hws):]
956
-
957
- removed=[]
958
- for i in tmp:
959
- if i in string.printable:
960
- stripped+=i
961
- else:
897
+ def preProcess_RPLC(cmd):
898
+ if '#RPLC#' in cmd:
899
+ with db.Session(db.ENGINE) as session:
900
+ dflt=session.query(db.ClipBoord).filter(db.ClipBoord.defaultPaste==True).order_by(db.ClipBoord.doe.desc()).first()
901
+ if dflt:
902
+ print(f"""{Fore.orange_red_1}using #RPLC#='{Fore.light_blue}{dflt.cbValue}{Fore.orange_red_1}'
903
+ in {Fore.light_yellow}'{cmd.replace('#RPLC#',dflt.cbValue)}'{Style.reset}""")
904
+ return cmd.replace('#RPLC#',dflt.cbValue)
905
+ else:
906
+ return cmd
907
+ print(f"{Fore.orange_red_1}nothing to use to replace {Fore.orange_4b}#RPLC#!{Style.reset}")
908
+ else:
909
+ return cmd
910
+ cmd=preProcess_RPLC(cmd)
911
+ def shelfCodeDetected(code):
962
912
  try:
963
- print(ord(i),i)
964
- #replace i with string representing emogi
913
+ with db.Session(db.ENGINE) as session:
914
+ results=session.query(db.Entry).filter(db.Entry.Code==code).all()
915
+ ct=len(results)
965
916
  except Exception as e:
966
- pass
967
-
968
- removed.append(i)
969
-
970
-
971
- #if stripped.startswith("OPOP"):
972
- # stripped=stripped[len("OPOP"):]
973
- ex=f"stripped({[hws.encode(),]})\n"
974
- if not cmd.startswith(hws):
975
- ex=''
976
- ex1=f"stripped('{removed}')\n"
977
- if len(removed) <= 0:
978
- ex1=''
979
- try:
980
- msg=f'''{'.'*10}\n{Fore.grey_50}{Style.bold}Input Diagnostics
981
- Input Data({Fore.light_green}{cmd.encode()}{Fore.grey_50}){Style.reset}{Fore.light_salmon_1}
982
- {ex1}{ex}{Fore.light_blue}finalCmd('{stripped}')\n{'.'*10}
983
- cmd_len={len(cmd)}{Style.reset}'''
984
- except Exception as e:
985
- print(e)
986
- try:
987
- detector = chardet.universaldetector.UniversalDetector()
988
- detector.feed(cmd)
989
- detector.close()
990
- encoding=detector.result['encoding']
991
- msg=f'''{'.'*10}\n{Fore.grey_50}{Style.bold}Input Diagnostics
992
- Input Data({Fore.light_green}{bytes(cmd,encoding)}{Fore.grey_50}){Style.reset}{Fore.light_salmon_1}
993
- {ex1}{ex}{Fore.light_blue}finalCmd('{stripped}')\n{'.'*10}
994
- cmd_len={len(cmd)}{Style.reset}'''
995
- except Exception as e:
996
- msg=f'''{'.'*10}\n{Fore.grey_50}{Style.bold}Input Diagnostics
997
- Input Data({Style.underline}{Style.bold}{Back.white}#UNDISPLAYABLE INPUT - {removed}#{Style.reset}{Fore.light_green}{Fore.grey_50}){Style.reset}{Fore.light_salmon_1}
998
- {ex1}{ex}{Fore.light_blue}finalCmd('{stripped}')\n{'.'*10}
999
- cmd_len={len(cmd)}{Style.reset}'''
1000
- print(msg)
1001
- return stripped
1002
- #QR Codes with honeywell voyager 1602ug have an issue this filters it
1003
- def GetAsciiOnly2(cmd):
1004
- hws='\x1b[B'
1005
- tmp=cmd
1006
- stripped=''
1007
- if cmd.endswith(hws):
1008
- tmp=cmd[:-1*len(hws)]
1009
- return tmp
1010
- return cmd
917
+ print(e)
918
+ ct=0
919
+ return f"{Fore.light_red}[{Fore.light_green}{Style.bold}Shelf{Style.reset}{Fore.light_green} CD FND{Fore.light_red}] {Fore.orange_red_1}{Style.underline}{code}{Style.reset} {Fore.light_green}{ct}{Fore.light_steel_blue} Found!{Style.reset}"
920
+
921
+ def shelfBarcodeDetected(code):
922
+ try:
923
+ with db.Session(db.ENGINE) as session:
924
+ results=session.query(db.Entry).filter(db.Entry.Barcode==code).all()
925
+ ct=len(results)
926
+ #extra_data#
927
+ if len(code) in range(6,14):
928
+ pc.run(db.ENGINE,CODE=code)
929
+ except Exception as e:
930
+ print(e)
931
+ ct=0
932
+ if ct > 0:
933
+ return f"{Fore.light_red}[{Fore.light_green}{Style.bold}Entry{Style.reset}{Fore.light_green} BCD FND{Fore.light_red}] {Fore.orange_red_1}{Style.underline}{code}{Style.reset} {Fore.light_green}{ct}{Fore.light_steel_blue} Found!{Style.reset}"
934
+ else:
935
+ return ''
936
+ def shelfPCCodeDetected(code):
937
+ try:
938
+ with db.Session(db.ENGINE) as session:
939
+ results=session.query(db.PairCollection).filter(db.PairCollection.Code==code).all()
940
+ ct=len(results)
941
+ except Exception as e:
942
+ print(e)
943
+ ct=0
944
+ return f"{Fore.light_red}[{Fore.light_green}{Style.bold}Shelf{Style.reset}{Fore.light_green} CD FND in PC{Fore.light_red}] {Fore.orange_red_1}{Style.underline}{code}{Style.reset} {Fore.light_green}{ct}{Fore.light_steel_blue} Found!{Style.reset}"
945
+
946
+ def shelfPCBarcodeDetected(code):
947
+ try:
948
+ with db.Session(db.ENGINE) as session:
949
+ results=session.query(db.PairCollection).filter(db.PairCollection.Barcode==code).all()
950
+ ct=len(results)
951
+ except Exception as e:
952
+ print(e)
953
+ ct=0
954
+ if ct > 0:
955
+ return f"{Fore.light_red}[{Fore.light_green}{Style.bold}PC{Style.reset}{Fore.light_green} BCD FND{Fore.light_red}] {Fore.orange_red_1}{Style.underline}{code}{Style.reset} {Fore.light_green}{ct}{Fore.light_steel_blue} Found!{Style.reset}"
956
+ else:
957
+ return ''
958
+
1011
959
 
1012
- def detectGetOrSet(name,length):
1013
- with db.Session(db.ENGINE) as session:
1014
- q=session.query(db.SystemPreference).filter(db.SystemPreference.name==name).first()
1015
- value=None
1016
- if q:
960
+
961
+ def detectShelfCode(cmd):
962
+ if cmd.startswith('*') and cmd.endswith('*') and len(cmd) - 2 == 8:
963
+ pattern=r"\*\d*\*"
964
+ shelfPattern=re.findall(pattern,cmd)
965
+ if len(shelfPattern) > 0:
966
+ #extra for shelf tag code
967
+ scMsg=f'{shelfCodeDetected(cmd[1:-1])}:{shelfPCCodeDetected(cmd[1:-1])}'
968
+ print(scMsg)
969
+ return cmd[1:-1]
970
+ else:
971
+ return cmd
972
+ else:
973
+ return cmd
974
+ bcdMsg=f'{shelfPCBarcodeDetected(cmd)}:{shelfBarcodeDetected(cmd)}'
975
+ print(bcdMsg)
976
+
977
+ def GetAsciiOnly(cmd):
978
+ hws='\x1bOP\x1bOP'
979
+ #hws='OPOP'
980
+ tmp=cmd
981
+ stripped=''
982
+ if cmd.startswith(hws):
983
+ tmp=cmd[len(hws):]
984
+
985
+ removed=[]
986
+ for i in tmp:
987
+ if i in string.printable:
988
+ stripped+=i
989
+ else:
990
+ try:
991
+ print(ord(i),i)
992
+ #replace i with string representing emogi
993
+ except Exception as e:
994
+ pass
995
+
996
+ removed.append(i)
997
+
998
+
999
+ #if stripped.startswith("OPOP"):
1000
+ # stripped=stripped[len("OPOP"):]
1001
+ ex=f"stripped({[hws.encode(),]})\n"
1002
+ if not cmd.startswith(hws):
1003
+ ex=''
1004
+ ex1=f"stripped('{removed}')\n"
1005
+ if len(removed) <= 0:
1006
+ ex1=''
1017
1007
  try:
1018
- value=json.loads(q.value_4_Json2DictString)[name]
1008
+ msg=f'''{'.'*10}\n{Fore.grey_50}{Style.bold}Input Diagnostics
1009
+ Input Data({Fore.light_green}{cmd.encode()}{Fore.grey_50}){Style.reset}{Fore.light_salmon_1}
1010
+ {ex1}{ex}{Fore.light_blue}finalCmd('{stripped}')\n{'.'*10}
1011
+ cmd_len={len(cmd)}{Style.reset}'''
1019
1012
  except Exception as e:
1020
- q.value_4_Json2DictString=json.dumps({name:length})
1021
- session.commit()
1022
- session.refresh(q)
1023
- value=json.loads(q.value_4_Json2DictString)[name]
1024
- else:
1025
- q=db.SystemPreference(name=name,value_4_Json2DictString=json.dumps({name:length}))
1026
- session.add(q)
1027
- session.commit()
1028
- session.refresh(q)
1029
- value=json.loads(q.value_4_Json2DictString)[name]
1030
- return value
1013
+ print(e)
1014
+ try:
1015
+ detector = chardet.universaldetector.UniversalDetector()
1016
+ detector.feed(cmd)
1017
+ detector.close()
1018
+ encoding=detector.result['encoding']
1019
+ msg=f'''{'.'*10}\n{Fore.grey_50}{Style.bold}Input Diagnostics
1020
+ Input Data({Fore.light_green}{bytes(cmd,encoding)}{Fore.grey_50}){Style.reset}{Fore.light_salmon_1}
1021
+ {ex1}{ex}{Fore.light_blue}finalCmd('{stripped}')\n{'.'*10}
1022
+ cmd_len={len(cmd)}{Style.reset}'''
1023
+ except Exception as e:
1024
+ msg=f'''{'.'*10}\n{Fore.grey_50}{Style.bold}Input Diagnostics
1025
+ Input Data({Style.underline}{Style.bold}{Back.white}#UNDISPLAYABLE INPUT - {removed}#{Style.reset}{Fore.light_green}{Fore.grey_50}){Style.reset}{Fore.light_salmon_1}
1026
+ {ex1}{ex}{Fore.light_blue}finalCmd('{stripped}')\n{'.'*10}
1027
+ cmd_len={len(cmd)}{Style.reset}'''
1028
+ print(msg)
1029
+ return stripped
1030
+ #QR Codes with honeywell voyager 1602ug have an issue this filters it
1031
+ def GetAsciiOnly2(cmd):
1032
+ hws='\x1b[B'
1033
+ tmp=cmd
1034
+ stripped=''
1035
+ if cmd.endswith(hws):
1036
+ tmp=cmd[:-1*len(hws)]
1037
+ return tmp
1038
+ return cmd
1039
+
1040
+ def detectGetOrSet(name,length):
1041
+ with db.Session(db.ENGINE) as session:
1042
+ q=session.query(db.SystemPreference).filter(db.SystemPreference.name==name).first()
1043
+ value=None
1044
+ if q:
1045
+ try:
1046
+ value=json.loads(q.value_4_Json2DictString)[name]
1047
+ except Exception as e:
1048
+ q.value_4_Json2DictString=json.dumps({name:length})
1049
+ session.commit()
1050
+ session.refresh(q)
1051
+ value=json.loads(q.value_4_Json2DictString)[name]
1052
+ else:
1053
+ q=db.SystemPreference(name=name,value_4_Json2DictString=json.dumps({name:length}))
1054
+ session.add(q)
1055
+ session.commit()
1056
+ session.refresh(q)
1057
+ value=json.loads(q.value_4_Json2DictString)[name]
1058
+ return value
1031
1059
 
1032
- cmd=GetAsciiOnly2(cmd)
1033
- cmd=GetAsciiOnly(cmd)
1034
- scanout=Path(detectGetOrSet('CMD_TO_FILE',str(Path('./SCANNER.TXT'))))
1060
+ cmd=GetAsciiOnly2(cmd)
1061
+ cmd=GetAsciiOnly(cmd)
1062
+ scanout=Path(detectGetOrSet('CMD_TO_FILE',str(Path('./SCANNER.TXT'))))
1035
1063
 
1036
- ml_delim=str(detectGetOrSet('ML_DELIM',str(Path('#ml#'))))
1037
- if cmd.startswith(ml_delim) and not cmd.endswith(ml_delim):
1038
- msg=f'''
1064
+ ml_delim=str(detectGetOrSet('ML_DELIM',str(Path('#ml#'))))
1065
+ if cmd.startswith(ml_delim) and not cmd.endswith(ml_delim):
1066
+ msg=f'''
1039
1067
  {Fore.light_steel_blue}
1040
1068
  Generate the Barcodes for using Code128 as the Code Type
1041
1069
  {Fore.light_green}MNUSAV - saves honeywell 1602ug settings,{Fore.light_magenta}MNUABT - discards honeywell 1602ug settings,{Fore.light_green}RESET_ - reset scanner,{Fore.light_magenta}SUFBK2 - add Suffix,{Fore.light_green}SUFCA2 - Clear All Suffixes,{Fore.light_magenta}SUFCL2 - Clear One Suffix,{Fore.light_green}PREBK2 - Add Prefix,{Fore.light_magenta}PRECA2 - Clear all Prefixes,{Fore.light_green}PRECL2 - Clear One Prefix{Style.reset}
@@ -1071,26 +1099,26 @@ Suffix {ml_delim}\\n
1071
1099
  MNUSAV
1072
1100
  {Style.reset}
1073
1101
  '''
1074
- print(msg)
1075
- print(f"{Fore.orange_red_1}An Incomplete Scan Occurred, Please Finish with end of cmd followed immediately by {Fore.magenta}{ml_delim}{Style.reset}")
1076
- buffer.append(cmd)
1077
- continue
1078
- elif cmd.startswith(ml_delim) and cmd.endswith(ml_delim):
1079
- if len(buffer) > 0:
1080
- buffer.append(cmd)
1081
- #cmd=''.join(buffer).replace(ml_delim,'')
1082
- cmd='\n'.join(buffer)[len(ml_delim):-len(ml_delim)]
1083
- else:
1084
- #cmd=cmd.replace(ml_delim,'')
1085
- cmd=cmd[len(ml_delim):-len(ml_delim)]
1086
- with scanout.open("w+") as out:
1087
- out.write(cmd)
1088
- elif not cmd.startswith(ml_delim) and cmd.endswith(ml_delim):
1089
- buffer.append(cmd)
1090
- cmd='\n'.join(buffer)[len(ml_delim):-len(ml_delim)]
1091
- with scanout.open("w+") as out:
1092
- out.write(cmd)
1093
- msg=f'''
1102
+ print(msg)
1103
+ print(f"{Fore.orange_red_1}An Incomplete Scan Occurred, Please Finish with end of cmd followed immediately by {Fore.magenta}{ml_delim}{Style.reset}")
1104
+ buffer.append(cmd)
1105
+ continue
1106
+ elif cmd.startswith(ml_delim) and cmd.endswith(ml_delim):
1107
+ if len(buffer) > 0:
1108
+ buffer.append(cmd)
1109
+ #cmd=''.join(buffer).replace(ml_delim,'')
1110
+ cmd='\n'.join(buffer)[len(ml_delim):-len(ml_delim)]
1111
+ else:
1112
+ #cmd=cmd.replace(ml_delim,'')
1113
+ cmd=cmd[len(ml_delim):-len(ml_delim)]
1114
+ with scanout.open("w+") as out:
1115
+ out.write(cmd)
1116
+ elif not cmd.startswith(ml_delim) and cmd.endswith(ml_delim):
1117
+ buffer.append(cmd)
1118
+ cmd='\n'.join(buffer)[len(ml_delim):-len(ml_delim)]
1119
+ with scanout.open("w+") as out:
1120
+ out.write(cmd)
1121
+ msg=f'''
1094
1122
  {Fore.light_steel_blue}
1095
1123
  Generate the Barcodes for using Code128 as the Code Type
1096
1124
  {Fore.light_green}MNUSAV - saves honeywell 1602ug settings,{Fore.light_magenta}MNUABT - discards honeywell 1602ug settings,{Fore.light_green}RESET_ - reset scanner,{Fore.light_magenta}SUFBK2 - add Suffix,{Fore.light_green}SUFCA2 - Clear All Suffixes,{Fore.light_magenta}SUFCL2 - Clear One Suffix,{Fore.light_green}PREBK2 - Add Prefix,{Fore.light_magenta}PRECA2 - Clear all Prefixes,{Fore.light_green}PRECL2 - Clear One Prefix{Style.reset}
@@ -1126,14 +1154,14 @@ Suffix {ml_delim}\\n
1126
1154
  MNUSAV
1127
1155
  {Style.reset}
1128
1156
  '''
1129
- print(msg)
1130
- nl='\n'
1131
- debuffer=f'{nl}'.join(buffer)
1132
- print(f"{Fore.orange_red_1}An Incomplete Scan Occurred, '{Fore.light_green}{cmd}{Fore.light_yellow}' was finalized with {Fore.magenta}{ml_delim}{Fore.sky_blue_2}, as '{debuffer}'{Style.reset}")
1133
-
1134
- buffer=[]
1135
- elif not cmd.startswith(ml_delim) and not cmd.endswith(ml_delim) and len(buffer) > 0:
1136
- msg=f'''
1157
+ print(msg)
1158
+ nl='\n'
1159
+ debuffer=f'{nl}'.join(buffer)
1160
+ print(f"{Fore.orange_red_1}An Incomplete Scan Occurred, '{Fore.light_green}{cmd}{Fore.light_yellow}' was finalized with {Fore.magenta}{ml_delim}{Fore.sky_blue_2}, as '{debuffer}'{Style.reset}")
1161
+
1162
+ buffer=[]
1163
+ elif not cmd.startswith(ml_delim) and not cmd.endswith(ml_delim) and len(buffer) > 0:
1164
+ msg=f'''
1137
1165
  {Fore.light_steel_blue}
1138
1166
  Generate the Barcodes for using Code128 as the Code Type
1139
1167
  {Fore.light_green}MNUSAV - saves honeywell 1602ug settings,{Fore.light_magenta}MNUABT - discards honeywell 1602ug settings,{Fore.light_green}RESET_ - reset scanner,{Fore.light_magenta}SUFBK2 - add Suffix,{Fore.light_green}SUFCA2 - Clear All Suffixes,{Fore.light_magenta}SUFCL2 - Clear One Suffix,{Fore.light_green}PREBK2 - Add Prefix,{Fore.light_magenta}PRECA2 - Clear all Prefixes,{Fore.light_green}PRECL2 - Clear One Prefix{Style.reset}
@@ -1169,22 +1197,22 @@ Suffix {ml_delim}\\n
1169
1197
  MNUSAV
1170
1198
  {Style.reset}
1171
1199
  '''
1172
- print(msg)
1173
- print(f"""{Fore.orange_red_1}An Incomplete Scan Occurred;
1174
- type the remainder of the command to add it to the buffer,
1175
- Please Finish with end of cmd followed immediately by {Fore.magenta}{ml_delim}{Style.reset}.
1176
- CMD's are not final until ended with {Fore.magenta}{ml_delim}{Style.reset}""")
1177
- buffer.append(cmd)
1178
- print(buffer)
1179
- continue
1200
+ print(msg)
1201
+ print(f"""{Fore.orange_red_1}An Incomplete Scan Occurred;
1202
+ type the remainder of the command to add it to the buffer,
1203
+ Please Finish with end of cmd followed immediately by {Fore.magenta}{ml_delim}{Style.reset}.
1204
+ CMD's are not final until ended with {Fore.magenta}{ml_delim}{Style.reset}""")
1205
+ buffer.append(cmd)
1206
+ print(buffer)
1207
+ continue
1180
1208
 
1181
1209
 
1182
1210
 
1183
- #multiline end#
1211
+ #multiline end#
1184
1212
 
1185
- hw_delim=str(detectGetOrSet('HW_DELIM',str(Path('#hw#'))))
1186
- if cmd.startswith(hw_delim) and not cmd.endswith(hw_delim):
1187
- msg=f'''
1213
+ hw_delim=str(detectGetOrSet('HW_DELIM',str(Path('#hw#'))))
1214
+ if cmd.startswith(hw_delim) and not cmd.endswith(hw_delim):
1215
+ msg=f'''
1188
1216
  {Fore.light_steel_blue}
1189
1217
  Generate the Barcodes for using Code128 as the Code Type
1190
1218
  {Fore.light_green}MNUSAV - saves honeywell 1602ug settings,{Fore.light_magenta}MNUABT - discards honeywell 1602ug settings,{Fore.light_green}RESET_ - reset scanner,{Fore.light_magenta}SUFBK2 - add Suffix,{Fore.light_green}SUFCA2 - Clear All Suffixes,{Fore.light_magenta}SUFCL2 - Clear One Suffix,{Fore.light_green}PREBK2 - Add Prefix,{Fore.light_magenta}PRECA2 - Clear all Prefixes,{Fore.light_green}PRECL2 - Clear One Prefix{Style.reset}
@@ -1220,26 +1248,26 @@ Suffix {hw_delim}\\n
1220
1248
  MNUSAV
1221
1249
  {Style.reset}
1222
1250
  '''
1223
- print(msg)
1224
- print(f"{Fore.orange_red_1}An Incomplete Scan Occurred, Please Finish with end of cmd followed immediately by {Fore.magenta}{hw_delim}{Style.reset}")
1225
- buffer.append(cmd)
1226
- continue
1227
- elif cmd.startswith(hw_delim) and cmd.endswith(hw_delim):
1228
- if len(buffer) > 0:
1229
- buffer.append(cmd)
1230
- #cmd=''.join(buffer).replace(hw_delim,'')
1231
- cmd=''.join(buffer)[len(hw_delim):-len(hw_delim)]
1232
- else:
1233
- #cmd=cmd.replace(hw_delim,'')
1234
- cmd=cmd[len(hw_delim):-len(hw_delim)]
1235
- with scanout.open("w+") as out:
1236
- out.write(cmd)
1237
- elif not cmd.startswith(hw_delim) and cmd.endswith(hw_delim):
1238
- buffer.append(cmd)
1239
- cmd=''.join(buffer)[len(hw_delim):-len(hw_delim)]
1240
- with scanout.open("w+") as out:
1241
- out.write(cmd)
1242
- msg=f'''
1251
+ print(msg)
1252
+ print(f"{Fore.orange_red_1}An Incomplete Scan Occurred, Please Finish with end of cmd followed immediately by {Fore.magenta}{hw_delim}{Style.reset}")
1253
+ buffer.append(cmd)
1254
+ continue
1255
+ elif cmd.startswith(hw_delim) and cmd.endswith(hw_delim):
1256
+ if len(buffer) > 0:
1257
+ buffer.append(cmd)
1258
+ #cmd=''.join(buffer).replace(hw_delim,'')
1259
+ cmd=''.join(buffer)[len(hw_delim):-len(hw_delim)]
1260
+ else:
1261
+ #cmd=cmd.replace(hw_delim,'')
1262
+ cmd=cmd[len(hw_delim):-len(hw_delim)]
1263
+ with scanout.open("w+") as out:
1264
+ out.write(cmd)
1265
+ elif not cmd.startswith(hw_delim) and cmd.endswith(hw_delim):
1266
+ buffer.append(cmd)
1267
+ cmd=''.join(buffer)[len(hw_delim):-len(hw_delim)]
1268
+ with scanout.open("w+") as out:
1269
+ out.write(cmd)
1270
+ msg=f'''
1243
1271
  {Fore.light_steel_blue}
1244
1272
  Generate the Barcodes for using Code128 as the Code Type
1245
1273
  {Fore.light_green}MNUSAV - saves honeywell 1602ug settings,{Fore.light_magenta}MNUABT - discards honeywell 1602ug settings,{Fore.light_green}RESET_ - reset scanner,{Fore.light_magenta}SUFBK2 - add Suffix,{Fore.light_green}SUFCA2 - Clear All Suffixes,{Fore.light_magenta}SUFCL2 - Clear One Suffix,{Fore.light_green}PREBK2 - Add Prefix,{Fore.light_magenta}PRECA2 - Clear all Prefixes,{Fore.light_green}PRECL2 - Clear One Prefix{Style.reset}
@@ -1275,12 +1303,12 @@ Suffix {hw_delim}\\n
1275
1303
  MNUSAV
1276
1304
  {Style.reset}
1277
1305
  '''
1278
- print(msg)
1279
- print(f"{Fore.orange_red_1}An Incomplete Scan Occurred, '{Fore.light_green}{cmd}{Fore.light_yellow}' was finalized with {Fore.magenta}{hw_delim}{Fore.sky_blue_2}, as '{''.join(buffer)}'{Style.reset}")
1280
-
1281
- buffer=[]
1282
- elif not cmd.startswith(hw_delim) and not cmd.endswith(hw_delim) and len(buffer) > 0:
1283
- msg=f'''
1306
+ print(msg)
1307
+ print(f"{Fore.orange_red_1}An Incomplete Scan Occurred, '{Fore.light_green}{cmd}{Fore.light_yellow}' was finalized with {Fore.magenta}{hw_delim}{Fore.sky_blue_2}, as '{''.join(buffer)}'{Style.reset}")
1308
+
1309
+ buffer=[]
1310
+ elif not cmd.startswith(hw_delim) and not cmd.endswith(hw_delim) and len(buffer) > 0:
1311
+ msg=f'''
1284
1312
  {Fore.light_steel_blue}
1285
1313
  Generate the Barcodes for using Code128 as the Code Type
1286
1314
  {Fore.light_green}MNUSAV - saves honeywell 1602ug settings,{Fore.light_magenta}MNUABT - discards honeywell 1602ug settings,{Fore.light_green}RESET_ - reset scanner,{Fore.light_magenta}SUFBK2 - add Suffix,{Fore.light_green}SUFCA2 - Clear All Suffixes,{Fore.light_magenta}SUFCL2 - Clear One Suffix,{Fore.light_green}PREBK2 - Add Prefix,{Fore.light_magenta}PRECA2 - Clear all Prefixes,{Fore.light_green}PRECL2 - Clear One Prefix{Style.reset}
@@ -1316,494 +1344,494 @@ Suffix {hw_delim}\\n
1316
1344
  MNUSAV
1317
1345
  {Style.reset}
1318
1346
  '''
1319
- print(msg)
1320
- print(f"""{Fore.orange_red_1}An Incomplete Scan Occurred;
1321
- type the remainder of the command to add it to the buffer,
1322
- Please Finish with end of cmd followed immediately by {Fore.magenta}{hw_delim}{Style.reset}.
1323
- CMD's are not final until ended with {Fore.magenta}{hw_delim}{Style.reset}""")
1324
- buffer.append(cmd)
1325
- print(buffer)
1326
- continue
1327
- cmd=detectShelfCode(cmd)
1347
+ print(msg)
1348
+ print(f"""{Fore.orange_red_1}An Incomplete Scan Occurred;
1349
+ type the remainder of the command to add it to the buffer,
1350
+ Please Finish with end of cmd followed immediately by {Fore.magenta}{hw_delim}{Style.reset}.
1351
+ CMD's are not final until ended with {Fore.magenta}{hw_delim}{Style.reset}""")
1352
+ buffer.append(cmd)
1353
+ print(buffer)
1354
+ continue
1355
+ cmd=detectShelfCode(cmd)
1328
1356
 
1329
- #cmd=GetAsciiOnly2(cmd)
1357
+ #cmd=GetAsciiOnly2(cmd)
1330
1358
 
1331
- #cmd=GetAsciiOnly(cmd)
1359
+ #cmd=GetAsciiOnly(cmd)
1332
1360
 
1333
- def Mbool(text,data):
1334
- try:
1335
- for i in ['n','no','false','f']:
1336
- if i in text.lower():
1337
- return False
1338
- for i in ['y','yes','true','t']:
1339
- if i in text.lower():
1340
- return True
1341
- return None
1342
- except Exception as e:
1343
- return
1361
+ def Mbool(text,data):
1362
+ try:
1363
+ for i in ['n','no','false','f']:
1364
+ if i in text.lower():
1365
+ return False
1366
+ for i in ['y','yes','true','t']:
1367
+ if i in text.lower():
1368
+ return True
1369
+ return None
1370
+ except Exception as e:
1371
+ return
1344
1372
 
1345
- #PRESET_EAN13_LEN=13
1346
- PRESET_EAN13_LEN=detectGetOrSet(name='PRESET_EAN13_LEN',length=13)
1347
- if PRESET_EAN13_LEN != None and len(cmd) == PRESET_EAN13_LEN:
1348
- try:
1349
- EAN13=barcode.EAN13(cmd)
1350
- use=Prompt.__init2__(None,func=Mbool,ptext=f"{Back.dark_red_1}{Fore.white}A EAN13({cmd}) Code was Entered, use it?{Style.reset}",helpText="yes or no",data="boolean")
1351
- if use in [True,None]:
1352
- pass
1353
- elif use in [False,]:
1354
- continue
1355
- except Exception as e:
1356
- msg=f'''
1373
+ #PRESET_EAN13_LEN=13
1374
+ PRESET_EAN13_LEN=detectGetOrSet(name='PRESET_EAN13_LEN',length=13)
1375
+ if PRESET_EAN13_LEN != None and len(cmd) == PRESET_EAN13_LEN:
1376
+ try:
1377
+ EAN13=barcode.EAN13(cmd)
1378
+ use=Prompt.__init2__(None,func=Mbool,ptext=f"{Back.dark_red_1}{Fore.white}A EAN13({cmd}) Code was Entered, use it?{Style.reset}",helpText="yes or no",data="boolean")
1379
+ if use in [True,None]:
1380
+ pass
1381
+ elif use in [False,]:
1382
+ continue
1383
+ except Exception as e:
1384
+ msg=f'''
1357
1385
  {Fore.dark_red_1}{Style.bold}{str(e)}{Style.reset}
1358
1386
  {Fore.yellow}{repr(e)}{Style.reset}
1359
1387
  {Fore.light_green}Processing Will Continue...{Style.reset}
1360
- '''
1361
- print(msg)
1362
- #this will be stored in system preferences as well as an gui be made to change it
1363
- #PRESET_UPC_LEN=12
1364
- #PRESET_UPC_LEN=None
1365
- PRESET_UPC_LEN=detectGetOrSet(name='PRESET_UPC_LEN',length=12)
1366
- if PRESET_UPC_LEN != None and len(cmd) == PRESET_UPC_LEN:
1367
- try:
1368
- UPCA=barcode.UPCA(cmd)
1369
- use=Prompt.__init2__(None,func=Mbool,ptext=f"{Back.dark_red_1}{Fore.white}len({len(cmd)})-> A UPCA({cmd}) Code was Entered, use it?{Style.reset}",helpText="[y/Y]es(will ensure full UPCA-digit), or [n/N]o(will re-prompt), or [b]/back to use current text",data="boolean_basic")
1370
- if use in [True,None]:
1371
- pass
1372
- elif use in [False,]:
1373
- continue
1374
- except Exception as e:
1375
- msg=f'''
1388
+ '''
1389
+ print(msg)
1390
+ #this will be stored in system preferences as well as an gui be made to change it
1391
+ #PRESET_UPC_LEN=12
1392
+ #PRESET_UPC_LEN=None
1393
+ PRESET_UPC_LEN=detectGetOrSet(name='PRESET_UPC_LEN',length=12)
1394
+ if PRESET_UPC_LEN != None and len(cmd) == PRESET_UPC_LEN:
1395
+ try:
1396
+ UPCA=barcode.UPCA(cmd)
1397
+ use=Prompt.__init2__(None,func=Mbool,ptext=f"{Back.dark_red_1}{Fore.white}len({len(cmd)})-> A UPCA({cmd}) Code was Entered, use it?{Style.reset}",helpText="[y/Y]es(will ensure full UPCA-digit), or [n/N]o(will re-prompt), or [b]/back to use current text",data="boolean_basic")
1398
+ if use in [True,None]:
1399
+ pass
1400
+ elif use in [False,]:
1401
+ continue
1402
+ except Exception as e:
1403
+ msg=f'''
1376
1404
  {Fore.dark_red_1}{Style.bold}{str(e)}{Style.reset}
1377
1405
  {Fore.yellow}{repr(e)}{Style.reset}
1378
1406
  {Fore.light_green}Processing Will Continue...{Style.reset}
1379
- '''
1380
- print(msg)
1407
+ '''
1408
+ print(msg)
1381
1409
 
1382
- PRESET_UPCA11_LEN=detectGetOrSet(name='PRESET_UPCA11_LEN',length=11)
1383
- if PRESET_UPCA11_LEN != None and len(cmd) == PRESET_UPCA11_LEN:
1384
- try:
1385
- UPCA11=str(barcode.UPCA(cmd))
1386
- use=Prompt.__init2__(None,func=Mbool,ptext=f"{Back.dark_red_1}{Fore.white}len({len(cmd)})-> A UPCA({cmd}) Code was Entered, use it?{Style.reset}",helpText="[y/Y]es(will ensure full UPCA-digit), or [n/N]o(will re-prompt), or [b]/back to use current text",data="boolean_basic")
1387
- print(f"USED:{use}")
1388
- if use in [True,]:
1389
- cmd=UPCA11
1390
- elif use in [None,]:
1391
- pass
1392
- elif use in [False,]:
1393
- continue
1394
- except Exception as e:
1395
- msg=f'''
1410
+ PRESET_UPCA11_LEN=detectGetOrSet(name='PRESET_UPCA11_LEN',length=11)
1411
+ if PRESET_UPCA11_LEN != None and len(cmd) == PRESET_UPCA11_LEN:
1412
+ try:
1413
+ UPCA11=str(barcode.UPCA(cmd))
1414
+ use=Prompt.__init2__(None,func=Mbool,ptext=f"{Back.dark_red_1}{Fore.white}len({len(cmd)})-> A UPCA({cmd}) Code was Entered, use it?{Style.reset}",helpText="[y/Y]es(will ensure full UPCA-digit), or [n/N]o(will re-prompt), or [b]/back to use current text",data="boolean_basic")
1415
+ print(f"USED:{use}")
1416
+ if use in [True,]:
1417
+ cmd=UPCA11
1418
+ elif use in [None,]:
1419
+ pass
1420
+ elif use in [False,]:
1421
+ continue
1422
+ except Exception as e:
1423
+ msg=f'''
1396
1424
  {Fore.dark_red_1}{Style.bold}{str(e)}{Style.reset}
1397
1425
  {Fore.yellow}{repr(e)}{Style.reset}
1398
1426
  {Fore.light_green}Processing Will Continue...{Style.reset}
1399
1427
  '''
1400
- print(msg)
1401
- #PRESET_CODE_LEN=8
1402
- #PRESET_CODE_LEN=None
1403
- PRESET_CODE_LEN=detectGetOrSet(name='PRESET_CODE_LEN',length=8)
1404
- if PRESET_CODE_LEN != None and len(cmd) == PRESET_CODE_LEN:
1405
- try:
1406
- Code39=barcode.Code39(cmd,add_checksum=False)
1407
- use=Prompt.__init2__(None,func=Mbool,ptext=f"{Back.dark_red_1}{Fore.white}A Possible Code39({cmd}) Code was Entered, use it?{Style.reset}",helpText="[y/Y]es(will ensure full UPCA-digit), or [n/N]o(will re-prompt), or [b]/back to use current text",data="boolean_basic")
1408
- if use in [True,None]:
1409
- final_use=True
1410
- pass
1411
- elif use in [False,]:
1412
- continue
1413
- except Exception as e:
1414
- msg=f'''
1415
- {Fore.dark_red_1}{Style.bold}{str(e)}{Style.reset}
1416
- {Fore.yellow}{repr(e)}{Style.reset}
1417
- {Fore.light_green}Processing Will Continue...{Style.reset}
1418
- '''
1419
- print(msg)
1428
+ print(msg)
1429
+ #PRESET_CODE_LEN=8
1430
+ #PRESET_CODE_LEN=None
1431
+ PRESET_CODE_LEN=detectGetOrSet(name='PRESET_CODE_LEN',length=8)
1432
+ if PRESET_CODE_LEN != None and len(cmd) == PRESET_CODE_LEN:
1433
+ try:
1434
+ Code39=barcode.Code39(cmd,add_checksum=False)
1435
+ use=Prompt.__init2__(None,func=Mbool,ptext=f"{Back.dark_red_1}{Fore.white}A Possible Code39({cmd}) Code was Entered, use it?{Style.reset}",helpText="[y/Y]es(will ensure full UPCA-digit), or [n/N]o(will re-prompt), or [b]/back to use current text",data="boolean_basic")
1436
+ if use in [True,None]:
1437
+ final_use=True
1438
+ pass
1439
+ elif use in [False,]:
1440
+ continue
1441
+ except Exception as e:
1442
+ msg=f'''
1443
+ {Fore.dark_red_1}{Style.bold}{str(e)}{Style.reset}
1444
+ {Fore.yellow}{repr(e)}{Style.reset}
1445
+ {Fore.light_green}Processing Will Continue...{Style.reset}
1446
+ '''
1447
+ print(msg)
1420
1448
 
1421
- postFilterMsg=f"""{Style.underline}{Fore.light_yellow}Post_Filtering_Final_Cmd('{Style.bold}{Style.res_underline}{Fore.white}{db.Entry.cfmt(None,cmd)}{Style.bold}{Fore.grey_50}{Style.underline}{Style.res_bold}{Fore.light_yellow}'){Style.res_underline}|len({len(cmd)}){Style.reset}
1422
- {Fore.grey_70}**{Fore.orange_red_1}Exclude '{db.DEFAULT_SEPARATOR_CHAR}' from {db.Entry.cfmt(None,'text')} for original input({db.Entry.rebar(None,cmd,skip_sep=True)})!{Style.reset}
1423
- {Fore.grey_85}{os.get_terminal_size().columns*'.'}{Style.reset}"""
1424
- print(postFilterMsg)
1425
- #this is purely for debugging
1426
- #more will come later
1427
- ph_age=detectGetOrSet('PH_AGE',60*60*24*7)
1428
- ph_limit=detectGetOrSet('PH_MAXLINES',10000)
1429
- #ph_age=5
1430
- if not noHistory:
1431
- db.saveHistory(cmd,ph_age,executed=func,data=data)
1432
- if cmd.endswith("#clr") or cmd.startswith('clr#'):
1433
- print(f"{Fore.light_magenta}Sometimes we need to {Fore.sky_blue_2}re-think our '{Fore.light_red}{cmd}{Fore.sky_blue_2}'!{Style.reset}")
1434
- continue
1435
- elif cmd.lower() in ["ph","prompt history",]:
1436
- ph=db.HistoryUi()
1437
- if ph.cmd != None:
1438
- cmd=ph.cmd
1439
- else:
1440
- continue
1441
- elif cmd.lower() in ["aisle map",]:
1442
- settings=namedtuple('self',['amx','amn','max_sb'])
1443
- settings.amx=15
1444
- settings.amn=0
1445
- settings.max_sb=5
1446
- ad=MAP.generate_names(settings)
1447
- return func(ad,data)
1448
- elif cmd.endswith("#c2cb"):
1449
- with db.Session(db.ENGINE) as session:
1450
- ncb_text=cmd.split('#c2cb')[0]
1451
- cb=db.ClipBoord(cbValue=ncb_text,doe=datetime.now(),ageLimit=db.ClipBoordEditor.ageLimit,defaultPaste=True)
1452
- results=session.query(db.ClipBoord).filter(db.ClipBoord.defaultPaste==True).all()
1453
- ct=len(results)
1454
- if ct > 0:
1455
- for num,r in enumerate(results):
1456
- r.defaultPaste=False
1457
- if num % 100:
1458
- session.commit()
1459
- session.commit()
1460
- session.add(cb)
1461
- session.commit()
1462
- continue
1463
- elif cmd.lower() == 'colors':
1464
- protocolors()
1465
- elif cmd.lower() == 'obf msg':
1466
- Obfuscate()
1467
- elif cmd.startswith("c2cb#"):
1468
- with db.Session(db.ENGINE) as session:
1469
- ncb_text=cmd.split('c2cb#')[-1]
1470
- cb=db.ClipBoord(cbValue=ncb_text,doe=datetime.now(),ageLimit=db.ClipBoordEditor.ageLimit,defaultPaste=True)
1471
- results=session.query(db.ClipBoord).filter(db.ClipBoord.defaultPaste==True).all()
1472
- ct=len(results)
1473
- if ct > 0:
1474
- for num,r in enumerate(results):
1475
- r.defaultPaste=False
1476
- if num % 100:
1449
+ postFilterMsg=f"""{Style.underline}{Fore.light_yellow}Post_Filtering_Final_Cmd('{Style.bold}{Style.res_underline}{Fore.white}{db.Entry.cfmt(None,cmd)}{Style.bold}{Fore.grey_50}{Style.underline}{Style.res_bold}{Fore.light_yellow}'){Style.res_underline}|len({len(cmd)}){Style.reset}
1450
+ {Fore.grey_70}**{Fore.orange_red_1}Exclude '{db.DEFAULT_SEPARATOR_CHAR}' from {db.Entry.cfmt(None,'text')} for original input({db.Entry.rebar(None,cmd,skip_sep=True)})!{Style.reset}
1451
+ {Fore.grey_85}{os.get_terminal_size().columns*'.'}{Style.reset}"""
1452
+ print(postFilterMsg)
1453
+ #this is purely for debugging
1454
+ #more will come later
1455
+ ph_age=detectGetOrSet('PH_AGE',60*60*24*7)
1456
+ ph_limit=detectGetOrSet('PH_MAXLINES',10000)
1457
+ #ph_age=5
1458
+ if not noHistory:
1459
+ db.saveHistory(cmd,ph_age,executed=func,data=data)
1460
+ if cmd.endswith("#clr") or cmd.startswith('clr#'):
1461
+ print(f"{Fore.light_magenta}Sometimes we need to {Fore.sky_blue_2}re-think our '{Fore.light_red}{cmd}{Fore.sky_blue_2}'!{Style.reset}")
1462
+ continue
1463
+ elif cmd.lower() in ["ph","prompt history",]:
1464
+ ph=db.HistoryUi()
1465
+ if ph.cmd != None:
1466
+ cmd=ph.cmd
1467
+ else:
1468
+ continue
1469
+ elif cmd.lower() in ["aisle map",]:
1470
+ settings=namedtuple('self',['amx','amn','max_sb'])
1471
+ settings.amx=15
1472
+ settings.amn=0
1473
+ settings.max_sb=5
1474
+ ad=MAP.generate_names(settings)
1475
+ return func(ad,data)
1476
+ elif cmd.endswith("#c2cb"):
1477
+ with db.Session(db.ENGINE) as session:
1478
+ ncb_text=cmd.split('#c2cb')[0]
1479
+ cb=db.ClipBoord(cbValue=ncb_text,doe=datetime.now(),ageLimit=db.ClipBoordEditor.ageLimit,defaultPaste=True)
1480
+ results=session.query(db.ClipBoord).filter(db.ClipBoord.defaultPaste==True).all()
1481
+ ct=len(results)
1482
+ if ct > 0:
1483
+ for num,r in enumerate(results):
1484
+ r.defaultPaste=False
1485
+ if num % 100:
1486
+ session.commit()
1477
1487
  session.commit()
1478
- session.commit()
1479
- session.add(cb)
1480
- session.commit()
1481
- continue
1482
- if cmd.endswith("#c2cbe"):
1483
- with db.Session(db.ENGINE) as session:
1484
- ncb_text=cmd.split('#c2cbe')[0]
1485
- cb=db.ClipBoord(cbValue=ncb_text,doe=datetime.now(),ageLimit=db.ClipBoordEditor.ageLimit,defaultPaste=True)
1486
- results=session.query(db.ClipBoord).filter(db.ClipBoord.defaultPaste==True).all()
1487
- ct=len(results)
1488
- if ct > 0:
1489
- for num,r in enumerate(results):
1490
- r.defaultPaste=False
1491
- if num % 100:
1488
+ session.add(cb)
1489
+ session.commit()
1490
+ continue
1491
+ elif cmd.lower() == 'colors':
1492
+ protocolors()
1493
+ elif cmd.lower() == 'obf msg':
1494
+ Obfuscate()
1495
+ elif cmd.startswith("c2cb#"):
1496
+ with db.Session(db.ENGINE) as session:
1497
+ ncb_text=cmd.split('c2cb#')[-1]
1498
+ cb=db.ClipBoord(cbValue=ncb_text,doe=datetime.now(),ageLimit=db.ClipBoordEditor.ageLimit,defaultPaste=True)
1499
+ results=session.query(db.ClipBoord).filter(db.ClipBoord.defaultPaste==True).all()
1500
+ ct=len(results)
1501
+ if ct > 0:
1502
+ for num,r in enumerate(results):
1503
+ r.defaultPaste=False
1504
+ if num % 100:
1505
+ session.commit()
1492
1506
  session.commit()
1493
- session.commit()
1494
- session.add(cb)
1495
- session.commit()
1496
- return func(ncb_text,data)
1497
- elif cmd.startswith("c2cbe#"):
1498
- with db.Session(db.ENGINE) as session:
1499
- ncb_text=cmd.split('c2cbe#')[-1]
1500
- cb=db.ClipBoord(cbValue=ncb_text,doe=datetime.now(),ageLimit=db.ClipBoordEditor.ageLimit,defaultPaste=True)
1501
- results=session.query(db.ClipBoord).filter(db.ClipBoord.defaultPaste==True).all()
1502
- ct=len(results)
1503
- if ct > 0:
1504
- for num,r in enumerate(results):
1505
- r.defaultPaste=False
1506
- if num % 100:
1507
+ session.add(cb)
1508
+ session.commit()
1509
+ continue
1510
+ if cmd.endswith("#c2cbe"):
1511
+ with db.Session(db.ENGINE) as session:
1512
+ ncb_text=cmd.split('#c2cbe')[0]
1513
+ cb=db.ClipBoord(cbValue=ncb_text,doe=datetime.now(),ageLimit=db.ClipBoordEditor.ageLimit,defaultPaste=True)
1514
+ results=session.query(db.ClipBoord).filter(db.ClipBoord.defaultPaste==True).all()
1515
+ ct=len(results)
1516
+ if ct > 0:
1517
+ for num,r in enumerate(results):
1518
+ r.defaultPaste=False
1519
+ if num % 100:
1520
+ session.commit()
1507
1521
  session.commit()
1508
- session.commit()
1509
- session.add(cb)
1510
- session.commit()
1511
- return func(ncb_text,data)
1512
- elif cmd.lower() in ['rob','readline on boot','readline_on_boot']:
1513
- with db.Session(db.ENGINE) as session:
1514
- READLINE_PREFERECE=session.query(db.SystemPreference).filter(db.SystemPreference.name=='readline').order_by(db.SystemPreference.dtoe.desc()).all()
1515
- ct=len(READLINE_PREFERECE)
1516
- if ct <= 0:
1517
- try:
1518
- import readline
1519
- sp=SystemPreference(name="readline",value_4_Json2DictString=json.dumps({"readline":True}))
1520
- session.add(sp)
1522
+ session.add(cb)
1521
1523
  session.commit()
1522
- except Exception as e:
1523
- print("Could not import Readline, you might not have it installed!")
1524
- else:
1525
- try:
1526
- f=None
1527
- for num,i in enumerate(READLINE_PREFERECE):
1528
- if i.default == True:
1529
- f=num
1530
- break
1531
- if f == None:
1532
- f=0
1533
- cfg=READLINE_PREFERECE[f].value_4_Json2DictString
1534
- if cfg =='':
1535
- READLINE_PREFERECE[f].value_4_Json2DictString=json.dumps({"readline":True})
1536
- import readline
1524
+ return func(ncb_text,data)
1525
+ elif cmd.startswith("c2cbe#"):
1526
+ with db.Session(db.ENGINE) as session:
1527
+ ncb_text=cmd.split('c2cbe#')[-1]
1528
+ cb=db.ClipBoord(cbValue=ncb_text,doe=datetime.now(),ageLimit=db.ClipBoordEditor.ageLimit,defaultPaste=True)
1529
+ results=session.query(db.ClipBoord).filter(db.ClipBoord.defaultPaste==True).all()
1530
+ ct=len(results)
1531
+ if ct > 0:
1532
+ for num,r in enumerate(results):
1533
+ r.defaultPaste=False
1534
+ if num % 100:
1535
+ session.commit()
1537
1536
  session.commit()
1538
- session.refresh(READLINE_PREFERECE[f])
1537
+ session.add(cb)
1538
+ session.commit()
1539
+ return func(ncb_text,data)
1540
+ elif cmd.lower() in ['rob','readline on boot','readline_on_boot']:
1541
+ with db.Session(db.ENGINE) as session:
1542
+ READLINE_PREFERECE=session.query(db.SystemPreference).filter(db.SystemPreference.name=='readline').order_by(db.SystemPreference.dtoe.desc()).all()
1543
+ ct=len(READLINE_PREFERECE)
1544
+ if ct <= 0:
1545
+ try:
1546
+ import readline
1547
+ sp=SystemPreference(name="readline",value_4_Json2DictString=json.dumps({"readline":True}))
1548
+ session.add(sp)
1549
+ session.commit()
1550
+ except Exception as e:
1551
+ print("Could not import Readline, you might not have it installed!")
1539
1552
  else:
1540
1553
  try:
1541
- x=json.loads(READLINE_PREFERECE[f].value_4_Json2DictString)
1542
- if x.get("readline") in [True,False,None]:
1554
+ f=None
1555
+ for num,i in enumerate(READLINE_PREFERECE):
1556
+ if i.default == True:
1557
+ f=num
1558
+ break
1559
+ if f == None:
1560
+ f=0
1561
+ cfg=READLINE_PREFERECE[f].value_4_Json2DictString
1562
+ if cfg =='':
1563
+ READLINE_PREFERECE[f].value_4_Json2DictString=json.dumps({"readline":True})
1564
+ import readline
1565
+ session.commit()
1566
+ session.refresh(READLINE_PREFERECE[f])
1567
+ else:
1543
1568
  try:
1544
- if x.get("readline") == False:
1545
- READLINE_PREFERECE[f].value_4_Json2DictString=json.dumps({"readline":True})
1546
- session.commit()
1547
- exit("Reboot is required!")
1548
- elif x.get("readline") == True:
1549
- READLINE_PREFERECE[f].value_4_Json2DictString=json.dumps({"readline":False})
1550
- session.commit()
1551
- exit("Reboot is required!")
1569
+ x=json.loads(READLINE_PREFERECE[f].value_4_Json2DictString)
1570
+ if x.get("readline") in [True,False,None]:
1571
+ try:
1572
+ if x.get("readline") == False:
1573
+ READLINE_PREFERECE[f].value_4_Json2DictString=json.dumps({"readline":True})
1574
+ session.commit()
1575
+ exit("Reboot is required!")
1576
+ elif x.get("readline") == True:
1577
+ READLINE_PREFERECE[f].value_4_Json2DictString=json.dumps({"readline":False})
1578
+ session.commit()
1579
+ exit("Reboot is required!")
1580
+ else:
1581
+ READLINE_PREFERECE[f].value_4_Json2DictString=json.dumps({"readline":True})
1582
+ session.commit()
1583
+ exit("Reboot is required!")
1584
+ print(e)
1585
+ except Exception as e:
1586
+ print(e)
1552
1587
  else:
1553
- READLINE_PREFERECE[f].value_4_Json2DictString=json.dumps({"readline":True})
1554
- session.commit()
1555
- exit("Reboot is required!")
1556
- print(e)
1588
+ print("readline is off")
1557
1589
  except Exception as e:
1558
- print(e)
1559
- else:
1560
- print("readline is off")
1590
+ try:
1591
+ import readline
1592
+ print(e)
1593
+ except Exception as e:
1594
+ print(e)
1561
1595
  except Exception as e:
1562
- try:
1563
- import readline
1564
- print(e)
1565
- except Exception as e:
1566
- print(e)
1596
+ print(e)
1597
+ elif cmd.lower() in ['uniq-rcpt-id','uniq rcpt id','unique_reciept_id','urid','unique reciept id','unique-reciept-id']:
1598
+ try:
1599
+ urid=TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).unique_reciept_id()
1600
+ send=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Return the {Back.black}Code({db.Entry.cfmt(None,urid)}):",helpText="send the code as input",data="boolean")
1601
+ if send in [None,]:
1602
+ continue
1603
+ elif send == True:
1604
+ return func(urid,data)
1605
+ else:
1606
+ print(urid)
1607
+ continue
1567
1608
  except Exception as e:
1568
1609
  print(e)
1569
- elif cmd.lower() in ['uniq-rcpt-id','uniq rcpt id','unique_reciept_id','urid','unique reciept id','unique-reciept-id']:
1570
- try:
1571
- urid=TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).unique_reciept_id()
1572
- send=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Return the {Back.black}Code({db.Entry.cfmt(None,urid)}):",helpText="send the code as input",data="boolean")
1573
- if send in [None,]:
1574
- continue
1575
- elif send == True:
1576
- return func(urid,data)
1577
- else:
1578
- print(urid)
1579
- continue
1580
- except Exception as e:
1581
- print(e)
1582
1610
 
1583
- elif cmd.lower() in ['ic2oc','input code to output code']:
1584
- c=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Code to Convert For Use:",helpText="a code that may be used elsewhere in a different format",data="str")
1585
- if c in [None,'d']:
1586
- continue
1587
- else:
1588
- try:
1589
- codeZ=str(useInputAsCode(c))
1590
- send=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Return the {Back.black}Code({db.Entry.cfmt(None,codeZ)}):",helpText="send the code as input",data="boolean")
1591
- if send in [None,]:
1611
+ elif cmd.lower() in ['ic2oc','input code to output code']:
1612
+ c=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Code to Convert For Use:",helpText="a code that may be used elsewhere in a different format",data="str")
1613
+ if c in [None,'d']:
1592
1614
  continue
1593
- elif send == True:
1594
- return func(codeZ,data)
1595
1615
  else:
1596
- print(c)
1597
- continue
1598
- except Exception as e:
1599
- print(e)
1600
- elif cmd.lower() in ['c2c','calc2cmd']:
1601
- t=TM.Tasks.TasksMode.evaluateFormula(None,fieldname="Prompt",oneShot=True)
1602
- return func(str(t),data)
1603
- elif cmd.lower() in ['esu',]:
1604
- TM.Tasks.TasksMode.Lookup()
1605
- elif cmd.lower() in ['daylogu','dlu']:
1606
- TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).product_history()
1607
- elif cmd.lower() in ['neu',]:
1608
- TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).NewEntryMenu()
1609
- elif cmd.lower() in ['exp',]:
1610
- TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).Expiration_()
1611
- elif cmd.lower() in ['mlu',]:
1612
- TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).MasterLookup()
1613
- elif cmd.lower() in ['comm']:
1614
- CM.RxTx.RxTx()
1615
- elif cmd.lower() in ['tsu','j','journal','jrnl']:
1616
- TSC.TouchStampC.TouchStampC(parent=self,engine=db.ENGINE)
1617
- elif cmd.lower() in ['tvu','tag data']:
1618
- pc.run(engine=db.ENGINE)
1619
- elif cmd.lower() in ['c','calc']:
1620
- #if len(inspect.stack(0)) <= 6:
1621
- TM.Tasks.TasksMode.evaluateFormula(None,fieldname="Prompt")
1622
- continue
1623
- #else:
1624
- #print(f"{Fore.light_green}Since {Fore.light_yellow}You{Fore.light_green} are already using the {Fore.light_red}Calculator{Fore.light_green}, I am refusing to recurse{Fore.light_steel_blue}(){Fore.light_green}!")
1625
- elif cmd.lower() in ['q','qm','q?','quit menu','quit al la carte']:
1626
- Prompt.QuitMenu(Prompt)
1627
- elif cmd.lower() in ['cb','clipboard']:
1628
- ed=db.ClipBoordEditor(self)
1629
- continue
1630
- elif cmd.lower() in ['#b',]:
1631
- with db.Session(db.ENGINE) as session:
1632
- next_barcode=session.query(db.SystemPreference).filter(db.SystemPreference.name=='next_barcode').all()
1633
- ct=len(next_barcode)
1634
- if ct > 0:
1635
- if next_barcode[0]:
1636
- setattr(next_barcode[0],'value_4_Json2DictString',str(json.dumps({'next_barcode':True})))
1637
- session.commit()
1638
- session.refresh(next_barcode[0])
1639
- else:
1640
- next_barcode=db.SystemPreference(name="next_barcode",value_4_Json2DictString=json.dumps({'next_barcode':True}))
1641
- session.add(next_barcode)
1642
- session.commit()
1643
- session.refresh(next_barcode)
1644
- lastTime=db.detectGetOrSet("PromptLastDTasFloat",datetime.now().timestamp(),setValue=True)
1645
- return
1646
- elif cmd.lower() in ['cse','clear selected entry']:
1647
- code=Prompt.__init2__(None,func=FormBuilderMkText,ptext="what do you wish to clear?",helpText="barcode|code|name",data="string")
1648
- if code in [None,]:
1649
- continue
1650
- with Session(db.ENGINE) as session:
1651
- query=session.query(db.Entry).filter(db.Entry.InList==True,or_(db.Entry.Code.icontains(code),db.Entry.Barcode.icontains(code),db.Entry.Name.icontains(code)))
1652
- results=query.all()
1653
- ct=len(results)
1654
- if ct < 1:
1655
- print("No Results to Clear!")
1656
- continue
1657
- helpText=[]
1658
- for num,i in enumerate(results):
1659
- msg=f"{Fore.cyan}{num}/{Fore.light_yellow}{num+1} of {Fore.light_red}{ct} -> {Fore.orange_red_1}{i.seeShort()}{Style.reset}"
1660
- helpText.append(msg)
1661
- helpText='\n'.join(helpText)
1662
- print(helpText)
1663
- selected=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Which index(es):",helpText=helpText,data="list")
1664
- try:
1665
- if selected in [None,'d',[]]:
1666
- continue
1667
- for i in selected:
1668
1616
  try:
1669
- index=int(i)
1670
- obj=results[index]
1671
- update={
1672
- 'InList':False,
1673
- 'ListQty':0,
1674
- 'Shelf':0,
1675
- 'Note':'',
1676
- 'BackRoom':0,
1677
- 'Distress':0,
1678
- 'Display_1':0,
1679
- 'Display_2':0,
1680
- 'Display_3':0,
1681
- 'Display_4':0,
1682
- 'Display_5':0,
1683
- 'Display_6':0,
1684
- 'Stock_Total':0,
1685
- 'CaseID_BR':'',
1686
- 'CaseID_LD':'',
1687
- 'CaseID_6W':'',
1688
- 'SBX_WTR_DSPLY':0,
1689
- 'SBX_CHP_DSPLY':0,
1690
- 'SBX_WTR_KLR':0,
1691
- 'FLRL_CHP_DSPLY':0,
1692
- 'FLRL_WTR_DSPLY':0,
1693
- 'WD_DSPLY':0,
1694
- 'CHKSTND_SPLY':0,
1695
- }
1696
- for i in update:
1697
- setattr(obj,i,update[i])
1617
+ codeZ=str(useInputAsCode(c))
1618
+ send=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Return the {Back.black}Code({db.Entry.cfmt(None,codeZ)}):",helpText="send the code as input",data="boolean")
1619
+ if send in [None,]:
1620
+ continue
1621
+ elif send == True:
1622
+ return func(codeZ,data)
1623
+ else:
1624
+ print(c)
1625
+ continue
1626
+ except Exception as e:
1627
+ print(e)
1628
+ elif cmd.lower() in ['c2c','calc2cmd']:
1629
+ t=TM.Tasks.TasksMode.evaluateFormula(None,fieldname="Prompt",oneShot=True)
1630
+ return func(str(t),data)
1631
+ elif cmd.lower() in ['esu',]:
1632
+ TM.Tasks.TasksMode.Lookup()
1633
+ elif cmd.lower() in ['daylogu','dlu']:
1634
+ TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).product_history()
1635
+ elif cmd.lower() in ['neu',]:
1636
+ TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).NewEntryMenu()
1637
+ elif cmd.lower() in ['exp',]:
1638
+ TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).Expiration_()
1639
+ elif cmd.lower() in ['mlu',]:
1640
+ TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).MasterLookup()
1641
+ elif cmd.lower() in ['comm']:
1642
+ CM.RxTx.RxTx()
1643
+ elif cmd.lower() in ['tsu','j','journal','jrnl']:
1644
+ TSC.TouchStampC.TouchStampC(parent=self,engine=db.ENGINE)
1645
+ elif cmd.lower() in ['tvu','tag data']:
1646
+ pc.run(engine=db.ENGINE)
1647
+ elif cmd.lower() in ['c','calc']:
1648
+ #if len(inspect.stack(0)) <= 6:
1649
+ TM.Tasks.TasksMode.evaluateFormula(None,fieldname="Prompt")
1650
+ continue
1651
+ #else:
1652
+ #print(f"{Fore.light_green}Since {Fore.light_yellow}You{Fore.light_green} are already using the {Fore.light_red}Calculator{Fore.light_green}, I am refusing to recurse{Fore.light_steel_blue}(){Fore.light_green}!")
1653
+ elif cmd.lower() in ['q','qm','q?','quit menu','quit al la carte']:
1654
+ Prompt.QuitMenu(Prompt)
1655
+ elif cmd.lower() in ['cb','clipboard']:
1656
+ ed=db.ClipBoordEditor(self)
1657
+ continue
1658
+ elif cmd.lower() in ['#b',]:
1659
+ with db.Session(db.ENGINE) as session:
1660
+ next_barcode=session.query(db.SystemPreference).filter(db.SystemPreference.name=='next_barcode').all()
1661
+ ct=len(next_barcode)
1662
+ if ct > 0:
1663
+ if next_barcode[0]:
1664
+ setattr(next_barcode[0],'value_4_Json2DictString',str(json.dumps({'next_barcode':True})))
1665
+ session.commit()
1666
+ session.refresh(next_barcode[0])
1667
+ else:
1668
+ next_barcode=db.SystemPreference(name="next_barcode",value_4_Json2DictString=json.dumps({'next_barcode':True}))
1669
+ session.add(next_barcode)
1698
1670
  session.commit()
1699
- except Exception as ee:
1700
- print(ee)
1701
- except Exception as e:
1702
- print(e)
1703
- elif cmd.lower() in ['cslf','clear selected location field']:
1704
- with db.Session(db.ENGINE) as session:
1705
- cta=len(db.LOCATION_FIELDS)
1706
- helpText=[]
1707
- for num,i in enumerate(db.LOCATION_FIELDS):
1708
- msg=f"{Fore.light_steel_blue}{num}/{Fore.slate_blue_1}{num+1}{Fore.orange_red_1} of {cta} ->{Fore.light_green}{i}{Style.reset}"
1709
- helpText.append(msg)
1710
- helpText="\n".join(helpText)
1711
- while True:
1712
- try:
1671
+ session.refresh(next_barcode)
1672
+ lastTime=db.detectGetOrSet("PromptLastDTasFloat",datetime.now().timestamp(),setValue=True)
1673
+ return
1674
+ elif cmd.lower() in ['cse','clear selected entry']:
1675
+ code=Prompt.__init2__(None,func=FormBuilderMkText,ptext="what do you wish to clear?",helpText="barcode|code|name",data="string")
1676
+ if code in [None,]:
1677
+ continue
1678
+ with Session(db.ENGINE) as session:
1679
+ query=session.query(db.Entry).filter(db.Entry.InList==True,or_(db.Entry.Code.icontains(code),db.Entry.Barcode.icontains(code),db.Entry.Name.icontains(code)))
1680
+ results=query.all()
1681
+ ct=len(results)
1682
+ if ct < 1:
1683
+ print("No Results to Clear!")
1684
+ continue
1685
+ helpText=[]
1686
+ for num,i in enumerate(results):
1687
+ msg=f"{Fore.cyan}{num}/{Fore.light_yellow}{num+1} of {Fore.light_red}{ct} -> {Fore.orange_red_1}{i.seeShort()}{Style.reset}"
1688
+ helpText.append(msg)
1689
+ helpText='\n'.join(helpText)
1713
1690
  print(helpText)
1714
- selected=Prompt.__init2__(None,func=FormBuilderMkText,ptext="What Location Fields do you wish to clear only(a list if fine)?",helpText=helpText,data="list")
1715
- if selected in [None,'d']:
1716
- return
1717
- else:
1718
- upd8={}
1691
+ selected=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Which index(es):",helpText=helpText,data="list")
1692
+ try:
1693
+ if selected in [None,'d',[]]:
1694
+ continue
1719
1695
  for i in selected:
1720
1696
  try:
1721
1697
  index=int(i)
1722
- upd8[db.LOCATION_FIELDS[index]]=0
1698
+ obj=results[index]
1699
+ update={
1700
+ 'InList':False,
1701
+ 'ListQty':0,
1702
+ 'Shelf':0,
1703
+ 'Note':'',
1704
+ 'BackRoom':0,
1705
+ 'Distress':0,
1706
+ 'Display_1':0,
1707
+ 'Display_2':0,
1708
+ 'Display_3':0,
1709
+ 'Display_4':0,
1710
+ 'Display_5':0,
1711
+ 'Display_6':0,
1712
+ 'Stock_Total':0,
1713
+ 'CaseID_BR':'',
1714
+ 'CaseID_LD':'',
1715
+ 'CaseID_6W':'',
1716
+ 'SBX_WTR_DSPLY':0,
1717
+ 'SBX_CHP_DSPLY':0,
1718
+ 'SBX_WTR_KLR':0,
1719
+ 'FLRL_CHP_DSPLY':0,
1720
+ 'FLRL_WTR_DSPLY':0,
1721
+ 'WD_DSPLY':0,
1722
+ 'CHKSTND_SPLY':0,
1723
+ }
1724
+ for i in update:
1725
+ setattr(obj,i,update[i])
1726
+ session.commit()
1723
1727
  except Exception as ee:
1724
1728
  print(ee)
1725
- session.query(db.Entry).update(upd8)
1726
- session.commit()
1727
- break
1728
- except Exception as e:
1729
- print(e)
1730
- elif cmd.lower() in ['mksl','make shopping list','p-slq','prompt slq','set list qty','slqp','slq-p']:
1731
- TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).setFieldInList("ListQty",load=True,only_select_qty=True)
1732
- elif cmd.lower() in ['pc','prec calc',]:
1733
- resultant=TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).prec_calc()
1734
- return func(resultant,data)
1735
- elif cmd.lower() in ['b','back']:
1736
- lastTime=db.detectGetOrSet("PromptLastDTasFloat",datetime.now().timestamp(),setValue=True)
1737
- return
1738
- elif cmd.lower() in ['h','help']:
1739
- extra=f'''{Fore.orange_red_1}Dimension Fields {Fore.light_steel_blue}are fields that tell how much space the product is going to take up using the the product itself as the unit of measure
1740
- {Fore.orange_red_1}Location Fields{Fore.light_steel_blue} are fields where the item resides at, will reside at, is coming from etc...
1741
- {Fore.orange_red_1}Count Fields{Fore.light_steel_blue} are fields that define max values that relate to how much goes to the shelf,comes via the Load, how much comes in a Pallet, or Case{Style.reset}
1742
-
1743
- {Fore.orange_red_1}{Style.underline}Prompt Level CMDS(Access from anywhere But {Fore.light_red}Root){Style.reset}
1744
- {Fore.light_yellow}Don't Use {Fore.grey_70}**{Style.reset}
1745
- {Fore.grey_70}**{Fore.light_green}sft{Fore.light_red}u{Fore.light_steel_blue} - search for text across whole DB and return it as input{Style.reset}
1746
- {Fore.grey_70}**{Fore.light_green}ne{Fore.light_red}u{Fore.light_steel_blue} - create a new entry menu{Style.reset}
1747
- {Fore.grey_70}**{Fore.light_green}bld{Fore.light_red}ls{Fore.light_steel_blue} - list all items with InList==True and has a location value above {Fore.light_red}0{Style.reset}
1748
- {Fore.grey_70}**{Fore.light_green}s{Fore.light_red}bld{Fore.light_steel_blue} - search with barcode in all items with InList==True and has a location value above {Fore.light_red}0{Style.reset}
1749
- {Fore.grey_70}**{Fore.light_green}"bldlse","builde","buildlse","build list export ","bld ls exp",'elsbld','export list build','exp ls bld','ebld'{Fore.light_steel_blue} - same as versions without export, but dumps list to {Path(Prompt.bld_file).absolute()}{Style.reset}
1750
- {Fore.grey_70}**{Fore.light_green}'esbld','export search build','export_search_build','exp scan build','exp_scan_bld'{Fore.light_steel_blue} - same as versions without export, but dumps list to {Path(Prompt.bld_file).absolute()}{Style.reset}
1751
- {Fore.orange_red_1}**{Fore.grey_50}Add a {Fore.light_magenta}-{Fore.grey_50} to the end of each cmd to include negatives, but ignore '0' and 'None' if spaces are included then put a space before the last -, elsewise put a it immediately behind the cmd to to enable this feature{Style.reset}
1752
- {Fore.grey_70}**{Fore.light_green}es{Fore.light_red}u{Fore.light_steel_blue} - search entry menu{Style.reset}
1753
- {Fore.grey_70}**{Fore.light_green}tv{Fore.light_red}u{Fore.light_steel_blue} - show tag data info{Style.reset}
1754
- {Fore.grey_70}**{Fore.light_green}ca{Fore.light_red}u{Fore.light_steel_blue} - clear all lists{Style.reset}
1755
- {Fore.grey_70}**{Fore.light_green}dl{Fore.light_red}u{Fore.light_green},daylog{Fore.light_red}u{Fore.light_steel_blue} - Entry History System{Style.reset}
1756
- {Fore.grey_70}**{Fore.light_green}mlu{Fore.light_steel_blue} - master lookup search for something in {SEARCH_TABLES}{Style.reset}
1757
- {Fore.grey_70}**{Fore.light_green}exp{Fore.light_steel_blue} - product expiration menu{Style.reset}
1758
- {Fore.grey_70}**{Fore.light_green}comm{Fore.light_steel_blue} - send an email message with gmail{Style.reset}
1759
- {Fore.grey_70}**{Fore.light_sea_green}'crbc',"checked random barcode"{Fore.light_yellow}- generate a random, but non-local-system existant barcode for input{Style.reset}
1760
- {Fore.grey_70}**{Fore.light_sea_green}'bcd-gen','bcd-img'{Fore.light_yellow}- generate a custom barcode img from input data possible output is selected from {barcode.PROVIDED_BARCODES}{Style.reset}
1761
- {Fore.grey_70}**{Fore.light_sea_green}'qr-gen','qr-img'{Fore.light_yellow}- generate a custom barcode img from input data possible output is selected{Style.reset}
1762
- {Fore.grey_70}**{Fore.light_red}u{Fore.light_steel_blue} is for {Fore.light_red}Universally{Fore.light_steel_blue} accessible where this menu is{Style.reset}
1763
- {Fore.grey_70}**{Style.bold}{Fore.spring_green_3a}ts{Fore.light_red}u{Fore.spring_green_3a},j,journal,jrnl{Style.reset} -{Fore.light_steel_blue} Access TouchScan Journal from this prompt{Style.reset}
1764
- {Fore.grey_70}**{Fore.light_red}The Current CMD type/scanned is written to {Fore.light_yellow}{scanout}{Fore.light_red}, so if you are stuck without traditional keyboard output, you can still utilize the Text file as a ClipBoard{Style.reset}
1765
- {Fore.grey_70}**{Fore.light_steel_blue}obf msg {Fore.spring_green_3a}encrypted msgs via {db.detectGetOrSet("OBFUSCATED MSG FILE",value="MSG.txt",setValue=False,literal=True)} and Prompt Input{Style.reset}
1766
- {Fore.grey_70}**{Fore.light_salmon_1}Start a line with {Fore.cyan}#ml#{Fore.light_salmon_1} followed by text, where {Fore.light_red}<ENTER>/<RETURN>{Fore.light_salmon_1} will allow for additional lines of input until you end the multi-line input with {Fore.cyan}#ml#{Style.reset}
1767
- {Fore.light_sea_green}Code=="UNASSIGNED_TO_NEW_ITEM" --> {Fore.light_steel_blue} `neu;set field;#select indexes for Code,Name,Price,CaseCount from prompt; type "UNASSIGNED_TO_NEW_ITEM" and hit <ENTER>/<RETURN>;#follow the prompts to fill the Entry Data for those Fields`{Style.reset}
1768
- {Fore.grey_70}**{Fore.light_green}'upcify','format upc','fupc'{Fore.light_steel_blue} Format input text to look '{db.Entry.rebar(None,"TESTTEXTUPCA")}{Style.reset}'
1769
- {Fore.grey_70}**{Fore.light_green}'codify','format code','fcode'{Fore.light_steel_blue} Format input text to look '{db.Entry.cfmt(None,"TESTTEXT")}{Style.reset}'
1770
- {Fore.grey_70}**{Fore.light_green}'upcify str','upcify.str','upcify-str','format upc str','fupcs'{Fore.light_steel_blue} Format input text to look and use formatted text as input-text'{db.Entry.rebar(None,"TESTTEXTUPCA")}{Style.reset}'
1771
- {Fore.grey_70}**{Fore.light_green}'codify str','codify.str','codify-str','format code str','fcodes'{Fore.light_steel_blue} Format input text to look and use formatted text as input-text'{db.Entry.cfmt(None,"TESTTEXT")}{Style.reset}'
1772
- {Fore.grey_70}**{Fore.light_green}'quick price','qprc','price'{Fore.light_steel_blue} Calculate price information using user provided data for an arbitrary product who Data is not in the Entry table{Style.reset}
1773
- {Fore.grey_70}**{Fore.light_green}'mksl','make shopping list','p-slq','prompt slq','set list qty','slqp','slq-p'{Fore.light_steel_blue} make a list using {Fore.green_3a}slq{Fore.light_steel_blue} from {Fore.orange_red_1}Tasks.{Fore.light_red}TasksMode{Style.reset}
1774
- {Fore.grey_70}**{Fore.light_green}'ic2oc','input code to output code'{Fore.light_steel_blue} Convert an input code to its neighboring format for view or input use{Style.reset}
1775
- {Fore.grey_70}**{Fore.light_green}'uniq-rcpt-id','uniq rcpt id','unique_reciept_id','urid','unique reciept id','unique-reciept-id'{Fore.light_steel_blue} Generate Relavent Receipt Id to be searchable in DayLogger{Style.reset}
1776
- {Fore.grey_70}**{Fore.light_green}'cslf','clear selected location field'{Fore.light_steel_blue} set Entry's with selected field's to Zero, but do not do change InList==False{Style.reset}
1777
- {Fore.grey_70}**{Fore.light_green}'cse','clear selected entry'{Fore.light_steel_blue} clear selected entry{Style.reset}
1778
- {Fore.grey_70}**{Fore.light_green}'fmbh','formbuilder help','form helptext'{Fore.light_steel_blue} print formbuilder helptext{Style.reset}
1779
- {Fore.grey_70}**{Fore.light_green}'text2file'{Fore.light_steel_blue} dump input/returned text to file{Style.reset}
1780
- {Fore.grey_70}**{Fore.light_green}'qc','quick change','q-c','q.c'{Fore.light_steel_blue} use the quick change menu {Fore.orange_red_1}if available{Style.reset}
1781
- '''
1782
- print(extra)
1783
- print(helpText)
1784
- continue
1785
- elif cmd.lower() in ['txt2fl','text2file','here2there','hr2thr']:
1786
- outfile=Path(db.detectGetOrSet('text2file','TextOut.txt',setValue=False,literal=True))
1787
- with open(outfile,'w') as x:
1788
- otext=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f'Text to Dump to {outfile}',helpText='saveable text',data="string")
1789
- if otext in [None,'d','']:
1790
- print("nothing was saved!")
1791
- x.write(otext)
1792
- elif cmd.lower() in ['known','known devices','known dev','knwn dev']:
1793
- disp=KNOWN_DEVICES
1794
- disp.append('')
1795
- disp=list(reversed(disp))
1796
- dText='\n\t- '.join(disp)
1797
-
1798
- kscan_disp=KNOWN_SCANNERS
1799
- kscan_disp.append('')
1800
- kscan_disp=list(reversed(kscan_disp))
1801
- kscan='\n\t- '.join(kscan_disp)
1802
- try:
1803
- hline='.'*os.get_terminal_size().columns
1804
- except Exception as e:
1805
- hline=20
1806
- msg=f"""
1729
+ except Exception as e:
1730
+ print(e)
1731
+ elif cmd.lower() in ['cslf','clear selected location field']:
1732
+ with db.Session(db.ENGINE) as session:
1733
+ cta=len(db.LOCATION_FIELDS)
1734
+ helpText=[]
1735
+ for num,i in enumerate(db.LOCATION_FIELDS):
1736
+ msg=f"{Fore.light_steel_blue}{num}/{Fore.slate_blue_1}{num+1}{Fore.orange_red_1} of {cta} ->{Fore.light_green}{i}{Style.reset}"
1737
+ helpText.append(msg)
1738
+ helpText="\n".join(helpText)
1739
+ while True:
1740
+ try:
1741
+ print(helpText)
1742
+ selected=Prompt.__init2__(None,func=FormBuilderMkText,ptext="What Location Fields do you wish to clear only(a list if fine)?",helpText=helpText,data="list")
1743
+ if selected in [None,'d']:
1744
+ return
1745
+ else:
1746
+ upd8={}
1747
+ for i in selected:
1748
+ try:
1749
+ index=int(i)
1750
+ upd8[db.LOCATION_FIELDS[index]]=0
1751
+ except Exception as ee:
1752
+ print(ee)
1753
+ session.query(db.Entry).update(upd8)
1754
+ session.commit()
1755
+ break
1756
+ except Exception as e:
1757
+ print(e)
1758
+ elif cmd.lower() in ['mksl','make shopping list','p-slq','prompt slq','set list qty','slqp','slq-p']:
1759
+ TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).setFieldInList("ListQty",load=True,only_select_qty=True)
1760
+ elif cmd.lower() in ['pc','prec calc',]:
1761
+ resultant=TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).prec_calc()
1762
+ return func(resultant,data)
1763
+ elif cmd.lower() in ['b','back']:
1764
+ lastTime=db.detectGetOrSet("PromptLastDTasFloat",datetime.now().timestamp(),setValue=True)
1765
+ return
1766
+ elif cmd.lower() in ['h','help']:
1767
+ extra=f'''{Fore.orange_red_1}Dimension Fields {Fore.light_steel_blue}are fields that tell how much space the product is going to take up using the the product itself as the unit of measure
1768
+ {Fore.orange_red_1}Location Fields{Fore.light_steel_blue} are fields where the item resides at, will reside at, is coming from etc...
1769
+ {Fore.orange_red_1}Count Fields{Fore.light_steel_blue} are fields that define max values that relate to how much goes to the shelf,comes via the Load, how much comes in a Pallet, or Case{Style.reset}
1770
+
1771
+ {Fore.orange_red_1}{Style.underline}Prompt Level CMDS(Access from anywhere But {Fore.light_red}Root){Style.reset}
1772
+ {Fore.light_yellow}Don't Use {Fore.grey_70}**{Style.reset}
1773
+ {Fore.grey_70}**{Fore.light_green}sft{Fore.light_red}u{Fore.light_steel_blue} - search for text across whole DB and return it as input{Style.reset}
1774
+ {Fore.grey_70}**{Fore.light_green}ne{Fore.light_red}u{Fore.light_steel_blue} - create a new entry menu{Style.reset}
1775
+ {Fore.grey_70}**{Fore.light_green}bld{Fore.light_red}ls{Fore.light_steel_blue} - list all items with InList==True and has a location value above {Fore.light_red}0{Style.reset}
1776
+ {Fore.grey_70}**{Fore.light_green}s{Fore.light_red}bld{Fore.light_steel_blue} - search with barcode in all items with InList==True and has a location value above {Fore.light_red}0{Style.reset}
1777
+ {Fore.grey_70}**{Fore.light_green}"bldlse","builde","buildlse","build list export ","bld ls exp",'elsbld','export list build','exp ls bld','ebld'{Fore.light_steel_blue} - same as versions without export, but dumps list to {Path(Prompt.bld_file).absolute()}{Style.reset}
1778
+ {Fore.grey_70}**{Fore.light_green}'esbld','export search build','export_search_build','exp scan build','exp_scan_bld'{Fore.light_steel_blue} - same as versions without export, but dumps list to {Path(Prompt.bld_file).absolute()}{Style.reset}
1779
+ {Fore.orange_red_1}**{Fore.grey_50}Add a {Fore.light_magenta}-{Fore.grey_50} to the end of each cmd to include negatives, but ignore '0' and 'None' if spaces are included then put a space before the last -, elsewise put a it immediately behind the cmd to to enable this feature{Style.reset}
1780
+ {Fore.grey_70}**{Fore.light_green}es{Fore.light_red}u{Fore.light_steel_blue} - search entry menu{Style.reset}
1781
+ {Fore.grey_70}**{Fore.light_green}tv{Fore.light_red}u{Fore.light_steel_blue} - show tag data info{Style.reset}
1782
+ {Fore.grey_70}**{Fore.light_green}ca{Fore.light_red}u{Fore.light_steel_blue} - clear all lists{Style.reset}
1783
+ {Fore.grey_70}**{Fore.light_green}dl{Fore.light_red}u{Fore.light_green},daylog{Fore.light_red}u{Fore.light_steel_blue} - Entry History System{Style.reset}
1784
+ {Fore.grey_70}**{Fore.light_green}mlu{Fore.light_steel_blue} - master lookup search for something in {SEARCH_TABLES}{Style.reset}
1785
+ {Fore.grey_70}**{Fore.light_green}exp{Fore.light_steel_blue} - product expiration menu{Style.reset}
1786
+ {Fore.grey_70}**{Fore.light_green}comm{Fore.light_steel_blue} - send an email message with gmail{Style.reset}
1787
+ {Fore.grey_70}**{Fore.light_sea_green}'crbc',"checked random barcode"{Fore.light_yellow}- generate a random, but non-local-system existant barcode for input{Style.reset}
1788
+ {Fore.grey_70}**{Fore.light_sea_green}'bcd-gen','bcd-img'{Fore.light_yellow}- generate a custom barcode img from input data possible output is selected from {barcode.PROVIDED_BARCODES}{Style.reset}
1789
+ {Fore.grey_70}**{Fore.light_sea_green}'qr-gen','qr-img'{Fore.light_yellow}- generate a custom barcode img from input data possible output is selected{Style.reset}
1790
+ {Fore.grey_70}**{Fore.light_red}u{Fore.light_steel_blue} is for {Fore.light_red}Universally{Fore.light_steel_blue} accessible where this menu is{Style.reset}
1791
+ {Fore.grey_70}**{Style.bold}{Fore.spring_green_3a}ts{Fore.light_red}u{Fore.spring_green_3a},j,journal,jrnl{Style.reset} -{Fore.light_steel_blue} Access TouchScan Journal from this prompt{Style.reset}
1792
+ {Fore.grey_70}**{Fore.light_red}The Current CMD type/scanned is written to {Fore.light_yellow}{scanout}{Fore.light_red}, so if you are stuck without traditional keyboard output, you can still utilize the Text file as a ClipBoard{Style.reset}
1793
+ {Fore.grey_70}**{Fore.light_steel_blue}obf msg {Fore.spring_green_3a}encrypted msgs via {db.detectGetOrSet("OBFUSCATED MSG FILE",value="MSG.txt",setValue=False,literal=True)} and Prompt Input{Style.reset}
1794
+ {Fore.grey_70}**{Fore.light_salmon_1}Start a line with {Fore.cyan}#ml#{Fore.light_salmon_1} followed by text, where {Fore.light_red}<ENTER>/<RETURN>{Fore.light_salmon_1} will allow for additional lines of input until you end the multi-line input with {Fore.cyan}#ml#{Style.reset}
1795
+ {Fore.light_sea_green}Code=="UNASSIGNED_TO_NEW_ITEM" --> {Fore.light_steel_blue} `neu;set field;#select indexes for Code,Name,Price,CaseCount from prompt; type "UNASSIGNED_TO_NEW_ITEM" and hit <ENTER>/<RETURN>;#follow the prompts to fill the Entry Data for those Fields`{Style.reset}
1796
+ {Fore.grey_70}**{Fore.light_green}'upcify','format upc','fupc'{Fore.light_steel_blue} Format input text to look '{db.Entry.rebar(None,"TESTTEXTUPCA")}{Style.reset}'
1797
+ {Fore.grey_70}**{Fore.light_green}'codify','format code','fcode'{Fore.light_steel_blue} Format input text to look '{db.Entry.cfmt(None,"TESTTEXT")}{Style.reset}'
1798
+ {Fore.grey_70}**{Fore.light_green}'upcify str','upcify.str','upcify-str','format upc str','fupcs'{Fore.light_steel_blue} Format input text to look and use formatted text as input-text'{db.Entry.rebar(None,"TESTTEXTUPCA")}{Style.reset}'
1799
+ {Fore.grey_70}**{Fore.light_green}'codify str','codify.str','codify-str','format code str','fcodes'{Fore.light_steel_blue} Format input text to look and use formatted text as input-text'{db.Entry.cfmt(None,"TESTTEXT")}{Style.reset}'
1800
+ {Fore.grey_70}**{Fore.light_green}'quick price','qprc','price'{Fore.light_steel_blue} Calculate price information using user provided data for an arbitrary product who Data is not in the Entry table{Style.reset}
1801
+ {Fore.grey_70}**{Fore.light_green}'mksl','make shopping list','p-slq','prompt slq','set list qty','slqp','slq-p'{Fore.light_steel_blue} make a list using {Fore.green_3a}slq{Fore.light_steel_blue} from {Fore.orange_red_1}Tasks.{Fore.light_red}TasksMode{Style.reset}
1802
+ {Fore.grey_70}**{Fore.light_green}'ic2oc','input code to output code'{Fore.light_steel_blue} Convert an input code to its neighboring format for view or input use{Style.reset}
1803
+ {Fore.grey_70}**{Fore.light_green}'uniq-rcpt-id','uniq rcpt id','unique_reciept_id','urid','unique reciept id','unique-reciept-id'{Fore.light_steel_blue} Generate Relavent Receipt Id to be searchable in DayLogger{Style.reset}
1804
+ {Fore.grey_70}**{Fore.light_green}'cslf','clear selected location field'{Fore.light_steel_blue} set Entry's with selected field's to Zero, but do not do change InList==False{Style.reset}
1805
+ {Fore.grey_70}**{Fore.light_green}'cse','clear selected entry'{Fore.light_steel_blue} clear selected entry{Style.reset}
1806
+ {Fore.grey_70}**{Fore.light_green}'fmbh','formbuilder help','form helptext'{Fore.light_steel_blue} print formbuilder helptext{Style.reset}
1807
+ {Fore.grey_70}**{Fore.light_green}'text2file'{Fore.light_steel_blue} dump input/returned text to file{Style.reset}
1808
+ {Fore.grey_70}**{Fore.light_green}'qc','quick change','q-c','q.c'{Fore.light_steel_blue} use the quick change menu {Fore.orange_red_1}if available{Style.reset}
1809
+ '''
1810
+ print(extra)
1811
+ print(helpText)
1812
+ continue
1813
+ elif cmd.lower() in ['txt2fl','text2file','here2there','hr2thr']:
1814
+ outfile=Path(db.detectGetOrSet('text2file','TextOut.txt',setValue=False,literal=True))
1815
+ with open(outfile,'w') as x:
1816
+ otext=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f'Text to Dump to {outfile}',helpText='saveable text',data="string")
1817
+ if otext in [None,'d','']:
1818
+ print("nothing was saved!")
1819
+ x.write(otext)
1820
+ elif cmd.lower() in ['known','known devices','known dev','knwn dev']:
1821
+ disp=KNOWN_DEVICES
1822
+ disp.append('')
1823
+ disp=list(reversed(disp))
1824
+ dText='\n\t- '.join(disp)
1825
+
1826
+ kscan_disp=KNOWN_SCANNERS
1827
+ kscan_disp.append('')
1828
+ kscan_disp=list(reversed(kscan_disp))
1829
+ kscan='\n\t- '.join(kscan_disp)
1830
+ try:
1831
+ hline='.'*os.get_terminal_size().columns
1832
+ except Exception as e:
1833
+ hline=20
1834
+ msg=f"""
1807
1835
  {Fore.medium_purple_3b}Known Cellar Devices that can use this Software{Style.reset}
1808
1836
  {Fore.medium_purple_3b}{hline}{Style.reset}
1809
1837
  {Fore.medium_violet_red}{dText}{Style.reset}
@@ -1823,91 +1851,91 @@ checksum{Style.reset}
1823
1851
  with '{Fore.cyan}{hw_delim}{Fore.dark_sea_green_5a}', like '{Fore.cyan}{hw_delim}{Fore.dark_sea_green_5a}ls Shelf{Fore.cyan}{hw_delim}{Fore.dark_sea_green_5a}'
1824
1852
  you can spread your command over several returns/newlines,
1825
1853
  which will result in a cmd of 'ls Shelf'{Style.reset}
1826
- """
1827
- print(msg)
1828
- elif cmd in ['qc','quick change','q-c','q.c']:
1829
- if callable(qc):
1830
- print(f"{Fore.light_steel_blue}Quick Change Callable has been executed!{Style.reset}")
1831
- qc()
1832
- else:
1833
- print(f"{Fore.orange_red_1}No Quick Change Callable has been set! {Fore.light_green}This Does nothing{Style.reset}")
1834
- continue
1835
- elif cmd in ['upcify','format upc','fupc']:
1836
- def mkT(text,data):
1837
- return text
1838
- code=Prompt.__init2__(None,func=mkT,ptext="Text/Data: ",helpText=f"Format input text to look '{db.Entry.rebar(None,'TESTTEXTUPCA')}'",data='')
1839
- if code in [None,]:
1840
- end=True
1841
- break
1842
- elif code in ['d',]:
1843
- continue
1844
- resultant=db.Entry.rebar(None,code)
1845
- print(resultant)
1846
- elif cmd in ['clear all universion',"cau","clear_all_universal"]:
1847
- TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).clear_all()
1848
- elif cmd in ['codify','format code','fcode']:
1849
- def mkT(text,data):
1850
- return text
1851
- code=Prompt.__init2__(None,func=mkT,ptext="Text/Data: ",helpText=f"Format input text to look '{db.Entry.cfmt(None,'TESTTEXT')}'",data='')
1852
- if code in [None,]:
1853
- end=True
1854
- break
1855
- elif code in ['d',]:
1856
- continue
1857
- resultant=db.Entry.cfmt(None,code)
1858
- print(resultant)
1859
- elif cmd in ['upcify str','upcify.str','upcify-str','format upc str','fupcs']:
1860
- def mkT(text,data):
1861
- return text
1862
- code=Prompt.__init2__(None,func=mkT,ptext="Text/Data: ",helpText=f"Format input text to look '{db.Entry.rebar(None,'TESTTEXTUPCA')}'",data='')
1863
- if code in [None,]:
1864
- end=True
1865
- break
1866
- elif code in ['d',]:
1867
- continue
1868
- resultant=db.Entry.rebar(None,code)
1869
- print(resultant)
1870
- return func(resultant,data)
1871
- elif cmd.lower() in ['fmbh','formbuilder help','form helptext']:
1872
- FormBuilderHelpText()
1873
- continue
1874
- elif cmd in ['codify str','codify.str','codify-str','format code str','fcodes']:
1875
- def mkT(text,data):
1876
- return text
1877
- code=Prompt.__init2__(None,func=mkT,ptext="Text/Data: ",helpText=f"Format input text to look '{db.Entry.cfmt(None,'TESTTEXT')}'",data='')
1878
- if code in [None,]:
1879
- end=True
1880
- break
1881
- elif code in ['d',]:
1882
- continue
1883
- resultant=db.Entry.cfmt(None,code)
1884
- print(resultant)
1885
- return func(resultant,data)
1886
- elif cmd.lower() in ['bcd-gen','bcd-img']:
1887
- TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).bcd_img()
1888
- elif cmd.lower() in ['qr-gen','qr-img']:
1889
- TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).qr_img()
1890
- elif cmd.lower() in ['crbc',"checked random barcode"]:
1891
- with db.Session(db.ENGINE) as session:
1892
- while True:
1893
- try:
1894
- code=''.join([str(random.randint(0,9)) for i in ' '*11])
1895
- UPCAcode=barcode.UPCA(code)
1896
- check=session.query(db.Entry).filter(or_(db.Entry.Barcode==str(UPCAcode),db.Entry.Barcode.icontains(str(UPCAcode)))).first()
1897
- if check != None:
1898
- continue
1899
- print(UPCAcode)
1900
- return func(str(UPCAcode),data)
1901
- except Exception as e:
1902
- print(e)
1903
- elif cmd.lower() in ['h+','help+']:
1904
- print(f'''{Fore.grey_50}If a Number in a formula is like '1*12345678*1', use '1*12345678.0*1' to get around regex for '*' values; {Fore.grey_70}{Style.bold}If An Issue Arises!{Style.reset}
1854
+ """
1855
+ print(msg)
1856
+ elif cmd in ['qc','quick change','q-c','q.c']:
1857
+ if callable(qc):
1858
+ print(f"{Fore.light_steel_blue}Quick Change Callable has been executed!{Style.reset}")
1859
+ qc()
1860
+ else:
1861
+ print(f"{Fore.orange_red_1}No Quick Change Callable has been set! {Fore.light_green}This Does nothing{Style.reset}")
1862
+ continue
1863
+ elif cmd in ['upcify','format upc','fupc']:
1864
+ def mkT(text,data):
1865
+ return text
1866
+ code=Prompt.__init2__(None,func=mkT,ptext="Text/Data: ",helpText=f"Format input text to look '{db.Entry.rebar(None,'TESTTEXTUPCA')}'",data='')
1867
+ if code in [None,]:
1868
+ end=True
1869
+ break
1870
+ elif code in ['d',]:
1871
+ continue
1872
+ resultant=db.Entry.rebar(None,code)
1873
+ print(resultant)
1874
+ elif cmd in ['clear all universion',"cau","clear_all_universal"]:
1875
+ TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).clear_all()
1876
+ elif cmd in ['codify','format code','fcode']:
1877
+ def mkT(text,data):
1878
+ return text
1879
+ code=Prompt.__init2__(None,func=mkT,ptext="Text/Data: ",helpText=f"Format input text to look '{db.Entry.cfmt(None,'TESTTEXT')}'",data='')
1880
+ if code in [None,]:
1881
+ end=True
1882
+ break
1883
+ elif code in ['d',]:
1884
+ continue
1885
+ resultant=db.Entry.cfmt(None,code)
1886
+ print(resultant)
1887
+ elif cmd in ['upcify str','upcify.str','upcify-str','format upc str','fupcs']:
1888
+ def mkT(text,data):
1889
+ return text
1890
+ code=Prompt.__init2__(None,func=mkT,ptext="Text/Data: ",helpText=f"Format input text to look '{db.Entry.rebar(None,'TESTTEXTUPCA')}'",data='')
1891
+ if code in [None,]:
1892
+ end=True
1893
+ break
1894
+ elif code in ['d',]:
1895
+ continue
1896
+ resultant=db.Entry.rebar(None,code)
1897
+ print(resultant)
1898
+ return func(resultant,data)
1899
+ elif cmd.lower() in ['fmbh','formbuilder help','form helptext']:
1900
+ FormBuilderHelpText()
1901
+ continue
1902
+ elif cmd in ['codify str','codify.str','codify-str','format code str','fcodes']:
1903
+ def mkT(text,data):
1904
+ return text
1905
+ code=Prompt.__init2__(None,func=mkT,ptext="Text/Data: ",helpText=f"Format input text to look '{db.Entry.cfmt(None,'TESTTEXT')}'",data='')
1906
+ if code in [None,]:
1907
+ end=True
1908
+ break
1909
+ elif code in ['d',]:
1910
+ continue
1911
+ resultant=db.Entry.cfmt(None,code)
1912
+ print(resultant)
1913
+ return func(resultant,data)
1914
+ elif cmd.lower() in ['bcd-gen','bcd-img']:
1915
+ TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).bcd_img()
1916
+ elif cmd.lower() in ['qr-gen','qr-img']:
1917
+ TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).qr_img()
1918
+ elif cmd.lower() in ['crbc',"checked random barcode"]:
1919
+ with db.Session(db.ENGINE) as session:
1920
+ while True:
1921
+ try:
1922
+ code=''.join([str(random.randint(0,9)) for i in ' '*11])
1923
+ UPCAcode=barcode.UPCA(code)
1924
+ check=session.query(db.Entry).filter(or_(db.Entry.Barcode==str(UPCAcode),db.Entry.Barcode.icontains(str(UPCAcode)))).first()
1925
+ if check != None:
1926
+ continue
1927
+ print(UPCAcode)
1928
+ return func(str(UPCAcode),data)
1929
+ except Exception as e:
1930
+ print(e)
1931
+ elif cmd.lower() in ['h+','help+']:
1932
+ print(f'''{Fore.grey_50}If a Number in a formula is like '1*12345678*1', use '1*12345678.0*1' to get around regex for '*' values; {Fore.grey_70}{Style.bold}If An Issue Arises!{Style.reset}
1905
1933
  {Fore.grey_50}This is due to the {Fore.light_green}Start/{Fore.light_red}Stop{Fore.grey_50} Characters for Code39 ({Fore.grey_70}*{Fore.grey_50}) being filtered with {Fore.light_yellow}Regex
1906
1934
  {Fore.light_magenta}rob=turn readline on/off at start
1907
1935
  {Fore.light_steel_blue}if 'b' returns to previous menu, try '#b' to return to barcode input, in ListMode@$LOCATION_FIELD, 'e' does the same{Style.reset}''')
1908
- continue
1909
- elif cmd.lower() in ['i','info']:
1910
- msg_fmbtxt=f"""Prompt's where FormBuilderMkText is used keywords like
1936
+ continue
1937
+ elif cmd.lower() in ['i','info']:
1938
+ msg_fmbtxt=f"""Prompt's where FormBuilderMkText is used keywords like
1911
1939
  today = today
1912
1940
  tomorrow = today+24h
1913
1941
  yesterday = today-24h
@@ -1918,976 +1946,1012 @@ last week = today-7d
1918
1946
  last year = today-365d
1919
1947
  last month = today-30d
1920
1948
  """
1921
- print(msg_fmbtxt)
1922
- l=Path("Holidays.txt")
1923
- if not l.exists():
1924
- l=Path(__file__).parent.parent/Path("Holidays.txt")
1925
- print(l)
1926
- with open(l,"r") as msgr:
1927
- for num,line in enumerate(msgr.readlines()):
1928
- if num % 2 == 0:
1929
- color=Fore.light_yellow
1930
- else:
1931
- color=Fore.sea_green_2
1932
-
1933
- msg=f"""{Fore.magenta}Line {Fore.cyan}{num}/{Fore.light_steel_blue}{num+1} - {color}{line}{Style.reset}"""
1934
- print(msg)
1935
- print(f"{Fore.orange_red_1}You can override the default Holidays.txt by placing a file called 'Holidays.txt' in your current pwd{Style.reset}")
1936
- print(f"{Fore.light_cyan}Running on Android:{Fore.slate_blue_1}{db.onAndroid()}{Style.reset}")
1937
- print(f"{Fore.light_cyan}Running on {Fore.slate_blue_1}{platform.system()} {Fore.light_cyan}Rel:{Fore.orange_red_1}{platform.release()}{Style.reset}")
1938
- print(helpText2)
1939
- Prompt.passwordfile(None,)
1940
- print(Prompt.resrc(Prompt))
1941
- sales_tax_msg=f'''
1949
+ print(msg_fmbtxt)
1950
+ l=Path("Holidays.txt")
1951
+ if not l.exists():
1952
+ l=Path(__file__).parent.parent/Path("Holidays.txt")
1953
+ print(l)
1954
+ with open(l,"r") as msgr:
1955
+ for num,line in enumerate(msgr.readlines()):
1956
+ if num % 2 == 0:
1957
+ color=Fore.light_yellow
1958
+ else:
1959
+ color=Fore.sea_green_2
1960
+
1961
+ msg=f"""{Fore.magenta}Line {Fore.cyan}{num}/{Fore.light_steel_blue}{num+1} - {color}{line}{Style.reset}"""
1962
+ print(msg)
1963
+ print(f"{Fore.orange_red_1}You can override the default Holidays.txt by placing a file called 'Holidays.txt' in your current pwd{Style.reset}")
1964
+ print(f"{Fore.light_cyan}Running on Android:{Fore.slate_blue_1}{db.onAndroid()}{Style.reset}")
1965
+ print(f"{Fore.light_cyan}Running on {Fore.slate_blue_1}{platform.system()} {Fore.light_cyan}Rel:{Fore.orange_red_1}{platform.release()}{Style.reset}")
1966
+ print(helpText2)
1967
+ Prompt.passwordfile(None,)
1968
+ print(Prompt.resrc(Prompt))
1969
+ sales_tax_msg=f'''
1942
1970
  {Fore.light_green}{Style.underline}Tax Formulas{Style.reset}
1943
1971
  {Fore.light_blue}Price is what is stated on the reciept or shelf tag without {Fore.light_red}Tax{Fore.cyan} and CRV applied.{Style.reset}
1944
1972
  {Fore.cyan}CRV is for beverages, where under 24 Fluid Ounces, the CRV is {Fore.light_cyan}$0.05{Fore.cyan} and above 24 Fluid ounces is {Fore.light_cyan}$0.10,{Fore.light_steel_blue}if multiple bottles are in a single purchased case, then the CRV is applied to each contained within the sold/purchased case{Style.reset}
1945
1973
  {Fore.cyan}CRV={Fore.light_cyan}({Fore.light_green}CRV_4_SIZE*{Fore.green_yellow}QTY_OF_cONTAINERS_IN_CASE{Fore.light_cyan}){Style.reset}
1946
1974
  {Fore.light_red}Total=(({Fore.cyan}CRV+{Fore.light_blue}Price)*{Fore.light_magenta}(Sales Tax Rate(0.0925)))+{Fore.light_blue}Price{Style.reset}
1947
1975
  {Fore.light_red}Tax=(({Fore.cyan}CRV+{Fore.light_blue}Price)*{Fore.light_magenta}(Sales Tax Rate(0.0925))){Style.reset}
1948
- '''
1949
- print(sales_tax_msg)
1950
- continue
1951
- elif cmd.lower() in ['sftu','search for text universal',]:
1952
- result=global_search_for_text()
1953
- return func(result,data)
1954
- elif cmd.lower() in ["bldls","build","buildls","build list","bld ls",'lsbld','list build','ls bld','bld']:
1955
- with db.Session(db.ENGINE) as session:
1956
- results_query=session.query(db.Entry).filter(db.Entry.InList==True)
1957
- location_fields=["Shelf","BackRoom","Display_1","Display_2","Display_3","Display_4","Display_5","Display_6","ListQty","SBX_WTR_DSPLY","SBX_CHP_DSPLY","SBX_WTR_KLR","FLRL_CHP_DSPLY","FLRL_WTR_DSPLY","WD_DSPLY","CHKSTND_SPLY","Distress"]
1958
- z=Prompt.mkfield_list(None,location_fields)
1959
- if z in [[],None]:
1960
- z=location_fields
1961
- location_fields=z
1962
- tmp=[]
1963
- for f in location_fields:
1964
- tmp.append(or_(getattr(db.Entry,f)>=0.0001))
1965
- results_query=results_query.filter(or_(*tmp))
1966
- results=results_query.all()
1967
- ct=len(results)
1968
- if ct < 1:
1969
- print(f"{Fore.light_steel_blue}Nothing in {Fore.slate_blue_1}Bld{Fore.light_red}LS!{Style.reset}")
1976
+ '''
1977
+ print(sales_tax_msg)
1970
1978
  continue
1971
- ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",3,setValue=False,literal=True))
1972
- master_total=0
1973
- master_total_crv=0
1974
- master_total_tax=0
1975
- master_total_tax_crv=0
1976
-
1977
- for num,i in enumerate(results):
1978
- msg=f'{"*"*os.get_terminal_size().columns}\n{Fore.light_green}{num}{Fore.light_magenta}/{Fore.orange_3}{num+1} of {Fore.light_red}{ct}[{Fore.dark_slate_gray_1}EID{Fore.orange_3}]{Fore.dark_violet_1b}{i.EntryId}{Style.reset} |-| {Fore.light_yellow}{i.Name}|{Fore.light_salmon_1}[{Fore.light_red}BCD]{i.rebar()}{Fore.medium_violet_red}|[{Fore.light_red}CD{Fore.medium_violet_red}]{i.cfmt(i.Code)} {Style.reset}|-| '
1979
- colormapped=[
1980
- Fore.deep_sky_blue_4c,
1981
- Fore.spring_green_4,
1982
- Fore.turquoise_4,
1983
- Fore.dark_cyan,
1984
- Fore.deep_sky_blue_2,
1985
- Fore.spring_green_2a,
1986
- Fore.medium_spring_green,
1987
- Fore.steel_blue,
1988
- Fore.cadet_blue_1,
1989
- Fore.aquamarine_3,
1990
- Fore.purple_1a,
1991
- Fore.medium_purple_3a,
1992
- Fore.slate_blue_1,
1993
- Fore.light_slate_grey,
1994
- Fore.dark_olive_green_3a,
1995
- Fore.deep_pink_4c,
1996
- Fore.orange_3,
1997
- ]
1998
- total=0
1999
- crv=0
2000
- tax=0
2001
- tax_crv=0
2002
- i.Tax=round(i.Tax,ROUNDTO)
2003
- i.CRV=round(i.CRV,ROUNDTO)
2004
- i.Price=round(i.Price,ROUNDTO)
2005
- session.commit()
2006
- for n2,f in enumerate(location_fields):
2007
- try:
2008
- if getattr(i,f) > 0:
2009
- total+=getattr(i,f)
2010
- except Exception as e:
2011
- print(e)
2012
- for n2,f in enumerate(location_fields):
2013
- if getattr(i,f) > 0:
2014
- msg2=f'{colormapped[n2]}{f} = {round(getattr(i,f),ROUNDTO)}{Style.reset}'
2015
- if n2 < len(location_fields):
2016
- msg2+=","
2017
- msg+=msg2
2018
- master_total+=total*round(i.Price,ROUNDTO)
2019
-
2020
- crv+=(round(i.CRV,ROUNDTO)*total)
2021
- tax+=(round(i.Tax,ROUNDTO)*total)
2022
- if tax == 0 and crv > 0:
2023
- tax_crv=(round(i.CRV,ROUNDTO)*total)
2024
- else:
2025
- tax_crv+=((round(i.Tax,ROUNDTO)*total)+(round(i.CRV,ROUNDTO)*total))
2026
- master_total_tax+=tax
2027
- master_total_crv+=crv
2028
- master_total_tax_crv+=tax_crv
2029
- tax_crv=round(tax_crv,ROUNDTO)
2030
- try:
2031
- super_total=(round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)/getSuperTotal(results,location_fields,colormapped)['final total'],ROUNDTO))*100
2032
- except Exception as e:
2033
- p1=round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO))
2034
- p2=getSuperTotal(results,location_fields,colormapped)['final total']
2035
- print(e)
2036
- print(p1,"p1")
2037
- print(p2,"p2")
2038
- super_total=0
2039
-
2040
- msg+=f"""{Fore.light_magenta} |-|{Fore.light_green} Total = {Fore.light_sea_green}{round(total,ROUNDTO)}
1979
+ elif cmd.lower() in ['sftu','search for text universal',]:
1980
+ result=global_search_for_text()
1981
+ return func(result,data)
1982
+ elif cmd.lower() in ["bldls","build","buildls","build list","bld ls",'lsbld','list build','ls bld','bld']:
1983
+ extras=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Show Extras?",helpText="extra data attached to each entry yes or no",data="boolean")
1984
+ if extras in [None,'d',False]:
1985
+ extras=False
1986
+
1987
+ with db.Session(db.ENGINE) as session:
1988
+ results_query=session.query(db.Entry).filter(db.Entry.InList==True)
1989
+ location_fields=["Shelf","BackRoom","Display_1","Display_2","Display_3","Display_4","Display_5","Display_6","ListQty","SBX_WTR_DSPLY","SBX_CHP_DSPLY","SBX_WTR_KLR","FLRL_CHP_DSPLY","FLRL_WTR_DSPLY","WD_DSPLY","CHKSTND_SPLY","Distress"]
1990
+ z=Prompt.mkfield_list(None,location_fields)
1991
+ if z in [[],None]:
1992
+ z=location_fields
1993
+ location_fields=z
1994
+ tmp=[]
1995
+ for f in location_fields:
1996
+ tmp.append(or_(getattr(db.Entry,f)>=0.0001))
1997
+ results_query=results_query.filter(or_(*tmp))
1998
+ results=results_query.all()
1999
+ ct=len(results)
2000
+ if ct < 1:
2001
+ print(f"{Fore.light_steel_blue}Nothing in {Fore.slate_blue_1}Bld{Fore.light_red}LS!{Style.reset}")
2002
+ continue
2003
+ ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",3,setValue=False,literal=True))
2004
+ master_total=0
2005
+ master_total_crv=0
2006
+ master_total_tax=0
2007
+ master_total_tax_crv=0
2008
+
2009
+ for num,i in enumerate(results):
2010
+ getExtras(i.EntryId,extras)
2011
+ msg=f'{"*"*os.get_terminal_size().columns}\n{Fore.light_green}{num}{Fore.light_magenta}/{Fore.orange_3}{num+1} of {Fore.light_red}{ct}[{Fore.dark_slate_gray_1}EID{Fore.orange_3}]{Fore.dark_violet_1b}{i.EntryId}{Style.reset} |-| {Fore.light_yellow}{i.Name}|{Fore.light_salmon_1}[{Fore.light_red}BCD]{i.rebar()}{Fore.medium_violet_red}|[{Fore.light_red}CD{Fore.medium_violet_red}]{i.cfmt(i.Code)} {Style.reset}|-| '
2012
+ colormapped=[
2013
+ Fore.deep_sky_blue_4c,
2014
+ Fore.spring_green_4,
2015
+ Fore.turquoise_4,
2016
+ Fore.dark_cyan,
2017
+ Fore.deep_sky_blue_2,
2018
+ Fore.spring_green_2a,
2019
+ Fore.medium_spring_green,
2020
+ Fore.steel_blue,
2021
+ Fore.cadet_blue_1,
2022
+ Fore.aquamarine_3,
2023
+ Fore.purple_1a,
2024
+ Fore.medium_purple_3a,
2025
+ Fore.slate_blue_1,
2026
+ Fore.light_slate_grey,
2027
+ Fore.dark_olive_green_3a,
2028
+ Fore.deep_pink_4c,
2029
+ Fore.orange_3,
2030
+ ]
2031
+ total=0
2032
+ crv=0
2033
+ tax=0
2034
+ tax_crv=0
2035
+ i.Tax=round(i.Tax,ROUNDTO)
2036
+ i.CRV=round(i.CRV,ROUNDTO)
2037
+ i.Price=round(i.Price,ROUNDTO)
2038
+ session.commit()
2039
+ for n2,f in enumerate(location_fields):
2040
+ try:
2041
+ if getattr(i,f) > 0:
2042
+ total+=getattr(i,f)
2043
+ except Exception as e:
2044
+ print(e)
2045
+ for n2,f in enumerate(location_fields):
2046
+ if getattr(i,f) > 0:
2047
+ msg2=f'{colormapped[n2]}{f} = {round(getattr(i,f),ROUNDTO)}{Style.reset}'
2048
+ if n2 < len(location_fields):
2049
+ msg2+=","
2050
+ msg+=msg2
2051
+ master_total+=total*round(i.Price,ROUNDTO)
2052
+
2053
+ crv+=(round(i.CRV,ROUNDTO)*total)
2054
+ tax+=(round(i.Tax,ROUNDTO)*total)
2055
+ if tax == 0 and crv > 0:
2056
+ tax_crv=(round(i.CRV,ROUNDTO)*total)
2057
+ else:
2058
+ tax_crv+=((round(i.Tax,ROUNDTO)*total)+(round(i.CRV,ROUNDTO)*total))
2059
+ master_total_tax+=tax
2060
+ master_total_crv+=crv
2061
+ master_total_tax_crv+=tax_crv
2062
+ tax_crv=round(tax_crv,ROUNDTO)
2063
+ try:
2064
+ super_total=(round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)/getSuperTotal(results,location_fields,colormapped)['final total'],ROUNDTO))*100
2065
+ except Exception as e:
2066
+ p1=round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO))
2067
+ p2=getSuperTotal(results,location_fields,colormapped)['final total']
2068
+ print(e)
2069
+ print(p1,"p1")
2070
+ print(p2,"p2")
2071
+ super_total=0
2072
+
2073
+ msg+=f"""{Fore.light_magenta} |-|{Fore.light_green} Total = {Fore.light_sea_green}{round(total,ROUNDTO)}
2041
2074
  {Fore.light_magenta}Price({i.Price}){Fore.medium_violet_red}*{Fore.light_slate_blue}Total({round(total,ROUNDTO)}):{round(i.Price*total,ROUNDTO)}
2042
2075
  {Fore.grey_70}+CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TotalCRV({crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+crv,ROUNDTO)})
2043
2076
  {Fore.grey_70}+Tax({i.Tax}) w/o CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxNoCRVTotal({tax})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax,ROUNDTO)})
2044
2077
  {Fore.grey_70}+Tax({i.Tax}) w/ CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxCRVTotal({tax_crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)})
2045
2078
  {Fore.medium_violet_red}PercentOfTotal({round(super_total,ROUNDTO)}) of Total({getSuperTotal(results,location_fields,colormapped)['final total']})
2046
2079
  {'*'*os.get_terminal_size().columns}{Style.reset}"""
2047
- print(msg)
2048
- master_total=round(master_total,ROUNDTO)
2049
- master_total_crv=round(master_total_crv,ROUNDTO)
2050
- master_total_tax=round(master_total_tax,ROUNDTO)
2051
- master_total_tax_crv=round(master_total_tax_crv,ROUNDTO)
2052
- msg=f"""{Fore.light_green}Total Product Value:{Fore.slate_blue_1}{round(master_total,ROUNDTO)}
2080
+ print(msg)
2081
+ master_total=round(master_total,ROUNDTO)
2082
+ master_total_crv=round(master_total_crv,ROUNDTO)
2083
+ master_total_tax=round(master_total_tax,ROUNDTO)
2084
+ master_total_tax_crv=round(master_total_tax_crv,ROUNDTO)
2085
+ msg=f"""{Fore.light_green}Total Product Value:{Fore.slate_blue_1}{round(master_total,ROUNDTO)}
2053
2086
  {Fore.light_green}Total Product Value w/CRV({master_total_crv}):{Fore.slate_blue_1}{round(master_total_crv+master_total,ROUNDTO)}
2054
2087
  {Fore.light_green}Total Product Value Taxed w/o CRV({master_total_tax}):{Fore.slate_blue_1}{round(master_total_tax+master_total,ROUNDTO)}
2055
2088
  {Fore.light_green}Total Product Value Taxed w/ CRV({master_total_tax_crv}):{Fore.slate_blue_1}{round(master_total_tax_crv+master_total,ROUNDTO)}
2056
- {Style.reset}"""
2057
- print(msg)
2058
- elif cmd.lower() in ['quick price','qprc','price']:
2059
- t=TM.Tasks.TasksMode.pricing(None)
2060
- if t is not None:
2061
- return func(str(t),data)
2062
- elif cmd.lower() in ["bldlse","builde","buildlse","build list export ","bld ls exp",'elsbld','export list build','exp ls bld','ebld']:
2063
- msg=''
2064
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file,clear_only=True)
2065
- with db.Session(db.ENGINE) as session:
2066
- results_query=session.query(db.Entry).filter(db.Entry.InList==True)
2067
- location_fields=["Shelf","BackRoom","Display_1","Display_2","Display_3","Display_4","Display_5","Display_6","ListQty","SBX_WTR_DSPLY","SBX_CHP_DSPLY","SBX_WTR_KLR","FLRL_CHP_DSPLY","FLRL_WTR_DSPLY","WD_DSPLY","CHKSTND_SPLY","Distress"]
2068
- z=Prompt.mkfield_list(None,location_fields)
2069
- if z in [[],None]:
2070
- z=location_fields
2071
- location_fields=z
2072
- tmp=[]
2073
- for f in location_fields:
2074
- tmp.append(or_(getattr(db.Entry,f)>=0.0001))
2075
- results_query=results_query.filter(or_(*tmp))
2076
- results=results_query.all()
2077
- ct=len(results)
2078
- if ct < 1:
2079
- msg=f"{Fore.light_steel_blue}Nothing in {Fore.slate_blue_1}Bld{Fore.light_red}LS!{Style.reset}"
2080
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2081
- print(msg)
2082
- continue
2083
- #start
2084
- ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",3,setValue=False,literal=True))
2085
- master_total=0
2086
- master_total_crv=0
2087
- master_total_tax=0
2088
- master_total_tax_crv=0
2089
-
2090
- for num,i in enumerate(results):
2091
- msg=f'{"*"*os.get_terminal_size().columns}\n{Fore.light_green}{num}{Fore.light_magenta}/{Fore.orange_3}{num+1} of {Fore.light_red}{ct}[{Fore.dark_slate_gray_1}EID{Fore.orange_3}]{Fore.dark_violet_1b}{i.EntryId}{Style.reset} |-| {Fore.light_yellow}{i.Name}|{Fore.light_salmon_1}[{Fore.light_red}BCD]{i.rebar()}{Fore.medium_violet_red}|[{Fore.light_red}CD{Fore.medium_violet_red}]{i.cfmt(i.Code)} {Style.reset}|-| '
2092
- colormapped=[
2093
- Fore.deep_sky_blue_4c,
2094
- Fore.spring_green_4,
2095
- Fore.turquoise_4,
2096
- Fore.dark_cyan,
2097
- Fore.deep_sky_blue_2,
2098
- Fore.spring_green_2a,
2099
- Fore.medium_spring_green,
2100
- Fore.steel_blue,
2101
- Fore.cadet_blue_1,
2102
- Fore.aquamarine_3,
2103
- Fore.purple_1a,
2104
- Fore.medium_purple_3a,
2105
- Fore.slate_blue_1,
2106
- Fore.light_slate_grey,
2107
- Fore.dark_olive_green_3a,
2108
- Fore.deep_pink_4c,
2109
- Fore.orange_3,
2110
- ]
2111
- total=0
2112
- crv=0
2113
- tax=0
2114
- tax_crv=0
2115
- i.Tax=round(i.Tax,ROUNDTO)
2116
- i.CRV=round(i.CRV,ROUNDTO)
2117
- i.Price=round(i.Price,ROUNDTO)
2118
- session.commit()
2119
- for n2,f in enumerate(location_fields):
2120
- try:
2121
- if getattr(i,f) > 0:
2122
- total+=getattr(i,f)
2123
- except Exception as e:
2124
- print(e)
2125
- for n2,f in enumerate(location_fields):
2126
- if getattr(i,f) > 0:
2127
- msg2=f'{colormapped[n2]}{f} = {round(getattr(i,f),ROUNDTO)}{Style.reset}'
2128
- if n2 < len(location_fields):
2129
- msg2+=","
2130
- msg+=msg2
2131
- master_total+=total*round(i.Price,ROUNDTO)
2132
-
2133
- crv+=(round(i.CRV,ROUNDTO)*total)
2134
- tax+=(round(i.Tax,ROUNDTO)*total)
2135
- if tax == 0 and crv > 0:
2136
- tax_crv=(round(i.CRV,ROUNDTO)*total)
2137
- else:
2138
- tax_crv+=((round(i.Tax,ROUNDTO)*total)+(round(i.CRV,ROUNDTO)*total))
2139
- master_total_tax+=tax
2140
- master_total_crv+=crv
2141
- master_total_tax_crv+=tax_crv
2142
- tax_crv=round(tax_crv,ROUNDTO)
2143
- try:
2144
- super_total=(round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)/getSuperTotal(results,location_fields,colormapped)['final total'],ROUNDTO))*100
2145
- except Exception as e:
2146
- p1=round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO))
2147
- p2=getSuperTotal(results,location_fields,colormapped)['final total']
2148
- print(e)
2149
- print(p1,"p1")
2150
- print(p2,"p2")
2151
- super_total=0
2152
- msg+=f"""{Fore.light_magenta} |-|{Fore.light_green} Total = {Fore.light_sea_green}{round(total,ROUNDTO)}
2089
+ {Style.reset}"""
2090
+ print(msg)
2091
+ elif cmd.lower() in ['quick price','qprc','price']:
2092
+ t=TM.Tasks.TasksMode.pricing(None)
2093
+ if t is not None:
2094
+ return func(str(t),data)
2095
+ elif cmd.lower() in ["bldlse","builde","buildlse","build list export ","bld ls exp",'elsbld','export list build','exp ls bld','ebld']:
2096
+ extras=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Show Extras?",helpText="extra data attached to each entry yes or no",data="boolean")
2097
+ if extras in [None,'d',False]:
2098
+ extras=False
2099
+ msg=''
2100
+ db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file,clear_only=True)
2101
+ with db.Session(db.ENGINE) as session:
2102
+ results_query=session.query(db.Entry).filter(db.Entry.InList==True)
2103
+ location_fields=["Shelf","BackRoom","Display_1","Display_2","Display_3","Display_4","Display_5","Display_6","ListQty","SBX_WTR_DSPLY","SBX_CHP_DSPLY","SBX_WTR_KLR","FLRL_CHP_DSPLY","FLRL_WTR_DSPLY","WD_DSPLY","CHKSTND_SPLY","Distress"]
2104
+ z=Prompt.mkfield_list(None,location_fields)
2105
+ if z in [[],None]:
2106
+ z=location_fields
2107
+ location_fields=z
2108
+ tmp=[]
2109
+ for f in location_fields:
2110
+ tmp.append(or_(getattr(db.Entry,f)>=0.0001))
2111
+ results_query=results_query.filter(or_(*tmp))
2112
+ results=results_query.all()
2113
+ ct=len(results)
2114
+ if ct < 1:
2115
+ msg=f"{Fore.light_steel_blue}Nothing in {Fore.slate_blue_1}Bld{Fore.light_red}LS!{Style.reset}"
2116
+ db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2117
+ print(msg)
2118
+ continue
2119
+ #start
2120
+ ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",3,setValue=False,literal=True))
2121
+ master_total=0
2122
+ master_total_crv=0
2123
+ master_total_tax=0
2124
+ master_total_tax_crv=0
2125
+
2126
+ for num,i in enumerate(results):
2127
+ getExtras(i.EntryId,extras)
2128
+ msg=f'{"*"*os.get_terminal_size().columns}\n{Fore.light_green}{num}{Fore.light_magenta}/{Fore.orange_3}{num+1} of {Fore.light_red}{ct}[{Fore.dark_slate_gray_1}EID{Fore.orange_3}]{Fore.dark_violet_1b}{i.EntryId}{Style.reset} |-| {Fore.light_yellow}{i.Name}|{Fore.light_salmon_1}[{Fore.light_red}BCD]{i.rebar()}{Fore.medium_violet_red}|[{Fore.light_red}CD{Fore.medium_violet_red}]{i.cfmt(i.Code)} {Style.reset}|-| '
2129
+ colormapped=[
2130
+ Fore.deep_sky_blue_4c,
2131
+ Fore.spring_green_4,
2132
+ Fore.turquoise_4,
2133
+ Fore.dark_cyan,
2134
+ Fore.deep_sky_blue_2,
2135
+ Fore.spring_green_2a,
2136
+ Fore.medium_spring_green,
2137
+ Fore.steel_blue,
2138
+ Fore.cadet_blue_1,
2139
+ Fore.aquamarine_3,
2140
+ Fore.purple_1a,
2141
+ Fore.medium_purple_3a,
2142
+ Fore.slate_blue_1,
2143
+ Fore.light_slate_grey,
2144
+ Fore.dark_olive_green_3a,
2145
+ Fore.deep_pink_4c,
2146
+ Fore.orange_3,
2147
+ ]
2148
+ total=0
2149
+ crv=0
2150
+ tax=0
2151
+ tax_crv=0
2152
+ i.Tax=round(i.Tax,ROUNDTO)
2153
+ i.CRV=round(i.CRV,ROUNDTO)
2154
+ i.Price=round(i.Price,ROUNDTO)
2155
+ session.commit()
2156
+ for n2,f in enumerate(location_fields):
2157
+ try:
2158
+ if getattr(i,f) > 0:
2159
+ total+=getattr(i,f)
2160
+ except Exception as e:
2161
+ print(e)
2162
+ for n2,f in enumerate(location_fields):
2163
+ if getattr(i,f) > 0:
2164
+ msg2=f'{colormapped[n2]}{f} = {round(getattr(i,f),ROUNDTO)}{Style.reset}'
2165
+ if n2 < len(location_fields):
2166
+ msg2+=","
2167
+ msg+=msg2
2168
+ master_total+=total*round(i.Price,ROUNDTO)
2169
+
2170
+ crv+=(round(i.CRV,ROUNDTO)*total)
2171
+ tax+=(round(i.Tax,ROUNDTO)*total)
2172
+ if tax == 0 and crv > 0:
2173
+ tax_crv=(round(i.CRV,ROUNDTO)*total)
2174
+ else:
2175
+ tax_crv+=((round(i.Tax,ROUNDTO)*total)+(round(i.CRV,ROUNDTO)*total))
2176
+ master_total_tax+=tax
2177
+ master_total_crv+=crv
2178
+ master_total_tax_crv+=tax_crv
2179
+ tax_crv=round(tax_crv,ROUNDTO)
2180
+ try:
2181
+ super_total=(round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)/getSuperTotal(results,location_fields,colormapped)['final total'],ROUNDTO))*100
2182
+ except Exception as e:
2183
+ p1=round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO))
2184
+ p2=getSuperTotal(results,location_fields,colormapped)['final total']
2185
+ print(e)
2186
+ print(p1,"p1")
2187
+ print(p2,"p2")
2188
+ super_total=0
2189
+ msg+=f"""{Fore.light_magenta} |-|{Fore.light_green} Total = {Fore.light_sea_green}{round(total,ROUNDTO)}
2153
2190
  {Fore.light_magenta}Price({i.Price}){Fore.medium_violet_red}*{Fore.light_slate_blue}Total({round(total,ROUNDTO)}):{round(i.Price*total,ROUNDTO)}
2154
2191
  {Fore.grey_70}+CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TotalCRV({crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(total*i.Price,ROUNDTO)+crv})
2155
2192
  {Fore.grey_70}+Tax({i.Tax}) w/o CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxNoCRVTotal({tax})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax,ROUNDTO)})
2156
2193
  {Fore.grey_70}+Tax({i.Tax}) w/ CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxCRVTotal({tax_crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)})
2157
2194
  {Fore.medium_violet_red}PercentOfTotal({round(super_total,ROUNDTO)}) of Total({getSuperTotal(results,location_fields,colormapped)['final total']})
2158
2195
  {'*'*os.get_terminal_size().columns}{Style.reset}"""
2159
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2160
- print(msg)
2161
- master_total=round(master_total,ROUNDTO)
2162
- master_total_crv=round(master_total_crv,ROUNDTO)
2163
- master_total_tax=round(master_total_tax,ROUNDTO)
2164
- master_total_tax_crv=round(master_total_tax_crv,ROUNDTO)
2165
- msg=f"""{Fore.light_green}Total Product Value:{Fore.slate_blue_1}{round(master_total,ROUNDTO)}
2196
+ db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2197
+ print(msg)
2198
+ master_total=round(master_total,ROUNDTO)
2199
+ master_total_crv=round(master_total_crv,ROUNDTO)
2200
+ master_total_tax=round(master_total_tax,ROUNDTO)
2201
+ master_total_tax_crv=round(master_total_tax_crv,ROUNDTO)
2202
+ msg=f"""{Fore.light_green}Total Product Value:{Fore.slate_blue_1}{round(master_total,ROUNDTO)}
2166
2203
  {Fore.light_green}Total Product Value w/CRV({master_total_crv}):{Fore.slate_blue_1}{round(master_total_crv+master_total,ROUNDTO)}
2167
2204
  {Fore.light_green}Total Product Value Taxed w/o CRV({master_total_tax}):{Fore.slate_blue_1}{round(master_total_tax+master_total,ROUNDTO)}
2168
2205
  {Fore.light_green}Total Product Value Taxed w/ CRV({master_total_tax_crv}):{Fore.slate_blue_1}{round(master_total_tax_crv+master_total,ROUNDTO)}
2169
- {Style.reset}"""
2170
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2171
- print(msg)
2172
- elif cmd.lower() in ['sbld','search build','search_build','scan build','scan_bld']:
2173
- end=False
2174
- while not end:
2175
- with db.Session(db.ENGINE) as session:
2176
- def mkT(text,data):
2177
- return text
2178
- code=Prompt.__init2__(None,func=mkT,ptext="Code|Barcode|Name: ",helpText="find by code,barcode,name",data='')
2179
- if code in [None,]:
2180
- end=True
2181
- break
2182
- elif code in ['d',]:
2183
- continue
2206
+ {Style.reset}"""
2207
+ db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2208
+ print(msg)
2209
+ elif cmd.lower() in ['sbld','search build','search_build','scan build','scan_bld']:
2210
+ extras=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Show Extras?",helpText="extra data attached to each entry yes or no",data="boolean")
2211
+ if extras in [None,'d',False]:
2212
+ extras=False
2213
+ end=False
2214
+ while not end:
2215
+ with db.Session(db.ENGINE) as session:
2216
+ def mkT(text,data):
2217
+ return text
2218
+ code=Prompt.__init2__(None,func=mkT,ptext="Code|Barcode|Name: ",helpText="find by code,barcode,name",data='')
2219
+ if code in [None,]:
2220
+ end=True
2221
+ break
2222
+ elif code in ['d',]:
2223
+ continue
2224
+
2225
+ results_query=session.query(db.Entry).filter(db.Entry.InList==True)
2226
+ results_query=results_query.filter(
2227
+ db.or_(
2228
+ db.Entry.Code==code,
2229
+ db.Entry.Barcode==code,
2230
+ db.Entry.Barcode.icontains(code),
2231
+ db.Entry.Code.icontains(code),
2232
+ db.Entry.Name.icontains(code)
2233
+ )
2234
+ )
2235
+ location_fields=["Shelf","BackRoom","Display_1","Display_2","Display_3","Display_4","Display_5","Display_6","ListQty","SBX_WTR_DSPLY","SBX_CHP_DSPLY","SBX_WTR_KLR","FLRL_CHP_DSPLY","FLRL_WTR_DSPLY","WD_DSPLY","CHKSTND_SPLY","Distress"]
2236
+ z=Prompt.mkfield_list(None,location_fields)
2237
+ if z in [[],None]:
2238
+ z=location_fields
2239
+ location_fields=z
2240
+ tmp=[]
2241
+ for f in location_fields:
2242
+ tmp.append(or_(getattr(db.Entry,f)>=0.0001))
2243
+ results_query=results_query.filter(or_(*tmp))
2244
+ results=results_query.all()
2245
+ ct=len(results)
2246
+ if ct < 1:
2247
+ print(f"{Fore.light_steel_blue}Nothing in {Fore.slate_blue_1}Bld{Fore.light_red}LS!{Style.reset}")
2248
+ continue
2184
2249
 
2185
- results_query=session.query(db.Entry).filter(db.Entry.InList==True)
2186
- results_query=results_query.filter(
2187
- db.or_(
2188
- db.Entry.Code==code,
2189
- db.Entry.Barcode==code,
2190
- db.Entry.Barcode.icontains(code),
2191
- db.Entry.Code.icontains(code),
2192
- db.Entry.Name.icontains(code)
2193
- )
2194
- )
2195
- location_fields=["Shelf","BackRoom","Display_1","Display_2","Display_3","Display_4","Display_5","Display_6","ListQty","SBX_WTR_DSPLY","SBX_CHP_DSPLY","SBX_WTR_KLR","FLRL_CHP_DSPLY","FLRL_WTR_DSPLY","WD_DSPLY","CHKSTND_SPLY","Distress"]
2196
- z=Prompt.mkfield_list(None,location_fields)
2197
- if z in [[],None]:
2198
- z=location_fields
2199
- location_fields=z
2200
- tmp=[]
2201
- for f in location_fields:
2202
- tmp.append(or_(getattr(db.Entry,f)>=0.0001))
2203
- results_query=results_query.filter(or_(*tmp))
2204
- results=results_query.all()
2205
- ct=len(results)
2206
- if ct < 1:
2207
- print(f"{Fore.light_steel_blue}Nothing in {Fore.slate_blue_1}Bld{Fore.light_red}LS!{Style.reset}")
2208
- continue
2209
-
2210
- ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",3,set_value=False,literal=True))
2211
- #ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",3,setValue=False,literal=True))
2212
- master_total=0
2213
- master_total_crv=0
2214
- master_total_tax=0
2215
- master_total_tax_crv=0
2216
-
2217
- for num,i in enumerate(results):
2218
- msg=f'{"*"*os.get_terminal_size().columns}\n{Fore.light_green}{num}{Fore.light_magenta}/{Fore.orange_3}{num+1} of {Fore.light_red}{ct}[{Fore.dark_slate_gray_1}EID{Fore.orange_3}]{Fore.dark_violet_1b}{i.EntryId}{Style.reset} |-| {Fore.light_yellow}{i.Name}|{Fore.light_salmon_1}[{Fore.light_red}BCD]{i.rebar()}{Fore.medium_violet_red}|[{Fore.light_red}CD{Fore.medium_violet_red}]{i.cfmt(i.Code)} {Style.reset}|-| '
2219
- colormapped=[
2220
- Fore.deep_sky_blue_4c,
2221
- Fore.spring_green_4,
2222
- Fore.turquoise_4,
2223
- Fore.dark_cyan,
2224
- Fore.deep_sky_blue_2,
2225
- Fore.spring_green_2a,
2226
- Fore.medium_spring_green,
2227
- Fore.steel_blue,
2228
- Fore.cadet_blue_1,
2229
- Fore.aquamarine_3,
2230
- Fore.purple_1a,
2231
- Fore.medium_purple_3a,
2232
- Fore.slate_blue_1,
2233
- Fore.light_slate_grey,
2234
- Fore.dark_olive_green_3a,
2235
- Fore.deep_pink_4c,
2236
- Fore.orange_3,
2237
- ]
2238
- total=0
2239
- crv=0
2240
- tax=0
2241
- tax_crv=0
2242
- i.Tax=round(i.Tax,ROUNDTO)
2243
- i.CRV=round(i.CRV,ROUNDTO)
2244
- i.Price=round(i.Price,ROUNDTO)
2245
- session.commit()
2246
- for n2,f in enumerate(location_fields):
2247
- try:
2248
- if getattr(i,f) > 0:
2249
- total+=getattr(i,f)
2250
- except Exception as e:
2251
- print(e)
2252
- for n2,f in enumerate(location_fields):
2253
- if getattr(i,f) > 0:
2254
- msg2=f'{colormapped[n2]}{f} = {round(getattr(i,f),ROUNDTO)}{Style.reset}'
2255
- if n2 < len(location_fields):
2256
- msg2+=","
2257
- msg+=msg2
2258
- master_total+=total*round(i.Price,ROUNDTO)
2259
-
2260
- crv+=(round(i.CRV,ROUNDTO)*total)
2261
- tax+=(round(i.Tax,ROUNDTO)*total)
2262
- if tax == 0 and crv > 0:
2263
- tax_crv=(round(i.CRV,ROUNDTO)*total)
2264
- else:
2265
- tax_crv+=((round(i.Tax,ROUNDTO)*total)+(round(i.CRV,ROUNDTO)*total))
2266
- master_total_tax+=tax
2267
- master_total_crv+=crv
2268
- master_total_tax_crv+=tax_crv
2269
- tax_crv=round(tax_crv,ROUNDTO)
2270
- try:
2271
- super_total=(round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)/getSuperTotal(results,location_fields,colormapped)['final total'],ROUNDTO))*100
2272
- except Exception as e:
2273
- p1=round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO))
2274
- p2=getSuperTotal(results,location_fields,colormapped)['final total']
2275
- print(e)
2276
- print(p1,"p1")
2277
- print(p2,"p2")
2278
- super_total=0
2279
- msg+=f"""{Fore.light_magenta} |-|{Fore.light_green} Total = {Fore.light_sea_green}{round(total,ROUNDTO)}
2250
+ ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",3,set_value=False,literal=True))
2251
+ #ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",3,setValue=False,literal=True))
2252
+ master_total=0
2253
+ master_total_crv=0
2254
+ master_total_tax=0
2255
+ master_total_tax_crv=0
2256
+
2257
+ for num,i in enumerate(results):
2258
+ getExtras(i.EntryId,extras)
2259
+ msg=f'{"*"*os.get_terminal_size().columns}\n{Fore.light_green}{num}{Fore.light_magenta}/{Fore.orange_3}{num+1} of {Fore.light_red}{ct}[{Fore.dark_slate_gray_1}EID{Fore.orange_3}]{Fore.dark_violet_1b}{i.EntryId}{Style.reset} |-| {Fore.light_yellow}{i.Name}|{Fore.light_salmon_1}[{Fore.light_red}BCD]{i.rebar()}{Fore.medium_violet_red}|[{Fore.light_red}CD{Fore.medium_violet_red}]{i.cfmt(i.Code)} {Style.reset}|-| '
2260
+ colormapped=[
2261
+ Fore.deep_sky_blue_4c,
2262
+ Fore.spring_green_4,
2263
+ Fore.turquoise_4,
2264
+ Fore.dark_cyan,
2265
+ Fore.deep_sky_blue_2,
2266
+ Fore.spring_green_2a,
2267
+ Fore.medium_spring_green,
2268
+ Fore.steel_blue,
2269
+ Fore.cadet_blue_1,
2270
+ Fore.aquamarine_3,
2271
+ Fore.purple_1a,
2272
+ Fore.medium_purple_3a,
2273
+ Fore.slate_blue_1,
2274
+ Fore.light_slate_grey,
2275
+ Fore.dark_olive_green_3a,
2276
+ Fore.deep_pink_4c,
2277
+ Fore.orange_3,
2278
+ ]
2279
+ total=0
2280
+ crv=0
2281
+ tax=0
2282
+ tax_crv=0
2283
+ i.Tax=round(i.Tax,ROUNDTO)
2284
+ i.CRV=round(i.CRV,ROUNDTO)
2285
+ i.Price=round(i.Price,ROUNDTO)
2286
+ session.commit()
2287
+ for n2,f in enumerate(location_fields):
2288
+ try:
2289
+ if getattr(i,f) > 0:
2290
+ total+=getattr(i,f)
2291
+ except Exception as e:
2292
+ print(e)
2293
+ for n2,f in enumerate(location_fields):
2294
+ if getattr(i,f) > 0:
2295
+ msg2=f'{colormapped[n2]}{f} = {round(getattr(i,f),ROUNDTO)}{Style.reset}'
2296
+ if n2 < len(location_fields):
2297
+ msg2+=","
2298
+ msg+=msg2
2299
+ master_total+=total*round(i.Price,ROUNDTO)
2300
+
2301
+ crv+=(round(i.CRV,ROUNDTO)*total)
2302
+ tax+=(round(i.Tax,ROUNDTO)*total)
2303
+ if tax == 0 and crv > 0:
2304
+ tax_crv=(round(i.CRV,ROUNDTO)*total)
2305
+ else:
2306
+ tax_crv+=((round(i.Tax,ROUNDTO)*total)+(round(i.CRV,ROUNDTO)*total))
2307
+ master_total_tax+=tax
2308
+ master_total_crv+=crv
2309
+ master_total_tax_crv+=tax_crv
2310
+ tax_crv=round(tax_crv,ROUNDTO)
2311
+ try:
2312
+ super_total=(round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)/getSuperTotal(results,location_fields,colormapped)['final total'],ROUNDTO))*100
2313
+ except Exception as e:
2314
+ p1=round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO))
2315
+ p2=getSuperTotal(results,location_fields,colormapped)['final total']
2316
+ print(e)
2317
+ print(p1,"p1")
2318
+ print(p2,"p2")
2319
+ super_total=0
2320
+ msg+=f"""{Fore.light_magenta} |-|{Fore.light_green} Total = {Fore.light_sea_green}{round(total,ROUNDTO)}
2280
2321
  {Fore.light_magenta}Price({i.Price}){Fore.medium_violet_red}*{Fore.light_slate_blue}Total({round(total,ROUNDTO)}):{round(i.Price*total,ROUNDTO)}
2281
2322
  {Fore.grey_70}+CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TotalCRV({crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(total*i.Price,ROUNDTO)+crv})
2282
2323
  {Fore.grey_70}+Tax({i.Tax}) w/o CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxNoCRVTotal({tax})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax,ROUNDTO)})
2283
2324
  {Fore.grey_70}+Tax({i.Tax}) w/ CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxCRVTotal({tax_crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)})
2284
2325
  {'*'*os.get_terminal_size().columns}{Style.reset}"""
2285
- print(msg)
2286
- master_total=round(master_total,ROUNDTO)
2287
- master_total_crv=round(master_total_crv,ROUNDTO)
2288
- master_total_tax=round(master_total_tax,ROUNDTO)
2289
- master_total_tax_crv=round(master_total_tax_crv,ROUNDTO)
2290
- msg=f"""{Fore.light_green}Total Product Value:{Fore.slate_blue_1}{round(master_total,ROUNDTO)}
2326
+ print(msg)
2327
+ master_total=round(master_total,ROUNDTO)
2328
+ master_total_crv=round(master_total_crv,ROUNDTO)
2329
+ master_total_tax=round(master_total_tax,ROUNDTO)
2330
+ master_total_tax_crv=round(master_total_tax_crv,ROUNDTO)
2331
+ msg=f"""{Fore.light_green}Total Product Value:{Fore.slate_blue_1}{round(master_total,ROUNDTO)}
2291
2332
  {Fore.light_green}Total Product Value w/CRV({master_total_crv}):{Fore.slate_blue_1}{round(master_total_crv+master_total,ROUNDTO)}
2292
2333
  {Fore.light_green}Total Product Value Taxed w/o CRV({master_total_tax}):{Fore.slate_blue_1}{round(master_total_tax+master_total,ROUNDTO)}
2293
2334
  {Fore.light_green}Total Product Value Taxed w/ CRV({master_total_tax_crv}):{Fore.slate_blue_1}{round(master_total_tax_crv+master_total,ROUNDTO)}
2294
2335
  {Fore.medium_violet_red}PercentOfTotal({round(super_total,ROUNDTO)}) of Total({getSuperTotal(results,location_fields,colormapped)['final total']})
2295
- {Style.reset}"""
2296
- print(msg)
2297
- elif cmd.lower() in ['esbld','export search build','export_search_build','exp scan build','exp_scan_bld']:
2298
- end=False
2299
- msg=''
2300
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file,clear_only=True)
2301
- while not end:
2302
- with db.Session(db.ENGINE) as session:
2303
- def mkT(text,data):
2304
- return text
2305
- code=Prompt.__init2__(None,func=mkT,ptext="Code|Barcode|Name: ",helpText="find by code,barcode,name",data='')
2306
- if code in [None,]:
2307
- end=True
2308
- break
2309
- elif code in ['d',]:
2310
- continue
2311
-
2312
- results_query=session.query(db.Entry).filter(db.Entry.InList==True)
2313
- results_query=results_query.filter(
2314
- db.or_(
2315
- db.Entry.Code==code,
2316
- db.Entry.Barcode==code,
2317
- db.Entry.Barcode.icontains(code),
2318
- db.Entry.Code.icontains(code),
2319
- db.Entry.Name.icontains(code)
2320
- )
2321
- )
2322
- location_fields=["Shelf","BackRoom","Display_1","Display_2","Display_3","Display_4","Display_5","Display_6","ListQty","SBX_WTR_DSPLY","SBX_CHP_DSPLY","SBX_WTR_KLR","FLRL_CHP_DSPLY","FLRL_WTR_DSPLY","WD_DSPLY","CHKSTND_SPLY","Distress"]
2323
- z=Prompt.mkfield_list(None,location_fields)
2324
- if z in [[],None]:
2325
- z=location_fields
2326
- location_fields=z
2327
- tmp=[]
2328
- for f in location_fields:
2329
- tmp.append(or_(getattr(db.Entry,f)>=0.0001))
2330
- results_query=results_query.filter(or_(*tmp))
2331
- results=results_query.all()
2332
- ct=len(results)
2333
- if ct < 1:
2334
- msg=f"{Fore.light_steel_blue}Nothing in {Fore.slate_blue_1}Bld{Fore.light_red}LS!{Style.reset}"
2335
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2336
+ {Style.reset}"""
2336
2337
  print(msg)
2337
- continue
2338
-
2339
- #start
2340
- ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",3,setValue=False,literal=True))
2341
- master_total=0
2342
- master_total_crv=0
2343
- master_total_tax=0
2344
- master_total_tax_crv=0
2345
-
2346
- for num,i in enumerate(results):
2347
- msg=f'{"*"*os.get_terminal_size().columns}\n{Fore.light_green}{num}{Fore.light_magenta}/{Fore.orange_3}{num+1} of {Fore.light_red}{ct}[{Fore.dark_slate_gray_1}EID{Fore.orange_3}]{Fore.dark_violet_1b}{i.EntryId}{Style.reset} |-| {Fore.light_yellow}{i.Name}|{Fore.light_salmon_1}[{Fore.light_red}BCD]{i.rebar()}{Fore.medium_violet_red}|[{Fore.light_red}CD{Fore.medium_violet_red}]{i.cfmt(i.Code)} {Style.reset}|-| '
2348
- colormapped=[
2349
- Fore.deep_sky_blue_4c,
2350
- Fore.spring_green_4,
2351
- Fore.turquoise_4,
2352
- Fore.dark_cyan,
2353
- Fore.deep_sky_blue_2,
2354
- Fore.spring_green_2a,
2355
- Fore.medium_spring_green,
2356
- Fore.steel_blue,
2357
- Fore.cadet_blue_1,
2358
- Fore.aquamarine_3,
2359
- Fore.purple_1a,
2360
- Fore.medium_purple_3a,
2361
- Fore.slate_blue_1,
2362
- Fore.light_slate_grey,
2363
- Fore.dark_olive_green_3a,
2364
- Fore.deep_pink_4c,
2365
- Fore.orange_3,
2366
- ]
2367
- total=0
2368
- crv=0
2369
- tax=0
2370
- tax_crv=0
2371
- i.Tax=round(i.Tax,ROUNDTO)
2372
- i.CRV=round(i.CRV,ROUNDTO)
2373
- i.Price=round(i.Price,ROUNDTO)
2374
- session.commit()
2375
- for n2,f in enumerate(location_fields):
2376
- try:
2377
- if getattr(i,f) > 0:
2378
- total+=getattr(i,f)
2379
- except Exception as e:
2380
- print(e)
2381
- for n2,f in enumerate(location_fields):
2382
- if getattr(i,f) > 0:
2383
- msg2=f'{colormapped[n2]}{f} = {round(getattr(i,f),ROUNDTO)}{Style.reset}'
2384
- if n2 < len(location_fields):
2385
- msg2+=","
2386
- msg+=msg2
2387
- master_total+=total*round(i.Price,ROUNDTO)
2388
-
2389
- crv+=(round(i.CRV,ROUNDTO)*total)
2390
- tax+=(round(i.Tax,ROUNDTO)*total)
2391
- if tax == 0 and crv > 0:
2392
- tax_crv=(round(i.CRV,ROUNDTO)*total)
2393
- else:
2394
- tax_crv+=((round(i.Tax,ROUNDTO)*total)+(round(i.CRV,ROUNDTO)*total))
2395
- master_total_tax+=tax
2396
- master_total_crv+=crv
2397
- master_total_tax_crv+=tax_crv
2398
- tax_crv=round(tax_crv,ROUNDTO)
2399
- try:
2400
- super_total=(round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)/getSuperTotal(results,location_fields,colormapped)['final total'],ROUNDTO))*100
2401
- except Exception as e:
2402
- p1=round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO))
2403
- p2=getSuperTotal(results,location_fields,colormapped)['final total']
2404
- print(e)
2405
- print(p1,"p1")
2406
- print(p2,"p2")
2407
- super_total=0
2408
- msg+=f"""{Fore.light_magenta} |-|{Fore.light_green} Total = {Fore.light_sea_green}{round(total,ROUNDTO)}
2338
+ elif cmd.lower() in ['esbld','export search build','export_search_build','exp scan build','exp_scan_bld']:
2339
+ extras=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Show Extras?",helpText="extra data attached to each entry yes or no",data="boolean")
2340
+ if extras in [None,'d',False]:
2341
+ extras=False
2342
+ end=False
2343
+ msg=''
2344
+ db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file,clear_only=True)
2345
+ while not end:
2346
+ with db.Session(db.ENGINE) as session:
2347
+ def mkT(text,data):
2348
+ return text
2349
+ code=Prompt.__init2__(None,func=mkT,ptext="Code|Barcode|Name: ",helpText="find by code,barcode,name",data='')
2350
+ if code in [None,]:
2351
+ end=True
2352
+ break
2353
+ elif code in ['d',]:
2354
+ continue
2355
+
2356
+ results_query=session.query(db.Entry).filter(db.Entry.InList==True)
2357
+ results_query=results_query.filter(
2358
+ db.or_(
2359
+ db.Entry.Code==code,
2360
+ db.Entry.Barcode==code,
2361
+ db.Entry.Barcode.icontains(code),
2362
+ db.Entry.Code.icontains(code),
2363
+ db.Entry.Name.icontains(code)
2364
+ )
2365
+ )
2366
+ location_fields=["Shelf","BackRoom","Display_1","Display_2","Display_3","Display_4","Display_5","Display_6","ListQty","SBX_WTR_DSPLY","SBX_CHP_DSPLY","SBX_WTR_KLR","FLRL_CHP_DSPLY","FLRL_WTR_DSPLY","WD_DSPLY","CHKSTND_SPLY","Distress"]
2367
+ z=Prompt.mkfield_list(None,location_fields)
2368
+ if z in [[],None]:
2369
+ z=location_fields
2370
+ location_fields=z
2371
+ tmp=[]
2372
+ for f in location_fields:
2373
+ tmp.append(or_(getattr(db.Entry,f)>=0.0001))
2374
+ results_query=results_query.filter(or_(*tmp))
2375
+ results=results_query.all()
2376
+ ct=len(results)
2377
+ if ct < 1:
2378
+ msg=f"{Fore.light_steel_blue}Nothing in {Fore.slate_blue_1}Bld{Fore.light_red}LS!{Style.reset}"
2379
+ db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2380
+ print(msg)
2381
+ continue
2382
+
2383
+ #start
2384
+ ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",3,setValue=False,literal=True))
2385
+ master_total=0
2386
+ master_total_crv=0
2387
+ master_total_tax=0
2388
+ master_total_tax_crv=0
2389
+
2390
+ for num,i in enumerate(results):
2391
+ getExtras(i.EntryId,extras)
2392
+ msg=f'{"*"*os.get_terminal_size().columns}\n{Fore.light_green}{num}{Fore.light_magenta}/{Fore.orange_3}{num+1} of {Fore.light_red}{ct}[{Fore.dark_slate_gray_1}EID{Fore.orange_3}]{Fore.dark_violet_1b}{i.EntryId}{Style.reset} |-| {Fore.light_yellow}{i.Name}|{Fore.light_salmon_1}[{Fore.light_red}BCD]{i.rebar()}{Fore.medium_violet_red}|[{Fore.light_red}CD{Fore.medium_violet_red}]{i.cfmt(i.Code)} {Style.reset}|-| '
2393
+ colormapped=[
2394
+ Fore.deep_sky_blue_4c,
2395
+ Fore.spring_green_4,
2396
+ Fore.turquoise_4,
2397
+ Fore.dark_cyan,
2398
+ Fore.deep_sky_blue_2,
2399
+ Fore.spring_green_2a,
2400
+ Fore.medium_spring_green,
2401
+ Fore.steel_blue,
2402
+ Fore.cadet_blue_1,
2403
+ Fore.aquamarine_3,
2404
+ Fore.purple_1a,
2405
+ Fore.medium_purple_3a,
2406
+ Fore.slate_blue_1,
2407
+ Fore.light_slate_grey,
2408
+ Fore.dark_olive_green_3a,
2409
+ Fore.deep_pink_4c,
2410
+ Fore.orange_3,
2411
+ ]
2412
+ total=0
2413
+ crv=0
2414
+ tax=0
2415
+ tax_crv=0
2416
+ i.Tax=round(i.Tax,ROUNDTO)
2417
+ i.CRV=round(i.CRV,ROUNDTO)
2418
+ i.Price=round(i.Price,ROUNDTO)
2419
+ session.commit()
2420
+ for n2,f in enumerate(location_fields):
2421
+ try:
2422
+ if getattr(i,f) > 0:
2423
+ total+=getattr(i,f)
2424
+ except Exception as e:
2425
+ print(e)
2426
+ for n2,f in enumerate(location_fields):
2427
+ if getattr(i,f) > 0:
2428
+ msg2=f'{colormapped[n2]}{f} = {round(getattr(i,f),ROUNDTO)}{Style.reset}'
2429
+ if n2 < len(location_fields):
2430
+ msg2+=","
2431
+ msg+=msg2
2432
+ master_total+=total*round(i.Price,ROUNDTO)
2433
+
2434
+ crv+=(round(i.CRV,ROUNDTO)*total)
2435
+ tax+=(round(i.Tax,ROUNDTO)*total)
2436
+ if tax == 0 and crv > 0:
2437
+ tax_crv=(round(i.CRV,ROUNDTO)*total)
2438
+ else:
2439
+ tax_crv+=((round(i.Tax,ROUNDTO)*total)+(round(i.CRV,ROUNDTO)*total))
2440
+ master_total_tax+=tax
2441
+ master_total_crv+=crv
2442
+ master_total_tax_crv+=tax_crv
2443
+ tax_crv=round(tax_crv,ROUNDTO)
2444
+ try:
2445
+ super_total=(round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)/getSuperTotal(results,location_fields,colormapped)['final total'],ROUNDTO))*100
2446
+ except Exception as e:
2447
+ p1=round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO))
2448
+ p2=getSuperTotal(results,location_fields,colormapped)['final total']
2449
+ print(e)
2450
+ print(p1,"p1")
2451
+ print(p2,"p2")
2452
+ super_total=0
2453
+ msg+=f"""{Fore.light_magenta} |-|{Fore.light_green} Total = {Fore.light_sea_green}{round(total,ROUNDTO)}
2409
2454
  {Fore.light_magenta}Price({i.Price}){Fore.medium_violet_red}*{Fore.light_slate_blue}Total({round(total,ROUNDTO)}):{round(i.Price*total,ROUNDTO)}
2410
2455
  {Fore.grey_70}+CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TotalCRV({crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(total*i.Price,ROUNDTO)+crv})
2411
2456
  {Fore.grey_70}+Tax({i.Tax}) w/o CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxNoCRVTotal({tax})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax,ROUNDTO)})
2412
2457
  {Fore.grey_70}+Tax({i.Tax}) w/ CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxCRVTotal({tax_crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)})
2413
2458
  {Fore.medium_violet_red}PercentOfTotal({round(super_total,ROUNDTO)}) of Total({getSuperTotal(results,location_fields,colormapped)['final total']})
2414
2459
  {'*'*os.get_terminal_size().columns}{Style.reset}"""
2415
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2416
- print(msg)
2417
- master_total=round(master_total,ROUNDTO)
2418
- master_total_crv=round(master_total_crv,ROUNDTO)
2419
- master_total_tax=round(master_total_tax,ROUNDTO)
2420
- master_total_tax_crv=round(master_total_tax_crv,ROUNDTO)
2421
- msg=f"""{Fore.light_green}Total Product Value:{Fore.slate_blue_1}{round(master_total,ROUNDTO)}
2460
+ db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2461
+ print(msg)
2462
+ master_total=round(master_total,ROUNDTO)
2463
+ master_total_crv=round(master_total_crv,ROUNDTO)
2464
+ master_total_tax=round(master_total_tax,ROUNDTO)
2465
+ master_total_tax_crv=round(master_total_tax_crv,ROUNDTO)
2466
+ msg=f"""{Fore.light_green}Total Product Value:{Fore.slate_blue_1}{round(master_total,ROUNDTO)}
2422
2467
  {Fore.light_green}Total Product Value w/CRV({master_total_crv}):{Fore.slate_blue_1}{round(master_total_crv+master_total,ROUNDTO)}
2423
2468
  {Fore.light_green}Total Product Value Taxed w/o CRV({master_total_tax}):{Fore.slate_blue_1}{round(master_total_tax+master_total,ROUNDTO)}
2424
2469
  {Fore.light_green}Total Product Value Taxed w/ CRV({master_total_tax_crv}):{Fore.slate_blue_1}{round(master_total_tax_crv+master_total,ROUNDTO)}
2425
- {Style.reset}"""
2426
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2427
- print(msg)
2428
- elif cmd.lower() in ["bldls-","build-","buildls-","build list -","bld ls -",'lsbld-','list build -','ls bld -','bld-']:
2429
- with db.Session(db.ENGINE) as session:
2430
- results_query=session.query(db.Entry).filter(db.Entry.InList==True)
2431
- location_fields=["Shelf","BackRoom","Display_1","Display_2","Display_3","Display_4","Display_5","Display_6","ListQty","SBX_WTR_DSPLY","SBX_CHP_DSPLY","SBX_WTR_KLR","FLRL_CHP_DSPLY","FLRL_WTR_DSPLY","WD_DSPLY","CHKSTND_SPLY","Distress"]
2432
- z=Prompt.mkfield_list(None,location_fields)
2433
- if z in [[],None]:
2434
- z=location_fields
2435
- location_fields=z
2436
- tmp=[]
2437
- for f in location_fields:
2438
- tmp.append(or_(getattr(db.Entry,f)!=0,getattr(db.Entry,f)!=None))
2439
- results_query=results_query.filter(or_(*tmp))
2440
- results=results_query.all()
2441
- ct=len(results)
2442
- if ct < 1:
2443
- print(f"{Fore.light_steel_blue}Nothing in {Fore.slate_blue_1}Bld{Fore.light_red}LS!{Style.reset}")
2444
- continue
2445
- ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",3,setValue=False,literal=True))
2446
- master_total=0
2447
- master_total_crv=0
2448
- master_total_tax=0
2449
- master_total_tax_crv=0
2450
-
2451
- for num,i in enumerate(results):
2452
- msg=f'{"*"*os.get_terminal_size().columns}\n{Fore.light_green}{num}{Fore.light_magenta}/{Fore.orange_3}{num+1} of {Fore.light_red}{ct}[{Fore.dark_slate_gray_1}EID{Fore.orange_3}]{Fore.dark_violet_1b}{i.EntryId}{Style.reset} |-| {Fore.light_yellow}{i.Name}|{Fore.light_salmon_1}[{Fore.light_red}BCD]{i.rebar()}{Fore.medium_violet_red}|[{Fore.light_red}CD{Fore.medium_violet_red}]{i.cfmt(i.Code)} {Style.reset}|-| '
2453
- colormapped=[
2454
- Fore.deep_sky_blue_4c,
2455
- Fore.spring_green_4,
2456
- Fore.turquoise_4,
2457
- Fore.dark_cyan,
2458
- Fore.deep_sky_blue_2,
2459
- Fore.spring_green_2a,
2460
- Fore.medium_spring_green,
2461
- Fore.steel_blue,
2462
- Fore.cadet_blue_1,
2463
- Fore.aquamarine_3,
2464
- Fore.purple_1a,
2465
- Fore.medium_purple_3a,
2466
- Fore.slate_blue_1,
2467
- Fore.light_slate_grey,
2468
- Fore.dark_olive_green_3a,
2469
- Fore.deep_pink_4c,
2470
- Fore.orange_3,
2471
- ]
2472
- total=0
2473
- crv=0
2474
- tax=0
2475
- tax_crv=0
2476
- for n2,f in enumerate(location_fields):
2477
- try:
2478
- if getattr(i,f) != 0:
2479
- total+=getattr(i,f)
2480
- except Exception as e:
2481
- print(e)
2482
- for n2,f in enumerate(location_fields):
2483
- if getattr(i,f) != 0:
2484
- msg2=f'{colormapped[n2]}{f} = {round(getattr(i,f),3)}{Style.reset}'
2485
- if n2 < len(location_fields):
2486
- msg2+=","
2487
- msg+=msg2
2488
- master_total+=total*round(i.Price,ROUNDTO)
2489
-
2490
- crv+=(round(i.CRV,ROUNDTO)*total)
2491
- tax+=(round(i.Tax,ROUNDTO)*total)
2492
- if tax == 0 and crv > 0:
2493
- tax_crv=(round(i.CRV,ROUNDTO)*total)
2494
- else:
2495
- tax_crv+=((round(i.Tax,ROUNDTO)*total)+(round(i.CRV,ROUNDTO)*total))
2496
- master_total_tax+=tax
2497
- master_total_crv+=crv
2498
- master_total_tax_crv+=tax_crv
2499
- tax_crv=round(tax_crv,ROUNDTO)
2500
- try:
2501
- super_total=(round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)/getSuperTotal(results,location_fields,colormapped)['final total'],ROUNDTO))*100
2502
- except Exception as e:
2503
- p1=round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO))
2504
- p2=getSuperTotal(results,location_fields,colormapped)['final total']
2505
- print(e)
2506
- print(p1,"p1")
2507
- print(p2,"p2")
2508
- super_total=0
2509
-
2510
- msg+=f"""{Fore.light_magenta} |-|{Fore.light_green} Total = {Fore.light_sea_green}{round(total,ROUNDTO)}
2470
+ {Style.reset}"""
2471
+ db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2472
+ print(msg)
2473
+ elif cmd.lower() in ["bldls-","build-","buildls-","build list -","bld ls -",'lsbld-','list build -','ls bld -','bld-']:
2474
+ extras=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Show Extras?",helpText="extra data attached to each entry yes or no",data="boolean")
2475
+ if extras in [None,'d',False]:
2476
+ extras=False
2477
+ with db.Session(db.ENGINE) as session:
2478
+ results_query=session.query(db.Entry).filter(db.Entry.InList==True)
2479
+ location_fields=["Shelf","BackRoom","Display_1","Display_2","Display_3","Display_4","Display_5","Display_6","ListQty","SBX_WTR_DSPLY","SBX_CHP_DSPLY","SBX_WTR_KLR","FLRL_CHP_DSPLY","FLRL_WTR_DSPLY","WD_DSPLY","CHKSTND_SPLY","Distress"]
2480
+ z=Prompt.mkfield_list(None,location_fields)
2481
+ if z in [[],None]:
2482
+ z=location_fields
2483
+ location_fields=z
2484
+ tmp=[]
2485
+ for f in location_fields:
2486
+ tmp.append(or_(getattr(db.Entry,f)!=0,getattr(db.Entry,f)!=None))
2487
+ results_query=results_query.filter(or_(*tmp))
2488
+ results=results_query.all()
2489
+ ct=len(results)
2490
+ if ct < 1:
2491
+ print(f"{Fore.light_steel_blue}Nothing in {Fore.slate_blue_1}Bld{Fore.light_red}LS!{Style.reset}")
2492
+ continue
2493
+ ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",3,setValue=False,literal=True))
2494
+ master_total=0
2495
+ master_total_crv=0
2496
+ master_total_tax=0
2497
+ master_total_tax_crv=0
2498
+
2499
+ for num,i in enumerate(results):
2500
+ getExtras(i.EntryId,extras)
2501
+ msg=f'{"*"*os.get_terminal_size().columns}\n{Fore.light_green}{num}{Fore.light_magenta}/{Fore.orange_3}{num+1} of {Fore.light_red}{ct}[{Fore.dark_slate_gray_1}EID{Fore.orange_3}]{Fore.dark_violet_1b}{i.EntryId}{Style.reset} |-| {Fore.light_yellow}{i.Name}|{Fore.light_salmon_1}[{Fore.light_red}BCD]{i.rebar()}{Fore.medium_violet_red}|[{Fore.light_red}CD{Fore.medium_violet_red}]{i.cfmt(i.Code)} {Style.reset}|-| '
2502
+ colormapped=[
2503
+ Fore.deep_sky_blue_4c,
2504
+ Fore.spring_green_4,
2505
+ Fore.turquoise_4,
2506
+ Fore.dark_cyan,
2507
+ Fore.deep_sky_blue_2,
2508
+ Fore.spring_green_2a,
2509
+ Fore.medium_spring_green,
2510
+ Fore.steel_blue,
2511
+ Fore.cadet_blue_1,
2512
+ Fore.aquamarine_3,
2513
+ Fore.purple_1a,
2514
+ Fore.medium_purple_3a,
2515
+ Fore.slate_blue_1,
2516
+ Fore.light_slate_grey,
2517
+ Fore.dark_olive_green_3a,
2518
+ Fore.deep_pink_4c,
2519
+ Fore.orange_3,
2520
+ ]
2521
+ total=0
2522
+ crv=0
2523
+ tax=0
2524
+ tax_crv=0
2525
+ for n2,f in enumerate(location_fields):
2526
+ try:
2527
+ if getattr(i,f) != 0:
2528
+ total+=getattr(i,f)
2529
+ except Exception as e:
2530
+ print(e)
2531
+ for n2,f in enumerate(location_fields):
2532
+ if getattr(i,f) != 0:
2533
+ msg2=f'{colormapped[n2]}{f} = {round(getattr(i,f),3)}{Style.reset}'
2534
+ if n2 < len(location_fields):
2535
+ msg2+=","
2536
+ msg+=msg2
2537
+ master_total+=total*round(i.Price,ROUNDTO)
2538
+
2539
+ crv+=(round(i.CRV,ROUNDTO)*total)
2540
+ tax+=(round(i.Tax,ROUNDTO)*total)
2541
+ if tax == 0 and crv > 0:
2542
+ tax_crv=(round(i.CRV,ROUNDTO)*total)
2543
+ else:
2544
+ tax_crv+=((round(i.Tax,ROUNDTO)*total)+(round(i.CRV,ROUNDTO)*total))
2545
+ master_total_tax+=tax
2546
+ master_total_crv+=crv
2547
+ master_total_tax_crv+=tax_crv
2548
+ tax_crv=round(tax_crv,ROUNDTO)
2549
+ try:
2550
+ super_total=(round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)/getSuperTotal(results,location_fields,colormapped)['final total'],ROUNDTO))*100
2551
+ except Exception as e:
2552
+ p1=round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO))
2553
+ p2=getSuperTotal(results,location_fields,colormapped)['final total']
2554
+ print(e)
2555
+ print(p1,"p1")
2556
+ print(p2,"p2")
2557
+ super_total=0
2558
+
2559
+ msg+=f"""{Fore.light_magenta} |-|{Fore.light_green} Total = {Fore.light_sea_green}{round(total,ROUNDTO)}
2511
2560
  {Fore.light_magenta}Price({i.Price}){Fore.medium_violet_red}*{Fore.light_slate_blue}Total({round(total,ROUNDTO)}):{round(i.Price*total,ROUNDTO)}
2512
2561
  {Fore.grey_70}+CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TotalCRV({crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(total*i.Price,ROUNDTO)+crv})
2513
2562
  {Fore.grey_70}+Tax({i.Tax}) w/o CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxNoCRVTotal({tax})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax,ROUNDTO)})
2514
2563
  {Fore.grey_70}+Tax({i.Tax}) w/ CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxCRVTotal({tax_crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)})
2515
2564
  {Fore.medium_violet_red}PercentOfTotal({round(super_total,ROUNDTO)}) of Total({getSuperTotal(results,location_fields,colormapped)['final total']})
2516
2565
  {'*'*os.get_terminal_size().columns}{Style.reset}"""
2517
- print(msg)
2518
- master_total=round(master_total,ROUNDTO)
2519
- master_total_crv=round(master_total_crv,ROUNDTO)
2520
- master_total_tax=round(master_total_tax,ROUNDTO)
2521
- master_total_tax_crv=round(master_total_tax_crv,ROUNDTO)
2522
- msg=f"""{Fore.light_green}Total Product Value:{Fore.slate_blue_1}{round(master_total,ROUNDTO)}
2566
+ print(msg)
2567
+ master_total=round(master_total,ROUNDTO)
2568
+ master_total_crv=round(master_total_crv,ROUNDTO)
2569
+ master_total_tax=round(master_total_tax,ROUNDTO)
2570
+ master_total_tax_crv=round(master_total_tax_crv,ROUNDTO)
2571
+ msg=f"""{Fore.light_green}Total Product Value:{Fore.slate_blue_1}{round(master_total,ROUNDTO)}
2523
2572
  {Fore.light_green}Total Product Value w/CRV({master_total_crv}):{Fore.slate_blue_1}{round(master_total_crv+master_total,ROUNDTO)}
2524
2573
  {Fore.light_green}Total Product Value Taxed w/o CRV({master_total_tax}):{Fore.slate_blue_1}{round(master_total_tax+master_total,ROUNDTO)}
2525
2574
  {Fore.light_green}Total Product Value Taxed w/ CRV({master_total_tax_crv}):{Fore.slate_blue_1}{round(master_total_tax_crv+master_total,ROUNDTO)}
2526
- {Style.reset}"""
2527
- print(msg)
2528
- elif cmd.lower() in ["bldlse-","builde-","buildlse-","build list export -","bld ls exp -",'elsbld-','export list build -','exp ls bld -','ebld-']:
2529
- msg=''
2530
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file,clear_only=True)
2531
- with db.Session(db.ENGINE) as session:
2532
- results_query=session.query(db.Entry).filter(db.Entry.InList==True)
2533
- location_fields=["Shelf","BackRoom","Display_1","Display_2","Display_3","Display_4","Display_5","Display_6","ListQty","SBX_WTR_DSPLY","SBX_CHP_DSPLY","SBX_WTR_KLR","FLRL_CHP_DSPLY","FLRL_WTR_DSPLY","WD_DSPLY","CHKSTND_SPLY","Distress"]
2534
- z=Prompt.mkfield_list(None,location_fields)
2535
- if z in [[],None]:
2536
- z=location_fields
2537
- location_fields=z
2538
- tmp=[]
2539
- for f in location_fields:
2540
- tmp.append(or_(getattr(db.Entry,f)!=0,getattr(db.Entry,f)!=None))
2541
- results_query=results_query.filter(or_(*tmp))
2542
- results=results_query.all()
2543
- ct=len(results)
2544
- if ct < 1:
2545
- msg=f"{Fore.light_steel_blue}Nothing in {Fore.slate_blue_1}Bld{Fore.light_red}LS!{Style.reset}"
2546
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2547
- print(msg)
2548
- continue
2549
- ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",3,setValue=False,literal=True))
2550
- master_total=0
2551
- master_total_crv=0
2552
- master_total_tax=0
2553
- master_total_tax_crv=0
2554
-
2555
- for num,i in enumerate(results):
2556
- msg=f'{"*"*os.get_terminal_size().columns}\n{Fore.light_green}{num}{Fore.light_magenta}/{Fore.orange_3}{num+1} of {Fore.light_red}{ct}[{Fore.dark_slate_gray_1}EID{Fore.orange_3}]{Fore.dark_violet_1b}{i.EntryId}{Style.reset} |-| {Fore.light_yellow}{i.Name}|{Fore.light_salmon_1}[{Fore.light_red}BCD]{i.rebar()}{Fore.medium_violet_red}|[{Fore.light_red}CD{Fore.medium_violet_red}]{i.cfmt(i.Code)} {Style.reset}|-| '
2557
- colormapped=[
2558
- Fore.deep_sky_blue_4c,
2559
- Fore.spring_green_4,
2560
- Fore.turquoise_4,
2561
- Fore.dark_cyan,
2562
- Fore.deep_sky_blue_2,
2563
- Fore.spring_green_2a,
2564
- Fore.medium_spring_green,
2565
- Fore.steel_blue,
2566
- Fore.cadet_blue_1,
2567
- Fore.aquamarine_3,
2568
- Fore.purple_1a,
2569
- Fore.medium_purple_3a,
2570
- Fore.slate_blue_1,
2571
- Fore.light_slate_grey,
2572
- Fore.dark_olive_green_3a,
2573
- Fore.deep_pink_4c,
2574
- Fore.orange_3,
2575
- ]
2576
- total=0
2577
- crv=0
2578
- tax=0
2579
- tax_crv=0
2580
- for n2,f in enumerate(location_fields):
2581
- try:
2582
- if getattr(i,f) != 0:
2583
- total+=getattr(i,f)
2584
- except Exception as e:
2585
- print(e)
2586
- for n2,f in enumerate(location_fields):
2587
- if getattr(i,f) != 0:
2588
- msg2=f'{colormapped[n2]}{f} = {round(getattr(i,f),ROUNDTO)}{Style.reset}'
2589
- if n2 < len(location_fields):
2590
- msg2+=","
2591
- msg+=msg2
2592
- master_total+=total*round(i.Price,ROUNDTO)
2593
-
2594
- crv+=(round(i.CRV,ROUNDTO)*total)
2595
- tax+=(round(i.Tax,ROUNDTO)*total)
2596
- if tax == 0 and crv > 0:
2597
- tax_crv=(round(i.CRV,ROUNDTO)*total)
2598
- else:
2599
- tax_crv+=((round(i.Tax,ROUNDTO)*total)+(round(i.CRV,ROUNDTO)*total))
2600
- master_total_tax+=tax
2601
- master_total_crv+=crv
2602
- master_total_tax_crv+=tax_crv
2603
- tax_crv=round(tax_crv,ROUNDTO)
2604
- try:
2605
- super_total=(round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)/getSuperTotal(results,location_fields,colormapped)['final total'],ROUNDTO))*100
2606
- except Exception as e:
2607
- p1=round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO))
2608
- p2=getSuperTotal(results,location_fields,colormapped)['final total']
2609
- print(e)
2610
- print(p1,"p1")
2611
- print(p2,"p2")
2612
- super_total=0
2613
-
2614
- msg+=f"""{Fore.light_magenta} |-|{Fore.light_green} Total = {Fore.light_sea_green}{round(total,ROUNDTO)}
2575
+ {Style.reset}"""
2576
+ print(msg)
2577
+ elif cmd.lower() in ["bldlse-","builde-","buildlse-","build list export -","bld ls exp -",'elsbld-','export list build -','exp ls bld -','ebld-']:
2578
+ extras=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Show Extras?",helpText="extra data attached to each entry yes or no",data="boolean")
2579
+ if extras in [None,'d',False]:
2580
+ extras=False
2581
+ msg=''
2582
+ db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file,clear_only=True)
2583
+ with db.Session(db.ENGINE) as session:
2584
+ results_query=session.query(db.Entry).filter(db.Entry.InList==True)
2585
+ location_fields=["Shelf","BackRoom","Display_1","Display_2","Display_3","Display_4","Display_5","Display_6","ListQty","SBX_WTR_DSPLY","SBX_CHP_DSPLY","SBX_WTR_KLR","FLRL_CHP_DSPLY","FLRL_WTR_DSPLY","WD_DSPLY","CHKSTND_SPLY","Distress"]
2586
+ z=Prompt.mkfield_list(None,location_fields)
2587
+ if z in [[],None]:
2588
+ z=location_fields
2589
+ location_fields=z
2590
+ tmp=[]
2591
+ for f in location_fields:
2592
+ tmp.append(or_(getattr(db.Entry,f)!=0,getattr(db.Entry,f)!=None))
2593
+ results_query=results_query.filter(or_(*tmp))
2594
+ results=results_query.all()
2595
+ ct=len(results)
2596
+ if ct < 1:
2597
+ msg=f"{Fore.light_steel_blue}Nothing in {Fore.slate_blue_1}Bld{Fore.light_red}LS!{Style.reset}"
2598
+ db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2599
+ print(msg)
2600
+ continue
2601
+ ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",3,setValue=False,literal=True))
2602
+ master_total=0
2603
+ master_total_crv=0
2604
+ master_total_tax=0
2605
+ master_total_tax_crv=0
2606
+
2607
+ for num,i in enumerate(results):
2608
+ getExtras(i.EntryId,extras)
2609
+ msg=f'{"*"*os.get_terminal_size().columns}\n{Fore.light_green}{num}{Fore.light_magenta}/{Fore.orange_3}{num+1} of {Fore.light_red}{ct}[{Fore.dark_slate_gray_1}EID{Fore.orange_3}]{Fore.dark_violet_1b}{i.EntryId}{Style.reset} |-| {Fore.light_yellow}{i.Name}|{Fore.light_salmon_1}[{Fore.light_red}BCD]{i.rebar()}{Fore.medium_violet_red}|[{Fore.light_red}CD{Fore.medium_violet_red}]{i.cfmt(i.Code)} {Style.reset}|-| '
2610
+ colormapped=[
2611
+ Fore.deep_sky_blue_4c,
2612
+ Fore.spring_green_4,
2613
+ Fore.turquoise_4,
2614
+ Fore.dark_cyan,
2615
+ Fore.deep_sky_blue_2,
2616
+ Fore.spring_green_2a,
2617
+ Fore.medium_spring_green,
2618
+ Fore.steel_blue,
2619
+ Fore.cadet_blue_1,
2620
+ Fore.aquamarine_3,
2621
+ Fore.purple_1a,
2622
+ Fore.medium_purple_3a,
2623
+ Fore.slate_blue_1,
2624
+ Fore.light_slate_grey,
2625
+ Fore.dark_olive_green_3a,
2626
+ Fore.deep_pink_4c,
2627
+ Fore.orange_3,
2628
+ ]
2629
+ total=0
2630
+ crv=0
2631
+ tax=0
2632
+ tax_crv=0
2633
+ for n2,f in enumerate(location_fields):
2634
+ try:
2635
+ if getattr(i,f) != 0:
2636
+ total+=getattr(i,f)
2637
+ except Exception as e:
2638
+ print(e)
2639
+ for n2,f in enumerate(location_fields):
2640
+ if getattr(i,f) != 0:
2641
+ msg2=f'{colormapped[n2]}{f} = {round(getattr(i,f),ROUNDTO)}{Style.reset}'
2642
+ if n2 < len(location_fields):
2643
+ msg2+=","
2644
+ msg+=msg2
2645
+ master_total+=total*round(i.Price,ROUNDTO)
2646
+
2647
+ crv+=(round(i.CRV,ROUNDTO)*total)
2648
+ tax+=(round(i.Tax,ROUNDTO)*total)
2649
+ if tax == 0 and crv > 0:
2650
+ tax_crv=(round(i.CRV,ROUNDTO)*total)
2651
+ else:
2652
+ tax_crv+=((round(i.Tax,ROUNDTO)*total)+(round(i.CRV,ROUNDTO)*total))
2653
+ master_total_tax+=tax
2654
+ master_total_crv+=crv
2655
+ master_total_tax_crv+=tax_crv
2656
+ tax_crv=round(tax_crv,ROUNDTO)
2657
+ try:
2658
+ super_total=(round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)/getSuperTotal(results,location_fields,colormapped)['final total'],ROUNDTO))*100
2659
+ except Exception as e:
2660
+ p1=round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO))
2661
+ p2=getSuperTotal(results,location_fields,colormapped)['final total']
2662
+ print(e)
2663
+ print(p1,"p1")
2664
+ print(p2,"p2")
2665
+ super_total=0
2666
+
2667
+ msg+=f"""{Fore.light_magenta} |-|{Fore.light_green} Total = {Fore.light_sea_green}{round(total,ROUNDTO)}
2615
2668
  {Fore.light_magenta}Price({i.Price}){Fore.medium_violet_red}*{Fore.light_slate_blue}Total({round(total,ROUNDTO)}):{round(i.Price*total,ROUNDTO)}
2616
2669
  {Fore.grey_70}+CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TotalCRV({crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(total*i.Price,ROUNDTO)+crv})
2617
2670
  {Fore.grey_70}+Tax({i.Tax}) w/o CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxNoCRVTotal({tax})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax,ROUNDTO)})
2618
2671
  {Fore.grey_70}+Tax({i.Tax}) w/ CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxCRVTotal({tax_crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)})
2619
2672
  {Fore.medium_violet_red}PercentOfTotal({round(super_total,ROUNDTO)}) of Total({getSuperTotal(results,location_fields,colormapped)['final total']})
2620
2673
  {'*'*os.get_terminal_size().columns}{Style.reset}"""
2621
- print(msg)
2622
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2623
-
2624
- master_total=round(master_total,ROUNDTO)
2625
- master_total_crv=round(master_total_crv,ROUNDTO)
2626
- master_total_tax=round(master_total_tax,ROUNDTO)
2627
- master_total_tax_crv=round(master_total_tax_crv,ROUNDTO)
2628
- msg=f"""{Fore.light_green}Total Product Value:{Fore.slate_blue_1}{round(master_total,ROUNDTO)}
2674
+ print(msg)
2675
+ db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2676
+
2677
+ master_total=round(master_total,ROUNDTO)
2678
+ master_total_crv=round(master_total_crv,ROUNDTO)
2679
+ master_total_tax=round(master_total_tax,ROUNDTO)
2680
+ master_total_tax_crv=round(master_total_tax_crv,ROUNDTO)
2681
+ msg=f"""{Fore.light_green}Total Product Value:{Fore.slate_blue_1}{round(master_total,ROUNDTO)}
2629
2682
  {Fore.light_green}Total Product Value w/CRV({master_total_crv}):{Fore.slate_blue_1}{round(master_total_crv+master_total,ROUNDTO)}
2630
2683
  {Fore.light_green}Total Product Value Taxed w/o CRV({master_total_tax}):{Fore.slate_blue_1}{round(master_total_tax+master_total,ROUNDTO)}
2631
2684
  {Fore.light_green}Total Product Value Taxed w/ CRV({master_total_tax_crv}):{Fore.slate_blue_1}{round(master_total_tax_crv+master_total,ROUNDTO)}
2632
- {Style.reset}"""
2633
- print(msg)
2634
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2635
- elif cmd.lower() in ['sbld-','search build -','search_build-','scan build-','scan_bld-']:
2636
- end=False
2637
- while not end:
2638
- with db.Session(db.ENGINE) as session:
2639
- def mkT(text,data):
2640
- return text
2641
- code=Prompt.__init2__(None,func=mkT,ptext="Code|Barcode|Name: ",helpText="find by code,barcode,name",data='')
2642
- if code in [None,]:
2643
- end=True
2644
- break
2645
- elif code in ['d',]:
2646
- continue
2647
-
2648
- results_query=session.query(db.Entry).filter(db.Entry.InList==True)
2649
- results_query=results_query.filter(
2650
- db.or_(
2651
- db.Entry.Code==code,
2652
- db.Entry.Barcode==code,
2653
- db.Entry.Barcode.icontains(code),
2654
- db.Entry.Code.icontains(code),
2655
- db.Entry.Name.icontains(code)
2656
- )
2657
- )
2658
- location_fields=["Shelf","BackRoom","Display_1","Display_2","Display_3","Display_4","Display_5","Display_6","ListQty","SBX_WTR_DSPLY","SBX_CHP_DSPLY","SBX_WTR_KLR","FLRL_CHP_DSPLY","FLRL_WTR_DSPLY","WD_DSPLY","CHKSTND_SPLY","Distress"]
2659
- z=Prompt.mkfield_list(None,location_fields)
2660
- if z in [[],None]:
2661
- z=location_fields
2662
- location_fields=z
2663
- tmp=[]
2664
- for f in location_fields:
2665
- tmp.append(or_(getattr(db.Entry,f)!=0,getattr(db.Entry,f)!=None))
2666
- results_query=results_query.filter(or_(*tmp))
2667
- results=results_query.all()
2668
- ct=len(results)
2669
- if ct < 1:
2670
- print(f"{Fore.light_steel_blue}Nothing in {Fore.slate_blue_1}Bld{Fore.light_red}LS!{Style.reset}")
2671
- continue
2672
- ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",3,setValue=False,literal=True))
2673
- master_total=0
2674
- master_total_crv=0
2675
- master_total_tax=0
2676
- master_total_tax_crv=0
2677
-
2678
- for num,i in enumerate(results):
2679
- msg=f'{"*"*os.get_terminal_size().columns}\n{Fore.light_green}{num}{Fore.light_magenta}/{Fore.orange_3}{num+1} of {Fore.light_red}{ct}[{Fore.dark_slate_gray_1}EID{Fore.orange_3}]{Fore.dark_violet_1b}{i.EntryId}{Style.reset} |-| {Fore.light_yellow}{i.Name}|{Fore.light_salmon_1}[{Fore.light_red}BCD]{i.rebar()}{Fore.medium_violet_red}|[{Fore.light_red}CD{Fore.medium_violet_red}]{i.cfmt(i.Code)} {Style.reset}|-| '
2680
- colormapped=[
2681
- Fore.deep_sky_blue_4c,
2682
- Fore.spring_green_4,
2683
- Fore.turquoise_4,
2684
- Fore.dark_cyan,
2685
- Fore.deep_sky_blue_2,
2686
- Fore.spring_green_2a,
2687
- Fore.medium_spring_green,
2688
- Fore.steel_blue,
2689
- Fore.cadet_blue_1,
2690
- Fore.aquamarine_3,
2691
- Fore.purple_1a,
2692
- Fore.medium_purple_3a,
2693
- Fore.slate_blue_1,
2694
- Fore.light_slate_grey,
2695
- Fore.dark_olive_green_3a,
2696
- Fore.deep_pink_4c,
2697
- Fore.orange_3,
2698
- ]
2699
- total=0
2700
- crv=0
2701
- tax=0
2702
- tax_crv=0
2703
- for n2,f in enumerate(location_fields):
2704
- try:
2705
- if getattr(i,f) != 0:
2706
- total+=getattr(i,f)
2707
- except Exception as e:
2708
- print(e)
2709
- for n2,f in enumerate(location_fields):
2710
- if getattr(i,f) != 0:
2711
- msg2=f'{colormapped[n2]}{f} = {round(getattr(i,f),ROUNDTO)}{Style.reset}'
2712
- if n2 < len(location_fields):
2713
- msg2+=","
2714
- msg+=msg2
2715
- master_total+=total*round(i.Price,3)
2716
-
2717
- crv+=(round(i.CRV,ROUNDTO)*total)
2718
- tax+=(round(i.Tax,ROUNDTO)*total)
2719
- if tax == 0 and crv > 0:
2720
- tax_crv=(round(i.CRV,ROUNDTO)*total)
2721
- else:
2722
- tax_crv+=((round(i.Tax,ROUNDTO)*total)+(round(i.CRV,ROUNDTO)*total))
2723
- master_total_tax+=tax
2724
- master_total_crv+=crv
2725
- master_total_tax_crv+=tax_crv
2726
- tax_crv=round(tax_crv,ROUNDTO)
2727
- try:
2728
- super_total=(round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)/getSuperTotal(results,location_fields,colormapped)['final total'],ROUNDTO))*100
2729
- except Exception as e:
2730
- p1=round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO))
2731
- p2=getSuperTotal(results,location_fields,colormapped)['final total']
2732
- print(e)
2733
- print(p1,"p1")
2734
- print(p2,"p2")
2735
- super_total=0
2736
-
2737
- msg+=f"""{Fore.light_magenta} |-|{Fore.light_green} Total = {Fore.light_sea_green}{round(total,ROUNDTO)}
2685
+ {Style.reset}"""
2686
+ print(msg)
2687
+ db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2688
+ elif cmd.lower() in ['sbld-','search build -','search_build-','scan build-','scan_bld-']:
2689
+ extras=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Show Extras?",helpText="extra data attached to each entry yes or no",data="boolean")
2690
+ if extras in [None,'d',False]:
2691
+ extras=False
2692
+ end=False
2693
+ while not end:
2694
+ with db.Session(db.ENGINE) as session:
2695
+ def mkT(text,data):
2696
+ return text
2697
+ code=Prompt.__init2__(None,func=mkT,ptext="Code|Barcode|Name: ",helpText="find by code,barcode,name",data='')
2698
+ if code in [None,]:
2699
+ end=True
2700
+ break
2701
+ elif code in ['d',]:
2702
+ continue
2703
+
2704
+ results_query=session.query(db.Entry).filter(db.Entry.InList==True)
2705
+ results_query=results_query.filter(
2706
+ db.or_(
2707
+ db.Entry.Code==code,
2708
+ db.Entry.Barcode==code,
2709
+ db.Entry.Barcode.icontains(code),
2710
+ db.Entry.Code.icontains(code),
2711
+ db.Entry.Name.icontains(code)
2712
+ )
2713
+ )
2714
+ location_fields=["Shelf","BackRoom","Display_1","Display_2","Display_3","Display_4","Display_5","Display_6","ListQty","SBX_WTR_DSPLY","SBX_CHP_DSPLY","SBX_WTR_KLR","FLRL_CHP_DSPLY","FLRL_WTR_DSPLY","WD_DSPLY","CHKSTND_SPLY","Distress"]
2715
+ z=Prompt.mkfield_list(None,location_fields)
2716
+ if z in [[],None]:
2717
+ z=location_fields
2718
+ location_fields=z
2719
+ tmp=[]
2720
+ for f in location_fields:
2721
+ tmp.append(or_(getattr(db.Entry,f)!=0,getattr(db.Entry,f)!=None))
2722
+ results_query=results_query.filter(or_(*tmp))
2723
+ results=results_query.all()
2724
+ ct=len(results)
2725
+ if ct < 1:
2726
+ print(f"{Fore.light_steel_blue}Nothing in {Fore.slate_blue_1}Bld{Fore.light_red}LS!{Style.reset}")
2727
+ continue
2728
+ ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",3,setValue=False,literal=True))
2729
+ master_total=0
2730
+ master_total_crv=0
2731
+ master_total_tax=0
2732
+ master_total_tax_crv=0
2733
+
2734
+ for num,i in enumerate(results):
2735
+ getExtras(i.EntryId,extras)
2736
+ msg=f'{"*"*os.get_terminal_size().columns}\n{Fore.light_green}{num}{Fore.light_magenta}/{Fore.orange_3}{num+1} of {Fore.light_red}{ct}[{Fore.dark_slate_gray_1}EID{Fore.orange_3}]{Fore.dark_violet_1b}{i.EntryId}{Style.reset} |-| {Fore.light_yellow}{i.Name}|{Fore.light_salmon_1}[{Fore.light_red}BCD]{i.rebar()}{Fore.medium_violet_red}|[{Fore.light_red}CD{Fore.medium_violet_red}]{i.cfmt(i.Code)} {Style.reset}|-| '
2737
+ colormapped=[
2738
+ Fore.deep_sky_blue_4c,
2739
+ Fore.spring_green_4,
2740
+ Fore.turquoise_4,
2741
+ Fore.dark_cyan,
2742
+ Fore.deep_sky_blue_2,
2743
+ Fore.spring_green_2a,
2744
+ Fore.medium_spring_green,
2745
+ Fore.steel_blue,
2746
+ Fore.cadet_blue_1,
2747
+ Fore.aquamarine_3,
2748
+ Fore.purple_1a,
2749
+ Fore.medium_purple_3a,
2750
+ Fore.slate_blue_1,
2751
+ Fore.light_slate_grey,
2752
+ Fore.dark_olive_green_3a,
2753
+ Fore.deep_pink_4c,
2754
+ Fore.orange_3,
2755
+ ]
2756
+ total=0
2757
+ crv=0
2758
+ tax=0
2759
+ tax_crv=0
2760
+ for n2,f in enumerate(location_fields):
2761
+ try:
2762
+ if getattr(i,f) != 0:
2763
+ total+=getattr(i,f)
2764
+ except Exception as e:
2765
+ print(e)
2766
+ for n2,f in enumerate(location_fields):
2767
+ if getattr(i,f) != 0:
2768
+ msg2=f'{colormapped[n2]}{f} = {round(getattr(i,f),ROUNDTO)}{Style.reset}'
2769
+ if n2 < len(location_fields):
2770
+ msg2+=","
2771
+ msg+=msg2
2772
+ master_total+=total*round(i.Price,3)
2773
+
2774
+ crv+=(round(i.CRV,ROUNDTO)*total)
2775
+ tax+=(round(i.Tax,ROUNDTO)*total)
2776
+ if tax == 0 and crv > 0:
2777
+ tax_crv=(round(i.CRV,ROUNDTO)*total)
2778
+ else:
2779
+ tax_crv+=((round(i.Tax,ROUNDTO)*total)+(round(i.CRV,ROUNDTO)*total))
2780
+ master_total_tax+=tax
2781
+ master_total_crv+=crv
2782
+ master_total_tax_crv+=tax_crv
2783
+ tax_crv=round(tax_crv,ROUNDTO)
2784
+ try:
2785
+ super_total=(round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)/getSuperTotal(results,location_fields,colormapped)['final total'],ROUNDTO))*100
2786
+ except Exception as e:
2787
+ p1=round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO))
2788
+ p2=getSuperTotal(results,location_fields,colormapped)['final total']
2789
+ print(e)
2790
+ print(p1,"p1")
2791
+ print(p2,"p2")
2792
+ super_total=0
2793
+
2794
+ msg+=f"""{Fore.light_magenta} |-|{Fore.light_green} Total = {Fore.light_sea_green}{round(total,ROUNDTO)}
2738
2795
  {Fore.light_magenta}Price({i.Price}){Fore.medium_violet_red}*{Fore.light_slate_blue}Total({round(total,ROUNDTO)}):{round(i.Price*total,ROUNDTO)}
2739
2796
  {Fore.grey_70}+CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TotalCRV({crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(total*i.Price,ROUNDTO)+crv})
2740
2797
  {Fore.grey_70}+Tax({i.Tax}) w/o CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxNoCRVTotal({tax})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax,ROUNDTO)})
2741
2798
  {Fore.grey_70}+Tax({i.Tax}) w/ CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxCRVTotal({tax_crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)})
2742
2799
  {Fore.medium_violet_red}PercentOfTotal({round(super_total,ROUNDTO)}) of Total({getSuperTotal(results,location_fields,colormapped)['final total']})
2743
2800
  {'*'*os.get_terminal_size().columns}{Style.reset}"""
2744
- print(msg)
2745
- master_total=round(master_total,ROUNDTO)
2746
- master_total_crv=round(master_total_crv,ROUNDTO)
2747
- master_total_tax=round(master_total_tax,ROUNDTO)
2748
- master_total_tax_crv=round(master_total_tax_crv,ROUNDTO)
2749
- msg=f"""{Fore.light_green}Total Product Value:{Fore.slate_blue_1}{round(master_total,ROUNDTO)}
2801
+ print(msg)
2802
+ master_total=round(master_total,ROUNDTO)
2803
+ master_total_crv=round(master_total_crv,ROUNDTO)
2804
+ master_total_tax=round(master_total_tax,ROUNDTO)
2805
+ master_total_tax_crv=round(master_total_tax_crv,ROUNDTO)
2806
+ msg=f"""{Fore.light_green}Total Product Value:{Fore.slate_blue_1}{round(master_total,ROUNDTO)}
2750
2807
  {Fore.light_green}Total Product Value w/CRV({master_total_crv}):{Fore.slate_blue_1}{round(master_total_crv+master_total,ROUNDTO)}
2751
2808
  {Fore.light_green}Total Product Value Taxed w/o CRV({master_total_tax}):{Fore.slate_blue_1}{round(master_total_tax+master_total,ROUNDTO)}
2752
2809
  {Fore.light_green}Total Product Value Taxed w/ CRV({master_total_tax_crv}):{Fore.slate_blue_1}{round(master_total_tax_crv+master_total,ROUNDTO)}
2753
- {Style.reset}"""
2754
- print(msg)
2755
- elif cmd.lower() in ['esbld-','export search build -','export_search_build-','exp scan build-','exp_scan_bld-']:
2756
- end=False
2757
- msg=''
2758
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file,clear_only=True)
2759
- while not end:
2760
- with db.Session(db.ENGINE) as session:
2761
- def mkT(text,data):
2762
- return text
2763
- code=Prompt.__init2__(None,func=mkT,ptext="Code|Barcode|Name: ",helpText="find by code,barcode,name",data='')
2764
- if code in [None,]:
2765
- end=True
2766
- break
2767
- elif code in ['d',]:
2768
- continue
2769
-
2770
- results_query=session.query(db.Entry).filter(db.Entry.InList==True)
2771
- results_query=results_query.filter(
2772
- db.or_(
2773
- db.Entry.Code==code,
2774
- db.Entry.Barcode==code,
2775
- db.Entry.Barcode.icontains(code),
2776
- db.Entry.Code.icontains(code),
2777
- db.Entry.Name.icontains(code)
2778
- )
2779
- )
2780
- location_fields=["Shelf","BackRoom","Display_1","Display_2","Display_3","Display_4","Display_5","Display_6","ListQty","SBX_WTR_DSPLY","SBX_CHP_DSPLY","SBX_WTR_KLR","FLRL_CHP_DSPLY","FLRL_WTR_DSPLY","WD_DSPLY","CHKSTND_SPLY","Distress"]
2781
- z=Prompt.mkfield_list(None,location_fields)
2782
- if z in [[],None]:
2783
- z=location_fields
2784
- location_fields=z
2785
- tmp=[]
2786
- for f in location_fields:
2787
- tmp.append(or_(getattr(db.Entry,f)!=0,getattr(db.Entry,f)!=None))
2788
- results_query=results_query.filter(or_(*tmp))
2789
- results=results_query.all()
2790
- ct=len(results)
2791
- if ct < 1:
2792
- msg=f"{Fore.light_steel_blue}Nothing in {Fore.slate_blue_1}Bld{Fore.light_red}LS!{Style.reset}"
2793
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2810
+ {Style.reset}"""
2794
2811
  print(msg)
2795
- continue
2796
- ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",3,setValue=False,literal=True))
2797
- master_total=0
2798
- master_total_crv=0
2799
- master_total_tax=0
2800
- master_total_tax_crv=0
2801
-
2802
- for num,i in enumerate(results):
2803
- msg=f'{"*"*os.get_terminal_size().columns}\n{Fore.light_green}{num}{Fore.light_magenta}/{Fore.orange_3}{num+1} of {Fore.light_red}{ct}[{Fore.dark_slate_gray_1}EID{Fore.orange_3}]{Fore.dark_violet_1b}{i.EntryId}{Style.reset} |-| {Fore.light_yellow}{i.Name}|{Fore.light_salmon_1}[{Fore.light_red}BCD]{i.rebar()}{Fore.medium_violet_red}|[{Fore.light_red}CD{Fore.medium_violet_red}]{i.cfmt(i.Code)} {Style.reset}|-| '
2804
- colormapped=[
2805
- Fore.deep_sky_blue_4c,
2806
- Fore.spring_green_4,
2807
- Fore.turquoise_4,
2808
- Fore.dark_cyan,
2809
- Fore.deep_sky_blue_2,
2810
- Fore.spring_green_2a,
2811
- Fore.medium_spring_green,
2812
- Fore.steel_blue,
2813
- Fore.cadet_blue_1,
2814
- Fore.aquamarine_3,
2815
- Fore.purple_1a,
2816
- Fore.medium_purple_3a,
2817
- Fore.slate_blue_1,
2818
- Fore.light_slate_grey,
2819
- Fore.dark_olive_green_3a,
2820
- Fore.deep_pink_4c,
2821
- Fore.orange_3,
2822
- ]
2823
- total=0
2824
- crv=0
2825
- tax=0
2826
- tax_crv=0
2827
- for n2,f in enumerate(location_fields):
2828
- try:
2829
- if getattr(i,f) != 0:
2830
- total+=getattr(i,f)
2831
- except Exception as e:
2832
- print(e)
2833
- for n2,f in enumerate(location_fields):
2834
- if getattr(i,f) != 0:
2835
- msg2=f'{colormapped[n2]}{f} = {round(getattr(i,f),ROUNDTO)}{Style.reset}'
2836
- if n2 < len(location_fields):
2837
- msg2+=","
2838
- msg+=msg2
2839
- master_total+=total*round(i.Price,ROUNDTO)
2840
-
2841
- crv+=(round(i.CRV,ROUNDTO)*total)
2842
- tax+=(round(i.Tax,ROUNDTO)*total)
2843
- if tax == 0 and crv > 0:
2844
- tax_crv=(round(i.CRV,ROUNDTO)*total)
2845
- else:
2846
- tax_crv+=((round(i.Tax,ROUNDTO)*total)+(round(i.CRV,ROUNDTO)*total))
2847
- master_total_tax+=tax
2848
- master_total_crv+=crv
2849
- master_total_tax_crv+=tax_crv
2850
- tax_crv=round(tax_crv,ROUNDTO)
2851
- try:
2852
- super_total=(round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)/getSuperTotal(results,location_fields,colormapped)['final total'],ROUNDTO))*100
2853
- except Exception as e:
2854
- p1=round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO))
2855
- p2=getSuperTotal(results,location_fields,colormapped)['final total']
2856
- print(e)
2857
- print(p1,"p1")
2858
- print(p2,"p2")
2859
- super_total=0
2860
- msg+=f"""{Fore.light_magenta} |-|{Fore.light_green} Total = {Fore.light_sea_green}{round(total,ROUNDTO)}
2812
+ elif cmd.lower() in ['esbld-','export search build -','export_search_build-','exp scan build-','exp_scan_bld-']:
2813
+ extras=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Show Extras?",helpText="extra data attached to each entry yes or no",data="boolean")
2814
+ if extras in [None,'d',False]:
2815
+ extras=False
2816
+ end=False
2817
+ msg=''
2818
+ db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file,clear_only=True)
2819
+ while not end:
2820
+ with db.Session(db.ENGINE) as session:
2821
+ def mkT(text,data):
2822
+ return text
2823
+ code=Prompt.__init2__(None,func=mkT,ptext="Code|Barcode|Name: ",helpText="find by code,barcode,name",data='')
2824
+ if code in [None,]:
2825
+ end=True
2826
+ break
2827
+ elif code in ['d',]:
2828
+ continue
2829
+
2830
+ results_query=session.query(db.Entry).filter(db.Entry.InList==True)
2831
+ results_query=results_query.filter(
2832
+ db.or_(
2833
+ db.Entry.Code==code,
2834
+ db.Entry.Barcode==code,
2835
+ db.Entry.Barcode.icontains(code),
2836
+ db.Entry.Code.icontains(code),
2837
+ db.Entry.Name.icontains(code)
2838
+ )
2839
+ )
2840
+ location_fields=["Shelf","BackRoom","Display_1","Display_2","Display_3","Display_4","Display_5","Display_6","ListQty","SBX_WTR_DSPLY","SBX_CHP_DSPLY","SBX_WTR_KLR","FLRL_CHP_DSPLY","FLRL_WTR_DSPLY","WD_DSPLY","CHKSTND_SPLY","Distress"]
2841
+ z=Prompt.mkfield_list(None,location_fields)
2842
+ if z in [[],None]:
2843
+ z=location_fields
2844
+ location_fields=z
2845
+ tmp=[]
2846
+ for f in location_fields:
2847
+ tmp.append(or_(getattr(db.Entry,f)!=0,getattr(db.Entry,f)!=None))
2848
+ results_query=results_query.filter(or_(*tmp))
2849
+ results=results_query.all()
2850
+ ct=len(results)
2851
+ if ct < 1:
2852
+ msg=f"{Fore.light_steel_blue}Nothing in {Fore.slate_blue_1}Bld{Fore.light_red}LS!{Style.reset}"
2853
+ db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2854
+ print(msg)
2855
+ continue
2856
+ ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",3,setValue=False,literal=True))
2857
+ master_total=0
2858
+ master_total_crv=0
2859
+ master_total_tax=0
2860
+ master_total_tax_crv=0
2861
+
2862
+ for num,i in enumerate(results):
2863
+ getExtras(i.EntryId,extras)
2864
+ msg=f'{"*"*os.get_terminal_size().columns}\n{Fore.light_green}{num}{Fore.light_magenta}/{Fore.orange_3}{num+1} of {Fore.light_red}{ct}[{Fore.dark_slate_gray_1}EID{Fore.orange_3}]{Fore.dark_violet_1b}{i.EntryId}{Style.reset} |-| {Fore.light_yellow}{i.Name}|{Fore.light_salmon_1}[{Fore.light_red}BCD]{i.rebar()}{Fore.medium_violet_red}|[{Fore.light_red}CD{Fore.medium_violet_red}]{i.cfmt(i.Code)} {Style.reset}|-| '
2865
+ colormapped=[
2866
+ Fore.deep_sky_blue_4c,
2867
+ Fore.spring_green_4,
2868
+ Fore.turquoise_4,
2869
+ Fore.dark_cyan,
2870
+ Fore.deep_sky_blue_2,
2871
+ Fore.spring_green_2a,
2872
+ Fore.medium_spring_green,
2873
+ Fore.steel_blue,
2874
+ Fore.cadet_blue_1,
2875
+ Fore.aquamarine_3,
2876
+ Fore.purple_1a,
2877
+ Fore.medium_purple_3a,
2878
+ Fore.slate_blue_1,
2879
+ Fore.light_slate_grey,
2880
+ Fore.dark_olive_green_3a,
2881
+ Fore.deep_pink_4c,
2882
+ Fore.orange_3,
2883
+ ]
2884
+ total=0
2885
+ crv=0
2886
+ tax=0
2887
+ tax_crv=0
2888
+ for n2,f in enumerate(location_fields):
2889
+ try:
2890
+ if getattr(i,f) != 0:
2891
+ total+=getattr(i,f)
2892
+ except Exception as e:
2893
+ print(e)
2894
+ for n2,f in enumerate(location_fields):
2895
+ if getattr(i,f) != 0:
2896
+ msg2=f'{colormapped[n2]}{f} = {round(getattr(i,f),ROUNDTO)}{Style.reset}'
2897
+ if n2 < len(location_fields):
2898
+ msg2+=","
2899
+ msg+=msg2
2900
+ master_total+=total*round(i.Price,ROUNDTO)
2901
+
2902
+ crv+=(round(i.CRV,ROUNDTO)*total)
2903
+ tax+=(round(i.Tax,ROUNDTO)*total)
2904
+ if tax == 0 and crv > 0:
2905
+ tax_crv=(round(i.CRV,ROUNDTO)*total)
2906
+ else:
2907
+ tax_crv+=((round(i.Tax,ROUNDTO)*total)+(round(i.CRV,ROUNDTO)*total))
2908
+ master_total_tax+=tax
2909
+ master_total_crv+=crv
2910
+ master_total_tax_crv+=tax_crv
2911
+ tax_crv=round(tax_crv,ROUNDTO)
2912
+ try:
2913
+ super_total=(round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)/getSuperTotal(results,location_fields,colormapped)['final total'],ROUNDTO))*100
2914
+ except Exception as e:
2915
+ p1=round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO))
2916
+ p2=getSuperTotal(results,location_fields,colormapped)['final total']
2917
+ print(e)
2918
+ print(p1,"p1")
2919
+ print(p2,"p2")
2920
+ super_total=0
2921
+ msg+=f"""{Fore.light_magenta} |-|{Fore.light_green} Total = {Fore.light_sea_green}{round(total,ROUNDTO)}
2861
2922
  {Fore.light_magenta}Price({i.Price}){Fore.medium_violet_red}*{Fore.light_slate_blue}Total({round(total,ROUNDTO)}):{round(i.Price*total,ROUNDTO)}
2862
2923
  {Fore.grey_70}+CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TotalCRV({crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(total*i.Price,ROUNDTO)+crv})
2863
2924
  {Fore.grey_70}+Tax({i.Tax}) w/o CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxNoCRVTotal({tax})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax,ROUNDTO)})
2864
2925
  {Fore.grey_70}+Tax({i.Tax}) w/ CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxCRVTotal({tax_crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)})
2865
2926
  {Fore.medium_violet_red}PercentOfTotal({round(super_total,ROUNDTO)}) of Total({getSuperTotal(results,location_fields,colormapped)['final total']})
2866
2927
  {'*'*os.get_terminal_size().columns}{Style.reset}"""
2867
- print(msg)
2868
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2869
- master_total=round(master_total,ROUNDTO)
2870
- master_total_crv=round(master_total_crv,ROUNDTO)
2871
- master_total_tax=round(master_total_tax,ROUNDTO)
2872
- master_total_tax_crv=round(master_total_tax_crv,ROUNDTO)
2873
- msg=f"""{Fore.light_green}Total Product Value:{Fore.slate_blue_1}{round(master_total,ROUNDTO)}
2928
+ print(msg)
2929
+ db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2930
+ master_total=round(master_total,ROUNDTO)
2931
+ master_total_crv=round(master_total_crv,ROUNDTO)
2932
+ master_total_tax=round(master_total_tax,ROUNDTO)
2933
+ master_total_tax_crv=round(master_total_tax_crv,ROUNDTO)
2934
+ msg=f"""{Fore.light_green}Total Product Value:{Fore.slate_blue_1}{round(master_total,ROUNDTO)}
2874
2935
  {Fore.light_green}Total Product Value w/CRV({master_total_crv}):{Fore.slate_blue_1}{round(master_total_crv+master_total,ROUNDTO)}
2875
2936
  {Fore.light_green}Total Product Value Taxed w/o CRV({master_total_tax}):{Fore.slate_blue_1}{round(master_total_tax+master_total,ROUNDTO)}
2876
2937
  {Fore.light_green}Total Product Value Taxed w/ CRV({master_total_tax_crv}):{Fore.slate_blue_1}{round(master_total_tax_crv+master_total,ROUNDTO)}
2877
- {Style.reset}"""
2878
- print(msg)
2879
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2880
- #end#
2881
- elif cmd.lower() in ['cdp','clipboard_default_paste','clipboard default paste']:
2882
- with db.Session(db.ENGINE) as session:
2883
- dflt=session.query(db.ClipBoord).filter(db.ClipBoord.defaultPaste==True).order_by(db.ClipBoord.doe.desc()).first()
2884
- if dflt:
2885
- print(f"{Fore.orange_red_1}using '{Fore.light_blue}{dflt.cbValue}{Fore.orange_red_1}'{Style.reset}")
2886
- return func(dflt.cbValue,data)
2938
+ {Style.reset}"""
2939
+ print(msg)
2940
+ db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2941
+ #end#
2942
+ elif cmd.lower() in ['cdp','clipboard_default_paste','clipboard default paste']:
2943
+ with db.Session(db.ENGINE) as session:
2944
+ dflt=session.query(db.ClipBoord).filter(db.ClipBoord.defaultPaste==True).order_by(db.ClipBoord.doe.desc()).first()
2945
+ if dflt:
2946
+ print(f"{Fore.orange_red_1}using '{Fore.light_blue}{dflt.cbValue}{Fore.orange_red_1}'{Style.reset}")
2947
+ return func(dflt.cbValue,data)
2948
+ else:
2949
+ print(f"{Fore.orange_red_1}nothing to use!{Style.reset}")
2887
2950
  else:
2888
- print(f"{Fore.orange_red_1}nothing to use!{Style.reset}")
2889
- else:
2890
- return func(cmd,data)
2951
+ return func(cmd,data)
2952
+ break
2953
+ except KeyboardInterrupt as e:
2954
+ pass
2891
2955
 
2892
2956
  #since this will be used statically, no self is required
2893
2957
  #example filter method