Expression Editor Functions - Invoicing Category

Function

Description of Returned Value

BaseUnitPriceConverted

Returns the base unit price from the despatch order (with product pricing) and optionally converts it to the specified currency and unit of measure, and optionally rounds the result to the specified number of decimals.

Format: BaseUnitPriceConverted([Currency], [UOM], [Decimals])

Examples: For a price of USD 50 per metric tonne with a USD/AUD exchange rate of 0.72:

  • BaseUnitPriceConverted("AUD") returns 36
  • BaseUnitPriceConverted("AUD", "kg") returns 0.036
  • BaseUnitPriceConverted("AUD", "kg", 2) returns 0.04

If a currency is not specified, the price is returned in the currency in which it was initially entered. If a UOM is not specified, the price is returned in the UOM in which it was initially entered.

Note: This expression cannot be used with despatch orders for contracts with analyte pricing.

ContractActualDryMass

Returns the sum of the actual dry mass for the despatch orders in the contract.

Format: ContractActualDryMass()

ContractActualWetMass

Returns the sum of the actual wet mass for the despatch orders in the contract.

Format: ContractActualWetMass()

ContractEndDate

Returns the contract end date.

Format: ContractEndDate()

ContractProductActualDryMass

Returns the sum of the actual dry mass for the despatch orders for the contract product.

Format: ContractProductActualDryMass()

ContractProductActualWetMass

Returns the sum of the actual wet mass for the despatch orders for the contract product.

Format: ContractProductActualWetMass()

ContractQuotaActualDryMass

Returns the sum of the actual dry mass for the despatch orders in the contract quota.

Format: ContractQuotaActualDryMass()

ContractQuotaActualWetMass

Returns the sum of the actual wet mass for the despatch orders in the contract quota.

Format: ContractQuotaActualWetMass()

ContractStartDate

Returns the contract start date.

Format: ContractStartDate()

ContractTermActualDryMass

Returns the sum of the actual dry mass for the despatch orders in the contract term.

Format: ContractTermActualDryMass()

ContractTermActualWetMass

Returns the sum of the actual wet mass for the despatch orders in the contract term.

Format: ContractTermActualWetMass()

CurrentInvoiceUnitPrice

Returns the current invoice unit price, which is calculated as the sum of the unit prices of applicable invoice line items.

Format: CurrentInvoiceUnitPrice()

CurrentInvoiceValue

Returns the current invoice value.

Format: CurrentInvoiceValue()

CurrentInvoiceValueBeforeTax

Returns the current invoice value before tax.

Format: CurrentInvoiceValueBeforeTax()

DateOfAgreement

Returns the date of contract agreement.

Format: DateOfAgreement()

DryMass

Returns the dry mass, and optionally converts it to the specified UOM.

Format: DryMass([UOM])

Example: DryMass("mt")

The UOM can be the UOM alias, symbol or name.

FirstInvoiceDate

Returns the date of the first invoice generated for the despatch order.

Format: FirstInvoiceDate()

GetAdjustedLinkedPrice

Returns the adjusted linked price.

Format: GetAdjustedLinkedPrice()

GetAdjustedLinkedPriceConvertedTo

Returns the adjusted linked price in the specified unit of measure and currency.

Format: GetAdjustedLinkedPriceConvertedTo(Currency, UOM)

If a currency is not specified, the price is returned in the currency in which it was initially entered. If a UOM is not specified, the price is returned in the UOM in which it was initially entered.

GetBaseProductPrice

Returns the base product price.

Format: GetBaseProductPrice()

GetBaseProductPriceConvertedTo

Returns the base product price in the specified unit of measure and currency.

Format: GetBaseProductPriceConvertedTo(Currency, UOM)

If a currency is not specified, the price is returned in the currency in which it was initially entered. If a UOM is not specified, the price is returned in the UOM in which it was initially entered.

GetContextObjectExtendedData

Returns the value of the extended data field, in the format of the extended data field.

Format: GetContextObjectExtendedData(Type, ExtendedDataLabel)

Where:

  • Type is "DespatchOrder", "ContractCharge" or "ContractTerm".
  • ExtendedDataLabel is either the extended data property name (for example, "String1", "String2", "Int1") or the specified caption of the extended data property (for example, String1 caption = "Upper Limit"). All extended data fields except for BTTextList fields can be used.

