// HospitalClientAlarm.cpp : implementation file // #include "stdafx.h" #include "ylgl.h" #include "HospitalClientAlarm.h" #include "MyMdi.H" #include "ModifyDinDan.h" #include "NeroDlg.h" #include "ClientRequirement.h" #include "./helper/ffsco.h" #include "SendMsgDlg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif #pragma comment(lib, "Shlwapi.lib") ///////////////////////////////////////////////////////////////////////////// // HospitalClientAlarm IMPLEMENT_DYNCREATE(HospitalClientAlarm, MyFormView) HospitalClientAlarm::HospitalClientAlarm() : MyFormView(HospitalClientAlarm::IDD) { m_date1 = GetTmFromStr(g_date); m_date2 = m_date1+CTimeSpan(30, 0, 0, 0); //}}AFX_DATA_INIT } HospitalClientAlarm::~HospitalClientAlarm() { } void HospitalClientAlarm::DoDataExchange(CDataExchange* pDX) { MyFormView::DoDataExchange(pDX); DDX_Control(pDX, IDC_LIST2, m_List1); DDX_Control(pDX, IDC_STATIC1, m_static1); DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKERdate1, m_date1); DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKERdate2, m_date2); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(HospitalClientAlarm, MyFormView) ON_BN_CLICKED(IDC_BUTclose, OnBUTclose) ON_BN_CLICKED(IDC_BUTTON1, OnButton1) ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1) ON_WM_TIMER() ON_BN_CLICKED(IDC_BUTshowphoto, OnBUTshowphoto) ON_BN_CLICKED(IDC_BUTexportphoto, OnBUTexportphoto) ON_BN_CLICKED(IDC_BUTimportphoto, OnBUTimportphoto) ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST2, OnItemchangedList2) ON_BN_CLICKED(IDC_BUTburncd, OnBUTHospitalClientAlarm) ON_NOTIFY(NM_DBLCLK, IDC_LIST2, OnDblclkList2) ON_BN_CLICKED(IDC_BUTburncd2, OnBUTburncd2) ON_BN_CLICKED(IDC_BUTsendmsg, OnBUTsendmsg) ON_BN_CLICKED(IDC_BUTprint3, OnBUTprint3) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // HospitalClientAlarm diagnostics #ifdef _DEBUG void HospitalClientAlarm::AssertValid() const { MyFormView::AssertValid(); } void HospitalClientAlarm::Dump(CDumpContext& dc) const { MyFormView::Dump(dc); } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // HospitalClientAlarm message handlers void HospitalClientAlarm::OnInitialUpdate() { MyFormView::OnInitialUpdate(); GetDlgItem(IDC_BUTprint3)->EnableWindow(IsHasRights2new(49)); // TODO: Add your specialized code here and/or call the base class CMyMdi Mdi; Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this); // Here we create the outbar control using the splitter as its parent // and setting its id to the first pane. CRect rc2; GetWindowRect(rc2); ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE); EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0); int idarray[]={IDC_BUTburncd2,IDC_BUTsendmsg,IDC_BUTprint3,IDC_BUTclose}; int idcount=4; int btnwid; CRect prerc; for(int a=idcount-2; a>=0; a--) { GetDlgItem(idarray[a+1])->GetWindowRect (prerc); ScreenToClient(prerc); GetDlgItem(idarray[a])->GetWindowRect (rc2); ScreenToClient(rc2); btnwid=rc2.Width (); rc2.right =prerc.left ; rc2.left =rc2.right -btnwid; GetDlgItem(idarray[a])->MoveWindow (rc2); } m_static1.SetFont (&g_titlefont); #if 0 // Jeff hospitalview添加了2字段,GetData里发送的查询是hospitalview视图的,所以该列表头也要显示; m_List1.SetHeadings("来单批号,100;客户姓名,100;宝宝姓名,100;宝宝性别,100;区域,100;类别,100;医院,100;电话1,100;电话2,100;QQ,100;地址1,100;地址2,100;地址3,100;录入日期,100;门市,100;录入员,100;业务种类,100;业务意向,100;预约日期,100;提醒日期,100;上门地址,100;备注,100" ); #else m_List1.SetHeadings("来单批号,100;客户姓名,100;宝宝姓名,100;宝宝性别,100;生日类型,100;宝宝生日,100;区域,100;类别,100;医院,100;电话1,100;电话2,100;QQ,100;地址1,100;地址2,100;地址3,100;录入日期,100;门市,100;录入员,100;业务种类,100;业务意向,100;预约日期,100;提醒日期,100;上门地址,100;备注,100" ); #endif // m_List1.LoadColumnInfo (144); m_List1.m_bSortSupport=0; GetData(); } void HospitalClientAlarm::OnBUTclose() { // TODO: Add your control notification handler code here GetParent()->SendMessage(WM_CLOSE); } void HospitalClientAlarm::OnSelchangeCombo1() { // TODO: Add your control notification handler code here SetTimer(1, 100, NULL); } void HospitalClientAlarm::OnTimer(UINT nIDEvent) { // TODO: Add your message handler code here and/or call default KillTimer(nIDEvent); OnButton1(); } BOOL HospitalClientAlarm::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class try { if(pMsg->message==WM_KEYDOWN) { switch (pMsg->wParam) { case VK_RETURN: OnButton1(); return 1; case 0x43: // copy if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) ) { GetFocus()->SendMessage(WM_COPY); return TRUE; } break; case 0x56: //Ctrl + V: if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) ) { GetFocus()->SendMessage(WM_PASTE); return TRUE; } break; case 0x58: // cut if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) ) { GetFocus()->SendMessage(WM_CUT); return TRUE; } break; case 0x5A: //undo case 0x59: //redo if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) ) { GetFocus()->SendMessage(WM_UNDO); return TRUE; } break; } } return MyFormView::PreTranslateMessage(pMsg); } catch(...) { } } void HospitalClientAlarm::GetSavePath(CString &path) { } int HospitalClientAlarm::FindArray(CStringArray *pArray, CString Str) { return 0; } void HospitalClientAlarm::GetNo(CString str, CStringArray &array) { } CString HospitalClientAlarm::GetSelName(CString name, CArray&spnamearray) { return ""; } void HospitalClientAlarm::OnBUTexportphoto() { } void HospitalClientAlarm::OnBUTimportphoto() { } void HospitalClientAlarm::OnBUTshowphoto() { // TODO: Add your control notification handler code here } void HospitalClientAlarm::OnButton1() { // TODO: Add your control notification handler code here FillGrid(); } void HospitalClientAlarm::OnItemchangedList2(NMHDR* pNMHDR, LRESULT* pResult) { NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR; // TODO: Add your control notification handler code here *pResult = 0; } void HospitalClientAlarm::OnBUTHospitalClientAlarm() { // TODO: Add your control notification handler code here } void HospitalClientAlarm::OnDblclkList2(NMHDR* pNMHDR, LRESULT* pResult) { // TODO: Add your control notification handler code here *pResult = 0; } void HospitalClientAlarm::OnBUTburncd2() { // TODO: Add your control notification handler code here POSITION pos; pos=m_List1.GetFirstSelectedItemPosition(); if(pos==NULL) { AfxMessageBox("请先选中您要取消的项目!", MB_ICONINFORMATION); return; } if(AfxMessageBox("确定取消该项目提醒吗?", MB_YESNO|MB_ICONINFORMATION)!=IDYES)return; int iItem=m_List1.GetNextSelectedItem(pos); CString businesstype=m_List1.GetItemText (iItem, 16); CString businessintention=m_List1.GetItemText (iItem, 17); CString bookingdate=m_List1.GetItemText (iItem, 18); CString alarmdate=m_List1.GetItemText (iItem, 19); CString id=m_List1.GetItemText (iItem, 0); while(id=="") { iItem--; id=m_List1.GetItemText (iItem, 0); } CString sql; sql.Format ("update [hospitalclientcontactreg] set [alarmcheck]='不提醒' where [businesstype]='%s' and [businessintention]='%s' and [bookingdate]='%s' and [alarmdate]='%s' and [id]='%s'",businesstype,businessintention,bookingdate,alarmdate, id); g_sendhead.bsql=1; g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return; AfxMessageBox("保存成功!", MB_ICONINFORMATION); GetData(); } // Jeff :发送短信; void HospitalClientAlarm::OnBUTsendmsg() { // TODO: Add your control notification handler code here POSITION pos; pos=m_List1.GetFirstSelectedItemPosition(); if(pos==NULL) { AfxMessageBox("请先选中您要发送短信的客人!", MB_ICONINFORMATION); return; } int iItem; CStringArray array; while (pos) { #if 0 // Jeff:列表多了2字段,需要移位; iItem = m_List1.GetNextSelectedItem(pos); if(!m_List1.GetItemText (iItem, 7).IsEmpty ()) array.Add (m_List1.GetItemText (iItem, 7)); if(!m_List1.GetItemText (iItem, 8).IsEmpty ()) array.Add (m_List1.GetItemText (iItem, 8)); #else iItem = m_List1.GetNextSelectedItem(pos); if(!m_List1.GetItemText (iItem, 9).IsEmpty ()) array.Add (m_List1.GetItemText (iItem, 9)); if(!m_List1.GetItemText (iItem, 10).IsEmpty ()) array.Add (m_List1.GetItemText (iItem, 10)); #endif } SendMsgDlg dlg; dlg.m_mode=2; dlg.m_pArray=&array; dlg.DoModal (); } void HospitalClientAlarm::OnBUTprint3() { ListToXLS(&m_List1, "c:\\提醒列表.xls", 0); } void HospitalClientAlarm::GetData() { g_sendhead.bsql=0; g_sendhead.code[0]=207; g_sendhead.tabcount=1; CString filter="alarmcheck='提醒'"; g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return; DataToArray(&m_List1array); if(m_List1array.GetSize ()) { CString id=m_List1array.ElementAt (0).ElementAt (0); for(int ii=1; iisignarray; int i = 0; for( i=0; iposarray; { CString date1=m_date1.Format("%Y-%m-%d"); CString date2=m_date2.Format("%Y-%m-%d"); { BOOL bFinded=0; for(ii=0; iidate2) if(m_List1array.ElementAt (ii).ElementAt (21)date2) { signarray.SetAt(ii, 0); bFinded=0; continue; } bFinded=1; } } for(ii=0; ii