radboy 0.0.375__py3-none-any.whl → 0.0.377__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
@@ -807,6 +807,173 @@ class Prompt(object):
807
807
 
808
808
 
809
809
  def __init2__(self,func,ptext='do what',helpText='',data={},noHistory=False,qc=None,replace_ptext=None):
810
+ '''
811
+ lsbld - bldls()
812
+ lsbld- - bldls(minus=True)
813
+ bldlse - bldls(bldlse=True)
814
+ bldlse - bldls(bldlse=True,minus=True)
815
+
816
+ sbld - bldls(sbld=True)
817
+ sbld- bldls(sbld=True,minus=True)
818
+ esbld - bldls(bldlse=True,sbld=True)
819
+ esblb- bldls(bldlse=True,sbld=True,minus=True)
820
+ '''
821
+ def bldls(bldlse=False,sbld=False,minus=False):
822
+ extras=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Show Extras?",helpText="extra data attached to each entry yes or no",data="boolean")
823
+ if extras in [None,'d',False]:
824
+ extras=False
825
+ msg=''
826
+ if bldlse:
827
+ db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file,clear_only=True)
828
+ with db.Session(db.ENGINE) as session:
829
+ results_query=session.query(db.Entry).filter(db.Entry.InList==True)
830
+ if sbld:
831
+ def mkT(text,data):
832
+ return text
833
+ code=Prompt.__init2__(None,func=mkT,ptext="Code|Barcode|Name: ",helpText="find by code,barcode,name",data='')
834
+ if code in [None,'d']:
835
+ return
836
+ results_query=results_query.filter(
837
+ db.or_(
838
+ db.Entry.Code==code,
839
+ db.Entry.Barcode==code,
840
+ db.Entry.Barcode.icontains(code),
841
+ db.Entry.Code.icontains(code),
842
+ db.Entry.Name.icontains(code)
843
+ )
844
+ )
845
+ 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"]
846
+ z=Prompt.mkfield_list(None,location_fields)
847
+ if z in [[],None]:
848
+ z=location_fields
849
+ location_fields=z
850
+ tmp=[]
851
+ for f in location_fields:
852
+ if not minus:
853
+ tmp.append(or_(getattr(db.Entry,f)>=0.0001))
854
+ else:
855
+ tmp.append(or_(getattr(db.Entry,f)!=0,getattr(db.Entry,f)!=None))
856
+
857
+ results_query=results_query.filter(or_(*tmp))
858
+ LookUpState=db.detectGetOrSet('list maker lookup order',False,setValue=False,literal=False)
859
+ if not isinstance(LookUpState,bool):
860
+ LookUpState=db.detectGetOrSet('list maker lookup order',False,setValue=True,literal=False)
861
+ if LookUpState == True:
862
+ results=results_query.order_by(db.Entry.Timestamp.asc()).all()
863
+ else:
864
+ results=results_query.order_by(db.Entry.Timestamp.desc()).all()
865
+ ct=len(results)
866
+ if ct < 1:
867
+ msg=f"{Fore.light_steel_blue}Nothing in {Fore.slate_blue_1}Bld{Fore.light_red}LS!{Style.reset}"
868
+ db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
869
+ print(msg)
870
+ return
871
+ #start
872
+ ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",3,setValue=False,literal=True))
873
+ master_total=0
874
+ master_total_crv=0
875
+ master_total_tax=0
876
+ master_total_tax_crv=0
877
+
878
+ for num,i in enumerate(results):
879
+ getExtras(i.EntryId,extras)
880
+ msg=f'{"*"*os.get_terminal_size().columns}\n{Fore.light_green}{num}{Fore.light_magenta}/{Fore.orange_3}{num+1} of {Fore.light_red}{ct}[{Fore.dark_slate_gray_1}EID{Fore.orange_3}]{Fore.dark_violet_1b}{i.EntryId}{Style.reset} |-| {Fore.light_yellow}{i.Name}|{Fore.light_salmon_1}[{Fore.light_red}BCD]{i.rebar()}{Fore.medium_violet_red}|[{Fore.light_red}CD{Fore.medium_violet_red}]{i.cfmt(i.Code)} {Style.reset}|-| '
881
+ colormapped=[
882
+ Fore.deep_sky_blue_4c,
883
+ Fore.spring_green_4,
884
+ Fore.turquoise_4,
885
+ Fore.dark_cyan,
886
+ Fore.deep_sky_blue_2,
887
+ Fore.spring_green_2a,
888
+ Fore.medium_spring_green,
889
+ Fore.steel_blue,
890
+ Fore.cadet_blue_1,
891
+ Fore.aquamarine_3,
892
+ Fore.purple_1a,
893
+ Fore.medium_purple_3a,
894
+ Fore.slate_blue_1,
895
+ Fore.light_slate_grey,
896
+ Fore.dark_olive_green_3a,
897
+ Fore.deep_pink_4c,
898
+ Fore.orange_3,
899
+ ]
900
+ total=0
901
+ crv=0
902
+ tax=0
903
+ tax_crv=0
904
+ i.Tax=round(i.Tax,ROUNDTO)
905
+ i.CRV=round(i.CRV,ROUNDTO)
906
+ i.Price=round(i.Price,ROUNDTO)
907
+ session.commit()
908
+ if not minus:
909
+ for n2,f in enumerate(location_fields):
910
+ try:
911
+ if getattr(i,f) > 0:
912
+ total+=getattr(i,f)
913
+ except Exception as e:
914
+ print(e)
915
+ for n2,f in enumerate(location_fields):
916
+ if getattr(i,f) > 0:
917
+ msg2=f'{colormapped[n2]}{f} = {round(getattr(i,f),ROUNDTO)}{Style.reset}'
918
+ if n2 < len(location_fields):
919
+ msg2+=","
920
+ msg+=msg2
921
+ else:
922
+ for n2,f in enumerate(location_fields):
923
+ try:
924
+ if getattr(i,f) != 0:
925
+ total+=getattr(i,f)
926
+ except Exception as e:
927
+ print(e)
928
+ for n2,f in enumerate(location_fields):
929
+ if getattr(i,f) != 0:
930
+ msg2=f'{colormapped[n2]}{f} = {round(getattr(i,f),3)}{Style.reset}'
931
+ if n2 < len(location_fields):
932
+ msg2+=","
933
+ msg+=msg2
934
+ master_total+=total*round(i.Price,ROUNDTO)
935
+
936
+ crv+=(round(i.CRV,ROUNDTO)*total)
937
+ tax+=(round(i.Tax,ROUNDTO)*total)
938
+ if tax == 0 and crv > 0:
939
+ tax_crv=(round(i.CRV,ROUNDTO)*total)
940
+ else:
941
+ tax_crv+=((round(i.Tax,ROUNDTO)*total)+(round(i.CRV,ROUNDTO)*total))
942
+ master_total_tax+=tax
943
+ master_total_crv+=crv
944
+ master_total_tax_crv+=tax_crv
945
+ tax_crv=round(tax_crv,ROUNDTO)
946
+ try:
947
+ super_total=(round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)/getSuperTotal(results,location_fields,colormapped)['final total'],ROUNDTO))*100
948
+ except Exception as e:
949
+ p1=round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO))
950
+ p2=getSuperTotal(results,location_fields,colormapped)['final total']
951
+ print(e)
952
+ print(p1,"p1")
953
+ print(p2,"p2")
954
+ super_total=0
955
+ msg+=f"""{Fore.light_magenta} |-|{Fore.light_green} Total = {Fore.light_sea_green}{round(total,ROUNDTO)}
956
+ {Fore.light_magenta}Price({i.Price}){Fore.medium_violet_red}*{Fore.light_slate_blue}Total({round(total,ROUNDTO)}):{round(i.Price*total,ROUNDTO)}
957
+ {Fore.grey_70}+CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TotalCRV({crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(total*i.Price,ROUNDTO)+crv})
958
+ {Fore.grey_70}+Tax({i.Tax}) w/o CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxNoCRVTotal({tax})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax,ROUNDTO)})
959
+ {Fore.grey_70}+Tax({i.Tax}) w/ CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxCRVTotal({tax_crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)})
960
+ {Fore.medium_violet_red}PercentOfTotal({round(super_total,ROUNDTO)}) of Total({getSuperTotal(results,location_fields,colormapped)['final total']})
961
+ {'*'*os.get_terminal_size().columns}{Style.reset}"""
962
+ if bldlse:
963
+ db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
964
+ print(msg)
965
+ master_total=round(master_total,ROUNDTO)
966
+ master_total_crv=round(master_total_crv,ROUNDTO)
967
+ master_total_tax=round(master_total_tax,ROUNDTO)
968
+ master_total_tax_crv=round(master_total_tax_crv,ROUNDTO)
969
+ msg=f"""{Fore.light_green}Total Product Value:{Fore.slate_blue_1}{round(master_total,ROUNDTO)}
970
+ {Fore.light_green}Total Product Value w/CRV({master_total_crv}):{Fore.slate_blue_1}{round(master_total_crv+master_total,ROUNDTO)}
971
+ {Fore.light_green}Total Product Value Taxed w/o CRV({master_total_tax}):{Fore.slate_blue_1}{round(master_total_tax+master_total,ROUNDTO)}
972
+ {Fore.light_green}Total Product Value Taxed w/ CRV({master_total_tax_crv}):{Fore.slate_blue_1}{round(master_total_tax_crv+master_total,ROUNDTO)}
973
+ {Style.reset}"""
974
+ if bldlse:
975
+ db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
976
+ print(msg)
810
977
  while True:
811
978
  try:
812
979
  lastTime=db.detectGetOrSet("PromptLastDTasFloat",datetime.now().timestamp())
@@ -2013,1015 +2180,25 @@ last month = today-30d
2013
2180
  result=global_search_for_text()
2014
2181
  return func(result,data)
2015
2182
  elif cmd.lower() in ["bldls","build","buildls","build list","bld ls",'lsbld','list build','ls bld','bld']:
2016
- extras=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Show Extras?",helpText="extra data attached to each entry yes or no",data="boolean")
2017
- if extras in [None,'d',False]:
2018
- extras=False
2019
-
2020
- with db.Session(db.ENGINE) as session:
2021
- results_query=session.query(db.Entry).filter(db.Entry.InList==True)
2022
- 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"]
2023
- z=Prompt.mkfield_list(None,location_fields)
2024
- if z in [[],None]:
2025
- z=location_fields
2026
- location_fields=z
2027
- tmp=[]
2028
- for f in location_fields:
2029
- tmp.append(or_(getattr(db.Entry,f)>=0.0001))
2030
- results_query=results_query.filter(or_(*tmp))
2031
-
2032
- LookUpState=db.detectGetOrSet('list maker lookup order',False,setValue=False,literal=False)
2033
- if not isinstance(LookUpState,bool):
2034
- LookUpState=db.detectGetOrSet('list maker lookup order',False,setValue=True,literal=False)
2035
- if LookUpState == True:
2036
- results=results_query.order_by(db.Entry.Timestamp.asc()).all()
2037
- else:
2038
- results=results_query.order_by(db.Entry.Timestamp.desc()).all()
2039
- ct=len(results)
2040
- if ct < 1:
2041
- print(f"{Fore.light_steel_blue}Nothing in {Fore.slate_blue_1}Bld{Fore.light_red}LS!{Style.reset}")
2042
- continue
2043
- ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",3,setValue=False,literal=True))
2044
- master_total=0
2045
- master_total_crv=0
2046
- master_total_tax=0
2047
- master_total_tax_crv=0
2048
-
2049
- for num,i in enumerate(results):
2050
- getExtras(i.EntryId,extras)
2051
- msg=f'{"*"*os.get_terminal_size().columns}\n{Fore.light_green}{num}{Fore.light_magenta}/{Fore.orange_3}{num+1} of {Fore.light_red}{ct}[{Fore.dark_slate_gray_1}EID{Fore.orange_3}]{Fore.dark_violet_1b}{i.EntryId}{Style.reset} |-| {Fore.light_yellow}{i.Name}|{Fore.light_salmon_1}[{Fore.light_red}BCD]{i.rebar()}{Fore.medium_violet_red}|[{Fore.light_red}CD{Fore.medium_violet_red}]{i.cfmt(i.Code)} {Style.reset}|-| '
2052
- colormapped=[
2053
- Fore.deep_sky_blue_4c,
2054
- Fore.spring_green_4,
2055
- Fore.turquoise_4,
2056
- Fore.dark_cyan,
2057
- Fore.deep_sky_blue_2,
2058
- Fore.spring_green_2a,
2059
- Fore.medium_spring_green,
2060
- Fore.steel_blue,
2061
- Fore.cadet_blue_1,
2062
- Fore.aquamarine_3,
2063
- Fore.purple_1a,
2064
- Fore.medium_purple_3a,
2065
- Fore.slate_blue_1,
2066
- Fore.light_slate_grey,
2067
- Fore.dark_olive_green_3a,
2068
- Fore.deep_pink_4c,
2069
- Fore.orange_3,
2070
- ]
2071
- total=0
2072
- crv=0
2073
- tax=0
2074
- tax_crv=0
2075
- i.Tax=round(i.Tax,ROUNDTO)
2076
- i.CRV=round(i.CRV,ROUNDTO)
2077
- i.Price=round(i.Price,ROUNDTO)
2078
- session.commit()
2079
- for n2,f in enumerate(location_fields):
2080
- try:
2081
- if getattr(i,f) > 0:
2082
- total+=getattr(i,f)
2083
- except Exception as e:
2084
- print(e)
2085
- for n2,f in enumerate(location_fields):
2086
- if getattr(i,f) > 0:
2087
- msg2=f'{colormapped[n2]}{f} = {round(getattr(i,f),ROUNDTO)}{Style.reset}'
2088
- if n2 < len(location_fields):
2089
- msg2+=","
2090
- msg+=msg2
2091
- master_total+=total*round(i.Price,ROUNDTO)
2092
-
2093
- crv+=(round(i.CRV,ROUNDTO)*total)
2094
- tax+=(round(i.Tax,ROUNDTO)*total)
2095
- if tax == 0 and crv > 0:
2096
- tax_crv=(round(i.CRV,ROUNDTO)*total)
2097
- else:
2098
- tax_crv+=((round(i.Tax,ROUNDTO)*total)+(round(i.CRV,ROUNDTO)*total))
2099
- master_total_tax+=tax
2100
- master_total_crv+=crv
2101
- master_total_tax_crv+=tax_crv
2102
- tax_crv=round(tax_crv,ROUNDTO)
2103
- try:
2104
- super_total=(round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)/getSuperTotal(results,location_fields,colormapped)['final total'],ROUNDTO))*100
2105
- except Exception as e:
2106
- p1=round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO))
2107
- p2=getSuperTotal(results,location_fields,colormapped)['final total']
2108
- print(e)
2109
- print(p1,"p1")
2110
- print(p2,"p2")
2111
- super_total=0
2112
-
2113
- msg+=f"""{Fore.light_magenta} |-|{Fore.light_green} Total = {Fore.light_sea_green}{round(total,ROUNDTO)}
2114
- {Fore.light_magenta}Price({i.Price}){Fore.medium_violet_red}*{Fore.light_slate_blue}Total({round(total,ROUNDTO)}):{round(i.Price*total,ROUNDTO)}
2115
- {Fore.grey_70}+CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TotalCRV({crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+crv,ROUNDTO)})
2116
- {Fore.grey_70}+Tax({i.Tax}) w/o CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxNoCRVTotal({tax})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax,ROUNDTO)})
2117
- {Fore.grey_70}+Tax({i.Tax}) w/ CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxCRVTotal({tax_crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)})
2118
- {Fore.medium_violet_red}PercentOfTotal({round(super_total,ROUNDTO)}) of Total({getSuperTotal(results,location_fields,colormapped)['final total']})
2119
- {'*'*os.get_terminal_size().columns}{Style.reset}"""
2120
- print(msg)
2121
- master_total=round(master_total,ROUNDTO)
2122
- master_total_crv=round(master_total_crv,ROUNDTO)
2123
- master_total_tax=round(master_total_tax,ROUNDTO)
2124
- master_total_tax_crv=round(master_total_tax_crv,ROUNDTO)
2125
- msg=f"""{Fore.light_green}Total Product Value:{Fore.slate_blue_1}{round(master_total,ROUNDTO)}
2126
- {Fore.light_green}Total Product Value w/CRV({master_total_crv}):{Fore.slate_blue_1}{round(master_total_crv+master_total,ROUNDTO)}
2127
- {Fore.light_green}Total Product Value Taxed w/o CRV({master_total_tax}):{Fore.slate_blue_1}{round(master_total_tax+master_total,ROUNDTO)}
2128
- {Fore.light_green}Total Product Value Taxed w/ CRV({master_total_tax_crv}):{Fore.slate_blue_1}{round(master_total_tax_crv+master_total,ROUNDTO)}
2129
- {Style.reset}"""
2130
- print(msg)
2183
+ bldls()
2131
2184
  elif cmd.lower() in ['quick price','qprc','price']:
2132
2185
  t=TM.Tasks.TasksMode.pricing(None)
2133
2186
  if t is not None:
2134
2187
  return func(str(t),data)
2135
2188
  elif cmd.lower() in ["bldlse","builde","buildlse","build list export ","bld ls exp",'elsbld','export list build','exp ls bld','ebld']:
2136
- extras=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Show Extras?",helpText="extra data attached to each entry yes or no",data="boolean")
2137
- if extras in [None,'d',False]:
2138
- extras=False
2139
- msg=''
2140
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file,clear_only=True)
2141
- with db.Session(db.ENGINE) as session:
2142
- results_query=session.query(db.Entry).filter(db.Entry.InList==True)
2143
- 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"]
2144
- z=Prompt.mkfield_list(None,location_fields)
2145
- if z in [[],None]:
2146
- z=location_fields
2147
- location_fields=z
2148
- tmp=[]
2149
- for f in location_fields:
2150
- tmp.append(or_(getattr(db.Entry,f)>=0.0001))
2151
- results_query=results_query.filter(or_(*tmp))
2152
- LookUpState=db.detectGetOrSet('list maker lookup order',False,setValue=False,literal=False)
2153
- if not isinstance(LookUpState,bool):
2154
- LookUpState=db.detectGetOrSet('list maker lookup order',False,setValue=True,literal=False)
2155
- if LookUpState == True:
2156
- results=results_query.order_by(db.Entry.Timestamp.asc()).all()
2157
- else:
2158
- results=results_query.order_by(db.Entry.Timestamp.desc()).all()
2159
- ct=len(results)
2160
- if ct < 1:
2161
- msg=f"{Fore.light_steel_blue}Nothing in {Fore.slate_blue_1}Bld{Fore.light_red}LS!{Style.reset}"
2162
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2163
- print(msg)
2164
- continue
2165
- #start
2166
- ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",3,setValue=False,literal=True))
2167
- master_total=0
2168
- master_total_crv=0
2169
- master_total_tax=0
2170
- master_total_tax_crv=0
2171
-
2172
- for num,i in enumerate(results):
2173
- getExtras(i.EntryId,extras)
2174
- msg=f'{"*"*os.get_terminal_size().columns}\n{Fore.light_green}{num}{Fore.light_magenta}/{Fore.orange_3}{num+1} of {Fore.light_red}{ct}[{Fore.dark_slate_gray_1}EID{Fore.orange_3}]{Fore.dark_violet_1b}{i.EntryId}{Style.reset} |-| {Fore.light_yellow}{i.Name}|{Fore.light_salmon_1}[{Fore.light_red}BCD]{i.rebar()}{Fore.medium_violet_red}|[{Fore.light_red}CD{Fore.medium_violet_red}]{i.cfmt(i.Code)} {Style.reset}|-| '
2175
- colormapped=[
2176
- Fore.deep_sky_blue_4c,
2177
- Fore.spring_green_4,
2178
- Fore.turquoise_4,
2179
- Fore.dark_cyan,
2180
- Fore.deep_sky_blue_2,
2181
- Fore.spring_green_2a,
2182
- Fore.medium_spring_green,
2183
- Fore.steel_blue,
2184
- Fore.cadet_blue_1,
2185
- Fore.aquamarine_3,
2186
- Fore.purple_1a,
2187
- Fore.medium_purple_3a,
2188
- Fore.slate_blue_1,
2189
- Fore.light_slate_grey,
2190
- Fore.dark_olive_green_3a,
2191
- Fore.deep_pink_4c,
2192
- Fore.orange_3,
2193
- ]
2194
- total=0
2195
- crv=0
2196
- tax=0
2197
- tax_crv=0
2198
- i.Tax=round(i.Tax,ROUNDTO)
2199
- i.CRV=round(i.CRV,ROUNDTO)
2200
- i.Price=round(i.Price,ROUNDTO)
2201
- session.commit()
2202
- for n2,f in enumerate(location_fields):
2203
- try:
2204
- if getattr(i,f) > 0:
2205
- total+=getattr(i,f)
2206
- except Exception as e:
2207
- print(e)
2208
- for n2,f in enumerate(location_fields):
2209
- if getattr(i,f) > 0:
2210
- msg2=f'{colormapped[n2]}{f} = {round(getattr(i,f),ROUNDTO)}{Style.reset}'
2211
- if n2 < len(location_fields):
2212
- msg2+=","
2213
- msg+=msg2
2214
- master_total+=total*round(i.Price,ROUNDTO)
2215
-
2216
- crv+=(round(i.CRV,ROUNDTO)*total)
2217
- tax+=(round(i.Tax,ROUNDTO)*total)
2218
- if tax == 0 and crv > 0:
2219
- tax_crv=(round(i.CRV,ROUNDTO)*total)
2220
- else:
2221
- tax_crv+=((round(i.Tax,ROUNDTO)*total)+(round(i.CRV,ROUNDTO)*total))
2222
- master_total_tax+=tax
2223
- master_total_crv+=crv
2224
- master_total_tax_crv+=tax_crv
2225
- tax_crv=round(tax_crv,ROUNDTO)
2226
- try:
2227
- super_total=(round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)/getSuperTotal(results,location_fields,colormapped)['final total'],ROUNDTO))*100
2228
- except Exception as e:
2229
- p1=round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO))
2230
- p2=getSuperTotal(results,location_fields,colormapped)['final total']
2231
- print(e)
2232
- print(p1,"p1")
2233
- print(p2,"p2")
2234
- super_total=0
2235
- msg+=f"""{Fore.light_magenta} |-|{Fore.light_green} Total = {Fore.light_sea_green}{round(total,ROUNDTO)}
2236
- {Fore.light_magenta}Price({i.Price}){Fore.medium_violet_red}*{Fore.light_slate_blue}Total({round(total,ROUNDTO)}):{round(i.Price*total,ROUNDTO)}
2237
- {Fore.grey_70}+CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TotalCRV({crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(total*i.Price,ROUNDTO)+crv})
2238
- {Fore.grey_70}+Tax({i.Tax}) w/o CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxNoCRVTotal({tax})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax,ROUNDTO)})
2239
- {Fore.grey_70}+Tax({i.Tax}) w/ CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxCRVTotal({tax_crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)})
2240
- {Fore.medium_violet_red}PercentOfTotal({round(super_total,ROUNDTO)}) of Total({getSuperTotal(results,location_fields,colormapped)['final total']})
2241
- {'*'*os.get_terminal_size().columns}{Style.reset}"""
2242
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2243
- print(msg)
2244
- master_total=round(master_total,ROUNDTO)
2245
- master_total_crv=round(master_total_crv,ROUNDTO)
2246
- master_total_tax=round(master_total_tax,ROUNDTO)
2247
- master_total_tax_crv=round(master_total_tax_crv,ROUNDTO)
2248
- msg=f"""{Fore.light_green}Total Product Value:{Fore.slate_blue_1}{round(master_total,ROUNDTO)}
2249
- {Fore.light_green}Total Product Value w/CRV({master_total_crv}):{Fore.slate_blue_1}{round(master_total_crv+master_total,ROUNDTO)}
2250
- {Fore.light_green}Total Product Value Taxed w/o CRV({master_total_tax}):{Fore.slate_blue_1}{round(master_total_tax+master_total,ROUNDTO)}
2251
- {Fore.light_green}Total Product Value Taxed w/ CRV({master_total_tax_crv}):{Fore.slate_blue_1}{round(master_total_tax_crv+master_total,ROUNDTO)}
2252
- {Style.reset}"""
2253
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2254
- print(msg)
2189
+ bldls(bldlse=True)
2255
2190
  elif cmd.lower() in ['sbld','search build','search_build','scan build','scan_bld']:
