コード例 #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="exception">exception</param>
 /// <param name="report">associated report document</param>
 /// <param name="image">image object being processed</param>
 public ImageErrorEventArgs(Exception exception, ReportDocument report, Image image)
 {
     Exception = exception;
     Image = image;
     Handled = false;
     ReportDocument = report;
 }
コード例 #2
0
ファイル: ReportPaginator.cs プロジェクト: T1Easyware/Soheil
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="report">report document</param>
        /// <param name="data">report data</param>
        /// <exception cref="ArgumentException">Flow document must have a specified page height</exception>
        /// <exception cref="ArgumentException">Flow document must have a specified page width</exception>
        /// <exception cref="ArgumentException">Flow document can have only one report header section</exception>
        /// <exception cref="ArgumentException">Flow document can have only one report footer section</exception>
        public ReportPaginator(ReportDocument report, ReportData data)
        {
            _report = report;
            _data = data;

            _flowDocument = report.CreateFlowDocument();
            _pageSize = new Size(_flowDocument.PageWidth, _flowDocument.PageHeight);

            if (_flowDocument.PageHeight == double.NaN) throw new ArgumentException("Flow document must have a specified page height");
            if (_flowDocument.PageWidth == double.NaN) throw new ArgumentException("Flow document must have a specified page width");

            _dynamicCache = new ReportPaginatorDynamicCache(_flowDocument);
            ArrayList listPageHeaders = _dynamicCache.GetFlowDocumentVisualListByType(typeof(SectionReportHeader));
            if (listPageHeaders.Count > 1) throw new ArgumentException("Flow document can have only one report header section");
            if (listPageHeaders.Count == 1) _blockPageHeader = (SectionReportHeader)listPageHeaders[0];
            ArrayList listPageFooters = _dynamicCache.GetFlowDocumentVisualListByType(typeof(SectionReportFooter));
            if (listPageFooters.Count > 1) throw new ArgumentException("Flow document can have only one report footer section");
            if (listPageFooters.Count == 1) _blockPageFooter = (SectionReportFooter)listPageFooters[0];

            _paginator = ((IDocumentPaginatorSource)_flowDocument).DocumentPaginator;

            // remove header and footer in our working copy
            Block block = _flowDocument.Blocks.FirstBlock;
            while (block != null)
            {
                Block thisBlock = block;
                block = block.NextBlock;
                if ((thisBlock == _blockPageHeader) || (thisBlock == _blockPageFooter)) _flowDocument.Blocks.Remove(thisBlock);
            }

            // get report context values
            _reportContextValues = _dynamicCache.GetFlowDocumentVisualListByInterface(typeof(IInlineContextValue));

            FillData();
        }
コード例 #3
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="report">report document</param>
        /// <param name="data">multiple report data</param>
        /// <exception cref="ArgumentException">Need at least two ReportData objects</exception>
        public MultipleReportPaginator(ReportDocument report, IEnumerable<ReportData> data)
        {
            if (data == null) throw new ArgumentException("Need at least two ReportData objects");

            // create a list of report paginators and compute page counts
            _pageCount = 0;
            int dataCount = 0;
            foreach (ReportData rd in data)
            {
                if (rd == null) continue;
                ReportPaginator paginator = new ReportPaginator(report, rd);
                _reportPaginators.Add(paginator);
                DocumentPage dp = paginator.GetPage(0);
                if ((dp != DocumentPage.Missing) && (dp.Size != Size.Empty)) _pageSize = paginator.PageSize;
                _firstPages.Add(dp); // just cache the generated first page
                _pageCount += paginator.PageCount;
                dataCount++;
            }
            if ((_reportPaginators.Count <= 0) || (dataCount < 2)) throw new ArgumentException("Need at least two ReportData objects");
        }
コード例 #4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="exception">exception</param>
 /// <param name="report">associated report document</param>
 public ImageErrorEventArgs(Exception exception, ReportDocument report)
     : this(exception, report, null)
 {
 }
