コード例 #1
0
        public ActionResult SetCheckData(Guid AccountTransactionID)
        {
            CheckData checkData = new CheckData();
            AccountingTransaction accountingTransaction = unitOfWork.AccountingTransactionRepository.GetByID(AccountTransactionID);
            checkData.PayTo = accountingTransaction.AccountingTransactionSource.AccountingVendorID == null ? accountingTransaction.AccountingTransactionSource.PersonPrimaryInfoID == null ? "None" : accountingTransaction.AccountingTransactionSource.PersonPrimaryInfo.LastFirstName : accountingTransaction.AccountingTransactionSource.AccountingVendor.VendorFullName;
            checkData.Date = DateTime.Now.ToShortDateString();
            checkData.AmountNumeric = accountingTransaction.Amount.ToString("F2");

            return View(checkData);
        }
コード例 #2
0
        //public ActionResult SetCheckData(bool isAVendor, int VendorID = 0, int PersonPrimaryInfoID = 0)
        //{

        //    return View();
        //}

        public ActionResult Print(CheckData checkData)
        {
           // MemoryStream checkPDF = new MemoryStream();

            PDFFormManager pdfManager = new PDFFormManager();

            //checkData.PayTo = "The Church Supply Company";
            //checkData.Date = "June 7, 2018";
            //checkData.AmountAlpha = "*********************************************************************************************************";
            //checkData.AmountNumeric = "175.00";

            string newCheckPath = pdfManager.FillCheckData(checkData);

            return File(newCheckPath, "application/pdf", String.Format("Check_{0}_{1}.pdf", FormatNameForCheck(checkData.PayTo), DateTime.Now.ToString("yyyyMMddHHmmss")));
        }
コード例 #3
0
        /// <summary>
        /// Prints a check
        /// </summary>
        /// <param name="checkData"></param>
        public string FillCheckData(CheckData checkData)
        {
            string topOfPageBusinessCheckCheckTemplate = HttpContext.Current.Server.MapPath("~/FormTemplates/TopOfPageBusinessCheck.pdf");
            string newCheck = HttpContext.Current.Server.MapPath(String.Format("~/FormTemplates/PrintedChecks/Check{0}.pdf", DateTime.Now.ToString("yyyyMMddHHmmssFFFFFFF")));

            using (PdfReader pdfReader = new PdfReader(topOfPageBusinessCheckCheckTemplate))
            {
                using (PdfStamper pdfStamper = new PdfStamper(pdfReader, new FileStream(newCheck, FileMode.Create)))
                {
                    AcroFields pdfFormFields = pdfStamper.AcroFields;

                    pdfFormFields.SetField("PayTo", checkData.PayTo);
                    pdfFormFields.SetField("Date", checkData.Date);
                    pdfFormFields.SetField("AmountNumeric", checkData.AmountNumeric);
                    pdfFormFields.SetField("AmountAlpha", CheckNumberToWord(checkData.AmountNumeric));

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

            return newCheck;
        }