Exemplo n.º 1
0
        // priority
        private static List<int> BuildOrientationTableFixIssue9985(FoxitPDFGenerator pdfGen, Data.Model.Report report, ref float y,bool pIsEmptyReport, float rowHeight = 25, float x = 0)
        {
            List<int> IdOptionAttributeList = new List<int>();
            var languageDataPP = PageLanguageHelper.GetLanguageContent("User", "PDFReportPP");
            var languageDataPolicy = PageLanguageHelper.GetLanguageContent("User", "ClientPP_Policy");
            List<string> colsNames = new List<string>() { languageDataPP.GetContent("PdfReportPP_088"), languageDataPP.GetContent("PdfReportPP_089"), languageDataPP.GetContent("PdfReportPP_090") };
            List<float> colsWidth = new List<float>() { 60, 280, 160 };
            var optAttrs = GetOptionAttributesByDataType("priority");
            List<int> IdOptions = new HashSet<int>(optAttrs.Select(t => t.idOptionAttribute)).ToList();

            Dictionary<int, List<string>> data = new Dictionary<int, List<string>>();
            int row = 0;
            if (!pIsEmptyReport)
            {
                List<ReportOptionAttributeValue> dataPrior = new List<ReportOptionAttributeValue>();
                for (int k = 0; k < IdOptions.Count; k++)
                {
                    int idOptAttrVal = IdOptions[k];
                    List<ReportOptionAttributeValue> dataOrder =
                        report.ReportOptionAttributeValue.Where(roav => roav.idOptionAttribute == idOptAttrVal)
                            .OrderBy(roav => roav.idReportOptionAttributeValue)
                            .ToList();
                    if (!IdOptionAttributeList.Any(z => z == idOptAttrVal))
                    {
                        IdOptionAttributeList.Add(idOptAttrVal);
                    }
                    dataPrior.AddRange(dataOrder);

                }
                    if (dataPrior.Any())
                    {
                       
                        dataPrior.OrderBy(ord => ord.idReportOptionAttributeValue).ToList().ForEach(dp =>
                        {
                            var isAnyDataAnd = IsAnyDataAnd(dp, new string[] {"Object"/*, "Priority"*/});
                            bool isFromNk = false;
                            string ot = string.Empty;
                            if (!isAnyDataAnd)
                            {
                                var pt = GetStringValue(dp, "Priority");
                                int idOptionAttribute = 0;
                                Int32.TryParse(Convert.ToString(dp.idOptionAttribute),out idOptionAttribute);
                                var obj = ReportOptionBL.GetOptionAttributeById(idOptionAttribute);
                                if (obj != null)
                                {
                                    ot = languageDataPolicy.GetContent(obj.NameKey);
                                    isFromNk = true;
                                }
                                isAnyDataAnd = !string.IsNullOrEmpty(pt) && !string.IsNullOrEmpty(ot);
                            }
                            if (isAnyDataAnd)
                            {
                                var lst = new List<string>();
                                for (int c = 0; c < colsNames.Count; c++)
                                {
                                    switch (c)
                                    {
                                        case 0:
                                            string priority = GetStringValue(dp, "Priority");
                                            lst.Add(priority);
                                            break;

                                        case 1:
                                            string @object = !isFromNk ? GetStringValue(dp, "Object") : ot;
                                            lst.Add(@object);
                                            break;

                                        case 2:
                                            string yearImmediate = GetStringValue(dp, "YearImmediate");
                                            lst.Add(yearImmediate);
                                            break;
                                    }
                                }
                                row++;
                                data.Add(row, lst);
                            }
                        });
                    }
                
            }
            else
            {
                int maxRow = 3;
                for (int i = 0; i < maxRow; i++)
                {
                    var lst = new List<string>();
                    for (int c = 0; c < colsNames.Count; c++)
                    {
                        lst.Add(string.Empty);
                    }
                    row++;
                    data.Add(row, lst);
                }
            }


            pdfGen.AddTableWithAutomaticNewPage(colsNames, colsWidth, data, ref y, pIsEmptyReport, colsWidth.Sum(), (data.Count + 2) * (stdRowHeight + 3), x, (stdRowHeight - 1));
            return IdOptionAttributeList;
        }
Exemplo n.º 2
0
        private static void GenerateContratsEpargneTable1(FoxitPDFGenerator pdfGen, Data.Model.Report report, ref float y, bool pIsEmptyReport, float x = 0)
        {
            var languageDataPP = PageLanguageHelper.GetLanguageContent("User", "PDFReportPP");
            List<string> colsNames = new List<string>() { "", languageDataPP.GetContent("PdfReportPP_105"), languageDataPP.GetContent("PdfReportPP_106"), languageDataPP.GetContent("PdfReportPP_107") };
            List<string> rowsNames = new List<string>() { languageDataPP.GetContent("PdfReportPP_108"), languageDataPP.GetContent("PdfReportPP_109"), languageDataPP.GetContent("PdfReportPP_110"), languageDataPP.GetContent("PdfReportPP_111"), languageDataPP.GetContent("PdfReportPP_112"),
            languageDataPP.GetContent("PdfReportPP_113"),languageDataPP.GetContent("PdfReportPP_114")};
            List<int> lstIdOption = new List<int>() { 575, 576, 577, 578, 579, 580, 581 };
            List<float> colsWidth = new List<float>() { 200, 100, 100, 100 };
            List<ReportOptionAttributeValue> dataEngagements = new List<ReportOptionAttributeValue>();

            Dictionary<int, List<string>> data = new Dictionary<int, List<string>>();
            int nbLignes = 7;
            for (int i = 0; i < nbLignes; i++)
            {
                data.Add(i, new List<string>());
                data[i] = new List<string>();

                dataEngagements = report.ReportOptionAttributeValue.Where(roav => roav.idOptionAttribute == lstIdOption[i]).ToList();
                for (int j = 1; j <= colsNames.Count; j++)
                {
                    if (j == 1)
                    {
                        data[i].Add(rowsNames[i]);
                    }
                    else
                    {
                        if (dataEngagements.Count > 0)
                        {
                            switch (j)
                            {
                                case 2:
                                    data[i].Add(Convert.ToString(dataEngagements[0].CustomObjectValue.CurrentAmount));
                                    break;
                                case 3:
                                    data[i].Add(Convert.ToString(dataEngagements[0].CustomObjectValue.AnnualSavings));
                                    break;
                                case 4:
                                    data[i].Add(Convert.ToString(dataEngagements[0].CustomObjectValue.Company));
                                    break;
                            }
                        }
                        else
                        {
                            data[i].Add("");
                        }
                    }
                }
            }

            string hostCode = Upsilab.Business.Utility.SessionManager.GetHostCodeSession();
            if (Upsilab.Business.Utility.ConfigurationManager.ExtranetHostCode == "BE")
            {
                data.Remove(4);
                data.Remove(6);
                nbLignes = nbLignes - 2;
            }

            pdfGen.AddTableWithAutomaticNewPage(colsNames, colsWidth, data, ref y, pIsEmptyReport, colsWidth.Sum(), (data.Count + 2) * 10, true, true, x, 10);

        }
Exemplo n.º 3
0
        private static void GenerateEmptyValeursImmobilieresTableFixIssue9985(FoxitPDFGenerator pdfGen, ref float y, float rowHeight = 25, float x = 0, int nbLignes = 10)
        {
            var languageDataPP = PageLanguageHelper.GetLanguageContent("User", "PDFReportPP");
            List<string> colsNames = new List<string>() { languageDataPP.GetContent("PdfReportPP_066"), languageDataPP.GetContent("PdfReportPP_067"), languageDataPP.GetContent("PdfReportPP_068"), languageDataPP.GetContent("PdfReportPP_069"), languageDataPP.GetContent("PdfReportPP_085"), languageDataPP.GetContent("PdfReportPP_086"), languageDataPP.GetContent("PdfReportPP_087"), languageDataPP.GetContent("PdfReportPP_070"), languageDataPP.GetContent("PdfReportPP_079") };
            List<float> colsWidth = new List<float>() { 60, 60f, 50, 50, 65, 60, 60, 60f, 60 };
            Dictionary<int, List<string>> data = new Dictionary<int, List<string>>();

            for (int i = 0; i < nbLignes; i++)
            {
                data.Add(i, new List<string>());
                data[i] = new List<string>();

                for (int j = 1; j <= colsNames.Count; j++)
                {
                    data[i].Add(string.Empty);
                }
            }

            pdfGen.AddTableWithAutomaticNewPage(colsNames, colsWidth, data, ref y, true, colsWidth.Sum(), (data.Count + 1) * rowHeight, x, (rowHeight - 1));
        }
