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

📄 dlost.cpp

📁 c++制作固定资产管理系统
💻 CPP
字号:
// DLost.cpp : implementation file
//

#include "stdafx.h"
#include "gdzc.h"
#include "DLost.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#include "externDllHeader.h"
/////////////////////////////////////////////////////////////////////////////
// CDLost dialog


CDLost::CDLost(CWnd* pParent /*=NULL*/)
	: CDialog(CDLost::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDLost)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CDLost::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDLost)
	DDX_Control(pDX, IDC_COMLOST, m_ComLost);
	DDX_Control(pDX, IDC_STAID2, m_StaID);
	DDX_Control(pDX, IDC_STACAPTION2, m_StaCaption);
	DDX_Control(pDX, IDC_EDTUNIT, m_EdtUnit);
	DDX_Control(pDX, IDC_EDTSPEC, m_EdtSpec);
	DDX_Control(pDX, IDC_EDTOUTPUT, m_EdtOutPut);
	DDX_Control(pDX, IDC_EDTNAME, m_EdtName);
	DDX_Control(pDX, IDC_EDTMEM, m_EdtMem);
	DDX_Control(pDX, IDC_EDTINPUT, m_EdtInput);
	DDX_Control(pDX, IDC_DTDATE, m_DtDate);
	DDX_Control(pDX, IDC_BUTSURE, m_ButSure);
	DDX_Control(pDX, IDC_BUTEXIT, m_ButExit);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDLost, CDialog)
	//{{AFX_MSG_MAP(CDLost)
	ON_BN_CLICKED(IDC_BUTSURE, OnButsure)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDLost message handlers

void CDLost::OnOK() 
{
	// TODO: Add extra validation here
	
	//CDialog::OnOK();
}

void CDLost::SetID(CString sID)
{
	this->m_sID=sID;
}

void CDLost::Display(CString sID)
{
	RxRecordset DspRst;
	CString sSQL;
	sSQL.Format("SELECT * FROM 固定资产信息视图 WHERE 编号='%s'",sID);
	DspRst.Open(sSQL,adCmdText);
	CString sName,sSpec,sUnit;
	sName=DspRst.GetFieldValue("名称");
	sSpec=DspRst.GetFieldValue("规格型号");
	sUnit=DspRst.GetFieldValue("单位");
	this->m_EdtName.SetWindowText(sName);
	this->m_EdtSpec.SetWindowText(sSpec);
	this->m_EdtUnit.SetWindowText(sUnit);

}

BOOL CDLost::OnInitDialog() 
{
	CDialog::OnInitDialog();
	CString LostID;
	LostID=ado.AutoNumber("固定资产减少表","编号","JS",2);
	this->m_StaID.SetWindowText(LostID);
	rst.Open("减少方式表");

	this->m_ComLost.SetRecordset(rst,"名称");
	this->Display(m_sID);	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CDLost::OnButsure() 
{
	CString sSQL,sLost,sLostID,sInput,sOutput,sMem,sDate;
	if(MessageBox("确定要减少此固定资产吗?","系统提示",MB_OKCANCEL|MB_ICONQUESTION)!=1)	
		return;
	m_ComLost.GetWindowText(sLost);
	sLostID=ado.FieldToOtherField("减少方式表","方式",sLost,"编号",1);
	m_EdtInput.GetWindowText(sInput);
	m_EdtOutPut.GetWindowText(sOutput);
	m_EdtMem.GetWindowText(sMem);
	CTime tDate;
	this->m_DtDate.GetTime(tDate);
	sDate=CTimeToCString(tDate);
	sSQL.Format("UPDATE 固定资产信息表 SET 减少否=1 WHERE 编号='%s'",m_sID);
	rst.Open(sSQL,adCmdText);
	sSQL.Format("INSERT INTO 固定资产减少表 VALUES ('%s',%s,%s,%s,'%s','%s')",m_sID,sLostID,sInput,sOutput,sMem,sDate);
	rst.Open(sSQL,adCmdText);
	MessageBox("固定资产减少成功!","确定",MB_OK|MB_ICONINFORMATION);
	this->OnCancel();

}

⌨️ 快捷键说明

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