'----****
'----**** MyBusiness POS V20
'----**** Version del script: 1.0
'----**** 19/02/2020
'----****
Public Sub Main()
' Si la mauiquina pide configurar el puerto
if Ambiente.Tag = "CONFIGURANDO" Then
Configuracion
else
ProcesaCodigo
end if
End Sub
Public Sub Configuracion()
if Ambiente.Lector.PortOpen Then
Ambiente.Lector.PortOpen = False
end if
Select Case Trim(Ambiente.rstEstacion("pbascula"))
Case "COM1"
Ambiente.Lector.CommPort = 1
Case "COM2"
Ambiente.Lector.CommPort = 2
Case "COM3"
Ambiente.Lector.CommPort = 3
Case "COM4"
Ambiente.Lector.CommPort = 4
Case "COM5"
Ambiente.Lector.CommPort = 5
Case else
Ambiente.Lector.CommPort = 1
End Select
if Ambiente.Lector.PortOpen Then
Exit Sub
end if
Ambiente.Tag = ""
Ambiente.Lector.Settings = "9600,O,7,1"
Ambiente.Lector.RTSEnable = True
Ambiente.Lector.PortOpen = True
TimerLector.Enabled = True
Exit Sub
End Sub
Public Sub ProcesaCodigo
' Si el puerto no esta abierto salimos del procedimiento
if Ambiente.Lector.PortOpen = False Then
Exit Sub
end if
flujo = flujo & Ambiente.Lector.Input
if clAt("S11", flujo ) Then
flujo = ""
end if
if Len(flujo) >= 16 Then
if Mid( flujo, 1, 3) = "S08" Then
Select Case Mid( flujo, 1, 4)
Case "S085"
Teclado.SendKeys ( Mid( flujo,5 ) )
flujo = ""
Case "S08A"
Teclado.SendKeys ( Mid( flujo,5 ) )
flujo = ""
Case "S08F"
if Mid( a,5,1 ) = "F" Then
Teclado.SendKeys ( Mid( flujo,6 ) )
flujo = ""
else
Teclado.SendKeys ( Mid( flujo,5 ) )
flujo = ""
end if
End Select
end if
End If
End Sub
Categoría: MyBusiness POS
VENTAS014 Rutina despues de insertar una Partida
'----****
'----**** MyBusiness POS V20
'----**** Version del script: 1.0
'----**** 19/02/2020
'----****
Public sub Main()
Dim MaxPartidas
'Aqui Cambiar el Numero Maximo de Partidas
MaxPartidas = 30
if fg2.Row >= MaxPartidas then
msgbox "El Número Máximo de Partidas(" & MaxPartidas & ") ha sido alcanzado"
End If
End Sub
TORR5220 Torreta 5220
'----****
'----**** MyBusiness POS V20
'----**** Version del script: 1.0
'----**** 19/02/2020
'----****
Public Sub Main()
if Not Torreta.PortOpen Then
Select Case Trim(Ambiente.rstEstacion("ptorreta"))
Case "COM1"
Torreta.CommPort = 1
Case "COM2"
Torreta.CommPort = 2
Case "COM3"
Torreta.CommPort = 3
Case "COM4"
Torreta.CommPort = 4
Case "COM5"
Torreta.CommPort = 5
Case else
Torreta.CommPort = 1
End Select
Torreta.Settings = "9600,N,8,1"
Torreta.RTSEnable = True
Torreta.PortOpen = True
End if
End Sub
SUCURSALVAR004 Acepta la distribución por sucursal
'----****
'----**** MyBusiness POS V20
'----**** Version del script: 1.0
'----**** 19/02/2020
'----****
Public Sub Main()
Dim nCapturado
nCapturado = 0
For n = 1 to fg.Rows - 1
nCapturado = nCapturado + Val2( fg.TextMatrix( n, 3 ) )
Next
Ambiente.Connection.Execute "DELETE FROM compra2sucdis WHERE id_partida = " & nId
For n = 1 to fg.Rows - 1
AfectaSucDis Val2( fg.TextMatrix( n, 3 ) ), fg.TextMatrix( n, 1 )
Next
End Sub
Public Sub AfectaSucDis( nCantidad, cClave )
Dim rstPartida
Dim rstCompra
Dim MovInv
Dim Query
Dim n
Set rstCompra = CreaRecordSet( "SELECT * FROM compra2 WHERE id = " & Compra, Ambiente.Connection )
Set rstPartida = CreaRecordSet( "SELECT * FROM compra2part WHERE id = " & nId, Ambiente.Connection )
if rstCompra.EOF Then
Exit Sub
end if
if rstPartida.EOF Then
Exit Sub
end if
Set Query = NewQuery()
Set Query.Connection = Ambiente.Connection
Query.strState = "INSERT"
Query.AddField "compra2sucdis","id", TraeSiguiente( "compra2sucdis", Ambiente.Connection )
Query.AddField "compra2sucdis","sucursal", Sucursal
Query.AddField "compra2sucdis","variacion", cClave
Query.AddField "compra2sucdis","id_partida", nId
Query.AddField "compra2sucdis","cantidad", nCantidad
Query.CreateQuery
Query.Execute
End Sub
SUCPROD003 Calcula precios y margen de utilidad
'----****
'----**** MyBusiness POS V20
'----**** Version del script: 1.0
'----**** 19/02/2020
'----****
Public Sub Main()
n = Ambiente.Tag
nCosto = Val2( Parent.txtFields(24) )
Select Case n
Case 2,4,6,8,10,12,14,16,18,20
If nCosto = 0 Then
Exit Sub
End If
nPrecio = Val2( txtFields(n) )
nMargen = ( ( nPrecio / nCosto ) - 1 ) * 100
txtFields(n + 1) = Formato( nMargen, Ambiente.FDinero )
Case 3,5,7,9,11,13,15,17,19,21
If nCosto = 0 Then
Exit Sub
End If
nMargen = Val2( txtFields(n) )
nPrecio = ( ( nMargen / 100 ) + 1 ) * nCosto
txtFields(n - 1) = Formato( nPrecio, Ambiente.FDinero )
'Case 24
' Command1.Setfocus
End Select
End Sub




