mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Reformat source files gnc-accounting-period.*
Change tabs to white space and some other white space changes.
This commit is contained in:
parent
037f5ed5be
commit
416b79d304
@ -50,14 +50,14 @@
|
|||||||
#include "gnc-ui-util.h"
|
#include "gnc-ui-util.h"
|
||||||
|
|
||||||
static time64 gnc_accounting_period_start_time64 (GncAccountingPeriod which,
|
static time64 gnc_accounting_period_start_time64 (GncAccountingPeriod which,
|
||||||
const GDate *fy_end,
|
const GDate *fy_end,
|
||||||
const GDate *contains);
|
const GDate *contains);
|
||||||
static time64 gnc_accounting_period_end_time64 (GncAccountingPeriod which,
|
static time64 gnc_accounting_period_end_time64 (GncAccountingPeriod which,
|
||||||
const GDate *fy_end,
|
const GDate *fy_end,
|
||||||
const GDate *contains);
|
const GDate *contains);
|
||||||
|
|
||||||
static time64
|
static time64
|
||||||
lookup_start_date_option(GDate *fy_end)
|
lookup_start_date_option (GDate *fy_end)
|
||||||
{
|
{
|
||||||
time64 time;
|
time64 time;
|
||||||
int which;
|
int which;
|
||||||
@ -67,8 +67,8 @@ lookup_start_date_option(GDate *fy_end)
|
|||||||
(GNC_PREFS_GROUP_ACCT_SUMMARY, GNC_PREF_START_DATE));
|
(GNC_PREFS_GROUP_ACCT_SUMMARY, GNC_PREF_START_DATE));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
which = gnc_prefs_get_int(GNC_PREFS_GROUP_ACCT_SUMMARY, GNC_PREF_START_PERIOD);
|
which = gnc_prefs_get_int (GNC_PREFS_GROUP_ACCT_SUMMARY, GNC_PREF_START_PERIOD);
|
||||||
time = gnc_accounting_period_start_time64(which, fy_end, NULL);
|
time = gnc_accounting_period_start_time64 (which, fy_end, NULL);
|
||||||
}
|
}
|
||||||
/* we will need the balance of the last transaction before the start
|
/* we will need the balance of the last transaction before the start
|
||||||
date, so subtract 1 from start date */
|
date, so subtract 1 from start date */
|
||||||
@ -78,7 +78,7 @@ lookup_start_date_option(GDate *fy_end)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static time64
|
static time64
|
||||||
lookup_end_date_option(GDate *fy_end)
|
lookup_end_date_option (GDate *fy_end)
|
||||||
{
|
{
|
||||||
time64 time;
|
time64 time;
|
||||||
int which;
|
int which;
|
||||||
@ -88,8 +88,8 @@ lookup_end_date_option(GDate *fy_end)
|
|||||||
(GNC_PREFS_GROUP_ACCT_SUMMARY, GNC_PREF_END_DATE));
|
(GNC_PREFS_GROUP_ACCT_SUMMARY, GNC_PREF_END_DATE));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
which = gnc_prefs_get_int(GNC_PREFS_GROUP_ACCT_SUMMARY, GNC_PREF_END_PERIOD);
|
which = gnc_prefs_get_int (GNC_PREFS_GROUP_ACCT_SUMMARY, GNC_PREF_END_PERIOD);
|
||||||
time = gnc_accounting_period_end_time64(which, fy_end, NULL);
|
time = gnc_accounting_period_end_time64 (which, fy_end, NULL);
|
||||||
}
|
}
|
||||||
if (time == 0)
|
if (time == 0)
|
||||||
time = -1;
|
time = -1;
|
||||||
@ -97,38 +97,36 @@ lookup_end_date_option(GDate *fy_end)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static GDate *
|
static GDate *
|
||||||
get_fy_end(void)
|
get_fy_end (void)
|
||||||
{
|
{
|
||||||
QofBook *book;
|
QofBook *book;
|
||||||
GDate *date = NULL;
|
GDate *date = NULL;
|
||||||
|
|
||||||
book = gnc_get_current_book();
|
book = gnc_get_current_book();
|
||||||
qof_instance_get (QOF_INSTANCE (book),
|
qof_instance_get (QOF_INSTANCE (book), "fy-end", &date, NULL);
|
||||||
"fy-end", &date,
|
|
||||||
NULL);
|
|
||||||
return date;
|
return date;
|
||||||
}
|
}
|
||||||
|
|
||||||
time64
|
time64
|
||||||
gnc_accounting_period_fiscal_start(void)
|
gnc_accounting_period_fiscal_start (void)
|
||||||
{
|
{
|
||||||
time64 t;
|
time64 t;
|
||||||
GDate *fy_end = get_fy_end();
|
GDate *fy_end = get_fy_end();
|
||||||
t = lookup_start_date_option(fy_end);
|
t = lookup_start_date_option (fy_end);
|
||||||
if (fy_end)
|
if (fy_end)
|
||||||
g_date_free(fy_end);
|
g_date_free (fy_end);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
time64
|
time64
|
||||||
gnc_accounting_period_fiscal_end(void)
|
gnc_accounting_period_fiscal_end (void)
|
||||||
{
|
{
|
||||||
time64 t;
|
time64 t;
|
||||||
GDate *fy_end = get_fy_end();
|
GDate *fy_end = get_fy_end();
|
||||||
|
|
||||||
t = lookup_end_date_option(fy_end);
|
t = lookup_end_date_option (fy_end);
|
||||||
if (fy_end)
|
if (fy_end)
|
||||||
g_date_free(fy_end);
|
g_date_free (fy_end);
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,9 +139,9 @@ gnc_accounting_period_start_gdate (GncAccountingPeriod which,
|
|||||||
|
|
||||||
if (contains)
|
if (contains)
|
||||||
{
|
{
|
||||||
date = g_date_new_dmy(g_date_get_day(contains),
|
date = g_date_new_dmy (g_date_get_day (contains),
|
||||||
g_date_get_month(contains),
|
g_date_get_month (contains),
|
||||||
g_date_get_year(contains));
|
g_date_get_year (contains));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -154,8 +152,8 @@ gnc_accounting_period_start_gdate (GncAccountingPeriod which,
|
|||||||
switch (which)
|
switch (which)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
g_message("Undefined relative time constant %d", which);
|
g_message ("Undefined relative time constant %d", which);
|
||||||
g_date_free(date);
|
g_date_free (date);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
case GNC_ACCOUNTING_PERIOD_TODAY:
|
case GNC_ACCOUNTING_PERIOD_TODAY:
|
||||||
@ -163,47 +161,47 @@ gnc_accounting_period_start_gdate (GncAccountingPeriod which,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case GNC_ACCOUNTING_PERIOD_MONTH:
|
case GNC_ACCOUNTING_PERIOD_MONTH:
|
||||||
gnc_gdate_set_month_start(date);
|
gnc_gdate_set_month_start (date);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GNC_ACCOUNTING_PERIOD_MONTH_PREV:
|
case GNC_ACCOUNTING_PERIOD_MONTH_PREV:
|
||||||
gnc_gdate_set_prev_month_start(date);
|
gnc_gdate_set_prev_month_start (date);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GNC_ACCOUNTING_PERIOD_QUARTER:
|
case GNC_ACCOUNTING_PERIOD_QUARTER:
|
||||||
gnc_gdate_set_quarter_start(date);
|
gnc_gdate_set_quarter_start (date);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GNC_ACCOUNTING_PERIOD_QUARTER_PREV:
|
case GNC_ACCOUNTING_PERIOD_QUARTER_PREV:
|
||||||
gnc_gdate_set_prev_quarter_start(date);
|
gnc_gdate_set_prev_quarter_start (date);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GNC_ACCOUNTING_PERIOD_CYEAR:
|
case GNC_ACCOUNTING_PERIOD_CYEAR:
|
||||||
gnc_gdate_set_year_start(date);
|
gnc_gdate_set_year_start (date);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GNC_ACCOUNTING_PERIOD_CYEAR_PREV:
|
case GNC_ACCOUNTING_PERIOD_CYEAR_PREV:
|
||||||
gnc_gdate_set_prev_year_start(date);
|
gnc_gdate_set_prev_year_start (date);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GNC_ACCOUNTING_PERIOD_FYEAR:
|
case GNC_ACCOUNTING_PERIOD_FYEAR:
|
||||||
if (fy_end == NULL)
|
if (fy_end == NULL)
|
||||||
{
|
{
|
||||||
g_message("Request for fisal year value but no fiscal year end value provided.");
|
g_message ("Request for fisal year value but no fiscal year end value provided.");
|
||||||
g_date_free(date);
|
g_date_free (date);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
gnc_gdate_set_fiscal_year_start(date, fy_end);
|
gnc_gdate_set_fiscal_year_start (date, fy_end);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GNC_ACCOUNTING_PERIOD_FYEAR_PREV:
|
case GNC_ACCOUNTING_PERIOD_FYEAR_PREV:
|
||||||
if (fy_end == NULL)
|
if (fy_end == NULL)
|
||||||
{
|
{
|
||||||
g_message("Request for fisal year value but no fiscal year end value provided.");
|
g_message ("Request for fisal year value but no fiscal year end value provided.");
|
||||||
g_date_free(date);
|
g_date_free (date);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
gnc_gdate_set_prev_fiscal_year_start(date, fy_end);
|
gnc_gdate_set_prev_fiscal_year_start (date, fy_end);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return date;
|
return date;
|
||||||
@ -211,18 +209,18 @@ gnc_accounting_period_start_gdate (GncAccountingPeriod which,
|
|||||||
|
|
||||||
static time64
|
static time64
|
||||||
gnc_accounting_period_start_time64 (GncAccountingPeriod which,
|
gnc_accounting_period_start_time64 (GncAccountingPeriod which,
|
||||||
const GDate *fy_end,
|
const GDate *fy_end,
|
||||||
const GDate *contains)
|
const GDate *contains)
|
||||||
{
|
{
|
||||||
GDate *date;
|
GDate *date;
|
||||||
time64 secs;
|
time64 secs;
|
||||||
|
|
||||||
date = gnc_accounting_period_start_gdate(which, fy_end, contains);
|
date = gnc_accounting_period_start_gdate (which, fy_end, contains);
|
||||||
if (!date)
|
if (!date)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
secs = gnc_time64_get_day_start_gdate(date);
|
secs = gnc_time64_get_day_start_gdate (date);
|
||||||
g_date_free(date);
|
g_date_free (date);
|
||||||
return secs;
|
return secs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,9 +233,9 @@ gnc_accounting_period_end_gdate (GncAccountingPeriod which,
|
|||||||
|
|
||||||
if (contains)
|
if (contains)
|
||||||
{
|
{
|
||||||
date = g_date_new_dmy(g_date_get_day(contains),
|
date = g_date_new_dmy (g_date_get_day (contains),
|
||||||
g_date_get_month(contains),
|
g_date_get_month (contains),
|
||||||
g_date_get_year(contains));
|
g_date_get_year (contains));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -248,8 +246,8 @@ gnc_accounting_period_end_gdate (GncAccountingPeriod which,
|
|||||||
switch (which)
|
switch (which)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
g_message("Undefined relative time constant %d", which);
|
g_message ("Undefined relative time constant %d", which);
|
||||||
g_date_free(date);
|
g_date_free (date);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case GNC_ACCOUNTING_PERIOD_TODAY:
|
case GNC_ACCOUNTING_PERIOD_TODAY:
|
||||||
@ -257,47 +255,47 @@ gnc_accounting_period_end_gdate (GncAccountingPeriod which,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case GNC_ACCOUNTING_PERIOD_MONTH:
|
case GNC_ACCOUNTING_PERIOD_MONTH:
|
||||||
gnc_gdate_set_month_end(date);
|
gnc_gdate_set_month_end (date);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GNC_ACCOUNTING_PERIOD_MONTH_PREV:
|
case GNC_ACCOUNTING_PERIOD_MONTH_PREV:
|
||||||
gnc_gdate_set_prev_month_end(date);
|
gnc_gdate_set_prev_month_end (date);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GNC_ACCOUNTING_PERIOD_QUARTER:
|
case GNC_ACCOUNTING_PERIOD_QUARTER:
|
||||||
gnc_gdate_set_quarter_end(date);
|
gnc_gdate_set_quarter_end (date);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GNC_ACCOUNTING_PERIOD_QUARTER_PREV:
|
case GNC_ACCOUNTING_PERIOD_QUARTER_PREV:
|
||||||
gnc_gdate_set_prev_quarter_end(date);
|
gnc_gdate_set_prev_quarter_end (date);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GNC_ACCOUNTING_PERIOD_CYEAR:
|
case GNC_ACCOUNTING_PERIOD_CYEAR:
|
||||||
gnc_gdate_set_year_end(date);
|
gnc_gdate_set_year_end (date);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GNC_ACCOUNTING_PERIOD_CYEAR_PREV:
|
case GNC_ACCOUNTING_PERIOD_CYEAR_PREV:
|
||||||
gnc_gdate_set_prev_year_end(date);
|
gnc_gdate_set_prev_year_end (date);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GNC_ACCOUNTING_PERIOD_FYEAR:
|
case GNC_ACCOUNTING_PERIOD_FYEAR:
|
||||||
if (fy_end == NULL)
|
if (fy_end == NULL)
|
||||||
{
|
{
|
||||||
g_message("Request for fisal year value but no fiscal year end value provided.");
|
g_message ("Request for fisal year value but no fiscal year end value provided.");
|
||||||
g_date_free(date);
|
g_date_free (date);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
gnc_gdate_set_fiscal_year_end(date, fy_end);
|
gnc_gdate_set_fiscal_year_end (date, fy_end);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GNC_ACCOUNTING_PERIOD_FYEAR_PREV:
|
case GNC_ACCOUNTING_PERIOD_FYEAR_PREV:
|
||||||
if (fy_end == NULL)
|
if (fy_end == NULL)
|
||||||
{
|
{
|
||||||
g_message("Request for fisal year value but no fiscal year end value provided.");
|
g_message ("Request for fisal year value but no fiscal year end value provided.");
|
||||||
g_date_free(date);
|
g_date_free (date);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
gnc_gdate_set_prev_fiscal_year_end(date, fy_end);
|
gnc_gdate_set_prev_fiscal_year_end (date, fy_end);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -306,18 +304,18 @@ gnc_accounting_period_end_gdate (GncAccountingPeriod which,
|
|||||||
|
|
||||||
static time64
|
static time64
|
||||||
gnc_accounting_period_end_time64 (GncAccountingPeriod which,
|
gnc_accounting_period_end_time64 (GncAccountingPeriod which,
|
||||||
const GDate *fy_end,
|
const GDate *fy_end,
|
||||||
const GDate *contains)
|
const GDate *contains)
|
||||||
{
|
{
|
||||||
GDate *date;
|
GDate *date;
|
||||||
time64 secs;
|
time64 secs;
|
||||||
|
|
||||||
date = gnc_accounting_period_end_gdate(which, fy_end, contains);
|
date = gnc_accounting_period_end_gdate (which, fy_end, contains);
|
||||||
if (!date)
|
if (!date)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
secs = gnc_time64_get_day_end_gdate(date);
|
secs = gnc_time64_get_day_end_gdate (date);
|
||||||
g_date_free(date);
|
g_date_free (date);
|
||||||
return secs ;
|
return secs ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,8 +92,9 @@ typedef enum
|
|||||||
* @return The starting day of the specified time interval, as a
|
* @return The starting day of the specified time interval, as a
|
||||||
* GDate. */
|
* GDate. */
|
||||||
GDate *gnc_accounting_period_start_gdate (GncAccountingPeriod which,
|
GDate *gnc_accounting_period_start_gdate (GncAccountingPeriod which,
|
||||||
const GDate *fy_end,
|
const GDate *fy_end,
|
||||||
const GDate *contains);
|
const GDate *contains);
|
||||||
|
|
||||||
/** This function returns the ending date for an accounting period.
|
/** This function returns the ending date for an accounting period.
|
||||||
* The date will be computed based upon the type of accounting
|
* The date will be computed based upon the type of accounting
|
||||||
* interval requested, an optional fiscal year end value, and an
|
* interval requested, an optional fiscal year end value, and an
|
||||||
@ -119,8 +120,8 @@ GDate *gnc_accounting_period_end_gdate (GncAccountingPeriod which,
|
|||||||
|
|
||||||
/* Get the fiscal accounting period from the preferences and return
|
/* Get the fiscal accounting period from the preferences and return
|
||||||
the start and end times. */
|
the start and end times. */
|
||||||
time64 gnc_accounting_period_fiscal_start(void);
|
time64 gnc_accounting_period_fiscal_start (void);
|
||||||
time64 gnc_accounting_period_fiscal_end(void);
|
time64 gnc_accounting_period_fiscal_end (void);
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user