点晴ERP-动态JS给送货单查看添加合计行
:点晴ERP-动态JS给送货单查看添加合计行
var weight_num=document.getElementById("num").value;
var total_contract_order_quantity=0;
var total_finished_order_quantity=0;
var total_pre_quantity=0;
var total_consignment_quantity=0;
for(no_w=1;no_w<=weight_num;no_w++){
total_contract_order_quantity=document.getElementById('contract_order_quantity'+no_w).value-(-total_contract_order_quantity)
total_finished_order_quantity=document.getElementById('finished_order_quantity'+no_w).value-(-total_finished_order_quantity)
total_pre_quantity=document.getElementById('pre_quantity'+no_w).value-(-total_pre_quantity)
total_consignment_quantity=document.getElementById('consignment_quantity'+no_w).value-(-total_consignment_quantity)
}
var table = document.getElementById('dgoie');
// 获取单元格数量
var cellCount = table.rows[0].cells.length;
// 创建新行并设置高度
var newRow = table.insertRow(-1); // -1 表示在表的底部插入
newRow.style.height = '26px';
// 为新行创建单元格并填充数据(如果需要)
for (var i = 0; i < cellCount; i++) {
var newCell = newRow.insertCell(i);
newCell.style.textAlign = 'center';
if(i==7){
newCell.innerHTML=total_contract_order_quantity;
}
else if(i==8){
newCell.innerHTML=total_finished_order_quantity;
}
else if(i==10){
newCell.innerHTML=total_pre_quantity;
}
else if(i==11){
newCell.innerHTML=total_consignment_quantity;
}
else{
newCell.innerHTML = ''; // 根据需要填充内容
}
}