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