the Follwoing code exports information to a text file. I need to change it slightly so that it adds all the pay information as a total and then writes it to the header line. I commented in code what needs to happen or is happening.
sql = "select s.sidstrNAME_IND, s.sidstrST_ADDR, s.sidstrADDR_CITY, s.sidstrSTATES_US, s.sidstrZIP_CODE, p.strPayPeriod, " _
& "p.strTotalEntitlement, p.strTTWH, p.strMilesPay FROM cms.dbo.tblsidpers as s INNER JOIN tblSadPay as p on " _
& "p.strSSN = s.sidstrSSN_SM where dtPayPaid is not null and p.intUICID = (select intUICID from tblUIC " _
& "where intTaskForceID = " & ddlTaskForce.SelectedValue & " and strUIC = '" & DDLUIC.SelectedValue & "') " _
& "UNION " _
& "select s.strName, s.strAddress, s.strCity, s.strState, s.strZip, p.strPayPeriod, p.strTotalEntitlement, p.strTTWH, p.strMilesPay " _
& "FROM MNAIrForcePersonnel.dbo.tblMnAirPersonnel as s INNER JOIN tblSadPay as p on p.strSSN = s.strSSN " _
& "where dtPayPaid is not null and p.intUICID = (select intUICID from tblUIC where intTaskForceID = " & ddlTaskForce.SelectedValue & " " _
& "and strUIC = '" & DDLUIC.SelectedValue & "') order by s.sidstrNAME_IND"
myDataTable = New DataTable
myDataTable = getData(sql)
theCounter = 1
For Each myDataRow In myDataTable.Rows
Name = addSpaces(myDataRow(0), 45)
StAddr = addSpaces(myDataRow(1), 50)
City = addSpaces(myDataRow(2), 15)
State = addSpaces(myDataRow(3), 2)
Zip = addSpaces(myDataRow(4), 9)
payRow = payStart & addSpaces(CStr(theCounter), 17)
theCounter = theCounter + 1
milesRow = milesStart & addSpaces(CStr(theCounter), 17)
theCounter = theCounter + 1
tempLine = Name & addSpaces("", 90) & StAddr & City & State & Zip
payRow += tempLine & addSpaces(myDataRow(5), 30) & "00" & formatPay(CDbl(myDataRow(6)) - CDbl(myDataRow(7))) & addSpaces("", 10)
milesRow += tempLine & addSpaces("Miles", 30) & "00" & formatPay(CDbl(myDataRow(8))) & addSpaces("", 10)
???????????????????
For the mydatarow 7 & 8 I need to add these all together when the loop is done and then add them into a healer line which is above this code.
theFile.WriteLine(payRow)
theFile.WriteLine(milesRow)
Next
theFile = Nothing
fso = Nothing