您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 信息化管理 > pos机管理系统软件源代码
#if!defined(AFX_CLASSDLG_H__B6736001_C0BF_47D8_8A7A_A2540CC35379__INCLUDED_)#defineAFX_CLASSDLG_H__B6736001_C0BF_47D8_8A7A_A2540CC35379__INCLUDED_#if_MSC_VER1000#pragmaonce#endif//_MSC_VER1000//ClassDlg.h:headerfile/////////////////////////////////////////////////////////////////////////////////CClassDlgdialogclassCClassDlg:publicCDialog{//Constructionpublic:intCountMateriel(CStringsclassid);CClassDlg(CWnd*pParent=NULL);//standardconstructorstaticCStringVariantToCString(VARIANTvar);staticintTreeSumRecordCount(CStringstrFieldValue);//DialogData//{{AFX_DATA(CClassDlg)enum{IDD=IDD_DIALOG_CLASS};CButtonm_oRadiodiscount;CEditm_oClassname;CTreeCtrlm_oTreeclass;CStringm_classname;intm_radiodiscount;longm_tempid;//}}AFX_DATA//Overrides//ClassWizardgeneratedvirtualfunctionoverrides//{{AFX_VIRTUAL(CClassDlg)protected:virtualvoidDoDataExchange(CDataExchange*pDX);//DDX/DDVsupport//}}AFX_VIRTUAL//Implementationprotected://Generatedmessagemapfunctions//{{AFX_MSG(CClassDlg)afx_msgvoidOnSelchangedTreeClass(NMHDR*pNMHDR,LRESULT*pResult);virtualBOOLOnInitDialog();afx_msgvoidOnButtonAddsame();afx_msgvoidOnButtonAddsub();afx_msgvoidOnButtonDel();afx_msgvoidOnButtonSave();//}}AFX_MSGDECLARE_MESSAGE_MAP()private:intGenNewID();//GenerateanewrecordID.voidAddSubTree(CStringParTree,HTREEITEMhPartItem);voidAddTree();BOOLbRepeat(CStringstrFieldValue);HTREEITEMhCurrentItem,hParentItem;CStringCurpar;};//{{AFX_INSERT_LOCATION}}//MicrosoftVisualC++willinsertadditionaldeclarationsimmediatelybeforethepreviousline.#endif//!defined(AFX_CLASSDLG_H__B6736001_C0BF_47D8_8A7A_A2540CC35379__INCLUDED_)//ClassDlg.cpp:implementationfile//#includestdafx.h#includeMyPos.h#includeClassDlg.h#ifdef_DEBUG#definenewDEBUG_NEW#undefTHIS_FILEstaticcharTHIS_FILE[]=__FILE__;#endif///////////////////////////////////////////////////////////////////////////////CClassDlgdialogexternCMyPosApptheApp;CClassDlg::CClassDlg(CWnd*pParent/*=NULL*/):CDialog(CClassDlg::IDD,pParent){//{{AFX_DATA_INIT(CClassDlg)m_classname=_T();m_radiodiscount=-1;m_tempid=0;//}}AFX_DATA_INIT}voidCClassDlg::DoDataExchange(CDataExchange*pDX){CDialog::DoDataExchange(pDX);//{{AFX_DATA_MAP(CClassDlg)DDX_Control(pDX,IDC_RADIO1_DISCOUNT,m_oRadiodiscount);DDX_Control(pDX,IDC_EDIT_CLASSNAME,m_oClassname);DDX_Control(pDX,IDC_TREE_CLASS,m_oTreeclass);DDX_Text(pDX,IDC_EDIT_CLASSNAME,m_classname);DDX_Radio(pDX,IDC_RADIO1_DISCOUNT,m_radiodiscount);DDX_Text(pDX,IDC_TEMPID,m_tempid);//}}AFX_DATA_MAP}BEGIN_MESSAGE_MAP(CClassDlg,CDialog)//{{AFX_MSG_MAP(CClassDlg)ON_NOTIFY(TVN_SELCHANGED,IDC_TREE_CLASS,OnSelchangedTreeClass)ON_BN_CLICKED(IDC_BUTTON_ADDSAME,OnButtonAddsame)ON_BN_CLICKED(IDC_BUTTON_ADDSUB,OnButtonAddsub)ON_BN_CLICKED(IDC_BUTTON_DEL,OnButtonDel)ON_BN_CLICKED(IDC_BUTTON_SAVE,OnButtonSave)//}}AFX_MSG_MAPEND_MESSAGE_MAP()///////////////////////////////////////////////////////////////////////////////CClassDlgmessagehandlersvoidCClassDlg::OnSelchangedTreeClass(NMHDR*pNMHDR,LRESULT*pResult){NM_TREEVIEW*pNMTreeView=(NM_TREEVIEW*)pNMHDR;CStringsql;CStringcurtext;_RecordsetPtrm_pRecordset;//Mustdefineitinfunction!!!HTREEITEMhCurItem;hCurItem=m_oTreeclass.GetSelectedItem();//GetCurrentitemanditssubitems.curtext=m_oTreeclass.GetItemText(hCurItem);//Readcurrentitemtextintoeditcontrol.m_classname=curtext;sql=SELECT*FROMMATERIELCLASSwhereNAME='+curtext+';try{m_tempid=0;m_pRecordset.CreateInstance(ADODB.Recordset);m_pRecordset-Open((_variant_t)sql,_variant_t((IDispatch*)theApp.m_pConnection,true),adOpenDynamic,adLockOptimistic,adCmdText);if(!m_pRecordset-adoEOF){m_tempid=(long)(m_pRecordset-GetCollect(ID));Curpar=VariantToCString(m_pRecordset-GetCollect(PARENT));if((float)(m_pRecordset-GetCollect(DISCOUNT))==0)m_radiodiscount=0;if((float)(m_pRecordset-GetCollect(DISCOUNT))==1)m_radiodiscount=1;}m_pRecordset-Close();}catch(_com_errore)///捕捉异常{CStringerrormessage;MessageBox(读取单选按钮出错!,m_classname);}UpdateData(false);*pResult=0;}voidCClassDlg::AddSubTree(CStringParTree,HTREEITEMhPartItem){HTREEITEMhCurrent;CStringsql;CStringcurID;_RecordsetPtrm_pTRecordset;//Mustdefineitinfunction!!!BecoursethisisaRECURSIONfunction.sql=SELECT*FROMMATERIELCLASSwherePARENT=';sql=sql+ParTree+';//The1sttimePartree=1.try{m_pTRecordset.CreateInstance(ADODB.Recordset);m_pTRecordset-Open((_variant_t)sql,_variant_t((IDispatch*)theApp.m_pConnection,true),adOpenDynamic,adLockOptimistic,adCmdText);m_pTRecordset-MoveFirst();if(!m_pTRecordset-adoEOF){while(!m_pTRecordset-adoEOF){hCurrent=m_oTreeclass.InsertItem((LPCTSTR)(_bstr_t)(m_pTRecordset-GetCollect(NAME)),hPartItem,NULL);//Insertanitemintocurrentparent.curID=VariantToCString(m_pTRecordset-GetCollect(ID));if(TreeSumRecordCount(curID)0)AddSubTree(VariantToCString(m_pTRecordset-GetCollect(ID)),hCurrent);//Recursion.if(!m_pTRecordset-adoEOF)m_pTRecordset-MoveNext();}}m_pTRecordset-Close();}catch(_com_errore)///捕捉异常{CStringerrormessage;MessageBox(读取类别子树出错!,ParTree);}}voidCClassDlg::AddTree(){TVINSERTSTRUCTtvInsert;HTREEITEMhParent;_RecordsetPtrm_pTRecordset;//Mustdefineitinfuncti
本文标题:pos机管理系统软件源代码
链接地址:https://www.777doc.com/doc-2852084 .html