## GetBudgetActualAmountPipes
<table class="TableStyle-Borders" style="margin-left: 0; margin-right: auto; width: 100%;" data-cellspacing="0"> <colgroup> <col style="width: 33%" /> <col style="width: 33%" /> <col style="width: 33%" /> </colgroup> <thead> <tr class="header TableStyle-Borders-Head-Header1"> <th class="TableStyle-Borders-HeadE-Regular-Header1">Order</th> <th class="TableStyle-Borders-HeadE-Regular-Header1">Pipe</th> <th class="TableStyle-Borders-HeadD-Regular-Header1">Description</th> </tr> </thead> <tbody> <tr class="odd TableStyle-Borders-Body-Row1"> <td class="TableStyle-Borders-BodyE-Regular-Row1">100</td> <td class="TableStyle-Borders-BodyE-Regular-Row1">GetSettings</td> <td class="TableStyle-Borders-BodyD-Regular-Row1">Gets BudgetsFromOnlineOnly setting. If Currency parameter is not null, then sets ConversionRate into result (if CurrencyRate for currency is null or ConversionRate is equal 0, then use 1, otherwise value from CurrencyRate.ConversionRate).</td> </tr> <tr class="even TableStyle-Borders-Body-Row1"> <td class="TableStyle-Borders-BodyE-Regular-Row1">200</td> <td class="TableStyle-Borders-BodyE-Regular-Row1">CreateOrderHistoryQuery</td> <td class="TableStyle-Borders-BodyD-Regular-Row1">Sets OrderHistoryQuery by whole OrderHistory table</td> </tr> <tr class="odd TableStyle-Borders-Body-Row1"> <td class="TableStyle-Borders-BodyE-Regular-Row1">300</td> <td class="TableStyle-Borders-BodyE-Regular-Row1">FilterOrderHistoryQuery</td> <td class="TableStyle-Borders-BodyD-Regular-Row1"><p>Filter OrderHistoryQuery with BillTo.CustomerNumber, PeriodStartDate and PeriodEndDate parameters.</p> <p>If ShipTo parameter is set, UserProfile parameter is null and BudgetsFromOnlineOnly setting is false, then filter also by ShipTo.CustomerSequence parameter.</p></td> </tr> <tr class="even TableStyle-Borders-Body-Row1"> <td class="TableStyle-Borders-BodyE-Regular-Row1">400</td> <td class="TableStyle-Borders-BodyE-Regular-Row1">FilterForOnlineOnlyIfNeeded</td> <td class="TableStyle-Borders-BodyD-Regular-Row1"><p>If BudgetsFromOnlineOnly is false, then exit pipe.</p> <p>If OrderHistoryQuery is null, then throw ArgumentNullException</p> <p>Join CustomerOrder table by orderHistory.WebOrderNumber and cart.OrderNumber. If UserProfile parameter exists, filter cart.InitiatedByUserProfile.UserName also by UserProfile.UserName parameter. And update OrderHistoryQuery result by all filtering with selecting order history.</p></td> </tr> <tr class="odd TableStyle-Borders-Body-Row1"> <td class="TableStyle-Borders-BodyB-Regular-Row1">500</td> <td class="TableStyle-Borders-BodyB-Regular-Row1">CalculateBudgetActualAmount</td> <td class="TableStyle-Borders-BodyA-Regular-Row1"><p>If OrderHistoryQuery is null, then throw ArgumentNullException</p> <p>Calculate BudgetActualAmount by summarizing all OrderHistoryQuery results.</p> <p><strong>Code Example:</strong></p> <p><code>orderHistory.OrderTotal / (orderHistory.ConversionRate == 0 || orderHistory.ConversionRate == null ? 1 : orderHistory.ConversionRate) * result.ConversionRate</code></p></td> </tr> </tbody> </table>
## GetCustomerBudgetReview
<table class="TableStyle-Borders" style="margin-left: 0; margin-right: auto; width: 100%;" data-cellspacing="0"> <colgroup> <col style="width: 33%" /> <col style="width: 33%" /> <col style="width: 33%" /> </colgroup> <thead> <tr class="header TableStyle-Borders-Head-Header1"> <th class="TableStyle-Borders-HeadE-Regular-Header1">Order</th> <th class="TableStyle-Borders-HeadE-Regular-Header1">Pipe</th> <th class="TableStyle-Borders-HeadD-Regular-Header1">Description</th> </tr> </thead> <tbody> <tr class="odd TableStyle-Borders-Body-Row1"> <td class="TableStyle-Borders-BodyE-Regular-Row1">100</td> <td class="TableStyle-Borders-BodyE-Regular-Row1">GetCurrency</td> <td class="TableStyle-Borders-BodyD-Regular-Row1">Get BillTo currency or default website currency (if customer currency is not set).</td> </tr> <tr class="even TableStyle-Borders-Body-Row1"> <td class="TableStyle-Borders-BodyE-Regular-Row1">200</td> <td class="TableStyle-Borders-BodyE-Regular-Row1">GetBudgetCalendar</td> <td class="TableStyle-Borders-BodyD-Regular-Row1">Get first BudgetCalendar filtered by BillTo.Id and FiscalYear parameters.</td> </tr> <tr class="odd TableStyle-Borders-Body-Row1"> <td class="TableStyle-Borders-BodyE-Regular-Row1">300</td> <td class="TableStyle-Borders-BodyE-Regular-Row1">GetCustomerBudgets</td> <td class="TableStyle-Borders-BodyD-Regular-Row1"><p>If UserProfile parameter is not null, filter CustomerBudget by BillTo.Id and UserProfile.Id parameters</p> <p>If ShipTo parameter is not null, filter CustomerBudget by BillTo.Id and ShipTo.Id parameters</p> <p>Else filter CustomerBudget by BillTo.Id parameter and ShipToCustomerId, UserProfileId equal null.</p> <p>CurrentCustomerBudget and PreviousCustomerBudget are being set by filtering collection.</p></td> </tr> <tr class="even TableStyle-Borders-Body-Row1"> <td class="TableStyle-Borders-BodyE-Regular-Row1">400</td> <td class="TableStyle-Borders-BodyE-Regular-Row1">CalculateVariance</td> <td class="TableStyle-Borders-BodyD-Regular-Row1"><p>If BudgetCalendar is null, exit pipe.</p> <p>Fill CustomerBudgetReviewDtos with 13 periods by using data from previous pipes (BudgetCalendar, CurrentCustomerBudget, PreviousCustomerBudget).</p></td> </tr> <tr class="odd TableStyle-Borders-Body-Row1"> <td class="TableStyle-Borders-BodyB-Regular-Row1">500</td> <td class="TableStyle-Borders-BodyB-Regular-Row1">GetBudgetActualAmounts</td> <td class="TableStyle-Borders-BodyA-Regular-Row1"><p>If GetBudgetActualAmounts is false, exit pipe.</p> <p>Iterate over CustomerBudgetReviewDtos and calculate CurrentFiscalYearActual and LastFiscalYearActual using GetBudgetActualAmount budget pipeline. Based on previous iteration, calculate CurrentFiscalYearVariance and LastFiscalYearVariance per each CustomerBudgetReviewDto.</p></td> </tr> </tbody> </table>
## GetAvailableBudgetBalance
<table class="TableStyle-Borders" style="margin-left: 0; margin-right: auto; width: 100%;" data-cellspacing="0"> <colgroup> <col style="width: 33%" /> <col style="width: 33%" /> <col style="width: 33%" /> </colgroup> <thead> <tr class="header TableStyle-Borders-Head-Header1"> <th class="TableStyle-Borders-HeadE-Regular-Header1"><p>Order</p></th> <th class="TableStyle-Borders-HeadE-Regular-Header1"><p>Handler</p></th> <th class="TableStyle-Borders-HeadD-Regular-Header1"><p>Description</p></th> </tr> </thead> <tbody> <tr class="odd TableStyle-Borders-Body-Row1"> <td class="TableStyle-Borders-BodyE-Regular-Row1"><p>100</p></td> <td class="TableStyle-Borders-BodyE-Regular-Row1"><p>ValidateBudgetEnforcementLevel</p></td> <td class="TableStyle-Borders-BodyD-Regular-Row1"><p>Retrieves BillTo by BillToId parameter, can return not found error. If BudgetsFromOnlineOnly setting is false and customer BudgetEnforcementLevel is BudgetEnforcementLevel.User, then set BudgetEnforcementLevel to BudgetEnforcementLevel.None. If customer BudgetEnforcementLevel is BudgetEnforcementLevel.None, then exit the handler chain.</p></td> </tr> <tr class="even TableStyle-Borders-Body-Row1"> <td class="TableStyle-Borders-BodyE-Regular-Row1"><p>200</p></td> <td class="TableStyle-Borders-BodyE-Regular-Row1"><p>GetFilterForBudgetEnforcementLevel</p></td> <td class="TableStyle-Borders-BodyD-Regular-Row1"><p>If customer BudgetEnforcementLevel is BudgetEnforcementLevel.ShipTo, then retrieve ShipTo by ShipToId parameter, can return not found error.</p> <p>If customer BudgetEnforcementLevel is BudgetEnforcementLevel.User, then retrieve UserProfile by UserProfileId parameter, can return not found error.</p></td> </tr> <tr class="odd TableStyle-Borders-Body-Row1"> <td class="TableStyle-Borders-BodyB-Regular-Row1"><p>300</p></td> <td class="TableStyle-Borders-BodyB-Regular-Row1"><p>CalculateAvailableBudgetBalance</p></td> <td class="TableStyle-Borders-BodyA-Regular-Row1"><p>Call GetCustomerBudgetReview budget pipeline for current year, with retrieved BillTo, ShipTo or UserProfile. Calculate FiscalYearBudget based on retrieved data.</p> <p>If customer budget review records exists. then set result Currency from BillTo or website default currency (if BillTo Currency property is not set). Call GetBudgetActualAmount budget pipeline and set FiscalYearActual with pipeline result.</p> <p>AvailableBudgetBalance value will be.calculated as FiscalYearBudget minus FiscalYearActual.</p></td> </tr> </tbody> </table>