mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Fix subtotal sign in credit note ledger
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@21573 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
0313539a88
commit
1357c9e737
@ -454,11 +454,22 @@ static const char * get_value_entry (VirtualLocation virt_loc,
|
|||||||
GncEntryLedger *ledger = user_data;
|
GncEntryLedger *ledger = user_data;
|
||||||
gnc_numeric value;
|
gnc_numeric value;
|
||||||
|
|
||||||
|
/* Credit notes need some attention here: the ledger displays values
|
||||||
|
* as on the document, meaning positive for credit notes. Credit note
|
||||||
|
* values are negative internally though. So depending on which values
|
||||||
|
* are used to calculate the subtotal, the resulting subtotal has to be
|
||||||
|
* sign-reversed before displaying.
|
||||||
|
*/
|
||||||
/* Check if this is the current cursor */
|
/* Check if this is the current cursor */
|
||||||
if (virt_cell_loc_equal (ledger->table->current_cursor_loc.vcell_loc,
|
if (virt_cell_loc_equal (ledger->table->current_cursor_loc.vcell_loc,
|
||||||
virt_loc.vcell_loc))
|
virt_loc.vcell_loc))
|
||||||
{
|
{
|
||||||
gnc_entry_ledger_compute_value (ledger, &value, NULL);
|
gnc_entry_ledger_compute_value (ledger, &value, NULL);
|
||||||
|
/* Credit note info: this function works with values as seen
|
||||||
|
* on-screen in the ledger, so they are always in the proper sign.
|
||||||
|
* As per the above no sign reversal is needed for
|
||||||
|
* credit note type ledgers.
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -468,14 +479,14 @@ static const char * get_value_entry (VirtualLocation virt_loc,
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
value = gncEntryReturnValue (entry, ledger->is_cust_doc);
|
value = gncEntryReturnValue (entry, ledger->is_cust_doc);
|
||||||
}
|
/* Credit note info: this function works with internal values,
|
||||||
|
* so they are negative for credit note type ledgers and have to
|
||||||
|
* be sign-reversed as per the above.
|
||||||
|
*/
|
||||||
|
|
||||||
/* Credit notes have negative values, but the ledger should
|
if (ledger->is_credit_note)
|
||||||
* display it as on the document, meaning positive.
|
value = gnc_numeric_neg (value);
|
||||||
* So reverse the value for credit notes.
|
}
|
||||||
*/
|
|
||||||
if (ledger->is_credit_note)
|
|
||||||
value = gnc_numeric_neg (value);
|
|
||||||
|
|
||||||
return xaccPrintAmount (value, gnc_default_print_info (FALSE));
|
return xaccPrintAmount (value, gnc_default_print_info (FALSE));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user