Exemple #1
0
        public static void PrintDistributionDocument(DistributionDocument dd)
        {
            string      brokerName = BrokerHouseInformation.GetBrokerHouseName();
            PDFCreators creator    = new PDFCreators(true, 25, 25, 15, 15);

            creator.SetDocumentHeaderFooter();
            creator.OpenPDF();
            creator.GetContentByte();
            creator.AddJDBLogoForFactures(10, 775);
            creator.SetTitleLeft8(" ");
            creator.SetTitleLeft8(" ");
            creator.SetTitleLeft8(" ");
            creator.SetTitleLeft8(" ");

            creator.SetTitleLeft8("  ");
            if (dd.DistributionDocType.Code == DistributionDocType.ISPRATNICA)
            {
                creator.SetTitleCenterForFactureNumber("ИСПРАТНИЦА " + dd.DocumentNumber);
                creator.SetTitleLeftWithFontSize10("за филијала " + dd.Branch.Code + " " + dd.Branch.Name);
            }
            else if (dd.DistributionDocType.Code == DistributionDocType.POVRATNICA)
            {
                creator.SetTitleCenterForFactureNumber("ПОВРАТНИЦА " + dd.DocumentNumber);
                creator.SetTitleLeftWithFontSize10("од филијала " + dd.Branch.Code + " " + dd.Branch.Name);
            }
            else if (dd.DistributionDocType.Code == DistributionDocType.PRIEM)
            {
                creator.SetTitleCenterForFactureNumber("ПРИЕМ " + dd.DocumentNumber);
            }
            creator.SetTitleLeft10("Датум: " + dd.DocumentDate.ToShortDateString());

            List <DistributionDocumentItem> lstDDI = DistributionDocumentItem.GetByDistributionDocument(dd.ID);

            string[]   headers          = { "Ред. бр.", "Број на полиса", "Осиг. компанија", "Тип на осигурување", "Под на осигурување" };
            float[]    widthPercentages = { 8, 17, 25, 25, 25 };
            TypeCode[] typeCodes        = { TypeCode.Int32, TypeCode.String, TypeCode.String, TypeCode.String, TypeCode.String };
            creator.CreateTable_Facture(headers.Length, headers, widthPercentages);
            int counter = 1;

            foreach (DistributionDocumentItem ddi in lstDDI)
            {
                object[] values;
                values    = new object[headers.Length];
                values[0] = counter;
                values[1] = ddi.Distribution.PolicyNumber;
                values[2] = ddi.Distribution.InsuranceCompany.ShortName;
                values[3] = ddi.Distribution.InsuranceSubType.InsuranceType.ShortName;
                values[4] = ddi.Distribution.InsuranceSubType.ShortDescription;
                creator.AddDataRowForFacturesExtend(values, headers.Length, typeCodes, headers, widthPercentages);
                counter++;
            }
            creator.AddTable();
            creator.SetTitleLeft8(" ");
            creator.SetTitleLeft8("              Издал                                                                                                                                                                           Примил");
            creator.SetTitleLeft8(" ");
            creator.SetTitleLeft8("_________________________                                                                                                                                     ____________________");
            creator.FinishPDF_FileName("IspratnicaPovratnica" + dd.DocumentNumber);
        }
Exemple #2
0
        public static void PrintBillInfoForPolicy(PolicyItem pi)
        {
            string      brokerName = BrokerHouseInformation.GetBrokerHouseName();
            PDFCreators creator    = new PDFCreators(true, 25, 25, 15, 15);

            creator.SetDocumentHeaderFooter();
            creator.OpenPDF();
            creator.GetContentByte();
            creator.AddJDBLogoForFactures(10, 775);
            creator.SetTitleLeft8(" ");
            creator.SetTitleLeft8(" ");
            creator.SetTitleLeft8(" ");
            creator.SetTitleLeft8(" ");
            creator.SetTitleLeft8("   Жиро-сметка :  " + Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.ZIRO_SMETKA).Value);
            creator.SetTitleLeft8("   Депонент :  " + Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.DEPONENT).Value);
            creator.SetTitleLeft8("   ЕДБ :   " + Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.EDB).Value + "       " + "Матичен број :  " + Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.MATICEN_BROJ).Value);

            creator.SetTitleLeft8("  ");
            creator.SetTitle("ПОТВРДА");
            creator.SetTitle("(за продадена полиса)");
            creator.SetTitle("Полиса бр. " + pi.PolicyNumber);
            creator.SetTitleLeft8("  ");
            creator.SetTitleLeftWithFontSize10(ConvertToMacedonian.ConvertToMACEDONIAN(pi.Policy.Client.Name).ToUpper());
            creator.SetTitleLeftWithFontSize10(ConvertToMacedonian.ConvertToMACEDONIAN(pi.Policy.Client.Address).ToUpper());
            creator.SetTitleLeftWithFontSize10(ConvertToMacedonian.ConvertToMACEDONIAN(pi.Policy.Client.Place.Municipality.Name).ToUpper());
            creator.SetTitleLeft10("Датум на полиса: " + pi.Policy.ApplicationDate.ToShortDateString());
            string nacinNaPlakanje = "";

            if (pi.IsPaidInBrokerHouse)
            {
                nacinNaPlakanje = "ЕДНОКРАТНО";
                List <Rate> lstRates = Rate.GetByPolicyItemID(pi.ID);
                if (lstRates.Count > 1)
                {
                    nacinNaPlakanje = "НА РАТИ";
                }
            }
            else
            {
                nacinNaPlakanje = "ДИРЕКТНО ВО ОСИГУРИТЕЛНА КОМПАНИЈА";
            }
            creator.SetTitleLeft10("Начин на плаќање на полиса: " + nacinNaPlakanje);

            string[]   headers          = { "Ред. бр.", "Број на полиса", "Осиг. компанија", "Тип на осигурување", "Премија" };
            float[]    widthPercentages = { 8, 17, 30, 30, 15 };
            TypeCode[] typeCodes        = { TypeCode.Int32, TypeCode.String, TypeCode.String, TypeCode.String, TypeCode.Decimal };
            creator.CreateTable_Facture(headers.Length, headers, widthPercentages);
            object[] values;
            values    = new object[headers.Length];
            values[0] = "1";
            values[1] = pi.PolicyNumber;
            values[2] = pi.Policy.InsuranceCompany.ShortName;
            values[3] = pi.InsuranceSubType.ShortDescription;
            values[4] = String.Format("{0:#,0.00}", pi.PremiumValue) + " ДЕН.";
            creator.AddDataRowForFactures(values, headers.Length, typeCodes);
            values    = new object[headers.Length];
            values[0] = "";
            values[1] = "";
            values[2] = "";
            values[3] = "Вкупно";
            values[4] = String.Format("{0:#,0.00}", pi.PremiumValue) + " ДЕН.";
            creator.AddDataRowForFactures(values, headers.Length, typeCodes);
            creator.AddTable();
            creator.SetTitleLeftBold14(" ");
            creator.SetTitleLeftItalic10("Со букви: " + NumberToTextController.Konvertiranje(pi.PremiumValue));
            creator.SetTitleLeft8(" ");
            creator.SetTitleLeft10("Согласно со член 23, точка 6 од Законот за ДДВ дејноста осигурување е ослободена од плаќање данок без право на одбиток на претходниот данок.");
            creator.SetTitleLeft8(" ");
            creator.SetTitleLeft8(" ");
            creator.SetTitleLeft8(" ");
            creator.SetTitleLeft8(" ");
            creator.SetTitleLeft8("         " + brokerName + "                                                                                                                           ДОГОВОРУВАЧ");
            creator.SetTitleLeft8(" ");
            creator.SetTitleLeft8("_________________________                                                                                                           ____________________");
            creator.FinishPDF_FileName("Potvrda" + pi.PolicyNumber);
        }
