Bug 6504

Summary: no way to enter shipping price in acq
Product: Koha Reporter: Nicole C. Engard <nengard>
Component: AcquisitionsAssignee: Srdjan Jankovic <srdjan>
Status: CLOSED FIXED QA Contact: Bugs List <koha-bugs>
Severity: normal    
Priority: PATCH-Sent (DO NOT USE) CC: chris, julian.maurice, katrin.fischer, koha.sekjal, mathsabypro, melia, mglavica, srdjan
Version: master   
Hardware: All   
OS: All   
Change sponsored?: Sponsored Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 5339    
Bug Blocks: 929    
Attachments: patch
Shipping on pending orders changes when you receive first item
Receipt Summary after receiving 3 items (with changed shipping cost on the second and third items)

Description Nicole C. Engard 2011-06-14 15:59:50 UTC
I thought I had a bug for this, but can't find it anymore. Koha in 3.0 used to allow you to enter you shipping costs when receiving an order, but there is no way to do this now.  It would be nice if this was back.
Comment 1 Srdjan Jankovic 2011-09-07 03:30:02 UTC
git log:

    Remove input for shipping cost as per bug 1965.
    Signed-off-by: Joshua Ferraro <jmf@liblime.com>

Please advise
Comment 2 Ian Walls 2011-09-07 15:56:42 UTC
This must be restored; the fix in bug 1965 was a hack, rather than an actual solution.  The current Koha database structure has a field for "freight" (aqorders.freight) that is going unused.  This does put the freight entry at the individual order line level, instead of the whole order, but that's fine; a freight charge for multiple items can just be attached to one of them, or the cost can be divided evenly, whichever the library prefers at data-entry time.
Comment 3 Srdjan Jankovic 2011-09-09 04:11:53 UTC Comment hidden (obsolete)
Comment 4 Katrin Fischer 2011-11-04 20:58:36 UTC
Hi Srdjan, 

thx again for your work on a much needed acquisition feature!

>* When creating an order I was not able to change quantity, ie it was always 1.
>If that is by design and each order can have only one item then it is fine.
>Otherwise it is undertested.

It should always be possible to order more than 1 item, hitting the plus sign on the item form (AcqCreateItem = on order) or editing the quantity in the order form (AcqCreateItem = in cataloguing, on receive)

Thats what I have done testing:

1) Order creation
Created a new order (AcqCreateItem = on order) using a new fund, so it's easier to track the spending. I have ordered 2 items for 10.00 each, and 1 item for 3.00. I have put in no discount or taxes.
Fund before order: available 100.00
Fund after order: committed 23.00, available 77.00

2) Receiving order
On receive there is a new field 'Shipping' now, where you can enter the total shipping cost for that delivery.

NOTE: Perhaps make that "Shipping cost"?

I entered 10.00.

NOTE: The shipping cost does not show on the receipt summary page.
Freight shows up as new field below 'Actual cost'. 

NOTE: The freight cost divides up between order lines, not between items. I would have expected it to be 3.33 for each item, but what happened was 5.00 for my record with 2 items and 5.00 for my record with 1 item.

I received 1 of my 2 items and the actual price for them was correctly moved from 'ordered' to 'spent' in the acq table, but the freight cost didn't show up in the budgets table.

NOTE: The freight price didn't show up in my budgets. I think it should be detracted from the budget the items were ordered for?

The item I received got the freight cost 5.00. When I received the second item the freight cost was recalculated to 2.50.

I changed the freight cost to 3.00. You can't see the freight cost on the receive pages, so I went back to the basket summary page.
The freight cost does not show on the basket summary page, but when editing single lines. The changed freight cost and the other costs showed up correctly.

I changed the freight price again on this page, the change was saved correctly.

I am failing this QA for now, as we have no way to see the freight costs on the summary pages and it's also not taken into account for the budgets. I am not sure the calculation by order line is correct. 

