diff --git a/Connections/database_functions.php b/Connections/database_functions.php index fb9b7e6..2df2239 100644 --- a/Connections/database_functions.php +++ b/Connections/database_functions.php @@ -164,7 +164,7 @@ define("CSV_DIRECTORY","csv"); // note: this is a hack for record keeping in an accounting program, and not recommended; // bike donations/giveaways should be handled in a better way like using BikeBinder, // an inventory system application,that may be tied into YBDB someday -$gnucash_accounts = array( "Assets:Current Assets:Checking" => "checking", +$gnucash_accounts = array( "Assets:Current Assets:Checking Account" => "checking", "Assets:Current Assets:PayPal" => "credit", "Assets:Account Receivable" => "account_receivable", "Assets:Donations" => "donation" diff --git a/js/transaction.js b/js/transaction.js index 84b314a..78c63fd 100644 --- a/js/transaction.js +++ b/js/transaction.js @@ -380,6 +380,32 @@ $(function() { // produce a GnuCash CSV file on submit + function gnucash_csv_submit() { + + // grab values + $("#gnucash_csv_submit").on("click keypress",function() { + + event.preventDefault(); + var Format = wNumb({decimals:0}); + + var transaction_range = []; + var gnucash_accounts = []; + $.each($("#gnucash_csv_range").val(), function(k,v) { + transaction_range.push(Format.from(v)); + }); + gnucash_accounts = $("#gnucash_csv_accounts").val(); + + // send values for processing individual csv files for each selected account type + if (gnucash_accounts) { + $.each(gnucash_accounts, function(k,v) { + $.post("json/transaction.php",{ gnucash_account_type: v, transaction_range: transaction_range}); + }); + } + }); + + } + + gnucash_csv_submit(); // null or real number function payment_result(result) { diff --git a/transaction_log.php b/transaction_log.php index 9b4d926..ab70ca8 100644 --- a/transaction_log.php +++ b/transaction_log.php @@ -822,7 +822,7 @@ if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "ChangeDate")) { echo "
"; echo "
    "; - echo ""; + echo ""; ?>