Esempio n. 1
0
        private void btnAnular_Click(object sender, EventArgs e)
        {
            if (Grilla.CurrentRow.Cells[8].Value.ToString() == "")
            {
                MessageBox.Show("Debe seleccionar una cobranza para continuar", Clases.cMensaje.Mensaje());
                return;
            }

            if (txtCodCobranza.Text =="")
            {
                MessageBox.Show ("Debe ingresar una cobranza",Clases.cMensaje.Mensaje ());
                return;
            }

            Int32 CodCobranza = Convert.ToInt32 (txtCodCobranza.Text);

            Clases.cFunciones fun = new Clases.cFunciones ();
            double Importe = fun.ToDouble(Grilla.CurrentRow.Cells[8].Value.ToString());
            Clases.cCobranza cob = new Clases.cCobranza();
            cob.AnularCobranza(CodCobranza);
            string Descripcion = "ANULACION DE COBRANZA " + txtPatente.Text;
            Clases.cPunitorioCobranza objPun = new Clases.cPunitorioCobranza(); 
            Double Punitorio = objPun.GetImportePunitorio(CodCobranza);
            objPun.BorrarPunitorio(CodCobranza);
           // Importe = Importe + Punitorio;
            Clases.cMovimiento mov = new Clases.cMovimiento();
            mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, -1 * Importe, 0, 0, 0, 0, Convert.ToDateTime(txtFecha.Text), Descripcion);
            //anulo punitorio
            Descripcion = "ANULACION DE PUNITORIO " + txtPatente.Text;
            mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, -1 * Punitorio , 0, 0, 0, 0, Convert.ToDateTime(txtFecha.Text), Descripcion);
            CargarGrilla();
            MessageBox.Show("Datos grabados correctamente", Clases.cMensaje.Mensaje());
        }
Esempio n. 2
0
 private void btnPagarSaldo_Click(object sender, EventArgs e)
 {
     Clases.cFunciones fun = new Clases.cFunciones();
     if (fun.ValidarFecha(txtFecha.Text) == false)
     {
         MessageBox.Show("La fecha ingresada es incorrecta.", Clases.cMensaje.Mensaje());
         return;
     }
     if (txtSaldo.Text != "")
     {
         double saldo = fun.ToDouble(txtSaldo.Text);
         if (saldo == 0)
         {
             MessageBox.Show("El saldo ya ha sido cancelado", Clases.cMensaje.Mensaje());
             return;
         }
         Int32  CodCobranza = Convert.ToInt32(txtCodCobranza.Text);
         double Importe     = fun.ToDouble(txtImporte.Text);
         if (Importe > saldo)
         {
             MessageBox.Show("El saldo supera el saldo", Clases.cMensaje.Mensaje());
             return;
         }
         Clases.cSaldoCobranza saldoCob = new Clases.cSaldoCobranza();
         DateTime         Fecha         = Convert.ToDateTime(txtFecha.Text);
         Clases.cCobranza cob           = new Clases.cCobranza();
         cob.PagarSaldo(CodCobranza, Fecha, Importe);
         string             Descripcion = "PAGO DE SALDO PATENTE " + txtPatente.Text;
         Clases.cMovimiento mov         = new Clases.cMovimiento();
         mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, Importe, 0, 0, 0, 0, Fecha, Descripcion);
         saldoCob.InsertarSaldoCob(CodCobranza, Fecha, Importe);
         Double Punitorio = 0;
         if (txtPunitorio.Text != "")
         {
             Punitorio = fun.ToDouble(txtPunitorio.Text);
         }
         Int32 CodVenta = Convert.ToInt32(Grilla.CurrentRow.Cells[1].Value.ToString());
         if (Punitorio > 0)
         {
             Clases.cPunitorioCobranza objPunitorio = new Clases.cPunitorioCobranza();
             Descripcion = "COBRO DE PUNITORIO, PATENTE " + txtPatente.Text;
             objPunitorio.GrabarPunitorio(CodVenta, CodCobranza, Punitorio, Fecha);
             mov.RegistrarMovimientoDescripcion(CodVenta, Principal.CodUsuarioLogueado, Punitorio, 0, 0, 0, 0, Fecha, Descripcion);
         }
         MessageBox.Show("Datos grabados correctamente", Clases.cMensaje.Mensaje());
     }
 }
