// Dlg_MainHeatingDetails.cpp : implementation file
//

#include "stdafx.h"
#include "SAPP1.h"
#include "SAPP1Dlg.h"
#include "Dlg_MainHeatingDetails.h"

// CDlg_MainHeatingDetails dialog

IMPLEMENT_DYNAMIC(CDlg_MainHeatingDetails, CDialog)
CDlg_MainHeatingDetails::CDlg_MainHeatingDetails(CWnd* pParent /*=NULL*/)
	: CDialog(CDlg_MainHeatingDetails::IDD, pParent)
	, str_comboIsOilPumpInHeatedSpace(_T(""))
	, str_comboOilBoilerInstalled(_T(""))
	, str_editCPSUopTemp(_T(""))
	, str_editHtEmmFromCase(_T(""))
	, str_editHtTransferredToWater(_T(""))
	, str_comboSmokeControlArea(_T(""))
	, str_comboIsCHPpresent(_T(""))
	, str_comboCHPFuel(_T(""))
	, str_editFractOfHtFromCHP(_T(""))
	, str_editElecEffofCHP(_T(""))
	, str_editHtEffofCHP(_T(""))
	, str_comboFuel(_T(""))
	, str_comboSystem(_T(""))
	, str_editEff(_T(""))
	, str_editFractofHtFromBoiler2(_T(""))
	, str_editManufactDesc(_T(""))
{
}

CDlg_MainHeatingDetails::~CDlg_MainHeatingDetails()
{
}

void CDlg_MainHeatingDetails::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_STATIC_1, m_labelWetCentralHt);
	DDX_Control(pDX, IDC_STATIC_2, m_labelRangeCooker);
	DDX_Control(pDX, IDC_STATIC_3, m_labelSmokeControl);
	DDX_Control(pDX, IDC_STATIC_4, m_labelCHP);
	DDX_Control(pDX, IDC_STATIC_5, m_labelSecComBoiler);
	DDX_Control(pDX, IDC_COMBO_IsOilPumpHtSpace, m_comboIsOilPumpInHeatedSpace);
	DDX_Control(pDX, IDC_COMBO_isOilBoilerInstalled, m_comboOilBoilerInstalled);
	DDX_Control(pDX, IDC_COMBO_smokeControlArea, m_comboSmokeControlArea);
	DDX_Control(pDX, IDC_COMBO_IsCHPpresent, m_comboIsCHPpresent);
	DDX_Control(pDX, IDC_COMBO_CHPfuel, m_comboCHPFuel);
	DDX_Control(pDX, IDC_COMBO_Fuel, m_comboFuel);
	DDX_Control(pDX, IDC_COMBO_system, m_comboSystem);
	DDX_Control(pDX, IDC_EDIT_CPSUtemp, m_editCPSUopTemp);
	DDX_Control(pDX, IDC_EDIT_HeatEmm, m_editHtEmmFromCase);
	DDX_Control(pDX, IDC_EDIT_HtTransferToWater, m_editHtTransferredToWater);
	DDX_Control(pDX, IDC_EDIT_fractionOfHeatCHP, m_editFractOfHtFromCHP);
	DDX_Control(pDX, IDC_EDIT_EEofCHP, m_editElecEffofCHP);
	DDX_Control(pDX, IDC_EDIT_HtEffofCHP, m_editHtEffofCHP);
	DDX_Control(pDX, IDC_EDIT_efficiency, m_editEff);
	DDX_Control(pDX, IDC_EDIT_fractOfHtFromBoiler2, m_editFractofHtFromBoiler2);
	DDX_Control(pDX, IDC_EDIT_ManufactDesc, m_editManufactDesc);
	DDX_CBString(pDX, IDC_COMBO_IsOilPumpHtSpace, str_comboIsOilPumpInHeatedSpace);
	DDX_CBString(pDX, IDC_COMBO_isOilBoilerInstalled, str_comboOilBoilerInstalled);
	DDX_Text(pDX, IDC_EDIT_CPSUtemp, str_editCPSUopTemp);
	DDX_Text(pDX, IDC_EDIT_HeatEmm, str_editHtEmmFromCase);
	DDX_Text(pDX, IDC_EDIT_HtTransferToWater, str_editHtTransferredToWater);
	DDX_CBString(pDX, IDC_COMBO_smokeControlArea, str_comboSmokeControlArea);
	DDX_CBString(pDX, IDC_COMBO_IsCHPpresent, str_comboIsCHPpresent);
	DDX_CBString(pDX, IDC_COMBO_CHPfuel, str_comboCHPFuel);
	DDX_Text(pDX, IDC_EDIT_fractionOfHeatCHP, str_editFractOfHtFromCHP);
	DDX_Text(pDX, IDC_EDIT_EEofCHP, str_editElecEffofCHP);
	DDX_Text(pDX, IDC_EDIT_HtEffofCHP, str_editHtEffofCHP);
	DDX_CBString(pDX, IDC_COMBO_Fuel, str_comboFuel);
	DDX_CBString(pDX, IDC_COMBO_system, str_comboSystem);
	DDX_Text(pDX, IDC_EDIT_efficiency, str_editEff);
	DDX_Text(pDX, IDC_EDIT_fractOfHtFromBoiler2, str_editFractofHtFromBoiler2);
	DDX_Text(pDX, IDC_EDIT_ManufactDesc, str_editManufactDesc);
	DDX_Control(pDX, IDC_STATIC_oilPump, m_labelOilPump);
	DDX_Control(pDX, IDC_STATIC_oilBoiler, m_labelOilBoiler);
	DDX_Control(pDX, IDC_STATIC_CHP, m_labelCHPyn);
	DDX_Control(pDX, IDC_STATIC_CHPfuel, m_labelCHPfuel);
	DDX_Control(pDX, IDC_STATIC_CHPfraction, m_labelCHPheatFraction);
	DDX_Control(pDX, IDC_STATIC_CHPeff, m_labelCHPElecEff);
	DDX_Control(pDX, IDC_STATIC_CHPheatEff, m_labelCHPHeatEff);
	DDX_Control(pDX, IDC_STATIC_per1, m_labelPer1);
	DDX_Control(pDX, IDC_STATIC_per2, m_labelPer2);
	DDX_Control(pDX, IDC_STATIC_rangeCooker1, m_labelRangeCookerHeatEmm);
	DDX_Control(pDX, IDC_STATIC_rangeCooker2, m_labelRangeCookerHeatTransfer);
	DDX_Control(pDX, IDC_STATIC_rangeCookerKW1, m_labelRangeCookerHeatEmmkW);
	DDX_Control(pDX, IDC_STATIC_rangeCookerKW2, m_labelRangeCookerHeatTransferkW);
	DDX_Control(pDX, IDC_STATIC_CPSU, m_labelCPSU);
}

BEGIN_MESSAGE_MAP(CDlg_MainHeatingDetails, CDialog)
	ON_CBN_SELCHANGE(IDC_COMBO_IsOilPumpHtSpace, OnCbnSelchangeComboIsoilpumphtspace)
	ON_CBN_SELCHANGE(IDC_COMBO_isOilBoilerInstalled, OnCbnSelchangeComboisoilboilerinstalled)
	ON_EN_CHANGE(IDC_EDIT_CPSUtemp, OnEnChangeEditCpsutemp)
	ON_EN_CHANGE(IDC_EDIT_HeatEmm, OnEnChangeEditHeatemm)
	ON_EN_CHANGE(IDC_EDIT_HtTransferToWater, OnEnChangeEditHttransfertowater)
	ON_CBN_SELCHANGE(IDC_COMBO_smokeControlArea, OnCbnSelchangeCombosmokecontrolarea)
	ON_CBN_SELCHANGE(IDC_COMBO_IsCHPpresent, OnCbnSelchangeComboIschppresent)
	ON_CBN_SELCHANGE(IDC_COMBO_CHPfuel, OnCbnSelchangeComboChpfuel)
	ON_EN_CHANGE(IDC_EDIT_fractionOfHeatCHP, OnEnChangeEditfractionofheatchp)
	ON_EN_CHANGE(IDC_EDIT_EEofCHP, OnEnChangeEditEeofchp)
	ON_EN_CHANGE(IDC_EDIT_HtEffofCHP, OnEnChangeEditHteffofchp)
	ON_CBN_SELCHANGE(IDC_COMBO_Fuel, OnCbnSelchangeComboFuel)
	ON_CBN_SELCHANGE(IDC_COMBO_system, OnCbnSelchangeCombosystem)
	ON_EN_CHANGE(IDC_EDIT_efficiency, OnEnChangeEditefficiency)
	ON_EN_CHANGE(IDC_EDIT_fractOfHtFromBoiler2, OnEnChangeEditfractofhtfromboiler2)
	ON_EN_CHANGE(IDC_EDIT_ManufactDesc, OnEnChangeEditManufactdesc)
