radboy 0.0.544__py3-none-any.whl → 0.0.546__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
@@ -56,7 +56,9 @@ def std_colorize(m,n,c,start=f"[Prompt]{Back.black}{Fore.pale_turquoise_1} Start
56
56
  else:
57
57
  msg=f'{start}{Fore.light_cyan}{n}/{Fore.green_yellow}{n+1}{Fore.orange_red_1} of {c} {Fore.light_salmon_1}{m}{Style.reset}{end}'
58
58
  return msg
59
-
59
+ '''Formula/Price menu options'''
60
+ PRICE=['quick price','qprc','price','prc']
61
+ FMLA=['fmlau','formulae-u','pre-formula','formulas']
60
62
  def timedout(ptext,htext='',timeout_returnable="timeout"):
61
63
  try:
62
64
  while True:
@@ -2261,7 +2263,8 @@ CMD's are not final until ended with {Fore.magenta}{hw_delim}{Style.reset}""")
2261
2263
  {Fore.grey_70}**{Fore.light_green}'codify','format code','fcode'{Fore.light_steel_blue} Format input text to look '{db.Entry.cfmt(None,"TESTTEXT")}{Style.reset}'
2262
2264
  {Fore.grey_70}**{Fore.light_green}'upcify str','upcify.str','upcify-str','format upc str','fupcs'{Fore.light_steel_blue} Format input text to look and use formatted text as input-text'{db.Entry.rebar(None,"TESTTEXTUPCA")}{Style.reset}'
2263
2265
  {Fore.grey_70}**{Fore.light_green}'codify str','codify.str','codify-str','format code str','fcodes'{Fore.light_steel_blue} Format input text to look and use formatted text as input-text'{db.Entry.cfmt(None,"TESTTEXT")}{Style.reset}'
2264
- {Fore.grey_70}**{Fore.light_green}'quick price','qprc','price'{Fore.light_steel_blue} Calculate price information using user provided data for an arbitrary product who Data is not in the Entry table{Style.reset}
2266
+ {Fore.grey_70}**{Fore.light_green}{PRICE}{Fore.light_steel_blue} Calculate price information using user provided data for an arbitrary product who Data is not in the Entry table{Style.reset}
2267
+ {Fore.grey_70}**{Fore.light_green}{FMLA}{Fore.light_steel_blue} use some pre-built formulas for returning values to the prompt{Style.reset}
2265
2268
  {Fore.grey_70}**{Fore.light_green}'mksl','make shopping list','p-slq','prompt slq','set list qty','slqp','slq-p'{Fore.light_steel_blue} make a list using {Fore.green_3a}slq{Fore.light_steel_blue} from {Fore.orange_red_1}Tasks.{Fore.light_red}TasksMode{Style.reset}
2266
2269
  {Fore.grey_70}**{Fore.light_green}'ic2oc','input code to output code'{Fore.light_steel_blue} Convert an input code to its neighboring format for view or input use{Style.reset}
2267
2270
  {Fore.grey_70}**{Fore.light_green}'uniq-rcpt-id','uniq rcpt id','unique_reciept_id','urid','unique reciept id','unique-reciept-id'{Fore.light_steel_blue} Generate Relavent Receipt Id to be searchable in DayLogger{Style.reset}
@@ -2608,15 +2611,22 @@ degress fahrenheite - degF
2608
2611
  return func(result,data)
2609
2612
  elif cmd.lower() in ["bldls","build","buildls","build list","bld ls",'lsbld','list build','ls bld','bld']:
2610
2613
  bldls()
2611
- elif cmd.lower() in ['quick price','qprc','price']:
2612
- t=TM.Tasks.pricing(None)
2614
+ elif cmd.lower() in PRICE:
2615
+ t=TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).pricing()
2616
+ if t is not None:
2617
+ print("returned")
2618
+ try:
2619
+ return func(str(t),data)
2620
+ except:
2621
+ return func(t,data)
2622
+ elif cmd.lower() in FMLA:
2623
+ t=TM.Tasks.TasksMode(parent=self,engine=db.ENGINE,init_only=True).formulaeu()
2613
2624
  if t is not None:
2614
2625
  print("returned")
2615
2626
  try:
2616
2627
  return func(str(t),data)
2617
2628
  except:
2618
2629
  return func(t,data)
2619
-
2620
2630
  elif cmd.lower() in ["bldlse","builde","buildlse","build list export ","bld ls exp",'elsbld','export list build','exp ls bld','ebld']:
2621
2631
  bldls(bldlse=True)
2622
2632
  elif cmd.lower() in ['sbld','search build','search_build','scan build','scan_bld']:
@@ -815,7 +815,7 @@ class HealthLogUi:
815
815
  'exec':lambda self=self:self.export_log_field(fields=['BloodSugar','BloodSugarUnitName','LongActingInsulinName','LongActingInsulinTaken','LongActingInsulinUnitName','ShortActingInsulinName','ShortActingInsulinTaken','ShortActingInsulinUnitName','HeartRate','HeartRateUnitName','DrugConsumed','DrugQtyConsumed','DrugQtyConsumedUnitName','CarboHydrateIntake','CarboHydrateIntakeUnitName','Comments',],not_none=['Comments',])
816
816
  },
