<?xml version="1.0" encoding="utf-8"?>
<Entity 
Schema="STOR" 
Name="INVENTORY_ELEMENTS" 
Description="Элемент инвентаризации" 
PrimaryKey="InventoryElementsID" 
DNAttributes="{BillOfGoods/CDisplayName}" 
DisplayName="{0}">
  <Fields>
    <Attribute Name="InventoryElementsID" Index="19310001" Type="guid" Description="Идентификатор" />
    <Attribute Name="AccountingNumber" Index="19310004" Type="float" DefaultFormat="{0:0.#####}" Description="Учетное количество(списание)" NumericPrecision="20" NumericScale="6" Required="1" />
    <Attribute Name="AccountingNumberPrice" Type="float" DefaultFormat="{0:0.#####}" Description="Учетное количество" NumericPrecision="20" NumericScale="6" Required="1" />
    <Attribute Name="ActualAmount" Index="19310005" Type="float" DefaultFormat="{0:0.#####}" Description="Фактическое количество" NumericPrecision="20" NumericScale="6" Required="1" />
    <Attribute Name="LotNumber" Index="19310008" Type="int" Description="Партия" />
    <Attribute Name="Series" Index="19310009" Type="string" Description="Серия" CharacterMaximumLength="100" />
    <Attribute Name="Price" Index="19310010" Type="float" DefaultFormat="{0:F2}" Description="Цена" NumericPrecision="12" NumericScale="2" />
    <Parent Name="InventoryDocument" Index="19310002" Type="STOR.INVENTORY_DOCUMENT" Description="Документ инвентаризации" Required="1" />
    <Parent Name="PackageType" Index="19310016" Type="PHARM.PACKAGE_TYPE" Description="Вид упаковки(списание)" />
    <Parent Name="SupplierContract" Index="19310017" Type="STOR.SUPPLIER_CONTRACT" Description="Договор от поставщика" />
    <Parent Name="MedicamentProducer" Index="19310018" Type="PHARM.MEDICAMENT_PRODUCER" Description="Производитель торгового наименования" />
    <Parent Name="BillOfGoods" Index="19310019" Type="PHARM.BILL_OF_GOODS" Description="Номенклатура товаров" />
    <Attribute Name="ExpirationDate" Index="19310020" Type="date" Description="Срок годности" />
    <Attribute Name="GTINSerialNumber" Index="19310021" Type="string" Description="GTIN/серийный номер" CharacterMaximumLength="28" />
    <Parent Name="PaymentType" Type="STOR.PAYMENT_TYPE" Description="Источник финансирования" />
    <Parent Name="SupplierContractAbr" Type="STOR.SUPPLIER_CONTRACT_ABR" Description="Аббревиатура договора" CharacterMaximumLength="20" />
    <Parent Name="PackageTypePrice" Type="PHARM.PACKAGE_TYPE" Description="Вид упаковки(покупки)" />
    <Child Name="InventoryElementsRemainss" Type="STOR.INVENTORY_ELEMENTS_REMAINS" Description="Связь остатков и элементов инвентаризации" ChildAttribute="InventoryElements" />
    <Attribute Name="Sum" Index="19310015" Type="float" DefaultFormat="{0:F2}" Description="Стоимость" NumericPrecision="12" NumericScale="2" RequiredAttributes="{Remains};{ActualAmount};{Remains / cUnitPrice / PackageType}; {PackageType} ; {Price};{Remains / PackageCoefficient}" />
    <Choice Name="CreateType" Description="Тип создания" Required="1">
      <Item Name="Из остатка" Index="0" />
      <Item Name="Вручную" Index="1" />
    </Choice>
    <Choice Name="VAT" Description="НДС">
      <Item Name="Без НДС" Index="0" />
      <Item Name="10%" Index="1" />
      <Item Name="18%" Index="2" />
      <Item Name="20%" Index="3" />
      <Item Name="5%" Index="4" />
      <Item Name="7%" Index="5" />
      <Item Name="22%" Index="6" />
    </Choice>
    <Child Name="ScannedInventoryElementss" Type="STOR.SCANNED_INVENTORY_ELEMENTS" Description="Отсканированные элементы инвентаризации" ChildAttribute="InventoryElements" />
  </Fields>
  <DbMapping>
    <Table name="T_INVENTORY_ELEMENTS">
      <Map Name="InventoryElementsID" Column="InventoryElementsID" />
      <Map Name="AccountingNumber" Column="AccountingNumber" />
      <Map Name="AccountingNumberPrice" Column="AccountingNumberPrice" />
      <Map Name="ActualAmount" Column="ActualAmount" />
      <Map Name="LotNumber" Column="LotNumber" />
      <Map Name="Series" Column="Series" />
      <Map Name="Price" Column="Price" />
      <Map Name="InventoryDocument" Column="InventoryDocument" />
      <Map Name="PackageType" Column="PackageType" />
      <Map Name="SupplierContract" Column="SupplierContract" />
      <Map Name="BillOfGoods" Column="BillOfGoods" />
      <Map Name="ExpirationDate" Column="ExpirationDate" />
      <Map Name="GTINSerialNumber" Column="GTINSerialNumber" />
      <Map Name="PaymentType" Column="PaymentType" />
      <Map Name="SupplierContractAbr" Column="SupplierContractAbr" />
      <Map Name="PackageTypePrice" Column="PackageTypePrice" />
      <Map Name="CreateType" Column="CreateType" />
      <Map Name="VAT" Column="VAT" />
    </Table>
    <Lexem>
      <Map Name="MedicamentProducer">
        <lx:Path OwnerQueryLevel="0" xmlns:lx="lexem">
          <lx:StepString name="SupplierContract" />
          <lx:StepString name="GoodsSupplier" />
        </lx:Path>
      </Map>
      <Map Name="Sum">
        <lx:MathOperator sign="*" xmlns:lx="lexem">
          <lx:Path OwnerQueryLevel="0">
            <lx:StepString name="ActualAmount" />
          </lx:Path>
          <lx:Path OwnerQueryLevel="0">
            <lx:StepString name="Price" />
          </lx:Path>
        </lx:MathOperator>
      </Map>
    </Lexem>
  </DbMapping>
</Entity>