• cloudtrip
  • NEWBIE
  • 0 Points
  • Member since 2011

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 3
    Questions
  • 11
    Replies

Here is the start of my class method:
___________________________________________________________________
 

public class TradeCalendarController {

    // Set class variable
  public Trade_Calender__c nitch;
  public Trade_Events__c trade;
  
    //set List variables
    Trade_Events__c[] recList; 
    Trade_Events__c[] recDelete; 
        
    //STANDARD CONTROLLER SECTION
 
 public TradeCalendarController(Trade_Calender__c item){
    this.nitch = item;

}  
   public String getParam(String name) {
        return ApexPages.currentPage().getParameters().get(name);   
    }

public TradeCalendarController(ApexPages.StandardController stdController) {
    this.nitch = (Trade_Calender__c)stdController.getRecord();
        
    recList = [ Select
    Trade_Calender__c,
    Name,
    Account__c,
    Year__c,
    Category__c,
    Vendor__c,
    Period__c,
    New_Pack__c,
    Promo_Price__c, 
    Merch_Type__c,
    More_than_1_event_in_period__c,
    Event_start_in_prior_period__c,  
    Events_del__c
    From Trade_Events__c
    WHERE
    Trade_Calender__c = :nitch.id order by Pack__c, period__c];
    
    if(recList.size()==0){
        newRow();
    }
}
// returns Record information
 public Trade_Events__c[] getRecList() { 
   return recList; 
}
      
 // Inserts all changes into records
 public pagereference saveChanges() { 
update nitch;
try {
upsert recList;
} catch (DMLException e){
     ApexPages.addMessages(e);
   return null;

     }
// after save refreshes data on page
  recList = [ Select
    Trade_Calender__c,
    Name,
    Account__c,
    Year__c,
    Category__c,
    Vendor__c,
    Period__c,
    New_Pack__c,
    Promo_Price__c,
    Merch_Type__c,
    More_than_1_event_in_period__c,
    Event_start_in_prior_period__c,
    Events_del__c
    From Trade_Events__c
    WHERE
    Trade_Calender__c = :nitch.id order by Pack__c, period__c];

   getRecList();
 
return null;
}

 // Inserts a new row
 public pagereference newRow() { 

  Trade_Events__c d = new Trade_Events__c();
  for(Trade_Calender__c trade:[Select id, name, account__c, Year__c from Trade_Calender__c where id = :nitch.id]){
  d.Account__c = trade.account__c;
  d.Name = trade.name;
  d.Year__c = trade.Year__c;
  d.Trade_Calender__c = nitch.id;
  recList.add(d);

}
return null;

 }

// clones a row
 public PageReference cl() {
 String delid = getParam('delid');
 Trade_Events__c d = new Trade_Events__c();
  for(Trade_Events__c trade:[Select id, Pack__c, Vendor__c, Merch_Type__c, Promo_Price__c, Category__c, name, account__c, Year__c from Trade_Events__c where Trade_Calender__c=:nitch.id and ID=:delid]){
  d.Account__c = trade.account__c;
  d.Name = trade.name;
  d.Year__c = trade.Year__c;
  d.Trade_Calender__c = nitch.id;
  d.New_Pack__c = trade.Pack__c;
  d.Merch_Type__c = trade.Merch_Type__c;
  d.Pack__c ='a0y40000000LzEK';
  d.Promo_Price__c = trade.Promo_Price__c;
  d.Category__c = trade.Category__c;
  d.Vendor__c = trade.Vendor__c;
  recList.add(d);

 }

   return null;
   }
 // delete row
 public PageReference del() {
        try {
            String delid = getParam('delid');
            Trade_Events__c event = [SELECT Id FROM Trade_Events__c WHERE ID=:delid];
            DELETE event;
        } catch (Exception e) {
            ApexPages.addMessages(e);
        }
// after del refreshes the data on page
    recList = [ Select
    Trade_Calender__c,
    Name,
    Account__c,
    Year__c,
    Category__c,
    Vendor__c,
    Period__c,
    New_Pack__c,
    Promo_Price__c,
    Merch_Type__c,
    More_than_1_event_in_period__c,
    Event_start_in_prior_period__c,
    Events_del__c
    From Trade_Events__c
    WHERE
    Trade_Calender__c = :nitch.id order by Pack__c, period__c];
    getRecList();
    return null;
    }

}

 

Here is my controller and would appreciate any assistance in trying to get this up to 75% so I can deploy it to production

 

************************************************************************

public class NewItemController {