Exemple #3
0
        public static void PrintLifePolicyReportController(DateTime fromDate, DateTime toDate)
        {
            PDFCreators creator = new PDFCreators(true, 10, 10, 15, 15);

            creator.SetDocumentHeaderFooter();
            creator.OpenPDF();
            creator.GetContentByte();
            creator.SetTitleLeftWithFontSize10("ИЗВЕШТАЈ ЗА ЖИВОТНО ОСИГУРУВАЊЕ");

            List <LifePolicy> lstLifePolicies = LifePolicy.GetUndiscardedInPeriod(fromDate, toDate);
            //GetNumberOfBrokerageYears
            int numberOfYearBrok = 4;

            foreach (LifePolicy lp in lstLifePolicies)
            {
                List <LifePolicyBrokerage> lstLPB = LifePolicyBrokerage.GetByLifePolicy(lp.ID);
                if (lstLPB.Count > numberOfYearBrok)
                {
                    numberOfYearBrok = lstLPB.Count;
                }
            }
            int totHeadersCount = 9 + numberOfYearBrok;

            string[] headers = new string[totHeadersCount];
            headers[0] = "Р.б.";
            headers[1] = "Полиса бр.";
            headers[2] = "Понуда бр.";
            headers[3] = "Датум на продажба";
            headers[4] = "Годишна премија (живот)";
            headers[5] = "Годишна премија (незгода)";
            headers[6] = "Годишна премија";
            headers[7] = "Вкупна премија";
            for (int i = 0; i < numberOfYearBrok; i++)
            {
                headers[8 + i] = "Брокеража за " + (i + 1) + " година";
            }
            headers[totHeadersCount - 1] = "Вкупна брокеража";

            float[] widthPercentages = new float[totHeadersCount];
            widthPercentages[0] = 4;
            widthPercentages[1] = 8;
            widthPercentages[2] = 6;
            widthPercentages[3] = 10;
            widthPercentages[4] = 7;
            widthPercentages[5] = 7;
            widthPercentages[6] = 7;
            widthPercentages[7] = 7;
            float perc = (float)36 / (float)numberOfYearBrok;

            for (int i = 0; i < numberOfYearBrok; i++)
            {
                widthPercentages[8 + i] = perc;
            }
            widthPercentages[totHeadersCount - 1] = 8;
            TypeCode[] typeCodes = new TypeCode[totHeadersCount];
            typeCodes[0] = TypeCode.Int32;
            typeCodes[1] = TypeCode.String;
            typeCodes[2] = TypeCode.String;
            typeCodes[3] = TypeCode.DateTime;
            typeCodes[4] = TypeCode.Decimal;
            typeCodes[5] = TypeCode.Decimal;
            typeCodes[6] = TypeCode.Decimal;
            typeCodes[7] = TypeCode.Decimal;
            for (int i = 0; i < numberOfYearBrok; i++)
            {
                typeCodes[8 + i] = TypeCode.Decimal;
            }
            typeCodes[totHeadersCount - 1] = TypeCode.Decimal;
            creator.CreateTableWithFontSize(headers.Length, headers, widthPercentages, 8);
            object[] values;
            int      counter = 1;
            decimal  totalYearlyPremiumValueForLife     = 0;
            decimal  totalYearlyPremiumValueForAccident = 0;
            decimal  totalYearlyPremiumValue            = 0;
            decimal  totalTotalPremumValue = 0;
            decimal  totalBrokerage        = 0;
            Dictionary <int, decimal> totalBrokValuesPerYear = new Dictionary <int, decimal>();

            foreach (LifePolicy lp in lstLifePolicies)
            {
                values    = new object[headers.Length];
                values[0] = counter;
                values[1] = lp.PolicyNumber;
                values[2] = lp.OfferNumber;
                values[3] = lp.ApplicationDate.ToShortDateString();
                values[4] = String.Format("{0:#,0.00}", lp.YearlyPremiumValueForLife);
                totalYearlyPremiumValueForLife += lp.YearlyPremiumValueForLife;
                values[5] = String.Format("{0:#,0.00}", lp.YearlyPremiumValueForAccident);
                totalYearlyPremiumValueForAccident += lp.YearlyPremiumValueForAccident;
                values[6] = String.Format("{0:#,0.00}", (lp.YearlyPremiumValueForAccident + lp.YearlyPremiumValueForLife));
                totalYearlyPremiumValue += (lp.YearlyPremiumValueForAccident + lp.YearlyPremiumValueForLife);
                values[7]              = String.Format("{0:#,0.00}", lp.TotalPremumValue);
                totalTotalPremumValue += lp.TotalPremumValue;
                List <LifePolicyBrokerage> lstLPBrok = LifePolicyBrokerage.GetByLifePolicy(lp.ID);
                decimal totalBrokeragePerPolicy      = 0;
                for (int j = 0; j < lstLPBrok.Count; j++)
                {
                    values[8 + j]            = String.Format("{0:#,0.00}", lstLPBrok[j].Value);
                    totalBrokeragePerPolicy += lstLPBrok[j].Value;
                    if (!totalBrokValuesPerYear.Keys.Contains(j))
                    {
                        totalBrokValuesPerYear.Add(j, lstLPBrok[j].Value);
                    }
                    else
                    {
                        totalBrokValuesPerYear[j] += lstLPBrok[j].Value;
                    }
                }
                values[totHeadersCount - 1] = String.Format("{0:#,0.00}", totalBrokeragePerPolicy);
                totalBrokerage += totalBrokeragePerPolicy;
                creator.AddDataRowForFactures(values, headers.Length, typeCodes);
                counter++;
            }
            values    = new object[headers.Length];
            values[0] = "";
            values[1] = "";
            values[2] = "";
            values[3] = "Вкупно";
            values[4] = String.Format("{0:#,0.00}", totalYearlyPremiumValueForLife);
            values[5] = String.Format("{0:#,0.00}", totalYearlyPremiumValueForAccident);
            values[6] = String.Format("{0:#,0.00}", totalYearlyPremiumValue);
            values[7] = String.Format("{0:#,0.00}", totalTotalPremumValue);
            int k = 0;

            foreach (KeyValuePair <int, decimal> kvp in totalBrokValuesPerYear)
            {
                values[8 + k] = String.Format("{0:#,0.00}", kvp.Value);
                k++;
            }
            values[totHeadersCount - 1] = String.Format("{0:#,0.00}", totalBrokerage);
            creator.AddDataRowForFactures(values, headers.Length, typeCodes);
            creator.AddTable();
            creator.FinishPDF_FileName("IzvestajZaZivotnoOsiguruvanje");
        }
