Exemple #1
0
        private void LoadPage()
        {
            var p = Attendance.GetCurrentPayPeriod();

            _attendance = new Attendance(Aid, p.month, p.period, p.year);
            RefreshData();
        }
Exemple #2
0
 public void LoadPage()
 {
     if (!Name.Equals("Archived"))
     {
         var p = Attendance.GetCurrentPayPeriod();
         _attendance = new Attendance(Aid, p.month, p.period, p.year);
     }
     RefreshDutyDetails();
     RefreshCurrent();
     RefreshData();
 }
Exemple #3
0
        public void ExportToPayslipPDF(DataTable approvedList, bool printFlag)
        {
            int gid, month, period, year;
            int i;

            string   filePath   = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\" + "MSAMIS Reports";
            var      PrintTable = new PdfPTable(2);
            var      alignTable = new PdfPTable(2);
            Document pdfDoc     = getPDFSize(approvedList.Rows.Count);

            alignTable.DefaultCell.Padding     = 3;
            alignTable.WidthPercentage         = 100;
            alignTable.DefaultCell.BorderWidth = 0;
            //alignTable.LockedWidth = true;
            Paragraph par = new Paragraph();

            PrintTable.DefaultCell.Padding     = 3;
            PrintTable.WidthPercentage         = 100;
            PrintTable.DefaultCell.BorderWidth = 0;
            if (approvedList.Rows.Count != 1)
            {
                fileName = "PayslipBatchPrintTemp.pdf";
            }
            //rylui.RylMessageBox.ShowDialog("Flag boiii");
            for (i = 0; i < approvedList.Rows.Count; i++)
            {
                alignTable = new PdfPTable(2);
                alignTable.HorizontalAlignment     = Element.ALIGN_LEFT;
                alignTable.DefaultCell.Padding     = 3;
                alignTable.WidthPercentage         = 45;
                alignTable.DefaultCell.BorderWidth = 0;

                gid    = Convert.ToInt32(approvedList.Rows[i][0]);
                month  = Convert.ToInt32(approvedList.Rows[i][1]);
                period = Convert.ToInt32(approvedList.Rows[i][2]);
                year   = Convert.ToInt32(approvedList.Rows[i][3]);


                var               newLine = Environment.NewLine;
                PayrollReport     pr      = new PayrollReport(gid, year, month, period);
                Attendance.Period p       = Attendance.GetCurrentPayPeriod();
                //Content
                //Name
                String GuardFullName = pr.LN.ToUpper() + ", " + pr.FN.ToUpper() + " " + pr.MN[0].ToString().ToUpper() + ".";
                Phrase Name          = new Phrase(GuardFullName + newLine, boldfontPayslip);
                //rylui.RylMessageBox.ShowDialog(GuardFullName);

                Phrase Header       = new Phrase("THIS IS TO CERTIFY THAT I'VE RECEIVED THE FULL" + newLine + " AMOUNT OF MY SALARY FOR THE PERIOD OF " + newLine, myfontPayslip);
                Chunk  ChunkHeader2 = new Chunk(($@"{(p.period == 1 ? "1ST HALF" : "2ND HALF")} OF {p.month}/{p.year}") + newLine + newLine, boldfontPayslip);

                Header.Add(ChunkHeader2);

                //deductions

                alignTable.AddCell(new Phrase("DEDUCTIONS:" + newLine, boldunderfontPayslip));
                alignTable.AddCell(new Phrase(" ", boldunderfontPayslip));

                alignTable.AddCell(new Phrase("SSS: ", myfontPayslip));
                alignTable.AddCell(new Phrase("Php " + pr.Sss.ToString("0.00"), myfontPayslip));

                alignTable.AddCell(new Phrase("PHIC: ", myfontPayslip));
                alignTable.AddCell(new Phrase("Php " + pr.PHIC.ToString("₱0.00"), myfontPayslip));

                alignTable.AddCell(new Phrase("Tax Withhold: ", myfontPayslip));
                alignTable.AddCell(new Phrase("Php " + pr.Withtax.ToString("₱0.00"), myfontPayslip));

                alignTable.AddCell(new Phrase("Pag-Ibig: ", myfontPayslip));
                alignTable.AddCell(new Phrase("Php " + pr.HDMF.ToString("₱0.00"), myfontPayslip));

                alignTable.AddCell(new Phrase("Cash Advance: ", myfontPayslip));
                alignTable.AddCell(new Phrase("Php " + pr.CashAdvance.ToString("₱0.00"), myfontPayslip));

                double TotalDedVal = pr.Sss + pr.PHIC + pr.Withtax + pr.HDMF + pr.CashAdvance;
                alignTable.AddCell(new Phrase("Total Deductions: ", boldfontPayslip));
                alignTable.AddCell(new Phrase("Php " + TotalDedVal.ToString("₱0.00"), boldfontPayslip));

                alignTable.AddCell(new Phrase(" "));
                alignTable.AddCell(new Phrase(" "));

                //Bonuses
                alignTable.AddCell(new Phrase("BONUSES:", boldunderfontPayslip));
                alignTable.AddCell(new Phrase("", boldunderfontPayslip));

                alignTable.AddCell(new Phrase("Thirteenth Month: ", myfontPayslip));
                alignTable.AddCell(new Phrase("Php " + pr.ThirteenthMonthPay.ToString("₱0.00"), myfontPayslip));

                alignTable.AddCell(new Phrase("Cola: ", myfontPayslip));
                alignTable.AddCell(new Phrase("Php " + pr.Cola.ToString("₱0.00"), myfontPayslip));

                alignTable.AddCell(new Phrase("Cash Bond: ", myfontPayslip));
                alignTable.AddCell(new Phrase("Php " + pr.CashBond.ToString("₱0.00"), myfontPayslip));

                alignTable.AddCell(new Phrase("Emergency Allowance: ", myfontPayslip));
                alignTable.AddCell(new Phrase("Php " + pr.EmergencyAllowance.ToString("₱0.00"), myfontPayslip));

                double TotalBonVal = pr.ThirteenthMonthPay + pr.Cola + pr.CashBond + pr.EmergencyAllowance;
                alignTable.AddCell(new Phrase("Total Bonuses: ", boldfontPayslip));
                alignTable.AddCell(new Phrase("Php " + TotalBonVal.ToString("₱0.00"), boldfontPayslip));

                alignTable.DefaultCell.Colspan = 2;
                alignTable.AddCell(new Phrase(" "));

                alignTable.AddCell(new Phrase("PLEASE COUNT YOUR MONEY BEFORE LEAVING", myfontPayslip));

                alignTable.AddCell(new Phrase(" "));

                alignTable.AddCell(new Phrase("TOTAL PAY: Php " + pr.NetAmountPaid.ToString("₱0.00") + newLine + newLine, boldunderfontPayslip));
                alignTable.DefaultCell.Colspan = 1;

                //Export Content
                if (approvedList.Rows.Count == 1)
                {
                    fileName = "Payslip" + pr.LN + pr.FN + pr.MN + ($@"{p.year}-{p.month}-{(p.period == 1 ? "1st_Half" : "2nd_Half")}") + ".pdf";
                }

                if (!Directory.Exists(filePath))
                {
                    Directory.CreateDirectory(filePath);
                }


                if (File.Exists(filePath + "\\" + fileName))
                {
                    File.Delete(filePath + "\\" + fileName);
                }


                par.Add(Name);
                par.Add(Header);
                par.Add(alignTable);
            }
            using (FileStream stream = new FileStream(filePath + "\\" + fileName, FileMode.Create))
            {
                //pdfDoc = new Document();
                PdfWriter.GetInstance(pdfDoc, stream);
                pdfDoc.Open();
                pdfDoc.Add(par);
                pdfDoc.Close();
                stream.Close();
            }
            if (printFlag == true)
            {
                PrintPDF(fileName);
            }
        }
