123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997 |
- #include "stdafx.h"
- #include "ylgl.h"
- #include "outsourcing.h"
- #include "MyMdi.H"
- #include "ModifyDinDan.h"
- #include "InputPsw.h"
- #include "outsourcingDlg.h"
- #include "outsourcingDlg2.h"
- #include "outsourcing2.h"
- #include "outsourcing3.h"
- #include "outsourcing4.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- #pragma comment(lib, "Shlwapi.lib")
- IMPLEMENT_DYNCREATE(outsourcing, MyFormView)
- outsourcing::outsourcing() : MyFormView(outsourcing::IDD)
- {
- m_filter = _T(""); m_nAdd = 0;
- if (g_bAllBranch)
- {
- m_nAdd = 1;
- }
- }
- outsourcing::~outsourcing()
- {
- }
- void outsourcing::DoDataExchange(CDataExchange* pDX)
- {
- MyFormView::DoDataExchange(pDX);
- 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);
- }
- BEGIN_MESSAGE_MAP(outsourcing, MyFormView)
- 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_BUTmodify, OnBUTmodify)
- ON_NOTIFY(NM_DBLCLK, IDC_LIST2, OnDblclkList2)
- ON_BN_CLICKED(IDC_BUTexport, OnBUTexport)
- ON_BN_CLICKED(IDC_BUTmodify2, OnBUTmodify2)
- ON_NOTIFY(NM_RDBLCLK, IDC_LIST2, OnRdblclkList2)
- ON_BN_CLICKED(IDC_BUTToPhotoPrint, OnBUTToPhotoPrint)
- ON_BN_CLICKED(IDC_BUTburncd, OnBUTburncd)
- ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
- ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
- ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2)
- ON_BN_CLICKED(IDC_BUTburncd2, OnBUTburncd2)
- ON_NOTIFY(NM_CUSTOMDRAW, IDC_LIST2, OnCustomdrawList)
- END_MESSAGE_MAP()
- #ifdef _DEBUG
- void outsourcing::AssertValid() const
- {
- MyFormView::AssertValid();
- }
- void outsourcing::Dump(CDumpContext& dc) const
- {
- MyFormView::Dump(dc);
- }
- #endif
- void outsourcing::OnInitialUpdate()
- {
- MyFormView::OnInitialUpdate();
- CMyMdi Mdi;
- Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
- 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);
- #ifdef LKAY_VERSION
- GetDlgItem(IDC_BUTexport)->ShowWindow(SW_SHOW);
- GetDlgItem(IDC_BUTToPhotoPrint)->ShowWindow(SW_SHOW);
- #endif
- int btnwid;
- CRect prerc;
- int idcount = 5;
- {
- int idarray[] = { IDC_BUTmodify, IDC_BUTmodify2, IDC_BUTburncd, IDC_BUTburncd2, IDC_BUTclose };
- idcount = 5;
- 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);
- }
- }
- int idarray2[] = { IDC_BUTTON1, IDC_BUTTON2, IDC_BUTTON3, IDC_BUTexport, IDC_BUTToPhotoPrint };
- idcount = 5;
- for (int a = 1; a < idcount; a++)
- {
- GetDlgItem(idarray2[a - 1])->GetWindowRect(prerc);
- ScreenToClient(prerc);
- GetDlgItem(idarray2[a])->GetWindowRect(rc2);
- ScreenToClient(rc2);
- btnwid = rc2.Width();
- rc2.left = prerc.right;
- rc2.right = rc2.left + btnwid;
- GetDlgItem(idarray2[a])->MoveWindow(rc2);
- }
- m_static1.SetFont(&g_titlefont);
- if (g_bAllBranch == 0)
- {
- #ifdef CHILD_VERSION
- #ifdef LKAY_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");
- #endif
- #else
- m_List1.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;设计,100;设计师,100;加急,100;取件日期,100;接单人,100;商品名称,100;是否发出,100;是否返工,100;是否完成,100;是否取走,100;加急,100;取件日期,100;男宾电话,100;女宾电话,100" );
- #endif
- m_List1.LoadColumnInfo(121);
- }
- 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");
- #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(305);
- }
- #if JEFF_DELETE_OFF
- m_List1.m_bSortSupport = 0;
- #endif
- GetData();
- for (int i = 0; i < g_userarray.GetSize(); i++)
- {
- m_combo1.AddString(g_userarray.ElementAt(i).ElementAt(1));
- }
- FillGrid();
- 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_BUTmodify)->EnableWindow(IsHasRights2new(13));
- GetDlgItem(IDC_BUTmodify2)->EnableWindow(IsHasRights2new(13));
- }
- void outsourcing::FillGrid(BOOL bStatus)
- {
- m_List1.DeleteAllItems2();
- int ii = 0;
- m_List1.m_arLabels.SetSize(m_List1array.GetSize(), 1);
- int count = 0;
- if (m_filter.IsEmpty() || bStatus)
- {
- if (bStatus == 2)
- {
- CTime tm(atoi(g_date.Mid(0, 4)), atoi(g_date.Mid(5, 2)), atoi(g_date.Mid(8, 2)), 0, 0, 0);
- CString sdate1, sdate2;
- sdate1 = tm.Format("%Y-%m-%d");
- CTimeSpan sp(15, 0, 0, 0);
- tm += sp;
- sdate2 = tm.Format("%Y-%m-%d");
- BOOL bFinded = 0;
- int begin, end;
- CString oldid = "";
- for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
- {
- if (oldid.IsEmpty())
- {
-
- oldid = m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd);
- begin = ii;
- continue;
- }
- if (ii == (m_List1.m_arLabels.GetSize() - 1) || (m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd) != "" && m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd) != oldid))
- {
- end = ii - 1;
- bFinded = 0;
- for (int a = begin; a <= end; a++)
- {
-
- if ((m_List1array.ElementAt(a).ElementAt(6 + m_nAdd) >= sdate1 && m_List1array.ElementAt(a).ElementAt(6 + m_nAdd) <= sdate2) || (m_List1array.ElementAt(a).ElementAt(14 + m_nAdd) >= sdate1 && m_List1array.ElementAt(a).ElementAt(14 + m_nAdd) <= sdate2))
- {
- bFinded = 1;
- break;
- }
- }
- if (bFinded == 1)
- {
- for (int a = begin; a <= end; a++)
- {
- m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(a));
- }
- }
- begin = ii;
- oldid = m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd);
- }
- }
- }
- else if (bStatus == 1)
- {
- {BOOL bFinded = 0;
- int begin, end;
- CString oldid = "";
- for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
- {
- if (oldid.IsEmpty())
- {
- oldid = m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd);
- begin = ii;
- continue;
- }
- if (ii == (m_List1.m_arLabels.GetSize() - 1) || (m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd) != "" && m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd) != oldid))
- {
- end = ii - 1;
- bFinded = 0;
- for (int a = begin; a <= end; a++)
- {
-
- if (m_List1array.ElementAt(a).ElementAt(11 + m_nAdd) != "OK")
- {
- bFinded = 1;
- break;
- }
- }
- if (bFinded == 0)
- {
- for (int a = begin; a <= end; a++)
- {
- m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(a));
- }
- }
- begin = ii;
- oldid = m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd);
- }
- }
- }
- }
- else if (bStatus == 3)
- {
- {BOOL bFinded = 0; BOOL bFinded2 = 0;
- int begin, end;
- CString oldid = "";
- for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
- {
- if (oldid.IsEmpty())
- {
- oldid = m_List1array.ElementAt(ii).ElementAt(0);
- begin = ii;
- continue;
- }
- if (ii == (m_List1.m_arLabels.GetSize() - 1) || (m_List1array.ElementAt(ii).ElementAt(0) != "" && m_List1array.ElementAt(ii).ElementAt(0) != oldid))
- {
- end = ii - 1;
- bFinded = 0; bFinded2 = 0;
- for (int a = begin; a <= end; a++)
- {
-
- if (m_List1array.ElementAt(a).ElementAt(11) != "OK")
- {
- bFinded = 1;
- break;
- }
-
- if (m_List1array.ElementAt(a).ElementAt(12) != "OK")
- {
- bFinded2 = 1;
- }
- }
- if (bFinded == 0 && bFinded2)
- {
- for (int a = begin; a <= end; a++)
- {
- m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(a));
- }
- }
- begin = ii;
- oldid = m_List1array.ElementAt(ii).ElementAt(0);
- }
- }
- }
- }
- else if (bStatus == 4)
- {
- BOOL bFinded = 0;
- BOOL bFinded2 = 0;
- int begin, end;
- CString oldid = "";
- for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
- {
- if (oldid.IsEmpty())
- {
- oldid = m_List1array.ElementAt(ii).ElementAt(0);
- begin = ii;
- continue;
- }
- if (ii == (m_List1.m_arLabels.GetSize() - 1) || (m_List1array.ElementAt(ii).ElementAt(0) != "" && m_List1array.ElementAt(ii).ElementAt(0) != oldid))
- {
- end = ii - 1;
- bFinded = 0; bFinded2 = 0;
- for (int a = begin; a <= end; a++)
- {
-
- if (m_List1array.ElementAt(a).ElementAt(12) != "OK")
- {
- bFinded = 1;
- break;
- }
-
- if (m_List1array.ElementAt(a).ElementAt(13) != "OK")
- {
- bFinded2 = 1;
- }
- }
- if (bFinded == 0 && bFinded2)
- {
- for (int a = begin; a <= end; a++)
- {
- m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(a));
- }
- }
- begin = ii;
- oldid = m_List1array.ElementAt(ii).ElementAt(0);
- }
- }
- }
- else
- {
- for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
- {
- m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
- }
- }
- }
- else
- {
- int nAdd = 0;
- #ifdef LKAY_VERSION
- nAdd=2;
- #endif
- int type = GetType(m_filter);
- if (type == 1)
- {
- BOOL bFinded = 0;
- for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
- {
- if (bFinded && m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd).IsEmpty())
- {
- m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
- continue;
- }
-
- if (m_List1array.ElementAt(ii).ElementAt(16 + nAdd + m_nAdd).Find(m_filter) != -1 || m_List1array.ElementAt(ii).ElementAt(17 + nAdd + m_nAdd).Find(m_filter) != -1)
- {
- bFinded = 1;
- m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
- }
- else
- {
- bFinded = 0;
- }
- }
- }
- else if (type == 2)
- {
- BOOL bFinded = 0;
- m_filter.MakeUpper();
- for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
- {
- if (bFinded && m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd).IsEmpty())
- {
- m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
- continue;
- }
-
- if (m_List1array.ElementAt(ii).ElementAt(18 + nAdd + m_nAdd).Find(m_filter) != -1 || m_List1array.ElementAt(ii).ElementAt(19 + nAdd + m_nAdd).Find(m_filter) != -1)
- {
- bFinded = 1;
- m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
- }
- else
- {
- bFinded = 0;
- }
- }
- }
- else
- {
- BOOL bFinded = 0;
- for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++)
- {
- if (bFinded && m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd).IsEmpty())
- {
- m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
- continue;
- }
-
- if (m_List1array.ElementAt(ii).ElementAt(0).Find(m_filter) != -1
- || m_List1array.ElementAt(ii).ElementAt(0 + m_nAdd).Find(m_filter) != -1
- || m_List1array.ElementAt(ii).ElementAt(1 + m_nAdd).Find(m_filter) != -1
- || m_List1array.ElementAt(ii).ElementAt(2 + m_nAdd).Find(m_filter) != -1
- || m_List1array.ElementAt(ii).ElementAt(7 + m_nAdd).Find(m_filter) != -1
- || m_List1array.ElementAt(ii).ElementAt(15 + nAdd + m_nAdd).Find(m_filter) != -1
- || m_List1array.ElementAt(ii).ElementAt(16 + nAdd + m_nAdd).Find(m_filter) != -1
- || m_List1array.ElementAt(ii).ElementAt(17 + nAdd + m_nAdd).Find(m_filter) != -1
- || m_List1array.ElementAt(ii).ElementAt(18 + nAdd + m_nAdd).Find(m_filter) != -1
- )
- {
- bFinded = 1;
- m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
- }
- else
- {
- bFinded = 0;
- }
- }
- }
- }
- 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);
- if (!g_id.IsEmpty())
- {
- for (int i = 0; i < m_List1.GetItemCount(); i++)
- {
- if (g_id == m_List1.GetItemText(i, 0 + m_nAdd))
- {
- m_List1.SetItemState(i, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
- m_List1.EnsureVisible(i, FALSE);
- break;
- }
- }
- }
- }
- void outsourcing::OnBUTclose()
- {
- GetParent()->SendMessage(WM_CLOSE);
- }
- void outsourcing::OnButton1()
- {
- UpdateData();
- m_filter.TrimLeft();
- m_filter.TrimRight();
- FillGrid();
- }
- void outsourcing::OnSelchangeCombo1()
- {
- SetTimer(1, 100, NULL);
- }
- void outsourcing::OnTimer(UINT nIDEvent)
- {
- KillTimer(nIDEvent);
- OnButton1();
- }
- BOOL outsourcing::PreTranslateMessage(MSG* pMsg)
- {
- try
- {
- if (pMsg->message == WM_KEYDOWN)
- {
- switch (pMsg->wParam)
- {
- case VK_RETURN:
- OnButton1();
- return 1;
- case 0x43:
- if ((GetKeyState(VK_CONTROL) & 0x80))
- {
- GetFocus()->SendMessage(WM_COPY);
- return TRUE;
- }
- break;
- case 0x56:
- if ((GetKeyState(VK_CONTROL) & 0x80))
- {
- GetFocus()->SendMessage(WM_PASTE);
- return TRUE;
- }
- break;
- case 0x58:
- if ((GetKeyState(VK_CONTROL) & 0x80))
- {
- GetFocus()->SendMessage(WM_CUT);
- return TRUE;
- }
- break;
- case 0x5A:
- case 0x59:
- if ((GetKeyState(VK_CONTROL) & 0x80))
- {
- GetFocus()->SendMessage(WM_UNDO);
- return TRUE;
- }
- break;
- }
- }
-
- return MyFormView::PreTranslateMessage(pMsg);
- }
- catch (...)
- {
- }
- }
- void outsourcing::GetNo(CString str, CStringArray &array)
- {
- if (!str.IsEmpty())
- {
- int pos = str.Find(",");
- while (pos != -1)
- {
- array.Add(str.Left(pos));
- str = str.Right(str.GetLength() - pos - 1);
- pos = str.Find(",");
- }
- array.Add(str);
- }
- }
- extern int CALLBACK BrowseProc(HWND hwnd, UINT msg, LPARAM lParam, LPARAM lpData);
- void outsourcing::GetSavePath(CString &path)
- {
- char lpszDisplayName[MAX_PATH], szFileName[MAX_PATH];
- LPITEMIDLIST pidlDesktop, pidlCurrent;
- if (SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidlDesktop)
- == NOERROR)
- {
- BROWSEINFO bi;
- bi.hwndOwner = this->m_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 outsourcing::FindArray(CStringArray *pArray, CString *pStr)
- {
- for (int i = 0; i < pArray->GetSize(); i++)
- {
- if (pArray->ElementAt(i) == *pStr)
- return i;
- }
- return -1;
- }
- void outsourcing::OnDblclkList2(NMHDR* pNMHDR, LRESULT* pResult)
- {
- OnBUTmodify();
- *pResult = 0;
- }
- void outsourcing::OnBUTmodify()
- {
- if (IsHasRights2new(13) == 0)return;
- POSITION pos;
- pos = m_List1.GetFirstSelectedItemPosition();
- if (pos == NULL)
- {
- 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);
- while (id == "")
- {
- iItem--;
- id = m_List1.GetItemText(iItem, 0 + m_nAdd);
- }
- outsourcingDlg dlg;
- dlg.m_branch = branch;
- dlg.m_id = id;
- dlg.m_name1 = m_List1.GetItemText(iItem, 1 + m_nAdd);
- dlg.m_name2 = m_List1.GetItemText(iItem, 2 + m_nAdd);
- if (dlg.DoModal() != IDOK)
- return;
- for (int i = 0; i < m_List1array.GetSize(); i++)
- {
- if (id == m_List1array.ElementAt(i).ElementAt(0 + m_nAdd))
- {
- iItem = i;
- break;
- }
- }
- int pos2;
- CString name;
- int sameproduct = 0;
- if (g_bAllBranch)
- {
- while (branch == m_List1array.ElementAt(iItem).ElementAt(0) && (id == m_List1array.ElementAt(iItem).ElementAt(0 + m_nAdd) || m_List1array.ElementAt(iItem).ElementAt(0 + m_nAdd).IsEmpty()))
- {
-
- name = m_List1array.ElementAt(iItem).ElementAt(8 + m_nAdd);
- for (int i = 0; i < dlg.m_sparray.GetSize(); i++)
- {
- if (name == dlg.m_sparray.ElementAt(i).ElementAt(0))
- {
- pos2 = i;
- sameproduct++;
-
- }
- }
- if (sameproduct > 1)
- {
- GetData();
- FillGrid();
- return;
- }
- #if 0
- m_List1array.ElementAt (iItem).SetAt (8+m_nAdd, dlg.m_sparray .ElementAt (pos2).ElementAt(2));
- m_List1array.ElementAt (iItem).SetAt (9+m_nAdd, dlg.m_sparray .ElementAt (pos2).ElementAt(3));
- m_List1array.ElementAt (iItem).SetAt (10+m_nAdd, dlg.m_sparray .ElementAt (pos2).ElementAt(4));
- #ifdef LKAY_VERSION
- m_List1array.ElementAt (iItem).SetAt (11, dlg.m_sparray .ElementAt (pos2).ElementAt(23));
- m_List1array.ElementAt (iItem).SetAt (12, dlg.m_sparray .ElementAt (pos2).ElementAt(24));
- m_List1array.ElementAt (iItem).SetAt (13, dlg.m_sparray .ElementAt (pos2).ElementAt(5));
- #else
- m_List1array.ElementAt (iItem).SetAt (11+m_nAdd, dlg.m_sparray .ElementAt (pos2).ElementAt(5));
- #endif
- #else
- m_List1array.ElementAt(iItem).SetAt(9 + m_nAdd, dlg.m_sparray.ElementAt(pos2).ElementAt(2));
- m_List1array.ElementAt(iItem).SetAt(10 + m_nAdd, dlg.m_sparray.ElementAt(pos2).ElementAt(3));
- m_List1array.ElementAt(iItem).SetAt(11 + m_nAdd, dlg.m_sparray.ElementAt(pos2).ElementAt(4));
- #ifdef LKAY_VERSION
- m_List1array.ElementAt (iItem).SetAt (12, dlg.m_sparray .ElementAt (pos2).ElementAt(23));
- m_List1array.ElementAt (iItem).SetAt (13, dlg.m_sparray .ElementAt (pos2).ElementAt(24));
- m_List1array.ElementAt (iItem).SetAt (14, dlg.m_sparray .ElementAt (pos2).ElementAt(5));
- #else
- m_List1array.ElementAt(iItem).SetAt(12 + m_nAdd, dlg.m_sparray.ElementAt(pos2).ElementAt(5));
- #endif
- #endif
- iItem++;
- if (iItem >= m_List1array.GetSize())break;
- }
- }
- else
- {
- while (id == m_List1array.ElementAt(iItem).ElementAt(0 + m_nAdd) || m_List1array.ElementAt(iItem).ElementAt(0 + m_nAdd).IsEmpty())
- {
-
- name = m_List1array.ElementAt(iItem).ElementAt(8 + m_nAdd);
- for (int i = 0; i < dlg.m_sparray.GetSize(); i++)
- {
- if (name == dlg.m_sparray.ElementAt(i).ElementAt(0))
- {
- pos2 = i;
- sameproduct++;
-
- }
- }
- if (sameproduct > 1)
- {
- GetData();
- FillGrid();
- return;
- }
- #if 0
- m_List1array.ElementAt (iItem).SetAt (8+m_nAdd, dlg.m_sparray .ElementAt (pos2).ElementAt(2));
- m_List1array.ElementAt (iItem).SetAt (9+m_nAdd, dlg.m_sparray .ElementAt (pos2).ElementAt(3));
- m_List1array.ElementAt (iItem).SetAt (10+m_nAdd, dlg.m_sparray .ElementAt (pos2).ElementAt(4));
- #ifdef LKAY_VERSION
- m_List1array.ElementAt (iItem).SetAt (11, dlg.m_sparray .ElementAt (pos2).ElementAt(23));
- m_List1array.ElementAt (iItem).SetAt (12, dlg.m_sparray .ElementAt (pos2).ElementAt(24));
- m_List1array.ElementAt (iItem).SetAt (13, dlg.m_sparray .ElementAt (pos2).ElementAt(5));
- #else
- m_List1array.ElementAt (iItem).SetAt (11+m_nAdd, dlg.m_sparray .ElementAt (pos2).ElementAt(5));
- #endif
- #else
- m_List1array.ElementAt(iItem).SetAt(9 + m_nAdd, dlg.m_sparray.ElementAt(pos2).ElementAt(2));
- m_List1array.ElementAt(iItem).SetAt(10 + m_nAdd, dlg.m_sparray.ElementAt(pos2).ElementAt(3));
- m_List1array.ElementAt(iItem).SetAt(11 + m_nAdd, dlg.m_sparray.ElementAt(pos2).ElementAt(4));
- #ifdef LKAY_VERSION
- m_List1array.ElementAt (iItem).SetAt (12, dlg.m_sparray .ElementAt (pos2).ElementAt(23));
- m_List1array.ElementAt (iItem).SetAt (13, dlg.m_sparray .ElementAt (pos2).ElementAt(24));
- m_List1array.ElementAt (iItem).SetAt (14, dlg.m_sparray .ElementAt (pos2).ElementAt(5));
- #else
- m_List1array.ElementAt(iItem).SetAt(12 + m_nAdd, dlg.m_sparray.ElementAt(pos2).ElementAt(5));
- #endif
- #endif
- iItem++;
- if (iItem >= m_List1array.GetSize())break;
- }
- }
- FillGrid();
- }
- void outsourcing::OnRdblclkList2(NMHDR* pNMHDR, LRESULT* pResult)
- {
- OnBUTmodify2();
- *pResult = 0;
- }
- void outsourcing::OnButton2()
- {
- UpdateData();
- m_filter.TrimLeft();
- m_filter.TrimRight();
- FillGrid(1);
- }
- void outsourcing::OnButton3()
- {
- UpdateData();
- m_filter.TrimLeft();
- m_filter.TrimRight();
- FillGrid(2);
- }
- void outsourcing::OnCustomdrawList(NMHDR* pNMHDR, LRESULT* pResult)
- {
- NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<NMLVCUSTOMDRAW*>(pNMHDR);
- *pResult = 0;
- if (CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage)
- {
- *pResult = CDRF_NOTIFYITEMDRAW;
- }
- else if (CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage)
- {
- COLORREF crText;
- int pos = pLVCD->nmcd.dwItemSpec;
- if (pos % 2)
- pLVCD->clrTextBk = g_gridcol1;
- else
- pLVCD->clrTextBk = g_gridcol2;
- while (m_List1.m_arLabels.ElementAt(pos).ElementAt(0).IsEmpty())
- {
- pos--;
- if (pos < 1)break;
- }
-
- if (atoi(m_List1.m_arLabels.ElementAt(pos).ElementAt(19)))
- crText = RGB(220, 0, 0);
- else
- crText = RGB(20, 133, 20);
- pLVCD->clrText = crText;
- *pResult = CDRF_DODEFAULT;
- }
- }
- void outsourcing::OnBUTmodify2()
- {
- if (IsHasRights2new(13) == 0)return;
- outsourcing2 dlg;
- dlg.DoModal();
- }
- void outsourcing::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
- {
- POSITION pos;
- pos = m_List1.GetFirstSelectedItemPosition();
- if (pos == NULL)
- {
- return;
- }
- int iItem = m_List1.GetNextSelectedItem(pos);
- g_id = m_List1.GetItemText(iItem, 0);
- while (g_id == "")
- {
- iItem--;
- g_id = m_List1.GetItemText(iItem, 0 + m_nAdd);
- }
- *pResult = 0;
- }
- void outsourcing::OnBUTburncd()
- {
- outsourcing3 dlg;
- dlg.DoModal();
- }
- void outsourcing::HidePrice()
- {
- if (IsHasRights2new(31))return;
- for (int i = 0; i < m_List1array.GetSize(); i++)
- {
- #ifdef LKAY_VERSION
- if(!m_List1array.ElementAt (i).ElementAt (16).IsEmpty ())
- m_List1array.ElementAt (i).SetAt (16, "***");
- if(!m_List1array.ElementAt (i).ElementAt (17).IsEmpty ())
- m_List1array.ElementAt (i).SetAt (17, "***");
- #else
- if (!m_List1array.ElementAt(i).ElementAt(14 + m_nAdd).IsEmpty())
- m_List1array.ElementAt(i).SetAt(14 + m_nAdd, "***");
- if (!m_List1array.ElementAt(i).ElementAt(15 + m_nAdd).IsEmpty())
- m_List1array.ElementAt(i).SetAt(15 + m_nAdd, "***");
- #endif
- }
- }
- void outsourcing::OnBUTexport()
- {
- UpdateData();
- m_filter.TrimLeft();
- m_filter.TrimRight();
- FillGrid(3);
- }
- void outsourcing::OnBUTToPhotoPrint()
- {
- UpdateData();
- m_filter.TrimLeft();
- m_filter.TrimRight();
- FillGrid(4);
- }
- void outsourcing::GetData()
- {
- if (g_bAllBranch == 0)
- {
- if (g_bShowOK == 0)
- {
- #ifdef LKAY_VERSION
- CString filter="status3='未取' and (dindantype<>'意向客户' or dindantype is null)";
- #else
- CString filter = "status3='未取'";
- #endif
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 33;
- g_sendhead.tabcount = 1;
- g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return;
- }
- else
- {
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 33;
- 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; i < g_brancharray.GetSize() - 1; i++)
- {
- if (i != -1)
- {
- branch = g_brancharray.ElementAt(i).ElementAt(0);
- g_branchip = g_brancharray.ElementAt(i).ElementAt(1);
- g_pMainWnd->OnDisconnect();
- 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] = 33;
- g_sendhead.tabcount = 1;
- g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)continue;
- }
- else
- {
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 33;
- g_sendhead.tabcount = 1;
- g_pMainWnd->ProcessChatMessageRequest2(1); if (g_bSendOK == 0)continue;
- }
- CArray<CStringArray, CStringArray>List1array;
- DataToArray(&List1array);
- int size = m_List1array.GetSize();
- for (int j = 0; j < List1array.GetSize(); j++)
- {
- size++;
- m_List1array.SetSize(size, 1);
- size--;
- m_List1array.ElementAt(size).Copy(List1array.ElementAt(j));
- m_List1array.ElementAt(size).InsertAt(0, branch);
- size++;
- }
- }
- g_pMainWnd->OnDisconnect();
- g_bBranchModify = 0;
- g_branchip = g_branchname = "";
- }
- HidePrice();
- }
- void outsourcing::OnBUTburncd2()
- {
- outsourcing4 dlg;
- dlg.DoModal();
- }
|