Untitled

 avatar
unknown
plain_text
2 months ago
1.5 kB
4
Indexable
// Create Scenario Items from Bill Points and Actual Volumes
for (LLC_BI__Bill_Point__c billPoint : billPointMap.values()) {
    TS_COA_Actual_Volumes__c actualVolume = actualVolumeMap.get(billPoint.LLC_BI__LookupKey__c);
    
    // If actualVolume is not null, allow TS_COA_Net_Fee_Amount__c to be null if it's not present
    Decimal netFeeAmount = actualVolume != null ? actualVolume.TS_COA_Net_Fee_Amount__c : null;
    Date pocDate = actualVolume != null ? actualVolume.TS_COA_S_C_Date__c : null;
    Decimal volumeCounter = actualVolume != null ? Decimal.valueOf(actualVolume.TS_COA_Counter__c) : null;

    // Create the Scenario Item record
    scenarioItemList.add(
        new LLC_BI__Scenario_Item__c(
            LLC_BI__Bill_Point__c = billPoint.Id,
            LLC_BI__Exception_Price__c = netFeeAmount,  // Allow null value
            poc__c = pocDate,
            LLC_BI__Volumes__c = volumeCounter,
            WMX_Proposed_Month__c = scenario.WMX_Proposed_Month__c,
            LLC_BI__Scenario__c = scenario.Id,
            LLC_BI__Product__c = billPoint.LLC_BI__Product__c,
            Name = billPoint.Name,
            TS_COA_Imported_Volume__c = True,
            TS_COA_Imported__c = 'Yes',
            LLC_BI__Standard_Price__c = billPoint.LLC_BI__Price__c,
            LLC_BI__Product_Type_Name__c = billPoint.LLC_BI__Product__r.LLC_BI__Product_Type__r.Name,
            LLC_BI__Is_Monthly__c = billPoint.LLC_BI__Is_Monthly__c
        )
    );
}
Editor is loading...
Leave a Comment