radboy 0.0.711__py3-none-any.whl → 0.0.712__py3-none-any.whl

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

Potentially problematic release.


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

radboy/DB/Prompt.py CHANGED
@@ -37,6 +37,7 @@ import enum
37
37
  from radboy.DB.rad_types import *
38
38
  import asyncio
39
39
  import hashlib
40
+ import decimal
40
41
 
41
42
  try:
42
43
  import resource
@@ -952,1434 +953,1436 @@ class Prompt(object):
952
953
 
953
954
 
954
955
  def __init2__(self,func,ptext='do what',helpText='',data={},noHistory=False,qc=None,replace_ptext=None,alt_input=None):
955
- ROUNDTO=int(db.detectGetOrSet("TotalSpent ROUNDTO default",4,setValue=False,literal=True))
956
- '''
957
- lsbld - bldls()
958
- lsbld- - bldls(minus=True)
959
- bldlse - bldls(bldlse=True)
960
- bldlse - bldls(bldlse=True,minus=True)
961
-
962
- sbld - bldls(sbld=True)
963
- sbld- bldls(sbld=True,minus=True)
964
- esbld - bldls(bldlse=True,sbld=True)
965
- esblb- bldls(bldlse=True,sbld=True,minus=True)
966
- '''
967
- def bldls(bldlse=False,sbld=False,minus=False,justCount=False,justTotal=False,mode=None):
968
- with localcontext() as ctx:
969
- ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
970
- ctx.prec=ROUNDTO
971
- ct=len(db.BooleanAnswers.setFieldInList_MODES)
972
- if (mode == None) or (not isinstance(mode,int)):
973
- modes=[]
974
- for num,i in enumerate(db.BooleanAnswers.setFieldInList_MODES):
975
- modes.append(std_colorize(i,num,ct))
976
- modes='\n'.join(modes)
977
- print(modes)
978
- mode=Control(func=FormBuilderMkText,ptext="Which Mode do you wish to use?",helpText=modes,data="integer")
979
- if mode is None:
980
- return
981
- elif mode in ['d',]:
982
- mode=0
983
- if not ((mode <= (ct-1)) and (mode >= 0)):
984
- print(f"{Fore.orange_red_1}invalid mode:\n{mode}\ndefaulting to {Fore.light_green}SHOWALL!{Style.reset}")
985
- mode=0
986
- else:
987
- if not ((mode <= (ct-1)) and (mode >= 0)):
988
- print(f"{Fore.orange_red_1}invalid mode:\n{mode}\ndefaulting to {Fore.light_green}SHOWALL!{Style.reset}")
989
- mode=0
956
+ with localcontext() as PROMPT_CONTEXT:
957
+ ROUNDTO=int(db.detectGetOrSet("TotalSpent ROUNDTO default",4,setValue=False,literal=True))
958
+ PROMPT_CONTEXT.prec=ROUNDTO
959
+ '''
960
+ lsbld - bldls()
961
+ lsbld- - bldls(minus=True)
962
+ bldlse - bldls(bldlse=True)
963
+ bldlse - bldls(bldlse=True,minus=True)
964
+
965
+ sbld - bldls(sbld=True)
966
+ sbld- bldls(sbld=True,minus=True)
967
+ esbld - bldls(bldlse=True,sbld=True)
968
+ esblb- bldls(bldlse=True,sbld=True,minus=True)
969
+ '''
970
+ def bldls(bldlse=False,sbld=False,minus=False,justCount=False,justTotal=False,mode=None):
971
+ with localcontext() as ctx:
972
+ ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
973
+ ctx.prec=ROUNDTO
974
+ ct=len(db.BooleanAnswers.setFieldInList_MODES)
975
+ if (mode == None) or (not isinstance(mode,int)):
976
+ modes=[]
977
+ for num,i in enumerate(db.BooleanAnswers.setFieldInList_MODES):
978
+ modes.append(std_colorize(i,num,ct))
979
+ modes='\n'.join(modes)
980
+ print(modes)
981
+ mode=Control(func=FormBuilderMkText,ptext="Which Mode do you wish to use?",helpText=modes,data="integer")
982
+ if mode is None:
983
+ return
984
+ elif mode in ['d',]:
985
+ mode=0
986
+ if not ((mode <= (ct-1)) and (mode >= 0)):
987
+ print(f"{Fore.orange_red_1}invalid mode:\n{mode}\ndefaulting to {Fore.light_green}SHOWALL!{Style.reset}")
988
+ mode=0
989
+ else:
990
+ if not ((mode <= (ct-1)) and (mode >= 0)):
991
+ print(f"{Fore.orange_red_1}invalid mode:\n{mode}\ndefaulting to {Fore.light_green}SHOWALL!{Style.reset}")
992
+ mode=0
990
993
 
991
- simple=Control(func=FormBuilderMkText,ptext="plain and simple y/n:",helpText="yes or no to absolute minimal output",data="boolean")
992
- if simple is None:
993
- return
994
- elif simple in ['d',]:
995
- simple=False
996
- def cse(code):
997
- with Session(db.ENGINE) as session:
998
- 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)))
999
- results=query.all()
1000
- ct=len(results)
1001
- if ct < 1:
1002
- print("No Results to Clear!")
1003
- return
1004
- helpText=[]
1005
- for num,i in enumerate(results):
1006
- msg=f"{Fore.cyan}{num}/{Fore.light_yellow}{num+1} of {Fore.light_red}{ct} -> {Fore.orange_red_1}{i.seeShort()}{Style.reset}"
1007
- helpText.append(msg)
1008
- helpText='\n'.join(helpText)
1009
- print(helpText)
1010
- selected=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Which index(es):",helpText=helpText,data="list")
1011
- try:
1012
- if selected in [None,'d',[]]:
994
+ simple=Control(func=FormBuilderMkText,ptext="plain and simple y/n:",helpText="yes or no to absolute minimal output",data="boolean")
995
+ if simple is None:
996
+ return
997
+ elif simple in ['d',]:
998
+ simple=False
999
+ def cse(code):
1000
+ with Session(db.ENGINE) as session:
1001
+ 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)))
1002
+ results=query.all()
1003
+ ct=len(results)
1004
+ if ct < 1:
1005
+ print("No Results to Clear!")
1013
1006
  return
1014
- for i in selected:
1015
- try:
1016
- index=int(i)
1017
- obj=results[index]
1018
- update={
1019
- 'InList':False,
1020
- 'ListQty':0,
1021
- 'Shelf':0,
1022
- 'Note':'',
1023
- 'BackRoom':0,
1024
- 'Distress':0,
1025
- 'Display_1':0,
1026
- 'Display_2':0,
1027
- 'Display_3':0,
1028
- 'Display_4':0,
1029
- 'Display_5':0,
1030
- 'Display_6':0,
1031
- 'Stock_Total':0,
1032
- 'CaseID_BR':'',
1033
- 'CaseID_LD':'',
1034
- 'CaseID_6W':'',
1035
- 'SBX_WTR_DSPLY':0,
1036
- 'SBX_CHP_DSPLY':0,
1037
- 'SBX_WTR_KLR':0,
1038
- 'FLRL_CHP_DSPLY':0,
1039
- 'FLRL_WTR_DSPLY':0,
1040
- 'WD_DSPLY':0,
1041
- 'CHKSTND_SPLY':0,
1042
- }
1043
- for i in update:
1044
- setattr(obj,i,update[i])
1045
- session.commit()
1046
- except Exception as ee:
1047
- print(ee)
1048
- except Exception as e:
1049
- print(e)
1050
- try:
1051
- TotalCRVItems=0
1052
- TotalItems=0
1053
- TTLQtyCrvItem=0
1054
- TotalLines=0
1055
- if (not justCount and not justTotal):
1056
- if not simple:
1057
- page=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Page Results?",helpText="wait for user input before displaying next item in list;yes or no",data="boolean")
1058
- if page is None:
1059
- return
1060
- elif page in ['d',False]:
1007
+ helpText=[]
1008
+ for num,i in enumerate(results):
1009
+ msg=f"{Fore.cyan}{num}/{Fore.light_yellow}{num+1} of {Fore.light_red}{ct} -> {Fore.orange_red_1}{i.seeShort()}{Style.reset}"
1010
+ helpText.append(msg)
1011
+ helpText='\n'.join(helpText)
1012
+ print(helpText)
1013
+ selected=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Which index(es):",helpText=helpText,data="list")
1014
+ try:
1015
+ if selected in [None,'d',[]]:
1016
+ return
1017
+ for i in selected:
1018
+ try:
1019
+ index=int(i)
1020
+ obj=results[index]
1021
+ update={
1022
+ 'InList':False,
1023
+ 'ListQty':0,
1024
+ 'Shelf':0,
1025
+ 'Note':'',
1026
+ 'BackRoom':0,
1027
+ 'Distress':0,
1028
+ 'Display_1':0,
1029
+ 'Display_2':0,
1030
+ 'Display_3':0,
1031
+ 'Display_4':0,
1032
+ 'Display_5':0,
1033
+ 'Display_6':0,
1034
+ 'Stock_Total':0,
1035
+ 'CaseID_BR':'',
1036
+ 'CaseID_LD':'',
1037
+ 'CaseID_6W':'',
1038
+ 'SBX_WTR_DSPLY':0,
1039
+ 'SBX_CHP_DSPLY':0,
1040
+ 'SBX_WTR_KLR':0,
1041
+ 'FLRL_CHP_DSPLY':0,
1042
+ 'FLRL_WTR_DSPLY':0,
1043
+ 'WD_DSPLY':0,
1044
+ 'CHKSTND_SPLY':0,
1045
+ }
1046
+ for i in update:
1047
+ setattr(obj,i,update[i])
1048
+ session.commit()
1049
+ except Exception as ee:
1050
+ print(ee)
1051
+ except Exception as e:
1052
+ print(e)
1053
+ try:
1054
+ TotalCRVItems=0
1055
+ TotalItems=0
1056
+ TTLQtyCrvItem=0
1057
+ TotalLines=0
1058
+ if (not justCount and not justTotal):
1059
+ if not simple:
1060
+ page=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Page Results?",helpText="wait for user input before displaying next item in list;yes or no",data="boolean")
1061
+ if page is None:
1062
+ return
1063
+ elif page in ['d',False]:
1064
+ page=False
1065
+ extras=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Show Extras?",helpText="extra data attached to each entry yes or no",data="boolean")
1066
+ if extras is None:
1067
+ return
1068
+ elif extras in ['d',False]:
1069
+ extras=False
1070
+
1071
+ else:
1061
1072
  page=False
1062
- extras=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Show Extras?",helpText="extra data attached to each entry yes or no",data="boolean")
1063
- if extras is None:
1064
- return
1065
- elif extras in ['d',False]:
1066
1073
  extras=False
1067
-
1068
1074
  else:
1069
1075
  page=False
1070
1076
  extras=False
1071
- else:
1072
- page=False
1073
- extras=False
1074
- msg=''
1075
- if bldlse:
1076
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file,clear_only=True)
1077
- with db.Session(db.ENGINE) as session:
1078
- results_query=session.query(db.Entry).filter(db.Entry.InList==True)
1079
- if sbld:
1080
- def mkT(text,data):
1081
- return text
1082
- code=Prompt.__init2__(None,func=mkT,ptext="Code|Barcode|Name: ",helpText="find by code,barcode,name",data='')
1083
- if code in [None,'d']:
1084
- return
1085
- results_query=results_query.filter(
1086
- db.or_(
1087
- db.Entry.Code==code,
1088
- db.Entry.Barcode==code,
1089
- db.Entry.Barcode.icontains(code),
1090
- db.Entry.Code.icontains(code),
1091
- db.Entry.Name.icontains(code)
1077
+ msg=''
1078
+ if bldlse:
1079
+ db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file,clear_only=True)
1080
+ with db.Session(db.ENGINE) as session:
1081
+ results_query=session.query(db.Entry).filter(db.Entry.InList==True)
1082
+ if sbld:
1083
+ def mkT(text,data):
1084
+ return text
1085
+ code=Prompt.__init2__(None,func=mkT,ptext="Code|Barcode|Name: ",helpText="find by code,barcode,name",data='')
1086
+ if code in [None,'d']:
1087
+ return
1088
+ results_query=results_query.filter(
1089
+ db.or_(
1090
+ db.Entry.Code==code,
1091
+ db.Entry.Barcode==code,
1092
+ db.Entry.Barcode.icontains(code),
1093
+ db.Entry.Code.icontains(code),
1094
+ db.Entry.Name.icontains(code)
1095
+ )
1096
+ )
1097
+ if db.BooleanAnswers.setFieldInList_MODES[mode] == 'ONLY_SHOW_CRV':
1098
+ results_query=results_query.filter(and_(db.Entry.CRV!=None,db.Entry.CRV!=0))
1099
+ elif db.BooleanAnswers.setFieldInList_MODES[mode] == 'ONLY_SHOW_TAXED':
1100
+ results_query=results_query.filter(and_(db.Entry.Tax!=None,db.Entry.Tax!=0))
1101
+ elif db.BooleanAnswers.setFieldInList_MODES[mode] == 'NO_CRV_NO_TAX':
1102
+ results_query=results_query.filter(
1103
+ and_(
1104
+ or_(db.Entry.Tax==None,db.Entry.Tax==0),
1105
+ or_(db.Entry.CRV==None,db.Entry.CRV==0),
1106
+ )
1107
+ )
1108
+ elif db.BooleanAnswers.setFieldInList_MODES[mode] =='CRV_UNTAXED':
1109
+ results_query=results_query.filter(
1110
+ and_(
1111
+ or_(db.Entry.Tax==None,db.Entry.Tax==0),
1112
+ not_(or_(db.Entry.CRV==None,db.Entry.CRV==0)),
1113
+ )
1114
+ )
1115
+ elif db.BooleanAnswers.setFieldInList_MODES[mode] =='NO_CRV_TAXED':
1116
+ results_query=results_query.filter(
1117
+ and_(
1118
+ not_(or_(db.Entry.Tax==None,db.Entry.Tax==0)),
1119
+ or_(db.Entry.CRV==None,db.Entry.CRV==0),
1120
+ )
1092
1121
  )
1093
- )
1094
- if db.BooleanAnswers.setFieldInList_MODES[mode] == 'ONLY_SHOW_CRV':
1095
- results_query=results_query.filter(and_(db.Entry.CRV!=None,db.Entry.CRV!=0))
1096
- elif db.BooleanAnswers.setFieldInList_MODES[mode] == 'ONLY_SHOW_TAXED':
1097
- results_query=results_query.filter(and_(db.Entry.Tax!=None,db.Entry.Tax!=0))
1098
- elif db.BooleanAnswers.setFieldInList_MODES[mode] == 'NO_CRV_NO_TAX':
1099
- results_query=results_query.filter(
1100
- and_(
1101
- or_(db.Entry.Tax==None,db.Entry.Tax==0),
1102
- or_(db.Entry.CRV==None,db.Entry.CRV==0),
1103
- )
1104
- )
1105
- elif db.BooleanAnswers.setFieldInList_MODES[mode] =='CRV_UNTAXED':
1106
- results_query=results_query.filter(
1107
- and_(
1108
- or_(db.Entry.Tax==None,db.Entry.Tax==0),
1109
- not_(or_(db.Entry.CRV==None,db.Entry.CRV==0)),
1110
- )
1111
- )
1112
- elif db.BooleanAnswers.setFieldInList_MODES[mode] =='NO_CRV_TAXED':
1113
- results_query=results_query.filter(
1114
- and_(
1115
- not_(or_(db.Entry.Tax==None,db.Entry.Tax==0)),
1116
- or_(db.Entry.CRV==None,db.Entry.CRV==0),
1117
- )
1118
- )
1119
-
1120
- 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"]
1121
- z=Prompt.mkfield_list(None,location_fields)
1122
- if z in [[],None]:
1123
- z=location_fields
1124
- location_fields=z
1125
- tmp=[]
1126
- for f in location_fields:
1127
- if not minus:
1128
- tmp.append(or_(getattr(db.Entry,f)>=0.0001))
1122
+
1123
+ 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"]
1124
+ z=Prompt.mkfield_list(None,location_fields)
1125
+ if z in [[],None]:
1126
+ z=location_fields
1127
+ location_fields=z
1128
+ tmp=[]
1129
+ for f in location_fields:
1130
+ if not minus:
1131
+ tmp.append(or_(getattr(db.Entry,f)>=0.0001))
1132
+ else:
1133
+ tmp.append(or_(getattr(db.Entry,f)!=0,getattr(db.Entry,f)!=None))
1134
+
1135
+ results_query=results_query.filter(or_(*tmp))
1136
+ LookUpState=db.detectGetOrSet('list maker lookup order',False,setValue=False,literal=False)
1137
+ if not isinstance(LookUpState,bool):
1138
+ LookUpState=db.detectGetOrSet('list maker lookup order',False,setValue=True,literal=False)
1139
+ if LookUpState == True:
1140
+ results=results_query.order_by(db.Entry.Timestamp.asc()).all()
1129
1141
  else:
1130
- tmp.append(or_(getattr(db.Entry,f)!=0,getattr(db.Entry,f)!=None))
1131
-
1132
- results_query=results_query.filter(or_(*tmp))
1133
- LookUpState=db.detectGetOrSet('list maker lookup order',False,setValue=False,literal=False)
1134
- if not isinstance(LookUpState,bool):
1135
- LookUpState=db.detectGetOrSet('list maker lookup order',False,setValue=True,literal=False)
1136
- if LookUpState == True:
1137
- results=results_query.order_by(db.Entry.Timestamp.asc()).all()
1138
- else:
1139
- results=results_query.order_by(db.Entry.Timestamp.desc()).all()
1140
- ct=len(results)
1141
- if ct < 1:
1142
- msg=f"{Fore.light_steel_blue}Nothing in {Fore.slate_blue_1}Bld{Fore.light_red}LS!{Style.reset}"
1143
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
1144
- print(msg)
1145
- return
1146
- #start
1147
-
1142
+ results=results_query.order_by(db.Entry.Timestamp.desc()).all()
1143
+ ct=len(results)
1144
+ if ct < 1:
1145
+ msg=f"{Fore.light_steel_blue}Nothing in {Fore.slate_blue_1}Bld{Fore.light_red}LS!{Style.reset}"
1146
+ db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
1147
+ print(msg)
1148
+ return
1149
+ #start
1150
+
1148
1151
 
1149
- master_total=decc("0.0000",cf=ROUNDTO)
1150
- master_total_crv=decc("0.00",cf=ROUNDTO)
1151
- master_total_tax=decc("0.0000",cf=ROUNDTO)
1152
- master_total_tax_crv=decc("0.0000",cf=ROUNDTO)
1152
+ master_total=decc("0.0000",cf=ROUNDTO)
1153
+ master_total_crv=decc("0.00",cf=ROUNDTO)
1154
+ master_total_tax=decc("0.0000",cf=ROUNDTO)
1155
+ master_total_tax_crv=decc("0.0000",cf=ROUNDTO)
1153
1156
 
1154
- reRunRequired=False
1155
- for num,i in enumerate(results):
1156
- getExtras(i.EntryId,extras)
1157
- if not simple:
1158
- chart="*"
1159
- else:
1160
- chart=''
1161
- if not simple:
1162
- msg=f'{f"{chart}"*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}|-| '
1163
- else:
1164
- msg=f'{num+1}/{ct} [Name] "{i.Name}" [Product Barcode] "{'-'.join(db.stre(i.Barcode)/6)}" [Product Barcode Processed] "{i.rebar()}" [Order Code] "{'-'.join(db.stre(i.Code)/4)}" '
1165
- colormapped=[
1166
- Fore.deep_sky_blue_4c,
1167
- Fore.spring_green_4,
1168
- Fore.turquoise_4,
1169
- Fore.dark_cyan,
1170
- Fore.deep_sky_blue_2,
1171
- Fore.spring_green_2a,
1172
- Fore.medium_spring_green,
1173
- Fore.steel_blue,
1174
- Fore.cadet_blue_1,
1175
- Fore.aquamarine_3,
1176
- Fore.purple_1a,
1177
- Fore.medium_purple_3a,
1178
- Fore.slate_blue_1,
1179
- Fore.light_slate_grey,
1180
- Fore.dark_olive_green_3a,
1181
- Fore.deep_pink_4c,
1182
- Fore.orange_3,
1183
- ]
1184
- #print("#0")
1185
- total=decc("0.0000",cf=ROUNDTO)
1186
- crv=decc("0.0000",cf=ROUNDTO)
1187
- tax=decc("0.0000",cf=ROUNDTO)
1188
- tax_crv=decc("0.0000",cf=ROUNDTO)
1189
- i.Tax=decc(i.Tax,cf=ROUNDTO)
1190
- i.CRV=decc(i.CRV,cf=ROUNDTO)
1191
- i.Price=decc(i.Price,cf=ROUNDTO)
1192
- try:
1193
- if (i.Price+i.CRV) > 0:
1194
- taxRate=decc(i.Tax/(i.Price+i.CRV),cf=ROUNDTO)
1157
+ reRunRequired=False
1158
+ for num,i in enumerate(results):
1159
+ getExtras(i.EntryId,extras)
1160
+ if not simple:
1161
+ chart="*"
1195
1162
  else:
1196
- taxRate=decc('0.00000',cf=ROUNDTO)
1163
+ chart=''
1164
+ if not simple:
1165
+ msg=f'{f"{chart}"*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}|-| '
1166
+ else:
1167
+ msg=f'{num+1}/{ct} [Name] "{i.Name}" [Product Barcode] "{'-'.join(db.stre(i.Barcode)/6)}" [Product Barcode Processed] "{i.rebar()}" [Order Code] "{'-'.join(db.stre(i.Code)/4)}" '
1168
+ colormapped=[
1169
+ Fore.deep_sky_blue_4c,
1170
+ Fore.spring_green_4,
1171
+ Fore.turquoise_4,
1172
+ Fore.dark_cyan,
1173
+ Fore.deep_sky_blue_2,
1174
+ Fore.spring_green_2a,
1175
+ Fore.medium_spring_green,
1176
+ Fore.steel_blue,
1177
+ Fore.cadet_blue_1,
1178
+ Fore.aquamarine_3,
1179
+ Fore.purple_1a,
1180
+ Fore.medium_purple_3a,
1181
+ Fore.slate_blue_1,
1182
+ Fore.light_slate_grey,
1183
+ Fore.dark_olive_green_3a,
1184
+ Fore.deep_pink_4c,
1185
+ Fore.orange_3,
1186
+ ]
1187
+ #print("#0")
1188
+ total=decc("0.0000",cf=ROUNDTO)
1189
+ crv=decc("0.0000",cf=ROUNDTO)
1190
+ tax=decc("0.0000",cf=ROUNDTO)
1191
+ tax_crv=decc("0.0000",cf=ROUNDTO)
1192
+ i.Tax=decc(i.Tax,cf=ROUNDTO)
1193
+ i.CRV=decc(i.CRV,cf=ROUNDTO)
1194
+ i.Price=decc(i.Price,cf=ROUNDTO)
1195
+ try:
1196
+ if (i.Price+i.CRV) > 0:
1197
+ taxRate=decc(i.Tax/(i.Price+i.CRV),cf=ROUNDTO)
1198
+ else:
1199
+ taxRate=decc('0.00000',cf=ROUNDTO)
1197
1200
 
1198
- except Exception as e:
1199
- taxRate=decc('0.00000',cf=ROUNDTO)
1200
- i.Tax=decc('0.0000',cf=ROUNDTO)
1201
- i.Price=decc('0.0000',cf=ROUNDTO)
1202
- i.CRV=decc('0.0000',cf=ROUNDTO)
1203
- session.commit()
1204
- session.refresh(i)
1201
+ except Exception as e:
1202
+ taxRate=decc('0.00000',cf=ROUNDTO)
1203
+ i.Tax=decc('0.0000',cf=ROUNDTO)
1204
+ i.Price=decc('0.0000',cf=ROUNDTO)
1205
+ i.CRV=decc('0.0000',cf=ROUNDTO)
1206
+ session.commit()
1207
+ session.refresh(i)
1205
1208
 
1206
- #print("#1")
1209
+ #print("#1")
1207
1210
 
1208
- if not minus:
1209
- for n2,f in enumerate(location_fields):
1210
- try:
1211
+ if not minus:
1212
+ for n2,f in enumerate(location_fields):
1213
+ try:
1214
+ if getattr(i,f) > 0:
1215
+ total+=decc(getattr(i,f),cf=ROUNDTO)
1216
+ except Exception as e:
1217
+ print(e)
1218
+ for n2,f in enumerate(location_fields):
1211
1219
  if getattr(i,f) > 0:
