コード例 #1
0
        public new void Print(bool isOpen)
        {
            ToPdf.AddPage(PdfSharp.PageSize.Letter);

            PrintHeader();
            PrintInfo();
            double lastItemY = PrintPayrolls();

            lastItemY = PrintDetails(lastItemY);
            if (Payroll.Deductions.Count > 0)
            {
                lastItemY = PrintDeductions(lastItemY);
            }
            lastItemY = PrintReinmburstments(lastItemY);
            if (Payroll.Reimbursements.Count > 0)
            {
                _initialYTotals = lastItemY;
            }
            PrintTotals();

            ToPdf.Print();

            if (isOpen)
            {
                PdfFile.Open();
            }
        }
コード例 #2
0
        protected override void PrintDetails()
        {
            double headerDateX = 10;
            double headerY     = 250;

            ToPdf.DrawString("DATE OF TICKET", FormatText.Bold, headerDateX, headerY, 50, 200, XStringFormats.Center);

            double headerCompanyX = 150;

            ToPdf.DrawString("COMPANY", FormatText.Bold, headerCompanyX, headerY, 50, 200, XStringFormats.Center);

            double headerTicketX = 300;

            ToPdf.DrawString("No TICKET", FormatText.Bold, headerTicketX, headerY, 50, 200, XStringFormats.Center);

            double headerHoursX = 380;

            ToPdf.DrawString("HOURS", FormatText.Bold, headerHoursX, headerY, 50, 200, XStringFormats.Center);

            double itemY = headerY;

            foreach (var item in Payroll.Details)
            {
                itemY += 15;
                ToPdf.DrawString(item.Ticket.Date.Date.ToShortDateString(), FormatText.Regular, headerDateX, itemY, 50, 200, XStringFormats.Center);
                ToPdf.DrawString(item.OilCompany.Name, FormatText.Regular, headerCompanyX, itemY, 50, 200, XStringFormats.Center);
                ToPdf.DrawString(item.Ticket.Number.ToString(), FormatText.Regular, headerTicketX, itemY, 50, 200, XStringFormats.Center);
                ToPdf.DrawString(item.Hours.ToString(), FormatText.Regular, headerHoursX, itemY, 50, 200, XStringFormats.Center);
            }
        }
コード例 #3
0
        protected override void PrintTotals()
        {
            double totalTextX  = 180;
            double totalValueX = 380;
            double totalInitY  = 600;

            double totalWeekHoursY = totalInitY;

            ToPdf.DrawString("Total Week Hours " + Payroll.TotalHours.ToString(), FormatText.Bold, totalTextX, totalWeekHoursY, 50, 200, XStringFormats.TopRight);

            double totalRegularHourY = totalInitY + 15;

            ToPdf.DrawString("Regular Hours " + Payroll.RegularHour.ToString(), FormatText.Regular, totalTextX, totalRegularHourY, 50, 200, XStringFormats.TopRight);
            ToPdf.DrawString(Payroll.PaymentRegularHour.ToString("C"), FormatText.Regular, totalValueX, totalRegularHourY, 50, 200, XStringFormats.TopCenter);

            double totalOvertimeHourY = totalInitY + 30;

            ToPdf.DrawString("Overtime Hours " + Payroll.OvertimeHour.ToString(), FormatText.Regular, totalTextX, totalOvertimeHourY, 50, 200, XStringFormats.TopRight);
            ToPdf.DrawString(Payroll.PaymentOvertimeHour.ToString("C"), FormatText.Regular, totalValueX, totalOvertimeHourY, 50, 200, XStringFormats.TopCenter);

            double totalDeductionsY = totalInitY + 45;

            ToPdf.DrawString("Deductions " + Payroll.DeductionsDetail, FormatText.Regular, totalTextX, totalDeductionsY, 50, 200, XStringFormats.TopRight);
            ToPdf.DrawString(Payroll.Deductions.ToString("C"), FormatText.Regular, totalValueX, totalDeductionsY, 50, 200, XStringFormats.TopCenter);

            double totalReimbursmentsY = totalInitY + 60;

            ToPdf.DrawString("Reimbursments " + Payroll.ReimbursmentsDetail, FormatText.Regular, totalTextX, totalReimbursmentsY, 50, 200, XStringFormats.TopRight);
            ToPdf.DrawString(Payroll.Reimbursements.ToString("C"), FormatText.Regular, totalValueX, totalReimbursmentsY, 50, 200, XStringFormats.TopCenter);

            double totalY = totalInitY + 90;

            ToPdf.DrawString("TOTAL", FormatText.Bold, totalTextX, totalY, 50, 200, XStringFormats.TopRight);
            ToPdf.DrawString(Payroll.TotalPayment.ToString("C"), FormatText.Bold, totalValueX, totalY, 50, 200, XStringFormats.TopCenter);
        }
コード例 #4
0
        protected override void PrintTotals()
        {
            double text1X = 100;
            double text2X = 290;
            double y      = _initialYTotals + 50;

            ToPdf.DrawString("Total Payment", FormatText.Bold, text1X, y, 50, 200, XStringFormats.TopLeft);
            ToPdf.DrawString(Payroll.Total.ToString("C"), FormatText.Bold, text2X, y, 50, 200, XStringFormats.TopRight);
        }
コード例 #5
0
        public void Print(bool isOpen)
        {
            ToPdf.AddPage(PdfSharp.PageSize.Letter);

            PrintHeader();
            PrintInfo();
            PrintDetails();
            PrintTotals();

            ToPdf.Print();

            if (isOpen)
            {
                PdfFile.Open();
            }
        }
コード例 #6
0
        private double PrintDetails(double initialY)
        {
            double text1X = 100;
            double text2X = 290;
            double y      = initialY;

            foreach (var item in Payroll.Details)
            {
                ToPdf.DrawString(item.Item, FormatText.Bold, text1X, y, 50, 200, XStringFormats.TopLeft);
                ToPdf.DrawString(item.Value.ToString("C"), FormatText.Regular, text2X, y, 50, 200, XStringFormats.TopRight);

                y += 15;
            }

            return(y);
        }
コード例 #7
0
        protected override void PrintInfo()
        {
            double text1X = 120;

            double payToY = 200;

            ToPdf.DrawString("Pay To: " + Payroll.Employee.Fullname, FormatText.Bold, text1X, payToY, 50, 200, XStringFormats.TopLeft);

            double paymentWeekY = 215;

            ToPdf.DrawString("Payment Week From: " + Payroll.From.Date.ToShortDateString() + " - " + Payroll.To.Date.ToShortDateString(), FormatText.Bold, text1X, paymentWeekY, 50, 200, XStringFormats.TopLeft);

            double paymentDateX = 370;
            double paymentDateY = 215;

            ToPdf.DrawString("Payment Date: " + Payroll.PaymentDate.Date.ToShortDateString(), FormatText.Regular, paymentDateX, paymentDateY, 50, 200, XStringFormats.TopLeft);
        }
コード例 #8
0
        protected override void PrintHeader()
        {
            double logoX = 20;
            double logoY = 80;

            ToPdf.DrawImage("resources\\images\\logo-sdt.JPG", logoX, logoY, 0.2);

            double textX  = 200;
            double titleY = 80;

            ToPdf.DrawString("S & D TRUCKING LLC", FormatText.Title, textX, titleY, 50, 200, XStringFormats.Center);

            double dir1Y = 95;

            ToPdf.DrawString("2620 Charway Rd", FormatText.Regular, textX, dir1Y, 50, 200, XStringFormats.Center);

            double dir2Y = 105;

            ToPdf.DrawString("Odessa, Tx 79766", FormatText.Regular, textX, dir2Y, 50, 200, XStringFormats.Center);
        }
コード例 #9
0
        private double PrintPayrolls()
        {
            double text1X = 100;
            double text2X = 290;
            double y      = 220;

            foreach (var item in Payroll.Rates)
            {
                ToPdf.DrawString(item.Companies, FormatText.Bold, text1X, y, 50, 200, XStringFormats.TopLeft);
                ToPdf.DrawString("Rate", FormatText.Regular, text1X, y + 15, 50, 200, XStringFormats.TopLeft);
                ToPdf.DrawString("Sub-Total", FormatText.Regular, text1X, y + 30, 50, 200, XStringFormats.TopLeft);

                ToPdf.DrawString(item.Hours.ToString(), FormatText.Italic, text2X, y, 50, 200, XStringFormats.TopRight);
                ToPdf.DrawString(item.Rate.ToString("C"), FormatText.Regular, text2X, y + 15, 50, 200, XStringFormats.TopRight);
                ToPdf.DrawString(item.Subtotal.ToString("C"), FormatText.BoldItalic, text2X, y + 30, 50, 200, XStringFormats.TopRight);

                y += 60;
            }

            return(y);
        }
