Ejemplo n.º 1
0
        protected override string Execute(CodeActivityContext context)
        {
            try
            {
                int      userId      = UserId.Get <int>(context);
                int      workspaceId = WorkspaceId.Get <int>(context);
                int      fpid        = FPId.Get <int>(context);
                int      subsystemId = SubsystemId.Get <int>(context);
                string   reportName  = ReportName.Get <string>(context);
                string[] paramTypes  = new[] { ParamTypes.Get <string>(context) };
                string[] paramValues = new[] { ParamValues.Get <string>(context) };

                string outputFileName = PrintReport(userId, workspaceId, fpid, subsystemId, reportName, paramTypes, paramValues, out string exceptionStr);

                if (outputFileName == null)
                {
                    return(exceptionStr);
                }

                return(Convert.ToBase64String(File.ReadAllBytes(outputFileName)));
            }
            catch (Exception ex)
            {
                EventLog.WriteEntry("BasePrint.TadbirPrint", ex.Message);
                return("-4");  //ex.Message;
                //throw ex;
            }
        }
Ejemplo n.º 2
0
        public void AssertReportCursor(ReportName name, string dir, string value)
        {
            var cursorSuffix = $"report.{name}";
            var cursorPath   = string.Format(CursorFormat, dir, cursorSuffix);

            AssertFile(value, cursorPath);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// R目标外帮助
        /// </summary>
        /// <param name="rptname">指标枚举</param>
        /// <param name="rowname">新行名称</param>
        /// <param name="dtR_MB_OUT">操作表</param>
        private void R_MB_OUT_HELP(ReportName rptname, string rowname, DataTable dtR_MB_OUT)
        {
            string sn = Hanbell.BSC.Report.BscYearIndex.GetYearIndex(RptDatetime.Year, rptname);

            if (string.IsNullOrEmpty(sn))
            {
                throw new Exception(rptname + "  " + RptDatetime.Year + "指标未设定!");
            }
            DataTable dtbos = this.GetResult(sn, RptDatetime).Tables[0];

            if (dtbos != null)
            {
                if (dtbos.Rows.Count > 0)
                {
                    DataRow newrow = dtR_MB_OUT.NewRow();
                    double  total  = 0;
                    for (int i = 0; i < 12; i++)
                    {
                        newrow[i] = dtbos.Select("dtype='去年同期' and dmonth=" + (i + 1)).Sum(p => p.Field <double>("dobjvalue"));
                        total    += Convert.ToDouble(newrow[i]);
                    }
                    newrow[12] = total;
                    newrow[13] = rowname;
                    dtR_MB_OUT.Rows.Add(newrow);
                }
            }
        }
Ejemplo n.º 4
0
 public void ReportGenerationEditApplication()
 {
     ReportsManagementWindow.ClickOn();
     ReportEdit.ClickOn();
     ReportName.EnterClearText("edit" + RandomNumber.smallNumber());
     ApproveEdit.ClickOn();
     softAssert.VerifySuccessMsg();
 }
Ejemplo n.º 5
0
 public void ReportGenerationCreateApplication()
 {
     GoTo();
     utility.ClickDropdownAndEnter(ReportEntityDropdown);
     FillFieldsToDisplay();
     FindFieldToDefine();
     SaveReport.ClickOn();
     ReportName.SendKeys(Constant.ReportName + RandomNumber.smallNumber());
     SaveAfterName.ClickOn();
     softAssert.VerifySuccessMsg();
 }
Ejemplo n.º 6
0
        public List <string> ExportLines()
        {
            List <string> lines = new List <string>();

            lines.Add("[Report]");
            lines.Add("Descriptor=" + Descriptor);
            lines.Add("ReportName=" + ReportName.ToUpper());
            lines.Add("PrinterName=" + PrinterName);
            string papername = printDocument.PrinterSettings.DefaultPageSettings.
                               PaperSize.PaperName;

            lines.Add("PaperName=" + papername);
            bool landscape = printDocument.PrinterSettings.DefaultPageSettings.Landscape;

            lines.Add("Landscape=" + ((landscape) ? "1" : "0"));
            Margins mgs = printDocument.PrinterSettings.DefaultPageSettings.Margins;

            lines.Add("Left=" + mgs.Left.ToString());
            lines.Add("Right=" + mgs.Right.ToString());
            lines.Add("Top=" + mgs.Top.ToString());
            lines.Add("Bottom=" + mgs.Bottom.ToString());
            lines.Add("");
            foreach (Plot item in PlotList)
            {
                lines.Add("[" + item.Name + "]");
                foreach (KeyValuePair <string, object> prop in item.Props)
                {
                    if (!prop.Key.Equals("ImagePath"))
                    {
                        Type valtype = prop.Value.GetType();
                        switch (valtype.Name)
                        {
                        case "Boolean":
                            lines.Add(prop.Key + "=" + (((bool)prop.Value) ? "1" : "0"));
                            break;

                        case "Color":
                            Color color = (Color)prop.Value;
                            lines.Add(prop.Key + "=" + Data.ColorToBase(color));
                            break;

                        default:
                            string value = prop.Value.ToString();
                            lines.Add(prop.Key + "=" + value);
                            break;
                        }
                    }
                }
                lines.Add("");
            }
            return(lines);
        }
Ejemplo n.º 7
0
 public static bool CheckforPermission(User _User, ReportName _report)
 {
     bool check = false;
     try
     {
         switch (_report)
         {
             case ReportName.Audit:
                 if (_User.MRAudit == true)
                     check = true;
                 break;
             case ReportName.Daily:
                 if (_User.MRDailyAtt == true)
                     check = true;
                 break;
             case ReportName.Detail:
                 if (_User.MRDetail == true)
                     check = true;
                 break;
             case ReportName.Employee:
                 if (_User.MREmployee == true)
                     check = true;
                 break;
             case ReportName.Grpah:
                 if (_User.MRGraph == true)
                     check = true;
                 break;
             case ReportName.Leave:
                 if (_User.MRLeave == true)
                     check = true;
                 break;
             case ReportName.ManualAtt:
                 if (_User.MRManualEditAtt == true)
                     check = true;
                 break;
             case ReportName.Monthly:
                 if (_User.MRMonthly == true)
                     check = true;
                 break;
             case ReportName.Summary:
                 if (_User.MRSummary == true)
                     check = true;
                 break;
         }
     }
     catch (Exception ex)
     {
         check = false;
     }
     return check;
 }
Ejemplo n.º 8
0
        public byte[] Render(ReportName reportName, IDictionary<string, object[]> dataSources, params ReportParameter[] parameters)
        {
            var localReport = new LocalReport();
            localReport.ReportEmbeddedResource = new ReportResourceResolver().ResolveResource(reportName);

            foreach (var dataSource in dataSources)
            {
                var reportDataSource = new ReportDataSource(dataSource.Key, dataSource.Value);
                localReport.DataSources.Add(reportDataSource);
            }

            if (parameters != null && parameters.Length > 0)
                localReport.SetParameters(parameters);

            var reportType = "PDF";

            var settings = localReport.GetDefaultPageSettings();

            var width = settings.IsLandscape ? settings.PaperSize.Height : settings.PaperSize.Width;
            var height = settings.IsLandscape ? settings.PaperSize.Width : settings.PaperSize.Height;

            var deviceInfo =
                "<DeviceInfo>" +
                "  <OutputFormat>PDF</OutputFormat>" +
                "  <PageWidth>" + width / 100.0m + "in</PageWidth>" +
                "  <PageHeight>" + height / 100.0m + "in</PageHeight>" +
                "  <MarginTop>" + settings.Margins.Top / 100.0m + "in</MarginTop>" +
                "  <MarginLeft>" + settings.Margins.Left / 100.0m + "in</MarginLeft>" +
                "  <MarginRight>" + settings.Margins.Right / 100.0m + "in</MarginRight>" +
                "  <MarginBottom>" + settings.Margins.Bottom / 100.0m + "in</MarginBottom>" +
                "</DeviceInfo>";

            string mimeType;
            string encoding;
            string fileNameExtension;
            Warning[] warnings;
            string[] streams;

            return localReport.Render(
                reportType,
                deviceInfo,
                out mimeType,
                out encoding,
                out fileNameExtension,
                out streams,
                out warnings);
        }
Ejemplo n.º 9
0
        public IActionResult ShowReport(
            DateTime start_Date
            , DateTime end_Date

            , string report_name
            //Показывать ли записи за период
            , int selectedPeriod = 0
            //используется для фильтра по сорту продукции в отчетах
            , string selectedSortOfProduction = null
            , int export_excel     = 0
            , string[] baseStrings = null //используется для экспорта рисункову диаграм в эксель
            , int lastDay          = 0    // нужен вывод за последний день
            , int tesYear          = 0    //для отчёта по ТЭС нужен отдельно год отчёта
            , int selectedMonth    = 0
            , int selectedYear     = 0
            , int currShiftIndex   = -1)          //индекс смены для отчёта по сменам
        {
            //Формируем инфу по проекту
            var reportName  = new ReportName(report_name);
            var reportDates = new ReportDates(start_Date, end_Date, selectedPeriod, lastDay,
                                              tesYear,//для отчёта по ТЭС нужен отдельно год отчёта
                                              selectedMonth, selectedYear);

            //Сохраняем использование отчёта
            Save_report_usage(this, reportName.Rus, context);

            //берём закешированные данные если они есть, иначе формируем новые данные
            var reportInfo = reportInfo_contr;

            reportInfo.EvalReportInfo(reportName, context, reportDates, currShiftIndex: currShiftIndex, export_excel: export_excel, selectedSortOfProduction, baseStrings, curr_controller: this);

            if (export_excel == 1)
            {
                return(Excel_methods.Export_to_Excel(reportName.Eng, reportInfo, controller: this));
            }

            #region viewbag filling
            //Подготавливаем параметры для отчёта
            //в основном данные берутся из reportInfo, но где то может понадобится
            ViewBag.start_Date  = reportInfo.ReportDates.StartDate;
            ViewBag.end_Date    = reportInfo.ReportDates.StartDate;
            ViewBag.report_name = reportName.Full;
            ViewData["tesYear"] = tesYear;
            #endregion
            return(View(reportInfo.ReportName.ViewName, reportInfo));
        }
        public override PagedData ProcessRequest(HttpContext context, CookDBDataContext db)
        {
            if (context.Request.Params.Count == 0)
            {
                return(new PagedData("Can't call RemoveReportName.ashx without parameters"));
            }

            if (context.Request.Params.Get("name") == null)
            {
                return(new PagedData("Name is null"));
            }

            ReportName name = db.ReportNames.Single(a => a.name.Equals(context.Request.Params.Get("name")));

            db.ReportNames.DeleteOnSubmit(name);
            db.SubmitChanges();

            return(new PagedData(""));
        }
Ejemplo n.º 11
0
        /// <summary>
        /// </summary>
        /// <returns></returns>
        public override int GetHashCode()
        {
            unchecked
            {
                // ReSharper disable NonReadonlyMemberInGetHashCode
                var hashCode = HostAddress != null?HostAddress.GetHashCode() : 0;

                hashCode = (hashCode * 397) ^ (UserId != null ? UserId.GetHashCode() : 0);
                //hashCode = (hashCode * 397) ^ (Password != null ? Password.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ MaxResult;
                hashCode = (hashCode * 397) ^ (ReportName != null ? ReportName.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (CustomField1 != null ? CustomField1.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (CustomField2 != null ? CustomField2.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (CustomField3 != null ? CustomField3.GetHashCode() : 0);
                hashCode = (hashCode * 397) ^ (CustomField4 != null ? CustomField4.GetHashCode() : 0);
                return(hashCode);
                // ReSharper restore NonReadonlyMemberInGetHashCode
            }
        }
Ejemplo n.º 12
0
        private async Task UpdateAsync(ReportName name, Func <string, IVisitor> getVisitor)
        {
            _logger.LogInformation("Updating report {Name}.", name);

            using (_logger.Indent())
            {
                var cursorProvider = new CursorFactory(
                    cursorSuffix: $"report.{name}",
                    defaultCursorValue: _defaultCursorValue,
                    logger: _logger);

                var csvPath = Path.Combine(_config.DataDirectory, "reports", $"{name}.csv");

                var downloader = new Downloader(
                    _httpClient,
                    _config,
                    cursorProvider,
                    getVisitor(csvPath),
                    _logger);

                await downloader.DownloadAsync();
            }
        }
        public override PagedData ProcessRequest(HttpContext context, CookDBDataContext db)
        {
            if (context.Request.Params.Count == 0)
            {
                return(new PagedData("Can't call AddReportName.ashx without parameters"));
            }

            if (context.Request.Params.Get("name") == null)
            {
                return(new PagedData("Name is null"));
            }


            ReportName name = new ReportName();

            name.name = context.Request.Params.Get("name");
            db.ReportNames.InsertOnSubmit(name);


            db.SubmitChanges();

            return(new PagedData(""));
        }
 public string ResolveResource(ReportName reportName)
 {
     return string.Format("{0}.{1}.rdlc", ReportNamespace, reportName);
 }
Ejemplo n.º 15
0
        public static bool CheckforPermission(User _User, ReportName _report)
        {
            bool check = false;

            try
            {
                switch (_report)
                {
                case ReportName.Audit:
                    if (_User.MRAudit == true)
                    {
                        check = true;
                    }
                    break;

                case ReportName.Daily:
                    if (_User.MRDailyAtt == true)
                    {
                        check = true;
                    }
                    break;

                case ReportName.Detail:
                    if (_User.MRDetail == true)
                    {
                        check = true;
                    }
                    break;

                case ReportName.Employee:
                    if (_User.MREmployee == true)
                    {
                        check = true;
                    }
                    break;

                case ReportName.Grpah:
                    if (_User.MRGraph == true)
                    {
                        check = true;
                    }
                    break;

                case ReportName.Leave:
                    if (_User.MRLeave == true)
                    {
                        check = true;
                    }
                    break;

                case ReportName.ManualAtt:
                    if (_User.MRManualEditAtt == true)
                    {
                        check = true;
                    }
                    break;

                case ReportName.Monthly:
                    if (_User.MRMonthly == true)
                    {
                        check = true;
                    }
                    break;

                case ReportName.Summary:
                    if (_User.MRSummary == true)
                    {
                        check = true;
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                check = false;
            }
            return(check);
        }
Ejemplo n.º 16
0
        private void GetParaMeters()
        {
            int ParaCount = 0;

            paramField         = new ParameterField();
            paramDiscreteValue = new ParameterDiscreteValue();
            paramValues        = new ParameterValues();

            if (ReportName != "RPTVoucherPrint" && ReportName != "RPTVoucherDetailsPrint" && ReportName != "BarCodePrint" && ReportName != "BarCodePrintBig" && ReportName != "BarCodePrintBig50x50" && ReportName != "BarCodePrintMedium50x25" && ReportName != "BarCodePrintSmall34x22" && ReportName != "SeasonalBarCodePrint" && ReportName != "WeighingBarCodePrint")
            {
                paramField = report.ParameterFields[ParaCount];
                paramDiscreteValue.Value = DBGetVal.FirmName;
                paramValues.Add(paramDiscreteValue);
                paramField.CurrentValues = paramValues;
                report.DataDefinition.ParameterFields[ParaCount].ApplyCurrentValues(paramValues);
                ParaCount++;
            }

            if (ReportName != "GetBill" && ReportName != "GetBillAPMCMar" && ReportName != "GetBillAPMC" && ReportName != "DCGetBill-A4" && ReportName != "GetDCPrint" && ReportName != "GetDCAPMC" && ReportName != "GetBillFirmPackList" &&
                ReportName != "GetBillMar" && ReportName != "RPTVoucherPrint" && ReportName != "RPTVoucherDetailsPrint" && ReportName != "BarCodePrint" && ReportName != "GetDCBoxPrintMar" && ReportName != "GetDCKgPrintMar" &&
                ReportName != "BarCodePrintBig" && ReportName != "BarCodePrintBig50x50" && ReportName != "BarCodePrintMedium50x25" &&
                ReportName != "BarCodePrintSmall34x22" && ReportName != "GetBigBill" && ReportName != "GetBillMRP" && ReportName != "GetBillMarMRP" && ReportName != "GetBill-a4" && ReportName != "GetBillMarPakka-A5" &&
                ReportName.IndexOf("GetDeliveryChallanFirm") == -1 && ReportName.IndexOf("GetBillFirm") == -1 && ReportName.IndexOf("GetBigBillFirm") == -1 &&
                ReportName.IndexOf("GetBillFirmTrans") == -1 && ReportName.IndexOf("GetBigBillFirmTrans") == -1 &&
                ReportName.IndexOf("GetBillFirmMar") == -1 && ReportName.IndexOf("GetBigBillFirmMar") == -1 &&
                ReportName.IndexOf("GetBillFirmTransMar") == -1 && ReportName.IndexOf("GetBigBillFirmTransMar") == -1 &&
                ReportName != "RptLocationWisePrint" &&
                ReportName.IndexOf("GetReturnBill") == -1 && ReportName != "GetQuotation" && ReportName != "GetQuotationBig")
            {
                paramField         = new ParameterField();
                paramDiscreteValue = new ParameterDiscreteValue();
                paramValues        = new ParameterValues();

                paramField = report.ParameterFields[ParaCount];
                paramDiscreteValue.Value = DBGetVal.FromDate;
                paramValues.Add(paramDiscreteValue);
                paramField.CurrentValues = paramValues;
                report.DataDefinition.ParameterFields[ParaCount].ApplyCurrentValues(paramValues);
                ParaCount++;

                paramField         = new ParameterField();
                paramDiscreteValue = new ParameterDiscreteValue();
                paramValues        = new ParameterValues();

                paramField = report.ParameterFields[ParaCount];
                paramDiscreteValue.Value = DBGetVal.ToDate;
                paramValues.Add(paramDiscreteValue);
                paramField.CurrentValues = paramValues;
                report.DataDefinition.ParameterFields[ParaCount].ApplyCurrentValues(paramValues);
                ParaCount++;
            }
            try
            {
                for (int i = 0; i < ReportSession.Length; i++)
                {
                    paramField         = new ParameterField();
                    paramDiscreteValue = new ParameterDiscreteValue();
                    paramValues        = new ParameterValues();

                    paramField = report.ParameterFields[ParaCount];
                    paramDiscreteValue.Value = ReportSession[i];
                    paramValues.Add(paramDiscreteValue);
                    paramField.CurrentValues = paramValues;
                    report.DataDefinition.ParameterFields[ParaCount].ApplyCurrentValues(paramValues);

                    ParaCount += 1;
                }
            }
            catch (Exception e)
            {
                report.Close();
                CommonFunctions.ErrorMessge = e.Message;
            }
        }
Ejemplo n.º 17
0
 public byte[] Render(ReportName reportName, string dataSourceName, dynamic model, params ReportParameter[] parameters)
 {
     return Render(reportName, new Dictionary<string, object[]> { { dataSourceName, model } }, parameters);
 }