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

📄 querydepreciationform.h

📁 vc++开发环境SQL数据库固定资产管理系统
💻 H
📖 第 1 页 / 共 2 页
字号:
			// fillToolStrip
			// 
			this->fillToolStrip->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(6) {this->折旧年份ToolStripLabel, 
				this->折旧年份ToolStripComboBox, this->折旧月份ToolStripLabel, this->折旧月份ToolStripComboBox, this->查询ToolStripButton, this->打印ToolStripButton});
			this->fillToolStrip->Location = System::Drawing::Point(0, 0);
			this->fillToolStrip->Name = L"fillToolStrip";
			this->fillToolStrip->Size = System::Drawing::Size(542, 25);
			this->fillToolStrip->TabIndex = 4;
			this->fillToolStrip->Text = L"fillToolStrip";
			// 
			// 折旧月份ToolStripLabel
			// 
			this->折旧月份ToolStripLabel->Name = L"折旧月份ToolStripLabel";
			this->折旧月份ToolStripLabel->Size = System::Drawing::Size(59, 22);
			this->折旧月份ToolStripLabel->Text = L"折旧月份:";
			// 
			// 折旧月份ToolStripComboBox
			// 
			this->折旧月份ToolStripComboBox->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList;
			this->折旧月份ToolStripComboBox->Name = L"折旧月份ToolStripComboBox";
			this->折旧月份ToolStripComboBox->Size = System::Drawing::Size(75, 25);
			// 
			// 查询ToolStripButton
			// 
			this->查询ToolStripButton->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"查询ToolStripButton.Image")));
			this->查询ToolStripButton->Name = L"查询ToolStripButton";
			this->查询ToolStripButton->Size = System::Drawing::Size(49, 22);
			this->查询ToolStripButton->Text = L"查询";
			this->查询ToolStripButton->Click += gcnew System::EventHandler(this, &QueryDepreciationForm::查询ToolStripButton_Click);
			// 
			// 打印ToolStripButton
			// 
			this->打印ToolStripButton->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"打印ToolStripButton.Image")));
			this->打印ToolStripButton->ImageTransparentColor = System::Drawing::Color::Magenta;
			this->打印ToolStripButton->Name = L"打印ToolStripButton";
			this->打印ToolStripButton->Size = System::Drawing::Size(49, 22);
			this->打印ToolStripButton->Text = L"打印";
			this->打印ToolStripButton->Click += gcnew System::EventHandler(this, &QueryDepreciationForm::打印ToolStripButton_Click);
			// 
			// QueryDepreciationForm
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(542, 416);
			this->Controls->Add(this->累计折旧查询视图DataGridView);
			this->Controls->Add(this->fillToolStrip);
			this->Name = L"QueryDepreciationForm";
			this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
			this->Text = L"统计月度计提的固定资产折旧";
			this->Load += gcnew System::EventHandler(this, &QueryDepreciationForm::QueryDepreciationForm_Load);
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->MyAssetsDataSet))->EndInit();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->累计折旧查询视图BindingSource))->EndInit();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->累计折旧查询视图DataGridView))->EndInit();
			this->fillToolStrip->ResumeLayout(false);
			this->fillToolStrip->PerformLayout();
			this->ResumeLayout(false);
			this->PerformLayout();

		}
