Skip to content

Instantly share code, notes, and snippets.

View chadsten's full-sized avatar

Chadsten chadsten

  • Colorado
View GitHub Profile
Erp.Tables.PartPlant PartPlant;
foreach (var ttPart_Row in (from ttPart_Iter in ttPart select ttPart_Iter)) {
this.PublishInfoMessage("Part foreach", Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "Part", "Duplicate");
foreach (var PartPlant_Row in (from ttPartPlant_Iter in Db.PartPlant where ttPart_Row.Company == ttPartPlant_Iter.Company && ttPart_Row.PartNum == ttPartPlant_Iter.PartNum select ttPartPlant_Iter))
{
this.PublishInfoMessage("PartPlant foreach", Ice.Common.BusinessObjectMessageType.Information, Ice.Bpm.InfoMessageDisplayMode.Individual, "Part", "Duplicate");
if (PartPlant_Row != null)
{
SELECT DISTINCT
dbo.r_CalculatedMinMax.PartNum, Epicor10.dbo.Part.PartDescription, Epicor10.Erp.Vendor.VendorID, dbo.r_CalculatedMinMax.Plant,
dbo.r_CalculatedMinMax.SourceType, dbo.r_CalculatedMinMax.PUM, dbo.r_CalculatedMinMax.IUM, CASE WHEN (dbo.r_CalculatedMinMax.ConvFactor > 1)
THEN dbo.r_CalculatedMinMax.ConvFactor ELSE '1' END AS ConvFactor, dbo.r_CalculatedMinMax.SugMin, dbo.r_CalculatedMinMax.SugMax,
dbo.r_CalculatedMinMax.MinimumQty AS CurrentMin, dbo.r_CalculatedMinMax.MaximumQty AS CurrentMax, Epicor10.Erp.PartClass.Description AS ClassDescription,
CASE WHEN (VendPart.BaseUnitPrice > 0) AND (dbo.r_CalculatedMinMax.SugMin IS NOT NULL) AND (Epicor10.dbo.Part.IUM <> Epicor10.dbo.Part.PUM)
THEN (((dbo.r_CalculatedMinMax.SugMin - (PartWhse.OnHandQty - PartWhse.DemandQty + dbo.r_CalculatedMinMax.OrderQty)) / dbo.r_CalculatedMinMax.ConvFactor)
*
SELECT TOP (100) PERCENT MAX(LastRecDate) AS LastRecDate, PartNum, Plant, MAX(LastPONum) AS LastPONum
FROM (SELECT MAX(TranDate) AS LastRecDate, PartNum, Plant, CAST(MAX(PONum) AS varchar(30)) AS LastPONum
FROM Epicor10.Erp.PartTran
WHERE (TranType IN ('PUR-STK', 'ADJ-QTY')) AND (TranDate <> '2016-09-30')
GROUP BY PartNum, Plant
UNION
SELECT LAST_REC_DATE, PROD_NUM, CASE WHEN WHSE_NUM IN ('10', '17', '19') THEN 'DIST' WHEN WHSE_NUM IN ('18', '90')
THEN 'PROJ' WHEN WHSE_NUM = '15' THEN 'FREE' ELSE WHSE_NUM END AS Plant, PO_LAST_RECPT AS PONum
FROM dbo.WHSE_STAT
WHERE (LAST_REC_DATE IS NOT NULL) AND (NOT (WHSE_NUM IN ('11', '20', '30')))) AS LRD
<?php
function commerce_group_wishlists_menu() {
$items['customer/wishlists'] = array(
'page callback' => 'commerce_group_wishlists_list',
'access arguments' => array('access content'),
'type' => MENU_NORMAL_ITEM,
);
$items['customer/wishlist/%'] = array(
'page callback' => 'commerce_group_wishlists_wishlist_view',
<?php
// required to hide add to cart
function commerce_price_visibility_form_alter(&$form, &$form_state, $form_id) {
if (strpos($form_id,"cart_add_to_cart")) {
// standard group/user vis check
$show_price = determine_visibility();
<?php
function commerce_group_sku_form_alter(&$form, &$form_state, $form_id) {
if(strstr($form_id, 'commerce_cart_add_to_cart_form_')) {
$group = get_user_groups();
$custom_label = get_custom_label($group);
$gpn = get_custom_sku($form_state['default_product']->product_id, $group);
if (!empty($gpn)) {
SELECT TOP (100) PERCENT PartNum, CONVERT(DECIMAL(16, 4), CEILING(SUM(OurShipQty) * 2)) AS YearTotal, CONVERT(DECIMAL(16, 4), CEILING(SUM(OurShipQty) / 6))
AS MonthAvg, COUNT(PartNum) AS Hits
FROM dbo.v_InvoiceRegisterForTurns
WHERE (InvoiceDate > DATEADD(month, - 6, GETDATE())) AND (Plant = 'DIST') AND (InvoiceTerms NOT IN ('16', '26', '14', 'PORD', '50%D', '50%S')) AND (BuyToOrder = 'false' OR
BuyToOrder IS NULL)
GROUP BY PartNum
<?php
function adjust_for_variance($price_array, $variance_threshold) {
$variance = calculate_variance($price_array);
if ($variance > $variance_threshold) {
sort($price_array);
array_pop($price_array);
$price_array = adjust_for_variance($price_array, $variance_threshold);
} else {
return $price_array;
}
CASE
WHEN (PartPlant.LeadTime <= '7')
THEN CONVERT(DECIMAL(16, 4), CEILING((MonthAvg * 1) * 1.1))
WHEN (PartPlant.LeadTime > '7' AND PartPlant.LeadTime <= '14')
THEN CONVERT(DECIMAL(16, 4), CEILING((MonthAvg * 1.2) * 1.1))
WHEN (PartPlant.LeadTime > '14' AND PartPlant.LeadTime <= '30')
THEN CONVERT(DECIMAL(16, 4), CEILING((MonthAvg * 1.5)) * 1.1)
WHEN (PartPlant.LeadTime > '30')
THEN CONVERT(DECIMAL(16, 4),CEILING((MonthAvg * 2) * 1.1))
END AS SugMax
Erp.Tables.OrderDtl OrderDtl;
Erp.Tables.OrderHed OrderHed;
Erp.Tables.Customer Customer;
Erp.Tables.OrderRel OrderRel;
Erp.Tables.PartPlant PartPlant;
Erp.Tables.Vendor Vendor;
Erp.Tables.JobMtl JobMtl;
Erp.Tables.JobOper JobOper;
foreach (var ttSug_Iter in (from ttSug_Row in ttSugPoDtl select ttSug_Row)) {