#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    2
    Rep Power
    0

    Open cash register


    Please forgive me if this shows up twice. I tried posting a few mins ago but was unsuccessful.

    I have written a pos application for a Pizza Restaurant I own and now I'm finally ready to talk the cash drawer into opening.

    The cash drawer is plugged into the receipt printer which is plugged into Com2 of the POS terminal.

    I've looked at a few sites and found code that should work but it doesn't for me (could be entirely my fault of course).

    The following code is supposed to work but I get a 'file doesn't exist' msg. Perhaps something was left unsaid on the site where I found it.

    var
    MyFile: TextFile;
    begin
    AssignFile(MyFile,'com2');
    Rewrite(MyFile);
    WriteLn(MyFile, CHR(27)+CHR(112)+CHR(0)+
    CHR(10)+CHR(100));
    System.CloseFile(MyFile);

    Any help would be much appreciated.

    Thanks,

    Don
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    2
    Rep Power
    0

    Solution


    Here is the solution for anyone who also has this problem.

    procedure TaaFrmPaymentMethod.OpenCashDrawer;
    var
    CDFile: TextFile;
    begin
    AssignFile(CDFile,'com2');
    Rewrite(MyFile);
    Write(CDFile,CHR(27)+CHR(112)+CHR(0)+CHR(10)
    +CHR(100));
    System.CloseFile(CDFile);
    end;

    My cash drawer was attached to com2. Replace this with whatever port your cash drawer plugs into.

    Be sure and use "Write" and not "Writeln". You will not have much success with Writeln.

    Don

IMN logo majestic logo threadwatch logo seochat tools logo