Solved

show amount in pos screen

Posted on 2011-03-24
13
491 Views
Last Modified: 2013-11-23
Hi all,

I'm developing a pos application. The application is displayed in a touch screen. I want to show some information, like amount and item name in other screen (small screen that will be displayed to customers). How do I do this?

Regards
Reynaldi
0
Comment
Question by:reynaldio
  • 5
  • 5
  • 2
  • +1
13 Comments
 
LVL 24

Expert Comment

by:jimyX
ID: 35206081
> "I want to show some information, like amount and item name in other screen (small screen that will be displayed to customers)"

Please could you explain more.
0
 
LVL 25

Expert Comment

by:epasquier
ID: 35206664
95% of my work is about POS software & plugins. I have quite a few solutions in my box for all kinds of POS needs. Enough to tell you that there is no standard solution for anything in this field.

Are you talking about a LCD display attached to a serial port (generally through a POS thermic printer) ?
If that is so, it is quite possible that your solution is in the ESC/POS (EPSON) protocol, in short a few bytes to send to the COM port to directly tell the LCD display what to show

Please give us as many information you have about the hardware you want to use
0
 
LVL 36

Expert Comment

by:Geert Gruwez
ID: 35206967
something like this ?
pas
 
unit uPosInfo;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TfrmPosInfo = class(TForm)
    procedure FormDestroy(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  end;

var
  frmPosInfo: TfrmPosInfo;

procedure ShowPosInfo(Info: TStrings; AttachToRightOfForm: TForm = nil);

implementation

{$R *.dfm}

var
  mPosInfo: TfrmPosInfo;

function PosInfo(AttachToRightOfForm: TForm = nil): TfrmPosInfo;
begin
  if not Assigned(mPosInfo) then
  begin
    mPosInfo := TfrmPosInfo.Create(AttachToRightOfForm);
    if Assigned(AttachToRightOfForm) then
    begin
      mPosInfo.Left := AttachToRightOfForm.Left + AttachToRightOfForm.Width;
      mPosInfo.Top := AttachToRightOfForm.Top;
    end;
    mPosInfo.Show;
  end;
  Result := mPosInfo;
end;

procedure ShowPosInfo(Info: TStrings; AttachToRightOfForm: TForm = nil);
var W, X, Y, deltaY: Integer;
  procedure CreateEntry(aOwner: TComponent; aName, aValue: String);
  var
    L: TLabel;
    E: TEdit;
  begin
    E := TEdit.Create(aOwner);
    E.Parent := TWinControl(aOwner);
    E.Width := W;
    E.Top := Y;
    E.Left := X;
    E.Text := aValue;
    E.ReadOnly := True;
    L := TLabel.Create(aOwner);
    L.Parent := TWinControl(aOwner);
    L.AutoSize := True;
    L.Caption := aName;
    L.Update;
    L.Left := X - 5 - L.Width;
    L.Top := Y;
    L.FocusControl := E;
    Y := Y + deltaY;
  end;
var I: Integer;
  c: TComponent;
  f: TfrmPosInfo;
begin
  F := PosInfo(AttachToRightOfForm);
  for I := F.ComponentCount-1 downto 0 do
  begin
    c := F.Components[I];
    c.Free;
  end;
  W := F.Width div 3 * 2 - 20;
  X := F.Width div 3;
  Y := 5;
  deltaY := 25;
  for I := 0 to Info.Count - 1 do
    CreateEntry(F, Info.Names[I], Info.ValueFromIndex[I]);
  F.Update;
end;

procedure TfrmPosInfo.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  Action := caFree;
end;

procedure TfrmPosInfo.FormDestroy(Sender: TObject);
begin
  mPosInfo := nil;
end;

initialization

finalization
  if Assigned(mPosInfo) then
    FreeAndNil(mPosInfo);
end.

Open in new window


dfm
 
object frmPosInfo: TfrmPosInfo
  Left = 446
  Top = 248
  BorderIcons = [biSystemMenu]
  BorderStyle = bsToolWindow
  Caption = 'Point of Sale'
  ClientHeight = 155
  ClientWidth = 378
  Color = clBtnFace
  Constraints.MaxHeight = 350
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  FormStyle = fsStayOnTop
  OldCreateOrder = False
  Position = poDefaultSizeOnly
  OnClose = FormClose
  OnDestroy = FormDestroy
  PixelsPerInch = 96
  TextHeight = 13
end

Open in new window


and use like this:
 
uses uPosInfo;

procedure TfrmMain.btnShowPosInfoClick(Sender: TObject);
var List: TStrings;
begin
  List := TStringList.Create;
  try
    List.Values['Article'] = 'Satchel';
    List.Values['Vendor'] = 'IBM';
    List.Values['State'] = 'Good';
    List.Values['Amount'] = '65';
    List.Values['Price'] = 'Too expensive';
    ShowPosInfo(List, Self);
  finally
    List.Free;
  end;
end;

Open in new window

0
 
LVL 25

Expert Comment

by:epasquier
ID: 35209039
Geert, you are going deep into details providing a solution before the asker really explains what he wants.

For those who wants a summary of what Geert did : he assumed reynaldio wanted to display informations on a secondary form, that form being displayed at a specific position (top/right of main form). That, assuming that the secondary small screen is a standard screen (meaning a Windows surface), being positioned in windows multi-screen manager at the top/right of primary screen, and that the main form is maximized on the main one, would effectively position an information screen in the top/left corner of the secondary screen. It could lead also to a lot of unsatisfying results.

That is a lot of assumptions, and simply put if most of those assumptions are correct (mainly the fact that the secondary screen IS a windows surface), then it would be best to use the Screen object, especially Monitors property, to get the correct position of the corner of that secondary screen, whatever the windows multi-screen config might be

procedure TfrmPosInfo.FormCreate(Sender: TObject);
Var
 SecondaryFormMonitor:Integer;
begin
 With Screen do 
  begin
// evaluate on which monitor the secondary form should be displayed
// this could be done otherwise, or configurable somewhere
   if MonitorCount>1 
    Then SecondaryFormMonitor:=1
    Else SecondaryFormMonitor:=0;
// put the secondary form in top/left corner of that screen
   Left:=Monitors[SecondaryFormMonitor].Left;
   Top:=Monitors[SecondaryFormMonitor].Top;
  end;
end;

Open in new window

0
 
LVL 2

Author Comment

by:reynaldio
ID: 35238290
Thanks all for your comments.

Sorry, for not being clear earlier. I've attached a picture of the pos screen.

@epasquier: i'm not sure what pos computer my client will use. Is is possible to write universal plugin that will work in any pos computer? Sorry i'm a newbie here, and i don't have a clue about the hardware :(

@Geert_Gruwez: Thanks for the code. I'll test it as soon as possible.

Regards,
Reynaldi
sem600.jpg
0
 
LVL 25

Expert Comment

by:epasquier
ID: 35238624
yes, that is exactly what I suspected : in your picture you can see the LCD screen is just above an EPSON thermic printer. That is because they are linked, and the display in the small LCD is done by communicating to it via the Printer , through COM port.

There is no Universal method, but ESC/POS protocol is used by 80% of that kind of system. You can also use OPOS which is a "kind of " universal method. But it has some issues, it is a bit hard to configure. My advice is to implement both : direct ESC/POS protocol for all EPSON hardware & compatible, and OPOS

I have to go now, but I'll give you documentation later
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 36

Expert Comment

by:Geert Gruwez
ID: 35239068
>epasquier
>i'm only assuming that you have a lot of work atm :)
0
 
LVL 2

Author Comment

by:reynaldio
ID: 35281599
@epasquier Thanks a lot for your explanation. I'll try to google for some articles on ESC/POS protocol and is looking forward to some links and documentations from you :)
0
 
LVL 25

Expert Comment

by:epasquier
ID: 35292065
Here is the documentation of an EPSON thermal printer. It describes the ESC/POS protocol commands.
If your LCD  display is connected directly to a COM port of the computer, or via USB and a virtual COM port installed by your driver, then it will most probably comply to this. Simply sending ASCII characters will display those. It is up to you to experience with it for the layout of the display
If your display is connected through the printer, then you have to send a command to select the device where the text should be printed/displayed
ESC = 0 (3 characters, escape = #27 , '=' and '0') will select the printer
ESC = 1 will select the LCD Display
good luck !
Epson-CTM-T88IIIspec.pdf
0
 
LVL 2

Author Comment

by:reynaldio
ID: 35425350
@epasquier   Thanks a lot for the link. Sorry it took some time for me to response. I have read the pdf you sent me. But i'm really not familiar with these commands and have no idea how to implement this on my application. Is it possible for you to give some samples code in delphi? A simple one will do, just to give me the idea :) Thanks
0
 
LVL 25

Accepted Solution

by:
epasquier earned 500 total points
ID: 35426192
it depends on the component you are going to use for COM port communication. Tell me which Delphi version you use, I will recommend you one.
Here is a small COM tool I made to spy/send text or ASCII(hexa) to devices, that will help you test how your device works.

I'm sorry the user interface is minimal and in french (not too much of it, as I said it is minimal interface). The lower edit zone is what you can send.

to test that the communication works, first send some text with the good speed and other parameters (top section), it should print/display something if the device connected recognize EPSON protocol.

To send hexa (you will have to, to send ESC sequences) you check the checkbox on the side, and your text should be of the form : "1B 3D 31" without quotes, for "ESC=1"

If you can achieve that, then you can start experiences, and I could help you further how to code that in your applications
SpyCOM.zip
0
 
LVL 2

Author Comment

by:reynaldio
ID: 35490948
@epasquier Thanks a lot for the sample code. I will try that asap. Hope it will help me understand how the protocol works. I use delphi 2007 Win32.

Regards,
Reynaldi
0
 
LVL 2

Author Closing Comment

by:reynaldio
ID: 35738848
Thank you for your help. You saved my day :)
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now