protected void grdCobranza_ItemCommand(object sender, GridCommandEventArgs e)
        {
            if (Session["Usuario"] == null)
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "CancelEdit();", true);
            }

            if (!ConnectionHelpers.CheckForInternetConnection())
            {
                throw new ArgumentException("ERROR: Revisar su conexión a internet.");
            }

            string mensaje = "";

            lblMensaje.Text = "";

            try
            {
                if (e.CommandName == "Eliminar")
                {
                    if (ValidarValores(ref mensaje) == false)
                    {
                        int id_proyectado = 0;
                        id_proyectado = int.Parse(e.CommandArgument.ToString());

                        string obj = Request.QueryString["objDocumento"];

                        char     delimiter  = '}';
                        string[] arryString = Request.QueryString["objDocumento"].Split(delimiter);
                        arryString[0] = arryString[0] + "}";
                        arryString[1] = arryString[1].Substring(1, 6);
                        string fecha = arryString[1];

                        gsReporte_EstadoCuenta_BIResult objDocumento = JsonHelper.JsonDeserialize <gsReporte_EstadoCuenta_BIResult>(arryString[0]);


                        CobranzasWCFClient objCobranzaWCF = new CobranzasWCFClient();
                        objCobranzaWCF.ProyectadoCobranza_Eliminar(
                            ((Usuario_LoginResult)Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, id_proyectado);


                        Proyeccion_Sectorista(0, fecha, 0, objDocumento.Origen, (int)objDocumento.OrigenOp, 1);

                        lblMensaje.Text     = "Se eliminó el registro.";
                        lblMensaje.CssClass = "mensajeExito";
                    }
                    else
                    {
                        lblMensaje.Text     = mensaje;
                        lblMensaje.CssClass = "mensajeError";
                    }
                }
            }
            catch (Exception ex)
            {
                lblMensaje.Text     = ex.Message;
                lblMensaje.CssClass = "mensajeError";
            }
        }
示例#2
0
        protected void btnAgregar_Click(object sender, EventArgs e)
        {
            CobranzasWCFClient objCobranzaWCF = new CobranzasWCFClient();
            int    id_proyectado = 0, id_semana = 0, id_estatus = 0;
            string periodo = "", mensaje = "", mes;

            if (Session["Usuario"] == null)
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "CancelEdit();", true);
            }

            try
            {
                if (ValidarValores(ref mensaje) == false)
                {
                    if (!string.IsNullOrEmpty(txtImporte.Text) || (txtImporte.Text != ""))
                    {
                        string semanaMng = ViewState["id_semana"].ToString();
                        string semanaCbo = cboSemana.SelectedValue.ToString();

                        if (semanaMng != semanaCbo)
                        {
                            Maximno            = (float)ViewState["Maximno"];
                            Acumulado          = (float)ViewState["Acumulado"];
                            Saldo              = Maximno - Acumulado;
                            ViewState["Saldo"] = Saldo;
                        }


                        char     delimiter  = '}';
                        string[] arryString = Request.QueryString["objDocumento"].Split(delimiter);
                        arryString[0] = arryString[0] + "}";
                        arryString[1] = arryString[1].Substring(1, 6);

                        gsReporte_EstadoCuenta_BIResult objDocumento = JsonHelper.JsonDeserialize <gsReporte_EstadoCuenta_BIResult>(arryString[0]);
                        string fecha = arryString[1];

                        id_semana = int.Parse(cboSemana.SelectedValue);
                        float  Importe     = float.Parse(txtImporte.Text);
                        string TablaOrigen = objDocumento.Origen;
                        int    OpOrigen    = (int)objDocumento.OrigenOp;

                        periodo = arryString[1];

                        Saldo = (float)ViewState["Saldo"];
                        if (Importe <= Saldo)
                        {
                            objCobranzaWCF.ProyectarCobranza_Registrar(((Usuario_LoginResult)Session["Usuario"]).idEmpresa, ((Usuario_LoginResult)Session["Usuario"]).codigoUsuario, id_proyectado, periodo, id_semana, Importe, TablaOrigen, OpOrigen, 1);

                            LimpiarValores();
                            Proyeccion_Sectorista(id_proyectado, periodo, 0, objDocumento.Origen, (int)objDocumento.OrigenOp, 1);
                            PeriodoSemana_cargar();
                            lblMaximo.CssClass = "mensajeExito";
                        }
                        else
                        {
                            lblMensaje.Text     = "Ingresar un importe igual o menor a " + ViewState["Saldo"];
                            lblMensaje.CssClass = "mensajeError";
                        }
                    }
                    else
                    {
                        throw new ArgumentException("ERROR: Se debe ingresar una Observación. ");
                    }
                }
                else
                {
                    lblMensaje.Text     = "ERROR: " + mensaje;
                    lblMensaje.CssClass = "mensajeError";
                }
            }
            catch (Exception ex)
            {
                lblMensaje.Text     = "ERROR: " + ex.Message;
                lblMensaje.CssClass = "mensajeError";
            }
        }
示例#3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Usuario"] == null)
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "mykey", "CancelEdit();", true);
            }

            try
            {
                if (!Page.IsPostBack)
                {
                    if (Request.QueryString["objDocumento"] != "" || Request.QueryString["objDocumento"] != null)
                    {
                        string obj = Request.QueryString["objDocumento"];

                        char     delimiter  = '}';
                        string[] arryString = Request.QueryString["objDocumento"].Split(delimiter);
                        arryString[0] = arryString[0] + "}";
                        arryString[1] = arryString[1].Substring(1, 6);

                        gsReporte_EstadoCuenta_BIResult objDocumento = JsonHelper.JsonDeserialize <gsReporte_EstadoCuenta_BIResult>(arryString[0]);

                        Title = "Planificación de Cobranza";

                        lblDocumento.Text = objDocumento.TipoDocumento;
                        lblNumero.Text    = objDocumento.NroDocumento;

                        lblImporte.Text = string.Format("{0:#,##0.##}", Convert.ToDouble(objDocumento.ImportePendiente.ToString()));


                        lblMoneda.Text        = objDocumento.monedasigno;
                        lblMonedaImporte.Text = objDocumento.monedasigno;

                        Maximno = (float)objDocumento.ImportePendiente;
                        ViewState["Maximno"] = Maximno;

                        Semana_cargar(cboSemana);
                        string fecha = arryString[1];

                        DateTime FechaD;
                        string   year = fecha.Substring(0, 4);
                        string   mes  = fecha.Substring(4, 2);
                        FechaD = DateTime.Parse(year + "/" + mes + "/" + "01");

                        rmyReporte.SelectedDate = FechaD;

                        Proyeccion_Sectorista(0, fecha, 0, objDocumento.Origen, (int)objDocumento.OrigenOp, 1);

                        PeriodoSemana_cargar();

                        lblMensaje.Text     = "Listo para mostrar planificación de sectorista";
                        lblMensaje.CssClass = "mensajeExito";

                        rmyReporte.DateInput.ReadOnly      = true;
                        rmyReporte.DatePopupButton.Enabled = false;
                    }
                }
            }
            catch (Exception ex)
            {
                lblMensaje.Text     = "ERROR: " + ex.Message;
                lblMensaje.CssClass = "mensajeError";
            }
        }