/* Dynamically Calculates the Banquet Discounts Order Form Totals As They Are Enetered */

function df_refresh_totals()
{
  var grand = 0;
  
  var qty_a = parseInt(document.getElementById('qtya').value);
  var qty_b = parseInt(document.getElementById('qtyb').value);
  var qty_c = parseInt(document.getElementById('qtyc').value);
  var qty_d_sm = parseInt(document.getElementById('qtyd_sm').value);
  var qty_d_lg = parseInt(document.getElementById('qtyd_lg').value);
  var qty_e = parseInt(document.getElementById('qtye').value);
  var qty_f = parseInt(document.getElementById('qtyf').value);
  
  var totala = qty_a ? qty_a * 9.00 : 0;
  var totalb = qty_b ? qty_b * 24.00 : 0;
  var totalc = qty_c ? qty_c * 6.00 : 0;
  var totald = qty_d_sm ? qty_d_sm * 9.00 : 0;
      totald += qty_d_lg ? qty_d_lg * 9.00 : 0;
  var totale = qty_e ? qty_e * 1.20 : 0;
  var totalf = qty_f ? qty_f * 1.20 : 0;
  
  grand += parseFloat(document.getElementById('totalah').value = document.getElementById('totala').value = totala.toFixed(2)); 
  grand += parseFloat(document.getElementById('totalbh').value = document.getElementById('totalb').value = totalb.toFixed(2));
  grand += parseFloat(document.getElementById('totalch').value = document.getElementById('totalc').value = totalc.toFixed(2));
  grand += parseFloat(document.getElementById('totaldh').value = document.getElementById('totald').value = totald.toFixed(2));
  grand += parseFloat(document.getElementById('totaleh').value = document.getElementById('totale').value = totale.toFixed(2));
  grand += parseFloat(document.getElementById('totalfh').value = document.getElementById('totalf').value = totalf.toFixed(2));
  
  document.getElementById('grandtotalh').value = document.getElementById('grandtotal').value = grand.toFixed(2);
}