wagecountfview.cpp
来自「我自己整理的一些VC源代码」· C++ 代码 · 共 873 行 · 第 1/2 页
CPP
873 行
sprintf( szSQL, "where xcygid = %s", tabgz.GZYGHM.GetValue() );
tabxc.Open( szSQL );
m_list_child.SetItemText( index, 1, tabxc.XCYGMC.GetValue() );
nType = atoi( tabxc.XCTZKH.GetValue() );
if( nType == 1 ) strTmp = "金";
else if( nType == 2 ) strTmp = "银";
else if( nType == 3 ) strTmp = "优惠";
m_list_child.SetItemText( index, 2, strTmp );
m_list_child.SetItemText( index, 3, tabxc.XCYGBH.GetValue() );
nValue = atoi( tabgz.GZYBJF.GetValue() ) / 100;
strTmp = " ";
if( nValue ) strTmp.Format( "%d", nValue );
m_list_child.SetItemText( index, 4, strTmp );
nValue = atoi( tabgz.GZEBJF.GetValue() ) / 100;
strTmp = " ";
if( nValue ) strTmp.Format( "%d", nValue );
m_list_child.SetItemText( index, 5, strTmp );
nValue = atoi( tabgz.GZDWSL.GetValue() ) / 100;
strTmp = " ";
if( nValue ) strTmp.Format( "%d", nValue );
m_list_child.SetItemText( index, 6, strTmp );
nValue = atoi( tabgz.GZXCFY.GetValue() ) / 100;
strTmp = " ";
if( nValue ) strTmp.Format( "%d", nValue );
m_list_child.SetItemText( index, 7, strTmp );
nValue = atoi( tabgz.GZTGFY.GetValue() ) / 100;
strTmp = " ";
if( nValue ) strTmp.Format( "%d", nValue );
m_list_child.SetItemText( index, 8, strTmp );
nValue = atoi( tabgz.GZYBYE.GetValue() ) / 100;
strTmp = " ";
if( nValue ) strTmp.Format( "%d", nValue );
m_list_child.SetItemText( index, 9, strTmp );
nValue = atoi( tabgz.GZEBYE.GetValue() ) / 100;
strTmp = " ";
if( nValue ) strTmp.Format( "%d", nValue );
m_list_child.SetItemText( index, 10, strTmp );
nValue = atoi( tabgz.GZDDJT.GetValue() ) / 100;
strTmp = " ";
if( nValue ) strTmp.Format( "%d", nValue );
m_list_child.SetItemText( index, 11, strTmp );
nValue = atoi( tabgz.GZPPWH.GetValue() ) / 100;
strTmp = " ";
if( nValue ) strTmp.Format( "%d", nValue );
m_list_child.SetItemText( index, 12, strTmp );
nValue = atoi( tabgz.GZFLDY.GetValue() ) / 100;
strTmp = " ";
if( nValue ) strTmp.Format( "%d", nValue );
m_list_child.SetItemText( index, 13, strTmp );
nValue = atoi( tabgz.GZSQYF.GetValue() ) / 100;
strTmp = " ";
if( nValue ) strTmp.Format( "%d", nValue );
m_list_child.SetItemText( index, 14, strTmp );
nValue = atoi( tabgz.GZDNFY.GetValue() ) / 100;
strTmp = " ";
if( nValue ) strTmp.Format( "%d", nValue );
m_list_child.SetItemText( index, 15, strTmp );
nValue = atoi( tabgz.GZSDSE.GetValue() ) / 100;
strTmp = " ";
if( nValue ) strTmp.Format( "%d", nValue );
m_list_child.SetItemText( index, 16, strTmp );
nValue = atoi( tabgz.GZSHSF.GetValue() ) / 100;
strTmp = " ";
if( nValue ) strTmp.Format( "%d", nValue );
m_list_child.SetItemText( index, 17, strTmp );
m_list_child.SetItemText( index, 18, tabgz.GZBZXX.GetValue() );
tabgz.MoveNext();
}
}
catch( _com_error &e )
{
AfxMessageBox( e.ErrorMessage() );
}
catch( ... )
{
}
}
void CWageCountFView::OnBtClose()
{
GetParentFrame()->SendMessage( WM_CLOSE );
}
void CWageCountFView::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo)
{
m_nLinePerPage = 24;
int nCount = m_list_child.GetItemCount();
int nPage = nCount / m_nLinePerPage + 1;
pInfo->SetMaxPage( nPage );
}
void CWageCountFView::OnEndPrinting(CDC* pDC, CPrintInfo* pInfo)
{
// TODO: Add your specialized code here and/or call the base class
CFormView::OnEndPrinting(pDC, pInfo);
}
void CWageCountFView::OnEndPrintPreview(CDC* pDC, CPrintInfo* pInfo, POINT point, CPreviewView* pView)
{
// TODO: Add your specialized code here and/or call the base class
CFormView::OnEndPrintPreview(pDC, pInfo, point, pView);
}
BOOL CWageCountFView::OnPreparePrinting(CPrintInfo* pInfo)
{
return CFormView::DoPreparePrinting( pInfo );
//return CFormView::OnPreparePrinting(pInfo);
}
void CWageCountFView::OnPrint(CDC* pDC, CPrintInfo* pInfo)
{
int iSavedPageStart = pInfo->m_rectDraw.top;
pDC->SetWindowOrg( 0, 0 );
pDC->SetViewportOrg( pInfo->m_rectDraw.left, -iSavedPageStart );
// Print the Page
// Get the View-DC
CDC* pViewDC = GetDC();
// Set the Mappingmode
pDC->SetMapMode(MM_ANISOTROPIC);
// Define the Originmapping of the viewport and
// the window for Treeoutput
pDC->SetWindowOrg( 0, 0 );
pDC->SetViewportOrg( pInfo->m_rectDraw.left, pInfo->m_rectDraw.top - iSavedPageStart );
// Define the Extentmapping of the viewport and the Window
pDC->SetViewportExt( pDC->GetDeviceCaps(LOGPIXELSX)
,pDC->GetDeviceCaps(LOGPIXELSY) );
pDC->SetWindowExt( pViewDC->GetDeviceCaps(LOGPIXELSX)
,pViewDC->GetDeviceCaps(LOGPIXELSY) );
// Release the View-DC
ReleaseDC(pViewDC);
int obk = pDC->SetBkMode( 0 );
CFont *pOldFont = pDC->SelectObject( &m_ftTitle );
pDC->TextOut( 450, 20, "工 资 汇 总 表" );
pDC->SelectObject( &m_ftContent );
pDC->TextOut( 30, 50, "地区:" );
pDC->TextOut( 500, 50, "(第 期)" );
pDC->TextOut( 750, 50, " 年 月 日报单 月 日发放" );
int cx = 15;
CRect rcItem, rcTmp;
rcItem = CRect( cx, 65, cx + 40, 105 );
pDC->DrawText( "序号", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 50;
pDC->DrawText( "领款人", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 40;
pDC->DrawText( "卡类", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 60;
pDC->DrawText( "编号", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 80;
pDC->DrawText( "一部合作经费", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 80;
pDC->DrawText( "二部合作经费", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 40;
pDC->DrawText( "单位", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 50;
pDC->DrawText( "广告费", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 50;
pDC->DrawText( "推广费", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 60;
rcTmp = rcItem;
rcTmp.bottom -= 20;
pDC->DrawText( "一部余", &rcTmp, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
rcTmp = rcItem;
rcTmp.top += 20;
pDC->DrawText( "合作经费", &rcTmp, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 60;
rcTmp = rcItem;
rcTmp.bottom -= 20;
pDC->DrawText( "二部余", &rcTmp, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
rcTmp = rcItem;
rcTmp.top += 20;
pDC->DrawText( "合作经费", &rcTmp, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 60;
pDC->DrawText( "督导津贴", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 40;
rcTmp = rcItem;
rcTmp.bottom -= 20;
pDC->DrawText( "品牌", &rcTmp, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
rcTmp = rcItem;
rcTmp.top += 20;
pDC->DrawText( "维护费", &rcTmp, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 40;
pDC->DrawText( "福利", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 60;
pDC->DrawText( "税前应发", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 40;
rcTmp = rcItem;
rcTmp.right += 60;
rcTmp.bottom -= 20;
pDC->DrawText( "减项", &rcTmp, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
rcTmp = rcItem;
rcTmp.top += 20;
pDC->DrawText( "电脑费", &rcTmp, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcTmp, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcTmp.left = rcTmp.right - 1;
rcTmp.right = rcTmp.left + 60;
pDC->DrawText( "个人所得税", &rcTmp, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
rcTmp.right ++;
pDC->Draw3dRect( &rcTmp, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.right += 60;
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem = rcTmp;
rcItem.top -= 20;
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 50;
pDC->DrawText( "税后应发", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 110;
pDC->DrawText( "备注", &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
int cy = 105;
int nPage = pInfo->m_nCurPage;
int nCount = m_list_child.GetItemCount();
int nFromLine = ( nPage - 1 ) / m_nLinePerPage;
int nToLine = nFromLine + m_nLinePerPage;
for( int i = nFromLine; i < nToLine; i ++ )
{
PrintLine( cx, cy, pDC, i );
cy += 25;
}
CString strTmp;
pDC->TextOut( 30, 710, "合计金额:" );
pDC->TextOut( 300, 710, "制表人:" );
pDC->TextOut( 550, 710, "公司经办人:" );
strTmp.Format( "第 %d 页", nPage );
pDC->TextOut( 500, 740, strTmp );
pDC->SelectObject( pOldFont );
pDC->SetBkMode( obk );
}
void CWageCountFView::PrintLine(int cx, int cy, CDC *pDC, int nItem)
{
int nCount = m_list_child.GetItemCount();
CRect rcItem;
CString strTmp, strSequence = " ", strName = " ", strCard = " ", strCode = " ";
CString strAdRade1 = " ", strAdRate2 = " ", strUnit = " ", strFlack = " ", strExtend = " ";
CString strSpareRate1 = " ", strSpareRate2 = " ", strSubsidy = " ", strAegis = " ", strWelfare = " ";
CString strBeginTax = " ", strComputer = " ", strTax = " ", strAfterTax = " ", strRemark = " ";
int nHeight = 25;
strSequence.Format( "%d", nItem + 1 );
if( nItem < nCount )
{
strName = m_list_child.GetItemText( nItem, 1 );
strCard = m_list_child.GetItemText( nItem, 2 );
strCode = m_list_child.GetItemText( nItem, 3 );
strAdRade1 = m_list_child.GetItemText( nItem, 4 );
strAdRate2 = m_list_child.GetItemText( nItem, 5 );
strUnit = m_list_child.GetItemText( nItem, 6 );
strFlack = m_list_child.GetItemText( nItem, 7 );
strExtend = m_list_child.GetItemText( nItem, 8 );
strSpareRate1 = m_list_child.GetItemText( nItem, 9 );
strSpareRate2 = m_list_child.GetItemText( nItem, 10 );
strSubsidy = m_list_child.GetItemText( nItem, 11 );
strAegis = m_list_child.GetItemText( nItem, 12 );
strWelfare = m_list_child.GetItemText( nItem, 13 );
strBeginTax = m_list_child.GetItemText( nItem, 14 );
strComputer = m_list_child.GetItemText( nItem, 15 );
strTax = m_list_child.GetItemText( nItem, 16 );
strAfterTax = m_list_child.GetItemText( nItem, 17 );
strRemark = m_list_child.GetItemText( nItem, 18 );
}
rcItem = CRect( cx, cy - 1, cx + 40, cy + nHeight );
pDC->DrawText( strSequence, &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 50;
pDC->DrawText( strName, &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 40;
pDC->DrawText( strCard, &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 60;
pDC->DrawText( strCode, &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 80;
pDC->DrawText( strAdRade1, &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 80;
pDC->DrawText( strAdRate2, &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 40;
pDC->DrawText( strUnit, &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 50;
pDC->DrawText( strFlack, &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 50;
pDC->DrawText( strExtend, &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 60;
pDC->DrawText( strSpareRate1, &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 60;
pDC->DrawText( strSpareRate2, &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 60;
pDC->DrawText( strSubsidy, &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 40;
pDC->DrawText( strAegis, &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 40;
pDC->DrawText( strWelfare, &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 60;
pDC->DrawText( strBeginTax, &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 40;
pDC->DrawText( strComputer, &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 61;
pDC->DrawText( strTax, &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 50;
pDC->DrawText( strAfterTax, &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
rcItem.left = rcItem.right - 1;
rcItem.right = rcItem.left + 110;
pDC->DrawText( strRemark, &rcItem, DT_CENTER | DT_VCENTER | DT_SINGLELINE );
pDC->Draw3dRect( &rcItem, RGB( 0, 0, 0 ), RGB( 0, 0, 0 ) );
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?