Esempio n. 1
0
        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");
            }
        }
Esempio n. 2
0
        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;
            }
        }
Esempio n. 3
0
        private void FrmReportNew_Load(object sender, EventArgs e)
        {
            try
            {
                // Setup a new instance of the AnnualReport.
                //AnnualReport rpt = new AnnualReport();
                //Run the report, and set it to the viewer control on the Form.
                //String filename = "";
                System.IO.FileInfo rptPath    = new System.IO.FileInfo(System.IO.Directory.GetCurrentDirectory() + "\\report\\" + reportfilename + ".rdlx");
                PageReport         definition = new PageReport(rptPath);
                GrapeCity.ActiveReports.Document.PageDocument runtime = new GrapeCity.ActiveReports.Document.PageDocument(definition);

                runtime.LocateDataSource += Runtime_LocateDataSource;

                //arvMain.LoadDocument(filename);
                arvMain.LoadDocument(runtime);
            }
            catch (ReportException ex)
            {
                MessageBox.Show(ex.Message, Text);
            }
        }
        private void viewer_disp()
        {
            //ページレポートに接続文字列とクエリ(sql)をセットして表示する

            GrapeCity.ActiveReports.PageReport rpt = new GrapeCity.ActiveReports.PageReport();
            // レポート定義のファイルをロードします。
            rpt.Load(new System.IO.FileInfo("rpt_uriage_denpyou.rdlx"));

            // 接続文字列を変更します
            //rpt.Report.DataSources[0].ConnectionProperties.DataProvider = tss.DataSource;
            rpt.Report.DataSources[0].ConnectionProperties.ConnectString = tss.GetConnectionString();

            // 変更するSQL文を定義します
            String tmpQuery = "select * from tss_uriage_denpyou_trn";

            // SQL文を変更します
            rpt.Report.DataSets[0].Query.CommandText = GrapeCity.ActiveReports.Expressions.ExpressionInfo.Parse(tmpQuery, GrapeCity.ActiveReports.Expressions.ExpressionResultType.String);

            GrapeCity.ActiveReports.Document.PageDocument pageDocument = new GrapeCity.ActiveReports.Document.PageDocument(rpt);
            viewer1.LoadDocument(pageDocument);
            //viewer1.LoadDocument("rpt_uriage_denpyou.rdlx");
        }
        private void viewer_disp()
        {
            //ページレポートに接続文字列とクエリ(sql)をセットして表示する

            GrapeCity.ActiveReports.PageReport rpt = new GrapeCity.ActiveReports.PageReport();
            // レポート定義のファイルをロードします。
            rpt.Load(new System.IO.FileInfo("rpt_uriage_denpyou.rdlx"));

            // 接続文字列を変更します
            //rpt.Report.DataSources[0].ConnectionProperties.DataProvider = tss.DataSource;
            rpt.Report.DataSources[0].ConnectionProperties.ConnectString = tss.GetConnectionString();

            // 変更するSQL文を定義します
            String tmpQuery = "select * from tss_uriage_denpyou_trn";
            // SQL文を変更します
            rpt.Report.DataSets[0].Query.CommandText = GrapeCity.ActiveReports.Expressions.ExpressionInfo.Parse(tmpQuery,GrapeCity.ActiveReports.Expressions.ExpressionResultType.String);

            GrapeCity.ActiveReports.Document.PageDocument pageDocument = new GrapeCity.ActiveReports.Document.PageDocument(rpt);
            viewer1.LoadDocument(pageDocument);
            //viewer1.LoadDocument("rpt_uriage_denpyou.rdlx");
        }
Esempio n. 6
0
        public void ExportReport(String filename)
        {
            try
            {
                System.IO.FileInfo rptPath    = new System.IO.FileInfo(System.IO.Directory.GetCurrentDirectory() + "\\report\\" + reportfilename + ".rdlx");
                PageReport         definition = new PageReport(rptPath);
                GrapeCity.ActiveReports.Document.PageDocument runtime = new GrapeCity.ActiveReports.Document.PageDocument(definition);

                //runtime.LocateDataSource += Runtime_LocateDataSource;
                runtime.LocateDataSource += Runtime_LocateDataSource1;
                //arvMain.LoadDocument(rptPath.FullName);

                GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport PdfExport1 = new GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport();
                PdfExport1.Export(runtime, filename);

                //arvMain.LoadDocument(runtime);
                Application.DoEvents();

                //List<SectionExport> sectionExports = new List<SectionExport>();
                //sectionExports.Add(new SectionExport
                ////{
                ////    DisplayName = Properties.Resources.SectionHTMLString,
                ////    Filter = Properties.Resources.HTMLFilter,
                ////    DefaultFileName = Properties.Resources.HTMLFileName,
                ////    Settings = new Export.Html.Section.HtmlExport()
                ////});
                ////sectionExports.Add(new SectionExport
                //{
                //    DisplayName = Properties.Resources.SectionPDFString,
                //    Filter = Properties.Resources.PDFFilter,
                //    DefaultFileName = Properties.Resources.PDFFileName,
                //    Settings = new GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport()
                //});

                //this.Show();
                //Application.DoEvents();
                //((SectionExport)sectionExports[0]).Export(arvMain.Document, filename);
            }
            catch (ReportException ex)
            {
                MessageBox.Show(ex.Message, Text);
            }

            //sectionExports.Add(new SectionExport
            //{
            //    DisplayName = Properties.Resources.SectionRTFString,
            //    Filter = Properties.Resources.RtfFilter,
            //    DefaultFileName = Properties.Resources.RtfFileName,
            //    Settings = new Export.Word.Section.RtfExport()
            //});
            //sectionExports.Add(new SectionExport
            //{
            //    DisplayName = Properties.Resources.SectionTIFFString,
            //    Filter = Properties.Resources.TiffFilter,
            //    DefaultFileName = Properties.Resources.TiffFileName,
            //    Settings = new Export.Image.Tiff.Section.TiffExport()
            //});
            //sectionExports.Add(new SectionExport
            //{
            //    DisplayName = Properties.Resources.SectionPlainTextString,
            //    Filter = Properties.Resources.TextFilter,
            //    DefaultFileName = Properties.Resources.TextFileName,
            //    Settings = new Export.Xml.Section.TextExport()
            //});
            //sectionExports.Add(new SectionExport
            //{
            //    DisplayName = Properties.Resources.SectionExcelString,
            //    Filter = Properties.Resources.ExcelFilter,
            //    DefaultFileName = Properties.Resources.ExcelFileName,
            //    Settings = new XlsExport()
            //});
            //cmbExportFormat.DataSource = sectionExports;
            //cmbExportFormat.DisplayMember = "DisplayName";
            //cmbExportFormat.SelectedIndex = 0;
        }
Esempio n. 7
0
        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());
            }
        }