Example #1
0
        public static string BusinessPermitApprovedTemplate(BusinessPermit.Models.BusinessPermit permit, List <Fee> fees)
        {
            //  Thank you for using the service. Have a nice day!
            string result = String.Format(@"<br>       
                         Good Day!
                       <br/>
                       <br/>
                       <br/>
                       <br/>
                       <div style=""margin-left:30px;"">
                           This is to inform you that your application for <b>Business Permit</b> has been <b>APPROVED</b>.
                      
                       <br/>    
                       <br/>
                       Your Reference Number for the permits payment is <b>{0}</b>
                       <br/>
                       <br/>
                       The following are your fees for this application:
                       <br/>
                       <br/>", permit.PaymentReference);
            float  total  = 0;

            foreach (var item in fees)
            {
                total  += item.Price;
                result += string.Format("P{0}&nbsp;&nbsp;&nbsp;- {1} <br/><br/>", item.Price, item.Description);
            }

            result += "P" + total + " - <b>TOTAL</b> <br/><br/> ";

            result += String.Format("For us to verify your payment, kindly click this <a href=\"{0}\">link</a> upon settling your account. <br/><br/>", GetPaymentUrl());
            result += " </div><br/><br/><br/><br/> Thank you for using the service. Have a nice day!";

            return(result);
        }
Example #2
0
        //     GET: /aw/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BusinessPermit.Models.BusinessPermit businesspermit = db.BusinessPermits.Find(id);
            if (businesspermit == null)
            {
                return(HttpNotFound());
            }

            return(View(businesspermit));
        }
Example #3
0
        private async Task ApproveBusiness(Payment payment)
        {
            BusinessPermit.Models.BusinessPermit permit = await db.BusinessPermits.Include(b => b.ZoningClearance).SingleOrDefaultAsync(z => z.PaymentReference == payment.ReferenceNumber);

            if (permit != null)
            {
                permit.Status           = "Paid";
                payment.Status          = "Confirmed";
                payment.TotalPayment    = permit.TotalPayment;
                db.Entry(permit).State  = EntityState.Modified;
                db.Entry(payment).State = EntityState.Modified;
                await db.SaveChangesAsync();

                // email ung attachment with congratulations
                EmailSender.SendMail(permit.ZoningClearance.EmailAddress, "Business Permit Certification", EmailSender.LocationalClearanceCertifyTemplate(), EmailSender.CreateAttachment(permit));
            }
        }
Example #4
0
        public ActionResult ApproveApplication(int?id)
        {
            var permitQuery = db.BusinessPermits.Include(b => b.ZoningClearance);

            BusinessPermit.Models.BusinessPermit permit = permitQuery.FirstOrDefault(p => p.Id == id);
            List <Fee> fees = db.Fees.Include(p => p.ApplicationType).Where(p => p.ApplicationType.Description.Contains("Business")).ToList();

            if (permit == null)
            {
                return(HttpNotFound());
            }

            permit.Status           = "Approved";
            permit.PaymentReference = base.RandomString();
            db.Entry(permit).State  = EntityState.Modified;
            permit.TotalPayment     = fees.Sum(f => f.Price);
            db.SaveChanges();

            EmailSender.SendMail(permit.ZoningClearance.EmailAddress, "Business Permit Application : Approved", EmailSender.BusinessPermitApprovedTemplate(permit, fees));
            return(RedirectToAction("Index"));
        }
Example #5
0
        public ActionResult Create([Bind(Include = "Id,IsNew,BusinessAccountNumber,DateApplied,BusinessName,OwnerName,BusinessAddress,BusinessNature,DeliveryVehicles,TotalAreaBusiness,ContactNumber,TotalEmployee,RentedOwnerName,MonthlyRental,JanGrossReceipt,FebGrossReceipt,MarGrossReceipt,AprGrossReceipt,MayGrossReceipt,JunGrossReceipt,JulGrossReceipt,AugGrossReceipt,SepGrossReceipt,OctGrossReceipt,NovGrossReceipt,DecGrossReceipt,TotalGrossReceipt,CapitalInvestment,DateStartedRemarks,CapitalInvestmentRemarks,AreaRemarks,GrossSalesPerDay,GrossSalesPerYear,PreviousBasisLicenseTax,CurrentBasisLicenseTax,AssessedAmount,Status,ZoningClearanceReferenceNumber")] BusinessPermit.Models.BusinessPermit businesspermit, HttpPostedFileBase uploadFile)
        {
            if (uploadFile != null)
            {
                businesspermit.Attachments = base.GetFileBytes(uploadFile);
                businesspermit.DateApplied = DateTime.Now;
                businesspermit.Status      = "Pending";
                ZoningClearance zoning = db.ZoningClearance.Where(z => z.ApplicationNumber == businesspermit.ZoningClearanceReferenceNumber).FirstOrDefault();

                if (zoning == null)
                {
                    return(View(businesspermit));
                }

                if (businesspermit.IsNew == false)
                {
                    BusinessPermit.Models.BusinessPermit previous = db.BusinessPermits.Where(z => z.BusinessAccountNumber == businesspermit.BusinessAccountNumber).OrderBy(p => p.DateApplied).FirstOrDefault();
                    if (previous != null)
                    {
                        if (previous.TotalGrossReceipt > businesspermit.TotalGrossReceipt)
                        {
                            businesspermit.TotalGrossReceipt = previous.TotalGrossReceipt;
                        }
                    }
                }

                businesspermit.BusinessAddress = zoning.BusinessAddress;
                businesspermit.BusinessName    = zoning.BusinessName;
                businesspermit.BusinessNature  = zoning.BusinessNature;
                businesspermit.OwnerName       = zoning.OwnerName;

                businesspermit.ZoningClearanceId = zoning.ZoningClearanceId;

                db.BusinessPermits.Add(businesspermit);

                db.SaveChanges();
                return(RedirectToAction("ApplicationSuccess"));
            }
            return(View(businesspermit));
        }
