コード例 #1
0
        public ActionResult FeePayment()
        {
            GetFrequency();
            Fee_Payment feePayment = new Fee_Payment();

            feePayment.Academic_Year = GetAcademicYear();
            long nFeePaymentId;

            feePayment.Payment_date = DateTime.Now.Date;
            using (var dbcontext = new SchoolERPDBContext())
            {
                if (dbcontext.Fee_Payment.ToList().Count == 0)
                {
                    feePayment.Recipt_no = "1" + " - " + Convert.ToString(GetAcademicYear());
                }
                else
                {
                    nFeePaymentId        = Convert.ToInt64(dbcontext.Fee_Payment.Max(x => x.Id) + 1);
                    feePayment.Recipt_no = Convert.ToString(GetAcademicYear()) + " - " + (nFeePaymentId);

                    //TempData["Student_Id"] = nFeePaymentId;
                    //TempData.Keep("Student_Id");
                }
            }

            return(View(feePayment));
        }
コード例 #2
0
        public static PdfPTable GenerateFeesPaymentRecipt(Fee_Payment fee_Payment)
        {
            CommonController oCommonController = new CommonController();
            PdfPTable        outerTable        = new PdfPTable(1);

            try
            {
                PdfPTable headingTable = new PdfPTable(1);

                PdfPCell headingTableCell = new PdfPCell(new Phrase("FEE RECIPT" + " - " + Convert.ToString(""), new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 22.5f, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(Color.Black))));
                headingTableCell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                headingTableCell.Border        = iTextSharp.text.Rectangle.NO_BORDER;
                headingTableCell.PaddingTop    = 45f;
                headingTableCell.PaddingBottom = 45f;
                headingTable.AddCell(headingTableCell);


                /*****************************************************************************************LOGO DESIGN *******************************************************************************/
                PdfPTable logoTable = new PdfPTable(2);


                string startupPath = AppDomain.CurrentDomain.BaseDirectory;

                string targetPath = startupPath + "Content\\images\\imageupload_-_Copy.png";



                iTextSharp.text.Image jpg = iTextSharp.text.Image.GetInstance(targetPath);
                //Resize image depend upon your need
                jpg.ScaleToFit(200f, 60f);
                //Give space before image
                jpg.SpacingBefore = 20f;
                //jpg.SpacingBefore = 150f;
                //Give some space after the image
                jpg.SpacingAfter = 20f;
                jpg.Alignment    = Element.ALIGN_CENTER;


                PdfPCell cellImage = new PdfPCell(jpg);
                cellImage.PaddingLeft = 2f;
                //cellImage.Border = iTextSharp.text.Rectangle.NO_BORDER;


                PdfPCell logoCell1 = new PdfPCell();

                cellImage.Border = iTextSharp.text.Rectangle.NO_BORDER;
                cellImage.Border = iTextSharp.text.Rectangle.RIGHT_BORDER;
                logoCell1.Border = iTextSharp.text.Rectangle.NO_BORDER;

                logoTable.AddCell(cellImage);
                logoTable.AddCell(logoCell1);



                /*****************************************************************************************LOGO DESIGN *******************************************************************************/
                PdfPTable studentDetailTable       = new PdfPTable(3);
                float[]   studentDetailTablewidths = new float[] { 200f, 200f, 200f };
                studentDetailTable.SetWidths(studentDetailTablewidths);
                /****************************************************FIRST TABLE (EMPLOYEE DETAILS ********************************************************************************************************************************/
                PdfPCell studentDetailTableCell11 = new PdfPCell(new Phrase("RECIPT NO  " + "\n" + "\n" + Convert.ToString(fee_Payment.Recipt_no) + "\n", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 22.5f, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(Color.Black))));
                studentDetailTableCell11.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                studentDetailTableCell11.Border        = iTextSharp.text.Rectangle.RIGHT_BORDER;
                studentDetailTableCell11.PaddingTop    = 15f;
                studentDetailTableCell11.PaddingBottom = 15f;

                //PdfPCell studentDetailTableCell11a = new PdfPCell(new Phrase("PAYMENT DATE  " +"\n" + "\n" + Convert.ToString(fee_Payment.Payment_date), new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 22.5f, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(Color.Black))));
                //studentDetailTableCell11a.HorizontalAlignment = PdfPCell.ALIGN_LEFT;
                //studentDetailTableCell11a.Border = iTextSharp.text.Rectangle.RIGHT_BORDER;
                ////staffDetailTableCell11.Border = iTextSharp.text.Rectangle.TOP_BORDER;
                //studentDetailTableCell11a.PaddingTop = 15f;
                //studentDetailTableCell11a.PaddingBottom = 15f;

                PdfPCell studentDetailTableCell12 = new PdfPCell(new Phrase("PAYMENT DATE  " + "\n" + "\n" + Convert.ToString(fee_Payment.Payment_date), new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 22.5f, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(Color.Black))));
                studentDetailTableCell12.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                studentDetailTableCell12.Border = iTextSharp.text.Rectangle.RIGHT_BORDER;
                //staffDetailTableCell12.Border = iTextSharp.text.Rectangle.TOP_BORDER;
                studentDetailTableCell12.PaddingTop    = 15f;
                studentDetailTableCell12.PaddingBottom = 15f;

                //PdfPCell studentDetailTableCell12a = new PdfPCell(new Phrase(Convert.ToString(fee_Payment.Payment_date), new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 22.5f, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(Color.Black))));
                //studentDetailTableCell12a.HorizontalAlignment = PdfPCell.ALIGN_LEFT;
                ////studentDetailTableCell12a.Border = iTextSharp.text.Rectangle.TOP_BORDER;
                //studentDetailTableCell12a.Border = iTextSharp.text.Rectangle.RIGHT_BORDER;
                //studentDetailTableCell12a.PaddingTop = 15f;
                //studentDetailTableCell12a.PaddingBottom = 15f;

                Student student = new Student();

                using (var dbcontext = new SchoolERPDBContext())
                {
                    student = dbcontext.Student.Where(x => x.Student_Id == fee_Payment.Student_id).FirstOrDefault();
                }


                using (var dbcontext = new SchoolERPDBContext())
                {
                    student = dbcontext.Student.Where(x => x.Student_Id == fee_Payment.Student_id).FirstOrDefault();
                }

                PdfPCell studentDetailTableCell13 = new PdfPCell(new Phrase("STUDENT NAME " + "\n" + "\n" + student.First_Name + " " + student.Last_Name + " " + student.Middle_Name, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 22.5f, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(Color.Black))));
                studentDetailTableCell13.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                studentDetailTableCell13.Border        = iTextSharp.text.Rectangle.NO_BORDER;
                studentDetailTableCell13.PaddingTop    = 15f;
                studentDetailTableCell13.PaddingBottom = 15f;



                PdfPCell studentDetailTableCell21 = new PdfPCell(new Phrase("ROLL NO" + "\n" + "\n" + student.Roll_No, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 22.5f, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(Color.Black))));
                studentDetailTableCell21.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                studentDetailTableCell21.Border        = iTextSharp.text.Rectangle.RIGHT_BORDER | iTextSharp.text.Rectangle.TOP_BORDER;
                studentDetailTableCell21.PaddingTop    = 15f;
                studentDetailTableCell21.PaddingBottom = 15f;



                string sFrequency = string.Empty;
                using (var dbcontext = new SchoolERPDBContext())
                {
                    sFrequency = dbcontext.Frequency.Where(x => x.Id == fee_Payment.Frequency).FirstOrDefault().Name;
                }

                PdfPCell studentDetailTableCell22 = new PdfPCell(new Phrase("FREQUENCY" + "\n" + "\n" + sFrequency, new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 22.5f, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(Color.Black))));
                studentDetailTableCell22.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                studentDetailTableCell22.Border        = iTextSharp.text.Rectangle.TOP_BORDER;
                studentDetailTableCell22.PaddingTop    = 15f;
                studentDetailTableCell22.PaddingBottom = 15f;



                PdfPCell studentDetailTableCell23 = new PdfPCell(new Phrase("CLASS & SECTION" + "\n" + "\n" + Convert.ToString(oCommonController.GetClassANdSectionForStudent(fee_Payment.Student_id)), new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 22.5f, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(Color.Black))));
                studentDetailTableCell23.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                studentDetailTableCell23.Border        = iTextSharp.text.Rectangle.LEFT_BORDER | iTextSharp.text.Rectangle.TOP_BORDER;
                studentDetailTableCell23.PaddingTop    = 15f;
                studentDetailTableCell23.PaddingBottom = 15f;


                studentDetailTable.AddCell(studentDetailTableCell11);
                studentDetailTable.AddCell(studentDetailTableCell12);
                studentDetailTable.AddCell(studentDetailTableCell13);
                studentDetailTable.AddCell(studentDetailTableCell21);

                studentDetailTable.AddCell(studentDetailTableCell22);
                studentDetailTable.AddCell(studentDetailTableCell23);

                List <FeeConfiguration_ViewModel> lstFeeConfig = new List <FeeConfiguration_ViewModel>();
                lstFeeConfig = oCommonController.GetFeeStructureForStudent(Convert.ToString(fee_Payment.Student_id), Convert.ToString(fee_Payment.Frequency));


                PdfPTable mySIItemDescriptionTable = new PdfPTable(1);
                PdfPTable feeComponentDescTable    = new PdfPTable(1);
                PdfPTable amountDescriptionTable   = new PdfPTable(1);

                PdfPTable feeTable       = new PdfPTable(4);
                float[]   feeTablewidths = new float[] { 50f, 250f, 50f, 50f };
                feeTable.SetWidths(feeTablewidths);
                feeTable.DefaultCell.Border = iTextSharp.text.Rectangle.NO_BORDER;

                //mySIItemDescriptionTable.DefaultCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
                //mySIItemDescriptionTable.DefaultCell.Border = iTextSharp.text.Rectangle.TOP_BORDER | iTextSharp.text.Rectangle.RIGHT_BORDER;
                //feeComponentDescTable.DefaultCell.Border = iTextSharp.text.Rectangle.NO_BORDER;
                //amountDescriptionTable.DefaultCell.Border = iTextSharp.text.Rectangle.NO_BORDER;

                //feeTable.AddCell(new Phrase(Convert.ToString("SI NO") + "\n" + "", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 22.5f, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(Color.Black))));


                //feeTable.AddCell(new Phrase(Convert.ToString("FEE COMPONENT") + "\n" + "", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 22.5f, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(Color.Black))));

                //feeTable.AddCell(new Phrase(Convert.ToString("AMOUNT") + "\n" + "", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 22.5f, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(Color.Black))));

                //feeTable.AddCell(new Phrase(Convert.ToString("PAISE") + "\n" + "", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 22.5f, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(Color.Black))));

                PdfPCell SIheaderItemCell = new PdfPCell(new Phrase(Convert.ToString("SI NO"), new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 22.5f, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(Color.Black))));
                SIheaderItemCell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                SIheaderItemCell.Border        = iTextSharp.text.Rectangle.RIGHT_BORDER;
                SIheaderItemCell.PaddingTop    = 45f;
                SIheaderItemCell.PaddingBottom = 45f;

                PdfPCell feeComponentheaderCell = new PdfPCell(new Phrase(Convert.ToString("FEE COMPONENT"), new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 22.5f, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(Color.Black))));
                feeComponentheaderCell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                feeComponentheaderCell.Border        = iTextSharp.text.Rectangle.RIGHT_BORDER;
                feeComponentheaderCell.PaddingTop    = 45f;
                feeComponentheaderCell.PaddingBottom = 45f;

                PdfPCell amountItemheaderCell = new PdfPCell(new Phrase(Convert.ToString("AMOUNT"), new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 22.5f, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(Color.Black))));
                amountItemheaderCell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                amountItemheaderCell.Border        = iTextSharp.text.Rectangle.RIGHT_BORDER;
                amountItemheaderCell.PaddingTop    = 45f;
                amountItemheaderCell.PaddingBottom = 45f;

                PdfPCell paiseItemheaderCell = new PdfPCell(new Phrase(Convert.ToString("PAISE"), new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 22.5f, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(Color.Black))));
                paiseItemheaderCell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                paiseItemheaderCell.Border        = iTextSharp.text.Rectangle.LEFT_BORDER;
                paiseItemheaderCell.PaddingTop    = 45f;
                paiseItemheaderCell.PaddingBottom = 45f;


                feeTable.AddCell(SIheaderItemCell);
                feeTable.AddCell(feeComponentheaderCell);
                feeTable.AddCell(amountItemheaderCell);
                feeTable.AddCell(paiseItemheaderCell);

                for (int nRowCount = 0; nRowCount < lstFeeConfig.ToList().Count; nRowCount++)
                {
                    PdfPCell SIItemCell = new PdfPCell(new Phrase(Convert.ToString(nRowCount + 1) + ". ", new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 22.5f, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(Color.Black))));
                    SIItemCell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                    SIItemCell.Border        = iTextSharp.text.Rectangle.RIGHT_BORDER | iTextSharp.text.Rectangle.TOP_BORDER;
                    SIItemCell.PaddingTop    = 15f;
                    SIItemCell.PaddingBottom = 15f;

                    PdfPCell feeComponentCell = new PdfPCell(new Phrase(Convert.ToString(lstFeeConfig[nRowCount].Name), new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 22.5f, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(Color.Black))));
                    feeComponentCell.HorizontalAlignment = PdfPCell.ALIGN_LEFT;
                    feeComponentCell.Border        = iTextSharp.text.Rectangle.RIGHT_BORDER | iTextSharp.text.Rectangle.TOP_BORDER;
                    feeComponentCell.PaddingTop    = 15f;
                    feeComponentCell.PaddingBottom = 15f;

                    var values     = Convert.ToString(lstFeeConfig[nRowCount].Amount).Split('.');
                    int firstValue = int.Parse(values[0]);

                    PdfPCell amountItemCell = new PdfPCell(new Phrase(string.Format(new CultureInfo("en-IN", false), "{0:n0}", firstValue), new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 22.5f, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(Color.Black))));
                    amountItemCell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                    amountItemCell.Border        = iTextSharp.text.Rectangle.TOP_BORDER | iTextSharp.text.Rectangle.RIGHT_BORDER;
                    amountItemCell.PaddingTop    = 15f;
                    amountItemCell.PaddingBottom = 15f;

                    PdfPCell paiseItemCell = new PdfPCell(new Phrase(Convert.ToString(values[1]), new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 22.5f, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(Color.Black))));
                    paiseItemCell.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                    paiseItemCell.Border        = iTextSharp.text.Rectangle.TOP_BORDER;
                    paiseItemCell.PaddingTop    = 15f;
                    paiseItemCell.PaddingBottom = 15f;

                    feeTable.AddCell(SIItemCell);
                    feeTable.AddCell(feeComponentCell);
                    feeTable.AddCell(amountItemCell);
                    feeTable.AddCell(paiseItemCell);
                    feeTable.AddCell(SIItemCell);
                    feeTable.AddCell(feeComponentCell);
                    feeTable.AddCell(amountItemCell);
                    feeTable.AddCell(paiseItemCell);
                }

                /*********************************************************************GROSS SALARY **********************************************************************************************/

                PdfPTable grossAndNetAmountTable = new PdfPTable(3);

                float[] width = new float[] { 300f, 50f, 50f };
                grossAndNetAmountTable.SetWidths(width);

                PdfPCell grossAndNetAmountTableCell11 = new PdfPCell(new Phrase(Convert.ToString("TOTAL AMOUNT"), new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 22.5f, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(Color.Black))));
                grossAndNetAmountTableCell11.HorizontalAlignment = PdfPCell.ALIGN_RIGHT;
                grossAndNetAmountTableCell11.Border        = iTextSharp.text.Rectangle.RIGHT_BORDER;
                grossAndNetAmountTableCell11.PaddingTop    = 15f;
                grossAndNetAmountTableCell11.PaddingBottom = 15f;

                var totalvalues     = Convert.ToString(lstFeeConfig[0].Total).Split('.');
                int totalfirstValue = int.Parse(totalvalues[0]);

                PdfPCell grossAndNetAmountTableCell12 = new PdfPCell(new Phrase(Convert.ToString(string.Format(new CultureInfo("en-IN", false), "{0:n0}", totalfirstValue)), new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 22.5f, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(Color.Black))));
                grossAndNetAmountTableCell12.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                grossAndNetAmountTableCell12.Border        = iTextSharp.text.Rectangle.RIGHT_BORDER;
                grossAndNetAmountTableCell12.PaddingTop    = 15f;
                grossAndNetAmountTableCell12.PaddingBottom = 15f;

                PdfPCell grossAndNetAmountTableCell13 = new PdfPCell(new Phrase(Convert.ToString(totalvalues[1]), new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 22.5f, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(Color.Black))));
                grossAndNetAmountTableCell13.HorizontalAlignment = PdfPCell.ALIGN_CENTER;
                grossAndNetAmountTableCell13.Border        = iTextSharp.text.Rectangle.NO_BORDER;
                grossAndNetAmountTableCell13.PaddingTop    = 15f;
                grossAndNetAmountTableCell13.PaddingBottom = 15f;



                grossAndNetAmountTable.AddCell(grossAndNetAmountTableCell11);
                grossAndNetAmountTable.AddCell(grossAndNetAmountTableCell12);
                grossAndNetAmountTable.AddCell(grossAndNetAmountTableCell13);

                /*********************************************************************GROSS SALARY ENDS **********************************************************************************************/


                PdfPTable amountInWordsTable        = new PdfPTable(1);
                PdfPCell  amountInWordstTableCell11 = new PdfPCell(new Phrase(Convert.ToString("AMOUNT IN WORDS : " + NumberToWordsConverter.NumToWord(Convert.ToDecimal(totalvalues[0]))), new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 22.5f, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(Color.Black))));
                amountInWordstTableCell11.HorizontalAlignment = PdfPCell.ALIGN_LEFT;
                amountInWordstTableCell11.Border        = iTextSharp.text.Rectangle.NO_BORDER;
                amountInWordstTableCell11.PaddingTop    = 45f;
                amountInWordstTableCell11.PaddingBottom = 45f;

                amountInWordsTable.AddCell(amountInWordstTableCell11);



                PdfPTable authorisedSignatoryTable       = new PdfPTable(1);
                PdfPCell  authorisedSignatoryTableCell11 = new PdfPCell(new Phrase(Convert.ToString("AUTHORISED SIGNATURE "), new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 22.5f, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(Color.Black))));
                authorisedSignatoryTableCell11.HorizontalAlignment = PdfPCell.ALIGN_RIGHT;
                authorisedSignatoryTableCell11.Border        = iTextSharp.text.Rectangle.NO_BORDER;
                authorisedSignatoryTableCell11.PaddingTop    = 45f;
                authorisedSignatoryTableCell11.PaddingBottom = 45f;

                authorisedSignatoryTable.AddCell(authorisedSignatoryTableCell11);

                PdfPTable LateFeesAndDueDateTable = new PdfPTable(2);

                PdfPCell LateFeesAndDueDateTableCell11 = new PdfPCell(new Phrase(Convert.ToString("LATE FEES IF ANY : " + Convert.ToString(lstFeeConfig[0].Late_Fees)), new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 22.5f, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(Color.Black))));
                LateFeesAndDueDateTableCell11.HorizontalAlignment = PdfPCell.ALIGN_LEFT;
                LateFeesAndDueDateTableCell11.Border        = iTextSharp.text.Rectangle.NO_BORDER;
                LateFeesAndDueDateTableCell11.PaddingTop    = 25f;
                LateFeesAndDueDateTableCell11.PaddingBottom = 25f;

                //	DateTime dtNextDueDate = DateTime.ParseExact(Convert.ToString(lstFeeConfig[0].Next_Due_Date), "dd-MM-yy", null);

                PdfPCell LateFeesAndDueDateTableCell12 = new PdfPCell(new Phrase(Convert.ToString("NEXT DUE DATE : " + Convert.ToString(Convert.ToDateTime(lstFeeConfig[0].Next_Due_Date).ToShortDateString())), new iTextSharp.text.Font(iTextSharp.text.Font.FontFamily.TIMES_ROMAN, 22.5f, iTextSharp.text.Font.BOLD, new iTextSharp.text.BaseColor(Color.Black))));
                LateFeesAndDueDateTableCell12.HorizontalAlignment = PdfPCell.ALIGN_LEFT;
                LateFeesAndDueDateTableCell12.Border        = iTextSharp.text.Rectangle.NO_BORDER;
                LateFeesAndDueDateTableCell12.PaddingTop    = 25f;
                LateFeesAndDueDateTableCell12.PaddingBottom = 25f;

                LateFeesAndDueDateTable.AddCell(LateFeesAndDueDateTableCell11);
                LateFeesAndDueDateTable.AddCell(LateFeesAndDueDateTableCell12);


                outerTable.AddCell(headingTable);
                outerTable.AddCell(logoTable);
                outerTable.AddCell(studentDetailTable);
                outerTable.AddCell(feeTable);
                outerTable.AddCell(grossAndNetAmountTable);
                outerTable.AddCell(amountInWordsTable);
                outerTable.AddCell(LateFeesAndDueDateTable);
                outerTable.AddCell(authorisedSignatoryTable);
            }
            catch (Exception ex)
            {
            }

            return(outerTable);
            //return null;
        }
