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

📄 jinhuobaobiao.h

📁 采用VC++.net做的超市收银管理系统
💻 H
📖 第 1 页 / 共 3 页
字号:
			this->oleDbInsertCommand2->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"SELLPRICE", System::Data::OleDb::OleDbType::Double, 8, S"SELLPRICE"));
			this->oleDbInsertCommand2->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"STOCKPRICE", System::Data::OleDb::OleDbType::Double, 8, S"STOCKPRICE"));
			this->oleDbInsertCommand2->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"STOCK", System::Data::OleDb::OleDbType::Integer, 4, S"STOCK"));
			this->oleDbInsertCommand2->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"LASTSTOCK", System::Data::OleDb::OleDbType::Integer, 4, S"LASTSTOCK"));
			this->oleDbInsertCommand2->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"MAXSTOCK", System::Data::OleDb::OleDbType::Integer, 4, S"MAXSTOCK"));
			this->oleDbInsertCommand2->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"STOCKCHA", System::Data::OleDb::OleDbType::Integer, 4, S"STOCKCHA"));
			// 
			// oleDbUpdateCommand2
			// 
			this->oleDbUpdateCommand2->CommandText = S"UPDATE 物品表 SET WID = \?, WNAME = \?, MODEL = \?, PRODUCER = \?, SELLPRICE = \?, STOCKP" 
				S"RICE = \?, STOCK = \?, LASTSTOCK = \?, MAXSTOCK = \?, STOCKCHA = \? WHERE (WID = \?)";
			this->oleDbUpdateCommand2->Connection = this->oleDbConnection1;
			this->oleDbUpdateCommand2->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"WID", System::Data::OleDb::OleDbType::VarChar, 10, S"WID"));
			this->oleDbUpdateCommand2->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"WNAME", System::Data::OleDb::OleDbType::VarChar, 30, S"WNAME"));
			this->oleDbUpdateCommand2->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"MODEL", System::Data::OleDb::OleDbType::VarChar, 10, S"MODEL"));
			this->oleDbUpdateCommand2->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"PRODUCER", System::Data::OleDb::OleDbType::VarChar, 20, S"PRODUCER"));
			this->oleDbUpdateCommand2->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"SELLPRICE", System::Data::OleDb::OleDbType::Double, 8, S"SELLPRICE"));
			this->oleDbUpdateCommand2->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"STOCKPRICE", System::Data::OleDb::OleDbType::Double, 8, S"STOCKPRICE"));
			this->oleDbUpdateCommand2->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"STOCK", System::Data::OleDb::OleDbType::Integer, 4, S"STOCK"));
			this->oleDbUpdateCommand2->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"LASTSTOCK", System::Data::OleDb::OleDbType::Integer, 4, S"LASTSTOCK"));
			this->oleDbUpdateCommand2->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"MAXSTOCK", System::Data::OleDb::OleDbType::Integer, 4, S"MAXSTOCK"));
			this->oleDbUpdateCommand2->Parameters->Add(new System::Data::OleDb::OleDbParameter(S"STOCKCHA", System::Data::OleDb::OleDbType::Integer, 4, S"STOCKCHA"));
			this->oleDbUpdateCommand2->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));
			// 
			// oleDbDeleteCommand2
			// 
			this->oleDbDeleteCommand2->CommandText = S"DELETE FROM 物品表 WHERE (WID = \?)";
			this->oleDbDeleteCommand2->Connection = this->oleDbConnection1;
			this->oleDbDeleteCommand2->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));
			// 
			// jinhuobaobiao
			// 
			this->AutoScaleBaseSize = System::Drawing::Size(6, 14);
			this->ClientSize = System::Drawing::Size(560, 422);
			this->Controls->Add(this->label4);
			this->Controls->Add(this->dataGrid3);
			this->Controls->Add(this->label3);
			this->Controls->Add(this->button3);
			this->Controls->Add(this->dataGrid1);
			this->Controls->Add(this->button2);
			this->Controls->Add(this->textBox2);
			this->Controls->Add(this->label2);
			this->Controls->Add(this->button1);
			this->Controls->Add(this->textBox1);
			this->Controls->Add(this->label1);
			this->Controls->Add(this->dataGrid2);
			this->Controls->Add(this->textBox3);
			this->Name = S"jinhuobaobiao";
			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();
			(__try_cast<System::ComponentModel::ISupportInitialize *  >(this->dataGrid3))->EndInit();
			this->ResumeLayout(false);

		}		
	private: System::Void button1_Click(System::Object *  sender, System::EventArgs *  e)
			 {  String *WID=this->textBox1->Text->Trim();
			    int i=this->textBox3->Text->Trim()->ToInt32(0);
			      if(i==0){ oleDbDeleteCommand3->CommandText=String::Concat(S"delete from 采购表 ");
             oleDbConnection1->Open();			
		     oleDbDeleteCommand3->ExecuteNonQuery();			
		     oleDbConnection1->Close();			
		     DataTable *table7=new DataTable();			  
             oleDbDataAdapter3->Fill(table7);			 
			 this->dataGrid1->DataSource=table7;
		                 }
		      oleDbSelectCommand3->CommandText=String::Concat(S"select IID as 物品ID,INAME as 名称,IPRODUCER as 生产商,ISTOCKPRICE as 数量 from  采购表 where ",S"IID='",WID,S"'");
         oleDbConnection1->Open();
		 oleDbSelectCommand3->ExecuteNonQuery();
		 oleDbConnection1->Close();
		 DataTable *table3=new DataTable();
            oleDbDataAdapter3->Fill(table3);
			this->dataGrid2->DataSource=table3;
			int nindex=dataGrid2->CurrentRowIndex;
			if(nindex<0){ 
			   
		 oleDbSelectCommand2->CommandText=String::Concat(S"select WID as 物品ID,WNAME as 名称,PRODUCER as 生产商 from  物品表 where ",S"WID='",WID,S"'");
         oleDbConnection1->Open();
		 oleDbSelectCommand2->ExecuteNonQuery();
		 oleDbConnection1->Close();
		 DataTable *table1=new DataTable();
            oleDbDataAdapter2->Fill(table1);
			this->dataGrid3->DataSource=table1;
			this->textBox2->Text="";
			}
			else{ this->dataGrid3->DataSource=table3;
			       DataTable *table4=__try_cast<DataTable*>(dataGrid2->DataSource);
			       DataRow * row=table4->Rows->Item[nindex]; 
			      this->textBox2->Text=row->Item[3]->ToString();
			     }
			   
			 }

