Exemplo n.º 1
0
        public KPIReport GetKPIReport(DashboardParameters para)
        {
            DashboardDataHelper rdHelper  = new DashboardDataHelper();
            KPIReport           kPIReport = new KPIReport();

            var TotalUnits       = rdHelper.GetTotalUnits(para);
            var UnitsWithinRange = rdHelper.GetUnitsWithinWeightRange(para);

            decimal Precision = 0;

            if (TotalUnits != 0)
            {
                Precision = (UnitsWithinRange / TotalUnits) * 100;
            }

            var UnitsWithinFillTimeLimits = rdHelper.GetUnitsWithinFillTimeLimits(para);

            decimal Performance = 0;

            if (TotalUnits != 0)
            {
                Performance = (UnitsWithinFillTimeLimits / TotalUnits) * 100;
            }


            kPIReport.Precision   = Math.Round(Precision, 2);
            kPIReport.Performance = Math.Round(Performance);
            kPIReport.Efficiency  = Math.Round((Performance + Precision) / 2, 2);


            return(kPIReport);
        }
        public KPIReport GetKPIReport([FromBody] DashboardParameters para)
        {
            DashboardData reportData = new DashboardData();
            KPIReport     kPIReport  = reportData.GetKPIReport(para);


            return(kPIReport);
        }
