悠悠同学网www.uuclass.com
}
}
_variant_t vtemp = m_pRecordset->GetCollect(\if(vtemp.dblVal>0) else
ftotal=0;
ftotal=(float)m_pRecordset->GetCollect(\
stotal.Format(\m_oTotalm.SetWindowText(stotal); m_oConsume.SetWindowText(stotal);
catch(_com_error e)///捕捉异常 { }
CString temp;
temp.Format(\结帐]计算单据商品金额出错:%s\AfxMessageBox(temp);
return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE
void CCheckDlg::OnButtonCheckok() {
m_oConsume.GetWindowText(stotal); m_oTotalm.GetWindowText(sbilltotal); int nselect=m_oCombopay.GetCurSel(); m_oCombopay.GetLBText(nselect,spaymode); CString stotal,sbilltotal,spayID,sql,spaymode,snowtime; long lpayID;
_RecordsetPtr m_pRecordset;
悠悠同学网www.uuclass.com
lpayID=GetPaymodeID(spaymode); spayID.Format(\
if(fchange<0)
return;
//得到系统时间
CTime now=CTime::GetCurrentTime();
snowtime=now.Format(_T(\sql=\
SALEBILL
set
ENDDATE='\
+stotal+\已结帐',PAYMODE=\
where ID='\
try { }
catch(_com_error e)///捕捉异常 { }
//output the checkout time and paymode to the print. theApp.snowtimep=snowtime; theApp.spaymodep=spaymode; theApp.sconsume=stotal; theApp.sactsum=sbilltotal;
CString temp;
temp.Format(\结帐]单据头更新数据库出错:%s\AfxMessageBox(temp); return;
_variant_t RecordsAffected;
theApp.m_pConnection->Execute((_bstr_t)sql,&RecordsAffected,adCmdText);
悠悠同学网www.uuclass.com
//Insert data into PAYDETAIL.
CString sclass,scontotal,sdiscount,sacttotal,svaltotal; int nItemCount=m_oChecklist.GetItemCount();//表项总数 for(int i=0;i sclass=m_oChecklist.GetItemText(i,0); scontotal=m_oChecklist.GetItemText(i,1); sdiscount=m_oChecklist.GetItemText(i,3); sacttotal=m_oChecklist.GetItemText(i,4); float fvaltotal=atof(scontotal)-atof(sacttotal); svaltotal.Format(\sql=\ into PAYDETAIL(BILLID,CLASS,TOTAL,DISCOUNT,ACTTOTAL,VALTOTAL) values('\ try { } catch(_com_error e)///捕捉异常 { CString temp; temp.Format(\结帐]付款明细(PAYDETAIL)插入数据出_variant_t RecordsAffected; theApp.m_pConnection->Execute((_bstr_t)sql,&RecordsAffected,adCmdText); \ 错:%s\ } } AfxMessageBox(temp); return; 悠悠同学网www.uuclass.com } //When the check button is click down,send a message(WM_CHECKOUT) to the CPosDlg. LRESULT Res=::SendMessage(theApp.pWnd, WM_CHECKOUT, 0, 0); CDialog::OnOK(); long CCheckDlg::GetPaymodeID(CString payname) { m_pRecordset->Open((_variant_t)sql,_variant_t((IDispatch*)theApp.m_pConnection,true),along paymodeID; _RecordsetPtr m_pRecordset; CString sql=\try { m_pRecordset.CreateInstance(\ dOpenStatic,adLockOptimistic,adCmdText); } void CCheckDlg::OnChangeEditReceive() } catch(_com_error e)///捕捉异常 { } return paymodeID; CString temp; temp.Format(\结帐]获取付款方式ID出错:%s\AfxMessageBox(temp); paymodeID=(long)m_pRecordset->GetCollect(\ 悠悠同学网www.uuclass.com { // TODO: If this is a RICHEDIT control, the control will not // send this notification unless you override the CDialog::OnInitDialog() // function and call CRichEditCtrl().SetEventMask() // with the ENM_CHANGE flag ORed into the mask. CString sreceive,schange,stotal; m_oChange.SetWindowText(\ m_oReceive.GetWindowText(sreceive); m_oTotalm.GetWindowText(stotal); fchange=atof(sreceive)-atof(stotal); if(fchange>=0) { schange.Format(\ m_oChange.SetWindowText(schange); } } void CCheckDlg::ReadtoList(CString sbillid) { _RecordsetPtr m_pRecordset; //Must define it in function!!!! CString sql,sclassname,sclassname1,sctotal; long lclassid; float fctotal=0; sql=\Sum(ITEMTOTAL) as XXX,CLASSID from BILLID='\ //删除所有list中的数据。 m_oChecklist.DeleteAllItems(); SALEDETAIL where