Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                ConstantesWeb.MostrarError(string.Empty, this.Page);
                CargarGrillaGastosOrdinarios();
                CargarGrillaGastosEvOrdinarios();
                CargarGrillaGastosEvExtraordinarios();
                CargarTotalGastos();
                CargarComboGastosOrdinarios();
                CargarCombosProveedores();
                ClientScript.RegisterStartupScript(GetType(), "TipoGastos", "cambioTipoGastos()", true);

                if (Session["Periodo"] != null)
                {
                    lblTitulo.Text = "Expensa de " + Session["direccionConsorcio"] + " del Periodo " + Session["Periodo"];
                }

                if (Session["Estado"] != null && Session["Estado"].ToString() == Constantes.EstadoAceptado)
                {
                    btnAceptar.Enabled = false;
                }

                divGastoOrdnarioNuevo.Visible = false;
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "TipoGastos", "cambioTipoGastos();", true);
            }
        }
Esempio n. 2
0
        protected void btnAnterior_Click(object sender, EventArgs e)
        {
            try
            {
                Dictionary <decimal, UnidadesFuncionalesModel> map = (Dictionary <decimal, UnidadesFuncionalesModel>)Session["MapPagoId"];
                decimal pagoID = Session["PagoId"].ToString().ToDecimal();
                var     key    = map.FirstOrDefault(x => x.Value.PagoId == pagoID).Key;
                ConstantesWeb.MostrarError(string.Empty, this.Page);

                key--;

                if (key > 0)
                {
                    var pago = map.FirstOrDefault(x => x.Key == key).Value;
                    Session["PagoId"] = pago.PagoId;
                    tituloPaginaID.CargarTitulo("Expensa de la Unidad Funcional de " + pago.Apellido + pago.Nombre);
                    CargaInicial();
                }
                else
                {
                    ConstantesWeb.MostrarError("No existen Unidades Funcionales previas para mostrar", this.Page);
                }
            }
            catch (Exception)
            {
                ConstantesWeb.MostrarError("No existen Unidades Funcionales previas para mostrar", this.Page);
            }
        }
Esempio n. 3
0
 protected void btnCancelarGastoEvExt_Click(object sender, EventArgs e)
 {
     txtDetalleGastoEvExt.Text          = "";
     txtImporteGastoExtraordinario.Text = "";
     txtImporteCompraGastoEvExt.Text    = "";
     ddlProveedoresEvExt.SelectedIndex  = 0;
     btnAgregarGastoEvExt.Text          = "Agregar";
     ConstantesWeb.MostrarError(string.Empty, this.Page);
 }
Esempio n. 4
0
        protected void btnAgregarGastoFijo_Click(object sender, EventArgs e)
        {
            int expensaId = Convert.ToInt32(Session["ExpensaId"]);

            ConstantesWeb.MostrarError(string.Empty, this.Page);

            try
            {
                int idExpensa = Convert.ToInt32(Session["ExpensaId"]);

                #region Validar
                if (btnNuevo.Checked && txtGastoFijo.Text == "")
                {
                    ConstantesWeb.MostrarError(Constantes.ErrorFaltaDetalle, this.Page);
                    return;
                }
                else if (!txtImporte.Text.IsNumeric())
                {
                    ConstantesWeb.MostrarError(Constantes.ErrorFaltaImporte, this.Page);
                    return;
                }
                else if (btnGuardado.Checked && ddlGastos.SelectedValue == "0")
                {
                    ConstantesWeb.MostrarError(Constantes.ErrorFaltaGasto, this.Page);
                    return;
                }
                #endregion

                if (btnAgregarGastoOrdinario.Text == "Agregar")
                {
                    AgregarGastoOrdinario(idExpensa);
                }
                else
                {
                    ModificarGastoOrdinario();
                }

                #region Limpiar Pantalla
                txtGastoFijo.Text        = "";
                txtImporte.Text          = "";
                ddlGastos.SelectedIndex  = 0;
                txtDetalleGastoFijo.Text = "";
                txtGastoFijo.Enabled     = true;
                CargarGrillaGastosOrdinarios();
                CargarGrillaGastosEvExtraordinarios();
                CargarTotalGastos();
                GuardarUltimoTotal(expensaId, Constantes.GetDecimalFromCurrency(lblTotalGastosOrdinarios.Text));
                btnNuevo.Enabled    = true;
                btnGuardado.Enabled = true;
                #endregion
            }
            catch
            {
                ConstantesWeb.MostrarError("No se pudo guardar los cambios", this.Page);
            }
        }