1212
- total+=decc(getattr(i,f),cf=ROUNDTO)
1213
- except Exception as e:
1214
- print(e)
1215
- for n2,f in enumerate(location_fields):
1216
- if getattr(i,f) > 0:
1217
- msg2=f'{colormapped[n2]}{f} = {decc(getattr(i,f),cf=ROUNDTO)}{Style.reset}'
1218
- if n2 < len(location_fields):
1219
- msg2+=","
1220
- msg+=msg2
1221
- else:
1222
- for n2,f in enumerate(location_fields):
1223
- try:
1224
- if getattr(i,f) != 0:
1225
- total+=decc(getattr(i,f),cf=ROUNDTO)
1226
- except Exception as e:
1227
- print(e)
1228
- for n2,f in enumerate(location_fields):
1229
- if getattr(i,f) != 0:
1230
- msg2=f'{colormapped[n2]}{f} = {decc(str(getattr(i,f)),cf=ROUNDTO)}{Style.reset}'
1231
- if n2 < len(location_fields):
1232
- msg2+=","
1233
- msg+=msg2
1234
-
1235
- master_total+=total*decc(i.Price,cf=ROUNDTO)
1236
-
1237
- crv+=(decc(i.CRV,cf=ROUNDTO)*total)
1238
- tax+=(decc(i.Tax,cf=ROUNDTO)*total)
1239
-
1240
- tax_crv=(crv+tax)
1241
- master_total_tax+=tax
1242
- master_total_crv+=crv
1243
- master_total_tax_crv+=tax_crv
1244
- #print("#exegen",type(total),type(tax_crv))
1245
- try:
1246
- #print((total*decc(i.Price)+tax_crv),"s1")
1247
- #print(decc(getSuperTotal(results,location_fields,colormapped)['final total']).quantize(decc("00.00")),"s2")
1248
- #print(tax_crv,"s3")
1249
- #super_total=(round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)/getSuperTotal(results,location_fields,colormapped)['final total'],ROUNDTO))*100
1250
- if (total*decc(i.Price,cf=ROUNDTO)+tax+crv) > 0:
1251
- super_total=(total*decc(i.Price)+tax+crv)/decc(getSuperTotal(results,location_fields,colormapped)['final total'],cf=ROUNDTO)
1252
- super_total=super_total*100
1220
+ msg2=f'{colormapped[n2]}{f} = {decc(getattr(i,f),cf=ROUNDTO)}{Style.reset}'
1221
+ if n2 < len(location_fields):
1222
+ msg2+=","
1223
+ msg+=msg2
1253
1224
  else:
1254
- super_total=0
1255
- except Exception as e:
1256
- p1=total*decc(i.Price,cf=ROUNDTO)+tax_crv
1257
- p2=decc(getSuperTotal(results,location_fields,colormapped)['final total'],cf=ROUNDTO)
1258
- print(e)
1259
- print(p1,"p1")
1260
- print(p2,"p2")
1261
- super_total=0
1262
- #print("#exegen2")
1263
- super_total=decc(super_total,cf=ROUNDTO)
1264
- #print(super_total)
1265
-
1266
- if simple:
1267
- msg+=f""" Total = {total}"""
1268
- print(db.strip_colors(msg))
1269
- else:
1270
- msg+=f"""{Fore.light_magenta} |-|{Fore.light_green} Total = {Fore.light_sea_green}{total}
1271
- {Fore.light_magenta}Price({decc(i.Price):.{getcontext().prec}f}){Fore.medium_violet_red}*{Fore.light_slate_blue}Total({total}):{decc(i.Price)*total:.{getcontext().prec}f}
1272
- {Fore.grey_70}+CRV({decc(i.CRV):.{getcontext().prec}f})*Total({total}){Fore.slate_blue_1}
1273
- {Fore.medium_spring_green}= {Fore.slate_blue_1}TotalCRV({crv:.{getcontext().prec}f})+TotalPrice({total*decc(i.Price):.{getcontext().prec}f})
1274
- {Fore.medium_spring_green}= {Fore.green_3a}NetPrice({total*decc(i.Price)+crv:.{getcontext().prec}f}){Style.reset}
1275
- {Fore.grey_70}+Tax({decc(i.Tax):.{getcontext().prec}f}) w/o CRV({decc(i.CRV):.{getcontext().prec}f})*Total({total}){Fore.slate_blue_1}
1276
- {Fore.medium_spring_green}= {Fore.slate_blue_1}TaxNoCRVTotal({tax:.{getcontext().prec}f})+TotalPrice({total*i.Price:.{getcontext().prec}f})
1277
- {Fore.medium_spring_green}= {Fore.green_3a}NetPrice({total*decc(i.Price)+tax:.{getcontext().prec}f}){Style.reset}
1278
- {Fore.grey_70}+Tax({decc(i.Tax):.{getcontext().prec}f}) w/ CRV({decc(i.CRV):.{getcontext().prec}f})*Total({total}){Fore.slate_blue_1}
1279
- {Fore.medium_spring_green}= {Fore.slate_blue_1}TaxCRVTotal({tax_crv:.{getcontext().prec}f})+TotalPrice({total*i.Price:.{getcontext().prec}f})
1280
- {Fore.medium_spring_green}= {Fore.green_3a}NetPrice({total*decc(i.Price)+tax+crv:.{getcontext().prec}f}){Style.reset}
1281
- {Fore.medium_violet_red}PercentOfTotal({super_total:.{getcontext().prec}f}%) of FinalTotal({getSuperTotal(results,location_fields,colormapped)['final total']})
1282
- {Fore.orange_red_1}TaxRate({taxRate:.{getcontext().prec}f})={decc(taxRate*100):.{getcontext().prec}f}%{Style.reset}
1283
- {'*'*os.get_terminal_size().columns}{Style.reset}"""
1284
- if bldlse:
1285
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
1286
- if not justCount and not justTotal:
1287
- if not simple:
1288
- print(msg)
1289
-
1290
- if i.CRV is not None:
1291
- if i.CRV != 0:
1292
- TotalCRVItems+=1
1293
- TTLQtyCrvItem+=(total)
1294
- TotalItems+=total
1295
- TotalLines+=1
1296
- if page:
1297
- nxt=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{Fore.orange_red_1}You MUST re-run cmd if using ed/ee{Fore.light_yellow}\nSee next item in list [Enter],stop paging [sp], backout to previous prompt[b],edit item [ee],clear entry [ce]?",helpText=f"{Fore.orange_red_1}You MUST re-run cmd if using ed/ee{Fore.light_yellow}\nSee next item in list [Enter],stop paging [sp], backout to previous prompt[b],edit item [ee],clear entry [ce]?",data="string")
1298
- if nxt is None:
1299
- return
1300
- elif nxt in ['d',]:
1301
- continue
1302
- elif nxt in ['sp',]:
1303
- page=False
1304
- continue
1305
- elif nxt in ['ee',]:
1306
- reRunRequired=True
1307
- TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).NewEntryMenu(code=i.Barcode)
1308
- continue
1309
- elif nxt in ['ce']:
1310
- reRunRequired=True
1311
- cse(i.Barcode)
1312
- continue
1313
-
1314
- #exit(f"here {master_total} {master_total_crv} {master_total_tax} {master_total_tax_crv}")
1315
- master_total=decc(str(master_total),cf=ROUNDTO)
1316
- master_total_crv=decc(str(master_total_crv),cf=ROUNDTO)
1317
- master_total_tax=decc(str(master_total_tax),cf=ROUNDTO)
1318
- master_total_tax_crv=decc(str(master_total_tax_crv),cf=ROUNDTO)
1225
+ for n2,f in enumerate(location_fields):
1226
+ try:
1227
+ if getattr(i,f) != 0:
1228
+ total+=decc(getattr(i,f),cf=ROUNDTO)
1229
+ except Exception as e:
1230
+ print(e)
1231
+ for n2,f in enumerate(location_fields):
1232
+ if getattr(i,f) != 0:
1233
+ msg2=f'{colormapped[n2]}{f} = {decc(str(getattr(i,f)),cf=ROUNDTO)}{Style.reset}'
1234
+ if n2 < len(location_fields):
1235
+ msg2+=","
1236
+ msg+=msg2
1319
1237
 
1320
- actual=(master_total_crv+master_total)+master_total_tax
1321
-
1238
+ master_total+=total*decc(i.Price,cf=ROUNDTO)
1322
1239
 
1323
- if not reRunRequired:
1324
- if justCount:
1325
- msg=f"""
1326
- {Fore.spring_green_3a}'Total Items'={Style.bold}{Fore.light_cyan}{TotalItems}{Style.reset}
1327
- {Fore.spring_green_3a}Total 'CRV Items' (each crv adds an xtra 1)={Fore.light_cyan}{TotalCRVItems}{Style.reset}
1328
- {Fore.spring_green_3a}Total 'CRV Items QTY Purchased' (each crv adds an xtra for total qty)={Fore.light_cyan}{TTLQtyCrvItem}{Style.reset}
1240
+ crv+=(decc(i.CRV,cf=ROUNDTO)*total)
1241
+ tax+=(decc(i.Tax,cf=ROUNDTO)*total)
1329
1242
 
1330
- {Fore.light_sea_green}'Total Items' + 'CRV Items' ={Fore.light_magenta}{TotalCRVItems+TotalItems}{Style.reset}
1331
- {Fore.light_sea_green}'Total Items' + 'CRV Items QTY Purchased' ={Fore.light_magenta}{TTLQtyCrvItem+TotalItems}{Style.reset}
1243
+ tax_crv=(crv+tax)
1244
+ master_total_tax+=tax
1245
+ master_total_crv+=crv
1246
+ master_total_tax_crv+=tax_crv
1247
+ #print("#exegen",type(total),type(tax_crv))
1248
+ try:
1249
+ #print((total*decc(i.Price)+tax_crv),"s1")
1250
+ #print(decc(getSuperTotal(results,location_fields,colormapped)['final total']).quantize(decc("00.00")),"s2")
1251
+ #print(tax_crv,"s3")
1252
+ #super_total=(round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)/getSuperTotal(results,location_fields,colormapped)['final total'],ROUNDTO))*100
1253
+ if (total*decc(i.Price,cf=ROUNDTO)+tax+crv) > 0:
1254
+ super_total=(total*decc(i.Price)+tax+crv)/decc(getSuperTotal(results,location_fields,colormapped)['final total'],cf=ROUNDTO)
1255
+ super_total=super_total*100
1256
+ else:
1257
+ super_total=0
1258
+ except Exception as e:
1259
+ p1=total*decc(i.Price,cf=ROUNDTO)+tax_crv
1260
+ p2=decc(getSuperTotal(results,location_fields,colormapped)['final total'],cf=ROUNDTO)
1261
+ print(e)
1262
+ print(p1,"p1")
1263
+ print(p2,"p2")
1264
+ super_total=0
1265
+ #print("#exegen2")
1266
+ super_total=decc(super_total,cf=ROUNDTO)
1267
+ #print(super_total)
1332
1268
 
1333
- {Fore.light_blue}'Total Lines'={Style.bold}{Fore.grey_70}{TotalLines}{Style.reset}
1334
- {Fore.light_blue}'Total Lines' + 'CRV Items'={Style.bold}{Fore.grey_70}{TotalLines+TotalCRVItems}{Style.reset}
1335
- {Fore.light_blue}'Total Lines' + 'CRV Items QTY Purchased'={Style.bold}{Fore.grey_70}{TotalLines+TotalCRVItems}{Style.reset}
1336
- {Style.reset}"""
1337
- if not simple:
1338
- print(msg)
1339
- return
1340
- if justTotal:
1341
- msg=f"""{Fore.light_green}Total Product Value
1342
- {Fore.orange_red_1}= {Style.bold}{Fore.slate_blue_1}{master_total}{Style.reset}
1343
- {Fore.light_green}Total Product Value w/CRV({master_total_crv})
1344
- {Fore.orange_red_1}= {Style.bold}{Fore.slate_blue_1}{master_total_crv+master_total}{Style.reset}
1345
- {Fore.light_green}Total Product Value Taxed({master_total_tax}) w/o CRV({master_total_crv})
1346
- {Fore.orange_red_1}= {Style.bold}{Fore.slate_blue_1}{master_total_tax+master_total}{Style.reset}
1347
- {Fore.light_green}Total Product Value Taxed({master_total_tax}) w/ CRV({master_total_crv})
1348
- {Fore.orange_red_1}= {Style.bold}{Fore.slate_blue_1}{actual}{Style.reset}
1349
- """
1350
- if not simple:
1351
- print(msg)
1352
- return
1269
+ if simple:
1270
+ msg+=f""" Total = {total}"""
1271
+ print(db.strip_colors(msg))
1272
+ else:
1273
+ msg+=f"""{Fore.light_magenta} |-|{Fore.light_green} Total = {Fore.light_sea_green}{total}
1274
+ {Fore.light_magenta}Price({decc(i.Price):.{getcontext().prec}f}){Fore.medium_violet_red}*{Fore.light_slate_blue}Total({total}):{decc(i.Price)*total:.{getcontext().prec}f}
1275
+ {Fore.grey_70}+CRV({decc(i.CRV):.{getcontext().prec}f})*Total({total}){Fore.slate_blue_1}
1276
+ {Fore.medium_spring_green}= {Fore.slate_blue_1}TotalCRV({crv:.{getcontext().prec}f})+TotalPrice({total*decc(i.Price):.{getcontext().prec}f})
1277
+ {Fore.medium_spring_green}= {Fore.green_3a}NetPrice({total*decc(i.Price)+crv:.{getcontext().prec}f}){Style.reset}
1278
+ {Fore.grey_70}+Tax({decc(i.Tax):.{getcontext().prec}f}) w/o CRV({decc(i.CRV):.{getcontext().prec}f})*Total({total}){Fore.slate_blue_1}
1279
+ {Fore.medium_spring_green}= {Fore.slate_blue_1}TaxNoCRVTotal({tax:.{getcontext().prec}f})+TotalPrice({total*i.Price:.{getcontext().prec}f})
1280
+ {Fore.medium_spring_green}= {Fore.green_3a}NetPrice({total*decc(i.Price)+tax:.{getcontext().prec}f}){Style.reset}
1281
+ {Fore.grey_70}+Tax({decc(i.Tax):.{getcontext().prec}f}) w/ CRV({decc(i.CRV):.{getcontext().prec}f})*Total({total}){Fore.slate_blue_1}
1282
+ {Fore.medium_spring_green}= {Fore.slate_blue_1}TaxCRVTotal({tax_crv:.{getcontext().prec}f})+TotalPrice({total*i.Price:.{getcontext().prec}f})
1283
+ {Fore.medium_spring_green}= {Fore.green_3a}NetPrice({total*decc(i.Price)+tax+crv:.{getcontext().prec}f}){Style.reset}
1284
+ {Fore.medium_violet_red}PercentOfTotal({super_total:.{getcontext().prec}f}%) of FinalTotal({getSuperTotal(results,location_fields,colormapped)['final total']})
1285
+ {Fore.orange_red_1}TaxRate({taxRate:.{getcontext().prec}f})={decc(taxRate*100):.{getcontext().prec}f}%{Style.reset}
1286
+ {'*'*os.get_terminal_size().columns}{Style.reset}"""
1287
+ if bldlse:
1288
+ db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
1289
+ if not justCount and not justTotal:
1290
+ if not simple:
1291
+ print(msg)
1292
+
1293
+ if i.CRV is not None:
1294
+ if i.CRV != 0:
1295
+ TotalCRVItems+=1
1296
+ TTLQtyCrvItem+=(total)
1297
+ TotalItems+=total
1298
+ TotalLines+=1
1299
+ if page:
1300
+ nxt=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{Fore.orange_red_1}You MUST re-run cmd if using ed/ee{Fore.light_yellow}\nSee next item in list [Enter],stop paging [sp], backout to previous prompt[b],edit item [ee],clear entry [ce]?",helpText=f"{Fore.orange_red_1}You MUST re-run cmd if using ed/ee{Fore.light_yellow}\nSee next item in list [Enter],stop paging [sp], backout to previous prompt[b],edit item [ee],clear entry [ce]?",data="string")
1301
+ if nxt is None:
1302
+ return
1303
+ elif nxt in ['d',]:
1304
+ continue
1305
+ elif nxt in ['sp',]:
1306
+ page=False
1307
+ continue
1308
+ elif nxt in ['ee',]:
1309
+ reRunRequired=True
1310
+ TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).NewEntryMenu(code=i.Barcode)
1311
+ continue
1312
+ elif nxt in ['ce']:
1313
+ reRunRequired=True
1314
+ cse(i.Barcode)
1315
+ continue
1353
1316
 
1317
+ #exit(f"here {master_total} {master_total_crv} {master_total_tax} {master_total_tax_crv}")
1318
+ master_total=decc(str(master_total),cf=ROUNDTO)
1319
+ master_total_crv=decc(str(master_total_crv),cf=ROUNDTO)
1320
+ master_total_tax=decc(str(master_total_tax),cf=ROUNDTO)
1321
+ master_total_tax_crv=decc(str(master_total_tax_crv),cf=ROUNDTO)
1354
1322
 
1355
- msg=f"""{Fore.light_green}Total Product Value
1356
- {Fore.orange_red_1}= {Style.bold}{Fore.slate_blue_1}{master_total}{Style.reset}
1357
- {Fore.light_green}Total Product Value w/CRV({master_total_crv})
1358
- {Fore.orange_red_1}= {Style.bold}{Fore.slate_blue_1}{master_total_crv+master_total}{Style.reset}
1359
- {Fore.light_green}Total Product Value Taxed({master_total_tax}) w/o CRV({master_total_crv})
1360
- {Fore.orange_red_1}= {Style.bold}{Fore.slate_blue_1}{master_total_tax+master_total}{Style.reset}
1361
- {Fore.light_green}Total Product Value Taxed({master_total_tax}) w/ CRV({master_total_crv})
1362
- {Fore.orange_red_1}= {Style.bold}{Fore.slate_blue_1}{actual}{Style.reset}
1363
- """
1364
- if page:
1365
- reviewRecieptLines=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Review Reciept Lines[y/N]",helpText="review line details for reciept to double check values",data="boolean")
1366
- else:
1367
- reviewRecieptLines=False
1323
+ actual=(master_total_crv+master_total)+master_total_tax
1324
+
1368
1325
 
1369
- if reviewRecieptLines is None:
1370
- return
1371
- elif reviewRecieptLines in ['d',False]:
1372
- pass
1373
- else:
1374
- msg+=f"""
1375
- {Fore.spring_green_3a}'Total Items'={Style.bold}{Fore.light_cyan}{TotalItems}{Style.reset}
1376
- {Fore.spring_green_3a}Total 'CRV Items' (each crv adds an xtra 1)={Fore.light_cyan}{TotalCRVItems}{Style.reset}
1377
- {Fore.spring_green_3a}Total 'CRV Items QTY Purchased' (each crv adds an xtra for total qty)={Fore.light_cyan}{TTLQtyCrvItem}{Style.reset}
1378
-
1379
- {Fore.light_sea_green}'Total Items' + 'CRV Items' ={Fore.light_magenta}{TotalCRVItems+TotalItems}{Style.reset}
1380
- {Fore.light_sea_green}'Total Items' + 'CRV Items QTY Purchased' ={Fore.light_magenta}{TTLQtyCrvItem+TotalItems}{Style.reset}
1381
-
1382
- {Fore.light_blue}'Total Lines'={Style.bold}{Fore.grey_70}{TotalLines}{Style.reset}
1383
- {Fore.light_blue}'Total Lines' + 'CRV Items'={Style.bold}{Fore.grey_70}{TotalLines+TotalCRVItems}{Style.reset}
1384
- {Fore.light_blue}'Total Lines' + 'CRV Items QTY Purchased'={Style.bold}{Fore.grey_70}{TotalLines+TotalCRVItems}{Style.reset}
1385
- {Style.reset}"""
1386
- else:
1387
- msg=f"{Fore.orange_red_1}You need to re-run lsbld to recalculate properly!{Style.reset}"
1388
- if bldlse:
1389
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
1390
- if not simple:
1391
- print(msg)
1392
- except Exception as e:
1393
- print(e,"you might try and re-run the cmd")
1326
+ if not reRunRequired:
1327
+ if justCount:
1328
+ msg=f"""
1329
+ {Fore.spring_green_3a}'Total Items'={Style.bold}{Fore.light_cyan}{TotalItems}{Style.reset}
1330
+ {Fore.spring_green_3a}Total 'CRV Items' (each crv adds an xtra 1)={Fore.light_cyan}{TotalCRVItems}{Style.reset}
1331
+ {Fore.spring_green_3a}Total 'CRV Items QTY Purchased' (each crv adds an xtra for total qty)={Fore.light_cyan}{TTLQtyCrvItem}{Style.reset}
1332
+
1333
+ {Fore.light_sea_green}'Total Items' + 'CRV Items' ={Fore.light_magenta}{TotalCRVItems+TotalItems}{Style.reset}
1334
+ {Fore.light_sea_green}'Total Items' + 'CRV Items QTY Purchased' ={Fore.light_magenta}{TTLQtyCrvItem+TotalItems}{Style.reset}
1335
+
1336
+ {Fore.light_blue}'Total Lines'={Style.bold}{Fore.grey_70}{TotalLines}{Style.reset}
1337
+ {Fore.light_blue}'Total Lines' + 'CRV Items'={Style.bold}{Fore.grey_70}{TotalLines+TotalCRVItems}{Style.reset}
1338
+ {Fore.light_blue}'Total Lines' + 'CRV Items QTY Purchased'={Style.bold}{Fore.grey_70}{TotalLines+TotalCRVItems}{Style.reset}
1339
+ {Style.reset}"""
1340
+ if not simple:
1341
+ print(msg)
1342
+ return
1343
+ if justTotal:
1344
+ msg=f"""{Fore.light_green}Total Product Value
1345
+ {Fore.orange_red_1}= {Style.bold}{Fore.slate_blue_1}{master_total}{Style.reset}
1346
+ {Fore.light_green}Total Product Value w/CRV({master_total_crv})
1347
+ {Fore.orange_red_1}= {Style.bold}{Fore.slate_blue_1}{master_total_crv+master_total}{Style.reset}
1348
+ {Fore.light_green}Total Product Value Taxed({master_total_tax}) w/o CRV({master_total_crv})
1349
+ {Fore.orange_red_1}= {Style.bold}{Fore.slate_blue_1}{master_total_tax+master_total}{Style.reset}
1350
+ {Fore.light_green}Total Product Value Taxed({master_total_tax}) w/ CRV({master_total_crv})
1351
+ {Fore.orange_red_1}= {Style.bold}{Fore.slate_blue_1}{actual}{Style.reset}
1352
+ """
1353
+ if not simple:
1354
+ print(msg)
1355
+ return
1394
1356
 
1395
- while True:
1396
- try:
1397
- lastTime=db.detectGetOrSet("PromptLastDTasFloat",datetime.now().timestamp())
1398
- buffer=[]
1399
- while True:
1400
- color1=Style.bold+Fore.medium_violet_red
1401
- color2=Fore.sea_green_2
1402
- color3=Fore.pale_violet_red_1
1403
- color4=color1
1404
- split_len=int(os.get_terminal_size().columns/2)
1405
- whereAmI=[str(Path.cwd())[i:i+split_len] for i in range(0, len(str(Path.cwd())), split_len)]
1406
- helpText2=f'''
1407
- {Fore.light_salmon_3a}DT:{Fore.light_salmon_1}{datetime.now()}{Style.reset}
1408
- {Fore.orchid}PATH:{Fore.dark_sea_green_5a}{'#'.join(whereAmI)}{Style.reset}
1409
- {Fore.light_salmon_1}System Version: {Back.grey_70}{Style.bold}{Fore.red}{VERSION}{Style.reset}'''.replace('#','\n')
1410
-
1411
- default_list=''
1412
- with db.Session(db.ENGINE) as session:
1413
- results=session.query(db.SystemPreference).filter(db.SystemPreference.name=="DefaultLists").all()
1414
- ct=len(results)
1415
- n=None
1416
- if ct <= 0:
1417
- pass
1418
- #print("no default tags")
1419
- else:
1420
- for num,r in enumerate(results):
1421
- try:
1422
- if r.default:
1423
- default_list=','.join(json.loads(r.value_4_Json2DictString).get("DefaultLists"))
1424
- break
1425
- except Exception as e:
1426
- print(e)
1427
1357
 
