# Munster DeltaFlex schema
#
# Based on `schema-sonic.md`, extended with CVT (article support file).
#
#
# Article file
@model Article

Article worden in dit format aangeleverd door DeltaFlex.

```
"ART"                    - ARTICLE UPDATE
ClientID        [N]
ItemID**        [N 8]
EAN_Code**      [C 13]
GroupID#        [N 2]  - fixed table
GenreID#        [N 4]  - fixed table
FormatID        [N 4]  - fixed table
SupplierID#     [C 10]
Genre#          [C 8]
Format          [C 3]
Supplier#       [C 8]
Artist          [C 70]
Title           [C 55]
Composer#       [C 35]
Conductor#      [C 35]
Orchestra#      [C 35]
Director#       [C 35]
Suffix#         [C 7]
Prefix#         [C 7]
ArticleNumber#  [C 15]
LabelName#      [C 30]
ArticleStatus   [C 3]    - DEL = deleted, NRM = normal, EXP = expected, SPO = offer
VAT_Code        [C 1]    - Hi (H), Low (L) or none (N or empty)
ReleaseDate#    [D]
AvailableFrom#  [D]
PlayTime#       [T]
Languages#      [C 20]   - ISO (separated by a colon), numeric value indicates age restriction
Subtitles#      [C 20]   - ISO (separated by a colon)
DVDRegion#      [C 1]    - either DVD region (0-9) or Blu-ray region (A-B). 0 means reg. free
TrackQty#       [N 3]
DiscQty#        [N 3]
SiteMarker#     [C 18]   - for site display use (e.g. coded P for “publish on frontpage”)
ImportCode#     [C 8]
ExtraInfo#      [C 40]   - may contain size and color information for apparel (colon sep.)
LinkInfo#       [C 10]   - formatted as “T:xxxxxxxx”, where T is LinkType (M = Merge,
                           L = Link) and xxxxxxxx is the LinkID for simular articles
ReleaseInfo#    [C 10]   - Can contain release week/yr. (WWYYYY) followed by a ReleaseID (xxxx)
Priority#       [C 1]    - Can contain release priority (A/B/C, etc.)
Restriction#    [C 4]    - Format C:ZZ (ZZ = ISO), G:XX (XX = Group ID) or empty (unrestricted)
```

## Post handler for article
@decorator Article

Voeg links toe naar sonic-nl op basis van ItemID

```php
if (isset($row['ItemID'])) {
    $ItemNr = str_pad($row['ItemID'], 8, '0', STR_PAD_LEFT);

    $base = rtrim(config('fsenv.url', 'https://distrolux.online'), '/') . '/';

    $imgName = "images/prod/I" . substr($ItemNr, 0, 2) . "/" . substr(
        $ItemNr,
        2,
        3
    ) . "/" . $ItemNr . ".jpg";

    $row['Image'] = $base . $imgName;
}
```

# Remark - article notities
@model ArticleRemark

```
"RMK"                    - ART_REMARK / Article remark (text)
ClientID        [N]
ItemID**        [N 8]
EAN_Code**      [C 13]
LineNr          [N 3]
RemarkLine      [C 120]
```

# Track data
@model ArticleTrack

```
"TRK"                    - ART_TRACK / Article track data
ClientID        [N]
ItemID**        [N 8]
EAN_Code**      [C 13]
Unique_ATID#    [C 15]   - may be used as a link link to another track database
DiscNumber      [N 3]
TrackNumber     [N 3]
TrackArtist#    [C 80]
TrackTitle      [C 80]
TrackComposer#  [C 45]
TrackConductor# [C 45]
TrackOrchestra# [C 45]
TrackDirector#  [C 45]
SoundLink_WMA#  [C 64]
Track_PlayTime# [C 5]    - time format: MMMss
```

# Article removals
@model ArticleRemoval

```
"RMV"                    - ART_REMOVED / Removed article
ClientID        [N]
ItemID**        [N 8]
EAN_Code**      [C 13]
```

# Product Stock price updates
@model StockUpdate

```
"SPI"                    - STOCK_PRICE / Article price + stock information *1)
ClientID        [N]
ItemID**        [N 8]
EAN_Code**      [C 13]
BranchID#       [C 4]
Price_XS1#      [N 9.2]  - Price 1 (excl. VAT) / only used with DeltaFlex
Price_XS2#      [N 9.2]  - Price 2 (excl. VAT) / only used with DeltaFlex
Price_XS3#      [N 9.2]  - Price 3 (excl. VAT) / only used with DeltaFlex
Price_XS4#      [N 9.2]  - Price 4 (excl. VAT) / only used with DeltaFlex
Price_XS5#      [N 9.2]  - Price 5 (excl. VAT) / only used with DeltaFlex
Price_MLO#      [N 9.2]  - Mail order price (incl. VAT)
Price_MLW#      [N 9.2]  - Mail order price (excl. VAT)
FillRate#       [N 3]    - percentage between 1 and 100, 0 means unknown, 999 means coded DT
DeliveryTime#   [N 3]    - number of days, 0 means unknown (coded if FR equal 999)
CurrentStockID  [C 4]    - coded stock level, e.g. Y / N (or >1 / >5 / >99)
ArticleStatus   [C 3]    - DEL = deleted, NRM = normal, EXP = expected, SPO = offer
ArticleRating   [C 30]   - max. 6 rating blocks, formatted as “Xnnnn”. Colon separated.
Price_Code#     [C 6]    - Price Code / only used with DeltaFlex
```

# Article support file
@model ArticleSupport

```
"CVT"                    - ARTICLE SUPPORT FILE
ClientID        [N]
SupportType     [C 3]    - GRP: Group, GNR: Genre, FOR: Format
SupportID       [N 4]    - GroupID / GenreID / FormatID
Short_Code      [C 8]
Description#    [C 25]
```

# Customer invoiced articles
@model CustomerInvoicedArticles

```
"INV"                    - CUSTOMER INVOICED ARTICLES
ClientID        [N]
CustomerID      [C 10]
ItemID          [N 8]
EAN_Code        [C 13]
InvoiceDate     [D]
InvoiceNumber   [C 10]
Invoiced_QTY    [N 6]
InvoicePrice    [N 9.2]
OrderLine_Ref   [C 10]
Unique_OLID     [C 14]
```


# Customer backorders
@model CustomerBackOrders

```
"CBO"                    - CUSTOMER BACKORDERS
ClientID        [N]
CustomerID      [C 10]
OrderNr         [C 20]
ItemID          [N 8]
EAN_Code        [C 13]
OrderDate       [D]
Open_QTY        [N 6]
Reserved_QTY    [N 6]
OrderPrice      [N 9.2]
OrderLine_Ref   [C 10]
Unique_OLID     [C 14]
```

# Deleted customer backorders
@model DeletedCustomerBackOrders

```
"DBO"                    - DELETED CUSTOMER BACKORDERS
ClientID        [N]
CustomerID      [C 10]
OrderNr         [C 20]
ItemID          [N 8]
EAN_Code        [C 13]
DeletionDate    [D]
Deleted_QTY     [N 6]
OrderPrice      [N 9.2]
OrderLine_Ref   [C 10]
Unique_OLID     [C 14]
Reason          [C 14]
```

# Customer backorders (legacy trigger variant)
@model CustomerBackOrders

```
"BPO"                    - CUSTOMER BACKORDERS (legacy trigger)
ClientID        [N]
CustomerID      [C 10]
OrderNr         [C 20]
ItemID          [N 8]
EAN_Code        [C 13]
OrderDate       [D]
Open_QTY        [N 6]
Reserved_QTY    [N 6]
OrderPrice      [N 9.2]
OrderLine_Ref   [C 10]
Unique_OLID     [C 14]
```

# Supplier data
@model Supplier

```
"SPL"                    - SUPPLIER
ClientID        [N]
SupplierID*     [C 10]
SupplierCode    [C 15]
Name_1          [C 45]
Name_2#         [C 45]
Street          [C 45]
ZIP_Code        [C 15]
City            [C 45]
CountryID       [C 2]
PhoneNumber#    [C 25]
FaxNumber#      [C 25]
email_addr#     [C 80]
VAT_Code#       [C 14]
Currency        [C 3]
Payment_Terms   [C 3]
Status          [C 3]
```

# Customer
@model Customer

```
"CST"                    - CUSTOMER
ClientID        [N]
CustomerID*     [C 10]
CustomerCode    [C 15]
Use_ALT_ADDR    [N]
Name_1          [C 45]
Name_2#         [C 45]
Street          [C 45]
ZIP_Code        [C 15]
City            [C 45]
CountryID       [C 2]
PhoneNumber#    [C 25]
FaxNumber#      [C 25]
email_addr#     [C 80]
WebPassword#    [C 15]
VAT_Number#     [C 14]
Price_Type      [C 1]
Currency        [C 3]
Payment_Terms   [C 3]
Status          [C 3]
Restriction#    [C 4]
```

# Customer address
@model CustomerAddress

```
"ADR"                    - ALT_ADDR / Alternate customer address
ClientID        [N]
CustomerID*     [C 10]
Name_1          [C 45]
Name_2#         [C 45]
Street          [C 45]
ZIP_Code        [C 15]
City            [C 45]
CountryID       [C 2]
email_addr#     [C 80]
```

# Extended customer data
@model CustomerExtendedData

```
"XCD"                    - EXT_CUST / Extended customer data
ClientID         [N]
CustomerID*      [C 10]
SalesRepCode#    [C 4]
DebNumber#       [C 6]
TransData_1#     [C 40]
TransData_2#     [C 40]
BackOrd_Days#    [N]
GenDiscount#     [N 6.2]
On_Hold          [N]
Check_Status     [N]
Remark_1#        [C 80]
Remark_2#        [C 80]
Remark_3#        [C 80]
Remark_4#        [C 80]
Remark_5#        [C 80]
```

# End of file marker
@model EOF

```
"EOF"                    - end of file string, last line of file
ClientID         [N]
Number_of_lines  [N]     - excluding current line
```

<!-- end of schema -->