private: System::Void button3_Click(System::Object *  sender, System::EventArgs *  e)
		 { String *WID=this->textBox1->Text->Trim();
		   String *ISTOCKPRICE=this->textBox2->Text->Trim();
		   int i=this->textBox3->Text->Trim()->ToInt32(0);
		   String *shuliang=this->textBox2->Text->Trim();
		   if(shuliang->CompareTo("")==0||shuliang->CompareTo("0")==0){MessageBox::Show("数量不能为空");}
		   else{		  
			   oleDbSelectCommand3->CommandText=String::Concat(S"select IID as 物品ID,INAME as 名称,IPRODUCER as 生产商,ISTOCKPRICE as 数量 from  采购表 where ",S"IID='",WID,S"'");
         oleDbConnection1->Open();
		 oleDbSelectCommand3->ExecuteNonQuery();
		 oleDbConnection1->Close();
		 DataTable *table1=new DataTable();
            oleDbDataAdapter3->Fill(table1);
			this->dataGrid2->DataSource=table1;
			int nindex=dataGrid2->CurrentRowIndex;
			if(nindex<0){ 
			   
		 oleDbSelectCommand2->CommandText=String::Concat(S"select WID as 物品ID,WNAME as 名称,PRODUCER as 生产商 from  物品表 where ",S"WID='",WID,S"'");
         oleDbConnection1->Open();
		 oleDbSelectCommand2->ExecuteNonQuery();
		 oleDbConnection1->Close();
		 DataTable *table2=new DataTable();
            oleDbDataAdapter2->Fill(table2);
			this->dataGrid2->DataSource=table2;
			int nindex1=dataGrid2->CurrentRowIndex;
			   DataTable *table3=__try_cast<DataTable*>(dataGrid2->DataSource);
			   DataRow * row1=table3->Rows->Item[nindex1]; 
			   String *IID=row1->Item[0]->ToString();
			   String *INAME=row1->Item[1]->ToString(); 
			   String *IPRODUCER=row1->Item[2]->ToString();
			   String *ISTOCKPRICE=this->textBox2->Text->Trim()->ToString();
               
			    oleDbInsertCommand3->CommandText=String::Concat(S"insert into 采购表 (", S"IID,INAME,IPRODUCER,ISTOCKPRICE) values ('",  IID,S"','",INAME,S"','",IPRODUCER,S"','",ISTOCKPRICE,S"')"  );
          oleDbSelectCommand3->CommandText=String::Concat(S"select IID as 物品ID,INAME as 名称,IPRODUCER as 生产商,ISTOCKPRICE as 数量 from  采购表 ");
		     oleDbConnection1->Open();
		     oleDbInsertCommand3->ExecuteNonQuery();
		     oleDbConnection1->Close();
		     DataTable *table4=new DataTable();
             oleDbDataAdapter3->Fill(table4);
			 this->dataGrid1->DataSource=table4;
			i++;
                   this->textBox3->Text=i.ToString();
			
			}

			   
			else{ 		
			        oleDbUpdateCommand3->CommandText=String::Concat(S"update 采购表 set ",S"ISTOCKPRICE='",ISTOCKPRICE,S"'",S" where IID='",WID,S"'" );                
					oleDbSelectCommand3->CommandText=String::Concat(S"select IID as 物品ID,INAME as 名称,IPRODUCER as 生产商,ISTOCKPRICE as 数量 from  采购表 ");
				oleDbConnection1->Open();				
				oleDbUpdateCommand3->ExecuteNonQuery();					
		     oleDbConnection1->Close();	
		     DataTable *table3=new DataTable();		
             oleDbDataAdapter3->Fill(table3); 			
			 this->dataGrid1->DataSource=table3;
			}           
			}
		   }
		
