// JavaScript Document

function dm(amount)
{
string = "" + amount;
dec = string.length - string.indexOf('.');
if (string.indexOf('.') == -1)
return string + '.00';
if (dec == 1)
return string + '00';
if (dec == 2)
return string + '0';
if (dec > 3)
return string.substring(0,string.length-dec+3);
return string;
}
function calculate()
{

   QtyAk = 0; QtyAsmk = 0; QtyAmedk=0; QtyAlgk = 0; QtyAxlgk = 0; QtyAxxlgk = 0;
   QtyAw = 0; QtyAsmw = 0; QtyAmedw=0; QtyAlgw = 0; QtyAxlgw = 0; QtyAxxlgw = 0;
   TotAk = 0; TotAw = 0;
   PrcAk = 22.00; PrcAw = 22.00;
   
   QtyBk = 0; QtyBsmk = 0; QtyBmedk=0; QtyBlgk = 0; QtyBxlgk = 0; QtyBxxlgk = 0;
   QtyBw = 0; QtyBsmw = 0; QtyBmedw=0; QtyBlgw = 0; QtyBxlgw = 0; QtyBxxlgw = 0;
   TotBk = 0; TotBw = 0;
   PrcBk = 22.00; PrcBw = 22.00;
   
   QtyCs = 0; QtyCsms = 0; QtyCmeds=0; QtyClgs = 0; QtyCxlgs = 0; QtyCxxlgs = 0;
   QtyCw = 0; QtyCsmw = 0; QtyCmedw=0; QtyClgw = 0; QtyCxlgw = 0; QtyCxxlgw = 0;
   TotCs = 0; TotCw = 0;
   PrcCs = 30.00; PrcCw = 30.00; 
   
   QtyDs = 0; QtyDsms = 0; QtyDmeds=0; QtyDlgs = 0; QtyDxlgs = 0; QtyDxxlgs = 0;
   QtyDw = 0; QtyDsmw = 0; QtyDmedw=0; QtyDlgw = 0; QtyDxlgw = 0; QtyDxxlgw = 0;
   TotDs = 0; TotDw = 0;
   PrcDs = 30.00; PrcDw = 30.00;
   
   QtyEs = 0; QtyEsms = 0; QtyEmeds=0; QtyElgs = 0; QtyExlgs = 0; QtyExxlgs = 0;
   QtyEl = 0; QtyEsml = 0; QtyEmedl=0; QtyElgl = 0; QtyExlgl = 0; QtyExxlgl = 0;
   TotEs = 0; TotEl = 0;
   PrcEs = 20.00; PrcEl = 25.00;
   
   QtyFs = 0; QtyFsms = 0; QtyFmeds=0; QtyFlgs = 0; QtyFxlgs = 0; QtyFxxlgs = 0;
   QtyFl = 0; QtyFsml = 0; QtyFmedl=0; QtyFlgl = 0; QtyFxlgl = 0; QtyFxxlgl = 0;
   TotFs = 0; TotFl = 0;
   PrcFs = 20.00; PrcFl = 25.00;
   
   QtyG = 0; QtyGmed=0; QtyGlg = 0; QtyGxlg = 0; QtyGxxlg = 0;
   TotG = 0;
   PrcG = 45.00;
   
   QtyHk = 0; QtyHsmk = 0; QtyHmedk=0; QtyHlgk = 0; QtyHxlgk = 0; QtyHxxlgk = 0;
   QtyHw = 0; QtyHsmw = 0; QtyHmedw=0; QtyHlgw = 0; QtyHxlgw = 0; QtyHxxlgw = 0;
   QtyHy = 0; QtyHsmy = 0; QtyHmedy=0; QtyHlgy = 0; QtyHxlgy = 0; QtyHxxlgy = 0;
   TotHk = 0; TotHw = 0;  TotHy = 0;
   PrcHk = 57.00; PrcHw = 57.00; PrcHy = 57.00;
   
   QtyIk = 0; QtyIk = 0;
   QtyIp = 0; QtyIp = 0;
   TotIk = 0; TotIp = 0;
   PrcIk = 12.00; PrcIp = 12.00;
   
   QtyJs = 0; QtyJs = 0;
   QtyJl = 0; QtyJl = 0;
   TotJs = 0; TotJl = 0;
   PrcJs = 23.75;  PrcJl = 25.00;
      
   Totamt = 0;

   if (document.ofrm.qtyAsmk.value > "")
      { QtyAsmk = document.ofrm.qtyAsmk.value };
   if (document.ofrm.qtyAmedk.value > "")
      { QtyAmedk = document.ofrm.qtyAmedk.value };
   if (document.ofrm.qtyAlgk.value > "")
      { QtyAlgk = document.ofrm.qtyAlgk.value };
   if (document.ofrm.qtyAxlgk.value > "")
      { QtyAxlgk = document.ofrm.qtyAxlgk.value };
   if (document.ofrm.qtyAxxlgk.value > "")
      { QtyAxxlgk = document.ofrm.qtyAxxlgk.value }; 
   if (document.ofrm.qtyAsmw.value > "")
      { QtyAsmw = document.ofrm.qtyAsmw.value };
   if (document.ofrm.qtyAmedw.value > "")
      { QtyAmedw = document.ofrm.qtyAmedw.value };
   if (document.ofrm.qtyAlgw.value > "")
      { QtyAlgw = document.ofrm.qtyAlgw.value };
   if (document.ofrm.qtyAxlgw.value > "")
      { QtyAxlgw = document.ofrm.qtyAxlgw.value };
   if (document.ofrm.qtyAxxlgw.value > "")
      { QtyAxxlgw = document.ofrm.qtyAxxlgw.value }; 
	  
   if (document.ofrm.qtyBsmk.value > "")
      { QtyBsmk = document.ofrm.qtyBsmk.value };
   if (document.ofrm.qtyBmedk.value > "")
      { QtyBmedk = document.ofrm.qtyBmedk.value };
   if (document.ofrm.qtyBlgk.value > "")
      { QtyBlgk = document.ofrm.qtyBlgk.value };
   if (document.ofrm.qtyBxlgk.value > "")
      { QtyBxlgk = document.ofrm.qtyBxlgk.value };
   if (document.ofrm.qtyBxxlgk.value > "")
      { QtyBxxlgk = document.ofrm.qtyBxxlgk.value }; 
   if (document.ofrm.qtyBsmw.value > "")
      { QtyBsmw = document.ofrm.qtyBsmw.value };
   if (document.ofrm.qtyBmedw.value > "")
      { QtyBmedw = document.ofrm.qtyBmedw.value };
   if (document.ofrm.qtyBlgw.value > "")
      { QtyBlgw = document.ofrm.qtyBlgw.value };
   if (document.ofrm.qtyBxlgw.value > "")
      { QtyBxlgw = document.ofrm.qtyBxlgw.value };
   if (document.ofrm.qtyBxxlgw.value > "")
      { QtyBxxlgw = document.ofrm.qtyBxxlgw.value };
	  
   if (document.ofrm.qtyCsms.value > "")
      { QtyCsms = document.ofrm.qtyCsms.value };
   if (document.ofrm.qtyCmeds.value > "")
      { QtyCmeds = document.ofrm.qtyCmeds.value };
   if (document.ofrm.qtyClgs.value > "")
      { QtyClgs = document.ofrm.qtyClgs.value };
   if (document.ofrm.qtyCxlgs.value > "")
      { QtyCxlgs = document.ofrm.qtyCxlgs.value };
   if (document.ofrm.qtyCxxlgs.value > "")
      { QtyCxxlgs = document.ofrm.qtyCxxlgs.value }; 
   if (document.ofrm.qtyCsmw.value > "")
      { QtyCsmw = document.ofrm.qtyCsmw.value };
   if (document.ofrm.qtyCmedw.value > "")
      { QtyCmedw = document.ofrm.qtyCmedw.value };
   if (document.ofrm.qtyClgw.value > "")
      { QtyClgw = document.ofrm.qtyClgw.value };
   if (document.ofrm.qtyCxlgw.value > "")
      { QtyCxlgw = document.ofrm.qtyCxlgw.value };
   if (document.ofrm.qtyCxxlgw.value > "")
      { QtyCxxlgw = document.ofrm.qtyCxxlgw.value };
	  
   if (document.ofrm.qtyDsms.value > "")
      { QtyDsms = document.ofrm.qtyDsms.value };
   if (document.ofrm.qtyDmeds.value > "")
      { QtyDmeds = document.ofrm.qtyDmeds.value };
   if (document.ofrm.qtyDlgs.value > "")
      { QtyDlgs = document.ofrm.qtyDlgs.value };
   if (document.ofrm.qtyDxlgs.value > "")
      { QtyDxlgs = document.ofrm.qtyDxlgs.value };
   if (document.ofrm.qtyDxxlgs.value > "")
      { QtyDxxlgs = document.ofrm.qtyDxxlgs.value }; 
   if (document.ofrm.qtyDsmw.value > "")
      { QtyDsmw = document.ofrm.qtyDsmw.value };
   if (document.ofrm.qtyDmedw.value > "")
      { QtyDmedw = document.ofrm.qtyDmedw.value };
   if (document.ofrm.qtyDlgw.value > "")
      { QtyDlgw = document.ofrm.qtyDlgw.value };
   if (document.ofrm.qtyDxlgw.value > "")
      { QtyDxlgw = document.ofrm.qtyDxlgw.value };
   if (document.ofrm.qtyDxxlgw.value > "")
      { QtyDxxlgw = document.ofrm.qtyDxxlgw.value };
	  
   if (document.ofrm.qtyEsms.value > "")
      { QtyEsms = document.ofrm.qtyEsms.value };
   if (document.ofrm.qtyEmeds.value > "")
      { QtyEmeds = document.ofrm.qtyEmeds.value };
   if (document.ofrm.qtyElgs.value > "")
      { QtyElgs = document.ofrm.qtyElgs.value };
   if (document.ofrm.qtyExlgs.value > "")
      { QtyExlgs = document.ofrm.qtyExlgs.value };
   if (document.ofrm.qtyExxlgs.value > "")
      { QtyExxlgs = document.ofrm.qtyExxlgs.value }; 
   if (document.ofrm.qtyEsml.value > "")
      { QtyEsml = document.ofrm.qtyEsml.value };
   if (document.ofrm.qtyEmedl.value > "")
      { QtyEmedl = document.ofrm.qtyEmedl.value };
   if (document.ofrm.qtyElgl.value > "")
      { QtyElgl = document.ofrm.qtyElgl.value };
   if (document.ofrm.qtyExlgl.value > "")
      { QtyExlgl = document.ofrm.qtyExlgl.value };
   if (document.ofrm.qtyExxlgl.value > "")
      { QtyExxlgl = document.ofrm.qtyExxlgl.value };
	  
   if (document.ofrm.qtyFsms.value > "")
      { QtyFsms = document.ofrm.qtyFsms.value };
   if (document.ofrm.qtyFmeds.value > "")
      { QtyFmeds = document.ofrm.qtyFmeds.value };
   if (document.ofrm.qtyFlgs.value > "")
      { QtyFlgs = document.ofrm.qtyFlgs.value };
   if (document.ofrm.qtyFxlgs.value > "")
      { QtyFxlgs = document.ofrm.qtyFxlgs.value };
   if (document.ofrm.qtyFxxlgs.value > "")
      { QtyFxxlgs = document.ofrm.qtyFxxlgs.value }; 
   if (document.ofrm.qtyFsml.value > "")
      { QtyFsml = document.ofrm.qtyFsml.value };
   if (document.ofrm.qtyFmedl.value > "")
      { QtyFmedl = document.ofrm.qtyFmedl.value };
   if (document.ofrm.qtyFlgl.value > "")
      { QtyFlgl = document.ofrm.qtyFlgl.value };
   if (document.ofrm.qtyFxlgl.value > "")
      { QtyFxlgl = document.ofrm.qtyFxlgl.value };
   if (document.ofrm.qtyFxxlgl.value > "")
      { QtyFxxlgl = document.ofrm.qtyFxxlgl.value };
	  
   if (document.ofrm.qtyGmed.value > "")
      { QtyGmed = document.ofrm.qtyGmed.value };
   if (document.ofrm.qtyGlg.value > "")
      { QtyGlg = document.ofrm.qtyGlg.value };
   if (document.ofrm.qtyGxlg.value > "")
      { QtyGxlg = document.ofrm.qtyGxlg.value };
   if (document.ofrm.qtyGxxlg.value > "")
      { QtyGxxlg = document.ofrm.qtyGxxlg.value };
	  
   if (document.ofrm.qtyHsmk.value > "")
      { QtyHsmk = document.ofrm.qtyHsmk.value };
   if (document.ofrm.qtyHmedk.value > "")
      { QtyHmedk = document.ofrm.qtyHmedk.value };
   if (document.ofrm.qtyHlgk.value > "")
      { QtyHlgk = document.ofrm.qtyHlgk.value };
   if (document.ofrm.qtyHxlgk.value > "")
      { QtyHxlgk = document.ofrm.qtyHxlgk.value };
   if (document.ofrm.qtyHxxlgk.value > "")
      { QtyHxxlgk = document.ofrm.qtyHxxlgk.value }; 
   if (document.ofrm.qtyHsmw.value > "")
      { QtyHsmw = document.ofrm.qtyHsmw.value };
   if (document.ofrm.qtyHmedw.value > "")
      { QtyHmedw = document.ofrm.qtyHmedw.value };
   if (document.ofrm.qtyHlgw.value > "")
      { QtyHlgw = document.ofrm.qtyHlgw.value };
   if (document.ofrm.qtyHxlgw.value > "")
      { QtyHxlgw = document.ofrm.qtyHxlgw.value };
   if (document.ofrm.qtyHxxlgw.value > "")
      { QtyHxxlgw = document.ofrm.qtyHxxlgw.value };
   if (document.ofrm.qtyHsmy.value > "")
      { QtyHsmw = document.ofrm.qtyHsmy.value };
   if (document.ofrm.qtyHmedy.value > "")
      { QtyHmedw = document.ofrm.qtyHmedy.value };
   if (document.ofrm.qtyHlgy.value > "")
      { QtyHlgw = document.ofrm.qtyHlgy.value };
   if (document.ofrm.qtyHxlgy.value > "")
      { QtyHxlgw = document.ofrm.qtyHxlgy.value };
   if (document.ofrm.qtyHxxlgy.value > "")
      { QtyHxxlgw = document.ofrm.qtyHxxlgy.value };
	  
   if (document.ofrm.qtyIk.value > "")
      { QtyIk = document.ofrm.qtyIk.value };
   if (document.ofrm.qtyIp.value > "")
      { QtyIp = document.ofrm.qtyIp.value };
	  
   if (document.ofrm.qtyJs.value > "")
      { QtyJs = document.ofrm.qtyJs.value };
   if (document.ofrm.qtyJl.value > "")
      { QtyJl = document.ofrm.qtyJl.value };

   TotAk = PrcAk * QtyAsmk + PrcAk * QtyAmedk + PrcAk * QtyAlgk + PrcAk * QtyAxlgk + PrcAk * QtyAxxlgk
   document.ofrm.totalAk.value = dm(eval(TotAk));
   TotAw = PrcAw * QtyAsmw + PrcAw * QtyAmedw + PrcAw * QtyAlgw + PrcAw * QtyAxlgw + PrcAw * QtyAxxlgw
   document.ofrm.totalAw.value = dm(eval(TotAw));
   TotBk = PrcBk * QtyBsmk + PrcBk * QtyBmedk + PrcBk * QtyBlgk + PrcBk * QtyBxlgk + PrcBk * QtyBxxlgk
   document.ofrm.totalBk.value = dm(eval(TotBk));
   TotBw = PrcBw * QtyBsmw + PrcBw * QtyBmedw + PrcBw * QtyBlgw + PrcBw * QtyBxlgw + PrcBw * QtyBxxlgw
   document.ofrm.totalBw.value = dm(eval(TotBw));
   TotCs = PrcCs * QtyCsms + PrcCs * QtyCmeds + PrcCs * QtyClgs + PrcCs * QtyCxlgs + PrcCs * QtyCxxlgs
   document.ofrm.totalCs.value = dm(eval(TotCs));
   TotCw = PrcCw * QtyCsmw + PrcCw * QtyCmedw + PrcCw * QtyClgw + PrcCw * QtyCxlgw + PrcCw * QtyCxxlgw
   document.ofrm.totalCw.value = dm(eval(TotCw));
   TotDs = PrcDs * QtyDsms + PrcDs * QtyDmeds + PrcDs * QtyDlgs + PrcDs * QtyDxlgs + PrcDs * QtyDxxlgs
   document.ofrm.totalDs.value = dm(eval(TotDs));
   TotDw = PrcDw * QtyDsmw + PrcDw * QtyDmedw + PrcDw * QtyDlgw + PrcDw * QtyDxlgw + PrcDw * QtyDxxlgw
   document.ofrm.totalDw.value = dm(eval(TotDw));
   TotEs = PrcEs * QtyEsms + PrcEs * QtyEmeds + PrcEs * QtyElgs + PrcEs * QtyExlgs + PrcEs * QtyExxlgs
   document.ofrm.totalEs.value = dm(eval(TotEs));
   TotEl = PrcEl * QtyEsml + PrcEl * QtyEmedl + PrcEl * QtyElgl+ PrcEl * QtyExlgl + PrcEl * QtyExxlgl
   document.ofrm.totalEl.value = dm(eval(TotEl));
   TotFs = PrcFs * QtyFsms + PrcFs * QtyFmeds + PrcFs * QtyFlgs + PrcFs * QtyFxlgs + PrcFs * QtyFxxlgs
   document.ofrm.totalFs.value = dm(eval(TotFs));
   TotFl = PrcFl * QtyFsml + PrcFl * QtyFmedl + PrcFl * QtyFlgl + PrcFl * QtyFxlgl + PrcFl * QtyFxxlgl
   document.ofrm.totalFl.value = dm(eval(TotFl));
   TotG = PrcG * QtyGmed + PrcG * QtyGlg + PrcG * QtyGxlg + PrcG * QtyGxxlg
   document.ofrm.totalG.value = dm(eval(TotG));
   TotHk = PrcHk * QtyHsmk + PrcHk * QtyHmedk + PrcHk * QtyHlgk + PrcHk * QtyHxlgk + PrcHk * QtyHxxlgk
   document.ofrm.totalHk.value = dm(eval(TotHk));
   TotHw = PrcHw * QtyHsmw + PrcHw * QtyHmedw + PrcHw * QtyHlgw + PrcHw * QtyHxlgw + PrcHw * QtyHxxlgw
   document.ofrm.totalHw.value = dm(eval(TotHw));
   TotHy = PrcHy * QtyHsmy + PrcHy * QtyHmedy + PrcHy * QtyHlgy + PrcHy * QtyHxlgy + PrcHy * QtyHxxlgy
   document.ofrm.totalHy.value = dm(eval(TotHy));
   TotIk = PrcIk * QtyIk
   document.ofrm.totalIk.value = dm(eval(TotIk));
   TotIp = PrcIp * QtyIp
   document.ofrm.totalIp.value = dm(eval(TotIp));
   TotJs = PrcJs * QtyJs
   document.ofrm.totalJs.value = dm(eval(TotJs));
   TotJl = PrcJl * QtyJl
   document.ofrm.totalJl.value = dm(eval(TotJl));


   Totamt = eval(TotAk) + eval(TotAw) + eval(TotBk) + eval(TotBw) + eval(TotCs) + eval(TotCw) + eval(TotDs) + eval(TotDw) + eval(TotEs) + eval(TotEl) + eval(TotFs) + eval(TotFl) + eval(TotG) + eval(TotHk) + eval(TotHw) + eval(TotHy) + eval(TotIk) + eval(TotIp) + eval(TotJs) + eval(TotJl)
   document.ofrm.GrandTotal.value = dm(eval(Totamt));
}

