<?xml version="1.0" encoding="UTF-8"?>
<xmlpanel>
    <configuration
        table="erpCommissionPositions"
        browserWhereClause="nCommissionNr=${idCommisions.primaryKey[0]}"
    >
        <primaryKey type="MULTI">
            <column name="nCommissionNr"  type="INT" source="$idCommisions.primaryKey[0]" />
            <column name="nPositionNr"    type="INT" source="AUTO" />
        </primaryKey>
    </configuration>

    <tablebrowser
        autoResizeMode="AUTO_RESIZE_NEXT_COLUMN"
        table="erpCommissionPositions"
        where=""
        orderBy="erpCommissionPositions.nPositionNr"
    >
        <primaryKey type="MULTI">
            <column name="nCommissionNr" type="INT"/>
            <column name="nPositionNr"   type="INT"/>
        </primaryKey>
        <column title="Position" field="nPositionNr" width="50" minWidth="10" maxWidth="70" />
        <column title="Article"  field="nArticleNr"  width="120" minWidth="10" maxWidth="200"
            joinTable="erpArticle" joinKeyField="nNr" joinField="sName"/>
        <column title="Quantity" field="fQuantity"   width="50" minWidth="10" maxWidth="70"
            type="NUMBER" alignment="RIGHT" pattern="#.00"/>
        <column title="Price"    field="fPrice"      width="50" minWidth="10" maxWidth="70"
            type="NUMBER" alignment="RIGHT" pattern="#.00"/>
    </tablebrowser>
    
    <searchDialog
        id="idArticleSearchDialog"
        title="Article search"
        autoResizeMode="AUTO_RESIZE_OFF"
        size="750 500"
        table="erpArticle"
        where="erpArticle.sStatus='A'"
        orderBy="erpArticle.sArticleNumber"
    >
        <primaryKey>
            <column name="nNr" type="INT" />
        </primaryKey>
        <column title="Article number"   field="sArticleNumber"     width="100" minWidth="10" maxWidth="120"
            id="idArticleNumber"/>
        <column title="Name"             field="sName"              width="140" minWidth="10" maxWidth="200"/>
        <column title="Article group"    field="nArticleGroupNr"    width="100" minWidth="10" maxWidth="120"
            type="COMBOBOX" joinTable="erpArticleGroups"    joinKeyField="nNr" joinField="sName"
            where="sStatus='A'" orderBy="nPosition" />
        <column title="Storage location" field="nStorageLocationNr" width="100" minWidth="10" maxWidth="120"
            type="COMBOBOX" joinTable="erpStorageLocations" joinKeyField="nNr" joinField="sName"
            where="sStatus='A'" orderBy="nPosition"/>
        <column title="Price"            field="fPrice"             width="60"  minWidth="10" maxWidth="120"
            type="NUMBER" alignment="RIGHT" pattern="#.00 €"/>
        <column title="Inventory"        field="fActualInventory"   width="70"  minWidth="10" maxWidth="120"
            type="NUMBER" alignment="RIGHT" pattern="#.0"/>
        <column title="Dimension"        field="nDimensionNr"       width="80"  minWidth="10" maxWidth="120"
            type="COMBOBOX" joinTable="erpDimensions"       joinKeyField="nNr" joinField="sName"
            where="sStatus='A'" orderBy="nPosition"/>
        <column title="Admittance"       field="dtAdmittance"       width="70"  minWidth="10" maxWidth="90"
            type="DATE" pattern="MM-dd-yyyy"/>
    </searchDialog>

    <panel id="editor" widgetGroupID="">
        <label text="Article:"
            constraints="0 +0 1 1 0.0 0.0 EAST NONE 5 5 0 0 0 0"
        />
        <textField
            id="idArticle"
            toolTipText="Article number"
            constraints="1 +0 1 1 0.0 0.0 WEST NONE 5 5 0 0 0 0"
            obligatory="true"
            size="80 21"
            searchDialog="idArticleSearchDialog"
            field="nArticleNr"
            type="INT"
        >
            <masterWidget
                table="erpArticle"
                showField="sArticleNumber"
                where=""
                searchDialogColumnID="idArticleNumber"
            >
                <primaryKey type="SINGLE">
                    <column name="nNr"        type="INT"/>
                </primaryKey>
                <slaveWidget id="idArticleName"  mode="VALUE" field="sName"           type="STRING" />
                <slaveWidget id="idArticleGroup" mode="VALUE" field="nArticleGroupNr" type="INT" />
                <slaveWidget id="idDimension"    mode="VALUE" field="nDimensionNr"    type="INT" />
                <slaveWidget id="idPrice"        mode="VALUE" field="fPrice"          type="FLOAT" />
            </masterWidget>
        </textField>
        <textField
            id="idArticleName"
            toolTipText="Article name"
            constraints="2 +0 2 1 0.0 0.0 WEST NONE 5 5 0 0 0 0"
            size="220 21"
            locked="true"
        />
        <comboBox
            id="idArticleGroup"
            name="Article group"
            toolTipText="Article group"
            constraints="4 +0 1 1 0.0 0.0 WEST NONE 5 5 0 0 0 0"
            locked="true"
        >
            <dataSource
                table="erpArticleGroups"
                itemField="sName"
                where="sStatus='A'"
                orderBy="nPosition"
            >
                <primaryKey type="SINGLE">
                    <column name="nNr" type="INT"/>
                </primaryKey>
            </dataSource>
        </comboBox>
        <comboBox
            id="idDimension"
            name="Dimension"
            toolTipText="Dimension"
            constraints="5 +0 1 1 0.0 0.0 WEST NONE 5 5 0 0 0 0"
            locked="true"
        >
            <dataSource
                table="erpDimensions"
                itemField="sName"
                where="sStatus='A'"
                orderBy="nPosition"
            >
                <primaryKey type="SINGLE">
                    <column name="nNr" type="INT"/>
                </primaryKey>
            </dataSource>
        </comboBox>

        <label text="Quantity:"
            constraints="0 +1 1 1 0.0 0.0 EAST NONE 5 5 0 0 0 0"
        />
        <numberField
            id="idQuantity"
            name="Quantity"
            toolTipText="Quantity"
            constraints="1 +0 1 1 0.0 0.0 WEST NONE 5 5 0 0 0 0"
            obligatory="true"
            defaultValue="1.00"
            pattern="#.##"
            horizontalAlignment="RIGHT"
            size="70 21"
            field="fQuantity"
            type="DOUBLE"
        />

        <label text="Price:"
            constraints="0 +1 1 1 0.0 0.0 EAST NONE 5 5 0 0 0 0"
        />
        <numberField
            id="idPrice"
            name="Price"
            toolTipText="Price"
            constraints="1 +0 1 1 0.0 0.0 WEST NONE 5 5 0 0 0 0"
            pattern="#.##"
            horizontalAlignment="RIGHT"
            size="70 21"
            field="fPrice"
            type="DOUBLE"
        />

        <label text="Total price:"
            constraints="2 +0 1 1 0.0 0.0 EAST NONE 5 5 0 0 0 0"
        />
        <numberField
            id="idTotalPrice"
            name="Total price"
            toolTipText="Total price"
            constraints="3 +0 1 1 0.0 0.0 WEST NONE 5 5 0 0 0 0"
            pattern="#.##"
            horizontalAlignment="RIGHT"
            size="70 21"
            field="fTotalPrice"
            type="DOUBLE"
        />

        <label
            text=""
            constraints="0 +1 6 1 10.0 0.0 EAST HORIZONTAL 5 0 0 0 0 0"
        />
    </panel>
</xmlpanel>