GnuCash  2.6.99
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
business-helpers.c
1 /*
2  * business-options.c -- non-GUI helper functions for business features
3  *
4  * Written By: Derek Atkins <[email protected]>
5  * Copyright (C) 2003 Derek Atkins
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation; either version 2 of
10  * the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, contact:
19  *
20  * Free Software Foundation Voice: +1-617-542-5942
21  * 51 Franklin Street, Fifth Floor Fax: +1-617-542-2652
22  * Boston, MA 02110-1301, USA [email protected]
23  */
24 
25 #include "config.h"
26 
27 #include "business-options.h"
28 #include "business-helpers.h"
29 
30 GncTaxTable* gnc_business_get_default_tax_table (QofBook *book, GncOwnerType ownertype)
31 {
32  GncTaxTable *table = NULL;
33  GNCOptionDB *odb;
34 
35  odb = gnc_option_db_new_for_type (GNC_ID_BOOK);
36  qof_book_load_options (book, gnc_option_db_load_from_kvp, odb);
37 
38  switch (ownertype)
39  {
40  case GNC_OWNER_CUSTOMER:
41  table = gnc_option_db_lookup_taxtable_option (odb,
42  "Business",
43  "Default Customer TaxTable",
44  NULL);
45  break;
46 
47  case GNC_OWNER_VENDOR:
48  table = gnc_option_db_lookup_taxtable_option (odb,
49  "Business",
50  "Default Vendor TaxTable",
51  NULL);
52  break;
53 
54  default:
55  break;
56  }
57 
58  gnc_option_db_destroy (odb);
59  return table;
60 }