Exemple #1
0
 private void Initialize()
 {
     ReportCalculationsManager = new ReportCalculations();
     ReportCalculationsManager.Initialize();
     ClientErrorsGridSetting();
     CalendarFrom.SelectionEnd = new DateTime(2014, 10, 28);
     CalendarTo.SelectionEnd   = new DateTime(2014, 10, 28);
 }
    private void ShowTemplateReport()
    {
        String tableHTML = getListReportTemplates();

        DocumentTemplatesList.InnerHtml = tableHTML;
        DocumentTemplateAcctions.InnerHtml = getReportTemplateActions(tableHTML == "");
        // vai buscar os valores deste projecto
        ReportCalculations calcs = new ReportCalculations();
        Utility.getReportSettings(calcs, Utility.currProjeto);

        //// inicializações
        String temp = String.Format("var DIST_BAD={0}, DIST_MED_BOTTOM={1}, DIST_MED_TOP={2}, DIST_GOOD_BOTTOM = {3}, MAX_ESCALA={4}, MAX_ESCALA_C={5}, VALOR_ESCALA_CUT_BAIXO={6}, VALOR_ESCALA_CUT_ALTO={7}; ",
            (int)(calcs.DIST_BAD * 100), (int)(calcs.DIST_MED_BOTTOM * 100), (int)(calcs.DIST_MED_TOP * 100), (int)(calcs.DIST_GOOD_BOTTOM * 100), calcs.MAX_ESCALA, calcs.MAX_ESCALA_C,
            calcs.VALOR_ESCALA_CUT_BAIXO, calcs.VALOR_ESCALA_CUT_ALTO);

        temp += String.Format("var GAP_DELTA_MIN={0},GAP_DELTA_MAX={1},MEDIA_CRITIC_DOWN_CUT={2},MEDIA_CRITIC_UP_CUT={3},CRITIC_UP_CUT={4},CRITIC_DOWN_CUT={5};", (int)(calcs.GAP_DELTA_MIN * 100), (int)(calcs.GAP_DELTA_MAX * 100),
            (int)(calcs.MEDIA_CRITIC_DOWN_CUT * 100), (int)(calcs.MEDIA_CRITIC_UP_CUT * 100), (int)(calcs.CRITIC_UP_CUT * 100), (int)(calcs.CRITIC_DOWN_CUT * 100));

        temp += String.Format("var FRACOS_FORTES_BOTTOM={0},FRACOS_FORTES_TOP={1};", (int)(calcs.FRACOS_FORTES_BOTTOM * 100), (int)(calcs.FRACOS_FORTES_TOP * 100));

        //temp += "updateFracosFortesDIVS();";
        reportconfigurationSetting = temp;
    }
Exemple #3
0
 public ReportCharts(ReportCalculations reportCalcs, String filename, MainDocumentPart mainDocPart)
 {
     _reportCalcs = reportCalcs;
     _mainDocPart = mainDocPart;
 }
