<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    guanxf

    我的博客:http://blog.sina.com.cn/17learning

      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
      71 隨筆 :: 1 文章 :: 41 評論 :: 0 Trackbacks
    創建文檔顯示如下:
    廠家名稱           公司得分        時間
    廠家A                 200            @create
    廠家B                  300         @create
     廠家a                 300          @create

    顯示結果:
        廠家名稱           公司得分        時間  
     廠家A                 500            @create 
      廠家B               200            @create 
    代碼如下:
    Sub Initialize
    On  Error  GoTo  errorHandle
    Dim session As New NotesSession
    Dim db As NotesDatabase
    Dim view As NotesView
    Dim doc As NotesDocument  
    Dim valueCategory As String
    Dim nowTime As   Variant
    Set db = session.CurrentDatabase
    Set view = db.GetView("showCategory")
    Set doc = view.GetFirstDocument()
          If Not doc Is Nothing Then
          valueCategory=CStr(doc.sortCategory(0))      ‘從前臺獲得顯示條件
          Else
          valueCategory="總排行"     
          End If
    While Not(doc Is Nothing)
    Call doc.Remove(True)
    Set doc = view.GetFirstDocument()
    Wend
    Call showContent(valueCategory)
    Exit Sub
     errorHandle:
    MsgBox  "showFddl  error:"+CStr(Erl)+"行"+Error
    Exit Sub
    End Sub
    Function  showContent(valueCategory As String)
    On Error GoTo eHandle
    Dim s As New NotesSession
    Dim db As NotesDatabase,view As NotesView
    Dim entryc As NotesViewEntryCollection,entryA As NotesViewEntry,entryB As NotesViewEntry
    Dim nav As NotesViewNavigator
    Dim value As Integer    '每個評分
    Dim comcount As Integer '一個公司的評分次數
    Dim comarr  As Variant ,valuearr  As Variant  '公司和評分數組
    Dim entry As NotesViewEntry
    Dim com As String
    Dim comnew As String
    Dim comlast As String 
    Dim comString As String
    Dim  valueString As String
    Dim count As Integer
    Dim doc,doc2,doc3 As NotesDocument
    Dim valueb As  Integer
    Dim  oldtime As  String
    Dim  nowTime As String
    Dim rview As NotesView
    Dim  rdoc As NotesDocument
    Dim docTime1,docTime2,docTime3 As String '保存的文檔時間
    '清空視圖
    Set db=s.Currentdatabase
    Set rview= db.GetView("s_showFddl")
    Set rdoc = rview.GetFirstDocument()
    While Not(rdoc Is Nothing)
    Call rdoc.Remove(True)
    Set rdoc = rview.getfirstdocument()
    Wend
    '遍歷視圖
    Set db=s.currentdatabase
    Set view = db.getview("showFddl")
    Set nav=view.createviewnav()   '遍歷器
    Set entryA=nav.getfirst
    comcount=0
    If Not entryA Is Nothing Then
    com = entryA.Columnvalues(1)  '得到公司名稱
    value =CInt(entryA.Columnvalues(0)) '得到總分
    oldtime =entryA.Columnvalues(2)  '得到文檔的時間
    comcount=1
    comlast=com
    If valueCategory="本周排行"  Then   '根據條件進行帥選
    firstday=Evaluate(|@Weekday(@Date(| & Year(Today) & |;1;1))|)
    test=Evaluate(|@Date(|& Year(Today) &|;1;1)|)'第一天(元旦)
    days=CInt((today-test(0)))  
          weeks=CInt(StrLeft(CStr((days+firstday(0)-1)/7),".") )+1
    If(weeks>9) Then
    thisyearweek=CStr(weeks)
    Else 
    thisyearweek="0"+Cstr(weeks)
    End If
    nowTime=CStr(Year(Today)&"#"& thisyearweek)
    tempOldTime=CDat(Format(oldtime,"yyyy-m-d"))
    firstday2=Evaluate(|@Weekday(@Date(| & Year(oldtime) & |;1;1))|)
    test2=Evaluate(|@Date(|&Year(oldtime) &|;1;1)|)'第一天(元旦)
    days2=CInt(tempOldTime-test2(0))  
       weeks2=CInt(StrLeft(CStr((days2+firstday2(0)-1)/7),".") )+1
    If(weeks2>9) Then
    thisyearweek2=CStr(weeks2)
    Else 
    thisyearweek2="0"+Cstr(weeks2)
    End If
    docTime1=CStr(Year(oldTime))+"#"+CStr(thisyearweek2)
    ElseIf   valueCategory="本月排行" Then
    nowTime=CStr(Year(Now))+"#"+CStr(Month(Now))
    docTime1=CStr(Year(oldtime))+"#"+CStr(Month(oldtime))
    ElseIf   valueCategory="本季度排行" Then
    tempNowTime=CStr(Year(Now))+"#"+CStr(Month(Now))
    rNowTime=StrRight(tempNowTime,"#")
    lNowTime=StrLeft(tempNowTime,"#")
                tempDocTime1=CStr(Year(oldtime))+"#"+CStr(Month(oldtime))
    RDocTime1=StrRight(tempDocTime1,"#")
    lDocTime1=StrLeft(tempDocTime1,"#")
    If lNowTime=lDocTime1    Then
    If (0<rNowTime<4) And (0<rDocTime1<4) Then
    nowTime="=="
    docTime1="==" 
    End If
    If (4<=rNowTime<7) And (4<=rDocTime1<7) Then
    nowTime="=="
    docTime1="==" 
    End If
    If (7<=rNowTime<10) And (7<=rDocTime1<10) Then
    nowTime="=="
    docTime1="==" 
    End If
    If (10<=rNowTime<13) And (10<=rDocTime1<13) Then
    nowTime="=="
    docTime1="==" 
    End If
    Else
                    nowTime="=="
    docTime1="!=="  
    End If
      ElseIf   valueCategory="總排行" Then
    nowtime=""
        docTime1=""
    End If
    Set entryB = nav.getnext(entryA)
    If Not entryB Is Nothing Then 
    comnew = entryB.Columnvalues(1)
    If Not comnew=comlast Then            
    If(nowtime=docTime1)  Then    '和當前時間做對比
    Set doc = New NotesDocument(db)  '保存新文檔顯示到s_showWhxf視圖中
    doc.form="pjSumfile"
    doc.S_unitName=com
    doc.S_no1=value
    doc.S_time=Evaluate("@Now")
    doc.S_category="電纜防盜器廠家"
    Call doc.Save(True,True)
                        comString=comString+"#:"+com       '公司名稱字符串
    valueString=valueString+"#"+CStr(value) '公司評分字符串
          End If 
    com=""
    value=0
    comcount=0
    comnew=""
    End If
    Else 
    If(nowTime=docTime1)  Then
    Set doc = New NotesDocument(db)
    doc.form="pjSumfile"
    doc.S_unitName=com
    doc.S_no1=value
    doc.S_time=Evaluate("@Now")
    doc.S_category="電纜防盜器廠家"
    Call doc.Save(True,True)
    End If
    End If
    End If
    If Not (nowTime=docTime1)   Then 
    value=0 '第一個文檔的時間
    comcount=0
    End If
    While Not entryB Is Nothing
    com = entryB.Columnvalues(1)
    valueNext=entryB.Columnvalues(2)
    If  valueCategory="本月排行" Then
    nowTime=CStr(Year(Now))+"#"+CStr(Month(Now))
    docTime2=CStr(Year(valueNext))+"#"+CStr(Month(valueNext))
    ElseIf valueCategory="本周排行" Then
    firstday=Evaluate(|@Weekday(@Date(| & Year(Today) & |;1;1))|)
    test=Evaluate(|@Date(|& Year(Today) &|;1;1)|)'第一天(元旦)
    days=CInt((today-CDat(test(0))))  
    weeks=CInt(StrLeft(CStr((days+firstday(0)-1)/7),".") )+1
    If(weeks>9) Then
    thisyearweek=CStr(weeks)
    Else 
    thisyearweek="0"+Cstr(weeks)
    End If
    nowTime=CStr(Year(Today)&"#"& thisyearweek)
    tempOldTime2=CDat(Format(valueNext,"yyyy-m-d"))
    firstday2=Evaluate(|@Weekday(@Date(| & Year(valueNext) & |;1;1))|)
    test2=Evaluate(|@Date(|&Year(valueNext) &|;1;1)|)'第一天(元旦)
    days2=CInt(CDat(tempOldTime2)-CDat(test2(0)))  
    weeks2=CInt(StrLeft(CStr((days2+firstday2(0)-1)/7),".") )+1
    If(weeks2>9) Then
    thisyearweek2=CStr(weeks2)
    Else 
    thisyearweek2="0"+Cstr(weeks2)
    End If
    docTime2=CStr(Year(valueNext))+"#"+CStr(thisyearweek2)
      ElseIf   valueCategory="本季度排行" Then
    tempNowTime=CStr(Year(Now))+"#"+CStr(Month(Now))
    rNowTime=StrRight(tempNowTime,"#")
    lNowTime=StrLeft(tempNowTime,"#")
    tempDocTime2=CStr(Year(valueNext))+"#"+CStr(Month(valueNext))
    RDocTime2=StrRight(tempDocTime2,"#")
    lDocTime2=StrLeft(tempDocTime2,"#")
    If lNowTime=lDocTime2    Then
    If (0<rNowTime<4) And (0<rDocTime2<4) Then
    nowTime="=="
    docTime2="==" 
    End If
    If (4<=rNowTime<7) And (4<=rDocTime2<7) Then
    nowTime="=="
    docTime2="==" 
    End If
    If (7<=rNowTime<10) And (7<=rDocTime2<10) Then
    nowTime="=="
    docTime2="==" 
    End If
    If (10<=rNowTime<13) And (10<=rDocTime2<13) Then
    nowTime="=="
    docTime2="==" 
    End If
    Else
    nowTime="=="
    docTime2="!=="  
    End If
    ElseIf   valueCategory="總排行" Then
    nowtime=""
    docTime2=""
    End If
    If( nowTime=docTime2)   Then
    value=value+entryB.Columnvalues(0) '第二個文檔的值
       comcount=comcount+1   '有幾個相同的值
    End If
    If(nowTime=docTime3)  Then 
        valueb=valueb+entryB.Columnvalues(0) '最后一個文檔的值
    End If
    comlast=com
    Set entryB = nav.getnext(entryB)
    If Not entryB Is Nothing Then
    comnew = entryB.Columnvalues(1)
    If   valueCategory="本月排行" Then
    nowTime=CStr(Year(Now))+"#"+CStr(Month(Now))
    docTime3=CStr(Year(valueNext))+"#"+CStr(Month(valueNext))
    ElseIf valueCategory="本周排行" Then
    firstday=Evaluate(|@Weekday(@Date(| & Year(Today) & |;1;1))|)
    test=Evaluate(|@Date(|& Year(Today) &|;1;1)|)'第一天(元旦)
    days=CInt((today-test(0)))  
    weeks=CInt(StrLeft(CStr((days+firstday(0)-1)/7),".") )+1
    If(weeks>9) Then
    thisyearweek=CStr(weeks)
    Else 
    thisyearweek="0"+Cstr(weeks)
    End If
    nowTime=CStr(Year(Today)&"#"& thisyearweek)
    tempOldTime=CDat(Format(valueNext,"yyyy-m-d"))
    firstday3=Evaluate(|@Weekday(@Date(| & Year(valueNext) & |;1;1))|)
    test3=Evaluate(|@Date(|&Year(valueNext) &|;1;1)|)'第一天(元旦)
    days3=CInt(tempOldTime-test3(0))  
    weeks3=CInt(StrLeft(CStr((days3+firstday3(0)-1)/7),".") )+1
    If(weeks3>9) Then
    thisyearweek3=CStr(weeks3)
    Else 
    thisyearweek3="0"+Cstr(weeks3)
    End If
    docTime3=CStr(Year(valueNext))+"#"+CStr(thisyearweek3)
     ElseIf   valueCategory="本季度排行" Then
    tempNowTime=CStr(Year(Now))+"#"+CStr(Month(Now))
    rNowTime=StrRight(tempNowTime,"#")
    lNowTime=StrLeft(tempNowTime,"#")
    tempDocTime3=CStr(Year(valueNext))+"#"+CStr(Month(valueNext))
    rDocTime3=StrRight(tempDocTime3,"#")
    lDocTime3=StrLeft(tempDocTime3,"#")
    If lNowTime=lDocTime3    Then
    If (0<rNowTime<4) And (0<rDocTime3<4) Then
    nowTime="=="
    docTime3="==" 
    End If
    If (4<=rNowTime<7) And (4<=rDocTime3<7) Then
    nowTime="=="
    docTime3="==" 
    End If
    If (7<=rNowTime<10) And (7<=rDocTime3<10) Then
    nowTime="=="
    docTime3="==" 
    End If
    If (10<=rNowTime<13) And (10<=rDocTime3<13) Then
    nowTime="=="
    docTime3="==" 
    End If
    Else
    nowTime="=="
    docTime3="!=="  
    End If
    ElseIf   valueCategory="總排行" Then
    nowtime=""
    docTime3=""
    End If
    If Not comnew=comlast Then   '公司變了
    If(nowTime=docTime2)  Then
    Set doc2 = New NotesDocument(db)
    doc2.form="pjSumfile"
    doc2.S_unitName=com
    doc2.S_no1=value/comcount
    doc2.S_time=Evaluate("@Now")
    doc2.S_category="電纜防盜器廠家"
    Call doc2.Save(True,True)
                         comString=comString+"#:"+com 
    valueString=valueString+"#"+Cstr(value/comcount)
    valueb=CInt(entryB.Columnvalues(0))
    End If
    com=""
    value=0
    valueb=0
    comcount=0
    comnew=""
    docTime2=""
    docTime3=""
    End If
    Else      '最后一個公司
    If(nowTime=docTime3)  Then 
    Set doc3 = New NotesDocument(db)
    doc3.form="pjSumfile"
    doc3.S_unitName=com
    doc3.S_no1=valueb/comcount
    doc3.S_time=Evaluate("@Now")
    doc3.S_category="電纜防盜器廠家"
    Call doc3.Save(True,True)
                                     comString=comString+"#:"+com
    valueString=valueString+"#"+Cstr(valueb/comcount)
    End If
    End If  
    Wend
    'comarr=Split(StrRight(comString,"#"),"#")
    'valuearr=Split(StrRight(valueString,"#"),"#")
    Exit Function 
    eHandle:
    MsgBox  "sumFddl showContent錯誤"+CStr(Erl)+"行"+Error
    Exit Function 
    End Function
    posted on 2012-02-20 22:30 管先飛 閱讀(526) 評論(0)  編輯  收藏 所屬分類: Lotus Notes
    主站蜘蛛池模板: 亚洲午夜福利在线观看| 欧洲精品码一区二区三区免费看| 久久综合亚洲色一区二区三区| 久久久无码精品亚洲日韩京东传媒| 亚洲日韩乱码久久久久久| 亚洲GV天堂无码男同在线观看| 国产无限免费观看黄网站| 亚洲免费在线观看视频| 国产a级特黄的片子视频免费| 国产成人亚洲精品青草天美| 亚洲av永久无码嘿嘿嘿| 一本岛v免费不卡一二三区| 欧洲乱码伦视频免费| 亚洲成年人啊啊aa在线观看| 亚洲av午夜福利精品一区人妖| 亚洲色无码专区一区| 国产成人1024精品免费| 最近中文字幕电影大全免费版 | 成人免费的性色视频| 国产色婷婷精品免费视频| 亚洲高清在线播放| 国内精品免费麻豆网站91麻豆| 亚洲毛片av日韩av无码| 亚洲日本国产综合高清| 国产无遮挡裸体免费视频在线观看 | 午夜在线免费视频| 国产亚洲婷婷香蕉久久精品| 亚洲va中文字幕| 国产亚洲一区二区三区在线不卡| 亚洲性色精品一区二区在线| 无码精品国产一区二区三区免费| 免费国产小视频在线观看| 亚洲综合丁香婷婷六月香| 久久久国产精品福利免费| 亚洲精品国产自在久久| 亚洲熟妇久久精品| 久久亚洲av无码精品浪潮| 视频一区在线免费观看| 国产美女无遮挡免费网站| 最新国产精品亚洲| 亚洲尤码不卡AV麻豆|