Booking.cpp 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917
  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],[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','','','','','')",
  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. g_sendhead.bsql=1;
  660. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  661. CArray<CStringArray, CStringArray>sparray;
  662. sparray.SetSize(m_List1.GetItemCount ()+m_List3.GetItemCount ()+m_listbox1.GetCount());
  663. int realcount=0;
  664. int i = 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_userarray.GetSize (); ii++)
  899. {
  900. m_renyuanarray.Add ( g_userarray.ElementAt (ii).ElementAt(2) );
  901. m_renyuanarray.Add ( g_userarray.ElementAt (ii).ElementAt(1) );
  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)) )
  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) && CheckBadWords2(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. CString sql2="insert into [sendreg]([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('"+m_phone+"','"+content+"','"+timestamp+"','"+scount+"','0','0','0','系统自动发送')";
  1611. sql+=sql2;sql+="@@@";
  1612. }
  1613. }
  1614. sql+=m_memberno;
  1615. g_sendhead.bsql=1;
  1616. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  1617. }
  1618. else if(m_type==3)
  1619. {
  1620. CString m_rate;
  1621. CString filter="[memberno]='"+m_memberno+"'";
  1622. g_sendhead.bsql=0;
  1623. g_sendhead.code[0]=132;
  1624. g_sendhead.tabcount=1;
  1625. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  1626. DataToArray(&g_List1array);
  1627. if(g_List1array.GetSize ()%5==0)
  1628. m_rate="5%";
  1629. else if(g_List1array.GetSize ()%5==1)
  1630. m_rate="10%";
  1631. else if(g_List1array.GetSize ()%5==2)
  1632. m_rate="15%";
  1633. else if(g_List1array.GetSize ()%5==3)
  1634. m_rate="20%";
  1635. else if(g_List1array.GetSize ()%5==4)
  1636. m_rate="50%";
  1637. float frate=atof(m_rate)/100.0;
  1638. CString m_point;
  1639. m_point.Format ("%d", (int)(min(atof(m_money1),atof(m_membernojiage))*frate));
  1640. CString m_card2no=m_memberno2;
  1641. CString date2=m_memberno2date;
  1642. CString m_name=m_membernoname ;
  1643. CString m_sex=m_membernosex ;
  1644. CString m_phone=m_membernophone ;
  1645. CString sql;
  1646. sql="delete from [membercard2blue] where [card2no]='"+m_card2no+"'";
  1647. 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+"')";
  1648. sql+="~~~";
  1649. if( atoi(g_cominfoarray.ElementAt(0).ElementAt(51)) )
  1650. {
  1651. CString m_content5 = g_cominfoarray.ElementAt(0).ElementAt(52);
  1652. CString content,timestamp;
  1653. CString name;
  1654. if(!m_name1.IsEmpty ())
  1655. name=m_name1+",";
  1656. name+=m_name2;
  1657. name.TrimRight (",");
  1658. CString name2=m_name;
  1659. #ifndef CHILD_VERSION
  1660. if(m_sex=="男")
  1661. name2+="先生";
  1662. else if(m_sex=="女")
  1663. name2+="女士";
  1664. #endif
  1665. content.Format ("%s您好,您的朋友%s为您返现金%s元.", name2, name, m_point);
  1666. content+=m_content5;
  1667. timestamp=CTime::GetCurrentTime ().Format ("%Y%m%d%H%M%S");
  1668. if( CheckPhoneType(m_phone)!=-1 && CheckBadWords(content,0)&& CheckBadWords2(content,0) )
  1669. {
  1670. int count=GetLengthEx(content)/MSG_LENGTH;
  1671. if(GetLengthEx(content)%MSG_LENGTH)
  1672. count++;
  1673. CString scount;
  1674. scount.Format ("%d", count);
  1675. CString sql2="insert into [sendreg]([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('"+m_phone+"','"+content+"','"+timestamp+"','"+scount+"','0','0','0','系统自动发送')";
  1676. sql+=sql2;sql+="~~~";
  1677. }
  1678. }
  1679. sql+=m_memberno;
  1680. g_sendhead.bsql=1;
  1681. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  1682. }
  1683. }
  1684. void Booking::OnBUTaddjd()
  1685. {
  1686. // TODO: Add your control notification handler code here
  1687. SPLBDlg dlg;
  1688. dlg.m_mode =2;
  1689. if(dlg.DoModal ()==IDOK)
  1690. {
  1691. for(int i=0; i<dlg.m_array.GetSize (); i++)
  1692. m_listbox1.AddString (dlg.m_array.ElementAt (i) );
  1693. }
  1694. }
  1695. void Booking::OnBUTdeljd()
  1696. {
  1697. // TODO: Add your control notification handler code here
  1698. int pos=m_listbox1.GetCurSel ();
  1699. if(pos==-1)
  1700. {
  1701. AfxMessageBox("请选中您要删除的景点!", MB_ICONINFORMATION);return;
  1702. }
  1703. m_listbox1.DeleteString (pos);
  1704. int count=m_listbox1.GetCount ();
  1705. if(pos<count)
  1706. m_listbox1.SetCurSel (pos);
  1707. else if(count && pos==count)
  1708. m_listbox1.SetCurSel (0);
  1709. }
  1710. void Booking::OnBUTinfo1()
  1711. {
  1712. // TODO: Add your control notification handler code here
  1713. CRect rc;
  1714. GetDlgItem(IDC_STATIC5)->GetWindowRect(rc);
  1715. ScreenToClient(rc);
  1716. m_page1.Create (IDD_DLGBookingPage1, this);
  1717. m_page1.MoveWindow (rc);
  1718. m_page1.ShowWindow (SW_SHOW);
  1719. }
  1720. void Booking::OnBUTinfo2()
  1721. {
  1722. // TODO: Add your control notification handler code here
  1723. }
  1724. void Booking::OnBUTinfo3()
  1725. {
  1726. // TODO: Add your control notification handler code here
  1727. }