END_MESSAGE_MAP()


// CDlg_MainHeatingDetails message handlers

BOOL CDlg_MainHeatingDetails::OnInitDialog()
{
	CDialog::OnInitDialog();

	//---------------------------------------------------
	// LABELS
	//---------------------------------------------------
	CFont *m_Font1 = new CFont;
	m_Font1->CreatePointFont(90, "Arial Bold");

	m_labelWetCentralHt.SetFont(m_Font1); 
	m_labelWetCentralHt.SetTextColor(BLUE); 

	m_labelRangeCooker.SetFont(m_Font1); 
	m_labelRangeCooker.SetTextColor(BLUE); 

	m_labelSmokeControl.SetFont(m_Font1); 
	m_labelSmokeControl.SetTextColor(BLUE); 

	m_labelCHP.SetFont(m_Font1); 
	m_labelCHP.SetTextColor(BLUE); 

	m_labelSecComBoiler.SetFont(m_Font1); 
	m_labelSecComBoiler.SetTextColor(BLUE); 

	//---------------------------------------------------
	// DROP DOWN MENUS
	//---------------------------------------------------
	AddStringsToComboBoxesForMainHeatingDetailedDlg();
	
	//---------------------------------------------------
	// If user selects File > New select defaults
	//---------------------------------------------------
	if(file_new_selected ==true)
	{
		SetAllValuesToDefault();		
	}

	DisplayValuesForMainHeatingDetailedDlg();

	if(mainFuel == "Oil")
	{
		m_labelOilPump.ShowWindow(TRUE);
		m_labelOilBoiler.ShowWindow(TRUE);

		m_comboIsOilPumpInHeatedSpace.ShowWindow(TRUE);
		m_comboOilBoilerInstalled.ShowWindow(TRUE);
	}
	else
	{
		m_labelOilPump.ShowWindow(FALSE);
		m_labelOilBoiler.ShowWindow(FALSE);

		m_comboIsOilPumpInHeatedSpace.ShowWindow(FALSE);
		m_comboOilBoilerInstalled.ShowWindow(FALSE);
	}

	if(mainHtType == "Community heating")
	{
		m_labelCHPyn.SetWindowText("Is there CHP");
		m_labelCHPfuel.ShowWindow(TRUE);
		m_labelCHPheatFraction.ShowWindow(TRUE);
		m_labelCHPElecEff.ShowWindow(TRUE);
		m_labelCHPHeatEff.ShowWindow(TRUE);
		m_labelPer1.ShowWindow(TRUE);
		m_labelPer2.ShowWindow(TRUE);
	
		m_comboIsCHPpresent.ShowWindow(TRUE);
		m_comboCHPFuel.ShowWindow(TRUE);
		m_editFractOfHtFromCHP.ShowWindow(TRUE);
		m_editElecEffofCHP.ShowWindow(TRUE);
		m_editHtEffofCHP.ShowWindow(TRUE);		
	}
	else
	{
		m_labelCHPyn.SetWindowText("CHP is not selected as main heating type");
		//m_labelCHPyn.ShowWindow(FALSE);
		m_labelCHPfuel.ShowWindow(FALSE);
		m_labelCHPheatFraction.ShowWindow(FALSE);
		m_labelCHPElecEff.ShowWindow(FALSE);
		m_labelCHPHeatEff.ShowWindow(FALSE);
		m_labelPer1.ShowWindow(FALSE);
		m_labelPer2.ShowWindow(FALSE);

		m_comboIsCHPpresent.ShowWindow(FALSE);
		m_comboCHPFuel.ShowWindow(FALSE);
		m_editFractOfHtFromCHP.ShowWindow(FALSE);
		m_editElecEffofCHP.ShowWindow(FALSE);
		m_editHtEffofCHP.ShowWindow(FALSE);
	}

	if((mainHtType == "Boiler") && (boilerType == "Range cooker"))
	{
		m_labelRangeCookerHeatEmm.SetWindowText("Heat emission form case");
		m_labelRangeCookerHeatTransfer.ShowWindow(TRUE);
		m_labelRangeCookerHeatEmmkW.ShowWindow(TRUE);
		m_labelRangeCookerHeatTransferkW.ShowWindow(TRUE);

		m_editHtEmmFromCase.ShowWindow(TRUE);
		m_editHtTransferredToWater.ShowWindow(TRUE);
	}
	else
	{
		m_labelRangeCookerHeatEmm.SetWindowText("Range cooker is not selected as boiler type");
		m_labelRangeCookerHeatTransfer.ShowWindow(FALSE);
		m_labelRangeCookerHeatEmmkW.ShowWindow(FALSE);
		m_labelRangeCookerHeatTransferkW.ShowWindow(FALSE);

		m_editHtEmmFromCase.ShowWindow(FALSE);
		m_editHtTransferredToWater.ShowWindow(FALSE);
	}

	if(boilerType == "CPSU")
	{
		m_labelCPSU.SetWindowText("CPSU operating temp");
		m_editCPSUopTemp.ShowWindow(TRUE);
	}
	else
	{
		m_labelCPSU.SetWindowText("CPSU is not selected as boiler type");
		m_editCPSUopTemp.ShowWindow(FALSE);
	}
	UpdateData(false);

	return TRUE;
}

void CDlg_MainHeatingDetails::AddStringsToComboBoxesForMainHeatingDetailedDlg()
{
	m_comboIsOilPumpInHeatedSpace.InsertString(0,"Yes");
	m_comboIsOilPumpInHeatedSpace.InsertString(1,"No");

	m_comboOilBoilerInstalled.InsertString(0,"Before 1 April 2007");
	m_comboOilBoilerInstalled.InsertString(1,"On or after April 2001");

	m_comboSmokeControlArea.InsertString(0,"No");
	m_comboSmokeControlArea.InsertString(1,"Yes");

	m_comboIsCHPpresent.InsertString(0,"No");
	m_comboIsCHPpresent.InsertString(1,"Yes");

	m_comboCHPFuel.InsertString(0,"Mains gas");
	m_comboCHPFuel.InsertString(1,"LPG");
	m_comboCHPFuel.InsertString(2,"Oil");
	m_comboCHPFuel.InsertString(3,"House coal");
	m_comboCHPFuel.InsertString(4,"Anthracite");
	m_comboCHPFuel.InsertString(5,"Waste combustion");
	m_comboCHPFuel.InsertString(6,"Wood logs");
	m_comboCHPFuel.InsertString(7,"Wood chips");
	m_comboCHPFuel.InsertString(8,"Wood pallets");
	m_comboCHPFuel.InsertString(9,"Biogas(landfill)");

	m_comboFuel.InsertString(0,"Mains gas");
	m_comboFuel.InsertString(1,"LPG");
	m_comboFuel.InsertString(2,"Oil");
	m_comboFuel.InsertString(3,"House coal");
	m_comboFuel.InsertString(4,"Anthracite");
	m_comboFuel.InsertString(5,"Waste combustion");
	m_comboFuel.InsertString(6,"Wood logs");
	m_comboFuel.InsertString(7,"Wood chips");
	m_comboFuel.InsertString(8,"Wood pallets");
	m_comboFuel.InsertString(9,"Biogas(landfill)");
	m_comboFuel.InsertString(10,"Waste heat");
	m_comboFuel.InsertString(11,"Geothermal heat source");

	m_comboSystem.InsertString(0,"Pre 1991 - 120-140°C full flow");
	m_comboSystem.InsertString(1,"Pre 1991 - Up to 100°C full flow");
	m_comboSystem.InsertString(2,"1991 or later - Up to 120°C variable flow");
	m_comboSystem.InsertString(3,"1991 or later - Up to 100°C variable flow");
}

