function MqPrintInvAdptrExt(oVecWebSess, iFldType, oCenMain)
{			
	var m_oVecWebSess=oVecWebSess;
	var m_iFldType=iFldType;
	var m_oCenMain=oCenMain;
	
	function OnAfterLoadRec()
	{
		var TYPE_PURCHASE=1;
		
		var lngType=GetFldValue(m_iFldType);
		var objBtnPrint=m_oCenMain.document.getElementById("cmdPrint");
		
		if(objBtnPrint){
			if(lngType==TYPE_PURCHASE){
				objBtnPrint.onclick=function(){objPrintInv.PrintInvoice();};
			}else{
				objBtnPrint.style.display = 'none';
				objBtnPrint.style.visibility = 'hidden';
			}
		}
	}
	
	function PrintInvoice()
	{
		var lngID=m_oCenMain.objRecord.GetRecordId();
		var lngReportID=5;
		var REPORT_WC_ASP_PATH = "../../Reports/WCMqWebReport.ASP";
		
		if(m_oCenMain.m_objReportViewer){
			m_oCenMain.m_objReportViewer.OpenReport(lngReportID + ".10",true,null,"",
											REPORT_WC_ASP_PATH, m_oCenMain.objRequest,
											m_oCenMain.mstrCurrentLocation, m_oCenMain.FEATURE_NORMAL_REPORT_VIEWER, null, null, null, 
											"&param8=" + lngID + "&prmsapplied=1");
		}
	}
	
	function GetFldValue(iFldID)
	{
		var strVal="";
		
		if(m_oVecWebSess){
			var oCurrRec=m_oVecWebSess.RecordMgr().CurrentRecord();
			if(oCurrRec){
				var oFldVal=oCurrRec.FldVals(iFldID);  
				if (oFldVal){
					strVal=oFldVal.GetValue();
				}
			}
		}
		return strVal;
	}
	this.OnAfterLoadRec=OnAfterLoadRec;
	this.PrintInvoice=PrintInvoice;
	
	WriteConsole("MqPrintInvAdptrExt: Initializing the extension");		
}
