`
ticojj
  • 浏览: 157706 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

修改后代码

 
阅读更多

Private Sub GenerateTaxFileXml(ByRef iTaxYr As Short)  
        On Error GoTo erhd  
        Dim sFileName As String  
        Dim oFileSys As Scripting.FileSystemObject  
        Dim xmlDoc As MSXML2.DOMDocument  
        Dim Root As MSXML2.IXMLDOMElement  
 
        Dim oTextStream As Scripting.TextStream  
 
        Dim oSQL As ClsMySQL  
        'Dim rsRv As ADODB.Recordset  
        Dim sBuffer As String  
        Dim sBufferHeader As String  
 
        Dim sEmpyrTaxFIleNo As String  
        Dim sEmpyrNm As String  
        Dim sDesgn As String  
        Dim lRecordCount As Integer  
        Dim cTotAmt As Decimal  
        Dim lBtNo As Integer  
        Dim sSubDte As String  
        Dim sMsg As String  
 
        oSQL = New ClsMySQL  
 
        sFileName = GetExportDir() & VB6.Format(iTaxYr, "0000") & sTaxFile  
        oFileSys = New Scripting.FileSystemObject  
 
  'delete old tax file  
       If oFileSys.FileExists(sFileName) Then  
           oFileSys.DeleteFile(sFileName)  
       End If
      
        '生成一个XML DOMDocument对象  
        xmlDoc = New MSXML2.DOMDocument  
 
        '生成根节点并把它设置为文件的根  
        Root = xmlDoc.createElement("IR56B")  
        xmlDoc.documentElement = Root  
        '在节点上添加多个属性  
        Call Root.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance")  
        Call Root.setAttribute("xmlns", "http://www.kingdee.com/ReK3Inventory")  
       
       
         Using gConAPCA As New OleDbConnection(gStrAPCA)  
            oSQL.ReSet_Renamed()  
            oSQL.SqlType = ClsMySQL.StatmentType.TYPE_SELECT  
            oSQL.AddTable("TBL_APCA_FST_PTY_INFO")  
            oSQL.AddFields("TAX_FL_NO", "NM", "DESGN")  
 
            gReader = QueryByReader(gConAPCA, oSQL.SQL)  
 
            If gReader.Read Then  
                sEmpyrTaxFIleNo = Null2Str(gReader("TAX_FL_NO"))  
                sEmpyrNm = Null2Str(gReader("NM"))  
                sDesgn = Null2Str(gReader("DESGN"))  
 
            End If  
            gReader.Close()  
 
            oSQL.ReSet_Renamed()  
            oSQL.AddTable("TBL_APCA_TAX_REPORT")  
            oSQL.AddSimpleFuncField("COUNT", , , "REC_COUNT")  
            oSQL.AddSimpleFuncField("SUM", "TOT_INCOME", , "TOT")  
            oSQL.AddFields("BT_NO", "SUB_DTE")  
            oSQL.AddGroupBy("BT_NO")  
            oSQL.AddGroupBy("SUB_DTE")  
 
            gReader = QueryByReader(gConAPCA, oSQL.SQL)  
 
            If gReader.Read Then  
                lRecordCount = Null2Zero(gReader("REC_COUNT"))  
                cTotAmt = Null2Zero(gReader("TOT"))  
                lBtNo = CInt(Null2Str(gReader("BT_NO")))  
                sSubDte = VB6.Format(gReader("SUB_DTE").ToString, "YYYYMMDD")  
            End If  
            gReader.Close() 
       
       
       
       
        '添加二级节点
        Dim Section As MSXML2.IXMLDOMElement
        Section=xmlDoc.createElement("Section")
        Section.text=sEmpyrTaxFIleNo
        xmlDoc.appendChild Section
       
        Dim Section As MSXML2.IXMLDOMElement
        ERN=xmlDoc.createElement("ERN")       
        ERN.text=lBtNo
        xmlDoc.appendChild ERN
       
        ' and so on
      
      
        Dim Employee As MSXML2.IXMLDOMElement
        xmlDoc.appendChild Employee
        '添加Employee三级节点
       
 
 
 
 
        '-------------以下不用------------------------  


 
        oTextStream = oFileSys.OpenTextFile(sFileName, Scripting.IOMode.ForWriting, True)  
       
 
            sBuffer = FillStringWithSpaceRight(VB.Left(sEmpyrTaxFIleNo, 3), 3)  
            sBuffer = sBuffer & FillStringWithSpaceRight(VB.Right(sEmpyrTaxFIleNo, 8), 8)  'Section 
            sBuffer = sBuffer & FillStringWithSpaceRight(CStr(iTaxYr), 4)  'YrErReturn 
            sBuffer = sBuffer & FillStringWithSpaceRight(sSubDte, 8)   'SubDate
            sBuffer = sBuffer & FillStringWithZero(CStr(lBtNo), 5)   'ERN
            sBuffer = sBuffer & New String("0", 6)  
            sBuffer = sBuffer & Space(9)  
            sBuffer = sBuffer & FillStringWithSpaceRight(sEmpyrNm, 70)    'ErName
            sBuffer = sBuffer & FillStringWithSpaceRight(sDesgn, 25)   'Designation
            sBuffer = sBuffer & FillStringWithZero(CStr(lRecordCount), 5)   'NoRecordBatch
            sBuffer = sBuffer & FillStringWithZero(CStr(cTotAmt), 11)   'TotIncomeBatch
            sBuffer = sBuffer & Space(1480)  
            oTextStream.WriteLine(sBuffer)  
  '--------以下在用----
            oSQL.ReSet_Renamed()  
            oSQL.SqlType = ClsMySQL.StatmentType.TYPE_SELECT  
            oSQL.AddTable("TBL_APCA_TAX_REPORT")  
 
            sBufferHeader = FillStringWithSpaceRight(VB.Left(sEmpyrTaxFIleNo, 3), 3)  
            sBufferHeader = sBufferHeader & FillStringWithSpaceRight(VB.Right(sEmpyrTaxFIleNo, 8), 8)  
            sBufferHeader = sBufferHeader & FillStringWithSpaceRight(CStr(iTaxYr), 4)  
            sBufferHeader = sBufferHeader & FillStringWithSpaceRight(sSubDte, 8)  
            sBufferHeader = sBufferHeader & FillStringWithZero(CStr(lBtNo), 5)  
 
 
            gReader = QueryByReader(gConAPCA, oSQL.SQL)  
           
            Do While gReader.Read    
                sEmpyrTaxFIleNo = Null2Str(gReader("TAX_FL_NO"))  
                sEmpyrNm = Null2Str(gReader("NM"))  
                sDesgn = Null2Str(gReader("DESGN")) 
             
            Dim SHEET_NO As  String
            Dim HK_ID As  String
            Dim STUS As  String
            Dim S_NM As  String
            Dim NM As  String
            Dim C_NM As  String
           
           SHEET_NO = Null2Zero(gReader("REC_COUNT"))
           HK_ID = Null2Zero(gReader("HK_ID"))
           STUS = Null2Zero(gReader("STUS"))
           S_NM = Null2Zero(gReader("S_NM"))
           NM = Null2Zero(gReader("NM"))
           C_NM = Null2Zero(gReader("C_NM"))   
               
           Dim SHEET_NO As MSXML2.IXMLDOMElement
        SHEET_NO=xmlDoc.createElement("SHEET_NO")
        SHEET_NO.text=SHEET_NO
        Employee.appendChild SHEET_NO    
                   
          Dim HK_ID As MSXML2.IXMLDOMElement
        HK_ID=xmlDoc.createElement("HK_ID")
        HK_ID.text=HK_ID
        Employee.appendChild HK_ID
       
        Dim STUS As MSXML2.IXMLDOMElement
        STUS=xmlDoc.createElement("STUS")
        STUS.text=STUS
        Employee.appendChild STUS
       
        Dim S_NM As MSXML2.IXMLDOMElement
        S_NM=xmlDoc.createElement("S_NM")
        S_NM.text=S_NM
        Employee.appendChild S_NM
       
        Dim NM As MSXML2.IXMLDOMElement
        NM=xmlDoc.createElement("NM")
        NM.text=NM
        Employee.appendChild NM
       
        Dim C_NM As MSXML2.IXMLDOMElement
        C_NM=xmlDoc.createElement("C_NM")
        C_NM.text=C_NM
        Employee.appendChild C_NM
       
           Loop     
  '---以下不用----
            
 
                sBuffer = sBufferHeader & FillStringWithZero(CStr(gReader("SHEET_NO").ToString), 6)  
                sBuffer = sBuffer & FillStringWithSpaceLeft(Null2Str(gReader("HK_ID")), 9)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("STUS")), 1)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("S_NM")), 20)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("NM")), 55)  
                sBuffer = sBuffer & FillChiStringWithSpaceRight(Null2Str(gReader("C_NM")), 50)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("GENDER")), 1)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("M_STUS")), 1)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("PASPT_NO")), 20)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("PASPT_ISSUE_BY")), 20)   '??
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("SPO_NM")), 50)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("SPO_HKID")), 9)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("SPO_PASPT_NO")), 20)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("SPO_PASPT_ISSUE_BY")), 20)  '??
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("R_ADDR")), 90)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("AR_CDE")), 1)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("CORR_ADDR")), 60)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("CAPCTY")), 40)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("PRIN_EMPYR")), 30)  
                sBuffer = sBuffer & VB6.Format(gReader("JOIN_DTE").ToString, "YYYYMMDD")  
                sBuffer = sBuffer & VB6.Format(gReader("CESS_DTE").ToString, "YYYYMMDD")  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("PRD_SLRY")), 19)  
                sBuffer = sBuffer & FillStringWithZero(Null2Str(gReader("SLRY")), 9)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("PRD_LEV_PAY")), 19)  
                sBuffer = sBuffer & FillStringWithZero(Null2Str(gReader("LEV_PAY")), 9)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("PRD_DIR_FEE")), 19)  
                sBuffer = sBuffer & FillStringWithZero(Null2Str(gReader("DIR_FEE")), 9)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("PRD_COMM")), 19)  
                sBuffer = sBuffer & FillStringWithZero(Null2Str(gReader("COMM")), 9)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("PRD_BNS")), 19)  
                sBuffer = sBuffer & FillStringWithZero(Null2Str(gReader("BNS")), 9)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("PRD_BACK_PAY")), 19)  
                sBuffer = sBuffer & FillStringWithZero(Null2Str(gReader("BACK_PAY")), 9)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("PRD_RETR_SCHM_PMNT")), 19)  
                sBuffer = sBuffer & FillStringWithZero(Null2Str(gReader("RETR_SCHM_PMNT")), 9)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("PRD_SLRY_TAX_EMPYR")), 19)  
                sBuffer = sBuffer & FillStringWithZero(Null2Str(gReader("SLRY_TAX_EMPYR")), 9)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("PRD_EDUC_BNF")), 19)  
                sBuffer = sBuffer & FillStringWithZero(Null2Str(gReader("EDUC_BNF")), 9)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("PRD_SHR_OPT_GAIN")), 19)  
                sBuffer = sBuffer & FillStringWithZero(Null2Str(gReader("SHR_OPT_GAIN")), 9) 
 
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("RWD_NATURE1")), 35)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("RWD_PRD1")), 19)  
                sBuffer = sBuffer & FillStringWithZero(Null2Str(gReader("RWD_AMT1")), 9)  
 
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("RWD_NATURE2")), 35)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("RWD_PRD2")), 19)  
                sBuffer = sBuffer & FillStringWithZero(Null2Str(gReader("RWD_AMT2")), 9)  
 
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("RWD_NATURE3")), 35)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("RWD_PRD3")), 19)  
                sBuffer = sBuffer & FillStringWithZero(Null2Str(gReader("RWD_AMT3")), 9)  
 
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("PRD_PNSN")), 19)  
                sBuffer = sBuffer & FillStringWithZero(Null2Str(gReader("PNSN")), 9)  
                sBuffer = sBuffer & FillStringWithZero(Null2Str(gReader("TOT_INCOME")), 9)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("R_IND")), 1)  
 
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("R_ADDR_1")), 110)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("R_NATURE_1")), 19)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("PRD_R_1")), 26)  
                sBuffer = sBuffer & FillStringWithZero(Null2Str(gReader("RENT_EMPYR_1")), 7)  
                sBuffer = sBuffer & FillStringWithZero(Null2Str(gReader("RENT_EMPYE_1")), 7)  
                sBuffer = sBuffer & FillStringWithZero(Null2Str(gReader("RENT_RFND_EMPYE_1")), 7)  
                sBuffer = sBuffer & FillStringWithZero(Null2Str(gReader("RENT_EMPYR_EMPYE_1")), 7)  
 
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("R_ADDR_2")), 110)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("R_NATURE_2")), 19)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("PRD_R_2")), 26)  
                sBuffer = sBuffer & FillStringWithZero(Null2Str(gReader("RENT_EMPYR_2")), 7)  
                sBuffer = sBuffer & FillStringWithZero(Null2Str(gReader("RENT_EMPYE_2")), 7)  
                sBuffer = sBuffer & FillStringWithZero(Null2Str(gReader("RENT_RFND_EMPYE_2")), 7)  
                sBuffer = sBuffer & FillStringWithZero(Null2Str(gReader("RENT_EMPYR_EMPYE_2")), 7)  
 
 
                If gReader("OSEA_AMT").Equals(DBNull.Value) And gReader("OSEA_ADDR").Equals(DBNull.Value) And gReader("OSEA_NM").Equals(DBNull.Value) Then  
                    sBuffer = sBuffer & "0" 
                Else  
                    sBuffer = sBuffer & "1" 
                End If  
 
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("OSEA_AMT")), 20)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("OSEA_NM")), 60)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("OSEA_ADDR")), 60)  
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("EMPYE_TAX_FL_NO")), 13)   '?
                sBuffer = sBuffer & FillStringWithSpaceRight(Null2Str(gReader("RMK")), 60)  
 
                oTextStream.WriteLine(sBuffer)  
                'rsRv.MoveNext()  
            Loop  
            '----------------以上不用----
            gReader.Close()  
 
            'End of file  
         '   oTextStream.Write(Chr(26))  
 
          '  oTextStream.Close()  
 
            oSQL.ReSet_Renamed()  
            oSQL.SqlType = ClsMySQL.StatmentType.TYPE_INSERT  
            oSQL.AddTable("TBL_APCA_AUD_LOG")  
 
            oSQL.AddField("USR")  
            oSQL.AddValue(sUserID)  
 
            oSQL.AddField("ACT")  
            oSQL.AddValue("S")  
 
            oSQL.AddField("LOG_TM")  
            oSQL.AddValue(VB6.Format(Today, "dd MMM YYYY") & " " & TimeOfDay)  
 
            oSQL.AddField("DESC")  
 
            sMsg = FormatMsg(My.Resources.str19011, CStr(iTaxYr), oFileSys.GetAbsolutePathName(sFileName))  
            oSQL.AddValue(sMsg)  
            'OpenRs(oSQL.SQL)  
 
            Call ExeNonQuery(gConAPCA, oSQL.SQL)  
 
 
            ShowInfo(sMsg)  
 
 
            '直接保存成文件即可  
            'xmlDoc.save(sFileName)  
 
            '调用IE浏览器打开xml文件  
            ShellExecute(Me.Handle.ToInt32, "explore", oFileSys.GetParentFolderName(sFileName) & vbNullChar, "", "", modShell.enuShowWindow.SW_SHOW)  
 
            oTextStream = Nothing  
            oFileSys = Nothing  
            'rsRv = Nothing  
            oSQL = Nothing  
        End Using  
 
        Exit Sub  
erhd:  
        oTextStream = Nothing  
        oFileSys = Nothing  
        'rsRv = Nothing  
        oSQL = Nothing  
        MyErrorRaise(Err.Description)  
    End Sub 

分享到:
评论

相关推荐

    Apriori修改后代码

    Apriori修改后代码

    springboot560实训管理系统的设计与实现修改后代码(1)pf.zip

    springboot560实训管理系统的设计与实现修改后代码(1)pf.zip

    Debug时修改代码能即时生效.

    理想状态下,开发者希望在Debug过程中修改代码后能够立即看到效果,以便迅速定位问题和验证修复方案的有效性。然而,传统的开发环境并不支持在不重启应用的情况下直接修改代码并立即生效,这无疑降低了开发效率和...

    查看修改源代码工具

    标题中的“查看修改源代码工具”指的是用于浏览和编辑计算机程序源代码的软件。这类工具在编程和软件开发过程中起着至关重要的作用,因为它们允许开发者深入理解代码结构,进行调试,优化,以及修复错误。源代码是...

    修改代码的艺术.ppt

    4. **保持可读性**:修改后的代码应该更易于理解和维护,遵循良好的编程规范和命名约定。 5. **持续集成**:将修改后的代码及时合并到主分支,避免出现分支冲突。 其次,工具在代码修改过程中起着关键作用。例如: ...

    C#窗体修改密码的代码

    C#窗体修改密码的代码 在这里,我们将详细讨论C#窗体修改密码的代码,该代码适用于C#初学者,...该代码提供了一个基本的密码修改功能,使用C#语言和WINDOWS窗体制作数据库系统,并且提供了多个知识点供学习和扩展。

    修改代码的艺术

    本书主要讲的是在对遗留代码进行修改前,要进行的准备工作,即安置单元测试,保护当前代码的已有行为,并在此基础上引入测试驱动开发。如何把测试安置到遗留代码中,并不是一件简单的事情,本书正是为了让我们做到这...

    Linux 内核代码修改

    6. **编写测试**:修改内核代码后,编写或更新测试用例至关重要。`prinfo_test.c`很可能是这样的测试用例,确保你的改动没有引入新的错误。 7. **编译与调试**:使用`make`命令编译内核,并通过`make modules_...

    vscode中, git只提交部分修改的代码文件.docx

    - 在源代码管理面板中,你会看到两种类型的更改:“已修改(Modified)”和“未追踪(Untracked)”。 - 对于**已修改的文件**,你可以通过点击文件旁边的 "+" 或 "-" 符号来选择要暂存的部分更改。例如,如果你只想...

    java实现的svn统计修改代码行数完整源码

    在给出的源码中,`.classpath`和`.project`是Eclipse项目的配置文件,`src`包含了源代码,`release`可能是项目构建后的输出,`.settings`存储了项目的个性化设置,而`config`可能包含了一些配置信息。这些文件可能并...

    Android Studio使用Kotlin时,修改代码后运行不生效的解决方法

    结果却发现,修改 String 资源后,“运行”,修改的内容没有生效。一开始以为只是 String 资源是这样,于是试了下 kt 文件,结果发现“运行”也不能生效。 但是先 clean 了,再“运行”,却可以正常编译出来。查了...

    ROS代码修改版

    - 添加或更新软件包的文档,使其他开发者更容易理解和使用修改后的代码。 在实际操作中,开发者可能会使用版本控制系统(如Git)来管理代码的变更,这样可以追踪每一次修改,方便回溯或协作。同时,为了确保修改后...

    最好的代码批量修改工具

    代码批量修改工具代码批量修改工具代码批量修改工具代码批量修改工具代码批量修改工具代码批量修改工具代码批量修改工具

    更改CPU名称,重启奏效(100% 真实)_修改cpu信息重启不变代码-CSDN博客.html

    更改CPU名称,重启奏效(100% 真实)_修改cpu信息重启不变代码-CSDN博客.html

    《修改代码的艺术》PDF版本下载.txt

    - **结果验证**:通过实际案例演示如何验证修改后的代码是否达到了预期的效果。 ### 三、目标读者群 - **软件开发人员**:无论是新手还是资深开发者,都可以从中学习到实用的代码修改技巧。 - **项目经理**:了解...

    079各类代码 修改WZ专用

    这里我们关注的是一个关于"079各类代码 修改WZ专用"的主题,这个压缩包包含了一系列与冒险岛游戏相关的代码资源,主要用于修改WZ职业(可能是游戏中的一种职业角色)的数据。 首先,我们来看《WZ职业技能代码.docx...

    Jetbrains IntelliJ IDEA,PhpStorm,WebStorm,Pycharm,CLion批量修改多行代码的方法

    这种方式非常适合于更改变量名、函数名、添加或删除相同的代码片段,或者进行其他需要一致性的修改。 除了以上基本操作,JetBrains IDEs还提供了更高级的批量编辑功能。比如,你可以使用Live Templates快速插入预定...

    修改代码的艺术(扫描高清中文pdf版)

    修改代码的艺术(扫描高清中文pdf版) 9part,共13part

Global site tag (gtag.js) - Google Analytics