📄 fixedassetsform.h
字号:
this->固定资产明细DataGridView->Location = System::Drawing::Point(4, 271);
this->固定资产明细DataGridView->MultiSelect = false;
this->固定资产明细DataGridView->Name = L"固定资产明细DataGridView";
this->固定资产明细DataGridView->ReadOnly = true;
this->固定资产明细DataGridView->RowHeadersVisible = false;
this->固定资产明细DataGridView->RowTemplate->Height = 23;
this->固定资产明细DataGridView->SelectionMode = System::Windows::Forms::DataGridViewSelectionMode::FullRowSelect;
this->固定资产明细DataGridView->Size = System::Drawing::Size(533, 141);
this->固定资产明细DataGridView->TabIndex = 52;
//
// 固定资产明细BindingNavigator
//
this->固定资产明细BindingNavigator->AddNewItem = this->bindingNavigatorAddNewItem;
this->固定资产明细BindingNavigator->BindingSource = this->固定资产明细BindingSource;
this->固定资产明细BindingNavigator->CountItem = this->bindingNavigatorCountItem;
this->固定资产明细BindingNavigator->DeleteItem = this->bindingNavigatorDeleteItem;
this->固定资产明细BindingNavigator->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(15) {this->名称ToolStripLabel,
this->名称ToolStripTextBox, this->查询ToolStripButton, this->bindingNavigatorMoveFirstItem, this->bindingNavigatorMovePreviousItem,
this->bindingNavigatorSeparator, this->bindingNavigatorPositionItem, this->bindingNavigatorCountItem, this->bindingNavigatorSeparator1,
this->bindingNavigatorMoveNextItem, this->bindingNavigatorMoveLastItem, this->bindingNavigatorSeparator2, this->bindingNavigatorAddNewItem,
this->bindingNavigatorDeleteItem, this->固定资产明细BindingNavigatorSaveItem});
this->固定资产明细BindingNavigator->Location = System::Drawing::Point(0, 0);
this->固定资产明细BindingNavigator->MoveFirstItem = this->bindingNavigatorMoveFirstItem;
this->固定资产明细BindingNavigator->MoveLastItem = this->bindingNavigatorMoveLastItem;
this->固定资产明细BindingNavigator->MoveNextItem = this->bindingNavigatorMoveNextItem;
this->固定资产明细BindingNavigator->MovePreviousItem = this->bindingNavigatorMovePreviousItem;
this->固定资产明细BindingNavigator->Name = L"固定资产明细BindingNavigator";
this->固定资产明细BindingNavigator->PositionItem = this->bindingNavigatorPositionItem;
this->固定资产明细BindingNavigator->Size = System::Drawing::Size(542, 25);
this->固定资产明细BindingNavigator->TabIndex = 51;
this->固定资产明细BindingNavigator->Text = L"bindingNavigator1";
//
// bindingNavigatorDeleteItem
//
this->bindingNavigatorDeleteItem->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"bindingNavigatorDeleteItem.Image")));
this->bindingNavigatorDeleteItem->Name = L"bindingNavigatorDeleteItem";
this->bindingNavigatorDeleteItem->RightToLeftAutoMirrorImage = true;
this->bindingNavigatorDeleteItem->Size = System::Drawing::Size(49, 22);
this->bindingNavigatorDeleteItem->Text = L"删除";
//
// 名称ToolStripLabel
//
this->名称ToolStripLabel->Name = L"名称ToolStripLabel";
this->名称ToolStripLabel->Size = System::Drawing::Size(35, 22);
this->名称ToolStripLabel->Text = L"名称:";
//
// 名称ToolStripTextBox
//
this->名称ToolStripTextBox->Name = L"名称ToolStripTextBox";
this->名称ToolStripTextBox->Size = System::Drawing::Size(100, 25);
this->名称ToolStripTextBox->Text = L"%%";
//
// 查询ToolStripButton
//
this->查询ToolStripButton->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Text;
this->查询ToolStripButton->Name = L"查询ToolStripButton";
this->查询ToolStripButton->Size = System::Drawing::Size(33, 22);
this->查询ToolStripButton->Text = L"查询";
this->查询ToolStripButton->Click += gcnew System::EventHandler(this, &FixedAssetsForm::查询ToolStripButton_Click);
//
// bindingNavigatorMoveFirstItem
//
this->bindingNavigatorMoveFirstItem->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
this->bindingNavigatorMoveFirstItem->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"bindingNavigatorMoveFirstItem.Image")));
this->bindingNavigatorMoveFirstItem->Name = L"bindingNavigatorMoveFirstItem";
this->bindingNavigatorMoveFirstItem->RightToLeftAutoMirrorImage = true;
this->bindingNavigatorMoveFirstItem->Size = System::Drawing::Size(23, 22);
this->bindingNavigatorMoveFirstItem->Text = L"移到第一条记录";
//
// bindingNavigatorMovePreviousItem
//
this->bindingNavigatorMovePreviousItem->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
this->bindingNavigatorMovePreviousItem->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"bindingNavigatorMovePreviousItem.Image")));
this->bindingNavigatorMovePreviousItem->Name = L"bindingNavigatorMovePreviousItem";
this->bindingNavigatorMovePreviousItem->RightToLeftAutoMirrorImage = true;
this->bindingNavigatorMovePreviousItem->Size = System::Drawing::Size(23, 22);
this->bindingNavigatorMovePreviousItem->Text = L"移到上一条记录";
//
// FixedAssetsForm
//
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->附属设备及配件Button);
this->Controls->Add(this->自编号TextBox);
this->Controls->Add(this->资产编号TextBox);
this->Controls->Add(this->名称TextBox);
this->Controls->Add(this->型号TextBox);
this->Controls->Add(this->制造厂家TextBox);
this->Controls->Add(this->出厂日期DateTimePicker);
this->Controls->Add(this->入帐日期DateTimePicker);
this->Controls->Add(this->存放地点TextBox);
this->Controls->Add(this->使用部门ComboBox);
this->Controls->Add(this->使用状态ComboBox);
this->Controls->Add(this->增加方式ComboBox);
this->Controls->Add(this->类别ComboBox);
this->Controls->Add(this->数量TextBox);
this->Controls->Add(this->单位ComboBox);
this->Controls->Add(this->单价TextBox);
this->Controls->Add(this->金额TextBox);
this->Controls->Add(this->资产原值TextBox);
this->Controls->Add(this->累计折旧TextBox);
this->Controls->Add(this->折旧方法ComboBox);
this->Controls->Add(this->折旧月数TextBox);
this->Controls->Add(this->已提月数TextBox);
this->Controls->Add(this->月度折旧额TextBox);
this->Controls->Add(this->预计净残值TextBox);
this->Controls->Add(this->说明TextBox);
this->Controls->Add(自编号Label);
this->Controls->Add(资产编号Label);
this->Controls->Add(名称Label);
this->Controls->Add(型号Label);
this->Controls->Add(制造厂家Label);
this->Controls->Add(出厂日期Label);
this->Controls->Add(入帐日期Label);
this->Controls->Add(存放地点Label);
this->Controls->Add(使用部门Label);
this->Controls->Add(使用状态Label);
this->Controls->Add(增加方式Label);
this->Controls->Add(类别Label);
this->Controls->Add(数量Label);
this->Controls->Add(单位Label);
this->Controls->Add(单价Label);
this->Controls->Add(金额Label);
this->Controls->Add(资产原值Label);
this->Controls->Add(累计折旧Label);
this->Controls->Add(折旧方法Label);
this->Controls->Add(折旧月数Label);
this->Controls->Add(已提月数Label);
this->Controls->Add(月度折旧额Label);
this->Controls->Add(预计净残值Label);
this->Controls->Add(说明Label);
this->Controls->Add(this->固定资产明细DataGridView);
this->Controls->Add(this->固定资产明细BindingNavigator);
this->Name = L"FixedAssetsForm";
this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
this->Text = L"登记固定资产详细信息";
this->Load += gcnew System::EventHandler(this, &FixedAssetsForm::FixedAssetsForm_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();
(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->固定资产明细BindingNavigator))->EndInit();
this->固定资产明细BindingNavigator->ResumeLayout(false);
this->固定资产明细BindingNavigator->PerformLayout();
this->ResumeLayout(false);
this->PerformLayout();
}
#pragma endregion
private: static String^ MyAssetsConnectionString= L"Data Source=.;Initial Catalog=MyAssets;Integrated Security=True;Pooling=False";
private: System::Void 固定资产明细BindingNavigatorSaveItem_Click(System::Object^ sender, System::EventArgs^ e) {
this->Validate();
this->固定资产明细BindingSource->EndEdit();
this->固定资产明细TableAdapter->Update(this->MyAssetsDataSet->固定资产明细);
}
private: System::Void FixedAssetsForm_Load(System::Object^ sender, System::EventArgs^ e) {
//获取公司的部门信息
String^ MySQLConnectionString = MyAssetsConnectionString;
SqlConnection^ MyConnection = gcnew SqlConnection(MySQLConnectionString);
MyConnection->Open();
System::Data::DataTable^ MyDepartmentTable = gcnew System::Data::DataTable();
String^ MySQL = "Select * From 公司部门";
SqlDataAdapter^ MyAdapter = gcnew SqlDataAdapter(MySQL, MyConnection);
MyAdapter->Fill(MyDepartmentTable);
this->使用部门ComboBox->DataSource = MyDepartmentTable;
this->使用部门ComboBox->DisplayMember = "部门名称";
this->使用部门ComboBox->ValueMember = "部门名称";
if (MyConnection->State == ConnectionState::Open)
{
MyConnection->Close();
}
// TODO: 这行代码将数据加载到表“MyAssetsDataSet.固定资产明细”中。您可以根据需要移动或移除它。
this->固定资产明细TableAdapter->Fill(this->MyAssetsDataSet->固定资产明细);
}
private: System::Void 附属设备及配件Button_Click(System::Object^ sender, System::EventArgs^ e) {
FittingsForm^ MyDlg = gcnew FittingsForm();
MyDlg->My资产编号 = this->资产编号TextBox->Text;
MyDlg->ShowDialog();
}
private: System::Void 查询ToolStripButton_Click(System::Object^ sender, System::EventArgs^ e) {
try
{
this->固定资产明细TableAdapter->FillBy(this->MyAssetsDataSet->固定资产明细, 名称ToolStripTextBox->Text);
}
catch (System::Exception^ ex)
{
System::Windows::Forms::MessageBox::Show(ex->Message);
}
}
private: System::Void bindingNavigatorAddNewItem_MouseUp(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) {
//自动计算自编号
String^ MySQLConnectionString = MyAssetsConnectionString;
SqlConnection^ MyConnection = gcnew SqlConnection(MySQLConnectionString);
MyConnection->Open();
SqlCommand^ MyCommand = MyConnection->CreateCommand();
MyCommand->CommandText = "Select max(自编号) 最大编号 From 固定资产明细";
System::Object^ MyResult = MyCommand->ExecuteScalar();
System::Int64 MyID = 1;
if (MyResult != System::DBNull::Value)
{
String^ MyMaxID = MyResult->ToString()->Trim();
MyMaxID = MyMaxID->Substring(2, MyMaxID->Length - 2);
MyID = Convert::ToInt64(MyMaxID) + 1;
}
int MyLength = MyID.ToString()->Length;
String^ MyNewID = "";
switch (MyLength)
{
case 1:
MyNewID = "MX0000000" + MyID.ToString();
break;
case 2:
MyNewID = "MX000000" + MyID.ToString();
break;
case 3:
MyNewID = "MX00000" + MyID.ToString();
break;
case 4:
MyNewID = "MX0000" + MyID.ToString();
break;
case 5:
MyNewID = "MX000" + MyID.ToString();
break;
case 6:
MyNewID = "MX00" + MyID.ToString();
break;
case 7:
MyNewID = "MX0" + MyID.ToString();
break;
}
if (MyConnection->State == ConnectionState::Open)
{
MyConnection->Close();
}
this->自编号TextBox->Text = MyNewID;
}
};
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -