COMMENT
Log Expenses v1.0
Created by /u/TheRealClose
Request by /u/Jibeddy
COMMENT
Set up required:
Set up a new Reminders list titled "Expenses" -- if you wish to name this something else, simply change the first Text field below to match.
Next, add a single reminder titled "Total Expenses: $0" -- if you wish to change this format, simply change the second Text field below to match.
It is important that the second text field below does not contain "0", but that the first reminder you create does.
Once these are set up, you are ready to use the shortcut!
It is important that when promoted to remove a reminder, tap 'Remove' -- this removes the old total.
If you wish to change the format of the individual expenses, simply rearrange what's in the third Text field -- It is important to ensure that *EXPENSE*, *COST*, and *DATE* are spelt correctly. The date is optional but the others must be included. It is also important that you do not use the " * " symbol anywhere else in the format.
Enjoy!
TEXT
Expenses

Text
TEXT
Total Expenses: $

Text
TEXT
*EXPENSE*: $*COST* - *DATE*

Text
REMINDERS
Find
All Reminders
where
All the following are true [{'class': 'filter-property', 'value': 'List'}, {'class': 'filter-operator', 'value': 'is'}, {'class': 'filter-benchmark', 'value': 'default'}] [{'class': 'filter-property', 'value': 'Title'}, {'class': 'filter-operator', 'value': 'begins with'}, {'class': 'filter-benchmark', 'value': 'anything'}] Get 1 File



Reminders
VARIABLES
Set variable
currentTotal
to
Input
REMINDERS
Get
Title
from
Reminder

Title
TEXT
Split
Text
by
Custom
$

Split Text
SCRIPTING
Get
Last Item
from
List

Item from List
SCRIPTING
Ask
What's the name of the expense?

Provided Input
SCRIPTING
Ask
How much was the expense?

Provided Input
MATHS
Round
Input
to
Ones Place

Rounded Number
VARIABLES
Add
Input
to
itemsToCheck
VARIABLES
Get
Item from List - currentTotal
MATHS
Number
+
Rounded Number - Expense
Options Under Construction

Calculation Result
VARIABLES
Add
Input
to
itemsToCheck
SCRIPTING
Repeat with each item in
Input

Repeat Results
VARIABLES
Set variable
amount
to
Input
SCRIPTING
If
Input
Condition
TEXT
Split
Text
by
Custom
.

Split Text
VARIABLES
Set variable
amountSplit
to
Input
SCRIPTING
Get
First Item
from
List

Item from List
VARIABLES
Set variable
splitLeft
to
Input
VARIABLES
Get
amountSplit
SCRIPTING
Get
Last Item
from
List

Item from List
TEXT
Split
Text
by
Every Character

Split Text
SCRIPTING
Count
Split Text
in
Input

Count
SCRIPTING
If
Input
Condition
VARIABLES
Get
Item from List - splitRight
MATHS
Number
×
10.0
Options Under Construction

Calculation Result
TEXT
Calculation Result
.
splitLeft

Text
VARIABLES
Set variable
amount
to
Input
SCRIPTING
End If

If Result
SCRIPTING
End If

If Result
VARIABLES
Get
amount
VARIABLES
Add
Input
to
itemsChecked
SCRIPTING
End Repeat

Repeat Results
VARIABLES
Get
itemsChecked
SCRIPTING
Get
First Item
from
List

Item from List
VARIABLES
Get
itemsChecked
SCRIPTING
Get
Last Item
from
List

Item from List
VARIABLES
Get
Text - expenseText
SCRIPTING
If
Input
Condition
SCRIPTING
Ask
What date is this expense from?

Provided Input
CALENDAR
Format
Date
Options Under Construction

Formatted Date
SCRIPTING
End If

If Result
VARIABLES
Get
Text - expenseText
TEXT
Split
Text
by
Custom
*

Split Text
SCRIPTING
Repeat with each item in
Input

Repeat Results
SCRIPTING
If
Input
Condition
VARIABLES
Get
Ask for Input - Expense
VARIABLES
Add
Input
to
expenseToCombine
SCRIPTING
Otherwise
SCRIPTING
If
Input
Condition
VARIABLES
Get
Item from List - checkedExpense
VARIABLES
Add
Input
to
expenseToCombine
SCRIPTING
Otherwise
SCRIPTING
If
Input
Condition
VARIABLES
Get
Formatted Date
VARIABLES
Add
Input
to
expenseToCombine
SCRIPTING
Otherwise
VARIABLES
Add
Input
to
expenseToCombine
SCRIPTING
End If

If Result
SCRIPTING
End If

If Result
SCRIPTING
End If

If Result
SCRIPTING
End Repeat

Repeat Results
VARIABLES
Get
expenseToCombine
TEXT
Combine
Text List
with
Custom
Text

Combined Text
TEXT
Item from List - checkedTotal
Text - totalText

Text
REMINDERS
Add
Combined Text - expenseToAdd
to
Text - List
with
No Alert
Options Under Construction

New Reminder
NUMBER
0.1

Number
SCRIPTING
Wait
Number - Wait
REMINDERS
Add
Text - totalToAdd
to
Text - List
with
No Alert
Options Under Construction

New Reminder
VARIABLES
Get
currentTotal
REMINDERS
Remove
Reminders
SCRIPTING
Show alert
Expense added!