INSERT INTO
    VCLib.T_OBJECT_MODIFICATION_ACTION (ObjectModificationActionID,
                                                     Entities,
                                                     Position,
                                                     type_,
                                                     Active,
                                                     Name,
                                                     Instruction,
                                                     InstructionType)
VALUES
    ('F95424E6-67FB-4494-9C88-ECDDDDA129EA', 504, 1, 203, false, 'CreatePatientBenefitsDirectionAfterPatientEditing', 'begin(p, process, num)
    @p:={.};

    @process := new Process("FillRegionalBenefitsDirectionFromPatient");
    @process->{Object} := @p;
    @num := @process->Run()[@process];
end;', 1);

INSERT INTO
    VCLib.T_SINGLE_MODIFICATION_ACTION (ObjectModificationActionID,
                                                     InsertFilter,
                                                     UpdateFilter,
                                                     DeleteFilter,
                                                     EditType)
VALUES
    ('F95424E6-67FB-4494-9C88-ECDDDDA129EA', NULL, '<lx:CriterionChildExists xmlns:lx="lexem">
        <condition>
            <lx:Criteria type="And">
                <lx:Criterion type="=">
                    <lx:Path OwnerQueryLevel="0">
                        <lx:StepString name="CreateType" />
                    </lx:Path>
                    <lx:ChoiceOperand Entity="AKUZ.PATIENT_BENEFITS" AttributeName="CreateType" type="Int32" PrimaryKey="2" />
                </lx:Criterion>
                <lx:Criteria type="Or">
                    <lx:Criterion type="=">
                        <lx:Path OwnerQueryLevel="0">
                            <lx:StepString name="Benefits" />
                            <lx:StepString name="BenefitViews" />
                        </lx:Path>
                        <lx:EnumOperand EnumType="BenefitViews" type="Int32" PrimaryKey="19002">
                            <Name><![CDATA[Региональная по контингенту]]></Name>
                        </lx:EnumOperand>
                    </lx:Criterion>
                    <lx:Criterion type="=">
                        <lx:Path OwnerQueryLevel="0">
                            <lx:StepString name="Benefits" />
                            <lx:StepString name="BenefitViews" />
                        </lx:Path>
                        <lx:EnumOperand EnumType="BenefitViews" type="Int32" PrimaryKey="19003">
                            <Name><![CDATA[Региональная по заболеванию]]></Name>
                        </lx:EnumOperand>
                    </lx:Criterion>
                </lx:Criteria>
                <lx:Criteria type="Or">
                    <lx:Criterion type="&lt;=">
                        <lx:Path OwnerQueryLevel="0">
                            <lx:StepString name="BeginDate" />
                        </lx:Path>
                        <lx:ParamHolder>
                            <lx:StepString name="CURRENT_DATE" />
                        </lx:ParamHolder>
                    </lx:Criterion>
                    <lx:Criterion type="=">
                        <lx:Path OwnerQueryLevel="0">
                            <lx:StepString name="BeginDate" />
                        </lx:Path>
                        <lx:Null />
                    </lx:Criterion>
                </lx:Criteria>
            </lx:Criteria>
        </condition>
        <lx:Path OwnerQueryLevel="0">
            <lx:StepString name="PatientBenefitss" />
        </lx:Path>
    </lx:CriterionChildExists>', NULL, 4);

