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

📄 fixedassetsview.cpp

📁 关于固定资产管理系统的源码
💻 CPP
字号:
// FixedAssetsView.cpp : implementation of the CFixedAssetsView class
//

#include "stdafx.h"
#include "FixedAssets.h"
#include "FixedAssetsDoc.h"
#include "FixedAssetsView.h"
#include "AddModifyAssets.h"
#include "ClearAssets.h"
#include "LOAN1.h"
#include "Repair.h"
#include "DossierDlg.h"
#include "FindLoan.h"
#include "FindGiveback.h"
#include "FindRepair.h"
#include "FindILiquidate.h"
#include "FindDeprciation.h"
#include "FindOther.h"
#include "CRACK.h"
#include "LOAN1.h"
#include "GiveBack.h"
#include "Repair.h"
#include "Repaired.h"
#include "FindRepaired.h"

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

/////////////////////////////////////////////////////////////////////////////
// CFixedAssetsView

IMPLEMENT_DYNCREATE(CFixedAssetsView, CFormView)

BEGIN_MESSAGE_MAP(CFixedAssetsView, CFormView)
	//{{AFX_MSG_MAP(CFixedAssetsView)
	ON_COMMAND(ID_ADD, OnAdd)
	ON_COMMAND(ID_MODIFY, OnModify)
	ON_COMMAND(ID_LIQUIDATE, OnLiquidate)
	ON_COMMAND(ID_LOAN, OnLoan)
	ON_COMMAND(ID_SENDREPAIRE, OnRepaire)
	ON_COMMAND(ID_ASSETTYPE, OnAssettype)
	ON_COMMAND(ID_DEPARTMENT, OnDepartment)
	ON_COMMAND(ID_DEPOSITARY, OnDepositary)
	ON_COMMAND(ID_ADDMODE, OnAddmode)
	ON_COMMAND(ID_KEEPER, OnKeeper)
	ON_COMMAND(ID_CLEARTYPE, OnCleartype)
	ON_COMMAND(ID_FIND_LOAN, OnFindLoan)
	ON_COMMAND(ID_FIND_GIVEBACK, OnFindGiveback)
	ON_COMMAND(ID_FIND_REPAIR, OnFindRepair)
	ON_COMMAND(ID_FIND_LIQUIDATE, OnFindLiquidate)
	ON_COMMAND(ID_FIND_OTHER, OnFindOther)
	ON_COMMAND(ID_FIND_DEPRECIATION, OnFindDepreciation)
	ON_COMMAND(ID_GIVEBACK, OnGiveBack)
	ON_COMMAND(ID_REPAIRED, OnRepaired)
	ON_COMMAND(ID_FIND_REPAIRED, OnFindRepaired)
	//}}AFX_MSG_MAP
	// Standard printing commands
	ON_COMMAND(ID_FILE_PRINT, CFormView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_DIRECT, CFormView::OnFilePrint)
	ON_COMMAND(ID_FILE_PRINT_PREVIEW, CFormView::OnFilePrintPreview)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CFixedAssetsView construction/destruction

CFixedAssetsView::CFixedAssetsView()
	: CFormView(CFixedAssetsView::IDD)
{
	//{{AFX_DATA_INIT(CFixedAssetsView)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	// TODO: add construction code here

}

CFixedAssetsView::~CFixedAssetsView()
{
}

void CFixedAssetsView::DoDataExchange(CDataExchange* pDX)
{
	CFormView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CFixedAssetsView)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}

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

	return CFormView::PreCreateWindow(cs);
}

void CFixedAssetsView::OnInitialUpdate()
{
	CFormView::OnInitialUpdate();
	
	GetParentFrame()->RecalcLayout();
	ResizeParentToFit();
	
}

/////////////////////////////////////////////////////////////////////////////
// CFixedAssetsView printing

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

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

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

void CFixedAssetsView::OnPrint(CDC* pDC, CPrintInfo* /*pInfo*/)
{
	// TODO: add customized printing code here
}

/////////////////////////////////////////////////////////////////////////////
// CFixedAssetsView diagnostics

#ifdef _DEBUG
void CFixedAssetsView::AssertValid() const
{
	CFormView::AssertValid();
}

void CFixedAssetsView::Dump(CDumpContext& dc) const
{
	CFormView::Dump(dc);
}

CFixedAssetsDoc* CFixedAssetsView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CFixedAssetsDoc)));
	return (CFixedAssetsDoc*)m_pDocument;
}
#endif //_DEBUG
void CFixedAssetsView::OnDraw(CDC* pDC) 
{   
	AfxGetMainWnd ( )->SetWindowText (_T("固定资产管理系统") ); 
    //改变背景颜色
	CBrush Brush(RGB(180,250,200));
// Select the brush into the device context . 
    CBrush* pOldBrush = pDC->SelectObject (&Brush); 
// Get the area that needs to be erased . 
    CRect rcClip ; 
    pDC->GetClipBox (&rcClip); 
//Paint the area. 
    pDC->PatBlt(rcClip.left,rcClip.top,rcClip.Width(),rcClip.Height(),PATCOPY); 
//Unselect brush out of device context . 
    pDC->SelectObject (pOldBrush );
	//加背景图
    IPicture *pPic;
    IStream *pStm;
	CClientDC dc(this);
    CFileStatus fstatus;
    CFile file;
    LONG cb;
	char path[MAX_PATH] = {'\0'};
	CString m_strExePath;
	GetModuleFileName(NULL,path,MAX_PATH);
	m_strExePath.Format("%s", path);
	int iPosition;
	iPosition = m_strExePath.ReverseFind('\\');
	m_strExePath = m_strExePath.Left(iPosition + 1);
    m_strExePath+="Winter.jpg";
	if (file.Open(m_strExePath,CFile::modeRead)&&file.GetStatus(m_strExePath,fstatus)&&((cb =fstatus.m_size) != -1))
    {
       HGLOBAL hGlobal = GlobalAlloc(GMEM_MOVEABLE, cb);
       LPVOID pvData = NULL;
       if (hGlobal != NULL)
	   {
          if ((pvData = GlobalLock(hGlobal)) != NULL)
		  {
              file.ReadHuge(pvData, cb);
              GlobalUnlock(hGlobal);
              CreateStreamOnHGlobal(hGlobal, TRUE, &pStm);
              if(SUCCEEDED(OleLoadPicture(pStm,fstatus.m_size,TRUE,IID_IPicture,(LPVOID*)&pPic)))
			  {
                   OLE_XSIZE_HIMETRIC hmWidth;
                   OLE_YSIZE_HIMETRIC hmHeight;    
                   pPic->get_Width(&hmWidth);
                   pPic->get_Height(&hmHeight);
				   CRect rect;
				   GetWindowRect(&rect);
                   double fX,fY;
                   fX=(double)dc.GetDeviceCaps(HORZRES)*(double)hmWidth/((double)dc.GetDeviceCaps(HORZSIZE)*100.0);
                   fY=(double)dc.GetDeviceCaps(VERTRES)*(double)hmHeight/((double)dc.GetDeviceCaps(VERTSIZE)*100.0);
                   if(FAILED(pPic->Render(dc,(rect.Width()-(DWORD)fX)/2,(rect.Height()-(DWORD)fY)/2,(DWORD)fX,(DWORD)fY,0,hmHeight,hmWidth,-hmHeight,NULL)))
                     AfxMessageBox("Failed To Render The picture!");
                   pPic->Release();
			  }
              else
                   AfxMessageBox("Error Loading Picture From Stream!");
		  }
	   }
	}
    else
       AfxMessageBox("Can't Open Image File!");   
}
/////////////////////////////////////////////////////////////////////////////
// CFixedAssetsView message handlers

void CFixedAssetsView::OnAdd()     //增加
{
    CAddModifyAssets dlg;
	dlg.AddModify=1;
    dlg.DoModal();
}

void CFixedAssetsView::OnModify() //变更
{
	CAddModifyAssets dlg;
	dlg.AddModify=0;
	dlg.DoModal();
}

void CFixedAssetsView::OnLiquidate()   //清理
{
	CClearAssets dlg; 
	dlg.DoModal();
	
}

void CFixedAssetsView::OnLoan() 
{
	// TODO: Add your command handler code here
	CLOAN dlg;
	dlg.DoModal();
}
void CFixedAssetsView::OnGiveBack() 
{
   	CGiveBack dlg;
	dlg.DoModal();
}
void CFixedAssetsView::OnRepaire() 
{
	// TODO: Add your command handler code here
	CRepair dlg;
	dlg.DoModal();
}

void CFixedAssetsView::OnRepaired() 
{
   	CRepaired dlg;
	dlg.DoModal();
}

void CFixedAssetsView::OnAssettype() 
{
   CDossierDlg  dlg;                    //为类CDossierDlg建立新对象
   dlg.m_strTableName="资产类别";       //确定应读取数据库中的表“资产类别” 
   dlg.m_strField="资产类别";           //表“资产类别”的名称字段为“资产类别”
   dlg.m_strLabel="资产类别";           //名称编辑框前提示标签信息为“资产类别”
   dlg.DoModal();                       //显示模式对话框
}

void CFixedAssetsView::OnDepartment() 
{
	CDossierDlg  dlg;
    dlg.m_strTableName="部门";
    dlg.m_strField="部门名称";
	dlg.m_strLabel="部门名称";
    dlg.DoModal();
}

void CFixedAssetsView::OnDepositary() 
{
    CDossierDlg  dlg;
	dlg.m_strTableName="存放地点";
    dlg.m_strField="存放地点";
	dlg.m_strLabel="存放地点";
    dlg.DoModal();	
}

void CFixedAssetsView::OnAddmode() 
{
     CDossierDlg  dlg;
	 dlg.m_strTableName="增加方式";
     dlg.m_strField="增加方式";
	 dlg.m_strLabel="增加方式";
     dlg.DoModal();		
}

void CFixedAssetsView::OnKeeper() 
{
	CDossierDlg  dlg;
	dlg.m_strTableName="保管人员";
    dlg.m_strField="保管人员";
	dlg.m_strLabel="保管人员";
    dlg.DoModal();	
	
}

void CFixedAssetsView::OnCleartype() 
{
    CDossierDlg  dlg;
	dlg.m_strTableName="清理方式";
    dlg.m_strField="清理方式";
	dlg.m_strLabel="清理方式";
    dlg.DoModal();	
		
}

void CFixedAssetsView::OnFindLoan() 
{
    CFindLoan dlg;
	dlg.DoModal();
}

void CFixedAssetsView::OnFindGiveback() 
{
    CFindGiveback dlg;
	dlg.DoModal();
}

void CFixedAssetsView::OnFindRepair() 
{
    CFindRepair dlg;
	dlg.DoModal();
}

void CFixedAssetsView::OnFindLiquidate() 
{
   CFindILiquidate dlg;
   dlg.DoModal();
}
void CFixedAssetsView::OnFindRepaired() 
{
    CFindRepaired dlg;
	dlg.DoModal();
}

void CFixedAssetsView::OnFindDepreciation() 
{
    CFindDeprciation dlg;
	dlg.DoModal();	
}
void CFixedAssetsView::OnFindOther() 
{
   CFindOther dlg;
   dlg.DoModal();
}


⌨️ 快捷键说明

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