{
  "header": {
    "id": "Receiptlist_Receipt_CDM",
    "modelType": "document",
    "modelVersion": "28.3.0",
    "locales": [
      {
        "code": "en"
      }
    ],
    "labels": [],
    "annotations": [
      {
        "name": "cdm.queryRoot",
        "value": "Receiptlist_DM"
      },
      {
        "name": "roles",
        "value": "admin,system,client"
      }
    ],
    "modelReferences": [
      {
        "alias": "CostTypes_TDM",
        "modelType": "document",
        "purpose": "typeDefinitions",
        "reference": "CostTypes_TDM"
      },
      {
        "alias": "Receiptlist_TDM",
        "modelType": "document",
        "purpose": "typeDefinitions",
        "reference": "Receiptlist_TDM"
      },
      {
        "alias": "Receipt_DM",
        "modelType": "document",
        "purpose": "include",
        "reference": "Receipt_DM"
      },
      {
        "alias": "Receiptlist_DM",
        "modelType": "document",
        "purpose": "include",
        "reference": "Receiptlist_DM"
      }
    ]
  },
  "content": {
    "modelInfo": {
      "name": "Receiptlist_Receipt_CDM"
    },
    "modelConfig": {
      "timeZone": "UTC",
      "decimalSeparator": ".",
      "conditionLanguage": {
        "code": "en_US"
      }
    },
    "modelRoot": {
      "rootGroups": [
        {
          "type": "Group",
          "id": "group_700d9",
          "name": "ReceiptlistReceipt",
          "annotations": [
            {
              "name": "cdm.relationship",
              "value": "ReceiptlistReceipt"
            },
            {
              "name": "cdm.sourceRole",
              "value": "Receiptlist"
            },
            {
              "name": "cdm.targetRole",
              "value": "Receipt"
            },
            {
              "name": "cdm.targetDocumentModel",
              "value": "Receipt_DM"
            }
          ],
          "Group": {
            "repeatability": 10000,
            "elements": [
              {
                "type": "Group",
                "id": "include_5dc2d",
                "name": "Receipt",
                "Group": {
                  "repeatability": 1,
                  "modelAlias": "Receipt_DM"
                }
              },
              {
                "type": "Rule",
                "id": "rule_a503d",
                "name": "Rule_CostTypeInReceiptlist",
                "internalDescription": [
                  {
                    "locale": "en",
                    "text": "Does not fire!"
                  }
                ],
                "Rule": {
                  "errorEntityRelPath": "../Receipt/CostType",
                  "errorCode": "Error rule_a503d",
                  "errorCondition": "FieldFilled(Receipt/CostType) and NoFieldValueIncludedInValueList(Receipt/CostType in /Receiptlist/ApprovedCostTypes*/CostType)",
                  "severity": "ERROR",
                  "errorMessage": [
                    {
                      "locale": "en",
                      "text": "Receipts can only have cost types that are entered in the receiptlist"
                    }
                  ]
                }
              },
              {
                "type": "Rule",
                "id": "rule_bfbe9",
                "name": "Rule_ReceiptNumberUnique",
                "internalDescription": [
                  {
                    "locale": "en",
                    "text": "Does not fire!"
                  }
                ],
                "Rule": {
                  "errorEntityRelPath": "../Receipt/ReceiptNumber",
                  "errorCode": "Error rule_bfbe9",
                  "errorCondition": "FieldValuesNotUnique(/ReceiptlistReceipt*/Receipt/ReceiptNumber)",
                  "severity": "ERROR",
                  "errorMessage": [
                    {
                      "locale": "en",
                      "text": "Receipt number is not unique."
                    }
                  ]
                }
              },
              {
                "type": "Field",
                "id": "field_44496",
                "name": "CostTypeNotInReceiptList",
                "Field": {
                  "fieldType": {
                    "type": "ConfirmType"
                  },
                  "global": true,
                  "transient": true
                }
              },
              {
                "type": "Rule",
                "id": "rule_d9eb5",
                "name": "Rule_CostTypeNotInReceiptList",
                "Rule": {
                  "errorEntityRelPath": "../Receipt/CostType",
                  "errorCode": "Error rule_d9eb5",
                  "errorCondition": "FieldFilled(Receipt/CostType) and FieldFilled(CostTypeNotInReceiptList)",
                  "severity": "ERROR",
                  "errorMessage": [
                    {
                      "locale": "en",
                      "text": "Cost type not in receiptlist"
                    }
                  ]
                }
              },
              {
                "type": "Computation",
                "id": "computation_05c6d",
                "name": "CostTypeNotInReceiptList_Comp",
                "Computation": {
                  "computedFieldRelPath": "../CostTypeNotInReceiptList",
                  "computationAlternatives": [
                    {
                      "operation": "True",
                      "precondition": "NoFieldValueIncludedInValueList(Receipt/CostType in /Receiptlist/ApprovedCostTypes*/CostType)"
                    }
                  ],
                  "errorMessage": [
                    {
                      "locale": "en",
                      "text": "error text for computation of CostTypeNotInReceiptList_Comp"
                    }
                  ]
                }
              },
              {
                "type": "Field",
                "id": "field_2bb85",
                "name": "ReceiptNumberNotUnique",
                "Field": {
                  "fieldType": {
                    "type": "ConfirmType"
                  },
                  "global": true,
                  "transient": true
                }
              },
              {
                "type": "Rule",
                "id": "rule_5750b",
                "name": "Rule_ReceiptNumberNotUnique",
                "Rule": {
                  "errorEntityRelPath": "../Receipt/ReceiptNumber",
                  "errorCode": "Error rule_5750b",
                  "errorCondition": "FieldFilled(Receipt/ReceiptNumber) and FieldFilled(ReceiptNumberNotUnique)",
                  "severity": "ERROR",
                  "errorMessage": [
                    {
                      "locale": "en",
                      "text": "Receipt number must be unique"
                    }
                  ]
                }
              },
              {
                "type": "Computation",
                "id": "computation_805be",
                "name": "ReceiptNumberNotUnique_Comp",
                "Computation": {
                  "computedFieldRelPath": "../ReceiptNumberNotUnique",
                  "computationAlternatives": [
                    {
                      "operation": "True",
                      "precondition": "FieldValuesNotUnique(/ReceiptlistReceipt*/Receipt/ReceiptNumber)"
                    }
                  ],
                  "errorMessage": [
                    {
                      "locale": "en",
                      "text": "error text for computation of ReceiptNumberNotUnique_Comp"
                    }
                  ]
                }
              }
            ]
          }
        },
        {
          "type": "Group",
          "id": "group_9dc4f",
          "name": "Receiptlist_Receipt_Fields",
          "Group": {
            "repeatability": 1,
            "elements": [
              {
                "type": "Field",
                "id": "field_d0338",
                "name": "SumReceipts",
                "Field": {
                  "fieldType": {
                    "type": "TypeDefType",
                    "TypeDefType": {
                      "typeDefinitionId": "typedef_81e9cdd0-72e2-4d09-abd2-705798b50c9f"
                    }
                  },
                  "label": [
                    {
                      "locale": "en",
                      "text": "Sum of Receipts"
                    }
                  ]
                }
              },
              {
                "type": "Computation",
                "id": "computation_ea3a8",
                "name": "SumReceipts_Comp",
                "Computation": {
                  "computedFieldRelPath": "../SumReceipts",
                  "computationAlternatives": [
                    {
                      "operation": "Sum(/ReceiptlistReceipt*/Receipt/Amount)"
                    }
                  ],
                  "errorMessage": [
                    {
                      "locale": "en",
                      "text": "error text for computation of SumReceipts_Comp"
                    }
                  ]
                }
              }
            ]
          }
        },
        {
          "type": "Group",
          "id": "include_3635b",
          "name": "Receiptlist",
          "Group": {
            "repeatability": 1,
            "modelAlias": "Receiptlist_DM"
          }
        }
      ]
    }
  }
}