• Hi Phil,

    Please find the script component code below....

    Option Explicit Off

    Option Strict Off

    Imports System

    Imports System.Data

    Imports System.Math

    Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper

    Imports Microsoft.SqlServer.Dts.Runtime.Wrapper

    Imports System.IO

    Imports System.Text

    <Microsoft.SqlServer.Dts.Pipeline.SSISScriptComponentEntryPointAttribute> _

    <CLSCompliant(False)> _

    Public Class ScriptMain

    Inherits UserComponent

    Dim fPHTaxReport As FileStream

    Dim swPHTaxWriter As StreamWriter

    Dim UTF8Encoding As Encoding

    Public Overrides Sub Input0_ProcessInputRow(ByVal Row As Input0Buffer)

    Dim FileFormat As String = Me.Variables.varfileformat.ToString()

    Try

    Dim strtarget As String = Me.Variables.varTargetFilepath.ToString + "Consolidated Report to PH Tax Department_" + DateTime.Now.ToString("yyyyMMddhhmm") + FileFormat

    fPHTaxReport = New FileStream(strtarget, FileMode.Append, FileAccess.Write)

    swPHTaxWriter = New StreamWriter(fPHTaxReport, UTF8Encoding.UTF8)

    If Row.RecordType = "H" Then

    swPHTaxWriter.WriteLine(Row.RecordType + "|" + _

    Row.TransactionType + "|" + _

    Row.TINNumber + "|" + _

    Row.OwnersRegisteredName + "|" + _

    Row.OwnersLastName + "|" + _

    Row.OwnersFirstName + "|" + _

    Row.OwnersMiddleName + "|" + _

    Row.OwnersTradeName + "|" + _

    Row.OwnersAddress1 + "|" + _

    Row.OwnersAddress2 + "|" + _

    CStr(Row.ExemptSales) + "|" + _

    CStr(Row.ZeroRatedSales) + "|" + _

    CStr(Row.TaxableSales) + "|" + _

    CStr(Row.OutputTax) + "|" + _

    Row.RDOCode + "|" + _

    Row.TaxableMonth + "|" + _

    Row.FiscalYearEnding)

    ElseIf (Row.RecordType = "D") Then

    swPHTaxWriter.WriteLine(Row.RecordType + "|" + _

    Row.TransactionType + "|" + _

    Row.TINNumber + "|" + _

    Row.OwnersRegisteredName + "|" + _

    Row.OwnersLastName + "|" + _

    Row.OwnersFirstName + "|" + _

    Row.OwnersMiddleName + "|" + _

    Row.OwnersAddress1 + "|" + _

    Row.OwnersAddress2 + "|" + _

    CStr(Row.ExemptSales) + "|" + _

    CStr(Row.ZeroRatedSales) + "|" + _

    CStr(Row.TaxableSales) + "|" + _

    CStr(Row.OutputTax) + "|" + _

    Row.RDOCode + "|" + _

    Row.TaxableMonth)

    End If

    swPHTaxWriter.Flush()

    fPHTaxReport.Close()

    Catch ex As Exception

    swPHTaxWriter.Flush()

    fPHTaxReport.Close()

    Throw ex

    End Try

    End Sub

    End Class

    Thanks