Exemplo n.º 1
0
 public SalesDiscountDetailUI()
 {
     InitializeComponent();
     lId             = "";
     lOperation      = GlobalVariables.Operation.Add;
     loSalesDiscount = new SalesDiscount();
 }
Exemplo n.º 2
0
 public SalesDiscountDetailUI(string[] pRecords)
 {
     InitializeComponent();
     lId             = "";
     lOperation      = GlobalVariables.Operation.Edit;
     loSalesDiscount = new SalesDiscount();
     lRecords        = pRecords;
 }
 public PQStockTransactionDetailUI()
 {
     InitializeComponent();
     loStock         = new Stock();
     loLocation      = new Location();
     loSalesDiscount = new SalesDiscount();
     lDetailId       = "";
     lOperator       = "Add";
 }
Exemplo n.º 4
0
 public AddDiscountUI()
 {
     InitializeComponent();
     loDiscount           = new SalesDiscount();
     lDiscountId          = "";
     lDiscountDescription = "";
     lAmount     = 0;
     lPercentage = 0;
     lVATExempt  = false;
     lDetails    = "";
     lFromClose  = false;
 }
        public IActionResult GetDiscountPrice([FromBody] SalesDiscountRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            SalesDiscount         discount = _itemPriceService.GetDiscount(request.DiscountId);
            SalesDiscountResponse result   = new SalesDiscountResponse {
                SalesPrice = request.SalesPrice * (1 - discount.Discount)
            };

            return(Ok(result));
        }
 public PQStockTransactionDetailUI(string pDetailId, string pStockId,
                                   string pLocationId, decimal pQty, decimal pUnitPrice,
                                   string pDiscountId, decimal pDiscountAmount, decimal pTotalPrice, string pRemarks)
 {
     InitializeComponent();
     loStock         = new Stock();
     loLocation      = new Location();
     loSalesDiscount = new SalesDiscount();
     lDetailId       = pDetailId;
     lStockId        = pStockId;
     lLocationId     = pLocationId;
     lQty            = pQty;
     lUnitPrice      = pUnitPrice;
     lDiscountId     = pDiscountId;
     lDiscountAmount = pDiscountAmount;
     lTotalPrice     = pTotalPrice;
     lRemarks        = pRemarks;
     lOperator       = "Edit";
 }
        public DiscountRule GetDiscountByID(int DiscountID)
        {
            DiscountRule discount = new DiscountRule();

            using (BusinessRulesDBEntities db = new BusinessRulesDBEntities())
            {
                SalesDiscount salesDiscount = db.SalesDiscounts.Where(a => a.ID == DiscountID).FirstOrDefault();
                if (salesDiscount != null)
                {
                    discount.ID              = salesDiscount.ID;
                    discount.Name            = salesDiscount.DiscountName;
                    discount.Base            = salesDiscount.DiscountBase;
                    discount.commAmount      = salesDiscount.CommAmt.Value;
                    discount.commRelatedUnit = salesDiscount.CommRelatedUnit;
                    discount.commRound       = salesDiscount.CommRound;
                    discount.commType        = salesDiscount.CommType;
                    discount.EndDate         = salesDiscount.DiscountEndDate.Value;
                    discount.Priority        = salesDiscount.DiscountPriority.Value;
                    discount.StartDate       = salesDiscount.DiscountStartDate.Value;
                    List <SalesDiscountCriteria> discountCriteria = db.SalesDiscountCriterias.Where(a => a.DiscountID == discount.Name).ToList();
                    if (discountCriteria.Count > 0)
                    {
                        discount.CriteriaList = (from dc in discountCriteria
                                                 join c in db.Criterias_Difinition on dc.DiscountCriteria equals c.ID.ToString()
                                                 select new SalesRulesCriteria
                        {
                            criteriaName = c.criteriaName,
                            operation = dc.operation,
                            textValue = dc.CriteriaValueText,
                            value = dc.CriteriaValue
                        }).ToList();
                    }
                }
            }
            return(discount);
        }