`;
}
if(count==3){
c.innerHTML=`
`;
}
}
generateBottomDia();// Calculation
function calculateSteel(){let beamCount=parseInt(document.getElementById("beamCount").value);
let topBars=parseInt(document.getElementById("topBars").value);
let bottomBars=parseInt(document.getElementById("bottomBars").value);let spacingInput=document.getElementById("spacing").value;
if(spacingInput==""||spacingInput<=0){
alert("Please enter Stirrup Spacing (mm)");
return;
}
let spacing=parseFloat(spacingInput)/1000;let stirrupDia=parseFloat(document.getElementById("stirrupDia").value);
let wastage=parseFloat(document.getElementById("wastage").value);let resultHTML="";
let grandTotal=0;for(let i=1;i<=beamCount;i++){let L=parseFloat(document.getElementById("beamLength"+i).value);
let B=parseFloat(document.getElementById("beamWidth"+i).value)/1000;
let D=parseFloat(document.getElementById("beamDepth"+i).value)/1000;
let cover=parseFloat(document.getElementById("beamCover"+i).value)/1000;if(!L||!B||!D||!cover){
alert("Fill all inputs for Beam "+i);
return;
}let beamTotal=0;
resultHTML+=``;
}let wastageSteel=grandTotal*(wastage/100);
let finalTotal=grandTotal+wastageSteel;resultHTML+=`
Steel Report

${content}`);
w.document.close();
w.print();
}
Beam ${i}
`;// TOP if(topBars==1){ let dia=parseFloat(document.getElementById("topDia1").value); let unit=(dia*dia/162); let wt=L*unit; beamTotal+=wt; resultHTML+=`Top Bar: ${L} × ${unit.toFixed(3)} = ${wt.toFixed(2)} kg
`; } if(topBars==2){ let dia=parseFloat(document.getElementById("topDia1").value); let unit=(dia*dia/162); let wt=2*L*unit; beamTotal+=wt; resultHTML+=`Top Bars: 2 × ${L} × ${unit.toFixed(3)} = ${wt.toFixed(2)} kg
`; } if(topBars==3){ for(let t=1;t<=3;t++){ let dia=parseFloat(document.getElementById("topDia"+t).value); let unit=(dia*dia/162); let wt=L*unit; beamTotal+=wt; resultHTML+=`Top Bar ${t}: ${L} × ${unit.toFixed(3)} = ${wt.toFixed(2)} kg
`; } }// BOTTOM if(bottomBars==1){ let dia=parseFloat(document.getElementById("bottomDia1").value); let unit=(dia*dia/162); let wt=L*unit; beamTotal+=wt; resultHTML+=`Bottom Bar: ${L} × ${unit.toFixed(3)} = ${wt.toFixed(2)} kg
`; } if(bottomBars==2){ let dia=parseFloat(document.getElementById("bottomDia1").value); let unit=(dia*dia/162); let wt=2*L*unit; beamTotal+=wt; resultHTML+=`Bottom Bars: 2 × ${L} × ${unit.toFixed(3)} = ${wt.toFixed(2)} kg
`; } if(bottomBars==3){ for(let b=1;b<=3;b++){ let dia=parseFloat(document.getElementById("bottomDia"+b).value); let unit=(dia*dia/162); let wt=L*unit; beamTotal+=wt; resultHTML+=`Bottom Bar ${b}: ${L} × ${unit.toFixed(3)} = ${wt.toFixed(2)} kg
`; } }// STIRRUPS let hook=2*(10*stirrupDia/1000); let stirrupLength=2*(B+D-2*cover)+hook; let stirrupNos=Math.ceil(L/spacing); let stirrupUnit=(stirrupDia*stirrupDia/162); let stirrupWeight=stirrupNos*stirrupLength*stirrupUnit;beamTotal+=stirrupWeight; grandTotal+=beamTotal;resultHTML+=`Stirrups: ${stirrupNos} × ${stirrupLength.toFixed(2)} × ${stirrupUnit.toFixed(3)} = ${stirrupWeight.toFixed(2)} kg

