Second DV View

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
fazoo
Posts: 3
Joined: 2013-05-13 17:07

Second DV View

Post by fazoo » 2013-05-13 18:40

Hi to all,

I have a table in my database named appointments and a table with existing client information, client_info.
My problem (aside from lack of PHP knowledge) is this:

When entering a new appointment record, I would like to be able to make a choice of New Customer or Repeat Customer.
If I select New Customer, I can then manually enter last_name, first_name, time etc and create/save the appointment to the appointments table.
If I select Repeat Customer, I can then select from a lookup field - drop down or auto complete the last name first, name fields and then address, phone number, etc gets auto-filled - all from the client_info table.

I see it as two different ways to enter an appointment record into the same table
When I'm in appointments table view I have a button to Add New. Maybe a second Add New(2) button could could be created, one taking you to the manual data entry Detail View and the second taking you to the lookup/auto-fill version.

Any help is greatly appreciated!

Thanks in advance.

Richard

User avatar
a.gneady
Site Admin
Posts: 1281
Joined: 2012-09-27 14:46
Contact:

Re: Second DV View

Post by a.gneady » 2013-05-21 21:02

Umm ... You should add a lookup field for customers in the appointments table (and may be some auto-fill lookups to auto-populate the customer details) ... You should then open the parent/children settings for the customers table and enable appointments.

From now on, your application users should always work with the customers table ... they should either search for an existing customer, or create a new one. In the detail view of the customer, they can easily add appointments without having to go the appointments page.
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

fazoo
Posts: 3
Joined: 2013-05-13 17:07

Re: Second DV View

Post by fazoo » 2013-05-24 17:40

Hello and thank you for your help!

This does change the flow I was hoping for but it will do the trick.
I was thinking that new appointments wouldn't become customers until they made a purchase.

Thanks again,
Richard

wplim
Veteran Member
Posts: 36
Joined: 2013-01-17 22:42

Re: Second DV View

Post by wplim » 2013-05-25 06:12

Try this:
1. Add a Status field in Customer table, default value is New
2. Add a Total Sales field in Customer table to track sales amount generated through this customer.
3. Add a function in _global.php to update customer table when a sales item is added/updated. First update the total sales field then check if status is new and total sales > 0, then set Status field to Return.
4. Call the function created in step 3 to all related hooks files in the function tablename_after_insert and tablename_after_update.

So now, when a new appointment is created, you use the customer's Status as lookup field in Appointment table to filter the customer list.

Hope this help.
Weoi

Post Reply