Пример #1
0
    protected void lnkEliminarMovimientoCajaYes_OnClick(object sender, EventArgs e)
    {
        int id_caja = Convert.ToInt32(ViewState["ID_CAJA"]);

        MasterBD.eliminarMovimientoCaja(id_caja);

        DateTime fecha1 = Convert.ToDateTime(ViewState["FECHA_INICIAL"]);

        DateTime fecha2 = Convert.ToDateTime(ViewState["FECHA_FINAL"]);

        fecha2.AddHours(23);
        fecha2.AddMinutes(59);
        fecha2.AddSeconds(59);

        int    id_tipo_concepto = Convert.ToInt32(ViewState["ID_TIPO_CONCEPTO"]);
        String concepto         = ViewState["CONCEPTO"].ToString();
        String concepto2        = ddlConceptoListados2.SelectedItem.Text.Trim();

        if (concepto2 == "--LISTAR TODOS--")
        {
            concepto2 = "null";
        }

        String concepto3 = ddlConceptoListados3.SelectedItem.Text.Trim();

        if (concepto3 == "--LISTAR TODOS--")
        {
            concepto3 = "null";
        }

        //DataSet ds = MasterBD.generarListados(fecha1, fecha2, id_tipo_concepto,concepto,concepto2,concepto3);
        DataSet ds = new DataSet();

        gvListados.DataSource = ds.Tables[0];
        gvListados.DataBind();

        divError.Visible             = true;
        divError.Attributes["class"] = "correcto";
        lblError.Text = "El movimiento de caja se ha eliminado correctamente";
        divConfirmacionEliminarMovimientoCaja.Visible = false;

        for (int i = 0; i < gvListados.Rows.Count; i++)
        {
            gvListados.Rows[Convert.ToInt32(i)].Cells[1].BackColor = Color.White;
            gvListados.Rows[Convert.ToInt32(i)].Cells[2].BackColor = Color.White;
            gvListados.Rows[Convert.ToInt32(i)].Cells[3].BackColor = Color.White;
            gvListados.Rows[Convert.ToInt32(i)].Cells[4].BackColor = Color.White;
            gvListados.Rows[Convert.ToInt32(i)].Cells[5].BackColor = Color.White;
            gvListados.Rows[Convert.ToInt32(i)].Cells[6].BackColor = Color.White;
        }
    }
Пример #2
0
    protected void lnkEliminarMovimientoCajaYes_OnClick(object sender, EventArgs e)
    {
        int id_caja = Convert.ToInt32(ViewState["ID_CAJA"]);

        MasterBD.eliminarMovimientoCaja(id_caja);

        DateTime fecha1 = Convert.ToDateTime(ViewState["FECHA_INICIAL"]);

        DateTime fecha2 = Convert.ToDateTime(ViewState["FECHA_FINAL"]);

        fecha2.AddHours(23);
        fecha2.AddMinutes(59);
        fecha2.AddSeconds(59);


        int    id_tipo_concepto = Convert.ToInt32(ViewState["ID_TIPO_CONCEPTO"]);
        String consulta         = ViewState["CONSULTA1"].ToString();
        String consulta2        = ViewState["CONSULTA2"].ToString();


        DataSet ds = MasterBD.generarListados(fecha1, fecha2, id_tipo_concepto, consulta, consulta2);

        gvListados.DataSource = ds.Tables[0];
        gvListados.DataBind();


        if (ds.Tables[1].Rows[0][0].ToString() == "")
        {
            lblRelativoCaja2.Text = "0  €";
        }
        else
        {
            if (Convert.ToDecimal(ds.Tables[1].Rows[0][0].ToString()) < 0)
            {
                lblRelativoCaja2.ForeColor = Color.Red;
            }
            else
            {
                lblRelativoCaja2.ForeColor = Color.Blue;
            }

            lblRelativoCaja2.Text = ds.Tables[1].Rows[0][0].ToString() + "  €";
        }

        if (ds.Tables[2].Rows[0][0].ToString() == "")
        {
            lblTotalCaja2.Text = "0  €";
        }
        else
        {
            if (Convert.ToDecimal(ds.Tables[2].Rows[0][0].ToString()) < 0)
            {
                lblTotalCaja2.ForeColor = Color.Red;
            }
            else
            {
                lblTotalCaja2.ForeColor = Color.Blue;
            }

            lblTotalCaja2.Text = ds.Tables[2].Rows[0][0].ToString() + "  €";
        }


        divError.Visible             = true;
        divError.Attributes["class"] = "correcto";
        lblError.Text = "El movimiento de caja se ha eliminado correctamente";
        divConfirmacionEliminarMovimientoCaja.Visible = false;
    }