CorpSms/FPay.cpp
2025-02-27 16:58:16 +08:00

245 lines
4.7 KiB
C++

// FBill.cpp : implementation file
//
#include "stdafx.h"
#include "corpsms.h"
#include "FPay.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFPay dialog
#include "MainFrm.h"
#include "ProcessSocket.h"
CFPay::CFPay(CWnd* pParent /*=NULL*/)
: CDialog(CFPay::IDD, pParent)
{
//{{AFX_DATA_INIT(CFPay)
//}}AFX_DATA_INIT
m_bInit = false;
m_bRefresh = false;
}
void CFPay::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CFPay)
DDX_Control(pDX, IDC_PAY_S1, m_S_S1);
DDX_Control(pDX, IDC_PAY_QUERYMONTH, m_L_Month);
DDX_Control(pDX, IDC_PAY_LIST, m_wndList);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CFPay, CDialog)
//{{AFX_MSG_MAP(CFPay)
ON_WM_SIZE()
ON_BN_CLICKED(IDC_BILL_QUERY, OnBillQuery)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CFPay message handlers
BOOL CFPay::OnInitDialog()
{
CDialog::OnInitDialog();
//取得共用参数
//CMainFrame * pFrame = static_cast <CMainFrame *>((CMainFrame *)AfxGetMainWnd());
this->GetParent()->GetParentFrame();
m_pMainFrame = (CMainFrame *)this->GetParent()->GetParentFrame();
m_pSocket = &m_pMainFrame->m_Socket;
m_AdoRS.SetAdoConnection( &m_pMainFrame->m_adoConnection );
//初始化List
m_Image.Create(16,16,ILC_COLOR32|ILC_MASK,5,5);
m_Image.Add(AfxGetApp()->LoadIcon(IDI_L_ADDRESSM) );
m_Image.Add(AfxGetApp()->LoadIcon(IDI_L_LOCK) );
m_wndList.SubClassWindow2();
m_wndList.SetHeadings(_T("序号,50; 充值时间,120; 金 额,80; 单 价,80; 小 计,80; 赠 送,80; 合 计,90;"));
m_wndList.SetGridLines(true);
m_wndList.SetImageList(&m_Image,LVSIL_SMALL);
m_bInit = true;
//只能查前3个月的数据
SYSTEMTIME t; ::GetLocalTime(&t);
CString strTemp;
long lCount = 0;
for ( int i=0 ; i<5 ; i++ )
{
if ( t.wMonth <=0 )
{
t.wYear --;
t.wMonth = 12;
}
/*
if ( i==0 && t.wDay <=5 )
continue;
*/
strTemp.Format( _T("%04d年%02d月份") , t.wYear , t.wMonth );
int iTemp = m_L_Month.AddString(strTemp);
strTemp.Format( _T("%04d%02d") , t.wYear , t.wMonth );
m_L_Month.SetItemData(iTemp,_ttol(strTemp));
lCount ++;
if ( lCount>=4 )
break;
t.wMonth = t.wMonth-1;
}
m_L_Month.SetCurSel(0);
/*
m_tBegin.SetDate( t.wYear,t.wMonth,t.wDay ); //起始
if ( t.wMonth == 1 ||
t.wMonth == 3 ||
t.wMonth == 5 ||
t.wMonth == 7 ||
t.wMonth == 8 ||
t.wMonth == 10 ||
t.wMonth == 12 )
{
t.wDay = 31;
}
else
if (t.wMonth == 2 )
t.wDay = 28;
else
t.wDay = 30;
*/
UpdateData(false);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CFPay::OnSize(UINT nType, int cx, int cy)
{
CDialog::OnSize(nType, cx, cy);
if ( m_bInit )
{
CRect rect;
m_S_S1.GetWindowRect(&rect);
m_wndList.MoveWindow( 0 , 0+rect.Height()+12 , cx,cy-rect.Height()-12);
}
}
BOOL CFPay::ReShow(BOOL bRefresh)
{
ShowWindow( SW_SHOW );
if ( bRefresh || !m_bRefresh )
{
RefreshInfo();
}
return true;
}
BOOL CFPay::ReHide()
{
ShowWindow( SW_HIDE );
return true;
}
BOOL CFPay::RefreshInfo()
{
//默认是先查询自己
//没有查询帐单的权限,只能查询自己
UpdateData(false);
/*
if ( !m_pMainFrame->GetUserPurview( PURVIEW_SEEBILL , false ) )
{
//没有查询帐单的权限,只能查询自己
m_strUser = m_pMainFrame->m_pCurUser->szUser;
m_lUserID = m_pMainFrame->m_lUserID;
UpdateData(false);
}
*/
return true;
}
void CFPay::OnBillQuery()
{
UpdateData(true);
long lQuery= m_L_Month.GetItemData(m_L_Month.GetCurSel());
if ( lQuery<200512 )
{
MessageBox( _T("查询月份有误,请改正!") , _T("错误") , MB_ICONWARNING );
return ;
}
long lYear = lQuery/100;
long lMon = lQuery%100;
long lDay = 31;
if ( lMon == 1 ||
lMon == 3 ||
lMon == 5 ||
lMon == 7 ||
lMon == 8 ||
lMon == 10 ||
lMon == 12 )
{
lDay = 31;
}
else
if (lMon == 2 )
lDay = 28;
else
lDay = 30;
/*
REQ_Bill2 * pBill = new REQ_Bill2;memset(pBill,0,sizeof(REQ_Bill2));
pBill->lCorpID = m_pMainFrame->m_lCorpID; //企业ID
pBill->lUserID = m_lUserID; //查询用户ID
pBill->tBegin.wYear = lYear;
pBill->tBegin.wMonth = lMon;
pBill->tBegin.wDay = 1;
pBill->tEnd.wYear = lYear;
pBill->tEnd.wMonth = lMon;
pBill->tEnd.wDay = lDay;
m_pMainFrame->SendFrame(SMSFUNC_BILL3,(BYTE*)pBill,sizeof(REQ_Bill));
//m_pMainFrame->SendFrame(SMSFUNC_BILL2,(BYTE*)pBill,sizeof(REQ_Bill));
*/
return ;
}
long CFPay::ProcessSocket(Socket_Head *pHead)
{
if ( pHead->lFuncType == SMSFUNC_BILL3 )
{
return true;
}
return false;
}
void CFPay::OnOK()
{
return ;
CDialog::OnOK();
}
void CFPay::OnCancel()
{
return ;
CDialog::OnCancel();
}