mirror of
https://github.com/Gnucash/gnucash.git
synced 2024-11-27 03:10:23 -06:00
*** empty log message ***
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2194 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
87f1d9c4f0
commit
6434055bb1
@ -1,5 +1,8 @@
|
||||
2000-04-21 Dave Peticolas <peticola@cs.ucdavis.edu>
|
||||
|
||||
* src/engine/Query.c: (xaccFreeQuery): free the split list
|
||||
(xaccQueryGetSplits) handle a null account group
|
||||
|
||||
* src/gnome/dialog-edit.c: figure out all the accounts affected
|
||||
by a currency/security/type change and ask the user whether the
|
||||
needed changes should be made.
|
||||
|
@ -96,7 +96,6 @@ xaccInitQuery(Query * q, QueryTerm * initial_term) {
|
||||
q->primary_sort = BY_STANDARD;
|
||||
q->secondary_sort = BY_NONE;
|
||||
q->tertiary_sort = BY_NONE;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -133,7 +132,6 @@ xaccQuerySingleTerm(Query * q, QueryTerm * qt) {
|
||||
and->data = qt;
|
||||
or->data = and;
|
||||
q->terms = or;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -163,6 +161,7 @@ xaccFreeQuery(Query * q) {
|
||||
g_list_free(g_list_nth_data(gl, i));
|
||||
}
|
||||
g_list_free(gl);
|
||||
g_free(q->split_list);
|
||||
g_free(q);
|
||||
}
|
||||
|
||||
@ -655,12 +654,12 @@ xaccQueryGetSplits(Query * q) {
|
||||
and_ptr = or_ptr->data;
|
||||
or_ptr->data = g_list_sort(and_ptr, query_sort_func);
|
||||
}
|
||||
|
||||
|
||||
/* iterate over accounts */
|
||||
all_accts = xaccGetAccounts(q->acct_group);
|
||||
for(ptr = all_accts; *ptr; ptr++) {
|
||||
for(ptr = all_accts; ptr && *ptr; ptr++) {
|
||||
current = *ptr;
|
||||
|
||||
|
||||
/* first, check this account to see if we need to look at it at
|
||||
* all. If the query is "ANY" matching or "NONE" matching, you
|
||||
* get what you expect; if it's "ALL" matching, only the first
|
||||
@ -804,7 +803,7 @@ xaccQueryAddSingleAccountMatch(Query * q, Account * acct,
|
||||
}
|
||||
else {
|
||||
qr = xaccQueryMerge(q, qs, QUERY_OR);
|
||||
}
|
||||
}
|
||||
xaccQuerySwapTerms(q, qr);
|
||||
xaccFreeQuery(qs);
|
||||
xaccFreeQuery(qr);
|
||||
@ -1511,6 +1510,15 @@ xaccMemoMatchPredicate(Split * s, PredicateData * pd) {
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
* xaccMiscMatchPredicate
|
||||
* *** Bill, please complete! ***
|
||||
*******************************************************************/
|
||||
int xaccMiscMatchPredicate(Split * s, PredicateData * pd) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************
|
||||
* xaccAmountMatchPredicate
|
||||
*******************************************************************/
|
||||
|
@ -217,6 +217,3 @@ time_t xaccQueryGetLatestDateFound(Query * q);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
@ -47,24 +47,28 @@ sub account_flatlist
|
||||
}
|
||||
|
||||
# --------------------------------------------------
|
||||
# &checkprice ($account, $date);
|
||||
# &checkprice ($account, $date, $price);
|
||||
# This routine checks to see if the account has already stored a
|
||||
# price for this day, returning 1 if yes otherwise 0/undefined.
|
||||
# price for this day, returning 1 if yes and the price is the same
|
||||
# as the one given, otherwise 0/undefined.
|
||||
|
||||
sub checkprice
|
||||
{
|
||||
my $acct = $_[0];
|
||||
my $dayte = $_[1];
|
||||
my $price = $_[2];
|
||||
my ($query, $datesecs, $earliest, $latest);
|
||||
my ($splitlist, $i, $split, $action);
|
||||
my ($splitlist, $i, $split, $action, $pryce);
|
||||
my $retn_value = 0;
|
||||
|
||||
$datesecs = gnucash::xaccScanDateS ($dayte);
|
||||
$earliest = $datesecs - 16*3600; # subtract 16 hours
|
||||
$latest = $datesecs + 16*3600; # add 16 hours
|
||||
$query = gnucash::xaccMallocQuery();
|
||||
gnucash::xaccQueryAddAccount ($query, $acct);
|
||||
gnucash::xaccQuerySetDateRange ($query, $earliest, $latest);
|
||||
gnucash::xaccQuerySetGroup($query, gnucash::xaccAccountGetParent($acct));
|
||||
gnucash::xaccQueryAddSingleAccountMatch ($query, $acct, $gnucash::QUERY_AND);
|
||||
gnucash::xaccQueryAddDateMatchTT ($query, $earliest, $latest,
|
||||
$gnucash::QUERY_AND);
|
||||
$splitlist = gnucash::xaccQueryGetSplits ($query);
|
||||
|
||||
$i = 0;
|
||||
@ -72,7 +76,8 @@ sub checkprice
|
||||
while ($split && ($retn_value == 0))
|
||||
{
|
||||
$action = gnucash::xaccSplitGetAction ($split);
|
||||
if ($action eq "Price") { $retn_value = 1; }
|
||||
$pryce = gnucash::xaccSplitGetSharePrice ($split);
|
||||
if (($action eq "Price") && ($price == $pryce)) { $retn_value = 1; }
|
||||
$i++;
|
||||
$split = gnucash::IthSplit ($splitlist, $i);
|
||||
}
|
||||
@ -208,7 +213,8 @@ foreach $acct (@acctlist)
|
||||
print "$security $prodname last price = $price at $dayte\n";
|
||||
# This || construction will store the price if its not already
|
||||
# stored (in the 28 hour period surrounding "dayte")
|
||||
&checkprice ($acct, $dayte) || &setprice ($acct, $dayte, $price);
|
||||
&checkprice ($acct, $dayte, $price) ||
|
||||
&setprice ($acct, $dayte, $price);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user