📄 stocktable.h
字号:
#pragma once
#include "LinkDataBase.h"
#include "DataGridDoubleClickColumn.h"
#include "DataGridNoActiveCellColumn.h"
#include "StokerDataManage.h"
#include "WareDataManage.h"
#include "SelectStorage.h"
#include "SelectImportTable.h"
#include "ImportReportForm.h"
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
namespace My
{
/// <summary>
/// StockTable 摘要
///
/// 警告: 如果您更改该类的名称,则将需要更改
/// 与该类所依赖的所有 .resx 文件关联的托管资源编译器工具的
/// “资源文件名”属性。 否则,
/// 设计器将不能与此窗体关联的
/// 本地化资源正确交互。
/// </summary>
public __gc class StockTable : public System::Windows::Forms::Form
{
//--------------------成员声明------------------------
public:
String* InputWareID;
String* InputWareName;
String* InputStorageName;
String* InputStorage;
String* InputStockerName;
String* InputStockerID;
//当前进货单编号
int intImportID;
int NewDetailID;
private:
LinkDataBase* MyDataBase; //数据库连接类
SqlDataAdapter* ImportDetailAdpater;
SqlDataAdapter* StorageAdpater;
SqlDataAdapter* ImportTableAdpater;
DataSet* ds;
bool blImportShow;
String* strTableName;
String* strSQL;
DataTable* NewTable;
//-------------------成员声明结束-----------------------
public:
StockTable(void)
{
InitializeComponent();
this->MyDataBase = new LinkDataBase();
this->ds = new DataSet();
this->StorageAdpater = new SqlDataAdapter();
//设置库存更新处理
this->StorageAdpater->add_RowUpdating(new SqlRowUpdatingEventHandler(0,this->UpdateStorage));
//Update
this->StorageAdpater->UpdateCommand = new SqlCommand();
this->StorageAdpater->UpdateCommand->CommandText = S"Update 库存库 Set 库存数量 = @库存数量 Where 货号 = @货号 AND 仓库 = @仓库";
this->StorageAdpater->UpdateCommand->Connection = this->MyDataBase->myConnection;
this->StorageAdpater->UpdateCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@货号", System::Data::SqlDbType::VarChar, 14, S"货号"));
this->StorageAdpater->UpdateCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@仓库", System::Data::SqlDbType::VarChar, 20, S"仓库"));
this->StorageAdpater->UpdateCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@库存数量", System::Data::SqlDbType::Decimal, 13, System::Data::ParameterDirection::Input, false, (System::Byte)28, (System::Byte)6, S"库存数量", System::Data::DataRowVersion::Current, 0));
//设置库存新增处理
this->StorageAdpater->InsertCommand = new SqlCommand();
this->StorageAdpater->InsertCommand->CommandText = S"Insert Into 库存库 (货号,仓库,库存数量,库存金额,库存单价) Values (@货号,@仓库,@库存数量,@库存金额,@库存单价)";
this->StorageAdpater->InsertCommand->Connection = this->MyDataBase->myConnection;
this->StorageAdpater->InsertCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@货号", System::Data::SqlDbType::VarChar, 14, S"货号"));
this->StorageAdpater->InsertCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@仓库", System::Data::SqlDbType::VarChar, 20, S"仓库"));
this->StorageAdpater->InsertCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@库存数量", System::Data::SqlDbType::Decimal, 13, System::Data::ParameterDirection::Input, false, (System::Byte)28, (System::Byte)6, S"库存数量", System::Data::DataRowVersion::Current, 0));
this->StorageAdpater->InsertCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@库存金额", System::Data::SqlDbType::Decimal, 13, System::Data::ParameterDirection::Input, false, (System::Byte)28, (System::Byte)6, S"库存金额", System::Data::DataRowVersion::Current, 0));
this->StorageAdpater->InsertCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@库存单价", System::Data::SqlDbType::Decimal, 13, System::Data::ParameterDirection::Input, false, (System::Byte)28, (System::Byte)6, S"库存单价", System::Data::DataRowVersion::Current, 0));
this->ImportTableAdpater = new SqlDataAdapter();
this->dgrdImportTable->Enabled = false;
this->ImportDetailAdpater = new SqlDataAdapter();
//设置进货单明细更新处理
this->ImportDetailAdpater->add_RowUpdating(new SqlRowUpdatingEventHandler(0,this->UpdateImportDetail));
//Insert
this->ImportDetailAdpater->InsertCommand = new SqlCommand();
this->ImportDetailAdpater->InsertCommand->CommandText = S"INSERT INTO 进货单明细(编号, 进货单号, 货号, 进货数量, 进价, 税价合计, 扣率, 税率, 不含税价, 税额, 仓库,货物质量) VALUES (@编"
S"号, @进货单号, @货号, @进货数量, @进价, @税价合计, @扣率, @税率, @不含税价, @税额, @仓库, @货物质量)";
this->ImportDetailAdpater->InsertCommand->Connection = this->MyDataBase->myConnection;
this->ImportDetailAdpater->InsertCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@编号", System::Data::SqlDbType::VarChar, 14, S"编号"));
this->ImportDetailAdpater->InsertCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@进货单号", System::Data::SqlDbType::VarChar, 14, S"进货单号"));
this->ImportDetailAdpater->InsertCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@货号", System::Data::SqlDbType::VarChar, 14, S"货号"));
this->ImportDetailAdpater->InsertCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@进货数量", System::Data::SqlDbType::Decimal, 13, System::Data::ParameterDirection::Input, false, (System::Byte)28, (System::Byte)6, S"进货数量", System::Data::DataRowVersion::Current, 0));
this->ImportDetailAdpater->InsertCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@进价", System::Data::SqlDbType::Decimal, 13, System::Data::ParameterDirection::Input, false, (System::Byte)28, (System::Byte)6, S"进价", System::Data::DataRowVersion::Current, 0));
this->ImportDetailAdpater->InsertCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@税价合计", System::Data::SqlDbType::Decimal, 13, System::Data::ParameterDirection::Input, false, (System::Byte)28, (System::Byte)6, S"", System::Data::DataRowVersion::Current, 0));
this->ImportDetailAdpater->InsertCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@扣率", System::Data::SqlDbType::Decimal, 13, System::Data::ParameterDirection::Input, false, (System::Byte)28, (System::Byte)6, S"扣率", System::Data::DataRowVersion::Current, 0));
this->ImportDetailAdpater->InsertCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@税率", System::Data::SqlDbType::Decimal, 13, System::Data::ParameterDirection::Input, false, (System::Byte)28, (System::Byte)6, S"税率", System::Data::DataRowVersion::Current, 0));
this->ImportDetailAdpater->InsertCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@不含税价", System::Data::SqlDbType::Decimal, 13, System::Data::ParameterDirection::Input, false, (System::Byte)28, (System::Byte)6, S"", System::Data::DataRowVersion::Current, 0));
this->ImportDetailAdpater->InsertCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@税额", System::Data::SqlDbType::Decimal, 13, System::Data::ParameterDirection::Input, false, (System::Byte)28, (System::Byte)6, S"", System::Data::DataRowVersion::Current, 0));
this->ImportDetailAdpater->InsertCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@仓库", System::Data::SqlDbType::VarChar, 20, S"仓库"));
this->ImportDetailAdpater->InsertCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@货物质量", System::Data::SqlDbType::VarChar, 14, S"货物质量"));
//Update
this->ImportDetailAdpater->UpdateCommand = new SqlCommand();
this->ImportDetailAdpater->UpdateCommand->CommandText = S"UPDATE 进货单明细 SET 编号 = @编号, 进货单号 = @进货单号, 货号 = @货号, 进货数量 = @进货数量, 进价 = @进价, 税价合计"
S" = @税价合计, 扣率 = @扣率, 税率 = @税率, 不含税价 = @不含税价, 税额 = @税额, 仓库 = @仓库, 货物质量 = @货物质量 WHERE (编号 = @Original_编号)";
this->ImportDetailAdpater->UpdateCommand->Connection = this->MyDataBase->myConnection;
this->ImportDetailAdpater->UpdateCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@编号", System::Data::SqlDbType::VarChar, 14, S"编号"));
this->ImportDetailAdpater->UpdateCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@进货单号", System::Data::SqlDbType::VarChar, 14, S"进货单号"));
this->ImportDetailAdpater->UpdateCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@货号", System::Data::SqlDbType::VarChar, 14, S"货号"));
this->ImportDetailAdpater->UpdateCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@进货数量", System::Data::SqlDbType::Decimal, 13, System::Data::ParameterDirection::Input, false, (System::Byte)28, (System::Byte)6, S"进货数量", System::Data::DataRowVersion::Current, 0));
this->ImportDetailAdpater->UpdateCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@进价", System::Data::SqlDbType::Decimal, 13, System::Data::ParameterDirection::Input, false, (System::Byte)28, (System::Byte)6, S"进价", System::Data::DataRowVersion::Current, 0));
this->ImportDetailAdpater->UpdateCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@税价合计", System::Data::SqlDbType::Decimal, 13, System::Data::ParameterDirection::Input, false, (System::Byte)28, (System::Byte)6, S"", System::Data::DataRowVersion::Current, 0));
this->ImportDetailAdpater->UpdateCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@扣率", System::Data::SqlDbType::Decimal, 13, System::Data::ParameterDirection::Input, false, (System::Byte)28, (System::Byte)6, S"扣率", System::Data::DataRowVersion::Current, 0));
this->ImportDetailAdpater->UpdateCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@税率", System::Data::SqlDbType::Decimal, 13, System::Data::ParameterDirection::Input, false, (System::Byte)28, (System::Byte)6, S"税率", System::Data::DataRowVersion::Current, 0));
this->ImportDetailAdpater->UpdateCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@不含税价", System::Data::SqlDbType::Decimal, 13, System::Data::ParameterDirection::Input, false, (System::Byte)28, (System::Byte)6, S"", System::Data::DataRowVersion::Current, 0));
this->ImportDetailAdpater->UpdateCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@税额", System::Data::SqlDbType::Decimal, 13, System::Data::ParameterDirection::Input, false, (System::Byte)28, (System::Byte)6, S"", System::Data::DataRowVersion::Current, 0));
this->ImportDetailAdpater->UpdateCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@仓库", System::Data::SqlDbType::VarChar, 20, S"仓库"));
this->ImportDetailAdpater->UpdateCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@Original_编号", System::Data::SqlDbType::VarChar, 14, System::Data::ParameterDirection::Input, false, (System::Byte)0, (System::Byte)0, S"编号", System::Data::DataRowVersion::Original, 0));
this->ImportDetailAdpater->UpdateCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@货物质量", System::Data::SqlDbType::VarChar, 14, S"货物质量"));
//Delete
this->ImportDetailAdpater->DeleteCommand = new SqlCommand();
this->ImportDetailAdpater->DeleteCommand->CommandText = S"DELETE FROM 进货单明细 WHERE (编号 = @Original_编号)";
this->ImportDetailAdpater->DeleteCommand->Connection = this->MyDataBase->myConnection;
this->ImportDetailAdpater->DeleteCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@Original_编号", System::Data::SqlDbType::VarChar, 14, System::Data::ParameterDirection::Input, false, (System::Byte)0, (System::Byte)0, S"编号", System::Data::DataRowVersion::Original, 0));
NewImportTable();
}
protected:
void Dispose(Boolean disposing)
{
if (disposing && components)
{
components->Dispose();
}
__super::Dispose(disposing);
}
private: System::Windows::Forms::GroupBox * groupBox2;
private: System::Windows::Forms::Label * label8;
private: System::Windows::Forms::TextBox * tBoxTax;
private: System::Windows::Forms::Label * label7;
private: System::Windows::Forms::TextBox * tBoxTotalNoTax;
private: System::Windows::Forms::Label * label4;
private: System::Windows::Forms::TextBox * tBoxTotal;
private: System::Windows::Forms::ToolBar * toolBar1;
private: System::Windows::Forms::ToolBarButton * tbarNew;
private: System::Windows::Forms::ToolBarButton * tbarSearch;
private: System::Windows::Forms::ToolBarButton * tbarSave;
private: System::Windows::Forms::ToolBarButton * tbarDelete;
private: System::Windows::Forms::ToolBarButton * tbarPrint;
private: System::Windows::Forms::ImageList * imageList1;
private: System::Windows::Forms::DataGrid * dgrdImportTable;
private: System::Windows::Forms::GroupBox * groupBox1;
private: System::Windows::Forms::Label * label6;
private: System::Windows::Forms::TextBox * tBoxStorage;
private: System::Windows::Forms::Label * label5;
private: System::Windows::Forms::TextBox * tBoxWareID;
private: System::Windows::Forms::Button * button1;
private: System::Windows::Forms::Label * label3;
private: System::Windows::Forms::ComboBox * cmbOperator;
private: System::Windows::Forms::Label * label2;
private: System::Windows::Forms::TextBox * tBoxMaker;
private: System::Windows::Forms::Label * label1;
private: System::Windows::Forms::TextBox * tBoxImportDate;
private: System::Windows::Forms::TextBox * tBoxStockerID;
private: System::Windows::Forms::TextBox * tBoxStockerName;
private: System::ComponentModel::IContainer * components;
private:
/// <summary>
/// 必需的设计器变量。
/// </summary>
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
void InitializeComponent(void)
{
this->components = new System::ComponentModel::Container();
System::Resources::ResourceManager * resources = new System::Resources::ResourceManager(__typeof(My::StockTable));
this->groupBox2 = new System::Windows::Forms::GroupBox();
this->label8 = new System::Windows::Forms::Label();
this->tBoxTax = new System::Windows::Forms::TextBox();
this->label7 = new System::Windows::Forms::Label();
this->tBoxTotalNoTax = new System::Windows::Forms::TextBox();
this->label4 = new System::Windows::Forms::Label();
this->tBoxTotal = new System::Windows::Forms::TextBox();
this->toolBar1 = new System::Windows::Forms::ToolBar();
this->tbarNew = new System::Windows::Forms::ToolBarButton();
this->tbarSearch = new System::Windows::Forms::ToolBarButton();
this->tbarSave = new System::Windows::Forms::ToolBarButton();
this->tbarDelete = new System::Windows::Forms::ToolBarButton();
this->tbarPrint = new System::Windows::Forms::ToolBarButton();
this->imageList1 = new System::Windows::Forms::ImageList(this->components);
this->dgrdImportTable = new System::Windows::Forms::DataGrid();
this->groupBox1 = new System::Windows::Forms::GroupBox();
this->label6 = new System::Windows::Forms::Label();
this->tBoxStorage = new System::Windows::Forms::TextBox();
this->label5 = new System::Windows::Forms::Label();
this->tBoxWareID = new System::Windows::Forms::TextBox();
this->tBoxStockerID = new System::Windows::Forms::TextBox();
this->button1 = new System::Windows::Forms::Button();
this->label3 = new System::Windows::Forms::Label();
this->cmbOperator = new System::Windows::Forms::ComboBox();
this->label2 = new System::Windows::Forms::Label();
this->tBoxMaker = new System::Windows::Forms::TextBox();
this->label1 = new System::Windows::Forms::Label();
this->tBoxImportDate = new System::Windows::Forms::TextBox();
this->tBoxStockerName = new System::Windows::Forms::TextBox();
this->groupBox2->SuspendLayout();
(__try_cast<System::ComponentModel::ISupportInitialize * >(this->dgrdImportTable))->BeginInit();
this->groupBox1->SuspendLayout();
this->SuspendLayout();
//
// groupBox2
//
this->groupBox2->Controls->Add(this->label8);
this->groupBox2->Controls->Add(this->tBoxTax);
this->groupBox2->Controls->Add(this->label7);
this->groupBox2->Controls->Add(this->tBoxTotalNoTax);
this->groupBox2->Controls->Add(this->label4);
this->groupBox2->Controls->Add(this->tBoxTotal);
this->groupBox2->Dock = System::Windows::Forms::DockStyle::Bottom;
this->groupBox2->Location = System::Drawing::Point(0, 357);
this->groupBox2->Name = S"groupBox2";
this->groupBox2->Size = System::Drawing::Size(752, 96);
this->groupBox2->TabIndex = 45;
this->groupBox2->TabStop = false;
//
// label8
//
this->label8->Location = System::Drawing::Point(510, 41);
this->label8->Name = S"label8";
this->label8->Size = System::Drawing::Size(57, 16);
this->label8->TabIndex = 44;
this->label8->Text = S"税额";
//
// tBoxTax
//
this->tBoxTax->Location = System::Drawing::Point(580, 36);
this->tBoxTax->Name = S"tBoxTax";
this->tBoxTax->Size = System::Drawing::Size(144, 21);
this->tBoxTax->TabIndex = 45;
this->tBoxTax->Text = S"";
//
// label7
//
this->label7->Location = System::Drawing::Point(260, 40);
this->label7->Name = S"label7";
this->label7->Size = System::Drawing::Size(72, 16);
this->label7->TabIndex = 42;
this->label7->Text = S"不含税金额";
//
// tBoxTotalNoTax
//
this->tBoxTotalNoTax->Location = System::Drawing::Point(348, 37);
this->tBoxTotalNoTax->Name = S"tBoxTotalNoTax";
this->tBoxTotalNoTax->Size = System::Drawing::Size(144, 21);
this->tBoxTotalNoTax->TabIndex = 43;
this->tBoxTotalNoTax->Text = S"";
//
// label4
//
this->label4->Location = System::Drawing::Point(20, 40);
this->label4->Name = S"label4";
this->label4->Size = System::Drawing::Size(57, 16);
this->label4->TabIndex = 40;
this->label4->Text = S"合计金额";
//
// tBoxTotal
//
this->tBoxTotal->Location = System::Drawing::Point(100, 40);
this->tBoxTotal->Name = S"tBoxTotal";
this->tBoxTotal->Size = System::Drawing::Size(144, 21);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -