Example #1
0
        public void LoadSearchResult(string customerName)
        {
            IPandSHistoryRepository purchaseRepository = new PandSHistoryRepository();

            //this.ShowAllCount = purchaseRepository.GetAllSalesInvoice().Count();
            this.PandSHistoryList = purchaseRepository.GetAllSalesInvoice().Where(x => x.ProductCode == customerName).ToList();
        }
Example #2
0
        private void RefreshData()
        {
            IPandSHistoryRepository purchaseRepository = new PandSHistoryRepository();

            // this.DateFormat = purchaseRepository.GetDateFormat();
            //this.ShowAllCount = purchaseRepository.GetAllSalesInvoice().Count();
            GetOptionsandTaxValues();
            this.JsonData         = purchaseRepository.GetLastSelectionData(Convert.ToInt32(ScreenId.PandSHistoryList));
            this.PandSHistoryList = purchaseRepository.GetAllSalesInvoiceJson(this.JsonData, this.IncludingGSTTrue).ToList();
            // this.PandSHistoryListcmb = purchaseRepository.GetAllSalesInvoice().OrderBy(x => x.ProductCode).ToList();


            DefaultList         = this.PandSHistoryList;
            FullPQList          = this.PandSHistoryList;
            PandSHistoryListcmb = PandSHistoryList;
            //this.ShowAllCount = this.PandSHistorycmb.Count();
            SetDefaultSearchSelection(this.JsonData);
            var    Updateddate = this.PandSHistoryListcmb.Max(x => x.CreatedDate);
            string date        = this.DateFormat as string;

            //this.LastUpdateDate = Convert.ToDateTime(Updateddate).ToString(date);

            //TotalInvoiceAmount = Convert.ToString(PandSHistory.Sum(e => e.InvoiceAmountValue));
            //TotalCCDAmount = Convert.ToString(PandSHistory.Sum(e => e.TotalAmount));
            this.TotalCusM1      = Convert.ToString(PandSHistoryList.Sum(e => e.TotalM1));
            this.TotalCusM2      = Convert.ToString(PandSHistoryList.Sum(e => e.TotalM2));
            this.TotalCusM3      = Convert.ToString(PandSHistoryList.Sum(e => e.TotalM3));
            this.TotalCusQuarter = Convert.ToString(PandSHistoryList.Sum(e => e.QuarterTotal));
            this.TotalCusYear    = Convert.ToString(PandSHistoryList.Sum(e => e.YearTotal));
            //this.GetData(this.SelectedSearchSupplier);
        }
Example #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PandSHistoryViewModel"/> class.
        /// </summary>
        public PandSHistoryViewModel(IRegionManager regionManager, IEventAggregator eventAggregator)
            : base()
        {
            IPandSHistoryRepository purchaseRepository = new PandSHistoryRepository();

            this.regionManager   = regionManager;
            this.eventAggregator = eventAggregator;
            this.LoadSupplierBackground();
            SearchCommand              = new RelayCommand(Search);
            ShowAllCommand             = new RelayCommand(ShowAll);
            ShowSelectedCommand        = new RelayCommand(ShowSelected);
            NavigateToClientCommand    = new RelayCommand(NavigatetoSupplier);
            ShowIncGSTCommand          = new RelayCommand(showincGST);
            ShowExcGSTCommand          = new RelayCommand(showexcGST);
            RefreshCommand             = new RelayCommand(refreshcommand);
            NavigateToPandSFormCommand = new RelayCommand(NavigatetoCustomerView);
            //NavigaetoSalesCommand = new RelayCommand(NavigatetoSalesInvoice);
            //YearQuarterSelectedCommand = new RelayCommand(OnYearQuarterMonthChange);
            //CalendarSelectionCommand = new RelayCommand(OnCalendarSelection);
            SelectedSearchQuarter = "2";
            CloseCommand          = new DelegateCommand(Close);

            this.ShowBoth     = true;
            this.ShowProducts = false;
            this.ShowServices = false;

            IsSalesTrue  = true;
            IsSalesFalse = false;

            this.YearRange = purchaseRepository.GetYearRange().ToList();
        }
Example #4
0
        void GetOptionsandTaxValues()
        {
            OptionsEntity           oData = new OptionsEntity();
            IPandSHistoryRepository purchaseRepository = new PandSHistoryRepository();

            oData = purchaseRepository.GetOptionSettings();
            if (oData != null)
            {
                this.CurrencyName   = oData.CurrencyCode;   //there is no currency name field in database
                this.CurrencyCode   = oData.CurrencyCode;
                this.CurrencyFormat = oData.NumberFormat;
                this.DateFormat     = oData.DateFormat;
                this.DecimalPlaces  = oData.DecimalPlaces;
                if (oData.ShowAmountIncGST == true)
                {
                    this.IncludingGSTTrue  = true;
                    this.IncludingGSTFalse = false;
                    //int decimalpoints = Convert.ToInt32(DecimalPlaces);
                    //foreach (var item in this.PandSHistory)
                    //{
                    //    item.InvoiceAmount = Math.Round(Convert.ToDouble(item.InvoiceAmount), decimalpoints).ToString();
                    //}
                    //this.PandSHistory = this.PandSHistory.Where(x => x.ExcIncGST == true).ToList();
                }
                else
                {
                    this.IncludingGSTTrue  = false;
                    this.IncludingGSTFalse = true;
                    int decimalpoints = Convert.ToInt32(DecimalPlaces);
                    //foreach (var item in this.PandSHistory)
                    //{
                    //    //item.InvoiceAmount = item.InvoiceAmountExcGST;
                    //    //item.InvoiceAmount = Math.Round(Convert.ToDouble(item.InvoiceAmountExcGST), decimalpoints).ToString();
                    //    item.InvoiceAmount = Math.Round(Convert.ToDouble(item.InvoiceAmount), decimalpoints).ToString();
                    //}
                    if (this.PandSHistoryList != null)
                    {
                        this.PandSHistoryList = this.PandSHistoryList.ToList();
                    }
                }
            }
            else
            {
                this.CurrencyName   = "USD";
                this.CurrencyCode   = "USD";
                this.CurrencyFormat = "en-US";
                this.DateFormat     = "dd/MM/yyyy";
            }



            TaxModel objDefaultTax = new TaxModel();

            objDefaultTax = purchaseRepository.GetDefaultTaxes();
            if (objDefaultTax != null)
            {
                this.TaxName = objDefaultTax.TaxName;
                //this.TaxName = objDefaultTax.TaxRate;
            }
            else
            {
                this.TaxName = "GST Free";
                //this.TaxRate = 0;
            }
        }
Example #5
0
        void Search(object param)
        {
            if (Count != 0)
            {
                SearchValues = new List <SearchEntity>();
                //this.ShowSelectedTrue = true;
                //this.ShowAllTrue = false;
                if (this.SelectedSearchYear != null || this.SelectedSearchYear == string.Empty)
                {
                    SearchEntity value = new SearchEntity();
                    value.FieldName  = "Year";
                    value.FieldValue = this.SelectedSearchYear;
                    SearchValues.Add(value);
                }
                else
                {
                    SearchEntity value = new SearchEntity();
                    value.FieldName  = "Year";
                    value.FieldValue = "0";
                    SearchValues.Add(value);
                }
                if (this.SelectedSearchQuarter != null || this.SelectedSearchQuarter == string.Empty)
                {
                    SearchEntity value = new SearchEntity();
                    value.FieldName  = "Quarter";
                    value.FieldValue = this.SelectedSearchQuarter;
                    int month1;
                    int month2;
                    int month3;
                    if (Convert.ToInt32(this.SelectedSearchQuarter) == 1)
                    {
                        month1 = 1;
                        month2 = 2;
                        month3 = 3;
                    }
                    else if (Convert.ToInt32(this.SelectedSearchQuarter) == 2)
                    {
                        month1 = 4;
                        month2 = 5;
                        month3 = 6;
                    }
                    else if (Convert.ToInt32(this.SelectedSearchQuarter) == 3)
                    {
                        month1 = 7;
                        month2 = 8;
                        month3 = 9;
                    }
                    else
                    {
                        month1 = 10;
                        month2 = 11;
                        month3 = 12;
                    }

                    SearchValues.Add(value);
                }
                else
                {
                    SearchEntity value = new SearchEntity();
                    value.FieldName  = "Quarter";
                    value.FieldValue = "0";
                    SearchValues.Add(value);
                }


                if (this.IsSalesTrue == true)
                {
                    SearchEntity value = new SearchEntity();
                    value.FieldName  = "IsSales";
                    value.FieldValue = "true";
                    SearchValues.Add(value);
                }
                else
                {
                    SearchEntity value = new SearchEntity();
                    value.FieldName  = "IsSales";
                    value.FieldValue = "false";
                    SearchValues.Add(value);
                }
                if (ShowProducts == true)
                {
                    SearchEntity value = new SearchEntity();
                    value.FieldName  = "Products";
                    value.FieldValue = "1";
                    SearchValues.Add(value);
                }
                else if (ShowServices == true)
                {
                    SearchEntity value = new SearchEntity();
                    value.FieldName  = "Products";
                    value.FieldValue = "2";
                    SearchValues.Add(value);
                }
                else
                {
                    SearchEntity value = new SearchEntity();
                    value.FieldName  = "Products";
                    value.FieldValue = "0";
                    SearchValues.Add(value);
                }


                //this.PandSHistory = this.PandSHistoryInternal;
                jsonSearch    = JsonConvert.SerializeObject(SearchValues);
                this.JsonData = jsonSearch;

                IPandSHistoryRepository purchaseRepository = new PandSHistoryRepository();
                var results = purchaseRepository.SaveSearchJson(jsonSearch, Convert.ToInt32(ScreenId.PandSHistoryList), "PandSHistory_List");
                if (Count != 0)
                {
                    this.PandSHistoryList = purchaseRepository.GetAllSalesInvoiceJson(jsonSearch, this.IncludingGSTTrue).ToList();
                    //changedateformat(this.PandSHistory);
                }

                this.PandSHistoryListcmb = this.PandSHistoryList.OrderBy(x => x.ProductCode).ToList();
                //this.PandSHistorycmbCredit = this.PandSHistorycmb.GroupBy(x => x.CashCreditNo).Select(g => g.First()).OrderBy(x => x.CreditCashNO).Where(y => y.CashCreditNo != null).ToList();
                //this.PandSHistorycmbSup = this.PandSHistory.GroupBy(x => x.CustomerName).Select(y => y.First()).OrderBy(x => x.CustomerName).Distinct().ToList();
                //this.PandSHistorycmbInv = this.PandSHistory.GroupBy(x => x.InvoiceNo).Select(y => y.First()).OrderBy(x => x.SortInvoiceNo).Distinct().ToList();
                //if (this.ShowAllTrue == true)
                //    this.ShowSelectedCount = 0;
                //else
                //    this.ShowSelectedCount = this.PandSHistory.Count();
                DefaultList = this.PandSHistoryListcmb;

                //TotalInvoiceAmount = Convert.ToString(PandSHistory.Sum(e => e.InvoiceAmountValue));
                //TotalCCDAmount = Convert.ToString(PandSHistory.Sum(e => e.TotalAmount));
                this.TotalCusM1      = Convert.ToString(PandSHistoryList.Sum(e => e.TotalM1));
                this.TotalCusM2      = Convert.ToString(PandSHistoryList.Sum(e => e.TotalM2));
                this.TotalCusM3      = Convert.ToString(PandSHistoryList.Sum(e => e.TotalM3));
                this.TotalCusQuarter = Convert.ToString(PandSHistoryList.Sum(e => e.QuarterTotal));
                this.TotalCusYear    = Convert.ToString(PandSHistoryList.Sum(e => e.YearTotal));
            }
        }