--Descarga de etiquetas de busqueda de productos
This commit is contained in:
@@ -102,6 +102,11 @@
|
|||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
<asp:BoundField DataField="TipoPS" HeaderText="Tipo" ItemStyle-HorizontalAlign="Center" />
|
<asp:BoundField DataField="TipoPS" HeaderText="Tipo" ItemStyle-HorizontalAlign="Center" />
|
||||||
|
<asp:TemplateField HeaderText="Etiqueta" ItemStyle-CssClass="Texto" ItemStyle-HorizontalAlign="Center" Visible="false">
|
||||||
|
<ItemTemplate>
|
||||||
|
<asp:LinkButton ID="LnkGenerarEtiqueta" runat="server" Text="Descargar" OnClick="LnkGenerarEtiqueta_Click"></asp:LinkButton>
|
||||||
|
</ItemTemplate>
|
||||||
|
</asp:TemplateField>
|
||||||
</Columns>
|
</Columns>
|
||||||
</asp:GridView>
|
</asp:GridView>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ Option Strict On
|
|||||||
|
|
||||||
Imports System.Data
|
Imports System.Data
|
||||||
Imports Extensiones
|
Imports Extensiones
|
||||||
|
Imports Microsoft.Reporting.WebForms
|
||||||
|
Imports ZXing
|
||||||
|
|
||||||
Partial Class PopUpBuscarPs
|
Partial Class PopUpBuscarPs
|
||||||
Inherits ClsPaginas
|
Inherits ClsPaginas
|
||||||
|
|
||||||
@@ -24,8 +26,8 @@ Partial Class PopUpBuscarPs
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
#Region " INICIALIZA VALORES "
|
#Region " INICIALIZA VALORES "
|
||||||
Private Sub CargaClasificaciones()
|
Private Sub CargaClasificaciones()
|
||||||
Ddlclasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa)
|
Ddlclasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa)
|
||||||
@@ -44,9 +46,9 @@ Partial Class PopUpBuscarPs
|
|||||||
DdlCompuesto.Items.Insert(0, New ListItem("Todos", "-1"))
|
DdlCompuesto.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||||
End If
|
End If
|
||||||
DdlCompuesto.Items.Insert(0, New ListItem("Todos", "-1"))
|
DdlCompuesto.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||||
End Sub
|
End Sub
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region " CARGA DATOS "
|
#Region " CARGA DATOS "
|
||||||
Protected Sub BtnFiltrar_Click(sender As Object, e As EventArgs)
|
Protected Sub BtnFiltrar_Click(sender As Object, e As EventArgs)
|
||||||
CargaDatos()
|
CargaDatos()
|
||||||
@@ -79,24 +81,31 @@ Partial Class PopUpBuscarPs
|
|||||||
|
|
||||||
GvDatos.DataBind()
|
GvDatos.DataBind()
|
||||||
GvDatos.UseAccessibleHeader = True
|
GvDatos.UseAccessibleHeader = True
|
||||||
|
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
|
||||||
|
GvDatos.Columns(4).Visible = True
|
||||||
|
End If
|
||||||
Else
|
Else
|
||||||
Alert("Asigne un valor a cualquiera de los filtros", TipoMensaje.MsgAdvertencia)
|
Alert("Asigne un valor a cualquiera de los filtros", TipoMensaje.MsgAdvertencia)
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region " GV DATOS "
|
#Region " GV DATOS "
|
||||||
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
||||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||||
Try
|
Try
|
||||||
e.Row.FCLiteral("LnkPs").Text = String.Format("<div class='truncate' style='width:200px;'>{0}{1}</a></div>", "<a href='javascript:Ir(""" & e.Row.DBCampo("CvePs") & """);'>", e.Row.DBCampo("Ps"))
|
e.Row.FCLiteral("LnkPs").Text = String.Format("<div class='truncate' style='width:200px;'>{0}{1}</a></div>", "<a href='javascript:Ir(""" & e.Row.DBCampo("CvePs") & """);'>", e.Row.DBCampo("Ps"))
|
||||||
|
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
|
||||||
|
ScriptManager.GetCurrent(Me).RegisterPostBackControl(e.Row.FCLinkButton("LnkGenerarEtiqueta"))
|
||||||
|
End If
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
Dim exexex As String = ex.Message
|
Dim exexex As String = ex.Message
|
||||||
End Try
|
End Try
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
Private Function ValidarUnFiltroSeleccionado() As Boolean
|
Private Function ValidarUnFiltroSeleccionado() As Boolean
|
||||||
If TxtCodigo.Text.Trim <> String.Empty Then Return True
|
If TxtCodigo.Text.Trim <> String.Empty Then Return True
|
||||||
If TxtCodigoBarras.Text.Trim <> String.Empty Then Return True
|
If TxtCodigoBarras.Text.Trim <> String.Empty Then Return True
|
||||||
@@ -109,7 +118,127 @@ Partial Class PopUpBuscarPs
|
|||||||
If DdlCompuesto.SelectedValue.ToEntero > 0 Then Return True
|
If DdlCompuesto.SelectedValue.ToEntero > 0 Then Return True
|
||||||
|
|
||||||
Return False
|
Return False
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Protected Sub LnkGenerarEtiqueta_Click(sender As Object, e As EventArgs)
|
||||||
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||||
|
|
||||||
|
Dim CvePrecioListaPredeterminada = GlobalDTPrecioListas(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePrecioLista", "Predeterminada = True").ToEntero()
|
||||||
|
Dim DtPrecios As DataTable = Nothing
|
||||||
|
|
||||||
|
Dim ObjVentas As New ClsProductosServicios
|
||||||
|
If ObjVentas.GetPSPrecios(CvePrecioListaPredeterminada, GvRow.DataKey("CvePs").ToString()) AndAlso ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||||
|
DtPrecios = ObjVentas.DtResultados.Copy()
|
||||||
|
End If
|
||||||
|
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"
|
||||||
|
End If
|
||||||
|
Dim params As New List(Of ReportParameter)
|
||||||
|
|
||||||
|
ImprimirPDFStimul(DirectorioArchivo, DtPrecios, params, "Precios")
|
||||||
|
End If
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
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 Function
|
||||||
|
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
|||||||
Reference in New Issue
Block a user