Booking.cpp 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930
  1. // Booking.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "Booking.h"
  6. #include "MyMdi.H"
  7. #include "ClientDlg.h"
  8. #include "ClientDlg2.h"
  9. #include "SetStyle.h"
  10. #include "InputMemberno.h"
  11. #include "SelMemberType.h"
  12. #include "AddMember.h"
  13. #include "InputCard2Dlg.h"
  14. #include "SPLBDlg.h"
  15. #ifdef _DEBUG
  16. #define new DEBUG_NEW
  17. #undef THIS_FILE
  18. static char THIS_FILE[] = __FILE__;
  19. #endif
  20. /////////////////////////////////////////////////////////////////////////////
  21. // Booking pinyin1 IDC_STATIC2
  22. IMPLEMENT_DYNCREATE(Booking, MyFormView)
  23. Booking::Booking()
  24. : MyFormView(Booking::IDD)
  25. {
  26. //{{AFX_DATA_INIT(Booking)
  27. m_taoxijiage = _T("");
  28. m_zs = _T("");
  29. m_discount = _T("");
  30. m_money1 = _T("");
  31. m_money2 = _T("");
  32. m_money3 = _T("");
  33. m_name1 = _T("");
  34. m_name2 = _T("");
  35. m_payed1 = _T("");
  36. m_payed2 = _T("");
  37. m_payed3 = _T("");
  38. m_payed4 = _T("");
  39. m_payed5 = _T("");
  40. m_time1 = g_date;
  41. m_time2 = _T("");
  42. m_time3 = _T("");
  43. m_bz = _T("");
  44. m_clothescount = _T("");
  45. m_clothescount2 = _T("");
  46. m_outside = _T("");
  47. m_outside2 = _T("");
  48. m_style = _T("");
  49. m_choosephotomoney = _T("");
  50. m_takephotomoney = _T("");
  51. m_waiter6 = g_user.name;
  52. m_nFocusPos = 0;
  53. m_cost1 = m_cost2 = 0;
  54. //}}AFX_DATA_INIT
  55. }
  56. Booking::~Booking()
  57. {
  58. }
  59. void Booking::DoDataExchange(CDataExchange* pDX)
  60. {
  61. MyFormView::DoDataExchange(pDX);
  62. //{{AFX_DATA_MAP(Booking)
  63. DDX_Control(pDX, IDC_LIST9, m_listbox1);
  64. DDX_Control(pDX, IDC_EDITzs, m_numedit4);
  65. DDX_Control(pDX, IDC_EDITtaoxijiage, m_numedit3);
  66. DDX_Control(pDX, IDC_EDITtime3, m_datectrl2);
  67. DDX_Control(pDX, IDC_EDITtime2, m_datectrl1);
  68. DDX_Control(pDX, IDC_EDITtime1, m_datectrl3);
  69. DDX_Control(pDX, IDC_EDITpayed1, m_edit2);
  70. DDX_Control(pDX, IDC_EDITdiscount, m_edit1);
  71. DDX_Control(pDX, IDC_COMBObm, m_combobm);
  72. DDX_Control(pDX, IDC_COMBOarea, m_comboarea);
  73. DDX_Control(pDX, IDC_COMBOtype2, m_combotype);
  74. DDX_Control(pDX, IDC_COMBOrenyuan, m_comborenyuan);
  75. DDX_Control(pDX, IDC_COMBOid, m_comboid);
  76. DDX_Control(pDX, IDC_LIST3, m_List3);
  77. DDX_Control(pDX, IDC_LIST1, m_List1);
  78. DDX_Control(pDX, IDC_STATIC1, m_static1);
  79. DDX_Control(pDX, IDC_COMBOtaoxiname, m_combotaoxiname);
  80. DDX_Text(pDX, IDC_EDITtaoxijiage, m_taoxijiage);
  81. DDX_Text(pDX, IDC_EDITzs, m_zs);
  82. DDX_Text(pDX, IDC_EDITdiscount, m_discount);
  83. DDX_Text(pDX, IDC_EDITmoney1, m_money1);
  84. DDX_Text(pDX, IDC_EDITmoney2, m_money2);
  85. DDX_Text(pDX, IDC_EDITmoney3, m_money3);
  86. DDX_Text(pDX, IDC_EDITname1, m_name1);
  87. DDX_Text(pDX, IDC_EDITname2, m_name2);
  88. DDX_Text(pDX, IDC_EDITpayed1, m_payed1);
  89. DDX_Text(pDX, IDC_EDITpayed2, m_payed2);
  90. DDX_Text(pDX, IDC_EDITpayed3, m_payed3);
  91. DDX_Text(pDX, IDC_EDITpayed4, m_payed4);
  92. DDX_Text(pDX, IDC_EDITpayed5, m_payed5);
  93. DDX_Text(pDX, IDC_EDITtime1, m_time1);
  94. DDX_Text(pDX, IDC_EDITtime2, m_time2);
  95. DDX_Text(pDX, IDC_EDITtime3, m_time3);
  96. DDX_Text(pDX, IDC_EDITbz, m_bz);
  97. DDV_MaxChars(pDX, m_bz, 1000);
  98. DDX_Text(pDX, IDC_EDITOclothescount, m_clothescount);
  99. DDX_Text(pDX, IDC_EDITOclothescount2, m_clothescount2);
  100. DDX_Text(pDX, IDC_EDITOoutside, m_outside);
  101. DDX_Text(pDX, IDC_EDITOoutside2, m_outside2);
  102. DDX_Text(pDX, IDC_EDITwaiter6, m_memberno);
  103. //}}AFX_DATA_MAP
  104. }
  105. BEGIN_MESSAGE_MAP(Booking, MyFormView)
  106. //{{AFX_MSG_MAP(Booking)
  107. ON_BN_CLICKED(IDC_BUTsave, OnBUTsave)
  108. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  109. ON_CBN_SELCHANGE(IDC_COMBOtaoxiname, OnSelchangeCOMBOtaoxiname)
  110. ON_BN_CLICKED(IDC_BUTspbox, OnBUTspbox)
  111. ON_WM_TIMER()
  112. ON_EN_CHANGE(IDC_EDITtaoxijiage, OnChangeEDITtaoxijiage)
  113. ON_EN_CHANGE(IDC_EDITdiscount, OnChangeEDITdiscount)
  114. ON_EN_CHANGE(IDC_EDITpayed1, OnChangeEDITpayed1)
  115. ON_CBN_DROPDOWN(IDC_COMBObm, OnDropdownCOMBObm)
  116. ON_CBN_DROPDOWN(IDC_COMBOrenyuan, OnDropdownCOMBOrenyuan)
  117. ON_CBN_SELCHANGE(IDC_COMBObm, OnSelchangeCOMBObm)
  118. ON_CBN_DROPDOWN(IDC_COMBOid, OnDropdownCOMBOid)
  119. ON_CBN_SELCHANGE(IDC_COMBOid, OnSelchangeCOMBOid)
  120. ON_BN_CLICKED(IDC_BUTWaiter, OnBUTWaiter)
  121. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  122. ON_BN_CLICKED(IDC_BUTprint, OnBUTprint)
  123. ON_BN_CLICKED(IDC_BUTstyle, OnBUTstyle)
  124. ON_BN_CLICKED(IDC_BUTdel, OnBUTdel)
  125. ON_BN_CLICKED(IDC_BUTdelall, OnBUTdelall)
  126. ON_BN_CLICKED(IDC_BUTspbox2, OnBUTspbox2)
  127. ON_BN_CLICKED(IDC_BUTdel3, OnBUTdel3)
  128. ON_BN_CLICKED(IDC_BUTdelall2, OnBUTdelall2)
  129. ON_BN_CLICKED(IDC_BUTaddjd, OnBUTaddjd)
  130. ON_BN_CLICKED(IDC_BUTdeljd, OnBUTdeljd)
  131. ON_BN_CLICKED(IDC_BUTinfo1, OnBUTinfo1)
  132. ON_BN_CLICKED(IDC_BUTinfo2, OnBUTinfo2)
  133. ON_BN_CLICKED(IDC_BUTinfo3, OnBUTinfo3)
  134. //}}AFX_MSG_MAP
  135. END_MESSAGE_MAP()
  136. /////////////////////////////////////////////////////////////////////////////
  137. // Booking diagnostics
  138. #ifdef _DEBUG
  139. void Booking::AssertValid() const
  140. {
  141. MyFormView::AssertValid();
  142. }
  143. void Booking::Dump(CDumpContext& dc) const
  144. {
  145. MyFormView::Dump(dc);
  146. }
  147. #endif //_DEBUG
  148. /////////////////////////////////////////////////////////////////////////////
  149. // Booking message handlers
  150. void Booking::OnInitialUpdate()
  151. {
  152. MyFormView::OnInitialUpdate();
  153. #ifdef NOCALCOST
  154. GetDlgItem(IDC_STATIC2)->ShowWindow(SW_HIDE);
  155. GetDlgItem(IDC_STATIC4)->ShowWindow(SW_HIDE);
  156. #endif
  157. #ifndef CHILD_VERSION
  158. #ifndef ZHIAI_VERSION
  159. GetDlgItem(IDC_STATIC10)->SetWindowText("服装套数:");
  160. GetDlgItem(IDC_STATIC11)->SetWindowText("造型:");
  161. GetDlgItem(IDC_STATIC12)->SetWindowText("外景:");
  162. GetDlgItem(IDC_STATIC13)->SetWindowText("内景:");
  163. #endif
  164. #endif
  165. // TODO: Add your specialized code here and/or call the base class
  166. CMyMdi Mdi;
  167. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  168. // Here we create the outbar control using the splitter as its parent
  169. // and setting its id to the first pane.
  170. CRect rc2;
  171. GetWindowRect(rc2);
  172. ::MoveWindow(m_hWnd, g_rc.left, g_rc.top, g_rc.Width(), g_rc.Height(), TRUE);
  173. EnumChildWindows(m_hWnd, (WNDENUMPROC)EnumChildProc, 0);
  174. m_combotype.AddString("婚纱照");
  175. m_combotype.AddString("写真照");
  176. m_combotype.AddString("宝宝照");
  177. m_combotype.AddString("全家福");
  178. m_combotype.AddString("情侣照");
  179. m_combotaoxiname.GetWindowRect(rc2);
  180. ScreenToClient(rc2);
  181. rc2.bottom += 200;
  182. m_combotaoxiname.MoveWindow(rc2);
  183. m_combobm.GetWindowRect(rc2);
  184. ScreenToClient(rc2);
  185. rc2.bottom += 200;
  186. m_combobm.MoveWindow(rc2);
  187. m_combotype.GetWindowRect(rc2);
  188. ScreenToClient(rc2);
  189. rc2.bottom += 200;
  190. m_combotype.MoveWindow(rc2);
  191. m_comborenyuan.GetWindowRect(rc2);
  192. ScreenToClient(rc2);
  193. rc2.bottom += 200;
  194. m_comborenyuan.MoveWindow(rc2);
  195. m_comboid.GetWindowRect(rc2);
  196. ScreenToClient(rc2);
  197. rc2.bottom += 600;
  198. m_comboid.MoveWindow(rc2);
  199. #ifdef ZHIAI_VERSION
  200. GetDlgItem(IDC_EDITOoutside)->GetWindowRect(rc2);
  201. GetDlgItem(IDC_EDITOoutside)->ShowWindow(0);
  202. ScreenToClient(rc2);
  203. m_comboarea.MoveWindow (rc2);
  204. m_comboarea.GetWindowRect (rc2);
  205. ScreenToClient(rc2);
  206. rc2.bottom +=600;
  207. m_comboarea.MoveWindow (rc2);
  208. #else
  209. m_comboarea.ShowWindow(0);
  210. #endif
  211. GetDlgItem(IDC_EDITmoney1)->GetWindowRect(rc2);
  212. SetComboHei(&m_comboid, rc2.Height());
  213. SetComboHei(&m_comborenyuan, rc2.Height());
  214. SetComboHei(&m_combotaoxiname, rc2.Height());
  215. SetComboHei(&m_combobm, rc2.Height());
  216. SetComboHei(&m_combotype, rc2.Height());
  217. SetComboHei(&m_comboarea, rc2.Height());
  218. m_static1.SetFont(&g_titlefont);
  219. int i;
  220. #ifdef ZHIAI_VERSION
  221. g_sendhead.bsql=0;
  222. g_sendhead.code[0]=6;
  223. g_sendhead.code[1]=7;
  224. g_sendhead.code[2]=10;
  225. g_sendhead.code[3]=4;
  226. g_sendhead.code[4]=82;
  227. g_sendhead.tabcount=5;
  228. g_pMainWnd->ProcessChatMessageRequest2(6);if(g_bSendOK==0)return;
  229. CArray<CStringArray, CStringArray>areaarray;
  230. DataToArray(&m_List1array, &m_List2array, &m_List3array, &m_sparray, &areaarray);
  231. for( i=0; i<areaarray.GetSize(); i++)
  232. {
  233. m_comboarea.AddString(areaarray.ElementAt(i).ElementAt(0));
  234. }
  235. #else
  236. g_sendhead.bsql = 0;
  237. g_sendhead.code[0] = 6;
  238. g_sendhead.code[1] = 7;
  239. g_sendhead.code[2] = 10;
  240. g_sendhead.code[3] = 4;
  241. g_sendhead.tabcount = 4;
  242. g_pMainWnd->ProcessChatMessageRequest2(6); if (g_bSendOK == 0)return;
  243. DataToArray(&m_List1array, &m_List2array, &m_List3array, &m_sparray);
  244. #endif
  245. for (i = 0; i < m_List1array.GetSize(); i++)
  246. m_combotaoxiname.AddString(m_List1array.ElementAt(i).ElementAt(1));
  247. m_List1.InitStyle();
  248. m_List1.InsertColumn(0, _T("编号"), LVCFMT_LEFT, 45);
  249. m_List1.InsertColumn(1, _T("商品名称"), LVCFMT_LEFT, 200);
  250. m_List1.InsertColumn(2, _T("价格"), LVCFMT_LEFT, 60);
  251. m_List1.InsertColumn(3, _T("数量"), LVCFMT_LEFT, 45);
  252. m_List1.InsertColumn(4, _T("加急"), LVCFMT_LEFT, 45);
  253. m_List1.InsertColumn(5, _T("取件日期"), LVCFMT_LEFT, 90);
  254. m_List3.InitStyle();
  255. m_List3.InsertColumn(0, _T("编号"), LVCFMT_LEFT, 45);
  256. m_List3.InsertColumn(1, _T("商品名称"), LVCFMT_LEFT, 235);
  257. m_List3.InsertColumn(2, _T("价格"), LVCFMT_LEFT, 60);
  258. m_List3.InsertColumn(3, _T("数量"), LVCFMT_LEFT, 45);
  259. CRect rc;
  260. GetDlgItem(IDC_STATIC5)->GetWindowRect(rc);
  261. ScreenToClient(rc);
  262. OnBUTinfo1();
  263. rc2 = rc;
  264. rc2.bottom = rc2.top;
  265. rc2.top -= 1;
  266. GetDlgItem(IDC_STATIC6)->MoveWindow(rc2);
  267. rc2 = rc;
  268. rc2.top = rc2.bottom;
  269. rc2.bottom += 1;
  270. GetDlgItem(IDC_STATIC7)->MoveWindow(rc2);
  271. }
  272. void Booking::OnSelchangeCOMBOtaoxiname()
  273. {
  274. // TODO: Add your control notification handler code here
  275. UpdateData();
  276. int pos = m_combotaoxiname.GetCurSel();
  277. if (pos == -1)return;
  278. m_combotaoxiname.GetLBText(pos, taoxiname);
  279. pos = -1;
  280. for (int i = 0; i < m_List1array.GetSize(); i++)
  281. {
  282. if (taoxiname == m_List1array.ElementAt(i).ElementAt(1))
  283. {
  284. pos = i;
  285. break;
  286. }
  287. }
  288. if (pos == -1)
  289. {
  290. m_taoxiid = "";
  291. m_taoxijiage = "";
  292. m_zs = "";
  293. UpdateData(false);
  294. OnChangeEDITtaoxijiage();
  295. m_List1.DeleteAllItems();
  296. return;
  297. }
  298. m_taoxiid = m_List1array.ElementAt(pos).ElementAt(0);
  299. m_taoxijiage = m_List1array.ElementAt(pos).ElementAt(2);
  300. m_zs = m_List1array.ElementAt(pos).ElementAt(3);
  301. UpdateData(false);
  302. OnChangeEDITtaoxijiage();
  303. FillGrid();
  304. }
  305. void Booking::FillGrid()
  306. {
  307. m_List1.DeleteAllItems();
  308. m_List3.DeleteAllItems();
  309. int pos = 0;
  310. int i = 0;
  311. for ( i = 0; i < m_List2array.GetSize(); i++)
  312. {
  313. if (m_List2array.ElementAt(i).ElementAt(0) != m_taoxiid)continue;
  314. m_List1.InsertItem(pos, m_List2array.ElementAt(i).ElementAt(1));
  315. m_List1.SetItemText(pos, 1, GetSPNameFromId(m_List2array.ElementAt(i).ElementAt(1)));
  316. m_List1.SetItemText(pos, 2, GetSPPriceFromId2(m_List2array.ElementAt(i).ElementAt(1)));
  317. m_List1.SetItemText(pos, 3, m_List2array.ElementAt(i).ElementAt(2));
  318. pos++;
  319. }
  320. pos = 0;
  321. for (i = 0; i < m_List3array.GetSize(); i++)
  322. {
  323. if (m_List3array.ElementAt(i).ElementAt(0) != m_taoxiid)continue;
  324. m_List3.InsertItem(pos, m_List3array.ElementAt(i).ElementAt(1));
  325. m_List3.SetItemText(pos, 1, GetSPNameFromId(m_List3array.ElementAt(i).ElementAt(1)));
  326. m_List3.SetItemText(pos, 2, GetSPPriceFromId2(m_List3array.ElementAt(i).ElementAt(1)));
  327. m_List3.SetItemText(pos, 3, m_List3array.ElementAt(i).ElementAt(2));
  328. pos++;
  329. }
  330. CalculateCost();
  331. }
  332. float Booking::GetSPPriceFromId(CString id)
  333. {
  334. for (int i = 0; i < m_sparray.GetSize(); i++)
  335. {
  336. if (id == m_sparray.ElementAt(i).ElementAt(0))
  337. return atof(m_sparray.ElementAt(i).ElementAt(3));
  338. }
  339. return 0;
  340. }
  341. float Booking::GetSPPriceFromId3(CString id)
  342. {
  343. for (int i = 0; i < m_sparray.GetSize(); i++)
  344. {
  345. if (id == m_sparray.ElementAt(i).ElementAt(0))
  346. return atof(m_sparray.ElementAt(i).ElementAt(4));
  347. }
  348. return 0;
  349. }
  350. CString Booking::GetSPPriceFromId2(CString id)
  351. {
  352. for (int i = 0; i < m_sparray.GetSize(); i++)
  353. {
  354. if (id == m_sparray.ElementAt(i).ElementAt(0))
  355. return m_sparray.ElementAt(i).ElementAt(4);
  356. }
  357. return "";
  358. }
  359. CString Booking::GetSPNameFromId(CString id)
  360. {
  361. int i = 0;
  362. for ( i = 0; i < m_sparray.GetSize(); i++)
  363. {
  364. if (id == m_sparray.ElementAt(i).ElementAt(0))
  365. return m_sparray.ElementAt(i).ElementAt(1);
  366. }
  367. id.TrimLeft("0");
  368. for (i = 0; i < m_sparray.GetSize(); i++)
  369. {
  370. if (id == m_sparray.ElementAt(i).ElementAt(0))
  371. return m_sparray.ElementAt(i).ElementAt(1);
  372. }
  373. return "";
  374. }
  375. BOOL Booking::PreTranslateMessage(MSG* pMsg)
  376. {
  377. // TODO: Add your specialized code here and/or call the base class
  378. if (pMsg->message == WM_KEYDOWN)
  379. {
  380. switch (pMsg->wParam)
  381. {
  382. case 0x43: // copy
  383. if ((GetKeyState(VK_CONTROL) & 0x80))
  384. {
  385. GetFocus()->SendMessage(WM_COPY);
  386. return TRUE;
  387. }
  388. break;
  389. case 0x56: //Ctrl + V:
  390. if ((GetKeyState(VK_CONTROL) & 0x80))
  391. {
  392. GetFocus()->SendMessage(WM_PASTE);
  393. return TRUE;
  394. }
  395. break;
  396. case 0x58: // cut
  397. if ((GetKeyState(VK_CONTROL) & 0x80))
  398. {
  399. GetFocus()->SendMessage(WM_CUT);
  400. return TRUE;
  401. }
  402. break;
  403. case 0x5A: //undo
  404. case 0x59: //redo
  405. if ((GetKeyState(VK_CONTROL) & 0x80))
  406. {
  407. GetFocus()->SendMessage(WM_UNDO);
  408. return TRUE;
  409. }
  410. break;
  411. }
  412. }
  413. else if (0)//pMsg->message==WM_LBUTTONDBLCLK)
  414. {
  415. {//list1
  416. CPoint pt;
  417. CRect rc, rc2;
  418. ::GetCursorPos(&pt);
  419. m_List1.GetWindowRect(rc2);
  420. if (rc2.PtInRect(pt) == 0)
  421. goto mm;
  422. pt.x -= rc2.left;
  423. pt.y -= rc2.top;
  424. POSITION pos;
  425. pos = m_List1.GetFirstSelectedItemPosition();
  426. if (pos == NULL)return 1;
  427. int iItem = m_List1.GetNextSelectedItem(pos);
  428. {
  429. m_List1.GetSubItemRect(iItem, 3, LVIR_BOUNDS, rc);
  430. if (rc.PtInRect(pt))
  431. return MyFormView::PreTranslateMessage(pMsg);
  432. else
  433. return 1;
  434. }
  435. }
  436. mm: {//list3
  437. CPoint pt;
  438. CRect rc, rc2;
  439. ::GetCursorPos(&pt);
  440. m_List3.GetWindowRect(rc2);
  441. if (rc2.PtInRect(pt) == 0)
  442. return MyFormView::PreTranslateMessage(pMsg);
  443. pt.x -= rc2.left;
  444. pt.y -= rc2.top;
  445. POSITION pos;
  446. pos = m_List3.GetFirstSelectedItemPosition();
  447. if (pos == NULL)return 1;
  448. int iItem = m_List3.GetNextSelectedItem(pos);
  449. m_List3.GetSubItemRect(iItem, 3, LVIR_BOUNDS, rc);
  450. if (rc.PtInRect(pt))
  451. return MyFormView::PreTranslateMessage(pMsg);
  452. else
  453. return 1;
  454. }
  455. }
  456. if (0)//pMsg->message==WM_LBUTTONDOWN)
  457. {
  458. {//list1
  459. CPoint pt;
  460. CRect rc, rc2;
  461. ::GetCursorPos(&pt);
  462. m_List1.GetWindowRect(rc2);
  463. if (rc2.PtInRect(pt) == 0)
  464. goto oo;
  465. m_nFocusPos = 0;
  466. SetTimer(1, 300, NULL);
  467. goto oo;
  468. }
  469. nn:
  470. oo : {//list3
  471. CPoint pt;
  472. CRect rc, rc2;
  473. ::GetCursorPos(&pt);
  474. m_List3.GetWindowRect(rc2);
  475. if (rc2.PtInRect(pt) == 0) return MyFormView::PreTranslateMessage(pMsg);
  476. SetTimer(3, 300, NULL);
  477. }
  478. }
  479. return MyFormView::PreTranslateMessage(pMsg);
  480. }
  481. void Booking::SetSPName1()
  482. {
  483. CString str;
  484. for (int i = 0; i < m_List1.GetItemCount(); i++)
  485. {
  486. if (GetSPNameFromId(m_List1.GetItemText(i, 0)) != "")
  487. m_List1.SetItemText(i, 1, GetSPNameFromId(m_List1.GetItemText(i, 0)));
  488. str.Format("%f", GetSPPriceFromId(m_List1.GetItemText(i, 0)));
  489. ConvertToPrice(str);
  490. m_List1.SetItemText(i, 2, str);
  491. // m_List1.SetItemText(i,3, "1");
  492. }
  493. CalculateCost();
  494. }
  495. void Booking::SetSPName2()
  496. {
  497. }
  498. void Booking::SetSPName3()
  499. {
  500. CString str;
  501. for (int i = 0; i < m_List3.GetItemCount(); i++)
  502. {
  503. if (GetSPNameFromId(m_List3.GetItemText(i, 0)) != "")
  504. m_List3.SetItemText(i, 1, GetSPNameFromId(m_List3.GetItemText(i, 0)));
  505. str.Format("%f", GetSPPriceFromId(m_List3.GetItemText(i, 0)));
  506. ConvertToPrice(str);
  507. m_List3.SetItemText(i, 2, str);
  508. // m_List3.SetItemText(i,3, "1");
  509. }
  510. CalculateCost2();
  511. }
  512. void Booking::OnTimer(UINT nIDEvent)
  513. {
  514. // TODO: Add your message handler code here and/or call default
  515. if (nIDEvent == 1)
  516. {
  517. KillTimer(nIDEvent);
  518. SetSPName1();
  519. }
  520. else if (nIDEvent == 2)
  521. {
  522. KillTimer(nIDEvent);
  523. SetSPName2();
  524. }
  525. else if (nIDEvent == 3)
  526. {
  527. KillTimer(nIDEvent);
  528. SetSPName3();
  529. }
  530. }
  531. void Booking::OnBUTsave()
  532. {
  533. if (IsHasRights2(0) == 0)
  534. return;
  535. // TODO: Add your control notification handler code here
  536. UpdateData();
  537. int pos = m_comboid.GetCurSel();
  538. if (pos == -1)
  539. {
  540. AfxMessageBox("资料不全,打*号的项目必须填写!", MB_ICONINFORMATION);
  541. return;
  542. }
  543. CString id;
  544. m_comboid.GetLBText(pos, id);
  545. BOOL bAdd = 1;
  546. if (pos)bAdd = 0;
  547. if (m_name1.IsEmpty() && m_name2.IsEmpty())
  548. {
  549. AfxMessageBox("资料不全,打*号的项目必须填写!", MB_ICONINFORMATION);
  550. return;
  551. }
  552. if (m_name1.Find("*") != -1 || m_name2.Find("*") != -1)
  553. {
  554. AfxMessageBox("客人名字非法!", MB_ICONINFORMATION);
  555. return;
  556. }
  557. CalculateCost();
  558. CalculateCost2();
  559. pos = m_combotaoxiname.GetCurSel();
  560. if (pos != -1)
  561. {
  562. m_combotaoxiname.GetLBText(pos, taoxiname);
  563. }
  564. else
  565. {
  566. m_combotaoxiname.GetWindowText(taoxiname);
  567. m_taoxiid.Empty();
  568. }
  569. m_taoxijiage.TrimLeft();
  570. m_taoxijiage.TrimRight();
  571. m_payed1.TrimLeft();
  572. m_payed1.TrimRight();
  573. if (taoxiname.IsEmpty() || m_taoxijiage.IsEmpty() || m_payed1.IsEmpty() || m_zs.IsEmpty())
  574. {
  575. AfxMessageBox("资料不全,打*号的项目必须填写!", MB_ICONINFORMATION);
  576. return;
  577. }
  578. CString bm;
  579. pos = m_combobm.GetCurSel();
  580. if (pos != -1)
  581. {
  582. m_combobm.GetLBText(pos, bm);
  583. }
  584. CString ren, txtype, area;
  585. pos = m_comborenyuan.GetCurSel();
  586. if (pos != -1)
  587. {
  588. m_comborenyuan.GetLBText(pos, ren);
  589. }
  590. else
  591. {
  592. AfxMessageBox("资料不全,打*号的项目必须填写!", MB_ICONINFORMATION);
  593. return;
  594. }
  595. pos = m_combotype.GetCurSel();
  596. if (pos != -1)
  597. {
  598. m_combotype.GetLBText(pos, txtype);
  599. }
  600. else
  601. {
  602. AfxMessageBox("资料不全,打*号的项目必须填写!", MB_ICONINFORMATION);
  603. return;
  604. }
  605. #ifdef ZHIAI_VERSION
  606. pos=m_comboarea.GetCurSel ();
  607. if(pos!=-1)
  608. {
  609. m_comboarea.GetLBText (pos, area);
  610. }
  611. m_outside=area;
  612. #endif
  613. if (!CheckDateOK(m_time2))return;
  614. if (!CheckDateOK(m_time3))return;
  615. #ifndef NOCALCOST
  616. if (atof(m_taoxijiage) < m_cost1 + m_cost2)
  617. {
  618. if (AfxMessageBox("警告:套系价格低于成本, 可能是亏本生意, 是否继续?", MB_YESNO | MB_ICONSTOP) != IDYES)return;
  619. }
  620. #endif
  621. CString strmoney;
  622. float list3money = 0;
  623. strmoney.Format("%f", list3money);
  624. ConvertToPrice(strmoney);
  625. CString sql, str, str2;
  626. CString strRes1, strRes2;
  627. GetFirstLetter(m_name1, strRes1);
  628. GetFirstLetter(m_name2, strRes2);
  629. m_waiter6 = g_user.name;
  630. CString m_membernotemp = m_memberno;
  631. if (m_type)m_memberno.Empty();
  632. if (bAdd)
  633. {
  634. CTime time = CTime::GetCurrentTime();
  635. CString date = g_date;
  636. sql = "select max(id) as cot from dindan where time1='" + date + "' ";
  637. g_sendhead.bsql = 1;
  638. g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
  639. date.Replace("-", "");
  640. id.Format("%s-%03d", date, g_ncount + 1);
  641. if (m_comboid.FindString(0, id) == -1)
  642. {
  643. m_comboid.InsertString(0, id);
  644. m_comboid.SetCurSel(0);
  645. }
  646. CString newid;
  647. newid.Format("%s-%03d", date, g_ncount + 2);
  648. m_comboid.InsertString(0, newid);
  649. UpdateData(false);
  650. m_sid = id;
  651. sql.Format("insert into [dindan]([id],[money1],[name1],[name2],[taoxiid],[taoxiname],[taoxijiage],[taoxizs],[time1],[time2],[time3],[staff_department],[ren],[discount],[payed1],[status],[status2],[status3],[status4],[status6],[status5],[status7],[status8],[urgent],[bz],[pinyin1],[pinyin2],[clothescount],[clothescount2],[outside],[outside2],[style],[waiter6],[memberno],[txtype],[tichenren1],[tichenren2],[tichenren3],[tichenren4],[tichenren5])values('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','未拍','未选','未取','未修','未修','未设计','未刻','未看','否','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','','','','','')",
  652. id, strmoney, m_name1, m_name2, m_taoxiid, taoxiname, m_taoxijiage, m_zs, m_time1, m_time2, m_time3, bm, ren, m_discount, m_payed1, FilterBZ(m_bz), strRes1, strRes2, m_clothescount, m_clothescount2, m_outside, m_outside2, m_style, m_waiter6, m_memberno, txtype);
  653. sql += "###insert into [client](id,name1,name2)values('" + id + "','" + m_name1 + "','" + m_name2 + "')";
  654. CString sql2;
  655. sql2 = "###" + id + "$$$" + m_memberno;
  656. sql += sql2;
  657. }
  658. m_memberno = m_membernotemp;
  659. int i = 0;
  660. g_sendhead.bsql = 1;
  661. g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
  662. CArray<CStringArray, CStringArray>sparray;
  663. sparray.SetSize(m_List1.GetItemCount() + m_List3.GetItemCount() + m_listbox1.GetCount());
  664. int realcount = 0;
  665. for ( i = 0; i < m_List1.GetItemCount(); i++)
  666. {
  667. str = m_List1.GetItemText(i, 1);
  668. str.TrimLeft(); str.TrimRight();
  669. if (str.IsEmpty())
  670. continue;
  671. sparray.ElementAt(realcount).Add(id);
  672. sparray.ElementAt(realcount).Add(m_List1.GetItemText(i, 0));
  673. sparray.ElementAt(realcount).Add(m_List1.GetItemText(i, 2));
  674. sparray.ElementAt(realcount).Add(m_List1.GetItemText(i, 3));
  675. sparray.ElementAt(realcount).Add("1");
  676. sparray.ElementAt(realcount).Add(m_List1.GetItemText(i, 1));
  677. sparray.ElementAt(realcount).Add(m_List1.GetItemText(i, 4));
  678. sparray.ElementAt(realcount).Add(m_List1.GetItemText(i, 5));
  679. realcount++;
  680. }
  681. for (i = 0; i < m_List3.GetItemCount(); i++)
  682. {
  683. str = m_List3.GetItemText(i, 1);
  684. str.TrimLeft(); str.TrimRight();
  685. if (str.IsEmpty())continue;
  686. sparray.ElementAt(realcount).Add(id);
  687. sparray.ElementAt(realcount).Add(m_List3.GetItemText(i, 0));
  688. sparray.ElementAt(realcount).Add(m_List3.GetItemText(i, 2));
  689. sparray.ElementAt(realcount).Add(m_List3.GetItemText(i, 3));
  690. sparray.ElementAt(realcount).Add("2");
  691. sparray.ElementAt(realcount).Add(m_List3.GetItemText(i, 1));
  692. sparray.ElementAt(realcount).Add("");
  693. sparray.ElementAt(realcount).Add("");
  694. realcount++;
  695. }
  696. for (i = 0; i < m_listbox1.GetCount(); i++)
  697. {
  698. m_listbox1.GetText(i, str);
  699. sparray.ElementAt(realcount).Add(id);
  700. sparray.ElementAt(realcount).Add(str);
  701. realcount++;
  702. }
  703. sparray.SetSize(realcount);
  704. if (realcount == 0)
  705. {
  706. sparray.SetSize(1);
  707. sparray.ElementAt(0).Add(id);
  708. }
  709. CMemFile memfile;
  710. CArchive ar(&memfile, CArchive::store);
  711. for (int ii = 0; ii < sparray.GetSize(); ii++)
  712. {
  713. sparray.ElementAt(ii).Serialize(ar);
  714. }
  715. ar.Close();
  716. int length = memfile.GetLength();
  717. BYTE *pData = memfile.Detach();
  718. int size = sparray.GetSize();
  719. BYTE *pData2 = new BYTE[length + sizeof(int)];
  720. memcpy(pData2, pData, length);
  721. memcpy(pData2 + length, &size, sizeof(int));
  722. delete[]pData;
  723. length += sizeof(int);
  724. g_nSendCode = 3;
  725. g_pMainWnd->ProcessChatMessageRequest2(pData2, length);
  726. g_nSendCode = 0;
  727. delete[]pData2;
  728. if (g_bSendOK == 0)return;
  729. AfxMessageBox("保存成功!", MB_ICONINFORMATION);
  730. if (m_type == 1 || m_type == 3)
  731. SaveCard2Data();
  732. GetDlgItem(IDC_BUTsave)->EnableWindow(0);
  733. GetDlgItem(IDC_BUTclient)->EnableWindow(1);
  734. GetDlgItem(IDC_BUTprint)->EnableWindow(1);
  735. if (IsHasRights2(4))
  736. GetDlgItem(IDC_BUTWaiter)->EnableWindow(1);
  737. CString phone;
  738. if (bAdd)
  739. {
  740. #ifdef CHILD_VERSION
  741. CClientDlg2 dlg;
  742. #else
  743. CClientDlg dlg;
  744. dlg.m_hqtime=m_time3;
  745. #endif
  746. dlg.m_phone1 = m_phone1;
  747. dlg.m_phone2 = m_phone2;
  748. dlg.m_bAdd = 1;
  749. dlg.m_bNeedSendMsg = 1;
  750. dlg.id = id;
  751. dlg.m_name1 = m_name1;
  752. dlg.m_name2 = m_name2;
  753. if (dlg.DoModal() == IDOK)
  754. {
  755. #ifdef CHILD_VERSION
  756. phone = dlg.m_phone1;
  757. #else
  758. phone=dlg.m_phone2 ;
  759. #endif
  760. m_name1 = dlg.m_name1;
  761. m_name2 = dlg.m_name2;
  762. UpdateData(false);
  763. }
  764. }
  765. BOOL bNeedCard = 0;
  766. if (m_type == 1 || m_type == 2 || m_type == 3)
  767. bNeedCard = 1;
  768. if (m_memberno.IsEmpty())
  769. bNeedCard = 1;
  770. if (bNeedCard)
  771. {
  772. SelMemberType dlg;
  773. if (dlg.DoModal() == IDOK)
  774. {
  775. if (dlg.m_type == 0)
  776. {
  777. AddMember dlg;
  778. dlg.m_name = m_name2;
  779. dlg.m_phone = phone;
  780. if (dlg.DoModal() == IDOK)
  781. {
  782. if (AfxMessageBox("会员添加成功,是否发放副卡?", MB_YESNO | MB_ICONINFORMATION) == IDYES)
  783. {
  784. InputCard2Dlg dlg2;
  785. dlg2.m_name = dlg.m_name;
  786. dlg2.m_no = dlg.m_memberno;
  787. dlg2.DoModal();
  788. }
  789. sql = "update dindan set [memberno]='" + dlg.m_memberno + "' where [id]='" + id + "'";
  790. g_sendhead.bsql = 1;
  791. g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
  792. }
  793. }
  794. else
  795. {
  796. AddMember dlg;
  797. dlg.m_mode = 1;
  798. dlg.m_name = m_name2;
  799. dlg.m_phone = phone;
  800. dlg.m_jiage = m_money1;
  801. if (dlg.DoModal() == IDOK)
  802. {
  803. if (AfxMessageBox("会员添加成功,是否发放副卡?", MB_YESNO | MB_ICONINFORMATION) == IDYES)
  804. {
  805. InputCard2Dlg dlg2;
  806. dlg2.m_mode = 1;
  807. dlg2.m_name = dlg.m_name;
  808. dlg2.m_no = dlg.m_memberno;
  809. dlg2.DoModal();
  810. }
  811. sql = "update dindan set [memberno]='" + dlg.m_memberno + "' where [id]='" + id + "'";
  812. g_sendhead.bsql = 1;
  813. g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
  814. }
  815. }
  816. }
  817. }
  818. }
  819. void Booking::OnBUTclose()
  820. {
  821. // TODO: Add your control notification handler code here
  822. GetParent()->SendMessage(WM_CLOSE);
  823. }
  824. void Booking::OnChangeEDITtaoxijiage()
  825. {
  826. // TODO: If this is a RICHEDIT control, the control will not
  827. // send this notification unless you override the MyFormView::OnInitDialog()
  828. // function and call CRichEditCtrl().SetEventMask()
  829. // with the ENM_CHANGE flag ORed into the mask.
  830. /* UpdateData();
  831. CString str;
  832. float list3money=0;
  833. for(int i=0; i<m_List3.GetItemCount (); i++)
  834. {
  835. list3money+=GetSPPriceFromId(m_List3.GetItemText (i, 0))*atof(m_List3.GetItemText(i,3));
  836. }
  837. m_money1.Format ("%f", list3money+atof(m_taoxijiage)-atof(m_discount));
  838. m_money2=m_payed1;
  839. m_money3.Format ("%f", atof(m_money1)-atof(m_money2));
  840. ConvertToPrice(m_money1);
  841. ConvertToPrice(m_money2);
  842. ConvertToPrice(m_money3);
  843. UpdateData(false);
  844. */
  845. UpdateData();
  846. CString str;
  847. float list3money = 0;
  848. /* for(int i=0; i<m_List3.GetItemCount (); i++)
  849. {
  850. list3money+=GetSPPriceFromId(m_List3.GetItemText (i, 0))*atof(m_List3.GetItemText(i,3));
  851. }*/
  852. m_money1.Format("%f", list3money + atof(m_taoxijiage) - atof(m_discount) + atof(m_payed4));
  853. m_money2.Format("%f", atof(m_payed5));
  854. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  855. ConvertToPrice(m_money1);
  856. ConvertToPrice(m_money2);
  857. ConvertToPrice(m_money3);
  858. UpdateData(false);
  859. // TODO: Add your control notification handler code here
  860. }
  861. void Booking::OnChangeEDITdiscount()
  862. {
  863. // TODO: If this is a RICHEDIT control, the control will not
  864. // send this notification unless you override the MyFormView::OnInitDialog()
  865. // function and call CRichEditCtrl().SetEventMask()
  866. // with the ENM_CHANGE flag ORed into the mask.
  867. OnChangeEDITtaoxijiage();
  868. // TODO: Add your control notification handler code here
  869. }
  870. void Booking::OnChangeEDITpayed1()
  871. {
  872. // TODO: If this is a RICHEDIT control, the control will not
  873. // send this notification unless you override the MyFormView::OnInitDialog()
  874. // function and call CRichEditCtrl().SetEventMask()
  875. // with the ENM_CHANGE flag ORed into the mask.
  876. OnChangeEDITtaoxijiage();
  877. // TODO: Add your control notification handler code here
  878. }
  879. void Booking::OnDropdownCOMBObm()
  880. {
  881. // TODO: Add your control notification handler code here
  882. if (m_combobm.GetCount() < 2)
  883. {
  884. g_sendhead.bsql = 0;
  885. g_sendhead.code[0] = 3;
  886. g_sendhead.tabcount = 1;
  887. g_pMainWnd->ProcessChatMessageRequest2(3); if (g_bSendOK == 0)return;
  888. DataToArray(&g_List1array);
  889. for (int ii = 0; ii < g_List1array.GetSize(); ii++)
  890. m_combobm.AddString(g_List1array.ElementAt(ii).ElementAt(0));
  891. }
  892. }
  893. void Booking::OnDropdownCOMBOrenyuan()
  894. {
  895. // TODO: Add your control notification handler code here
  896. if (m_renyuanarray.GetSize() == 0)
  897. {
  898. for (int ii = 0; ii < g_AryStaff.GetSize(); ii++)
  899. {
  900. m_renyuanarray.Add(GetStaffDepartment(ii)); // 部门;
  901. m_renyuanarray.Add(GetStaffName(ii)); // 员工;
  902. }
  903. }
  904. m_comborenyuan.ResetContent();
  905. int pos = m_combobm.GetCurSel();
  906. if (pos == -1)
  907. {
  908. for (int ii = 0; ii < m_renyuanarray.GetSize(); ii += 2)
  909. {
  910. m_comborenyuan.AddString(m_renyuanarray.ElementAt(ii + 1));
  911. }
  912. }
  913. else
  914. {
  915. CString str;
  916. m_combobm.GetLBText(pos, str);
  917. for (int ii = 0; ii < m_renyuanarray.GetSize(); ii += 2)
  918. {
  919. if (str == m_renyuanarray.ElementAt(ii))
  920. m_comborenyuan.AddString(m_renyuanarray.ElementAt(ii + 1));
  921. }
  922. }
  923. }
  924. void Booking::OnSelchangeCOMBObm()
  925. {
  926. // TODO: Add your control notification handler code here
  927. m_comborenyuan.ResetContent();
  928. m_comborenyuan.SetCurSel(-1);
  929. }
  930. void Booking::OnDropdownCOMBOid()
  931. {
  932. // TODO: Add your control notification handler code here
  933. if (m_comboid.GetCount() == 0)
  934. {
  935. CString date = g_date;
  936. CString sql;
  937. // sql="select count(*) as cot from dindan where time1='"+date+"' ";
  938. sql = "select max(id) as cot from dindan where time1='" + date + "' ";
  939. g_sendhead.bsql = 1;
  940. g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
  941. date.Replace("-", "");
  942. CString id;
  943. id.Format("%s-%03d", date, g_ncount + 1);
  944. m_comboid.AddString(id);
  945. }
  946. }
  947. void Booking::OnSelchangeCOMBOid()
  948. {
  949. // TODO: Add your control notification handler code here
  950. int pos = m_comboid.GetCurSel();
  951. m_phone1 = m_phone2 = "";
  952. GetDlgItem(IDC_BUTprint)->EnableWindow(pos);
  953. if (IsHasRights2new(0))
  954. {
  955. GetDlgItem(IDC_BUTsave)->EnableWindow(pos == 0);
  956. // GetDlgItem(IDC_BUTclient)->EnableWindow(pos==0);
  957. }
  958. else
  959. GetDlgItem(IDC_BUTsave)->EnableWindow(0);
  960. //订单修改权限
  961. // GetDlgItem(IDC_BUTsave)->EnableWindow(IsHasRights2new(1));
  962. // if(pos)
  963. // GetDlgItem(IDC_BUTclient)->EnableWindow(IsHasRights2new(1));
  964. m_memberno = "";
  965. m_memberno2 = "";
  966. m_type = 0;
  967. if (pos < 1)
  968. {
  969. ClearCtrl();
  970. InputMemberno dlg;
  971. dlg.m_bNoAdd = 1;
  972. if (dlg.DoModal() == IDOK)
  973. {
  974. m_memberno = dlg.m_memberno;
  975. m_memberno2 = dlg.m_memberno2;
  976. m_type = dlg.m_type;
  977. m_memberno2date = dlg.m_memberno2date;
  978. m_membernoname = dlg.m_membernoname;
  979. m_membernosex = dlg.m_membernosex;
  980. m_membernophone = dlg.m_membernophone;
  981. m_membernojiage = dlg.m_membernojiage;
  982. SetDlgItemText(IDC_EDITwaiter6, m_memberno);
  983. }
  984. return;
  985. }
  986. CString id;
  987. m_comboid.GetLBText(pos, id);
  988. CString filter = "id='" + id + "';id='" + id + "' and kind<>'4' and kind<>'5'";
  989. g_sendhead.code[0] = 11;
  990. g_sendhead.code[1] = 50;
  991. g_sendhead.tabcount = 2;
  992. g_sendhead.bsql = 0;
  993. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  994. CArray<CStringArray, CStringArray>sparray;
  995. DataToArray(&g_List1array, &sparray);
  996. CString bm, ren;
  997. m_takephotomoney = g_List1array.ElementAt(0).ElementAt(2);
  998. m_choosephotomoney = g_List1array.ElementAt(0).ElementAt(3);
  999. m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  1000. m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  1001. m_taoxiid = g_List1array.ElementAt(0).ElementAt(6);
  1002. taoxiname = g_List1array.ElementAt(0).ElementAt(7);
  1003. m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  1004. m_zs = g_List1array.ElementAt(0).ElementAt(9);
  1005. m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  1006. m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  1007. m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  1008. bm = g_List1array.ElementAt(0).ElementAt(13);
  1009. ren = g_List1array.ElementAt(0).ElementAt(14);
  1010. m_discount = g_List1array.ElementAt(0).ElementAt(15);
  1011. m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  1012. m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  1013. m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  1014. m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  1015. m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  1016. m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  1017. m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  1018. m_outside = g_List1array.ElementAt(0).ElementAt(28);
  1019. m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  1020. m_style = g_List1array.ElementAt(0).ElementAt(30);
  1021. m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  1022. m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  1023. m_waiter3 = g_List1array.ElementAt(0).ElementAt(36);
  1024. m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  1025. m_bz = g_List1array.ElementAt(0).ElementAt(38);
  1026. m_waiter6 = g_List1array.ElementAt(0).ElementAt(41);
  1027. pos = m_combotaoxiname.FindString(0, taoxiname);
  1028. if (pos == -1)
  1029. {
  1030. m_combotaoxiname.InsertString(0, taoxiname);
  1031. m_combotaoxiname.SetCurSel(0);
  1032. }
  1033. else
  1034. m_combotaoxiname.SetCurSel(pos);
  1035. pos = m_combobm.FindString(0, bm);
  1036. if (pos == -1)
  1037. {
  1038. m_combobm.ResetContent();
  1039. m_combobm.InsertString(0, bm);
  1040. m_combobm.SetCurSel(0);
  1041. }
  1042. else
  1043. m_combobm.SetCurSel(pos);
  1044. pos = m_comborenyuan.FindString(0, ren);
  1045. if (pos == -1)
  1046. {
  1047. m_comborenyuan.InsertString(0, ren);
  1048. m_comborenyuan.SetCurSel(0);
  1049. }
  1050. else
  1051. m_comborenyuan.SetCurSel(pos);
  1052. UpdateData(false);
  1053. m_List1.DeleteAllItems();
  1054. m_List3.DeleteAllItems();
  1055. int listpos[2] = { 0 };
  1056. CEditListCtrl *pList[2] = { &m_List1, &m_List3 };
  1057. for (int i = 0; i < sparray.GetSize(); i++)
  1058. {
  1059. pos = atoi(sparray.ElementAt(i).ElementAt(4)) - 1;
  1060. if (pos>1)pos = 0;
  1061. pList[pos]->InsertItem(listpos[pos], sparray.ElementAt(i).ElementAt(1));
  1062. pList[pos]->SetItemText(listpos[pos], 1, sparray.ElementAt(i).ElementAt(5));
  1063. pList[pos]->SetItemText(listpos[pos], 2, sparray.ElementAt(i).ElementAt(2));
  1064. pList[pos]->SetItemText(listpos[pos], 3, sparray.ElementAt(i).ElementAt(3));
  1065. listpos[pos]++;
  1066. }
  1067. OnChangeEDITtaoxijiage();
  1068. CalculateCost();
  1069. CalculateCost2();
  1070. }
  1071. void Booking::ClearCtrl()
  1072. {
  1073. m_money1 = _T("");
  1074. m_money2 = _T("");
  1075. m_money3 = _T("");
  1076. m_choosephotomoney = _T("");
  1077. m_name1 = _T("");
  1078. m_name2 = _T("");
  1079. m_taoxiid = _T("");
  1080. m_taoxijiage = _T("");
  1081. m_zs = _T("");
  1082. m_time1 = g_date;
  1083. m_time2 = _T("");
  1084. m_time3 = _T("");
  1085. m_bz = _T("");
  1086. m_discount = _T("");
  1087. m_payed1 = _T("");
  1088. m_payed2 = _T("");
  1089. m_payed3 = _T("");
  1090. m_payed4 = _T("");
  1091. m_payed5 = _T("");
  1092. m_clothescount = _T("");
  1093. m_clothescount2 = _T("");
  1094. m_outside = _T("");
  1095. m_outside2 = _T("");
  1096. m_style = _T("");
  1097. m_waiter1 = _T("");
  1098. m_waiter2 = _T("");
  1099. m_waiter3 = _T("");
  1100. m_waiter4 = _T("");
  1101. m_waiter6 = g_user.name;
  1102. m_combotaoxiname.SetCurSel(-1);
  1103. m_combobm.SetCurSel(-1);
  1104. m_comborenyuan.SetCurSel(-1);
  1105. UpdateData(false);
  1106. m_List1.DeleteAllItems();
  1107. m_List3.DeleteAllItems();
  1108. }
  1109. void Booking::OnBUTWaiter()
  1110. {
  1111. if (AfxMessageBox("是否导入订单?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  1112. CFileDialog fdlg(true, NULL, "", OFN_HIDEREADONLY, "影楼订单文件(*.*)|*.dan||");
  1113. if (fdlg.DoModal() != IDOK)return;
  1114. CString path = fdlg.GetFileName();
  1115. CArray<CStringArray, CStringArray>g_Sel1array[20];//精英团队
  1116. CArray<CStringArray, CStringArray>g_Sel2array[20];//景点介绍
  1117. CArray<CStringArray, CStringArray>g_Sel3array[20];//套系内容
  1118. CArray<CStringArray, CStringArray>g_Sel4array[20];//产品展示
  1119. CArray<CStringArray, CStringArray>g_Sel5array[20];//礼服介绍
  1120. CString g_name1;
  1121. CString g_name2;
  1122. CString g_phone1;
  1123. CString g_phone2;
  1124. CString g_price1;
  1125. CString g_price2;
  1126. CString g_date;
  1127. {
  1128. CString str = path;
  1129. int pos = str.Find(".");
  1130. if (pos == -1)return;
  1131. str = str.Left(pos);
  1132. pos = str.Find(" ");
  1133. if (pos == -1)return;
  1134. g_name1 = str.Left(pos); str = str.Right(str.GetLength() - pos - 1);
  1135. pos = str.Find(" ");
  1136. if (pos == -1)return;
  1137. g_name2 = str.Left(pos); str = str.Right(str.GetLength() - pos - 1);
  1138. pos = str.Find(" ");
  1139. if (pos == -1)return;
  1140. g_phone1 = str.Left(pos); str = str.Right(str.GetLength() - pos - 1);
  1141. pos = str.Find(" ");
  1142. if (pos == -1)return;
  1143. g_phone2 = str.Left(pos); str = str.Right(str.GetLength() - pos - 1);
  1144. }
  1145. int length[100];
  1146. CFile fp;
  1147. fp.Open(path, CFile::modeRead);
  1148. int fileleng = fp.GetLength();
  1149. int memlength = fileleng - sizeof(int) * 100;
  1150. int i = 0;
  1151. for ( i = 0; i < 100; i++)
  1152. fp.Read(length + i, sizeof(int));
  1153. for (i = 0; i < 20; i++)
  1154. g_Sel1array[i].SetSize(length[i]);
  1155. for (i = 0; i < 20; i++)
  1156. g_Sel2array[i].SetSize(length[20 + i]);
  1157. for (i = 0; i < 20; i++)
  1158. g_Sel3array[i].SetSize(length[40 + i]);
  1159. for (i = 0; i < 20; i++)
  1160. g_Sel4array[i].SetSize(length[60 + i]);
  1161. for (i = 0; i < 20; i++)
  1162. g_Sel5array[i].SetSize(length[80 + i]);
  1163. BYTE *pData = new BYTE[memlength];
  1164. fp.Read(pData, memlength);
  1165. fp.Close();
  1166. CMemFile memfile;
  1167. memfile.Attach(pData, memlength);
  1168. CArchive ar(&memfile, CArchive::load);
  1169. for (i = 0; i < 20; i++)
  1170. {
  1171. for (int j = 0; j < length[i]; j++)
  1172. g_Sel1array[i].ElementAt(j).Serialize(ar);
  1173. }
  1174. for (i = 0; i < 20; i++)
  1175. {
  1176. for (int j = 0; j < g_Sel2array[i].GetSize(); j++)
  1177. g_Sel2array[i].ElementAt(j).Serialize(ar);
  1178. }
  1179. for (i = 0; i < 20; i++)
  1180. {
  1181. for (int j = 0; j < g_Sel3array[i].GetSize(); j++)
  1182. g_Sel3array[i].ElementAt(j).Serialize(ar);
  1183. }
  1184. for (i = 0; i < 20; i++)
  1185. {
  1186. for (int j = 0; j < g_Sel4array[i].GetSize(); j++)
  1187. g_Sel4array[i].ElementAt(j).Serialize(ar);
  1188. }
  1189. for (i = 0; i < 20; i++)
  1190. {
  1191. for (int j = 0; j < g_Sel5array[i].GetSize(); j++)
  1192. g_Sel5array[i].ElementAt(j).Serialize(ar);
  1193. }
  1194. ar.Close();
  1195. memfile.Detach();
  1196. delete[]pData;
  1197. if (g_Sel5array[19].GetSize())
  1198. {
  1199. g_price1 = g_Sel5array[19].ElementAt(0).ElementAt(0);
  1200. g_price2 = g_Sel5array[19].ElementAt(0).ElementAt(1);
  1201. }
  1202. else
  1203. {
  1204. g_price1 = g_price2 = "";
  1205. }
  1206. OnDropdownCOMBOid();
  1207. m_comboid.SetCurSel(0);
  1208. OnSelchangeCOMBOid();
  1209. m_name1 = g_name1;
  1210. m_name2 = g_name2;
  1211. CStringArray array;
  1212. for (i = 0; i < 19; i++)
  1213. {
  1214. for (int j = 0; j < g_Sel3array[i].GetSize(); j++)
  1215. {
  1216. if (g_Sel3array[i].ElementAt(j).GetSize() < 2)continue;
  1217. int count = g_Sel3array[i].ElementAt(j).GetSize();
  1218. for (int a = 1; a < count; a++)
  1219. {
  1220. if (a == 1)
  1221. {
  1222. CString taoxiname = g_Sel3array[i].ElementAt(j).ElementAt(a);
  1223. m_combotaoxiname.InsertString(0, taoxiname);
  1224. m_combotaoxiname.SetCurSel(0);
  1225. }
  1226. else
  1227. {
  1228. CString str = g_Sel3array[i].ElementAt(j).ElementAt(a);
  1229. CString dir, name;
  1230. int pos = str.ReverseFind('\\');
  1231. dir = str.Left(pos);
  1232. name = str.Right(str.GetLength() - pos - 1);
  1233. array.Add(name);
  1234. }
  1235. }
  1236. }
  1237. }
  1238. for (i = 0; i < 19; i++)
  1239. {
  1240. for (int j = 0; j < g_Sel4array[i].GetSize(); j++)
  1241. {
  1242. int count = g_Sel4array[i].ElementAt(j).GetSize();
  1243. for (int a = 1; a < count; a++)
  1244. {
  1245. array.Add(g_Sel4array[i].ElementAt(j).ElementAt(a));
  1246. }
  1247. }
  1248. }
  1249. for (i = 0; i < array.GetSize(); i++)
  1250. {
  1251. int pos = m_List1.GetItemCount();
  1252. CString str;
  1253. if (pos)
  1254. {
  1255. if (m_List1.GetItemText(pos - 1, 0).IsEmpty() && m_List1.GetItemText(pos - 1, 1).IsEmpty())
  1256. {
  1257. pos--;
  1258. m_List1.SetItemText(pos, 0, "");
  1259. m_List1.SetItemText(pos, 1, array.ElementAt(i));
  1260. m_List1.SetItemText(pos, 2, "");
  1261. m_List1.SetItemText(pos, 3, "1");
  1262. }
  1263. else
  1264. {
  1265. m_List1.InsertItem(pos, "");
  1266. m_List1.SetItemText(pos, 1, array.ElementAt(i));
  1267. m_List1.SetItemText(pos, 2, "");
  1268. m_List1.SetItemText(pos, 3, "1");
  1269. }
  1270. }
  1271. else
  1272. {
  1273. m_List1.InsertItem(pos, "");
  1274. m_List1.SetItemText(pos, 1, array.ElementAt(i));
  1275. m_List1.SetItemText(pos, 2, "");
  1276. m_List1.SetItemText(pos, 3, "1");
  1277. }
  1278. }
  1279. if (g_Sel5array[19].GetSize())
  1280. {
  1281. g_price1 = g_Sel5array[19].ElementAt(0).ElementAt(0);
  1282. g_price2 = g_Sel5array[19].ElementAt(0).ElementAt(1);
  1283. }
  1284. else
  1285. {
  1286. g_price1 = g_price2 = "";
  1287. }
  1288. m_taoxijiage = g_price1;
  1289. m_payed1 = g_price2;
  1290. UpdateData(false);
  1291. m_phone1 = g_phone1;
  1292. m_phone2 = g_phone2;
  1293. OnChangeEDITtaoxijiage();
  1294. }
  1295. void Booking::OnButton1()
  1296. {
  1297. // TODO: Add your control notification handler code here
  1298. /* CTime tm=CTime::GetCurrentTime ();
  1299. CTimeSpan dt(1, 0, 0, 0);
  1300. CTimeSpan dt2(25, 0, 0, 0);
  1301. CTime tm2=tm-dt2;
  1302. while(tm>tm2)
  1303. {
  1304. CString filter;
  1305. filter="id like '";
  1306. filter+=tm2.Format("%Y%m%d");
  1307. filter+="%'";
  1308. tm2+=dt;
  1309. g_sendhead.code[0]=50;
  1310. g_sendhead.tabcount=1;
  1311. g_sendhead.bsql=0;
  1312. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  1313. CArray<CStringArray, CStringArray>sparray;
  1314. DataToArray(&sparray);
  1315. m_List1.DeleteAllItems ();
  1316. m_List3.DeleteAllItems ();
  1317. int listpos[3]={0};int pos;
  1318. CEditListCtrl *pList[3]={&m_List1,&m_List2,&m_List3};
  1319. for(int i=0; i<sparray.GetSize (); i++)
  1320. {
  1321. pos=atoi(sparray.ElementAt (i).ElementAt (4))-1;
  1322. pList[pos]->InsertItem(listpos[pos], sparray.ElementAt (i).ElementAt (1));
  1323. pList[pos]->SetItemText(listpos[pos], 1, GetSPNameFromId(sparray.ElementAt (i).ElementAt (1)));
  1324. if(pos<2)
  1325. pList[pos]->SetItemText(listpos[pos], 2, sparray.ElementAt (i).ElementAt (0));
  1326. else
  1327. {
  1328. pList[pos]->SetItemText(listpos[pos], 2, sparray.ElementAt (i).ElementAt (0));
  1329. pList[pos]->SetItemText(listpos[pos], 3, sparray.ElementAt (i).ElementAt (0));
  1330. }
  1331. listpos[pos]++;
  1332. }
  1333. CArray<CStringArray, CStringArray>savearray;
  1334. savearray.SetSize(m_List1.GetItemCount ());
  1335. CString sql,id,spid,name;
  1336. for( i=0; i<m_List1.GetItemCount (); i++)
  1337. {
  1338. spid=m_List1.GetItemText (i, 0);
  1339. id= m_List1.GetItemText (i, 2) ;
  1340. name=m_List1.GetItemText (i, 1);
  1341. sql="update dindansp set name='"+name+"' where id='"+id+"' and spid='"+spid+"'";
  1342. g_sendhead.bsql=1;
  1343. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  1344. }
  1345. for( i=0; i<m_List3.GetItemCount (); i++)
  1346. {
  1347. spid=m_List3.GetItemText (i, 0);
  1348. id= m_List3.GetItemText (i, 3) ;
  1349. name=m_List3.GetItemText (i, 1);
  1350. sql="update dindansp set name='"+name+"' where id='"+id+"' and spid='"+spid+"'";
  1351. g_sendhead.bsql=1;
  1352. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  1353. }
  1354. }*/
  1355. }
  1356. void Booking::OnBUTprint()
  1357. {
  1358. // TODO: Add your control notification handler code here
  1359. int pos = m_comboid.GetCurSel();
  1360. if (pos == -1)
  1361. {
  1362. return;
  1363. }
  1364. CString id;
  1365. m_comboid.GetLBText(pos, id);
  1366. g_pMainWnd->PrintDinDan(id);
  1367. }
  1368. void Booking::OnBUTstyle()
  1369. {
  1370. // TODO: Add your control notification handler code here
  1371. SetStyle dlg;
  1372. dlg.m_style = m_style;
  1373. if (dlg.DoModal() == IDOK)
  1374. m_style = dlg.m_style;
  1375. }
  1376. void Booking::OnBUTspbox()
  1377. {
  1378. // TODO: Add your control notification handler code here
  1379. SPBox dlg;
  1380. #ifndef CHILD_VERSION
  1381. dlg.m_mode=1;
  1382. #endif
  1383. if (dlg.DoModal() != IDOK)return;
  1384. for (int a = 0; a < dlg.m_spidarray.GetSize(); a++)
  1385. {
  1386. dlg.m_spid = dlg.m_spidarray.ElementAt(a);
  1387. dlg.m_spname = dlg.m_spnamearray.ElementAt(a);
  1388. int pos = m_List3.GetItemCount();
  1389. CString str;
  1390. if (pos)
  1391. {
  1392. if (m_List3.GetItemText(pos - 1, 0).IsEmpty() && m_List3.GetItemText(pos - 1, 1).IsEmpty())
  1393. {
  1394. pos--;
  1395. m_List3.SetItemText(pos, 0, dlg.m_spid);
  1396. m_List3.SetItemText(pos, 1, GetSPNameFromId(dlg.m_spid));
  1397. str.Format("%f", GetSPPriceFromId3(dlg.m_spid));
  1398. ConvertToPrice(str);
  1399. m_List3.SetItemText(pos, 2, str);
  1400. m_List3.SetItemText(pos, 3, "1");
  1401. }
  1402. else
  1403. {
  1404. m_List3.InsertItem(pos, dlg.m_spid);
  1405. m_List3.SetItemText(pos, 1, GetSPNameFromId(dlg.m_spid));
  1406. str.Format("%f", GetSPPriceFromId3(dlg.m_spid));
  1407. ConvertToPrice(str);
  1408. m_List3.SetItemText(pos, 2, str);
  1409. m_List3.SetItemText(pos, 3, "1");
  1410. }
  1411. }
  1412. else
  1413. {
  1414. m_List3.InsertItem(pos, dlg.m_spid);
  1415. m_List3.SetItemText(pos, 1, GetSPNameFromId(dlg.m_spid));
  1416. str.Format("%f", GetSPPriceFromId3(dlg.m_spid));
  1417. ConvertToPrice(str);
  1418. m_List3.SetItemText(pos, 2, str);
  1419. m_List3.SetItemText(pos, 3, "1");
  1420. }
  1421. }
  1422. CalculateCost2();
  1423. }
  1424. void Booking::OnBUTdel()
  1425. {
  1426. // TODO: Add your control notification handler code here
  1427. POSITION pos;
  1428. pos = m_List3.GetFirstSelectedItemPosition();
  1429. if (pos == NULL)
  1430. {
  1431. AfxMessageBox("请先选中您要删除的项目!", MB_ICONINFORMATION);
  1432. return;
  1433. }
  1434. int iItem = m_List3.GetNextSelectedItem(pos);
  1435. m_List3.DeleteItem(iItem);
  1436. CalculateCost2();
  1437. int count = m_List3.GetItemCount();
  1438. if (count == 0)return;
  1439. if (iItem == count)
  1440. iItem = 0;
  1441. m_List3.SetItemState(iItem, LVIS_SELECTED, LVIS_SELECTED);
  1442. }
  1443. void Booking::OnBUTdelall()
  1444. {
  1445. // TODO: Add your control notification handler code here
  1446. m_List3.DeleteAllItems();
  1447. CalculateCost2();
  1448. }
  1449. void Booking::OnBUTspbox2()
  1450. {
  1451. // TODO: Add your control notification handler code here
  1452. SPBox dlg;
  1453. if (dlg.DoModal() != IDOK)return;
  1454. for (int a = 0; a < dlg.m_spidarray.GetSize(); a++)
  1455. {
  1456. dlg.m_spid = dlg.m_spidarray.ElementAt(a);
  1457. dlg.m_spname = dlg.m_spnamearray.ElementAt(a);
  1458. int pos = m_List1.GetItemCount();
  1459. CString str;
  1460. if (pos)
  1461. {
  1462. if (m_List1.GetItemText(pos - 1, 0).IsEmpty() && m_List1.GetItemText(pos - 1, 1).IsEmpty())
  1463. {
  1464. pos--;
  1465. m_List1.SetItemText(pos, 0, dlg.m_spid);
  1466. m_List1.SetItemText(pos, 1, GetSPNameFromId(dlg.m_spid));
  1467. str.Format("%f", GetSPPriceFromId3(dlg.m_spid));
  1468. ConvertToPrice(str);
  1469. m_List1.SetItemText(pos, 2, str);
  1470. m_List1.SetItemText(pos, 3, "1");
  1471. }
  1472. else
  1473. {
  1474. m_List1.InsertItem(pos, dlg.m_spid);
  1475. m_List1.SetItemText(pos, 1, GetSPNameFromId(dlg.m_spid));
  1476. str.Format("%f", GetSPPriceFromId3(dlg.m_spid));
  1477. ConvertToPrice(str);
  1478. m_List1.SetItemText(pos, 2, str);
  1479. m_List1.SetItemText(pos, 3, "1");
  1480. }
  1481. }
  1482. else
  1483. {
  1484. m_List1.InsertItem(pos, dlg.m_spid);
  1485. m_List1.SetItemText(pos, 1, GetSPNameFromId(dlg.m_spid));
  1486. str.Format("%f", GetSPPriceFromId3(dlg.m_spid));
  1487. ConvertToPrice(str);
  1488. m_List1.SetItemText(pos, 2, str);
  1489. m_List1.SetItemText(pos, 3, "1");
  1490. }
  1491. }
  1492. CalculateCost();
  1493. }
  1494. void Booking::OnBUTdel3()
  1495. {
  1496. // TODO: Add your control notification handler code here
  1497. POSITION pos;
  1498. pos = m_List1.GetFirstSelectedItemPosition();
  1499. if (pos == NULL)
  1500. {
  1501. AfxMessageBox("请先选中您要删除的项目!", MB_ICONINFORMATION);
  1502. return;
  1503. }
  1504. if (AfxMessageBox("确定要删除套系中的商品吗?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  1505. int iItem = m_List1.GetNextSelectedItem(pos);
  1506. m_List1.DeleteItem(iItem);
  1507. CalculateCost();
  1508. int count = m_List1.GetItemCount();
  1509. if (count == 0)return;
  1510. if (iItem == count)
  1511. iItem = 0;
  1512. m_List1.SetItemState(iItem, LVIS_SELECTED, LVIS_SELECTED);
  1513. }
  1514. void Booking::OnBUTdelall2()
  1515. {
  1516. // TODO: Add your control notification handler code here
  1517. if (AfxMessageBox("确定要删除套系中的商品吗?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  1518. m_List1.DeleteAllItems();
  1519. CalculateCost();
  1520. }
  1521. void Booking::CalculateCost()
  1522. {
  1523. int i = 0;
  1524. m_cost1 = 0;
  1525. CString str;
  1526. for ( i = 0; i < m_List1.GetItemCount(); i++)
  1527. {
  1528. m_cost1 += GetSPPriceFromId(m_List1.GetItemText(i, 0))*atof(m_List1.GetItemText(i, 3));
  1529. }
  1530. float cost2 = 0;
  1531. for (i = 0; i < m_List1.GetItemCount(); i++)
  1532. {
  1533. cost2 += GetSPPriceFromId3(m_List1.GetItemText(i, 0))*atof(m_List1.GetItemText(i, 3));
  1534. }
  1535. str.Format("套系包含商品,成本:%0.1f,售价:%0.1f", m_cost1, cost2);
  1536. str.Format("套系包含商品,总价:%0.1f", cost2);
  1537. ::ConvertToPrice(str);
  1538. SetDlgItemText(IDC_STATIC2, str);
  1539. }
  1540. void Booking::CalculateCost2()
  1541. {
  1542. int i = 0;
  1543. m_cost2 = 0;
  1544. CString str;
  1545. for ( i = 0; i < m_List3.GetItemCount(); i++)
  1546. {
  1547. m_cost2 += GetSPPriceFromId(m_List3.GetItemText(i, 0))*atof(m_List3.GetItemText(i, 3));
  1548. }
  1549. float cost2 = 0;
  1550. for (i = 0; i < m_List3.GetItemCount(); i++)
  1551. {
  1552. cost2 += GetSPPriceFromId3(m_List3.GetItemText(i, 0))*atof(m_List3.GetItemText(i, 3));
  1553. }
  1554. #ifndef CHILD_VERSION
  1555. str.Format ("婚庆服务,成本:%0.1f,售价:%0.1f", m_cost2,cost2);
  1556. #else
  1557. str.Format("增加产品,成本:%0.1f,售价:%0.1f", m_cost2, cost2);
  1558. #endif
  1559. #ifndef CHILD_VERSION
  1560. str.Format ("婚庆服务,总价:%0.1f",cost2);
  1561. #else
  1562. str.Format("增加产品,总价:%0.1f", cost2);
  1563. #endif
  1564. ::ConvertToPrice(str);
  1565. SetDlgItemText(IDC_STATIC4, str);
  1566. }
  1567. void Booking::SaveCard2Data()
  1568. {
  1569. if (m_type == 1)
  1570. {
  1571. CString m_point;
  1572. m_point.Format("%d", atol(m_money1) / 100);
  1573. m_point.Format("%d", atol(m_point) * 100);
  1574. CString m_card2no = m_memberno2;
  1575. CString date2 = m_memberno2date;
  1576. CString m_name = m_membernoname;
  1577. CString m_sex = m_membernosex;
  1578. CString m_phone = m_membernophone;
  1579. CString sql;
  1580. sql = "delete from membercard2 where [card2no]='" + m_card2no + "'";
  1581. sql += "@@@insert into [memberreg]([memberno],[dindanid],[money],[date],[card2no],[type],[taoxi],[date2])values('" + m_memberno + "','" + m_sid + "','" + m_point + "','" + g_date + "','" + m_card2no + "','转介绍','" + taoxiname + "','" + date2 + "')";
  1582. sql += "@@@";
  1583. m_point.Format("%d", atol(m_point) / 100);
  1584. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(51))) // msgcheck5
  1585. {
  1586. CString m_content5 = g_cominfoarray.ElementAt(0).ElementAt(52);
  1587. CString content, timestamp;
  1588. CString name;
  1589. if (!m_name1.IsEmpty())
  1590. name = m_name1 + ",";
  1591. name += m_name2;
  1592. name.TrimRight(",");
  1593. CString name2 = m_name;
  1594. #ifndef CHILD_VERSION
  1595. if(m_sex=="男")
  1596. name2+="先生";
  1597. else if(m_sex=="女")
  1598. name2+="女士";
  1599. #endif
  1600. content.Format("%s您好,您的朋友%s为您积分%s分.", name2, name, m_point);
  1601. content += m_content5;
  1602. timestamp = CTime::GetCurrentTime().Format("%Y%m%d%H%M%S");
  1603. if (CheckPhoneType(m_phone) != -1 && CheckBadWords(content, 0))
  1604. {
  1605. int count = GetLengthEx(content) / MSG_LENGTH;
  1606. if (GetLengthEx(content) % MSG_LENGTH)
  1607. count++;
  1608. CString scount;
  1609. scount.Format("%d", count);
  1610. #if JEFF_TEST_ON
  1611. CString sql2 = _T("");
  1612. sql2.Format(INSERT_SENDREG,_T("5"),m_phone,content,timestamp,scount, _T("0"), _T("0"), _T("0"), _T("系统自动发送"));
  1613. sql += sql2;
  1614. #else
  1615. CString sql2 = "insert into [sendreg]([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('" + m_phone + "','" + content + "','" + timestamp + "','" + scount + "','0','0','0','系统自动发送')";
  1616. sql += sql2;
  1617. #endif
  1618. sql += "@@@";
  1619. }
  1620. }
  1621. sql += m_memberno;
  1622. g_sendhead.bsql = 1;
  1623. g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
  1624. }
  1625. else if (m_type == 3)
  1626. {
  1627. CString m_rate;
  1628. CString filter = "[memberno]='" + m_memberno + "'";
  1629. g_sendhead.bsql = 0;
  1630. g_sendhead.code[0] = 132;
  1631. g_sendhead.tabcount = 1;
  1632. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  1633. DataToArray(&g_List1array);
  1634. if (g_List1array.GetSize() % 5 == 0)
  1635. m_rate = "5%";
  1636. else if (g_List1array.GetSize() % 5 == 1)
  1637. m_rate = "10%";
  1638. else if (g_List1array.GetSize() % 5 == 2)
  1639. m_rate = "15%";
  1640. else if (g_List1array.GetSize() % 5 == 3)
  1641. m_rate = "20%";
  1642. else if (g_List1array.GetSize() % 5 == 4)
  1643. m_rate = "50%";
  1644. float frate = atof(m_rate) / 100.0;
  1645. CString m_point;
  1646. m_point.Format("%d", (int)(min(atof(m_money1), atof(m_membernojiage))*frate));
  1647. CString m_card2no = m_memberno2;
  1648. CString date2 = m_memberno2date;
  1649. CString m_name = m_membernoname;
  1650. CString m_sex = m_membernosex;
  1651. CString m_phone = m_membernophone;
  1652. CString sql;
  1653. sql = "delete from [membercard2blue] where [card2no]='" + m_card2no + "'";
  1654. sql += "~~~insert into [memberregblue]([memberno],[dindanid],[money],[date],[card2no],[type],[taoxi],[date2])values('" + m_memberno + "','" + m_sid + "','" + m_point + "','" + g_date + "','" + m_card2no + "','转介绍','" + taoxiname + "','" + date2 + "')";
  1655. sql += "~~~";
  1656. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(51)))
  1657. {
  1658. CString m_content5 = g_cominfoarray.ElementAt(0).ElementAt(52);
  1659. CString content, timestamp;
  1660. CString name;
  1661. if (!m_name1.IsEmpty())
  1662. name = m_name1 + ",";
  1663. name += m_name2;
  1664. name.TrimRight(",");
  1665. CString name2 = m_name;
  1666. #ifndef CHILD_VERSION
  1667. if(m_sex=="男")
  1668. name2+="先生";
  1669. else if(m_sex=="女")
  1670. name2+="女士";
  1671. #endif
  1672. content.Format("%s您好,您的朋友%s为您返现金%s元.", name2, name, m_point);
  1673. content += m_content5;
  1674. timestamp = CTime::GetCurrentTime().Format("%Y%m%d%H%M%S");
  1675. if (CheckPhoneType(m_phone) != -1 && CheckBadWords(content, 0))
  1676. {
  1677. int count = GetLengthEx(content) / MSG_LENGTH;
  1678. if (GetLengthEx(content) % MSG_LENGTH)
  1679. count++;
  1680. CString scount;
  1681. scount.Format("%d", count);
  1682. #if JEFF_TEST_ON
  1683. CString sql2 = _T("");
  1684. sql2.Format(INSERT_SENDREG, _T("5"), m_phone, content, timestamp, scount, _T("0"), _T("0"), _T("0"), _T("系统自动发送"));
  1685. sql += sql2;
  1686. #else
  1687. CString sql2 = "insert into [sendreg]([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('" + m_phone + "','" + content + "','" + timestamp + "','" + scount + "','0','0','0','系统自动发送')";
  1688. sql += sql2;
  1689. #endif
  1690. sql += "~~~";
  1691. }
  1692. }
  1693. sql += m_memberno;
  1694. g_sendhead.bsql = 1;
  1695. g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
  1696. }
  1697. }
  1698. void Booking::OnBUTaddjd()
  1699. {
  1700. // TODO: Add your control notification handler code here
  1701. SPLBDlg dlg;
  1702. dlg.m_mode = 2;
  1703. if (dlg.DoModal() == IDOK)
  1704. {
  1705. for (int i = 0; i < dlg.m_array.GetSize(); i++)
  1706. m_listbox1.AddString(dlg.m_array.ElementAt(i));
  1707. }
  1708. }
  1709. void Booking::OnBUTdeljd()
  1710. {
  1711. // TODO: Add your control notification handler code here
  1712. int pos = m_listbox1.GetCurSel();
  1713. if (pos == -1)
  1714. {
  1715. AfxMessageBox("请选中您要删除的景点!", MB_ICONINFORMATION); return;
  1716. }
  1717. m_listbox1.DeleteString(pos);
  1718. int count = m_listbox1.GetCount();
  1719. if (pos < count)
  1720. m_listbox1.SetCurSel(pos);
  1721. else if (count && pos == count)
  1722. m_listbox1.SetCurSel(0);
  1723. }
  1724. void Booking::OnBUTinfo1() // 客人资料按钮;
  1725. {
  1726. // TODO: Add your control notification handler code here
  1727. CRect rc;
  1728. GetDlgItem(IDC_STATIC5)->GetWindowRect(rc);
  1729. ScreenToClient(rc);
  1730. m_page1.Create(IDD_DLGBookingPage1, this);
  1731. m_page1.MoveWindow(rc);
  1732. m_page1.ShowWindow(SW_SHOW);
  1733. }
  1734. void Booking::OnBUTinfo2()
  1735. {
  1736. // TODO: Add your control notification handler code here
  1737. }
  1738. void Booking::OnBUTinfo3()
  1739. {
  1740. // TODO: Add your control notification handler code here
  1741. }