Todo Aplicaciones, Temas, Juegos en APK y Noticias de S.O. Android

Aqui encontraras APK y noticias de todas las Aplicaciones, temas, Juegos para S. O. Android contamos con los mas buscados APK y noticias actualizadas.

Los Manuales y Programas

Encontraras todo tipo de Manules y tutoriales como instalacion, configuracion programacion, consultas de todo tipo de programas SQL, Visual Studio, Java, Programas de S.O. Windows.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.This theme is Bloggerized by Lasantha Bandara - Premiumbloggertemplates.com.

Video

viernes, 27 de abril de 2012

MANUAL Y TUTORIALES DE JAVA

Manual y tutoriales de JAVA - el manual es la biblia de java y el tutorial esta por capitulos


DESCARGA:
http://www.mediafire.com/?blc4067fpx8udis

CONTRASEÑA:
todotutopw

sábado, 21 de abril de 2012

Pronosticar la venta por año, semestre - SQL y Visual Studio

veremos como pronosticar la venta por año y dependiendo por el año del dato podremos saber si el año tiene 1 o 2 semestres y nos lo mostrata en un listview y nos hallara el total de la venta.


PRONOSTICO DE VENTAS POR AÑO, SEMESTRE

LEVANTAMOS LA BASE DE DATOS NEPTUNO
ABRIMOS VISUAL STUDIO Y CREAMOS UNA NUEVA APLICACIÓN


DISEÑAMOS EL FORMULARIO 


COMO PUEDEN OBSERVAR PARA PODER HALLAR EL SEMESTRE TENEMOS QUE DESGLOSARLO DESDE EL TRIMESTRE.


CODIGO SQL PARA LA APLICACIÓN: PROCEDIMIENTO ALMACENADO:
--seleccionamos el nombre de la compañia,Convertir la fecha de año,mes,dia a dia,mes,año y que sea de valor varchar,
--se convertira la fechapedido a trimestre y de trimestre se convertira en semestre,
--tambien se seleccionara el nombre de producto, y se hallara la venta que sera  el preciounitario * cantidad - el descuento y te dara la venta
create procedure pa_totalv
select Clientes.NombreCompañía, fechsp=convert(varchar,FechaPedido,103),
case DATEPART(QUARTER,fechapedido)
when 1 then 's1'
when 2 then 's1'
else
's2'
end as semestre, Productos.NombreProducto,
venta=[Detalles de pedidos].PrecioUnidad * [Detalles de pedidos].Cantidad - [Detalles de pedidos].Descuento
 from Clientes inner join Pedidos
 on
  Clientes.IdCliente = Pedidos.IdCliente
  inner join [Detalles de pedidos]
  on
  Pedidos.IdPedido=[Detalles de pedidos].IdPedido
  inner join Productos
  on
  [Detalles de pedidos].IdProducto=Productos.IdProducto

AGREGAMOS COLUMNAS AL LISTVIEW

AÑADIMOS 5 COLUMNAS CON LOS TEXT COMPAÑÍA, FECHA, SEMESTRE, PRODUCTO, VENTA.



PARA QUE MUESTRE LOS DETALLES EN EL LISTVIEW


PARA VISUALIZARLO CON LINEAS

COMENSAMOS A PROGRAMAR EN EL BOTON CONSULTAR


PERO ANTES AGREGAMOS UN MODULO PARA LA CONEXION


COMO PUEDEN VER EL CODIGO DEL MODULO CONEXION

AHORA PROCEDEREMOS A PROGRAMAR EN EL BOTON CONSULTAR DEL FORMULARIO:

 como pueden ver ese es el codigo para que cargue el procedimiento almacando ya realizado con este codigo solo podran ver los datos cargados en el listview
ahora programaremos para el load
Doble click en el formulario afuera para poder entrar al load
 CREAR PROCEDIMIENTO PARA EL AÑO:
create procedure pa_cboaño
as
select distinct YEAR(fechapedido) from Pedidos
order by YEAR(FechaPedido)
PARA PROGRAMAR Y QUE NOS MUESTRE EL AÑO EN EL COMBOBOX LO QUE HAREMOS ES PROGRAMAR EN EL FORMULARIO:

LO QUE SE MUESTRA A CONTINUACION ES EL CODIGO DEL LOAD PARA QUE PUEDA MOSTRAR EL AÑO.


CODIGO:
   Dim cn As New SqlConnection

        Dim comando As New SqlCommand
        Dim lector As SqlDataReader
        Dim fila As ListViewItem
        Try
            cn.ConnectionString = cadena
            cn.Open()
            With comando
                .CommandText = "pa_cboaño"
                .CommandType = CommandType.StoredProcedure
                .Connection = cn
            End With
            lector = comando.ExecuteReader

            If lector.HasRows = True Then
                While lector.Read
                  
                    Me.ComboBox1.Items.Add(CStr(lector.Item(0)))
                End While
            End If
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        Finally
            If cn.State = ConnectionState.Open Then
                cn.Close()
                cn.Dispose()
            End If
        End Try


EN EJECUCIÓN:
AHORA CREAREMOS UN PROCEDIMIENTO PARA QUE DEPENDIENDO DEL AÑO NOS MUESTRE CUANTOS SEMESTRES TENEMOS EN LOS AÑOS.

create procedure pa_semestrexaño
@año int
as
select distinct case DATEPART(QUARTER,fechapedido)
when 1 then 's1'
when 2 then 's1'
else
's2'
end as semestre from pedidos
where year (fechapedido)=@año

EJECUTANDO EL PROCEDIMIENTO:

pa_semestrexaño '1997'

EN EJECUCIÓN:



AHORA EN EL COMBOBOX1 DEL AÑO:
HAREMOS QUE EN EL COMBOBOX SEMESTRE CARGUE DEPENDIENDO DEL COMBOBOX AÑO, ENTONCES LO QUE AREMOS ES PROGRAMAR EN EL COMBOBOX AÑO. DOBLE CLICK

ESTE SERA EL CODIGO QUE DEBERAN COLOCAR EN EL COMBOBOX1

CODIGO:
Dim cn As New SqlConnection
        Dim comando As New SqlCommand
        Dim lector As SqlDataReader
        Dim fila As ListViewItem
        Try
            cn.ConnectionString = cadena
            cn.Open()
            With comando
                .CommandText = "pa_semestrexaño"
                .CommandType = CommandType.StoredProcedure
                .Parameters.AddWithValue("año", Me.ComboBox1.Text.Trim)
                .Connection = cn
            End With
            lector = comando.ExecuteReader
            Me.ComboBox2.Text = ""
            Me.ComboBox2.Items.Clear()
            If lector.HasRows = True Then
                While lector.Read

                    Me.ComboBox2.Items.Add(CStr(lector.Item(0)))
                End While
            End If
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        Finally
            If cn.State = ConnectionState.Open Then
                cn.Close()
                cn.Dispose()
            End If
        End Try

AHORA HAREMOS QUE AL SELECCIONAR EL AÑO MAS EL SEMESTRE NOS CARGUE EN EL LISTVIEW LOS DATOS SELECCIONADOS. (HAREMOS UNA MODIFICACION AL PROCEDMIENTO PA_TOTALV)

CODIGO DEL PROCEDIMIENTO MODIFICADO:

alter procedure pa_totalv
@año int,
@semestre char(2)
as
select Clientes.NombreCompañía, fechsp=convert(varchar,FechaPedido,103),
case DATEPART(QUARTER,fechapedido)
when 1 then 's1'
when 2 then 's1'
else
's2'
end as semestre, Productos.NombreProducto,
venta=[Detalles de pedidos].PrecioUnidad * [Detalles de pedidos].Cantidad - [Detalles de pedidos].Descuento
 from Clientes inner join Pedidos
 on
  Clientes.IdCliente = Pedidos.IdCliente
  inner join [Detalles de pedidos]
  on
  Pedidos.IdPedido=[Detalles de pedidos].IdPedido
  inner join Productos
  on
  [Detalles de pedidos].IdProducto=Productos.IdProducto
  where YEAR(fechapedido)= @año and
  case DATEPART(QUARTER,fechapedido)
when 1 then 's1'
when 2 then 's1'
else
's2'
end = @semestre

EN EN FORMULARIO EDITAREMOS  EN EL BOTON DOBLE CLICK Y COMENZAREMOS A EDITAR






 CODIGO:
Dim cn As New SqlConnection
        Dim comando, c2 As New SqlCommand
        Dim lector, l2 As SqlDataReader
        Dim fila As ListViewItem
        Dim suma As Double
        suma = 0
        Try
            cn.ConnectionString = cadena
            cn.Open()
            With comando
                .CommandText = "pa_totalv"
                .CommandType = CommandType.StoredProcedure
                .Parameters.AddWithValue("@año", ComboBox1.Text.Trim)
                .Parameters.AddWithValue("@semestre", ComboBox2.Text.Trim)
                .Connection = cn
            End With
            lector = comando.ExecuteReader
            Me.lvresultado.Items.Clear() '--limpiar el listview para que no carge y vuelva a cargar
            If lector.HasRows = True Then
                While lector.Read
                    fila = New ListViewItem
                    fila.Text = CStr(lector.Item(0))
                    fila.SubItems.Add(CStr(lector.Item(1)))
                    fila.SubItems.Add(CStr(lector.Item(2)))
                    fila.SubItems.Add(CStr(lector.Item(3)))
                    fila.SubItems.Add(CStr(lector.Item(4)))
                    suma += lector.Item(4)
                    Me.lvresultado.Items.Add(fila)
                End While
                Me.TextBox1.Text = suma
            End If

EL RESULTADO DE TODO SERA LO SIGUIENTE:



DESCARGAR
1.- BASE DE DATOS
2.- APLICACIÓN


martes, 17 de abril de 2012

Conexion Base de datos a Visual Studio

ejemplo