-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPoShEDI.psm1
167 lines (145 loc) · 3.48 KB
/
PoShEDI.psm1
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
$Public = @( Get-ChildItem -Path $PSScriptRoot\Public\*.ps1 -ErrorAction SilentlyContinue )
$Private = @( Get-ChildItem -Path $PSScriptRoot\Private\*.ps1 -ErrorAction SilentlyContinue )
#Dot source the files
Foreach($import in @($Public + $Private))
{
Try
{
. $import.fullname
}
Catch
{
Write-Error -Message "Failed to import function $($import.fullname): $_"
}
}
Export-ModuleMember -Function $Public.Basename
$Script:ModuleConfig = @{
EDIOUT = @{
ElementSeparator = '*'
CompositeElementSeparator = '>'
#Default to DUNS Number
SenderCode = ''
SenderCodeQualifier = '01'
}
SQL = @{
ServerInstance = ''
}
}
#Load classes for EDI Document Creation
class EDI850Header {
[ValidateLength(4,9)]
[string]$ControlNum
[ValidateLength(1,22)]
[string]$PONum
[datetime]$Date
[ValidateLength(0,50)]
[string]$VendorID
[ValidateLength(0,4096)]
[string]$Memo
[ValidateLength(1,60)]
[string]$BTName
[ValidateLength(2,80)]
[string]$BTAccountNumber
[ValidateLength(1,55)]
[string]$BTAddress
[ValidateLength(2,30)]
[string]$BTCity
[ValidateLength(2,2)]
[string]$BTState
[ValidateLength(3,15)]
[string]$BTZip
[ValidateLength(1,60)]
[string]$STName
[string]$STLocationID
[ValidateLength(1,55)]
[string]$STAddress
[ValidateLength(2,30)]
[string]$STCity
[ValidateLength(2,2)]
[string]$STState
[ValidateLength(3,15)]
[string]$STZip
[ValidateLength(1,60)]
[string]$BuyerName
[ValidateLength(1,256)]
[string]$BuyerEmail
[ValidateLength(1,256)]
[string]$BuyerPhone
EDI850Header (){
$this.Date = Get-Date
}
}
class EDI850Detail {
[decimal]$Quantity
[ValidateLength(2,2)]
$UOM
[ValidateLength(1,48)]
[string]$UPC
[ValidateLength(1,48)]
[string]$VendorCode
[nullable[decimal]]$Cost
[ValidateLength(1,80)]
[string]$Description
[ValidateLength(1,45)]
[string]$Note
}
class SPSInvoiceHeader {
[datetime]$InvoiceDate
[string]$InvoiceNumber
[datetime]$PODate
[string]$PONumber
<#
[string]$BillingName
[string]$BillingEMail
[string]$BillingPhone
[string]$BillingFax
#>
[string]$BillToName
[string]$BillToStreet
[string]$BillToCity
[string]$BillToState
[string]$BillToZip
[string]$BillToID
<#
[string]$RemitToName
[string]$RemitToStreet
[string]$RemitToCity
[string]$RemitToState
[string]$RemitToZip
[string]$RemitToID
#>
[string]$ShipToName
[string]$ShipToStreet
[string]$ShipToCity
[string]$ShipToState
[string]$ShipToZip
[string]$ShipToID
# [string]$VendorName
[string]$SenderCode
[string]$ExternalVendorID
[string]$InternalVendorID
[nullable[datetime]]$DiscountDueDate
[nullable[datetime]]$InvoiceDueDate
[string]$TermsDescription
[nullable[datetime]]$ShipDate
[decimal]$TaxTotal
[decimal]$TotalCost
[nullable[decimal]]$TotalCostTermsDiscount
[bool]$IsComplete
}
class SPSInvoiceDetail {
[string]$InvoiceNumber
[string]$SenderCode
[nullable[int]]$LineNumber
[decimal]$Quantity
[string]$UOM
[decimal]$UnitPrice
[string]$UnitPriceUnit
[nullable[decimal]]$TaxAmount
[string]$UPC
[string]$VendorCode
[string]$ItemDescription
[bool]$IsSAC = $false
[string]$SACCode
}
#endregion