Ejemplo n.º 1
0
        private static void AddHeader(Document pdfDoc, Employee employee, Duty duty)
        {
            pdfDoc.Add(new Paragraph());
            Chunk chunk = new Chunk("SLUŽBA:	Služba transporta\n", FontFactory.GetFont("TIMES_ROMAN", 10, Font.NORMAL, BaseColor.BLACK));

            pdfDoc.Add(chunk);
            chunk = new Chunk("Oddelek: PSO\n", FontFactory.GetFont("TIMES_ROMAN", 10, Font.NORMAL, BaseColor.BLACK));
            pdfDoc.Add(chunk);
            chunk = new Chunk("Delavec: " + employee.Name + " " + employee.Surname + "\n", FontFactory.GetFont("Arial", 10, Font.NORMAL, BaseColor.BLACK));
            pdfDoc.Add(chunk);
            pdfDoc.Add(Chunk.NEWLINE);
            pdfDoc.Add(Chunk.NEWLINE);
            PdfPTable pt = new PdfPTable(1);

            AddCellCenterBold(pt, "OBRAČUN PRIPRAVLJENOSTI IN INTERVENCIJ", 12);
            AddCellCenterBold(pt, ("od " + PlinovodiDezurstvaUtils.SubStringMonthInDate(duty.From.ToString("d.MMMM.yy")) + " do " +
                                   PlinovodiDezurstvaUtils.SubStringMonthInDate(duty.To.ToString("d.MMMM.yy"))), 12);
            pdfDoc.Add(pt);
        }
Ejemplo n.º 2
0
        private static void GenerateHourOverwiev(Document pdfDoc, Employee employee, Duty duty, int[] takenHoursInOneDay,
                                                 IEnumerable <Intervention> interventionListSeperated)
        {
            double realHoursAllSum = 0;
            int    hoursSum        = 0;
            double realHoursSum    = 0;

            //process header
            PlinovodiDezurstvaUtils.AddHeader(pdfDoc, employee, duty);

            //process workdays
            PdfPTable table = PlinovodiDezurstvaUtils.GetTable(5);

            PlinovodiDezurstvaUtils.AddTableLine(table, new List <string>()
            {
                "Datum", "Dan", "", "Število ur", "Število rednih  ur (10%)"
            });

            for (int indexDays = 0; indexDays < 8; indexDays++)
            {
                if (indexDays == 5 || indexDays == 6)
                {
                    continue;
                }

                int hours = PlinovodiDezurstvaUtils.GetSteviloUr(indexDays, takenHoursInOneDay);
                PlinovodiDezurstvaUtils.AddTableLine(table, new List <string>()
                {
                    PlinovodiDezurstvaUtils.SubStringMonthInDate(duty.From.AddDays(indexDays).ToString("d.MMMM.yy")),
                    PlinovodiDezurstvaUtils.GetDayName(indexDays),
                    "", hours.ToString(), (hours * 0.1).ToString()
                });
                hoursSum += hours; realHoursSum += hours * 0.1;
            }

            PlinovodiDezurstvaUtils.AddTableLine(table, new List <string>()
            {
                "", "", "Skupaj", hoursSum.ToString(), realHoursSum.ToString()
            });
            pdfDoc.Add(table);
            realHoursAllSum += realHoursSum;
            /////////////////////////////////////////////////

            //process weekends
            hoursSum     = 0;
            realHoursSum = 0;
            table        = PlinovodiDezurstvaUtils.GetTable(5);
            PlinovodiDezurstvaUtils.AddTableLine(table, new List <string>()
            {
                "Datum", "Dan", "", "Število ur", "Število rednih  ur (20%)"
            });

            for (int indexDays = 0; indexDays < 8; indexDays++)
            {
                if (indexDays != 5 && indexDays != 6)
                {
                    continue;
                }

                int hours = PlinovodiDezurstvaUtils.GetSteviloUr(indexDays, takenHoursInOneDay);
                PlinovodiDezurstvaUtils.AddTableLine(table, new List <string>()
                {
                    PlinovodiDezurstvaUtils.SubStringMonthInDate(duty.From.AddDays(indexDays).ToString("d.MMMM.yy")),
                    PlinovodiDezurstvaUtils.GetDayName(indexDays),
                    "", hours.ToString(), (hours * 0.2).ToString()
                });

                hoursSum += hours; realHoursSum += hours * 0.2;
            }

            PlinovodiDezurstvaUtils.AddTableLine(table, new List <string>()
            {
                "", "", "Skupaj", hoursSum.ToString(), realHoursSum.ToString()
            });
            pdfDoc.Add(table);
            realHoursAllSum += realHoursSum;
            /////////////////////////////////////

            //process interventions
            table = PlinovodiDezurstvaUtils.GetTable(5);
            PlinovodiDezurstvaUtils.AddTableLine(table, new List <string>()
            {
                "Datum", "Objekt", "Od ure", "Do ure", "Opis del"
            });
            bool weHaveInterventions = false;

            foreach (Intervention intervention in interventionListSeperated)
            {
                int endHour = intervention.From.Day != intervention.To.Day ? 24 : intervention.To.Hour;
                PlinovodiDezurstvaUtils.AddTableLine(table, new List <string>()
                {
                    PlinovodiDezurstvaUtils.SubStringMonthInDate(intervention.From.ToString("d.MMMM.yy")), "",
                    intervention.From.ToString("HH:mm"), endHour + ":00", intervention.ShortDescription
                });

                weHaveInterventions = true;
            }
            if (weHaveInterventions)
            {
                PdfPTable pt = new PdfPTable(1);
                PlinovodiDezurstvaUtils.AddCellCenterBold(pt, "INTERVENCIJA", 12);
                pdfDoc.Add(pt);

                pdfDoc.Add(table);
            }
            //////////////
            ///

            //add Footer
            PlinovodiDezurstvaUtils.AddFooter(pdfDoc, employee, duty, realHoursAllSum, takenHoursInOneDay);
        }
