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

📄 warrentinput.h

📁 Visual C++.net数据库开发经典案例
💻 H
📖 第 1 页 / 共 3 页
字号:
			// 
			this->label3->Location = System::Drawing::Point(352, 24);
			this->label3->Name = S"label3";
			this->label3->Size = System::Drawing::Size(56, 16);
			this->label3->TabIndex = 23;
			this->label3->Text = S"制单人";
			// 
			// label2
			// 
			this->label2->Location = System::Drawing::Point(240, 24);
			this->label2->Name = S"label2";
			this->label2->Size = System::Drawing::Size(56, 16);
			this->label2->TabIndex = 22;
			this->label2->Text = S"日期";
			// 
			// label1
			// 
			this->label1->Location = System::Drawing::Point(16, 24);
			this->label1->Name = S"label1";
			this->label1->Size = System::Drawing::Size(56, 16);
			this->label1->TabIndex = 9;
			this->label1->Text = S"凭证编号";
			// 
			// cmbWarrentNumber
			// 
			this->cmbWarrentNumber->ItemHeight = 12;
			System::Object* __mcTemp__1[] = new System::Object*[4];
			__mcTemp__1[0] = S"";
			__mcTemp__1[1] = S"付";
			__mcTemp__1[2] = S"收";
			__mcTemp__1[3] = S"转";
			this->cmbWarrentNumber->Items->AddRange(__mcTemp__1);
			this->cmbWarrentNumber->Location = System::Drawing::Point(128, 40);
			this->cmbWarrentNumber->Name = S"cmbWarrentNumber";
			this->cmbWarrentNumber->Size = System::Drawing::Size(104, 20);
			this->cmbWarrentNumber->TabIndex = 4;
			// 
			// tBoxOperator
			// 
			this->tBoxOperator->Location = System::Drawing::Point(352, 40);
			this->tBoxOperator->Name = S"tBoxOperator";
			this->tBoxOperator->Size = System::Drawing::Size(104, 21);
			this->tBoxOperator->TabIndex = 2;
			this->tBoxOperator->Text = S"";
			// 
			// tBoxDate
			// 
			this->tBoxDate->Location = System::Drawing::Point(240, 40);
			this->tBoxDate->Name = S"tBoxDate";
			this->tBoxDate->Size = System::Drawing::Size(104, 21);
			this->tBoxDate->TabIndex = 1;
			this->tBoxDate->Text = S"";
			// 
			// tBoxWarrentCodeShow
			// 
			this->tBoxWarrentCodeShow->Location = System::Drawing::Point(16, 40);
			this->tBoxWarrentCodeShow->Name = S"tBoxWarrentCodeShow";
			this->tBoxWarrentCodeShow->Size = System::Drawing::Size(104, 21);
			this->tBoxWarrentCodeShow->TabIndex = 0;
			this->tBoxWarrentCodeShow->Text = S"";
			// 
			// groupBox2
			// 
			this->groupBox2->Controls->Add(this->btnSearch);
			this->groupBox2->Controls->Add(this->label9);
			this->groupBox2->Controls->Add(this->label10);
			this->groupBox2->Controls->Add(this->tBoxAccountDate);
			this->groupBox2->Controls->Add(this->tBoxWarrentCode);
			this->groupBox2->Dock = System::Windows::Forms::DockStyle::Top;
			this->groupBox2->Location = System::Drawing::Point(0, 41);
			this->groupBox2->Name = S"groupBox2";
			this->groupBox2->Size = System::Drawing::Size(816, 96);
			this->groupBox2->TabIndex = 9;
			this->groupBox2->TabStop = false;
			// 
			// btnSearch
			// 
			this->btnSearch->ImageAlign = System::Drawing::ContentAlignment::MiddleLeft;
			this->btnSearch->ImageIndex = 6;
			this->btnSearch->ImageList = this->imageList1;
			this->btnSearch->Location = System::Drawing::Point(24, 40);
			this->btnSearch->Name = S"btnSearch";
			this->btnSearch->Size = System::Drawing::Size(88, 24);
			this->btnSearch->TabIndex = 37;
			this->btnSearch->Text = S"查询";
			this->btnSearch->Click += new System::EventHandler(this, btnSearch_Click);
			// 
			// imageList1
			// 
			this->imageList1->ImageSize = System::Drawing::Size(16, 16);
			this->imageList1->ImageStream = (__try_cast<System::Windows::Forms::ImageListStreamer *  >(resources->GetObject(S"imageList1.ImageStream")));
			this->imageList1->TransparentColor = System::Drawing::Color::Transparent;
			// 
			// label9
			// 
			this->label9->Location = System::Drawing::Point(380, 43);
			this->label9->Name = S"label9";
			this->label9->Size = System::Drawing::Size(56, 16);
			this->label9->TabIndex = 33;
			this->label9->Text = S"会计期间";
			// 
			// label10
			// 
			this->label10->Location = System::Drawing::Point(136, 46);
			this->label10->Name = S"label10";
			this->label10->Size = System::Drawing::Size(56, 16);
			this->label10->TabIndex = 32;
			this->label10->Text = S"凭证编号";
			// 
			// tBoxAccountDate
			// 
			this->tBoxAccountDate->Location = System::Drawing::Point(440, 40);
			this->tBoxAccountDate->Name = S"tBoxAccountDate";
			this->tBoxAccountDate->Size = System::Drawing::Size(168, 21);
			this->tBoxAccountDate->TabIndex = 28;
			this->tBoxAccountDate->Text = S"";
			// 
			// tBoxWarrentCode
			// 
			this->tBoxWarrentCode->Location = System::Drawing::Point(200, 40);
			this->tBoxWarrentCode->Name = S"tBoxWarrentCode";
			this->tBoxWarrentCode->Size = System::Drawing::Size(168, 21);
			this->tBoxWarrentCode->TabIndex = 27;
			this->tBoxWarrentCode->Text = S"";
			// 
			// tBtnFirstRecord
			// 
			this->tBtnFirstRecord->ImageIndex = 5;
			this->tBtnFirstRecord->Text = S"首记录";
			this->tBtnFirstRecord->ToolTipText = S"首记录";
			// 
			// dgrdWarrentTable
			// 
			this->dgrdWarrentTable->AllowNavigation = false;
			this->dgrdWarrentTable->DataMember = S"";
			this->dgrdWarrentTable->Dock = System::Windows::Forms::DockStyle::Left;
			this->dgrdWarrentTable->HeaderForeColor = System::Drawing::SystemColors::ControlText;
			this->dgrdWarrentTable->Location = System::Drawing::Point(0, 137);
			this->dgrdWarrentTable->Name = S"dgrdWarrentTable";
			this->dgrdWarrentTable->ReadOnly = true;
			this->dgrdWarrentTable->Size = System::Drawing::Size(304, 340);
			this->dgrdWarrentTable->TabIndex = 7;
			this->dgrdWarrentTable->Click += new System::EventHandler(this, dgrdWarrentTable_Click);
			// 
			// tBtnQuit
			// 
			this->tBtnQuit->ImageIndex = 15;
			this->tBtnQuit->Text = S"退出";
			this->tBtnQuit->ToolTipText = S"退出";
			// 
			// tBtnDeleteRecord
			// 
			this->tBtnDeleteRecord->ImageIndex = 3;
			this->tBtnDeleteRecord->Text = S"删除记录";
			this->tBtnDeleteRecord->ToolTipText = S"删除记录";
			// 
			// tBtnModifyRecord
			// 
			this->tBtnModifyRecord->ImageIndex = 0;
			this->tBtnModifyRecord->Text = S"保存修改";
			this->tBtnModifyRecord->ToolTipText = S"保存修改";
			// 
			// tBtnCancelModify
			// 
			this->tBtnCancelModify->ImageIndex = 2;
			this->tBtnCancelModify->Text = S"取消修改";
			this->tBtnCancelModify->ToolTipText = S"取消修改";
			// 
			// toolBar1
			// 
			System::Windows::Forms::ToolBarButton* __mcTemp__2[] = new System::Windows::Forms::ToolBarButton*[10];
			__mcTemp__2[0] = this->tBtnFirstRecord;
			__mcTemp__2[1] = this->tBtnPreviousRecord;
			__mcTemp__2[2] = this->tBtnNextRecord;
			__mcTemp__2[3] = this->tBtnLastRecord;
			__mcTemp__2[4] = this->tBtnAddRecord;
			__mcTemp__2[5] = this->tBtnModify;
			__mcTemp__2[6] = this->tBtnDeleteRecord;
			__mcTemp__2[7] = this->tBtnModifyRecord;
			__mcTemp__2[8] = this->tBtnCancelModify;
			__mcTemp__2[9] = this->tBtnQuit;
			this->toolBar1->Buttons->AddRange(__mcTemp__2);
			this->toolBar1->DropDownArrows = true;
			this->toolBar1->ImageList = this->imageList1;
			this->toolBar1->Location = System::Drawing::Point(0, 0);
			this->toolBar1->Name = S"toolBar1";
			this->toolBar1->ShowToolTips = true;
			this->toolBar1->Size = System::Drawing::Size(816, 41);
			this->toolBar1->TabIndex = 6;
			this->toolBar1->ButtonClick += new System::Windows::Forms::ToolBarButtonClickEventHandler(this, toolBar1_ButtonClick);
			// 
			// dgrdDetail
			// 
			this->dgrdDetail->AllowNavigation = false;
			this->dgrdDetail->DataMember = S"";
			this->dgrdDetail->Dock = System::Windows::Forms::DockStyle::Fill;
			this->dgrdDetail->HeaderForeColor = System::Drawing::SystemColors::ControlText;
			this->dgrdDetail->Location = System::Drawing::Point(304, 248);
			this->dgrdDetail->Name = S"dgrdDetail";
			this->dgrdDetail->ReadOnly = true;
			this->dgrdDetail->Size = System::Drawing::Size(512, 229);
			this->dgrdDetail->TabIndex = 10;
			this->dgrdDetail->Click += new System::EventHandler(this, dgrdDetail_Click);
			this->dgrdDetail->DoubleClick += new System::EventHandler(this, dgrdDetail_DoubleClick);
			this->dgrdDetail->CurrentCellChanged += new System::EventHandler(this, dgrdDetail_CurrentCellChanged);
			// 
			// DetailSelectSqlCmd
			// 
			this->DetailSelectSqlCmd->CommandText = S"SELECT 分录表.科目代码, 科目表.科目名称, 分录表.借方, 分录表.贷方, 分录表.摘要 FROM 分录表 INNER JOIN 科目表 ON 分录表." 
				S"科目代码 = 科目表.科目代码";
			// 
			// DetailInsertSqlCmd
			// 
			this->DetailInsertSqlCmd->CommandText = S"INSERT INTO 分录表 (凭证编号, 摘要, 科目代码, 借方, 贷方) VALUES (@凭证编号, @摘要, @科目代码, @借方, @贷方)";
			this->DetailInsertSqlCmd->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@凭证编号", System::Data::SqlDbType::VarChar, 10, S"凭证编号"));
			this->DetailInsertSqlCmd->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@摘要", System::Data::SqlDbType::VarChar, 40, S"摘要"));
			this->DetailInsertSqlCmd->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@科目代码", System::Data::SqlDbType::VarChar, 20, S"科目代码"));
			this->DetailInsertSqlCmd->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@借方", System::Data::SqlDbType::Money, 8, S"借方"));
			this->DetailInsertSqlCmd->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@贷方", System::Data::SqlDbType::Money, 8, S"贷方"));
			// 
			// DetailUpdateSqlCmd
			// 
			this->DetailUpdateSqlCmd->CommandText = S"UPDATE 分录表 SET 摘要 = @摘要, 科目代码 = @科目代码, 借方 = @借方, 贷方 = @贷方 WHERE (编号 = @编号)";
			this->DetailUpdateSqlCmd->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@摘要", System::Data::SqlDbType::VarChar, 40, S"摘要"));
			this->DetailUpdateSqlCmd->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@科目代码", System::Data::SqlDbType::VarChar, 20, S"科目代码"));
			this->DetailUpdateSqlCmd->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@借方", System::Data::SqlDbType::Money, 8, S"借方"));
			this->DetailUpdateSqlCmd->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@贷方", System::Data::SqlDbType::Money, 8, S"贷方"));
			this->DetailUpdateSqlCmd->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@编号", System::Data::SqlDbType::Int, 4, System::Data::ParameterDirection::Input, false, (System::Byte)0, (System::Byte)0, S"编号", System::Data::DataRowVersion::Original, 0));
			// 
			// DetailDeleteSqlCmd
			// 
			this->DetailDeleteSqlCmd->CommandText = S"DELETE FROM 分录表 WHERE (编号 = @编号)";
			this->DetailDeleteSqlCmd->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@编号", System::Data::SqlDbType::Int, 4, System::Data::ParameterDirection::Input, false, (System::Byte)0, (System::Byte)0, S"编号", System::Data::DataRowVersion::Original, 0));
			// 
			// WarrentInput
			// 
			this->AutoScaleBaseSize = System::Drawing::Size(6, 14);
			this->ClientSize = System::Drawing::Size(816, 477);
			this->Controls->Add(this->dgrdDetail);
			this->Controls->Add(this->groupBox1);
			this->Controls->Add(this->dgrdWarrentTable);
			this->Controls->Add(this->groupBox2);
			this->Controls->Add(this->toolBar1);
			this->Name = S"WarrentInput";
			this->Text = S"会计凭证输入";
			this->Load += new System::EventHandler(this, WarrentInput_Load);
			this->groupBox1->ResumeLayout(false);
			this->groupBox2->ResumeLayout(false);
			(__try_cast<System::ComponentModel::ISupportInitialize *  >(this->dgrdWarrentTable))->EndInit();
			(__try_cast<System::ComponentModel::ISupportInitialize *  >(this->dgrdDetail))->EndInit();
			this->ResumeLayout(false);

		}		


