Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task0002 #9

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,126 @@
<textEdit>true</textEdit>
</extInfo>
</items>
<items xsi:type="form:FormGroup">
<name>ГруппаСкидка</name>
<id>171</id>
<items xsi:type="form:FormField">
<name>СогласованнаяСкидка</name>
<id>166</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<dataPath xsi:type="form:DataPath">
<segments>Объект.СогласованнаяСкидка</segments>
</dataPath>
<handlers>
<event>OnChange</event>
<name>СогласованнаяСкидкаПриИзменении</name>
</handlers>
<extendedTooltip>
<name>СогласованнаяСкидкаРасширеннаяПодсказка</name>
<id>168</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<type>Label</type>
<autoMaxWidth>true</autoMaxWidth>
<autoMaxHeight>true</autoMaxHeight>
<extInfo xsi:type="form:LabelDecorationExtInfo">
<horizontalAlign>Left</horizontalAlign>
</extInfo>
</extendedTooltip>
<contextMenu>
<name>СогласованнаяСкидкаКонтекстноеМеню</name>
<id>167</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<autoFill>true</autoFill>
</contextMenu>
<type>InputField</type>
<editMode>Enter</editMode>
<showInHeader>true</showInHeader>
<headerHorizontalAlign>Left</headerHorizontalAlign>
<showInFooter>true</showInFooter>
<extInfo xsi:type="form:InputFieldExtInfo">
<autoMaxWidth>true</autoMaxWidth>
<autoMaxHeight>true</autoMaxHeight>
<wrap>true</wrap>
<chooseType>true</chooseType>
<typeDomainEnabled>true</typeDomainEnabled>
<textEdit>true</textEdit>
</extInfo>
</items>
<items xsi:type="form:Button">
<name>ПересчитатьТаблицу</name>
<id>169</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<extendedTooltip>
<name>ПересчитатьТаблицуРасширеннаяПодсказка</name>
<id>170</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<type>Label</type>
<autoMaxWidth>true</autoMaxWidth>
<autoMaxHeight>true</autoMaxHeight>
<extInfo xsi:type="form:LabelDecorationExtInfo">
<horizontalAlign>Left</horizontalAlign>
</extInfo>
</extendedTooltip>
<type>UsualButton</type>
<commandName>Form.Command.ПересчитатьТаблицу</commandName>
<representation>Auto</representation>
<autoMaxWidth>true</autoMaxWidth>
<autoMaxHeight>true</autoMaxHeight>
<placementArea>UserCmds</placementArea>
<representationInContextMenu>Auto</representationInContextMenu>
</items>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<extendedTooltip>
<name>ГруппаСкидкаРасширеннаяПодсказка</name>
<id>172</id>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
<common>true</common>
</userVisible>
<type>Label</type>
<autoMaxWidth>true</autoMaxWidth>
<autoMaxHeight>true</autoMaxHeight>
<extInfo xsi:type="form:LabelDecorationExtInfo">
<horizontalAlign>Left</horizontalAlign>
</extInfo>
</extendedTooltip>
<type>UsualGroup</type>
<extInfo xsi:type="form:UsualGroupExtInfo">
<group>HorizontalIfPossible</group>
<behavior>Auto</behavior>
<representation>WeakSeparation</representation>
<showLeftMargin>true</showLeftMargin>
<united>true</united>
<showTitle>true</showTitle>
<throughAlign>Auto</throughAlign>
<currentRowUse>Auto</currentRowUse>
</extInfo>
</items>
<visible>true</visible>
<enabled>true</enabled>
<userVisible>
Expand Down Expand Up @@ -1878,6 +1998,23 @@
<main>true</main>
<savedData>true</savedData>
</attributes>
<formCommands>
<name>ПересчитатьТаблицу</name>
<title>
<key>ru</key>
<value>Пересчитать таблицу</value>
</title>
<id>1</id>
<use>
<common>true</common>
</use>
<action xsi:type="form:FormCommandHandlerContainer">
<handler>
<name>ПересчитатьТаблицу</name>
</handler>
</action>
<currentRowUse>Auto</currentRowUse>
</formCommands>
<commandInterface>
<navigationPanel/>
<commandBar/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,41 @@

КонецПроцедуры

// {{Борисова А.В.
&НаКлиенте
Процедура ПересчитатьТаблицу(Команда)
РассчитатьСтоимостьСУчетомСкидки();
РассчитатьСуммуДокумента();
КонецПроцедуры

&НаКлиенте
Асинх Процедура СогласованнаяСкидкаПриИзменении(Элемент)
Режим = РежимДиалогаВопрос.ДаНет;
Ответ = Ждать ВопросАсинх("Пересчитать таблицу?",Режим, 0);

Если Ответ = КодВозвратаДиалога.Да Тогда
РассчитатьСтоимостьСУчетомСкидки();
РассчитатьСуммуДокумента();
Иначе
Возврат;
КонецЕсли;
КонецПроцедуры

&НаКлиенте
Процедура РассчитатьСтоимостьСУчетомСкидки()
ТаблицаТоваров = Объект.Товары;
ТаблицаУслуги = Объект.Услуги;

Для Каждого Строка из ТаблицаТоваров Цикл
Строка.Сумма = Строка.Цена*(100 - Объект.СогласованнаяСкидка)/100 * Строка.Количество;
КонецЦикла;

Для Каждого Строка из ТаблицаУслуги Цикл
Строка.Сумма = Строка.Цена*(100 - Объект.СогласованнаяСкидка)/100 * Строка.Количество;
КонецЦикла;
КонецПроцедуры
//Борисова А.В.}}

&НаКлиенте
Процедура ПриОткрытии(Отказ)

Expand Down Expand Up @@ -112,8 +147,13 @@
&НаКлиенте
Процедура РассчитатьСуммуСтроки(ТекущиеДанные)

КоэффициентСкидки = 1 - ТекущиеДанные.Скидка / 100;
ТекущиеДанные.Сумма = ТекущиеДанные.Цена * ТекущиеДанные.Количество * КоэффициентСкидки;
//КоэффициентСкидки = 1 - ТекущиеДанные.Скидка / 100;
//ТекущиеДанные.Сумма = ТекущиеДанные.Цена * ТекущиеДанные.Количество * КоэффициентСкидки;

// {{Борисова А.В.
ТекущиеДанные.Сумма = ТекущиеДанные.Цена *(100 - Объект.СогласованнаяСкидка)/100 * ТекущиеДанные.Количество;
РассчитатьСуммуДокумента();
//Борисова А.В.}}

КонецПроцедуры

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,27 @@
<fullTextSearch>Use</fullTextSearch>
<dataHistory>Use</dataHistory>
</attributes>
<attributes uuid="640be891-3666-4748-b2ff-0d7e320ac1c5">
<name>СогласованнаяСкидка</name>
<synonym>
<key>ru</key>
<value>Согласованная скидка</value>
</synonym>
<type>
<types>Number</types>
<numberQualifiers>
<precision>5</precision>
<scale>2</scale>
</numberQualifiers>
</type>
<minValue xsi:type="core:UndefinedValue"/>
<maxValue xsi:type="core:StringValue">
<value>100</value>
</maxValue>
<fillValue xsi:type="core:UndefinedValue"/>
<fullTextSearch>Use</fullTextSearch>
<dataHistory>Use</dataHistory>
</attributes>
<forms uuid="d2984117-1a5a-45ca-bc97-adb070bd946d">
<name>ФормаДокумента</name>
<synonym>
Expand Down