Publicado el Dejar un comentario

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

Publicado el Dejar un comentario

PUNTOV039 Al presionar CONTROL + F5 en el punto de venta

'----**** 
'----**** MyBusiness POS V20
'----**** Version del script: 1.0
'----**** 19/02/2020
'----**** 
Sub Main()

    cDato = TecladoVirtual( Ambiente, Trim( Ambiente.rstEstacion("leyendacomodin") ) )

    if clEmpty( (cDato) ) Then
       Exit Sub
    end if

    Set rstVenta = CreaRecordSet( "SELECT * FROM ventas WHERE comodin = '" & Trim( cDato ) & "'", Ambiente.Connection )

    if rstVenta.EOF Then
       MsgBox "No existe el dato buscado", vbInformation
       Exit Sub
    end if

    Set rstVenta = CreaRecordSet( "SELECT * FROM ventas WHERE comodin = '" & Trim( cDato ) & "' AND estado = 'PE'", Ambiente.Connection )

    if rstVenta.EOF Then
       MsgBox "Ya fue cobrado y cerrado: " & cDato, vbInformation
       Exit Sub       
    end if

    LlamaVenta rstVenta("venta")  

End Sub
Publicado el Dejar un comentario

PRODS006 Antes de aceptar en los datos adicionales

'----**** 
'----**** MyBusiness POS V20
'----**** Version del script: 1.0
'----**** 19/02/2020
'----**** 
Public Sub Main()
    Dim DatosAnterior
    Dim DatoNuevo
    Dim nPos

    nPos = clAt("%==%", Ambiente.Tag)
    DatoAnterior = Mid(Ambiente.Tag, 1, nPos - 1)
    DatoNuevo = Mid(Ambiente.Tag, nPos + 4)

    If Len( DatoNuevo ) > 1 Then
       If Val2(DatoNuevo) = 0 Then
          MsgBox "Es necesario un dato numérico", vbInformation
          CancelaProceso = True
       End If
    End if

End Sub
Publicado el Dejar un comentario

PRESUP001 Modulo de presupuesto

'----**** 
'----**** MyBusiness POS V20
'----**** Version del script: 1.0
'----**** 19/02/2020
'----**** 
Public Sub Main()

    txtFields(0) = Ambiente.Uid

End Sub
Publicado el Dejar un comentario

MAGELLAN384 Bascula magellan 384 de un puerto

'----**** 
'----**** 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
       TraePeso       
    end if

End Sub


Public Sub Configuracion()

       if Ambiente.Lector.PortOpen Then
          Exit Sub
       end if

       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.Lector.Settings = "9600,O,7,1"
        Ambiente.Lector.RTSEnable = True    
        Ambiente.Lector.PortOpen = True

        Ambiente.Tag = ""

        Exit Sub

End Sub


Public Sub TraePeso

    ' Si el puerto no esta abierto salimos del procedimiento
    if Ambiente.Lector.PortOpen = False Then
       Exit Sub
    end if 

    a = Ambiente.Lector.Input
    a = ""

    For n = 1 to 50

        Ambiente.Lector.OutPut = Chr(83) & Chr( 49 ) & Chr( 49 ) & Chr( 13 )
    
        ' Si lo que obtenemos es el valor del lector de código de barras
        a = Ambiente.Lector.Input

        if Len( a ) > 0 Then
           a = Replace( Trim( a ), Chr(13), "" )
           a = Val2( Mid( a, 4) ) / 1000
           txtFields(0) = Formato( a, "###,###.0000" )
           AceptaPeso  
           Exit For 
        end if

        Eventos

    Next
 
End Sub