() AS 
BEGIN

DECLARE @cu int SET @cu = perfect.GetCu(0, 1) IF @cu = 0 RETURN
EXEC perfect.PutHeader('Menu', @cu)

SELECT '
<p><a target=_blank href=userguide>User Guide</a>

<p>Customers: <a href=ListCust>List All</a> | <a href=ListCustCurrent>Current</a> | <a href=AddCust>New</a> 
| <a href="FindCust?f2=Id&o1=E&v3=">Find by Id</a>
| <a href="FindCust?f2=PolicyNumber&o1=E&v3=">Find by Policy Number</a>
| <a href="FindCust?f2=Postcode&o1=B&v3=">by Postcode</a> 
| <a href="FindCust?f4=LastName&o2=C&v5=&o1=A&f6=FirstName&o3=C&v7=">by Name</a>
| <a href="FindCust?f2=TradeName&o1=C&v3=">by Tradename</a> | <a href="FindCust?f2=Email&o1=C&v3=">by Email</a>
| <a href="/FindCust?f2=Magazine&o1=E&v3=1&a=Go">Magazine</a>
| <a href="/CsvCustMagazine">Magazine Data</a>

<p><a href="ListCart">Carts</a> 
| <a href="ListCartUnpaid">Unpaid Apps</a>
| <a href="/FindCart?f2=id&o1=E&v3=">Find by Id</a> | <a href="ListCartDupPaid">Paid more than once</a> | <a href="UncheckedDocuments">Unchecked Documents</a> | <a href="ListCustNote">Notes</a> 
| <a href="FindPaymentResponseValue?f4=Name&o2=E&v5=RESPONSECODE&o1=A&f6=Value&o3=N&v7=A&a=Go">Payment Failures</a>
| <a href="ListCartTotalNotPolicyTotal">Cart/Policy Total Different</a>

<p>Applications : <a href="ListApplicationManual">Manual Rated</a> | <a href="ListApplication">All</a> | <a href="ListApplicationPaid">Paid</a>

<p>Policies: <a href="ListPolicyRenewDue">Renew email due</a> | <a href="/FindPolicy?f8=CoverStart&o4=Q&v9=0&o2=A&f10=CoverStart&o5=R&v11=-100&o1=A&f6=PolicyKind&o3=N&v7=New+Business&a=Go">Coming up for renewal</a> 
- <a href="/CsvPolicyComingUpForRenewal">Csv</a>
- <a href="/CsvPolicyComingUpForRenewalInternal">Internal Csv</a>
| <a href="/FindPolicy?f16=CoverStart&o8=Q&v17=0&o4=A&f18=CoverStart&o9=R&v19=-100&o2=A&f10=PolicyKind&o5=N&v11=New+Business&o1=A&f6=HasOddPremium&o3=E&v7=1&a=Go">Odd Premium</a>
| <a href="/FindPolicy?f2=Paid&o1=Q&v3=365&a=Go">Paid</a>
| <a href="/CsvPolicyLastYear">Paid(CSVlast year)</a>
| <a href="/FindPolicyNonDup?f4=CoverStart&o2=R&v5=0&o1=A&f12=Unpaid&o6=E&v13=1&o3=A&f14=PolicyKind&o7=E&v15=Renewal&a=Go">Did not renew</a> <a href="/DidNotRenewCsv">Csv</a>
| <a href="/FindPolicy?f2=PolicyKind&o1=E&v3=New Business&a=Go">New business</a> <a href="https://policy.bmib.ie/CsvPolicyNewBusiness">Csv</a> 
| <a href="/FindPolicy?f2=PolicyKind&o1=E&v3=Mid-term+adjustment&a=Go">Mid-term Adj.</a>
| <a href="/FindPolicy?f2=PolicyKind&o1=E&v3=Transfer+from+HIS+%28+non+BMIB+%29&a=Go">From HIS (Non BMIB)</a>
| <a href="/FindPolicy?f2=PolicyKind&o1=E&v3=Transfer+from+HIS+%28+BMIB+%29&a=Go">From HIS (BMIB)</a>
| <a href="/ListPolicyPrevBeauty">Prev insurance Prof Beauty</a>
| <a href="/CsvPolicyPrevBeauty">Csv</a>
| <a href="/ListPolicyPrevWestminster"> Prev insurance Westminster</a>
| <a href="/CsvPolicyPrevWestminster">Csv<a/>
| <a href="/CsvPolicyLastYearBusEquip"> Has Bus Equip</a>
| <a href="/FindPolicy?f4=Price&o2=E&v5=Beauty&o1=A&f6=PolicyKind&o3=B&v7=&a=Go">Beauty</a>
| <a href="/CsvPolicy">Csv data</a>

<p>Claims: <a href="/ListClaim">List All</a>

<p>Paid Policies Csv <a href="/CsvPolicyWeekly?weeks=1">Last Week</a> | <a href="/CsvPolicyWeekly?weeks=2">Week Before Last</a> 
| <a href="/ListPolicyMonth">By Month</a>

<p><a href="/FindEmailSent?o4=F&f4=recipient&o2=C&o5=&v5=&i2=I&o1=A&o6=F&f6=Sent&o3=Q&o7=&v7=10&i3=I&i1=I">Find Sent Email</a>
| <a href="/FindEmailSent?f4=title&o2=C&v5=fail&o1=A&f6=Sent&o3=Q&v7=10&a=Go">Find By Title</a>
| <a href="/ListEmailOutErrorLog">Error Log</a> | <a href="/ListEmailOut">Mail Queue</a>

<p><a href=ListPrice>Prices</a> <a href=CsvPrice>Csv</a> | <a href=AddPrice>New Price</a> | <a href=ListCoverType>Cover Types</a> <a href=CsvCoverType>Csv</a> | <a href=ListAssociationView>Associations</a> <a href="CsvAssociationView">(CSV)</a>| <a href=AddAssociation>New Association</a> | <a href=ListAppCategory>App Categories</a>

<p><a href=ListTreatmentStat>Treatments</a> | <a href=ListTreatmentDeleted>Deleted</a> 
| <a href="FindTreatment?f2=Alt&o1=N&v3=0&a=Go"> Mapped (Alt)
| <a href=CsvTreatment>Csv All</a> | <a href=CsvWebHolisticTreatment>Csv Web Holistic</a> | <a href=CsvWebBeautyTreatment>Csv Web Beauty</a>

| <a href=AddTreatment>New Treatment</a> | <a href="FindTreatment?f2=WebBeauty&o1=E&v3=1&a=Go">Find Treatment</a> 
| <a href=ListEndorsement>Endorsements</a> 
| <a href=ListEndorsementById>By Id</a>
| <a href="CsvEndorsement">Csv</a> 
| <a href=AddEndorsement>New Endorsement</a>

<p><a target=_blank href="/">Public site</a> | <a target=_blank href="http://www.bmib.ie">Old public site</a> | <a target=_blank href="http://www.bmib.ie/admin">Old public admin</a> 

'

+ CASE WHEN perfect.HasSuperRole(@cu) = 0 THEN '' ELSE '

<hr><a href=ListLogin>Logins</a> | <a href=AddLogin>New Login</a> | <a href=ListRole>Roles</a> | <a href=AddRole>New Role</a>

Static content <a href="ListDirectory">Directory List</a> | <a href="AddDirectory">Create Directory</a>

<hr>Application <a href="ShowSchema?k=8">Schema</a> |  <a href="ListStoredProcs?schema=website">Shared Procs</a>
| <a href="ListStoredFuncs?schema=website">Functions</a> | <a href="ListViews?schema=website">Views</a> 
| tf <a href="ListStoredFuncs?schema=tf">Functions</a>
| <a href="ListStoredFuncs?schema=f">Email Format</a>

<p>Handlers <a href="ListStoredProcs?schema=pubhandler">Application Custom</a> | <a href="ListStoredProcs?schema=handler">System Custom</a> | <a href=ListHandler>Compiled</a> | <a href=AddHandler>New Handler</a> | <a href=RecompileAll>Compile All</a>

<p>Database <a href=ListTable>Tables and Views</a> | <a href=ListSchema>Schemas</a>

<p>perfect <a href="ShowSchema?k=6">Schema</a> | <a href="ListStoredProcs?schema=perfect">Procedures</a> | <a href="ListStoredFuncs?schema=perfect">Functions</a> 
| <a href="ListTriggers?schema=perfect">Triggers</a> | <a href="ListViews?schema=perfect">Views</a> 

<p><a href=RoutineSearch>Search Code</a> | <a href="FindHandlerItem?o2=F&f2=Sql&o1=C&o3=&v3=&i1=I">Handler Item Search</a>
| <a href=ListReferenceErrors>Reference Errors</a> | <a href=ListExpReference>Exp Refs</a> | <a href=ListExpReferenceT>Exp Ref Rev</a> | <a href=ListObjectUsage>All objects with usage</a>

<p><a href=Tidyup>Delete temp data</a> | <a href=BackupDatabase>Backup Database</a> | <a href=ShowDiskUsage>Show Disk Usage</a>
 | <a href=ListMessageLog>Message Log</a>

<p>(OBSOLETE) <a href=ListMailQueue>Mail Queue</a> | <a href=RestartMail>Restart Mail</a>
 | <a href=ListSentEmail>Emails sent in last 2 days</a>


'

END

EXEC perfect.PutTrailer()


END