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