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

📄 chbhfdlg.cpp

📁 vc++6.0与orcale的连接及对orcale数据库数据的提取
💻 CPP
📖 第 1 页 / 共 2 页
字号:
	m_list4.SetColumnWidth(9,width/3);
	SetDlgItemText(IDC_TS,"接收:"); //设置STATIC控件数据
	SetDlgItemText(IDC_CL,"");
	SetWindowText("文书受理");
	SetTimer(100,100000,NULL);	
	m_list1.SetExtendedStyle(LVS_EX_FULLROWSELECT);
	//	m_list1.SetExtendedStyle(LVS_EX_GRIDLINES);	// 为List添加网格
			m_list2.SetExtendedStyle(LVS_EX_FULLROWSELECT);
	//	m_list2.SetExtendedStyle(LVS_EX_GRIDLINES);	// 为List添加网格
		m_list3.SetExtendedStyle(LVS_EX_FULLROWSELECT);
	//	m_list3.SetExtendedStyle(LVS_EX_GRIDLINES);	// 为List添加网格
		
m_list1.SetBkColor(RGB(255,255,255));
m_list1.SetTextBkColor(RGB(255,255,255));
m_list1.SetTextColor(RGB(0,200,0));
//m_list1.SetCheck(0,TRUE);
m_list2.SetBkColor(RGB(255,255,255));
m_list2.SetTextBkColor(RGB(0,0,255));
m_list2.SetTextColor(RGB(255,255,255));
m_list3.SetBkColor(RGB(255,255,255));
m_list3.SetTextBkColor(RGB(0,200,0));
m_list3.SetTextColor(RGB(255,255,255));

//	SetWindowPos(NULL, 0,0,1024,768,NULL);
	if (!m_database.Open(NULL,FALSE,FALSE,"ODBC;DSN=wssl;PWD=wssl"))
		ASSERT("不能打开到该数据源的连接!");
		user1=atoi(user);
}

int CChbhfDlg::lowtime()
{
CTime time;
CDBVariant varValue;//设置结构变量,存放字段的值
CString CurrentTime,day,year,month;
int day1,day2,month1,month2,year1,year2,di;
time=time.GetCurrentTime();
year=time.Format("%Y");
year1=atoi(year);
month=time.Format("%m");
month1=atoi(month);
day=time.Format("%d");
day1=atoi(day);
	char buf1[4],buf2[4],buf3[4];
		if(m_set.m_SLRQ.GetDay())

		{
			m_set.GetFieldValue(12,varValue);//从数据集中取得当前行第12个字段的值
	    	sprintf(buf1,"%d",varValue.m_pdate->year);
			sprintf(buf2,"%d",varValue.m_pdate->month);			
	    	sprintf(buf3,"%d",varValue.m_pdate->day);
				
		}
		else
			MessageBox("受理日期为空值!!!!!");

m_list4.InsertItem(0,buf1);
year2=atoi(m_list4.GetItemText(0,0));
//MessageBox("受理日期为空值!!!!!1");
m_list4.SetItemText(0,1,buf2);
month2=atoi(m_list4.GetItemText(0,1));

m_list4.SetItemText(0,2,buf3);
day2=atoi(m_list4.GetItemText(0,2));
//MessageBox("受理日期为空值!!!!!1");
m_list4.DeleteAllItems();
//m_set.Close();
UpdateData(true);
if(month1<month2)
  month1+=1;
int mi;
mi=month1-month2;
switch(mi)
{
case 1:
	{	switch(month2)
    {
	case 1:
	case 3:
    case 5:
	case 7:
	case 8:
	case 10:
	case 12:
		{day1+=31;
		break;}
	case 2:
		{	day1+=28;
		break;}
	case 4:
	case 6:
	case 9:
	case 11:
		{	day1+=30;
		break;
		}
	}
	break;
	}

		
case 2:
	{ day1+=60;
	break;
	}
}
 if(day1>=day2)

	di=day1-day2-1;
 else 
	{
	 MessageBox("系统时间有问题");
 }
 	CString SQL,s;
    CWSLCT m_set1;

	SQL.Format("select max(slsj) from TBL_WSLCT where bmh in(select a.slbm from TBL_GZDFB a where  a.slbh='1000101')",slbh1);/*(select bmh 	from TBL_XTBM where bmnr in(select gw from TBL_RYGL where RYBH=%d))*/
     
	 m_database.ExecuteSQL(SQL);

	 s=m_set1.m_SLSJ;
		if((di-atoi(s))<0)
	
	di=di-atoi(m_set1.m_SLSJ);
		else
		{di=100000;
				SetDlgItemText(IDC_TS,"超时!!!!!");
		}
			
		return  di;
}

void CChbhfDlg::combo1()
{
	CXTtbm m_set;
    m_set.Open(AFX_DB_USE_DEFAULT_TYPE,"select * from TBL_xtbm where bmlbxh='4'and bmh!='000000' ");
	CString str;
	m_set.MoveFirst();
	while(!m_set.IsEOF())
	{
		str.Format("%s",m_set.m_BMNR);
		m_combo1.AddString(str);
		m_set.MoveNext();
	}
	
	m_set.Close();
}

void CChbhfDlg::OnJs() 
{
i = m_list1.GetSelectionMark();
	 
	if (i==-1)
	{
		MessageBox("请您选择一项任务");
	}
	else
	{
		UpdateData();
		CString ItemValuse;
		int num = 0;
	  ItemValuse= m_list1.GetItemText(i,num);
	 slbh1=ItemValuse;
	          m_list2.InsertItem(0,ItemValuse);
			  m_list3.InsertItem(0,ItemValuse); 
	 for (num = 1;num<10;num++)
		{	ItemValuse = m_list1.GetItemText(i,num);
            
		m_list2.SetItemText(0,num,ItemValuse);
		m_list3.SetItemText(0,num,ItemValuse);
		}
	    m_list1.DeleteItem(i);
		m_list2.SetHotItem(i);
		m_list3.SetHotItem(i);
	UpdateData(false);

	CString strSQL,str,user2,slbh2;
	CTime time;
	time=time.GetCurrentTime();
	if (time.GetMonth()<10)
		str.Format("%d0%d%d",time.GetYear(),time.GetMonth(),time.GetDay());
	else
		str.Format("%d%d%d",time.GetYear(),time.GetMonth(),time.GetDay());
	user2=user;
	slbh2=slbh1;
    strSQL.Format("insert into TBL_GZDFB(slbh,slbm,slsj,wcbz) values('%s','%s',To_date('%s','YYYYMMDD'),'%s')",slbh1,user,str,user2);
    m_database.ExecuteSQL(strSQL);
	strSQL.Format("UPDATE  TBL_GZDFB  set jssj = To_date('%s','YYYYMMDD') where slbh='%s'",str,slbh2);	

    m_database.ExecuteSQL(strSQL);
MessageBox("成功接收\r请尽快办理!!!!!");
	}
	flag ="1";
	
}

void CChbhfDlg::OnJsqx() 
{
//m_timer.UpdateWindow();//OnEnable(true);
	j =i;
	if(flag=="1")
	{
    if (j==-1)
	{
		MessageBox("请选择一行纪录");
	}
	else
	{
  
	UpdateData();
		CString ItemValuse;
		int num = 0;
	 ItemValuse = m_list2.GetItemText(0,num);
	  m_list1.InsertItem(j,ItemValuse);
			  
	 for (num = 1;num<6;num++)
		{
		ItemValuse = m_list2.GetItemText(0,num);
		m_list1.SetItemText(j,num,ItemValuse);
		
		}
	    m_list2.DeleteItem(0);
		m_list1.SetHotItem(j);
		UpdateData(false);
	}
	}
	flag = "0";	// TODO: Add your control notification handler code here
	
}

void CChbhfDlg::OnBc() 
{
	// TODO: Add your control notification handler code here
		CString strSQL,str;
		CTime time;
		int task = m_list3.GetSelectionMark();
	if (task==-1&&sl)
	{
		MessageBox("请您选择一项任务");
	}
	else
	{
	
	   time=time.GetCurrentTime();
	   if (time.GetMonth()<10)
	    	str.Format("%d0%d%d",time.GetYear(),time.GetMonth(),time.GetDay());
	   else
	    	str.Format("%d%d%d",time.GetYear(),time.GetMonth(),time.GetDay());
	//	strSQL.Format("insert into TBL_GZDFB(slbh,slbm) values('0020220','10','To_date('20040414'),YYYYmmDD')");
		//	strSQL.Format("insert into TBL_GZDFB(slbh,slbm) values('0020221','10')");
		strSQL.Format("UPDATE  TBL_GZDFB  set wcbz = '*',slsj =To_date('%s','YYYYMMDD') where slbh ='%s' ",str,user);	
	//	AfxMessageBox("不成功111111111!");
    	m_database.ExecuteSQL(strSQL);
		m_list2.DeleteItem(task);
	    m_list3.DeleteItem(task);
		MessageBox("保存成功\r你成功的处理了一项任务\r加油");
	}
		
}


void CChbhfDlg::OnSelchangeCombo1() 
{
	
	m_combo1.GetLBText(m_combo1.GetCurSel(),sl);
	// TODO: Add your control notification handler code here
	
}

void CChbhfDlg::OnEditchangeCombo1() 
{
	
CString str1;
	int n;
	n=m_combo1.GetCurSel();//m_combo1.GetDlgCtrlID();
    m_combo1.GetDlgItem(n,NULL);
//	UpdateData(true);
//	m_e1=atoi(str1);
//	UpdateData(false);	// TODO: Add your control notification handler code here
	
	  
}

void CChbhfDlg::OnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult) 
{
		int sel = m_tab.GetCurSel();

	switch(sel)
	{
	case 0:
		SetWindowPos(NULL, 20,20,800,600,NULL);	
	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_HIDE );
	m_jieshou.ShowWindow( SW_SHOW );
	m_bcquxiao.ShowWindow( SW_HIDE );
//	m_jsquxiao.ShowWindow( SW_SHOW );
	m_xuanze.ShowWindow( SW_SHOW );
	m_xzbaocun.ShowWindow( SW_HIDE );
		m_list1.SetExtendedStyle(LVS_EX_FULLROWSELECT);
		m_list2.SetExtendedStyle(LVS_EX_FULLROWSELECT);
//	m_TS.ShowWindow( SW_SHOW );
		m_CL.ShowWindow( SW_SHOW );
	SetDlgItemText(IDC_TS,"接收:");
		SetDlgItemText(IDC_CL,"");
	m_combo1.ShowWindow( SW_HIDE );
	SetWindowText("文书受理");
	//	m_list1.SetExtendedStyle(LVS_EX_GRIDLINES);	// 为List添加网格
	//	m_list2.SetExtendedStyle(LVS_EX_GRIDLINES);	// 为List添加网格
		
			
		break;
	case 1:

	m_list1.ShowWindow( SW_HIDE );
	m_list2.ShowWindow( SW_HIDE );
	m_baocun.ShowWindow( SW_SHOW );
	m_list3.ShowWindow( SW_SHOW );
	m_list4.ShowWindow( SW_HIDE );
	m_xuanze.ShowWindow( SW_HIDE );
	m_jieshou.ShowWindow( SW_HIDE );
//	m_bcquxiao.ShowWindow( SW_SHOW );
	m_jsquxiao.ShowWindow( SW_HIDE );
//	m_xzbaocun.ShowWindow( SW_SHOW );
	m_combo1.ShowWindow( SW_SHOW );
	SetDlgItemText(IDC_TS,"");
	SetDlgItemText(IDC_CL,"处理:");
		SetWindowText("任务处理");
			SetWindowPos(NULL, 20,20,800,270,NULL);
		//	m_list3.SetExtendedStyle(LVS_EX_GRIDLINES);	// 为List添加网格
		//		m_list3.SetExtendedStyle(LVS_EX_FULLROWSELECT);
	
    	break;	
    case 2:
    CDialog::OnOK();
        break;
	
	}	// TODO: Add your control notification handler code here
	
	*pResult = 0;
}