Exemple #4
0
        public static void PrintAnex(Policy p)
        {
            List <Rate> ratesForPrint = Rate.GetByPolicyItemID(p.PolicyItems[0].ID);

            Broker.DataAccess.Facture f = PolicyItemFactureItem.GetByPolicyItemID(p.PolicyItems[0].ID);
            PDFCreators creator         = new PDFCreators(true, 25, 25, 15, 15);

            creator.SetDocumentHeaderFooter();
            creator.OpenPDF();
            creator.GetContentByte();
            creator.AddJDBLogoForFactures(10, 775);
            creator.SetTitleLeft8(" ");
            creator.SetTitleLeft8(" ");
            creator.SetTitleLeft8(" ");
            creator.SetTitleLeft8(" ");
            creator.SetTitleLeft8("   Жиро-сметка :  " + Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.ZIRO_SMETKA).Value);
            creator.SetTitleLeft8("   Депонент :  " + Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.DEPONENT).Value);
            creator.SetTitleLeft8("   ЕДБ :   " + Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.EDB).Value + "       " + "Матичен број :  " + Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.MATICEN_BROJ).Value);
            creator.SetTitleLeft8("  ");
            creator.SetTitleLeft8("Договорувач " + p.Client.Name + "                                                                                                             " + "Експозитура " + p.Branch.Name);
            creator.SetTitleLeft8("  ");
            creator.SetTitle("ДОГОВОР " + p.PolicyItems[0].PolicyNumber);
            creator.SetTitle("за плаќање на должна премија за осигурување");
            creator.SetTitle("(плаќање на рати)");
            creator.SetTitleLeft8("  ");
            creator.SetTitleLeft8("  ");
            creator.SetTitleLeft8("1.Премијата за осигурување ќе се плати на рати, како што следи:");
            string[]   headersRates          = { "Реден број", "Рок за плаќање", "Полиса", "Фактура број", "Износ" };
            float[]    widthPercentagesRates = { 10, 25, 25, 20, 20 };
            TypeCode[] typeCodesRates        = { TypeCode.Int32, TypeCode.String, TypeCode.String, TypeCode.String, TypeCode.Decimal };
            creator.CreateTable_Facture(headersRates.Length, headersRates, widthPercentagesRates);
            ratesForPrint = ratesForPrint.OrderBy(c => c.Date).ToList();
            int counter = 1;

            foreach (Rate r in ratesForPrint)
            {
                object[] valuesRates = new object[headersRates.Length];
                valuesRates[0] = counter;
                valuesRates[1] = r.Date.ToShortDateString();
                valuesRates[2] = r.PolicyItem.PolicyNumber;
                if (f != null)
                {
                    valuesRates[3] = f.FactureNumber;
                }
                else
                {
                    valuesRates[3] = "";
                }
                valuesRates[4] = String.Format("{0:#,0.00}", r.Value) + " ДЕН.";
                creator.AddDataRowForFactures(valuesRates, headersRates.Length, typeCodesRates);
                counter++;
            }
            object[] values = new object[headersRates.Length];
            values[0] = "";
            values[1] = "";
            values[2] = "";
            values[3] = "Вкупно";
            values[4] = String.Format("{0:#,0.00}", p.PolicyItems[0].PremiumValue) + " ДЕН.";
            creator.AddDataRowForFactures(values, headersRates.Length, typeCodesRates);
            creator.AddTable();
            creator.SetTitleLeft8("2.Доколку настане осигуран случај - штета, независно од тоа што е договорено плаќање на рати, премијата за осигурување стасува за наплата веднаш до висината на надоместокот што треба да се исплати и ќе се наплати по пат на компензација.");
            creator.SetTitleLeft8("3.Ако премијата не се плати во договорените рокови од овој Договор, ќе се пресметува камата.");
            creator.SetTitleLeft8("4.Договорот е составен од три еднообразни примероци, од кои еден за осигуреникот, а два за осигурувачот.");
            creator.SetTitle(" ");
            creator.SetTitle(" ");
            if (f != null)
            {
                creator.SetTitleCenter8("Во " + f.User.Branch.Municipality.Name + " на " + f.DateOfCreation.ToShortDateString());
            }
            else
            {
                creator.SetTitleCenter8("Во " + p.Branch.Municipality.Name + " на " + p.ApplicationDate.ToShortDateString());
            }
            creator.SetTitle(" ");
            creator.SetTitle(" ");
            string brokerName = BrokerHouseInformation.GetBrokerHouseName();

            creator.SetTitleLeft8("         " + brokerName + "                                                                                                                           ДОГОВОРУВАЧ");
            creator.SetTitleLeft8(" ");
            creator.SetTitleLeft8("_________________________                                                                                                           ____________________");
            creator.FinishPDF_FileName("Aneks" + p.PolicyItems[0].PolicyNumber);
        }
