// DesignFrom.cpp : implementation file // #include "stdafx.h" #include "ylgl.h" #include "DesignFrom.h" #include "MyMdi.H" #include "ModifyDinDan.h" #include "InputPsw.h" #include "TakeMoney2.h" #include "ImportPhoto.h" #include "ClientRequirement.h" #include "ChoosePhotoSkin2.h" #include "./helper/ffsco.h" #include "SelectPhotoDlg.h" #include "ShowPic.h" #include "Login2.h" #include "ShowCut.h" #include "CompressOption.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif #pragma comment(lib, "Shlwapi.lib") ///////////////////////////////////////////////////////////////////////////// // DesignFrom IMPLEMENT_DYNCREATE(DesignFrom, MyFormView) DesignFrom::DesignFrom() : MyFormView(DesignFrom::IDD) { //{{AFX_DATA_INIT(DesignFrom) m_filter = _T(""); m_nAdd=0; //}}AFX_DATA_INIT if(g_bAllBranch) { m_nAdd=1; } } DesignFrom::~DesignFrom() { } void DesignFrom::DoDataExchange(CDataExchange* pDX) { MyFormView::DoDataExchange(pDX); //{{AFX_DATA_MAP(DesignFrom) DDX_Control(pDX, IDC_COMBO1, m_combo1); DDX_Control(pDX, IDC_LIST2, m_List1); DDX_Control(pDX, IDC_STATIC1, m_static1); DDX_CBString(pDX, IDC_COMBO1, m_filter); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(DesignFrom, MyFormView) //{{AFX_MSG_MAP(DesignFrom) ON_BN_CLICKED(IDC_BUTclose, OnBUTclose) ON_BN_CLICKED(IDC_BUTTON1, OnButton1) ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1) ON_WM_TIMER() ON_BN_CLICKED(IDC_BUTshowphoto, OnBUTshowphoto) ON_BN_CLICKED(IDC_BUTexportphoto, OnBUTexportphoto) ON_BN_CLICKED(IDC_BUTimportphoto, OnBUTimportphoto) ON_BN_CLICKED(IDC_BUTTON2, OnButton2) ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST2, OnItemchangedList2) ON_BN_CLICKED(IDC_BUTimportphoto2, OnBUTimportphoto2) ON_BN_CLICKED(IDC_BUTimportphoto3, OnBUTimportphoto3) ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2) ON_BN_CLICKED(IDC_BUTTON3, OnButton3) ON_BN_CLICKED(IDC_BTNSEARCHFILTER, OnBtnsearchfilter) ON_BN_CLICKED(IDC_BUTprint3, OnBUTprint3) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // DesignFrom diagnostics #ifdef _DEBUG void DesignFrom::AssertValid() const { MyFormView::AssertValid(); } void DesignFrom::Dump(CDumpContext& dc) const { MyFormView::Dump(dc); } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // DesignFrom message handlers void DesignFrom::OnInitialUpdate() { MyFormView::OnInitialUpdate(); // TODO: Add your specialized code here and/or call the base class CMyMdi Mdi; Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this); GetDlgItem(IDC_BUTimportphoto3)->EnableWindow(IsHasRights2new(12)); GetDlgItem(IDC_BUTTON3)->EnableWindow(IsHasRights2new(12)); GetDlgItem(IDC_BUTshowphoto)->EnableWindow(IsHasRights2new(15)); // 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); if(g_bAllBranch==0) { int idarray[]={IDC_BUTexportphoto,IDC_BUTimportphoto,IDC_BUTimportphoto2,IDC_BUTimportphoto3,IDC_BUTshowphoto,IDC_BUTTON3,IDC_BUTclose}; int idcount=7; int btnwid; CRect prerc; for(int a=idcount-2; a>=0; a--) { GetDlgItem(idarray[a+1])->GetWindowRect (prerc); ScreenToClient(prerc); GetDlgItem(idarray[a])->GetWindowRect (rc2); ScreenToClient(rc2); btnwid=rc2.Width (); rc2.right =prerc.left ; rc2.left =rc2.right -btnwid; GetDlgItem(idarray[a])->MoveWindow (rc2); } } else { GetDlgItem(IDC_BUTshowphoto)->ShowWindow (0); GetDlgItem(IDC_BUTprint3)->ShowWindow (1); int idarray[]={IDC_BUTprint3,IDC_BUTexportphoto,IDC_BUTimportphoto,IDC_BUTimportphoto2,IDC_BUTimportphoto3,IDC_BUTTON3,IDC_BUTclose}; int idcount=7; int btnwid; CRect prerc; for(int a=idcount-2; a>=0; a--) { GetDlgItem(idarray[a+1])->GetWindowRect (prerc); ScreenToClient(prerc); GetDlgItem(idarray[a])->GetWindowRect (rc2); ScreenToClient(rc2); btnwid=rc2.Width (); rc2.right =prerc.left ; rc2.left =rc2.right -btnwid; GetDlgItem(idarray[a])->MoveWindow (rc2); } } m_static1.SetFont (&g_titlefont); if(g_bAllBranch==0) { #ifdef CHILD_VERSION m_List1.SetHeadings("订单号,100;家长姓名,100;宝宝姓名,100;精修,100;设计,100;设计日期,100;看设计,100;看设计日期,100;加急,100;取件日期,100;看设计要求,100;接单人,100;看设计人,100;设计师,100;套系名称,100;套系价格,100;手机,100;固定电话,100" ); #else m_List1.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;精修,100;设计,100;设计日期,100;看设计,100;看设计日期,100;加急,100;取件日期,100;看设计要求,100;接单人,100;看设计人,100;设计师,100;套系名称,100;套系价格,100;男宾电话,100;女宾电话,100" ); #endif m_List1.LoadColumnInfo (119); } else { #ifdef CHILD_VERSION m_List1.SetHeadings("店名,100;订单号,100;家长姓名,100;宝宝姓名,100;精修,100;设计,100;设计日期,100;看设计,100;看设计日期,100;加急,100;取件日期,100;看设计要求,100;接单人,100;看设计人,100;设计师,100;套系名称,100;套系价格,100;手机,100;固定电话,100" ); #else m_List1.SetHeadings("店名,100;订单号,100;男宾姓名,100;女宾姓名,100;精修,100;设计,100;设计日期,100;看设计,100;看设计日期,100;加急,100;取件日期,100;看设计要求,100;接单人,100;看设计人,100;设计师,100;套系名称,100;套系价格,100;男宾电话,100;女宾电话,100" ); #endif m_List1.LoadColumnInfo (199); } GetData(); m_combo1.AddString (g_user.name); m_combo1.GetWindowRect (rc2); ScreenToClient(rc2); rc2.bottom +=200; m_combo1.MoveWindow (rc2); GetDlgItem(IDC_BUTclose)->GetWindowRect(rc2); SetComboHei(&m_combo1, rc2.Height ()); GetDlgItem(IDC_BUTexportphoto)->EnableWindow(IsHasRights2new(11)); } void DesignFrom::FillGrid(BOOL bStatus) { if(g_bSearchFilter) { m_List1.DeleteAllItems2 (); int ii=0; m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 ); int count=0; { for(ii=0; iig_filterdate2) continue; } if(g_waiter1!="") { if(m_List1array.ElementAt (ii).ElementAt (13+m_nAdd)!=g_waiter1) continue; } if(g_bAllBranch && g_filterbranch!="") { if(m_List1array.ElementAt (ii).ElementAt (0)!= g_filterbranch) continue; } if(1) { m_List1.m_arLabels.ElementAt (count++).Copy (m_List1array.ElementAt (ii)); } } } m_List1.m_arLabels.SetSize(count, 1); ii=count; m_List1.m_LabelCount=ii; m_List1.SetItemCountEx (ii); CString str; str.Format ("单数:%d", ii); SetDlgItemText(IDC_STATIC2, str); } else { m_List1.DeleteAllItems2 (); int ii=0; m_List1.m_arLabels.SetSize( m_List1array.GetSize (), 1 ); int count=0; if(m_filter.IsEmpty ()) { if(bStatus) { for(ii=0; iiSendMessage(WM_CLOSE); } void DesignFrom::OnSelchangeCombo1() { // TODO: Add your control notification handler code here SetTimer(1, 100, NULL); } void DesignFrom::OnTimer(UINT nIDEvent) { // TODO: Add your message handler code here and/or call default KillTimer(nIDEvent); OnButton1(); } BOOL DesignFrom::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class try { if(pMsg->message==WM_KEYDOWN) { switch (pMsg->wParam) { case VK_RETURN: OnButton1(); return 1; 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) { CPoint pt; CRect rc,rc2; ::GetCursorPos (&pt); m_List1.GetWindowRect (rc2); if(rc2.PtInRect (pt)==0) return MyFormView::PreTranslateMessage(pMsg); pt.x-=rc2.left ; pt.y-=rc2.top ; POSITION pos; pos=m_List1.GetFirstSelectedItemPosition(); if(pos==NULL)return MyFormView::PreTranslateMessage(pMsg); int iItem=m_List1.GetNextSelectedItem(pos); m_List1.GetSubItemRect( iItem, 10+m_nAdd, LVIR_BOUNDS, rc); if(rc.PtInRect (pt)) { CClientRequirement dlg; CString id=m_List1.GetItemText (iItem, 0+m_nAdd); CString str; if(g_bAllBranch==0) { for(int i=0; im_hWnd; bi.pidlRoot = pidlDesktop; bi.pszDisplayName = lpszDisplayName; bi.lpszTitle = "\n文档保存的目录:"; bi.ulFlags = BIF_STATUSTEXT&BIF_RETURNONLYFSDIRS ; bi.lpfn = BrowseProc; bi.lParam = 0; bi.iImage = 0; pidlCurrent = SHBrowseForFolder(&bi); SHGetPathFromIDList(pidlCurrent, szFileName); path = szFileName; } } int DesignFrom::FindArray(CStringArray *pArray, CString Str) { for(int i=0; iGetSize (); i++) { if(pArray->ElementAt (i)==Str) return i; } return -1; } void DesignFrom::GetNo(CString str, CStringArray &array) { if(!str.IsEmpty ()) { int pos=str.Find (","); while(pos!=-1) { if(FindArray(&array, str.Left (pos))==-1) array.Add (str.Left (pos)); str=str.Right (str.GetLength ()-pos-1); pos=str.Find (","); } if(FindArray(&array, str)==-1) array.Add(str); } } CString DesignFrom::GetSelName(CString name, CArray&spnamearray) { CString ret; name=","+name+","; CString str; for(int i=0; i&spnamearray) { CString ret; name=","+name+","; CString str; for(int i=0; iOnDisconnect(); g_branchname=branch; g_bBranchModify=1; g_pMainWnd->ProcessChatMessageRequest2(sql); g_pMainWnd->OnDisconnect();g_bBranchModify=0;g_branchip=g_branchname=""; } else g_pMainWnd->ProcessChatMessageRequest2(sql); if(g_bSendOK==0)return; if(g_bAllBranch==0) { GetData(); } else { for(int i=0; iOnDisconnect(); g_branchname=branch; g_bBranchModify=1; g_pMainWnd->ProcessChatMessageRequest2(sql); g_pMainWnd->OnDisconnect();g_bBranchModify=0;g_branchip=g_branchname=""; } else g_pMainWnd->ProcessChatMessageRequest2(sql); if(g_bSendOK==0)return; savepath+="ok"; ::DeleteFile (savepath); AfxMessageBox("导入客照成功!", MB_ICONINFORMATION); if(g_bAllBranch==0) { GetData(); } else { for(int i=0; iEnableWindow(1); // GetDlgItem(IDC_BUTimportphoto2)->EnableWindow(1); } else { GetDlgItem(IDC_BUTimportphoto)->EnableWindow(0); // GetDlgItem(IDC_BUTimportphoto2)->EnableWindow(0); } /* if(waiter4.IsEmpty () && IsHasRights2new(7) || IsHasRights2new(49) ) { GetDlgItem(IDC_BUTimportphoto)->EnableWindow(1); GetDlgItem(IDC_BUTimportphoto2)->EnableWindow(1); } else if(waiter4==g_user.name && IsHasRights2new(7) ) { GetDlgItem(IDC_BUTimportphoto)->EnableWindow(1); GetDlgItem(IDC_BUTimportphoto2)->EnableWindow(1); } else { GetDlgItem(IDC_BUTimportphoto)->EnableWindow(0); GetDlgItem(IDC_BUTimportphoto2)->EnableWindow(0); }*/ *pResult = 0; } void DesignFrom::OnBUTimportphoto2() { // TODO: Add your control notification handler code here // TODO: Add your control notification handler code here POSITION pos; pos=m_List1.GetFirstSelectedItemPosition(); if(pos==NULL) { AfxMessageBox("请先选中您要查看的定单!", MB_ICONINFORMATION); return; } int iItem=m_List1.GetNextSelectedItem(pos); CString branch; CString id=m_List1.GetItemText (iItem, 0+m_nAdd); if(g_bAllBranch) branch=m_List1.GetItemText (iItem, 0); CString name=m_List1.GetItemText (iItem, 1+m_nAdd)+","+m_List1.GetItemText (iItem, 2+m_nAdd); name.TrimLeft (","); name.TrimRight (","); name="客人:"+name; ShowPic dlg; dlg.m_id=id; dlg.m_name=name; dlg.m_name2=m_List1.GetItemText (iItem, 1+m_nAdd)+m_List1.GetItemText (iItem, 2+m_nAdd); dlg.remark=m_List1.GetItemText (iItem, 10+m_nAdd); dlg.m_mode=5; if(g_bAllBranch) { dlg.m_branch=branch; CString branchpath=GetBranchPhotoPath(branch); dlg.m_path=g_path3+branchpath+"\\"; } else dlg.m_path=g_path3+"\\"; dlg.m_path+=id; dlg.m_path +="\\"; dlg.DoModal (); } void DesignFrom::OnBUTimportphoto3() { // TODO: Add your control notification handler code here if(IsHasRights2new(12)==0)return; // TODO: Add your control notification handler code here POSITION pos; pos=m_List1.GetFirstSelectedItemPosition(); if(pos==NULL) { AfxMessageBox("请先选中您要导出片的定单!", MB_ICONINFORMATION); return; } int iItem=m_List1.GetNextSelectedItem(pos); CString id=m_List1.GetItemText (iItem, 0+m_nAdd); CString branch; if(g_bAllBranch) branch=m_List1.GetItemText (iItem, 0); CString path; if(g_bAllBranch) { CString branchpath=GetBranchPhotoPath(branch); path=g_path3+branchpath+"\\"; } else path=g_path3+"\\"; path+=id; path +="\\"; CStringArray array; CString dir; GetSavePath(dir); if(dir.IsEmpty()) { return; } CString name1=m_List1.GetItemText (iItem, 1+m_nAdd); CString name2=m_List1.GetItemText (iItem, 2+m_nAdd); CString remark=m_List1.GetItemText (iItem, 10+m_nAdd); dir.TrimRight ('\\'); dir+="\\"; dir+=id; dir+=g_branchname; if(g_bAllBranch) { if(GetBranchPhotoPath(branch)!="") dir+=branch; } dir+=name1; dir+=name2; dir+="设计好的片"; dir+="\\"; ::CreateDirectory (dir, NULL); CStringArray desarray; CStringArray dirarray; CString savepath=dir; CString str; if(1) { using namespace helper_coffs; ffsco o; o.dirs(1); o.find(LPCSTR(path), LPCSTR("*.*")); ffsco::typeT coo; ffsco::typeT::iterator it; coo = o.co_dir(); for (it = coo.begin(); coo.end() != it;it ++) { str=(*it).c_str(); if(FindArray(&dirarray, str)==-1) { dirarray.Add (str); if(str!=dirarray.ElementAt (0)) { str=savepath+str.Right (str.GetLength ()-dirarray.ElementAt (0).GetLength ()); if(::CheckFolderFileExist (str)==0) ::CreateDirectory (str, NULL); } } } } if(1) { for(int i=0; i'入册' and name<>'入底'"; #else CString filter="id='"+id+"';id='"+id+"';id='"+id+"' and kind<>'2' and name<>'入册' and name<>'入底'"; #endif g_sendhead.bsql=0; g_sendhead.code[0]=50; g_sendhead.code[1]=11; g_sendhead.code[2]=56; g_sendhead.tabcount=3; if(g_bAllBranch) { g_branchip=GetIP(branch); g_pMainWnd->OnDisconnect(); g_branchname=branch; g_bBranchModify=1; g_pMainWnd->ProcessChatMessageRequest2(filter); g_pMainWnd->OnDisconnect();g_bBranchModify=0;g_branchip=g_branchname=""; } else g_pMainWnd->ProcessChatMessageRequest2(filter); if(g_bSendOK==0)return; CArraysparray; CArraysparray2; DataToArray( &sparray, &g_List1array, &sparray2); CString path; if(g_bAllBranch) { CString branchpath=GetBranchPhotoPath(branch); path=g_path3+branchpath+"\\"; } else path=g_path3+"\\"; path+=id; path +="\\"; //////////////////////////////////////// CString str,spname; CStringArray noarray; CStringArray spnamearray; int i = 0; for( i=0; iProcessChatMessageRequest2(filter);if(g_bSendOK==0)return; } else { g_sendhead.bsql=0; g_sendhead.code[0]=31; g_sendhead.tabcount=1; #ifdef LKAY_VERSION CString filter="dindantype<>'意向客户' or dindantype is null"; g_pMainWnd->ProcessChatMessageRequest2(filter); #else g_pMainWnd->ProcessChatMessageRequest2(1); #endif if(g_bSendOK==0)return; } DataToArray(&m_List1array); } else { //////////////数据汇总 m_List1array.RemoveAll (); CString branch; for(int i=-1; iOnDisconnect(); g_branchname=branch; g_bBranchModify=1; } else branch=g_brancharray.ElementAt (g_brancharray.GetSize ()-1).ElementAt (0); if(g_bShowOK==0) { CString filter="status3='未取'"; g_sendhead.bsql=0; g_sendhead.code[0]=31; g_sendhead.tabcount=1; g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)continue; } else { g_sendhead.bsql=0; g_sendhead.code[0]=31; g_sendhead.tabcount=1; g_pMainWnd->ProcessChatMessageRequest2(1);if(g_bSendOK==0)continue; } CArrayList1array; DataToArray(&List1array); int size=m_List1array.GetSize (); for(int j=0; jOnDisconnect(); g_bBranchModify=0;g_branchip=g_branchname=""; } m_List1arraybak.SetSize(m_List1array.GetSize (), 1); for(int ii=0; ii256) { m_List1array.ElementAt (ii).SetAt (10, m_List1array.ElementAt (ii).ElementAt (10).Left (256)+"..."); } } HidePrice(); FillGrid(); } void DesignFrom::OnBUTprint3() { // TODO: Add your control notification handler code here GetData(); }