?? fixedassetsview.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("固定資產(chǎn)管理系統(tǒng)") );
//改變背景顏色
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="資產(chǎn)類別"; //確定應(yīng)讀取數(shù)據(jù)庫中的表“資產(chǎn)類別”
dlg.m_strField="資產(chǎn)類別"; //表“資產(chǎn)類別”的名稱字段為“資產(chǎn)類別”
dlg.m_strLabel="資產(chǎn)類別"; //名稱編輯框前提示標簽信息為“資產(chǎn)類別”
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();
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -