Foxtable(狐表)用户栏目专家坐堂 → 关于XML的问题,初学,请发代码学习


  共有7653人关注过本帖平板打印复制链接

主题:关于XML的问题,初学,请发代码学习

帅哥哟,离线,有人找我吗?
hongyefor
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:524 积分:3676 威望:0 精华:0 注册:2012/7/27 10:28:00
  发帖心情 Post By:2019/3/13 17:06:00 [只看该作者]

Dim db4 As WinForm.DropDownBox = e.Form.Controls("DropBox4")
Dim db5 As WinForm.DropDownBox = e.Form.Controls("DropBox5")
Dim dzml4 As String = db4.text
Dim dzml5 As String = db5.text
If dzml4 IsNot Nothing Then
    Tables("表A").StopRedraw
    For Each dir As String In FileSys.GetDirectories(dzml4)
        For Each f As String In FileSys.GetFiles(dir)
            If f.EndsWith("_verifysign.log") Then
                Dim str = f.SubString(f.Length - 38)
                If DataTables("表B").Find("文件名 = '" & str & "'" ) Is Nothing Then
                    Dim txt As String = FileSys.ReadAllText(f, Encoding.Default)
                    Dim idx As Integer = txt.IndexOf("</business>")
                   
                    Dim s1 As String = txt.SubString(0, idx+11)
                    Dim s2 As String = txt.SubString(idx+12)
                    Dim xmlDoc As New System.XML.XmlDocument
                    xmlDoc.Loadxml(s1)
                   
                    Dim ndList  = xmlDoc.GetElementsByTagName("input")
                    Dim kprq As String
                    Dim fpdm As String
                    Dim fphm As String
                    Dim ghdwmc As String
                    Dim ghdwdzdh As String
                    Dim ghdwsbh As String
                    Dim ghdwyhzh As String
                    Dim hjje As String
                    Dim hjse As String
                    Dim jshj As String
                    Dim bz As String
                    Dim fpzt As String
                    For i As Integer = 0 To ndList.count - 1
                        If ndList(i).Item("kprq") IsNot Nothing Then kprq = ndList(i).Item("kprq").InnerText
                        If ndList(i).Item("fpdm") IsNot Nothing Then fpdm = ndList(i).Item("fpdm").InnerText
                        If ndList(i).Item("fphm") IsNot Nothing Then fphm = ndList(i).Item("fphm").InnerText
                        If ndList(i).Item("ghdwmc") IsNot Nothing Then ghdwmc = ndList(i).Item("ghdwmc").InnerText
                        If ndList(i).Item("ghdwdzdh") IsNot Nothing Then ghdwdzdh = ndList(i).Item("ghdwdzdh").InnerText
                        If ndList(i).Item("ghdwsbh") IsNot Nothing Then ghdwsbh = ndList(i).Item("ghdwsbh").InnerText
                        If ndList(i).Item("ghdwyhzh") IsNot Nothing Then ghdwyhzh = ndList(i).Item("ghdwyhzh").InnerText
                        If ndList(i).Item("hjje") IsNot Nothing Then hjje = ndList(i).Item("hjje").InnerText
                        If ndList(i).Item("hjse") IsNot Nothing Then hjse = ndList(i).Item("hjse").InnerText
                        If ndList(i).Item("jshj") IsNot Nothing Then jshj = ndList(i).Item("jshj").InnerText
                        If ndList(i).Item("bz") IsNot Nothing Then bz = ndList(i).Item("bz").InnerText
                        If ndList(i).Item("fpzt") IsNot Nothing Then fpzt = ndList(i).Item("fpzt").InnerText
                    Next
                    If fphm <> Nothing Then
                        Dim ndr As DataRow = DataTables("表b").addnew
                        ndr("开piao日期") = kprq.SubString(0,4) + "-" + kprq.SubString(4,2) + "-" + kprq.SubString(6,2)
                        ndr("fa piao代码") = fpdm
                        ndr("fa piao号码") = fphm
                        ndr("客户名称") =ghdwmc
                        ndr("地址电话") =ghdwdzdh
                        ndr("纳税人识别号") = ghdwsbh
                        ndr("开户银行及账号") = ghdwyhzh
                        ndr("合计金额") = hjje
                        ndr("合计税额") = hjse
                        ndr("价税合计") = jshj
                        ndr("备注") = bz
                        ndr("fa piao状态") = fpzt
                       
                        ndr("文件名") = str
                        ndList = xmlDoc.GetElementsByTagName("fyxm")(0).ChildNodes
                        For i As Integer = 0 To ndList.count - 1
                            Dim spmc As String = ndList(i).Item("spmc").InnerText
                            Dim ggxh As String = ndList(i).Item("ggxh").InnerText
                            Dim sl As String = ndList(i).Item("sl").InnerText
                            Dim se As String = ndList(i).Item("se").InnerText
                            Dim dw As String = ndList(i).Item("dw").InnerText
                            Dim spsl As String = ndList(i).Item("spsl").InnerText
                            Dim dj As String = ndList(i).Item("dj").InnerText
                            Dim je As String = ndList(i).Item("je").InnerText
                            Dim r As Row = Tables("表A").AddNew
                            r("fa piao代码") = fpdm
                            r("fa piao号码") = fphm
                            r("客户名称") = ghdwmc
                            r("货物或服务名称") = spmc
                            r("规格") = ggxh
                            r("单位") = dw
                            r("数量") = spsl
                            r("单价") = dj
                            r("税率") = sl
                            r("税额") = se
                            r("金额") = je
                            r("fa piao状态") = fpzt
                            ndr("文件名") = str
                        Next
                    End If
                End If
            End If
        Next
    Next
    Tables("表A").ResumeRedraw
    DataTables("表b").DeleteFor("fa piao状态 = '2'")
    For Each s As String In DataTables("表A").GetValues("fa piao号码", "fa piao状态 = '3'")
        DataTables("表A").DeleteFor("fa piao号码 = '" & s & "' and fa piao状态 = '0'")
    Next
    For Each s1 As String In DataTables("表b").GetValues("fa piao号码", "fa piao状态 = '3'")
        DataTables("表b").DeleteFor("fa piao号码 = '" & s1 & "' and fa piao状态 = '0'")
    Next
End If

 回到顶部
总数 51 1 2 3 4 5 6 下一页