B4A=true
Group=Default Group
ModulesStructureVersion=1
Type=Class
Version=11.8
@EndOfDesignText@
Sub Class_Globals
	Private Root As B4XView 'ignore
	Private xui As XUI 'ignore
	Dim lb_folioselec As Label
	Dim c As Cursor
	Dim d As Cursor
	Dim cl_picking As CustomListView
	Private b_guardapicking As Button
	Dim cmd As DBCommand
	Dim reqManager As DBRequestManager
	
	Private toast As BCToast
	Private Capturing As Boolean
	Private rp As RuntimePermissions
	Private detector As JavaObject
	Private camEx As CameraExClass
	Private LastPreview As Long
	Private IntervalBetweenPreviewsMs As Int = 100
	Dim codigoencontrado As String
	
	Private p_producto As Panel
	Private l_nombreproducto As Label
	Private et_catori_piezas As EditText
	Private et_cantesc_piezas As EditText
	Private et_catori_cajas As EditText
	Private et_cantesc_cajas As EditText
	Private et_cantesc_blister As EditText
	Private et_catori_blister As EditText
	Private btnStartStop As ImageView
	Private et_codigo As EditText
	Private l_ordenamiento As Label
	Dim posision As Int = 0
	Private Panel6 As Panel
	Private pnlPreview As Panel
	Private B_cerrar As Button
	Private b_entradamanual As Button
	Private p_entradamaual As Panel
	Private et_entradamanual As EditText
	Private b_cancelar As Button
	Private b_terminar As Button
	Dim sDate,sTime As String
	Private l_totales As Label
	Private l_faltantes As Label
	Private l_porcentaje As Label
	Private l_fecha As Label
	Private btnStartStop2 As ImageView
	Dim delanteatras As Int
	Dim f As Cursor
	Dim regreso As Int
End Sub

'You can add more parameters here.
Public Sub Initialize As Object
	Return Me
End Sub

'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
	Root = Root1
	Root.LoadLayout("picking")
	'load the layout to Root
	
'	reqManager.Initialize(Me, Starter.DBReqServer)
	
	'camara
	Panel6.Width = Root.Width
	Panel6.Height= Root.Height
	Panel6.Visible = False
	toast.Initialize(Root)
'	StopCamera
'	B4XPages.SetTitle(Me, "Barcode Example")
'	CreateDetector (Array("AZTEC", "CODE_128", "CODE_39", "CODE_93", "CODABAR", "DATA_MATRIX", "EAN_13", "EAN_8", "ITF", "PDF417", "QR_CODE", "UPC_A", "UPC_E"))
	
End Sub

Sub B4XPage_Appear
	btnStartStop2.Visible = False
'	c = Starter.skmt.ExecQuery("SELECT CUENTA FROM CUENTAA WHERE ESTATUS = 1")
'	c.Position = 0
'	Log(c.RowCount)
'	If c.RowCount >= 1 Then
'		b_cancelar.Visible = False
'		lb_folioselec.Text = c.GetString("CUENTA")
'		btnStartStop2.Visible = True
'		d = Starter.skmt.ExecQuery("SELECT FECHACONSULTA FROM FECHA")
'		d.Position = 0
'		l_fecha.Text = d.GetString("FECHACONSULTA")
'		d.Close
'	Else
		b_cancelar.Visible = False
		btnStartStop2.Visible = False
'		lb_folioselec.Text = B4XPages.MainPage.seleccion.folioactual
'		l_fecha.Text = B4XPages.MainPage.seleccion.fechabusqueda
'	End If

'	c.Close
	
	p_producto.Visible = True
	c = Starter.skmt.ExecQuery("SELECT * FROM PICKING_REPARTO WHERE ESTATUS = 0 ORDER BY HIST_PN_NOMBRE_PRODUCTO")
	d = Starter.skmt.ExecQuery("SELECT * FROM PICKING_REPARTO")
	Log(c.RowCount)
	l_faltantes.Text = d.RowCount - c.RowCount + 1
	l_totales.text = d.RowCount
	l_porcentaje.Text = NumberFormat2((l_faltantes.Text * 100)/l_totales.Text,1,2,2,True)
	If c.RowCount = 1 Then
		c.Position = 0
