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 +1713 -1707
- radboy/DB/__pycache__/Prompt.cpython-313.pyc +0 -0
- radboy/DB/__pycache__/db.cpython-313.pyc +0 -0
- radboy/__init__.py +1 -1
- radboy/__pycache__/RecordMyCodes.cpython-313.pyc +0 -0
- radboy/__pycache__/__init__.cpython-313.pyc +0 -0
- {radboy-0.0.348.dist-info → radboy-0.0.349.dist-info}/METADATA +1 -1
- {radboy-0.0.348.dist-info → radboy-0.0.349.dist-info}/RECORD +10 -10
- {radboy-0.0.348.dist-info → radboy-0.0.349.dist-info}/WHEEL +0 -0
- {radboy-0.0.348.dist-info → radboy-0.0.349.dist-info}/top_level.txt +0 -0
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
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
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
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
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
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
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
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
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
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
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
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
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
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
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
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
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
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
+
cmd=GetAsciiOnly2(cmd)
|
|
1036
|
+
cmd=GetAsciiOnly(cmd)
|
|
1037
|
+
scanout=Path(detectGetOrSet('CMD_TO_FILE',str(Path('./SCANNER.TXT'))))
|
|
1035
1038
|
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
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
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
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
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
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
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
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
|
-
|
|
1186
|
+
#multiline end#
|
|
1184
1187
|
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
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
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
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
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
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
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
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
|
-
|
|
1332
|
+
#cmd=GetAsciiOnly2(cmd)
|
|
1330
1333
|
|
|
1331
|
-
|
|
1334
|
+
#cmd=GetAsciiOnly(cmd)
|
|
1332
1335
|
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
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
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
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
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
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
|
-
|
|
1382
|
+
'''
|
|
1383
|
+
print(msg)
|
|
1381
1384
|
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
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
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
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
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
if
|
|
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
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1542
|
-
|
|
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
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
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
|
-
|
|
1554
|
-
session.commit()
|
|
1555
|
-
exit("Reboot is required!")
|
|
1556
|
-
print(e)
|
|
1563
|
+
print("readline is off")
|
|
1557
1564
|
except Exception as e:
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1565
|
+
try:
|
|
1566
|
+
import readline
|
|
1567
|
+
print(e)
|
|
1568
|
+
except Exception as e:
|
|
1569
|
+
print(e)
|
|
1561
1570
|
except Exception as e:
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
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
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
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
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
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
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
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="
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
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
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
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
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
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
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
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
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
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
|
-
|
|
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
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
|
|
1985
|
-
|
|
1986
|
-
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2000
|
-
|
|
2001
|
-
|
|
2002
|
-
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
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
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
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
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
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
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
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
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
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
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
)
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
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
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
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
|
-
|
|
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
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
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
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
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
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
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
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
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
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
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
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
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
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
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
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
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
|
-
|
|
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
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
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
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
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
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
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
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
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
|