select distinct fc.ownerId, fc.ownerType, m.mfr_name from tbl_CRM_FiscalCalendar fc inner join tbl_TER_BusinessPlans bp on bp.ownerId = fc.ownerId and bp.ownerType = fc.ownerType and bp.timeframeYear = fc.fiscalYear inner join tblManufacturers m on m.mfr_id = fc.ownerId where coalesce( fc.weeksElapsed, 0 ) > 0 and fc.ownerType = 'MFR' and fc.ownerId =

#htmleditformat( mfr_name )# - Fiscal #_fiscalYear#

select distinct skuId from tbl_MFR_TPF_Detail#_tpfSuffix# with (nolock) where mfr_id = and forecast_year = and forecast_month = and skuId > 0 select s.skuId, s.sku, p.prodId, s.bgtCatOverride, case when s.bgtCatOverride = 'Y' and s.bgtCatId is not null then s.bgtCatId else p.bgtCatId end bgtCatId, coalesce( s.equivUnitsPerCase, 1 ) equivUnitsPerCase from tbl_PRD_Skus s with (nolock) inner join tbl_PRD_Products p with (nolock) on p.prodId = s.prodId and p.ownerId = s.ownerId and p.fsl_tablecode = p.fsl_tablecode where s.skuId = and s.ownerId = and s.fsl_tablecode = 'MFR' update tbl_MFR_TPF_Detail#_tpfSuffix# set prodId = , bgtCategoryId = case when forecast_status = 'A' then else end where mfr_id = and skuId = and forecast_year = and forecast_month = ---> select territoryId, bgtCategoryId, sum( forecast_qty ) caseAmt, sum( forecast_amt ) dollarAmt, sum( forecast_alt ) altAmt from tbl_MFR_TPF_Detail#_tpfSuffix# with (nolock) where territoryId > 0 and bgtCategoryId > 0 and tpartnerType = 'CDR' and forecast_status = 'A' and mfr_id = and forecast_month = and forecast_year = group by territoryId, bgtCategoryId order by territoryId update tbl_MFR_TPF_Detail#_tpfSuffix# set forecast_qty = , forecast_amt = , forecast_alt = , lastUpdateSource = , lastUpdate = where mfr_id = and tpartnerType = 'TER' and tpartnerId = and bgtCategoryId = and productItemCode = and productLevel = 'UOM' and forecast_status = 'A' and forecast_year = and forecast_month = insert into tbl_MFR_TPF_Detail#_tpfSuffix# ( mfr_id, tpartnerType, tpartnerId, productLevel, forecast_status, forecast_year, forecast_month, forecast_qty, forecast_amt, forecast_alt, bgtCategoryId, lastUpdateSource, lastUpdate, productItemCode, territoryId ) values ( , 'TER', , 'UOM', 'A', , , , , , , , , , ) select distinct tpartnerId, bgtCategoryId from tbl_MFR_TPF_Detail#_tpfSuffix# with (nolock) where mfr_Id = and tpartnerType = 'TER' and productItemCode like 'BGT%' and forecast_year = and forecast_month = and forecast_status = 'A' select territoryId, bgtCategoryId from qmd_bgtCategoryActuals where territoryId = and bgtCategoryId =
Purged #_tpfMonth#/#_tpfYear# - TerritoryID #tPartnerId#, BudgetCategoryId #bgtCategoryId#
delete from tbl_MFR_TPF_Detail#_tpfSuffix# where mfr_Id = and tpartnerType = 'TER' and productItemCode like 'BGT%' and forecast_year = and forecast_month = and forecast_status = 'A' and bgtCategoryId = and tPartnerId =
delete from tbl_TER_BusinessPlanGoals where ownerId = and ownerType = and goalType in ( 'B', 'G' ) and businessPlanId in ( select businessPlanId from tbl_TER_BusinessPlans where ownerId = and ownerType = and timeframeYear = and timeframePeriod = and businessPlanId = ) select businessPlanId, ownerId, ownerType from tbl_TER_BusinessPlans where ownerId = and ownerType = and timeframeYear = and timeframePeriod = -- and territoryId = 4138 and businessPlanId = update tbl_TER_BusinessPlans set startDate = , endDate = where businessPlanId =
#_resultsHTML#