fvchild.cpp
来自「我自己整理的一些VC源代码」· C++ 代码 · 共 1,491 行 · 第 1/4 页
CPP
1,491 行
m_list_child.DeleteAllItems();
try
{
index = m_list_child.GetItemCount();
tabdl.Open( "WHERE DLJLZT <> 0" );
while( tabdl.IsOpen() && !tabdl.IsEOF() )
{
index = m_list_child.GetItemCount();
m_list_child.InsertItem( index, tabdl.DLDLBH.GetValue(), 0 );
m_list_child.SetItemData( index, atol( tabdl.DLDLID.GetValue() ) );
m_list_child.SetItemText( index, 1, tabdl.DLDLMC.GetValue() );
m_list_child.SetItemText( index, 2, tabdl.DLDLDH.GetValue() );
memset( szSQL, 0, 255 );
sprintf( szSQL, "WHERE CSBMBM= 'XC' AND CSZDMC= 'XCKHYH' AND CSSZQZ = %s", tabdl.DLKHYH.strValue );
tabcs.Open( szSQL );
if ( tabcs.IsOpen() )
m_list_child.SetItemText( index, 3, tabcs.CSQZMS.GetValue() );
m_list_child.SetItemText( index, 4, tabdl.DLYHZH.GetValue() );
m_list_child.SetItemText( index, 5, tabdl.DLJRRQ.GetValue() );
m_list_child.SetItemText( index, 6, tabdl.DLFZRM.GetValue() );
// m_list_child.SetItemText( index, 7, tabdl.DLDLJB.GetValue() );
memset( szSQL, 0, 255 );
sprintf( szSQL, "WHERE CSBMBM= 'DL' AND CSZDMC= 'DLDLJB' AND CSSZQZ = %s", tabdl.DLDLJB.GetValue() );
tabcs.Open( szSQL );
if ( tabcs.IsOpen() )
m_list_child.SetItemText( index, 7, tabcs.CSQZMS.GetValue() );
m_list_child.SetItemText( index, 8, tabdl.DLJHJE.GetValue() );
sprintf( szSQL, "where xcygid = %s", tabdl.DLDLZG.GetValue() );
if( tabxc.Open( szSQL ) ) m_list_child.SetItemText( index, 9, tabxc.XCYGMC.GetValue() );
sprintf( szSQL, "where xcygid = %s", tabdl.DLTJRH.GetValue() );
if( tabxc.Open( szSQL ) ) m_list_child.SetItemText( index, 10, tabxc.XCYGMC.GetValue() );
sprintf( szSQL, "where dldlid = %s", tabdl.DLSJDL.GetValue() );
if( tabdl1.Open( szSQL ) ) m_list_child.SetItemText( index, 11, tabdl1.DLDLMC.GetValue() );
sprintf( szSQL, "where sjdlch = %s", tabdl.DLDLCH.GetValue() );
if( tabsj.Open( szSQL ) ) m_list_child.SetItemText( index, 12, tabsj.SJDLCM.GetValue() );
m_list_child.SetItemText( index, 13, tabdl.DLBZXX.GetValue() );
index ++;
tabdl.MoveNext();
}
}
catch( _com_error &e )
{
AfxMessageBox( e.ErrorMessage() );
}
}
void CFVChild::InsertDL()
{
int index = 0;
CDlgDL dlg;
CTabCS tabcs;
CTabXC tabxc;
CTabDL tabdl;
CTabSJ tabsj;
char szSQL[250];
if( dlg.DoModal() == IDOK )
{
index = m_list_child.GetItemCount();
m_list_child.InsertItem( index, dlg.strdldlbh, 0 );
m_list_child.SetItemData( index, atol( dlg.strdldlid ) );
m_list_child.SetItemText( index, 1, dlg.strdldlmc );
m_list_child.SetItemText( index, 2, dlg.strdldldh );
//m_list_child.SetItemText( index, 3, dlg.strdlkhyh );
memset( szSQL, 0, 255 );
sprintf( szSQL, "WHERE CSBMBM= 'XC' AND CSZDMC= 'XCKHYH' AND CSSZQZ = %s", dlg.strdlkhyh );
tabcs.Open( szSQL );
if ( tabcs.IsOpen() )
m_list_child.SetItemText( index, 3, tabcs.CSQZMS.GetValue() );
m_list_child.SetItemText( index, 4, dlg.strdlyhzh );
m_list_child.SetItemText( index, 5, dlg.strdljrrq );
m_list_child.SetItemText( index, 6, dlg.strdlfzrm );
//m_list_child.SetItemText( index, 7, dlg.strdldljb );
m_list_child.SetItemText( index, 8, dlg.strdljhje );
//m_list_child.SetItemText( index, 9, dlg.strdldlzg );
//m_list_child.SetItemText( index, 10, dlg.strdltjrh );
//m_list_child.SetItemText( index, 11, dlg.strdlsjdl );
//m_list_child.SetItemText( index, 12, dlg.strdldlch );
m_list_child.SetItemText( index, 13, dlg.strdlbzxx );
memset( szSQL, 0, 255 );
sprintf( szSQL, "WHERE CSBMBM= 'DL' AND CSZDMC= 'DLDLJB' AND CSSZQZ = %s", dlg.strdldljb );
tabcs.Open( szSQL );
if ( tabcs.IsOpen() )
m_list_child.SetItemText( index, 7, tabcs.CSQZMS.GetValue() );
sprintf( szSQL, "where xcygid = %s", dlg.strdldlzg );
if( tabxc.Open( szSQL ) ) m_list_child.SetItemText( index, 9, tabxc.XCYGMC.GetValue() );
sprintf( szSQL, "where xcygid = %s", dlg.strdltjrh );
if( tabxc.Open( szSQL ) ) m_list_child.SetItemText( index, 10, tabxc.XCYGMC.GetValue() );
sprintf( szSQL, "where dldlid = %s", dlg.strdlsjdl );
if( tabdl.Open( szSQL ) ) m_list_child.SetItemText( index, 11, tabdl.DLDLMC.GetValue() );
sprintf( szSQL, "where sjdlch = %s", dlg.strdldlch );
if( tabsj.Open( szSQL ) ) m_list_child.SetItemText( index, 12, tabsj.SJDLCM.GetValue() );
m_list_child.SetItemText( index, 13, tabdl.DLBZXX.GetValue() );
AfxMessageBox( "记录添加成功!" );
}
}
void CFVChild::UpdateDL()
{
CDlgDL dlg;
CString strdldlid;
CString strSQL;
CString strTmp;
CTabXC tabxc;
dlg.m_nOperType = MODE_MODIFY;
if( m_nCurrItem >= 0 )
{
strdldlid.Format( "%d", (int)m_list_child.GetItemData( m_nCurrItem) );
dlg.strdldlid = strdldlid;
dlg.strdldlbh = m_list_child.GetItemText( m_nCurrItem, 0 ); //代理编号
dlg.strdldlmc = m_list_child.GetItemText( m_nCurrItem, 1 ); //代理名称
dlg.strdldldh = m_list_child.GetItemText( m_nCurrItem, 2 ); //代理电话
dlg.strdlkhyh = m_list_child.GetItemText( m_nCurrItem, 3 ); //开户银行
dlg.strdlyhzh = m_list_child.GetItemText( m_nCurrItem, 4 ); //开户帐号
dlg.strdljrrq = m_list_child.GetItemText( m_nCurrItem, 5 ); //加入日期
dlg.strdlfzrm = m_list_child.GetItemText( m_nCurrItem, 6 ); //负责人名
dlg.strdldljb = m_list_child.GetItemText( m_nCurrItem, 7 ); //代理级别
dlg.strdljhje = m_list_child.GetItemText( m_nCurrItem, 8 ); //进货金额(首次)
dlg.strdldlzg = m_list_child.GetItemText( m_nCurrItem, 9 ); //代理主管
dlg.strdltjrh = m_list_child.GetItemText( m_nCurrItem, 10); //推荐人名
dlg.strdlsjdl = m_list_child.GetItemText( m_nCurrItem, 11); //上级代理
dlg.strdldlch = m_list_child.GetItemText( m_nCurrItem, 12); //代理处
dlg.strdlbzxx = m_list_child.GetItemText( m_nCurrItem, 13); //备注信息
strSQL.Format( "WHERE XCDLMC = %s", strdldlid );
tabxc.Open( strSQL );
if( tabxc.IsOpen() )
{
dlg.strxcygbh = tabxc.XCYGBH.strValue;//员工编号
dlg.strxcygid = tabxc.XCYGID.strValue;//宣传ID
dlg.strxctzkh = tabxc.XCTZKH.strValue;//投资卡号
dlg.m_ck_xuanchuan = true;
dlg.bFlag = TRUE;
}
else
{
dlg.m_ck_xuanchuan = false;
dlg.bFlag = FALSE;
}
}
if( dlg.DoModal() == IDOK )
{
m_list_child.SetItemText( m_nCurrItem, 0 , dlg.strdldlbh); //代理编号
m_list_child.SetItemText( m_nCurrItem, 1 , dlg.strdldlmc); //代理名称
m_list_child.SetItemText( m_nCurrItem, 2 , dlg.strdldldh); //代理电话
m_list_child.SetItemText( m_nCurrItem, 3 , dlg.strdlkhyh); //开户银行
m_list_child.SetItemText( m_nCurrItem, 4 , dlg.strdlyhzh); //开户帐号
m_list_child.SetItemText( m_nCurrItem, 5 , dlg.strdljrrq); //加入日期
m_list_child.SetItemText( m_nCurrItem, 6 , dlg.strdlfzrm); //负责人名
m_list_child.SetItemText( m_nCurrItem, 7 , dlg.strdldljb); //代理级别
m_list_child.SetItemText( m_nCurrItem, 8 , dlg.strdljhje); //进货金额(首次)
m_list_child.SetItemText( m_nCurrItem, 9 , dlg.strdldlzg); //代理主管
m_list_child.SetItemText( m_nCurrItem, 10, dlg.strdltjrh); //推荐人名
m_list_child.SetItemText( m_nCurrItem, 11, dlg.strdlsjdl); //上级代理
m_list_child.SetItemText( m_nCurrItem, 12, dlg.strdldlch); //代理处
m_list_child.SetItemText( m_nCurrItem, 13, dlg.strdlbzxx); //备注信息
AfxMessageBox( "记录修改成功!" );
QueryDL();
}
}
void CFVChild::DeleteDL()
{
char szSQL[250];
int nCount = 0;
nCount = m_list_child.GetItemCount();
if ( m_nCurrItem < 0 || nCount <= 0 ) return;
sprintf( szSQL, "UPDATE DL SET DLJLZT = 0 WHERE DLDLID = %d", (long)m_list_child.GetItemData( m_nCurrItem ) );
try
{
connection->Execute( szSQL, NULL, adExecuteNoRecords );
m_list_child.DeleteItem( m_nCurrItem );
}
catch( _com_error &e )
{
AfxMessageBox( e.ErrorMessage() );
}
catch( ... )
{
}
}
void CFVChild::InitSP()
{
if( m_nListMode != ID_WH_SP )
{
ClearList();
m_nListMode = ID_WH_SP;
Title( "产 品 信 息 维 护" );
m_list_child.InsertColumn( 0, "产品编号", LVCFMT_LEFT, 80 );
m_list_child.InsertColumn( 1, "产品名称", LVCFMT_LEFT, 150 );
m_list_child.InsertColumn( 2, "产品规格", LVCFMT_LEFT, 120 );
m_list_child.InsertColumn( 3, "计量单位", LVCFMT_LEFT, 70 );
m_list_child.InsertColumn( 4, "地区代理价", LVCFMT_RIGHT, 80 );
m_list_child.InsertColumn( 5, "县代理价", LVCFMT_RIGHT, 70 );
m_list_child.InsertColumn( 6, "乡代理价", LVCFMT_RIGHT, 70 );
m_list_child.InsertColumn( 7, "金卡单价", LVCFMT_RIGHT, 70 );
m_list_child.InsertColumn( 8, "银卡单价", LVCFMT_RIGHT, 70 );
m_list_child.InsertColumn( 9, "优惠单价", LVCFMT_RIGHT, 70 );
m_list_child.InsertColumn( 10, "零售价", LVCFMT_RIGHT, 70 );
m_list_child.InsertColumn( 11, "备注信息", LVCFMT_LEFT, 130 );
QuerySP();
}
}
void CFVChild::QuerySP()
{
int index = 0;
CTabSP tabsp;
CTabCS tabcs;
char szSQL[ 255 ];
CString strTmp;
m_list_child.DeleteAllItems();
try
{
tabsp.Open( "WHERE SPJLZT <> 0" );
while( tabsp.IsOpen() && !tabsp.IsEOF() )
{
index = m_list_child.GetItemCount();
m_list_child.InsertItem( index, tabsp.SPSPHM.GetValue(), 0 );
m_list_child.SetItemData( index, atol( tabsp.SPSPID.GetValue() ) );
m_list_child.SetItemText( index, 1, tabsp.SPSPMC.GetValue() );
sprintf( szSQL, "where csbmbm = 'SP' and cszdmc = 'SPCPGG' and csszqz = %s", tabsp.SPSPGG.GetValue() );
if( tabcs.Open( szSQL ) ) m_list_child.SetItemText( index, 2, tabcs.CSQZMS.GetValue() );
sprintf( szSQL, "where csbmbm = 'SP' and cszdmc = 'SPJLDW' and csszqz = %s", tabsp.SPJLDW.GetValue() );
if( tabcs.Open( szSQL ) ) m_list_child.SetItemText( index, 3, tabcs.CSQZMS.GetValue() );
strTmp.Format( "%.2f", atof( tabsp.SPDJDJ.GetValue() ) / 100 );
m_list_child.SetItemText( index, 4, strTmp );
strTmp.Format( "%.2f", atof( tabsp.SPXCDJ.GetValue() ) / 100 );
m_list_child.SetItemText( index, 5, strTmp );
strTmp.Format( "%.2f", atof( tabsp.SPXJDJ.GetValue() ) / 100 );
m_list_child.SetItemText( index, 6, strTmp );
strTmp.Format( "%.2f", atof( tabsp.SPJKDJ.GetValue() ) / 100 );
m_list_child.SetItemText( index, 7, strTmp );
strTmp.Format( "%.2f", atof( tabsp.SPYKDJ.GetValue() ) / 100 );
m_list_child.SetItemText( index, 8, strTmp );
strTmp.Format( "%.2f", atof( tabsp.SPYHDJ.GetValue() ) / 100 );
m_list_child.SetItemText( index, 9, strTmp );
strTmp.Format( "%.2f", atof( tabsp.SPLSJQ.GetValue() ) / 100 );
m_list_child.SetItemText( index, 10, strTmp );
m_list_child.SetItemText( index, 11, tabsp.SPBZXX.GetValue() );
index ++;
tabsp.MoveNext();
}
}
catch( _com_error &e )
{
AfxMessageBox( e.ErrorMessage() );
}
}
void CFVChild::InsertSP()
{
int index = 0;
CDlgSP dlg;
if( dlg.DoModal() == IDOK )
{
index = m_list_child.GetItemCount();
m_list_child.InsertItem( index, dlg.strspsphm, 0 );
m_list_child.SetItemData( index, atol( dlg.strspspid ) );
m_list_child.SetItemText( index, 1, dlg.strspspmc );
m_list_child.SetItemText( index, 2, dlg.strspspgg );
m_list_child.SetItemText( index, 3, dlg.strspjldw );
m_list_child.SetItemText( index, 4, dlg.strspdjdj );
m_list_child.SetItemText( index, 5, dlg.strspxcdj );
m_list_child.SetItemText( index, 6, dlg.strspxjdj );
m_list_child.SetItemText( index, 7, dlg.strspjkdj );
m_list_child.SetItemText( index, 8, dlg.strspykdj );
m_list_child.SetItemText( index, 9, dlg.strspyhdj );
m_list_child.SetItemText( index, 10, dlg.strsplsjq );
m_list_child.SetItemText( index, 11, dlg.strspbzxx );
}
}
void CFVChild::UpdateSP()
{
int index = 0;
CDlgSP dlg;
char szSQL[250];
CTabCS tabcs;
index = m_list_child.GetSelectionMark();
if ( index < 0 ) return;
dlg.strspspid.Format( "%d", (long)m_list_child.GetItemData( index ) );
dlg.strspsphm = m_list_child.GetItemText( index, 0 );
dlg.strspspmc = m_list_child.GetItemText( index, 1 );
dlg.strspspgg = m_list_child.GetItemText( index, 2 );
dlg.strspjldw = m_list_child.GetItemText( index, 3 );
dlg.strspdjdj = m_list_child.GetItemText( index, 4 );
dlg.strspxcdj = m_list_child.GetItemText( index, 5 );
dlg.strspxjdj = m_list_child.GetItemText( index, 6 );
dlg.strspjkdj = m_list_child.GetItemText( index, 7 );
dlg.strspykdj = m_list_child.GetItemText( index, 8 );
dlg.strspyhdj = m_list_child.GetItemText( index, 9 );
dlg.strsplsjq = m_list_child.GetItemText( index, 10 );
dlg.strspbzxx = m_list_child.GetItemText( index, 11 );
dlg.m_nOperType = MODE_MODIFY;
if( dlg.DoModal() == IDOK )
{
m_list_child.DeleteItem( index );
m_list_child.InsertItem( index, dlg.strspsphm, 0 );
m_list_child.SetItemData( index, atol( dlg.strspspid ) );
m_list_child.SetItemText( index, 1, dlg.strspspmc );
m_list_child.SetItemText( index, 2, dlg.strspspgg );
m_list_child.SetItemText( index, 3, dlg.strspjldw );
m_list_child.SetItemText( index, 4, dlg.strspdjdj );
m_list_child.SetItemText( index, 5, dlg.strspxcdj );
m_list_child.SetItemText( index, 6, dlg.strspxjdj );
m_list_child.SetItemText( index, 7, dlg.strspjkdj );
m_list_child.SetItemText( index, 8, dlg.strspykdj );
m_list_child.SetItemText( index, 9, dlg.strspyhdj );
m_list_child.SetItemText( index, 10, dlg.strsplsjq );
m_list_child.SetItemText( index, 11, dlg.strspbzxx );
sprintf( szSQL, "where csbmbm = 'SP' and cszdmc = 'SPCPGG' and csszqz = %s", dlg.strspspgg );
if( tabcs.Open( szSQL ) ) m_list_child.SetItemText( index, 2, tabcs.CSQZMS.GetValue() );
sprintf( szSQL, "where csbmbm = 'SP' and cszdmc = 'SPJLDW' and csszqz = %s", dlg.strspjldw );
if( tabcs.Open( szSQL ) ) m_list_child.SetItemText( index, 3, tabcs.CSQZMS.GetValue() );
}
}
void CFVChild::DeleteSP()
{
long lspid, index;
char szSQL[250];
index = m_list_child.GetSelectionMark();
if ( index < 0 ) return;
lspid = m_list_child.GetItemData( index );
memset( szSQL, 0 , 250 );
sprintf( szSQL, "UPDATE SP SET SPJLZT = 0 WHERE SPSPID = %d", lspid );
try
{
connection->Execute( szSQL, NULL, adExecuteNoRecords );
m_list_child.DeleteItem( index );
}
catch( ...)
{
}
}
void CFVChild::InitSJ()
{
if( m_nListMode != ID_WH_SJ )
{
ClearList();
m_nListMode = ID_WH_SJ;
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_LEFT, 150 );
QuerySJ();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?