Skip to content

Commit

Permalink
0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
олег committed Jun 15, 2017
1 parent d5a5cba commit b520929
Show file tree
Hide file tree
Showing 63 changed files with 142,055 additions and 387 deletions.
72 changes: 33 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,60 +28,54 @@ Ajax запросов. Дополнительные библиотеки не т
* Функция вызываемая после обработки команды - обработка возвращаемых данных
* @param {{Status,Error,URL,Command,IdCommand,NumDevice}} Rezult - ответ ККM
*/
function ExecuteSuccess(Rezult) {
var Responce = "";
function ExecuteSuccess(Rezult) {
var Responce = "";

if (Rezult.Status === 0) {
Responce = Responce + "Статус: " + "Ok" + "\r\n";
} else if (Rezult.Status === 1) {
Responce = Responce + "Статус: " + "Выполняется" + "\r\n";
} else if (Rezult.Status === 2) {
Responce = Responce + "Статус: " + "Ошибка!" + "\r\n";
} else if (Rezult.Status === 3) {
Responce = Responce + "Статус: " + "Данные не найдены!" + "\r\n";
}
// Текст ошибки
if (Rezult.Error !== undefined && Rezult.Error !== "") {
Responce = Responce + "Ошибка: " + Rezult.Error + "\r\n";
}
if (Rezult !== undefined) {
var JSon = JSON.stringify(Rezult, '', 4);
Responce = Responce + "JSON ответа: \r\n" + JSon + "\r\n";
}
if (Rezult.Status === 0) {
Responce = Responce + "Статус: " + "Ok" + "\r\n";
} else if (Rezult.Status === 1) {
Responce = Responce + "Статус: " + "Выполняется" + "\r\n";
} else if (Rezult.Status === 2) {
Responce = Responce + "Статус: " + "Ошибка!" + "\r\n";
} else if (Rezult.Status === 3) {
Responce = Responce + "Статус: " + "Данные не найдены!" + "\r\n";
}

document.getElementById('Responce').textContent = Responce;
}

// Текст ошибки
if (Rezult.Error !== undefined && Rezult.Error !== "") {
Responce = Responce + "Ошибка: " + Rezult.Error + "\r\n";
}

if (Rezult !== undefined) {
var JSon = JSON.stringify(Rezult, null, 4);
Responce = Responce + "JSON ответа: \r\n" + JSon + "\r\n";
}

document.getElementById('Responce').textContent = Responce;
}
```

### Инициализация
```javascript
// минимально нужно указать под кем и куда делать запрос и назначить обработчик
KkmServer.Connect('Admin','').HookAjaxSuccess(ExecuteSuccess);

// или
KkmServer.Connect('Admin','','http://localhost:5893/');
KkmServer.HookAjaxSuccess(ExecuteSuccess);
KkmServer.SetCashierName('Петрова');
KkmServer.SetNumDevice(1);
KkmServer.connect('Admin', '').setHookAjaxSuccess(ExecuteSuccess)
```

### Выполнение команд
```javascript
// chaining синтаксис
KkmServer.DepositingCash(2.05).Execute();
// простой
KkmServer.Execute(KkmServer.commandDepositingCash(2.05));
// расширенный
var Deposit = KkmServer.commandDepositingCash(2.05,'Иванова',2);
Deposit.idCommand = 'мой_идентификатор';
KkmServer.Execute(Deposit);
KkmServer.depositingCash(2.05);

var check = KkmServer.OpenCheck();
check.addRegisterString('Мыло',1,1,1);
check.Data.Cash = 1;
KkmServer.execute(check.Data);
```

**Enjoy**

##History
## History

###Альфа версии
### Альфа версии
- 0.1.0 - Переработан полностью набор методов. Добавлена документация.
- 0.0.2 - Первая публичная версия

Loading

0 comments on commit b520929

Please sign in to comment.