private MemoryStream PrintCfsExpTs3a(string orderNo, string userName) { XtraReport rpt = new XtraReport(); rpt.LoadLayout(Server.MapPath(@"~\Modules\Freight\Report\repx\TallySheet_Exp_List.repx")); //rpt.DataSource = PrintFreightDoc.DsExpTs(orderNo,userName); System.IO.MemoryStream str = new MemoryStream(); rpt.ExportToPdf(str); return(str); }
private MemoryStream PrintCfsImpHaulier1(string orderNo) { XtraReport rpt = new XtraReport(); rpt.LoadLayout(Server.MapPath(@"~\Modules\Freight\Report\repx\HaulierTruckingAdvice_Imp1.repx")); //rpt.DataSource = PrintFreightDoc.PrintImpHaulier1(orderNo); System.IO.MemoryStream str = new MemoryStream(); rpt.ExportToPdf(str); return(str); }
private void btnPrint_Click(object sender, EventArgs e) { XtraReport rp = new XtraReport(); rp.DataSource = xControl.xeCoTrongCuaHang(); //rp.ShowDesignerDialog(); rp.LoadLayout(Application.StartupPath + @"\ReportDanhSachXeCoTrongCuaHang.repx"); //if(textBox1.Text == "1") rp.ShowPreviewDialog(); //else rp.ShowDesignerDialog(); rp.ShowPreviewDialog(); }
private XtraReport RaporStokGiris() { XtraReport xr_Master = new XtraReport(); xr_Master.LoadLayout(Application.StartupPath + "\\ReportDesigners\\Fatura\\rptFatura.repx"); //clsTablolar.csYazdirma Yazdirma = new clsTablolar.csYazdirma(); //xr_Master.DataSource = Yazdirma.fa (SqlConnections.GetBaglanti(),(int)gvFatura.GetFocusedRowCellValue("FaturaID")); return(xr_Master); }
public void imprimir(long tipoDocumento, COMPROBANTE comprobante) { try { byte[] formatoReporte; PUNTOEMISIONDOCUMENTO puntoEmisionDocumento = (from puntoE in comprobante.PUNTOEMISION.PUNTOEMISIONDOCUMENTO where puntoE.CODIGOTIPOCOMPROBANTE == comprobante.TIPOCOMPROBANTE.CODIGOTIPOCOMPROBANTE select puntoE).FirstOrDefault(); if (puntoEmisionDocumento.ARCHIVOREPORTE != null) { formatoReporte = puntoEmisionDocumento.ARCHIVOREPORTE; } else if (comprobante.TIPOCOMPROBANTE.ARCHIVOREPORTE == null) { XtraMessageBox.Show("NO SE HAN DEFINIDO REPORTE DE FACTURA"); return; } else { formatoReporte = comprobante.TIPOCOMPROBANTE.ARCHIVOREPORTE; } System.IO.MemoryStream memoryStream = new System.IO.MemoryStream(formatoReporte); xtraReport.LoadLayout(memoryStream); Parameter parametro = new DevExpress.XtraReports.Parameters.Parameter(); parametro.Value = comprobante.CODIGOCOMPROBANTE; parametro.Name = "codigoComprobante"; formaReporte.WindowState = FormWindowState.Maximized; xtraReport.Parameters["codigoComprobante"].Value = comprobante.CODIGOCOMPROBANTE; xtraReport.DrawWatermark = (comprobante.CLAVEDEACCESO.Substring(23, 1).Equals("1") ? true : false); xtraReport.Watermark.Text = (comprobante.CLAVEDEACCESO.Substring(23, 1).Equals("1") ? "LA INFORMACIÓN IMPRESA NO TIENE VALIDEZ." + Environment.NewLine + "COMPROBANTE GENERADO EN EL AMBIENTE DE PRUEBAS" : ""); formaReporte.Text = comprobante.TIPOCOMPROBANTE.NOMBRE + "-" + comprobante.NUMEROCOMPROBANTE; formaReporte.getdocumentViewer1().DocumentSource = xtraReport; formaReporte.getdocumentViewer1().Show(); formaReporte.getdocumentViewer1().PrintingSystem.SetCommandVisibility(DevExpress.XtraPrinting.PrintingSystemCommand.Open, DevExpress.XtraPrinting.CommandVisibility.None); formaReporte.ShowDialog(); } catch (Exception ex) { XtraMessageBox.Show(ex.ToString()); } }
private MemoryStream PrintInvoice(string billNo) { XtraReport rpt = new XtraReport(); rpt.LoadLayout(Server.MapPath(@"~\ReportFreightSea\repx\Account\Invoice.repx")); rpt.DataSource = AccountFreightPrint.PrintInvoice(billNo, "IV"); rpt.CreateDocument(); System.IO.MemoryStream str = new MemoryStream(); rpt.ExportToPdf(str); return(str); }
private MemoryStream PrintArReceipt(string docId) { XtraReport rpt = new XtraReport(); rpt.LoadLayout(Server.MapPath(@"~\ReportAccount\Document\ArReceipt.repx")); rpt.DataSource = AccountPrint.DsArReceipt(docId); System.IO.MemoryStream str = new MemoryStream(); rpt.ExportToPdf(str); return(str); }
private MemoryStream PrintInvoice(string billNo) { XtraReport rpt = new XtraReport(); rpt.LoadLayout(Server.MapPath(@"~\ReportFreightSea\repx\Account\Invoice.repx")); rpt.DataSource = AccountFreightPrint.PrintInvoice(billNo, D.Text("select DocType from XaArInvoice Where DocNo='" + billNo + "'")); System.IO.MemoryStream str = new MemoryStream(); rpt.ExportToPdf(str); return(str); }
/// <summary> /// 打印操作 /// </summary> /// <param name="operation"></param> public void PrintDialog(string operation) { var xtreport = new XtraReport(); // _btApp = new BarTender.Application(); //判断当前打印模版路径是否存在 var temPath = Application.StartupPath + @"\Stencil\ProOemOrder.repx"; if (!File.Exists(temPath)) { MessageBox.Show(@"当前路径下的打印模版文件不存在!", @"异常", MessageBoxButtons.OK, MessageBoxIcon.Warning); xtreport.ShowDesigner(); return; } xtreport.LoadLayout(temPath); xtreport.RequestParameters = false; xtreport.ShowPrintStatusDialog = false; xtreport.ShowPrintMarginsWarning = false; xtreport.DataSource = uGridChecks.DataSource; //模板赋值 for (var i = 0; i < uGridCheck.DisplayLayout.Bands[0].Columns.Count; i++) { var cKey = uGridCheck.DisplayLayout.Bands[0].Columns[i].Key; string cValue; if (uGridCheck.Rows.Count > _iRowNo) { cValue = uGridCheck.Rows[_iRowNo].Cells[i].Value.ToString(); } else { cValue = ""; } DLL.DllWorkPrintLabel.SetParametersValue(xtreport, cKey, cValue); } //模板赋值 switch (operation) { case "print": xtreport.Print(); break; case "design": xtreport.ShowDesigner(); break; case "preview": xtreport.ShowPreview(); break; } }
private MemoryStream PrintWh_invoice(string refN, string refType, string userId) { string user = HttpContext.Current.User.Identity.Name; XtraReport rpt = new XtraReport(); rpt.LoadLayout(Server.MapPath(@"~\ReportWarehouse\repx\invoice.repx")); string strsql = string.Format(@"exec proc_PrintInvoice_wh '{0}','{1}','{2}','{3}','{4}'", refN, "", refType, userId, ""); DataSet ds_temp = ConnectSql.GetDataSet(strsql); DataTable Mast = ds_temp.Tables[0].Copy(); Mast.TableName = "Mast"; DataTable Detail = ds_temp.Tables[1].Copy(); Detail.TableName = "Detail"; DataTable Detail2 = new DataTable(); if (ds_temp.Tables.Count > 2) { Detail2 = ds_temp.Tables[2].Copy(); Detail2.TableName = "Detail"; } if (Detail.Rows.Count > 0) { DevExpress.XtraReports.UI.GroupFooterBand groupFooter_Inv = rpt.Report.Bands["GroupFooter_Wine"] as DevExpress.XtraReports.UI.GroupFooterBand; DevExpress.XtraReports.UI.XRSubreport subReport_Inv = new XRSubreport(); subReport_Inv.Name = "GroupFooter_Wine1"; groupFooter_Inv.Controls.Add(subReport_Inv); XtraReport rpt_Inv = new XtraReport(); rpt_Inv.LoadLayout(Server.MapPath(@"~\ReportWarehouse\repx\invoice_1.repx")); subReport_Inv.ReportSource = rpt_Inv; rpt_Inv.DataSource = Detail; } if (Detail2.Rows.Count > 0) { DevExpress.XtraReports.UI.GroupFooterBand groupFooter_Inv = rpt.Report.Bands["GroupFooter_Other"] as DevExpress.XtraReports.UI.GroupFooterBand; DevExpress.XtraReports.UI.XRSubreport subReport_Inv = new XRSubreport(); subReport_Inv.Name = "GroupFooter_Other1"; groupFooter_Inv.Controls.Add(subReport_Inv); XtraReport rpt_Inv = new XtraReport(); rpt_Inv.LoadLayout(Server.MapPath(@"~\ReportWarehouse\repx\invoice_2.repx")); subReport_Inv.ReportSource = rpt_Inv; rpt_Inv.DataSource = Detail2; } rpt.DataSource = Mast; System.IO.MemoryStream str = new MemoryStream(); rpt.ExportToPdf(str); return(str); }
public static XtraReport CargarInformeLocal(string nombreListado) { var res = new XtraReport(); var rutaP = VariablesGlobales.rutaListados;//Settings.Default.RutaListadosDV; var rutaListado = Path.Combine(rutaP, nombreListado); if (File.Exists(rutaListado)) { res.LoadLayout(rutaListado); } res.Tag = nombreListado; return(res); }
void IReport.Preview() { DataTable dt_X = ((DataView)gridViewCT.DataSource).ToTable(); string strReport = "\\Report\\RptBaoCaoThuocCanDate.repx"; XtraReport xtra_report = new XtraReport(); xtra_report.Parameters.Clear(); string file = Application.StartupPath + strReport; xtra_report.LoadLayout(file); xtra_report.DataSource = dt_X; GPP_DungChung_HL.Form.FrmXtraReportViewer rpt = new GPP_DungChung_HL.Form.FrmXtraReportViewer(xtra_report); rpt.ShowDialog(); }
private void btnIn_Click(object sender, EventArgs e) { DataTable dt_X = ((DataView)gridView_CT.DataSource).ToTable(); string strReport = "\\Report\\baocaonhansu.repx"; XtraReport xtra_report = new XtraReport(); xtra_report.Parameters.Clear(); string file = Application.StartupPath + strReport; xtra_report.LoadLayout(file); xtra_report.DataSource = dt_X; GPP_DungChung_HL.Form.FrmXtraReportViewer rpt = new GPP_DungChung_HL.Form.FrmXtraReportViewer(xtra_report); rpt.ShowDialog(); }
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; } }
public XtraReport CreateReport() { var report = new XtraReport { }; report.ParametersRequestBeforeShow += Report_ParametersRequestBeforeShow; report.ParametersRequestSubmit += Report_ParametersRequestSubmit; report.LoadLayout(new MemoryStream(_content)); report.CreateDocument(); report.DataSource = DataSourceHelper.GetDataSource(_dataSource, RetrieveDefaultParameterDictionary(report)); return(report); }
private void btnOpenDesign_Click(object sender, EventArgs e) { if (txtPath.Text.Trim() == "") { MessageBox.Show("请选择报表文件!"); return; } XtraReport report = new XtraReport(); report.LoadLayout(txtPath.Text); report.CreateDocument(); report.ShowDesigner(); }
private void btnIn_Click(object sender, EventArgs e) { if (trangthai.Equals("toanbo")) { if (gridViewTKChiTieu.RowCount > 0) { XtraReport rp = new XtraReport(); rp.DataSource = gridTKChiTieu.DataSource; rp.LoadLayout(Application.StartupPath + @"\ReportTKChiTietToanBoThang.repx"); //rp.ShowDesignerDialog(); rp.ShowPreviewDialog(); } else { XtraMessageBox.Show("Không có dữ liệu để in!"); } } if (trangthai.Equals("toanbomotthang")) { if (gridViewTKChiTieu.RowCount > 0) { XtraReport rp = new XtraReport(); rp.DataSource = gridTKChiTieu.DataSource; rp.LoadLayout(Application.StartupPath + @"\ReportTKChiTieuToanBoMotThang.repx"); //rp.ShowDesignerDialog(); rp.ShowPreviewDialog(); } else { XtraMessageBox.Show("Không có dữ liệu để in!"); } } if (trangthai.Equals("tungngaymotthang")) { if (gridViewTKChiTieu.RowCount > 0) { XtraReport rp = new XtraReport(); rp.DataSource = gridTKChiTieu.DataSource; rp.LoadLayout(Application.StartupPath + @"\ReportTKChiTietTungNgayMotThang.repx"); //rp.ShowDesignerDialog(); rp.ShowPreviewDialog(); } else { XtraMessageBox.Show("Không có dữ liệu để in!"); } } ConTKChiTieuThang_Load(sender, e); }
private void btnIn_Click(object sender, EventArgs e) { ConTKNguoiOThang_Load(sender, e); if (trangthai.Equals("nhieuthang")) { if (gridViewTKNguoiThang.RowCount > 0) { XtraReport rp = new XtraReport(); rp.DataSource = gridTKNguoiThang.DataSource; rp.LoadLayout(Application.StartupPath + @"\ReportTKNguoiNuoiTungThang.repx"); //rp.ShowDesignerDialog(); rp.ShowPreviewDialog(); } else { XtraMessageBox.Show("Không có dữ liệu để in", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } if (trangthai.Equals("nhieungay")) { if (gridViewTKNguoiThang.RowCount > 0) { XtraReport rp = new XtraReport(); rp.DataSource = gridTKNguoiThang.DataSource; rp.LoadLayout(Application.StartupPath + @"\ReportTKNguoiNuoiMotThangToanBo.repx"); //rp.ShowDesignerDialog(); rp.ShowPreviewDialog(); } else { XtraMessageBox.Show("Không có dữ liệu để in", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } if (trangthai.Equals("motngay")) { if (gridViewTKNguoiThang.RowCount > 0) { XtraReport rp = new XtraReport(); rp.DataSource = gridTKNguoiThang.DataSource; rp.LoadLayout(Application.StartupPath + @"\ReportTKNguoiNuoiMotThangMotNgay.repx"); //rp.ShowDesignerDialog(); rp.ShowPreviewDialog(); } else { XtraMessageBox.Show("Không có dữ liệu để in", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
void UpdateView() { XtraReport report = xrDesignPanel1.Report; XtraReport report2 = new XtraReport(); MemoryStream ms = new MemoryStream(); report.SaveLayout(ms); ms.Seek(0, SeekOrigin.Begin); report2.LoadLayout(ms); report2.DataSource = report.DataSource; report2.CreateDocument(); printControl1.PrintingSystem = report2.PrintingSystem; printControl1.ExecCommand(DevExpress.XtraPrinting.PrintingSystemCommand.ZoomToWholePage); }
private void btnCikti_ItemClick(object sender, ItemClickEventArgs e) { var topluCiktilar = new Collection <long>(); for (var i = 0; i < grdVOlaylar.DataRowCount; i++) { topluCiktilar.Add(int.Parse(grdVOlaylar.GetRowCellValue(i, "Id").ToString())); } var ustYazi = new XtraReport(); var tutanak = new XtraReport(); ustYazi.LoadLayout(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\Raporlar\\UstYazi.repx"); tutanak.LoadLayout(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\Raporlar\\Tutanak.repx"); var daimiCikti = (new ETSEntities().DaimiArastirmaTutanaklari.AsEnumerable() .Select(r => new { r, list = topluCiktilar }) .Where(@t => (@t.list.Contains(@t.r.Id))) .Select(@t => @t.r)).ToList(); foreach (var t in daimiCikti.Where(t => t.Personel3Id == null && t.Personel4Id == null)) { tutanak.LoadLayout(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\Raporlar\\Tutanak2Imza.repx"); } foreach (var t in daimiCikti.Where(t => t.Personel3Id != null && t.Personel4Id == null)) { tutanak.LoadLayout(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory) + "\\Raporlar\\Tutanak3Imza.repx"); } ustYazi.DataSource = daimiCikti; ustYazi.ShowRibbonPreview(); tutanak.DataSource = daimiCikti; tutanak.ShowRibbonPreview(); }
private void btnIn_Click(object sender, EventArgs e) { if (gvDanhSachThongKe.RowCount > 0) { XtraReport rp = new XtraReport(); rp.DataSource = frm.ChuyenGridViewSangDataTable(gvDanhSachThongKe); if (lueChonLoaiThongKe.Text == "Xe máy") { rp.LoadLayout(Application.StartupPath + @"\ReportThongKeBanXeMayTheoNam.repx"); } else { rp.LoadLayout(Application.StartupPath + @"\ReportThongKeBanPhuTungTheoNam.repx"); } //if (textBox1.Text == "1") // rp.ShowDesignerDialog(); //else rp.ShowPreviewDialog(); rp.ShowPreviewDialog(); } else { XtraMessageBox.Show("Không có dữ liệu để in", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void btnDiseño_Click(object sender, EventArgs e) { XtraReport report = new XtraReport { DataSource = DataSource }; report.LoadLayout(FileName); XRDesignFormEx xrDfe = new XRDesignFormEx(); xrDfe.OpenReport(report); xrDfe.DesignPanel.FileName = FileName; xrDfe.WindowState = FormWindowState.Maximized; xrDfe.ShowDialog(); }
public void CreateReportWithBookmark() { ReportDataV2 reportData = ObjectSpace.FindObject <ReportDataV2>(new BinaryOperator("DisplayName", "ReportWithBookmark")); if (reportData == null) { reportData = ObjectSpace.CreateObject <ReportDataV2>(); XtraReport rep = new XtraReport(); #if !DXCORE3 byte[] byteArray = Encoding.UTF8.GetBytes(ConvertVersion(OrdinalReportResource.ReportLayout)); MemoryStream stream = new MemoryStream(byteArray); rep.LoadLayout(stream); #else var assembly = Assembly.GetExecutingAssembly(); var resourceNames = assembly.GetManifestResourceNames(); var resourceName = resourceNames.FirstOrDefault(p => p.Contains("OrdinalReport.repx")); using (Stream stream = assembly.GetManifestResourceStream(resourceName)) { rep.LoadLayout(stream); } #endif rep.DisplayName = "ReportWithBookmark"; rep.Bookmark = "Names"; XRControl control = rep.FindControl("label5", true); if (control != null) { control.DataBindings.Add(new DevExpress.XtraReports.UI.XRBinding("Bookmark", null, "FirstName")); } control = rep.FindControl("label9", true); if (control != null) { control.Text = "Report with bookmarks"; } ReportDataProvider.ReportsStorage.SaveReport(reportData, rep); } }
private void btnIn_Click(object sender, EventArgs e) { if (gridVPhongO.RowCount > 0) { XtraReport rp = new XtraReport(); rp.DataSource = gridVPhongO.DataSource; rp.LoadLayout(Application.StartupPath + @"\ReportCapNhatPhong.repx"); //rp.ShowDesignerDialog(); rp.ShowPreviewDialog(); } else { XtraMessageBox.Show("Không có dữ liệu để in", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
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); } }
private void btnIn_Click(object sender, EventArgs e) { if (gridViewLichLamViec.RowCount > 0) { XtraReport rp = new XtraReport(); rp.DataSource = gridLichLamViec.DataSource; rp.LoadLayout(Application.StartupPath + @"\ReportInLichLamViecTheoTieuChi.repx"); //rp.ShowDesignerDialog(); rp.ShowPreviewDialog(); } else { XtraMessageBox.Show("Không có dữ liệu để in!"); } InLichLamViec_Load(sender, e); }
private void btnIn_Click(object sender, EventArgs e) { if (gridViewNguoiO.RowCount > 0) { XtraReport rp = new XtraReport(); rp.DataSource = gridNguoiO.DataSource;;; rp.LoadLayout(Application.StartupPath + @"\ReportInPhongOToanBo.repx"); //rp.ShowDesignerDialog(); rp.ShowPreviewDialog(); } else { XtraMessageBox.Show("Không có dữ liệu để thống kê!"); } InPhongO_Load(sender, e); }
private void btnIn_Click(object sender, EventArgs e) { if (gridViewTienTuThien.RowCount > 0) { XtraReport rp = new XtraReport(); rp.DataSource = gridTienTuThien.DataSource; rp.LoadLayout(Application.StartupPath + @"\ReportInTienChiTieu.repx"); //rp.ShowDesignerDialog(); rp.ShowPreviewDialog(); } else { XtraMessageBox.Show("Không có dữ liệu để in!"); } InchiTieuHangNgay_Load(sender, e); }
private void btnTungNgay_Click(object sender, EventArgs e) { if (gridViewTKNguoiDuocNuoi.RowCount > 0) { XtraReport rp = new XtraReport(); rp.DataSource = gridTKNguoiDuocNuoi.DataSource; rp.LoadLayout(Application.StartupPath + @"\ReportTKNguoiNuoiTungNgay.repx"); //rp.ShowDesignerDialog(); rp.ShowPreviewDialog(); } else { XtraMessageBox.Show("Không có dữ liệu để in", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning); } ConTKNguoiONgay_Load(sender, e); }
private static void DocumentLoading(string name) { Data.ValueOfReport = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, name); //Объединение пути к отчету и базового каталога в одну строку XtraReport report = new XtraReport(); //Инициализирует новый экземпляр класса XtraReport с настройками по умолчанию report.LoadLayout(Data.ValueOfReport); //Загрузка макета отчета из файла в формате REPX ReportPrintTool printTool = new ReportPrintTool(report); //Инициализирует новый экземпляр класса ReportPrintTool с указанным отчетом printTool.ShowPreview(); //Отображает окно отчета }
private void btnIn_Click(object sender, EventArgs e) { if (gridViewTaiKhoan.RowCount > 0) { XtraReport rp = new XtraReport(); rp.DataSource = gridTaiKhoan.DataSource; rp.LoadLayout(Application.StartupPath + @"\ReportTaiKhoanTheoQuyen.repx"); //rp.ShowDesignerDialog(); rp.ShowPreviewDialog(); } else { XtraMessageBox.Show("Không có dữ liệu để thống kê!"); } InTaiKhoan_Load(sender, e); }
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; }
/// <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; } }
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; } } } }
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; } }
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; } }
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); } } } } xtreport.DataSource = dt; //模板赋值 switch (operation) { case "print": xtreport.Print(); break; case "design": xtreport.ShowDesigner(); break; case "preview": xtreport.ShowPreview(); break; } }
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(); }
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; } }
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; } }
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(); } }
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; }
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; }
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; }
protected void Page_Load(object sender, EventArgs e) { string Type=Request.Form.Get("type"); //Section "Восстановить у пользователя" if (Type == DOWNLOAD_FILE_RECOVER_USER) { if (Request.Form.Get("dataBlockId") != null) { int dataBlockId = Convert.ToInt32(Request.Form.Get("dataBlockId")); string connectionString = ConfigurationManager.AppSettings["fleetnetbaseConnectionString"]; DataBlock dataBlock = new DataBlock(connectionString, ConfigurationManager.AppSettings["language"]); dataBlock.OpenConnection(); byte[] fileBytes = dataBlock.GetDataBlock_BytesArray(dataBlockId); string fileName = dataBlock.GetDataBlock_FileName(dataBlockId); dataBlock.CloseConnection(); Response.Clear(); Response.AddHeader("Content-Disposition", String.Format("attachment;filename=\"{0}\"", fileName)); Response.AddHeader("Content-Length", fileBytes.Length.ToString()); Response.ContentType = "application/octet-stream"; Response.OutputStream.Write(fileBytes, 0, fileBytes.Length); Response.End(); return; } } //Section "PLF Файлы" if (Type == GET_PLF_REPORT) { string CardID=Request.Form.Get("CardID"); string PLFID=Request.Form.Get("PLFID"); string UserName = Request.Form.Get("UserName"); string Format = Request.Form.Get("Format"); string ReportType = Request.Form.Get("ReportType"); if (string.IsNullOrEmpty(ReportType)) { ReportType = "Полный отчет"; } int dataBlockId = int.Parse(PLFID); List<int> dataBlockIDS = new List<int>(); dataBlockIDS.Add(dataBlockId); 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 = new DateTime(); from = dataBlock.plfUnitInfo.Get_START_PERIOD(dataBlockId); DateTime to = new DateTime(); to = dataBlock.plfUnitInfo.Get_END_PERIOD(dataBlockId); string vehicle = dataBlock.plfUnitInfo.Get_VEHICLE(dataBlockId); string deviceID = dataBlock.plfUnitInfo.Get_ID_DEVICE(dataBlockId); DataSet dataset = new DataSet(); 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); dataBlock.CloseConnection(); //gets table PlfHeader_1 DataTable dt = dataset.Tables[0]; //gets the first row DataRow dr = dt.Rows[0]; string driverName = dr["Имя водителя"].ToString(); //load needed template string path = HttpContext.Current.Server.MapPath("~/templates_plf") + "\\"; XtraReport report = new XtraReport(); report.LoadLayout(path + ReportType+".repx"); report.DataSource = dataset; MemoryStream reportStream = new MemoryStream(); switch (Format) { case "html": report.ExportToHtml(reportStream); break; case "pdf": report.ExportToPdf(reportStream); break; case "rtf": report.ExportToRtf(reportStream); break; case "png": report.ExportToImage(reportStream,ImageFormat.Png); break; } Response.Clear(); Response.AddHeader("Content-Disposition", String.Format("attachment;filename=\"{0}\"", "Отчет " + driverName + " " + new DateTime(from.Year, from.Month, from.Day).ToString("dd_MM_yyyy") + "-" + new DateTime(to.Year, to.Month, to.Day).ToString("dd_MM_yyyy") + "." + Format)); Response.AddHeader("Content-Length", reportStream.GetBuffer().Length.ToString()); Response.ContentType = "application/octet-stream"; Response.OutputStream.Write(reportStream.GetBuffer(), 0, reportStream.GetBuffer().Length); Response.End(); return; } if (Type == GET_PLF_REPORT_FOR_PERIOD) { string CardID = Request.Form.Get("CardID"); string StartDate = Request.Form.Get("StartDate"); string EndDate = Request.Form.Get("EndDate"); string UserName = Request.Form.Get("UserName"); string Format = Request.Form.Get("Format"); string ReportType = Request.Form.Get("ReportType"); if (string.IsNullOrEmpty(ReportType)) { 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); dataBlock.CloseConnection(); //gets table PlfHeader_1 DataTable dt = dataset.Tables[0]; //gets the first row DataRow dr = dt.Rows[0]; string driverName = dr["Имя водителя"].ToString(); //load needed template string path = HttpContext.Current.Server.MapPath("~/templates_plf") + "\\"; XtraReport report = new XtraReport(); report.LoadLayout(path + ReportType + ".repx"); report.DataSource = dataset; MemoryStream reportStream = new MemoryStream(); switch (Format) { case "html": report.ExportToHtml(reportStream); break; case "pdf": report.ExportToPdf(reportStream); break; case "rtf": report.ExportToRtf(reportStream); break; case "png": report.ExportToImage(reportStream, ImageFormat.Png); break; } Response.Clear(); Response.AddHeader("Content-Disposition", String.Format("attachment;filename=\"{0}\"", "Отчет " + driverName + " " + new DateTime(from.Year, from.Month, from.Day).ToString("dd_MM_yyyy") + "-" + new DateTime(to.Year, to.Month, to.Day).ToString("dd_MM_yyyy") + "." + Format)); Response.AddHeader("Content-Length", reportStream.GetBuffer().Length.ToString()); Response.ContentType = "application/octet-stream"; Response.OutputStream.Write(reportStream.GetBuffer(), 0, reportStream.GetBuffer().Length); Response.End(); return; } //Section "Транспортные средства" if (Type == GET_DDD_REPORT) { string DataBlockID = Request.Form.Get("DataBlockID"); string UserName = Request.Form.Get("UserName"); string Format = Request.Form.Get("Format"); string ReportType = Request.Form.Get("ReportType"); if (string.IsNullOrEmpty(ReportType)) { 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(); report.LoadLayout(path + ReportType + ".repx"); report.DataSource = dataset; MemoryStream reportStream = new MemoryStream(); switch (Format) { case "html": report.ExportToHtml(reportStream); break; case "pdf": report.ExportToPdf(reportStream); break; case "rtf": report.ExportToRtf(reportStream); break; case "png": report.ExportToImage(reportStream, ImageFormat.Png); break; } Response.Clear(); Response.AddHeader("Content-Disposition", String.Format("attachment;filename=\"{0}\"", "Отчет " + VIN + "_" + RegNumb + " " + vehsCardPeriod[0].ToString("dd_MM_yyyy") + "-" + vehsCardPeriod[1].ToString("dd_MM_yyyy") + "." + Format)); Response.AddHeader("Content-Length", reportStream.GetBuffer().Length.ToString()); Response.ContentType = "application/octet-stream"; Response.OutputStream.Write(reportStream.GetBuffer(), 0, reportStream.GetBuffer().Length); Response.End(); return; } //Section "Транспортные средства" if (Type == GET_DDD_REPORT_FOR_PERIOD) { string CardID = Request.Form.Get("CardID"); string StartDate = Request.Form.Get("StartDate"); string EndDate = Request.Form.Get("EndDate"); string UserName = Request.Form.Get("UserName"); string Format = Request.Form.Get("Format"); string ReportType = Request.Form.Get("ReportType"); if (string.IsNullOrEmpty(ReportType)) { ReportType = "Полный отчет"; } string connectionString = System.Configuration.ConfigurationManager.AppSettings["fleetnetbaseConnectionString"]; DataBlock dataBlock = new DataBlock(connectionString, ConfigurationManager.AppSettings["language"]); dataBlock.OpenConnection(); DataSet dataset = new DataSet(); int cardId = int.Parse(CardID); string VIN = dataBlock.vehiclesTables.GetVehicleVin(cardId); string RegNumb = dataBlock.vehiclesTables.GetVehicleGOSNUM(cardId); 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(); report.LoadLayout(path + ReportType + ".repx"); report.DataSource = dataset; MemoryStream reportStream = new MemoryStream(); switch (Format) { case "html": report.ExportToHtml(reportStream); break; case "pdf": report.ExportToPdf(reportStream); break; case "rtf": report.ExportToRtf(reportStream); break; case "png": report.ExportToImage(reportStream, ImageFormat.Png); break; } Response.Clear(); Response.AddHeader("Content-Disposition", String.Format("attachment;filename=\"{0}\"", "Отчет " + VIN + "_" + RegNumb + " " + from.ToString("dd_MM_yyyy") + "-" + to.ToString("dd_MM_yyyy") + "." + Format)); Response.AddHeader("Content-Length", reportStream.GetBuffer().Length.ToString()); Response.ContentType = "application/octet-stream"; Response.OutputStream.Write(reportStream.GetBuffer(), 0, reportStream.GetBuffer().Length); Response.End(); return; } }
/// <summary> /// 打印操作 /// </summary> /// <param name="operation"></param> public void PrintDialog(string operation) { //当修改原数据是要进行保存后才能去打印 if (biSave.Enabled == true) { MessageBox.Show("在原数据上进行修改时请先保存后再进行打印!!!"); } 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.PrintingSystem.StartPrint += PrintingSystem_StartPrint; xtreport.RequestParameters = false; xtreport.ShowPrintStatusDialog = false; xtreport.ShowPrintMarginsWarning = false; //模板赋值 DllWorkPrintLabel.SetParametersValue(xtreport, "cSerialNumber", lblTitleMain.lblcSerialNumber.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cBarCode", "R*" + _FitemId + "*L*" + txtcLotNo.Text + "*S*" + lblTitleMain.lblcSerialNumber.Text+";"+dtpcDefine2.Value.ToShortDateString()); DllWorkPrintLabel.SetParametersValue(xtreport, "cInvCode", txtcInvCode.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cInvName", utecInvName.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "dDate", dtpdDate.Value.ToShortDateString()); DllWorkPrintLabel.SetParametersValue(xtreport, "cInvStd", txtcInvStd.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cFullName", txtcFullName.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cVendor", txtcVendor.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cLotNo", txtcLotNo.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "iQuantity", uneiQuantity.Value); DllWorkPrintLabel.SetParametersValue(xtreport, "cMemo", txtcMemo.Text); DllWorkPrintLabel.SetParametersValue(xtreport, "cDefine1", txtcDefine1.Text); 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; } }
/// <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; } }