2256
- extras=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Show Extras?",helpText="extra data attached to each entry yes or no",data="boolean")
2257
- if extras in [None,'d',False]:
2258
- extras=False
2259
- end=False
2260
- while not end:
2261
- with db.Session(db.ENGINE) as session:
2262
- def mkT(text,data):
2263
- return text
2264
- code=Prompt.__init2__(None,func=mkT,ptext="Code|Barcode|Name: ",helpText="find by code,barcode,name",data='')
2265
- if code in [None,]:
2266
- end=True
2267
- break
2268
- elif code in ['d',]:
2269
- continue
2270
-
2271
- results_query=session.query(db.Entry).filter(db.Entry.InList==True)
2272
- results_query=results_query.filter(
2273
- db.or_(
2274
- db.Entry.Code==code,
2275
- db.Entry.Barcode==code,
2276
- db.Entry.Barcode.icontains(code),
2277
- db.Entry.Code.icontains(code),
2278
- db.Entry.Name.icontains(code)
2279
- )
2280
- )
2281
- 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"]
2282
- z=Prompt.mkfield_list(None,location_fields)
2283
- if z in [[],None]:
2284
- z=location_fields
2285
- location_fields=z
2286
- tmp=[]
2287
- for f in location_fields:
2288
- tmp.append(or_(getattr(db.Entry,f)>=0.0001))
2289
- results_query=results_query.filter(or_(*tmp))
2290
- LookUpState=db.detectGetOrSet('list maker lookup order',False,setValue=False,literal=False)
2291
- if not isinstance(LookUpState,bool):
2292
- LookUpState=db.detectGetOrSet('list maker lookup order',False,setValue=True,literal=False)
2293
- if LookUpState == True:
2294
- results=results_query.order_by(db.Entry.Timestamp.asc()).all()
2295
- else:
2296
- results=results_query.order_by(db.Entry.Timestamp.desc()).all()
2297
- ct=len(results)
2298
- if ct < 1:
2299
- print(f"{Fore.light_steel_blue}Nothing in {Fore.slate_blue_1}Bld{Fore.light_red}LS!{Style.reset}")
2300
- continue
2301
-
2302
- ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",3,set_value=False,literal=True))
2303
- #ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",3,setValue=False,literal=True))
2304
- master_total=0
2305
- master_total_crv=0
2306
- master_total_tax=0
2307
- master_total_tax_crv=0
2308
-
2309
- for num,i in enumerate(results):
2310
- getExtras(i.EntryId,extras)
2311
- msg=f'{"*"*os.get_terminal_size().columns}\n{Fore.light_green}{num}{Fore.light_magenta}/{Fore.orange_3}{num+1} of {Fore.light_red}{ct}[{Fore.dark_slate_gray_1}EID{Fore.orange_3}]{Fore.dark_violet_1b}{i.EntryId}{Style.reset} |-| {Fore.light_yellow}{i.Name}|{Fore.light_salmon_1}[{Fore.light_red}BCD]{i.rebar()}{Fore.medium_violet_red}|[{Fore.light_red}CD{Fore.medium_violet_red}]{i.cfmt(i.Code)} {Style.reset}|-| '
2312
- colormapped=[
2313
- Fore.deep_sky_blue_4c,
2314
- Fore.spring_green_4,
2315
- Fore.turquoise_4,
2316
- Fore.dark_cyan,
2317
- Fore.deep_sky_blue_2,
2318
- Fore.spring_green_2a,
2319
- Fore.medium_spring_green,
2320
- Fore.steel_blue,
2321
- Fore.cadet_blue_1,
2322
- Fore.aquamarine_3,
2323
- Fore.purple_1a,
2324
- Fore.medium_purple_3a,
2325
- Fore.slate_blue_1,
2326
- Fore.light_slate_grey,
2327
- Fore.dark_olive_green_3a,
2328
- Fore.deep_pink_4c,
2329
- Fore.orange_3,
2330
- ]
2331
- total=0
2332
- crv=0
2333
- tax=0
2334
- tax_crv=0
2335
- i.Tax=round(i.Tax,ROUNDTO)
2336
- i.CRV=round(i.CRV,ROUNDTO)
2337
- i.Price=round(i.Price,ROUNDTO)
2338
- session.commit()
2339
- for n2,f in enumerate(location_fields):
2340
- try:
2341
- if getattr(i,f) > 0:
2342
- total+=getattr(i,f)
2343
- except Exception as e:
2344
- print(e)
2345
- for n2,f in enumerate(location_fields):
2346
- if getattr(i,f) > 0:
2347
- msg2=f'{colormapped[n2]}{f} = {round(getattr(i,f),ROUNDTO)}{Style.reset}'
2348
- if n2 < len(location_fields):
2349
- msg2+=","
2350
- msg+=msg2
2351
- master_total+=total*round(i.Price,ROUNDTO)
2352
-
2353
- crv+=(round(i.CRV,ROUNDTO)*total)
2354
- tax+=(round(i.Tax,ROUNDTO)*total)
2355
- if tax == 0 and crv > 0:
2356
- tax_crv=(round(i.CRV,ROUNDTO)*total)
2357
- else:
2358
- tax_crv+=((round(i.Tax,ROUNDTO)*total)+(round(i.CRV,ROUNDTO)*total))
2359
- master_total_tax+=tax
2360
- master_total_crv+=crv
2361
- master_total_tax_crv+=tax_crv
2362
- tax_crv=round(tax_crv,ROUNDTO)
2363
- try:
2364
- super_total=(round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)/getSuperTotal(results,location_fields,colormapped)['final total'],ROUNDTO))*100
2365
- except Exception as e:
2366
- p1=round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO))
2367
- p2=getSuperTotal(results,location_fields,colormapped)['final total']
2368
- print(e)
2369
- print(p1,"p1")
2370
- print(p2,"p2")
2371
- super_total=0
2372
- msg+=f"""{Fore.light_magenta} |-|{Fore.light_green} Total = {Fore.light_sea_green}{round(total,ROUNDTO)}
2373
- {Fore.light_magenta}Price({i.Price}){Fore.medium_violet_red}*{Fore.light_slate_blue}Total({round(total,ROUNDTO)}):{round(i.Price*total,ROUNDTO)}
2374
- {Fore.grey_70}+CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TotalCRV({crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(total*i.Price,ROUNDTO)+crv})
2375
- {Fore.grey_70}+Tax({i.Tax}) w/o CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxNoCRVTotal({tax})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax,ROUNDTO)})
2376
- {Fore.grey_70}+Tax({i.Tax}) w/ CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxCRVTotal({tax_crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)})
2377
- {'*'*os.get_terminal_size().columns}{Style.reset}"""
2378
- print(msg)
2379
- master_total=round(master_total,ROUNDTO)
2380
- master_total_crv=round(master_total_crv,ROUNDTO)
2381
- master_total_tax=round(master_total_tax,ROUNDTO)
2382
- master_total_tax_crv=round(master_total_tax_crv,ROUNDTO)
2383
- msg=f"""{Fore.light_green}Total Product Value:{Fore.slate_blue_1}{round(master_total,ROUNDTO)}
2384
- {Fore.light_green}Total Product Value w/CRV({master_total_crv}):{Fore.slate_blue_1}{round(master_total_crv+master_total,ROUNDTO)}
2385
- {Fore.light_green}Total Product Value Taxed w/o CRV({master_total_tax}):{Fore.slate_blue_1}{round(master_total_tax+master_total,ROUNDTO)}
2386
- {Fore.light_green}Total Product Value Taxed w/ CRV({master_total_tax_crv}):{Fore.slate_blue_1}{round(master_total_tax_crv+master_total,ROUNDTO)}
2387
- {Fore.medium_violet_red}PercentOfTotal({round(super_total,ROUNDTO)}) of Total({getSuperTotal(results,location_fields,colormapped)['final total']})
2388
- {Style.reset}"""
2389
- print(msg)
2191
+ bldls(sbld=True)
2390
2192
  elif cmd.lower() in ['esbld','export search build','export_search_build','exp scan build','exp_scan_bld']:
2391
- extras=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Show Extras?",helpText="extra data attached to each entry yes or no",data="boolean")
2392
- if extras in [None,'d',False]:
2393
- extras=False
2394
- end=False
2395
- msg=''
2396
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file,clear_only=True)
2397
- while not end:
2398
- with db.Session(db.ENGINE) as session:
2399
- def mkT(text,data):
2400
- return text
2401
- code=Prompt.__init2__(None,func=mkT,ptext="Code|Barcode|Name: ",helpText="find by code,barcode,name",data='')
2402
- if code in [None,]:
2403
- end=True
2404
- break
2405
- elif code in ['d',]:
2406
- continue
2407
-
2408
- results_query=session.query(db.Entry).filter(db.Entry.InList==True)
2409
- results_query=results_query.filter(
2410
- db.or_(
2411
- db.Entry.Code==code,
2412
- db.Entry.Barcode==code,
2413
- db.Entry.Barcode.icontains(code),
2414
- db.Entry.Code.icontains(code),
2415
- db.Entry.Name.icontains(code)
2416
- )
2417
- )
2418
- 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"]
2419
- z=Prompt.mkfield_list(None,location_fields)
2420
- if z in [[],None]:
2421
- z=location_fields
2422
- location_fields=z
2423
- tmp=[]
2424
- for f in location_fields:
2425
- tmp.append(or_(getattr(db.Entry,f)>=0.0001))
2426
- results_query=results_query.filter(or_(*tmp))
2427
- LookUpState=db.detectGetOrSet('list maker lookup order',False,setValue=False,literal=False)
2428
- if not isinstance(LookUpState,bool):
2429
- LookUpState=db.detectGetOrSet('list maker lookup order',False,setValue=True,literal=False)
2430
- if LookUpState == True:
2431
- results=results_query.order_by(db.Entry.Timestamp.asc()).all()
2432
- else:
2433
- results=results_query.order_by(db.Entry.Timestamp.desc()).all()
2434
- ct=len(results)
2435
- if ct < 1:
2436
- msg=f"{Fore.light_steel_blue}Nothing in {Fore.slate_blue_1}Bld{Fore.light_red}LS!{Style.reset}"
2437
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2438
- print(msg)
2439
- continue
2440
-
2441
- #start
2442
- ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",3,setValue=False,literal=True))
2443
- master_total=0
2444
- master_total_crv=0
2445
- master_total_tax=0
2446
- master_total_tax_crv=0
2447
-
2448
- for num,i in enumerate(results):
2449
- getExtras(i.EntryId,extras)
2450
- msg=f'{"*"*os.get_terminal_size().columns}\n{Fore.light_green}{num}{Fore.light_magenta}/{Fore.orange_3}{num+1} of {Fore.light_red}{ct}[{Fore.dark_slate_gray_1}EID{Fore.orange_3}]{Fore.dark_violet_1b}{i.EntryId}{Style.reset} |-| {Fore.light_yellow}{i.Name}|{Fore.light_salmon_1}[{Fore.light_red}BCD]{i.rebar()}{Fore.medium_violet_red}|[{Fore.light_red}CD{Fore.medium_violet_red}]{i.cfmt(i.Code)} {Style.reset}|-| '
2451
- colormapped=[
2452
- Fore.deep_sky_blue_4c,
2453
- Fore.spring_green_4,
2454
- Fore.turquoise_4,
2455
- Fore.dark_cyan,
2456
- Fore.deep_sky_blue_2,
2457
- Fore.spring_green_2a,
2458
- Fore.medium_spring_green,
2459
- Fore.steel_blue,
2460
- Fore.cadet_blue_1,
2461
- Fore.aquamarine_3,
2462
- Fore.purple_1a,
2463
- Fore.medium_purple_3a,
2464
- Fore.slate_blue_1,
2465
- Fore.light_slate_grey,
2466
- Fore.dark_olive_green_3a,
2467
- Fore.deep_pink_4c,
2468
- Fore.orange_3,
2469
- ]
2470
- total=0
2471
- crv=0
2472
- tax=0
2473
- tax_crv=0
2474
- i.Tax=round(i.Tax,ROUNDTO)
2475
- i.CRV=round(i.CRV,ROUNDTO)
2476
- i.Price=round(i.Price,ROUNDTO)
2477
- session.commit()
2478
- for n2,f in enumerate(location_fields):
2479
- try:
2480
- if getattr(i,f) > 0:
2481
- total+=getattr(i,f)
2482
- except Exception as e:
2483
- print(e)
2484
- for n2,f in enumerate(location_fields):
2485
- if getattr(i,f) > 0:
2486
- msg2=f'{colormapped[n2]}{f} = {round(getattr(i,f),ROUNDTO)}{Style.reset}'
2487
- if n2 < len(location_fields):
2488
- msg2+=","
2489
- msg+=msg2
2490
- master_total+=total*round(i.Price,ROUNDTO)
2491
-
2492
- crv+=(round(i.CRV,ROUNDTO)*total)
2493
- tax+=(round(i.Tax,ROUNDTO)*total)
2494
- if tax == 0 and crv > 0:
2495
- tax_crv=(round(i.CRV,ROUNDTO)*total)
2496
- else:
2497
- tax_crv+=((round(i.Tax,ROUNDTO)*total)+(round(i.CRV,ROUNDTO)*total))
2498
- master_total_tax+=tax
2499
- master_total_crv+=crv
2500
- master_total_tax_crv+=tax_crv
2501
- tax_crv=round(tax_crv,ROUNDTO)
2502
- try:
2503
- super_total=(round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)/getSuperTotal(results,location_fields,colormapped)['final total'],ROUNDTO))*100
2504
- except Exception as e:
2505
- p1=round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO))
2506
- p2=getSuperTotal(results,location_fields,colormapped)['final total']
2507
- print(e)
2508
- print(p1,"p1")
2509
- print(p2,"p2")
2510
- super_total=0
2511
- msg+=f"""{Fore.light_magenta} |-|{Fore.light_green} Total = {Fore.light_sea_green}{round(total,ROUNDTO)}
2512
- {Fore.light_magenta}Price({i.Price}){Fore.medium_violet_red}*{Fore.light_slate_blue}Total({round(total,ROUNDTO)}):{round(i.Price*total,ROUNDTO)}
2513
- {Fore.grey_70}+CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TotalCRV({crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(total*i.Price,ROUNDTO)+crv})
2514
- {Fore.grey_70}+Tax({i.Tax}) w/o CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxNoCRVTotal({tax})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax,ROUNDTO)})
2515
- {Fore.grey_70}+Tax({i.Tax}) w/ CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxCRVTotal({tax_crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)})
2516
- {Fore.medium_violet_red}PercentOfTotal({round(super_total,ROUNDTO)}) of Total({getSuperTotal(results,location_fields,colormapped)['final total']})
2517
- {'*'*os.get_terminal_size().columns}{Style.reset}"""
2518
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2519
- print(msg)
2520
- master_total=round(master_total,ROUNDTO)
2521
- master_total_crv=round(master_total_crv,ROUNDTO)
2522
- master_total_tax=round(master_total_tax,ROUNDTO)
2523
- master_total_tax_crv=round(master_total_tax_crv,ROUNDTO)
2524
- msg=f"""{Fore.light_green}Total Product Value:{Fore.slate_blue_1}{round(master_total,ROUNDTO)}
2525
- {Fore.light_green}Total Product Value w/CRV({master_total_crv}):{Fore.slate_blue_1}{round(master_total_crv+master_total,ROUNDTO)}
2526
- {Fore.light_green}Total Product Value Taxed w/o CRV({master_total_tax}):{Fore.slate_blue_1}{round(master_total_tax+master_total,ROUNDTO)}
2527
- {Fore.light_green}Total Product Value Taxed w/ CRV({master_total_tax_crv}):{Fore.slate_blue_1}{round(master_total_tax_crv+master_total,ROUNDTO)}
2528
- {Style.reset}"""
2529
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2530
- print(msg)
2193
+ bldls(bldlse=True,sbld=True)
2531
2194
  elif cmd.lower() in ["bldls-","build-","buildls-","build list -","bld ls -",'lsbld-','list build -','ls bld -','bld-']:
2532
- extras=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Show Extras?",helpText="extra data attached to each entry yes or no",data="boolean")
2533
- if extras in [None,'d',False]:
2534
- extras=False
2535
- with db.Session(db.ENGINE) as session:
2536
- results_query=session.query(db.Entry).filter(db.Entry.InList==True)
2537
- 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"]
2538
- z=Prompt.mkfield_list(None,location_fields)
2539
- if z in [[],None]:
2540
- z=location_fields
2541
- location_fields=z
2542
- tmp=[]
2543
- for f in location_fields:
2544
- tmp.append(or_(getattr(db.Entry,f)!=0,getattr(db.Entry,f)!=None))
2545
- results_query=results_query.filter(or_(*tmp))
2546
- LookUpState=db.detectGetOrSet('list maker lookup order',False,setValue=False,literal=False)
2547
- if not isinstance(LookUpState,bool):
2548
- LookUpState=db.detectGetOrSet('list maker lookup order',False,setValue=True,literal=False)
2549
- if LookUpState == True:
2550
- results=results_query.order_by(db.Entry.Timestamp.asc()).all()
2551
- else:
2552
- results=results_query.order_by(db.Entry.Timestamp.desc()).all()
2553
- ct=len(results)
2554
- if ct < 1:
2555
- print(f"{Fore.light_steel_blue}Nothing in {Fore.slate_blue_1}Bld{Fore.light_red}LS!{Style.reset}")
2556
- continue
2557
- ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",3,setValue=False,literal=True))
2558
- master_total=0
2559
- master_total_crv=0
2560
- master_total_tax=0
2561
- master_total_tax_crv=0
2562
-
2563
- for num,i in enumerate(results):
2564
- getExtras(i.EntryId,extras)
2565
- msg=f'{"*"*os.get_terminal_size().columns}\n{Fore.light_green}{num}{Fore.light_magenta}/{Fore.orange_3}{num+1} of {Fore.light_red}{ct}[{Fore.dark_slate_gray_1}EID{Fore.orange_3}]{Fore.dark_violet_1b}{i.EntryId}{Style.reset} |-| {Fore.light_yellow}{i.Name}|{Fore.light_salmon_1}[{Fore.light_red}BCD]{i.rebar()}{Fore.medium_violet_red}|[{Fore.light_red}CD{Fore.medium_violet_red}]{i.cfmt(i.Code)} {Style.reset}|-| '
2566
- colormapped=[
2567
- Fore.deep_sky_blue_4c,
2568
- Fore.spring_green_4,
2569
- Fore.turquoise_4,
2570
- Fore.dark_cyan,
2571
- Fore.deep_sky_blue_2,
2572
- Fore.spring_green_2a,
2573
- Fore.medium_spring_green,
2574
- Fore.steel_blue,
2575
- Fore.cadet_blue_1,
2576
- Fore.aquamarine_3,
2577
- Fore.purple_1a,
2578
- Fore.medium_purple_3a,
2579
- Fore.slate_blue_1,
2580
- Fore.light_slate_grey,
2581
- Fore.dark_olive_green_3a,
2582
- Fore.deep_pink_4c,
2583
- Fore.orange_3,
2584
- ]
2585
- total=0
2586
- crv=0
2587
- tax=0
2588
- tax_crv=0
2589
- for n2,f in enumerate(location_fields):
2590
- try:
2591
- if getattr(i,f) != 0:
2592
- total+=getattr(i,f)
2593
- except Exception as e:
2594
- print(e)
2595
- for n2,f in enumerate(location_fields):
2596
- if getattr(i,f) != 0:
2597
- msg2=f'{colormapped[n2]}{f} = {round(getattr(i,f),3)}{Style.reset}'
2598
- if n2 < len(location_fields):
2599
- msg2+=","
2600
- msg+=msg2
2601
- master_total+=total*round(i.Price,ROUNDTO)
2602
-
2603
- crv+=(round(i.CRV,ROUNDTO)*total)
2604
- tax+=(round(i.Tax,ROUNDTO)*total)
2605
- if tax == 0 and crv > 0:
2606
- tax_crv=(round(i.CRV,ROUNDTO)*total)
2607
- else:
2608
- tax_crv+=((round(i.Tax,ROUNDTO)*total)+(round(i.CRV,ROUNDTO)*total))
2609
- master_total_tax+=tax
2610
- master_total_crv+=crv
2611
- master_total_tax_crv+=tax_crv
2612
- tax_crv=round(tax_crv,ROUNDTO)
2613
- try:
2614
- super_total=(round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)/getSuperTotal(results,location_fields,colormapped)['final total'],ROUNDTO))*100
2615
- except Exception as e:
2616
- p1=round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO))
2617
- p2=getSuperTotal(results,location_fields,colormapped)['final total']
2618
- print(e)
2619
- print(p1,"p1")
2620
- print(p2,"p2")
2621
- super_total=0
2622
-
2623
- msg+=f"""{Fore.light_magenta} |-|{Fore.light_green} Total = {Fore.light_sea_green}{round(total,ROUNDTO)}
2624
- {Fore.light_magenta}Price({i.Price}){Fore.medium_violet_red}*{Fore.light_slate_blue}Total({round(total,ROUNDTO)}):{round(i.Price*total,ROUNDTO)}
2625
- {Fore.grey_70}+CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TotalCRV({crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(total*i.Price,ROUNDTO)+crv})
2626
- {Fore.grey_70}+Tax({i.Tax}) w/o CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxNoCRVTotal({tax})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax,ROUNDTO)})
2627
- {Fore.grey_70}+Tax({i.Tax}) w/ CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxCRVTotal({tax_crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)})
2628
- {Fore.medium_violet_red}PercentOfTotal({round(super_total,ROUNDTO)}) of Total({getSuperTotal(results,location_fields,colormapped)['final total']})
2629
- {'*'*os.get_terminal_size().columns}{Style.reset}"""
2630
- print(msg)
2631
- master_total=round(master_total,ROUNDTO)
2632
- master_total_crv=round(master_total_crv,ROUNDTO)
2633
- master_total_tax=round(master_total_tax,ROUNDTO)
2634
- master_total_tax_crv=round(master_total_tax_crv,ROUNDTO)
2635
- msg=f"""{Fore.light_green}Total Product Value:{Fore.slate_blue_1}{round(master_total,ROUNDTO)}
2636
- {Fore.light_green}Total Product Value w/CRV({master_total_crv}):{Fore.slate_blue_1}{round(master_total_crv+master_total,ROUNDTO)}
2637
- {Fore.light_green}Total Product Value Taxed w/o CRV({master_total_tax}):{Fore.slate_blue_1}{round(master_total_tax+master_total,ROUNDTO)}
2638
- {Fore.light_green}Total Product Value Taxed w/ CRV({master_total_tax_crv}):{Fore.slate_blue_1}{round(master_total_tax_crv+master_total,ROUNDTO)}
2639
- {Style.reset}"""
2640
- print(msg)
2195
+ bldls(minus=True)
2641
2196
  elif cmd.lower() in ["bldlse-","builde-","buildlse-","build list export -","bld ls exp -",'elsbld-','export list build -','exp ls bld -','ebld-']:
2642
- extras=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Show Extras?",helpText="extra data attached to each entry yes or no",data="boolean")
2643
- if extras in [None,'d',False]:
2644
- extras=False
2645
- msg=''
2646
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file,clear_only=True)
2647
- with db.Session(db.ENGINE) as session:
2648
- results_query=session.query(db.Entry).filter(db.Entry.InList==True)
2649
- 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"]
2650
- z=Prompt.mkfield_list(None,location_fields)
2651
- if z in [[],None]:
2652
- z=location_fields
2653
- location_fields=z
2654
- tmp=[]
2655
- for f in location_fields:
2656
- tmp.append(or_(getattr(db.Entry,f)!=0,getattr(db.Entry,f)!=None))
2657
- results_query=results_query.filter(or_(*tmp))
2658
- LookUpState=db.detectGetOrSet('list maker lookup order',False,setValue=False,literal=False)
2659
- if not isinstance(LookUpState,bool):
2660
- LookUpState=db.detectGetOrSet('list maker lookup order',False,setValue=True,literal=False)
2661
- if LookUpState == True:
2662
- results=results_query.order_by(db.Entry.Timestamp.asc()).all()
2663
- else:
2664
- results=results_query.order_by(db.Entry.Timestamp.desc()).all()
2665
- ct=len(results)
2666
- if ct < 1:
2667
- msg=f"{Fore.light_steel_blue}Nothing in {Fore.slate_blue_1}Bld{Fore.light_red}LS!{Style.reset}"
2668
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2669
- print(msg)
2670
- continue
2671
- ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",3,setValue=False,literal=True))
2672
- master_total=0
2673
- master_total_crv=0
2674
- master_total_tax=0
2675
- master_total_tax_crv=0
2676
-
2677
- for num,i in enumerate(results):
2678
- getExtras(i.EntryId,extras)
2679
- msg=f'{"*"*os.get_terminal_size().columns}\n{Fore.light_green}{num}{Fore.light_magenta}/{Fore.orange_3}{num+1} of {Fore.light_red}{ct}[{Fore.dark_slate_gray_1}EID{Fore.orange_3}]{Fore.dark_violet_1b}{i.EntryId}{Style.reset} |-| {Fore.light_yellow}{i.Name}|{Fore.light_salmon_1}[{Fore.light_red}BCD]{i.rebar()}{Fore.medium_violet_red}|[{Fore.light_red}CD{Fore.medium_violet_red}]{i.cfmt(i.Code)} {Style.reset}|-| '
2680
- colormapped=[
2681
- Fore.deep_sky_blue_4c,
2682
- Fore.spring_green_4,
2683
- Fore.turquoise_4,
2684
- Fore.dark_cyan,
2685
- Fore.deep_sky_blue_2,
2686
- Fore.spring_green_2a,
2687
- Fore.medium_spring_green,
2688
- Fore.steel_blue,
2689
- Fore.cadet_blue_1,
2690
- Fore.aquamarine_3,
2691
- Fore.purple_1a,
2692
- Fore.medium_purple_3a,
2693
- Fore.slate_blue_1,
2694
- Fore.light_slate_grey,
2695
- Fore.dark_olive_green_3a,
2696
- Fore.deep_pink_4c,
2697
- Fore.orange_3,
2698
- ]
2699
- total=0
2700
- crv=0
2701
- tax=0
2702
- tax_crv=0
2703
- for n2,f in enumerate(location_fields):
2704
- try:
2705
- if getattr(i,f) != 0:
2706
- total+=getattr(i,f)
2707
- except Exception as e:
2708
- print(e)
2709
- for n2,f in enumerate(location_fields):
2710
- if getattr(i,f) != 0:
2711
- msg2=f'{colormapped[n2]}{f} = {round(getattr(i,f),ROUNDTO)}{Style.reset}'
2712
- if n2 < len(location_fields):
2713
- msg2+=","
2714
- msg+=msg2
2715
- master_total+=total*round(i.Price,ROUNDTO)
2716
-
2717
- crv+=(round(i.CRV,ROUNDTO)*total)
2718
- tax+=(round(i.Tax,ROUNDTO)*total)
2719
- if tax == 0 and crv > 0:
2720
- tax_crv=(round(i.CRV,ROUNDTO)*total)
2721
- else:
2722
- tax_crv+=((round(i.Tax,ROUNDTO)*total)+(round(i.CRV,ROUNDTO)*total))
2723
- master_total_tax+=tax
2724
- master_total_crv+=crv
2725
- master_total_tax_crv+=tax_crv
2726
- tax_crv=round(tax_crv,ROUNDTO)
2727
- try:
2728
- super_total=(round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)/getSuperTotal(results,location_fields,colormapped)['final total'],ROUNDTO))*100
2729
- except Exception as e:
2730
- p1=round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO))
2731
- p2=getSuperTotal(results,location_fields,colormapped)['final total']
2732
- print(e)
2733
- print(p1,"p1")
2734
- print(p2,"p2")
2735
- super_total=0
2736
-
2737
- msg+=f"""{Fore.light_magenta} |-|{Fore.light_green} Total = {Fore.light_sea_green}{round(total,ROUNDTO)}
2738
- {Fore.light_magenta}Price({i.Price}){Fore.medium_violet_red}*{Fore.light_slate_blue}Total({round(total,ROUNDTO)}):{round(i.Price*total,ROUNDTO)}
2739
- {Fore.grey_70}+CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TotalCRV({crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(total*i.Price,ROUNDTO)+crv})
2740
- {Fore.grey_70}+Tax({i.Tax}) w/o CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxNoCRVTotal({tax})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax,ROUNDTO)})
2741
- {Fore.grey_70}+Tax({i.Tax}) w/ CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxCRVTotal({tax_crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)})
2742
- {Fore.medium_violet_red}PercentOfTotal({round(super_total,ROUNDTO)}) of Total({getSuperTotal(results,location_fields,colormapped)['final total']})
2743
- {'*'*os.get_terminal_size().columns}{Style.reset}"""
2744
- print(msg)
2745
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2746
-
2747
- master_total=round(master_total,ROUNDTO)
2748
- master_total_crv=round(master_total_crv,ROUNDTO)
2749
- master_total_tax=round(master_total_tax,ROUNDTO)
2750
- master_total_tax_crv=round(master_total_tax_crv,ROUNDTO)
2751
- msg=f"""{Fore.light_green}Total Product Value:{Fore.slate_blue_1}{round(master_total,ROUNDTO)}
2752
- {Fore.light_green}Total Product Value w/CRV({master_total_crv}):{Fore.slate_blue_1}{round(master_total_crv+master_total,ROUNDTO)}
2753
- {Fore.light_green}Total Product Value Taxed w/o CRV({master_total_tax}):{Fore.slate_blue_1}{round(master_total_tax+master_total,ROUNDTO)}
2754
- {Fore.light_green}Total Product Value Taxed w/ CRV({master_total_tax_crv}):{Fore.slate_blue_1}{round(master_total_tax_crv+master_total,ROUNDTO)}
2755
- {Style.reset}"""
2756
- print(msg)
2757
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2197
+ bldls(bldlse=True,minus=True)
2758
2198
  elif cmd.lower() in ['sbld-','search build -','search_build-','scan build-','scan_bld-']:
