Opportunity to make some Cash

General FreeBASIC programming questions.
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: Opportunity to make some Cash

Post by BasicCoder2 »

@Gablea,
You would need to update the screen part that displays the date and time within every loop within every function so it may not be all that practical. It would probably update too often or sometimes not often enough. A thread however I assume can be locked into an exact second? Your Visual Basic program must do that somehow.

I don't know if any code I write would run on DOS. On the DOS machines I used to use the cpu hardware interrupt to run a background program the details of which I have long forgotten. Now all that is taken care of by the multitasking operating system (Windows and I presume Linux also) which handles all that stuff with this thing they call threads.
.
dodicat
Posts: 7983
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Opportunity to make some Cash

Post by dodicat »

The threading idea proposed (now and before) by basiccoder2 seems to work well on Gablea's screen.
Certainly using locate it throws everything haywire.
But with draw string the outputs are not too bad.
The flicker is there a little bit.
I don't understand why Gablea has rejected it outright.
Maybe it doesn't work on Linux?

GABLEA'S BLACK BOX:

Code: Select all

#include "vbcompat.bi"
#include "fbgfx.bi"
'shell "start fbtime.exe" 

declare Sub PoSScreen
declare sub showtime(byval param As Any Ptr) 
dim shared as integer AppVersion=2017
dim shared as integer totaldue=13
dim shared as integer BarcodeNumber
Dim Shared terminate As Integer = 0

Dim shared thread As Any Ptr




Sub StartPoSMode
 'thread = ThreadCreate( @showtime, 0 )
   dim as string _in
      Do 
         PoSScreen                'Displays the screen
         Locate 26,54 : Input "Barcode : ", _in
         barcodenumber=vallng(_in)
      Loop until  left(lcase(_in),1)="q"
     
     ' MainMenu
   End Sub
   dim as long w,h
   w=650
   h=500
 screenres w,h,8,,FB.GFX_NO_FRAME
 width w\8,h\16
 dim as integer xpos,ypos,x,y
 screencontrol 100,50,50
 
 
 thread = ThreadCreate( @showtime, 0 )
startposmode


 Sub PoSScreen
   ScreenLock
   Cls
      Print " " & Chr(201) & String(76,Chr(205)) & Chr(187)
      Print " " & Chr(186) & "algPoS                                                             SimplePoS" & Chr(186)
      Print " " & Chr(186) & "EPoS Made Simple                                             Version " & AppVersion & Chr(186)
      Print " " & Chr(204) & String(76,Chr(205)) & Chr(185)
      Print " " & Chr(186) & Chr(201) & String(30,Chr(205)) & Chr(187) & " " & Chr(201) & String(41,Chr(205)) & Chr(187) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(30," ") & Chr(186) & " " & Chr(186) & String(41," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(30," ") & Chr(186) & " " & Chr(186) & String(41," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(200) & String(30,Chr(205)) & Chr(188) & " " & Chr(200) & String(41,Chr(205)) & Chr(188) & Chr(186)

      Print " " & Chr(186) & Chr(201) & String(74,Chr(205)) & Chr(187) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(204) & String(74,Chr(205)) & Chr(185) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(200) & String(74,Chr(205)) & Chr(188) & Chr(186)
      Print " " & Chr(204) & String(76,Chr(205)) & Chr(185)
      Print " " & Chr(186) & "                                                                            " & Chr(186)
      Print " " & Chr(200) & String(76,Chr(205)) & Chr(188);
      locate 12,12
      print "barcodenumber";barcodenumber
   
        Locate 6,5 : Print "Total"
        Locate 7,5 : Print "  Due"

        Locate 6,38 : Print "Cashier"
        Locate 6,65 : Print "Trans"
        Locate 6,74 : Print "PoS"
        
        Locate 7,38 : Print "0000 ********************"
        Locate 7,65 : Print "00001"
        Locate 7,74 : Print "001"

   
      If TotalDue = 0 Then
         Locate 26,5 : Print "Next Customer Please"
      Else
         Locate 26,5 : Print "Next Item Please"
      End If
      
         

       ' Locate 29,4 ': Print Format(Now,"dd/mm/yyyy")
     '   Locate 29,16 : Print Format(Now,"hh:mm:ss")

   ScreenUnLock
   sleep 1,1
End Sub

sub showtime(byval param As Any Ptr) 
    
   
   
    Dim As Double t = Timer
    While( 1 )
    'locate 29,4
    line (20,450)-(20+300,450+16),0,bf  'clear print area
   ' print  Format(Now,"dd/mm/yyyy"); "   ";Format(Now,"hh:mm:ss")
    draw string (20,450), Format(Now,"dd/mm/yyyy"),15
    draw string (200,450), Format(Now,"hh:mm:ss"),15

  
    If terminate=1 Then Exit Sub
    sleep 10
Wend
end sub
terminate=1

ThreadWait (thread)
Print "Thread terminated" 
Gablea
Posts: 1104
Joined: Apr 06, 2010 0:05
Location: Northampton, United Kingdom
Contact:

Re: Opportunity to make some Cash

Post by Gablea »

@dodicat
I think I rejected it because it would not work on dos.

But as I’m starting to fall in love with Linux just as much as I do dos I’m thinking about the option of threading (I’m assuming with s little bit of work it could be used to handle the serial barcode reader as well

I’m not near my PC at the moment but as soon as I am I will trial the code to see if I can understand how you guys have laid the code out.
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Opportunity to make some Cash

Post by MrSwiss »

@Gablea,

I've just *recoded* the Example (from Manual: page CondCreate), for the FBC versions: >= 1.04.0,
aka: those that *have* Boolean Data-Type. It shows, how to sync. threads, using a Mutex.
For your Application IMHO a *must have*, to be able to control all the various external devices.
(If you want to use Threads, you'll have to drop DOS, since it can't handle *multi threaded*!)

code:

Code: Select all

' recoded Example from FB-Manual/CondCreate, simplified by use of Boolean: FBC >= ver. 1.04.0
' 
' compile: -s gui (dialect=lang "FB")
'
Type Thread_T                                       'Generic user thread
    Dim As Any Ptr handle                           'Any Ptr handle to user thread
    Dim As Any Ptr sync                             'Any Ptr handle to mutex
    Dim As Any Ptr cond1                            'Any Ptr handle to conditional1
    Dim As Any Ptr cond2                            'Any Ptr handle to conditional2
    Dim As Boolean ready1                           'Boolean ready1 (TRUE or FALSE)
    Dim As Boolean ready2                           'Boolean ready2 (as above)
    Dim As Boolean quit                             'Boolean used to stop user thread
    Declare Static Sub Thread (ByVal As Any Ptr)    'Generic user thread procedure
    Dim procedure As Sub (ByVal As Any Ptr)         'Procedure Ptr (to be executed by above)
    Dim p As Any Ptr                                'Any Ptr to pass DataUDT address to proc.
End Type

Static Sub Thread_T.Thread (ByVal param As Any Ptr) 'Generic user thread procedure
    Dim As Thread_T Ptr tp = param                  'Casting to generic user Thread_T
    Static As ULong I                               'remember counter value (static)

    Do
        MutexLock(tp->sync)                         'Mutex (Lock) for user thread
            'productive from here
            tp->procedure(tp->p)                    'execute thread procedure
            I += 1 : Locate 30, 38 : Print I;       'increment counter | output status (counter)
            'end productive
            tp->ready1 = TRUE                       'Set ready1 (main thread to go active)
            CondSignal(tp->cond1)                   'CondSignal to send signal1 to main thread
            While tp->ready2 = FALSE                'Process loop against spurious wakeups
                CondWait(tp->cond2, tp->sync)       'CondWait to receive signal2 from main-thread
            Wend
            tp->ready2 = FALSE                      'reset ready2 (user thread to go inactive)
            If tp->quit Then                        'Test for ending user thread
                MutexUnlock(tp->sync)               'Mutex (Unlock) for user thread
                Exit Do                             'terminate thread procedure
            End If
        MutexUnlock(tp->sync)                       'Mutex (Unlock) for user thread
    
        Sleep 5
    Loop
End Sub

'-----------------------------------------------------------------------------------------------------
' constants & initializers
Const As Long   x0 = 640 \ 2, y0 = 480 \ 2, r0 = 175
Const As Single pi = 4 * Atn(1)

Randomize(Timer, 3)                         'init mersenne twister
For i As UInteger = 0 To 99                 'warm it up ...
    Rnd : Rnd : Rnd
Next

'-----------------------------------------------------------------------------------------------------
' user DATA type, to be used by Sub PointOnCircle (ByVal p As Any Ptr), below
Type Point2D
    Dim As Long x, y
End Type

'user procedure to be excuted by user Thread_T
Sub PointOnCircle (ByVal p As Any Ptr)      'p = pointer to DATA struct but, nothing else (see below)
    Dim As Point2D Ptr pp = p               'any ptr to struct. ptr conversion (IMPORTANT!) _
    Dim As Single teta = 2 * pi * Rnd       'otherwise: this Sub knows nothing of its internals

    pp->x = x0 + r0 * Cos(teta)
    Sleep 5                                 'To increase possibility of uncorrelated data occurrence
    pp->y = y0 + r0 * Sin(teta)
End Sub

'-----------------------------------------------------------------------------------------------------
' main
Screen 12
Locate 30,  2 : Print "<any_key> : exit";
Locate 30, 27 : Print "calculated:";
Locate 30, 54 : Print "plotted:";

Dim As Point2D Ptr   Pptr = New Point2D     'create type's, assigned to ptr's (menory alloc.)
Dim As Thread_T Ptr  Tptr = New Thread_T

'init Tptr (aka: Thread_T struct.)
Tptr->sync = MutexCreate                    'mutex: treads are mutually exclusive (handler)
Tptr->cond1 = CondCreate                    'thread signaling
Tptr->cond2 = CondCreate
Tptr->procedure = @PointOnCircle            'treads procedure ptr (procedure executed by thread)
Tptr->p = Pptr                              'pointer to p (DATA struct.) used by above proc.
Tptr->handle = ThreadCreate(@Thread_T.Thread, Tptr)

Do
    Static As ULong I

    MutexLock(Tptr->sync)                   'Mutex (Lock) for main thread
        While Tptr->ready1 = FALSE          'Process loop against spurious wakeups
            CondWait(Tptr->cond1, Tptr->sync) 'CondWait to receive signal1 from user-thread
        Wend
        Tptr->ready1 = FALSE                'reset ready1 (main thread to go inactive)
        'productive from here
        PSet (Pptr->x, Pptr->y)             'Plotting one point (generates a circle, in time)
        I += 1 : Locate 30, 62 : Print I;   'increment counter | output status (counter)
        'end productive
        Tptr->ready2 = TRUE                 'set ready2 (user thread to go active)
        CondSignal(Tptr->cond2)             'CondSignal to send signal2 to user thread
        If Inkey <> "" Then
            Tptr->quit = TRUE               'set quit (stop user thread signal)
            MutexUnlock(Tptr->sync)         'Mutex (Unlock) for main thread
            Exit Do                         'terminate main loop
        End If
    MutexUnlock(Tptr->sync)                 'Mutex (Unlock) for main thread

    Sleep 5
Loop
' cleanup: thread stuff, release memory etc.
ThreadWait(Tptr->handle)                    'terminate thread
MutexDestroy(Tptr->sync)                    'terminate mutex
CondDestroy(Tptr->cond1)                    'terminate signalling
CondDestroy(Tptr->cond2)
Delete Tptr                                 'free allocated memory (type pointer's used)
Delete Pptr
Color 10 : Locate 15, 24
Print "cleanup done, any key press, quit's ";
Sleep                                       'wait for user input, before exiting
' end main --- EOF ---
'-----------------------------------------------------------------------------------------------------
What you might not like is the *heavy* use of Pointers, however, its the only way, to avoid *shared variables*.
Which IMHO, should be avoided, whenever possible (old style coding, hard to track, if there are bug's).
Last edited by MrSwiss on Oct 13, 2017 13:26, edited 1 time in total.
fxm
Moderator
Posts: 12110
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Opportunity to make some Cash

Post by fxm »

In fact, this example comes from the "CondCreate" page (a simpler version is at "MutexCreate" page).
When I created these examples in early 2015, the "Boolean" type was not yet added to FreeBASIC.

I would like to emphasize that coding in multi-tasking can be very delicate, as soon as we want to synchronize certain access between the tasks which are by definition and initially entirely asynchronous (to avoid certain access collisions, while no thread blocking permanently).
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Opportunity to make some Cash

Post by MrSwiss »

@fxm,

happy now? (changed page reference in previous post)
Better check modified comments in the code, which are IMHO, easier to understand.
(also: more exhaustive, less ambiguous ("end" replaced with "terminate"), as well as
a little bit less *technical*)
dodicat
Posts: 7983
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Opportunity to make some Cash

Post by dodicat »

Gablea.
Those floppy's are defunct.
I tried to read them but no joy?
I have them (somewhere) on a hard drive on an old computer and cd I am sure.
I'll try and find them.
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: Opportunity to make some Cash

Post by BasicCoder2 »

@Gablea,
Can you tell me again why you need to continually read the time and date?
Why not just read it when required and when the screen display is updated?

With regards to using Linux I would say that would be a great choice compared with MSDOS. I had to make a choice to stick to Windows or change over to Linux as I did not have time to learn both systems.
.
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Opportunity to make some Cash

Post by MrSwiss »

@Gablea,

just as a exercise, I've coded the simplest *Time-Thread*, I could come up with.
However, it uses three dedicated, global variables (1. String / 2. & 3. Booleans).

SimpleTimeThread.bas:

Code: Select all

' SimpleTimeThread.bas -- 2017-10-13, by MrSwiss
'
' compile: -s console (dialect=lang "FB")
'
' ----- Time Thread setup -----
Dim Shared As String    sTime       ' Time-String
Dim Shared As Boolean   nTime, quit ' Flag's (signal to main & control thread proc.)

Sub thr_proc (ByVal p As Any Ptr)   ' p is not at all used, here ...
    Static As String cTime          ' internal comparator, for change detection

    While Not quit                  ' global, to stop this procedure
        If cTime <> Time Then       ' sleep until Time changes
            cTime = Time            ' update internal comparator
            sTime = cTime           ' update gobal variable
            nTime = TRUE            ' signal main (that sTime has changed) _
        End If                      ' main must reset it, after taking action
        Sleep 20, 1
    Wend
End Sub

Dim As Any Ptr thread_ptr = ThreadCreate(@thr_proc, 0)
' ----- End - Time Thread setup -----

' ===== MAIN =====
Width 80, 25 : Color 15             ' console size | foreground color (white)
' initial user information
Locate 10, 1 : Print "DEMO, shows a independent Time Thread"
Locate 12, 1 : Print "Time and dot-printing, work independently ..."
Locate 13, 1 : Print "every 3rd line of dot's, causes a Cls!"
Locate 20, 1 : Print "any user action, quit's program ..."
Color 12                            ' dot's color (bright red)
Dim As UByte row = 2, col = 1       ' start cursor position (for main only)

Do
    If nTime Then                   ' check thread signal (time updated)
        Color 10 : Locate 1, 73     ' fixed screen poition (top, rhs, bright-green)
        Print sTime; : nTime = FALSE  ' reset signal (mandatory)
        Color 12                    ' reset to: dot-color
    End If

    Locate row, col : Print ".";    ' show independent action (from thread)
    row = CsrLin : col = Pos        ' save current cursor pos.
    If row = 4 AndAlso col = 80 Then  ' reset whole screen (after 3 dot-lines)
        Cls : row = 2 : col = 1     ' reset variables, to start pos.
    End If

    If Len(InKey) Then              ' check for user action
        quit = TRUE : Sleep 5, 1    ' quit thread procedure | wait a bit
        ThreadWait(thread_ptr)      ' wait for thread termination
        Exit Do                     ' quit main loop (exit prog.)
    End If
    Sleep 100, 1                    ' tread-proc. runns faster than main-loop
Loop
' ===== MAIN =====  ' ----- EOF -----
Gablea
Posts: 1104
Joined: Apr 06, 2010 0:05
Location: Northampton, United Kingdom
Contact:

Re: Opportunity to make some Cash

Post by Gablea »

BasicCoder2 wrote:@Gablea,
Can you tell me again why you need to continually read the time and date?
Why not just read it when required and when the screen display is updated?

With regards to using Linux I would say that would be a great choice compared with MSDOS. I had to make a choice to stick to Windows or change over to Linux as I did not have time to learn both systems.
.
I need the time and date to be correct as the main processing system (windows app) uses that to process the reports if the time and date on the tills are wrong then the report will be wrong and so would all the calculations that is processed by the system.

@MrSwiss
I will have a look at your code this weekend once I’m back in front of my PC (am at the moment typing this ony iPhone)

Am I being to picky with the date and time? The windows system can display the time and date perfectly and still handle 100’s of items being scanned as well as in the background database syncing (i want to drop windows from all of my front end machines by March 2018) hence why I’m looking into Linux (could always use ReactOS but that is not very stable at all at the moment)

Though all of your input and examples have really made this more understandable for me. (That’s is why I’m thinking about moving the serial barcode reader input into a thread on its own)
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Opportunity to make some Cash

Post by MrSwiss »

Gablea wrote:I need the time and date to be correct as ...
Are you aware of the fact, that in this case (synchronized Time), the server (at least)
has to get, what is called "internet Time" (from a external NTP-server) and, all your
clients (Till's) must synchronize Time, with that server (SQL on it, too). This then assures,
that all Date/Time stamps are "in sync.".

This is external to the Application (machine-/OS-level) ... a ADMIN job, not a DEV job.
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: Opportunity to make some Cash

Post by BasicCoder2 »

Gablea wrote:I need the time and date to be correct as the main processing system (windows app) uses that to process the reports if the time and date on the tills are wrong then the report will be wrong and so would all the calculations that is processed by the system.
But I am not talking about the time and date being wrong just when you need to read it. I mean at what point do you actually record the date and time as opposed the many times you might display it? Don't you read and record the date and time when the transaction is complete?
MrSwiss
Posts: 3910
Joined: Jun 02, 2013 9:27
Location: Switzerland

Re: Opportunity to make some Cash

Post by MrSwiss »

@BasicCoder2,

don't you realize, that currently, your questions are "beside the point" ?
Gablea
Posts: 1104
Joined: Apr 06, 2010 0:05
Location: Northampton, United Kingdom
Contact:

Re: Opportunity to make some Cash

Post by Gablea »

It’s the time mainly that is not being displayed correctly on screen.

If the system is sitting on a function that does not update the sceen (example waiting for a user to select something from a menu) then the screen does not get updated until after the hey selected the functions.

Example

User menu would update the screen to show

1. No sale
2. Refund
3. Exchange
4. Report
5. Float Menu
6. End Of Day

Required function :|

Until the user select a number nothing is updated

All I would like really is just for the screen time and date to be refreshed independlty to any other function on the system (so instead of having it inside a keyboard process fucntion look it would be on its own running in the background)
dodicat
Posts: 7983
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Opportunity to make some Cash

Post by dodicat »

But this was my suggestion to begin with.

This is windows code.

Linux will need the shell instruction changed.

code 1
fbtime.bas

Code: Select all

'fbtime.bas
'compile with -s gui to fbtime.exe
#include "fbgfx.bi"
#include "vbcompat.bi"

dim as integer x=val(command(1))
dim as integer y=val(command(2))
screenres 200,32,8,,FB.GFX_NO_FRAME or FB.GFX_ALWAYS_ON_TOP
screencontrol 100,x+65-50,y+490-50 

width 200\8,32\16
color 0, 15

dim as string t1,t2
do
    t1=time
    screenlock
if t1<>t2 then 
    line(0,0)-(199,31),0,bf
    line(0,0)-(199,31),15,b
    draw string(10,15),Format(Now,"dd/mm/yyyy"),15
    draw string(100,15),format(Now,"hh:mm:ss"),15
end if
screenunlock
sleep 900
    t2=t1
loop
beep
end

 
code 2
dud.bas

Code: Select all


'compile this to dud.exe
screenres 10,10
sleep 200 
code 3
The running file

Code: Select all

 
#include "vbcompat.bi"
#include "fbgfx.bi"
using fb
declare Sub PoSScreen
dim shared as integer AppVersion=2017
dim shared as integer totaldue=13
dim shared as integer BarcodeNumber
dim shared as integer x,y
 
Sub StartPoSMode
   
 shell "start fbtime.exe " &(x) & " " &(y)  'run fbtime.exe

 chain "dud.exe"   'to help get immediate focus on fbtime.exe
 
   dim as string _in
      Do 
         PoSScreen                'Displays the screen
       
         Locate 26,54 : Input "Barcode : ", _in
         barcodenumber=valulng(_in)
      Loop until  left(lcase(_in),1)="q"
      shell "taskkill /F /IM fbtime.exe"       'close fbtime.exe
      end
     ' MainMenu
   End Sub
   
   dim as long w,h
   w=650  'widtt
   h=500  'height
   x=50   'screenposition x
   y=50   'screenposition y
 screenres w,h,8,,FB.GFX_NO_FRAME or FB.GFX_HIGH_PRIORITY 
 
 width w\8,h\16
 screencontrol SET_WINDOW_POS,x,y
 sleep 200
 screencontrol GET_WINDOW_POS ,x,y  'get window position

startposmode


 Sub PoSScreen
   ScreenLock
   Cls
      Print " " & Chr(201) & String(76,Chr(205)) & Chr(187)
      Print " " & Chr(186) & "algPoS                                                             SimplePoS" & Chr(186)
      Print " " & Chr(186) & "EPoS Made Simple                                             Version " & AppVersion & Chr(186)
      Print " " & Chr(204) & String(76,Chr(205)) & Chr(185)
      Print " " & Chr(186) & Chr(201) & String(30,Chr(205)) & Chr(187) & " " & Chr(201) & String(41,Chr(205)) & Chr(187) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(30," ") & Chr(186) & " " & Chr(186) & String(41," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(30," ") & Chr(186) & " " & Chr(186) & String(41," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(200) & String(30,Chr(205)) & Chr(188) & " " & Chr(200) & String(41,Chr(205)) & Chr(188) & Chr(186)

      Print " " & Chr(186) & Chr(201) & String(74,Chr(205)) & Chr(187) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(204) & String(74,Chr(205)) & Chr(185) & Chr(186)
      Print " " & Chr(186) & Chr(186) & String(74," ") & Chr(186) & Chr(186)
      Print " " & Chr(186) & Chr(200) & String(74,Chr(205)) & Chr(188) & Chr(186)
      Print " " & Chr(204) & String(76,Chr(205)) & Chr(185)
      Print " " & Chr(186) & "                                                                            " & Chr(186)
      Print " " & Chr(200) & String(76,Chr(205)) & Chr(188);
      locate 12,12
      print "barcodenumber";barcodenumber
   
        Locate 6,5 : Print "Total"
        Locate 7,5 : Print "  Due"

        Locate 6,38 : Print "Cashier"
        Locate 6,65 : Print "Trans"
        Locate 6,74 : Print "PoS"
        
        Locate 7,38 : Print "0000 ********************"
        Locate 7,65 : Print "00001"
        Locate 7,74 : Print "001"

   
      If TotalDue = 0 Then
         Locate 26,5 : Print "Next Customer Please"
      Else
         Locate 26,5 : Print "Next Item Please"
      End If
      
         

       ' Locate 29,4 : Print Format(Now,"dd/mm/yyyy")
     '   Locate 29,16 : Print Format(Now,"hh:mm:ss")

   ScreenUnLock
   sleep 1,1
End Sub 
fbtime.exe is the executible showing the time and date.
dud .exe is only there to get focus straight away on the screen.
compile fbtime.bas and dud.bas first.
(Put all three files together somewhere)
You might have to wait with a blank screen for a minute on the first run of executables with the running file (depending on your antivirus)
After that, you system will accept the executables in future.
(My win 10 performs in this manner)

Try all this in windows first to see the result.
Linux will need to alter the shell commands.

press Q to quit.
Post Reply