    New_Item_Tracking__c item;
    Launch_Specific_Products__c[] prodList;
    Launch_Specific_Products__c[] deletions;

    public NewItemController(New_Item_Tracking__c newItem) {
   
    item = newItem;

    prodList = [Select
    Wrigley_Products__c,
    SS_MP_Club__c,
    New_Product_Status__c,
    Est_Distribution__c,
    Order_Volume__c,
    Accepted_Date__c,
    Ordered_Date__c,
    Presented_Pending_Date__c,
    Rejected_Date__c,
    Delete_This__c,
    Month_1_SSU_Early_Launch__c,
    Approved_Early_Ship_1_Month_Prior_Turn__c,
    Month_2_SSU_Early_Launch__c,
    Approved_Early_Ship_2_Month_Prior_Turn__c,
    Month_3_SSU_Early_Launch__c,
    Approved_Early_Ship_3_Month_Prior_Turn__c,
    X1st_Month_Vol__c,
    Mth_1_Vol_Turn__c,
    X2nd_Month_Vol__c,
    Mth_2_Vol_Turn__c,
    X3rd_Month_Vol__c,
    Mth_3_Vol_Turn__c,
    X4th_Month_Vol__c,
    Mth_4_Vol_Turn__c,
    X5th_Month_Vol__c,
    Mth_5_Vol_Turn__c,
    X4_W__c,
    X8_Wks_Dist__c,
    X12_Wks_Dist__c,
    X16_Wks_Dist__c,
    X20_Wks_Dist__c,
    X24_Wks_Dist__c,
    X28_Wks_Dist__c
    From Launch_Specific_Products__c
    WHERE
    New_Item_Tracking__c=:item.Id
    ORDER BY SS_MP_Club__c, Wrigley_Products__c];
    }
    public NewItemController(ApexPages.StandardController controller) {
   
    item = (New_Item_Tracking__c)controller.getSubject();

    prodList = [Select
    Wrigley_Products__c,
    SS_MP_Club__c,
    New_Product_Status__c,
    Est_Distribution__c,
    Order_Volume__c,
    Accepted_Date__c,
    Ordered_Date__c,
    Presented_Pending_Date__c,
    Rejected_Date__c,
    Delete_This__c,
    X1st_Month_Vol__c,
    Mth_1_Vol_Turn__c,
    X2nd_Month_Vol__c,
    Mth_2_Vol_Turn__c,
    X3rd_Month_Vol__c,
    Mth_3_Vol_Turn__c,
    X4th_Month_Vol__c,
    Mth_4_Vol_Turn__c,
    X5th_Month_Vol__c,
    Mth_5_Vol_Turn__c,
    X4_W__c,
    X8_Wks_Dist__c,
    X12_Wks_Dist__c,
    X16_Wks_Dist__c,
    X20_Wks_Dist__c,
    X24_Wks_Dist__c,
    X28_Wks_Dist__c,
    Month_1_SSU_Early_Launch__c,
    Approved_Early_Ship_1_Month_Prior_Turn__c,
    Month_2_SSU_Early_Launch__c,
    Approved_Early_Ship_2_Month_Prior_Turn__c,
    Month_3_SSU_Early_Launch__c,
    Approved_Early_Ship_3_Month_Prior_Turn__c
    From Launch_Specific_Products__c
    WHERE
    New_Item_Tracking__c=:item.Id
    ORDER BY SS_MP_Club__c, Wrigley_Products__c];
/*
    if(prodList.size()==0){
        newProduct();
    }
*/
}
// returns product information into Products
 public Launch_Specific_Products__c[] getprodList() {
  return prodList;
}

 // Inserts all changes into records
 public pagereference savehanges() {
  upsert prodList;
  return null;

 }

 /*
 public pagereference newProduct() {
  Launch_Specific_Products__c d = new Launch_Specific_Products__c();
  d.New_Item_Tracking__c = item.Id;
  prodList.add(d);
  return null;
 }
 */

/*
 public PageReference delProduct() {
 
  upsert prodList;
  deletions= [ SELECT Id FROM Launch_Specific_Products__c WHERE New_Item_Tracking__c=:item.Id AND Delete_This__c=true];
 
  delete deletions;
  prodList = [Select
    Wrigley_Products__c,
    New_Product_Status__c,
    Est_Distribution__c,
    Order_Volume__c,
    Accepted_Date__c,
    Ordered_Date__c,
    Presented_Pending_Date__c,
    Rejected_Date__c,
    Delete_This__c
    From Launch_Specific_Products__c
    WHERE
    New_Item_Tracking__c=:item.Id];
 
    getprodList();
 
  return null;
 }
 */
}

Here is the start of my class method:
___________________________________________________________________
 

public class TradeCalendarController {

    // Set class variable
  public Trade_Calender__c nitch;
  public Trade_Events__c trade;
  
    //set List variables
    Trade_Events__c[] recList; 
    Trade_Events__c[] recDelete; 
        
    //STANDARD CONTROLLER SECTION
 
 public TradeCalendarController(Trade_Calender__c item){
    this.nitch = item;

}  
   public String getParam(String name) {
        return ApexPages.currentPage().getParameters().get(name);   
    }

public TradeCalendarController(ApexPages.StandardController stdController) {
    this.nitch = (Trade_Calender__c)stdController.getRecord();
        
    recList = [ Select
    Trade_Calender__c,
    Name,
    Account__c,
    Year__c,
    Category__c,
    Vendor__c,
    Period__c,
    New_Pack__c,
    Promo_Price__c, 
    Merch_Type__c,
    More_than_1_event_in_period__c,
    Event_start_in_prior_period__c,  
    Events_del__c
    From Trade_Events__c
    WHERE
    Trade_Calender__c = :nitch.id order by Pack__c, period__c];
    
    if(recList.size()==0){
        newRow();
    }
}
// returns Record information
 public Trade_Events__c[] getRecList() { 
   return recList; 
}
      
 // Inserts all changes into records
 public pagereference saveChanges() { 
update nitch;
try {
upsert recList;
} catch (DMLException e){
     ApexPages.addMessages(e);
   return null;

     }
// after save refreshes data on page
  recList = [ Select
    Trade_Calender__c,
    Name,
    Account__c,
    Year__c,
    Category__c,
    Vendor__c,
    Period__c,
    New_Pack__c,
    Promo_Price__c,
    Merch_Type__c,
    More_than_1_event_in_period__c,
    Event_start_in_prior_period__c,
    Events_del__c
    From Trade_Events__c
    WHERE
    Trade_Calender__c = :nitch.id order by Pack__c, period__c];

   getRecList();
 
return null;
}

 // Inserts a new row
 public pagereference newRow() { 

  Trade_Events__c d = new Trade_Events__c();
  for(Trade_Calender__c trade:[Select id, name, account__c, Year__c from Trade_Calender__c where id = :nitch.id]){
  d.Account__c = trade.account__c;
  d.Name = trade.name;
  d.Year__c = trade.Year__c;
  d.Trade_Calender__c = nitch.id;
  recList.add(d);

}
return null;

 }

// clones a row
 public PageReference cl() {
 String delid = getParam('delid');
 Trade_Events__c d = new Trade_Events__c();
  for(Trade_Events__c trade:[Select id, Pack__c, Vendor__c, Merch_Type__c, Promo_Price__c, Category__c, name, account__c, Year__c from Trade_Events__c where Trade_Calender__c=:nitch.id and ID=:delid]){
  d.Account__c = trade.account__c;
  d.Name = trade.name;
  d.Year__c = trade.Year__c;
  d.Trade_Calender__c = nitch.id;
  d.New_Pack__c = trade.Pack__c;
  d.Merch_Type__c = trade.Merch_Type__c;
  d.Pack__c ='a0y40000000LzEK';
  d.Promo_Price__c = trade.Promo_Price__c;
  d.Category__c = trade.Category__c;
  d.Vendor__c = trade.Vendor__c;
  recList.add(d);

 }

   return null;
   }
 // delete row
 public PageReference del() {
        try {
            String delid = getParam('delid');
            Trade_Events__c event = [SELECT Id FROM Trade_Events__c WHERE ID=:delid];
            DELETE event;
        } catch (Exception e) {
            ApexPages.addMessages(e);
        }
// after del refreshes the data on page
    recList = [ Select
    Trade_Calender__c,
    Name,
    Account__c,
    Year__c,
    Category__c,
    Vendor__c,
    Period__c,
    New_Pack__c,
    Promo_Price__c,
    Merch_Type__c,
    More_than_1_event_in_period__c,
    Event_start_in_prior_period__c,
    Events_del__c
    From Trade_Events__c
    WHERE
    Trade_Calender__c = :nitch.id order by Pack__c, period__c];
    getRecList();
    return null;
    }

}

 

Here is my controller and would appreciate any assistance in trying to get this up to 75% so I can deploy it to production

 

************************************************************************

public class NewItemController {

    New_Item_Tracking__c item;
    Launch_Specific_Products__c[] prodList;
    Launch_Specific_Products__c[] deletions;

    public NewItemController(New_Item_Tracking__c newItem) {
   
    item = newItem;

    prodList = [Select
    Wrigley_Products__c,
    SS_MP_Club__c,
    New_Product_Status__c,
    Est_Distribution__c,
    Order_Volume__c,
    Accepted_Date__c,
    Ordered_Date__c,
    Presented_Pending_Date__c,
    Rejected_Date__c,
    Delete_This__c,
    Month_1_SSU_Early_Launch__c,
    Approved_Early_Ship_1_Month_Prior_Turn__c,
    Month_2_SSU_Early_Launch__c,
    Approved_Early_Ship_2_Month_Prior_Turn__c,
    Month_3_SSU_Early_Launch__c,
    Approved_Early_Ship_3_Month_Prior_Turn__c,
    X1st_Month_Vol__c,
    Mth_1_Vol_Turn__c,
    X2nd_Month_Vol__c,
    Mth_2_Vol_Turn__c,
    X3rd_Month_Vol__c,
    Mth_3_Vol_Turn__c,
    X4th_Month_Vol__c,
    Mth_4_Vol_Turn__c,
    X5th_Month_Vol__c,
    Mth_5_Vol_Turn__c,
    X4_W__c,
    X8_Wks_Dist__c,
    X12_Wks_Dist__c,
    X16_Wks_Dist__c,
    X20_Wks_Dist__c,
    X24_Wks_Dist__c,
    X28_Wks_Dist__c
    From Launch_Specific_Products__c
    WHERE
    New_Item_Tracking__c=:item.Id
    ORDER BY SS_MP_Club__c, Wrigley_Products__c];
    }
    public NewItemController(ApexPages.StandardController controller) {
   
    item = (New_Item_Tracking__c)controller.getSubject();

    prodList = [Select
    Wrigley_Products__c,
    SS_MP_Club__c,
    New_Product_Status__c,
    Est_Distribution__c,
    Order_Volume__c,
    Accepted_Date__c,
    Ordered_Date__c,
    Presented_Pending_Date__c,
    Rejected_Date__c,
    Delete_This__c,
    X1st_Month_Vol__c,
    Mth_1_Vol_Turn__c,
    X2nd_Month_Vol__c,
    Mth_2_Vol_Turn__c,
    X3rd_Month_Vol__c,
    Mth_3_Vol_Turn__c,
    X4th_Month_Vol__c,
    Mth_4_Vol_Turn__c,
    X5th_Month_Vol__c,
    Mth_5_Vol_Turn__c,
    X4_W__c,
    X8_Wks_Dist__c,
    X12_Wks_Dist__c,
    X16_Wks_Dist__c,
    X20_Wks_Dist__c,
    X24_Wks_Dist__c,
    X28_Wks_Dist__c,
    Month_1_SSU_Early_Launch__c,
    Approved_Early_Ship_1_Month_Prior_Turn__c,
    Month_2_SSU_Early_Launch__c,
    Approved_Early_Ship_2_Month_Prior_Turn__c,
    Month_3_SSU_Early_Launch__c,
    Approved_Early_Ship_3_Month_Prior_Turn__c
    From Launch_Specific_Products__c
    WHERE
    New_Item_Tracking__c=:item.Id
    ORDER BY SS_MP_Club__c, Wrigley_Products__c];
/*
    if(prodList.size()==0){
        newProduct();
    }
*/
}
// returns product information into Products
 public Launch_Specific_Products__c[] getprodList() {
  return prodList;
}

 // Inserts all changes into records
 public pagereference savehanges() {
  upsert prodList;
  return null;

 }

 /*
 public pagereference newProduct() {
  Launch_Specific_Products__c d = new Launch_Specific_Products__c();
  d.New_Item_Tracking__c = item.Id;
  prodList.add(d);
  return null;
 }
 */

/*
 public PageReference delProduct() {
 
  upsert prodList;
  deletions= [ SELECT Id FROM Launch_Specific_Products__c WHERE New_Item_Tracking__c=:item.Id AND Delete_This__c=true];
 
  delete deletions;
  prodList = [Select
    Wrigley_Products__c,
    New_Product_Status__c,
    Est_Distribution__c,
    Order_Volume__c,
    Accepted_Date__c,
    Ordered_Date__c,
    Presented_Pending_Date__c,
    Rejected_Date__c,
    Delete_This__c
    From Launch_Specific_Products__c
    WHERE
    New_Item_Tracking__c=:item.Id];
 
    getprodList();
 
  return null;
 }
 */
}