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

📄 medicinesalemanagesdlg.cpp

📁 一个简易的医药销售管理系统源码
💻 CPP
📖 第 1 页 / 共 5 页
字号:
		m_pRecordset=NULL;*/
		strSQL="select * from unit";
		if (SUCCEEDED(hTRes))
		{
			hTRes = m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(strSQL.GetLength()+1),
					((CMedicineSaleManagesApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
					adOpenDynamic,adLockPessimistic,adCmdText);
		}
		else
		{
			theApp.EndWaitCursor();
			AfxMessageBox("打开数据源出错,不能更新!");
			m_pRecordset->Close();
			m_pRecordset=NULL;
			return;
		}
		while(!(m_pRecordset->adoEOF))
		{
			rang++;
			if(!(m_pRecordset->adoEOF))
				m_pRecordset->MoveNext();
		}
		m_pRecordset->Close();
		strSQL="select * from price";
		if (SUCCEEDED(hTRes))
		{
			hTRes = m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(strSQL.GetLength()+1),
					((CMedicineSaleManagesApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
					adOpenDynamic,adLockPessimistic,adCmdText);
		}
		else
		{
			theApp.EndWaitCursor();
			AfxMessageBox("打开数据源出错,不能更新!");
			m_pRecordset->Close();
			m_pRecordset=NULL;
			return;
		}
		while(!(m_pRecordset->adoEOF))
		{
			rang++;
			if(!(m_pRecordset->adoEOF))
				m_pRecordset->MoveNext();
		}
		m_pRecordset->Close();
		strSQL="select * from medtype";
		if (SUCCEEDED(hTRes))
		{
			hTRes = m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(strSQL.GetLength()+1),
					((CMedicineSaleManagesApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
					adOpenDynamic,adLockPessimistic,adCmdText);
		}
		else
		{
			theApp.EndWaitCursor();
			AfxMessageBox("打开数据源出错,不能更新!");
			m_pRecordset->Close();
			m_pRecordset=NULL;
			return;
		}
		while(!(m_pRecordset->adoEOF))
		{
			rang++;
			if(!(m_pRecordset->adoEOF))
				m_pRecordset->MoveNext();
		}
		m_pRecordset->Close();
		m_progress1.SetRange(1,rang+13);//每增加一张表就增加2
		m_progress1.SetStep(1);
		strSQL="drop table products";
		(((CMedicineSaleManagesApp*)AfxGetApp())->m_pConn1)->Execute((_bstr_t)strSQL,NULL,adCmdText);
		strSQL="CREATE TABLE products (";
		strSQL+="product_id int IDENTITY (1, 1) NOT NULL ,";
		strSQL+="class_id varchar(30) NOT NULL ,";
		strSQL+="parent_id varchar(30) NOT NULL ,";
		strSQL+="child_number int NOT NULL ,";
		strSQL+="child_count int NOT NULL ,";
		strSQL+="serial_number varchar(26) NOT NULL ,";
		strSQL+="name varchar(80) NOT NULL ,";
		strSQL+="alias varchar(30) NOT NULL ,";
		strSQL+="standard varchar(20) NOT NULL ,";
		strSQL+="modal varchar(20) NOT NULL ,";
		strSQL+="permitcode varchar(50) NOT NULL ,";
		strSQL+="trademark varchar(50) NOT NULL ,";
		strSQL+="makearea varchar(60) NOT NULL ,";
		strSQL+="unit1_id smallint NOT NULL ,";
		strSQL+="unit2_id smallint NOT NULL ,";
		strSQL+="unit3_id smallint NOT NULL ,";
		strSQL+="unit4_id smallint NOT NULL ,";
		strSQL+="rate2 float NOT NULL ,";
		strSQL+="rate3 float NOT NULL ,";
		strSQL+="rate4 float NOT NULL ,";
		strSQL+="validmonth smallint NOT NULL ,";
		strSQL+="validday smallint NOT NULL ,";
		strSQL+="comment varchar(250) NOT NULL ,";
		strSQL+="deleted bit NOT NULL ,";
		strSQL+="pinyin varchar(80) NOT NULL ,";
		strSQL+="firstcheck bit NOT NULL ,";
		strSQL+="validcheck bit NOT NULL ,";
		strSQL+="otcflag char(1) NOT NULL ,";
		strSQL+="gspflag char(1) NOT NULL ,";
		strSQL+="medtype smallint NOT NULL ,";
		strSQL+="costmethod char(1) NOT NULL ,";
		strSQL+="EngName varchar(50) NOT NULL ,";
		strSQL+="ChemName varchar(50) NOT NULL ,";
		strSQL+="LatinName varchar(50) NOT NULL ,";
		strSQL+="deduct money NOT NULL ,";
		strSQL+="OTCType tinyint NOT NULL ,";
		strSQL+="GMP bit NOT NULL ,";
		strSQL+="Gross numeric(18, 4) NOT NULL ,";
		strSQL+="MaintainType tinyint NOT NULL ,";
		strSQL+="MaintainDay int NOT NULL ,";
		strSQL+="ModifyDate timestamp ,";//NOT NULL
		strSQL+="r_id int NOT NULL ,";
		strSQL+="PackStd varchar(60) NOT NULL ,";
		strSQL+="StorageCon varchar(60) NOT NULL ,";
		strSQL+="TaxRate float NOT NULL ,";
		strSQL+="supplier_id int NOT NULL ,";
		strSQL+="emp_id int NOT NULL ,";
		strSQL+="tcmoney float NOT NULL ,";
		strSQL+="Profit float NOT NULL ,";
		strSQL+="PosYhDay int NOT NULL) ";
		(((CMedicineSaleManagesApp*)AfxGetApp())->m_pConn1)->Execute((_bstr_t)strSQL,NULL,adCmdText);//建立product表
		strSQL.Empty();
		m_progress1.StepIt();
		//
		m_progress1.SetStep(1);
		strSQL="drop table medtype";
		(((CMedicineSaleManagesApp*)AfxGetApp())->m_pConn1)->Execute((_bstr_t)strSQL,NULL,adCmdText);
		strSQL="CREATE TABLE medtype (";
		strSQL+="mt_id int ,";
		strSQL+="mt_code char(4) ,";
		strSQL+="mt_name char(12) ,";
		strSQL+="deleted bit ,";
		strSQL+="ModifyDate timestamp)";
		(((CMedicineSaleManagesApp*)AfxGetApp())->m_pConn1)->Execute((_bstr_t)strSQL,NULL,adCmdText);//建立product表
		strSQL.Empty();
		m_progress1.StepIt();
		//
		/*strSQL="drop table productdetail";
		(((CMedicineSaleManagesApp*)AfxGetApp())->m_pConn1)->Execute((_bstr_t)strSQL,NULL,adCmdText);
		strSQL="CREATE TABLE productdetail (";
		strSQL+="pd_id int IDENTITY (1, 1) NOT NULL ,";
		strSQL+="billid int NOT NULL ,";
		strSQL+="p_id int NOT NULL ,";
		strSQL+="s_id int NOT NULL ,";
		strSQL+="quantity numeric(18, 4) NOT NULL ,";
		strSQL+="price numeric(20, 8) NOT NULL ,";
		strSQL+="total numeric(18, 4) NOT NULL ,";
		strSQL+="costprice numeric(18, 4) NOT NULL ,";
		strSQL+="costtotal numeric(18, 4) NOT NULL ,";
		strSQL+="taxprice numeric(20, 8) NOT NULL ,";
		strSQL+="taxtotal numeric(18, 4) NOT NULL ,";
		strSQL+="batchno varchar(20) NOT NULL ,";
		strSQL+="makedate datetime NOT NULL ,";
		strSQL+="validdate datetime NOT NULL ,";
		strSQL+="commissionflag tinyint NOT NULL ,";
		strSQL+="supplier_id int NOT NULL ,";
		strSQL+="location_id int NOT NULL ,";
		strSQL+="storetype tinyint NOT NULL ,";
		strSQL+="price_id int NOT NULL ,";
		strSQL+="order_id int NOT NULL ,";
		strSQL+="unitid int NOT NULL ,";
		strSQL+="smb_id int NOT NULL ,";
		strSQL+="comment varchar(255) NOT NULL ,";
		strSQL+="oldcommissionflag int NOT NULL ,";
		strSQL+="jsprice float NOT NULL)";
		(((CMedicineSaleManagesApp*)AfxGetApp())->m_pConn1)->Execute((_bstr_t)strSQL,NULL,adCmdText);//建立productdetail表
		strSQL.Empty();
		m_progress1.StepIt();
		strSQL="drop table billidx";
		(((CMedicineSaleManagesApp*)AfxGetApp())->m_pConn1)->Execute((_bstr_t)strSQL,NULL,adCmdText);
		strSQL="CREATE TABLE billidx (";
		strSQL+="billid int IDENTITY (1, 1) NOT NULL ,";
		strSQL+="billdate datetime NOT NULL ,";
		strSQL+="billnumber varchar(20),";
		strSQL+="billtype smallint NOT NULL ,";
		strSQL+="a_id int NOT NULL ,";
		strSQL+="c_id int NOT NULL ,";
		strSQL+="e_id int NOT NULL ,";
		strSQL+="sout_id int NOT NULL ,";
		strSQL+="sin_id int NOT NULL ,";
		strSQL+="auditman int NOT NULL ,";
		strSQL+="inputman int NOT NULL ,";
		strSQL+="ysmoney numeric(18, 4) NOT NULL ,";
		strSQL+="ssmoney numeric(18, 4) NOT NULL ,";
		strSQL+="quantity numeric(18, 4) NOT NULL ,";
		strSQL+="taxrate numeric(5, 2) NOT NULL ,";
		strSQL+="period smallint NOT NULL ,";
		strSQL+="billstates char(1),";
		strSQL+="order_id int NOT NULL ,";
		strSQL+="department_id int NOT NULL ,";
		strSQL+="posid int NOT NULL ,";
		strSQL+="region_id int NOT NULL ,";
		strSQL+="auditdate datetime NOT NULL ,";
		strSQL+="skdate datetime NOT NULL ,";
		strSQL+="jsye numeric(18, 4) NOT NULL ,";
		strSQL+="jsflag char(1),";
		//strSQL+="note varchar(256),";
		//strSQL+="summary varchar(256),";
		//strSQL+="invoice int NOT NULL ,";
		//strSQL+="transcount tinyint NOT NULL ,";
		//strSQL+="lasttranstime datetime NOT NULL ,";
		//strSQL+="GUID uniqueidentifier ROWGUIDCOL NOT NULL ,";
		//strSQL+="InvoiceTotal numeric(18, 4) NOT NULL ,";
		//strSQL+="InvoiceNO varchar(12),";
		strSQL+="BusinessType tinyint NOT NULL)";
		(((CMedicineSaleManagesApp*)AfxGetApp())->m_pConn1)->Execute((_bstr_t)strSQL,NULL,adCmdText);//建立billidx表
		strSQL.Empty();
		m_progress1.StepIt();*/
		strSQL="drop table price";
		(((CMedicineSaleManagesApp*)AfxGetApp())->m_pConn1)->Execute((_bstr_t)strSQL,NULL,adCmdText);
		strSQL="CREATE TABLE price (";
		strSQL+="price_id int IDENTITY (1, 1) NOT NULL ,";
		strSQL+="p_id int NOT NULL ,";
		strSQL+="u_id smallint NOT NULL ,";
		strSQL+="retailprice money NOT NULL ,";
		strSQL+="recprice money NOT NULL ,";
		strSQL+="price1 money NOT NULL ,";
		strSQL+="price2 money NOT NULL ,";
		strSQL+="price3 money NOT NULL ,";
		strSQL+="price4 money NOT NULL ,";
		strSQL+="gpprice money NOT NULL ,";
		strSQL+="glprice money NOT NULL ,";
		strSQL+="specialprice money NOT NULL ,";
		strSQL+="unittype tinyint NOT NULL ,";
		strSQL+="lowprice money NOT NULL ,";
		strSQL+="ModifyDate timestamp ,";// NOT NULL
		strSQL+="lastprice numeric(20, 8) NOT NULL ,";
		strSQL+="lasttime datetime NOT NULL ,";
		strSQL+="billid int NOT NULL)";
		(((CMedicineSaleManagesApp*)AfxGetApp())->m_pConn1)->Execute((_bstr_t)strSQL,NULL,adCmdText);
		strSQL.Empty();
		m_progress1.StepIt();
		strSQL="drop table unit";
		(((CMedicineSaleManagesApp*)AfxGetApp())->m_pConn1)->Execute((_bstr_t)strSQL,NULL,adCmdText);
		strSQL="CREATE TABLE unit (";
		strSQL+="unit_id int,";// IDENTITY (1, 1) NOT NULL 
		strSQL+="name varchar (10),";// NOT NULL 
		strSQL+="ModifyDate timestamp,";// NOT NULL
		strSQL+="deleted bit)";// NOT NULL
		(((CMedicineSaleManagesApp*)AfxGetApp())->m_pConn1)->Execute((_bstr_t)strSQL,NULL,adCmdText);//建立unit表
		strSQL.Empty();
		m_progress1.StepIt();
		m_pRecordset1.CreateInstance(__uuidof(Recordset));
		try
		{
			CString strSQL="SELECT * FROM products";
			m_pRecordset1->Open((LPTSTR)strSQL.GetBuffer(strSQL.GetLength()+1),
					((CMedicineSaleManagesApp*)AfxGetApp())->m_pConn1.GetInterfacePtr(),
					adOpenDynamic,adLockPessimistic,adCmdText);
		}
		catch(_com_error *e)
		{
			AfxMessageBox(e->ErrorMessage());
		}
		strSQL="select * from products";
		m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(strSQL.GetLength()+1),
				((CMedicineSaleManagesApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
				adOpenDynamic,adLockPessimistic,adCmdText);
		while(!(m_pRecordset->adoEOF))
		{
			m_pRecordset1->AddNew();
			m_pRecordset1->PutCollect("class_id",m_pRecordset->GetCollect("class_id"));
			m_pRecordset1->PutCollect("parent_id",m_pRecordset->GetCollect("parent_id"));
			m_pRecordset1->PutCollect("child_number",m_pRecordset->GetCollect("child_number"));
			m_pRecordset1->PutCollect("child_count",m_pRecordset->GetCollect("child_count"));
			m_pRecordset1->PutCollect("serial_number",m_pRecordset->GetCollect("serial_number"));
			m_pRecordset1->PutCollect("name",m_pRecordset->GetCollect("name"));
			m_pRecordset1->PutCollect("alias",m_pRecordset->GetCollect("alias"));
			m_pRecordset1->PutCollect("standard",m_pRecordset->GetCollect("standard"));
			m_pRecordset1->PutCollect("modal",m_pRecordset->GetCollect("modal"));
			m_pRecordset1->PutCollect("permitcode",m_pRecordset->GetCollect("permitcode"));
			m_pRecordset1->PutCollect("trademark",m_pRecordset->GetCollect("trademark"));
			m_pRecordset1->PutCollect("makearea",m_pRecordset->GetCollect("makearea"));
			m_pRecordset1->PutCollect("unit1_id",m_pRecordset->GetCollect("unit1_id"));
			m_pRecordset1->PutCollect("unit2_id",m_pRecordset->GetCollect("unit2_id"));
			m_pRecordset1->PutCollect("unit3_id",m_pRecordset->GetCollect("unit3_id"));
			m_pRecordset1->PutCollect("unit4_id",m_pRecordset->GetCollect("unit4_id"));
			m_pRecordset1->PutCollect("rate2",m_pRecordset->GetCollect("rate2"));
			m_pRecordset1->PutCollect("rate3",m_pRecordset->GetCollect("rate3"));
			m_pRecordset1->PutCollect("rate4",m_pRecordset->GetCollect("rate4"));
			m_pRecordset1->PutCollect("validmonth",m_pRecordset->GetCollect("validmonth"));
			m_pRecordset1->PutCollect("validday",m_pRecordset->GetCollect("validday"));
			m_pRecordset1->PutCollect("comment",m_pRecordset->GetCollect("comment"));
			m_pRecordset1->PutCollect("deleted",m_pRecordset->GetCollect("deleted"));
			m_pRecordset1->PutCollect("pinyin",m_pRecordset->GetCollect("pinyin"));
			m_pRecordset1->PutCollect("firstcheck",m_pRecordset->GetCollect("firstcheck"));
			m_pRecordset1->PutCollect("validcheck",m_pRecordset->GetCollect("validcheck"));
			m_pRecordset1->PutCollect("otcflag",m_pRecordset->GetCollect("otcflag"));
			m_pRecordset1->PutCollect("gspflag",m_pRecordset->GetCollect("gspflag"));
			m_pRecordset1->PutCollect("medtype",m_pRecordset->GetCollect("medtype"));
			m_pRecordset1->PutCollect("costmethod",m_pRecordset->GetCollect("costmethod"));
			m_pRecordset1->PutCollect("EngName",m_pRecordset->GetCollect("EngName"));
			m_pRecordset1->PutCollect("ChemName",m_pRecordset->GetCollect("ChemName"));
			m_pRecordset1->PutCollect("LatinName",m_pRecordset->GetCollect("LatinName"));
			m_pRecordset1->PutCollect("deduct",m_pRecordset->GetCollect("deduct"));
			m_pRecordset1->PutCollect("OTCType",m_pRecordset->GetCollect("OTCType"));
			m_pRecordset1->PutCollect("GMP",m_pRecordset->GetCollect("GMP"));
			m_pRecordset1->PutCollect("Gross",m_pRecordset->GetCollect("Gross"));
			m_pRecordset1->PutCollect("MaintainType",m_pRecordset->GetCollect("MaintainType"));
			m_pRecordset1->PutCollect("MaintainDay",m_pRecordset->GetCollect("MaintainDay"));
			//m_pRecordset1->PutCollect("ModifyDate",m_pRecordset->GetCollect("ModifyDate"));
			m_pRecordset1->PutCollect("r_id",m_pRecordset->GetCollect("r_id"));
			m_pRecordset1->PutCollect("PackStd",m_pRecordset->GetCollect("PackStd"));
			m_pRecordset1->PutCollect("StorageCon",m_pRecordset->GetCollect("StorageCon"));
			m_pRecordset1->PutCollect("TaxRate",m_pRecordset->GetCollect("TaxRate"));
			m_pRecordset1->PutCollect("supplier_id",m_pRecordset->GetCollect("supplier_id"));
			m_pRecordset1->PutCollect("emp_id",m_pRecordset->GetCollect("emp_id"));
			m_pRecordset1->PutCollect("tcmoney",m_pRecordset->GetCollect("tcmoney"));
			m_pRecordset1->PutCollect("Profit",m_pRecordset->GetCollect("Profit"));
			m_pRecordset1->PutCollect("PosYhDay",m_pRecordset->GetCollect("PosYhDay"));
			m_pRecordset1->Update();
			if(!(m_pRecordset->adoEOF))
				m_pRecordset->MoveNext();
			m_progress1.StepIt();
		}
		m_pRecordset->Close();
		m_pRecordset1->Close();
		/*try
		{
			CString strSQL="SELECT * FROM productdetail";
			m_pRecordset1->Open((LPTSTR)strSQL.GetBuffer(strSQL.GetLength()+1),
					((CMedicineSaleManagesApp*)AfxGetApp())->m_pConn1.GetInterfacePtr(),
					adOpenDynamic,adLockPessimistic,adCmdText);
		}
		catch(_com_error *e)
		{
			AfxMessageBox(e->ErrorMessage());
		}
		strSQL="select * from productdetail";
		m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(strSQL.GetLength()+1),
				((CMedicineSaleManagesApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
				adOpenDynamic,adLockPessimistic,adCmdText);
		while(!(m_pRecordset->adoEOF))
		{
			m_pRecordset1->AddNew();
			m_pRecordset1->PutCollect("billid",m_pRecordset->GetCollect("billid"));
			m_pRecordset1->PutCollect("p_id",m_pRecordset->GetCollect("p_id"));
			m_pRecordset1->PutCollect("s_id",m_pRecordset->GetCollect("s_id"));
			m_pRecordset1->PutCollect("quantity",m_pRecordset->GetCollect("quantity"));
			m_pRecordset1->PutCollect("price",m_pRecordset->GetCollect("price"));

⌨️ 快捷键说明

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