⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 selleventdlg.cpp

📁 VC++ 开发的一个大型进销存管理系统,并附带有Visio的数据库开发模型,商品采用分类管理.但是各位同仁需要注意,本系统的开发过程是基于VC++6.0 SQL Server2000的基础之上开发的.
💻 CPP
📖 第 1 页 / 共 2 页
字号:
	int nCurRow = 0;
	CString str_DateFrom, str_DateTo, str_ClassName, str_ManagerName;
	GetDlgItemText(IDC_DATETIMEPICKER_FROM, str_DateFrom);
	GetDlgItemText(IDC_DATETIMEPICKER_TO, str_DateTo);
	GetDlgItemText(IDC_COMBO_CLASSNAME, str_ClassName);
	GetDlgItemText(IDC_COMBO_MANAGERNAME, str_ManagerName);

	if(str_ClassName == "全部分类" && str_ManagerName == "全部管理员")
	{
		//修改日期和总金额
		SetDlgItemText(IDC_STATIC_DATEFROM, str_DateFrom);
		SetDlgItemText(IDC_STATIC_DATETO, str_DateTo);
		strSQL.Format("Select sum(SumMoney) as TodayIn From _tGoodsSellEvent Where SellDate BETWEEN '%s' AND '%s'", str_DateFrom, str_DateTo);
		m_ds->ExecuteSQL(strSQL);
		fTodayIn = m_ds->GetAsFloat("TodayIn");
		strTodayIn.Format("%.2f 元",fTodayIn);
		SetDlgItemText(IDC_STATIC_SUM, strTodayIn);
		this->m_listSellEvent.DeleteAllItems();
		m_dsClass->ExecuteSQL("Select ClassName From _tClass");
		while(!m_dsClass->IsEOF())
		{
			strClassName = m_dsClass->GetAsString("ClassName");
			m_dsClass->MoveNext();
			nCurRow = m_listSellEvent.GetItemCount();
			m_listSellEvent.InsertItem(nCurRow,"");
			m_listSellEvent.SetItemText(nCurRow++,0,strClassName);
				
			strSQL.Format("Select * From SellEvent Where ClassName = '%s' and SellDate between '%s' and '%s'", strClassName, str_DateFrom, str_DateTo);
			m_ds->ExecuteSQL(strSQL);
			nRecordCount = m_ds->GetRecordCount();
			for(int i = 0; i < nRecordCount; i++)
			{
				m_listSellEvent.InsertItem(nCurRow, "");
				m_listSellEvent.SetItemText(nCurRow, 0 , m_ds->GetAsString("GoodSellID"));
				m_listSellEvent.SetItemText(nCurRow, 1 , m_ds->GetAsString("GoodName"));
				m_listSellEvent.SetItemText(nCurRow, 2 , m_ds->GetAsString("Price") + "元");
				m_listSellEvent.SetItemText(nCurRow, 3 , m_ds->GetAsString("Num") + "件");
				m_listSellEvent.SetItemText(nCurRow, 4 , m_ds->GetAsString("SumMoney") + "元");
				m_listSellEvent.SetItemText(nCurRow++, 5 , m_ds->GetAsString("ManagerName"));
				m_ds->MoveNext();
			}
			m_listSellEvent.InsertItem(nCurRow++, "");
			m_listSellEvent.InsertItem(nCurRow, "");
			m_listSellEvent.SetItemText(nCurRow,0,"——————");
			m_listSellEvent.SetItemText(nCurRow,1,"————————");
			m_listSellEvent.SetItemText(nCurRow,2,"——————");
			m_listSellEvent.SetItemText(nCurRow,3,"————");
			m_listSellEvent.SetItemText(nCurRow,4,"——————");
			m_listSellEvent.SetItemText(nCurRow++,5,"——————");
		}
	}
	else if(str_ManagerName != "全部管理员")
	{
		//修改日期和总金额
		SetDlgItemText(IDC_STATIC_DATEFROM, str_DateFrom);
		SetDlgItemText(IDC_STATIC_DATETO, str_DateTo);
		strSQL.Format("Select sum(SumMoney) as TodayIn From SellEvent Where ManagerName = '%s' and SellDate BETWEEN '%s' AND '%s'", str_ManagerName, str_DateFrom, str_DateTo);
//		::AfxMessageBox(strSQL);

		m_ds->ExecuteSQL(strSQL);
		fTodayIn = m_ds->GetAsFloat("TodayIn");
		strTodayIn.Format("%.2f 元",fTodayIn);
		SetDlgItemText(IDC_STATIC_SUM, strTodayIn);
		
		this->m_listSellEvent.DeleteAllItems();

		m_dsClass->ExecuteSQL("Select ClassName From _tClass");
		while(!m_dsClass->IsEOF())
		{
			strClassName = m_dsClass->GetAsString("ClassName");
			m_dsClass->MoveNext();
			nCurRow = m_listSellEvent.GetItemCount();
			m_listSellEvent.InsertItem(nCurRow,"");
			m_listSellEvent.SetItemText(nCurRow++,0,strClassName);
			
			strSQL.Format("Select * From SellEvent Where ManagerName = '%s' and ClassName = '%s' and SellDate between '%s' and '%s'", str_ManagerName, strClassName, str_DateFrom, str_DateTo);
			m_ds->ExecuteSQL(strSQL);
			nRecordCount = m_ds->GetRecordCount();
			for(int i = 0; i < nRecordCount; i++)
			{
				m_listSellEvent.InsertItem(nCurRow, "");
				m_listSellEvent.SetItemText(nCurRow, 0 , m_ds->GetAsString("GoodSellID"));
				m_listSellEvent.SetItemText(nCurRow, 1 , m_ds->GetAsString("GoodName"));
				m_listSellEvent.SetItemText(nCurRow, 2 , m_ds->GetAsString("Price") + "元");
				m_listSellEvent.SetItemText(nCurRow, 3 , m_ds->GetAsString("Num") + "件");
				m_listSellEvent.SetItemText(nCurRow, 4 , m_ds->GetAsString("SumMoney") + "元");
				m_listSellEvent.SetItemText(nCurRow++, 5 , m_ds->GetAsString("ManagerName"));
				m_ds->MoveNext();
			}
			m_listSellEvent.InsertItem(nCurRow++, "");
			m_listSellEvent.InsertItem(nCurRow, "");
			m_listSellEvent.SetItemText(nCurRow,0,"——————");
			m_listSellEvent.SetItemText(nCurRow,1,"————————");
			m_listSellEvent.SetItemText(nCurRow,2,"——————");
			m_listSellEvent.SetItemText(nCurRow,3,"————");
			m_listSellEvent.SetItemText(nCurRow,4,"——————");
			m_listSellEvent.SetItemText(nCurRow++,5,"——————");
		}
	}
/*		可以删除

	//获取当前时间
	int nRecordCount = 0;
	int nCurRow = 0;
	float fTodayIn = 0;
	CString strClassName, strSQL, strTodayIn;

	int nYear,nMonth,nDay;
	CString sCurrentTime;
	CTime time;
	time=CTime::GetCurrentTime();
	nYear=time.GetYear();
	nMonth=time.GetMonth();
	nDay=time.GetDay();
	sCurrentTime.Format("%4d-%02d-%02d", nYear, nMonth, nDay);	//保证日期格式

	SetDlgItemText(IDC_STATIC_DATEFROM,sCurrentTime);
	SetDlgItemText(IDC_STATIC_DATETO,sCurrentTime);

	strSQL.Format("Select sum(SumMoney) as TodayIn From _tGoodsSellEvent Where SellDate = '%s'", sCurrentTime);
	m_ds->ExecuteSQL(strSQL);
	fTodayIn = m_ds->GetAsFloat("TodayIn");
	strTodayIn.Format("%.2f 元",fTodayIn);
	SetDlgItemText(IDC_STATIC_SUM, strTodayIn);


	this->m_listSellEvent.DeleteAllItems();


	m_dsClass->ExecuteSQL("Select ClassName From _tClass");
	while(!m_dsClass->IsEOF())
	{
		strClassName = m_dsClass->GetAsString("ClassName");
		m_dsClass->MoveNext();
		nCurRow = m_listSellEvent.GetItemCount();
		m_listSellEvent.InsertItem(nCurRow,"");
		m_listSellEvent.SetItemText(nCurRow++,0,strClassName);


		strSQL.Format("Select * From SellEvent Where ClassName = '%s' and SellDate = '%s'", strClassName, sCurrentTime);
		m_ds->ExecuteSQL(strSQL);
		nRecordCount = m_ds->GetRecordCount();
		for(int i = 0; i < nRecordCount; i++)
		{
			m_listSellEvent.InsertItem(nCurRow, "");
			m_listSellEvent.SetItemText(nCurRow, 0 , m_ds->GetAsString("GoodSellID"));
			m_listSellEvent.SetItemText(nCurRow, 1 , m_ds->GetAsString("GoodName"));
			m_listSellEvent.SetItemText(nCurRow, 2 , m_ds->GetAsString("Price") + "元");
			m_listSellEvent.SetItemText(nCurRow, 3 , m_ds->GetAsString("Num") + "件");
			m_listSellEvent.SetItemText(nCurRow, 4 , m_ds->GetAsString("SumMoney") + "元");
			m_listSellEvent.SetItemText(nCurRow++, 5 , m_ds->GetAsString("ManagerName"));
			m_ds->MoveNext();
		}
		m_listSellEvent.InsertItem(nCurRow++, "");
		m_listSellEvent.InsertItem(nCurRow, "");
		m_listSellEvent.SetItemText(nCurRow,0,"——————");
		m_listSellEvent.SetItemText(nCurRow,1,"————————");
		m_listSellEvent.SetItemText(nCurRow,2,"——————");
		m_listSellEvent.SetItemText(nCurRow,3,"————");
		m_listSellEvent.SetItemText(nCurRow,4,"——————");
		m_listSellEvent.SetItemText(nCurRow++,5,"——————");
	}
*/
























