Exemple #1
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();
	
}
Exemple #2
-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();
}