/*
 * Author       : sampleapps
 * Generated on : 24-Nov-2009 13:54:37
 * Version      : 3.0
 */
application "commission"
{
    type = public
    date format = "dd-MMM-yyyy"
    time zone = "America/Los_Angeles"
    section Home
    {
        form  form
        {
            
            Retail
            (
                type  =  USD
                width  =  20
            )

            Sold
            (
                type  =  USD
                width  =  20
            )

            Sales_Rep
            (
                displayname  =  "Sales Rep"
                type  =  text
                on user input
                {
                    if ((input.Sales_Rep  ==  "AA")  ||  (input.Sales_Rep  ==  "BB"))
                    {
                        input.Commission = (input.Sold  *  0.3  -  (input.Sold  -  input.Retail));
                    }
                    else
                    {
                        input.Commission = (input.Sold  *  0.2  -  (input.Sold  -  input.Retail));
                    }
                }
            )

            Commission
            (
                type  =  decimal
                width  =  20
            )

            actions
            {
                on add
                {
                    Submit
                    (
                        type  =  submit
                        displayname  =  "Submit"
                    )
                    Reset
                    (
                        type  =  reset
                        displayname  =  "Reset"
                    )
                }
                on edit
                {
                    Update
                    (
                        type  =  submit
                        displayname  =  "Update"
                    )
                    Cancel
                    (
                        type  =  cancel
                        displayname  =  "Cancel"
                    )
                }
            }
        }

        list  form_View
        {
            displayname = "form View"
            show  all  rows  from  form 
            (
                Sold
                Retail
                Sales_Rep as "Sales Rep"
                Commission
            )
            options
            (
                display rows = 100
            )
        }

    }

}
