0
votes

Hey I am writing a class and keep getting this Constructor not defined error. I have a Class within another class and I am doing all my queries before I start assigning fields to each of the class elements.

I get no errors when I am constructing the approvalQuoteLineWrapper class in the inner for loop at the end. However when I try to construct the approvalQuoteWrapper I keep getting this error.

Constructor not defined: [CustomApprovalsHomeComponentController.approvalQuoteWrapper].(Id, Id, Id, Id, Id, Id, String, String, String, String, String, String, Datetime, Decimal, List) (Line: 114, Column: 23)

Here is my Code:

public with sharing class CustomApprovalsHomeComponentController {

public class approvalQuoteLineWrapper{
    public approvalQuoteLineWrapper(Id quoteLineId, Id productId, String productName, Decimal listPrice, Decimal discountPercentage, Decimal netPrice, Decimal quantity, Decimal extendedPrice){
        this.quoteLineId = quoteLineId;
        this.productId = productId;
        this.productName = productName;
        this.listPrice = listPrice;
        this.discountPercentage = discountPercentage;
        this.netPrice = netPrice;
        this.quantity = quantity;
        this.extendedPrice = extendedPrice;
    }
    public Id quoteLineId {get;set;}
    public Id productId {get;set;}
    public String productName {get;set;}
    public Decimal listPrice {get;set;}
    public Decimal discountPercentage {get;set;}
    public Decimal netPrice {get;set;}
    public Decimal quantity {get;set;}
    public Decimal extendedPrice {get;set;}
}
public class approvalQuoteWrapper{
    public approvalQuoteWrapper(Id approvalId, Id quoteId, Id opportunityId, Id approverId, Id accountId, Id ownerId, String paymentTerms, String billingFreq, String quoteStatus, String oppType, String approvalStatus, String accountName, Date quoteCreateDate, Decimal totalDiscount, List<approvalQuoteLineWrapper> quoteLineList){
        this.approvalId = approvalId;
        this.quoteId = quoteId;
        this.opportunityId = opportunityId;
        this.approverId = approverId;
        this.accountId = accountId;
        this.ownerId = ownerId;
        this.paymentTerms = paymentTerms;
        this.billingFreq = billingFreq;
        this.quoteStatus = quoteStatus;
        this.oppType = oppType;
        this.approvalStatus = approvalStatus;
        this.accountName = accountName;
        this.quoteCreateDate = quoteCreateDate;
        this.totalDiscount = totalDiscount;
        this.quoteLineList = quoteLineList;
    }
    public Id approvalId {get;set;}
    public Id quoteId {get;set;}
    public Id opportunityId {get;set;}
    public Id approverId {get;set;}
    public Id accountId {get;set;}
    public Id ownerId {get;set;}
    public String paymentTerms {get;set;}
    public String billingFreq {get;set;}
    public String quoteStatus {get;set;}
    public String oppType {get;set;}
    public String approvalStatus {get;set;}
    public String accountName {get;set;}
    public Date quoteCreateDate {get;set;}
    public Decimal totalDiscount {get;set;}
    public List<approvalQuoteLineWrapper> quoteLineList {get;set;}  


}

public List<approvalQuoteWrapper> itemsToApprove {get;set;}

public CustomApprovalsHomeComponentController(){
    Map<Id, sbaa__Approval__c> approvalList = new Map<Id, sbaa__Approval__c>();
    itemsToApprove = new List<approvalQuoteWrapper>();

    for(sbaa__Approval__c items : [SELECT Id, sbaa__Approver__r.sbaa__User__c, Quote__c, sbaa__Status__c
                                 FROM sbaa__Approval__c
                                 WHERE sbaa__Approver__r.sbaa__User__c = :UserInfo.getUserID()])
    {
        approvalList.put(items.Quote__c, items);
    }



    List<SBQQ__Quote__c> quoteList = [SELECT Id, SBQQ__Account__c, SBQQ__Account__r.Name, SBQQ__Opportunity2__c, SBQQ__Opportunity2__r.Type, ApprovalStatus__c, CreatedDate, SBQQ__TotalCustomerDiscountAmount__c, OwnerId, SBQQ__PaymentTerms__c, SBQQ__BillingFrequency__c
                                 FROM SBQQ__Quote__c
                                 WHERE Id IN :approvalList.keySet() 
                                 AND ApprovalStatus__c = 'Pending'
                                 ORDER BY CreatedDate DESC];


    List<SBQQ__QuoteLine__c> quoteLineList = [SELECT Id, SBQQ__Product__c, SBQQ__Product__r.Name, SBQQ__ListPrice__c, SBCF_Approval_Discount__c, SBQQ__NetPrice__c, SBQQ__Quantity__c, SBCF_Price_per_user__c, SBQQ__Quote__c
                                 FROM SBQQ__QuoteLine__c
                                 WHERE SBQQ__Quote__c IN :approvalList.keySet()];



    for(SBQQ__Quote__c quote : quoteList){
        List<approvalQuoteLineWrapper> appQLineList = new List<approvalQuoteLineWrapper>();
        for(SBQQ__QuoteLine__c quoteLine : quoteLineList){
            if(quoteLine.SBQQ__Quote__c == quote.Id){
                appQLineList.add(new approvalQuoteLineWrapper(
                quoteLine.Id, 
                quoteLine.SBQQ__Product__c, 
                quoteLine.SBQQ__Product__r.Name, 
                quoteLine.SBQQ__ListPrice__c, 
                quoteLine.SBCF_Approval_Discount__c, 
                quoteLine.SBQQ__NetPrice__c, 
                quoteLine.SBQQ__Quantity__c, 
                quoteLine.SBCF_Price_per_user__c ));
            }
        }
        itemsToApprove.add(new approvalQuoteWrapper(
            approvalList.get(quote.Id).Id,
            quote.Id,
            quote.SBQQ__Opportunity2__c,
            approvalList.get(quote.Id).sbaa__Approver__r.sbaa__User__c,
            quote.SBQQ__Account__c,
            quote.OwnerId,
            quote.SBQQ__PaymentTerms__c,
            quote.SBQQ__BillingFrequency__c,
            quote.ApprovalStatus__c,
            quote.SBQQ__Opportunity2__r.Type,
            approvalList.get(quote.Id).sbaa__Status__c,
            quote.SBQQ__Account__r.Name,
            quote.CreatedDate,
            quote.SBQQ__TotalCustomerDiscountAmount__c,
            appQLineList));
    }
}

}

Not Sure what I am missing.

Thanks in advance!

1

1 Answers

1
votes

Date vs DateTime

Your constructor uses a Date, you're passing in a DateTime.