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

📄 gongziview.cpp

📁 VC++6.0编译的一个小的工资管理系统。这是源代码。所要的积分
💻 CPP
字号:
// gongziView.cpp : implementation of the CGongziView class
//

#include "stdafx.h"
#include "gongzi.h"

#include "gongziSet.h"
#include "gongziDoc.h"
#include "gongziView.h"

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

/////////////////////////////////////////////////////////////////////////////
// CGongziView

IMPLEMENT_DYNCREATE(CGongziView, CRecordView)

BEGIN_MESSAGE_MAP(CGongziView, CRecordView)
	//{{AFX_MSG_MAP(CGongziView)
	ON_BN_CLICKED(IDC_BUTTON_FIRST, OnButtonFirst)
	ON_BN_CLICKED(IDC_BUTTON_LAST, OnButtonLast)
	ON_BN_CLICKED(IDC_BUTTON_NEXT, OnButtonNext)
	ON_BN_CLICKED(IDC_BUTTON_PRE, OnButtonPre)
	ON_BN_CLICKED(IDC_BUTTON_EXE, OnButtonExe)
	ON_BN_CLICKED(IDC_RADIO_ADD, OnRadioAdd)
	ON_BN_CLICKED(IDC_RADIO_DEL, OnRadioDel)
	ON_BN_CLICKED(IDC_RADIO_UPDATE, OnRadioUpdate)
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CRecordView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CRecordView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CRecordView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CGongziView construction/destruction

CGongziView::CGongziView()
	: CRecordView(CGongziView::IDD)
{
	//{{AFX_DATA_INIT(CGongziView)
	m_pSet = NULL;
	//}}AFX_DATA_INIT
	// TODO: add construction code here

}

CGongziView::~CGongziView()
{
}

void CGongziView::DoDataExchange(CDataExchange* pDX)
{
	CRecordView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CGongziView)
	DDX_FieldText(pDX, IDC_EDIT_BAOXIAN, m_pSet->m_BAOXIAN, m_pSet);
	DDX_FieldText(pDX, IDC_EDIT_BUMEN, m_pSet->m_BUMEN, m_pSet);
	DDX_FieldText(pDX, IDC_EDIT_BUZHU, m_pSet->m_BUZHU, m_pSet);
	DDX_FieldText(pDX, IDC_EDIT_CHUXU, m_pSet->m_CHUXU, m_pSet);
	DDX_FieldText(pDX, IDC_EDIT_FANGZU, m_pSet->m_FANGZU, m_pSet);
	DDX_FieldText(pDX, IDC_EDIT_HUIFEI, m_pSet->m_HUIFEI, m_pSet);
	DDX_FieldText(pDX, IDC_EDIT_JBGONGZI, m_pSet->m_JBGONGZI, m_pSet);
	DDX_FieldText(pDX, IDC_EDIT_JIANGJIN, m_pSet->m_JIANGJIN, m_pSet);
	DDX_FieldText(pDX, IDC_EDIT_JINTIE, m_pSet->m_JINTIE, m_pSet);
	DDX_FieldText(pDX, IDC_EDIT_MONTH, m_pSet->m_MONTH, m_pSet);
	DDX_FieldText(pDX, IDC_EDIT_SHUIDIANFEI, m_pSet->m_SUIDIANFEI, m_pSet);
	DDX_FieldText(pDX, IDC_EDIT_YEAR, m_pSet->m_YEAR, m_pSet);
	DDX_FieldText(pDX, IDC_EDIT_YJGONGZI, m_pSet->m_YJGONGZI, m_pSet);
	DDX_FieldText(pDX, IDC_EDIT_ZGBH, m_pSet->m_ZGBH, m_pSet);
	DDX_FieldText(pDX, IDC_EDIT_ZGNAME, m_pSet->m_ZGNAME, m_pSet);
	DDX_FieldText(pDX, IDC_EDIT_KCSUM, m_pSet->m_KCSUM, m_pSet);
	DDX_FieldText(pDX, IDC_EDIT_SFZONGZI, m_pSet->m_SFGONGZI, m_pSet);
	DDX_FieldText(pDX, IDC_EDIT_YFSUM, m_pSet->m_YFSUM, m_pSet);
	//}}AFX_DATA_MAP
}

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

	return CRecordView::PreCreateWindow(cs);
}