817
817
  'xpt consumed':{
818
- 'cmds':['xptfd','xpt fd','xpt food','lfd','xpt fuel','xpt fl','xlfl'],
818
+ 'cmds':['xptfd','xpt fd','xpt food','xpt-fd','xpt fuel','xpt fl','xlfl'],
819
819
  'desc':'export food',
820
820
  'exec':lambda self=self:self.export_log_field(
821
821
  fields=["EntryBarcode",
radboy/TasksMode/Tasks.py CHANGED
@@ -288,445 +288,596 @@ def td(time_string):
288
288
  def save(value):
289
289
  detectGetOrSet("InLineResult",value,setValue=True,literal=True)
290
290
 
291
- def pricing(self):
292
- #needs to be refactored
293
-
294
- while True:
295
- try:
296
- default_taxrate=Decimal(detectGetOrSet("Tax Rate",0.0925,setValue=False,literal=True))
297
- default_price=Decimal(detectGetOrSet("pricing default price",1,setValue=False,literal=True))
298
- default_bottle_qty=Decimal(detectGetOrSet("pricing default bottle_qty",1,setValue=False,literal=True))
299
- default_bottle_size=Decimal(detectGetOrSet("pricing default bottle_size",16.9,setValue=False,literal=True))
300
- default_purchased_qty=Decimal(detectGetOrSet("pricing default purchased_qty",1,setValue=False,literal=True))
301
- defaults_msg=f"""
302
- {Fore.orange_red_1}Default Settings [changeable under sysset]{Style.reset}
303
- {Fore.light_sea_green}default_taxrate=={Fore.turquoise_4}{default_taxrate},
304
- {Fore.grey_70}default_price=={Fore.light_yellow}{default_price},
305
- {Fore.light_sea_green}default_bottle_qty=={Fore.turquoise_4}{default_bottle_qty},
306
- {Fore.grey_70}default_bottle_size=={Fore.light_yellow}{default_bottle_size},
307
- {Fore.light_sea_green}default_purchased_qty=={Fore.turquoise_4}{default_purchased_qty}
308
- {Style.reset}"""
309
- def timedecimal_to_ampm():
310
- dayHours=Prompt.__init2__(None,func=FormBuilderMkText,ptext="How many hours in a day?: ",helpText="how many hours make a day? default is 24 ",data="dec.dec")
311
- if dayHours is None:
312
- return
313
- elif dayHours in ['d',]:
314
- dayHours=Decimal('24')
315
- halfday=dayHours/2
291
+ class Formulae:
292
+ def findAndUse2(self,options=None):
293
+ if options is None:
294
+ options=self.options
295
+ with Session(ENGINE) as session:
296
+ cmd=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"{Fore.light_red}[FindAndUse2]{Fore.light_yellow}what cmd are your looking for?",helpText="type the cmd",data="string")
297
+ if cmd in ['d',None]:
298
+ return
299
+ else:
300
+ options=copy(options)
301
+
302
+ session.query(FindCmd).delete()
303
+ session.commit()
304
+ for num,k in enumerate(options):
305
+ stage=0
306
+ cmds=options[k]['cmds']
307
+ l=[]
308
+ l.extend(cmds)
309
+ l.append(options[k]['desc'])
310
+ cmdStr=' '.join(l)
311
+ cmd_string=FindCmd(CmdString=cmdStr,CmdKey=k)
312
+ session.add(cmd_string)
313
+ if num % 50 == 0:
314
+ session.commit()
315
+ session.commit()
316
+ session.flush()
316
317
 
317
- result=None
318
- time_Dec=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Time Decimal: ",helpText="time of day as a decimal to convert to 12H ",data="dec.dec")
319
- if time_Dec is None:
318
+ results=session.query(FindCmd).filter(FindCmd.CmdString.icontains(cmd)).all()
319
+
320
+
321
+ ct=len(results)
322
+ if ct == 0:
323
+ print(f"No Cmd was found by {Fore.light_red}{cmd}{Style.reset}")
320
324
  return
321
- elif time_Dec in ['d',]:
322
- time_Dec=0.0
323
- ampm='am'
324
- if time_Dec >= 0 and time_Dec <= dayHours:
325
- if time_Dec <= halfday:
326
- hours=int(time_Dec)
327
- else:
328
- hours=int(time_Dec-halfday)
329
- ampm='pm'
330
- minutes=time_Dec-int(time_Dec)
331
-
325
+ for num,x in enumerate(results):
326
+ msg=f"{Fore.light_yellow}{num}/{Fore.light_steel_blue}{num+1} of {Fore.light_red}{ct} -> {Fore.turquoise_4}{f'{Fore.light_yellow},{Style.reset}{Fore.turquoise_4}'.join(options[x.CmdKey]['cmds'])} - {Fore.green_yellow}{options[x.CmdKey]['desc']}"
327
+ print(msg)
328
+ select=Prompt.__init2__(None,func=FormBuilderMkText,ptext="which index?",helpText="the number farthest to the left before the /",data="integer")
329
+ if select in [None,'d']:
330
+ return
331
+ try:
332
+ ee=options[results[select].CmdKey]['exec']
333
+ if callable(ee):
334
+ return ee()
335
+ except Exception as e:
336
+ print(e)
337
+
338
+ def __init__(self):
339
+ pass
340
+ def formulaeu(self):
341
+ while True:
342
+ try:
343
+ def timedecimal_to_ampm():
344
+ dayHours=Prompt.__init2__(None,func=FormBuilderMkText,ptext="How many hours in a day?: ",helpText="how many hours make a day? default is 24 ",data="dec.dec")
345
+ if dayHours is None:
346
+ return
347
+ elif dayHours in ['d',]:
348
+ dayHours=Decimal('24')
349
+ halfday=dayHours/2
350
+
351
+ result=None
352
+ time_Dec=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Time Decimal: ",helpText="time of day as a decimal to convert to 12H ",data="dec.dec")
353
+ if time_Dec is None:
354
+ return
355
+ elif time_Dec in ['d',]:
356
+ time_Dec=0.0
357
+ ampm='am'
358
+ if time_Dec >= 0 and time_Dec <= dayHours:
359
+ if time_Dec <= halfday:
360
+ hours=int(time_Dec)
361
+ else:
362
+ hours=int(time_Dec-halfday)
363
+ ampm='pm'
364
+ minutes=time_Dec-int(time_Dec)
365
+
366
+ try:
367
+ minutes=int(minutes*60)
368
+ except Exception as e:
369
+ print(e)
370
+ minutes=0
371
+ result=f"{hours}[12H]/{int(time_Dec)}[24]:{minutes} {ampm}"
372
+
373
+ return result
374
+ return result
375
+
376
+ def invert_value():
377
+ result=None
378
+ value=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Value to Invert: ",helpText="make user provided value, or formula negative (value*-1='-value')",data="dec.dec")
379
+ if value is None:
380
+ return
381
+ elif value in ['d',]:
382
+ value=0
383
+ result=value*-1
384
+ return result
385
+
386
+
387
+
388
+ self.options={
389
+ f'{uuid1()}':{
390
+ 'cmds':['invert','-value','iv-val'],
391
+ 'desc':f'{Fore.light_yellow}value{Fore.medium_violet_red}is multiplied by -1 to make inverse{Style.reset}',
392
+ 'exec':invert_value
393
+ },
394
+ f'{uuid1()}':{
395
+ 'cmds':['time dec to clock','t2c','time to clock'],
396
+ 'desc':f'{Fore.light_yellow}value{Fore.medium_violet_red}convert decimal time to clock time{Style.reset}',
397
+ 'exec':timedecimal_to_ampm
398
+ },
399
+ f'{uuid1()}':{
400
+ 'cmds':['fcmd','findcmd','find cmd'],
401
+ 'desc':f'Find {Fore.light_yellow}cmd{Fore.medium_violet_red}and excute for return{Style.reset}',
402
+ 'exec':self.findAndUse2
403
+ },
404
+ }
405
+ defaults_msg=f'''
406
+ '''
407
+ for num,i in enumerate(self.options):
408
+ self.options[i]['cmds'].append(str(num))
409
+ options=copy(self.options)
410
+
411
+ while True:
412
+ helpText=[]
413
+ for i in options:
414
+ msg=f"{Fore.light_green}{options[i]['cmds']}{Fore.light_red} -> {options[i]['desc']}{Style.reset}"
415
+ helpText.append(msg)
416
+ helpText='\n'.join(helpText)
417
+ print(helpText)
418
+ print(defaults_msg)
419
+ cmd=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Quick Formulas|Do What?:",helpText=helpText,data="string")
420
+ if cmd is None:
421
+ return None
422
+ result=None
423
+ for i in options:
424
+ els=[ii.lower() for ii in options[i]['cmds']]
425
+ if cmd.lower() in els:
426
+ result=options[i]['exec']()
427
+ break
428
+ print(f"{result}")
429
+ returnResult=Prompt.__init2__(None,func=FormBuilderMkText,ptext="[Formula] Return Result?[y/n]",helpText=f"result to return is '{result}'",data="boolean")
430
+ if returnResult in [True,]:
431
+ if result is None:
432
+ return None
433
+ else:
434
+ returnTypes=["float","Decimal","string","string"]
435
+ returnActor=[lambda x:round(float(x),4),lambda x:Decimal(x).quantize(Decimal("0.0000")),lambda x: f"{x:.4f}",lambda x:str(x)]
436
+ ct=len(returnTypes)
437
+ returnType=None
438
+ htext=[]
439
+ strOnly=False
440
+ for num,i in enumerate(returnTypes):
441
+ try:
442
+ htext.append(std_colorize(f"{i} - {returnActor[num](result)} ",num,ct))
443
+ except Exception as e:
444
+ strOnly=True
445
+ print(e)
446
+ htext='\n'.join(htext)
447
+ while returnType not in range(0,ct+1):
448
+ print(htext)
449
+ returnType=Prompt.__init2__(self,func=FormBuilderMkText,ptext="Return the value as?",helpText=f"{htext}\nwhich index?",data="integer")
450
+ if returnType is None:
451
+ return None
452
+ elif returnType in ['d',]:
453
+ if not strOnly:
454
+ returnType=1
455
+ else:
456
+ returnType=-1
457
+ break
458
+ #return str(result)
459
+ try:
460
+ if returnTypes[returnType] == 'float':
461
+ try:
462
+ return returnActor[returnType](result)
463
+ except Exception as e:
464
+ print(e)
465
+ continue
466
+ elif returnTypes[returnType] == 'Decimal':
467
+ try:
468
+ return returnActor[returnType](result)
469
+ except Exception as e:
470
+ print(e)
471
+ continue
472
+ elif returnTypes[returnType] == 'string':
473
+ try:
474
+ return returnActor[returnType](result)
475
+ except Exception as e:
476
+ print(e)
477
+ continue
478
+ else:
479
+ return result
480
+ except Exception as e:
481
+ print(e)
482
+ print("returning as a string")
483
+ return result
484
+ return result
485
+ except Exception as e:
486
+ print(e,str(e),repr(e))
487
+ return None
488
+
489
+
490
+ def pricing(self):
491
+ """Price and Formulas whose values can be returned to the Prompt."""
492
+ while True:
493
+ try:
494
+ default_taxrate=Decimal(detectGetOrSet("Tax Rate",0.0925,setValue=False,literal=True))
495
+ default_price=Decimal(detectGetOrSet("pricing default price",1,setValue=False,literal=True))
496
+ default_bottle_qty=Decimal(detectGetOrSet("pricing default bottle_qty",1,setValue=False,literal=True))
497
+ default_bottle_size=Decimal(detectGetOrSet("pricing default bottle_size",16.9,setValue=False,literal=True))
498
+ default_purchased_qty=Decimal(detectGetOrSet("pricing default purchased_qty",1,setValue=False,literal=True))
499
+ defaults_msg=f"""
500
+ {Fore.orange_red_1}Default Settings [changeable under sysset]{Style.reset}
501
+ {Fore.light_sea_green}default_taxrate=={Fore.turquoise_4}{default_taxrate},
502
+ {Fore.grey_70}default_price=={Fore.light_yellow}{default_price},
503
+ {Fore.light_sea_green}default_bottle_qty=={Fore.turquoise_4}{default_bottle_qty},
504
+ {Fore.grey_70}default_bottle_size=={Fore.light_yellow}{default_bottle_size},
505
+ {Fore.light_sea_green}default_purchased_qty=={Fore.turquoise_4}{default_purchased_qty}
506
+ {Style.reset}"""
507
+
508
+ def tax_rate_decimal():
509
+ result=None
510
+ tax_percent=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Tax Rate Percent: ",helpText="percent to convert to decimal (Percent/100=Rate)",data="dec.dec")
511
+ if tax_percent is None:
512
+ return
513
+ elif tax_percent in ['d',]:
514
+ tax_percent=default_taxrate/100
515
+ result=tax_percent/100
516
+ return result
517
+
518
+ def beverage_PTCRV_base():
519
+ result=None
520
+ print('Beverage Total Price+Tax+CRV of Size')
521
+ price=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Price ($)(default={default_price}):",helpText="A float or integer",data="float")
522
+ if price is None:
523
+ return None
524
+ elif price in ['','d']:
525
+ price=default_price
526
+
527
+
528
+ bottle_size=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Size in FlOz(or eqivalent,oz assumed if not specified({default_bottle_size})):",helpText="a value plus its unit",data="string")
529
+ if bottle_size is None:
530
+ return None
531
+ elif bottle_size in ['d',]:
532
+ bottle_size=default_bottle_size
332
533
  try:
333
- minutes=int(minutes*60)
534
+ bts=float(bottle_size)
535
+ bottle_size=f"{bts} floz"
334
536
  except Exception as e:
335
537
  print(e)
336
- minutes=0
337
- result=f"{hours}[12H]/{int(time_Dec)}[24]:{minutes} {ampm}"
338
-
339
- return result
340
- return result
538
+ x=pint.UnitRegistry()
539
+ xx=x(bottle_size)
540
+ xxx=xx.to("floz")
541
+ bottle_qty=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Qty Of Containers({default_bottle_qty}):",helpText="A float or integer",data="float")
542
+ if bottle_qty is None:
543
+ return None
544
+ elif bottle_qty in ['d',]:
545
+ bottle_qty=default_bottle_qty
341
546
 
342
- def tax_rate_decimal():
343
- result=None
344
- tax_percent=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Tax Rate Percent: ",helpText="percent to convert to decimal (Percent/100=Rate)",data="dec.dec")
345
- if tax_percent is None:
346
- return
347
- elif tax_percent in ['d',]:
348
- tax_percent=default_taxrate/100
349
- result=tax_percent/100
350
- return result
547
+ if xxx.magnitude < 24:
548
+ crv=float(Decimal(0.05)*Decimal(bottle_qty))
549
+ else:
550
+ crv=float(Decimal(0.10)*Decimal(bottle_qty))
351
551
 
352
- def invert_value():
353
- result=None
354
- value=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Value to Invert: ",helpText="make user provided value, or formula negative (value*-1='-value')",data="dec.dec")
355
- if value is None:
356
- return
357
- elif value in ['d',]:
358
- value=0
359
- result=value*-1
360
- return result
552
+ tax_rate=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Tax Rate (0.01==1%(Default={default_taxrate})):",helpText="A float or integer",data="float")
553
+ if tax_rate is None:
554
+ return None
555
+ elif tax_rate == 'd':
556
+ tax_rate=default_taxrate
361
557
 
362
- def beverage_PTCRV_base():
363
- result=None
364
- print('Beverage Total Price+Tax+CRV of Size')
365
- price=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Price ($)(default={default_price}):",helpText="A float or integer",data="float")
366
- if price is None:
367
- return None
368
- elif price in ['','d']:
369
- price=default_price
370
-
371
-
372
- bottle_size=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Size in FlOz(or eqivalent,oz assumed if not specified({default_bottle_size})):",helpText="a value plus its unit",data="string")
373
- if bottle_size is None:
374
- return None
375
- elif bottle_size in ['d',]:
376
- bottle_size=default_bottle_size
377
- try:
378
- bts=float(bottle_size)
379
- bottle_size=f"{bts} floz"
380
- except Exception as e:
381
- print(e)
382
- x=pint.UnitRegistry()
383
- xx=x(bottle_size)
384
- xxx=xx.to("floz")
385
- bottle_qty=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Qty Of Containers({default_bottle_qty}):",helpText="A float or integer",data="float")
386
- if bottle_qty is None:
387
- return None
388
- elif bottle_qty in ['d',]:
389
- bottle_qty=default_bottle_qty
390
-
391
- if xxx.magnitude < 24:
392
- crv=float(Decimal(0.05)*Decimal(bottle_qty))
393
- else:
394
- crv=float(Decimal(0.10)*Decimal(bottle_qty))
558
+ purchased_qty=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Qty purchased({default_purchased_qty})?",helpText=f"how much is being purchased for {price}",data="float")
559
+ if purchased_qty is None:
560
+ return None
561
+ elif purchased_qty in ['d',]:
562
+ purchased_qty=default_purchased_qty
395
563
 
396
- tax_rate=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Tax Rate (0.01==1%(Default={default_taxrate})):",helpText="A float or integer",data="float")
397
- if tax_rate is None:
398
- return None
399
- elif tax_rate == 'd':
400
- tax_rate=default_taxrate
564
+ price=(Decimal(price)*Decimal(purchased_qty))+Decimal(crv)
565
+ tax=price*Decimal(tax_rate)
401
566
 
402
- purchased_qty=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Qty purchased({default_purchased_qty})?",helpText=f"how much is being purchased for {price}",data="float")
403
- if purchased_qty is None:
404
- return None
405
- elif purchased_qty in ['d',]:
406
- purchased_qty=default_purchased_qty
407
567
 
408
- price=(Decimal(price)*Decimal(purchased_qty))+Decimal(crv)
409
- tax=price*Decimal(tax_rate)
568
+ result=(Decimal(price)+tax).quantize(Decimal('0.0000'))
569
+ return result
410
570
 
571
+ def tax_with_crv():
572
+ result=None
573
+ print('Tax+CRV of Size')
574
+ price=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Price ($({default_price})):",helpText="A float or integer",data="float")
575
+ if price is None:
576
+ return None
577
+ elif price in ['','d']:
578
+ price=default_price
411
579
 
412
- result=round(float(Decimal(price)+tax),prec)
413
- return result
414
580
 
415
- def tax_with_crv():
416
- result=None
417
- print('Tax+CRV of Size')
418
- price=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Price ($({default_price})):",helpText="A float or integer",data="float")
419
- if price is None:
420
- return None
421
- elif price in ['','d']:
422
- price=default_price
423
-
424
-
425
- bottle_size=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Size in FlOz(or eqivalent,oz assumed if not specified({default_bottle_size})):",helpText="a value plus its unit",data="string")
426
- if bottle_size is None:
427
- return None
428
- elif bottle_size in ['d',]:
429
- bottle_size=default_bottle_size
430
- try:
431
- bts=float(bottle_size)
432
- bottle_size=f"{bts} floz"
433
- except Exception as e:
434
- print(e)
435
- x=pint.UnitRegistry()
436
- xx=x(bottle_size)
437
- xxx=xx.to("floz")
438
- bottle_qty=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Qty Of Containers({default_bottle_qty}):",helpText="A float or integer",data="float")
439
- if bottle_qty is None:
440
- return None
441
- elif bottle_qty in ['d',]:
442
- bottle_qty=default_bottle_qty
443
-
444
- if xxx.magnitude < 24:
445
- crv=Decimal(0.05)*Decimal(bottle_qty)
446
- else:
447
- crv=Decimal(0.10)*Decimal(bottle_qty)
581
+ bottle_size=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Size in FlOz(or eqivalent,oz assumed if not specified({default_bottle_size})):",helpText="a value plus its unit",data="string")
582
+ if bottle_size is None:
583
+ return None
584
+ elif bottle_size in ['d',]:
585
+ bottle_size=default_bottle_size
586
+ try:
587
+ bts=float(bottle_size)
588
+ bottle_size=f"{bts} floz"
589
+ except Exception as e:
590
+ print(e)
591
+ x=pint.UnitRegistry()
592
+ xx=x(bottle_size)
593
+ xxx=xx.to("floz")
594
+ bottle_qty=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Qty Of Containers({default_bottle_qty}):",helpText="A float or integer",data="float")
595
+ if bottle_qty is None:
596
+ return None
597
+ elif bottle_qty in ['d',]:
598
+ bottle_qty=default_bottle_qty
448
599
 
449
- tax_rate=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Tax Rate (0.01==1%(Default={default_taxrate})):",helpText="A float or integer",data="float")
450
- if tax_rate is None:
451
- return None
452
- elif tax_rate == 'd':
453
- tax_rate=default_taxrate
600
+ if xxx.magnitude < 24:
601
+ crv=Decimal(0.05)*Decimal(bottle_qty)
602
+ else:
603
+ crv=Decimal(0.10)*Decimal(bottle_qty)
454
604
 
455
- purchased_qty=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Qty purchased({default_purchased_qty})?",helpText=f"how much is being purchased for {price}",data="float")
456
- if purchased_qty is None:
457
- return None
458
- elif purchased_qty in ['d',]:
459
- purchased_qty=default_purchased_qty
605
+ tax_rate=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Tax Rate (0.01==1%(Default={default_taxrate})):",helpText="A float or integer",data="float")
606
+ if tax_rate is None:
607
+ return None
608
+ elif tax_rate == 'd':
609
+ tax_rate=default_taxrate
460
610
 
461
- price=(Decimal(price)*Decimal(purchased_qty))+crv
462
- tax=price*Decimal(tax_rate)
611
+ purchased_qty=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Qty purchased({default_purchased_qty})?",helpText=f"how much is being purchased for {price}",data="float")
612
+ if purchased_qty is None:
613
+ return None
614
+ elif purchased_qty in ['d',]:
615
+ purchased_qty=default_purchased_qty
463
616
 
464
- result=tax
465
- return result
617
+ price=(Decimal(price)*Decimal(purchased_qty))+crv
618
+ tax=price*Decimal(tax_rate)
466
619
 
467
- def crv_total():
468
- result=None
469
- print('Total CRV for Qty of Size')
470
- bottle_size=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Size in FlOz(or eqivalent,oz assumed if not specified({default_bottle_size})):",helpText="a value plus its unit",data="string")
471
- if bottle_size is None:
472
- return None
473
- elif bottle_size in ['d',]:
474
- bottle_size=default_bottle_size
475
- try:
476
- bts=float(bottle_size)
477
- bottle_size=f"{bts} floz"
478
- except Exception as e:
479
- print(e)
480
- x=pint.UnitRegistry()
481
- xx=x(bottle_size)
482
- xxx=xx.to("floz")
483
- bottle_qty=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Qty Of Containers({default_bottle_qty}):",helpText="A float or integer",data="float")
484
- if bottle_qty is None:
485
- return None
486
- elif bottle_qty in ['d',]:
487
- bottle_qty=default_bottle_qty
488
-
489
- if xxx.magnitude < 24:
490
- crv=Decimal(0.05)*Decimal(bottle_qty)
491
- else:
492
- crv=Decimal(0.10)*Decimal(bottle_qty)
620
+ result=tax
621
+ return result
493
622
 
494
-
495
- result=crv
496
- return result
623
+ def crv_total():
624
+ result=None
625
+ print('Total CRV for Qty of Size')
626
+ bottle_size=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Size in FlOz(or eqivalent,oz assumed if not specified({default_bottle_size})):",helpText="a value plus its unit",data="string")
627
+ if bottle_size is None:
628
+ return None
629
+ elif bottle_size in ['d',]:
630
+ bottle_size=default_bottle_size
631
+ try:
632
+ bts=float(bottle_size)
633
+ bottle_size=f"{bts} floz"
634
+ except Exception as e:
635
+ print(e)
636
+ x=pint.UnitRegistry()
637
+ xx=x(bottle_size)
638
+ xxx=xx.to("floz")
639
+ bottle_qty=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Qty Of Containers({default_bottle_qty}):",helpText="A float or integer",data="float")
640
+ if bottle_qty is None:
641
+ return None
642
+ elif bottle_qty in ['d',]:
643
+ bottle_qty=default_bottle_qty
497
644
 
498
- def price_tax():
499
- result=None
500
- print('Price+Tax')
501
- price=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Price ($({default_price})):",helpText="A float or integer",data="float")
502
- if price is None:
503
- return None
504
- elif price in ['','d']:
505
- price=default_price
645
+ if xxx.magnitude < 24:
646
+ crv=Decimal(0.05)*Decimal(bottle_qty)
647
+ else:
648
+ crv=Decimal(0.10)*Decimal(bottle_qty)
506
649
 
650
+
651
+ result=crv
652
+ return result
507
653
 
508
- bottle_qty=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Qty Of Containers/Product({default_bottle_qty}):",helpText="A float or integer",data="float")
509
- if bottle_qty is None:
510
- return None
511
- elif bottle_qty in ['d',]:
512
- bottle_qty=default_bottle_qty
654
+ def price_tax():
655
+ result=None
656
+ print('Price+Tax')
657
+ price=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Price ($({default_price})):",helpText="A float or integer",data="float")
658
+ if price is None:
659
+ return None
660
+ elif price in ['','d']:
661
+ price=default_price
513
662
 
514
- tax_rate=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Tax Rate (0.01==1%(Default={default_taxrate})):",helpText="A float or integer",data="float")
515
- if tax_rate is None:
516
- return None
517
- elif tax_rate == 'd':
518
- tax_rate=default_taxrate
519
663
 
520
- price=Decimal(price)*Decimal(bottle_qty)
521
- tax=price*Decimal(tax_rate)
664
+ bottle_qty=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Qty Of Containers/Product({default_bottle_qty}):",helpText="A float or integer",data="float")
665
+ if bottle_qty is None:
666
+ return None
667
+ elif bottle_qty in ['d',]:
668
+ bottle_qty=default_bottle_qty
522
669
 
523
- result=(price+tax)
524
- return result
670
+ tax_rate=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Tax Rate (0.01==1%(Default={default_taxrate})):",helpText="A float or integer",data="float")
671
+ if tax_rate is None:
672
+ return None
673
+ elif tax_rate == 'd':
674
+ tax_rate=default_taxrate
525
675
 
526
- def tax_no_crv():
527
- result=None
528
- print('Tax without CRV')
529
- price=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Price ($({default_price})):",helpText="A float or integer",data="float")
530
- if price is None:
531
- return None
532
- elif price in ['','d']:
533
- price=default_price
676
+ price=Decimal(price)*Decimal(bottle_qty)
677
+ tax=price*Decimal(tax_rate)
534
678
 
679
+ result=(price+tax)
680
+ return result
535
681
 
536
- bottle_qty=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Qty Of Containers/Product({default_bottle_qty}):",helpText="A float or integer",data="float")
537
- if bottle_qty is None:
538
- return None
539
- elif bottle_qty in ['d',]:
540
- bottle_qty=default_bottle_qty
682
+ def tax_no_crv():
683
+ result=None
684
+ print('Tax without CRV')
685
+ price=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Price ($({default_price})):",helpText="A float or integer",data="float")
686
+ if price is None:
687
+ return None
688
+ elif price in ['','d']:
689
+ price=default_price
541
690
 
542
- tax_rate=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Tax Rate (0.01==1%(Default={default_taxrate})):",helpText="A float or integer",data="float")
543
- if tax_rate is None:
544
- return None
545
- elif tax_rate == 'd':
546
- tax_rate=default_taxrate
547
691
 
548
- price=Decimal(price)*Decimal(bottle_qty)
549
- tax=price*Decimal(tax_rate)
692
+ bottle_qty=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Qty Of Containers/Product({default_bottle_qty}):",helpText="A float or integer",data="float")
693
+ if bottle_qty is None:
694
+ return None
695
+ elif bottle_qty in ['d',]:
696
+ bottle_qty=default_bottle_qty
550
697
 
551
- result=tax
552
- return result
698
+ tax_rate=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Tax Rate (0.01==1%(Default={default_taxrate})):",helpText="A float or integer",data="float")
699
+ if tax_rate is None:
700
+ return None
701
+ elif tax_rate == 'd':
702
+ tax_rate=default_taxrate
553
703
 
554
- def tax_rate_from_priceAndTax():
555
- result=None
556
- print('tax_rate_from_priceAndTax()')
557
- price=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Price ($({default_price})):",helpText="A float or integer",data="float")
558
- if price is None:
559
- return None
560
- elif price in ['','d']:
561
- price=default_price
704
+ price=Decimal(price)*Decimal(bottle_qty)
705
+ tax=price*Decimal(tax_rate)
562
706
 
707
+ result=tax
708
+ return result
563
709
 
564
- taxed=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Tax ($) (0.01==1%(Default={0})):",helpText="A float or integer",data="float")
565
- if taxed is None:
566
- return None
567
- elif taxed == 'd':
568
- taxed=0
710
+ def tax_rate_from_priceAndTax():
711
+ result=None
712
+ print('tax_rate_from_priceAndTax()')
713
+ price=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Price ($({default_price})):",helpText="A float or integer",data="float")
714
+ if price is None:
715
+ return None
716
+ elif price in ['','d']:
717
+ price=default_price
569
718
 
570
719
 
571
- tax_rate=Decimal(taxed)/Decimal(price)
720
+ taxed=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Tax ($) (0.01==1%(Default={0})):",helpText="A float or integer",data="float")
721
+ if taxed is None:
722
+ return None
723
+ elif taxed == 'd':
724
+ taxed=0
572
725
 
573
- result=tax_rate
574
- return result
575
726
 
576
- def tax_rate_from_oldPriceAndNewPrice():
577
- result=None
578
- print('tax_rate_from_oldPriceAndNewPrice()')
579
- old_price=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Old Price ($({default_price})):",helpText="A float or integer",data="float")
580
- if old_price is None:
581
- return None
582
- elif old_price in ['','d']:
583
- old_price=default_price
584
-
585
- new_price=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"New Price ($({default_price})):",helpText="A float or integer",data="float")
586
- if new_price is None:
587
- return None
588
- elif new_price in ['','d']:
589
- new_price=default_price
590
-
591
- taxed=Decimal(new_price)-Decimal(old_price)
592
- tax_rate=taxed/Decimal(old_price)
593
- tax_rate=tax_rate
594
-
595
- result=tax_rate
596
- return result
727
+ tax_rate=Decimal(taxed)/Decimal(price)
597
728
 
598
-
599
- options={
600
- f'{uuid1()}':{
601
- 'cmds':['beverage price+tax+CRV','b-ptcrv',],
602
- 'desc':f'{Fore.light_yellow}beverage Price+Tax+CRV{Fore.medium_violet_red} asking for base questions like bottle size and qty to get total cost with tax{Style.reset}',
603
- 'exec':beverage_PTCRV_base
604
- },
605
- f'{uuid1()}':{
606
- 'cmds':['price+tax','p+t',],
607
- 'desc':f'{Fore.light_yellow}Price+Tax{Fore.medium_violet_red} asking questions like price and qty to get total cost with tax{Style.reset}',
608
- 'exec':price_tax
609
- },
610
- f'{uuid1()}':{
611
- 'cmds':['crvttl','crv total','crvtotal','crv_total',],
612
- 'desc':f'{Fore.light_yellow}total crv{Fore.medium_violet_red} asking questions like price and qty to get total crv{Style.reset}',
613
- 'exec':crv_total
614
- },
615
- f'{uuid1()}':{
616
- 'cmds':['tax+crv','t+c','tax crv',],
617
- 'desc':f'{Fore.light_yellow}tax+crv{Fore.medium_violet_red} asking questions like price and qty to get total crv{Style.reset}',
618
- 'exec':tax_with_crv
619
- },
620
- f'{uuid1()}':{
621
- 'cmds':['tax','tax no crv','tax 0 crv',],
622
- 'desc':f'{Fore.light_yellow}tax w/o crv{Fore.medium_violet_red} asking questions like price and qty to get total tax without crv{Style.reset}',
623
- 'exec':tax_no_crv
624
- },
625
- f'{uuid1()}':{
626
- 'cmds':['trfpt','tax_rate_from_price_and_tax','tax rate from price and tax','taxRateFromPriceAndTax',],
627
- 'desc':f'{Fore.light_yellow}tax rate{Fore.medium_violet_red} from price and tax as a decimal{Style.reset}',
628
- 'exec':tax_rate_from_priceAndTax
629
- },
630
- f'{uuid1()}':{
631
- 'cmds':['tax_rate_from_old_price_and_new_price','tax rate from old price and new price','taxRateFromOldPriceAndNewPrice','trfopnp',],
632
- 'desc':f'{Fore.light_yellow}tax rate{Fore.medium_violet_red} from old price and new price{Style.reset}',
633
- 'exec':tax_rate_from_oldPriceAndNewPrice
634
- },
635
- f'{uuid1()}':{
636
- 'cmds':['tax decimal','taxdecimal'],
637
- 'desc':f'{Fore.light_yellow}tax rate decimal{Fore.medium_violet_red} from percent{Style.reset}',
638
- 'exec':tax_rate_decimal
639
- },
640
- f'{uuid1()}':{
641
- 'cmds':['invert','-value','iv-val'],
642
- 'desc':f'{Fore.light_yellow}value{Fore.medium_violet_red}is multiplied by -1 to make inverse{Style.reset}',
643
- 'exec':invert_value
644
- },
645
- f'{uuid1()}':{
646
- 'cmds':['time dec to clock','t2c','time to clock'],
647
- 'desc':f'{Fore.light_yellow}value{Fore.medium_violet_red}convert decimal time to clock time{Style.reset}',
648
- 'exec':timedecimal_to_ampm
649
- },
650
- }
651
- for num,i in enumerate(options):
652
- options[i]['cmds'].append(str(num))
653
-
654
- while True:
655
- helpText=[]
656
- for i in options:
657
- msg=f"{Fore.light_green}{options[i]['cmds']}{Fore.light_red} -> {options[i]['desc']}{Style.reset}"
658
- helpText.append(msg)
659
- helpText='\n'.join(helpText)
660
- print(helpText)
661
- print(defaults_msg)
662
- cmd=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Pricing Analisys Tool|Do What?:",helpText=helpText,data="string")
663
- if cmd is None:
664
- return None
665
- result=None
666
- for i in options:
667
- els=[ii.lower() for ii in options[i]['cmds']]
668
- if cmd.lower() in els:
669
- result=options[i]['exec']()
670
- break
671
- print(f"{result}")
672
- returnResult=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Return Result?[y/n]",helpText=f"result to return is '{result}'",data="boolean")
673
- if returnResult in [True,]:
674
- if result is None:
729
+ result=tax_rate
730
+ return result
731
+
732
+ def tax_rate_from_oldPriceAndNewPrice():
733
+ result=None
734
+ print('tax_rate_from_oldPriceAndNewPrice()')
735
+ old_price=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"Old Price ($({default_price})):",helpText="A float or integer",data="float")
736
+ if old_price is None:
675
737
  return None