Perhaps someone else has some ideas about this?

* Restored "Shipping" input for "Receive a new shipment"; this may not be what
you had in mind
* Having done that, it made sense to split it over all pending items. I can see
potential issues with that, but it can be adjusted, see below
* Added "Freight" input on the "Receive Order" screen. Inconsistency warning:
Shipping vs Freight
* Values should be showing correctly on the "Receipt Summary" screen
* There was no way of changing freight value, so I've added it to the "Modify
Order" screen

I tried a fairly simple scenario when receiving shipment with all pending
orders, and it worked as expected. I do not know what scenarios are
possible/likely, so please play with it.
Comment 5 Srdjan Jankovic 2011-11-07 05:18:15 UTC Comment hidden (obsolete)
Comment 6 Nicole C. Engard 2011-11-07 13:30:41 UTC
(In reply to comment #5)
> * "The freight price didn't show up in my budgets. I think it should be
> detracted from the budget the items were ordered for?"
>   That was not asked for. I need more instructions if we decide to go with
> that.

That would probably be by fault for not being clearer.  If we're tracking the shipping then it makes sense that it show as a negative against our budgets. The whole point of tracking the shipping was that we needed an accurate budget keeping device. So, shipping costs (which I do prefer over freight) should be subtracted from budgets.

What additional information is necessary to make this happen?

Comment 7 Srdjan Jankovic 2011-11-08 01:54:01 UTC
I need to know which screen(s) and what field on the screen should be affected.
Comment 8 Nicole C. Engard 2011-11-08 13:42:08 UTC
aqbudgets.budget_expend should be updated with the shipping costs subtracted.

That means that the budgets should all be updated so these pages should all show what has been spent against the budget - including the shipping costs:


Then each basket should show the shipping costs in the table:


And the total for that basket should include the tax and the shipping costs since those were both expenses on this basket.

Shipping should also show on the receiving page: 


probably in the table at the bottom listing already received items.

Can anyone else think of any other pages/examples that I have missed?
Comment 9 Srdjan Jankovic 2011-11-09 03:38:03 UTC
Nicole, what you are describing goes way beyond this bug as described. I will raise it with Bywater Solutions and see what can be done.
Comment 10 Nicole C. Engard 2011-11-09 15:40:36 UTC

Please do, but you should know that I am the one at ByWater who reported the issue to our developers :) It came up while training our partners on how to use acquisitions.  You can't keep accurate accounting if you can't enter the and track the shipping costs against your budget.

Comment 11 Srdjan Jankovic 2011-11-25 02:29:07 UTC Comment hidden (obsolete)
Comment 12 Melia Meggs 2011-12-07 01:53:40 UTC
I have tried to test again following what Katrin did in Comment 4.

Here is what I have done testing:

1) Order creation

I created a new order using a new fund. I ordered 2 items for 10.00 each, and 1 item for 3.00.  I put in no discount or taxes.
Fund before order: available 100.00
Fund after order: ordered 23.00, available 77.00

This seems all correct.

2) Receiving order

I clicked on Receive Shipment and entered a "Shipping Cost" of 10.00.

The receipt summary still shows Shipping Cost as 0.00 for all of my items.  (I expected it to divide up the shipping cost that I had entered between the items and then show 3.33 for each item on the receipt summary, but maybe I misunderstood what is meant to happen...)

If from the receipt summary I click on receive (to the right of the item), there is a field for me to enter "Freight" below "Actual Cost."  Is "Freight" different from "Shipping Cost"?  Can we make these both say "Shipping Cost"?

I changed the "Freight" from 0.00 to 5.00, and this was then correctly reflected on the receipt summary.

Then I went back to Budgets & Funds.  My new budget still shows a total of 100.00.  (I'm not sure if that's correct or not.)  If I click on the budge name, I can see that the correct amount has been deducted from the fund.

