Exemple #1
0
 private void frmBuscarFacturas_Load(object sender, EventArgs e)
 {
     if (state == false)
     {
         try
         {
             btnCancelarFactura.Visible = true;
             dgvTabla.DataSource        = FacturacionDB.TodasLasFacturasND();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         try
         {
             dgvTabla.DataSource        = FacturacionDB.TodasLasFacturasND();
             btnCancelarFactura.Visible = false;
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Exemple #2
0
 private void frmCancelacionPago_Load(object sender, EventArgs e)
 {
     if (CodigoFactura != null)
     {
         try
         {
             txtCodigoFactura.Focus();
             dgvFactura.DataSource = FacturacionDB.BuscarfacturasCP(int.Parse(CodigoFactura));
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         try
         {
             dgvFactura.DataSource = FacturacionDB.TodasLasFacturasND();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Exemple #3
0
 private void btnBuscar_Click(object sender, EventArgs e)
 {
     try
     {
         dgvTabla.DataSource = FacturacionDB.TodasLasFacturas(dtpFecha.Value.ToString("yyyy-MM-dd"));
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemple #4
0
 private void btnLimpiar_Click(object sender, EventArgs e)
 {
     Limpiar();
     try
     {
         dgvTabla.DataSource = FacturacionDB.TodasLasFacturasND();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemple #5
0
 private void frmFacturasA_Load(object sender, EventArgs e)
 {
     try
     {
         double GA = Convert.ToDouble(GananciasDB.ObtenerCantidad(DateTime.Today.Date.ToString("yyyy-MM-dd")));
         lblTotalRecaudado.Text = lblTotalRecaudado.Text + " " + "$" + GA.ToString("f2");
         dgvTabla.DataSource    = FacturacionDB.TodasLasFacturas(DateTime.Today.Date.ToString("yyyy-MM-dd"));
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemple #6
0
 private void dtpFecha_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == Convert.ToChar(Keys.Enter))
     {
         try
         {
             dgvTabla.DataSource = FacturacionDB.TodasLasFacturas(dtpFecha.Value.ToString("yyyy-MM-dd"));
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
 }
Exemple #7
0
 private void btnBuscar_Click(object sender, EventArgs e)
 {
     try
     {
         if (txtCodigoFactura.Text == string.Empty)
         {
             MessageBox.Show("Complete el Codigo de la factura", "Cancelacion Pago", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
         else
         {
             int IDF = int.Parse(txtCodigoFactura.Text);
             dgvFactura.DataSource = FacturacionDB.BuscarfacturasCP(IDF);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Cancelacion Pago", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
 }
Exemple #8
0
 private void txtCodigoFactura_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == Convert.ToChar(Keys.Enter))
     {
         try
         {
             if (txtCodigoFactura.Text == string.Empty)
             {
                 MessageBox.Show("Complete el Codigo de la factura", "Cancelacion Pago", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
             int IDF = int.Parse(txtCodigoFactura.Text);
             dgvFactura.DataSource = FacturacionDB.BuscarfacturasCP(IDF);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Cancelacion Pago", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
 }
Exemple #9
0
 private void txtIDFactura_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == Convert.ToChar(Keys.Enter))
     {
         string matricula, precio, codigofa, nombre, apellido, notas, Fecha;
         if (txtApellido.Text == string.Empty)
         {
             apellido = "";
         }
         else
         {
             apellido = " " + txtApellido.Text;
         }
         if (txtIDFactura.Text == string.Empty)
         {
             codigofa = "";
         }
         else
         {
             codigofa = txtIDFactura.Text;
         }
         if (txtMatricula.Text == string.Empty)
         {
             matricula = "";
         }
         else
         {
             matricula = txtMatricula.Text;
         }
         if (txtNombre.Text == string.Empty)
         {
             nombre = "";
         }
         else
         {
             nombre = txtNombre.Text;
         }
         if (txtNotas.Text == string.Empty)
         {
             notas = "";
         }
         else
         {
             notas = txtNotas.Text;
         }
         if (txtPrecio.Text == string.Empty)
         {
             precio = "";
         }
         else
         {
             precio = txtPrecio.Text;
         }
         if (dtpFecha.Value.Date == DateTime.Today.Date)
         {
             Fecha = "";
         }
         else
         {
             Fecha = dtpFecha.Value.Date.ToString("yyyy-MM-dd");
         }
         try
         {
             dgvTabla.DataSource = FacturacionDB.BuscarFacturas1(matricula, nombre + apellido, precio, Fecha, codigofa, notas);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Busqueda de Facturas", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
 }
Exemple #10
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Esta seguro que desea Cancelar el Pago?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
     {
         try
         {
             if (dgvFactura.SelectedRows.Count == 1)
             {
                 int ID;
                 ID = Convert.ToInt32(dgvFactura.CurrentRow.Cells[0].Value);
                 if (FacturacionDB.ObtenerCancelacionPago(ID) == "0")
                 {
                     int      R             = FacturacionDB.CancelarPago(ID, "Cancelado");
                     DateTime FechaFactura  = Convert.ToDateTime(dgvFactura.CurrentRow.Cells[4].Value);
                     int      Matricula     = Convert.ToInt32(dgvFactura.CurrentRow.Cells[1].Value);
                     Decimal  Ganancia      = Convert.ToDecimal(GananciasDB.ObtenerCantidad(FechaFactura.Date.ToString("yyyy-MM-dd")));
                     Decimal  Pago          = Convert.ToDecimal(dgvFactura.CurrentRow.Cells[3].Value);
                     decimal  NuevaGanancia = Ganancia - Pago;
                     int      R0            = GananciasDB.ActualizarGananciasF(FechaFactura.Date.ToString("yyyy-MM-dd"), NuevaGanancia);
                     DateTime FP            = Convert.ToDateTime(EstudianteDB.ObtenerFechaProximoPago(Matricula));
                     string   Modopago      = EstudianteDB.ObtenerModoPago(Matricula);
                     if (Modopago == "Mensual")
                     {
                         DateTime Time   = FP;
                         TimeSpan Tiempo = TimeSpan.FromDays(30);
                         Time = Time.Subtract(Tiempo);
                         int R2 = EstudianteDB.ActualizarProximoPago(Matricula, Time.ToString("yyyy-MM-dd"));
                         Retorno = R2;
                     }
                     else if (Modopago == "Semanal")
                     {
                         DateTime Time   = FP;
                         TimeSpan Tiempo = TimeSpan.FromDays(7);
                         Time = Time.Subtract(Tiempo);
                         int R2 = EstudianteDB.ActualizarProximoPago(Matricula, Time.ToString("yyyy-MM-dd"));
                         Retorno = R2;
                     }
                     if (R > 0 & R0 > 0 & Retorno > 0)
                     {
                         MessageBox.Show("Pago Cancelado!", "Cancelacion Pago", MessageBoxButtons.OK, MessageBoxIcon.Information);
                     }
                     else
                     {
                         MessageBox.Show("Ocurrio un Error", "Cancelacion Pago", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                     }
                 }
                 else
                 {
                     MessageBox.Show("El Pago ya fue Cancelado", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 }
             }
             else
             {
                 MessageBox.Show("Selecciona una factura de la lista", "Cancelacion Pago", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
 }