void CEditUI::PaintText(HDC hDC) { DWORD mCurTextColor = m_dwTextColor; if( m_dwTextColor == 0 ) mCurTextColor = m_dwTextColor = m_pManager->GetDefaultFontColor(); if( m_dwDisabledTextColor == 0 ) m_dwDisabledTextColor = m_pManager->GetDefaultDisabledColor(); CDuiString sDrawText = GetText(); CDuiString sTipValue = GetTipValue(); if(sDrawText == sTipValue || sDrawText == _T("")) { mCurTextColor = m_dwTipValueColor; sDrawText = sTipValue; } else { CDuiString sTemp = sDrawText; if( m_bPasswordMode ) { sDrawText.Empty(); LPCTSTR pStr = sTemp.GetData(); while( *pStr != _T('\0') ) { sDrawText += m_cPasswordChar; pStr = ::CharNext(pStr); } } } RECT rc = m_rcItem; rc.left += m_rcTextPadding.left; rc.right -= m_rcTextPadding.right; rc.top += m_rcTextPadding.top; rc.bottom -= m_rcTextPadding.bottom; if( IsEnabled() ) { CRenderEngine::DrawText(hDC, m_pManager, rc, sDrawText, mCurTextColor, \ m_iFont, DT_SINGLELINE | m_uTextStyle); } else { CRenderEngine::DrawText(hDC, m_pManager, rc, sDrawText, m_dwDisabledTextColor, \ m_iFont, DT_SINGLELINE | m_uTextStyle); } }
//---------------------------------------------------------------------------- //! \brief this is main work loop function for any GUI's entry, // param index is for GUI's index id //---------------------------------------------------------------------------- void CReturnDlg::WorkLoop(int index) { TCHAR buf[10] = { L"" }; m_strMsg.m_nFormat = DT_LEFT; m_strMsg2.m_nFormat = DT_RIGHT; m_Bt.ShowWindow(SW_HIDE); m_Bt1.ShowWindow(SW_HIDE); m_strMsg.SetColor(RGB(0, 0, 0),RGB( 255,255,255)); m_strMsg1.SetColor(RGB(0, 0, 0),RGB( 255,255,255)); CString str = L""; CString str1 = L""; int i = 0; switch(index) { case PASSWORD_INPUT: //Password Input m_bGoBackFlag = FALSE; for(i = 0;i<m_strPassword.GetLength();i++) str += L"*"; ShowText(L"Enter Password", L"", str); break; case AMOUNT_INPUT: //Amout Input m_bGoBackFlag = FALSE; ShowText(L"Enter Amount", L"", m_strAmount); break; case CLERK_INPUT: //Clerk ID input if (CDataFile::Read(L"CLERK ID", buf) && CString(buf) == L"Off") { m_bGoBackFlag?GoBack():GoNext(); } else { m_bGoBackFlag = FALSE; ShowText(L"Enter Clerk", L"Id", L""); break; } case RECEIP_TINPUT: //Receipt input if (CDataFile::Read(L"RECEIPT", buf) && CString(buf) == L"Off") { m_bGoBackFlag?GoBack():GoNext(); } else { m_bGoBackFlag = FALSE; ShowText(L"Enter Receipt", L"Number", L""); } break; case ENTERCARD_INPUT: //Card enter and manual Entry m_bGoBackFlag = FALSE; if (!OpenDevice()) { m_strErr1 = L"fail open device"; PostMessage(ERROR_MESSAGE, 2, 1); break; } m_strMsg.m_nFormat = DT_RIGHT; m_strMsg2.m_nFormat = DT_LEFT; ShowText(m_strAmount, L"Insert/Swipe/Tap", L"or Key Card #"); SetTimer(1, 30000, NULL); break; // debit card case DEBITCARDENTRY: m_bCancelPrint = TRUE; m_bGoBackFlag = FALSE; ShowText(L"Pass to", L"Customer", L""); SetTimer(1, 3000, NULL); m_bCancelInCustomer = TRUE; break; case DEBITCASHBACK: //CASHBACK if (m_bReturnFlag) { m_bGoBackFlag?GoBack():GoNext(); break; } if (CDataFile::Read(L"CASHBACK", buf) && CString(buf) == L"Off") { m_bGoBackFlag?GoBack():GoNext(); } else { m_bGoBackFlag = FALSE; str = L"Enter Cashback"; str1 = L"Amount"; CString str2 = L"$0.00"; ShowText(str, str1, str2); } break; case DEBITSURCHARGEFEE: //surcharge fee if (m_bReturnFlag) { m_bGoBackFlag?GoBack():GoNext(); break; } if (!CDataFile::Read(L"SURCHARGE", buf)) { m_bGoBackFlag?GoBack():GoNext(); return; } if (CString(buf) == L"$0.00" || CString(buf) == L"") { m_bGoBackFlag?GoBack():GoNext(); } else { m_bGoBackFlag = FALSE; m_Bt.SetValue(1, L" Cancel", IDB_CANCEL); m_Bt.ShowWindow(SW_SHOW); m_Bt1.SetValue(3, L" OK", IDB_OK); m_Bt1.ShowWindow(SW_SHOW); str.Format(L" %s OK?", CString(buf)); ShowText(L"Fee", str, L""); m_strSurcharge = CString(buf); break; } case DEBITTIPSELECT: //TipSelect if (m_bReturnFlag) { m_bGoBackFlag?GoBack():GoNext(); break; } GetTipValue(); break; case DEBITTOTALCOMFIRM: // TotalComfirm m_bGoBackFlag = FALSE; if (DoConfirm(m_bReturnFlag)) GoNext(); else OnCancel(); break; case DEBITSELECTACCOUNT: // SelectAccount m_bGoBackFlag = FALSE; m_Bt.SetValue(1, L" CHEQUE"); m_Bt1.SetValue(3, L" SAVING"); m_Bt.ShowWindow(SW_SHOW); m_Bt1.ShowWindow(SW_SHOW); ShowText(L"Select Account", L"", L""); break; case DEBITONLINEPIN: //OnlinePin if (!EnterOnlinePin()) { m_strErr1 = L"EnterOnlinePin"; PostMessage(ERROR_MESSAGE, 2, 1); } else { ShowText(L"Please Wait...", L"", L""); GoToLevel(DOTRANSACTION); } break; case DEBITMERCHANTCOPY: // for merchant copy of the receipt if (m_TRREC.ComStatus == ST_OK && m_TRREC.TranStatus == ST_APPROVED) str = L"APPROVED"; else str = L"Unsuccessful"; m_strMsg2.m_nFormat = DT_LEFT; ShowText(str, L"Retrieve Card", L"Pass to Clerk"); Print(); break; case DEBITCUSTOMERCOPY: // for Customer copy of the receipt ShowText(L"Press OK for", L"customer copy", L""); SetTimer(1, 30000, NULL); break; case DEBITWAITCOPYEND: // waiting for Customer copy of the receipt ending... if (m_TRREC.ComStatus == ST_OK && m_TRREC.TranStatus == ST_APPROVED) { str.Format(L"AUTH : %s", CString(m_TRREC.AuthCode)); m_strMsg2.m_nFormat = DT_LEFT; str1.Format(L"Inv.#: %s", CString(m_TRREC.InvoiceNo)); ShowText(L"APPROVED", str, str1); } else { str.Format(L"Declined %s", CString(m_TRREC.RespCode)); ShowText(L"Unsuccessful", str, L""); } break; case DEBITEND: // ending... CDialog::OnCancel(); break; // == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == == case MANUALENTRYY: //Manual Entry enter expiry m_strMsg.SetCaption(L"Enter Expiry"); m_strMsg1.SetCaption(L"Date MMYY"); m_strMsg2.SetCaption(L""); break; case MANUAL_IMPRINT_CARD: //imprint card m_strMsg.SetCaption(L"Imprint Card"); m_strMsg1.SetCaption(L"Press OK"); m_strMsg2.SetCaption(L""); break; // == == == == == == == == == == == == == = EMV Chip Card Debit Sale :C chip page 122 == == == == == == == == == == == == == = case CHIPENTRYY: m_bCancelPrint = TRUE; m_bGoBackFlag = FALSE; ShowText(L"Pass to", L"Customer", L""); SetTimer(1, 3000, NULL); m_bCancelInCustomer = TRUE; break; case SELECT_LANGUAGE: if (SupportEnglishOrFrench()) { // get first language found will be selected // EMVSelectLanguage(???); m_bGoBackFlag?GoBack():GoNext(); } else { m_bGoBackFlag = FALSE; m_Bt.SetValue(1, L" English"); m_Bt.ShowWindow(SW_SHOW); m_Bt1.SetValue(3, L" Francais"); m_Bt1.ShowWindow(SW_SHOW); str.Format(L" %s OK?", CString(buf)); ShowText(L"Select language", L"Choisir langue", L""); } break; case SELECT_APPLICATIION: /* if (!IsEMVMultiApplication()) { //Select this single Application m_bGoBackFlag?GoBack():GoNext(); } else { m_bGoBackFlag = FALSE; m_Bt.SetValue(1, L" No"); m_Bt.ShowWindow(SW_SHOW); m_Bt1.SetValue(3, L" Yes"); m_Bt1.ShowWindow(SW_SHOW); str = GetNextEMVApplicationLabel(); ShowText(L"Select", str, L""); } */ break; case APPLICATION_CONFIRM: m_bGoBackFlag = FALSE; m_Bt.SetValue(1, L" No"); m_Bt.ShowWindow(SW_SHOW); m_Bt1.SetValue(3, L" Yes"); m_Bt1.ShowWindow(SW_SHOW); ShowText(m_strCurrentApplicationLabel, L"OK?", L""); break; case CHIP_DEBITCASHBACK: //CASHBACK m_bCancelPrint = TRUE; if (m_TRREC.CardType == CARD_CREDIT) { m_bGoBackFlag?GoBack():GoNext(); return; } if (CDataFile::Read(L"CASHBACK", buf) && CString(buf) == L"Off") { m_bGoBackFlag?GoBack():GoNext(); } else { m_bGoBackFlag = FALSE; str = L"Enter Cashback"; str1 = L"Amount"; CString str2 = m_strCashback;//L"$0.00"; ShowText(str, str1, str2); } break; case CHIP_DEBITSURCHARGEFEE: //surcharge fee if (m_TRREC.CardType == CARD_CREDIT) { m_bGoBackFlag?GoBack():GoNext(); return; } if (!CDataFile::Read(L"SURCHARGE", buf)) { m_bGoBackFlag?GoBack():GoNext(); return; } if (CString(buf) == L"$0.00" || CString(buf) == L"") { m_bGoBackFlag?GoBack():GoNext(); } else { m_bGoBackFlag = FALSE; m_Bt.SetValue(1, L" Cancel", IDB_CANCEL); m_Bt.ShowWindow(SW_SHOW); m_Bt1.SetValue(3, L" OK", IDB_OK); m_Bt1.ShowWindow(SW_SHOW); str.Format(L" %s OK?", CString(buf)); ShowText(L"Fee", str, L""); m_strSurcharge = CString(buf); break; } case CHIP_DEBITTIPSELECT: //TipSelect GetTipValue(); break; case CHIP_DEBITTOTALCOMFIRM: // TotalComfirm m_bGoBackFlag = FALSE; if (DoConfirm(m_bReturnFlag)) GoNext(); else OnCancel(); break; case CHIP_DEBITSELECTACCOUNT: // SelectAccount if (m_TRREC.CardType == CARD_CREDIT) { // m_bGoBackFlag?GoBack():GoNext(); m_strMsg2.m_nFormat = DT_LEFT; ShowText(L"Please Wait...", L"Do not remove", L"Card!"); m_iLevel = EMV_WAIT; SetKeyReturn(KEY_ENTER); return; } m_bGoBackFlag = FALSE; m_Bt.SetValue(1, L" CHEQUE"); m_Bt1.SetValue(3, L" SAVING"); m_Bt.ShowWindow(SW_SHOW); m_Bt1.ShowWindow(SW_SHOW); ShowText(L"Select Account", L"", L""); break; case CHIP_DEBITENTERPIN: //EnterPin if (!EMVEnterPin())//Fix me later { m_strErr1 = L"EMVEnterPin"; PostMessage(ERROR_MESSAGE, 2, 1); } else { if (m_TRREC.CardType == CARD_CREDIT) { GoNext(); } else { ShowText(L"Please Wait...", L"", L""); GoToLevel(DOTRANSACTION); } } break; case CHIP_PASSTOCLERK: //Pass to clerk ShowText(L"Pass to clerk", L"Do not remove card", L""); SetTimer(1, 3000, NULL); break; case CHIP_DEBITMERCHANTCOPY: // for merchant copy of the receipt if (m_TRREC.ComStatus == ST_OK && m_TRREC.TranStatus == ST_APPROVED) str = L"APPROVED"; else str = L"Unsuccessful"; m_strMsg2.m_nFormat = DT_LEFT; ShowText(str, L"Remove card", L"Pass to clerk"); Print(); break; case CHIP_DEBITCUSTOMERCOPY: // for Customer copy of the receipt ShowText(L"Press OK for", L"customer copy", L""); SetTimer(1, 30000, NULL); break; case CHIP_DEBITWAITCOPYEND: // waiting for Customer copy of the receipt ending... if (m_TRREC.ComStatus == ST_OK && m_TRREC.TranStatus == ST_APPROVED) { str.Format(L"AUTH : %s", CString(m_TRREC.AuthCode)); m_strMsg2.m_nFormat = DT_LEFT; str1.Format(L"Inv.#: %s", CString(m_TRREC.InvoiceNo)); ShowText(L"APPROVED", str, str1); } else { str.Format(L"Declined %s", CString(m_TRREC.RespCode)); ShowText(L"Unsuccessful", str, L""); } break; case CHIP_DEBITEND: // ending... if (GetScrStatus() == SCR_POWER_ON) ShowText(L"Please",L"Remove Card",L""); else CDialog::OnCancel(); break; // == == == == == == == == == == == == == = Credit Card Sale :C Swiped page 75 == == == == == == == == == == == == == == == == == = case CREDITSWIPEENTRYY://FRAUD CHECK m_bCancelPrint = TRUE; m_bGoBackFlag = FALSE; if (CDataFile::Read(L"FRAUD CHECK", buf) && CString(buf) == L"Off") { if (m_bReturnFlag) GoToLevel(DOTRANSACTION); else m_bGoBackFlag?GoBack():GoNext(); } else { ShowText(L"Enter Last", L"4 Digits", L""); } break; case CREDITSWIPETOCUSTOMER: case MANUAL_SWIPETOCUSTOMER: if (m_bReturnFlag) { m_bGoBackFlag?GoBack():GoNext(); break; } if (CDataFile::Read(L"TIP PROMPT", buf) && CString(buf) == L"Off") { m_iLevel = DOTRANSACTION; GoToLevel(m_iLevel); } else { ShowText(L"Pass to", L"Customer", L""); SetTimer(1, 3000, NULL); m_bCancelInCustomer = TRUE; m_bGoBackFlag = FALSE; } break; case CREDITSWIPETIPSELECT: //TipSelect case MANUAL_SWIPETIPSELECT: //TipSelect if (m_bReturnFlag) { m_bGoBackFlag?GoBack():GoNext(); break; } GetTipValue(); break; case CREDITSWIPETOTALCOMFIRM: // TotalComfirm case MANUAL_SWIPETOTALCOMFIRM: // TotalComfirm m_bGoBackFlag = FALSE; if (m_bReturnFlag) { m_bGoBackFlag?GoBack():GoNext(); break; } if (DoConfirm(m_bReturnFlag)) GoNext(); else OnCancel(); break; case CREDITSWIPETOCLERK: //Pass to clerk case MANUAL_SWIPETOCLERK: //Pass to clerk ShowText(L"Pass to", L"clerk", L""); SetTimer(1, 3000, NULL); break; case CREDITMERCHANTCOPY: // for merchant copy of the receipt m_strMsg2.m_nFormat = DT_LEFT; if (m_TRREC.ComStatus == ST_OK && m_TRREC.TranStatus == ST_APPROVED) { str.Format(L"AUTH : %s", CString(m_TRREC.AuthCode)); m_strMsg2.m_nFormat = DT_LEFT; str1.Format(L"Inv.#: %s", CString(m_TRREC.InvoiceNo)); ShowText(L"APPROVED", str, str1); } else { if (strlen(m_TRREC.HostRespText) > 0) str = CString(m_TRREC.HostRespText); else str.Format(L"Declined %s", CString(m_TRREC.RespCode)); ShowText(L"Unsuccessful", str, L""); } Print(); break; case CREDITCUSTOMERCOPY: // for Customer copy of the receipt ShowText(L"Press OK for", L"customer copy", L""); SetTimer(1, 30000, NULL); break; case CREDITWAITCOPYEND: // waiting for Customer copy of the receipt ending... if (m_TRREC.ComStatus == ST_OK && m_TRREC.TranStatus == ST_APPROVED) { str.Format(L"AUTH : %s", CString(m_TRREC.AuthCode)); m_strMsg2.m_nFormat = DT_LEFT; str1.Format(L"Inv.#: %s", CString(m_TRREC.InvoiceNo)); ShowText(L"APPROVED", str, str1); } else { str.Format(L"Declined %s", CString(m_TRREC.RespCode)); ShowText(L"Unsuccessful", str, L""); } break; case CREDITEND: // ending... // case MANUAL_END: // ending... CDialog::OnCancel(); break; // == == == == == == == == == == == == == == Do transaction (connect to host) == == == == == == == = case DOTRANSACTION: DoTransaction(); break; case CANCELENTRY: m_bCancelFlag = TRUE; ShowText(L"Transaction", L"Cancelled", L""); SetTimer(1, 30000, NULL); if (m_TRREC.CardError == CARD_NO_ERROR && m_bCancelPrint) Print(0); break; case CANCELTOCLERK: if(m_TRREC.bEmvTransaction) { GoToLevel(EMV_REMOVE_CARD); break; } if (m_bCancelInCustomer) { ShowText(L"Pass to", L"Clerk", L""); SetTimer(1, 3000, NULL); } else CDialog::OnCancel(); break; // == == == == == == == Display Window == == == == == case DISPLAY_WINDOW: m_strMsg2.m_nFormat = DT_LEFT; str = CDisplay::GetLine(1); if (str.GetLength() > 0) m_strTitle.SetCaption(str); str = CDisplay::GetLine(2); ShowText(str, CDisplay::GetLine(3), CDisplay::GetLine(4)); SetDisplayButton(); break; case EMV_SELECT_LANGUAGE: //EMV Select language m_Bt.SetValue(1, L" English"); m_Bt.ShowWindow(SW_SHOW); m_Bt1.SetValue(3, L" Francais"); m_Bt1.ShowWindow(SW_SHOW); ShowText(L"Select language", L"Choisir langue", L""); break; case EMV_CONFIRM_AMOUNT: //EMV confirm amount str.Format(L" $ %s OK?", DealAmountStr(m_TRREC.TotalAmount)); m_strMsg2.m_nFormat = DT_LEFT; ShowText(L"Total :", str, L"Press OK to confirm"); break; case EMV_SELECT_ACCOUNT: //EMV select account m_Bt.SetValue(1, L" CHEQUE"); m_Bt1.SetValue(3, L" SAVING"); m_Bt.ShowWindow(SW_SHOW); m_Bt1.ShowWindow(SW_SHOW); ShowText(L"Select Account", L"", L""); break; case EMV_REMOVE_CARD: //EMV Remove Card if (GetScrStatus() == SCR_POWER_ON) ShowText(L"Please",L"Remove Card",L""); else CDialog::OnCancel(); break; case EMV_PASS_COUSTOMER: //EMV Remove Card ShowText(L"Pass to", L"Customer", L""); break; case EMV_START: //EMV Remove Card StartEMV(); break; } }