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());
        }
        private void btnAnular_Click(object sender, EventArgs e)
        {
            if (fun.ValidarFecha(txtFecha.Text) == false)
            {
                Mensaje("La fecha ingresada es incorrecta");
                return;
            }
            DateTime Fecha       = Convert.ToDateTime(txtFecha.Text);
            Int32    CodRegistro = Convert.ToInt32(Principal.CodigoPrincipalAbm);

            Clases.cEfectivoaPagar obj = new Clases.cEfectivoaPagar();
            string Descripcion         = "ANULACION DE PAGO A " + txtCliente.Text;

            Descripcion = Descripcion + ", PATENTE " + txtPatente.Text;
            double Total  = fun.ToDouble(txtImporte.Text);
            double Saldo  = fun.ToDouble(txtSaldo.Text);
            double Pagado = Total - Saldo;

            if (Total == Saldo)
            {
                Mensaje("No hay registros para anular");
                return;
            }

            Clases.cSaldoEfectivoPagar saldoEf = new Clases.cSaldoEfectivoPagar();
            obj.Anular(CodRegistro);
            saldoEf.Borrar(CodRegistro);
            Clases.cMovimiento mov = new Clases.cMovimiento();
            mov.RegistrarMovimientoDescripcion(-1, Convert.ToInt32(Principal.CodigoPrincipalAbm), Pagado, 0, 0, 0, 0, Fecha, Descripcion);
            Mensaje("Datos grabados correctamente");
            btnAnular.Enabled = false;
            btnGrabar.Enabled = false;
        }
Esempio n. 3
0
        private void btnAgregarGasto_Click(object sender, EventArgs e)
        {
            Clases.cFunciones fun = new Clases.cFunciones();
            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;
            }

            if (txtCodStock.Text == "")
            {
                MessageBox.Show("Debe ingresar un auto para continuar", Clases.cMensaje.Mensaje());
                return;
            }
            Int32 CodCategoriaGasto = Convert.ToInt32(CmbCategoriaGasto.SelectedValue.ToString());

            Clases.cGasto gasto    = new Clases.cGasto();
            string        Nombre   = gasto.GetGastoxCodigo(Convert.ToInt32(CodCategoriaGasto));
            string        sImporte = txtImporteGasto.Text;
            DateTime      Fecha    = Convert.ToDateTime(txtFecha.Text);

            //Clases.cFunciones fun = new Clases.cFunciones();
            double Importe = fun.ToDouble(sImporte);

            gasto.InsertarGasto(Convert.ToInt32(txtCodStock.Text), CodCategoriaGasto, Importe, DateTime.Now);
            Clases.cMovimiento mov = new Clases.cMovimiento();
            mov.RegistrarMovimiento(-1, Principal.CodUsuarioLogueado, -1 * Importe, 0, 0, Importe, 0, Fecha);
            CargarGrilla();
        }
        private void btnGrabar_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;
            }



            Int32    CodComision = Convert.ToInt32(txtCodComision.Text);
            DateTime Fecha       = Convert.ToDateTime(txtFecha.Text);

            Clases.cComisionVendedor com = new Clases.cComisionVendedor();
            com.PagoComision(Fecha, CodComision);
            string Descripcion = "PAGO COMISIÓN " + txtNombre.Text + " " + txtApellido.Text;

            Descripcion = Descripcion + ", PATENTE " + txtPatente.Text;
            double Importe = fun.ToDouble(txtImporte.Text);

            Clases.cMovimiento mov = new Clases.cMovimiento();
            mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, -1 * Importe, 0, 0, 0, 0, Fecha, Descripcion);
            MessageBox.Show("Datos grabados Correctamente", Clases.cMensaje.Mensaje());

            btnGrabar.Enabled = false;
            btnAnular.Enabled = false;
        }
        private void btnRegistrarPago_Click(object sender, EventArgs e)
        {
            Clases.cFunciones fun = new Clases.cFunciones();
            if (Grilla.CurrentRow == null)
            {
                MessageBox.Show("Debe seleccionar un registro para continuar", Clases.cMensaje.Mensaje());
                return;
            }

            if (fun.ValidarFecha(txtFechaDevolucion.Text) == false)
            {
                MessageBox.Show("La fecha de devolución es incorrecta", Clases.cMensaje.Mensaje());
                return;
            }

            if (Grilla.CurrentRow.Cells[8].Value.ToString() != "")
            {
                MessageBox.Show("Ya se ha registrado el pago del préstamo", Clases.cMensaje.Mensaje());
                return;
            }


            Int32    CodPrestamo = Convert.ToInt32(Grilla.CurrentRow.Cells[0].Value);
            DateTime FechaPago   = Convert.ToDateTime(txtFechaDevolucion.Text);
            string   Nombre      = Grilla.CurrentRow.Cells[1].Value.ToString();
            string   Descripcion = "PAGO PRESTAMO " + Nombre.ToString();
            double   Importe     = fun.ToDouble(Grilla.CurrentRow.Cells[6].Value.ToString());

            Clases.cPrestamo prestamo = new Clases.cPrestamo();
            prestamo.RegistrarDevolucion(CodPrestamo, FechaPago);
            Clases.cMovimiento mov = new Clases.cMovimiento();
            mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, -1 * Importe, 0, 0, 0, 0, FechaPago, Descripcion);
            MessageBox.Show("Datos registrados correctametne", Clases.cMensaje.Mensaje());
            CargarGrilla();
        }
        private void btnPagarSaldo_Click(object sender, EventArgs e)
        {
            Clases.cFunciones fun = new Clases.cFunciones();
            if (txtMontoaPagar.Text == "")
            {
                Mensaje("Debe ingresar un monto a cobrar");
                return;
            }
            double Saldo   = fun.ToDouble(txtSaldo.Text);
            double Importe = fun.ToDouble(txtMontoaPagar.Text);

            if (Saldo == 0)
            {
                Mensaje("No hay saldo para cancelar");
                return;
            }
            if (Importe > Saldo)
            {
                Mensaje("El importe a cobrar es mayor al saldo");
                return;
            }
            Clases.cSaldoCobranzaGeneral saldoCob = new Clases.cSaldoCobranzaGeneral();
            Int32    CodCobranza = Convert.ToInt32(txtCodCobranza.Text);
            DateTime Fecha       = Convert.ToDateTime(txtFechaCobro.Text);
            string   Descripción = "PAGO SALDO " + txtDescripcion.Text;

            Clases.cCobranzaGeneral cob = new Clases.cCobranzaGeneral();
            cob.PagarSaldo(CodCobranza, Importe);
            saldoCob.InsertarSaldoCob(CodCobranza, Fecha, Importe);
            Clases.cMovimiento mov = new Clases.cMovimiento();
            mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, Importe, 0, 0, 0, 0, Fecha, Descripción);
            Mensaje("Datos grabados correctamente ");
            GetCobranzas(CodCobranza);
        }
        private void btnPagarSaldo_Click(object sender, EventArgs e)
        {
            Clases.cFunciones fun = new Clases.cFunciones();
            if (txtImportePagado.Text == "")
            {
                MessageBox.Show("Debe ingresar un importe", Clases.cMensaje.Mensaje());
                return;
            }

            double Saldo   = fun.ToDouble(txtSaldo.Text);
            double Importe = fun.ToDouble(txtImportePagado.Text);

            if (Importe > Saldo)
            {
                MessageBox.Show("El saldo es superior al importe", Clases.cMensaje.Mensaje());
                return;
            }
            Clases.cMovimiento mov         = new Clases.cMovimiento();
            Clases.cSaldoCuota saldoCuotas = new Clases.cSaldoCuota();
            string             Descripcion = "PAGO DE SALDO CUOTA" + txtCuota.Text;

            Descripcion = Descripcion + ", PATENTE " + txtPatente.Text;
            Int32 Cuota    = Convert.ToInt32(txtCuota.Text);
            Int32 CodGrupo = Convert.ToInt32(txtCodGrupo.Text);

            Clases.cSaldoCuotasAnteriores salCuotas = new Clases.cSaldoCuotasAnteriores();
            Clases.cCuotasAnteriores      cuota     = new Clases.cCuotasAnteriores();
            DateTime Fecha = Convert.ToDateTime(txtFecha.Text);

            cuota.PagarSaldoCuota(CodGrupo, Cuota, Importe);
            mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, Importe, 0, 0, 0, 0, Fecha, Descripcion);
            salCuotas.InsertarSaldoCob(CodGrupo, Cuota, Fecha, Importe);
            MessageBox.Show("Datos grabados correctamente", Clases.cMensaje.Mensaje());
        }