コード例 #5
0
	    public void LoadOperatorProcessReport(int operatorId)
	    {
	        var dataService = new OperatorReportDataService();
	        Report = dataService.GetOperatorProcessReport(operatorId, StartDate, EndDate);

	        var reportDocument = new ReportDocument();

	        var reader =
                new StreamReader(new FileStream(@"Views\Reporting\OperatorProcessReport.xaml", FileMode.Open, FileAccess.Read));
	        reportDocument.XamlData = reader.ReadToEnd();
	        reportDocument.XamlImagePath = Path.Combine(Environment.CurrentDirectory, @"Views\Reporting\");
	        reader.Close();

	        var data = new ReportData();

	        // set constant document values
	        data.ReportDocumentValues.Add("PrintDate", DateTime.Now);

	        var titleTabel = new DataTable("TitleTable");
	        titleTabel.Columns.Add("ReportTitle", typeof(string));
            var name = Common.Properties.Resources.ResourceManager.GetString("txtName") + Report.Title;
            var code = Common.Properties.Resources.ResourceManager.GetString("txtCode") + Report.Code;
	        var date = DateTime.Now.ToPersianCompactDateTimeString();
            titleTabel.Rows.Add(new object[] { name });
            titleTabel.Rows.Add(new object[] { code });
            titleTabel.Rows.Add(new object[] { date });

            data.DataTables.Add(titleTabel);

            var totalTabel = new DataTable("TotalTable");
            totalTabel.Columns.Add("TimeTotal", typeof(string));
            totalTabel.Columns.Add("CountTotal", typeof(string));

            totalTabel.Rows.Add(new object[] { Common.Properties.Resources.ResourceManager.GetString("txtTotalTargetTime") + Format.ConvertToHMS((int) Report.TotalTargetTime), Common.Properties.Resources.ResourceManager.GetString("txtTotalTargetCount") + Report.TotalTargetCount });
            totalTabel.Rows.Add(new object[] { Common.Properties.Resources.ResourceManager.GetString("txtTotalProductionTime") + Format.ConvertToHMS((int)Report.TotalProductionTime), Common.Properties.Resources.ResourceManager.GetString("txTotalProductionCount") + Report.TotalProductionCount });
            totalTabel.Rows.Add(new object[] { Common.Properties.Resources.ResourceManager.GetString("txtTotalExtraTime") + Format.ConvertToHMS((int)Report.TotalExtraTime), Common.Properties.Resources.ResourceManager.GetString("txtTotalExtraCount") + Report.TotalExtraCount });
            totalTabel.Rows.Add(new object[] { Common.Properties.Resources.ResourceManager.GetString("txtTotalShortageTime") + Format.ConvertToHMS((int)Report.TotalShortageTime), Common.Properties.Resources.ResourceManager.GetString("txtTotalShortageCount") + Report.TotalShortageCount });
            totalTabel.Rows.Add(new object[] { Common.Properties.Resources.ResourceManager.GetString("txtTotalDefectionTime") + Format.ConvertToHMS((int)Report.TotalDefectionTime), Common.Properties.Resources.ResourceManager.GetString("txtTotalDefectionCount") + Report.TotalDefectionCount });
            totalTabel.Rows.Add(new object[] { Common.Properties.Resources.ResourceManager.GetString("txtTotalWaste") + Report.TotalWaste, Common.Properties.Resources.ResourceManager.GetString("txtTotalSecondGrade") + Report.TotalSecondGrade });


            data.DataTables.Add(totalTabel);

	        var activitiesTable = new DataTable("ActivitiesReport");

            activitiesTable.Columns.Add("Date", typeof(string));
	        activitiesTable.Columns.Add("Product", typeof (string));
	        activitiesTable.Columns.Add("Station", typeof (string));
	        activitiesTable.Columns.Add("Activity", typeof (string));
	        activitiesTable.Columns.Add("TargetValue", typeof (string));
	        activitiesTable.Columns.Add("ProductionValue", typeof (string));
	        activitiesTable.Columns.Add("DefectionValue", typeof (string));
	        activitiesTable.Columns.Add("StoppageValue", typeof (string));
	        activitiesTable.Columns.Add("IsRework", typeof (string));

	        foreach (var item in Report.ActivityItems)
	        {
	            activitiesTable.Rows.Add(CurrentType == OEType.CountBased
	                ? new object[]
	                {
	                    item.Date.ToShortDateString(), item.Product, item.Station, item.Activity, item.TargetCount, item.ProductionCount,
	                    item.DefectionCount, item.StoppageCount, item.IsRework
	                }
	                : new object[]
	                {
	                    item.Date.ToShortDateString(), item.Product, item.Station, item.Activity, item.TargetTime, item.ProductionTime,
	                    item.DefectionTime, item.StoppageTime, item.IsRework
	                });
	        }

	        data.DataTables.Add(activitiesTable);

            var qualitiveTable = new DataTable("QualitiveReport");

            qualitiveTable.Columns.Add("Date", typeof(string));
            qualitiveTable.Columns.Add("Product", typeof(string));
            qualitiveTable.Columns.Add("Station", typeof(string));
            qualitiveTable.Columns.Add("Activity", typeof(string));
            qualitiveTable.Columns.Add("DefectionValue", typeof(string));
            qualitiveTable.Columns.Add("SecondGrade", typeof(string));
            qualitiveTable.Columns.Add("Waste", typeof(string));

            foreach (var item in Report.QualitiveItems)
            {
                var waste = item.Status == QualitiveStatus.Waste ? "*" : string.Empty;
                var secondGrade = item.Status == QualitiveStatus.SecondGrade ? "*" : string.Empty;
                var defection = CurrentType == OEType.CountBased ? item.DefectionCount : item.DefectionTime;
                qualitiveTable.Rows.Add(new object[]
                    {
                        item.Date.ToShortDateString(), item.Product, item.Station, item.Activity, defection, secondGrade, waste
	                });
            }

            data.DataTables.Add(qualitiveTable);

            var technicalTable = new DataTable("TechnicalReport");

            technicalTable.Columns.Add("Date", typeof(string));
            technicalTable.Columns.Add("Product", typeof(string));
            technicalTable.Columns.Add("Station", typeof(string));
            technicalTable.Columns.Add("Activity", typeof(string));
            technicalTable.Columns.Add("StoppageValue", typeof(string));

            foreach (var item in Report.TechnicalItems)
            {
                var stoppage = CurrentType == OEType.CountBased ? item.StoppageCount : item.StoppageTime;
                technicalTable.Rows.Add(new object[]
                    {
                        item.Date.ToShortDateString(), item.Product, item.Station, item.Activity, stoppage
	                });
            }

            data.DataTables.Add(technicalTable);


	        XpsDocument xps = reportDocument.CreateXpsDocument(data);

	        Document = xps.GetFixedDocumentSequence();
            
	    }
コード例 #6
0
ファイル: ImageEventArgs.cs プロジェクト: T1Easyware/Soheil
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="report">associated report document</param>
 /// <param name="image">Image object being processed</param>
 public ImageEventArgs(ReportDocument report, Image image)
 {
     ReportDocument = report;
     Image = image;
 }
コード例 #7
0
ファイル: ImageEventArgs.cs プロジェクト: T1Easyware/Soheil
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="report">associated report document</param>
 public ImageEventArgs(ReportDocument report) : this(report, null)
 {
 }
コード例 #8
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="report">associated report document</param>
 /// <param name="row">DataRow object being processed</param>
 public DataRowBoundEventArgs(ReportDocument report, DataRow row)
 {
     ReportDocument = report;
     DataRow = row;
 }
コード例 #9
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="report">associated report document</param>
 public DataRowBoundEventArgs(ReportDocument report) : this(report, null)
 {
 }