void CDlg_MainHeatingDetails::DisplayValuesForMainHeatingDetailedDlg()
{
	str_comboIsOilPumpInHeatedSpace.Format("%s",oilPumpInHeatedSpace);
	str_comboOilBoilerInstalled.Format("%s",oilBoilerInstalled);

	str_editCPSUopTemp.Format("%.1f",CPSUoperatingTemp);
	str_editHtEmmFromCase.Format("%.1f",heatEmmFromCase);
	str_editHtTransferredToWater.Format("%.1f",heatTransferredToWater);

	str_comboSmokeControlArea.Format("%s",smokeControlledArea);
	str_comboIsCHPpresent.Format("%s",isThereCHP);
	str_comboCHPFuel.Format("%s",CHPfuel);

	str_editFractOfHtFromCHP.Format("%.1f",fractOfHtFromCHP);
	str_editElecEffofCHP.Format("%.1f",elecEffOfCHP);
	str_editHtEffofCHP.Format("%.1f",heatingEffOfCHP);

	str_comboFuel.Format("%s",secComBoilerFuel);
	str_comboSystem.Format("%s",secComBoilerSystem);

	str_editEff.Format("%.1f",secComBoilerEff);
	str_editFractofHtFromBoiler2.Format("%.1f",secComBoilerFractOfHtFromBoiler2);
	str_editManufactDesc.Format("%s",secComBoilerManufactDesc);

	UpdateData(FALSE);
}

void CDlg_MainHeatingDetails::ReadInputsFromMainHeatingDetailedDlg()
{
	UpdateData(TRUE);

	oilPumpInHeatedSpace = str_comboIsOilPumpInHeatedSpace;
	oilBoilerInstalled = str_comboOilBoilerInstalled;

	CPSUoperatingTemp = atof(str_editCPSUopTemp);
	heatEmmFromCase = atof(str_editHtEmmFromCase);
	heatTransferredToWater = atof(str_editHtTransferredToWater);

	smokeControlledArea = str_comboSmokeControlArea;
	isThereCHP = str_comboIsCHPpresent;
	CHPfuel = str_comboCHPFuel;

	fractOfHtFromCHP = atof(str_editFractOfHtFromCHP);
	elecEffOfCHP = atof(str_editElecEffofCHP);
	heatingEffOfCHP = atof(str_editHtEffofCHP);

	secComBoilerFuel = str_comboFuel;
	secComBoilerSystem = str_comboSystem;

	secComBoilerEff = atof(str_editEff);
	secComBoilerFractOfHtFromBoiler2 = atof(str_editFractofHtFromBoiler2);
	secComBoilerManufactDesc = str_editManufactDesc;
}
void CDlg_MainHeatingDetails::OnCbnSelchangeComboIsoilpumphtspace()
{
	ReadInputsFromMainHeatingDetailedDlg();
}

void CDlg_MainHeatingDetails::OnCbnSelchangeComboisoilboilerinstalled()
{
	ReadInputsFromMainHeatingDetailedDlg();
}

