Ejemplo n.º 1
0
        void GetSaleLedgers()
        {
            if (QueryController.User.IsIdValid(User.Id))
            {
                SalesLedgersGrid.Controls.Clear();
                var response = QueryController.Sale.GetSaleLedgers(SearchQuery, Pagination);
                if (response.StatusCode == 200)
                {
                    // Render EmptyData if Count == 0 and show no results if searchQueryType is different from none
                    RenderEmptyData(response.DataArray.Count == 0);

                    SalesLedgers = response.DataArray;
                    foreach (Backend.Objects.Sale sale in response.DataArray)
                    {
                        AddSaleLedgerToGrid(sale);
                    }
                    Pagination = response.Pagination;
                }
                // No Content
                else if (response.StatusCode == 204)
                {
                    RenderEmptyData(response.DataArray.Count == 0);
                }
            }
            else
            {
                Alert.Show("User Account Error", "Please login again, an error occured", Alert.AlertType.Error, isMini: false);
            }
        }
Ejemplo n.º 2
0
        void GetSales()
        {
            if (QueryController.User.IsIdValid(User.Id))
            {
                SalesGrid.Controls.Clear();
                TotalRevenue = SupplyPrice = Profit = TaxAmount = 0;

                var response = QueryController.Sale.GetSales(SearchQuery, Pagination);
                if (response.StatusCode == 200)
                {
                    // Render EmptyData if Count == 0 and show no results if searchQueryType is different from none
                    RenderEmptyData(response.DataArray.Count == 0);

                    SalesObject = response.DataArray;
                    foreach (Backend.Objects.Sale sale in response.DataArray)
                    {
                        AddSaleToGrid(sale);

                        // Sum
                        TotalRevenue += sale.TotalPrice;
                        SupplyPrice  += sale.SupplyPrice;
                        Profit       += GetProfit(sale);
                        TaxAmount    += sale.TaxAmount;
                    }
                    Pagination = response.Pagination;
                }
                // No Content
                else if (response.StatusCode == 204)
                {
                    RenderEmptyData(response.DataArray.Count == 0);
                }

                // Render Totals ..
                RenderStatistics();
            }
            else
            {
                Alert.Show("User Account Error", "Please login again, an error occured", Alert.AlertType.Error, isMini: false);
            }
        }
Ejemplo n.º 3
0
        void GetPayments()
        {
            if (QueryController.User.IsIdValid(User.Id))
            {
                PaymentsGrid.Controls.Clear();
                CashAmount = StoreCreditAmount = CreditCardAmount = 0;

                var response = QueryController.Sale.GetPayments(SearchQuery, Pagination);
                if (response.StatusCode == 200)
                {
                    // Render EmptyData if Count == 0 and show no results if searchQueryType is different from none
                    RenderEmptyData(response.DataArray.Count == 0);

                    Payments = response.DataArray;
                    foreach (Backend.Objects.Payment payment in response.DataArray)
                    {
                        // Get & Sum
                        var _payment = SetAmounts(payment);
                        CashAmount        += _payment.CashAmount;
                        StoreCreditAmount += _payment.StoreCreditAmount;
                        CreditCardAmount  += _payment.CreditCardAmount;

                        AddPaymentToGrid(_payment);
                    }
                    Pagination = response.Pagination;
                }
                // No Content
                else if (response.StatusCode == 204)
                {
                    RenderEmptyData(response.DataArray.Count == 0);
                }

                // Render Totals ..
                RenderStatistics();
            }
            else
            {
                Alert.Show("User Account Error", "Please login again, an error occured", Alert.AlertType.Error, isMini: false);
            }
        }
Ejemplo n.º 4
0
        void GetProducts()
        {
            if (QueryController.User.IsIdValid(User.Id))
            {
                InventoryGrid.Controls.Clear();
                CurrentStock = StockValue = ItemValue = 0;

                var response = QueryController.Products.Product.GetInventoryProducts(SearchQuery, Pagination);
                if (response.StatusCode == 200)
                {
                    // Render EmptyData if Count == 0 and show no results if searchQueryType is different from none
                    RenderEmptyData(response.DataArray.Count == 0);

                    Products = response.DataArray;
                    foreach (Backend.Objects.Product product in response.DataArray)
                    {
                        AddProductToGrid(product);

                        // Sum
                        CurrentStock += product.Stock;
                        StockValue   += product.StockValue;
                        ItemValue    += product.Price;
                    }
                    Pagination = response.Pagination;
                }
                // No Content
                else if (response.StatusCode == 204)
                {
                    RenderEmptyData(response.DataArray.Count == 0);
                }

                // Render Totals ..
                RenderStatistics();
            }
            else
            {
                Alert.Show("User Account Error", "Please login again, an error occured", Alert.AlertType.Error, isMini: false);
            }
        }