DesignFrom.cpp 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646
  1. // DesignFrom.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "DesignFrom.h"
  6. #include "MyMdi.H"
  7. #include "ModifyDinDan.h"
  8. #include "InputPsw.h"
  9. #include "TakeMoney2.h"
  10. #include "ImportPhoto.h"
  11. #include "ClientRequirement.h"
  12. #include "ChoosePhotoSkin2.h"
  13. #include "./helper/ffsco.h"
  14. #include "SelectPhotoDlg.h"
  15. #include "ShowPic.h"
  16. #include "Login2.h"
  17. #include "ShowCut.h"
  18. #include "CompressOption.h"
  19. #ifdef _DEBUG
  20. #define new DEBUG_NEW
  21. #undef THIS_FILE
  22. static char THIS_FILE[] = __FILE__;
  23. #endif
  24. #pragma comment(lib, "Shlwapi.lib")
  25. /////////////////////////////////////////////////////////////////////////////
  26. // DesignFrom
  27. IMPLEMENT_DYNCREATE(DesignFrom, MyFormView)
  28. DesignFrom::DesignFrom()
  29. : MyFormView(DesignFrom::IDD)
  30. {
  31. //{{AFX_DATA_INIT(DesignFrom)
  32. m_filter = _T("");
  33. m_nAdd=0;
  34. //}}AFX_DATA_INIT
  35. if(g_bAllBranch)
  36. {
  37. m_nAdd=1;
  38. }
  39. }
  40. DesignFrom::~DesignFrom()
  41. {
  42. }
  43. void DesignFrom::DoDataExchange(CDataExchange* pDX)
  44. {
  45. MyFormView::DoDataExchange(pDX);
  46. //{{AFX_DATA_MAP(DesignFrom)
  47. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  48. DDX_Control(pDX, IDC_LIST2, m_List1);
  49. DDX_Control(pDX, IDC_STATIC1, m_static1);
  50. DDX_CBString(pDX, IDC_COMBO1, m_filter);
  51. //}}AFX_DATA_MAP
  52. }
  53. BEGIN_MESSAGE_MAP(DesignFrom, MyFormView)
  54. //{{AFX_MSG_MAP(DesignFrom)
  55. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  56. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  57. ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
  58. ON_WM_TIMER()
  59. ON_BN_CLICKED(IDC_BUTshowphoto, OnBUTshowphoto)
  60. ON_BN_CLICKED(IDC_BUTexportphoto, OnBUTexportphoto)
  61. ON_BN_CLICKED(IDC_BUTimportphoto, OnBUTimportphoto)
  62. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  63. ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST2, OnItemchangedList2)
  64. ON_BN_CLICKED(IDC_BUTimportphoto2, OnBUTimportphoto2)
  65. ON_BN_CLICKED(IDC_BUTimportphoto3, OnBUTimportphoto3)
  66. ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2)
  67. ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
  68. ON_BN_CLICKED(IDC_BTNSEARCHFILTER, OnBtnsearchfilter)
  69. ON_BN_CLICKED(IDC_BUTprint3, OnBUTprint3)
  70. //}}AFX_MSG_MAP
  71. END_MESSAGE_MAP()
  72. /////////////////////////////////////////////////////////////////////////////
  73. // DesignFrom diagnostics
  74. #ifdef _DEBUG
  75. void DesignFrom::AssertValid() const
  76. {
  77. MyFormView::AssertValid();
  78. }
  79. void DesignFrom::Dump(CDumpContext& dc) const
  80. {
  81. MyFormView::Dump(dc);
  82. }
  83. #endif //_DEBUG
  84. /////////////////////////////////////////////////////////////////////////////
  85. // DesignFrom message handlers
  86. void DesignFrom::OnInitialUpdate()
  87. {
  88. MyFormView::OnInitialUpdate();
  89. // TODO: Add your specialized code here and/or call the base class
  90. CMyMdi Mdi;
  91. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  92. GetDlgItem(IDC_BUTimportphoto3)->EnableWindow(IsHasRights2new(12));
  93. GetDlgItem(IDC_BUTTON3)->EnableWindow(IsHasRights2new(12));
  94. GetDlgItem(IDC_BUTshowphoto)->EnableWindow(IsHasRights2new(15));
  95. // Here we create the outbar control using the splitter as its parent
  96. // and setting its id to the first pane.
  97. CRect rc2;
  98. GetWindowRect(rc2);
  99. ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
  100. EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
  101. if(g_bAllBranch==0)
  102. {
  103. int idarray[]={IDC_BUTexportphoto,IDC_BUTimportphoto,IDC_BUTimportphoto2,IDC_BUTimportphoto3,IDC_BUTshowphoto,IDC_BUTTON3,IDC_BUTclose};
  104. int idcount=7;
  105. int btnwid;
  106. CRect prerc;
  107. for(int a=idcount-2; a>=0; a--)
  108. {
  109. GetDlgItem(idarray[a+1])->GetWindowRect (prerc);
  110. ScreenToClient(prerc);
  111. GetDlgItem(idarray[a])->GetWindowRect (rc2);
  112. ScreenToClient(rc2);
  113. btnwid=rc2.Width ();
  114. rc2.right =prerc.left ;
  115. rc2.left =rc2.right -btnwid;
  116. GetDlgItem(idarray[a])->MoveWindow (rc2);
  117. }
  118. }
  119. else
  120. {
  121. GetDlgItem(IDC_BUTshowphoto)->ShowWindow (0);
  122. GetDlgItem(IDC_BUTprint3)->ShowWindow (1);
  123. int idarray[]={IDC_BUTprint3,IDC_BUTexportphoto,IDC_BUTimportphoto,IDC_BUTimportphoto2,IDC_BUTimportphoto3,IDC_BUTTON3,IDC_BUTclose};
  124. int idcount=7;
  125. int btnwid;
  126. CRect prerc;
  127. for(int a=idcount-2; a>=0; a--)
  128. {
  129. GetDlgItem(idarray[a+1])->GetWindowRect (prerc);
  130. ScreenToClient(prerc);
  131. GetDlgItem(idarray[a])->GetWindowRect (rc2);
  132. ScreenToClient(rc2);
  133. btnwid=rc2.Width ();
  134. rc2.right =prerc.left ;
  135. rc2.left =rc2.right -btnwid;
  136. GetDlgItem(idarray[a])->MoveWindow (rc2);
  137. }
  138. }
  139. m_static1.SetFont (&g_titlefont);
  140. if(g_bAllBranch==0)
  141. {
  142. #ifdef CHILD_VERSION
  143. m_List1.SetHeadings("订单号,100;家长姓名,100;宝宝姓名,100;精修,100;设计,100;设计日期,100;看设计,100;看设计日期,100;加急,100;取件日期,100;看设计要求,100;接单人,100;看设计人,100;设计师,100;套系名称,100;套系价格,100;手机,100;固定电话,100" );
  144. #else
  145. m_List1.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;精修,100;设计,100;设计日期,100;看设计,100;看设计日期,100;加急,100;取件日期,100;看设计要求,100;接单人,100;看设计人,100;设计师,100;套系名称,100;套系价格,100;男宾电话,100;女宾电话,100" );
  146. #endif
  147. m_List1.LoadColumnInfo (119);
  148. }
  149. else
  150. {
  151. #ifdef CHILD_VERSION
  152. m_List1.SetHeadings("店名,100;订单号,100;家长姓名,100;宝宝姓名,100;精修,100;设计,100;设计日期,100;看设计,100;看设计日期,100;加急,100;取件日期,100;看设计要求,100;接单人,100;看设计人,100;设计师,100;套系名称,100;套系价格,100;手机,100;固定电话,100" );
  153. #else
  154. m_List1.SetHeadings("店名,100;订单号,100;男宾姓名,100;女宾姓名,100;精修,100;设计,100;设计日期,100;看设计,100;看设计日期,100;加急,100;取件日期,100;看设计要求,100;接单人,100;看设计人,100;设计师,100;套系名称,100;套系价格,100;男宾电话,100;女宾电话,100" );
  155. #endif
  156. m_List1.LoadColumnInfo (199);
  157. }
  158. GetData();
  159. m_combo1.AddString (g_user.name);
  160. m_combo1.GetWindowRect (rc2);
  161. ScreenToClient(rc2);
  162. rc2.bottom +=200;
  163. m_combo1.MoveWindow (rc2);
  164. GetDlgItem(IDC_BUTclose)->GetWindowRect(rc2);
  165. SetComboHei(&m_combo1, rc2.Height ());
  166. GetDlgItem(IDC_BUTexportphoto)->EnableWindow(IsHasRights2new(11));
  167. }
  168. void DesignFrom::FillGrid(BOOL bStatus)
  169. {
  170. if(g_bSearchFilter)
  171. {
  172. m_List1.DeleteAllItems2 ();
  173. int ii=0;
  174. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  175. int count=0;
  176. {
  177. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  178. {
  179. if(g_filterdate1!="")
  180. {
  181. if(m_List1array.ElementAt (ii).ElementAt (5+m_nAdd)<g_filterdate1 || m_List1array.ElementAt (ii).ElementAt (5+m_nAdd)>g_filterdate2)
  182. continue;
  183. }
  184. if(g_waiter1!="")
  185. {
  186. if(m_List1array.ElementAt (ii).ElementAt (13+m_nAdd)!=g_waiter1)
  187. continue;
  188. }
  189. if(g_bAllBranch && g_filterbranch!="")
  190. {
  191. if(m_List1array.ElementAt (ii).ElementAt (0)!= g_filterbranch)
  192. continue;
  193. }
  194. if(1)
  195. {
  196. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  197. }
  198. }
  199. }
  200. m_List1.m_arLabels.SetSize(count, 1);
  201. ii=count;
  202. m_List1.m_LabelCount=ii;
  203. m_List1.SetItemCountEx (ii);
  204. CString str;
  205. str.Format ("单数:%d", ii);
  206. SetDlgItemText(IDC_STATIC2, str);
  207. }
  208. else
  209. {
  210. m_List1.DeleteAllItems2 ();
  211. int ii=0;
  212. m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 );
  213. int count=0;
  214. if(m_filter.IsEmpty ())
  215. {
  216. if(bStatus)
  217. {
  218. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  219. {
  220. if(m_List1array.ElementAt (ii).ElementAt (3+m_nAdd)=="OK"&&m_List1array.ElementAt (ii).ElementAt (4+m_nAdd)!="OK")
  221. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  222. }
  223. }
  224. else
  225. {
  226. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  227. {
  228. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  229. }
  230. }
  231. }
  232. else
  233. {
  234. if(bStatus)
  235. {
  236. int type=GetType(m_filter);
  237. if(type==1)//电话
  238. {
  239. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  240. {
  241. if( m_List1array.ElementAt (ii).ElementAt (3+m_nAdd)=="OK"&&m_List1array.ElementAt (ii).ElementAt (4+m_nAdd)!="OK"&&(m_List1array.ElementAt (ii).ElementAt (16+m_nAdd).Find (m_filter)!=-1 || \
  242. m_List1array.ElementAt (ii).ElementAt (17+m_nAdd).Find (m_filter)!=-1))
  243. {
  244. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  245. }
  246. }
  247. }
  248. else if(type==2)//拼音
  249. {
  250. m_filter.MakeUpper ();
  251. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  252. {
  253. if( m_List1array.ElementAt (ii).ElementAt (3+m_nAdd)=="OK"&&m_List1array.ElementAt (ii).ElementAt (4+m_nAdd)!="OK"&&(m_List1array.ElementAt (ii).ElementAt (18+m_nAdd).Find (m_filter)!=-1 || \
  254. m_List1array.ElementAt (ii).ElementAt (19+m_nAdd).Find (m_filter)!=-1))
  255. {
  256. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  257. }
  258. }
  259. }
  260. else
  261. {
  262. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  263. {
  264. if( m_List1array.ElementAt (ii).ElementAt (3+m_nAdd)=="OK"&&m_List1array.ElementAt (ii).ElementAt (4+m_nAdd)!="OK"&&(m_List1array.ElementAt (ii).ElementAt (0).Find (m_filter)!=-1 ||\
  265. m_List1array.ElementAt (ii).ElementAt (1).Find (m_filter)!=-1 || \
  266. m_List1array.ElementAt (ii).ElementAt (2).Find (m_filter)!=-1 || \
  267. m_List1array.ElementAt (ii).ElementAt (3).Find (m_filter)!=-1 || \
  268. m_List1array.ElementAt (ii).ElementAt (11).Find (m_filter)!=-1|| \
  269. m_List1array.ElementAt (ii).ElementAt (12).Find (m_filter)!=-1 || \
  270. m_List1array.ElementAt (ii).ElementAt (13).Find (m_filter)!=-1 || \
  271. m_List1array.ElementAt (ii).ElementAt (14).Find (m_filter)!=-1 || \
  272. m_List1array.ElementAt (ii).ElementAt (15).Find (m_filter)!=-1 || \
  273. m_List1array.ElementAt (ii).ElementAt (16).Find (m_filter)!=-1 || \
  274. m_List1array.ElementAt (ii).ElementAt (17).Find (m_filter)!=-1 || \
  275. m_List1array.ElementAt (ii).ElementAt (18).Find (m_filter)!=-1 ))
  276. {
  277. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  278. }
  279. }
  280. }
  281. }
  282. else
  283. {
  284. int type=GetType(m_filter);
  285. if(type==1)//电话
  286. {
  287. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  288. {
  289. if(m_List1array.ElementAt (ii).ElementAt (16+m_nAdd).Find (m_filter)!=-1 || \
  290. m_List1array.ElementAt (ii).ElementAt (17+m_nAdd).Find (m_filter)!=-1)
  291. {
  292. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  293. }
  294. }
  295. }
  296. else if(type==2)//拼音
  297. {
  298. m_filter.MakeUpper ();
  299. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  300. {
  301. if(m_List1array.ElementAt (ii).ElementAt (18+m_nAdd).Find (m_filter)!=-1 || \
  302. m_List1array.ElementAt (ii).ElementAt (19+m_nAdd).Find (m_filter)!=-1)
  303. {
  304. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  305. }
  306. }
  307. }
  308. else
  309. {
  310. for(ii=0; ii<m_List1.m_arLabels.GetSize (); ii++)
  311. {
  312. if(m_List1array.ElementAt (ii).ElementAt (0).Find (m_filter)!=-1 ||\
  313. m_List1array.ElementAt (ii).ElementAt (1).Find (m_filter)!=-1 || \
  314. m_List1array.ElementAt (ii).ElementAt (2).Find (m_filter)!=-1 || \
  315. m_List1array.ElementAt (ii).ElementAt (3).Find (m_filter)!=-1 || \
  316. m_List1array.ElementAt (ii).ElementAt (11).Find (m_filter)!=-1|| \
  317. m_List1array.ElementAt (ii).ElementAt (12).Find (m_filter)!=-1 || \
  318. m_List1array.ElementAt (ii).ElementAt (13).Find (m_filter)!=-1 || \
  319. m_List1array.ElementAt (ii).ElementAt (14).Find (m_filter)!=-1 || \
  320. m_List1array.ElementAt (ii).ElementAt (15).Find (m_filter)!=-1 || \
  321. m_List1array.ElementAt (ii).ElementAt (16).Find (m_filter)!=-1 || \
  322. m_List1array.ElementAt (ii).ElementAt (17).Find (m_filter)!=-1 || \
  323. m_List1array.ElementAt (ii).ElementAt (18).Find (m_filter)!=-1 )
  324. {
  325. m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii));
  326. }
  327. }
  328. }
  329. }
  330. }
  331. m_List1.m_arLabels.SetSize(count, 1);
  332. ii=count;
  333. m_List1.m_LabelCount=ii;
  334. m_List1.SetItemCountEx (ii);
  335. CString str;
  336. str.Format ("单数:%d", ii);
  337. SetDlgItemText(IDC_STATIC2, str);
  338. }
  339. if(!g_id.IsEmpty ())
  340. {
  341. for(int i=0; i<m_List1.GetItemCount (); i++)
  342. {
  343. if(g_id==m_List1.GetItemText (i, 0+m_nAdd))
  344. {
  345. m_List1.SetItemState(i,LVIS_SELECTED|LVIS_FOCUSED,LVIS_SELECTED|LVIS_FOCUSED);
  346. m_List1.EnsureVisible(i,FALSE);
  347. break;
  348. }
  349. }
  350. }
  351. }
  352. void DesignFrom::OnBUTclose()
  353. {
  354. // TODO: Add your control notification handler code here
  355. GetParent()->SendMessage(WM_CLOSE);
  356. }
  357. void DesignFrom::OnSelchangeCombo1()
  358. {
  359. // TODO: Add your control notification handler code here
  360. SetTimer(1, 100, NULL);
  361. }
  362. void DesignFrom::OnTimer(UINT nIDEvent)
  363. {
  364. // TODO: Add your message handler code here and/or call default
  365. KillTimer(nIDEvent);
  366. OnButton1();
  367. }
  368. BOOL DesignFrom::PreTranslateMessage(MSG* pMsg)
  369. {
  370. // TODO: Add your specialized code here and/or call the base class
  371. try
  372. {
  373. if(pMsg->message==WM_KEYDOWN)
  374. {
  375. switch (pMsg->wParam)
  376. {
  377. case VK_RETURN:
  378. OnButton1();
  379. return 1;
  380. case 0x43: // copy
  381. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  382. {
  383. GetFocus()->SendMessage(WM_COPY);
  384. return TRUE;
  385. }
  386. break;
  387. case 0x56: //Ctrl + V:
  388. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  389. {
  390. GetFocus()->SendMessage(WM_PASTE);
  391. return TRUE;
  392. }
  393. break;
  394. case 0x58: // cut
  395. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  396. {
  397. GetFocus()->SendMessage(WM_CUT);
  398. return TRUE;
  399. }
  400. break;
  401. case 0x5A: //undo
  402. case 0x59: //redo
  403. if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
  404. {
  405. GetFocus()->SendMessage(WM_UNDO);
  406. return TRUE;
  407. }
  408. break;
  409. }
  410. }
  411. else if(pMsg->message==WM_LBUTTONDBLCLK)
  412. {
  413. CPoint pt;
  414. CRect rc,rc2;
  415. ::GetCursorPos (&pt);
  416. m_List1.GetWindowRect (rc2);
  417. if(rc2.PtInRect (pt)==0) return MyFormView::PreTranslateMessage(pMsg);
  418. pt.x-=rc2.left ;
  419. pt.y-=rc2.top ;
  420. POSITION pos;
  421. pos=m_List1.GetFirstSelectedItemPosition();
  422. if(pos==NULL)return MyFormView::PreTranslateMessage(pMsg);
  423. int iItem=m_List1.GetNextSelectedItem(pos);
  424. m_List1.GetSubItemRect( iItem, 10+m_nAdd, LVIR_BOUNDS, rc);
  425. if(rc.PtInRect (pt))
  426. {
  427. CClientRequirement dlg;
  428. CString id=m_List1.GetItemText (iItem, 0+m_nAdd);
  429. CString str;
  430. if(g_bAllBranch==0)
  431. {
  432. for(int i=0; i<m_List1arraybak.GetSize (); i++)
  433. {
  434. if(m_List1arraybak.ElementAt (i).ElementAt (0+m_nAdd)==id)
  435. {
  436. str=m_List1arraybak.ElementAt (i).ElementAt (10+m_nAdd);
  437. break;
  438. }
  439. }
  440. }
  441. else
  442. {
  443. CString branch=m_List1.GetItemText (iItem, 0);
  444. for(int i=0; i<m_List1arraybak.GetSize (); i++)
  445. {
  446. if(m_List1arraybak.ElementAt (i).ElementAt (0+m_nAdd)==id && branch==m_List1array.ElementAt (i).ElementAt (0))
  447. {
  448. str=m_List1arraybak.ElementAt (i).ElementAt (10+m_nAdd);
  449. break;
  450. }
  451. }
  452. }
  453. dlg.m_bz2=str;
  454. dlg.m_bSave =0;
  455. dlg.DoModal ();
  456. }
  457. }
  458. return MyFormView::PreTranslateMessage(pMsg);
  459. }
  460. catch(...)
  461. {
  462. }
  463. }
  464. extern int CALLBACK BrowseProc(HWND hwnd, UINT msg, LPARAM lParam, LPARAM lpData);
  465. /*{
  466. switch(msg)
  467. {
  468. case BFFM_INITIALIZED:
  469. SendMessage(hwnd, BFFM_SETSELECTION, TRUE, NULL);
  470. break;
  471. case BFFM_SELCHANGED:
  472. {
  473. char szFileName[MAX_PATH];
  474. LPITEMIDLIST pidlCurrent = (LPITEMIDLIST)lParam;
  475. SHGetPathFromIDList(pidlCurrent, szFileName);
  476. SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)szFileName);
  477. }
  478. break;
  479. }
  480. return 0;
  481. }*/
  482. void DesignFrom::GetSavePath(CString &path)
  483. {
  484. char lpszDisplayName[MAX_PATH], szFileName[MAX_PATH];
  485. LPITEMIDLIST pidlDesktop, pidlCurrent;
  486. if(SHGetSpecialFolderLocation(NULL,CSIDL_DESKTOP,&pidlDesktop) == NOERROR)
  487. {
  488. BROWSEINFO bi;
  489. bi.hwndOwner = this->m_hWnd;
  490. bi.pidlRoot = pidlDesktop;
  491. bi.pszDisplayName = lpszDisplayName;
  492. bi.lpszTitle = "\n文档保存的目录:";
  493. bi.ulFlags = BIF_STATUSTEXT&BIF_RETURNONLYFSDIRS ;
  494. bi.lpfn = BrowseProc;
  495. bi.lParam = 0;
  496. bi.iImage = 0;
  497. pidlCurrent = SHBrowseForFolder(&bi);
  498. SHGetPathFromIDList(pidlCurrent, szFileName);
  499. path = szFileName;
  500. }
  501. }
  502. int DesignFrom::FindArray(CStringArray *pArray, CString Str)
  503. {
  504. for(int i=0; i<pArray->GetSize (); i++)
  505. {
  506. if(pArray->ElementAt (i)==Str)
  507. return i;
  508. }
  509. return -1;
  510. }
  511. void DesignFrom::GetNo(CString str, CStringArray &array)
  512. {
  513. if(!str.IsEmpty ())
  514. {
  515. int pos=str.Find (",");
  516. while(pos!=-1)
  517. {
  518. if(FindArray(&array, str.Left (pos))==-1)
  519. array.Add (str.Left (pos));
  520. str=str.Right (str.GetLength ()-pos-1);
  521. pos=str.Find (",");
  522. }
  523. if(FindArray(&array, str)==-1)
  524. array.Add(str);
  525. }
  526. }
  527. CString DesignFrom::GetSelName(CString name, CArray<CStringArray, CStringArray>&spnamearray)
  528. {
  529. CString ret;
  530. name=","+name+",";
  531. CString str;
  532. for(int i=0; i<spnamearray.GetSize (); i++)
  533. {
  534. str=","+spnamearray.ElementAt (i).ElementAt (6)+",";
  535. if(str.Find (name)!=-1)
  536. {
  537. ret+=spnamearray.ElementAt (i).ElementAt (5);
  538. ret+=";";
  539. }
  540. }
  541. ret.TrimRight (";");
  542. ret.Replace ("*", "x");
  543. return ret;
  544. }
  545. CString DesignFrom::GetSelName2(CString name, CArray<CStringArray, CStringArray>&spnamearray)
  546. {
  547. CString ret;
  548. name=","+name+",";
  549. CString str;
  550. for(int i=0; i<spnamearray.GetSize (); i++)
  551. {
  552. str=","+spnamearray.ElementAt (i).ElementAt (8)+",";
  553. if(str.Find (name)!=-1)
  554. {
  555. ret+=spnamearray.ElementAt (i).ElementAt (5);
  556. ret+=";";
  557. }
  558. }
  559. ret.TrimRight (";");
  560. ret.Replace ("*", "x");
  561. return ret;
  562. }
  563. void DesignFrom::OnBUTexportphoto()
  564. {
  565. if(IsHasRights2new(11)==0)return;
  566. // TODO: Add your control notification handler code here
  567. POSITION pos;
  568. pos=m_List1.GetFirstSelectedItemPosition();
  569. if(pos==NULL)
  570. {
  571. AfxMessageBox("请先选中您要导出片的定单!", MB_ICONINFORMATION);
  572. return;
  573. }
  574. int iItem=m_List1.GetNextSelectedItem(pos);
  575. CString id=m_List1.GetItemText (iItem, 0+m_nAdd);
  576. CString branch;
  577. if(g_bAllBranch)
  578. branch=m_List1.GetItemText (iItem, 0);
  579. CString path;
  580. if(g_bAllBranch)
  581. {
  582. CString branchpath=GetBranchPhotoPath(branch);
  583. path=g_path4+branchpath+"\\";
  584. }
  585. else
  586. path=g_path4+"\\";
  587. path+=id;
  588. path +="\\";
  589. CStringArray array;
  590. CString dir;
  591. GetSavePath(dir);
  592. if(dir.IsEmpty())
  593. {
  594. return;
  595. }
  596. CString name1=m_List1.GetItemText (iItem, 1+m_nAdd);
  597. CString name2=m_List1.GetItemText (iItem, 2+m_nAdd);
  598. dir.TrimRight ('\\');
  599. dir+="\\";
  600. dir+=id;
  601. dir+=g_branchname;
  602. if(g_bAllBranch)
  603. {
  604. if(GetBranchPhotoPath(branch)!="")
  605. dir+=branch;
  606. }
  607. dir+=name1;
  608. dir+=name2;
  609. dir+="精修好的片";
  610. dir+="\\";
  611. ::CreateDirectory (dir, NULL);
  612. CStringArray desarray;
  613. CStringArray dirarray;
  614. CString savepath=dir;
  615. CString str;
  616. if(1)
  617. {
  618. using namespace helper_coffs;
  619. ffsco o;
  620. o.dirs(1);
  621. o.find(LPCSTR(path), LPCSTR("*.*"));
  622. ffsco::typeT coo;
  623. ffsco::typeT::iterator it;
  624. coo = o.co_dir();
  625. for (it = coo.begin();
  626. coo.end() != it;
  627. it ++)
  628. {
  629. str=(*it).c_str();
  630. if(FindArray(&dirarray, str)==-1)
  631. {
  632. dirarray.Add (str);
  633. if(str!=dirarray.ElementAt (0))
  634. {
  635. str=savepath+str.Right (str.GetLength ()-dirarray.ElementAt (0).GetLength ());
  636. if(::CheckFolderFileExist (str)==0)
  637. ::CreateDirectory (str, NULL);
  638. }
  639. }
  640. }
  641. }
  642. if(1)
  643. {
  644. for(int i=0; i<dirarray.GetSize (); i++)
  645. {
  646. using namespace helper_coffs;
  647. ffsco o;
  648. o.dirs(0);
  649. o.find(LPCSTR(dirarray.ElementAt (i)), LPCSTR("*.jpg"));
  650. ffsco::typeT coo;
  651. ffsco::typeT::iterator it;
  652. coo = o.co_file();
  653. for (it = coo.begin();
  654. coo.end() != it;
  655. it ++)
  656. {
  657. str=(*it).c_str();
  658. if(str.GetAt (str.ReverseFind ('\\')+1)=='s')continue;
  659. if(str.GetAt (str.ReverseFind ('\\')+1)=='m')continue;
  660. array.Add (str);
  661. desarray.Add (savepath+dirarray.ElementAt (i).Right (dirarray.ElementAt (i).GetLength ()-dirarray.ElementAt (0).GetLength ())+str.Right (str.GetLength ()-str.ReverseFind ('\\')-1));
  662. }
  663. }
  664. }
  665. if(array.GetSize ()==0)
  666. {
  667. AfxMessageBox("此单未导片!", MB_ICONINFORMATION);
  668. return;
  669. }
  670. CCompressOption comoptdlg;
  671. comoptdlg.DoModal ();
  672. ImportPhoto dlg;
  673. dlg.m_nOutputSize=comoptdlg.m_nsize;
  674. dlg.m_mode =1;
  675. dlg.m_pArray=&array;
  676. dlg.m_pDesArray=&desarray;
  677. dlg.m_savepath =dir;
  678. dlg.DoModal ();
  679. AfxMessageBox("导片成功!", MB_ICONINFORMATION);
  680. // CString str;
  681. str=" 导出精修片 ";
  682. str+="客人:";
  683. str+=name1+name2+id;
  684. WriteLog(str);
  685. {
  686. ShowCut dlg;
  687. dlg.m_branch=branch;
  688. dlg.m_mode=1;
  689. dlg.m_id =id;
  690. dlg.DoModal ();
  691. }
  692. }
  693. void DesignFrom::OnBUTimportphoto()
  694. {
  695. // TODO: Add your control notification handler code here
  696. POSITION pos;
  697. pos=m_List1.GetFirstSelectedItemPosition();
  698. if(pos==NULL)
  699. {
  700. AfxMessageBox("请先选中您要导片的定单!", MB_ICONINFORMATION);
  701. return;
  702. }
  703. int iItem=m_List1.GetNextSelectedItem(pos);
  704. CString branch;
  705. CString id=m_List1.GetItemText (iItem, 0+m_nAdd);
  706. if(g_bAllBranch)
  707. branch=m_List1.GetItemText (iItem, 0);
  708. CString oldstatus=m_List1.GetItemText (iItem, 4+m_nAdd);
  709. CString time10=m_List1.GetItemText (iItem, 5+m_nAdd);
  710. CString name=m_List1.GetItemText (iItem, 1+m_nAdd)+","+m_List1.GetItemText (iItem, 2+m_nAdd);
  711. name.TrimLeft (",");
  712. name.TrimRight (",");
  713. name="客人:"+name;
  714. CString phone=m_List1.GetItemText (iItem, 16+m_nAdd)+","+m_List1.GetItemText (iItem, 17+m_nAdd);
  715. phone.TrimLeft (",");
  716. phone.TrimRight (",");
  717. phone="电话:"+phone;
  718. #ifdef ENTERPRISE_VERSION
  719. if(::CheckFolderFileExist (g_path3)==0)
  720. ::CreateDirectory (g_path3, NULL);
  721. #endif
  722. if(!::CheckFolderFileExist (g_path3))
  723. {
  724. AfxMessageBox("设计片保存机器目录未设置, 请通知系统管理员!", MB_ICONINFORMATION);
  725. return;
  726. }
  727. CString savepath;
  728. if(g_bAllBranch)
  729. {
  730. CString branchpath=GetBranchPhotoPath(branch);
  731. savepath=g_path3+branchpath+"\\";
  732. if(::CheckFolderFileExist (savepath)==0)
  733. ::CreateDirectory (savepath, NULL);
  734. }
  735. else
  736. savepath=g_path3+"\\";
  737. savepath+=id+"\\";
  738. if(::CheckFolderFileExist (savepath)==0)
  739. ::CreateDirectory (savepath, NULL);
  740. /* IsGrowthTx growthtxdlg;
  741. growthtxdlg.m_id=id;
  742. growthtxdlg.DoModal ();
  743. if(growthtxdlg.m_bReturnOK==0)
  744. return;
  745. if(growthtxdlg.m_bGrowthTx && growthtxdlg.m_seltxname.IsEmpty ())
  746. return;
  747. if(!growthtxdlg.m_seltxname.IsEmpty ())
  748. {
  749. savepath+=growthtxdlg.m_seltxname+"\\";
  750. if(::CheckFolderFileExist (savepath)==0)
  751. ::CreateDirectory (savepath, NULL);
  752. }*/
  753. CString srcdir;CString str;
  754. GetSavePath(srcdir);
  755. if(srcdir.IsEmpty())
  756. {
  757. CString status5;
  758. if(AfxMessageBox("客照是否全部设计完毕?", MB_YESNO|MB_ICONINFORMATION)==IDYES)
  759. status5="OK";
  760. else
  761. status5="设计中";
  762. CString sql;
  763. if(time10.IsEmpty ())
  764. sql="update dindan set status5='"+status5+"',time10='"+g_date+"' where id='"+id+"'";
  765. else
  766. sql="update dindan set status5='"+status5+"' where id='"+id+"'";
  767. g_sendhead.bsql=1;
  768. if(g_bAllBranch)
  769. {
  770. g_branchip=GetIP(branch);
  771. g_pMainWnd->OnDisconnect();
  772. g_branchname=branch;
  773. g_bBranchModify=1;
  774. g_pMainWnd->ProcessChatMessageRequest2(sql);
  775. g_pMainWnd->OnDisconnect();g_bBranchModify=0;g_branchip=g_branchname="";
  776. }
  777. else
  778. g_pMainWnd->ProcessChatMessageRequest2(sql);
  779. if(g_bSendOK==0)return;
  780. if(g_bAllBranch==0)
  781. {
  782. GetData();
  783. }
  784. else
  785. {
  786. for(int i=0; i<m_List1array.GetSize (); i++)
  787. {
  788. if(id==m_List1array.ElementAt (i).ElementAt (1) && branch==m_List1array.ElementAt (i).ElementAt (0))
  789. {
  790. m_List1array.ElementAt (i).SetAt (4+m_nAdd, status5);
  791. if(time10.IsEmpty ())
  792. m_List1array.ElementAt (i).SetAt (5+m_nAdd, g_date);
  793. FillGrid();
  794. break;
  795. }
  796. }
  797. }
  798. return;
  799. }
  800. if(srcdir.GetLength ()<4)
  801. {
  802. AfxMessageBox("请选择正确的您文件所在的目录!", MB_ICONSTOP);
  803. return;
  804. }
  805. if(oldstatus!="未设计")
  806. {
  807. CString str;
  808. str.Format ("%s\r\n%s\r\n此单已导入过设计片, 确认您选中的照片没有导入过吗? 否则会覆盖原来的照片, 是否继续?", name, phone );
  809. if(AfxMessageBox(str, MB_YESNO|MB_ICONSTOP)!=IDYES)
  810. return;
  811. }
  812. else
  813. {
  814. CString str;
  815. str.Format ("%s\r\n%s\r\n确认您选中的照片与客户资料相符吗? 是否继续?", name, phone );
  816. if(AfxMessageBox(str, MB_YESNO|MB_ICONINFORMATION)!=IDYES)
  817. return;
  818. }
  819. CStringArray array;
  820. CStringArray desarray;
  821. CStringArray dirarray;
  822. if(1)
  823. {
  824. using namespace helper_coffs;
  825. ffsco o;
  826. o.dirs(1);
  827. o.find(LPCSTR(srcdir), LPCSTR("*.*"));
  828. ffsco::typeT coo;
  829. ffsco::typeT::iterator it;
  830. coo = o.co_dir();
  831. for (it = coo.begin();
  832. coo.end() != it;
  833. it ++)
  834. {
  835. str=(*it).c_str();
  836. if(FindArray(&dirarray, str)==-1)
  837. {
  838. dirarray.Add (str);
  839. if(str!=dirarray.ElementAt (0))
  840. {
  841. str=savepath+str.Right (str.GetLength ()-dirarray.ElementAt (0).GetLength ());
  842. if(::CheckFolderFileExist (str)==0)
  843. ::CreateDirectory (str, NULL);
  844. }
  845. }
  846. }
  847. }
  848. if(1)
  849. {
  850. for(int i=0; i<dirarray.GetSize (); i++)
  851. {
  852. using namespace helper_coffs;
  853. ffsco o;
  854. o.dirs(0);
  855. o.find(LPCSTR(dirarray.ElementAt (i)), LPCSTR("*.jpg"));
  856. ffsco::typeT coo;
  857. ffsco::typeT::iterator it;
  858. coo = o.co_file();
  859. for (it = coo.begin();
  860. coo.end() != it;
  861. it ++)
  862. {
  863. str=(*it).c_str();
  864. array.Add (str);
  865. desarray.Add (savepath+dirarray.ElementAt (i).Right (dirarray.ElementAt (i).GetLength ()-dirarray.ElementAt (0).GetLength ())+str.Right (str.GetLength ()-str.ReverseFind ('\\')-1));
  866. }
  867. }
  868. }
  869. if(array.GetSize ()==0)return;
  870. ImportPhoto dlg;
  871. dlg.m_branch=branch;
  872. dlg.m_nphototype=3;
  873. dlg.m_pArray=&array;
  874. dlg.m_pDesArray=&desarray;
  875. dlg.m_savepath =savepath;
  876. #ifdef ENTERPRISE_VERSION
  877. // if(!g_branchname.IsEmpty ())
  878. {
  879. dlg.m_bSaveUploadTask=g_bSaveUploadTask4;
  880. dlg.m_sel=g_cominfoarraylocal.ElementAt(0).ElementAt(81);
  881. dlg.m_uploadtaskarray .Add (id+";"+name);
  882. dlg.m_uploadtaskarray .Add ("");
  883. dlg.m_uploadtaskarray .Add ("");
  884. dlg.m_uploadtaskarray .Add ("");
  885. dlg.m_uploadtaskarray .Add ("");
  886. dlg.m_uploadtaskarray .Add ("");
  887. dlg.m_uploadtaskarray .Add ("");
  888. dlg.m_uploadtaskarray .Add ("");
  889. dlg.m_uploadtaskarray .Add ("");
  890. dlg.m_uploadtaskarray .Add ("");
  891. }
  892. #endif
  893. dlg.DoModal ();
  894. CString status5;
  895. if(AfxMessageBox("客照是否全部设计完毕?", MB_YESNO|MB_ICONINFORMATION)==IDYES)
  896. status5="OK";
  897. else
  898. status5="设计中";
  899. CString sql;
  900. if(time10.IsEmpty ())
  901. sql="update dindan set status5='"+status5+"',waiter4='"+g_user.name+"',time10='"+g_date+"' where id='"+id+"'";
  902. else
  903. sql="update dindan set status5='"+status5+"',waiter4='"+g_user.name+"' where id='"+id+"'";
  904. g_sendhead.bsql=1;
  905. if(g_bAllBranch)
  906. {
  907. g_branchip=GetIP(branch);
  908. g_pMainWnd->OnDisconnect();
  909. g_branchname=branch;
  910. g_bBranchModify=1;
  911. g_pMainWnd->ProcessChatMessageRequest2(sql);
  912. g_pMainWnd->OnDisconnect();g_bBranchModify=0;g_branchip=g_branchname="";
  913. }
  914. else
  915. g_pMainWnd->ProcessChatMessageRequest2(sql);
  916. if(g_bSendOK==0)return;
  917. savepath+="ok";
  918. ::DeleteFile (savepath);
  919. AfxMessageBox("导入客照成功!", MB_ICONINFORMATION);
  920. if(g_bAllBranch==0)
  921. {
  922. GetData();
  923. }
  924. else
  925. {
  926. for(int i=0; i<m_List1array.GetSize (); i++)
  927. {
  928. if(id==m_List1array.ElementAt (i).ElementAt (1) && branch==m_List1array.ElementAt (i).ElementAt (0))
  929. {
  930. m_List1array.ElementAt (i).SetAt (4+m_nAdd, status5);
  931. if(time10.IsEmpty ())
  932. m_List1array.ElementAt (i).SetAt (5+m_nAdd, g_date);
  933. m_List1array.ElementAt (i).SetAt (13+m_nAdd, g_user.name);
  934. FillGrid();
  935. break;
  936. }
  937. }
  938. }
  939. }
  940. // Jeff:选设计版按钮;
  941. void DesignFrom::OnBUTshowphoto() //Jeff:选设计版按钮;
  942. {
  943. // TODO: Add your control notification handler code here
  944. POSITION pos;
  945. pos=m_List1.GetFirstSelectedItemPosition();
  946. if(pos==NULL)
  947. {
  948. AfxMessageBox("请先选中您要查看的定单!", MB_ICONINFORMATION);
  949. return;
  950. }
  951. int iItem=m_List1.GetNextSelectedItem(pos);
  952. CString status=m_List1.GetItemText (iItem, 4);
  953. CString id=m_List1.GetItemText (iItem, 0);
  954. CString status2=m_List1.GetItemText (iItem, 5);
  955. ChoosePhotoSkin2 dlg; // 选设计对话框;
  956. dlg.m_mode2 =1;
  957. dlg.SetLiaPath ("3.lia");
  958. dlg.m_strOrderNumber=id;
  959. dlg.m_path=g_path3+"\\";
  960. dlg.m_path+=id;
  961. dlg.m_path +="\\";
  962. //AfxMessageBox(dlg.m_path);//Jeff Box;
  963. dlg.DoModal ();
  964. g_bInSkin=0;
  965. // printf("Jeff:ChoosePhotoSkin2::m_id=%s\n ChoosePhotoSkin2::m_path=%s\n ChoosePhotoSkin2::m_mode\n\n",dlg.m_id,dlg.m_path,dlg.m_mode);// Jeff Printf;
  966. for(int i=0; i<m_List1array.GetSize(); i++)
  967. {
  968. if(id==m_List1array.ElementAt (i).ElementAt (0))
  969. {
  970. m_List1array.ElementAt (i).SetAt (10, dlg.m_bz3);
  971. m_List1array.ElementAt (i).SetAt (6, dlg.m_status8);
  972. m_List1array.ElementAt (i).SetAt (9, dlg.m_time5);
  973. if(dlg.m_status8!="OK")
  974. m_List1array.ElementAt (i).SetAt (4, "设计中");
  975. else
  976. m_List1array.ElementAt (i).SetAt (4, "OK");
  977. FillGrid();
  978. break;
  979. }
  980. }
  981. }
  982. void DesignFrom::OnButton1()
  983. {
  984. // TODO: Add your control notification handler code here
  985. UpdateData();
  986. m_filter.TrimLeft ();
  987. m_filter.TrimRight ();
  988. FillGrid();
  989. }
  990. void DesignFrom::OnButton2()
  991. {
  992. // TODO: Add your control notification handler code here
  993. UpdateData();
  994. m_filter.TrimLeft ();
  995. m_filter.TrimRight ();
  996. FillGrid(1);
  997. }
  998. void DesignFrom::OnItemchangedList2(NMHDR* pNMHDR, LRESULT* pResult)
  999. {
  1000. NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
  1001. // TODO: Add your control notification handler code here
  1002. POSITION pos;
  1003. pos=m_List1.GetFirstSelectedItemPosition();
  1004. if(pos==NULL)
  1005. {
  1006. return;
  1007. }
  1008. int iItem=m_List1.GetNextSelectedItem(pos);
  1009. // CString waiter4=m_List1.GetItemText (iItem, 11);
  1010. if( IsHasRights2new(7) || IsHasRights2new(49) )
  1011. {
  1012. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(1);
  1013. // GetDlgItem(IDC_BUTimportphoto2)->EnableWindow(1);
  1014. }
  1015. else
  1016. {
  1017. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(0);
  1018. // GetDlgItem(IDC_BUTimportphoto2)->EnableWindow(0);
  1019. }
  1020. /* if(waiter4.IsEmpty () && IsHasRights2new(7) || IsHasRights2new(49) )
  1021. {
  1022. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(1);
  1023. GetDlgItem(IDC_BUTimportphoto2)->EnableWindow(1);
  1024. }
  1025. else if(waiter4==g_user.name && IsHasRights2new(7) )
  1026. {
  1027. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(1);
  1028. GetDlgItem(IDC_BUTimportphoto2)->EnableWindow(1);
  1029. }
  1030. else
  1031. {
  1032. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(0);
  1033. GetDlgItem(IDC_BUTimportphoto2)->EnableWindow(0);
  1034. }*/
  1035. *pResult = 0;
  1036. }
  1037. void DesignFrom::OnBUTimportphoto2()
  1038. {
  1039. // TODO: Add your control notification handler code here
  1040. // TODO: Add your control notification handler code here
  1041. POSITION pos;
  1042. pos=m_List1.GetFirstSelectedItemPosition();
  1043. if(pos==NULL)
  1044. {
  1045. AfxMessageBox("请先选中您要查看的定单!", MB_ICONINFORMATION);
  1046. return;
  1047. }
  1048. int iItem=m_List1.GetNextSelectedItem(pos);
  1049. CString branch;
  1050. CString id=m_List1.GetItemText (iItem, 0+m_nAdd);
  1051. if(g_bAllBranch)
  1052. branch=m_List1.GetItemText (iItem, 0);
  1053. CString name=m_List1.GetItemText (iItem, 1+m_nAdd)+","+m_List1.GetItemText (iItem, 2+m_nAdd);
  1054. name.TrimLeft (",");
  1055. name.TrimRight (",");
  1056. name="客人:"+name;
  1057. ShowPic dlg;
  1058. dlg.m_id=id;
  1059. dlg.m_name=name;
  1060. dlg.m_name2=m_List1.GetItemText (iItem, 1+m_nAdd)+m_List1.GetItemText (iItem, 2+m_nAdd);
  1061. dlg.remark=m_List1.GetItemText (iItem, 10+m_nAdd);
  1062. dlg.m_mode=5;
  1063. if(g_bAllBranch)
  1064. {
  1065. dlg.m_branch=branch;
  1066. CString branchpath=GetBranchPhotoPath(branch);
  1067. dlg.m_path=g_path3+branchpath+"\\";
  1068. }
  1069. else
  1070. dlg.m_path=g_path3+"\\";
  1071. dlg.m_path+=id;
  1072. dlg.m_path +="\\";
  1073. dlg.DoModal ();
  1074. }
  1075. void DesignFrom::OnBUTimportphoto3()
  1076. {
  1077. // TODO: Add your control notification handler code here
  1078. if(IsHasRights2new(12)==0)return;
  1079. // TODO: Add your control notification handler code here
  1080. POSITION pos;
  1081. pos=m_List1.GetFirstSelectedItemPosition();
  1082. if(pos==NULL)
  1083. {
  1084. AfxMessageBox("请先选中您要导出片的定单!", MB_ICONINFORMATION);
  1085. return;
  1086. }
  1087. int iItem=m_List1.GetNextSelectedItem(pos);
  1088. CString id=m_List1.GetItemText (iItem, 0+m_nAdd);
  1089. CString branch;
  1090. if(g_bAllBranch)
  1091. branch=m_List1.GetItemText (iItem, 0);
  1092. CString path;
  1093. if(g_bAllBranch)
  1094. {
  1095. CString branchpath=GetBranchPhotoPath(branch);
  1096. path=g_path3+branchpath+"\\";
  1097. }
  1098. else
  1099. path=g_path3+"\\";
  1100. path+=id;
  1101. path +="\\";
  1102. CStringArray array;
  1103. CString dir;
  1104. GetSavePath(dir);
  1105. if(dir.IsEmpty())
  1106. {
  1107. return;
  1108. }
  1109. CString name1=m_List1.GetItemText (iItem, 1+m_nAdd);
  1110. CString name2=m_List1.GetItemText (iItem, 2+m_nAdd);
  1111. CString remark=m_List1.GetItemText (iItem, 10+m_nAdd);
  1112. dir.TrimRight ('\\');
  1113. dir+="\\";
  1114. dir+=id;
  1115. dir+=g_branchname;
  1116. if(g_bAllBranch)
  1117. {
  1118. if(GetBranchPhotoPath(branch)!="")
  1119. dir+=branch;
  1120. }
  1121. dir+=name1;
  1122. dir+=name2;
  1123. dir+="设计好的片";
  1124. dir+="\\";
  1125. ::CreateDirectory (dir, NULL);
  1126. CStringArray desarray;
  1127. CStringArray dirarray;
  1128. CString savepath=dir;
  1129. CString str;
  1130. if(1)
  1131. {
  1132. using namespace helper_coffs;
  1133. ffsco o;
  1134. o.dirs(1);
  1135. o.find(LPCSTR(path), LPCSTR("*.*"));
  1136. ffsco::typeT coo;
  1137. ffsco::typeT::iterator it;
  1138. coo = o.co_dir();
  1139. for (it = coo.begin(); coo.end() != it;it ++)
  1140. {
  1141. str=(*it).c_str();
  1142. if(FindArray(&dirarray, str)==-1)
  1143. {
  1144. dirarray.Add (str);
  1145. if(str!=dirarray.ElementAt (0))
  1146. {
  1147. str=savepath+str.Right (str.GetLength ()-dirarray.ElementAt (0).GetLength ());
  1148. if(::CheckFolderFileExist (str)==0)
  1149. ::CreateDirectory (str, NULL);
  1150. }
  1151. }
  1152. }
  1153. }
  1154. if(1)
  1155. {
  1156. for(int i=0; i<dirarray.GetSize (); i++)
  1157. {
  1158. using namespace helper_coffs;
  1159. ffsco o;
  1160. o.dirs(0);
  1161. o.find(LPCSTR(dirarray.ElementAt (i)), LPCSTR("*.jpg"));
  1162. ffsco::typeT coo;
  1163. ffsco::typeT::iterator it;
  1164. coo = o.co_file();
  1165. for (it = coo.begin(); coo.end() != it;it ++)
  1166. {
  1167. str=(*it).c_str();
  1168. if(str.GetAt (str.ReverseFind ('\\')+1)=='s')continue;
  1169. if(str.GetAt (str.ReverseFind ('\\')+1)=='m')continue;
  1170. array.Add (str);
  1171. desarray.Add (savepath+dirarray.ElementAt (i).Right (dirarray.ElementAt (i).GetLength ()-dirarray.ElementAt (0).GetLength ())+str.Right (str.GetLength ()-str.ReverseFind ('\\')-1));
  1172. //AfxMessageBox(str);
  1173. //AfxMessageBox (savepath+dirarray.ElementAt (i).Right (dirarray.ElementAt (i).GetLength ()-dirarray.ElementAt (0).GetLength ())+str.Right (str.GetLength ()-str.ReverseFind ('\\')-1));
  1174. }
  1175. }
  1176. }
  1177. if(array.GetSize ()==0)
  1178. {
  1179. AfxMessageBox("此单未导片!", MB_ICONINFORMATION);
  1180. return;
  1181. }
  1182. CStdioFile fp;
  1183. fp.Open (dir+"客户要求.txt", CFile::modeCreate|CFile::modeWrite);
  1184. fp.WriteString (remark);
  1185. fp.Close ();
  1186. CCompressOption comoptdlg;
  1187. comoptdlg.DoModal ();
  1188. ImportPhoto dlg;
  1189. dlg.m_nOutputSize=comoptdlg.m_nsize;
  1190. dlg.m_mode =1;
  1191. dlg.m_pArray=&array;
  1192. dlg.m_pDesArray=&desarray;
  1193. dlg.m_savepath =dir;
  1194. dlg.DoModal ();
  1195. AfxMessageBox("导片成功!", MB_ICONINFORMATION);
  1196. // CString str;
  1197. str=" 导出设计片 ";
  1198. str+="客人:";
  1199. str+=name1+name2+id;
  1200. WriteLog(str);
  1201. }
  1202. void DesignFrom::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
  1203. {
  1204. // TODO: Add your control notification handler code here
  1205. POSITION pos;
  1206. pos=m_List1.GetFirstSelectedItemPosition();
  1207. if(pos==NULL)return;
  1208. int iItem=m_List1.GetNextSelectedItem(pos);
  1209. g_id = m_List1.GetItemText (iItem, 0+m_nAdd);
  1210. *pResult = 0;
  1211. }
  1212. void DesignFrom::OnButton3()
  1213. {
  1214. // TODO: Add your control notification handler code here
  1215. if(IsHasRights2new(12)==0)return;
  1216. // TODO: Add your control notification handler code here
  1217. UpdateData();
  1218. POSITION pos;
  1219. pos=m_List1.GetFirstSelectedItemPosition();
  1220. if(pos==NULL)
  1221. {
  1222. AfxMessageBox("请先选中您要导片的定单!", MB_ICONINFORMATION);
  1223. return;
  1224. }
  1225. int iItem=m_List1.GetNextSelectedItem(pos);
  1226. CString id=m_List1.GetItemText (iItem, 0+m_nAdd);
  1227. CString branch;
  1228. if(g_bAllBranch)
  1229. branch=m_List1.GetItemText (iItem, 0);
  1230. CString name1=m_List1.GetItemText (iItem, 1+m_nAdd);
  1231. CString name2=m_List1.GetItemText (iItem, 2+m_nAdd);
  1232. #ifdef CHILD_VERSION
  1233. CString filter="id='"+id+"';id='"+id+"';id='"+id+"' and name<>'入册' and name<>'入底'";
  1234. #else
  1235. CString filter="id='"+id+"';id='"+id+"';id='"+id+"' and kind<>'2' and name<>'入册' and name<>'入底'";
  1236. #endif
  1237. g_sendhead.bsql=0;
  1238. g_sendhead.code[0]=50;
  1239. g_sendhead.code[1]=11;
  1240. g_sendhead.code[2]=56;
  1241. g_sendhead.tabcount=3;
  1242. if(g_bAllBranch)
  1243. {
  1244. g_branchip=GetIP(branch);
  1245. g_pMainWnd->OnDisconnect();
  1246. g_branchname=branch;
  1247. g_bBranchModify=1;
  1248. g_pMainWnd->ProcessChatMessageRequest2(filter);
  1249. g_pMainWnd->OnDisconnect();g_bBranchModify=0;g_branchip=g_branchname="";
  1250. }
  1251. else
  1252. g_pMainWnd->ProcessChatMessageRequest2(filter);
  1253. if(g_bSendOK==0)return;
  1254. CArray<CStringArray, CStringArray>sparray;
  1255. CArray<CStringArray, CStringArray>sparray2;
  1256. DataToArray( &sparray, &g_List1array, &sparray2);
  1257. CString path;
  1258. if(g_bAllBranch)
  1259. {
  1260. CString branchpath=GetBranchPhotoPath(branch);
  1261. path=g_path3+branchpath+"\\";
  1262. }
  1263. else
  1264. path=g_path3+"\\";
  1265. path+=id;
  1266. path +="\\";
  1267. ////////////////////////////////////////
  1268. CString str,spname;
  1269. CStringArray noarray;
  1270. CStringArray spnamearray;
  1271. int i = 0;
  1272. for( i=0; i<sparray.GetSize (); i++)
  1273. {
  1274. str=sparray.ElementAt (i).ElementAt (8);
  1275. spname=sparray.ElementAt (i).ElementAt (5);
  1276. GetNo(str, noarray);
  1277. }
  1278. if(noarray.GetSize ()==0)
  1279. {
  1280. AfxMessageBox("此单未选设计版!", MB_ICONINFORMATION);
  1281. return;
  1282. }
  1283. spnamearray.SetSize(noarray.GetSize ());
  1284. for( i=0; i<noarray.GetSize (); i++)
  1285. {
  1286. str=noarray.ElementAt (i);
  1287. spnamearray.SetAt (i, GetSelName2(str, sparray));
  1288. }
  1289. CString dir;
  1290. GetSavePath(dir);
  1291. if(dir.IsEmpty())return;
  1292. dir.TrimRight ('\\');
  1293. dir+="\\";
  1294. dir+=id;
  1295. dir+=g_branchname;
  1296. if(g_bAllBranch)
  1297. {
  1298. if(GetBranchPhotoPath(branch)!="")
  1299. dir+=branch;
  1300. }
  1301. dir+=name1;
  1302. dir+=name2;
  1303. dir+="选设计";
  1304. dir+="\\";
  1305. CStringArray array;
  1306. CStringArray spnamearray2;
  1307. CString src,des;
  1308. for(i=0; i<noarray.GetSize (); i++)
  1309. {
  1310. src.Format ("%s%s.jpg", path, noarray.ElementAt (i));
  1311. if(::CheckFileExist (src))
  1312. {
  1313. array.Add (src);
  1314. src=spnamearray.ElementAt (i);
  1315. spnamearray2.Add (spnamearray.ElementAt (i));
  1316. }
  1317. else
  1318. AfxMessageBox("未找到设计版:"+src.Right (src.GetLength ()-src.ReverseFind ('\\')-1), MB_ICONINFORMATION);
  1319. }
  1320. ::CreateDirectory (dir, NULL);
  1321. ImportPhoto dlg;
  1322. dlg.m_mode =1;
  1323. dlg.m_bOrigin =1;
  1324. dlg.m_pArray=&array;
  1325. dlg.m_pArray2=&spnamearray2;
  1326. dlg.m_savepath =dir;
  1327. dlg.DoModal ();
  1328. //////////////
  1329. if(g_List1array.GetSize ())
  1330. {
  1331. CStdioFile fp;
  1332. fp.Open (dir+"客户要求.txt", CFile::modeCreate|CFile::modeWrite);
  1333. fp.WriteString ("选设计要求:\n");
  1334. fp.WriteString (g_List1array.ElementAt (0).ElementAt (57));
  1335. fp.WriteString ("\n");
  1336. fp.WriteString ("\n");
  1337. fp.WriteString ("设计版替换照片:\n");
  1338. CString replace=g_List1array.ElementAt (0).ElementAt (59);
  1339. if(!replace.IsEmpty ())
  1340. {
  1341. replace.Delete (0, 1);
  1342. replace.Replace ("$", "\n");
  1343. }
  1344. fp.WriteString (replace);
  1345. fp.WriteString ("\n");
  1346. fp.WriteString ("\n");
  1347. fp.WriteString ("订单要求:\n");
  1348. fp.WriteString (g_List1array.ElementAt (0).ElementAt (38));
  1349. fp.WriteString ("\n");
  1350. fp.WriteString ("\n");
  1351. fp.WriteString ("客人产品:\n");
  1352. CString str;
  1353. str="产品名称";
  1354. FillLength(str, 20);
  1355. str+="数量";
  1356. FillLength(str, 30);
  1357. str+="加急";
  1358. FillLength(str, 40);
  1359. str+="取件日期";
  1360. FillLength(str, 50);
  1361. fp.WriteString (str); fp.WriteString ("\n");
  1362. for(int i=0; i<sparray2.GetSize (); i++)
  1363. {
  1364. str.Empty ();
  1365. str=sparray2.ElementAt (i).ElementAt (0);
  1366. FillLength(str, 20);
  1367. str+=sparray2.ElementAt (i).ElementAt (1);
  1368. FillLength(str, 30);
  1369. str+=sparray2.ElementAt (i).ElementAt (18);
  1370. FillLength(str, 40);
  1371. str+=sparray2.ElementAt (i).ElementAt (19);
  1372. FillLength(str, 50);
  1373. fp.WriteString (str); fp.WriteString ("\n");
  1374. }
  1375. fp.Close ();
  1376. }
  1377. //////////////
  1378. AfxMessageBox("导片成功!", MB_ICONINFORMATION);
  1379. // CString str;
  1380. str=" 导出选设计片 ";
  1381. str+="客人:";
  1382. str+=name1+name2+id;
  1383. WriteLog(str);
  1384. }
  1385. void DesignFrom::HidePrice()
  1386. {
  1387. #ifdef LKAY_VERSION
  1388. if(IsHasRights2new(31))return;
  1389. for(int i=0; i< m_List1array.GetSize (); i++)
  1390. {
  1391. m_List1array.ElementAt (i).SetAt (14+m_nAdd, "***");
  1392. m_List1array.ElementAt (i).SetAt (15+m_nAdd, "***");
  1393. m_List1array.ElementAt (i).SetAt (16+m_nAdd, "***");
  1394. m_List1array.ElementAt (i).SetAt (17+m_nAdd, "***");
  1395. }
  1396. #else
  1397. if(IsHasRights2new(31))return;
  1398. for(int i=0; i< m_List1array.GetSize (); i++)
  1399. {
  1400. m_List1array.ElementAt (i).SetAt (16+m_nAdd, "***");
  1401. m_List1array.ElementAt (i).SetAt (17+m_nAdd, "***");
  1402. }
  1403. #endif
  1404. }
  1405. void DesignFrom::OnBtnsearchfilter()
  1406. {
  1407. // TODO: Add your control notification handler code here
  1408. SearchFilter dlg;
  1409. dlg.m_mode =4;
  1410. if(dlg.DoModal ()==IDOK)FillGrid();
  1411. g_bSearchFilter=0;
  1412. }
  1413. void DesignFrom::GetData()
  1414. {
  1415. if(g_bAllBranch==0)
  1416. {
  1417. if(g_bShowOK==0)
  1418. {
  1419. #ifdef LKAY_VERSION
  1420. CString filter="status3='未取' and (dindantype<>'意向客户' or dindantype is null)";
  1421. #else
  1422. CString filter="status3='未取'";
  1423. #endif
  1424. g_sendhead.bsql=0;
  1425. g_sendhead.code[0]=31;
  1426. g_sendhead.tabcount=1;
  1427. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  1428. }
  1429. else
  1430. {
  1431. g_sendhead.bsql=0;
  1432. g_sendhead.code[0]=31;
  1433. g_sendhead.tabcount=1;
  1434. #ifdef LKAY_VERSION
  1435. CString filter="dindantype<>'意向客户' or dindantype is null";
  1436. g_pMainWnd->ProcessChatMessageRequest2(filter);
  1437. #else
  1438. g_pMainWnd->ProcessChatMessageRequest2(1);
  1439. #endif
  1440. if(g_bSendOK==0)return;
  1441. }
  1442. DataToArray(&m_List1array);
  1443. }
  1444. else
  1445. {
  1446. //////////////数据汇总
  1447. m_List1array.RemoveAll ();
  1448. CString branch;
  1449. for(int i=-1; i<g_brancharray.GetSize ()-1; i++)
  1450. {
  1451. if(i!=-1)
  1452. {
  1453. branch=g_brancharray.ElementAt (i).ElementAt (0);
  1454. g_branchip=g_brancharray.ElementAt (i).ElementAt (1);
  1455. g_pMainWnd->OnDisconnect();
  1456. g_branchname=branch;
  1457. g_bBranchModify=1;
  1458. }
  1459. else
  1460. branch=g_brancharray.ElementAt (g_brancharray.GetSize ()-1).ElementAt (0);
  1461. if(g_bShowOK==0)
  1462. {
  1463. CString filter="status3='未取'";
  1464. g_sendhead.bsql=0;
  1465. g_sendhead.code[0]=31;
  1466. g_sendhead.tabcount=1;
  1467. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)continue;
  1468. }
  1469. else
  1470. {
  1471. g_sendhead.bsql=0;
  1472. g_sendhead.code[0]=31;
  1473. g_sendhead.tabcount=1;
  1474. g_pMainWnd->ProcessChatMessageRequest2(1);if(g_bSendOK==0)continue;
  1475. }
  1476. CArray<CStringArray, CStringArray>List1array;
  1477. DataToArray(&List1array);
  1478. int size=m_List1array.GetSize ();
  1479. for(int j=0; j<List1array.GetSize (); j++)
  1480. {
  1481. size++;
  1482. m_List1array.SetSize(size , 1 );
  1483. size--;
  1484. m_List1array.ElementAt (size).Copy (List1array.ElementAt (j));
  1485. m_List1array.ElementAt (size).InsertAt (0, branch);
  1486. size++;
  1487. }
  1488. }
  1489. g_pMainWnd->OnDisconnect();
  1490. g_bBranchModify=0;g_branchip=g_branchname="";
  1491. }
  1492. m_List1arraybak.SetSize(m_List1array.GetSize (), 1);
  1493. for(int ii=0; ii<m_List1array.GetSize (); ii++)
  1494. {
  1495. m_List1arraybak.ElementAt (ii).Copy(m_List1array.ElementAt (ii));
  1496. if(m_List1array.ElementAt (ii).ElementAt (10).GetLength ()>256)
  1497. {
  1498. m_List1array.ElementAt (ii).SetAt (10, m_List1array.ElementAt (ii).ElementAt (10).Left (256)+"...");
  1499. }
  1500. }
  1501. HidePrice();
  1502. FillGrid();
  1503. }
  1504. void DesignFrom::OnBUTprint3()
  1505. {
  1506. // TODO: Add your control notification handler code here
  1507. GetData();
  1508. }