Exemple #4
0
        public void ExportToPayslipPDFOne(DataTable approvedList, string file)
        {
            int i;
            var PrintTable = new PdfPTable(2);
            var alignTable = new PdfPTable(2);

            alignTable.DefaultCell.Padding     = 3;
            alignTable.WidthPercentage         = 100;
            alignTable.DefaultCell.BorderWidth = 0;
            //alignTable.LockedWidth = true;

            PrintTable.DefaultCell.Padding     = 3;
            PrintTable.WidthPercentage         = 100;
            PrintTable.DefaultCell.BorderWidth = 0;

            //rylui.RylMessageBox.ShowDialog("Flag boiii");
            for (i = 0; i < approvedList.Rows.Count; i++)
            {
                var gid    = Convert.ToInt32(approvedList.Rows[i][0]);
                var month  = Convert.ToInt32(approvedList.Rows[i][1]);
                var period = Convert.ToInt32(approvedList.Rows[i][2]);
                var year   = Convert.ToInt32(approvedList.Rows[i][3]);

                var newLine = Environment.NewLine;
                var pr      = new PayrollReport(gid, year, month, period);
                var p       = Attendance.GetCurrentPayPeriod();
                //Content
                //Name
                var GuardFullName = pr.LN.ToUpper() + ", " + pr.FN.ToUpper() + " " + pr.MN[0].ToString().ToUpper() + ".";
                var Name          = new Phrase(GuardFullName + newLine, boldfontPayslip);

                var Header       = new Phrase("THIS IS TO CERTIFY THAT I'VE RECEIVED THE FULL AMOUNT OF MY SALARY FOR THE PERIOD OF ", myfontPayslip);
                var ChunkHeader2 = new Chunk(($@"{(p.period == 1 ? "1ST HALF" : "2ND HALF")} OF {p.month}/{p.year}") + newLine + newLine, boldfontPayslip);

                Header.Add(ChunkHeader2);

                //deductions

                alignTable.AddCell(new Phrase("DEDUCTIONS:" + newLine, boldunderfontPayslip));
                alignTable.AddCell(new Phrase(" ", boldunderfontPayslip));

                alignTable.AddCell(new Phrase("SSS: ", myfontPayslip));
                alignTable.AddCell(new Phrase("Php " + pr.Sss.ToString("0.00"), myfontPayslip));

                alignTable.AddCell(new Phrase("PHIC: ", myfontPayslip));
                alignTable.AddCell(new Phrase("Php " + pr.PHIC.ToString("₱0.00"), myfontPayslip));

                alignTable.AddCell(new Phrase("Tax Withhold: ", myfontPayslip));
                alignTable.AddCell(new Phrase("Php " + pr.Withtax.ToString("₱0.00"), myfontPayslip));

                alignTable.AddCell(new Phrase("Pag-Ibig: ", myfontPayslip));
                alignTable.AddCell(new Phrase("Php " + pr.HDMF.ToString("₱0.00"), myfontPayslip));

                alignTable.AddCell(new Phrase("Cash Advance: ", myfontPayslip));
                alignTable.AddCell(new Phrase("Php " + pr.CashAdvance.ToString("₱0.00"), myfontPayslip));

                var TotalDedVal = pr.Sss + pr.PHIC + pr.Withtax + pr.HDMF + pr.CashAdvance;
                alignTable.AddCell(new Phrase("Total Deductions: ", boldfontPayslip));
                alignTable.AddCell(new Phrase("Php " + TotalDedVal.ToString("₱0.00"), boldfontPayslip));

                alignTable.AddCell(new Phrase(" "));
                alignTable.AddCell(new Phrase(" "));

                //Bonuses
                alignTable.AddCell(new Phrase("BONUSES:", boldunderfontPayslip));
                alignTable.AddCell(new Phrase("", boldunderfontPayslip));

                alignTable.AddCell(new Phrase("Thirteenth Month: ", myfontPayslip));
                alignTable.AddCell(new Phrase("Php " + pr.ThirteenthMonthPay.ToString("₱0.00"), myfontPayslip));

                alignTable.AddCell(new Phrase("Cola: ", myfontPayslip));
                alignTable.AddCell(new Phrase("Php " + pr.Cola.ToString("₱0.00"), myfontPayslip));

                alignTable.AddCell(new Phrase("Cash Bond: ", myfontPayslip));
                alignTable.AddCell(new Phrase("Php " + pr.CashBond.ToString("₱0.00"), myfontPayslip));

                alignTable.AddCell(new Phrase("Emergency Allowance: ", myfontPayslip));
                alignTable.AddCell(new Phrase("Php " + pr.EmergencyAllowance.ToString("₱0.00"), myfontPayslip));

                var TotalBonVal = pr.ThirteenthMonthPay + pr.Cola + pr.CashBond + pr.EmergencyAllowance;
                alignTable.AddCell(new Phrase("Total Bonuses: ", boldfontPayslip));
                alignTable.AddCell(new Phrase("Php " + TotalBonVal.ToString("₱0.00"), boldfontPayslip));

                alignTable.DefaultCell.Colspan = 2;
                alignTable.AddCell(new Phrase(" "));

                alignTable.AddCell(new Phrase("PLEASE COUNT YOUR MONEY BEFORE LEAVING", myfontPayslip));

                alignTable.AddCell(new Phrase(" "));

                alignTable.AddCell(new Phrase("TOTAL PAY: Php " + pr.NetAmountPaid.ToString("₱0.00"), boldunderfontPayslip));

                //Export Content

                using (var stream = new FileStream(file, FileMode.Create)) {
                    var pdfDoc = getPDFSize(approvedList.Rows.Count);// new Document(PageSize.A8, 10f, 10f, 10f, 10f);
                    PdfWriter.GetInstance(pdfDoc, stream);
                    pdfDoc.Open();

                    pdfDoc.Add(Name);
                    pdfDoc.Add(Header);

                    pdfDoc.Add(alignTable);
                    pdfDoc.Close();
                    stream.Close();
                }
            }
        }