Ejemplo n.º 1
0
        public static int Pagar(Pago pPago)
        {
            int             retorno  = 0;
            MySqlConnection conexion = bdComun.obtenerConexion();
            MySqlCommand    comando  = new MySqlCommand(string.Format(
                                                            "INSERT INTO PAGO VALUES ('{0}','{1}','{2}', '{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}')",
                                                            pPago.ID_PAGO, pPago.ID_CUENTA, pPago.FECHA_ABONO, pPago.TIPO_PAGO, pPago.MONTO, pPago.DESCRIPCION, pPago.TARJETA, pPago.TIPO, pPago.REF, pPago.BANCO, pPago.CHEQUE),
                                                        conexion);

            retorno = comando.ExecuteNonQuery();
            //1 insertado | 0 error
            conexion.Close();
            return(retorno);
        }
Ejemplo n.º 2
0
        //TCODIGO INUTIL
        public static int Modificar(Pago pPago, int idPago)
        {
            int retorno = 0;

            MySqlConnection conexion = bdComun.obtenerConexion();
            MySqlCommand    comando  = new MySqlCommand(string.Format(
                                                            "update pago set MONTO='{0}'", pPago.MONTO, idPago), conexion);


            retorno = comando.ExecuteNonQuery();

            //1 insertado | 0 error
            conexion.Close();
            return(retorno);
        }
Ejemplo n.º 3
0
        public static Pago ConsultarPagos(int ID_CUENTA)
        {
            Pago            pPago    = new Pago();
            MySqlConnection conexion = bdComun.obtenerConexion();
            MySqlCommand    _comando = new MySqlCommand(String.Format(
                                                            "SELECT ID_PAGO, ID_CUENTA, FECHA_ABONO, TIPO_PAGO, MONTO, DESCRIPCION FROM PAGO where ID_CUENTA ='{0}' ", ID_CUENTA),
                                                        conexion);
            MySqlDataReader _reader = _comando.ExecuteReader();

            while (_reader.Read())
            {
                pPago.ID_PAGO     = _reader.GetInt32(0);
                pPago.ID_CUENTA   = _reader.GetInt32(1);
                pPago.FECHA_ABONO = _reader.GetString(2);
                pPago.TIPO_PAGO   = _reader.GetInt32(3);
                pPago.MONTO       = _reader.GetDecimal(4);
                pPago.DESCRIPCION = _reader.GetString(5);
            }
            conexion.Close();
            return(pPago);
        }
Ejemplo n.º 4
0
        public static List <Pago> ReportePagos()
        {
            List <Pago>     _lista   = new List <Pago>();
            MySqlConnection conexion = bdComun.obtenerConexion();
            MySqlCommand    _comando = new MySqlCommand(String.Format(
                                                            "SELECT ID_PAGO, ID_CUENTA, FECHA_ABONO, TIPO_PAGO, MONTO, DESCRIPCION FROM PAGO ;"),
                                                        conexion);
            MySqlDataReader _reader = _comando.ExecuteReader();

            while (_reader.Read())
            {
                Pago pPago = new Pago();
                pPago.ID_PAGO     = _reader.GetInt32(0);
                pPago.ID_CUENTA   = _reader.GetInt32(1);
                pPago.FECHA_ABONO = _reader.GetString(2);
                pPago.TIPO_PAGO   = _reader.GetInt32(3);
                pPago.MONTO       = _reader.GetDecimal(4);
                pPago.DESCRIPCION = _reader.GetString(5);
                _lista.Add(pPago);
            }
            conexion.Close();
            return(_lista);
        }
Ejemplo n.º 5
0
        public detalleForm(Factura _factura, bool admin)
        {
            InitializeComponent();

            if (admin == false)
            {
                btnAnular.Enabled = false;
            }

            _cliente = ClienteDBM.ObtenerCliente(_factura.ID_CLIENTE, null);
            _pago    = PagoDBM.ConsultarUnicoPago(_factura.ID_CUENTA);
            _cuenta  = CuentaDBM.ObtenerCuentaporID_cuenta(_factura.ID_CUENTA);
            _detalle = DetalleDBM.ObtenerDetalle(_factura.ID_DETALLE);
            _trabajo = TrabajoDBM.TrabajoFecha(_factura.ID_FACTURA);
            _usuario = UsuarioDBM.ObtenerUsuario(_factura.ID_USUARIO);

            vistaFactura.DataSource = ProductoVendidoDBM.ObtenerProductosDetalle(_factura.ID_DETALLE);

            txtId.Text              = _factura.ID_CLIENTE;
            txtName.Text            = _cliente.NOMBRE;
            txtTelefono.Text        = _cliente.TELEFONO;
            txtDireccion.Text       = _cliente.DIRECCION;
            txtDescuento.Text       = _factura.FACTOR_DESCUENTO.ToString();
            txtDate.Text            = _factura.FECHA;
            ordenTipo.SelectedIndex = _factura.TIPO;
            lblNumeroFactura.Text   = _factura.INDICE.ToString();

            metodoPago.SelectedIndex = _pago.TIPO_PAGO;

            txtTarjeta.Text = _pago.TARJETA;
            txtTipo.Text    = _pago.TIPO;
            txtREF.Text     = _pago.REF;
            txtBanco.Text   = _pago.BANCO;
            txtChque.Text   = _pago.CHEQUE;

            decimal a = _detalle.SUBTOTAL * 0.12m;

            txtIva.Text = a.ToString();

            txtTotal.Text    = _cuenta.TOTAL.ToString();
            txtSaldo.Text    = _cuenta.SALDO.ToString();
            txtSubtotal.Text = _detalle.SUBTOTAL.ToString();

            txtFechaEntrega.Text = _trabajo.FECHA_ENTREGA;
            txtResponsable.Text  = _usuario.NOMBRE + " " + _usuario.APELLIDO;

            if (_cuenta.TOTAL == 0)
            {
                txtId.ForeColor        = System.Drawing.Color.Red;
                txtName.ForeColor      = System.Drawing.Color.Red;
                txtTelefono.ForeColor  = System.Drawing.Color.Red;
                txtDireccion.ForeColor = System.Drawing.Color.Red;
                txtDate.ForeColor      = System.Drawing.Color.Red;
                txtTotal.ForeColor     = System.Drawing.Color.Red;

                txtId.Text        = "ANULADO";
                txtName.Text      = "ANULADO";
                txtTelefono.Text  = "ANULADO";
                txtDireccion.Text = "ANULADO";
                txtDate.Text      = "ANULADO";

                btnAnular.Enabled = false;
            }
        }