mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Robert Graham Merkel's update to gnc-asssociate-account.c
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@3313 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
7d87e7e26b
commit
26efcc708a
@ -6,6 +6,8 @@
|
|||||||
* Copyright 2000 Gnumatic Incorporated *
|
* Copyright 2000 Gnumatic Incorporated *
|
||||||
* Written by Robert Merkel <rgmerk@mira.net> *
|
* Written by Robert Merkel <rgmerk@mira.net> *
|
||||||
* *
|
* *
|
||||||
|
* WARNING WARNING WARNING: THIS STUFF IS TOTALLY UNTESTED AND *
|
||||||
|
* IS ONLY IN CVS FOR SAFEKEEPING *
|
||||||
* This program is free software; you can redistribute it and/or *
|
* This program is free software; you can redistribute it and/or *
|
||||||
* modify it under the terms of the GNU General Public License as *
|
* modify it under the terms of the GNU General Public License as *
|
||||||
* published by the Free Software Foundation; either version 2 of *
|
* published by the Free Software Foundation; either version 2 of *
|
||||||
@ -88,8 +90,12 @@ back_associate_expense_accounts(Account *stock_account,
|
|||||||
|
|
||||||
kvp_frame_set_slot(acc_frame, "associated-stock-account",
|
kvp_frame_set_slot(acc_frame, "associated-stock-account",
|
||||||
stock_acc_guid_kvpval);
|
stock_acc_guid_kvpval);
|
||||||
|
|
||||||
|
kvp_value_delete(stock_acc_guid_kvpval);
|
||||||
|
|
||||||
kvp_frame_set_slot(acc_frame, "associated-stock-account-category",
|
kvp_frame_set_slot(acc_frame, "associated-stock-account-category",
|
||||||
stock_acc_category_kvpval);
|
stock_acc_category_kvpval);
|
||||||
|
kvp_value_delete(stock_acc_category_kvpval);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -120,8 +126,10 @@ back_associate_income_accounts(Account *stock_account,
|
|||||||
|
|
||||||
kvp_frame_set_slot(acc_frame, "associated-stock-account",
|
kvp_frame_set_slot(acc_frame, "associated-stock-account",
|
||||||
stock_acc_guid_kvpval);
|
stock_acc_guid_kvpval);
|
||||||
|
kvp_value_delete(stock_acc_guid_kvpval);
|
||||||
kvp_frame_set_slot(acc_frame, "associated-stock-account-category",
|
kvp_frame_set_slot(acc_frame, "associated-stock-account-category",
|
||||||
stock_acc_category_kvpval);
|
stock_acc_category_kvpval);
|
||||||
|
kvp_value_delete(stock_acc_category_kvpval);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -176,6 +184,22 @@ de_kvp_account_list(kvp_value *kvpd_list)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*********************************************************************\
|
||||||
|
* gnc_tracking_associate_income_accounts *
|
||||||
|
* associate a list of income accounts with a stock account *
|
||||||
|
* *
|
||||||
|
* NOTE: Please disassociate all the accounts in account_list *
|
||||||
|
* using gnc_tracking_dissociate_accounts if necessary, BEFORE *
|
||||||
|
* calling this function *
|
||||||
|
* *
|
||||||
|
* Args: stock_account - the stock account *
|
||||||
|
* category - the type of association *
|
||||||
|
* account_list - a GList of Account *'s of the accounts *
|
||||||
|
* to associate with the stock account *
|
||||||
|
* *
|
||||||
|
* Returns : void *
|
||||||
|
\*********************************************************************/
|
||||||
|
|
||||||
void
|
void
|
||||||
gnc_tracking_associate_income_accounts(Account *stock_account,
|
gnc_tracking_associate_income_accounts(Account *stock_account,
|
||||||
GNCTrackingIncomeCategory category,
|
GNCTrackingIncomeCategory category,
|
||||||
@ -200,9 +224,27 @@ gnc_tracking_associate_income_accounts(Account *stock_account,
|
|||||||
kvp_frame_set_slot(inc_account_frame,
|
kvp_frame_set_slot(inc_account_frame,
|
||||||
income_to_key[category],
|
income_to_key[category],
|
||||||
kvpd_on_account_list);
|
kvpd_on_account_list);
|
||||||
|
|
||||||
|
kvp_value_delete(kvpd_on_account_list);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*********************************************************************\
|
||||||
|
* gnc_tracking_associate_expense_accounts *
|
||||||
|
* associate a list of expense accounts with a stock account *
|
||||||
|
* *
|
||||||
|
* NOTE: Please disassociate all the accounts in account_list *
|
||||||
|
* using gnc_tracking_dissociate_accounts if necessary, BEFORE *
|
||||||
|
* calling this function *
|
||||||
|
* *
|
||||||
|
* Args: stock_account - the stock account *
|
||||||
|
* category - the type of association *
|
||||||
|
* account_list - a GList of Account *'s of the accounts *
|
||||||
|
* to associate with the stock account *
|
||||||
|
* *
|
||||||
|
* Returns : void *
|
||||||
|
\*********************************************************************/
|
||||||
|
|
||||||
void gnc_tracking_asssociate_expense_account(Account *stock_account,
|
void gnc_tracking_asssociate_expense_account(Account *stock_account,
|
||||||
GNCTrackingExpenseCategory category,
|
GNCTrackingExpenseCategory category,
|
||||||
GList *account_list)
|
GList *account_list)
|
||||||
@ -226,9 +268,22 @@ void gnc_tracking_asssociate_expense_account(Account *stock_account,
|
|||||||
kvp_frame_set_slot(expense_acc_frame,
|
kvp_frame_set_slot(expense_acc_frame,
|
||||||
expense_to_key[category],
|
expense_to_key[category],
|
||||||
kvpd_on_account_list);
|
kvpd_on_account_list);
|
||||||
|
kvp_value_delete(kvpd_on_account_list);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*********************************************************************\
|
||||||
|
* gnc_tracking_find_expense_accounts *
|
||||||
|
* find out which accounts are associated with a particular *
|
||||||
|
* account in a particular way *
|
||||||
|
* *
|
||||||
|
* *
|
||||||
|
* Args: stock_account - the stock account *
|
||||||
|
* category - the type of association *
|
||||||
|
* *
|
||||||
|
* Returns : A GList of Account *'s listing the accounts *
|
||||||
|
\*********************************************************************/
|
||||||
|
|
||||||
GList *gnc_tracking_find_expense_accounts(Account *stock_account,
|
GList *gnc_tracking_find_expense_accounts(Account *stock_account,
|
||||||
GNCTrackingExpenseCategory category)
|
GNCTrackingExpenseCategory category)
|
||||||
{
|
{
|
||||||
@ -251,6 +306,18 @@ GList *gnc_tracking_find_expense_accounts(Account *stock_account,
|
|||||||
|
|
||||||
return de_kvp_account_list(kvpd_on_account_list);
|
return de_kvp_account_list(kvpd_on_account_list);
|
||||||
}
|
}
|
||||||
|
/*********************************************************************\
|
||||||
|
* gnc_tracking_find_income_accounts *
|
||||||
|
* find out which accounts are associated with a particular *
|
||||||
|
* account in a particular way *
|
||||||
|
* *
|
||||||
|
* *
|
||||||
|
* Args: stock_account - the stock account *
|
||||||
|
* category - the type of association *
|
||||||
|
* *
|
||||||
|
* Returns : A GList of Account *'s listing the accounts *
|
||||||
|
\*********************************************************************/
|
||||||
|
|
||||||
GList *gnc_tracking_find_income_accounts(Account *stock_account,
|
GList *gnc_tracking_find_income_accounts(Account *stock_account,
|
||||||
GNCTrackingIncomeCategory category)
|
GNCTrackingIncomeCategory category)
|
||||||
{
|
{
|
||||||
@ -274,6 +341,15 @@ GList *gnc_tracking_find_income_accounts(Account *stock_account,
|
|||||||
return de_kvp_account_list(kvpd_on_account_list);
|
return de_kvp_account_list(kvpd_on_account_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*********************************************************************\
|
||||||
|
* gnc_tracking_find_all_expense_accounts *
|
||||||
|
* find all expense accounts associated with a stock account *
|
||||||
|
* *
|
||||||
|
* Args: stock_account - the stock account *
|
||||||
|
* *
|
||||||
|
* Returns : A GList of Account *'s listing the accounts *
|
||||||
|
\*********************************************************************/
|
||||||
|
|
||||||
GList *gnc_tracking_find_all_expense_accounts(Account *stock_account)
|
GList *gnc_tracking_find_all_expense_accounts(Account *stock_account)
|
||||||
{
|
{
|
||||||
GList *complete_list=NULL;
|
GList *complete_list=NULL;
|
||||||
@ -287,6 +363,14 @@ GList *gnc_tracking_find_all_expense_accounts(Account *stock_account)
|
|||||||
}
|
}
|
||||||
return complete_list;
|
return complete_list;
|
||||||
}
|
}
|
||||||
|
/*********************************************************************\
|
||||||
|
* gnc_tracking_find_all_income_accounts *
|
||||||
|
* find all income accounts associated with a stock account *
|
||||||
|
* *
|
||||||
|
* Args: stock_account - the stock account *
|
||||||
|
* *
|
||||||
|
* Returns : A GList of Account *'s listing the accounts *
|
||||||
|
\*********************************************************************/
|
||||||
|
|
||||||
GList *gnc_tracking_find_all_income_accounts(Account *stock_account)
|
GList *gnc_tracking_find_all_income_accounts(Account *stock_account)
|
||||||
{
|
{
|
||||||
@ -301,11 +385,32 @@ GList *gnc_tracking_find_all_income_accounts(Account *stock_account)
|
|||||||
}
|
}
|
||||||
return complete_list;
|
return complete_list;
|
||||||
}
|
}
|
||||||
|
/*********************************************************************\
|
||||||
|
* gnc_tracking_find_stock_account *
|
||||||
|
* find the stock account associated with this expense/income *
|
||||||
|
* account. If there is no association, return NULL *
|
||||||
|
* *
|
||||||
|
* Args: inc_or_expense_acc - the expense/income account *
|
||||||
|
* *
|
||||||
|
* *
|
||||||
|
* Returns : The associated stock account *
|
||||||
|
\*********************************************************************/
|
||||||
|
|
||||||
Account *gnc_tracking_find_stock_account(Account *inc_or_expense_acc)
|
Account *gnc_tracking_find_stock_account(Account *inc_or_expense_acc)
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
/*********************************************************************\
|
||||||
|
* gnc_tracking_dissociate_account *
|
||||||
|
* remove any association between this income/expense account *
|
||||||
|
* and any stock account it is presently associated with *
|
||||||
|
* account. *
|
||||||
|
* *
|
||||||
|
* Args: inc_or_expense_acc - the expense/income account *
|
||||||
|
* *
|
||||||
|
* *
|
||||||
|
* Returns : void *
|
||||||
|
\*********************************************************************/
|
||||||
|
|
||||||
void
|
void
|
||||||
gnc_tracking_dissociate_account(Account *inc_or_expense_account)
|
gnc_tracking_dissociate_account(Account *inc_or_expense_account)
|
||||||
@ -360,6 +465,7 @@ gnc_tracking_dissociate_account(Account *inc_or_expense_account)
|
|||||||
kvp_frame_set_slot(assoc_acc_kvpframe,
|
kvp_frame_set_slot(assoc_acc_kvpframe,
|
||||||
category_name,
|
category_name,
|
||||||
acc_list_kvpval);
|
acc_list_kvpval);
|
||||||
|
kvp_value_delete(acc_list_kvpval);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user