Tariffs module


This component implements a universal system of tariffs for system users.

The tariff component allows you to quickly implement the ability to create tariff plans for users in the system:

  • Creating a tariff
  • Creating options for tariffs
  • The ability to set an individual value for the options of each tariff

It is assumed that the system is configured to take into account the specifications of tariff plans individually for each project.

Main objects

DB tables:

  • as_trf_tariffs
  • as_trf_tariffOptions
  • as_trf_tariffOptionValues
  • as_trf_tariffLog

SP and functions in the database:

  • trf_cahngeUserTariff (sp)
  • trf_getUserTariffOptionValue (f)
  • trf_getUserTariffDeadline (f)
  • trf_deadlineNotificationUsers (sp)

Components (pages, tables, and forms)

  • pages
    • /tariffs - page for managing pricing plans

  • Tables
    • tariffManagement - main tariff management table. Roles: Administrator.
    • tariffOptions - modal table for managing tariff options. Roles: Administrator.

  • tariffOptionValues - table for managing the values of options for the tariff. Roles: Administrator.
  • tariffUsers - information table with tariff users. Roles: Administrator.
  • Forms
    • tariffOptions - sub-form for managing tariff parameters in the Roles table: administrator.
    • setTariffOptionValue - popover-a form of setting the value of the tariff option. Roles: Administrator.
    • tariffInfo - a form with information about the current tariff. Roles: user, administrator.
  • changeTariff - a form for changing the tariff with information on the available tariff plans. Roles: user, administrator.

Dependencies with standard Falcon components

  • For the component to work, you need to add the fields to the as_users table:
    • tariffID int null, with an external key on id as_trf_tariffs
    • tariffDeadline date null
  • Also, in as_settings, you can add the tariffDaysLeftNotification setting - the number of days for which the user will be notified (on the information panel in the LC - tariffInfo form) about the end of the tariff. By default, this value is taken for 5 days.
  • The component is also associated with the finance system: fin_accounts, fin_finances, fin_financeStatuses, fin_financeStatusLog 

Key functions and procedures


Procedure for setting/changing the tariff.


At the entrance:

  • @username nvarchar - to whom we set the tariff
  • @tariffID int - what is the set rate?
  • @period int - for what period (months) we set the tariff, it can only take values 0, 1, 6, 12, 36, because the set price depends on this parameter (in the table as_trf_tariffs price, price6, price12, price36, respectively).

If 0 is passed, the tariff is set without a deadline, i.e. forever (for example, when registering, you can set a default free tariff in this way).

At the exit:

  • result, msg

The procedure checks if the account has enough funds to switch to the tariff, then performs the appropriate financial operations, otherwise the user is notified of an insufficient balance.


The function returns the value of the option for the user at a certain tariff.

At the entrance:

  • @username nvarchar - the user for whom we want to find out the value of the option
  • @optionCode nvarchar - option code

At the output, we get @value - the string value of the option.


The function returns the end date of the tariff for the user in the format yyyy-mm-dd.

At the entrance @username nvarchar, @deadline in the format date.


The procedure returns a list of users whose tariff expiration date is approaching.

At the entrance:

  • @days int - number of days before the deadline

The output is a table (username nvarchar(128), tariffID int, deysLeft int, deadline date).

It can be used in periodic procedures to notify users about the end of the tariff.

How to implement a component

  1. We take all the necessary objects from the Auction system and transfer them to the solution.
  2. On the tariff management page (/tariffs - under the admin), we create tariffs and options.
  3. Fill in the data on the tariffs: description, prices (if the tariff does not specify any prices, then it is considered free, otherwise the system will require you to specify prices for all periods), specify the value of the options for the tariff. It is possible to disable tariffs and options. Disabled rates are not available for selection.
  4. We are making changes to the business logic of the project to account for tariffs. To find out the value of the option for the current user, call the trf_getUserTariffOptionValue function and pass it to it username and optionCode.
  5. In the user's account, we display the information form of the tariff (tariffInfo). It displays information about the current tariff, the expiration date and the button to change the tariff.



SQL-tool for creating personal accounts on the site

The essence of the approach and the history of the creation of Falcon Space
Web platform for creating personal accounts

Falcon Space Platform

This is a reduction in the cost of ownership

at the expense of fewer people to support

This is a quick change

while using the program

This is a modern interface

full adaptation for mobile devices

MS SQL web applications. Affiliate program for developers and web studios

You can develop on your own or collaborate with us on Falcon Space web development using only SQL and HTML.
See examples with SQL code
Platform documentation
Working on MS SQL Server
NOTE! Модули, представленные в данном каталоге не являются частью ядра платформы. Это микрорешения, сделанные на базе платформы.
Модули не предполагают автоматического обновления. Развитие, доработка модулей, исправление возможных ошибок/коллизий не входит в стоимость платформы.
Component demo stand
At the stand you can see various components in action - tables, forms, modal windows, diagrams, a map, etc.
Solution demo site
Basic solutions that can be flexibly adapted for yourself - change the appearance, business logic and even the structure of the database.
Discuss the project
Ask the initial questions about the project that concern you right now. We will advise you for free and recommend the best solution.