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

    <tablebrowser
        autoResizeMode="AUTO_RESIZE_NEXT_COLUMN"
        table="wwAuftragspositionen"
        where=""
        orderBy="wwAuftragspositionen.nPositionNr"
    >
        <primaryKey type="MULTI">
            <column name="nAuftragNr"  type="INT"/>
            <column name="nPositionNr" type="INT"/>
        </primaryKey>
        <column title="Position" field="nPositionNr" width="50" minWidth="10" maxWidth="70" />
        <column title="Artikel"  field="nArtikelNr"  width="120" minWidth="10" maxWidth="200"
            joinTable="wwArtikel" joinKeyField="nNr" joinField="sBezeichnung"/>
        <column title="Menge"    field="fMenge"      width="50" minWidth="10" maxWidth="70"
            type="NUMBER" alignment="RIGHT" pattern="#.00"/>
    </tablebrowser>
    
    <searchDialog
        id="idArtikelSuchDialog"
        title="Artikel-Suche"
        autoResizeMode="AUTO_RESIZE_OFF"
        size="750 500"
        table="wwArtikel"
        where="wwArtikel.sStatus='A'"
        orderBy="wwArtikel.sArtikelnummer"
    >
        <primaryKey>
            <column name="nNr" type="INT" />
        </primaryKey>
        <column title="Artikelnummer"    field="sArtikelnummer"    width="100" minWidth="10" maxWidth="120"/>
        <column title="Bezeichnung"      field="sBezeichnung"      width="140" minWidth="10" maxWidth="200"/>
        <column title="Artikelgruppe"    field="nArtikelgruppeNr"  width="100" minWidth="10" maxWidth="120"
            joinTable="wwArtikelgruppen" joinKeyField="nNr" joinField="sBezeichnung"/>
        <column title="Lagerort"         field="nLagerortNr"       width="100" minWidth="10" maxWidth="120"
            joinTable="wwLagerorte" joinKeyField="nNr" joinField="sBezeichnung"/>
        <column title="Preis"            field="fPreis"            width="60"  minWidth="10" maxWidth="120"
            type="NUMBER" alignment="RIGHT" pattern="#.00 €"/>
        <column title="Bestand"          field="fIstmenge"         width="70"  minWidth="10" maxWidth="120"
            type="NUMBER" alignment="RIGHT" pattern="#.0"/>
        <column title="Dimension"        field="nDimensionNr"      width="80"  minWidth="10" maxWidth="120"
            joinTable="wwDimensionen"    joinKeyField="nNr" joinField="sBezeichnung"/>
        <column title="Aufgenommen"      field="dtAufnahme"        width="70"  minWidth="10" maxWidth="90"
            type="DATE" pattern="dd.MM.yyyy"/>
    </searchDialog>

    <panel id="editor" widgetGroupID="">
        <label text="Artikel:"
            constraints="0 +0 1 1 0.0 0.0 EAST NONE 5 5 0 0 0 0"
        />
        <textField
            id="idArtikel"
            toolTipText="Artikel"
            constraints="1 +0 1 1 0.0 0.0 WEST NONE 5 5 0 0 0 0"
            obligatory="true"
            size="220 21"
            searchDialog="idArtikelSuchDialog"
            field="nArtikelNr"
            type="INT"
        >
            <masterWidget
                table="wwArtikel"
                showField="sBezeichnung"
                where=""
            >
                <primaryKey type="SINGLE">
                    <column name="nNr"        type="INT"/>
                </primaryKey>
                <slaveWidget id="idArtikelgruppe" mode="VALUE" field="nArtikelgruppeNr" type="INT" />
                <slaveWidget id="idDimension"     mode="VALUE" field="nDimensionNr"     type="INT" />
                <slaveWidget id="idPreis"         mode="VALUE" field="fPreis"           type="FLOAT" />
            </masterWidget>
        </textField>
        <comboBox
            id="idArtikelgruppe"
            name="Artikelgruppe"
            toolTipText="Artikelgruppe"
            constraints="2 +0 1 1 0.0 0.0 WEST NONE 5 5 0 0 0 0"
            locked="true"
            type="INT"
        >
            <dataSource
                table="wwArtikelgruppen"
                itemField="sBezeichnung"
                where="sStatus='A'"
                orderBy="nPosition"
            >
                <primaryKey type="SINGLE">
                    <column name="nNr" type="INT"/>
                </primaryKey>
            </dataSource>
        </comboBox>
        <comboBox
            id="idDimension"
            name="Dimension"
            toolTipText="Dimension"
            constraints="3 +0 1 1 0.0 0.0 WEST NONE 5 5 0 0 0 0"
            locked="true"
            type="INT"
        >
            <dataSource
                table="wwDimensionen"
                itemField="sBezeichnung"
                where="sStatus='A'"
                orderBy="nPosition"
            >
                <primaryKey type="SINGLE">
                    <column name="nNr" type="INT"/>
                </primaryKey>
            </dataSource>
        </comboBox>

        <label text="Menge:"
            constraints="0 +1 1 1 0.0 0.0 EAST NONE 5 5 0 0 0 0"
        />
        <numberField
            id="idMenge"
            name="Menge"
            toolTipText="Menge"
            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="fMenge"
            type="DOUBLE"
        />

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

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

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