ClientMoney.cpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883
  1. // ClientMoney.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "ClientMoney.h"
  6. #include "MyMdi.H"
  7. #include "ModifyDinDan.h"
  8. #include "InputPsw.h"
  9. #include "ImportPhoto.h"
  10. #include "ImportPhoto.h"
  11. #include "NeroDlg.h"
  12. #include "ClientRequirement.h"
  13. #include "ChoosePhotoSkin2.h"
  14. #include "./helper/ffsco.h"
  15. #include "TakeMoney4.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. // ClientMoney
  24. IMPLEMENT_DYNCREATE(ClientMoney, MyFormView)
  25. ClientMoney::ClientMoney()
  26. : MyFormView(ClientMoney::IDD)
  27. {
  28. //{{AFX_DATA_INIT(ClientMoney)
  29. m_filter = _T("");
  30. m_check1 = FALSE;
  31. m_check2 = FALSE;
  32. //}}AFX_DATA_INIT
  33. }
  34. ClientMoney::~ClientMoney()
  35. {
  36. }
  37. void ClientMoney::DoDataExchange(CDataExchange* pDX)
  38. {
  39. MyFormView::DoDataExchange(pDX);
  40. //{{AFX_DATA_MAP(ClientMoney)
  41. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  42. DDX_Control(pDX, IDC_LIST2, m_List1);
  43. DDX_Control(pDX, IDC_STATIC1, m_static1);
  44. DDX_CBString(pDX, IDC_COMBO1, m_filter);
  45. DDX_Check(pDX, IDC_CHECK1, m_check1);
  46. DDX_Check(pDX, IDC_CHECK2, m_check2);
  47. //}}AFX_DATA_MAP
  48. }
  49. BEGIN_MESSAGE_MAP(ClientMoney, MyFormView)
  50. //{{AFX_MSG_MAP(ClientMoney)
  51. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  52. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  53. ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
  54. ON_WM_TIMER()
  55. ON_BN_CLICKED(IDC_BUTshowphoto, OnBUTshowphoto)
  56. ON_BN_CLICKED(IDC_BUTexportphoto, OnBUTexportphoto)
  57. ON_BN_CLICKED(IDC_BUTimportphoto, OnBUTimportphoto)
  58. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  59. ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST2, OnItemchangedList2)
  60. ON_BN_CLICKED(IDC_BUTburncd, OnBUTClientMoney)
  61. ON_NOTIFY(NM_DBLCLK, IDC_LIST2, OnDblclkList2)
  62. ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2)
  63. ON_BN_CLICKED(IDC_BUTburncd2, OnBUTburncd2)
  64. ON_BN_CLICKED(IDC_CHECK1, OnCheck1)
  65. ON_BN_CLICKED(IDC_CHECK2, OnCheck2)
  66. //}}AFX_MSG_MAP
  67. ON_NOTIFY(NM_CUSTOMDRAW, IDC_LIST2, OnCustomdrawList)
  68. END_MESSAGE_MAP()
  69. /////////////////////////////////////////////////////////////////////////////
  70. // ClientMoney diagnostics
  71. #ifdef _DEBUG
  72. void ClientMoney::AssertValid() const
  73. {
  74. MyFormView::AssertValid();
  75. }
  76. void ClientMoney::Dump(CDumpContext& dc) const
  77. {
  78. MyFormView::Dump(dc);
  79. }
  80. #endif //_DEBUG
  81. /////////////////////////////////////////////////////////////////////////////
  82. // ClientMoney message handlers
  83. void ClientMoney::OnInitialUpdate()
  84. {
  85. MyFormView::OnInitialUpdate();
  86. // TODO: Add your specialized code here and/or call the base class
  87. CMyMdi Mdi;
  88. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  89. GetDlgItem(IDC_BUTburncd2)->EnableWindow(IsHasRights2new(49));
  90. // Here we create the outbar control using the splitter as its parent
  91. // and setting its id to the first pane.
  92. CRect rc2;
  93. GetWindowRect(rc2);
  94. ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
  95. EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
  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" );
  99. #else
  100. m_List1.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;是否取件,100;应付,100;前期,100;后期,100;已付,100;欠款,100;门市,100;套系名称,100;套系价格,100;男宾电话,100;女宾电话,100" );
  101. #endif
  102. m_List1.LoadColumnInfo (126);
  103. if(0)//g_bShowOK==0)
  104. {
  105. #ifdef LKAY_VERSION
  106. CString filter="status3='未取' and (dindantype<>'意向客户' or dindantype is null)";
  107. #else
  108. CString filter="status3='未取'";
  109. #endif
  110. g_sendhead.bsql=0;
  111. g_sendhead.code[0]=62;
  112. g_sendhead.tabcount=1;
  113. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  114. }
  115. else
  116. {
  117. g_sendhead.bsql=0;
  118. g_sendhead.code[0]=62;
  119. g_sendhead.tabcount=1;
  120. #ifdef LKAY_VERSION
  121. CString filter="dindantype<>'意向客户' or dindantype is null";
  122. g_pMainWnd->ProcessChatMessageRequest2(filter);
  123. #else
  124. g_pMainWnd->ProcessChatMessageRequest2(1);
  125. #endif
  126. if(g_bSendOK==0)return;
  127. }
  128. DataToArray(&m_List1array);HidePrice();
  129. FillGrid();
  130. m_combo1.GetWindowRect (rc2);
  131. ScreenToClient(rc2);
  132. rc2.bottom +=200;
  133. m_combo1.MoveWindow (rc2);
  134. GetDlgItem(IDC_BUTclose)->GetWindowRect(rc2);
  135. SetComboHei(&m_combo1, rc2.Height ());
  136. }
  137. void ClientMoney::FillGrid(BOOL bStatus)
  138. {
  139. m_List1.DeleteAllItems2 ();
  140. int ii=0;
  141. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  142. int count=0;
  143. if(m_filter.IsEmpty ()||m_check1||m_check2)
  144. {
  145. if(m_check1||m_check2)//电话
  146. {
  147. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  148. {
  149. if(m_check1)
  150. {
  151. if(m_List1array.ElementAt (ii).ElementAt (3)!="OK")continue;
  152. }
  153. if(m_check2)
  154. {
  155. if(atoi(m_List1array.ElementAt (ii).ElementAt (8))==0)continue;
  156. }
  157. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  158. }
  159. }
  160. else
  161. {
  162. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  163. {
  164. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  165. }
  166. }
  167. }
  168. else
  169. {
  170. int type=GetType(m_filter);
  171. if(type==1)//电话
  172. {
  173. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  174. {
  175. if(m_List1array.ElementAt (ii).ElementAt (13).Find (m_filter)!=-1 || \
  176. m_List1array.ElementAt (ii).ElementAt (12).Find (m_filter)!=-1)
  177. {
  178. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  179. }
  180. }
  181. }
  182. else if(type==2)//拼音
  183. {
  184. m_filter.MakeUpper ();
  185. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  186. {
  187. if(m_List1array.ElementAt (ii).ElementAt (15).Find (m_filter)!=-1 || \
  188. m_List1array.ElementAt (ii).ElementAt (14).Find (m_filter)!=-1)
  189. {
  190. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  191. }
  192. }
  193. }
  194. else
  195. {
  196. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  197. {
  198. if(m_List1array.ElementAt (ii).ElementAt (0).Find (m_filter)!=-1 ||\
  199. m_List1array.ElementAt (ii).ElementAt (1).Find (m_filter)!=-1 || \
  200. m_List1array.ElementAt (ii).ElementAt (2).Find (m_filter)!=-1 || \
  201. m_List1array.ElementAt (ii).ElementAt (7).Find (m_filter)!=-1|| \
  202. m_List1array.ElementAt (ii).ElementAt (8).Find (m_filter)!=-1|| \
  203. m_List1array.ElementAt (ii).ElementAt (9).Find (m_filter)!=-1 || \
  204. m_List1array.ElementAt (ii).ElementAt (10).Find (m_filter)!=-1 || \
  205. m_List1array.ElementAt (ii).ElementAt (11).Find (m_filter)!=-1 || \
  206. m_List1array.ElementAt (ii).ElementAt (12).Find (m_filter)!=-1 || \
  207. m_List1array.ElementAt (ii).ElementAt (13).Find (m_filter)!=-1 )
  208. {
  209. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  210. }
  211. }
  212. }
  213. }
  214. m_List1.m_arLabels.SetSize(count, 1);
  215. ii=count;
  216. m_List1.m_LabelCount=ii;
  217. m_List1.SetItemCountEx (ii);
  218. CString str;
  219. str.Format ("单数:%d", ii);
  220. SetDlgItemText(IDC_STATIC2, str);
  221. if(!g_id.IsEmpty ())
  222. {
  223. for(int i=0; i<m_List1.GetItemCount (); i++)
  224. {
  225. if(g_id==m_List1.GetItemText (i, 0))
  226. {
  227. m_List1.SetItemState(i,LVIS_SELECTED|LVIS_FOCUSED,LVIS_SELECTED|LVIS_FOCUSED);
  228. m_List1.EnsureVisible(i,FALSE);
  229. break;
  230. }
  231. }
  232. }
  233. }
  234. void ClientMoney::OnBUTclose()
  235. {
  236. // TODO: Add your control notification handler code here
  237. GetParent()->SendMessage(WM_CLOSE);
  238. }
  239. void ClientMoney::OnSelchangeCombo1()
  240. {
  241. // TODO: Add your control notification handler code here
  242. SetTimer(1, 100, NULL);
  243. }
  244. void ClientMoney::OnTimer(UINT nIDEvent)
  245. {
  246. // TODO: Add your message handler code here and/or call default
  247. KillTimer(nIDEvent);
  248. OnButton1();
  249. }
  250. BOOL ClientMoney::PreTranslateMessage(MSG* pMsg)
  251. {
  252. // TODO: Add your specialized code here and/or call the base class
  253. try
  254. {
  255. if(pMsg->message==WM_KEYDOWN)
  256. {
  257. switch (pMsg->wParam)
  258. {
  259. case VK_RETURN:
  260. OnButton1();
  261. return 1;
  262. case 0x43: // copy
  263. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  264. {
  265. GetFocus()->SendMessage(WM_COPY);
  266. return TRUE;
  267. }
  268. break;
  269. case 0x56: //Ctrl + V:
  270. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  271. {
  272. GetFocus()->SendMessage(WM_PASTE);
  273. return TRUE;
  274. }
  275. break;
  276. case 0x58: // cut
  277. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  278. {
  279. GetFocus()->SendMessage(WM_CUT);
  280. return TRUE;
  281. }
  282. break;
  283. case 0x5A: //undo
  284. case 0x59: //redo
  285. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  286. {
  287. GetFocus()->SendMessage(WM_UNDO);
  288. return TRUE;
  289. }
  290. break;
  291. }
  292. }
  293. return MyFormView::PreTranslateMessage(pMsg);
  294. }
  295. catch(...)
  296. {
  297. }
  298. }
  299. extern int CALLBACK BrowseProc(HWND hwnd, UINT msg, LPARAM lParam, LPARAM lpData);
  300. /*{
  301. switch(msg)
  302. {
  303. case BFFM_INITIALIZED:
  304. SendMessage(hwnd, BFFM_SETSELECTION, TRUE, NULL);
  305. break;
  306. case BFFM_SELCHANGED:
  307. {
  308. char szFileName[MAX_PATH];
  309. LPITEMIDLIST pidlCurrent = (LPITEMIDLIST)lParam;
  310. SHGetPathFromIDList(pidlCurrent, szFileName);
  311. SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)szFileName);
  312. }
  313. break;
  314. }
  315. return 0;
  316. }*/
  317. void ClientMoney::GetSavePath(CString &path)
  318. {
  319. char lpszDisplayName[MAX_PATH], szFileName[MAX_PATH];
  320. LPITEMIDLIST pidlDesktop, pidlCurrent;
  321. if(SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidlDesktop)
  322. == NOERROR)
  323. {
  324. BROWSEINFO bi;
  325. bi.hwndOwner = this->m_hWnd;
  326. bi.pidlRoot = pidlDesktop;
  327. bi.pszDisplayName = lpszDisplayName;
  328. bi.lpszTitle = "\n文档保存的目录:";
  329. bi.ulFlags = BIF_STATUSTEXT&BIF_RETURNONLYFSDIRS ;
  330. bi.lpfn = BrowseProc;
  331. bi.lParam = 0;
  332. bi.iImage = 0;
  333. pidlCurrent = SHBrowseForFolder(&bi);
  334. SHGetPathFromIDList(pidlCurrent, szFileName);
  335. path = szFileName;
  336. }
  337. }
  338. int ClientMoney::FindArray(CStringArray *pArray, CString Str)
  339. {
  340. for(int i=0; i<pArray->GetSize (); i++)
  341. {
  342. if(pArray->ElementAt (i)==Str)
  343. return i;
  344. }
  345. return -1;
  346. }
  347. void ClientMoney::GetNo(CString str, CStringArray &array)
  348. {
  349. if(!str.IsEmpty ())
  350. {
  351. int pos=str.Find (",");
  352. while(pos!=-1)
  353. {
  354. if(FindArray(&array, str.Left (pos))==-1)
  355. array.Add (str.Left (pos));
  356. str=str.Right (str.GetLength ()-pos-1);
  357. pos=str.Find (",");
  358. }
  359. if(FindArray(&array, str)==-1)
  360. array.Add(str);
  361. }
  362. }
  363. CString ClientMoney::GetSelName(CString name, CArray<CStringArray, CStringArray>&spnamearray)
  364. {
  365. CString ret;
  366. name=","+name+",";
  367. CString str;
  368. for(int i=0; i<spnamearray.GetSize (); i++)
  369. {
  370. str=","+spnamearray.ElementAt (i).ElementAt (6)+",";
  371. if(str.Find (name)!=-1)
  372. {
  373. ret+=spnamearray.ElementAt (i).ElementAt (5);
  374. ret+=";";
  375. }
  376. }
  377. ret.TrimRight (";");
  378. ret.Replace ("*", "x");
  379. return ret;
  380. }
  381. void ClientMoney::OnBUTexportphoto()
  382. {
  383. if(IsHasRights2new(11)==0)return;
  384. // TODO: Add your control notification handler code here
  385. POSITION pos;
  386. pos=m_List1.GetFirstSelectedItemPosition();
  387. if(pos==NULL)
  388. {
  389. AfxMessageBox("请先选中您要导出片的定单!", MB_ICONINFORMATION);
  390. return;
  391. }
  392. int iItem=m_List1.GetNextSelectedItem(pos);
  393. CString id=m_List1.GetItemText (iItem, 0);
  394. CString path;
  395. path=g_path4+"\\";
  396. path+=id;
  397. path +="\\";
  398. CString temp;
  399. CStringArray array;
  400. using namespace helper_coffs;
  401. ffsco o;
  402. o.dirs(0);
  403. o.find(LPCSTR(path), LPCSTR("*.jpg"));
  404. ffsco::typeT coo;
  405. ffsco::typeT::iterator it;
  406. coo = o.co_file();
  407. for (it = coo.begin();
  408. coo.end() != it;
  409. it ++)
  410. {
  411. temp=(*it).c_str();
  412. if(temp.GetAt (temp.ReverseFind ('\\')+1)!='s' && temp.GetAt (temp.ReverseFind ('\\')+1)!='m')
  413. {
  414. array.Add (temp);
  415. }
  416. }
  417. if(array.GetSize ()==0)
  418. {
  419. AfxMessageBox("此单未导片!", MB_ICONINFORMATION);
  420. return;
  421. }
  422. CString dir;
  423. GetSavePath(dir);
  424. if(dir.IsEmpty())
  425. {
  426. return;
  427. }
  428. CString name1=m_List1.GetItemText (iItem, 1);
  429. CString name2=m_List1.GetItemText (iItem, 2);
  430. dir.TrimRight ('\\');
  431. dir+="\\";
  432. dir+=id;
  433. dir+=name1;
  434. dir+=name2;
  435. dir+="精修好的片";
  436. dir+="\\";
  437. ::CreateDirectory (dir, NULL);
  438. ImportPhoto dlg;
  439. dlg.m_mode =1;
  440. dlg.m_pArray=&array;
  441. dlg.m_savepath =dir;
  442. dlg.DoModal (); AfxMessageBox("导片成功!", MB_ICONINFORMATION);
  443. }
  444. void ClientMoney::OnBUTimportphoto()
  445. {
  446. // TODO: Add your control notification handler code here
  447. POSITION pos;
  448. pos=m_List1.GetFirstSelectedItemPosition();
  449. if(pos==NULL)
  450. {
  451. AfxMessageBox("请先选中您要导片的定单!", MB_ICONINFORMATION);
  452. return;
  453. }
  454. int iItem=m_List1.GetNextSelectedItem(pos);
  455. CString id=m_List1.GetItemText (iItem, 0);
  456. CString oldstatus=m_List1.GetItemText (iItem, 4);
  457. CString name=m_List1.GetItemText (iItem, 1)+","+m_List1.GetItemText (iItem, 2);
  458. name.TrimLeft (",");
  459. name.TrimRight (",");
  460. name="客人:"+name;
  461. CString phone=m_List1.GetItemText (iItem, 13)+","+m_List1.GetItemText (iItem, 14);
  462. phone.TrimLeft (",");
  463. phone.TrimRight (",");
  464. phone="电话:"+phone;
  465. if(g_path3.IsEmpty ())
  466. {
  467. AfxMessageBox("未设置设计片保存机器, 请通知系统管理员!", MB_ICONINFORMATION);
  468. return;
  469. }
  470. if(!::CheckFolderFileExist (g_path3))
  471. {
  472. AfxMessageBox("设计片保存机器目录未设置, 请通知系统管理员!", MB_ICONINFORMATION);
  473. return;
  474. }
  475. CString savepath=g_path3+"\\";
  476. savepath+=id+"\\";
  477. if(::CheckFolderFileExist (savepath)==0)
  478. ::CreateDirectory (savepath, NULL);
  479. CString srcdir;CString str;
  480. GetSavePath(srcdir);
  481. if(srcdir.IsEmpty())
  482. {
  483. CString status5;
  484. if(AfxMessageBox("客照是否全部设计完毕?", MB_YESNO|MB_ICONINFORMATION)==IDYES)
  485. status5="OK";
  486. else
  487. status5="设计中";
  488. CString sql;
  489. sql="update dindan set status5='"+status5+"' where id='"+id+"'";
  490. sql+=DINDAN_REF;
  491. g_sendhead.bsql=1;
  492. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  493. for(int i=0; i<m_List1array.GetSize (); i++)
  494. {
  495. if(id==m_List1array.ElementAt (i).ElementAt (0))
  496. {
  497. m_List1array.ElementAt (i).SetAt (4, status5);
  498. FillGrid();
  499. break;
  500. }
  501. }
  502. return;
  503. }
  504. if(srcdir.GetLength ()<4)
  505. {
  506. AfxMessageBox("请选择正确的您文件所在的目录!", MB_ICONSTOP);
  507. return;
  508. }
  509. if(oldstatus!="未设计")
  510. {
  511. CString str;
  512. str.Format ("%s\r\n%s\r\n此单已导入过设计片, 确认您选中的照片没有导入过吗? 否则会覆盖原来的照片, 是否继续?", name, phone );
  513. if(AfxMessageBox(str, MB_YESNO|MB_ICONSTOP)!=IDYES)
  514. return;
  515. }
  516. else
  517. {
  518. CString str;
  519. str.Format ("%s\r\n%s\r\n确认您选中的照片与客户资料相符吗? 是否继续?", name, phone );
  520. if(AfxMessageBox(str, MB_YESNO|MB_ICONINFORMATION)!=IDYES)
  521. return;
  522. }
  523. CStringArray array;
  524. CStringArray desarray;
  525. CStringArray dirarray;
  526. if(1)
  527. {
  528. using namespace helper_coffs;
  529. ffsco o;
  530. o.dirs(1);
  531. o.find(LPCSTR(srcdir), LPCSTR("*.*"));
  532. ffsco::typeT coo;
  533. ffsco::typeT::iterator it;
  534. coo = o.co_dir();
  535. for (it = coo.begin();
  536. coo.end() != it;
  537. it ++)
  538. {
  539. str=(*it).c_str();
  540. if(FindArray(&dirarray, str)==-1)
  541. {
  542. dirarray.Add (str);
  543. if(str!=dirarray.ElementAt (0))
  544. {
  545. str=savepath+str.Right (str.GetLength ()-dirarray.ElementAt (0).GetLength ());
  546. if(::CheckFolderFileExist (str)==0)
  547. ::CreateDirectory (str, NULL);
  548. }
  549. }
  550. }
  551. }
  552. if(1)
  553. {
  554. for(int i=0; i<dirarray.GetSize (); i++)
  555. {
  556. using namespace helper_coffs;
  557. ffsco o;
  558. o.dirs(0);
  559. o.find(LPCSTR(dirarray.ElementAt (i)), LPCSTR("*.jpg"));
  560. ffsco::typeT coo;
  561. ffsco::typeT::iterator it;
  562. coo = o.co_file();
  563. for (it = coo.begin();
  564. coo.end() != it;
  565. it ++)
  566. {
  567. str=(*it).c_str();
  568. array.Add (str);
  569. desarray.Add (savepath+dirarray.ElementAt (i).Right (dirarray.ElementAt (i).GetLength ()-dirarray.ElementAt (0).GetLength ())+str.Right (str.GetLength ()-str.ReverseFind ('\\')-1));
  570. }
  571. }
  572. }
  573. if(array.GetSize ()==0)return;
  574. ImportPhoto dlg;
  575. dlg.m_pArray=&array;
  576. dlg.m_pDesArray=&desarray;
  577. dlg.m_savepath =savepath;
  578. dlg.DoModal ();
  579. CString status5;
  580. if(AfxMessageBox("客照是否全部设计完毕?", MB_YESNO|MB_ICONINFORMATION)==IDYES)
  581. status5="OK";
  582. else
  583. status5="设计中";
  584. CString sql;
  585. sql="update dindan set status5='"+status5+"',waiter4='"+g_user.name+"' where id='"+id+"'";
  586. sql+=DINDAN_REF;
  587. g_sendhead.bsql=1;
  588. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  589. savepath+="ok";
  590. ::DeleteFile (savepath);
  591. AfxMessageBox("导入客照成功!", MB_ICONINFORMATION);
  592. for(int i=0; i<m_List1array.GetSize (); i++)
  593. {
  594. if(id==m_List1array.ElementAt (i).ElementAt (0))
  595. {
  596. m_List1array.ElementAt (i).SetAt (4, status5);
  597. m_List1array.ElementAt (i).SetAt (10, g_user.name);
  598. FillGrid();
  599. break;
  600. }
  601. }
  602. }
  603. void ClientMoney::OnBUTshowphoto()
  604. {
  605. // TODO: Add your control notification handler code here
  606. POSITION pos;
  607. pos=m_List1.GetFirstSelectedItemPosition();
  608. if(pos==NULL)
  609. {
  610. AfxMessageBox("请先选中您要查看的定单!", MB_ICONINFORMATION);
  611. return;
  612. }
  613. int iItem=m_List1.GetNextSelectedItem(pos);
  614. CString status=m_List1.GetItemText (iItem, 4);
  615. CString id=m_List1.GetItemText (iItem, 0);
  616. if(status=="未设计")
  617. {
  618. AfxMessageBox("此单未导片!", MB_ICONINFORMATION);
  619. return;
  620. }
  621. /* ShowPic dlg;
  622. dlg.m_path=g_path3+"\\";
  623. dlg.m_path+=id;
  624. dlg.m_path +="\\";
  625. dlg.DoModal ();*/
  626. ChoosePhotoSkin2 dlg;
  627. dlg.m_mode2 =1;
  628. dlg.SetLiaPath ("3.lia");
  629. dlg.m_strOrderNumber=id;
  630. dlg.m_path=g_path3+"\\";
  631. dlg.m_path+=id;
  632. dlg.m_path +="\\";
  633. dlg.DoModal ();
  634. for(int i=0; i<m_List1array.GetSize (); i++)
  635. {
  636. if(id==m_List1array.ElementAt (i).ElementAt (0))
  637. {
  638. m_List1array.ElementAt (i).SetAt (7, dlg.m_bz2);
  639. // FillGrid();
  640. break;
  641. }
  642. }
  643. }
  644. void ClientMoney::OnButton1()
  645. {
  646. // TODO: Add your control notification handler code here
  647. UpdateData();
  648. m_filter.TrimLeft ();
  649. m_filter.TrimRight ();
  650. FillGrid();
  651. }
  652. void ClientMoney::OnButton2()
  653. {
  654. // TODO: Add your control notification handler code here
  655. }
  656. void ClientMoney::OnItemchangedList2(NMHDR* pNMHDR, LRESULT* pResult)
  657. {
  658. NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
  659. // TODO: Add your control notification handler code here
  660. POSITION pos;
  661. pos=m_List1.GetFirstSelectedItemPosition();
  662. if(pos==NULL)
  663. {
  664. return;
  665. }
  666. int iItem=m_List1.GetNextSelectedItem(pos);
  667. CString waiter4=m_List1.GetItemText (iItem, 10);
  668. if(waiter4.IsEmpty () && IsHasRights2new(7) || IsHasRights2new(49) )
  669. {
  670. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(1);
  671. }
  672. else if(waiter4==g_user.name && IsHasRights2new(7) )
  673. {
  674. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(1);
  675. }
  676. else
  677. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(0);
  678. *pResult = 0;
  679. }
  680. void ClientMoney::OnBUTClientMoney()
  681. {
  682. // TODO: Add your control notification handler code here
  683. #ifdef LYFZ_VERSION
  684. //return;
  685. #endif
  686. POSITION pos;
  687. pos=m_List1.GetFirstSelectedItemPosition();
  688. if(pos==NULL)
  689. {
  690. return;
  691. }
  692. int iItem=m_List1.GetNextSelectedItem(pos);
  693. CString id=m_List1.GetItemText (iItem, 0);
  694. TakeMoney4 dlg;
  695. dlg.m_mode =5;
  696. dlg.m_id =id;
  697. dlg.m_name1 =m_List1.GetItemText (iItem, 1);
  698. dlg.m_name2 =m_List1.GetItemText (iItem, 2);
  699. if(dlg.DoModal ()!=IDOK)return;
  700. }
  701. void ClientMoney::OnDblclkList2(NMHDR* pNMHDR, LRESULT* pResult)
  702. {
  703. // TODO: Add your control notification handler code here
  704. OnBUTClientMoney();
  705. *pResult = 0;
  706. }
  707. void ClientMoney::OnCustomdrawList ( NMHDR* pNMHDR, LRESULT* pResult )
  708. {
  709. NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>( pNMHDR );
  710. // Take the default processing unless we set this to something else below.
  711. *pResult = 0;
  712. // First thing - check the draw stage. If it's the control's prepaint
  713. // stage, then tell Windows we want messages for every item.
  714. if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
  715. {
  716. *pResult = CDRF_NOTIFYITEMDRAW;
  717. }
  718. else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage )
  719. {
  720. // This is the prepaint stage for an item. Here's where we set the
  721. // item's text color. Our return value will tell Windows to draw the
  722. // item itself, but it will use the new color we set here.
  723. // We'll cycle the colors through red, green, and light blue.
  724. if(m_List1.m_arLabels.ElementAt (pLVCD->nmcd.dwItemSpec).ElementAt (8)!="0")
  725. pLVCD->clrText = RGB(220,0,0);
  726. else
  727. pLVCD->clrText = RGB(20,133,20);
  728. if(pLVCD->nmcd.dwItemSpec%2)
  729. pLVCD->clrTextBk = g_gridcol1;
  730. else
  731. pLVCD->clrTextBk = g_gridcol2;
  732. // Store the color back in the NMLVCUSTOMDRAW struct.
  733. // Tell Windows to paint the control itself.
  734. *pResult = CDRF_DODEFAULT;
  735. }
  736. }
  737. void ClientMoney::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
  738. {
  739. // TODO: Add your control notification handler code here
  740. POSITION pos;
  741. pos=m_List1.GetFirstSelectedItemPosition();
  742. if(pos==NULL)return;
  743. int iItem=m_List1.GetNextSelectedItem(pos);
  744. g_id = m_List1.GetItemText (iItem, 0);
  745. *pResult = 0;
  746. }
  747. void ClientMoney::HidePrice()
  748. {
  749. #ifdef LKAY_VERSION
  750. if(IsHasRights2new(31))return;
  751. for(int i=0; i< m_List1array.GetSize (); i++)
  752. {
  753. m_List1array.ElementAt (i).SetAt (4, "***");
  754. m_List1array.ElementAt (i).SetAt (5, "***");
  755. m_List1array.ElementAt (i).SetAt (6, "***");
  756. m_List1array.ElementAt (i).SetAt (7, "***");
  757. m_List1array.ElementAt (i).SetAt (8, "***");
  758. m_List1array.ElementAt (i).SetAt (9, "***");
  759. m_List1array.ElementAt (i).SetAt (10, "***");
  760. m_List1array.ElementAt (i).SetAt (11, "***");
  761. m_List1array.ElementAt (i).SetAt (12, "***");
  762. }
  763. #else
  764. if(IsHasRights2new(31))return;
  765. for(int i=0; i< m_List1array.GetSize (); i++)
  766. {
  767. m_List1array.ElementAt (i).SetAt (11, "***");
  768. m_List1array.ElementAt (i).SetAt (12, "***");
  769. }
  770. #endif
  771. #ifdef LYFZ_VERSION
  772. if(IsHasRights2new(49))return;
  773. for( i=0; i< m_List1array.GetSize (); i++)
  774. {
  775. m_List1array.ElementAt (i).SetAt (4, "");
  776. m_List1array.ElementAt (i).SetAt (5, "");
  777. m_List1array.ElementAt (i).SetAt (7, "");
  778. m_List1array.ElementAt (i).SetAt (10, "");
  779. }
  780. #endif
  781. }
  782. void ClientMoney::OnBUTburncd2()
  783. {
  784. // TODO: Add your control notification handler code here
  785. ListToXLS(&m_List1, "c:\\客人欠款.xls", 0);
  786. }
  787. //lYFZ
  788. void ClientMoney::OnCheck1()
  789. {
  790. // TODO: Add your control notification handler code here
  791. UpdateData();
  792. FillGrid();
  793. }
  794. void ClientMoney::OnCheck2()
  795. {
  796. // TODO: Add your control notification handler code here
  797. OnCheck1();
  798. }