Exemple #5
0
        public static void PrintFacture(Broker.DataAccess.Facture f)
        {
            string brokerName = BrokerHouseInformation.GetBrokerHouseName();

            if (f.DocumentSubType.Code == DocumentSubType.FAKTURA_PROVIZIJA || f.DocumentSubType.Code == DocumentSubType.IZLEZNA_FAKTURA_ZA_PROVZIJA_ZA_ZIVOTNO_OSUGURUVANjE)
            {
                PDFCreators creator = new PDFCreators(true, 25, 25, 15, 15);
                creator.SetDocumentHeaderFooter();
                creator.OpenPDF();
                creator.GetContentByte();
                creator.AddJDBLogoForFactures(10, 775);
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft8(" ");
                if (f.DocumentSubType.Code == DocumentSubType.FAKTURA_PROVIZIJA)
                {
                    creator.SetTitleLeft8("   Жиро-сметка :  " + Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.ZIRO_SMETKA_ZA_OSIG_KOMPANII).Value);
                }
                else if (f.DocumentSubType.Code == DocumentSubType.FAKTURA_KLIENT)
                {
                    creator.SetTitleLeft8("   Жиро-сметка :  " + Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.ZIRO_SMETKA).Value);
                }
                creator.SetTitleLeft8("   Депонент :  " + Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.DEPONENT).Value);
                creator.SetTitleLeft8("   ЕДБ :   " + Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.EDB).Value + "       " + "Матичен број :  " + Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.MATICEN_BROJ).Value);

                creator.SetTitleLeft8("  ");
                if (f.Discard)
                {
                    creator.SetTitleCenterForFactureNumber("СТОРНИРАНА Ф-ра бр. " + f.FactureNumber);
                }
                else
                {
                    creator.SetTitleCenterForFactureNumber("Фактура бр. " + f.FactureNumber);
                }
                string internalCode = "";
                try
                {
                    FinansovoDataClassesDataContext fdc = new FinansovoDataClassesDataContext();
                    List <Client> listCLients           = fdc.Clients.Where(c => c.EMBG == f.Client.EMBG).ToList();
                    if (listCLients.Count > 0)
                    {
                        internalCode = listCLients[0].Code;
                    }
                }
                catch { }
                if (internalCode != string.Empty)
                {
                    creator.SetTitleLeftWithFontSize10(internalCode);
                }
                creator.SetTitleLeftWithFontSize10(ConvertToMacedonian.ConvertToMACEDONIAN(f.Client.Name).ToUpper());
                creator.SetTitleLeftWithFontSize10(ConvertToMacedonian.ConvertToMACEDONIAN(f.Client.Address).ToUpper());
                //creator.SetTitleLeftWithFontSize10(ConvertToMacedonian.ConvertToMACEDONIAN(f.Client.Place.Municipality.Name).ToUpper());
                creator.SetTitleLeftWithFontSize10(ConvertToMacedonian.ConvertToMACEDONIAN(f.Client.Place.Name).ToUpper());
                creator.SetTitleLeft10("Датум на фактура: " + f.DateOfCreation.ToShortDateString());
                creator.SetTitleLeft10("Рок на плаќање: " + f.DateOfPayment.ToShortDateString());
                //creator.SetTitleLeft8("Период: " + f.FromDate.ToShortDateString() + " - " + f.ToDate.ToShortDateString());

                string[]   headers          = { "Ред. бр.", "Опис", "Количина", "Премија", "Брокеража" };
                float[]    widthPercentages = { 8, 45, 15, 17, 15 };
                TypeCode[] typeCodes        = { TypeCode.Int32, TypeCode.String, TypeCode.Int32, TypeCode.Decimal, TypeCode.Decimal };
                creator.CreateTable_Facture(headers.Length, headers, widthPercentages);
                object[] values;
                foreach (FactureItem fi in f.FactureItems)
                {
                    values    = new object[headers.Length];
                    values[0] = fi.Number.ToString();
                    values[1] = fi.Description;
                    values[2] = fi.Count.ToString();
                    values[3] = String.Format("{0:#,0.00}", fi.PremiumValue);
                    values[4] = String.Format("{0:#,0.00}", fi.BrokerageValue);
                    creator.AddDataRowForFactures(values, headers.Length, typeCodes);
                }
                values    = new object[headers.Length];
                values[0] = "";
                values[1] = "";
                values[2] = "";
                values[3] = "Вкупно";
                values[4] = String.Format("{0:#,0.00}", f.BrokerageValue);
                creator.AddDataRowForFactures(values, headers.Length, typeCodes);
                creator.AddTable();
                creator.SetTitleLeftBold14(" ");
                creator.SetTitleLeftItalic10("Со букви: " + NumberToTextController.Konvertiranje(f.BrokerageValue));
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft10("Ве молиме фактурираниот износ да го платите до назначениот рок на плаќање.");
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft10("Доколку износот за фактурата не биде платен до наведениот датум, се пресметува затезна камата од денот на стасаност до денот на плаќањето.");
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft10("Согласно со член 23, точка 6 од Законот за ДДВ дејноста осигурување е ослободена од плаќање данок без право на одбиток на претходниот данок.");
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft10("                          Фактурирал                                              Примил                                                           Одобрил");
                creator.SetTitleLeft10("                    _________________                            __________________                                  ____________________");

                creator.AddPage();
                creator.SetTitleCenterForFactureNumber("Спецификација за фактура бр. " + f.FactureNumber);
                string[]   headersSpecifications          = { "Ред. бр.", "Број на полиса", "Почеток", "Истек", "Дата на издавање", "Премија" };
                float[]    widthPercentagesSpecifications = { 10, 20, 19, 19, 19, 13 };
                TypeCode[] typeCodesSpecifications        = { TypeCode.Int32, TypeCode.String, TypeCode.String, TypeCode.String, TypeCode.String, TypeCode.Decimal };
                object[]   valuesSpecifications;
                foreach (FactureItem fi in f.FactureItems)
                {
                    creator.SetTitleLeft10Bold(fi.InsuranceSubType.Description);
                    creator.CreateTable_Facture(headersSpecifications.Length, headersSpecifications, widthPercentagesSpecifications);
                    if (f.DocumentSubType.Code == DocumentSubType.FAKTURA_PROVIZIJA)
                    {
                        List <PolicyItemFactureItem> pifiList = PolicyItemFactureItem.GetByFactureItemID(fi.ID);
                        int ordinalNumber = 1;
                        foreach (PolicyItemFactureItem pifi in pifiList)
                        {
                            valuesSpecifications    = new object[6];
                            valuesSpecifications[0] = ordinalNumber;
                            valuesSpecifications[1] = pifi.PolicyItem.PolicyNumber;
                            valuesSpecifications[2] = pifi.PolicyItem.Policy.StartDate.ToShortDateString();
                            valuesSpecifications[3] = pifi.PolicyItem.Policy.EndDate.ToShortDateString();
                            valuesSpecifications[4] = pifi.PolicyItem.Policy.ApplicationDate.ToShortDateString();
                            valuesSpecifications[5] = pifi.PolicyItem.PremiumValue;
                            creator.AddDataRowForFacturesExtend(valuesSpecifications, headersSpecifications.Length, typeCodesSpecifications, headersSpecifications, widthPercentagesSpecifications);
                            ordinalNumber++;
                        }
                    }
                    if (f.DocumentSubType.Code == DocumentSubType.IZLEZNA_FAKTURA_ZA_PROVZIJA_ZA_ZIVOTNO_OSUGURUVANjE)
                    {
                        List <LifePolicyFactureItem> pifiList = LifePolicyFactureItem.GetByFactureItemID(fi.ID);
                        int ordinalNumber = 1;
                        foreach (LifePolicyFactureItem pifi in pifiList)
                        {
                            valuesSpecifications    = new object[6];
                            valuesSpecifications[0] = ordinalNumber;
                            valuesSpecifications[1] = pifi.LifePolicy.PolicyNumber;
                            valuesSpecifications[2] = pifi.LifePolicy.StartDate.ToShortDateString();
                            valuesSpecifications[3] = pifi.LifePolicy.EndDate.ToShortDateString();
                            valuesSpecifications[4] = pifi.LifePolicy.ApplicationDate.ToShortDateString();
                            valuesSpecifications[5] = pifi.LifePolicy.TotalPremumValue;
                            creator.AddDataRowForFacturesExtend(valuesSpecifications, headersSpecifications.Length, typeCodesSpecifications, headersSpecifications, widthPercentagesSpecifications);
                            ordinalNumber++;
                        }
                    }
                    creator.AddTable();
                    creator.SetTitleCenterForFactureNumber(" ");
                }

                creator.FinishPDF_FileName("Factura" + f.FactureNumber);
            }
            if (f.DocumentSubType.Code == DocumentSubType.FAKTURA_KLIENT)
            {
                PDFCreators creator = new PDFCreators(true, 25, 25, 15, 15);
                creator.SetDocumentHeaderFooter();
                creator.OpenPDF();
                creator.GetContentByte();
                creator.AddJDBLogoForFactures(10, 775);
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft8("   Жиро-сметка :  " + Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.ZIRO_SMETKA).Value);
                creator.SetTitleLeft8("   Депонент :  " + Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.DEPONENT).Value);
                creator.SetTitleLeft8("   ЕДБ :   " + Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.EDB).Value + "       " + "Матичен број :  " + Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.MATICEN_BROJ).Value);
                creator.SetTitleLeft8("  ");
                if (f.Discard)
                {
                    creator.SetTitleCenterForFactureNumber("СТОРНИРАНА Ф-ра бр. " + f.FactureNumber);
                }
                else
                {
                    creator.SetTitleCenterForFactureNumber("Фактура бр. " + f.FactureNumber);
                }
                string internalCode = "";
                try
                {
                    FinansovoDataClassesDataContext fdc = new FinansovoDataClassesDataContext();
                    List <Client> listCLients           = fdc.Clients.Where(c => c.EMBG == f.Client.EMBG).ToList();
                    if (listCLients.Count > 0)
                    {
                        internalCode = listCLients[0].Code;
                    }
                }
                catch { }
                if (internalCode != string.Empty)
                {
                    creator.SetTitleLeftWithFontSize10(internalCode);
                }
                creator.SetTitleLeftWithFontSize10(ConvertToMacedonian.ConvertToMACEDONIAN(f.Client.Name).ToUpper());
                creator.SetTitleLeftWithFontSize10(ConvertToMacedonian.ConvertToMACEDONIAN(f.Client.Address).ToUpper());
                creator.SetTitleLeftWithFontSize10(ConvertToMacedonian.ConvertToMACEDONIAN(f.Client.Place.Municipality.Name).ToUpper());
                creator.SetTitleLeft10("Датум на фактура: " + f.DateOfCreation.ToShortDateString());
                creator.SetTitleLeft10("Рок на плаќање: " + f.DateOfPayment.ToShortDateString());
                //creator.SetTitleLeft8("Период: " + f.FromDate.ToShortDateString() + " - " + f.ToDate.ToShortDateString());

                string[]   headers          = { "Ред. бр.", "Број на полиса", "Осиг. комапнија", "Тип на осигурување", "Премија" };
                float[]    widthPercentages = { 8, 17, 30, 30, 15 };
                TypeCode[] typeCodes        = { TypeCode.Int32, TypeCode.String, TypeCode.String, TypeCode.String, TypeCode.Decimal };
                creator.CreateTable_Facture(headers.Length, headers, widthPercentages);
                object[] values;

                foreach (FactureItem fi in f.FactureItems)
                {
                    List <PolicyItemFactureItem> pifi = PolicyItemFactureItem.GetByFactureItemID(fi.ID);
                    values    = new object[headers.Length];
                    values[0] = fi.Number.ToString();
                    values[1] = pifi[0].PolicyItem.PolicyNumber;
                    values[2] = pifi[0].PolicyItem.Policy.InsuranceCompany.ShortName;
                    values[3] = pifi[0].PolicyItem.InsuranceSubType.ShortDescription;
                    values[4] = String.Format("{0:#,0.00}", fi.PremiumValue) + " ДЕН.";
                    creator.AddDataRowForFactures(values, headers.Length, typeCodes);
                }
                values    = new object[headers.Length];
                values[0] = "";
                values[1] = "";
                values[2] = "";
                values[3] = "Вкупно";
                values[4] = String.Format("{0:#,0.00}", f.TotalCost) + " ДЕН.";
                creator.AddDataRowForFactures(values, headers.Length, typeCodes);
                creator.AddTable();
                creator.SetTitleLeftBold14(" ");
                creator.SetTitleLeftItalic10("Со букви: " + NumberToTextController.Konvertiranje(f.TotalCost));
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft10("Ве молиме фактурираниот износ да го платите до назначениот рок на плаќање.");
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft10("Доколку износот за фактурата не биде платен до наведениот датум, се пресметува затезна камата од денот на стасаност до денот на плаќањето.");
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft10("Согласно со член 23, точка 6 од Законот за ДДВ дејноста осигурување е ослободена од плаќање данок без право на одбиток на претходниот данок.");
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft10("                          Фактурирал                                              Примил                                                          Одобрил");
                creator.SetTitleLeft10("                    _________________                            __________________                                  ____________________");

                Broker.DataAccess.Parameter pSE_PECATI_SPECIFIKACIJA_NA_F_RA_ZA_KLIENT = Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.SE_PECATI_SPECIFIKACIJA_NA_F_RA_ZA_KLIENT);
                bool fpSE_PECATI_SPECIFIKACIJA_NA_F_RA_ZA_KLIENT = true;
                if (pSE_PECATI_SPECIFIKACIJA_NA_F_RA_ZA_KLIENT != null)
                {
                    if (Convert.ToBoolean(pSE_PECATI_SPECIFIKACIJA_NA_F_RA_ZA_KLIENT.Value) == false)
                    {
                        fpSE_PECATI_SPECIFIKACIJA_NA_F_RA_ZA_KLIENT = false;
                    }
                }
                if (fpSE_PECATI_SPECIFIKACIJA_NA_F_RA_ZA_KLIENT)
                {
                    string facItemDescriptionStart = "Полиса - ";
                    creator.AddPage();
                    foreach (FactureItem fi in f.FactureItems)
                    {
                        string polNumber = fi.Description.Substring(facItemDescriptionStart.Length);
                        creator.SetTitleLeft10(facItemDescriptionStart + polNumber);
                        string[]   headersRates          = { "Рата бр.", "Дата за плаќање", "Износ" };
                        float[]    widthPercentagesRates = { 15, 50, 35 };
                        TypeCode[] typeCodesRates        = { TypeCode.Int32, TypeCode.String, TypeCode.Decimal };
                        creator.CreateTable_Facture(headersRates.Length, headersRates, widthPercentagesRates);
                        PolicyItem  pi    = PolicyItem.GetByNumberAndInsuranceSubType(polNumber, fi.InsuranceSubTypeID, (int)fi.Facture.InsuranceCompanyID);
                        List <Rate> rates = Rate.GetByPolicyItemID(pi.ID);
                        rates = rates.OrderBy(c => c.Number).ToList();
                        foreach (Rate r in rates)
                        {
                            object[] valuesRates = new object[headersRates.Length];
                            valuesRates[0] = r.Number;
                            valuesRates[1] = r.Date.ToShortDateString();
                            valuesRates[2] = String.Format("{0:#,0.00}", r.Value);
                            creator.AddDataRowForFactures(valuesRates, headersRates.Length, typeCodes);
                        }
                        creator.AddTable();
                    }
                }
                creator.FinishPDF_FileName("Factura" + f.FactureNumber);
            }
            if (f.DocumentSubType.Code == DocumentSubType.GRUPNA_FAKTURA)
            {
                PDFCreators creator = new PDFCreators(true, 25, 25, 15, 15);
                creator.SetDocumentHeaderFooter();
                creator.OpenPDF();
                creator.GetContentByte();
                creator.AddJDBLogoForFactures(10, 775);
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft8("   Жиро-сметка :  " + Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.ZIRO_SMETKA).Value);
                creator.SetTitleLeft8("   Депонент :  " + Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.DEPONENT).Value);
                creator.SetTitleLeft8("   ЕДБ :   " + Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.EDB).Value + "       " + "Матичен број :  " + Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.MATICEN_BROJ).Value);
                creator.SetTitleLeft8("  ");
                if (f.Discard)
                {
                    creator.SetTitleCenterForFactureNumber("СТОРНИРАНА Фактура бр. " + f.FactureNumber);
                }
                else
                {
                    creator.SetTitleCenterForFactureNumber("Фактура бр. " + f.FactureNumber);
                }
                string internalCode = "";
                try
                {
                    FinansovoDataClassesDataContext fdc = new FinansovoDataClassesDataContext();
                    List <Client> listCLients           = fdc.Clients.Where(c => c.EMBG == f.Client.EMBG).ToList();
                    if (listCLients.Count > 0)
                    {
                        internalCode = listCLients[0].Code;
                    }
                }
                catch { }
                if (internalCode != string.Empty)
                {
                    creator.SetTitleLeftWithFontSize10(internalCode);
                }
                creator.SetTitleLeftWithFontSize10(ConvertToMacedonian.ConvertToMACEDONIAN(f.Client.Name).ToUpper());
                creator.SetTitleLeftWithFontSize10(ConvertToMacedonian.ConvertToMACEDONIAN(f.Client.Address).ToUpper());
                creator.SetTitleLeftWithFontSize10(ConvertToMacedonian.ConvertToMACEDONIAN(f.Client.Place.Municipality.Name).ToUpper());
                creator.SetTitleLeft10("Датум на фактура: " + f.DateOfCreation.ToShortDateString());
                creator.SetTitleLeft10("Рок на плаќање: " + f.DateOfPayment.ToShortDateString());
                string[]   headers          = { "Ред. бр.", "Број на полиса", "Осиг. компанија", "Тип на осигурување", "Премија" };
                float[]    widthPercentages = { 8, 17, 30, 30, 15 };
                TypeCode[] typeCodes        = { TypeCode.Int32, TypeCode.String, TypeCode.String, TypeCode.String, TypeCode.Decimal };
                creator.CreateTable_Facture(headers.Length, headers, widthPercentages);
                object[] values;
                foreach (FactureItem fi in f.FactureItems)
                {
                    List <PolicyItemFactureItem> pifi = PolicyItemFactureItem.GetByFactureItemID(fi.ID);
                    values    = new object[headers.Length];
                    values[0] = fi.Number.ToString();
                    values[1] = pifi[0].PolicyItem.PolicyNumber;
                    values[2] = pifi[0].PolicyItem.Policy.InsuranceCompany.ShortName;
                    values[3] = pifi[0].PolicyItem.InsuranceSubType.ShortDescription;
                    values[4] = String.Format("{0:#,0.00}", fi.PremiumValue) + " ДЕН.";
                    creator.AddDataRowForFactures(values, headers.Length, typeCodes);
                }
                values    = new object[headers.Length];
                values[0] = "";
                values[1] = "";
                values[2] = "";
                values[3] = "Вкупно";
                values[4] = String.Format("{0:#,0.00}", f.TotalCost) + " ДЕН.";
                creator.AddDataRowForFactures(values, headers.Length, typeCodes);
                creator.AddTable();
                creator.SetTitleLeftBold14(" ");
                creator.SetTitleLeftItalic10("Со букви: " + NumberToTextController.Konvertiranje(f.TotalCost));
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft10("Ве молиме фактурираниот износ да го платите до назначениот рок на плаќање.");
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft10("Доколку износот за фактурата не биде платен до наведениот датум, се пресметува затезна камата од денот на стасаност до денот на плаќањето.");
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft10("Согласно со член 23, точка 6 од Законот за ДДВ дејноста осигурување е ослободена од плаќање данок без право на одбиток на претходниот данок.");
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft8(" ");
                creator.SetTitleLeft10("                          Фактурирал                                              Примил                                                          Одобрил");
                creator.SetTitleLeft10("                    _________________                            __________________                                  ____________________");

                bool fpSE_PECATI_SPECIFIKACIJA_NA_F_RA_ZA_KLIENT = true;
                if (Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.SE_PECATI_SPECIFIKACIJA_NA_F_RA_ZA_KLIENT) != null)
                {
                    fpSE_PECATI_SPECIFIKACIJA_NA_F_RA_ZA_KLIENT = Boolean.Parse(Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.SE_PECATI_SPECIFIKACIJA_NA_F_RA_ZA_KLIENT).Value);
                }


                if (fpSE_PECATI_SPECIFIKACIJA_NA_F_RA_ZA_KLIENT)
                {
                    string facItemDescriptionStart = "Полиса бр. ";
                    creator.AddPage();
                    foreach (FactureItem fi in f.FactureItems)
                    {
                        string polNumber = fi.Description.Substring(facItemDescriptionStart.Length);
                        creator.SetTitleLeft10(facItemDescriptionStart + polNumber);
                        string[]   headersRates          = { "Рата бр.", "Дата за плаќање", "Износ" };
                        float[]    widthPercentagesRates = { 15, 50, 35 };
                        TypeCode[] typeCodesRates        = { TypeCode.Int32, TypeCode.String, TypeCode.Decimal };
                        creator.CreateTable_Facture(headersRates.Length, headersRates, widthPercentagesRates);
                        PolicyItem  pi    = PolicyItem.GetByNumberAndInsuranceSubType(polNumber, fi.InsuranceSubTypeID, (int)fi.Facture.InsuranceCompanyID);
                        List <Rate> rates = Rate.GetByPolicyItemID(pi.ID);
                        rates = rates.OrderBy(c => c.Number).ToList();
                        foreach (Rate r in rates)
                        {
                            object[] valuesRates = new object[headersRates.Length];
                            valuesRates[0] = r.Number;
                            valuesRates[1] = r.Date.ToShortDateString();
                            valuesRates[2] = String.Format("{0:#,0.00}", r.Value);
                            creator.AddDataRowForFactures(valuesRates, headersRates.Length, typeCodes);
                        }
                        creator.AddTable();
                    }
                }



                creator.FinishPDF_FileName("Factura" + f.FactureNumber);
            }
        }
