⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wageview.cpp

📁 这是一个用VC++编写的工资管理系统
💻 CPP
字号:
// WageView.cpp : implementation of the CWageView class
//

#include "stdafx.h"
#include "Wage.h"
#include "Wage1.h"


#include "WageDoc.h"
#include "WageView.h"

#include "NewNum.h"
#include "DeleteNum.h"
#include "ChangeNum.h"
#include "mainshow.h"

#include "FirstInput.h"
#include "FirstInput2.h"
#include"EditNew.h"


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

/////////////////////////////////////////////////////////////////////////////
// CWageView

IMPLEMENT_DYNCREATE(CWageView, CView)

BEGIN_MESSAGE_MAP(CWageView, CView)
	//{{AFX_MSG_MAP(CWageView)
	ON_COMMAND(ID_PERSONINQUIRE, OnPersonInquire)
	ON_COMMAND(ID_ADDINFORMATION, OnAddInformation)
	ON_COMMAND(ID_DELETEINFORMATION, OnDeleteInformation)
	ON_COMMAND(ID_CHANGEINFORMATION, OnChangeInformation)
	ON_COMMAND(ID_ALLSHOW, OnAllshow)
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CWageView construction/destruction

CWageView::CWageView()
{
	// TODO: add construction code here

}

CWageView::~CWageView()
{
}

BOOL CWageView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CWageView drawing

void CWageView::OnDraw(CDC* pDC)
{
	CWageDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	// TODO: add draw code for native data here
	POSITION pos;
	CWage *elem;
	int hang=0;
	pos=m_pWageList->GetHeadPosition();
	while (pos!=NULL) 
	{
	elem=(CWage *)m_pWageList->GetAt(pos);
	elem->output(pDC,hang++);
	m_pWageList->GetNext(pos);
	}

	
}

/////////////////////////////////////////////////////////////////////////////
// CWageView printing

BOOL CWageView::OnPreparePrinting(CPrintInfo* pInfo)
{
	// default preparation
	return DoPreparePrinting(pInfo);
}

void CWageView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add extra initialization before printing
}

void CWageView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
	// TODO: add cleanup after printing
}

/////////////////////////////////////////////////////////////////////////////
// CWageView diagnostics

#ifdef _DEBUG
void CWageView::AssertValid() const
{
	CView::AssertValid();
}

