reynaldio
asked on
show amount in pos screen
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
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
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
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
something like this ?
pas
dfm
and use 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.
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
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;
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
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;
ASKER
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
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
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
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
>epasquier
>i'm only assuming that you have a lot of work atm :)
>i'm only assuming that you have a lot of work atm :)
ASKER
@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 :)
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
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
ASKER
@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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
@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
Regards,
Reynaldi
ASKER
Thank you for your help. You saved my day :)
Please could you explain more.