ClientWnd.cpp 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. // ClientWnd.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "ClientWnd.h"
  6. #include "JPEG.h"
  7. #include "StaffAchievementShowAll.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CClientWnd
  15. CClientWnd::CClientWnd()
  16. {
  17. m_bInit=1;
  18. }
  19. CClientWnd::~CClientWnd()
  20. {
  21. for(int i=0; i<50; i++)
  22. {
  23. if(m_label[i].GetSafeHwnd ())
  24. m_label[i].DestroyWindow ();
  25. }
  26. }
  27. BEGIN_MESSAGE_MAP(CClientWnd, CWnd)
  28. //{{AFX_MSG_MAP(CClientWnd)
  29. ON_WM_ERASEBKGND()
  30. ON_WM_CREATE()
  31. ON_CBN_SELCHANGE(100, OnSelchangeCOMBOid)
  32. //}}AFX_MSG_MAP
  33. END_MESSAGE_MAP()
  34. /////////////////////////////////////////////////////////////////////////////
  35. // CClientWnd message handlers
  36. BOOL CClientWnd::OnEraseBkgnd(CDC* pDC)
  37. {
  38. // TODO: Add your message handler code here and/or call default
  39. CRect rc;
  40. GetClientRect (rc);
  41. pDC->FillSolidRect (rc, g_bkcol);
  42. return 1;
  43. #ifdef NEW_SKIN
  44. if(m_bInit)
  45. {
  46. m_bInit=0;
  47. /* CRect rc;
  48. rc=g_pMainWnd2->m_rcarray.ElementAt (17);
  49. ScreenToClient(rc);
  50. m_combobox.Create(WS_VSCROLL|WS_CHILD|CBS_DROPDOWN,rc,this,100);
  51. m_combobox.ShowWindow(SW_SHOW);
  52. rc.bottom +=260;
  53. m_combobox.MoveWindow (rc);
  54. tpFont.CreatePointFont (180, _T("黑体"));
  55. m_combobox.SetFont(&tpFont);
  56. m_acCombo.Init(&m_combobox);
  57. g_sendhead.bsql=0;
  58. g_sendhead.code[0]=30;
  59. g_sendhead.tabcount=1;
  60. g_pMainWnd->ProcessChatMessageRequest2(21);if(g_bSendOK==0)return 0;
  61. DataToArray(&m_List1array);
  62. m_acCombo.m_pArray=&m_List1array;
  63. m_combobox.SetFocus ();
  64. CRect rcarray[50];
  65. int pos=0;
  66. rcarray[pos]=g_pMainWnd2->m_rcarray.ElementAt (18);ScreenToClient(rcarray[pos]);pos++;
  67. int dt=g_pMainWnd2->m_rcarray.ElementAt (20).left -g_pMainWnd2->m_rcarray.ElementAt (19).left ;
  68. for(int i=0; i<6; i++)
  69. {
  70. rc=g_pMainWnd2->m_rcarray.ElementAt (19);
  71. rc.left +=dt*i;
  72. rc.right +=dt*i;
  73. ScreenToClient(rc);
  74. rcarray[pos]=rc;pos++;
  75. }
  76. dt=g_pMainWnd2->m_rcarray.ElementAt (22).top -g_pMainWnd2->m_rcarray.ElementAt (21).top ;
  77. for(i=0; i<10; i++)
  78. {
  79. rc=g_pMainWnd2->m_rcarray.ElementAt (21);
  80. rc.top +=dt*i;
  81. rc.bottom +=dt*i;
  82. ScreenToClient(rc);
  83. rcarray[pos]=rc;pos++;
  84. }
  85. for(i=0; i<10; i++)
  86. {
  87. rc=g_pMainWnd2->m_rcarray.ElementAt (23);
  88. rc.top +=dt*i;
  89. rc.bottom +=dt*i;
  90. ScreenToClient(rc);
  91. rcarray[pos]=rc;pos++;
  92. }
  93. for(i=0; i<10; i++)
  94. {
  95. rc=g_pMainWnd2->m_rcarray.ElementAt (24);
  96. rc.top +=dt*i;
  97. rc.bottom +=dt*i;
  98. ScreenToClient(rc);
  99. rcarray[pos]=rc;pos++;
  100. }
  101. for(i=0; i<6; i++)
  102. {
  103. rc=g_pMainWnd2->m_rcarray.ElementAt (25);
  104. rc.top +=dt*i;
  105. rc.bottom +=dt*i;
  106. ScreenToClient(rc);
  107. rcarray[pos]=rc;pos++;
  108. }
  109. for(i=0; i<6; i++)
  110. {
  111. rc=g_pMainWnd2->m_rcarray.ElementAt (26);
  112. rc.top +=dt*i;
  113. rc.bottom +=dt*i;
  114. ScreenToClient(rc);
  115. rcarray[pos]=rc;pos++;
  116. }
  117. rc=g_pMainWnd2->m_rcarray.ElementAt (27);
  118. ScreenToClient(rc);
  119. rcarray[pos]=rc;pos++;
  120. CString str;
  121. for(i=0; i<pos; i++)
  122. {
  123. str.Format("%d", i);
  124. m_label[i].Create (str, WS_CHILD, rcarray[i], this, 101+i);
  125. m_label[i].SetTextColor(RGB(0,0,255));
  126. m_label[i].SetBorder(TRUE,RGB(0,255,0));
  127. m_label[i].SetBkColor(RGB(255,255,231));
  128. }*/
  129. }
  130. return CWnd::OnEraseBkgnd(pDC);
  131. #else
  132. return CWnd::OnEraseBkgnd(pDC);
  133. #endif
  134. return 1;//CWnd::OnEraseBkgnd(pDC);
  135. }
  136. void CClientWnd::OnSelchangeCOMBOid()
  137. {
  138. int pos=m_combobox.GetCurSel ();
  139. if(pos==-1)return;
  140. if(m_acCombo.m_posarray.GetSize ()<=pos)return;
  141. int pos2=m_acCombo.m_posarray .ElementAt (pos);
  142. CString id=m_List1array.ElementAt (pos2).ElementAt (0);
  143. CString name1=m_List1array.ElementAt (pos2).ElementAt (1);
  144. CString name2=m_List1array.ElementAt (pos2).ElementAt (2);
  145. CString phone1=m_List1array.ElementAt (pos2).ElementAt (12);
  146. CString phone2=m_List1array.ElementAt (pos2).ElementAt (13);
  147. CString filter="[id]='"+id+"';[id]='"+id+"';[id]='"+id+"';id='"+id+"' and kind<>'2'";
  148. g_sendhead.code[0]=11;
  149. g_sendhead.code[1]=27;
  150. g_sendhead.code[2]=38;
  151. g_sendhead.code[3]=56;
  152. g_sendhead.tabcount=4;
  153. g_sendhead.bsql=0;
  154. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  155. CArray<CStringArray, CStringArray>dindanarray;
  156. CArray<CStringArray, CStringArray>m_List1array;
  157. CArray<CStringArray, CStringArray>m_List2array;
  158. CArray<CStringArray, CStringArray>m_sparray;
  159. DataToArray(&dindanarray,&m_List1array,&m_List2array,&m_sparray);
  160. if(dindanarray.GetSize ()==0)return;
  161. CString str;
  162. str="单号: "+id;
  163. str+="\r\n";
  164. str+="男宾: "+name1;
  165. str+="\r\n";
  166. str+="女宾: "+name2;
  167. str+="\r\n";
  168. str+="男宾电话: "+phone1;
  169. str+="\r\n";
  170. str+="女宾电话: "+phone2;
  171. CString strarray[50];
  172. pos=0;
  173. strarray[pos]=str;pos++;
  174. str="拍照:"+dindanarray.ElementAt (0).ElementAt (25);
  175. strarray[pos]=str;pos++;
  176. str="初修:"+dindanarray.ElementAt (0).ElementAt (44);
  177. strarray[pos]=str;pos++;
  178. str="选片:"+dindanarray.ElementAt (0).ElementAt (32);
  179. strarray[pos]=str;pos++;
  180. str="精修:"+dindanarray.ElementAt (0).ElementAt (46);
  181. strarray[pos]=str;pos++;
  182. str="设计:"+dindanarray.ElementAt (0).ElementAt (45);
  183. strarray[pos]=str;pos++;
  184. str="取件:"+dindanarray.ElementAt (0).ElementAt (33);
  185. strarray[pos]=str;pos++;
  186. pos=37;
  187. for(int i=0; i<m_List1array.GetSize (); i++)
  188. {
  189. if(pos>42)break;
  190. str=m_List1array.ElementAt (i).ElementAt (5)+":"+m_List1array.ElementAt (i).ElementAt (1);
  191. strarray[pos]=str;pos++;
  192. }
  193. pos=43;
  194. str.Format ("套系价格:%s", dindanarray.ElementAt (0).ElementAt (8));
  195. strarray[pos]=str;pos++;
  196. for( i=0; i<m_List2array.GetSize (); i++)
  197. {
  198. if(pos>48)break;
  199. str=m_List2array.ElementAt (i).ElementAt (4)+":"+m_List2array.ElementAt (i).ElementAt (1);
  200. strarray[pos]=str;pos++;
  201. }
  202. pos=7;
  203. for( i=0; i<m_sparray.GetSize (); i++)
  204. {
  205. if(pos>16)
  206. {
  207. pos=16;
  208. str="...";
  209. strarray[pos]=str;
  210. strarray[pos+10]=str;
  211. strarray[pos+20]=str;
  212. break;
  213. }
  214. str=m_sparray.ElementAt (i).ElementAt (0);
  215. strarray[pos]=str;
  216. str=m_sparray.ElementAt (i).ElementAt (4);
  217. strarray[pos+10]=str;
  218. str=m_sparray.ElementAt (i).ElementAt (5);
  219. strarray[pos+20]=str;
  220. pos++;
  221. }
  222. CString m_taoxijiage = dindanarray.ElementAt (0).ElementAt (8);
  223. CString m_payed4 = dindanarray.ElementAt (0).ElementAt (19);
  224. CString m_payed5 = dindanarray.ElementAt (0).ElementAt (20);
  225. CString m_money1,m_money2,m_money3;
  226. m_money1 = dindanarray.ElementAt (0).ElementAt (1);
  227. m_money2.Format ("%f", atof(m_payed5)+atof(m_money1));
  228. m_money1.Format ("%f", atof(m_taoxijiage)+atof(m_payed4));
  229. m_money3.Format ("%f", atof(m_money1)-atof(m_money2));
  230. ConvertToPrice(m_money3);
  231. pos=49;
  232. str.Format ("余款:%s", m_money3);
  233. strarray[pos]=str;pos++;
  234. for( i=0; i<50; i++)
  235. {
  236. // if(strarray[i].IsEmpty ())
  237. // strarray[i].Format ("%d", i);
  238. m_label[i].SetWindowText (strarray[i]);
  239. m_label[i].ShowWindow (SW_SHOW);
  240. m_label[i].Paint ();
  241. // m_label[i].Invalidate ();
  242. }
  243. m_combobox.SetFocus ();
  244. }
  245. void CClientWnd::ShowCtrls(BOOL bShow)
  246. {
  247. if(g_pMainWnd2)
  248. {
  249. g_pMainWnd2->UseRgn(bShow);
  250. }
  251. /* if(bShow==0)
  252. {
  253. for(int i=0; i<50; i++)
  254. {
  255. m_label[i].ShowWindow (bShow);
  256. }
  257. }
  258. m_combobox.SetWindowText ("");
  259. m_combobox.ShowWindow (bShow);*/
  260. }