diff --git a/README.md b/README.md
new file mode 100644
index 0000000..7bf8aa1
--- /dev/null
+++ b/README.md
@@ -0,0 +1,41 @@
+# Torn Vault Tracker
+
+Track vault balances for shared private island vaults in [Torn City](https://torn.com/).
+
+## Description
+
+Uses the [Torn API](https://www.torn.com/api.html) to pul the most recent vault transactions for you and your spouse. Note that in ordder to acess the "Log" endpoint, the keys used must be created with Full Access permissions.
+
+## Getting Started
+
+### Dependencies
+
+* Any reasonable LAMP stack (developed on Ubuntu 20.04 with Apache and PHP 8.1.10)
+
+### Installing
+
+* Create folder in your server's web root, for example, 'tvt'
+* Upload/clone this repo into your folder
+* Edit `functions.php` to add API keys for you and your spouse
+* Open the tracker in any web browser
+
+### Automating the API requests (TK)
+
+## Help
+
+Any advise for common problems or issues.
+```
+command to run if program contains helper info
+```
+
+## Authors
+
+Contributors names and contact info
+
+Keith Solomon
+[KeithSolomon.net](https://keithsolomon.net/)
+
+## Version History
+
+* 0.1
+ * Initial Release
diff --git a/all-entries.csv b/all-entries.csv
deleted file mode 100644
index be66f59..0000000
--- a/all-entries.csv
+++ /dev/null
@@ -1,111 +0,0 @@
-Symos,26/09/2022,"Vault deposit",1
-Symos,26/09/2022,"Vault deposit",185354305
-Zarathos,27/09/2022,"Vault withdraw",-2000000
-Symos,27/09/2022,"Vault withdraw",-3000
-Symos,28/09/2022,"Vault withdraw",-1000000
-Zarathos,28/09/2022,"Vault withdraw",-2000000
-Symos,28/09/2022,"Vault withdraw",-300000
-Symos,30/09/2022,"Vault withdraw",-400000
-Symos,30/09/2022,"Vault withdraw",-150000
-Symos,30/09/2022,"Vault withdraw",-50000
-Symos,02/10/2022,"Vault withdraw",-2000000
-Zarathos,02/10/2022,"Vault withdraw",-2000000
-Symos,02/10/2022,"Vault deposit",1000000
-Symos,04/10/2022,"Vault withdraw",-300000
-Symos,05/10/2022,"Vault withdraw",-300000
-Zarathos,06/10/2022,"Vault withdraw",-2000000
-Symos,06/10/2022,"Vault withdraw",-2000000
-Symos,06/10/2022,"Vault withdraw",-10000000
-Symos,07/10/2022,"Vault withdraw",-350000
-Symos,07/10/2022,"Vault withdraw",-2000000
-Zarathos,13/10/2022,"Vault withdraw",-2000000
-Symos,14/10/2022,"Vault withdraw",-350000
-Symos,15/10/2022,"Vault withdraw",-350000
-Zarathos,16/10/2022,"Vault withdraw",-2000000
-Symos,16/10/2022,"Vault withdraw",-1200000
-Symos,18/10/2022,"Vault withdraw",-10000000
-Zarathos,19/10/2022,"Vault withdraw",-2000000
-Symos,21/10/2022,"Vault withdraw",-350000
-Symos,21/10/2022,"Vault withdraw",-1000000
-Symos,22/10/2022,"Vault withdraw",-350000
-Symos,23/10/2022,"Vault withdraw",-230000
-Zarathos,24/10/2022,"Vault withdraw",-80000000
-Zarathos,24/10/2022,"Vault deposit",12392725
-Symos,24/10/2022,"Vault withdraw",-1000000
-Zarathos,24/10/2022,"Vault deposit",2988600
-Zarathos,25/10/2022,"Vault deposit",89862
-Zarathos,25/10/2022,"Vault withdraw",-352500
-Symos,25/10/2022,"Vault withdraw",-600000
-Symos,25/10/2022,"Vault deposit",690914
-Symos,25/10/2022,"Vault withdraw",-1000000
-Zarathos,26/10/2022,"Vault withdraw",-3000000
-Zarathos,26/10/2022,"Vault withdraw",-2000000
-Symos,26/10/2022,"Vault withdraw",-1500000
-Symos,26/10/2022,"Vault withdraw",-5000000
-Symos,26/10/2022,"Vault withdraw",-750000
-Symos,28/10/2022,"Vault withdraw",-700000
-Symos,28/10/2022,"Vault deposit",96429637
-Symos,28/10/2022,"Vault withdraw",-800000
-Zarathos,28/10/2022,"Vault deposit",52642857
-Symos,29/10/2022,"Vault withdraw",-352500
-Symos,29/10/2022,"Vault withdraw",-750000
-Symos,30/10/2022,"Vault deposit",760975
-Symos,30/10/2022,"Vault withdraw",-352500
-Zarathos,31/10/2022,"Vault withdraw",-1000000
-Symos,31/10/2022,"Vault withdraw",-20000000
-Symos,31/10/2022,"Vault deposit",450000
-Symos,01/11/2022,"Vault withdraw",-400000
-Symos,01/11/2022,"Vault withdraw",-750000
-Zarathos,03/11/2022,"Vault withdraw",-100000000
-Symos,03/11/2022,"Vault deposit",99442460
-Symos,03/11/2022,"Vault withdraw",-500000
-Symos,03/11/2022,"Vault withdraw",-750000
-Zarathos,05/11/2022,"Vault withdraw",-2000000
-Symos,05/11/2022,"Vault withdraw",-500000
-Symos,07/11/2022,"Vault withdraw",-200000
-Zarathos,08/11/2022,"Vault withdraw",-2000000
-Symos,09/11/2022,"Vault withdraw",-350000
-Symos,09/11/2022,"Vault withdraw",-750000
-Symos,10/11/2022,"Vault withdraw",-50000
-Symos,11/11/2022,"Vault withdraw",-330000
-Symos,12/11/2022,"Vault withdraw",-1050000
-Symos,12/11/2022,"Vault withdraw",-75000
-Symos,12/11/2022,"Vault deposit",526550
-Symos,13/11/2022,"Vault withdraw",-350000
-Symos,14/11/2022,"Vault withdraw",-1000000
-Symos,14/11/2022,"Vault withdraw",-100000
-Symos,14/11/2022,"Vault withdraw",-10000000
-Symos,14/11/2022,"Vault deposit",5775234
-Symos,14/11/2022,"Vault withdraw",-16000000
-Symos,14/11/2022,"Vault withdraw",-1200000
-Symos,16/11/2022,"Vault withdraw",-350000
-Symos,16/11/2022,"Vault withdraw",-700000
-Symos,20/11/2022,"Vault withdraw",-1100000
-Symos,21/11/2022,"Vault withdraw",-200000
-Symos,22/11/2022,"Vault withdraw",-1050000
-Symos,25/11/2022,"Vault withdraw",-1000000
-Zarathos,29/11/2022,"Vault withdraw",-3000000
-Symos,29/11/2022,"Vault withdraw",-1000000
-Symos,02/12/2022,"Vault withdraw",-500000
-Symos,04/12/2022,"Vault withdraw",-10000000
-Symos,05/12/2022,"Vault withdraw",-500000
-Symos,06/12/2022,"Vault withdraw",-20000000
-Zarathos,07/12/2022,"Vault deposit",40000000
-Symos,09/12/2022,"Vault deposit",86455
-Symos,09/12/2022,"Vault withdraw",-1000000
-Zarathos,10/12/2022,"Vault deposit",2608832
-Zarathos,10/12/2022,"Vault withdraw",-1000000
-Symos,11/12/2022,"Vault withdraw",-200000
-Symos,11/12/2022,"Vault withdraw",-1000000
-Zarathos,12/12/2022,"Vault withdraw",-4000000
-Symos,14/12/2022,"Vault withdraw",-750000
-Symos,14/12/2022,"Vault withdraw",-15000000
-Zarathos,15/12/2022,"Vault deposit",3203752
-Zarathos,15/12/2022,"Vault withdraw",-5000000
-Symos,15/12/2022,"Vault withdraw",-750000
-Zarathos,17/12/2022,"Vault deposit",3915202
-Zarathos,17/12/2022,"Vault withdraw",-6000000
-Zarathos,17/12/2022,"Vault deposit",3000000
-Zarathos,17/12/2022,"Vault deposit",3000000
-Zarathos,17/12/2022,"Vault withdraw",-8000000
-Zarathos,17/12/2022,"Vault deposit",4000000
\ No newline at end of file
diff --git a/functions.php b/functions.php
index 9d463cb..57aedd1 100644
--- a/functions.php
+++ b/functions.php
@@ -120,4 +120,62 @@ function getLog($user, $csv) {
return $usrVault;
}
+// vaultTxns(): Show all vault transactions
+function vaultTxns($csv) {
+ $output = '';
+
+ $output .= '
';
+ $output .= ' ';
+ $output .= ' | User | ';
+ $output .= ' Timestamp | ';
+ $output .= ' Operation | ';
+ $output .= ' Amount | ';
+ $output .= ' ';
+
+ $output .= ' ';
+
+ foreach ($csv as $entry) {
+ if ($entry[2] == 'Vault withdraw') {
+ $class = 'debit';
+ } else {
+ $class = 'credit';
+ }
+
+ $output .= '';
+ $output .= '| ';
+ $output .= $entry[0];
+ $output .= ' | ';
+ $output .= '';
+ $output .= date("d/m/Y", $entry[1]);
+ $output .= ' | ';
+ $output .= '';
+ $output .= $entry[2];
+ $output .= ' | ';
+ $output .= '';
+ $output .= formatMoney($entry[3]);
+ $output .= ' | ';
+ $output .= '
';
+ }
+
+ $output .= ' ';
+
+ $output .= '
';
+
+ echo $output;
+}
+
+function splitVault(array $inputArray, string $fieldName, $fieldValue): array {
+ $firstArray = [];
+ $secondArray = [];
+
+ foreach ($inputArray as $item) {
+ if (isset($item[$fieldName]) && $item[$fieldName] == $fieldValue) {
+ $firstArray[] = $item;
+ } else {
+ $secondArray[] = $item;
+ }
+ }
+
+ return [$firstArray, $secondArray];
+}
?>
\ No newline at end of file
diff --git a/index.php b/index.php
index 7a4af43..2fe3b0f 100644
--- a/index.php
+++ b/index.php
@@ -21,43 +21,18 @@ include('functions.php');
Transactions
-
-
- | User |
- Timestamp |
- Operation |
- Amount |
-
-
- ';
- echo '';
- echo $entry[0];
- echo ' | ';
- echo '';
- echo date("d/m/Y", $entry[1]);
- echo ' | ';
- echo '';
- echo $entry[2];
- echo ' | ';
- echo '';
- echo formatMoney($entry[3]);
- echo ' | ';
- echo '';
- }
- ?>
-
+
Balances
+
+