TakeFrom.cpp 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800
  1. // TakeFrom.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "TakeFrom.h"
  6. #include "MyMdi.H"
  7. #include "ModifyDinDan.h"
  8. #include "InputPsw.h"
  9. #include "ImportPhoto.h"
  10. #include "ShowPic.h"
  11. #include "TakeMoney2.h"
  12. #include "SelWaiter2.h"
  13. #include "TakeStautsSel.h"
  14. #include "SalaryRateSet2.h"
  15. #include "UploadPhoto.h"
  16. #ifdef _DEBUG
  17. #define new DEBUG_NEW
  18. #undef THIS_FILE
  19. static char THIS_FILE[] = __FILE__;
  20. #endif
  21. #pragma comment(lib, "Shlwapi.lib")
  22. IMPLEMENT_DYNCREATE(TakeFrom, MyFormView)
  23. TakeFrom::TakeFrom() : MyFormView(TakeFrom::IDD)
  24. {
  25. m_filter = _T("");
  26. m_nAdd = 0;
  27. if (g_bAllBranch)
  28. {
  29. m_nAdd = 1;
  30. }
  31. }
  32. TakeFrom::~TakeFrom()
  33. {
  34. }
  35. void TakeFrom::DoDataExchange(CDataExchange* pDX)
  36. {
  37. MyFormView::DoDataExchange(pDX);
  38. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  39. DDX_Control(pDX, IDC_LIST2, m_List1);
  40. DDX_Control(pDX, IDC_STATIC1, m_static1);
  41. DDX_CBString(pDX, IDC_COMBO1, m_filter);
  42. }
  43. BEGIN_MESSAGE_MAP(TakeFrom, MyFormView)
  44. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  45. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  46. ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
  47. ON_WM_TIMER()
  48. ON_BN_CLICKED(IDC_BUTimportphoto, OnBUTimportphoto)
  49. ON_BN_CLICKED(IDC_BUTshowphoto, OnBUTshowphoto)
  50. ON_BN_CLICKED(IDC_BUTmoney, OnBUTmoney)
  51. ON_BN_CLICKED(IDC_BTNaddsp, OnBTNaddsp)
  52. ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST2, OnItemchangedList2)
  53. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  54. ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2)
  55. ON_NOTIFY(NM_DBLCLK, IDC_LIST2, OnDblclkList2)
  56. ON_BN_CLICKED(IDC_BTNSEARCHFILTER, OnBtnsearchfilter)
  57. ON_BN_CLICKED(IDC_BUTprint3, OnBUTprint3)
  58. ON_BN_CLICKED(Btn_MicroShare, OnBnClickedMicroshare)
  59. END_MESSAGE_MAP()
  60. #ifdef _DEBUG
  61. void TakeFrom::AssertValid() const
  62. {
  63. MyFormView::AssertValid();
  64. }
  65. void TakeFrom::Dump(CDumpContext& dc) const
  66. {
  67. MyFormView::Dump(dc);
  68. }
  69. #endif //_DEBUG
  70. void TakeFrom::OnInitialUpdate()
  71. {
  72. MyFormView::OnInitialUpdate();
  73. // TODO: Add your specialized code here and/or call the base class
  74. CMyMdi Mdi;
  75. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  76. #ifdef LYFZ_VERSION
  77. GetDlgItem(IDC_BUTimportphoto)->ShowWindow(0);
  78. #endif
  79. // Here we create the outbar control using the splitter as its parent
  80. // and setting its id to the first pane.
  81. CRect rc2;
  82. GetWindowRect(rc2);
  83. ::MoveWindow(m_hWnd, g_rc.left, g_rc.top, g_rc.Width(), g_rc.Height(), TRUE);
  84. EnumChildWindows(m_hWnd, (WNDENUMPROC)EnumChildProc, 0);
  85. int idarray[] = { IDC_BUTprint3, IDC_BUTimportphoto, IDC_BUTshowphoto, IDC_BUTTON2, IDC_BUTclose };
  86. int idcount = 5;
  87. int btnwid;
  88. CRect prerc;
  89. for (int a = idcount - 2; a >= 0; a--)
  90. {
  91. GetDlgItem(idarray[a + 1])->GetWindowRect(prerc);
  92. ScreenToClient(prerc);
  93. GetDlgItem(idarray[a])->GetWindowRect(rc2);
  94. ScreenToClient(rc2);
  95. btnwid = rc2.Width();
  96. rc2.right = prerc.left;
  97. rc2.left = rc2.right - btnwid;
  98. GetDlgItem(idarray[a])->MoveWindow(rc2);
  99. }
  100. m_static1.SetFont(&g_titlefont);
  101. if (g_bAllBranch == 0)
  102. {
  103. #ifdef CHILD_VERSION
  104. #ifdef LKAY_VERSION
  105. m_List1.SetHeadings("订单号,100;家长姓名,100;宝宝姓名,100;相片张数,100;景点,100;拍照,100;导片日期,100;摄影师,100;助理,100;化妆师,100;助理,100;接单人,100;套系名称,100;套系价格,100;手机,100;固定电话,100" );
  106. #else
  107. m_List1.SetHeadings("订单号,100;家长姓名,100;宝宝姓名,100;相片张数,100;景点,100;拍照,100;拍照日期,100;摄影师,100;助理,100;化妆师,100;助理,100;接单人,100;套系名称,100;套系价格,100;手机,100;固定电话,100" );
  108. #endif
  109. #else
  110. m_List1.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;相片张数,100;景点,100;拍照,100;拍照日期,100;摄影师,100;助理,100;化妆师,100;助理,100;接单人,100;套系名称,100;套系价格,100;男宾电话,100;女宾电话,100");
  111. #endif
  112. m_List1.LoadColumnInfo(114);
  113. }
  114. else
  115. {
  116. #ifdef CHILD_VERSION
  117. m_List1.SetHeadings("店名,100;订单号,100;家长姓名,100;宝宝姓名,100;相片张数,100;景点,100;拍照,100;拍照日期,100;摄影师,100;助理,100;化妆师,100;助理,100;接单人,100;套系名称,100;套系价格,100;手机,100;固定电话,100" );
  118. #else
  119. m_List1.SetHeadings("店名,100;订单号,100;男宾姓名,100;女宾姓名,100;相片张数,100;景点,100;拍照,100;拍照日期,100;摄影师,100;助理,100;化妆师,100;助理,100;接单人,100;套系名称,100;套系价格,100;男宾电话,100;女宾电话,100");
  120. #endif
  121. m_List1.LoadColumnInfo(196);
  122. GetDlgItem(IDC_BUTprint3)->ShowWindow(1);
  123. }
  124. #if JEFF_DELETE_OFF // 多景点时排序有问题!
  125. m_List1.m_bSortSupport = 0;
  126. #endif
  127. GetData();
  128. m_combo1.AddString(g_user.name);
  129. m_combo1.GetWindowRect(rc2);
  130. ScreenToClient(rc2);
  131. rc2.bottom += 200;
  132. m_combo1.MoveWindow(rc2);
  133. GetDlgItem(IDC_BUTclose)->GetWindowRect(rc2);
  134. SetComboHei(&m_combo1, rc2.Height());
  135. }
  136. void TakeFrom::FillGrid(BOOL bStatus/*=0*/)
  137. {
  138. if (g_bSearchFilter) // 1.按钮:条件查询;
  139. {
  140. m_List1.DeleteAllItems2();
  141. int ii = 0;
  142. m_List1.m_arLabels.SetSize(m_List1array.GetSize(), 1);
  143. int count = 0;
  144. {
  145. BOOL bFinded = 0;
  146. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  147. {
  148. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd).IsEmpty())
  149. {
  150. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  151. continue;
  152. }
  153. if (g_filterdate1 != "") // Jeff.查询过滤条件:日期;
  154. {
  155. if (m_List1array.ElementAt(ii).ElementAt(6 + m_nAdd) < g_filterdate1 || m_List1array.ElementAt(ii).ElementAt(6 + m_nAdd) > g_filterdate2)
  156. {
  157. bFinded = 0;
  158. continue;
  159. }
  160. }
  161. if (g_waiter1 != "") // Jeff.查询过滤条件:门市;
  162. {
  163. if (m_List1array.ElementAt(ii).ElementAt(11 + m_nAdd) != g_waiter1)
  164. {
  165. bFinded = 0;
  166. continue;
  167. }
  168. }
  169. if (g_waiter2 != "") // Jeff.查询过滤条件:摄影师;
  170. {
  171. if (m_List1array.ElementAt(ii).ElementAt(7 + m_nAdd) != g_waiter2)
  172. {
  173. bFinded = 0;
  174. continue;
  175. }
  176. }
  177. if (g_waiter3 != "") // Jeff.查询过滤条件:化妆师;
  178. {
  179. if (m_List1array.ElementAt(ii).ElementAt(9 + m_nAdd) != g_waiter3)
  180. {
  181. bFinded = 0;
  182. continue;
  183. }
  184. }
  185. if (g_waiter4 != "") // Jeff.查询套系类别;
  186. {
  187. if (m_List1array.ElementAt(ii).ElementAt(3) != g_waiter4)
  188. {
  189. bFinded = 0;
  190. continue;
  191. }
  192. }
  193. if (g_bAllBranch && g_filterbranch != "") // Jeff.集团版查询过滤条件:分店名称;
  194. {
  195. if (m_List1array.ElementAt(ii).ElementAt(0) != g_filterbranch)
  196. {
  197. bFinded = 0;
  198. continue;
  199. }
  200. }
  201. // 2015.03.30
  202. // Jeff:上面已有判断,这里必须判断订单号非空才能添加,否则会添加其他空的选项;
  203. if (!m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd).IsEmpty())
  204. {
  205. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  206. bFinded = 1;
  207. }
  208. }
  209. }
  210. m_List1.m_arLabels.SetSize(count, 1);
  211. ii = count;
  212. m_List1.m_LabelCount = ii;
  213. m_List1.SetItemCountEx(ii);
  214. CString str;
  215. str.Format("单数:%d", ii);
  216. SetDlgItemText(IDC_STATIC2, str);
  217. }
  218. else // 2.其他显示;
  219. {
  220. m_List1.DeleteAllItems2();
  221. int ii = 0;
  222. m_List1.m_arLabels.SetSize(m_List1array.GetSize(), 1);
  223. int count = 0;
  224. if (m_filter.IsEmpty()) // 2.1.没有查询关键字;
  225. {
  226. if (bStatus == 1) // bStatus==1,没用到;
  227. {
  228. BOOL bFinded = 0;
  229. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  230. {
  231. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd).IsEmpty())
  232. {
  233. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  234. continue;
  235. }
  236. if (m_List1array.ElementAt(ii).ElementAt(5 + m_nAdd) != "OK"&&m_List1array.ElementAt(ii).ElementAt(6 + m_nAdd).IsEmpty() == 0)
  237. {
  238. bFinded = 1;
  239. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  240. }
  241. else
  242. {
  243. bFinded = 0;
  244. }
  245. }
  246. }
  247. else if (bStatus == 2) // 今拍按钮用到;
  248. {
  249. BOOL bFinded = 0;
  250. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  251. {
  252. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd).IsEmpty())
  253. {
  254. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  255. continue;
  256. }
  257. if (m_List1array.ElementAt(ii).ElementAt(5 + m_nAdd) == "OK" && m_List1array.ElementAt(ii).ElementAt(6 + m_nAdd) == g_date)
  258. {
  259. bFinded = 1;
  260. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  261. }
  262. else
  263. {
  264. bFinded = 0;
  265. }
  266. }
  267. }
  268. else // bStatus==0;默认使用的值;
  269. {
  270. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  271. {
  272. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  273. }
  274. }
  275. }
  276. else // 2.2.指定查询条件 ;
  277. {
  278. if (bStatus == 1)
  279. {
  280. BOOL bFinded = 0;
  281. int type = GetType(m_filter);
  282. if (type == 1)//电话
  283. {
  284. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  285. {
  286. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd).IsEmpty())
  287. {
  288. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  289. continue;
  290. }
  291. if (m_List1array.ElementAt(ii).ElementAt(5 + m_nAdd) != "OK"&&m_List1array.ElementAt(ii).ElementAt(6 + m_nAdd).IsEmpty() == 0 && (m_List1array.ElementAt(ii).ElementAt(15 + m_nAdd).Find(m_filter) != -1 || \
  292. m_List1array.ElementAt(ii).ElementAt(14 + m_nAdd).Find(m_filter) != -1))
  293. {
  294. bFinded = 1;
  295. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  296. }
  297. else
  298. {
  299. bFinded = 0;
  300. }
  301. }
  302. }
  303. else if (type == 2)//拼音
  304. {
  305. BOOL bFinded = 0;
  306. m_filter.MakeUpper();
  307. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  308. {
  309. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd).IsEmpty())
  310. {
  311. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  312. continue;
  313. }
  314. if (m_List1array.ElementAt(ii).ElementAt(5 + m_nAdd) != "OK"&&m_List1array.ElementAt(ii).ElementAt(6 + m_nAdd).IsEmpty() == 0 && (m_List1array.ElementAt(ii).ElementAt(16 + m_nAdd).Find(m_filter) != -1 || \
  315. m_List1array.ElementAt(ii).ElementAt(17 + m_nAdd).Find(m_filter) != -1))
  316. {
  317. bFinded = 1;
  318. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  319. }
  320. else
  321. {
  322. bFinded = 0;
  323. }
  324. }
  325. }
  326. else
  327. {
  328. BOOL bFinded = 0;
  329. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  330. {
  331. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd).IsEmpty())
  332. {
  333. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  334. continue;
  335. }
  336. if (m_List1array.ElementAt(ii).ElementAt(5 + m_nAdd) != "OK"&&\
  337. m_List1array.ElementAt(ii).ElementAt(6 + m_nAdd).IsEmpty() == 0 && \
  338. (m_List1array.ElementAt(ii).ElementAt(0).Find(m_filter) != -1 || \
  339. m_List1array.ElementAt(ii).ElementAt(1).Find(m_filter) != -1 || \
  340. m_List1array.ElementAt(ii).ElementAt(2).Find(m_filter) != -1 || \
  341. m_List1array.ElementAt(ii).ElementAt(3).Find(m_filter) != -1 || \
  342. m_List1array.ElementAt(ii).ElementAt(4).Find(m_filter) != -1 || \
  343. m_List1array.ElementAt(ii).ElementAt(5).Find(m_filter) != -1 || \
  344. m_List1array.ElementAt(ii).ElementAt(6).Find(m_filter) != -1 || \
  345. m_List1array.ElementAt(ii).ElementAt(7).Find(m_filter) != -1 || \
  346. m_List1array.ElementAt(ii).ElementAt(8).Find(m_filter) != -1 || \
  347. m_List1array.ElementAt(ii).ElementAt(9).Find(m_filter) != -1 || \
  348. m_List1array.ElementAt(ii).ElementAt(10).Find(m_filter) != -1 || \
  349. m_List1array.ElementAt(ii).ElementAt(11).Find(m_filter) != -1 || \
  350. m_List1array.ElementAt(ii).ElementAt(14).Find(m_filter) != -1 || \
  351. m_List1array.ElementAt(ii).ElementAt(15).Find(m_filter) != -1 || \
  352. m_List1array.ElementAt(ii).ElementAt(16).Find(m_filter) != -1 || \
  353. m_List1array.ElementAt(ii).ElementAt(17).Find(m_filter) != -1 || \
  354. m_List1array.ElementAt(ii).ElementAt(13).Find(m_filter) != -1))
  355. {
  356. bFinded = 1;
  357. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  358. }
  359. else
  360. {
  361. bFinded = 0;
  362. }
  363. }
  364. }
  365. }
  366. else if (bStatus == 2)
  367. {
  368. BOOL bFinded = 0;
  369. int type = GetType(m_filter);
  370. if (type == 1)//电话
  371. {
  372. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  373. {
  374. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd).IsEmpty())
  375. {
  376. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  377. continue;
  378. }
  379. if (m_List1array.ElementAt(ii).ElementAt(5 + m_nAdd) == "OK"&&m_List1array.ElementAt(ii).ElementAt(6 + m_nAdd) == g_date && (m_List1array.ElementAt(ii).ElementAt(15 + m_nAdd).Find(m_filter) != -1 || \
  380. m_List1array.ElementAt(ii).ElementAt(14 + m_nAdd).Find(m_filter) != -1))
  381. {
  382. bFinded = 1;
  383. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  384. }
  385. else
  386. {
  387. bFinded = 0;
  388. }
  389. }
  390. }
  391. else if (type == 2)//拼音
  392. {
  393. BOOL bFinded = 0;
  394. m_filter.MakeUpper();
  395. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  396. {
  397. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd).IsEmpty())
  398. {
  399. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  400. continue;
  401. }
  402. if (m_List1array.ElementAt(ii).ElementAt(5 + m_nAdd) == "OK"&&m_List1array.ElementAt(ii).ElementAt(6 + m_nAdd) == g_date && (m_List1array.ElementAt(ii).ElementAt(17 + m_nAdd).Find(m_filter) != -1 || \
  403. m_List1array.ElementAt(ii).ElementAt(16 + m_nAdd).Find(m_filter) != -1))
  404. {
  405. bFinded = 1;
  406. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  407. }
  408. else
  409. {
  410. bFinded = 0;
  411. }
  412. }
  413. }
  414. else
  415. {
  416. BOOL bFinded = 0;
  417. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  418. {
  419. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd).IsEmpty())
  420. {
  421. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  422. continue;
  423. }
  424. if (m_List1array.ElementAt(ii).ElementAt(5 + m_nAdd) == "OK"&&m_List1array.ElementAt(ii).ElementAt(6 + m_nAdd) == g_date &&\
  425. (m_List1array.ElementAt(ii).ElementAt(0).Find(m_filter) != -1 || \
  426. m_List1array.ElementAt(ii).ElementAt(1).Find(m_filter) != -1 || \
  427. m_List1array.ElementAt(ii).ElementAt(2).Find(m_filter) != -1 || \
  428. m_List1array.ElementAt(ii).ElementAt(3).Find(m_filter) != -1 || \
  429. m_List1array.ElementAt(ii).ElementAt(4).Find(m_filter) != -1 || \
  430. m_List1array.ElementAt(ii).ElementAt(5).Find(m_filter) != -1 || \
  431. m_List1array.ElementAt(ii).ElementAt(6).Find(m_filter) != -1 || \
  432. m_List1array.ElementAt(ii).ElementAt(7).Find(m_filter) != -1 || \
  433. m_List1array.ElementAt(ii).ElementAt(8).Find(m_filter) != -1 || \
  434. m_List1array.ElementAt(ii).ElementAt(9).Find(m_filter) != -1 || \
  435. m_List1array.ElementAt(ii).ElementAt(10).Find(m_filter) != -1 || \
  436. m_List1array.ElementAt(ii).ElementAt(11).Find(m_filter) != -1 || \
  437. m_List1array.ElementAt(ii).ElementAt(14).Find(m_filter) != -1 || \
  438. m_List1array.ElementAt(ii).ElementAt(15).Find(m_filter) != -1 || \
  439. m_List1array.ElementAt(ii).ElementAt(16).Find(m_filter) != -1 || \
  440. m_List1array.ElementAt(ii).ElementAt(17).Find(m_filter) != -1 || \
  441. m_List1array.ElementAt(ii).ElementAt(13).Find(m_filter) != -1))
  442. {
  443. bFinded = 1;
  444. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  445. }
  446. else
  447. {
  448. bFinded = 0;
  449. }
  450. }
  451. }
  452. }
  453. else
  454. {
  455. int type = GetType(m_filter);
  456. if (type == 1)//电话
  457. {
  458. BOOL bFinded = 0;
  459. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  460. {
  461. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd).IsEmpty())
  462. {
  463. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  464. continue;
  465. }
  466. if (m_List1array.ElementAt(ii).ElementAt(14 + m_nAdd).Find(m_filter) != -1 || \
  467. m_List1array.ElementAt(ii).ElementAt(15 + m_nAdd).Find(m_filter) != -1)
  468. {
  469. bFinded = 1;
  470. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  471. }
  472. else
  473. {
  474. bFinded = 0;
  475. }
  476. }
  477. }
  478. else if (type == 2)//拼音
  479. {
  480. BOOL bFinded = 0;
  481. m_filter.MakeUpper();
  482. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  483. {
  484. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd).IsEmpty())
  485. {
  486. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  487. continue;
  488. }
  489. if (m_List1array.ElementAt(ii).ElementAt(16 + m_nAdd).Find(m_filter) != -1 || \
  490. m_List1array.ElementAt(ii).ElementAt(17 + m_nAdd).Find(m_filter) != -1)
  491. {
  492. bFinded = 1;
  493. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  494. }
  495. else
  496. {
  497. bFinded = 0;
  498. }
  499. }
  500. }
  501. else
  502. {
  503. BOOL bFinded = 0;
  504. for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
  505. {
  506. if (bFinded && m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd).IsEmpty())
  507. {
  508. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  509. continue;
  510. }
  511. if (m_List1array.ElementAt(ii).ElementAt(0).Find(m_filter) != -1 || \
  512. m_List1array.ElementAt(ii).ElementAt(1).Find(m_filter) != -1 || \
  513. m_List1array.ElementAt(ii).ElementAt(2).Find(m_filter) != -1 || \
  514. m_List1array.ElementAt(ii).ElementAt(3).Find(m_filter) != -1 || \
  515. m_List1array.ElementAt(ii).ElementAt(4).Find(m_filter) != -1 || \
  516. m_List1array.ElementAt(ii).ElementAt(5).Find(m_filter) != -1 || \
  517. m_List1array.ElementAt(ii).ElementAt(6).Find(m_filter) != -1 || \
  518. m_List1array.ElementAt(ii).ElementAt(7).Find(m_filter) != -1 || \
  519. m_List1array.ElementAt(ii).ElementAt(8).Find(m_filter) != -1 || \
  520. m_List1array.ElementAt(ii).ElementAt(9).Find(m_filter) != -1 || \
  521. m_List1array.ElementAt(ii).ElementAt(10).Find(m_filter) != -1 || \
  522. m_List1array.ElementAt(ii).ElementAt(11).Find(m_filter) != -1 || \
  523. m_List1array.ElementAt(ii).ElementAt(14).Find(m_filter) != -1 || \
  524. m_List1array.ElementAt(ii).ElementAt(15).Find(m_filter) != -1 || \
  525. m_List1array.ElementAt(ii).ElementAt(16).Find(m_filter) != -1 || \
  526. m_List1array.ElementAt(ii).ElementAt(17).Find(m_filter) != -1 || \
  527. m_List1array.ElementAt(ii).ElementAt(13).Find(m_filter) != -1)
  528. {
  529. bFinded = 1;
  530. m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  531. }
  532. else
  533. {
  534. bFinded = 0;
  535. }
  536. }
  537. }
  538. }
  539. }
  540. m_List1.m_arLabels.SetSize(count, 1);
  541. ii = count;
  542. m_List1.m_LabelCount = ii;
  543. m_List1.SetItemCountEx(ii);
  544. CString str;
  545. str.Format("单数:%d", ii);
  546. SetDlgItemText(IDC_STATIC2, str);
  547. }
  548. if (!g_id.IsEmpty())
  549. {
  550. for (int i = 0; i < m_List1.GetItemCount(); i++)
  551. {
  552. if (g_id == m_List1.GetItemText(i, 0 + m_nAdd))
  553. {
  554. m_List1.SetItemState(i, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
  555. m_List1.EnsureVisible(i, FALSE);
  556. break;
  557. }
  558. }
  559. }
  560. }
  561. void TakeFrom::OnBUTclose()
  562. {
  563. // TODO: Add your control notification handler code here
  564. GetParent()->SendMessage(WM_CLOSE);
  565. }
  566. void TakeFrom::OnSelchangeCombo1()
  567. {
  568. // TODO: Add your control notification handler code here
  569. SetTimer(1, 100, NULL);
  570. }
  571. void TakeFrom::OnTimer(UINT nIDEvent)
  572. {
  573. // TODO: Add your message handler code here and/or call default
  574. KillTimer(nIDEvent);
  575. OnButton1();
  576. }
  577. BOOL TakeFrom::PreTranslateMessage(MSG* pMsg)
  578. {
  579. // TODO: Add your specialized code here and/or call the base class
  580. try
  581. {
  582. if (pMsg->message == WM_KEYDOWN)
  583. {
  584. switch (pMsg->wParam)
  585. {
  586. case VK_RETURN:
  587. OnButton1();
  588. return 1;
  589. case 0x43: // copy
  590. if ((GetKeyState(VK_CONTROL) & 0x80))
  591. {
  592. GetFocus()->SendMessage(WM_COPY);
  593. return TRUE;
  594. }
  595. break;
  596. case 0x56: //Ctrl + V:
  597. if ((GetKeyState(VK_CONTROL) & 0x80))
  598. {
  599. GetFocus()->SendMessage(WM_PASTE);
  600. return TRUE;
  601. }
  602. break;
  603. case 0x58: // cut
  604. if ((GetKeyState(VK_CONTROL) & 0x80))
  605. {
  606. GetFocus()->SendMessage(WM_CUT);
  607. return TRUE;
  608. }
  609. break;
  610. case 0x5A: //undo
  611. case 0x59: //redo
  612. if ((GetKeyState(VK_CONTROL) & 0x80))
  613. {
  614. GetFocus()->SendMessage(WM_UNDO);
  615. return TRUE;
  616. }
  617. break;
  618. }
  619. }
  620. return MyFormView::PreTranslateMessage(pMsg);
  621. }
  622. catch (...)
  623. {
  624. }
  625. }
  626. // Jeff.remark.
  627. // 1.弹出"拍照状态确认"对话框前,需要获取订单的拍照状态,以此来确定是否需要禁用check状态框;
  628. //
  629. void TakeFrom::OnBUTimportphoto() // 导入原片按钮;
  630. {
  631. POSITION pos;
  632. pos = m_List1.GetFirstSelectedItemPosition();
  633. if (pos == NULL)
  634. {
  635. AfxMessageBox("请先选中您要导片的定单!", MB_ICONINFORMATION);
  636. return;
  637. }
  638. // 1.选中的起始行号;
  639. int iItem = m_List1.GetNextSelectedItem(pos);
  640. // 2.选中的行数;
  641. int itemcount = m_List1.GetItemCount();
  642. int iItemBak = iItem;
  643. CString status2 = "OK";
  644. CString branch;
  645. CString strOrderNumber = m_List1.GetItemText(iItem, 0 + m_nAdd); // .OrderNumber订单号;
  646. int beginno = atoi(m_List1.GetItemText(iItem, 3 + m_nAdd)) + 1; // .Jeff.起始编号,即下一次相片命名的号码数;由服务器减1,客户端加1;
  647. if (g_bAllBranch)
  648. branch = m_List1.GetItemText(iItem, 0);
  649. // Jeff.多景点时,选择了不是第一个景点,订单是空的;
  650. while (strOrderNumber == "")
  651. {
  652. iItem--;
  653. strOrderNumber = m_List1.GetItemText(iItem, 0 + m_nAdd);
  654. beginno = atoi(m_List1.GetItemText(iItem, 3 + m_nAdd)) + 1; // 由服务器减1,客户端加1;
  655. }
  656. int nTopItem = iItem;// Jeff add:记录第一个有订单号的项;
  657. //int nNotOkItem = -1; // Jeff add:第一个被记录未拍照ok的子景点项;如果是头景点呢?
  658. // .jdpos景点位置;并不能用来判断该订单是否多个景点,因为如果iItem是有订单号的话,无效;
  659. int jdpos = iItemBak - iItem;
  660. // .订单拍摄如果不是ok状态,设置为拍摄中;
  661. BOOL bOK = TRUE; //Jeff.add;
  662. #if 1 // Jeff.用于判断是否只剩下一个 未OK 状态时,拍照确认对话框的复选是否需要勾上;
  663. // 此时iItem为有订单号的头景点;
  664. if (m_List1.GetItemText(iItem, 5 + m_nAdd) != "OK")
  665. {
  666. status2 = "拍摄中";
  667. //bOK = FALSE;
  668. }
  669. // .子景点(如果有的话);
  670. ++iItem;
  671. while (iItem < itemcount && m_List1.GetItemText(iItem, 0 + m_nAdd) == "" && status2 != "拍摄中")
  672. {
  673. if (m_List1.GetItemText(iItem, 5 + m_nAdd) != "OK" && iItemBak != iItem) // Jeff.如果只有两个景点这里出错:第一个ok,第二个未拍;这里会跳出;
  674. {
  675. status2 = "拍摄中";
  676. //bOK = FALSE;
  677. //nNotOkItem = iItem;
  678. break;
  679. }
  680. iItem++;
  681. }
  682. // printf("Jeff:对话框前的状态:%s\n\n",status2);
  683. #endif
  684. iItem = iItemBak;
  685. CString dindanjd = m_List1.GetItemText(iItem, 4 + m_nAdd);
  686. CString waiter1 = m_List1.GetItemText(iItem, 7 + m_nAdd);
  687. CString waiter12 = m_List1.GetItemText(iItem, 8 + m_nAdd);
  688. CString waiter2 = m_List1.GetItemText(iItem, 9 + m_nAdd);
  689. CString waiter22 = m_List1.GetItemText(iItem, 10 + m_nAdd);
  690. strOrderNumber = m_List1.GetItemText(iItem, 0 + m_nAdd);
  691. while (strOrderNumber == "")
  692. {
  693. iItem--;
  694. strOrderNumber = m_List1.GetItemText(iItem, 0 + m_nAdd);
  695. }
  696. CString name = m_List1.GetItemText(iItem, 1 + m_nAdd) + "," + m_List1.GetItemText(iItem, 2 + m_nAdd);
  697. name.TrimLeft(",");
  698. name.TrimRight(",");
  699. name = "客人:" + name;
  700. CString phone = m_List1.GetItemText(iItem, 14 + m_nAdd) + "," + m_List1.GetItemText(iItem, 15 + m_nAdd);
  701. phone.TrimLeft(",");
  702. phone.TrimRight(",");
  703. phone = "电话:" + phone;
  704. if (g_path1.IsEmpty())
  705. {
  706. AfxMessageBox("未设置原片保存机器, 请通知系统管理员!", MB_ICONINFORMATION);
  707. return;
  708. }
  709. #ifdef ENTERPRISE_VERSION
  710. if (::CheckFolderFileExist(g_path1) == 0)
  711. ::CreateDirectory(g_path1, NULL);
  712. #endif
  713. if (!::CheckFolderFileExist(g_path1))
  714. {
  715. AfxMessageBox("原片保存机器目录未设置, 请通知系统管理员!", MB_ICONINFORMATION);
  716. return;
  717. }
  718. CString savepath;
  719. if (g_bAllBranch)
  720. {
  721. CString branchpath = GetBranchPhotoPath(branch);
  722. savepath = g_path1 + branchpath + "\\";
  723. if (::CheckFolderFileExist(savepath) == 0)
  724. ::CreateDirectory(savepath, NULL);
  725. }
  726. else
  727. savepath = g_path1 + "\\";
  728. savepath += strOrderNumber + "\\";
  729. if (::CheckFolderFileExist(savepath) == 0)
  730. ::CreateDirectory(savepath, NULL);
  731. CString calnopath = savepath;
  732. savepath += dindanjd + "\\";
  733. if (::CheckFolderFileExist(savepath) == 0)
  734. ::CreateDirectory(savepath, NULL);
  735. CString Filter = "图片文件 (*.jpg)|*.jpg|原始格式RAW (*.raw)|*.raw|原始格式NEF (*.nef)|*.nef|原始格式CR2 (*.cr2)|*.cr2||";
  736. // .选择要导入的相片,可多选;
  737. CFileDialog fdlg(true, NULL, "openfile", OFN_ALLOWMULTISELECT, Filter);
  738. TCHAR szBuffer[60000] = { 0 };
  739. fdlg.m_ofn.lpstrFile = szBuffer;
  740. fdlg.m_ofn.nMaxFile = 60000;
  741. if (fdlg.DoModal() != IDOK)
  742. {
  743. // .拍摄人员确认 SelWaiter2;
  744. SelWaiter2 waiterdlg;
  745. waiterdlg.waiter1 = waiter1;
  746. waiterdlg.waiter12 = waiter12;
  747. waiterdlg.waiter2 = waiter2;
  748. waiterdlg.waiter22 = waiter22;
  749. waiterdlg.beginno = beginno;// Jeff,实际上SelWaiter::beginno并没有任何作用,这里放置具有误导性!
  750. if (waiterdlg.DoModal() != IDOK)return;
  751. waiter1 = waiterdlg.waiter1;
  752. waiter12 = waiterdlg.waiter12;
  753. waiter2 = waiterdlg.waiter2;
  754. waiter22 = waiterdlg.waiter22;
  755. beginno = waiterdlg.beginno;
  756. CString status;
  757. // .拍照状态确认.对话框.
  758. TakeStautsSel dlg2;
  759. if (status2 == "OK") // .拍照状态为ok时;
  760. {
  761. dlg2.m_check1 = 1;
  762. // Jeff.add:已经是ok的拍照状态,禁用用户修改该状态;IDC_CHECK1
  763. //dlg2.DisEnableCheck();
  764. dlg2.m_bCheckEnalbe = FALSE;
  765. }
  766. dlg2.DoModal();
  767. if (dlg2.m_radio1 == 0)
  768. {
  769. status = "OK";
  770. }
  771. else if (dlg2.m_radio1 == 1)
  772. {
  773. status = "拍摄中";
  774. //dlg2.CheckChange();
  775. }
  776. else
  777. {
  778. status = "未拍";
  779. //dlg2.CheckChange();
  780. }
  781. #if 1
  782. //本次选择ok时,需要再检查一下,看是否全部都已经ok;
  783. // 此时iItem为有订单号的头景点;
  784. // printf("Jeff:景点拍照完成,nTopItem=%d\n\n",nTopItem);
  785. bOK = TRUE;
  786. status2 = "OK";
  787. int nItem = nTopItem;
  788. if (m_List1.GetItemText(nItem, 5 + m_nAdd) != "OK")
  789. {
  790. if (nItem != iItemBak)
  791. {
  792. status2 = "拍摄中";
  793. // printf("Jeff:景点%d拍照完成\n\n",nItem);
  794. bOK = FALSE;
  795. }
  796. else if (status != "OK")
  797. {
  798. status2 = "拍摄中";
  799. // printf("Jeff:景点%d拍照完成\n\n",nItem);
  800. bOK = FALSE;
  801. }
  802. }
  803. // .子景点(如果有的话);
  804. ++nItem;
  805. while (nItem < itemcount && m_List1.GetItemText(nItem, 0 + m_nAdd) == "" && status2 != "拍摄中")
  806. {
  807. if (m_List1.GetItemText(nItem, 5 + m_nAdd) != "OK" && iItemBak != nItem) // Jeff.如果只有两个景点这里出错:第一个ok,第二个未拍;这里会跳出;
  808. {
  809. status2 = "拍摄中";
  810. bOK = FALSE;
  811. // printf("Jeff:景点%d拍照完成\n\n",nItem);
  812. break;
  813. }
  814. else
  815. {
  816. if (status != "OK")
  817. {
  818. status2 = "拍摄中";
  819. bOK = FALSE;
  820. }
  821. }
  822. ++nItem;
  823. }
  824. if (bOK) status2 = "OK";
  825. #endif
  826. #if 1
  827. //if ( !bOK )
  828. // status2 = "拍摄中";
  829. //else if(dlg2.m_check1) // .拍照景点全部ok状态;
  830. // status2 = "OK";
  831. CString sql;
  832. if (dlg2.m_check1)
  833. {
  834. status2 = "OK";
  835. // Jeff:如果有多个景点,全部设置为拍照ok;
  836. // 需要遍历处理;
  837. sql.Format("update dindanjd set [status]='OK' where id='%s'", strOrderNumber);
  838. // printf("Jeff:全部景点选择拍照OK,SQL=%s\n\n",sql);
  839. }
  840. #endif
  841. //CString sql;
  842. //sql="update dindanjd set [status]='"+status+"',[waiter1]='"+waiter1+"',[waiter12]='"+waiter12+"',[waiter2]='"+waiter2+"',[waiter22]='"+waiter22+"' where [id]='"+id+"' and [name]='"+dindanjd+"'";
  843. sql += "***update dindanjd set [status]='" + status + "',[waiter1]='" + waiter1 + "',[waiter12]='" + waiter12 + "',[waiter2]='" + waiter2 + "',[waiter22]='" + waiter22 + "' where [id]='" + strOrderNumber + "' and [name]='" + dindanjd + "'";
  844. #ifndef LYFZ_VERSION
  845. if (jdpos == 0)
  846. sql += "***update dindan set [status]=case when [status]<>'OK' then '" + status2 + "' else [status] end,[waiter1]='" + waiter1 + "',[waiter2]='" + waiter2 + "' where [id]='" + strOrderNumber + "'";
  847. else if (jdpos == 1)
  848. sql += "***update dindan set [status]=case when [status]<>'OK' then '" + status2 + "' else [status] end,[waiter12]='" + waiter1 + "',[waiter22]='" + waiter2 + "' where [id]='" + strOrderNumber + "'";
  849. else if (jdpos == 2)
  850. sql += "***update dindan set [status]=case when [status]<>'OK' then '" + status2 + "' else [status] end,[waiter13]='" + waiter1 + "',[waiter23]='" + waiter2 + "' where [id]='" + strOrderNumber + "'";
  851. else if (jdpos == 3)
  852. sql += "***update dindan set [status]=case when [status]<>'OK' then '" + status2 + "' else [status] end,[waiter14]='" + waiter1 + "',[waiter24]='" + waiter2 + "' where [id]='" + strOrderNumber + "'";
  853. else
  854. sql += "***update dindan set [status]=case when [status]<>'OK' then '" + status2 + "' else [status] end where [id]='" + strOrderNumber + "'";
  855. #else
  856. sql+="***update dindan set [status]=case when [status]<>'OK' then '"+status2+"' else [status] end where [id]='"+strOrderNumber+"'";
  857. #endif
  858. CString sql2;
  859. if (1)
  860. {
  861. sql2 = "***gentakecontent:" + strOrderNumber;
  862. sql += sql2;
  863. }
  864. g_sendhead.bsql = 1;
  865. if (g_bAllBranch)
  866. {
  867. g_branchip = GetIP(branch);
  868. g_pMainWnd->OnDisconnect();
  869. g_branchname = branch;
  870. g_bBranchModify = 1;
  871. g_pMainWnd->ProcessChatMessageRequest2(sql);
  872. g_pMainWnd->OnDisconnect();
  873. g_bBranchModify = 0;
  874. g_branchip = g_branchname = "";
  875. }
  876. else
  877. g_pMainWnd->ProcessChatMessageRequest2(sql);
  878. if (g_bSendOK == 0)return;
  879. if (g_bAllBranch == 0)
  880. {
  881. GetData();
  882. }
  883. else
  884. {
  885. BOOL bFind = 0;
  886. for (int i = 0; i < m_List1array.GetSize(); i++)
  887. {
  888. if (bFind && m_List1array.ElementAt(i).ElementAt(1) != "")break;
  889. if (strOrderNumber == m_List1array.ElementAt(i).ElementAt(1) && branch == m_List1array.ElementAt(i).ElementAt(0))
  890. {
  891. bFind = 1;
  892. }
  893. if (bFind && dindanjd == m_List1array.ElementAt(i).ElementAt(4))
  894. {
  895. m_List1array.ElementAt(i).SetAt(7 + m_nAdd, waiter1);
  896. m_List1array.ElementAt(i).SetAt(8 + m_nAdd, waiter12);
  897. m_List1array.ElementAt(i).SetAt(9 + m_nAdd, waiter2);
  898. m_List1array.ElementAt(i).SetAt(10 + m_nAdd, waiter22);
  899. m_List1array.ElementAt(i).SetAt(5 + m_nAdd, status);
  900. FillGrid();
  901. break;
  902. }
  903. }
  904. }
  905. return;
  906. }
  907. pos = fdlg.GetStartPosition();
  908. CStringArray array;
  909. while (pos != NULL)
  910. {
  911. array.Add(fdlg.GetNextPathName(pos));
  912. }
  913. if (array.GetSize() == 0)return;
  914. if (1)
  915. {
  916. CString str;
  917. str.Format("%s\r\n%s\r\n景点:%s\r\n确认您选中的照片与客户资料相符吗? 是否继续?", name, phone, dindanjd);
  918. if (AfxMessageBox(str, MB_YESNO | MB_ICONINFORMATION) != IDYES)
  919. return;
  920. }
  921. SelWaiter2 waiterdlg;
  922. waiterdlg.waiter1 = waiter1;
  923. waiterdlg.waiter12 = waiter12;
  924. waiterdlg.waiter2 = waiter2;
  925. waiterdlg.waiter22 = waiter22;
  926. waiterdlg.beginno = beginno;
  927. if (waiterdlg.DoModal() != IDOK)return;
  928. waiter1 = waiterdlg.waiter1;
  929. waiter12 = waiterdlg.waiter12;
  930. waiter2 = waiterdlg.waiter2;
  931. waiter22 = waiterdlg.waiter22;
  932. beginno = waiterdlg.beginno;
  933. //----------------------------------------------------------------------------------------------
  934. //----------------------------------------------------------------------------------------------
  935. //----------------------------------------------------------------------------------------------
  936. // 导入拍照好的相片;
  937. ImportPhoto dlg;
  938. dlg.beginno = beginno; // 当前订单相片编号;
  939. dlg.m_bOfmat = 1; // 未知;
  940. dlg.m_branch = branch; // 分店名称;
  941. dlg.m_nphototype = 0; // 相片类型,==0表示原片;
  942. dlg.m_calnopath = calnopath; // 未知;
  943. dlg.m_mode = 2; // 未知;
  944. dlg.m_bOrigin = 1; // 未知;
  945. dlg.m_pArray = &array; // 要导入的相片路径集合;
  946. dlg.m_savepath = savepath; // 保存相片的目录;
  947. #ifdef ENTERPRISE_VERSION
  948. // if(!g_branchname.IsEmpty())
  949. {
  950. dlg.m_id = strOrderNumber;
  951. dlg.m_bSaveUploadTask = g_bSaveUploadTask1;
  952. dlg.m_sel = g_cominfoarraylocal.ElementAt(0).ElementAt(78);
  953. dlg.m_uploadtaskarray.Add(strOrderNumber + ";" + name);
  954. dlg.m_uploadtaskarray.Add("");
  955. dlg.m_uploadtaskarray.Add("");
  956. dlg.m_uploadtaskarray.Add("");
  957. dlg.m_uploadtaskarray.Add("");
  958. dlg.m_uploadtaskarray.Add("");
  959. dlg.m_uploadtaskarray.Add("");
  960. dlg.m_uploadtaskarray.Add("");
  961. dlg.m_uploadtaskarray.Add("");
  962. dlg.m_uploadtaskarray.Add("");
  963. }
  964. #endif
  965. dlg.DoModal();
  966. // Jeff.每次重新导入相片时,都删除ok文件;
  967. beginno = dlg.beginno;
  968. savepath += "ok";
  969. ::DeleteFile(savepath); // 删除ok文件;
  970. CString status;
  971. TakeStautsSel dlg2;
  972. if (status2 == "OK")
  973. {
  974. dlg2.m_check1 = 1;
  975. dlg2.m_bCheckEnalbe = FALSE;
  976. }
  977. dlg2.DoModal();
  978. if (dlg2.m_radio1 == 0)
  979. {
  980. status = "OK";
  981. }
  982. else if (dlg2.m_radio1 == 1)
  983. {
  984. status = "拍摄中";
  985. //dlg2.CheckChange();
  986. }
  987. else
  988. {
  989. status = "未拍";
  990. //dlg2.CheckChange();
  991. }
  992. #if 1
  993. //本次选择ok时,需要再检查一下,看是否全部都已经ok;
  994. // 此时iItem为有订单号的头景点;
  995. // printf("Jeff:景点拍照完成,nTopItem=%d\n\n",nTopItem);
  996. bOK = TRUE;
  997. status2 = "OK";
  998. int nItem = nTopItem;
  999. if (m_List1.GetItemText(nItem, 5 + m_nAdd) != "OK")
  1000. {
  1001. if (nItem != iItemBak)
  1002. {
  1003. status2 = "拍摄中";
  1004. // printf("Jeff:景点%d拍照完成\n\n",nItem);
  1005. bOK = FALSE;
  1006. }
  1007. else if (status != "OK")
  1008. {
  1009. status2 = "拍摄中";
  1010. // printf("Jeff:景点%d拍照完成\n\n",nItem);
  1011. bOK = FALSE;
  1012. }
  1013. }
  1014. // .子景点(如果有的话);
  1015. ++nItem;
  1016. while (nItem < itemcount && m_List1.GetItemText(nItem, 0 + m_nAdd) == "" && status2 != "拍摄中")
  1017. {
  1018. if (m_List1.GetItemText(nItem, 5 + m_nAdd) != "OK" && iItemBak != nItem) // Jeff.如果只有两个景点这里出错:第一个ok,第二个未拍;这里会跳出;
  1019. {
  1020. status2 = "拍摄中";
  1021. bOK = FALSE;
  1022. // printf("Jeff:景点%d拍照完成\n\n",nItem);
  1023. break;
  1024. }
  1025. else
  1026. {
  1027. if (status != "OK")
  1028. {
  1029. status2 = "拍摄中";
  1030. bOK = FALSE;
  1031. }
  1032. }
  1033. ++nItem;
  1034. }
  1035. if (bOK) status2 = "OK";
  1036. #endif
  1037. #if 1
  1038. //if ( !bOK )
  1039. // status2 = "拍摄中";
  1040. //else if(dlg2.m_check1) // .拍照景点全部ok状态;
  1041. // status2 = "OK";
  1042. CString sql;
  1043. if (dlg2.m_check1)
  1044. {
  1045. status2 = "OK";
  1046. // Jeff:如果有多个景点,全部设置为拍照ok;
  1047. // 需要遍历处理?;
  1048. // 批量处理某个订单的就可以了;
  1049. // SQL:update dindanjd set [status]='OK' where id='';
  1050. // CString SQL;
  1051. sql.Format("update dindanjd set [status]='OK' where id='%s'", strOrderNumber);
  1052. // printf("Jeff:全部景点选择拍照OK,SQL=%s\n\n",sql);
  1053. }
  1054. #endif
  1055. //CString sql;
  1056. //sql="update dindanjd set [status]='"+status+"',[date]='"+g_date+"',[waiter1]='"+waiter1+"',[waiter12]='"+waiter12+"',[waiter2]='"+waiter2+"',[waiter22]='"+waiter22+"' where [id]='"+id+"' and [name]='"+dindanjd+"'";
  1057. sql += "***update dindanjd set [status]='" + status + "',[date]='" + g_date + "',[waiter1]='" + waiter1 + "',[waiter12]='" + waiter12 + "',[waiter2]='" + waiter2 + "',[waiter22]='" + waiter22 + "' where [id]='" + strOrderNumber + "' and [name]='" + dindanjd + "'";
  1058. CString sbeginno;
  1059. sbeginno.Format("%d", beginno);
  1060. #ifdef LYFZ_VERSION
  1061. //sql+="***update dindan set [status]='"+status2+"' where [id]='"+id+"'";//旧文;
  1062. sql+="***update dindan set [status]=case when [status]<>'OK' then '"+status2+"' else [status] end"+" where [id]='"+id+"'";
  1063. #else
  1064. // dindan time2为拍照时间,在第一次ok时,这个时间不能再修改;
  1065. // Jeff.SQL参考例子:
  1066. // update dindan set time2='2014-06-28' where id='20140628-007' and isnull(time2,'')=''
  1067. #if 0 // 原.
  1068. if(jdpos==0)
  1069. sql+="***update dindan set [status]='"+status2+"',[waiter1]='"+waiter1+"',[waiter2]='"+waiter2+"',[time2]='"+g_date+"',[curno]='"+sbeginno+"' where [id]='"+id+"'";
  1070. else if(jdpos==1)
  1071. sql+="***update dindan set [status]='"+status2+"',[waiter12]='"+waiter1+"',[waiter22]='"+waiter2+"',[time2]='"+g_date+"',[curno]='"+sbeginno+"' where [id]='"+id+"'";
  1072. else if(jdpos==2)
  1073. sql+="***update dindan set [status]='"+status2+"',[waiter13]='"+waiter1+"',[waiter23]='"+waiter2+"',[time2]='"+g_date+"',[curno]='"+sbeginno+"' where [id]='"+id+"'";
  1074. else if(jdpos==3)
  1075. sql+="***update dindan set [status]='"+status2+"',[waiter14]='"+waiter1+"',[waiter24]='"+waiter2+"',[time2]='"+g_date+"',[curno]='"+sbeginno+"' where [id]='"+id+"'";
  1076. else
  1077. sql+="***update dindan set [status]='"+status2+"',[time2]='"+g_date+"',[curno]='"+sbeginno+"' where [id]='"+id+"'";
  1078. #else
  1079. //--------------------------------------------------------------------------
  1080. // Jeff.SQL参考语句示例:
  1081. // update dindan set time2=case when isnull(time2,'')='' then '2014-07-28' else time2 end , name2='OK',time3='2015-01-01',time1='2014-05-30' where id='20140628-007'
  1082. //
  1083. //---------------------------------------------------------------------
  1084. // printf("Jeff:拍照状态=%s\n\n",status2);
  1085. if (status2 != "OK") // !=ok,不记录拍照时间;--这样是否合理?
  1086. {
  1087. // 当数据库原本status不为OK时,可以修改时间和状态;否则状态和时间都不能修改,保持原样;
  1088. if (jdpos == 0)
  1089. sql += "***update dindan set [status]=case when [status]<>'OK' then '" + status2 + "' else [status] end,[waiter1]='" + waiter1 + "',[waiter2]='" + waiter2 + "',[curno]='" + sbeginno + "', [time2]=case when [status]<>'OK' then '" + g_date + "' else [time2] end" + " where [id]='" + strOrderNumber + "'";
  1090. else if (jdpos == 1)
  1091. sql += "***update dindan set [status]=case when [status]<>'OK' then '" + status2 + "' else [status] end,[waiter12]='" + waiter1 + "',[waiter22]='" + waiter2 + "',[curno]='" + sbeginno + "', [time2]=case when [status]<>'OK' then '" + g_date + "' else [time2] end" + " where [id]='" + strOrderNumber + "'";
  1092. else if (jdpos == 2)
  1093. sql += "***update dindan set [status]=case when [status]<>'OK' then '" + status2 + "' else [status] end,[waiter13]='" + waiter1 + "',[waiter23]='" + waiter2 + "',[curno]='" + sbeginno + "', [time2]=case when [status]<>'OK' then '" + g_date + "' else [time2] end" + " where [id]='" + strOrderNumber + "'";
  1094. else if (jdpos == 3)
  1095. sql += "***update dindan set [status]=case when [status]<>'OK' then '" + status2 + "' else [status] end,[waiter14]='" + waiter1 + "',[waiter24]='" + waiter2 + "',[curno]='" + sbeginno + "', [time2]=case when [status]<>'OK' then '" + g_date + "' else [time2] end" + " where [id]='" + strOrderNumber + "'";
  1096. else
  1097. sql += "***update dindan set [status]=case when [status]<>'OK' then '" + status2 + "' else [status] end,[curno]='" + sbeginno + "' where [id]='" + strOrderNumber + "'";
  1098. // printf("Jeff:拍照中,SQL=%s\n\n",sql);
  1099. }
  1100. else // ==ok时,才记录拍照时间;
  1101. {
  1102. /*if(jdpos==0)
  1103. sql+="***update dindan set [status]='"+status2+"',[waiter1]='"+waiter1+"',[waiter2]='"+waiter2+"',[curno]='"+sbeginno+ "', [time2]=case when isnull([time2],'')='' then '" +g_date+"' else [time2] end" + " where [id]='"+id+"'";
  1104. else if(jdpos==1)
  1105. sql+="***update dindan set [status]='"+status2+"',[waiter12]='"+waiter1+"',[waiter22]='"+waiter2+"',[curno]='"+sbeginno+ "', [time2]=case when isnull([time2],'')='' then '" +g_date+"' else [time2] end" +" where [id]='"+id+"'";
  1106. else if(jdpos==2)
  1107. sql+="***update dindan set [status]='"+status2+"',[waiter13]='"+waiter1+"',[waiter23]='"+waiter2+"',[curno]='"+sbeginno+ "', [time2]=case when isnull([time2],'')='' then '" +g_date+"' else [time2] end" + " where [id]='"+id+"'";
  1108. else if(jdpos==3)
  1109. sql+="***update dindan set [status]='"+status2+"',[waiter14]='"+waiter1+"',[waiter24]='"+waiter2+"',[curno]='"+sbeginno+ "', [time2]=case when isnull([time2],'')='' then '" +g_date+"' else [time2] end" + " where [id]='"+id+"'";
  1110. else
  1111. sql+="***update dindan set [status]='"+status2+"',[curno]='"+sbeginno+ "', [time2]=case when isnull([time2],'')='' then '" +g_date+"' else [time2] end" + " where [id]='"+id+"'";*/
  1112. // 当数据库原本status为OK时,不可修改时间;否则可以修改时间;
  1113. if (jdpos == 0)
  1114. sql += "***update dindan set [status]='" + status2 + "',[waiter1]='" + waiter1 + "',[waiter2]='" + waiter2 + "',[curno]='" + sbeginno + "', [time2]=case when [status]<>'OK' then '" + g_date + "' else [time2] end" + " where [id]='" + strOrderNumber + "'";
  1115. else if (jdpos == 1)
  1116. sql += "***update dindan set [status]='" + status2 + "',[waiter12]='" + waiter1 + "',[waiter22]='" + waiter2 + "',[curno]='" + sbeginno + "', [time2]=case when [status]<>'OK' then '" + g_date + "' else [time2] end" + " where [id]='" + strOrderNumber + "'";
  1117. else if (jdpos == 2)
  1118. sql += "***update dindan set [status]='" + status2 + "',[waiter13]='" + waiter1 + "',[waiter23]='" + waiter2 + "',[curno]='" + sbeginno + "', [time2]=case when [status]<>'OK' then '" + g_date + "' else [time2] end" + " where [id]='" + strOrderNumber + "'";
  1119. else if (jdpos == 3)
  1120. sql += "***update dindan set [status]='" + status2 + "',[waiter14]='" + waiter1 + "',[waiter24]='" + waiter2 + "',[curno]='" + sbeginno + "', [time2]=case when [status]<>'OK' then '" + g_date + "' else [time2] end" + " where [id]='" + strOrderNumber + "'";
  1121. else
  1122. sql += "***update dindan set [status]='" + status2 + "',[curno]='" + sbeginno + "', [time2]=case when isnull([time2],'')='' then '" + g_date + "' else [time2] end" + " where [id]='" + strOrderNumber + "'";
  1123. // printf("Jeff:拍照OK,SQL=%s\n\n",sql);
  1124. }
  1125. #endif
  1126. #endif
  1127. /////////////////////////
  1128. CString m_name1 = m_List1.GetItemText(iItem, 1 + m_nAdd);
  1129. CString m_name2 = m_List1.GetItemText(iItem, 2 + m_nAdd);
  1130. CString m_phone1 = m_List1.GetItemText(iItem, 14 + m_nAdd);
  1131. CString m_phone2 = m_List1.GetItemText(iItem, 15 + m_nAdd);
  1132. if (g_bAllBranch)
  1133. {
  1134. for (int i = 0; i < m_List1arrayBak.GetSize(); i++)
  1135. {
  1136. if (strOrderNumber == m_List1arrayBak.ElementAt(i).ElementAt(1) && branch == m_List1arrayBak.ElementAt(i).ElementAt(0))
  1137. {
  1138. m_phone1 = m_List1arrayBak.ElementAt(i).ElementAt(14 + m_nAdd);
  1139. m_phone2 = m_List1arrayBak.ElementAt(i).ElementAt(15 + m_nAdd);
  1140. }
  1141. }
  1142. }
  1143. else
  1144. {
  1145. for (int i = 0; i < m_List1arrayBak.GetSize(); i++)
  1146. {
  1147. if (strOrderNumber == m_List1arrayBak.ElementAt(i).ElementAt(0))
  1148. {
  1149. m_phone1 = m_List1arrayBak.ElementAt(i).ElementAt(14 + m_nAdd);
  1150. m_phone2 = m_List1arrayBak.ElementAt(i).ElementAt(15 + m_nAdd);
  1151. }
  1152. }
  1153. }
  1154. CString sql2;
  1155. BOOL msgcheck = atoi(g_cominfoarray.ElementAt(0).ElementAt(101));
  1156. CString msgcontent = g_cominfoarray.ElementAt(0).ElementAt(105);
  1157. if (status != "OK")msgcheck = 0;
  1158. #ifdef CHILD_VERSION
  1159. if(msgcheck )
  1160. {
  1161. CString m_content3 = msgcontent;
  1162. CString str,timestamp;
  1163. timestamp="msgtimestamp";
  1164. {
  1165. CString name;
  1166. if(!m_name1.IsEmpty ())
  1167. name=m_name1+",";
  1168. name+=m_name2;
  1169. name.TrimRight (",");
  1170. if(name.IsEmpty ()==0 && CheckPhoneType(m_phone1)!=-1 && CheckBadWords(name,0) )
  1171. {
  1172. str=name+m_content3;
  1173. str.Replace ("xxx小朋友", "");
  1174. int count=GetLengthEx(str)/MSG_LENGTH;
  1175. if(GetLengthEx(str)%MSG_LENGTH)
  1176. count++;
  1177. CString scount;
  1178. scount.Format ("%d", count);
  1179. #if JEFF_TEST_ON
  1180. sql2.Format(INSERT_SENDREG, _T("11"), m_phone1, str, timestamp, scount, _T("0"), _T("0"), _T("0"), _T("系统自动发送"));
  1181. sql += _T("***") + sql2;
  1182. #else
  1183. sql2="***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('"+m_phone1+"','"+str+"','"+timestamp+"','"+scount+"','0','0','0','系统自动发送')";
  1184. sql+=sql2;
  1185. #endif
  1186. }
  1187. }
  1188. }
  1189. #else
  1190. if (msgcheck)
  1191. {
  1192. CString m_content3 = msgcontent;
  1193. CString str, timestamp;
  1194. timestamp = "msgtimestamp";
  1195. int pos = m_content3.Find("xxx先生/女士");
  1196. if (pos != -1)
  1197. {
  1198. if (m_name1.IsEmpty() == 0 && CheckPhoneType(m_phone1) != -1 && CheckBadWords(m_name1, 0) )
  1199. {
  1200. str = m_content3;
  1201. str.Replace("xxx先生/女士", m_name1 + "先生");
  1202. int count = GetLengthEx(str) / MSG_LENGTH;
  1203. if (GetLengthEx(str) % MSG_LENGTH)
  1204. count++;
  1205. CString scount;
  1206. scount.Format("%d", count);
  1207. #if JEFF_TEST_ON
  1208. sql2.Format(INSERT_SENDREG, _T("11"), m_phone1, str, timestamp, scount, _T("0"), _T("0"), _T("0"), _T("系统自动发送"));
  1209. sql += _T("***") + sql2;
  1210. #else
  1211. sql2 = "***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('" + m_phone1 + "','" + str + "','" + timestamp + "','" + scount + "','0','0','0','系统自动发送')";
  1212. sql += sql2;
  1213. #endif
  1214. }
  1215. if (m_name2.IsEmpty() == 0 && CheckPhoneType(m_phone2) != -1 && CheckBadWords(m_name2, 0) )
  1216. {
  1217. str = m_content3;
  1218. str.Replace("xxx先生/女士", m_name2 + "女士");
  1219. int count = GetLengthEx(str) / MSG_LENGTH;
  1220. if (GetLengthEx(str) % MSG_LENGTH)
  1221. count++;
  1222. CString scount;
  1223. scount.Format("%d", count);
  1224. CTime tm = CTime::GetCurrentTime();
  1225. tm += CTimeSpan(0, 0, 0, 3);
  1226. timestamp = tm.Format("%Y%m%d%H%M%S");
  1227. timestamp = "msgtimexxstamp";
  1228. #if JEFF_TEST_ON
  1229. sql2.Format(INSERT_SENDREG, _T("11"), m_phone2, str, timestamp, scount, _T("0"), _T("0"), _T("0"), _T("系统自动发送"));
  1230. sql += _T("***") + sql2;
  1231. #else
  1232. sql2 = "***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('" + m_phone2 + "','" + str + "','" + timestamp + "','" + scount + "','0','0','0','系统自动发送')";
  1233. sql += sql2;
  1234. #endif
  1235. }
  1236. }
  1237. }
  1238. #endif
  1239. /////////////////////////
  1240. if (1)//拍照OK时记录客人预定内容
  1241. {
  1242. sql2 = "***gentakecontent:" + strOrderNumber;
  1243. sql += sql2;
  1244. }
  1245. g_sendhead.bsql = 1;
  1246. if (g_bAllBranch)
  1247. {
  1248. g_branchip = GetIP(branch);
  1249. g_pMainWnd->OnDisconnect();
  1250. g_branchname = branch;
  1251. g_bBranchModify = 1;
  1252. g_pMainWnd->ProcessChatMessageRequest2(sql);
  1253. g_pMainWnd->OnDisconnect();
  1254. g_bBranchModify = 0;
  1255. g_branchip = g_branchname = "";
  1256. }
  1257. else
  1258. g_pMainWnd->ProcessChatMessageRequest2(sql);
  1259. if (g_bSendOK == 0)
  1260. return;
  1261. AfxMessageBox("导入客照成功!", MB_ICONINFORMATION);
  1262. WriteLog(_T("拍照导入相片"));
  1263. if (g_bAllBranch == 0)
  1264. {
  1265. GetData();
  1266. }
  1267. else
  1268. {
  1269. BOOL bFind = 0;
  1270. for (int i = 0; i < m_List1array.GetSize(); i++)
  1271. {
  1272. if (bFind && m_List1array.ElementAt(i).ElementAt(1) != "")break;
  1273. if (strOrderNumber == m_List1array.ElementAt(i).ElementAt(1) && branch == m_List1array.ElementAt(i).ElementAt(0))
  1274. {
  1275. bFind = 1;
  1276. }
  1277. if (bFind && dindanjd == m_List1array.ElementAt(i).ElementAt(4))
  1278. {
  1279. m_List1array.ElementAt(i).SetAt(7 + m_nAdd, waiter1);
  1280. m_List1array.ElementAt(i).SetAt(8 + m_nAdd, waiter12);
  1281. m_List1array.ElementAt(i).SetAt(9 + m_nAdd, waiter2);
  1282. m_List1array.ElementAt(i).SetAt(10 + m_nAdd, waiter22);
  1283. m_List1array.ElementAt(i).SetAt(5 + m_nAdd, status);
  1284. m_List1array.ElementAt(i).SetAt(6 + m_nAdd, g_date);
  1285. m_List1array.ElementAt(i).SetAt(3 + m_nAdd, sbeginno);
  1286. FillGrid();
  1287. break;
  1288. }
  1289. }
  1290. }
  1291. }
  1292. void TakeFrom::OnBUTshowphoto() // 查看原片
  1293. {
  1294. POSITION pos;
  1295. pos = m_List1.GetFirstSelectedItemPosition();
  1296. if (pos == NULL)
  1297. {
  1298. AfxMessageBox("请先选中您要查看的定单!", MB_ICONINFORMATION);
  1299. return;
  1300. }
  1301. int iItem = m_List1.GetNextSelectedItem(pos);
  1302. CString dindanjd = m_List1.GetItemText(iItem, 4 + m_nAdd);
  1303. CString branch;
  1304. CString id = m_List1.GetItemText(iItem, 0 + m_nAdd);
  1305. if (g_bAllBranch)
  1306. branch = m_List1.GetItemText(iItem, 0);
  1307. while (id == "")
  1308. {
  1309. iItem--;
  1310. id = m_List1.GetItemText(iItem, 0 + m_nAdd);
  1311. }
  1312. CString name = m_List1.GetItemText(iItem, 1 + m_nAdd) + "," + m_List1.GetItemText(iItem, 2 + m_nAdd);
  1313. name.TrimLeft(",");
  1314. name.TrimRight(",");
  1315. name = "客人:" + name;
  1316. ShowPic dlg;
  1317. dlg.m_id = id;
  1318. dlg.m_name = name;
  1319. dlg.m_mode = 1;
  1320. if (g_bAllBranch)
  1321. {
  1322. dlg.m_branch = branch;
  1323. CString branchpath = GetBranchPhotoPath(branch);
  1324. dlg.m_path = g_path1 + branchpath + "\\";
  1325. }
  1326. else
  1327. dlg.m_path = g_path1 + "\\";
  1328. dlg.m_path += id;
  1329. dlg.m_path += "\\";
  1330. if (g_pMainWnd->IsCtrlDown() == 0 && g_pMainWnd->IsShiftDown() == 0 && dindanjd != "")
  1331. {
  1332. if (AfxMessageBox("是否查看全部景点?", MB_YESNO | MB_ICONINFORMATION) != IDYES)
  1333. {
  1334. if (dindanjd == "系统默认景点")
  1335. {
  1336. if (::PathFileExists(dlg.m_path + dindanjd))
  1337. {
  1338. dlg.m_path += dindanjd;
  1339. dlg.m_path += "\\";
  1340. }
  1341. }
  1342. else
  1343. {
  1344. dlg.m_path += dindanjd;
  1345. dlg.m_path += "\\";
  1346. }
  1347. }
  1348. }
  1349. else if (g_pMainWnd->IsCtrlDown())
  1350. {
  1351. if (dindanjd == "系统默认景点")
  1352. {
  1353. if (::PathFileExists(dlg.m_path + dindanjd))
  1354. {
  1355. dlg.m_path += dindanjd;
  1356. dlg.m_path += "\\";
  1357. }
  1358. }
  1359. else
  1360. {
  1361. dlg.m_path += dindanjd;
  1362. dlg.m_path += "\\";
  1363. }
  1364. }
  1365. dlg.DoModal();
  1366. if (dlg.m_bdelall)
  1367. {
  1368. for (int i = 0; i < m_List1array.GetSize(); i++)
  1369. {
  1370. if (g_bAllBranch)
  1371. {
  1372. if (id == m_List1array.ElementAt(i).ElementAt(1) && branch == m_List1array.ElementAt(i).ElementAt(0))
  1373. {
  1374. #if JEFF_TEST_ON // 全部删除后,这里显示的值应该为0;
  1375. m_List1array.ElementAt(i).SetAt(3 + m_nAdd, "0");
  1376. #else
  1377. m_List1array.ElementAt(i).SetAt(3 + m_nAdd, "1");
  1378. #endif
  1379. FillGrid();
  1380. break;
  1381. }
  1382. }
  1383. else
  1384. {
  1385. if (id == m_List1array.ElementAt(i).ElementAt(0))
  1386. {
  1387. #if JEFF_TEST_ON // 全部删除后,这里显示的值应该为0;
  1388. m_List1array.ElementAt(i).SetAt(3 + m_nAdd, "0");
  1389. #else
  1390. m_List1array.ElementAt(i).SetAt(3 + m_nAdd, "1");
  1391. #endif
  1392. FillGrid();
  1393. break;
  1394. }
  1395. }
  1396. }
  1397. }
  1398. }
  1399. void TakeFrom::OnBUTmoney() // 今拍 按钮;
  1400. {
  1401. // TODO: Add your control notification handler code here
  1402. UpdateData();
  1403. m_filter.TrimLeft();
  1404. m_filter.TrimRight();
  1405. FillGrid(2);
  1406. }
  1407. void TakeFrom::OnBTNaddsp()
  1408. {
  1409. }
  1410. void TakeFrom::OnItemchangedList2(NMHDR* pNMHDR, LRESULT* pResult)
  1411. {
  1412. NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
  1413. // TODO: Add your control notification handler code here
  1414. POSITION pos;
  1415. pos = m_List1.GetFirstSelectedItemPosition();
  1416. if (pos == NULL)
  1417. {
  1418. return;
  1419. }
  1420. int iItem = m_List1.GetNextSelectedItem(pos);
  1421. if (IsHasRights2new(4) || IsHasRights2new(49))
  1422. {
  1423. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(1);
  1424. }
  1425. else
  1426. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(0);
  1427. *pResult = 0;
  1428. }
  1429. void TakeFrom::OnButton1() // 查询按钮;
  1430. {
  1431. // TODO: Add your control notification handler code here
  1432. UpdateData();
  1433. m_filter.TrimLeft();
  1434. m_filter.TrimRight();
  1435. FillGrid();
  1436. }
  1437. void TakeFrom::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
  1438. {
  1439. // TODO: Add your control notification handler code here
  1440. POSITION pos;
  1441. pos = m_List1.GetFirstSelectedItemPosition();
  1442. if (pos == NULL)return;
  1443. int iItem = m_List1.GetNextSelectedItem(pos);
  1444. g_id = m_List1.GetItemText(iItem, 0 + m_nAdd);
  1445. while (g_id == "")
  1446. {
  1447. iItem--;
  1448. g_id = m_List1.GetItemText(iItem, 0 + m_nAdd);
  1449. }
  1450. *pResult = 0;
  1451. }
  1452. void TakeFrom::OnDblclkList2(NMHDR* pNMHDR, LRESULT* pResult)
  1453. {
  1454. // TODO: Add your control notification handler code here
  1455. OnBUTshowphoto();
  1456. *pResult = 0;
  1457. }
  1458. void TakeFrom::HidePrice()
  1459. {
  1460. m_List1arrayBak.RemoveAll();
  1461. m_List1arrayBak.SetSize(m_List1array.GetSize());
  1462. for (int i = 0; i < m_List1array.GetSize(); i++)
  1463. {
  1464. m_List1arrayBak.ElementAt(i).Copy(m_List1array.ElementAt(i));
  1465. }
  1466. #ifdef LKAY_VERSION
  1467. if(IsHasRights2new(31))return;
  1468. for( i=0; i<m_List1array.GetSize (); i++)
  1469. {
  1470. m_List1array.ElementAt (i).SetAt (11+m_nAdd, "***");
  1471. m_List1array.ElementAt (i).SetAt (12+m_nAdd, "***");
  1472. m_List1array.ElementAt (i).SetAt (13+m_nAdd, "***");
  1473. m_List1array.ElementAt (i).SetAt (14+m_nAdd, "***");
  1474. }
  1475. #else
  1476. if (IsHasRights2new(31))return;
  1477. for (i = 0; i < m_List1array.GetSize(); i++)
  1478. {
  1479. m_List1array.ElementAt(i).SetAt(13 + m_nAdd, "***");
  1480. m_List1array.ElementAt(i).SetAt(14 + m_nAdd, "***");
  1481. }
  1482. #endif
  1483. }
  1484. void TakeFrom::OnBtnsearchfilter() // 条件查询按钮;
  1485. {
  1486. SearchFilter dlg;
  1487. dlg.m_mode = 0;
  1488. if (dlg.DoModal() == IDOK)
  1489. FillGrid();
  1490. g_bSearchFilter = 0;
  1491. }
  1492. void TakeFrom::OnBUTprint3()
  1493. {
  1494. GetData();
  1495. }
  1496. void TakeFrom::OnButton2() // 客人头像按钮;
  1497. {
  1498. POSITION pos;
  1499. pos = m_List1.GetFirstSelectedItemPosition();
  1500. if (pos == NULL)
  1501. {
  1502. AfxMessageBox("请先选中您要拍头像的客人!", MB_ICONINFORMATION);
  1503. return;
  1504. }
  1505. int iItem = m_List1.GetNextSelectedItem(pos);
  1506. CString branch;
  1507. CString id = m_List1.GetItemText(iItem, 0 + m_nAdd);
  1508. if (g_bAllBranch)
  1509. branch = m_List1.GetItemText(iItem, 0);
  1510. while (id == "")
  1511. {
  1512. iItem--;
  1513. id = m_List1.GetItemText(iItem, 0 + m_nAdd);
  1514. }
  1515. UploadPhoto dlg;
  1516. if (g_bAllBranch)
  1517. {
  1518. CString branchpath = GetBranchPhotoPath(branch);
  1519. dlg.m_path = g_path1 + branchpath + "\\";
  1520. if (::CheckFolderFileExist(dlg.m_path) == 0)
  1521. ::CreateDirectory(dlg.m_path, NULL);
  1522. }
  1523. else
  1524. dlg.m_path = g_path1 + "\\";
  1525. dlg.m_path += "客人头像\\";
  1526. if (::CheckFolderFileExist(dlg.m_path) == 0)
  1527. ::CreateDirectory(dlg.m_path, NULL);
  1528. dlg.m_path += id + "\\";
  1529. if (::CheckFolderFileExist(dlg.m_path) == 0)
  1530. ::CreateDirectory(dlg.m_path, NULL);
  1531. dlg.DoModal();
  1532. }
  1533. void TakeFrom::GetData()
  1534. {
  1535. if (g_bAllBranch == 0)
  1536. {
  1537. if (g_bShowOK == 0)
  1538. {
  1539. #ifdef LKAY_VERSION
  1540. CString filter="status3='未取' and (dindantype<>'意向客户' or dindantype is null)";
  1541. #else
  1542. CString filter = "status3='未取'";
  1543. #endif
  1544. g_sendhead.bsql = 0;
  1545. g_sendhead.code[0] = 25; // Jeff.case 25对应的表为takeview视图:订单景点表;
  1546. g_sendhead.tabcount = 1;
  1547. g_pMainWnd->ProcessChatMessageRequest2(filter);
  1548. if (g_bSendOK == 0)return;
  1549. }
  1550. else
  1551. {
  1552. g_sendhead.bsql = 0;
  1553. g_sendhead.code[0] = 25; // Jeff.case 25对应的表为takeview视图:订单景点表;
  1554. g_sendhead.tabcount = 1;
  1555. #ifdef LKAY_VERSION
  1556. CString filter="dindantype<>'意向客户' or dindantype is null";
  1557. g_pMainWnd->ProcessChatMessageRequest2(filter);
  1558. #else
  1559. g_pMainWnd->ProcessChatMessageRequest2(1);
  1560. #endif
  1561. if (g_bSendOK == 0)return;
  1562. }
  1563. DataToArray(&m_List1array);
  1564. }
  1565. else
  1566. {
  1567. //////////////数据汇总
  1568. m_List1array.RemoveAll();
  1569. CString branch;
  1570. for (int i = -1; i < g_brancharray.GetSize() - 1; i++)
  1571. {
  1572. if (i != -1)
  1573. {
  1574. branch = g_brancharray.ElementAt(i).ElementAt(0);
  1575. g_branchip = g_brancharray.ElementAt(i).ElementAt(1);
  1576. g_pMainWnd->OnDisconnect();
  1577. g_branchname = branch;
  1578. g_bBranchModify = 1;
  1579. }
  1580. else
  1581. branch = g_brancharray.ElementAt(g_brancharray.GetSize() - 1).ElementAt(0);
  1582. if (g_bShowOK == 0)
  1583. {
  1584. CString filter = "status3='未取'";
  1585. g_sendhead.bsql = 0;
  1586. g_sendhead.code[0] = 25; // Jeff.case 25对应的表为takeview视图:订单景点表;
  1587. g_sendhead.tabcount = 1;
  1588. g_pMainWnd->ProcessChatMessageRequest2(filter);
  1589. if (g_bSendOK == 0) continue;
  1590. }
  1591. else
  1592. {
  1593. g_sendhead.bsql = 0;
  1594. g_sendhead.code[0] = 25; // Jeff.case 25对应的表为takeview视图:订单景点表;
  1595. g_sendhead.tabcount = 1;
  1596. g_pMainWnd->ProcessChatMessageRequest2(1);
  1597. if (g_bSendOK == 0) continue;
  1598. }
  1599. CArray<CStringArray, CStringArray>List1array;
  1600. DataToArray(&List1array);
  1601. int size = m_List1array.GetSize();
  1602. for (int j = 0; j < List1array.GetSize(); j++)
  1603. {
  1604. size++;
  1605. m_List1array.SetSize(size, 1);
  1606. size--;
  1607. m_List1array.ElementAt(size).Copy(List1array.ElementAt(j));
  1608. m_List1array.ElementAt(size).InsertAt(0, branch);
  1609. size++;
  1610. }
  1611. }
  1612. g_pMainWnd->OnDisconnect();
  1613. g_bBranchModify = 0;
  1614. g_branchip = g_branchname = "";
  1615. }
  1616. HidePrice();
  1617. FillGrid();
  1618. }
  1619. void TakeFrom::OnBnClickedMicroshare() // 微分享;
  1620. {
  1621. // 定义变量;
  1622. CString strOrderNumber = _T(""); // 订单号;
  1623. CString strScenery = _T(""); // 景点名;
  1624. CString strCustomer = _T(""); // 顾客姓名;
  1625. CString strMakeupArtist = _T(""); // 化妆师;
  1626. CString strSourcePath = _T(""); // 相片根目录;
  1627. CString strBranchName = _T(""); // 分店名;
  1628. CString strBranchDomain = _T(""); // 分店域名;
  1629. TCHAR szShareId[MAX_PATH] = _T(""); // 微分享相册ID;
  1630. // 获取变量值;
  1631. POSITION pos;
  1632. pos = m_List1.GetFirstSelectedItemPosition();
  1633. if (pos == NULL)
  1634. {
  1635. AfxMessageBox("请先选中您要查看的定单!", MB_ICONINFORMATION);
  1636. return;
  1637. }
  1638. int iItem = m_List1.GetNextSelectedItem(pos);
  1639. strScenery = m_List1.GetItemText(iItem, 4 + m_nAdd);
  1640. strMakeupArtist = m_List1.GetItemText(iItem, 9 + m_nAdd);
  1641. strOrderNumber = m_List1.GetItemText(iItem, 0 + m_nAdd);
  1642. if (g_bAllBranch)
  1643. strBranchName = m_List1.GetItemText(iItem, 0);
  1644. while (strOrderNumber == "")
  1645. {
  1646. iItem--;
  1647. strOrderNumber = m_List1.GetItemText(iItem, 0 + m_nAdd);
  1648. }
  1649. if (g_bAllBranch)
  1650. {
  1651. strBranchDomain = GetBranchPhotoPath(strBranchName);
  1652. strSourcePath = g_path1 + strBranchDomain + "\\";
  1653. }
  1654. else
  1655. {
  1656. strSourcePath = g_path1 + "\\";
  1657. }
  1658. strSourcePath += strOrderNumber;
  1659. strSourcePath += "\\";
  1660. if (AfxMessageBox("是否查看全部景点?", MB_YESNO | MB_ICONINFORMATION) != IDYES)
  1661. {
  1662. if (::PathFileExists(strSourcePath + strScenery))
  1663. {
  1664. strSourcePath += strScenery;
  1665. strSourcePath += "\\";
  1666. }
  1667. }
  1668. // 加载动态库;
  1669. if (LoadMicroShareLibrary() == FALSE)
  1670. return;
  1671. if ( g_lyfzCreateShare )
  1672. {
  1673. g_lyfzCreateShare(
  1674. g_cominfoarray.ElementAt(0).ElementAt(147), // 微分享的登录账号;
  1675. g_cominfoarray.ElementAt(0).ElementAt(148), // 微分享的登录账号密码;
  1676. g_path1, // 相片根级目录;
  1677. strBranchDomain, // 分店域名;
  1678. strOrderNumber, // 订单号,用于生成二维码文件名;
  1679. strScenery, // 景点名;
  1680. strSourcePath,
  1681. m_List1.GetItemText(iItem, 1 + m_nAdd), // 客人姓名1 ;
  1682. m_List1.GetItemText(iItem, 2 + m_nAdd), // 客人姓名2
  1683. strMakeupArtist, // 化妆师;
  1684. szShareId // 返回微相册ID;
  1685. );
  1686. }
  1687. FreeMicroShareLibrary();
  1688. }