private void btncp_Click(object sender, EventArgs e) { try { DateTime r; if (Convert.ToDecimal(txtchequep.Text.Replace('.', ',')) > 0 && txtnrochequep.Text != "" && DateTime.TryParse(mskfechacheqep.Text, out r)) { id = id + 1; FormasDePago f = new FormasDePago(id, Convert.ToDecimal(txtchequep.Text.Replace('.', ',')), 0, Convert.ToInt32(cmbcuentap.SelectedValue), Convert.ToDateTime(mskfechacheqep.Text), txtnrochequep.Text, txtcomcheqp.Text, Convert.ToInt32(cmbFormaPago.SelectedValue), 0, 0); lista.Add(f); dataGridView1.DataSource = null; cargalista(); txtchequep.Text = "0.00"; txtnrochequep.Text = ""; mskfechacheqep.Text = ""; txtcomcheqp.Text = ""; } else { MessageBox.Show("Debe completar el nro de cheque y una fecha valida"); } } catch (Exception ex) { id = id - 1; MessageBox.Show(ex.Message); } }
private void btnefect_Click(object sender, EventArgs e) { try { if (Convert.ToDecimal(txtEfectivo.Text.Replace('.', ',')) > 0) { id = id + 1; FormasDePago f = new FormasDePago(id, Convert.ToDecimal(txtEfectivo.Text.Replace('.', ',')), 0, 0, DateTime.Now, "", txtcomefe.Text, Convert.ToInt32(cmbFormaPago.SelectedValue), 0, 0); lista.Add(f); dataGridView1.DataSource = null; cargalista(); txtEfectivo.Text = "0.00"; txtcomefe.Text = ""; } else { MessageBox.Show("El importe debe ser mayor a 0"); } } catch (Exception ex) { id = id - 1; MessageBox.Show(ex.Message); } }
private void btncf_Click(object sender, EventArgs e) { try { int filaseleccionada = Convert.ToInt32(this.dataGridView2.CurrentRow.Index); int idformasdepago = 0; idformasdepago = Convert.ToInt32(dataGridView2[0, filaseleccionada].Value); if (idformasdepago != 0) { id = id + 1; FormasDePago f = new FormasDePago(id, Convert.ToDecimal(dataGridView2[2, filaseleccionada].Value), 0, 0, Convert.ToDateTime(dataGridView2[3, filaseleccionada].Value), dataGridView2[4, filaseleccionada].Value.ToString(), "", Convert.ToInt32(cmbFormaPago.SelectedValue), 0, idformasdepago); lista.Add(f); dataGridView1.DataSource = null; cargalista(); cmbFormaPago_SelectedIndexChanged(sender, e); } } catch (Exception ex) { id = id - 1; MessageBox.Show(ex.Message); } }