-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathViewInvoice.ascx.vb
executable file
·149 lines (108 loc) · 5.01 KB
/
ViewInvoice.ascx.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports DotNetNuke
Imports DotNetNuke.Common
Imports DotNetNuke.Common.Utilities
Imports DotNetNuke.Entities.Modules
Imports DotNetNuke.Entities.Modules.Actions
Imports DotNetNuke.Entities.Users
Imports DotNetNuke.Security
Imports DotNetNuke.Security.Roles
Imports DotNetNuke.Services.Exceptions
Imports DotNetNuke.Services.Localization
Imports DotNetNuke.Entities.Tabs
Imports DotNetNuke.UI.Utilities
Imports Ventrian.SubscriptionTools.Entities
Namespace Ventrian.SubscriptionTools
Partial Public Class ViewInvoice
Inherits ModuleBase
#Region " Private Members "
Private _receiptID As Integer = Null.NullInteger
#End Region
#Region " Private Methods "
Private Sub ReadQueryString()
If Not (Request("ReceiptID") Is Nothing) Then
_receiptID = Convert.ToInt32(Request("ReceiptID"))
End If
End Sub
Private Sub BindCrumbs()
Dim crumbs As New ArrayList
Dim objCrumbMain As New CrumbInfo
objCrumbMain.Caption = Localization.GetString("Main", LocalResourceFile)
objCrumbMain.Url = NavigateURL()
crumbs.Add(objCrumbMain)
Dim objViewInvoice As New CrumbInfo
objViewInvoice.Caption = Localization.GetString("ViewInvoice", LocalResourceFile)
objViewInvoice.Url = Me.Request.RawUrl
crumbs.Add(objViewInvoice)
rptBreadCrumbs.DataSource = crumbs
rptBreadCrumbs.DataBind()
End Sub
Private Sub BindInvoice()
Dim objReceiptController As New ReceiptController
Dim objReceipt As ReceiptInfo = objReceiptController.Get(_receiptID)
If (objReceipt Is Nothing) Then
Response.Redirect(NavigateURL, True)
End If
Dim objUserController As New UserController
Dim objUser As UserInfo = objUserController.GetUser(Me.PortalId, objReceipt.UserID)
If (objUser Is Nothing) Then
Response.Redirect(NavigateURL, True)
End If
Dim symbol As String = "$"
Dim currency As String = Me.Currency
If (objReceipt.Currency <> "") Then
currency = objReceipt.Currency
End If
Select Case currency.ToUpper
Case "USD"
symbol = "$"
Case "GBP"
symbol = "£"
Case "EUR"
symbol = "€"
Case "CAD"
symbol = "$"
Case "JPY"
symbol = "¥"
End Select
Dim invoice As String = Me.InvoiceTemplate
invoice = invoice.Replace("[CITY]", objUser.Profile.City)
invoice = invoice.Replace("[COUNTRY]", objUser.Profile.Country)
invoice = invoice.Replace("[DATE]", objReceipt.DateCreated.ToString("MMMM, dd yyyy"))
If (objReceipt.DateEnd <> Null.NullDate) Then
invoice = invoice.Replace("[EXPIRYDATE]", objReceipt.DateEnd.ToString("MMMM, dd yyyy"))
Else
invoice = invoice.Replace("[EXPIRYDATE]", "")
End If
invoice = invoice.Replace("[FIRSTNAME]", objReceipt.FirstName)
invoice = invoice.Replace("[FULLNAME]", objReceipt.FirstName & " " & objReceipt.LastName)
invoice = invoice.Replace("[LASTNAME]", objReceipt.LastName)
invoice = invoice.Replace("[DISPLAYNAME]", objReceipt.LastName)
invoice = invoice.Replace("[PORTALNAME]", Me.PortalSettings.PortalName)
invoice = invoice.Replace("[POSTALCODE]", objUser.Profile.PostalCode)
invoice = invoice.Replace("[QTY]", "")
invoice = invoice.Replace("[RECEIPTID]", objReceipt.ReceiptID.ToString())
invoice = invoice.Replace("[REGION]", objUser.Profile.Region)
invoice = invoice.Replace("[STATUS]", objReceipt.Status)
invoice = invoice.Replace("[STREET]", objUser.Profile.Street)
invoice = invoice.Replace("[SUBSCRIPTIONDESCRIPTION]", objReceipt.Description)
invoice = invoice.Replace("[SUBSCRIPTIONNAME]", objReceipt.Name)
invoice = invoice.Replace("[SUBSCRIPTIONPRICE]", symbol & objReceipt.ServiceFee.ToString("##0.00"))
invoice = invoice.Replace("[USERNAME]", objUser.Username)
lblInvoice.Text = "<pre>" & invoice & "</pre>"
End Sub
#End Region
#Region " Event Handlers "
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
ReadQueryString()
BindCrumbs()
BindInvoice()
Catch exc As Exception 'Module failed to load
ProcessModuleLoadException(Me, exc)
End Try
End Sub
#End Region
End Class
End Namespace