Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
User Override of Auto-Calc Freight Cost
11-24-2017, 01:57 AM
Post: #1
User Override of Auto-Calc Freight Cost
I have implemented automatic Freight calculation for Sales Orders but in some cases we must be able to override the value. I notice if I overwrite the auto-calc result it always reverts back to the auto-calc value.

I may have to alter the code, which is fine, but I want to check with the rest of you before I proceed. Perhaps I have missed a setting or missed a procedure? Is this the expected functionality?

Any help or thoughts are greatly appreciated.

By the way... This feature is very slick!

https://www.linkedin.com/in/eclipsepaulbecker
Visit this user's website Find all posts by this user
Quote this message in a reply
11-24-2017, 04:45 AM
Post: #2
RE: User Override of Auto-Calc Freight Cost
I am pretty sure that needs changing in the code.

That feature was written by Ricard if I remember correctly. I haven't seen him around for a while.

Tim
Visit this user's website Find all posts by this user
Quote this message in a reply
11-24-2017, 08:37 AM
Post: #3
RE: User Override of Auto-Calc Freight Cost
I'm happy to help with testing and trunk commits if a fix for this is coded.

Andy.

https://www.linkedin.com/in/andrewcouling
Find all posts by this user
Quote this message in a reply
11-24-2017, 11:46 PM
Post: #4
RE: User Override of Auto-Calc Freight Cost
Thank you both for your input and timely response.

I was able to fulfill this small change by adding just one logic condition. What I have now is:

+ If the user enters "0" for the Freight Charge the "Recalc Shipping Cost" button will perform as expected and apply a value
+ If the user enters "0" for the Freight Charge the "Commit Order Lines" button will perform as expected and apply a value
+ if the user enters a value other than "0" the "Recalc Shipping Cost" and "Commit Order Lines" buttons apply no value

Now we have the out-of-the-box functionality (which is awesome) as well as the ability to override for special cases. If for some reason the user decides his Freight Cost is no longer valid he or she can simply set it back to "0" and the system will perform as usual. We need this ability if a customer:

+ Reduces a large order to a small order (auto-calc freight charge)
+ Increases a small order to a large order (special freight charge)

I will share the small change in just a bit when I SCP back over to the server...

https://www.linkedin.com/in/eclipsepaulbecker
Visit this user's website Find all posts by this user
Quote this message in a reply
11-25-2017, 02:59 AM (This post was last modified: 11-25-2017 03:08 AM by VortecCPI.)
Post: #5
RE: User Override of Auto-Calc Freight Cost
Here is all I did to enable this feature: In DeliveryDetails.php change line 122

From:
if($_SESSION['DoFreightCalc']==True) {

To:
if($_SESSION['DoFreightCalc']==True AND $_POST['FreightCost']==0) {

Not too sure if you guys prefer "AND" or "&&" so I will leave that up to you. It appears "AND" is preferred from my quick interrogation of the code.

So far I have only had to change nine files to meet our needs and most of the changes are very small. The most work occurred at PO_Items.php where I do a lookup to populate the description with the Branch address when entering a Non-Stock item to our PO for freight charge.

https://www.linkedin.com/in/eclipsepaulbecker
Visit this user's website Find all posts by this user
Quote this message in a reply
11-27-2017, 08:42 AM
Post: #6
RE: User Override of Auto-Calc Freight Cost
The only reason I got it to update was if the order had changed then the freight would not be recalculated... in this case if a super large heavy/bulky item was added to the order after the order had initially been entered then there would be scope for undercharging.
When the order is invoiced there is scope for over-riding the freight charged at this point.
Glad you like this functionality ... it was used extensively when first developed but is a bit miserable to maintain the data and the slicker way really is to use the freight company's APIs which are more available now than was the case when this was written.

Phil Daintree
webERP Admin
Logic Works Ltd
http://www.logicworks.co.nz
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)