📄 fvquery.cpp
字号:
void CFVQuery::QueryMingXi()
{
CDlgQueryConf dlg;
char szSQL[500];
int index = 0, i = 0;
CString strTmp;
CMyField field[16];
CAdoSet adoSet;
CTabCS tabcs;
dlg.m_nListMode = m_nListMode;
if (dlg.DoModal() == IDOK )
{
memset( szSQL, 0, 500 );
sprintf( szSQL, "SELECT XCYGMC, XCTZKH, GZYGHM, GZYBJF, GZEBJF, GZDWSL, GZXCFY,\
GZTGFY, GZYBYE, GZEBYE, GZSQYF, GZSJJE, GZSHSF, GZBZXX, GZCZRY, GZFFQB \
FROM GZ,XC WHERE GZGZID = XCYGID AND " );
strcat( szSQL, dlg.strSQL );
ClearList();
try
{
adoSet.Query( szSQL, field, 16 );
while ( adoSet.IsOpen() && !adoSet.IsEOF() )
{
if ( !i )
{
strTmp.Format( "南国春宣传推广费明细表 (第 %s 期)", field[15].GetValue() );
Title( strTmp );
}
strTmp.Format( "%d", index );
m_list_msg.InsertItem( index, strTmp );
m_list_msg.SetItemText( index, 1, field[0].GetValue() );
memset( szSQL, 0, 255 );
sprintf( szSQL, "WHERE CSBMBM = 'XC' AND CSZDMC = 'XCTZKH' AND CSSZQZ = %s AND YJLSPH = 0", field[1].GetValue() );
tabcs.Open( szSQL );
if ( tabcs.IsOpen() )
m_list_msg.SetItemText( index, 2, tabcs.CSQZMS.GetValue() );
m_list_msg.SetItemText( index, 3, field[2].GetValue() );
strTmp.Format( "%.2f", atof( field[3].GetValue() ) );
m_list_msg.SetItemText( index, 4, strTmp );
/*m_list_msg.SetItemText( index, 5, field[4].GetValue() );
m_list_msg.SetItemText( index, 6, field[5].GetValue() );
m_list_msg.SetItemText( index, 7, field[6].GetValue() );
m_list_msg.SetItemText( index, 8, field[7].GetValue() );
m_list_msg.SetItemText( index, 9, field[8].GetValue() );
m_list_msg.SetItemText( index, 10, field[9].GetValue() );
m_list_msg.SetItemText( index, 11, field[10].GetValue() );
m_list_msg.SetItemText( index, 12, field[11].GetValue() );
m_list_msg.SetItemText( index, 13, field[12].GetValue() );*/
strTmp.Format( "%.2f", atof( field[4].GetValue() ) );
m_list_msg.SetItemText( index, 5, strTmp );
strTmp.Format( "%.2f", atof( field[5].GetValue() ) );
m_list_msg.SetItemText( index, 6, strTmp );
strTmp.Format( "%.2f", atof( field[6].GetValue() ) );
m_list_msg.SetItemText( index, 7, strTmp );
strTmp.Format( "%.2f", atof( field[7].GetValue() ) );
m_list_msg.SetItemText( index, 8, strTmp );
strTmp.Format( "%.2f", atof( field[8].GetValue() ) );
m_list_msg.SetItemText( index, 9, strTmp );
strTmp.Format( "%.2f", atof( field[9].GetValue() ) );
m_list_msg.SetItemText( index, 10, strTmp );
strTmp.Format( "%.2f", atof( field[10].GetValue() ) );
m_list_msg.SetItemText( index, 11, strTmp );
strTmp.Format( "%.2f", atof( field[11].GetValue() ) );
m_list_msg.SetItemText( index, 12, strTmp );
strTmp.Format( "%.2f", atof( field[12].GetValue() ) );
m_list_msg.SetItemText( index, 13, strTmp );
m_list_msg.SetItemText( index, 14, field[13].GetValue() );
index++;
adoSet.MoveNext();
}
}
catch( _com_error &e )
{
AfxMessageBox( e.ErrorMessage() );
}
}
}
void CFVQuery::MingXiRowTextOut(int cx, int cy, CDC *pDC, int nrow )
{
CRect rcItem;
int nheight;
if ( nrow < 0 )
{
nheight = 20;
//序号
rcItem = CRect( cx , cy, cx + 30, cy + nheight );
pDC->DrawText( "序号", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//领款人
rcItem = CRect( cx + 29, cy, cx + 80, cy + nheight );
pDC->DrawText( "领款人", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//卡类
rcItem = CRect( cx + 79 , cy, cx + 120, cy + nheight );
pDC->DrawText( "卡类", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//编号
rcItem = CRect( cx + 119 , cy, cx + 170, cy + nheight );
pDC->DrawText( "编号", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//一部合作经费
rcItem = CRect( cx + 169 , cy, cx + 250, cy + nheight );
pDC->DrawText( "一部合作经费", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//二部合作经费
rcItem = CRect( cx + 249 , cy, cx + 330, cy + nheight );
pDC->DrawText( "二部合作经费", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//单位
rcItem = CRect( cx + 329 , cy, cx + 370, cy + nheight );
pDC->DrawText( "单位", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//广告费
rcItem = CRect( cx + 369 , cy, cx + 430, cy + nheight );
pDC->DrawText( "广告费", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//推广费
rcItem = CRect( cx + 429, cy, cx + 490, cy + nheight );
pDC->DrawText( "推广费", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//一部余合作经费
rcItem = CRect( cx + 489 , cy, cx + 580, cy + nheight );
pDC->DrawText( "一部余合作经费", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//二部余合作经费
rcItem = CRect( cx + 579, cy, cx + 670, cy + nheight );
pDC->DrawText( "二部余合作经费", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//税前应发
rcItem = CRect( cx + 669 , cy, cx + 725, cy + nheight );
pDC->DrawText( "税前应发", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//税金
rcItem = CRect( cx + 724, cy, cx + 765, cy + nheight );
pDC->DrawText( "税金", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//税前应发
rcItem = CRect( cx + 764 , cy, cx + 820, cy + nheight );
pDC->DrawText( "税前应发", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//备注
rcItem = CRect( cx + 819 , cy, cx + 900, cy + nheight );
pDC->DrawText( "备注", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
}
else
{
nheight = 20;
//序号
rcItem = CRect( cx , cy, cx + 30, cy + nheight);
pDC->DrawText( m_list_msg.GetItemText( nrow, 0 ), &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//领款人
rcItem = CRect( cx + 29, cy, cx + 80, cy + nheight);
pDC->DrawText( m_list_msg.GetItemText( nrow, 1 ), &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//卡类
rcItem = CRect( cx + 79 , cy , cx + 120, cy + nheight );
pDC->DrawText( m_list_msg.GetItemText( nrow, 2 ), &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//编号
rcItem = CRect( cx + 119 , cy, cx + 170, cy + nheight );
pDC->DrawText( m_list_msg.GetItemText( nrow, 3 ), &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//一部合作经费
rcItem = CRect( cx + 169 , cy, cx + 250, cy + nheight );
pDC->DrawText( m_list_msg.GetItemText( nrow, 4 ), &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//二部合作经费
rcItem = CRect( cx + 249 , cy, cx + 330, cy + nheight );
pDC->DrawText( m_list_msg.GetItemText( nrow, 5 ), &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//单位
rcItem = CRect( cx + 329 , cy, cx + 370, cy + nheight );
pDC->DrawText( m_list_msg.GetItemText( nrow, 6 ), &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//广告费
rcItem = CRect( cx + 369 , cy, cx + 430, cy + nheight );
pDC->DrawText( m_list_msg.GetItemText( nrow, 7 ), &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//推广费
rcItem = CRect( cx + 429, cy, cx + 490, cy + nheight );
pDC->DrawText( m_list_msg.GetItemText( nrow, 8 ), &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//一部余合作经费
rcItem = CRect( cx + 489 , cy, cx + 580, cy + nheight );
pDC->DrawText( m_list_msg.GetItemText( nrow, 9 ), &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//二部余合作经费
rcItem = CRect( cx + 579, cy, cx + 670, cy + nheight );
pDC->DrawText( m_list_msg.GetItemText( nrow, 10 ), &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//税前应发
rcItem = CRect( cx + 669 , cy, cx + 725, cy + nheight );
pDC->DrawText( m_list_msg.GetItemText( nrow, 11 ), &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//税金
rcItem = CRect( cx + 724, cy, cx + 765, cy + nheight );
pDC->DrawText( m_list_msg.GetItemText( nrow, 12 ), &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//税前应发
rcItem = CRect( cx + 764 , cy, cx + 820, cy + nheight );
pDC->DrawText( m_list_msg.GetItemText( nrow, 13 ), &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//备注
rcItem = CRect( cx + 819 , cy, cx + 900, cy + nheight );
pDC->DrawText( m_list_msg.GetItemText( nrow, 14 ), &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
}
}
void CFVQuery::CppfRowTextOut(int cx, int cy, CDC *pDC, int nrow)
{
CRect rcItem;
int nheight;
if ( nrow < 0 )
{
nheight = 20;
//日期
rcItem = CRect( cx , cy, cx + 60, cy + nheight );
pDC->DrawText( "日期", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//代理处名
rcItem = CRect( cx + 59, cy, cx + 180, cy + nheight );
pDC->DrawText( "代理处名", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//代理处编号
rcItem = CRect( cx + 179 , cy, cx + 260, cy + nheight );
pDC->DrawText( "代理处编号", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//产品(代码)
rcItem = CRect( cx + 259 , cy, cx + 340, cy + nheight );
pDC->DrawText( "产品(代码)", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//数量
rcItem = CRect( cx + 339 , cy, cx + 390, cy + nheight );
pDC->DrawText( "数量", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//净营业额
rcItem = CRect( cx + 389 , cy, cx + 470, cy + nheight );
if ( m_nListMode == ID_RP_SPLS )
pDC->DrawText( "净营业额", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
else
pDC->DrawText( "商品价格", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//小计
rcItem = CRect( cx + 469 , cy, cx + 550, cy + nheight );
pDC->DrawText( "小计", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//备注
rcItem = CRect( cx + 549 , cy, cx + 700, cy + nheight );
pDC->DrawText( "备注", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
}
else
{
nheight = 20;
//日期
rcItem = CRect( cx , cy, cx + 60, cy + nheight );
pDC->DrawText( m_list_msg.GetItemText( nrow, 0 ), &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//代理处名
rcItem = CRect( cx + 59, cy, cx + 180, cy + nheight );
pDC->DrawText( m_list_msg.GetItemText( nrow, 1 ), &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//代理处编号
rcItem = CRect( cx + 179 , cy, cx + 260, cy + nheight );
pDC->DrawText( m_list_msg.GetItemText( nrow, 2 ), &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//产品(代码)
rcItem = CRect( cx + 259 , cy, cx + 340, cy + nheight );
pDC->DrawText( m_list_msg.GetItemText( nrow, 3 ), &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//数量
rcItem = CRect( cx + 339 , cy, cx + 390, cy + nheight );
pDC->DrawText( m_list_msg.GetItemText( nrow, 4 ), &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//净营业额
rcItem = CRect( cx + 389 , cy, cx + 470, cy + nheight );
pDC->DrawText( m_list_msg.GetItemText( nrow, 5 ), &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//小计
rcItem = CRect( cx + 469 , cy, cx + 550, cy + nheight );
pDC->DrawText( m_list_msg.GetItemText( nrow, 6 ), &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
//备注
rcItem = CRect( cx + 549 , cy, cx + 700, cy + nheight );
pDC->DrawText( m_list_msg.GetItemText( nrow, 7 ), &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
}
}
void CFVQuery::QueryCpls()
{
CDlgQueryConf dlg;
char szSQL[500];
CMyField field[11];
CString strTmp;
int nindex = 0, i = 0;
CAdoSet adoSet;
dlg.m_nListMode = m_nListMode;
if (dlg.DoModal() == IDOK )
{
memset( szSQL, 0, 500 );
sprintf( szSQL, "SELECT SJCSBM, SJDLCM, YJJHSJ, SJFZRH, DLDLMC, "
"DLDLBH, YJSPID, YJJHSL, SPDJDJ, YJJHJE, YJBZXX FROM SJ, DL, YJ,SP WHERE "
" YJJDID = DLDLID AND SJDLCH = DLDLID AND SPSPID = YJSPID AND YJLSPH = 1 " );
strcat( szSQL, dlg.strSQL );
ClearList();
try
{
adoSet.Query( szSQL, field, 11 );
while( adoSet.IsOpen() && !adoSet.IsEOF() )
{
if (!i)
{
strTmp.Format( "代理处名称:%s 代理处编号:%s 上级代理处编号:%s",
field[1].GetValue(), field[0].GetValue(),
field[3].GetValue() );
m_static_atitle.SetWindowText( strTmp.GetBuffer( 0 ) );
}
i++;
m_list_msg.InsertItem( nindex, field[2].GetValue() );
m_list_msg.SetItemText( nindex, 1, field[4].GetValue() );
m_list_msg.SetItemText( nindex, 2, field[5].GetValue() );
m_list_msg.SetItemText( nindex, 3, field[6].GetValue() );
m_list_msg.SetItemText( nindex, 4, field[7].GetValue() );
//m_list_msg.SetItemText( nindex, 5, field[8].GetValue() );
strTmp.Format( "%.2f", atof(field[7].GetValue() ) );
m_list_msg.SetItemText( nindex, 5, strTmp );
strTmp.Format( "%.2f", atof(field[8].GetValue() )* atof(field[8].GetValue() )/10000 ) ;
m_list_msg.SetItemText( nindex, 6, strTmp );
//m_list_msg.SetItemText( nindex, 6, field[9].GetValue() );
m_list_msg.SetItemText( nindex, 7, field[10].GetValue() );
adoSet.MoveNext();
}
}
catch( _com_error &e )
{
AfxMessageBox( e.ErrorMessage() );
}
}
}
void CFVQuery::InitSpls()
{
if ( m_nListMode != ID_RP_SPLS )
{
int ncount = m_list_msg.GetHeaderCtrl()->GetItemCount();
for( ; ncount >=0; ncount--) m_list_msg.DeleteColumn( ncount );
m_nLinePerPage = 50;
m_nListMode = ID_RP_SPLS;
Title( "南国春系列产品零售汇总表" );
m_list_msg.InsertColumn( 0, "日期", LVCFMT_LEFT, 70 );
m_list_msg.InsertColumn( 1, "代理商品", LVCFMT_LEFT, 140 );
m_list_msg.InsertColumn( 2, "代理商编号", LVCFMT_LEFT, 140 );
m_list_msg.InsertColumn( 3, "产品代码", LVCFMT_LEFT, 140 );
m_list_msg.InsertColumn( 4, "数量", LVCFMT_LEFT, 100 );
m_list_msg.InsertColumn( 5, "净营业额", LVCFMT_LEFT, 100 );
m_list_msg.InsertColumn( 6, "小计", LVCFMT_LEFT, 100 );
m_list_msg.InsertColumn( 7, "备注", LVCFMT_LEFT, 200 );
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -