InstallContactAboutSupport

Announcement

Recent posts

Current Status

Amazon token issues

Registering a user account

Latest update for all users:
Latest version details

Recent History

PayPal Checkout Cookies

Amazon Shipping VTR

#1 09-12-2020 01:16 pm

Simply NikNaks
Member
Simply NikNaks

Script - How to access Package?

I use Package to determine if I need to send an item as Large Letter or Parcel
Can I access Package in Script? If so, where is it held? I cannot find the appropriate field in the structure

Offline

#2 09-12-2020 01:20 pm

Andrew
Admin
Andrew

Re: Script - How to access Package?

It's in Record.Invoice.Items(n).Package

Offline

#3 09-12-2020 01:35 pm

Simply NikNaks
Member
Simply NikNaks

Re: Script - How to access Package?

Thanks - but I'm after the overall Package Total of the order not the individual Package Value of a particular item.
Basically, I set Package to a value less than 1 if the item is Large Letter. If I can get 2 items in before the package goes from a Large Letter to a Parcel I use a value of 0.49. If I can get 4 items in I set Package to a value of 0.24, etc.
So I am trying to figure out the overall Package total of the order to determine if the parcel size is Large Letter or Parcel (i.e. the Package value as it appears on the main screen for the order)

Offline

#4 09-12-2020 01:49 pm

Ben
Admin
Ben

Re: Script - How to access Package?

In script you'd have to get that total yourself, for example like this:
 
    'Pass items array into function to get total package back    
    Dim Package As Decimal = GetTotalPackage(Record.Invoice.Items)
    
    Function GetTotalPackage(Items() As ItemStruct)
        Dim Package As Decimal
        
        For Each Item As ItemStruct In Items
            Package += (Item.Package * Item.Quantity)
        Next
        
        Return Package
    End Function

Offline

Board footer