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