Example: GetContextObjectExtendedData("ContractCharge", "ShortString2")

Example: GetContextObjectExtendedData("DespatchOrder", "Int1") * 2

Example: If(GetContextObjectExtendedData("ContractCharge", "Boolean1"), 11, 21)

GetContractChargeValue

Returns the value of the specified contract charge, optionally rounded to a number of decimal places.

Format: GetContractChargeValue(ContractChargeName[, Decimals])

GetExchangeRate

Returns the specified exchange rate for the specified date and currencies. Uses the default exchange rate source if no exchange rate source is specified in the expression or in the context in which the expression is evaluated (for example, in an applicable set of contract terms).

Format: GetExchangeRate(ReferenceDate, FromCurrency, ToCurrency[, ExchangeRateSource])

Example: GetExchangeRate(InvoiceDate(), "USD", "CLP", "Banco Central de Chile")

GetInterestRatesValue

Returns the interest rate based on an interest rate series, optionally with a maturity. If no maturity period is specified, MineMarket gets the overnight rate.

Format: GetInterestRatesValue(InterestRateSeriesName, ReferenceDate[, Maturity])

The maturity can be one of the following strings:

  • Overnight
  • 1 week
  • 1 month
  • 2 months
  • 3 months
  • 6 months
  • 12 months
  • 1 w
  • 1 m
  • 2 m
  • 3 m
  • 6 m
  • 12 m

Example: GetInterestRatesValue("LIBOR-Daily", InvoiceDate(), "1 month")

GetInvoiceLineItemValue

Returns the value of the specified invoice line item within the current invoice.

Format: GetInvoiceLineItemValue(LineItem)

Example: GetInvoiceLineItemValue("Cu")

GetLineItemUnitPrice

Returns the unit price of the specified invoice line item and optionally converts it to the specified currency and unit of measure, and optionally rounds the result to the specified number of decimals.

Note: This function cannot be used with the following line item types:

  • Revenue line items (both product and analyte pricing)
  • Taxes
  • Instalments
  • Payment terms

Format: GetLineItemUnitPrice(Name, [Currency], [UOM], [Decimals])

If a currency is not specified, the price is returned in the currency of the line item. If a UOM is not specified, the price is converted to the UOM of the despatch order.

Note: For contract charges, only contract charges that have been calculated can be returned. Contract charges are calculated in the order that they appear in the contract terms. Therefore, a contract charge using this function must be placed after the contract charge that it is based on.

Example: The following configuration of contract charges returns zero for Contract Charge 2 because Contract Charge 3 is calculated later:

  • Contract Charge 1: 4 USD/mt
  • Contract Charge 2: GetLineItemUnitPrice("Contract Charge 3")
  • Contract Charge 3: 5 USD/mt

GetPackagesNetMass

Returns the net mass of packages that have the specified quality. If the packages do not have assay values, but are in a package group with assay values, the quality of the package group is used.

Format: GetPackagesNetMass(Analyte1, Min1, Max1, UOM1, [Analyte2, Min2, Max2, UOM2,...])

Example: GetPackagesNetMass("Pb", 0, 15, “ppm”, "S", 0, 25, “ppm”) * -5

GetPremiumMatrixValue

Returns the value of the premium from a premium matrix.

Format: GetPremiumMatrixValue(PremiumMatrixName, ReferenceDate)

Example: GetPremiumMatrixValue("Premium Matrix-0001", PlannedDespatchDate())

GetPreviousInvoiceLineItemValue

Returns the value of the specified invoice line item from the previous invoice.

Format: GetPreviousInvoiceLineItemValue(LineItem)

Example: GetInvoiceLineItemValue("Contract Charge Name")

GrossMass

Returns the gross mass.

Format: GrossMass()

HedgingProfitOrLoss

Returns the hedging profit/loss.

Format: HedgingProfitOrLoss()

InvoiceDate

Returns the invoice date.

Format: InvoiceDate()

InvoiceDueDate

Returns the due date of the sales or purchase invoice. If there is more than one invoice installment, the function returns the latest installment due date.

Format: InvoiceDueDate()

LinkedHedgingProfitOrLoss

Returns the linked hedging profit/loss, from the linked contract.

Format: LinkedHedgingProfitOrLoss()

LoadedDryMass

Returns the loaded dry mass.

Format: LoadedDryMass()

LoadedWetMass

Returns the loaded wet mass.

Format: LoadedWetMass()

ProvisionalInvoiceDate

Returns the provisional invoice date.

Format: ProvisionalInvoiceDate()

PurchaseInvoiceValue

Returns the purchase invoice value.

Format: PurchaseInvoiceValue()

PurchaseInvoiceValueBeforeTax

Returns the purchase invoice value before tax.

Format: PurchaseInvoiceValueBeforeTax()

ReceiptOfDocuments

Returns the receipt of documents.

Format: ReceiptOfDocuments()

RequiredMass

Returns the required mass.

Format: RequiredMass()

SalesInvoiceValue

Returns the sales invoice value.

If the Include Dynamic Invoice Item parameter is true then dynamic invoice items are included in the calculation total. Default is false.

Format: SalesInvoiceValue(IncludeDII)

Examples:

  • SalesInvoiceValue(true)
  • SalesInvoiceValue(false) is equivalent to SalesInvoiceValue()

SalesInvoiceValueBeforeTax

Returns the sales invoice value before tax.

If the Include Dynamic Invoice Item parameter is true then dynamic invoice items are included in the calculation total. Default is false.

Format: SalesInvoiceValueBeforeTax(IncludeDII)

Examples:

  • SalesInvoiceValueBeforeTax(true)
  • SalesInvoiceValueBeforeTax(false) is equivalent to SalesInvoiceValueBeforeTax()

SumOfLineItemsUnitPrice

Returns the unit price of certain already calculated invoice line items and optionally converts each unit price to the specified currency and unit of measure, and optionally rounds the result to the specified number of decimals, and then calculates the sum of those converted unit prices.

Note: This function cannot be used with the following line item types:

  • Revenue line items (both product and analyte pricing)
  • Taxes
  • Instalments
  • Payment terms

Format: SumOfLineItemsUnitPrice([Currency], [UOM], [Decimals])

If a currency is not specified, the currency of the line item is used. If a UOM is not specified, the line item is converted to the UOM of the despatch order.

Note: For contract charges, only contract charges that have been calculated can be included in the sum. Contract charges are calculated in the order that they appear in the contract terms. Therefore, a contract charge using this function must be placed after any contract charges that it is based on.

Example: The following configuration of contract charges returns 9 USD/mt for Contract Charge 3 because Contract Charge 4 is calculated later:

  • Contract Charge 1: 4 USD/mt
  • Contract Charge 2: 5 USD/mt
  • Contract Charge 3: SumOfLineItemsUnitPrice("USD", "mt")
  • Contract Charge 4: 2 USD/mt

UmpiringCost

Returns the umpiring cost, as entered during an assay exchange.

If used to calculate an umpiring contract charge, clear the Unit in the Resulting Value field group (that is, make the Unit blank). By default, the umpiring cost is based on the number of won (and shared) lots; however, if the Value Basis is Lost Umpire Lot, the umpiring cost is based on lost (and shared) lots.

Format: UmpiringCost()

UmpiringCostPerAnalyte

Returns the umpiring cost per analyte, as entered during an assay exchange.

If used to calculate an umpiring contract charge, clear the Unit in the Resulting Value field group (that is, make the Unit blank). By default, the umpiring cost is based on the number of won (and shared) lots; however, if the Value Basis is Lost Umpire Lot, the umpiring cost is based on lost (and shared) lots.

Format: UmpiringCostPerAnalyte(Analyte)

Example: UmpiringCostPerAnalyte("Ag")

UnloadedDryMass

Returns the unloaded dry mass.

Format: UnloadedDryMass()

UnloadedWetMass

Returns the unloaded wet mass.

Format: UnloadedWetMass()

WetMass

Returns the wet mass, and optionally converts it to the specified UOM.

Format: WetMass([UOM])

Example: WetMass("kg")

The UOM can be the UOM alias, symbol or name.