Esempio n. 8
0
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            Clases.cFunciones fun = new Clases.cFunciones();
            if (fun.ValidarFecha(txtFechaPago.Text) == false)
            {
                MessageBox.Show("Debe ingresar una fecha válida", Clases.cMensaje.Mensaje());
                return;
            }
            double Importe  = fun.ToDouble(txtImporte.Text);
            double Tope     = fun.ToDouble(txtTope.Text);
            double dif      = Tope - Importe;
            string Descrip2 = "";

            if (dif > 0)
            {
                Descrip2 = "DIFERENCIA POSITVA DE TRANSFERENCIA, PATENTE " + txtPatente.Text;
            }
            if (dif < 0)
            {
                Descrip2 = "DIFERENCIA NEGATIVA DE TRANSFERENCIA, PATENTE " + txtPatente.Text;
            }

            if (dif < 0)
            {
                //paga el tope mas la diferencia negativa
                Importe = Tope;
            }

            if (dif > 0)
            {
                //paga el tope mas la diferencia negativa
                Importe = Tope;
            }

            string Descripcion = txtDescripcion.Text + " " + txtPatente.Text;

            Clases.cMovimiento mov   = new Clases.cMovimiento();
            DateTime           Fecha = Convert.ToDateTime(txtFechaPago.Text);

            Clases.cGastosPagar gasto = new Clases.cGastosPagar();
            gasto.ActualizarPago(Convert.ToInt32(Principal.CodigoPrincipalAbm), Fecha);
            mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, -1 * Importe, 0, 0, 0, 0, Fecha, Descripcion);
            if (dif != 0)
            {
                Int32?CodVenta = null;
                if (txtCodVenta.Text.Trim() != "")
                {
                    CodVenta = Convert.ToInt32(txtCodVenta.Text);
                }
                //hubo exedente o menor plata
                mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, dif, 0, 0, 0, 0, Fecha, Descrip2);
                Clases.cDiferenciaTransferencia obj = new Clases.cDiferenciaTransferencia();
                obj.Insertar(CodVenta, dif, Convert.ToInt32(Principal.CodigoPrincipalAbm));
            }
            MessageBox.Show("Datos grabados correctamente", Clases.cMensaje.Mensaje());
            btnGrabar.Enabled = false;
        }
Esempio n. 9
0
        private void btnAgregarCosto_Click(object sender, EventArgs e)
        {
            if (txtCodStock.Text == "")
            {
                MessageBox.Show("Debe ingresar un vehículo para continuar", Clases.cMensaje.Mensaje());
                return;
            }
            Clases.cFunciones fun = new Clases.cFunciones();
            if (txtCodAuto.Text == "")
            {
                MessageBox.Show("Debe ingresar un auto válido", 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;
            }


            Double Importe = 0;

            if (txtCosto.Text != "")
            {
                Importe = Convert.ToDouble(txtCosto.Text);
            }
            Int32  CodAuto     = Convert.ToInt32(txtCodAuto.Text);
            string Descripcion = txtDescripcionCosto.Text + ", PATENTE " + txtPatente.Text;
            string Fecha       = txtFecha.Text;
            string Patente     = txtPatente.Text;
            Int32? CodStock    = -1;

            if (txtCodStock.Text != "")
            {
                CodStock = Convert.ToInt32(txtCodStock.Text);
            }

            Clases.cCosto costo = new Clases.cCosto();
            costo.InsertarCosto(CodAuto, Patente, Importe, Fecha, Descripcion.ToUpper(), CodStock);
            CargarCostoxstock(Convert.ToInt32(CodStock));
            DateTime FechaCosto = Convert.ToDateTime(txtFecha.Text);

            Clases.cMovimiento mov = new Clases.cMovimiento();
            mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, (-1) * (Importe), 0, 0, Importe, 0, FechaCosto, Descripcion.ToUpper());
            txtCosto.Text            = "";
            txtDescripcionCosto.Text = "";
            txtCodCosto.Text         = "";
            // Clases.cGrilla.FormatoColumnasMiles(Grilla, "Importe");
        }
Esempio n. 10
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            Clases.cFunciones fun = new Clases.cFunciones();
            if (fun.ValidarFecha(txtFecha.Text) == false)
            {
                Mensaje("La fecha es incorrecta");
                return;
            }

            if (txtEfectivo.Text == "")
            {
                Mensaje("Debe ingresar un importe");
                return;
            }

            if (cmbConcepto.SelectedIndex == 0)
            {
                if (txtDescripcion.Text == "")
                {
                    Mensaje("Debe ingresar una descripción");
                    return;
                }
            }

            DateTime Fecha         = Convert.ToDateTime(txtFecha.Text);
            double   Importe       = fun.ToDouble(txtEfectivo.Text);
            string   Descripcion   = txtDescripcion.Text;
            Int32?   CodEntidad    = null;
            string   NombreEntidad = "";

            if (cmbConcepto.SelectedIndex > 0)
            {
                CodEntidad = Convert.ToInt32(cmbConcepto.SelectedValue);
                Clases.cEntidad ent = new Clases.cEntidad();
                NombreEntidad = ent.GetNombrexCodigo(Convert.ToInt32(CodEntidad));
            }

            if (NombreEntidad != "")
            {
                Descripcion = NombreEntidad + "," + Descripcion;
            }
            Clases.cGastosNegocio gasto = new Clases.cGastosNegocio();
            gasto.GrabarGastos(Fecha, CodEntidad, Descripcion, Importe);
            Clases.cMovimiento mov = new Clases.cMovimiento();
            mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, -1 * Importe, 0, 0, 0, 0, Fecha, Descripcion);
            Mensaje("Datos grabados correctamente");
            txtEfectivo.Text    = "";
            txtDescripcion.Text = "";
            txtFecha.Text       = "";
            if (cmbConcepto.Items.Count > 1)
            {
                cmbConcepto.SelectedIndex = 0;
            }
        }
Esempio n. 11
0
        private void btnModificar_Click(object sender, EventArgs e)
        {
            Clases.cFunciones fun = new Clases.cFunciones();
            if (txtMontoModificar.Text == "")
            {
                MessageBox.Show("Debe ingresar un monto para continuar ", Clases.cMensaje.Mensaje());
                return;
            }

            Int32    CodPrestamo        = Convert.ToInt32(Principal.CodigoPrincipalAbm);
            DateTime Fecha              = Convert.ToDateTime(txtFechaPago.Text);
            double   Importe            = fun.ToDouble(txtMontoModificar.Text);
            string   DescripcionDetalle = "INGRESO PRESTAMO " + Importe.ToString().Replace(",", ".");
            double   MontoAnterio       = fun.ToDouble(txtImporte.Text);
            double   MontoModificar     = fun.ToDouble(txtMontoModificar.Text);

            if (CmbOpciones.SelectedIndex == 0)
            {
                DescripcionDetalle = "AGREGAR CAPITAL " + Importe.ToString();
            }
            else
            {
                MontoModificar     = -1 * MontoModificar;
                DescripcionDetalle = "DESCUENTO DE CAPITAL " + Importe.ToString();
            }
            txtImporte.Text = (fun.ToDouble(txtImporte.Text) + fun.ToDouble(MontoModificar.ToString())).ToString();
            txtImporte.Text = fun.FormatoEnteroMiles(txtImporte.Text);
            CalcularPorcentaje();

            Clases.cDetallePrestamo detalle = new Clases.cDetallePrestamo();
            detalle.InsertarDetallePrestamo(CodPrestamo, Importe, DescripcionDetalle, Fecha);
            //cargo el nuevo porcentaje
            double   Por              = Convert.ToDouble(txtPorcentaje.Text.Replace(".", ","));
            double   MontoFinal       = fun.ToDouble(txtImporte.Text);
            double   ImporteaPagar    = fun.ToDouble(txtMontoApagar.Text);
            DateTime FechaVencimiento = Convert.ToDateTime(txtFechaVencimiento.Text);

            Clases.cPrestamo prestamo = new Clases.cPrestamo();
            prestamo.ModificarPorcentajePrestamo(CodPrestamo, Por, ImporteaPagar, Fecha, MontoFinal);
            CargarDetalle(CodPrestamo);
            string DescripcionMovimiento = "";

            if (MontoModificar > 0)
            {
                DescripcionMovimiento = " INGRESO PRESTAMO " + txtNombre.Text;
            }
            else
            {
                DescripcionMovimiento = " RETIRO PRESTAMO " + txtNombre.Text;
            }
            Clases.cMovimiento mov = new Clases.cMovimiento();
            mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, MontoModificar, 0, 0, 0, 0, Fecha, DescripcionMovimiento);
            MessageBox.Show("Datos grabados correctamente", Clases.cMensaje.Mensaje());
        }
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            Clases.cFunciones fun = new Clases.cFunciones();
            if (txtMontoaPagar.Text == "")
            {
                Mensaje("Debe ingresar un monto a cobrar");
                return;
            }
            double Saldo   = fun.ToDouble(txtSaldo.Text);
            double Importe = fun.ToDouble(txtMontoaPagar.Text);

            if (Saldo == 0)
            {
                Mensaje("No hay saldo para cancelar");
                return;
            }
            if (fun.ValidarFecha(txtFechaCobro.Text) == false)
            {
                Mensaje("Debe ingresar una fecha de cobro");
                return;
            }
            if (Importe > Saldo)
            {
                Mensaje("El importe a cobrar es mayor al saldo");
                return;
            }

            if (Saldo > Importe)
            {
                var result = MessageBox.Show("El importe es inferior al saldo, desea continuar", "Información",
                                             MessageBoxButtons.YesNo,
                                             MessageBoxIcon.Question);

                // If the no button was pressed ...
                if (result == DialogResult.No)
                {
                    return;
                }
            }
            Int32    CodCobranza = Convert.ToInt32(txtCodCobranza.Text);
            DateTime Fecha       = Convert.ToDateTime(txtFechaCobro.Text);
            string   Descripción = "COBRANZA GENERAL ,PATENTE " + txtPatente.Text;

            Clases.cCobranzaGeneral cob = new Clases.cCobranzaGeneral();
            cob.RegistrarCobro(CodCobranza, Fecha, Importe);
            Clases.cMovimiento mov = new Clases.cMovimiento();
            mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, Importe, 0, 0, 0, 0, Fecha, Descripción);
            Mensaje("Datos grabados correctamente ");
            GetCobranzas(CodCobranza);
        }
Esempio n. 13
0
        private void btnAnular_Click(object sender, EventArgs e)
        {
            Clases.cFunciones fun = new Clases.cFunciones();

            /*
             * if (Grilla.Rows.Count < 2)
             * {
             *  MessageBox.Show("Debe Seleccionar una prenda para continuar ", Clases.cMensaje.Mensaje());
             *  return;
             * }
             *
             * if (Grilla.CurrentRow == null)
             * {
             *  MessageBox.Show("Seleccione una fila para continuar.", Clases.cMensaje.Mensaje());
             *  return;
             * }
             *
             * if (Grilla.CurrentRow.Cells[6].Value.ToString() == "")
             * {
             *  MessageBox.Show("La prenda no se puede anular debido a que no ha sido cobrada.", Clases.cMensaje.Mensaje());
             *  return;
             * }
             */
            string Descripcion = "ANULACION DE COBRO DE PRENDA:  Patente " + txtPatente.Text;

            Descripcion = Descripcion + ", Cliente " + txtNombre.Text;
            string CodPrenda = Principal.CodigoPrincipalAbm;
            Double Importe   = fun.ToDouble(txtImporte.Text);
            Int32  CodVenta  = Convert.ToInt32(txtCodVenta.Text);

            Clases.cPrenda prenda = new Clases.cPrenda();
            prenda.AnularPagoPrenda(Convert.ToInt32(CodPrenda));
            Clases.cMovimiento mov = new Clases.cMovimiento();
            if (txtDiferencia.Text != "0")
            {
                double Diferencia = fun.ToDouble(txtDiferencia.Text);
                string TEXTO      = "ANULACION DIFERENCIA PRENDA, PATENTE " + txtPatente.Text;
                // mov.RegistrarMovimientoDescripcion(CodVenta, Principal.CodUsuarioLogueado, (-1) * Diferencia, 0, 0, 0, 0, DateTime.Now, TEXTO);
            }
            DateTime Fecha = Convert.ToDateTime(txtFecha.Text);

            Clases.cCheque cheque = new Clases.cCheque();
            cheque.BorrarChequexCodPrenda(Convert.ToInt32(CodPrenda));
            Importe = fun.ToDouble(txtTotalCheque.Text);
            mov.RegistrarMovimientoDescripcion(CodVenta, Principal.CodUsuarioLogueado, (-1) * Importe, 0, 0, 0, 0, Fecha, Descripcion);
            MessageBox.Show("Datos grabados correctamente", Clases.cMensaje.Mensaje());
            GetPrendaxCod(Convert.ToInt32(CodPrenda));
        }
Esempio n. 14
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. 15
0
        private void btnAnular_Click(object sender, EventArgs e)
        {
            string msj    = "Confirma anular el pago";
            var    result = MessageBox.Show(msj, "Información",
                                            MessageBoxButtons.YesNo,
                                            MessageBoxIcon.Question);

            // If the no button was pressed ...
            if (result == DialogResult.No)
            {
                return;
            }
            Clases.cFunciones fun     = new Clases.cFunciones();
            double            Importe = fun.ToDouble(txtImporte.Text);

            string Descripcion = "PAGO ANULADO " + txtDescripcion.Text + " " + txtPatente.Text;

            Clases.cMovimiento mov   = new Clases.cMovimiento();
            DateTime           Fecha = Convert.ToDateTime(txtFechaPago.Text);

            Clases.cGastosPagar             gasto  = new Clases.cGastosPagar();
            Clases.cDiferenciaTransferencia objDif = new Clases.cDiferenciaTransferencia();
            double ImporteDiferencia = objDif.GetImporteDiferenciaxCodGasto(Convert.ToInt32(Principal.CodigoPrincipalAbm));
            int    positivo          = 0;

            if (ImporteDiferencia > 0)
            {
                positivo = 1;
            }
            ImporteDiferencia = -1 * ImporteDiferencia;

            if (positivo == 1)
            {
                Importe = Importe + ImporteDiferencia;
            }

            gasto.ActualizarPago(Convert.ToInt32(Principal.CodigoPrincipalAbm), null);
            mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, Importe, 0, 0, 0, 0, Fecha, Descripcion);
            //saco el exedente
            mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, ImporteDiferencia, 0, 0, 0, 0, Fecha, "AJUSTE DE DIFERENCIA");
            MessageBox.Show("Datos grabados correctamente", Clases.cMensaje.Mensaje());
            objDif.Borrar(Convert.ToInt32(Principal.CodigoPrincipalAbm));
            btnAnular.Enabled = false;
        }
Esempio n. 16
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            if (Grilla.CurrentRow == null)
            {
                MessageBox.Show("Debe seleccionar un costo ", Clases.cMensaje.Mensaje());
                return;
            }
            txtCodCosto.Text = Grilla.CurrentRow.Cells[0].Value.ToString();
            if (txtCodCosto.Text == "")
            {
            }
            var    resul    = MessageBox.Show("Confirma eliminar el costo", Clases.cMensaje.Mensaje(), MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            Double Importe  = 0;
            string sImporte = "";

            if (resul == DialogResult.Yes)
            {
                //busco el importe a borrar

                sImporte = "";
                for (int i = 0; i < Grilla.Rows.Count - 1; i++)
                {
                    if (Grilla.Rows[i].Cells[0].Value.ToString() == txtCodCosto.Text)
                    {
                        sImporte = Grilla.Rows[i].Cells[4].Value.ToString();
                    }
                }
            }
            Clases.cFunciones fun = new Clases.cFunciones();
            if (sImporte != "")
            {
                Importe = fun.ToDouble(sImporte);
            }
            Clases.cCosto costo    = new Clases.cCosto();
            Int32         CodCosto = Convert.ToInt32(txtCodCosto.Text);

            costo.BorrarCosto(CodCosto);
            DateTime Fecha = Convert.ToDateTime(txtFecha.Text);

            Clases.cMovimiento mov = new Clases.cMovimiento();
            mov.RegistrarMovimiento(-1, Principal.CodUsuarioLogueado, (Importe), 0, 0, (-1) * Importe, 0, Fecha);
            CargarCostoxstock(Convert.ToInt32(txtCodStock.Text));
        }
Esempio n. 17
0
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            Clases.cFunciones fun = new Clases.cFunciones();

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

            if (Grilla.Rows.Count < 2)
            {
                MessageBox.Show("Debe Seleccionar una prenda 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;
            }

            DateTime Fecha       = Convert.ToDateTime(txtFecha.Text);
            Int32    CodVenta    = Convert.ToInt32(Grilla.CurrentRow.Cells[0].Value.ToString());
            string   NroCheque   = Grilla.CurrentRow.Cells[1].Value.ToString();
            string   Descripcion = "COBRO CHEQUE " + txtPatente.Text + " , " + NroCheque.ToString();

            Descripcion = Descripcion + ", " + txtEntregado.Text;
            Double Importe = fun.ToDouble(Grilla.CurrentRow.Cells[2].Value.ToString());

            Clases.cCheque cheque = new Clases.cCheque();
            cheque.RegistrarCobroCheque(txtFecha.Text, Convert.ToInt32(CodVenta), NroCheque);
            Clases.cMovimiento mov = new Clases.cMovimiento();
            mov.RegistrarMovimientoDescripcion(CodVenta, Principal.CodUsuarioLogueado, Importe, 0, 0, 0, 0, Fecha, Descripcion);
            CargarGrilla();
            MessageBox.Show("Datos grabados correctamente", Clases.cMensaje.Mensaje());
        }
Esempio n. 18
0
        private void btnEliminarGasto_Click(object sender, EventArgs e)
        {
            if (Grilla.CurrentRow == null)
            {
                MessageBox.Show("Debe seleccionar un registro para continuar", Clases.cMensaje.Mensaje());
                return;
            }
            Clases.cFunciones fun = new Clases.cFunciones();
            Int32             CodCategoriaGasto = Convert.ToInt32(Grilla.CurrentRow.Cells[0].Value);
            double            Importe           = fun.ToDouble(Grilla.CurrentRow.Cells[2].Value.ToString());

            Clases.cGasto gasto = new Clases.cGasto();
            gasto.BorrarGastoxCategoria(Convert.ToInt32(txtCodStock.Text), CodCategoriaGasto);
            Clases.cMovimiento mov   = new Clases.cMovimiento();
            DateTime           Fecha = Convert.ToDateTime(txtFecha.Text);

            mov.RegistrarMovimiento(-1, Principal.CodUsuarioLogueado, Importe, 0, 0, -1 * Importe, 0, Fecha);
            CargarGrilla();
        }
Esempio n. 19
0
        private void btnAnular_Click(object sender, EventArgs e)
        {
            if (Grilla.CurrentRow == null)
            {
                MessageBox.Show("Debe seleccionar un registro para continuar", Clases.cMensaje.Mensaje());
                return;
            }

            Int32  CodPago   = Convert.ToInt32(Grilla.CurrentRow.Cells[0].Value.ToString());
            Int32  CodCheque = Convert.ToInt32(Grilla.CurrentRow.Cells[1].Value.ToString());
            string msj       = "Confirma anular el pago ";
            var    result    = MessageBox.Show(msj, "Información",
                                               MessageBoxButtons.YesNo,
                                               MessageBoxIcon.Question);

            // If the no button was pressed ...
            if (result == DialogResult.No)
            {
                return;
            }
            Clases.cFunciones fun = new Clases.cFunciones();
            if (fun.ValidarFecha(txtFecha.Text) == false)
            {
                MessageBox.Show("La fecha ingresada es incorrecta", Clases.cMensaje.Mensaje());
                return;
            }
            Clases.cPagoCheque objPago = new Clases.cPagoCheque();
            double             Importe = fun.ToDouble(Grilla.CurrentRow.Cells[2].Value.ToString());

            Clases.cChequesaPagar cheque = new Clases.cChequesaPagar();
            Clases.cMovimiento    mov    = new Clases.cMovimiento();
            DateTime Fecha = Convert.ToDateTime(txtFecha.Text);

            //cheque.AnularPagarCheque (Convert.ToInt32(Principal.CodigoPrincipalAbm));
            objPago.AnularPagoCheque(CodPago, CodCheque, Importe);
            string Descripcion = "ANULACION PAGO DE CHEQUE " + txtCliente.Text.ToUpper();

            mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, Importe, 0, 0, 0, 0, Fecha, Descripcion);
            MessageBox.Show("Datos grabados correctamente", Clases.cMensaje.Mensaje());
            btnAnular.Enabled = false;
            Cargar(CodCheque);
        }
