📄 selltable.h
字号:
#pragma once
#include "LinkDataBase.h"
#include "DataGridDoubleClickColumn.h"
#include "DataGridNoActiveCellColumn.h"
#include "ClientDataManage.h"
#include "WareDataManage.h"
#include "SelectStorage.h"
#include "SelectSellTable.h"
#include "SellTableReportForm.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>
/// SellTable 摘要
///
/// 警告: 如果您更改该类的名称,则将需要更改
/// 与该类所依赖的所有 .resx 文件关联的托管资源编译器工具的
/// “资源文件名”属性。 否则,
/// 设计器将不能与此窗体关联的
/// 本地化资源正确交互。
/// </summary>
public __gc class SellTable : public System::Windows::Forms::Form
{
//--------------------成员声明------------------------
public:
String* InputWareID;
String* InputWareName;
String* InputStorageName;
String* InputStorage;
String* InputClientName;
String* InputClientID;
//当前销售单编号
int intSellID;
int NewDetailID;
//String* Input
private:
LinkDataBase* MyDataBase; //数据库连接类
SqlDataAdapter* SellDetailAdpater;
SqlDataAdapter* StorageAdpater;
SqlDataAdapter* SellTableAdpater;
DataSet* ds;
bool blSellTableShow;
String* strTableName;
String* strSQL;
DataTable* NewTable;
//-------------------成员声明结束-----------------------
public:
SellTable(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->SellTableAdpater = new SqlDataAdapter();
this->dgrdSellTable->Enabled = false;
this->SellDetailAdpater = new SqlDataAdapter();
//设置销售单明细更新处理
this->SellDetailAdpater->add_RowUpdating(new SqlRowUpdatingEventHandler(0,this->UpdateSellDetail));
//Insert
this->SellDetailAdpater->InsertCommand = new SqlCommand();
this->SellDetailAdpater->InsertCommand->CommandText = S"INSERT INTO 销售单明细(编号, 销售单号, 货号, 销售数量, 销售价, 税价合计, 扣率, 税率, 不含税价, 税额, 仓库) VALUES (@编"
S"号, @销售单号, @货号, @销售数量, @销售价, @税价合计, @扣率, @税率, @不含税价, @税额, @仓库)";
this->SellDetailAdpater->InsertCommand->Connection = this->MyDataBase->myConnection;
this->SellDetailAdpater->InsertCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@编号", System::Data::SqlDbType::VarChar, 14, S"编号"));
this->SellDetailAdpater->InsertCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@销售单号", System::Data::SqlDbType::VarChar, 14, S"销售单号"));
this->SellDetailAdpater->InsertCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@货号", System::Data::SqlDbType::VarChar, 14, S"货号"));
this->SellDetailAdpater->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->SellDetailAdpater->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->SellDetailAdpater->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->SellDetailAdpater->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->SellDetailAdpater->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->SellDetailAdpater->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->SellDetailAdpater->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->SellDetailAdpater->InsertCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@仓库", System::Data::SqlDbType::VarChar, 20, S"仓库"));
//Update
this->SellDetailAdpater->UpdateCommand = new SqlCommand();
this->SellDetailAdpater->UpdateCommand->CommandText = S"UPDATE 销售单明细 SET 编号 = @编号, 销售单号 = @销售单号, 货号 = @货号, 销售数量 = @销售数量, 销售价 = @销售价, 税价合计"
S" = @税价合计, 扣率 = @扣率, 税率 = @税率, 不含税价 = @不含税价, 税额 = @税额, 仓库 = @仓库 WHERE (编号 = @Original_编号)";
this->SellDetailAdpater->UpdateCommand->Connection = this->MyDataBase->myConnection;
this->SellDetailAdpater->UpdateCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@编号", System::Data::SqlDbType::VarChar, 14, S"编号"));
this->SellDetailAdpater->UpdateCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@销售单号", System::Data::SqlDbType::VarChar, 14, S"销售单号"));
this->SellDetailAdpater->UpdateCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@货号", System::Data::SqlDbType::VarChar, 14, S"货号"));
this->SellDetailAdpater->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->SellDetailAdpater->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->SellDetailAdpater->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->SellDetailAdpater->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->SellDetailAdpater->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->SellDetailAdpater->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->SellDetailAdpater->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->SellDetailAdpater->UpdateCommand->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@仓库", System::Data::SqlDbType::VarChar, 20, S"仓库"));
this->SellDetailAdpater->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));
//Delete
this->SellDetailAdpater->DeleteCommand = new SqlCommand();
this->SellDetailAdpater->DeleteCommand->CommandText = S"DELETE FROM 销售单明细 WHERE (编号 = @Original_编号)";
this->SellDetailAdpater->DeleteCommand->Connection = this->MyDataBase->myConnection;
this->SellDetailAdpater->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));
NewSellTable();
}
protected:
void Dispose(Boolean disposing)
{
if (disposing && components)
{
components->Dispose();
}
__super::Dispose(disposing);
}
private: System::Windows::Forms::ToolBar * toolBar1;
private: System::Windows::Forms::ToolBarButton * tbarSave;
private: System::Windows::Forms::ToolBarButton * tbarDelete;
private: System::Windows::Forms::ImageList * imageList1;
private: System::Windows::Forms::ToolBarButton * tbarNew;
private: System::Windows::Forms::ToolBarButton * tbarSearch;
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::ToolBarButton * tbarPrint;
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::TextBox * tBoxClientID;
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 * tBoxSellDate;
private: System::Windows::Forms::TextBox * tBoxClientName;
private: System::Windows::Forms::DataGrid * dgrdSellTable;
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::SellTable));
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->dgrdSellTable = 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->tBoxClientID = 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->tBoxSellDate = new System::Windows::Forms::TextBox();
this->tBoxClientName = new System::Windows::Forms::TextBox();
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();
(__try_cast<System::ComponentModel::ISupportInitialize * >(this->dgrdSellTable))->BeginInit();
this->groupBox1->SuspendLayout();
this->groupBox2->SuspendLayout();
this->SuspendLayout();
//
// toolBar1
//
System::Windows::Forms::ToolBarButton* __mcTemp__1[] = new System::Windows::Forms::ToolBarButton*[5];
__mcTemp__1[0] = this->tbarNew;
__mcTemp__1[1] = this->tbarSearch;
__mcTemp__1[2] = this->tbarSave;
__mcTemp__1[3] = this->tbarDelete;
__mcTemp__1[4] = this->tbarPrint;
this->toolBar1->Buttons->AddRange(__mcTemp__1);
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(744, 41);
this->toolBar1->TabIndex = 18;
this->toolBar1->ButtonClick += new System::Windows::Forms::ToolBarButtonClickEventHandler(this, toolBar1_ButtonClick);
//
// tbarNew
//
this->tbarNew->ImageIndex = 4;
this->tbarNew->Text = S"新建";
this->tbarNew->ToolTipText = S"新建";
this->tbarNew->Visible = false;
//
// tbarSearch
//
this->tbarSearch->ImageIndex = 1;
this->tbarSearch->Text = S"查看";
this->tbarSearch->ToolTipText = S"查看";
this->tbarSearch->Visible = false;
//
// tbarSave
//
this->tbarSave->ImageIndex = 0;
this->tbarSave->Text = S"保存";
this->tbarSave->ToolTipText = S"保存修改";
//
// tbarDelete
//
this->tbarDelete->ImageIndex = 3;
this->tbarDelete->Text = S"删除";
this->tbarDelete->ToolTipText = S"删除";
//
// tbarPrint
//
this->tbarPrint->ImageIndex = 2;
this->tbarPrint->Text = S"打印";
this->tbarPrint->ToolTipText = S"打印";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -