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

📄 双星台球厅计时收费系统view.cpp

📁 可以用于台球厅进行收费的程序代码,计算时间并进行费用计算
💻 CPP
📖 第 1 页 / 共 3 页
字号:
					if(m_70==0)
					{
						m_71=((23-m_4)*60*60)+((59-m_5)*60)+(60-m_6);
					}
					else
					{
						m_71=((23-m_4)*60*60)+((59-m_5)*60)+(60-m_6)+(m_70*60*60*24);
					}
					m_72=m_63-1;
					if(m_72==0)
					{
						m_73=m_1*60*60+m_2*60+m_3;
					}
					else
					{
						m_73=m_1*60*60+m_2*60+m_3+(m_72*60*60*24);
					}
				}
				if((m_52==4)||(m_52==6)||(m_52==9)||(m_52==11))
				{
					m_70=30-m_53;
					if(m_70==0)
					{
						m_71=((23-m_4)*60*60)+((59-m_5)*60)+(60-m_6);
					}
					else
					{
						m_71=((23-m_4)*60*60)+((59-m_5)*60)+(60-m_6)+(m_70*60*60*24);
					}
					m_72=m_63-1;
					if(m_72==0)
					{
						m_73=m_1*60*60+m_2*60+m_3;
					}
					else
					{
						m_73=m_1*60*60+m_2*60+m_3+(m_72*60*60*24);
					}
				}
				if(m_52==2)
				{
					if(((m_51-1980)%4)==0)
					{
						m_70=29-m_53;
						if(m_70==0)
						{
							m_71=((23-m_4)*60*60)+((59-m_5)*60)+(60-m_6);
						}
						else
						{
							m_71=((23-m_4)*60*60)+((59-m_5)*60)+(60-m_6)+(m_70*60*60*24);
						}
						m_72=m_63-1;
						if(m_72==0)
						{
							m_73=m_1*60*60+m_2*60+m_3;
						}
						else
						{
							m_73=m_1*60*60+m_2*60+m_3+(m_72*60*60*24);
						}
					}
					else
					{
						m_70=28-m_53;
						if(m_70==0)
						{
							m_71=((23-m_4)*60*60)+((59-m_5)*60)+(60-m_6);
						}
						else
						{
							m_71=((23-m_4)*60*60)+((59-m_5)*60)+(60-m_6)+(m_70*60*60*24);
						}
						m_72=m_63-1;
						if(m_72==0)
						{
							m_73=m_1*60*60+m_2*60+m_3;
						}
						else
						{
							m_73=m_1*60*60+m_2*60+m_3+(m_72*60*60*24);
						}
					}
				}

				m_9=m_71+m_73;
			}
			
			if((m_52==m_62)&&(m_53!=m_63))
			{
				m_72=m_63-m_53-1;
				m_71=((23-m_4)*60*60)+((59-m_5)*60)+(60-m_6)+(m_72*60*60*24)+(m_1*60*60)+(m_2*60)+m_3;
				m_9=m_71;
			}
			
			if((m_52==m_62)&&(m_53==m_63))
			{
				int m_7=(m_1*60*60)+(m_2*60)+m_3;
				int m_8=(m_4*60*60)+(m_5*60)+m_6;
				m_9=m_7-m_8;
			}

			m_TimeLength_1=m_TimeLength_1+m_9;
			
			int m_10=m_9/3600;
			int m_11=(m_9%3600)/60;
			int m_12=((m_9%3600)%60);
			
			str[0].Format("%d",m_10);
			str[1].Format("%d",m_11);
			str[2].Format("%d",m_12);
			
			if(str[0].GetLength()==1)
			{
				str[0]="0"+str[0];
			}
			if(str[1].GetLength()==1)
			{
				str[1]="0"+str[1];
			}
			if(str[2].GetLength()==1)
			{
				str[2]="0"+str[2];
			}
			str[3]=str[0]+":"+str[1]+":"+str[2];
			
			m_UserInformation.SetItemText(i-1,7,str[3]);
			
			m_UserInformation.GetItemText(i-1,2,chrTemp,sizeof(char[255]));
			CString str_5=chrTemp;
			
			str_5.Replace(" 元/小时","");
			
			int m_13=atoi(str_5);
			
			double m_14=(((double)m_13*100)/(60*60))*m_9;
			
			int m_15=(int)(m_14/100);
			int m_16=(int)((m_14-(int)(m_14/100)*100)/10);
			int m_17=(int)(m_14-m_15*100-m_16*10);
			
			double m_18=m_15+(double)m_16*0.1+(double)m_17*0.01;

			m_TatolFeiYong_1=m_TatolFeiYong_1+m_18;
			
			CString str_6;
			str_6.Format("%0.2f 元",m_18);
			
			m_UserInformation.SetItemText(i-1,8,str_6);	
		}
		else
		{
			m_UserNumber_2++;
		}
	}

	CString str[4];

	int m_10=m_TimeLength_1/3600;
	int m_11=(m_TimeLength_1%3600)/60;
	int m_12=((m_TimeLength_1%3600)%60);
	
	str[0].Format("%d",m_10);
	str[1].Format("%d",m_11);
	str[2].Format("%d",m_12);
	
	if(str[0].GetLength()==1)
	{
		str[0]="0"+str[0];
	}
	if(str[1].GetLength()==1)
	{
		str[1]="0"+str[1];
	}
	if(str[2].GetLength()==1)
	{
		str[2]="0"+str[2];
	}
	str[3]=str[0]+":"+str[1]+":"+str[2];
	
	m_TimeLength.SetWindowText(str[3]);

	str[3].Format("%0.2f 元",m_TatolFeiYong_1);
	m_TaloeFeiYong.SetWindowText(str[3]);

	str[3].Format("%d 个",m_UserNumber_1);
	m_UserNumber.SetWindowText(str[3]);

	str[3].Format("%d 个",m_UserNumber_2);
	m_UnUserNumber.SetWindowText(str[3]);

	CFormView::OnTimer(nIDEvent);
}

void CMyView::On_AddDataToListShow(CString str)
{
	CMainFrame *pFrame=(CMainFrame*)AfxGetApp()->m_pMainWnd;

	int m_Mark=atoi(str)-1;

	CString str_1,str_2;
	_variant_t var;
	
	int m_MarkCount=0;
	
	try
	{
		pFrame->f_MyApp->m_pRecordset->Open("SELECT *FROM TaiQiuZheUserInformationRecond",
			pFrame->f_MyApp->m_pConnection.GetInterfacePtr(),
			adOpenDynamic,
			adLockOptimistic,
			adCmdText);
		
		if(!pFrame->f_MyApp->m_pRecordset->BOF)
		{
			pFrame->f_MyApp->m_pRecordset->MoveFirst();
		}
		while(!pFrame->f_MyApp->m_pRecordset->adoEOF)
		{
			var=pFrame->f_MyApp->m_pRecordset->GetCollect("UserNumber");
			if(var.vt!=VT_NULL)
			{
				str_1=(LPCSTR)_bstr_t(var);
				
				if(str_1==str)
				{
					var=pFrame->f_MyApp->m_pRecordset->GetCollect("UserWeiZhi");
					if(var.vt!=VT_NULL)
					{
						str_1=(LPCSTR)_bstr_t(var);
						
						m_UserInformation.SetItemText(m_Mark,1,str_1);				
					}
					
					var=pFrame->f_MyApp->m_pRecordset->GetCollect("UserJiaGe");
					if(var.vt!=VT_NULL)
					{
						str_1=(LPCSTR)_bstr_t(var);
						
						m_UserInformation.SetItemText(m_Mark,2,str_1);				
					}
					
					var=pFrame->f_MyApp->m_pRecordset->GetCollect("UserMark");
					if(var.vt!=VT_NULL)
					{
						str_1=(LPCSTR)_bstr_t(var);
						
						m_UserInformation.SetItemText(m_Mark,3,str_1);				
					}

					var=pFrame->f_MyApp->m_pRecordset->GetCollect("UserPeople");
					if(var.vt!=VT_NULL)
					{
						str_1=(LPCSTR)_bstr_t(var);
						
						m_UserInformation.SetItemText(m_Mark,4,str_1);				
					}

					var=pFrame->f_MyApp->m_pRecordset->GetCollect("UserData");
					if(var.vt!=VT_NULL)
					{
						str_1=(LPCSTR)_bstr_t(var);
						
						m_UserInformation.SetItemText(m_Mark,5,str_1);				
					}

					var=pFrame->f_MyApp->m_pRecordset->GetCollect("BeginTime");
					if(var.vt!=VT_NULL)
					{
						str_1=(LPCSTR)_bstr_t(var);
						
						m_UserInformation.SetItemText(m_Mark,6,str_1);				
					}
					
					var=pFrame->f_MyApp->m_pRecordset->GetCollect("Mark");
					if(var.vt!=VT_NULL)
					{
						str_1=(LPCSTR)_bstr_t(var);
						
						m_UserInformation.SetItemText(m_Mark,9,str_1);				
					}

					m_UserInformation.SetItemText(m_Mark,7,"");
					m_UserInformation.SetItemText(m_Mark,8,"");
				}
			}
			pFrame->f_MyApp->m_pRecordset->MoveNext();
		}
		pFrame->f_MyApp->m_pRecordset->Close();		
	}
	catch(_com_error &e)
	{
		AfxMessageBox(e.ErrorMessage());
		return;
	}

//	m_UserInformation.SetItemText(m_Mark,2,str_1);	
//	char chrTemp[255] = {'\0'};

//	m_UserInformation.GetItemText(0,6,chrTemp,sizeof(char[255]));
//	CString str_1=chrTemp;
}

void CMyView::On_AddOldDataToListShow(int Mark)
{
	CMainFrame *pFrame=(CMainFrame*)AfxGetApp()->m_pMainWnd;

	if(Mark==0)
	{
		_variant_t RecordsAffected;
		pFrame->f_MyApp->m_pRecordset=pFrame->f_MyApp->m_pConnection->Execute("SELECT COUNT(*) FROM UserInformationRecondList",
			&RecordsAffected,adCmdText);
		_variant_t vIndex=(long)0;
		_variant_t vCount=pFrame->f_MyApp->m_pRecordset->GetCollect(vIndex);
		pFrame->f_MyApp->m_pRecordset->Close();
		
		CString str_1=(LPCSTR)_bstr_t(vCount);
		int m_RecordCount=atoi(str_1)+1;

		m_TongJiMarkCount[0]=m_RecordCount-1;

		str_1.Format("%d",m_RecordCount);

		CString str_2;
		_variant_t var;

		int m_markCount=0;
		
		try
		{
			pFrame->f_MyApp->m_pRecordset->Open("SELECT *FROM UserInformationRecondList",
				pFrame->f_MyApp->m_pConnection.GetInterfacePtr(),
				adOpenDynamic,
				adLockOptimistic,
				adCmdText);
			
			pFrame->f_MyApp->m_pRecordset->MoveLast();
			
			var=pFrame->f_MyApp->m_pRecordset->GetCollect("UserData");
			if(var.vt!=VT_NULL)
			{
				str_2=(LPCSTR)_bstr_t(var);

				CString str_Data_1=str_2;
				int m_Data_1=str_Data_1.Find("-",0);
				CString str_Data_2=str_Data_1.Mid(0,m_Data_1);
				CString str_Data_3=str_Data_1.Mid(m_Data_1+2,2);
				CString str_Data_4=str_Data_1.Mid(m_Data_1+2+2+2,2);
				
				CString str_Data_10[4];
				
				m_ShowYear.GetWindowText(str_Data_10[0]);
				m_ShowMonth.GetWindowText(str_Data_10[1]);
				m_ShowData.GetWindowText(str_Data_10[2]);

				if(str_Data_10[1]=="")
				{
					str_Data_10[1]=str_Data_3;
				}

				if(str_Data_10[2]=="")
				{
					str_Data_10[2]=str_Data_4;
				}

				BOOL m_Mark_B=FALSE;
				int m_Mark_A=m_ShowYear.GetCount();
				for(int i=0;i<m_Mark_A;i++)
				{
					m_ShowYear.SetCurSel(i);
					m_ShowYear.GetWindowText(str_Data_10[3]);
					if(str_Data_10[3]==str_Data_2)
					{
						m_Mark_B=TRUE;
					}
				}
				if(m_Mark_B==FALSE)
				{
					m_ShowYear.AddString(str_Data_2);
				}

				m_Mark_A=m_ShowYear.GetCount();
				for(i=0;i<m_Mark_A;i++)
				{
					m_ShowYear.SetCurSel(i);
					m_ShowYear.GetWindowText(str_Data_10[3]);
					if(str_Data_10[3]==str_Data_10[0])
					{
						break;
					}
				}

				if((str_Data_10[0]==str_Data_2)&&(str_Data_10[1]==str_Data_3)&&(str_Data_10[2]==str_Data_4))
				{
					m_TongJiInformation.SetItemText(m_RecordCount,3,str_2);
					
					var=pFrame->f_MyApp->m_pRecordset->GetCollect("ID");
					if(var.vt!=VT_NULL)
					{
						str_2=(LPCSTR)_bstr_t(var);
						m_TongJiInformation.InsertItem(m_RecordCount,str_2);						
					}

					var=pFrame->f_MyApp->m_pRecordset->GetCollect("UserData");
					if(var.vt!=VT_NULL)
					{
						str_2=(LPCSTR)_bstr_t(var);
						m_TongJiInformation.SetItemText(m_markCount,3,str_2);
					}
					

⌨️ 快捷键说明

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