DinDanFromBranch.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729
  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 "InputPsw.h"
  9. #include "ClientDlg.h"
  10. #include "ClientDlg2.h"
  11. #include "TakeMoney2.h"
  12. #include "./helper/ffsco.h"
  13. #include "SelBranch.h"
  14. #ifdef _DEBUG
  15. #define new DEBUG_NEW
  16. #undef THIS_FILE
  17. static char THIS_FILE[] = __FILE__;
  18. #endif
  19. #pragma comment(lib, "Shlwapi.lib")
  20. /////////////////////////////////////////////////////////////////////////////
  21. // DinDanFromBranch
  22. IMPLEMENT_DYNCREATE(DinDanFromBranch, MyFormView)
  23. DinDanFromBranch::DinDanFromBranch()
  24. : MyFormView(DinDanFromBranch::IDD)
  25. {
  26. //{{AFX_DATA_INIT(DinDanFromBranch)
  27. m_filter = _T("");
  28. //}}AFX_DATA_INIT
  29. }
  30. DinDanFromBranch::~DinDanFromBranch()
  31. {
  32. }
  33. void DinDanFromBranch::DoDataExchange(CDataExchange* pDX)
  34. {
  35. MyFormView::DoDataExchange(pDX);
  36. //{{AFX_DATA_MAP(DinDanFromBranch)
  37. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  38. DDX_Control(pDX, IDC_LIST2, m_List1);
  39. DDX_Control(pDX, IDC_STATIC1, m_static1);
  40. DDX_CBString(pDX, IDC_COMBO1, m_filter);
  41. //}}AFX_DATA_MAP
  42. }
  43. BEGIN_MESSAGE_MAP(DinDanFromBranch, MyFormView)
  44. //{{AFX_MSG_MAP(DinDanFromBranch)
  45. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  46. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  47. ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
  48. ON_WM_TIMER()
  49. ON_BN_CLICKED(IDC_BUTprint3, OnBUTprint3)
  50. ON_BN_CLICKED(IDC_BUTprint4, OnBUTprint4)
  51. ON_BN_CLICKED(IDC_BTNSEARCHFILTER, OnBtnsearchfilter)
  52. ON_NOTIFY(NM_CUSTOMDRAW, IDC_LIST2, OnCustomdrawList1)
  53. //}}AFX_MSG_MAP
  54. END_MESSAGE_MAP()
  55. /////////////////////////////////////////////////////////////////////////////
  56. // DinDanFromBranch diagnostics
  57. #ifdef _DEBUG
  58. void DinDanFromBranch::AssertValid() const
  59. {
  60. MyFormView::AssertValid();
  61. }
  62. void DinDanFromBranch::Dump(CDumpContext& dc) const
  63. {
  64. MyFormView::Dump(dc);
  65. }
  66. #endif //_DEBUG
  67. /////////////////////////////////////////////////////////////////////////////
  68. // DinDanFromBranch message handlers FillLength
  69. extern void SetComboHei(CComboBox *pCombo, int hei);
  70. void DinDanFromBranch::OnInitialUpdate()
  71. {
  72. MyFormView::OnInitialUpdate();
  73. // TODO: Add your specialized code here and/or call the base class
  74. CMyMdi Mdi;
  75. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  76. // Here we create the outbar control using the splitter as its parent
  77. // and setting its id to the first pane.
  78. CRect rc2;
  79. GetWindowRect(rc2);
  80. ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
  81. EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
  82. int idarray[]={IDC_BUTprint4,IDC_BUTprint3,IDC_BUTclose};
  83. int idcount=3;
  84. int btnwid;
  85. CRect prerc;
  86. for(int a=idcount-2; a>=0; a--)
  87. {
  88. GetDlgItem(idarray[a+1])->GetWindowRect (prerc);
  89. ScreenToClient(prerc);
  90. GetDlgItem(idarray[a])->GetWindowRect (rc2);
  91. ScreenToClient(rc2);
  92. btnwid=rc2.Width ();
  93. rc2.right =prerc.left ;
  94. rc2.left =rc2.right -btnwid;
  95. GetDlgItem(idarray[a])->MoveWindow (rc2);
  96. }
  97. m_static1.SetFont (&g_titlefont);
  98. #ifdef CHILD_VERSION
  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. #else
  101. 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" );
  102. #endif
  103. m_List1.LoadColumnInfo (182);
  104. CStringArray m_iparray;
  105. for(int i=0; i<g_brancharray.GetSize (); i++)
  106. {
  107. if(m_iparray.GetSize ())
  108. {
  109. if(g_brancharray.ElementAt (i).ElementAt (2)==m_iparray.ElementAt (m_iparray.GetSize ()-1))continue;
  110. }
  111. m_combo1.AddString (g_brancharray.ElementAt (i).ElementAt (0)); m_iparray.Add (g_brancharray.ElementAt (i).ElementAt (2));
  112. }
  113. GetData();
  114. m_combo1.GetWindowRect (rc2);
  115. ScreenToClient(rc2);
  116. rc2.bottom +=200;
  117. m_combo1.MoveWindow (rc2);
  118. GetDlgItem(IDC_BUTclose)->GetWindowRect(rc2);
  119. SetComboHei(&m_combo1, rc2.Height ());
  120. GetDlgItem(IDC_BUTprint3)->EnableWindow(IsHasRights2new(49));
  121. GetDlgItem(IDC_BUTprint4)->EnableWindow(IsHasRights2new(1));
  122. }
  123. void DinDanFromBranch::FillGrid()
  124. {
  125. int m_nadd=2;
  126. if(g_bSearchFilter)
  127. {
  128. m_List1.DeleteAllItems2 ();
  129. int ii=0;
  130. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  131. int count=0;
  132. {
  133. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  134. {
  135. if(g_filterdate1!="")
  136. {
  137. if(m_List1array.ElementAt (ii).ElementAt (14+m_nadd)<g_filterdate1 || m_List1array.ElementAt (ii).ElementAt (14+m_nadd)>g_filterdate2)
  138. continue;
  139. }
  140. if(g_waiter1!="")
  141. {
  142. if(m_List1array.ElementAt (ii).ElementAt (19+m_nadd)!=g_waiter1)
  143. continue;
  144. }
  145. if(g_waiter2!="")
  146. {
  147. if(m_List1array.ElementAt (ii).ElementAt (22+m_nadd)!=g_waiter2)
  148. continue;
  149. }
  150. if(g_waiter3!="")
  151. {
  152. if(m_List1array.ElementAt (ii).ElementAt (23+m_nadd)!=g_waiter3)
  153. continue;
  154. }
  155. if(1)
  156. {
  157. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  158. }
  159. }
  160. }
  161. m_List1.m_arLabels.SetSize(count, 1);
  162. ii=count;
  163. m_List1.m_LabelCount=ii;
  164. m_List1.SetItemCountEx (ii);
  165. CString str;
  166. str.Format ("单数:%d", ii);
  167. SetDlgItemText(IDC_STATIC2, str);
  168. }
  169. else
  170. {
  171. m_List1.DeleteAllItems2 ();
  172. int ii=0;
  173. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  174. int count=0;
  175. if(m_filter.IsEmpty ())
  176. {
  177. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  178. {
  179. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  180. }
  181. }
  182. else
  183. {
  184. int type=GetType(m_filter);
  185. if(type==1)//电话
  186. {
  187. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  188. {
  189. if(m_List1array.ElementAt (ii).ElementAt (30+m_nadd).Find (m_filter)!=-1 || \
  190. m_List1array.ElementAt (ii).ElementAt (31+m_nadd).Find (m_filter)!=-1)
  191. {
  192. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  193. }
  194. }
  195. }
  196. else if(type==2)//拼音
  197. {
  198. m_filter.MakeUpper ();
  199. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  200. {
  201. if(m_List1array.ElementAt (ii).ElementAt (32+m_nadd).Find (m_filter)!=-1 || \
  202. m_List1array.ElementAt (ii).ElementAt (33+m_nadd).Find (m_filter)!=-1)
  203. {
  204. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  205. }
  206. }
  207. }
  208. else
  209. {
  210. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  211. {
  212. if(m_List1array.ElementAt (ii).ElementAt (0).Find (m_filter)!=-1 || \
  213. m_List1array.ElementAt (ii).ElementAt (1).Find (m_filter)!=-1 || \
  214. m_List1array.ElementAt (ii).ElementAt (2).Find (m_filter)!=-1 || \
  215. m_List1array.ElementAt (ii).ElementAt (3).Find (m_filter)!=-1 || \
  216. m_List1array.ElementAt (ii).ElementAt (4).Find (m_filter)!=-1 || \
  217. m_List1array.ElementAt (ii).ElementAt (19+m_nadd).Find (m_filter)!=-1 || \
  218. m_List1array.ElementAt (ii).ElementAt (20+m_nadd).Find (m_filter)!=-1 || \
  219. m_List1array.ElementAt (ii).ElementAt (22+m_nadd).Find (m_filter)!=-1 || \
  220. m_List1array.ElementAt (ii).ElementAt (23+m_nadd).Find (m_filter)!=-1 || \
  221. m_List1array.ElementAt (ii).ElementAt (33+m_nadd).Find (m_filter)!=-1 || \
  222. m_List1array.ElementAt (ii).ElementAt (30+m_nadd).Find (m_filter)!=-1 ||\
  223. m_List1array.ElementAt (ii).ElementAt (31+m_nadd).Find (m_filter)!=-1 || \
  224. m_List1array.ElementAt (ii).ElementAt (32+m_nadd).Find (m_filter)!=-1)
  225. {
  226. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  227. }
  228. }
  229. }
  230. }
  231. m_List1.m_arLabels.SetSize(count, 1);
  232. ii=count;
  233. m_List1.m_LabelCount=ii;
  234. m_List1.SetItemCountEx (ii);
  235. CString str;
  236. str.Format ("单数:%d", ii);
  237. SetDlgItemText(IDC_STATIC2, str);
  238. }
  239. if(!g_id.IsEmpty ())
  240. {
  241. for(int i=0; i<m_List1.GetItemCount (); i++)
  242. {
  243. if(g_id==m_List1.GetItemText (i, 1 ))
  244. {
  245. m_List1.SetItemState(i,LVIS_SELECTED|LVIS_FOCUSED,LVIS_SELECTED|LVIS_FOCUSED);
  246. m_List1.EnsureVisible(i,FALSE);
  247. break;
  248. }
  249. }
  250. }
  251. }
  252. void DinDanFromBranch::OnBUTclose()
  253. {
  254. // TODO: Add your control notification handler code here
  255. GetParent()->SendMessage(WM_CLOSE);
  256. }
  257. void DinDanFromBranch::OnButton1()
  258. {
  259. // TODO: Add your control notification handler code here
  260. UpdateData();
  261. m_filter.TrimLeft ();
  262. m_filter.TrimRight ();
  263. FillGrid();
  264. }
  265. void DinDanFromBranch::OnSelchangeCombo1()
  266. {
  267. // TODO: Add your control notification handler code here
  268. SetTimer(1, 100, NULL);
  269. }
  270. void DinDanFromBranch::OnTimer(UINT nIDEvent)
  271. {
  272. // TODO: Add your message handler code here and/or call default
  273. KillTimer(nIDEvent);
  274. OnButton1();
  275. }
  276. BOOL DinDanFromBranch::PreTranslateMessage(MSG* pMsg)
  277. {
  278. // TODO: Add your c code here and/or call the base class
  279. try
  280. {
  281. if(pMsg->message==WM_KEYDOWN)
  282. {
  283. switch (pMsg->wParam)
  284. {
  285. case VK_RETURN:
  286. OnButton1();
  287. return 1;
  288. case VK_F9:
  289. GetClientPhone();
  290. return 1;
  291. case 0x43: // copy
  292. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  293. {
  294. GetFocus()->SendMessage(WM_COPY);
  295. return TRUE;
  296. }
  297. break;
  298. case 0x56: //Ctrl + V:
  299. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  300. {
  301. GetFocus()->SendMessage(WM_PASTE);
  302. return TRUE;
  303. }
  304. break;
  305. case 0x58: // cut
  306. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  307. {
  308. GetFocus()->SendMessage(WM_CUT);
  309. return TRUE;
  310. }
  311. break;
  312. case 0x5A: //undo
  313. case 0x59: //redo
  314. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  315. {
  316. GetFocus()->SendMessage(WM_UNDO);
  317. return TRUE;
  318. }
  319. break;
  320. }
  321. }
  322. return MyFormView::PreTranslateMessage(pMsg);
  323. }
  324. catch(...)
  325. {
  326. }
  327. }
  328. void DinDanFromBranch::GetClientPhone()
  329. {
  330. CStdioFile fp;
  331. fp.Open ("c:\\clientphone.txt", CFile::modeCreate|CFile::modeWrite);
  332. CString str;
  333. CString branch,name,m_name1,m_name2;
  334. CString phone,m_phone1,m_phone2;
  335. CString txname,txprice,mensi;
  336. int leng1=26;
  337. int leng2=15;
  338. int leng3=30;
  339. int leng4=25;
  340. int leng5=15;
  341. int leng6=15;
  342. branch="店名";
  343. name="姓名";
  344. mensi="门市";
  345. phone="电话";
  346. txname="套系";
  347. txprice="价格";
  348. FillLength(name, leng1);
  349. FillLength(mensi, leng2);
  350. FillLength(phone, leng3);
  351. FillLength(txname, leng4);
  352. FillLength(txprice,leng5);
  353. FillLength(branch,leng6);
  354. str=name+mensi+phone+txname+txprice+branch+"\n";
  355. fp.WriteString (str);
  356. for(int i=0; i<m_List1.GetItemCount (); i++)
  357. {
  358. name.Empty ();
  359. phone.Empty ();
  360. m_name1=m_List1.GetItemText (i, 2);
  361. m_name2=m_List1.GetItemText (i, 3);
  362. m_phone1=m_List1.GetItemText (i, 10);
  363. m_phone2=m_List1.GetItemText (i, 11);
  364. mensi=m_List1.GetItemText (i, 7);
  365. txname=m_List1.GetItemText (i, 8);
  366. txprice=m_List1.GetItemText (i, 9);
  367. branch=m_List1.GetItemText (i, 0);
  368. if(!m_name1.IsEmpty ())
  369. name=m_name1+",";
  370. name+=m_name2;
  371. name.TrimRight (",");
  372. if(!m_phone1.IsEmpty ())
  373. phone=m_phone1+",";
  374. phone+=m_phone2;phone.TrimRight (",");
  375. FillLength(name, leng1);
  376. FillLength(mensi, leng2);
  377. FillLength(phone, leng3);
  378. FillLength(txname, leng4);
  379. FillLength(txprice,leng5);
  380. FillLength(branch,leng6);
  381. str=name+mensi+phone+txname+txprice+branch+"\n";
  382. fp.WriteString (str);
  383. }
  384. fp.Close ();
  385. MessageBox("电话已保存到c:\\clientphone.txt");
  386. ShellExecute(NULL, _T("open"), _T("c:\\clientphone.txt"), NULL, NULL, SW_SHOWMAXIMIZED);
  387. }
  388. void DinDanFromBranch::OnBUTprint3()
  389. {
  390. // TODO: Add your control notification handler code here
  391. GetData();
  392. // GetClientPhone();
  393. }
  394. void DinDanFromBranch::OnBUTprint4()
  395. {
  396. // TODO: Add your control notification handler code here
  397. POSITION pos;
  398. pos=m_List1.GetFirstSelectedItemPosition();
  399. if(pos==NULL)
  400. {
  401. return;
  402. }
  403. int iItem=m_List1.GetNextSelectedItem(pos);
  404. CString id = m_List1.GetItemText (iItem, 1);
  405. CString branch = m_List1.GetItemText (iItem, 0);
  406. CString name1=m_List1.GetItemText (iItem, 2);
  407. CString name2=m_List1.GetItemText (iItem, 3);
  408. CString name;
  409. if(!name1.IsEmpty ())
  410. name=name1+",";
  411. name+=name2;
  412. name.TrimRight (",");
  413. CStringArray array;
  414. CString str,sql;
  415. int count=m_combo1.GetCount();
  416. for(int 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(int 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. for(int i=-1; i<g_brancharray.GetSize ()-1; i++)
  612. {
  613. if(i!=-1)
  614. {
  615. branch=g_brancharray.ElementAt (i).ElementAt (0);
  616. g_branchip=g_brancharray.ElementAt (i).ElementAt (1);
  617. g_pMainWnd->OnDisconnect();
  618. g_branchname=branch;
  619. g_bBranchModify=1;
  620. }
  621. else
  622. branch=g_brancharray.ElementAt (g_brancharray.GetSize ()-1).ElementAt (0);
  623. if(g_bShowOK==0)
  624. {
  625. CString filter="status3='未取'";
  626. g_sendhead.bsql=0;
  627. g_sendhead.code[0]=181;
  628. g_sendhead.tabcount=1;
  629. g_pMainWnd->ProcessChatMessageRequest2(filter);
  630. if(g_bSendOK==0)
  631. {
  632. failbrancharray.Add (branch);
  633. continue;
  634. }
  635. }
  636. else
  637. {
  638. g_sendhead.bsql=0;
  639. g_sendhead.code[0]=181;
  640. g_sendhead.tabcount=1;
  641. g_pMainWnd->ProcessChatMessageRequest2(21);
  642. if(g_bSendOK==0)
  643. {
  644. failbrancharray.Add (branch);
  645. continue;
  646. }
  647. }
  648. CArray<CStringArray, CStringArray>List1array;
  649. DataToArray(&List1array);
  650. int size=m_List1array.GetSize ();
  651. for(int j=0; j<List1array.GetSize (); j++)
  652. {
  653. size++;
  654. m_List1array.SetSize(size , 1 );
  655. size--;
  656. m_List1array.ElementAt (size).Copy (List1array.ElementAt (j));
  657. m_List1array.ElementAt (size).InsertAt (0, branch);
  658. size++;
  659. }
  660. }
  661. for(i=0; i<failbrancharray.GetSize (); i++)
  662. {
  663. //AfxMessageBox("连接"+failbrancharray.ElementAt(i)+"服务器失败!", MB_ICONINFORMATION);
  664. }
  665. HidePrice();
  666. FillGrid();
  667. g_pMainWnd->OnDisconnect();g_bBranchModify=0;g_branchip=g_branchname="";
  668. }