Example #6
0
        public static Attachment CreateAttachment(BusinessPermit.Models.BusinessPermit building)
        {
            Document doc = new Document(new Rectangle(PageSize.A4));
            //Create PDF Table
            PdfPTable  tableLayout = new PdfPTable(4);
            string     fileName    = string.Format("BusinessPermit-{0}-{1}.pdf", building.BusinessAccountNumber, DateTime.Now.ToShortDateString().Replace("/", ""));
            string     path        = HttpContext.Current.Server.MapPath(string.Format("~/App_Data/{0}", fileName));
            FileStream fm          = new FileStream(path, FileMode.Create);

            //Create a PDF file in specific path
            PdfWriter.GetInstance(doc, fm);

            //Open the PDF document
            doc.Open();

            Paragraph para = new Paragraph(@"BUSINESS PERMIT AND LICENSE OFFICE",
                                           new Font(Font.FontFamily.TIMES_ROMAN, 14f, Font.BOLD, BaseColor.BLACK));

            // Setting paragraph's text alignment using iTextSharp.text.Element class
            para.Alignment = Element.ALIGN_CENTER;
            doc.Add(para);

            Paragraph para1 = new Paragraph(@"BUSINESS PERMIT",
                                            new Font(Font.FontFamily.TIMES_ROMAN, 14f, Font.BOLD, BaseColor.BLACK));

            // Setting paragraph's text alignment using iTextSharp.text.Element class
            para1.Alignment = Element.ALIGN_CENTER;
            doc.Add(para1);


            Paragraph para9 = new Paragraph("THIS IS TO CERTIFY THAT.",
                                            new Font(Font.FontFamily.TIMES_ROMAN, 12f, Font.NORMAL, BaseColor.BLACK));

            // Setting paragraph's text alignment using iTextSharp.text.Element class
            para9.SpacingBefore = 30;
            para9.Alignment     = Element.ALIGN_CENTER;
            // Adding this 'para' to the Document object
            doc.Add(para9);

            Paragraph para8 = new Paragraph(building.BusinessName,
                                            new Font(Font.FontFamily.TIMES_ROMAN, 12f, Font.UNDERLINE, BaseColor.BLACK));

            // Setting paragraph's text alignment using iTextSharp.text.Element class
            para8.SpacingBefore = 5;
            para8.Alignment     = Element.ALIGN_CENTER;
            // Adding this 'para' to the Document object
            doc.Add(para8);

            Paragraph para10 = new Paragraph(@"(Business Trade Name)",
                                             new Font(Font.FontFamily.TIMES_ROMAN, 12f, Font.NORMAL, BaseColor.BLACK));

            // Setting paragraph's text alignment using iTextSharp.text.Element class
            para10.Alignment = Element.ALIGN_CENTER;
            // Adding this 'para' to the Document object
            doc.Add(para10);

            Paragraph para11 = new Paragraph(building.OwnerName,
                                             new Font(Font.FontFamily.TIMES_ROMAN, 12f, Font.UNDERLINE, BaseColor.BLACK));

            // Setting paragraph's text alignment using iTextSharp.text.Element class
            para11.Alignment = Element.ALIGN_CENTER;
            // Adding this 'para' to the Document object
            doc.Add(para11);

            Paragraph para14 = new Paragraph(@"(Business Owner's Name)",
                                             new Font(Font.FontFamily.TIMES_ROMAN, 12f, Font.NORMAL, BaseColor.BLACK));

            // Setting paragraph's text alignment using iTextSharp.text.Element class
            para14.Alignment = Element.ALIGN_CENTER;
            // Adding this 'para' to the Document object
            doc.Add(para14);

            Paragraph para15 = new Paragraph(building.BusinessAddress,
                                             new Font(Font.FontFamily.TIMES_ROMAN, 12f, Font.UNDERLINE, BaseColor.BLACK));

            // Setting paragraph's text alignment using iTextSharp.text.Element class
            para15.Alignment = Element.ALIGN_CENTER;
            // Adding this 'para' to the Document object
            doc.Add(para15);

            Paragraph para16 = new Paragraph(@"(Business Address)",
                                             new Font(Font.FontFamily.TIMES_ROMAN, 12f, Font.NORMAL, BaseColor.BLACK));

            // Setting paragraph's text alignment using iTextSharp.text.Element class
            para16.Alignment = Element.ALIGN_CENTER;
            // Adding this 'para' to the Document object
            doc.Add(para16);

            Paragraph para7 = new Paragraph(@"is hereby granted this permit nad license to operate and/or establish his/her business in the city subject to the provisions of the City Revenue Code of Marikina and other ordinances/laws/regulations pertinent thereto.",
                                            new Font(Font.FontFamily.TIMES_ROMAN, 12f, Font.NORMAL, BaseColor.BLACK));

            // Setting paragraph's text alignment using iTextSharp.text.Element class
            para7.SpacingBefore = 10;
            para7.Alignment     = Element.ALIGN_JUSTIFIED_ALL;
            // Adding this 'para' to the Document object
            doc.Add(para7);


            Image sign = Image.GetInstance(HttpContext.Current.Server.MapPath(string.Format("~/Images/Other.png")));

            sign.SpacingBefore = 40;
            sign.Alignment     = Element.ALIGN_LEFT;
            sign.ScaleToFit(140f, 120f);


            doc.Add(sign);


            Paragraph para12 = new Paragraph("Atty. Nancy V. Taylan                                                                  Marcelino Teodoro",
                                             new Font(Font.FontFamily.TIMES_ROMAN, 12f, Font.BOLD, BaseColor.BLACK));

            // Setting paragraph's text alignment using iTextSharp.text.Element class
            para12.Alignment = Element.ALIGN_LEFT;
            // Adding this 'para' to the Document object
            doc.Add(para12);

            Paragraph para13 = new Paragraph("Locational Administrator/Business Permit Licensing Office                             Honorable City Mayor",
                                             new Font(Font.FontFamily.TIMES_ROMAN, 12f, Font.NORMAL, BaseColor.BLACK));

            // Setting paragraph's text alignment using iTextSharp.text.Element class
            para13.Alignment = Element.ALIGN_LEFT;
            // Adding this 'para' to the Document object
            doc.Add(para13);


            Paragraph para17 = new Paragraph("ERASURES OR ALTERATIONS WILL INVALIDATE THIS PERMIT",
                                             new Font(Font.FontFamily.TIMES_ROMAN, 12f, Font.BOLD, BaseColor.BLACK));

            // Setting paragraph's text alignment using iTextSharp.text.Element class
            para17.Alignment = Element.ALIGN_CENTER;
            // Adding this 'para' to the Document object
            doc.Add(para17);

            Paragraph para18 = new Paragraph(@"this PERMIT should be conspicuously at the place when the business before is/are being conducted and shall be presented and/or surrendered to concerened authorities upon demand. This permit is revocable and is null and void if t he permittee violates any applicable law ordinance and/or regulation or if he fails to pay any tax and fee charges as they become due.",
                                             new Font(Font.FontFamily.TIMES_ROMAN, 10f, Font.NORMAL, BaseColor.BLACK));

            // Setting paragraph's text alignment using iTextSharp.text.Element class
            para18.Alignment = Element.ALIGN_CENTER;
            // Adding this 'para' to the Document object
            doc.Add(para18);

            Paragraph para19 = new Paragraph(@"In case of business closer/retirment, please surrender this permit to the office of BPLO twenty (20) days after said closure to avoid penalty.",
                                             new Font(Font.FontFamily.TIMES_ROMAN, 10f, Font.NORMAL, BaseColor.BLACK));

            // Setting paragraph's text alignment using iTextSharp.text.Element class
            para19.Alignment = Element.ALIGN_CENTER;
            // Adding this 'para' to the Document object
            doc.Add(para19);

            // Closing the document
            doc.Close();

            ContentType ct         = new ContentType(System.Net.Mime.MediaTypeNames.Application.Pdf);
            Attachment  attachment = new Attachment(path);

            attachment.ContentDisposition.FileName = fileName + ".pdf";

            return(attachment);
        }