var resultCode
var requestId = 0x80000000 | (Math.random() * 2147483647.)

oleObject = new ActiveXObject("SBRFSRV.Server")
ws = WScript.CreateObject('WScript.Shell')

oleObject.clear()
oleObject.SParam("Amount", 1000)
oleObject.SParam("RequestID", requestId)           // установка своего RequestID
resultCode = oleObject.NFun(4000)
if(resultCode == 0) {
  showTextInNotepad("Before: \r\n" + oleObject.GParamString("Cheque"))
  var queryRequestId = oleObject.GParamString("QueryRequestID")

  var shell = new ActiveXObject("WScript.Shell");
  shell.Popup("QueryRequestID=" + queryRequestId)
  
  // Сохранение в терминале банковского и торгового чеков
  oleObject.clear()
  oleObject.SParam ("QueryRequestID", queryRequestId) // ID операции оплаты
  resultCode = oleObject.NFun(6006)
  showTextInNotepad("After: \r\n" + oleObject.GParamString("Cheque"))
}

function showTextInNotepad(text)
{
  filename = (new Date()).valueOf() + "upos_check.txt"
  fso = WScript.CreateObject('Scripting.FileSystemObject')
  file = fso.CreateTextFile(filename)
  file.Write(text)
  file.Close()
  WScript.CreateObject('WScript.Shell').Run("notepad " + filename)
  WScript.Sleep(2000)
  fso.DeleteFile(filename)
}