Booking.cpp 49 KB

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