Esempio n. 5
0
 protected void btnCancelarGastoFijo_Click(object sender, EventArgs e)
 {
     txtGastoFijo.Text             = "";
     txtGastoFijo.Enabled          = true;
     txtImporte.Text               = "";
     txtDetalleGastoFijo.Text      = "";
     ddlGastos.SelectedValue       = "0";
     btnAgregarGastoOrdinario.Text = "Agregar";
     ConstantesWeb.MostrarError(string.Empty, this.Page);
     btnNuevo.Enabled    = true;
     btnGuardado.Enabled = true;
 }
Esempio n. 6
0
        protected void btnAceptar_Click(object sender, EventArgs e)
        {
            string confirmValue = Request.Form["confirm_value"];

            if (confirmValue == "Si")
            {
                try
                {
                    _expensaNeg.AceptarExpensa(Convert.ToInt32(Session["ExpensaId"]), lblTotalGastosExtraordinarios.Text, lblTotalGastosOrdinarios.Text);
                }
                catch (Exception ex)
                {
                    ConstantesWeb.MostrarError(ex.Message, this.Page);
                    return;
                }

                Response.Redirect("Expensas.aspx#consorcios");
            }
        }
Esempio n. 7
0
        protected void grdGastosEventuales_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                if (e.CommandSource.GetType().ToString().ToUpper().Contains("IMAGEBUTTON"))
                {
                    ImageButton imgButton   = (ImageButton)e.CommandSource;
                    var         gridViewrow = (GridViewRow)imgButton.NamingContainer;

                    string tipo = e.CommandName.ToUpper();
                    ConstantesWeb.MostrarError(string.Empty, this.Page);

                    switch (tipo)
                    {
                    case "ELIMINAR":
                        var idGasto   = Convert.ToDecimal(gridViewrow.Cells[GrdEvOrd_ColIdExpensaDetalle].Text);
                        int expensaId = Convert.ToInt32(Session["ExpensaId"]);

                        _gastosServ.DeleteGastoEvOrdinario(idGasto);
                        _expensasServ.ActualizarTotalGastosEvOrdinarios(expensaId);
                        CargarGrillaGastosOrdinarios();
                        CargarGrillaGastosEvOrdinarios();
                        CargarTotalGastos();
                        GuardarUltimoTotal(expensaId, Constantes.GetDecimalFromCurrency(lblTotalGastosOrdinarios.Text));
                        break;

                    case "MODIFICAR":
                        Session["gastoEvOrdinarioId"]     = Convert.ToDecimal(gridViewrow.Cells[GrdEvOrd_ColIdExpensaDetalle].Text);
                        ddlProveedoresEvOrd.SelectedValue = gridViewrow.Cells[GrdEvOrd_ColIdProveedores].Text;
                        GetTipoProveedorEvOrd();
                        txtDetalleGastoEvOrd.Text       = gridViewrow.Cells[ColDetalle].Text;
                        txtImporteCompraGastoEvOrd.Text = gridViewrow.Cells[ColImporteCompra].Text;
                        txtImporteEvOrd.Text            = gridViewrow.Cells[ColImporteVenta].Text;
                        btnAgregarGastoEvOrd.Text       = "Modificar";
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                ConstantesWeb.MostrarError("No se pudo realizar la operacion", this.Page);
            }
        }
