1 (edited by tom 07/31/2011 12:16:21 pm)

Topic: Delivery Notes

When a delivery note is created other deliveries are used to see what has already been delivered.

But it seems to use the same shipping charge from the original sales order.

So if you had a SO for $500 of product and $50 of shipping ($550 total) and make 2 deliveries you can end up with $600 of invoices
if you are not careful.

Often I will just apply the shipping to the first delivery and have additional deliveries list $0 shipping.

Some countries customs agents do not like this.

Is it possible for the Delivery Note creation form to subtract the shipping from earlier deliveries before it auto fills in the shipping cost?
(not negative, of course)

tom
ps. I tried making an example of this in the demo site, but I could not create a SO with a non-zero shipping charge.
(well I could create it, but the shipping cost was not saved for some reason)

Re: Delivery Notes

Here is a poorly written implementation of my suggestion...

diff -r 6fa1ff512c1b sales/customer_delivery.php
--- a/sales/customer_delivery.php    Sun Jul 31 00:37:32 2011 +0200
+++ b/sales/customer_delivery.php    Wed Aug 10 21:37:12 2011 -0400
@@ -95,6 +95,14 @@
        die ("<br><b>" . _("This order has no items. There is nothing to delivery.") . "</b>");
    }

+// Adjust Shipping Charge based upon previous deliveries TAM
+    $sql = "SELECT sum(ov_freight) as freight FROM ".TB_PREF."debtor_trans WHERE order_ = " . $_GET['OrderNumber'] . " AND type = " . ST_CUSTDELIVERY . " AND debtor_no = " . $ord->customer_id;
+    $result = db_query($sql, "Can not find delivery notes");
+    $row = db_fetch_row($result);
+    if (!$row[0]) $freight = 0;
+    else $freight = $row[0];
+    if ($freight < $ord->freight_cost) $ord->freight_cost = $ord->freight_cost - $freight;
+    else $ord->freight_cost = 0;
    $_SESSION['Items'] = $ord;
    copy_from_cart();