void CDlg_MainHeatingDetails::OnEnChangeEditCpsutemp()
{
	if(display_CPSUmsg_only_once == true)
	{
		display_CPSUmsg_only_once = false;
		MessageBox("Please enter value form Appendix F", "Help", MB_OK);
	}
	//------------------------------------------------------------------------------
	// Empty edit box if user types any character other than numeric characters or '.'
	UpdateData(TRUE);
	static TCHAR * lpszValidChars = _T(".0123456789");
	// szText is the string we want to check for invalid chracters
	if (_tcsspnp(str_editCPSUopTemp, lpszValidChars) != 0) 
	{
		str_editCPSUopTemp = " ";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromMainHeatingDetailedDlg();
}

void CDlg_MainHeatingDetails::OnEnChangeEditHeatemm()
{
	//------------------------------------------------------------------------------
	// Empty edit box if user types any character other than numeric characters or '.'
	UpdateData(TRUE);
	static TCHAR * lpszValidChars = _T(".0123456789");
	// szText is the string we want to check for invalid chracters
	if (_tcsspnp(str_editHtEmmFromCase, lpszValidChars) != 0) 
	{
		str_editHtEmmFromCase = " ";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromMainHeatingDetailedDlg();
}

void CDlg_MainHeatingDetails::OnEnChangeEditHttransfertowater()
{
	//------------------------------------------------------------------------------
	// Empty edit box if user types any character other than numeric characters or '.'
	UpdateData(TRUE);
	static TCHAR * lpszValidChars = _T(".0123456789");
	// szText is the string we want to check for invalid chracters
	if (_tcsspnp(str_editHtTransferredToWater, lpszValidChars) != 0) 
	{
		str_editHtTransferredToWater = " ";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromMainHeatingDetailedDlg();
}

void CDlg_MainHeatingDetails::OnCbnSelchangeCombosmokecontrolarea()
{
	ReadInputsFromMainHeatingDetailedDlg();
}

void CDlg_MainHeatingDetails::OnCbnSelchangeComboIschppresent()
{
	ReadInputsFromMainHeatingDetailedDlg();
}

void CDlg_MainHeatingDetails::OnCbnSelchangeComboChpfuel()
{
	ReadInputsFromMainHeatingDetailedDlg();
}

void CDlg_MainHeatingDetails::OnEnChangeEditfractionofheatchp()
{
	//------------------------------------------------------------------------------
	// Empty edit box if user types any character other than numeric characters or '.'
	UpdateData(TRUE);
	static TCHAR * lpszValidChars = _T(".0123456789");
	// szText is the string we want to check for invalid chracters
	if (_tcsspnp(str_editFractOfHtFromCHP, lpszValidChars) != 0) 
	{
		str_editFractOfHtFromCHP = " ";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromMainHeatingDetailedDlg();
}

void CDlg_MainHeatingDetails::OnEnChangeEditEeofchp()
{
	//------------------------------------------------------------------------------
	// Empty edit box if user types any character other than numeric characters or '.'
	UpdateData(TRUE);
	static TCHAR * lpszValidChars = _T(".0123456789");
	// szText is the string we want to check for invalid chracters
	if (_tcsspnp(str_editElecEffofCHP, lpszValidChars) != 0) 
	{
		str_editElecEffofCHP = " ";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromMainHeatingDetailedDlg();
}

void CDlg_MainHeatingDetails::OnEnChangeEditHteffofchp()
{
	//------------------------------------------------------------------------------
	// Empty edit box if user types any character other than numeric characters or '.'
	UpdateData(TRUE);
	static TCHAR * lpszValidChars = _T(".0123456789");
	// szText is the string we want to check for invalid chracters
	if (_tcsspnp(str_editHtEffofCHP, lpszValidChars) != 0) 
	{
		str_editHtEffofCHP = " ";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromMainHeatingDetailedDlg();
}

void CDlg_MainHeatingDetails::OnCbnSelchangeComboFuel()
{
	ReadInputsFromMainHeatingDetailedDlg();
}

void CDlg_MainHeatingDetails::OnCbnSelchangeCombosystem()
{
	ReadInputsFromMainHeatingDetailedDlg();
}

void CDlg_MainHeatingDetails::OnEnChangeEditefficiency()
{
	//------------------------------------------------------------------------------
	// Empty edit box if user types any character other than numeric characters or '.'
	UpdateData(TRUE);
	static TCHAR * lpszValidChars = _T(".0123456789");
	// szText is the string we want to check for invalid chracters
	if (_tcsspnp(str_editEff, lpszValidChars) != 0) 
	{
		str_editEff = " ";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromMainHeatingDetailedDlg();
}

void CDlg_MainHeatingDetails::OnEnChangeEditfractofhtfromboiler2()
{
	//------------------------------------------------------------------------------
	// Empty edit box if user types any character other than numeric characters or '.'
	UpdateData(TRUE);
	static TCHAR * lpszValidChars = _T(".0123456789");
	// szText is the string we want to check for invalid chracters
	if (_tcsspnp(str_editFractofHtFromBoiler2, lpszValidChars) != 0) 
	{
		str_editFractofHtFromBoiler2 = " ";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromMainHeatingDetailedDlg();
}

void CDlg_MainHeatingDetails::OnEnChangeEditManufactdesc()
{
	//------------------------------------------------------------------------------
	// Empty edit box if user types any character other than numeric characters or '.'
	UpdateData(TRUE);
	static TCHAR * lpszValidChars = _T("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-*&%!'@#_:;.0123456789 ");
	// szText is the string we want to check for invalid chracters
	if (_tcsspnp(str_editManufactDesc, lpszValidChars) != 0) 
	{
		str_editManufactDesc = " ";
		UpdateData(FALSE);
		return;
	}
	ReadInputsFromMainHeatingDetailedDlg();
}


BOOL CDlg_MainHeatingDetails::PreTranslateMessage(MSG* pMsg) 
{
	// TODO: Add your specialized code here and/or call the base class
	if(pMsg->message==WM_KEYDOWN)
	{
		if(pMsg->wParam==VK_RETURN || pMsg->wParam==VK_ESCAPE)
			pMsg->wParam=NULL ;
	} 

	return CDialog::PreTranslateMessage(pMsg);
}