private void MostrarFotoBeneficiario(double CodigoDeFamiliar)
        {
            using (var context = new lts_sindicatoDataContext())
            {
                convertir_imagen cnvimg = new convertir_imagen();
                socios           soc    = new socios();

                var foto = soc.get_foto_benef_binary(CodigoDeFamiliar);
                picbox_beneficiario.Image = cnvimg.ByteArrayToImage(foto.ToArray());
                lbl_Parentesco.Text       = dgv_MostrarBeneficiario.CurrentRow.Cells["parentesco"].Value.ToString();
            }
        }
Example #2
0
        private void Inicializar()
        {
            socios         oSocio          = new socios();
            SocioImplement oSocioImplement = new SocioImplement();

            oSocio = oSocioImplement.Get(_idSocio);
            this.mtxtNumero.Text    = oSocio.codigo_socio + "-" + oSocio.subcodigo_socio;
            this.mtxtNumero.Enabled = false;
            this.txtNombre.Text     = oSocio.nombre;
            this.txtNombre.Enabled  = false;
            _idAccion = 0;
            CargarGrilla();
        }
Example #3
0
        private void Inicializar()
        {
            socios                 oSocio                  = new socios();
            SocioImplement         oSocioImplement         = new SocioImplement();
            SocioConexionImplement oSocioConexionImplement = new SocioConexionImplement();

            oSocio = oSocioImplement.Get(_idSocio);
            this.txtCodigoSocio.Text    = oSocio.codigo_socio;
            this.txtSubcodigoSocio.Text = oSocio.subcodigo_socio;
            this.txtNombreSocio.Text    = oSocio.nombre;
            this.txtMedidor.Text        = oSocioConexionImplement.Get(_idSocio).medidor;
            CargarGrilla();
        }
Example #4
0
 public int Save(socios oSocio)
 {
     try
     {
         cooperativaEntities bd = new cooperativaEntities();
         bd.socios.AddObject(oSocio);
         bd.SaveChanges();
         return(oSocio.id_socio);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #5
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            socios socios = db.socios.Find(id);

            if (socios == null)
            {
                return(HttpNotFound());
            }
            return(View(socios));
        }
Example #6
0
        private void MostrarDatosDeSocio()
        {
            socios           GetDatosSocio   = new socios();
            convertir_imagen ConvertirImagen = new convertir_imagen();
            var DatosSocio = GetDatosSocio.get_datos_socio(_cuil, 0);

            txt_NroSocio.Text = DatosSocio.nrosocio;
            txt_Nombre.Text   = DatosSocio.apellido.Trim() + " " + DatosSocio.nombre.Trim();
            txt_Dni.Text      = DatosSocio.dni.Trim();
            txt_Empresa.Text  = DatosSocio.empresa.Trim();

            var foto = GetDatosSocio.get_foto_titular_binary(_cuil);

            picbox_socio.Image = ConvertirImagen.ByteArrayToImage(foto.ToArray());
        }
Example #7
0
        public decimal CalcularIVA(int idFactura)
        {
            using (cooperativaEntities bd = new cooperativaEntities())
            {
                Commons oCommons       = new Commons();
                var     detallesByFact = (from d in bd.facturas_detalles
                                          join c in bd.cod_conceptos on d.id_concepto equals c.id_concepto
                                          where d.id_factura == idFactura
                                          select new
                {
                    d.id_factura,
                    d.id_detalle,
                    d.id_concepto,
                    d.idOrden,
                    d.idTipo,
                    d.importe,
                    c.id_formula,
                    c.orden_concepto,
                    c.tipo_signo,
                    c.variable,
                    c.activo,
                    c.aplicar_descuento,
                    c.aplicar_iva,
                    c.aplicar_recargo,
                    c.concepto
                }).ToList();
                DataTable detallesCalc = oCommons.convertToTable(detallesByFact);
                decimal   IVA          = 0;
                foreach (DataRow rowDet in detallesCalc.Rows)
                {
                    if (bool.Parse(rowDet["aplicar_iva"].ToString()))
                    {
                        IVA = IVA + decimal.Parse(rowDet["importe"].ToString());
                    }
                }
                int idSocio = 0;
                FacturasImplement oFacturasImplement = new FacturasImplement();
                idSocio = (int)oFacturasImplement.Get(idFactura).id_socio;
                socios         oSocio          = new socios();
                SocioImplement oSocioImplement = new SocioImplement();
                oSocio = oSocioImplement.Get(idSocio);
                IVA    = IVA * (decimal.Parse(oSocio.iva.ToString()) / 100);

                return(IVA);
            }
        }
Example #8
0
        public ActionResult Edit([Bind(Include = "ID,Nombre,Apellido,Cedula,Foto,Direccion,Telefono,Sexo,Edad,Fecha_de_nacimiento,Afiliados,Datos_Membresia,Lugar_de_trabajo,Direccion_Oficina,Telefono_Oficina,Estado_Membresia,Fecha_de_ingreso,Fecha_de_salida")] socios socios, HttpPostedFileBase imagen)
        {
            if (ModelState.IsValid)
            {
                string nombreARchivo = Path.GetFileNameWithoutExtension(imagen.FileName);
                string extension     = Path.GetExtension(imagen.FileName);
                nombreARchivo = nombreARchivo + DateTime.Now.ToString("yymmssfff") + extension;
                socios.Foto   = "~/images/" + nombreARchivo;
                nombreARchivo = Path.Combine(Server.MapPath("~/images"), nombreARchivo);
                imagen.SaveAs(nombreARchivo);


                db.Entry(socios).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(socios));
        }
Example #9
0
        public static Boolean InsertSocio(socios socio)
        {
            Boolean correcto = false;

            try
            {
                ORM.bd.socios.Add(socio);
                ORM.bd.SaveChanges();
                correcto = true;
            }
            catch (DbUpdateException e)
            {
                ORM.RejectChanges();
                SqlException sqlEx = (SqlException)e.InnerException.InnerException;
                MessageBox.Show(sqlEx.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            return(correcto);
        }
Example #10
0
        public static socios LoginSocio(String dni, String password, ref Boolean correcto)
        {
            socios socio = null;

            try
            {
                socio = (
                    from s in ORM.bd.socios
                    where s.dni.Equals(dni) && s.password.Equals(password) && s.administrador == true && s.activo == true
                    select s).FirstOrDefault();
            }
            catch (EntityException ex)
            {
                correcto = false;
                SqlException sqlEx = (SqlException)ex.InnerException.InnerException;
                MessageBox.Show(ex.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            return(socio);
        }
Example #11
0
        private void Inicializar()
        {
            socios                 oSocio                  = new socios();
            SocioImplement         oSocioImplement         = new SocioImplement();
            SocioConexionImplement oSocioConexionImplement = new SocioConexionImplement();

            oSocio = oSocioImplement.Get(_idSocio);
            this.txtCodigo.Text         = oSocio.codigo_socio;
            this.txtSubCodigo.Text      = oSocio.subcodigo_socio;
            this.txtNombre.Text         = oSocio.nombre;
            _mostrarImpagas             = 0;
            _mostrarValoresActualizados = 0;
            CargarGrilla();
            CargarTotales();
            Thread t = new Thread(new ThreadStart(InicializarTablaExt));

            t.Start();
            //InicializarTablaExt();
        }
Example #12
0
        public static Boolean DeleteSocio(socios socio)
        {
            Boolean correcto = false;

            try
            {
                //ORM.bd.comunidades.RemoveRange(socio.comunidades1);
                ORM.bd.socios.Remove(socio);
                ORM.bd.SaveChanges();
                correcto = true;
            }
            catch (DbUpdateException e)
            {
                ORM.RejectChanges();
                SqlException sqlEx = (SqlException)e.InnerException.InnerException;
                MessageBox.Show(sqlEx.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            return(correcto);
        }
Example #13
0
        private void Cargar_TituBenef()
        {
            socios soc = new socios();

            foreach (var item in soc.Get_Titular_Benef(_cuil, Convert.ToInt32(cbx_eventos.SelectedValue)))
            {
                dgv_titu_benef.Rows.Add();
                int fila = dgv_titu_benef.Rows.Count - 1;
                dgv_titu_benef.Rows[fila].Cells["nombre"].Value      = item.nombre;
                dgv_titu_benef.Rows[fila].Cells["Parentesco"].Value  = item.Parentesco;
                dgv_titu_benef.Rows[fila].Cells["CodigoFliar"].Value = item.CodigoFliar;
                dgv_titu_benef.Rows[fila].Cells["dni"].Value         = item.Cuil;
                dgv_titu_benef.Rows[fila].Cells["sexo"].Value        = item.Sexo;
                dgv_titu_benef.Rows[fila].Cells["Edad"].Value        = item.Edad;
                dgv_titu_benef.Rows[fila].Cells["Exepcion"].Value    = 0;
                dgv_titu_benef.Rows[fila].Cells["Emitir"].Value      = Properties.Resources.impresora_PNG_24; //D:\Proyectos\entrega_cupones\entrega_cupones\Resources\impresora (1).png;
            }
            cargar_exepciones();
        }
Example #14
0
        public socios Get(int id)
        {
            try{
                socios oSocio = new socios();
                using (cooperativaEntities bd = new cooperativaEntities())
                {
                    var regis = (from p in bd.socios
                                 where p.id_socio == id
                                 select p).Single();

                    oSocio.id_socio        = regis.id_socio;
                    oSocio.codigo_socio    = regis.codigo_socio;
                    oSocio.subcodigo_socio = regis.subcodigo_socio;
                    oSocio.nombre          = regis.nombre;
                    oSocio.tipo_documento  = regis.tipo_documento;
                    oSocio.documento       = regis.documento;
                    if (regis.fecha_alta != null)
                    {
                        oSocio.fecha_alta = regis.fecha_alta;
                    }
                    else
                    {
                        oSocio.fecha_alta = DateTime.Parse("01/01/1900");
                    }
                    oSocio.estado        = regis.estado;
                    oSocio.fin_estado    = regis.fin_estado;
                    oSocio.tarifa        = regis.tarifa;
                    oSocio.fin_tarifa    = regis.fin_tarifa;
                    oSocio.iva           = regis.iva;
                    oSocio.cuit          = regis.cuit;
                    oSocio.categoria     = regis.categoria;
                    oSocio.observaciones = regis.observaciones;
                    return(oSocio);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #15
0
        private void dgv_titu_benef_SelectionChanged_1(object sender, EventArgs e)
        {
            int cantfilas = dgv_titu_benef.Rows.Count;

            if (cantfilas > 0) // este if lo hago por que me da error cuando limpio el grid y llamo a mostrar los beneficiarios de las mochilas
            {
                socios           soc = new socios();
                convertir_imagen img = new convertir_imagen();
                int    edad          = Convert.ToInt32(dgv_titu_benef.CurrentRow.Cells["Edad"].Value);
                double Codigo_Fliar;

                Codigo_Fliar = Convert.ToDouble(dgv_titu_benef.CurrentRow.Cells["CodigoFliar"].Value);

                if (Codigo_Fliar > 0)
                {
                    picbox_socio.Image = img.ByteArrayToImage(soc.get_foto_benef_binary(Codigo_Fliar).ToArray());
                }
                else
                {
                    if ((Codigo_Fliar == 0) && (Convert.ToInt32(dgv_titu_benef.CurrentRow.Cells["Exepcion"].Value) == 0)) // es por que es titular
                    {
                        picbox_socio.Image = img.ByteArrayToImage(soc.get_foto_titular_binary(_cuil).ToArray());
                    }
                    else // Es por que es Exepcion
                    {
                        picbox_socio.Image = img.ByteArrayToImage(soc.get_foto_benef_binary(1).ToArray());
                    }
                }

                HabilitarBotonEmitirCupon(Convert.ToInt32(dgv_titu_benef.CurrentRow.Cells["Exepcion"].Value),
                                          Convert.ToInt32(dgv_titu_benef.CurrentRow.Cells["ExepcionId"].Value),
                                          Convert.ToInt32(dgv_titu_benef.CurrentRow.Cells["CodigoFliar"].Value),
                                          edad,
                                          Convert.ToInt32(cbx_eventos.SelectedValue),
                                          (Codigo_Fliar == 0 ? true : false)
                                          );
            }
        }
Example #16
0
        private void Inicializar()
        {
            socios                 oSocio                  = new socios();
            SocioImplement         oSocioImplement         = new SocioImplement();
            SocioConexionImplement oSocioConexionImplement = new SocioConexionImplement();

            oSocio = oSocioImplement.Get(_idSocio);
            this.txtCodigo.Text    = oSocio.codigo_socio;
            this.txtSubCodigo.Text = oSocio.subcodigo_socio;
            this.txtNombre.Text    = oSocio.nombre;


            //   _bandera = true;
            //   _bandera2 = true;

            _cargando = true;
            CargarGrilla();


            //    _bandera = false;
            //    _bandera2 = false;
            //CargarTotales();
        }
Example #17
0
        /// <summary>
        /// Envía un email
        /// </summary>
        /// <param name="socio">Instancia de socio al que enviar el email</param>
        /// <param name="subject">Asunto del email</param>
        /// <param name="body">Cuerpo en html del email</param>
        public static void sendEmail(socios socio, string subject, string body)
        {
            var fromAddress = new MailAddress("*****@*****.**", "Proyecto Gestenis");
            string fromPassword = "******";
            var toAddress = new MailAddress(socio.email, socio.nombre);

            var smtp = new SmtpClient
            {
                Host = "smtp.gmail.com",
                Port = 587,
                EnableSsl = true,
                DeliveryMethod = SmtpDeliveryMethod.Network,
                UseDefaultCredentials = false,
                Credentials = new NetworkCredential(fromAddress.Address, fromPassword)
            };
            using (var message = new MailMessage(fromAddress, toAddress)
            {
                Subject = subject,
                Body = body,
                IsBodyHtml = true
            })
            {
                try // TODO: Mirar que hacer con esta excepción
                {
                    smtp.Send(message);
                }
                catch (Exception e)
                {
                    // ´TODO: mirar que hacer con esta excepción
                    Debug.WriteLine(e);
                }
            }
        }
Example #18
0
        private void EmitirCupon_()
        {
            EventosCupones EvntCpn = new EventosCupones();
            DS_cupones     ds      = new DS_cupones();
            DataTable      dt      = ds.cupon_dia_niño;

            dt.Clear();
            socios          soc        = new socios();
            DataGridViewRow fila       = dgv_titu_benef.CurrentRow;
            DataRow         dr         = dt.NewRow();
            var             datos      = soc.get_datos_socio(_cuil, 0);
            int             edad       = Convert.ToInt32(fila.Cells["Edad"].Value);
            int             nroDeCupon = 0;
            int             Termas     = chk_Termas.Checked ? 1 : 0;

            if (edad > 1 || edad < 22)
            {
                if (Convert.ToInt32(fila.Cells["Exepcion"].Value) == 1)                          // si es Exepcion
                {
                    if (EvntCpn.ExisteExepcion(Convert.ToInt32(fila.Cells["ExepcionID"].Value))) // si Exepcion ya emitio cupon
                    {
                        MessageBox.Show("Ya se emitio cupon para Exepcion.");
                    }
                    else
                    {
                        EventosCupones evntcpn  = new EventosCupones();
                        int            nrocupon = evntcpn.EventosCuponesInsertar(
                            Convert.ToInt32(cbx_eventos.SelectedValue),
                            Convert.ToDouble(fila.Cells["dni"].Value),
                            Convert.ToInt32(fila.Cells["CodigoFliar"].Value),
                            Convert.ToInt32(fila.Cells["ExepcionID"].Value),
                            Convert.ToInt32(cbx_Mochilas.SelectedValue),
                            UsuarioID,
                            txt_QuienRetira.Text,
                            chk_FondoDeDesempleo.Checked == true ? 1 : 0,
                            datos.CuilStr,
                            chk_Termas.Checked ? 1 : 0
                            );
                        nroDeCupon = nrocupon;

                        dr["titu_apenom"]        = datos.apellido + " " + datos.nombre;
                        dr["titu_dni"]           = datos.dni;
                        dr["titu_empresa"]       = datos.empresa;
                        dr["titu_nrosocio"]      = datos.nrosocio;
                        dr["titu_foto"]          = soc.get_foto_titular_binary(_cuil).ToArray();
                        dr["benef_apenom"]       = fila.Cells["nombre"].Value;
                        dr["benef_dni"]          = fila.Cells["Dni"].Value;
                        dr["benef_sexo"]         = fila.Cells["sexo"].Value;
                        dr["benef_edad"]         = fila.Cells["Edad"].Value;
                        dr["benef_foto"]         = soc.get_foto_benef_binary(1).ToArray();
                        dr["event_nrocupon"]     = nrocupon;
                        dr["event_fechaentrega"] = DateTime.Now;
                        dr["event_cupon_ID"]     = EvntCpn.GetCuponID();
                        dr["reimpresion"]        = "0";
                        dt.Rows.Add(dr);
                    }
                }
                else // no es exepcion y pregunto si es entrega de Mochilas y pregunto se existe el familiar par enviar mensaje de que ya se emitio el cupon y si no existe Asigno el Cupon
                {
                    if (Convert.ToInt32(cbx_eventos.SelectedValue) == 4 ?
                        EvntCpn.ExisteFamiliar(Convert.ToInt32(fila.Cells["CodigoFliar"].Value)) :
                        EvntCpn.ExisteTitular(Convert.ToInt32(fila.Cells["Dni"].Value), Convert.ToInt32(cbx_eventos.SelectedValue)))
                    {
                        MessageBox.Show("Ya se emitio cupon para Beneficiario.");
                    }
                    else
                    {
                        EventosCupones evntcpn = new EventosCupones();

                        //Inserto el cupon y devuelvo el nro de Cupon

                        int nrocupon = evntcpn.EventosCuponesInsertar(
                            Convert.ToInt32(cbx_eventos.SelectedValue),
                            Convert.ToDouble(fila.Cells["dni"].Value),
                            Convert.ToInt32(fila.Cells["CodigoFliar"].Value),
                            Convert.ToInt32(fila.Cells["ExepcionID"].Value),
                            Convert.ToInt32(cbx_Mochilas.SelectedValue),
                            UsuarioID,
                            txt_QuienRetira.Text,
                            chk_FondoDeDesempleo.Checked == true ? 1 : 0,
                            datos.CuilStr,
                            chk_Termas.Checked ? 1 : 0
                            );
                        nroDeCupon = nrocupon;

                        dr["titu_apenom"]        = datos.apellido + " " + datos.nombre;
                        dr["titu_dni"]           = datos.dni;
                        dr["titu_empresa"]       = datos.empresa;
                        dr["titu_nrosocio"]      = datos.nrosocio;
                        dr["titu_foto"]          = soc.get_foto_titular_binary(_cuil).ToArray();
                        dr["benef_apenom"]       = fila.Cells["nombre"].Value;
                        dr["benef_dni"]          = fila.Cells["Dni"].Value;
                        dr["benef_sexo"]         = fila.Cells["sexo"].Value;
                        dr["benef_edad"]         = fila.Cells["Edad"].Value;
                        dr["benef_foto"]         = soc.get_foto_benef_binary(Convert.ToInt32(fila.Cells["CodigoFliar"].Value)).ToArray();
                        dr["event_nrocupon"]     = nrocupon;
                        dr["event_fechaentrega"] = DateTime.Now;
                        dr["event_cupon_ID"]     = EvntCpn.GetCuponID();
                        dr["reimpresion"]        = "0";
                        dr["Turno"] = EvntCpn.GetDiaHoraDelTurno(EvntCpn.GetTurno(Convert.ToString(_cuil), Termas));
                        dr["Logo"]  = mtdConvertirImagen.ImageToByteArray(Image.FromFile("C:\\SEC_Gestion\\Imagen\\Logo_reporte.png"));
                        dt.Rows.Add(dr);
                    }
                }
                if (dt.Rows.Count > 0)
                {
                    ImprimirCupones(dt, nroDeCupon, datos.nrosocio, fila.Cells["Edad"].Value.ToString(), datos.dni, dt.Rows[0]["titu_apenom"].ToString(), datos.empresa, fila.Cells["Dni"].Value.ToString(), fila.Cells["nombre"].Value.ToString());

                    fila.Cells["Estado"].Value = "Emitido [Nº: " + EvntCpn.GetNumeroCuponPorCuil(Convert.ToDouble(fila.Cells["dni"].Value), Convert.ToInt32(cbx_eventos.SelectedValue)).ToString() + "]";
                    btn_emitir_cupon.Enabled   = false;

                    //Muestro el Turno. En el Label del Formulario
                    MostrarTurno();
                }
            }
        }
Example #19
0
        public decimal CalcularIVARecargo(int idFactura)
        {
            #region

            /*
             * using (cooperativaEntities bd = new cooperativaEntities())
             * {
             *  Commons oCommons = new Commons();
             *  var detallesByFact = (from d in bd.facturas_detalles
             *                        join c in bd.cod_conceptos on d.id_concepto equals c.id_concepto
             *                        where d.id_factura == idFactura
             *                        select new
             *                        {
             *                            d.id_factura,
             *                            d.id_detalle,
             *                            d.id_concepto,
             *                            d.idOrden,
             *                            d.idTipo,
             *                            d.importe,
             *                            c.id_formula,
             *                            c.orden_concepto,
             *                            c.tipo_signo,
             *                            c.variable,
             *                            c.activo,
             *                            c.aplicar_descuento,
             *                            c.aplicar_iva,
             *                            c.aplicar_recargo,
             *                            c.concepto
             *                        }).ToList();
             *  DataTable detallesCalc = oCommons.convertToTable(detallesByFact);
             *  decimal IVARecargo = 0;
             *  foreach (DataRow rowDet in detallesCalc.Rows)
             *  {
             *      if (bool.Parse(rowDet["aplicar_iva"].ToString()) && bool.Parse(rowDet["aplicar_recargo"].ToString()))
             *          IVARecargo = IVARecargo + decimal.Parse(rowDet["importe"].ToString());
             *  }
             *  int idSocio = 0;
             *  FacturasImplement oFacturasImplement = new FacturasImplement();
             *  idSocio = (int)oFacturasImplement.Get(idFactura).id_socio;
             *  socios oSocio = new socios();
             *  SocioImplement oSocioImplement = new SocioImplement();
             *  oSocio = oSocioImplement.Get(idSocio);
             *
             *  IVARecargo = IVARecargo * (decimal.Parse(oSocio.iva.ToString()) / 100);
             *
             *  return IVARecargo;
             * }
             */
            #endregion
            decimal _IvaRecargo = 0;
            decimal _recargo    = 0;
            _recargo = CalcularRecargo(idFactura);
            int idSocio = 0;
            FacturasImplement oFacturasImplement = new FacturasImplement();
            idSocio = (int)oFacturasImplement.Get(idFactura).id_socio;
            socios         oSocio          = new socios();
            SocioImplement oSocioImplement = new SocioImplement();
            oSocio      = oSocioImplement.Get(idSocio);
            _IvaRecargo = _recargo * (decimal.Parse(oSocio.iva.ToString()) / 100);
            return(_IvaRecargo);
        }
Example #20
0
        public decimal CalcularRecargo(int idFactura)
        {
            using (cooperativaEntities bd = new cooperativaEntities())
            {
                Commons oCommons = new Commons();


                MySqlCommand _comando = new MySqlCommand(String.Format(
                                                             "call GetTotalRecargoByFactura('{0}')", idFactura), dbConectorMySql.ObtenerConexion());

                MySqlDataReader _reader      = _comando.ExecuteReader();
                DataTable       detallesCalc = new DataTable();
                detallesCalc.Load(_reader);
                decimal Recargo = 0;
                Recargo = decimal.Parse(detallesCalc.Rows[0][0].ToString());

                /*var detallesByFact = (from d in bd.facturas_detalles
                 *                    join c in bd.cod_conceptos on d.id_concepto equals c.id_concepto
                 *                    where d.id_factura == idFactura
                 *                    select new
                 *                    {
                 *                        d.id_factura,
                 *                        d.id_detalle,
                 *                        d.id_concepto,
                 *                        d.idOrden,
                 *                        d.idTipo,
                 *                        d.importe,
                 *                        c.id_formula,
                 *                        c.orden_concepto,
                 *                        c.tipo_signo,
                 *                        c.variable,
                 *                        c.activo,
                 *                        c.aplicar_descuento,
                 *                        c.aplicar_iva,
                 *                        c.aplicar_recargo,
                 *                        c.concepto
                 *                    }).ToList();
                 * DataTable detallesCalc = oCommons.convertToTable(detallesByFact);
                 *
                 * foreach (DataRow rowDet in detallesCalc.Rows)
                 * {
                 *  if (bool.Parse(rowDet["aplicar_recargo"].ToString()))
                 *      Recargo = Recargo + decimal.Parse(rowDet["importe"].ToString());
                 * }*/
                /* periodos oPeriodo = new periodos();
                 * PeriodosImplement oPeriososImplement = new PeriodosImplement();
                 *
                 *
                 * FacturasImplement oFacturasImplement = new FacturasImplement();
                 * oPeriodo = oPeriososImplement.Get(oFacturasImplement.Get(idFactura).id_periodo.ToString());*/
                TimeSpan diferencia;
                DateTime fecha_primer_venc = new DateTime();
                fecha_primer_venc = DateTime.Parse(detallesCalc.Rows[0][1].ToString());
                if (fecha_primer_venc < DateTime.Today)
                {
                    diferencia = DateTime.Today - DateTime.Parse(fecha_primer_venc.ToString());
                }
                else
                {
                    diferencia = DateTime.Today - DateTime.Today;
                }
                cod_conceptos     oCod_conceptos     = new cod_conceptos();
                ConceptoImplement oConceptoImplement = new ConceptoImplement();
                oCod_conceptos = oConceptoImplement.Get(18);

                decimal?days      = diferencia.Days * oCod_conceptos.variable;
                decimal resultado = 0;
                if (days >= 0)
                {
                    resultado = (decimal)days;
                }

                int idSocio = 0;
                idSocio = int.Parse(detallesCalc.Rows[0][2].ToString());
                socios         oSocio          = new socios();
                SocioImplement oSocioImplement = new SocioImplement();
                oSocio = oSocioImplement.Get(idSocio);

                tarifas         oTarifa          = new tarifas();
                TarifaImplement oTarifaImplement = new TarifaImplement();
                oTarifa = oTarifaImplement.Get(oSocio.id_socio);

                Recargo = Recargo * resultado;
                DateTime fecha_segundo_venc = new DateTime();
                fecha_segundo_venc = DateTime.Parse(detallesCalc.Rows[0][3].ToString());
                if (fecha_segundo_venc > DateTime.Today)
                {
                    if (oTarifa.cargo_fijo > Recargo) //esto lo hago segun la marca en recargo en tabla tarifas?
                    {
                        Recargo = (decimal)oTarifa.cargo_fijo;
                    }
                }
                return(Recargo);
            }
        }
Example #21
0
        private void RecorrerDgvTituBenef()
        {
            EventosCupones EvntCpn = new EventosCupones();
            DS_cupones     ds      = new DS_cupones();
            DataTable      dt      = ds.cupon_dia_niño;

            dt.Clear();
            socios soc = new socios();

            foreach (DataGridViewRow fila in dgv_titu_benef.Rows)
            {
                if (Convert.ToBoolean(fila.Cells["EmitirCupon"].Value))
                {
                    DataRow dr    = dt.NewRow();
                    var     datos = soc.get_datos_socio(_cuil, 0);
                    if (Convert.ToInt32(fila.Cells["Exepcion"].Value) == 1)                          // si es Exepcion
                    {
                        if (EvntCpn.ExisteExepcion(Convert.ToInt32(fila.Cells["ExepcionID"].Value))) // si Exepcion ya emitio cupon
                        {
                            MessageBox.Show("Ya se emitio cupon para Exepcion.");
                        }
                        else
                        {
                            EventosCupones evntcpn  = new EventosCupones();
                            int            nrocupon = evntcpn.EventosCuponesInsertar(
                                Convert.ToInt32(cbx_eventos.SelectedValue),
                                Convert.ToDouble(fila.Cells["dni"].Value),
                                Convert.ToInt32(fila.Cells["CodigoFliar"].Value),
                                Convert.ToInt32(fila.Cells["ExepcionID"].Value),
                                0,
                                UsuarioID,
                                string.Empty,
                                0,
                                datos.CuilStr,
                                0
                                );


                            dr["titu_apenom"]        = datos.apellido + " " + datos.nombre;
                            dr["titu_dni"]           = datos.dni;
                            dr["titu_empresa"]       = datos.empresa;
                            dr["titu_nrosocio"]      = datos.nrosocio;
                            dr["titu_foto"]          = soc.get_foto_titular_binary(_cuil).ToArray();
                            dr["benef_apenom"]       = fila.Cells["nombre"].Value;
                            dr["benef_dni"]          = fila.Cells["Dni"].Value;
                            dr["benef_sexo"]         = fila.Cells["sexo"].Value;
                            dr["benef_edad"]         = fila.Cells["Edad"].Value;
                            dr["benef_foto"]         = soc.get_foto_benef_binary(1).ToArray();
                            dr["event_nrocupon"]     = nrocupon;
                            dr["event_fechaentrega"] = DateTime.Now;
                            dt.Rows.Add(dr);
                        }
                    }
                    else
                    {
                        if (EvntCpn.ExisteFamiliar(Convert.ToInt32(fila.Cells["CodigoFliar"].Value)))
                        {
                            MessageBox.Show("Ya se emitio cupon para Beneficiario.");
                        }
                        else
                        {
                            EventosCupones evntcpn = new EventosCupones();

                            int nrocupon = evntcpn.EventosCuponesInsertar(
                                Convert.ToInt32(cbx_eventos.SelectedValue),
                                Convert.ToDouble(fila.Cells["dni"].Value),
                                Convert.ToInt32(fila.Cells["CodigoFliar"].Value),
                                Convert.ToInt32(fila.Cells["ExepcionID"].Value),
                                0,
                                UsuarioID,
                                string.Empty,
                                0,
                                datos.CuilStr,
                                0
                                );

                            dr["titu_apenom"]        = datos.apellido + " " + datos.nombre;
                            dr["titu_dni"]           = datos.dni;
                            dr["titu_empresa"]       = datos.empresa;
                            dr["titu_nrosocio"]      = datos.nrosocio;
                            dr["titu_foto"]          = soc.get_foto_titular_binary(_cuil).ToArray();
                            dr["benef_apenom"]       = fila.Cells["nombre"].Value;
                            dr["benef_dni"]          = fila.Cells["Dni"].Value;
                            dr["benef_sexo"]         = fila.Cells["sexo"].Value;
                            dr["benef_edad"]         = fila.Cells["Edad"].Value;
                            dr["benef_foto"]         = soc.get_foto_benef_binary(Convert.ToInt32(fila.Cells["CodigoFliar"].Value)).ToArray();
                            dr["event_nrocupon"]     = nrocupon;
                            dr["event_fechaentrega"] = DateTime.Now;
                            dt.Rows.Add(dr);
                        }
                    }
                }
            }
            if (dt.Rows.Count > 0)
            {
                ImprimirCupones(dt);
            }
        }
Example #22
0
        private void CargarDatos()
        {
            if (txtNroFactura.Text.Length > 0)
            {
                facturas                  oFacturas                  = new facturas();
                socios                    oSocio                     = new socios();
                SocioImplement            oSocioImplement            = new SocioImplement();
                FacturasImplement         oFacturasImplement         = new FacturasImplement();
                PeriodosImplement         oPeriodosImplement         = new PeriodosImplement();
                FacturasDetallesImplement oFacturasDetallesImplement = new FacturasDetallesImplement();
                _idFactura = int.Parse(txtNroFactura.Text);
                if (oFacturasImplement.ExisteFactura(_idFactura))
                {
                    oFacturas = oFacturasImplement.Get(int.Parse(txtNroFactura.Text));
                    oSocio    = oSocioImplement.Get((int)oFacturas.id_socio);
                    _idSocio  = oSocio.id_socio;
                    txtCodigoSubCodSocio.Text = oSocio.codigo_socio + "/" + oSocio.subcodigo_socio;
                    txtNombreSocio.Text       = oSocio.nombre;
                    txtVencimiento.Text       = ((DateTime)oPeriodosImplement.Get(oFacturas.id_periodo).fecha_primer_venc).ToShortDateString();
                    //facturado = neto + iva
                    DataTable detallesFacturaDT = oFacturasImplement.GetByIdFacturaDT(oFacturas.id_factura);
                    decimal   _totalFacturado   = 0;
                    decimal   _importeTotal     = 0;
                    decimal   _convenio         = 0;
                    decimal   _acciones         = 0;
                    foreach (DataRow dr in detallesFacturaDT.Rows)
                    {
                        //IVA = decimal.Parse(dr["IVA"].ToString());
                        _totalFacturado = _totalFacturado + decimal.Parse(dr["Neto"].ToString()) + decimal.Parse(dr["IVA"].ToString());
                        _importeTotal   = _importeTotal + decimal.Parse(dr["Total"].ToString());
                        _convenio       = _convenio + decimal.Parse(dr["Convenio"].ToString());
                        _acciones       = _acciones + decimal.Parse(dr["Acciones"].ToString());
                    }

                    txtFacturado.Text = _totalFacturado.ToString();
                    txtCobrado.Text   = oFacturas.cobrado.ToString();
                    txtResto.Text     = (_totalFacturado - (decimal.Parse(oFacturas.cobrado.ToString()))).ToString();
                    txtDescuento.Text = "0";
                    CalculosFactura oCalculosFacturas = new CalculosFactura();
                    txtRecargo.Text  = (oCalculosFacturas.CalcularRecargo(oFacturas.id_factura) + oCalculosFacturas.CalcularIVARecargo(oFacturas.id_factura)).ToString();
                    txtTotal.Text    = (_importeTotal - (decimal)oFacturas.cobrado - decimal.Parse(txtDescuento.Text)).ToString();
                    txtConvenio.Text = _convenio.ToString();
                    txtAcciones.Text = _acciones.ToString();


                    CobranzasImplement oCobranzasImplement = new CobranzasImplement();

                    txtFactIngresadas.Text = oCobranzasImplement.GetFacturas(dtpFechaCaja.Value).ToString();

                    txtTotalCobrado.Text = _importeTotal.ToString();
                    txtTotalFactura.Text = _importeTotal.ToString();;
                    txtDiferencia.Text   = (decimal.Parse(txtTotalFactura.Text) - decimal.Parse(txtTotalCobrado.Text)).ToString();
                }
                else
                {
                    //si esta con cobranza entonces seria para cambiar la caja
                    if (oFacturasImplement.ExisteCobranza(_idFactura))
                    {
                        _existeCobranza = true;
                    }
                    else
                    {
                        _existeCobranza = false;
                    }
                }
            }
        }
Example #23
0
        private void Inicializar()
        {
            socios         oSocios          = new socios();
            SocioImplement oSociosImplement = new SocioImplement();

            socios_lote        oSocioLote          = new socios_lote();
            SocioLoteImplement oSocioLoteImplement = new SocioLoteImplement();

            oSocioLote = oSocioLoteImplement.Get(_idSocio);

            socios_conexion        oSocioConexion          = new socios_conexion();
            SocioConexionImplement oSocioConexionImplement = new SocioConexionImplement();

            oSocioConexion = oSocioConexionImplement.Get(_idSocio);

            socios_varios        oSocioVarios          = new socios_varios();
            SocioVariosImplement oSocioVariosImplement = new SocioVariosImplement();

            oSocioVarios = oSocioVariosImplement.Get(_idSocio);


            oSocios               = oSociosImplement.Get(_idSocio);
            txtCodigo.Text        = oSocios.codigo_socio;
            txtFechaConvenio.Text = _FechaConvenio.ToShortDateString();
            txtNombre.Text        = oSocios.nombre;
            cod_documentos     oCodDocumentos       = new cod_documentos();
            DocumentoImplement oDocumentosImplement = new DocumentoImplement();

            if (oSocios.tipo_documento != null)
            {
                txtTipoDocumento.Text = oDocumentosImplement.Get((int)oSocios.tipo_documento).documento;
            }
            txtDocumento.Text = oSocios.documento.ToString();

            CalleImplement oCalleImplement = new CalleImplement();

            BarrioImplement    oBarrioImplement    = new BarrioImplement();
            LocalidadImplement oLocalidadImplement = new LocalidadImplement();

            if (oSocioConexion.calle != null & (int)oSocioConexion.calle != 0)
            {
                txtDomicilioReal.Text = oCalleImplement.Get((int)oSocioConexion.calle).calle + " " + oSocioConexion.calle_altura;
            }
            if (oSocioLote.localidad != null & (int)oSocioLote.localidad != 0)
            {
                txtCiudadReal.Text = oLocalidadImplement.Get((int)oSocioLote.localidad).localidad;
            }
            if (oSocioLote.calle != null & (int)oSocioLote.calle != 0)
            {
                txtDomicilioLegal.Text = oCalleImplement.Get((int)oSocioLote.calle).calle + " " + oSocioLote.calle_altura;
            }
            if (oSocioLote.localidad != null & (int)oSocioLote.localidad != 0)
            {
                txtCiudadLegal.Text = oLocalidadImplement.Get((int)oSocioLote.localidad).localidad;
            }
            txtLote.Text    = oSocioLote.lote;
            txtManzana.Text = oSocioLote.manzana;
            if (oSocioLote.barrio != null & (int)oSocioLote.barrio != 0)
            {
                txtBarrio.Text = oBarrioImplement.Get((int)oSocioLote.barrio).barrio;
            }

            txtImporteDeuda.Text          = _ImporteDeuda.ToString();
            txtValorCuotas.Text           = _ImporteCuota.ToString();
            txtCantidadCuotas.Text        = _CantidadCuotas.ToString();
            txtImporteCanonMunicipal.Text = _CanonMunicipal.ToString();


            FacturasImplement oFacturasImplement = new FacturasImplement();
            string            sPeriodo           = oFacturasImplement.GetUltimoPeriodoFacturadoBySocio(_idSocio);
            int      anio         = int.Parse(sPeriodo.Substring(0, 3));
            int      mes          = int.Parse(sPeriodo.Substring(4, 5));
            DateTime fechaPeriodo = new DateTime(anio, mes, 1);
            DateTime fechaDesde   = fechaPeriodo.AddMonths(1);
            DateTime fechaHasta   = fechaPeriodo.AddMonths(_CantidadCuotas);
            Meses    mesDesde     = (Meses)fechaDesde.Month;
            Meses    mesHasta     = (Meses)fechaHasta.Month;

            txtDesdeMes.Text  = mesDesde.ToString();
            txtMesHasta.Text  = mesHasta.ToString();
            txtDesdeAnio.Text = fechaDesde.Year.ToString();
            txtAnioHasta.Text = fechaHasta.Year.ToString();
        }
Example #24
0
        private void Imprimir()
        {
            SysConfigImplement oSysConfigImplement = new SysConfigImplement();

            Reportes.frmReportes frmRpt             = new Reportes.frmReportes();
            Reportes.rptFacturas rpt                = new Reportes.rptFacturas();
            FacturasImplement    oFacturasImplement = new FacturasImplement();
            //DataTable dtFacturas=new DataTable();
            //if(_mostrarImpagas ==0)
            //{
            //    if(_mostrarValoresActualizados==0)
            //    {
            //        dtFacturas=_facturasNoAct;
            //    }
            //    else
            //    {
            //        dtFacturas=_facturasAct;
            //    }
            //}
            //else
            //{
            //    if(_mostrarValoresActualizados==0)
            //    {
            //        dtFacturas=_facturasNoActImp;
            //    }
            //    else
            //    {
            //        dtFacturas=_facturasActImp;
            //    }
            //}


            DataTable dtFacturas     = oFacturasImplement.GetByIdSocioDT(_idSocio, _mostrarImpagas, _mostrarValoresActualizados);
            decimal   totalfacturado = 0;
            decimal   totalrecargo   = 0;
            decimal   totalcobrado   = 0;
            decimal   totaldeuda     = 0;

            foreach (DataRow dr in dtFacturas.Rows)
            {
                dr["Total"]   = (decimal.Parse(dr["Recargo"].ToString()) + decimal.Parse(dr["IVARecargo"].ToString())) + (decimal.Parse(dr["Neto"].ToString()) + decimal.Parse(dr["IVA"].ToString())) - decimal.Parse(dr["Cobrado"].ToString());
                dr["Neto"]    = (decimal.Parse(dr["Neto"].ToString()) + decimal.Parse(dr["IVA"].ToString()));
                dr["Recargo"] = (decimal.Parse(dr["Recargo"].ToString()) + decimal.Parse(dr["IVARecargo"].ToString()));

                totalfacturado = totalfacturado + (decimal.Parse(dr["Neto"].ToString()) + decimal.Parse(dr["IVA"].ToString()));
                totalrecargo   = totalrecargo + (decimal.Parse(dr["Recargo"].ToString()) + decimal.Parse(dr["IVARecargo"].ToString()));
                totalcobrado   = totalcobrado + decimal.Parse(dr["Cobrado"].ToString());
                totaldeuda     = totaldeuda + decimal.Parse(dr["Total"].ToString());
            }

            socios             oSocio               = new socios();
            SocioImplement     oSocioImplement      = new SocioImplement();
            socios_lote        oSocio_lote          = new socios_lote();
            SocioLoteImplement oSocio_loteImplement = new SocioLoteImplement();
            tarifas            oTarifas             = new tarifas();
            TarifaImplement    oTarifaImplement     = new TarifaImplement();
            cod_barrios        oCod_Barrios         = new cod_barrios();
            BarrioImplement    oBarrioImplement     = new BarrioImplement();
            cod_calles         oCod_Calles          = new  cod_calles();
            CalleImplement     oCalleImplement      = new CalleImplement();

            oSocio      = oSocioImplement.Get(_idSocio);
            oSocio_lote = oSocio_loteImplement.Get(_idSocio);
            string calleAltura = "";
            string manzana     = "";
            string lote        = "";
            string tarifa      = "";
            string barrio      = "";

            if (oSocio.tarifa > 0)
            {
                tarifa = oTarifaImplement.Get((int)oSocio.tarifa).tarifa;
            }
            if (oSocio_lote != null)
            {
                if (oSocio_lote.barrio > 0)
                {
                    barrio = oBarrioImplement.Get((int)oSocio_lote.barrio).barrio;
                }
                if (oSocio_lote.calle_altura.Length > 0)
                {
                    calleAltura = oSocio_lote.calle_altura;
                }
                if (oSocio_lote.manzana.Length > 0)
                {
                    manzana = oSocio_lote.manzana;
                }
                if (oSocio_lote.lote.Length > 0)
                {
                    lote = oSocio_lote.lote;
                }
            }
            string calle = "";

            if (oSocio_lote.calle != null && oSocio_lote.calle > 0)
            {
                calle = oCalleImplement.Get((int)oSocio_lote.calle).calle;
            }

            //Cargo el Data Set


            DataSet ds = new DataSet("Generico");

            ds.Tables.Add(oSysConfigImplement.GetEncabezadoDT("Encabezado"));
            ds.Tables[0].TableName = "dtEncabezado";
            ds.Tables.Add(dtFacturas);
            ds.Tables[1].TableName = "dtFacturas";
            rpt.SetDataSource(ds);
            rpt.SetParameterValue("socio", oSocio.codigo_socio + "/" + oSocio.subcodigo_socio + "  " + oSocio.nombre);
            rpt.SetParameterValue("tarifa", tarifa);
            rpt.SetParameterValue("barrio", barrio);
            rpt.SetParameterValue("calle", calle);
            rpt.SetParameterValue("numero", calleAltura);
            rpt.SetParameterValue("manzana", manzana);
            rpt.SetParameterValue("lote", lote);
            rpt.SetParameterValue("totalfacturado", Math.Round(totalfacturado, 2).ToString());
            rpt.SetParameterValue("totalrecargo", Math.Round(totalrecargo, 2).ToString());
            rpt.SetParameterValue("totalcobrado", Math.Round(totalcobrado, 2).ToString());
            rpt.SetParameterValue("totaldeuda", Math.Round(totaldeuda, 2).ToString());
            frmRpt.crvGenerico.ReportSource = rpt;
            frmRpt.Show();
        }