2759
- extras=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Show Extras?",helpText="extra data attached to each entry yes or no",data="boolean")
2760
- if extras in [None,'d',False]:
2761
- extras=False
2762
- end=False
2763
- while not end:
2764
- with db.Session(db.ENGINE) as session:
2765
- def mkT(text,data):
2766
- return text
2767
- code=Prompt.__init2__(None,func=mkT,ptext="Code|Barcode|Name: ",helpText="find by code,barcode,name",data='')
2768
- if code in [None,]:
2769
- end=True
2770
- break
2771
- elif code in ['d',]:
2772
- continue
2773
-
2774
- results_query=session.query(db.Entry).filter(db.Entry.InList==True)
2775
- results_query=results_query.filter(
2776
- db.or_(
2777
- db.Entry.Code==code,
2778
- db.Entry.Barcode==code,
2779
- db.Entry.Barcode.icontains(code),
2780
- db.Entry.Code.icontains(code),
2781
- db.Entry.Name.icontains(code)
2782
- )
2783
- )
2784
- 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"]
2785
- z=Prompt.mkfield_list(None,location_fields)
2786
- if z in [[],None]:
2787
- z=location_fields
2788
- location_fields=z
2789
- tmp=[]
2790
- for f in location_fields:
2791
- tmp.append(or_(getattr(db.Entry,f)!=0,getattr(db.Entry,f)!=None))
2792
- results_query=results_query.filter(or_(*tmp))
2793
- LookUpState=db.detectGetOrSet('list maker lookup order',False,setValue=False,literal=False)
2794
- if not isinstance(LookUpState,bool):
2795
- LookUpState=db.detectGetOrSet('list maker lookup order',False,setValue=True,literal=False)
2796
- if LookUpState == True:
2797
- results=results_query.order_by(db.Entry.Timestamp.asc()).all()
2798
- else:
2799
- results=results_query.order_by(db.Entry.Timestamp.desc()).all()
2800
- ct=len(results)
2801
- if ct < 1:
2802
- print(f"{Fore.light_steel_blue}Nothing in {Fore.slate_blue_1}Bld{Fore.light_red}LS!{Style.reset}")
2803
- continue
2804
-
2805
- ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",3,setValue=False,literal=True))
2806
- master_total=0
2807
- master_total_crv=0
2808
- master_total_tax=0
2809
- master_total_tax_crv=0
2810
-
2811
- for num,i in enumerate(results):
2812
- getExtras(i.EntryId,extras)
2813
- msg=f'{"*"*os.get_terminal_size().columns}\n{Fore.light_green}{num}{Fore.light_magenta}/{Fore.orange_3}{num+1} of {Fore.light_red}{ct}[{Fore.dark_slate_gray_1}EID{Fore.orange_3}]{Fore.dark_violet_1b}{i.EntryId}{Style.reset} |-| {Fore.light_yellow}{i.Name}|{Fore.light_salmon_1}[{Fore.light_red}BCD]{i.rebar()}{Fore.medium_violet_red}|[{Fore.light_red}CD{Fore.medium_violet_red}]{i.cfmt(i.Code)} {Style.reset}|-| '
2814
- colormapped=[
2815
- Fore.deep_sky_blue_4c,
2816
- Fore.spring_green_4,
2817
- Fore.turquoise_4,
2818
- Fore.dark_cyan,
2819
- Fore.deep_sky_blue_2,
2820
- Fore.spring_green_2a,
2821
- Fore.medium_spring_green,
2822
- Fore.steel_blue,
2823
- Fore.cadet_blue_1,
2824
- Fore.aquamarine_3,
2825
- Fore.purple_1a,
2826
- Fore.medium_purple_3a,
2827
- Fore.slate_blue_1,
2828
- Fore.light_slate_grey,
2829
- Fore.dark_olive_green_3a,
2830
- Fore.deep_pink_4c,
2831
- Fore.orange_3,
2832
- ]
2833
- total=0
2834
- crv=0
2835
- tax=0
2836
- tax_crv=0
2837
- for n2,f in enumerate(location_fields):
2838
- try:
2839
- if getattr(i,f) != 0:
2840
- total+=getattr(i,f)
2841
- except Exception as e:
2842
- print(e)
2843
- for n2,f in enumerate(location_fields):
2844
- if getattr(i,f) != 0:
2845
- msg2=f'{colormapped[n2]}{f} = {round(getattr(i,f),ROUNDTO)}{Style.reset}'
2846
- if n2 < len(location_fields):
2847
- msg2+=","
2848
- msg+=msg2
2849
- master_total+=total*round(i.Price,3)
2850
-
2851
- crv+=(round(i.CRV,ROUNDTO)*total)
2852
- tax+=(round(i.Tax,ROUNDTO)*total)
2853
- if tax == 0 and crv > 0:
2854
- tax_crv=(round(i.CRV,ROUNDTO)*total)
2855
- else:
2856
- tax_crv+=((round(i.Tax,ROUNDTO)*total)+(round(i.CRV,ROUNDTO)*total))
2857
- master_total_tax+=tax
2858
- master_total_crv+=crv
2859
- master_total_tax_crv+=tax_crv
2860
- tax_crv=round(tax_crv,ROUNDTO)
2861
- try:
2862
- super_total=(round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)/getSuperTotal(results,location_fields,colormapped)['final total'],ROUNDTO))*100
2863
- except Exception as e:
2864
- p1=round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO))
2865
- p2=getSuperTotal(results,location_fields,colormapped)['final total']
2866
- print(e)
2867
- print(p1,"p1")
2868
- print(p2,"p2")
2869
- super_total=0
2870
-
2871
- msg+=f"""{Fore.light_magenta} |-|{Fore.light_green} Total = {Fore.light_sea_green}{round(total,ROUNDTO)}
2872
- {Fore.light_magenta}Price({i.Price}){Fore.medium_violet_red}*{Fore.light_slate_blue}Total({round(total,ROUNDTO)}):{round(i.Price*total,ROUNDTO)}
2873
- {Fore.grey_70}+CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TotalCRV({crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(total*i.Price,ROUNDTO)+crv})
2874
- {Fore.grey_70}+Tax({i.Tax}) w/o CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxNoCRVTotal({tax})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax,ROUNDTO)})
2875
- {Fore.grey_70}+Tax({i.Tax}) w/ CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxCRVTotal({tax_crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)})
2876
- {Fore.medium_violet_red}PercentOfTotal({round(super_total,ROUNDTO)}) of Total({getSuperTotal(results,location_fields,colormapped)['final total']})
2877
- {'*'*os.get_terminal_size().columns}{Style.reset}"""
2878
- print(msg)
2879
- master_total=round(master_total,ROUNDTO)
2880
- master_total_crv=round(master_total_crv,ROUNDTO)
2881
- master_total_tax=round(master_total_tax,ROUNDTO)
2882
- master_total_tax_crv=round(master_total_tax_crv,ROUNDTO)
2883
- msg=f"""{Fore.light_green}Total Product Value:{Fore.slate_blue_1}{round(master_total,ROUNDTO)}
2884
- {Fore.light_green}Total Product Value w/CRV({master_total_crv}):{Fore.slate_blue_1}{round(master_total_crv+master_total,ROUNDTO)}
2885
- {Fore.light_green}Total Product Value Taxed w/o CRV({master_total_tax}):{Fore.slate_blue_1}{round(master_total_tax+master_total,ROUNDTO)}
2886
- {Fore.light_green}Total Product Value Taxed w/ CRV({master_total_tax_crv}):{Fore.slate_blue_1}{round(master_total_tax_crv+master_total,ROUNDTO)}
2887
- {Style.reset}"""
2888
- print(msg)
2199
+ bldls(sbld=True,minus=True)
2889
2200
  elif cmd.lower() in ['esbld-','export search build -','export_search_build-','exp scan build-','exp_scan_bld-']:
