outsourcingDlg.cpp 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691
  1. // outsourcingDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "outsourcingDlg.h"
  6. #include "ShowMsg2.h"
  7. #include "SelProvider.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. /////////////////////////////////////////////////////////////////////////////
  14. // outsourcingDlg
  15. outsourcingDlg::outsourcingDlg(CWnd* pParent /*=NULL*/)
  16. : CDialog(outsourcingDlg::IDD)
  17. {
  18. //{{AFX_DATA_INIT(outsourcingDlg)IDC_COMBOid
  19. m_name1 = _T("");
  20. m_name2 = _T("");
  21. m_id = _T("");
  22. m_money1 = _T("");
  23. m_money2 = _T("");
  24. m_money3 = _T("");
  25. m_bGrowthTX=0;
  26. //}}AFX_DATA_INIT
  27. }
  28. void outsourcingDlg::DoDataExchange(CDataExchange* pDX)
  29. {
  30. CDialog::DoDataExchange(pDX);
  31. //{{AFX_DATA_MAP(outsourcingDlg)
  32. DDX_Control(pDX, IDC_LIST1, m_List1);
  33. DDX_Text(pDX, IDC_EDITname1, m_name1);
  34. DDX_Text(pDX, IDC_EDITname2, m_name2);
  35. DDX_Text(pDX, IDC_EDITid2, m_id);
  36. DDX_Text(pDX, IDC_EDITmoney1, m_money1);
  37. DDX_Text(pDX, IDC_EDITmoney2, m_money2);
  38. DDX_Text(pDX, IDC_EDITmoney3, m_money3);
  39. //}}AFX_DATA_MAP
  40. }
  41. BEGIN_MESSAGE_MAP(outsourcingDlg, CDialog)
  42. //{{AFX_MSG_MAP(outsourcingDlg)
  43. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  44. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  45. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  46. ON_WM_TIMER()
  47. ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
  48. ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
  49. ON_BN_CLICKED(IDC_BUTTON5, OnButton5)
  50. ON_WM_DESTROY()
  51. //}}AFX_MSG_MAP
  52. END_MESSAGE_MAP()
  53. /////////////////////////////////////////////////////////////////////////////
  54. // outsourcingDlg diagnostics
  55. /////////////////////////////////////////////////////////////////////////////
  56. // outsourcingDlg message handlers
  57. BOOL outsourcingDlg::PreTranslateMessage(MSG* pMsg)
  58. {
  59. // TODO: Add your specialized code here and/or call the base class
  60. if(0)//pMsg->message==WM_LBUTTONDBLCLK)
  61. {
  62. {//list1
  63. CPoint pt;
  64. CRect rc,rc2;
  65. ::GetCursorPos (&pt);
  66. m_List1.GetWindowRect (rc2);
  67. if(rc2.PtInRect (pt)) return 1;
  68. }
  69. }
  70. return CDialog::PreTranslateMessage(pMsg);
  71. }
  72. void outsourcingDlg::OnBUTclose()
  73. {
  74. // TODO: Add your control notification handler code here
  75. CDialog::OnCancel ();
  76. }
  77. void outsourcingDlg::GetData()
  78. {
  79. // TODO: Add your control notification handler code here
  80. CArray<CStringArray, CStringArray>List1array;
  81. if(g_bAllBranch==0)
  82. {
  83. #ifdef CHILD_VERSION
  84. CString filter="id='"+m_id+"' and name<>'入册' and name<>'入底';id='"+m_id+"';;";
  85. #else
  86. CString filter="id='"+m_id+"' and kind<>'2' and name<>'入册' and name<>'入底';id='"+m_id+"';;";
  87. #endif
  88. g_sendhead.code[0]=56;
  89. g_sendhead.code[1]=11;
  90. g_sendhead.code[2]=9;//供应商信息
  91. g_sendhead.code[3]=8;
  92. g_sendhead.tabcount=4;
  93. g_sendhead.bsql=0;
  94. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  95. DataToArray(&m_sparray,&List1array,&g_List1array,&m_List2array);
  96. }
  97. else
  98. {
  99. g_pMainWnd->OnDisconnect();
  100. g_branchip=GetIP(m_branch);
  101. g_pMainWnd->OnDisconnect();
  102. g_branchname=m_branch;
  103. g_bBranchModify=1;
  104. #ifdef CHILD_VERSION
  105. CString filter="id='"+m_id+"' and name<>'入册' and name<>'入底';id='"+m_id+"';;";
  106. #else
  107. CString filter="id='"+m_id+"' and kind<>'2' and name<>'入册' and name<>'入底';id='"+m_id+"';;";
  108. #endif
  109. g_sendhead.code[0]=56;
  110. g_sendhead.code[1]=11;
  111. g_sendhead.code[2]=9;//供应商信息
  112. g_sendhead.code[3]=8;
  113. g_sendhead.tabcount=4;
  114. g_sendhead.bsql=0;
  115. g_pMainWnd->ProcessChatMessageRequest2(filter);if(g_bSendOK==0)return;
  116. DataToArray(&m_sparray,&List1array,&g_List1array,&m_List2array);
  117. }
  118. if("成长套系"==List1array.ElementAt (0).ElementAt (52))
  119. m_bGrowthTX=1;
  120. m_phone1 = List1array.ElementAt (0).ElementAt (61);
  121. m_phone2 = List1array.ElementAt (0).ElementAt (62);
  122. oldstatus= List1array.ElementAt (0).ElementAt (33);
  123. m_List1.DeleteAllItems ();
  124. int listpos[3]={0};
  125. CComboBoxListCtrl *pList[1]={&m_List1};
  126. int pos=0;
  127. oldstatus2="OK";
  128. for(int i=0; i<m_sparray.GetSize (); i++)
  129. {
  130. pList[pos]->InsertItem(listpos[pos], m_sparray.ElementAt (i).ElementAt (0));
  131. pList[pos]->SetItemText(listpos[pos], 1, m_sparray.ElementAt (i).ElementAt (1));
  132. #ifdef LKAY_VERSION
  133. pList[pos]->SetItemText(listpos[pos], 2, m_sparray.ElementAt (i).ElementAt (29));
  134. pList[pos]->SetItemText(listpos[pos], 3, m_sparray.ElementAt (i).ElementAt (30));
  135. #else
  136. pList[pos]->SetItemText(listpos[pos], 2, m_sparray.ElementAt (i).ElementAt (18));
  137. pList[pos]->SetItemText(listpos[pos], 3, m_sparray.ElementAt (i).ElementAt (19));
  138. #endif
  139. pList[pos]->SetItemText(listpos[pos], 4, m_sparray.ElementAt (i).ElementAt (2));
  140. pList[pos]->SetItemText(listpos[pos], 5, m_sparray.ElementAt (i).ElementAt (9)+"/"+m_sparray.ElementAt (i).ElementAt (10));
  141. pList[pos]->SetItemText(listpos[pos], 6, m_sparray.ElementAt (i).ElementAt (3));
  142. pList[pos]->SetItemText(listpos[pos], 7, m_sparray.ElementAt (i).ElementAt (11)+"/"+m_sparray.ElementAt (i).ElementAt (12));
  143. pList[pos]->SetItemText(listpos[pos], 8, m_sparray.ElementAt (i).ElementAt (4));
  144. pList[pos]->SetItemText(listpos[pos], 9, m_sparray.ElementAt (i).ElementAt (13)+"/"+m_sparray.ElementAt (i).ElementAt (14));
  145. #ifdef LKAY_VERSION
  146. pList[pos]->SetItemText(listpos[pos], 10, m_sparray.ElementAt (i).ElementAt (23));
  147. pList[pos]->SetItemText(listpos[pos], 11, m_sparray.ElementAt (i).ElementAt (25)+"/"+m_sparray.ElementAt (i).ElementAt (26));
  148. pList[pos]->SetItemText(listpos[pos], 12, m_sparray.ElementAt (i).ElementAt (24));
  149. pList[pos]->SetItemText(listpos[pos], 13, m_sparray.ElementAt (i).ElementAt (27)+"/"+m_sparray.ElementAt (i).ElementAt (28));
  150. pList[pos]->SetItemText(listpos[pos], 14, m_sparray.ElementAt (i).ElementAt (5));
  151. pList[pos]->SetItemText(listpos[pos], 15, m_sparray.ElementAt (i).ElementAt (15)+"/"+m_sparray.ElementAt (i).ElementAt (16));
  152. #else
  153. pList[pos]->SetItemText(listpos[pos], 10, m_sparray.ElementAt (i).ElementAt (5));
  154. pList[pos]->SetItemText(listpos[pos], 11, m_sparray.ElementAt (i).ElementAt (15)+"/"+m_sparray.ElementAt (i).ElementAt (16));
  155. #endif
  156. if(m_sparray.ElementAt (i).ElementAt (4)!="OK")
  157. oldstatus2="未完成";
  158. listpos[pos]++;
  159. }
  160. if(List1array.GetSize ())
  161. {
  162. CString m_taoxijiage = List1array.ElementAt (0).ElementAt (8);
  163. CString m_payed4 = List1array.ElementAt (0).ElementAt (19);
  164. CString m_payed5 = List1array.ElementAt (0).ElementAt (20);
  165. m_money1 = List1array.ElementAt (0).ElementAt (1);
  166. m_money2.Format ("%f", atof(m_payed5)+atof(m_money1));
  167. m_money1.Format ("%f", atof(m_taoxijiage)+atof(m_payed4));
  168. m_money3.Format ("%f", atof(m_money1)-atof(m_money2));
  169. ConvertToPrice(m_money1);
  170. ConvertToPrice(m_money2);
  171. ConvertToPrice(m_money3);
  172. UpdateData(false);
  173. }
  174. SetTimer(1, 500, NULL);
  175. }
  176. extern BOOL CALLBACK EnumChildProc2(HWND hwnd,LPARAM lParam);
  177. extern float m_WidthScale2;
  178. extern float m_HeightScale2;
  179. BOOL outsourcingDlg::OnInitDialog()
  180. {
  181. CDialog::OnInitDialog();
  182. #ifdef CHILD_VERSION
  183. GetDlgItem(IDC_STATIC1)->SetWindowText("家长姓名:");
  184. GetDlgItem(IDC_STATIC2)->SetWindowText("宝宝姓名:");
  185. #endif
  186. // TODO: Add extra initialization here
  187. // Here we create the outbar control using the splitter as its parent
  188. // and setting its id to the first pane.
  189. CRect rc2;
  190. GetWindowRect(rc2);
  191. ::MoveWindow(m_hWnd,0,g_rc.top,g_rc.left+g_rc.Width(),g_rc.Height(),TRUE);
  192. m_WidthScale2 = (float)(g_rc.left+g_rc.Width())/(float)rc2.Width(); // new/Old
  193. m_HeightScale2 = (float)g_rc.Height()/(float)rc2.Height();
  194. EnumChildWindows(m_hWnd,(WNDENUMPROC)EnumChildProc2,0);
  195. m_List1.m_sparray=&m_sparray;
  196. m_List1.InitStyle();
  197. #ifdef LKAY_VERSION
  198. int idarray[]={IDC_BUTTON3,IDC_BUTTON1,IDC_BUTTON5,IDC_BUTTON4,IDC_BUTTON2,IDOK,IDC_BUTclose};
  199. int idcount=7;
  200. GetDlgItem(IDC_BUTTON4)->ShowWindow(SW_SHOW);
  201. GetDlgItem(IDC_BUTTON5)->ShowWindow(SW_SHOW);
  202. #else
  203. int idarray[]={IDC_BUTTON3,IDC_BUTTON1,IDC_BUTTON2,IDOK,IDC_BUTclose};
  204. int idcount=5;
  205. #endif
  206. int btnwid;
  207. CRect prerc;
  208. for(int a=idcount-2; a>=0; a--)
  209. {
  210. GetDlgItem(idarray[a+1])->GetWindowRect (prerc);
  211. ScreenToClient(prerc);
  212. GetDlgItem(idarray[a])->GetWindowRect (rc2);
  213. ScreenToClient(rc2);
  214. btnwid=rc2.Width ();
  215. rc2.right =prerc.left ;
  216. rc2.left =rc2.right -btnwid;
  217. GetDlgItem(idarray[a])->MoveWindow (rc2);
  218. }
  219. #ifdef LKAY_VERSION
  220. m_List1.InsertColumn(0,_T("商品名称"),LVCFMT_LEFT,160);
  221. m_List1.InsertColumn(1,_T("数量"),LVCFMT_LEFT,50);
  222. // m_List1.InsertColumn(2,_T("加急"),LVCFMT_LEFT,50);
  223. // m_List1.InsertColumn(3,_T("取件日期"),LVCFMT_LEFT,100);
  224. m_List1.InsertColumn(2,_T("P数"),LVCFMT_LEFT,50);
  225. m_List1.InsertColumn(3,_T("张数"),LVCFMT_LEFT,100);
  226. m_List1.InsertColumn(4,_T("发出"),LVCFMT_LEFT,100);
  227. m_List1.InsertColumn(5,_T("发出日期"),LVCFMT_LEFT,140);
  228. m_List1.InsertColumn(6,_T("返工"),LVCFMT_LEFT,50);
  229. m_List1.InsertColumn(7,_T("返工日期"),LVCFMT_LEFT,140);
  230. m_List1.InsertColumn(8,_T("完成"),LVCFMT_LEFT,60);
  231. m_List1.InsertColumn(9,_T("完成日期"),LVCFMT_LEFT,140);
  232. m_List1.InsertColumn(10,_T("组件"),LVCFMT_LEFT,60);
  233. m_List1.InsertColumn(11,_T("组件日期"),LVCFMT_LEFT,140);
  234. m_List1.InsertColumn(12,_T("转走"),LVCFMT_LEFT,60);
  235. m_List1.InsertColumn(13,_T("转走日期"),LVCFMT_LEFT,140);
  236. m_List1.InsertColumn(14,_T("取走"),LVCFMT_LEFT,50);
  237. m_List1.InsertColumn(15,_T("取走日期"),LVCFMT_LEFT,140);
  238. #else
  239. m_List1.InsertColumn(0,_T("商品名称"),LVCFMT_LEFT,160);
  240. m_List1.InsertColumn(1,_T("数量"),LVCFMT_LEFT,50);
  241. m_List1.InsertColumn(2,_T("加急"),LVCFMT_LEFT,50);
  242. m_List1.InsertColumn(3,_T("取件日期"),LVCFMT_LEFT,100);
  243. m_List1.InsertColumn(4,_T("发出"),LVCFMT_LEFT,100);
  244. m_List1.InsertColumn(5,_T("发出日期"),LVCFMT_LEFT,140);
  245. m_List1.InsertColumn(6,_T("返工"),LVCFMT_LEFT,50);
  246. m_List1.InsertColumn(7,_T("返工日期"),LVCFMT_LEFT,140);
  247. m_List1.InsertColumn(8,_T("完成"),LVCFMT_LEFT,60);
  248. m_List1.InsertColumn(9,_T("完成日期"),LVCFMT_LEFT,140);
  249. m_List1.InsertColumn(10,_T("取走"),LVCFMT_LEFT,50);
  250. m_List1.InsertColumn(11,_T("取走日期"),LVCFMT_LEFT,140);
  251. #endif
  252. GetData();
  253. GetDlgItem(IDOK)->EnableWindow(IsHasRights2new(13));
  254. return TRUE; // return TRUE unless you set the focus to a control
  255. // EXCEPTION: OCX Property Pages should return FALSE
  256. }
  257. void outsourcingDlg::OnOK()
  258. {
  259. // TODO: Add extra validation here
  260. if(IsHasRights2new(13)==0)return;
  261. CString sql,str,m_status3,m_status4;
  262. m_status3="OK";
  263. m_status4="OK";
  264. for(int i=0; i<m_List1.GetItemCount (); i++)
  265. {
  266. m_sparray.ElementAt (i).SetAt (2, m_List1.GetItemText (i, 4) );
  267. m_sparray.ElementAt (i).SetAt (3, m_List1.GetItemText (i, 6) );
  268. m_sparray.ElementAt (i).SetAt (4, m_List1.GetItemText (i, 8) );
  269. #ifdef LKAY_VERSION
  270. m_sparray.ElementAt (i).SetAt (5, m_List1.GetItemText (i, 14) );
  271. #else
  272. m_sparray.ElementAt (i).SetAt (5, m_List1.GetItemText (i, 10) );
  273. #endif
  274. str=m_List1.GetItemText (i, 5);
  275. m_sparray.ElementAt (i).SetAt (9, str.Left (str.Find ('/')) );
  276. m_sparray.ElementAt (i).SetAt (10, str.Right (str.GetLength ()-str.Find ('/')-1 ) );
  277. str=m_List1.GetItemText (i, 7);
  278. m_sparray.ElementAt (i).SetAt (11, str.Left (str.Find ('/')) );
  279. m_sparray.ElementAt (i).SetAt (12, str.Right (str.GetLength ()-str.Find ('/')-1 ) );
  280. str=m_List1.GetItemText (i, 9);
  281. m_sparray.ElementAt (i).SetAt (13, str.Left (str.Find ('/')) );
  282. m_sparray.ElementAt (i).SetAt (14, str.Right (str.GetLength ()-str.Find ('/')-1 ) );
  283. #ifdef LKAY_VERSION
  284. m_sparray.ElementAt (i).SetAt (23, m_List1.GetItemText (i, 10) );
  285. m_sparray.ElementAt (i).SetAt (24, m_List1.GetItemText (i, 12) );
  286. str=m_List1.GetItemText (i, 11);
  287. m_sparray.ElementAt (i).SetAt (25, str.Left (str.Find ('/')) );
  288. m_sparray.ElementAt (i).SetAt (26, str.Right (str.GetLength ()-str.Find ('/')-1 ) );
  289. str=m_List1.GetItemText (i, 13);
  290. m_sparray.ElementAt (i).SetAt (27, str.Left (str.Find ('/')) );
  291. m_sparray.ElementAt (i).SetAt (28, str.Right (str.GetLength ()-str.Find ('/')-1 ) );
  292. str=m_List1.GetItemText (i, 15);
  293. m_sparray.ElementAt (i).SetAt (15, str.Left (str.Find ('/')) );
  294. m_sparray.ElementAt (i).SetAt (16, str.Right (str.GetLength ()-str.Find ('/')-1 ) );
  295. if(m_List1.GetItemText (i, 14)!="OK")
  296. m_status3="未取";
  297. if(m_List1.GetItemText (i, 8)!="OK")
  298. m_status4="未完成";
  299. #else
  300. str=m_List1.GetItemText (i, 11);
  301. m_sparray.ElementAt (i).SetAt (15, str.Left (str.Find ('/')) );
  302. m_sparray.ElementAt (i).SetAt (16, str.Right (str.GetLength ()-str.Find ('/')-1 ) );
  303. if(m_List1.GetItemText (i, 10)!="OK")
  304. m_status3="未取";
  305. if(m_List1.GetItemText (i, 8)!="OK")
  306. m_status4="未完成";
  307. #endif
  308. }
  309. if(m_status3=="OK" && m_bGrowthTX==0)
  310. {
  311. if(AfxMessageBox("全部取件后此单将存入历史数据库并不可修改, 确认吗?", MB_YESNO|MB_ICONINFORMATION)!=IDYES)return;
  312. }
  313. if(atof(m_money3)>0)
  314. if(AfxMessageBox("警告:此客人余款未清, 请向财务核对, 继续吗?", MB_YESNO|MB_ICONSTOP)!=IDYES)return;
  315. if(atof(m_money3)<0)
  316. if(AfxMessageBox("警告:此客人账目不清, 请向财务核对, 继续吗?", MB_YESNO|MB_ICONSTOP)!=IDYES)return;
  317. if(m_sparray.GetSize ()==0)
  318. {
  319. return;
  320. }
  321. if(1)//m_status3=="OK" && m_bGrowthTX==0)
  322. {//自动生成出库记录
  323. int size=m_sparray.GetSize ();
  324. m_sparray.SetSize(size*2);
  325. for(int i=0; i<m_List1.GetItemCount (); i++)
  326. {
  327. m_sparray.ElementAt (size+i).RemoveAll ();
  328. m_sparray.ElementAt (size+i).Add (m_id);
  329. m_sparray.ElementAt (size+i).Add (GetLB(m_List1.GetItemText (i, 0)));
  330. m_sparray.ElementAt (size+i).Add (m_List1.GetItemText (i, 0));
  331. m_sparray.ElementAt (size+i).Add (m_List1.GetItemText (i, 1));
  332. #ifdef LKAY_VERSION
  333. if(m_List1.GetItemText (i, 8)=="OK" || m_List1.GetItemText (i, 14)=="OK")
  334. m_sparray.ElementAt (size+i).Add ("1");
  335. else
  336. m_sparray.ElementAt (size+i).Add ("0");
  337. #else
  338. if(m_List1.GetItemText (i, 8)=="OK" || m_List1.GetItemText (i, 10)=="OK")
  339. m_sparray.ElementAt (size+i).Add ("1");
  340. else
  341. m_sparray.ElementAt (size+i).Add ("0");
  342. #endif
  343. }
  344. }
  345. CMemFile memfile;
  346. CArchive ar(&memfile, CArchive::store);
  347. for(int ii=0; ii<m_sparray.GetSize (); ii++)
  348. {
  349. m_sparray.ElementAt (ii).Serialize (ar);
  350. }
  351. ar.Close();
  352. int length=memfile.GetLength ();
  353. BYTE *pData = memfile.Detach();
  354. int size=m_sparray.GetSize ();
  355. BYTE *pData2=new BYTE[length+sizeof(int)];
  356. memcpy(pData2, pData, length);
  357. memcpy(pData2+length, &size, sizeof(int));
  358. delete []pData;
  359. length+=sizeof(int);
  360. g_nSendCode=9;
  361. g_pMainWnd->ProcessChatMessageRequest2(pData2, length);
  362. g_nSendCode=0;
  363. delete []pData2;
  364. if(g_bSendOK==0)return;
  365. sql="";
  366. if(m_status3=="OK" && m_bGrowthTX==0)
  367. {
  368. sql= "update dindan set [status3]='"+m_status3+"',[time5]='"+g_date+"' where id='"+m_id+"'";
  369. ////////////////////////
  370. CString sql2;
  371. BOOL msgcheck = atoi(g_cominfoarray.ElementAt(0).ElementAt(104));
  372. CString msgcontent = g_cominfoarray.ElementAt(0).ElementAt(108);
  373. if(oldstatus=="OK")msgcheck=0;
  374. #ifdef CHILD_VERSION
  375. if(msgcheck )
  376. {
  377. CString m_content3 = msgcontent;
  378. CString str,timestamp;
  379. timestamp="msgtimestamp";
  380. {
  381. CString name;
  382. if(!m_name1.IsEmpty ())
  383. name=m_name1+",";
  384. name+=m_name2;
  385. name.TrimRight (",");
  386. if(name.IsEmpty ()==0 && CheckPhoneType(m_phone1)!=-1 && CheckBadWords(name,0) && CheckBadWords2(name,0) )
  387. {
  388. str=name+m_content3;
  389. str.Replace ("xxx小朋友", "");
  390. int count=GetLengthEx(str)/MSG_LENGTH;
  391. if(GetLengthEx(str)%MSG_LENGTH)
  392. count++;
  393. CString scount;
  394. scount.Format ("%d", count);
  395. sql2="***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('"+m_phone1+"','"+str+"','"+timestamp+"','"+scount+"','0','0','0','系统自动发送')";
  396. sql+=sql2;
  397. }
  398. }
  399. }
  400. #else
  401. if(msgcheck)
  402. {
  403. CString m_content3 = msgcontent;
  404. CString str,timestamp;
  405. timestamp="msgtimestamp";
  406. int pos=m_content3.Find("xxx先生/女士");
  407. if(pos!=-1)
  408. {
  409. if(m_name1.IsEmpty ()==0 && CheckPhoneType(m_phone1)!=-1 && CheckBadWords(m_name1,0)&& CheckBadWords2(m_name1,0) )
  410. {
  411. str=m_content3;
  412. str.Replace ("xxx先生/女士", m_name1+"先生");
  413. int count=GetLengthEx(str)/MSG_LENGTH;
  414. if(GetLengthEx(str)%MSG_LENGTH)
  415. count++;
  416. CString scount;
  417. scount.Format ("%d", count);
  418. sql2="***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('"+m_phone1+"','"+str+"','"+timestamp+"','"+scount+"','0','0','0','系统自动发送')";
  419. sql+=sql2;
  420. }
  421. if(m_name2.IsEmpty ()==0 && CheckPhoneType(m_phone2)!=-1 && CheckBadWords(m_name2,0) && CheckBadWords2(m_name2,0) )
  422. {
  423. str=m_content3;
  424. str.Replace ("xxx先生/女士", m_name2+"女士");
  425. int count=GetLengthEx(str)/MSG_LENGTH;
  426. if(GetLengthEx(str)%MSG_LENGTH)
  427. count++;
  428. CString scount;
  429. scount.Format ("%d", count);
  430. CTime tm=CTime::GetCurrentTime ();
  431. tm+=CTimeSpan(0,0,0,3);
  432. timestamp=tm.Format ("%Y%m%d%H%M%S");
  433. timestamp="msgtimexxstamp";
  434. sql2="***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('"+m_phone2+"','"+str+"','"+timestamp+"','"+scount+"','0','0','0','系统自动发送')";
  435. sql+=sql2;
  436. }
  437. }
  438. }
  439. #endif
  440. /////////////////////////
  441. // g_sendhead.bsql=1;
  442. // g_pMainWnd->ProcessChatMessageRequest2(sql);
  443. // if(g_bSendOK==0)return;
  444. }
  445. BOOL msgcheck = atoi(g_cominfoarray.ElementAt(0).ElementAt(128));//通知取件短信
  446. CString msgcontent = g_cominfoarray.ElementAt(0).ElementAt(129);
  447. if(oldstatus2=="OK")msgcheck=0;
  448. if(m_status4!="OK")msgcheck=0;
  449. if(msgcheck)
  450. {
  451. CString sql2;
  452. #ifdef CHILD_VERSION
  453. if(msgcheck )
  454. {
  455. CString m_content3 = msgcontent;
  456. CString str,timestamp;
  457. timestamp="msgtimestamp";
  458. {
  459. CString name;
  460. if(!m_name1.IsEmpty ())
  461. name=m_name1+",";
  462. name+=m_name2;
  463. name.TrimRight (",");
  464. if(name.IsEmpty ()==0 && CheckPhoneType(m_phone1)!=-1 && CheckBadWords(name,0) && CheckBadWords2(name,0) )
  465. {
  466. str=name+m_content3;
  467. str.Replace ("xxx小朋友", "");
  468. int count=GetLengthEx(str)/MSG_LENGTH;
  469. if(GetLengthEx(str)%MSG_LENGTH)
  470. count++;
  471. CString scount;
  472. scount.Format ("%d", count);
  473. sql2="***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('"+m_phone1+"','"+str+"','"+timestamp+"','"+scount+"','0','0','0','系统自动发送')";
  474. sql+=sql2;
  475. }
  476. }
  477. }
  478. #else
  479. if(msgcheck)
  480. {
  481. CString m_content3 = msgcontent;
  482. CString str,timestamp;
  483. timestamp="msgtimestamp";
  484. int pos=m_content3.Find("xxx先生/女士");
  485. if(pos!=-1)
  486. {
  487. if(m_name1.IsEmpty ()==0 && CheckPhoneType(m_phone1)!=-1 && CheckBadWords(m_name1,0)&& CheckBadWords2(m_name1,0) )
  488. {
  489. str=m_content3;
  490. str.Replace ("xxx先生/女士", m_name1+"先生");
  491. int count=GetLengthEx(str)/MSG_LENGTH;
  492. if(GetLengthEx(str)%MSG_LENGTH)
  493. count++;
  494. CString scount;
  495. scount.Format ("%d", count);
  496. sql2="***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('"+m_phone1+"','"+str+"','"+timestamp+"','"+scount+"','0','0','0','系统自动发送')";
  497. sql+=sql2;
  498. }
  499. if(m_name2.IsEmpty ()==0 && CheckPhoneType(m_phone2)!=-1 && CheckBadWords(m_name2,0) && CheckBadWords2(m_name2,0) )
  500. {
  501. str=m_content3;
  502. str.Replace ("xxx先生/女士", m_name2+"女士");
  503. int count=GetLengthEx(str)/MSG_LENGTH;
  504. if(GetLengthEx(str)%MSG_LENGTH)
  505. count++;
  506. CString scount;
  507. scount.Format ("%d", count);
  508. CTime tm=CTime::GetCurrentTime ();
  509. tm+=CTimeSpan(0,0,0,3);
  510. timestamp=tm.Format ("%Y%m%d%H%M%S");
  511. timestamp="msgtimexxstamp";
  512. sql2="***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('"+m_phone2+"','"+str+"','"+timestamp+"','"+scount+"','0','0','0','系统自动发送')";
  513. sql+=sql2;
  514. }
  515. }
  516. }
  517. #endif
  518. ////////////////////////
  519. }
  520. if(sql!="")
  521. {
  522. g_sendhead.bsql=1;
  523. g_pMainWnd->ProcessChatMessageRequest2(sql);
  524. if(g_bSendOK==0)return;
  525. }
  526. AfxMessageBox("保存成功!", MB_ICONINFORMATION);
  527. CDialog::OnOK();
  528. }
  529. void outsourcingDlg::OnButton1()
  530. {
  531. // TODO: Add your control notification handler code here
  532. for(int i=0; i<m_List1.GetItemCount (); i++)
  533. {
  534. if(m_List1.GetItemText (i, 8)=="OK")continue;
  535. m_List1.SetItemText (i, 8, "OK");
  536. m_List1.SetItemText (i, 9, g_date+"/"+g_user.name);
  537. }
  538. }
  539. void outsourcingDlg::OnButton2()
  540. {
  541. // TODO: Add your control notification handler code here
  542. #ifdef LKAY_VERSION
  543. for(int i=0; i<m_List1.GetItemCount (); i++)
  544. {
  545. if(m_List1.GetItemText (i, 14)=="OK")continue;
  546. m_List1.SetItemText (i, 14, "OK");
  547. m_List1.SetItemText (i, 15, g_date+"/"+g_user.name);
  548. }
  549. #else
  550. for(int i=0; i<m_List1.GetItemCount (); i++)
  551. {
  552. if(m_List1.GetItemText (i, 10)=="OK")continue;
  553. m_List1.SetItemText (i, 10, "OK");
  554. m_List1.SetItemText (i, 11, g_date+"/"+g_user.name);
  555. }
  556. #endif
  557. }
  558. CString outsourcingDlg::GetLB(CString name)
  559. {
  560. for(int i=0; i<m_List2array.GetSize (); i++)
  561. {
  562. if(name==m_List2array.ElementAt (i).ElementAt (1))
  563. return m_List2array.ElementAt (i).ElementAt (4);
  564. }
  565. return "";
  566. }
  567. void outsourcingDlg::OnTimer(UINT nIDEvent)
  568. {
  569. // TODO: Add your message handler code here and/or call default
  570. KillTimer(1);
  571. if(atof(m_money3)>0)
  572. {
  573. ShowMsg2 dlg;
  574. dlg.DoModal ();
  575. // if(AfxMessageBox("警告:此客人余款未清, 请向财务核对, 继续吗?", MB_YESNO|MB_ICONSTOP)!=IDYES)
  576. // CDialog::OnCancel ();
  577. }
  578. CDialog::OnTimer(nIDEvent);
  579. }
  580. void outsourcingDlg::OnButton3()
  581. {
  582. // TODO: Add your control notification handler code here
  583. POSITION pos;
  584. pos=m_List1.GetFirstSelectedItemPosition();
  585. if(pos==NULL)
  586. {
  587. AfxMessageBox("请先选中您要发出制作的产品!", MB_ICONINFORMATION);
  588. return;
  589. }
  590. SelProvider dlg;
  591. if(dlg.DoModal ()!=IDOK)return;
  592. int iItem;
  593. while (pos)
  594. {
  595. iItem = m_List1.GetNextSelectedItem(pos);
  596. m_List1.SetItemText (iItem, 4, dlg.m_provider);
  597. m_List1.SetItemText (iItem, 5, g_date+"/"+g_user.name);
  598. }
  599. }
  600. void outsourcingDlg::OnButton4()
  601. {
  602. // TODO: Add your control notification handler code here
  603. for(int i=0; i<m_List1.GetItemCount (); i++)
  604. {
  605. if(m_List1.GetItemText (i, 12)=="OK")continue;
  606. m_List1.SetItemText (i, 12, "OK");
  607. m_List1.SetItemText (i, 13, g_date+"/"+g_user.name);
  608. }
  609. }
  610. void outsourcingDlg::OnButton5()
  611. {
  612. // TODO: Add your control notification handler code here
  613. for(int i=0; i<m_List1.GetItemCount (); i++)
  614. {
  615. if(m_List1.GetItemText (i, 10)=="OK")continue;
  616. m_List1.SetItemText (i, 10, "OK");
  617. m_List1.SetItemText (i, 11, g_date+"/"+g_user.name);
  618. }
  619. }
  620. void outsourcingDlg::OnDestroy()
  621. {
  622. CDialog::OnDestroy();
  623. // TODO: Add your message handler code here
  624. if(g_bAllBranch)
  625. {
  626. g_pMainWnd->OnDisconnect();
  627. g_bBranchModify=0;g_branchip=g_branchname="";
  628. }
  629. }