DinDanFromBranch.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728
  1. // DinDanFromBranch.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "DinDanFromBranch.h"
  6. #include "MyMdi.h"
  7. #include "ModifyDinDan.h"
  8. #include "ClientDlg.h"
  9. #include "ClientDlg2.h"
  10. #include "./helper/ffsco.h"
  11. #include "SelBranch.h"
  12. #ifdef _DEBUG
  13. #define new DEBUG_NEW
  14. #undef THIS_FILE
  15. static char THIS_FILE[] = __FILE__;
  16. #endif
  17. #pragma comment(lib, "Shlwapi.lib")
  18. /////////////////////////////////////////////////////////////////////////////
  19. // DinDanFromBranch
  20. IMPLEMENT_DYNCREATE(DinDanFromBranch, MyFormView)
  21. DinDanFromBranch::DinDanFromBranch()
  22. : MyFormView(DinDanFromBranch::IDD)
  23. {
  24. //{{AFX_DATA_INIT(DinDanFromBranch)
  25. m_filter = _T("");
  26. //}}AFX_DATA_INIT
  27. }
  28. DinDanFromBranch::~DinDanFromBranch()
  29. {
  30. }
  31. void DinDanFromBranch::DoDataExchange(CDataExchange* pDX)
  32. {
  33. MyFormView::DoDataExchange(pDX);
  34. //{{AFX_DATA_MAP(DinDanFromBranch)
  35. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  36. DDX_Control(pDX, IDC_LIST2, m_List1);
  37. DDX_Control(pDX, IDC_STATIC1, m_static1);
  38. DDX_CBString(pDX, IDC_COMBO1, m_filter);
  39. //}}AFX_DATA_MAP
  40. }
  41. BEGIN_MESSAGE_MAP(DinDanFromBranch, MyFormView)
  42. //{{AFX_MSG_MAP(DinDanFromBranch)
  43. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  44. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  45. ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
  46. ON_WM_TIMER()
  47. ON_BN_CLICKED(IDC_BUTprint3, OnBUTprint3)
  48. ON_BN_CLICKED(IDC_BUTprint4, OnBUTprint4)
  49. ON_BN_CLICKED(IDC_BTNSEARCHFILTER, OnBtnsearchfilter)
  50. ON_NOTIFY(NM_CUSTOMDRAW, IDC_LIST2, OnCustomdrawList1)
  51. //}}AFX_MSG_MAP
  52. END_MESSAGE_MAP()
  53. /////////////////////////////////////////////////////////////////////////////
  54. // DinDanFromBranch diagnostics
  55. #ifdef _DEBUG
  56. void DinDanFromBranch::AssertValid() const
  57. {
  58. MyFormView::AssertValid();
  59. }
  60. void DinDanFromBranch::Dump(CDumpContext& dc) const
  61. {
  62. MyFormView::Dump(dc);
  63. }
  64. #endif //_DEBUG
  65. /////////////////////////////////////////////////////////////////////////////
  66. // DinDanFromBranch message handlers FillLength
  67. extern void SetComboHei(CComboBox *pCombo, int hei);
  68. void DinDanFromBranch::OnInitialUpdate()
  69. {
  70. MyFormView::OnInitialUpdate();
  71. // TODO: Add your specialized code here and/or call the base class
  72. CMyMdi Mdi;
  73. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  74. // Here we create the outbar control using the splitter as its parent
  75. // and setting its id to the first pane.
  76. CRect rc2;
  77. GetWindowRect(rc2);
  78. ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
  79. EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
  80. int idarray[]={IDC_BUTprint4,IDC_BUTprint3,IDC_BUTclose};
  81. int idcount=3;
  82. int btnwid;
  83. CRect prerc;
  84. for(int a=idcount-2; a>=0; a--)
  85. {
  86. GetDlgItem(idarray[a+1])->GetWindowRect (prerc);
  87. ScreenToClient(prerc);
  88. GetDlgItem(idarray[a])->GetWindowRect (rc2);
  89. ScreenToClient(rc2);
  90. btnwid=rc2.Width ();
  91. rc2.right =prerc.left ;
  92. rc2.left =rc2.right -btnwid;
  93. GetDlgItem(idarray[a])->MoveWindow (rc2);
  94. }
  95. m_static1.SetFont (&g_titlefont);
  96. #ifdef CHILD_VERSION
  97. m_List1.SetHeadings("店名,100;订单号,100;家长姓名,100;宝宝姓名,100;类别,100;折扣,100;授权,100;折扣(后),100;授权(后),100;拍照,100;初修,100;选片,100;精修,100;设计,100;看设计,100;取件,100;预约时间,100;拍照时间,100;选片时间,100;看设计时间,100;取件时间,100;接单人,100;套系名称,100;套系价格,100;摄影师,100;化妆师,100;初修,100;选片,100;精修,100;设计师,100;看设计,100;录单,100;手机,100;固定电话,100" );
  98. #else
  99. m_List1.SetHeadings("店名,100;订单号,100;男宾姓名,100;女宾姓名,100;类别,100;折扣,100;授权,100;折扣(后),100;授权(后),100;拍照,100;初修,100;选片,100;精修,100;设计,100;看设计,100;取件,100;预约时间,100;拍照时间,100;选片时间,100;看设计时间,100;取件时间,100;接单人,100;套系名称,100;套系价格,100;摄影师,100;化妆师,100;初修,100;选片,100;精修,100;设计师,100;看设计,100;录单,100;男宾电话,100;女宾电话,100" );
  100. #endif
  101. m_List1.LoadColumnInfo (182);
  102. CStringArray m_iparray;
  103. for(int i=0; i<g_brancharray.GetSize (); i++)
  104. {
  105. if(m_iparray.GetSize ())
  106. {
  107. if(g_brancharray.ElementAt (i).ElementAt (2)==m_iparray.ElementAt (m_iparray.GetSize ()-1))continue;
  108. }
  109. m_combo1.AddString (g_brancharray.ElementAt (i).ElementAt (0)); m_iparray.Add (g_brancharray.ElementAt (i).ElementAt (2));
  110. }
  111. GetData();
  112. m_combo1.GetWindowRect (rc2);
  113. ScreenToClient(rc2);
  114. rc2.bottom +=200;
  115. m_combo1.MoveWindow (rc2);
  116. GetDlgItem(IDC_BUTclose)->GetWindowRect(rc2);
  117. SetComboHei(&m_combo1, rc2.Height ());
  118. GetDlgItem(IDC_BUTprint3)->EnableWindow(IsHasRights2new(49));
  119. GetDlgItem(IDC_BUTprint4)->EnableWindow(IsHasRights2new(1));
  120. }
  121. void DinDanFromBranch::FillGrid()
  122. {
  123. int m_nadd=2;
  124. if(g_bSearchFilter)
  125. {
  126. m_List1.DeleteAllItems2 ();
  127. int ii=0;
  128. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  129. int count=0;
  130. {
  131. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  132. {
  133. if(g_filterdate1!="")
  134. {
  135. if(m_List1array.ElementAt (ii).ElementAt (14+m_nadd)<g_filterdate1 || m_List1array.ElementAt (ii).ElementAt (14+m_nadd)>g_filterdate2)
  136. continue;
  137. }
  138. if(g_waiter1!="")
  139. {
  140. if(m_List1array.ElementAt (ii).ElementAt (19+m_nadd)!=g_waiter1)
  141. continue;
  142. }
  143. if(g_waiter2!="")
  144. {
  145. if(m_List1array.ElementAt (ii).ElementAt (22+m_nadd)!=g_waiter2)
  146. continue;
  147. }
  148. if(g_waiter3!="")
  149. {
  150. if(m_List1array.ElementAt (ii).ElementAt (23+m_nadd)!=g_waiter3)
  151. continue;
  152. }
  153. if(1)
  154. {
  155. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  156. }
  157. }
  158. }
  159. m_List1.m_arLabels.SetSize(count, 1);
  160. ii=count;
  161. m_List1.m_LabelCount=ii;
  162. m_List1.SetItemCountEx (ii);
  163. CString str;
  164. str.Format ("单数:%d", ii);
  165. SetDlgItemText(IDC_STATIC2, str);
  166. }
  167. else
  168. {
  169. m_List1.DeleteAllItems2 ();
  170. int ii=0;
  171. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  172. int count=0;
  173. if(m_filter.IsEmpty ())
  174. {
  175. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  176. {
  177. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  178. }
  179. }
  180. else
  181. {
  182. int type=GetType(m_filter);
  183. if(type==1)//电话
  184. {
  185. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  186. {
  187. if(m_List1array.ElementAt (ii).ElementAt (30+m_nadd).Find (m_filter)!=-1 || \
  188. m_List1array.ElementAt (ii).ElementAt (31+m_nadd).Find (m_filter)!=-1)
  189. {
  190. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  191. }
  192. }
  193. }
  194. else if(type==2)//拼音
  195. {
  196. m_filter.MakeUpper ();
  197. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  198. {
  199. if(m_List1array.ElementAt (ii).ElementAt (32+m_nadd).Find (m_filter)!=-1 || \
  200. m_List1array.ElementAt (ii).ElementAt (33+m_nadd).Find (m_filter)!=-1)
  201. {
  202. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  203. }
  204. }
  205. }
  206. else
  207. {
  208. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  209. {
  210. if(m_List1array.ElementAt (ii).ElementAt (0).Find (m_filter)!=-1 || \
  211. m_List1array.ElementAt (ii).ElementAt (1).Find (m_filter)!=-1 || \
  212. m_List1array.ElementAt (ii).ElementAt (2).Find (m_filter)!=-1 || \
  213. m_List1array.ElementAt (ii).ElementAt (3).Find (m_filter)!=-1 || \
  214. m_List1array.ElementAt (ii).ElementAt (4).Find (m_filter)!=-1 || \
  215. m_List1array.ElementAt (ii).ElementAt (19+m_nadd).Find (m_filter)!=-1 || \
  216. m_List1array.ElementAt (ii).ElementAt (20+m_nadd).Find (m_filter)!=-1 || \
  217. m_List1array.ElementAt (ii).ElementAt (22+m_nadd).Find (m_filter)!=-1 || \
  218. m_List1array.ElementAt (ii).ElementAt (23+m_nadd).Find (m_filter)!=-1 || \
  219. m_List1array.ElementAt (ii).ElementAt (33+m_nadd).Find (m_filter)!=-1 || \
  220. m_List1array.ElementAt (ii).ElementAt (30+m_nadd).Find (m_filter)!=-1 ||\
  221. m_List1array.ElementAt (ii).ElementAt (31+m_nadd).Find (m_filter)!=-1 || \
  222. m_List1array.ElementAt (ii).ElementAt (32+m_nadd).Find (m_filter)!=-1)
  223. {
  224. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  225. }
  226. }
  227. }
  228. }
  229. m_List1.m_arLabels.SetSize(count, 1);
  230. ii=count;
  231. m_List1.m_LabelCount=ii;
  232. m_List1.SetItemCountEx (ii);
  233. CString str;
  234. str.Format ("单数:%d", ii);
  235. SetDlgItemText(IDC_STATIC2, str);
  236. }
  237. if(!g_id.IsEmpty ())
  238. {
  239. for(int i=0; i<m_List1.GetItemCount (); i++)
  240. {
  241. if(g_id==m_List1.GetItemText (i, 1 ))
  242. {
  243. m_List1.SetItemState(i,LVIS_SELECTED|LVIS_FOCUSED,LVIS_SELECTED|LVIS_FOCUSED);
  244. m_List1.EnsureVisible(i,FALSE);
  245. break;
  246. }
  247. }
  248. }
  249. }
  250. void DinDanFromBranch::OnBUTclose()
  251. {
  252. // TODO: Add your control notification handler code here
  253. GetParent()->SendMessage(WM_CLOSE);
  254. }
  255. void DinDanFromBranch::OnButton1()
  256. {
  257. // TODO: Add your control notification handler code here
  258. UpdateData();
  259. m_filter.TrimLeft ();
  260. m_filter.TrimRight ();
  261. FillGrid();
  262. }
  263. void DinDanFromBranch::OnSelchangeCombo1()
  264. {
  265. // TODO: Add your control notification handler code here
  266. SetTimer(1, 100, NULL);
  267. }
  268. void DinDanFromBranch::OnTimer(UINT nIDEvent)
  269. {
  270. // TODO: Add your message handler code here and/or call default
  271. KillTimer(nIDEvent);
  272. OnButton1();
  273. }
  274. BOOL DinDanFromBranch::PreTranslateMessage(MSG* pMsg)
  275. {
  276. // TODO: Add your c code here and/or call the base class
  277. try
  278. {
  279. if(pMsg->message==WM_KEYDOWN)
  280. {
  281. switch (pMsg->wParam)
  282. {
  283. case VK_RETURN:
  284. OnButton1();
  285. return 1;
  286. case VK_F9:
  287. GetClientPhone();
  288. return 1;
  289. case 0x43: // copy
  290. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  291. {
  292. GetFocus()->SendMessage(WM_COPY);
  293. return TRUE;
  294. }
  295. break;
  296. case 0x56: //Ctrl + V:
  297. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  298. {
  299. GetFocus()->SendMessage(WM_PASTE);
  300. return TRUE;
  301. }
  302. break;
  303. case 0x58: // cut
  304. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  305. {
  306. GetFocus()->SendMessage(WM_CUT);
  307. return TRUE;
  308. }
  309. break;
  310. case 0x5A: //undo
  311. case 0x59: //redo
  312. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  313. {
  314. GetFocus()->SendMessage(WM_UNDO);
  315. return TRUE;
  316. }
  317. break;
  318. }
  319. }
  320. return MyFormView::PreTranslateMessage(pMsg);
  321. }
  322. catch(...)
  323. {
  324. }
  325. return true;
  326. }
  327. void DinDanFromBranch::GetClientPhone()
  328. {
  329. CStdioFile fp;
  330. fp.Open ("c:\\clientphone.txt", CFile::modeCreate|CFile::modeWrite);
  331. CString str;
  332. CString branch,name,m_name1,m_name2;
  333. CString phone,m_phone1,m_phone2;
  334. CString txname,txprice,mensi;
  335. int leng1=26;
  336. int leng2=15;
  337. int leng3=30;
  338. int leng4=25;
  339. int leng5=15;
  340. int leng6=15;
  341. branch="店名";
  342. name="姓名";
  343. mensi="门市";
  344. phone="电话";
  345. txname="套系";
  346. txprice="价格";
  347. FillLength(name, leng1);
  348. FillLength(mensi, leng2);
  349. FillLength(phone, leng3);
  350. FillLength(txname, leng4);
  351. FillLength(txprice,leng5);
  352. FillLength(branch,leng6);
  353. str=name+mensi+phone+txname+txprice+branch+"\n";
  354. fp.WriteString (str);
  355. for(int i=0; i<m_List1.GetItemCount (); i++)
  356. {
  357. name.Empty ();
  358. phone.Empty ();
  359. m_name1=m_List1.GetItemText (i, 2);
  360. m_name2=m_List1.GetItemText (i, 3);
  361. m_phone1=m_List1.GetItemText (i, 10);
  362. m_phone2=m_List1.GetItemText (i, 11);
  363. mensi=m_List1.GetItemText (i, 7);
  364. txname=m_List1.GetItemText (i, 8);
  365. txprice=m_List1.GetItemText (i, 9);
  366. branch=m_List1.GetItemText (i, 0);
  367. if(!m_name1.IsEmpty ())
  368. name=m_name1+",";
  369. name+=m_name2;
  370. name.TrimRight (",");
  371. if(!m_phone1.IsEmpty ())
  372. phone=m_phone1+",";
  373. phone+=m_phone2;phone.TrimRight (",");
  374. FillLength(name, leng1);
  375. FillLength(mensi, leng2);
  376. FillLength(phone, leng3);
  377. FillLength(txname, leng4);
  378. FillLength(txprice,leng5);
  379. FillLength(branch,leng6);
  380. str=name+mensi+phone+txname+txprice+branch+"\n";
  381. fp.WriteString (str);
  382. }
  383. fp.Close ();
  384. MessageBox("电话已保存到c:\\clientphone.txt");
  385. ShellExecute(NULL, _T("open"), _T("c:\\clientphone.txt"), NULL, NULL, SW_SHOWMAXIMIZED);
  386. }
  387. void DinDanFromBranch::OnBUTprint3()
  388. {
  389. // TODO: Add your control notification handler code here
  390. GetData();
  391. // GetClientPhone();
  392. }
  393. void DinDanFromBranch::OnBUTprint4()
  394. {
  395. // TODO: Add your control notification handler code here
  396. POSITION pos;
  397. pos=m_List1.GetFirstSelectedItemPosition();
  398. if(pos==NULL)
  399. {
  400. return;
  401. }
  402. int iItem=m_List1.GetNextSelectedItem(pos);
  403. CString id = m_List1.GetItemText (iItem, 1);
  404. CString branch = m_List1.GetItemText (iItem, 0);
  405. CString name1=m_List1.GetItemText (iItem, 2);
  406. CString name2=m_List1.GetItemText (iItem, 3);
  407. CString name;
  408. if(!name1.IsEmpty ())
  409. name=name1+",";
  410. name+=name2;
  411. name.TrimRight (",");
  412. CStringArray array;
  413. CString str,sql;
  414. int count=m_combo1.GetCount();
  415. int i = 0;
  416. for( i=0; i<count; i++)
  417. {
  418. m_combo1.GetLBText (i, str);
  419. if(str==branch)continue;
  420. array.Add (str);
  421. }
  422. SelBranch dlg;
  423. dlg.m_pArray=&array;
  424. if(dlg.DoModal()!=IDOK)return;
  425. str.Format ("是否将 %s 客人 %s 转至 %s 拍照?", branch, name, dlg.m_sel);
  426. if(AfxMessageBox(str, MB_YESNO)!=IDYES)return;
  427. CString fromip,toip;
  428. for(i=0; i<g_brancharray.GetSize (); i++)
  429. {
  430. if(branch==g_brancharray.ElementAt (i).ElementAt (0))
  431. {
  432. fromip=g_brancharray.ElementAt (i).ElementAt (1);
  433. if(i==g_brancharray.GetSize ()-1)fromip="xxx";
  434. break;
  435. }
  436. }
  437. if(fromip!="xxx")
  438. {
  439. g_bBranchModify=1;g_branchip=fromip;g_branchname=branch;
  440. g_pMainWnd->OnDisconnect();
  441. }
  442. CArray<CStringArray, CStringArray>List1array;
  443. g_sendhead.bsql=0;
  444. g_sendhead.code[0]=156;
  445. g_sendhead.tabcount=1;
  446. g_pMainWnd->ProcessChatMessageRequest2(id);
  447. if(g_bSendOK==0)
  448. {
  449. AfxMessageBox("转单失败!");g_bBranchModify=0;g_branchip=g_branchname="";
  450. return;
  451. }
  452. DataToArray(&List1array);
  453. if(List1array.GetSize ())
  454. {
  455. for( i=0; i<List1array.ElementAt (0).GetSize (); i++)
  456. {
  457. sql+=List1array.ElementAt (0).ElementAt (i);sql+="***";
  458. }
  459. sql.TrimRight ("***");
  460. if(sql.IsEmpty ())
  461. {
  462. AfxMessageBox("转单失败!此单不存在,可能被删除!");g_bBranchModify=0;g_branchip=g_branchname="";
  463. return;
  464. }
  465. toip="";
  466. for(i=0; i<g_brancharray.GetSize (); i++)
  467. {
  468. if(dlg.m_sel==g_brancharray.ElementAt (i).ElementAt (0))
  469. {
  470. toip=g_brancharray.ElementAt (i).ElementAt (1);
  471. if(i==g_brancharray.GetSize ()-1)toip="xxx";
  472. break;
  473. }
  474. }
  475. g_pMainWnd->OnDisconnect();
  476. g_bBranchModify=0;g_branchip=g_branchname="";
  477. if(toip!="xxx")
  478. {
  479. g_bBranchModify=1;g_branchip=toip;g_branchname=dlg.m_sel;
  480. }
  481. CStringArray m_seldressarray;
  482. m_seldressarray.Add (id);
  483. for( i=0; i<List1array.ElementAt (0).GetSize (); i++)
  484. {
  485. // MessageBox(List1array.ElementAt (0).ElementAt (i));
  486. m_seldressarray.Add (List1array.ElementAt (0).ElementAt (i));
  487. }
  488. CMemFile memfile;
  489. CArchive ar(&memfile, CArchive::store);
  490. m_seldressarray.Serialize (ar);
  491. ar.Close();
  492. int length=memfile.GetLength ();
  493. BYTE *pData = memfile.Detach();
  494. g_nSendCode=25;
  495. g_sendhead.bsql=0;
  496. g_pMainWnd->ProcessChatMessageRequest2(pData, length);
  497. g_nSendCode=0;
  498. delete []pData;
  499. if(g_bSendOK==0 || g_ncount!=888 )
  500. {
  501. g_bBranchModify=0;g_branchip=g_branchname="";
  502. AfxMessageBox("转单失败!");
  503. g_pMainWnd->OnDisconnect();
  504. return;
  505. }
  506. g_pMainWnd->OnDisconnect();g_bBranchModify=0;g_branchip=g_branchname="";
  507. if(fromip!="xxx")
  508. {
  509. g_bBranchModify=1;g_branchip=fromip;g_branchname=branch;
  510. g_pMainWnd->OnDisconnect();
  511. }
  512. g_sendhead.bsql=1;
  513. sql= "delete from dindan where id='"+id+"'";
  514. sql+= "***delete from dindansp where id='"+id+"'";
  515. sql+= "***delete from photoprint where id='"+id+"'";
  516. sql+= "***delete from dindanbukuan where id='"+id+"'";
  517. sql+= "***delete from dindanbukuan2 where id='"+id+"'";
  518. sql+= "***delete from client where [id]='"+id+"'";
  519. sql+= "***delete from burncdreg where [id]='"+id+"'";
  520. sql+= "***delete from digitalwork where [id]='"+id+"'";
  521. sql+= "***delete from mywork where [id]='"+id+"'";
  522. sql+= "***delete from dindanjd where [id]='"+id+"'";
  523. g_pMainWnd->ProcessChatMessageRequest2(sql);
  524. if(g_bSendOK==0)
  525. {
  526. g_bBranchModify=0;g_branchip=g_branchname="";
  527. AfxMessageBox("转单成功,删除原订单失败,请手工删除!");
  528. g_pMainWnd->OnDisconnect();
  529. return;
  530. }
  531. g_pMainWnd->OnDisconnect();g_bBranchModify=0;g_branchip=g_branchname="";
  532. AfxMessageBox("转单成功!", MB_ICONINFORMATION);
  533. }
  534. }
  535. void DinDanFromBranch::OnCustomdrawList1 ( NMHDR* pNMHDR, LRESULT* pResult )
  536. {
  537. NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNMHDR );
  538. // Take the default processing unless we set this to something else below.
  539. *pResult = 0;
  540. // First thing - check the draw stage. If it's the control's prepaint
  541. // stage, then tell Windows we want messages for every item.
  542. if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
  543. {
  544. *pResult = CDRF_NOTIFYITEMDRAW;
  545. }
  546. else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
  547. {
  548. // This is the prepaint stage for an item. Here's where we set the
  549. // item's text color. Our return value will tell Windows to draw the
  550. // item itself, but it will use the new color we set here.
  551. // We'll cycle the colors through red, green, and light blue.
  552. if(atof(m_List1.m_arLabels.ElementAt (pLVCD->nmcd.dwItemSpec).ElementAt (5))<5.0 || (atof(m_List1.m_arLabels.ElementAt (pLVCD->nmcd.dwItemSpec).ElementAt (7))<5.0)&&m_List1.m_arLabels.ElementAt (pLVCD->nmcd.dwItemSpec).ElementAt (7)!="" )
  553. {
  554. pLVCD->clrText = RGB(220,0,0);
  555. }
  556. else if(atof(m_List1.m_arLabels.ElementAt (pLVCD->nmcd.dwItemSpec).ElementAt (5))<8.0 || (atof(m_List1.m_arLabels.ElementAt (pLVCD->nmcd.dwItemSpec).ElementAt (7))<8.0)&&m_List1.m_arLabels.ElementAt (pLVCD->nmcd.dwItemSpec).ElementAt (7)!="" )
  557. {
  558. pLVCD->clrText = RGB(255,255,0);
  559. }
  560. else if(atof(m_List1.m_arLabels.ElementAt (pLVCD->nmcd.dwItemSpec).ElementAt (5))==0 && atof(m_List1.m_arLabels.ElementAt (pLVCD->nmcd.dwItemSpec).ElementAt (7))==0)
  561. {
  562. pLVCD->clrText = RGB(0,0,0);
  563. }
  564. else
  565. {
  566. pLVCD->clrText = RGB(20,133,20);
  567. }
  568. if(pLVCD->nmcd.dwItemSpec%2)
  569. pLVCD->clrTextBk = g_gridcol1;
  570. else
  571. pLVCD->clrTextBk = g_gridcol2;
  572. // Store the color back in the NMLVCUSTOMDRAW struct.
  573. // Tell Windows to paint the control itself.
  574. *pResult = CDRF_DODEFAULT;
  575. }
  576. }
  577. void DinDanFromBranch::HidePrice()
  578. {
  579. if(IsHasRights2new(31)==0)
  580. {
  581. for(int i=0; i< m_List1array.GetSize (); i++)
  582. {
  583. m_List1array.ElementAt (i).SetAt (32, "***");
  584. m_List1array.ElementAt (i).SetAt (33, "***");
  585. }
  586. }
  587. if(IsHasRights2new(50)==0)
  588. {
  589. for(int i=0; i< m_List1array.GetSize (); i++)
  590. {
  591. m_List1array.ElementAt (i).SetAt (8, "***");
  592. m_List1array.ElementAt (i).SetAt (5, "***");
  593. m_List1array.ElementAt (i).SetAt (6, "***");
  594. m_List1array.ElementAt (i).SetAt (7, "***");
  595. }
  596. }
  597. }
  598. void DinDanFromBranch::OnBtnsearchfilter()
  599. {
  600. // TODO: Add your control notification handler code here
  601. SearchFilter dlg;
  602. dlg.m_mode =0;
  603. if(dlg.DoModal ()==IDOK)FillGrid();
  604. g_bSearchFilter=0;
  605. }
  606. void DinDanFromBranch::GetData()
  607. {
  608. m_List1array.RemoveAll ();
  609. CStringArray failbrancharray;
  610. CString branch;
  611. int i = 0;
  612. for( i=-1; i<g_brancharray.GetSize ()-1; i++)
  613. {
  614. if(i!=-1)
  615. {
  616. branch=g_brancharray.ElementAt (i).ElementAt (0);
  617. g_branchip=g_brancharray.ElementAt (i).ElementAt (1);
  618. g_pMainWnd->OnDisconnect();
  619. g_branchname=branch;
  620. g_bBranchModify=1;
  621. }
  622. else
  623. branch=g_brancharray.ElementAt (g_brancharray.GetSize ()-1).ElementAt (0);
  624. if(g_bShowOK==0)
  625. {
  626. CString filter="status3='未取'";
  627. g_sendhead.bsql=0;
  628. g_sendhead.code[0]=181;
  629. g_sendhead.tabcount=1;
  630. g_pMainWnd->ProcessChatMessageRequest2(filter);
  631. if(g_bSendOK==0)
  632. {
  633. failbrancharray.Add (branch);
  634. continue;
  635. }
  636. }
  637. else
  638. {
  639. g_sendhead.bsql=0;
  640. g_sendhead.code[0]=181;
  641. g_sendhead.tabcount=1;
  642. g_pMainWnd->ProcessChatMessageRequest2(21);
  643. if(g_bSendOK==0)
  644. {
  645. failbrancharray.Add (branch);
  646. continue;
  647. }
  648. }
  649. CArray<CStringArray, CStringArray>List1array;
  650. DataToArray(&List1array);
  651. int size=m_List1array.GetSize ();
  652. for(int j=0; j<List1array.GetSize (); j++)
  653. {
  654. size++;
  655. m_List1array.SetSize(size , 1 );
  656. size--;
  657. m_List1array.ElementAt (size).Copy (List1array.ElementAt (j));
  658. m_List1array.ElementAt (size).InsertAt (0, branch);
  659. size++;
  660. }
  661. }
  662. for(i=0; i<failbrancharray.GetSize (); i++)
  663. {
  664. //AfxMessageBox("连接"+failbrancharray.ElementAt(i)+"服务器失败!", MB_ICONINFORMATION);
  665. }
  666. HidePrice();
  667. FillGrid();
  668. g_pMainWnd->OnDisconnect();g_bBranchModify=0;g_branchip=g_branchname="";
  669. }