コード例 #3
0
        public JsonResult PayFeesForStudent(Fee_Payment fee_Payment)
        {
            long   nYear       = GetAcademicYear();
            string sReturnText = string.Empty;

            fee_Payment.Created_On    = DateTime.Now;
            fee_Payment.Created_By    = 4;
            fee_Payment.Academic_Year = nYear;
            fee_Payment.Is_Active     = true;
            fee_Payment.Collected_by  = "devi";
            //fee_Payment.Next_due_date = (fee_Payment.Next_due_date ==  :
            fee_Payment.File_Name = "FEE_RECIPT" + fee_Payment.Student_id + "_" + fee_Payment.Recipt_no + ".pdf";
            try
            {
                using (var dbcontext = new SchoolERPDBContext())
                {
                    if (dbcontext.Fee_Payment.Where(a => a.Student_id == fee_Payment.Student_id && a.Frequency == fee_Payment.Frequency && a.Academic_Year == nYear && (a.Is_Deleted == false || a.Is_Deleted == null)).Count() == 0)
                    {
                        dbcontext.Fee_Payment.Add(fee_Payment);
                        dbcontext.SaveChanges();
                        System.IO.FileStream fs;
                        Document             pdfDoc;
                        pdfDoc = new Document(PageSize.A2, 0f, 0f, 80f, 30f);

                        string severFilePath = Server.MapPath("~/views//billing//");

                        if (!Directory.Exists(severFilePath))
                        {                         // if it doesn't exist, create
                            System.IO.Directory.CreateDirectory(severFilePath);
                        }

                        //fs = new FileStream(severFilePath + "//" + ""+ "_" + "FEE_RECIPT" + fee_Payment.Student_id + "_" + "" + "_Triplicate" + ".pdf", FileMode.Create);
                        fs = new FileStream(severFilePath + "//" + fee_Payment.File_Name, FileMode.Create);
                        PdfWriter writer = PdfWriter.GetInstance(pdfDoc, fs);

                        writer.CloseStream = false;


                        iTextSharp.text.Font NormalFont = FontFactory.GetFont("Arial", 12, BaseColor.BLUE);
                        Paragraph            paragraph  = new Paragraph("                                                                                          INVOICE                                                                                               (Original)");
                        pdfDoc.Open();

                        pdfDoc.Add(PDFGenerateController.GenerateFeesPaymentRecipt(fee_Payment));
                        pdfDoc.Close();
                        // Close the writer instance
                        writer.Close();
                        // Always close open filehandles explicity
                        fs.Close();


                        //oPDFGenerateController.GenerateFeesPaymentRecipt(fee_Payment);
                        sReturnText = "OK";
                    }
                    else
                    {
                        sReturnText = "Already Paid";
                    }
                }
            }
            catch (Exception ex)
            {
                sReturnText = ex.Message.ToString();
            }

            return(Json(sReturnText, JsonRequestBehavior.AllowGet));
        }