Quintiq file version 2.0 #parent: #root StaticMethod GetProcessQuantity ( ProductInStockingPointInPeriod pispip, output String tooltip ) declarative remote as Real { Description: 'Return quantities of a pispip related sales demands.' TextBody: [* quantity := 0.0 fulfilledQuantity := 0.0 unfulfilledQuantity := 0.0 totalQuantity := 0.0 totalFulfilledQuantity := 0.0 totalUnfulfileldQuantity := 0.0 // Insert table tag for tooltip // Product tooltip := ""; tooltip := tooltip + ''; // Routing name tooltip := tooltip + ''; // Period tooltip := tooltip + ''; // A separating line tooltip := tooltip + '
Product: ' + pispip.ProductInStockingPoint_MP().Product_MP().Name() + '
Stocking point: ' + pispip.ProductInStockingPoint_MP().StockingPoint_MP().Name() + '
Period: ' + pispip.Start().Format( 'D-MM-Y' ) + ' until ' + pispip.End().Format( 'D-MM-Y' ) + '

'; // Headers tooltip := tooltip + '' + '' + '' + '' + ''; // Sort them w.r.t sales segment name for grouping sdips := selectsortedset( pispip, SalesDemandInPeriodBase, sdip, true, sdip.SalesSegmentName() ); ssName := sdips.Element( 0 ).SalesSegmentName(); traverse( sdips, Elements, e ) { // When we see a different sales segment, create a new row for tooltip if( ssName <> e.SalesSegmentName() ) { tooltip := tooltip + '' + '' + '' + '' + ''; // Reset value ssName := e.SalesSegmentName(); quantity := 0; unfulfilledQuantity := 0; fulfilledQuantity := 0; } quantity := quantity + e.Quantity(); fulfilledQuantity := fulfilledQuantity + e.FulfilledQuantity(); unfulfilledQuantity := unfulfilledQuantity + e.UnfulfilledQuantity(); totalQuantity := totalQuantity + e.Quantity(); totalFulfilledQuantity := totalFulfilledQuantity + e.FulfilledQuantity(); totalUnfulfileldQuantity := totalUnfulfileldQuantity + e.UnfulfilledQuantity(); } // Last row handling tooltip := tooltip + '' + '' + '' + '' + ''; // Sum for multi sales segment demands if( selectuniquevalues( sdips, Elements, e, true, e.SalesSegmentName() ).Size() > 1 ) { tooltip := tooltip + '' + '' + '' + '
Sales segment:Quantity:Fulfilled:Unfulfilled:Price:
' + ssName + '' + quantity.AsQUILL() + '' + fulfilledQuantity.AsQUILL() + '' + unfulfilledQuantity.AsQUILL() + '' + e.Price().AsQUILL() + '
' + ssName + '' + quantity.AsQUILL() + '' + fulfilledQuantity.AsQUILL() + '' + unfulfilledQuantity.AsQUILL() + '' + sdips.Element( sdips.Size() - 1 ).Price().AsQUILL() + '
All' + totalQuantity.AsQUILL() + '' + totalFulfilledQuantity.AsQUILL() + '' + totalUnfulfileldQuantity.AsQUILL() + '
' } // Return fulfilled quantity sum return totalFulfilledQuantity; *] }