2890
- extras=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Show Extras?",helpText="extra data attached to each entry yes or no",data="boolean")
2891
- if extras in [None,'d',False]:
2892
- extras=False
2893
- end=False
2894
- msg=''
2895
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file,clear_only=True)
2896
- while not end:
2897
- with db.Session(db.ENGINE) as session:
2898
- def mkT(text,data):
2899
- return text
2900
- code=Prompt.__init2__(None,func=mkT,ptext="Code|Barcode|Name: ",helpText="find by code,barcode,name",data='')
2901
- if code in [None,]:
2902
- end=True
2903
- break
2904
- elif code in ['d',]:
2905
- continue
2906
-
2907
- results_query=session.query(db.Entry).filter(db.Entry.InList==True)
2908
- results_query=results_query.filter(
2909
- db.or_(
2910
- db.Entry.Code==code,
2911
- db.Entry.Barcode==code,
2912
- db.Entry.Barcode.icontains(code),
2913
- db.Entry.Code.icontains(code),
2914
- db.Entry.Name.icontains(code)
2915
- )
2916
- )
2917
- 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"]
2918
- z=Prompt.mkfield_list(None,location_fields)
2919
- if z in [[],None]:
2920
- z=location_fields
2921
- location_fields=z
2922
- tmp=[]
2923
- for f in location_fields:
2924
- tmp.append(or_(getattr(db.Entry,f)!=0,getattr(db.Entry,f)!=None))
2925
- results_query=results_query.filter(or_(*tmp))
2926
- LookUpState=db.detectGetOrSet('list maker lookup order',False,setValue=False,literal=False)
2927
- if not isinstance(LookUpState,bool):
2928
- LookUpState=db.detectGetOrSet('list maker lookup order',False,setValue=True,literal=False)
2929
- if LookUpState == True:
2930
- results=results_query.order_by(db.Entry.Timestamp.asc()).all()
2931
- else:
2932
- results=results_query.order_by(db.Entry.Timestamp.desc()).all()
2933
- ct=len(results)
2934
- if ct < 1:
2935
- msg=f"{Fore.light_steel_blue}Nothing in {Fore.slate_blue_1}Bld{Fore.light_red}LS!{Style.reset}"
2936
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
2937
- print(msg)
2938
- continue
2939
- ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",3,setValue=False,literal=True))
2940
- master_total=0
2941
- master_total_crv=0
2942
- master_total_tax=0
2943
- master_total_tax_crv=0
2944
-
2945
- for num,i in enumerate(results):
2946
- getExtras(i.EntryId,extras)
2947
- msg=f'{"*"*os.get_terminal_size().columns}\n{Fore.light_green}{num}{Fore.light_magenta}/{Fore.orange_3}{num+1} of {Fore.light_red}{ct}[{Fore.dark_slate_gray_1}EID{Fore.orange_3}]{Fore.dark_violet_1b}{i.EntryId}{Style.reset} |-| {Fore.light_yellow}{i.Name}|{Fore.light_salmon_1}[{Fore.light_red}BCD]{i.rebar()}{Fore.medium_violet_red}|[{Fore.light_red}CD{Fore.medium_violet_red}]{i.cfmt(i.Code)} {Style.reset}|-| '
2948
- colormapped=[
2949
- Fore.deep_sky_blue_4c,
2950
- Fore.spring_green_4,
2951
- Fore.turquoise_4,
2952
- Fore.dark_cyan,
2953
- Fore.deep_sky_blue_2,
2954
- Fore.spring_green_2a,
2955
- Fore.medium_spring_green,
2956
- Fore.steel_blue,
2957
- Fore.cadet_blue_1,
2958
- Fore.aquamarine_3,
2959
- Fore.purple_1a,
2960
- Fore.medium_purple_3a,
2961
- Fore.slate_blue_1,
2962
- Fore.light_slate_grey,
2963
- Fore.dark_olive_green_3a,
2964
- Fore.deep_pink_4c,
2965
- Fore.orange_3,
2966
- ]
2967
- total=0
2968
- crv=0
2969
- tax=0
2970
- tax_crv=0
2971
- for n2,f in enumerate(location_fields):
2972
- try:
2973
- if getattr(i,f) != 0:
2974
- total+=getattr(i,f)
2975
- except Exception as e:
2976
- print(e)
2977
- for n2,f in enumerate(location_fields):
2978
- if getattr(i,f) != 0:
2979
- msg2=f'{colormapped[n2]}{f} = {round(getattr(i,f),ROUNDTO)}{Style.reset}'
2980
- if n2 < len(location_fields):
2981
- msg2+=","
2982
- msg+=msg2
2983
- master_total+=total*round(i.Price,ROUNDTO)
2984
-
2985
- crv+=(round(i.CRV,ROUNDTO)*total)
2986
- tax+=(round(i.Tax,ROUNDTO)*total)
2987
- if tax == 0 and crv > 0:
2988
- tax_crv=(round(i.CRV,ROUNDTO)*total)
2989
- else:
2990
- tax_crv+=((round(i.Tax,ROUNDTO)*total)+(round(i.CRV,ROUNDTO)*total))
2991
- master_total_tax+=tax
2992
- master_total_crv+=crv
2993
- master_total_tax_crv+=tax_crv
2994
- tax_crv=round(tax_crv,ROUNDTO)
2995
- try:
2996
- super_total=(round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)/getSuperTotal(results,location_fields,colormapped)['final total'],ROUNDTO))*100
2997
- except Exception as e:
2998
- p1=round(round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO))
2999
- p2=getSuperTotal(results,location_fields,colormapped)['final total']
3000
- print(e)
3001
- print(p1,"p1")
3002
- print(p2,"p2")
3003
- super_total=0
3004
- msg+=f"""{Fore.light_magenta} |-|{Fore.light_green} Total = {Fore.light_sea_green}{round(total,ROUNDTO)}
3005
- {Fore.light_magenta}Price({i.Price}){Fore.medium_violet_red}*{Fore.light_slate_blue}Total({round(total,ROUNDTO)}):{round(i.Price*total,ROUNDTO)}
3006
- {Fore.grey_70}+CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TotalCRV({crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(total*i.Price,ROUNDTO)+crv})
3007
- {Fore.grey_70}+Tax({i.Tax}) w/o CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxNoCRVTotal({tax})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax,ROUNDTO)})
3008
- {Fore.grey_70}+Tax({i.Tax}) w/ CRV({i.CRV})*Total({round(total,ROUNDTO)}){Fore.slate_blue_1}\n=TaxCRVTotal({tax_crv})+TotalPrice({round(total*i.Price,ROUNDTO)})=NetPrice({round(round(total*i.Price,ROUNDTO)+tax_crv,ROUNDTO)})
3009
- {Fore.medium_violet_red}PercentOfTotal({round(super_total,ROUNDTO)}) of Total({getSuperTotal(results,location_fields,colormapped)['final total']})
3010
- {'*'*os.get_terminal_size().columns}{Style.reset}"""
3011
- print(msg)
3012
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
3013
- master_total=round(master_total,ROUNDTO)
3014
- master_total_crv=round(master_total_crv,ROUNDTO)
3015
- master_total_tax=round(master_total_tax,ROUNDTO)
3016
- master_total_tax_crv=round(master_total_tax_crv,ROUNDTO)
3017
- msg=f"""{Fore.light_green}Total Product Value:{Fore.slate_blue_1}{round(master_total,ROUNDTO)}
3018
- {Fore.light_green}Total Product Value w/CRV({master_total_crv}):{Fore.slate_blue_1}{round(master_total_crv+master_total,ROUNDTO)}
3019
- {Fore.light_green}Total Product Value Taxed w/o CRV({master_total_tax}):{Fore.slate_blue_1}{round(master_total_tax+master_total,ROUNDTO)}
3020
- {Fore.light_green}Total Product Value Taxed w/ CRV({master_total_tax_crv}):{Fore.slate_blue_1}{round(master_total_tax_crv+master_total,ROUNDTO)}
3021
- {Style.reset}"""
3022
- print(msg)
3023
- db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
3024
- #end#
2201
+ bldls(bldlse=True,sbld=True,minus=True)
3025
2202
  elif cmd.lower() in ['cdp','clipboard_default_paste','clipboard default paste']:
3026
2203
  with db.Session(db.ENGINE) as session:
3027
2204
  dflt=session.query(db.ClipBoord).filter(db.ClipBoord.defaultPaste==True).order_by(db.ClipBoord.doe.desc()).first()