Exemplo n.º 1
0
        private static int SetTableHeaderUstHour(ref Table table, UtilDTO.CATEGORY category)
        {
            List <string> headers = new List <string>()
            {
                "Sprint"
                , $"A. Pts entregues"
                , "B. Tamanho do time"
                , "C. Qtd funcionários empresa"
                , "D. Pts por membro do time\n(A / B)"
                , "E. Pontuação de cerimônia"
                , "F. Pontos fornecedor\n(C *(D + E))"
                , "G. Horas extras"
                , "H. Horas na sprint\n(F * UST / Valor hora) + G"
                , "A ser faturado\n(H * Valor hora)"
            };

            return(SetGenericTableHeader(ref table, headers, category));
        }
Exemplo n.º 2
0
        private static int SetTableHeaderUstDev(ref Table table, UtilDTO.CATEGORY category)
        {
            List <string> headers = new List <string>
            {
                "Sprint",
                "A. Pts entregues",
                "B. Tamanho do time",
                "C. Qtd funcionários empresa",
                "D. Pts por membro do time\n(A / B)",
                "E. Fator de ajuste",
                "F. UST pelas cerimônias",
                "G. UST Hora extra\n(0,5 UST a cada 4h)",
                "H. Total de pontos\n(( D + F) * E * C) + G",
                "A ser faturado\n(G * UST) "
            };

            return(SetGenericTableHeader(ref table, headers, category));
        }
Exemplo n.º 3
0
        private static void CreateSummaryTableUstHourContent(Document document, List <SprintDevDTO> sprints, object missing, double ustValue, UtilDTO.CATEGORY category)
        {
            int   columns      = 10;
            Table summaryTable = document.Tables.Add(EndOfDocument(document, ref missing), 1, columns, ref missing, ref missing);

            summaryTable.Borders.Enable  = 1;
            summaryTable.Range.Font.Size = 8;

            SetTableHeaderUstHour(ref summaryTable, category);

            int    line       = 2;
            double totalHours = 0;

            foreach (var sprint in sprints)
            {
                foreach (var contract in sprint.Contracts)
                {
                    double employeeCount    = 0;
                    double extraHour        = 0;
                    double hours            = 0;
                    double pointsPerPartner = 0;
                    string cerimonialPoint  = "0";
                    if ((category == UtilDTO.CATEGORY.DESPESA && sprint.CerimonialPoint == UtilDTO.CERIMONIAL_POINT.DESPESA) ||
                        (category == UtilDTO.CATEGORY.INVESTIMENTO && sprint.CerimonialPoint == UtilDTO.CERIMONIAL_POINT.INVESTIMENTO))
                    {
                        cerimonialPoint = "1";
                    }
                    foreach (var dev in contract.Collaborators)
                    {
                        employeeCount += dev.Presence;
                        extraHour     += category == UtilDTO.CATEGORY.DESPESA ? dev.ExtraHoursExpenses : dev.ExtraHourInvestment;
                    }
                    double pointsPerTeamMember = category == UtilDTO.CATEGORY.DESPESA ? sprint.PointsPerTeamMemberExpenses : sprint.PointsPerTeamMemberInvestment;
                    pointsPerPartner = employeeCount * (pointsPerTeamMember + Convert.ToDouble(cerimonialPoint));
                    hours            = Math.Ceiling(pointsPerPartner * ustValue / contract.HourValue) + extraHour;
                    int acceptedPoints = category == UtilDTO.CATEGORY.DESPESA ? sprint.AcceptedPointsExpenses : sprint.AcceptedPointsInvestment;

                    summaryTable.Rows.Add(missing);
                    summaryTable.Rows[line].Range.Font.Bold = 0;
                    summaryTable.Rows[line].Shading.BackgroundPatternColor = WdColor.wdColorWhite;
                    summaryTable.Rows[line].Cells[1].Range.Text            = sprint.Range.Name;
                    summaryTable.Rows[line].Cells[2].Range.Text            = acceptedPoints.ToString();                   //A
                    summaryTable.Rows[line].Cells[3].Range.Text            = sprint.TeamSize.ToString(decimalFormat);     //B
                    summaryTable.Rows[line].Cells[4].Range.Text            = employeeCount.ToString(decimalFormat);       //C
                    summaryTable.Rows[line].Cells[5].Range.Text            = pointsPerTeamMember.ToString(decimalFormat); //D
                    summaryTable.Rows[line].Cells[6].Range.Text            = cerimonialPoint;                             //E
                    summaryTable.Rows[line].Cells[7].Range.Text            = pointsPerPartner.ToString(decimalFormat);    //F
                    summaryTable.Rows[line].Cells[8].Range.Text            = extraHour.ToString(decimalFormat);           //G
                    summaryTable.Rows[line].Cells[9].Range.Text            = hours.ToString();                            //H

                    totalHours += hours;
                    line++;
                }
            }

            summaryTable.Rows.Add(missing);
            summaryTable.Rows[line].Cells[1].Range.Text = "TOTAL:";
            summaryTable.Rows[line].Cells[1].Merge(summaryTable.Rows[line].Cells[columns - 2]);
            summaryTable.Rows[line].Cells[2].Range.Text      = totalHours.ToString() + "h";
            summaryTable.Rows[line].Cells[2].Range.Font.Bold = 1;
            summaryTable.Rows[line].Cells[3].Range.Text      = string.Format("{0:C}", totalHours * sprints[0].Contracts[0].HourValue);//(TODO) Atualmente apenas uma empresa usa esta categoria e representa a excecao. Melhorar depois!
            summaryTable.Rows[line].Cells[3].Range.Font.Bold = 1;

            //summaryTable.Range.Cells.AutoFit();
            //summaryTable.Range.Cells.DistributeHeight();
            summaryTable.Range.ParagraphFormat.SpaceAfter = 0;
        }