676
- else:
677
- returnTypes=["float","Decimal","string","string"]
678
- returnActor=[lambda x:round(float(x),4),lambda x:Decimal(x).quantize(Decimal("0.0000")),lambda x: f"{x:.4f}",lambda x:str(x)]
679
- ct=len(returnTypes)
680
- returnType=None
681
- htext=[]
682
- strOnly=False
683
- for num,i in enumerate(returnTypes):
684
- try:
685
- htext.append(std_colorize(f"{i} - {returnActor[num](result)} ",num,ct))
686
- except Exception as e:
687
- strOnly=True
688
- print(e)
689
- htext='\n'.join(htext)
690
- while returnType not in range(0,ct+1):
691
- print(htext)
692
- returnType=Prompt.__init2__(self,func=FormBuilderMkText,ptext="Return the value as?",helpText=f"{htext}\nwhich index?",data="integer")
693
- if returnType is None:
694
- return None
695
- elif returnType in ['d',]:
696
- if not strOnly:
697
- returnType=1
698
- else:
699
- returnType=-1
700
- break
701
- #return str(result)
702
- try:
703
- if returnTypes[returnType] == 'float':
704
- try:
705
- return returnActor[returnType](result)
706
- except Exception as e:
707
- print(e)
708
- continue
709
- elif returnTypes[returnType] == 'Decimal':
710
- try:
711
- return returnActor[returnType](result)
712
- except Exception as e:
713
- print(e)
714
- continue
715
- elif returnTypes[returnType] == 'string':
738
+ elif old_price in ['','d']:
739
+ old_price=default_price
740
+
741
+ new_price=Prompt.__init2__(None,func=FormBuilderMkText,ptext=f"New Price ($({default_price})):",helpText="A float or integer",data="float")
742
+ if new_price is None:
743
+ return None
744
+ elif new_price in ['','d']:
745
+ new_price=default_price
746
+
747
+ taxed=Decimal(new_price)-Decimal(old_price)
748
+ tax_rate=taxed/Decimal(old_price)
749
+ tax_rate=tax_rate
750
+
751
+ result=tax_rate
752
+ return result
753
+
754
+
755
+ self.options={
756
+ f'{uuid1()}':{
757
+ 'cmds':['beverage price+tax+CRV','b-ptcrv',],
758
+ 'desc':f'{Fore.light_yellow}beverage Price+Tax+CRV{Fore.medium_violet_red} asking for base questions like bottle size and qty to get total cost with tax{Style.reset}',
759
+ 'exec':beverage_PTCRV_base
760
+ },
761
+ f'{uuid1()}':{
762
+ 'cmds':['price+tax','p+t',],
763
+ 'desc':f'{Fore.light_yellow}Price+Tax{Fore.medium_violet_red} asking questions like price and qty to get total cost with tax{Style.reset}',
764
+ 'exec':price_tax
765
+ },
766
+ f'{uuid1()}':{
767
+ 'cmds':['crvttl','crv total','crvtotal','crv_total',],
768
+ 'desc':f'{Fore.light_yellow}total crv{Fore.medium_violet_red} asking questions like price and qty to get total crv{Style.reset}',
769
+ 'exec':crv_total
770
+ },
771
+ f'{uuid1()}':{
772
+ 'cmds':['tax+crv','t+c','tax crv',],
773
+ 'desc':f'{Fore.light_yellow}tax+crv{Fore.medium_violet_red} asking questions like price and qty to get total crv{Style.reset}',
774
+ 'exec':tax_with_crv
775
+ },
776
+ f'{uuid1()}':{
777
+ 'cmds':['tax','tax no crv','tax 0 crv',],
778
+ 'desc':f'{Fore.light_yellow}tax w/o crv{Fore.medium_violet_red} asking questions like price and qty to get total tax without crv{Style.reset}',
779
+ 'exec':tax_no_crv
780
+ },
781
+ f'{uuid1()}':{
782
+ 'cmds':['trfpt','tax_rate_from_price_and_tax','tax rate from price and tax','taxRateFromPriceAndTax',],
783
+ 'desc':f'{Fore.light_yellow}tax rate{Fore.medium_violet_red} from price and tax as a decimal{Style.reset}',
784
+ 'exec':tax_rate_from_priceAndTax
785
+ },
786
+ f'{uuid1()}':{
787
+ 'cmds':['tax_rate_from_old_price_and_new_price','tax rate from old price and new price','taxRateFromOldPriceAndNewPrice','trfopnp',],
788
+ 'desc':f'{Fore.light_yellow}tax rate{Fore.medium_violet_red} from old price and new price{Style.reset}',
789
+ 'exec':tax_rate_from_oldPriceAndNewPrice
790
+ },
791
+ f'{uuid1()}':{
792
+ 'cmds':['tax decimal','taxdecimal'],
793
+ 'desc':f'{Fore.light_yellow}tax rate decimal{Fore.medium_violet_red} from percent{Style.reset}',
794
+ 'exec':tax_rate_decimal
795
+ },
796
+ f'{uuid1()}':{
797
+ 'cmds':['fcmd','findcmd','find cmd'],
798
+ 'desc':f'Find {Fore.light_yellow}cmd{Fore.medium_violet_red}and excute for return{Style.reset}',
799
+ 'exec':self.findAndUse2
800
+ },
801
+ }
802
+ for num,i in enumerate(self.options):
803
+ self.options[i]['cmds'].append(str(num))
804
+ options=copy(self.options)
805
+ while True:
806
+ helpText=[]
807
+ for i in options:
808
+ msg=f"{Fore.light_green}{options[i]['cmds']}{Fore.light_red} -> {options[i]['desc']}{Style.reset}"
809
+ helpText.append(msg)
810
+ helpText='\n'.join(helpText)
811
+ print(helpText)
812
+ print(defaults_msg)
813
+ cmd=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Pricing Analisys Tool|Do What?:",helpText=helpText,data="string")
814
+ if cmd is None:
815
+ return None
816
+ result=None
817
+ for i in options:
818
+ els=[ii.lower() for ii in options[i]['cmds']]
819
+ if cmd.lower() in els:
820
+ result=options[i]['exec']()
821
+ break
822
+ print(f"{result}")
823
+ returnResult=Prompt.__init2__(None,func=FormBuilderMkText,ptext="Return Result?[y/n]",helpText=f"result to return is '{result}'",data="boolean")
824
+ if returnResult in [True,]:
825
+ if result is None:
826
+ return None
827
+ else:
828
+ returnTypes=["float","Decimal","string","string"]
829
+ returnActor=[lambda x:round(float(x),4),lambda x:Decimal(x).quantize(Decimal("0.0000")),lambda x: f"{x:.4f}",lambda x:str(x)]
830
+ ct=len(returnTypes)
831
+ returnType=None
832
+ htext=[]
833
+ strOnly=False
834
+ for num,i in enumerate(returnTypes):
716
835
  try:
717
- return returnActor[returnType](result)
836
+ htext.append(std_colorize(f"{i} - {returnActor[num](result)} ",num,ct))
718
837
  except Exception as e:
838
+ strOnly=True
719
839
  print(e)
720
- continue
721
- else:
840
+ htext='\n'.join(htext)
841
+ while returnType not in range(0,ct+1):
842
+ print(htext)
843
+ returnType=Prompt.__init2__(self,func=FormBuilderMkText,ptext="Return the value as?",helpText=f"{htext}\nwhich index?",data="integer")
844
+ if returnType is None:
845
+ return None
846
+ elif returnType in ['d',]:
847
+ if not strOnly:
848
+ returnType=1
849
+ else:
850
+ returnType=-1
851
+ break
852
+ #return str(result)
853
+ try:
854
+ if returnTypes[returnType] == 'float':
855
+ try:
856
+ return returnActor[returnType](result)
857
+ except Exception as e:
858
+ print(e)
859
+ continue
860
+ elif returnTypes[returnType] == 'Decimal':
861
+ try:
862
+ return returnActor[returnType](result)
863
+ except Exception as e:
864
+ print(e)
865
+ continue
866
+ elif returnTypes[returnType] == 'string':
867
+ try:
868
+ return returnActor[returnType](result)
869
+ except Exception as e:
870
+ print(e)
871
+ continue
872
+ else:
873
+ return result
874
+ except Exception as e:
875
+ print(e)
876
+ print("returning as a string")
722
877
  return result
