Client2FormLYFZ.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753
  1. // Client2FormLYFZ.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "Client2FormLYFZ.h"
  6. #include "MyMdi.H"
  7. #include "ModifyDinDan.h"
  8. #include "TakeMoney2.h"
  9. #include "NeroDlg.h"
  10. #include "ClientRequirement.h"
  11. #include "ChooseDesignSkin.h"
  12. #include "./helper/ffsco.h"
  13. #include "AddClientLYFZ.h"
  14. #include "SendMsgDlg.h"
  15. #include "SearchFilter5.h"
  16. #ifdef _DEBUG
  17. #define new DEBUG_NEW
  18. #undef THIS_FILE
  19. static char THIS_FILE[] = __FILE__;
  20. #endif
  21. #pragma comment(lib, "Shlwapi.lib")
  22. /////////////////////////////////////////////////////////////////////////////
  23. // Client2FormLYFZ
  24. IMPLEMENT_DYNCREATE(Client2FormLYFZ, MyFormView)
  25. Client2FormLYFZ::Client2FormLYFZ()
  26. : MyFormView(Client2FormLYFZ::IDD)
  27. {
  28. //{{AFX_DATA_INIT(Client2FormLYFZ)
  29. m_filter = _T("");
  30. //}}AFX_DATA_INIT
  31. }
  32. Client2FormLYFZ::~Client2FormLYFZ()
  33. {
  34. }
  35. void Client2FormLYFZ::DoDataExchange(CDataExchange* pDX)
  36. {
  37. MyFormView::DoDataExchange(pDX);
  38. //{{AFX_DATA_MAP(Client2FormLYFZ)
  39. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  40. DDX_Control(pDX, IDC_LIST2, m_List1);
  41. DDX_Control(pDX, IDC_STATIC1, m_static1);
  42. DDX_CBString(pDX, IDC_COMBO1, m_filter);
  43. //}}AFX_DATA_MAP
  44. }
  45. BEGIN_MESSAGE_MAP(Client2FormLYFZ, MyFormView)
  46. //{{AFX_MSG_MAP(Client2FormLYFZ)
  47. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  48. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  49. ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
  50. ON_WM_TIMER()
  51. ON_BN_CLICKED(IDC_BUTshowphoto, OnBUTshowphoto)
  52. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  53. ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST2, OnItemchangedList2)
  54. ON_BN_CLICKED(IDC_BUTburncd, OnBUTClient2FormLYFZ)
  55. ON_NOTIFY(NM_DBLCLK, IDC_LIST2, OnDblclkList2)
  56. ON_BN_CLICKED(IDC_BUTburncd2, OnBUTburncd2)
  57. ON_BN_CLICKED(IDC_BUTburncd3, OnBUTburncd3)
  58. ON_BN_CLICKED(IDC_BUTsendmsg, OnBUTsendmsg)
  59. ON_BN_CLICKED(IDC_BUTprint3, OnBUTprint3)
  60. //}}AFX_MSG_MAP
  61. END_MESSAGE_MAP()
  62. /////////////////////////////////////////////////////////////////////////////
  63. // Client2FormLYFZ diagnostics
  64. #ifdef _DEBUG
  65. void Client2FormLYFZ::AssertValid() const
  66. {
  67. MyFormView::AssertValid();
  68. }
  69. void Client2FormLYFZ::Dump(CDumpContext& dc) const
  70. {
  71. MyFormView::Dump(dc);
  72. }
  73. #endif //_DEBUG
  74. /////////////////////////////////////////////////////////////////////////////
  75. // Client2FormLYFZ message handlers
  76. void Client2FormLYFZ::OnInitialUpdate()
  77. {
  78. MyFormView::OnInitialUpdate();
  79. GetDlgItem(IDC_BUTburncd3)->EnableWindow(IsHasRights2new(49));
  80. GetDlgItem(IDC_BUTprint3)->EnableWindow(IsHasRights2new(49));
  81. // TODO: Add your specialized code here and/or call the base class
  82. CMyMdi Mdi;
  83. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  84. // Here we create the outbar control using the splitter as its parent
  85. // and setting its id to the first pane.
  86. CRect rc2;
  87. GetWindowRect(rc2);
  88. ::MoveWindow(m_hWnd, g_rc.left, g_rc.top, g_rc.Width(), g_rc.Height(), TRUE);
  89. EnumChildWindows(m_hWnd, (WNDENUMPROC)EnumChildProc, 0);
  90. int idarray[] = { IDC_BUTburncd, IDC_BUTburncd2, IDC_BUTburncd3, IDC_BUTsendmsg, IDC_BUTprint3, IDC_BUTclose };
  91. int idcount = 6;
  92. int btnwid;
  93. CRect prerc;
  94. for (int a = idcount - 2; a >= 0; a--)
  95. {
  96. GetDlgItem(idarray[a + 1])->GetWindowRect(prerc);
  97. ScreenToClient(prerc);
  98. GetDlgItem(idarray[a])->GetWindowRect(rc2);
  99. ScreenToClient(rc2);
  100. btnwid = rc2.Width();
  101. rc2.right = prerc.left;
  102. rc2.left = rc2.right - btnwid;
  103. GetDlgItem(idarray[a])->MoveWindow(rc2);
  104. }
  105. m_static1.SetFont(&g_titlefont);
  106. m_List1.SetHeadings("id,0;地区,100;老总姓名,100;影楼名称,100;业务员,100;电话,100;QQ,100;地址,100;来源,100;状态,100;备注,100;日期,100");
  107. m_List1.LoadColumnInfo(144);
  108. GetData();
  109. m_combo1.GetWindowRect(rc2);
  110. ScreenToClient(rc2);
  111. rc2.bottom += 200;
  112. m_combo1.MoveWindow(rc2);
  113. GetDlgItem(IDC_BUTclose)->GetWindowRect(rc2);
  114. SetComboHei(&m_combo1, rc2.Height());
  115. }
  116. void Client2FormLYFZ::FillGrid(BOOL bStatus)
  117. {
  118. if (g_bSearchFilter)
  119. {
  120. m_List1.DeleteAllItems2();
  121. int ii = 0;
  122. m_List1.m_arLabels.SetSize(m_List1array.GetSize(), 1);
  123. int count = 0;
  124. {
  125. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  126. {
  127. if (g_filterdate1 != "")
  128. {
  129. if (m_List1array.ElementAt(ii).ElementAt(11) < g_filterdate1 || m_List1array.ElementAt(ii).ElementAt(11) > g_filterdate2)
  130. continue;
  131. }
  132. if (g_waiter1 != "")
  133. {
  134. if (m_List1array.ElementAt(ii).ElementAt(4) != g_waiter1)
  135. continue;
  136. }
  137. if (g_waiter2 != "")
  138. {
  139. if (m_List1array.ElementAt(ii).ElementAt(1) != g_waiter2)
  140. continue;
  141. }
  142. if (g_waiter3 != "")
  143. {
  144. if (m_List1array.ElementAt(ii).ElementAt(8) != g_waiter3)
  145. continue;
  146. }
  147. if (g_waiter4 != "")
  148. {
  149. if (m_List1array.ElementAt(ii).ElementAt(9) != g_waiter4)
  150. continue;
  151. }
  152. if (1)
  153. {
  154. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  155. }
  156. }
  157. }
  158. m_List1.m_arLabels.SetSize(count, 1);
  159. ii = count;
  160. m_List1.m_LabelCount = ii;
  161. m_List1.SetItemCountEx(ii);
  162. CString str;
  163. str.Format("单数:%d", ii);
  164. SetDlgItemText(IDC_STATIC2, str);
  165. }
  166. else
  167. {
  168. m_List1.DeleteAllItems2();
  169. int ii = 0;
  170. m_List1.m_arLabels.SetSize(m_List1array.GetSize(), 1);
  171. int count = 0;
  172. if (m_filter.IsEmpty())
  173. {
  174. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  175. {
  176. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  177. }
  178. }
  179. else
  180. {
  181. int type = GetType(m_filter);
  182. if (type == 1)//电话
  183. {
  184. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  185. {
  186. if (m_List1array.ElementAt(ii).ElementAt(5).Find(m_filter) != -1)
  187. {
  188. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  189. }
  190. }
  191. }
  192. else if (type == 2)//拼音
  193. {
  194. m_filter.MakeUpper();
  195. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  196. {
  197. if (m_List1array.ElementAt(ii).ElementAt(12).Find(m_filter) != -1 || m_List1array.ElementAt(ii).ElementAt(13).Find(m_filter) != -1)
  198. {
  199. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  200. }
  201. }
  202. }
  203. else
  204. {
  205. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  206. {
  207. if (m_List1array.ElementAt(ii).ElementAt(0).Find(m_filter) != -1 || \
  208. m_List1array.ElementAt(ii).ElementAt(1).Find(m_filter) != -1 || \
  209. m_List1array.ElementAt(ii).ElementAt(2).Find(m_filter) != -1 || \
  210. m_List1array.ElementAt(ii).ElementAt(3).Find(m_filter) != -1 || \
  211. m_List1array.ElementAt(ii).ElementAt(4).Find(m_filter) != -1 || \
  212. m_List1array.ElementAt(ii).ElementAt(5).Find(m_filter) != -1 || \
  213. m_List1array.ElementAt(ii).ElementAt(6).Find(m_filter) != -1 || \
  214. m_List1array.ElementAt(ii).ElementAt(7).Find(m_filter) != -1 || \
  215. m_List1array.ElementAt(ii).ElementAt(9).Find(m_filter) != -1 || \
  216. m_List1array.ElementAt(ii).ElementAt(8).Find(m_filter) != -1)
  217. {
  218. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  219. }
  220. }
  221. }
  222. }
  223. m_List1.m_arLabels.SetSize(count, 1);
  224. ii = count;
  225. m_List1.m_LabelCount = ii;
  226. m_List1.SetItemCountEx(ii);
  227. CString str;
  228. str.Format("客人:%d", ii);
  229. SetDlgItemText(IDC_STATIC2, str);
  230. }
  231. }
  232. void Client2FormLYFZ::OnBUTclose()
  233. {
  234. // TODO: Add your control notification handler code here
  235. GetParent()->SendMessage(WM_CLOSE);
  236. }
  237. void Client2FormLYFZ::OnSelchangeCombo1()
  238. {
  239. // TODO: Add your control notification handler code here
  240. SetTimer(1, 100, NULL);
  241. }
  242. void Client2FormLYFZ::OnTimer(UINT nIDEvent)
  243. {
  244. // TODO: Add your message handler code here and/or call default
  245. KillTimer(nIDEvent);
  246. OnButton1();
  247. }
  248. BOOL Client2FormLYFZ::PreTranslateMessage(MSG* pMsg)
  249. {
  250. // TODO: Add your specialized code here and/or call the base class
  251. try
  252. {
  253. if (pMsg->message == WM_KEYDOWN)
  254. {
  255. switch (pMsg->wParam)
  256. {
  257. case VK_RETURN:
  258. OnButton1();
  259. return 1;
  260. case 0x43: // copy
  261. if ((GetKeyState(VK_CONTROL) & 0x80))
  262. {
  263. GetFocus()->SendMessage(WM_COPY);
  264. return TRUE;
  265. }
  266. break;
  267. case 0x56: //Ctrl + V:
  268. if ((GetKeyState(VK_CONTROL) & 0x80))
  269. {
  270. GetFocus()->SendMessage(WM_PASTE);
  271. return TRUE;
  272. }
  273. break;
  274. case 0x58: // cut
  275. if ((GetKeyState(VK_CONTROL) & 0x80))
  276. {
  277. GetFocus()->SendMessage(WM_CUT);
  278. return TRUE;
  279. }
  280. break;
  281. case 0x5A: //undo
  282. case 0x59: //redo
  283. if ((GetKeyState(VK_CONTROL) & 0x80))
  284. {
  285. GetFocus()->SendMessage(WM_UNDO);
  286. return TRUE;
  287. }
  288. break;
  289. }
  290. }
  291. return MyFormView::PreTranslateMessage(pMsg);
  292. }
  293. catch (...)
  294. {
  295. }
  296. return true;
  297. }
  298. extern int CALLBACK BrowseProc(HWND hwnd, UINT msg, LPARAM lParam, LPARAM lpData);
  299. /*{
  300. switch(msg)
  301. {
  302. case BFFM_INITIALIZED:
  303. SendMessage(hwnd, BFFM_SETSELECTION, TRUE, NULL);
  304. break;
  305. case BFFM_SELCHANGED:
  306. {
  307. char szFileName[MAX_PATH];
  308. LPITEMIDLIST pidlCurrent = (LPITEMIDLIST)lParam;
  309. SHGetPathFromIDList(pidlCurrent, szFileName);
  310. SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)szFileName);
  311. }
  312. break;
  313. }
  314. return 0;
  315. }*/
  316. void Client2FormLYFZ::GetSavePath(CString &path)
  317. {
  318. char lpszDisplayName[MAX_PATH], szFileName[MAX_PATH];
  319. LPITEMIDLIST pidlDesktop, pidlCurrent;
  320. if (SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidlDesktop)
  321. == NOERROR)
  322. {
  323. BROWSEINFO bi;
  324. bi.hwndOwner = this->m_hWnd;
  325. bi.pidlRoot = pidlDesktop;
  326. bi.pszDisplayName = lpszDisplayName;
  327. bi.lpszTitle = "\n文档保存的目录:";
  328. bi.ulFlags = BIF_STATUSTEXT&BIF_RETURNONLYFSDIRS;
  329. bi.lpfn = BrowseProc;
  330. bi.lParam = 0;
  331. bi.iImage = 0;
  332. pidlCurrent = SHBrowseForFolder(&bi);
  333. SHGetPathFromIDList(pidlCurrent, szFileName);
  334. path = szFileName;
  335. }
  336. }
  337. int Client2FormLYFZ::FindArray(CStringArray *pArray, CString Str)
  338. {
  339. for (int i = 0; i < pArray->GetSize(); i++)
  340. {
  341. if (pArray->ElementAt(i) == Str)
  342. return i;
  343. }
  344. return -1;
  345. }
  346. //-----------------------------------------------------------------
  347. // remark by Jeff 2014-12-12
  348. // 函数:GetNo
  349. // 描述:从str中解析出每个相片名,然后存入空的CStringArray中;
  350. // 参数:
  351. // str:选好的相片名串,如:"001,002,003" 后分隔符改为"|",结果应是"001|002|003"
  352. // array:空的数组,用来存放解析后的相片名;
  353. // 返回:
  354. // 注意:更换分隔符造成的问题,在该函数已解决;
  355. //-----------------------------------------------------------------
  356. void Client2FormLYFZ::GetNo(CString str, CStringArray &array)
  357. {
  358. if (!str.IsEmpty())
  359. {
  360. #ifdef USE_SEP_VEB
  361. int pos = str.Find(SEPS_VEB);
  362. #else
  363. int pos = str.Find(",");
  364. #endif
  365. while (pos != -1)
  366. {
  367. if (FindArray(&array, str.Left(pos)) == -1)
  368. array.Add(str.Left(pos));
  369. str = str.Right(str.GetLength() - pos - 1);
  370. #ifdef USE_SEP_VEB
  371. pos = str.Find(SEPS_VEB);
  372. #else
  373. pos = str.Find(",");
  374. #endif
  375. }
  376. if (FindArray(&array, str) == -1)
  377. array.Add(str);
  378. }
  379. }
  380. //-----------------------------------------------------------------
  381. // remark by Jeff 2014-12-12
  382. // 函数:GetSelName
  383. // 描述:
  384. // 参数:
  385. // name:由GetNo解析出来后的单个相片名,如:"001"
  386. // spnamearray:订单下的商品数组,case 50所得;
  387. // 返回:
  388. // 注意:更换分隔符造成的问题,在该函数已解决;
  389. //-----------------------------------------------------------------
  390. CString Client2FormLYFZ::GetSelName(CString name, CArray<CStringArray, CStringArray>&spnamearray)
  391. {
  392. CString ret;
  393. #ifdef USE_SEP_VEB
  394. name = SEPS_VEB + name + SEPS_VEB;
  395. #else
  396. name = "," + name + ",";
  397. #endif
  398. CString str;
  399. for (int i = 0; i < spnamearray.GetSize(); i++)
  400. {
  401. #ifdef USE_SEP_VEB
  402. str = SEPS_VEB + spnamearray.ElementAt(i).ElementAt(6) + SEPS_VEB;
  403. #else
  404. str = "," + spnamearray.ElementAt(i).ElementAt(6) + ",";
  405. #endif
  406. if (str.Find(name) != -1)
  407. {
  408. ret += spnamearray.ElementAt(i).ElementAt(5);
  409. ret += ";";
  410. }
  411. }
  412. ret.TrimRight(";");
  413. ret.Replace("*", "x");
  414. return ret;
  415. }
  416. void Client2FormLYFZ::OnBUTshowphoto()
  417. {
  418. // TODO: Add your control notification handler code here
  419. POSITION pos;
  420. pos = m_List1.GetFirstSelectedItemPosition();
  421. if (pos == NULL)
  422. {
  423. AfxMessageBox("请先选中您要查看的定单!", MB_ICONINFORMATION);
  424. return;
  425. }
  426. int iItem = m_List1.GetNextSelectedItem(pos);
  427. CString status = m_List1.GetItemText(iItem, 4);
  428. CString id = m_List1.GetItemText(iItem, 0);
  429. if (status == "未设计")
  430. {
  431. AfxMessageBox("此单未导片!", MB_ICONINFORMATION);
  432. return;
  433. }
  434. /* ShowPic dlg;
  435. dlg.m_path=g_path3+"\\";
  436. dlg.m_path+=id;
  437. dlg.m_path +="\\";
  438. dlg.DoModal ();*/
  439. ChooseDesignSkin dlg;
  440. dlg.SetLiaPath("3.lia");
  441. dlg.m_strOrderNumber = id;
  442. dlg.m_path = g_path3 + "\\";
  443. dlg.m_path += id;
  444. dlg.m_path += "\\";
  445. dlg.DoModal();
  446. for (int i = 0; i < m_List1array.GetSize(); i++)
  447. {
  448. if (id == m_List1array.ElementAt(i).ElementAt(0))
  449. {
  450. m_List1array.ElementAt(i).SetAt(7, dlg.m_bz2);
  451. // FillGrid();
  452. break;
  453. }
  454. }
  455. }
  456. void Client2FormLYFZ::OnButton1()
  457. {
  458. // TODO: Add your control notification handler code here
  459. UpdateData();
  460. m_filter.TrimLeft();
  461. m_filter.TrimRight();
  462. FillGrid();
  463. }
  464. void Client2FormLYFZ::OnButton2()
  465. {
  466. // TODO: Add your control notification handler code here
  467. SearchFilter5 dlg;
  468. CStringArray Array2;
  469. CStringArray Array3;
  470. CStringArray Array4;
  471. for (int i = 0; i < m_List1array.GetSize(); i++)
  472. {
  473. if (-1 == ::FindArray(&Array2, m_List1array.ElementAt(i).ElementAt(1)))
  474. Array2.Add(m_List1array.ElementAt(i).ElementAt(1));
  475. if (-1 == ::FindArray(&Array3, m_List1array.ElementAt(i).ElementAt(8)))
  476. Array3.Add(m_List1array.ElementAt(i).ElementAt(8));
  477. if (-1 == ::FindArray(&Array4, m_List1array.ElementAt(i).ElementAt(9)))
  478. Array4.Add(m_List1array.ElementAt(i).ElementAt(9));
  479. }
  480. dlg.m_pArray2 = &Array2;
  481. dlg.m_pArray3 = &Array3;
  482. dlg.m_pArray4 = &Array4;
  483. if (dlg.DoModal() == IDOK)FillGrid();
  484. g_bSearchFilter = 0;
  485. }
  486. void Client2FormLYFZ::OnItemchangedList2(NMHDR* pNMHDR, LRESULT* pResult)
  487. {
  488. NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
  489. // TODO: Add your control notification handler code here
  490. *pResult = 0;
  491. }
  492. void Client2FormLYFZ::OnBUTClient2FormLYFZ()
  493. {
  494. // TODO: Add your control notification handler code here
  495. AddClientLYFZ dlg;
  496. dlg.m_pList2array = &m_List2array;
  497. if (dlg.DoModal() == IDOK)
  498. {
  499. GetData();
  500. }
  501. }
  502. void Client2FormLYFZ::OnDblclkList2(NMHDR* pNMHDR, LRESULT* pResult)
  503. {
  504. // TODO: Add your control notification handler code here
  505. POSITION pos;
  506. pos = m_List1.GetFirstSelectedItemPosition();
  507. if (pos == NULL)return;
  508. OnBUTburncd2();
  509. *pResult = 0;
  510. }
  511. void Client2FormLYFZ::OnBUTburncd2()
  512. {
  513. // TODO: Add your control notification handler code here
  514. POSITION pos;
  515. pos = m_List1.GetFirstSelectedItemPosition();
  516. if (pos == NULL)
  517. {
  518. AfxMessageBox("请先选中您要修改的客户!", MB_ICONINFORMATION);
  519. return;
  520. }
  521. int iItem = m_List1.GetNextSelectedItem(pos);
  522. AddClientLYFZ dlg;
  523. dlg.m_pList2array = &m_List2array;
  524. dlg.m_bAdd = 0;
  525. dlg.id = m_List1.GetItemText(iItem, 0);
  526. dlg.m_area = m_List1.GetItemText(iItem, 1);
  527. dlg.m_name1 = m_List1.GetItemText(iItem, 2);
  528. dlg.m_name2 = m_List1.GetItemText(iItem, 3);
  529. dlg.m_clerk = m_List1.GetItemText(iItem, 4);
  530. if (IsHasRights2new(49) == 0 && dlg.m_clerk != g_user.name && dlg.m_clerk != "")
  531. {
  532. AfxMessageBox("只能修改自己的客户!", MB_ICONINFORMATION);
  533. return;
  534. }
  535. dlg.m_phone1 = m_List1.GetItemText(iItem, 5);
  536. dlg.m_qq1 = m_List1.GetItemText(iItem, 6);
  537. dlg.m_addr1 = m_List1.GetItemText(iItem, 7);
  538. dlg.m_from = m_List1.GetItemText(iItem, 8);
  539. dlg.m_status = m_List1.GetItemText(iItem, 9);
  540. CString id = m_List1.GetItemText(iItem, 0);
  541. for (int ii = 0; ii < m_List1array.GetSize(); ii++)
  542. {
  543. if (m_List1array.ElementAt(ii).ElementAt(0) == id)
  544. {
  545. dlg.m_bz = m_List1.m_arLabels.ElementAt(ii).ElementAt(10);
  546. break;
  547. }
  548. }
  549. if (dlg.DoModal() == IDOK)
  550. {
  551. GetData();
  552. }
  553. }
  554. void Client2FormLYFZ::OnBUTburncd3()
  555. {
  556. // TODO: Add your control notification handler code here
  557. POSITION pos;
  558. pos = m_List1.GetFirstSelectedItemPosition();
  559. if (pos == NULL)
  560. {
  561. AfxMessageBox("请先选中您要删除的客户!", MB_ICONINFORMATION);
  562. return;
  563. }
  564. int iItem = m_List1.GetNextSelectedItem(pos);
  565. CString id = m_List1.GetItemText(iItem, 0);
  566. if (AfxMessageBox("确认删除吗?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  567. CString sql;
  568. sql.Format("delete from client2 where id=%d ", atoi(id));
  569. g_sendhead.bsql = 1;
  570. g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
  571. GetData();
  572. }
  573. void Client2FormLYFZ::OnBUTsendmsg()
  574. {
  575. // TODO: Add your control notification handler code here
  576. POSITION pos;
  577. pos = m_List1.GetFirstSelectedItemPosition();
  578. if (pos == NULL)
  579. {
  580. AfxMessageBox("请先选中您要发送短信的客人!", MB_ICONINFORMATION);
  581. return;
  582. }
  583. int iItem;
  584. CStringArray array;
  585. while (pos)
  586. {
  587. iItem = m_List1.GetNextSelectedItem(pos);
  588. if (!m_List1.GetItemText(iItem, 5).IsEmpty())
  589. array.Add(m_List1.GetItemText(iItem, 5));
  590. }
  591. SendMsgDlg dlg;
  592. dlg.m_mode = 2;
  593. dlg.m_pArray = &array;
  594. dlg.DoModal();
  595. }
  596. void Client2FormLYFZ::OnBUTprint3()
  597. {
  598. CStdioFile fp;
  599. /* if(::PathFileExists ("c:\\clientphone.txt"))
  600. {
  601. fp.Open ("c:\\clientphone.txt", CFile::modeWrite);
  602. fp.SeekToEnd ();
  603. }
  604. else*/
  605. fp.Open("c:\\clientphone.txt", CFile::modeCreate | CFile::modeWrite);
  606. CString str;
  607. CString str1, str2, str3, str4, str5, str6, str7;
  608. CString phone;
  609. CString txname, txprice, mensi;
  610. int leng1 = 30;
  611. int leng2 = 30;
  612. int leng3 = 15;
  613. int leng4 = 18;
  614. int leng5 = 15;
  615. int leng6 = 10;
  616. int leng7 = 10;
  617. str1 = "老总姓名";
  618. str2 = "影楼名称";
  619. str3 = "业务员";
  620. str4 = "电话";
  621. str5 = "QQ";
  622. str6 = "来源";
  623. str7 = "状态";
  624. FillLength(str1, leng1);
  625. FillLength(str2, leng2);
  626. FillLength(str3, leng3);
  627. FillLength(str4, leng4);
  628. FillLength(str5, leng5);
  629. FillLength(str6, leng6);
  630. FillLength(str7, leng7);
  631. str = str1 + str2 + str3 + str4 + str5 + str6 + str7 + "\n";
  632. fp.WriteString(str);
  633. for (int i = 0; i < m_List1.GetItemCount(); i++)
  634. {
  635. str1 = str2 = str3 = str4 = str5 = str6 = str7 = "";
  636. str1 = m_List1.GetItemText(i, 2);
  637. str2 = m_List1.GetItemText(i, 3);
  638. str3 = m_List1.GetItemText(i, 4);
  639. str4 = m_List1.GetItemText(i, 5);
  640. str5 = m_List1.GetItemText(i, 6);
  641. str6 = m_List1.GetItemText(i, 8);
  642. str7 = m_List1.GetItemText(i, 9);
  643. FillLength(str1, leng1);
  644. FillLength(str2, leng2);
  645. FillLength(str3, leng3);
  646. FillLength(str4, leng4);
  647. FillLength(str5, leng5);
  648. FillLength(str6, leng6);
  649. FillLength(str7, leng7);
  650. str = str1 + str2 + str3 + str4 + str5 + str6 + str7 + "\n";
  651. fp.WriteString(str);
  652. }
  653. fp.Close();
  654. MessageBox("电话已保存到c:\\clientphone.txt");
  655. ShellExecute(NULL, _T("open"), _T("c:\\clientphone.txt"), NULL, NULL, SW_SHOWMAXIMIZED);
  656. }
  657. void Client2FormLYFZ::GetData()
  658. {
  659. g_sendhead.bsql = 0;
  660. g_sendhead.code[0] = 90;
  661. g_sendhead.tabcount = 1;
  662. g_pMainWnd->ProcessChatMessageRequest2(1); if (g_bSendOK == 0)return;
  663. DataToArray(&m_List2array);
  664. int size = 0;
  665. int i = 0;
  666. for ( i = 0; i < m_List2array.GetSize(); i++)
  667. {
  668. if (m_List2array.ElementAt(i).ElementAt(4) != g_user.name && m_List2array.ElementAt(i).ElementAt(4) != "" && IsHasRights2new(49) == 0)continue;
  669. m_List1array.SetSize(size + 1, 1);
  670. m_List1array.ElementAt(size).Copy(m_List2array.ElementAt(i));
  671. size++;
  672. }
  673. m_List1arrayBak.SetSize(m_List1array.GetSize());
  674. for (i = 0; i < m_List1array.GetSize(); i++)
  675. {
  676. m_List1arrayBak.ElementAt(i).Copy(m_List1array.ElementAt(i));
  677. if (m_List1array.ElementAt(i).ElementAt(10).GetLength()>256)
  678. m_List1array.ElementAt(i).SetAt(10, m_List1array.ElementAt(i).ElementAt(10).Left(256) + "..");
  679. }
  680. FillGrid();
  681. }