1
0
mirror of https://github.com/fspc/Yellow-Bike-Database.git synced 2025-02-22 08:53:23 -05:00

Adds checking number to cvs num if one exists.

This commit is contained in:
Jonathan Rosenbaum 2015-04-11 05:15:47 +00:00
parent e983cc7d0f
commit 109cf3d3c9

View File

@ -225,7 +225,7 @@ $csv_directory = CSV_DIRECTORY;
} }
// second statement to find normal transactions // second statement to find normal transactions
$query = "SELECT SUBSTRING_INDEX(date, ' ', 1) AS 'date', transaction_id, transaction_type, description, amount, " . $query = "SELECT SUBSTRING_INDEX(date, ' ', 1) AS 'date', transaction_id, transaction_type, check_number, description, amount, " .
"CONCAT(contacts.first_name, ' ', contacts.last_name) AS 'patron' " . "CONCAT(contacts.first_name, ' ', contacts.last_name) AS 'patron' " .
"FROM transaction_log, contacts WHERE paid=1 AND date!='NULL' " . "FROM transaction_log, contacts WHERE paid=1 AND date!='NULL' " .
"AND (payment_type='cash' OR payment_type='check') " . "AND (payment_type='cash' OR payment_type='check') " .
@ -234,7 +234,7 @@ $csv_directory = CSV_DIRECTORY;
$sql2 = mysql_query($query, $YBDB) or die(mysql_error()); $sql2 = mysql_query($query, $YBDB) or die(mysql_error());
// third statement to find anonymous transactions // third statement to find anonymous transactions
$query = "SELECT SUBSTRING_INDEX(date, ' ', 1) AS 'date', transaction_id, transaction_type, description, amount " . $query = "SELECT SUBSTRING_INDEX(date, ' ', 1) AS 'date', transaction_id, transaction_type, check_number, description, amount " .
"FROM transaction_log WHERE paid=1 AND date!='NULL' " . "FROM transaction_log WHERE paid=1 AND date!='NULL' " .
"AND (payment_type='cash' OR payment_type='check') " . "AND (payment_type='cash' OR payment_type='check') " .
"AND anonymous=1 " . "AND anonymous=1 " .
@ -248,7 +248,10 @@ $csv_directory = CSV_DIRECTORY;
$description = preg_replace('/\n/', ' \r ', $result['description']); $description = preg_replace('/\n/', ' \r ', $result['description']);
$description = preg_replace('/\r/', '\r', $description); $description = preg_replace('/\r/', '\r', $description);
$description = preg_replace('/,/', ';', $description); $description = preg_replace('/,/', ';', $description);
$gnucash_csv_file .= $result['date'] . ', ' . $result['transaction_id'] . if ($result['check_number'] != "NULL") {
$check_number = $result['check_number'];
}
$gnucash_csv_file .= $result['date'] . ', ' . $result['transaction_id'] . ' ' . $check_number .
',' . ' [' . $coordinator[$result['transaction_id']] . ' => ' . $result['patron'] . '] ' . ',' . ' [' . $coordinator[$result['transaction_id']] . ' => ' . $result['patron'] . '] ' .
$description . ' (Income:' . $result['transaction_type'] . ') ' . $description . ' (Income:' . $result['transaction_type'] . ') ' .
', ' . $result['amount'] . ', ' . ', ' . $result['amount'] . ', ' .
@ -260,7 +263,10 @@ $csv_directory = CSV_DIRECTORY;
$description = preg_replace('/\n/', ' \r ', $result['description']); $description = preg_replace('/\n/', ' \r ', $result['description']);
$description = preg_replace('/\r/', '\r', $description); $description = preg_replace('/\r/', '\r', $description);
$description = preg_replace('/,/', ';', $description); $description = preg_replace('/,/', ';', $description);
$gnucash_csv_file .= $result['date'] . ', ' . $result['transaction_id'] . if ($result['check_number'] != "NULL") {
$check_number = $result['check_number'];
}
$gnucash_csv_file .= $result['date'] . ', ' . $result['transaction_id'] . ' ' . $check_number .
',' . ' [' . $coordinator[$result['transaction_id']] . ' => Anonymous] ' . ',' . ' [' . $coordinator[$result['transaction_id']] . ' => Anonymous] ' .
$description . ' (Income:' . $result['transaction_type'] . ') ' . $description . ' (Income:' . $result['transaction_type'] . ') ' .
', ' . $result['amount'] . ', ' . ', ' . $result['amount'] . ', ' .