<?xml version="1.0" encoding="utf-8"?>
<Entity 
Schema="AKUZ" 
Name="PAID_SERVICE_CONTRACT" 
Description="Договор на оказание платных услуг" 
Inherits="AKUZ.CONTRACT">
  <Fields>
    <Parent Name="CostCategory" Type="AKUZ.COST_CATEGORY" Description="Справочник категорий цен" />
    <Child Name="EventServices" Type="AKUZ.EVENT_SERVICE" Description="Услуги по случаю обращения" ChildAttribute="Contract" />
    <Child Name="ContractMedicalServices" Type="AKUZ.CONTRACT_SERVICE" Description="Услуги по договору" ChildAttribute="Contract" />
    <Parent Name="ContractTemplate" Type="AKUZ.CONTRACT_TEMPLATE" Description="Шаблон договора" />
    <Child Name="ContractFiles" Type="AKUZ.CONTRACT_FILE" Description="Файл договора" ChildAttribute="Contract" />
  </Fields>
  <DbMapping>
    <Table name="T_PAID_SERVICE_CONTRACT">
      <Map Name="CostCategory" Column="CostCategory" />
      <Map Name="ContractTemplate" Column="ContractTemplate" />
      <Map Name="DiscountSize" Column="DiscountSize" />
    </Table>
  </DbMapping>
  <CalculatingAttributes>
    <Attribute Name="TotalCost" Type="float" DefaultFormat="{0:N}" Description="Итоговая стоимость по договору" RequiredAttributes="{EventServices/Cost};{EventServices/ServiceCount};{EventServices/Coefficient}" />
    <Attribute Name="TotalCostStr" Type="string" Description="Итоговая стоимость по договору (строка)" RequiredAttributes="{TotalCost}" />
    <Attribute Name="DiscountSize" Type="float" Description="Сумма скидки по договору" RequiredAttributes="{EventServices/Coefficient};{EventServices/Cost};{EventServices/ServiceCount}" />
    <Child Name="ContractTemplateFiles" Type="AKUZ.CONTRACT_TEMPLATE_FILE" Description="Файл шаблона договора" RequiredAttributes="{ContractTemplate/ContractTemplateFiles/MedicalServiceContractTemplates/MedicalService};{EventServices/MedicalService};{ContractTemplate/ContractTemplateFiles/Priority}" PathAttributes="{ContractTemplate/ContractTemplateFiles}" />
  </CalculatingAttributes>
</Entity>