コード例 #1
0
        public byte[] FillIRS941Form(ReportPayrollCompanyTotal payrollData)
        {
            string iRS941FormTemplate = HttpContext.Current.Server.MapPath("~/FormTemplates/IRS2015Form941.pdf");
            byte[] formResults;

            using (PdfReader pdfReader = new PdfReader(iRS941FormTemplate))
            {
                using (MemoryStream ms = new MemoryStream())
                {
                    using (PdfStamper pdfStamper = new PdfStamper(pdfReader, ms))
                    {
                        AcroFields pdfFormFields = pdfStamper.AcroFields;
                        var s = pdfFormFields.GetSignatureNames();
                        var e = pdfFormFields.GetBlankSignatureNames();

                        pdfFormFields.SetField("f1_10_0_", "Suitland Road Baptist Church");

                        pdfStamper.FormFlattening = false;
                        pdfStamper.Close();
                    }

                    formResults = ms.GetBuffer();
                }
            }

            return formResults;
        }
コード例 #2
0
        public ReportPayrollCompanyTotal GetReportPayrollCompanyTotal()
        {
            ReportPayrollCompanyTotal rpp = new ReportPayrollCompanyTotal();
            ReportPersonPayrollAccount currentReportPersonPayrollAccount;
            rpp.ReportCompanyAccountBalances = new List<ReportPersonPayrollAccount>();
            rpp.ReportAllEmployeesAccountTransactions = new List<ReportPersonPayrollAccountTransaction>();

            IEnumerable<PayrollPersonTransaction> transForPerson = this.unitOfWork.PayrollPersonTransactionRepository.Get(x =>
                DbFunctions.TruncateTime(x.CreatedOn) >= this.startDate.Date
                && DbFunctions.TruncateTime(x.CreatedOn) <= this.endDate.Date
                && x.Active).ToArray();

            if (transForPerson.Count() > 0)
            {
                foreach (var tran in transForPerson)
                {
                    foreach (var deductionAccount in tran.PayrollDeductionAccounts)
                    {
                        rpp.ReportAllEmployeesAccountTransactions.Add(new ReportPersonPayrollAccountTransaction()
                        {
                            ReportPersonPayrollAccount = new ReportPersonPayrollAccount()
                            {
                                AccountTitle = deductionAccount.Title,
                                AccountTotal = ComputeTotal(tran.GrossSalary, deductionAccount),
                                PayrollDeductionAccountID = deductionAccount.PayrollDeductionAccountID
                            },
                            TransactionDate = tran.CreatedOn.DateTime,
                            GrossSalary = tran.GrossSalary,
                        });
                    }
                }

                foreach (var tran in rpp.ReportAllEmployeesAccountTransactions.GroupBy(x => x.ReportPersonPayrollAccount.PayrollDeductionAccountID))
                {
                    currentReportPersonPayrollAccount = new ReportPersonPayrollAccount();

                    currentReportPersonPayrollAccount.PayrollDeductionAccountID = tran.Key;

                    foreach (var deductionAccount in tran)
                    {
                        currentReportPersonPayrollAccount.AccountTitle = deductionAccount.ReportPersonPayrollAccount.AccountTitle;
                        currentReportPersonPayrollAccount.AccountTotal += deductionAccount.ReportPersonPayrollAccount.AccountTotal;
                    }

                    rpp.ReportCompanyAccountBalances.Add(currentReportPersonPayrollAccount);
                } 
            }

            return rpp;
        }