MainFrimDlg2.cpp 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882
  1. // MainFrimDlg2.cpp: implementation of the MainFrimDlg2 class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #include "stdafx.h"
  5. #include "YLGL.h"
  6. #include "MainFrimDlg2.h"
  7. #include ".\MenuBarXP\MenuXP.h"
  8. //////////////////////////////////////////////////////////////////////
  9. // Construction/Destruction 图片欣赏
  10. /////////////////////////////////////////////////////////////////////
  11. CArray<CStringArray, CStringArray>g_OutlookBararray;
  12. //#include <afxpriv2.h>
  13. //#include <Atlbase.h>
  14. MainFrimDlg2::MainFrimDlg2()
  15. {
  16. m_bLoadMenu = 0;
  17. dataUpdateCentrer.setTodayBar(&m_bar); //add by wangwenbin for Update Centrer 2014-05-03
  18. }
  19. MainFrimDlg2::~MainFrimDlg2()
  20. {
  21. }
  22. void MainFrimDlg2::OnFSCommand(LPCTSTR command, LPCTSTR args)
  23. {
  24. }
  25. void MainFrimDlg2::Init()
  26. {
  27. g_pMainWnd2 = this;
  28. CString picdir = g_mainpath + "\\图片\\";
  29. if (g_bRedSkin)
  30. picdir = g_mainpath + "\\图片-红色风格\\";
  31. #ifdef REPL_TITLE
  32. if (::PathFileExists(picdir + "标题.jpg"))
  33. {
  34. Image *img = NULL;
  35. ::LoadImageFromBuf(&img, picdir + "标题.jpg");
  36. int width = img->GetWidth();
  37. int height = img->GetHeight();
  38. if (height == 87)
  39. {
  40. Graphics graph(m_pBk);
  41. Rect destinationRect(0, 0, width, height);
  42. graph.DrawImage(img, destinationRect, 0, 0, width, height, UnitPixel);
  43. }
  44. delete img;
  45. }
  46. #endif
  47. if (::PathFileExists(picdir + "背景.jpg"))
  48. {
  49. Image *pImg = NULL;
  50. ::LoadImageFromBuf(&pImg, picdir + "背景.jpg");
  51. if (1660 == pImg->GetWidth() && 1177 == pImg->GetHeight())
  52. {
  53. Graphics graph(m_pBk);
  54. CRect rc = m_rcarray.ElementAt(16);
  55. rc.left /= g_fscalex;
  56. rc.right /= g_fscalex;
  57. rc.top /= g_fscaley;
  58. rc.bottom /= g_fscaley;
  59. Rect destinationRect(rc.left, rc.top, rc.Width(), rc.Height());
  60. graph.DrawImage(pImg, destinationRect, 0, 0, pImg->GetWidth(), pImg->GetHeight(), UnitPixel);
  61. }
  62. delete pImg;
  63. }
  64. CRect rc;
  65. HWND wnd = ::FindWindow("Shell_TrayWnd", 0);
  66. ::GetWindowRect(wnd, &rc);
  67. int hei = rc.Height();
  68. rc = CRect(0, 0, g_screenwid, g_screenhei - hei);
  69. MoveWindow(rc);
  70. {
  71. CRgn rgn1, rgn2, rgn3;
  72. CRect rc = m_rcarray.ElementAt(16);
  73. rgn2.CreateRectRgn(rc.left, rc.top, rc.right, rc.bottom);
  74. ::SetWindowRgn(g_pMainWnd->m_hWnd, rgn2, 0);
  75. }
  76. ((MyBmpButton2*)m_picarray.ElementAt(11))->m_bAutoFocusImg = 1;
  77. ((MyBmpButton2*)m_picarray.ElementAt(12))->m_bAutoFocusImg = 1;
  78. ((MyBmpButton2*)m_picarray.ElementAt(13))->m_bAutoFocusImg = 1;
  79. ((MyBmpButton2*)m_picarray.ElementAt(28))->m_bAutoFocusImg = 1;
  80. ///////////////////////flash
  81. rc = m_rcarray.ElementAt(16);
  82. rc.left = rc.right - 115;
  83. rc.top = rc.bottom - 35;
  84. ((MyBmpButton2*)m_picarray.ElementAt(17))->MoveWindow(rc);
  85. //////////////////////////////////
  86. Init2();
  87. rc = m_rcarray.ElementAt(16);
  88. CRect oldmainrc = g_rc;
  89. g_rc = rc;
  90. g_dx = g_rc.left - oldmainrc.left;
  91. g_dy = g_rc.top - oldmainrc.top;
  92. g_WidthScale = ((float)g_rc.Width()) / 722.0;
  93. g_HeightScale = ((float)g_rc.Height()) / 533.0;
  94. if (g_screenwid == 2560 && g_screenhei == 1440)
  95. {
  96. // m_WidthScale*=0.775;
  97. // m_HeightScale*=0.76;
  98. }
  99. if (g_screenwid == 1920 && g_screenhei == 1440)
  100. {
  101. // m_WidthScale*=0.775;
  102. // m_HeightScale*=0.76;
  103. }
  104. #ifndef BASIC_VERSION
  105. m_bar.Create(IDD_DLGtodaybar, this);
  106. rc = g_rc; rc.bottom = rc.top + 20;
  107. rc.left++;
  108. rc.right -= 2;
  109. m_bar.MoveWindow(rc);
  110. #endif
  111. }
  112. void MainFrimDlg2::Destory()
  113. {
  114. }
  115. void MainFrimDlg2::BtnClick(WPARAM wParam, LPARAM lParam)
  116. {
  117. int id = lParam;
  118. id -= 99;
  119. switch (id)
  120. {
  121. case 14:
  122. g_pMainWnd->OnClose2();
  123. break;
  124. case 12:
  125. ::SendMessage(g_pMainWnd->GetSafeHwnd(), WM_SYSCOMMAND, SC_MINIMIZE, 0);
  126. break;
  127. case 8:
  128. case 9:
  129. case 10:
  130. case 11:
  131. ShowMenu(id - 8);
  132. break;
  133. case 1:
  134. g_pMainWnd->OnCommandMenu(IDM_TODAY);
  135. break;
  136. case 2:
  137. g_pMainWnd->OnCommandMenu(IDM_DINDAN);
  138. break;
  139. case 3:
  140. g_pMainWnd->OnCommandMenu(IDM_TAKECONTROL);
  141. break;
  142. case 4:
  143. g_pMainWnd->OnCommandMenu(IDM_CLIENTMONEY);
  144. break;
  145. case 5:
  146. g_pMainWnd->OnCommandMenu(IDM_TAKEAWAYBOOK);
  147. break;
  148. case 6:
  149. g_pMainWnd->OnCommandMenu(IDM_Daily);
  150. break;
  151. case 7:
  152. g_pMainWnd->OnCommandMenu(IDM_ProcessAlarm);
  153. break;
  154. break;
  155. case 29:
  156. if (g_bRedSkin)
  157. {
  158. if (AfxMessageBox("确定切换成蓝色风格界面吗?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  159. CString version = _T("Version 1.0");
  160. AfxGetApp()->WriteProfileInt(version, "redskin", 0);
  161. AfxMessageBox("切换成功,重启软件生效!", MB_ICONINFORMATION);
  162. }
  163. else
  164. {
  165. if (0 == ::PathFileExists(g_mainpath + "\\skin\\10-red.lia"))
  166. {
  167. AfxMessageBox("红色界面包尚未安装,请通知系统管理员!", MB_ICONINFORMATION);
  168. ShellExecute(NULL, _T("open"), _T("www.lyfz.net"), "", NULL, SW_SHOWNORMAL);
  169. return;
  170. }
  171. if (AfxMessageBox("确定切换成红色风格界面吗?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  172. CString version = _T("Version 1.0");
  173. AfxGetApp()->WriteProfileInt(version, "redskin", 1);
  174. AfxMessageBox("切换成功,重启软件生效!", MB_ICONINFORMATION);
  175. }
  176. break;
  177. }
  178. }
  179. BOOL MainFrimDlg2::PreTransMsg(MSG* pMsg)
  180. {
  181. if (pMsg->message == WM_KEYDOWN)
  182. {
  183. switch (pMsg->wParam)
  184. {
  185. case VK_ESCAPE:
  186. case VK_RETURN:
  187. return 1;
  188. }
  189. }
  190. else if (pMsg->message == WM_PAINT && pMsg->hwnd == this->m_hWnd)
  191. {
  192. SetTimer(1, 100, NULL);
  193. // DrawLogin();
  194. }
  195. else if (pMsg->message == WM_TIMER&& pMsg->hwnd == this->m_hWnd)
  196. {
  197. KillTimer(1);
  198. // LOG4C((LOG_NOTICE,"DrawLogin"));
  199. DrawLogin();
  200. }
  201. else if (pMsg->message == WM_LBUTTONUP)
  202. {
  203. CPoint pt;
  204. GetCursorPos(&pt);
  205. ScreenToClient(&pt);
  206. CRect rc;
  207. rc = m_rcarray.ElementAt(11);
  208. if (rc.PtInRect(pt))
  209. ::SendMessage(g_pMainWnd->GetSafeHwnd(), WM_SYSCOMMAND, SC_MINIMIZE, 0);
  210. rc = m_rcarray.ElementAt(16);
  211. rc.left = rc.right - 115;
  212. rc.top = rc.bottom - 35;
  213. if (rc.PtInRect(pt))
  214. ShellExecute(NULL, _T("open"), _T("www.lyfz.net"), "", NULL, SW_SHOWNORMAL);
  215. }
  216. else if (pMsg->message == WM_LBUTTONDBLCLK)
  217. {
  218. CPoint pt;
  219. GetCursorPos(&pt);
  220. ScreenToClient(&pt);
  221. CRect rc;
  222. GetClientRect(rc);
  223. CPoint pt2 = rc.CenterPoint();
  224. rc.left = pt2.x - 20;
  225. rc.right = pt2.x + 20;
  226. rc.top = pt2.y - 10;
  227. rc.bottom = pt2.y + 10;
  228. if (rc.PtInRect(pt) && g_pMainWnd->IsShiftDown() && g_pMainWnd->IsCtrlDown())
  229. {
  230. MessageBox("版权所有:惠州市利亚方舟科技有限公司\r\n电话:0752-2398865\r\n网址:www.lyfz.net");
  231. }
  232. }
  233. return g_pMainWnd->PreTranslateMessage(pMsg);
  234. return CDialog::PreTranslateMessage(pMsg);
  235. }
  236. void MainFrimDlg2::Init2()
  237. {
  238. CRect rc = m_rcarray.ElementAt(15);
  239. // rc.top-=5;
  240. // rc.bottom-=7;
  241. if (!m_wndOutlookBar.Create(WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN, rc, this, 0, OBS_XT_DEFAULT))
  242. {
  243. TRACE0("Failed to create outlook bar.");
  244. return;
  245. }
  246. // Set the background and text color of the outlook bar.
  247. if (g_bRedSkin)
  248. m_wndOutlookBar.SetBackColor(RGB(112, 29, 55));
  249. else
  250. m_wndOutlookBar.SetBackColor(RGB(70, 70, 70));
  251. m_wndOutlookBar.SetTextColor(RGB(0xff, 0xff, 0xff));
  252. // Add items to the outlook bar.
  253. InitializeOutlookBar();
  254. }
  255. static UINT nIcons[] =
  256. {
  257. IDI_ICON1, IDI_ICON3, IDI_ICON4, IDI_ICON7,
  258. IDI_ICON8, IDI_ICON2, IDI_ICON11, IDI_ICON6,
  259. IDI_ICON9, IDI_ICON10, IDI_ICON5
  260. };
  261. // 初始化侧边栏;
  262. void MainFrimDlg2::InitializeOutlookBar()
  263. {
  264. // Create the image lists used by the outlook bar.
  265. m_ImageSmall.Create(16, 16, ILC_COLOR16 | ILC_MASK, 2, 1);
  266. m_ImageLarge.Create(32, 32, ILC_COLOR16 | ILC_MASK, 2, 1);
  267. // initiailize the image lists.
  268. for (int i = 0; i < 11; ++i)
  269. {
  270. HICON hIcon = AfxGetApp()->LoadIcon(nIcons[i]);
  271. ASSERT(hIcon);
  272. m_ImageSmall.Add(hIcon);
  273. m_ImageLarge.Add(hIcon);
  274. }
  275. int iFolder; // index of the added folder
  276. CString rights;
  277. int foldercount = 0;
  278. // set the image lists for the outlook bar.
  279. m_wndOutlookBar.SetImageList(&m_ImageLarge, OBS_XT_LARGEICON);
  280. m_wndOutlookBar.SetImageList(&m_ImageSmall, OBS_XT_SMALLICON);
  281. g_user.rights2 = "*门市流程;1;拍照;修片;选片;精修;设计;发片/取件;*财务管理;0;*统计查询;0;* 短信群发 ;0;*会员管理;0;*礼服管理;0;*库存管理;0;*客户管理;0;*来电精灵;0;*员工考勤;0;";
  282. RefreshOutlookBar();
  283. }
  284. LRESULT MainFrimDlg2::OnOutbarNotify(WPARAM wParam, LPARAM lParam)
  285. {
  286. int nBarAction = (int)wParam;
  287. // Cast the lParam to a XT_OUTBAR_INFO* struct pointer.
  288. XT_OUTBAR_INFO* pOBInfo = (XT_OUTBAR_INFO*)lParam;
  289. ASSERT(pOBInfo);
  290. switch (nBarAction)
  291. {
  292. case OBN_XT_ITEMCLICK:
  293. {
  294. CString strMsg = pOBInfo->lpszText;
  295. g_pMainWnd->OnOutbarNotify(strMsg);
  296. // AfxMessageBox(strMsg);
  297. // TRACE2( "Item selected: %d, Name: %s.\n", pOBInfo->nIndex, pOBInfo->lpszText);
  298. }
  299. break;
  300. }
  301. return TRUE;
  302. }
  303. void MainFrimDlg2::SetSelFolder(int pos)
  304. {
  305. m_wndOutlookBar.SetSelFolder(pos);
  306. }
  307. void MainFrimDlg2::ShowMenu(int pos)
  308. {
  309. m_bLoadMenu = 1; m_nMenuPos = pos;
  310. CRect rc = m_rcarray.ElementAt(7 + pos);
  311. CMenuXP *pPopup;
  312. pPopup = new CMenuXP;
  313. pPopup->CYBUTTONMARGIN = 3;
  314. pPopup->CreatePopupMenu();
  315. pPopup->SetMenuStyle(CMenuXP::STYLE_XP);
  316. CString text;
  317. {
  318. CMenu *pMenu = g_pMainWnd->GetMenu();
  319. CMenu* submenu = pMenu->GetSubMenu(pos);
  320. CString version = _T("Version 1.0");
  321. BOOL checked = AfxGetApp()->GetProfileInt(version, "status", 0);
  322. CArray<DWORD, DWORD>delidarray;
  323. int count = g_pMainWnd->m_Mdi.GetCount(); if (count == -1)count = 0;
  324. if (pos == 2)//&& count)
  325. {
  326. // submenu->DeleteMenu (65280, MF_BYCOMMAND);
  327. // count=submenu->GetMenuItemCount ()-2;
  328. count = submenu->GetMenuItemCount();
  329. // submenu->DeleteMenu (count-1, MF_BYPOSITION);count--;
  330. }
  331. else
  332. count = submenu->GetMenuItemCount();
  333. int i = 0;
  334. for ( i = 0; i < count; i++)
  335. {
  336. // submenu->GetMenuString(submenu->GetMenuItemID(i), text, MF_BYCOMMAND);
  337. submenu->GetMenuString(i, text, MF_BYPOSITION);
  338. if (text.IsEmpty())
  339. {
  340. if (!(pos == 2 && i > 11))
  341. pPopup->AppendSeparator();
  342. }
  343. else
  344. {
  345. if (pos == 2 && i > 10)
  346. {
  347. DWORD id = submenu->GetMenuItemID(i);
  348. if (id > 1010)
  349. {
  350. delidarray.Add(id); continue;
  351. }
  352. } // CString str;
  353. // str.Format(":%d", submenu->GetMenuItemID(i));
  354. pPopup->AppendODMenu2(0, new CMenuXPText(submenu->GetMenuItemID(i), text, NULL));
  355. if (pos == 1 && i == 12 && checked)
  356. pPopup->CheckMenuItem(submenu->GetMenuItemID(i), MF_BYCOMMAND | MF_CHECKED);
  357. else if (pos == 1 && i == 13 && g_bStaffAchievementShow)
  358. pPopup->CheckMenuItem(submenu->GetMenuItemID(i), MF_BYCOMMAND | MF_CHECKED);
  359. else if (pos == 2 && i == 10 && g_bShowOK == 0)
  360. pPopup->CheckMenuItem(submenu->GetMenuItemID(i), MF_BYCOMMAND | MF_CHECKED);
  361. else if (pos == 2 && i > 10)
  362. {
  363. UINT status = submenu->GetMenuState(submenu->GetMenuItemID(i), MF_BYCOMMAND);
  364. if (status&MF_CHECKED)
  365. pPopup->CheckMenuItem(submenu->GetMenuItemID(i), MF_BYCOMMAND | MF_CHECKED);
  366. }
  367. else if (pos == 0 && i > 5)
  368. {
  369. UINT status = submenu->GetMenuState(submenu->GetMenuItemID(i), MF_BYCOMMAND);
  370. if (status&MF_CHECKED)
  371. pPopup->CheckMenuItem(submenu->GetMenuItemID(i), MF_BYCOMMAND | MF_CHECKED);
  372. }
  373. }
  374. }
  375. for (i = delidarray.GetSize() - 1; i >= 0; i--)
  376. submenu->DeleteMenu(delidarray.ElementAt(i), MF_BYCOMMAND);
  377. }
  378. rc.left += 5;
  379. pPopup->TrackPopupMenu(TPM_RIGHTBUTTON, rc.left, rc.bottom, g_pMainWnd, 0);
  380. delete pPopup;
  381. }
  382. void MainFrimDlg2::MouseMove()
  383. {
  384. if (m_bLoadMenu)
  385. {
  386. CPoint pt;
  387. ::GetCursorPos(&pt);
  388. ScreenToClient(&pt);
  389. CRect rc = m_rcarray.ElementAt(7);
  390. CRect rc2 = m_rcarray.ElementAt(8);
  391. CRect rc3 = m_rcarray.ElementAt(9);
  392. CRect rc4 = m_rcarray.ElementAt(10);
  393. if (rc.PtInRect(pt) && m_nMenuPos != 0)
  394. {
  395. ShowMenu(0);
  396. }
  397. else if (rc2.PtInRect(pt) && m_nMenuPos != 1)
  398. {
  399. ShowMenu(1);
  400. }
  401. else if (rc3.PtInRect(pt) && m_nMenuPos != 2)
  402. {
  403. ShowMenu(2);
  404. }
  405. else if (rc4.PtInRect(pt) && m_nMenuPos != 3)
  406. {
  407. ShowMenu(3);
  408. }
  409. }
  410. }
  411. //extern void LoadImageFromFile(Image **img, CString path);
  412. extern BOOL g_bDrawLogin;
  413. void MainFrimDlg2::DrawLogin()
  414. {
  415. if (!g_bDrawLogin)
  416. return;
  417. CDC *pDC = GetDC();
  418. Graphics graph(pDC->GetSafeHdc());
  419. CRect rc = m_rcarray.ElementAt(14); rc.right += 60;
  420. RectF layoutRect(rc.left, rc.top, rc.Width(), rc.Height());
  421. Rect destinationRect(rc.left, rc.top, rc.Width(), rc.Height());
  422. if (1)
  423. {
  424. CRect rc;
  425. HWND wnd = ::FindWindow("Shell_TrayWnd", 0);
  426. ::GetWindowRect(wnd, &rc);
  427. int hei = rc.Height();
  428. rc = CRect(0, 0, g_screenwid, g_screenhei - hei);
  429. g_fscalex = (float)g_screenwid / 2000.0;
  430. g_fscaley = (float)(g_screenhei - hei) / 1400.0;
  431. }
  432. rc.left /= g_fscalex;
  433. rc.right /= g_fscalex;
  434. rc.top /= g_fscaley;
  435. rc.bottom /= g_fscaley;
  436. graph.SetSmoothingMode(SmoothingModeHighQuality);
  437. graph.DrawImage(m_pBk, destinationRect, rc.left, rc.top, rc.Width(), rc.Height(), UnitPixel);
  438. StringFormat format;
  439. format.SetAlignment(StringAlignmentNear);
  440. SolidBrush *Brush = new SolidBrush(Color(255, 255, 255, 255));
  441. CString str;
  442. if (g_user.bLongin)
  443. str = g_user.name + " (联机) " + g_branchname;
  444. else
  445. str = "未登录 " + g_branchname;
  446. if (g_bAllBranch)
  447. {
  448. if (g_user.bLongin)
  449. str = g_user.name + " (联机) 多店汇总";
  450. else
  451. str = "未登录 多店汇总";
  452. }
  453. int leng = GetLengthEx(str);
  454. BSTR bstr = str.AllocSysString();
  455. Gdiplus::Font *g_TimerFont;
  456. if (g_screenwid <= 1024)
  457. g_TimerFont = new Gdiplus::Font(L"黑体", 9);
  458. else
  459. g_TimerFont = new Gdiplus::Font(L"黑体", 10);
  460. graph.SetTextRenderingHint(TextRenderingHintAntiAlias);
  461. graph.DrawString(
  462. bstr,
  463. leng,
  464. g_TimerFont,
  465. layoutRect,
  466. &format,
  467. Brush);
  468. delete Brush;
  469. delete g_TimerFont;
  470. SysFreeString(bstr);
  471. ReleaseDC(pDC);
  472. }
  473. void MainFrimDlg2::UseRgn(BOOL bUse)
  474. {
  475. if (bUse == 0)
  476. {
  477. CRect rc; GetClientRect(rc);
  478. CRgn rgn1, rgn2, rgn3;
  479. rgn1.CreateRectRgn(rc.left, rc.top, rc.right, rc.bottom);
  480. rc = m_rcarray.ElementAt(16);
  481. rgn2.CreateRectRgn(rc.left, rc.top, rc.right, rc.bottom);
  482. rgn1.CombineRgn(&rgn1, &rgn2, RGN_DIFF);
  483. ::SetWindowRgn(m_hWnd, rgn1, 1);
  484. }
  485. else
  486. {
  487. CRect rc;
  488. GetClientRect(rc);
  489. CRgn rgn2;
  490. rgn2.CreateRectRgn(rc.left, rc.top, rc.right, rc.bottom);
  491. ::SetWindowRgn(m_hWnd, rgn2, 1);
  492. }
  493. // ShowBar(bUse);
  494. }
  495. BOOL MainFrimDlg2::IsHasRight(CString rights, CString name)
  496. {
  497. return 1;
  498. CStringArray array;
  499. array.Add(_T("门市流程"));
  500. array.Add(_T("财务管理"));
  501. array.Add(_T("统计查询"));
  502. //array.Add(_T("短信群发"));//Jeff
  503. array.Add(_T("短信管理"));//Jeff
  504. array.Add(_T("会员管理"));
  505. array.Add(_T("礼服管理"));
  506. array.Add(_T("库存管理"));
  507. array.Add(_T("客户管理"));
  508. array.Add(_T("来电精灵"));
  509. array.Add(_T("员工考勤"));
  510. for (int i = 0; i < array.GetSize(); i++)
  511. {
  512. if (name == array.ElementAt(i))
  513. {
  514. return atoi(rights.Mid(i, 1));
  515. }
  516. }
  517. return 0;
  518. }
  519. void MainFrimDlg2::ShowBar(BOOL bShow)
  520. {
  521. #ifndef BASIC_VERSION
  522. if (g_bShowBar == 0 && bShow)return;
  523. if (g_bAllBranch)
  524. {
  525. m_bar.ShowWindow(0);
  526. return;
  527. }
  528. if (bShow)
  529. {
  530. m_bar.InitCtrl(); m_bar.LinkClick("∧");
  531. }
  532. m_bar.ShowWindow(bShow);
  533. #endif
  534. }
  535. BOOL MainFrimDlg2::IsHasRightsHead(CString rights, CString name)
  536. {
  537. if (g_user.account == "admin")return 1;
  538. name = "*" + name + ";1;";
  539. int pos = rights.Find(name);
  540. if (pos == -1)return 0;
  541. return 1;
  542. }
  543. BOOL MainFrimDlg2::IsHasRightsItem(CString rights, CString head, CString name)
  544. {
  545. if (g_user.account == "admin")return 1;
  546. head = "*" + head + ";";
  547. int pos = rights.Find(head);
  548. if (pos == -1)return 0;
  549. rights = rights.Right(rights.GetLength() - pos - head.GetLength() - 2);
  550. pos = rights.Find("*");
  551. if (pos != -1)
  552. rights = rights.Left(pos);
  553. if (name == "开单")
  554. {
  555. if (rights.Find("预约") != -1)return 1;
  556. }
  557. if (rights.Find(name) != -1)return 1;
  558. return 0;
  559. }
  560. void MainFrimDlg2::EnableBtns(BOOL bEnable)
  561. {
  562. ((MyBmpButton2*)m_picarray.ElementAt(0))->EnableWindow(bEnable);
  563. ((MyBmpButton2*)m_picarray.ElementAt(1))->EnableWindow(bEnable);
  564. ((MyBmpButton2*)m_picarray.ElementAt(2))->EnableWindow(bEnable);
  565. ((MyBmpButton2*)m_picarray.ElementAt(3))->EnableWindow(bEnable);
  566. ((MyBmpButton2*)m_picarray.ElementAt(4))->EnableWindow(bEnable);
  567. ((MyBmpButton2*)m_picarray.ElementAt(5))->EnableWindow(bEnable);
  568. ((MyBmpButton2*)m_picarray.ElementAt(6))->EnableWindow(bEnable);
  569. ((MyBmpButton2*)m_picarray.ElementAt(0))->ReDraw();
  570. ((MyBmpButton2*)m_picarray.ElementAt(1))->ReDraw();
  571. ((MyBmpButton2*)m_picarray.ElementAt(2))->ReDraw();
  572. ((MyBmpButton2*)m_picarray.ElementAt(3))->ReDraw();
  573. ((MyBmpButton2*)m_picarray.ElementAt(4))->ReDraw();
  574. ((MyBmpButton2*)m_picarray.ElementAt(5))->ReDraw();
  575. ((MyBmpButton2*)m_picarray.ElementAt(6))->ReDraw();
  576. }
  577. void MainFrimDlg2::RefreshOutlookBar2()
  578. {
  579. #ifdef BASIC_VERSION
  580. return;
  581. #endif
  582. int count = m_wndOutlookBar.GetFolderCount();
  583. while (count--)
  584. m_wndOutlookBar.RemoveFolder(0);
  585. int iFolder; // index of the added folder
  586. int foldercount = 0;
  587. CArray<CStringArray, CStringArray>List1array;
  588. List1array.SetSize(15, 0);
  589. List1array.ElementAt(0).Add("分店汇总");
  590. List1array.ElementAt(0).Add("订单报表");
  591. List1array.ElementAt(0).Add("发片/取件");
  592. List1array.ElementAt(0).Add("相片冲印");
  593. List1array.ElementAt(0).Add("金卡会员");
  594. List1array.ElementAt(0).Add("现金子卡");
  595. List1array.ElementAt(0).Add("员工资料");
  596. List1array.ElementAt(1).Add("客服中心");
  597. List1array.ElementAt(1).Add("摄控安排");
  598. List1array.ElementAt(1).Add("选片预约");
  599. List1array.ElementAt(1).Add("看样预约");
  600. List1array.ElementAt(1).Add("取件预约");
  601. #ifndef CHILD_VERSION
  602. List1array.ElementAt (1).Add ("婚庆安排");
  603. #endif
  604. List1array.ElementAt(2).Add("数码中心");
  605. List1array.ElementAt(2).Add("拍照");
  606. List1array.ElementAt(2).Add("修片");
  607. List1array.ElementAt(2).Add("精修");
  608. List1array.ElementAt(2).Add("设计");
  609. List1array.ElementAt(2).Add("数码安排");
  610. for (int i = 0; i < 15; i++)
  611. {
  612. while (List1array.ElementAt(i).GetSize() < 20)
  613. List1array.ElementAt(i).Add("");
  614. }
  615. CString m_rights = g_user.rights2;
  616. int nItem = 0;
  617. CString str;
  618. for (int a = 0; a < 3; a++)
  619. {
  620. for (int b = 0; b < 20; b++)
  621. {
  622. str = List1array.ElementAt(a).ElementAt(b);
  623. if (str.IsEmpty())break;
  624. if (b == 0)
  625. {
  626. if (1)//IsHasRightsHead(m_rights, str))
  627. {
  628. iFolder = m_wndOutlookBar.AddFolder(str, foldercount); foldercount++;
  629. }
  630. else
  631. break;
  632. }
  633. else
  634. {
  635. if (1)//IsHasRightsItem(m_rights, List1array.ElementAt (a).ElementAt (0), str))
  636. {
  637. m_wndOutlookBar.InsertItem(iFolder, b, str, b - 1, NULL);
  638. }
  639. }
  640. }
  641. }
  642. // We want to receive notification messages.
  643. m_wndOutlookBar.SetOwner(this);
  644. m_wndOutlookBar.SetSelFolder(0);
  645. }
  646. void MainFrimDlg2::RefreshOutlookBar()//初始化侧边栏;
  647. {
  648. int count = m_wndOutlookBar.GetFolderCount();
  649. while (count--)
  650. m_wndOutlookBar.RemoveFolder(0);
  651. int iFolder; // index of the added folder
  652. int foldercount = 0;
  653. g_OutlookBararray.RemoveAll();
  654. g_OutlookBararray.SetSize(15, 0);
  655. g_OutlookBararray.ElementAt(foldercount).Add("客户管理");
  656. g_OutlookBararray.ElementAt(foldercount).Add("服务跟踪");
  657. g_OutlookBararray.ElementAt(foldercount).Add("意向客户");
  658. g_OutlookBararray.ElementAt(foldercount).Add("服务记录");
  659. g_OutlookBararray.ElementAt(foldercount).Add("服务统计");
  660. g_OutlookBararray.ElementAt(foldercount).Add("每日签到");
  661. g_OutlookBararray.ElementAt(foldercount).Add("服务费");
  662. g_OutlookBararray.ElementAt(foldercount).Add("客户短信");
  663. g_OutlookBararray.ElementAt(foldercount).Add("满意度");
  664. g_OutlookBararray.ElementAt(foldercount).Add("满意度图表");
  665. g_OutlookBararray.ElementAt(foldercount).Add("客户流失");
  666. g_OutlookBararray.ElementAt(foldercount).Add("客户来源");
  667. foldercount++;
  668. g_OutlookBararray.ElementAt(foldercount).Add("门市流程");
  669. g_OutlookBararray.ElementAt(foldercount).Add("开单");
  670. foldercount++;
  671. g_OutlookBararray.ElementAt(foldercount).Add("财务管理");
  672. g_OutlookBararray.ElementAt(foldercount).Add("订单收款");
  673. g_OutlookBararray.ElementAt(foldercount).Add("其它二销");
  674. g_OutlookBararray.ElementAt(foldercount).Add("现金支出");
  675. g_OutlookBararray.ElementAt(foldercount).Add("其它收入");
  676. g_OutlookBararray.ElementAt(foldercount).Add("提成比例");
  677. //g_OutlookBararray.ElementAt (foldercount).Add ("员工工作");
  678. g_OutlookBararray.ElementAt(foldercount).Add("计件提成"); // Jeff
  679. g_OutlookBararray.ElementAt(foldercount).Add("工资管理");
  680. g_OutlookBararray.ElementAt(foldercount).Add("员工奖罚");
  681. foldercount++;
  682. g_OutlookBararray.ElementAt(foldercount).Add("统计查询");
  683. g_OutlookBararray.ElementAt(foldercount).Add("日财务表");
  684. g_OutlookBararray.ElementAt(foldercount).Add("月财务表");
  685. g_OutlookBararray.ElementAt(foldercount).Add("年财务表");
  686. g_OutlookBararray.ElementAt(foldercount).Add("年财务图表");
  687. g_OutlookBararray.ElementAt(foldercount).Add("订单图表");
  688. g_OutlookBararray.ElementAt(foldercount).Add("成本核算");
  689. g_OutlookBararray.ElementAt(foldercount).Add("工资报表");
  690. g_OutlookBararray.ElementAt(foldercount).Add("员工业绩");
  691. g_OutlookBararray.ElementAt(foldercount).Add("员工资料");
  692. g_OutlookBararray.ElementAt(foldercount).Add("员工奖惩");
  693. g_OutlookBararray.ElementAt(foldercount).Add("客户区域");
  694. foldercount++;
  695. // g_OutlookBararray.ElementAt (foldercount).Add (" 短信群发 ");
  696. g_OutlookBararray.ElementAt(foldercount).Add(" 短信管理 ");
  697. g_OutlookBararray.ElementAt(foldercount).Add("短信群发");
  698. g_OutlookBararray.ElementAt(foldercount).Add("短信发送");
  699. g_OutlookBararray.ElementAt(foldercount).Add("流程短信");
  700. g_OutlookBararray.ElementAt(foldercount).Add("员工短信");
  701. g_OutlookBararray.ElementAt(foldercount).Add("发送记录");
  702. g_OutlookBararray.ElementAt(foldercount).Add("短信设置");
  703. foldercount++;
  704. g_OutlookBararray.ElementAt(foldercount).Add("会员管理");
  705. g_OutlookBararray.ElementAt(foldercount).Add("金卡会员");
  706. g_OutlookBararray.ElementAt(foldercount).Add("现金子卡");
  707. g_OutlookBararray.ElementAt(foldercount).Add("金卡图表");
  708. g_OutlookBararray.ElementAt(foldercount).Add("积分短信");
  709. foldercount++;
  710. g_OutlookBararray.ElementAt(foldercount).Add("蓝钻会员");
  711. g_OutlookBararray.ElementAt(foldercount).Add("转介绍返现");
  712. g_OutlookBararray.ElementAt(foldercount).Add("转介绍图表");
  713. g_OutlookBararray.ElementAt(foldercount).Add("积分设置");
  714. foldercount++;
  715. g_OutlookBararray.ElementAt(foldercount).Add("库存管理");
  716. g_OutlookBararray.ElementAt(foldercount).Add("入库单");
  717. g_OutlookBararray.ElementAt(foldercount).Add("出库单");
  718. g_OutlookBararray.ElementAt(foldercount).Add("库存查询");
  719. g_OutlookBararray.ElementAt(foldercount).Add("商品图表");
  720. g_OutlookBararray.ElementAt(foldercount).Add("固定资产管理");
  721. foldercount++;
  722. g_OutlookBararray.ElementAt(foldercount).Add("来电精灵");
  723. g_OutlookBararray.ElementAt(foldercount).Add("客户来电");
  724. g_OutlookBararray.ElementAt(foldercount).Add("拨出电话");
  725. g_OutlookBararray.ElementAt(foldercount).Add("未接来电");
  726. foldercount++;
  727. g_OutlookBararray.ElementAt(foldercount).Add("员工考勤");
  728. g_OutlookBararray.ElementAt(foldercount).Add("考勤记录");
  729. g_OutlookBararray.ElementAt(foldercount).Add("月统计");
  730. g_OutlookBararray.ElementAt(foldercount).Add("时间设置");
  731. g_OutlookBararray.ElementAt(foldercount).Add("排班设置");
  732. BOOL bHospital = 0;
  733. if (g_cominfoarray.GetSize())
  734. {
  735. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(125)))
  736. {
  737. bHospital = 1;
  738. }
  739. }
  740. if (bHospital)
  741. {
  742. foldercount++;
  743. g_OutlookBararray.ElementAt(foldercount).Add("医院跟踪系统");
  744. g_OutlookBararray.ElementAt(foldercount).Add("意向查询");
  745. g_OutlookBararray.ElementAt(foldercount).Add("意向单录入");
  746. g_OutlookBararray.ElementAt(foldercount).Add("今日提醒");
  747. g_OutlookBararray.ElementAt(foldercount).Add("跟踪短信");
  748. g_OutlookBararray.ElementAt(foldercount).Add("资料设置");
  749. }
  750. for (int i = 0; i < 15; i++)
  751. {
  752. while (g_OutlookBararray.ElementAt(i).GetSize() < 20)
  753. g_OutlookBararray.ElementAt(i).Add("");
  754. }
  755. CString m_rights = g_user.rights2;
  756. int nItem = 0;
  757. CString str;
  758. int itemcount = 10;
  759. if (bHospital)itemcount = 11;
  760. for (int a = 0; a < itemcount; a++)
  761. {
  762. for (int b = 0; b < 20; b++)
  763. {
  764. str = g_OutlookBararray.ElementAt(a).ElementAt(b);
  765. if (str.IsEmpty())break;
  766. if (b == 0)
  767. {
  768. if (IsHasRightsHead(m_rights, str))
  769. {
  770. iFolder = m_wndOutlookBar.AddFolder(str, foldercount); foldercount++;
  771. }
  772. else
  773. break;
  774. }
  775. else
  776. {
  777. if (IsHasRightsItem(m_rights, g_OutlookBararray.ElementAt(a).ElementAt(0), str))
  778. {
  779. m_wndOutlookBar.InsertItem(iFolder, b, str, b - 1, NULL);
  780. }
  781. }
  782. }
  783. }
  784. // We want to receive notification messages.
  785. m_wndOutlookBar.SetOwner(this);
  786. m_wndOutlookBar.SetSelFolder(0);
  787. }