Beispiel #1
0
        private void EgresosVarios_Cargar(int idOperacion)
        {
            EgresosWCFClient objEgresoWCF     = new EgresosWCFClient();
            bool?            bloqueado        = null;
            string           mensajeBloqueado = null;

            gsEgresosVarios_BuscarDetalleResult[] lstEgresosVarios_Detalle = null;
            gsEgresosVarios_BuscarCabeceraResult  objEgresosVarios;

            try
            {
                objEgresosVarios = objEgresoWCF.EgresosVarios_Buscar(((Usuario_LoginResult)Session["Usuario"]).idEmpresa,
                                                                     ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, idOperacion, ref bloqueado, ref mensajeBloqueado,
                                                                     ref lstEgresosVarios_Detalle);

                lblSerieNro.Text     = objEgresosVarios.Serie + "-" + objEgresosVarios.NroDocumento;
                lblNomVendedor.Text  = objEgresosVarios.ID_Agenda + "-" + objEgresosVarios.AgendaNombre;
                lblFechaEmision.Text = objEgresosVarios.Vcmto.ToString("dd/MM/yyyy");
                lblMotivo.Text       = objEgresosVarios.NombreDocumento;
                lblFechaInicio.Text  = objEgresosVarios.FechaInicio.ToString("dd/MM/yyyy");
                lblFechaFinal.Text   = objEgresosVarios.Vcmto.ToString("dd/MM/yyyy");

                grdResumen.DataSource = lstEgresosVarios_Detalle.ToList().FindAll(x => x.Estado == 1);;
                grdResumen.DataBind();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void Reporte_Cargar()
        {
            List <gsIndicadorEnvioResult> lstIndicador;

            try
            {
                EgresosWCFClient objReporte = new EgresosWCFClient();



                lstIndicador = objReporte.IndicadorEnvio(((Usuario_LoginResult)Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario).ToList();

                grdIndicador.DataSource = lstIndicador;
                grdIndicador.DataBind();

                lblMensaje.Text     = "Se han encontrado " + lstIndicador.Count.ToString() + " registro.";
                lblMensaje.CssClass = "mensajeExito";

                ViewState["lstIndicador"] = JsonHelper.JsonSerializer(lstIndicador);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #3
0
        private void EgresosVarios_Listar(string idAgenda, DateTime fechaInicio, DateTime fechaFinal)
        {
            EgresosWCFClient objEgresosWCF;

            try {
                objEgresosWCF = new EgresosWCFClient();
                grdEgresosVarios.DataSource = objEgresosWCF.EgresosVarios_ListarCajaChica(((Usuario_LoginResult)Session["Usuario"]).idEmpresa,
                                                                                          ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, idAgenda, fechaInicio, fechaFinal);
                grdEgresosVarios.DataBind();
            }
            catch (Exception ex) {
                throw ex;
            }
        }
Beispiel #4
0
        protected void grdEgresosVarios_DeleteCommand(object sender, GridCommandEventArgs e)
        {
            if (Session["Usuario"] == null)
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "CancelEdit();", true);
            }

            EgresosWCFClient objEgresosWCF = new EgresosWCFClient();

            try
            {
                objEgresosWCF.EgresosVarios_Eliminar(((Usuario_LoginResult)Session["Usuario"]).idEmpresa,
                                                     ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, Convert.ToInt32(((GridDataItem)e.Item).GetDataKeyValue("Op")));
                EgresosVarios_Listar(((Usuario_LoginResult)Session["Usuario"]).nroDocumento, dpFechaInicio.SelectedDate.Value, dpFechaFinal.SelectedDate.Value);
            }
            catch (Exception ex)
            {
                lblMensaje.Text     = "ERROR: " + ex.Message;
                lblMensaje.CssClass = "mensajeError";
            }
        }
        protected void btnGuardar_Click(object sender, EventArgs e)
        {
            if (Session["Usuario"] == null)
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "CancelEdit();", true);
            }

            try
            {
                EgresosWCFClient objEgresoWCF = new EgresosWCFClient();
                if (cboMoneda.SelectedIndex < 0)
                {
                    throw new ArgumentException("Se debe seleccionar un tipo de moneda.");
                }

                if (txtConcepto.Text.Length <= 0)
                {
                    throw new ArgumentException("Se debe especificar el concepto general de los gastos.");
                }

                if (grdRecibos.Items.Count <= 0)
                {
                    throw new ArgumentException("Se debe ingresar un documento de egreso.");
                }

                objEgresoWCF.EgresosVarios_Registrar(((Usuario_LoginResult)Session["Usuario"]).idEmpresa,
                                                     ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, EgresosVarios_Obtener(),
                                                     JsonHelper.JsonDeserialize <List <gsEgresosVarios_BuscarDetalleResult> >((string)ViewState["lstEVDetalle"]).ToArray());

                ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "CloseAndRebind();", true);
            }
            catch (Exception ex)
            {
                lblMensaje.Text     = "ERROR: " + ex.Message;
                lblMensaje.CssClass = "mensajeError";
            }
        }
        private void EgresosVarios_Cargar(int idOperacion)
        {
            EgresosWCFClient objEgresoWCF     = new EgresosWCFClient();
            bool?            bloqueado        = null;
            string           mensajeBloqueado = null;

            gsEgresosVarios_BuscarDetalleResult[] lstEgresosVarios_Detalle = null;
            gsEgresosVarios_BuscarCabeceraResult  objEgresosVarios;

            try {
                if (idOperacion != 0)
                {
                    objEgresosVarios = objEgresoWCF.EgresosVarios_Buscar(((Usuario_LoginResult)Session["Usuario"]).idEmpresa,
                                                                         ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, idOperacion, ref bloqueado, ref mensajeBloqueado,
                                                                         ref lstEgresosVarios_Detalle);
                    if ((bool)bloqueado)
                    {
                        throw new ArithmeticException(mensajeBloqueado);
                    }

                    lblIDAgenda.Text              = objEgresosVarios.ID_Agenda;
                    txtNroDoc.Text                = objEgresosVarios.NroDocumento;
                    txtNombre.Text                = objEgresosVarios.AgendaNombre;
                    dpFecRegistro.SelectedDate    = objEgresosVarios.Fecha;
                    dpFecVencimiento.SelectedDate = objEgresosVarios.Vcmto;
                    cboMoneda.SelectedValue       = objEgresosVarios.ID_Moneda.ToString();
                    txtConcepto.Text              = objEgresosVarios.Concepto;
                    txtSerie.Text  = objEgresosVarios.Serie;
                    txtNumero.Text = objEgresosVarios.Numero.ToString();
                    cboCentroCosto.SelectedValue = objEgresosVarios.ID_CCosto;
                    cboUnidGestion.SelectedValue = objEgresosVarios.ID_UnidadGestion;
                    cboUnidProy.SelectedValue    = objEgresosVarios.ID_UnidadProyecto;
                    cboNatGasto.SelectedValue    = objEgresosVarios.ID_NaturalezaGastoIngreso;

                    ViewState["objEVCabecera"] = JsonHelper.JsonSerializer(objEgresosVarios);
                    ViewState["lstEVDetalle"]  = JsonHelper.JsonSerializer(lstEgresosVarios_Detalle.ToList());

                    lblTotal.Text = "Total: " + lstEgresosVarios_Detalle.ToList().AsEnumerable().Sum(x => x.Importe).ToString();

                    grdRecibos.DataSource = lstEgresosVarios_Detalle.ToList().FindAll(x => x.Estado == 1);;
                    grdRecibos.DataBind();
                }
                else
                {
                    txtNroDoc.Text = ((Usuario_LoginResult)Session["Usuario"]).nroDocumento;
                    txtNombre.Text = ((Usuario_LoginResult)Session["Usuario"]).nombres.ToUpper();

                    objEgresosVarios              = new gsEgresosVarios_BuscarCabeceraResult();
                    objEgresosVarios.Op           = idOperacion;
                    objEgresosVarios.ID_Agenda    = ((Usuario_LoginResult)Session["Usuario"]).nroDocumento;
                    objEgresosVarios.AgendaNombre = ((Usuario_LoginResult)Session["Usuario"]).nombres;
                    ViewState["objEVCabecera"]    = JsonHelper.JsonSerializer(objEgresosVarios);
                    ViewState["lstEVDetalle"]     = JsonHelper.JsonSerializer(new List <gsEgresosVarios_BuscarDetalleResult>());

                    lblTotal.Text = "Total: 0.00";

                    grdRecibos.DataSource = lstEgresosVarios_Detalle;
                    grdRecibos.DataBind();
                }
            }
            catch (Exception ex) {
                throw ex;
            }
        }