Esempio n. 8
0
        private void CargaInicial()
        {
            bool MostrarDatosParticulares;

            ConstantesWeb.MostrarError(string.Empty, this.Page);

            CargaGrillaGastosParticularesOrd();
            CargaGrillaGastosParticularesExt();
            var pago = _unidadesFuncServ.GetPago(Session["PagoId"].ToString().ToDecimal());

            totalesUF.CalcularTotales(pago);
            txtImporteGastoParticular.Text = pago.ImporteGastoParticular.ToString("0.00");
            txtDetalleGastoParticular.Text = pago.DetalleGastoParticular;


            MostrarDatosParticulares = Session["Estado"].ToString() != "Finalizado";

            txtDetalleGastoParticular.Enabled = MostrarDatosParticulares;
            txtImporteGastoParticular.Enabled = MostrarDatosParticulares;
            btnActualizar.Visible             = MostrarDatosParticulares;
        }
Esempio n. 9
0
        protected void btnActualizar_Click(object sender, EventArgs e)
        {
            if (txtImporteGastoParticular.Text.IsNumeric() == false)
            {
                ConstantesWeb.MostrarError("No se ingreso un Importe correcto", this.Page);
            }
            else
            {
                ConstantesWeb.MostrarError(string.Empty, this.Page);

                unidadesFuncionalesServ serv = new unidadesFuncionalesServ();
                decimal PagoId  = Session["PagoId"].ToString().ToDecimal();
                decimal importe = Convert.ToDecimal(txtImporteGastoParticular.Text);
                serv.GuardarGastoParticular(PagoId, importe, txtDetalleGastoParticular.Text.ToUpper());
                var pago = _unidadesFuncServ.GetPago(PagoId);

                totalesUF.CalcularTotales(pago);
                txtImporteGastoParticular.Text = pago.ImporteGastoParticular.ToString("0.00");
                txtDetalleGastoParticular.Text = pago.DetalleGastoParticular;
            }
        }
