Discounting a service line item is an advanced feature whereby we allow a rule to be setup which may apply a discount setup, renewal or prorata invoice line to any service invoice if specified under a service or a client wide custom field.
It is recommended that you enable the Invoice Items App and setup at least the following line item types:
Other, Setup, Renewal, Discount
The “Discount” item type will be used by default for all discount invoice line items and this will allow for the separation of setup, renewal and discounted revenue via all of our reporting tools.
You will note by looking at the example rule below that we have also added three custom fields to each service requiring the discount functionality.
In this case all the fields were normal text based fields which SnapBill will magically convert to a numerical (float) value.
$service→data-setup_discount
$service→data-renewal_discount
$service→data-prorata_discount
We check if these are set before we proceed to add a discount line to the invoice. Discounts are set as fractions and to provide your client with 25% discount you will need to set the relevant custom field to 0.25.
Important: Discounts will take into account the special quantity field type on a service and the calculation for the discount line is based on $service→quantity * [$service→data-“type”_discount].
Please note: This rule is quite complex as it also contains prorated logic which may not be required in all instances.
Run the following code if this is the first invoice for the service Run the code on the condition that $service->package->setup is greater than 0 Append a line to the invoice: $service->name: $service->package->name Setup Fee for $service->quantity units of $service->package->setup Run the code on the condition that the custom field $service->data-setup_discount is set Append a discount line to the invoice: Discount: $service->name: $service->package->name Setup Fee Discount for $service->data-setup_discount discount units of the negative $service->package->setup Run the code on the condition that $service->term is greater than 1 Run the code on the condition that $renewal_date->day is greater or equal to 25 Update the renewal date to the first of the following month Update the renewal date to the first of the current month Run the code on the condition that $renewal_date->day is greater than 5 Run the code on the condition that $renewal_date->day is smaller than 25 Append a prorata line to the invoice: $service->name: $service->package->name Prorated Fee (Rest of $renewal_date->month_name)", without any rounding. Run the code on the condition that the custom field $service->data-prorata_discount is set Append a discount prorata line to the invoice: $service->name: $service->package->name Prorated Fee Discount (Rest of $renewal_date->month_name) for $service->data-prorata_discount discount units of the negative prorata amount without any rounding. Update the renewal date to the first of the following month End execution of this rule at this point. Update the renewal date to the first of the following month Run the code on the condition that $service->fee is greater than 0 Append a line to the invoice: $service->name: $service->package->name $service->term(>term) Fee ($renewal_date->month_name $renewal_date->year) for $service->quantity units of $service->fee Run the code on the condition that the custom field $service->data-renewal_discount is set Append a discount line to the invoice: Discount: $service->name: $service->package->name $service->term(>term) Fee Discount ($renewal_date->month_name $renewal_date->year) for $service->data-renewal_discount discount units of the negative $service->fee Update the renewal date to the first of $service->term months from now
If you require support setting this up then please get in touch.