Skip to content

Instantly share code, notes, and snippets.

@lonelydimple
Created December 18, 2012 14:38
Show Gist options
  • Save lonelydimple/4328537 to your computer and use it in GitHub Desktop.
Save lonelydimple/4328537 to your computer and use it in GitHub Desktop.
CreateReportDoc function which is responsible for creating every ProgressRptUpdate First, the entire function, Then, the relevant bit for us.
Sub CreateReportDoc(isManual,PerVal)
Set PRdoc = PRdb.CreateDocument
Set doc = view.GetDocumentByKey(PRUNIDdoc.bondNumber, True)
If Not (doc Is Nothing) Then
PRdoc.Form = "ProgressReportUpdate"
agency = PRUNIDdoc.Agency(0)
agencytext = Cstr(agency)
howlong = Len(agencytext)
'pad the AgencyID value
leadZeros = Evaluate(|@Repeat("0";5-@Length("| + agencytext + |"))|)
agencytext = leadZeros(0) + agencytext
PRdoc.Agency = agencytext
PRdoc.bondNumber = PRUNIDdoc.bondNumber
PRdoc.principal = PRUNIDdoc.Principal
PRdoc.sendTo = PRUNIDdoc.sendTo(0)
PRdoc.SendToAdd1 = PRUNIDdoc.address1(0)
PRdoc.SendToAdd2 = PRUNIDdoc.address2(0)
PRdoc.SendToCity = PRUNIDdoc.city(0)
PRdoc.SendToState = PRUNIDdoc.state(0)
PRdoc.SendToZip = PRUNIDdoc.zip(0)
PRdoc.obligee= doc.BDOBLG(0)
PRdoc.city = doc.BDCITY(0)
PRdoc.state = doc.BDST(0)
upperCase$ = doc.PrincipalUNID(0)
Set Principaldoc = Principalview.GetDocumentByKey(upperCase$, True)
If Not (Principaldoc Is Nothing ) Then
BF = Principaldoc.BranchFile(0)
If BF = "Yes" Then
PRdoc.OfficeLoc = "TX"
Else
PRdoc.OfficeLoc = "IA"
End If
End If
PRdoc.contractAmt = PRUNIDdoc.BDBAMT
PRdoc.phone = PRUNIDdoc.phone
PRdoc.fax = PRUNIDdoc.fax
PRdoc.email = PRUNIDdoc.email
PRdoc.IssuedDt = PRUNIDdoc.BondDate
PRdoc.Description = PRUNIDdoc.jobDescription
PRdoc.ChangeStatus = "NoSubmit"
PRdoc.DocVersion ="1"
PRdoc.Period = PERVAL
PRdoc.underwriter = PRUNIDdoc.underwriter
PRdoc.assistant = PRUNIDdoc.assistant
PRdoc.SentMonth = PRUNIDdoc.MailDtMonth
PRdoc.SentDay = PRUNIDdoc.MailDtDay
PRdoc.SendMethod = PRUNIDdoc.SendMethod
If isManual = 1 Then
PRdoc.SHOWVIEW = "Show"
Else
PRdoc.SHOWVIEW = "Show"
End If
PRdoc.isManual = isManual
datesent = Cstr(Format( Date, "mmmm dd, yyyy" ))
PRdoc.SentDate = datesent
Redim Preserve listID(countdoc)
listID(countdoc) = PRUNIDdoc.bondNumber(0)
Call PRdoc.MakeResponse( PRUNIDdoc )
Call PRdoc.Save( True, False )
IDLen = Len(PRdoc.NoteID)
RanStr = ""
Lenval = 8
If IDLen >= 1 And IDLen <= Lenval Then
For i% = 1 To (Lenval - IDLen)
RanStr = RanStr + Chr(Int(Rnd*26)+65)
Next
IDStr = RanStr + PRdoc.NoteID
End If
PRdoc.AccessNumber = "NT" + IDStr
' If PRUNIDdoc.SendMethod(0) = "E-Mail" Then
' Call sendEmail
' End If
Call PRdoc.Save( True, False )
Else
' Print PRUNIDdoc.bondNumber, " was not added"
End If
End Sub
' line 63/64 from above
datesent = Cstr(Format( Date, "mmmm dd, yyyy" ))
PRdoc.SentDate = datesent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment