public static bool agregarTitular(string nombre, string direccion, string telefono, string celular, string mail)
 {
     titular t = new titular();
     t.nombre = nombre;
     t.direccion = direccion;
     t.telefono = telefono;
     t.celular = celular;
     t.mail = mail;
     CatalogoTitulares.addTitular(t);
     return true;
 }
 public static bool actualizarTitular(int ID, string nombre, string direccion, string telefono, string celular, string mail)
 {
     titular t = new titular();
     t.nombre = nombre;
     t.direccion = direccion;
     t.telefono = telefono;
     t.celular = celular;
     t.mail = mail;
     t.idtitular = ID;
     CatalogoTitulares.updateTitular(t);
     return true;
 }
 public static void removeTitular(titular Titular)
 {
     try {
         admEntities db = Datos.getDB();
         Titular = db.titular.Where(t => t.idtitular == Titular.idtitular).SingleOrDefault();
         db.titular.Remove(Titular);
         db.SaveChanges();
     }
     catch (Exception e)
     {
         Logger.Log.write(e.InnerException == null ? e.Message : e.InnerException.Message);
         throw e;
     }
 }
 public static void addTitular(titular t)
 {
     try
     {
         admEntities db = Datos.getDB();
         db.titular.Add(t);
         db.SaveChanges();
     }
     catch (Exception e)
     {
         Logger.Log.write(e.InnerException == null ? e.Message : e.InnerException.Message);
         throw e;
     }
 }
 public static titular getOrAddTitular(string titular)
 {
     try
     {
         admEntities db = Datos.getDB();
         titular t = db.titular.Where(x => x.nombre == titular).SingleOrDefault();
         if (t == null)
         {
             t = new titular();
             t.nombre = titular;
             t = db.titular.Add(t);
             db.SaveChanges();
         }
         return t;
     }
     catch (Exception e)
     {
         Logger.Log.write(e.InnerException == null ? e.Message : e.InnerException.Message);
         throw e;
     }
 }
 public static List<unidad> getAllUnidadesConTitular(edificio e)
 {
     try
     {
         List<unidad> unidades = null;
         admEntities db = Datos.getDB();
         unidades = db.unidad.Where(x => x.dir_edificio == e.direccion).OrderBy(x => x.id_unidad).ToList();
         foreach(var u in unidades)
         {
             if (u.titular == null)
             {
                 titular t = new titular();
                 t.nombre = "<Ninguno>";
                 u.titular = t;
             }
         }
         return unidades;
     }
     catch (Exception ex)
     {
         Logger.Log.write(ex.InnerException == null ? ex.Message : ex.InnerException.Message);
         throw ex;
     }
 }