1428
- #{Back.dark_orange_3b}
1429
- now=datetime.now()
1430
- nowFloat=now.timestamp()
1431
- timeInshellStart=datetime.fromtimestamp(db.detectGetOrSet("InShellStart",nowFloat))
1432
- InShellElapsed=datetime.now()-timeInshellStart
1433
- lastCmdDT=None
1434
- with db.Session(db.ENGINE) as session:
1435
- lastCMD=session.query(db.PH).order_by(db.PH.dtoe.desc()).limit(2).all()
1436
- if len(lastCMD) >= 2:
1437
- lastCmdDT=lastCMD[1].dtoe
1438
- if lastCmdDT != None:
1439
- duration=now-lastCmdDT
1440
- else:
1441
- duration=None
1442
- def lineTotal():
1443
- total=0
1444
- if not Path("STDOUT.TXT").exists():
1445
- with Path("STDOUT.TXT").open("w") as log:
1446
- log.write("")
1447
-
1448
- with open(Path("STDOUT.TXT"),"r") as log:
1449
- total=len(log.readlines())
1450
- return total
1451
-
1452
- isit=now in HOLI
1453
- holiname=HOLI.get(now.strftime("%m/%d/%Y"))
1454
-
1455
- if not holiname:
1456
- holiname=f"""{Fore.orange_4b}Not a Holiday {Style.reset}"""
1457
- cwd=str(Path().cwd())
1458
- if callable(replace_ptext):
1459
- ptext=replace_ptext()
1460
- else:
1461
- ptext=ptext
1462
- 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}'
1463
- m=f"{holidate}|{Fore.light_blue}DUR="+str(datetime.now()-datetime.fromtimestamp(lastTime)).split(".")[0]
1464
- CHEAT=f'''{Fore.light_sea_green+((os.get_terminal_size().columns)-len(m))*'*'}
1465
- {Fore.light_steel_blue+os.get_terminal_size().columns*'*'}
1466
- {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)
1467
- {Fore.light_red+os.get_terminal_size().columns*'.'}
1468
- {Fore.rgb(55,191,78)}HFL:{Fore.rgb(55,130,191)}{lineTotal()}{Fore.light_red}{Fore.light_green}{Back.grey_15}'''
1469
- if alt_input is not None and callable(alt_input):
1470
- cmd=alt_input(f"{db.ROBS}{Fore.light_yellow}{db.ROBE}{'.'*os.get_terminal_size().columns}\n{db.ROBS}{Back.grey_15}{Fore.light_yellow}{db.ROBE}{ptext}{db.ROBS}{Fore.light_steel_blue}{db.ROBE}\n[{db.ROBS}{Fore.light_green}{db.ROBE}cheat/cht=brief cmd helpt{db.ROBS}{Fore.light_steel_blue}{db.ROBE}] ({db.ROBS}{Fore.orange_red_1}{db.ROBE}Exec{db.ROBS}{Fore.light_steel_blue}{db.ROBE})\n ->{db.ROBS}{Style.reset}{db.ROBE}")
1471
- else:
1472
- cmd=input(f"{db.ROBS}{Fore.light_yellow}{db.ROBE}{'.'*os.get_terminal_size().columns}\n{db.ROBS}{Back.grey_15}{Fore.light_yellow}{db.ROBE}{ptext}{db.ROBS}{Fore.light_steel_blue}{db.ROBE}\n[{db.ROBS}{Fore.light_green}{db.ROBE}cheat/cht=brief cmd helpt{db.ROBS}{Fore.light_steel_blue}{db.ROBE}] ({db.ROBS}{Fore.orange_red_1}{db.ROBE}Exec{db.ROBS}{Fore.light_steel_blue}{db.ROBE})\n ->{db.ROBS}{Style.reset}{db.ROBE}")
1473
-
1474
- def strip_null(text):
1475
- if '\0' in text:
1476
- return text.replace("\00","").replace("\0","")
1477
- else:
1478
- return text
1479
- cmd=strip_null(cmd)
1358
+ msg=f"""{Fore.light_green}Total Product Value
1359
+ {Fore.orange_red_1}= {Style.bold}{Fore.slate_blue_1}{master_total}{Style.reset}
1360
+ {Fore.light_green}Total Product Value w/CRV({master_total_crv})
1361
+ {Fore.orange_red_1}= {Style.bold}{Fore.slate_blue_1}{master_total_crv+master_total}{Style.reset}
1362
+ {Fore.light_green}Total Product Value Taxed({master_total_tax}) w/o CRV({master_total_crv})
1363
+ {Fore.orange_red_1}= {Style.bold}{Fore.slate_blue_1}{master_total_tax+master_total}{Style.reset}
1364
+ {Fore.light_green}Total Product Value Taxed({master_total_tax}) w/ CRV({master_total_crv})
1365
+ {Fore.orange_red_1}= {Style.bold}{Fore.slate_blue_1}{actual}{Style.reset}
1366
+ """
1367
+ if page:
1368
+ reviewRecieptLines=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Review Reciept Lines[y/N]",helpText="review line details for reciept to double check values",data="boolean")
1369
+ else:
1370
+ reviewRecieptLines=False
1480
1371
 
1481
- db.logInput(cmd)
1482
- print(f"{Fore.medium_violet_red}{os.get_terminal_size().columns*'.'}{Style.reset}",end='')
1483
-
1372
+ if reviewRecieptLines is None:
1373
+ return
1374
+ elif reviewRecieptLines in ['d',False]:
1375
+ pass
1376
+ else:
1377
+ msg+=f"""
1378
+ {Fore.spring_green_3a}'Total Items'={Style.bold}{Fore.light_cyan}{TotalItems}{Style.reset}
1379
+ {Fore.spring_green_3a}Total 'CRV Items' (each crv adds an xtra 1)={Fore.light_cyan}{TotalCRVItems}{Style.reset}
1380
+ {Fore.spring_green_3a}Total 'CRV Items QTY Purchased' (each crv adds an xtra for total qty)={Fore.light_cyan}{TTLQtyCrvItem}{Style.reset}
1381
+
1382
+ {Fore.light_sea_green}'Total Items' + 'CRV Items' ={Fore.light_magenta}{TotalCRVItems+TotalItems}{Style.reset}
1383
+ {Fore.light_sea_green}'Total Items' + 'CRV Items QTY Purchased' ={Fore.light_magenta}{TTLQtyCrvItem+TotalItems}{Style.reset}
1384
+
1385
+ {Fore.light_blue}'Total Lines'={Style.bold}{Fore.grey_70}{TotalLines}{Style.reset}
1386
+ {Fore.light_blue}'Total Lines' + 'CRV Items'={Style.bold}{Fore.grey_70}{TotalLines+TotalCRVItems}{Style.reset}
1387
+ {Fore.light_blue}'Total Lines' + 'CRV Items QTY Purchased'={Style.bold}{Fore.grey_70}{TotalLines+TotalCRVItems}{Style.reset}
1388
+ {Style.reset}"""
1389
+ else:
1390
+ msg=f"{Fore.orange_red_1}You need to re-run lsbld to recalculate properly!{Style.reset}"
1391
+ if bldlse:
1392
+ db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
1393
+ if not simple:
1394
+ print(msg)
1395
+ except Exception as e:
1396
+ print(e,"you might try and re-run the cmd")
1484
1397
 
1485
- def preProcess_RPLC(cmd):
1486
- if '#RPLC#' in cmd:
1487
- with db.Session(db.ENGINE) as session:
1488
- dflt=session.query(db.ClipBoord).filter(db.ClipBoord.defaultPaste==True).order_by(db.ClipBoord.doe.desc()).first()
1489
- if dflt:
1490
- print(f"""{Fore.orange_red_1}using #RPLC#='{Fore.light_blue}{dflt.cbValue}{Fore.orange_red_1}'
1491
- in {Fore.light_yellow}'{cmd.replace('#RPLC#',dflt.cbValue)}'{Style.reset}""")
1492
- return cmd.replace('#RPLC#',dflt.cbValue)
1398
+ while True:
1399
+ try:
1400
+ lastTime=db.detectGetOrSet("PromptLastDTasFloat",datetime.now().timestamp())
1401
+ buffer=[]
1402
+ while True:
1403
+ color1=Style.bold+Fore.medium_violet_red
1404
+ color2=Fore.sea_green_2
1405
+ color3=Fore.pale_violet_red_1
1406
+ color4=color1
1407
+ split_len=int(os.get_terminal_size().columns/2)
1408
+ whereAmI=[str(Path.cwd())[i:i+split_len] for i in range(0, len(str(Path.cwd())), split_len)]
1409
+ helpText2=f'''
1410
+ {Fore.light_salmon_3a}DT:{Fore.light_salmon_1}{datetime.now()}{Style.reset}
1411
+ {Fore.orchid}PATH:{Fore.dark_sea_green_5a}{'#'.join(whereAmI)}{Style.reset}
1412
+ {Fore.light_salmon_1}System Version: {Back.grey_70}{Style.bold}{Fore.red}{VERSION}{Style.reset}'''.replace('#','\n')
1413
+
1414
+ default_list=''
1415
+ with db.Session(db.ENGINE) as session:
1416
+ results=session.query(db.SystemPreference).filter(db.SystemPreference.name=="DefaultLists").all()
1417
+ ct=len(results)
1418
+ n=None
1419
+ if ct <= 0:
1420
+ pass
1421
+ #print("no default tags")
1493
1422
  else:
1494
- return cmd
1495
- print(f"{Fore.orange_red_1}nothing to use to replace {Fore.orange_4b}#RPLC#!{Style.reset}")
1423
+ for num,r in enumerate(results):
1424
+ try:
1425
+ if r.default:
1426
+ default_list=','.join(json.loads(r.value_4_Json2DictString).get("DefaultLists"))
1427
+ break
1428
+ except Exception as e:
1429
+ print(e)
1430
+
1431
+ #{Back.dark_orange_3b}
1432
+ now=datetime.now()
1433
+ nowFloat=now.timestamp()
1434
+ timeInshellStart=datetime.fromtimestamp(db.detectGetOrSet("InShellStart",nowFloat))
1435
+ InShellElapsed=datetime.now()-timeInshellStart
1436
+ lastCmdDT=None
1437
+ with db.Session(db.ENGINE) as session:
1438
+ lastCMD=session.query(db.PH).order_by(db.PH.dtoe.desc()).limit(2).all()
1439
+ if len(lastCMD) >= 2:
1440
+ lastCmdDT=lastCMD[1].dtoe
1441
+ if lastCmdDT != None:
1442
+ duration=now-lastCmdDT
1496
1443
  else:
1497
- return cmd
1498
- cmd=preProcess_RPLC(cmd)
1499
- def shelfCodeDetected(code):
1500
- try:
1501
- with db.Session(db.ENGINE) as session:
1502
- results=session.query(db.Entry).filter(db.Entry.Code==code).all()
1503
- ct=len(results)
1504
- except Exception as e:
1505
- print(e)
1506
- ct=0
1507
- 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}"
1508
-
1509
- def shelfBarcodeDetected(code):
1510
- try:
1511
- with db.Session(db.ENGINE) as session:
1512
- results=session.query(db.Entry).filter(db.Entry.Barcode==code).all()
1513
- ct=len(results)
1514
- #extra_data#
1515
- if len(code) in range(6,14):
1516
- pc.run(db.ENGINE,CODE=code)
1517
- except Exception as e:
1518
- print(e)
1519
- ct=0
1520
- if ct > 0:
1521
- 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}"
1444
+ duration=None
1445
+ def lineTotal():
1446
+ total=0
1447
+ if not Path("STDOUT.TXT").exists():
1448
+ with Path("STDOUT.TXT").open("w") as log:
1449
+ log.write("")
1450
+
1451
+ with open(Path("STDOUT.TXT"),"r") as log:
1452
+ total=len(log.readlines())
1453
+ return total
1454
+
1455
+ isit=now in HOLI
1456
+ holiname=HOLI.get(now.strftime("%m/%d/%Y"))
1457
+
1458
+ if not holiname:
1459
+ holiname=f"""{Fore.orange_4b}Not a Holiday {Style.reset}"""
1460
+ cwd=str(Path().cwd())
1461
+ if callable(replace_ptext):
1462
+ ptext=replace_ptext()
1522
1463
  else:
1523
- return ''
1524
- def shelfPCCodeDetected(code):
1525
- try:
1526
- with db.Session(db.ENGINE) as session:
1527
- results=session.query(db.PairCollection).filter(db.PairCollection.Code==code).all()
1528
- ct=len(results)
1529
- except Exception as e:
1530
- print(e)
1531
- ct=0
1532
- 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}"
1533
-
1534
- def shelfPCBarcodeDetected(code):
1535
- try:
1536
- with db.Session(db.ENGINE) as session:
1537
- results=session.query(db.PairCollection).filter(db.PairCollection.Barcode==code).all()
1538
- ct=len(results)
1539
- except Exception as e:
1540
- print(e)
1541
- ct=0
1542
- if ct > 0:
1543
- 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}"
1464
+ ptext=ptext
1465
+ 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}'
1466
+ m=f"{holidate}|{Fore.light_blue}DUR="+str(datetime.now()-datetime.fromtimestamp(lastTime)).split(".")[0]
1467
+ CHEAT=f'''{Fore.light_sea_green+((os.get_terminal_size().columns)-len(m))*'*'}
1468
+ {Fore.light_steel_blue+os.get_terminal_size().columns*'*'}
1469
+ {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)
1470
+ {Fore.light_red+os.get_terminal_size().columns*'.'}
1471
+ {Fore.rgb(55,191,78)}HFL:{Fore.rgb(55,130,191)}{lineTotal()}{Fore.light_red}{Fore.light_green}{Back.grey_15}'''
1472
+ if alt_input is not None and callable(alt_input):
1473
+ cmd=alt_input(f"{db.ROBS}{Fore.light_yellow}{db.ROBE}{'.'*os.get_terminal_size().columns}\n{db.ROBS}{Back.grey_15}{Fore.light_yellow}{db.ROBE}{ptext}{db.ROBS}{Fore.light_steel_blue}{db.ROBE}\n[{db.ROBS}{Fore.light_green}{db.ROBE}cheat/cht=brief cmd helpt{db.ROBS}{Fore.light_steel_blue}{db.ROBE}] ({db.ROBS}{Fore.orange_red_1}{db.ROBE}Exec{db.ROBS}{Fore.light_steel_blue}{db.ROBE})\n ->{db.ROBS}{Style.reset}{db.ROBE}")
1544
1474
  else:
1545
- return ''
1546
-
1475
+ cmd=input(f"{db.ROBS}{Fore.light_yellow}{db.ROBE}{'.'*os.get_terminal_size().columns}\n{db.ROBS}{Back.grey_15}{Fore.light_yellow}{db.ROBE}{ptext}{db.ROBS}{Fore.light_steel_blue}{db.ROBE}\n[{db.ROBS}{Fore.light_green}{db.ROBE}cheat/cht=brief cmd helpt{db.ROBS}{Fore.light_steel_blue}{db.ROBE}] ({db.ROBS}{Fore.orange_red_1}{db.ROBE}Exec{db.ROBS}{Fore.light_steel_blue}{db.ROBE})\n ->{db.ROBS}{Style.reset}{db.ROBE}")
1476
+
1477
+ def strip_null(text):
1478
+ if '\0' in text:
1479
+ return text.replace("\00","").replace("\0","")
1480
+ else:
1481
+ return text
1482
+ cmd=strip_null(cmd)
1547
1483
 
1484
+ db.logInput(cmd)
1485
+ print(f"{Fore.medium_violet_red}{os.get_terminal_size().columns*'.'}{Style.reset}",end='')
1486
+
1548
1487
 
1549
- def detectShelfCode(cmd):
1550
- if cmd.startswith('*') and cmd.endswith('*') and len(cmd) - 2 == 8:
1551
- pattern=r"\*\d*\*"
1552
- shelfPattern=re.findall(pattern,cmd)
1553
- if len(shelfPattern) > 0:
1554
- #extra for shelf tag code
1555
- scMsg=f'{shelfCodeDetected(cmd[1:-1])}:{shelfPCCodeDetected(cmd[1:-1])}'
1556
- print(scMsg)
1557
- return cmd[1:-1]
1488
+ def preProcess_RPLC(cmd):
1489
+ if '#RPLC#' in cmd:
1490
+ with db.Session(db.ENGINE) as session:
1491
+ dflt=session.query(db.ClipBoord).filter(db.ClipBoord.defaultPaste==True).order_by(db.ClipBoord.doe.desc()).first()
1492
+ if dflt:
1493
+ print(f"""{Fore.orange_red_1}using #RPLC#='{Fore.light_blue}{dflt.cbValue}{Fore.orange_red_1}'
1494
+ in {Fore.light_yellow}'{cmd.replace('#RPLC#',dflt.cbValue)}'{Style.reset}""")
1495
+ return cmd.replace('#RPLC#',dflt.cbValue)
1496
+ else:
1497
+ return cmd
1498
+ print(f"{Fore.orange_red_1}nothing to use to replace {Fore.orange_4b}#RPLC#!{Style.reset}")
1558
1499
  else:
1559
1500
  return cmd
1560
- else:
1561
- return cmd
1562
- bcdMsg=f'{shelfPCBarcodeDetected(cmd)}:{shelfBarcodeDetected(cmd)}'
1563
- print(bcdMsg)
1564
-
1565
- def GetAsciiOnly(cmd):
1566
- hws='\x1bOP\x1bOP'
1567
- #hws='OPOP'
1568
- tmp=cmd
1569
- stripped=''
1570
- if cmd.startswith(hws):
1571
- tmp=cmd[len(hws):]
1572
-
1573
- removed=[]
1574
- for i in tmp:
1575
- if i in string.printable:
1576
- stripped+=i
1501
+ cmd=preProcess_RPLC(cmd)
1502
+ def shelfCodeDetected(code):
1503
+ try:
1504
+ with db.Session(db.ENGINE) as session:
1505
+ results=session.query(db.Entry).filter(db.Entry.Code==code).all()
1506
+ ct=len(results)
1507
+ except Exception as e:
1508
+ print(e)
1509
+ ct=0
1510
+ 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}"
1511
+
1512
+ def shelfBarcodeDetected(code):
1513
+ try:
1514
+ with db.Session(db.ENGINE) as session:
1515
+ results=session.query(db.Entry).filter(db.Entry.Barcode==code).all()
1516
+ ct=len(results)
1517
+ #extra_data#
1518
+ if len(code) in range(6,14):
1519
+ pc.run(db.ENGINE,CODE=code)
1520
+ except Exception as e:
1521
+ print(e)
1522
+ ct=0
1523
+ if ct > 0:
1524
+ 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}"
1577
1525
  else:
1578
- try:
1579
- print(ord(i),i)
1580
- #replace i with string representing emogi
1581
- except Exception as e:
1582
- pass
1583
-
1584
- removed.append(i)
1526
+ return ''
1527
+ def shelfPCCodeDetected(code):
1528
+ try:
1529
+ with db.Session(db.ENGINE) as session:
1530
+ results=session.query(db.PairCollection).filter(db.PairCollection.Code==code).all()
1531
+ ct=len(results)
1532
+ except Exception as e:
1533
+ print(e)
1534
+ ct=0
1535
+ 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}"
1585
1536
 
1537
+ def shelfPCBarcodeDetected(code):
1538
+ try:
1539
+ with db.Session(db.ENGINE) as session:
1540
+ results=session.query(db.PairCollection).filter(db.PairCollection.Barcode==code).all()
1541
+ ct=len(results)
1542
+ except Exception as e:
1543
+ print(e)
1544
+ ct=0
1545
+ if ct > 0:
1546
+ 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}"
1547
+ else:
1548
+ return ''
1549
+
1550
+
1551
+
1552
+ def detectShelfCode(cmd):
1553
+ if cmd.startswith('*') and cmd.endswith('*') and len(cmd) - 2 == 8:
1554
+ pattern=r"\*\d*\*"
1555
+ shelfPattern=re.findall(pattern,cmd)
1556
+ if len(shelfPattern) > 0:
1557
+ #extra for shelf tag code
1558
+ scMsg=f'{shelfCodeDetected(cmd[1:-1])}:{shelfPCCodeDetected(cmd[1:-1])}'
1559
+ print(scMsg)
1560
+ return cmd[1:-1]
1561
+ else:
1562
+ return cmd
1563
+ else:
1564
+ return cmd
1565
+ bcdMsg=f'{shelfPCBarcodeDetected(cmd)}:{shelfBarcodeDetected(cmd)}'
1566
+ print(bcdMsg)
1586
1567
 
1587
- #if stripped.startswith("OPOP"):
1588
- # stripped=stripped[len("OPOP"):]
1589
- ex=f"stripped({[hws.encode(),]})\n"
1590
- if not cmd.startswith(hws):
1591
- ex=''
1592
- ex1=f"stripped('{removed}')\n"
1593
- if len(removed) <= 0:
1594
- ex1=''
1595
- try:
1596
- msg=f'''{'.'*10}\n{Fore.grey_50}{Style.bold}Input Diagnostics
1597
- Input Data({Fore.light_green}{cmd.encode()}{Fore.grey_50}){Style.reset}{Fore.light_salmon_1}
1598
- {ex1}{ex}{Fore.light_blue}finalCmd('{stripped}')\n{'.'*10}
1599
- cmd_len={len(cmd)}{Style.reset}'''
1600
- except Exception as e:
1601
- print(e)
1568
+ def GetAsciiOnly(cmd):
1569
+ hws='\x1bOP\x1bOP'
1570
+ #hws='OPOP'
1571
+ tmp=cmd
1572
+ stripped=''
1573
+ if cmd.startswith(hws):
1574
+ tmp=cmd[len(hws):]
1575
+
1576
+ removed=[]
1577
+ for i in tmp:
1578
+ if i in string.printable:
1579
+ stripped+=i
1580
+ else:
1581
+ try:
1582
+ print(ord(i),i)
1583
+ #replace i with string representing emogi
1584
+ except Exception as e:
1585
+ pass
1586
+
1587
+ removed.append(i)
1588
+
1589
+
1590
+ #if stripped.startswith("OPOP"):
1591
+ # stripped=stripped[len("OPOP"):]
1592
+ ex=f"stripped({[hws.encode(),]})\n"
1593
+ if not cmd.startswith(hws):
1594
+ ex=''
1595
+ ex1=f"stripped('{removed}')\n"
1596
+ if len(removed) <= 0:
1597
+ ex1=''
1602
1598
  try:
1603
- detector = chardet.universaldetector.UniversalDetector()
1604
- detector.feed(cmd)
1605
- detector.close()
1606
- encoding=detector.result['encoding']
1607
1599
  msg=f'''{'.'*10}\n{Fore.grey_50}{Style.bold}Input Diagnostics
1608
- Input Data({Fore.light_green}{bytes(cmd,encoding)}{Fore.grey_50}){Style.reset}{Fore.light_salmon_1}
1609
- {ex1}{ex}{Fore.light_blue}finalCmd('{stripped}')\n{'.'*10}
1610
- cmd_len={len(cmd)}{Style.reset}'''
1600
+ Input Data({Fore.light_green}{cmd.encode()}{Fore.grey_50}){Style.reset}{Fore.light_salmon_1}
1601
+ {ex1}{ex}{Fore.light_blue}finalCmd('{stripped}')\n{'.'*10}
1602
+ cmd_len={len(cmd)}{Style.reset}'''
1611
1603
  except Exception as e:
1612
- msg=f'''{'.'*10}\n{Fore.grey_50}{Style.bold}Input Diagnostics
1613
- 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}
1614
- {ex1}{ex}{Fore.light_blue}finalCmd('{stripped}')\n{'.'*10}
1615
- cmd_len={len(cmd)}{Style.reset}'''
1616
- print(msg)
1617
- return stripped
1618
- #QR Codes with honeywell voyager 1602ug have an issue this filters it
1619
- def GetAsciiOnly2(cmd):
1620
- hws='\x1b[B'
1621
- tmp=cmd
1622
- stripped=''
1623
- if cmd.endswith(hws):
1624
- tmp=cmd[:-1*len(hws)]
1625
- return tmp
1626
- return cmd
1627
-
1628
- def detectGetOrSet(name,length):
1629
- with db.Session(db.ENGINE) as session:
1630
- q=session.query(db.SystemPreference).filter(db.SystemPreference.name==name).first()
1631
- value=None
1632
- if q:
1604
+ print(e)
1633
1605
  try:
1634
- value=json.loads(q.value_4_Json2DictString)[name]
1606
+ detector = chardet.universaldetector.UniversalDetector()
1607
+ detector.feed(cmd)
1608
+ detector.close()
1609
+ encoding=detector.result['encoding']
1610
+ msg=f'''{'.'*10}\n{Fore.grey_50}{Style.bold}Input Diagnostics
1611
+ Input Data({Fore.light_green}{bytes(cmd,encoding)}{Fore.grey_50}){Style.reset}{Fore.light_salmon_1}
1612
+ {ex1}{ex}{Fore.light_blue}finalCmd('{stripped}')\n{'.'*10}
1613
+ cmd_len={len(cmd)}{Style.reset}'''
1635
1614
  except Exception as e:
1636
- q.value_4_Json2DictString=json.dumps({name:length})
1615
+ msg=f'''{'.'*10}\n{Fore.grey_50}{Style.bold}Input Diagnostics
1616
+ 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}
1617
+ {ex1}{ex}{Fore.light_blue}finalCmd('{stripped}')\n{'.'*10}
1618
+ cmd_len={len(cmd)}{Style.reset}'''
1619
+ print(msg)
1620
+ return stripped
1621
+ #QR Codes with honeywell voyager 1602ug have an issue this filters it
1622
+ def GetAsciiOnly2(cmd):
1623
+ hws='\x1b[B'
1624
+ tmp=cmd
1625
+ stripped=''
1626
+ if cmd.endswith(hws):
1627
+ tmp=cmd[:-1*len(hws)]
1628
+ return tmp
1629
+ return cmd
1630
+
1631
+ def detectGetOrSet(name,length):
1632
+ with db.Session(db.ENGINE) as session:
1633
+ q=session.query(db.SystemPreference).filter(db.SystemPreference.name==name).first()
1634
+ value=None
1635
+ if q:
1636
+ try:
1637
+ value=json.loads(q.value_4_Json2DictString)[name]
1638
+ except Exception as e:
1639
+ q.value_4_Json2DictString=json.dumps({name:length})
1640
+ session.commit()
1641
+ session.refresh(q)
1642
+ value=json.loads(q.value_4_Json2DictString)[name]
1643
+ else:
1644
+ q=db.SystemPreference(name=name,value_4_Json2DictString=json.dumps({name:length}))
1645
+ session.add(q)
1637
1646
  session.commit()
1638
1647
  session.refresh(q)
1639
1648
  value=json.loads(q.value_4_Json2DictString)[name]
1649
+ return value
1650
+
1651
+ cmd=GetAsciiOnly2(cmd)
1652
+ cmd=GetAsciiOnly(cmd)
1653
+ scanout=Path(detectGetOrSet('CMD_TO_FILE',str(Path('./SCANNER.TXT'))))
1654
+
1655
+ ml_delim=str(detectGetOrSet('ML_DELIM',str(Path('#ml#'))))
1656
+ if cmd.startswith(ml_delim) and not cmd.endswith(ml_delim):
1657
+ msg=f'''
1658
+ {Fore.light_steel_blue}
1659
+ Generate the Barcodes for using Code128 as the Code Type
1660
+ {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}
1661
+ {Fore.light_green}Use a Hex editor to convert alpha-numeric values to hex and use the below codes
1662
+ Scan the code sequence for 9,9 to set all prefixes and suffixes to
1663
+ {Fore.light_steel_blue}
1664
+ {Fore.grey_70}K0K - 0,{Fore.cyan}K1K - 1,{Fore.grey_70}K3K - 3,{Fore.cyan}K4K - 4,{Fore.grey_70}K5K - 5,{Fore.cyan}K6K - 6,{Fore.grey_70}K7K - 7,{Fore.cyan}K8K - 8,{Fore.grey_70}K9K - 9,{Fore.cyan}KAK - A,{Fore.grey_70}KBK - B,{Fore.cyan}KCK - C,{Fore.grey_70}KDK - D,{Fore.cyan}KEK - E,{Fore.grey_70}KFK - F{Style.reset}
1665
+ {Fore.light_red}{Style.bold}You WILL need the scanners programming chart until further notice
1666
+ and the honeywell set prefix/suffix is {ml_delim}
1667
+ {Fore.light_yellow}The Sequences needed to be scanned are
1668
+ -------------
1669
+ Prefix {ml_delim}
1670
+ -------------
1671
+ PRECA2
1672
+ PREBK2
1673
+ 9,9
1674
+ 2,3
1675
+ 6,8
1676
+ 7,7
1677
+ 2,3
1678
+ MNUSAV
1679
+ --------------
1680
+ Suffix {ml_delim}\\n
1681
+ --------------
1682
+ SUFCA2
1683
+ SUFBK2
1684
+ 9,9
1685
+ 2,3
1686
+ 6,8
1687
+ 7,7
1688
+ 2,3
1689
+ 0,D
1690
+ MNUSAV
1691
+ {Style.reset}
1692
+ '''
1693
+ print(msg)
1694
+ 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}")
1695
+ buffer.append(cmd)
1696
+ continue
1697
+ elif cmd.startswith(ml_delim) and cmd.endswith(ml_delim):
1698
+ if len(buffer) > 0:
1699
+ buffer.append(cmd)
1700
+ #cmd=''.join(buffer).replace(ml_delim,'')
1701
+ cmd='\n'.join(buffer)[len(ml_delim):-len(ml_delim)]
1640
1702
  else:
1641
- q=db.SystemPreference(name=name,value_4_Json2DictString=json.dumps({name:length}))
1642
- session.add(q)
1643
- session.commit()
1644
- session.refresh(q)
1645
- value=json.loads(q.value_4_Json2DictString)[name]
1646
- return value
1647
-
1648
- cmd=GetAsciiOnly2(cmd)
1649
- cmd=GetAsciiOnly(cmd)
1650
- scanout=Path(detectGetOrSet('CMD_TO_FILE',str(Path('./SCANNER.TXT'))))
1651
-
1652
- ml_delim=str(detectGetOrSet('ML_DELIM',str(Path('#ml#'))))
1653
- if cmd.startswith(ml_delim) and not cmd.endswith(ml_delim):
1654
- msg=f'''
1655
- {Fore.light_steel_blue}
1656
- Generate the Barcodes for using Code128 as the Code Type
1657
- {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}
1658
- {Fore.light_green}Use a Hex editor to convert alpha-numeric values to hex and use the below codes
1659
- Scan the code sequence for 9,9 to set all prefixes and suffixes to
1660
- {Fore.light_steel_blue}
1661
- {Fore.grey_70}K0K - 0,{Fore.cyan}K1K - 1,{Fore.grey_70}K3K - 3,{Fore.cyan}K4K - 4,{Fore.grey_70}K5K - 5,{Fore.cyan}K6K - 6,{Fore.grey_70}K7K - 7,{Fore.cyan}K8K - 8,{Fore.grey_70}K9K - 9,{Fore.cyan}KAK - A,{Fore.grey_70}KBK - B,{Fore.cyan}KCK - C,{Fore.grey_70}KDK - D,{Fore.cyan}KEK - E,{Fore.grey_70}KFK - F{Style.reset}
1662
- {Fore.light_red}{Style.bold}You WILL need the scanners programming chart until further notice
1663
- and the honeywell set prefix/suffix is {ml_delim}
1664
- {Fore.light_yellow}The Sequences needed to be scanned are
1665
- -------------
1666
- Prefix {ml_delim}
1667
- -------------
1668
- PRECA2
1669
- PREBK2
1670
- 9,9
1671
- 2,3
1672
- 6,8
1673
- 7,7
1674
- 2,3
1675
- MNUSAV
1676
- --------------
1677
- Suffix {ml_delim}\\n
1678
- --------------
1679
- SUFCA2
1680
- SUFBK2
1681
- 9,9
1682
- 2,3
1683
- 6,8
1684
- 7,7
1685
- 2,3
1686
- 0,D
1687
- MNUSAV
1688
- {Style.reset}
1689
- '''
1690
- print(msg)
1691
- 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}")
1692
- buffer.append(cmd)
1693
- continue
1694
- elif cmd.startswith(ml_delim) and cmd.endswith(ml_delim):
1695
- if len(buffer) > 0:
1703
+ #cmd=cmd.replace(ml_delim,'')
1704
+ cmd=cmd[len(ml_delim):-len(ml_delim)]
1705
+ with scanout.open("w+") as out:
1706
+ out.write(cmd)
1707
+ elif not cmd.startswith(ml_delim) and cmd.endswith(ml_delim):
1696
1708
  buffer.append(cmd)
1697
- #cmd=''.join(buffer).replace(ml_delim,'')
1709
+ nl='\n'
1710
+ cmd_proto=TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).process_cmd(buffer)
1711
+ print(cmd_proto)
1698
1712
  cmd='\n'.join(buffer)[len(ml_delim):-len(ml_delim)]
1699
- else:
1700
- #cmd=cmd.replace(ml_delim,'')
1701
- cmd=cmd[len(ml_delim):-len(ml_delim)]
1702
1713
  with scanout.open("w+") as out:
1703
1714
  out.write(cmd)
1704
- elif not cmd.startswith(ml_delim) and cmd.endswith(ml_delim):
1705
- buffer.append(cmd)
1706
- nl='\n'
1707
- cmd_proto=TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).process_cmd(buffer)
1708
- print(cmd_proto)
1709
- cmd='\n'.join(buffer)[len(ml_delim):-len(ml_delim)]
1710
- with scanout.open("w+") as out:
1711
- out.write(cmd)
1712
- msg=f'''
1713
- {Fore.light_steel_blue}
1714
- Generate the Barcodes for using Code128 as the Code Type
1715
- {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}
1716
- {Fore.light_green}Use a Hex editor to convert alpha-numeric values to hex and use the below codes
1717
- Scan the code sequence for 9,9 to set all prefixes and suffixes to
1718
- {Fore.light_steel_blue}
1719
- {Fore.grey_70}K0K - 0,{Fore.cyan}K1K - 1,{Fore.grey_70}K3K - 3,{Fore.cyan}K4K - 4,{Fore.grey_70}K5K - 5,{Fore.cyan}K6K - 6,{Fore.grey_70}K7K - 7,{Fore.cyan}K8K - 8,{Fore.grey_70}K9K - 9,{Fore.cyan}KAK - A,{Fore.grey_70}KBK - B,{Fore.cyan}KCK - C,{Fore.grey_70}KDK - D,{Fore.cyan}KEK - E,{Fore.grey_70}KFK - F{Style.reset}
1720
- {Fore.light_red}{Style.bold}You WILL need the scanners programming chart until further notice
1721
- and the honeywell set prefix/suffix is {ml_delim}
1722
- {Fore.light_yellow}The Sequences needed to be scanned are
1723
- -------------
1724
- Prefix {ml_delim}
1725
- -------------
1726
- PRECA2
1727
- PREBK2
1728
- 9,9
1729
- 2,3
1730
- 6,8
1731
- 7,7
1732
- 2,3
1733
- MNUSAV
1734
- --------------
1735
- Suffix {ml_delim}\\n
1736
- --------------
1737
- SUFCA2
1738
- SUFBK2
1739
- 9,9
1740
- 2,3
1741
- 6,8
1742
- 7,7
1743
- 2,3
1744
- 0,D
1745
- MNUSAV
1746
- {Style.reset}
1747
- '''
1748
- print(msg)
1749
- debuffer=f'{nl}'.join(buffer)
1750
- 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}")
1751
-
1752
- buffer=[]
1753
- elif not cmd.startswith(ml_delim) and not cmd.endswith(ml_delim) and len(buffer) > 0:
1754
- msg=f'''
1755
- {Fore.light_steel_blue}
1756
- Generate the Barcodes for using Code128 as the Code Type
1757
- {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}
1758
- {Fore.light_green}Use a Hex editor to convert alpha-numeric values to hex and use the below codes
1759
- Scan the code sequence for 9,9 to set all prefixes and suffixes to
1760
- {Fore.light_steel_blue}
1761
- {Fore.grey_70}K0K - 0,{Fore.cyan}K1K - 1,{Fore.grey_70}K3K - 3,{Fore.cyan}K4K - 4,{Fore.grey_70}K5K - 5,{Fore.cyan}K6K - 6,{Fore.grey_70}K7K - 7,{Fore.cyan}K8K - 8,{Fore.grey_70}K9K - 9,{Fore.cyan}KAK - A,{Fore.grey_70}KBK - B,{Fore.cyan}KCK - C,{Fore.grey_70}KDK - D,{Fore.cyan}KEK - E,{Fore.grey_70}KFK - F{Style.reset}
1762
- {Fore.light_red}{Style.bold}You WILL need the scanners programming chart until further notice
1763
- and the honeywell set prefix/suffix is {ml_delim}
1764
- {Fore.light_yellow}The Sequences needed to be scanned are
1765
- -------------
1766
- Prefix {ml_delim}
1767
- -------------
1768
- PRECA2
1769
- PREBK2
1770
- 9,9
1771
- 2,3
1772
- 6,8
1773
- 7,7
1774
- 2,3
1775
- MNUSAV
1776
- --------------
1777
- Suffix {ml_delim}\\n
1778
- --------------
1779
- SUFCA2
1780
- SUFBK2
1781
- 9,9
1782
- 2,3
1783
- 6,8
1784
- 7,7
1785
- 2,3
1786
- 0,D
1787
- MNUSAV
1788
- {Style.reset}
1789
- '''
1790
- print(msg)
1791
- print(f"""{Fore.orange_red_1}An Incomplete Scan Occurred;
1792
- type the remainder of the command to add it to the buffer,
1793
- Please Finish with end of cmd followed immediately by {Fore.magenta}{ml_delim}{Style.reset}.
1794
- CMD's are not final until ended with {Fore.magenta}{ml_delim}{Style.reset}""")
1795
- buffer.append(cmd)
1796
- print(buffer)
1797
- continue
1715
+ msg=f'''
1716
+ {Fore.light_steel_blue}
1717
+ Generate the Barcodes for using Code128 as the Code Type
1718
+ {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}
1719
+ {Fore.light_green}Use a Hex editor to convert alpha-numeric values to hex and use the below codes
1720
+ Scan the code sequence for 9,9 to set all prefixes and suffixes to
1721
+ {Fore.light_steel_blue}
1722
+ {Fore.grey_70}K0K - 0,{Fore.cyan}K1K - 1,{Fore.grey_70}K3K - 3,{Fore.cyan}K4K - 4,{Fore.grey_70}K5K - 5,{Fore.cyan}K6K - 6,{Fore.grey_70}K7K - 7,{Fore.cyan}K8K - 8,{Fore.grey_70}K9K - 9,{Fore.cyan}KAK - A,{Fore.grey_70}KBK - B,{Fore.cyan}KCK - C,{Fore.grey_70}KDK - D,{Fore.cyan}KEK - E,{Fore.grey_70}KFK - F{Style.reset}
1723
+ {Fore.light_red}{Style.bold}You WILL need the scanners programming chart until further notice
1724
+ and the honeywell set prefix/suffix is {ml_delim}
1725
+ {Fore.light_yellow}The Sequences needed to be scanned are
1726
+ -------------
1727
+ Prefix {ml_delim}
1728
+ -------------
1729
+ PRECA2
1730
+ PREBK2
1731
+ 9,9
1732
+ 2,3
1733
+ 6,8
1734
+ 7,7
1735
+ 2,3
1736
+ MNUSAV
1737
+ --------------
1738
+ Suffix {ml_delim}\\n
1739
+ --------------
1740
+ SUFCA2
1741
+ SUFBK2
1742
+ 9,9
1743
+ 2,3
1744
+ 6,8
1745
+ 7,7
1746
+ 2,3
1747
+ 0,D
1748
+ MNUSAV
1749
+ {Style.reset}
1750
+ '''
1751
+ print(msg)
1752
+ debuffer=f'{nl}'.join(buffer)
1753
+ 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}")
1754
+
1755
+ buffer=[]
1756
+ elif not cmd.startswith(ml_delim) and not cmd.endswith(ml_delim) and len(buffer) > 0:
1757
+ msg=f'''
1758
+ {Fore.light_steel_blue}
1759
+ Generate the Barcodes for using Code128 as the Code Type
1760
+ {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}
1761
+ {Fore.light_green}Use a Hex editor to convert alpha-numeric values to hex and use the below codes
1762
+ Scan the code sequence for 9,9 to set all prefixes and suffixes to
1763
+ {Fore.light_steel_blue}
1764
+ {Fore.grey_70}K0K - 0,{Fore.cyan}K1K - 1,{Fore.grey_70}K3K - 3,{Fore.cyan}K4K - 4,{Fore.grey_70}K5K - 5,{Fore.cyan}K6K - 6,{Fore.grey_70}K7K - 7,{Fore.cyan}K8K - 8,{Fore.grey_70}K9K - 9,{Fore.cyan}KAK - A,{Fore.grey_70}KBK - B,{Fore.cyan}KCK - C,{Fore.grey_70}KDK - D,{Fore.cyan}KEK - E,{Fore.grey_70}KFK - F{Style.reset}
1765
+ {Fore.light_red}{Style.bold}You WILL need the scanners programming chart until further notice
1766
+ and the honeywell set prefix/suffix is {ml_delim}
1767
+ {Fore.light_yellow}The Sequences needed to be scanned are
1768
+ -------------
1769
+ Prefix {ml_delim}
1770
+ -------------
1771
+ PRECA2
1772
+ PREBK2
1773
+ 9,9
1774
+ 2,3
1775
+ 6,8
1776
+ 7,7
1777
+ 2,3
1778
+ MNUSAV
1779
+ --------------
1780
+ Suffix {ml_delim}\\n
1781
+ --------------
1782
+ SUFCA2
1783
+ SUFBK2
1784
+ 9,9
1785
+ 2,3
1786
+ 6,8
1787
+ 7,7
1788
+ 2,3
1789
+ 0,D
1790
+ MNUSAV
1791
+ {Style.reset}
1792
+ '''
1793
+ print(msg)
1794
+ print(f"""{Fore.orange_red_1}An Incomplete Scan Occurred;
1795
+ type the remainder of the command to add it to the buffer,
1796
+ Please Finish with end of cmd followed immediately by {Fore.magenta}{ml_delim}{Style.reset}.
1797
+ CMD's are not final until ended with {Fore.magenta}{ml_delim}{Style.reset}""")
1798
+ buffer.append(cmd)
1799
+ print(buffer)
1800
+ continue
1798
1801
 
1799
1802
 
1800
1803
 
1801
- #multiline end#
1802
-
1803
- hw_delim=str(detectGetOrSet('HW_DELIM',str(Path('#hw#'))))
1804
- if cmd.startswith(hw_delim) and not cmd.endswith(hw_delim):
1805
- msg=f'''
1806
- {Fore.light_steel_blue}
1807
- Generate the Barcodes for using Code128 as the Code Type
1808
- {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}
1809
- {Fore.light_green}Use a Hex editor to convert alpha-numeric values to hex and use the below codes
1810
- Scan the code sequence for 9,9 to set all prefixes and suffixes to
1811
- {Fore.light_steel_blue}
1812
- {Fore.grey_70}K0K - 0,{Fore.cyan}K1K - 1,{Fore.grey_70}K3K - 3,{Fore.cyan}K4K - 4,{Fore.grey_70}K5K - 5,{Fore.cyan}K6K - 6,{Fore.grey_70}K7K - 7,{Fore.cyan}K8K - 8,{Fore.grey_70}K9K - 9,{Fore.cyan}KAK - A,{Fore.grey_70}KBK - B,{Fore.cyan}KCK - C,{Fore.grey_70}KDK - D,{Fore.cyan}KEK - E,{Fore.grey_70}KFK - F{Style.reset}
1813
- {Fore.light_red}{Style.bold}You WILL need the scanners programming chart until further notice
1814
- and the honeywell set prefix/suffix is {hw_delim}
1815
- {Fore.light_yellow}The Sequences needed to be scanned are
1816
- -------------
1817
- Prefix {hw_delim}
1818
- -------------
1819
- PRECA2
1820
- PREBK2
1821
- 9,9
1822
- 2,3
1823
- 6,8
1824
- 7,7
1825
- 2,3
1826
- MNUSAV
1827
- --------------
1828
- Suffix {hw_delim}\\n
1829
- --------------
1830
- SUFCA2
1831
- SUFBK2
1832
- 9,9
1833
- 2,3
1834
- 6,8
1835
- 7,7
1836
- 2,3
1837
- 0,D
1838
- MNUSAV
1839
- {Style.reset}
1840
- '''
1841
- print(msg)
1842
- 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}")
1843
- buffer.append(cmd)
1844
- continue
1845
- elif cmd.startswith(hw_delim) and cmd.endswith(hw_delim):
1846
- if len(buffer) > 0:
1804
+ #multiline end#
1805
+
1806
+ hw_delim=str(detectGetOrSet('HW_DELIM',str(Path('#hw#'))))
1807
+ if cmd.startswith(hw_delim) and not cmd.endswith(hw_delim):
1808
+ msg=f'''
1809
+ {Fore.light_steel_blue}
1810
+ Generate the Barcodes for using Code128 as the Code Type
1811
+ {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}
1812
+ {Fore.light_green}Use a Hex editor to convert alpha-numeric values to hex and use the below codes
1813
+ Scan the code sequence for 9,9 to set all prefixes and suffixes to
1814
+ {Fore.light_steel_blue}
1815
+ {Fore.grey_70}K0K - 0,{Fore.cyan}K1K - 1,{Fore.grey_70}K3K - 3,{Fore.cyan}K4K - 4,{Fore.grey_70}K5K - 5,{Fore.cyan}K6K - 6,{Fore.grey_70}K7K - 7,{Fore.cyan}K8K - 8,{Fore.grey_70}K9K - 9,{Fore.cyan}KAK - A,{Fore.grey_70}KBK - B,{Fore.cyan}KCK - C,{Fore.grey_70}KDK - D,{Fore.cyan}KEK - E,{Fore.grey_70}KFK - F{Style.reset}
1816
+ {Fore.light_red}{Style.bold}You WILL need the scanners programming chart until further notice
1817
+ and the honeywell set prefix/suffix is {hw_delim}
1818
+ {Fore.light_yellow}The Sequences needed to be scanned are
1819
+ -------------
1820
+ Prefix {hw_delim}
1821
+ -------------
1822
+ PRECA2
1823
+ PREBK2
1824
+ 9,9
1825
+ 2,3
1826
+ 6,8
1827
+ 7,7
1828
+ 2,3
1829
+ MNUSAV
1830
+ --------------
1831
+ Suffix {hw_delim}\\n
1832
+ --------------
1833
+ SUFCA2
1834
+ SUFBK2
1835
+ 9,9
1836
+ 2,3
1837
+ 6,8
1838
+ 7,7
1839
+ 2,3
1840
+ 0,D
1841
+ MNUSAV
1842
+ {Style.reset}
1843
+ '''
1844
+ print(msg)
1845
+ 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}")
1846
+ buffer.append(cmd)
1847
+ continue
1848
+ elif cmd.startswith(hw_delim) and cmd.endswith(hw_delim):
1849
+ if len(buffer) > 0:
1850
+ buffer.append(cmd)
1851
+ #cmd=''.join(buffer).replace(hw_delim,'')
1852
+ cmd=''.join(buffer)[len(hw_delim):-len(hw_delim)]
1853
+ else:
1854
+ #cmd=cmd.replace(hw_delim,'')
1855
+ cmd=cmd[len(hw_delim):-len(hw_delim)]
1856
+ with scanout.open("w+") as out:
1857
+ out.write(cmd)
1858
+ elif not cmd.startswith(hw_delim) and cmd.endswith(hw_delim):
1847
1859
  buffer.append(cmd)
1848
- #cmd=''.join(buffer).replace(hw_delim,'')
1849
1860
  cmd=''.join(buffer)[len(hw_delim):-len(hw_delim)]
1850
- else:
1851
- #cmd=cmd.replace(hw_delim,'')
1852
- cmd=cmd[len(hw_delim):-len(hw_delim)]
1853
1861
  with scanout.open("w+") as out:
1854
1862
  out.write(cmd)
1855
- elif not cmd.startswith(hw_delim) and cmd.endswith(hw_delim):
1856
- buffer.append(cmd)
1857
- cmd=''.join(buffer)[len(hw_delim):-len(hw_delim)]
1858
- with scanout.open("w+") as out:
1859
- out.write(cmd)
1860
- msg=f'''
1861
- {Fore.light_steel_blue}
1862
- Generate the Barcodes for using Code128 as the Code Type
1863
- {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}
1864
- {Fore.light_green}Use a Hex editor to convert alpha-numeric values to hex and use the below codes
1865
- Scan the code sequence for 9,9 to set all prefixes and suffixes to
1866
- {Fore.light_steel_blue}
1867
- {Fore.grey_70}K0K - 0,{Fore.cyan}K1K - 1,{Fore.grey_70}K3K - 3,{Fore.cyan}K4K - 4,{Fore.grey_70}K5K - 5,{Fore.cyan}K6K - 6,{Fore.grey_70}K7K - 7,{Fore.cyan}K8K - 8,{Fore.grey_70}K9K - 9,{Fore.cyan}KAK - A,{Fore.grey_70}KBK - B,{Fore.cyan}KCK - C,{Fore.grey_70}KDK - D,{Fore.cyan}KEK - E,{Fore.grey_70}KFK - F{Style.reset}
1868
- {Fore.light_red}{Style.bold}You WILL need the scanners programming chart until further notice
1869
- and the honeywell set prefix/suffix is {hw_delim}
1870
- {Fore.light_yellow}The Sequences needed to be scanned are
1871
- -------------
1872
- Prefix {hw_delim}
1873
- -------------
1874
- PRECA2
1875
- PREBK2
1876
- 9,9
1877
- 2,3
1878
- 6,8
1879
- 7,7
1880
- 2,3
1881
- MNUSAV
1882
- --------------
1883
- Suffix {hw_delim}\\n
1884
- --------------
1885
- SUFCA2
1886
- SUFBK2
1887
- 9,9
1888
- 2,3
1889
- 6,8
1890
- 7,7
1891
- 2,3
1892
- 0,D
1893
- MNUSAV
1894
- {Style.reset}
1895
- '''
1896
- print(msg)
1897
- 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}")
1898
-
1899
- buffer=[]
1900
- elif not cmd.startswith(hw_delim) and not cmd.endswith(hw_delim) and len(buffer) > 0:
1901
- msg=f'''
1902
- {Fore.light_steel_blue}
1903
- Generate the Barcodes for using Code128 as the Code Type
1904
- {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}
1905
- {Fore.light_green}Use a Hex editor to convert alpha-numeric values to hex and use the below codes
1906
- Scan the code sequence for 9,9 to set all prefixes and suffixes to
1907
- {Fore.light_steel_blue}
1908
- {Fore.grey_70}K0K - 0,{Fore.cyan}K1K - 1,{Fore.grey_70}K3K - 3,{Fore.cyan}K4K - 4,{Fore.grey_70}K5K - 5,{Fore.cyan}K6K - 6,{Fore.grey_70}K7K - 7,{Fore.cyan}K8K - 8,{Fore.grey_70}K9K - 9,{Fore.cyan}KAK - A,{Fore.grey_70}KBK - B,{Fore.cyan}KCK - C,{Fore.grey_70}KDK - D,{Fore.cyan}KEK - E,{Fore.grey_70}KFK - F{Style.reset}
1909
- {Fore.light_red}{Style.bold}You WILL need the scanners programming chart until further notice
1910
- and the honeywell set prefix/suffix is {hw_delim}
1911
- {Fore.light_yellow}The Sequences needed to be scanned are
1912
- -------------
1913
- Prefix {hw_delim}
1914
- -------------
1915
- PRECA2
1916
- PREBK2
1917
- 9,9
1918
- 2,3
1919
- 6,8
1920
- 7,7
1921
- 2,3
1922
- MNUSAV
1923
- --------------
1924
- Suffix {hw_delim}\\n
1925
- --------------
1926
- SUFCA2
1927
- SUFBK2
1928
- 9,9
1929
- 2,3
1930
- 6,8
1931
- 7,7
1932
- 2,3
1933
- 0,D
1934
- MNUSAV
1935
- {Style.reset}
1936
- '''
1937
- print(msg)
1938
- print(f"""{Fore.orange_red_1}An Incomplete Scan Occurred;
1939
- type the remainder of the command to add it to the buffer,
1940
- Please Finish with end of cmd followed immediately by {Fore.magenta}{hw_delim}{Style.reset}.
1941
- CMD's are not final until ended with {Fore.magenta}{hw_delim}{Style.reset}""")
1942
- buffer.append(cmd)
1943
- print(buffer)
1944
- continue
1945
- cmd=detectShelfCode(cmd)
1946
-
1947
- #cmd=GetAsciiOnly2(cmd)
1948
-
1949
- #cmd=GetAsciiOnly(cmd)
1950
-
1951
- def Mbool(text,data):
1952
- try:
1953
- for i in ['n','no','false','f']:
1954
- if i in text.lower():
1955
- return False
1956
- for i in ['y','yes','true','t']:
1957
- if i in text.lower():
1958
- return True
1959
- return None
1960
- except Exception as e:
1961
- return
1962
-
1963
- #PRESET_EAN13_LEN=13
1964
- PRESET_EAN13_LEN=detectGetOrSet(name='PRESET_EAN13_LEN',length=13)
1965
- if PRESET_EAN13_LEN != None and len(cmd) == PRESET_EAN13_LEN:
1966
- try:
1967
- EAN13=barcode.EAN13(cmd)
1968
- 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")
1969
- if use in [True,None]:
1970
- pass
1971
- elif use in [False,]:
1972
- continue
1973
- except Exception as e:
1974
1863
  msg=f'''