Exemple #4
0
    public static bool getReportSettings(ReportCalculations reportCalculations, Projecto p)
    {
        int zero = -1;
        int zeroC = -1;
        String StrEscala = p.getCurrentConfig("SCALE");
        String[] Escalas = StrEscala.Split('«');
        String[] Valores = Escalas[0].Split('|');
        int realScaleSize = Valores.Count();

        String StrEscalaC = p.getCurrentConfig("SCALE_C");
        String[] EscalasC = StrEscalaC.Split('«');
        String[] ValoresC = EscalasC[0].Split('|');
        int realScaleSizeC = ValoresC.Count();

        // o primeiro valor pode ser o NR, ou não
        int.TryParse(Valores[0], out zero);
        Valores[0] = zero.ToString();
        realScaleSize = Valores.Count();

        // o primeiro valor pode ser o NR, ou não
        int.TryParse(ValoresC[0], out zeroC);
        ValoresC[0] = zeroC.ToString();
        realScaleSizeC = ValoresC.Count();

        if (zero == 0)
            realScaleSize--;
        if (zeroC == 0)
            realScaleSizeC--;

        reportCalculations.MAX_ESCALA = realScaleSize;
        reportCalculations.MAX_ESCALA_C = realScaleSizeC;

        switch (realScaleSize)
        {
            case 5:
                reportCalculations.GAP_DELTA_MAX = 0.5;
                reportCalculations.GAP_DELTA_MIN = -0.5;

                reportCalculations.MEDIA_CRITIC_DOWN_CUT = 2F;
                reportCalculations.MEDIA_CRITIC_UP_CUT = 4F;

                reportCalculations.FRACOS_FORTES_BOTTOM = 3.4999F;
                reportCalculations.FRACOS_FORTES_TOP = 4.25F;

                reportCalculations.DIST_BAD = 0.06F;
                reportCalculations.DIST_MED_BOTTOM = 0.3F;
                reportCalculations.DIST_MED_TOP = 0.6F;
                reportCalculations.DIST_GOOD_BOTTOM = 0.7F;

                reportCalculations.VALOR_ESCALA_CUT_BAIXO = 2;
                reportCalculations.VALOR_ESCALA_CUT_ALTO = 4;
                break;
            case 6:
                // ESCALA DE 6
                reportCalculations.GAP_DELTA_MAX = 0.5;
                reportCalculations.GAP_DELTA_MIN = -0.5;

                reportCalculations.MEDIA_CRITIC_DOWN_CUT = 3F;
                reportCalculations.MEDIA_CRITIC_UP_CUT = 5F;

                reportCalculations.FRACOS_FORTES_BOTTOM = 3.0F;
                reportCalculations.FRACOS_FORTES_TOP = 5.0F;

                reportCalculations.DIST_BAD = 0.06F;
                reportCalculations.DIST_MED_BOTTOM = 0.3F;
                reportCalculations.DIST_MED_TOP = 0.6F;
                reportCalculations.DIST_GOOD_BOTTOM = 0.7F;

                reportCalculations.VALOR_ESCALA_CUT_BAIXO = 3;
                reportCalculations.VALOR_ESCALA_CUT_ALTO = 5;
                break;
            case 7:
                reportCalculations.GAP_DELTA_MAX = 0.5;
                reportCalculations.GAP_DELTA_MIN = -0.5;

                reportCalculations.MEDIA_CRITIC_DOWN_CUT = 3.5F;
                reportCalculations.MEDIA_CRITIC_UP_CUT = 5.5F;

                reportCalculations.FRACOS_FORTES_BOTTOM = 3.5F;
                reportCalculations.FRACOS_FORTES_TOP = 5.5F;

                reportCalculations.DIST_BAD = 0.06F;
                reportCalculations.DIST_MED_BOTTOM = 0.3F;
                reportCalculations.DIST_MED_TOP = 0.6F;
                reportCalculations.DIST_GOOD_BOTTOM = 0.7F;

                reportCalculations.VALOR_ESCALA_CUT_BAIXO = 3;
                reportCalculations.VALOR_ESCALA_CUT_ALTO = 6;
                break;
            case 8:
                reportCalculations.GAP_DELTA_MAX = 0.5;
                reportCalculations.GAP_DELTA_MIN = -0.5;

                reportCalculations.MEDIA_CRITIC_DOWN_CUT = 3F;
                reportCalculations.MEDIA_CRITIC_UP_CUT = 6F;

                reportCalculations.FRACOS_FORTES_BOTTOM = 4.0F;
                reportCalculations.FRACOS_FORTES_TOP = 6.0F;

                reportCalculations.DIST_BAD = 0.06F;
                reportCalculations.DIST_MED_BOTTOM = 0.3F;
                reportCalculations.DIST_MED_TOP = 0.6F;
                reportCalculations.DIST_GOOD_BOTTOM = 0.7F;

                reportCalculations.VALOR_ESCALA_CUT_BAIXO = 4;
                reportCalculations.VALOR_ESCALA_CUT_ALTO = 7;
                break;
        }

        switch (realScaleSizeC)
        {
            case 5:
                reportCalculations.CRITIC_DOWN_CUT = 2F;
                reportCalculations.CRITIC_UP_CUT = 4F;
                break;
            case 6:
                // ESCALA DE 6
                reportCalculations.CRITIC_DOWN_CUT = 3F;
                reportCalculations.CRITIC_UP_CUT = 5F;
                break;
            case 7:
                reportCalculations.CRITIC_DOWN_CUT = 3.5F;
                reportCalculations.CRITIC_UP_CUT = 5.5F;
                break;
            case 8:
                reportCalculations.CRITIC_DOWN_CUT = 3F;
                reportCalculations.CRITIC_UP_CUT = 6F;
                break;
        }

        String reportSettings = p.getreportSettings();

        if (reportSettings == null) return true;

        String[] vars = reportSettings.Split(';');
        Dictionary<String, double> valores = new Dictionary<string, double>();
        String[] dim;

        foreach (String var in vars)
        {
            dim = var.Split('=');
            if (dim.Length == 2)
            {
                if (dim[0] != "VALOR_ESCALA_CUT_BAIXO" && dim[0] != "VALOR_ESCALA_CUT_ALTO")
                    valores.Add(dim[0], float.Parse(dim[1]) / 100.0);
                else
                    valores.Add(dim[0], float.Parse(dim[1]));
            }
        }

        if (valores.ContainsKey("MEDIA_CRITIC_DOWN_CUT"))
            reportCalculations.MEDIA_CRITIC_DOWN_CUT = valores["MEDIA_CRITIC_DOWN_CUT"];

        if (valores.ContainsKey("MEDIA_CRITIC_UP_CUT"))
            reportCalculations.MEDIA_CRITIC_UP_CUT = valores["MEDIA_CRITIC_UP_CUT"];

        if (valores.ContainsKey("FRACOS_FORTES_BOTTOM"))
            reportCalculations.FRACOS_FORTES_BOTTOM = valores["FRACOS_FORTES_BOTTOM"];

        if (valores.ContainsKey("FRACOS_FORTES_TOP"))
            reportCalculations.FRACOS_FORTES_TOP = valores["FRACOS_FORTES_TOP"];

        if (valores.ContainsKey("DIST_BAD"))
            reportCalculations.DIST_BAD = valores["DIST_BAD"];

        if (valores.ContainsKey("DIST_MED_BOTTOM"))
            reportCalculations.DIST_MED_BOTTOM = valores["DIST_MED_BOTTOM"];

        if (valores.ContainsKey("DIST_MED_TOP"))
            reportCalculations.DIST_MED_TOP = valores["DIST_MED_TOP"];

        if (valores.ContainsKey("DIST_GOOD_BOTTOM"))
            reportCalculations.DIST_GOOD_BOTTOM = valores["DIST_GOOD_BOTTOM"];

        if (valores.ContainsKey("VALOR_ESCALA_CUT_BAIXO"))
            reportCalculations.VALOR_ESCALA_CUT_BAIXO = (int)valores["VALOR_ESCALA_CUT_BAIXO"];

        if (valores.ContainsKey("VALOR_ESCALA_CUT_ALTO"))
            reportCalculations.VALOR_ESCALA_CUT_ALTO = (int)valores["VALOR_ESCALA_CUT_ALTO"];

        if (valores.ContainsKey("CRITIC_DOWN_CUT"))
            reportCalculations.CRITIC_DOWN_CUT = valores["CRITIC_DOWN_CUT"];

        if (valores.ContainsKey("CRITIC_UP_CUT"))
            reportCalculations.CRITIC_UP_CUT = valores["CRITIC_UP_CUT"];

        if (valores.ContainsKey("GAP_DELTA_MAX"))
            reportCalculations.GAP_DELTA_MAX = valores["GAP_DELTA_MAX"];

        if (valores.ContainsKey("GAP_DELTA_MIN"))
            reportCalculations.GAP_DELTA_MIN = valores["GAP_DELTA_MIN"];

        return true;
    }
    private void startOne2One()
    {
        try
        {
            foreach (Ticket t in _lstTickets)
            {
                this._self = t.Proprio;
                this._avaliado = t.Avaliado;
                this._endMarker = t.Chave;

                _Modelo = ModeloCompetencias.getDBModelo(_projecto.owner, ModeloCompetencias.getPessoaModelo(_avaliado.PessoaID, _projecto.ProjectoID));
                _Modelo.loadFull(_projecto.owner, null);

                repCalcs = new ReportCalculations(_Modelo, _self, _avaliado, _projecto);

                if (!repCalcs.InitOne2One())
                {
                    endProcessing();
                    return;
                }

                CountUps = 0;
                CountHoriz = 0;
                CountDown = 0;

                createReportOne2One();

                endProcessing();

                // para o caso de ter de continuar a gerar outros relatórios
                ChartsToUpdate = new Dictionary<String, List<ReportRow>>();
                ChartsAranhaToUpdate = new Dictionary<String, List<ReportRow>>();
                ChartsToUpdateExtended = new Dictionary<chartHelper, List<ReportRow>>();
            }
        }
        catch (Exception e)
        {
            Error = "Erro ao processar o questionário";

            string filename = outputFilename + ".error";
            TextWriter stream = new StreamWriter(filename);
            stream.WriteLine(e.ToString());
            stream.Flush();
            stream.Close();

            endProcessing();
            worker.Abort();
            worker.Join();
            return;
        }

        endProcessing();
        worker.Join();
        worker.Abort();
    }
    public ReportFactory(String templatePath, String destinationPath, DateTime dataDocumento, Pessoa self, Pessoa avaliado, Projecto proj, String endMarker)
    {
        this.templatePath = templatePath;
        this.destPath = destinationPath;
        this._self = self;
        this._avaliado = avaliado;
        this._projecto = proj;
        this._endMarker = endMarker;

        _Modelo = ModeloCompetencias.getDBModelo(_projecto.owner, ModeloCompetencias.getPessoaModelo(_avaliado.PessoaID, _projecto.ProjectoID));
        _Modelo.loadFull(_projecto.owner, null);

        repCalcs = new ReportCalculations(_Modelo, self, avaliado, proj);
        if (!repCalcs.Init())
            repCalcs = null;

        CountUps = 0;
        CountHoriz = 0;
        CountDown = 0;
    }
    public ReportFactory(String templatePath, String destinationPath, DateTime dataDocumento, Pessoa self, Ticket ticket, Projecto proj, String endMarker, String langCode)
    {
        this.templatePath = templatePath;
        this.destPath = destinationPath;
        this._self = self;
        this._ticket = ticket;
        this._projecto = proj;
        this._endMarker = endMarker;
        this.langCode = langCode;

        _Modelo = ModeloCompetencias.getDBModelo(_projecto.owner, ModeloCompetencias.getPessoaModelo(_self.PessoaID, _projecto.ProjectoID));
        _Modelo.loadFull(_projecto.owner, ticket);
        _Modelo.traslateTo(langCode);

        repCalcs = new ReportCalculations(_Modelo, _self.PessoaID, _projecto);

        if (!repCalcs.Init())
            repCalcs = null;

        CountUps = 0;
        CountHoriz = 0;
        CountDown = 0;
    }