diff --git a/iloire Facturacion/App_Browsers/qt.browser b/iloire Facturacion/App_Browsers/qt.browser new file mode 100644 index 0000000..2c4e6c0 --- /dev/null +++ b/iloire Facturacion/App_Browsers/qt.browser @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iloire Facturacion/App_GlobalResources/Print.Designer.cs b/iloire Facturacion/App_GlobalResources/Print.Designer.cs index 8dd6d36..25aa00c 100644 --- a/iloire Facturacion/App_GlobalResources/Print.Designer.cs +++ b/iloire Facturacion/App_GlobalResources/Print.Designer.cs @@ -1,261 +1,270 @@ -//------------------------------------------------------------------------------ -// -// Este código fue generado por una herramienta. -// Versión de runtime:4.0.30319.239 -// -// Los cambios en este archivo podrían causar un comportamiento incorrecto y se perderán si -// se vuelve a generar el código. -// -//------------------------------------------------------------------------------ - -namespace Resources { - using System; - - - /// - /// Clase de recurso con establecimiento inflexible de tipos, para buscar cadenas traducidas, etc. - /// - // StronglyTypedResourceBuilder generó automáticamente esta clase - // a través de una herramienta como ResGen o Visual Studio. - // Para agregar o quitar un miembro, edite el archivo .ResX y, a continuación, vuelva a ejecutar ResGen - // con la opción /str o vuelva a generar el proyecto de Visual Studio. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Web.Application.StronglyTypedResourceProxyBuilder", "10.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Print { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Print() { - } - - /// - /// Devuelve la instancia de ResourceManager almacenada en caché utilizada por esta clase. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Resources.Print", global::System.Reflection.Assembly.Load("App_GlobalResources")); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Invalida la propiedad CurrentUICulture del subproceso actual para todas las - /// búsquedas de recursos mediante esta clase de recurso con establecimiento inflexible de tipos. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Busca una cadena traducida similar a Advance Payment Tax. - /// - internal static string Invoice_AdvancePaymentTax { - get { - return ResourceManager.GetString("Invoice_AdvancePaymentTax", resourceCulture); - } - } - - /// - /// Busca una cadena traducida similar a To be paid to the Tax agency in behalf of {0}. - /// - internal static string Invoice_AdvancePTComment { - get { - return ResourceManager.GetString("Invoice_AdvancePTComment", resourceCulture); - } - } - - /// - /// Busca una cadena traducida similar a Company Number. - /// - internal static string Invoice_CompanyNumber { - get { - return ResourceManager.GetString("Invoice_CompanyNumber", resourceCulture); - } - } - - /// - /// Busca una cadena traducida similar a Email. - /// - internal static string Invoice_Email { - get { - return ResourceManager.GetString("Invoice_Email", resourceCulture); - } - } - - /// - /// Busca una cadena traducida similar a Item. - /// - internal static string Invoice_Item { - get { - return ResourceManager.GetString("Invoice_Item", resourceCulture); - } - } - - /// - /// Busca una cadena traducida similar a Invoice number {1}# {0} #. - /// - internal static string Invoice_Number { - get { - return ResourceManager.GetString("Invoice_Number", resourceCulture); - } - } - - /// - /// Busca una cadena traducida similar a Bank wire. - /// - internal static string Invoice_PaymentDetails { - get { - return ResourceManager.GetString("Invoice_PaymentDetails", resourceCulture); - } - } - - /// - /// Busca una cadena traducida similar a Payment details. - /// - internal static string Invoice_PaymentDetailsTitle { - get { - return ResourceManager.GetString("Invoice_PaymentDetailsTitle", resourceCulture); - } - } - - /// - /// Busca una cadena traducida similar a Phone. - /// - internal static string Invoice_Phone { - get { - return ResourceManager.GetString("Invoice_Phone", resourceCulture); - } - } - - /// - /// Busca una cadena traducida similar a Price. - /// - internal static string Invoice_Price { - get { - return ResourceManager.GetString("Invoice_Price", resourceCulture); - } - } - - /// - /// Busca una cadena traducida similar a Qty. - /// - internal static string Invoice_Qty { - get { - return ResourceManager.GetString("Invoice_Qty", resourceCulture); - } - } - - /// - /// Busca una cadena traducida similar a Service. - /// - internal static string Invoice_Service { - get { - return ResourceManager.GetString("Invoice_Service", resourceCulture); - } - } - - /// - /// Busca una cadena traducida similar a SubTotal. - /// - internal static string Invoice_SubTotal { - get { - return ResourceManager.GetString("Invoice_SubTotal", resourceCulture); - } - } - - /// - /// Busca una cadena traducida similar a To. - /// - internal static string Invoice_To { - get { - return ResourceManager.GetString("Invoice_To", resourceCulture); - } - } - - /// - /// Busca una cadena traducida similar a Total. - /// - internal static string Invoice_Total { - get { - return ResourceManager.GetString("Invoice_Total", resourceCulture); - } - } - - /// - /// Busca una cadena traducida similar a Total to Pay. - /// - internal static string Invoice_TotalToPay { - get { - return ResourceManager.GetString("Invoice_TotalToPay", resourceCulture); - } - } - - /// - /// Busca una cadena traducida similar a VAT. - /// - internal static string Invoice_VAT { - get { - return ResourceManager.GetString("Invoice_VAT", resourceCulture); - } - } - - /// - /// Busca una cadena traducida similar a Proposal. - /// - internal static string Proposal { - get { - return ResourceManager.GetString("Proposal", resourceCulture); - } - } - - /// - /// Busca una cadena traducida similar a Proposal Details. - /// - internal static string ProposalDetails { - get { - return ResourceManager.GetString("ProposalDetails", resourceCulture); - } - } - - /// - /// Busca una cadena traducida similar a Total. - /// - internal static string Proposal_Total { - get { - return ResourceManager.GetString("Proposal_Total", resourceCulture); - } - } - - /// - /// Busca una cadena traducida similar a Quote. - /// - internal static string Quote { - get { - return ResourceManager.GetString("Quote", resourceCulture); - } - } - - /// - /// Busca una cadena traducida similar a VAT is not included. - /// - internal static string VAT_Not_Included { - get { - return ResourceManager.GetString("VAT_Not_Included", resourceCulture); - } - } - } -} +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.269 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Resources { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option or rebuild the Visual Studio project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Web.Application.StronglyTypedResourceProxyBuilder", "10.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Print { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Print() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Resources.Print", global::System.Reflection.Assembly.Load("App_GlobalResources")); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to Advance Payment Tax. + /// + internal static string Invoice_AdvancePaymentTax { + get { + return ResourceManager.GetString("Invoice_AdvancePaymentTax", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to To be paid to the Tax agency in behalf of {0}. + /// + internal static string Invoice_AdvancePTComment { + get { + return ResourceManager.GetString("Invoice_AdvancePTComment", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Company Number. + /// + internal static string Invoice_CompanyNumber { + get { + return ResourceManager.GetString("Invoice_CompanyNumber", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Email. + /// + internal static string Invoice_Email { + get { + return ResourceManager.GetString("Invoice_Email", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Item. + /// + internal static string Invoice_Item { + get { + return ResourceManager.GetString("Invoice_Item", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Invoice number {1}# {0} #. + /// + internal static string Invoice_Number { + get { + return ResourceManager.GetString("Invoice_Number", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Bank wire. + /// + internal static string Invoice_PaymentDetails { + get { + return ResourceManager.GetString("Invoice_PaymentDetails", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Payment details. + /// + internal static string Invoice_PaymentDetailsTitle { + get { + return ResourceManager.GetString("Invoice_PaymentDetailsTitle", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Phone. + /// + internal static string Invoice_Phone { + get { + return ResourceManager.GetString("Invoice_Phone", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Price. + /// + internal static string Invoice_Price { + get { + return ResourceManager.GetString("Invoice_Price", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Qty. + /// + internal static string Invoice_Qty { + get { + return ResourceManager.GetString("Invoice_Qty", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Service. + /// + internal static string Invoice_Service { + get { + return ResourceManager.GetString("Invoice_Service", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to SubTotal. + /// + internal static string Invoice_SubTotal { + get { + return ResourceManager.GetString("Invoice_SubTotal", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to To. + /// + internal static string Invoice_To { + get { + return ResourceManager.GetString("Invoice_To", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Total. + /// + internal static string Invoice_Total { + get { + return ResourceManager.GetString("Invoice_Total", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Total to Pay. + /// + internal static string Invoice_TotalToPay { + get { + return ResourceManager.GetString("Invoice_TotalToPay", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to VAT. + /// + internal static string Invoice_VAT { + get { + return ResourceManager.GetString("Invoice_VAT", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to VAT Number. + /// + internal static string Invoice_VATNumber { + get { + return ResourceManager.GetString("Invoice_VATNumber", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Proposal. + /// + internal static string Proposal { + get { + return ResourceManager.GetString("Proposal", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Proposal Details. + /// + internal static string ProposalDetails { + get { + return ResourceManager.GetString("ProposalDetails", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Total. + /// + internal static string Proposal_Total { + get { + return ResourceManager.GetString("Proposal_Total", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Quote. + /// + internal static string Quote { + get { + return ResourceManager.GetString("Quote", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to VAT is not included. + /// + internal static string VAT_Not_Included { + get { + return ResourceManager.GetString("VAT_Not_Included", resourceCulture); + } + } + } +} diff --git a/iloire Facturacion/App_GlobalResources/Print.es.resx b/iloire Facturacion/App_GlobalResources/Print.es.resx index 8d2ec9a..7756e69 100644 --- a/iloire Facturacion/App_GlobalResources/Print.es.resx +++ b/iloire Facturacion/App_GlobalResources/Print.es.resx @@ -1,186 +1,189 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Retención - - - Retención a efectuar frente la agencia tributaria en nombre de {0} - - - Artículo - - - Factura nº {1}# {0} # - - - Precio - - - Cantidad - - - Servicio - - - SubTotal - - - Para - - - Total - - - Total a pagar - - - IVA - - - NIF/CIF - - - Email - - - Ingreso en cuenta corriente - - - Forma de pago - - - Tel - - - Propuesta - - - Detalles de la propuesta - - - Total presupuestado - - - Presupuesto desglosado - - - IVA no incluido - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Retención + + + Retención a efectuar frente la agencia tributaria en nombre de {0} + + + Artículo + + + Factura nº {1}# {0} # + + + Precio + + + Cantidad + + + Servicio + + + SubTotal + + + Para + + + Total + + + Total a pagar + + + IVA + + + NIF/CIF + + + Email + + + Ingreso en cuenta corriente + + + Forma de pago + + + Tel + + + Propuesta + + + Detalles de la propuesta + + + Total presupuestado + + + Presupuesto desglosado + + + IVA no incluido + + + IVA no + \ No newline at end of file diff --git a/iloire Facturacion/App_GlobalResources/Print.nl.designer.cs b/iloire Facturacion/App_GlobalResources/Print.nl.designer.cs new file mode 100644 index 0000000..e69de29 diff --git a/iloire Facturacion/App_GlobalResources/Print.nl.resx b/iloire Facturacion/App_GlobalResources/Print.nl.resx new file mode 100644 index 0000000..a9bcc4f --- /dev/null +++ b/iloire Facturacion/App_GlobalResources/Print.nl.resx @@ -0,0 +1,189 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Voorschot BTW + + + Te betalen aan de belastingdienst ten behoeve van {0} + + + KVK nummer + + + E-Mail + + + Item + + + Factuur: FAC{1}-{0} + + + Bank overschrijving + + + Betalings gegevens + + + Telefoon + + + Prijs + + + Aantal + + + Dienst + + + SubTotaal + + + Klant + + + Totaal + + + Totaal te betalen + + + BTW + + + Voorstel + + + Voorstel Details + + + Totaal + + + Offerte + + + BTW is niet inbegrepen + + + BTW nummer + + \ No newline at end of file diff --git a/iloire Facturacion/App_GlobalResources/Print.resx b/iloire Facturacion/App_GlobalResources/Print.resx index c62a4b3..053a2d0 100644 --- a/iloire Facturacion/App_GlobalResources/Print.resx +++ b/iloire Facturacion/App_GlobalResources/Print.resx @@ -1,186 +1,189 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Advance Payment Tax - - - To be paid to the Tax agency in behalf of {0} - - - Company Number - - - Email - - - Item - - - Invoice number {1}# {0} # - - - Bank wire - - - Payment details - - - Phone - - - Price - - - Qty - - - Service - - - SubTotal - - - To - - - Total - - - Total to Pay - - - VAT - - - Proposal - - - Proposal Details - - - Total - - - Quote - - - VAT is not included - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Advance Payment Tax + + + To be paid to the Tax agency in behalf of {0} + + + Company Number + + + Email + + + Item + + + Invoice number {1}# {0} # + + + Bank wire + + + Payment details + + + Phone + + + Price + + + Qty + + + Service + + + SubTotal + + + To + + + Total + + + Total to Pay + + + VAT + + + Proposal + + + Proposal Details + + + Total + + + Quote + + + VAT is not included + + + VAT Number + \ No newline at end of file diff --git a/iloire Facturacion/Content/Site.print.css b/iloire Facturacion/Content/Site.print.css index 4034bff..d795e99 100644 --- a/iloire Facturacion/Content/Site.print.css +++ b/iloire Facturacion/Content/Site.print.css @@ -14,7 +14,7 @@ div.invoiceFooter { margin-top:30px; - text-align:right; + text-align:left; font-style:italic; } diff --git a/iloire Facturacion/Controllers/InvoiceController.cs b/iloire Facturacion/Controllers/InvoiceController.cs index 35f032f..e17f562 100644 --- a/iloire Facturacion/Controllers/InvoiceController.cs +++ b/iloire Facturacion/Controllers/InvoiceController.cs @@ -1,358 +1,385 @@ -/* - Iván Loire - www.iloire.com - Please readme README file for license terms. - - ASP.NET MVC3 ACME Invocing app (demo app for training purposes) -*/ -using System; -using System.Collections.Generic; -using System.Data; -using System.Data.Entity; -using System.Linq; -using System.Web; -using System.Web.Mvc; -using MvcPaging; -using System.Globalization; - -namespace iloire_Facturacion.Controllers -{ - [Authorize] - public class InvoiceController : Controller - { - - private InvoiceDB db = new InvoiceDB(); - private int defaultPageSize = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["DefaultPaginationSize"]); - - /*CUSTOM*/ - - private void FillIndexViewBags(IPagedList invoices) - { - ViewBag.NetTotal = invoices.Sum(i => i.NetTotal); - ViewBag.TotalWithVAT = invoices.Sum(i => i.TotalWithVAT); - ViewBag.AdvancePaymentTaxAmountTotal = invoices.Sum(i => i.AdvancePaymentTaxAmount); - } - - public ViewResultBase Search(string text, string from, string to, int? page, int? pagesize, bool? proposal = false) - { - Session["invoiceText"] = text; - Session["invoiceFrom"] = from; - Session["invoiceTo"] = to; - - var invoices = db.Invoices.Include(i => i.InvoiceDetails).Include(i => i.Customer); - - if (!string.IsNullOrWhiteSpace(from)) - { - DateTime fromDate; - if (DateTime.TryParse(from, CultureInfo.CurrentUICulture, DateTimeStyles.AssumeLocal, out fromDate)) - invoices = invoices.Where(t => t.TimeStamp >= fromDate); - } - if (!string.IsNullOrWhiteSpace(to)) - { - DateTime toDate; - if (DateTime.TryParse(to, CultureInfo.CurrentUICulture, DateTimeStyles.AssumeLocal, out toDate)) - invoices = invoices.Where(t => t.TimeStamp <= toDate); - } - - if (!string.IsNullOrWhiteSpace(text)) - { - invoices = invoices.Where(t => (t.Notes.ToLower().IndexOf(text.ToLower()) > -1) - || (t.Name.ToLower().IndexOf(text.ToLower()) > -1) - || (t.Customer.Name.ToLower().IndexOf(text.ToLower()) > -1) - ); - } - - ViewBag.IsProposal = proposal; - - int currentPageIndex = page.HasValue ? page.Value - 1 : 0; - - IPagedList invoices_paged = null; - - if (proposal == true)//once the data is in memory, i can filter by IsProposal - invoices = invoices.Where(i => i.InvoiceNumber == 0); //we can not use Where(i => i.IsProposal) from within the LINQ db context - else - invoices = invoices.Where(i => i.InvoiceNumber > 0); //we can not use Where(i => i.IsProposal) from within the LINQ db context - - invoices_paged = invoices.OrderByDescending(i => i.TimeStamp).ToPagedList(currentPageIndex, (pagesize.HasValue) ? pagesize.Value : defaultPageSize); - - FillIndexViewBags(invoices_paged); - - if (Request.IsAjaxRequest()) - return PartialView("Index", invoices_paged); - else - return View("Index", invoices_paged); - } - - public PartialViewResult UnPaidInvoices() - { - var invoices = db.Invoices.Include(i => i.Customer).Where(i => i.Paid == false && i.DueDate >= DateTime.Now && i.InvoiceNumber> 0).OrderBy(i => i.DueDate); - return PartialView("InvoicesListPartial", invoices.ToList()); - } - - public PartialViewResult LatestProposals() { - var invoices = db.Invoices.Include(i => i.Customer).Where(i => i.InvoiceNumber == 0).OrderByDescending(i => i.TimeStamp); - return PartialView("InvoicesListPartial", invoices.ToList()); - } - - public PartialViewResult OverDueInvoices() - { - var invoices = db.Invoices.Include(i => i.Customer).Where(i => i.Paid == false && i.DueDate < DateTime.Now && i.InvoiceNumber > 0).OrderBy(i => i.DueDate); - return PartialView("InvoicesListPartial", invoices.ToList()); - } - - - public PartialViewResult LastInvoicesByCustomer(int id) - { - var invoices = db.Invoices.Include(i => i.Customer).Where(i => i.CustomerID == id && i.InvoiceNumber > 0).OrderByDescending(i => i.TimeStamp); - return PartialView("InvoicesListPartial", invoices.ToList()); - } - - public PartialViewResult LastProposalsByCustomer(int id) - { - var invoices = db.Invoices.Include(i => i.Customer).Where(i => i.CustomerID == id && i.InvoiceNumber == 0).OrderByDescending(i=>i.TimeStamp); - return PartialView("InvoicesListPartial", invoices.ToList()); - } - - /*END CUSTOM*/ - - // - // GET: /Invoice/ - - public ActionResult Index(string filter, int? page, int? pagesize, bool? proposal = false) - { - #region remember filter stuff - if (filter == "clear") - { - Session["invoiceText"] = null; - Session["invoiceFrom"] = null; - Session["invoiceTo"] = null; - } - else - { - if ((Session["invoiceText"] != null) || (Session["invoiceFrom"] != null) || (Session["invoiceTo"] != null)) - { - return RedirectToAction("Search", new { text = Session["invoiceText"], from = Session["invoiceFrom"], to = Session["invoiceTo"], proposal=proposal }); - } - } - #endregion - - - int currentPageIndex = page.HasValue ? page.Value - 1 : 0; - var invoices = db.Invoices.Include(i => i.InvoiceDetails).Include(i => i.Customer); - ViewBag.IsProposal = proposal; - - IPagedList invoices_paged = null; - if (proposal == true) - { - invoices = invoices.Where(i => i.InvoiceNumber == 0); //we can not use Where(i => i.IsProposal) from within the LINQ db context - } - else - { - invoices = invoices.Where(i => i.InvoiceNumber > 0); //we can not use Where(i => i.IsProposal) from within the LINQ db context - } - - invoices_paged = invoices.OrderByDescending(i => i.TimeStamp).ToPagedList(currentPageIndex, (pagesize.HasValue) ? pagesize.Value : defaultPageSize); - - FillIndexViewBags(invoices_paged); - - return View(invoices_paged); - } - - // - // GET: /Invoice/Details/5 - - public ViewResult Print(int id, bool? proposal = false) - { - if (Request["lan"] != null) - { - //valid culture name? - CultureInfo[] cultures = System.Globalization.CultureInfo.GetCultures - (CultureTypes.SpecificCultures); - - var selectCulture = from p in cultures - where p.Name == Request["lan"] - select p; - - if (selectCulture.Count() == 1) - System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo(Request["lan"]); - } - - - ViewBag.Print = true; - ViewBag.MyCompany = System.Configuration.ConfigurationManager.AppSettings["MyCompanyName"]; - ViewBag.MyCompanyID = System.Configuration.ConfigurationManager.AppSettings["MyCompanyID"]; - ViewBag.MyCompanyAddress = System.Configuration.ConfigurationManager.AppSettings["MyCompanyAddress"]; - ViewBag.MyCompanyPhone = System.Configuration.ConfigurationManager.AppSettings["MyCompanyPhone"]; - ViewBag.MyEmail = System.Configuration.ConfigurationManager.AppSettings["MyEmail"]; - ViewBag.MyBankAccount = System.Configuration.ConfigurationManager.AppSettings["MyBankAccount"]; - - Invoice invoice = db.Invoices.Find(id); - if (proposal == true) - return View("PrintProposal", invoice); - else - return View(invoice); - } - - // - // GET: /Invoice/Create - - public ActionResult Create(bool? proposal=false) - { - Invoice i = new Invoice(); - i.TimeStamp = DateTime.Now; - i.DueDate = DateTime.Now.AddDays(30); //30 days after today - i.AdvancePaymentTax = Convert.ToDecimal(System.Configuration.ConfigurationManager.AppSettings["DefaultAdvancePaymentTax"]); - - if (!proposal == true) - { - //generate next invoice number - var next_invoice = (from inv in db.Invoices - orderby inv.InvoiceNumber descending - select inv).FirstOrDefault(); - if (next_invoice != null) - i.InvoiceNumber = next_invoice.InvoiceNumber + 1; - } - ViewBag.IsProposal = proposal; - ViewBag.CustomerID = new SelectList(db.Customers.OrderBy(c=>c.Name), "CustomerID", "Name"); - return View(i); - } - - // - // POST: /Invoice/Create - - [HttpPost] - [ValidateInput(false)] - public ActionResult Create(Invoice invoice, bool? proposal = false) - { - ViewBag.CustomerID = new SelectList(db.Customers.OrderBy(c => c.Name), "CustomerID", "Name", invoice.CustomerID); - ViewBag.IsProposal = proposal; - - if (ModelState.IsValid) - { - //make sure invoice number doesn't exist - if (proposal == false) - { - var invoice_exists = (from inv in db.Invoices where inv.InvoiceNumber == invoice.InvoiceNumber select inv).FirstOrDefault(); - if (invoice_exists != null) - { - ModelState.AddModelError("InvoiceNumber", "Invoice with that number already exists"); - return View(invoice); - } - } - db.Invoices.Add(invoice); - db.SaveChanges(); - return RedirectToAction("Edit", "Invoice", new { id = invoice.InvoiceID, proposal = proposal }); - } - return View(invoice); - } - - // - // GET: /Invoice/Edit/5 - - public ActionResult Edit(int id, bool? proposal = false, bool? makeinvoice = false, bool? makeproposal = false) - { - Invoice invoice = db.Invoices.Find(id); - ViewBag.CustomerID = new SelectList(db.Customers.OrderBy(c => c.Name), "CustomerID", "Name", invoice.CustomerID); - - if (makeinvoice == true) - { - //we want to make invoice from this proposal - //generate next invoice number - var next_invoice = (from inv in db.Invoices - orderby inv.InvoiceNumber descending - select inv).FirstOrDefault(); - - if (next_invoice != null) - invoice.InvoiceNumber = next_invoice.InvoiceNumber + 1; //assign next available invoice number - - invoice.TimeStamp = DateTime.Now; - invoice.DueDate = DateTime.Now.AddDays(30); - - ViewBag.Warning = "The current item is going to be converted on Invoice. A new InvoiceNumber has been pre-assigned. The dates will be modified accordingly. Click on 'Save' to continue."; - ViewBag.ShowMakeInvoice = ViewBag.ShowMakeProposal = false; - } - else if (makeproposal == true) - { - invoice.InvoiceNumber = 0; //reset invoice number - ViewBag.Warning = "The current item is going to be converted on Proposal. You will lose InvoiceNumber. If that's what you want click on 'Save'"; - ViewBag.ShowMakeInvoice = ViewBag.ShowMakeProposal = false; - } - else - { - if (!invoice.IsProposal && proposal == true) - { - //item is invoice, redirect to proper route (hack) - return RedirectToAction("Edit", new { id = id, proposal = false, makeinvoice = false }); - } - - ViewBag.ShowMakeInvoice = invoice.IsProposal; - ViewBag.ShowMakeProposal = !invoice.IsProposal; - } - - ViewBag.IsProposal = invoice.IsProposal; - - return View(invoice); - } - - // - // POST: /Invoice/Edit/5 - - [HttpPost] - [ValidateInput(false)] - public ActionResult Edit(Invoice invoice, bool? proposal = false) - { - ViewBag.CustomerID = new SelectList(db.Customers.OrderBy(c => c.Name), "CustomerID", "Name", invoice.CustomerID); - ViewBag.IsProposal = proposal; - if (ModelState.IsValid) - { - if (proposal == false) - { - //make sure invoice number doesn't exist - var invoice_exists = (from inv in db.Invoices - where inv.InvoiceNumber == invoice.InvoiceNumber - && inv.InvoiceID != invoice.InvoiceID - select inv).Count(); - - if (invoice_exists > 0) - { - ModelState.AddModelError("InvoiceNumber", "Invoice with that number already exists"); - return View(invoice); - } - } - - db.Entry(invoice).State = EntityState.Modified; - db.SaveChanges(); - return RedirectToAction("Index", new { proposal = proposal }); - } - return View(invoice); - } - - // - // GET: /Invoice/Delete/5 - - public ActionResult Delete(int id, bool? proposal = false) - { - ViewBag.IsProposal = proposal; - Invoice invoice = db.Invoices.Find(id); - return View(invoice); - } - - // - // POST: /Invoice/Delete/5 - - [HttpPost, ActionName("Delete")] - public ActionResult DeleteConfirmed(int id, bool? proposal = false) - { - ViewBag.IsProposal = proposal; - Invoice invoice = db.Invoices.Find(id); - db.Invoices.Remove(invoice); - db.SaveChanges(); - return RedirectToAction("Index", new { proposal = proposal }); - } - - protected override void Dispose(bool disposing) - { - db.Dispose(); - base.Dispose(disposing); - } - } +/* + Iván Loire - www.iloire.com + Please readme README file for license terms. + + ASP.NET MVC3 ACME Invocing app (demo app for training purposes) +*/ +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.Entity; +using System.Linq; +using System.Web; +using System.Web.Mvc; +using MvcPaging; +using System.Globalization; +using Rotativa; + +namespace iloire_Facturacion.Controllers +{ + [Authorize] + public class InvoiceController : Controller + { + + private InvoiceDB db = new InvoiceDB(); + private int defaultPageSize = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["DefaultPaginationSize"]); + + /*CUSTOM*/ + + private void FillIndexViewBags(IPagedList invoices) + { + ViewBag.NetTotal = invoices.Sum(i => i.NetTotal); + ViewBag.TotalWithVAT = invoices.Sum(i => i.TotalWithVAT); + ViewBag.AdvancePaymentTaxAmountTotal = invoices.Sum(i => i.AdvancePaymentTaxAmount); + } + + public ViewResultBase Search(string text, string from, string to, int? page, int? pagesize, bool? proposal = false, bool? reminder = false) + { + Session["invoiceText"] = text; + Session["invoiceFrom"] = from; + Session["invoiceTo"] = to; + + var invoices = db.Invoices.Include(i => i.InvoiceDetails).Include(i => i.Customer); + + if (!string.IsNullOrWhiteSpace(from)) + { + DateTime fromDate; + if (DateTime.TryParse(from, CultureInfo.CurrentUICulture, DateTimeStyles.AssumeLocal, out fromDate)) + invoices = invoices.Where(t => t.TimeStamp >= fromDate); + } + if (!string.IsNullOrWhiteSpace(to)) + { + DateTime toDate; + if (DateTime.TryParse(to, CultureInfo.CurrentUICulture, DateTimeStyles.AssumeLocal, out toDate)) + invoices = invoices.Where(t => t.TimeStamp <= toDate); + } + + if (!string.IsNullOrWhiteSpace(text)) + { + invoices = invoices.Where(t => (t.Notes.ToLower().IndexOf(text.ToLower()) > -1) + || (t.Name.ToLower().IndexOf(text.ToLower()) > -1) + || (t.Customer.Name.ToLower().IndexOf(text.ToLower()) > -1) + ); + } + + ViewBag.IsProposal = proposal; + ViewBag.IsReminder = reminder; + + int currentPageIndex = page.HasValue ? page.Value - 1 : 0; + + IPagedList invoices_paged = null; + + if (proposal == true)//once the data is in memory, i can filter by IsProposal + invoices = invoices.Where(i => i.InvoiceNumber == 0); //we can not use Where(i => i.IsProposal) from within the LINQ db context + else + invoices = invoices.Where(i => i.InvoiceNumber > 0); //we can not use Where(i => i.IsProposal) from within the LINQ db context + + invoices_paged = invoices.OrderByDescending(i => i.TimeStamp).ToPagedList(currentPageIndex, (pagesize.HasValue) ? pagesize.Value : defaultPageSize); + + FillIndexViewBags(invoices_paged); + + if (Request.IsAjaxRequest()) + return PartialView("Index", invoices_paged); + else + return View("Index", invoices_paged); + } + + public PartialViewResult UnPaidInvoices() + { + var invoices = db.Invoices.Include(i => i.Customer).Where(i => i.Paid == false && i.DueDate >= DateTime.Now && i.InvoiceNumber> 0).OrderBy(i => i.DueDate); + return PartialView("InvoicesListPartial", invoices.ToList()); + } + + public PartialViewResult LatestProposals() { + var invoices = db.Invoices.Include(i => i.Customer).Where(i => i.InvoiceNumber == 0).OrderByDescending(i => i.TimeStamp); + return PartialView("InvoicesListPartial", invoices.ToList()); + } + + public PartialViewResult OverDueInvoices() + { + var invoices = db.Invoices.Include(i => i.Customer).Where(i => i.Paid == false && i.DueDate < DateTime.Now && i.InvoiceNumber > 0).OrderBy(i => i.DueDate); + return PartialView("InvoicesListPartial", invoices.ToList()); + } + + + public PartialViewResult LastInvoicesByCustomer(int id) + { + var invoices = db.Invoices.Include(i => i.Customer).Where(i => i.CustomerID == id && i.InvoiceNumber > 0).OrderByDescending(i => i.TimeStamp); + return PartialView("InvoicesListPartial", invoices.ToList()); + } + + public PartialViewResult LastProposalsByCustomer(int id) + { + var invoices = db.Invoices.Include(i => i.Customer).Where(i => i.CustomerID == id && i.InvoiceNumber == 0).OrderByDescending(i=>i.TimeStamp); + return PartialView("InvoicesListPartial", invoices.ToList()); + } + + /*END CUSTOM*/ + + // + // GET: /Invoice/ + + public ActionResult Index(string filter, int? page, int? pagesize, bool? proposal = false, bool? reminder = false) + { + #region remember filter stuff + if (filter == "clear") + { + Session["invoiceText"] = null; + Session["invoiceFrom"] = null; + Session["invoiceTo"] = null; + } + else + { + if ((Session["invoiceText"] != null) || (Session["invoiceFrom"] != null) || (Session["invoiceTo"] != null)) + { + return RedirectToAction("Search", new { text = Session["invoiceText"], from = Session["invoiceFrom"], to = Session["invoiceTo"], proposal=proposal }); + } + } + #endregion + + + int currentPageIndex = page.HasValue ? page.Value - 1 : 0; + var invoices = db.Invoices.Include(i => i.InvoiceDetails).Include(i => i.Customer); + ViewBag.IsProposal = proposal; + ViewBag.IsReminder = reminder; + + IPagedList invoices_paged = null; + if (proposal == true) + { + invoices = invoices.Where(i => i.InvoiceNumber == 0); //we can not use Where(i => i.IsProposal) from within the LINQ db context + } + else + { + invoices = invoices.Where(i => i.InvoiceNumber > 0); //we can not use Where(i => i.IsProposal) from within the LINQ db context + } + + invoices_paged = invoices.OrderByDescending(i => i.TimeStamp).ToPagedList(currentPageIndex, (pagesize.HasValue) ? pagesize.Value : defaultPageSize); + + FillIndexViewBags(invoices_paged); + + return View(invoices_paged); + } + + // + // GET: /Invoice/Print/5 + + public ViewResult Print(int id, bool? proposal = false, bool? reminder = false) + { + try + { + if (Request["lan"] != null) + { + //valid culture name? + CultureInfo[] cultures = System.Globalization.CultureInfo.GetCultures + (CultureTypes.SpecificCultures); + + var selectCulture = from p in cultures + where p.Name == Request["lan"] + select p; + + if (selectCulture.Count() == 1) + System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo(Request["lan"]); + } + } + catch + { + } + + + ViewBag.Print = true; + ViewBag.MyCompany = System.Configuration.ConfigurationManager.AppSettings["MyCompanyName"]; + ViewBag.MyCompanyID = System.Configuration.ConfigurationManager.AppSettings["MyCompanyID"]; + ViewBag.MyVATID = System.Configuration.ConfigurationManager.AppSettings["MyVATID"]; + ViewBag.MyCompanyAddress = System.Configuration.ConfigurationManager.AppSettings["MyCompanyAddress"]; + ViewBag.MyCompanyPhone = System.Configuration.ConfigurationManager.AppSettings["MyCompanyPhone"]; + ViewBag.MyEmail = System.Configuration.ConfigurationManager.AppSettings["MyEmail"]; + ViewBag.MyBankAccount = System.Configuration.ConfigurationManager.AppSettings["MyBankAccount"]; + + Invoice invoice = db.Invoices.Find(id); + if (proposal == true) + return View("PrintProposal", invoice); + else if (reminder == true) + return View("PrintReminder", invoice); + else + return View(invoice); + } + + // + // GET: /Invoice/Pdf/5 + + public ActionResult Pdf(int id, bool? proposal = false, bool? reminder = false) + { + return new ActionAsPdf( + "Print", + new { id = id, proposal = proposal, reminder = reminder }) { FileName = "Invoice.pdf" }; + } + + // + // GET: /Invoice/Create + + public ActionResult Create(bool? proposal=false) + { + Invoice i = new Invoice(); + i.TimeStamp = DateTime.Now; + //i.DueDate = DateTime.Now.AddDays(30); //30 days after today + i.DueDate = DateTime.Now.AddDays(14); //14 days after today + i.AdvancePaymentTax = Convert.ToDecimal(System.Configuration.ConfigurationManager.AppSettings["DefaultAdvancePaymentTax"]); + + if (!proposal == true) + { + //generate next invoice number + var next_invoice = (from inv in db.Invoices + orderby inv.InvoiceNumber descending + select inv).FirstOrDefault(); + if (next_invoice != null) + i.InvoiceNumber = next_invoice.InvoiceNumber + 1; + } + ViewBag.IsProposal = proposal; + ViewBag.CustomerID = new SelectList(db.Customers.OrderBy(c=>c.Name), "CustomerID", "Name"); + return View(i); + } + + // + // POST: /Invoice/Create + + [HttpPost] + [ValidateInput(false)] + public ActionResult Create(Invoice invoice, bool? proposal = false, bool? reminder = false) + { + ViewBag.CustomerID = new SelectList(db.Customers.OrderBy(c => c.Name), "CustomerID", "Name", invoice.CustomerID); + ViewBag.IsProposal = proposal; + ViewBag.IsReminder = reminder; + + if (ModelState.IsValid) + { + //make sure invoice number doesn't exist + if (proposal == false) + { + var invoice_exists = (from inv in db.Invoices where inv.InvoiceNumber == invoice.InvoiceNumber select inv).FirstOrDefault(); + if (invoice_exists != null) + { + ModelState.AddModelError("InvoiceNumber", "Invoice with that number already exists"); + return View(invoice); + } + } + db.Invoices.Add(invoice); + db.SaveChanges(); + return RedirectToAction("Edit", "Invoice", new { id = invoice.InvoiceID, proposal = proposal }); + } + return View(invoice); + } + + // + // GET: /Invoice/Edit/5 + + public ActionResult Edit(int id, bool? proposal = false, bool? makeinvoice = false, bool? makeproposal = false, bool? reminder = false) + { + Invoice invoice = db.Invoices.Find(id); + ViewBag.CustomerID = new SelectList(db.Customers.OrderBy(c => c.Name), "CustomerID", "Name", invoice.CustomerID); + + if (makeinvoice == true) + { + //we want to make invoice from this proposal + //generate next invoice number + var next_invoice = (from inv in db.Invoices + orderby inv.InvoiceNumber descending + select inv).FirstOrDefault(); + + if (next_invoice != null) + invoice.InvoiceNumber = next_invoice.InvoiceNumber + 1; //assign next available invoice number + + invoice.TimeStamp = DateTime.Now; + invoice.DueDate = DateTime.Now.AddDays(30); + + ViewBag.Warning = "The current item is going to be converted on Invoice. A new InvoiceNumber has been pre-assigned. The dates will be modified accordingly. Click on 'Save' to continue."; + ViewBag.ShowMakeInvoice = ViewBag.ShowMakeProposal = false; + } + else if (makeproposal == true) + { + invoice.InvoiceNumber = 0; //reset invoice number + ViewBag.Warning = "The current item is going to be converted on Proposal. You will lose InvoiceNumber. If that's what you want click on 'Save'"; + ViewBag.ShowMakeInvoice = ViewBag.ShowMakeProposal = false; + } + else + { + if (!invoice.IsProposal && proposal == true) + { + //item is invoice, redirect to proper route (hack) + return RedirectToAction("Edit", new { id = id, proposal = false, makeinvoice = false }); + } + + ViewBag.ShowMakeInvoice = invoice.IsProposal; + ViewBag.ShowMakeProposal = !invoice.IsProposal; + } + + ViewBag.IsProposal = invoice.IsProposal; + + return View(invoice); + } + + // + // POST: /Invoice/Edit/5 + + [HttpPost] + [ValidateInput(false)] + public ActionResult Edit(Invoice invoice, bool? proposal = false, bool? reminder = false) + { + ViewBag.CustomerID = new SelectList(db.Customers.OrderBy(c => c.Name), "CustomerID", "Name", invoice.CustomerID); + ViewBag.IsProposal = proposal; + ViewBag.IsPrReminder = reminder; + if (ModelState.IsValid) + { + if (proposal == false) + { + //make sure invoice number doesn't exist + var invoice_exists = (from inv in db.Invoices + where inv.InvoiceNumber == invoice.InvoiceNumber + && inv.InvoiceID != invoice.InvoiceID + select inv).Count(); + + if (invoice_exists > 0) + { + ModelState.AddModelError("InvoiceNumber", "Invoice with that number already exists"); + return View(invoice); + } + } + + db.Entry(invoice).State = EntityState.Modified; + db.SaveChanges(); + return RedirectToAction("Index", new { proposal = proposal }); + } + return View(invoice); + } + + // + // GET: /Invoice/Delete/5 + + public ActionResult Delete(int id, bool? proposal = false, bool? reminder = false) + { + ViewBag.IsProposal = proposal; + ViewBag.IsReminder = reminder; + Invoice invoice = db.Invoices.Find(id); + return View(invoice); + } + + // + // POST: /Invoice/Delete/5 + + [HttpPost, ActionName("Delete")] + public ActionResult DeleteConfirmed(int id, bool? proposal = false, bool? reminder = false) + { + ViewBag.IsProposal = proposal; + ViewBag.IsReminder = reminder; + Invoice invoice = db.Invoices.Find(id); + db.Invoices.Remove(invoice); + db.SaveChanges(); + return RedirectToAction("Index", new { proposal = proposal }); + } + + protected override void Dispose(bool disposing) + { + db.Dispose(); + base.Dispose(disposing); + } + } } \ No newline at end of file diff --git a/iloire Facturacion/Global.asax.cs b/iloire Facturacion/Global.asax.cs index ec11833..9900fd5 100644 --- a/iloire Facturacion/Global.asax.cs +++ b/iloire Facturacion/Global.asax.cs @@ -24,13 +24,19 @@ public static void RegisterRoutes(RouteCollection routes) routes.MapRoute( "Invoice", // Nombre de ruta "Invoice/{action}/{id}", // URL con parámetros - new { controller = "Invoice", action = "Index", id = UrlParameter.Optional, proposal = false } // Valores predeterminados de parámetro + new { controller = "Invoice", action = "Index", id = UrlParameter.Optional, proposal = false, reminder = false } // Valores predeterminados de parámetro + ); + + routes.MapRoute( + "Proposal", // Nombre de ruta + "Proposal/{action}/{id}", // URL con parámetros + new { controller = "Invoice", action = "Index", id = UrlParameter.Optional, proposal = true, reminder = false } // Valores predeterminados de parámetro ); routes.MapRoute( - "Proposal", // Nombre de ruta - "Proposal/{action}/{id}", // URL con parámetros - new { controller = "Invoice", action = "Index", id = UrlParameter.Optional, proposal=true } // Valores predeterminados de parámetro + "Reminder", // Nombre de ruta + "Reminder/{action}/{id}", // URL con parámetros + new { controller = "Invoice", action = "Index", id = UrlParameter.Optional, proposal=false, reminder = true } // Valores predeterminados de parámetro ); diff --git a/iloire Facturacion/Rotativa/README.txt b/iloire Facturacion/Rotativa/README.txt new file mode 100644 index 0000000..cecb844 --- /dev/null +++ b/iloire Facturacion/Rotativa/README.txt @@ -0,0 +1,11 @@ +This folder contains file necessary to Rotativa to generate Pdf files + +Please don't move or rename them or the folder itself + +If you need to you should add a key in web.config with the path to this files: + + + + + + \ No newline at end of file diff --git a/iloire Facturacion/Rotativa/libeay32.dll b/iloire Facturacion/Rotativa/libeay32.dll new file mode 100644 index 0000000..8d31f86 Binary files /dev/null and b/iloire Facturacion/Rotativa/libeay32.dll differ diff --git a/iloire Facturacion/Rotativa/libgcc_s_dw2-1.dll b/iloire Facturacion/Rotativa/libgcc_s_dw2-1.dll new file mode 100644 index 0000000..9e32dc2 Binary files /dev/null and b/iloire Facturacion/Rotativa/libgcc_s_dw2-1.dll differ diff --git a/iloire Facturacion/Rotativa/mingwm10.dll b/iloire Facturacion/Rotativa/mingwm10.dll new file mode 100644 index 0000000..cf2113a Binary files /dev/null and b/iloire Facturacion/Rotativa/mingwm10.dll differ diff --git a/iloire Facturacion/Rotativa/ssleay32.dll b/iloire Facturacion/Rotativa/ssleay32.dll new file mode 100644 index 0000000..a30ff0e Binary files /dev/null and b/iloire Facturacion/Rotativa/ssleay32.dll differ diff --git a/iloire Facturacion/Rotativa/wkhtmltopdf.exe b/iloire Facturacion/Rotativa/wkhtmltopdf.exe new file mode 100644 index 0000000..1e6c742 Binary files /dev/null and b/iloire Facturacion/Rotativa/wkhtmltopdf.exe differ diff --git a/iloire Facturacion/Views/Account/LogOn.cshtml b/iloire Facturacion/Views/Account/LogOn.cshtml index fedb31e..975f515 100644 --- a/iloire Facturacion/Views/Account/LogOn.cshtml +++ b/iloire Facturacion/Views/Account/LogOn.cshtml @@ -6,7 +6,7 @@
- +

Log in

@@ -52,21 +52,4 @@ }

-
-
-

Demo

-

- In order to try the application, use this credentials: -

-
-
    -
  • login: user
  • -
  • password: pass
  • -
-
-

Remember you can fork the project on github: Fork project on Github

-
-
- -
\ No newline at end of file diff --git a/iloire Facturacion/Views/Home/Index.cshtml b/iloire Facturacion/Views/Home/Index.cshtml index 9e31bc6..9dd854b 100644 --- a/iloire Facturacion/Views/Home/Index.cshtml +++ b/iloire Facturacion/Views/Home/Index.cshtml @@ -1,5 +1,5 @@ -@{ - ViewBag.Title = "Página principal"; +@{ + ViewBag.Title = "homepage"; }

diff --git a/iloire Facturacion/Views/Invoice/EditOrCreateInvoicePartial.cshtml b/iloire Facturacion/Views/Invoice/EditOrCreateInvoicePartial.cshtml index 7775ed8..6129617 100644 --- a/iloire Facturacion/Views/Invoice/EditOrCreateInvoicePartial.cshtml +++ b/iloire Facturacion/Views/Invoice/EditOrCreateInvoicePartial.cshtml @@ -126,17 +126,36 @@ } @Html.ActionLink("Print", "Print", "Invoice", new { id = Model.InvoiceID, proposal = ViewBag.IsProposal }, new { target = "_blank", @class = "btn" }) + + @Html.ActionLink("PDF", "Pdf", "Invoice", new { id = Model.InvoiceID, proposal = ViewBag.IsProposal }, new { target = "_blank", @class = "btn" }) @if (!Model.IsProposal) { //even if this is an invoice, we let be printed with proposal format - @Html.ActionLink("Print as proposal", "Print", "Invoice", new { id = Model.InvoiceID, proposal = true }, new { target = "_blank", @class = "btn" }) + @Html.ActionLink("Print as proposal", "Print", "Invoice", new { id = Model.InvoiceID, proposal = true }, new { target = "_blank", @class = "btn" }) + } + + @if (!Model.IsProposal) + { //even if this is an invoice, we let be printed with proposal format + @Html.ActionLink("PDF proposal", "Pdf", "Invoice", new { id = Model.InvoiceID, proposal = true }, new { target = "_blank", @class = "btn" }) + } + + @if (!Model.IsProposal) + { //even if this is an invoice, we let be printed with proposal format + @Html.ActionLink("Print as reminder", "Print", "Invoice", new { id = Model.InvoiceID, reminder = true }, new { target = "_blank", @class = "btn" }) + } + + @if (!Model.IsProposal) + { //even if this is an invoice, we let be printed with proposal format + @Html.ActionLink("PDF reminder", "Pdf", "Invoice", new { id = Model.InvoiceID, reminder = true }, new { target = "_blank", @class = "btn" }) } - @if (ViewBag.ShowMakeInvoice == true) { - @Html.ActionLink("Make invoice", "Edit", "Invoice", new { id = Model.InvoiceID, makeinvoice = true }, new { @class = "btn" }) + @if (ViewBag.ShowMakeInvoice == true) + { + @Html.ActionLink("Make invoice", "Edit", "Invoice", new { id = Model.InvoiceID, makeinvoice = true }, new { @class = "btn" }) } - @if (ViewBag.ShowMakeProposal == true) { + @if (ViewBag.ShowMakeProposal == true) + { @Html.ActionLink("Make proposal", "Edit", "Invoice", new { id = Model.InvoiceID, makeproposal = true }, new { @class = "btn" }) } diff --git a/iloire Facturacion/Views/Invoice/Index.cshtml b/iloire Facturacion/Views/Invoice/Index.cshtml index 8a199b4..da9582b 100644 --- a/iloire Facturacion/Views/Invoice/Index.cshtml +++ b/iloire Facturacion/Views/Invoice/Index.cshtml @@ -119,6 +119,7 @@ @Html.ActionLink("Edit", "Edit", new { id = item.InvoiceID, proposal = ViewBag.IsProposal }, new { @class = "btn primary" }) @Html.ActionLink("Print", "Print", new { id = item.InvoiceID, proposal = ViewBag.IsProposal }, new { target = "_blank", @class = "btn" }) + @Html.ActionLink("PDF", "Pdf", new { id = item.InvoiceID, proposal = ViewBag.IsProposal }, new { target = "_blank", @class = "btn" }) @Html.ActionLink("Delete", "Delete", new { id = item.InvoiceID, proposal = ViewBag.IsProposal }, new { @class = "btn" }) @if (ViewBag.IsProposal) { diff --git a/iloire Facturacion/Views/Invoice/Print.cshtml b/iloire Facturacion/Views/Invoice/Print.cshtml index 1b57752..2a5d1fc 100644 --- a/iloire Facturacion/Views/Invoice/Print.cshtml +++ b/iloire Facturacion/Views/Invoice/Print.cshtml @@ -7,18 +7,20 @@ @model Invoice -@{ - ViewBag.Title = DateTime.Now.Year + "#" + Model.InvoiceNumber + " " + Model.Name + " " + Model.Customer.Name; +@{ + ViewBag.Title = "FAC" + Model.TimeStamp.ToString("yyyy") + "-" + Model.InvoiceNumber + " " + Model.Name + " " + Model.Customer.Name; + ViewBag.Invoicename = "FAC" + Model.TimeStamp.ToString("yyyy") + "-" + Model.InvoiceNumber; Layout = "~/Views/Shared/_LayoutPrint.cshtml"; + } @@ -31,15 +33,9 @@

-

- - @Resources.Print.Invoice_CompanyNumber: @ViewBag.MyCompanyID -

-

@Html.Raw(ViewBag.MyCompanyAddress.Replace(";","
"))

-

@Resources.Print.Invoice_Phone: @ViewBag.MyCompanyPhone

@@ -176,11 +172,8 @@

- (*) @string.Format(@Resources.Print.Invoice_AdvancePTComment, ViewBag.MyCompany) +

-

- @Resources.Print.Invoice_PaymentDetailsTitle: - @Resources.Print.Invoice_PaymentDetails : @ViewBag.MyBankAccount

diff --git a/iloire Facturacion/Views/Invoice/PrintProposal.cshtml b/iloire Facturacion/Views/Invoice/PrintProposal.cshtml index 987936a..2619c6d 100644 --- a/iloire Facturacion/Views/Invoice/PrintProposal.cshtml +++ b/iloire Facturacion/Views/Invoice/PrintProposal.cshtml @@ -15,7 +15,7 @@
- + -

@string.Format(@Resources.Print.Invoice_Number, @Model.InvoiceNumber, DateTime.Now.Year)

+

@string.Format(@Resources.Print.Invoice_Number, @Model.InvoiceNumber, @Model.TimeStamp.ToString("yyyy"))

@Model.TimeStamp.ToLongDateString()
- +

@string.Format(@Resources.Print.Proposal, @Model.InvoiceNumber, DateTime.Now.Year)

@@ -31,15 +31,9 @@

-

- - @Resources.Print.Invoice_CompanyNumber: @ViewBag.MyCompanyID -

-

@Html.Raw(ViewBag.MyCompanyAddress.Replace(";","
"))

-

@Resources.Print.Invoice_Phone: @ViewBag.MyCompanyPhone

diff --git a/iloire Facturacion/Views/Invoice/PrintReminder.cshtml b/iloire Facturacion/Views/Invoice/PrintReminder.cshtml new file mode 100644 index 0000000..d4783af --- /dev/null +++ b/iloire Facturacion/Views/Invoice/PrintReminder.cshtml @@ -0,0 +1,133 @@ +@* + Iván Loire - www.iloire.com + Please readme README file for license terms. + + ASP.NET MVC3 ACME Invocing app (demo app for training purposes) +*@ + +@model Invoice + +@{ + ViewBag.Title = "FAC" + Model.TimeStamp.ToString("yyyy") + "-" + Model.InvoiceNumber + " " + Model.Name + " " + Model.Customer.Name; + ViewBag.Invoicename = "FAC" + Model.TimeStamp.ToString("yyyy") + "-" + Model.InvoiceNumber; + + if(Model.TotalToPay <= 2500) { + ViewBag.IncassoKosten = (float)Model.TotalToPay * 0.15; + } + else if(Model.TotalToPay <= 5000) + { + ViewBag.calcvalue = Model.TotalToPay - 2500; + ViewBag.IncassoKosten = (float)ViewBag.calcvalue * 0.10 + 375; + } + else if (Model.TotalToPay <= 10000) + { + ViewBag.calcvalue = Model.TotalToPay - 5000; + ViewBag.IncassoKosten = (float)ViewBag.calcvalue * 0.05 + 625; + } + else if (Model.TotalToPay <= 200000) + { + ViewBag.calcvalue = Model.TotalToPay - 10000; + ViewBag.IncassoKosten = (float)ViewBag.calcvalue * 0.01 + 875; + } + else + { + ViewBag.calcvalue = Model.TotalToPay - 200000; + ViewBag.IncassoKosten = (float)ViewBag.calcvalue * 0.005 + 2775; + } + + if(ViewBag.IncassoKosten < 40) + { + ViewBag.IncassoKosten = 40; + } + + Layout = "~/Views/Shared/_LayoutPrint.cshtml"; +} + + + + + + + + + + + + +
+ +
+
+

+ + @Html.DisplayFor(model => model.Customer.Name) + +

+ +

+ @Resources.Print.Invoice_CompanyNumber: + + @Html.DisplayFor(model => model.Customer.CompanyNumber) + +

+

+ @Html.DisplayFor(model => model.Customer.Address) +

+ +

+ @Html.DisplayFor(model => model.Customer.CP), + @Html.DisplayFor(model => model.Customer.City) +

+
+
+ +

+ Ons Kenmerk: @ViewBag.Invoicename
+ Betreft: Openstaande post(en) +

+
+ +

Veenendaal, @Model.DueDate.ToString("dd MMMM yyyy")

+

Geachte Heer/Mevrouw,

+

Volgens onze administratie, staan er een of meerdere posten open waarvan de betalingstermijn reeds is vervallen.

+

Middels dit schrijven verzoeken wij u, binnen 14 dagen na dagtekening, het onderstaande te vergelijken met uw administratie en onder vermelding van uw factuur nummer (@ViewBag.Invoicename) te doen bijschrijven op rekening: xxxx.xx.xxx ten name van: xxx.

+

Indien u reeds heeft betaald, verzoeken wij u contact met ons op te nemen, mogelijk kon uw betaling niet verwerkt worden.

+ + + + + + + + @if (ViewBag.Print != true){ + + } + + + + + + + + + +
+ Factuur nummer + + Factuur datum + + Verval datum + + Bedrag +
+ @ViewBag.Invoicename + + @Model.TimeStamp.ToString("dd-MM-yyyy") + + @Model.DueDate.ToString("dd-MM-yyyy") + + @String.Format("{0:C}", Model.TotalToPay) +
+ +

Volledigheidshalve melden wij, mocht het gestelde termijn verstrijken zonder dat het genoemde totaalbedrag is voldaan, wordt de vordering uithanden gegeven. Op grond van de Wet incassokosten bent u in dat geval ad. @String.Format("{0:C}", ViewBag.IncassoKosten) aan buitengerechtelijke incassokosten verschuldigd. BTW Incassokosten kunnen niet worden verrekend.

+

Hoogachtend,



xx xxxxx

\ No newline at end of file diff --git a/iloire Facturacion/Views/Shared/_LogOnPartial.cshtml b/iloire Facturacion/Views/Shared/_LogOnPartial.cshtml index a867ca5..772e8f8 100644 --- a/iloire Facturacion/Views/Shared/_LogOnPartial.cshtml +++ b/iloire Facturacion/Views/Shared/_LogOnPartial.cshtml @@ -1,9 +1,9 @@  \ No newline at end of file diff --git a/iloire Facturacion/Web.config b/iloire Facturacion/Web.config index 0afdd2f..a5b57ec 100644 --- a/iloire Facturacion/Web.config +++ b/iloire Facturacion/Web.config @@ -1,4 +1,4 @@ - + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - + + + @@ -64,26 +65,27 @@ - + - - + + - + - + + diff --git a/iloire Facturacion/iloire Facturacion.csproj b/iloire Facturacion/iloire Facturacion.csproj index da51cb1..82a992e 100644 --- a/iloire Facturacion/iloire Facturacion.csproj +++ b/iloire Facturacion/iloire Facturacion.csproj @@ -1,320 +1,378 @@ - - - - Debug - AnyCPU - - - 2.0 - {1895D1C8-FDCE-4BB7-839F-ADB779ED1EC6} - {E53F8FEA-EAE0-44A6-8774-FFD645390401};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - iloire_Facturacion - iloire Facturacion - v4.0 - false - false - ..\ - true - - - true - full - false - bin\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\ - TRACE - prompt - 4 - - - - ..\packages\elmah.corelibrary.1.2\lib\Elmah.dll - - - ..\packages\EntityFramework.4.1.10331.0\lib\EntityFramework.dll - - - - - False - ..\packages\SqlServerCompact.4.0.8482.1\lib\System.Data.SqlServerCe.dll - - - - - - - - - - - - - - - - - - - - - - - - - - True - True - Print.resx - - - True - True - Print.es.resx - - - - - - - - - - - - Global.asax - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Designer - - - Web.config - - - Web.config - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GlobalResourceProxyGenerator - Print.Designer.cs - - - - - GlobalResourceProxyGenerator - Print.es.designer.cs - Designer - - - - + + + + Debug + AnyCPU + + + 2.0 + {1895D1C8-FDCE-4BB7-839F-ADB779ED1EC6} + {E53F8FEA-EAE0-44A6-8774-FFD645390401};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + iloire_Facturacion + iloire Facturacion + v4.0 + false + false + ..\ + true + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + true + true + invoices + + + + + + + + + + + + + + pdbonly + true + bin\ + TRACE + prompt + 4 + + + + ..\packages\elmah.corelibrary.1.2\lib\Elmah.dll + + + ..\packages\EntityFramework.4.1.10331.0\lib\EntityFramework.dll + + + + ..\packages\Rotativa.1.3\lib\net40\Rotativa.dll + + + + False + ..\packages\SqlServerCompact.4.0.8482.1\lib\System.Data.SqlServerCe.dll + + + True + + + True + + + True + + + + + + True + + + True + + + True + + + + + + + + True + + + True + + + True + + + + + True + + + + + + Print.nl.resx + True + True + + + True + True + Print.resx + + + True + True + Print.es.resx + + + + + + + + + + + + Global.asax + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Designer + + + Web.config + + + Web.config + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GlobalResourceProxyGenerator + Print.Designer.cs + + + + + GlobalResourceProxyGenerator + Print.es.designer.cs + Designer + + + + + GlobalResourceProxyGenerator + Print.nl.designer.cs + + + + - - - - - - - - False - True - 8947 - / - - - False - False - - - False - - - - - - - - + --> + + + + + + + + False + True + 8947 + / + + + False + False + + + False + + + + + + + + \ No newline at end of file diff --git a/iloire Facturacion/packages.config b/iloire Facturacion/packages.config index e35d666..82fe549 100644 --- a/iloire Facturacion/packages.config +++ b/iloire Facturacion/packages.config @@ -1,12 +1,13 @@ - - - - - - - - - - - + + + + + + + + + + + + \ No newline at end of file