Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Micros 3700 - Discounts - Itemizers connection on SQL 2

Status
Not open for further replies.

nvak

Programmer
May 25, 2015
60
GR
Hello Guys,

Does anybody know which table stores the connection between a Discount with the its Itemizers?

thanks,


Untitled_au612n.png
 
SQL:
select 
    itmzr_mask_1_32,
    itmzr_mask_33_64,
    itmzr_mask_65_96
from micros.dsvc_def

these integer columns change depending on whats selected. I havent spent anytime working out what the algorithm is for converting the integer to to the selected values as ive never need to use them.

Do you want some custom SIM scripts developed. Contact me via my website
 
Ok worked it out.

Nothing selected is Null or 0
The first itemizer in the column (ie. Itemizer 1, 33 or 65) is assigned the maximum negative integer value of -2,147,483,648
The second itemizer in the column (ie. Itemizer 2, 34, 66) is assigned the positive value of 1,073,741,824 which is half of the maximum positive integer.
Each subsequent number if half of the previous value in the sequence 1,073,741,824, 536,870,912, 268,435,456 etc

So if you select Itemizer 1, 2 and 3 then the value in the column itmzr_mask_1_32 should be ( -2,147,483,648 + 1,073,741,824 + 536,870,912 = -536,870,912)


Do you want some custom SIM scripts developed. Contact me via my website
 
thank you Cathal i was so closed to solve it out but you are real fast!
 
Code:
        private void CalculateItemizers(int number, Discount discount)
{
    if (number < 0)
    {
        discount.ItemizersList.Add(1);
        number = (int)(number + 2147483648);
    }

    int pow = 0;
    long itemizer = (long)Math.Pow(2, pow);

    while (itemizer <= Math.Pow(2, 31))
    {
        pow++;

        if ((number & itemizer) == itemizer)
        {
            discount.ItemizersList.Add(33 - pow);
        }

        itemizer = (long)Math.Pow(2, pow);
    }
}
 
Hi

forgive my ignorance on the programming but am interested in what the code does and the scenario it can be useful, if you don't mind

 
the C# code works out what itemizers are assigned.

For example if itmzr_mask_1_32 column in the database contained -536,870,912 then this code generates a List<int> containing the numbers 1,2,3 which tells you that itemizers 1,2 and 3 are assigned to this discount.

Do you want some custom SIM scripts developed. Contact me via my website
 
I just want to know outside micros (third party software) for every discount the itemizers which can be applied on.

The code above has already read from the database the column itmzr_mask_1_32 from table micros.dsvc_def as Cathal said and returns a list as a property on Discount object with the itemizers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top