Opensourcepos: Dinner Table feature in Sale module

Created on 3 Oct 2016  路  105Comments  路  Source: opensourcepos/opensourcepos

New Feature or Enhacement

I am building a feature to select tables in the sales module. When a sale is started, the employee can select a table where the order has come from. No new sale can be added to a table which is already being served (the sale is suspended). Also, there will be two special tables- delivery and take away. Feature is almost built.

bug enhancement

All 105 comments

I would also like to know is there a way to automatically generate the required translations for a new word (in this case 'Table') and add it to the translations files?

Thanks for the contribution proposal, when you say table I assume you mean restaurant table (physical one). We are so used to talk of tables as data representation that it's easy to mess up.

It would be nice to have that view and controller as addition to OSPOS for horeca type of business.

Sorry about the confusion. Yes, I do mean the restaurant table (I have named it dinner_table). I faced the same issue when naming the database table for it.

The database.sql gives errors when installing but using ospos database.sql then 3.0 to 3.1 it worked ok. I see it takes the place of the standard stock location in the register. This appears to be an issue. Like you said needs to be a config item.

2016-11-04 15_39_37-program manager

Hi @odiea
I have fixed the errors. I did not understand the part about dinner table taking place of stock location in the register. Could you ellaborate it?

The first image is from standard OSPOS. Includes stock locations.
2016-11-05 15_35_33-wedidit _ powered by ospos 3 0 1
The second image is from your version. Stock location is gone but your Table location is shown in it's place.
2016-11-05 15_34_57-open source point of sale _ powered by ospos 3 0 1

The option of stock location is shown only when there are more than 1 stock locations. (This is the case in the current master itself)

Sorry I stand corrected. Stock locations appear just fine.

The other minor issue would be after I unsuspend a table the Table number is set to the first table in the drop down list and not the original table .

Have fixed this.

Is this rebased with the latest code?

After merging it into the Master I tested this some more.
There is no way to disable it that I have found.
After you delete all the tables there is no longer a place holder to Install new tables.
Other feature on Register works nicely.
This may be petty but is there a way to put another drop down for the employee id so they can be credited for their Sales.

Either @deepshah or @jlctmaster need to take this and bring to a conclusion as it's not completed as it stands.

Hello, I'm working on a new branch, when I have something ready to upload it I'll do the PR

Hey guys, sorry for replying so late. I have been busy with some other stuff and not been able to work on this. @jlctmaster feel free to take off from where I left it.

@odiea @jlctmaster this looks completed, correct?

So far it appears to be working ok. I don't see changes in Reports to see why the table number was added to the Sales table. I do see changes at the Register and Store config.

Hi, for that I am thinking of making a module in the menu where you can take the orders and automatically save them as a suspended sale and that is registered which was the innkeeper that attended the client at table X, and that is the innkeeper who confirms the Sale, so that it can be invoiced in cash, this is where you can see in the sales module as a suspended sale for your billing.

For the record, the sales tax changes required a new module too - and I'm using the paper currency icon for it. I recall that the pencil symbol is available.

For this module I can design an image that represents the symbol of the restaurant as the one in the attachment.

dinner-icon

Looks great.

Nah.. we need to be consistent with the design. There is already a big set of icons stored in a dir, please choose one that gives the idea.

Just had a look at the SQL script to upgrade for this feature. I wonder why we keep duplicating sales tables, maybe adding suspended as a simple boolean column will suffice to check if table is suspended or not.

@jlctmaster I tested the latest master and if I didn't enable the tables and then I go to unsuspended I get an error:

A PHP Error was encountered

Severity: Notice

Message: Trying to get property of non-object

Filename: models/Dinner_table.php

Line Number: 63

please check.

Checking the suspended table the dinner_table_id is NULL.
Not sure that as relevance here, I just want to add more info that could be useful.

Hello, that's right, the dinner_table attribute in the sales_suspensed table must be NULL since if NOT NULL is applied, the list of tables must be shown in the billing and this prevents it from being configurable.

I'm dropping the set of suspended tables as part of the sales tax feature, so should I assume that the same rule would apply for the dinner_table_id in the sales table? .... for suspended sales?

