Exemple #1
0
 private void dtpFecha_ValueChanged(object sender, EventArgs e)
 {
     try
     {
         string R = GananciasDB.ObtenerTotalIngresos(dtpFecha.Value.ToString("yyyy-MM-dd"));
         if (R != null & R != string.Empty)
         {
             string R1 = GananciasDB.ObtenerCantidad(dtpFecha.Value.ToString("yyyy-MM-dd"));
             double T1 = double.Parse(R1);
             txtTotalIngresos.Text    = T1.ToString("f2");
             txtTotalIngresos.Enabled = false;
             double T = double.Parse(R);
             txtTotalGanancias.Text    = T.ToString("f2");
             txtTotalGanancias.Enabled = false;
             string R0 = GananciasDB.ObtenerDescuentos(dtpFecha.Value.ToString("yyyy-MM-dd"));
             double T0 = double.Parse(R0);
             txtDescuentos.Text = T0.ToString("f2");
         }
         else
         {
             DateTime fecha = dtpFecha.Value;
             double   G     = Double.Parse(GananciasDB.ObtenerCantidad(fecha.Date.ToString("yyyy-MM-dd")));
             txtTotalIngresos.Text    = G.ToString("f2");
             txtTotalIngresos.Enabled = false;
         }
     }
     catch (Exception)
     {
         MessageBox.Show("No se Registraron Ingresos en Ese dia", "Informacion Ingresos", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemple #2
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 #3
0
 private void btnRegistrar_Click(object sender, EventArgs e)
 {
     try
     {
         DateTime FechaA = dtpFecha.Value;
         string   R0     = GananciasDB.ObtenerDescuentos(FechaA.Date.ToString("yyyy-MM-dd"));
         if (R0 != null & R0 != string.Empty)
         {
             double pTotalDescuentos, pTotalGanancias, pTotalIngresos, Descuentos;
             pTotalDescuentos       = Double.Parse(R0);
             Descuentos             = double.Parse(txtDescuentos.Text);
             pTotalDescuentos       = Descuentos + pTotalDescuentos;
             txtDescuentos.Text     = pTotalDescuentos.ToString("f2");
             pTotalIngresos         = double.Parse(txtTotalIngresos.Text);
             pTotalGanancias        = pTotalIngresos - pTotalDescuentos;
             txtTotalGanancias.Text = pTotalGanancias.ToString("f2");
             int R = GananciasDB.RegistrarIngresos(pTotalDescuentos, pTotalGanancias, FechaA.Date.ToString("yyyy-MM-dd"));
             if (R > 0)
             {
                 MessageBox.Show("Registro Exitoso!", "Ganancias", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 MessageBox.Show("No se pudo Registrar, Intentelo Nuevamente", "Ganancias", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             double pTD, pTG, pTI;
             pTI = double.Parse(txtTotalIngresos.Text);
             pTD = double.Parse(txtDescuentos.Text);
             pTG = pTI - pTD;
             int R = GananciasDB.RegistrarIngresos(pTD, pTG, FechaA.Date.ToString("yyyy-MM-dd"));
             if (R > 0)
             {
                 MessageBox.Show("Registro Exitoso!", "Ganancias", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 MessageBox.Show("No se Pudo Registrar, Intentalo Nuevamente", "Ganancias", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            string fecha;

            if (dtpFechaGanancias.Value.Date == DateTime.Today.Date)
            {
                fecha = "";
            }
            else
            {
                fecha = dtpFechaGanancias.Value.Date.ToString("yyyy-MM-dd");
            }
            try
            {
                dgvGanancias.DataSource = GananciasDB.Buscar(fecha);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 private void dtpFechaGanancias_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == Convert.ToChar(Keys.Enter))
     {
         string fecha;
         if (dtpFechaGanancias.Value.Date == DateTime.Today.Date)
         {
             fecha = "";
         }
         else
         {
             fecha = dtpFechaGanancias.Value.Date.ToString("yyyy-MM-dd");
         }
         try
         {
             dgvGanancias.DataSource = GananciasDB.Buscar(fecha);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Exemple #6
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);
         }
     }
 }