Exemple #1
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);
            }
        }
Exemple #2
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
     {
     }
 }
Exemple #3
0
        public void add_new_discount(long SyncId, int type, int basis, decimal value, decimal amount, bool ismultiple, bool ishistory, bool status, int position)
        {
            cls_discount disc = new cls_discount(SyncId, type, basis, value, ismultiple, status);

            set_discount_name(disc, type);
            if (ishistory)
            {
                disc.set_discounted_amount(amount);
            }
            this.disclist.Insert(position, disc);

            foreach (cls_discount d in this.disclist)
            {
                if (d.get_basis() >= position)
                {
                    d.set_basis(d.get_basis() + 1);
                }
            }
        }
Exemple #4
0
        public void activateDiscount_using_wid(long SyncId, decimal value, bool isMultiple)
        {
            cls_discount disc = get_discount_using_wid(SyncId);

            if (SyncId == disc.get_SyncId() && !disc.get_status())
            {
                disc.set_status(true);
                disc.set_value(value);
                disc.set_ismultiple(isMultiple);
            }
            else if (SyncId == disc.get_SyncId() && disc.get_status())
            {
                if (DialogHelper.ShowDialog("This discount is already being used. Do you want to remove the discount?", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    disc.set_status(false);
                }
            }
            else
            {
            }
        }