Booking.cpp 51 KB

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