This class shows the detail of the order selected. It allows the user to change the the quantity of the items, delete them and notify the customer if the order is updated.
| private | TextArea | notesArea | |
| private | DataGrid | grid | |
| private | TextInput | subtotalInput | |
| private | TextInput | totalInput | |
| private | TextInput | taxInput | |
| private | TextInput | dateInput | |
| private | Button | notifyBtn | |
| private | Service | remoteServer | |
| private | Number | totalLabor | |
| private | Object | repairData | |
| private | Connector | laborConnector | |
| private | Connector | updateOrderConnector | |
| private | Number | activeWorkOrder |
DetailView() |
| public | onOrderReceived(item:Object) | ||
| public | showDetail(r:ResultEvent) | ||
| public | static | FORMAT_STOCK_DATE(item:Object) | |
| public | modelChanged(item) | ||
| public | editField(indexcolNamevalue) | ||
| public | newPartEvent(part:Object) | ||
| public | click() | ||
| public | notify(event) | ||
| public | updateConfirmation(r:ResultEvent) | ||
| public | reportError(fault:FaultEvent) | ||
| public | bayChangeEvent(event:Object) | ||
| private | onLoad() | ||
| private | init() | ||
| private | setConnection() | ||
| private | getRepairDate() | ||
| private | null | updateInvoice(removedItem:Object) |
private notesArea:TextArea
An instance of TextArea that has been initialized on the stage with instance name notesArea.
private grid:DataGrid
An instance of DataGrid that has been initialized on the stage with instance name grid.
private subtotalInput:TextInput
An instance of TextInput that has been initialized on the stage with instance name subtotalInput.
private totalInput:TextInput
An instance of TextInput that has been initialized on the stage with instance name totalInput.
private taxInput:TextInput
An instance of TextInput that has been initialized on the stage with instance name taxInput.
private dateInput:TextInput
An instance of TextInput that has been initialized on the stage with instance name dateInput.
private notifyBtn:Button
An instance of Button that has been initialized on the stage with instance name notifyBtn.
private remoteServer:Service
A Service object that connects to the CFC mx.services.workOrder
private totalLabor:Number
The total labor of the current order
private repairData:Object
An Object with the following properties REPAIR_DATE, REPAIR_TIME, REPAIR_LENGTH, and REPAIR_BAY. It's instatiated on onOrderReceived()
- See Also
- onOrderReceived
private laborConnector:Connector
A connector used to notify other classes when the totalLabor property changes
- See Also
- TrioMotor.totalLabor
private updateOrderConnector:Connector
A connector used to notify other classes when an order is updated. This happen when the user presses the notify button.
- See Also
- TrioMotor.updateOrder
private activeWorkOrder:Number
the WORK_ORDER_ID of the current order. It's instatiated on onOrderReceived()
- See Also
- onOrderReceived
DetailView()
public onOrderReceived(item:Object):Void
Description: keeps a reference of the item received in the repairData Object It also keeps its id in activeWorkOrder. Set notes TextArea and the date TextInput with the data received
Calls the server requesting the items of the selected order
Assumptions: receives an item with the following properties:
REPAIR_DATE, REPAIR_TIME, REPAIR_LENGTH, REPAIR_BAY, NOTES, and WORK_ORDER_ID
Globals: instantiates repairData and activeWorkOrder. Uses notesArea, dateInput, and remoteServer
Calls: getRepairDate()
getWorkOrderItems() in remoteServer Service
Is Called by: broadcastOrderReceived() in the application(TrioMotor class)
- Parameters
- Returns
- Void
- See Also
- OrderReceivedListener.onOrderReceived
public showDetail(r:ResultEvent):Void
Description: populates the DataGrid with the recordset Received. Registersitself as a listener of the modelChanged event in the grid.dataProvider. Calls updateInvoice()
Assumptions: receives a RecordSet with the columns: PART_NAME, QTY, PRICE, and IN_STOCK_DATE
Globals: Uses grid
Calls: updateInvoice()
addEventListener() in grid.dataProvider
Is Called by: the server via RelayResponder in response to the getWorkOrderItems() call
- Parameters
- Returns
- Void
static public FORMAT_STOCK_DATE(item:Object):String
Description: checks if IN_STOCK_DATE is not null. If it isn't, returns its value formatted, otherwise, returns the string yes
Assumptions: the Object received has the properties: IN_STOCK_DATE and PART_NAME Globals: none
Calls: none
Is Called by: This function is called by Column inStockCol to format its values because the labelFunction of inStockCol maps to this function
- Parameters
item (Object)-- Returns
- String
public modelChanged(item):Void
Description: Updates the invoice each time the model changes
Assumptions: item has a property removedItems
Globals: none
Calls: updateInvoice()
Is Called by: the grid.dataProvider because this class is registered as a listener of the modelChanged event
- Parameters
item -- Returns
- Void
public editField(index,
colName,
value):Void
Description: Edits the value of a cell(QTY) in the grid and checks if it's Labor. If it is not Labor, it finds which cell corresponds to Labor and increases its amount with the difference between new and old value from the cell updated
Assumptions: the items in the data grid have the properties LABOR, QTY, and PART_ID
Globals: uses grid
Calls: getItemAt(), editField() in the DataGrid
Is Called by: change of the StepperCell class
- Parameters
- Returns
- Void
- See Also
- StepperCell.change
public newPartEvent(part:Object):Void
Description: Adds a part to the grid. If the part already exits in the grid, it increases its quantity, otherwise, adds a new one.
If the grid is empty, it creates a new Labor record and then adds the part
Assumptions: Part has the properties QTY, LABOR, PART_ID, IN_STOCK_DATE, PART_NAME, and PRICE
Globals: uses activeWorkOrder, grid
Calls: editField(), addItem(), and getItemAt() in the grid
Is Called by: The Connector newPart, because this class is registered as a listener of the new Part event. This connector is fired by Parts
- Parameters
part (Object)- A part to be added in the grid- Returns
- Void
- See Also
- TrioMotor.newPart
public click():Void
Description: Checks that the user has selected an order with items, date and notes. If all of them are present (order, items, date and notes), shows an alert window to confirm the notify event. If anything is missing, shows an alert window informing the user that some items have not been supplied
Assumptions: activeWorkOrder, grid, dateInput, notesArea are instantiated
Globals: uses activeWorkOrder, grid, dateInput, notesArea
Calls: Alert.show()
Is Called by: The notifyBtn when the user cliks on it
- Returns
- Void
public notify(event):Void
Description: if the user clicks Yes in the Alert window, updateWorkOrder() is called on the server to update the selected order
Assumptions: repairData has the properties REPAIR_DATE, REPAIR_TIME, REPAIR_LENGTH, REPAIR_BAY . The gird is not empty, there are an active order. An the notes have some text
Globals: uses grid, activeWorkOrder, repairData, notesArea, and remoteServer
Calls: updateWorkOrder() in the Service remoteServer that references to the CfC mx.services.workOrder
Is Called by: The proxy object in the alert "Confirm Notification", created on the method click() param event
- Returns
- Void
- See Also
- .click
public updateConfirmation(r:ResultEvent):Void
Description: If the confirmation is true, shows a Successful Alert and sends an updateOrderEvent to all the listeners that are registered in the updateOrderConnector.
If the confirmation is not true, shows an Error Alert
Assumptions: updateOrderConnector is instantiated
Globals: Uses updateOrderConnector and activeWorkOrder
Calls: fireEvent() in the Connector updateOrderConnector
Is Called by: This function is called by the server via RelayResponder in response to the updateWorkOrder() call param r Expects a Boolean as ResultEvent.result
- Returns
- Void
- See Also
- TrioMotor.updateOrder
public reportError(fault:FaultEvent):Void
Description: trace the error in case that some problem has occurred
Assumptions: none
Globals: none
Calls: none
Is Called by: This function is called byRelayResponder when an Error occurs
- Parameters
fault (FaultEvent)-- Returns
- Void
public bayChangeEvent(event:Object):Void
Description: Saves the incoming object in the repairData and updates the dateInput with the data
Assumptions: the item received has the following properties:
REPAIR_DATE, REPAIR_TIME, REPAIR_LENGTH, REPAIR_BAY, NOTES, and WORK_ORDER_ID
Globals: Uses repairData and dateInput
Calls: getRepairDate()
Is Called by: The connector bayChange, because this class is registered as a listener of it. This event is fired by the BaySchedule class
- Parameters
event (Object)-- Returns
- Void
- See Also
- TrioMotor.bayChange
private onLoad():Void
Description: Creates the columns for the grid, sets the Style in the InputText And registers this class as a listener of the event click in the notifyBtn
Assumptions: grid, subtotalInput, taxInput, notifyBtn, dateInput, and totalInput have already been instantiated on the stage
Globals: Uses the following globals:
grid, subtotalInput, taxInput, notifyBtn, dateInput, and totalInput
Calls: Will call FORMAT_STOCK_DATE in inStockCol.labelFunction
call setStyle() in subtotalInput, taxInput, dateInput, and totalInput
Is Called by: This function is called automatically by the player when this object is completely loaded. This is possible because this class extends from the MovieClip Class
- Returns
- void
private init():Void
Description: Registers this object as listener of newPart event and bayChange event in the Connectors newPart and bayChange. Calls the set connection method to connect with the server
Registers this object as listener of OrderReceived event in the application
Assumptions: application is already instantiated
Globals: uses application, laborConnector, and updateOrderConnector
Calls: setConnection()
addListener() in the Connectors newPart and bayChange.
And addOrderReceivedListener() in the application
Is Called by: setApplication() in its super class AbstractView
- Returns
- Void
private setConnection():Void
Description: Creates a connection with the server to the CFC mx.services.workOrder
Assumptions: application is already instantiated
Globals: uses application and remoteServer
Calls: none
Is Called by: init()
- Returns
- Void
private getRepairDate():String
Description: Formats a string with the REPAIR_DATE data and returns it. If there is no REPAIR_DATE available, returns an empty string
Assumptions: none
Globals: uses repairData
Calls: getMonth() and getDate() in repairData.REPAIR_DATE
Is Called by: onOrderReceived() and bayChangeEvent()
- Returns
- String
private updateInvoice(removedItem:Object)
Description: Goes through the grid and calculate the subtotal, total, and labor time. Sends an Event to all the registered Listener in the laborConnector and sends the new value of the totalLabor
Updates the TextInputs subtotalInput, taxInput, totalInput with the new values
Assumptions: The items in the grid and the removedItem have the properties: PRICE, QTY, PART_ID, and LABOR
Globals: uses grid, totalLabor, subtotalInput, taxInput, totalInput, and laborConnector
grid, subtotalInput, taxInput, and totalInput have been initialized on the stage
Calls: getItemAt() and editField in the grid
fireEvent() in the Connector laborConnector
Is Called by: showDetail() and modelChanged() param removedItem Is not required
- Returns
- Void
- See Also
- TrioMotor.totalLabor