void CXTPReportGroupRow::UpdateSelectedChilds()
{
	for (int II = 0; II < m_pSection->m_pTree->GetCount(); II++)
	{
		CXTPReportRow* pTRow = m_pSection->m_pTree->GetAt(II);
		if (pTRow)
		{
			if (pTRow->IsGroupRow())
			{
				CXTPReportGroupRow* pTgRow = (CXTPReportGroupRow*) pTRow;
				if (pTgRow->GetChilds(FALSE) && pTgRow->IsExpanded())
				{
					for (int J = 0; J < pTgRow->GetChilds()->GetCount(); J++)
					{
						CXTPReportRow* pChRow = pTgRow->GetChilds(FALSE)->GetAt(J);
						if (pChRow)
						{
							CXTPReportRecord* pChRec = pChRow->GetRecord();
							if (pChRec)
							{
								CXTPReportRow* ptRow = m_pSection->m_pTree->FindInTree(pChRec);
								if (ptRow && !ptRow->IsGroupRow())
									ptRow->SetSelected(pChRec->IsSelected());
							}
						}
					}
				}
			}
		}
	}
}
Пример #2
0
CXTPReportRecord* CReportCtrl::TransferAddRecord(void)
{
	ASSERT (m_pAddOpRecord != NULL);

	CXTPReportRecord *pRec = new CXTPReportRecord();
	for (int i=0; i<m_nColCount; ++i)
	{
		const ColInfo &col = m_cols[i];
		if (col.fmt != FmtIdOnly)
		{
			CXTPReportRecordItem *pItem = new CXTPReportRecordItem();
			if (!col.check)
			{
				pItem->SetCaption(m_pAddOpRecord->GetItem(i)->GetCaption(NULL));
			}
			else
			{
				pItem->SetEditable(col.editable);
				pItem->HasCheckbox(col.check); 
				pItem->SetChecked(m_pAddOpRecord->GetItem(i)->IsChecked());
			}
			pRec->AddItem(pItem);
		}
	}

	PutRecordAux(pRec);

	GetRecords()->InsertAt(m_pAddOpRecord->GetIndex(),pRec);
	ClearAddRecord();
	
	Populate();

	return pRec;
 
}
Пример #3
0
void CSimpleReport::ColReplace(int r, int c, double n)
{
	CXTPReportRecord* pRec = GetRecords()->GetAt(r);
	if (!pRec)
		return;

	CXTPReportRecordItemNumber* p = (CXTPReportRecordItemNumber*)pRec->GetItem(c);
	if (p) 
		p->SetValue(n);
}
Пример #4
0
void CSimpleReport::ColSetBold(int r, int c, BOOL x)
{
	CXTPReportRecord* pRec = GetRecords()->GetAt(r);
	if (!pRec)
		return;

	CXTPReportRecordItem* p = pRec->GetItem(c);
	if (p)
		p->SetBold(x);
}
Пример #5
0
void CMedic::RefreshReport( CMedicSet *pMedicSet )
{
	CMainFrame *p = (CMainFrame *)AfxGetMainWnd();
	CXTPReportControl *pReport = p->m_wndReportCtrl;
	CXTPReportRecords *pRecords = pReport->GetRecords();
	pRecords->RemoveAll();

	CXTPReportRecord *pRecord;
	CXTPReportRecordItem *pItem;
	CString strPrice;
	while(!pMedicSet->IsEOF())
	{
		pRecord = new CXTPReportRecord();
		pRecord->AddItem(new CXTPReportRecordItemText(pMedicSet->m_MedicID));
		pRecord->AddItem(new CXTPReportRecordItemText(pMedicSet->m_MedicName));
		pRecord->AddItem(new CXTPReportRecordItemText(pMedicSet->m_MedicType));
		CTime ProduceData = pMedicSet->m_ProduceDate;
		pRecord->AddItem(new CXTPReportRecordItemText(ProduceData.Format(_T("%Y-%m-%d"))));
		if (0 == pMedicSet->m_MedicNumber)
		{
			pItem = pRecord->AddItem(new CXTPReportRecordItemNumber(pMedicSet->m_MedicNumber));
			pItem->SetBackgroundColor(RGB(255,0,0));
		}
		else
			pRecord->AddItem(new CXTPReportRecordItemNumber(pMedicSet->m_MedicNumber));
		strPrice.Format("%.2f",pMedicSet->m_MedicPrice);
		pRecord->AddItem(new CXTPReportRecordItemText(strPrice));
		pRecord->AddItem(new CXTPReportRecordItemNumber(pMedicSet->m_GuarantPeriod));
		pRecord->AddItem(new CXTPReportRecordItemText(pMedicSet->m_ProduceCompany));
		pReport->AddRecord(pRecord);
		pMedicSet->MoveNext();
	}
	pReport->Populate();
	
}
Пример #6
0
void CSimpleReport::ColReplace(int r, int c, const char* s)
{
	CXTPReportRecord* pRec = GetRecords()->GetAt(r);
	if (!pRec)
		return;

	CXTPReportRecordItem* p = pRec->GetItem(c);
	if (p)
		p->SetCaption(s);

}
Пример #7
0
void CSimpleReport::ColSetColor(int r, int c, COLORREF fore, COLORREF back)
{
	CXTPReportRecord* pRec = GetRecords()->GetAt(r);
	if (!pRec)
		return;

	CXTPReportRecordItem* p = pRec->GetItem(c);
	if (p) {
		p->SetBackgroundColor(back);
		p->SetTextColor(fore);
	}
}
void CXTPReportRecordItemIcon::OnEditChanged(XTP_REPORTRECORDITEM_ARGS* pItemArgs, LPCTSTR szText)
{
	if (pItemArgs == NULL)
		return;

	CXTPReportRecordItem::OnEditChanged(pItemArgs, szText);

	int r = pItemArgs->pRow->GetIndex();
	int i = pItemArgs->pItem->GetIndex();
	CXTPReportRecord* pRec = pItemArgs->pRow->GetRecord();
	if (pRec)
	{
		pRec->UpdateRecordField(r, i, szText);
	}
}
void CXTPReportGroupRow::UpdateSelectedMostDeepChilds()
{
	for (int nRow=0; nRow<m_pSection->GetRows()->GetCount(); nRow++)
	{
		CXTPReportRow *pRow = m_pSection->GetRows()->GetAt(nRow);

		if (pRow->GetChilds(FALSE))
			continue;

		CXTPReportRecord *pRecord = pRow->GetRecord();
		if (pRecord)
		{
			pRow->SetSelected(pRecord->IsSelected());
		}
	}
}
Пример #10
0
void CReportCtrl::FillRecordset(_RecordsetPtr &rst,FillRecordAux funcAux)
{ 
	if (rst != NULL)
		while (!rst->adoEOF)
		{
			FieldsPtr fields = rst->Fields;
			CXTPReportRecord *pRec = new CXTPReportRecord();
			for (int i=0; i<m_nColCount; ++i)
			{
				if (m_cols[i].fmt ==FmtIdOnly)
					pRec->SetBookmark(fields->Item[m_cols[i].field]->Value);
				else
					pRec->AddItem(RecordItemFromCol(m_cols[i],fields->Item[m_cols[i].field]->Value));

			}

			PutRecordAux(pRec);
			if (funcAux != NULL)
				funcAux(fields,pRec);

			AddRecord(pRec);
			rst->MoveNext();
		}

	if (m_nOpFlag & OpAdd)
	{
		m_pAddOpRecord = new CXTPReportRecord();
		for (int i=0; i<m_nColCount; ++i)
		{
			const ColInfo &col= m_cols[i];
			
			if (m_cols[i].fmt != FmtIdOnly)
			{
				CXTPReportRecordItem *pItem = new CXTPReportRecordItem();
				pItem->HasCheckbox(col.check);
				m_pAddOpRecord->AddItem(pItem); 
			}
		}

		PutAddRecordAux();
		AddRecord(m_pAddOpRecord);
	}

	Populate();
}
BOOL CXTPReportGroupRow::CalculateByChilds(CXTPReportRow* pPassedRow, int col_start, int col_end, double& dPassedValue)
{
	BOOL bRet = FALSE;

	CXTPReportRow* pRow = NULL;
	CXTPReportRecord* pRec = NULL;
	CXTPReportRecordItem* pItem = NULL;

	for (int row = 0; row < pPassedRow->GetChilds(FALSE)->GetCount(); row++)
	{
		pRow = pPassedRow->GetChilds(FALSE)->GetAt(row);
		if (pRow && !pRow->IsGroupRow())
		{
			pRec = pRow->GetRecord();
			if (pRec)
			{
				bRet = TRUE;
				for (int col = col_start; col < col_end; col++)
				{
					if (col < pRec->GetItemCount())
					{
						pItem = pRec->GetItem(col);
						if (pItem)
						{
							CString s = pItem->GetCaption(NULL);
							dPassedValue += pItem->StringToDouble(s);
						}
					}
				}
			}
		}
		else if (pRow && pRow->IsGroupRow())
		{
			bRet = CalculateByChilds(pRow, col_start, col_end, dPassedValue);
		}
	}
	return bRet;
}
Пример #12
0
HRESULT CXTPReportDataManager::UpdateField(CXTPReportRecordItemVariant* pItem)
{
    BOOL bOk = FALSE;
    HRESULT hr = E_FAIL;

    m_bLocalUpdate = TRUE;

    try
    {
        while (TRUE)
        {
            if (!pItem)
                break;
            CXTPReportRecord* pRecord = pItem->GetRecord();
            if (!pRecord)
                break;
            // get data source record bookmark
            VARIANT vtBookmark = pRecord->GetBookmark();
            if (vtBookmark.vt == VT_EMPTY)
                break;
            // move to specified record
            if (FAILED(hr = m_pDataSource->put_Bookmark(vtBookmark)))
                break;
            // update item
            XTPREPORTADODB::FieldsPtr pFields;
            if (FAILED(hr = m_pDataSource->get_Fields(&pFields)) || pFields == NULL)
                break;
            long lFields;
            if (FAILED(hr = pFields->get_Count(&lFields)) || lFields == 0 || pItem->GetIndex() >= lFields)
                break;
            VARIANT vtIdx;
            vtIdx.vt = VT_I4;
            vtIdx.lVal = pItem->GetIndex();
            XTPREPORTADODB::FieldPtr pField;
            if (FAILED(hr = pFields->get_Item(vtIdx, &pField)) || pField == NULL)
                break;
            long lAttrs;
            if (FAILED(hr = pField->get_Attributes(&lAttrs)))
                break;
            if (!(lAttrs & (XTPREPORTADODB::adFldUpdatable | XTPREPORTADODB::adFldUnknownUpdatable)))
                break;
            XTPREPORTADODB::DataTypeEnum dteType;
            if (FAILED(hr = pField->get_Type(&dteType)))
                break;
            if (dteType == XTPREPORTADODB::adLongVarBinary)
                break;
            VARIANT vtValue = pItem->GetValue();
            if (FAILED(hr = pField->put_Value(vtValue)))
                break;
            if (FAILED(hr = m_pDataSource->Update()))
            {
                m_pDataSource->CancelUpdate();
                break;
            }
            bOk = TRUE;
            break;
        }

    }
    catch(_com_error &e)
    {
        TRACE_ProviderError(m_pConnection);
        TRACE_ComError(e);
        hr = FAILED(hr) ? hr : E_FAIL;
    }
    catch(...)
    {
        TRACE(_T("Unknown error in UpdateField()\n"));
        hr = FAILED(hr) ? hr : E_FAIL;
    }

    m_bLocalUpdate = FALSE;

    return FAILED(hr) ? hr : bOk ? S_OK : E_FAIL;
}
Пример #13
0
HRESULT CXTPReportDataManager::AddReportRecords(XTPREPORTADODB::_RecordsetPtr pRecordset, BOOL bAddNow)
{
    HRESULT hr = E_FAIL;

    try
    {
        if (pRecordset == NULL)
            return E_FAIL;
        XTPREPORTADODB::FieldsPtr pFields;
        if (FAILED(hr = pRecordset->get_Fields(&pFields)) || pFields == NULL)
            return hr;
        long lFields;
        if (FAILED(hr = pFields->get_Count(&lFields)) || lFields == 0)
            return hr;

        long lRecords;
        if (FAILED(hr = pRecordset->get_RecordCount(&lRecords)))
            return hr;
        if (lRecords <= 0)
            return E_FAIL;
        pRecordset->MoveFirst();
        VARIANT_BOOL vtRecordsEof;
        pRecordset->get_bEOF(&vtRecordsEof);
        while (!vtRecordsEof)
        {

            // create record
            CXTPReportRecord* pRecord = new CXTPReportRecord;
            if (!pRecord)
                break;
            // get field values
            VARIANT vtIdx;
            vtIdx.vt = VT_I4;
            for (int i = 0; i < lFields; i++)
            {
                vtIdx.lVal = i;
                XTPREPORTADODB::FieldPtr pField;
                if (FAILED(hr = pFields->get_Item(vtIdx, &pField)) || pField == NULL)
                    break;
                VARIANT vtValue;
                if (FAILED(hr = pField->get_Value(&vtValue)))
                    break;
                CXTPReportRecordItemVariant* pItem = new CXTPReportRecordItemVariant(vtValue);
                if (!pItem)
                    break;
                pRecord->AddItem(pItem);
            }
            // bind report record to data source record by bookmark
            VARIANT vtBookmark;
            if (FAILED(hr = pRecordset->get_Bookmark(&vtBookmark)))
                break;
            pRecord->SetBookmark(vtBookmark);
            // add record to report records collection
            if (bAddNow)
                m_pReportControl->AddRecordEx(pRecord);
            else
                m_pReportControl->AddRecord(pRecord);
            if (FAILED(hr))
                break;
            pRecordset->MoveNext();
            pRecordset->get_bEOF(&vtRecordsEof);
        }
    }
    catch(_com_error &e)
    {
        TRACE_ProviderError(m_pConnection);
        TRACE_ComError(e);
        hr = FAILED(hr) ? hr : E_FAIL;
    }
    catch(...)
    {
        TRACE(_T("Unknown error in AddReportRecords()\n"));
        hr = FAILED(hr) ? hr : E_FAIL;
    }

    return FAILED(hr) ? hr : S_OK;
}
Пример #14
0
HRESULT CXTPReportDataManager::UpdateReportRecords(XTPREPORTADODB::_RecordsetPtr pRecordset)
{
    HRESULT hr = E_FAIL;

    try
    {

        CXTPReportRecords* pRecords = m_pReportControl->GetRecords();
        if (!(pRecordset != NULL && pRecords))
            return E_FAIL;
        XTPREPORTADODB::FieldsPtr pFields;
        if (FAILED(hr = pRecordset->get_Fields(&pFields)) || pFields == NULL)
            return hr;
        long lFields;
        if (FAILED(hr = pFields->get_Count(&lFields)) || lFields == 0)
            return hr;
        long lRecords;
        if (FAILED(hr = pRecordset->get_RecordCount(&lRecords)))
            return hr;
        if (lRecords <= 0)
            return E_FAIL;
        pRecordset->MoveFirst();
        VARIANT_BOOL vtRecordsEof;
        pRecordset->get_bEOF(&vtRecordsEof);
        while (!vtRecordsEof)
        {
            // get record bookmark
            VARIANT vtBookmark;
            if (FAILED(hr = pRecordset->get_Bookmark(&vtBookmark)))
                break;
            CXTPReportRecord* pRecord = pRecords->FindRecordByBookmark(vtBookmark, TRUE);
            if (pRecord)
            {
                // get field values
                VARIANT vtIdx;
                vtIdx.vt = VT_I4;
                for (int i = 0; i < lFields; i++)
                {
                    vtIdx.lVal = i;
                    XTPREPORTADODB::FieldPtr pField;
                    if (FAILED(hr = pFields->get_Item(vtIdx, &pField)) || pField == NULL)
                        break;
                    VARIANT vtValue;
                    if (FAILED(hr = pField->get_Value(&vtValue)))
                        break;
                    CXTPReportRecordItemVariant* pItem = (CXTPReportRecordItemVariant*)pRecord->GetItem(i);
                    if (!pItem)
                        break;
                    pItem->SetValue(COleVariant(vtValue));
                }
                m_pReportControl->UpdateRecord(pRecord, TRUE);
            }
            pRecordset->MoveNext();
            pRecordset->get_bEOF(&vtRecordsEof);
        }
    }
    catch(_com_error &e)
    {
        TRACE_ProviderError(m_pConnection);
        TRACE_ComError(e);
        hr = FAILED(hr) ? hr : E_FAIL;
    }
    catch(...)
    {
        TRACE(_T("Unknown error in UpdateReportRecords()\n"));
        hr = FAILED(hr) ? hr : E_FAIL;
    }

    return FAILED(hr) ? hr : S_OK;
}
Пример #15
0
HRESULT CXTPReportDataManager::CreateEmptyRecord(CXTPReportRecord** ppRecord)
{
    BOOL bOk = FALSE;
    HRESULT hr = E_FAIL;
    CXTPReportRecord* pRecord = NULL;

    try
    {
        while (TRUE)
        {
            if (m_pDataSource == NULL || !ppRecord)
                break;
            // create empty record
            pRecord = new CXTPReportRecord;
            if (!pRecord)
                break;
            XTPREPORTADODB::FieldsPtr pFields;
            if (FAILED(hr = m_pDataSource->get_Fields(&pFields)) || pFields == NULL)
                break;
            long lFields;
            if (FAILED(hr = pFields->get_Count(&lFields)) || lFields == 0)
                break;
            long lRecords;
            if (FAILED(hr = m_pDataSource->get_RecordCount(&lRecords)))
                break;
            if (lRecords > 0)
            {
                m_pDataSource->MoveFirst();
                VARIANT_BOOL vtRecordsEof;
                if (FAILED(hr = m_pDataSource->get_bEOF(&vtRecordsEof)))
                    break;
                if (vtRecordsEof)
                    break;
            }
            VARIANT vtIdx;
            vtIdx.vt = VT_I4;
            int i;
            for (i = 0; i < lFields; i++)
            {
                vtIdx.lVal = i;
                XTPREPORTADODB::FieldPtr pField;
                if (FAILED(hr = pFields->get_Item(vtIdx, &pField)) || pField == NULL)
                    break;

                VARIANT vtValue;
                if (lRecords == 0)
                {
                    XTPREPORTADODB::DataTypeEnum dt;
                    if (FAILED(hr = pField->get_Type(&dt)))
                        break;

                    if (dt == XTPREPORTADODB::adInteger || dt == XTPREPORTADODB::adTinyInt || dt == XTPREPORTADODB::adSmallInt || dt == XTPREPORTADODB::adBigInt ||
                            dt == XTPREPORTADODB::adUnsignedTinyInt || dt == XTPREPORTADODB::adUnsignedSmallInt || dt == XTPREPORTADODB::adUnsignedInt || dt == XTPREPORTADODB::adUnsignedBigInt)
                        vtValue.vt = VT_I4;
                    else if (dt == XTPREPORTADODB::adBoolean)
                        vtValue.vt = VT_BOOL;
                    else if (dt == XTPREPORTADODB::adDate)
                        vtValue.vt = VT_DATE;
                    else if (dt == XTPREPORTADODB::adDouble)
                        vtValue.vt = VT_R8;
                    else if (dt == XTPREPORTADODB::adSingle)
                        vtValue.vt = VT_R4;
                    else if (dt == XTPREPORTADODB::adCurrency)
                        vtValue.vt = VT_CY;
                    else
                        vtValue.vt = VT_BSTR;
                }
                else
                {
                    if (FAILED(hr = pField->get_Value(&vtValue)))
                        break;
                }

                vtValue.lVal = 0;
                CXTPReportRecordItemVariant* pItem = new CXTPReportRecordItemVariant(vtValue);
                if (!pItem)
                    break;
                pRecord->AddItem(pItem);
            }
            if (FAILED(hr) || i < lFields)
                break;
            *ppRecord = pRecord;
            bOk = TRUE;
            break;
        }

    }
    catch(_com_error &e)
    {
        if (pRecord)
            delete pRecord;
        TRACE_ProviderError(m_pConnection);
        TRACE_ComError(e);
        hr = FAILED(hr) ? hr : E_FAIL;
    }
    catch(...)
    {
        if (pRecord)
            delete pRecord;
        TRACE(_T("Unknown error in CreateEmptyRecord()\n"));
        hr = FAILED(hr) ? hr : E_FAIL;
    }

    if (!bOk && pRecord)
        delete pRecord;

    return FAILED(hr) ? hr : bOk ? S_OK : E_FAIL;
}
Пример #16
0
void CInteractionStructureView::RefreshList(bool bForceRefresh) {
	CEditorDoc *pDoc = (CEditorDoc *) GetDocument();
	ASSERT(pDoc != NULL);
	if (pDoc == NULL) {
		return;
	}
	CInteractionStream *pInteractionStream = pDoc->project.GetInteractionStream();
	if (!pInteractionStream) {
		GetReportCtrl().ResetContent();
		return;
	}
	UpdateTimelineVisibleObjects();
	CArray<CInteractionAreaEx *, CInteractionAreaEx *> caInteractionsFind;
	UINT uPageStart=0,uPageEnd=0;
	pDoc->project.GetPagePeriod(pDoc->m_curPosMs,uPageStart,uPageEnd);
	CTimePeriod tp;
	tp.Init(INTERACTION_PERIOD_TIME,uPageStart,uPageEnd);
	pInteractionStream->FindInteractions(&tp, false, &caInteractionsFind);
		// add new interactions to list
		GetReportCtrl().ResetContent();
		CXTPReportControl &wndReport = GetReportCtrl();

		// save new interactions
		m_caInteractions.RemoveAll();
		for (int i = 0; i < caInteractionsFind.GetSize(); ++i) {
			m_caInteractions.InsertAt(0, caInteractionsFind[i]);
				}
		int nImageIndex = 2;
		CString csInteractionName;
		CXTPReportRecord* pReportControl = NULL;
		if (GetStructureTypeCaptionForCurrentPage(csInteractionName, nImageIndex)) {
			if (m_areEx == NULL) {
				m_areEx = new CInteractionAreaEx();
			}

			m_areEx->SetInteractionName(csInteractionName, false);
			m_areEx->SetHiddenDuringEdit(false);

			pReportControl = new CInteractionRecord(m_areEx, 0, _T(""), nImageIndex);
			pReportControl->SetExpanded(TRUE);
		}

		CXTPReportRecord* pAnswers = NULL, *pButtons = NULL, *pFeedback = NULL, *pStatusDisplay = NULL, *pMisc = NULL;
		CXTPReportRecord* pReportControlInteractionElement = NULL, *pReportControlInteractionObjects = NULL;
		CString csCaption = _T("");
		for (int i = 0; i < m_caInteractions.GetSize(); ++i) {
			InteractionRecordType interactionType = m_caInteractions[i]->GetTypeId();
			switch (interactionType) {
				case INTERACTION_RECORD_TEXT: {
					if (pReportControl) {
						csCaption.LoadString(IDS_ASSIGNMENT_TEXT);
						CInteractionRecord *pItem = (CInteractionRecord*) pReportControl->GetChilds()->Add(
							new CInteractionRecord(m_caInteractions[i], INTERACTION_RECORD_PRIORITY_TEXT, csCaption));
					}
					break;
											  }
				case INTERACTION_RECORD_TITLE: {
					if (pReportControl) {
						csCaption.LoadString(IDC_LABEL_TITLE);
						csCaption = csCaption + _T(" ");
						CInteractionRecord *pItem = (CInteractionRecord*) pReportControl->GetChilds()->Add(
							new CInteractionRecord(m_caInteractions[i], INTERACTION_RECORD_PRIORITY_TITLE, csCaption ));
					}
					break;
											   }
				case INTERACTION_RECORD_ANSWERS: {
					if (pAnswers == NULL && pReportControl != NULL) {
						csCaption.LoadString(IDC_GROUP_ANSWERS);
						if (m_pAnswers == NULL) {
							m_pAnswers = new CInteractionAreaEx();
							m_pAnswers->SetInteractionName(csCaption, false);
							m_pAnswers->SetHiddenDuringEdit(false);
						}
						pAnswers = pReportControl->GetChilds()->Add(new CInteractionRecord(m_pAnswers, INTERACTION_RECORD_PRIORITY_ANSWERS, _T("") ,INTERACTION_IMAGE_INDEX_ANSWERS));
						pAnswers->SetExpanded(TRUE);
					}
					if (pAnswers) {
						pAnswers->GetChilds()->Add(new CInteractionRecord(m_caInteractions[i]));
					}
					break;
												 }
				case INTERACTION_RECORD_BUTTONS: {
					if (pButtons == NULL && pReportControl != NULL) {
						csCaption.LoadString(IDD_QUESTIONNAIRE_BUTTON_PAGE);
						if (m_pButtons == NULL) {
							m_pButtons = new CInteractionAreaEx();
							m_pButtons->SetInteractionName(csCaption, false);
							m_pButtons->SetHiddenDuringEdit(false);
						}
						pButtons = pReportControl->GetChilds()->Add(new CInteractionRecord(m_pButtons, INTERACTION_RECORD_PRIORITY_BUTTONS, _T("") , INTERACTION_IMAGE_INDEX_BUTTONS));
						pButtons->SetExpanded(TRUE);
					}
					if (pButtons) {
						pButtons->GetChilds()->Add(new CInteractionRecord(m_caInteractions[i]));
					}
					break;
												 }
				//case INTERACTION_RECORD_FEEDBACK: {
				//	if (pFeedback == NULL && pReportControl != NULL) {
				//		csCaption.LoadString(IDS_FEEDBACK);
				//		if (m_pFeedback == NULL) {
				//			m_pFeedback = new CInteractionAreaEx();
				//			m_pFeedback->SetInteractionName(csCaption, false);
				//			m_pFeedback->SetHiddenDuringEdit(false);
				//		}
				//		pFeedback = pReportControl->GetChilds()->Add(new CInteractionRecord(m_pFeedback, INTERACTION_RECORD_PRIORITY_FEEDBACK, _T("") , INTERACTION_IMAGE_INDEX_FEEDBACK));
				//		pFeedback->SetExpanded(TRUE);
				//	}
				//	if (pFeedback) {
				//		pFeedback->GetChilds()->Add(new CInteractionRecord(m_caInteractions[i]));
				//	}
				//	break;
				//								  }
				case INTERACTION_RECORD_STATUS: {
					if (pStatusDisplay == NULL && pReportControl != NULL) {
						csCaption.LoadString(IDS_STATUS_DISPLAY);
						if (m_pStatusDisplay == NULL) {
							m_pStatusDisplay = new CInteractionAreaEx();
							m_pStatusDisplay->SetInteractionName(csCaption, false);
							m_pStatusDisplay->SetHiddenDuringEdit(false);
						}
						pStatusDisplay = pReportControl->GetChilds()->Add(new CInteractionRecord(m_pStatusDisplay, INTERACTION_RECORD_PRIORITY_STATUSDISPLAY, _T(""), INTERACTION_IMAGE_INDEX_STATUS_DISPLAY));
						pStatusDisplay->SetExpanded(TRUE);
					}
					if (pStatusDisplay) {
						pStatusDisplay->GetChilds()->Add(
							new CInteractionRecord(m_caInteractions[i]));
					}
					break;
												}
				case INTERACTION_RECORD_ELEMENTS: {
					if (pReportControlInteractionElement == NULL) {
						csCaption.LoadString(IDS_INTERACTION_OBJECTS);
						if (m_areElement == NULL) {
							m_areElement = new CInteractionAreaEx();
							m_areElement->SetInteractionName(csCaption, false);
							m_areElement->SetHiddenDuringEdit(false);
						}
						pReportControlInteractionElement = new CInteractionRecord(m_areElement);
						pReportControlInteractionElement->SetExpanded(TRUE);
					}
					if (m_caInteractions[i]->GetButtonType() == BUTTON_TYPE_OTHER) {
						pReportControlInteractionElement->GetChilds()->Add(
							new CInteractionRecord(m_caInteractions[i], 0, _T(""), INTERACTION_IMAGE_INDEX_BUTTONS));
					} else {
						pReportControlInteractionElement->GetChilds()->Add(
							new CInteractionRecord(m_caInteractions[i], 0, _T(""), INTERACTION_IMAGE_INDEX_INTERACTIVE_AREA));
					}
					break;
												  }
				case INTERACTION_RECORD_MISC: {
					if (pMisc == NULL && pReportControl != NULL) {
						csCaption.LoadString(IDS_MISC);
						if (m_pMisc == NULL) {
							m_pMisc = new CInteractionAreaEx();
							m_pMisc->SetInteractionName(csCaption, false);
							m_pMisc->SetHiddenDuringEdit(false);
						}
						pMisc = pReportControl->GetChilds()->Add(new CInteractionRecord(m_pMisc, INTERACTION_RECORD_PRIORITY_MISC));
						pMisc->SetExpanded(TRUE);
					}
					if (pMisc) {
						pMisc->GetChilds()->Add(new CInteractionRecord(m_caInteractions[i]));
					}
					break;
											  }
				case INTERACTION_RECORD_GRAPHIC_OBJECTS: {
					if(m_caInteractions[i]->IsDemoDocumentObject()){
						if (pReportControlInteractionElement == NULL) {
							csCaption.LoadString(IDS_INTERACTION_OBJECTS);
							if (m_areElement == NULL) {
								m_areElement = new CInteractionAreaEx();
								m_areElement->SetInteractionName(csCaption, false);
								m_areElement->SetHiddenDuringEdit(false);
							}
							pReportControlInteractionElement = new CInteractionRecord(m_areElement);
							pReportControlInteractionElement->SetExpanded(TRUE);
						}
						if (m_caInteractions[i]->GetButtonType() == BUTTON_TYPE_OTHER) {
							pReportControlInteractionElement->GetChilds()->Add(
								new CInteractionRecord(m_caInteractions[i], 0, _T(""), INTERACTION_IMAGE_INDEX_BUTTONS));
						} else {
							pReportControlInteractionElement->GetChilds()->Add(
								new CInteractionRecord(m_caInteractions[i], 0, _T(""), INTERACTION_IMAGE_INDEX_INTERACTIVE_CALLOUT));
						}
					}
					else{
						if (pReportControlInteractionObjects == NULL) {
							csCaption.LoadString(ID_GROUP_GRAPHICAL_OBJECTS);
							if (m_areObjects == NULL) {
								m_areObjects = new CInteractionAreaEx();
								m_areObjects->SetInteractionName(csCaption, false);
								m_areObjects->SetHiddenDuringEdit(false);
							}
							pReportControlInteractionObjects = new CInteractionRecord(m_areObjects);
							pReportControlInteractionObjects->SetExpanded(TRUE);
						}
						if (m_caInteractions[i]->GetButtonType() == BUTTON_TYPE_OTHER) {
							pReportControlInteractionObjects->GetChilds()->Add(
								new CInteractionRecord(m_caInteractions[i], 0, _T(""), INTERACTION_IMAGE_INDEX_BUTTONS));
						} else {
                            CGraphicalObject *pGo = (CGraphicalObject*)m_caInteractions[i];
                            if (pGo->IsCallout())
                                pReportControlInteractionObjects->GetChilds()->Add(
                                new CInteractionRecord(m_caInteractions[i], 0, _T(""), INTERACTION_IMAGE_INDEX_CALLOUT));
                            else
                                pReportControlInteractionObjects->GetChilds()->Add(
                                new CInteractionRecord(m_caInteractions[i], 0, _T(""), INTERACTION_IMAGE_INDEX_TEXT));
						}
					}
					break;
														 }
				case INTERACTION_RECORD_UNKNOWN: {
					// should never happen
					ASSERT(false);
					break;
												 }
			}
		}

		if(pReportControlInteractionObjects && pReportControlInteractionObjects->GetChilds()->GetCount() > 0)
			wndReport.AddRecord(pReportControlInteractionObjects);
		if(pReportControlInteractionElement && pReportControlInteractionElement->GetChilds()->GetCount() > 0)
			wndReport.AddRecord(pReportControlInteractionElement);
		if(pReportControl && pReportControl->GetChilds()->GetCount() > 0)
			wndReport.AddRecord(pReportControl);

		wndReport.Populate();

	//clicked item is marked as selected so reselect timeline selected
	DeSelectItems();
	for (int i = 0; i < GetReportCtrl().GetRows()->GetCount(); i++)
	{
		if(((CInteractionRecord*)GetReportCtrl().GetRows()->GetAt(i)->GetRecord())->m_pInteractionArea->IsSelected())
			GetReportCtrl().GetRows()->GetAt(i)->SetSelected(TRUE);
		else
			GetReportCtrl().GetRows()->GetAt(i)->SetSelected(FALSE);
		((CInteractionRecord *)GetReportCtrl().GetRows()->GetAt(i)->GetRecord())->m_pItemIcon->m_bVisible = 
			((CInteractionRecord *)GetReportCtrl().GetRows()->GetAt(i)->GetRecord())->m_pInteractionArea->IsTimelineDisplay()||
			((CInteractionRecord *)GetReportCtrl().GetRows()->GetAt(i)->GetRecord())->m_pInteractionArea->IsSelected();
		((CInteractionRecord *)GetReportCtrl().GetRows()->GetAt(i)->GetRecord())->m_pItemIcon->UpdateVisibleIcon();
	}
	for (int i = 0; i < GetReportCtrl().GetRows()->GetCount(); i++) {
		CheckChildrenVisibility(GetReportCtrl().GetRows()->GetAt(i));
	}

	GetReportCtrl().RedrawControl();
}
Пример #17
-1
void CMedic::MedicSearchOutDate()
{
	CMainFrame *p = (CMainFrame *)AfxGetMainWnd();
	CXTPReportControl *pReport = p->m_wndReportCtrl;
	CXTPReportRecords *pRecords = pReport->GetRecords();
	pRecords->RemoveAll();
	

	CXTPReportRecord *pRecord;

	CMedicSet *pMedicSet = &p->medicSet;
	pMedicSet->m_strFilter = "";
	pMedicSet->Requery();
	CMedicManage ManMedic;
	CTime CurDate = CTime::GetCurrentTime();
	CString strPrice;
	while(!pMedicSet->IsEOF())
	{
		ManMedic.SetMedicSet(pMedicSet);
		CTime OutDate = ManMedic.GetOutDateTime();
		/*CString k = OutDate.Format(_T("%Y-%m-%d"));*/
		
		if (OutDate < CurDate)
		{
			pRecord = new CXTPReportRecord();
			pRecord->AddItem(new CXTPReportRecordItemText(pMedicSet->m_MedicID));
			pRecord->AddItem(new CXTPReportRecordItemText(pMedicSet->m_MedicName));
			pRecord->AddItem(new CXTPReportRecordItemText(pMedicSet->m_MedicType));
			CTime ProduceData = pMedicSet->m_ProduceDate;
			pRecord->AddItem(new CXTPReportRecordItemText(ProduceData.Format(_T("%Y-%m-%d"))));
			pRecord->AddItem(new CXTPReportRecordItemNumber(pMedicSet->m_MedicNumber));
			strPrice.Format("%.2f",pMedicSet->m_MedicPrice);
			pRecord->AddItem(new CXTPReportRecordItemText(strPrice));
			pRecord->AddItem(new CXTPReportRecordItemNumber(pMedicSet->m_GuarantPeriod));
			pRecord->AddItem(new CXTPReportRecordItemText(pMedicSet->m_ProduceCompany));
			pReport->AddRecord(pRecord);
		}
		pMedicSet->MoveNext();
	}
	pReport->Populate();
}