If len(shop.value)>0 Then
filter= "{pos_master}.shopcode='"& shop.Value &"' and pos_date between '"& startdate &"' And '"& enddate &"' "
Else
filter= " pos_date between '"& startdate &"' And '"& enddate &"' "
End If
If len(filter)>0 And user.Name="admin" Then MessageBox.Show (Filter)
DataTables("pos_master").LoadFilter =Filter
DataTables("pos_master").load
Dim r As Integer
Dim RowCount As Integer = Tables("pos_master").Rows.Count
Dim startcount As Integer
If user.name="admin" Then messagebox.Show ( " tables pos_master row count " & Rowcount )
If user.name="admin" Then messagebox.Show ( " tables pos_master start count " & startcount )
Do Until startcount= Rowcount
Dim r_1 As Row = Tables("pos_master").Rows(startcount)
If len(r_1("customer_card_no") )>0 Then
Dim customer_dr As DataRow
find_str=("customer_card_no='"& r_1("customer_card_no") &"' ")
messagebox .Show (find_Str)
customer_dr=DataTables("customer").find (find_str)
Dim pos_master_dr As DataRow
pos_master_dr = DataTables("pos_master").Find("customer_card_no='"& r_1("customer_card_no") &"' ","pos_date desc ")
If pos_master_dr IsNot Nothing Then '如果找到的话
messagebox.Show ( " 2 ")
r_1("lastbuy_day")=pos_master_dr("pos_date")
End If
If len(customer_dr("customer_ename") )>0 Then r_1("customer_ename")=customer_dr("customer_ename")
If len(customer_dr("customer_opening") )>0 Then r_1("customer_opening")=customer_dr("customer_opening")
If len(customer_dr("customer_sub_cat") )>0 Then r_1("customer_sub_cat")=customer_dr("customer_sub_cat")
' messagebox.Show( r_1("customer_cname") & " " & r_1("customer_card_no") & " " & startcount )
Else
r_1("customer_ename")=""
End If
startcount=startcount+1
' messagebox.Show(" start value " & startcount )
Loop