dim cmd as SQLCommand
'核算上月工资_____________________________________________________________________________
Dim shangyue As Double=0
Dim y_Shangyue As Integer = Date.Today.Year
Dim m_Shangyue As Integer = Date.Today.Month
Dim dt1_Shangyue As New Date(y_Shangyue, m_Shangyue, 1)
dt1_Shangyue = dt1_Shangyue.Addmonths(-1)
y_Shangyue = dt1_Shangyue.Year
m_Shangyue = Dt1_Shangyue.Month
Dim FilterShangyue As String
Dim dt2_Shangyue As New Date(y_Shangyue, m_Shangyue, Date.DaysInMonth(y_Shangyue, m_Shangyue)) '获取本月的最后一天
FilterShangyue = "(sell_date >= '" & dt1_Shangyue & "' And sell_date <= '" & dt2_Shangyue & "')"
FilterShangyue= "select * from crm_sale left join crm_opportunity on crm_sale.opp_id=crm_opportunity.opp_id Where seller = '" & _userid & "'and " + FilterShangyue
e.Form.Controls("txtShangyueticheng").text=FilterShangyue
Dim dt As DataTable
cmd.CommandText = FilterShangyue
dt = cmd.ExecuteReader()
For Each dr2 As DataRow In dt.Datarows
msgbox(dr2("from_id"))
Select Case dr2("from_id")
Case 0,8
shangyue=shangyue+dr2("totalMoney")*0.005
Case 3,12,1,2,4,5,6,7,9,10,11
shangyue=shangyue+dr2("totalMoney")*0.02
Case Else
End Select
Next
e.Form.Controls("txtShangyueticheng").text=shangyue