public bool isQuantityUpdated(InvoiceDetailModel model)
        {
            bool isUpdated = false;

            for (int i = 0; i < this.articleList.Count; i++)
            {
                if (this.articleList[i].returnedQty != model.articleList[i].returnedQty)
                {
                    return(true);
                }
                if (this.articleList[i].damagedQty != model.articleList[i].damagedQty)
                {
                    return(true);
                }
            }

            return(isUpdated);
        }
        public SubmitReturnModel ConvertToSubmitReturnModel(InvoiceDetailModel model, bool isRefund)
        {
            SubmitReturnModel item = new SubmitReturnModel()
            {
                CustomerId = model.CustomerId, FranchiseId = model.FrachiseID, OrderId = model.FranchiseSellId, IsRefund = isRefund? 1:0, lstProducts = new List <SubmitArticleModel>(), CreatedBy = model.FrachiseID
            };

            foreach (ArticleDetails article in model.articleList)
            {
                item.lstProducts.Add(new SubmitArticleModel()
                {
                    ArticleId     = article.ArticleId,
                    DamagedQty    = article.damagedQty.ToString(),
                    SubCategoryId = article.SubCategoryId,
                    MarketableQty = article.damagedQty > 0?(article.TotalQty - article.damagedQty).ToString():article.returnedQty.ToString()
                });
            }

            return(item);
        }
        public InvoiceDetailModel sortOrderDetails(ObservableCollection <InvoiceDetailsServerModel> tempLIst)
        {
            InvoiceDetailModel model = new InvoiceDetailModel()
            {
                InvoiceNo           = tempLIst[0].InvoiceNo,
                FranchiseSellId     = tempLIst[0].FranchiseSellId,
                CreatedDate         = tempLIst[0].CreatedDate,
                TotalAmount         = tempLIst[0].TotalAmount,
                TotalAmountInRupees = ConvertInRupees(tempLIst[0].TotalAmount),
                TotalQty            = tempLIst[0].TotalQty,
                CustomerName        = tempLIst[0].CustomerName + " (" + tempLIst[0].ContactNo + ")",
                SellStatus          = tempLIst[0].SellStatus,
                CustomerId          = tempLIst[0].CustomerId,

                articleList = new ObservableCollection <ArticleDetails>()
            };
            int index = 0;

            foreach (InvoiceDetailsServerModel item in tempLIst)
            {
                model.articleList.Add(new ArticleDetails()
                {
                    ArticleId       = item.ArticleId,
                    CategoryName    = item.CategoryName,
                    damagedQty      = 0,
                    isSelected      = false,
                    MRP             = ConvertInRupees(item.MRP),
                    AdjustedQty     = item.AdjustedQty != null ? Convert.ToInt32(item.AdjustedQty) : 0,
                    AvailableQty    = Convert.ToInt32(item.TotalQty) - (item.AdjustedQty != null ? Convert.ToInt32(item.AdjustedQty) : 0),
                    returnedQty     = 0,
                    SubCategoryId   = item.SubCategoryId,
                    SubCategoryName = item.SubCategoryName,
                    TotalQty        = Convert.ToInt32(model.TotalQty), artId = index
                });
                index++;
            }

            return(model);
        }