Beispiel #7
0
        static void Main(string[] args)
        {
            calibri = BaseFont.CreateFont("calibri.ttf", BaseFont.CP1252, BaseFont.EMBEDDED);
            calibri8N = new Font(calibri, 8, Font.NORMAL);
            calibri8I = new Font(calibri, 8, Font.ITALIC);
            calibri8B = new Font(calibri, 8, Font.BOLD);
            calibri9N = new Font(calibri, 9, Font.NORMAL);
            calibri9B = new Font(calibri, 9, Font.BOLD);
            calibri12N = new Font(calibri, 10, Font.NORMAL);
            calibri12B = new Font(calibri, 10, Font.BOLD);
            calibri11N = new Font(calibri, 10, Font.NORMAL);
            calibri11B = new Font(calibri, 10, Font.BOLD);

            titular t = new titular();
            unidad u = new unidad();
            expensas e = new expensas();
            u.dir_edificio = "9 de Julio 566";
            u.id_unidad = "02-02";
            t.nombre = "Ramon Fernandez";
            u.titular = t;
            u.parcela = "10";

            e.nro_factura = "159";
            e.nro_referencia = "534023492342";
            e.fechaVto2 = DateTime.Now;
            e.importeVto2 = 3150.32;

            GenerarIntimacionAdministrativa(u, e);
        }
 public static void updateTitular(titular t)
 {
     try
     {
         admEntities db = Datos.getDB();
         titular titular = db.titular.Where(tit => tit.idtitular == t.idtitular).SingleOrDefault();
         titular.nombre = t.nombre;
         titular.celular = t.celular;
         titular.direccion = t.direccion;
         titular.telefono = t.telefono;
         titular.mail = t.mail;
         db.Entry(titular).State = System.Data.EntityState.Modified;
         db.SaveChanges();
     }
     catch (Exception e)
     {
         Logger.Log.write(e.InnerException == null ? e.Message : e.InnerException.Message);
         throw e;
     }
 }
        static void addConceptos(Document doc, List<CatalogoDeudores.DetalleDeuda> detalles, unidad uni, titular tit, double descuento = 0)
        {
            PdfPTable t = new PdfPTable(6);
            t.WidthPercentage = 100;
            float[] widths = new float[] { 35f, 35f, 35f, 35f, 35f, 35f };
            t.SetWidths(widths);

            Paragraph p;
            p = new Paragraph(15, "Consorcio: " + uni.dir_edificio, calibri9N);
            doc.Add(p);

            p = new Paragraph(15, "Unidad: " + uni.id_unidad, calibri9N);
            doc.Add(p);

            p = new Paragraph(15, "Titular: " + (uni.titular != null ? uni.titular.nombre : "Ninguno"), calibri9N);
            doc.Add(p);

            p = new Paragraph(15, " ", calibri9N);
            doc.Add(p);

            int leading = 9;

            PdfPCell c;

            c = new PdfPCell();

            c.Border = 0;
            c.BorderWidthBottom = 0.1f;
            c.BorderWidthTop = 0.1f;
            p = new Paragraph(leading, "Periodo", calibri9N);
            p.Alignment = Element.ALIGN_CENTER;
            c.FixedHeight = 16;
            c.AddElement(p);

            t.AddCell(c);

            c = new PdfPCell();
            c.Border = 0;
            c.BorderWidthBottom = 0.1f;
            c.BorderWidthTop = 0.1f;
            p = new Paragraph(leading, "Concepto", calibri9N);
            p.Alignment = Element.ALIGN_CENTER;
            c.AddElement(p);
            t.AddCell(c);

            c = new PdfPCell();
            c.Border = 0;
            c.BorderWidthBottom = 0.1f;
            c.BorderWidthTop = 0.1f;
            p = new Paragraph(leading, "Comprobante", calibri9N);
            p.Alignment = Element.ALIGN_CENTER;
            c.AddElement(p);
            t.AddCell(c);

            c = new PdfPCell();
            c.Border = 0;
            c.BorderWidthBottom = 0.1f;
            c.BorderWidthTop = 0.1f;
            p = new Paragraph(leading, "Importe       ", calibri9N);
            p.Alignment = Element.ALIGN_RIGHT;
            c.AddElement(p);
            t.AddCell(c);

            c = new PdfPCell();
            c.Border = 0;
            c.BorderWidthBottom = 0.1f;
            c.BorderWidthTop = 0.1f;
            p = new Paragraph(leading, "Recargo       ", calibri9N);
            p.Alignment = Element.ALIGN_RIGHT;
            c.AddElement(p);
            t.AddCell(c);

            c = new PdfPCell();
            c.Border = 0;
            c.BorderWidthBottom = 0.1f;
            c.BorderWidthTop = 0.1f;
            p = new Paragraph(leading, "Deuda       ", calibri9N);
            p.Alignment = Element.ALIGN_RIGHT;
            c.AddElement(p);
            t.AddCell(c);

            //Poner cobros

            double total = 0;
            double totalRecargos = 0;
            foreach (var d in detalles)
            {
                c = new PdfPCell();

                c.Border = 0;

                p = new Paragraph(leading, d.Periodo.Month + "/" + d.Periodo.Year, calibri9N);
                p.Alignment = Element.ALIGN_CENTER;
                c.FixedHeight = 16;
                c.AddElement(p);

                t.AddCell(c);

                c = new PdfPCell();
                c.Border = 0;
                p = new Paragraph(leading, d.Tipo == "Ordinaria" ? "Expensas" : d.Tipo, calibri9N);
                p.Alignment = Element.ALIGN_CENTER;
                c.AddElement(p);
                t.AddCell(c);

                c = new PdfPCell();
                c.Border = 0;
                if (d.NroFactura == "000000000000000")
                    d.NroFactura = " - ";
                p = new Paragraph(leading, d.Tipo == "Ordinaria" ? d.NroFactura : " - ", calibri9N);
                p.Alignment = Element.ALIGN_CENTER;
                c.AddElement(p);
                t.AddCell(c);

                c = new PdfPCell();
                c.Border = 0;
                p = new Paragraph(leading, d.Importe.ToString("n2") + "       ", calibri9N);
                p.Alignment = Element.ALIGN_RIGHT;
                c.AddElement(p);
                t.AddCell(c);

                c = new PdfPCell();
                c.Border = 0;

                p = new Paragraph(leading, d.Recargo.ToString("n2") + "       ", calibri9N);
                p.Alignment = Element.ALIGN_RIGHT;
                c.AddElement(p);
                t.AddCell(c);

                c = new PdfPCell();
                c.Border = 0;

                p = new Paragraph(leading, (d.Importe + d.Recargo).ToString("n2") + "       ", calibri9N);
                p.Alignment = Element.ALIGN_RIGHT;
                c.AddElement(p);
                t.AddCell(c);
                total += d.Importe + d.Recargo;
                totalRecargos += d.Recargo;
            }

            if (descuento > 0)
            {
                c = new PdfPCell();

                c.Border = 0;

                p = new Paragraph(leading, DateTime.Now.Month + "/" + DateTime.Now.Year, calibri9N);
                p.Alignment = Element.ALIGN_CENTER;
                c.FixedHeight = 16;
                c.AddElement(p);

                t.AddCell(c);

                c = new PdfPCell();
                c.Border = 0;
                p = new Paragraph(leading, "Bonificacion: " + descuento + "%", calibri9N);
                p.Alignment = Element.ALIGN_CENTER;
                c.AddElement(p);
                t.AddCell(c);

                c = new PdfPCell();
                c.Border = 0;
                p = new Paragraph(leading, " ", calibri9N);
                p.Alignment = Element.ALIGN_CENTER;
                c.AddElement(p);
                t.AddCell(c);

                c = new PdfPCell();
                c.Border = 0;
                p = new Paragraph(leading, " ", calibri9N);
                p.Alignment = Element.ALIGN_RIGHT;
                c.AddElement(p);
                t.AddCell(c);

                c = new PdfPCell();
                c.Border = 0;

                p = new Paragraph(leading, "-" + ((descuento / 100) * totalRecargos).ToString("n2"), calibri9N);
                p.Alignment = Element.ALIGN_RIGHT;
                c.AddElement(p);
                t.AddCell(c);

                c = new PdfPCell();
                c.Border = 0;

                p = new Paragraph(leading, " ", calibri9N);
                p.Alignment = Element.ALIGN_RIGHT;
                c.AddElement(p);
                t.AddCell(c);
            }

            c = new PdfPCell();
            c.Border = 0;
            c.BorderWidthBottom = 0.1f;
            c.BorderWidthTop = 0.1f;
            p = new Paragraph(leading, "TOTAL ", calibri9B);
            p.Alignment = Element.ALIGN_CENTER;
            c.FixedHeight = 16;
            c.AddElement(p);

            t.AddCell(c);

            c = new PdfPCell();
            c.Border = 0;
            c.BorderWidthBottom = 0.1f;
            c.BorderWidthTop = 0.1f;
            p = new Paragraph(leading, " ", calibri9N);
            p.Alignment = Element.ALIGN_CENTER;
            c.AddElement(p);
            t.AddCell(c);

            c = new PdfPCell();
            c.Border = 0;
            c.BorderWidthBottom = 0.1f;
            c.BorderWidthTop = 0.1f;
            p = new Paragraph(leading, " ", calibri9N);
            p.Alignment = Element.ALIGN_CENTER;
            c.AddElement(p);
            t.AddCell(c);

            c = new PdfPCell();
            c.Border = 0;
            c.BorderWidthBottom = 0.1f;
            c.BorderWidthTop = 0.1f;
            p = new Paragraph(leading, " ", calibri9N);
            p.Alignment = Element.ALIGN_CENTER;
            c.AddElement(p);
            t.AddCell(c);

            c = new PdfPCell();
            c.Border = 0;
            c.BorderWidthBottom = 0.1f;
            c.BorderWidthTop = 0.1f;
            p = new Paragraph(leading, " ", calibri9N);
            p.Alignment = Element.ALIGN_CENTER;
            c.AddElement(p);
            t.AddCell(c);

            c = new PdfPCell();
            c.Border = 0;
            c.BorderWidthBottom = 0.1f;
            c.BorderWidthTop = 0.1f;
            p = new Paragraph(leading, (total - ((descuento / 100) * totalRecargos)).ToString("n2"), calibri9B);
            p.Alignment = Element.ALIGN_RIGHT;
            c.AddElement(p);
            t.AddCell(c);

            doc.Add(t);
        }
        public static string generarRecibo(System.Drawing.Image qr, List<CatalogoDeudores.DetalleDeuda> detalles, unidad uni, titular tit, double descuento = 0)
        {
            calibri = BaseFont.CreateFont(IncludesPath + "calibri.ttf", BaseFont.CP1252, BaseFont.EMBEDDED);
            calibri8N = new iTextSharp.text.Font(calibri, 8, iTextSharp.text.Font.NORMAL);
            calibri8B = new iTextSharp.text.Font(calibri, 8, iTextSharp.text.Font.BOLD);
            calibri9N = new iTextSharp.text.Font(calibri, 9, iTextSharp.text.Font.NORMAL);
            calibri9B = new iTextSharp.text.Font(calibri, 9, iTextSharp.text.Font.BOLD);
            calibri12N = new iTextSharp.text.Font(calibri, 10, iTextSharp.text.Font.NORMAL);
            calibri12B = new iTextSharp.text.Font(calibri, 10, iTextSharp.text.Font.BOLD);
            calibri11N = new iTextSharp.text.Font(calibri, 10, iTextSharp.text.Font.NORMAL);
            calibri11B = new iTextSharp.text.Font(calibri, 10, iTextSharp.text.Font.BOLD);

            Document doc = new Document(PageSize.A4, milimetroToPoint(12), milimetroToPoint(12), milimetroToPoint(7), 0f);
            bool exists = System.IO.Directory.Exists(Ruta + "Recibos");

            if (!exists)
                System.IO.Directory.CreateDirectory(Ruta + "Recibos");

            string nombre = detalles.First().Edificio + " " + detalles.First().Unidad + " " + DateTime.Now.ToShortDateString().Replace("/", "-");

            var output = new FileStream(Ruta + @"Recibos\" + nombre + ".pdf", FileMode.Create);
            var writer = PdfWriter.GetInstance(doc, output);

            doc.Open();
            addEncabezado(doc, qr);
            addConceptos(doc, detalles, uni, tit, descuento);
            doc.Add(new Paragraph(10, " "));
            addFirmaSello(doc);
            doc.Close();
            return Ruta + @"Recibos\" + nombre + ".pdf";
        }
 private static void hacerLiquidacionThread(ExpensasEdificio expensasEdificio, DateTime p, DateTime vto1, DateTime vto2, string textoPie, System.Drawing.Image _24, System.Drawing.Image qr, System.Drawing.Image tijera)
 {
     Document doc = new Document(PageSize.A4, milimetroToPoint(12), milimetroToPoint(12), milimetroToPoint(7), 0f);
     bool exists = System.IO.Directory.Exists(Ruta + "Liquidaciones\\" + p.Month + " del " + p.Year);
     if (!exists)
         System.IO.Directory.CreateDirectory(Ruta + "Liquidaciones\\" + p.Month + " del " + p.Year);
     var output = new FileStream(Ruta + @"Liquidaciones\\" + p.Month + " del " + p.Year + "\\" + expensasEdificio.Edificio.direccion + ".pdf", FileMode.Create);
     var writer = PdfWriter.GetInstance(doc, output);
     doc.Open();
     PDFFooter footer = new PDFFooter();
     footer.texto = textoPie;
     writer.PageEvent = footer;
     foreach (TotalUnidad totalesUnidad in expensasEdificio.TotalUnidad)
     {
         addEncabezado(doc, expensasEdificio, totalesUnidad.Unidad, "Ordinaria", totalesUnidad.NroFactura, qr);
         addGastos(doc, expensasEdificio);
         doc.Add(new Paragraph(3, " "));
         addTotales(doc, expensasEdificio, totalesUnidad);
         addResumen(doc, expensasEdificio, totalesUnidad);
         addEstadoCaja(doc, expensasEdificio);
         addDeudores(doc, expensasEdificio);
         doc.Add(new Paragraph(8, " "));
         addUrgencias(doc, writer, expensasEdificio, _24, tijera);
         doc.Add(new Paragraph(8, " "));
         addCuponDePago(doc, writer, expensasEdificio, totalesUnidad, vto1, vto2);//, strWriter);
         doc.NewPage();
     }
     unidad uniAdm = new unidad();
     titular titAdm = new titular();
     titAdm.nombre = "Administración";
     uniAdm.id_unidad = "Archivo";
     uniAdm.titular = titAdm;
     addEncabezado(doc, expensasEdificio, uniAdm, "Ordinaria", "000000000000000", qr);
     addGastos(doc, expensasEdificio);
     doc.Add(new Paragraph(3, " "));
     addEstadoCaja(doc, expensasEdificio);
     addDeudores(doc, expensasEdificio);
     doc.Add(new Paragraph(8, " "));
     addUrgencias(doc, writer, expensasEdificio, _24, tijera);
     doc.Close();
 }
        public static String generarAllVistaPreviaLiquidaciones(List<edificio> edificios, DateTime p, DateTime vto1, DateTime vto2, string textoPie, System.Drawing.Image _24, System.Drawing.Image qr, System.Drawing.Image tijera)
        {
            List<ExpensasEdificio> expensas = CatalogoExpensas.getAllExpensasVistaPrevia(edificios, p, vto1, vto2);
            calibri = BaseFont.CreateFont(IncludesPath + "calibri.ttf", BaseFont.CP1252, BaseFont.EMBEDDED);
            calibri8N = new Font(calibri, 8, Font.NORMAL);
            calibri8B = new Font(calibri, 8, Font.BOLD);
            calibri9N = new Font(calibri, 9, Font.NORMAL);
            calibri9B = new Font(calibri, 9, Font.BOLD);
            calibri12N = new Font(calibri, 10, Font.NORMAL);
            calibri12B = new Font(calibri, 10, Font.BOLD);
            calibri11N = new Font(calibri, 10, Font.NORMAL);
            calibri11B = new Font(calibri, 10, Font.BOLD);

            Document doc = new Document(PageSize.A4, milimetroToPoint(12), milimetroToPoint(12), milimetroToPoint(7), 0f);
            bool exists = System.IO.Directory.Exists(Ruta + "VistaPrevia\\" + p.Month + " del " + p.Year);
            if (!exists)
                System.IO.Directory.CreateDirectory(Ruta + "VistaPrevia\\" + p.Month + " del " + p.Year);

            String salida = Ruta + @"VistaPrevia\\" + p.Month + " del " + p.Year + "\\VistaPrevia.pdf";
            var output = new FileStream(salida, FileMode.Create);
            var writer = PdfWriter.GetInstance(doc, output);
            doc.Open();
            PDFFooter footer = new PDFFooter();
            footer.texto = "Vista Previa " + (textoPie.Count() > 0 ? "- " + textoPie : "");
            writer.PageEvent = footer;

            foreach (var expensasEdificio in expensas)
            {
                unidad uniAdm = new unidad();
                titular titAdm = new titular();
                titAdm.nombre = "Administración";
                uniAdm.id_unidad = "Archivo";
                uniAdm.titular = titAdm;
                addEncabezado(doc, expensasEdificio, uniAdm, "Ordinaria", "000000000000000", qr);
                addGastos(doc, expensasEdificio);
                doc.Add(new Paragraph(3, " "));
                addEstadoCaja(doc, expensasEdificio);
                addDeudores(doc, expensasEdificio);
                doc.Add(new Paragraph(8, " "));
                addUrgencias(doc, writer, expensasEdificio, _24, tijera);
                doc.NewPage();
            }
            doc.Close();
            return salida;
        }
 public static string emitirRecibo(Bitmap qr, List<CatalogoDeudores.DetalleDeuda> detalles, unidad uni, titular tit)
 {
     return  ControladorInformes.generarRecibo(qr, detalles, uni,tit);
 }
 public static void EliminarTitular(String idTitular)
 {
     titular t = new titular();
     t.idtitular = int.Parse(idTitular);
     EliminarTitular(t);
 }
 public static void EliminarTitular(titular Titular)
 {
     CatalogoTitulares.removeTitular(Titular);
 }
Beispiel #16
0
 private void CargarTitulares()
 {
     List<titular> titulares = (List < titular > )Business.ControladorTitulares.getAllTitulares();
     titular t = new titular();
     t.nombre = "Ninguno";
     titulares.Add(t);
     cmbTitulares.DataSource = titulares;
     cmbTitulares.DisplayMember = "nombre";
     cmbTitulares.SelectedIndex = cmbTitulares.Items.Count - 1;
     if (modifica == true)
     {
         if (titular != "Ninguno")
         {
             cmbTitulares.SelectedIndex = cmbTitulares.FindString(titular);
         }
     }
 }