Exemplo n.º 4
0
        private static Double GenerateValeursImmobilieresTableFixIssue9985(FoxitPDFGenerator pdfGen, Data.Model.Report report, ref float y,bool pIsEmptyReport, float rowHeight = 25, float x = 0, Double sommefinale = 0)
        {
            var languageDataPP = PageLanguageHelper.GetLanguageContent("User", "PDFReportPP");
            List<string> colsNames = new List<string>() { languageDataPP.GetContent("PdfReportPP_066"), languageDataPP.GetContent("PdfReportPP_067"), languageDataPP.GetContent("PdfReportPP_068"), languageDataPP.GetContent("PdfReportPP_069"), languageDataPP.GetContent("PdfReportPP_mode_detention"), languageDataPP.GetContent("PdfReportPP_085"), languageDataPP.GetContent("PdfReportPP_086"), languageDataPP.GetContent("PdfReportPP_087"), languageDataPP.GetContent("PdfReportPP_070"), languageDataPP.GetContent("PdfReportPP_079") };
            List<float> colsWidth = new List<float>() { 60, 60f, 40, 50, 50, 50, 60, 50, 50, 60 };
            Dictionary<int, List<string>> data = new Dictionary<int, List<string>>();
            double sommeCurrentValue = 0, d;
            var optAttrs = GetOptionAttributesByDataType("securities");
            List<int> IdOptions = new HashSet<int>(optAttrs.Select(t => t.idOptionAttribute)).ToList();

            int row = 0;
            if (!pIsEmptyReport)
            {
                var idsUnit = new List<int>();
                List<ReportOptionAttributeValue> dataValeursMobilieres = new List<ReportOptionAttributeValue>();
                for (int k = 0; k < IdOptions.Count; k++)
                {
                    int idOptAttrVal = IdOptions[k];
                    List<ReportOptionAttributeValue> dataOrder =
                        report.ReportOptionAttributeValue.Where(roav => roav.idOptionAttribute == idOptAttrVal)
                            .OrderBy(roav => roav.idReportOptionAttributeValue)
                            .ToList();
                    dataValeursMobilieres.AddRange(dataOrder);
                }
                if (dataValeursMobilieres.Any())
                {
                    dataValeursMobilieres.OrderBy(ord => ord.idReportOptionAttributeValue).ToList().ForEach(dl =>
                    {
                        if (!idsUnit.Any(px => px == dl.idReportOptionAttributeValue) && IsAnyDataAnd(dl, new string[] {"Description"/*, "CurrentValue"*/}))
                        {
                            idsUnit.Add(dl.idReportOptionAttributeValue);
                            var lst = new List<string>();
                            for (int c = 0; c < colsNames.Count; c++)
                            {
                                switch (c)
                                {
                                    case 0:
                                        string description = GetStringValue(dl, "Description");
                                        lst.Add(description);
                                        break;
                                    case 1:
                                        string organisation = GetStringValue(dl, "Organization");
                                        lst.Add(organisation);
                                        break;
                                    case 2:
                                        string currentValue = GetStringValue(dl, "CurrentValue");
                                        lst.Add(currentValue);
                                        if (Double.TryParse(currentValue.Replace(".", ","), out d))
                                            sommeCurrentValue += d;
                                        break;
                                    case 3:
                                        string holder = GetStringValue(dl, "Holder");
                                        lst.Add(holder);
                                        break;
                                    case 4: // ModeDetention
                                        string modedetention = string.Empty;
                                        string idOpStr = GetStringValue(dl, "ModeDetention");
                                        int idOp = 0;
                                        Int32.TryParse(idOpStr, out idOp);
                                        var oa = GetOptionAttributeById(idOp);
                                        if (oa != null)
                                        {
                                            modedetention = languageDataPatrimoine.GetContent(oa.NameKey);
                                        }
                                        lst.Add(modedetention);
                                        break;
                                    case 5:
                                        string souscriptionDate = GetStringValue(dl, "SubscriptionDate");
                                        lst.Add(souscriptionDate);
                                        break;
                                    case 6:
                                        string annualRendement = GetStringValue(dl, "AnnualYield");
                                        lst.Add(annualRendement);
                                        break;
                                    case 7:
                                        string beneficiary = GetStringValue(dl, "Beneficiary");
                                        lst.Add(beneficiary);
                                        break;
                                    case 8:
                                        string source = GetStringValue(dl, "Source");
                                        lst.Add(source);
                                        break;
                                    case 9:
                                        string country = GetStringValue(dl, "Country");
                                        lst.Add(GetEnumValue(country, 10));
                                        break;
                                }
                            }
                            row++;
                            data.Add(row, lst);
                        }
                    });
                }
            }
            else
            {
                int maxRow = 3;
                for (int i = 0; i < maxRow; i++)
                {
                    var lst = new List<string>();
                    for (int c = 0; c < colsNames.Count; c++)
                    {
                        lst.Add(string.Empty);
                    }
                    row++;
                    data.Add(row, lst);
                }
            }

            //if (row > 0) // alwasy show total
            {
                var lst2 = new List<string>();
                for (int j = 1; j <= colsNames.Count; j++)
                {
                    switch (j)
                    {
                        case 2:
                            lst2.Add(LanguageContentBL.Translate("libelle_total"));
                            break;
                        case 3:
                            {
                                if(pIsEmptyReport)
                                    lst2.Add(string.Empty);
                                else if (sommefinale == 0)
                                    lst2.Add(sommeCurrentValue.ToString());
                                else
                                    lst2.Add((sommeCurrentValue + sommefinale).ToString());
                                break;
                            }
                        default:
                            lst2.Add(string.Empty);
                            break;
                    }
                }
                row++;
                data.Add(row, lst2);
            }

            pdfGen.AddTableWithAutomaticNewPage(colsNames, colsWidth, data, ref y, pIsEmptyReport, colsWidth.Sum(), (data.Count + 4) * (stdRowHeight + 3), x, (stdRowHeight - 1));

            return sommeCurrentValue;
        }
Exemplo n.º 5
0
        private static Double GenerateImmobilierDeJouissanceTableFixIssue9985(FoxitPDFGenerator pdfGen, Data.Model.Report report, ref float y, bool pIsEmptyReport,float rowHeight = 25, float x = 0, int debutLigne = 0, Double sommefinale = 0)
        {
            var languageDataPP = PageLanguageHelper.GetLanguageContent("User", "PDFReportPP");
            List<string> colsNames = new List<string>() { languageDataPP.GetContent("PdfReportPP_066"), languageDataPP.GetContent("PdfReportPP_069"), languageDataPP.GetContent("PdfReportPP_mode_detention"), languageDataPP.GetContent("PdfReportPP_080"), languageDataPP.GetContent("PdfReportPP_081"), languageDataPP.GetContent("PdfReportPP_082"), languageDataPP.GetContent("PdfReportPP_068"), languageDataPP.GetContent("PdfReportPP_070"), languageDataPP.GetContent("PdfReportPP_079_1") };
            List<float> colsWidth = new List<float>() { 60, 60, 50, 55, 65, 60, 60, 80, 60 };
            Dictionary<int, List<string>> data = new Dictionary<int, List<string>>();
            double somme = 0, d;
            //var optAttrs = GetOptionAttributesByDataType("patrimoineimmobilier");
            //List<int> IdOptions = new HashSet<int>(optAttrs.Select(t => t.idOptionAttribute)).ToList();
            List<int> IdOptions = new List<int>() { 204, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873 };
            int row = 0;
            if (!pIsEmptyReport)
            {
                var idsUnit = new List<int>();
                List<ReportOptionAttributeValue> dataImmobilierJouissance = new List<ReportOptionAttributeValue>();
                for (int k = 0; k < IdOptions.Count; k++)
                {
                    int idOptAttrVal = IdOptions[k];
                    List<ReportOptionAttributeValue> dataOrder =
                        report.ReportOptionAttributeValue.Where(roav => roav.idOptionAttribute == idOptAttrVal)
                            .OrderBy(roav => roav.idReportOptionAttributeValue)
                            .ToList();
                    dataImmobilierJouissance.AddRange(dataOrder);
                }

                if (dataImmobilierJouissance.Any())
                {
                    dataImmobilierJouissance.OrderBy(ord => ord.idReportOptionAttributeValue).ToList().ForEach(dl =>
                    {
                        if (!idsUnit.Any(px => px == dl.idReportOptionAttributeValue) && IsAnyDataAnd(dl, new string[] {"Description"/*, "CurrentValue"*/}))
                        {
                            idsUnit.Add(dl.idReportOptionAttributeValue);
                            var lst = new List<string>();
                            for (int c = 0; c < colsNames.Count; c++)
                            {
                                switch (c)
                                {
                                    case 0:
                                        lst.Add(GetStringValue(dl, "Description"));
                                        break;
                                    case 1:
                                        lst.Add(GetStringValue(dl, "Organization"));
                                        break;
                                    case 2: // ModeDetention
                                        string modedetention = string.Empty;
                                        string idOpStr = GetStringValue(dl, "ModeDetention");
                                        int idOp = 0;
                                        Int32.TryParse(idOpStr, out idOp);
                                        var oa = GetOptionAttributeById(idOp);
                                        if (oa != null)
                                        {
                                            modedetention = languageDataPatrimoine.GetContent(oa.NameKey);
                                        }
                                        lst.Add(modedetention);
                                        break;
                                    case 3:
                                        lst.Add(GetEnumValue(GetStringValue(dl, "Ownership"), 4));
                                        break;
                                    case 4:
                                        lst.Add(GetStringValue(dl, "AcquisitionDate"));
                                        break;
                                    case 5:
                                        lst.Add(GetStringValue(dl, "AcquisitionValue"));
                                        break;
                                    case 6:
                                        string currentValue = GetStringValue(dl, "CurrentValue");
                                        lst.Add(currentValue);
                                        if (Double.TryParse(currentValue.Replace(".", ","), out d))
                                            somme += d;
                                        break;
                                    case 7:
                                        lst.Add(GetStringValue(dl, "Source"));
                                        break;
                                    case 8:
                                        lst.Add(GetEnumValue(GetStringValue(dl, "Country"), 10));
                                        break;
                                }
                            }
                            row++;
                            data.Add(row, lst);
                        }
                    });


                }
            }
            else
            {
                int maxRow = 3;
                for (int i = 0; i < maxRow; i++)
                {
                    var lst = new List<string>();
                    for (int c = 0; c < colsNames.Count; c++)
                    {
                        lst.Add(string.Empty);
                    }
                    row++;
                    data.Add(row, lst);
                }
            }

            //if (row > 0) // always show total
            {
                var lst2 = new List<string>();
                for (int j = 1; j <= colsNames.Count; j++)
                {
                    switch (j)
                    {
                        case 5:
                            lst2.Add(LanguageContentBL.Translate("libelle_total"));
                            break;
                        case 6:
                        {
                            if (pIsEmptyReport)
                                lst2.Add(string.Empty);
                            else if (sommefinale == 0)
                                lst2.Add(somme.ToString());
                            else
                                lst2.Add((somme + sommefinale).ToString());
                            break;
                        }
                        default:
                            lst2.Add(string.Empty);
                            break;
                    }
                }
                row++;
                data.Add(row, lst2);
            }
            pdfGen.AddTableWithAutomaticNewPage(colsNames, colsWidth, data, ref y, pIsEmptyReport, colsWidth.Sum(), (data.Count + 3) * (stdRowHeight + 3), x, (stdRowHeight - 1));

            return somme;
        }
