当前位置: 首页>>代码示例>>C++>>正文


C++ CBCGPGridRow::AddSubItem方法代码示例

本文整理汇总了C++中CBCGPGridRow::AddSubItem方法的典型用法代码示例。如果您正苦于以下问题:C++ CBCGPGridRow::AddSubItem方法的具体用法?C++ CBCGPGridRow::AddSubItem怎么用?C++ CBCGPGridRow::AddSubItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CBCGPGridRow的用法示例。


在下文中一共展示了CBCGPGridRow::AddSubItem方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FillPriceGird

//更新商品数据
//strHeader = L"商品类别|商品名称|商品编码|价格|库存|现金购物|金额|账户购物|赠送|兑换积分";
void CStoreDlg::FillPriceGird()
{
	m_lpCommodityGrid->RemoveAll();

	CCommodityArray CommodityArray;//待售商品队列
	CCommodityQueryCondition CommodityQueryCondition;//商品查询条件
	//从数据库取得库存数据
	if (!CIBADAL::GetInstance()->GetPriceCommodity(CommodityArray, CommodityQueryCondition)) return;

	CCommoditySoldInfoArray CommoditySoldInfoArray;
	if (!CIBADAL::GetInstance()->GetCommoditySoldInfo(CommoditySoldInfoArray)) return;

	//取得列数
	const INT nColumns = m_lpCommodityGrid->GetColumnCount();

	UINT nStoreNum = 0; //库存数量

	UINT nPrePrice = 0;//先前的价格

	CString strTmp;//临时变量
	CBCGPGridRow* pLastGroup = NULL;
	//商品记录
	for (INT i = 0; i < CommodityArray.GetCount(); i++)
	{	//商品信息
		CCommodity & Commodity = CommodityArray.GetAt(i);
		//分类头设置
		UINT nPrice = Commodity.GetAdvicePrice();
		if (nPrice != nPrePrice)
		{
			if (nStoreNum > 0)//数量大于0
			{
				pLastGroup->GetItem(4)->SetValue(nStoreNum);
				nStoreNum = 0;
			}

			nPrePrice = nPrice;
			//创建记录
			pLastGroup = m_lpCommodityGrid->CreateRow(nColumns);
			pLastGroup->AllowSubItems();// 关联式子菜单
			strTmp.Format(_T("%.2f"), Commodity.GetAdvicePrice() / 100.0);
			pLastGroup->GetItem(0)->SetValue(strTmp.GetString());
			//添加记录
			m_lpCommodityGrid->AddRow(pLastGroup, FALSE);
		}

		//此商品出现过
		CBCGPGridRow* pCommodity = m_lpCommodityGrid->CreateRow(nColumns);
		ASSERT_VALID(pCommodity);
		//设置子项
		pCommodity->GetItem(1)->SetValue(Commodity.GetCommodityName().GetString());
		pCommodity->GetItem(2)->SetValue(Commodity.GetBarCode().GetString());
		strTmp.Format(_T("%.2f"), Commodity.GetAdvicePrice() / 100.0);
		pCommodity->GetItem(3)->SetValue(Commodity.GetGroupName().GetString());
		pCommodity->GetItem(4)->SetValue(Commodity.GetRemainQuantity());

		if (theApp.GetCurCashier()->IsOnDuty())
		{
			for (INT j = 0; j < CommoditySoldInfoArray.GetCount(); j++)
			{
				CCommoditySoldInfo CommoditySoldInfo = CommoditySoldInfoArray.GetAt(j);

				if (CommoditySoldInfo.GetCommoditycode().CompareNoCase(Commodity.GetBarCode()) == 0)
				{
					//现金合计数量
					INT nCount = CommoditySoldInfo.GetSoldCount1() + CommoditySoldInfo.GetReturnCount1();

					if (nCount > 0)
					{
						pCommodity->GetItem(5)->SetValue(nCount);
						strTmp.Format(_T("%.2f"), (CommoditySoldInfo.GetSoldAmout1() + CommoditySoldInfo.GetReturnAmout1()) / 100.0);
						pCommodity->GetItem(6)->SetValue(strTmp.GetString());
					}
					//账户合计数量
					nCount = CommoditySoldInfo.GetSoldCount2() + CommoditySoldInfo.GetReturnCount2();

					if (nCount > 0)
					{
						pCommodity->GetItem(7)->SetValue(nCount);
					}
					//赠送合计数量
					if (CommoditySoldInfo.GetPresentCount() > 0)
					{
						pCommodity->GetItem(8)->SetValue(CommoditySoldInfo.GetPresentCount());
					}

					if (CommoditySoldInfo.GetExchangePoint())
					{
						pCommodity->GetItem(9)->SetValue(CommoditySoldInfo.GetExchangePoint());
					}
				}
			}

		}

		nStoreNum += Commodity.GetRemainQuantity();
		pLastGroup->AddSubItem(pCommodity, FALSE);//添加子列表
	}

//.........这里部分代码省略.........
开发者ID:layerfsd,项目名称:PersonalIBA,代码行数:101,代码来源:StoreDlg.cpp

示例2: FillSortGird

//更新商品数据
//strHeader = L"商品类别|商品名称|商品编码|价格|库存|现金购物|金额|账户购物|赠送|兑换积分";
void CStoreDlg::FillSortGird()
{	
	m_lpCommodityGrid->RemoveAll();

	CCommodityArray CommodityArray;//商品队列
	CCommodityQueryCondition CommodityQueryCondition;//查询条件
	
	//取得商品库存数据和商品查询条件
	if (!CIBADAL::GetInstance()->GetStoreCommodity(CommodityArray, CommodityQueryCondition)) return;

	CCommoditySoldInfoArray CommoditySoldInfoArray;
	if (!CIBADAL::GetInstance()->GetCommoditySoldInfo(CommoditySoldInfoArray)) return;

	const INT nColumns = m_lpCommodityGrid->GetColumnCount();

	INT nTmp = 0; 

	CString strLastGroupId;
	CBCGPGridRow* pLastGroup = NULL;

	for (INT i = 0; i < CommodityArray.GetCount(); i++)
	{	
		CCommodity & CommodityInfo = CommodityArray.GetAt(i);

		CString strTmp = CommodityInfo.GetGroupId();

		if (strLastGroupId != strTmp)
		{	
			if (nTmp > 0)
			{
				pLastGroup->GetItem(4)->SetValue(nTmp);
				nTmp = 0;
			}

			strLastGroupId = strTmp;
			pLastGroup = m_lpCommodityGrid->CreateRow(nColumns);
			pLastGroup->AllowSubItems();
			pLastGroup->GetItem(0)->SetValue(CommodityInfo.GetGroupName().GetString());
			m_lpCommodityGrid->AddRow(pLastGroup, FALSE);
		}

		CBCGPGridRow* pCommodity = m_lpCommodityGrid->CreateRow(nColumns);
		ASSERT_VALID(pCommodity);

		pCommodity->GetItem(1)->SetValue(CommodityInfo.GetCommodityName().GetString());
		pCommodity->GetItem(2)->SetValue(CommodityInfo.GetBarCode().GetString());
		strTmp.Format(_T("%.2f"), CommodityInfo.GetAdvicePrice() / 100.0);
		pCommodity->GetItem(3)->SetValue(strTmp.GetString());
		pCommodity->GetItem(4)->SetValue(CommodityInfo.GetRemainQuantity());

		if (theApp.GetCurCashier()->IsOnDuty())
		{
			for (INT j = 0; j < CommoditySoldInfoArray.GetCount(); j++)
			{
				CCommoditySoldInfo CommoditySoldInfo = CommoditySoldInfoArray.GetAt(j);

				if (CommoditySoldInfo.GetCommoditycode().CompareNoCase(CommodityInfo.GetBarCode()) == 0)
				{
					//现金合计数量
					INT nCount = CommoditySoldInfo.GetSoldCount1() + CommoditySoldInfo.GetReturnCount1();

					if (nCount > 0)
					{
						pCommodity->GetItem(5)->SetValue(nCount);
						strTmp.Format(_T("%.2f"), (CommoditySoldInfo.GetSoldAmout1() + CommoditySoldInfo.GetReturnAmout1()) / 100.0);
						pCommodity->GetItem(6)->SetValue(strTmp.GetString());
					}
					//账户合计数量
					nCount = CommoditySoldInfo.GetSoldCount2() + CommoditySoldInfo.GetReturnCount2();

					if (nCount > 0)
					{
						pCommodity->GetItem(7)->SetValue(nCount);
					}
					//赠送合计数量
					if (CommoditySoldInfo.GetPresentCount() > 0)
					{
						pCommodity->GetItem(8)->SetValue(CommoditySoldInfo.GetPresentCount());
					}

					if (CommoditySoldInfo.GetExchangePoint())
					{
						pCommodity->GetItem(9)->SetValue(CommoditySoldInfo.GetExchangePoint());
					}
				}
			}
		}

		nTmp += CommodityInfo.GetRemainQuantity();

		pLastGroup->AddSubItem(pCommodity, FALSE);
	}

	if (pLastGroup != NULL) //有商品数据
	{
		pLastGroup->GetItem(4)->SetValue(nTmp);
	}

//.........这里部分代码省略.........
开发者ID:layerfsd,项目名称:PersonalIBA,代码行数:101,代码来源:StoreDlg.cpp

示例3: FillGird


//.........这里部分代码省略.........
		//
	}

	//取得列数
	const INT nColumns = m_wndGridTree.GetColumnCount();

	INT nTmp = 0; //库存数量

	CString strLastGroupId;//上一次的商品
	CBCGPGridRow* pLastGroup = NULL;
	//商品记录
	for (INT i = 0; i < CommodityArray.GetCount(); i++)
	{	//商品信息
		CCommodity & Commodity = CommodityArray.GetAt(i);
		//商品ID
		CString strTmp = Commodity.GetGroupId();
		//此商品没有出现过
		if (strLastGroupId != strTmp)
		{	
			if (nTmp > 0)//数量大于0
			{
				pLastGroup->GetItem(4)->SetValue(nTmp);
				nTmp = 0;
			}

			strLastGroupId = strTmp;
			//创建记录
			pLastGroup = m_wndGridTree.CreateRow(nColumns);
			pLastGroup->AllowSubItems();// 关联式子菜单
			pLastGroup->GetItem(0)->SetValue(Commodity.GetGroupName().GetString());
			//添加记录
			m_wndGridTree.AddRow(pLastGroup, FALSE);
		}
		//此商品出现过
		CBCGPGridRow* pCommodity = m_wndGridTree.CreateRow(nColumns);
		ASSERT_VALID(pCommodity);
		//设置子项
		pCommodity->GetItem(1)->SetValue(Commodity.GetCommodityName().GetString());
		pCommodity->GetItem(2)->SetValue(Commodity.GetBarCode().GetString());
		strTmp.Format(_T("%.2f"), Commodity.GetAdvicePrice() / 100.0);
		pCommodity->GetItem(3)->SetValue(strTmp.GetString());
		pCommodity->GetItem(4)->SetValue(Commodity.GetRemainQuantity());

		if (theApp.GetCurCashier()->IsOnDuty())
		{
			for (INT j = 0; j < CommoditySoldInfoArray.GetCount(); j++)
			{
				CCommoditySoldInfo CommoditySoldInfo = CommoditySoldInfoArray.GetAt(j);

				if (CommoditySoldInfo.GetCommoditycode().CompareNoCase(Commodity.GetBarCode()) == 0)
				{
					//现金合计数量
					INT nCount = CommoditySoldInfo.GetSoldCount1() + CommoditySoldInfo.GetReturnCount1();

					if (nCount > 0)
					{
						pCommodity->GetItem(5)->SetValue(nCount);
						strTmp.Format(_T("%.2f"), (CommoditySoldInfo.GetSoldAmout1() + CommoditySoldInfo.GetReturnAmout1()) / 100.0);
						pCommodity->GetItem(6)->SetValue(strTmp.GetString());
					}
					//账户合计数量
					nCount = CommoditySoldInfo.GetSoldCount2() + CommoditySoldInfo.GetReturnCount2();

					if (nCount > 0)
					{
						pCommodity->GetItem(7)->SetValue(nCount);
					}
					//赠送合计数量
					if (CommoditySoldInfo.GetPresentCount() > 0)
					{
						pCommodity->GetItem(8)->SetValue(CommoditySoldInfo.GetPresentCount());
					}

					if (CommoditySoldInfo.GetExchangePoint())
					{
						pCommodity->GetItem(9)->SetValue(CommoditySoldInfo.GetExchangePoint());
					}
				}
			}

			if (Commodity.GetStoreInQuantity() > 0)
			{
				pCommodity->GetItem(10)->SetValue(Commodity.GetStoreInQuantity());
				pCommodity->GetItem(11)->SetValue(Commodity.GetStoreInAmount());
			}
		}

		nTmp += Commodity.GetRemainQuantity();

		pLastGroup->AddSubItem(pCommodity, FALSE);//添加子列表
	}

	if (pLastGroup != NULL) //有商品数据
	{
		pLastGroup->GetItem(4)->SetValue(nTmp);
		GetDlgItem(IDC_BUTTON_JXCPRINT)->EnableWindow(TRUE);
	}

	m_wndGridTree.AdjustLayout();
}
开发者ID:layerfsd,项目名称:PersonalIBA,代码行数:101,代码来源:OffDutyDlg.cpp


注:本文中的CBCGPGridRow::AddSubItem方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。