#pragma endregion
		public: String^ MyCompany;
		private: static String^ MyAssetsConnectionString= L"Data Source=.;Initial Catalog=MyAssets;Integrated Security=True;Pooling=False";
		private: System::Void QueryDepreciationForm_Load(System::Object^  sender, System::EventArgs^  e) {
			 // TODO: 这行代码将数据加载到表“MyAssetsDataSet.累计折旧查询视图”中。您可以根据需要移动或移除它。
			 //this->累计折旧查询视图TableAdapter->Fill(this->MyAssetsDataSet->累计折旧查询视图);
			for (int i = 2006; i < 2100; i++)
            {
                this->折旧年份ToolStripComboBox->Items->Add(i.ToString());
            }
            for (int i = 1; i < 13; i++)
            {
                this->折旧月份ToolStripComboBox->Items->Add(i.ToString());
            }
		 }
		private: System::Void 查询ToolStripButton_Click(System::Object^  sender, System::EventArgs^  e) {
			 try 
			 {
				 this->累计折旧查询视图TableAdapter->FillBy(this->MyAssetsDataSet->累计折旧查询视图, System::Nullable<System::Int32 >((*cli::safe_cast<System::Int32^>(System::Convert::ChangeType(折旧年份ToolStripComboBox->Text, 
						 System::Int32::typeid)))), System::Nullable<System::Int32 >((*cli::safe_cast<System::Int32^>(System::Convert::ChangeType(折旧月份ToolStripComboBox->Text, 
						 System::Int32::typeid)))));
			 }
			 catch (System::Exception^ ex) 
			 {
				 System::Windows::Forms::MessageBox::Show(ex->Message);
			 }
		}
		private: System::Void 打印ToolStripButton_Click(System::Object^  sender, System::EventArgs^  e) {
			if (this->MyAssetsDataSet->累计折旧查询视图->Rows->Count < 1)
            {
                return;
            }
            //导出Excel表格数据文件
			ApplicationClass^ MyExcel;
			Workbooks^ MyWorkBooks;
			Workbook^ MyWorkBook;
			Worksheet^ MyWorkSheet;
			char MyColumns;
			Range^ MyRange;
			array<System::Object^,2>^ MyData=gcnew array<System::Object^,2>(5000,30);
			int Count, i, j;
			MyExcel = gcnew ApplicationClass();
			MyExcel->Visible = true;
			if (MyExcel == nullptr)
			{
				MessageBox::Show("Excel程序无法启动!", "信息提示", MessageBoxButtons::OK, MessageBoxIcon::Information);
				return;
			}
			MyWorkBooks = MyExcel->Workbooks;
			MyWorkBook = MyWorkBooks->Add(Missing::Value);
			MyWorkSheet = (Worksheet^)MyWorkBook->Worksheets[1];	
			switch(this->MyAssetsDataSet->累计折旧查询视图->Columns->Count+ 64)
			{
			case 64:
				 MyRange=MyWorkSheet->Range["A5","A5"];
				break;
			case 65:
				MyRange=MyWorkSheet->Range["A5","B5"];
				break;
			case 66:
				MyRange=MyWorkSheet->Range["A5","C5"];
				break;
			case 67:
				MyRange=MyWorkSheet->Range["A5","D5"];
				break;
			case 68:
				MyRange=MyWorkSheet->Range["A5","E5"];
				break;
			case 69:
				MyRange=MyWorkSheet->Range["A5","F5"];
				break;
			case 70:
				MyRange=MyWorkSheet->Range["A5","G5"];
				break;
			case 71:
				MyRange=MyWorkSheet->Range["A5","H5"];
				break;
			case 72:
				MyRange=MyWorkSheet->Range["A5","I5"];
				break;
			case 73:
				MyRange=MyWorkSheet->Range["A5","J5"];
				break;
			case 74:
				MyRange=MyWorkSheet->Range["A5","K5"];
				break;
			case 75:
				MyRange=MyWorkSheet->Range["A5","L5"];
				break;
			case 76:
				MyRange=MyWorkSheet->Range["A5","M5"];
				break;
			case 77:
				MyRange=MyWorkSheet->Range["A5","N5"];
				break;
			case 78:
				MyRange=MyWorkSheet->Range["A5","O5"];
				break;
			case 79:
				MyRange=MyWorkSheet->Range["A5","P5"];
				break;
			case 80:
				MyRange=MyWorkSheet->Range["A5","Q5"];
				break;
			case 81:
				MyRange=MyWorkSheet->Range["A5","R5"];
				break;
			case 82:
				MyRange=MyWorkSheet->Range["A5","S5"];
				break;
			case 83:
				MyRange=MyWorkSheet->Range["A5","T5"];
				break;
			case 84:
				MyRange=MyWorkSheet->Range["A5","U5"];
				break;
			case 85:
				MyRange=MyWorkSheet->Range["A5","V5"];
				break;
			case 86:
				MyRange=MyWorkSheet->Range["A5","W5"];
				break;
			case 87:
				MyRange=MyWorkSheet->Range["A5","X5"];
				break;
			case 88:
				MyRange=MyWorkSheet->Range["A5","Y5"];
				break;
			case 89:
				MyRange=MyWorkSheet->Range["A5","Z5"];
				break;
			}			        
            Count = 0;
            for each (DataColumn^ MyNewColumn in this->MyAssetsDataSet->累计折旧查询视图->Columns)
            {
                MyData[0, Count] = MyNewColumn->ColumnName;
                Count = Count + 1;
            }
            j = 1;
            //输出数据库记录
            for each (DataRow^ MyRow in this->MyAssetsDataSet->累计折旧查询视图->Rows)
            {
                for (i = 0; i < this->MyAssetsDataSet->累计折旧查询视图->Columns->Count - 2; i++)
                {
                    MyData[j, i] = MyRow[i]->ToString();
                }
                j++;
            }
            MyRange = MyRange->Resize[this->MyAssetsDataSet->累计折旧查询视图->Rows->Count + 1, this->MyAssetsDataSet->累计折旧查询视图->Columns->Count - 2];
            MyRange->Value2 = MyData;
            MyRange->EntireColumn->AutoFit();
            MyWorkSheet->Cells[2, 2] = this->MyCompany + "月度累计折旧计提统计表";
            MyWorkSheet->Cells[4, 1] = "计提日期:" + this->折旧年份ToolStripComboBox->Text + "年" + this->折旧月份ToolStripComboBox->Text + "月";
		 }
	};
}

⌨️ 快捷键说明

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