void showexcGST(object param)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            int decimalpoints = Convert.ToInt32(this.DecimalPlaces);
            //foreach (var item in this.PayMoneyList)
            //{
            //    //item.InvoiceAmount = item.InvoiceAmountExcGST;
            //    item.InvoiceAmount = Math.Round(Convert.ToDouble(item.InvoiceAmountExcGST), decimalpoints).ToString();
            //}
            //if (this.ShowAllTrue == false)
            //    this.PayMoneyList = DefaultList.Where(x => x.ExcIncGST == false).ToList();
            //else
            //    this.PayMoneyList = FullPQList.Where(x => x.ExcIncGST == false).ToList();
            IPayMoneyListRepository purchaseRepository = new PayMoneyListRepository();

            this.PayMoneyList     = purchaseRepository.GetAllSalesInvoiceJson(this.JsonData).ToList();
            DefaultList           = this.PayMoneyList;
            this.PayMoneyListCash = this.PayMoneyList.OrderBy(x => x.CashChequeNo).ToList();

            if (this.ShowAllTrue == false)
            {
                this.ShowSelectedCount = this.PayMoneyList.Count();
            }
            else
            {
                this.ShowSelectedCount = this.PayMoneyList.Count();
            }

            Mouse.OverrideCursor = null;
        }
        }//end

        void ShowSummary(object param)
        {
            IPayMoneyListRepository purchaseRepository = new PayMoneyListRepository();

            this.PayMoneyList     = purchaseRepository.GetAllSalesInvoiceJson(this.JsonData).ToList();
            DefaultList           = this.PayMoneyList;
            this.PayMoneyListCash = this.PayMoneyList.OrderBy(x => x.CashChequeNo).ToList();

            Mouse.OverrideCursor = null;
        }
        private void RefreshData()
        {
            IPayMoneyListRepository purchaseRepository = new PayMoneyListRepository();

            this.DateFormat   = purchaseRepository.GetDateFormat();
            this.ShowAllCount = purchaseRepository.GetAllSalesInvoice().Count();
            GetOptionsandTaxValues();
            this.AllCount = purchaseRepository.getTotalCount(Convert.ToInt32(ScreenId.PayMoneyList));
            this.JsonData = purchaseRepository.GetLastSelectionData(Convert.ToInt32(ScreenId.PayMoneyList));

            this.PayMoneyList     = purchaseRepository.GetAllSalesInvoiceJson(this.JsonData).ToList();
            DefaultList           = this.PayMoneyList;
            this.PayMoneyListCash = this.PayMoneyList.OrderBy(x => x.CashChequeNo).ToList();

            this.TotalAmount = Convert.ToString(this.PayMoneyList.Sum(e => e.Amount));


            if (this.JsonData != null)
            {
                var objResponse1 = JsonConvert.DeserializeObject <List <SearchEntity> >(JsonData);
                if (objResponse1[6].FieldValue == "True")
                {
                    this.ShowAllTrue        = true;
                    this.ShowSelectedTrue   = false;
                    this.YearmonthQuartTrue = true;
                    this.StartEndDateTrue   = false;
                }
            }
            else
            {
                this.ShowAllTrue        = true;
                this.ShowSelectedTrue   = false;
                this.YearmonthQuartTrue = true;
                this.StartEndDateTrue   = false;
            }

            this.ShowSelectedCount = this.PayMoneyList.Count();

            this.YearRange = purchaseRepository.GetYearRange().ToList();

            SetDefaultSearchSelection();
        }
        void GetOptionsandTaxValues()
        {
            OptionsEntity           oData = new OptionsEntity();
            IPayMoneyListRepository purchaseRepository = new PayMoneyListRepository();

            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.PayMoneyList)
                    //{
                    //    item.InvoiceAmount = Math.Round(Convert.ToDouble(item.InvoiceAmount), decimalpoints).ToString();
                    //}
                    //this.PayMoneyList = this.PayMoneyList.Where(x => x.ExcIncGST == true).ToList();
                }
                else
                {
                    this.IncludingGSTTrue  = false;
                    this.IncludingGSTFalse = true;
                    int decimalpoints = Convert.ToInt32(DecimalPlaces);
                    //foreach (var item in this.PayMoneyList)
                    //{
                    //    //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.PayMoneyList != null)
                    {
                        this.PayMoneyList = this.PayMoneyList.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;
            }
        }
        void Search(object param)
        {
            if (Count != 0)
            {
                SearchValues = new List <SearchEntity>();
                if (this.SelectedSearchYear != null || this.SelectedSearchYear == string.Empty)
                {
                    SearchEntity value = new SearchEntity();
                    value.FieldName  = "Year";
                    value.FieldValue = this.SelectedSearchYear;
                    SearchValues.Add(value);
                    var year = Convert.ToInt32(this.SelectedSearchYear);
                }
                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.SelectedSearchMonth != null || this.SelectedSearchMonth == string.Empty)
                {
                    SearchEntity value = new SearchEntity();
                    value.FieldName  = "Month";
                    value.FieldValue = this.SelectedSearchMonth;
                    SearchValues.Add(value);
                    var month = Convert.ToInt32(this.SelectedSearchMonth);
                }
                else
                {
                    SearchEntity value = new SearchEntity();
                    value.FieldName  = "Month";
                    value.FieldValue = "0";
                    SearchValues.Add(value);
                }
                if (this.SelectedSearchStartDate != null && this.SelectedSearchEndDate != null)
                {
                    SearchEntity value = new SearchEntity();
                    value.FieldName  = "StartDate";
                    value.FieldValue = string.Format("{0:MMM/dd/yyyy}", this.SelectedSearchStartDate);
                    SearchValues.Add(value);
                    SearchEntity value1 = new SearchEntity();
                    value1.FieldName  = "EndDate";
                    value1.FieldValue = string.Format("{0:MMM/dd/yyyy}", this.SelectedSearchEndDate);
                    SearchValues.Add(value1);
                }
                else
                {
                    SearchEntity value = new SearchEntity();
                    value.FieldName  = "StartDate";
                    value.FieldValue = "0";
                    //SearchValues.Add(value);
                    SearchEntity value1 = new SearchEntity();
                    value1.FieldName  = "EndDate";
                    value1.FieldValue = "0";
                    SearchValues.Add(value);
                    SearchValues.Add(value1);
                }
                if (this.PandS != null)
                {
                    SearchEntity value = new SearchEntity();
                    value.FieldName  = "PandS";
                    value.FieldValue = this.PandS.ToString();
                    SearchValues.Add(value);
                }
                else
                {
                    SearchEntity value = new SearchEntity();
                    value.FieldName  = "PandS";
                    value.FieldValue = "0";
                    SearchValues.Add(value);
                }
                if (this.ShowAllTrue == true)
                {
                    SearchEntity value = new SearchEntity();
                    value.FieldName  = "ShowAll";
                    value.FieldValue = this.ShowAllTrue.ToString();
                    SearchValues.Add(value);
                }
                else
                {
                    SearchEntity value = new SearchEntity();
                    value.FieldName  = "ShowAll";
                    value.FieldValue = "false";
                    SearchValues.Add(value);
                }
                jsonSearch    = JsonConvert.SerializeObject(SearchValues);
                this.JsonData = jsonSearch;

                IPayMoneyListRepository purchaseRepository = new PayMoneyListRepository();
                var results = purchaseRepository.SaveSearchJson(jsonSearch, Convert.ToInt32(ScreenId.PayMoneyList), "PandS_Sold_List");
                if (Count != 0)
                {
                    this.PayMoneyList     = purchaseRepository.GetAllSalesInvoiceJson(jsonSearch).ToList();
                    DefaultList           = this.PayMoneyList;
                    this.PayMoneyListCash = this.PayMoneyList.OrderBy(x => x.CashChequeNo).ToList();

                    this.TotalAmount = Convert.ToString(this.PayMoneyList.Sum(e => e.Amount));
                }


                if (this.ShowAllTrue == true)
                {
                    this.ShowSelectedCount = this.PayMoneyList.Count();
                }
                else
                {
                    this.ShowSelectedCount = this.PayMoneyList.Count();
                }
            }
        }
 public void LoadSearchResult(string customerName)
 {
     IPayMoneyListRepository purchaseRepository = new PayMoneyListRepository();
     //this.ShowAllCount = purchaseRepository.GetAllSalesInvoice().Count();
     //this.PayMoneyList = purchaseRepository.GetAllSalesInvoice().Where(x => x.CustomerName == customerName).ToList();
 }