add descriptions

This commit is contained in:
fleetside72 2018-09-28 14:16:40 -04:00
parent 4e7bbe1125
commit be5697d51f

View File

@ -224,18 +224,20 @@ server.get("/add_gl_multi_and_post", bodyParser.json(), function (inReq, inRes)
x.gl.lines = []; x.gl.lines = [];
x.gl.jpath = []; x.gl.jpath = [];
for (var i in x.item){ for (var i in x.item){
//copy the current item to the gl array
var line = x.item[i]; var line = x.item[i];
x.gl.lines.push(line); x.gl.lines.push(line);
//build references to 'item' array
var ref = []; var ref = [];
ref.push("{item,"+i+"}"); ref.push("{item,"+i+"}");
ref.push("{header}"); ref.push("{header}");
x.gl.jpath.push(ref); x.gl.jpath.push(ref);
//copy the existing line to the GL array //copy the current item to the gl array again, but swap account with supplied 'account' in header
var ofs = JSON.parse(JSON.stringify(line)); var ofs = JSON.parse(JSON.stringify(line));
ofs.account = x.header.account; ofs.account = x.header.account;
ofs.amount = -ofs.amount; ofs.amount = -ofs.amount;
//add another line the GL array using the offset account
x.gl.lines.push(ofs); x.gl.lines.push(ofs);
//add the same reference again for the offset account
x.gl.jpath.push(ref); x.gl.jpath.push(ref);
} }
var sql = "INSERT INTO evt.bpr (bpr) SELECT $1"; var sql = "INSERT INTO evt.bpr (bpr) SELECT $1";