Пример #1
0
 private void set_discount_name(cls_discount disc, int type)
 {
     if (type == dchead_adjusttype || type == dcdetail_adjusttype)
     {
         disc.set_name("Adjust");
     }
     else if (type == dchead_discounttype || type == dcdetail_discounttype)
     {
         disc.set_name("Regular Discount");
     }
     else
     {
     }
 }
Пример #2
0
        private void activateDiscount(int type, decimal value, decimal amount, bool isMultiple, bool isHistory, int discountWid)
        {
            bool flag = false;

            if (!isHistory)
            {
                discountWid = 0;
            }
            if ((type == dcdetail_customdiscounttype && discountWid != 0) || type != dcdetail_customdiscounttype)
            {
                foreach (cls_discount disc in this.disclist)
                {
                    if (type == disc.get_type() && !disc.get_status())
                    {
                        if (type == dcdetail_customdiscounttype && discountWid != disc.get_SyncId())
                        {
                            continue;
                        }
                        if (type == cls_globalvariables.dcdetail_promoqty && isMultiple)
                        {
                            disc.set_name("Item Discount");
                        }

                        set_discount_name(disc, type);
                        disc.set_status(true);
                        disc.set_ismultiple(isMultiple);
                        disc.set_value(value);
                        if (amount == 0 && !isMultiple && type == dcdetail_promoqty)
                        {
                            amount = value * -1;
                        }
                        if (isHistory)
                        {
                            disc.set_discounted_amount(amount);
                        }
                        flag = true;
                        break;
                    }
                }
            }
            if (!flag && type == dcdetail_customdiscounttype)
            {
                cls_discount discountTemp = new cls_discount();
                discountTemp.set_status(true);
                discountTemp.set_ismultiple(isMultiple);
                discountTemp.set_value(value);
                discountTemp.set_name("Custom Discount");
                if (isHistory)
                {
                    discountTemp.set_discounted_amount(amount);
                }
                this.disclist.Add(discountTemp);
            }
        }