radboy 0.0.712__py3-none-any.whl → 0.0.714__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.

@@ -20,6 +20,9 @@ def CountTo():
20
20
  }
21
21
  start=datetime.now()
22
22
  data=FormBuilder(data=fd)
23
+ if data is None:
24
+ print("bad parameters!")
25
+ return
23
26
  absolute_start=False
24
27
  useLast=False
25
28
  while True:
@@ -41,6 +44,9 @@ def CountTo():
41
44
  }
42
45
  start=datetime.now()
43
46
  data=FormBuilder(data=fd)
47
+ if data is None:
48
+ print("bad parameters!")
49
+ return
44
50
  absolute_start=False
45
51
  if useLast:
46
52
  print("using last setup!")
radboy/DB/Prompt.py CHANGED
@@ -26,7 +26,7 @@ import lzma,base64
26
26
  from Crypto.Cipher import AES
27
27
  #from Cryptodome.Cipher import AES
28
28
  from Crypto.Util.Padding import pad, unpad
29
- from decimal import Decimal,localcontext
29
+ from decimal import Decimal,localcontext,getcontext
30
30
  import biip
31
31
  import itertools
32
32
  from inputimeout import inputimeout, TimeoutOccurred
@@ -196,7 +196,7 @@ def getExtras(entryId,extras):
196
196
 
197
197
  def getSuperTotal(results,location_fields,colormapped):
198
198
  with db.Session(db.ENGINE) as session:
199
- ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",3,setValue=False,literal=True))
199
+ ROUNDTO=int(db.detectGetOrSet("lsbld ROUNDTO default",4,setValue=False,literal=True))
200
200
  master_total=decc("0.00",cf=ROUNDTO)
201
201
  master_total_crv=decc("0.00",cf=ROUNDTO)
202
202
  master_total_tax=decc("0.00",cf=ROUNDTO)
@@ -1271,19 +1271,19 @@ class Prompt(object):
1271
1271
  print(db.strip_colors(msg))
1272
1272
  else:
1273
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}"""
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
1287
  if bldlse:
1288
1288
  db.logInput(msg,user=False,filter_colors=True,maxed_hfl=False,ofile=Prompt.bld_file)
1289
1289
  if not justCount and not justTotal:
@@ -1326,29 +1326,29 @@ class Prompt(object):
1326
1326
  if not reRunRequired:
1327
1327
  if justCount:
1328
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}
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
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}
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
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}
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
1339
  {Style.reset}"""
1340
1340
  if not simple:
1341
1341
  print(msg)
1342
1342
  return
1343
1343
  if justTotal:
1344
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}
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
1352
  """
1353
1353
  if not simple:
1354
1354
  print(msg)
@@ -1356,13 +1356,13 @@ class Prompt(object):
1356
1356
 
1357
1357
 
1358
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}
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
1366
  """
1367
1367
  if page:
1368
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")
@@ -1375,16 +1375,16 @@ class Prompt(object):
1375
1375
  pass
1376
1376
  else:
1377
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}
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
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}
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
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}
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
1388
  {Style.reset}"""
1389
1389
  else:
1390
1390
  msg=f"{Fore.orange_red_1}You need to re-run lsbld to recalculate properly!{Style.reset}"
@@ -2469,6 +2469,18 @@ class Prompt(object):
2469
2469
  print(helpText)
2470
2470
  continue
2471
2471
  elif cmd.lower() in generate_cmds(startcmd=['precision','prcsn'],endCmd=['set','st','=']):
2472
+ toplvl=Control(func=FormBuilderMkText,ptext="Is this for everything globally(False)?",helpText="boolean",data="boolean")
2473
+ if toplvl in ['NaN',None]:
2474
+ continue
2475
+ elif toplvl in ['d',]:
2476
+ toplvl=False
2477
+
2478
+ saveIt=Control(func=FormBuilderMkText,ptext="Save to settings(False)?",helpText="boolean",data="boolean")
2479
+ if saveIt in ['NaN',None]:
2480
+ continue
2481
+ elif saveIt in ['d',]:
2482
+ saveIt=False
2483
+
2472
2484
  value=Control(func=FormBuilderMkText,ptext="How many digits of precision?",helpText=f"1-{decimal.MAX_PREC}",data="integer")
2473
2485
  if value in ['NaN',None]:
2474
2486
  continue
@@ -2477,7 +2489,12 @@ class Prompt(object):
2477
2489
  elif value < 1:
2478
2490
  print("invalid value")
2479
2491
  continue
2480
- PROMPT_CONTEXT.prec=value
2492
+ if not toplvl:
2493
+ PROMPT_CONTEXT.prec=value
2494
+ else:
2495
+ getcontext().prec=value
2496
+ if saveIt:
2497
+ PROMPT_CONTEXT.prec=int(db.detectGetOrSet("lsbld ROUNDTO default",value,setValue=True,literal=False))
2481
2498
  continue
2482
2499
  elif cmd.lower() in generate_cmds(startcmd=['simple','smpl'],endCmd=['scanner','scanr','scnnr','scnr']):
2483
2500
  TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).simple_scanner()