Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
synergy-components
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
synergy-components
Commits
fb7cbade
Commit
fb7cbade
authored
Mar 28, 2018
by
Sergey Antonovich
🇯🇵
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
number-to-string.conf
parent
d643fa2d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
123 additions
and
0 deletions
+123
-0
form-cmp/number-to-string.conf.xml
form-cmp/number-to-string.conf.xml
+123
-0
No files found.
form-cmp/number-to-string.conf.xml
0 → 100644
View file @
fb7cbade
<?xml version="1.0" encoding="utf-8"?>
<configuration
version=
"1"
date=
"2018-03-28 14:26:52"
synergyVersion=
"3.15"
>
<objects
version=
"1"
date=
"2018-03-28 14:26:52"
synergyVersion=
"3.15"
>
<customComponent
code=
"number_to_string"
name=
"Числа прописью"
use_in_forms=
"true"
>
<javascript>
function numberToText(c) {
function k(b, c) {
var d = c[0], e = c[1], f = c[2];
return b % 10 == 1
&&
b % 100 != 11 ? d : b % 10
>
= 2
&&
b % 10
<
= 4
&&
(b % 100
<
10 || b % 100
>
= 20) ? e : f
}
for (var d = {
0: {
1: "\u043e\u0434\u0438\u043d",
2: "\u0434\u0432\u0430",
3: "\u0442\u0440\u0438",
4: "\u0447\u0435\u0442\u044b\u0440\u0435",
5: "\u043f\u044f\u0442\u044c",
6: "\u0448\u0435\u0441\u0442\u044c",
7: "\u0441\u0435\u043c\u044c",
8: "\u0432\u043e\u0441\u0435\u043c\u044c",
9: "\u0434\u0435\u0432\u044f\u0442\u044c",
10: "\u0434\u0435\u0441\u044f\u0442\u044c",
11: "\u043e\u0434\u0438\u043d\u043d\u0430\u0434\u0446\u0430\u0442\u044c",
12: "\u0434\u0432\u0435\u043d\u0430\u0434\u0446\u0430\u0442\u044c",
13: "\u0442\u0440\u0438\u043d\u0430\u0434\u0446\u0430\u0442\u044c",
14: "\u0447\u0435\u0442\u044b\u0440\u043d\u0430\u0434\u0446\u0430\u0442\u044c",
15: "\u043f\u044f\u0442\u043d\u0430\u0446\u0430\u0442\u044c",
16: "\u0448\u0435\u0441\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u044c",
17: "\u0441\u0435\u043c\u043d\u0430\u0434\u0446\u0430\u0442\u044c",
18: "\u0432\u043e\u0441\u0435\u043c\u043d\u0430\u0434\u0446\u0430\u0442\u044c",
19: "\u0434\u0435\u0432\u044f\u0442\u043d\u0430\u0434\u0446\u0430\u0442\u044c",
20: "\u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044c",
30: "\u0442\u0440\u0438\u0434\u0446\u0430\u0442\u044c",
40: "\u0441\u043e\u0440\u043e\u043a",
50: "\u043f\u044f\u0442\u044c\u0434\u0435\u0441\u044f\u0442",
60: "\u0448\u0435\u0441\u0442\u044c\u0434\u0435\u0441\u044f\u0442",
70: "\u0441\u0435\u043c\u044c\u0434\u0435\u0441\u044f\u0442",
80: "\u0432\u043e\u0441\u0435\u043c\u044c\u0434\u0435\u0441\u044f\u0442",
90: "\u0434\u0435\u0432\u044f\u043d\u043e\u0441\u0442\u043e",
100: "\u0441\u0442\u043e",
200: "\u0434\u0432\u0435\u0441\u0442\u0438",
300: "\u0442\u0440\u0438\u0441\u0442\u0430",
400: "\u0447\u0435\u0442\u044b\u0440\u0435\u0441\u0442\u0430",
500: "\u043f\u044f\u0442\u044c\u0441\u043e\u0442",
600: "\u0448\u0435\u0441\u0442\u044c\u0441\u043e\u0442",
700: "\u0441\u0435\u043c\u044c\u0441\u043e\u0442",
800: "\u0432\u043e\u0441\u0435\u043c\u044c\u0441\u043e\u0442",
900: "\u0434\u0435\u0432\u044f\u0442\u044c\u0441\u043e\u0442"
}, 1: {1: "\u043e\u0434\u043d\u0430", 2: "\u0434\u0432\u0435"}
}, i = {
0: ["", "", ""],
1: ["\u0442\u044b\u0441\u044f\u0447\u0430", "\u0442\u044b\u0441\u044f\u0447\u0438", "\u0442\u044b\u0441\u044f\u0447"],
2: ["\u043c\u0438\u043b\u043b\u0438\u043e\u043d", "\u043c\u0438\u043b\u043b\u0438\u043e\u043d\u0430", "\u043c\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432"],
3: ["\u043c\u0438\u043b\u043b\u0438\u0430\u0440\u0434", "\u043c\u0438\u043b\u043b\u0438\u0430\u0440\u0434\u0430", "\u043c\u0438\u043b\u043b\u0438\u0430\u0440\u0434\u043e\u0432"],
4: ["\u0442\u0440\u0438\u043b\u043b\u0438\u043e\u043d", "\u0442\u0440\u0438\u043b\u043b\u0438\u043e\u043d\u0430", "\u0442\u0440\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432"],
5: ["\u043a\u0432\u0430\u0434\u0440\u0438\u043b\u043b\u0438\u043e\u043d", "\u043a\u0432\u0430\u0434\u0440\u0438\u043b\u043b\u0438\u043e\u043d\u0430", "\u043a\u0432\u0430\u0434\u0440\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432"],
6: ["\u043a\u0432\u0438\u043d\u0442\u0438\u043b\u043b\u0438\u043e\u043d", "\u043a\u0432\u0438\u043d\u0442\u0438\u043b\u043b\u0438\u043e\u043d\u0430", "\u043a\u0432\u0438\u043d\u0442\u0438\u043b\u043b\u0438\u043e\u043d\u043e\u0432"]
}, h = "", j = (("" + c).match(/(\d{1,3})(?=((\d{3})*([^\d]|$)))/g) || []).reverse(), e = 0; e
<
j.length; e++) {
for (var f = d[e], c = j[e], b = "", g = 0; g
<
c.length; g++) if (a = c.substr(g), f
&&
f[a] || d[0][a]) {
b = b + " " + (f
&&
f[a] || d[0][a]);
break;
} else a = +c.substr(g, 1) * Math.pow(10, a.length - 1), +a in d[0]
&&
(b = b + " " + d[0][a]);
b
&&
(b = b + " " + k(+c, i[e] || i[0]));
h = b + h
}
return h || "\u043d\u043e\u043b\u044c"
}
model.getAsfData = function (blockNumber) {
if(model.getValue()){
var valueObject = JSON.stringify(model.getValue());
return AS.FORMS.ASFDataUtils.getBaseAsfData(model.asfProperty, blockNumber, valueObject, valueObject);
}else{
return AS.FORMS.ASFDataUtils.getBaseAsfData(model.asfProperty, blockNumber);
}
};
model.setAsfData = function(asfData){
if(!asfData || !asfData.value) return;
model.setValue(JSON.parse(asfData.value));
};
view.updateValueFromModel = function(){
if(('code' in model) !== false
&&
typeof(model.code) === 'object'){
for(var cmpG in model.code){
var cmpS = model.code[cmpG];
if(cmpG.indexOf('#table') !== -1){
if(Array.isArray(cmpS.to)
&&
Array.isArray(cmpS.from)){
model.playerModel.getModelWithId(""+cmpS.from[0],""+cmpS.from[1],cmpS.from[2]).procedureToString = cmpS;
model.playerModel.getModelWithId(""+cmpS.from[0],""+cmpS.from[1],cmpS.from[2]).on('valueChange',function(e,m){
model.playerModel.getModelWithId(""+m.procedureToString.to[0],""+m.procedureToString.to[1],m.procedureToString.to[2]).setValue(""+numberToText(""+(!m.getValue()?'ноль':m.getValue())));
});
var v = model.playerModel.getModelWithId(""+cmpS.from[0],""+cmpS.from[1],cmpS.from[2]).getValue();
model.playerModel.getModelWithId(""+cmpS.to[0],""+cmpS.to[1],cmpS.to[2]).setValue(""+(!v?'ноль':v));
}else if(Array.isArray(cmpS.to)){
model.playerModel.getModelWithId(""+cmpS.from).procedureToString = cmpS;
model.playerModel.getModelWithId(""+cmpS.from).on('valueChange',function(e,m){
model.playerModel.getModelWithId(""+m.procedureToString.to[0],""+m.procedureToString.to[1],m.procedureToString.to[2]).setValue(""+numberToText(""+(!m.getValue()?'ноль':m.getValue())));
});
var v = model.playerModel.getModelWithId(""+cmpS.from).getValue();
model.playerModel.getModelWithId(""+cmpS.to[0],""+cmpS.to[1],cmpS.to[2]).setValue(""+(!v?'ноль':v));
}else if(Array.isArray(cmpS.from)){
model.playerModel.getModelWithId(""+cmpS.from[0],""+cmpS.from[1],cmpS.from[2]).procedureToString = cmpS;
model.playerModel.getModelWithId(""+cmpS.from[0],""+cmpS.from[1],cmpS.from[2]).on('valueChange',function(e,m){
model.playerModel.getModelWithId(""+m.procedureToString.to).setValue(""+numberToText(""+(!m.getValue()?'ноль':m.getValue())));
});
var v = model.playerModel.getModelWithId(""+cmpS.from[0],""+cmpS.from[1],cmpS.from[2]).getValue();
model.playerModel.getModelWithId(""+cmpS.to).setValue(""+(!v?'ноль':v));
}
}else{
model.playerModel.getModelWithId(""+cmpG).procedureToString = [cmpS,cmpG];
model.playerModel.getModelWithId(""+cmpG).on('valueChange',function(e,m){
var v = model.playerModel.getModelWithId(""+m.procedureToString[1]).getValue();
model.playerModel.getModelWithId(""+m.procedureToString[0]).setValue(""+numberToText((!v?'ноль':v)));
});
var v = model.playerModel.getModelWithId(""+cmpG).getValue();
model.playerModel.getModelWithId(""+cmpS).setValue(""+numberToText((!v?'ноль':v)));
}
}
}
};
view.updateValueFromModel();
</javascript>
<html></html>
</customComponent>
</objects>
<dependencies/>
</configuration>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment