This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #CSV file is in this format: | |
| #CustomerNbr,Description,Qty,UnitPrice,PaymentMethod | |
| #CUST1,Services for June 2020,1,100,UPSUSD | |
| #CUST2,Services for May 2020,2,200,UPSUSD | |
| #CUST3,Services for April 2020,3,300,UPSUSD | |
| $WebSession = New-Object Microsoft.PowerShell.Commands.WebRequestSession | |
| Login-Acumatica -WebSession $WebSession |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Function Check-Invoice | |
| { | |
| param( | |
| [Parameter(Mandatory=$true)] | |
| [Microsoft.PowerShell.Commands.WebRequestSession]$WebSession, | |
| $EndPoint = $env:AcumaticaTestEndPoint, | |
| [Parameter(Mandatory=$true)] | |
| $DocDesc, | |
| [Parameter(Mandatory=$true)] | |
| $CustomerNbr) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Function Pay-Invoice | |
| { | |
| param( | |
| [Parameter(Mandatory=$true)] | |
| [Microsoft.PowerShell.Commands.WebRequestSession]$WebSession, | |
| $EndPoint = $env:AcumaticaTestEndPoint, | |
| [Parameter(Mandatory=$true)] | |
| [string]$ReferenceNbr, | |
| [Parameter(Mandatory=$true)] | |
| [string]$PaymentMethod) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Function Create-Invoice | |
| { | |
| param( | |
| [Parameter(Mandatory=$true)] | |
| [Microsoft.PowerShell.Commands.WebRequestSession]$WebSession, | |
| $EndPoint = $env:AcumaticaTestEndPoint, | |
| $Body, | |
| [switch]$release) | |
| $Uri = "$EndPoint/entity/default/18.200.001/Invoice" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Function Get-Invoice | |
| { | |
| param( | |
| [Parameter(Mandatory=$true)] | |
| [Microsoft.PowerShell.Commands.WebRequestSession]$WebSession, | |
| $EndPoint = $env:AcumaticaTestEndPoint, | |
| [Parameter(Mandatory=$true)] | |
| $ReferenceNbr) | |
| $HashArguments = @{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Function Logout-Acumatica | |
| { | |
| param( | |
| [Parameter(Mandatory=$true)] | |
| [Microsoft.PowerShell.Commands.WebRequestSession]$WebSession, | |
| $EndPoint = $env:AcumaticaTestEndPoint | |
| ) | |
| $Uri = "$EndPoint/entity/auth/logout" | |
| $response = Invoke-RestMethod $Uri -Method 'POST' -Headers $headers -WebSession $WebSession |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Function Login-Acumatica | |
| { | |
| #This OutputType allows you to strongly type the return object from this function | |
| #In this case we are going to encapsulate the WebRequestSession object initialization and return it | |
| #to the calling process as to be used in other functions. This is needed as to pass the authentication | |
| #State to other functions that need it. Don’t forget to use the Logout-Acumatica function else you will incur | |
| #unnecessary User Logins if they are left open. | |
| [OutputType([Microsoft.PowerShell.Commands.WebRequestSession])] | |
| param( | |
| $User = $Null, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "Create A payment for invoice $ReferenceNbr" | |
| $body = @" | |
| { | |
| `"Type`": {`"value`": `"Payment`"}, | |
| `"CustomerID`": {`"value`": `"$CustomerNbr`"}, | |
| `"PaymentMethod`": {`"value`": `"$PaymentMethod`"}, | |
| `"PaymentAmount`": {`"value`": $UnitPrice}, | |
| `"DocumentsToApply`": [{`"ReferenceNbr`": {`"value`": `"$ReferenceNbr`"}}] | |
| } | |
| "@ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| "Releasing Invoice $ReferenceNbr" | |
| $body = @" | |
| { | |
| `"entity`":{`"id`": `"$EntityID`"} | |
| } | |
| $body | |
| "@ | |
| $HashArguments = @{ | |
| Uri = "$AcumaticaEndPoint/entity/default/18.200.001/Invoice/ReleaseInvoice" | |
| Method = 'POST' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $CustomerNbr = "ABARTENDE" | |
| $Description = "This was auto created with PowerShell" | |
| $InventoryID = "CONSULTING" | |
| $Qty = "1.000000" | |
| $UnitPrice = "100.000000" | |
| $UOM = "HOUR" | |
| #The @" and "@ tags declare a here string which allows you to have string declarations that run multiple lines | |
| $body = @" | |
| { |
NewerOlder