cptechinc / stat-dpluso

Stat Tech Dplus Online
0 stars 0 forks source link

Customer Bookings Panel #8

Open Pauldro opened 6 years ago

Pauldro commented 6 years ago

Make the class CustomerBookings Call the file BookingsPanelCustomer.class.php in the first line after the curly braces paste use OrderPanelCustomerTraits; include it in site/templates/content/common/initialize.php Copy all the functions from BookingsPanel.class.php and paste into CustomerBookings Copy all the files and directories from site/templates/dashboard/bookings into site/templates/customer/cust-page/bookings/ then in bookings-panel.php you'll want to include a call to set_customer($customer->custid, $customer->shipid);

public function setup_pageurl() {
    $this->pageurl->path = DplusWire::wire('config')->pages->ajaxload."bookings/customer/$this->custID";
      if (!empty($this->shipID)) {
     $this->pageurl->path->add("shipto-$this->shipID");
}

}

Notice for the following functions you'll have to supply the custID and shipID in the urls generate_viewsalesordersbydayurl($date) generate_viewsalesorderdayurl($ordn, $date)

You'll also have to configure site/templates/content/ajax/load/bookings-router.php to fetch the custID and shipID from the URL for cases sales-orders

Pauldro commented 6 years ago

@bbullemer The functions get_bookings, get_daybookingordernumbers(), get_daybookingordernumbers(), count_daybookingordernumbers(), count_todaysbookings() need to call new database functions which you'll create based off the old ones except this one will have a different name.

For example in get_bookings() the function get_userbookings from _dbfunc.php will need a new function that will will be called get_customerbookings and after sessionID supply the panel's custID and shipID, The function in _dbfunc.php can be copied from get_userbookings except the table you're going to use when querying for a customer is bookingc, and remember to add the to search the customerID on the query, and also shipID if it's not empty.

Then you're going to copy the get_bookingsummarybycustomer() and its _dbfunc.php function. Then you're going to paste it to be get_bookingsummarybyshipto(), and same for the _dbfunc.php function. Again you'll copy the function _dbfunc.php point it to bookingc and then in the db function make sure it's looking for that customer and shipto if applicable.