Пример #1
0
        private static void GeneratePPCredit(FoxitPDFGenerator pdfGen, Data.Model.Report report,ref float y, bool pIsEmptyReport)
        {
            var languageDataCredit = PageLanguageHelper.GetLanguageContent("User", "ClientPP_Credit");
            var languageDataPP = PageLanguageHelper.GetLanguageContent("User", "PDFReportPP");

            Func<float, float, int, int, string, bool> BlockQuestion = (yp, x1, yes, no, t) =>
            {
                var reportAnyYes = GetReportOptionValueByIdOption(yes, report);
                var reportAnyNo = GetReportOptionValueByIdOption(no, report);
                if (reportAnyYes != null && reportAnyNo != null)
                    reportAnyNo = null;

                pdfGen.AddDefaultText(languageDataCredit.GetContent(t), yp, max_width, height, x1 += padding_left);
                pdfGen.AddDefaultText(languageDataPP.GetContent("PdfReportPP_Yes"), yp, max_width, height, x1 += 250);
                ReportBL.PlotBooleanValue(pdfGen, reportAnyYes, yp, x1 = x1 + tabCheck + 5);
                pdfGen.AddDefaultText(languageDataPP.GetContent("PdfReportPP_No"), yp, max_width, height, x1 = x1 + tabYesNo);
                ReportBL.PlotBooleanValue(pdfGen, reportAnyNo, yp, x1 = x1 + tabCheck + 5);
                return reportAnyYes != null;
            };

            Func<float, float, int, string, string> BlockMontant = (yp, xt, idx, t) =>
            {
                /*pdfGen.AddDefaultText(languageDataCredit.GetContent(t).Replace("&euro;", "€"), yp, max_width, height, x1 += padding_left);
                string liquidity = GetReportOptionAttributeValueByIdOptionAttribute(idx, report);
                liquidity = !string.IsNullOrEmpty(liquidity) ? liquidity : "0";
                pdfGen.AddAnswer(liquidity, yp, 75, 20, x1 += 250);
                return string.Empty;*/

                string montantCredit = GetReportOptionAttributeValueByIdOptionAttribute(idx, report);
                if (!pIsEmptyReport)
                {
                    if (!string.IsNullOrEmpty(montantCredit) && !montantCredit.Equals("0"))
                    {
                        pdfGen.AddDefaultText(languageDataCredit.GetContent(t).Replace("&euro;", "€"), yp, max_width, height, xt += padding_left);
                        pdfGen.AddAnswer(montantCredit, yp, 100, 20, xt += 270);
                    }
                }
                else
                {
                    pdfGen.AddDefaultText(languageDataCredit.GetContent(t).Replace("&euro;", "€"), yp, max_width, height, xt += padding_left);
                    pdfGen.AddAnswer(string.Empty, yp, 100, 20, xt += 270);
                }
                return string.Empty;
            };

            var dataCredits = report.ReportOptionAttributeValue.Where(roav => roav.idOptionAttribute == 215).OrderBy(roav => roav.idReportOptionAttributeValue).ToList();
            dataCredits = dataCredits.Where(dc => !string.IsNullOrEmpty(dc.CustomObjectValue.Borrower)).ToList();

            var hasCredit = GetReportOptionValueByIdOption(1307, report) != null;
            var hasDetailCredit = GetReportOptionValueByIdOption(1309, report) != null;

            if (y ==0)
            {
                if (dataCredits.Count + 2 >= 7)
                {
                    pdfGen.CreatePage(true, false, true, string.Empty, true);
                }
                else
                    pdfGen.CreatePage(); 
            }



            //CREDITS
            pdfGen.AddTitle(languageDataPP.GetContent("PdfReportPP_127"), y, max_width, 20);
            var isAnyDataCredit = dataCredits.Count > 0; //report.ReportOptionAttributeValue.Any(roav => roav.idOptionAttribute == 215);

            var x = 0;
            float yTmp = 0;
            if (!pIsEmptyReport)
            {
                if (hasCredit)
                {
                    if (!isAnyDataCredit)
                    {
                        y += interline + 5;
                        yTmp = y;
                        pdfGen.CalculeZoneWithAutomaticNewPage(ref y, 2f * height);
                        if (y > 0) y = yTmp;
                        BlockQuestion(y, x, 1307, 1308, "ClientPP_Credit_020");

                        //Credits (en K€)
                        y += interline;
                        BlockMontant(y, x, 729, "ClientPP_Credit_023");
                    }
                    else
                    {
                        y += interline;
                        GenerateCreditsTable2(pdfGen, report, ref y, pIsEmptyReport);

                        //y += interline;
                        //pdfGen.CalculeZoneWithAutomaticNewPage(ref y, 60);
                    }
                }
                else
                {
                    //Credits (en K€)
                    y += interline;
                    yTmp = y;
                    pdfGen.CalculeZoneWithAutomaticNewPage(ref y, 1f * height);
                    if (y > 0) y = yTmp;
                    BlockQuestion(y, x, 1307, 1308, "ClientPP_Credit_020");
                }
            }
            else
            {
                y += interline + 5;
                yTmp = y;
                pdfGen.CalculeZoneWithAutomaticNewPage(ref y, 2f * height);
                if (y > 0) y = yTmp;
                BlockQuestion(y, x, 1307, 1308, "ClientPP_Credit_020");

                //Credits (en K€)
                y += interline;
                BlockMontant(y, x, 729, "ClientPP_Credit_023");

                y += interline;
                GenerateCreditsTable2(pdfGen, report, ref y, pIsEmptyReport);
            }

            if (dataCredits.Any())
            {
                y += interline;
                yTmp = y;
                pdfGen.CalculeZoneWithAutomaticNewPage(ref y, 60);
                if (y > 0) y = yTmp;

                pdfGen.AddReferenceWithZone(languageDataPP.GetContent("PdfReportPP_131"), ref y, max_width, height, 20);
                y += textInterline;
                pdfGen.AddReferenceWithZone(languageDataPP.GetContent("PdfReportPP_129"), ref y, max_width, height, 20);
                y += textInterline;
                pdfGen.AddReferenceWithZone(languageDataPP.GetContent("PdfReportPP_130"), ref y, max_width, height, 20); 
            }

            /*if ((!hasCredit || !hasDetailCredit) && !psIsEmptyReport)
            {
                y += interline + 5;
                var yTmp = y;
                pdfGen.CalculeZoneWithAutomaticNewPage(ref y,2f*height);
                if (y > 0) y = yTmp;
                BlockQuestion(y, x, 1307, 1308, "ClientPP_Credit_020");

                if (hasCredit)
                {
                    //Patrimoine divers (en €)
                    y += interline;
                    BlockMontant(y, x, 729, "ClientPP_Credit_023");
                }
            }*/

            //Endettement estimes
            //pdfGen.AddDefaultText(languageDataPP.GetContent("PdfReportPP_128"), y , max_width, height);
            //pdfGen.AddAnswer(GetReportOptionAttributeValueByIdOptionAttribute(729, report), y, 75, 20, 250);

            /*if (hasDetailCredit || psIsEmptyReport)
            {
                y += interline;
                GenerateCreditsTable2(pdfGen, report, ref y, psIsEmptyReport);

                y += interline;
                var yTmp = y ;
                pdfGen.CalculeZoneWithAutomaticNewPage(ref y, 60);
                if (y > 0) y = yTmp;

                pdfGen.AddReferenceWithZone(languageDataPP.GetContent("PdfReportPP_131"), ref y, max_width, height, 20);
                y += textInterline;
                pdfGen.AddReferenceWithZone(languageDataPP.GetContent("PdfReportPP_129"), ref y, max_width, height, 20);
                y += textInterline;
                pdfGen.AddReferenceWithZone(languageDataPP.GetContent("PdfReportPP_130"), ref y, max_width, height, 20);
            }*/
        }
