📄 importreportform.h
字号:
#pragma once
#using <C:\Program Files\Common Files\Crystal Decisions\1.1\Managed\CrystalDecisions.CrystalReports.Engine.dll>
#using <C:\Program Files\Common Files\Crystal Decisions\1.1\Managed\CrystalDecisions.Windows.Forms.dll>
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
using namespace CrystalDecisions::CrystalReports::Engine;
using namespace CrystalDecisions::Windows::Forms;
namespace My
{
/// <summary>
/// ImportReportForm 摘要
///
/// 警告: 如果您更改该类的名称,则将需要更改
/// 与该类所依赖的所有 .resx 文件关联的托管资源编译器工具的
/// “资源文件名”属性。 否则,
/// 设计器将不能与此窗体关联的
/// 本地化资源正确交互。
/// </summary>
public __gc class ImportReportForm : public System::Windows::Forms::Form
{
public:
String* ID;
public:
ImportReportForm(String* strID)
{
InitializeComponent();
ID = strID;
}
protected:
void Dispose(Boolean disposing)
{
if (disposing && components)
{
components->Dispose();
}
__super::Dispose(disposing);
}
private: CrystalDecisions::Windows::Forms::CrystalReportViewer * crystalReportViewer1;
private: System::Data::SqlClient::SqlDataAdapter * sqlDataAdapter1;
private: My::DataSet1 * dataSet11;
private: System::Data::SqlClient::SqlCommand * sqlSelectCommand1;
private: System::Data::SqlClient::SqlConnection * sqlConnection1;
private: My::DataSetImportTable * dataSetImportTable1;
private:
/// <summary>
/// 必需的设计器变量。
/// </summary>
System::ComponentModel::Container* components;
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
void InitializeComponent(void)
{
this->crystalReportViewer1 = new CrystalDecisions::Windows::Forms::CrystalReportViewer();
this->sqlDataAdapter1 = new System::Data::SqlClient::SqlDataAdapter();
this->sqlSelectCommand1 = new System::Data::SqlClient::SqlCommand();
this->sqlConnection1 = new System::Data::SqlClient::SqlConnection();
this->dataSetImportTable1 = new My::DataSetImportTable();
(__try_cast<System::ComponentModel::ISupportInitialize * >(this->dataSetImportTable1))->BeginInit();
this->SuspendLayout();
//
// crystalReportViewer1
//
this->crystalReportViewer1->ActiveViewIndex = -1;
this->crystalReportViewer1->DisplayGroupTree = false;
this->crystalReportViewer1->Dock = System::Windows::Forms::DockStyle::Fill;
this->crystalReportViewer1->Location = System::Drawing::Point(0, 0);
this->crystalReportViewer1->Name = S"crystalReportViewer1";
this->crystalReportViewer1->ReportSource = 0;
this->crystalReportViewer1->Size = System::Drawing::Size(720, 373);
this->crystalReportViewer1->TabIndex = 0;
//
// sqlDataAdapter1
//
this->sqlDataAdapter1->ContinueUpdateOnError = true;
this->sqlDataAdapter1->SelectCommand = this->sqlSelectCommand1;
System::Data::Common::DataTableMapping* __mcTemp__1[] = new System::Data::Common::DataTableMapping*[1];
System::Data::Common::DataColumnMapping* __mcTemp__2[] = new System::Data::Common::DataColumnMapping*[10];
__mcTemp__2[0] = new System::Data::Common::DataColumnMapping(S"Date", S"Date");
__mcTemp__2[1] = new System::Data::Common::DataColumnMapping(S"Total", S"Total");
__mcTemp__2[2] = new System::Data::Common::DataColumnMapping(S"Quantity", S"Quantity");
__mcTemp__2[3] = new System::Data::Common::DataColumnMapping(S"Price", S"Price");
__mcTemp__2[4] = new System::Data::Common::DataColumnMapping(S"DetailTotal", S"DetailTotal");
__mcTemp__2[5] = new System::Data::Common::DataColumnMapping(S"Discount", S"Discount");
__mcTemp__2[6] = new System::Data::Common::DataColumnMapping(S"TaxRate", S"TaxRate");
__mcTemp__2[7] = new System::Data::Common::DataColumnMapping(S"Depot", S"Depot");
__mcTemp__2[8] = new System::Data::Common::DataColumnMapping(S"WareName", S"WareName");
__mcTemp__2[9] = new System::Data::Common::DataColumnMapping(S"StockerName", S"StockerName");
__mcTemp__1[0] = new System::Data::Common::DataTableMapping(S"Table", S"ImportTable", __mcTemp__2);
this->sqlDataAdapter1->TableMappings->AddRange(__mcTemp__1);
//
// sqlSelectCommand1
//
this->sqlSelectCommand1->CommandText = S"SELECT 进货单.进货日期 AS Date, 进货单.税价合计 AS Total, 进货单明细.进货数量 AS Quantity, 进货单明细.进价 AS P"
S"rice, 进货单明细.税价合计 AS DetailTotal, 进货单明细.扣率 AS Discount, 进货单明细.税率 AS TaxRate, 进货单明"
S"细.仓库 AS Depot, 商品清单.品名 AS WareName, 供货商清单.名称 AS StockerName FROM 进货单 INNER JOIN "
S"进货单明细 ON 进货单.编号 = 进货单明细.进货单号 INNER JOIN 商品清单 ON 进货单明细.货号 = 商品清单.货号 INNER JOIN 供货"
S"商清单 ON 进货单.供货商号 = 供货商清单.供货商号 WHERE (进货单.编号 = @ID)";
this->sqlSelectCommand1->Connection = this->sqlConnection1;
this->sqlSelectCommand1->Parameters->Add(new System::Data::SqlClient::SqlParameter(S"@ID", System::Data::SqlDbType::VarChar, 14, S"编号"));
//
// sqlConnection1
//
this->sqlConnection1->ConnectionString = S"workstation id=localhost;packet size=4096;integrated security=SSPI;initial catalo"
S"g=jxcbook;persist security info=False";
//
// dataSetImportTable1
//
this->dataSetImportTable1->DataSetName = S"DataSetImportTable";
this->dataSetImportTable1->Locale = new System::Globalization::CultureInfo(S"zh-CN");
//
// ImportReportForm
//
this->AutoScaleBaseSize = System::Drawing::Size(6, 14);
this->ClientSize = System::Drawing::Size(720, 373);
this->Controls->Add(this->crystalReportViewer1);
this->Name = S"ImportReportForm";
this->Text = S"ImportReportForm";
this->Load += new System::EventHandler(this, ImportReportForm_Load);
(__try_cast<System::ComponentModel::ISupportInitialize * >(this->dataSetImportTable1))->EndInit();
this->ResumeLayout(false);
}
private: System::Void ImportReportForm_Load(System::Object * sender, System::EventArgs * e)
{
//读入数据
this->sqlSelectCommand1->Parameters->Item[S"@ID"]->Value = this->ID;
this->sqlDataAdapter1->Fill(this->dataSetImportTable1,S"进货报表");
//设置报表数据源
ReportDocument* oRpt = new ReportDocument();
oRpt->Load(".\\ImportReport.rpt");
oRpt->SetDataSource(this->dataSetImportTable1->Tables->Item[S"进货报表"]);
crystalReportViewer1->ReportSource = oRpt;
}
};
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -