From 13b8c029df64439fa11db7f5f17de66a924715d9 Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Thu, 4 Dec 1997 11:40:14 +0000 Subject: [PATCH] oops, we weren't looking at both price cells in ledger git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@273 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/RegWindow.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/src/RegWindow.c b/src/RegWindow.c index 9913fc8bd4..a218c0fc04 100644 --- a/src/RegWindow.c +++ b/src/RegWindow.c @@ -1500,23 +1500,40 @@ regSaveTransaction( RegWindow *regData, int position ) /* ignore MOD_PRIC for non-stock accounts */ if( (regData->changed & MOD_PRIC) && ((MUTUAL == regData->type) || - (STOCK == regData->type) || - (PORTFOLIO == regData->type)) ) + (STOCK == regData->type) )) { String price; float val=0.0; /* must be float for sscanf to work */ - DEBUG("MOD_PRIC\n"); + DEBUG("MOD_PRIC_mutual/stock\n"); /* ...the price flag ... */ price = XbaeMatrixGetCell(regData->reg,row+PRCC_CELL_R,PRCC_CELL_C); sscanf( price, "%f", &val ); trans->share_price = val; - /* not needed -- the regRefresh will redraw all -- - * sprintf( buf, "%.2f ", trans->share_price ); - * XbaeMatrixSetCell( regData->reg, row+PRCC_CELL_R, PRCC_CELL_C, buf ); - */ + } + + /* ignore MOD_PRIC for non-stock accounts */ + if( (regData->changed & MOD_PRIC) && + (PORTFOLIO == regData->type) ) + { + String price; + float val=0.0; /* must be float for sscanf to work */ + double prc, prd; + + DEBUG("MOD_PRIC-portfolio\n"); + /* ...the price flag ... */ + + price = XbaeMatrixGetCell(regData->reg,row+PRCC_CELL_R,PRCC_CELL_C); + sscanf( price, "%f", &val ); + prc = val; + + price = XbaeMatrixGetCell(regData->reg,row+PRCD_CELL_R,PRCD_CELL_C); + sscanf( price, "%f", &val ); + prd = val; + + trans->share_price = DMAX (prc, prd); } /* If this is a new transaction, and the user did not