Esempio n. 3
0
        private void Grilla_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            Clases.cFunciones fun = new Clases.cFunciones();
            if (Grilla.CurrentRow == null)
            {
                return;
            }
            txtImporte.Text = Grilla.CurrentRow.Cells[2].Value.ToString();
            txtTope.Text    = Grilla.CurrentRow.Cells[2].Value.ToString();
            string Saldo = Grilla.CurrentRow.Cells[9].Value.ToString();

            txtCodCobranza.Text = Grilla.CurrentRow.Cells[0].Value.ToString();
            Int32 CodCobranza = Convert.ToInt32(Grilla.CurrentRow.Cells[0].Value.ToString());

            Clases.cPunitorioCobranza objPun = new Clases.cPunitorioCobranza();
            Double Punitorio = objPun.GetImportePunitorio(CodCobranza);

            txtPunitorio.Text = Punitorio.ToString();
            if (Punitorio > 0)
            {
                txtPunitorio.Text = fun.FormatoEnteroMiles(txtPunitorio.Text);
            }
            else
            {
                txtPunitorio.Text = "0";
            }
            if (Saldo.Trim() == "")
            {
                Saldo = txtImporte.Text;
            }

            if (Grilla.CurrentRow.Cells[4].Value.ToString() == "")
            {
                btnAnular.Enabled     = false;
                btnGrabar.Enabled     = true;
                btnPagarSaldo.Visible = false;
            }
            else
            {
                btnAnular.Enabled     = true;
                btnGrabar.Enabled     = false;
                btnPagarSaldo.Visible = true;
            }

            txtSaldo.Text = Saldo;
        }
Esempio n. 4
0
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            Clases.cFunciones fun = new Clases.cFunciones();
            if (Grilla.Rows.Count < 2)
            {
                MessageBox.Show("Debe ingresar un registro para continuar", Clases.cMensaje.Mensaje());
                return;
            }

            if (Grilla.CurrentRow == null)
            {
                MessageBox.Show("Debe ingresar un registro para continuar", Clases.cMensaje.Mensaje());
                return;
            }

            if (txtFecha.Text == "")
            {
                MessageBox.Show("Debe ingresar una fecha para continuar.", Clases.cMensaje.Mensaje());
                return;
            }

            if (fun.ValidarFecha(txtFecha.Text) == false)
            {
                MessageBox.Show("La fecha ingresada es incorrecta.", Clases.cMensaje.Mensaje());
                return;
            }

            Int32 CodCobranza = Convert.ToInt32(Grilla.CurrentRow.Cells[0].Value.ToString());
            //Double Importe = fun.ToDouble(Grilla.CurrentRow.Cells[2].Value.ToString());
            double Tope      = fun.ToDouble(txtTope.Text);
            double Importe   = fun.ToDouble(txtImporte.Text);
            double Saldo     = fun.ToDouble(txtSaldo.Text);
            Double Punitorio = 0;

            if (txtPunitorio.Text != "")
            {
                Punitorio = fun.ToDouble(txtPunitorio.Text);
            }
            if (Importe > Tope)
            {
                MessageBox.Show("El importe ingresado supera el monto total", Clases.cMensaje.Mensaje());
                return;
            }

            Saldo = Tope - Importe;

            string   Descripcion = "REGISTRO DE COBRANZA PATENTE " + txtPatente.Text;
            Int32    CodVenta    = Convert.ToInt32(Grilla.CurrentRow.Cells[1].Value.ToString());
            DateTime Fecha       = Convert.ToDateTime(txtFecha.Text);

            Clases.cCobranza cobranza = new Clases.cCobranza();
            cobranza.RegistrarCobranza(CodCobranza, txtFecha.Text, Importe, Saldo);
            Clases.cMovimiento        mov          = new Clases.cMovimiento();
            Clases.cPunitorioCobranza objPunitorio = new Clases.cPunitorioCobranza();
            //Importe = Importe + Punitorio;
            mov.RegistrarMovimientoDescripcion(CodVenta, Principal.CodUsuarioLogueado, Importe, ((-1) * Importe), 0, 0, 0, Fecha, Descripcion);
            Clases.cSaldoCobranza saldoCob = new Clases.cSaldoCobranza();
            saldoCob.InsertarSaldoCob(CodCobranza, Fecha, Importe);
            if (Punitorio > 0)
            {
                Descripcion = "COBRO DE PUNITORIO, PATENTE " + txtPatente.Text;
                objPunitorio.GrabarPunitorio(CodVenta, CodCobranza, Punitorio, Fecha);
                mov.RegistrarMovimientoDescripcion(CodVenta, Principal.CodUsuarioLogueado, Punitorio, 0, 0, 0, 0, Fecha, Descripcion);
            }

            MessageBox.Show("Datos grabados correctamente", Clases.cMensaje.Mensaje());
            CargarGrilla();
        }
