亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? posdlg.cpp

?? C源碼
?? CPP
?? 第 1 頁 / 共 3 頁
字號:
		m_pRecordset->Open((_variant_t)sql,_variant_t((IDispatch*)theApp.m_pConnection,true),adOpenDynamic,adLockOptimistic,adCmdText);

		if(!m_pRecordset->adoEOF)
			sname=(LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("NAME");	
	}
	catch(_com_error e)///捕捉異常
	{
		CString temp;
		temp.Format("獲取商品名稱出錯:%s",e.ErrorMessage());
		AfxMessageBox(temp);
	}
	return sname;
}

void CPosDlg::OnButtonSelmateriel() 
{
	int iOption;
	CString sbillid;
	iOption = m_oListbill.GetCurSel();
	if(iOption<0)
		return;
	m_oListbill.GetText(iOption, sbillid);//得到選中項的文本

	if(bGetBillStatus(sbillid))
		return;

	CSelectDlg selectdlg;
	selectdlg.DoModal();	
}

void CPosDlg::ReadToFormlist(CString sbillid)
{
	_RecordsetPtr m_pRecordset; //Must define it in function!!!!
	CString sql,sname,sno,sqa,ssum;
	long rowcount=0;
	long lmid;
	float fsum;
	LV_ITEM lvitem;

	//清空list控件的數據
	m_oFormlist.DeleteAllItems();

	int numline=0;
	lvitem.pszText="";
	lvitem.mask=LVIF_TEXT;
	lvitem.iSubItem=0;

	sql="Select * from SALEDETAIL where BILLID='"+sbillid+"'";
	try
	{
		m_pRecordset.CreateInstance("ADODB.Recordset");
		m_pRecordset->Open((_variant_t)sql,_variant_t((IDispatch*)theApp.m_pConnection,true),adOpenDynamic,adLockOptimistic,adCmdText);
		
		while(!m_pRecordset->adoEOF)
		{
			sno=(LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("ROWNO");
			sqa=(LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("ITEMCOUNT");
			lmid=(long)m_pRecordset->GetCollect("MATERIELID");
			sname=GetMaterielName(lmid);
			fsum=(float)m_pRecordset->GetCollect("ITEMTOTAL");
			ssum.Format("%.2f",fsum);

			lvitem.iItem=numline;
			m_oFormlist.InsertItem(&lvitem);
			//讀出數據寫入到list中
			m_oFormlist.SetItemText(numline,0,sno);
			m_oFormlist.SetItemText(numline,1,sname);
			m_oFormlist.SetItemText(numline,2,sqa);
			m_oFormlist.SetItemText(numline,3,ssum);					

			m_pRecordset->MoveNext();
			numline++;
		}
		RECT rect;
		m_oFormlist.GetWindowRect(&rect);
		m_oButton.MoveWindow(440,95+numline*15, rect.right/40, rect.bottom/35);
		m_oButton.BringWindowToTop();
		m_oButton.ShowWindow(SW_SHOW);//從隱藏變為顯示
		m_pRecordset->Close();///關閉記錄集rowcount
	}
	catch(_com_error e)///捕捉異常
	{
		CString temp;
		temp.Format("讀取單據商品到列表中出錯:%s",e.ErrorMessage());
		AfxMessageBox(temp);
	}
}

void CPosDlg::OnDblclkListForm(NMHDR* pNMHDR, LRESULT* pResult) 
{
	CString sno,ssum,sname,scount,sql;
	CString sbillid;
	float fprice,fsum;
	int ncount,nqa,iOption;

	iOption = m_oListbill.GetCurSel();
	m_oListbill.GetText(iOption, sbillid);//得到選中項的文本

	if(bGetBillStatus(sbillid))
		return;

	//得到當前選中的行
	POSITION pos = m_oFormlist.GetFirstSelectedItemPosition();
	//如果選中一行
	if(pos)
	{		
		int nItem = m_oFormlist.GetNextSelectedItem(pos);
		sno=m_oFormlist.GetItemText(nItem,0);
		scount=m_oFormlist.GetItemText(nItem,2);
		ncount=atoi(scount);
		theApp.sqa=scount;
		ssum=m_oFormlist.GetItemText(nItem,3);
		fsum=atof(ssum);
		fprice=fsum;
		if(ncount>0)
			fprice=fsum/ncount;
		//Open the modifyqa dlg. 
		CModifyqaDlg modifydlg;
		modifydlg.DoModal();

		nqa=atoi(theApp.sqa);
		fsum=nqa*fprice;
		ssum.Format("%.2f",fsum);

		m_oFormlist.SetItemText(nItem,2,theApp.sqa);
		m_oFormlist.SetItemText(nItem,3,ssum);
		//Update saledetail.
		sql="Update SALEDETAIL set ITEMCOUNT="+theApp.sqa+",ITEMTOTAL="+ssum+" where BILLID='"+sbillid+"' and ROWNO="+sno+"";
		try
		{ 	_variant_t RecordsAffected;
			theApp.m_pConnection->Execute((_bstr_t)sql,&RecordsAffected,adCmdText);
			UpdateData(FALSE);
		}
		catch(_com_error e)///捕捉異常
		{
			CString temp;
			temp.Format("[修改數量]更新商品出錯:%s",e.ErrorMessage());
			AfxMessageBox(temp);
			return;
		}
		//Update salebill.
		_RecordsetPtr m_pRecordset; //Must define it in function!!!!
		float ftotal;
		CString stotal;
		sql="select Sum(ITEMTOTAL) as SSS from SALEDETAIL where BILLID='"+sbillid+"'";
		try
		{ 
			m_pRecordset.CreateInstance("ADODB.Recordset");
			m_pRecordset->Open((_variant_t)sql,_variant_t((IDispatch*)theApp.m_pConnection,true),adOpenStatic,adLockOptimistic,adCmdText);

			ftotal=(float)m_pRecordset->GetCollect("SSS");
			m_pRecordset->Close();
		}
		catch(_com_error e)///捕捉異常
		{
			CString stemp;
			stemp.Format("[修改數量]計算單據金額出錯:%s",e.ErrorMessage());
			AfxMessageBox(stemp);
			return;
		}
		stotal.Format("%.2f",ftotal);
		sql="Update SALEBILL set TOTAL="+stotal+" where ID='"+sbillid+"'";
		try
		{ 	_variant_t RecordsAffected;
			theApp.m_pConnection->Execute((_bstr_t)sql,&RecordsAffected,adCmdText);
		}
		catch(_com_error e)///捕捉異常
		{
			CString temp;
			temp.Format("[修改數量]更新總金額出錯:%s",e.ErrorMessage());
			AfxMessageBox(temp);
			return;
		}
		m_oTotal.SetWindowText(stotal);

	}	
	*pResult = 0;
}

BOOL CPosDlg::PreTranslateMessage(MSG* pMsg) 
{
	int i,iState,iOption;
	RECT rect;
	CString sql,sno,sbillid,stotal;

	if(pMsg->message==WM_KEYDOWN)
	{
		switch(pMsg->wParam)
		{
		case VK_F1:
			OnButtonAddf();
			break;
		case VK_F2:
			OnButtonDelf();
			break;
		case VK_F3:
			OnButtonCallf();
			break;
		case VK_F4:
			OnButtonHidef();
			break;
		case VK_F5:
			OnButtonCheckf();
			break;
		case VK_F6:
			
			break;
		case VK_F7:

			break;
		case VK_F8:

			break;
		case VK_F9:

			break;
		case VK_F10:
			OnButtonOff();
			break;
		}
	}
//	if(GetFocus()->GetDlgCtrlID()==IDC_LIST_FORM)//針對特定的控件,也可以不用判斷  
//	{  
		if(pMsg->message==WM_KEYDOWN && pMsg->wParam==VK_DELETE)  
        {  
			iOption = m_oListbill.GetCurSel();
			m_oListbill.GetText(iOption, sbillid);//得到選中項的文本

			if(bGetBillStatus(sbillid))
				return FALSE;

			int nItemSelected=m_oFormlist.GetSelectedCount();//所選表項數
			int nItemCount=m_oFormlist.GetItemCount();//表項總數
			if(nItemSelected<1) 
				return FALSE;
			for(i=nItemCount-1;i>=0;i--)	
			{
				iState=m_oFormlist.GetItemState(i,LVIS_SELECTED);
				if(iState!=0) 
				{
					sno=m_oFormlist.GetItemText(i,0);
					m_oFormlist.DeleteItem(i);

					sql="delete * from SALEDETAIL where BILLID='"+sbillid+"' and ROWNO="+sno+"";
					try
					{ 	_variant_t RecordsAffected;
						theApp.m_pConnection->Execute((_bstr_t)sql,&RecordsAffected,adCmdText);
						UpdateData(FALSE);
					}
					catch(_com_error e)///捕捉異常
					{
						CString temp;
						temp.Format("從數據庫中刪除單據出錯:%s",e.ErrorMessage());
						AfxMessageBox(temp);
						return FALSE;
					}
				}	
			}
			ReadToFormlist(sbillid);//Refresh formlist.
			m_oFormlist.GetWindowRect(&rect);
			m_oButton.MoveWindow(440,95+(nItemCount-1)*15, rect.right/40, rect.bottom/35);
			m_oButton.BringWindowToTop();
			m_oButton.ShowWindow(SW_SHOW);//從隱藏變為顯示

			stotal=SumItemtotal(sbillid);
			m_oTotal.SetWindowText(stotal);
			sql="Update SALEBILL set TOTAL="+stotal+" where ID='"+sbillid+"'";
			try
			{ 	
				_variant_t RecordsAffected;
				theApp.m_pConnection->Execute((_bstr_t)sql,&RecordsAffected,adCmdText);
			}
			catch(_com_error e)///捕捉異常
			{
				CString temp;
				temp.Format("[刪除商品]更新商品總金額出錯:%s",e.ErrorMessage());
				AfxMessageBox(temp);
				return FALSE;
			}
         }  
//	}		
	return CDialog::PreTranslateMessage(pMsg);
}

void CPosDlg::OnButtonCallf() 
{
	_RecordsetPtr m_pRecordset; //Must define it in function!!!!
	CString sql;

	if(!theApp.VerifyPower("CallBill"))
	{
		AfxMessageBox("沒有權限調單!");
		return;
	}

	CCallDlg calldlg;//Create a dialog to enter billid to call.
	calldlg.dowhat="imhappy";
	calldlg.DoModal();

	if(!bGetBillStatus(theApp.scallid))
		return;

	sql="select * from SALEBILL where ID='"+theApp.scallid+"'";
	try
	{
		m_pRecordset.CreateInstance("ADODB.Recordset");
		m_pRecordset->Open((_variant_t)sql,_variant_t((IDispatch*)theApp.m_pConnection,true),adOpenStatic,adLockOptimistic,adCmdText);
			
		if(!m_pRecordset->adoEOF)
		{
			m_oTableno.SetWindowText((LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("TABLENO"));
			m_oPeasons.SetWindowText((LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("PEOPLES"));
			m_oCheck.SetWindowText((LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("SALES"));
			m_oStatus.SetWindowText((LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("STATUS"));
			m_oBegintime.SetWindowText((LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("BEGINDATE"));
			m_oEndtime.SetWindowText((LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("ENDDATE"));
			float ftotal=(float)m_pRecordset->GetCollect("TOTAL");
			CString stotal;
			stotal.Format("%.2f",ftotal);
			m_oTotal.SetWindowText(stotal);
			ftotal=(float)m_pRecordset->GetCollect("ACTTOTAL");
			stotal.Format("%.2f",ftotal);
			m_oActtotal.SetWindowText(stotal);
			ReadToFormlist(theApp.scallid);//Get bill items from database.

			m_oListbill.AddString(theApp.scallid);
			m_oListbill.SelectString(-1,theApp.scallid);
		}
		if(m_pRecordset->adoEOF)
		{
			CString temp="單據 '"+theApp.scallid+"' 不存在!";
			AfxMessageBox(temp);
			theApp.scallid="";
		}
		m_pRecordset->Close();
	}
	catch(_com_error e)///捕捉異常
	{
		CString temp;
		temp.Format("從列表讀取單據頭到編輯框出錯:%s",e.ErrorMessage());
		AfxMessageBox(temp);
		return;
	}	
	m_oButton.ShowWindow(SW_HIDE);//從顯示變為隱藏	
}

long CPosDlg::GetRecordCount(CString sql)
{
	long lcount;
	_RecordsetPtr m_pRecordset; //Must define it in function!!!!

	try
	{ 
		m_pRecordset.CreateInstance("ADODB.Recordset");
		m_pRecordset->Open((_variant_t)sql,_variant_t((IDispatch*)theApp.m_pConnection,true),adOpenStatic,adLockOptimistic,adCmdText);

		lcount=(long)m_pRecordset->GetCollect("XXX");
		m_pRecordset->Close();
	}
	catch(_com_error e)///捕捉異常
	{
		CString stemp;
		stemp.Format("獲得記錄數出錯:%s",e.ErrorMessage());
		AfxMessageBox(stemp);
	}
	return lcount;
}

void CPosDlg::OnButtonDelf() 
{
	CString sql,sbillid;
	int iOption;
	_RecordsetPtr m_pRecordset;

	if(!theApp.VerifyPower("DelBill"))
	{
		AfxMessageBox("沒有權限刪除單據!");
		return;
	}

	iOption = m_oListbill.GetCurSel();
	if(iOption==-1)
		return;
	m_oListbill.GetText(iOption, sbillid);//得到選中項的文本


	if(bGetBillStatus(sbillid))
	{
		AfxMessageBox("不能刪除已結帳單據!");
		return;
	}

	if(AfxMessageBox("確定刪除此單據嗎?",MB_YESNO)==IDYES)
	{
		sql="Delete * from SALEBILL where ID='"+sbillid+"'";
		try
		{ 	
			_variant_t RecordsAffected;
			theApp.m_pConnection->Execute((_bstr_t)sql,&RecordsAffected,adCmdText);		
		}
		catch(_com_error e)///捕捉異常
		{
			CString temp;
			temp.Format("Delete bill id error:%s",e.ErrorMessage());
			AfxMessageBox(temp);
			return;
		}	
		sql="Delete * from SALEDETAIL where BILLID='"+sbillid+"'";
		try
		{ 
			_variant_t RecordsAffected;
			theApp.m_pConnection->Execute((_bstr_t)sql,&RecordsAffected,adCmdText);		
		}
		catch(_com_error e)///捕捉異常
		{
			CString temp;
			temp.Format("刪除單據商品出錯:%s",e.ErrorMessage());
			AfxMessageBox(temp);
			return;
		}	
		m_oListbill.DeleteString(iOption);
		if(m_oListbill.GetCount()>0)
		{
			if(m_oListbill.GetCount()>iOption)
				m_oListbill.SetCurSel(iOption);
			if(m_oListbill.GetCount()==iOption)
				m_oListbill.SetCurSel(iOption-1);

			iOption = m_oListbill.GetCurSel();
			m_oListbill.GetText(iOption, sbillid);//Again得到選中項的文本
			theApp.scallid=sbillid;//Get current bill id.
			ReadBillHead(sbillid);
			ReadToFormlist(sbillid);
		}
	}
	else
		return;			
}

void CPosDlg::OnButtonHidef() 
{
	int iOption;
	CString sbillid;

	iOption = m_oListbill.GetCurSel();
	if(iOption==-1)
		return;

	m_oListbill.GetText(iOption, sbillid);//Again得到選中項的文本

	if(!bGetBillStatus(sbillid))
	{
		AfxMessageBox("未結帳單據不能隱藏!");
		return;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲成人免费看| 中文字幕免费在线观看视频一区| 亚洲午夜私人影院| 欧美日韩国产综合一区二区三区| 亚洲品质自拍视频| 欧美日韩国产一区| 免费在线看一区| 久久精品日韩一区二区三区| 99re成人在线| 三级久久三级久久| ww久久中文字幕| 91老师国产黑色丝袜在线| 午夜精品久久久| 久久伊人中文字幕| 色嗨嗨av一区二区三区| 蜜臀久久99精品久久久久久9| 久久久精品中文字幕麻豆发布| 91在线免费看| 亚洲国产日韩综合久久精品| 精品国产凹凸成av人网站| 91视频一区二区| 日韩精品欧美成人高清一区二区| 久久久噜噜噜久噜久久综合| 在线免费不卡视频| 久久电影网电视剧免费观看| 中文字幕人成不卡一区| 7777女厕盗摄久久久| 国产一区二区不卡| 亚洲午夜激情av| 国产日韩欧美精品在线| av一二三不卡影片| 在线不卡一区二区| 国产91丝袜在线18| 日韩成人免费看| 亚洲欧美日韩在线| 久久色.com| 欧美精品v国产精品v日韩精品| 国产精品亚洲视频| 青青草国产成人av片免费| 亚洲人妖av一区二区| 精品国产91九色蝌蚪| 欧美专区日韩专区| kk眼镜猥琐国模调教系列一区二区| 奇米影视7777精品一区二区| 亚洲精品亚洲人成人网在线播放| 日韩午夜精品电影| 欧美日韩视频专区在线播放| 97超碰欧美中文字幕| 国产麻豆视频一区二区| 日韩av午夜在线观看| 一区二区三区视频在线看| 中国av一区二区三区| xnxx国产精品| 欧美大片日本大片免费观看| 欧美亚日韩国产aⅴ精品中极品| 国产麻豆精品theporn| 秋霞影院一区二区| 视频一区欧美日韩| 亚洲亚洲精品在线观看| 亚洲理论在线观看| 国产精品不卡视频| 国产精品美女久久久久久| 国产欧美精品一区| 久久毛片高清国产| 久久综合狠狠综合| 精品国产sm最大网站| 日韩欧美激情四射| 欧美α欧美αv大片| 制服丝袜日韩国产| 7777精品伊人久久久大香线蕉 | 777奇米成人网| 欧美无乱码久久久免费午夜一区| 91猫先生在线| 91小宝寻花一区二区三区| www.亚洲在线| 99精品桃花视频在线观看| 9人人澡人人爽人人精品| 成人久久18免费网站麻豆| 高清av一区二区| av中文字幕在线不卡| 99久久久久免费精品国产| 不卡av免费在线观看| 成人午夜精品在线| 99久久精品国产网站| 91黄色免费版| 欧美日韩在线免费视频| 91精品婷婷国产综合久久性色| 91精品国产综合久久久久久久| 欧美一区二区三区婷婷月色 | 男男视频亚洲欧美| 久久99在线观看| 国产精品1区2区| www.欧美亚洲| 91电影在线观看| 日韩丝袜美女视频| 国产日韩精品一区二区三区| 亚洲天堂网中文字| 亚洲第一会所有码转帖| 免费高清不卡av| 国产成人福利片| 色综合咪咪久久| 欧美一区二区人人喊爽| 欧美精品一区二区三区蜜臀| 国产精品久久久久久久第一福利 | 日本中文字幕一区二区有限公司| 精品一区二区三区免费毛片爱| 国产精品白丝jk黑袜喷水| 色久优优欧美色久优优| 欧美一区三区二区| 国产精品少妇自拍| 日韩精品亚洲一区| 国产黄色成人av| 欧美午夜在线一二页| 国产亚洲美州欧州综合国| 亚洲色图一区二区| 开心九九激情九九欧美日韩精美视频电影 | 日韩精品免费视频人成| 国产成人免费网站| 欧美日韩在线一区二区| 欧美国产日韩精品免费观看| 亚洲高清免费一级二级三级| 国产剧情av麻豆香蕉精品| 91福利国产精品| 国产亲近乱来精品视频| 日韩专区欧美专区| 成人av电影免费在线播放| 日韩亚洲欧美高清| 亚洲精品久久久蜜桃| 精品在线免费观看| 欧美剧在线免费观看网站| 国产精品美女久久久久av爽李琼| 日本网站在线观看一区二区三区| av网站一区二区三区| 欧美精品一区二区三区一线天视频| 一级特黄大欧美久久久| 成人av电影观看| 精品久久人人做人人爱| 午夜精品免费在线| 色综合中文字幕国产 | 欧美一区二区三区四区视频| 亚洲日本乱码在线观看| 国产高清在线精品| 精品国产乱码久久久久久久| 亚洲6080在线| 欧美三区免费完整视频在线观看| 亚洲欧美日韩久久| 成人少妇影院yyyy| 精品88久久久久88久久久| 天堂蜜桃91精品| 欧美日韩国产bt| 亚洲香蕉伊在人在线观| 日本韩国欧美一区| 亚洲精品一二三| 色一情一乱一乱一91av| 日韩毛片精品高清免费| 成人h版在线观看| 国产精品福利一区二区| 成人高清视频在线| 中文字幕的久久| 成人综合婷婷国产精品久久蜜臀| 久久精品一区二区三区不卡 | 91小视频在线观看| 成人欧美一区二区三区小说 | 欧美中文一区二区三区| 成人免费在线视频| 成人99免费视频| 亚洲日穴在线视频| 99国产精品一区| 亚洲精品国产无套在线观| 91在线你懂得| 亚洲国产精品久久不卡毛片| 欧美色视频一区| 日日摸夜夜添夜夜添精品视频 | 精品少妇一区二区三区在线视频 | 国产激情精品久久久第一区二区| 久久久久久夜精品精品免费| 国产精品一二二区| 国产精品久久久久精k8 | 91精品国产综合久久福利软件 | 成人黄色av网站在线| 亚洲天堂免费看| 欧美日韩亚洲另类| 蜜桃av一区二区| 久久久久久久久久久黄色| 国产69精品久久久久毛片| 亚洲欧洲精品一区二区精品久久久| 91亚洲精品久久久蜜桃网站| 亚洲国产精品影院| 日韩一区二区三| 国产成人在线网站| 亚洲欧美另类图片小说| 欧美精品v日韩精品v韩国精品v| 美女爽到高潮91| 国产精品电影院| 欧美日韩国产乱码电影| 国精品**一区二区三区在线蜜桃| 欧美激情一区二区三区四区| 欧美亚洲动漫制服丝袜| 国产一区二三区| 亚洲精品成人悠悠色影视|