From 6f07aa879adb2fdc20f4d117c8f147a7bc4a729e Mon Sep 17 00:00:00 2001 From: HECTOR RODRIGUEZ Date: Thu, 18 Feb 2021 12:15:25 -0700 Subject: [PATCH] Reporte para etiquetas QR en productos con lote y caducidad --- Compras/PopUpVerFactura.aspx.vb | 72 ++++- .../Grales/Formatos/EtiquetaDeRecepcion.rdlc | 288 ++++++++++++++++++ Inventarios/Kardex.aspx | 6 +- Inventarios/Kardex.aspx.vb | 14 + 4 files changed, 375 insertions(+), 5 deletions(-) create mode 100644 Empresas/Grales/Formatos/EtiquetaDeRecepcion.rdlc diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index 60e3e291a..7f42c8bf3 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -289,6 +289,12 @@ Partial Class PopUpVerFactura If UrlParametros("CVEMOVIMIENTO") IsNot Nothing AndAlso UrlParametros("CVEMOVIMIENTO").ToString.ToEntero > 0 Then ImprimirEtiqueta(UrlParametros("CVEMOVIMIENTO").ToString.ToEntero, UrlParametros("MODALIDAD").ToString) End If + End If + + If UrlParametros("OP").ToString = "Etiqueta2" Then + If UrlParametros("CVEPS") IsNot Nothing AndAlso UrlParametros("CVEPS").ToString.ToEntero > 0 Then + ImprimirEtiqueta2(UrlParametros("CVEPS").ToString.ToEntero, UrlParametros("PS").ToString, UrlParametros("CVEALMACEN").ToString, UrlParametros("MODALIDAD").ToString) + End If End If 'IMPRIME OC @@ -4374,7 +4380,7 @@ Partial Class PopUpVerFactura Private Sub ImprimirEtiqueta(CveMovimiento As Integer, Modalidad As String) Dim ObjInventarios As New ClsInventarios - + Dim PS As String = "" Dim All As Byte() Using ms As New MemoryStream Using d As New Document @@ -4386,7 +4392,7 @@ Partial Class PopUpVerFactura Dim CvePS As Integer = DetalleRow.Item("CvePS").ToString.ToEntero Dim Lote As String = DetalleRow.Item("Lote").ToString Dim FechaCaducidad As Date = DetalleRow.Item("FechaCaducidad").ToString.ToDate - Dim PS As String = String.Format("{0} - {1}", DetalleRow.Item("Codigo").ToString, DetalleRow.Item("PS").ToString) + PS = String.Format("{0} - {1}", DetalleRow.Item("Codigo").ToString, DetalleRow.Item("PS").ToString) If Modalidad = "Individual" Then Dim reporteByte As Byte() = GenerarEtiqueta(CvePS, Lote, FechaCaducidad, PS) @@ -4421,7 +4427,65 @@ Partial Class PopUpVerFactura End Using All = ms.ToArray() End Using - ImprimirbytesPDF(All, "Etiquetas") + ImprimirbytesPDF(All, PS.ToString) + + + If Modalidad = "Individual" Then + Else + + End If + ObjInventarios.Dispose() + End Sub + + Private Sub ImprimirEtiqueta2(CvePS As Integer, PS As String, CveAlmacen As String, Modalidad As String) + + Dim ObjInventarios As New ClsInventarios + + Dim All As Byte() + Using ms As New MemoryStream + Using d As New Document + Using Copy As New PdfCopy(d, ms) + d.Open() + If ObjInventarios.GetExistenciasCaducidad(CvePS, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveAlmacen.ToString) Then + If ObjInventarios.DtResultados IsNot Nothing Then + For Each DetalleRow As DataRow In ObjInventarios.DtResultados.Rows + Dim Lote As String = DetalleRow.Item("Lote").ToString + Dim FechaCaducidad As Date = DetalleRow.Item("FechaCaducidad").ToString.ToDate + If Modalidad = "Individual" Then + Dim reporteByte As Byte() = GenerarEtiqueta(CvePS, Lote, FechaCaducidad, PS) + + Dim reader As New PdfReader(reporteByte) + Dim Paginas As Integer = reader.NumberOfPages + Dim Contador As Integer = 0 + While Contador < Paginas + Contador += 1 + Copy.AddPage(Copy.GetImportedPage(reader, Contador)) + End While + Else + Dim Cant As Integer = DetalleRow.Item("Cantidad").ToString.ToEntero - 1 + + For contador As Integer = 0 To Cant + Dim reporteByte As Byte() = GenerarEtiqueta(CvePS, Lote, FechaCaducidad, PS) + + Dim reader As New PdfReader(reporteByte) + Dim Paginas As Integer = reader.NumberOfPages + Dim Cont As Integer = 0 + While Cont < Paginas + Cont += 1 + Copy.AddPage(Copy.GetImportedPage(reader, Cont)) + End While + Next + End If + Next + End If + End If + d.Close() + + End Using + End Using + All = ms.ToArray() + End Using + ImprimirbytesPDF(All, PS.ToString) If Modalidad = "Individual" Then @@ -4440,7 +4504,7 @@ Partial Class PopUpVerFactura params.Add(New ReportParameter("QR", QrDescarga)) params.Add(New ReportParameter("PS", PS)) params.Add(New ReportParameter("Lote", Lote)) - params.Add(New ReportParameter("FechaCad", FechaCaducidad.ToString())) + params.Add(New ReportParameter("FechaCad", FechaCaducidad.ToString("dd/MM/yyyy"))) Return StreamPDF("Empresas/Grales/Formatos/EtiquetaDeRecepcion.rdlc", New DataTable, params) End Function #End Region diff --git a/Empresas/Grales/Formatos/EtiquetaDeRecepcion.rdlc b/Empresas/Grales/Formatos/EtiquetaDeRecepcion.rdlc new file mode 100644 index 000000000..ed96b21c3 --- /dev/null +++ b/Empresas/Grales/Formatos/EtiquetaDeRecepcion.rdlc @@ -0,0 +1,288 @@ + + + 0 + + + + + + true + + + + + =Parameters!PS.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!Lote.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!FechaCad.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + Database + =Parameters!QR.Value + image/bmp + FitProportional + 0.14111cm + 2.16972cm + 2.34667cm + 3 + + + + + + true + true + + + + + LOTE: + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + F. ELABORACIÓN: + + + + + + 2pt + 2pt + 2pt + 2pt + + + + Embedded + Logo + FitProportional + 1.5468cm + 8.2016cm + 0.74287cm + 1.52823cm + 6 + + + + + + 0.92351in + + + + + 3.83898in + + 2.5cm + 10cm + 0.02cm + 0.02cm + 0.02cm + 0.02cm +