use FormatMoney everywhere

This commit is contained in:
Marco Antonio J. Costa
2025-10-08 05:36:37 -03:00
committed by majcosta
parent 0dd32c4670
commit 3d29eff4d8
25 changed files with 160 additions and 477 deletions
+34 -114
View File
@@ -808,31 +808,15 @@ void DrawRecordsText( void )
if(pCurFinance->iAmount >=0)
{
// increase in asset - debit
swprintf(sString, L"%d", pCurFinance->iAmount);
// insert commas
InsertCommasForDollarFigure( sString );
// insert dollar sight for first record in the list
//DEF: 3/19/99: removed cause we want to see the dollar sign on ALL entries
// if( iCounter == 0 )
{
InsertDollarSignInToString( sString );
}
swprintf(sString, L"%s", FormatMoney(pCurFinance->iAmount).data());
FindFontCenterCoordinates(RECORD_DEBIT_X,0,RECORD_DEBIT_WIDTH,0, sString, FINANCE_TEXT_FONT,&usX, &usY);
mprintf(usX, 12+RECORD_Y + (iCounter * ( GetFontHeight( FINANCE_TEXT_FONT ) + 6 ) ), sString);
}
else
{
// decrease in asset - credit
swprintf(sString, L"%d", pCurFinance->iAmount * (-1));
swprintf(sString, L"%s", FormatMoney(pCurFinance->iAmount * (-1)).data());
SetFontForeground(FONT_RED);
InsertCommasForDollarFigure( sString );
// insert dollar sight for first record in the list
//DEF: 3/19/99: removed cause we want to see the dollar sign on ALL entries
// if( iCounter == 0 )
{
InsertDollarSignInToString( sString );
}
FindFontCenterCoordinates(RECORD_CREDIT_X ,0 , RECORD_CREDIT_WIDTH,0, sString, FINANCE_TEXT_FONT,&usX, &usY);
mprintf(usX, 12+RECORD_Y + (iCounter * ( GetFontHeight( FINANCE_TEXT_FONT ) + 6 ) ), sString);
@@ -860,15 +844,7 @@ void DrawRecordsText( void )
// print the balance string
swprintf(sString, L"%d", iBalance);
InsertCommasForDollarFigure( sString );
// insert dollar sight for first record in the list
//DEF: 3/19/99: removed cause we want to see the dollar sign on ALL entries
// if( iCounter == 0 )
{
InsertDollarSignInToString( sString );
}
swprintf(sString, L"%s", FormatMoney(iBalance).data());
FindFontCenterCoordinates(RECORD_BALANCE_X,0,RECORD_BALANCE_WIDTH,0, sString, FINANCE_TEXT_FONT,&usX, &usY);
mprintf(usX, 12+RECORD_Y + (iCounter * ( GetFontHeight( FINANCE_TEXT_FONT ) + 6 ) ), sString);
@@ -921,7 +897,7 @@ void InvalidateLapTopScreen( void )
void DrawSummaryText( void )
{
INT16 usX, usY;
CHAR16 pString[100];
std::wstring tmp{};
INT32 iBalance = 0;
@@ -949,98 +925,68 @@ void DrawSummaryText( void )
// yesterdays income
iBalance = GetPreviousDaysIncome( );
swprintf(pString, L"%d", iBalance );
tmp = FormatMoney(iBalance);
FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0, tmp.data(), FINANCE_TEXT_FONT, &usX, &usY);
InsertCommasForDollarFigure( pString );
if( iBalance != 0 )
InsertDollarSignInToString( pString );
FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY);
mprintf(usX,YESTERDAYS_INCOME,pString);
mprintf(usX,YESTERDAYS_INCOME,tmp.data());
SetFontForeground( FONT_BLACK );
// yesterdays other
iBalance = GetYesterdaysOtherDeposits( );
swprintf(pString, L"%d", iBalance );
tmp = FormatMoney(iBalance);
FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0, tmp.data(),FINANCE_TEXT_FONT, &usX, &usY);
InsertCommasForDollarFigure( pString );
if( iBalance != 0 )
InsertDollarSignInToString( pString );
FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY);
mprintf(usX,YESTERDAYS_OTHER,pString);
mprintf(usX,YESTERDAYS_OTHER,tmp.data());
SetFontForeground( FONT_RED );
// yesterdays debits
iBalance = GetYesterdaysDebits( );
if( iBalance < 0 )
{
SetFontForeground( FONT_RED );
iBalance *= -1;
}
tmp = FormatMoney(iBalance);
swprintf(pString, L"%d", iBalance );
FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0, tmp.data(),FINANCE_TEXT_FONT, &usX, &usY);
InsertCommasForDollarFigure( pString );
if( iBalance != 0 )
InsertDollarSignInToString( pString );
FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY);
mprintf(usX,YESTERDAYS_DEBITS,pString);
mprintf(usX,YESTERDAYS_DEBITS,tmp.data());
SetFontForeground( FONT_BLACK );
// yesterdays balance..ending balance..so todays balance then
iBalance = GetTodaysBalance( );
if( iBalance < 0 )
{
SetFontForeground( FONT_RED );
iBalance *= -1;
}
tmp = FormatMoney(iBalance);
swprintf(pString, L"%d", iBalance );
InsertCommasForDollarFigure( pString );
if( iBalance != 0 )
InsertDollarSignInToString( pString );
FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0, tmp.data(),FINANCE_TEXT_FONT, &usX, &usY);
FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY);
mprintf(usX,YESTERDAYS_BALANCE,pString);
mprintf(usX,YESTERDAYS_BALANCE,tmp.data());
SetFontForeground( FONT_BLACK );
// todays income
iBalance = GetTodaysDaysIncome( );
swprintf(pString, L"%d", iBalance );
tmp = FormatMoney(iBalance);
InsertCommasForDollarFigure( pString );
if( iBalance != 0 )
InsertDollarSignInToString( pString );
FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,tmp.data(),FINANCE_TEXT_FONT, &usX, &usY);
FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY);
mprintf(usX,TODAYS_INCOME,pString);
mprintf(usX,TODAYS_INCOME,tmp.data());
SetFontForeground( FONT_BLACK );
// todays other
iBalance = GetTodaysOtherDeposits( );
swprintf(pString, L"%d", iBalance );
tmp = FormatMoney(iBalance);
InsertCommasForDollarFigure( pString );
if( iBalance != 0 )
InsertDollarSignInToString( pString );
FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,tmp.data(),FINANCE_TEXT_FONT, &usX, &usY);
FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY);
mprintf(usX,TODAYS_OTHER,pString);
mprintf(usX,TODAYS_OTHER,tmp.data());
SetFontForeground( FONT_RED );
@@ -1053,15 +999,11 @@ void DrawSummaryText( void )
iBalance *= ( -1 );
}
swprintf(pString, L"%d", iBalance );
tmp = FormatMoney(iBalance);
InsertCommasForDollarFigure( pString );
if( iBalance != 0 )
InsertDollarSignInToString( pString );
FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,tmp.data(),FINANCE_TEXT_FONT, &usX, &usY);
FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY);
mprintf(usX,TODAYS_DEBITS,pString);
mprintf(usX,TODAYS_DEBITS,tmp.data());
SetFontForeground( FONT_BLACK );
@@ -1069,36 +1011,23 @@ void DrawSummaryText( void )
iBalance = GetCurrentBalance( );
if( iBalance < 0 )
{
iBalance *= -1;
SetFontForeground( FONT_RED );
swprintf(pString, L"%d", iBalance );
iBalance *= -1;
}
else
{
swprintf(pString, L"%d", iBalance );
}
InsertCommasForDollarFigure( pString );
if( iBalance != 0 )
InsertDollarSignInToString( pString );
FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY);
mprintf(usX,TODAYS_CURRENT_BALANCE,pString);
tmp = FormatMoney(iBalance);
FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,tmp.data(),FINANCE_TEXT_FONT, &usX, &usY);
mprintf(usX,TODAYS_CURRENT_BALANCE,tmp.data());
SetFontForeground( FONT_BLACK );
// todays forcast income
iBalance = GetProjectedTotalDailyIncome( );
swprintf(pString, L"%d", iBalance );
tmp = FormatMoney(iBalance);
InsertCommasForDollarFigure( pString );
if( iBalance != 0 )
InsertDollarSignInToString( pString );
FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,tmp.data(),FINANCE_TEXT_FONT, &usX, &usY);
FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY);
mprintf(usX,TODAYS_CURRENT_FORCAST_INCOME,pString);
mprintf(usX,TODAYS_CURRENT_FORCAST_INCOME,tmp.data());
SetFontForeground( FONT_BLACK );
@@ -1107,22 +1036,13 @@ void DrawSummaryText( void )
iBalance = GetCurrentBalance( ) + GetProjectedTotalDailyIncome( );
if( iBalance < 0 )
{
iBalance *= -1;
SetFontForeground( FONT_RED );
swprintf(pString, L"%d", iBalance );
iBalance *= -1;
}
else
{
swprintf(pString, L"%d", iBalance );
}
InsertCommasForDollarFigure( pString );
if( iBalance != 0 )
InsertDollarSignInToString( pString );
FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,pString,FINANCE_TEXT_FONT, &usX, &usY);
mprintf(usX,TODAYS_CURRENT_FORCAST_BALANCE,pString);
tmp = FormatMoney(iBalance);
FindFontRightCoordinates(0,0,iScreenWidthOffset + 580,0,tmp.data(),FINANCE_TEXT_FONT, &usX, &usY);
mprintf(usX,TODAYS_CURRENT_FORCAST_BALANCE,tmp.data());
SetFontForeground( FONT_BLACK );