Ejemplo n.º 3
0
        private static void GenerateComplains(Document pdfDoc, Employee employee, IEnumerable <Intervention> interventionList)
        {
            foreach (Intervention intervention in interventionList)
            {
                pdfDoc.NewPage();
                PdfPTable pt = new PdfPTable(1);
                PlinovodiDezurstvaUtils.AddCellCenterBold(pt, "PORO\u010cILO O INTERVENCIJI", 18);
                pdfDoc.Add(pt);

                pdfDoc.Add(Chunk.NEWLINE);
                pdfDoc.Add(Chunk.NEWLINE);

                PdfPTable table = GetTable(8);
                //row1
                PdfPCell cell = new PdfPCell(new Phrase("Ime in Priimek: "));
                cell.Colspan = 2;
                cell.Border  = 0;
                table.AddCell(cell);

                cell                   = new PdfPCell(new Phrase(employee.Name + " " + employee.Surname));
                cell.Colspan           = 6;
                cell.Border            = 0;
                cell.BorderWidthBottom = 1;
                table.AddCell(cell);
                //row2
                cell         = new PdfPCell(new Phrase("Nedovoljeno stanje prijavil: "));
                cell.Colspan = 3;
                cell.Border  = 0;
                table.AddCell(cell);
                cell                   = new PdfPCell(new Phrase(""));
                cell.Colspan           = 5;
                cell.Border            = 0;
                cell.BorderWidthBottom = 1;
                table.AddCell(cell);
                //row3
                cell         = new PdfPCell(new Phrase("Prijava nedovoljenega stanja ob: "));
                cell.Colspan = 3;
                cell.Border  = 0;
                table.AddCell(cell);
                cell = new PdfPCell(new Phrase(intervention.From.ToString("HH:mm")));
                cell.HorizontalAlignment = Element.ALIGN_CENTER;
                cell.Colspan             = 1;
                cell.Border            = 0;
                cell.BorderWidthBottom = 1;
                table.AddCell(cell);
                cell         = new PdfPCell(new Phrase("uri"));
                cell.Colspan = 1;
                cell.Border  = 0;
                table.AddCell(cell);
                cell         = new PdfPCell(new Phrase("Objekt / plinovod: "));
                cell.Colspan = 2;
                cell.Border  = 0;
                table.AddCell(cell);
                cell                   = new PdfPCell(new Phrase(""));
                cell.Colspan           = 1;
                cell.Border            = 0;
                cell.BorderWidthBottom = 1;
                table.AddCell(cell);

                //row4
                cell         = new PdfPCell(new Phrase("Prihod na objekt ob: "));
                cell.Colspan = 2;
                cell.Border  = 0;
                table.AddCell(cell);
                cell                   = new PdfPCell(new Phrase(""));
                cell.Colspan           = 1;
                cell.Border            = 0;
                cell.BorderWidthBottom = 1;
                table.AddCell(cell);
                cell         = new PdfPCell(new Phrase("uri"));
                cell.Colspan = 1;
                cell.Border  = 0;
                table.AddCell(cell);
                cell         = new PdfPCell(new Phrase("Odhod z objekta ob: "));
                cell.Colspan = 2;
                cell.Border  = 0;
                table.AddCell(cell);
                cell                   = new PdfPCell(new Phrase(""));
                cell.Colspan           = 1;
                cell.Border            = 0;
                cell.BorderWidthBottom = 1;
                table.AddCell(cell);
                cell = new PdfPCell(new Phrase("uri"));
                cell.HorizontalAlignment = Element.ALIGN_RIGHT;
                cell.Colspan             = 1;
                cell.Border = 0;
                table.AddCell(cell);

                //row4
                cell         = new PdfPCell(new Phrase("Zaključek ob:: "));
                cell.Colspan = 2;
                cell.Border  = 0;
                table.AddCell(cell);
                cell = new PdfPCell(new Phrase(intervention.To.ToString("HH:mm")));
                cell.HorizontalAlignment = Element.ALIGN_CENTER;
                cell.Colspan             = 1;
                cell.Border            = 0;
                cell.BorderWidthBottom = 1;
                table.AddCell(cell);
                cell         = new PdfPCell(new Phrase("uri"));
                cell.Colspan = 1;
                cell.Border  = 0;
                table.AddCell(cell);
                cell         = new PdfPCell(new Phrase("Skupaj število ur: "));
                cell.Colspan = 2;
                cell.Border  = 0;
                table.AddCell(cell);
                int endHour = intervention.From.Day != intervention.To.Day ? 24 : intervention.To.Hour;
                cell = new PdfPCell(new Phrase((endHour - intervention.From.Hour).ToString()));
                cell.HorizontalAlignment = Element.ALIGN_CENTER;
                cell.Colspan             = 2;
                cell.Border            = 0;
                cell.BorderWidthBottom = 1;
                table.AddCell(cell);



                pdfDoc.Add(table);

                Chunk chunk = new Chunk("Kratek opis javljenega nedovoljenega stanja:\n", FontFactory.GetFont(BaseFont.TIMES_ROMAN, 14, Font.BOLD, BaseColor.BLACK));
                pdfDoc.Add(chunk);
                table        = new PdfPTable(1);
                cell         = new PdfPCell(new Phrase(intervention.ShortDescription));
                cell.Colspan = 2;
                cell.Border  = 0;
                table.AddCell(cell);
                pdfDoc.Add(table);

                chunk = new Chunk("Stanje ob prihodu:\n", FontFactory.GetFont(BaseFont.TIMES_ROMAN, 14, Font.BOLD, BaseColor.BLACK));
                pdfDoc.Add(chunk);
                table        = new PdfPTable(1);
                cell         = new PdfPCell(new Phrase("Opis stanja ob prihodu."));
                cell.Colspan = 2;
                cell.Border  = 0;
                table.AddCell(cell);
                pdfDoc.Add(table);

                chunk = new Chunk("Ukrepi in opis opravljenega dela:\n", FontFactory.GetFont(BaseFont.TIMES_ROMAN, 14, Font.BOLD, BaseColor.BLACK));
                pdfDoc.Add(chunk);
                table        = new PdfPTable(1);
                cell         = new PdfPCell(new Phrase(intervention.LongDescription));
                cell.Colspan = 2;
                cell.Border  = 0;
                table.AddCell(cell);
                pdfDoc.Add(table);

                chunk = new Chunk("Vzrok:\n", FontFactory.GetFont(BaseFont.TIMES_ROMAN, 14, Font.BOLD, BaseColor.BLACK));
                pdfDoc.Add(chunk);
                table        = new PdfPTable(1);
                cell         = new PdfPCell(new Phrase("Opis vzroka."));
                cell.Colspan = 2;
                cell.Border  = 0;
                table.AddCell(cell);
                pdfDoc.Add(table);

                chunk = new Chunk("Porabljen material:", FontFactory.GetFont(BaseFont.TIMES_ROMAN, 14, Font.BOLD, BaseColor.BLACK));
                pdfDoc.Add(chunk);
                table = GetTable(2);
                AddTableLine(table, new List <string> {
                    "Naziv / ime materiala", "Količina"
                });
                AddTableLine(table, new List <string> {
                    " ", " "
                });
                AddTableLine(table, new List <string> {
                    " ", " "
                });
                AddTableLine(table, new List <string> {
                    " ", " "
                });
                AddTableLine(table, new List <string> {
                    " ", " "
                });
                pdfDoc.Add(table);

                table        = GetTable(8);
                cell         = new PdfPCell(new Phrase("Datum intervencije: "));
                cell.Colspan = 2;
                cell.Border  = 0;
                table.AddCell(cell);
                cell                   = new PdfPCell(new Phrase(intervention.From.ToString("d.M.yy")));
                cell.Colspan           = 1;
                cell.Border            = 0;
                cell.BorderWidthBottom = 1;
                table.AddCell(cell);
                cell         = new PdfPCell(new Phrase(""));
                cell.Colspan = 1;
                cell.Border  = 0;
                table.AddCell(cell);
                cell         = new PdfPCell(new Phrase("Podpis: "));
                cell.Colspan = 2;
                cell.Border  = 0;
                table.AddCell(cell);
                cell                   = new PdfPCell(new Phrase(""));
                cell.Colspan           = 2;
                cell.Border            = 0;
                cell.BorderWidthBottom = 1;
                table.AddCell(cell);

                cell         = new PdfPCell(new Phrase("Vodja Službe transporta: "));
                cell.Colspan = 3;
                cell.Border  = 0;
                table.AddCell(cell);
                cell         = new PdfPCell(new Phrase(""));
                cell.Colspan = 1;
                cell.Border  = 0;
                table.AddCell(cell);
                cell                   = new PdfPCell(new Phrase(""));
                cell.Colspan           = 4;
                cell.Border            = 0;
                cell.BorderWidthBottom = 1;
                table.AddCell(cell);

                pdfDoc.Add(table);
            }
        }