Exemple #1
0
        private bool Validar()
        {
            CapaNegocios.Planilla vNegocioPlanilla = new CapaNegocios.Planilla();
            bool vResultado = true;

            try
            {
                if (txtNombre.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("El campo Nombre contiene un valor no válido", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    vResultado = false;
                }

                if (txtApellido1.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("El campo Apellido1 contiene un valor no válido", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    vResultado = false;
                }

                if (txtApellido2.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("El campo Apellido2 contiene un valor no válido", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    vResultado = false;
                }
            }
            catch (Exception ex)
            {
                vResultado = false;
                throw new Exception(ex.Message, ex);
            }
            return(vResultado);
        }
Exemple #2
0
        private void btnAplicar_Click(object sender, EventArgs e)
        {
            int vUltimaLinea;

            CapaEntidad.Estructura.Planilla vDatos;
            CapaNegocios.Planilla           vNegocioPlanilla = new CapaNegocios.Planilla();
            try
            {
                if (dtDatos.Rows.Count > 0)
                {
                    vUltimaLinea = dtDatos.Rows.Count - 1;
                    vDatos       = new CapaEntidad.Estructura.Planilla()
                    {
                        IdLote         = Convert.ToInt32(dtDatos.Rows[0]["IdLote"].ToString()),
                        IdCliente      = Convert.ToInt32(dtDatos.Rows[0]["IdCliente"].ToString()),
                        FechaCorte     = Convert.ToDateTime(dtDatos.Rows[0]["FechaCorte"].ToString()),
                        IdCredito      = Convert.ToInt32(dtDatos.Rows[0]["IdCredito"].ToString()),
                        CuotaCobrada   = Convert.ToDecimal(dtDatos.Rows[0]["CuotaCobrada"].ToString()),
                        CuotaPaga      = Convert.ToDecimal(dtDatos.Rows[0]["CuotaPaga"].ToString()),
                        SaldoPendiente = Convert.ToDecimal(dtDatos.Rows[0]["SaldoPendiente"].ToString()),
                        Amortizacion   = Convert.ToDecimal(dtDatos.Rows[0]["Amortizacion"].ToString()),
                        Intereses      = Convert.ToDecimal(dtDatos.Rows[0]["Intereses"].ToString()),
                        EstadoPlanilla = Convert.ToString(dtDatos.Rows[0]["EstadoPlanilla"].ToString()),
                    };
                    vNegocioPlanilla.Insert(vDatos);
                    MessageBox.Show("El Proceso a finalizado de forma correcta");
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
        private bool Validar()
        {
            CapaNegocios.Planilla vNegocioPlanilla = new CapaNegocios.Planilla();
            bool vResultado = true;

            try
            {
                if (txtIdCliente.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("El campo Id Cliente contiene un valor no válido", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    vResultado = false;
                }

                if (txtTasa.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("El campo Tasa contiene un valor no válido", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    vResultado = false;
                }

                if (txtMontoCredito.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("El campo Monto Crédito contiene un valor no válido", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    vResultado = false;
                }

                if (txtPlazo.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("El campo Plazo contiene un valor no válido", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    vResultado = false;
                }

                if (txtCuota.Text.Trim() == string.Empty)
                {
                    MessageBox.Show("El campo Plazo contiene un valor no válido", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    vResultado = false;
                }

                if (vModo == "E")
                {
                    if (vNegocioPlanilla.LeerPlanilla(vIdCredito).Rows.Count > 0)
                    {
                        if (MessageBox.Show("El credito seleccionado  contiene una planilla asociada,¿Desea continuar?", "Informacion", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No)
                        {
                            vResultado = false;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                vResultado = false;
                throw new Exception(ex.Message, ex);
            }
            return(vResultado);
        }
Exemple #4
0
 public void CargarArchivoExcel(string pRuta)
 {
     CapaNegocios.Planilla vNegocioPlanilla = new CapaNegocios.Planilla();
     try
     {
         dtDatos             = vNegocioPlanilla.LeerExcel(pRuta, "Hoja1");
         dgvDatos.DataSource = dtDatos;
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message, ex);
     }
 }
Exemple #5
0
        public void CargarArchivoXml(string pRuta)
        {
            CapaNegocios.Planilla vNegocioPlanilla = new CapaNegocios.Planilla();
            DataSet dsDatos = new DataSet();
            string  vXML    = string.Empty;

            System.Xml.XmlDocument xml = new System.Xml.XmlDocument();
            XmlNodeReader          xmlNodedr;

            try
            {
                XmlDocument xDoc = new XmlDocument();
                xDoc.Load(pRuta);
                xmlNodedr = new XmlNodeReader(xDoc);
                dsDatos.ReadXml(xmlNodedr);
                dgvDatos.DataSource = dsDatos.Tables[0];
                dtDatos             = dsDatos.Tables[0];
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }
        private void GenerarProyeccion()
        {
            List <CapaEntidad.Estructura.Proyeccion> vListaProyeccion = new List <CapaEntidad.Estructura.Proyeccion>();

            CapaNegocios.Planilla             vNegocioPlanilla = new CapaNegocios.Planilla();
            CapaEntidad.Estructura.Proyeccion vProyeccion;
            decimal   vSaldoAnterior = 0;
            decimal   vTasa          = 0;
            int       vDias;
            DateTime  vFecha = DateTime.Now.Date;
            DataTable dtPlanilla;
            int       vCantidadRegistros = 0;
            decimal   vSaldo             = 0;
            decimal   vSaldo2            = 0;

            try
            {
                vSaldoAnterior = Math.Round(Convert.ToDecimal(txtMontoCredito.Text), 2);
                vTasa          = Convert.ToDecimal(txtTasa.Text) / 100;
                if (vModo == "C")
                {
                    dtPlanilla = vNegocioPlanilla.LeerPlanilla(vIdCredito);
                    if (dtPlanilla.Rows.Count > 0)
                    {
                        vFecha             = Convert.ToDateTime(dtPlanilla.Rows[0]["FechaCorte"].ToString());
                        vCantidadRegistros = dtPlanilla.Rows.Count;
                    }
                }
                for (int i = 0; i <= Convert.ToInt32(txtPlazo.Text); i++)
                {
                    if (i == 0)
                    {
                        vProyeccion = new CapaEntidad.Estructura.Proyeccion()
                        {
                            Cuota          = 0,
                            MontoPrincipal = 0,
                            Interes        = 0,
                            Saldo          = vSaldoAnterior,
                            Pago           = 0,
                            FechaCorte     = vFecha,
                            NumeroCuota    = i
                        };
                    }
                    else
                    {
                        vFecha = DateTime.Now.Date.AddMonths(i);
                        vDias  = vFecha.Day;
                        if (vFecha.Month == 2)
                        {
                            vDias = 28 - vDias;
                        }
                        else
                        {
                            vDias = 30 - vDias;
                        }
                        vFecha                     = vFecha.AddDays(vDias);
                        vProyeccion                = new CapaEntidad.Estructura.Proyeccion();
                        vProyeccion.Cuota          = Convert.ToDecimal(txtCuota.Text);
                        vProyeccion.MontoPrincipal = Math.Round(vSaldoAnterior * vTasa, 2);
                        vProyeccion.Interes        = Math.Round(Convert.ToDecimal(txtCuota.Text) - vProyeccion.MontoPrincipal, 2);
                        vProyeccion.Saldo          = Math.Round(vSaldoAnterior - vProyeccion.Interes, 2);
                        vProyeccion.NumeroCuota    = i;
                        vSaldoAnterior             = Math.Round(vProyeccion.Saldo, 2);
                        vProyeccion.FechaCorte     = vFecha;

                        if (vModo == "C" && i <= vCantidadRegistros)
                        {
                            vProyeccion.Pago = vProyeccion.Cuota;
                            vSaldo2          = vProyeccion.Saldo;
                        }
                        else
                        {
                            if (vModo == "C")
                            {
                                vSaldo = Math.Round(vSaldoAnterior - vProyeccion.Interes, 2);
                                if (vSaldo2 != 0)
                                {
                                    vProyeccion.Saldo = vSaldo2;
                                }

                                vSaldoAnterior = Math.Round(vSaldo, 2);
                            }
                        }
                    }
                    vListaProyeccion.Add(vProyeccion);
                }
                dgvProyeccion.DataSource = vListaProyeccion;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex);
            }
        }