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

📄 dwysp.cpp

📁 企业合同管理系统:以企业合同为主线
💻 CPP
字号:
// Dwysp.cpp : implementation file
//

#include "stdafx.h"
#include "htglxt.h"
#include "Dwysp.h"
#include "DBaseQuery.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#include "ExternDllHeader.h"
#include "MyDoc.h"
#include "WyspView.h"
#include "MainFrm.h"
/////////////////////////////////////////////////////////////////////////////
// CDwysp dialog
extern CHtglxtApp theApp;

CDwysp::CDwysp(CWnd* pParent /*=NULL*/)
	: CDialog(CDwysp::IDD, pParent)
{
	//{{AFX_DATA_INIT(CDwysp)
	//}}AFX_DATA_INIT
}


void CDwysp::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CDwysp)
	DDX_Control(pDX, IDC_EDTJSJG, m_Edtjsjg);
	DDX_Control(pDX, IDC_EDTXXNR, m_Edtxxnr);
	DDX_Control(pDX, IDC_EDTXMMC, m_Edtxmmc);
	DDX_Control(pDX, IDC_EDTSPQK, m_Edtspqk);
	DDX_Control(pDX, IDC_EDTFZRQZ, m_Edtfzrqz);
	DDX_Control(pDX, IDC_EDTBM, m_Edtbm);
	DDX_Control(pDX, IDC_EDTBH, m_Edtbh);
	DDX_Control(pDX, IDC_DTRQ, m_Dtrq);
	DDX_Control(pDX, IDC_COMHTH, m_Comhth);
	DDX_Control(pDX, IDC_BUTSAVE1, m_ButSave);
	DDX_Control(pDX, IDC_BUTPRINT, m_ButPrint);
	DDX_Control(pDX, IDC_BUTEXIT1, m_ButExit);
	DDX_Control(pDX, IDC_BUTDELE, m_ButDele);
	DDX_Control(pDX, IDC_BUTADD, m_ButAdd);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CDwysp, CDialog)
	//{{AFX_MSG_MAP(CDwysp)
	ON_BN_CLICKED(IDC_BUTADD, OnButadd)
	ON_BN_CLICKED(IDC_BUTPRINT, OnButprint)
	ON_BN_CLICKED(IDC_BUTSAVE1, OnButsave1)
	ON_BN_CLICKED(IDC_BUTDELE, OnButdele)
	ON_BN_CLICKED(IDC_BUTEXIT1, OnButexit1)
	ON_CBN_KILLFOCUS(IDC_COMHTH, OnKillfocusComhth)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDwysp message handlers

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

void CDwysp::Clear()
{
	m_Edtxxnr.SetWindowText("");
	m_Edtxmmc.SetWindowText("");
	m_Edtspqk.SetWindowText("");
	m_Edtjsjg.SetWindowText("");
	m_Edtfzrqz.SetWindowText("");
	m_Edtbm.SetWindowText("");
	m_Edtbh.SetWindowText("");
	m_Dtrq.SetWindowText("");
	m_Comhth.SetWindowText("");	
}

void CDwysp::Display(CString sID)
{
	if(sID.IsEmpty())
		return;
	CString sSQL;
	RxRecordset drst;
	sSQL.Format("SELECT * FROM 违约索赔视图 WHERE 编号='%s'",sID);
	drst.Open(sSQL,adCmdText);
	if(drst.GetRecordCount()<1)
		return;
	CString sHTH,sXMMC,sBMMC,sWTRQ,sWTNR,sJSJG,sFZE,sSPQK;
	sHTH=drst.GetFieldValue("合同号");
	sXMMC=drst.GetFieldValue("项目名称");
	sBMMC=drst.GetFieldValue("部门名称");
	sWTRQ=drst.GetFieldValue("问题日期");
	sWTNR=drst.GetFieldValue("问题内容");
	sJSJG=drst.GetFieldValue("交涉结果");
	sFZE=drst.GetFieldValue("负责人");
	sSPQK=drst.GetFieldValue("索赔情况");
	m_Edtbh.SetWindowText(m_sID);
	m_Comhth.SetWindowText(sHTH);
	m_Edtxmmc.SetWindowText(sXMMC);
	m_Edtbm.SetWindowText(sBMMC);
	m_Edtxxnr.SetWindowText(sWTNR);
	m_Edtspqk.SetWindowText(sSPQK);
	m_Edtfzrqz.SetWindowText(sFZE);
	m_Edtjsjg.SetWindowText(sJSJG);	
	CTime time;
	time=CStringTOCTime(sWTRQ);
	this->m_Dtrq.SetTime(&time);
}