void CChbhfDlg::OnTimer(UINT nIDEvent) 
{   
//	FLASH();	// 刷新list控件中数据
	// TODO: Add your message handler code here and/or call default
	
	CDialog::OnTimer(nIDEvent);
}



void CChbhfDlg::OnXz() 
{
	FLASH();// TODO: Add your control notification handler code here
	
}



HBRUSH CChbhfDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) 
{
	HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
	
hbr=m_brush;
    if(nCtlColor==CTLCOLOR_DLG )
	{	pDC->SetBkMode(TRANSPARENT);
                //此处设置字体的颜色
   //pDC->SetBkColor (RGB (25,100, 45));
   pDC->SetTextColor(RGB(255,0,255));
	}

	if (nCtlColor==CTLCOLOR_STATIC )
			if(pWnd->GetDlgCtrlID() == IDC_TS)
{ pDC->SetBkMode(TRANSPARENT);
                //此处设置字体的颜色
   pDC->SetBkColor (RGB (180,189, 189));
   pDC->SetTextColor(RGB(255,0,0));


    
   // TODO: Change any attributes of the DC here
}		
else if(pWnd->GetDlgCtrlID() == IDC_CL)
{
	 pDC->SetBkMode(TRANSPARENT);
                //此处设置字体的颜色
   pDC->SetBkColor (RGB (180,189, 189));
   pDC->SetTextColor(RGB(0,0,255));
}// TODO: Return a different brush if the default is not desired
	return hbr;
}

void CChbhfDlg::OnButton1() 
{SetWindowPos(NULL, 20,20,800,600,NULL);
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_HIDE );
	m_jieshou.ShowWindow( SW_SHOW );
	m_bcquxiao.ShowWindow( SW_HIDE );
//	m_jsquxiao.ShowWindow( SW_SHOW );
	m_xuanze.ShowWindow( SW_SHOW );
	m_xzbaocun.ShowWindow( SW_HIDE );
		m_list1.SetExtendedStyle(LVS_EX_FULLROWSELECT);
		m_list2.SetExtendedStyle(LVS_EX_FULLROWSELECT);
//	m_CL.ShowWindow( SW_SHOW );
	SetDlgItemText(IDC_TS,"接收:");
		SetDlgItemText(IDC_CL,"");
	m_combo1.ShowWindow( SW_HIDE );
	SetWindowText("文书受理");	// TODO: Add your control notification handler code here
	
}

void CChbhfDlg::OnButton2() 
{SetWindowPos(NULL, 20,20,800,300,NULL);
	m_list1.ShowWindow( SW_HIDE );
	m_list2.ShowWindow( SW_HIDE );
	m_baocun.ShowWindow( SW_SHOW );
	m_list3.ShowWindow( SW_SHOW );
	m_list4.ShowWindow( SW_HIDE );
	m_xuanze.ShowWindow( SW_HIDE );
	m_jieshou.ShowWindow( SW_HIDE );
//	m_bcquxiao.ShowWindow( SW_SHOW );
	m_jsquxiao.ShowWindow( SW_HIDE );
//	m_xzbaocun.ShowWindow( SW_SHOW );
	m_combo1.ShowWindow( SW_SHOW );
	SetDlgItemText(IDC_TS,"");
	SetDlgItemText(IDC_CL,"处理:");
		SetWindowText("任务处理");
		
			m_list3.SetExtendedStyle(LVS_EX_GRIDLINES);	// 为List添加网格
				m_list3.SetExtendedStyle(LVS_EX_FULLROWSELECT);	// TODO: Add your control notification handler code here
	
}

void CChbhfDlg::OnButton3() 
{
 CDialog::OnOK();	// TODO: Add your control notification handler code here
	
}

⌨️ 快捷键说明

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