Exemple #6
0
        public static void PrintFinCardByApplicationDateReport(DateTime fromDate, DateTime toDate, List <int> lstBranhces,
                                                               List <int> lstInsuranceCompanies, List <int> lstInsuranceSubTypes, List <int> lstUsers, List <int> lstMarketingAgents)
        {
            string      brokerName = BrokerHouseInformation.GetBrokerHouseName();
            PDFCreators creator    = new PDFCreators(true, 25, 25, 15, 15);

            creator.SetDocumentHeaderFooter();
            creator.OpenPDF();
            creator.GetContentByte();
            creator.AddJDBLogoForFactures(10, 775);
            creator.SetTitleLeft8(" ");
            creator.SetTitleLeft8(" ");
            creator.SetTitleLeft8(" ");
            creator.SetTitle("ФИНАНСОВА КАРТИЦА");
            creator.SetTitle("по датум на издавање на полиси");
            creator.SetTitle("за период " + fromDate.ToShortDateString() + " - " + toDate.ToShortDateString());
            creator.SetTitleLeft10("Датум на печатење: " + DateTime.Today.ToShortDateString());

            decimal overallSaldo  = 0;
            decimal overallDebt   = 0;
            decimal overallDemand = 0;

            DateTime dt1 = fromDate;
            DateTime dt2 = toDate;
            int      d1  = dt1.Day;
            int      m1  = dt1.Month;
            int      y1  = dt1.Year;
            int      d2  = dt2.Day;
            int      m2  = dt2.Month;
            int      y2  = dt2.Year;

            //List<Policy> lstPol = Policy.Table.Where(c => c.Discard == false && c.ApplicationDate.Date >= fromDate.Date && c.ApplicationDate.Date <= toDate.Date).ToList();
            DataClassesDataContext dc = new DataClassesDataContext();
            string query = @"SELECT p.* from policies p, policyitems pi where pi.policyid=p.id" +
                           @" and p.branchid in (" + ReportFinPolicies.GetFromIDs(lstBranhces) + ") " +
                           @" and p.userid in (" + ReportFinPolicies.GetFromIDs(lstUsers) + ") " +
                           @" and p.insurancecompanyid in (" + ReportFinPolicies.GetFromIDs(lstInsuranceCompanies) + ") " +
                           @" and pi.insurancesubtypeid in (" + ReportFinPolicies.GetFromIDs(lstInsuranceSubTypes) + ") " +
                           @" and p.applicationdate>='" + y1 + - +m1 + - +d1 + "'" +
                           @" and p.applicationdate<='" + y2 + - +m2 + - +d2 + "'" +
                           @" and p.discard = 0 ";

            List <Policy> lstPol = dc.ExecuteQuery <Policy>(query).ToList();

            foreach (Policy p in lstPol)
            {
                creator.SetTitleLeft10("Број на полиса: " + p.PolicyItems[0].PolicyNumber);
                creator.SetTitleLeft10("Осигурителна компанија: " + p.InsuranceCompany.ShortName);
                creator.SetTitleLeft10("Подкласа на осигурување: " + p.PolicyItems[0].InsuranceSubType.ShortDescription);
                creator.SetTitleLeft10("Датум на полиса: " + p.ApplicationDate.ToShortDateString());
                //decimal totalSaldo = 0;
                decimal totalDebtValue     = 0;
                decimal totalDemandValue   = 0;
                List <FinanceCardInfo> lst = new List <FinanceCardInfo>();
                lst = FinanceCardController.GetByPolicy(p, 0);
                string[]   headers          = { "Дата", "Доспева", "Опис", "Должи", "Побарува", "Салдо" };
                float[]    widthPercentages = { 10, 10, 35, 15, 15, 15 };
                TypeCode[] typeCodes        = { TypeCode.String, TypeCode.String, TypeCode.String, TypeCode.Decimal, TypeCode.Decimal, TypeCode.Decimal };
                creator.CreateTable_Facture(headers.Length, headers, widthPercentages);
                foreach (FinanceCardInfo fci in lst)
                {
                    object[] values;
                    values            = new object[headers.Length];
                    values[0]         = fci.DocumentDate.ToShortDateString();
                    values[1]         = fci.PaidDate.ToShortDateString();
                    values[2]         = fci.Description;
                    values[3]         = String.Format("{0:#,0.00}", fci.DebtValue);
                    values[4]         = String.Format("{0:#,0.00}", fci.DemandValue);
                    values[5]         = String.Format("{0:#,0.00}", fci.SaldoValue);
                    totalDebtValue   += fci.DebtValue;
                    totalDemandValue += fci.DemandValue;
                    //totalSaldo += fci.SaldoValue;
                    creator.AddDataRowForFactures(values, headers.Length, typeCodes);
                }
                object[] valuesTot;
                valuesTot      = new object[headers.Length];
                valuesTot[0]   = "";
                valuesTot[1]   = "";
                valuesTot[2]   = "";
                valuesTot[3]   = String.Format("{0:#,0.00}", totalDebtValue);
                valuesTot[4]   = String.Format("{0:#,0.00}", totalDemandValue);
                valuesTot[5]   = String.Format("{0:#,0.00}", totalDebtValue - totalDemandValue);
                overallSaldo  += (totalDebtValue - totalDemandValue);
                overallDemand += totalDemandValue;
                overallDebt   += totalDebtValue;
                creator.AddDataRowForFactures(valuesTot, headers.Length, typeCodes);
                creator.AddTable();
            }
            creator.SetTitleRight("Должи: " + String.Format("{0:#,0.00}", overallDebt) + "  Побарува: " + String.Format("{0:#,0.00}", overallDemand) + "  Салдо: " + String.Format("{0:#,0.00}", overallSaldo));
            creator.FinishPDF_FileName("FinCard");
        }
Exemple #7
0
        public static void PrintFinCardByPaidDates(DateTime fromDate, DateTime toDate, List <int> lstBranhces,
                                                   List <int> lstInsuranceCompanies, List <int> lstInsuranceSubTypes, List <int> lstUsers, List <int> lstMarketingAgents)
        {
            string      brokerName = BrokerHouseInformation.GetBrokerHouseName();
            PDFCreators creator    = new PDFCreators(true, 25, 25, 15, 15);

            creator.SetDocumentHeaderFooter();
            creator.OpenPDF();
            creator.GetContentByte();
            creator.AddJDBLogoForFactures(10, 775);
            creator.SetTitleLeft8(" ");
            creator.SetTitleLeft8(" ");
            creator.SetTitleLeft8(" ");
            creator.SetTitle("ФИНАНСОВА КАРТИЦА");
            creator.SetTitle("по датум на доспевање и уплата");
            creator.SetTitle("за период " + fromDate.ToShortDateString() + " - " + toDate.ToShortDateString());
            creator.SetTitleLeft10("Датум на печатење: " + DateTime.Today.ToShortDateString());

            decimal overallSaldo  = 0;
            decimal overallDebt   = 0;
            decimal overallDemand = 0;

            List <FinanceCardInfo> lstFCIByRates = FinanceCardController.GetByRateInPeriod(fromDate, toDate, lstBranhces, lstInsuranceCompanies,
                                                                                           lstInsuranceSubTypes, lstUsers, lstMarketingAgents);
            List <FinanceCardInfo> lstFCIByPayments = FinanceCardController.GetByPaymentInPeriod(fromDate, toDate, lstBranhces, lstInsuranceCompanies,
                                                                                                 lstInsuranceSubTypes, lstUsers, lstMarketingAgents);
            HashSet <int> lstPolicyIDs = new HashSet <int>();

            foreach (FinanceCardInfo fciR in lstFCIByRates)
            {
                if (!lstPolicyIDs.Contains(fciR.PolicyItemID))
                {
                    lstPolicyIDs.Add(fciR.PolicyItemID);
                }
            }
            foreach (FinanceCardInfo fciP in lstFCIByPayments)
            {
                if (!lstPolicyIDs.Contains(fciP.PolicyItemID))
                {
                    lstPolicyIDs.Add(fciP.PolicyItemID);
                }
            }

            foreach (int piID in lstPolicyIDs)
            {
                PolicyItem pi = PolicyItem.Get(piID);
                creator.SetTitleLeft10("Број на полиса: " + pi.Policy.PolicyItems[0].PolicyNumber);
                creator.SetTitleLeft10("Осигурителна компанија: " + pi.Policy.InsuranceCompany.ShortName);
                creator.SetTitleLeft10("Подкласа на осигурување: " + pi.Policy.PolicyItems[0].InsuranceSubType.ShortDescription);
                creator.SetTitleLeft10("Датум на полиса: " + pi.Policy.ApplicationDate.ToShortDateString());
                //decimal totalSaldo = 0;
                decimal totalDebtValue        = 0;
                decimal totalDemandValue      = 0;
                List <FinanceCardInfo> lst    = new List <FinanceCardInfo>();
                List <FinanceCardInfo> lstRat = lstFCIByRates.Where(c => c.PolicyItemID == piID).ToList();
                List <FinanceCardInfo> lstPay = lstFCIByPayments.Where(c => c.PolicyItemID == piID).ToList();
                if (lstRat != null)
                {
                    if (lstRat.Count > 0)
                    {
                        lst.AddRange(lstRat);
                    }
                }
                if (lstPay != null)
                {
                    if (lstPay.Count > 0)
                    {
                        lst.AddRange(lstPay);
                    }
                }
                for (int i = 0; i < lst.Count; i++)
                {
                    if (i == 0)
                    {
                        lst[i].SaldoValue = lst[i].DebtValue - lst[i].DemandValue;
                    }
                    if (i > 0)
                    {
                        lst[i].SaldoValue = lst[i - 1].SaldoValue + (lst[i].DebtValue - lst[i].DemandValue);
                    }
                }
                string[]   headers          = { "Дата", "Доспева", "Опис", "Должи", "Побарува", "Салдо" };
                float[]    widthPercentages = { 10, 10, 35, 15, 15, 15 };
                TypeCode[] typeCodes        = { TypeCode.String, TypeCode.String, TypeCode.String, TypeCode.Decimal, TypeCode.Decimal, TypeCode.Decimal };
                creator.CreateTable_Facture(headers.Length, headers, widthPercentages);
                foreach (FinanceCardInfo fci in lst)
                {
                    object[] values;
                    values            = new object[headers.Length];
                    values[0]         = fci.DocumentDate.ToShortDateString();
                    values[1]         = fci.PaidDate.ToShortDateString();
                    values[2]         = fci.Description;
                    values[3]         = String.Format("{0:#,0.00}", fci.DebtValue);
                    values[4]         = String.Format("{0:#,0.00}", fci.DemandValue);
                    values[5]         = String.Format("{0:#,0.00}", fci.SaldoValue);
                    totalDebtValue   += fci.DebtValue;
                    totalDemandValue += fci.DemandValue;
                    //totalSaldo += fci.SaldoValue;
                    creator.AddDataRowForFactures(values, headers.Length, typeCodes);
                }
                object[] valuesTot;
                valuesTot      = new object[headers.Length];
                valuesTot[0]   = "";
                valuesTot[1]   = "";
                valuesTot[2]   = "";
                valuesTot[3]   = String.Format("{0:#,0.00}", totalDebtValue);
                valuesTot[4]   = String.Format("{0:#,0.00}", totalDemandValue);
                valuesTot[5]   = String.Format("{0:#,0.00}", totalDebtValue - totalDemandValue);
                overallSaldo  += (totalDebtValue - totalDemandValue);
                overallDemand += totalDemandValue;
                overallDebt   += totalDebtValue;
                creator.AddDataRowForFactures(valuesTot, headers.Length, typeCodes);
                creator.AddTable();
            }
            creator.SetTitleRight("Должи: " + String.Format("{0:#,0.00}", overallDebt) + "  Побарува: " + String.Format("{0:#,0.00}", overallDemand) + "  Салдо: " + String.Format("{0:#,0.00}", (overallDebt - overallDemand)));
            creator.FinishPDF_FileName("FinCard");
        }
