12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478 |
- // Booking.cpp : implementation file
- //
- #include "stdafx.h"
- #include "LYFZIPManage.h"
- #include "Booking.h"
- #include "MyMdi.H"
- #include "ClientDlg.h"
- #include "SetStyle.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // Booking pinyin1 IDC_EDITtime2
- IMPLEMENT_DYNCREATE(Booking, CFormView)
- Booking::Booking()
- : CFormView(Booking::IDD)
- {
- //{{AFX_DATA_INIT(Booking)
- m_taoxijiage = _T("");
- m_zs = _T("");
- m_discount = _T("");
- m_money1 = _T("");
- m_money2 = _T("");
- m_money3 = _T("");
- m_name1 = _T("");
- m_name2 = _T("");
- m_payed1 = _T("");
- m_payed2 = _T("");
- m_payed3 = _T("");
- m_payed4 = _T("");
- m_payed5 = _T("");
- m_time1 = CTime::GetCurrentTime ().Format ("%Y-%m-%d");
- m_time2 = _T("");
- m_time3 = _T("");
- m_bz = _T("");
- m_clothescount = _T("");
- m_clothescount2 = _T("");
- m_outside = _T("");
- m_outside2 = _T("");
- m_style = _T("");
- m_choosephotomoney = _T("");
- m_takephotomoney = _T("");
- m_waiter6 = g_user.name ;
- m_nFocusPos=0;
- //}}AFX_DATA_INIT
- }
- Booking::~Booking()
- {
- }
- void Booking::DoDataExchange(CDataExchange* pDX)
- {
- CFormView::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(Booking)
- DDX_Control(pDX, IDC_EDITtaoxijiage, m_numedit3);
- DDX_Control(pDX, IDC_EDITtime3, m_datectrl2);
- DDX_Control(pDX, IDC_EDITtime2, m_datectrl1);
- DDX_Control(pDX, IDC_EDITpayed1, m_edit2);
- DDX_Control(pDX, IDC_EDITdiscount, m_edit1);
- DDX_Control(pDX, IDC_COMBObm, m_combobm);
- DDX_Control(pDX, IDC_COMBOrenyuan, m_comborenyuan);
- DDX_Control(pDX, IDC_COMBOid, m_comboid);
- DDX_Control(pDX, IDC_LIST3, m_List3);
- DDX_Control(pDX, IDC_LIST2, m_List2);
- DDX_Control(pDX, IDC_LIST1, m_List1);
- DDX_Control(pDX, IDC_STATIC1, m_static1);
- DDX_Control(pDX, IDC_COMBOtaoxiname, m_combotaoxiname);
- DDX_Text(pDX, IDC_EDITtaoxijiage, m_taoxijiage);
- DDX_Text(pDX, IDC_EDITzs, m_zs);
- DDX_Text(pDX, IDC_EDITdiscount, m_discount);
- DDX_Text(pDX, IDC_EDITmoney1, m_money1);
- DDX_Text(pDX, IDC_EDITmoney2, m_money2);
- DDX_Text(pDX, IDC_EDITmoney3, m_money3);
- DDX_Text(pDX, IDC_EDITname1, m_name1);
- DDX_Text(pDX, IDC_EDITname2, m_name2);
- DDX_Text(pDX, IDC_EDITpayed1, m_payed1);
- DDX_Text(pDX, IDC_EDITpayed2, m_payed2);
- DDX_Text(pDX, IDC_EDITpayed3, m_payed3);
- DDX_Text(pDX, IDC_EDITpayed4, m_payed4);
- DDX_Text(pDX, IDC_EDITpayed5, m_payed5);
- DDX_Text(pDX, IDC_EDITtime1, m_time1);
- DDX_Text(pDX, IDC_EDITtime2, m_time2);
- DDX_Text(pDX, IDC_EDITtime3, m_time3);
- DDX_Text(pDX, IDC_EDITbz, m_bz);
- DDX_Text(pDX, IDC_EDITOclothescount, m_clothescount);
- DDX_Text(pDX, IDC_EDITOclothescount2, m_clothescount2);
- DDX_Text(pDX, IDC_EDITOoutside, m_outside);
- DDX_Text(pDX, IDC_EDITOoutside2, m_outside2);
- DDX_Text(pDX, IDC_EDITwaiter6, m_waiter6);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(Booking, CFormView)
- //{{AFX_MSG_MAP(Booking)
- ON_BN_CLICKED(IDC_BUTsave, OnBUTsave)
- ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
- ON_CBN_SELCHANGE(IDC_COMBOtaoxiname, OnSelchangeCOMBOtaoxiname)
- ON_BN_CLICKED(IDC_BUTspbox, OnBUTspbox)
- ON_WM_TIMER()
- ON_EN_CHANGE(IDC_EDITtaoxijiage, OnChangeEDITtaoxijiage)
- ON_EN_CHANGE(IDC_EDITdiscount, OnChangeEDITdiscount)
- ON_EN_CHANGE(IDC_EDITpayed1, OnChangeEDITpayed1)
- ON_CBN_DROPDOWN(IDC_COMBObm, OnDropdownCOMBObm)
- ON_CBN_DROPDOWN(IDC_COMBOrenyuan, OnDropdownCOMBOrenyuan)
- ON_CBN_SELCHANGE(IDC_COMBObm, OnSelchangeCOMBObm)
- ON_CBN_DROPDOWN(IDC_COMBOid, OnDropdownCOMBOid)
- ON_CBN_SELCHANGE(IDC_COMBOid, OnSelchangeCOMBOid)
- ON_BN_CLICKED(IDC_BUTclient, OnBUTclient)
- ON_BN_CLICKED(IDC_BUTWaiter, OnBUTWaiter)
- ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
- ON_BN_CLICKED(IDC_BUTprint, OnBUTprint)
- ON_BN_CLICKED(IDC_BUTstyle, OnBUTstyle)
- ON_BN_CLICKED(IDC_BUTdel, OnBUTdel)
- ON_BN_CLICKED(IDC_BUTdelall, OnBUTdelall)
- ON_BN_CLICKED(IDC_BUTspbox2, OnBUTspbox2)
- ON_BN_CLICKED(IDC_BUTdel3, OnBUTdel3)
- ON_BN_CLICKED(IDC_BUTdelall2, OnBUTdelall2)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // Booking diagnostics
- #ifdef _DEBUG
- void Booking::AssertValid() const
- {
- CFormView::AssertValid();
- }
- void Booking::Dump(CDumpContext& dc) const
- {
- CFormView::Dump(dc);
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // Booking message handlers
- void Booking::OnInitialUpdate()
- {
- CFormView::OnInitialUpdate();
- // TODO: Add your specialized code here and/or call the base class
- CMyMdi Mdi;
- Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
-
- // Here we create the outbar control using the splitter as its parent
- // and setting its id to the first pane.
- CRect rc2;
- GetWindowRect(rc2);
- ::MoveWindow(m_hWnd,g_rc.left,g_rc.top,g_rc.Width(),g_rc.Height(),TRUE);
- EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc,0);
- m_combotaoxiname.GetWindowRect (rc2);
- ScreenToClient(rc2);
- rc2.bottom +=200;
- m_combotaoxiname.MoveWindow (rc2);
- m_combobm.GetWindowRect (rc2);
- ScreenToClient(rc2);
- rc2.bottom +=200;
- m_combobm.MoveWindow (rc2);
- m_comborenyuan.GetWindowRect (rc2);
- ScreenToClient(rc2);
- rc2.bottom +=200;
- m_comborenyuan.MoveWindow (rc2);
- m_comboid.GetWindowRect (rc2);
- ScreenToClient(rc2);
- rc2.bottom +=200;
- m_comboid.MoveWindow (rc2);
- m_static1.SetFont (&g_titlefont);
- g_sendhead.bsql=0;
- g_sendhead.code[0]=6;
- g_sendhead.code[1]=7;
- g_sendhead.code[2]=10;
- g_sendhead.code[3]=4;
- g_sendhead.tabcount=4;
- g_pMainWnd->ProcessChatMessageRequest2(6);if(g_bSendOK==0)return;
- DataToArray(&m_List1array, &m_List2array, &m_List3array, &m_sparray);
- for(int i=0; i<m_List1array.GetSize (); i++)
- m_combotaoxiname.AddString (m_List1array.ElementAt (i).ElementAt (1));
- #ifdef MODERN_VERSION
- m_List1.InitStyle();
- m_List1.InsertColumn(0,_T("编号"),LVCFMT_LEFT,55);
- m_List1.InsertColumn(1,_T("商品名称"),LVCFMT_LEFT,170);
- m_List1.InsertColumn(2,_T("数量"),LVCFMT_LEFT,55);
- m_List2.InitStyle();
- m_List2.InsertColumn(0,_T("编号"),LVCFMT_LEFT,55);
- m_List2.InsertColumn(1,_T("商品名称"),LVCFMT_LEFT,150);
- m_List2.InsertColumn(2,_T("数量"),LVCFMT_LEFT,55);
- m_List3.InitStyle();
- m_List3.InsertColumn(0,_T("编号"),LVCFMT_LEFT,45);
- m_List3.InsertColumn(1,_T("商品名称"),LVCFMT_LEFT,142);
- m_List3.InsertColumn(2,_T("价格"),LVCFMT_LEFT,45);
- m_List3.InsertColumn(3,_T("数量"),LVCFMT_LEFT,45);
- #else
- m_List1.InitStyle();
- m_List1.InsertColumn(0,_T("编号"),LVCFMT_LEFT,55);
- m_List1.InsertColumn(1,_T("商品名称"),LVCFMT_LEFT,280);
- m_List1.InsertColumn(2,_T("数量"),LVCFMT_LEFT,55);
- m_List2.InitStyle();
- m_List2.InsertColumn(0,_T("编号"),LVCFMT_LEFT,55);
- m_List2.InsertColumn(1,_T("商品名称"),LVCFMT_LEFT,280);
- m_List2.InsertColumn(2,_T("数量"),LVCFMT_LEFT,55);
- m_List3.InitStyle();
- m_List3.InsertColumn(0,_T("编号"),LVCFMT_LEFT,45);
- m_List3.InsertColumn(1,_T("商品名称"),LVCFMT_LEFT,235);
- m_List3.InsertColumn(2,_T("价格"),LVCFMT_LEFT,60);
- m_List3.InsertColumn(3,_T("数量"),LVCFMT_LEFT,45);
- #endif
- }
- void Booking::OnSelchangeCOMBOtaoxiname()
- {
- // TODO: Add your control notification handler code here
- UpdateData();
- int pos=m_combotaoxiname.GetCurSel ();
- if(pos==-1)return;
- CString taoxiname;
- m_combotaoxiname.GetLBText (pos, taoxiname);
- pos=-1;
- for(int i=0; i<m_List1array.GetSize (); i++)
- {
- if(taoxiname==m_List1array.ElementAt (i).ElementAt (1))
- {
- pos=i;
- break;
- }
- }
- if(pos==-1)
- {
- m_taoxiid = "";
- m_taoxijiage = "";
- m_zs = "";
- UpdateData(false);
- OnChangeEDITtaoxijiage();
- m_List1.DeleteAllItems ();
- m_List2.DeleteAllItems ();
- return;
- }
- m_taoxiid = m_List1array.ElementAt (pos).ElementAt (0);
- m_taoxijiage = m_List1array.ElementAt (pos).ElementAt (2);
- m_zs = m_List1array.ElementAt (pos).ElementAt (3);
- UpdateData(false);
- OnChangeEDITtaoxijiage();
- FillGrid();
- }
- void Booking::FillGrid()
- {
- m_List1.DeleteAllItems ();
- int pos=0;
- for(int i=0; i<m_List2array.GetSize (); i++)
- {
- if(m_List2array.ElementAt (i).ElementAt (0)!=m_taoxiid)continue;
- m_List1.InsertItem(pos, m_List2array.ElementAt (i).ElementAt (1));
- m_List1.SetItemText(pos,1, GetSPNameFromId(m_List2array.ElementAt (i).ElementAt (1)));
- m_List1.SetItemText(pos,2, m_List2array.ElementAt (i).ElementAt (2));
- pos++;
- }
- #ifndef MODERN_VERSION
- for( i=0; i<m_List3array.GetSize (); i++)
- {
- if(m_List3array.ElementAt (i).ElementAt (0)!=m_taoxiid)continue;
- m_List1.InsertItem(pos, m_List3array.ElementAt (i).ElementAt (1));
- m_List1.SetItemText(pos,1, GetSPNameFromId(m_List3array.ElementAt (i).ElementAt (1)));
- m_List1.SetItemText(pos,2, m_List3array.ElementAt (i).ElementAt (2));
- pos++;
- }
- #else
- m_List2.DeleteAllItems ();
- pos=0;
- for( i=0; i<m_List3array.GetSize (); i++)
- {
- if(m_List3array.ElementAt (i).ElementAt (0)!=m_taoxiid)continue;
- m_List2.InsertItem(pos, m_List3array.ElementAt (i).ElementAt (1));
- m_List2.SetItemText(pos,1, GetSPNameFromId(m_List3array.ElementAt (i).ElementAt (1)));
- m_List2.SetItemText(pos,2, m_List3array.ElementAt (i).ElementAt (2));
- pos++;
- }
- #endif
- }
- float Booking::GetSPPriceFromId(CString id)
- {
- for(int i=0; i<m_sparray.GetSize (); i++)
- {
- if(id==m_sparray.ElementAt (i).ElementAt (0))
- return atof(m_sparray.ElementAt (i).ElementAt (4));
- }
- return 0;
- }
- CString Booking::GetSPNameFromId(CString id)
- {
- for(int i=0; i<m_sparray.GetSize (); i++)
- {
- if(id==m_sparray.ElementAt (i).ElementAt (0))
- return m_sparray.ElementAt (i).ElementAt (1);
- }
- id.TrimLeft ("0");
- for( i=0; i<m_sparray.GetSize (); i++)
- {
- if(id==m_sparray.ElementAt (i).ElementAt (0))
- return m_sparray.ElementAt (i).ElementAt (1);
- }
- return "";
- }
- BOOL Booking::PreTranslateMessage(MSG* pMsg)
- {
- // TODO: Add your specialized code here and/or call the base class
- if(pMsg->message==WM_KEYDOWN)
- {
- switch( pMsg->wParam )
- {
- case 0x43: // copy
- if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
- {
- GetFocus()->SendMessage(WM_COPY);
- return TRUE;
- }
- break;
- case 0x56: //Ctrl + V:
- if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
- {
- GetFocus()->SendMessage(WM_PASTE);
- return TRUE;
- }
- break;
- case 0x58: // cut
- if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
- {
- GetFocus()->SendMessage(WM_CUT);
- return TRUE;
- }
- break;
- case 0x5A: //undo
- case 0x59: //redo
- if ( ( GetKeyState( VK_CONTROL ) & 0x80 ) )
- {
- GetFocus()->SendMessage(WM_UNDO);
- return TRUE;
- }
- break;
- }
- }
- else if(pMsg->message==WM_LBUTTONDBLCLK)
- {
- {//list1
- CPoint pt;
- CRect rc,rc2;
- ::GetCursorPos (&pt);
- m_List1.GetWindowRect (rc2);
- if(rc2.PtInRect (pt)==0)
- #ifdef MODERN_VERSION
- goto ll;
- #else
- goto mm;
- #endif
- pt.x-=rc2.left ;
- pt.y-=rc2.top ;
- int iItem=m_List1.GetItemCount ()-1;
- if(iItem<0)
- {
- m_List1.GetHeaderCtrl()->GetItemRect (0, rc);
- int hei=rc.Height ();
- rc.top +=hei;
- rc.bottom +=hei;
- if(rc.PtInRect (pt))
- {
- m_List1.InsertItem(m_List1.GetItemCount (), "");
- }
- m_List1.GetHeaderCtrl()->GetItemRect (1, rc);
- rc.top +=hei;
- rc.bottom +=hei;
- if(rc.PtInRect (pt))
- {
- m_List1.InsertItem(m_List1.GetItemCount (), "");
- }
- }
- else
- {
- m_List1.GetSubItemRect( iItem, 0, LVIR_BOUNDS, rc);
- int hei=rc.Height ();
- rc.top +=hei;
- rc.bottom +=hei;
- if(rc.PtInRect (pt))
- {
- if(m_List1.GetItemText (iItem, 0).IsEmpty ()&&m_List1.GetItemText (iItem, 1).IsEmpty ())
- #ifdef MODERN_VERSION
- goto ll;
- #else
- goto mm;
- #endif
- m_List1.InsertItem(m_List1.GetItemCount (), "");
- }
- }
- }
- #ifdef MODERN_VERSION
- goto ll;
- #else
- goto mm;
- #endif
- ll: {//list2
- CPoint pt;
- CRect rc,rc2;
- ::GetCursorPos (&pt);
- m_List2.GetWindowRect (rc2);
- if(rc2.PtInRect (pt)==0)
- goto ll;
- pt.x-=rc2.left ;
- pt.y-=rc2.top ;
- int iItem=m_List2.GetItemCount ()-1;
- if(iItem<0)
- {
- m_List2.GetHeaderCtrl()->GetItemRect (0, rc);
- int hei=rc.Height ();
- rc.top +=hei;
- rc.bottom +=hei;
- if(rc.PtInRect (pt))
- {
- m_List2.InsertItem(m_List2.GetItemCount (), "");
- }
- m_List2.GetHeaderCtrl()->GetItemRect (1, rc);
- rc.top +=hei;
- rc.bottom +=hei;
- if(rc.PtInRect (pt))
- {
- m_List2.InsertItem(m_List2.GetItemCount (), "");
- }
- }
- else
- {
- m_List2.GetSubItemRect( iItem, 0, LVIR_BOUNDS, rc);
- int hei=rc.Height ();
- rc.top +=hei;
- rc.bottom +=hei;
- if(rc.PtInRect (pt))
- {
- if(m_List2.GetItemText (iItem, 0).IsEmpty ()&&m_List2.GetItemText (iItem, 1).IsEmpty ())
- goto mm;
- m_List2.InsertItem(m_List2.GetItemCount (), "");
- }
- }
- }
- mm: {//list3
- CPoint pt;
- CRect rc,rc2;
- ::GetCursorPos (&pt);
- m_List3.GetWindowRect (rc2);
- if(rc2.PtInRect (pt)==0) return CFormView::PreTranslateMessage(pMsg);
- pt.x-=rc2.left ;
- pt.y-=rc2.top ;
- int iItem=m_List3.GetItemCount ()-1;
- if(iItem<0)
- {
- m_List3.GetHeaderCtrl()->GetItemRect (0, rc);
- int hei=rc.Height ();
- rc.top +=hei;
- rc.bottom +=hei;
- if(rc.PtInRect (pt))
- {
- m_List3.InsertItem(m_List3.GetItemCount (), "");
- }
-
- m_List3.GetHeaderCtrl()->GetItemRect (1, rc);
- rc.top +=hei;
- rc.bottom +=hei;
- if(rc.PtInRect (pt))
- {
- m_List3.InsertItem(m_List3.GetItemCount (), "");
- }
- }
- else
- {
- m_List3.GetSubItemRect( iItem, 0, LVIR_BOUNDS, rc);
- int hei=rc.Height ();
- rc.top +=hei;
- rc.bottom +=hei;
- if(rc.PtInRect (pt))
- {
- if(m_List3.GetItemText (iItem, 0).IsEmpty ()&&m_List3.GetItemText (iItem, 1).IsEmpty ())
- return CFormView::PreTranslateMessage(pMsg);
- m_List3.InsertItem(m_List3.GetItemCount (), "");
- }
- }
- }
-
- }
-
- if(pMsg->message==WM_LBUTTONDOWN)
- {
- {//list1
- CPoint pt;
- CRect rc,rc2;
- ::GetCursorPos (&pt);
- m_List1.GetWindowRect (rc2);
- if(rc2.PtInRect (pt)==0)
- #ifdef MODERN_VERSION
- goto nn;
- #else
- goto oo;
- #endif
- m_nFocusPos=0;
- SetTimer(1, 300, NULL);
- #ifdef MODERN_VERSION
- goto nn;
- #else
- goto oo;
- #endif
- }
- nn: {//list2
- CPoint pt;
- CRect rc,rc2;
- ::GetCursorPos (&pt);
- m_List2.GetWindowRect (rc2);
- if(rc2.PtInRect (pt)==0) goto oo;
- m_nFocusPos=1;
- SetTimer(2, 300, NULL);
- }
- oo: {//list3
- CPoint pt;
- CRect rc,rc2;
- ::GetCursorPos (&pt);
- m_List3.GetWindowRect (rc2);
- if(rc2.PtInRect (pt)==0) return CFormView::PreTranslateMessage(pMsg);
- SetTimer(3, 300, NULL);
- }
-
-
- }
-
- return CFormView::PreTranslateMessage(pMsg);
- }
- void Booking::SetSPName1()
- {
- for(int i=0; i<m_List1.GetItemCount (); i++)
- {
- if(GetSPNameFromId(m_List1.GetItemText (i, 0))!="")
- m_List1.SetItemText(i,1, GetSPNameFromId(m_List1.GetItemText (i, 0)));
- }
- }
- void Booking::SetSPName2()
- {
- for(int i=0; i<m_List2.GetItemCount (); i++)
- {
- if(GetSPNameFromId(m_List2.GetItemText (i, 0))!="")
- m_List2.SetItemText(i,1, GetSPNameFromId(m_List2.GetItemText (i, 0)));
- }
- }
- void Booking::SetSPName3()
- {
- CString str;
- for(int i=0; i<m_List3.GetItemCount (); i++)
- {
- if(GetSPNameFromId(m_List3.GetItemText (i, 0))!="")
- m_List3.SetItemText(i,1, GetSPNameFromId(m_List3.GetItemText (i, 0)));
- str.Format ("%f", GetSPPriceFromId(m_List3.GetItemText (i, 0)));
- ConvertToPrice (str);
- m_List3.SetItemText(i,2, str);
- }
- }
- void Booking::OnTimer(UINT nIDEvent)
- {
- // TODO: Add your message handler code here and/or call default
- if(nIDEvent==1)
- {
- KillTimer(nIDEvent);
- SetSPName1();
- }
- else if(nIDEvent==2)
- {
- KillTimer(nIDEvent);
- SetSPName2();
- }
- else if(nIDEvent==3)
- {
- KillTimer(nIDEvent);
- SetSPName3();
- }
- }
- void Booking::OnBUTsave()
- {
- if(IsHasRights2(0)==0)
- return;
- // TODO: Add your control notification handler code here
- UpdateData();
- int pos=m_comboid.GetCurSel ();
- if(pos==-1)
- {
- AfxMessageBox("资料不全,打*号的项目必须填写!", MB_ICONINFORMATION);
- return;
- }
- CString id;
- m_comboid.GetLBText (pos, id);
- BOOL bAdd=1;
- if(pos)bAdd=0;
- if(m_name1.IsEmpty () && m_name2.IsEmpty ())
- {
- AfxMessageBox("资料不全,打*号的项目必须填写!", MB_ICONINFORMATION);
- return;
- }
- CString taoxiname;
- pos=m_combotaoxiname.GetCurSel ();
- if(pos!=-1)
- {
- m_combotaoxiname.GetLBText (pos, taoxiname);
- }
- else
- {
- m_combotaoxiname.GetWindowText (taoxiname);
- // AfxMessageBox(taoxiname);
- m_taoxiid.Empty ();
- }
- m_taoxijiage.TrimLeft ();
- m_taoxijiage.TrimRight ();
- m_payed1.TrimLeft ();
- m_payed1.TrimRight ();
- if(taoxiname.IsEmpty () || m_taoxijiage.IsEmpty ()|| m_payed1.IsEmpty ())
- {
- AfxMessageBox("资料不全,打*号的项目必须填写!", MB_ICONINFORMATION);
- return;
- }
- CString bm;
- pos=m_combobm.GetCurSel ();
- if(pos!=-1)
- {
- m_combobm.GetLBText (pos, bm);
- }
-
- CString ren;
- pos=m_comborenyuan.GetCurSel ();
- if(pos!=-1)
- {
- m_comborenyuan.GetLBText (pos, ren);
- }
- else
- {
- AfxMessageBox("资料不全,打*号的项目必须填写!", MB_ICONINFORMATION);
- return;
- }
- if(!CheckDateOK(m_time2))return;
- if(!CheckDateOK(m_time3))return;
- float list3money=0;
- /* for(int i=0; i<m_List3.GetItemCount (); i++)
- {
- list3money+=GetSPPriceFromId(m_List3.GetItemText (i, 0))*atof(m_List3.GetItemText(i,3));
- }*/
- m_money1.Format ("%f", list3money);
- ConvertToPrice(m_money1);
- CString sql,str,str2;
-
- CString strRes1,strRes2;
- GetFirstLetter(m_name1, strRes1);
- GetFirstLetter(m_name2, strRes2);
- m_waiter6=g_user.name ;
- if(bAdd)
- {
- CTime time=CTime::GetCurrentTime ();
- m_time1=time.Format ("%Y-%m-%d");
- CString date=time.Format ("%Y-%m-%d");
- //sql="select count(*) as cot from dindan where time1='"+date+"' ";
- sql="select max(id) as cot from dindan where time1='"+date+"' ";
- g_sendhead.bsql=1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
- date=time.Format ("%Y%m%d");
- id.Format ("%s-%03d", date, g_ncount+1);
- if(m_comboid.FindString (0, id)==-1)
- {
- m_comboid.InsertString(0,id);
- m_comboid.SetCurSel (0);
- }
- CString newid;
- newid.Format ("%s-%03d", date, g_ncount+2);
- m_comboid.InsertString(0,newid);
- UpdateData(false);
- //29-
-
- 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],[urgent],[bz],[pinyin1],[pinyin2],\
- [clothescount],[clothescount2],[outside],[outside2],[style],[waiter6])\
- 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')",\
- id,m_money1,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);
- sql+="***insert into client(id,name1,name2)values('"+id+"','"+m_name1+"','"+m_name2+"')";
- }
- else
- {
- sql.Format ("update dindan set money1='%s',name1='%s',name2='%s',taoxiid='%s',taoxiname='%s',\
- taoxijiage='%s',taoxizs='%s',time2='%s',time3='%s',bm='%s',ren='%s',discount='%s',payed1='%s',bz='%s',pinyin1='%s',pinyin2='%s',clothescount='%s',clothescount2='%s',outside='%s',outside2='%s',style='%s',waiter6='%s' where id='%s' ",\
- m_money1,m_name1,m_name2,m_taoxiid,taoxiname,m_taoxijiage,m_zs,\
- 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,id);
- sql+="***update client set name1='"+m_name1+"',name2='"+m_name2+"' where id='"+id+"'";
- }
- g_sendhead.bsql=1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
- CArray<CStringArray, CStringArray>sparray;
- sparray.SetSize(m_List1.GetItemCount ()+m_List2.GetItemCount ()+m_List3.GetItemCount ());
- int realcount=0;
- for(int i=0; i<m_List1.GetItemCount (); i++)
- {
- str=m_List1.GetItemText (i, 1);
- str.TrimLeft (); str.TrimRight ();
- str2=m_List1.GetItemText (i, 2);
- str2.TrimLeft (); str2.TrimRight ();
- if(str.IsEmpty () && str2.IsEmpty ())continue;
- sparray.ElementAt (realcount).Add ( id );
- sparray.ElementAt (realcount).Add ( m_List1.GetItemText (i, 0) );
- sparray.ElementAt (realcount).Add ( "0" );
- sparray.ElementAt (realcount).Add ( m_List1.GetItemText (i, 2) );
- sparray.ElementAt (realcount).Add ( "1" );
- sparray.ElementAt (realcount).Add ( m_List1.GetItemText (i, 1) );
- realcount++;
- }
- for( i=0; i<m_List2.GetItemCount (); i++)
- {
- str=m_List2.GetItemText (i, 1);
- str.TrimLeft (); str.TrimRight ();
- str2=m_List2.GetItemText (i, 2);
- str2.TrimLeft (); str2.TrimRight ();
- if(str.IsEmpty () && str2.IsEmpty ())continue;
- sparray.ElementAt (realcount).Add ( id );
- sparray.ElementAt (realcount).Add ( m_List2.GetItemText (i, 0) );
- sparray.ElementAt (realcount).Add ( "0" );
- sparray.ElementAt (realcount).Add ( m_List2.GetItemText (i, 2) );
- sparray.ElementAt (realcount).Add ( "2" );
- sparray.ElementAt (realcount).Add ( m_List2.GetItemText (i, 1) );
- realcount++;
- }
- for( i=0; i<m_List3.GetItemCount (); i++)
- {
- str=m_List3.GetItemText (i, 1);
- str.TrimLeft (); str.TrimRight ();
- str2=m_List3.GetItemText (i, 2);
- str2.TrimLeft (); str2.TrimRight ();
- if(str.IsEmpty () && str2.IsEmpty ())continue;
- sparray.ElementAt (realcount).Add ( id );
- sparray.ElementAt (realcount).Add ( m_List3.GetItemText (i, 0) );
- sparray.ElementAt (realcount).Add ( m_List3.GetItemText (i, 2) );
- sparray.ElementAt (realcount).Add ( m_List3.GetItemText (i, 3) );
- sparray.ElementAt (realcount).Add ( "3" );
- sparray.ElementAt (realcount).Add ( m_List3.GetItemText (i, 1) );
- realcount++;
- }
- sparray.SetSize(realcount);
- if(realcount==0)
- {
- sparray.SetSize(1);
- sparray.ElementAt (0).Add (id);
- }
- CMemFile memfile;
- CArchive ar(&memfile, CArchive::store);
- for(int ii=0; ii<sparray.GetSize (); ii++)
- {
- sparray.ElementAt (ii).Serialize (ar);
- }
- ar.Close();
- int length=memfile.GetLength ();
- BYTE *pData = memfile.Detach();
- int size=sparray.GetSize ();
- BYTE *pData2=new BYTE[length+sizeof(int)];
- memcpy(pData2, pData, length);
- memcpy(pData2+length, &size, sizeof(int));
- delete []pData;
- length+=sizeof(int);
- g_nSendCode=3;
- g_pMainWnd->ProcessChatMessageRequest2(pData2, length);
- g_nSendCode=0;
- delete []pData2;
- if(g_bSendOK==0)return;
- AfxMessageBox("保存成功!", MB_ICONINFORMATION);
- GetDlgItem(IDC_BUTsave)->EnableWindow(0);
- GetDlgItem(IDC_BUTclient)->EnableWindow(1);
- GetDlgItem(IDC_BUTprint)->EnableWindow(1);
- if(IsHasRights2(4))
- GetDlgItem(IDC_BUTWaiter)->EnableWindow(1);
- if(bAdd)OnBUTclient();
- }
- void Booking::OnBUTclose()
- {
- // TODO: Add your control notification handler code here
- GetParent()->SendMessage(WM_CLOSE);
- }
- void Booking::OnChangeEDITtaoxijiage()
- {
- // TODO: If this is a RICHEDIT control, the control will not
- // send this notification unless you override the CFormView::OnInitDialog()
- // function and call CRichEditCtrl().SetEventMask()
- // with the ENM_CHANGE flag ORed into the mask.
- /* UpdateData();
- CString str;
- float list3money=0;
- for(int i=0; i<m_List3.GetItemCount (); i++)
- {
- list3money+=GetSPPriceFromId(m_List3.GetItemText (i, 0))*atof(m_List3.GetItemText(i,3));
- }
- m_money1.Format ("%f", list3money+atof(m_taoxijiage)-atof(m_discount));
- m_money2=m_payed1;
- m_money3.Format ("%f", atof(m_money1)-atof(m_money2));
- ConvertToPrice(m_money1);
- ConvertToPrice(m_money2);
- ConvertToPrice(m_money3);
- UpdateData(false);
- */
- UpdateData();
- CString str;
- float list3money=0;
- /* for(int i=0; i<m_List3.GetItemCount (); i++)
- {
- list3money+=GetSPPriceFromId(m_List3.GetItemText (i, 0))*atof(m_List3.GetItemText(i,3));
- }*/
- m_money1.Format ("%f", list3money+atof(m_taoxijiage)-atof(m_discount)+atof(m_payed4));
- m_money2.Format ("%f", atof(m_payed5));
- m_money3.Format ("%f", atof(m_money1)-atof(m_money2));
- ConvertToPrice(m_money1);
- ConvertToPrice(m_money2);
- ConvertToPrice(m_money3);
- UpdateData(false);
- // TODO: Add your control notification handler code here
-
- }
- void Booking::OnChangeEDITdiscount()
- {
- // TODO: If this is a RICHEDIT control, the control will not
- // send this notification unless you override the CFormView::OnInitDialog()
- // function and call CRichEditCtrl().SetEventMask()
- // with the ENM_CHANGE flag ORed into the mask.
- OnChangeEDITtaoxijiage();
- // TODO: Add your control notification handler code here
-
- }
- void Booking::OnChangeEDITpayed1()
- {
- // TODO: If this is a RICHEDIT control, the control will not
- // send this notification unless you override the CFormView::OnInitDialog()
- // function and call CRichEditCtrl().SetEventMask()
- // with the ENM_CHANGE flag ORed into the mask.
- OnChangeEDITtaoxijiage();
- // TODO: Add your control notification handler code here
-
- }
- void Booking::OnDropdownCOMBObm()
- {
- // TODO: Add your control notification handler code here
- if(m_combobm.GetCount ()<2)
- {
- g_sendhead.bsql=0;
- g_sendhead.code[0]=3;
- g_sendhead.tabcount=1;
- g_pMainWnd->ProcessChatMessageRequest2(3);if(g_bSendOK==0)return;
- DataToArray(&g_List1array);
- for(int ii=0; ii<g_List1array.GetSize (); ii++)
- m_combobm.AddString ( g_List1array.ElementAt (ii).ElementAt(0) );
- }
- }
- void Booking::OnDropdownCOMBOrenyuan()
- {
- // TODO: Add your control notification handler code here
- if(m_renyuanarray.GetSize ()==0)
- {
-
- for(int ii=0; ii<g_userarray.GetSize (); ii++)
- {
- m_renyuanarray.Add ( g_userarray.ElementAt (ii).ElementAt(2) );
- m_renyuanarray.Add ( g_userarray.ElementAt (ii).ElementAt(1) );
- }
- }
- m_comborenyuan.ResetContent ();
- int pos=m_combobm.GetCurSel ();
- if(pos==-1)
- {
- for(int ii=0; ii<m_renyuanarray.GetSize (); ii+=2)
- {
- m_comborenyuan.AddString (m_renyuanarray.ElementAt (ii+1) );
- }
- }
- else
- {
- CString str;
- m_combobm.GetLBText (pos, str);
- for(int ii=0; ii<m_renyuanarray.GetSize (); ii+=2)
- {
- if(str==m_renyuanarray.ElementAt (ii))
- m_comborenyuan.AddString (m_renyuanarray.ElementAt (ii+1) );
- }
- }
- }
- void Booking::OnSelchangeCOMBObm()
- {
- // TODO: Add your control notification handler code here
- m_comborenyuan.ResetContent ();
- m_comborenyuan.SetCurSel (-1);
- }
- void Booking::OnDropdownCOMBOid()
- {
- // TODO: Add your control notification handler code here
- if(m_comboid.GetCount ()==0)
- {
- CString date=CTime::GetCurrentTime ().Format ("%Y-%m-%d");
- CString sql;
- // sql="select count(*) as cot from dindan where time1='"+date+"' ";
- sql="select max(id) as cot from dindan where time1='"+date+"' ";
- g_sendhead.bsql=1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
- date=CTime::GetCurrentTime ().Format ("%Y%m%d");
- CString id;
- id.Format ("%s-%03d", date, g_ncount+1);
- m_comboid.AddString (id);
- g_sendhead.bsql=0;
- g_sendhead.code[0]=21;
- g_sendhead.tabcount=1;
- g_pMainWnd->ProcessChatMessageRequest2(51);if(g_bSendOK==0)return;
-
- DataToArray(&g_List1array);
- for(int i=0; i<g_List1array.GetSize (); i++)
- {
- m_comboid.AddString (g_List1array.ElementAt (i).ElementAt (0));
- }
- }
- }
- void Booking::OnSelchangeCOMBOid()
- {
- // TODO: Add your control notification handler code here
- int pos=m_comboid.GetCurSel ();
-
- GetDlgItem(IDC_BUTprint)->EnableWindow(pos);
- if(IsHasRights2new(0))
- {
- GetDlgItem(IDC_BUTsave)->EnableWindow(pos==0);
- // GetDlgItem(IDC_BUTclient)->EnableWindow(pos==0);
- }
- else
- GetDlgItem(IDC_BUTsave)->EnableWindow(0);
- //订单修改权限
- // GetDlgItem(IDC_BUTsave)->EnableWindow(IsHasRights2new(1));
- // if(pos)
- // GetDlgItem(IDC_BUTclient)->EnableWindow(IsHasRights2new(1));
-
- if(pos<1)
- {
- ClearCtrl();
- return;
- }
- CString id;
- m_comboid.GetLBText (pos, id);
- CString filter="id='"+id+"';id='"+id+"' and kind<>'4' and kind<>'5'";
- g_sendhead.code[0]=11;
- g_sendhead.code[1]=50;
- g_sendhead.tabcount=2;
- g_sendhead.bsql=0;
- g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
- CArray<CStringArray, CStringArray>sparray;
- DataToArray(&g_List1array, &sparray);
- CString taoxiname,bm,ren;
- // m_money1 = g_List1array.ElementAt (0).ElementAt (1);
- m_takephotomoney = g_List1array.ElementAt (0).ElementAt (2);
- m_choosephotomoney = g_List1array.ElementAt (0).ElementAt (3);
- m_name1 = g_List1array.ElementAt (0).ElementAt (4);
- m_name2 = g_List1array.ElementAt (0).ElementAt (5);
- m_taoxiid= g_List1array.ElementAt (0).ElementAt (6);
- taoxiname= g_List1array.ElementAt (0).ElementAt (7);
- m_taoxijiage = g_List1array.ElementAt (0).ElementAt (8);
- m_zs = g_List1array.ElementAt (0).ElementAt (9);
- m_time1 = g_List1array.ElementAt (0).ElementAt (10);
- m_time2 = g_List1array.ElementAt (0).ElementAt (11);
- m_time3 = g_List1array.ElementAt (0).ElementAt (12);
- bm = g_List1array.ElementAt (0).ElementAt (13);
- ren = g_List1array.ElementAt (0).ElementAt (14);
- m_discount = g_List1array.ElementAt (0).ElementAt (15);
- m_payed1 = g_List1array.ElementAt (0).ElementAt (16);
- m_payed2 = g_List1array.ElementAt (0).ElementAt (17);
- m_payed3 = g_List1array.ElementAt (0).ElementAt (18);
- m_payed4 = g_List1array.ElementAt (0).ElementAt (19);
- m_payed5 = g_List1array.ElementAt (0).ElementAt (20);
- m_clothescount = g_List1array.ElementAt (0).ElementAt (26);
- m_clothescount2 = g_List1array.ElementAt (0).ElementAt (27);
- m_outside = g_List1array.ElementAt (0).ElementAt (28);
- m_outside2 = g_List1array.ElementAt (0).ElementAt (29);
- m_style = g_List1array.ElementAt (0).ElementAt (30);
- m_waiter1 = g_List1array.ElementAt (0).ElementAt (34);
- m_waiter2 = g_List1array.ElementAt (0).ElementAt (35);
- m_waiter3 = g_List1array.ElementAt (0).ElementAt (36);
- m_waiter4 = g_List1array.ElementAt (0).ElementAt (37);
- m_bz = g_List1array.ElementAt (0).ElementAt (38);
- m_waiter6 = g_List1array.ElementAt (0).ElementAt (41);
- pos=m_combotaoxiname.FindString (0, taoxiname);
- if(pos==-1)
- {
- m_combotaoxiname.InsertString (0, taoxiname);
- m_combotaoxiname.SetCurSel (0);
- }
- else
- m_combotaoxiname.SetCurSel (pos);
- pos=m_combobm.FindString (0, bm);
- if(pos==-1)
- {
- m_combobm.ResetContent ();
- m_combobm.InsertString (0, bm);
- m_combobm.SetCurSel (0);
- }
- else
- m_combobm.SetCurSel (pos);
- pos=m_comborenyuan.FindString (0, ren);
- if(pos==-1)
- {
- m_comborenyuan.InsertString (0, ren);
- m_comborenyuan.SetCurSel (0);
- }
- else
- m_comborenyuan.SetCurSel (pos);
- UpdateData(false);
-
- m_List1.DeleteAllItems ();
- m_List2.DeleteAllItems ();
- m_List3.DeleteAllItems ();
- int listpos[3]={0};
- CEditListCtrl *pList[3]={&m_List1,&m_List2,&m_List3};
- for(int i=0; i<sparray.GetSize (); i++)
- {
- pos=atoi(sparray.ElementAt (i).ElementAt (4))-1;
- #ifndef MODERN_VERSION
- if(pos==1)pos=0;
- #endif
- pList[pos]->InsertItem(listpos[pos], sparray.ElementAt (i).ElementAt (1));
- pList[pos]->SetItemText(listpos[pos], 1, sparray.ElementAt (i).ElementAt (5));
- if(pos<2)
- pList[pos]->SetItemText(listpos[pos], 2, sparray.ElementAt (i).ElementAt (3));
- else
- {
- pList[pos]->SetItemText(listpos[pos], 2, sparray.ElementAt (i).ElementAt (2));
- pList[pos]->SetItemText(listpos[pos], 3, sparray.ElementAt (i).ElementAt (3));
- }
- listpos[pos]++;
- }
- OnChangeEDITtaoxijiage();
- }
- void Booking::ClearCtrl()
- {
- m_money1 = _T("");
- m_money2 = _T("");
- m_money3 = _T("");
- m_choosephotomoney = _T("");
- m_name1 = _T("");
- m_name2 = _T("");
- m_taoxiid = _T("");
- m_taoxijiage = _T("");
- m_zs = _T("");
- m_time1 = CTime::GetCurrentTime ().Format ("%Y-%m-%d");
- m_time2 = _T("");
- m_time3 = _T("");
- m_bz = _T("");
- m_discount = _T("");
- m_payed1 = _T("");
- m_payed2 = _T("");
- m_payed3 = _T("");
- m_payed4 = _T("");
- m_payed5 = _T("");
- m_clothescount = _T("");
- m_clothescount2 = _T("");
- m_outside = _T("");
- m_outside2 = _T("");
- m_style = _T("");
- m_waiter1 = _T("");
- m_waiter2 = _T("");
- m_waiter3 = _T("");
- m_waiter4 = _T("");
- m_waiter6 = g_user.name ;
- m_combotaoxiname.SetCurSel (-1);
- m_combobm.SetCurSel (-1);
- m_comborenyuan.SetCurSel (-1);
- UpdateData(false);
- m_List1.DeleteAllItems ();
- m_List2.DeleteAllItems ();
- m_List3.DeleteAllItems ();
- }
- void Booking::OnBUTclient()
- {
- // TODO: Add your control notification handler code here
- int pos=m_comboid.GetCurSel ();
- if(pos==-1)
- {
- return;
- }
- CString id;
- m_comboid.GetLBText (pos, id);
- UpdateData();
- CClientDlg dlg;
- dlg.id =id;
- dlg.m_name1 =m_name1;
- dlg.m_name2 =m_name2;
- if(dlg.DoModal ()!=IDOK)
- {
- CString sql;
- sql+=DINDAN_REF;
- g_sendhead.bsql=1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
- return;
- }
- m_name1=dlg.m_name1 ;
- m_name2=dlg.m_name2 ;
- UpdateData(false);
- }
- void Booking::OnBUTWaiter()
- {
- }
- void Booking::OnButton1()
- {
- // TODO: Add your control notification handler code here
- CTime tm=CTime::GetCurrentTime ();
- CTimeSpan dt(1, 0, 0, 0);
- CTimeSpan dt2(25, 0, 0, 0);
- CTime tm2=tm-dt2;
- while(tm>tm2)
- {
- CString filter;
- filter="id like '";
- filter+=tm2.Format("%Y%m%d");
- filter+="%'";
-
- tm2+=dt;
-
-
- g_sendhead.code[0]=50;
- g_sendhead.tabcount=1;
- g_sendhead.bsql=0;
- g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
- CArray<CStringArray, CStringArray>sparray;
- DataToArray(&sparray);
-
- m_List1.DeleteAllItems ();
- m_List2.DeleteAllItems ();
- m_List3.DeleteAllItems ();
- int listpos[3]={0};int pos;
- CEditListCtrl *pList[3]={&m_List1,&m_List2,&m_List3};
- for(int i=0; i<sparray.GetSize (); i++)
- {
- pos=atoi(sparray.ElementAt (i).ElementAt (4))-1;
- pList[pos]->InsertItem(listpos[pos], sparray.ElementAt (i).ElementAt (1));
- pList[pos]->SetItemText(listpos[pos], 1, GetSPNameFromId(sparray.ElementAt (i).ElementAt (1)));
- if(pos<2)
- pList[pos]->SetItemText(listpos[pos], 2, sparray.ElementAt (i).ElementAt (0));
- else
- {
- pList[pos]->SetItemText(listpos[pos], 2, sparray.ElementAt (i).ElementAt (0));
- pList[pos]->SetItemText(listpos[pos], 3, sparray.ElementAt (i).ElementAt (0));
- }
- listpos[pos]++;
- }
-
- CArray<CStringArray, CStringArray>savearray;
- savearray.SetSize(m_List1.GetItemCount ());
- CString sql,id,spid,name;
-
- for( i=0; i<m_List1.GetItemCount (); i++)
- {
- spid=m_List1.GetItemText (i, 0);
- id= m_List1.GetItemText (i, 2) ;
- name=m_List1.GetItemText (i, 1);
- sql="update dindansp set name='"+name+"' where id='"+id+"' and spid='"+spid+"'";
-
- g_sendhead.bsql=1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
- }
- for( i=0; i<m_List3.GetItemCount (); i++)
- {
- spid=m_List3.GetItemText (i, 0);
- id= m_List3.GetItemText (i, 3) ;
- name=m_List3.GetItemText (i, 1);
- sql="update dindansp set name='"+name+"' where id='"+id+"' and spid='"+spid+"'";
-
- g_sendhead.bsql=1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
- }
- }
- }
- void Booking::OnBUTprint()
- {
- // TODO: Add your control notification handler code here
- int pos=m_comboid.GetCurSel ();
- if(pos==-1)
- {
- return;
- }
- CString id;
- m_comboid.GetLBText (pos, id);
- g_pMainWnd->PrintDinDan(id);
- }
- void Booking::OnBUTstyle()
- {
- // TODO: Add your control notification handler code here
- SetStyle dlg;
- dlg.m_style=m_style;
- if(dlg.DoModal ()==IDOK)
- m_style=dlg.m_style;
- }
- void Booking::OnBUTspbox()
- {
- // TODO: Add your control notification handler code here
- SPBox dlg;
- if(dlg.DoModal ()!=IDOK)return;
- int pos=m_List3.GetItemCount ();
- CString str;
- if(pos)
- {
- if(m_List3.GetItemText (pos-1, 0).IsEmpty ()&&m_List3.GetItemText (pos-1, 1).IsEmpty ())
- {
- pos--;
- m_List3.SetItemText(pos,0, dlg.m_spid);
- m_List3.SetItemText(pos,1, GetSPNameFromId(dlg.m_spid));
- str.Format ("%f", GetSPPriceFromId(dlg.m_spid));
- ConvertToPrice (str);
- m_List3.SetItemText(pos,2, str);
- }
- else
- {
- m_List3.InsertItem(pos, dlg.m_spid);
- m_List3.SetItemText(pos,1, GetSPNameFromId(dlg.m_spid));
- str.Format ("%f", GetSPPriceFromId(dlg.m_spid));
- ConvertToPrice (str);
- m_List3.SetItemText(pos,2, str);
- }
- }
- else
- {
- m_List3.InsertItem(pos, dlg.m_spid);
- m_List3.SetItemText(pos,1, GetSPNameFromId(dlg.m_spid));
- str.Format ("%f", GetSPPriceFromId(dlg.m_spid));
- ConvertToPrice (str);
- m_List3.SetItemText(pos,2, str);
- }
- }
- void Booking::OnBUTdel()
- {
- // TODO: Add your control notification handler code here
- POSITION pos;
- pos=m_List3.GetFirstSelectedItemPosition();
- if(pos==NULL)
- {
- AfxMessageBox("请先选中您要删除的项目!", MB_ICONINFORMATION);
- return;
- }
- int iItem=m_List3.GetNextSelectedItem(pos);
- m_List3.DeleteItem (iItem);
- int count=m_List3.GetItemCount ();
- if(count==0)return;
- if(iItem==count)
- iItem=0;
-
- m_List3.SetItemState (iItem, LVIS_SELECTED, LVIS_SELECTED);
- }
- void Booking::OnBUTdelall()
- {
- // TODO: Add your control notification handler code here
- m_List3.DeleteAllItems ();
- }
- void Booking::OnBUTspbox2()
- {
- // TODO: Add your control notification handler code here
- SPBox dlg;
- if(dlg.DoModal ()!=IDOK)return;
- if(m_nFocusPos==0)
- {
- int pos=m_List1.GetItemCount ();
- CString str;
- if(pos)
- {
- if(m_List1.GetItemText (pos-1, 0).IsEmpty ()&&m_List1.GetItemText (pos-1, 1).IsEmpty ())
- {
- pos--;
- m_List1.SetItemText(pos,0, dlg.m_spid);
- m_List1.SetItemText(pos,1, GetSPNameFromId(dlg.m_spid));
- }
- else
- {
- m_List1.InsertItem(pos, dlg.m_spid);
- m_List1.SetItemText(pos,1, GetSPNameFromId(dlg.m_spid));
- }
- }
- else
- {
- m_List1.InsertItem(pos, dlg.m_spid);
- m_List1.SetItemText(pos,1, GetSPNameFromId(dlg.m_spid));
- }
- }
- else
- {
- int pos=m_List2.GetItemCount ();
- CString str;
- if(pos)
- {
- if(m_List2.GetItemText (pos-1, 0).IsEmpty ()&&m_List2.GetItemText (pos-1, 1).IsEmpty ())
- {
- pos--;
- m_List2.SetItemText(pos,0, dlg.m_spid);
- m_List2.SetItemText(pos,1, GetSPNameFromId(dlg.m_spid));
- }
- else
- {
- m_List2.InsertItem(pos, dlg.m_spid);
- m_List2.SetItemText(pos,1, GetSPNameFromId(dlg.m_spid));
- }
- }
- else
- {
- m_List2.InsertItem(pos, dlg.m_spid);
- m_List2.SetItemText(pos,1, GetSPNameFromId(dlg.m_spid));
- }
- }
- }
- void Booking::OnBUTdel3()
- {
- // TODO: Add your control notification handler code here
- if(m_nFocusPos==0)
- {
- POSITION pos;
- pos=m_List1.GetFirstSelectedItemPosition();
- if(pos==NULL)
- {
- AfxMessageBox("请先选中您要删除的项目!", MB_ICONINFORMATION);
- return;
- }
- if(AfxMessageBox("确定要删除套系中的商品吗?", MB_YESNO|MB_ICONINFORMATION)!=IDYES)return;
- int iItem=m_List1.GetNextSelectedItem(pos);
- m_List1.DeleteItem (iItem);
- int count=m_List1.GetItemCount ();
- if(count==0)return;
- if(iItem==count)
- iItem=0;
-
- m_List1.SetItemState (iItem, LVIS_SELECTED, LVIS_SELECTED);
- }
- else
- {
- POSITION pos;
- pos=m_List2.GetFirstSelectedItemPosition();
- if(pos==NULL)
- {
- AfxMessageBox("请先选中您要删除的项目!", MB_ICONINFORMATION);
- return;
- }
- if(AfxMessageBox("确定要删除结婚当天的商品吗?", MB_YESNO|MB_ICONINFORMATION)!=IDYES)return;
- int iItem=m_List2.GetNextSelectedItem(pos);
- m_List2.DeleteItem (iItem);
- int count=m_List2.GetItemCount ();
- if(count==0)return;
- if(iItem==count)
- iItem=0;
-
- m_List2.SetItemState (iItem, LVIS_SELECTED, LVIS_SELECTED);
- }
- }
- void Booking::OnBUTdelall2()
- {
- // TODO: Add your control notification handler code here
- if(m_nFocusPos==0)
- {
- if(AfxMessageBox("确定要删除套系中的商品吗?", MB_YESNO|MB_ICONINFORMATION)!=IDYES)return;
- m_List1.DeleteAllItems ();
- }
- else
- {
- if(AfxMessageBox("确定要删除结婚当天的商品吗?", MB_YESNO|MB_ICONINFORMATION)!=IDYES)return;
- m_List2.DeleteAllItems ();
- }
- }
|