Commit Graph

27 Commits

Author SHA1 Message Date
PhilRunninger
f8f1433546 Make debugging statements in SQL files more informative.
I added the CTE's name as the new first column of the
`SELECT * FROM <cte>` statement.
2024-03-13 08:50:50 -04:00
PhilRunninger
f5a79f16b6 Fix divide by zero errors when no adjustment can be made. 2023-08-31 09:51:30 -04:00
PhilRunninger
f0ec96fe2a Change WHERE clause to remove tag[= or <>]'open-orders' condition.
Now that we think we know what we're doing, I'm using a more rigorous
approach to defining iterations and tags, and this condition is no
longer necessary, and in fact, may be harmful. This I'm removing it.

The initial load of data will have these values.

iter    | tag         | purpose
--------|-------------|-------------------------------------------------
plan    | baseline    | Adjustments will be made to these values only.
actuals | open-orders | Ordered before 2024 season, still open.
actuals | booked      | Ordered in 2024 season so far
2023-08-29 20:02:46 -04:00
PhilRunninger
0d83f19e33 Fix percent change calculation for price adjustment.
I shouldn't be coding on zero hours sleep!
2023-05-17 10:04:46 -04:00
PhilRunninger
47d1baffc5 Handle the case where baseline is zero (units or value).
This happens when a customer places identical orders and specifies that
they be shipped in different seasons. We end up with one order shipped
in 2023 and one open for 2024. Under our current operating procedures,
open orders are subtracted from shipped orders and are presented as
baseline for the next forecast. The zero that appears in the baseline in
this case was causing all kinds of issues in the SQL scripts for
inserting the adjustments, ranging from finding zero rows to adjust to
division by zero.

Another change required to correct this was updating the iter value of
the open orders from 'actuals' to 'copy':

    UPDATE rlarp.osm_pool
    SET iter = 'copy'
    WHERE tag = 'open-orders'
2023-05-17 05:28:21 -04:00
PhilRunninger
86225ea7e5 Get pounds to update for each forecast adjustment.
Lots of cleanup here too, removing large swaths of code that are no
longer needed. Many improvements the Excel workbook, which is kept in
Teams, not git. These changes may or may not have had accompanying VBA
changes.
2023-04-27 16:54:37 -04:00
66b74e31cb update all routes to round to 2 decimals for units, value, and cost 2021-04-19 09:20:52 -04:00
Trowbridge
df02a31000 the module is stored as key type in the json 2020-02-25 15:08:01 -05:00
Trowbridge
ff1304be3c add substance column and move some files out of the route folder that aren't actually being used by routes 2020-02-19 13:25:28 -05:00
Trowbridge
cbc2caa41d add module back in 2020-02-18 17:10:49 -05:00
Trowbridge
69346646bd change module to be the comment 2020-02-18 15:35:56 -05:00
Trowbridge
d3a4a45d53 change comment to be the tag 2020-02-18 14:47:46 -05:00
Trowbridge
7635380ccc ensure not to load null comments 2020-02-14 17:00:44 -05:00
Paul Trowbridge
db13f3d38c routes that make adjustments need to return comment info 2020-02-14 15:52:16 -05:00
Trowbridge
18558674c0 change key name to message 2020-02-14 14:41:51 -05:00
Trowbridge
0c394b2557 update CTE names, remove volume filter 2020-02-13 14:00:04 -05:00
Paul Trowbridge
b3122a50bb swap out return rows 2020-02-13 13:56:29 -05:00
Trowbridge
a4cf5b7607 insert new columns and log 2020-02-13 13:20:33 -05:00
Trowbridge
9793596d27 switch scale columns 2020-02-13 13:19:06 -05:00
Trowbridge
79ec4739c1 swap out basemix coluns 2020-02-13 13:18:55 -05:00
Paul Trowbridge
22841d3671 fix issue with price adjustment 2019-04-03 14:07:49 -05:00
Paul Trowbridge
d3332cc778 include promo code in base mix 2019-04-03 12:17:54 -04:00
fleetside72
833ec511c1 handle price change on no base sales 2019-04-03 03:00:38 -04:00
Trowbridge
b05d68f8ec dont sum up diext and discounts 2019-03-20 01:31:51 -04:00
Paul Trowbridge
932c95e83c dont use iterdet anymore since not in osm. iter = source + behavior 2019-03-14 10:47:29 -04:00
Paul Trowbridge
9d6453f837 update scale by price route 2019-03-13 17:27:59 -04:00
Paul Trowbridge
41d7f4286a add routes to scale volume and also to scale price 2019-03-13 09:35:45 -04:00