Exemplo n.º 4
0
        private static void CreateSummaryTableUstDev(Document document, List <SprintDevDTO> sprintsDevList, ref object missing, FornecedorDTO partner, UtilDTO.CATEGORY category)
        {
            double totalPoints = 0;
            int    columns     = 10;

            Table summaryTable = document.Tables.Add(EndOfDocument(document, ref missing), 1, columns, ref missing, ref missing);

            summaryTable.Borders.Enable  = 1;
            summaryTable.Range.Font.Size = 8;

            int line = SetTableHeaderUstDev(ref summaryTable, category);

            foreach (var sprint in sprintsDevList)
            {
                foreach (var contract in sprint.Contracts)
                {
                    if (contract.PartnerName == partner.Name)
                    {
                        double extraHourUst        = 0;
                        double employeeCount       = 0;
                        double partialPoints       = 0;
                        int    acceptedPoints      = category == UtilDTO.CATEGORY.DESPESA ? sprint.AcceptedPointsExpenses : sprint.AcceptedPointsInvestment;
                        double pointsPerTeamMember = category == UtilDTO.CATEGORY.DESPESA ? sprint.PointsPerTeamMemberExpenses : sprint.PointsPerTeamMemberInvestment;
                        string cerimonialPoint     = "0";
                        if ((category == UtilDTO.CATEGORY.DESPESA && sprint.CerimonialPoint == UtilDTO.CERIMONIAL_POINT.DESPESA) ||
                            (category == UtilDTO.CATEGORY.INVESTIMENTO && sprint.CerimonialPoint == UtilDTO.CERIMONIAL_POINT.INVESTIMENTO))
                        {
                            cerimonialPoint = "1";
                        }
                        foreach (var dev in contract.Collaborators)
                        {
                            employeeCount += dev.Presence;
                            extraHourUst  += Controle.CalcUstByExtraHour(category == UtilDTO.CATEGORY.DESPESA ? dev.ExtraHoursExpenses : dev.ExtraHourInvestment);
                        }
                        partialPoints = ((pointsPerTeamMember + Convert.ToDouble(cerimonialPoint)) * contract.Factor * employeeCount) + extraHourUst;
                        summaryTable.Rows.Add(missing);
                        summaryTable.Rows[line].Range.Font.Bold = 0;
                        summaryTable.Rows[line].Shading.BackgroundPatternColor = WdColor.wdColorWhite;
                        summaryTable.Rows[line].Cells[1].Range.Text            = sprint.Range.Name + "\n" + contract.Name;
                        summaryTable.Rows[line].Cells[2].Range.Text            = acceptedPoints.ToString();                   //A
                        summaryTable.Rows[line].Cells[3].Range.Text            = sprint.TeamSize.ToString(decimalFormat);     //B
                        summaryTable.Rows[line].Cells[4].Range.Text            = employeeCount.ToString(decimalFormat);       //C
                        summaryTable.Rows[line].Cells[5].Range.Text            = pointsPerTeamMember.ToString(decimalFormat); //D
                        summaryTable.Rows[line].Cells[6].Range.Text            = contract.Factor.ToString();                  //E
                        summaryTable.Rows[line].Cells[7].Range.Text            = cerimonialPoint;                             //F
                        summaryTable.Rows[line].Cells[8].Range.Text            = extraHourUst.ToString(decimalFormat);        //G
                        summaryTable.Rows[line].Cells[9].Range.Text            = partialPoints.ToString(decimalFormat);       //H

                        totalPoints += Math.Round(partialPoints, 3);
                        line++;
                    }
                }
            }

            SetSummaryTableTotal(ref summaryTable, columns, line, totalPoints, partner.UstValue, ref missing);
        }
Exemplo n.º 5
0
        public static int SetGenericTableHeader(ref Table table, List <string> headers, UtilDTO.CATEGORY category)
        {
            int line   = 1;
            int column = 1;

            //Adicionar tipo de investimento
            table.Rows.Add();
            table.Rows[line].Range.Font.Bold = 1;
            table.Rows[line].Shading.BackgroundPatternColor = WdColor.wdColorLightGreen;
            table.Cell(line, column).Merge(table.Cell(line, headers.Count));
            table.Cell(line, column).Range.Text = $"Orçamento: {category}";
            line++;

            //Adicionadno demais partes do cabeçalho
            table.Rows[line].Range.Font.Bold = 1;
            table.Rows[line].Shading.BackgroundPatternColor = WdColor.wdColorGray25;
            foreach (var header in headers)
            {
                table.Cell(line, column).Range.Text = header;
                column++;
            }
            line++;

            return(line);
        }