1975
- {Fore.dark_red_1}{Style.bold}{str(e)}{Style.reset}
1976
- {Fore.yellow}{repr(e)}{Style.reset}
1977
- {Fore.light_green}Processing Will Continue...{Style.reset}
1978
- '''
1864
+ {Fore.light_steel_blue}
1865
+ Generate the Barcodes for using Code128 as the Code Type
1866
+ {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}
1867
+ {Fore.light_green}Use a Hex editor to convert alpha-numeric values to hex and use the below codes
1868
+ Scan the code sequence for 9,9 to set all prefixes and suffixes to
1869
+ {Fore.light_steel_blue}
1870
+ {Fore.grey_70}K0K - 0,{Fore.cyan}K1K - 1,{Fore.grey_70}K3K - 3,{Fore.cyan}K4K - 4,{Fore.grey_70}K5K - 5,{Fore.cyan}K6K - 6,{Fore.grey_70}K7K - 7,{Fore.cyan}K8K - 8,{Fore.grey_70}K9K - 9,{Fore.cyan}KAK - A,{Fore.grey_70}KBK - B,{Fore.cyan}KCK - C,{Fore.grey_70}KDK - D,{Fore.cyan}KEK - E,{Fore.grey_70}KFK - F{Style.reset}
1871
+ {Fore.light_red}{Style.bold}You WILL need the scanners programming chart until further notice
1872
+ and the honeywell set prefix/suffix is {hw_delim}
1873
+ {Fore.light_yellow}The Sequences needed to be scanned are
1874
+ -------------
1875
+ Prefix {hw_delim}
1876
+ -------------
1877
+ PRECA2
1878
+ PREBK2
1879
+ 9,9
1880
+ 2,3
1881
+ 6,8
1882
+ 7,7
1883
+ 2,3
1884
+ MNUSAV
1885
+ --------------
1886
+ Suffix {hw_delim}\\n
1887
+ --------------
1888
+ SUFCA2
1889
+ SUFBK2
1890
+ 9,9
1891
+ 2,3
1892
+ 6,8
1893
+ 7,7
1894
+ 2,3
1895
+ 0,D
1896
+ MNUSAV
1897
+ {Style.reset}
1898
+ '''
1979
1899
  print(msg)
1980
- #this will be stored in system preferences as well as an gui be made to change it
1981
- #PRESET_UPC_LEN=12
1982
- #PRESET_UPC_LEN=None
1983
- PRESET_UPC_LEN=detectGetOrSet(name='PRESET_UPC_LEN',length=12)
1984
- if PRESET_UPC_LEN != None and len(cmd) == PRESET_UPC_LEN:
1985
- try:
1986
- UPCA=barcode.UPCA(cmd)
1987
- 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")
1988
- if use in [True,None]:
1989
- pass
1990
- elif use in [False,]:
1991
- continue
1992
- except Exception as e:
1900
+ 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}")
1901
+
1902
+ buffer=[]
1903
+ elif not cmd.startswith(hw_delim) and not cmd.endswith(hw_delim) and len(buffer) > 0:
1993
1904
  msg=f'''
1994
- {Fore.dark_red_1}{Style.bold}{str(e)}{Style.reset}
1995
- {Fore.yellow}{repr(e)}{Style.reset}
1996
- {Fore.light_green}Processing Will Continue...{Style.reset}
1997
- '''
1905
+ {Fore.light_steel_blue}
1906
+ Generate the Barcodes for using Code128 as the Code Type
1907
+ {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}
1908
+ {Fore.light_green}Use a Hex editor to convert alpha-numeric values to hex and use the below codes
1909
+ Scan the code sequence for 9,9 to set all prefixes and suffixes to
1910
+ {Fore.light_steel_blue}
1911
+ {Fore.grey_70}K0K - 0,{Fore.cyan}K1K - 1,{Fore.grey_70}K3K - 3,{Fore.cyan}K4K - 4,{Fore.grey_70}K5K - 5,{Fore.cyan}K6K - 6,{Fore.grey_70}K7K - 7,{Fore.cyan}K8K - 8,{Fore.grey_70}K9K - 9,{Fore.cyan}KAK - A,{Fore.grey_70}KBK - B,{Fore.cyan}KCK - C,{Fore.grey_70}KDK - D,{Fore.cyan}KEK - E,{Fore.grey_70}KFK - F{Style.reset}
1912
+ {Fore.light_red}{Style.bold}You WILL need the scanners programming chart until further notice
1913
+ and the honeywell set prefix/suffix is {hw_delim}
1914
+ {Fore.light_yellow}The Sequences needed to be scanned are
1915
+ -------------
1916
+ Prefix {hw_delim}
1917
+ -------------
1918
+ PRECA2
1919
+ PREBK2
1920
+ 9,9
1921
+ 2,3
1922
+ 6,8
1923
+ 7,7
1924
+ 2,3
1925
+ MNUSAV
1926
+ --------------
1927
+ Suffix {hw_delim}\\n
1928
+ --------------
1929
+ SUFCA2
1930
+ SUFBK2
1931
+ 9,9
1932
+ 2,3
1933
+ 6,8
1934
+ 7,7
1935
+ 2,3
1936
+ 0,D
1937
+ MNUSAV
1938
+ {Style.reset}
1939
+ '''
1998
1940
  print(msg)
1941
+ print(f"""{Fore.orange_red_1}An Incomplete Scan Occurred;
1942
+ type the remainder of the command to add it to the buffer,
1943
+ Please Finish with end of cmd followed immediately by {Fore.magenta}{hw_delim}{Style.reset}.
1944
+ CMD's are not final until ended with {Fore.magenta}{hw_delim}{Style.reset}""")
1945
+ buffer.append(cmd)
1946
+ print(buffer)
1947
+ continue
1948
+ cmd=detectShelfCode(cmd)
1999
1949
 
2000
- PRESET_UPCA11_LEN=detectGetOrSet(name='PRESET_UPCA11_LEN',length=11)
2001
- if PRESET_UPCA11_LEN != None and len(cmd) == PRESET_UPCA11_LEN:
2002
- try:
2003
- UPCA11=str(barcode.UPCA(cmd))
2004
- 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")
2005
- print(f"USED:{use}")
2006
- if use in [True,]:
2007
- cmd=UPCA11
2008
- elif use in [None,]:
2009
- pass
2010
- elif use in [False,]:
2011
- continue
2012
- except Exception as e:
2013
- msg=f'''
2014
- {Fore.dark_red_1}{Style.bold}{str(e)}{Style.reset}
2015
- {Fore.yellow}{repr(e)}{Style.reset}
2016
- {Fore.light_green}Processing Will Continue...{Style.reset}
2017
- '''
2018
- print(msg)
2019
- #PRESET_CODE_LEN=8
2020
- #PRESET_CODE_LEN=None
2021
- PRESET_CODE_LEN=detectGetOrSet(name='PRESET_CODE_LEN',length=8)
2022
- if PRESET_CODE_LEN != None and len(cmd) == PRESET_CODE_LEN:
2023
- try:
2024
- Code39=barcode.Code39(cmd,add_checksum=False)
2025
- 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")
2026
- if use in [True,None]:
2027
- final_use=True
2028
- pass
2029
- elif use in [False,]:
2030
- continue
2031
- except Exception as e:
2032
- msg=f'''
2033
- {Fore.dark_red_1}{Style.bold}{str(e)}{Style.reset}
2034
- {Fore.yellow}{repr(e)}{Style.reset}
2035
- {Fore.light_green}Processing Will Continue...{Style.reset}
2036
- '''
2037
- print(msg)
1950
+ #cmd=GetAsciiOnly2(cmd)
2038
1951
 
2039
- 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}
2040
- {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}
2041
- {Fore.grey_85}{os.get_terminal_size().columns*'.'}{Style.reset}"""
2042
- print(postFilterMsg)
2043
- #this is purely for debugging
2044
- #more will come later
2045
- ph_age=detectGetOrSet('PH_AGE',60*60*24*7)
2046
- ph_limit=detectGetOrSet('PH_MAXLINES',10000)
2047
- #ph_age=5
2048
- if not noHistory:
2049
- db.saveHistory(cmd,ph_age,executed=func,data=data)
2050
- if cmd.endswith("#clr") or cmd.startswith('clr#'):
2051
- 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}")
2052
- continue
2053
- elif cmd.lower() in ["ph","prompt history",]:
2054
- ph=db.HistoryUi()
2055
- if ph.cmd != None:
2056
- cmd=ph.cmd
2057
- else:
2058
- continue
2059
- elif cmd.lower() in ["aisle map",]:
2060
- settings=namedtuple('self',['amx','amn','max_sb'])
2061
- settings.amx=15
2062
- settings.amn=0
2063
- settings.max_sb=5
2064
- ad=MAP.generate_names(settings)
2065
- return func(ad,data)
2066
- elif cmd.endswith("#c2cb"):
2067
- with db.Session(db.ENGINE) as session:
2068
- ncb_text=cmd.split('#c2cb')[0]
2069
- cb=db.ClipBoord(cbValue=ncb_text,doe=datetime.now(),ageLimit=db.ClipBoordEditor.ageLimit,defaultPaste=True)
2070
- results=session.query(db.ClipBoord).filter(db.ClipBoord.defaultPaste==True).all()
2071
- ct=len(results)
2072
- if ct > 0:
2073
- for num,r in enumerate(results):
2074
- r.defaultPaste=False
2075
- if num % 100:
2076
- session.commit()
2077
- session.commit()
2078
- session.add(cb)
2079
- session.commit()
1952
+ #cmd=GetAsciiOnly(cmd)
1953
+
1954
+ def Mbool(text,data):
1955
+ try:
1956
+ for i in ['n','no','false','f']:
1957
+ if i in text.lower():
1958
+ return False
1959
+ for i in ['y','yes','true','t']:
1960
+ if i in text.lower():
1961
+ return True
1962
+ return None
1963
+ except Exception as e:
1964
+ return
1965
+
1966
+ #PRESET_EAN13_LEN=13
1967
+ PRESET_EAN13_LEN=detectGetOrSet(name='PRESET_EAN13_LEN',length=13)
1968
+ if PRESET_EAN13_LEN != None and len(cmd) == PRESET_EAN13_LEN:
1969
+ try:
1970
+ EAN13=barcode.EAN13(cmd)
1971
+ 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")
1972
+ if use in [True,None]:
1973
+ pass
1974
+ elif use in [False,]:
1975
+ continue
1976
+ except Exception as e:
1977
+ msg=f'''
1978
+ {Fore.dark_red_1}{Style.bold}{str(e)}{Style.reset}
1979
+ {Fore.yellow}{repr(e)}{Style.reset}
1980
+ {Fore.light_green}Processing Will Continue...{Style.reset}
1981
+ '''
1982
+ print(msg)
1983
+ #this will be stored in system preferences as well as an gui be made to change it
1984
+ #PRESET_UPC_LEN=12
1985
+ #PRESET_UPC_LEN=None
1986
+ PRESET_UPC_LEN=detectGetOrSet(name='PRESET_UPC_LEN',length=12)
1987
+ if PRESET_UPC_LEN != None and len(cmd) == PRESET_UPC_LEN:
1988
+ try:
1989
+ UPCA=barcode.UPCA(cmd)
1990
+ 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")
1991
+ if use in [True,None]:
1992
+ pass
1993
+ elif use in [False,]:
1994
+ continue
1995
+ except Exception as e:
1996
+ msg=f'''
1997
+ {Fore.dark_red_1}{Style.bold}{str(e)}{Style.reset}
1998
+ {Fore.yellow}{repr(e)}{Style.reset}
1999
+ {Fore.light_green}Processing Will Continue...{Style.reset}
2000
+ '''
2001
+ print(msg)
2002
+
2003
+ PRESET_UPCA11_LEN=detectGetOrSet(name='PRESET_UPCA11_LEN',length=11)
2004
+ if PRESET_UPCA11_LEN != None and len(cmd) == PRESET_UPCA11_LEN:
2005
+ try:
2006
+ UPCA11=str(barcode.UPCA(cmd))
2007
+ 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")
2008
+ print(f"USED:{use}")
2009
+ if use in [True,]:
2010
+ cmd=UPCA11
2011
+ elif use in [None,]:
2012
+ pass
2013
+ elif use in [False,]:
2014
+ continue
2015
+ except Exception as e:
2016
+ msg=f'''
2017
+ {Fore.dark_red_1}{Style.bold}{str(e)}{Style.reset}
2018
+ {Fore.yellow}{repr(e)}{Style.reset}
2019
+ {Fore.light_green}Processing Will Continue...{Style.reset}
2020
+ '''
2021
+ print(msg)
2022
+ #PRESET_CODE_LEN=8
2023
+ #PRESET_CODE_LEN=None
2024
+ PRESET_CODE_LEN=detectGetOrSet(name='PRESET_CODE_LEN',length=8)
2025
+ if PRESET_CODE_LEN != None and len(cmd) == PRESET_CODE_LEN:
2026
+ try:
2027
+ Code39=barcode.Code39(cmd,add_checksum=False)
2028
+ 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")
2029
+ if use in [True,None]:
2030
+ final_use=True
2031
+ pass
2032
+ elif use in [False,]:
2033
+ continue
2034
+ except Exception as e:
2035
+ msg=f'''
2036
+ {Fore.dark_red_1}{Style.bold}{str(e)}{Style.reset}
2037
+ {Fore.yellow}{repr(e)}{Style.reset}
2038
+ {Fore.light_green}Processing Will Continue...{Style.reset}
2039
+ '''
2040
+ print(msg)
2041
+
2042
+ 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}
2043
+ {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}
2044
+ {Fore.grey_85}{os.get_terminal_size().columns*'.'}{Style.reset}"""
2045
+ print(postFilterMsg)
2046
+ #this is purely for debugging
2047
+ #more will come later
2048
+ ph_age=detectGetOrSet('PH_AGE',60*60*24*7)
2049
+ ph_limit=detectGetOrSet('PH_MAXLINES',10000)
2050
+ #ph_age=5
2051
+ if not noHistory:
2052
+ db.saveHistory(cmd,ph_age,executed=func,data=data)
2053
+ if cmd.endswith("#clr") or cmd.startswith('clr#'):
2054
+ 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}")
2080
2055
  continue
2081
- elif cmd.lower() == 'colors':
2082
- protocolors()
2083
- elif cmd.lower() in ['cheat','cht']:
2084
- print(CHEAT)
2085
- continue
2086
- elif cmd.lower() == 'obf msg':
2087
- Obfuscate()
2088
- elif cmd.startswith("c2cb#"):
2089
- with db.Session(db.ENGINE) as session:
2090
- ncb_text=cmd.split('c2cb#')[-1]
2091
- cb=db.ClipBoord(cbValue=ncb_text,doe=datetime.now(),ageLimit=db.ClipBoordEditor.ageLimit,defaultPaste=True)
2092
- results=session.query(db.ClipBoord).filter(db.ClipBoord.defaultPaste==True).all()
2093
- ct=len(results)
2094
- if ct > 0:
2095
- for num,r in enumerate(results):
2096
- r.defaultPaste=False
2097
- if num % 100:
2098
- session.commit()
2056
+ elif cmd.lower() in ["ph","prompt history",]:
2057
+ ph=db.HistoryUi()
2058
+ if ph.cmd != None:
2059
+ cmd=ph.cmd
2060
+ else:
2061
+ continue
2062
+ elif cmd.lower() in ["aisle map",]:
2063
+ settings=namedtuple('self',['amx','amn','max_sb'])
2064
+ settings.amx=15
2065
+ settings.amn=0
2066
+ settings.max_sb=5
2067
+ ad=MAP.generate_names(settings)
2068
+ return func(ad,data)
2069
+ elif cmd.endswith("#c2cb"):
2070
+ with db.Session(db.ENGINE) as session:
2071
+ ncb_text=cmd.split('#c2cb')[0]
2072
+ cb=db.ClipBoord(cbValue=ncb_text,doe=datetime.now(),ageLimit=db.ClipBoordEditor.ageLimit,defaultPaste=True)
2073
+ results=session.query(db.ClipBoord).filter(db.ClipBoord.defaultPaste==True).all()
2074
+ ct=len(results)
2075
+ if ct > 0:
2076
+ for num,r in enumerate(results):
2077
+ r.defaultPaste=False
2078
+ if num % 100:
2079
+ session.commit()
2080
+ session.commit()
2081
+ session.add(cb)
2099
2082
  session.commit()
2100
- session.add(cb)
2101
- session.commit()
2083
+ continue
2084
+ elif cmd.lower() == 'colors':
2085
+ protocolors()
2086
+ elif cmd.lower() in ['cheat','cht']:
2087
+ print(CHEAT)
2102
2088
  continue
2103
- if cmd.endswith("#c2cbe"):
2104
- with db.Session(db.ENGINE) as session:
2105
- ncb_text=cmd.split('#c2cbe')[0]
2106
- cb=db.ClipBoord(cbValue=ncb_text,doe=datetime.now(),ageLimit=db.ClipBoordEditor.ageLimit,defaultPaste=True)
2107
- results=session.query(db.ClipBoord).filter(db.ClipBoord.defaultPaste==True).all()
2108
- ct=len(results)
2109
- if ct > 0:
2110
- for num,r in enumerate(results):
2111
- r.defaultPaste=False
2112
- if num % 100:
2113
- session.commit()
2089
+ elif cmd.lower() == 'obf msg':
2090
+ Obfuscate()
2091
+ elif cmd.startswith("c2cb#"):
2092
+ with db.Session(db.ENGINE) as session:
2093
+ ncb_text=cmd.split('c2cb#')[-1]
2094
+ cb=db.ClipBoord(cbValue=ncb_text,doe=datetime.now(),ageLimit=db.ClipBoordEditor.ageLimit,defaultPaste=True)
2095
+ results=session.query(db.ClipBoord).filter(db.ClipBoord.defaultPaste==True).all()
2096
+ ct=len(results)
2097
+ if ct > 0:
2098
+ for num,r in enumerate(results):
2099
+ r.defaultPaste=False
2100
+ if num % 100:
2101
+ session.commit()
2102
+ session.commit()
2103
+ session.add(cb)
2114
2104
  session.commit()
2115
- session.add(cb)
2116
- session.commit()
2117
- return func(ncb_text,data)
2118
- elif cmd.startswith("c2cbe#"):
2119
- with db.Session(db.ENGINE) as session:
2120
- ncb_text=cmd.split('c2cbe#')[-1]
2121
- cb=db.ClipBoord(cbValue=ncb_text,doe=datetime.now(),ageLimit=db.ClipBoordEditor.ageLimit,defaultPaste=True)
2122
- results=session.query(db.ClipBoord).filter(db.ClipBoord.defaultPaste==True).all()
2123
- ct=len(results)
2124
- if ct > 0:
2125
- for num,r in enumerate(results):
2126
- r.defaultPaste=False
2127
- if num % 100:
2128
- session.commit()
2105
+ continue
2106
+ if cmd.endswith("#c2cbe"):
2107
+ with db.Session(db.ENGINE) as session:
2108
+ ncb_text=cmd.split('#c2cbe')[0]
2109
+ cb=db.ClipBoord(cbValue=ncb_text,doe=datetime.now(),ageLimit=db.ClipBoordEditor.ageLimit,defaultPaste=True)
2110
+ results=session.query(db.ClipBoord).filter(db.ClipBoord.defaultPaste==True).all()
2111
+ ct=len(results)
2112
+ if ct > 0:
2113
+ for num,r in enumerate(results):
2114
+ r.defaultPaste=False
2115
+ if num % 100:
2116
+ session.commit()
2117
+ session.commit()
2118
+ session.add(cb)
2129
2119
  session.commit()
2130
- session.add(cb)
2131
- session.commit()
2132
- return func(ncb_text,data)
2133
- elif cmd.lower() in ['rob','readline on boot','readline_on_boot']:
2134
- with db.Session(db.ENGINE) as session:
2135
- READLINE_PREFERECE=session.query(db.SystemPreference).filter(db.SystemPreference.name=='readline').order_by(db.SystemPreference.dtoe.desc()).all()
2136
- ct=len(READLINE_PREFERECE)
2137
- if ct <= 0:
2138
- try:
2139
- import readline
2140
- sp=SystemPreference(name="readline",value_4_Json2DictString=json.dumps({"readline":True}))
2141
- session.add(sp)
2120
+ return func(ncb_text,data)
2121
+ elif cmd.startswith("c2cbe#"):
2122
+ with db.Session(db.ENGINE) as session:
2123
+ ncb_text=cmd.split('c2cbe#')[-1]
2124
+ cb=db.ClipBoord(cbValue=ncb_text,doe=datetime.now(),ageLimit=db.ClipBoordEditor.ageLimit,defaultPaste=True)
2125
+ results=session.query(db.ClipBoord).filter(db.ClipBoord.defaultPaste==True).all()
2126
+ ct=len(results)
2127
+ if ct > 0:
2128
+ for num,r in enumerate(results):
2129
+ r.defaultPaste=False
2130
+ if num % 100:
2131
+ session.commit()
2142
2132
  session.commit()
2143
- except Exception as e:
2144
- print("Could not import Readline, you might not have it installed!")
2145
- else:
2146
- try:
2147
- f=None
2148
- for num,i in enumerate(READLINE_PREFERECE):
2149
- if i.default == True:
2150
- f=num
2151
- break
2152
- if f == None:
2153
- f=0
2154
- cfg=READLINE_PREFERECE[f].value_4_Json2DictString
2155
- if cfg =='':
2156
- READLINE_PREFERECE[f].value_4_Json2DictString=json.dumps({"readline":True})
2133
+ session.add(cb)
2134
+ session.commit()
2135
+ return func(ncb_text,data)
2136
+ elif cmd.lower() in ['rob','readline on boot','readline_on_boot']:
2137
+ with db.Session(db.ENGINE) as session:
2138
+ READLINE_PREFERECE=session.query(db.SystemPreference).filter(db.SystemPreference.name=='readline').order_by(db.SystemPreference.dtoe.desc()).all()
2139
+ ct=len(READLINE_PREFERECE)
2140
+ if ct <= 0:
2141
+ try:
2157
2142
  import readline
2143
+ sp=SystemPreference(name="readline",value_4_Json2DictString=json.dumps({"readline":True}))
2144
+ session.add(sp)
2158
2145
  session.commit()
2159
- session.refresh(READLINE_PREFERECE[f])
2160
- else:
2161
- try:
2162
- x=json.loads(READLINE_PREFERECE[f].value_4_Json2DictString)
2163
- if x.get("readline") in [True,False,None]:
2146
+ except Exception as e:
2147
+ print("Could not import Readline, you might not have it installed!")
2148
+ else:
2149
+ try:
2150
+ f=None
2151
+ for num,i in enumerate(READLINE_PREFERECE):
2152
+ if i.default == True:
2153
+ f=num
2154
+ break
2155
+ if f == None:
2156
+ f=0
2157
+ cfg=READLINE_PREFERECE[f].value_4_Json2DictString
2158
+ if cfg =='':
2159
+ READLINE_PREFERECE[f].value_4_Json2DictString=json.dumps({"readline":True})
2160
+ import readline
2161
+ session.commit()
2162
+ session.refresh(READLINE_PREFERECE[f])
2163
+ else:
2164
+ try:
2165
+ x=json.loads(READLINE_PREFERECE[f].value_4_Json2DictString)
2166
+ if x.get("readline") in [True,False,None]:
2167
+ try:
2168
+ if x.get("readline") == False:
2169
+ READLINE_PREFERECE[f].value_4_Json2DictString=json.dumps({"readline":True})
2170
+ session.commit()
2171
+ exit("Reboot is required!")
2172
+ elif x.get("readline") == True:
2173
+ READLINE_PREFERECE[f].value_4_Json2DictString=json.dumps({"readline":False})
2174
+ session.commit()
2175
+ exit("Reboot is required!")
2176
+ else:
2177
+ READLINE_PREFERECE[f].value_4_Json2DictString=json.dumps({"readline":True})
2178
+ session.commit()
2179
+ exit("Reboot is required!")
2180
+ print(e)
2181
+ except Exception as e:
2182
+ print(e)
2183
+ else:
2184
+ print("readline is off")
2185
+ except Exception as e:
2164
2186
  try:
2165
- if x.get("readline") == False:
2166
- READLINE_PREFERECE[f].value_4_Json2DictString=json.dumps({"readline":True})
2167
- session.commit()
2168
- exit("Reboot is required!")
2169
- elif x.get("readline") == True:
2170
- READLINE_PREFERECE[f].value_4_Json2DictString=json.dumps({"readline":False})
2171
- session.commit()
2172
- exit("Reboot is required!")
2173
- else:
2174
- READLINE_PREFERECE[f].value_4_Json2DictString=json.dumps({"readline":True})
2175
- session.commit()
2176
- exit("Reboot is required!")
2187
+ import readline
2177
2188
  print(e)
2178
2189
  except Exception as e:
2179
2190
  print(e)
2180
- else:
2181
- print("readline is off")
2182
- except Exception as e:
2183
- try:
2184
- import readline
2185
- print(e)
2186
- except Exception as e:
2187
- print(e)
2188
- except Exception as e:
2189
- print(e)
2190
- elif cmd.lower() in ['uniq-rcpt-id','uniq rcpt id','unique_reciept_id','urid','unique reciept id','unique-reciept-id']:
2191
- try:
2192
- urid=TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).unique_reciept_id()
2193
- 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")
2194
- if send in [None,]:
2195
- continue
2196
- elif send == True:
2197
- return func(urid,data)
2198
- else:
2199
- print(urid)
2200
- continue
2201
- except Exception as e:
2202
- print(e)
2203
-
2204
- elif cmd.lower() in ['ic2oc','input code to output code']:
2205
- 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")
2206
- if c in [None,'d']:
2207
- continue
2208
- else:
2191
+ except Exception as e:
2192
+ print(e)
2193
+ elif cmd.lower() in ['uniq-rcpt-id','uniq rcpt id','unique_reciept_id','urid','unique reciept id','unique-reciept-id']:
2209
2194
  try:
2210
- codeZ=str(useInputAsCode(c))
2211
- 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")
2195
+ urid=TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).unique_reciept_id()
2196
+ 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")
2212
2197
  if send in [None,]:
2213
2198
  continue
2214
2199
  elif send == True:
2215
- return func(codeZ,data)
2200
+ return func(urid,data)
2216
2201
  else:
2217
- print(c)
2202
+ print(urid)
2218
2203
  continue
2219
2204
  except Exception as e:
2220
2205
  print(e)
2221
- elif cmd.lower() in ['c2c','calc2cmd']:
2222
- t=TM.Tasks.TasksMode.evaluateFormula(None,fieldname="Prompt",oneShot=True)
2223
- return func(str(t),data)
2224
- elif cmd.lower() in ['esu',]:
2225
- TM.Tasks.TasksMode.Lookup()
2226
- elif cmd.lower() in ['daylogu','dlu']:
2227
- TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).product_history()
2228
- elif cmd.lower() in ['neu',]:
2229
- TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).NewEntryMenu()
2230
- elif cmd.lower() in ['exp',]:
2231
- TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).Expiration_()
2232
- elif cmd.lower() in ['mlu',]:
2233
- TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).MasterLookup()
2234
- elif cmd.lower() in ['comm']:
2235
- CM.RxTx.RxTx()
2236
- elif cmd.lower() in ['tsu','j','journal','jrnl']:
2237
- TSC.TouchStampC.TouchStampC(parent=self,engine=db.ENGINE)
2238
- elif cmd.lower() in ['tvu','tag data']:
2239
- pc.run(engine=db.ENGINE)
2240
- elif cmd.lower() in ['exe','execute','x']:
2241
- TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).executeInLine()
2242
- continue
2243
- elif cmd.lower() in ['exe-result','execute-result','xr']:
2244
- return func(TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).getInLineResult(),str(text))
2245
- elif cmd.lower() in ['exe-print','pxr','print exe result']:
2246
- print(TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).getInLineResult())
2247
- continue
2248
- elif cmd.lower() in ['c','calc']:
2249
- #if len(inspect.stack(0)) <= 6:
2250
- TM.Tasks.TasksMode.evaluateFormula(None,fieldname="Prompt")
2251
- continue
2252
- #else:
2253
- #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}!")
2254
- elif cmd.lower() in ['q','qm','q?','quit menu','quit al la carte']:
2255
- Prompt.QuitMenu(Prompt)
2256
- elif cmd.lower() in ['cb','clipboard']:
2257
- ed=db.ClipBoordEditor(self)
2258
- continue
2259
- elif cmd.lower() in ['#b',]:
2260
- with db.Session(db.ENGINE) as session:
2261
- next_barcode=session.query(db.SystemPreference).filter(db.SystemPreference.name=='next_barcode').all()
2262
- ct=len(next_barcode)
2263
- if ct > 0:
2264
- if next_barcode[0]:
2265
- setattr(next_barcode[0],'value_4_Json2DictString',str(json.dumps({'next_barcode':True})))
2266
- session.commit()
2267
- session.refresh(next_barcode[0])
2206
+
2207
+ elif cmd.lower() in ['ic2oc','input code to output code']:
2208
+ 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")
2209
+ if c in [None,'d']:
2210
+ continue
2268
2211
  else:
2269
- next_barcode=db.SystemPreference(name="next_barcode",value_4_Json2DictString=json.dumps({'next_barcode':True}))
2270
- session.add(next_barcode)
2271
- session.commit()
2272
- session.refresh(next_barcode)
2273
- lastTime=db.detectGetOrSet("PromptLastDTasFloat",datetime.now().timestamp(),setValue=True)
2274
- return
2275
- elif cmd.lower() in ['cse','clear selected entry']:
2276
- code=Prompt.__init2__(None,func=FormBuilderMkText,ptext="what do you wish to clear?",helpText="barcode|code|name",data="string")
2277
- if code in [None,]:
2212
+ try:
2213
+ codeZ=str(useInputAsCode(c))
2214
+ 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")
2215
+ if send in [None,]:
2216
+ continue
2217
+ elif send == True:
2218
+ return func(codeZ,data)
2219
+ else:
2220
+ print(c)
2221
+ continue
2222
+ except Exception as e:
2223
+ print(e)
2224
+ elif cmd.lower() in ['c2c','calc2cmd']:
2225
+ t=TM.Tasks.TasksMode.evaluateFormula(None,fieldname="Prompt",oneShot=True)
2226
+ return func(str(t),data)
2227
+ elif cmd.lower() in ['esu',]:
2228
+ TM.Tasks.TasksMode.Lookup()
2229
+ elif cmd.lower() in ['daylogu','dlu']:
2230
+ TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).product_history()
2231
+ elif cmd.lower() in ['neu',]:
2232
+ TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).NewEntryMenu()
2233
+ elif cmd.lower() in ['exp',]:
2234
+ TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).Expiration_()
2235
+ elif cmd.lower() in ['mlu',]:
2236
+ TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).MasterLookup()
2237
+ elif cmd.lower() in ['comm']:
2238
+ CM.RxTx.RxTx()
2239
+ elif cmd.lower() in ['tsu','j','journal','jrnl']:
2240
+ TSC.TouchStampC.TouchStampC(parent=self,engine=db.ENGINE)
2241
+ elif cmd.lower() in ['tvu','tag data']:
2242
+ pc.run(engine=db.ENGINE)
2243
+ elif cmd.lower() in ['exe','execute','x']:
2244
+ TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).executeInLine()
2278
2245
  continue
2279
- with Session(db.ENGINE) as session:
2280
- 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)))
2281
- results=query.all()
2282
- ct=len(results)
2283
- if ct < 1:
2284
- print("No Results to Clear!")
2246
+ elif cmd.lower() in ['exe-result','execute-result','xr']:
2247
+ return func(TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).getInLineResult(),str(text))
2248
+ elif cmd.lower() in ['exe-print','pxr','print exe result']:
2249
+ print(TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).getInLineResult())
2250
+ continue
2251
+ elif cmd.lower() in ['c','calc']:
2252
+ #if len(inspect.stack(0)) <= 6:
2253
+ TM.Tasks.TasksMode.evaluateFormula(None,fieldname="Prompt")
2254
+ continue
2255
+ #else:
2256
+ #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}!")
2257
+ elif cmd.lower() in ['q','qm','q?','quit menu','quit al la carte']:
2258
+ Prompt.QuitMenu(Prompt)
2259
+ elif cmd.lower() in ['cb','clipboard']:
2260
+ ed=db.ClipBoordEditor(self)
2261
+ continue
2262
+ elif cmd.lower() in ['#b',]:
2263
+ with db.Session(db.ENGINE) as session:
2264
+ next_barcode=session.query(db.SystemPreference).filter(db.SystemPreference.name=='next_barcode').all()
2265
+ ct=len(next_barcode)
2266
+ if ct > 0:
2267
+ if next_barcode[0]:
2268
+ setattr(next_barcode[0],'value_4_Json2DictString',str(json.dumps({'next_barcode':True})))
2269
+ session.commit()
2270
+ session.refresh(next_barcode[0])
2271
+ else:
2272
+ next_barcode=db.SystemPreference(name="next_barcode",value_4_Json2DictString=json.dumps({'next_barcode':True}))
2273
+ session.add(next_barcode)
2274
+ session.commit()
2275
+ session.refresh(next_barcode)
2276
+ lastTime=db.detectGetOrSet("PromptLastDTasFloat",datetime.now().timestamp(),setValue=True)
2277
+ return
2278
+ elif cmd.lower() in ['cse','clear selected entry']:
2279
+ code=Prompt.__init2__(None,func=FormBuilderMkText,ptext="what do you wish to clear?",helpText="barcode|code|name",data="string")
2280
+ if code in [None,]:
2285
2281
  continue
2286
- helpText=[]
2287
- for num,i in enumerate(results):
2288
- msg=f"{Fore.cyan}{num}/{Fore.light_yellow}{num+1} of {Fore.light_red}{ct} -> {Fore.orange_red_1}{i.seeShort()}{Style.reset}"
2289
- helpText.append(msg)
2290
- helpText='\n'.join(helpText)
2291
- print(helpText)
2292
- selected=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Which index(es):",helpText=helpText,data="list")
2293
- try:
2294
- if selected in [None,'d',[]]:
2282
+ with Session(db.ENGINE) as session:
2283
+ 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)))
2284
+ results=query.all()
2285
+ ct=len(results)
2286
+ if ct < 1:
2287
+ print("No Results to Clear!")
2295
2288
  continue
2296
- for i in selected:
2297
- try:
2298
- index=int(i)
2299
- obj=results[index]
2300
- update={
2301
- 'InList':False,
2302
- 'ListQty':0,
2303
- 'Shelf':0,
2304
- 'Note':'',
2305
- 'BackRoom':0,
2306
- 'Distress':0,
2307
- 'Display_1':0,
2308
- 'Display_2':0,
2309
- 'Display_3':0,
2310
- 'Display_4':0,
2311
- 'Display_5':0,
2312
- 'Display_6':0,
2313
- 'Stock_Total':0,
2314
- 'CaseID_BR':'',
2315
- 'CaseID_LD':'',
2316
- 'CaseID_6W':'',
2317
- 'SBX_WTR_DSPLY':0,
2318
- 'SBX_CHP_DSPLY':0,
2319
- 'SBX_WTR_KLR':0,
2320
- 'FLRL_CHP_DSPLY':0,
2321
- 'FLRL_WTR_DSPLY':0,
2322
- 'WD_DSPLY':0,
2323
- 'CHKSTND_SPLY':0,
2324
- }
2325
- for i in update:
2326
- setattr(obj,i,update[i])
2327
- session.commit()
2328
- except Exception as ee:
2329
- print(ee)
2330
- except Exception as e:
2331
- print(e)
2332
- elif cmd.lower() in ['cslf','clear selected location field']:
2333
- with db.Session(db.ENGINE) as session:
2334
- cta=len(db.LOCATION_FIELDS)
2335
- helpText=[]
2336
- for num,i in enumerate(db.LOCATION_FIELDS):
2337
- 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}"
2338
- helpText.append(msg)
2339
- helpText="\n".join(helpText)
2340
- while True:
2289
+ helpText=[]
2290
+ for num,i in enumerate(results):
2291
+ msg=f"{Fore.cyan}{num}/{Fore.light_yellow}{num+1} of {Fore.light_red}{ct} -> {Fore.orange_red_1}{i.seeShort()}{Style.reset}"
2292
+ helpText.append(msg)
2293
+ helpText='\n'.join(helpText)
2294
+ print(helpText)
2295
+ selected=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Which index(es):",helpText=helpText,data="list")
2341
2296
  try:
2342
- print(helpText)
2343
- selected=Prompt.__init2__(None,func=FormBuilderMkText,ptext="What Location Fields do you wish to clear only(a list if fine)?",helpText=helpText,data="list")
2344
- if selected in [None,'d']:
2345
- return
2346
- else:
2347
- upd8={}
2348
- for i in selected:
2349
- try:
2350
- index=int(i)
2351
- upd8[db.LOCATION_FIELDS[index]]=0
2352
- except Exception as ee:
2353
- print(ee)
2354
- session.query(db.Entry).update(upd8)
2355
- session.commit()
2356
- break
2297
+ if selected in [None,'d',[]]:
2298
+ continue
2299
+ for i in selected:
2300
+ try:
2301
+ index=int(i)
2302
+ obj=results[index]
2303
+ update={
2304
+ 'InList':False,
2305
+ 'ListQty':0,
2306
+ 'Shelf':0,
2307
+ 'Note':'',
2308
+ 'BackRoom':0,
2309
+ 'Distress':0,
2310
+ 'Display_1':0,
2311
+ 'Display_2':0,
2312
+ 'Display_3':0,
2313
+ 'Display_4':0,
2314
+ 'Display_5':0,
2315
+ 'Display_6':0,
2316
+ 'Stock_Total':0,
2317
+ 'CaseID_BR':'',
2318
+ 'CaseID_LD':'',
2319
+ 'CaseID_6W':'',
2320
+ 'SBX_WTR_DSPLY':0,
2321
+ 'SBX_CHP_DSPLY':0,
2322
+ 'SBX_WTR_KLR':0,
2323
+ 'FLRL_CHP_DSPLY':0,
2324
+ 'FLRL_WTR_DSPLY':0,
2325
+ 'WD_DSPLY':0,
2326
+ 'CHKSTND_SPLY':0,
2327
+ }
2328
+ for i in update:
2329
+ setattr(obj,i,update[i])
2330
+ session.commit()
2331
+ except Exception as ee:
2332
+ print(ee)
2357
2333
  except Exception as e:
2358
2334
  print(e)
2359
- elif cmd.lower() in ['mksl','make shopping list','p-slq','prompt slq','set list qty','slqp','slq-p']:
2360
- TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).setFieldInList("ListQty",load=True,only_select_qty=True)
2361
- elif cmd.lower() in ['pc','prec calc',]:
2362
- resultant=TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).prec_calc()
2363
- return func(resultant,data)
2364
- elif cmd.lower() in generate_cmds(startcmd=['lds2','rdts'],endCmd=['',]):
2365
- resultant=TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).rd_ui()
2366
- continue
2367
- elif cmd.lower() in ['b','back']:
2368
- lastTime=db.detectGetOrSet("PromptLastDTasFloat",datetime.now().timestamp(),setValue=True)
2369
- return
2370
- elif cmd.lower() in generate_cmds(startcmd=['fake',],endCmd=['phone','ph#','ph. no.','phone number']):
2371
- phn=db.PhakePhone().phonenumber
2372
- print(phn)
2373
- returnable=Control(func=FormBuilderMkText,ptext="Return this number as input?",helpText="yes or no",data="boolean")
2374
- if returnable is None:
2375
- continue
2376
- elif returnable in ['d',False]:
2335
+ elif cmd.lower() in ['cslf','clear selected location field']:
2336
+ with db.Session(db.ENGINE) as session:
2337
+ cta=len(db.LOCATION_FIELDS)
2338
+ helpText=[]
2339
+ for num,i in enumerate(db.LOCATION_FIELDS):
2340
+ 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}"
2341
+ helpText.append(msg)
2342
+ helpText="\n".join(helpText)
2343
+ while True:
2344
+ try:
2345
+ print(helpText)
2346
+ selected=Prompt.__init2__(None,func=FormBuilderMkText,ptext="What Location Fields do you wish to clear only(a list if fine)?",helpText=helpText,data="list")
2347
+ if selected in [None,'d']:
2348
+ return
2349
+ else:
2350
+ upd8={}
2351
+ for i in selected:
2352
+ try:
2353
+ index=int(i)
2354
+ upd8[db.LOCATION_FIELDS[index]]=0
2355
+ except Exception as ee:
2356
+ print(ee)
2357
+ session.query(db.Entry).update(upd8)
2358
+ session.commit()
2359
+ break
2360
+ except Exception as e:
2361
+ print(e)
2362
+ elif cmd.lower() in ['mksl','make shopping list','p-slq','prompt slq','set list qty','slqp','slq-p']:
2363
+ TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).setFieldInList("ListQty",load=True,only_select_qty=True)
2364
+ elif cmd.lower() in ['pc','prec calc',]:
2365
+ resultant=TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).prec_calc()
2366
+ return func(resultant,data)
2367
+ elif cmd.lower() in generate_cmds(startcmd=['lds2','rdts'],endCmd=['',]):
2368
+ resultant=TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).rd_ui()
2377
2369
  continue
2378
- else:
2379
- return func(phn,data)
2380
- elif cmd.lower() in ['h','help']:
2381
- llo_modes=["dlu.cr","Prompt.lsbld","esu","t.[mksl||qsl||set Shelf||set Display]"]
2382
- 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
2370
+ elif cmd.lower() in ['b','back']:
2371
+ lastTime=db.detectGetOrSet("PromptLastDTasFloat",datetime.now().timestamp(),setValue=True)
2372
+ return
2373
+ elif cmd.lower() in generate_cmds(startcmd=['fake',],endCmd=['phone','ph#','ph. no.','phone number']):
2374
+ phn=db.PhakePhone().phonenumber
2375
+ print(phn)
2376
+ returnable=Control(func=FormBuilderMkText,ptext="Return this number as input?",helpText="yes or no",data="boolean")
2377
+ if returnable is None:
2378
+ continue
2379
+ elif returnable in ['d',False]:
2380
+ continue
2381
+ else:
2382
+ return func(phn,data)
2383
+ elif cmd.lower() in ['h','help']:
2384
+ llo_modes=["dlu.cr","Prompt.lsbld","esu","t.[mksl||qsl||set Shelf||set Display]"]
2385
+ 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
2383
2386
  {Fore.orange_red_1}Location Fields{Fore.light_steel_blue} are fields where the item resides at, will reside at, is coming from etc...
2384
2387
  {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}
2385
2388
 
@@ -2460,491 +2463,503 @@ CMD's are not final until ended with {Fore.magenta}{hw_delim}{Style.reset}""")
2460
2463
  {Fore.grey_70}** {Fore.light_steel_blue}{generate_cmds(startcmd=['util','diff','rules'],endCmd=['encounter-verify','ev'])} {Fore.light_green}confirm an encounter rules{Style.reset}
2461
2464
  {Fore.grey_70}** {Fore.light_steel_blue}['letter','message']{Fore.light_green} Generate a displayable letter from a default format, allowing to return the text as colored, or plain output; if a return is not desired, continue to the last prompt. using curly-braces you may attempt to write small python code to be evaluated and used as text in the message/letter. This includes colors from Fore,Back, and Style.{Style.reset}
2462
2465
  {Fore.grey_70}** {Fore.light_steel_blue}{generate_cmds(startcmd=['simple','smpl'],endCmd=['scanner','scanr','scnnr','scnr'])} {Fore.light_green}a scanner recorder that only records the text,times scanned,and dtoe, and when when time permits, comment.{Style.reset}
2463
- '''
2464
- print(extra)
2465
- print(helpText)
2466
- continue
2467
- elif cmd.lower() in generate_cmds(startcmd=['simple','smpl'],endCmd=['scanner','scanr','scnnr','scnr']):
2468
- TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).simple_scanner()
2469
- continue
2470
- elif cmd.lower() in generate_cmds(startcmd=['util','checksum','cksm'],endCmd=['sha512 ','sha512']):
2471
- text=Control(func=FormBuilderMkText,ptext="Text: ",helpText="text for a checksum",data="str")
2472
- if text is None:
2473
- continue
2474
- elif text in ['NAN',]:
2475
- continue
2476
- returnIt=Control(func=FormBuilderMkText,ptext=f"Return '{hashlib.sha512(text.encode()).hexdigest()}': ",helpText="text for a checksum",data="boolean")
2477
- if returnIt in [None,'NAN']:
2478
- return func(None,data)
2479
- elif returnIt in [True,]:
2480
- return func(hashlib.sha512(text.encode()).hexdigest(),data)
2481
- else:
2482
- continue
2483
- elif cmd.lower() in generate_cmds(startcmd=['util','diff','rules'],endCmd=['encounter-verify','ev']):
2484
- rule=['Think of a passphrase that you will tell the messenger/courier',
2485
- 'execute `text2file` to send output to textfile',
2486
- '''execute `util sha512` and type your passphrase
2487
- into the prompt for sha512 checksum of the passphrase and hit enter when you are done''',
2488
- 'type one of `1/y/True/t` to return the hashsum to for writing to file.',
2489
- 'tell your passphrase to the messenger/courier whom will tell the passphrase to the target, ',
2490
- 'as well as provide the hashsum for the passphrase provided by the target to the courier',
2491
- 'the target will checksum the messenger/courier provided phrase exactly.'
2492
- 'the messenger/courier will checksum the phrase provided by the target exactly.'
2493
- 'if the checksum\'s match on both sides:'
2494
- 'then the transaction is confirmed to proceed',
2495
- 'execute `diff txt`',
2496
- 'execute `c2c`',
2497
- 'execute `Path("TextOut.txt").open("r"").read()` to the hashsum provided for the opposing parties passphrase',
2498
- 'execute `util sha512`',
2499
- 'type the passphrase exactly provided by the opposing party',
2500
- 'type `yes` or `1` or `t` to return the hashsum for the phrase provided by the opposing party for comparison',
2501
- 'against the pre-determined hashsum exchanged by file.',
2502
- f'return "{Fore.light_green}True{Style.reset}" if they match',
2503
- f'return "{Fore.light_red}False{Style.reset}" if they DO NOT match',
2504
- 'passphrases must be exchanged in person but are not restricted',
2505
- 'to how they are remitted for verification;',
2506
- 'each party is given the hashum of the opposing party\'s passphrase by file or must be written to TextOut.txt',
2507
- 'if the passphrase fails to match the checksum after a pre-determined number of fails(on either side),',
2508
- 'then the transaction is NOT to be completed and begin to',
2509
- 'follow appropriate procedures to handle the appropriate Severity of the failure; treat it as a threat under all circumstances.'
2510
- ]
2511
- ct=len(rule)
2512
- for num,i in enumerate(rule):
2513
- print(std_colorize(i,num,ct))
2514
- continue
2515
- elif cmd.lower() in generate_cmds(startcmd=['util','diff','eq'],endCmd=['text ','txt']):
2516
- text1=Control(func=FormBuilderMkText,ptext="Text 1: ",helpText="text 1",data="str")
2517
- if text1 is None:
2466
+ {Fore.grey_70}** {Fore.light_steel_blue}{generate_cmds(startcmd=['precision','prcsn'],endCmd=['set','st','='])} {Fore.light_green}set Prompt Decimal precision{Style.reset}
2467
+ '''
2468
+ print(extra)
2469
+ print(helpText)
2518
2470
  continue
2519
- elif text1 in ['NAN',]:
2471
+ elif cmd.lower() in generate_cmds(startcmd=['precision','prcsn'],endCmd=['set','st','=']):
2472
+ value=Control(func=FormBuilderMkText,ptext="How many digits of precision?",helpText=f"1-{decimal.MAX_PREC}",data="integer")
2473
+ if value in ['NaN',None]:
2474
+ continue
2475
+ elif value in ['d',]:
2476
+ value=4
2477
+ elif value < 1:
2478
+ print("invalid value")
2479
+ continue
2480
+ PROMPT_CONTEXT.prec=value
2520
2481
  continue
2521
- text2=Control(func=FormBuilderMkText,ptext="Text 2: ",helpText="text 2",data="str")
2522
- if text2 is None:
2482
+ elif cmd.lower() in generate_cmds(startcmd=['simple','smpl'],endCmd=['scanner','scanr','scnnr','scnr']):
2483
+ TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).simple_scanner()
2523
2484
  continue
2524
- elif text2 in ['NAN',]:
2485
+ elif cmd.lower() in generate_cmds(startcmd=['util','checksum','cksm'],endCmd=['sha512 ','sha512']):
2486
+ text=Control(func=FormBuilderMkText,ptext="Text: ",helpText="text for a checksum",data="str")
2487
+ if text is None:
2488
+ continue
2489
+ elif text in ['NAN',]:
2490
+ continue
2491
+ returnIt=Control(func=FormBuilderMkText,ptext=f"Return '{hashlib.sha512(text.encode()).hexdigest()}': ",helpText="text for a checksum",data="boolean")
2492
+ if returnIt in [None,'NAN']:
2493
+ return func(None,data)
2494
+ elif returnIt in [True,]:
2495
+ return func(hashlib.sha512(text.encode()).hexdigest(),data)
2496
+ else:
2497
+ continue
2498
+ elif cmd.lower() in generate_cmds(startcmd=['util','diff','rules'],endCmd=['encounter-verify','ev']):
2499
+ rule=['Think of a passphrase that you will tell the messenger/courier',
2500
+ 'execute `text2file` to send output to textfile',
2501
+ '''execute `util sha512` and type your passphrase
2502
+ into the prompt for sha512 checksum of the passphrase and hit enter when you are done''',
2503
+ 'type one of `1/y/True/t` to return the hashsum to for writing to file.',
2504
+ 'tell your passphrase to the messenger/courier whom will tell the passphrase to the target, ',
2505
+ 'as well as provide the hashsum for the passphrase provided by the target to the courier',
2506
+ 'the target will checksum the messenger/courier provided phrase exactly.'
2507
+ 'the messenger/courier will checksum the phrase provided by the target exactly.'
2508
+ 'if the checksum\'s match on both sides:'
2509
+ 'then the transaction is confirmed to proceed',
2510
+ 'execute `diff txt`',
2511
+ 'execute `c2c`',
2512
+ 'execute `Path("TextOut.txt").open("r"").read()` to the hashsum provided for the opposing parties passphrase',
2513
+ 'execute `util sha512`',
2514
+ 'type the passphrase exactly provided by the opposing party',
2515
+ 'type `yes` or `1` or `t` to return the hashsum for the phrase provided by the opposing party for comparison',
2516
+ 'against the pre-determined hashsum exchanged by file.',
2517
+ f'return "{Fore.light_green}True{Style.reset}" if they match',
2518
+ f'return "{Fore.light_red}False{Style.reset}" if they DO NOT match',
2519
+ 'passphrases must be exchanged in person but are not restricted',
2520
+ 'to how they are remitted for verification;',
2521
+ 'each party is given the hashum of the opposing party\'s passphrase by file or must be written to TextOut.txt',
2522
+ 'if the passphrase fails to match the checksum after a pre-determined number of fails(on either side),',
2523
+ 'then the transaction is NOT to be completed and begin to',
2524
+ 'follow appropriate procedures to handle the appropriate Severity of the failure; treat it as a threat under all circumstances.'
2525
+ ]
2526
+ ct=len(rule)
2527
+ for num,i in enumerate(rule):
2528
+ print(std_colorize(i,num,ct))
2525
2529
  continue
2530
+ elif cmd.lower() in generate_cmds(startcmd=['util','diff','eq'],endCmd=['text ','txt']):
2531
+ text1=Control(func=FormBuilderMkText,ptext="Text 1: ",helpText="text 1",data="str")
2532
+ if text1 is None:
2533
+ continue
2534
+ elif text1 in ['NAN',]:
2535
+ continue
2536
+ text2=Control(func=FormBuilderMkText,ptext="Text 2: ",helpText="text 2",data="str")
2537
+ if text2 is None:
2538
+ continue
2539
+ elif text2 in ['NAN',]:
2540
+ continue
2526
2541
 
2527
- if text1 == text2:
2528
- color=Fore.light_green
2529
- else:
2530
- color=Fore.light_red
2542
+ if text1 == text2:
2543
+ color=Fore.light_green
2544
+ else:
2545
+ color=Fore.light_red
2531
2546
 
2532
- returnIt=Control(func=FormBuilderMkText,ptext=f"Return '\001{color}{text1==text2}{Style.reset}\002': ",helpText="text1 == text2",data="str")
2533
- if returnIt in [None,'NAN']:
2534
- return func(None,data)
2535
- elif returnIt in [True,]:
2536
- return func(str(text1==text2),data)
2537
- else:
2538
- continue
2539
- elif cmd.lower() in generate_cmds(startcmd=['util',],endCmd=['tags','tgs']):
2540
- TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).setFieldInList("Tags",load=True,only_select_qty=True)
2541
- continue
2542
- elif cmd.lower() in generate_cmds(startcmd=['units',],endCmd=['']):
2543
- TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).listSystemUnits()
2544
- elif cmd.lower() in generate_cmds(startcmd=['units',],endCmd=['r','return','returnable']):
2545
- r=TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).listSystemUnits(returnable=True)
2546
- if r != None:
2547
- return func(r,data)
2548
- elif cmd.lower() in generate_cmds(startcmd=["set inlist","sil"],endCmd=["qtyu","u"]):
2549
- TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).set_inList()
2550
- elif cmd.lower() in ['None','none']:
2551
- return func(None,data)
2552
- elif cmd.lower() in ['NAN',]:
2553
- return func('NAN',data)
2554
- elif cmd.lower() in ['letter','message']:
2555
- m=TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).WriteLetter()
2556
- if m is None:
2557
- continue
2558
- else:
2559
- return func(m,data)
2560
- elif cmd.lower() in ['rllo','reverse list lookup order']:
2561
- try:
2562
- state=db.detectGetOrSet('list maker lookup order',False,setValue=False,literal=False)
2563
- state=db.detectGetOrSet('list maker lookup order',not state,setValue=True,literal=False)
2564
- except Exception as e:
2565
- print(e)
2566
- state=db.detectGetOrSet('list maker lookup order',True,setValue=True,literal=False)
2567
- continue
2568
- elif cmd.lower() in ['vllo','view list lookup order']:
2569
- try:
2570
- state=db.detectGetOrSet('list maker lookup order',False,setValue=False,literal=False)
2571
- translate={True:"Ascending by Timestamp, Newest==First Line & Last Line==Oldest",False:"Descending by Timestamp, Oldest==First Line & Last Line==Newest"}
2572
- print(f"{state} : {translate[state]}")
2573
- except Exception as e:
2574
- state=db.detectGetOrSet('list maker lookup order',True,setValue=True,literal=False)
2575
- state=db.detectGetOrSet('list maker lookup order',False,setValue=False,literal=False)
2576
- translate={True:"Ascending by Timestamp",False:"Descending by Timestamp"}
2577
- print(e)
2578
- continue
2579
- elif cmd.lower() in ['txt2fl','text2file','here2there','hr2thr']:
2580
- outfile=Path(db.detectGetOrSet('text2file','TextOut.txt',setValue=False,literal=True))
2581
- with open(outfile,'w') as x:
2582
- otext=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f'Text to Dump to {outfile}',helpText='saveable text',data="string")
2583
- if otext in [None,'d','']:
2584
- print("nothing was saved!")
2585
- if otext is None:
2547
+ returnIt=Control(func=FormBuilderMkText,ptext=f"Return '\001{color}{text1==text2}{Style.reset}\002': ",helpText="text1 == text2",data="str")
2548
+ if returnIt in [None,'NAN']:
2549
+ return func(None,data)
2550
+ elif returnIt in [True,]:
2551
+ return func(str(text1==text2),data)
2552
+ else:
2586
2553
  continue
2587
- x.write(otext)
2588
- print(f"wrote '{otext}' to '{outfile}'")
2589
- elif cmd.lower() in ['known','known devices','known dev','knwn dev']:
2590
- disp=KNOWN_DEVICES
2591
- disp.append('')
2592
- disp=list(reversed(disp))
2593
- dText='\n\t- '.join(disp)
2594
-
2595
- kscan_disp=KNOWN_SCANNERS
2596
- kscan_disp.append('')
2597
- kscan_disp=list(reversed(kscan_disp))
2598
- kscan='\n\t- '.join(kscan_disp)
2599
- try:
2600
- hline='.'*os.get_terminal_size().columns
2601
- except Exception as e:
2602
- hline=20
2603
- msg=f"""
2604
- {Fore.medium_purple_3b}Known Cellar Devices that can use this Software{Style.reset}
2605
- {Fore.medium_purple_3b}{hline}{Style.reset}
2606
- {Fore.medium_violet_red}{dText}{Style.reset}
2607
-
2608
- {Fore.light_yellow}The Recommended Scanners, currently
2609
- (as this code was writtern around them) are:
2610
- {Fore.dark_goldenrod}{kscan}{Style.reset}
2611
- {Style.bold}{Fore.light_green}Scanner Notes{Style.reset}
2612
- {hline}
2613
- {Fore.light_magenta}If You can add a suffix/prefix to
2614
- your scanners output, use {Fore.cyan}{hw_delim}{Fore.light_magenta} as the prefix
2615
- and suffix, to allow for additional code error correction,
2616
- where the scanner might insert a newline right before the
2617
- checksum{Style.reset}
2618
-
2619
- {Fore.dark_sea_green_5a}if you encapsulate your commands
2620
- 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}'
2621
- you can spread your command over several returns/newlines,
2622
- which will result in a cmd of 'ls Shelf'{Style.reset}
2623
- """
2624
- print(msg)
2625
- elif cmd in ['qc','quick change','q-c','q.c']:
2626
- if callable(qc):
2627
- print(f"{Fore.light_steel_blue}Quick Change Callable has been executed!{Style.reset}")
2628
- qc()
2629
- else:
2630
- print(f"{Fore.orange_red_1}No Quick Change Callable has been set! {Fore.light_green}This Does nothing{Style.reset}")
2631
- continue
2632
- elif cmd in ['upcify','format upc','fupc']:
2633
- def mkT(text,data):
2634
- return text
2635
- code=Prompt.__init2__(None,func=mkT,ptext="Text/Data: ",helpText=f"Format input text to look '{db.Entry.rebar(None,'TESTTEXTUPCA')}'",data='')
2636
- if code in [None,]:
2637
- end=True
2638
- break
2639
- elif code in ['d',]:
2554
+ elif cmd.lower() in generate_cmds(startcmd=['util',],endCmd=['tags','tgs']):
2555
+ TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).setFieldInList("Tags",load=True,only_select_qty=True)
2640
2556
  continue
2641
- resultant=db.Entry.rebar(None,code)
2642
- print(resultant)
2643
- elif cmd in ['clear all universion',"cau","clear_all_universal"]:
2644
- TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).clear_all()
2645
- elif cmd in ['codify','format code','fcode']:
2646
- def mkT(text,data):
2647
- return text
2648
- code=Prompt.__init2__(None,func=mkT,ptext="Text/Data: ",helpText=f"Format input text to look '{db.Entry.cfmt(None,'TESTTEXT')}'",data='')
2649
- if code in [None,]:
2650
- end=True
2651
- break
2652
- elif code in ['d',]:
2653
- continue
2654
- resultant=db.Entry.cfmt(None,code)
2655
- print(resultant)
2656
- elif cmd in ['upcify str','upcify.str','upcify-str','format upc str','fupcs']:
2657
- def mkT(text,data):
2658
- return text
2659
- code=Prompt.__init2__(None,func=mkT,ptext="Text/Data: ",helpText=f"Format input text to look '{db.Entry.rebar(None,'TESTTEXTUPCA')}'",data='')
2660
- if code in [None,]:
2661
- end=True
2662
- break
2663
- elif code in ['d',]:
2664
- continue
2665
- resultant=db.Entry.rebar(None,code)
2666
- print(resultant)
2667
- return func(resultant,data)
2668
- elif cmd.lower() in ['fbht','fmbh','formbuilder help','form helptext']:
2669
- FormBuilderHelpText()
2670
- continue
2671
- elif cmd in ['codify str','codify.str','codify-str','format code str','fcodes']:
2672
- def mkT(text,data):
2673
- return text
2674
- code=Prompt.__init2__(None,func=mkT,ptext="Text/Data: ",helpText=f"Format input text to look '{db.Entry.cfmt(None,'TESTTEXT')}'",data='')
2675
- if code in [None,]:
2676
- end=True
2677
- break
2678
- elif code in ['d',]:
2679
- continue
2680
- resultant=db.Entry.cfmt(None,code)
2681
- print(resultant)
2682
- return func(resultant,data)
2683
- elif cmd.lower() in ['bcd-gen','bcd-img']:
2684
- TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).bcd_img()
2685
- elif cmd.lower() in ['qr-gen','qr-img']:
2686
- TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).qr_img()
2687
- elif cmd.lower() in ['dsu','daystring','daystr']:
2688
- print(TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).day_string())
2689
- continue
2690
- elif cmd.lower() in ['dsur','daystring return','dstr r']:
2691
- m=TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).day_string()
2692
- print(m)
2693
- return func(m,data)
2694
- elif cmd.lower() in ['dsup','daystring plain','daystrpln']:
2695
- print(TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).day_string(plain=True))
2696
- continue
2697
- elif cmd.lower() in ['dsurp','daystring return plain','dstr r pln']:
2698
- m=TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).day_string(plain=True)
2699
- print(m)
2700
- return func(m,data)
2701
- elif cmd.lower() in ['crbc',"checked random barcode"]:
2702
- with db.Session(db.ENGINE) as session:
2703
- while True:
2704
- try:
2705
- code=''.join([str(random.randint(0,9)) for i in ' '*11])
2706
- UPCAcode=barcode.UPCA(code)
2707
- check=session.query(db.Entry).filter(or_(db.Entry.Barcode==str(UPCAcode),db.Entry.Barcode.icontains(str(UPCAcode)))).first()
2708
- if check != None:
2709
- continue
2710
- print(UPCAcode)
2711
- return func(str(UPCAcode),data)
2712
- except Exception as e:
2713
- print(e)
2714
- elif cmd.lower() in ['cruid',"checked uid"]:
2715
- with db.Session(db.ENGINE) as session:
2716
- while True:
2717
- try:
2718
- uid=str(uuid1())
2719
- check=session.query(db.Entry).filter(or_(db.Entry.Barcode==str(uid),db.Entry.Barcode.icontains(str(uid)))).first()
2720
- if check != None:
2721
- continue
2722
- print(uid)
2723
- return func(str(uid),data)
2724
- except Exception as e:
2725
- print(e)
2726
- elif cmd.lower() in ['h+','help+']:
2727
- 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}
2728
- {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
2729
- {Fore.light_magenta}rob=turn readline on/off at start
2730
- {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}''')
2731
- continue
2732
- elif cmd.lower() in ['i','info']:
2733
- while True:
2734
- msg_fmbtxt=f"""{FormBuilderHelpText()}"""
2735
- print(msg_fmbtxt)
2736
- n=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Next?",helpText="yes or no",data="boolean")
2737
- if n in ['d',True]:
2738
- pass
2739
- elif n is None:
2740
- fail=True
2741
- break
2742
- else:
2557
+ elif cmd.lower() in generate_cmds(startcmd=['units',],endCmd=['']):
2558
+ TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).listSystemUnits()
2559
+ elif cmd.lower() in generate_cmds(startcmd=['units',],endCmd=['r','return','returnable']):
2560
+ r=TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).listSystemUnits(returnable=True)
2561
+ if r != None:
2562
+ return func(r,data)
2563
+ elif cmd.lower() in generate_cmds(startcmd=["set inlist","sil"],endCmd=["qtyu","u"]):
2564
+ TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).set_inList()
2565
+ elif cmd.lower() in ['None','none']:
2566
+ return func(None,data)
2567
+ elif cmd.lower() in ['NAN',]:
2568
+ return func('NAN',data)
2569
+ elif cmd.lower() in ['letter','message']:
2570
+ m=TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).WriteLetter()
2571
+ if m is None:
2743
2572
  continue