Esempio n. 10
0
        protected void grdGastosFijos_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            GridViewRow gridViewrow;

            ConstantesWeb.MostrarError(string.Empty, this.Page);

            try
            {
                if (e.CommandSource.GetType().ToString().ToUpper().Contains("IMAGEBUTTON"))
                {
                    ImageButton imgButton = (ImageButton)e.CommandSource;
                    gridViewrow = (GridViewRow)imgButton.NamingContainer;

                    string tipo = e.CommandName.ToUpper();
                    int    expensaId;

                    switch (tipo)
                    {
                    case "ELIMINAR":
                        var idExpensaDetalle = Convert.ToDecimal(gridViewrow.Cells[GrdOrd_ColIdExpensaDetalle].Text);
                        expensaId = Convert.ToInt32(Session["ExpensaId"]);

                        _gastosServ.DeleteDetalle(idExpensaDetalle);
                        CargarGrillaGastosOrdinarios();
                        GuardarUltimoTotal(expensaId, Constantes.GetDecimalFromCurrency(lblTotalGastosOrdinarios.Text));
                        CargarTotalGastos();
                        break;

                    case "MODIFICAR":
                        VisualizarGastoFijo(gridViewrow);

                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                ConstantesWeb.MostrarError(ex.Message, this.Page);
            }
        }
Esempio n. 11
0
        protected void grdGastosParticularesOrd_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            GridViewRow gridViewrow;

            ConstantesWeb.MostrarError(string.Empty, this.Page);

            try
            {
                if (e.CommandSource.GetType().ToString().ToUpper().Contains("IMAGEBUTTON"))
                {
                    ImageButton imgButton = (ImageButton)e.CommandSource;
                    gridViewrow = (GridViewRow)imgButton.NamingContainer;
                    string tipo = e.CommandName.ToUpper();

                    switch (tipo)
                    {
                    case "ELIMINAR":
                        var idGasto = int.Parse(gridViewrow.Cells[col_ID_GastoParticular].Text);

                        _pagosNeg.DeleteGastosEvOrdinariosUF(idGasto);

                        CargaGrillaGastosParticularesOrd();
                        var pago = _unidadesFuncServ.GetPago(Session["PagoId"].ToString().ToDecimal());

                        totalesUF.CalcularTotales(pago);
                        txtImporteGastoParticular.Text = pago.ImporteGastoParticular.ToString("0.00");
                        txtDetalleGastoParticular.Text = pago.DetalleGastoParticular;

                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                ConstantesWeb.MostrarError("No se pudo Eliminar el Gasto Particular", this.Page);
            }
        }
Esempio n. 12
0
        protected void btnAceptarModificar_Click(object sender, EventArgs e)
        {
            try
            {
                ConstantesWeb.MostrarError(string.Empty, this.Page);

                DueñosModel dueño = new DueñosModel()
                {
                    ID        = int.Parse(txtCodigoModificar.Text),
                    Nombre    = txtNombreModificar.Text.ToUpper(),
                    Apellido  = txtApellidoModificar.Text.ToUpper(),
                    Direccion = txtDireccionModificar.Text.ToUpper(),
                    Mail      = txtMailModificar.Text.ToUpper(),
                    Telefono  = txtTelefonoModificar.Text,
                };

                _dueñosServ.ModificarDueño(dueño);
                LlenarGrillaDueños();
            }
            catch (Exception ex)
            {
                ConstantesWeb.MostrarError(ex.Message, this.Page);
            }
        }
Esempio n. 13
0
        protected void btnAceptarModificar_Click(object sender, EventArgs e)
        {
            try
            {
                ConstantesWeb.MostrarError(string.Empty, this.Page);

                ProveedoresModel proveedor = new ProveedoresModel()
                {
                    Codigo    = int.Parse(txtCodigoModificar.Text),
                    Nombre    = txtNombreModificar.Text,
                    Direccion = txtDireccionModificar.Text,
                    Mail      = txtMailModificar.Text,
                    Telefono  = txtTelefonoModificar.Text,
                    Tipo      = ddlTipoModificar.Text
                };

                _proveedoresNeg.ModificarProveedor(proveedor);
                LlenarGrillaProveedores();
            }
            catch (Exception ex)
            {
                ConstantesWeb.MostrarError(ex.Message, this.Page);
            }
        }
Esempio n. 14
0
        protected void btnAgregarGastoExt_Click(object sender, EventArgs e)
        {
            #region Validar
            if (txtDetalleGastoEvExt.Text == "")
            {
                ConstantesWeb.MostrarError(Constantes.ErrorFaltaDetalle, this.Page);
                return;
            }
            else if (!txtImporteGastoExtraordinario.Text.IsNumeric())
            {
                ConstantesWeb.MostrarError(Constantes.ErrorFaltaImporte, this.Page);
                return;
            }
            #endregion

            ConstantesWeb.MostrarError(string.Empty, this.Page);

            int     expensaId = Convert.ToInt32(Session["ExpensaId"]);
            int     gastoEvExtraordinarioId = Convert.ToInt32(Session["gastoEvExtraordinarioId"]);
            decimal importeVenta            = txtImporteGastoExtraordinario.Text.ToDecimal();
            decimal importeCompra           = 0;
            decimal proveedorId             = Convert.ToInt32(ddlProveedoresEvExt.SelectedValue);
            string  detalle = txtDetalleGastoEvExt.Text + " - " + Session["direccionConsorcio"] + " - " + Session["Periodo"];

            if (txtImporteCompraGastoEvExt.Enabled == true)
            {
                importeCompra = txtImporteCompraGastoEvExt.Text.ToDecimal();
            }
            else if (txtImporteCompraGastoEvExt.Text == "")
            {
                importeCompra = importeVenta;
            }

            if (btnAgregarGastoEvExt.Text == "Agregar")
            {
                var ctaCteId = proveedorId != 0 ? _proveedoresNeg.AddHaber(importeCompra, proveedorId, Constantes.GastoEvExt, detalle) : 0;
                _expensasServ.AgregarGastoExtraordinario(expensaId, txtDetalleGastoEvExt.Text.ToUpper(), importeVenta, importeCompra, proveedorId, ctaCteId);
            }
            else
            {
                _expensasServ.ModificarGastoExtraordinario(gastoEvExtraordinarioId, txtDetalleGastoEvExt.Text.ToUpper(), importeVenta, importeCompra);

                decimal ProveedorCtaCteId = _expensasServ.GetProveedorCtaCteId(Constantes.GastoEvExt, gastoEvExtraordinarioId);

                //delete ProveedoreCtaCte
                //agregar Haber

                btnAgregarGastoEvExt.Text = "Agregar";
            }

            _expensasServ.ActualizarTotalGastosEvExtraordinarios(expensaId);

            txtDetalleGastoEvExt.Text          = "";
            txtImporteCompraGastoEvExt.Text    = "";
            txtImporteGastoExtraordinario.Text = "";

            CargarGrillaGastosOrdinarios();
            CargarGrillaGastosEvExtraordinarios();
            CargarTotalGastos();
            GuardarUltimoTotal(expensaId, Constantes.GetDecimalFromCurrency(lblTotalGastosOrdinarios.Text));
        }
Esempio n. 15
0
        protected void btnAgregarGastoEvOrd_Click(object sender, EventArgs e)
        {
            #region Validar
            if (txtDetalleGastoEvOrd.Text == "")
            {
                ConstantesWeb.MostrarError(Constantes.ErrorFaltaDetalle, this.Page);
                return;
            }
            else if (!txtImporteEvOrd.Text.IsNumeric())
            {
                ConstantesWeb.MostrarError(Constantes.ErrorFaltaImporte, this.Page);
                return;
            }
            #endregion

            ConstantesWeb.MostrarError(string.Empty, this.Page);

            int     expensaId          = Convert.ToInt32(Session["ExpensaId"]);
            int     gastoEvOrdinarioId = Convert.ToInt32(Session["gastoEvOrdinarioId"]);
            decimal importeVenta       = txtImporteEvOrd.Text.ToDecimal();
            decimal importeCompra      = 0;
            decimal proveedorId        = Convert.ToInt32(ddlProveedoresEvOrd.SelectedValue);
            string  detalle            = txtDetalleGastoEvOrd.Text.ToUpper() + " - " + Session["direccionConsorcio"] + " - " + Session["Periodo"];

            if (txtImporteCompraGastoEvOrd.Enabled == true)
            {
                importeCompra = txtImporteCompraGastoEvOrd.Text.ToDecimal();
            }
            else
            {
                importeCompra = importeVenta;
            }

            if (btnAgregarGastoEvOrd.Text == "Agregar")
            {
                decimal ctaCteId = proveedorId == 0 ? 0 : _proveedoresNeg.AddHaber(importeCompra, proveedorId, Constantes.GastoEvExt, detalle);

                _expensasServ.AgregarGastoEvOrdinario(expensaId, txtDetalleGastoEvOrd.Text.ToUpper(), importeVenta, importeCompra, proveedorId, ctaCteId);
            }
            else
            {
                var proveedorCtaCte_id = _expensasServ.ModificarGastoEvOrdinario(gastoEvOrdinarioId, txtDetalleGastoEvOrd.Text.ToUpper(), txtImporteEvOrd.Text.ToDecimal(), importeCompra, proveedorId);

                if (proveedorCtaCte_id.HasValue)
                {
                    _proveedoresServ.ModificarProveedorCtaCte(proveedorCtaCte_id.Value, detalle, importeCompra, proveedorId);
                }

                btnAgregarGastoEvOrd.Text = "Agregar";
            }

            _expensasServ.ActualizarTotalGastosEvOrdinarios(expensaId);
            txtDetalleGastoEvOrd.Text         = "";
            txtImporteEvOrd.Text              = "";
            txtImporteCompraGastoEvOrd.Text   = "";
            ddlProveedoresEvOrd.SelectedValue = "0";

            CargarGrillaGastosOrdinarios();
            CargarGrillaGastosEvOrdinarios();
            CargarTotalGastos();
        }