Esempio n. 20
0
        private void GrabarGastos()
        {
            Clases.cFunciones fun = new Clases.cFunciones();
            Int32             CodCategoriaGasto = 0;
            double            Importe           = 0;
            Int32             CodStock          = Convert.ToInt32(txtCodStock.Text);

            Clases.cGasto      gasto = new Clases.cGasto();
            Clases.cMovimiento mov   = new Clases.cMovimiento();
            gasto.BorrarGastoxCodStock(CodStock);
            DateTime Fecha = Convert.ToDateTime(txtFecha.Text);

            for (int i = 0; i < Grilla.Rows.Count - 1; i++)
            {
                CodCategoriaGasto = Convert.ToInt32(Grilla.Rows[i].Cells[0].Value.ToString());
                Importe           = fun.ToDouble(Grilla.Rows[i].Cells[2].Value.ToString());
                CodCategoriaGasto = Convert.ToInt32(Grilla.Rows[i].Cells[0].Value.ToString());
                gasto.InsertarGasto(CodStock, CodCategoriaGasto, Importe, DateTime.Now);
                mov.RegistrarMovimiento(-1, Principal.CodUsuarioLogueado, (-1) * Importe, 0, 0, Importe, 0, Fecha);
            }
        }
Esempio n. 21
0
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            Clases.cFunciones fun = new Clases.cFunciones();
            if (fun.ValidarFecha(txtFechaPago.Text) == false)
            {
                MessageBox.Show("La fecha de pago es incorrecta", Clases.cMensaje.Mensaje());
                return;
            }

            string   Descripcion = "PAGO DE INTERÉS " + txtNombre.Text.ToString();
            Int32    CodPrestamo = Convert.ToInt32(Principal.CodigoPrincipalAbm);
            DateTime Fecha       = Convert.ToDateTime(txtFechaPago.Text);
            double   Importe     = fun.ToDouble(txtMontoApagar.Text);

            Clases.cMovimiento    mov  = new Clases.cMovimiento();
            Clases.cPagoIntereses pago = new Clases.cPagoIntereses();
            pago.RegistrarPago(CodPrestamo, Fecha, Importe);
            mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, -1 * Importe, 0, 0, 0, 0, Fecha, Descripcion);
            MessageBox.Show("Datos grabados correctamente", Clases.cMensaje.Mensaje());
            CargarGrilla(CodPrestamo);
        }
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            if (fun.ValidarFecha(txtFecha.Text) == false)
            {
                Mensaje("La fecha ingresada es incorrecta");
                return;
            }

            if (txtIngresarImporte.Text == "")
            {
                Mensaje("Debe ingresar un importe para continuar");
                return;
            }

            DateTime Fecha          = Convert.ToDateTime(txtFecha.Text);
            Int32    CodRegistro    = Convert.ToInt32(Principal.CodigoPrincipalAbm);
            double   Importe        = fun.ToDouble(txtIngresarImporte.Text);
            double   Saldo          = fun.ToDouble(txtSaldo.Text);
            double   aPagar         = fun.ToDouble(txtIngresarImporte.Text);
            double   ImporteInicial = fun.ToDouble(txtImporte.Text);

            if (aPagar > Saldo)
            {
                Mensaje("El Importe a pagar supera el saldo");
                return;
            }
            Clases.cSaldoEfectivoPagar objSaldo = new Clases.cSaldoEfectivoPagar();

            Clases.cEfectivoaPagar obj = new Clases.cEfectivoaPagar();
            obj.ActualizarPago(CodRegistro, Fecha, Importe);
            string Descripcion = "PAGO EFECTIVO " + txtCliente.Text;

            objSaldo.InsertarSaldo(CodRegistro, Fecha, Importe);
            Descripcion = Descripcion + ", PATENTE " + txtPatente.Text;
            Clases.cMovimiento mov = new Clases.cMovimiento();
            mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, -1 * Importe, 0, 0, 0, 0, Fecha, Descripcion);
            Mensaje("Datos grabados correctamente");
            txtImporte.Text   = "";
            btnGrabar.Enabled = false;
        }
        private void btnAnular_Click(object sender, EventArgs e)
        {
            Clases.cFunciones fun = new Clases.cFunciones();
            if (fun.ValidarFecha(txtFecha.Text) == false)
            {
                Mensaje("La fecha ingresada es incorrecta");
                return;
            }
            double ImporteAnular = fun.ToDouble(txtTotalCobrado.Text);
            Int32  CodCobranza   = Convert.ToInt32(txtCodCobranza.Text);

            Clases.cMovimiento      mov = new Clases.cMovimiento();
            Clases.cCobranzaGeneral cob = new Clases.cCobranzaGeneral();
            DateTime fecha = Convert.ToDateTime(txtFecha.Text);

            cob.AnularCobranza(CodCobranza);
            string descrip = "ANULACIÓN " + txtDescripcion.Text;

            mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, -1 * ImporteAnular, 0, 0, 0, 0, fecha, descrip);
            GetCobranzas(CodCobranza);
            Mensaje("Datos grabados correctamente");
        }
Esempio n. 24
0
        private void btnGrabar_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 (txtImporteAPagar.Text == "")
            {
                MessageBox.Show("Debe ingresar un importe a pagar", Clases.cMensaje.Mensaje());
                return;
            }
            double Importe = fun.ToDouble(txtImporteAPagar.Text);
            double Saldo   = fun.ToDouble(txtSaldo.Text);

            if (Importe > Saldo)
            {
                MessageBox.Show("El monto a pagar supera el sado", Clases.cMensaje.Mensaje());
                return;
            }
            Int32 CodCheque = Convert.ToInt32(Principal.CodigoPrincipalAbm);

            Clases.cPagoCheque    pagoCheque = new Clases.cPagoCheque();
            Clases.cChequesaPagar cheque     = new Clases.cChequesaPagar();
            Clases.cMovimiento    mov        = new Clases.cMovimiento();
            DateTime Fecha = Convert.ToDateTime(txtFecha.Text);

            //cheque.PagarCheque(Convert.ToInt32(Principal.CodigoPrincipalAbm), Fecha);
            pagoCheque.InsertarPagoCheque(CodCheque, Importe, Fecha);
            string Descripcion = "PAGO DE CHEQUE " + txtCliente.Text.ToUpper();

            Descripcion = Descripcion + ", PATENTE " + txtPatente.Text;
            mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, -1 * Importe, 0, 0, 0, 0, Fecha, Descripcion);
            MessageBox.Show("Datos grabados correctamente", Clases.cMensaje.Mensaje());
            Cargar(CodCheque);
        }
Esempio n. 25
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            Clases.cFunciones fun = new Clases.cFunciones();
            if (Grilla.CurrentRow == null)
            {
                MessageBox.Show("Debe seleccionar un registro para continuar", Clases.cMensaje.Mensaje());
                return;
            }

            if (fun.ValidarFecha(txtFechaPago.Text) == false)
            {
                MessageBox.Show("La fecha de Pago Ingresada es incorrecta", Clases.cMensaje.Mensaje());
                return;
            }
            string msj    = "Confirma eliminar el Pago ";
            var    result = MessageBox.Show(msj, "Información",
                                            MessageBoxButtons.YesNo,
                                            MessageBoxIcon.Question);

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

            DateTime Fecha   = Convert.ToDateTime(txtFechaPago.Text);
            Int32    CodPago = Convert.ToInt32(Grilla.CurrentRow.Cells[0].Value);
            double   Importe = fun.ToDouble(Grilla.CurrentRow.Cells[2].Value.ToString());

            Clases.cPagoIntereses Pago = new Clases.cPagoIntereses();
            Pago.BorrarPago(CodPago);
            string Descripcion = "ANULACION PAGO " + txtNombre.Text;

            Clases.cMovimiento mov = new Clases.cMovimiento();
            mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, Importe, 0, 0, 0, 0, Fecha, Descripcion);
            MessageBox.Show("Datos grabados correctamente", Clases.cMensaje.Mensaje());
        }
Esempio n. 26
0
        private void btnAnular_Click(object sender, EventArgs e)
        {
            Clases.cFunciones fun = new Clases.cFunciones();
            string            msj = "Confirma anular el pago de la comisión ";
            var result            = MessageBox.Show(msj, "Información",
                                                    MessageBoxButtons.YesNo,
                                                    MessageBoxIcon.Question);

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

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

            Int32    CodComision = Convert.ToInt32(txtCodComision.Text);
            DateTime Fecha       = Convert.ToDateTime(txtFecha.Text);

            Clases.cComisionVendedor com = new Clases.cComisionVendedor();
            com.AnularPagoComision(CodComision);
            string Descripcion = "ANULACIÓN PAGO COMISIÓN " + txtNombre.Text + " " + txtApellido.Text;

            Descripcion = Descripcion + ", PATENTE " + txtPatente.Text;
            double Importe = fun.ToDouble(txtImporte.Text);

            Clases.cMovimiento mov = new Clases.cMovimiento();
            mov.RegistrarMovimientoDescripcion(-1, Principal.CodUsuarioLogueado, Importe, 0, 0, 0, 0, Fecha, Descripcion);
            MessageBox.Show("Datos grabados Correctamente", Clases.cMensaje.Mensaje());

            btnGrabar.Enabled = false;
            btnAnular.Enabled = false;
        }
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            Clases.cFunciones fun = new Clases.cFunciones();
            if (txtEfectivo.Text == "")
            {
                MessageBox.Show("Ingresar efectivo para continuar", Clases.cMensaje.Mensaje());
                return;
            }

            if (txtFecha.Text == "")
            {
                MessageBox.Show("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;
            }

            DateTime Fecha       = Convert.ToDateTime(txtFecha.Text);
            string   Descripcion = txtDescripcion.Text;
            Double   Importe     = fun.ToDouble(txtEfectivo.Text);

            // Clases.cFunciones fun = new Clases.cFunciones();
            if (cmbTipo.SelectedIndex == 1)
            {
                Importe = (-1) * Importe;
            }
            Clases.cMovimiento mov = new Clases.cMovimiento();
            mov.RegistrarMovimientoDescripcion(0, Principal.CodUsuarioLogueado, Importe, 0, 0, 0, 0, Fecha, Descripcion);
            MessageBox.Show("Datos grabados correctamente", Clases.cMensaje.Mensaje());
            txtEfectivo.Text    = "";
            txtDescripcion.Text = "";
        }
Esempio n. 28
0
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            Clases.cFunciones fun = new Clases.cFunciones();
            if (fun.ValidarFecha(txtFechaDesde.Text) == false)
            {
                MessageBox.Show("Fecha desde incorrecta", Clases.cMensaje.Mensaje());
                return;
            }

            if (fun.ValidarFecha(txtFechaHasta.Text) == false)
            {
                MessageBox.Show("Fecha hasta incorrecta", Clases.cMensaje.Mensaje());
                return;
            }

            if (Convert.ToDateTime(txtFechaDesde.Text) > Convert.ToDateTime(txtFechaHasta.Text))
            {
                MessageBox.Show("La fecha desde debe ser inferior a la fecha hasta", Clases.cMensaje.Mensaje());
                return;
            }

            DateTime FechaDesde = Convert.ToDateTime(txtFechaDesde.Text);
            DateTime FechaHasta = Convert.ToDateTime(txtFechaHasta.Text);
            string   Concepto   = txtConcepto.Text;

            Clases.cMovimiento mov  = new Clases.cMovimiento();
            DataTable          trdo = mov.GetMovimientoxFecha(FechaDesde, FechaHasta, Concepto);

            DataTable tResul = new DataTable();

            tResul.Columns.Add("Fecha");
            tResul.Columns.Add("Descripcion");
            tResul.Columns.Add("Ingreso");
            tResul.Columns.Add("Egreso");
            double TotalIngresos = 0;
            double TotalEgresos  = 0;

            for (int i = 0; i < trdo.Rows.Count; i++)
            {
                string  sFecha       = trdo.Rows[i]["Fecha"].ToString();
                string  sDescripcion = trdo.Rows[i]["Descripcion"].ToString();
                double  Importe      = Convert.ToDouble(trdo.Rows[i]["ImporteEfectivo"].ToString());
                DataRow r            = tResul.NewRow();
                r["Fecha"]       = sFecha;
                r["Descripcion"] = sDescripcion;
                if (Importe > 0)
                {
                    TotalIngresos = TotalIngresos + Importe;
                    r["Ingreso"]  = Importe.ToString();
                    r["Egreso"]   = "";
                }
                else
                {
                    TotalEgresos = TotalEgresos + Importe;
                    Importe      = (-1) * Importe;
                    r["Ingreso"] = "";
                    r["Egreso"]  = Importe.ToString();
                }
                tResul.Rows.Add(r);
            }
            tResul = fun.TablaaMiles(tResul, "Ingreso");
            tResul = fun.TablaaMiles(tResul, "Egreso");
            trdo   = fun.TablaaMiles(trdo, "ImporteEfectivo");
            //Grilla.DataSource = trdo;
            Grilla.DataSource            = tResul;
            Grilla.Columns[1].Width      = 400;
            Grilla.Columns[2].Width      = 150;
            Grilla.Columns[3].Width      = 155;
            Grilla.Columns[1].HeaderText = "Descripción";
            double Total = TotalIngresos + TotalEgresos;

            txtTotal.Text = Total.ToString();
            txtTotal.Text = fun.FormatoEnteroMiles(txtTotal.Text);
        }
Esempio n. 29
0
        private void btnAnular_Click(object sender, EventArgs e)
        {
            if (Grilla.CurrentRow == null)
            {
                MessageBox.Show("Debe seleccionar un registro para continuar ", Clases.cMensaje.Mensaje());
                return;
            }

            string msj    = "Confirma anular la venta ";
            var    result = MessageBox.Show(msj, "Información",
                                            MessageBoxButtons.YesNo,
                                            MessageBoxIcon.Question);

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

            string Patente  = Grilla.CurrentRow.Cells[4].Value.ToString();
            string CodVenta = Grilla.CurrentRow.Cells[0].Value.ToString();

            //
            Int32  CodAutoPartePago1     = 0;
            Int32  CodAutoPartePago2     = 0;
            double ImportePagadoCobranza = 0;
            double ImportePagadoCuotas   = 0;
            double ImportePagadoPrenda   = 0;
            double ImportePagadoCheque   = 0;

            Clases.cVenta    objVenta2 = new Clases.cVenta();
            Clases.cCobranza cobranza  = new Clases.cCobranza();
            Clases.cPrenda   prenda    = new Clases.cPrenda();
            ImportePagadoCobranza = cobranza.GetImportePagado(Convert.ToInt32(CodVenta));
            Clases.cCuota  cuota  = new Clases.cCuota();
            Clases.cCheque cheque = new Clases.cCheque();
            ImportePagadoCuotas = cuota.ImportePagado(Convert.ToInt32(CodVenta));
            ImportePagadoPrenda = prenda.ImportePagado(Convert.ToInt32(CodVenta));
            ImportePagadoCheque = cheque.ImportePagado(Convert.ToInt32(CodVenta));
            DataTable tresult2 = objVenta2.GetAutosPartePago(Convert.ToInt32(CodVenta));

            for (int z = 0; z < tresult2.Rows.Count; z++)
            {
                if (z == 0)
                {
                    if (tresult2.Rows[0]["CodAuto"].ToString() != "")
                    {
                        CodAutoPartePago1 = Convert.ToInt32(tresult2.Rows[0]["CodAuto"].ToString());
                    }
                }

                if (z == 1)
                {
                    if (tresult2.Rows[0]["CodAuto"].ToString() != "")
                    {
                        CodAutoPartePago2 = Convert.ToInt32(tresult2.Rows[0]["CodAuto"].ToString());
                    }
                }
            }

            double ImporteAutoPartePago = 0;
            double ImporteCredito       = 0;
            double ImporteEfectivo      = 0;
            double ImportePrenda        = 0;
            double ImporteCobranza      = 0;
            double ImporteBanco         = 0;
            double CodAutoVendido       = -1;
            double CodAutoPartePago     = -1;
            double ImporteAutoNegativo  = 0;
            double ImporteSenia         = 0;

            Clases.cVenta objVenta = new Clases.cVenta();

            if (CodVenta != "")
            {
                Clases.cMovimiento objMov = new Clases.cMovimiento();
                ImporteAutoNegativo = objMov.GetImporteAutoNegativoxCodVenta(Convert.ToInt32(CodVenta));
                ImporteAutoNegativo = -1 * ImporteAutoNegativo;

                DataTable trdo = objVenta.GetVentaxCodigo(Convert.ToInt32(CodVenta));
                if (trdo.Rows.Count > 0)
                {
                    ImporteCredito  = Convert.ToDouble(trdo.Rows[0]["ImporteCredito"].ToString());
                    ImporteEfectivo = Convert.ToDouble(trdo.Rows[0]["ImporteEfectivo"].ToString());
                    ImportePrenda   = Convert.ToDouble(trdo.Rows[0]["ImportePrenda"].ToString());
                    ImporteCobranza = Convert.ToDouble(trdo.Rows[0]["ImporteCobranza"].ToString());
                    if (trdo.Rows[0]["PrecioSenia"].ToString() != "")
                    {
                        ImporteSenia = Convert.ToDouble(trdo.Rows[0]["PrecioSenia"].ToString());
                    }
                    ImporteEfectivo = ImporteEfectivo + ImporteSenia;
                    if (trdo.Rows[0]["CodAutoVendido"].ToString() != "")
                    {
                        CodAutoVendido = Convert.ToInt32(trdo.Rows[0]["CodAutoVendido"].ToString());
                    }

                    if (trdo.Rows[0]["CodAutoPartePago"].ToString() != "")
                    {
                        CodAutoPartePago = Convert.ToInt32(trdo.Rows[0]["CodAutoPartePago"].ToString());
                    }

                    if (trdo.Rows[0]["ImporteAutoPartePago"].ToString() != "")
                    {
                        ImporteAutoPartePago = Convert.ToDouble(trdo.Rows[0]["ImporteAutoPartePago"].ToString());
                    }

                    if (trdo.Rows[0]["ImporteBanco"].ToString() != "")
                    {
                        ImporteBanco = Convert.ToDouble(trdo.Rows[0]["ImporteBanco"].ToString());
                    }
                }

                //importe total del credito en documentos usado mas abajo
                double        ImporteTotalDocumento = 0;
                Clases.cCuota objCuotas             = new Clases.cCuota();
                ImporteTotalDocumento = objCuotas.GetSaldoDeudaCuotas(Convert.ToInt32(CodVenta));
                SqlConnection con = new SqlConnection();
                con.ConnectionString = Clases.cConexion.Cadenacon();
                con.Open();
                SqlTransaction Transaccion;
                Transaccion = con.BeginTransaction();
                SqlCommand Comand = new SqlCommand();
                Comand.Connection  = con;
                Comand.Transaction = Transaccion;
                try
                {
                    //vuelvo el auto al stock
                    //string sql = "insert into StockAuto(CodAuto,FechaAlta,CodUsuario)";
                    //sql = sql + " values(" + CodAutoVendido.ToString();
                    //sql = sql + "," + "'" + DateTime.Now.ToShortDateString() + "'";
                    //sql = sql + "," + Principal.CodUsuarioLogueado;
                    //sql = sql + ")";
                    string sql = "update StockAuto  set FechaBaja = null";
                    sql = sql + " where CodStock=";
                    sql = sql + " (select max(CodStock) from StockAuto sa ";
                    sql = sql + " where sa.CodAuto =" + CodAutoVendido.ToString();
                    sql = sql + ")";
                    Comand.CommandText = sql;
                    Comand.ExecuteNonQuery();
                    //si pago con un auto le doy de baja
                    if (CodAutoPartePago > 0)
                    {
                        SqlCommand Comand2 = new SqlCommand();
                        Comand2.Connection  = con;
                        Comand2.Transaction = Transaccion;
                        string sqlStock = "update StockAuto";
                        sqlStock            = sqlStock + " set FechaBaja =" + "'" + DateTime.Now.ToShortDateString() + "'";
                        sqlStock            = sqlStock + " where CodAuto =" + CodAutoPartePago;
                        Comand2.CommandText = sqlStock;
                        Comand2.ExecuteNonQuery();
                    }
                    //borro la venta
                    string     sql3    = "delete from venta where CodVenta=" + CodVenta.ToString();
                    SqlCommand Comand3 = new SqlCommand();
                    Comand3.Connection  = con;
                    Comand3.Transaction = Transaccion;
                    Comand3.CommandText = sql3;
                    Comand3.ExecuteNonQuery();

                    //borro las cuotas

                    string     sql4    = "delete from cuotas where CodVenta=" + CodVenta.ToString();
                    SqlCommand Comand4 = new SqlCommand();
                    Comand4.Connection  = con;
                    Comand4.Transaction = Transaccion;
                    Comand4.CommandText = sql4;
                    Comand4.ExecuteNonQuery();

                    //borro la prenda

                    string     sqlPrenda    = "delete from Prenda where CodVenta=" + CodVenta.ToString();
                    SqlCommand ComandPrenda = new SqlCommand();
                    ComandPrenda.Connection  = con;
                    ComandPrenda.Transaction = Transaccion;
                    ComandPrenda.CommandText = sqlPrenda;
                    ComandPrenda.ExecuteNonQuery();

                    //borro los cheques

                    string     sqlCheque    = "delete from Cheque where CodVenta=" + CodVenta.ToString();
                    SqlCommand ComandCheque = new SqlCommand();
                    ComandCheque.Connection  = con;
                    ComandCheque.Transaction = Transaccion;
                    ComandCheque.CommandText = sqlCheque;
                    ComandCheque.ExecuteNonQuery();

                    //si hubo un saldo de cobranza tb lo anulo
                    //ya que significa que habia pagado una cobranza
                    //y debo volver a sacar el efectivo cobrado

                    //borro las cobranzas

                    string     sqlCobranza    = "delete from Cobranza where CodVenta=" + CodVenta.ToString();
                    SqlCommand ComandCobranza = new SqlCommand();
                    ComandCobranza.Connection  = con;
                    ComandCobranza.Transaction = Transaccion;
                    ComandCobranza.CommandText = sqlCobranza;
                    ComandCobranza.ExecuteNonQuery();



                    //borro las comisiones
                    if (ImportePagadoCobranza > 0)
                    {
                        //vuelvo el efectivo atraz
                        ImporteEfectivo = ImporteEfectivo + ImportePagadoCobranza;
                        //
                    }

                    if (ImportePagadoCuotas > 0)
                    {
                        ImporteEfectivo = ImporteEfectivo + ImportePagadoCuotas;
                    }

                    if (ImportePagadoPrenda > 0)
                    {
                        ImporteEfectivo = ImporteEfectivo + ImportePagadoPrenda;
                    }

                    if (ImportePagadoCheque > 0)
                    {
                        ImporteEfectivo = ImporteEfectivo + ImportePagadoCheque;
                    }

                    string     sqlComision    = "delete from ComisionVendedor where CodVenta=" + CodVenta.ToString();
                    SqlCommand ComandComision = new SqlCommand();
                    ComandComision.Connection  = con;
                    ComandComision.Transaction = Transaccion;
                    ComandComision.CommandText = sqlComision;
                    ComandComision.ExecuteNonQuery();

                    //Inserto el movimiento con los valores opuesto
                    ImporteCredito        = ImporteCredito * (-1);
                    ImporteTotalDocumento = ImporteTotalDocumento * (-1);
                    ImporteEfectivo       = ImporteEfectivo * (-1);
                    ImportePrenda         = ImportePrenda * (-1);
                    ImporteCobranza       = ImporteCobranza * (-1);
                    ImporteBanco          = ImporteBanco * (-1);
                    ImporteAutoPartePago  = (-1) * ImporteAutoPartePago;


                    string Descrip = "ANULACION VENTA " + Patente.ToString();
                    string sql5    = "Insert into Movimiento(ImporteDocumento,ImporteEfectivo";
                    sql5 = sql5 + ",ImportePrenda,ImporteCobranza,CodUsuario,Fecha,ImporteAuto,ImporteBanco,Descripcion)";
                    sql5 = sql5 + "Values(" + ImporteTotalDocumento.ToString().Replace(",", ".");
                    sql5 = sql5 + "," + ImporteEfectivo.ToString().Replace(",", ".");
                    sql5 = sql5 + "," + ImportePrenda.ToString().Replace(",", ".");
                    sql5 = sql5 + "," + ImporteCobranza.ToString().Replace(",", ".");
                    sql5 = sql5 + "," + Principal.CodUsuarioLogueado.ToString();
                    sql5 = sql5 + "," + "'" + DateTime.Now.ToShortDateString() + "'";
                    sql5 = sql5 + "," + ImporteAutoPartePago.ToString().Replace(",", ".");
                    sql5 = sql5 + "," + ImporteBanco.ToString().Replace(",", ".");
                    sql5 = sql5 + "," + "'" + Descrip + "'";
                    sql5 = sql5 + ")";
                    //finalmente inserto el movimiento opuesto
                    //para que vuelva el valor de la cuenta vehiculo
                    SqlCommand Comand5 = new SqlCommand();
                    Comand5.Connection  = con;
                    Comand5.Transaction = Transaccion;
                    Comand5.CommandText = sql5;
                    Comand5.ExecuteNonQuery();

                    string sql5b = "Insert into Movimiento(ImporteDocumento,ImporteEfectivo";
                    sql5b = sql5b + ",ImportePrenda,ImporteCobranza,CodUsuario,Fecha,ImporteAuto,ImporteBanco)";
                    sql5b = sql5b + "Values(" + ImporteTotalDocumento.ToString().Replace(",", ".");
                    sql5b = sql5b + ",0";
                    sql5b = sql5b + ",0";
                    sql5b = sql5b + ",0";
                    sql5b = sql5b + "," + Principal.CodUsuarioLogueado.ToString();
                    sql5b = sql5b + "," + "'" + DateTime.Now.ToShortDateString() + "'";
                    sql5b = sql5b + "," + ImporteAutoNegativo.ToString().Replace(",", ".");
                    sql5b = sql5b + ",0";
                    sql5b = sql5b + ")";
                    //finalmente inserto el movimiento opuesto del auto
                    //para que vuelva el valor de la cuenta vehiculo
                    SqlCommand Comand5b = new SqlCommand();
                    Comand5b.Connection  = con;
                    Comand5b.Transaction = Transaccion;
                    Comand5b.CommandText = sql5b;
                    Comand5b.ExecuteNonQuery();

                    string     sql6    = "delete from VentasxAuto where CodVenta =" + CodVenta.ToString();
                    SqlCommand Comand6 = new SqlCommand();
                    Comand6.Connection  = con;
                    Comand6.Transaction = Transaccion;
                    Comand6.CommandText = sql6;
                    Comand6.ExecuteNonQuery();

                    string     sql7    = "delete from GastosPagar where CodVenta =" + CodVenta.ToString();
                    SqlCommand Comand7 = new SqlCommand();
                    Comand7.Connection  = con;
                    Comand7.Transaction = Transaccion;
                    Comand7.CommandText = sql7;
                    Comand7.ExecuteNonQuery();

                    // doy de baja los autos del stock que ingresaron
                    // como parte de pago
                    if (CodAutoPartePago1 > 0)
                    {
                        string sql8 = "update StockAuto set FechaBaja=" + "'" + DateTime.Now.ToShortDateString() + "'";
                        sql8 = sql8 + " where CodAuto=" + CodAutoPartePago1.ToString();
                        SqlCommand Comand8 = new SqlCommand();
                        Comand8.Connection  = con;
                        Comand8.Transaction = Transaccion;
                        Comand8.CommandText = sql8;
                        Comand8.ExecuteNonQuery();
                    }

                    Transaccion.Commit();
                    con.Close();
                    GetVentas();
                    MessageBox.Show("Venta anulada correctamente", Clases.cMensaje.Mensaje());
                }
                catch (Exception ex)
                {
                    Transaccion.Rollback();
                    MessageBox.Show("Hubo un error en el proceso de anulación de venta", Clases.cMensaje.Mensaje());
                }
            }
        }
Esempio n. 30
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();
        }