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

📄 fvchild.cpp

📁 我自己整理的一些VC源代码
💻 CPP
📖 第 1 页 / 共 4 页
字号:

void CFVChild::QuerySJ()
{
	int index = 0;
	CTabSJ tabsj;
	CTabSJ tabsj1;
	CTabXC tabxc;
	char szSQL[ 255 ];
	CString strTmp;

	m_list_child.DeleteAllItems();
	
	try
	{
		tabsj.Open( "where sjjlzt <> 0" );
		while( tabsj.IsOpen() && !tabsj.IsEOF() )
		{
			index = m_list_child.GetItemCount();
			m_list_child.InsertItem( index, tabsj.SJCSBM.GetValue(), 0 );
			m_list_child.SetItemData( index, atol( tabsj.SJDLCH.GetValue() ) );
			m_list_child.SetItemText( index, 1, tabsj.SJDLCM.GetValue() );
			sprintf( szSQL, "where sjdlch = %s", tabsj.SJDLCH.GetValue() );
			if( tabsj1.Open( szSQL ) ) m_list_child.SetItemText( index, 2, tabsj1.SJDLCM.GetValue() );
			sprintf( szSQL, "where xcygid = %s", tabsj.SJFZRH.GetValue() );
			if( tabxc.Open( szSQL ) )
			{
				strTmp.Format( "%s %s", tabxc.XCYGID.GetValue(), tabxc.XCYGMC.GetValue() );
				m_list_child.SetItemText( index, 3, strTmp );
			}
			m_list_child.SetItemText( index, 4, tabsj.SJBZXX.GetValue() );
			tabsj.MoveNext();
		}
	}
	catch( _com_error &e )
	{
		AfxMessageBox( e.ErrorMessage() );
	}
}

void CFVChild::InsertSJ()
{
	int index = 0;
	CDlgSJ dlg;
	if( dlg.DoModal() == IDOK )
	{
		index = m_list_child.GetItemCount();
		m_list_child.InsertItem( index, dlg.strsjcsbm );
		m_list_child.SetItemData( index, atol( dlg.strsjdlch ) );
		m_list_child.SetItemText( index, 1, dlg.strsjcsbm );
		m_list_child.SetItemText( index, 2, dlg.strsjdlcm );
		m_list_child.SetItemText( index, 3, dlg.strsjsjch );
		m_list_child.SetItemText( index, 4, dlg.strsjbzxx );
	}
}

void CFVChild::UpdateSJ()
{
	CDlgSJ dlg;
	long index;

	index = m_list_child.GetSelectionMark();
	if ( index < 0 ) return ;
	dlg.strsjdlch.Format( "%d", (long)m_list_child.GetItemData( index ) );
	dlg.strsjcsbm = m_list_child.GetItemText( index, 0 );
	dlg.strsjsjch = m_list_child.GetItemText( index, 1 );
	dlg.strsjdlcm = m_list_child.GetItemText( index, 2 );
	dlg.strsjfzrh = m_list_child.GetItemText(index, 3 );
	dlg.strsjbzxx = m_list_child.GetItemText( index, 4 );
	dlg.m_nOperType = MODE_MODIFY;
	if ( dlg.DoModal() == IDOK )
	{
		m_list_child.DeleteItem( index );
		m_list_child.InsertItem( index, dlg.strsjcsbm );
		m_list_child.SetItemText( index, 1, dlg.strsjdlcm );
		m_list_child.SetItemText( index, 2, dlg.strsjsjch );
		m_list_child.SetItemText( index, 3, dlg.strsjfzrh );
		m_list_child.SetItemText( index, 4, dlg.strsjbzxx );		

	}
}

void CFVChild::DeleteSJ()
{
	char szSQL[250];
	long index;

	index = m_list_child.GetSelectionMark();
	if ( index < 0 ) return;
	sprintf( szSQL, "UPDATE SJ SET SJJLZT = 0 WHERE SJDLCH = %d", (long)m_list_child.GetItemData( index ) );
	try
	{
		connection->Execute( szSQL, NULL, adExecuteNoRecords );
		m_list_child.DeleteItem( index );
	}
	catch( ...)
	{

	}
}

void CFVChild::InitYJ()
{
	if( m_nListMode != IDC_YJ_DAILIYJ )
	{
		ClearList();
		m_nListMode = IDC_YJ_DAILIYJ;
		Title( "代 理 商 业 绩" );
		
		m_list_child.InsertColumn( 0, "代理商编号", LVCFMT_LEFT, 80 );
		m_list_child.InsertColumn( 1, "购买人", LVCFMT_LEFT, 120 );
		m_list_child.InsertColumn( 2, "产品", LVCFMT_LEFT, 120 );
		m_list_child.InsertColumn( 3, "时间", LVCFMT_LEFT, 80 );
		m_list_child.InsertColumn( 4, "数量", LVCFMT_RIGHT, 70 );
		m_list_child.InsertColumn( 5, "价格", LVCFMT_RIGHT, 70 );
		m_list_child.InsertColumn( 6, "金额", LVCFMT_RIGHT, 70 );
		m_list_child.InsertColumn( 7, "卡号", LVCFMT_LEFT, 80 );
		m_list_child.InsertColumn( 8, "销售方式", LVCFMT_LEFT, 80 );
		m_list_child.InsertColumn( 9, "备注", LVCFMT_LEFT, 150 );

		QueryYJ();
	}
}

void CFVChild::QueryYJ()
{

}

void CFVChild::InsertYJ()
{
	CDlgYJ dlg;
	if( dlg.DoModal() )
	{
	}
}

void CFVChild::InitGH()
{
	if( m_nListMode != IDC_FILE_GH )
	{
		ClearList();
		m_nListMode = IDC_FILE_GH;
		Title( "操 作 员 信 息" );
		
		m_list_child.InsertColumn( 0, "工号", LVCFMT_LEFT, 80 );
		m_list_child.InsertColumn( 1, "登录名", LVCFMT_LEFT, 120 );
		m_list_child.InsertColumn( 2, "员工姓名", LVCFMT_LEFT, 120 );
		m_list_child.InsertColumn( 3, "备注信息", LVCFMT_LEFT, 200 );

		QueryGH();
	}
}

void CFVChild::QueryGH()
{
	int index = 0;
	CTabGH tabgh;

	m_list_child.DeleteAllItems();
	
	try
	{
		tabgh.Open();
		while( tabgh.IsOpen() && !tabgh.IsEOF() )
		{
			index = m_list_child.GetItemCount();
			m_list_child.InsertItem( index, tabgh.GHYGBH.GetValue(), 0 );
			m_list_child.SetItemData( index, atol( tabgh.GHYGHM.GetValue() ) );
			m_list_child.SetItemText( index, 1, tabgh.GHDLXM.GetValue() );
			m_list_child.SetItemText( index, 2, tabgh.GHYGXM.GetValue() );
			m_list_child.SetItemText( index, 3, tabgh.GHBZXX.GetValue() );
			tabgh.MoveNext();
		}
	}
	catch( _com_error &e )
	{
		AfxMessageBox( e.ErrorMessage() );
	}
}

void CFVChild::InsertGH()
{
	CDlgGH dlg;
	if( dlg.DoModal() == IDOK )
	{
		int index = m_list_child.GetItemCount();
		m_list_child.InsertItem( index, dlg.strghygbh, 0 );
		m_list_child.SetItemData( index, atol( dlg.strghyghm ) );
		m_list_child.SetItemText( index, 1, dlg.strghdlxm );
		m_list_child.SetItemText( index, 2, dlg.strghygxm );
		m_list_child.SetItemText( index, 3, dlg.strghbzxx );
	}
}

void CFVChild::UpdateGH()
{
	CDlgGH dlg;
	dlg.m_nOperType = MODE_MODIFY;
	dlg.strghygbh = m_list_child.GetItemText( m_nCurrItem, 0 );
	dlg.strghyghm.Format( "%ld", m_list_child.GetItemData( m_nCurrItem ) );
	dlg.strghdlxm = m_list_child.GetItemText( m_nCurrItem, 1 );
	dlg.strghygxm = m_list_child.GetItemText( m_nCurrItem, 2 );
	dlg.strghbzxx = m_list_child.GetItemText( m_nCurrItem, 3 );
	if( dlg.DoModal() == IDOK )
	{
		int index = m_list_child.GetItemCount();
		m_list_child.InsertItem( m_nCurrItem, dlg.strghygbh, 0 );
		m_list_child.SetItemText( m_nCurrItem, 1, dlg.strghdlxm );
		m_list_child.SetItemText( m_nCurrItem, 2, dlg.strghygxm );
		m_list_child.SetItemText( m_nCurrItem, 3, dlg.strghbzxx );
	}
}

void CFVChild::DeleteGH()
{
	int		index;
	char szSQL[250];

	index = m_list_child.GetSelectionMark();
	if ( index >= 0 )
	{
		try
		{	
			connection->BeginTrans();
			memset( szSQL, 0, 250 );
			sprintf( szSQL, "UPDATE GQ SET GQJLZT = 0  WHERE GQGHHM = %d", ( long )m_list_child.GetItemData( index ) );
			connection->Execute( szSQL, NULL, adExecuteNoRecords );
			memset( szSQL, 0, 250 );
			sprintf( szSQL, "UPDATE GH SET GHJLZT = 0  WHERE GHYGHM = %d", ( long )m_list_child.GetItemData( index ) );
			connection->Execute( szSQL, NULL, adExecuteNoRecords );
			connection->CommitTrans();
		 	m_list_child.DeleteItem( index ); 
		}
		catch( ... )
		{
			connection->RollbackTrans();
		}
	}
}

void CFVChild::InitCS()
{
	if( m_nListMode != ID_VIEW_SPDW )
	{
		ClearList();
		m_nListMode = ID_VIEW_SPDW;
		Title( " 参 数 信 息 维 护 " );
		
		m_list_child.InsertColumn( 0, "编码表名", LVCFMT_LEFT, 100 );
		m_list_child.InsertColumn( 1, "字段名称", LVCFMT_LEFT, 100 );
		m_list_child.InsertColumn( 2, "字段描述", LVCFMT_LEFT, 100 );
		m_list_child.InsertColumn( 3, "字段序号", LVCFMT_LEFT, 100 );
		m_list_child.InsertColumn( 4, "取值方式", LVCFMT_LEFT, 100 );
		m_list_child.InsertColumn( 5, "字符取值", LVCFMT_LEFT, 100 );
		m_list_child.InsertColumn( 6, "数字取值", LVCFMT_LEFT, 100 );
		m_list_child.InsertColumn( 7, "取值描述", LVCFMT_LEFT, 100 );
		m_list_child.InsertColumn( 8, "记录状态", LVCFMT_LEFT, 100 );
		m_list_child.InsertColumn( 9, "备注信息", LVCFMT_LEFT, 100 );
		
		QueryCS();
	}
}
void CFVChild::InsertCS()
{
	CDlgCS dlg;
	
	dlg.m_nOperType = MODE_APPEND;
	if( dlg.DoModal() == IDOK )
	{
		QueryCS();
		AfxMessageBox( "保存成功!" );
	}
}

void CFVChild::QueryCS()
{
	CTabCS tabcs;
	CString strSQL;
	long nIndex = 0;

	m_list_child.DeleteAllItems();

	strSQL = "WHERE CSJLZT = 1";
	tabcs.Open( strSQL );
	while( tabcs.IsOpen() && !tabcs.IsEOF() )
	{
		m_list_child.InsertItem( nIndex, tabcs.CSBMBM.strValue );
		m_list_child.SetItemText( nIndex,0, tabcs.CSBMBM.strValue );
		m_list_child.SetItemText( nIndex,1, tabcs.CSZDMC.strValue );
		m_list_child.SetItemText( nIndex,2, tabcs.CSZDMS.strValue );
		m_list_child.SetItemText( nIndex,3, tabcs.CSZDXH.strValue );
		m_list_child.SetItemText( nIndex,4, tabcs.CSQZFS.strValue );
		m_list_child.SetItemText( nIndex,5, tabcs.CSZFQZ.strValue );
		m_list_child.SetItemText( nIndex,6, tabcs.CSSZQZ.strValue );
		m_list_child.SetItemText( nIndex,7, tabcs.CSQZMS.strValue );
		m_list_child.SetItemText( nIndex,8, tabcs.CSJLZT.strValue );
		m_list_child.SetItemText( nIndex,9, tabcs.CSBZXX.strValue );

		nIndex ++;
		tabcs.MoveNext();
	}

}

void CFVChild::DeleteCS()
{
	return;
}

void CFVChild::UpdateCS()
{
	CDlgCS dlg;
	CString strTmp;
	BOOL bRet = FALSE;
	
	dlg.m_nOperType = MODE_MODIFY;
	
	if( m_nCurrItem >= 0 )
	{
		dlg.strCSBMBM = m_list_child.GetItemText( m_nCurrItem, 0 );
		dlg.strCSZDMC = m_list_child.GetItemText( m_nCurrItem, 1 );
		dlg.strCSZDMS = m_list_child.GetItemText( m_nCurrItem, 2 );
		dlg.strCSZDXH = m_list_child.GetItemText( m_nCurrItem, 3 );
		dlg.strCSQZFS = m_list_child.GetItemText( m_nCurrItem, 4 );
		dlg.strCSZFQZ = m_list_child.GetItemText( m_nCurrItem, 5 );
		dlg.strCSSZQZ = m_list_child.GetItemText( m_nCurrItem, 6 );
		dlg.strCSQZMS = m_list_child.GetItemText( m_nCurrItem, 7 );
		dlg.strCSJLZT = m_list_child.GetItemText( m_nCurrItem, 8 );
		dlg.strCSBZXX = m_list_child.GetItemText( m_nCurrItem, 9 );
	
		strTmp = dlg.strCSZDMS;

		if( strTmp == "督导奖励最后结算日期" )
		{
			bRet = TRUE;
		}
		else if( strTmp == "代理级别" )
		{
			bRet = TRUE;
		}
		else if( strTmp == "产品规格" )
		{
			bRet = TRUE;
		}
		else if( strTmp == "产品计量单位" )
		{
			bRet = TRUE;
		}
		else if( strTmp == "推广奖励最后结算日期" )
		{
			bRet = TRUE;
		}
		else if( strTmp == "开户银行" )
		{
			bRet = TRUE;
		}
		else if( strTmp == "投资卡号" )
		{
			bRet = TRUE;
		}
		
		if ( bRet )
		{
			if( dlg.DoModal() == IDOK )
			{
				QueryCS();
				AfxMessageBox( "修改成功!" );
			}
		}
	}
}

⌨️ 快捷键说明

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