Exemple #1
0
        private void pagar()
        {
            var        connection = DBConnection.getInstance().getConnection();
            SqlCommand query      = new SqlCommand("POSTRESQL.registrarPago", connection);

            query.CommandType = CommandType.StoredProcedure;
            MedioPago medioPago = (MedioPago)(this.comboMedioPago.SelectedItem);

            query.Parameters.Add(new SqlParameter("@medio_pago", Convert.ToInt32(medioPago.code)));
            query.Parameters.Add(new SqlParameter("@sucursal", sucursalCode));
            query.Parameters.Add(new SqlParameter("@usuario", username));
            AbmFactura.Cliente cliente = (AbmFactura.Cliente)(this.comboCliente.SelectedItem);
            query.Parameters.Add(new SqlParameter("@cliente", Convert.ToInt32(cliente.code)));
            query.Parameters.Add(new SqlParameter("@fecha", DateTime.Today));
            query.Parameters.Add(new SqlParameter("@total", importeTotal));

            connection.Open();
            query.ExecuteNonQuery();
            connection.Close();

            //PONER FACTURA COMO PAGA
            foreach (Decimal factura in facturas)
            {
                PagarFactura(factura);
            }
        }
Exemple #2
0
        public void PagarFactura(Decimal idFactura)
        {
            var        connection = DBConnection.getInstance().getConnection();
            SqlCommand query      = new SqlCommand("POSTRESQL.pagar_factura", connection);

            query.CommandType = CommandType.StoredProcedure;
            query.Parameters.Add(new SqlParameter("@usuario", username));
            query.Parameters.Add(new SqlParameter("@factura", idFactura));
            query.Parameters.Add(new SqlParameter("@fecha", DateTime.Today));
            AbmFactura.Cliente cliente = (AbmFactura.Cliente)(this.comboCliente.SelectedItem);
            query.Parameters.Add(new SqlParameter("@cliente", Convert.ToInt32(cliente.code)));
            query.Parameters.Add(new SqlParameter("@importe", importeTotal));
            query.Parameters.Add(new SqlParameter("@sucursal", sucursalCode));
            MedioPago medioPago = (MedioPago)(this.comboMedioPago.SelectedItem);

            query.Parameters.Add(new SqlParameter("@medio", Convert.ToInt32(medioPago.code)));
            connection.Open();
            query.ExecuteNonQuery();
            connection.Close();
        }