Booking.cpp 51 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919
  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. ChinesePinYin::GetFirstLetter(m_name1, strRes1);
  628. ChinesePinYin::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);
  661. if (g_bSendOK == 0)return;
  662. CArray<CStringArray, CStringArray>sparray;
  663. sparray.SetSize(m_List1.GetItemCount() + m_List3.GetItemCount() + m_listbox1.GetCount());
  664. int realcount = 0;
  665. int i = 0;
  666. for ( i = 0; i < m_List1.GetItemCount(); i++)
  667. {
  668. str = m_List1.GetItemText(i, 1);
  669. str.TrimLeft(); str.TrimRight();
  670. if (str.IsEmpty())
  671. continue;
  672. sparray.ElementAt(realcount).Add(id);
  673. sparray.ElementAt(realcount).Add(m_List1.GetItemText(i, 0));
  674. sparray.ElementAt(realcount).Add(m_List1.GetItemText(i, 2));
  675. sparray.ElementAt(realcount).Add(m_List1.GetItemText(i, 3));
  676. sparray.ElementAt(realcount).Add("1");
  677. sparray.ElementAt(realcount).Add(m_List1.GetItemText(i, 1));
  678. sparray.ElementAt(realcount).Add(m_List1.GetItemText(i, 4));
  679. sparray.ElementAt(realcount).Add(m_List1.GetItemText(i, 5));
  680. realcount++;
  681. }
  682. for (i = 0; i < m_List3.GetItemCount(); i++)
  683. {
  684. str = m_List3.GetItemText(i, 1);
  685. str.TrimLeft(); str.TrimRight();
  686. if (str.IsEmpty())continue;
  687. sparray.ElementAt(realcount).Add(id);
  688. sparray.ElementAt(realcount).Add(m_List3.GetItemText(i, 0));
  689. sparray.ElementAt(realcount).Add(m_List3.GetItemText(i, 2));
  690. sparray.ElementAt(realcount).Add(m_List3.GetItemText(i, 3));
  691. sparray.ElementAt(realcount).Add("2");
  692. sparray.ElementAt(realcount).Add(m_List3.GetItemText(i, 1));
  693. sparray.ElementAt(realcount).Add("");
  694. sparray.ElementAt(realcount).Add("");
  695. realcount++;
  696. }
  697. for (i = 0; i < m_listbox1.GetCount(); i++)
  698. {
  699. m_listbox1.GetText(i, str);
  700. sparray.ElementAt(realcount).Add(id);
  701. sparray.ElementAt(realcount).Add(str);
  702. realcount++;
  703. }
  704. sparray.SetSize(realcount);
  705. if (realcount == 0)
  706. {
  707. sparray.SetSize(1);
  708. sparray.ElementAt(0).Add(id);
  709. }
  710. CMemFile memfile;
  711. CArchive ar(&memfile, CArchive::store);
  712. for (int ii = 0; ii < sparray.GetSize(); ii++)
  713. {
  714. sparray.ElementAt(ii).Serialize(ar);
  715. }
  716. ar.Close();
  717. int length = memfile.GetLength();
  718. BYTE *pData = memfile.Detach();
  719. int size = sparray.GetSize();
  720. BYTE *pData2 = new BYTE[length + sizeof(int)];
  721. memcpy(pData2, pData, length);
  722. memcpy(pData2 + length, &size, sizeof(int));
  723. delete[]pData;
  724. length += sizeof(int);
  725. g_nSendCode = 3;
  726. g_pMainWnd->ProcessChatMessageRequest2(pData2, length);
  727. g_nSendCode = 0;
  728. delete[]pData2;
  729. if (g_bSendOK == 0)return;
  730. AfxMessageBox("保存成功!", MB_ICONINFORMATION);
  731. if (m_type == 1 || m_type == 3)
  732. SaveCard2Data();
  733. GetDlgItem(IDC_BUTsave)->EnableWindow(0);
  734. GetDlgItem(IDC_BUTclient)->EnableWindow(1);
  735. GetDlgItem(IDC_BUTprint)->EnableWindow(1);
  736. if (IsHasRights2(4))
  737. GetDlgItem(IDC_BUTWaiter)->EnableWindow(1);
  738. CString phone;
  739. if (bAdd)
  740. {
  741. #ifdef CHILD_VERSION
  742. CClientDlg2 dlg;
  743. #else
  744. CClientDlg dlg;
  745. dlg.m_hqtime=m_time3;
  746. #endif
  747. dlg.m_phone1 = m_phone1;
  748. dlg.m_phone2 = m_phone2;
  749. dlg.m_bAdd = 1;
  750. dlg.m_bNeedSendMsg = 1;
  751. dlg.id = id;
  752. dlg.m_name1 = m_name1;
  753. dlg.m_name2 = m_name2;
  754. if (dlg.DoModal() == IDOK)
  755. {
  756. #ifdef CHILD_VERSION
  757. phone = dlg.m_phone1;
  758. #else
  759. phone=dlg.m_phone2 ;
  760. #endif
  761. m_name1 = dlg.m_name1;
  762. m_name2 = dlg.m_name2;
  763. UpdateData(false);
  764. }
  765. }
  766. BOOL bNeedCard = 0;
  767. if (m_type == 1 || m_type == 2 || m_type == 3)
  768. bNeedCard = 1;
  769. if (m_memberno.IsEmpty())
  770. bNeedCard = 1;
  771. if (bNeedCard)
  772. {
  773. SelMemberType dlg;
  774. if (dlg.DoModal() == IDOK)
  775. {
  776. if (dlg.m_type == 0)
  777. {
  778. AddMember dlg;
  779. dlg.m_name = m_name2;
  780. dlg.m_phone = phone;
  781. if (dlg.DoModal() == IDOK)
  782. {
  783. if (AfxMessageBox("会员添加成功,是否发放副卡?", MB_YESNO | MB_ICONINFORMATION) == IDYES)
  784. {
  785. InputCard2Dlg dlg2;
  786. dlg2.m_name = dlg.m_name;
  787. dlg2.m_no = dlg.m_memberno;
  788. dlg2.DoModal();
  789. }
  790. sql = "update dindan set [memberno]='" + dlg.m_memberno + "' where [id]='" + id + "'";
  791. g_sendhead.bsql = 1;
  792. g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
  793. }
  794. }
  795. else
  796. {
  797. AddMember dlg;
  798. dlg.m_mode = 1;
  799. dlg.m_name = m_name2;
  800. dlg.m_phone = phone;
  801. dlg.m_jiage = m_money1;
  802. if (dlg.DoModal() == IDOK)
  803. {
  804. if (AfxMessageBox("会员添加成功,是否发放副卡?", MB_YESNO | MB_ICONINFORMATION) == IDYES)
  805. {
  806. InputCard2Dlg dlg2;
  807. dlg2.m_mode = 1;
  808. dlg2.m_name = dlg.m_name;
  809. dlg2.m_no = dlg.m_memberno;
  810. dlg2.DoModal();
  811. }
  812. sql = "update dindan set [memberno]='" + dlg.m_memberno + "' where [id]='" + id + "'";
  813. g_sendhead.bsql = 1;
  814. g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
  815. }
  816. }
  817. }
  818. }
  819. }
  820. void Booking::OnBUTclose()
  821. {
  822. // TODO: Add your control notification handler code here
  823. GetParent()->SendMessage(WM_CLOSE);
  824. }
  825. void Booking::OnChangeEDITtaoxijiage()
  826. {
  827. // TODO: If this is a RICHEDIT control, the control will not
  828. // send this notification unless you override the MyFormView::OnInitDialog()
  829. // function and call CRichEditCtrl().SetEventMask()
  830. // with the ENM_CHANGE flag ORed into the mask.
  831. /* UpdateData();
  832. CString str;
  833. float list3money=0;
  834. for(int i=0; i<m_List3.GetItemCount (); i++)
  835. {
  836. list3money+=GetSPPriceFromId(m_List3.GetItemText (i, 0))*atof(m_List3.GetItemText(i,3));
  837. }
  838. m_money1.Format ("%f", list3money+atof(m_taoxijiage)-atof(m_discount));
  839. m_money2=m_payed1;
  840. m_money3.Format ("%f", atof(m_money1)-atof(m_money2));
  841. ConvertToPrice(m_money1);
  842. ConvertToPrice(m_money2);
  843. ConvertToPrice(m_money3);
  844. UpdateData(false);
  845. */
  846. UpdateData();
  847. CString str;
  848. float list3money = 0;
  849. /* for(int i=0; i<m_List3.GetItemCount (); i++)
  850. {
  851. list3money+=GetSPPriceFromId(m_List3.GetItemText (i, 0))*atof(m_List3.GetItemText(i,3));
  852. }*/
  853. m_money1.Format("%f", list3money + atof(m_taoxijiage) - atof(m_discount) + atof(m_payed4));
  854. m_money2.Format("%f", atof(m_payed5));
  855. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  856. ConvertToPrice(m_money1);
  857. ConvertToPrice(m_money2);
  858. ConvertToPrice(m_money3);
  859. UpdateData(false);
  860. // TODO: Add your control notification handler code here
  861. }
  862. void Booking::OnChangeEDITdiscount()
  863. {
  864. // TODO: If this is a RICHEDIT control, the control will not
  865. // send this notification unless you override the MyFormView::OnInitDialog()
  866. // function and call CRichEditCtrl().SetEventMask()
  867. // with the ENM_CHANGE flag ORed into the mask.
  868. OnChangeEDITtaoxijiage();
  869. // TODO: Add your control notification handler code here
  870. }
  871. void Booking::OnChangeEDITpayed1()
  872. {
  873. // TODO: If this is a RICHEDIT control, the control will not
  874. // send this notification unless you override the MyFormView::OnInitDialog()
  875. // function and call CRichEditCtrl().SetEventMask()
  876. // with the ENM_CHANGE flag ORed into the mask.
  877. OnChangeEDITtaoxijiage();
  878. // TODO: Add your control notification handler code here
  879. }
  880. void Booking::OnDropdownCOMBObm()
  881. {
  882. // TODO: Add your control notification handler code here
  883. if (m_combobm.GetCount() < 2)
  884. {
  885. g_sendhead.bsql = 0;
  886. g_sendhead.code[0] = 3;
  887. g_sendhead.tabcount = 1;
  888. g_pMainWnd->ProcessChatMessageRequest2(3); if (g_bSendOK == 0)return;
  889. DataToArray(&g_List1array);
  890. for (int ii = 0; ii < g_List1array.GetSize(); ii++)
  891. m_combobm.AddString(g_List1array.ElementAt(ii).ElementAt(0));
  892. }
  893. }
  894. void Booking::OnDropdownCOMBOrenyuan()
  895. {
  896. // TODO: Add your control notification handler code here
  897. if (m_renyuanarray.GetSize() == 0)
  898. {
  899. for (int ii = 0; ii < g_userarray.GetSize(); ii++)
  900. {
  901. m_renyuanarray.Add(g_userarray.ElementAt(ii).ElementAt(2));
  902. m_renyuanarray.Add(g_userarray.ElementAt(ii).ElementAt(1));
  903. }
  904. }
  905. m_comborenyuan.ResetContent();
  906. int pos = m_combobm.GetCurSel();
  907. if (pos == -1)
  908. {
  909. for (int ii = 0; ii < m_renyuanarray.GetSize(); ii += 2)
  910. {
  911. m_comborenyuan.AddString(m_renyuanarray.ElementAt(ii + 1));
  912. }
  913. }
  914. else
  915. {
  916. CString str;
  917. m_combobm.GetLBText(pos, str);
  918. for (int ii = 0; ii < m_renyuanarray.GetSize(); ii += 2)
  919. {
  920. if (str == m_renyuanarray.ElementAt(ii))
  921. m_comborenyuan.AddString(m_renyuanarray.ElementAt(ii + 1));
  922. }
  923. }
  924. }
  925. void Booking::OnSelchangeCOMBObm()
  926. {
  927. // TODO: Add your control notification handler code here
  928. m_comborenyuan.ResetContent();
  929. m_comborenyuan.SetCurSel(-1);
  930. }
  931. void Booking::OnDropdownCOMBOid()
  932. {
  933. // TODO: Add your control notification handler code here
  934. if (m_comboid.GetCount() == 0)
  935. {
  936. CString date = g_date;
  937. CString sql;
  938. // sql="select count(*) as cot from dindan where time1='"+date+"' ";
  939. sql = "select max(id) as cot from dindan where time1='" + date + "' ";
  940. g_sendhead.bsql = 1;
  941. g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
  942. date.Replace("-", "");
  943. CString id;
  944. id.Format("%s-%03d", date, g_ncount + 1);
  945. m_comboid.AddString(id);
  946. }
  947. }
  948. void Booking::OnSelchangeCOMBOid()
  949. {
  950. // TODO: Add your control notification handler code here
  951. int pos = m_comboid.GetCurSel();
  952. m_phone1 = m_phone2 = "";
  953. GetDlgItem(IDC_BUTprint)->EnableWindow(pos);
  954. if (IsHasRights2new(0))
  955. {
  956. GetDlgItem(IDC_BUTsave)->EnableWindow(pos == 0);
  957. // GetDlgItem(IDC_BUTclient)->EnableWindow(pos==0);
  958. }
  959. else
  960. GetDlgItem(IDC_BUTsave)->EnableWindow(0);
  961. //订单修改权限
  962. // GetDlgItem(IDC_BUTsave)->EnableWindow(IsHasRights2new(1));
  963. // if(pos)
  964. // GetDlgItem(IDC_BUTclient)->EnableWindow(IsHasRights2new(1));
  965. m_memberno = "";
  966. m_memberno2 = "";
  967. m_type = 0;
  968. if (pos < 1)
  969. {
  970. ClearCtrl();
  971. InputMemberno dlg;
  972. dlg.m_bNoAdd = 1;
  973. if (dlg.DoModal() == IDOK)
  974. {
  975. m_memberno = dlg.m_memberno;
  976. m_memberno2 = dlg.m_memberno2;
  977. m_type = dlg.m_type;
  978. m_memberno2date = dlg.m_memberno2date;
  979. m_membernoname = dlg.m_membernoname;
  980. m_membernosex = dlg.m_membernosex;
  981. m_membernophone = dlg.m_membernophone;
  982. m_membernojiage = dlg.m_membernojiage;
  983. SetDlgItemText(IDC_EDITwaiter6, m_memberno);
  984. }
  985. return;
  986. }
  987. CString id;
  988. m_comboid.GetLBText(pos, id);
  989. CString filter = "id='" + id + "';id='" + id + "' and kind<>'4' and kind<>'5'";
  990. g_sendhead.code[0] = 11;
  991. g_sendhead.code[1] = 50;
  992. g_sendhead.tabcount = 2;
  993. g_sendhead.bsql = 0;
  994. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  995. CArray<CStringArray, CStringArray>sparray;
  996. DataToArray(&g_List1array, &sparray);
  997. CString bm, ren;
  998. m_takephotomoney = g_List1array.ElementAt(0).ElementAt(2);
  999. m_choosephotomoney = g_List1array.ElementAt(0).ElementAt(3);
  1000. m_name1 = g_List1array.ElementAt(0).ElementAt(4);
  1001. m_name2 = g_List1array.ElementAt(0).ElementAt(5);
  1002. m_taoxiid = g_List1array.ElementAt(0).ElementAt(6);
  1003. taoxiname = g_List1array.ElementAt(0).ElementAt(7);
  1004. m_taoxijiage = g_List1array.ElementAt(0).ElementAt(8);
  1005. m_zs = g_List1array.ElementAt(0).ElementAt(9);
  1006. m_time1 = g_List1array.ElementAt(0).ElementAt(10);
  1007. m_time2 = g_List1array.ElementAt(0).ElementAt(11);
  1008. m_time3 = g_List1array.ElementAt(0).ElementAt(12);
  1009. bm = g_List1array.ElementAt(0).ElementAt(13);
  1010. ren = g_List1array.ElementAt(0).ElementAt(14);
  1011. m_discount = g_List1array.ElementAt(0).ElementAt(15);
  1012. m_payed1 = g_List1array.ElementAt(0).ElementAt(16);
  1013. m_payed2 = g_List1array.ElementAt(0).ElementAt(17);
  1014. m_payed3 = g_List1array.ElementAt(0).ElementAt(18);
  1015. m_payed4 = g_List1array.ElementAt(0).ElementAt(19);
  1016. m_payed5 = g_List1array.ElementAt(0).ElementAt(20);
  1017. m_clothescount = g_List1array.ElementAt(0).ElementAt(26);
  1018. m_clothescount2 = g_List1array.ElementAt(0).ElementAt(27);
  1019. m_outside = g_List1array.ElementAt(0).ElementAt(28);
  1020. m_outside2 = g_List1array.ElementAt(0).ElementAt(29);
  1021. m_style = g_List1array.ElementAt(0).ElementAt(30);
  1022. m_waiter1 = g_List1array.ElementAt(0).ElementAt(34);
  1023. m_waiter2 = g_List1array.ElementAt(0).ElementAt(35);
  1024. m_waiter3 = g_List1array.ElementAt(0).ElementAt(36);
  1025. m_waiter4 = g_List1array.ElementAt(0).ElementAt(37);
  1026. m_bz = g_List1array.ElementAt(0).ElementAt(38);
  1027. m_waiter6 = g_List1array.ElementAt(0).ElementAt(41);
  1028. pos = m_combotaoxiname.FindString(0, taoxiname);
  1029. if (pos == -1)
  1030. {
  1031. m_combotaoxiname.InsertString(0, taoxiname);
  1032. m_combotaoxiname.SetCurSel(0);
  1033. }
  1034. else
  1035. m_combotaoxiname.SetCurSel(pos);
  1036. pos = m_combobm.FindString(0, bm);
  1037. if (pos == -1)
  1038. {
  1039. m_combobm.ResetContent();
  1040. m_combobm.InsertString(0, bm);
  1041. m_combobm.SetCurSel(0);
  1042. }
  1043. else
  1044. m_combobm.SetCurSel(pos);
  1045. pos = m_comborenyuan.FindString(0, ren);
  1046. if (pos == -1)
  1047. {
  1048. m_comborenyuan.InsertString(0, ren);
  1049. m_comborenyuan.SetCurSel(0);
  1050. }
  1051. else
  1052. m_comborenyuan.SetCurSel(pos);
  1053. UpdateData(false);
  1054. m_List1.DeleteAllItems();
  1055. m_List3.DeleteAllItems();
  1056. int listpos[2] = { 0 };
  1057. CEditListCtrl *pList[2] = { &m_List1, &m_List3 };
  1058. for (int i = 0; i < sparray.GetSize(); i++)
  1059. {
  1060. pos = atoi(sparray.ElementAt(i).ElementAt(4)) - 1;
  1061. if (pos>1)pos = 0;
  1062. pList[pos]->InsertItem(listpos[pos], sparray.ElementAt(i).ElementAt(1));
  1063. pList[pos]->SetItemText(listpos[pos], 1, sparray.ElementAt(i).ElementAt(5));
  1064. pList[pos]->SetItemText(listpos[pos], 2, sparray.ElementAt(i).ElementAt(2));
  1065. pList[pos]->SetItemText(listpos[pos], 3, sparray.ElementAt(i).ElementAt(3));
  1066. listpos[pos]++;
  1067. }
  1068. OnChangeEDITtaoxijiage();
  1069. CalculateCost();
  1070. CalculateCost2();
  1071. }
  1072. void Booking::ClearCtrl()
  1073. {
  1074. m_money1 = _T("");
  1075. m_money2 = _T("");
  1076. m_money3 = _T("");
  1077. m_choosephotomoney = _T("");
  1078. m_name1 = _T("");
  1079. m_name2 = _T("");
  1080. m_taoxiid = _T("");
  1081. m_taoxijiage = _T("");
  1082. m_zs = _T("");
  1083. m_time1 = g_date;
  1084. m_time2 = _T("");
  1085. m_time3 = _T("");
  1086. m_bz = _T("");
  1087. m_discount = _T("");
  1088. m_payed1 = _T("");
  1089. m_payed2 = _T("");
  1090. m_payed3 = _T("");
  1091. m_payed4 = _T("");
  1092. m_payed5 = _T("");
  1093. m_clothescount = _T("");
  1094. m_clothescount2 = _T("");
  1095. m_outside = _T("");
  1096. m_outside2 = _T("");
  1097. m_style = _T("");
  1098. m_waiter1 = _T("");
  1099. m_waiter2 = _T("");
  1100. m_waiter3 = _T("");
  1101. m_waiter4 = _T("");
  1102. m_waiter6 = g_user.name;
  1103. m_combotaoxiname.SetCurSel(-1);
  1104. m_combobm.SetCurSel(-1);
  1105. m_comborenyuan.SetCurSel(-1);
  1106. UpdateData(false);
  1107. m_List1.DeleteAllItems();
  1108. m_List3.DeleteAllItems();
  1109. }
  1110. void Booking::OnBUTWaiter()
  1111. {
  1112. if (AfxMessageBox("是否导入订单?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  1113. CFileDialog fdlg(true, NULL, "", OFN_HIDEREADONLY, "影楼订单文件(*.*)|*.dan||");
  1114. if (fdlg.DoModal() != IDOK)return;
  1115. CString path = fdlg.GetFileName();
  1116. CArray<CStringArray, CStringArray>g_Sel1array[20];//精英团队
  1117. CArray<CStringArray, CStringArray>g_Sel2array[20];//景点介绍
  1118. CArray<CStringArray, CStringArray>g_Sel3array[20];//套系内容
  1119. CArray<CStringArray, CStringArray>g_Sel4array[20];//产品展示
  1120. CArray<CStringArray, CStringArray>g_Sel5array[20];//礼服介绍
  1121. CString g_name1;
  1122. CString g_name2;
  1123. CString g_phone1;
  1124. CString g_phone2;
  1125. CString g_price1;
  1126. CString g_price2;
  1127. CString g_date;
  1128. {
  1129. CString str = path;
  1130. int pos = str.Find(".");
  1131. if (pos == -1)return;
  1132. str = str.Left(pos);
  1133. pos = str.Find(" ");
  1134. if (pos == -1)return;
  1135. g_name1 = str.Left(pos); str = str.Right(str.GetLength() - pos - 1);
  1136. pos = str.Find(" ");
  1137. if (pos == -1)return;
  1138. g_name2 = str.Left(pos); str = str.Right(str.GetLength() - pos - 1);
  1139. pos = str.Find(" ");
  1140. if (pos == -1)return;
  1141. g_phone1 = str.Left(pos); str = str.Right(str.GetLength() - pos - 1);
  1142. pos = str.Find(" ");
  1143. if (pos == -1)return;
  1144. g_phone2 = str.Left(pos); str = str.Right(str.GetLength() - pos - 1);
  1145. }
  1146. int i = 0;
  1147. int length[100];
  1148. CFile fp;
  1149. fp.Open(path, CFile::modeRead);
  1150. int fileleng = fp.GetLength();
  1151. int memlength = fileleng - sizeof(int) * 100;
  1152. for ( i = 0; i < 100; i++)
  1153. fp.Read(length + i, sizeof(int));
  1154. for (i = 0; i < 20; i++)
  1155. g_Sel1array[i].SetSize(length[i]);
  1156. for (i = 0; i < 20; i++)
  1157. g_Sel2array[i].SetSize(length[20 + i]);
  1158. for (i = 0; i < 20; i++)
  1159. g_Sel3array[i].SetSize(length[40 + i]);
  1160. for (i = 0; i < 20; i++)
  1161. g_Sel4array[i].SetSize(length[60 + i]);
  1162. for (i = 0; i < 20; i++)
  1163. g_Sel5array[i].SetSize(length[80 + i]);
  1164. BYTE *pData = new BYTE[memlength];
  1165. fp.Read(pData, memlength);
  1166. fp.Close();
  1167. CMemFile memfile;
  1168. memfile.Attach(pData, memlength);
  1169. CArchive ar(&memfile, CArchive::load);
  1170. for (i = 0; i < 20; i++)
  1171. {
  1172. for (int j = 0; j < length[i]; j++)
  1173. g_Sel1array[i].ElementAt(j).Serialize(ar);
  1174. }
  1175. for (i = 0; i < 20; i++)
  1176. {
  1177. for (int j = 0; j < g_Sel2array[i].GetSize(); j++)
  1178. g_Sel2array[i].ElementAt(j).Serialize(ar);
  1179. }
  1180. for (i = 0; i < 20; i++)
  1181. {
  1182. for (int j = 0; j < g_Sel3array[i].GetSize(); j++)
  1183. g_Sel3array[i].ElementAt(j).Serialize(ar);
  1184. }
  1185. for (i = 0; i < 20; i++)
  1186. {
  1187. for (int j = 0; j < g_Sel4array[i].GetSize(); j++)
  1188. g_Sel4array[i].ElementAt(j).Serialize(ar);
  1189. }
  1190. for (i = 0; i < 20; i++)
  1191. {
  1192. for (int j = 0; j < g_Sel5array[i].GetSize(); j++)
  1193. g_Sel5array[i].ElementAt(j).Serialize(ar);
  1194. }
  1195. ar.Close();
  1196. memfile.Detach();
  1197. delete[]pData;
  1198. if (g_Sel5array[19].GetSize())
  1199. {
  1200. g_price1 = g_Sel5array[19].ElementAt(0).ElementAt(0);
  1201. g_price2 = g_Sel5array[19].ElementAt(0).ElementAt(1);
  1202. }
  1203. else
  1204. {
  1205. g_price1 = g_price2 = "";
  1206. }
  1207. OnDropdownCOMBOid();
  1208. m_comboid.SetCurSel(0);
  1209. OnSelchangeCOMBOid();
  1210. m_name1 = g_name1;
  1211. m_name2 = g_name2;
  1212. CStringArray array;
  1213. for (i = 0; i < 19; i++)
  1214. {
  1215. for (int j = 0; j < g_Sel3array[i].GetSize(); j++)
  1216. {
  1217. if (g_Sel3array[i].ElementAt(j).GetSize() < 2)continue;
  1218. int count = g_Sel3array[i].ElementAt(j).GetSize();
  1219. for (int a = 1; a < count; a++)
  1220. {
  1221. if (a == 1)
  1222. {
  1223. CString taoxiname = g_Sel3array[i].ElementAt(j).ElementAt(a);
  1224. m_combotaoxiname.InsertString(0, taoxiname);
  1225. m_combotaoxiname.SetCurSel(0);
  1226. }
  1227. else
  1228. {
  1229. CString str = g_Sel3array[i].ElementAt(j).ElementAt(a);
  1230. CString dir, name;
  1231. int pos = str.ReverseFind('\\');
  1232. dir = str.Left(pos);
  1233. name = str.Right(str.GetLength() - pos - 1);
  1234. array.Add(name);
  1235. }
  1236. }
  1237. }
  1238. }
  1239. for (i = 0; i < 19; i++)
  1240. {
  1241. for (int j = 0; j < g_Sel4array[i].GetSize(); j++)
  1242. {
  1243. int count = g_Sel4array[i].ElementAt(j).GetSize();
  1244. for (int a = 1; a < count; a++)
  1245. {
  1246. array.Add(g_Sel4array[i].ElementAt(j).ElementAt(a));
  1247. }
  1248. }
  1249. }
  1250. for (i = 0; i < array.GetSize(); i++)
  1251. {
  1252. int pos = m_List1.GetItemCount();
  1253. CString str;
  1254. if (pos)
  1255. {
  1256. if (m_List1.GetItemText(pos - 1, 0).IsEmpty() && m_List1.GetItemText(pos - 1, 1).IsEmpty())
  1257. {
  1258. pos--;
  1259. m_List1.SetItemText(pos, 0, "");
  1260. m_List1.SetItemText(pos, 1, array.ElementAt(i));
  1261. m_List1.SetItemText(pos, 2, "");
  1262. m_List1.SetItemText(pos, 3, "1");
  1263. }
  1264. else
  1265. {
  1266. m_List1.InsertItem(pos, "");
  1267. m_List1.SetItemText(pos, 1, array.ElementAt(i));
  1268. m_List1.SetItemText(pos, 2, "");
  1269. m_List1.SetItemText(pos, 3, "1");
  1270. }
  1271. }
  1272. else
  1273. {
  1274. m_List1.InsertItem(pos, "");
  1275. m_List1.SetItemText(pos, 1, array.ElementAt(i));
  1276. m_List1.SetItemText(pos, 2, "");
  1277. m_List1.SetItemText(pos, 3, "1");
  1278. }
  1279. }
  1280. if (g_Sel5array[19].GetSize())
  1281. {
  1282. g_price1 = g_Sel5array[19].ElementAt(0).ElementAt(0);
  1283. g_price2 = g_Sel5array[19].ElementAt(0).ElementAt(1);
  1284. }
  1285. else
  1286. {
  1287. g_price1 = g_price2 = "";
  1288. }
  1289. m_taoxijiage = g_price1;
  1290. m_payed1 = g_price2;
  1291. UpdateData(false);
  1292. m_phone1 = g_phone1;
  1293. m_phone2 = g_phone2;
  1294. OnChangeEDITtaoxijiage();
  1295. }
  1296. void Booking::OnButton1()
  1297. {
  1298. // TODO: Add your control notification handler code here
  1299. /* CTime tm=CTime::GetCurrentTime ();
  1300. CTimeSpan dt(1, 0, 0, 0);
  1301. CTimeSpan dt2(25, 0, 0, 0);
  1302. CTime tm2=tm-dt2;
  1303. while(tm>tm2)
  1304. {
  1305. CString filter;
  1306. filter="id like '";
  1307. filter+=tm2.Format("%Y%m%d");
  1308. filter+="%'";
  1309. tm2+=dt;
  1310. g_sendhead.code[0]=50;
  1311. g_sendhead.tabcount=1;
  1312. g_sendhead.bsql=0;
  1313. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  1314. CArray<CStringArray, CStringArray>sparray;
  1315. DataToArray(&sparray);
  1316. m_List1.DeleteAllItems ();
  1317. m_List3.DeleteAllItems ();
  1318. int listpos[3]={0};int pos;
  1319. CEditListCtrl *pList[3]={&m_List1,&m_List2,&m_List3};
  1320. for(int i=0; i<sparray.GetSize (); i++)
  1321. {
  1322. pos=atoi(sparray.ElementAt (i).ElementAt (4))-1;
  1323. pList[pos]->InsertItem(listpos[pos], sparray.ElementAt (i).ElementAt (1));
  1324. pList[pos]->SetItemText(listpos[pos], 1, GetSPNameFromId(sparray.ElementAt (i).ElementAt (1)));
  1325. if(pos<2)
  1326. pList[pos]->SetItemText(listpos[pos], 2, sparray.ElementAt (i).ElementAt (0));
  1327. else
  1328. {
  1329. pList[pos]->SetItemText(listpos[pos], 2, sparray.ElementAt (i).ElementAt (0));
  1330. pList[pos]->SetItemText(listpos[pos], 3, sparray.ElementAt (i).ElementAt (0));
  1331. }
  1332. listpos[pos]++;
  1333. }
  1334. CArray<CStringArray, CStringArray>savearray;
  1335. savearray.SetSize(m_List1.GetItemCount ());
  1336. CString sql,id,spid,name;
  1337. for( i=0; i<m_List1.GetItemCount (); i++)
  1338. {
  1339. spid=m_List1.GetItemText (i, 0);
  1340. id= m_List1.GetItemText (i, 2) ;
  1341. name=m_List1.GetItemText (i, 1);
  1342. sql="update dindansp set name='"+name+"' where id='"+id+"' and spid='"+spid+"'";
  1343. g_sendhead.bsql=1;
  1344. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  1345. }
  1346. for( i=0; i<m_List3.GetItemCount (); i++)
  1347. {
  1348. spid=m_List3.GetItemText (i, 0);
  1349. id= m_List3.GetItemText (i, 3) ;
  1350. name=m_List3.GetItemText (i, 1);
  1351. sql="update dindansp set name='"+name+"' where id='"+id+"' and spid='"+spid+"'";
  1352. g_sendhead.bsql=1;
  1353. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  1354. }
  1355. }*/
  1356. }
  1357. void Booking::OnBUTprint()
  1358. {
  1359. // TODO: Add your control notification handler code here
  1360. int pos = m_comboid.GetCurSel();
  1361. if (pos == -1)
  1362. {
  1363. return;
  1364. }
  1365. CString id;
  1366. m_comboid.GetLBText(pos, id);
  1367. g_pMainWnd->PrintDinDan(id);
  1368. }
  1369. void Booking::OnBUTstyle()
  1370. {
  1371. // TODO: Add your control notification handler code here
  1372. SetStyle dlg;
  1373. dlg.m_style = m_style;
  1374. if (dlg.DoModal() == IDOK)
  1375. m_style = dlg.m_style;
  1376. }
  1377. void Booking::OnBUTspbox()
  1378. {
  1379. // TODO: Add your control notification handler code here
  1380. SPBox dlg;
  1381. #ifndef CHILD_VERSION
  1382. dlg.m_mode=1;
  1383. #endif
  1384. if (dlg.DoModal() != IDOK)return;
  1385. for (int a = 0; a < dlg.m_spidarray.GetSize(); a++)
  1386. {
  1387. dlg.m_spid = dlg.m_spidarray.ElementAt(a);
  1388. dlg.m_spname = dlg.m_spnamearray.ElementAt(a);
  1389. int pos = m_List3.GetItemCount();
  1390. CString str;
  1391. if (pos)
  1392. {
  1393. if (m_List3.GetItemText(pos - 1, 0).IsEmpty() && m_List3.GetItemText(pos - 1, 1).IsEmpty())
  1394. {
  1395. pos--;
  1396. m_List3.SetItemText(pos, 0, dlg.m_spid);
  1397. m_List3.SetItemText(pos, 1, GetSPNameFromId(dlg.m_spid));
  1398. str.Format("%f", GetSPPriceFromId3(dlg.m_spid));
  1399. ConvertToPrice(str);
  1400. m_List3.SetItemText(pos, 2, str);
  1401. m_List3.SetItemText(pos, 3, "1");
  1402. }
  1403. else
  1404. {
  1405. m_List3.InsertItem(pos, dlg.m_spid);
  1406. m_List3.SetItemText(pos, 1, GetSPNameFromId(dlg.m_spid));
  1407. str.Format("%f", GetSPPriceFromId3(dlg.m_spid));
  1408. ConvertToPrice(str);
  1409. m_List3.SetItemText(pos, 2, str);
  1410. m_List3.SetItemText(pos, 3, "1");
  1411. }
  1412. }
  1413. else
  1414. {
  1415. m_List3.InsertItem(pos, dlg.m_spid);
  1416. m_List3.SetItemText(pos, 1, GetSPNameFromId(dlg.m_spid));
  1417. str.Format("%f", GetSPPriceFromId3(dlg.m_spid));
  1418. ConvertToPrice(str);
  1419. m_List3.SetItemText(pos, 2, str);
  1420. m_List3.SetItemText(pos, 3, "1");
  1421. }
  1422. }
  1423. CalculateCost2();
  1424. }
  1425. void Booking::OnBUTdel()
  1426. {
  1427. // TODO: Add your control notification handler code here
  1428. POSITION pos;
  1429. pos = m_List3.GetFirstSelectedItemPosition();
  1430. if (pos == NULL)
  1431. {
  1432. AfxMessageBox("请先选中您要删除的项目!", MB_ICONINFORMATION);
  1433. return;
  1434. }
  1435. int iItem = m_List3.GetNextSelectedItem(pos);
  1436. m_List3.DeleteItem(iItem);
  1437. CalculateCost2();
  1438. int count = m_List3.GetItemCount();
  1439. if (count == 0)return;
  1440. if (iItem == count)
  1441. iItem = 0;
  1442. m_List3.SetItemState(iItem, LVIS_SELECTED, LVIS_SELECTED);
  1443. }
  1444. void Booking::OnBUTdelall()
  1445. {
  1446. // TODO: Add your control notification handler code here
  1447. m_List3.DeleteAllItems();
  1448. CalculateCost2();
  1449. }
  1450. void Booking::OnBUTspbox2()
  1451. {
  1452. // TODO: Add your control notification handler code here
  1453. SPBox dlg;
  1454. if (dlg.DoModal() != IDOK)return;
  1455. for (int a = 0; a < dlg.m_spidarray.GetSize(); a++)
  1456. {
  1457. dlg.m_spid = dlg.m_spidarray.ElementAt(a);
  1458. dlg.m_spname = dlg.m_spnamearray.ElementAt(a);
  1459. int pos = m_List1.GetItemCount();
  1460. CString str;
  1461. if (pos)
  1462. {
  1463. if (m_List1.GetItemText(pos - 1, 0).IsEmpty() && m_List1.GetItemText(pos - 1, 1).IsEmpty())
  1464. {
  1465. pos--;
  1466. m_List1.SetItemText(pos, 0, dlg.m_spid);
  1467. m_List1.SetItemText(pos, 1, GetSPNameFromId(dlg.m_spid));
  1468. str.Format("%f", GetSPPriceFromId3(dlg.m_spid));
  1469. ConvertToPrice(str);
  1470. m_List1.SetItemText(pos, 2, str);
  1471. m_List1.SetItemText(pos, 3, "1");
  1472. }
  1473. else
  1474. {
  1475. m_List1.InsertItem(pos, dlg.m_spid);
  1476. m_List1.SetItemText(pos, 1, GetSPNameFromId(dlg.m_spid));
  1477. str.Format("%f", GetSPPriceFromId3(dlg.m_spid));
  1478. ConvertToPrice(str);
  1479. m_List1.SetItemText(pos, 2, str);
  1480. m_List1.SetItemText(pos, 3, "1");
  1481. }
  1482. }
  1483. else
  1484. {
  1485. m_List1.InsertItem(pos, dlg.m_spid);
  1486. m_List1.SetItemText(pos, 1, GetSPNameFromId(dlg.m_spid));
  1487. str.Format("%f", GetSPPriceFromId3(dlg.m_spid));
  1488. ConvertToPrice(str);
  1489. m_List1.SetItemText(pos, 2, str);
  1490. m_List1.SetItemText(pos, 3, "1");
  1491. }
  1492. }
  1493. CalculateCost();
  1494. }
  1495. void Booking::OnBUTdel3()
  1496. {
  1497. // TODO: Add your control notification handler code here
  1498. POSITION pos;
  1499. pos = m_List1.GetFirstSelectedItemPosition();
  1500. if (pos == NULL)
  1501. {
  1502. AfxMessageBox("请先选中您要删除的项目!", MB_ICONINFORMATION);
  1503. return;
  1504. }
  1505. if (AfxMessageBox("确定要删除套系中的商品吗?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  1506. int iItem = m_List1.GetNextSelectedItem(pos);
  1507. m_List1.DeleteItem(iItem);
  1508. CalculateCost();
  1509. int count = m_List1.GetItemCount();
  1510. if (count == 0)return;
  1511. if (iItem == count)
  1512. iItem = 0;
  1513. m_List1.SetItemState(iItem, LVIS_SELECTED, LVIS_SELECTED);
  1514. }
  1515. void Booking::OnBUTdelall2()
  1516. {
  1517. // TODO: Add your control notification handler code here
  1518. if (AfxMessageBox("确定要删除套系中的商品吗?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  1519. m_List1.DeleteAllItems();
  1520. CalculateCost();
  1521. }
  1522. void Booking::CalculateCost()
  1523. {
  1524. m_cost1 = 0;
  1525. CString str;
  1526. int i = 0;
  1527. for ( i = 0; i < m_List1.GetItemCount(); i++)
  1528. {
  1529. m_cost1 += GetSPPriceFromId(m_List1.GetItemText(i, 0))*atof(m_List1.GetItemText(i, 3));
  1530. }
  1531. float cost2 = 0;
  1532. for (i = 0; i < m_List1.GetItemCount(); i++)
  1533. {
  1534. cost2 += GetSPPriceFromId3(m_List1.GetItemText(i, 0))*atof(m_List1.GetItemText(i, 3));
  1535. }
  1536. str.Format("套系包含商品,成本:%0.1f,售价:%0.1f", m_cost1, cost2);
  1537. str.Format("套系包含商品,总价:%0.1f", cost2);
  1538. ::ConvertToPrice(str);
  1539. SetDlgItemText(IDC_STATIC2, str);
  1540. }
  1541. void Booking::CalculateCost2()
  1542. {
  1543. m_cost2 = 0;
  1544. CString str;
  1545. int i = 0;
  1546. for ( i = 0; i < m_List3.GetItemCount(); i++)
  1547. {
  1548. m_cost2 += GetSPPriceFromId(m_List3.GetItemText(i, 0))*atof(m_List3.GetItemText(i, 3));
  1549. }
  1550. float cost2 = 0;
  1551. for (i = 0; i < m_List3.GetItemCount(); i++)
  1552. {
  1553. cost2 += GetSPPriceFromId3(m_List3.GetItemText(i, 0))*atof(m_List3.GetItemText(i, 3));
  1554. }
  1555. #ifndef CHILD_VERSION
  1556. str.Format ("婚庆服务,成本:%0.1f,售价:%0.1f", m_cost2,cost2);
  1557. #else
  1558. str.Format("增加产品,成本:%0.1f,售价:%0.1f", m_cost2, cost2);
  1559. #endif
  1560. #ifndef CHILD_VERSION
  1561. str.Format ("婚庆服务,总价:%0.1f",cost2);
  1562. #else
  1563. str.Format("增加产品,总价:%0.1f", cost2);
  1564. #endif
  1565. ::ConvertToPrice(str);
  1566. SetDlgItemText(IDC_STATIC4, str);
  1567. }
  1568. void Booking::SaveCard2Data()
  1569. {
  1570. if (m_type == 1)
  1571. {
  1572. CString m_point;
  1573. m_point.Format("%d", atol(m_money1) / 100);
  1574. m_point.Format("%d", atol(m_point) * 100);
  1575. CString m_card2no = m_memberno2;
  1576. CString date2 = m_memberno2date;
  1577. CString m_name = m_membernoname;
  1578. CString m_sex = m_membernosex;
  1579. CString m_phone = m_membernophone;
  1580. CString sql;
  1581. sql = "delete from membercard2 where [card2no]='" + m_card2no + "'";
  1582. 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 + "')";
  1583. sql += "@@@";
  1584. m_point.Format("%d", atol(m_point) / 100);
  1585. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(51))) // msgcheck5
  1586. {
  1587. CString m_content5 = g_cominfoarray.ElementAt(0).ElementAt(52);
  1588. CString content, timestamp;
  1589. CString name;
  1590. if (!m_name1.IsEmpty())
  1591. name = m_name1 + ",";
  1592. name += m_name2;
  1593. name.TrimRight(",");
  1594. CString name2 = m_name;
  1595. #ifndef CHILD_VERSION
  1596. if(m_sex=="男")
  1597. name2+="先生";
  1598. else if(m_sex=="女")
  1599. name2+="女士";
  1600. #endif
  1601. content.Format("%s您好,您的朋友%s为您积分%s分.", name2, name, m_point);
  1602. content += m_content5;
  1603. timestamp = CTime::GetCurrentTime().Format("%Y%m%d%H%M%S");
  1604. if (CheckPhoneType(m_phone) != -1 && CheckBadWords(content, 0))
  1605. {
  1606. int count = GetLengthEx(content) / MSG_LENGTH;
  1607. if (GetLengthEx(content) % MSG_LENGTH)
  1608. count++;
  1609. CString scount;
  1610. scount.Format("%d", count);
  1611. #if JEFF_TEST_ON
  1612. CString sql2 = _T("");
  1613. sql2.Format(INSERT_SENDREG, _T("5"), m_phone, content, timestamp, scount, _T("0"), _T("0"), _T("0"), _T("系统自动发送"));
  1614. sql += sql2;
  1615. #else
  1616. CString sql2 = "insert into [sendreg]([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('" + m_phone + "','" + content + "','" + timestamp + "','" + scount + "','0','0','0','系统自动发送')";
  1617. sql += sql2;
  1618. #endif
  1619. sql += "@@@";
  1620. }
  1621. }
  1622. sql += m_memberno;
  1623. g_sendhead.bsql = 1;
  1624. g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
  1625. }
  1626. else if (m_type == 3)
  1627. {
  1628. CString m_rate;
  1629. CString filter = "[memberno]='" + m_memberno + "'";
  1630. g_sendhead.bsql = 0;
  1631. g_sendhead.code[0] = 132;
  1632. g_sendhead.tabcount = 1;
  1633. g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
  1634. DataToArray(&g_List1array);
  1635. if (g_List1array.GetSize() % 5 == 0)
  1636. m_rate = "5%";
  1637. else if (g_List1array.GetSize() % 5 == 1)
  1638. m_rate = "10%";
  1639. else if (g_List1array.GetSize() % 5 == 2)
  1640. m_rate = "15%";
  1641. else if (g_List1array.GetSize() % 5 == 3)
  1642. m_rate = "20%";
  1643. else if (g_List1array.GetSize() % 5 == 4)
  1644. m_rate = "50%";
  1645. float frate = atof(m_rate) / 100.0;
  1646. CString m_point;
  1647. m_point.Format("%d", (int)(min(atof(m_money1), atof(m_membernojiage))*frate));
  1648. CString m_card2no = m_memberno2;
  1649. CString date2 = m_memberno2date;
  1650. CString m_name = m_membernoname;
  1651. CString m_sex = m_membernosex;
  1652. CString m_phone = m_membernophone;
  1653. CString sql;
  1654. sql = "delete from [membercard2blue] where [card2no]='" + m_card2no + "'";
  1655. 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 + "')";
  1656. sql += "~~~";
  1657. if (atoi(g_cominfoarray.ElementAt(0).ElementAt(51)))
  1658. {
  1659. CString m_content5 = g_cominfoarray.ElementAt(0).ElementAt(52);
  1660. CString content, timestamp;
  1661. CString name;
  1662. if (!m_name1.IsEmpty())
  1663. name = m_name1 + ",";
  1664. name += m_name2;
  1665. name.TrimRight(",");
  1666. CString name2 = m_name;
  1667. #ifndef CHILD_VERSION
  1668. if(m_sex=="男")
  1669. name2+="先生";
  1670. else if(m_sex=="女")
  1671. name2+="女士";
  1672. #endif
  1673. content.Format("%s您好,您的朋友%s为您返现金%s元.", name2, name, m_point);
  1674. content += m_content5;
  1675. timestamp = CTime::GetCurrentTime().Format("%Y%m%d%H%M%S");
  1676. if (CheckPhoneType(m_phone) != -1 && CheckBadWords(content, 0))
  1677. {
  1678. int count = GetLengthEx(content) / MSG_LENGTH;
  1679. if (GetLengthEx(content) % MSG_LENGTH)
  1680. count++;
  1681. CString scount;
  1682. scount.Format("%d", count);
  1683. #if JEFF_TEST_ON
  1684. CString sql2 = _T("");
  1685. sql2.Format(INSERT_SENDREG, _T("5"), m_phone, content, timestamp, scount, _T("0"), _T("0"), _T("0"), _T("系统自动发送"));
  1686. sql += sql2;
  1687. #else
  1688. CString sql2 = "insert into [sendreg]([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('" + m_phone + "','" + content + "','" + timestamp + "','" + scount + "','0','0','0','系统自动发送')";
  1689. sql += sql2;
  1690. #endif
  1691. sql += "~~~";
  1692. }
  1693. }
  1694. sql += m_memberno;
  1695. g_sendhead.bsql = 1;
  1696. g_pMainWnd->ProcessChatMessageRequest2(sql); if (g_bSendOK == 0)return;
  1697. }
  1698. }
  1699. void Booking::OnBUTaddjd()
  1700. {
  1701. // TODO: Add your control notification handler code here
  1702. SPLBDlg dlg;
  1703. dlg.m_mode = 2;
  1704. if (dlg.DoModal() == IDOK)
  1705. {
  1706. for (int i = 0; i < dlg.m_array.GetSize(); i++)
  1707. m_listbox1.AddString(dlg.m_array.ElementAt(i));
  1708. }
  1709. }
  1710. void Booking::OnBUTdeljd()
  1711. {
  1712. // TODO: Add your control notification handler code here
  1713. int pos = m_listbox1.GetCurSel();
  1714. if (pos == -1)
  1715. {
  1716. AfxMessageBox("请选中您要删除的景点!", MB_ICONINFORMATION); return;
  1717. }
  1718. m_listbox1.DeleteString(pos);
  1719. int count = m_listbox1.GetCount();
  1720. if (pos < count)
  1721. m_listbox1.SetCurSel(pos);
  1722. else if (count && pos == count)
  1723. m_listbox1.SetCurSel(0);
  1724. }
  1725. void Booking::OnBUTinfo1() // 客人资料按钮;
  1726. {
  1727. // TODO: Add your control notification handler code here
  1728. CRect rc;
  1729. GetDlgItem(IDC_STATIC5)->GetWindowRect(rc);
  1730. ScreenToClient(rc);
  1731. m_page1.Create(IDD_DLGBookingPage1, this);
  1732. m_page1.MoveWindow(rc);
  1733. m_page1.ShowWindow(SW_SHOW);
  1734. }
  1735. void Booking::OnBUTinfo2()
  1736. {
  1737. // TODO: Add your control notification handler code here
  1738. }
  1739. void Booking::OnBUTinfo3()
  1740. {
  1741. // TODO: Add your control notification handler code here
  1742. }