mirror of
https://github.com/KeymonSoft/Salma_Almacen.git
synced 2026-04-18 05:09:21 +00:00
1270 lines
36 KiB
QBasic
1270 lines
36 KiB
QBasic
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
|
|
Private Dialog As B4XDialog
|
|
Private P_escan As Panel
|
|
Private e_cant As EditText
|
|
Private b_vreseumen As Button
|
|
Private B_borrar As Button
|
|
Private phn As PhoneVibrate
|
|
Private p_img As Panel
|
|
Private p_nums As Panel
|
|
Private e_prod As EditText
|
|
Private b_sig As Button
|
|
Private E_ESCANER As EditText
|
|
Private c As Cursor
|
|
Private codigo_escaner As String
|
|
Private piezas_escaner As String
|
|
Private P_escan As Panel
|
|
Private b_cad As Button
|
|
Private teclado As IME
|
|
Dim db As SQL
|
|
Private b_incidencia As Button
|
|
Private p_inci As Panel
|
|
Private B4XComboBox1 As B4XComboBox
|
|
Private B4XComboBox2 As B4XComboBox
|
|
Private d As Cursor
|
|
Private b_cadincidencia As Button
|
|
Private B_registrar As Button
|
|
Private et_cant_incidencia As EditText
|
|
Private ed_com As EditText
|
|
Private b_cancel As Button
|
|
Dim itemselect As String
|
|
Dim itemselect2 As String
|
|
Dim itemselect3 As String
|
|
Dim itemselect4 As String
|
|
Private b_limpiar As Button
|
|
Private p_calendario As Panel
|
|
Private ASWheelPicker1 As ASWheelPicker
|
|
Private ASWheelPicker2 As ASWheelPicker
|
|
Private ASWheelPicker3 As ASWheelPicker
|
|
Private l_fecha_caducidad As Label
|
|
Dim day As String = DateTime.GetDayOfMonth(DateTime.Now)
|
|
Dim month As String = DateTime.GetMonth(DateTime.Now)
|
|
Dim year2 As String = DateTime.GetYear(DateTime.Now)
|
|
Dim month2 As String
|
|
Private bgfecha As Button
|
|
Private SearchTemplate As B4XSearchTemplate
|
|
Private Base As B4XView
|
|
Private p_busqueda As Panel
|
|
|
|
'camara
|
|
|
|
Private pnlPreview As B4XView
|
|
Private btnStartStop As Panel
|
|
Private rp As RuntimePermissions
|
|
Private detector As JavaObject
|
|
Private camEx As CameraExClass
|
|
Private camEx2 As CameraExClass2
|
|
Private LastPreview As Long
|
|
Private IntervalBetweenPreviewsMs As Int = 100
|
|
Private toast As BCToast
|
|
Private Capturing As Boolean
|
|
Private B_cerrar As Button
|
|
Private Panel6 As Panel
|
|
Private b_cadcancel As Button
|
|
Private b_cam_inci As Panel
|
|
|
|
Private p_cam As Panel
|
|
Dim frontCamera As Boolean = False
|
|
Private p_camara As Panel
|
|
Private b_foto_inci As Button
|
|
Dim nombrefoto As String
|
|
Private e_cantpiezas As EditText
|
|
Private p_cant_cajas As Panel
|
|
Private p_cant_piezas As Panel
|
|
|
|
Dim panelselect As String = 1
|
|
|
|
Private l_cajas As Label
|
|
Private l_piezas As Label
|
|
Dim foto As String = 0
|
|
Private clv_producto As CustomListView
|
|
Private lb_prod As Label
|
|
Private lb_cantarchivo As Label
|
|
Private Label5 As Label
|
|
Private lb_entrada As Label
|
|
Private et_cant As EditText
|
|
Private p_prodnoencontrado As Panel
|
|
|
|
Dim cadx As Button
|
|
Private c_prodn As B4XComboBox
|
|
Private c_entradan As B4XComboBox
|
|
Private et_cantn As EditText
|
|
Private lb_prodn As Label
|
|
Dim d As Cursor
|
|
|
|
Private p_busquedainci As Panel
|
|
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
|
|
Base = Root
|
|
Dialog.Initialize (Base)
|
|
Root.LoadLayout("escaneo")
|
|
p_calendario.Width = Root.Width
|
|
p_calendario.Height= Root.Height
|
|
p_calendario.Visible = False
|
|
e_cant.Enabled = False
|
|
e_cantpiezas.Enabled = False
|
|
P_escan.Width = Root.Width
|
|
p_nums.Visible = True 'fl lo agregue
|
|
db.Initialize(Starter.rutaBD,"kmt.db",True)
|
|
p_inci.Visible = False
|
|
l_cajas.TextColor = Colors.Red
|
|
l_piezas.TextColor = Colors.Gray
|
|
p_cant_cajas.Color = Colors.Transparent
|
|
p_cant_piezas.Color = Colors.Transparent
|
|
Panel6.Width = Root.Width
|
|
Panel6.Height= Root.Height
|
|
e_prod.Enabled = False
|
|
|
|
'Se crea lista para incidencias
|
|
c = Starter.skmt.ExecQuery("SELECT CAT_INC_DESCRIPCION FROM CAT_INCIDENCIA")
|
|
Dim Items As List
|
|
Items.Initialize
|
|
If c.RowCount > 0 Then
|
|
Items.Add("SELECCIONA UNA OPCION")
|
|
For i = 0 To c.RowCount-1
|
|
c.Position = i
|
|
Items.Add(c.GetString("CAT_INC_DESCRIPCION"))
|
|
Next
|
|
B4XComboBox1.SetItems(Items)
|
|
End If
|
|
c.Close
|
|
itemselect = "Selecciona una opcion"
|
|
|
|
|
|
|
|
'Se crean lista para producto que no este registrado
|
|
SearchTemplate.Initialize
|
|
Dialog.BackgroundColor = Colors.White
|
|
Dialog.ButtonsColor = Colors.Blue
|
|
Dialog.BorderColor = Colors.Blue
|
|
Dialog.ButtonsTextColor = Colors.White
|
|
Dialog.BorderCornersRadius = 30
|
|
Dialog.ButtonsHeight = 70
|
|
SearchTemplate.Resize(330dip,370dip)
|
|
SearchTemplate.ItemHightlightColor = Colors.Blue
|
|
SearchTemplate.CustomListView1.sv.ScrollViewInnerPanel.Color = Colors.Blue
|
|
SearchTemplate.CustomListView1.DefaultTextColor = Colors.Black
|
|
SearchTemplate.CustomListView1.DefaultTextBackgroundColor = Colors.White
|
|
SearchTemplate.TextHighlightColor = Colors.Black
|
|
SearchTemplate.SearchField.TextField.TextColor = Colors.Black
|
|
d = Starter.skmt.ExecQuery("SELECT CAT_GP_NOMBRE FROM CAT_PRODUCTOS_ALMACEN")
|
|
Dim Items2 As List
|
|
Items2.Initialize
|
|
If d.RowCount > 0 Then
|
|
|
|
For i = 1 To d.RowCount-1
|
|
d.Position = i
|
|
Items2.Add(d.GetString("CAT_GP_NOMBRE"))
|
|
Next
|
|
SearchTemplate.SetItems(Items2)
|
|
End If
|
|
d.Close
|
|
p_busqueda.Enabled = False
|
|
p_busquedainci.Enabled = False
|
|
|
|
'Creacion de spinners para caducidad
|
|
Dim dias As List : dias.Initialize
|
|
Log(month)
|
|
For i = 1 To 31
|
|
Dim Item As ASWheelPicker_Item
|
|
Item.Initialize
|
|
Item.Text = i
|
|
Item.Value = i
|
|
Item.ItemTextProperties = ASWheelPicker1.ItemTextProperties
|
|
Item.ItemTextProperties.TextColor = (0x8FF000000)
|
|
dias.Add(Item)
|
|
Next
|
|
|
|
ASWheelPicker1.AddItems(dias)
|
|
|
|
Dim mes0 As List : mes0.Initialize
|
|
mes0 = Array As String("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre")
|
|
Dim mes As List
|
|
mes.Initialize
|
|
For Each o As Object In mes0
|
|
Dim Item As ASWheelPicker_Item
|
|
Item.Initialize
|
|
Item.Text = o
|
|
Item.Value = o
|
|
Item.ItemTextProperties = ASWheelPicker2.ItemTextProperties
|
|
Item.ItemTextProperties.TextColor = (0x8FF000000)
|
|
mes.Add(Item)
|
|
Next
|
|
ASWheelPicker2.AddItems(mes)
|
|
|
|
Dim year As List : year.Initialize
|
|
For i = DateTime.GetYear(DateTime.Now) To DateTime.GetYear(DateTime.Now) + 4
|
|
Dim Item As ASWheelPicker_Item
|
|
Item.Initialize
|
|
Item.Text = i
|
|
Item.Value = i
|
|
Item.ItemTextProperties = ASWheelPicker3.ItemTextProperties
|
|
Item.ItemTextProperties.TextColor = (0x8FF000000)
|
|
year.Add(Item)
|
|
Next
|
|
ASWheelPicker3.AddItems(year)
|
|
|
|
ASWheelPicker1.Refresh
|
|
ASWheelPicker2.Refresh
|
|
ASWheelPicker3.Refresh
|
|
|
|
If (DateTime.GetMonth(DateTime.Now)= 1 Or DateTime.GetMonth(DateTime.Now)= 2 Or DateTime.GetMonth(DateTime.Now)= 3 Or DateTime.GetMonth(DateTime.Now)= 4 Or DateTime.GetMonth(DateTime.Now)= 5 Or DateTime.GetMonth(DateTime.Now)= 6 Or DateTime.GetMonth(DateTime.Now)= 7 Or DateTime.GetMonth(DateTime.Now)= 8 Or DateTime.GetMonth(DateTime.Now)= 9 ) Then
|
|
l_fecha_caducidad.Text = DateTime.GetDayOfMonth(DateTime.Now)&"/"&"0"&DateTime.GetMonth(DateTime.Now)&"/"&DateTime.GetYear(DateTime.Now)
|
|
End If
|
|
|
|
'camara
|
|
Panel6.Visible = False
|
|
p_camara.Height = Root.Height
|
|
p_camara.Width = Root.Width
|
|
p_camara.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
|
|
|
|
Private Sub B4XPage_Appear
|
|
DateTime.DateFormat="dd/MM/yyyy"
|
|
E_ESCANER.RequestFocus
|
|
InitializeCamera2
|
|
clv_producto.Clear
|
|
p_prodnoencontrado.Visible = False
|
|
p_inci.Visible = False
|
|
p_nums.Visible = True
|
|
P_escan.Visible = True
|
|
|
|
End Sub
|
|
'
|
|
Private Sub B4XPage_Resume
|
|
Log("pausado")
|
|
p_nums.Visible = True
|
|
P_escan.Visible = True
|
|
InitializeCamera2
|
|
End Sub
|
|
|
|
'tomar foto
|
|
|
|
Private Sub InitializeCamera2
|
|
Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_CAMERA)
|
|
' Wait For Activity_PermissionResult (Permission As String, Result As Boolean)
|
|
' If Result Then
|
|
camEx2.Initialize(p_cam, frontCamera, Me, "Camera1")
|
|
frontCamera = camEx2.Front
|
|
Log("inicializamos Camara")
|
|
' Else
|
|
' ToastMessageShow("No permission!!!", True)
|
|
' End If
|
|
Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_WRITE_EXTERNAL_STORAGE)
|
|
End Sub
|
|
|
|
Sub Camera1_Ready (Success As Boolean)
|
|
Log("Camara ready")
|
|
If Success Then
|
|
camEx2.SetJpegQuality(90)
|
|
camEx2.SetContinuousAutoFocus
|
|
camEx2.CommitParameters
|
|
camEx2.StartPreview
|
|
Log(camEx2.GetPreviewSize)
|
|
Else
|
|
ToastMessageShow("Cannot open camera.", True)
|
|
Log("Cannot open camera")
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub b_cam_inci_Click
|
|
foto = 2
|
|
DateTime.DateFormat="ddMMyyyyHHmmss"
|
|
InitializeCamera2
|
|
p_camara.Visible = True
|
|
nombrefoto = DateTime.Now & "_foto.jpg"
|
|
teclado.HideKeyboard
|
|
End Sub
|
|
|
|
Private Sub p_camara_Click
|
|
|
|
End Sub
|
|
|
|
|
|
Private Sub b_foto_inci_Click
|
|
camEx2.TakePicture
|
|
' p_camara.Visible = False
|
|
' StopCamera
|
|
End Sub
|
|
|
|
Sub Camera1_PictureTaken (Data()As Byte)
|
|
Log("tome foto")
|
|
Dim filename As String = nombrefoto
|
|
Dim Dirp As String = File.DirRootExternal
|
|
Dim Dir As String
|
|
Try
|
|
File.MakeDir(Dirp,"incidenciaskmts")
|
|
Dir = "/incidenciaskmts"
|
|
Catch
|
|
Dir = ""
|
|
End Try
|
|
|
|
camEx2.SavePictureToFile(Data, Dirp&Dir, filename)
|
|
camEx2.StartPreview 'restart preview
|
|
ToastMessageShow("Picture saved." & CRLF & "File size: " & File.Size(Dir, filename) & Dir &"," & filename, True)
|
|
Log("Picture saved." & CRLF & "File size: " & File.Size(Dir, filename) & Dir &"," & filename)
|
|
p_camara.Visible = False
|
|
StopCamera2
|
|
End Sub
|
|
|
|
Private Sub StopCamera2
|
|
' Capturing = False
|
|
If camEx2.IsInitialized Then
|
|
camEx2.Release
|
|
End If
|
|
End Sub
|
|
|
|
'fin tomar foto
|
|
|
|
'camara
|
|
|
|
Private Sub B4XPage_Disappear
|
|
If p_camara.Visible = True Then
|
|
p_camara.Visible= False
|
|
StopCamera2
|
|
Else if Panel6.Visible = True Then
|
|
Panel6.Visible = False
|
|
StopCamera
|
|
End If
|
|
|
|
' StopCamera
|
|
' StopCamera2
|
|
' Panel6.Visible = False
|
|
' p_calendario.Visible = False
|
|
|
|
|
|
End Sub
|
|
|
|
|
|
Sub btnStartStop_Click
|
|
foto = 1
|
|
If Capturing = False Then
|
|
Panel6.Visible = True
|
|
StartCamera
|
|
phn.Vibrate(100)
|
|
Else
|
|
Panel6.Visible = False
|
|
StopCamera
|
|
phn.Vibrate(100)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub B_cerrar_Click
|
|
If E_ESCANER.Text.Length = 0 Then
|
|
Panel6.Visible = False
|
|
StopCamera
|
|
StopCamera2
|
|
phn.Vibrate(100)
|
|
Else
|
|
Panel6.Visible = False
|
|
StopCamera
|
|
StopCamera2
|
|
E_ESCANER_EnterPressed
|
|
phn.Vibrate(100)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub StopCamera
|
|
' E_ESCANER.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)
|
|
E_ESCANER.Text = msg
|
|
toast.Show($"Found [Color=Red][b][plain]${msg}[/plain][/b][/Color]"$)
|
|
Log(msg)
|
|
If E_ESCANER.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
|
|
Else
|
|
toast.Show("Error opening camera")
|
|
StopCamera
|
|
End If
|
|
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 E_ESCANER_EnterPressed
|
|
|
|
c=Starter.skmt.ExecQuery2("select count(*) as CUANTOS from CAT_EQUIVALENCIAS where CAT_EQ_EQUIVALENCIA = ? ", Array As String(E_ESCANER.TEXT))
|
|
c.Position = 0
|
|
codigo_escaner = c.GetString("CUANTOS")
|
|
c.Close
|
|
If codigo_escaner > 0 Then
|
|
c=Starter.skmt.ExecQuery2("select CAT_EQ_CODIGO, CAT_EQ_EQUIVALENCIA from CAT_EQUIVALENCIAS where CAT_EQ_EQUIVALENCIA = ? ", Array As String(E_ESCANER.TEXT))
|
|
c.Position = 0
|
|
codigo_escaner = c.GetString("CAT_EQ_CODIGO")
|
|
c.Close
|
|
c=Starter.skmt.ExecQuery2("select CAT_GP_NOMBRE from CAT_GUNAPROD where CAT_GP_ID = ? ", Array As String(codigo_escaner))
|
|
d=Starter.skmt.ExecQuery2("SELECT CAT_OC_FOLIO, RESTA, CAT_OC_UM FROM CAT_ORDENCOMPRA_SUMA WHERE CAT_OC_IDPROD = ?",Array As String (codigo_escaner))
|
|
clv_producto.Clear
|
|
d.Position = 0
|
|
c.Position = 0
|
|
|
|
If d.RowCount = 0 Then
|
|
Log("entre a registrar un producto escaneado")
|
|
|
|
clv_producto.AsView.Visible = False
|
|
p_prodnoencontrado.Visible = True
|
|
|
|
' c.Position = 0
|
|
For i = 0 To c.RowCount - 1
|
|
c.Position = i
|
|
lb_prodn.Text = (c.GetString("CAT_GP_NOMBRE"))
|
|
Next
|
|
c.Close
|
|
|
|
d = Starter.skmt.ExecQuery("SELECT ORDEN FROM CAT_ORDENES_SELECCIONADAS")
|
|
Dim Items4 As List
|
|
Items4.Initialize
|
|
If d.RowCount > 0 Then
|
|
Items4.Add("Selecciona una opcion")
|
|
For i = 0 To d.RowCount-1
|
|
d.Position = i
|
|
Items4.Add(d.GetString("ORDEN"))
|
|
Next
|
|
c_prodn.SetItems(Items4)
|
|
End If
|
|
d.Close
|
|
itemselect3 = "Selecciona una opcion"
|
|
|
|
Dim items5 As List
|
|
items5.Initialize
|
|
items5.Add("Selecciona una opcion")
|
|
items5.Add("CS")
|
|
items5.Add("EA")
|
|
|
|
c_entradan.SetItems(items5)
|
|
itemselect4 = "Selecciona una opcion"
|
|
|
|
|
|
Else If p_inci.Visible = True Then
|
|
|
|
Log("encontre el codigo con incidencia")
|
|
|
|
clv_producto.AsView.Visible = False
|
|
p_prodnoencontrado.Visible = False
|
|
' c.Position = 0
|
|
For i = 0 To c.RowCount - 1
|
|
c.Position = i
|
|
e_prod.Text = (c.GetString("CAT_GP_NOMBRE"))
|
|
Next
|
|
c.Close
|
|
|
|
Else
|
|
Log("encontre el codigo")
|
|
clv_producto.AsView.Visible = True
|
|
' c.Position = 0
|
|
' d.Position = 0
|
|
For i = 0 To d.RowCount - 1
|
|
d.Position = i
|
|
clv_producto.Add(CreateListItem(c.GetString("CAT_GP_NOMBRE"),d.GetString("CAT_OC_FOLIO"),d.GetString("RESTA"),d.GetString("CAT_OC_UM")),i)
|
|
Next
|
|
c.Close
|
|
d.Close
|
|
End If
|
|
|
|
Else If E_ESCANER.Text.Length = 0 Then
|
|
Log("no hice nada ")
|
|
|
|
Else
|
|
If p_inci.Visible Then
|
|
Log("entre a incidencia de producto no encontrado")
|
|
c=Starter.skmt.ExecQuery2("select CAT_GP_NOMBRE from CAT_GUNAPROD where CAT_GP_ID = ? ", Array As String(codigo_escaner))
|
|
p_busquedainci_Click
|
|
p_prodnoencontrado.Visible = False
|
|
clv_producto.AsView.Visible = False
|
|
c.Position = 0
|
|
For i = 0 To c.RowCount - 1
|
|
c.Position = i
|
|
e_prod.Text = (c.GetString("CAT_GP_NOMBRE"))
|
|
Next
|
|
c.Close
|
|
Else
|
|
Log("entre aqui")
|
|
MsgboxAsync("CODIGO NO ENCONTRADO","AVISO")
|
|
' e_prod.Text = "Pendiente alta"
|
|
p_busqueda.Enabled = True
|
|
p_busquedainci.Enabled = True
|
|
p_busqueda_Click
|
|
p_prodnoencontrado.Visible = True
|
|
End If
|
|
End If
|
|
|
|
|
|
If E_ESCANER.Text.Length > 1 Then
|
|
teclado.HideKeyboard
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Sub CreateListItem(mostrar As String, mostrar1 As String, mostrar2 As String, mostrar3 As String) As Panel
|
|
Dim p As B4XView = xui.CreatePanel("")
|
|
p.SetLayoutAnimated(0, 0, 0, 1, 115)
|
|
p.LoadLayout("detalle_folio")
|
|
p.Height= 195dip
|
|
' p.Width = clv_orden.GetBase.Width
|
|
lb_prod.Text = mostrar
|
|
Label5.Text = mostrar1
|
|
lb_cantarchivo.Text = mostrar2
|
|
lb_entrada.Text = mostrar3
|
|
|
|
' Log(p.Width)
|
|
Return p
|
|
End Sub
|
|
|
|
Private Sub p_inci_Click
|
|
teclado.HideKeyboard
|
|
End Sub
|
|
|
|
Private Sub p_nums_Click
|
|
teclado.HideKeyboard
|
|
End Sub
|
|
|
|
Private Sub b_sig_Click
|
|
|
|
If p_prodnoencontrado.Visible = False Then
|
|
|
|
Dim r_guardado, continuar As Boolean = False
|
|
|
|
For x= 0 To clv_producto.Size - 1
|
|
Log(x & " y " & clv_producto.Size)
|
|
clv_producto.GetPanel(x)
|
|
Dim pnl0 As B4XView = clv_producto.GetPanel(x)
|
|
Dim pnl1 As B4XView = pnl0.GetView(0)
|
|
Dim b_fc As B4XView = pnl1.GetView(5)
|
|
Dim lb_oc As B4XView = pnl1.GetView(8)
|
|
|
|
Dim pnl2 As B4XView = pnl1.GetView(4)
|
|
Dim et_escan As B4XView = pnl2.GetView(0)
|
|
Log("|" & b_fc.Text & "| y |" & et_escan.text &"| y " & lb_oc.Text)
|
|
If et_escan.Text <> "" And b_fc.Text = "Caducidad" Then
|
|
continuar = False
|
|
MsgboxAsync("Captura la fecha de caducidad de todos los productos","")
|
|
Log("no cumple")
|
|
Exit
|
|
Else
|
|
continuar = True
|
|
Log("si cumple")
|
|
End If
|
|
Log("continuar0 = "& continuar)
|
|
Next
|
|
|
|
Log("Continuar =" & continuar)
|
|
If continuar Then
|
|
For x= 0 To clv_producto.Size - 1
|
|
Log(x & " y " & clv_producto.Size)
|
|
clv_producto.GetPanel(x)
|
|
Dim pnl0 As B4XView = clv_producto.GetPanel(x)
|
|
Dim pnl1 As B4XView = pnl0.GetView(0)
|
|
Dim lb_np As B4XView = pnl1.GetView(3)
|
|
Dim lb_oc As B4XView = pnl1.GetView(8)
|
|
Dim lb_um As B4XView = pnl1.GetView(7)
|
|
Dim b_fc As B4XView = pnl1.GetView(5)
|
|
Dim lb_cant As B4XView = pnl1.GetView(10)
|
|
|
|
Dim pnl2 As B4XView = pnl1.GetView(4)
|
|
Dim et_escan As B4XView = pnl2.GetView(0)
|
|
|
|
If et_escan.Text <> "" And lb_um.Text = "EA" And b_fc.Text <> "Caducidad" Then
|
|
|
|
DateTime.DateFormat="ddMMyyyyHHmmss"
|
|
Dim nuevaFecha As String = DateTime.DATE(DateTime.Now)
|
|
db.ExecNonQuery2("INSERT INTO CAT_ESCANEO (CAT_ID_USUARIO , CAT_ALMACEN, CAT_COD_BAR, CAT_NOM_PROD, CAT_CAJAS, CAT_PIEZAS, CAT_FEC_CAD, CAT_ORDEN_COMPRA, CAT_FECHA_CAPTURA, CAT_STATUS)VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", Array As Object (B4XPages.MainPage.user, Starter.almacen, E_ESCANER.Text, lb_np.text,0,et_escan.Text,b_fc.Text,lb_oc.Text,nuevaFecha,"0"))
|
|
Log("inserte " & et_escan.Text)
|
|
Dim rest = lb_cant.Text - et_escan.Text
|
|
Log(rest)
|
|
Starter.skmt.ExecNonQuery2("UPDATE CAT_ORDENCOMPRA_SUMA SET RESTA = ? WHERE CAT_OC_IDPROD = ? and CAT_OC_FOLIO = ?", Array As String (rest, codigo_escaner, lb_oc.Text))
|
|
Log("actualice " & et_escan.Text)
|
|
r_guardado = True
|
|
LogColor("Se envio "& lb_oc.text,Colors.red)
|
|
|
|
Else If et_escan.Text <> "" And lb_um.Text = "CS" And b_fc.Text <> "Caducidad" Then
|
|
|
|
DateTime.DateFormat="ddMMyyyyHHmmss"
|
|
Dim nuevaFecha As String = DateTime.DATE(DateTime.Now)
|
|
db.ExecNonQuery2("INSERT INTO CAT_ESCANEO (CAT_ID_USUARIO , CAT_ALMACEN, CAT_COD_BAR, CAT_NOM_PROD, CAT_CAJAS, CAT_PIEZAS, CAT_FEC_CAD, CAT_ORDEN_COMPRA, CAT_FECHA_CAPTURA, CAT_STATUS)VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", Array As Object (B4XPages.MainPage.user, Starter.almacen, E_ESCANER.Text, lb_np.text,et_escan.Text, 0,b_fc.Text,lb_oc.Text,nuevaFecha,"0"))
|
|
Log("inserte " & et_escan.Text)
|
|
Dim rest = lb_cant.Text - et_escan.Text
|
|
Log(rest)
|
|
Starter.skmt.ExecNonQuery2("UPDATE CAT_ORDENCOMPRA_SUMA SET RESTA = ? WHERE CAT_OC_IDPROD = ? and CAT_OC_FOLIO = ?", Array As String (rest, codigo_escaner, lb_oc.Text))
|
|
Log("actualice " & et_escan.Text)
|
|
r_guardado = True
|
|
LogColor("Se envio "& lb_oc.text,Colors.red)
|
|
|
|
Else If et_escan.Text = "" And (lb_um.Text = "EA" Or lb_um.Text = "CS") And b_fc.Text = "Caducidad" Then
|
|
|
|
Else
|
|
MsgboxAsync("Captura datos", "")
|
|
r_guardado = False
|
|
|
|
End If
|
|
Next
|
|
If r_guardado Then
|
|
clv_producto.Clear
|
|
E_ESCANER.Text = ""
|
|
p_nums.Visible = True 'fl lo agregue
|
|
E_ESCANER.RequestFocus
|
|
b_cadincidencia.Text = "Caducidad"
|
|
DateTime.DateFormat="dd/MM/yyyy"
|
|
MsgboxAsync("Datos guardados","")
|
|
phn.Vibrate(100)
|
|
p_busqueda.Enabled = False
|
|
|
|
|
|
End If
|
|
End If
|
|
|
|
Else If p_prodnoencontrado.Visible = True Then
|
|
|
|
If et_cantn.Text <> "" And cadx.Text <> "Caducidad" Then
|
|
|
|
If itemselect4 = "CS" Then
|
|
|
|
DateTime.DateFormat="ddMMyyyyHHmmss"
|
|
Dim nuevaFecha As String = DateTime.DATE(DateTime.Now)
|
|
db.ExecNonQuery2("INSERT INTO CAT_ESCANEO (CAT_ID_USUARIO , CAT_ALMACEN, CAT_COD_BAR, CAT_NOM_PROD, CAT_CAJAS, CAT_PIEZAS, CAT_FEC_CAD, CAT_ORDEN_COMPRA, CAT_FECHA_CAPTURA, CAT_STATUS)VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", Array As Object (B4XPages.MainPage.user, Starter.almacen, E_ESCANER.Text, lb_prodn.text,et_cantn.text,0,b_cad.text,itemselect3,nuevaFecha,"0"))
|
|
E_ESCANER.Text = ""
|
|
p_nums.Visible = True 'fl lo agregue
|
|
p_prodnoencontrado.Visible = False
|
|
cadx.Text = "Caducidad"
|
|
E_ESCANER.RequestFocus
|
|
b_cadincidencia.Text = "Caducidad"
|
|
DateTime.DateFormat="dd/MM/yyyy"
|
|
MsgboxAsync("Datos guardados","")
|
|
phn.Vibrate(100)
|
|
p_busqueda.Enabled = False
|
|
c_entradan.SelectedIndex = 0
|
|
c_prodn.SelectedIndex = 0
|
|
et_cantn.Text = ""
|
|
clv_producto.AsView.Visible = True
|
|
|
|
Else If itemselect4 = "EA" Then
|
|
|
|
DateTime.DateFormat="ddMMyyyyHHmmss"
|
|
Dim nuevaFecha As String = DateTime.DATE(DateTime.Now)
|
|
db.ExecNonQuery2("INSERT INTO CAT_ESCANEO (CAT_ID_USUARIO , CAT_ALMACEN, CAT_COD_BAR, CAT_NOM_PROD, CAT_CAJAS, CAT_PIEZAS, CAT_FEC_CAD, CAT_ORDEN_COMPRA, CAT_FECHA_CAPTURA, CAT_STATUS)VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", Array As Object (B4XPages.MainPage.user, Starter.almacen, E_ESCANER.Text, lb_prodn.text,0,et_cantn.text,b_cad.text,itemselect3,nuevaFecha,"0"))
|
|
E_ESCANER.Text = ""
|
|
p_nums.Visible = True 'fl lo agregue
|
|
p_prodnoencontrado.Visible = False
|
|
cadx.Text = "Caducidad"
|
|
E_ESCANER.RequestFocus
|
|
b_cadincidencia.Text = "Caducidad"
|
|
DateTime.DateFormat="dd/MM/yyyy"
|
|
MsgboxAsync("Datos guardados","")
|
|
phn.Vibrate(100)
|
|
p_busqueda.Enabled = False
|
|
c_entradan.SelectedIndex = 0
|
|
c_prodn.SelectedIndex = 0
|
|
et_cantn.Text = ""
|
|
clv_producto.AsView.Visible = True
|
|
|
|
End If
|
|
|
|
Else If (et_cantn.Text <> "" And b_cad.Text = "Caducidad") Or (et_cantn.Text = "" And cadx.Text = "Caducidad") Then
|
|
|
|
MsgboxAsync("Captura todos los datos","")
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub p_busqueda_Click
|
|
phn.Vibrate(100)
|
|
Wait For (Dialog.ShowTemplate(SearchTemplate, "", "", "Cancelar")) Complete (Result As Int)
|
|
If Result = xui.DialogResponse_Positive Then
|
|
clv_producto.AsView.Visible = False
|
|
lb_prodn.Text = SearchTemplate.SelectedItem
|
|
' e_prod.Text = SearchTemplate.SelectedItem
|
|
End If
|
|
phn.Vibrate(100)
|
|
|
|
d = Starter.skmt.ExecQuery("SELECT ORDEN FROM CAT_ORDENES_SELECCIONADAS")
|
|
Dim Items4 As List
|
|
Items4.Initialize
|
|
If d.RowCount > 0 Then
|
|
Items4.Add("Selecciona una opcion")
|
|
For i = 0 To d.RowCount-1
|
|
d.Position = i
|
|
Items4.Add(d.GetString("ORDEN"))
|
|
Next
|
|
c_prodn.SetItems(Items4)
|
|
End If
|
|
d.Close
|
|
itemselect3 = "Selecciona una opcion"
|
|
|
|
Dim items5 As List
|
|
items5.Initialize
|
|
items5.Add("Selecciona una opcion")
|
|
items5.Add("CS")
|
|
items5.Add("EA")
|
|
|
|
c_entradan.SetItems(items5)
|
|
itemselect4 = "Selecciona una opcion"
|
|
|
|
End Sub
|
|
|
|
Private Sub b_incidencia_Click
|
|
p_inci.Visible = True
|
|
P_escan.Visible = False
|
|
p_prodnoencontrado.Visible = False
|
|
phn.Vibrate(100)
|
|
|
|
|
|
c = Starter.skmt.ExecQuery("SELECT ORDEN FROM CAT_ORDENES_SELECCIONADAS")
|
|
Dim Items3 As List
|
|
Items3.Initialize
|
|
If c.RowCount > 0 Then
|
|
Items3.Add("SELECCIONA UNA OPCION")
|
|
For i = 0 To c.RowCount-1
|
|
c.Position = i
|
|
Items3.Add(c.GetString("ORDEN"))
|
|
Next
|
|
B4XComboBox2.SetItems(Items3)
|
|
End If
|
|
c.Close
|
|
itemselect2 = "Selecciona una opcion"
|
|
|
|
End Sub
|
|
|
|
Private Sub c_entradan_SelectedIndexChanged (Index As Int)
|
|
itemselect4 = Sender.As(B4XComboBox).SelectedItem
|
|
Log(itemselect4)
|
|
Log(Index)
|
|
End Sub
|
|
|
|
Private Sub c_prodn_SelectedIndexChanged (Index As Int)
|
|
itemselect3 = Sender.As(B4XComboBox).SelectedItem
|
|
Log(itemselect3)
|
|
Log(Index)
|
|
End Sub
|
|
|
|
Private Sub B4XComboBox2_SelectedIndexChanged (Index As Int)
|
|
itemselect2 = Sender.As(B4XComboBox).SelectedItem
|
|
Log(itemselect2)
|
|
Log(Index)
|
|
End Sub
|
|
|
|
Private Sub B4XComboBox1_SelectedIndexChanged (Index As Int)
|
|
itemselect = Sender.As(B4XComboBox).SelectedItem
|
|
Log(itemselect)
|
|
Log(Index)
|
|
End Sub
|
|
|
|
Private Sub b_cadincidencia_Click
|
|
p_calendario.Visible = True
|
|
phn.Vibrate(100)
|
|
End Sub
|
|
|
|
Private Sub b_limpiar_Click
|
|
|
|
If p_prodnoencontrado.Visible Then
|
|
|
|
p_busqueda.Enabled = False
|
|
p_prodnoencontrado.Visible = False
|
|
b_cad.Text = "Caducidad"
|
|
c_prodn.SelectedIndex = 0
|
|
c_entradan.SelectedIndex = 0
|
|
lb_prodn.Text = ""
|
|
et_cantn.Text = ""
|
|
E_ESCANER.Text = ""
|
|
|
|
Else
|
|
|
|
e_prod.Text = ""
|
|
E_ESCANER.Text = ""
|
|
b_cadincidencia.Text = "Caducidad"
|
|
E_ESCANER.RequestFocus
|
|
' b_cad.Text = "Caducidad"
|
|
phn.Vibrate(100)
|
|
p_busqueda.Enabled = False
|
|
clv_producto.Clear
|
|
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub B_registrar_Click
|
|
If et_cant_incidencia.Text.Length > 0 And b_cadincidencia.Text <> "Caducidad" Then
|
|
If B4XComboBox1.SelectedIndex > 0 Then
|
|
DateTime.DateFormat="ddMMyyyyHHmmss"
|
|
Dim nuevaFecha As String=DateTime.Date(DateTime.Now)
|
|
db.ExecNonQuery2("INSERT INTO CAT_ESCAN_INCIDENCIA (CAT_ID_USUARIO, CAT_ALMACEN, CAT_COD_BAR, CAT_NOM_PROD, CAT_TIPO_INCIDENCIA, CAT_CANT, CAT_DETALLE_INCIDENCIA, CAT_FEC_CAD, CAT_ORDEN_COMPRA, CAT_FECHA_CAPTURA, CAT_FOTO, CAT_STATUS)VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", Array As Object (B4XPages.MainPage.user, Starter.almacen, E_ESCANER.Text,e_prod.Text,itemselect,et_cant_incidencia.Text,ed_com.Text,b_cadincidencia.Text,itemselect2, nuevaFecha,nombrefoto,"0"))
|
|
B4XComboBox1.SelectedIndex = 0
|
|
e_prod.Text = ""
|
|
et_cant_incidencia.Text = ""
|
|
E_ESCANER.Text = ""
|
|
b_cadincidencia.Text = "Caducidad"
|
|
E_ESCANER.RequestFocus
|
|
ed_com.Text = ""
|
|
p_inci.Visible = False
|
|
P_escan.Visible = True
|
|
b_cad.Text = "Caducidad"
|
|
DateTime.DateFormat="dd/MM/yyyy"
|
|
MsgboxAsync("Datos guardados","")
|
|
phn.Vibrate(100)
|
|
p_busqueda.Enabled = False
|
|
p_busquedainci.Enabled = False
|
|
B4XComboBox1.SelectedIndex = 0
|
|
Else
|
|
MsgboxAsync("Selecciona una opción valida", "")
|
|
End If
|
|
Else
|
|
MsgboxAsync("Captura todos los datos", "")
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub b_cancel_Click
|
|
e_prod.Text = ""
|
|
p_inci.Visible = False
|
|
P_escan.Visible = True
|
|
et_cant_incidencia.Text = ""
|
|
E_ESCANER.Text = ""
|
|
b_cadincidencia.Text = "Caducidad"
|
|
E_ESCANER.RequestFocus
|
|
ed_com.Text = ""
|
|
B4XComboBox1.SelectedIndex = 0
|
|
B4XComboBox2.SelectedIndex = 0
|
|
phn.Vibrate(100)
|
|
p_busquedainci.Enabled = False
|
|
End Sub
|
|
|
|
Private Sub b_cad_Click
|
|
p_calendario.Visible = True
|
|
cadx = Sender
|
|
phn.Vibrate(100)
|
|
teclado.HideKeyboard
|
|
End Sub
|
|
|
|
Private Sub b_cadcancel_Click
|
|
If b_cad.Text <> "Caducidad" Then
|
|
p_calendario.Visible = False
|
|
phn.Vibrate(100)
|
|
Else
|
|
p_calendario.Visible = False
|
|
phn.Vibrate(100)
|
|
b_cad.Text = "Caducidad"
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub p_calendario_Click
|
|
|
|
End Sub
|
|
|
|
Private Sub ASWheelPicker1_ItemChange(Column As Int,ListIndex As Int)
|
|
l_fecha_caducidad.Text = ASWheelPicker1.GetSelectedItem(Column).Text
|
|
day = ASWheelPicker1.GetSelectedItem(Column).Text
|
|
|
|
If day = 1 Or day = "2" Or day = "3" Or day = "4" Or day = "5" Or day = "6" Or day = "7" Or day = "8" Or day = "9" Then
|
|
l_fecha_caducidad.Text = "0"&day&"/"&month2&"/"&year2
|
|
Else
|
|
l_fecha_caducidad.Text = day&"/"&month2&"/"&year2
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub ASWheelPicker2_ItemChange(Column As Int,ListIndex As Int)
|
|
l_fecha_caducidad.Text = ASWheelPicker2.GetSelectedItem(Column).Text
|
|
month = ASWheelPicker2.GetSelectedItem(Column).Text
|
|
|
|
If month = "Enero" Then
|
|
month2 = "01"
|
|
Else If month = "Febrero" Then
|
|
month2 = "02"
|
|
Else If month = "Marzo" Then
|
|
month2 = "03"
|
|
Else If month = "Abril" Then
|
|
month2 = "04"
|
|
Else If month = "Mayo" Then
|
|
month2 = "05"
|
|
Else If month = "Junio" Then
|
|
month2 = "06"
|
|
Else If month = "Julio" Then
|
|
month2 = "07"
|
|
Else If month = "Agosto" Then
|
|
month2 = "08"
|
|
Else If month = "Septiembre" Then
|
|
month2 = "09"
|
|
Else If month = "Octubre" Then
|
|
month2 = "10"
|
|
Else If month = "Noviembre" Then
|
|
month2 = "11"
|
|
Else If month = "Diciembre" Then
|
|
month2 = "12"
|
|
End If
|
|
|
|
If day = 1 Or day = "2" Or day = "3" Or day = "4" Or day = "5" Or day = "6" Or day = "7" Or day = "8" Or day = "9" Then
|
|
l_fecha_caducidad.Text = "0"&day&"/"&month2&"/"&year2
|
|
Else
|
|
l_fecha_caducidad.Text = day&"/"&month2&"/"&year2
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub ASWheelPicker3_ItemChange(Column As Int,ListIndex As Int)
|
|
l_fecha_caducidad.Text = ASWheelPicker3.GetSelectedItem(Column).Text
|
|
year2 = ASWheelPicker3.GetSelectedItem(Column).Text
|
|
|
|
If day = 1 Or day = "2" Or day = "3" Or day = "4" Or day = "5" Or day = "6" Or day = "7" Or day = "8" Or day = "9" Then
|
|
l_fecha_caducidad.Text = "0"&day&"/"&month2&"/"&year2
|
|
Else
|
|
l_fecha_caducidad.Text = day&"/"&month2&"/"&year2
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub bgfecha_Click
|
|
|
|
If l_fecha_caducidad.Text = "" Then
|
|
cadx.text = "Caducidad"
|
|
b_cadincidencia.Text = "Caducidad"
|
|
Else
|
|
If month = "Febrero" And (day = 31 Or day = 30) And (year2 Mod 4) = 0 Then
|
|
Log(year2 Mod 4)
|
|
cadx.Text = "29"&"/"&month2&"/"&year2
|
|
b_cadincidencia.Text = "29"&"/"&month2&"/"&year2
|
|
Else If month = "Febrero" And (day = 31 Or day = 30 Or day = 29) And (year2 Mod 4) > 1 Then
|
|
cadx.Text = "28"&"/"&month2&"/"&year2
|
|
b_cadincidencia.Text = "28"&"/"&month2&"/"&year2
|
|
Else If month = "Abril" And day = 31 Then
|
|
cadx.Text = "30"&"/"&month2&"/"&year2
|
|
b_cadincidencia.Text = "30"&"/"&month2&"/"&year2
|
|
Else If month = "Junio" And day = 31 Then
|
|
cadx.Text = "30"&"/"&month2&"/"&year2
|
|
b_cadincidencia.Text = "30"&"/"&month2&"/"&year2
|
|
Else If month = "Septiembre" And day = 31 Then
|
|
cadx.Text = "30"&"/"&month2&"/"&year2
|
|
b_cadincidencia.Text = "30"&"/"&month2&"/"&year2
|
|
Else If month = "Noviembre" And day = 31 Then
|
|
cadx.Text = "30"&"/"&month2&"/"&year2
|
|
b_cadincidencia.Text = "30"&"/"&month2&"/"&year2
|
|
Else
|
|
cadx.Text = l_fecha_caducidad.Text
|
|
b_cadincidencia.Text = l_fecha_caducidad.Text
|
|
End If
|
|
p_calendario.Visible = False
|
|
phn.Vibrate(100)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub p_cant_cajas_Click
|
|
panelselect = 1
|
|
phn.Vibrate(100)
|
|
l_cajas.TextColor = Colors.Red
|
|
l_piezas.TextColor = Colors.Gray
|
|
End Sub
|
|
|
|
Private Sub p_cant_piezas_Click
|
|
panelselect = 2
|
|
phn.Vibrate(100)
|
|
l_cajas.TextColor = Colors.Gray
|
|
l_piezas.TextColor = Colors.Red
|
|
End Sub
|
|
|
|
Private Sub num_1_Click
|
|
If panelselect = 1 Then
|
|
e_cant.Text = e_cant.Text & "1"
|
|
e_cant.Text= NumberFormat(e_cant.Text.Replace(",",""),0,0)
|
|
phn.Vibrate(100)
|
|
Else
|
|
e_cantpiezas.Text = e_cantpiezas.Text & "1"
|
|
e_cantpiezas.Text= NumberFormat(e_cantpiezas.Text.Replace(",",""),0,0)
|
|
phn.Vibrate(100)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub num_2_Click
|
|
If panelselect = 1 Then
|
|
e_cant.Text = e_cant.Text & "2"
|
|
e_cant.Text= NumberFormat(e_cant.Text.Replace(",",""),0,0)
|
|
phn.Vibrate(100)
|
|
Else
|
|
e_cantpiezas.Text = e_cantpiezas.Text & "2"
|
|
e_cantpiezas.Text= NumberFormat(e_cantpiezas.Text.Replace(",",""),0,0)
|
|
phn.Vibrate(100)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub num_3_Click
|
|
If panelselect = 1 Then
|
|
e_cant.Text = e_cant.Text & "3"
|
|
e_cant.Text= NumberFormat(e_cant.Text.Replace(",",""),0,0)
|
|
phn.Vibrate(100)
|
|
Else
|
|
e_cantpiezas.Text = e_cantpiezas.Text & "3"
|
|
e_cantpiezas.Text= NumberFormat(e_cantpiezas.Text.Replace(",",""),0,0)
|
|
phn.Vibrate(100)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub num_4_Click
|
|
If panelselect = 1 Then
|
|
e_cant.Text = e_cant.Text & "4"
|
|
e_cant.Text= NumberFormat(e_cant.Text.Replace(",",""),0,0)
|
|
phn.Vibrate(100)
|
|
Else
|
|
e_cantpiezas.Text = e_cantpiezas.Text & "4"
|
|
e_cantpiezas.Text= NumberFormat(e_cantpiezas.Text.Replace(",",""),0,0)
|
|
phn.Vibrate(100)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub num_5_Click
|
|
If panelselect = 1 Then
|
|
e_cant.Text = e_cant.Text & "5"
|
|
e_cant.Text= NumberFormat(e_cant.Text.Replace(",",""),0,0)
|
|
phn.Vibrate(100)
|
|
Else
|
|
e_cantpiezas.Text = e_cantpiezas.Text & "5"
|
|
e_cantpiezas.Text= NumberFormat(e_cantpiezas.Text.Replace(",",""),0,0)
|
|
phn.Vibrate(100)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub num_6_Click
|
|
If panelselect = 1 Then
|
|
e_cant.Text = e_cant.Text & "6"
|
|
e_cant.Text= NumberFormat(e_cant.Text.Replace(",",""),0,0)
|
|
phn.Vibrate(100)
|
|
Else
|
|
e_cantpiezas.Text = e_cantpiezas.Text & "6"
|
|
e_cantpiezas.Text= NumberFormat(e_cantpiezas.Text.Replace(",",""),0,0)
|
|
phn.Vibrate(100)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub num_7_Click
|
|
If panelselect = 1 Then
|
|
e_cant.Text = e_cant.Text & "7"
|
|
e_cant.Text= NumberFormat(e_cant.Text.Replace(",",""),0,0)
|
|
phn.Vibrate(100)
|
|
Else
|
|
e_cantpiezas.Text = e_cantpiezas.Text & "7"
|
|
e_cantpiezas.Text= NumberFormat(e_cantpiezas.Text.Replace(",",""),0,0)
|
|
phn.Vibrate(100)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub num_8_Click
|
|
If panelselect = 1 Then
|
|
e_cant.Text = e_cant.Text & "8"
|
|
e_cant.Text= NumberFormat(e_cant.Text.Replace(",",""),0,0)
|
|
phn.Vibrate(100)
|
|
Else
|
|
e_cantpiezas.Text = e_cantpiezas.Text & "8"
|
|
e_cantpiezas.Text= NumberFormat(e_cantpiezas.Text.Replace(",",""),0,0)
|
|
phn.Vibrate(100)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub num_9_Click
|
|
If panelselect = 1 Then
|
|
e_cant.Text = e_cant.Text & "9"
|
|
e_cant.Text= NumberFormat(e_cant.Text.Replace(",",""),0,0)
|
|
phn.Vibrate(100)
|
|
Else
|
|
e_cantpiezas.Text = e_cantpiezas.Text & "9"
|
|
e_cantpiezas.Text= NumberFormat(e_cantpiezas.Text.Replace(",",""),0,0)
|
|
phn.Vibrate(100)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub num_0_Click
|
|
If panelselect = 1 Then
|
|
e_cant.Text = e_cant.Text & "0"
|
|
e_cant.Text= NumberFormat(e_cant.Text.Replace(",",""),0,0)
|
|
phn.Vibrate(100)
|
|
Else
|
|
e_cantpiezas.Text = e_cantpiezas.Text & "0"
|
|
e_cantpiezas.Text= NumberFormat(e_cantpiezas.Text.Replace(",",""),0,0)
|
|
phn.Vibrate(100)
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub B_borrar_Click
|
|
If panelselect = 1 Then
|
|
If e_cant.Text.Length >= 2 Then
|
|
e_cant.Text = e_cant.Text.SubString2(0,e_cant.Text.Length-1)
|
|
e_cant.Text= NumberFormat(e_cant.Text.Replace(",",""),0,0)
|
|
Else
|
|
If e_cant.Text.Length <> 0 Then
|
|
e_cant.Text = e_cant.Text.SubString2(0,e_cant.Text.Length-1)
|
|
End If
|
|
End If
|
|
phn.Vibrate(80)
|
|
Else
|
|
If e_cantpiezas.Text.Length >= 2 Then
|
|
e_cantpiezas.Text = e_cantpiezas.Text.SubString2(0,e_cantpiezas.Text.Length-1)
|
|
e_cantpiezas.Text= NumberFormat(e_cantpiezas.Text.Replace(",",""),0,0)
|
|
Else
|
|
If e_cantpiezas.Text.Length <> 0 Then
|
|
e_cantpiezas.Text = e_cantpiezas.Text.SubString2(0,e_cantpiezas.Text.Length-1)
|
|
End If
|
|
End If
|
|
phn.Vibrate(80)
|
|
End If
|
|
|
|
End Sub
|
|
|
|
Private Sub b_vreseumen_Click
|
|
|
|
B4XPages.ShowPage ("Resumen")
|
|
|
|
End Sub
|
|
|
|
Private Sub B_borrar_LongClick
|
|
|
|
If panelselect = 1 Then
|
|
e_cant.Text = ""
|
|
Else
|
|
e_cantpiezas.Text = ""
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub B4XPage_CloseRequest As ResumableSub
|
|
' BACK key pressed
|
|
' Return True To close, False To cancel
|
|
If p_camara.Visible = True Then
|
|
p_camara.Visible= False
|
|
StopCamera2
|
|
Else if Panel6.Visible = True Then
|
|
Panel6.Visible = False
|
|
StopCamera
|
|
Else If p_calendario.Visible = True Then
|
|
p_calendario.Visible = False
|
|
Else If p_inci.Visible = True Then
|
|
p_inci.Visible = False
|
|
P_escan.Visible = True
|
|
Else
|
|
B4XPages.ShowPage("Checarorden")
|
|
End If
|
|
' Return True
|
|
Return False
|
|
End Sub
|
|
|
|
Private Sub p_busquedainci_Click
|
|
phn.Vibrate(100)
|
|
Wait For (Dialog.ShowTemplate(SearchTemplate, "", "", "Cancelar")) Complete (Result As Int)
|
|
If Result = xui.DialogResponse_Positive Then
|
|
clv_producto.AsView.Visible = False
|
|
p_prodnoencontrado.Visible = False
|
|
' lb_prodn.Text = SearchTemplate.SelectedItem
|
|
e_prod.Text = SearchTemplate.SelectedItem
|
|
End If
|
|
phn.Vibrate(100)
|
|
End Sub
|
|
|
|
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage. |