Esempio n. 5
0
        private void GetGanancia()
        {
            Clases.cFunciones         fun                  = new Clases.cFunciones();
            Clases.cVenta             objVenta             = new Clases.cVenta();
            Clases.cPunitorioCobranza objPunitorioCobranza = new Clases.cPunitorioCobranza();
            Clases.cPunitorioCuota    objPunitorioCuota    = new Clases.cPunitorioCuota();
            DateTime  FechaDesde = Convert.ToDateTime(txtFechaDesde.Text);
            DateTime  FechaHasta = Convert.ToDateTime(txtFechaHasta.Text);
            DataTable trdo       = objVenta.GetVentasxFecha(FechaDesde, FechaHasta, "", null);

            Clases.cPreVenta objPreVenta = new Clases.cPreVenta();
            DataTable        trdo2       = objPreVenta.GetPreVentasxFecha(FechaDesde, FechaHasta, "", null);
            //le agre[g
            string Dato      = "";
            Int32  PosPintar = 0;

            PosPintar = trdo.Rows.Count;
            for (int i = 0; i < trdo2.Rows.Count; i++)
            {
                DataRow fila;
                fila = trdo.NewRow();
                for (int j = 0; j < trdo2.Columns.Count; j++)
                {
                    Dato    = trdo2.Rows[i][j].ToString();
                    fila[j] = Dato;
                }
                trdo.Rows.Add(fila);
            }
            Clases.cPunitorioCuotasAnteriores objPunDocAnt = new Clases.cPunitorioCuotasAnteriores();
            Int32 Cant = trdo.Rows.Count;

            txtCantidad.Text = Cant.ToString();
            trdo             = fun.TablaaMiles(trdo, "ImporteVenta");
            trdo             = fun.TablaaMiles(trdo, "ImporteEfectivo");
            trdo             = fun.TablaaMiles(trdo, "ImporteAutoPartePago");
            trdo             = fun.TablaaMiles(trdo, "ImporteCredito");
            trdo             = fun.TablaaMiles(trdo, "ImportePrenda");
            trdo             = fun.TablaaMiles(trdo, "Cheque");
            trdo             = fun.TablaaMiles(trdo, "ImporteCobranza");
            trdo             = fun.TablaaMiles(trdo, "Ganancia");
            double Utilidad = fun.TotalizarColumna(trdo, "Ganancia");
            Double ImportePunitorioCobranza        = objPunitorioCobranza.GetImportexFecha(FechaDesde, FechaHasta);
            Double ImportePunitorioCuota           = objPunitorioCuota.GetImportexFecha(FechaDesde, FechaHasta);
            Double ImportePunitorioCuotasAnterioes = objPunDocAnt.GetImportexFecha(FechaDesde, FechaHasta);
            Double TotalPunitorio = ImportePunitorioCobranza + ImportePunitorioCuota + ImportePunitorioCuotasAnterioes;

            txtUtilidad.Text = fun.TotalizarColumna(trdo, "Ganancia").ToString();
            txtUtilidad.Text = fun.FormatoEnteroMiles(txtUtilidad.Text);

            Clases.cGastosNegocio gastos = new Clases.cGastosNegocio();
            double TotalGastos           = gastos.GetGastosNegocioxFecha(FechaDesde, FechaHasta);

            txtGastos.Text = fun.SepararDecimales(TotalGastos.ToString());
            txtGastos.Text = fun.FormatoEnteroMiles(txtGastos.Text);

            Clases.cPagoIntereses objpago = new Clases.cPagoIntereses();
            double TotalPago = objpago.GetResumenPagosInteresesxFecha(FechaDesde, FechaHasta);

            txtInteresesPagados.Text = fun.SepararDecimales(TotalPago.ToString());
            txtInteresesPagados.Text = fun.FormatoEnteroMiles(txtInteresesPagados.Text);
            double InteresesGanados = 0;

            Clases.cCuotasAnteriores cuotasAnt = new Clases.cCuotasAnteriores();
            Clases.cCuota            cuota     = new Clases.cCuota();
            InteresesGanados         = cuota.GetGanaciaCobroCuotas(FechaDesde, FechaHasta);
            InteresesGanados         = InteresesGanados + cuotasAnt.GetGanaciaCobroCuotas(FechaDesde, FechaHasta);
            txtInteresesGanados.Text = InteresesGanados.ToString();
            txtInteresesGanados.Text = fun.FormatoEnteroMiles(txtInteresesGanados.Text);
            double Ganancia = Utilidad + TotalPunitorio - TotalPago - TotalGastos + InteresesGanados;

            txtResultado.Text = fun.SepararDecimales(Ganancia.ToString());
            txtResultado.Text = fun.FormatoEnteroMiles(txtResultado.Text);
            txtPunitorio.Text = TotalPunitorio.ToString();
            txtPunitorio.Text = fun.FormatoEnteroMiles(txtPunitorio.Text);
        }