'		l_ordenamiento.Text = c.GetString("CAT_DF_RUTAO")
		et_codigo.Text = c.GetString("HIST_PN_CODIGO_PRODUCTO")
		l_nombreproducto.Text = c.GetString("HIST_PN_NOMBRE_PRODUCTO")
		et_catori_piezas.Text = c.GetString("HIST_PN_CANT_PIEZAS_OR")
		et_catori_cajas.Text = c.GetString("HIST_PN_CANT_CAJAS_OR")
		et_catori_blister.Text = c.GetString("HIST_PN_CANT_BLISTER_OR")
		et_cantesc_piezas.Text = c.GetString("HIST_PN_CANT_PIEZAS")
		et_cantesc_cajas.Text = c.GetString("HIST_PN_CANT_CAJAS")
		et_cantesc_blister.Text = c.GetString("HIST_PN_CANT_BLISTER")
		b_guardapicking.Text = "Terminar picking"
	Else If c.RowCount > 1 Then
		Log(c.RowCount)
		c.Position = 0
'		l_ordenamiento.Text = c.GetString("CAT_DF_RUTAO")
		et_codigo.Text = c.GetString("HIST_PN_CODIGO_PRODUCTO")
		l_nombreproducto.Text = c.GetString("HIST_PN_NOMBRE_PRODUCTO")
		et_catori_piezas.Text = c.GetString("HIST_PN_CANT_PIEZAS_OR")
		et_catori_cajas.Text = c.GetString("HIST_PN_CANT_CAJAS_OR")
		et_catori_blister.Text = c.GetString("HIST_PN_CANT_BLISTER_OR")
		et_cantesc_piezas.Text = c.GetString("HIST_PN_CANT_PIEZAS")
		et_cantesc_cajas.Text = c.GetString("HIST_PN_CANT_CAJAS")
		et_cantesc_blister.Text = c.GetString("HIST_PN_CANT_BLISTER")
		b_guardapicking.Text = "Guardar"
	Else
'		Msgbox2Async("No existen datos de la ruta: "& B4XPages.MainPage.seleccion.folioactual &" del almacen: "& B4XPages.MainPage.almacen.almacenselec,"Atención","Aceptar","","",Null, False)
		Wait For Msgbox_Result (result As Int)
		If result=DialogResponse.POSITIVE Then
			B4XPages.ShowPage("seleccion")
		End If
	End If
	c.Close
	
'	p_producto.Visible = True 'PARA PRUEBAS
	reqManager.Initialize(Me, B4XPages.MainPage.server)
End Sub

''camara
'
'Private Sub B4XPage_Disappear
'	If Panel6.Visible = True Then
'		Panel6.Visible = False
'		StopCamera
'	End If	
'End Sub
'
'
'Sub btnStartStop_Click
'	delanteatras = 1
'	If Capturing = False Then
'		Panel6.Visible = True
'		StartCamera
'	Else
'		Panel6.Visible = False
'		StopCamera
'	End If
'End Sub
'
'Sub btnStartStop2_Click
'	delanteatras = 2
'	If Capturing = False Then
'		Panel6.Visible = True
'		StartCamera
'	Else
'		Panel6.Visible = False
'		StopCamera
'	End If
'End Sub
'
'Private Sub B_cerrar_Click
'	If et_codigo.Text.Length = 0 Then
'		Panel6.Visible = False
'		StopCamera
'		btnFlash2_Click
'	Else
'		Panel6.Visible = False
'		StopCamera
'		et_codigo_EnterPressed
'		btnFlash2_Click
'	End If
'End Sub
'
'Private Sub StopCamera
''	et_codigo.Text = ""
'	Capturing = False
'	pnlPreview.Visible = False
'	If camEx.IsInitialized Then
'		camEx.Release
'	End If
'End Sub
'
'Private Sub StartCameraShared
'	pnlPreview.Visible = True
'	Capturing = True
'End Sub
'
'Private Sub FoundBarcode (msg As String)
''	et_codigo.Text = msg
'	toast.Show($"Found [Color=Red][b][plain]${msg}[/plain][/b][/Color]"$)
'	Log(msg)
'	codigoencontrado = msg
''	If et_codigo.Text.Length > 1 Then
'	B_cerrar_Click
''	End If
'End Sub
'
'Private Sub StartCamera
'	rp.CheckAndRequest(rp.PERMISSION_CAMERA)
'	Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean)
'	If Result = False Then
'		toast.Show("No permission!")
'		Return
'	End If
'	StartCameraShared
'	camEx.Initialize(pnlPreview, False, Me, "Camera1")
'	Wait For Camera1_Ready (Success As Boolean)
'	If Success Then
'		camEx.SetContinuousAutoFocus
'		camEx.CommitParameters
'		camEx.StartPreview
'		btnFlash_Click
'	Else
'		toast.Show("Error opening camera")
'		StopCamera
'	End If
'End Sub
'
'Sub btnFlash_Click
'	Dim f() As Float = camEx.GetFocusDistances
'	Log(f(0) & ", " & f(1) & ", " & f(2))
'	Dim flashModes As List = camEx.GetSupportedFlashModes
'	If flashModes.IsInitialized = False Then
'		ToastMessageShow("Flash not supported.", False)
'		Return
'	End If
'	Dim flash As String = "torch"
''	LogColor(flash,Colors.Red)
'	camEx.SetFlashMode(flash)
'	ToastMessageShow(flash, False)
'	camEx.CommitParameters
'End Sub
'
'Sub btnFlash2_Click
'	Dim f() As Float = camEx.GetFocusDistances
'	Log(f(0) & ", " & f(1) & ", " & f(2))
'	Dim flashModes As List = camEx.GetSupportedFlashModes
'	If flashModes.IsInitialized = False Then
'		ToastMessageShow("Flash not supported.", False)
'		Return
'	End If
'	Dim flash As String = "off"
''	LogColor(flash,Colors.Red)
'	camEx.SetFlashMode("off")
'	ToastMessageShow(flash, False)
'	camEx.CommitParameters
'End Sub
'
'Private Sub CreateDetector (Codes As List)
'	Dim ctxt As JavaObject
'	ctxt.InitializeContext
'	Dim builder As JavaObject
'	builder.InitializeNewInstance("com/google/android/gms/vision/barcode/BarcodeDetector.Builder".Replace("/", "."), Array(ctxt))
'	Dim barcodeClass As String = "com/google/android/gms/vision/barcode/Barcode".Replace("/", ".")
'	Dim barcodeStatic As JavaObject
'	barcodeStatic.InitializeStatic(barcodeClass)
'	Dim format As Int
'	For Each formatName As String In Codes
'		format = Bit.Or(format, barcodeStatic.GetField(formatName))
'	Next
'	builder.RunMethod("setBarcodeFormats", Array(format))
'	detector = builder.RunMethod("build", Null)
'	Dim operational As Boolean = detector.RunMethod("isOperational", Null)
'	If operational = False Then
'		toast.Show("Failed to create detector")
'	End If
'	btnStartStop.Enabled = operational
'End Sub
'
'Private Sub Camera1_Preview (data() As Byte)
'	If DateTime.Now > LastPreview + IntervalBetweenPreviewsMs Then
'		'Dim n As Long = DateTime.Now
'		Dim frameBuilder As JavaObject
'		Dim bb As JavaObject
'		bb = bb.InitializeStatic("java.nio.ByteBuffer").RunMethod("wrap", Array(data))
'		frameBuilder.InitializeNewInstance("com/google/android/gms/vision/Frame.Builder".Replace("/", "."), Null)
'		
'		'New Code
'		Dim In As InputStream
'		In.InitializeFromBytesArray(camEx.PreviewImageToJpeg(data, 100), 0, data.Length)
'		Dim bmp As Bitmap
'		'Log(TestPnl.Top)
''		TestPnl.Top = 40dip
''		TestPnl.Width = pnlPreview.Width
'		bmp.Initialize2(In)
'		bmp = bmp.Rotate(90)
'		bmp = bmp.Crop(0, bmp.Height * .3, bmp.Width, bmp.Height * .3)
'		'bmp = bmp.Resize(bmp.Width, bmp.Height * .8, True)
'		'QrTestPnl.SetBitmap(bmp)
'		'Dim B As Bitmap =  camEx.PreviewImageToJpeg(data, 100)
'		'bmp.Rotate(270)
'		
'		frameBuilder.RunMethod("setBitmap", Array(bmp)) 'instead of the setImageData line
'		'frameBuilder.RunMethod("setBitmap", Array(TestPnl.GetBitmap)) 'instead of the setImageData line
'		'End of new code
'		
'		
'
'		
'		'Old Code
''		Dim cs As CameraSize = camEx.GetPreviewSize
''		frameBuilder.RunMethod("setImageData", Array(bb, cs.Width, cs.Height,  842094169))
'
'
'		Dim frame As JavaObject = frameBuilder.RunMethod("build", Null)
'		Dim SparseArray As JavaObject = detector.RunMethod("detect", Array(frame))
'		LastPreview = DateTime.Now
'		Dim Matches As Int = SparseArray.RunMethod("size", Null)
'		If Matches > 0 Then
'			Dim barcode As JavaObject = SparseArray.RunMethod("valueAt", Array(0))
'			Dim raw As String = barcode.GetField("rawValue")
'			FoundBarcode(raw)
'		End If
'	End If
'End Sub
'
''fin camara

Private Sub et_codigo_EnterPressed
	If delanteatras = 1 Then
		
'		If et_codigo.Text = codigoencontrado Then
			p_producto.Visible = True
'			btnFlash2_Click
'		Else If et_codigo.Text = codigoencontrado Then
'			MsgboxAsync("Escanea el codigo nuevamente.","Atención")
''			btnFlash2_Click
'		End If
		
	Else If delanteatras = 2 Then
		
		d = Starter.skmt.ExecQuery2("SELECT * FROM CAT_DETALLEFOLIO WHERE CAT_DF_ID = ? AND CAT_DF_ESTATUS = ?",Array As String (codigoencontrado,1))
		Log(d.RowCount)
		If d.RowCount > 0 Then
			d.Position = 0
			et_codigo.Text = codigoencontrado
			p_producto.Visible = True
			l_ordenamiento.Text = d.GetString("CAT_DF_RUTAO")
			et_codigo.Text = d.GetString("CAT_DF_ID")
			l_nombreproducto.Text = d.GetString("CAT_DF_NOMBRE")
			et_catori_piezas.Text = d.GetString("CAT_DF_PIEZAS")
			et_catori_cajas.Text = d.GetString("CAT_DF_CAJAS")
			et_catori_blister.Text = d.GetString("CAT_DF_BLISTER")
			et_cantesc_piezas.Text = d.GetString("CAT_DF_PIEZAS")
			et_cantesc_cajas.Text = d.GetString("CAT_DF_CAJAS")
			et_cantesc_blister.Text = d.GetString("CAT_DF_BLISTER")
			b_guardapicking.Text = "Guardar"
		Else
			MsgboxAsync("El codigo aun no ha sido escaneado","Atencion.")
		End If
		d.Close
	End If
End Sub

Private Sub b_entradamanual_Click
	If p_producto.Visible Then 
		p_entradamaual.Visible = False
	Else If p_entradamaual.Visible Then
		p_entradamaual.Visible = False
	Else
		p_entradamaual.Visible = True
	End If
End Sub

Private Sub et_entradamanual_EnterPressed
	If et_codigo.Text = et_entradamanual.Text Then
		p_producto.Visible = True
		p_entradamaual.Visible = False
		et_entradamanual.Text = ""
	Else
		MsgboxAsync("Por favor captura el codigo correcto.","Atención")
	End If
End Sub

Private Sub b_cancelar_Click
	Starter.skmt.ExecNonQuery("delete from CUENTAA")
	B4XPages.ShowPage("seleccion")
End Sub

Private Sub b_guardapicking_Click
	regreso = 0
	DateTime.DateFormat = "dd/MM/yyyy"
	DateTime.Timeformat = "HH:mm:ss"
	sDate=DateTime.Date(DateTime.Now)
	sTime=DateTime.Time(DateTime.Now)
	
	If b_guardapicking.Text = "Terminar picking" Then
		If p_producto.Visible Then
			Dim bopiezas As Int
			Dim bocajas As Int
			Dim boblister As Int
			bopiezas = et_catori_piezas.Text - et_cantesc_piezas.Text
			bocajas = et_catori_cajas.Text - et_cantesc_cajas.Text
			boblister = et_catori_blister.Text - et_cantesc_blister.Text
			Log(bopiezas)
			
			Private CAJASPIEZAS As Int
			Private BLISTERPIEZAS As Int
			Private totalpiezas As Int
			Private preciototal As Float
			Private precioorden As Float
			Private cantidadbo As Int
			Private preciobo As Float
			
'			c = Starter.skmt.ExecQuery2("SELECT CAJASPIEZAS, BLISTERPIEZAS, PRECIO FROM CAT_CONVERSION WHERE ID = ? AND NOMBRE = ?", Array As String(et_codigo.Text, l_nombreproducto.Text))
'			d = Starter.skmt.ExecQuery2("SELECT CANTIDAD FROM CAT_DETALLEFOLIO WHERE CAT_DF_ID = ? AND CAT_DF_NOMBRE = ?",Array As String(et_codigo.Text, l_nombreproducto.Text))
'			d.Position = 0
'			c.Position = 0
'			CAJASPIEZAS = c.GetString("CAJASPIEZAS") * et_cantesc_cajas.Text
'			BLISTERPIEZAS = c.GetString("BLISTERPIEZAS") * et_cantesc_blister.Text
'			Log("Cajas a piezas es = "&CAJASPIEZAS)
'			Log("blister a piezas es = "&BLISTERPIEZAS)
'			totalpiezas = CAJASPIEZAS + BLISTERPIEZAS + et_cantesc_piezas.Text
'			Log("total piezas es = "&totalpiezas)
'			preciototal = c.GetString("PRECIO")* totalpiezas
'			Log("total precio = "& preciototal)
'			precioorden = c.GetString("PRECIO") * d.GetString("CANTIDAD")
'			cantidadbo = d.GetString("CANTIDAD") - totalpiezas
'			preciobo = cantidadbo * c.GetString("PRECIO")
'			c.Close
'			d.Close
			Starter.skmt.ExecNonQuery2("UPDATE CHECAR SET MOSTRAR = ?" ,Array As String(1))
'			Starter.skmt.ExecNonQuery2("UPDATE CUENTAA SET ESTATUS = ? WHERE CUENTA = ?",Array As String (0,lb_folioselec.Text))
			Starter.skmt.ExecNonQuery2("UPDATE PICKING_REPARTO SET ESTATUS = ?, HIST_PN_CANT_PIEZAS_OR = ?, HIST_PN_CANT_CAJAS_OR = ?, HIST_PN_CANT_BLISTER_OR = ?, HIST_PN_CANT_CAJAS = ?, HIST_PN_CANT_PIEZAS = ?, HIST_PN_CANT_BLISTER = ? WHERE HIST_PN_CODIGO_PRODUCTO = ? and HIST_PN_NOMBRE_PRODUCTO = ?",Array As String(1, et_catori_piezas.Text, et_catori_cajas.Text, et_catori_blister.Text, et_cantesc_cajas.Text, et_cantesc_piezas.Text, et_cantesc_blister.Text, et_codigo.Text, l_nombreproducto.Text))
			posision = posision + 1
			p_producto.Visible = False
			b_cancelar.Visible = False
			mandapicking
			B4XPages.ShowPage("principal")
		End If
		
	Else
		
		If p_producto.Visible Then
			Dim bopiezas As Int
			Dim bocajas As Int
			Dim boblister As Int
			bopiezas = et_catori_piezas.Text - et_cantesc_piezas.Text
			bocajas = et_catori_cajas.Text - et_cantesc_cajas.Text
			boblister = et_catori_blister.Text - et_cantesc_blister.Text
			Log(bopiezas)
			
			Private CAJASPIEZAS As Int
			Private BLISTERPIEZAS As Int
			Private totalpiezas As Int
			Private preciototal As Float
			Private precioorden As Float
			Private cantidadbo As Int
			Private preciobo As Float
			
'			c = Starter.skmt.ExecQuery2("SELECT CAJASPIEZAS, BLISTERPIEZAS, PRECIO FROM CAT_CONVERSION WHERE ID = ? AND NOMBRE = ?", Array As String(et_codigo.Text, l_nombreproducto.Text))
'			d = Starter.skmt.ExecQuery2("SELECT CANTIDAD FROM CAT_DETALLEFOLIO WHERE CAT_DF_ID = ? AND CAT_DF_NOMBRE = ?",Array As String(et_codigo.Text, l_nombreproducto.Text))
'			d.Position = 0
'			If c.RowCount > 0 Then
'				c.Position = 0
'				CAJASPIEZAS = c.GetString("CAJASPIEZAS") * et_cantesc_cajas.Text
'				BLISTERPIEZAS = c.GetString("BLISTERPIEZAS") * et_cantesc_blister.Text
'				Log("Cajas a piezas es = "&CAJASPIEZAS)
'				Log("blister a piezas es = "&BLISTERPIEZAS)
'				totalpiezas = CAJASPIEZAS + BLISTERPIEZAS + et_cantesc_piezas.Text
'				Log("total piezas es = "&totalpiezas)
'				preciototal = c.GetString("PRECIO")* totalpiezas
'				Log("total precio = "& preciototal)
'				precioorden = c.GetString("PRECIO") * d.GetString("CANTIDAD")
'				cantidadbo = d.GetString("CANTIDAD") - totalpiezas
'				preciobo = cantidadbo * c.GetString("PRECIO")
'				c.Close
'				d.Close
'			Else
'				
'			End If
'			Starter.skmt.ExecNonQuery2("UPDATE CUENTAA SET ESTATUS = ? WHERE CUENTA = ?",Array As String (1,lb_folioselec.Text))
			Starter.skmt.ExecNonQuery2("UPDATE PICKING_REPARTO SET ESTATUS = ?, HIST_PN_CANT_PIEZAS_OR = ?, HIST_PN_CANT_CAJAS_OR = ?, HIST_PN_CANT_BLISTER_OR = ?, HIST_PN_CANT_CAJAS = ?, HIST_PN_CANT_PIEZAS = ?, HIST_PN_CANT_BLISTER = ? WHERE HIST_PN_CODIGO_PRODUCTO = ? and HIST_PN_NOMBRE_PRODUCTO = ?",Array As String(1, et_catori_piezas.Text, et_catori_cajas.Text, et_catori_blister.Text, et_cantesc_cajas.Text, et_cantesc_piezas.Text, et_cantesc_blister.Text, et_codigo.Text, l_nombreproducto.Text))
			posision = posision + 1
			p_producto.Visible = False
			b_cancelar.Visible = False
			B4XPage_Appear
		
	
		Else
	
		End If
	End If
	
End Sub


Sub mandapicking
	c = Starter.skmt.ExecQuery("SELECT * from PICKING_REPARTO")
	If c.RowCount > 0 Then
		Private folio As String = Subs.hmsKMT
		For i=0 To c.RowCount -1
			c.Position=i
			f=Starter.skmt.ExecQuery("select RUTAA from RUTAA")
			If f.RowCount > 0 Then
				f.Position = 0
					Dim ruta As String = f.GetString("RUTAA")
			End If
			Dim cmd As DBCommand
			cmd.Initialize
			cmd.Name = "insertGUNApickingreparto"
			cmd.Parameters = Array As Object(B4XPages.MainPage.almacen,ruta,c.GetString("HIST_PN_CODIGO_PRODUCTO"),c.GetString("HIST_PN_NOMBRE_PRODUCTO") ,c.GetString("HIST_PN_CANT_CAJAS_OR") ,c.GetString("HIST_PN_CANT_PIEZAS_OR") ,c.GetString("HIST_PN_CANT_BLISTER_OR") ,c.GetString("HIST_PN_CANT_CAJAS") ,c.GetString("HIST_PN_CANT_PIEZAS") ,c.GetString("HIST_PN_CANT_BLISTER"), B4XPages.MainPage.usuario,c.GetString("FECHA"))
			reqManager.ExecuteCommand(cmd , "picking_rep")
		Next
		c.Close
	End If
End Sub

Private Sub b_regresar_Click
	regreso = regreso +1
	Log(regreso)
	c = Starter.skmt.ExecQuery("SELECT * FROM PICKING_REPARTO WHERE ESTATUS = 1 ORDER BY HIST_PN_NOMBRE_PRODUCTO")
	d = Starter.skmt.ExecQuery("SELECT * FROM PICKING_REPARTO")
	Log(c.RowCount)
'	l_faltantes.Text = d.RowCount - c.RowCount + 1
'	l_totales.text = d.RowCount
'	l_porcentaje.Text = NumberFormat2((l_faltantes.Text * 100)/l_totales.Text,1,2,2,True)
	If c.RowCount > 0 Then
		If c.RowCount >= regreso Then
			c.Position = c.RowCount - regreso
'		l_ordenamiento.Text = c.GetString("CAT_DF_RUTAO")
			et_codigo.Text = c.GetString("HIST_PN_CODIGO_PRODUCTO")
			l_nombreproducto.Text = c.GetString("HIST_PN_NOMBRE_PRODUCTO")
			et_catori_piezas.Text = c.GetString("HIST_PN_CANT_PIEZAS_OR")
			et_catori_cajas.Text = c.GetString("HIST_PN_CANT_CAJAS_OR")
			et_catori_blister.Text = c.GetString("HIST_PN_CANT_BLISTER_OR")
			et_cantesc_piezas.Text = c.GetString("HIST_PN_CANT_PIEZAS")
			et_cantesc_cajas.Text = c.GetString("HIST_PN_CANT_CAJAS")
			et_cantesc_blister.Text = c.GetString("HIST_PN_CANT_BLISTER")
'	b_guardapicking.Text = "Terminar picking"
			c.Close
		End If
	End If
End Sub