//	CDialog::OnOK();
}

void CSellEventDlg::OnBtnPrint() 
{
	// TODO: Add your control notification handler code here
	
}

HBRUSH CSellEventDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
	
	// TODO: Change any attributes of the DC here
	
	// TODO: Return a different brush if the default is not desired
//*************************添加背景色教程**********************
//	在OnCtlColor函数中添加如下代码:(可能需要选择STATIC的简单属性) 
//		if(nCtlColor==CTLCOLOR_STATIC)	下面的IDC_STATIC_TEST也可用CTLCOLOR_STATIC代替
//		{  pDC->SetTextColor(RGB(255,0,0)); 
//		pDC->SetBkColor(RGB(128,128,128));//设置文本背景色 
//		pDC->SetBkMode(TRANSPARENT);//设置背景透明 
//		} 
//		其他控件的宏定义为: 
//			.CTLCOLOR_BTN       按钮控件 
//			.CTLCOLOR_DLG       对话框 
//			.CTLCOLOR_EDIT      编辑框 
//			.CTLCOLOR_LISTBOX   列表控件 
//			.CTLCOLOR_MSGBOX    消息控件 
//			.CTLCOLOR_SCROLLBAR 滚动条控件 
//			.CTLCOLOR_STATIC    静态控件   
//******************************************************

//****************************设置控件的字体**********************
//	CFont font;
//	font.CreatePointFont(720,_T("Arial")); 
//	GetDlgItem(IDC_STATIC_TEST)->SetFont(&font); 
//	font.DeleteObject();

//********************************************************
	if(pWnd->GetDlgCtrlID() == IDC_STATIC_TITLE)			
	{   

		pDC->SetTextColor(RGB(120, 120, 120));			//设置文本颜色

		//如果FormView只是一中颜色,而不是图片,你就可以用:pDC->SetBkColor(...)   
	//	pDC->BitBlt(0,   0,   m_rectLOG.Width(),   m_rectLOG.Height(),   
	//		&m_listMemDC,   0,   0,   SRCCOPY);     
	//	 pDC->SetBkMode(TRANSPARENT); //设置透明 
	//	return   (HBRUSH)GetStockObject(NULL_BRUSH);   
	}
	return hbr;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -