// outsourcingDlg.cpp : implementation file // #include "stdafx.h" #include "ylgl.h" #include "outsourcingDlg.h" #include "ShowMsg2.h" #include "SelProvider.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // outsourcingDlg outsourcingDlg::outsourcingDlg(CWnd* pParent /*=NULL*/) : CDialog(outsourcingDlg::IDD) { //{{AFX_DATA_INIT(outsourcingDlg)IDC_COMBOid m_name1 = _T(""); m_name2 = _T(""); m_id = _T(""); m_money1 = _T(""); m_money2 = _T(""); m_money3 = _T(""); m_bGrowthTX=0; //}}AFX_DATA_INIT } void outsourcingDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(outsourcingDlg) DDX_Control(pDX, IDC_LIST1, m_List1); DDX_Text(pDX, IDC_EDITname1, m_name1); DDX_Text(pDX, IDC_EDITname2, m_name2); DDX_Text(pDX, IDC_EDITid2, m_id); DDX_Text(pDX, IDC_EDITmoney1, m_money1); DDX_Text(pDX, IDC_EDITmoney2, m_money2); DDX_Text(pDX, IDC_EDITmoney3, m_money3); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(outsourcingDlg, CDialog) //{{AFX_MSG_MAP(outsourcingDlg) ON_BN_CLICKED(IDC_BUTclose, OnBUTclose) ON_BN_CLICKED(IDC_BUTTON1, OnButton1) ON_BN_CLICKED(IDC_BUTTON2, OnButton2) ON_WM_TIMER() ON_BN_CLICKED(IDC_BUTTON3, OnButton3) ON_BN_CLICKED(IDC_BUTTON4, OnButton4) ON_BN_CLICKED(IDC_BUTTON5, OnButton5) ON_WM_DESTROY() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // outsourcingDlg diagnostics ///////////////////////////////////////////////////////////////////////////// // outsourcingDlg message handlers BOOL outsourcingDlg::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class if(0)//pMsg->message==WM_LBUTTONDBLCLK) { {//list1 CPoint pt; CRect rc,rc2; ::GetCursorPos (&pt); m_List1.GetWindowRect (rc2); if(rc2.PtInRect (pt)) return 1; } } return CDialog::PreTranslateMessage(pMsg); } void outsourcingDlg::OnBUTclose() { // TODO: Add your control notification handler code here CDialog::OnCancel (); } void outsourcingDlg::GetData() { // TODO: Add your control notification handler code here CArrayList1array; if(g_bAllBranch==0) { #ifdef CHILD_VERSION CString filter="id='"+m_id+"' and name<>'入册' and name<>'入底';id='"+m_id+"';;"; #else CString filter="id='"+m_id+"' and kind<>'2' and name<>'入册' and name<>'入底';id='"+m_id+"';;"; #endif g_sendhead.code[0]=56; g_sendhead.code[1]=11; g_sendhead.code[2]=9;//供应商信息 g_sendhead.code[3]=8; g_sendhead.tabcount=4; g_sendhead.bsql=0; g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return; DataToArray(&m_sparray,&List1array,&g_List1array,&m_List2array); } else { g_pMainWnd->OnDisconnect(); g_branchip=GetIP(m_branch); g_pMainWnd->OnDisconnect(); g_branchname=m_branch; g_bBranchModify=1; #ifdef CHILD_VERSION CString filter="id='"+m_id+"' and name<>'入册' and name<>'入底';id='"+m_id+"';;"; #else CString filter="id='"+m_id+"' and kind<>'2' and name<>'入册' and name<>'入底';id='"+m_id+"';;"; #endif g_sendhead.code[0]=56; g_sendhead.code[1]=11; g_sendhead.code[2]=9;//供应商信息 g_sendhead.code[3]=8; g_sendhead.tabcount=4; g_sendhead.bsql=0; g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return; DataToArray(&m_sparray,&List1array,&g_List1array,&m_List2array); } if("成长套系"==List1array.ElementAt (0).ElementAt (52)) m_bGrowthTX=1; m_phone1 = List1array.ElementAt (0).ElementAt (61); m_phone2 = List1array.ElementAt (0).ElementAt (62); oldstatus= List1array.ElementAt (0).ElementAt (33); m_List1.DeleteAllItems (); int listpos[3]={0}; CComboBoxListCtrl *pList[1]={&m_List1}; int pos=0; oldstatus2="OK"; for(int i=0; iInsertItem(listpos[pos], m_sparray.ElementAt (i).ElementAt (0)); pList[pos]->SetItemText(listpos[pos], 1, m_sparray.ElementAt (i).ElementAt (1)); #ifdef LKAY_VERSION pList[pos]->SetItemText(listpos[pos], 2, m_sparray.ElementAt (i).ElementAt (29)); pList[pos]->SetItemText(listpos[pos], 3, m_sparray.ElementAt (i).ElementAt (30)); #else pList[pos]->SetItemText(listpos[pos], 2, m_sparray.ElementAt (i).ElementAt (18)); pList[pos]->SetItemText(listpos[pos], 3, m_sparray.ElementAt (i).ElementAt (19)); #endif pList[pos]->SetItemText(listpos[pos], 4, m_sparray.ElementAt (i).ElementAt (2)); pList[pos]->SetItemText(listpos[pos], 5, m_sparray.ElementAt (i).ElementAt (9)+"/"+m_sparray.ElementAt (i).ElementAt (10)); pList[pos]->SetItemText(listpos[pos], 6, m_sparray.ElementAt (i).ElementAt (3)); pList[pos]->SetItemText(listpos[pos], 7, m_sparray.ElementAt (i).ElementAt (11)+"/"+m_sparray.ElementAt (i).ElementAt (12)); pList[pos]->SetItemText(listpos[pos], 8, m_sparray.ElementAt (i).ElementAt (4)); pList[pos]->SetItemText(listpos[pos], 9, m_sparray.ElementAt (i).ElementAt (13)+"/"+m_sparray.ElementAt (i).ElementAt (14)); #ifdef LKAY_VERSION pList[pos]->SetItemText(listpos[pos], 10, m_sparray.ElementAt (i).ElementAt (23)); pList[pos]->SetItemText(listpos[pos], 11, m_sparray.ElementAt (i).ElementAt (25)+"/"+m_sparray.ElementAt (i).ElementAt (26)); pList[pos]->SetItemText(listpos[pos], 12, m_sparray.ElementAt (i).ElementAt (24)); pList[pos]->SetItemText(listpos[pos], 13, m_sparray.ElementAt (i).ElementAt (27)+"/"+m_sparray.ElementAt (i).ElementAt (28)); pList[pos]->SetItemText(listpos[pos], 14, m_sparray.ElementAt (i).ElementAt (5)); pList[pos]->SetItemText(listpos[pos], 15, m_sparray.ElementAt (i).ElementAt (15)+"/"+m_sparray.ElementAt (i).ElementAt (16)); #else pList[pos]->SetItemText(listpos[pos], 10, m_sparray.ElementAt (i).ElementAt (5)); pList[pos]->SetItemText(listpos[pos], 11, m_sparray.ElementAt (i).ElementAt (15)+"/"+m_sparray.ElementAt (i).ElementAt (16)); #endif if(m_sparray.ElementAt (i).ElementAt (4)!="OK") oldstatus2="未完成"; listpos[pos]++; } if(List1array.GetSize ()) { CString m_taoxijiage = List1array.ElementAt (0).ElementAt (8); CString m_payed4 = List1array.ElementAt (0).ElementAt (19); CString m_payed5 = List1array.ElementAt (0).ElementAt (20); m_money1 = List1array.ElementAt (0).ElementAt (1); m_money2.Format ("%f", atof(m_payed5)+atof(m_money1)); m_money1.Format ("%f", atof(m_taoxijiage)+atof(m_payed4)); m_money3.Format ("%f", atof(m_money1)-atof(m_money2)); ConvertToPrice(m_money1); ConvertToPrice(m_money2); ConvertToPrice(m_money3); UpdateData(false); } SetTimer(1, 500, NULL); } extern BOOL CALLBACK EnumChildProc2(HWND hwnd,LPARAM lParam); extern float m_WidthScale2; extern float m_HeightScale2; BOOL outsourcingDlg::OnInitDialog() { CDialog::OnInitDialog(); #ifdef CHILD_VERSION GetDlgItem(IDC_STATIC1)->SetWindowText("家长姓名:"); GetDlgItem(IDC_STATIC2)->SetWindowText("宝宝姓名:"); #endif // TODO: Add extra initialization here // 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,0,g_rc.top,g_rc.left+g_rc.Width(),g_rc.Height(),TRUE); m_WidthScale2 = (float)(g_rc.left+g_rc.Width())/(float)rc2.Width(); // new/Old m_HeightScale2 = (float)g_rc.Height()/(float)rc2.Height(); EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc2,0); m_List1.m_sparray=&m_sparray; m_List1.InitStyle(); #ifdef LKAY_VERSION int idarray[]={IDC_BUTTON3,IDC_BUTTON1,IDC_BUTTON5,IDC_BUTTON4,IDC_BUTTON2,IDOK,IDC_BUTclose}; int idcount=7; GetDlgItem(IDC_BUTTON4)->ShowWindow(SW_SHOW); GetDlgItem(IDC_BUTTON5)->ShowWindow(SW_SHOW); #else int idarray[]={IDC_BUTTON3,IDC_BUTTON1,IDC_BUTTON2,IDOK,IDC_BUTclose}; int idcount=5; #endif 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); } #ifdef LKAY_VERSION m_List1.InsertColumn(0,_T("商品名称"),LVCFMT_LEFT,160); m_List1.InsertColumn(1,_T("数量"),LVCFMT_LEFT,50); // m_List1.InsertColumn(2,_T("加急"),LVCFMT_LEFT,50); // m_List1.InsertColumn(3,_T("取件日期"),LVCFMT_LEFT,100); m_List1.InsertColumn(2,_T("P数"),LVCFMT_LEFT,50); m_List1.InsertColumn(3,_T("张数"),LVCFMT_LEFT,100); m_List1.InsertColumn(4,_T("发出"),LVCFMT_LEFT,100); m_List1.InsertColumn(5,_T("发出日期"),LVCFMT_LEFT,140); m_List1.InsertColumn(6,_T("返工"),LVCFMT_LEFT,50); m_List1.InsertColumn(7,_T("返工日期"),LVCFMT_LEFT,140); m_List1.InsertColumn(8,_T("完成"),LVCFMT_LEFT,60); m_List1.InsertColumn(9,_T("完成日期"),LVCFMT_LEFT,140); m_List1.InsertColumn(10,_T("组件"),LVCFMT_LEFT,60); m_List1.InsertColumn(11,_T("组件日期"),LVCFMT_LEFT,140); m_List1.InsertColumn(12,_T("转走"),LVCFMT_LEFT,60); m_List1.InsertColumn(13,_T("转走日期"),LVCFMT_LEFT,140); m_List1.InsertColumn(14,_T("取走"),LVCFMT_LEFT,50); m_List1.InsertColumn(15,_T("取走日期"),LVCFMT_LEFT,140); #else m_List1.InsertColumn(0,_T("商品名称"),LVCFMT_LEFT,160); m_List1.InsertColumn(1,_T("数量"),LVCFMT_LEFT,50); m_List1.InsertColumn(2,_T("加急"),LVCFMT_LEFT,50); m_List1.InsertColumn(3,_T("取件日期"),LVCFMT_LEFT,100); m_List1.InsertColumn(4,_T("发出"),LVCFMT_LEFT,100); m_List1.InsertColumn(5,_T("发出日期"),LVCFMT_LEFT,140); m_List1.InsertColumn(6,_T("返工"),LVCFMT_LEFT,50); m_List1.InsertColumn(7,_T("返工日期"),LVCFMT_LEFT,140); m_List1.InsertColumn(8,_T("完成"),LVCFMT_LEFT,60); m_List1.InsertColumn(9,_T("完成日期"),LVCFMT_LEFT,140); m_List1.InsertColumn(10,_T("取走"),LVCFMT_LEFT,50); m_List1.InsertColumn(11,_T("取走日期"),LVCFMT_LEFT,140); #endif GetData(); GetDlgItem(IDOK)->EnableWindow(IsHasRights2new(13)); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void outsourcingDlg::OnOK() { // TODO: Add extra validation here if(IsHasRights2new(13)==0)return; CString sql,str,m_status3,m_status4; m_status3="OK"; m_status4="OK"; for(int i=0; i0) if(AfxMessageBox("警告:此客人余款未清, 请向财务核对, 继续吗?", MB_YESNO|MB_ICONSTOP)!=IDYES)return; if(atof(m_money3)<0) if(AfxMessageBox("警告:此客人账目不清, 请向财务核对, 继续吗?", MB_YESNO|MB_ICONSTOP)!=IDYES)return; if(m_sparray.GetSize ()==0) { return; } if(1)//m_status3=="OK" && m_bGrowthTX==0) {//自动生成出库记录 int size=m_sparray.GetSize (); m_sparray.SetSize(size*2); for(int i=0; iProcessChatMessageRequest2(pData2, length); g_nSendCode=0; delete []pData2; if(g_bSendOK==0)return; sql=""; if(m_status3=="OK" && m_bGrowthTX==0) { sql= "update dindan set [status3]='"+m_status3+"',[time5]='"+g_date+"' where id='"+m_id+"'"; //////////////////////// CString sql2; BOOL msgcheck = atoi(g_cominfoarray.ElementAt(0).ElementAt(104)); CString msgcontent = g_cominfoarray.ElementAt(0).ElementAt(108); if(oldstatus=="OK")msgcheck=0; #ifdef CHILD_VERSION if(msgcheck ) { CString m_content3 = msgcontent; CString str,timestamp; timestamp="msgtimestamp"; { CString name; if(!m_name1.IsEmpty ()) name=m_name1+","; name+=m_name2; name.TrimRight (","); if(name.IsEmpty ()==0 && CheckPhoneType(m_phone1)!=-1 && CheckBadWords(name,0) && CheckBadWords2(name,0) ) { str=name+m_content3; str.Replace ("xxx小朋友", ""); int count=GetLengthEx(str)/MSG_LENGTH; if(GetLengthEx(str)%MSG_LENGTH) count++; CString scount; scount.Format ("%d", count); sql2="***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('"+m_phone1+"','"+str+"','"+timestamp+"','"+scount+"','0','0','0','系统自动发送')"; sql+=sql2; } } } #else if(msgcheck) { CString m_content3 = msgcontent; CString str,timestamp; timestamp="msgtimestamp"; int pos=m_content3.Find("xxx先生/女士"); if(pos!=-1) { if(m_name1.IsEmpty ()==0 && CheckPhoneType(m_phone1)!=-1 && CheckBadWords(m_name1,0)&& CheckBadWords2(m_name1,0) ) { str=m_content3; str.Replace ("xxx先生/女士", m_name1+"先生"); int count=GetLengthEx(str)/MSG_LENGTH; if(GetLengthEx(str)%MSG_LENGTH) count++; CString scount; scount.Format ("%d", count); sql2="***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('"+m_phone1+"','"+str+"','"+timestamp+"','"+scount+"','0','0','0','系统自动发送')"; sql+=sql2; } if(m_name2.IsEmpty ()==0 && CheckPhoneType(m_phone2)!=-1 && CheckBadWords(m_name2,0) && CheckBadWords2(m_name2,0) ) { str=m_content3; str.Replace ("xxx先生/女士", m_name2+"女士"); int count=GetLengthEx(str)/MSG_LENGTH; if(GetLengthEx(str)%MSG_LENGTH) count++; CString scount; scount.Format ("%d", count); CTime tm=CTime::GetCurrentTime (); tm+=CTimeSpan(0,0,0,3); timestamp=tm.Format ("%Y%m%d%H%M%S"); timestamp="msgtimexxstamp"; sql2="***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('"+m_phone2+"','"+str+"','"+timestamp+"','"+scount+"','0','0','0','系统自动发送')"; sql+=sql2; } } } #endif ///////////////////////// // g_sendhead.bsql=1; // g_pMainWnd->ProcessChatMessageRequest2(sql); // if(g_bSendOK==0)return; } BOOL msgcheck = atoi(g_cominfoarray.ElementAt(0).ElementAt(128));//通知取件短信 CString msgcontent = g_cominfoarray.ElementAt(0).ElementAt(129); if(oldstatus2=="OK")msgcheck=0; if(m_status4!="OK")msgcheck=0; if(msgcheck) { CString sql2; #ifdef CHILD_VERSION if(msgcheck ) { CString m_content3 = msgcontent; CString str,timestamp; timestamp="msgtimestamp"; { CString name; if(!m_name1.IsEmpty ()) name=m_name1+","; name+=m_name2; name.TrimRight (","); if(name.IsEmpty ()==0 && CheckPhoneType(m_phone1)!=-1 && CheckBadWords(name,0) && CheckBadWords2(name,0) ) { str=name+m_content3; str.Replace ("xxx小朋友", ""); int count=GetLengthEx(str)/MSG_LENGTH; if(GetLengthEx(str)%MSG_LENGTH) count++; CString scount; scount.Format ("%d", count); sql2="***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('"+m_phone1+"','"+str+"','"+timestamp+"','"+scount+"','0','0','0','系统自动发送')"; sql+=sql2; } } } #else if(msgcheck) { CString m_content3 = msgcontent; CString str,timestamp; timestamp="msgtimestamp"; int pos=m_content3.Find("xxx先生/女士"); if(pos!=-1) { if(m_name1.IsEmpty ()==0 && CheckPhoneType(m_phone1)!=-1 && CheckBadWords(m_name1,0)&& CheckBadWords2(m_name1,0) ) { str=m_content3; str.Replace ("xxx先生/女士", m_name1+"先生"); int count=GetLengthEx(str)/MSG_LENGTH; if(GetLengthEx(str)%MSG_LENGTH) count++; CString scount; scount.Format ("%d", count); sql2="***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('"+m_phone1+"','"+str+"','"+timestamp+"','"+scount+"','0','0','0','系统自动发送')"; sql+=sql2; } if(m_name2.IsEmpty ()==0 && CheckPhoneType(m_phone2)!=-1 && CheckBadWords(m_name2,0) && CheckBadWords2(m_name2,0) ) { str=m_content3; str.Replace ("xxx先生/女士", m_name2+"女士"); int count=GetLengthEx(str)/MSG_LENGTH; if(GetLengthEx(str)%MSG_LENGTH) count++; CString scount; scount.Format ("%d", count); CTime tm=CTime::GetCurrentTime (); tm+=CTimeSpan(0,0,0,3); timestamp=tm.Format ("%Y%m%d%H%M%S"); timestamp="msgtimexxstamp"; sql2="***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('"+m_phone2+"','"+str+"','"+timestamp+"','"+scount+"','0','0','0','系统自动发送')"; sql+=sql2; } } } #endif //////////////////////// } if(sql!="") { g_sendhead.bsql=1; g_pMainWnd->ProcessChatMessageRequest2(sql); if(g_bSendOK==0)return; } AfxMessageBox("保存成功!", MB_ICONINFORMATION); CDialog::OnOK(); } void outsourcingDlg::OnButton1() { // TODO: Add your control notification handler code here for(int i=0; i0) { ShowMsg2 dlg; dlg.DoModal (); // if(AfxMessageBox("警告:此客人余款未清, 请向财务核对, 继续吗?", MB_YESNO|MB_ICONSTOP)!=IDYES) // CDialog::OnCancel (); } CDialog::OnTimer(nIDEvent); } void outsourcingDlg::OnButton3() { // TODO: Add your control notification handler code here POSITION pos; pos=m_List1.GetFirstSelectedItemPosition(); if(pos==NULL) { AfxMessageBox("请先选中您要发出制作的产品!", MB_ICONINFORMATION); return; } SelProvider dlg; if(dlg.DoModal ()!=IDOK)return; int iItem; while (pos) { iItem = m_List1.GetNextSelectedItem(pos); m_List1.SetItemText (iItem, 4, dlg.m_provider); m_List1.SetItemText (iItem, 5, g_date+"/"+g_user.name); } } void outsourcingDlg::OnButton4() { // TODO: Add your control notification handler code here for(int i=0; iOnDisconnect(); g_bBranchModify=0;g_branchip=g_branchname=""; } }