protected void grvnotaabono_RowCommand(object sender, GridViewCommandEventArgs e) { int fila = Convert.ToInt32(e.CommandArgument); int idabono = Convert.ToInt32(grvnotaabono.Rows[fila].Cells[0].Text); if (e.CommandName == "Eliminar") { NotaAbonoDAO db = new NotaAbonoDAO(); db.Eliminar(idabono); cargar(); string script = "openModal();"; ScriptManager.RegisterStartupScript(this, typeof(Page), "correcto", script, true); } else if (e.CommandName == "Modificar") { int id = Convert.ToInt32(grvnotaabono.Rows[fila].Cells[0].Text); Response.Redirect("ModNotaAbono.aspx?IDMP=" + id, true); } else if (e.CommandName == "Imprimir") { string ID = grvnotaabono.Rows[fila].Cells[0].Text; string sRuta = "Reportes/frmNotaAbono.aspx?Id=" + ID; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Window1", "<script> window.open('" + sRuta + "');</script>", false); } }
protected void btnguardar_Click(object sender, EventArgs e) { if (txtmonto.Text != "") { Model.Enity.NotaAbono nt = new Model.Enity.NotaAbono(); nt.Id_Abono = Convert.ToInt32(Request.QueryString["IDMP"]); nt.Id_Cliente = Convert.ToInt32(ddlcliente.SelectedValue); nt.Monto = Math.Round(Convert.ToDecimal(txtmonto.Text), 2); nt.Id_vendedor = Convert.ToInt32(txtvendedor.Text); nt.Numero_Abono = txtnumeroabono.Text; string nota = txtnota.Text; string estado = ddlestado.SelectedValue; if (estado == "3") { nt.Montoac = Math.Round(Convert.ToDecimal(txtmontoac.Text), 2); } else { nt.Montoac = 0.00m; } nt.id_estado = Convert.ToInt32(ddlestado.SelectedValue); nt.estado = ddlestado.SelectedItem.Text; nt.Fecha = txtfecha.Text; NotaAbonoDAO ntdao = new NotaAbonoDAO(); ntdao.ActualizarNotaAbono(nt, nota); Response.Redirect("ManteNotaAbonoAdmin.aspx", true); } else { txtmensaje.Text = "Debe llenar todos los campos."; string script = "openModal();"; ScriptManager.RegisterStartupScript(this, typeof(Page), "error", script, true); } }
private void cargar() { NotaAbonoDAO nt = new NotaAbonoDAO(); int id = Convert.ToInt32(Request.QueryString["IDMP"]); System.Data.DataSet ds = nt.BuscarNotaAbono(id); DataTable dtnota = ds.Tables[0]; string idzona = dtnota.Rows[0]["IdZona"].ToString(); cargarmercado(idzona); txtnumeroabono.Text = dtnota.Rows[0]["Numero_Abono"].ToString(); ddlmercado.SelectedValue = Convert.ToString(dtnota.Rows[0]["IdMercado"]); txtdireccion.Text = Convert.ToString(dtnota.Rows[0]["Direccion"]); txtfecha.Text = Convert.ToDateTime(dtnota.Rows[0]["Fecha"]).ToString("yyyy-MM-dd"); txtmonto.Text = dtnota.Rows[0]["Monto"].ToString(); txtnota.Text = dtnota.Rows[0]["Nota"].ToString(); txtvendedor.Text = dtnota.Rows[0]["Id_vendedor"].ToString(); if (dtnota.Rows[0]["id_estado"].ToString() != null) { ddlestado.SelectedValue = dtnota.Rows[0]["id_estado"].ToString(); if (ddlestado.SelectedValue == "3") { lblmonto.Visible = true; txtmontoac.Visible = true; txtmontoac.Text = dtnota.Rows[0]["Montoac"].ToString(); } } string idmer = ddlmercado.SelectedValue; Util.Helper.ListarClientesxMerZon(ddlcliente, idmer); ddlcliente.SelectedValue = Convert.ToString(dtnota.Rows[0]["Id_cliente"]); }
private void cargar() { //Util.Helper.ListarClientes(ddlcliente); NotaAbonoDAO db = new NotaAbonoDAO(); int usuario = Convert.ToInt32(Session["IDUsuario"].ToString()); grvnotaabono.DataSource = db.ListarAbono(usuario); grvnotaabono.DataBind(); }
protected void btnbuscar_Click(object sender, EventArgs e) { string fi = txtfi.Text; string ff = txtff.Text; string id = ddlcliente.SelectedValue; NotaAbonoDAO nota = new NotaAbonoDAO(); grvnotaabono.DataSource = nota.BuscarNotaAbonoxfecha(fi, ff, id); grvnotaabono.DataBind(); }
private void cargar() { Util.Helper.ListarClientes(ddlcliente); NotaAbonoDAO db = new NotaAbonoDAO(); txtfi.Text = DateTime.Now.ToString("yyyy-MM-dd"); txtff.Text = DateTime.Now.ToString("yyyy-MM-dd"); grvnotaabono.DataSource = db.BuscarNotaAbonoxfecha(txtfi.Text, txtff.Text, "0"); grvnotaabono.DataBind(); }
protected void grvnotaabono_RowCommand(object sender, GridViewCommandEventArgs e) { int fila = Convert.ToInt32(e.CommandArgument); int idabono = Convert.ToInt32(grvnotaabono.Rows[fila].Cells[0].Text); if (e.CommandName == "Eliminar") { NotaAbonoDAO db = new NotaAbonoDAO(); //db.Eliminar(idmer); cargar(); string script = "openModal();"; ScriptManager.RegisterStartupScript(this, typeof(Page), "correcto", script, true); } else if (e.CommandName == "Modificar") { int id = Convert.ToInt32(grvnotaabono.Rows[fila].Cells[0].Text); Response.Redirect("ModNotaAbono.aspx?IDMP=" + id, true); } }
protected void txtnumero_TextChanged(object sender, EventArgs e) { NotaAbonoDAO pd = new NotaAbonoDAO(); string numero = txtnumero.Text; numero = numero.PadLeft(8, '0'); string id = Request.QueryString["cl"].ToString(); System.Data.DataSet ds = pd.BuscarNotaAbonoxnumeroxcliente(numero, id); DataTable dt = ds.Tables[0]; int can = dt.Rows.Count; if (can > 0) { int pago = Convert.ToInt32(dt.Rows[0]["id_estado"]); if (pago != 2 && pago != 0) { txtfecha2.Text = dt.Rows[0]["Fecha"].ToString(); txtid.Text = dt.Rows[0]["Id_Abono"].ToString(); if (pago == 1) { txtacuenta2.Text = dt.Rows[0]["Monto"].ToString(); } else { txtacuenta2.Text = dt.Rows[0]["Montoac"].ToString(); } } else { txtmensaje.Text = "La nota de abono no ha sido cancelada."; string script = "openModal();"; ScriptManager.RegisterStartupScript(this, typeof(Page), "error", script, true); } } else { txtmensaje.Text = "La nota de abono no esta registrada para este cliente."; string script = "openModal();"; ScriptManager.RegisterStartupScript(this, typeof(Page), "error", script, true); } }
protected void btnguardar_Click(object sender, EventArgs e) { if (txtmonto.Text != "") { Model.Enity.NotaAbono nt = new Model.Enity.NotaAbono(); nt.Id_Cliente = Convert.ToInt32(ddlcliente.SelectedValue); nt.Monto = Convert.ToInt32(txtmonto.Text); nt.Id_vendedor = Convert.ToInt32(Session["IDUsuario"].ToString()); nt.Fecha = txtfecha.Text; string nota = txtnota.Text; NotaAbonoDAO ntdao = new NotaAbonoDAO(); ntdao.InsertarNotaAbono(nt, nota); Response.Redirect("ManteNotaAbono.aspx", true); } else { txtmensaje.Text = "Debe llenar todos los campos."; string script = "openModal();"; ScriptManager.RegisterStartupScript(this, typeof(Page), "error", script, true); } }