protected override object OnCreateReportHandler(string reportPath) { SectionReport rptOrders; switch (reportPath) { case "Reports/BillingInvoice.rdlx": case "Reports/Orders.rdlx": PageReport rptPageRDL = new PageReport(); rptPageRDL.Load(new FileInfo(Server.MapPath(reportPath))); rptPageRDL.Report.DataSources[0].ConnectionProperties.ConnectString = "data source=" + Server.MapPath("~/App_Data/NWind.mdb") + ";provider=Microsoft.Jet.OLEDB.4.0;"; return(rptPageRDL); case "Reports/Invoice.rpx": rptOrders = new SectionReport(); XmlTextReader xtr = new XmlTextReader(Server.MapPath(reportPath)); rptOrders.LoadLayout(xtr); (rptOrders.DataSource as OleDBDataSource).ConnectionString = "data source=" + Server.MapPath("~/App_Data/NWind.mdb") + ";provider=Microsoft.Jet.OLEDB.4.0;"; return(rptOrders); default: return(base.OnCreateReportHandler(reportPath)); } }
private void PrintBarcode(int repid) { try { PageReport rpt = new PageReport(); rpt.Load(new FileInfo("reg\\doc\\barcode.rdlx")); rpt.Report.DataSources[0].ConnectionProperties.ConnectString = KontoGlobals.sqlConnectionString.ConnectionString; GrapeCity.ActiveReports.Document.PageDocument doc = new GrapeCity.ActiveReports.Document.PageDocument(rpt); doc.Parameters["reportid"].CurrentValue = repid; var frm = new KontoRepViewer(doc); frm.Text = "Print"; var _tab = this.Parent.Parent as TabControlAdv; if (_tab == null) { return; } var pg1 = new TabPageAdv(); pg1.Text = "Barcode Print"; _tab.TabPages.Add(pg1); _tab.SelectedTab = pg1; frm.TopLevel = false; frm.Parent = pg1; frm.Location = new System.Drawing.Point(pg1.Location.X + pg1.Width / 2 - frm.Width / 2, pg1.Location.Y + pg1.Height / 2 - frm.Height / 2); frm.Show();// = true; } catch (Exception ex) { MessageBox.Show(ex.ToString()); Log.Error(ex, "print barcode"); } }
/// <summary> /// Preview the Layer report and set the target device for the layer to the report. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPreview_Click(object sender, EventArgs e) { _pageReport.Load(new FileInfo("Layer.rdlx")); _reportRuntime = new PageDocument(_pageReport); _reportRuntime.PageReport.Report.Layers[1].TargetDevice = _targetDevices; reportViewer.LoadDocument(_reportRuntime); btnPdfExport.Enabled = true; }
private void PDFDigitalSignature_Load(object sender, EventArgs e) { //Set the default for in the 'Signature Format' combo box. cmbVisibilityType.SelectedIndex = 3; var pageReport = new PageReport(); _pageDocument = pageReport.Document; pageReport.Load(new FileInfo("..//..//..//..//Report//Catalog.rdlx")); arvMain.LoadDocument(_pageDocument); }
public override void Print() { base.Print(); if (this.customGridView1.FocusedRowHandle < 0) { return; } if (KontoView.Columns.ColumnByFieldName("ReportId") != null) { string accname = Convert.ToString(this.customGridView1.GetRowCellValue(customGridView1.FocusedRowHandle, "AccName")); int reportid = Convert.ToInt32(this.customGridView1.GetRowCellValue(customGridView1.FocusedRowHandle, "ReportId")); if (KontoView.Columns.ColumnByFieldName("IsDeleted") != null) { if (Convert.ToBoolean(this.KontoView.GetRowCellValue(this.KontoView.FocusedRowHandle, "IsDeleted"))) { return; } } PageReport rpt = new PageReport(); rpt.Load(new FileInfo("reg\\doc\\Outwardbarcode.rdlx")); rpt.Report.DataSources[0].ConnectionProperties.ConnectString = KontoGlobals.sqlConnectionString.ConnectionString; GrapeCity.ActiveReports.Document.PageDocument doc = new GrapeCity.ActiveReports.Document.PageDocument(rpt); doc.Parameters["Party"].CurrentValue = accname; doc.Parameters["ReportId"].CurrentValue = reportid; doc.Parameters["BarcodeNo"].CurrentValue = "0"; var frm = new KontoRepViewer(doc); frm.Text = "Barcode"; var _tab = this.ParentForm.Parent.Parent as TabControlAdv; if (_tab == null) { return; } var pg1 = new TabPageAdv(); pg1.Text = "Barcode Print"; _tab.TabPages.Add(pg1); _tab.SelectedTab = pg1; frm.TopLevel = false; frm.Parent = pg1; frm.Location = new System.Drawing.Point(pg1.Location.X + pg1.Width / 2 - frm.Width / 2, pg1.Location.Y + pg1.Height / 2 - frm.Height / 2); frm.Show();// = true; } }
public override void SaveDataAsync(bool newmode) { try { if (_bc == null) { return; } if (qtySpinEdit.Value == 0) { return; } var st = Convert.ToDecimal(stockLabelControl.Text); if (st - qtySpinEdit.Value < 0) { MessageBox.Show("Can not generate Barcode For Extra Qty"); return; } using (var db = new KontoContext()) { var repid = db.Barcodes.DefaultIfEmpty().Max(x => x == null ? 0 : x.ReportId) + 1; var barcode = Convert.ToInt32(GetNextBarcodeNo(db)); for (int i = 0; i < qtySpinEdit.Value; i++) { var bm = new BarcodeModel() { CompId = KontoGlobals.CompanyId, IsActive = true, IsDeleted = false, OrderTransId = _bc.OrderTransId, PcsNo = 1, AccId = _bc.AccId, Qty = 1, ProductId = _bc.ProductId, ReportId = repid, RefBarcodeId = _bc.Id }; if (i == 0) { bm.BarcodeNo = barcode.ToString(); } else { barcode = barcode + 1; bm.BarcodeNo = barcode.ToString(); }//String.Format("{0:d9}", (DateTime.Now.Ticks / 10) % 1000000000); //KontoUtils.GetUniqueKey(8)).tos; db.Barcodes.Add(bm); } db.SaveChanges(); _bc = null; PageReport rpt = new PageReport(); rpt.Load(new FileInfo("reg\\doc\\Outwardbarcode.rdlx")); rpt.Report.DataSources[0].ConnectionProperties.ConnectString = KontoGlobals.sqlConnectionString.ConnectionString; GrapeCity.ActiveReports.Document.PageDocument doc = new GrapeCity.ActiveReports.Document.PageDocument(rpt); doc.Parameters["Party"].CurrentValue = partyLabelControl.Text; doc.Parameters["ReportId"].CurrentValue = repid; doc.Parameters["BarcodeNo"].CurrentValue = "0"; var frm = new KontoRepViewer(doc); frm.Text = "Barcode"; var _tab = this.Parent.Parent as TabControlAdv; if (_tab == null) { return; } var pg1 = new TabPageAdv(); pg1.Text = "Barcode Print"; _tab.TabPages.Add(pg1); _tab.SelectedTab = pg1; frm.TopLevel = false; frm.Parent = pg1; frm.Location = new System.Drawing.Point(pg1.Location.X + pg1.Width / 2 - frm.Width / 2, pg1.Location.Y + pg1.Height / 2 - frm.Height / 2); frm.Show();// = true; } this.ResetPage(); barcodeTextEdit.Focus(); } catch (Exception ex) { Log.Error(ex, "Barcode Save"); MessageBox.Show(ex.ToString()); } }