2744
-
2745
- l=Path("Holidays.txt")
2746
- if not l.exists():
2747
- l=Path(__file__).parent.parent/Path("Holidays.txt")
2748
- print(l)
2749
- with open(l,"r") as msgr:
2750
- for num,line in enumerate(msgr.readlines()):
2751
- if num % 2 == 0:
2752
- color=Fore.light_yellow
2753
- else:
2754
- color=Fore.sea_green_2
2755
-
2756
- msg=f"""{Fore.magenta}Line {Fore.cyan}{num}/{Fore.light_steel_blue}{num+1} - {color}{line}{Style.reset}"""
2757
- print(msg)
2758
- n=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Next?",helpText="yes or no",data="boolean")
2759
- if n in ['d',True]:
2760
- pass
2761
- elif n is None:
2762
- fail=True
2763
- break
2764
2573
  else:
2765
- continue
2766
- 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}")
2767
- print(f"{Fore.light_cyan}Running on Android:{Fore.slate_blue_1}{db.onAndroid()}{Style.reset}")
2768
- 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}")
2769
- print(helpText2)
2770
- n=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Next?",helpText="yes or no",data="boolean")
2771
- if n in ['d',True]:
2772
- pass
2773
- elif n is None:
2774
- fail=True
2775
- break
2574
+ return func(m,data)
2575
+ elif cmd.lower() in ['rllo','reverse list lookup order']:
2576
+ try:
2577
+ state=db.detectGetOrSet('list maker lookup order',False,setValue=False,literal=False)
2578
+ state=db.detectGetOrSet('list maker lookup order',not state,setValue=True,literal=False)
2579
+ except Exception as e:
2580
+ print(e)
2581
+ state=db.detectGetOrSet('list maker lookup order',True,setValue=True,literal=False)
2582
+ continue
2583
+ elif cmd.lower() in ['vllo','view list lookup order']:
2584
+ try:
2585
+ state=db.detectGetOrSet('list maker lookup order',False,setValue=False,literal=False)
2586
+ translate={True:"Ascending by Timestamp, Newest==First Line & Last Line==Oldest",False:"Descending by Timestamp, Oldest==First Line & Last Line==Newest"}
2587
+ print(f"{state} : {translate[state]}")
2588
+ except Exception as e:
2589
+ state=db.detectGetOrSet('list maker lookup order',True,setValue=True,literal=False)
2590
+ state=db.detectGetOrSet('list maker lookup order',False,setValue=False,literal=False)
2591
+ translate={True:"Ascending by Timestamp",False:"Descending by Timestamp"}
2592
+ print(e)
2593
+ continue
2594
+ elif cmd.lower() in ['txt2fl','text2file','here2there','hr2thr']:
2595
+ outfile=Path(db.detectGetOrSet('text2file','TextOut.txt',setValue=False,literal=True))
2596
+ with open(outfile,'w') as x:
2597
+ otext=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f'Text to Dump to {outfile}',helpText='saveable text',data="string")
2598
+ if otext in [None,'d','']:
2599
+ print("nothing was saved!")
2600
+ if otext is None:
2601
+ continue
2602
+ x.write(otext)
2603
+ print(f"wrote '{otext}' to '{outfile}'")
2604
+ elif cmd.lower() in ['known','known devices','known dev','knwn dev']:
2605
+ disp=KNOWN_DEVICES
2606
+ disp.append('')
2607
+ disp=list(reversed(disp))
2608
+ dText='\n\t- '.join(disp)
2609
+
2610
+ kscan_disp=KNOWN_SCANNERS
2611
+ kscan_disp.append('')
2612
+ kscan_disp=list(reversed(kscan_disp))
2613
+ kscan='\n\t- '.join(kscan_disp)
2614
+ try:
2615
+ hline='.'*os.get_terminal_size().columns
2616
+ except Exception as e:
2617
+ hline=20
2618
+ msg=f"""
2619
+ {Fore.medium_purple_3b}Known Cellar Devices that can use this Software{Style.reset}
2620
+ {Fore.medium_purple_3b}{hline}{Style.reset}
2621
+ {Fore.medium_violet_red}{dText}{Style.reset}
2622
+
2623
+ {Fore.light_yellow}The Recommended Scanners, currently
2624
+ (as this code was writtern around them) are:
2625
+ {Fore.dark_goldenrod}{kscan}{Style.reset}
2626
+ {Style.bold}{Fore.light_green}Scanner Notes{Style.reset}
2627
+ {hline}
2628
+ {Fore.light_magenta}If You can add a suffix/prefix to
2629
+ your scanners output, use {Fore.cyan}{hw_delim}{Fore.light_magenta} as the prefix
2630
+ and suffix, to allow for additional code error correction,
2631
+ where the scanner might insert a newline right before the
2632
+ checksum{Style.reset}
2633
+
2634
+ {Fore.dark_sea_green_5a}if you encapsulate your commands
2635
+ 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}'
2636
+ you can spread your command over several returns/newlines,
2637
+ which will result in a cmd of 'ls Shelf'{Style.reset}
2638
+ """
2639
+ print(msg)
2640
+ elif cmd in ['qc','quick change','q-c','q.c']:
2641
+ if callable(qc):
2642
+ print(f"{Fore.light_steel_blue}Quick Change Callable has been executed!{Style.reset}")
2643
+ qc()
2776
2644
  else:
2777
- continue
2778
- Prompt.passwordfile(None,)
2779
- n=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Next?",helpText="yes or no",data="boolean")
2780
- if n in ['d',True]:
2781
- pass
2782
- elif n is None:
2783
- fail=True
2645
+ print(f"{Fore.orange_red_1}No Quick Change Callable has been set! {Fore.light_green}This Does nothing{Style.reset}")
2646
+ continue
2647
+ elif cmd in ['upcify','format upc','fupc']:
2648
+ def mkT(text,data):
2649
+ return text
2650
+ code=Prompt.__init2__(None,func=mkT,ptext="Text/Data: ",helpText=f"Format input text to look '{db.Entry.rebar(None,'TESTTEXTUPCA')}'",data='')
2651
+ if code in [None,]:
2652
+ end=True
2784
2653
  break
2785
- else:
2654
+ elif code in ['d',]:
2786
2655
  continue
2787
- print(Prompt.resrc(Prompt))
2788
- n=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Next?",helpText="yes or no",data="boolean")
2789
- if n in ['d',True]:
2790
- pass
2791
- elif n is None:
2792
- fail=True
2656
+ resultant=db.Entry.rebar(None,code)
2657
+ print(resultant)
2658
+ elif cmd in ['clear all universion',"cau","clear_all_universal"]:
2659
+ TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).clear_all()
2660
+ elif cmd in ['codify','format code','fcode']:
2661
+ def mkT(text,data):
2662
+ return text
2663
+ code=Prompt.__init2__(None,func=mkT,ptext="Text/Data: ",helpText=f"Format input text to look '{db.Entry.cfmt(None,'TESTTEXT')}'",data='')
2664
+ if code in [None,]:
2665
+ end=True
2793
2666
  break
2794
- else:
2667
+ elif code in ['d',]:
2795
2668
  continue