Exemplo n.º 3
0
 public KPIReport LoadKPIReport(int companyId, int reportMonth, int reportYear)
 {
     try
     {
         DataSet reportData;
         using (IO io = new IO(WebCommon.KPIConnectionString))
         {
             reportData = io.ExecuteDataSetQuery(IO.CreateCommandFromStoredProc("KPI_REPORT_LOADREPORTDATA",
                 Param.CreateParam("COMPANYID", SqlDbType.Int, companyId),
                 Param.CreateParam("KPIREPORTMONTH", SqlDbType.Int, reportMonth),
                 Param.CreateParam("KPIREPORTYEAR", SqlDbType.Int, reportYear)));
         }
         if (reportData.Tables.Count == 0 || reportData.Tables[0].Rows.Count == 0)
         {
             return null;
         }
         KPIReport report = new KPIReport();
         report.kpiReportId = Convert.ToInt32(reportData.Tables[0].Rows[0]["KPI_REPORT_ID"]);
         report.createDate = Convert.ToDateTime(reportData.Tables[0].Rows[0]["CREATE_DATE"]);
         report.lastUpdate = Convert.ToDateTime(reportData.Tables[0].Rows[0]["LAST_UPDATE"]);
         report.reportDate = Convert.ToDateTime(reportData.Tables[0].Rows[0]["REPORT_DATE"]);
         report.createdBy = Convert.ToString(reportData.Tables[0].Rows[0]["CREATED_BY"]);
         report.reportYear = Convert.ToInt32(reportData.Tables[0].Rows[0]["REPORT_YEAR"]);
         report.reportMonth = Convert.ToInt32(reportData.Tables[0].Rows[0]["REPORT_MONTH"]);
         report.targetCollectionAmount = Convert.ToInt32(reportData.Tables[0].Rows[0]["TARGET_COLLECTION_AMOUNT"]);
         report.targetDSOAmount = Convert.ToInt32(reportData.Tables[0].Rows[0]["TARGET_DSO_AMOUNT"]);
         report.invoicingStartDate = Convert.ToDateTime(reportData.Tables[0].Rows[0]["INVOICING_START_DATE"]);
         report.companyId = Convert.ToInt32(reportData.Tables[0].Rows[0]["COMPANY_ID"]);
         report.invoicingWeek5Date = Convert.ToDateTime(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "INVOICING_WEEK_5_DATE", DateTime.MinValue));
         report.projectedBillingWeek1 = Convert.ToInt32(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "PROJECTED_BILLING_WEEK_1", 0));
         report.projectedBillingWeek2 = Convert.ToInt32(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "PROJECTED_BILLING_WEEK_2", 0));
         report.projectedBillingWeek3 = Convert.ToInt32(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "PROJECTED_BILLING_WEEK_3", 0));
         report.projectedBillingWeek4 = Convert.ToInt32(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "PROJECTED_BILLING_WEEK_1", 0));
         report.projectedBillingWeek5 = Convert.ToInt32(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "PROJECTED_BILLING_WEEK_1", 0));
         report.actualInvoicingWeek1 = Convert.ToDateTime(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "ACTUAL_INVOICING_WEEK_1", DateTime.MinValue));
         report.actualInvoicingWeek2 = Convert.ToDateTime(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "ACTUAL_INVOICING_WEEK_2", DateTime.MinValue));
         report.actualInvoicingWeek3 = Convert.ToDateTime(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "ACTUAL_INVOICING_WEEK_3", DateTime.MinValue));
         report.actualInvoicingWeek4 = Convert.ToDateTime(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "ACTUAL_INVOICING_WEEK_4", DateTime.MinValue));
         report.actualInvoicingWeek5 = Convert.ToDateTime(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "ACTUAL_INVOICING_WEEK_5", DateTime.MinValue));
         report.didNotPostWeek1 = Convert.ToInt32(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "DID_NOT_POST_WEEK_1", 0));
         report.didNotPostWeek2 = Convert.ToInt32(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "DID_NOT_POST_WEEK_2", 0));
         report.didNotPostWeek3 = Convert.ToInt32(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "DID_NOT_POST_WEEK_3", 0));
         report.didNotPostWeek4 = Convert.ToInt32(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "DID_NOT_POST_WEEK_4", 0));
         report.didNotPostWeek5 = Convert.ToInt32(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "DID_NOT_POST_WEEK_5", 0));
         report.catchUpWeek1 = Convert.ToInt32(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "CATCH_UP_WEEK_1", 0));
         report.catchUpWeek2 = Convert.ToInt32(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "CATCH_UP_WEEK_2", 0));
         report.catchUpWeek3 = Convert.ToInt32(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "CATCH_UP_WEEK_3", 0));
         report.catchUpWeek4 = Convert.ToInt32(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "CATCH_UP_WEEK_4", 0));
         report.catchUpWeek5 = Convert.ToInt32(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "CATCH_UP_WEEK_5", 0));
         report.creditAppsReceived = Convert.ToInt32(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "CREDIT_APPS_RECEIVED", 0));
         report.creditAppsChecked = Convert.ToInt32(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "CREDIT_APPS_CHECKED", 0));
         report.paymentGivenNum = Convert.ToInt32(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "PAYMENT_GIVEN_NUM", 0));
         report.paymentGivenNumPercent = Convert.ToInt32(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "PAYMENT_GIVEN_NUM_PERCENT", 0));
         report.paymentGivenAmount = Convert.ToInt32(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "PAYMENT_GIVEN_AMOUNT", 0));
         report.paymentGivenAmountPercent = Convert.ToInt32(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "PAYMENT_GIVEN_AMOUNT_PERCENT", 0));
         report.paymentMissingNum = Convert.ToInt32(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "PAYMENT_MISSING_NUM", 0));
         report.paymentMissingNumPercent = Convert.ToInt32(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "PAYMENT_MISSING_NUM_PERCENT", 0));
         report.paymentMissingAmount = Convert.ToInt32(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "PAYMENT_MISSING_AMOUNT", 0));
         report.paymentMissingAmountPercent = Convert.ToInt32(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "PAYMENT_MISSING_AMOUNT_PERCENT", 0));
         report.waivedNum = Convert.ToInt32(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "WAIVED_NUM", 0));
         report.waivedNumPercent = Convert.ToInt32(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "WAIVED_NUM_PERCENT", 0));
         report.waivedAmount = Convert.ToInt32(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "WAIVED_AMOUNT", 0));
         report.waivedAmountPercent = Convert.ToInt32(IO.GetDataRowValue(reportData.Tables[0].Rows[0], "WAIVED_AMOUNT_PERCENT", 0));
         return report;
     }
     catch (Exception ex)
     {
         WebCommon.LogExceptionInfo(ex);
         throw new Exception("An error occurred while trying to load the report data.");
     }
 }