![]() |
[SOLVED]Thousand character in the Subtotal of Gro |
Post Reply ![]() |
Author | |
ylaroye ![]() Groupie ![]() Joined: 01 November 2018 Status: Offline Points: 20 |
![]() ![]() ![]() ![]() ![]() Posted: 11 May 2019 at 4:41pm |
I am disappointed to see that my following proposal for evolution was not retained in version 19.0.0 Beta 1 while it is legitimate and that I proposed the code to implement it. Why? ------------------------------------ In a financial application, there is need to present the amounts with the thousand separator. This can be done for the elements in the ReportControl lines but not for the GroupRow.I propose an evolution on the SetFormatString method allowing to manage: - the thousand separator => keyword 'T' - the decimal separator => keyword 'D' - the sign '-' (sometimes represented with parentheses: -1234 => (1234)) => keyword 'N' These 3 elements must be put between '[]' after the '%' and the value of each element is the character just behind the keyword. Example: 'Subtotal =% [T D, N (]. 02f $' T = Blank D = Comma N = Parenthesis ![]() Product: XTP 18.6.0 and XTP 19.0.0 Beta 1 on VC++ 6.0 Platform: Windows 10 (64bit) |
|
![]() |
|
agontarenko ![]() Admin Group ![]() Joined: 25 March 2016 Status: Offline Points: 316 |
![]() ![]() ![]() ![]() ![]() |
Hello, We added same functionality but by using CURRENCYFMT structure and GetCurrencyFormat function. This allows to get currency string more flexible. See BOOL CFormulaDlg::OnInitDialog() function in ReportSample. ![]() Regards, Artem Gontarenko
|
|
![]() |
|
ylaroye ![]() Groupie ![]() Joined: 01 November 2018 Status: Offline Points: 20 |
![]() ![]() ![]() ![]() ![]() |
Hello Artem,
CURRENCYFMT structure and GetCurrencyFormat function are only used in Source\Chart\Utils\XTPChartNumberFormat.cpp and XTPChartNumberFormat.h files. I haven't seen in Xtreme ToolkitPro v19.0.0.050119 where CURRENCYFMT structure and GetCurrencyFormat function are used for the ReportControl (in "Source" and "Samples" sub-folders). Can you send me your modified FormulaDlg.cpp/FormulaDlg.h files to understand how you have implemented it? Regards, Yves Laroye |
|
![]() |
|
agontarenko ![]() Admin Group ![]() Joined: 25 March 2016 Status: Offline Points: 316 |
![]() ![]() ![]() ![]() ![]() |
This changes from FormulaDlg // FormulaDlg.h ~CFormulaDlg(); CURRENCYFMT m_fmtCurrency; int GetLocaleLong(LCTYPE LCType); // FormulaDlg.cpp CFormulaDlg::CFormulaDlg(CWnd* pParent /*=NULL*/) : CDialog(CFormulaDlg::IDD, pParent) { //{{AFX_DATA_INIT(CFormulaDlg) // NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT ZeroMemory(&m_fmtCurrency, sizeof(m_fmtCurrency)); m_fmtCurrency.lpDecimalSep = new TCHAR[10]; m_fmtCurrency.lpThousandSep = new TCHAR[10]; m_fmtCurrency.lpCurrencySymbol = new TCHAR[10]; m_fmtCurrency.Grouping = 3; m_fmtCurrency.NumDigits = GetLocaleLong(LOCALE_IDIGITS); m_fmtCurrency.LeadingZero = GetLocaleLong(LOCALE_ILZERO); m_fmtCurrency.NegativeOrder = GetLocaleLong(LOCALE_INEGCURR); m_fmtCurrency.PositiveOrder = GetLocaleLong(LOCALE_ICURRENCY); GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, m_fmtCurrency.lpDecimalSep, 10); GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SCURRENCY, m_fmtCurrency.lpCurrencySymbol, 10); GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, m_fmtCurrency.lpThousandSep, 10); } CFormulaDlg::~CFormulaDlg() { SAFE_DELETE_AR(m_fmtCurrency.lpDecimalSep); SAFE_DELETE_AR(m_fmtCurrency.lpThousandSep); SAFE_DELETE_AR(m_fmtCurrency.lpCurrencySymbol); } int CFormulaDlg::GetLocaleLong(LCTYPE LCType) { TCHAR szResult[5]; int nResult = ::GetLocaleInfo(LOCALE_USER_DEFAULT, LCType, szResult, 4); ASSERT(nResult == 2); UNUSED(nResult); return _ttoi(szResult); } BOOL CFormulaDlg::OnInitDialog() { ... { _T("Pen"), _T("WA"), -200000 }, { _T("Paper"), _T("WA"), 100000 }, { _T("Books"), _T("WA"), 100000 }, }; ... BOOL bUseCurrencyFormat = TRUE; for (i = 0; i < m_wndReport.GetRows()->GetCount(); i++) { CXTPReportRow* pRow = m_wndReport.GetRows()->GetAt(i); if (pRow->IsGroupRow()) { CXTPReportGroupRow* pGroupRow = reinterpret_cast<CXTPReportGroupRow*>(pRow); if(bUseCurrencyFormat) { pGroupRow->SetFormatString(_T(" Subtotal ")); pGroupRow->SetCurrencyFormat(&m_fmtCurrency); } else { pGroupRow->SetFormatString(_T(" Subtotal $=%.02f")); } pGroupRow->SetFormula(_T("SUMSUB(R*C1:R*C8)")); pGroupRow->SetCaption(_T("x")); bUseCurrencyFormat = !bUseCurrencyFormat; } } return FALSE; } You can initiate the m_fmtCurrency structure with different values to get the desired result. Regards, Artem Gontarenko |
|
![]() |
|
agontarenko ![]() Admin Group ![]() Joined: 25 March 2016 Status: Offline Points: 316 |
![]() ![]() ![]() ![]() ![]() |
FYI. This changes will be available in next beta or final release. ToolkitPro v19.0.0.050119 not contain this changes Regards, Artem Gontarenko |
|
![]() |
|
ylaroye ![]() Groupie ![]() Joined: 01 November 2018 Status: Offline Points: 20 |
![]() ![]() ![]() ![]() ![]() |
Artem, I am looking forward to the new version! Yves Laroye
|
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |