Ferretera. cambios en la generacion de codigo de barras.
This commit is contained in:
@@ -10,6 +10,7 @@ Imports iText.Barcodes.Dmcode
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
Imports Modelos
|
||||
Imports Stimulsoft.Base.Context
|
||||
Imports ZXing
|
||||
|
||||
|
||||
Partial Class PopUpVerFactura
|
||||
@@ -6039,6 +6040,13 @@ Partial Class PopUpVerFactura
|
||||
ObjVentas.Dispose()
|
||||
|
||||
If DtPrecios IsNot Nothing Then
|
||||
|
||||
DtPrecios.Columns.Add(New DataColumn("CBBase64", GetType(String)))
|
||||
|
||||
For Each Row As DataRow In DtPrecios.Rows
|
||||
Row("CBBase64") = Convert.ToBase64String(GeneraCodigoQR(Row("CodigoBarras").ToString(), 40, 150, 0, "CODE_39", True))
|
||||
Next
|
||||
|
||||
Dim DirectorioArchivo As String = "Empresas/Grales/Formatos/Etiqueta.mrt"
|
||||
If System.IO.File.Exists(UsuarioActual.Empresa.Ruta + "Formatos/Etiqueta.mrt") Then
|
||||
DirectorioArchivo = UsuarioActual.Empresa.Ruta + "Formatos/Etiqueta.mrt"
|
||||
@@ -6153,4 +6161,94 @@ Partial Class PopUpVerFactura
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
Private Function GeneraCodigoQR(CodigoBarras As String, Alto As Integer, Largo As Integer, Margen As Integer, Formato As String, Optional PureBacode As Boolean = False) As Byte()
|
||||
|
||||
Dim barcodeWriter As New BarcodeWriter
|
||||
Dim opciones As New ZXing.Common.EncodingOptions
|
||||
Dim FormatoBar As New BarcodeFormat
|
||||
'Dim Respuesta As Byte()
|
||||
|
||||
opciones.Height = Alto
|
||||
opciones.Width = Largo
|
||||
opciones.Margin = Margen
|
||||
opciones.PureBarcode = PureBacode
|
||||
barcodeWriter.Options = opciones
|
||||
|
||||
Select Case Formato
|
||||
Case "All_1D"
|
||||
barcodeWriter.Format = BarcodeFormat.All_1D
|
||||
Exit Select
|
||||
Case "AZTEC"
|
||||
barcodeWriter.Format = BarcodeFormat.AZTEC
|
||||
Exit Select
|
||||
Case "CODABAR"
|
||||
barcodeWriter.Format = BarcodeFormat.CODABAR
|
||||
Exit Select
|
||||
Case "CODE_128"
|
||||
barcodeWriter.Format = BarcodeFormat.CODE_128
|
||||
Exit Select
|
||||
Case "CODE_39"
|
||||
barcodeWriter.Format = BarcodeFormat.CODE_39
|
||||
Exit Select
|
||||
Case "CODE_93"
|
||||
barcodeWriter.Format = BarcodeFormat.CODE_93
|
||||
Exit Select
|
||||
Case "DATA_MATRIX"
|
||||
barcodeWriter.Format = BarcodeFormat.DATA_MATRIX
|
||||
Exit Select
|
||||
Case "EAN_13"
|
||||
barcodeWriter.Format = BarcodeFormat.EAN_13
|
||||
Exit Select
|
||||
Case "EAN_8"
|
||||
barcodeWriter.Format = BarcodeFormat.EAN_8
|
||||
Exit Select
|
||||
Case "IMB"
|
||||
barcodeWriter.Format = BarcodeFormat.IMB
|
||||
Exit Select
|
||||
Case "ITF"
|
||||
barcodeWriter.Format = BarcodeFormat.ITF
|
||||
Exit Select
|
||||
Case "MAXICODE"
|
||||
barcodeWriter.Format = BarcodeFormat.MAXICODE
|
||||
Exit Select
|
||||
Case "MSI"
|
||||
barcodeWriter.Format = BarcodeFormat.MSI
|
||||
Exit Select
|
||||
Case "PDF_417"
|
||||
barcodeWriter.Format = BarcodeFormat.PDF_417
|
||||
Exit Select
|
||||
Case "PLESSEY"
|
||||
barcodeWriter.Format = BarcodeFormat.PLESSEY
|
||||
Exit Select
|
||||
Case "QR_CODE"
|
||||
barcodeWriter.Format = BarcodeFormat.QR_CODE
|
||||
Exit Select
|
||||
Case "RSS_14"
|
||||
barcodeWriter.Format = BarcodeFormat.RSS_14
|
||||
Exit Select
|
||||
Case "RSS_EXPANDED"
|
||||
barcodeWriter.Format = BarcodeFormat.RSS_EXPANDED
|
||||
Exit Select
|
||||
Case "UPC_A"
|
||||
barcodeWriter.Format = BarcodeFormat.UPC_A
|
||||
Exit Select
|
||||
Case "UPC_E"
|
||||
barcodeWriter.Format = BarcodeFormat.UPC_E
|
||||
Exit Select
|
||||
Case "UPC_EAN_EXTENSION"
|
||||
barcodeWriter.Format = BarcodeFormat.UPC_EAN_EXTENSION
|
||||
Exit Select
|
||||
|
||||
End Select
|
||||
|
||||
Dim imgCod As Drawing.Bitmap = barcodeWriter.Write(CodigoBarras)
|
||||
Dim memoriStream As New System.IO.MemoryStream
|
||||
imgCod.Save(memoriStream, Drawing.Imaging.ImageFormat.Bmp)
|
||||
|
||||
'Respuesta = Convert.ToBase64String(memoriStream.ToArray())
|
||||
|
||||
Return memoriStream.ToArray()
|
||||
|
||||
End Function
|
||||
End Class
|
||||
|
||||
@@ -2208,7 +2208,7 @@ Partial Class ProductosyServicios
|
||||
#Region "Codigo Barras"
|
||||
|
||||
'Codigo barras/QR se retorna como una imagen bmp
|
||||
Private Function GeneraCodigoQR(CodigoBarras As String, Alto As Integer, Largo As Integer, Margen As Integer, Formato As String) As Byte()
|
||||
Private Function GeneraCodigoQR(CodigoBarras As String, Alto As Integer, Largo As Integer, Margen As Integer, Formato As String, Optional PureBacode As Boolean = False) As Byte()
|
||||
|
||||
Dim barcodeWriter As New BarcodeWriter
|
||||
Dim opciones As New ZXing.Common.EncodingOptions
|
||||
@@ -2218,7 +2218,7 @@ Partial Class ProductosyServicios
|
||||
opciones.Height = Alto
|
||||
opciones.Width = Largo
|
||||
opciones.Margin = Margen
|
||||
|
||||
opciones.PureBarcode = PureBacode
|
||||
barcodeWriter.Options = opciones
|
||||
|
||||
Select Case Formato
|
||||
@@ -3582,6 +3582,13 @@ Partial Class ProductosyServicios
|
||||
ObjVentas.Dispose()
|
||||
|
||||
If DtPrecios IsNot Nothing Then
|
||||
|
||||
DtPrecios.Columns.Add(New DataColumn("CBBase64", GetType(String)))
|
||||
|
||||
For Each Row As DataRow In DtPrecios.Rows
|
||||
Row("CBBase64") = Convert.ToBase64String(GeneraCodigoQR(Row("CodigoBarras").ToString(), 40, 150, 0, "CODE_39", True))
|
||||
Next
|
||||
|
||||
Dim DirectorioArchivo As String = "Empresas/Grales/Formatos/Etiqueta.mrt"
|
||||
If System.IO.File.Exists(UsuarioActual.Empresa.Ruta + "Formatos/Etiqueta.mrt") Then
|
||||
DirectorioArchivo = UsuarioActual.Empresa.Ruta + "Formatos/Etiqueta.mrt"
|
||||
|
||||
Reference in New Issue
Block a user