void CWageView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CWageDoc* CWageView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CWageDoc)));
	return (CWageDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CWageView message handlers

void CWageView::OnPersonInquire()   //here
{
	// TODO: Add your command handler code here
		CFirstInput2 dlg;
		if(dlg.DoModal()!=IDOK)
			return;

		CMainShow dlg2;
		// Search(dlg.m_num1);
		CWage * pWage = NULL;
		for (POSITION pos = m_pWageList->GetHeadPosition();pos != NULL;)
		{
			pWage = (CWage*)m_pWageList->GetNext(pos);
			if (pWage->m_workernum == dlg.m_num1)
				break;
		}

		if (pWage == NULL) return;

		dlg2.m_num1 = dlg.m_num1;
		dlg2.m_addwage1 = pWage->m_addwage;
		dlg2.m_actualwage1 = pWage->m_actualgive;
		dlg2.m_basewage1 = pWage->m_basewage;
		dlg2.m_extrawage1 = pWage->m_extrawage;
		dlg2.m_houserent1 = pWage->m_houserent;
		dlg2.m_housewage1 = pWage->m_housewage;
		dlg2.m_meetingmoney1 = pWage->m_meetingmoney;
		dlg2.m_positionwage1 = pWage->m_positionwage;
		dlg2.m_shouldgive1   = pWage->m_shouldgive;
		dlg2.m_shouldsub	= pWage->m_shouldsub;
		dlg2.m_store1		= pWage->m_store;
		dlg2.m_tax1			= pWage->m_tax;
		dlg2.m_traficwage1	= pWage->m_trafficwage;

		if(dlg2.DoModal()==IDOK)
		{
			/*/
			m_month=dlg2.m_Nmonth;
			m_basewage=dlg2.m_Nbasewage;
			m_extrawage=dlg2.m_Nextrawage;
			m_positionwage=dlg2.m_Npositionwage;
			m_addwage=dlg2.m_Naddwage;
			m_housewage=dlg2.m_Nhousewage;
			m_trafficwage=dlg2.m_Ntraficwage;
			m_shouldgive=dlg2.m_Nshouldgive;
			m_houserent=dlg2.m_Nhouserent;
			m_store=dlg2.m_Nstore;
			m_meetingmoney=dlg2.m_Nmeetingmoney;
			m_tax=dlg2.m_Ntax;
			m_shouldsub=dlg2.m_Nshouldsub;
			m_actualgive=dlg2.m_Nactualgive;
			CWage *pWage =new CWage(dlg2.m_Nmonth,dlg.m_newnum,dlg2.m_Nbasewage,dlg2.m_Nextrawage,dlg2.m_Npositionwage,dlg2.m_Naddwage,dlg2.m_Nhousewage,dlg2.m_Ntraficwage,dlg2.m_Nhouserent,dlg2.m_Nstore,dlg2.m_Nmeetingmoney);
			m_WageListPosition=m_pWageList->AddTail(pWage);
			//*/
		}
}

void CWageView::OnAddInformation() 
{
	// TODO: Add your command handler code here
	CNewNum dlg;
	if(dlg.DoModal()!=IDOK)
		return;
	m_workernum=dlg.m_newnum;
	CEditNew dlg2;
	if(dlg2.DoModal()==IDOK)
	{
		m_month=dlg2.m_Nmonth;
		m_basewage=dlg2.m_Nbasewage;
		m_extrawage=dlg2.m_Nextrawage;
		m_positionwage=dlg2.m_Npositionwage;
		m_addwage=dlg2.m_Naddwage;
		m_housewage=dlg2.m_Nhousewage;
		m_trafficwage=dlg2.m_Ntraficwage;
		m_shouldgive=dlg2.m_Nshouldgive;
		m_houserent=dlg2.m_Nhouserent;
		m_store=dlg2.m_Nstore;
		m_meetingmoney=dlg2.m_Nmeetingmoney;
		m_tax=dlg2.m_Ntax;
		m_shouldsub=dlg2.m_Nshouldsub;
		m_actualgive=dlg2.m_Nactualgive;

		CWage *pWage =new CWage(dlg2.m_Nmonth,dlg.m_newnum,dlg2.m_Nbasewage,dlg2.m_Nextrawage,dlg2.m_Npositionwage,dlg2.m_Naddwage,dlg2.m_Nhousewage,dlg2.m_Ntraficwage,dlg2.m_Nhouserent,dlg2.m_Nstore,dlg2.m_Nmeetingmoney);
		m_WageListPosition=m_pWageList->AddTail(pWage);
	}	
}

void CWageView::OnDeleteInformation() 
{
	// TODO: Add your command handler code here
	CDeleteNum dlg;
	dlg.DoModal();
}

void CWageView::OnChangeInformation() 
{
	// TODO: Add your command handler code here
	CChangeNum dlg;
	dlg.DoModal();
}

void CWageView::OnMenuitemFirstInput()      //应该是OnMenuitemNewNum()
{
	CNewNum dlg;
	if(dlg.DoModal()!=IDOK)
		return;
	m_workernum=dlg.m_newnum;
	CEditNew dlg2;
	if(dlg2.DoModal()==IDOK)
	{
		m_month=dlg2.m_Nmonth;
		m_basewage=dlg2.m_Nbasewage;
		m_extrawage=dlg2.m_Nextrawage;
		m_positionwage=dlg2.m_Npositionwage;
		m_addwage=dlg2.m_Naddwage;
		m_housewage=dlg2.m_Nhousewage;
		m_trafficwage=dlg2.m_Ntraficwage;
		m_shouldgive=dlg2.m_Nshouldgive;
		m_houserent=dlg2.m_Nhouserent;
		m_store=dlg2.m_Nstore;
		m_meetingmoney=dlg2.m_Nmeetingmoney;
		m_tax=dlg2.m_Ntax;
		m_shouldsub=dlg2.m_Nshouldsub;
		m_actualgive=dlg2.m_Nactualgive;
		CWage *pWage =new CWage(dlg2.m_Nmonth,dlg.m_newnum,dlg2.m_Nbasewage,dlg2.m_Nextrawage,dlg2.m_Npositionwage,dlg2.m_Naddwage,dlg2.m_Nhousewage,dlg2.m_Ntraficwage,dlg2.m_Nhouserent,dlg2.m_Nstore,dlg2.m_Nmeetingmoney);
		m_WageListPosition=m_pWageList->AddTail(pWage);
	}	
}

void CWageView::OnInitialUpdate()
{
	CView::OnInitialUpdate();
	// TODO: Add your specialized code here and/or call the base class
	CWageDoc* pDoc = (CWageDoc*)GetDocument();
	ASSERT_VALID(pDoc);
//	m_pWageList=&GetDocument()->m_WageList;
	m_pWageList = &(pDoc->m_WageList);
	m_WageListPosition = m_pWageList->GetHeadPosition();

}

void CWageView::OnMenuitemDelete()			//删除某职工信息
{
	while (m_pWageList->IsEmpty()!=0)
	{
		delete m_pWageList->RemoveHead();			
	}
}

void CWageView::OnAllshow() 
{
	// TODO: Add your command handler code here
//	POSITION m_WageListPosition;
	//CObList* m_pWageList;
	CClientDC dc (this);
	CDC * pDC;
	pDC=GetDC();
	CWage * wage;
	m_WageListPosition=m_pWageList->GetHeadPosition();
	while(m_WageListPosition!=NULL)
	{
		wage=(CWage *)m_pWageList->GetAt(m_WageListPosition);
		wage->OnDraw(pDC);
		m_pWageList->GetNext(m_WageListPosition);
	}
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -