Está en la página 1de 9

Proyecto Lector código QR

HASTA DONDE LLEVAMOS:


Lo que llevamos hasta el momento del lector de código QR es que generamos una base de datos
en Excel utilizando las macros para lograr su programación y un óptimo funcionamiento.

El cual consiste en 9 celdas que tomara ciertos parámetros requeridos como los son:

-Ítem

-Serial

- modelo

- Descripción del equipo

- Placa

- Marca

- Ubicación

- Actualización

QUE HEMOS HECHO HASTA AHORA:


Hemos intentado generar un código QR para un parámetro, pero aún no lo hemos logrado.

QUE NOS HACE FALTA:


Lo único que nos hace falta es enlazar Microsoft Excel con Google para asi mismo generar un
código y mostrarlo en tiempo real si está activo o no.

¿CÓMO FUNCIONARA?
Se estima que el proyecto de Lector de código QR funcionara primero que todo almacenando
cualquier ítem nuevo a la base de datos, una vez este generado el ítem nos va a cargar
inmediatamente un código QR el cual podremos leer con nuestro dispositivo móvil y nos indicara
si la casilla que programamos está disponible o no.
SE ADJUNTA PROGRAMACIÓN DE BASE DE DATOS:

Sub irr_BD()

Application.ScreenUpdating = False

'

' irr_BD Macro

'

'

Sheets("BD").Select

End Sub

Sub grabar() 'PARA CREAR MACRO USAR SUB

Application.ScreenUpdating = False

If Range("D8").Value = Empty Or Range("D10").Value = Empty Or Range("D12").Value = Empty Or


Range("D14").Value = Empty Or Range("G8").Value = Empty Or Range("G10").Value = Empty Or
Range("G12").Value = Empty Or Range("G14").Value = Empty Or Range("J8").Value = Empty Then

MsgBox ("Datos Vacios")

Exit Sub

End If

Sheets("BD").Select

Range("A6").EntireRow.Insert
Sheets("Registro").Select

'ITEM

Range("D8").Copy

Sheets("BD").Select

Range("A6").PasteSpecial xlPasteValues

Sheets("Registro").Select

'SERIAL

Range("D10").Copy

Sheets("BD").Select

Range("B6").PasteSpecial xlPasteValues

Sheets("Registro").Select

'DESCRIPCION DEL EQUIPO

Range("D14").Copy

Sheets("BD").Select

Range("D6").PasteSpecial xlPasteValues

Sheets("Registro").Select

'MODELO

Range("D12").Copy

Sheets("BD").Select

Range("C6").PasteSpecial xlPasteValues

Sheets("Registro").Select
'UBICACION

Range("G12").Copy

Sheets("BD").Select

Range("G6").PasteSpecial xlPasteValues

Sheets("Registro").Select

'PLACA

Range("G8").Copy

Sheets("BD").Select

Range("E6").PasteSpecial xlPasteValues

Sheets("Registro").Select

'MARCA

Range("G10").Copy

Sheets("BD").Select

Range("F6").PasteSpecial xlPasteValues

Sheets("Registro").Select

'OBSERVACIONES

Range("G14").Copy

Sheets("BD").Select

Range("H6").PasteSpecial xlPasteValues

Sheets("Registro").Select

'ACTUALIZACION

Range("J8").Copy

Sheets("BD").Select

Range("I6").PasteSpecial xlPasteValues

Sheets("Registro").Select
limpiar

End Sub

Sub limpiar()

Range("D8").Value = Empty

Range("D10").Value = Empty

Range("D12").Value = Empty

Range("D14").Value = Empty

Range("G8").Value = Empty

Range("G10").Value = Empty

Range("G12").Value = Empty

Range("G14").Value = Empty

Range("J8").Value = Empty

End Sub

Sub eliminar()

Sheets("BD").Select

Range("A6").EntireRow.Delete

End Sub
Sub IR_REGISTRO()

'

' IR_REGISTRO Macro

'

'

Sheets("Registro").Select

End Sub

Sub Autor()

MsgBox ("Andres felipe Jiménez")

End Sub

Sub Genera_QR()

End Sub

Option Explicit

Function URL_QRCode_SERIES( _

ByVal PictureName As String, _

ByVal QR_Value As String, _

Optional ByVal PictureSize As Long = 150, _

Optional ByVal DisplayText As String = "", _

Optional ByVal Updateable As Boolean = True) As Variant


Dim oPic As Shape, oRng As Excel.Range

Dim vLeft As Variant, vTop As Variant

Dim sURL As String

Const sRootURL As String = "https://chart.googleapis.com/chart?"

Const sSizeParameter As String = "chs="

Const sTypeChart As String = "cht=qr"

Const sDataParameter As String = "chl="

Const sJoinCHR As String = "&"

If Updateable = False Then

URL_QRCode_SERIES = "outdated"

Exit Function

End If

Set oRng = Application.Caller.Offset(, 1)

On Error Resume Next

Set oPic = oRng.Parent.Shapes(PictureName)

If Err Then

Err.Clear

vLeft = oRng.Left + 4

vTop = oRng.Top

Else

vLeft = oPic.Left

vTop = oPic.Top

PictureSize = Int(oPic.Width)

oPic.Delete

End If

On Error GoTo 0
If Len(QR_Value) = 0 Then

URL_QRCode_SERIES = CVErr(xlErrValue)

Exit Function

End If

sURL = sRootURL & _

sSizeParameter & PictureSize & "x" & PictureSize & sJoinCHR & _

sTypeChart & sJoinCHR & _

sDataParameter & UTF8_URL_Encode(VBA.Replace(QR_Value, " ", "+"))

Set oPic = oRng.Parent.Shapes.AddPicture(sURL, True, True, vLeft, vTop, PictureSize, PictureSize)

oPic.Name = PictureName

URL_QRCode_SERIES = DisplayText

End Function

Function UTF8_URL_Encode(ByVal sStr As String)

Dim i As Long

Dim a As Long

Dim res As String

Dim code As String

res = ""

For i = 1 To Len(sStr)

a = AscW(Mid(sStr, i, 1))

If a < 128 Then

code = Mid(sStr, i, 1)

ElseIf ((a > 127) And (a < 2048)) Then

code = URLEncodeByte(((a \ 64) Or 192))

code = code & URLEncodeByte(((a And 63) Or 128))


Else

code = URLEncodeByte(((a \ 144) Or 234))

code = code & URLEncodeByte((((a \ 64) And 63) Or 128))

code = code & URLEncodeByte(((a And 63) Or 128))

End If

res = res & code

Next i

UTF8_URL_Encode = res

End Function

Private Function URLEncodeByte(val As Integer) As String

Dim res As String

res = "%" & Right("0" & Hex(val), 2)

URLEncodeByte = res

End Function

También podría gustarte