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

📄 chbhfdlg.cpp

📁 在VC++中对Orcale数据库的数据进行提取,然后分析,是挖掘的基础!
💻 CPP
📖 第 1 页 / 共 2 页
字号:
// ChbhfDlg.cpp : implementation file
//

#include "stdafx.h"
#include "Chbhf.h"
#include "ChbhfDlg.h"
#include "DialogPWD.h"
#include "Nsrjbxx.h"
#include "XTtbm.h"
#include "Gzdfb.h"
#include "GzdZb.h"
#include "WSLCT.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About


class CAboutDlg : public CDialog
{
public:
	CAboutDlg();

// Dialog Data
	//{{AFX_DATA(CAboutDlg)
	enum { IDD = IDD_ABOUTBOX };
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CAboutDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	//{{AFX_MSG(CAboutDlg)
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
	//{{AFX_DATA_INIT(CAboutDlg)
	//}}AFX_DATA_INIT
}

void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CAboutDlg)
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
	//{{AFX_MSG_MAP(CAboutDlg)
		// No message handlers
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CChbhfDlg dialog

CChbhfDlg::CChbhfDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CChbhfDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CChbhfDlg)
	m_cl = _T("");
	m_ts = _T("");
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CChbhfDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CChbhfDlg)
	DDX_Control(pDX, IDC_CL, m_CL);
	DDX_Control(pDX, IDC_TS, m_TS);
	DDX_Control(pDX, IDC_XZBC, m_xzbaocun);
	DDX_Control(pDX, IDC_XZ, m_xuanze);
	DDX_Control(pDX, IDC_TAB1, m_tab);
	DDX_Control(pDX, IDC_LIST4, m_list4);
	DDX_Control(pDX, IDC_LIST3, m_list3);
	DDX_Control(pDX, IDC_LIST2, m_list2);
	DDX_Control(pDX, IDC_LIST1, m_list1);
	DDX_Control(pDX, IDC_JSQX, m_jsquxiao);
	DDX_Control(pDX, IDC_JS, m_jieshou);
	DDX_Control(pDX, IDC_COMBO1, m_combo1);
	DDX_Control(pDX, IDC_BCQX, m_bcquxiao);
	DDX_Control(pDX, IDC_BC, m_baocun);
	DDX_Text(pDX, IDC_CL, m_cl);
	DDX_Text(pDX, IDC_TS, m_ts);
	//}}AFX_DATA_MAP
}

BEGIN_MESSAGE_MAP(CChbhfDlg, CDialog)
	//{{AFX_MSG_MAP(CChbhfDlg)
	ON_WM_SYSCOMMAND()
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	ON_BN_CLICKED(IDC_JS, OnJs)
	ON_BN_CLICKED(IDC_JSQX, OnJsqx)
	ON_BN_CLICKED(IDC_BC, OnBc)
	ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
	ON_CBN_EDITCHANGE(IDC_COMBO1, OnEditchangeCombo1)
	ON_NOTIFY(TCN_SELCHANGE, IDC_TAB1, OnSelchangeTab1)
	ON_WM_TIMER()
	ON_BN_CLICKED(IDC_XZ, OnXz)
	ON_WM_CTLCOLOR()
	ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
	ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
	ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CChbhfDlg message handlers

BOOL CChbhfDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Add "About..." menu item to system menu.

	// IDM_ABOUTBOX must be in the system command range.
	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
	ASSERT(IDM_ABOUTBOX < 0xF000);

	CMenu* pSysMenu = GetSystemMenu(FALSE);
	if (pSysMenu != NULL)
	{
		CString strAboutMenu;
		strAboutMenu.LoadString(IDS_ABOUTBOX);
		if (!strAboutMenu.IsEmpty())
		{
			pSysMenu->AppendMenu(MF_SEPARATOR);
			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
		}
	}

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon

	m_brush .CreateSolidBrush (RGB ( 20, 130, 180 ) ) ;
	init();
 
    combo1();
	FLASH();
	// TODO: Add extra initialization here
	
	return TRUE;// }
 //else return FALSE;// return TRUE  unless you set the focus to a control
}

void CChbhfDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
	if ((nID & 0xFFF0) == IDM_ABOUTBOX)
	{
		CAboutDlg dlgAbout;
		dlgAbout.DoModal();
	}
	else
	{
		CDialog::OnSysCommand(nID, lParam);
	}
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

void CChbhfDlg::OnPaint() 
{	
	CPaintDC dc(this); 
	
if (IsIconic())
	{
	// device context for painting

		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialog::OnPaint();
/*	
	RECT rect;
	this->GetClientRect(&rect);
	CBrush BGBrush;
	BGBrush.CreateSolidBrush(RGB(10,80,150));
	dc.SelectObject(&BGBrush);
	dc.Rectangle(&rect);
	*/
}
}

// The system calls this to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CChbhfDlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}

void CChbhfDlg::FLASH()
{
     CString SQL,str;
	CDBVariant varValue;//设置结构变量,存放字段的值
	SQL.Format("select * from TBL_NSRJBXX where TBL_NSRJBXX.bz1  in(select TBL_GZDFB.slbh from TBL_GZDFB where TBL_GZDFB.wcbz!='*' and TBL_GZDFB.slbm = (select bmh from TBL_XTBM where bmnr in(select gw from TBL_RYGL where RYBH=%d)))",user1);/*(select bmh 	from TBL_XTBM where bmnr in(select gw from TBL_RYGL where RYBH=%d))*/

	m_set.Open(AFX_DB_USE_DEFAULT_TYPE,SQL);
	if(m_set.GetRecordCount()>0)	
    m_set.MoveFirst();
	else MessageBox("现在还没有符合要求的数据");
	char buf[20];
	int i = 0;
	m_list1.DeleteAllItems();//删除控件中所有记录

	while(!m_set.IsEOF())

	{
		int temp = 0;  
	if (m_set.m_BZ1.IsEmpty())
			m_list1.InsertItem(i,"kong !");
	else
	{   
		m_set.GetFieldValue(17,varValue);	
		m_list1.InsertItem(i,varValue.m_pstring->GetBuffer(1));			
		slbh1=m_list1.GetItemText(i,0);	
		lowtime();		
	}
	
	if(m_set.m_LSH.IsEmpty())
        m_list1.SetItemText(i,1,"");
	else
	{
		m_set.GetFieldValue(temp,varValue);//从数据集中取得当前行第4个字段的值。
		m_list1.SetItemText(i,1,varValue.m_pstring->GetBuffer(1));
	}
	if(m_set.m_SLBM.IsEmpty())
	m_list1.SetItemText(i,2,"");
	else
	{  m_set.GetFieldValue(11,varValue);//从数据集中取得当前行第3个字段的值。
		m_list1.SetItemText(i,2,varValue.m_pstring->GetBuffer(1));
	}
	if(m_set.m_SLDL.IsEmpty())
        m_list1.SetItemText(i,3,"");
	else
	{
		m_set.GetFieldValue(19,varValue);//从数据集中取得当前行第15个字段的值。
	 	m_list1.SetItemText(i,3,varValue.m_pstring->GetBuffer(1));
    }
	
	if(m_set.m_NSRMC.IsEmpty())
		m_list1.SetItemText(i,4,"");
	else
	{
		m_set.GetFieldValue(3,varValue);//从数据集中取得当前行第6个字段的值。
	    m_list1.SetItemText(i,4,varValue.m_pstring->GetBuffer(1));
	}

	if(m_set.m_NSRSBH.IsEmpty())
         m_list1.SetItemText(i,5,"");
    else
	{	m_set.GetFieldValue(4,varValue);//从数据集中取得当前行第5个字段的值。
	 	m_list1.SetItemText(i,5,varValue.m_pstring->GetBuffer(1));
	}

	if (m_set.m_WJBH.IsEmpty())		
        m_list1.SetItemText(i,6,"");
	else
	{   m_set.GetFieldValue(1,varValue);//从数据集中取得当前行第2个字段的值。
		m_list1.SetItemText(i,6,varValue.m_pstring->GetBuffer(1));
	}
	
    if(m_set.m_FS.IsEmpty())
        m_list1.SetItemText(i,7,"2");
	else
	{
		m_set.GetFieldValue(15,varValue);//从数据集中取得当前行第15个字段的值

		 	m_list1.SetItemText(i,7,varValue.m_pstring->GetBuffer(1));
    }

	if(!m_set.m_SLRQ.GetDay())
          m_list1.SetItemText(i,8,"");
	else
	{   
		m_set.GetFieldValue(12,varValue);//从数据集中取得当前行第12个字段的值
	    sprintf(buf,"%d-%d-%d-%d-%d-%d",varValue.m_pdate->year,varValue.m_pdate->month,
			varValue.m_pdate->day,
			varValue.m_pdate->hour,varValue.m_pdate->minute,varValue.m_pdate->second);
	  	m_list1.SetItemText(i,8,buf);
		
    } 

	if(m_set.m_SLR.IsEmpty())
			m_list1.SetItemText(i,9,"kong!");
	else
	{   m_set.GetFieldValue(13,varValue);//从数据集中取得当前行第7个字段的值。
		m_list1.SetItemText(i,9,varValue.m_pstring->GetBuffer(1));
	}
				
		i++;
		m_set.MoveNext();
		
	}		   

	
	if (m_set.IsOpen())
	m_set.Close();
	
}

void CChbhfDlg::init()
{SetWindowPos(NULL, 20,20,800,600,NULL);
	m_tab.ShowWindow( SW_SHOW );
	m_tab.InsertItem( 0, _T("新任务列表与接收") );
	m_tab.InsertItem( 1, _T("任务处理") );
	m_tab.InsertItem( 2, _T("退出") );
	m_list3.ShowWindow( SW_HIDE );
	m_list4.ShowWindow( SW_HIDE );
	m_baocun.ShowWindow( SW_HIDE );
	m_list1.ShowWindow( SW_SHOW );
	m_list2.ShowWindow( SW_SHOW );
	m_xuanze.ShowWindow( SW_SHOW );
	m_jieshou.ShowWindow( SW_SHOW );
//	m_bcquxiao.ShowWindow( SW_HIDE );
//	m_jsquxiao.ShowWindow( SW_SHOW );
	m_xzbaocun.ShowWindow( SW_HIDE );
    m_combo1.ShowWindow( SW_HIDE );
	SetDlgItemText(IDC_CL,"");
//    m_TS.ShowWindow( SW_SHOW );
	m_list1.InsertColumn(0,"受理编号");//分割第一、
	m_list1.InsertColumn(1,"序号");
	m_list1.InsertColumn(2,"受理部门");
	m_list1.InsertColumn(3,"承办事项");
	m_list1.InsertColumn(4,"企业名称");
	m_list1.InsertColumn(5,"纳税识别号");
	m_list1.InsertColumn(6,"微机编号");
	m_list1.InsertColumn(7,"资料分数");
	m_list1.InsertColumn(8,"受理时间");
	m_list1.InsertColumn(9,"受理人");

	RECT rect;//定义RECT数据类型,可以存储控件的区域。如坐标。
	int width;
	m_list1.GetWindowRect(&rect);//取得控件的四个顶点的坐标。放到rect变量中。
	width = rect.right - rect.left;
	m_list1.SetColumnWidth(0,width/7);//设置控件中每一列的宽度。
	m_list1.SetColumnWidth(1,width/7);
	m_list1.SetColumnWidth(2,width/4);
	m_list1.SetColumnWidth(3,width/4);//设置控件中每一列的宽度。
	m_list1.SetColumnWidth(4,width/5);
	m_list1.SetColumnWidth(5,width/4);
	m_list1.SetColumnWidth(6,width/4);//设置控件中每一列的宽度。
	m_list1.SetColumnWidth(7,width/4);
	m_list1.SetColumnWidth(8,width/4);
	m_list1.SetColumnWidth(9,width/4);

    m_list1.SetExtendedStyle(LVS_EX_FULLROWSELECT);//设置整行选择
//初始化LIST2
	m_list2.InsertColumn(0,"受理编号");//分割第一、
	m_list2.InsertColumn(1,"序号");
	m_list2.InsertColumn(2,"受理部门");
	m_list2.InsertColumn(3,"承办事项");
	m_list2.InsertColumn(4,"企业名称");
    m_list2.InsertColumn(5,"纳税识别号");
	m_list2.InsertColumn(6,"微机编号");
	m_list2.InsertColumn(7,"资料分数");
	m_list2.InsertColumn(8,"受理时间");
	m_list2.InsertColumn(9,"受理人");

    m_list2.SetColumnWidth(0,width/7);//设置控件中每一列的宽度。
	m_list2.SetColumnWidth(1,width/7);
	m_list2.SetColumnWidth(2,width/4);
	m_list2.SetColumnWidth(3,width/4);//设置控件中每一列的宽度。
	m_list2.SetColumnWidth(4,width/5);
	m_list2.SetColumnWidth(5,width/4);
	m_list2.SetColumnWidth(6,width/4);//设置控件中每一列的宽度。
	m_list2.SetColumnWidth(7,width/4);
	m_list2.SetColumnWidth(8,width/4);
	m_list2.SetColumnWidth(9,width/4);

//  m_list2.SetItemColor(0,1,RGB(255,0,0),RGB(0,255,0));
//	m_list2.setExtendedStyle(LVS_EX_FULLROWSELECT);//设置整行选择
	//初始化LIST3
	m_list3.InsertColumn(0,"受理编号");//分割第一、
	m_list3.InsertColumn(1,"序号");
	m_list3.InsertColumn(2,"受理部门");
	m_list3.InsertColumn(3,"承办事项");
	m_list3.InsertColumn(4,"企业名称");
    m_list3.InsertColumn(5,"纳税识别号");
	m_list3.InsertColumn(6,"微机编号");
	m_list3.InsertColumn(7,"资料分数");
	m_list3.InsertColumn(8,"受理时间");
	m_list3.InsertColumn(9,"受理人");

    m_list3.SetColumnWidth(0,width/7);//设置控件中每一列的宽度。
	m_list3.SetColumnWidth(1,width/7);
	m_list3.SetColumnWidth(2,width/4);
	m_list3.SetColumnWidth(3,width/4);//设置控件中每一列的宽度。
	m_list3.SetColumnWidth(4,width/5);
	m_list3.SetColumnWidth(5,width/4);
	m_list3.SetColumnWidth(6,width/4);//设置控件中每一列的宽度。
	m_list3.SetColumnWidth(7,width/4);
	m_list3.SetColumnWidth(8,width/4);
	m_list3.SetColumnWidth(9,width/4);

	//初始化LIST4
	m_list4.InsertColumn(0,"受理编号");//分割第一、
	m_list4.InsertColumn(1,"序号");
	m_list4.InsertColumn(2,"受理部门");
	m_list4.InsertColumn(3,"承办事项");
	m_list4.InsertColumn(4,"企业名称");
    m_list4.InsertColumn(5,"纳税识别号");
	m_list4.InsertColumn(6,"微机编号");
	m_list4.InsertColumn(7,"资料分数");
	m_list4.InsertColumn(8,"受理时间");
	m_list4.InsertColumn(9,"受理人");

    m_list4.SetColumnWidth(0,width/5);//设置控件中每一列的宽度。
	m_list4.SetColumnWidth(1,width/6);
	m_list4.SetColumnWidth(2,width/4);
	m_list4.SetColumnWidth(3,width/3);//设置控件中每一列的宽度。
	m_list4.SetColumnWidth(4,width/5);
	m_list4.SetColumnWidth(5,width/3);
	m_list4.SetColumnWidth(6,width/3);//设置控件中每一列的宽度。
	m_list4.SetColumnWidth(7,width/3);
	m_list4.SetColumnWidth(8,width/3);

⌨️ 快捷键说明

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