void CDwysp::Enabled(bool bEnabled)
{
	m_Edtxxnr.EnableWindow(bEnabled);
//	m_Edtxmmc.EnableWindow(bEnabled);
	m_Edtspqk.EnableWindow(bEnabled);
	m_Edtjsjg.EnableWindow(bEnabled);
	m_Edtfzrqz.EnableWindow(bEnabled);
	//m_Edtbm.EnableWindow(bEnabled);
	m_Dtrq.EnableWindow(bEnabled);
	m_Comhth.EnableWindow(bEnabled);
	m_ButSave.EnableWindow(bEnabled);
	m_ButPrint.EnableWindow(!bEnabled);
	m_ButExit.EnableWindow(!bEnabled);
	m_ButDele.EnableWindow(!bEnabled);
	m_ButAdd.EnableWindow(!bEnabled);
}

void CDwysp::OnButadd() 
{
	CString sNewID;
	sNewID=ado.AutoNumber("办理违约索赔记录","编号","WS",3);
	this->Clear();
	this->Enabled(true);
	this->m_Edtbh.SetWindowText(sNewID);
	this->m_Comhth.SetFocus();
		CTime time;
	time=time.GetCurrentTime();
	this->m_Dtrq.SetTime(&time);	
}

void CDwysp::OnButprint() 
{
	m_Edtbh.GetWindowText(PrintID);
	theApp.m_pDocManager=NULL;
	theApp.m_pMainWnd=NULL;
	CSingleDocTemplate* pDocTemplate;
	pDocTemplate = new CSingleDocTemplate(
		IDR_MAINFRAME,
		RUNTIME_CLASS(CMyDoc),
		RUNTIME_CLASS(CMainFrame),       // main SDI frame window
		RUNTIME_CLASS(CWyspView));
	theApp.AddDocTemplate(pDocTemplate);
	CCommandLineInfo cmdInfo;
	theApp.ParseCommandLine(cmdInfo);
	if (!theApp.ProcessShellCommand(cmdInfo))
		return ;
	theApp.m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);
	theApp.m_pMainWnd->UpdateWindow();	
}

void CDwysp::OnButsave1() 
{
	if(MessageBox("确定要保存记录吗?","系统提示",MB_OKCANCEL|MB_ICONQUESTION)!=1)
	return;
	CString sSQL,sBH,sHTH,sWTRQ,sWTNR,sJSJG,sFZE,sSPQK;
	m_Edtbh.GetWindowText(sBH);
	m_Comhth.GetWindowText(sHTH);
	m_Edtxxnr.GetWindowText(sWTNR);
	m_Edtspqk.GetWindowText(sSPQK);
	m_Edtfzrqz.GetWindowText(sFZE);
	m_Edtjsjg.GetWindowText(sJSJG);
	CTime time;
	m_Dtrq.GetTime(time);
	sWTRQ=CTimeToCString(time);
	sSQL.Format("INSERT INTO 办理违约索赔记录 VALUES('%s','%s','%s','%s','%s','%s','%s')",sBH,sHTH,sWTRQ,sWTNR,sJSJG,sFZE,sSPQK);
	RxRecordset sRst;
	sRst.Open(sSQL,adCmdText);
	this->Enabled(false);
	this->m_ButAdd.SetFocus();

}

void CDwysp::OnButdele() 
{
	CString sSQL,sID;
	m_Edtbh.GetWindowText(sID);

	if(MessageBox("确定要删除记录吗?","系统提示",MB_OKCANCEL|MB_ICONQUESTION)!=1)
		return;
	sSQL.Format("DELETE 办理违约索赔记录 WHERE 编号 ='%s'",sID);
	RxRecordset drst;
	drst.Open(sSQL,adCmdText);
	this->OnCancel();	
	
}

void CDwysp::OnButexit1() 
{
	this->OnCancel();	
}

BOOL CDwysp::OnInitDialog() 
{
	CDialog::OnInitDialog();
	CDBaseQuery* ParentWnd=(CDBaseQuery*)FindWindow(NULL,"违约索赔查询");
	m_sID=ParentWnd->m_Grid.GetItemText(ParentWnd->m_Grid.GetRow(),0);
	this->Display(m_sID);
	RxRecordset rst;
	rst.Open("合同签订记录");
	this->m_Comhth.SetRecordset(rst,"编号");
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CDwysp::OnKillfocusComhth() 
{
	CString shtbh,sSQL;
	this->m_Comhth.GetWindowText(shtbh);	
	if(shtbh.IsEmpty())
		return;
	sSQL.Format("SELECT * FROM 合同签订视图 WHERE 编号='%s'",shtbh);
	RxRecordset rst;
	rst.Open(sSQL,adCmdText);
	if(rst.GetRecordCount()<1)
	{
		MessageBox("您输入的合同编号有问题!请确定后重新输入!","系统提示",MB_OK|MB_ICONSTOP);
		m_Comhth.SetFocus();
		return;
	}
	else
	{
		CString sXMMC,sQSR,sBM,sXMZG;
		sXMMC=rst.GetFieldValue("项目");
		sBM=rst.GetFieldValue("部门");
		this->m_Edtxmmc.SetWindowText(sXMMC);
		this->m_Edtbm.SetWindowText(sBM);
	}			
}

⌨️ 快捷键说明

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