DesignFrom.cpp 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645
  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. for(int i=0; i<sparray.GetSize (); i++)
  1272. {
  1273. str=sparray.ElementAt (i).ElementAt (8);
  1274. spname=sparray.ElementAt (i).ElementAt (5);
  1275. GetNo(str, noarray);
  1276. }
  1277. if(noarray.GetSize ()==0)
  1278. {
  1279. AfxMessageBox("此单未选设计版!", MB_ICONINFORMATION);
  1280. return;
  1281. }
  1282. spnamearray.SetSize(noarray.GetSize ());
  1283. for( i=0; i<noarray.GetSize (); i++)
  1284. {
  1285. str=noarray.ElementAt (i);
  1286. spnamearray.SetAt (i, GetSelName2(str, sparray));
  1287. }
  1288. CString dir;
  1289. GetSavePath(dir);
  1290. if(dir.IsEmpty())return;
  1291. dir.TrimRight ('\\');
  1292. dir+="\\";
  1293. dir+=id;
  1294. dir+=g_branchname;
  1295. if(g_bAllBranch)
  1296. {
  1297. if(GetBranchPhotoPath(branch)!="")
  1298. dir+=branch;
  1299. }
  1300. dir+=name1;
  1301. dir+=name2;
  1302. dir+="选设计";
  1303. dir+="\\";
  1304. CStringArray array;
  1305. CStringArray spnamearray2;
  1306. CString src,des;
  1307. for(i=0; i<noarray.GetSize (); i++)
  1308. {
  1309. src.Format ("%s%s.jpg", path, noarray.ElementAt (i));
  1310. if(::CheckFileExist (src))
  1311. {
  1312. array.Add (src);
  1313. src=spnamearray.ElementAt (i);
  1314. spnamearray2.Add (spnamearray.ElementAt (i));
  1315. }
  1316. else
  1317. AfxMessageBox("未找到设计版:"+src.Right (src.GetLength ()-src.ReverseFind ('\\')-1), MB_ICONINFORMATION);
  1318. }
  1319. ::CreateDirectory (dir, NULL);
  1320. ImportPhoto dlg;
  1321. dlg.m_mode =1;
  1322. dlg.m_bOrigin =1;
  1323. dlg.m_pArray=&array;
  1324. dlg.m_pArray2=&spnamearray2;
  1325. dlg.m_savepath =dir;
  1326. dlg.DoModal ();
  1327. //////////////
  1328. if(g_List1array.GetSize ())
  1329. {
  1330. CStdioFile fp;
  1331. fp.Open (dir+"客户要求.txt", CFile::modeCreate|CFile::modeWrite);
  1332. fp.WriteString ("选设计要求:\n");
  1333. fp.WriteString (g_List1array.ElementAt (0).ElementAt (57));
  1334. fp.WriteString ("\n");
  1335. fp.WriteString ("\n");
  1336. fp.WriteString ("设计版替换照片:\n");
  1337. CString replace=g_List1array.ElementAt (0).ElementAt (59);
  1338. if(!replace.IsEmpty ())
  1339. {
  1340. replace.Delete (0, 1);
  1341. replace.Replace ("$", "\n");
  1342. }
  1343. fp.WriteString (replace);
  1344. fp.WriteString ("\n");
  1345. fp.WriteString ("\n");
  1346. fp.WriteString ("订单要求:\n");
  1347. fp.WriteString (g_List1array.ElementAt (0).ElementAt (38));
  1348. fp.WriteString ("\n");
  1349. fp.WriteString ("\n");
  1350. fp.WriteString ("客人产品:\n");
  1351. CString str;
  1352. str="产品名称";
  1353. FillLength(str, 20);
  1354. str+="数量";
  1355. FillLength(str, 30);
  1356. str+="加急";
  1357. FillLength(str, 40);
  1358. str+="取件日期";
  1359. FillLength(str, 50);
  1360. fp.WriteString (str); fp.WriteString ("\n");
  1361. for(int i=0; i<sparray2.GetSize (); i++)
  1362. {
  1363. str.Empty ();
  1364. str=sparray2.ElementAt (i).ElementAt (0);
  1365. FillLength(str, 20);
  1366. str+=sparray2.ElementAt (i).ElementAt (1);
  1367. FillLength(str, 30);
  1368. str+=sparray2.ElementAt (i).ElementAt (18);
  1369. FillLength(str, 40);
  1370. str+=sparray2.ElementAt (i).ElementAt (19);
  1371. FillLength(str, 50);
  1372. fp.WriteString (str); fp.WriteString ("\n");
  1373. }
  1374. fp.Close ();
  1375. }
  1376. //////////////
  1377. AfxMessageBox("导片成功!", MB_ICONINFORMATION);
  1378. // CString str;
  1379. str=" 导出选设计片 ";
  1380. str+="客人:";
  1381. str+=name1+name2+id;
  1382. WriteLog(str);
  1383. }
  1384. void DesignFrom::HidePrice()
  1385. {
  1386. #ifdef LKAY_VERSION
  1387. if(IsHasRights2new(31))return;
  1388. for(int i=0; i< m_List1array.GetSize (); i++)
  1389. {
  1390. m_List1array.ElementAt (i).SetAt (14+m_nAdd, "***");
  1391. m_List1array.ElementAt (i).SetAt (15+m_nAdd, "***");
  1392. m_List1array.ElementAt (i).SetAt (16+m_nAdd, "***");
  1393. m_List1array.ElementAt (i).SetAt (17+m_nAdd, "***");
  1394. }
  1395. #else
  1396. if(IsHasRights2new(31))return;
  1397. for(int i=0; i< m_List1array.GetSize (); i++)
  1398. {
  1399. m_List1array.ElementAt (i).SetAt (16+m_nAdd, "***");
  1400. m_List1array.ElementAt (i).SetAt (17+m_nAdd, "***");
  1401. }
  1402. #endif
  1403. }
  1404. void DesignFrom::OnBtnsearchfilter()
  1405. {
  1406. // TODO: Add your control notification handler code here
  1407. SearchFilter dlg;
  1408. dlg.m_mode =4;
  1409. if(dlg.DoModal ()==IDOK)FillGrid();
  1410. g_bSearchFilter=0;
  1411. }
  1412. void DesignFrom::GetData()
  1413. {
  1414. if(g_bAllBranch==0)
  1415. {
  1416. if(g_bShowOK==0)
  1417. {
  1418. #ifdef LKAY_VERSION
  1419. CString filter="status3='未取' and (dindantype<>'意向客户' or dindantype is null)";
  1420. #else
  1421. CString filter="status3='未取'";
  1422. #endif
  1423. g_sendhead.bsql=0;
  1424. g_sendhead.code[0]=31;
  1425. g_sendhead.tabcount=1;
  1426. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  1427. }
  1428. else
  1429. {
  1430. g_sendhead.bsql=0;
  1431. g_sendhead.code[0]=31;
  1432. g_sendhead.tabcount=1;
  1433. #ifdef LKAY_VERSION
  1434. CString filter="dindantype<>'意向客户' or dindantype is null";
  1435. g_pMainWnd->ProcessChatMessageRequest2(filter);
  1436. #else
  1437. g_pMainWnd->ProcessChatMessageRequest2(1);
  1438. #endif
  1439. if(g_bSendOK==0)return;
  1440. }
  1441. DataToArray(&m_List1array);
  1442. }
  1443. else
  1444. {
  1445. //////////////数据汇总
  1446. m_List1array.RemoveAll ();
  1447. CString branch;
  1448. for(int i=-1; i<g_brancharray.GetSize ()-1; i++)
  1449. {
  1450. if(i!=-1)
  1451. {
  1452. branch=g_brancharray.ElementAt (i).ElementAt (0);
  1453. g_branchip=g_brancharray.ElementAt (i).ElementAt (1);
  1454. g_pMainWnd->OnDisconnect();
  1455. g_branchname=branch;
  1456. g_bBranchModify=1;
  1457. }
  1458. else
  1459. branch=g_brancharray.ElementAt (g_brancharray.GetSize ()-1).ElementAt (0);
  1460. if(g_bShowOK==0)
  1461. {
  1462. CString filter="status3='未取'";
  1463. g_sendhead.bsql=0;
  1464. g_sendhead.code[0]=31;
  1465. g_sendhead.tabcount=1;
  1466. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)continue;
  1467. }
  1468. else
  1469. {
  1470. g_sendhead.bsql=0;
  1471. g_sendhead.code[0]=31;
  1472. g_sendhead.tabcount=1;
  1473. g_pMainWnd->ProcessChatMessageRequest2(1);if(g_bSendOK==0)continue;
  1474. }
  1475. CArray<CStringArray, CStringArray>List1array;
  1476. DataToArray(&List1array);
  1477. int size=m_List1array.GetSize ();
  1478. for(int j=0; j<List1array.GetSize (); j++)
  1479. {
  1480. size++;
  1481. m_List1array.SetSize(size , 1 );
  1482. size--;
  1483. m_List1array.ElementAt (size).Copy (List1array.ElementAt (j));
  1484. m_List1array.ElementAt (size).InsertAt (0, branch);
  1485. size++;
  1486. }
  1487. }
  1488. g_pMainWnd->OnDisconnect();
  1489. g_bBranchModify=0;g_branchip=g_branchname="";
  1490. }
  1491. m_List1arraybak.SetSize(m_List1array.GetSize (), 1);
  1492. for(int ii=0; ii<m_List1array.GetSize (); ii++)
  1493. {
  1494. m_List1arraybak.ElementAt (ii).Copy(m_List1array.ElementAt (ii));
  1495. if(m_List1array.ElementAt (ii).ElementAt (10).GetLength ()>256)
  1496. {
  1497. m_List1array.ElementAt (ii).SetAt (10, m_List1array.ElementAt (ii).ElementAt (10).Left (256)+"...");
  1498. }
  1499. }
  1500. HidePrice();
  1501. FillGrid();
  1502. }
  1503. void DesignFrom::OnBUTprint3()
  1504. {
  1505. // TODO: Add your control notification handler code here
  1506. GetData();
  1507. }