SetSalary.cpp 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. // SetSalary.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "SetSalary.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // SetSalary dialog
  13. SetSalary::SetSalary(CWnd* pParent /*=NULL*/)
  14. : CDialog(SetSalary::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(SetSalary)
  17. m_money = _T("");
  18. //}}AFX_DATA_INIT
  19. }
  20. void SetSalary::DoDataExchange(CDataExchange* pDX)
  21. {
  22. CDialog::DoDataExchange(pDX);
  23. //{{AFX_DATA_MAP(SetSalary)
  24. DDX_Control(pDX, IDC_EDIT1, m_editnum);
  25. DDX_Text(pDX, IDC_EDIT1, m_money);
  26. //}}AFX_DATA_MAP
  27. }
  28. BEGIN_MESSAGE_MAP(SetSalary, CDialog)
  29. //{{AFX_MSG_MAP(SetSalary)
  30. //}}AFX_MSG_MAP
  31. END_MESSAGE_MAP()
  32. /////////////////////////////////////////////////////////////////////////////
  33. // SetSalary message handlers
  34. BOOL SetSalary::OnInitDialog()
  35. {
  36. CDialog::OnInitDialog();
  37. // TODO: Add extra initialization here
  38. CString str;
  39. str.Format ("%s %dÄê-%dÔ Ìá³É×ܶî", name, year, month);
  40. SetDlgItemText(IDC_STATIC1, str);
  41. g_sendhead.bsql=0;
  42. g_sendhead.code[0]=85;
  43. g_sendhead.tabcount=1;
  44. CString filter;
  45. filter.Format ("[name]='%s' and [year]='%d' and [month]='%d'", name, year, month);
  46. g_pMainWnd->ProcessChatMessageRequest2(filter);
  47. if(g_bSendOK)
  48. {
  49. CArray<CStringArray, CStringArray>array;
  50. DataToArray(&array);
  51. if(array.GetSize ())
  52. {
  53. m_money=array.ElementAt (0).ElementAt (1);
  54. UpdateData(false);
  55. }
  56. }
  57. CenterWindow();
  58. return false; // return TRUE unless you set the focus to a control
  59. // EXCEPTION: OCX Property Pages should return FALSE
  60. }
  61. void SetSalary::OnOK()
  62. {
  63. // TODO: Add extra validation here
  64. UpdateData();
  65. CString sql,temp;
  66. sql.Format("delete from salary where [name]='"+name+"' and [year]='%d' and [month]='%d'", year, month);
  67. temp.Format ("***insert into salary([name],[year],[month],[money])values('"+name+"','%d','%d','"+m_money+"')", year, month);
  68. sql+=temp;
  69. for(int i=0; i<pArray->GetSize (); i++)
  70. {
  71. if(selpos==1)
  72. temp.Format ("***update dindan set [tichenren1]='%s/%d-%02d' where [id]='"+pArray->ElementAt (i)+"'", name, year, month);
  73. else if(selpos==2)
  74. temp.Format ("***update dindan set [tichenren2]='%s/%d-%02d' where [id]='"+pArray->ElementAt (i)+"'", name, year, month);
  75. else if(selpos==3)
  76. temp.Format ("***update dindan set [tichenren3]='%s/%d-%02d' where [id]='"+pArray->ElementAt (i)+"'", name, year, month);
  77. else if(selpos==4)
  78. temp.Format ("***update dindan set [tichenren4]='%s/%d-%02d' where [id]='"+pArray->ElementAt (i)+"'", name, year, month);
  79. else if(selpos==5)
  80. temp.Format ("***update dindan set [tichenren5]='%s/%d-%02d' where [id]='"+pArray->ElementAt (i)+"'", name, year, month);
  81. sql+=temp;
  82. }
  83. g_sendhead.bsql=1;
  84. g_pMainWnd->ProcessChatMessageRequest2(sql);if(g_bSendOK==0)return;
  85. AfxMessageBox("±£´æ³É¹¦!");
  86. CDialog::OnOK();
  87. }