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

📄 wupinxiaofei.h

📁 采用VC++.net做的超市收银管理系统
💻 H
📖 第 1 页 / 共 4 页
字号:
			this->oleDbDeleteCommand3->CommandText = S"DELETE FROM 物品表 WHERE (WID = \?)";
			this->oleDbDeleteCommand3->Connection = this->oleDbConnection1;
			this->oleDbDeleteCommand3->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"Original_WID", System::Data::OleDb::OleDbType::VarChar, 10, System::Data::ParameterDirection::Input, false, (System::Byte)0, (System::Byte)0, S"WID", System::Data::DataRowVersion::Original, 0));
			// 
			// oleDbInsertCommand3
			// 
			this->oleDbInsertCommand3->CommandText = S"INSERT INTO 物品表(WID, WNAME, MODEL, PRODUCER, SELLPRICE, STOCKPRICE, STOCK, LASTST" 
				S"OCK, MAXSTOCK, STOCKCHA) VALUES (\?, \?, \?, \?, \?, \?, \?, \?, \?, \?)";
			this->oleDbInsertCommand3->Connection = this->oleDbConnection1;
			this->oleDbInsertCommand3->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"WID", System::Data::OleDb::OleDbType::VarChar, 10, S"WID"));
			this->oleDbInsertCommand3->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"WNAME", System::Data::OleDb::OleDbType::VarChar, 30, S"WNAME"));
			this->oleDbInsertCommand3->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"MODEL", System::Data::OleDb::OleDbType::VarChar, 10, S"MODEL"));
			this->oleDbInsertCommand3->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"PRODUCER", System::Data::OleDb::OleDbType::VarChar, 20, S"PRODUCER"));
			this->oleDbInsertCommand3->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"SELLPRICE", System::Data::OleDb::OleDbType::Double, 8, S"SELLPRICE"));
			this->oleDbInsertCommand3->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"STOCKPRICE", System::Data::OleDb::OleDbType::Double, 8, S"STOCKPRICE"));
			this->oleDbInsertCommand3->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"STOCK", System::Data::OleDb::OleDbType::Integer, 4, S"STOCK"));
			this->oleDbInsertCommand3->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"LASTSTOCK", System::Data::OleDb::OleDbType::Integer, 4, S"LASTSTOCK"));
			this->oleDbInsertCommand3->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"MAXSTOCK", System::Data::OleDb::OleDbType::Integer, 4, S"MAXSTOCK"));
			this->oleDbInsertCommand3->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"STOCKCHA", System::Data::OleDb::OleDbType::Integer, 4, S"STOCKCHA"));
			// 
			// oleDbSelectCommand3
			// 
			this->oleDbSelectCommand3->CommandText = S"SELECT WID, WNAME, MODEL, PRODUCER, SELLPRICE, STOCKPRICE, STOCK, LASTSTOCK, MAXS" 
				S"TOCK, STOCKCHA FROM 物品表";
			this->oleDbSelectCommand3->Connection = this->oleDbConnection1;
			// 
			// oleDbUpdateCommand3
			// 
			this->oleDbUpdateCommand3->CommandText = S"UPDATE 物品表 SET WID = \?, WNAME = \?, MODEL = \?, PRODUCER = \?, SELLPRICE = \?, STOCKP" 
				S"RICE = \?, STOCK = \?, LASTSTOCK = \?, MAXSTOCK = \?, STOCKCHA = \? WHERE (WID = \?)";
			this->oleDbUpdateCommand3->Connection = this->oleDbConnection1;
			this->oleDbUpdateCommand3->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"WID", System::Data::OleDb::OleDbType::VarChar, 10, S"WID"));
			this->oleDbUpdateCommand3->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"WNAME", System::Data::OleDb::OleDbType::VarChar, 30, S"WNAME"));
			this->oleDbUpdateCommand3->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"MODEL", System::Data::OleDb::OleDbType::VarChar, 10, S"MODEL"));
			this->oleDbUpdateCommand3->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"PRODUCER", System::Data::OleDb::OleDbType::VarChar, 20, S"PRODUCER"));
			this->oleDbUpdateCommand3->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"SELLPRICE", System::Data::OleDb::OleDbType::Double, 8, S"SELLPRICE"));
			this->oleDbUpdateCommand3->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"STOCKPRICE", System::Data::OleDb::OleDbType::Double, 8, S"STOCKPRICE"));
			this->oleDbUpdateCommand3->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"STOCK", System::Data::OleDb::OleDbType::Integer, 4, S"STOCK"));
			this->oleDbUpdateCommand3->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"LASTSTOCK", System::Data::OleDb::OleDbType::Integer, 4, S"LASTSTOCK"));
			this->oleDbUpdateCommand3->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"MAXSTOCK", System::Data::OleDb::OleDbType::Integer, 4, S"MAXSTOCK"));
			this->oleDbUpdateCommand3->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"STOCKCHA", System::Data::OleDb::OleDbType::Integer, 4, S"STOCKCHA"));
			this->oleDbUpdateCommand3->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"Original_WID", System::Data::OleDb::OleDbType::VarChar, 10, System::Data::ParameterDirection::Input, false, (System::Byte)0, (System::Byte)0, S"WID", System::Data::DataRowVersion::Original, 0));
			// 
			// oleDbDataAdapter4
			// 
			this->oleDbDataAdapter4->InsertCommand = this->oleDbInsertCommand4;
			this->oleDbDataAdapter4->SelectCommand = this->oleDbSelectCommand4;
			System::Data::Common::DataTableMapping* __mcTemp__7[] = new System::Data::Common::DataTableMapping*[1];
			System::Data::Common::DataColumnMapping* __mcTemp__8[] = new System::Data::Common::DataColumnMapping*[9];
			__mcTemp__8[0] = new System::Data::Common::DataColumnMapping(S"SID", S"SID");
			__mcTemp__8[1] = new System::Data::Common::DataColumnMapping(S"SNAME", S"SNAME");
			__mcTemp__8[2] = new System::Data::Common::DataColumnMapping(S"SMODEL", S"SMODEL");
			__mcTemp__8[3] = new System::Data::Common::DataColumnMapping(S"SPRODUCER", S"SPRODUCER");
			__mcTemp__8[4] = new System::Data::Common::DataColumnMapping(S"SSELLPRICE", S"SSELLPRICE");
			__mcTemp__8[5] = new System::Data::Common::DataColumnMapping(S"SQUANTITY", S"SQUANTITY");
			__mcTemp__8[6] = new System::Data::Common::DataColumnMapping(S"SWNAME", S"SWNAME");
			__mcTemp__8[7] = new System::Data::Common::DataColumnMapping(S"SDATE", S"SDATE");
			__mcTemp__8[8] = new System::Data::Common::DataColumnMapping(S"YID", S"YID");
			__mcTemp__7[0] = new System::Data::Common::DataTableMapping(S"Table", S"消费表", __mcTemp__8);
			this->oleDbDataAdapter4->TableMappings->AddRange(__mcTemp__7);
			// 
			// oleDbInsertCommand4
			// 
			this->oleDbInsertCommand4->CommandText = S"INSERT INTO 消费表(SID, SNAME, SMODEL, SPRODUCER, SSELLPRICE, SQUANTITY, SWNAME, SDA" 
				S"TE, YID) VALUES (\?, \?, \?, \?, \?, \?, \?, \?, \?)";
			this->oleDbInsertCommand4->Connection = this->oleDbConnection1;
			this->oleDbInsertCommand4->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"SID", System::Data::OleDb::OleDbType::VarChar, 10, S"SID"));
			this->oleDbInsertCommand4->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"SNAME", System::Data::OleDb::OleDbType::VarChar, 20, S"SNAME"));
			this->oleDbInsertCommand4->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"SMODEL", System::Data::OleDb::OleDbType::VarChar, 10, S"SMODEL"));
			this->oleDbInsertCommand4->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"SPRODUCER", System::Data::OleDb::OleDbType::VarChar, 20, S"SPRODUCER"));
			this->oleDbInsertCommand4->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"SSELLPRICE", System::Data::OleDb::OleDbType::Double, 8, S"SSELLPRICE"));
			this->oleDbInsertCommand4->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"SQUANTITY", System::Data::OleDb::OleDbType::Integer, 4, S"SQUANTITY"));
			this->oleDbInsertCommand4->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"SWNAME", System::Data::OleDb::OleDbType::VarChar, 30, S"SWNAME"));
			this->oleDbInsertCommand4->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"SDATE", System::Data::OleDb::OleDbType::DBTimeStamp, 8, S"SDATE"));
			this->oleDbInsertCommand4->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"YID", System::Data::OleDb::OleDbType::VarChar, 10, S"YID"));
			// 
			// oleDbSelectCommand4
			// 
			this->oleDbSelectCommand4->CommandText = S"SELECT SID, SNAME, SMODEL, SPRODUCER, SSELLPRICE, SQUANTITY, SWNAME, SDATE, YID F" 
				S"ROM 消费表";
			this->oleDbSelectCommand4->Connection = this->oleDbConnection1;
			// 
			// textBox11
			// 
			this->textBox11->Location = System::Drawing::Point(424, 288);
			this->textBox11->Name = S"textBox11";
			this->textBox11->Size = System::Drawing::Size(64, 21);
			this->textBox11->TabIndex = 51;
			this->textBox11->Text = S"";
			// 
			// label10
			// 
			this->label10->Font = new System::Drawing::Font(S"宋体", 10.5F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, (System::Byte)134);
			this->label10->Location = System::Drawing::Point(488, 24);
			this->label10->Name = S"label10";
			this->label10->Size = System::Drawing::Size(56, 23);
			this->label10->TabIndex = 52;
			this->label10->Text = S"总计:";
			this->label10->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
			// 
			// label11
			// 
			this->label11->Font = new System::Drawing::Font(S"宋体", 10.5F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, (System::Byte)134);
			this->label11->Location = System::Drawing::Point(488, 80);
			this->label11->Name = S"label11";
			this->label11->Size = System::Drawing::Size(56, 23);
			this->label11->TabIndex = 53;
			this->label11->Text = S"实收:";
			this->label11->TextAlign = System::Drawing::ContentAlignment::MiddleCenter;
			// 
			// wupinxiaofei
			// 
			this->AutoScaleBaseSize = System::Drawing::Size(6, 14);
			this->ClientSize = System::Drawing::Size(688, 526);
			this->Controls->Add(this->textBox8);
			this->Controls->Add(this->textBox7);
			this->Controls->Add(this->label11);
			this->Controls->Add(this->label10);
			this->Controls->Add(this->textBox9);
			this->Controls->Add(this->button5);
			this->Controls->Add(this->button2);
			this->Controls->Add(this->button1);
			this->Controls->Add(this->dataGrid1);
			this->Controls->Add(this->textBox6);
			this->Controls->Add(this->textBox5);
			this->Controls->Add(this->textBox4);
			this->Controls->Add(this->textBox3);
			this->Controls->Add(this->textBox2);
			this->Controls->Add(this->textBox1);
			this->Controls->Add(this->label6);
			this->Controls->Add(this->label5);
			this->Controls->Add(this->label4);
			this->Controls->Add(this->label3);
			this->Controls->Add(this->label2);
			this->Controls->Add(this->label1);
			this->Controls->Add(this->label9);
			this->Controls->Add(this->label8);
			this->Controls->Add(this->label7);
			this->Controls->Add(this->dataGrid2);
			this->Controls->Add(this->textBox10);
			this->Controls->Add(this->textBox11);
			this->Name = S"wupinxiaofei";
			this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen;
			this->Text = S"物品消费";
			(__try_cast<System::ComponentModel::ISupportInitialize *  >(this->dataGrid1))->EndInit();
			(__try_cast<System::ComponentModel::ISupportInitialize *  >(this->dataGrid2))->EndInit();
			this->ResumeLayout(false);

		}		

    private: System::Void button1_Click(System::Object *  sender, System::EventArgs *  e)
			 { String *WID=this->textBox1->Text->Trim();
               int i=this->textBox10->Text->Trim()->ToInt32(0);
                 oleDbSelectCommand2->CommandText=String::Concat(S"select * from 登入表");
                  oleDbConnection1->Open();
		       oleDbSelectCommand2->ExecuteNonQuery();
		       oleDbConnection1->Close();
		       DataTable *table1=new DataTable();
              oleDbDataAdapter2->Fill(table1);
			 this->dataGrid2->DataSource=table1;
			   int nindex=dataGrid2->CurrentRowIndex;
			   DataTable *table2=__try_cast<DataTable*>(dataGrid2->DataSource);
			   DataRow * row=table2->Rows->Item[nindex]; 
			   String *YID=row->Item[0]->ToString(); 
			   String *YNAME=row->Item[1]->ToString(); 
                          
oleDbSelectCommand3->CommandText=String::Concat(S"select WID,WNAME,MODEL,PRODUCER,SELLPRICE from  物品表 where ",S"WID='",WID,S"'" );
         oleDbConnection1->Open();
		 oleDbSelectCommand3->ExecuteNonQuery();
		 oleDbConnection1->Close();
		 DataTable *table3=new DataTable();
            oleDbDataAdapter3->Fill(table3);
			 this->dataGrid2->DataSource=table3;
			   int nindex1=dataGrid2->CurrentRowIndex;
			  if(nindex1<0) { MessageBox::Show("靠,本店不卖脏货");}
			  else{
			   DataTable *table4=__try_cast<DataTable*>(dataGrid2->DataSource);
			   DataRow * row1=table4->Rows->Item[nindex1]; 
			   String *SID=row1->Item[0]->ToString(); 
			   String *SNAME=row1->Item[1]->ToString(); 
			   String *SMODEL=row1->Item[2]->ToString(); 
			   String *SPRODUCER=row1->Item[3]->ToString(); 
			   String *SSELLPRICE=row1->Item[4]->ToString(); 
			   DateTime dtime=System::DateTime::Now;;
               String *SDATE=dtime.ToShortDateString();
			
             
			 
			 if(i!=0){ 
				 oleDbSelectCommand1->CommandText=String::Concat(S"select SID from  出售表 where ",S"SID='",WID,S"'"  );
         oleDbConnection1->Open();
		 oleDbSelectCommand1->ExecuteNonQuery();
		 oleDbConnection1->Close();
		 DataTable *table8=new DataTable();
            oleDbDataAdapter1->Fill(table8);
			 this->dataGrid2->DataSource=table8;			 
			   int nindex2=dataGrid2->CurrentRowIndex;
			   DataTable *table9=__try_cast<DataTable*>(dataGrid2->DataSource);			   
			  if(nindex2<0){  
				   String *SQUANTITY="1";  
                 oleDbInsertCommand1->CommandText=String::Concat(S"insert into 出售表 (", S"SID,SNAME,SMODEL,SPRODUCER,SSELLPRICE,SQUANTITY,SWNAME,SDATE,YID) values ('",  SID,S"','",SNAME,S"','",SMODEL,S"','",SPRODUCER,S"','",SSELLPRICE,S"','",SQUANTITY,S"','",YNAME,S"','",SDATE,S"','",YID,S"')"  );
          oleDbSelectCommand1->CommandText=String::Concat(S"select SID as 物品ID,SNAME as 名称, SMODEL as 型号,SPRODUCER as 生产商,SSELLPRICE as 出售价格,SQUANTITY as 数量,SDATE as 日期,YID as 销售员ID,SWNAME as 销售员姓名 from  出售表 ");
		     oleDbConnection1->Open();
		     oleDbInsertCommand1->ExecuteNonQuery();
		     oleDbConnection1->Close();
		     DataTable *table5=new DataTable();
             oleDbDataAdapter1->Fill(table5);
			 this->dataGrid1->DataSource=table5;

			 oleDbSelectCommand1->CommandText=String::Concat(S"select SID,SNAME,SMODEL,SSELLPRICE,SQUANTITY,SPRODUCER from  出售表 where ",S"SID='",WID,S"'" );
         oleDbConnection1->Open();
		 oleDbSelectCommand1->ExecuteNonQuery();
		 oleDbConnection1->Close();
		 DataTable *table6=new DataTable();
            oleDbDataAdapter1->Fill(table6);
			 this->dataGrid2->DataSource=table6;
			   int nindex2=dataGrid2->CurrentRowIndex;
			   DataTable *table7=__try_cast<DataTable*>(dataGrid2->DataSource);
			   DataRow * row2=table7->Rows->Item[nindex2]; 
			   this->textBox2->Text=row2->Item[1]->ToString(); 
			   this->textBox3->Text=row2->Item[2]->ToString();
			   this->textBox4->Text=row2->Item[3]->ToString();
			   this->textBox5->Text=row2->Item[4]->ToString();
			   this->textBox6->Text=row2->Item[5]->ToString();
			   i++;
                   this->textBox10->Text=i.ToString();
                  int sum=0;
				    oleDbSelectCommand1->CommandText=String::Concat(S"select * from  出售表 " );
         oleDbConnection1->Open();
		 oleDbSelectCommand1->ExecuteNonQuery();
		 oleDbConnection1->Close();
		 DataTable *table8=new DataTable();
            oleDbDataAdapter1->Fill(table8);
			 this->dataGrid1->DataSource=table8;	
             int nindex5=dataGrid1->CurrentRowIndex;
			 if(nindex5<0) this->textBox7->Text="0";
			 else{ DataTable *table20=__try_cast<DataTable*>(dataGrid1->DataSource);
			   for(nindex5=0;nindex5<i;nindex5++)
			   {  
				   DataRow * row4=table20->Rows->Item[nindex5];					      
			   int shuliang=row4->Item[5]->ToString()->ToInt32(0);			 
			   int jiage=row4->Item[4]->ToString()->ToInt32(0);
			       sum=shuliang*jiage+sum;
			   }
			   
               this->textBox7->Text=sum.ToString();
			 }
                         }
		 else{ 
			  
			  oleDbSelectCommand1->CommandText=String::Concat(S"select SQUANTITY from  出售表 where ",S"SID='",WID,S"'" );
         oleDbConnection1->Open();
		 oleDbSelectCommand1->ExecuteNonQuery();
		 oleDbConnection1->Close();
		 DataTable *table6=new DataTable();
            oleDbDataAdapter1->Fill(table6);
			 this->dataGrid2->DataSource=table6;
			   int nindex3=dataGrid2->CurrentRowIndex;
			   DataTable *table12=__try_cast<DataTable*>(dataGrid2->DataSource);
			   DataRow * row2=table12->Rows->Item[nindex1];   

⌨️ 快捷键说明

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