private: System::Void button2_Click(System::Object *  sender, System::EventArgs *  e)
		 {    String *WID=this->textBox1->Text->Trim();
               int i=this->textBox3->Text->Trim()->ToInt32(0);
                 oleDbSelectCommand1->CommandText=String::Concat(S"select * from 登入表");
                  oleDbConnection1->Open();
		       oleDbSelectCommand1->ExecuteNonQuery();
		       oleDbConnection1->Close();
		       DataTable *table1=new DataTable();
              oleDbDataAdapter1->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 * from  采购表 " );
         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);
			       for(nindex1=0;nindex1<i;nindex1++)
			        {         DataRow * row1=table4->Rows->Item[nindex1];
                              String *IID=row1->Item[0]->ToString();
							  String *INAME=row1->Item[1]->ToString(); 
							  String *IPRODUCER=row1->Item[2]->ToString(); 
							  String *ISTOCKPRICE=row1->Item[3]->ToString(); 
							  int  caigou=row1->Item[3]->ToString()->ToInt32(0);
							  DateTime dtime=System::DateTime::Now;;
                              String *DATES=dtime.ToShortDateString();
					oleDbInsertCommand4->CommandText=String::Concat(S"insert into 进货表 (", S"IID,INAME,IPRODUCER,ISTOCKPRICE,DATES,YID,YNAME) values ('",  IID,S"','",INAME,S"','",IPRODUCER,S"','",ISTOCKPRICE,S"','",DATES,S"','",YNAME,S"','",YID,S"')"  );
 		           oleDbConnection1->Open();
		          oleDbInsertCommand4->ExecuteNonQuery();
		         oleDbConnection1->Close();
		        DataTable *table5=new DataTable();
               oleDbDataAdapter4->Fill(table5);
                          
                             oleDbSelectCommand2->CommandText=String::Concat(S"select STOCK from  物品表 where ",S"WID='",IID,S"'" );
		     oleDbConnection1->Open();
			 oleDbSelectCommand2->ExecuteNonQuery();
		     oleDbConnection1->Close();
		     DataTable *table6=new DataTable();
             oleDbDataAdapter2->Fill(table6);
             this->dataGrid2->DataSource=table6;	
             int nindex2=dataGrid2->CurrentRowIndex;
              DataTable *table7=__try_cast<DataTable*>(dataGrid2->DataSource);
              DataRow * row3=table7->Rows->Item[nindex2];
			  int wupin=row3->Item[0]->ToString()->ToInt32(0);
			    int kucun=wupin+caigou;
				String *STOCK=kucun.ToString();

				 oleDbUpdateCommand2->CommandText=String::Concat(S"update 物品表 set ",S"STOCK='",STOCK,S"'",S" where WID='",IID,S"'" );     
				oleDbConnection1->Open();				
		     oleDbUpdateCommand2->ExecuteNonQuery();			
		     oleDbConnection1->Close();		
		     DataTable *table8=new DataTable();		
             oleDbDataAdapter2->Fill(table8);
						           }			 		 
			 this->textBox3->Text="0";
		 }
		 }
};
}

⌨️ 快捷键说明

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