private: System::Void WarrentInput_Load(System::Object *  sender, System::EventArgs *  e)
		{
			this->cmWarrent = __try_cast<CurrencyManager*>(this->BindingContext->Item[this->ds->Tables->Item[S"凭证表"]]);
			this->DataBidings();
			this->dgrdWarrentTable->DataSource = this->ds->Tables->Item[S"凭证表"];
			this->DataGridStateWarrent();

			if(this->ds->Tables->Item[S"凭证表"]->Rows->Count == 0)
			{
				this->strSQL = S"SELECT 科目表.科目名称,分录表.* FROM 分录表,科目表 WHERE 科目表.科目代码 = 分录表.科目代码";
			}
			else
			{
				int row = this->dgrdWarrentTable->CurrentRowIndex;
				String* strWarrentCode = this->ds->Tables->Item[S"凭证表"]->Rows->Item[row]->Item[S"凭证编号"]->ToString()->Trim();
				this->strSQL = String::Format(S"SELECT 科目表.科目名称,分录表.* FROM 分录表,科目表 WHERE 科目表.科目代码 = 分录表.科目代码 AND 分录表.凭证编号 = '{0}'",strWarrentCode);
			}
			this->MyDataBase->SelectDataBase(this->DetailAdapter,this->ds,this->strSQL,S"凭证明细表");
			this->dgrdDetail->DataSource = this->ds->Tables->Item[S"凭证明细表"];
			this->DataGridStateDetail();

			this->SetModify(false);
		}
		//------------------设置表格样式----------------------
		void DataGridStateWarrent()
		{
			DataGridTableStyle* ts = new DataGridTableStyle();
			DataGridNoActiveCellColumn* aTextColumn;
			ts->AlternatingBackColor = Color::LightGray;
			ts->MappingName = this->ds->Tables->Item[S"凭证表"]->TableName;

			int numCols = this->ds->Tables->Item[S"凭证表"]->Columns->Count;
			for(int i = 0;i < numCols;i++)
			{
				aTextColumn = new DataGridNoActiveCellColumn();
				aTextColumn->get_TextBox()->Enabled = false;
				aTextColumn->MappingName = this->ds->Tables->Item[S"凭证表"]->Columns->Item[i]->ColumnName;
				aTextColumn->HeaderText = this->ds->Tables->Item[S"凭证表"]->Columns->Item[i]->ColumnName;
				aTextColumn->NullText = S"";
				aTextColumn->Format = S"D";
				ts->GridColumnStyles->Add(aTextColumn);
			}
			this->dgrdWarrentTable->TableStyles->Add(ts);			
		}
		void DataGridStateDetail()
		{

⌨️ 快捷键说明

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