// After.cpp : implementation file
//

#include "stdafx.h"
#include "Test.h"
#include "After.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CAfter dialog


CAfter::CAfter(CWnd* pParent /*=NULL*/)
	: CDialog(CAfter::IDD, pParent)
{
	//{{AFX_DATA_INIT(CAfter)
	m_ed3 = _T("");
	m_ed2 = _T("");
	m_ed4 = _T("");
	m_ed5 = _T("");
	m_ed6 = _T("");
	m_ed1 = _T("");
	//}}AFX_DATA_INIT
}


void CAfter::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAfter)
	DDX_Text(pDX, IDC_EDIT3, m_ed3);
	DDX_Text(pDX, IDC_EDIT4, m_ed2);
	DDX_Text(pDX, IDC_EDIT5, m_ed4);
	DDX_Text(pDX, IDC_EDIT6, m_ed5);
	DDX_Text(pDX, IDC_EDIT7, m_ed6);
	DDX_Text(pDX, IDC_EDIT2, m_ed1);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CAfter, CDialog)
	//{{AFX_MSG_MAP(CAfter)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAfter message handlers


BOOL CAfter::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	char str[10];

	sprintf(str,"%d",Method);
	m_ed1= str;
    sprintf(str,"%d",Num);
	m_ed2= str;
	sprintf(str,"%d",Num-Cant);
	m_ed3=str;
	if (Num==0) Num=1;
	sprintf(str,"%d",100*(Num-Cant)/Num);
	m_ed4=str;
	sprintf(str,"%d",Summa);
	m_ed5=str;
	sprintf(str,"%d",Time);
	m_ed6=str;


	UpdateData(false);
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CAfter::OnOK() 
{
	// TODO: Add extra validation here
	
	pDoc->USumma[Method-1]=Summa;
	pDoc->UTime [Method-1]=Time;
	pDoc->UPercent[Method-1]=100*(Num-Cant)/Num;

    pDoc->StatData[pDoc->StatNo][0]= Method;
	pDoc->StatData[pDoc->StatNo][1]= Num;
	pDoc->StatData[pDoc->StatNo][2]= Num-Cant;
	pDoc->StatData[pDoc->StatNo][3]= 100*(Num-Cant)/Num;
	pDoc->StatData[pDoc->StatNo][4]= Summa;
	pDoc->StatData[pDoc->StatNo][5]= Time;
	pDoc->StatNo++;

	CDialog::OnOK();
}
