示例#1
0
        public List <Models.MOrderViewOfPayment> ShowClientOrderViewForPayment()
        {
            COrders      co  = new COrders();
            COrderOnline col = new COrderOnline();
            CClients     cc  = new CClients();
            List <Models.MOrderViewOfPayment> ClientPayments = new List <Models.MOrderViewOfPayment>();
            List <Models.MPayments>           Payments       = this.GetAll();
            List <Models.MOrders>             Orders         = co.GetAll();

            List <Models.MOrdersLine> OrderLine = col.GetAll();

            var query = from o in Payments
                        where o.OrderId != 0 &&
                        o.VendorId == -1 &&
                        o.ClientId != -1 &&
                        o.Paymentstate != Common.Constants.PaymentState.Paid.ToString()
                        select o;

            foreach (var item in query)
            {
                Models.MOrderViewOfPayment mop = new Models.MOrderViewOfPayment();
                mop.PaymentId = item.id.ToString();
                mop.ClientId  = item.ClientId.ToString();
                string clientName = cc.ReturnClientNameById(mop.ClientId);
                string OrderId    = item.OrderId.ToString();
                mop.OrderId = item.OrderId.ToString();
                string OrderDate = (from o in Orders
                                    where o.id == OrderId
                                    select o.Orderdate).FirstOrDefault();
                mop.OrderDate = OrderDate;
                mop.OrderName = (from o in Orders
                                 where o.id == OrderId
                                 select o.OrderName).FirstOrDefault();
                mop.OrderCode = (from o in Orders
                                 where o.id == OrderId
                                 select o.OrdersNo).FirstOrDefault();
                mop.PaidAmount = item.Paid;
                mop.TotalCost  = item.TotalCost;
                mop.ClientName = clientName;
                ClientPayments.Add(mop);
            }

            return(ClientPayments);
        }
示例#2
0
            public List <Models.MViewModels.MViewOrderDetails> GetAllDetails(int OrderId)
            {
                List <Models.MViewModels.MViewOrderDetails> OrderDetails = new List <Models.MViewModels.MViewOrderDetails>();
                List <Models.MOrdersLine> OrderLine = new List <Models.MOrdersLine>();

                Models.MViewModels.MViewOrderDetails mvo = new Models.MViewModels.MViewOrderDetails();
                Classes.COrderOnline coo = new COrderOnline();
                Classes.COrders      co  = new COrders();
                Classes.CProducts    cp  = new CProducts();
                OrderLine = coo.GetAll();
                OrderLine = OrderLine.Where(o => o.OrderId == OrderId.ToString()).ToList();
                for (int i = 0; i < OrderLine.Count; i++)
                {
                    mvo = new Models.MViewModels.MViewOrderDetails();
                    string CurrentProductPrice = string.Empty, ProductName = string.Empty;
                    ProductName = cp.GetProductNameWithTagsById(Convert.ToInt32(OrderLine[i].ProductId));
                    string OrderType = co.ReturnOrderTypeById(OrderId);
                    switch (OrderType)
                    {
                    case "Client":
                    {
                        CurrentProductPrice = cp.ReturnSalePrice(Convert.ToInt32(OrderLine[i].ProductId));
                        break;
                    }

                    case "Vendor":
                    {
                        CurrentProductPrice = cp.ReturnCostPrice(Convert.ToInt32(OrderLine[i].ProductId));
                        break;
                    }

                    default:
                        break;
                    }
                    mvo.CurrentProductPrice = CurrentProductPrice;
                    mvo.OrderProductPrice   = OrderLine[i].SalePrice;
                    mvo.ProductCost         = OrderLine[i].totalProductCost;
                    mvo.ProductName         = ProductName;
                    mvo.Units = OrderLine[i].unit;
                    OrderDetails.Add(mvo);
                }
                return(OrderDetails);
            }
示例#3
0
            public List <Models.MViewModels.MViewRecievables> GetAll()
            {
                List <Models.MViewModels.MViewRecievables> Get = new List <Models.MViewModels.MViewRecievables>();
                var query = from o in obj.Payments
                            where o.PaymentType == Common.Constants.PaymentTypes.Partial.ToString() &&
                            o.ClientId != -1 && o.OrderId != 0 && o.VendorId == -1
                            select o;

                Classes.CClients cc         = new CClients();
                Classes.COrders  co         = new COrders();
                string           clientName = string.Empty;
                string           orderName  = string.Empty;

                foreach (var item in query)
                {
                    clientName = cc.ReturnClientNameById(item.ClientId.ToString());
                    orderName  = co.GetOrderNameById(item.OrderId.ToString());
                }
                return(Get);
            }
示例#4
0
            public List <Models.MViewModels.MViewOrders> GetAll(string OrderType)
            {
                List <Models.MViewModels.MViewOrders> OrderDetails = new List <Models.MViewModels.MViewOrders>();
                List <Models.MOrders> Orders = new List <Models.MOrders>();

                Classes.COrders  co  = new COrders();
                Classes.CClients ccl = new CClients();
                Classes.CVendor  cv  = new CVendor();
                Orders = co.GetAll();
                switch (OrderType)
                {
                case "Clients":
                {
                    Orders = Orders.Where(o => o.venorld == "-1").ToList();
                    for (int i = 0; i < Orders.Count; i++)
                    {
                        Models.MViewModels.MViewOrders mod = new Models.MViewModels.MViewOrders();
                        string ClientName = string.Empty;
                        if (Orders[i].ClientId != "-1")
                        {
                            ClientName = ccl.ReturnClientNameById(Orders[i].ClientId);
                        }

                        mod.ClientName          = ClientName;
                        mod.Installments        = Orders[i].Installments;
                        mod.InstallmentsDueDate = Orders[i].InstallmentDueDate;
                        mod.OrderCost           = Orders[i].TotalCost;
                        mod.OrderDescription    = Orders[i].OrderDescription;
                        mod.OrderId             = Orders[i].id;
                        mod.OrderName           = Orders[i].OrderName;
                        mod.OrderNo             = Orders[i].OrdersNo;
                        mod.VendorName          = string.Empty;
                        mod.WareHouseId         = Orders[i].WareHouseId;
                        mod.ModeOfPayment       = Orders[i].ModeOfPayment;
                        mod.GrantorName         = Orders[i].GrantorName;
                        OrderDetails.Add(mod);
                    }
                    break;
                }

                case "Vendors":
                {
                    Orders = Orders.Where(o => o.ClientId == "-1").ToList();
                    for (int i = 0; i < Orders.Count; i++)
                    {
                        Models.MViewModels.MViewOrders mod = new Models.MViewModels.MViewOrders();
                        string VendorName = string.Empty;

                        if (Orders[i].venorld != "-1")
                        {
                            VendorName = cv.GetVendorNameById(Orders[i].venorld);
                        }
                        mod.ClientName          = string.Empty;
                        mod.Installments        = Orders[i].Installments;
                        mod.InstallmentsDueDate = Orders[i].InstallmentDueDate;
                        mod.OrderCost           = Orders[i].TotalCost;
                        mod.OrderDescription    = Orders[i].OrderDescription;
                        mod.OrderId             = Orders[i].id;
                        mod.OrderName           = Orders[i].OrderName;
                        mod.OrderNo             = Orders[i].OrdersNo;
                        mod.VendorName          = VendorName;
                        mod.WareHouseId         = Orders[i].WareHouseId;
                        OrderDetails.Add(mod);
                    }
                    break;
                }

                default:
                    break;
                }


                return(OrderDetails);
            }