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

📄 printcardform.h

📁 vc++开发环境SQL数据库固定资产管理系统
💻 H
📖 第 1 页 / 共 2 页
字号:
			this->累计折旧查询视图BindingNavigator->MoveFirstItem = nullptr;
			this->累计折旧查询视图BindingNavigator->MoveLastItem = nullptr;
			this->累计折旧查询视图BindingNavigator->MoveNextItem = nullptr;
			this->累计折旧查询视图BindingNavigator->MovePreviousItem = nullptr;
			this->累计折旧查询视图BindingNavigator->Name = L"累计折旧查询视图BindingNavigator";
			this->累计折旧查询视图BindingNavigator->PositionItem = nullptr;
			this->累计折旧查询视图BindingNavigator->Size = System::Drawing::Size(542, 25);
			this->累计折旧查询视图BindingNavigator->TabIndex = 6;
			this->累计折旧查询视图BindingNavigator->Text = L"bindingNavigator1";
			// 
			// 资产名称ToolStripTextBox
			// 
			this->资产名称ToolStripTextBox->Name = L"资产名称ToolStripTextBox";
			this->资产名称ToolStripTextBox->Size = System::Drawing::Size(100, 25);
			this->资产名称ToolStripTextBox->Text = L"%%";
			// 
			// 查询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, &PrintCardForm::查询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, &PrintCardForm::打印ToolStripButton_Click);
			// 
			// PrintCardForm
			// 
			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->固定资产租借DataGridView);
			this->Controls->Add(this->固定资产修理DataGridView);
			this->Controls->Add(this->固定资产明细DataGridView);
			this->Controls->Add(this->累计折旧查询视图BindingNavigator);
			this->Name = L"PrintCardForm";
			this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
			this->Text = L"打印固定资产卡片";
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->固定资产附属设备DataGridView))->EndInit();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->固定资产租借DataGridView))->EndInit();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->固定资产修理DataGridView))->EndInit();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->固定资产明细DataGridView))->EndInit();
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->累计折旧查询视图BindingNavigator))->EndInit();
			this->累计折旧查询视图BindingNavigator->ResumeLayout(false);
			this->累计折旧查询视图BindingNavigator->PerformLayout();
			this->ResumeLayout(false);
			this->PerformLayout();

		}
#pragma endregion
		private:System::Data::DataTable^ MyAssetsTable;
        private:System::Data::DataTable^ MyRepairTable;
        private:System::Data::DataTable^ MyBorrowTable;
        private:System::Data::DataTable^ MyFittingTable;
		public: String^ MyCompany;
		private: static String^ MyAssetsConnectionString= L"Data Source=.;Initial Catalog=MyAssets;Integrated Security=True;Pooling=False";
		private: System::Void 查询ToolStripButton_Click(System::Object^  sender, System::EventArgs^  e) {
			String^ My名称 = this->资产名称ToolStripTextBox->Text;
            String^ MySQLConnectionString = MyAssetsConnectionString;
            SqlConnection^ MyConnection = gcnew SqlConnection(MySQLConnectionString);
            MyConnection->Open();
            MyAssetsTable = gcnew System::Data::DataTable();
            String^ MySQL = "SELECT * FROM 固定资产明细 WHERE 名称 LIKE '" + My名称 + "'";
            SqlDataAdapter^ MyAdapter = gcnew SqlDataAdapter(MySQL, MyConnection);
            MyAdapter->Fill(MyAssetsTable);
            this->固定资产明细DataGridView->DataSource = MyAssetsTable;
            if (MyConnection->State == ConnectionState::Open)
            {
                MyConnection->Close();
            }
		}
		private: System::Void 固定资产明细DataGridView_SelectionChanged(System::Object^  sender, System::EventArgs^  e) {
            String^ My资产编号 = this->固定资产明细DataGridView->CurrentRow->Cells[1]->Value->ToString();
            String^ MySQLConnectionString = MyAssetsConnectionString;
            SqlConnection^ MyConnection = gcnew SqlConnection(MySQLConnectionString);
            MyConnection->Open();
            MyRepairTable = gcnew System::Data::DataTable();
            String^ MySQL = "SELECT * FROM 固定资产修理记录 WHERE 资产编号='" + My资产编号 + "'";
            SqlDataAdapter^ MyAdapter = gcnew SqlDataAdapter(MySQL, MyConnection);
            MyAdapter->Fill(MyRepairTable);
            this->固定资产修理DataGridView->DataSource = MyRepairTable;
            MyBorrowTable = gcnew System::Data::DataTable();
            MySQL = "SELECT * FROM 固定资产租借记录 WHERE 资产编号='" + My资产编号 + "'";
            MyAdapter = gcnew SqlDataAdapter(MySQL, MyConnection);
            MyAdapter->Fill(MyBorrowTable);
            this->固定资产租借DataGridView->DataSource = MyBorrowTable;
            MyFittingTable = gcnew System::Data::DataTable();
            MySQL = "SELECT * FROM 固定资产附属设备 WHERE 资产编号='" + My资产编号 + "'";
            MyAdapter = gcnew SqlDataAdapter(MySQL, MyConnection);
            MyAdapter->Fill(MyFittingTable);
            this->固定资产附属设备DataGridView->DataSource = MyFittingTable;
            if (MyConnection->State == ConnectionState::Open)
            {
                MyConnection->Close();
            }
		 }
		private: System::Void 打印ToolStripButton_Click(System::Object^  sender, System::EventArgs^  e) {
            this->printPreviewDialog1->Document = this->printDocument1;
            this->printPreviewDialog1->ShowDialog();
		 }
		private: System::Void printDocument1_PrintPage(System::Object^  sender, System::Drawing::Printing::PrintPageEventArgs^  e) {
            e->Graphics->DrawString(this->MyCompany + "固定资产卡片", gcnew System::Drawing::Font("宋体", 20), Brushes::Black, 150, 80);
            e->Graphics->DrawString("资产编号:" + this->固定资产明细DataGridView->CurrentRow->Cells[1]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 100, 145);
			e->Graphics->DrawString("打印日期:" + DateTime::Now.ToShortDateString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 540, 145);
            e->Graphics->DrawLine(gcnew Pen(Color::Black, (float)3.00), 100, 165, 720, 165);
            e->Graphics->DrawString("名称:" + this->固定资产明细DataGridView->CurrentRow->Cells[2]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 175);
            e->Graphics->DrawString("型号:" + this->固定资产明细DataGridView->CurrentRow->Cells[3]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 450, 175);
            e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 195, 720, 195);
            e->Graphics->DrawString("制造厂家:" + this->固定资产明细DataGridView->CurrentRow->Cells[4]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 200);
            e->Graphics->DrawString("出厂日期:" + ((DateTime)this->固定资产明细DataGridView->CurrentRow->Cells[5]->Value).ToShortDateString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 450, 200);
            e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 220, 720, 220);
            e->Graphics->DrawString("存放地点:" + this->固定资产明细DataGridView->CurrentRow->Cells[7]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 225);
            e->Graphics->DrawString("入帐日期:" + ((DateTime)this->固定资产明细DataGridView->CurrentRow->Cells[6]->Value).ToShortDateString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 450, 225);
            e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 245, 720, 245);
            e->Graphics->DrawString("使用部门:" + this->固定资产明细DataGridView->CurrentRow->Cells[8]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 250);
            e->Graphics->DrawString("使用状态:" + this->固定资产明细DataGridView->CurrentRow->Cells[9]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 450, 250);
            e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 270, 720, 270);
            e->Graphics->DrawString("增加方式:" + this->固定资产明细DataGridView->CurrentRow->Cells[10]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 275);
            e->Graphics->DrawString("类别:" + this->固定资产明细DataGridView->CurrentRow->Cells[11]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 450, 275);
            e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 295, 720, 295);
            e->Graphics->DrawString("数量:" + this->固定资产明细DataGridView->CurrentRow->Cells[12]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 300);
            e->Graphics->DrawString("单位:" + this->固定资产明细DataGridView->CurrentRow->Cells[13]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 230, 300);
            e->Graphics->DrawString("单价:" + this->固定资产明细DataGridView->CurrentRow->Cells[14]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 340, 300);
            e->Graphics->DrawString("金额:" + this->固定资产明细DataGridView->CurrentRow->Cells[15]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 520, 300);
            e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 320, 720, 320);
            e->Graphics->DrawString("资产原值:" + this->固定资产明细DataGridView->CurrentRow->Cells[16]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 325);
            e->Graphics->DrawString("累计折旧:" + this->固定资产明细DataGridView->CurrentRow->Cells[17]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 340, 325);
            e->Graphics->DrawString("预计净残值:" + this->固定资产明细DataGridView->CurrentRow->Cells[22]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 520, 325);
            e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 345, 720, 345);
            e->Graphics->DrawString("折旧月数:" + this->固定资产明细DataGridView->CurrentRow->Cells[19]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 350);
            e->Graphics->DrawString("已提月数:" + this->固定资产明细DataGridView->CurrentRow->Cells[20]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 230, 350);
            e->Graphics->DrawString("月度折旧额:" + this->固定资产明细DataGridView->CurrentRow->Cells[21]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 340, 350);
            e->Graphics->DrawString("折旧方法:" + this->固定资产明细DataGridView->CurrentRow->Cells[18]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 520, 350);
            e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 370, 720, 370);
            e->Graphics->DrawString("说明:" + this->固定资产明细DataGridView->CurrentRow->Cells[23]->Value->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 375);
            e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 395, 720, 395);
            e->Graphics->DrawString("附属设备名称", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 130, 400);
            e->Graphics->DrawString("规格型号", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 330, 400);
            e->Graphics->DrawString("生产厂家", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 500, 400);
            e->Graphics->DrawString("单位", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 640, 400);
            e->Graphics->DrawString("数量", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 680, 400);
            e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 420, 720, 420);
            int MyPosY = 425;
            for (int i = 0; i < this->MyFittingTable->Rows->Count; i++)
            {
                e->Graphics->DrawString(this->MyFittingTable->Rows[i][2]->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, MyPosY);
                e->Graphics->DrawString(this->MyFittingTable->Rows[i][3]->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 300, MyPosY);
                e->Graphics->DrawString(this->MyFittingTable->Rows[i][4]->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 450, MyPosY);
                e->Graphics->DrawString(this->MyFittingTable->Rows[i][6]->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 640, MyPosY);
                e->Graphics->DrawString(this->MyFittingTable->Rows[i][7]->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 680, MyPosY);
                MyPosY = MyPosY + 20;
            }
            e->Graphics->DrawLine(gcnew Pen(Color::Black, (float)3.00), 100, 645, 720, 645);
            e->Graphics->DrawString("故障原因", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 150, 650);
            e->Graphics->DrawString("修理情况", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 330, 650);
            e->Graphics->DrawString("修理公司", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 500, 650);
            e->Graphics->DrawString("送修日期", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 630, 650);
            e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 670, 720, 670);
            MyPosY = 675;
            for (int i = 0; i < this->MyRepairTable->Rows->Count; i++)
             {
                 e->Graphics->DrawString(MyRepairTable->Rows[i][9]->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, MyPosY);
                 e->Graphics->DrawString(MyRepairTable->Rows[i][10]->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 300, MyPosY);
                 e->Graphics->DrawString(MyRepairTable->Rows[i][8]->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 470, MyPosY);
                 e->Graphics->DrawString(((DateTime)MyRepairTable->Rows[i][5]).ToShortDateString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 620, MyPosY);
                 MyPosY = MyPosY + 20;
             }
             e->Graphics->DrawLine(gcnew Pen(Color::Black, (float)3.00), 100, 905, 720, 905);
             e->Graphics->DrawString("租借数量", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, 910);
             e->Graphics->DrawString("说明", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 250, 910);
             e->Graphics->DrawString("租借公司", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 400, 910);
             e->Graphics->DrawString("租借日期", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 550, 910);
             e->Graphics->DrawString("实际收益", gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 640, 910);
             e->Graphics->DrawLine(gcnew Pen(Color::Black), 100, 930, 720, 930);
             MyPosY = 935;
             for (int i = 0; i < this->MyBorrowTable->Rows->Count; i++)
             {
                 e->Graphics->DrawString(MyBorrowTable->Rows[i][3]->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 110, MyPosY);
                 e->Graphics->DrawString(MyBorrowTable->Rows[i][10]->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 180, MyPosY);
                 e->Graphics->DrawString(MyBorrowTable->Rows[i][5]->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 380, MyPosY);
                 e->Graphics->DrawString(((DateTime)MyBorrowTable->Rows[i][6]).ToShortDateString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 540, MyPosY);
                 e->Graphics->DrawString(MyBorrowTable->Rows[i][8]->ToString(), gcnew System::Drawing::Font("宋体", 12), Brushes::Black, 640, MyPosY);
                 MyPosY = MyPosY + 20;
             }
            e->Graphics->DrawLine(gcnew Pen(Color::Black, (float)3.00), 100, 1070, 720, 1070);              
		 }
	};
}

⌨️ 快捷键说明

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