Пример #2
0
        private static void GeneratePPRevenuEtPatrimoine(FoxitPDFGenerator pdfGen, Data.Model.Report report, ref float y, bool pIsEmptyReport)
        {
            const string key = "pprevenupatrimoine";
            #region "DEBUG Begin"

            if (IS_DEBUG)
            {
                Upsilab.Business.Log.Log.AppendException(new Exception(string.Format(trace,"debut revenu et patrimoine",DateTime.Now.ToString("dd/MM/yyy HH:mm:ss"))));
            }

            #endregion
            var languageDataPP = PageLanguageHelper.GetLanguageContent("User", "PDFReportPP");
            var languageDataPatFin = PageLanguageHelper.GetLanguageContent("User", "ClientPP_ParimoineFinancier");
            //REVENUS ET PATRIMOINE
            float x = 0;
            y += (interline*2f);
            var yTmp = y;
            pdfGen.CalculeZoneWithAutomaticNewPage(ref y, 4 * height);
            if (y > 0) y = yTmp;

            pdfGen.AddTitle(languageDataPP.GetContent("PdfReportPP_042"), y, max_width, height);
            pdfGen.AddJustifyText(languageDataPP.GetContent("PdfReportPP_043"), y += paddingAfterParagraph + 10, max_width, height * 3);//Cpnformement .....

            /******************* I - REVENUS **********************/
            #region "I - Revenus"
            if (IS_DEBUG && _listDebug.Any(px => px == key)) Upsilab.Business.Log.Log.AppendException(new Exception(string.Format(trace, "I - REVENUS", DateTime.Now.ToString("dd/MM/yyy HH:mm:ss"))));
            //I. Revenus
            pdfGen.AddSubtitle(languageDataPP.GetContent("PdfReportPP_044"), y += (interline * 2) , max_width, height);

            // "revenuebreakdown"
            List<int> lstIdOption = new List<int>() { 194, 195, 774, 196, 197, 198, 199 };
            bool isAnydata = false;
            var hasDetailRevenu = GetReportOptionValueByIdOption(1259, report) != null;
            if (hasDetailRevenu)// si details checked
            {
                var dataRevenusDetails = report.ReportOptionAttributeValue.Where(roav => roav.OptionAttribute.idOption == 314).OrderBy(roav => roav.idReportOptionAttributeValue).ToList();
                foreach (var dt in dataRevenusDetails)
                {
                    isAnydata = IsAnyDataAnd(dt, new string[] {/*"Amount", */"SourceDestination" });
                    // old criteria
                    if (!isAnydata)
                    {
                        isAnydata = IsAnyDataAnd(dt, new string[] {/*"Amount", */"Designation" });
                        if (!isAnydata && dt.CustomObjectValue != null)
                        {
                           // var amt = dt.CustomObjectValue.Amount ?? string.Empty;
                            var dgt = dt.CustomObjectValue.Designation ?? string.Empty;
                            //isAnydata = !string.IsNullOrEmpty(amt) && !string.IsNullOrEmpty(dgt);
                            isAnydata = !string.IsNullOrEmpty(dgt);
                        }
                    }
                    if (isAnydata) break;
                }
            }

            /*-------------------------------------------------------
                a) Revenus annuels nets (en K euros)
            ---------------------------------------------------------*/
            if (IS_DEBUG && _listDebug.Any(px => px == key)) Upsilab.Business.Log.Log.AppendException(new Exception(string.Format(trace, "a) Revenus annuels nets (en K euros)", DateTime.Now.ToString("dd/MM/yyy HH:mm:ss"))));
        
           // if (!hasDetailRevenu)
            {
                y += interline;
                pdfGen.AddTextBoldSubtitle(string.Format("{0}", languageDataPP.GetContent("PdfReportPP_045")), y, max_width, height, ChapiterPaddingLeft);
                string revenuV = GetReportOptionAttributeValueByIdOptionAttribute(727, report);
                pdfGen.AddAnswer(revenuV, y, 100, 20, 250);
            }

            /*-------------------------------------------------------
                b) Détail des revenus
            ---------------------------------------------------------*/
            if (IS_DEBUG && _listDebug.Any(px => px == key)) Upsilab.Business.Log.Log.AppendException(new Exception(string.Format(trace, "b) Détail des revenus", DateTime.Now.ToString("dd/MM/yyy HH:mm:ss"))));

            #region "DELEGATE"
            Func<float, float, int, int, string, bool> BlockQuestion = (yp, xs, yesIdOption, noIdOption, questionNamekey) =>
            {
                var reportAnyyes = GetReportOptionValueByIdOption(yesIdOption, report);
                pdfGen.AddDefaultText(languageDataPatFin.GetContent(questionNamekey), yp, max_width, height, xs += padding_left);

                pdfGen.AddDefaultText(languageDataPP.GetContent("PdfReportPP_Yes"), yp, max_width, height, xs += 270);
                ReportBL.PlotBooleanValue(pdfGen, reportAnyyes, yp, xs += tabCheck + 5);

                pdfGen.AddDefaultText(languageDataPP.GetContent("PdfReportPP_No"), yp, max_width, height, xs += tabYesNo);
                ReportBL.PlotBooleanValue(pdfGen, GetReportOptionValueByIdOption(noIdOption, report), yp, xs += tabCheck + 5);
                return reportAnyyes != null;
            };

            /*Func<float, float, int, string, string> BlockMontant = (yp, xt, idx, t) =>
            {
                pdfGen.AddDefaultText(languageDataPatFin.GetContent(t).Replace("&euro;", "€"), yp, max_width, height, xt += padding_left);
                string liquidity = GetReportOptionAttributeValueByIdOptionAttribute(idx, report);
                liquidity = !pIsEmptyReport ? (!string.IsNullOrEmpty(liquidity) ? liquidity : "0") : string.Empty;
                //pdfGen.AddDefaultText(liquidity, yp, max_width, 20, x += 250);
                pdfGen.AddAnswer(liquidity, yp, 100, 20, xt += 270);
                return string.Empty;
            };*/

            //[09-02-2016:Tonny] Ne pas afficher la ligne si montant non renseinger ou égale à 0
            Func<float, float, int, string, string> BlockMontant = (yp, xt, idx, t) =>
            {
                string liquidity = GetReportOptionAttributeValueByIdOptionAttribute(idx, report);
                //liquidity = !pIsEmptyReport ? (!string.IsNullOrEmpty(liquidity) ? liquidity : "0") : string.Empty;
                if (!pIsEmptyReport)
                {
                    if (!string.IsNullOrEmpty(liquidity) && !liquidity.Equals("0"))
                    {
                        pdfGen.AddDefaultText(languageDataPatFin.GetContent(t).Replace("&euro;", "€"), yp, max_width, height, xt += padding_left);
                        //pdfGen.AddDefaultText(liquidity, yp, max_width, 20, x += 250);
                        pdfGen.AddAnswer(liquidity, yp, 100, 20, xt += 270);
                    }
                }
                else
                {
                    pdfGen.AddDefaultText(languageDataPatFin.GetContent(t).Replace("&euro;", "€"), yp, max_width, height, xt += padding_left);
                    //pdfGen.AddDefaultText(liquidity, yp, max_width, 20, x += 250);
                    pdfGen.AddAnswer(string.Empty, yp, 100, 20, xt += 270);                
                }
                return string.Empty;
            };
            #endregion

            int nbLine = 0;

            if (IS_DEBUG && _listDebug.Any(px => px == key)) Upsilab.Business.Log.Log.AppendException(new Exception(string.Format(trace, "begin test any data", DateTime.Now.ToString("dd/MM/yyy HH:mm:ss"))));
            if ((/*hasDetailRevenu && */isAnydata) || pIsEmptyReport)
            {
                if (IS_DEBUG && _listDebug.Any(px => px == key)) Upsilab.Business.Log.Log.AppendException(new Exception(string.Format(trace, "debut tableau des revenus", DateTime.Now.ToString("dd/MM/yyy HH:mm:ss"))));

                y += interline;
                pdfGen.AddTextBoldSubtitle(string.Format("{0}", languageDataPP.GetContent("PdfReportPP_046").Replace(":", string.Empty)), y, max_width, height, ChapiterPaddingLeft);
                y += interline;
                GenerateDetailRevenuTableFixIssue9985(pdfGen, report, ref nbLine, ref y, pIsEmptyReport);

                if (IS_DEBUG && _listDebug.Any(px => px == key)) Upsilab.Business.Log.Log.AppendException(new Exception(string.Format(trace, "fin tableau des revenus", DateTime.Now.ToString("dd/MM/yyy HH:mm:ss"))));
            }

            if (IS_DEBUG && _listDebug.Any(px => px == key)) Upsilab.Business.Log.Log.AppendException(new Exception(string.Format(trace, "debut note revenus", DateTime.Now.ToString("dd/MM/yyy HH:mm:ss"))));

            y += interline;
            yTmp = y;
            pdfGen.CalculeZoneWithAutomaticNewPage(ref y, (20 + 80 + 10));
            if (y > 0) yTmp = y;
            pdfGen.AddLabelNote(languageDataPP.GetContent("PdfReportPP_Notes"), y, 500, 20);
            string noteValue = ReportBL.GetStringValue(GetReportOptionAttributeValueByIdOptionAttribute(270, report));
            float heightCalcul = 0;
           // y += interline;
            y += 5;
            pdfGen.DynamicBlueBorderZoneSize(noteValue, y, out heightCalcul, 80);
            yTmp = y + interline;
            pdfGen.CalculeZoneWithAutomaticNewPage(ref y, heightCalcul);
            if (y > 0)
            {
                y = yTmp;
            }

            pdfGen.AddDynamicBlueBorderWithText(noteValue, ref y, 0, max_width, 50);

            if (IS_DEBUG && _listDebug.Any(px => px == key)) Upsilab.Business.Log.Log.AppendException(new Exception(string.Format(trace, "fin note revenus", DateTime.Now.ToString("dd/MM/yyy HH:mm:ss"))));
            #endregion

            /******************* II - PATRIMOINE **********************/
            if (IS_DEBUG && _listDebug.Any(px => px == key)) Upsilab.Business.Log.Log.AppendException(new Exception(string.Format(trace, "II - PATRIMOINE", DateTime.Now.ToString("dd/MM/yyy HH:mm:ss"))));
          
            #region "II. Patrimoine"
            y += interline + 10;
            pdfGen.CalculeZoneWithAutomaticNewPage(ref y, 2 * height);
            pdfGen.AddSubtitle(languageDataPP.GetContent("PdfReportPP_059"), y, max_width, height);

            #region "Actif global"
            //Actif global estimé (en K€) :
            if (IS_DEBUG && _listDebug.Any(px => px == key)) Upsilab.Business.Log.Log.AppendException(new Exception(string.Format(trace, "Actif global", DateTime.Now.ToString("dd/MM/yyy HH:mm:ss"))));
            
            pdfGen.AddDefaultText(languageDataPP.GetContent("PdfReportPP_060"), y += interline + 5, max_width, height, ChapiterPaddingLeft);
            string actif = GetReportOptionAttributeValueByIdOptionAttribute(728, report);
            pdfGen.AddAnswer(actif, y, 100, 20, 250);
            #endregion

            #region "a) Patrimoine financier"
            if (IS_DEBUG && _listDebug.Any(px => px == key)) Upsilab.Business.Log.Log.AppendException(new Exception(string.Format(trace, "a) Patrimoine financier", DateTime.Now.ToString("dd/MM/yyy HH:mm:ss"))));
            
            yTmp = y + interline+5;
            pdfGen.CalculeZoneWithAutomaticNewPage(ref y, 3f * height);
            if (y > 0)
                y = yTmp;

            pdfGen.AddTextBoldSubtitle(string.Format("{0}", languageDataPP.GetContent("PdfReportPP_061")), y, max_width, height, ChapiterPaddingLeft);
            int nbLigneAAfficher1 = 0, nbLigneAAfficher2 = 0, nbLigneAAfficher3 = 0, nbLigneAAfficher4 = 0, nbLigneAAfficher5 = 0, nbLigneAAfficher6 = 0, nbLigneAAfficher7 = 0;
            bool GotoNextPage = true;
            int nbLinesTmp = 0;
            float TabHeight = 0;
            int nbligne = 0;
            const float patrimoinRowheight = 25;

            x = 0;
            y += interline;

            //Le client a-t-il un patrimoine financier ?
            var hasPatrimoineFinancier = BlockQuestion(y, x, 1260, 1261, "ClientPP_ParimoineFinancier_004");

            if (hasPatrimoineFinancier || pIsEmptyReport)
            {
                /*------------------------------------------------
                1 - LIQUIDITE
                /*------------------------------------------------*/
                #region "1 - Liquidité"
                if (IS_DEBUG && _listDebug.Any(px => px == key))
                {
                    Upsilab.Business.Log.Log.AppendException(new Exception(string.Format(trace, "1 - Liquidité", DateTime.Now.ToString("dd/MM/yyy HH:mm:ss"))));
                }
                x = 0;
                //Patrimoine financier (en €):
                y += interline;
                BlockMontant(y, x, 779, "ClientPP_ParimoineFinancier_003");

                y += interline+10;

                //1.  Liquidités (compte chèque, CODEVI, CEL, LEP, livrets, etc.)
                x = padding_left + 10;
                pdfGen.AddDefaultText(languageDataPP.GetContent("PdfReportPP_062"), y, max_width, height, x);

                var hasLiquidite = GetReportOptionValueByIdOption(1262, report) != null;
                var hasDetailLiquidite = GetReportOptionValueByIdOption(1264, report) != null;

                // -------------- test existence data
                bool isAnyLiquiditeData = false;
                var optAttrs = GetOptionAttributesByDataType("patrimoinefinancier");
                List<int> IdOptions = new HashSet<int>(optAttrs.Select(t => t.idOptionAttribute)).ToList();
                for (int k = 0; k < IdOptions.Count; k++)
                {
                    int idOptAttrVal = IdOptions[k];
                    List<ReportOptionAttributeValue> dataLiquidites =
                        report.ReportOptionAttributeValue.Where(roav => roav.idOptionAttribute == idOptAttrVal)
                            .OrderBy(roav => roav.idReportOptionAttributeValue)
                            .ToList();
                    foreach (ReportOptionAttributeValue reportOptonAttrValue in dataLiquidites)
                    {
                        if (IsAnyDataAnd(reportOptonAttrValue, new string[] {"Description"/*, "CurrentValue"*/}))
                        {
                            isAnyLiquiditeData = true;
                            break;
                        }
                    }
                }
                //----------------------------------
               
                x += 5;

                    if (!pIsEmptyReport)
                    {
                        if (hasLiquidite)
                        {
                            if (!isAnyLiquiditeData)
                            {
                                y += interline;
                                //Le client a-t-il des liquidités ?
                                BlockQuestion(y, x, 1262, 1263, "ClientPP_ParimoineFinancier_008");
                                //Liquidités (en €)
                                y += interline;
                                BlockMontant(y, x, 780, "ClientPP_ParimoineFinancier_007");
                            }
                            else
                            {
                                y = y + interline;
                                yTmp = y;
                                pdfGen.CalculeZoneWithAutomaticNewPage(ref y, 3 * 25);
                                if (y > 0)
                                    y = yTmp;

                                GenerateLiquiditesTableFixIssue9985(pdfGen, report, ref y, pIsEmptyReport, patrimoinRowheight);
                            }
                        }
                        else
                        {
                            y += interline;
                            //Le client a-t-il des liquidités ?
                            BlockQuestion(y, x, 1262, 1263, "ClientPP_ParimoineFinancier_008");
                        }
                    }
                    else
                    { //LIQUIDITES EMPTY REPORT
                        y += interline;
                        //Le client a-t-il des liquidités ?
                        BlockQuestion(y, x, 1262, 1263, "ClientPP_ParimoineFinancier_008");
                        //Liquidités (en €)
                        y += interline;
                        BlockMontant(y, x, 780, "ClientPP_ParimoineFinancier_007");

                        y = y + interline;
                        yTmp = y;
                        pdfGen.CalculeZoneWithAutomaticNewPage(ref y, 3 * 25);
                        if (y > 0)
                            y = yTmp;

                        GenerateLiquiditesTableFixIssue9985(pdfGen, report, ref y, pIsEmptyReport, patrimoinRowheight);
                    }
              

                #endregion

                /*------------------------------------------------
	        2 - Term investissment
	        /*------------------------------------------------*/
                #region "2 - Term investissment"
                if (IS_DEBUG && _listDebug.Any(px => px == key))
                {
                    Upsilab.Business.Log.Log.AppendException(new Exception(string.Format(trace, "2 - Term investissment", DateTime.Now.ToString("dd/MM/yyy HH:mm:ss"))));
                }
                const float rowPlacementHeight = 25;
                y += interline + 10; //TO_POSITION
                yTmp = y;
                pdfGen.CalculeZoneWithAutomaticNewPage(ref y, 3 * height);
                if (y > 0) y = yTmp;

                x = padding_left + 10;

                pdfGen.AddDefaultTextWithAutomaticNewPage(languageDataPP.GetContent("PdfReportPP_063"), ref y, max_width - padding_left, 40, x);

                x += 5;
                var hasPlacementAterme = GetReportOptionValueByIdOption(1269, report) != null;
                var hasDetailPlacementAterme = GetReportOptionValueByIdOption(1267, report) != null;

                // -------------- test existence data
                bool isAnyTermInvData = false;
                optAttrs = GetOptionAttributesByDataType("terminvestments");
                IdOptions = new HashSet<int>(optAttrs.Select(t => t.idOptionAttribute)).ToList();
                for (int k = 0; k < IdOptions.Count; k++)
                {
                    int idOptAttrVal = IdOptions[k];
                    List<ReportOptionAttributeValue> dataLiquidites =
                        report.ReportOptionAttributeValue.Where(roav => roav.idOptionAttribute == idOptAttrVal)
                            .OrderBy(roav => roav.idReportOptionAttributeValue)
                            .ToList();
                    foreach (ReportOptionAttributeValue reportOptonAttrValue in dataLiquidites)
                    {
                        if (IsAnyDataAnd(reportOptonAttrValue, new string[] { "Description"/*, "CurrentValue"*/ }))
                        {
                            isAnyTermInvData = true;
                            break;
                        }
                    }
                }
                //----------------------------------

               // if ((!hasPlacementAterme || !hasDetailPlacementAterme) && !pIsEmptyReport)
                //if ((!hasPlacementAterme || !isAnyTermInvData) && !pIsEmptyReport)

                if (!pIsEmptyReport)
                {
                    if (hasPlacementAterme)
                    {

                        if (!isAnyTermInvData)
                        {
                            y += interline + 5;
                            BlockQuestion(y, x, 1269, 1270, "ClientPP_ParimoineFinancier_012");
                            //Patrimoine financier (en €)
                            y += interline;
                            BlockMontant(y, x, 787, "ClientPP_ParimoineFinancier_011");
                        }
                        else
                        {
                            y = y + interline + 10;
                            yTmp = y;
                            pdfGen.CalculeZoneWithAutomaticNewPage(ref y, 3 * height);
                            if (y > 0)
                                y = yTmp;

                            GeneratePlacementATermesTableFixIssue9985(pdfGen, report, ref y, pIsEmptyReport);
                        }
                    }
                    else
                    {
                        //Patrimoine financier (en €)
                        y += interline + 5;
                        BlockQuestion(y, x, 1269, 1270, "ClientPP_ParimoineFinancier_012");
                    }
                }
                else
                { //EMPTY REPORT
                    y += interline + 5;
                    BlockQuestion(y, x, 1269, 1270, "ClientPP_ParimoineFinancier_012");
                    //Patrimoine financier (en €)
                    y += interline;
                    BlockMontant(y, x, 787, "ClientPP_ParimoineFinancier_011");

                    y = y + interline + 10;
                    yTmp = y;
                    pdfGen.CalculeZoneWithAutomaticNewPage(ref y, 3 * height);
                    if (y > 0)
                        y = yTmp;

                    GeneratePlacementATermesTableFixIssue9985(pdfGen, report, ref y, pIsEmptyReport);
                }
                #endregion

                /*------------------------------------------------
	        3 -Life insurance
	        /*------------------------------------------------*/
                if (IS_DEBUG && _listDebug.Any(px => px == key))
                {
                    Upsilab.Business.Log.Log.AppendException(new Exception(string.Format(trace, "3 -Life insurance", DateTime.Now.ToString("dd/MM/yyy HH:mm:ss"))));
                }
                #region "3 -Life insurance"
                y = y + interline + 10;
                yTmp = y;
                pdfGen.CalculeZoneWithAutomaticNewPage(ref y, 3 * height);
                if (y > 0)
                    y = yTmp;

                x = padding_left + 10;
                pdfGen.AddDefaultTextWithAutomaticNewPage(languageDataPP.GetContent("PdfReportPP_064"), ref y, max_width, 40, x);

                x += 5;

                var hasAssuranceVie = GetReportOptionValueByIdOption(1273, report) != null;
                var hasDetailAssuranceVie = GetReportOptionValueByIdOption(1271, report) != null;

                // -------------- test existence data
                bool isAnyLifeInsData = false;
                optAttrs = GetOptionAttributesByDataType("lifeinsurance");
                IdOptions = new HashSet<int>(optAttrs.Select(t => t.idOptionAttribute)).ToList();
                for (int k = 0; k < IdOptions.Count; k++)
                {
                    int idOptAttrVal = IdOptions[k];
                    List<ReportOptionAttributeValue> dataLiquidites =
                        report.ReportOptionAttributeValue.Where(roav => roav.idOptionAttribute == idOptAttrVal)
                            .OrderBy(roav => roav.idReportOptionAttributeValue)
                            .ToList();
                    foreach (ReportOptionAttributeValue reportOptonAttrValue in dataLiquidites)
                    {
                        if (IsAnyDataAnd(reportOptonAttrValue, new string[] { "Description"/*, "CurrentValue"*/ }))
                        {
                            isAnyLifeInsData = true;
                            break;
                        }
                    }
                }
                //----------------------------------

                //if ((!hasAssuranceVie || !hasDetailAssuranceVie) && !pIsEmptyReport)
                //if ((!hasAssuranceVie || !isAnyLifeInsData) && !pIsEmptyReport)
                if(!pIsEmptyReport)
                {
                    if (hasAssuranceVie)
                    {
                        if (!isAnyLifeInsData)
                        {
                            y += interline;
                            //Le client a-t-il des assurances-vie ?
                            BlockQuestion(y, x, 1273, 1274, "ClientPP_ParimoineFinancier_016");
                            //Assurance-vie (en €)
                            y += interline;
                            BlockMontant(y, x, 788, "ClientPP_ParimoineFinancier_015");
                        }
                        else
                        {
                            y = y + interline;
                            yTmp = y;
                            pdfGen.CalculeZoneWithAutomaticNewPage(ref y, 3 * height);
                            if (y > 0)
                                y = yTmp;

                            GenerateAssurancesVieTableFixIssue9985(pdfGen, report, ref y, pIsEmptyReport);
                        }
                    }
                    else
                    {
                        y += interline;
                        //Le client a-t-il des assurances-vie ?
                        BlockQuestion(y, x, 1273, 1274, "ClientPP_ParimoineFinancier_016");                
                    }
                }else
                { // EMPTY REPORT
                    y += interline;
                    //Le client a-t-il des assurances-vie ?
                    BlockQuestion(y, x, 1273, 1274, "ClientPP_ParimoineFinancier_016");
                    //Assurance-vie (en €)
                    y += interline;
                    BlockMontant(y, x, 788, "ClientPP_ParimoineFinancier_015");

                    y = y + interline;
                    yTmp = y;
                    pdfGen.CalculeZoneWithAutomaticNewPage(ref y, 3 * height);
                    if (y > 0)
                        y = yTmp;

                    GenerateAssurancesVieTableFixIssue9985(pdfGen, report, ref y, pIsEmptyReport);
                }

                #endregion

                /*------------------------------------------------
	        4 -Securities
	        /*------------------------------------------------*/
                #region "4 -Securities"
                if (IS_DEBUG && _listDebug.Any(px => px == key))
                {
                    Upsilab.Business.Log.Log.AppendException(new Exception(string.Format(trace, "4 -Securities", DateTime.Now.ToString("dd/MM/yyy HH:mm:ss"))));
                }
                y = y + interline + 10;
                //y += interline;
                yTmp = y;
                pdfGen.CalculeZoneWithAutomaticNewPage(ref y, 3 * height);
                if (y > 0)
                    y = yTmp;

                x = padding_left + 10;
                const float rowValMobHeight = 25;
                pdfGen.AddDefaultTextWithAutomaticNewPage(languageDataPP.GetContent("PdfReportPP_065"), ref y,
                    max_width - padding_left, 40, x);
                x += 5;

                var hasValeurImmobiliere = GetReportOptionValueByIdOption(1277, report) != null;
                var hasDetailValeurImmobiliere = GetReportOptionValueByIdOption(1275, report) != null;

                // -------------- test existence data
                bool isAnySecuritiesData = false;
                optAttrs = GetOptionAttributesByDataType("securities");
                IdOptions = new HashSet<int>(optAttrs.Select(t => t.idOptionAttribute)).ToList();
                for (int k = 0; k < IdOptions.Count; k++)
                {
                    int idOptAttrVal = IdOptions[k];
                    List<ReportOptionAttributeValue> dataLiquidites =
                        report.ReportOptionAttributeValue.Where(roav => roav.idOptionAttribute == idOptAttrVal)
                            .OrderBy(roav => roav.idReportOptionAttributeValue)
                            .ToList();
                    foreach (ReportOptionAttributeValue reportOptonAttrValue in dataLiquidites)
                    {
                        if (IsAnyDataAnd(reportOptonAttrValue, new string[] { "Description"/*, "CurrentValue"*/ }))
                        {
                            isAnySecuritiesData = true;
                            break;
                        }
                    }
                }
                //----------------------------------

                //if ((!hasValeurImmobiliere || !hasDetailValeurImmobiliere) && !pIsEmptyReport)
                //if ((!hasValeurImmobiliere || !isAnySecuritiesData) && !pIsEmptyReport)
                if(!pIsEmptyReport)
                {
                    if (hasValeurImmobiliere)
                    {
                        if (!isAnySecuritiesData)
                        {
                            y += interline;
                            BlockQuestion(y, x, 1277, 1278, "ClientPP_ParimoineFinancier_019");
                            //Patrimoine financier (en €)
                            y += interline + 5;
                            BlockMontant(y, x, 789, "ClientPP_ParimoineFinancier_018");
                        }
                        else
                        {
                            y = y + interline;
                            yTmp = y;
                            pdfGen.CalculeZoneWithAutomaticNewPage(ref y, 3 * height);
                            if (y > 0)
                                y = yTmp;

                            GenerateValeursImmobilieresTableFixIssue9985(pdfGen, report, ref y, pIsEmptyReport);
                        }
                    }
                    else
                    {
                        y += interline;
                        BlockQuestion(y, x, 1277, 1278, "ClientPP_ParimoineFinancier_019");                
                    }
                }else
                { //EMPY REPORT
                    y += interline;
                    BlockQuestion(y, x, 1277, 1278, "ClientPP_ParimoineFinancier_019");
                    //Patrimoine financier (en €)
                    y += interline + 5;
                    BlockMontant(y, x, 789, "ClientPP_ParimoineFinancier_018");

                    y = y + interline;
                    yTmp = y;
                    pdfGen.CalculeZoneWithAutomaticNewPage(ref y, 3 * height);
                    if (y > 0)
                        y = yTmp;

                    GenerateValeursImmobilieresTableFixIssue9985(pdfGen, report, ref y, pIsEmptyReport);
                }

                #endregion
            }
            

           

            #endregion //"a) Patrimoine financier"


            #region "b ) Patrimoine immobilier"
            if (IS_DEBUG && _listDebug.Any(px => px == key))
            {
                Upsilab.Business.Log.Log.AppendException(new Exception(string.Format(trace, "b ) Patrimoine immobilier", DateTime.Now.ToString("dd/MM/yyy HH:mm:ss"))));
            }

            y = y + interline + 15;
            yTmp = y;
            pdfGen.CalculeZoneWithAutomaticNewPage(ref y, 3f * height);
            if (y > 0)
                y = yTmp;

            pdfGen.AddTextBoldSubtitle(string.Format("{0}", languageDataPP.GetContent("PdfReportPP_361")), y,
                max_width, height, ChapiterPaddingLeft);

            y += interline;
            x = 0;
            //Le client a-t-il un patrimoine immobilier ?
            var hasPatrimoineImmobilier = BlockQuestion(y, x, 1280, 1281, "ClientPP_ParimoineFinancier_0021");
            const float rowPatImHeight = 25;

            if (hasPatrimoineImmobilier || pIsEmptyReport)
            {
                //Patrimoine financier (en €)
                y += interline;
                BlockMontant(y, x, 790, "ClientPP_ParimoineFinancier_020");

                y = y + interline + 5;
                yTmp = y;
                pdfGen.CalculeZoneWithAutomaticNewPage(ref y, 3f * height);
                if (y > 0)
                    y = yTmp;

                x = padding_left;

                /*----------------------------------------------------
                1 - Immobilier de joissance
                ----------------------------------------------------*/
                #region "1 - Immobilier de joissance"
                if (IS_DEBUG && _listDebug.Any(px => px == key))
                {
                    Upsilab.Business.Log.Log.AppendException(new Exception(string.Format(trace, "1 - Immobilier de joissance", DateTime.Now.ToString("dd/MM/yyy HH:mm:ss"))));
                }

                //1.  Immobilier de jouissance (résidence principale, résidence secondaire, etc.)
                pdfGen.AddDefaultTextWithAutomaticNewPage(languageDataPP.GetContent("PdfReportPP_362"), ref y,
                   max_width, 40, x);
                x += 10;

                var hasImmoJouissance = GetReportOptionValueByIdOption(1283, report) != null;
                var hasDetailJouissance = GetReportOptionValueByIdOption(1285, report) != null;
                //Details immobilier de joissance  "oui"

                // -------------- test existence data
                bool isAnyImmobJouissanceData = false;
                var IdOptions = new List<int>() { 204, 857, 858, 859, 860, 861, 862, 863, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873 };
                for (int k = 0; k < IdOptions.Count; k++)
                {
                    int idOptAttrVal = IdOptions[k];
                    List<ReportOptionAttributeValue> dataLiquidites =
                        report.ReportOptionAttributeValue.Where(roav => roav.idOptionAttribute == idOptAttrVal)
                            .OrderBy(roav => roav.idReportOptionAttributeValue)
                            .ToList();
                    foreach (ReportOptionAttributeValue reportOptonAttrValue in dataLiquidites)
                    {
                        if (IsAnyDataAnd(reportOptonAttrValue, new string[] { "Description"/*, "CurrentValue"*/ }))
                        {
                            isAnyImmobJouissanceData = true;
                            break;
                        }
                    }
                }
                //----------------------------------

                //if ((!hasImmoJouissance || !hasDetailJouissance) && !pIsEmptyReport)
                //if ((!hasImmoJouissance || !isAnyImmobJouissanceData) && !pIsEmptyReport)  
                if(!pIsEmptyReport)
                {
                    if (hasImmoJouissance)
                    {
                        if (!isAnyImmobJouissanceData)
                        {
                            y += interline;
                            //Le client a-t-il de l'immobilier de joissance ?
                            BlockQuestion(y, x, 1283, 1284, "ClientPP_ParimoineFinancier_025");
                            y += interline + 5;
                            //Immobiler de joissance (en €)
                            BlockMontant(y, x, 791, "ClientPP_ParimoineFinancier_022");
                        }
                        else
                        {
                            y += interline;
                            yTmp = y;
                            pdfGen.CalculeZoneWithAutomaticNewPage(ref y, 3f * height);
                            if (y > 0)
                                y = yTmp;
                            GenerateImmobilierDeJouissanceTableFixIssue9985(pdfGen, report, ref y, pIsEmptyReport, rowPatImHeight);
                        }
                    }
                    else
                    {
                        y += interline;
                        //Le client a-t-il de l'immobilier de joissance ?
                        BlockQuestion(y, x, 1283, 1284, "ClientPP_ParimoineFinancier_025");                
                    }
                }else
                { //EMPY REPORT
                    y += interline;
                    //Le client a-t-il de l'immobilier de joissance ?
                    BlockQuestion(y, x, 1283, 1284, "ClientPP_ParimoineFinancier_025");
                    y += interline + 5;
                    //Immobiler de joissance (en €)
                    BlockMontant(y, x, 791, "ClientPP_ParimoineFinancier_022");

                    y += interline;
                    yTmp = y;
                    pdfGen.CalculeZoneWithAutomaticNewPage(ref y, 3f * height);
                    if (y > 0)
                        y = yTmp;
                    GenerateImmobilierDeJouissanceTableFixIssue9985(pdfGen, report, ref y, pIsEmptyReport, rowPatImHeight);
                }
                #endregion


                /*----------------------------------------------------
		        2 - Immobilier de rapport
		        ----------------------------------------------------*/
                #region "2 - Immobilier de rapport"
                if (IS_DEBUG && _listDebug.Any(px => px == key))
                {
                    Upsilab.Business.Log.Log.AppendException(new Exception(string.Format(trace, "2 - Immobilier de rapport", DateTime.Now.ToString("dd/MM/yyy HH:mm:ss"))));
                }

                const float rowImRapHeight = 25;
                y += interline + 10;
                x = padding_left;
                yTmp = y;
                pdfGen.CalculeZoneWithAutomaticNewPage(ref y, (3 * height)+40);
                if (y > 0)
                    y = yTmp;
                pdfGen.AddDefaultTextWithAutomaticNewPage(languageDataPP.GetContent("PdfReportPP_363"), ref y,
                    max_width, 40, x);
             
                
                x += 5;

                var hasImmoRapport = GetReportOptionValueByIdOption(1287, report) != null;
                var hasDetailRapport = GetReportOptionValueByIdOption(1289, report) != null;
                //Details immobilier de rapport  "oui"

                // -------------- test existence data
                bool isAnyImmobRapportData = false;
                IdOptions = new List<int>() { 205, 874, 875, 876 };
                for (int k = 0; k < IdOptions.Count; k++)
                {
                    int idOptAttrVal = IdOptions[k];
                    List<ReportOptionAttributeValue> dataLiquidites =
                        report.ReportOptionAttributeValue.Where(roav => roav.idOptionAttribute == idOptAttrVal)
                            .OrderBy(roav => roav.idReportOptionAttributeValue)
                            .ToList();
                    foreach (ReportOptionAttributeValue reportOptonAttrValue in dataLiquidites)
                    {
                        if (IsAnyDataAnd(reportOptonAttrValue, new string[] { "Description"/*, "CurrentValue"*/ }))
                        {
                            isAnyImmobRapportData = true;
                            break;
                        }
                    }
                }
                //----------------------------------

                //if ((!hasImmoRapport || !hasDetailRapport) && !pIsEmptyReport)
                //if ((!hasImmoRapport || !isAnyImmobRapportData) && !pIsEmptyReport)
                if (!pIsEmptyReport)
                {
                    if (hasImmoRapport)
                    {
                        if (!isAnyImmobRapportData)
                        {
                            y += interline;
                            //Le client a-t-il de l'immobilier de joissance ?
                            BlockQuestion(y, x, 1287, 1288, "ClientPP_ParimoineFinancier_027");
                            //Immobiler de rapport (en €)
                            y += interline;

                            BlockMontant(y, x, 792, "ClientPP_ParimoineFinancier_026");

                            y += interline;
                        }
                        else
                        {
                            y += interline;
                            GenerateImmobilierDeRapportTableFixIssue9985(pdfGen, report, ref y, pIsEmptyReport, rowImRapHeight, 0, 670);
                        }
                    }
                    else
                    {
                        y += interline;
                        //Le client a-t-il de l'immobilier de joissance ?
                        BlockQuestion(y, x, 1287, 1288, "ClientPP_ParimoineFinancier_027");
                    }
                }
                else
                { // EMPTY REPORT
                    y += interline;
                    //Le client a-t-il de l'immobilier de joissance ?
                    BlockQuestion(y, x, 1287, 1288, "ClientPP_ParimoineFinancier_027");
                    //Immobiler de rapport (en €)
                    y += interline;

                    BlockMontant(y, x, 792, "ClientPP_ParimoineFinancier_026");

                    y += interline;
                    GenerateImmobilierDeRapportTableFixIssue9985(pdfGen, report, ref y, pIsEmptyReport, rowImRapHeight, 0, 670);
                }

                #endregion
            }

            #endregion //"b ) Patrimoine immobilier"


            #region "c - Patrimoine professionnel"
            if (IS_DEBUG && _listDebug.Any(px => px == key))
            {
                Upsilab.Business.Log.Log.AppendException(new Exception(string.Format(trace, "c - Patrimoine professionnel", DateTime.Now.ToString("dd/MM/yyy HH:mm:ss"))));
            }

            const float rowPatFinHeight = 25;
            y = y + interline + 13;
            yTmp = y;
            pdfGen.CalculeZoneWithAutomaticNewPage(ref y, (40 + (2f * height)), y > 0 ? 670 : 0);
            if (y > 0)
                y = yTmp;

            pdfGen.AddTextBoldSubtitle(languageDataPP.GetContent("PdfReportPP_367"), y, max_width, 40,
                ChapiterPaddingLeft);

            x = 0;
            

            var hasImmoProfessionnel = GetReportOptionValueByIdOption(1291, report) != null;
            var hasDetailProfessionnel = GetReportOptionValueByIdOption(1293, report) != null;
            //Details immobilier professionnel  "oui"

            // -------------- test existence data
            bool isAnyPatriProfData = false;
            var optAttrs1 = GetOptionAttributesByDataType("patrimoineprofessionnel");
            var IdOptions1 = new HashSet<int>(optAttrs1.Select(t => t.idOptionAttribute)).ToList();
            for (int k = 0; k < IdOptions1.Count; k++)
            {
                int idOptAttrVal = IdOptions1[k];
                List<ReportOptionAttributeValue> dataLiquidites =
                    report.ReportOptionAttributeValue.Where(roav => roav.idOptionAttribute == idOptAttrVal)
                        .OrderBy(roav => roav.idReportOptionAttributeValue)
                        .ToList();
                foreach (ReportOptionAttributeValue reportOptonAttrValue in dataLiquidites)
                {
                    if (IsAnyDataAnd(reportOptonAttrValue, new string[] { "Description"/*, "OwnedCapital"*/ }))
                    {
                        isAnyPatriProfData = true;
                        break;
                    }
                }
            }
            //----------------------------------

            //if ((!hasImmoProfessionnel || !hasDetailProfessionnel) && !pIsEmptyReport)
            //if ((!hasImmoProfessionnel || !isAnyPatriProfData) && !pIsEmptyReport)
            if (!pIsEmptyReport)
            {
                if (hasImmoProfessionnel)
                {
                    if (!isAnyPatriProfData)
                    {
                        y += interline;
                        BlockQuestion(y, x, 1291, 1292, "ClientPP_ParimoineFinancier_030");
                        //Patrimoine divers (en €)
                        y += interline;

                        BlockMontant(y, x, 793, "ClientPP_ParimoineFinancier_029");

                        y += interline;
                    }
                    else
                    {
                        y = y + interline;
                        yTmp = y;

                        pdfGen.CalculeZoneWithAutomaticNewPage(ref y, 3f * height);
                        if (y > 0)
                            y = yTmp;
                        GeneratePatrimoineProfessionnelTableFixIssue9985(pdfGen, report, ref y, pIsEmptyReport);
                    }
                }
                else
                {
                    y += interline;
                    BlockQuestion(y, x, 1291, 1292, "ClientPP_ParimoineFinancier_030");
                }
            }
            else
            { // EMPTY REPORT
                y += interline;
                BlockQuestion(y, x, 1291, 1292, "ClientPP_ParimoineFinancier_030");
                //Patrimoine divers (en €)
                y += interline;

                BlockMontant(y, x, 793, "ClientPP_ParimoineFinancier_029");

                y += interline;
                yTmp = y;

                pdfGen.CalculeZoneWithAutomaticNewPage(ref y, 3f * height);
                if (y > 0)
                    y = yTmp;
                GeneratePatrimoineProfessionnelTableFixIssue9985(pdfGen, report, ref y, pIsEmptyReport);
            }

            #endregion //"c - Patrimoine professionnel"

            y = y + interline + 10;
            yTmp = y;
            pdfGen.CalculeZoneWithAutomaticNewPage(ref y, 90);
            if (y > 0)
                y = yTmp;

            pdfGen.AddReferenceWithZone(languageDataPP.GetContent("PdfReportPP_369"), ref y, max_width, 10);
            y += textInterline;
            pdfGen.AddReferenceWithZone(languageDataPP.GetContent("PdfReportPP_370"), ref y, max_width, 40);
            y += textInterline * 4;
            pdfGen.AddReferenceWithZone(languageDataPP.GetContent("PdfReportPP_371"), ref y, max_width, 10, 10);
            y += textInterline;
            pdfGen.AddReferenceWithZone(languageDataPP.GetContent("PdfReportPP_372"), ref y, max_width, 30, 10);
            y += textInterline * 1.5f;
            pdfGen.AddReferenceWithZone(languageDataPP.GetContent("PdfReportPP_372_2"), ref y, max_width, 30, 10);
            y += textInterline;
            pdfGen.AddReferenceWithZone(languageDataPP.GetContent("PdfReportPP_372_3"), ref y, max_width, 30, 10);

            y = y + interline + 5;
            yTmp = y;
            pdfGen.CalculeZoneWithAutomaticNewPage(ref y, 30);
            if (y > 0)
                y = yTmp;

            pdfGen.AddReferenceWithZone(languageDataPP.GetContent("PdfReportPP_364"), ref y, max_width, 10);
            y += textInterline;
            pdfGen.AddReferenceWithZone(languageDataPP.GetContent("PdfReportPP_365"), ref y, max_width, 10);
            y += textInterline;
            pdfGen.AddReferenceWithZone(languageDataPP.GetContent("PdfReportPP_366"), ref y, max_width, 10);

            #endregion  //"II. Patrimoine"

            y += interline*2f;

            /******************* II - DIVERS **********************/
            #region "III. Divers"
            if (IS_DEBUG && _listDebug.Any(px => px == key))
            {
                Upsilab.Business.Log.Log.AppendException(new Exception(string.Format(trace, "III. Divers", DateTime.Now.ToString("dd/MM/yyy HH:mm:ss"))));
            }
            const float rowDiversHeight = 25;
            pdfGen.AddSubtitleWithAutomaticNewPage(languageDataPP.GetContent("PdfReportPP_368"), ref y, max_width,
                height);
            //GenerateTablePatrimoineDivers(pdfGen, report, y += paddingAfterParagraph);

            x = 0;
            



            var hasDiversImmo = GetReportOptionValueByIdOption(1295, report) != null;
            var hasDetailDiversImmo = GetReportOptionValueByIdOption(1297, report) != null;

            // -------------- test existence data
            PageLanguageHelper globalLanguageData = PageLanguageHelper.GetLanguageContent("User", "ClientPP_Revenue");
            bool isAnyDiversData = false;
            var optAttrs2 = GetOptionAttributesByDataType("driver");
            var IdOptions2 = new HashSet<int>(optAttrs2.Select(t => t.idOptionAttribute)).ToList();
            for (int k = 0; k < IdOptions2.Count; k++)
            {
                int idOptAttrVal = IdOptions2[k];
                List<ReportOptionAttributeValue> dataLiquidites =
                    report.ReportOptionAttributeValue.Where(roav => roav.idOptionAttribute == idOptAttrVal)
                        .OrderBy(roav => roav.idReportOptionAttributeValue)
                        .ToList();
                foreach (ReportOptionAttributeValue reportOptonAttrValue in dataLiquidites)
                {
                    bool isAnydataInt = IsAnyDataAnd(reportOptonAttrValue, new string[] { /*"CurrentValue", "Active"*/ }); // old criteria
                    if (!isAnydataInt)
                    {
                        isAnydataInt = IsAnyDataAnd(reportOptonAttrValue, new string[] { /*"CurrentValue",*/ "Designation" });
                    }
                    if (!isAnydataInt)
                    {
                        int idOptionAttribute = 0;
                        Int32.TryParse(Convert.ToString(reportOptonAttrValue.idOptionAttribute), out idOptionAttribute);
                        var obj = ReportOptionBL.GetOptionAttributeById(idOptionAttribute);
                        string designation = string.Empty;
                        if (obj != null)
                        {
                            designation = globalLanguageData.GetContent(obj.NameKey);
                        }
                        isAnydataInt = !string.IsNullOrEmpty(designation);
                    }
                    if (isAnydataInt)
                    {
                        isAnyDiversData = true;
                        break;
                    }
                }
            }
            //----------------------------------

            //if ((!hasDiversImmo || !hasDetailDiversImmo) && !pIsEmptyReport)
            //if ((!hasDiversImmo || !isAnyDiversData) && !pIsEmptyReport)
            if (!pIsEmptyReport)
            {
                if (hasDiversImmo)
                {
                    if (!isAnyDiversData)
                    {
                        y += interline;
                        BlockQuestion(y, x, 1295, 1296, "ClientPP_ParimoineFinancier_033");
                        //Patrimoine divers (en €)
                        y += interline;
                        BlockMontant(y, x, 794, "ClientPP_ParimoineFinancier_032");

                        y += interline;
                    }
                    else
                    {
                        y += interline;
                        GenerateTablePatrimoineDiversFixIssue9985(pdfGen, report, ref y, pIsEmptyReport, rowDiversHeight, 0, 0);
                    }
                }
                else
                {
                    y += interline;
                    BlockQuestion(y, x, 1295, 1296, "ClientPP_ParimoineFinancier_033");
                }
            }
            else
            { // EMPTY REPORT
                y += interline;
                BlockQuestion(y, x, 1295, 1296, "ClientPP_ParimoineFinancier_033");
                //Patrimoine divers (en €)
                y += interline;
                BlockMontant(y, x, 794, "ClientPP_ParimoineFinancier_032");

                y += interline;
                GenerateTablePatrimoineDiversFixIssue9985(pdfGen, report, ref y, pIsEmptyReport, rowDiversHeight, 0, 0);
            }

            #endregion
        }