Is possible do this with SambaPOS?

Hello guys,
I am new with SambaPOS. I have checked some posts but some of my doubts have not been resolved.

Questions
#1. This is my business diagram process:

I need to give to my customer a ticket, with special information in itself:

  • This ticket can be: TYPE1, TYPE2. Each one with a specified counter.
  • Format in this ticket is: [Serial number] - [Document number], example: 0001-0000002
  • When document number is 9999999+1, Serial number increments in one unid, and document number is 1.
  • Minium value to serial number or document number: 1

My steps for solve this question

  1. I made 4 number generators:
  • Serial type1, with format: 0000
  • Serial type2, with format: 0000
  • Document type1, with format: 0000000
  • Document type2, with format: 0000000
  1. I made two type tickets:
  • TYPE1
  • TYPE2
    Ok, here I can select only a number generator. I selected document type 1 to TYPE1, and document type 2 to TYPE2.
  1. I made a type entity: TYPE TICKET
  2. I add entity data: TYPE1, TYPE2
  3. I add entity screen: Type document. Here I can select only one type ticket. So I don’t know how I can continue.

Thanks.

Not as ticket I’d but using a set of program settings similar to the setup people have done for daily resetting ticket number but don’t reset the.
4 settings for the 2 ids and the 2 serials
Make automation to add as ticket tag using the both then increase with a clause/additional action to increase Id when serial is reset.

1 Like

Thanks man. I can not follow your instructions because I newbie with SambaPOS :frowning:
Finally I only made two tickets with this format: 0001-#######
I know it is not the correct manner.

If you can help me with a images tutorial, or video, wao, this will be nice for me. So may, I can help to spanish people from Peru here. In my country it is a requirement of the government.

You cannot use Number Generators for this because you want them to be reset at a certain threshold, which will cause duplicate Ticket Numbers, which is not allowed.

You also cannot use multiple Ticket Types within a single Ticket/Sale. You can only select 1 Ticket Type per Ticket/Sale at a time. You cannot combine them. FYI, the same also applies to Departments; youcan only select 1 Department at a time per Ticket/Sale.

For both of these reasons, using Ticket Types and Number Generators is not going to work for you.

You are best off leaving the Number Generators alone, and using your own generation pattern for creating your “Invoice” numbers. This is done by using Global Program Settings to store, increment, and reset your numbers.

There are many discussion about this on the forum; in general people have referred to them as a “Resetting Order Number” which is done at End of Workperiod. Using the Term “Order Number” is incorrect - it should be “Ticket Number” or “Invoice Number” or “Queue Number” since we are talking about a Ticket, not an Order (Orders are items on a Ticket).

There is a link to a “Tutorial” on the V2 Forum within this Topic that always gets referred …

http://forum2.sambapos.org/index.php?topic=97.msg671#msg671

Although that method works, it can cause some confusion due to syntax used in V2 vs. V3/4/5 so… I think it is probably about time someone re-wrote instructions for that setup. Give me some time to do so…

Suffice it to say, this is the Action you will be using:

image

1 Like

Here is a Tutorial that is very specific for your needs …

1 Like

Thanks man, for taking the time to resolve my concern.
At this point I am reviewing the tutorial created. If I have additional questions I will post them.

Friend @QMcKay,
Your tutorial was nice to understand rules and action mechanisms, and other concepts.
I could configure Program settings, action and rules. However, I can not define ticket type (all invoices are type A).

So I has been created a new entity type.

With some entities: Type1, Type2

I checked some topics to get custom data about our entities. I made a additional custom constraint.

  • How can I define a custom constraint to know selected value?.

Thanks.

“Type1” and “Type2” are not Custom Data. They are the Entity Names.

Try:

{ENTITY NAME:Invoices type} Equals Type1
1 Like

@QMcKay,
Ok, all works fine. I am very happy. :smile:
2. In my ticket template, I can show information about ticket:

[<J00>{ENTITY NAME:Invoice type} | {TICKET STATE:InvA} {TICKET STATE:InvB}]

Is possible make conditional clausules in printer template?
Example:

IF ({ENTITY NAME:Invoice type} == 'Type2')
Show customer name, address.
ELSE
Show customer name only.
ENDIF

Thanks.

Yes, using ternary operation inside [=expression]

[LAYOUT]
<J00>[='{ENTITY NAME:Invoice type}' == 'Type2' ? '{ENTITY NAME:Customer}' +' | '+ '{ENTITY DATA:Customer:Address}' : '{ENTITY NAME:Customer}']

Exact syntax for retrieving Entity information is different in [Layout] section (like above), as opposed to [ENTITIES:X] sections (below) …

[ENTITIES:Customer]
<J00>[='{ENTITY NAME:Invoice type}' == 'Type2' ? '{ENTITY NAME}' +' | '+ '{ENTITY DATA:Address}' : '{ENTITY NAME}']
1 Like

@QMcKay,
Nice, now I can make a beautiful template.
I was studying this: Printer Template Formatting Tags
There is manner to make a type line like title with a specified character?
Example:

My type ticket can has different names, example: “Type2”, “Large name”, etc.
I would like that text always is center, and blank space is completed with characters(- or =)

There is no Tag that will do that, but you could build something with JScript methods like .join() and .slice() to prefix and suffix a centered value to a certain length (character count of your printer).

1 Like

Thanks.

Source: http://locutus.io/php/strings/str_pad/
Function: str_pad
Parameteres

  • input: your text or entity name, data.
  • padLength: This should be same that your line character count printer. I don´t know if is possible get automatically this information. In my case 48(Epson TMT20II).
  • padString: Pad character, or pad characters.
  • padType: STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH

Example:

str_pad(‘EXAMPLE’, 48, ‘=’, ‘STR_PAD_LEFT’)
image
str_pad(‘EXAMPLE’, 48, ‘=’, ‘STR_PAD_BOTH’)
image
str_pad(‘EXAMPLE’, 48, ‘=’, ‘STR_PAD_RIGHT’)
image

How to use in report with Invoice type

<J00>{CALL:string.str_pad('{ENTITY NAME:Invoice type}', 48, "-", 'STR_PAD_BOTH')}
3 Likes

So very nice to see someone on the forum with some compatancy for a change not needing to have every little thing explained and shown :slight_smile:
That looks like a hand script.
Could you posibly paste the script for others to use :slight_smile:

1 Like