723
- except Exception as e:
724
- print(e)
725
- print("returning as a string")
726
- return result
727
- return result
728
- except Exception as e:
729
- print(e,str(e),repr(e))
878
+ return result
879
+ except Exception as e:
880
+ print(e,str(e),repr(e))
730
881
 
731
882
  class TasksMode:
732
883
  def set_inList(self):
@@ -937,8 +1088,6 @@ class TasksMode:
937
1088
  else:
938
1089
  return text
939
1090
 
940
- pricing=lambda x:pricing(None)
941
-
942
1091
  Lookup=Lookup2
943
1092
  #extra is for future expansion
944
1093
  def exportList2Excel(self,fields=False,extra=[]):
@@ -4831,6 +4980,9 @@ where:
4831
4980
  msg=f"{tmp}{color1_field}{k}{Style.reset} - {'|'.join([f'{cmd_alter}{i}{Style.reset}' for i in location_fields[k]])}"
4832
4981
  print(msg)
4833
4982
 
4983
+ self.formulae=Formulae()
4984
+ self.formulaeu=self.formulae.formulaeu
4985
+ self.pricing=self.formulae.pricing
4834
4986
  for entry in self.valid_fields:
4835
4987
  self.options[entry]={
4836
4988
  'cmds':["#"+str(count),f"ls {entry}"],
radboy/__init__.py CHANGED
@@ -1 +1 @@
1
- VERSION='0.0.544'
1
+ VERSION='0.0.546'
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: radboy
3
- Version: 0.0.544
3
+ Version: 0.0.546
4
4
  Summary: A Retail Calculator for Android/Linux
5
5
  Author: Carl Joseph Hirner III
6
6
  Author-email: Carl Hirner III <k.j.hirner.wisdom@gmail.com>
@@ -5,7 +5,7 @@ radboy/Holidays.txt,sha256=y-JZPihh5iaWKxMIHNXD39yVuVmf1vMs4FdNDcg0f1Y,3114
5
5
  radboy/InventoryGlossary.txt,sha256=018-Yqca6DFb10jPdkUY-5qhkRlQN1k3rxoTaERQ-LA,91008
6
6
  radboy/RecordMyCodes.py,sha256=Lt2reA6xchq3U7Y08DvkrHboZ25i1ts7X2E9gSIwcVg,41101
7
7
  radboy/Run.py,sha256=JUoCTHnzQBv7n8PB2_i93ANdAC_iW__RkAge8esCnk4,76
8
- radboy/__init__.py,sha256=yPpiYPBK90fk2N3yya3FR3e6KYU0Tx6U-wS9MlYOUtw,17
8
+ radboy/__init__.py,sha256=M4GNJjPNUq8u7e8Sqq14tiWOGezP5HtZePM-xgWZTlk,17
9
9
  radboy/api_key,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  radboy/case-export-2024-05-14-13-10-00.672971.xlsx,sha256=Wd592d_VLFmfUI9KKKSVjNwjV91euc1T7ATyvwvUhlg,5431
11
11
  radboy/case-export-2024-05-14-13-13-22.540614.xlsx,sha256=OnGrhmScHfGp_mVaWW-LNMsqrQgyZDpiU3wV-2s3U5Q,5556
@@ -84,7 +84,7 @@ radboy/DB/ExerciseTracker.py,sha256=OS9i8jGIZPj-6m1bB0-eKNHQ6vf2iv_AYPEc0s4bkBM,
84
84
  radboy/DB/PayDay.py,sha256=H2kPGvBCDkMOz7lbxQhYtUt_oAInpxi37Q6MFrah98I,8710
85
85
  radboy/DB/PayModels.py,sha256=hjwWxP7PL33hmfzQl5YTf0HqzaMxXJxFknPdxFJXJc8,3499
86
86
  radboy/DB/PrintLogging.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
87
- radboy/DB/Prompt.py,sha256=5fwbxVNXwYDuX9s8slOdcnX_ixMOVbmmaVMN41Myv9Y,154476
87
+ radboy/DB/Prompt.py,sha256=WCWuui0xKnIUkflX7XekWlm6PE8U6G1DpKX8BDXhy-s,155135
88
88
  radboy/DB/RandomStringUtil.py,sha256=eZCpR907WStgfbk4Evcghjv9hOkUDXH-iMXIq0-kXq8,24386
89
89
  radboy/DB/ResetTools.py,sha256=RbI-Ua7UlsN0S9qLqtEkTWvzyTZ6R-hHR3CW4NHlUPE,6660
90
90
  radboy/DB/SMLabelImporter.py,sha256=eUoBDxVUUEKGL2g_PwkASM67ZB7FmXtSnn4bCagskhY,4013
@@ -108,7 +108,7 @@ radboy/DB/__pycache__/FormBuilder.cpython-312.pyc,sha256=p1o-5SMRL8OXP_XQ5liUpf-
108
108
  radboy/DB/__pycache__/PrintLogging.cpython-312.pyc,sha256=pIAFqTi6OiQQORSc-oMH1zAbsdH7sY1TifxrN_QOvnU,148
109
109
  radboy/DB/__pycache__/Prompt.cpython-311.pyc,sha256=P2uPRpeqfLFtxieZ0JHBG3X_HZzWUCsFSLb_fpRqky0,6407
110
110
  radboy/DB/__pycache__/Prompt.cpython-312.pyc,sha256=6CcQ1gE2hcz3cKPjo4f6d7xNM2PTDnl8NzQG0Pme5BE,142886
111
- radboy/DB/__pycache__/Prompt.cpython-313.pyc,sha256=UqbcDnIcJtC848VBcX4-Ik3JzzEj_vKlc23dvp_S6HA,235023
111
+ radboy/DB/__pycache__/Prompt.cpython-313.pyc,sha256=6-hov-d3xNlsB35U_aL1cfneJ4-z9FsJltT5ixfFmcg,236020
112
112
  radboy/DB/__pycache__/RandomStringUtil.cpython-312.pyc,sha256=TrbEY89MuLmNlvoo5d8vOE6Dyshh5_EMlTZvk8MDVN4,48597
113
113
  radboy/DB/__pycache__/RandomStringUtil.cpython-313.pyc,sha256=MCcgVwV2Y-9rAY2FVaJZCKcou3HDX70EZudoiCigT0o,49217
114
114
  radboy/DB/__pycache__/ResetTools.cpython-311.pyc,sha256=4Vyc57iAAF0yRPjjglnVKovnTn8OoFIi6Zok3Wpj_YM,9292
@@ -209,10 +209,10 @@ radboy/GeoTools/__pycache__/GeoClass.cpython-313.pyc,sha256=eZ6hpLKoic1XCb7BKKg-
209
209
  radboy/GeoTools/__pycache__/OSMClass.cpython-312.pyc,sha256=5RoT8_wiI8R7yb_B9FWIC7mALdGNoqyWtkzsjM2pbh0,40387
210
210
  radboy/GeoTools/__pycache__/__init__.cpython-312.pyc,sha256=Y7Xtrzwm44-xuY_4NK8aDjYfVmXIzUFWOyexJu9le8A,1238
211
211
  radboy/GeoTools/__pycache__/__init__.cpython-313.pyc,sha256=-bk9eEIxWZgHYZHtNJbrpubDRWkbdYNkGr5J7sVhyIE,1238
212
- radboy/HealthLog/HealthLog.py,sha256=KjvGW2RMQta9ycAvDNjbG0iaVHbprXK7O28DPIhyJhk,34169
212
+ radboy/HealthLog/HealthLog.py,sha256=OK4NPcQbIUJHeyJ1H6kWjspkcL_V5n79rUNEWYkGxfQ,34172
213
213
  radboy/HealthLog/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
214
214
  radboy/HealthLog/__pycache__/HealthLog.cpython-312.pyc,sha256=hTo4o7jo9L2yqPZgzuKUw_kon_PVcCuTRguELTuLrIo,27946
215
- radboy/HealthLog/__pycache__/HealthLog.cpython-313.pyc,sha256=7z2GOn50X_wv1djAtOH42fjtkBvzicSw6008H4EzoC4,53283
215
+ radboy/HealthLog/__pycache__/HealthLog.cpython-313.pyc,sha256=KxkqwBgsOZ5rRRIWtwkq8Y0yd-fJcPOa4A2F8AV4diI,53286
216
216
  radboy/HealthLog/__pycache__/__init__.cpython-312.pyc,sha256=yZrYKBk31pGSjCRqmqzpX409iw-muC1zsNO2ObqkGlY,272
217
217
  radboy/HealthLog/__pycache__/__init__.cpython-313.pyc,sha256=cqdZbEJKq9XVoVqDAwsW0pwwBBGSerJNWGlST3YVR3g,151
218
218
  radboy/InListRestore/ILR.py,sha256=s8fbbHLKQSVJX1VaeyGE-vdIUGBEbOPX29kRIG2j2WY,16847
@@ -341,7 +341,7 @@ radboy/SystemSettings/__pycache__/__init__.cpython-312.pyc,sha256=aIzp4Po0t8EhSA
341
341
  radboy/SystemSettings/__pycache__/__init__.cpython-313.pyc,sha256=QFDuoidxMWsGVLsy5lN-rDs6TP8nKJ4yyCyiamNOhwo,156
342
342
  radboy/TasksMode/ReFormula.py,sha256=REDRJYub-OEOE6g14oRQOLOQwv8pHqVJy4NQk3CCM90,2255
343
343
  radboy/TasksMode/SetEntryNEU.py,sha256=Gu0Z677tjpc7-9AQtLbIr7yzPx6ZJXGK33lOIgU0IRM,17432
344
- radboy/TasksMode/Tasks.py,sha256=dHF9SiYdiG5kdV6pxsMuJ9xVXUN-o2ldn55EU76bjTw,330911
344
+ radboy/TasksMode/Tasks.py,sha256=za4WwmXUtucq1kUjF3ncgFTHuQDtUns7ZAOShhsaUqs,340152
345
345
  radboy/TasksMode/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
346
346
  radboy/TasksMode/__pycache__/ReFormula.cpython-311.pyc,sha256=QEG3PwVw-8HTd_Mf9XbVcxU56F1fC9yBqWXYPLC39DU,4865
347
347
  radboy/TasksMode/__pycache__/ReFormula.cpython-312.pyc,sha256=aX7BWm2PPjCTnxsbGUitR-2h9hq4AjaBiHMrUXvIl0Y,3967
@@ -350,7 +350,7 @@ radboy/TasksMode/__pycache__/SetEntryNEU.cpython-312.pyc,sha256=pCdFj61aPKkHL6Sv
350
350
  radboy/TasksMode/__pycache__/SetEntryNEU.cpython-313.pyc,sha256=UExwr8dN2STFEDE5t_YnQFMUX-wGv7JH10I1OyBDRtM,20212
351
351
  radboy/TasksMode/__pycache__/Tasks.cpython-311.pyc,sha256=6QOTJnLiXSKdF81hkhy3vyrz49PPhS20s5_0X52g3Hw,131120
352
352
  radboy/TasksMode/__pycache__/Tasks.cpython-312.pyc,sha256=hyJwdaYaaRLdcrNxgg36diJ5iijX5_3I0UAORsj-6LU,310295
353
- radboy/TasksMode/__pycache__/Tasks.cpython-313.pyc,sha256=QpGdmGuU2Zm-iuk7MtejxCmwoAqpWIUZtY7f74V8ZIg,403448
353
+ radboy/TasksMode/__pycache__/Tasks.cpython-313.pyc,sha256=CqZ6fIaMnYj1chMZy1PjxJr_r0ERk3FkRjQipyujVCw,412318
354
354
  radboy/TasksMode/__pycache__/__init__.cpython-311.pyc,sha256=PKV1JbihEacm639b53bZozRQvcllSkjGP3q8STVMxF4,234
355
355
  radboy/TasksMode/__pycache__/__init__.cpython-312.pyc,sha256=ERgnEvRMiGSecWp1BpNzLdSq_SdKw7GvFWUvUM7bLVw,272
356
356
  radboy/TasksMode/__pycache__/__init__.cpython-313.pyc,sha256=lvsTxukyvGKB3C0rdF9dQi_bvVh6ceDVINfwcuIsd0s,151
@@ -397,7 +397,7 @@ radboy/__pycache__/Run.cpython-311.pyc,sha256=G_UEfMtkLRjR6ZpGA_BJzGenuaCcP469Y9
397
397
  radboy/__pycache__/Run.cpython-312.pyc,sha256=v4xolc3mHyla991XhpYBUbBHYT0bnJ1gE-lkFoQ4GFA,241
398
398
  radboy/__pycache__/__init__.cpython-311.pyc,sha256=R-DVbUioMOW-Fnaq7FpT5F1a5p0q3b_RW-HpLRArCAY,242
399
399
  radboy/__pycache__/__init__.cpython-312.pyc,sha256=FsFzLXOlTK8_7ixoPZzakkR8Wibt-DvXLFh-oG2QlPw,164
400
- radboy/__pycache__/__init__.cpython-313.pyc,sha256=1zEpd0RqInh0ymTkHBdESXjY_YNCg_fuHIRjBfZFRMo,165
400
+ radboy/__pycache__/__init__.cpython-313.pyc,sha256=iSo13-BDByUwtyCmbDxnkbRvJ2jF6rJo8uCn2ZP6gbE,165
401
401
  radboy/__pycache__/__init__.cpython-39.pyc,sha256=D48T6x6FUeKPfubo0sdS_ZUut3FmBvPMP7qT6rYBZzU,275
402
402
  radboy/__pycache__/possibleCode.cpython-311.pyc,sha256=zFiHyzqD8gUnIWu4vtyMYIBposiRQqaRXfcT_fOl4rU,20882
403
403
  radboy/__pycache__/possibleCode.cpython-312.pyc,sha256=tk_CO-AcsO3YZj5j6vEsw3g37UmEzWc5YgeWEoJEUg4,27922
@@ -422,7 +422,7 @@ radboy/tkGui/Images/__pycache__/__init__.cpython-311.pyc,sha256=tXBYpqbOlZ24B1BI
422
422
  radboy/tkGui/__pycache__/BeginnersLuck.cpython-311.pyc,sha256=xLQOnV1wuqHGaub16mPX0dDMGU9ryCeLtNz5e517_GE,3004
423
423
  radboy/tkGui/__pycache__/Review.cpython-311.pyc,sha256=wKq24iM6Xe2OampgZ7-8U6Nvmgs2y-qWOrGwtWhc75k,4047
424
424
  radboy/tkGui/__pycache__/__init__.cpython-311.pyc,sha256=BX7DBn5qbvKTvlrKOP5gzTBPBTeTgSMjBW6EMl7N8e0,230
425
- radboy-0.0.544.dist-info/METADATA,sha256=sBkxbz1vSfgT-S7T21I3tniT59zOhEa5W22AXATyGiE,1615
426
- radboy-0.0.544.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
427
- radboy-0.0.544.dist-info/top_level.txt,sha256=mlM0RWMUxGo1YHnlLmYrHOgGdK4XNRpr7nMFD5lR56c,7
428
- radboy-0.0.544.dist-info/RECORD,,
425
+ radboy-0.0.546.dist-info/METADATA,sha256=DrC6-7KyNXi-L76na-7dnPTq1T0VgxGE5slIVhNi_us,1615
426
+ radboy-0.0.546.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
427
+ radboy-0.0.546.dist-info/top_level.txt,sha256=mlM0RWMUxGo1YHnlLmYrHOgGdK4XNRpr7nMFD5lR56c,7
428
+ radboy-0.0.546.dist-info/RECORD,,