--
datacolchanged事件
select case e.datacol.namecase "车号","日期","里程表数"
dim d as date = e.datarow("日期")
dim dr as datarow
if d.day > 20 then
dim d2 as date = new date(d.year,d.month,20)
dr = e.datatable.find("车号=\'" & e.datarow("车号") & "\' and 日期 <=#" & d2 & "#","日期 desc")
elseif d.day < 20 then
dim d2 as date =d.addmonths(-1)
d2= new date(d2.year,d2.month,20)
dr = e.datatable.find("车号=\'" & e.datarow("车号") & "\' and 日期 <=#" & d2 & "#","日期 desc")
end if
if dr isnot nothing then
e.datarow("月累里程数") = e.datarow("里程表数") - dr("里程表数")
end if
end select