So my questions are:
1. When you click on Receive Shipment and enter a shipping cost, should this be divided up between the items in the shipment and reflected in the "Shipping" column on the basket details page?
2. Can we change "Freight" to "Shipping Cost" for consistency throughout?
3. I don't really understand much about budgets vs. funds.  Should the total on the budget change after I have received items?  If so, this isn't quite right yet.  OR should the total on the budget stay the same and only the total sublevels spent and the base level remaining on the fund change?  If this is right, then it's ok as is.
Comment 13 Srdjan Jankovic 2011-12-07 22:26:31 UTC
Created attachment 6648 [details] [review]

a) Fixed incorrect Shipping cost allocation on the receipt summary
b) "Shipping cost" was called freight in some places, and the database field is named freight as well. Replaced "Freight" with "Shipping cost"
c) Budgets and funds periods screen shows total allocated. We can change that if you wish, but that has nothing to do with shipping
Comment 14 Melia Meggs 2011-12-08 23:39:37 UTC
Ok, I did the same testing as last time.

1) Order creation - pass

2) Receiving order

I clicked on Receive Shipment and entered a "Shipping Cost" of 10.00.  There were 3 items, and the shipping cost was correctly divided up to make it $3.33 for each item.

From the receipt summary I clicked on receive (to the right of the item), and "Freight" is now changed to "Shipping Cost."  The $3.33 is already filled in for me here, so this all looks good so far.

When I click save, the shipping costs and totals for the Already Received item at the bottom are correct, but I found that the shipping costs for the two pending orders had now changed from $3.33 each to $1.67 each.  So originally all pending orders had shipping of $3.33, but after receiving one item, the two pending orders that were left had the shipping changed to $1.67 each.  Screenshot attached.  

This did not happen when I received the second and third items - this time the shipping remained the same.  I have attached another screenshot showing the final result after receiving all three items.

Then I went back to Budgets & Funds and found that the correct amount has been deducted from the fund, so this part looks good, too.  However, the budget remains at $100.  So I have to ask this question again in hopes that someone in the community can answer it:

If you have a budget of $100 that has a fund of $100, and you spend some money out of the fund, should the same amount also be deducted from the budget?  That would make sense to me.
Comment 15 Melia Meggs 2011-12-08 23:40:29 UTC
Created attachment 6685 [details]
Shipping on pending orders changes when you receive first item
Comment 16 Melia Meggs 2011-12-08 23:41:57 UTC
Created attachment 6686 [details]
Receipt Summary after receiving 3 items (with changed shipping cost on the second and third items)
Comment 17 Julian Maurice 2012-01-19 11:32:28 UTC
I haven't read all the discussion, so I don't know if it will help you but I want to mention that bug 5339 implement a way to have 'by parcel' shipping price instead of having it in order lines.
Comment 18 Paul Poulain 2012-02-17 14:39:04 UTC
The script devel/misc/testbugzillapatches.pl has detected that this bug does not apply anymore, so i'm marking this bug as "does not apply".

The script is supposed to handle conflicts related to updatedatabase, but no other cases of merge conflict. So the conflict may be trivial to fix.

If it happens that the patch attached does apply cleanly, please send me an email, there's something wrong in the script. It's possible, as it's a recent script.
If the patch applies does not apply as I think, please rebase and resubmit, thanks
Comment 19 Srdjan Jankovic 2012-03-07 04:57:36 UTC
Definitely needs to wait for http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5339, which gives a more complete solution
Comment 20 Chris Cormack 2013-01-01 23:04:21 UTC
Bug 5339 has been resolved, so this can be revisited.
Comment 21 Katrin Fischer 2013-01-03 07:12:03 UTC
You can now enter a shipping price for a parcel/shipment/invoice and a fund for the price to be deducted from. I think this solution was different, as it divided the shipping price between the ordered items/order lines.
Comment 22 Nicole C. Engard 2014-01-24 14:50:54 UTC
Fixed with another patch ages ago