This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# compile Q1 data | |
q1_data <- weight_hits(IR, 0, 3, 1) | |
weight_hits <- function(data, start, end, weight) { | |
result <- filter(IR, OrderDate < Sys.Date() - months(start), OrderDate >= Sys.Date() - months(end)) %>% | |
group_by(PartNum, Plant) %>% | |
summarise(hits = n() * weight) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Sum of all velcocity calculations | |
#' | |
#' @param hit_velocity (int) | |
#' @param cus_velocity (int) | |
#' @param qty_velocity (int) | |
#' @param imt_velocity (int) | |
#' @param lod_velocity (int) | |
#' | |
#' @return The sum of all passed parameters | |
#' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Superfat (Superman) | |
Brokeman (Batman) | |
Wondering Woman (Wonder Woman) | |
Greene Security (Green Latern) | |
Fat American (Captain America) | |
Captain Canada (Captain America) | |
Brown Man - UPS (Hulk) | |
Aquaphobe (Aquaman) | |
Tottally Better Than Batman (Robin) | |
Handiflash (The Flash) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT (SUM(ExtendedCost) / | |
(SELECT COUNT(*) AS TempCount FROM | |
(SELECT SnapDate | |
FROM EpicorReports.dbo.InventorySnapshots AS DayCount | |
WHERE Datepart(week,DayCount.SnapDate) = Datepart(week,InvSnap.SnapDate) AND Plant <> 'PROJ' | |
GROUP BY SnapDate) | |
AS NumOfDays)) | |
AS OnHandValue, | |
ItemMoveType_c, DATEPART(week, SnapDate) AS Week | |
FROM EpicorReports.dbo.InventorySnapshots AS InvSnap |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="about-container"> | |
<div> | |
<img src="//cdn.shopify.com/s/files/1/2933/2634/files/Kennys_Outside-01_2048x2048.png?v=1517860975" alt="" /> | |
</div> | |
<div class="about-block"> | |
<p class="about-text"> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- with vendpart | |
SELECT SH.PartNum, SH.MonthAvg, SH.Hits, SH.Customers, PP.LeadTime, SH.Plant, ISNULL(PW.OnHandQty, 0) + ISNULL(PO.OrderQty, 0) - ISNULL(PW.DemandQty, 0) | |
AS AvailableQty, SH.MonthAvg / 28 AS DailyDemand, VP.BaseUnitPrice | |
FROM Epicor10.Erp.PartPlant AS PP LEFT OUTER JOIN | |
Epicor10.Erp.VendPart AS VP ON PP.PartNum = VP.PartNum AND PP.VendorNum = VP.VendorNum LEFT OUTER JOIN | |
Epicor10.Erp.PartWhse AS PW ON PP.PrimWhse = PW.WarehouseCode AND PP.PartNum = PW.PartNum LEFT OUTER JOIN | |
dbo.pa_2_1_parts_on_po AS PO ON PP.PartNum = PO.PartNum AND PP.Plant = PO.Plant RIGHT OUTER JOIN | |
dbo.pa_2_0_year_sales_history AS SH ON PP.Plant = SH.Plant AND PP.PartNum = SH.PartNum | |
WHERE (PP.BuyToOrder <> 'true') AND (VP.ExpirationDate >= GETDATE()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT DISTINCT | |
Epicor10.Erp.Part.PartNum, | |
dbo.pa_2_0_year_sales_history.Hits, | |
Epicor10.Erp.Part.PUM, | |
dbo.pa_2_0_year_sales_history.Customers, | |
Epicor10.Erp.Part.IUM, | |
Epicor10.Erp.PartPlant.MinimumQty, | |
Epicor10.Erp.PartPlant.MaximumQty, | |
Epicor10.Erp.PartPlant.LeadTime, | |
Epicor10.Erp.PartPlant.VendorNum, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
year.PartNum, | |
SUM((ISNULL(q1.Hits, 0) + ISNULL(q2.Hits, 0) + ISNULL(q3.Hits, 0) + ISNULL(q4.Hits, 0))) AS HitsDEBUG, | |
SUM((ISNULL(q1.Hits, 0) + ISNULL(q2.Hits, 0) + ISNULL(q3.Hits, 0) + ISNULL(q4.Hits, 0)) / 4) AS Hits, | |
SUM((ISNULL(q1.QuarterTotal, 0) + ISNULL(q2.QuarterTotal, 0) + ISNULL(q3.QuarterTotal, 0) + ISNULL(q4.QuarterTotal, 0)) / 4) AS QuarterTotal, | |
SUM((ISNULL(q1.MonthAvg, 0) + ISNULL(q2.MonthAvg, 0) + ISNULL(q3.MonthAvg, 0) + ISNULL(q4.MonthAvg, 0)) / 4) AS MonthAvg, | |
SUM((ISNULL(q1.MonthStd, 0) + ISNULL(q2.MonthStd, 0) + ISNULL(q3.MonthStd, 0) + ISNULL(q4.MonthStd, 0)) / 4) AS MonthStd, | |
SUM((ISNULL(q1.PartAvg, 0) + ISNULL(q2.PartAvg, 0) + ISNULL(q3.PartAvg, 0) + ISNULL(q4.PartAvg, 0)) / 4) AS PartAvg, | |
SUM((ISNULL(q1.PartStd, 0) + ISNULL(q2.PartStd, 0) + ISNULL(q3.PartStd, 0) + ISNULL(q4.PartStd, 0)) / 4) AS PartStd, | |
MAX(year.MinShipQty) AS MinShipQty, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
PartNum, | |
CONVERT(DECIMAL(16, 4), (SUM(OurShipQty) * .5)) AS QuarterTotal, | |
CONVERT(DECIMAL(16, 4), (SUM(OurShipQty) / 3) * .5) AS MonthAvg, | |
CONVERT(DECIMAL(16, 4), (((STDEV(OurShipQty)) * .5) * (COUNT(PartNum) * .5))) AS MonthStd, | |
CONVERT(DECIMAL(16, 4), (AVG(OurShipQty)) * .5) AS PartAvg, | |
CONVERT(DECIMAL(16, 4), (STDEV(OurShipQty)) * .5) AS PartStd, | |
CONVERT(DECIMAL(16, 4), (COUNT(PartNum)) * .5) AS Hits, | |
COUNT(DISTINCT CustID) AS Customers, | |
Plant |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
PartNum, | |
CONVERT(DECIMAL(16, 4), (SUM(OurShipQty) * .5)) AS QuarterTotal, | |
CONVERT(DECIMAL(16, 4), (SUM(OurShipQty) / 3) * .5) AS MonthAvg, | |
CONVERT(DECIMAL(16, 4), (COUNT(PartNum)) * .5) AS Hits, | |
COUNT(DISTINCT CustID) AS Customers, | |
MAX(Plant) AS Plant | |
FROM | |
dbo.v_InvoiceRegisterForTurns | |
WHERE |