FoodGram

FoodGram I developed for my own food intake tracking and data logging that can easily be put to a spreadsheet.

dim e, yea
dim chk$, ing$, fnam$, meal$, ig$
2:
cls
color 7,0
chk$="":ing$="":fnam$="":meal$="":ig$=""
e=0
cls
shell "ls | grep foodgram.csv > file.txt"
open "file.txt" for input as #2
do
 if not(eof(2)) then input #2, chk$
 if lcase$(chk$)="foodgram.csv" then yea=1
loop until eof(2)
close #2
if yea=0 then shell "echo Date, Time, Meal Type, Meal Name, Ingredients > foodgram.csv"
shell "rm file.txt"
1:
color 7,0
cls
print
print
color 5,8
print " FoodGram Version 1.03a by Page Telegram 2022"
print
locate 4,1:color 7,0:print " Date: ";date$, "Time: ";time$
color 7,0
print "  [1] Food is called: "; 
color 4,7
print fnam$
color 7,0
print "  [2] Ingredients include: "; 
color 4,7
print ing$
color 7,0
print "  [3]/[B/L/D/S/K] Breakfast, Lunch, Dinner, Snack or drinK?: ";
color 4,7
print meal$
color 7,0
print "  [4] Save Entry and Start New Entry!          "
print "  [5] Tail lastest 10 in foodgram.csv          "
print "  Others: [P]oop! [E]xercise [M]oon:(wake/bed) "
print "  [ESC] System  [U]pload to Server             "
color 2,0
print "  File is saved in current folder as foodgram.csv | Screens[H]ot"
color 1,7
do
locate 4,1:color 7,0:print "        Date: ";date$, "Time: ";time$
color 4,0: locate 22,1
 select case inkey$
  case "B","b"
    meal$="Breakfast": goto 1
  case "L","l"
       meal$="Lunch": goto 1

  case "D","d"
    meal$="Dinner": goto 1

  case "S","s"
    meal$="Snack": goto 1

  case "K","k"
    meal$="Drink": goto 1
  case "H","h": shell "fbgrab -d /dev/fb0 -s 2 ./foodgram.png": goto 1

  case "M","m": input "Confirm Wake / Sleep (Y/N)",yorn$:if ucase$(yorn$)="Y" then shell "echo "+date$+","+time$+","+"Awake / Sleep Event! >> foodgram.csv" else goto 1
  case "E","e": input "Confirm Exercise (Y/N)",yorn$:if ucase$(yorn$)="Y" then shell "echo "+date$+","+time$+","+"Exercised Event! >> foodgram.csv" else goto 1
  case "P","p": input "Confirm Poop Event Type: (1/2/3/4/5/6/7/N)",yorn$:if ucase$(yorn$)="N" then goto 1 else shell "echo "+date$+","+time$+","+"Poop Event!, Poop Type " + yorn$ + " >> foodgram.csv"
  case "U","u": shell "cp foodgram.csv foodgram.txt":shell "./upftp foodgram.txt /myhealth/": shell "./upftp foodgram.bas /dev/foodgram/": shell "./upftp foodgram.png /dev/foodgram/" :goto 1
  case "1": input "        Food Name:", fnam$: goto 1
  case "2": input "        Add ingredient:",ig$: ing$=ing$+ig$+"+": goto 1
  case "3": input "        What meal type?", meal$: goto 1
  case "4": print "        saving file as ";meal$;" on "; date$; " at "; time$: shell "echo " + date$ + "," + time$ + "," + meal$ + "," + fnam$ + "," + ing$ + " >> foodgram.csv": goto 2
  case "5": locate 11,1:shell "tail foodgram.csv"
  case chr$(27): e=1
 end select
loop until e=1
system