Exemplo n.º 6
0
        private static void GeneratePersonneAChargeEnfantTable(FoxitPDFGenerator pdfGen, Data.Model.Report report,
            ref float y, bool pIsEmptyReport = false, float x = 0)
        {
            var customDatalanguageData = PageLanguageHelper.GetLanguageContent("User", "Client_DataType");

            List<ReportOptionAttributeValue> enfants =
                report.ReportOptionAttributeValue.Where(roav => roav.idOptionAttribute == 192)
                    .OrderBy(roav => roav.idReportOptionAttributeValue)
                    .ToList();

            Dictionary<int, List<string>> data = new Dictionary<int, List<string>>();

            List<string> colNames = new List<string>() { customDatalanguageData.GetContent("Client_DataType_006"), customDatalanguageData.GetContent("Client_DataType_007"), customDatalanguageData.GetContent("Client_DataType_008"), customDatalanguageData.GetContent("Client_DataType_009") };
            

            if (!pIsEmptyReport)
            {
                int row = 0;
                enfants.ToList().ForEach(eft =>
                {
                    if (IsMoreThanOneAnyData(eft, new string[] { "Name", "FirstName" /*, "DateOfBirth"*/ }))
                    {
                        var lst = new List<string>();
                        for (int c = 0; c < colNames.Count; c++)
                        {

                            switch (c)
                            {
                                case 0: //Nom
                                    string nom = GetStringValue(eft, "Name");
                                    lst.Add(nom);
                                    break;
                                case 1: // Prenom
                                    string prenom = GetStringValue(eft, "FirstName");
                                    lst.Add(prenom);
                                    break;
                                case 2: // date de naissance
                                    string dob = GetStringValue(eft, "DateOfBirth");
                                    lst.Add(dob);
                                    break;
                                case 3: // tax
                                    string tax = GetEnumValue(Convert.ToString(eft.CustomObjectValue.IsTaxContributor),1);
                                    lst.Add(tax);
                                    break;
                            }

                        }
                        data.Add(row, lst);
                        row++;
                    }
                });
            }
            else
            {
                int maxRow = 3;
                for (int i = 0; i < maxRow; i++)
                {
                    var lst = new List<string>();
                    for (int c = 0; c < colNames.Count; c++)
                    {
                        lst.Add(string.Empty);
                    }
                    data.Add(i, lst);
                }
            }

            List<float> colsWidth = new List<float>() { 130, 130, 70, 170 };

            pdfGen.AddTableWithAutomaticNewPage(colNames, colsWidth, data, ref y, pIsEmptyReport, colsWidth.Sum(), (data.Count + 1) * stdRowHeight, true, false, x, (stdRowHeight-1));
        }
Exemplo n.º 7
0
        // driver
        private static int GenerateTablePatrimoineDiversFixIssue9985(FoxitPDFGenerator pdfGen, Data.Model.Report report, ref float y,bool pIsEmptyReport, float rowHeight, float x = 0,float defaultPagesize = 0)
        {
            PageLanguageHelper globalLanguageData = PageLanguageHelper.GetLanguageContent("User", "ClientPP_Revenue");
            var languageDataPP = PageLanguageHelper.GetLanguageContent("User", "PDFReportPP");
            List<string> colsNames = new List<string>() { languageDataPP.GetContent("PdfReportPP_072"), languageDataPP.GetContent("PdfReportPP_068"), languageDataPP.GetContent("PdfReportPP_069"), languageDataPP.GetContent("PdfReportPP_070"), languageDataPP.GetContent("PdfReportPP_073"), languageDataPP.GetContent("PdfReportPP_074"), languageDataPP.GetContent("PdfReportPP_075"), languageDataPP.GetContent("PdfReportPP_076") };
            List<float> colsWidth = new List<float>() { 80, 50, 50, 60, 60, 60, 80, 60 };
            var optAttrs = GetOptionAttributesByDataType("driver");
            List<int> lstIdOption = new List<int>();
            if (optAttrs != null && optAttrs.Any())
            {
                lstIdOption = new HashSet<int>(optAttrs.Select(t => t.idOptionAttribute)).ToList();
            }
            //List<int> lstIdOption = new List<int>() { 207, 208, 209, 210, 211, 212, 213, 214 };
            string[] rowTitle = new string[] { languageDataPP.GetContent("PdfReportPP_453"), languageDataPP.GetContent("PdfReportPP_454"), languageDataPP.GetContent("PdfReportPP_455"), languageDataPP.GetContent("PdfReportPP_456"), languageDataPP.GetContent("PdfReportPP_457"), languageDataPP.GetContent("PdfReportPP_458"), languageDataPP.GetContent("PdfReportPP_459"), languageDataPP.GetContent("PdfReportPP_460") };
            Dictionary<int, List<string>> data = new Dictionary<int, List<string>>();
            //List<ReportOptionAttributeValue> dataDivers = new List<ReportOptionAttributeValue>();

            int cpt = 0;
            Double somme = 0, d;

            if (!pIsEmptyReport)
            {
                var idsUnit = new List<int>();
                List<ReportOptionAttributeValue> dataDivers = new List<ReportOptionAttributeValue>();
                for (int row = 0; row < lstIdOption.Count; row++)
                {
                    List<ReportOptionAttributeValue> dataOrder =
                        report.ReportOptionAttributeValue.Where(roav => roav.idOptionAttribute == lstIdOption[row]).OrderBy(roav => roav.idReportOptionAttributeValue)
                            .ToList();
                    dataDivers.AddRange(dataOrder);
                }
                if (dataDivers.Any())
                {

                    dataDivers.OrderBy(ord => ord.idReportOptionAttributeValue).ToList().ForEach(dd =>
                    {
                        string designation = string.Empty;
                        bool isOldCriteria = true;
                        bool isAnydataInt = IsAnyDataAnd(dd, new string[] {/*"CurrentValue", "Active"*/}); // old criteria
                        if (!isAnydataInt)
                        {
                            isAnydataInt = IsAnyDataAnd(dd, new string[] {/*"CurrentValue",*/ "Designation"});
                                // new criteria
                            isOldCriteria = false;
                        }
                        if (!isAnydataInt)
                        {
                            int idOptionAttribute = 0;
                            Int32.TryParse(Convert.ToString(dd.idOptionAttribute),out idOptionAttribute);
                                var obj = ReportOptionBL.GetOptionAttributeById(idOptionAttribute);
                                if (obj != null)
                                {
                                    designation = globalLanguageData.GetContent(obj.NameKey);
                                }
                            isAnydataInt = !string.IsNullOrEmpty(designation);
                            isOldCriteria = true;
                        }

                        if (!idsUnit.Any(px => px == dd.idReportOptionAttributeValue) && isAnydataInt)
                        {
                            idsUnit.Add(dd.idReportOptionAttributeValue);
                            var lst = new List<string>();
                            for (int j = 1; j <= colsNames.Count; j++)
                            {
                                switch (j)
                                {
                                    case 1:
                                        string firstCol = string.Empty;
                                        if (isOldCriteria)
                                        {
                                            firstCol = designation;
                                        }
                                        else
                                        {
                                            firstCol = GetStringValue(dd, "Designation");
                                        }
                                        lst.Add(firstCol);
                                        break;
                                    case 2:
                                        string currentValue = GetStringValue(dd, "CurrentValue");
                                        lst.Add(currentValue);
                                        if (double.TryParse(currentValue.Replace(".", ","), out d))
                                            somme += d;
                                        break;
                                    case 3:
                                        lst.Add(GetStringValue(dd, "Holder"));
                                        break;
                                    case 4:
                                        lst.Add(GetStringValue(dd, "Source"));
                                        break;
                                    case 5:
                                        lst.Add(GetStringValue(dd, "Details"));
                                        break;
                                    case 6:
                                        lst.Add(GetStringValue(dd, "Description"));
                                        break;
                                    case 7:
                                        string generateIncome = GetStringValue(dd, "GenerateIncome");
                                        if (!string.IsNullOrEmpty(generateIncome))
                                        {
                                            if (generateIncome == "1")
                                                generateIncome = LanguageContentBL.Translate("Report_Symbol_Yes");
                                            else if (generateIncome == "2")
                                                generateIncome = LanguageContentBL.Translate("Report_Symbol_No");
                                        }
                                        lst.Add(generateIncome);
                                        break;
                                    case 8:
                                        lst.Add(GetEnumValue(GetStringValue(dd, "Country"), 10));
                                        break;
                                }
                            }
                            cpt++;
                            data.Add(cpt, lst);
                        }
                    });
                }
            }
            else
            {
                int maxRow = 3;
                for (int i = 0; i < maxRow; i++)
                {
                    var lst = new List<string>();
                    for (int c = 0; c < colsNames.Count; c++)
                    {
                        lst.Add(string.Empty);
                    }
                    cpt++;
                    data.Add(cpt, lst);
                }
            }

            if (cpt > 0)
            {
                var lst2 = new List<string>();
                for (int j = 1; j <= colsNames.Count; j++)
                {
                    switch (j)
                    {
                        case 1:
                            lst2.Add(LanguageContentBL.Translate("libelle_total"));
                            break;
                        case 2:
                            if (pIsEmptyReport)
                                lst2.Add(string.Empty);
                            else
                                lst2.Add(somme.ToString());
                            break;
                        default:
                            lst2.Add(string.Empty);
                            break;
                    }
                }
                cpt++;
                data.Add(cpt, lst2);
            }
            pdfGen.AddTableWithAutomaticNewPage(colsNames, colsWidth, data, ref y, pIsEmptyReport, colsWidth.Sum(), (data.Count + 7) * (stdRowHeight + 3), x, (stdRowHeight - 1), true, false, defaultPagesize);
            return (cpt - 1);
        }
Exemplo n.º 8
0
        // patrimoineprofessionnel
        private static Double GeneratePatrimoineProfessionnelTableFixIssue9985(FoxitPDFGenerator pdfGen, Data.Model.Report report, ref float y,bool pIsEmptyReport, float rowHeight = 25, float x = 0, int debutLigne = 0, Double sommefinale = 0)
        {
            var languageDataPP = PageLanguageHelper.GetLanguageContent("User", "PDFReportPP");
            List<string> colsNames = new List<string>() { languageDataPP.GetContent("PdfReportPP_066"), languageDataPP.GetContent("PdfReportPP_069"), languageDataPP.GetContent("PdfReportPP_077"), languageDataPP.GetContent("PdfReportPP_078"), languageDataPP.GetContent("PdfReportPP_070"), languageDataPP.GetContent("PdfReportPP_079_1") };
            List<float> colsWidth = new List<float>() { 80, 80, 80, 100, 80, 80 };
            var optAttrs = GetOptionAttributesByDataType("patrimoineprofessionnel");
            List<int> IdOptions = new HashSet<int>(optAttrs.Select(t => t.idOptionAttribute)).ToList();

            Dictionary<int, List<string>> data = new Dictionary<int, List<string>>();

            double somme = 0, d;

            int row = 0;
            if (!pIsEmptyReport)
            {
                var idsUnit = new List<int>();
                List<ReportOptionAttributeValue> dataImmobilierProfessionnel = new List<ReportOptionAttributeValue>();
                for (int k = 0; k < IdOptions.Count; k++)
                {
                    int idOptAttrVal = IdOptions[k];
                    List<ReportOptionAttributeValue> dataOrder = report.ReportOptionAttributeValue.Where(roav => roav.idOptionAttribute == idOptAttrVal).OrderBy(roav => roav.idReportOptionAttributeValue).ToList();
                    dataImmobilierProfessionnel.AddRange(dataOrder);
                }
                if (dataImmobilierProfessionnel.Any())
                {
                    dataImmobilierProfessionnel.OrderBy(ord => ord.idReportOptionAttributeValue).ToList().ForEach(dl =>
                    {
                        if (!idsUnit.Any(zx => zx == dl.idReportOptionAttributeValue) && IsAnyDataAnd(dl, new string[] { "Description"/*, "OwnedCapital"*/ }))
                        {
                            idsUnit.Add(dl.idReportOptionAttributeValue);
                            var lst = new List<string>();
                            for (int c = 1; c <= colsNames.Count; c++)
                            {
                                switch (c)
                                {
                                    case 1:
                                        lst.Add(GetStringValue(dl, "Description"));
                                        break;
                                    case 2:
                                        lst.Add(GetStringValue(dl, "Holder"));
                                        break;
                                    case 3:
                                        string ownedCapital = GetStringValue(dl, "OwnedCapital");
                                        lst.Add(ownedCapital);
                                        if (Double.TryParse(ownedCapital.Replace(".", ","), out d))
                                            somme += d;
                                        break;
                                    case 4:
                                        lst.Add(GetStringValue(dl, "Details"));
                                        break;
                                    case 5:
                                        lst.Add(GetStringValue(dl, "Source"));
                                        break;
                                    case 6:
                                        lst.Add(GetEnumValue(GetStringValue(dl, "Country"), 10));
                                        break;
                                }
                            }
                            row++;
                            data.Add(row, lst);
                        }
                    });
                } 
            }
            else
            {
                int maxRow = 3;
                for (int i = 0; i < maxRow; i++)
                {
                    var lst = new List<string>();
                    for (int c = 0; c < colsNames.Count; c++)
                    {
                        lst.Add(string.Empty);
                    }
                    row++;
                    data.Add(row, lst);
                }
            }

           // if (row > 0) // always show total
            {
                var lst2 = new List<string>();
                for (int j = 1; j <= colsNames.Count; j++)
                {
                    switch (j)
                    {
                        case 2:
                            lst2.Add(LanguageContentBL.Translate("libelle_total"));
                            break;
                        case 3:
                            {
                                if (pIsEmptyReport)
                                {
                                    lst2.Add(string.Empty);
                                }
                                else if (sommefinale == 0)
                                    lst2.Add(somme.ToString());
                                else
                                    lst2.Add((somme + sommefinale).ToString());
                                break;
                            }
                        default:
                            lst2.Add(string.Empty);
                            break;
                    }
                }
                row++;
                data.Add(row, lst2);
            }

            pdfGen.AddTableWithAutomaticNewPage(colsNames, colsWidth, data, ref y, pIsEmptyReport, colsWidth.Sum(), (data.Count + 3) * (stdRowHeight + 3), x, (stdRowHeight - 1));

            return somme;
        }
Exemplo n.º 9
0
        // "revenuebreakdown"
        private static void GenerateDetailRevenuTableFixIssue9985(FoxitPDFGenerator pdfGen, Data.Model.Report report, ref int nbLigne, ref float y, bool pIsEmptyReport,float x = 0)
        {
            const string key = "revenupatrimoine";
            int nb = 0;

            Dictionary<int, List<string>> data = new Dictionary<int, List<string>>();
            PageLanguageHelper globalLanguageData = PageLanguageHelper.GetLanguageContent("User", "ClientPP_Revenue");
            var languageDataPP = PageLanguageHelper.GetLanguageContent("User", "PDFReportPP");
            List<string> colsNames = new List<string>() { languageDataPP.GetContent("PdfReportPP_047"), languageDataPP.GetContent("PdfReportPP_048"), languageDataPP.GetContent("PdfReportPP_050"), languageDataPP.GetContent("PdfReportPP_051"), languageDataPP.GetContent("PdfReportPP_052") };// languageDataPP.GetContent("PdfReportPP_049"),
            List<float> colsWidth = new List<float>() { 150, 70, 70, 140, 80 };
            var optAttrs = GetOptionAttributesByDataType("RevenueBreakdown");
            List<int> lstIdOption = new List<int>();
            if (optAttrs != null && optAttrs.Any())
            {
                lstIdOption = new HashSet<int>(optAttrs.Select(t => t.idOptionAttribute)).ToList();
            }
            //List<int> lstIdOption = new List<int>() { 194, 195, 774, 196, 197, 198, 199 };
            string[] firstCols = new string[]
            {
                languageDataPP.GetContent("PdfReportPP_053"),languageDataPP.GetContent("PdfReportPP_054"),languageDataPP.GetContent("PdfReportPP_RevenusFonciers"),
                languageDataPP.GetContent("PdfReportPP_055"),languageDataPP.GetContent("PdfReportPP_056"),languageDataPP.GetContent("PdfReportPP_057"),languageDataPP.GetContent("PdfReportPP_058")
            };

            var languageDataRevenu = Upsilab.Business.Utility.PageLanguageHelper.GetLanguageContent("User", "ClientPP_Revenue");
            //List<ReportOptionAttributeValue> dataRevenusDetails = new List<ReportOptionAttributeValue>();
            int nbLignes = lstIdOption.Count + 1;
            double somme = 0, d;

            bool isAnydata = false;

            if (!pIsEmptyReport)
            {
                List<ReportOptionAttributeValue> dataRevenusDetails = new List<ReportOptionAttributeValue>();
                for (int k = 0; k < lstIdOption.Count; k++)
                {
                    int idOptAttrVal = lstIdOption[k];
                    List<ReportOptionAttributeValue> dataOrder =
                            report.ReportOptionAttributeValue.Where(roav => roav.idOptionAttribute == idOptAttrVal).OrderBy(roav => roav.idReportOptionAttributeValue)
                                .ToList();
                    dataRevenusDetails.AddRange(dataOrder);
                }
                var idsUnit = new List<int>();
                    var lst = new List<string>();
                        if (dataRevenusDetails != null && dataRevenusDetails.Any())
                        {
                            int cx = 0;
                            dataRevenusDetails.OrderBy(ord => ord.idReportOptionAttributeValue).ToList().ForEach(dt =>
                            {
                                if (IS_DEBUG && _listDebug.Any(qx => qx == key)) Upsilab.Business.Log.Log.AppendException(new Exception(string.Format(trace, "begin GenerateDetailRevenuTableFixIssue9985", DateTime.Now.ToString("dd/MM/yyy HH:mm:ss"))));
                                lst = new List<string>();
                                bool isOldCriteria = true;
                                bool isAnydataInt = IsAnyDataAnd(dt, new string[] {/*"Amount", */"SourceDestination" });
                                    // old criteria
                                if (!isAnydataInt)
                                {
                                    isAnydataInt = IsAnyDataAnd(dt, new string[] {/*"Amount", */"Designation"});
                                    if (!isAnydataInt && dt.CustomObjectValue!=null)
                                    {
                                        //var amt = dt.CustomObjectValue.Amount ?? string.Empty;
                                        var dgt = dt.CustomObjectValue.Designation ?? string.Empty;
                                        //isAnydataInt = !string.IsNullOrEmpty(amt) && !string.IsNullOrEmpty(dgt);
                                        isAnydataInt = !string.IsNullOrEmpty(dgt);
                                    }
                                    // new criteria
                                    isOldCriteria = false;
                                }

                                // FOR DEBUG
                                if (IS_DEBUG && _listDebug.Any(qx => qx == key))
                                {
                                    const string tr = "dt not null : {0} , isAnydataInt : {1} , idReportOptionAttributeValue : {2}";
                                    Log.Log.AppendException(new Exception(string.Format(tr, (dt != null).ToString(), isAnydataInt.ToString(), (dt != null ? dt.idReportOptionAttributeValue : -1))));
                                }

                                int idOptionAttribute = 0;
                                string designation = string.Empty;
                                if (!isAnydataInt)
                                {
                                    if (IS_DEBUG && _listDebug.Any(qx => qx == key)) Log.Log.AppendException(new Exception(string.Format("idOptionAttribute : {0}", dt.idOptionAttribute)));
                                    Int32.TryParse(Convert.ToString(dt.idOptionAttribute),out idOptionAttribute);
                                    var obj = ReportOptionBL.GetOptionAttributeById(idOptionAttribute);
                                    if (obj != null)
                                    {
                                        designation = languageDataRevenu.GetContent(obj.NameKey);
                                    }
                                    isAnydataInt = !string.IsNullOrEmpty(designation) && !string.IsNullOrEmpty(GetStringValue(dt, "Amount"));
                                    isOldCriteria = true;
                                }

                                if (!idsUnit.Any(px => px == dt.idReportOptionAttributeValue) && isAnydataInt)
                                {
                                    idsUnit.Add(dt.idReportOptionAttributeValue);
                                    if (IS_DEBUG && _listDebug.Any(qx => qx == key))
                                    {
                                        var sb1 = string.Format("dt!=null --> {0}", (dt != null).ToString());
                                        Upsilab.Business.Log.Log.AppendException(new Exception(sb1));
                                        if (dt != null)
                                        {
                                            sb1 = string.Format("dt.CustomObjectValue!=null --> {0}", (dt.CustomObjectValue).ToString());
                                            Upsilab.Business.Log.Log.AppendException(new Exception(sb1));
                                            if (dt.CustomObjectValue!=null)
                                            {
                                                var sb = new StringBuilder();
                                                sb = sb.Append(string.Format("dt.CustomObjectValue!=null --> {0}",(dt.CustomObjectValue).ToString()));
                                                sb = sb.Append(string.Format(", Designation : {0}", dt.CustomObjectValue.Designation ?? "null"));
                                                sb = sb.Append(string.Format(", designation : {0}", !string.IsNullOrEmpty(designation) ? designation : "vide"));
                                                sb = sb.Append(string.Format(", Amount : {0}", dt.CustomObjectValue.Amount ?? "null"));
                                                sb = sb.Append(string.Format(", Frequency : {0}",dt.CustomObjectValue.Frequency ?? "null"));
                                                sb = sb.Append(string.Format(", Details : {0}",dt.CustomObjectValue.Details  ?? "null"));
                                                string Dates = GetStringValue(dt, "Dates");
                                                sb = sb.Append(string.Format(", Dates : {0}", Dates));
                                                Upsilab.Business.Log.Log.AppendException(new Exception(sb.ToString())); 
                                            }
                                        }
                                    }
                                    isAnydata = true;
                                    for (int c = 0; c < colsNames.Count; c++)
                                    {
                                        if (c == 0)
                                        {
                                            string firstCol = string.Empty;
                                            if (isOldCriteria)
                                            {
                                                firstCol = designation;
                                            }
                                            else
                                            {
                                                firstCol = Convert.ToString(dt.CustomObjectValue.Designation);
                                            }
                                            lst.Add(firstCol);
                                        }
                                        else
                                        {
                                            switch (c)
                                            {
                                                case 1:
                                                    var at = dt.CustomObjectValue.Amount ?? string.Empty;
                                                    string Amount = Convert.ToString(at);
                                                    lst.Add(Amount);
                                                    if (double.TryParse(Amount.Replace(".", ","), out d))
                                                        somme += d;
                                                    break;
                                                case 2:
                                                    var fq = dt.CustomObjectValue.Frequency ?? string.Empty;
                                                    lst.Add(GetEnumValue(Convert.ToString(fq), 3));
                                                    break;
                                                case 3:
                                                    var dl = dt.CustomObjectValue.Details ?? string.Empty;
                                                    string Details = Convert.ToString(dl);
                                                    lst.Add(Details);
                                                    break;
                                                case 4:
                                                    string Dates = GetStringValue(dt, "Dates");
                                                    lst.Add(Dates);
                                                    break;
                                            }
                                        }
                                    }
                                    nb++;
                                    data.Add(nb, lst);
                                }
                                cx++;
                            });
                        }

                        if (isAnydata)
                        {
                            lst = new List<string>();
                            for (int c = 0; c < colsNames.Count; c++)
                            {
                                switch (c)
                                {
                                    case 0:
                                        lst.Add(LanguageContentBL.Translate("libelle_total"));
                                        break;
                                    case 1:
                                        if (pIsEmptyReport)
                                            lst.Add(string.Empty);
                                        else
                                            lst.Add(somme.ToString());
                                        break;
                                    default:
                                        lst.Add(string.Empty);
                                        break;
                                }
                            }

                            nb++;
                            data.Add(nb, lst);
                        }
            }
            else
            {
                int maxRow = 3;
                int row = 0;
                for (int i = 0; i < maxRow; i++)
                {
                    var lst = new List<string>();
                    for (int c = 0; c < colsNames.Count; c++)
                    {
                        lst.Add(string.Empty);
                    }
                    row++;
                    data.Add(row, lst);
                }

                row++;
                var lst2 = new List<string>();
                for (int c = 0; c < colsNames.Count; c++)
                {
                    switch (c)
                    {
                        case 0:
                            lst2.Add(LanguageContentBL.Translate("libelle_total"));
                            break;
                        default:
                            lst2.Add(string.Empty);
                            break;
                    }
                }
                data.Add(row, lst2);
            }

            nbLigne = nb;

            // pdfGen.AddTable(colsNames, colsWidth, data, y, colsWidth.Sum(), (nbLignes + 5) * 24, x, 24);
            float rowHeight = stdRowHeight;
            if (IS_DEBUG) Upsilab.Business.Log.Log.AppendException(new Exception(string.Format(trace, "end GenerateDetailRevenuTableFixIssue9985", DateTime.Now.ToString("dd/MM/yyy HH:mm:ss"))));
            pdfGen.AddTableWithAutomaticNewPage(colsNames, colsWidth, data, ref y, pIsEmptyReport, colsWidth.Sum(), (data.Count + 1) * rowHeight, true, false, x, (rowHeight - 1));
        }
Exemplo n.º 10
0
        // patrimoinefinancier
        private static Double GenerateLiquiditesTableFixIssue9985(FoxitPDFGenerator pdfGen, Data.Model.Report report, ref float y,bool pIsEmptyReport, float rowHeight = 25, float x = 0, int debutLigne = 0, Double sommefinale = 0)
        {

            var languageDataPP = PageLanguageHelper.GetLanguageContent("User", "PDFReportPP");
            List<string> colsNames = new List<string>() { languageDataPP.GetContent("PdfReportPP_066"), languageDataPP.GetContent("PdfReportPP_067"), languageDataPP.GetContent("PdfReportPP_068"), languageDataPP.GetContent("PdfReportPP_069"), languageDataPP.GetContent("PdfReportPP_mode_detention"), languageDataPP.GetContent("PdfReportPP_070"), languageDataPP.GetContent("PdfReportPP_071") };
            List<float> colsWidth = new List<float>() { 90, 75, 50, 75, 75, 75, 85 };
            var optAttrs = GetOptionAttributesByDataType("patrimoinefinancier");
            List<int> IdOptions = new HashSet<int>(optAttrs.Select(t => t.idOptionAttribute)).ToList();

            int cpt = 0;
            Double somme = 0, d;
            Dictionary<int, List<string>> data = new Dictionary<int, List<string>>();

            if (!pIsEmptyReport)
            {
                var idsUnit = new List<int>();
                List<ReportOptionAttributeValue> dataLiquidites = new List<ReportOptionAttributeValue>();
                for (int k = 0; k < IdOptions.Count; k++)
                {
                    int idOptAttrVal = IdOptions[k];
                    List<ReportOptionAttributeValue> dataOrder =
                        report.ReportOptionAttributeValue.Where(roav => roav.idOptionAttribute == idOptAttrVal)
                            .OrderBy(roav => roav.idReportOptionAttributeValue)
                            .ToList();
                    dataLiquidites.AddRange(dataOrder);
                }

                if (dataLiquidites.Any())
                {
                    //int nbLignes = debutLigne == 0 ? 10 : 21;
                    //  int nbLignes = 21;

                    int nbLigneAafficher = 0;
                    // parcours des lignes

                    int i = 0;

                    dataLiquidites.OrderBy(ord => ord.idReportOptionAttributeValue).ToList().ForEach(dl =>
                    {
                        if (!idsUnit.Any(px => px == dl.idReportOptionAttributeValue) && IsAnyDataAnd(dl, new string[] {"Description"/*, "CurrentValue"*/}))
                        {
                            idsUnit.Add(dl.idReportOptionAttributeValue);
                            var lst = new List<string>();
                            for (int c = 0; c < colsNames.Count; c++)
                            {
                                switch (c)
                                {
                                    case 0: // description
                                        string description = GetStringValue(dl, "Description");
                                        lst.Add(description);
                                        break;

                                    case 1: // organisation
                                        string organisation = GetStringValue(dl, "Organization");
                                        lst.Add(organisation);
                                        break;

                                    case 2: // currentvalue
                                        string currentvalue = GetStringValue(dl, "CurrentValue");
                                        lst.Add(currentvalue);
                                        if (Double.TryParse(currentvalue.Replace(".", ","), out d))
                                            somme += d;
                                        break;

                                    case 3: // holder
                                        string holder = GetStringValue(dl, "Holder");
                                        lst.Add(holder);
                                        break;

                                    case 4: // ModeDetention
                                        string modedetention = string.Empty;
                                        string idOpStr = GetStringValue(dl, "ModeDetention");
                                        int idOp = 0;
                                        Int32.TryParse(idOpStr, out idOp);
                                        var oa = GetOptionAttributeById(idOp);
                                        if (oa != null)
                                        {
                                            modedetention = languageDataPatrimoine.GetContent(oa.NameKey);
                                        }
                                        lst.Add(modedetention);
                                        break;

                                    case 5: // source
                                        string source = GetStringValue(dl, "Source");
                                        lst.Add(source);
                                        break;

                                    case 6: // country
                                        string country = GetEnumValue(GetStringValue(dl, "Country"), 10);
                                        lst.Add(country);
                                        break;
                                }
                            }
                            cpt++;
                            data.Add(cpt, lst);
                        }
                    });
                }
            }
            else
            {
                int maxRow = 3;
                for (int i = 0; i < maxRow; i++)
                {
                    var lst = new List<string>();
                    for (int c = 0; c < colsNames.Count; c++)
                    {
                        lst.Add(string.Empty);
                    }
                    cpt++;
                    data.Add(cpt, lst);
                }
            }



            var lstTotal = new List<string>();

            //if (cpt > 0) -- > alwasy show total
            {
                for (int j = 1; j <= colsNames.Count; j++)
                {
                    switch (j)
                    {
                        case 2:
                            lstTotal.Add(LanguageContentBL.Translate("libelle_total"));
                            break;
                        case 3:
                            {
                                if(pIsEmptyReport)
                                    lstTotal.Add(string.Empty);
                                else if (sommefinale == 0)
                                    lstTotal.Add(somme.ToString());
                                else
                                    lstTotal.Add((somme + sommefinale).ToString());
                                break;
                            }
                        default:
                            lstTotal.Add(string.Empty);
                            break;
                    }
                }
                cpt++;
                data.Add(cpt, lstTotal);
            }

            pdfGen.AddTableWithAutomaticNewPage(colsNames, colsWidth, data, ref y, pIsEmptyReport, colsWidth.Sum(), (data.Count + 1) * stdRowHeight, x, (stdRowHeight - 1));

            return somme;
        }
Exemplo n.º 11
0
        private static void GenerateProjetInvestissementTableFixIssue9985(FoxitPDFGenerator pdfGen, Data.Model.Report report, ref float y, bool pIsEmptyReport,float rowHeight = 25, float x = 0)
        {
            const string key = "projetinvestissement";
            var languageDataPP = PageLanguageHelper.GetLanguageContent("User", "PDFReportPP");
            List<string> colsNames = new List<string>() { languageDataPP.GetContent("PdfReportPP_066"), languageDataPP.GetContent("PdfReportPP_048"), languageDataPP.GetContent("PdfReportPP_411"), languageDataPP.GetContent("PdfReportPP_412"), languageDataPP.GetContent("PdfReportPP_413") };
            List<string> rowsNames = new List<string>() { languageDataPP.GetContent("PdfReportPP_414"), languageDataPP.GetContent("PdfReportPP_415"), languageDataPP.GetContent("PdfReportPP_416") };
            List<float> colsWidth = new List<float>() { 130, 60, 70, 150, 90 };
            //List<int> lstIdOption = new List<int>() { 226, 227, 228 };
            var optAttrs = GetOptionAttributesByDataType("investmentproject");
            List<int> IdOptions = new HashSet<int>(optAttrs.Select(t => t.idOptionAttribute)).ToList();

            Dictionary<int, List<string>> data = new Dictionary<int, List<string>>();

            Double somme = 0, d;

            int row = 0;
            if (!pIsEmptyReport)
            {
                var idsUnit = new List<int>();
                List<ReportOptionAttributeValue> dataProjetsInv = new List<ReportOptionAttributeValue>();
                for (int k = 0; k < IdOptions.Count; k++)
                {
                    int idOptAttrVal = IdOptions[k];
                    List<ReportOptionAttributeValue> dataOrder =
                        report.ReportOptionAttributeValue.Where(roav => roav.idOptionAttribute == idOptAttrVal)
                            .OrderBy(roav => roav.idReportOptionAttributeValue)
                            .ToList();
                    dataProjetsInv.AddRange(dataOrder);
                }
                    if (dataProjetsInv.Any())
                    {
                        dataProjetsInv.OrderBy(ord => ord.idReportOptionAttributeValue).ToList().ForEach(pi =>
                        {
                            bool isAnyDataAnd = IsAnyDataAnd(pi, new string[] {"Designation"/*, "Amount"*/});
                            if (!isAnyDataAnd)
                            {
                                isAnyDataAnd = IsAnyDataAnd(pi, new string[] { "Designation"/*, "InvestmentProjectAmount"*/ });
                            }
                            if (!idsUnit.Any(zx => zx == pi.idReportOptionAttributeValue) && isAnyDataAnd)
                            {
                                idsUnit.Add(pi.idReportOptionAttributeValue);
                                var lst = new List<string>();
                                for (int c = 0; c < colsNames.Count; c++)
                                {
                                    switch (c)
                                    {
                                        case 0:
                                            string designation = GetStringValue(pi, "Designation");
                                            lst.Add(designation);
                                            break;

                                        case 1:
                                            string amount = GetStringValue(pi, "Amount");
                                            if (string.IsNullOrEmpty(amount)) amount = GetStringValue(pi, "InvestmentProjectAmount");
                                            lst.Add(amount);
                                            if (Double.TryParse(amount.Replace(".", ","), out d))
                                                somme += d;
                                            break;

                                        case 2:
                                            string horizon = GetStringValue(pi, "Horizon");
                                            lst.Add(horizon);
                                            break;

                                        case 3:
                                            string description = GetStringValue(pi, "Description");
                                            lst.Add(description);
                                            break;

                                        case 4:
                                            string country = GetStringValue(pi, "Country");
                                            lst.Add(country);
                                            break;
                                    }

                                }
                                row++;
                                data.Add(row, lst);
                            }
                        });
                    }
                
            }
            else
            {
                int maxRow = 3;
                for (int i = 0; i < maxRow; i++)
                {
                    var lst = new List<string>();
                    for (int c = 0; c < colsNames.Count; c++)
                    {
                        lst.Add(string.Empty);
                    }
                    row++;
                    data.Add(row, lst);
                }
            }

            if (row > 0)
            {
                var lst2 = new List<string>();

                for (int j = 1; j <= colsNames.Count; j++)
                {
                    switch (j)
                    {
                        case 1:
                            lst2.Add(LanguageContentBL.Translate("libelle_total"));
                            break;
                        case 2:
                            lst2.Add(!pIsEmptyReport ? somme.ToString() : string.Empty);
                            break;
                        default:
                            lst2.Add(string.Empty);
                            break;
                    }

                }
                row++;
                data.Add(row, lst2);
            }


            pdfGen.AddTableWithAutomaticNewPage(colsNames, colsWidth, data, ref y, pIsEmptyReport, colsWidth.Sum(), (data.Count + 1) * stdRowHeight, x, (stdRowHeight - 1));

        }
Exemplo n.º 12
0
        // financialcommitment
        private static void GenerateEngagementsEncoursTableFixIssue9985(FoxitPDFGenerator pdfGen, Data.Model.Report report, ref float y,bool pIsEmptyReport, float rowHeight = 25, float x = 0)
        {
            var languageDataPP = PageLanguageHelper.GetLanguageContent("User", "PDFReportPP");
            List<string> colsNames = new List<string>() { languageDataPP.GetContent("PdfReportPP_066"), languageDataPP.GetContent("PdfReportPP_137"), languageDataPP.GetContent("PdfReportPP_138"), languageDataPP.GetContent("PdfReportPP_139") };
            List<string> rowsNames = new List<string>() { languageDataPP.GetContent("PdfReportPP_140"), languageDataPP.GetContent("PdfReportPP_142"), languageDataPP.GetContent("PdfReportPP_143"), languageDataPP.GetContent("PdfReportPP_144"), languageDataPP.GetContent("PdfReportPP_145"), languageDataPP.GetContent("PdfReportPP_146"), languageDataPP.GetContent("PdfReportPP_147"), languageDataPP.GetContent("PdfReportPP_148") };

            //List<int> lstIdOption = new List<int>() { 217, 219, 220, 221, 222, 223, 224, 225 };
            var optAttrs = GetOptionAttributesByDataType("financialcommitment");
            List<int> IdOptions = new HashSet<int>(optAttrs.Select(t => t.idOptionAttribute)).ToList();
            List<float> colsWidth = new List<float>() { 150, 90, 80, 180 };
            List<ReportOptionAttributeValue> dataEngagements = new List<ReportOptionAttributeValue>();

            Dictionary<int, List<string>> data = new Dictionary<int, List<string>>();
            double somme = 0, d;

            int row = 0;
            if (!pIsEmptyReport)
            {
                List<ReportOptionAttributeValue> dataFinancialCommitment = new List<ReportOptionAttributeValue>();
                for (int k = 0; k < IdOptions.Count; k++)
                {
                    int idOptAttrVal = IdOptions[k];
                    List<ReportOptionAttributeValue> dataOrder =
                        report.ReportOptionAttributeValue.Where(roav => roav.idOptionAttribute == idOptAttrVal)
                            .OrderBy(roav => roav.idReportOptionAttributeValue)
                            .ToList();
                    dataFinancialCommitment.AddRange(dataOrder);
                }

                    if (dataFinancialCommitment.Any())
                    {
                        dataFinancialCommitment.OrderBy(ord => ord.idReportOptionAttributeValue).ToList().ForEach(fc =>
                        {
                            bool isAny = IsAnyDataAnd(fc, new string[] { "Designation"});
                            string Designation = GetStringValue(fc, "Designation");
                            if (!isAny)
                            {                                
                                var obj = Upsilab.Business.Report.ReportOptionBL.GetOptionAttributeById(fc.idOptionAttribute); //idOptionAttribute
                                if (obj != null)
                                {
                                    Designation = languageDataCharges.GetContent(obj.NameKey);
                                }
                                isAny = !string.IsNullOrEmpty(Designation);
                            }
                            if (isAny)
                            {
                                var lst = new List<string>();
                                for (int c = 0; c < colsNames.Count; c++)
                                {
                                    switch (c)
                                    {
                                        case 0:
                                            string designation = Designation;
                                            lst.Add(designation);
                                            break;

                                        case 1:
                                            string annualExpenditure = GetStringValue(fc, "AnnualExpenditure");
                                            lst.Add(annualExpenditure);
                                            if (Double.TryParse(annualExpenditure.Replace(".", ","), out d))
                                                somme += d;
                                            break;

                                        case 2:
                                            string maturity = GetStringValue(fc, "Maturity");
                                            lst.Add(maturity);
                                            break;

                                        case 3:
                                            string details = GetStringValue(fc, "Details");
                                            lst.Add(details);
                                            break;
                                    }
                                }
                                row++;
                                data.Add(row, lst);
                            }
                        });
                    }
                
            }
            else
            {
                int maxRow = 3;
                for (int i = 0; i < maxRow; i++)
                {
                    var lst = new List<string>();
                    for (int c = 0; c < colsNames.Count; c++)
                    {
                        lst.Add(string.Empty);
                    }
                    row++;
                    data.Add(row, lst);
                }
            }

            if (row > 0)
            {
                var lst2 = new List<string>();

                for (int j = 1; j <= colsNames.Count; j++)
                {
                    switch (j)
                    {
                        case 1:
                            lst2.Add(LanguageContentBL.Translate("libelle_total"));
                            break;
                        case 2:
                            lst2.Add(!pIsEmptyReport ? somme.ToString() : string.Empty);
                            break;
                        default:
                            lst2.Add(string.Empty);
                            break;
                    }

                }
                row++;
                data.Add(row, lst2);
            }


            pdfGen.AddTableWithAutomaticNewPage(colsNames, colsWidth, data, ref y, pIsEmptyReport, colsWidth.Sum(), (row + 3) * stdRowHeight, x, (stdRowHeight - 1));

        }
Exemplo n.º 13
0
        private static void BuilImpotsEtTaxesTableFixIssue9985(FoxitPDFGenerator pdfGen, Data.Model.Report report, ref float y,bool pIsEmptyReport, float rowHeight = 25, float x = 0)
        {
            var languageDataPP = PageLanguageHelper.GetLanguageContent("User", "PDFReportPP");
            var currentYear = DateTime.Now.Year;

            List<string> colsNames = new List<string>() 
            { 
                languageDataPP.GetContent("PdfReportPP_448"), 
                string.Format(languageDataPP.GetContent("PdfReportPP_449"), currentYear), 
                string.Format(languageDataPP.GetContent("PdfReportPP_450"), currentYear - 1), 
                string.Format(languageDataPP.GetContent("PdfReportPP_451"), currentYear - 2),
                languageDataPP.GetContent("PdfReportPP_452")
            };

            List<float> colsWidth = new List<float>() { 150, 87.5f, 87.5f, 87.5f, 87.5f };
            var optAttrs = GetOptionAttributesByDataType("liquidation");
            List<int> IdOptions = new HashSet<int>(optAttrs.Select(t => t.idOptionAttribute)).ToList();

            double sommeAnnee = 0, sommeAnneeMoinUn = 0, sommeAnneeMoinDeux = 0, d1 = 0, d2 = 0, d3 = 0;
            int row = 0;
            Dictionary<int, List<string>> data = new Dictionary<int, List<string>>();

            if (!pIsEmptyReport)
            {
                List<ReportOptionAttributeValue> dataImpotsTaxes = new List<ReportOptionAttributeValue>();
                for (int k = 0; k < IdOptions.Count; k++)
                {
                    int idOptAttrVal = IdOptions[k];
                    List<ReportOptionAttributeValue> dataOrder =
                        report.ReportOptionAttributeValue.Where(roav => roav.idOptionAttribute == idOptAttrVal)
                            .OrderBy(roav => roav.idReportOptionAttributeValue)
                            .ToList();
                    dataImpotsTaxes.AddRange(dataOrder);
                }

                if (dataImpotsTaxes.Any())
                    {
                        dataImpotsTaxes.OrderBy(ord => ord.idReportOptionAttributeValue).ToList().ForEach(lq =>
                        {
                            if (IsAnyDataAnd(lq, new string[] {"Designation"/*, "CurrentAmount"*/}))
                            {
                                var lst = new List<string>();
                                for (int c = 0; c < colsNames.Count; c++)
                                {
                                    switch (c)
                                    {
                                        case 0:
                                            string designation = GetStringValue(lq, "Designation");
                                            lst.Add(designation);
                                            break;

                                        case 1:
                                            var currentAmount = GetStringValue(lq, "CurrentAmount");
                                            lst.Add(currentAmount);
                                            if (Double.TryParse(currentAmount.Replace(".", ","), out d1))
                                                sommeAnnee += d1;
                                            break;
                                        case 2:
                                            var year1Amount = GetStringValue(lq, "Year1Amount");
                                            lst.Add(year1Amount);
                                            if (Double.TryParse(year1Amount.Replace(".", ","), out d2))
                                                sommeAnneeMoinUn += d2;
                                            break;
                                        case 3:
                                            var year2Amount = GetStringValue(lq, "Year2Amount");
                                            lst.Add(year2Amount);
                                            if (Double.TryParse(year2Amount.Replace(".", ","), out d3))
                                                sommeAnneeMoinDeux += d3;
                                            break;
                                        case 4:
                                            var shareCount = GetStringValue(lq, "ShareCount");
                                            lst.Add(shareCount);
                                            break;
                                    }
                                }
                                row++;
                                data.Add(row, lst);
                            }
                        });
                    }
                
            }
            else
            {
                const int maxRow = 3;
                for (int i = 0; i < maxRow; i++)
                {
                    var lst = new List<string>();
                    for (int c = 0; c < colsNames.Count; c++)
                    {
                        lst.Add(string.Empty);
                    }
                    row++;
                    data.Add(row, lst);
                }
            }

            if (row > 0)
            {
                var lstTotal = new List<string>();
                for (int c = 0; c < colsNames.Count; c++)
                {
                    switch (c)
                    {
                        case 0:
                            lstTotal.Add(LanguageContentBL.Translate("libelle_total"));
                            break;

                        case 1:
                            lstTotal.Add(pIsEmptyReport ? string.Empty : sommeAnnee.ToString());
                            break;

                        case 2:
                            lstTotal.Add(pIsEmptyReport ? string.Empty : sommeAnneeMoinUn.ToString());
                            break;

                        case 3:
                            lstTotal.Add(pIsEmptyReport ? string.Empty : sommeAnneeMoinDeux.ToString());
                            break;

                        default:
                            lstTotal.Add(string.Empty);
                            break;
                    }
                }
                row++;
                data.Add(row, lstTotal);
            }
            pdfGen.AddTableWithAutomaticNewPage(colsNames, colsWidth, data, ref y, pIsEmptyReport, colsWidth.Sum(), (data.Count + 1) * stdRowHeight, x, (stdRowHeight - 1));
        }
Exemplo n.º 14
0
        private static void GenerateAutresPersonnesTable(FoxitPDFGenerator pdfGen, Data.Model.Report report, float y, float x = 0)
        {
            var languageDataPP = PageLanguageHelper.GetLanguageContent("User", "PDFReportPP");
            List<string> colsNames = new List<string>() { languageDataPP.GetContent("PdfReportPP_429"), languageDataPP.GetContent("PdfReportPP_430"), languageDataPP.GetContent("PdfReportPP_431"), languageDataPP.GetContent("PdfReportPP_432") };
            List<float> colsWidth = new List<float>() { 130, 130, 70, 170 };
            Dictionary<int, List<string>> data = new Dictionary<int, List<string>>();
            List<ReportOptionAttributeValue> dataPersonnes = new List<ReportOptionAttributeValue>();
            dataPersonnes = report.ReportOptionAttributeValue.Where(roav => roav.idOptionAttribute == 193).OrderBy(roav => roav.idReportOptionAttributeValue).ToList();
            int nbLignes = 5;
            for (int i = 0; i < nbLignes; i++)
            {
                data.Add(i, new List<string>());
                data[i] = new List<string>();
                for (int j = 1; j <= colsNames.Count; j++)
                {
                    if (i < dataPersonnes.Count)
                    {
                        switch (j)
                        {
                            case 1:
                                string Name = Convert.ToString(dataPersonnes[i].CustomObjectValue.Name);
                                data[i].Add(Name);
                                break;
                            case 2:
                                string FirstName = Convert.ToString(dataPersonnes[i].CustomObjectValue.FirstName);
                                data[i].Add(FirstName);
                                break;
                            case 3:
                                string DateOfBirth = Convert.ToString(dataPersonnes[i].CustomObjectValue.DateOfBirth);
                                data[i].Add(DateOfBirth);
                                break;
                            case 4:
                                data[i].Add(GetEnumValue(Convert.ToString(dataPersonnes[i].CustomObjectValue.IsTaxContributor), 1));

                                break;
                        }
                    }
                    else
                    {
                        data[i].Add("");
                    }
                }
            }

            //pdfGen.AddTable(colsNames, colsWidth, data, y, colsWidth.Sum(), (nbLignes + 1) * 20, x);
            pdfGen.AddTableWithAutomaticNewPage(colsNames, colsWidth, data, ref y, true, colsWidth.Sum(), (data.Count + 1) * 20, x, 19);
        }
Exemplo n.º 15
0
        private static void GenerateLiberaliteTable(FoxitPDFGenerator pdfGen, Data.Model.Report report, ref float y, bool pIsEmptyReport, float x = 0)
        {
            Func<int,int,int, bool> BaseExistence = (z,p,q) =>
            {
                var rp = GetReportOptionAttributeValueByIdOptionAttribute(p, report);
                var rz = GetReportOptionAttributeValueByIdOptionAttribute(z, report);
                var rq =  GetReportOptionAttributeValueByIdOptionAttribute(q, report);
                return !string.IsNullOrEmpty(rp) || !string.IsNullOrEmpty(rz)  || !string.IsNullOrEmpty(rq) ;
            };

            var languageData = Upsilab.Business.Utility.PageLanguageHelper.GetLanguageContent("User", "ClientPP_Titulaire");
            var languageDataPP = PageLanguageHelper.GetLanguageContent("User", "PDFReportPP");
            List<string> colsNames = new List<string>() { languageData.GetContent("ClientPP_Titulaire_libelle_1147"), languageData.GetContent("ClientPP_Titulaire_montant_1147"), languageData.GetContent("ClientPP_Titulaire_dates_1147"), languageData.GetContent("ClientPP_Titulaire_remarques_1147") };
            List<float> colsWidth = new List<float>() { 130, 130, 70, 170 };
            string[] libelles = { languageDataPP.GetContent("PdfReportPP_488"), languageDataPP.GetContent("PdfReportPP_491"), languageDataPP.GetContent("PdfReportPP_494"), GetReportOptionAttributeValueByIdOptionAttribute(804, report) };
            int[] montants = { 731, 733, 735, 805 };
            int[] dates = { 732, 734, 736, 806 };
            int[] remarques = { 796, 797, 798, 807 };
            int nbLignes = 4;
            Dictionary<int, List<string>> data = new Dictionary<int, List<string>>();
            for (int i = 0; i < nbLignes; i++)
            {
                bool isExist = BaseExistence(montants[i], dates[i], remarques[i]);
                if (isExist || pIsEmptyReport)
                {
                    var lst = new List<string>();
                    for (int j = 0; j < 4; j++)
                    {
                        if (pIsEmptyReport)
                        {
                            lst.Add(string.Empty);
                        }
                        else
                        {
                            switch (j)
                            {
                                case 0:
                                    lst.Add(libelles[i].Replace(":",string.Empty));
                                    break;
                                case 1:
                                    lst.Add(GetReportOptionAttributeValueByIdOptionAttribute(montants[i], report));
                                    break;
                                case 2:
                                    lst.Add(GetReportOptionAttributeValueByIdOptionAttribute(dates[i], report));
                                    break;
                                case 3:
                                    lst.Add(GetReportOptionAttributeValueByIdOptionAttribute(remarques[i], report));
                                    break;
                            }
                        }
                    }
                    data.Add(i,lst);
                }
            }
            float rowHeight = stdRowHeight;
            pdfGen.AddTableWithAutomaticNewPage(colsNames, colsWidth, data, ref y, pIsEmptyReport, colsWidth.Sum(), (data.Count + 2) * rowHeight, true, false, x, (rowHeight - 1));
        }