Участник
|
In several places in NAV 2009 SP1, it has been used ListPlus pages in order to display two-dimension matrix. Those ListPlus Pages may be customized in order to be arranged as FactBoxes directly inside a main page (Document, Worksheet, etc.).
The main concept of those kind of two-dimensional matrix pages is that they have a Page Part with a List that is updated every time a value is changed in the analysis parameter bounded to fields and/or variables that belongs directly to the ListPlus.
This post will provide the basics on how to integrate the Item Availability by Location directly as FactBoxes instead of being called from RTC actions. The same concept may be applied to Item Availability by Period and Item Availability by Variant (and/or all of them together). In the example, the Planning Worksheet page is used as the main page.
The next step will guide you through the modifications that need to be performed in order to arrange Page 492 “Item Availability By Location” as a FactBox. (In the standard Cronus this is called from an action present in the Related Information action group.)
- Rearrange Matrix Lines and configure Style property
- Design page 515 “Item Avail. by Location Lines”
- Below the Container line, add a new line of Field type. Fill in a name (e.g. “ItemNo”), a caption (e.g. “Item”) and populate SourceExpr property with Item.”No.” + ‘ ‘ + Item.Description
- Add some Style management: for this line change the Style property to “Favorable” and StyleExpr to TRUE

- In order to display in bold Matrix cells that contain values different from 0, add the following Boolean global variables (one for every possible Matrix Column). It is very important that for every Boolean variable, you also set the property (SHIFT+F4) “IncludeInDataset” to Yes. GRBool (for GrossRequirement StyleExpr)
SRBool (for ScheduledReceipt StyleExpr)
PORBool (for PlannedOrderReceipt StyleExpr)
PABBool (for ProjAvailBalance StyleExpr)
InvBool (for Item.Inventory StyleExpr)
QPOBool (for Item."Qty. on Purch. Order" StyleExpr)
QSOBool (for Item.”Qty. on Sales Order” StyleExpr)
TOSQBool (for Item.”Trans. Ord. Shipment (Qty.)” StyleExpr)
QTBool (for Item.”Qty. in Transit” StyleExpr)
TORQBool (for Item.”Trans. Ord. Receipt(Qty.)” StyleExpr)
EIBool (for ExpectedInventory StyleExpr)
AvInvBool (for QtyAvailable StyleExpr)
SRQBool (for Item.”Scheduled Receipt(Qty.)” StyleExpr)
SNQBool (for Item.”Scheduled Need (Qty.)” StyleExpr)
PORLBool (for PlannedOrderReleases StyleExpr)
NetChBool (for Item.”Net Change” StyleExpr)
- Create a new Function called “InitBoolean” and add this code: GRBool := GrossRequirement <> 0;
SrBool := ScheduledReceipt <> 0;
PORBool := PlannedOrderReceipt <> 0;
PABBool := ProjAvailBalance <> 0;
InvBool := Item.Inventory <> 0;
QPOBool := Item."Qty. on Purch. Order" <> 0;
QSOBool := Item."Qty. on Sales Order" <> 0;
TOSQBool := Item."Trans. Ord. Shipment (Qty.)" <> 0;
QTBool := Item."Qty. in Transit" <> 0;
TORQBool := Item."Trans. Ord. Receipt (Qty.)" <> 0;
EIBool := ExpectedInventory <> 0;
AvInvBool := QtyAvailable <> 0;
SRQBool := Item."Scheduled Receipt (Qty.)" <> 0;
SNQBool := Item."Scheduled Need (Qty.)" <> 0;
PORLBool := PlannedOrderReleases <> 0 ;
NetChBool := Item."Net Change" <> 0;
- Add the Boolean value initialization in the OnAfterGetRecord() trigger at the bottom …
ExpectedInventory := AvailabilityMgt.ExpectedQtyOnHand(Item,TRUE,0,QtyAvailable,31129999D);
END;
InitBoolean; //Add this line
…
- For last, let this code work. In Page Designer, on each field for which you created a Boolean variable, change the Style property to “Strong” and in the StyleExpr property add the respective Boolean variable that you created in step d.
- Save and Compile the page.
- Add Availability by Location FactBox to Planning Worksheet.
- Design page 99000852 Planning Worksheet
- Go to last line and add a new Part type. Give this a name (e.g. IALL) and a caption (e.g. Availability By Location) and in the Properties for the line, fill in the PagePartID with “Item Avail. by Location Lines”
- Save and compile the page.
- Add the controls and code to update dynamically the Availability by Location FactBox
- Design page 99000852 Planning Worksheet
- Add these global variables Name DataType Subtype Length Option String ItemForIALL Record Item Calendar Record Date ItemPeriodLength Option Day,Week,Month,Quarter,Year,Period AmountType Option Net Change,Balance at Date ItemNo Code 30 DescDateFilter Text 30
- Add the controls to manage the options for the Availability by Location FactBox by inserting those lines below the Container
Type: Group, SubType: Group, Caption: Availability Options
Type: Field, Caption: View by, SourceExpr: ItemPeriodLength, Style: Unfavorable, StyleExpr: TRUE
Type: Field, Caption: View as, SourceExpr: AmountType, Style: Unfavorable, StyleExpr: TRUE
Type: Field, Caption: Period, SourceExpr: DescDateFilter, Editable: FALSE
- Create a new Function called UpdateSubForm() and add this code ..
IF ItemForIALL.GET(ItemNo) THEN BEGIN
FindPeriod('',ItemForIALL);
CurrPage.IALL.FORM.Set(ItemForIALL,ItemPeriodLength,AmountType);
END;
…
- Create a new Function called FindPeriod() with these values: FindPeriod(SearchText : Code[10];VAR ItemRec : Record Item)
On the FindPeriod function, add a local variable:
Name DataType Subtype PeroidFormMgt Codeunit PeriodFormManagement And add this code to the FindPeriod function:
…
IF ItemRec.GETFILTER("Date Filter") <> '' THEN BEGIN
Calendar.SETFILTER("Period Start",ItemRec.GETFILTER("Date Filter"));
IF NOT PeriodFormMgt.FindDate('+',Calendar,ItemPeriodLength) THEN
PeriodFormMgt.FindDate('+',Calendar,ItemPeriodLength: ay);
Calendar.SETRANGE("Period Start");
END;
PeriodFormMgt.FindDate(SearchText,Calendar,ItemPeriodLength);
IF AmountType = AmountType::"Net Change" THEN BEGIN
ItemRec.SETRANGE("Date Filter",Calendar."Period Start",Calendar."Period End");
IF ItemRec.GETRANGEMIN("Date Filter") = ItemRec.GETRANGEMAX("Date Filter") THEN
ItemRec.SETRANGE("Date Filter",ItemRec.GETRANGEMIN("Date Filter"));
END ELSE
ItemRec.SETRANGE("Date Filter",0D,Calendar."Period End");
DescDateFilter := ItemRec.GETFILTER("Date Filter");
…
- Now you only need to add the code to let the Availability by location FactBox act like the original ListPlus page. To do so, you just have to copy paste those functions (and obviously code inside) from Page 492 “Item Availability by Location” and paste them into the functions of the Planning Worksheet page. PeriodItemPeriodLengthOnPush
YearItemPeriodLengthOnPush
QuarterItemPeriodLengthOnPush
MonthItemPeriodLengthOnPush
WeekItemPeriodLengthOnPush
DayItemPeriodLengthOnPush
NetChangeAmountTypeOnPush
BalanceatDateAmountTypeOnPush
DayItemPeriodLengthOnValidate
WeekItemPeriodLengthOnValidate
MonthItemPeriodLengthOnValidat
QuarterItemPeriodLengthOnValid
YearItemPeriodLengthOnValidate
PeriodItemPeriodLengthOnValida
NetChangeAmountTypeOnValidate
BalanceatDateAmountTypeOnValid
- Once you have copied all this function, it’s needed to substitute all the FindPeriod(‘’); statement with FindPeriod(‘’,ItemForIALL); (You can simply use CTRL+H, Replace build in function).
- For refinement, you need to add in the OnOpenPage() trigger, in the bottom, this code ...
ERROR('');
ReqJnlManagement.OpenJnl(CurrentWkshBatchName,Rec);
FindPeriod('',ItemForIALL); //Add this line
…
And in the OnAfterGetRecord(); trigger, in the bottom, this code
…
PlanningWarningLevel1OnFormat;
ItemNo := "No."; //Add this line
UpdateSubForm; //Add this line
…
- Save and compile the page.
- Add the Period Actions to browse through Periods in the Availability by Location FactBox
- Design page 99000852 Planning Worksheet
- Go to Last line(the first blank line) of the page and click SHIFT+F4 (edit Properties of the page)
- Change the property PromotedActionCategoriesML into ENU=New,Process,Reports,Availability Periods
- Close the Page properties window
- Go to last line of the page and click on View > Actions
- Go to last line and add one action group and two actions like these
Type: ActionGroup, Caption: Availability
Type: Action, Caption: Previous Period, Image: PreviousRecord, Promoted: Yes, PromotedCategory: Category4, ShortCutKey: CTRL+Q
Type: Action, Caption: Next Period, Image: NextRecord, Promoted: Yes, PromotedCategory: Category4, ShortCutKey: CTRL+W
- Save and compile the page.
Right now you have completed all the steps necessary to create a FactBox for Item Availability by Location.
Attached you will find a .txt file with the example above, extended to Item availability by Location, by Period and by Variant too. Captions have been added for ENU and ITA.
These postings are provided "AS IS" with no warranties and confer no rights. You assume all risk for your use.
Best Regards,
Duilio Tacconi ( dtacconi)
Microsoft Dynamics Italy
Microsoft Customer Service and Support (CSS) EMEA

Источник: http://feedproxy.google.com/~r/Micro...a-factbox.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
|