One thing I did change related to the dinner table feature is that I changed the list of suspended sales to not include the dinner table column if the dinner table feature was not enabled.

@jlctmaster ok but there is the error that I reported above please test and fix:

A PHP Error was encountered

Severity: Notice

Message: Trying to get property of non-object

Filename: models/Dinner_table.php

Line Number: 63

@SteveIreland yes if suspended is changed even dinner tables should follow. @jlctmaster please follow up on that.

@jlctmaster fixing this, I also spotted that in Suspended Table column is added even if disabled in Store Config. So fixing that too.

@SteveIreland if you drop the suspended tables could you please include the change to Dinner Table? It's better to make one change for all in one place as that simplifies the matter.

Already done sir. Thanks.

can we use this module to hotels/hostal rooms?

@damianzoanni and what would be the specific requirement for the case?
Dinner Table is a means to identify a table in a place, if you mean that you want to identify the room instead of a table it's probably just a matter of "translation". But I'm guessing a bit here.

@daN4cat it well be nice if this module can be cloned for Hotels.. or for reception to repair celular phone... or other .. maybe with some abstraction of the name of module we can make many instances of the module and make it configurable

@jlctmaster food for thoughts....

Good idea, it would be nice to be able to expand that functionality to apply it to other similar scenarios.

@jlctmaster so you need to make it generic and not a Dinner Table type of functionality.
It's something that has to do with location.

Of course, there are things that are exclusive to a process, but others such as what mentions @damianzoanni to use the module for a hotel or a repair shop of cell phones, this could be integrated with the current module with the minimum of modifications.

@jlctmaster I leave to you the fun. I don't need this. I just fixed the issues I spotted to keep things working smoothly and generic when the module is not enabled.

I assume that you may want to title things to be "Dinner Table", "Hotel Room", "XYZ" with the drop down options you want.
In that way you make it quite generic.

Of course database table needs to be renamed...

let's make it real

@jlctmaster I just want to understand if you plan to or are working on making this feature more generic as I want to understand what's left to close 3.1.0.

Hello @daN4cat , I'm still not working on this, there are certain things that should be better defined to give you the support you want, you can close the support in this version 3.1.0

Greetings.

Hello there,

I have replaced the application/models/Dinner_table.php and application/views/sales/suspended.php with the newer codes that were dated on March 13 and I am still having the table issues. Could anyone here help?

Thanks for your help in advance.
-Desmond

Download the latest version and do the database updates or create a new database.

I think I am using the latest version - 3.1.0 - 4f5ad57. Please let me know IF this is not the latest version. I will give it a try to drop and re-create the new database.

Thanks for your prompt response.

You should download todays current 3.1.0. This is still a Beta with additions being added or changed weekly.

ok. I have downloaded the latest version (the time stamp on the codes are May 24th) and reload everything from scratch, dropped and re-created the database and I am still having the suspended table issues. Please help !!!

Thanks,
-d

What is the issue. Is it the Table number still shows in the dropdown list after a table has been suspended or other issue. Would someone please look into the table suspend feature not working properly.

The issue is ... the table name doesn't stick to the original one every time I UN-suspeneded it. It got reset it back to the first table in the drop down. Below is the sample.

Table name

Delivery
Take way
Table 1
Table 2
Table 3

I suspended a sale for table 2 and the sale will get reset it back to "Delivery" every time I UN-suspended it.

Thanks for looking into this.

-Desmond

Hello there,

Any luck on the fix?

Thanks,
Desmond

@jlctmaster can you please look into this issue?

The following link will get you the original dinner table feature minus anything that has been added since this commit. It appears to be working https://github.com/jekkos/opensourcepos/tree/6826115b2d029f6282e4fc2d7469b7576b0b436d

got it. so this build (the timestamp on this build is Feb 26. So I guess the changes in this build was not merged into the latest build?

Thanks for the link. I will give this build later tonight.

I will keep you guys posted.

The latest does contain this feature but was broken after other new code was added.

Got it. Good to know. Also, Is it possible to have a "floor plan" with all the tables in system? if not, will this feature be added or is it already on the roadmap somewhere? if no, can this feature be requested?

Thanks,
Desmond

If you want to use the Customer Rewards feature the following link is also working. Currently I believe most requests are on hold unless some User is willing to add that feature.
https://github.com/jekkos/opensourcepos/tree/cdc401dd7e1ad0827f96f511a65671d19c819c2a

View issue #1196. Another requested feature.

The table part really needs a dedicated owner otherwise I see it hard to progress. Neither I nor @jekkos have any driving reason to work on this as not a retail use case.

ok. Thanks for the heads up on the feature request.
Also, do you have any ETA when the latest build will have the fix for the suspended table issues.
I don't want to go back to the older build if the fix is coming soon ?

Thanks for your understanding.

P.S. I really like to stay with OSPOS because OSPOS is the best out of all the POS systems that I have tried so far.

-Desmond

I hope @jlctmaster can help here and fix the issue. I don't have that much time to dedicate to this project at the moment.

dan4ca,

Thanks.

jlcaster,

Please help !!!
:)

Thanks for all of your help as always.
I am really appreciated all of your help.
-Desmond

Hi, sorry for the absence, I have been short of time by a project that I am currently working on, I understand that the error they report is when the suspended sale is restored, it is not tied to the original table with which the order was made, if not with the default being "Delivered."

This is so it?

That and the suspended table still shows in the dropdown list of available tables.

Jlcmaster,

Yes. That's correct.

Please help.

Thanks for your help in advance.

Cheers
-d

It appears that the issue is the way suspended sales are now being kept in the database. When I suspend sales in a working version of Dinner Tables and then go to the newer version it functions properly until the suspended sales are all unsuspended.

@odiea do you have time to understand when this suspended feature was touched?

That's what I have been trying to find out. I believe it was introduced with @SteveIreland new Tax feature. I did a work around in Controller/Sales.php that if Dinner tables was used it would revert back to the old suspended tables. I will include it for your inspection.
~~~
public function suspend()
{
$dinner_table = $this->sale_lib->get_dinner_table();
$cart = $this->sale_lib->get_cart();
$payments = $this->sale_lib->get_payments();
$employee_id = $this->Employee->get_logged_in_employee_info()->person_id;
$customer_id = $this->sale_lib->get_customer();
$customer_info = $this->Customer->get_info($customer_id);
$invoice_number = $this->_is_custom_invoice_number($customer_info) ? $this->sale_lib->get_invoice_number() : NULL;
$quote_number = $this->sale_lib->get_quote_number();
$comment = $this->sale_lib->get_comment();
if($this->config->item('dinner_table_enable') == FALSE)
{
$sale_status = '1';

    $data = array();
    $sales_taxes = array();
    if($this->Sale->save($sale_status, $cart, $customer_id, $employee_id, $comment, $invoice_number, $quote_number, $payments, $dinner_table, $sales_taxes) == '-1')
    {
        $data['error'] = $this->lang->line('sales_unsuccessfully_suspended_sale');
    }
    else
    {
        $data['success'] = $this->lang->line('sales_successfully_suspended_sale');
    }
    }
    else
    {
        //SAVE sale to database
    $data = array();
    if ($this->Sale_suspended->save($cart, $customer_id, $employee_id, $comment, $invoice_number, $quote_number, $payments, $dinner_table) == '-1')
    {
        $data['error'] = $this->lang->line('sales_unsuccessfully_suspended_sale');
    }
    else
    {
        $data['success'] = $this->lang->line('sales_successfully_suspended_sale');
    }
    }

    $this->sale_lib->clear_all();
    $this->_reload($data);
}

~~~

It is part of the 3.0.2_to_3.1.0.sql database.
ALTER TABLE ospos_sales
ADD COLUMN quote_number varchar(32) DEFAULT NULL,
ADD COLUMN sale_status tinyint(2) NOT NULL DEFAULT 0;
The Sale Status is where it appears suspended sales are now being tracked.

