function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
nikkeynikkey 

Roll up summary custom logic fails

Can any one help me out .I have a visual force page created for 4 reports and has wizard controller written.Now we would like do some custom calculation to change the Value.The logic was working fine at one report and gets failed in other report.

PickReport ,InvoiceReport,PickReportUS ,InvoiceReportUS ect having a wizard controller.

Condition 1:

PickReport & PickReportUS

If the product line =‘DIE’ make following changes .

1) unit price should change to $.01.

2)extension = qty*0.01

3)Subtotal__c=Non_Pick_Total__c(Rollup summary :Aggregrates the Extension,has a Criterias as "Pick is False" )

InvoiceReport&InvoiceReportUS

1) unit price should change to $.01.

2)extension = qty*0.01

3)Subtotal__c=Pick_Total__c(Rollup summary :Aggregrates the Extension,has a Criterias as "Pick is True" )

Condition 2:

PickReport & PickReportUS

If the product line !=‘DIE’ make following changes .

1) unit price should change to $1.

2)extension = qty*1

3)Subtotal__c=Non_Pick_Total__c(Rollup summary :Aggregrates the Extension,has a Criterias as "Pick is False" )

InvoiceReport&InvoiceReportUS

1) unit price should change to $1.

2)extension = qty*1

3)Subtotal__c=Pick_Total__c(Rollup summary :Aggregrates the Extension,has a Criterias as "Pick is True" )

Code :
if(OPplineitem[i].PricebookEntry.Product2.Product_Line__c=='DIE') 
                     {
                      tempObj.unitprice=0.01;
                      tempobj.extension=OPplineitem[i].Quantity * tempObj.unitprice;
                      tempObj.productname=OPplineitem[i].Bin_Item_Code__c;
                      //tempObj2.Subtotal=tempobj.extension;

                      if(i==0){
                       //tempObj2.Subtotal=tempObj.NonPickTotal;
                      tempObj2.Subtotal=tempobj.extension;
                     }
                     else{
                      tempObj2.Subtotal=tempObj2.Subtotal+tempObj.extension;
                       }
                        system.debug('@@@@@@@@'+tempObj2.Subtotal);
                      }
                 else
                     {
                     tempObj.unitprice=1;
                     //tempObj.unitprice=OPplineitem[i].ListPrice;
                     tempobj.extension=OPplineitem[i].Extension__c ;
                     tempObj2.Subtotal=tempobj.extension;
                     system.debug('*********'+tempObj2.Subtotal);
                    }

This code works fine for the PickReport but fails for Invoice Report.When the Subtotal is PickTotal.The value dispalyed is incorrect .

Anyhelp very much appreciated.