void CGongziView::OnInitialUpdate()
{
	m_pSet = &GetDocument()->m_gongziSet;
	CRecordView::OnInitialUpdate();
	GetParentFrame()->RecalcLayout();
	ResizeParentToFit();

}

/////////////////////////////////////////////////////////////////////////////
// CGongziView printing

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CGongziView diagnostics

#ifdef _DEBUG
void CGongziView::AssertValid() const
{
	CRecordView::AssertValid();
}

void CGongziView::Dump(CDumpContext& dc) const
{
	CRecordView::Dump(dc);
}

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

/////////////////////////////////////////////////////////////////////////////
// CGongziView database support
CRecordset* CGongziView::OnGetRecordset()
{
	return m_pSet;
}


/////////////////////////////////////////////////////////////////////////////
// CGongziView message handlers

void CGongziView::OnButtonFirst() 
{
	m_pSet->MoveFirst();
	if(m_pSet->IsBOF())
	{
		MessageBox("记录已经再第一条了!");
		m_pSet->MoveNext();
		UpdateData(FALSE);
		return;
	}
	UpdateData(FALSE);
	
}

void CGongziView::OnButtonLast() 
{
	m_pSet->MoveLast();
	if(m_pSet->IsEOF())
	{
		MessageBox("记录已经在最后一条了!");
		m_pSet->MovePrev();
		UpdateData(FALSE);
		return;
	}
	UpdateData(FALSE);
	
}

void CGongziView::OnButtonNext() 
{
	m_pSet->MoveNext();
	if(m_pSet->IsEOF())
	{
		MessageBox("记录已经在最后一条了!");
		m_pSet->MovePrev();
		UpdateData(FALSE);
		return;
	}
	UpdateData(FALSE);
	
}

void CGongziView::OnButtonPre() 
{
	m_pSet->MovePrev();
	if(m_pSet->IsBOF())
	{
		MessageBox("记录已经再第一条了!");
		m_pSet->MoveNext();
		UpdateData(FALSE);
		return;
	}
	UpdateData(FALSE);
	
}

void CGongziView::OnButtonExe() 
{
	m_pSet->Edit();

	m_pSet->m_YFSUM=m_pSet->m_JBGONGZI+m_pSet->m_JIANGJIN+m_pSet->m_YJGONGZI
		+m_pSet->m_JINTIE+m_pSet->m_BUZHU;
	m_pSet->m_KCSUM=m_pSet->m_SUIDIANFEI+m_pSet->m_FANGZU+m_pSet->m_CHUXU
		+m_pSet->m_HUIFEI+m_pSet->m_BAOXIAN;
	m_pSet->m_SFGONGZI=m_pSet->m_YFSUM-m_pSet->m_KCSUM;

	UpdateData(FALSE);
	//m-pSet->Requery();
	m_pSet->Update();

	
}

void CGongziView::OnRadioAdd() 
{
	m_pSet->AddNew();
	UpdateData(FALSE);
	
}

void CGongziView::OnRadioDel() 
{
	m_pSet->Delete();
	m_pSet->MoveNext();
	if(m_pSet->IsEOF())
		m_pSet->MoveLast();
	if(m_pSet->IsBOF())
		m_pSet->SetFieldNull(NULL);
	UpdateData(TRUE);
	
}

void CGongziView::OnRadioUpdate() 
{
	UpdateData();
	m_pSet->Update();
	//m_pSet->Requery();
	m_pSet->MoveFirst();
	
}


⌨️ 快捷键说明

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