-- 作者:大红袍
-- 发布时间:2016/5/17 17:03:00
--
For Each ary() As String In DataTables("包装车间工资表").GetValues("日期|生产形式", "日期 is not null and 生产形式 <> \'个人\'") Dim drs As List(Of DataRow) = DataTables("包装车间工资表").Select("日期=#" & ary(0) & "# and 生产形式=\'" & ary(1) & "\'") Dim smoney As Double = DataTables("包装车间工资表").compute("sum(计件金额)", "日期=#" & ary(0) & "# and 生产形式=\'" & ary(1) & "\'") Dim stime As Double = DataTables("包装车间工资表").compute("sum(计件时间)", "日期=#" & ary(0) & "# and 生产形式=\'" & ary(1) & "\'") Dim dj As Double = smoney / stime For Each dr As DataRow In drs dr("分配单价") = dj dr("分配后金额") = format(dj * dr("计件时间"),"0.00") Next Next For Each dr As DataRow In DataTables("包装车间工资表").Select("生产形式 = \'个人\'") dr("分配单价") = Nothing dr("分配后金额") = format(dr("数量") * dr("单价"),"0.00") Next
For Each ary As String In DataTables("包装车间工资表").GetValues("日期", "日期 is not null") Dim drs1 As List(Of DataRow) = DataTables("包装车间工资表").Select("日期=#" & ary & "#") Dim sum As Double = DataTables("包装车间工资表").compute("sum(上班工时)", "日期=#" & ary & "#") Dim count As Integer = 0 Dim ls As new List(Of String) For Each dr As DataRow In drs1 Dim str As String = dr("姓名") If ls.Contains(str) = False Then count += 1 ls.add(str) dr("备注") = dr("备注").replace("重复", Nothing) Else dr("备注") = "重复" & dr("备注").replace("重复", Nothing) End If Next For Each dr As DataRow In drs1 If dr("备注") Like "*重复*" Then dr("上班天数") = Nothing End If If sum > = 8 dr("上班天数") = 1 Else dr("上班天数") = format(sum/8, "0.00") End If Next Next
\'Tables("包装车间工资表").Filter = "" Tables("包装车间工资表").Filter = "日期 is not null and (备注 is null or 备注 not like \'%重复%\')" Tables("包装车间工资表").Sort = "日期,生产形式"
|