Just to add my 2 cents (about what it's worth). The design intent was to ultimately drop the old suspended tables so that we no longer have to deal with both. I'd hate to have been responsible for creating a situation where suspended sales are kept in both sets of tables.

The only reason I didn't drop them immediately was because of the existing data in the suspended sales tables. At that time I wasn't sure what the migration rules were and I thought it would be acceptable to have a built in migration as old suspended data was "unsuspended". Of course now that I've had to set up migration for sales tax history the obvious solution would have been to create a migration for suspended sales tables and remove them.

The issue is can you get the dinner table feature to work with your newer suspended feature because it does not work properly now.

I'll start getting up to speed on the Dinner table issue. I'm sure it won't be wasted time since it's always been a fantasy of mine to open up a pop up Tex-Mex restaurant. :smile:

Steve,

Thanks for working hard on this.

I am really appreciated it.

-d

There is a problem with the config, when the submit is clicked there is no pop up notification confirming all is fine. @SteveIreland, when fixing this could you please check into that issue as well?

Also the behaviour of the input boxes is not correct when the checkbox is unticked and submit is clicked. They should stay grey/disabled.

@daN4cat I cannot duplicate the config issues. Both appear to be working correctly .

Strange I can see:

A PHP Error was encountered

Severity: Notice

Message: Undefined variable: Delivery

Filename: models/Dinner_table.php

Line Number: 14

I wouldn't that it's a PHP version related issue. Which version do you use? I have 5.6

7 something.

I found the root cause. Quick testing and I should be ready to submit. It's probably due to the PHP version.

I will try it in 5.6 and see what it does.

PHP Version 5.6.15 I tried it on this version with a new db and I have no issues.

The Dinner Tables feature is still not working in Sales with a new db but the config looks ok on my end.

Fixed the Config tables notification pop up issue.

I'll rebase again on the latest master and give my changes some more testing. It does include the fix for the unsuspending dinner table issue.

Testing and debugging is going pretty well. However, I want to focus on VAT tax testing tomorrow night.

And I just wanted to add that I tested the config changes and they are working fine on 7.0.10 of PHP and 5.7.14 of MySQL for me. Thanks.

Config for tables it's fine since I fixed it.

Thanks everyone.

Is there a way to get the fix for the suspended tables issues?
Thanks

-d

@kandesmond it's ongoing, @SteveIreland is testing his fix.

Got it. Thanks.

Hello everyone, I have been able to review the recent changes and I have applied the correction to the error presented with the feature of the dinner table, please check the PR.

I assume that means I'll need to rebase again and resolve conflicts. But that's cool. I'm becoming an expert at rebasing.

You were working on solving this bug? I'm sorry.

I merged the fix, @kandesmond please test and confirm it's fixed. Same for @odiea and @SteveIreland if you find the time.

Thanks @jlctmaster for the help

No problem sorry for the delay

I will definitely try it out later tonight.

Thanks everyone.

Appears back to being functional again. Drop down does not show suspended tables and when unsuspended the table name or number is retained. Good Work.

it's fixed and it's working great now.

Thanks for fixing it.

Cheers
-d

I found one minor issue and I don't think it's a big major issue but I figure out that I should point it out.

below is my settings.

Table name

Delivery 1
Take away 1
Delivery 2
Take away 2
Table 1
Table 2
....
Table 10

I suspended a sale for "Delivery 1" and it got suspended and un-suspended without any issues but "Delivery 1" is still available in the drop down for the new sales.

It's only happening to "Delivery 1" though. The rest of table features are still working great.

Thanks,
Desmond

@jlctmaster can you please check the new issue and fix?

Sorry, one more. i just tested it ... it's also happening to Take away 1.

I have tested it all the way to Table 6 and it's fine.

so it seems it's only happening to the first Two tables in the drop down.

Hello, this is not an error but the basic functionality of this feature, since according to the logic with which this functionality was tested is the following, the records that come preloaded "delivery" and "take away" should not be reserved in the sale, if it is true that at the moment of suspending the sale this keeps the selected record, however, these should always be available.

With the rest of the records are supposed to be tables where the customer goes to the restaurant is lodged at a table, makes his request and at the time of retirement asks the account.

This is how it is programmed this characteristic, it is also interesting to know when it would have more than one concept that indicates that it is "delivery" or "take away"

jlcmaster,

Got it. Thanks for your answers.

-d

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andriux1990 picture andriux1990  路  4Comments

odiea picture odiea  路  3Comments

danersan picture danersan  路  4Comments

daN4cat picture daN4cat  路  5Comments

esbyrt picture esbyrt  路  5Comments