Commit 9a53e949 authored by Irina Oleynik's avatar Irina Oleynik

Add new file

parent 24ffc4f4
var result = true;
var message = "ok";
try {
let currentFormData = API.getFormData(dataUUID);
let table_needs;
let rowCount = 0;
for(let i=0; i<currentFormData.data.length; i++){
if( currentFormData.data[i].id == 'table_needs'){
table_needs = currentFormData.data[i].data;
}
}
for(let i=0; i<table_needs.length; i++){
if( table_needs[i].id.slice(0,16) == 'numericinput_cfo'){
rowCount += 1;
}
}
for(let i=0; i<rowCount; i++){
let contractAsfData = [];
for(let j=0; j<table_needs.length; j++){
if( table_needs[j].id.slice(-1) == (i+1).toString()){
contractAsfData.push(table_needs[j]);
}
}
for(let j=0; j<contractAsfData.length; j++){
contractAsfData[j].id = contractAsfData[j].id.substring(0, contractAsfData[j].id.indexOf("-"));
}
let result = API.createDocRCC('registr_for_budjet', contractAsfData);
if(result.errorCode != 0) throw new Error("Не удалось создать документ.\n" + result.errorMessage);
result = API.activateDoc(result.documentID);
if(result.errorCode != 0) throw new Error("Ошибка активации документа");
}
message = "Документ создан, documentID: " + result.documentID;
} catch (err) {
log.error(err);
message = err.message;
}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment