private void GrillaCuotas_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            string Cuota         = GrillaCuotas.CurrentRow.Cells[1].Value.ToString();
            string Importe       = GrillaCuotas.CurrentRow.Cells[3].Value.ToString();
            string ImportePagado = GrillaCuotas.CurrentRow.Cells[5].Value.ToString();
            string Fecha         = GrillaCuotas.CurrentRow.Cells[2].Value.ToString();
            string CodGrupo      = GrillaCuotas.CurrentRow.Cells[0].Value.ToString();

            GetPunitorio(Convert.ToInt32(CodGrupo), Convert.ToInt32(Cuota));
            Clases.cFunciones fun = new Clases.cFunciones();

            if (Cuota != "")
            {
                txtCuota.Text         = Cuota;
                txtImporte.Text       = Importe;
                txtImportePagado.Text = ImportePagado;
                txtFecha.Text         = Fecha;
                if (txtImporte.Text != "")
                {
                    //string xx = trdo.Rows[0]["Importe"].ToString().Replace (",",".").ToString();
                    txtImporte.Text  = fun.TransformarEntero(Importe);
                    txtImporte.Text  = fun.FormatoEnteroMiles(txtImporte.Text);
                    txtCodGrupo.Text = CodGrupo.ToString();
                    if (txtImportePagado.Text != "")
                    {
                        btnAnular.Enabled     = true;
                        btnPagarSaldo.Visible = true;
                        // txtImportePagado.ReadOnly = true;
                        btnGrabar.Enabled     = false;
                        txtImportePagado.Text = fun.TransformarEntero(txtImportePagado.Text);
                        txtImportePagado.Text = fun.FormatoEnteroMiles(txtImportePagado.Text);
                        txtSaldo.Text         = (fun.ToDouble(txtImporte.Text) - fun.ToDouble(txtImportePagado.Text)).ToString();
                    }
                    else
                    {
                        btnPagarSaldo.Visible = false;
                        txtSaldo.Text         = "";
                        btnAnular.Enabled     = false;
                        btnGrabar.Enabled     = true;
                        // txtImportePagado.ReadOnly = false;
                    }
                }
                //obtengo la deuda total
                Clases.cCuotasAnteriores objCuota = new Clases.cCuotasAnteriores();
                txtTotalDeuda.Text = objCuota.GetSaldoDeudaCuotas(Convert.ToInt32(CodGrupo)).ToString();
                if (txtTotalDeuda.Text != "")
                {
                    txtTotalDeuda.Text = fun.TransformarEntero(txtTotalDeuda.Text);
                    txtTotalDeuda.Text = fun.FormatoEnteroMiles(txtTotalDeuda.Text);
                }
            }
        }
Esempio n. 2
0
        private void Actualizar()
        {
            //obtengo el importe de documentos a cobrar
            GetDeudasxPrestamo();
            GetEfectivosaPagar();
            GetCobranzaGeneral();
            GetChequesPagar();
            Clases.cFunciones        fun       = new Clases.cFunciones();
            Clases.cCuota            cuota     = new Clases.cCuota();
            Clases.cCuotasAnteriores cuotasAnt = new Clases.cCuotasAnteriores();
            Clases.cCheque           cheque    = new Clases.cCheque();
            Double ImporteCheque = cheque.GetTotalChequesaCobrar();

            Clases.cChequeCobrar chequeCob = new Clases.cChequeCobrar();
            ImporteCheque = ImporteCheque + chequeCob.GetTotalChequesaCobrar();
            Double Importe = cuota.GetMontoCuotasImpagas();
            Double ImporteCuotasAnteriores = cuotasAnt.GetMontoCuotasImpagas();

            Importe = Importe + ImporteCuotasAnteriores;
            Double ImporteSinInteres          = cuota.GetMontoCuotasImpagasSinInteres();
            double ImporteSinInteresCuotasAnt = cuotasAnt.GetMontoCuotasImpagasSinInteres();

            ImporteSinInteres            = ImporteSinInteres + ImporteSinInteresCuotasAnt;
            txtDocumentos.Text           = fun.TransformarEntero(Importe.ToString().Replace(",", "."));
            txtDocumentos.Text           = fun.FormatoEnteroMiles(txtDocumentos.Text);
            txtDocumentosSinInteres.Text = ImporteSinInteres.ToString();
            txtDocumentosSinInteres.Text = fun.TransformarEntero(ImporteSinInteres.ToString());
            txtDocumentosSinInteres.Text = fun.FormatoEnteroMiles(txtDocumentosSinInteres.Text);
            txtTotalCheque.Text          = fun.FormatoEnteroMiles(ImporteCheque.ToString());
            Clases.cResumenCuentas res = new Clases.cResumenCuentas();
            DataTable trdo             = res.GetResumenCuentas();

            if (trdo.Rows.Count > 0)
            {
                double ImporteEfectivo = Convert.ToDouble(trdo.Rows[0]["ImporteEfectivo"]);
                txtEfectivo.Text = fun.TransformarEntero(ImporteEfectivo.ToString().Replace(",", "."));
                txtEfectivo.Text = fun.FormatoEnteroMiles(txtEfectivo.Text);

                double ImporteAuto = Convert.ToDouble(trdo.Rows[0]["ImporteAuto"]);
                txtVehículo.Text = fun.TransformarEntero(ImporteAuto.ToString().Replace(",", "."));
                txtVehículo.Text = fun.FormatoEnteroMiles(txtVehículo.Text);

                double ImportePrenda = Convert.ToDouble(trdo.Rows[0]["ImportePrenda"]);
                txtPrenda.Text = fun.TransformarEntero(ImportePrenda.ToString().Replace(",", "."));
                txtPrenda.Text = fun.FormatoEnteroMiles(txtPrenda.Text);

                double ImporteCobranza = Convert.ToDouble(trdo.Rows[0]["ImporteCobranza"]);
                txtCobranzas.Text = fun.TransformarEntero(ImporteCobranza.ToString().Replace(",", "."));
                txtCobranzas.Text = fun.FormatoEnteroMiles(txtCobranzas.Text);

                double ImporteBanco = Convert.ToDouble(trdo.Rows[0]["ImporteBanco"]);
                txtBanco.Text = fun.TransformarEntero(ImporteBanco.ToString().Replace(",", "."));
                txtBanco.Text = fun.FormatoEnteroMiles(txtBanco.Text);

                Clases.cComisionVendedor com = new Clases.cComisionVendedor();
                txtComisiones.Text = com.GetComisionesPendientes().ToString();
                if (txtComisiones.Text != "")
                {
                    txtComisiones.Text = fun.FormatoEnteroMiles(txtComisiones.Text);
                }

                Clases.cGastosPagar gasto = new Clases.cGastosPagar();
                txtGastosPendientes.Text = gasto.GetGastosaPagar().ToString();

                if (txtGastosPendientes.Text != "")
                {
                    txtGastosPendientes.Text = fun.FormatoEnteroMiles(txtGastosPendientes.Text);
                }

                Clases.cCobranza cob = new Clases.cCobranza();
                txtCobranzas.Text = cob.GetTotalDeudaCobranzas().ToString();
                txtCobranzas.Text = fun.FormatoEnteroMiles(txtCobranzas.Text);
                GetPrendas();
                GetTotalVehiculo();
                GetTarjeta();
            }
        }
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            if (txtCuota.Text == "")
            {
                MessageBox.Show("Debe ingresar una cuota para continuar.", Clases.cMensaje.Mensaje());
                return;
            }
            if (txtImportePagado.Text == "")
            {
                MessageBox.Show("Debe ingresar un monto de la cuota.", Clases.cMensaje.Mensaje());
                return;
            }
            Clases.cFunciones fun           = new Clases.cFunciones();
            double            Importe       = fun.ToDouble(txtImporte.Text);
            double            ImportePagado = fun.ToDouble(txtImportePagado.Text);
            Int32             CodUsuario    = Principal.CodUsuarioLogueado;

            if (ImportePagado > Importe)
            {
                MessageBox.Show("El importe a abonar es superior al valor de la cuota", Clases.cMensaje.Mensaje());
                return;
            }

            if (ImportePagado < Importe)
            {
                var result = MessageBox.Show("El importe abonado es inferior al valor de la cuota, Confirma Pago de la cuota?", Clases.cMensaje.Mensaje(),
                                             MessageBoxButtons.YesNo,
                                             MessageBoxIcon.Question);

                // If the no button was pressed ...
                if (result == DialogResult.No)
                {
                    return;
                }
            }

            Int32    CodGrupo  = Convert.ToInt32(txtCodGrupo.Text);
            Int32    Cuota     = Convert.ToInt32(txtCuota.Text);
            DateTime FechaPago = Convert.ToDateTime(txtFecha.Text);
            double   Saldo     = Importe - ImportePagado;
            Double   Punitorio = 0;

            if (txtPunitorio.Text != "")
            {
                Punitorio = fun.ToDouble(txtPunitorio.Text);
            }
            Clases.cCuotasAnteriores objCuota = new Clases.cCuotasAnteriores();
            if (objCuota.GrabarCuota(CodGrupo, Cuota, FechaPago, ImportePagado, Saldo, CodUsuario, txtPatente.Text, Punitorio))
            {
                MessageBox.Show("Cuota grabada correctamente.", Clases.cMensaje.Mensaje());
                CargarPlandeCuotas(Convert.ToInt32(CodGrupo));

                txtTotalDeuda.Text = objCuota.GetSaldoDeudaCuotas(Convert.ToInt32(CodGrupo)).ToString();
                if (txtTotalDeuda.Text != "")
                {
                    txtTotalDeuda.Text = fun.TransformarEntero(txtTotalDeuda.Text);
                    txtTotalDeuda.Text = fun.FormatoEnteroMiles(txtTotalDeuda.Text);
                }
            }
            else
            {
                MessageBox.Show("Hubo un error en el proceso de grabación.", Clases.cMensaje.Mensaje());
            }
        }