コード例 #10
0
        protected override void PrintInfo()
        {
            double text1X = 100;
            double y      = 150;

            double payToY = y;

            ToPdf.DrawString("Pay To: " + Payroll.LeaseCompany.Name, FormatText.Bold, text1X, payToY, 50, 200, XStringFormats.TopLeft);

            double truckY = y + 15;

            ToPdf.DrawString("TRUCK No. " + Payroll.Truck.Number, FormatText.Bold, text1X, truckY, 50, 200, XStringFormats.TopLeft);

            double paymentWeekY = y + 30;

            ToPdf.DrawString("FROM: " + Payroll.From.Date.ToShortDateString() + " TO " + Payroll.To.Date.ToShortDateString(), FormatText.Bold, text1X, paymentWeekY, 50, 200, XStringFormats.TopLeft);

            double paymentDateX = 290;
            double paymentDateY = y + 30;

            ToPdf.DrawString("Date: " + Payroll.Date.ToShortDateString(), FormatText.Regular, paymentDateX, paymentDateY, 50, 200, XStringFormats.TopRight);
        }
コード例 #11
0
        public void ConvertToPdf(string imageFilePath, string pdfFilePath)
        {
            if (string.IsNullOrEmpty(imageFilePath))
            {
                throw new ArgumentNullException();
            }
            if (string.IsNullOrEmpty(pdfFilePath))
            {
                throw new ArgumentNullException();
            }

            FileInfo fileInfo = new FileInfo(imageFilePath);
            string   fileType = fileInfo.Extension.Trim();

            if (!(fileType.Equals(".jpg") || fileType.Equals(".png") || fileType.Equals(".ico")))
            {
                throw new InvalidDataException();
            }

            ToPdf convertToPdf = new ToPdf();

            convertToPdf.ConvertImageToPdf(imageFilePath, pdfFilePath);
        }
コード例 #12
0
        protected override void PrintTotals()
        {
            double totalTextX  = 180;
            double totalValueX = 380;

            if (Payroll.Employee.IsWeeklyPayment)
            {
                double totalRegularHourY = 365;
                ToPdf.DrawString("Total Week ", FormatText.Regular, totalTextX, totalRegularHourY, 50, 200, XStringFormats.TopRight);
                ToPdf.DrawString(Payroll.PaymentTotalHours.ToString("C"), FormatText.Regular, totalValueX, totalRegularHourY, 50, 200, XStringFormats.TopCenter);
            }
            else
            {
                double totalWeekHoursY = 350;
                ToPdf.DrawString("Total Week Hours " + Payroll.TotalHours.ToString(), FormatText.Bold, totalTextX, totalWeekHoursY, 50, 200, XStringFormats.TopRight);

                double totalRegularHourY = 365;
                ToPdf.DrawString("Hours " + Payroll.TotalHours.ToString(), FormatText.Regular, totalTextX, totalRegularHourY, 50, 200, XStringFormats.TopRight);
                ToPdf.DrawString(Payroll.PaymentTotalHours.ToString("C"), FormatText.Regular, totalValueX, totalRegularHourY, 50, 200, XStringFormats.TopCenter);
            }

            double totalDeductionsY = 380;

            ToPdf.DrawString("Deductions " + Payroll.DeductionsDetail, FormatText.Regular, totalTextX, totalDeductionsY, 50, 200, XStringFormats.TopRight);
            ToPdf.DrawString(Payroll.Deductions.ToString("C"), FormatText.Regular, totalValueX, totalDeductionsY, 50, 200, XStringFormats.TopCenter);

            double totalReimbursmentsY = 395;

            ToPdf.DrawString("Reimbursments " + Payroll.ReimbursmentsDetail, FormatText.Regular, totalTextX, totalReimbursmentsY, 50, 200, XStringFormats.TopRight);
            ToPdf.DrawString(Payroll.Reimbursements.ToString("C"), FormatText.Regular, totalValueX, totalReimbursmentsY, 50, 200, XStringFormats.TopCenter);

            double totalY = 410;

            ToPdf.DrawString("TOTAL", FormatText.Bold, totalTextX, totalY, 50, 200, XStringFormats.TopRight);
            ToPdf.DrawString(Payroll.TotalPayment.ToString("C"), FormatText.Bold, totalValueX, totalY, 50, 200, XStringFormats.TopCenter);
        }
        public void ConvertToPdf(string imageFilePath, string pdfFilePath)
        {
            ToPdf convertToPdf = new ToPdf();

            convertToPdf.ConvertImageToPdf(imageFilePath, pdfFilePath);
        }