Exemple #8
0
        public static void PrintFinCard(Policy p, Broker.DataAccess.Client c, string itemsType)
        {
            string      brokerName = BrokerHouseInformation.GetBrokerHouseName();
            PDFCreators creator    = new PDFCreators(true, 25, 25, 15, 15);

            creator.SetDocumentHeaderFooter();
            creator.OpenPDF();
            creator.GetContentByte();
            creator.AddJDBLogoForFactures(10, 775);
            creator.SetTitleLeft8(" ");
            creator.SetTitleLeft8(" ");
            creator.SetTitleLeft8(" ");
            creator.SetTitleLeft8(" ");
            creator.SetTitleLeft8("   Жиро-сметка :  " + Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.ZIRO_SMETKA).Value);
            creator.SetTitleLeft8("   Депонент :  " + Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.DEPONENT).Value);
            creator.SetTitleLeft8("   ЕДБ :   " + Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.EDB).Value + "       " + "Матичен број :  " + Broker.DataAccess.Parameter.GetByCode(Broker.DataAccess.Parameter.MATICEN_BROJ).Value);
            creator.SetTitleLeft8("  ");
            creator.SetTitleCenterForFactureNumber("ФИНАНСОВА КАРТИЦА");
            List <FinanceCardInfo> lst = new List <FinanceCardInfo>();

            if (p != null)
            {
                creator.SetTitleLeftWithFontSize10("за полиса " + p.PolicyItems[0].PolicyNumber);
                lst = FinanceControllers.FinanceCardController.GetByPolicy(p, 0);
            }
            else if (c != null)
            {
                creator.SetTitleLeftWithFontSize10("за договорувач: ");
                creator.SetTitleLeftWithFontSize10(ConvertToMacedonian.ConvertToMACEDONIAN(c.Name).ToUpper());
                creator.SetTitleLeftWithFontSize10(ConvertToMacedonian.ConvertToMACEDONIAN(c.Address).ToUpper());
                creator.SetTitleLeftWithFontSize10(ConvertToMacedonian.ConvertToMACEDONIAN(c.Place.Municipality.Name).ToUpper());
                if (itemsType == "AllItems")
                {
                    lst = FinanceControllers.FinanceCardController.GetByClient(c);
                }
                else if (itemsType == "OpenItems")
                {
                    lst = FinanceControllers.FinanceCardController.GetByClientOpenItems(c);
                }
            }

            creator.SetTitleLeft10("Датум на печатење: " + DateTime.Today.ToShortDateString());
            //decimal totalSaldo = 0;
            decimal totalDebtValue   = 0;
            decimal totalDemandValue = 0;

            string[]   headers          = { "Дата", "Доспева", "Опис", "Должи", "Побарува", "Салдо" };
            float[]    widthPercentages = { 10, 10, 35, 15, 15, 15 };
            TypeCode[] typeCodes        = { TypeCode.String, TypeCode.String, TypeCode.String, TypeCode.Decimal, TypeCode.Decimal, TypeCode.Decimal };
            creator.CreateTable_Facture(headers.Length, headers, widthPercentages);
            foreach (FinanceCardInfo fci in lst)
            {
                object[] values;
                values            = new object[headers.Length];
                values[0]         = fci.DocumentDate.ToShortDateString();
                values[1]         = fci.PaidDate.ToShortDateString();
                values[2]         = fci.Description;
                values[3]         = String.Format("{0:#,0.00}", fci.DebtValue);
                values[4]         = String.Format("{0:#,0.00}", fci.DemandValue);
                values[5]         = String.Format("{0:#,0.00}", fci.SaldoValue);
                totalDebtValue   += fci.DebtValue;
                totalDemandValue += fci.DemandValue;
                //totalSaldo += fci.SaldoValue;
                creator.AddDataRowForFactures(values, headers.Length, typeCodes);
            }
            object[] valuesTot;
            valuesTot    = new object[headers.Length];
            valuesTot[0] = "";
            valuesTot[1] = "";
            valuesTot[2] = "";
            valuesTot[3] = String.Format("{0:#,0.00}", totalDebtValue);
            valuesTot[4] = String.Format("{0:#,0.00}", totalDemandValue);
            valuesTot[5] = String.Format("{0:#,0.00}", totalDebtValue - totalDemandValue);
            creator.AddDataRowForFactures(valuesTot, headers.Length, typeCodes);
            creator.AddTable();
            creator.FinishPDF_FileName("FinCard");
        }