2796
- sales_tax_msg=f'''
2797
- {Fore.light_green}{Style.underline}Tax Formulas{Style.reset}
2798
- {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}
2799
- {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}
2800
- {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}
2801
- {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}
2802
- {Fore.light_red}Tax=(({Fore.cyan}CRV+{Fore.light_blue}Price)*{Fore.light_magenta}(Sales Tax Rate(0.0925))){Style.reset}
2803
- '''
2804
- print(sales_tax_msg)
2805
- n=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Next?",helpText="yes or no",data="boolean")
2806
- if n in ['d',True]:
2807
- pass
2808
- elif n is None:
2809
- fail=True
2669
+ resultant=db.Entry.cfmt(None,code)
2670
+ print(resultant)
2671
+ elif cmd in ['upcify str','upcify.str','upcify-str','format upc str','fupcs']:
2672
+ def mkT(text,data):
2673
+ return text
2674
+ code=Prompt.__init2__(None,func=mkT,ptext="Text/Data: ",helpText=f"Format input text to look '{db.Entry.rebar(None,'TESTTEXTUPCA')}'",data='')
2675
+ if code in [None,]:
2676
+ end=True
2810
2677
  break
2811
- else:
2678
+ elif code in ['d',]:
2812
2679
  continue
2813
- ConversionUnitsMSg=f"""
2814
- degress celcius - degC
2815
- degress fahrenheite - degF
2816
-
2817
- """
2818
- print(ConversionUnitsMSg)
2819
- n=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Next?",helpText="yes or no",data="boolean")
2820
- if n in ['d',True]:
2821
- pass
2822
- elif n is None:
2823
- fail=True
2680
+ resultant=db.Entry.rebar(None,code)
2681
+ print(resultant)
2682
+ return func(resultant,data)
2683
+ elif cmd.lower() in ['fbht','fmbh','formbuilder help','form helptext']:
2684
+ FormBuilderHelpText()
2685
+ continue
2686
+ elif cmd in ['codify str','codify.str','codify-str','format code str','fcodes']:
2687
+ def mkT(text,data):
2688
+ return text
2689
+ code=Prompt.__init2__(None,func=mkT,ptext="Text/Data: ",helpText=f"Format input text to look '{db.Entry.cfmt(None,'TESTTEXT')}'",data='')
2690
+ if code in [None,]:
2691
+ end=True
2824
2692
  break
2825
- else:
2693
+ elif code in ['d',]:
2826
2694
  continue
2827
- m='\n'.join([i for i in reversed(pydoc.render_doc(stre).split("\n"))])
2695
+ resultant=db.Entry.cfmt(None,code)
2696
+ print(resultant)
2697
+ return func(resultant,data)
2698
+ elif cmd.lower() in ['bcd-gen','bcd-img']:
2699
+ TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).bcd_img()
2700
+ elif cmd.lower() in ['qr-gen','qr-img']:
2701
+ TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).qr_img()
2702
+ elif cmd.lower() in ['dsu','daystring','daystr']:
2703
+ print(TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).day_string())
2704
+ continue
2705
+ elif cmd.lower() in ['dsur','daystring return','dstr r']:
2706
+ m=TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).day_string()
2707
+ print(m)
2708
+ return func(m,data)
2709
+ elif cmd.lower() in ['dsup','daystring plain','daystrpln']:
2710
+ print(TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).day_string(plain=True))
2711
+ continue
2712
+ elif cmd.lower() in ['dsurp','daystring return plain','dstr r pln']:
2713
+ m=TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).day_string(plain=True)
2828
2714
  print(m)
2715
+ return func(m,data)
2716
+ elif cmd.lower() in ['crbc',"checked random barcode"]:
2717
+ with db.Session(db.ENGINE) as session:
2718
+ while True:
2719
+ try:
2720
+ code=''.join([str(random.randint(0,9)) for i in ' '*11])
2721
+ UPCAcode=barcode.UPCA(code)
2722
+ check=session.query(db.Entry).filter(or_(db.Entry.Barcode==str(UPCAcode),db.Entry.Barcode.icontains(str(UPCAcode)))).first()
2723
+ if check != None:
2724
+ continue
2725
+ print(UPCAcode)
2726
+ return func(str(UPCAcode),data)
2727
+ except Exception as e:
2728
+ print(e)
2729
+ elif cmd.lower() in ['cruid',"checked uid"]:
2730
+ with db.Session(db.ENGINE) as session:
2731
+ while True:
2732
+ try:
2733
+ uid=str(uuid1())
2734
+ check=session.query(db.Entry).filter(or_(db.Entry.Barcode==str(uid),db.Entry.Barcode.icontains(str(uid)))).first()
2735
+ if check != None:
2736
+ continue
2737
+ print(uid)
2738
+ return func(str(uid),data)
2739
+ except Exception as e:
2740
+ print(e)
2741
+ elif cmd.lower() in ['h+','help+']:
2742
+ 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}
2743
+ {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
2744
+ {Fore.light_magenta}rob=turn readline on/off at start
2745
+ {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}''')
2746
+ continue
2747
+ elif cmd.lower() in ['i','info']:
2748
+ while True:
2749
+ msg_fmbtxt=f"""{FormBuilderHelpText()}"""
2750
+ print(msg_fmbtxt)
2751
+ n=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Next?",helpText="yes or no",data="boolean")
2752
+ if n in ['d',True]:
2753
+ pass
2754
+ elif n is None:
2755
+ fail=True
2756
+ break
2757
+ else:
2758
+ continue
2829
2759
 
2830
- n=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Again?",helpText="yes or no",data="boolean")
2831
- if n in ['d',True]:
2832
- pass
2833
- elif n is None:
2834
- fail=True
2835
- break
2836
- else:
2837
- break
2838
- continue
2839
- elif cmd.lower() in ['sftu','search for text universal',]:
2840
- result=global_search_for_text()
2841
- return func(result,data)
2842
- elif cmd.lower() in ["bldls","build","buildls","build list","bld ls",'lsbld','list build','ls bld','bld']:
2843
- bldls()
2844
- elif cmd.lower() in ["bldls crv","buildcrv","buildlscrv","build list crv","bld ls crv",'lsbld','list build crv','ls bld crv','bldcrv']:
2845
- bldls(mode=db.BooleanAnswers.setFieldInList_MODES.index('ONLY_SHOW_CRV'))
2846
- elif cmd.lower() in ["bldls tax","buildtax","buildlstax","build list tax","bld ls tx",'lsbldtx','list build tax','ls bld tx','bldtx']:
2847
- bldls(mode=db.BooleanAnswers.setFieldInList_MODES.index('ONLY_SHOW_TAXED'))
2848
- elif cmd.lower() in ["bldls no txcrv","build no tax crv","buildlsnotaxcrv","build list no tax crv","bld ls ntxcrv",'lsbldntxcrv','list build no tax crv','ls bld ntx crv','bldntxcrv']:
2849
- bldls(mode=db.BooleanAnswers.setFieldInList_MODES.index('NO_CRV_NO_TAX'))
2850
- elif cmd.lower() in generate_cmds(startcmd=['check','chk'],endCmd=['weather','wthr','dm','dmu']):
2851
- print(f"Weather Collection is done:{asyncio.run(db.theWeather())}")
2852
- continue
2853
- elif cmd.lower() in ["bldls showall","build showall","buildlssa","build list sa","bld ls sa",'lsbldsa','list build showall','ls bld sa','bld sa']:
2854
- bldls(mode=db.BooleanAnswers.setFieldInList_MODES.index('SHOWALL'))
2855
- elif cmd.lower() in generate_cmds(startcmd=["lsbld","buildls","bldls","bld"],endCmd=["ncrvtxd","nocrv txd","ncrv txd","no crv taxed"]):
2856
- bldls(mode=db.BooleanAnswers.setFieldInList_MODES.index('NO_CRV_TAXED'))
2857
- elif cmd.lower() in generate_cmds(startcmd=["lsbld","buildls","bldls","bld"],endCmd=["crvntx","crv ntx","crv notax","crv not taxed","crv untaxed"]):
2858
- bldls(mode=db.BooleanAnswers.setFieldInList_MODES.index('CRV_UNTAXED'))
2859
- elif cmd.lower() in ['si-reference','si-ref','si ref','si reference']:
2860
- msg=f"""{Fore.light_steel_blue}{Style.bold}
2861
- Name Symbol Factor/Scientific Name
2862
- {Fore.orange_red_1}{'-'*os.get_terminal_size().columns}{Style.reset}
2863
- {Fore.light_yellow}
2864
- quetta Q 10*(10**30)/e30 nonillion
2865
- ronna R 10*(10**27)/e27 octillion
2866
- yotta Y 10*(10**24)/e24 septillion
2867
- zetta Z 10*(10**21)/e21 sextillion
2868
- exa E 10*(10**18)/e18 quintillion
2869
- peta P 10*(10**15)/e15 quadrillion
2870
- tera T 10*(10**12)/e12 trillion
2871
- giga G 10*(10**9)/e9 billion
2872
- mega M 10*(10**6)/e6 million
2873
- kilo k 10*(10**3)/e3 thousand
2874
- hecto h 10*(10**2)/e2 hundred
2875
- deka da 10*(10**1)/e1 ten
2876
- {Fore.light_magenta}------- 100 -- one{Fore.spring_green_3a}
2877
- deci d 10*(10**-1)/e-1 tenth
2878
- centi c 10*(10**-2)/e-2 hundredth
2879
- milli m 10*(10**-3)/e-3 thousandth
2880
- micro μ 10*(10**-6)/e-6 millionth
2881
- nano n 10*(10**-9)/e-9 billionth
2882
- pico p 10*(10**-12)/e-12 trillionth
2883
- femto f 10*(10**-15)/e-15 quadrillionth
2884
- atto a 10*(10**-18)/e-18 quintillionth
2885
- zepto z 10*(10**-21)/e-21 sextillionth
2886
- yocto y 10*(10**-24)/e-24 septillionth
2887
- ronto r 10*(10**-27)/e-27 octillionth
2888
- quecto q 10*(10**-30)/e-30 nonillionth
2889
-
2890
- {math.pi:.2f} pico = {math.pi*10e-12:.13f} = {math.pi:.2f}*10e-13
2891
- {Style.reset}"""
2892
- print(msg)
2893
- continue
2894
- elif cmd.lower() in ['jcu','just count','just-count','just_count']:
2895
- bldls(justCount=True)
2896
- elif cmd.lower() in ['set prec','sprec']:
2897
- t=TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).setPrec()
2898
- continue
2899
- elif cmd.lower() in ['jcu-','just count -','just-count -','just_count -','just count minus','just-count minus','just_count minus']:
2900
- bldls(justCount=True,minus=True)
2901
- elif cmd.lower() in ['jtu','just total','just-total','just_total']:
2902
- bldls(justTotal=True)
2903
- elif cmd.lower() in ['jtu-','just total -','just-total -','just_total -','just total minus','just-total minus','just_total minus']:
2904
- bldls(justTotal=True,minus=True)
2905
- elif cmd.lower() in PRICE:
2906
- t=TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).pricing()
2907
- if t is not None:
2908
- print("returned")
2909
- try:
2910
- return func(str(t),data)
2911
- except:
2912
- return func(t,data)
2913
- elif cmd.lower() in FMLA:
2914
- t=TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).formulaeu()
2915
- if t is not None:
2916
- print("returned")
2917
- try:
2918
- return func(str(t),data)
2919
- except:
2920
- return func(t,data)
2921
- elif cmd.lower() in ["bldlse","builde","buildlse","build list export ","bld ls exp",'elsbld','export list build','exp ls bld','ebld']:
2922
- bldls(bldlse=True)
2923
- elif cmd.lower() in ['sbld','search build','search_build','scan build','scan_bld']:
2924
- bldls(sbld=True)
2925
- elif cmd.lower() in ['esbld','export search build','export_search_build','exp scan build','exp_scan_bld']:
2926
- bldls(bldlse=True,sbld=True)
2927
- elif cmd.lower() in ["bldls-","build-","buildls-","build list -","bld ls -",'lsbld-','list build -','ls bld -','bld-']:
2928
- bldls(minus=True)
2929
- elif cmd.lower() in ["bldlse-","builde-","buildlse-","build list export -","bld ls exp -",'elsbld-','export list build -','exp ls bld -','ebld-']:
2930
- bldls(bldlse=True,minus=True)
2931
- elif cmd.lower() in ['sbld-','search build -','search_build-','scan build-','scan_bld-']:
2932
- bldls(sbld=True,minus=True)
2933
- elif cmd.lower() in ['esbld-','export search build -','export_search_build-','exp scan build-','exp_scan_bld-']:
2934
- bldls(bldlse=True,sbld=True,minus=True)
2935
- elif cmd.lower() in ['cdp','clipboard_default_paste','clipboard default paste']:
2936
- with db.Session(db.ENGINE) as session:
2937
- dflt=session.query(db.ClipBoord).filter(db.ClipBoord.defaultPaste==True).order_by(db.ClipBoord.doe.desc()).first()
2938
- if dflt:
2939
- print(f"{Fore.orange_red_1}using '{Fore.light_blue}{dflt.cbValue}{Fore.orange_red_1}'{Style.reset}")
2940
- return func(dflt.cbValue,data)
2941
- else:
2942
- print(f"{Fore.orange_red_1}nothing to use!{Style.reset}")
2943
- else:
2944
- return func(cmd,data)
2945
- break
2946
- except KeyboardInterrupt as e:
2947
- pass
2760
+ l=Path("Holidays.txt")
2761
+ if not l.exists():
2762
+ l=Path(__file__).parent.parent/Path("Holidays.txt")
2763
+ print(l)
2764
+ with open(l,"r") as msgr:
2765
+ for num,line in enumerate(msgr.readlines()):
2766
+ if num % 2 == 0:
2767
+ color=Fore.light_yellow
2768
+ else:
2769
+ color=Fore.sea_green_2
2770
+
2771
+ msg=f"""{Fore.magenta}Line {Fore.cyan}{num}/{Fore.light_steel_blue}{num+1} - {color}{line}{Style.reset}"""
2772
+ print(msg)
2773
+ n=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Next?",helpText="yes or no",data="boolean")
2774
+ if n in ['d',True]:
2775
+ pass
2776
+ elif n is None:
2777
+ fail=True
2778
+ break
2779
+ else:
2780
+ continue
2781
+ 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}")
2782
+ print(f"{Fore.light_cyan}Running on Android:{Fore.slate_blue_1}{db.onAndroid()}{Style.reset}")
2783
+ 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}")
2784
+ print(helpText2)
2785
+ n=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Next?",helpText="yes or no",data="boolean")
2786
+ if n in ['d',True]:
2787
+ pass
2788
+ elif n is None:
2789
+ fail=True
2790
+ break
2791
+ else:
2792
+ continue
2793
+ Prompt.passwordfile(None,)
2794
+ n=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Next?",helpText="yes or no",data="boolean")
2795
+ if n in ['d',True]:
2796
+ pass
2797
+ elif n is None:
2798
+ fail=True
2799
+ break
2800
+ else:
2801
+ continue
2802
+ print(Prompt.resrc(Prompt))
2803
+ n=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Next?",helpText="yes or no",data="boolean")
2804
+ if n in ['d',True]:
2805
+ pass
2806
+ elif n is None:
2807
+ fail=True
2808
+ break
2809
+ else:
2810
+ continue
2811
+ sales_tax_msg=f'''
2812
+ {Fore.light_green}{Style.underline}Tax Formulas{Style.reset}
2813
+ {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}
2814
+ {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}
2815
+ {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}
2816
+ {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}
2817
+ {Fore.light_red}Tax=(({Fore.cyan}CRV+{Fore.light_blue}Price)*{Fore.light_magenta}(Sales Tax Rate(0.0925))){Style.reset}
2818
+ '''
2819
+ print(sales_tax_msg)
2820
+ n=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Next?",helpText="yes or no",data="boolean")
2821
+ if n in ['d',True]:
2822
+ pass
2823
+ elif n is None:
2824
+ fail=True
2825
+ break
2826
+ else:
2827
+ continue
2828
+ ConversionUnitsMSg=f"""
2829
+ degress celcius - degC
2830
+ degress fahrenheite - degF
2831
+
2832
+ """
2833
+ print(ConversionUnitsMSg)
2834
+ n=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Next?",helpText="yes or no",data="boolean")
2835
+ if n in ['d',True]:
2836
+ pass
2837
+ elif n is None:
2838
+ fail=True
2839
+ break
2840
+ else:
2841
+ continue
2842
+ m='\n'.join([i for i in reversed(pydoc.render_doc(stre).split("\n"))])
2843
+ print(m)
2844
+
2845
+ n=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Again?",helpText="yes or no",data="boolean")
2846
+ if n in ['d',True]:
2847
+ pass
2848
+ elif n is None:
2849
+ fail=True
2850
+ break
2851
+ else:
2852
+ break
2853
+ continue
2854
+ elif cmd.lower() in ['sftu','search for text universal',]:
2855
+ result=global_search_for_text()
2856
+ return func(result,data)
2857
+ elif cmd.lower() in ["bldls","build","buildls","build list","bld ls",'lsbld','list build','ls bld','bld']:
2858
+ bldls()
2859
+ elif cmd.lower() in ["bldls crv","buildcrv","buildlscrv","build list crv","bld ls crv",'lsbld','list build crv','ls bld crv','bldcrv']:
2860
+ bldls(mode=db.BooleanAnswers.setFieldInList_MODES.index('ONLY_SHOW_CRV'))
2861
+ elif cmd.lower() in ["bldls tax","buildtax","buildlstax","build list tax","bld ls tx",'lsbldtx','list build tax','ls bld tx','bldtx']:
2862
+ bldls(mode=db.BooleanAnswers.setFieldInList_MODES.index('ONLY_SHOW_TAXED'))
2863
+ elif cmd.lower() in ["bldls no txcrv","build no tax crv","buildlsnotaxcrv","build list no tax crv","bld ls ntxcrv",'lsbldntxcrv','list build no tax crv','ls bld ntx crv','bldntxcrv']:
2864
+ bldls(mode=db.BooleanAnswers.setFieldInList_MODES.index('NO_CRV_NO_TAX'))
2865
+ elif cmd.lower() in generate_cmds(startcmd=['check','chk'],endCmd=['weather','wthr','dm','dmu']):
2866
+ print(f"Weather Collection is done:{asyncio.run(db.theWeather())}")
2867
+ continue
2868
+ elif cmd.lower() in ["bldls showall","build showall","buildlssa","build list sa","bld ls sa",'lsbldsa','list build showall','ls bld sa','bld sa']:
2869
+ bldls(mode=db.BooleanAnswers.setFieldInList_MODES.index('SHOWALL'))
2870
+ elif cmd.lower() in generate_cmds(startcmd=["lsbld","buildls","bldls","bld"],endCmd=["ncrvtxd","nocrv txd","ncrv txd","no crv taxed"]):
2871
+ bldls(mode=db.BooleanAnswers.setFieldInList_MODES.index('NO_CRV_TAXED'))
2872
+ elif cmd.lower() in generate_cmds(startcmd=["lsbld","buildls","bldls","bld"],endCmd=["crvntx","crv ntx","crv notax","crv not taxed","crv untaxed"]):
2873
+ bldls(mode=db.BooleanAnswers.setFieldInList_MODES.index('CRV_UNTAXED'))
2874
+ elif cmd.lower() in ['si-reference','si-ref','si ref','si reference']:
2875
+ msg=f"""{Fore.light_steel_blue}{Style.bold}
2876
+ Name Symbol Factor/Scientific Name
2877
+ {Fore.orange_red_1}{'-'*os.get_terminal_size().columns}{Style.reset}
2878
+ {Fore.light_yellow}
2879
+ quetta Q 10*(10**30)/e30 nonillion
2880
+ ronna R 10*(10**27)/e27 octillion
2881
+ yotta Y 10*(10**24)/e24 septillion
2882
+ zetta Z 10*(10**21)/e21 sextillion
2883
+ exa E 10*(10**18)/e18 quintillion
2884
+ peta P 10*(10**15)/e15 quadrillion
2885
+ tera T 10*(10**12)/e12 trillion
2886
+ giga G 10*(10**9)/e9 billion
2887
+ mega M 10*(10**6)/e6 million
2888
+ kilo k 10*(10**3)/e3 thousand
2889
+ hecto h 10*(10**2)/e2 hundred
2890
+ deka da 10*(10**1)/e1 ten
2891
+ {Fore.light_magenta}------- 100 -- one{Fore.spring_green_3a}
2892
+ deci d 10*(10**-1)/e-1 tenth
2893
+ centi c 10*(10**-2)/e-2 hundredth
2894
+ milli m 10*(10**-3)/e-3 thousandth
2895
+ micro μ 10*(10**-6)/e-6 millionth
2896
+ nano n 10*(10**-9)/e-9 billionth
2897
+ pico p 10*(10**-12)/e-12 trillionth
2898
+ femto f 10*(10**-15)/e-15 quadrillionth
2899
+ atto a 10*(10**-18)/e-18 quintillionth
2900
+ zepto z 10*(10**-21)/e-21 sextillionth
2901
+ yocto y 10*(10**-24)/e-24 septillionth
2902
+ ronto r 10*(10**-27)/e-27 octillionth
2903
+ quecto q 10*(10**-30)/e-30 nonillionth
2904
+
2905
+ {math.pi:.2f} pico = {math.pi*10e-12:.13f} = {math.pi:.2f}*10e-13
2906
+ {Style.reset}"""
2907
+ print(msg)
2908
+ continue
2909
+ elif cmd.lower() in ['jcu','just count','just-count','just_count']:
2910
+ bldls(justCount=True)
2911
+ elif cmd.lower() in ['set prec','sprec']:
2912
+ t=TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).setPrec()
2913
+ continue
2914
+ elif cmd.lower() in ['jcu-','just count -','just-count -','just_count -','just count minus','just-count minus','just_count minus']:
2915
+ bldls(justCount=True,minus=True)
2916
+ elif cmd.lower() in ['jtu','just total','just-total','just_total']:
2917
+ bldls(justTotal=True)
2918
+ elif cmd.lower() in ['jtu-','just total -','just-total -','just_total -','just total minus','just-total minus','just_total minus']:
2919
+ bldls(justTotal=True,minus=True)
2920
+ elif cmd.lower() in PRICE:
2921
+ t=TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).pricing()
2922
+ if t is not None:
2923
+ print("returned")
2924
+ try:
2925
+ return func(str(t),data)
2926
+ except:
2927
+ return func(t,data)
2928
+ elif cmd.lower() in FMLA:
2929
+ t=TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).formulaeu()
2930
+ if t is not None:
2931
+ print("returned")
2932
+ try:
2933
+ return func(str(t),data)
2934
+ except:
2935
+ return func(t,data)
2936
+ elif cmd.lower() in ["bldlse","builde","buildlse","build list export ","bld ls exp",'elsbld','export list build','exp ls bld','ebld']:
2937
+ bldls(bldlse=True)
2938
+ elif cmd.lower() in ['sbld','search build','search_build','scan build','scan_bld']:
2939
+ bldls(sbld=True)
2940
+ elif cmd.lower() in ['esbld','export search build','export_search_build','exp scan build','exp_scan_bld']:
2941
+ bldls(bldlse=True,sbld=True)
2942
+ elif cmd.lower() in ["bldls-","build-","buildls-","build list -","bld ls -",'lsbld-','list build -','ls bld -','bld-']:
2943
+ bldls(minus=True)
2944
+ elif cmd.lower() in ["bldlse-","builde-","buildlse-","build list export -","bld ls exp -",'elsbld-','export list build -','exp ls bld -','ebld-']:
2945
+ bldls(bldlse=True,minus=True)
2946
+ elif cmd.lower() in ['sbld-','search build -','search_build-','scan build-','scan_bld-']:
2947
+ bldls(sbld=True,minus=True)
2948
+ elif cmd.lower() in ['esbld-','export search build -','export_search_build-','exp scan build-','exp_scan_bld-']:
2949
+ bldls(bldlse=True,sbld=True,minus=True)
2950
+ elif cmd.lower() in ['cdp','clipboard_default_paste','clipboard default paste']:
2951
+ with db.Session(db.ENGINE) as session:
2952
+ dflt=session.query(db.ClipBoord).filter(db.ClipBoord.defaultPaste==True).order_by(db.ClipBoord.doe.desc()).first()
2953
+ if dflt:
2954
+ print(f"{Fore.orange_red_1}using '{Fore.light_blue}{dflt.cbValue}{Fore.orange_red_1}'{Style.reset}")
2955
+ return func(dflt.cbValue,data)
2956
+ else:
2957
+ print(f"{Fore.orange_red_1}nothing to use!{Style.reset}")
2958
+ else:
2959
+ return func(cmd,data)
2960
+ break
2961
+ except KeyboardInterrupt as e:
2962
+ pass
2948
2963
 
2949
2964
  #since this will be used statically, no self is required
2950
2965
  #example filter method