本文整理汇总了C#中XtraReport.LoadLayout方法的典型用法代码示例。如果您正苦于以下问题:C# XtraReport.LoadLayout方法的具体用法?C# XtraReport.LoadLayout怎么用?C# XtraReport.LoadLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XtraReport
的用法示例。
在下文中一共展示了XtraReport.LoadLayout方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BindReport
public static XtraReport BindReport(ReportFile report)
{
//report.DataSource.WriteXmlSchema("rep.xml");
XtraReport rep = new XtraReport();
using (MemoryStream stream = new MemoryStream(report.Report))
{
rep.LoadLayout(stream);
BindingSource bsData = new BindingSource();
bsData.DataSource = report.DataSource;
rep.DataSource = bsData;
rep.CreateDocument();
return rep;
}
}
示例2: PrintDialogRm
public void PrintDialogRm(string operation,Infragistics.Win.UltraWinGrid.UltraGridRow uRow,DataTable dt)
{
var xtreport = new XtraReport();
// _btApp = new BarTender.Application();
//判断当前打印模版路径是否存在
//var _RmcTempletFileName = Application.StartupPath + @"\Label\班次制令单.repx";
var temPath = _RmcTempletFileName; //_cTempletFileName; //Application.StartupPath + @"\Label\" + _cTempletFileName;
if (!File.Exists(temPath))
{
MessageBox.Show(@"当前路径下的打印模版文件不存在!", @"异常", MessageBoxButtons.OK, MessageBoxIcon.Warning);
xtreport.ShowDesigner();
return;
}
xtreport.LoadLayout(temPath);
xtreport.PrinterName = _cPrinter;
xtreport.RequestParameters = false;
xtreport.ShowPrintStatusDialog = false;
xtreport.ShowPrintMarginsWarning = false;
var cFitemID = uRow.Cells["cFitemID"].Value.ToString();
var cLotNo = uRow.Cells["FBatchNo"].Value.ToString();
var cDefine2 = dt.Rows[0]["cDefine2"].ToString();
var cSerialNumber = dt.Rows[0]["cSerialNumber"].ToString();
var cInvCode = dt.Rows[0]["cInvCode"].ToString();
var cInvName = dt.Rows[0]["cInvName"].ToString();
var dDate= dt.Rows[0]["dDate"].ToString();
var cInvStd = dt.Rows[0]["cInvStd"].ToString();
var cFullName = dt.Rows[0]["cFullName"].ToString();
var iQuantity = uRow.Cells["iQuantity"].Value.ToString();
var cMemo = dt.Rows[0]["cMemo"].ToString();
var cDefine1 = dt.Rows[0]["cDefine1"].ToString();
//模板赋值
DllWorkPrintLabel.SetParametersValue(xtreport, "cSerialNumber", lblTitleMain.lblcSerialNumber.Text);
DllWorkPrintLabel.SetParametersValue(xtreport, "cBarCode", "R*" + cFitemID + "*L*" + cLotNo + "*S*" + cSerialNumber + ";" + cDefine2);
DllWorkPrintLabel.SetParametersValue(xtreport, "cInvCode", cInvCode);
DllWorkPrintLabel.SetParametersValue(xtreport, "cInvName", cInvName);
DllWorkPrintLabel.SetParametersValue(xtreport, "dDate", dDate);
DllWorkPrintLabel.SetParametersValue(xtreport, "cInvStd", cInvStd);
DllWorkPrintLabel.SetParametersValue(xtreport, "cFullName", txtcFullName.Text);
DllWorkPrintLabel.SetParametersValue(xtreport, "cVendor", cFullName);
DllWorkPrintLabel.SetParametersValue(xtreport, "cLotNo", cLotNo);
DllWorkPrintLabel.SetParametersValue(xtreport, "iQuantity", iQuantity);
DllWorkPrintLabel.SetParametersValue(xtreport, "cMemo", cMemo);
DllWorkPrintLabel.SetParametersValue(xtreport, "cDefine1", cDefine1);
if (dtpdDate.Checked)
DllWorkPrintLabel.SetParametersValue(xtreport, "cVendorDate", dtpdDate.Value);
//模板赋值
switch (operation)
{
case "print":
xtreport.Print();
break;
case "design":
xtreport.ShowDesigner();
break;
case "preview":
xtreport.ShowPreview();
break;
}
}
示例3: PrintDialog
public void PrintDialog(string operation)
{
var xtreport = new XtraReport();
// _btApp = new BarTender.Application();
//判断当前打印模版路径是否存在
var _cTempletFileName = Application.StartupPath + @"\Label\班次制令单.repx";
var temPath = _cTempletFileName; //Application.StartupPath + @"\Label\" + _cTempletFileName;
if (!File.Exists(temPath))
{
MessageBox.Show(@"当前路径下的打印模版文件不存在!", @"异常", MessageBoxButtons.OK, MessageBoxIcon.Warning);
xtreport.ShowDesigner();
return;
}
xtreport.LoadLayout(temPath);
xtreport.PrinterName = _cPrinter;
xtreport.RequestParameters = false;
xtreport.ShowPrintStatusDialog = false;
xtreport.ShowPrintMarginsWarning = false;
//模板赋值
DllWorkPrintLabel.SetParametersValue(xtreport, "cSerialNumber", lblTitleMain.lblcSerialNumber.Text);
DllWorkPrintLabel.SetParametersValue(xtreport, "cInvCode", txtcInvCode.Text);
DllWorkPrintLabel.SetParametersValue(xtreport, "cInvName", utecInvName.Text);
DllWorkPrintLabel.SetParametersValue(xtreport, "cInvStd", txtcInvStd.Text);
DllWorkPrintLabel.SetParametersValue(xtreport, "cFullName", txtcFullName.Text);
DllWorkPrintLabel.SetParametersValue(xtreport, "cOrderNuber", txtcOrderNumber.Text);
DllWorkPrintLabel.SetParametersValue(xtreport, "FBatchNo", txtFBatchNo.Text);
DllWorkPrintLabel.SetParametersValue(xtreport, "iQuantity", uneiQuantity.Value);
DllWorkPrintLabel.SetParametersValue(xtreport, "cDepartment", txtcDept.Text);
DllWorkPrintLabel.SetParametersValue(xtreport, "dDate", dtpdDate.Value.ToShortDateString());
DllWorkPrintLabel.SetParametersValue(xtreport, "cMemo", txtcMemo.Text);
DllWorkPrintLabel.SetParametersValue(xtreport, "批次", txtcMemo.Text);
DllWorkPrintLabel.SetParametersValue(xtreport, "库位", txtcMemo.Text);
DllWorkPrintLabel.SetParametersValue(xtreport, "库存", txtcMemo.Text);
DllWorkPrintLabel.SetParametersValue(xtreport, "发货数", txtcMemo.Text);
//xtreport.DataSource = dataInventory.BomDetail;
DataSet ds = new DataSet();
using (var con = new SqlConnection(BaseStructure.WmsCon))
{
using (var cmd = new SqlCommand { CommandType = CommandType.StoredProcedure, Connection = con })
{
cmd.CommandText = "proc_Bomdetail";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@BomID", bomID);
using (SqlDataAdapter dataAdapter = new SqlDataAdapter(cmd))
{
dataAdapter.Fill(ds);
}
cmd.Parameters.Clear();
}
}
int count = 0;
if(!int.TryParse(uneiQuantity.Value.ToString(), out count))
{
count = 0;
}
DataTable dt = null;
if (ds != null && ds.Tables[0].Rows.Count > 0)
{
dt = ds.Tables[0].Clone();
dt.Columns.Add("发货数", typeof(int));
//DataTable dt = ds.Tables[0];
var dtE = ds.Tables[0].AsEnumerable();
foreach (DataRow dr in GetBomDetail())
{
var iquantity = Convert.ToDecimal(dr["iQuantity"]) * count;
var drs = dtE.Where(w => w.Field<string>("cInvCode") == dr["cInvCode"].ToString()).OrderBy(o => o.Field<string>("批次")).ToList();
//DataRow[] drs = dtE.Select(" cInvCode = '"+dr["cInvCode"].ToString()+"'").OrderBy("");
foreach (DataRow dr1 in drs)
{
if (iquantity >= 0)
{
var kc = Convert.ToDecimal(dr1["库存"]);
var fhs = kc > iquantity ? iquantity : kc;
//假如库存大于发货数,直接当前库位发货,如果小于发货数,当前库位发完当前数,并到下一个库位发剩余数量
iquantity = kc >= iquantity ? -1 : iquantity - kc;
DataRow drNew = dt.NewRow();
drNew["AutoID"] = dr1["AutoID"];
drNew["BomID"] = dr1["BomID"];
drNew["cInvCode"] = dr1["cInvCode"];
drNew["cInvName"] = dr1["cInvName"];
drNew["iQuantity"] = dr1["iQuantity"];
drNew["cUnitID"] = dr1["cUnitID"];
drNew["cUnitName"] = dr1["cUnitName"];
drNew["cInvStd"] = dr1["cInvStd"];
drNew["cFullName"] = dr1["cFullName"];
drNew["cMemo"] = dr1["cMemo"];
drNew["dAddTime"] = dr1["dAddTime"];
drNew["cFitemID"] = dr1["cFitemID"];
drNew["批次"] = dr1["批次"];
drNew["库位"] = dr1["库位"];
drNew["库存"] = dr1["库存"];
drNew["发货数"] = fhs;
dt.Rows.Add(drNew);
}
}
//.........这里部分代码省略.........
示例4: ShowEntity
public void ShowEntity(BaseEntity entity)
{
if (entity == null) return;
CurrentTemplate = (Report)entity;
if (CurrentTemplate.Id > 0)
{
DMT.Provider.UpdateEditControlValuesWithEntity(layoutEntity, CurrentTemplate);
listEntityTemplateParam.BindData();
using (System.IO.Stream stream = new MemoryStream(Encoding.UTF8.GetBytes(CurrentTemplate.ReportLayout)))
{
report = new XtraReport();
report.LoadLayout(stream);
}
panelDetail.Visible = true;
}
else
{
DMT.Provider.UpdateEditControlValuesWithEntity(layoutEntity, CurrentTemplate);
panelDetail.Visible = false;
}
}
示例5: PrintDialog
public void PrintDialog(string operation)
{
var xtreport = new XtraReport();
// _btApp = new BarTender.Application();
//判断当前打印模版路径是否存在
var temPath = _cTempletFileName; //_cTempletFileName; //Application.StartupPath + @"\Label\" + _cTempletFileName;
if (!File.Exists(temPath))
{
MessageBox.Show(@"当前路径下的打印模版文件不存在!", @"异常", MessageBoxButtons.OK, MessageBoxIcon.Warning);
xtreport.ShowDesigner();
return;
}
xtreport.LoadLayout(temPath);
xtreport.PrinterName = _cPrinter;
xtreport.RequestParameters = false;
xtreport.ShowPrintStatusDialog = false;
xtreport.ShowPrintMarginsWarning = false;
//模板赋值
DllWorkPrintLabel.SetParametersValue(xtreport, "cSerialNumber", lblTitleMain.lblcSerialNumber.Text);
DllWorkPrintLabel.SetParametersValue(xtreport, "cBarCode", "P*" + _FitemId + "*L*" + txtFBatchNo.Text + "*S*" );
DllWorkPrintLabel.SetParametersValue(xtreport, "cInvCode", txtcInvCode.Text);
DllWorkPrintLabel.SetParametersValue(xtreport, "cInvName", utecInvName.Text);
DllWorkPrintLabel.SetParametersValue(xtreport, "cInvStd", txtcInvStd.Text);
DllWorkPrintLabel.SetParametersValue(xtreport, "cFullName", txtcFullName.Text);
DllWorkPrintLabel.SetParametersValue(xtreport, "iQuantity", uneiQuantity.Value);
DllWorkPrintLabel.SetParametersValue(xtreport, "cMemo", txtcMemo.Text);
DllWorkPrintLabel.SetParametersValue(xtreport, "dDate", dtpdDate.Value.ToShortDateString());
DllWorkPrintLabel.SetParametersValue(xtreport, "cOrderNumber", txtcOrderNumber.Text);
xtreport.DataSource = GetPrintData();
//模板赋值
switch (operation)
{
case "print":
xtreport.Print();
break;
case "design":
xtreport.ShowDesigner();
break;
case "preview":
xtreport.ShowPreview();
break;
}
}
示例6: GetDDDReport
public static String GetDDDReport(String DataBlockID, String UserName, String ReportType)
{
int dataBlockId = int.Parse(DataBlockID);
List<int> dataBlockIDS = new List<int>();
dataBlockIDS.Add(dataBlockId);
string connectionString = System.Configuration.ConfigurationManager.AppSettings["fleetnetbaseConnectionString"];
DataBlock dataBlock = new DataBlock(connectionString, ConfigurationManager.AppSettings["language"]);
dataBlock.OpenConnection();
DataSet dataset = new DataSet();
string VIN = dataBlock.vehicleUnitInfo.Get_VehicleOverview_IdentificationNumber(dataBlockId).ToString();
string RegNumb = dataBlock.vehicleUnitInfo.Get_VehicleOverview_RegistrationIdentification(dataBlockId).vehicleRegistrationNumber.ToString();
int vehicleId = dataBlock.vehiclesTables.GetVehicleId_byVinRegNumbers(VIN, RegNumb);
List<DateTime> vehsCardPeriod = dataBlock.vehicleUnitInfo.Get_StartEndPeriod(dataBlockId);
int userId = dataBlock.usersTable.Get_UserID_byName(UserName);
dataset = ReportDataSetLoader.Get_Vehicle_ALLDate(vehicleId,
dataBlockIDS, vehsCardPeriod[0], vehsCardPeriod[1], userId);
dataBlock.CloseConnection();
//load needed template
string path = HttpContext.Current.Server.MapPath("~/templates_ddd") + "\\";
XtraReport report = new XtraReport();
if (string.IsNullOrEmpty(ReportType))
{
ReportType = "Полный отчет";
}
report.LoadLayout(path + ReportType + ".repx");
report.DataSource = dataset;
MemoryStream reportStream = new MemoryStream();
report.ExportToHtml(reportStream);
reportStream.Seek(0, SeekOrigin.Begin);
// convert stream to string
StreamReader reader = new StreamReader(reportStream);
string textReport = reader.ReadToEnd();
return textReport;
}
示例7: GetPLFReportForPeriod
public static Report GetPLFReportForPeriod(String CardID, String StartDate, String EndDate, String UserName, String ReportType)
{
int cardID = int.Parse(CardID);
string connectionString = System.Configuration.ConfigurationManager.AppSettings["fleetnetbaseConnectionString"];
BLL.DataBlock dataBlock = new BLL.DataBlock(connectionString, ConfigurationManager.AppSettings["language"]);
dataBlock.OpenConnection();
DateTime from = DateTime.Parse(StartDate);
DateTime to = DateTime.Parse(EndDate);
DataSet dataset = new DataSet();
List<int> dataBlockIDS = dataBlock.cardsTable.GetAllDataBlockIds_byCardId(cardID);
int userId = dataBlock.usersTable.Get_UserID_byName(UserName);
List<PLFUnit.PLFRecord> records = new List<PLFUnit.PLFRecord>();
dataset = ReportDataSetLoader.Get_PLF_ALLData(dataBlockIDS,
new DateTime(from.Year, from.Month, from.Day), new DateTime(to.Year, to.Month, to.Day),
cardID, userId, ref records);
//if (dataset == null) {
//return null;
//}
dataBlock.CloseConnection();
//load needed template
string path = HttpContext.Current.Server.MapPath("~/templates_plf") + "\\";
XtraReport report = new XtraReport();
if (string.IsNullOrEmpty(ReportType))
{
ReportType = "Полный отчет";
}
report.LoadLayout(path + ReportType + ".repx");
report.DataSource = dataset;
MemoryStream reportStream = new MemoryStream();
report.ExportToHtml(reportStream);
reportStream.Seek(0, SeekOrigin.Begin);
// convert stream to string
StreamReader reader = new StreamReader(reportStream);
string textReport = reader.ReadToEnd();
Report r = new Report();
r.report = textReport;
r.time = new double[records.Count];
r.speed = new double[records.Count];
r.voltage = new double[records.Count];
r.rpm = new double[records.Count];
r.fuel = new double[records.Count];
List<double> lats = new List<double>();
List<double> lngs = new List<double>();
for (int i = 0; i < records.Count; i++)
{
double t = (records[i].SYSTEM_TIME.GetSystemTime() - new DateTime(1970, 1, 1, 0, 0, 0)).TotalMilliseconds;
r.time[i] = t;
r.speed[i] = double.Parse(records[i].SPEED, System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.NumberFormatInfo.InvariantInfo);
r.voltage[i] = double.Parse(records[i].VOLTAGE, System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.NumberFormatInfo.InvariantInfo);
r.rpm[i] = double.Parse(records[i].ENGINE_RPM, System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.NumberFormatInfo.InvariantInfo);
r.fuel[i] = Math.Round(double.Parse(records[i].FUEL_VOLUME1), 1);
if (records[i].LATITUDE != null && records[i].LONGITUDE != null)
{
lats.Add(double.Parse(records[i].LATITUDE, System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.NumberFormatInfo.InvariantInfo));
lngs.Add(double.Parse(records[i].LONGITUDE, System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.NumberFormatInfo.InvariantInfo));
}
}
r.lat = new double[lats.Count];
r.lng = new double[lats.Count];
for (int i = 0; i < lats.Count; i++) {
r.lat[i] = lats[i];
r.lng[i] = lngs[i];
}
r.period = new DateTime(from.Year, from.Month, from.Day).ToShortDateString() + " - " + new DateTime(to.Year, to.Month, to.Day).ToShortDateString();
return r;
}
示例8: OpenReport
private void OpenReport()
{
using (XF_ReportOpen form = new XF_ReportOpen(this.DbContext))
{
if (form.ShowDialog() == DialogResult.Yes)
{
uint fileID = form.FileID;
var rep = this.DbContext.FileObjects.Where(f => f.FileID == fileID).FirstOrDefault();
if (rep == null)
throw new ApplicationException("No report with the specified ID!");
using (MemoryStream stream = new MemoryStream(rep.FileBlob))
{
stream.Position = 0;
XtraReport report = new XtraReport();
report.LoadLayout(stream);
report.Tag = fileID;
this.Editor.OpenReport(report);
this.Editor.ActiveDesignPanel.ReportState = ReportState.Opened;
}
}
}
}
示例9: InitReport
XtraReport InitReport(DataTable dt)
{
XtraReport xr = new XtraReport();
xr.LoadLayout(Application.StartupPath + @"\reportLayouts\stokListe.repx");
BindingSource bs = new BindingSource();
bs.DataSource = dt;
xr.DataSource = bs;
return xr;
}
示例10: AddCollectionDataSource
private byte[] AddCollectionDataSource(byte[] content, string typeName)
{
XtraReport report = new XtraReport();
using (MemoryStream stream = new MemoryStream(content))
{
report.LoadLayout(stream);
}
report.DataSource = new CollectionDataSource() { ObjectTypeName = typeName, Name = "collectionDataSource" };
using (MemoryStream stream = new MemoryStream())
{
report.SaveLayout(stream);
return stream.ToArray();
}
}
示例11: btnPrintPreview_Click
private void btnPrintPreview_Click(object sender, EventArgs e)
{
XtraReport r = new XtraReport();
DataSet ds = new DataSet();
DataTable dtCompany = new DataTable("Company");
dtCompany.Columns.Add("Tên đơn vị");
dtCompany.Columns.Add("Tên giao dịch");
dtCompany.Columns.Add("Mã số thuế");
dtCompany.Columns.Add("Lĩnh vực hoạt động");
dtCompany.Columns.Add("Điện thoại");
dtCompany.Columns.Add("Fax");
dtCompany.Columns.Add("Email");
dtCompany.Columns.Add("Website");
dtCompany.Columns.Add("Địa chỉ đơn vị");
dtCompany.Columns.Add("Giám đốc");
dtCompany.Columns.Add("Kế toán");
dtCompany.Columns.Add("Thủ quỹ");
DataRow row = dtCompany.NewRow();
object tmp;
EasyParam.GetValue("Tên đơn vị", out tmp, ParamCategory.CompanyInfo, "TÊN DOANH NGHIỆP", DataType.String);
row["Tên đơn vị"] = tmp;
EasyParam.GetValue("Tên giao dịch", out tmp, ParamCategory.CompanyInfo, string.Empty, DataType.String);
row["Tên giao dịch"] = tmp;
EasyParam.GetValue("Mã số thuế", out tmp, ParamCategory.CompanyInfo, string.Empty, DataType.String);
row["Mã số thuế"] = tmp;
EasyParam.GetValue("Lĩnh vực hoạt động", out tmp, ParamCategory.CompanyInfo, string.Empty, DataType.String);
row["Lĩnh vực hoạt động"] = tmp;
EasyParam.GetValue("Điện thoại", out tmp, ParamCategory.CompanyInfo, string.Empty, DataType.String);
row["Điện thoại"] = tmp;
EasyParam.GetValue("Fax", out tmp, ParamCategory.CompanyInfo, string.Empty, DataType.String);
row["Fax"] = tmp;
EasyParam.GetValue("Email", out tmp, ParamCategory.CompanyInfo, string.Empty, DataType.String);
row["Email"] = tmp;
EasyParam.GetValue("Website", out tmp, ParamCategory.CompanyInfo, string.Empty, DataType.String);
row["Website"] = tmp;
EasyParam.GetValue("Địa chỉ đơn vị", out tmp, ParamCategory.CompanyInfo, "", DataType.String);
row["Địa chỉ đơn vị"] = tmp;
EasyParam.GetValue("Giám đốc", out tmp, ParamCategory.CompanyInfo, string.Empty, DataType.String);
row["Giám đốc"] = tmp;
EasyParam.GetValue("Kế toán", out tmp, ParamCategory.CompanyInfo, string.Empty, DataType.String);
row["Kế toán"] = tmp;
EasyParam.GetValue("Thủ quỹ", out tmp, ParamCategory.CompanyInfo, string.Empty, DataType.String);
row["Thủ quỹ"] = tmp;
dtCompany.Rows.Add(row);
DataTable dtInvoice = new DataTable("Invoice");
dtInvoice.Columns.Add("InvoiceCode");
dtInvoice.Columns.Add("InvoiceDate", typeof(DateTime));
dtInvoice.Columns.Add("EntityName");
dtInvoice.Columns.Add("EntityAddress");
dtInvoice.Columns.Add("VoucherCode");
dtInvoice.Columns.Add("VoucherDate", typeof(DateTime));
dtInvoice.Columns.Add("InvoiceNote");
dtInvoice.Columns.Add("Total", typeof(decimal));
dtInvoice.Columns.Add("Bằng chữ");
DataRow rowInvoice = dtInvoice.NewRow();
rowInvoice["InvoiceCode"] = _invoice.InvoiceCode;
rowInvoice["InvoiceDate"] = _invoice.InvoiceDate;
rowInvoice["InvoiceNote"] = _invoice.InvoiceNote;
rowInvoice["EntityName"] = _invoice.EntityName;
rowInvoice["EntityAddress"] = _invoice.EntityAddress;
rowInvoice["VoucherCode"] = _invoice.VoucherCode;
rowInvoice["VoucherDate"] = _invoice.VoucherDate;
rowInvoice["Total"] = _invoice.Total;
rowInvoice["Bằng chữ"] = lbTotalString.Text+"\r\nABCD";
dtInvoice.Rows.Add(rowInvoice);
ds.Tables.Add(dtCompany);
ds.Tables.Add(dtInvoice);
if (_invoiceType.InvoiceTypeName == Constant.INVOICE_TYPE_THU)
r.LoadLayout(Application.StartupPath + @"\Reports\phieuthu.repx");
else if (_invoiceType.InvoiceTypeName == Constant.INVOICE_TYPE_CHI)
r.LoadLayout(Application.StartupPath + @"\Reports\phieuchi.repx");
r.DataSource = ds;
//r.ShowPreview();
r.ShowDesigner();
}
示例12: PrintDialog
/// <summary>
/// 打印操作
/// </summary>
/// <param name="p"></param>
private void PrintDialog(string p)
{
var xtreport = new XtraReport();
// _btApp = new BarTender.Application();
//判断当前打印模版路径是否存在
var temPath = Application.StartupPath + @"\Stencil\TrackDeliveryOrder.repx";
if (!File.Exists(temPath))
{
MessageBox.Show(@"当前路径下的打印模版文件不存在!", @"异常", MessageBoxButtons.OK, MessageBoxIcon.Warning);
xtreport.Name = "TrackDeliveryOrder";
xtreport.ShowDesigner();
return;
}
xtreport.LoadLayout(temPath);
xtreport.RequestParameters = false;
DLL.DllWorkPrintLabel.SetParametersValue(xtreport, "cCode", txtcCode.Text);
DLL.DllWorkPrintLabel.SetParametersValue(xtreport, "cOrderType", cbxcOrderType.Text);
DLL.DllWorkPrintLabel.SetParametersValue(xtreport, "cCusName", utxtcCusName.Text);
DLL.DllWorkPrintLabel.SetParametersValue(xtreport, "dDate", dtpdDate.Text);
DLL.DllWorkPrintLabel.SetParametersValue(xtreport, "OrderDate", dtpOrderDate.Text);
DLL.DllWorkPrintLabel.SetParametersValue(xtreport, "DeliveryDate", dtpDeliveryDate.Text);
DLL.DllWorkPrintLabel.SetParametersValue(xtreport, "cDepName", utecDepName.Text);
//模板赋值
switch (p)
{
case "print":
xtreport.Print();
break;
case "design":
xtreport.ShowDesigner();
break;
case "preview":
xtreport.ShowPreview();
break;
}
}
示例13: PrintDialog
public void PrintDialog(string operation)
{
if (string.IsNullOrEmpty(biEditTemplet.Caption))
{
MessageBox.Show(@"请先在 维护中心-模板管理,添加仓位标签项,再打开此界面!", @"异常", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
var dt = new DataKis.StockPlacePrintDataTable();
foreach (var uRow in uGridCheck.Rows.GetFilteredInNonGroupByRows())
{
var nRow = dt.NewStockPlacePrintRow();
nRow.FSPID = int.Parse(uRow.Cells["FSPID"].Value.ToString());
nRow.FNumber = uRow.Cells["FNumber"].Value.ToString();
nRow.FName = uRow.Cells["FName"].Value.ToString();
nRow.FFullName = uRow.Cells["FFullName"].Value.ToString();
dt.Rows.Add(nRow);
}
if (dt.Rows.Count < 1)
{
MessageBox.Show(@"请先筛选要打印的数据!", @"异常", MessageBoxButtons.OK, MessageBoxIcon.Warning);
return;
}
var xtreport = new XtraReport();
// _btApp = new BarTender.Application();
//判断当前打印模版路径是否存在
var temPath = _cTempletFileName; //_cTempletFileName; //Application.StartupPath + @"\Label\" + _cTempletFileName;
if (!File.Exists(temPath))
{
MessageBox.Show(@"当前路径下的打印模版文件不存在!", @"异常", MessageBoxButtons.OK, MessageBoxIcon.Warning);
xtreport.ShowDesigner();
return;
}
xtreport.LoadLayout(temPath);
xtreport.PrinterName = _cPrinter;
xtreport.RequestParameters = false;
xtreport.ShowPrintStatusDialog = false;
xtreport.ShowPrintMarginsWarning = false;
//模板赋值
xtreport.DataSource = dt;
//模板赋值
switch (operation)
{
case "print":
xtreport.Print();
break;
case "design":
xtreport.ShowDesigner();
break;
case "preview":
xtreport.ShowPreview();
break;
}
}
示例14: PrintDialog
/// <summary>
/// 打印操作
/// </summary>
/// <param name="operation"></param>
public void PrintDialog(string operation)
{
var xtreport = new XtraReport();
// _btApp = new BarTender.Application();
//判断当前打印模版路径是否存在
var temPath = Application.StartupPath + @"\Stencil\DeliveryOrder.repx";
if (!File.Exists(temPath))
{
MessageBox.Show(@"当前路径下的打印模版文件不存在!", @"异常", MessageBoxButtons.OK, MessageBoxIcon.Warning);
xtreport.Name = "DeliveryOrder";
xtreport.ShowDesigner();
return;
}
xtreport.LoadLayout(temPath);
xtreport.RequestParameters = false;
xtreport.ShowPrintStatusDialog = false;
xtreport.ShowPrintMarginsWarning = false;
xtreport.DataSource = uGridChecks.DataSource;
//模板赋值
string cKey, cValue;
for (var i = 0; i < uGridCheck.DisplayLayout.Bands[0].Columns.Count; i++)
{
cKey = uGridCheck.DisplayLayout.Bands[0].Columns[i].Key;
cValue = uGridCheck.Rows[_iRowNo].Cells[i].Value.ToString();
DLL.DllWorkPrintLabel.SetParametersValue(xtreport, cKey, cValue);
}
//模板赋值
switch (operation)
{
case "print":
xtreport.Print();
break;
case "design":
xtreport.ShowDesigner();
break;
case "preview":
xtreport.ShowPreview();
break;
}
}
示例15: GetDDDReportForPeriod
public static String GetDDDReportForPeriod(String CardID, String StartDate, String EndDate, String UserName, String ReportType)
{
int cardId = Int16.Parse(CardID);
string connectionString = System.Configuration.ConfigurationManager.AppSettings["fleetnetbaseConnectionString"];
DataBlock dataBlock = new DataBlock(connectionString, ConfigurationManager.AppSettings["language"]);
dataBlock.OpenConnection();
DataSet dataset = new DataSet();
int vehicleId = dataBlock.vehiclesTables.GetVehicle_byCardId(cardId);
List<int> dataBlockIDS = dataBlock.cardsTable.GetAllDataBlockIds_byCardId(cardId);
int userId = dataBlock.usersTable.Get_UserID_byName(UserName);
DateTime from = DateTime.Parse(StartDate);
DateTime to = DateTime.Parse(EndDate);
dataset = ReportDataSetLoader.Get_Vehicle_ALLDate(vehicleId,
dataBlockIDS, from, to, userId);
dataBlock.CloseConnection();
//load needed template
string path = HttpContext.Current.Server.MapPath("~/templates_ddd") + "\\";
XtraReport report = new XtraReport();
if (string.IsNullOrEmpty(ReportType))
{
ReportType = "Полный отчет";
}
report.LoadLayout(path + ReportType + ".repx");
report.DataSource = dataset;
MemoryStream reportStream = new MemoryStream();
report.ExportToHtml(reportStream);
reportStream.Seek(0, SeekOrigin.Begin);
// convert stream to string
StreamReader reader = new StreamReader(reportStream);
string textReport = reader.ReadToEnd();
return textReport;
}