예제 #1
0
        private void manageDevisTable(GeneralObject obj, SumManager sumManager)
        {
            Table tab = this.final.Tables[2];

            Row templateToCopy = tab.Rows[1];

            foreach (Projet projet in obj.projets)
            {
                if (projet.Stories != null && projet.Stories.Count > 0 && projet.découpageStories["PR"].Count > 0)
                {
                    Row toAdd = tab.InsertRow(tab.RowCount - 2);
                    //project
                    toAdd.Cells[0].InsertParagraph(projet.Nom);
                    List bulletedList = null;
                    //stories
                    if (projet.découpageStories.Count > 0)
                    {
                        foreach (MasterStories story in projet.découpageStories["PR"])
                        {
                            if (bulletedList == null)
                            {
                                bulletedList = this.final.AddList(story.Description, 0, ListItemType.Bulleted, 1);
                            }
                            else
                            {
                                this.final.AddListItem(bulletedList, story.Description);
                            }
                        }
                        if (bulletedList != null)
                        {
                            toAdd.Cells[1].InsertList(bulletedList);
                            //Cout
                            FactuStoriesTabs total = (FactuStoriesTabs)sumManager.getProjectCost(projet.Nom, true);
                            toAdd.Cells[2].InsertParagraph(total.getPR().ToString("G29") + "€");
                        }
                    }
                }
                FactuStoriesTabs totalCost    = (FactuStoriesTabs)sumManager.getProjectCost(projet.Nom, true);
                string           totalCostStr = totalCost.getPR().ToString("G29");
                this.tableSubTotal += decimal.Parse(totalCostStr);
            }
            tab.Rows[tab.RowCount - 1].Cells[1].ReplaceText("[totalTable]", this.tableSubTotal.ToString());

            if (this.isFactu)
            {
                Table tabBonus      = this.final.Tables[3];
                Table tabUnfinished = this.final.Tables[4];
                Row   ToCopy        = tab.Rows[1];
                foreach (Projet insert in obj.projets)
                {
                    if (insert.découpageStories["B"] != null && insert.découpageStories["B"].Count > 0)
                    {
                        Row toAdd = tabBonus.InsertRow(tabBonus.RowCount - 2);
                        //project
                        toAdd.Cells[0].InsertParagraph(insert.Nom);
                        List bulletedList = null;
                        //stories
                        foreach (MasterStories story in insert.découpageStories["B"])
                        {
                            if (bulletedList == null)
                            {
                                bulletedList = this.final.AddList(story.Description, 0, ListItemType.Bulleted, 1);
                            }
                            else
                            {
                                this.final.AddListItem(bulletedList, story.Description);
                            }
                        }
                        toAdd.Cells[1].InsertList(bulletedList);
                        //Cout
                        FactuStoriesTabs total = (FactuStoriesTabs)sumManager.getProjectCost(insert.Nom, true);
                        toAdd.Cells[2].InsertParagraph(total.getB().ToString("G29") + "€");
                        string totalBstr = total.getB().ToString("G29");
                        this.tableSubTotalBonus += decimal.Parse(totalBstr);
                    }

                    if (insert.découpageStories["PNR"] != null && insert.découpageStories["PNR"].Count > 0)
                    {
                        Row toAdd = tabUnfinished.InsertRow(tabUnfinished.RowCount - 1);
                        //project
                        toAdd.Cells[0].InsertParagraph(insert.Nom);
                        List bulletedList = null;
                        //stories
                        foreach (MasterStories story in insert.découpageStories["PNR"])
                        {
                            if (bulletedList == null)
                            {
                                bulletedList = this.final.AddList(story.Description, 0, ListItemType.Bulleted, 1);
                            }
                            else
                            {
                                this.final.AddListItem(bulletedList, story.Description);
                            }
                        }
                        toAdd.Cells[1].InsertList(bulletedList);
                    }
                }
                tabBonus.Rows[tabBonus.RowCount - 1].Cells[1].ReplaceText("[totalTableBonus]", this.tableSubTotalBonus.ToString());
            }
        }