void DiaGridView::OnInitialUpdate() { // Call the base class OnInitialUpdate. This call is // essential for grid specific intialization (In // contrast to GXInit which performs application specific // intialization) CGXGridView::OnInitialUpdate(); // Disable Undo mechanism for the following commands. // Objective Grid has a built in Undo/Redo architecture // that can be disabled/enabled with this call. // We disable it here so that users are not able to // rollback changes that we make in code. GetParam()->EnableUndo(FALSE); CMFCDiaDoc* pDoc = GetDocument(); ASSERT_VALID(pDoc); if (!pDoc) return; m_entities = pDoc->getDrawEntities(); SetRowCount(0); SetColCount(5); SetValueRange(CGXRange(0, 1), "figure type"); SetValueRange(CGXRange(0, 2), "center x"); SetValueRange(CGXRange(0, 3), "center y"); SetValueRange(CGXRange(0, 4), "line type"); SetValueRange(CGXRange(0, 5), "line color"); // Re-enable undo mechanism GetParam()->EnableUndo(TRUE); }
BOOL CRGXEvents::OnLButtonClickedRowCol(ROWCOL nRow, ROWCOL nCol, UINT nFlags, CPoint pt) { long lEventNr = 0; //TRACE("OnLButtonClickedRowCol!\n"); SetReadOnly(FALSE); SetStyleRange(CGXRange(1, 0, GetRowCount(), 12), CGXStyle().SetFont(CGXFont()./*SetSize(14).*/SetBold(FALSE)) ); SetStyleRange(CGXRange(nRow, 0, nRow, 12), CGXStyle().SetFont(CGXFont()./*SetSize(14).*/SetBold(TRUE)) ); SetReadOnly(TRUE); if (nRow >= 1) { //TRACE("Valittu rivi %d\n", nRow); m_lCurrentLoanEventNr = atol(GetValueRowCol(nRow,17)); GetParent()->SendMessage(WM_COMMAND, GetDlgCtrlID() | RJ_OG_PARENT_DLG << 16, (LONG) GetSafeHwnd()); } return TRUE; }
BOOL CDlgArviomies::OnInitDialog() { CDialog::OnInitDialog(); m_pGXArviomies->SubclassDlgItem(IDC_ARVIOMIESRIVIT, this); m_pGXArviomies->Initialize(); //m_pGXArviomies->GetParam()->EnableUndo(FALSE); m_pGXArviomies->SetRowCount(50); m_pGXArviomies->SetColCount(4); m_pGXArviomies->SetStyleRange(CGXRange(0,1), CGXStyle().SetValue("Nkirj")); m_pGXArviomies->SetStyleRange(CGXRange(0,2), CGXStyle().SetValue("Nimi")); m_pGXArviomies->SetStyleRange(CGXRange(0,3), CGXStyle().SetValue("Oikeudet")); m_pGXArviomies->SetStyleRange(CGXRange(0,4), CGXStyle().SetValue("Tunnus")); m_pGXArviomies->SetColWidth(0,0,20); // Rivinrot m_pGXArviomies->SetColWidth(1,1,50); // Nimi m_pGXArviomies->SetColWidth(2,2,150); // Nimi m_pGXArviomies->SetColWidth(3,3,20); // Oikeudet m_pGXArviomies->SetColWidth(4,4,0); // Tunnus =ID //m_pGXArviomies->GetParam()->EnableUndo(TRUE); m_pGXArviomies->SetFocus(); ShowArviomiehet(); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void CPostcodeCityBrowse::UpdateViews() { if (!initialized) { return; } // Clear grid cityGrid.SetRowCount(0); // Process postal code CString postcode; zipEdit.GetWindowText(postcode); if (postcode.GetLength() == 0) { return; } // Query cities by Postal code QueryImp::CityStatePostcodeFromPostcodeIterator iter = refQueryFileRef->LookupCityStatePostcodeFromPostcode(postcode); CityStatePostcode cityStatePostcode; while (iter.Next(cityStatePostcode)) { int row = cityGrid.GetRowCount() + 1; cityGrid.SetRowCount(row); char tmp[20]; // Column values sprintf(tmp, "%d", cityStatePostcode.state); cityGrid.SetStyleRange( CGXRange(row, 1), CGXStyle().SetValue(tmp) ); cityGrid.SetStyleRange( CGXRange(row, 2), CGXStyle().SetValue(cityStatePostcode.postcode) ); cityGrid.SetStyleRange( CGXRange(row, 3), CGXStyle().SetValue(cityStatePostcode.financeNumber) ); cityGrid.SetStyleRange( CGXRange(row, 4), CGXStyle().SetValue(cityStatePostcode.city) ); } }
void CRGXMainWndGrid::setRowBoldFont(ROWCOL nRow) { // --- testi --- /*m_wndLainaGrid.SetReadOnly(TRUE); m_wndLainaGrid.SetStyleRange(CGXRange().SetCols(0,7), CGXStyle().SetReadOnly(TRUE)); m_wndLainaGrid.SetStyleRange(CGXRange().SetCols(8,8), CGXStyle().SetReadOnly(FALSE).SetInterior(RGB(192,192,192))); m_wndLainaGrid.SetStyleRange(CGXRange().SetCols(9,17), CGXStyle().SetReadOnly(TRUE)); */ /* //LOGFONT lf; //f1.GetObject(sizeof(lf), &lf); //CGXFont gxfont(lf); */ /* //SetStyleRange(CGXRange(i, 1, i, 16), // CGXStyle().SetInterior(RGB(192,192,192)) // ); */ // // --- font -- setGridReadOnly(FALSE); SetStyleRange(CGXRange(nRow, 0, nRow, 16), CGXStyle().SetFont(CGXFont()./*SetSize(14).*/SetBold(TRUE)) ); setGridReadOnly(TRUE); }
///////////////////////////////////////////////////////////////////////////// // Crate the window and all child windows. ///////////////////////////////////////////////////////////////////////////// void CPostcodeCityBrowse::Initialize() { assert(theApp.refQueryFile != 0); // Postcode code input zipLabel.Create("Postcode:", WS_VISIBLE | WS_CHILD, CRect(0,0,0,0), this); zipEdit.Create(WS_VISIBLE | WS_CHILD| WS_BORDER, CRect(0,0,0,0), this, PostcodeEditID); // City grid cityGrid.Create( WS_VISIBLE | WS_CHILD | WS_VSCROLL | WS_HSCROLL | WS_BORDER, CRect(0, 0, 400, 100), this, 2 ); cityGrid.Initialize(); cityGrid.SetColCount(4); // Column headings cityGrid.SetStyleRange( CGXRange(0, 1), CGXStyle().SetValue("State") ); cityGrid.SetStyleRange( CGXRange(0, 2), CGXStyle().SetValue("Postcode") ); cityGrid.SetStyleRange( CGXRange(0, 3), CGXStyle().SetValue("Finance") ); cityGrid.SetStyleRange( CGXRange(0, 4), CGXStyle().SetValue("City") ); cityGrid.GetParam()->EnableUndo(FALSE); cityGridLabel.Create("CityStatePostcode", WS_VISIBLE | WS_CHILD, CRect(0,0,0,0), this); initialized = true; // Cause initial placement to happen CRect rect; GetClientRect(rect); HandleSize(rect.right, rect.bottom); }
BOOL CRGXDeskLogRows::OnLButtonClickedRowCol(ROWCOL nRow, ROWCOL nCol, UINT nFlags, CPoint pt) { TRACE("OnLButtonClickedRowCol!\n"); SetReadOnly(FALSE); SetStyleRange(CGXRange(1, 0, GetRowCount(), 16), CGXStyle().SetFont(CGXFont()./*SetSize(14).*/SetBold(FALSE)) ); SetStyleRange(CGXRange(nRow, 0, nRow, 16), CGXStyle().SetFont(CGXFont()./*SetSize(14).*/SetBold(TRUE)) ); m_loanNr = atol(this->GetValueRowCol(nRow, 4)); SetReadOnly(TRUE); return TRUE; }
BOOL CDlgArviomies::ShowArviomiehet() { m_pGXArviomies->SetTopRow(1); m_pGXArviomies->MoveCurrentCell(GX_TOPLEFT); m_pGXArviomies->SetRowCount(0); try { // --- luetaan arviomiesten tiedot --- // m_pAMRS->m_strFilter.Format(""); m_pAMRS->Open(); iRowCount = 0; while (!m_pAMRS->IsEOF()) { iRowCount++; m_pGXArviomies->SetRowCount(iRowCount); m_pGXArviomies->SetValueRange(CGXRange(iRowCount, 1), m_pAMRS->m_AM_Nimikirjaimet); m_pGXArviomies->SetValueRange(CGXRange(iRowCount, 2), m_pAMRS->m_AM_Nimi); m_pGXArviomies->SetValueRange(CGXRange(iRowCount, 3), m_pAMRS->m_AM_Oikeudet); m_pGXArviomies->SetValueRange(CGXRange(iRowCount, 4), m_pAMRS->m_AM_Tunnus); m_pAMRS->MoveNext(); } m_pAMRS->Close(); } catch (CDBException* e) { AfxMessageBox(e->m_strError); e->Delete(); m_pAMRS->Close(); return FALSE; } return TRUE; }
void CRGXMainWndGrid::setDefaultFont() { // --- testi --- //m_wndLainaGrid.SetReadOnly(TRUE); /*m_wndLainaGrid.SetStyleRange(CGXRange().SetCols(0,7), CGXStyle().SetReadOnly(TRUE)); m_wndLainaGrid.SetStyleRange(CGXRange().SetCols(8,8), CGXStyle().SetReadOnly(FALSE).SetInterior(RGB(192,192,192))); m_wndLainaGrid.SetStyleRange(CGXRange().SetCols(9,17), CGXStyle().SetReadOnly(TRUE)); */ // // --- font setGridReadOnly(FALSE); SetStyleRange(CGXRange(1, 0, GetRowCount(), 16), CGXStyle().SetFont(CGXFont()./*SetSize(14).*/SetBold(FALSE)) ); setGridReadOnly(TRUE); }
CString CRGXMainWndGrid::ShowPawnTicketNumbers(/*CString sHtun*/ long AsId) { long lRows = 0; m_lLainojaKpl = 0; m_dLainojaYhtEuro = 0; m_lAktiivisiaKpl = 0; m_lLunastetutKpl = 0; m_dAktLainojaYhtEuro = 0; char buf[20]; CString strResult; CString stmp = ""; CString sAsId = ""; //TRACE(" --- ShowPawnTicketNumbers\n"); //BOOL bLock = LockUpdate(); clear(); setGridReadOnly(FALSE); try { //pLainaRS->Close(); /*pLainaRS->m_strFilter.Format("LA_AS_HTun='" + sHtun + "' order by LA_Nr");*/ sAsId.Format("%ld", AsId); pLainaRS->m_strFilter.Format("LA_AS_ID=" + sAsId + " order by LA_Tila, LA_Nr"); TRACE("...where %s\n", pLainaRS->m_strFilter); pLainaRS->Open(); while (!pLainaRS->IsEOF()) { lRows++; m_lLainojaKpl++; SetRowCount(lRows); SetValueRange(CGXRange(lRows, 1), pLainaRS->m_LA_Nr); SetValueRange(CGXRange(lRows, 2), pLainaRS->m_LA_LainanNimi); // --- lainan perustamispäivä ---- sprintf(buf, "%s", pLainaRS->m_LA_AlkupPv.Format("%d.%m.%Y")); SetValueRange(CGXRange(lRows, 3), buf); // // --- Eräpäivä --- sprintf(buf, "%s", pLainaRS->m_LA_EraPv.Format("%d.%m.%Y")); SetValueRange(CGXRange(lRows, 4), buf); // // --- Lainan tila --- SetValueRange(CGXRange(lRows, 5), pLainaRS->m_LA_Tila); if (pLainaRS->m_LA_Tila == "L") // lunastettu -> sininen { m_lLunastetutKpl++; SetStyleRange(CGXRange(lRows, 1, lRows, 16), CGXStyle().SetInterior(RGB(128,255,255)) ); } else if (pLainaRS->m_LA_Tila == "A") // uudistettu -> vihreä ? { m_lAktiivisiaKpl++; m_dAktLainojaYhtEuro = m_dAktLainojaYhtEuro + pLainaRS->m_LA_Laina; SetStyleRange(CGXRange(lRows, 1, lRows, 16), CGXStyle().SetInterior(RGB(64,255,192)) ); } else if (pLainaRS->m_LA_Tila == "H") // huutokaupassa -> orange ? { SetStyleRange(CGXRange(lRows, 1, lRows, 16), CGXStyle().SetInterior(RGB(255,128,128)) ); } else if (pLainaRS->m_LA_Tila == "M") // myyty huutokaupassa -> light gray ? { SetStyleRange(CGXRange(lRows, 1, lRows, 16), CGXStyle().SetInterior(RGB(192,192,192)) ); } stmp.Format("%7.2f", pLainaRS->m_LA_VakSumma); SetValueRange(CGXRange(lRows, 6), stmp); stmp.Format("%7.2f", pLainaRS->m_LA_Laina); m_dLainojaYhtEuro = m_dLainojaYhtEuro + pLainaRS->m_LA_Laina; SetValueRange(CGXRange(lRows, 7), stmp); // // --- Odotuspäivä --- if(!pLainaRS->IsFieldNull(&pLainaRS->m_LA_OdotusPv)) sprintf(buf, "%s", pLainaRS->m_LA_OdotusPv.Format("%d.%m.%Y")); else sprintf(buf, ""); SetValueRange(CGXRange(lRows, 8), buf); // --- Viite --- sprintf(buf, "%s", theApp.buildReferenceNumberFor(pLainaRS->m_LA_Nr)); SetValueRange(CGXRange(lRows, 9), buf); stmp.Format("%7.1f", pLainaRS->m_LA_Korko); SetValueRange(CGXRange(lRows, 10), stmp); SetValueRange(CGXRange(lRows, 11), pLainaRS->m_LA_Kielto); if (!pLainaRS->IsFieldNull(&pLainaRS->m_LA_KieltoRajaPv)) { SetStyleRange(CGXRange(lRows, 1, lRows, 17), CGXStyle().SetInterior(RGB(255,0,0)) // red ); } stmp.Format("%7.1f", pLainaRS->m_LA_SaVakMaksuPr); SetValueRange(CGXRange(lRows, 12), stmp); SetValueRange(CGXRange(lRows, 13), "0"); stmp.Format("%7.2f", pLainaRS->m_LA_YlimSaMaksu); SetValueRange(CGXRange(lRows, 14), stmp); SetValueRange(CGXRange(lRows, 15), pLainaRS->m_LA_Liitteet); SetValueRange(CGXRange(lRows, 16), pLainaRS->m_LA_Huom); SetValueRange(CGXRange(lRows, 17), pLainaRS->m_LA_Varasto); if (pLainaRS->m_LA_EraPv < CTime::GetCurrentTime() && !(pLainaRS->m_LA_Tila == "M" || pLainaRS->m_LA_Tila == "L")) { SetStyleRange(CGXRange(lRows, 4, lRows, 4), CGXStyle().SetInterior(RGB(250,141,69)) // rusk.punainen ); } SetRowHeight(lRows,lRows,30); // Rivikork pLainaRS->MoveNext(); } } catch (CDBException* e) { AfxMessageBox(e->m_strError); e->Delete(); } pLainaRS->Close(); //LockUpdate(bLock); Redraw(); // setGridReadOnly(TRUE); if (lRows >= 1) { SetCurrentCell(1,0); strResult = GetValueRowCol(1,1); this->FindRow(atol(strResult)); } else { SetCurrentCell(0,0); strResult = ""; } this->resetWaitDateParam(); //TRACE("Viimeisin lainanumero = %s\n", strResult); return strResult; }
void CRGXMainWndGrid::setGridReadOnly(BOOL bType) { //SetReadOnly(bType); if (bType == TRUE) { //SetStyleRange(CGXRange().SetCols(0,7), // CGXStyle().SetReadOnly(TRUE)); //SetStyleRange(CGXRange().SetCols(8,8), // CGXStyle().SetReadOnly(FALSE).SetInterior(RGB(192,192,192))); SetStyleRange(CGXRange().SetCols(8), CGXStyle() .SetControl(GX_IDS_CTRL_DATETIME)); //SetStyleRange(CGXRange().SetCols(9,17), // CGXStyle().SetReadOnly(TRUE)); SetStyleRange(CGXRange().SetCols(1), CGXStyle().SetReadOnly(TRUE)); SetStyleRange(CGXRange().SetCols(2), CGXStyle().SetReadOnly(TRUE)); SetStyleRange(CGXRange().SetCols(3), CGXStyle().SetReadOnly(TRUE)); SetStyleRange(CGXRange().SetCols(4), CGXStyle().SetReadOnly(TRUE)); SetStyleRange(CGXRange().SetCols(5), CGXStyle().SetReadOnly(TRUE)); SetStyleRange(CGXRange().SetCols(6), CGXStyle().SetReadOnly(TRUE)); SetStyleRange(CGXRange().SetCols(7), CGXStyle().SetReadOnly(TRUE)); //SetStyleRange(CGXRange().SetCols(8), // CGXStyle().SetReadOnly(TRUE)); SetStyleRange(CGXRange().SetCols(9), CGXStyle().SetReadOnly(TRUE)); SetStyleRange(CGXRange().SetCols(10), CGXStyle().SetReadOnly(TRUE)); SetStyleRange(CGXRange().SetCols(11), CGXStyle().SetReadOnly(TRUE)); SetStyleRange(CGXRange().SetCols(12), CGXStyle().SetReadOnly(TRUE)); SetStyleRange(CGXRange().SetCols(13), CGXStyle().SetReadOnly(TRUE)); SetStyleRange(CGXRange().SetCols(14), CGXStyle().SetReadOnly(TRUE)); SetStyleRange(CGXRange().SetCols(15), CGXStyle().SetReadOnly(TRUE)); SetStyleRange(CGXRange().SetCols(16), CGXStyle().SetReadOnly(TRUE)); SetStyleRange(CGXRange().SetCols(17), CGXStyle().SetReadOnly(TRUE)); } else { //SetReadOnly(bType); SetStyleRange(CGXRange().SetCols(1), CGXStyle().SetReadOnly(FALSE)); SetStyleRange(CGXRange().SetCols(2), CGXStyle().SetReadOnly(FALSE)); SetStyleRange(CGXRange().SetCols(3), CGXStyle().SetReadOnly(FALSE)); SetStyleRange(CGXRange().SetCols(4), CGXStyle().SetReadOnly(FALSE)); SetStyleRange(CGXRange().SetCols(5), CGXStyle().SetReadOnly(FALSE)); SetStyleRange(CGXRange().SetCols(6), CGXStyle().SetReadOnly(FALSE)); SetStyleRange(CGXRange().SetCols(7), CGXStyle().SetReadOnly(FALSE)); //SetStyleRange(CGXRange().SetCols(8), // CGXStyle().SetReadOnly(TRUE)); SetStyleRange(CGXRange().SetCols(9), CGXStyle().SetReadOnly(FALSE)); SetStyleRange(CGXRange().SetCols(10), CGXStyle().SetReadOnly(FALSE)); SetStyleRange(CGXRange().SetCols(11), CGXStyle().SetReadOnly(FALSE)); SetStyleRange(CGXRange().SetCols(12), CGXStyle().SetReadOnly(FALSE)); SetStyleRange(CGXRange().SetCols(13), CGXStyle().SetReadOnly(FALSE)); SetStyleRange(CGXRange().SetCols(14), CGXStyle().SetReadOnly(FALSE)); SetStyleRange(CGXRange().SetCols(15), CGXStyle().SetReadOnly(FALSE)); SetStyleRange(CGXRange().SetCols(16), CGXStyle().SetReadOnly(FALSE)); SetStyleRange(CGXRange().SetCols(17), CGXStyle().SetReadOnly(FALSE)); } }
void CRGXMainWndGrid::updateLoanRowInfo(long loanNr) { CString stmp = ""; char buf[20]; setGridReadOnly(FALSE); for (int i = 1; i <= int(this->GetRowCount()); i++) { if (atol(this->GetValueRowCol(i, 1)) == loanNr) { TRACE("Lainan rivi = %ld\n", i); break; } } try { pLainaRS->m_strFilter.Format("LA_Nr = %ld", loanNr); pLainaRS->Open(); if (!pLainaRS->IsEOF()) { SetValueRange(CGXRange(i, 1), pLainaRS->m_LA_Nr); SetValueRange(CGXRange(i, 2), pLainaRS->m_LA_LainanNimi); // --- lainan perustamispäivä ---- sprintf(buf, "%s", pLainaRS->m_LA_AlkupPv.Format("%d.%m.%Y")); SetValueRange(CGXRange(i, 3), buf); // // --- Eräpäivä --- sprintf(buf, "%s", pLainaRS->m_LA_EraPv.Format("%d.%m.%Y")); SetValueRange(CGXRange(i, 4), buf); // // --- Lainan tila --- SetValueRange(CGXRange(i, 5), pLainaRS->m_LA_Tila); if (pLainaRS->m_LA_Tila == "L") // lunastettu -> sininen { SetStyleRange(CGXRange(i, 1, i, 16), CGXStyle().SetInterior(RGB(128,255,255)) ); } else if (pLainaRS->m_LA_Tila == "A") // uudistettu -> vihreä ? { SetStyleRange(CGXRange(i, 1, i, 16), CGXStyle().SetInterior(RGB(64,255,192)) ); } else if (pLainaRS->m_LA_Tila == "H") // huutokaupassa -> orange ? { SetStyleRange(CGXRange(i, 1, i, 16), CGXStyle().SetInterior(RGB(255,128,128)) ); } else if (pLainaRS->m_LA_Tila == "M") // myyty huutokaupassa -> light gray ? { SetStyleRange(CGXRange(i, 1, i, 16), CGXStyle().SetInterior(RGB(192,192,192)) ); } stmp.Format("%7.2f", pLainaRS->m_LA_VakSumma); SetValueRange(CGXRange(i, 6), stmp); stmp.Format("%7.2f", pLainaRS->m_LA_Laina); SetValueRange(CGXRange(i, 7), stmp); // // --- Odotuspäivä --- if(!pLainaRS->IsFieldNull(&pLainaRS->m_LA_OdotusPv)) sprintf(buf, "%s", pLainaRS->m_LA_OdotusPv.Format("%d.%m.%Y")); else sprintf(buf, ""); SetValueRange(CGXRange(i, 8), buf); // --- Viite --- sprintf(buf, "%s", theApp.buildReferenceNumberFor(pLainaRS->m_LA_Nr)); SetValueRange(CGXRange(i, 9), buf); stmp.Format("%7.1f", pLainaRS->m_LA_Korko); SetValueRange(CGXRange(i, 10), stmp); SetValueRange(CGXRange(i, 11), pLainaRS->m_LA_Kielto); if (!pLainaRS->IsFieldNull(&pLainaRS->m_LA_KieltoRajaPv)) { SetStyleRange(CGXRange(i, 1, i, 17), CGXStyle().SetInterior(RGB(255,0,0)) // red ); } stmp.Format("%7.1f", pLainaRS->m_LA_SaVakMaksuPr); SetValueRange(CGXRange(i, 12), stmp); SetValueRange(CGXRange(i, 13), "0"); stmp.Format("%7.2f", pLainaRS->m_LA_YlimSaMaksu); SetValueRange(CGXRange(i, 14), stmp); SetValueRange(CGXRange(i, 15), pLainaRS->m_LA_Liitteet); SetValueRange(CGXRange(i, 16), pLainaRS->m_LA_Huom); SetValueRange(CGXRange(i, 17), pLainaRS->m_LA_Varasto); if (pLainaRS->m_LA_EraPv < CTime::GetCurrentTime() && !(pLainaRS->m_LA_Tila == "M" || pLainaRS->m_LA_Tila == "L")) { SetStyleRange(CGXRange(i, 4, i, 4), CGXStyle().SetInterior(RGB(250,141,69)) // rusk.punainen ); } SetRowHeight(i,i,30); // Rivikork } } catch (CDBException* e) { AfxMessageBox(e->m_strError); e->Delete(); } pLainaRS->Close(); //LockUpdate(bLock); Redraw(); // setGridReadOnly(TRUE); }
void CRGXMainWndGrid::SetColumnWidths() { BOOL bOldLock = LockUpdate(); SetColWidth(0,0,15); SetColWidth(1,1,40); // Lainan numero SetColWidth(2,2, 140);// nimi SetColWidth(3,3, 59);// päiväys SetColWidth(4,4, 59);// eräpäivä SetColWidth(5,5,15); // tila SetColWidth(6,6,59); // Vakuusarvo SetColWidth(7,7,59); // Lainan määrä SetColWidth(8,8,90); // OdotusPv SetColWidth(9,9,70); // Viite# SetColWidth(10,10,0); // Korko% SetColWidth(11,11,30); // Kielto SetColWidth(12,12,0); // SäilVakMaksu SetColWidth(13,13,0); // Kuittimaksu SetColWidth(14,14,0); // YlimSäilMaksu SetColWidth(15,15,30); // Liitteet SetColWidth(16,16,40); // Huom SetColWidth(17,17,0); // Varasto //SetColWidth(18,18,20); // SetRowHeight(1,13,30); // Rivikork SetStyleRange(CGXRange(0,1), CGXStyle().SetValue("Laina")); SetStyleRange(CGXRange(0,2), CGXStyle().SetValue("LaNimi")); SetStyleRange(CGXRange(0,3), CGXStyle().SetValue("AlkuPv")); SetStyleRange(CGXRange(0,4), CGXStyle().SetValue("EräPv")); SetStyleRange(CGXRange(0,5), CGXStyle().SetValue("Tila")); SetStyleRange(CGXRange(0,6), CGXStyle().SetValue("VakArvo")); SetStyleRange(CGXRange(0,7), CGXStyle().SetValue("Laina")); SetStyleRange(CGXRange(0,8), CGXStyle().SetValue("OdotusPv")); SetStyleRange(CGXRange(0,9), CGXStyle().SetValue("Viite#")); SetStyleRange(CGXRange(0,10), CGXStyle().SetValue("Korko%")); SetStyleRange(CGXRange(0,11), CGXStyle().SetValue("Kielto")); SetStyleRange(CGXRange(0,12), CGXStyle().SetValue("Säilytysmaksu")); SetStyleRange(CGXRange(0,13), CGXStyle().SetValue("Kuittimaksu")); SetStyleRange(CGXRange(0,14), CGXStyle().SetValue("YlimSäilytysmaksu")); SetStyleRange(CGXRange(0,15), CGXStyle().SetValue("Liitteet")); SetStyleRange(CGXRange(0,16), CGXStyle().SetValue("Huom")); SetStyleRange(CGXRange(0,17), CGXStyle().SetValue("Varasto")); //SetStyleRange(CGXRange(0,17), CGXStyle().SetValue("")); //SetStyleRange(CGXRange(0,18), CGXStyle().SetValue("")); //SetStyleRange(CGXRange(0,19), CGXStyle().SetValue("")); /* SetStyleRange(CGXRange().SetCols(8), CGXStyle() .SetControl(GX_IDS_CTRL_DATETIME) ); */ LockUpdate(bOldLock); }
BOOL CRGXMainWndGrid::OnLButtonClickedRowCol(ROWCOL nRow, ROWCOL nCol, UINT nFlags, CPoint pt) { CString msg = ""; //TRACE("OnLButtonClickedRowCol!\n"); /*GetParent()->SendMessage(WM_COMMAND, GetDlgCtrlID(), MAKELONG(m_hwnd, RJ_OG_PARENT_DLG)); */ //int vuosi,kk,pv = 0; CTime tNow((CTime::GetCurrentTime().GetYear()), (CTime::GetCurrentTime().GetMonth()), (CTime::GetCurrentTime().GetDay()), 0,0,0); //CTime tx(1990,1,1,0,0,0); if (m_nCol == 8) // EDELLISELLÄ kerralla kohdistin oli sarakkeessa 8 { //SetStyleRange(CGXRange(m_nRow,8), CGXStyle().SetValue(m_sOdPvmTxt)); msg.Format("OdotusPvm: Laina#:%ld, OdPv: %s", atol(GetValueRowCol(m_nRow,1)), GetValueRowCol(m_nRow,8)); TRACE("%s\n", msg); // if (!m_tXdateWasEmpty) // käyttäjä määritti jonkun odotuspäivän { if (theApp.GetDate(GetValueRowCol(m_nRow,8)) > tNow) { // --- odotuspv aset tulevaisuuteen ---- //TRACE("Talletus! (%ld,%ld) ", m_nRow, m_nCol); //TRACE("Laina#:%ld, OdPv: %s | ", atol(GetValueRowCol(m_nRow,1)), GetValueRowCol(m_nRow,8)); //TRACE("Odotuspäivä - %s\n", tx.Format("%d.%m.%Y")); msg.Format("OdotusPvmTalletus: Laina#:%ld, OdPv: %s", atol(GetValueRowCol(m_nRow,1)), theApp.GetDate(GetValueRowCol(m_nRow,8)).Format("%d.%m.%Y")); TRACE("%s ->", msg); TRACE("TALLETUS!\n"); theApp.m_pMC->m_pDB->saveLoanChangesInMainWnd(atol(GetValueRowCol(m_nRow,1)), theApp.GetDate(GetValueRowCol(m_nRow,8))); } else { msg.Format("OdotusPvmTalletus: Laina#:%ld, OdPv: %s Ei talletusta koska OdPvm on määrit. menneisyyteen!", atol(GetValueRowCol(m_nRow,1)), GetValueRowCol(m_nRow,8)); SetStyleRange(CGXRange(m_nRow,8), CGXStyle().SetValue(m_sOdPvmTxt)); // kopioidaan vanha pvm takaisin jos käyttäjä on kontrollilla sitä muuttanut TRACE("%s\n", msg); } //AfxMessageBox(msg); // AfxMessageBox ei toimi, jos käyttäjä aukaisee date-kontrollin auki hiirellä !!! } else { // Talletetaan tyhjä odotusPvm ko. lainalle TRACE("TALLETUS! Joka tap koska ei tiedetä onko ruutu ollut tyhjä vai käyttäjä tyhjännyt sen!\n"); if (GetValueRowCol(m_nRow,8).IsEmpty()) { theApp.m_pMC->m_pDB->saveLoanChangesInMainWnd(atol(GetValueRowCol(m_nRow,1)), NULL); } else { theApp.m_pMC->m_pDB->saveLoanChangesInMainWnd(atol(GetValueRowCol(m_nRow,1)), theApp.GetDate(GetValueRowCol(m_nRow,8))); } } } // // --- talteen edellisen rivin tiedot ------------- // Käyttäjä siirtynyt uudelle riville. Talletusta varten talletetaan aik. tiedot --- m_nRow = nRow; m_nCol = nCol; m_sOdPvmTxt = GetValueRowCol(nRow,8); m_tXdate = theApp.GetDate(GetValueRowCol(nRow,8)); if (GetValueRowCol(nRow,8).IsEmpty()) // OdPmv tyhjä tai käyttäjä tyhj. sen -> aina talletus (toistaiseksi) { m_tXdateWasEmpty = TRUE; } else { m_tXdateWasEmpty = FALSE; } //TRACE("Rivi=%ld, Sar=%ld\n", nRow, nCol); // // this->setDefaultFont(); if (nCol == 8) { this->setRowBoldFont(nRow); GetParent()->SendMessage(WM_COMMAND, //lisätty odotuspv viantakia 250504 GetDlgCtrlID() | RJ_OG_PARENT_DLG << 16, (LONG) GetSafeHwnd()); return TRUE; } if (nRow >= 1) { GetParent()->SendMessage(WM_COMMAND, GetDlgCtrlID() | RJ_OG_PARENT_DLG << 16, (LONG) GetSafeHwnd()); } return TRUE; }
void CRGXDeskLogRows::initGrid() { GetParam()->EnableUndo(FALSE); SetRowCount(50); SetColCount(16); // // esimerkiksi r2s2 asetetaan valintalistaksi ! //pLainarivit->SetStyleRange(CGXRange(2, 2), CGXStyle() // .SetControl(GX_IDS_CTRL_TEXTFIT) // .SetChoiceList(_T("one\ntwo\nthree\nfour\nfive\nsix\nseven\neight"))); SetStyleRange(CGXRange(0,1), CGXStyle().SetValue("KS_Tunnus")); SetStyleRange(CGXRange(0,2), CGXStyle().SetValue("Aika")); SetStyleRange(CGXRange(0,3), CGXStyle().SetValue("AM")); SetStyleRange(CGXRange(0,4), CGXStyle().SetValue("LainaNr")); SetStyleRange(CGXRange(0,5), CGXStyle().SetValue("Tapahtuma")); SetStyleRange(CGXRange(0,6), CGXStyle().SetValue("Selite")); SetStyleRange(CGXRange(0,7), CGXStyle().SetValue("Siirrot")); SetStyleRange(CGXRange(0,8), CGXStyle().SetValue("VanhaLaina")); SetStyleRange(CGXRange(0,9), CGXStyle().SetValue("UusiLaina")); SetStyleRange(CGXRange(0,10), CGXStyle().SetValue("Korot")); SetStyleRange(CGXRange(0,11), CGXStyle().SetValue("SHVMaksut")); SetStyleRange(CGXRange(0,12), CGXStyle().SetValue("Toimitusmaksut")); SetStyleRange(CGXRange(0,13), CGXStyle().SetValue("Pyöristys")); SetStyleRange(CGXRange(0,14), CGXStyle().SetValue("Maksettava")); SetStyleRange(CGXRange(0,15), CGXStyle().SetValue("Alijaama")); SetStyleRange(CGXRange(0,16), CGXStyle().SetValue("Ylijaama")); SetColWidth(0,0,0); // rivi# SetColWidth(1,1,17); // KS_Tunnus SetColWidth(2,2,100); // Aika SetColWidth(3,3,17); // AM SetColWidth(4,4,40); // LainaNr SetColWidth(5,5,25); // Tapahtuma SetColWidth(6,6,130); // Selite SetColWidth(7,7,60); // Summa SetColWidth(8,8,60); // VanhaLaina SetColWidth(9,9,60); // UusiLaina SetColWidth(10,10,50); // Korot SetColWidth(11,11,50); // SHVMaksut SetColWidth(12,12,50); // Toimitusmaksut SetColWidth(13,13,50); // Pyöristys SetColWidth(14,14,50); // Maksettava SetColWidth(15,15,50); // Alijaama SetColWidth(16,16,50); // Ylijaama SetStyleRange(CGXRange().SetCols(14), CGXStyle().SetInterior(RGB(255,255,192))); this->GetParam()->EnableSelection(FALSE); SetReadOnly(TRUE); GetParam()->EnableUndo(TRUE); SetFocus(); }
void CRGXDeskLogRows::fillGrid(CTime date, long desk) { long rowcount = 0; SetRowCount(rowcount); clear(); CString s; s.Format("%s", date.Format("%d.%m.%Y@%H:%M.%S")); TRACE("%s\n", s); CTime tx(1990,1,1,0,0,0); // alkuarvo vuonna miekka ja kypärä -> listalle tulee siis kaikki kassalokitap. //CTime tx(2001,9,8,16,45,0); CTimeSpan t1days(1,0,0,0); CTime ty(1990,1,1,0,0,0); ty = date + t1days; // loppuaika on 1 vrk suurempi kuin annettu päivämäärä if (desk == -1) { m_pKLRS->m_strFilter.Format(""); } else { m_pKLRS->m_strFilter.Format("KL_KS_Tunnus = %ld", desk); } if (date != NULL) { tx = date; } s.Format("%s", tx.Format("%d.%m.%Y@%H:%M.%S")); TRACE("%s\n", s); SetReadOnly(FALSE); try { //TRACE("Tapahtumalogi: '%s'\n", m_pKLRS->m_strFilter); m_pKLRS->m_strSort = "KL_Aika desc"; // desc / asc m_pKLRS->Open(); while(!m_pKLRS->IsEOF()) { if (m_pKLRS->m_KL_Aika < tx || m_pKLRS->m_KL_Aika > ty) { m_pKLRS->MoveNext(); continue; } rowcount++; SetRowCount(rowcount); // // --- kassa --- s.Format("%ld", m_pKLRS->m_KL_KS_Tunnus); SetValueRange(CGXRange(rowcount, 1), s); // // --- TapAika --- s = "-"; if (!m_pKLRS->IsFieldNull(&m_pKLRS->m_KL_Aika)) { s.Format("%s", m_pKLRS->m_KL_Aika.Format("%d.%m.%Y@%H:%M.%S")); } SetValueRange(CGXRange(rowcount, 2), s); // // --- arviomiehen tunnus --- SetValueRange(CGXRange(rowcount, 3), m_pKLRS->m_KL_AM_Nimikirjaimet); // // --- lainan # jos ei sitten tyhjä --- s = "-"; if (!m_pKLRS->IsFieldNull(&m_pKLRS->m_KL_LainaNr)) { s.Format("%ld", m_pKLRS->m_KL_LainaNr); } SetValueRange(CGXRange(rowcount, 4), s); // // --- tapahtuman tyyppi --- SetValueRange(CGXRange(rowcount, 5), m_pKLRS->m_KL_TapahtumanTyyppi); // // --- selite ---- SetValueRange(CGXRange(rowcount, 6), m_pKLRS->m_KL_Selite); // // --- lainan summa --- s = "-"; if (!m_pKLRS->IsFieldNull(&m_pKLRS->m_KL_Summa)) { s.Format("%7.2f", m_pKLRS->m_KL_Summa); } SetValueRange(CGXRange(rowcount, 7), s); // // --- vanha lainasumma --- s = "-"; if (!m_pKLRS->IsFieldNull(&m_pKLRS->m_KL_VanhaLaina)) { s.Format("%7.2f", m_pKLRS->m_KL_VanhaLaina); } SetValueRange(CGXRange(rowcount, 8), s); // // --- uusi lainasumma --- s = "-"; if (!m_pKLRS->IsFieldNull(&m_pKLRS->m_KL_UusiLaina)) { s.Format("%7.2f", m_pKLRS->m_KL_UusiLaina); } SetValueRange(CGXRange(rowcount, 9), s); // // --- väri -- if (m_pKLRS->m_KL_TapahtumanTyyppi == "U") { SetStyleRange(CGXRange(rowcount, 1, rowcount, 16), CGXStyle().SetInterior(RGB(152,234,128)) ); } if (m_pKLRS->m_KL_TapahtumanTyyppi == "L") { SetStyleRange(CGXRange(rowcount, 1, rowcount, 16), CGXStyle().SetInterior(RGB(139,222,205)) // vaalean sininen ); } if (m_pKLRS->m_KL_TapahtumanTyyppi == "D") { SetStyleRange(CGXRange(rowcount, 8, rowcount, 9), CGXStyle().SetInterior(RGB(255,255,192)) ); } if (m_pKLRS->m_KL_TapahtumanTyyppi == "H" || m_pKLRS->m_KL_TapahtumanTyyppi == "C" || m_pKLRS->m_KL_TapahtumanTyyppi == "E" || m_pKLRS->m_KL_TapahtumanTyyppi == "E" || m_pKLRS->m_KL_TapahtumanTyyppi == "W") { SetStyleRange(CGXRange(rowcount, 1, rowcount, 16), CGXStyle().SetInterior(RGB(255,200,255)) // violetti/pun ); } // // --- korot --- s = "-"; if (!m_pKLRS->IsFieldNull(&m_pKLRS->m_KL_Korot)) { s.Format("%7.2f", m_pKLRS->m_KL_Korot); } SetValueRange(CGXRange(rowcount, 10), s); // // --- shv-maksut --- s = "-"; if (!m_pKLRS->IsFieldNull(&m_pKLRS->m_KL_SHVMaksut)) { s.Format("%7.2f", m_pKLRS->m_KL_SHVMaksut); } SetValueRange(CGXRange(rowcount, 11), s); // // --- toimitus-maksut --- s = "-"; if (!m_pKLRS->IsFieldNull(&m_pKLRS->m_KL_Toimitusmaksut)) { s.Format("%7.2f", m_pKLRS->m_KL_Toimitusmaksut); } SetValueRange(CGXRange(rowcount, 12), s); // // --- pyöristys --- s = "-"; if (!m_pKLRS->IsFieldNull(&m_pKLRS->m_KL_Pyoristys)) { s.Format("%7.2f", m_pKLRS->m_KL_Pyoristys); } SetValueRange(CGXRange(rowcount, 13), s); // // --- maksettava --- s = "-"; if (!m_pKLRS->IsFieldNull(&m_pKLRS->m_KL_Maksettava)) { s.Format("%7.2f", m_pKLRS->m_KL_Maksettava); } SetValueRange(CGXRange(rowcount, 14), s); // // --- Alijäämä --- s = "-"; if (!m_pKLRS->IsFieldNull(&m_pKLRS->m_KL_Alijaama)) { s.Format("%7.2f", m_pKLRS->m_KL_Alijaama); } SetValueRange(CGXRange(rowcount, 15), s); // // --- Ylijäämä --- s = "-"; if (!m_pKLRS->IsFieldNull(&m_pKLRS->m_KL_Ylijaama)) { s.Format("%7.2f", m_pKLRS->m_KL_Ylijaama); } SetValueRange(CGXRange(rowcount, 16), s); m_pKLRS->MoveNext(); } m_pKLRS->Close(); } catch (CDBException* e) { AfxMessageBox(e->m_strError); e->Delete(); m_pKLRS->Close(); } SetReadOnly(TRUE); }
///////////////////////////////////////////////////////////////////////////// // Crate the window and all child windows. ///////////////////////////////////////////////////////////////////////////// void CParseAddressBrowse::Initialize() { assert(theApp.refQueryFile != 0); // First line firstLineLabel.Create("First Line:", WS_VISIBLE | WS_CHILD, CRect(0,0,0,0), this); firstLineEdit.Create(WS_VISIBLE | WS_CHILD| WS_BORDER, CRect(0,0,0,0), this, FirstLineEditID); // Last line lastLineLabel.Create("Last Line:", WS_VISIBLE | WS_CHILD, CRect(0,0,0,0), this); lastLineEdit.Create(WS_VISIBLE | WS_CHILD| WS_BORDER, CRect(0,0,0,0), this, LastLineEditID); // Parse Button parseButton.Create("Parse", WS_VISIBLE | WS_CHILD| WS_BORDER, CRect(0,0,0,0), this, ParseButtonID); // first line parse grid firstLineParseGrid.Create( WS_VISIBLE | WS_CHILD | WS_VSCROLL | WS_HSCROLL | WS_BORDER, CRect(0, 0, 400, 100), this, 10 ); firstLineParseGrid.Initialize(); firstLineParseGrid.SetColCount(NbrColumns); // Column headings firstLineParseGrid.SetStyleRange( CGXRange(0, NbrColumn), CGXStyle().SetValue("Nbr") ); firstLineParseGrid.SetStyleRange( CGXRange(0, PredirColumn), CGXStyle().SetValue("Predir") ); firstLineParseGrid.SetStyleRange( CGXRange(0, PrefixColumn), CGXStyle().SetValue("Prefix") ); firstLineParseGrid.SetStyleRange( CGXRange(0, StreetColumn), CGXStyle().SetValue("Street") ); firstLineParseGrid.SetStyleRange( CGXRange(0, SuffixColumn), CGXStyle().SetValue("Suffix") ); firstLineParseGrid.SetStyleRange( CGXRange(0, PostdirColumn), CGXStyle().SetValue("Postdir") ); firstLineParseGrid.SetStyleRange( CGXRange(0, UnitDesColumn), CGXStyle().SetValue("UnitDes") ); firstLineParseGrid.SetStyleRange( CGXRange(0, UnitColumn), CGXStyle().SetValue("Unit") ); firstLineParseGrid.SetStyleRange( CGXRange(0, IntersectColumn), CGXStyle().SetValue("Intersect?") ); firstLineParseGrid.SetStyleRange( CGXRange(0, Street2Column), CGXStyle().SetValue("Street2") ); firstLineParseGrid.SetStyleRange( CGXRange(0, ModsColumn), CGXStyle().SetValue("Mods") ); firstLineParseGridLabel.Create("First Line Parse Candidates", WS_VISIBLE | WS_CHILD, CRect(0,0,0,0), this); // last line parse grid lastLineParseGrid.Create( WS_VISIBLE | WS_CHILD | WS_VSCROLL | WS_HSCROLL | WS_BORDER, CRect(0, 0, 400, 100), this, 10 ); lastLineParseGrid.Initialize(); lastLineParseGrid.SetColCount(5); // Column headings lastLineParseGrid.SetStyleRange( CGXRange(0, 1), CGXStyle().SetValue("City") ); lastLineParseGrid.SetStyleRange( CGXRange(0, 2), CGXStyle().SetValue("State") ); lastLineParseGrid.SetStyleRange( CGXRange(0, 3), CGXStyle().SetValue("Postcode") ); lastLineParseGrid.SetStyleRange( CGXRange(0, 4), CGXStyle().SetValue("Pcode Ext") ); lastLineParseGrid.SetStyleRange( CGXRange(0, 5), CGXStyle().SetValue("Mods") ); lastLineParseGridLabel.Create("Last Line Parse Candidates", WS_VISIBLE | WS_CHILD, CRect(0,0,0,0), this); initialized = true; // Cause initial placement to happen CRect rect; GetClientRect(rect); HandleSize(rect.right, rect.bottom); }
void CParseAddressBrowse::UpdateViews() { if (!initialized) { return; } // Clear results firstLineParseGrid.SetRowCount(0); lastLineParseGrid.SetRowCount(0); CString firstLineStr; firstLineEdit.GetWindowText(firstLineStr); // Parse first line AddressParserFirstLine::ParseCandidate firstLineParseCandidate; bool ok = firstLineParser->Parse((const char*)firstLineStr, firstLineParseCandidate, true); firstLineParser->PermuteAddress(~0); for (; ok; ok = firstLineParser->NextAddressPermutation(firstLineParseCandidate, true)) { // Set parse results to row firstLineParseGrid.SetRowCount(firstLineParseGrid.GetRowCount() + 1); int row = firstLineParseGrid.GetRowCount(); firstLineParseGrid.SetStyleRange( CGXRange(row, NbrColumn), CGXStyle().SetValue(firstLineParseCandidate.number) ); firstLineParseGrid.SetStyleRange( CGXRange(row, PredirColumn), CGXStyle().SetValue(firstLineParseCandidate.predir) ); firstLineParseGrid.SetStyleRange( CGXRange(row, PrefixColumn), CGXStyle().SetValue(firstLineParseCandidate.prefix) ); firstLineParseGrid.SetStyleRange( CGXRange(row, StreetColumn), CGXStyle().SetValue(firstLineParseCandidate.street) ); firstLineParseGrid.SetStyleRange( CGXRange(row, SuffixColumn), CGXStyle().SetValue(firstLineParseCandidate.suffix) ); firstLineParseGrid.SetStyleRange( CGXRange(row, PostdirColumn), CGXStyle().SetValue(firstLineParseCandidate.postdir) ); firstLineParseGrid.SetStyleRange( CGXRange(row, UnitDesColumn), CGXStyle().SetValue(firstLineParseCandidate.unitDesignator) ); firstLineParseGrid.SetStyleRange( CGXRange(row, UnitColumn), CGXStyle().SetValue(firstLineParseCandidate.unitNumber) ); firstLineParseGrid.SetStyleRange( CGXRange(row, IntersectColumn), CGXStyle().SetValue(firstLineParseCandidate.isIntersection ? "Yes" : "No") ); firstLineParseGrid.SetStyleRange( CGXRange(row, Street2Column), CGXStyle().SetValue(firstLineParseCandidate.street2) ); char buf[20]; sprintf(buf, "%d", firstLineParseCandidate.numberOfMods); firstLineParseGrid.SetStyleRange( CGXRange(row, ModsColumn), CGXStyle().SetValue(buf) ); } CString lastLineStr; lastLineEdit.GetWindowText(lastLineStr); // Parse last line AddressParserLastLine::ParseCandidate lastLineParseCandidate; ok = lastLineParser->Parse((const char*)lastLineStr, lastLineParseCandidate, true); lastLineParser->PermuteAddress(~0); for (;ok; ok = lastLineParser->NextAddressPermutation(lastLineParseCandidate, true)) { // Set parse results to row lastLineParseGrid.SetRowCount(lastLineParseGrid.GetRowCount() + 1); int row = lastLineParseGrid.GetRowCount(); lastLineParseGrid.SetStyleRange( CGXRange(row, 1), CGXStyle().SetValue(lastLineParseCandidate.city) ); lastLineParseGrid.SetStyleRange( CGXRange(row, 2), CGXStyle().SetValue(lastLineParseCandidate.state) ); lastLineParseGrid.SetStyleRange( CGXRange(row, 3), CGXStyle().SetValue(lastLineParseCandidate.postcode) ); lastLineParseGrid.SetStyleRange( CGXRange(row, 4), CGXStyle().SetValue(lastLineParseCandidate.postcodeExt) ); char buf[20]; sprintf(buf, "%d", lastLineParseCandidate.numberOfMods); lastLineParseGrid.SetStyleRange( CGXRange(row, 5), CGXStyle().SetValue(buf) ); } }