//------------------------ private void btnPasTra_Click(object sender, EventArgs e) { if (txtIdTra.Text == "" && txtDesTra.Text == "" && txtPreTra.Text == "" && nudCan.Value.ToString() == "0") { MessageBox.Show("Seleccione al menos un tratamiento"); } else if (nudCan.Value.ToString() == "0") { MessageBox.Show("La cantidad debe ser mayor a 0"); } else if (txtPiezas.Text == "") { MessageBox.Show("Indique pieza(s) tratada(s)"); } else { clsDetalleBoleta reg = lstDetBol.Find(i => i.Tratamiento == txtDesTra.Text); if (reg == null) { reg = new clsDetalleBoleta(); reg.IdDetalle = numboldet++; reg.Tratamiento = txtDesTra.Text; reg.Cantidad = int.Parse(nudCan.Value.ToString()); reg.Piezas = txtPiezas.Text; reg.PrecioUnitario = double.Parse(txtPreTra.Text); lstDetBol.Add(reg); //Acumuladores subtotal += reg.Subtotal; igv += reg.Igv; total += reg.Total; //Impresion totales txtSubtotalCab.Text = subtotal.ToString(); txtIgvCab.Text = igv.ToString(); txtTotalCab.Text = total.ToString(); CargarGrilla(); nudCan.Value = 0; txtPiezas.Text = ""; } } }
private void btnQuiTra_Click(object sender, EventArgs e) { clsDetalleBoleta reg = lstDetBol.Find(i => i.Tratamiento == txtDesTra.Text); if (reg != null) { lstDetBol.Remove(reg); subtotal -= reg.Subtotal; igv -= reg.Igv; total -= reg.Total; //Impresion totales txtSubtotalCab.Text = subtotal.ToString(); txtIgvCab.Text = igv.ToString(); txtTotalCab.Text = total.ToString(); CargarGrilla(); nudCan.Value = 0; txtPiezas.Text = ""; } }