示例#1
0
        private void RefreshData()
        {
            IPaymentsToSuppliersRepository purchaseRepository = new PaymentsToSuppliersRepository();

            this.DateFormat   = purchaseRepository.GetDateFormat();
            this.ShowAllCount = purchaseRepository.GetAllPurInvoice().Count();
            GetOptionsandTaxValues();
            this.JsonData = purchaseRepository.GetLastSelectionData(Convert.ToInt32(ScreenId.PaymentsToSuppliersList));
            this.PaymentsToSuppliersList         = purchaseRepository.GetAllPurInvoiceJson(this.JsonData).OrderBy(e => e.SupplierName).ToList();
            this.PaymentsToSuppliersListcmb      = purchaseRepository.GetAllPurInvoice().OrderBy(e => e.SupplierName).ToList();
            this.ShowSelectedCount               = this.PaymentsToSuppliersList.Count();
            this.PaymentsToSuppliersListcmbDebit = this.PaymentsToSuppliersListcmb.GroupBy(x => x.CashChequeNo).Select(g => g.First()).Where(y => y.CashChequeNo != null).OrderBy(e => e.CashChequeNo).ToList();
            this.PaymentsToSuppliersListcmbSup   = this.PaymentsToSuppliersList.GroupBy(x => x.SupplierName).Select(y => y.First()).Distinct().OrderBy(e => e.SupplierName).ToList();

            this.PaymentsToSuppliersListcmbInv = this.PaymentsToSuppliersList.GroupBy(x => x.InvoiceNo).Select(y => y.First()).Distinct().OrderBy(e => e.InvoiceNo).ToList();
            this.YearRange = purchaseRepository.GetYearRange().ToList();
            //changedateformat(this.PaymentsToSuppliersList);
            //changedateformat(this.PaymentsToSuppliersListcmb);
            changeNumberformat(this.PaymentsToSuppliersList);
            changeNumberformat(this.PaymentsToSuppliersListcmb);
            DefaultList = this.PaymentsToSuppliersList;
            FullPQList  = this.PaymentsToSuppliersListcmb;
            //this.ShowAllCount = this.PurchaseInvoiceListcmb.Count();
            SetDefaultSearchSelection(this.JsonData);
            var    Updateddate = this.PaymentsToSuppliersListcmb.Max(x => x.CreatedDate);
            string date        = this.DateFormat as string;

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

            TotalCashChequeAmount = Convert.ToString(PaymentsToSuppliersList.Sum(e => e.CashChequeAmount));
            TotalPOPIAmount       = Convert.ToString(PaymentsToSuppliersList.Sum(e => e.InvoiceAmountValue));
            //this.GetData(this.SelectedSearchSupplier);
        }
示例#2
0
        public void GetData(string SearchFilter, string parameter)
        {
            //IPurchaseInvoiceListRepository purchaseRepository = new PurchaseInvoiceListRepository();
            //var result = purchaseRepository.GetAllPurInvoice().ToList();
            if (SearchFilter != null || SearchFilter == string.Empty)
            {
                if (parameter == "Supplier")
                {
                    this.ShowAllCount = this.ShowAllCount;
                    //var searchname = SearchFilter.Split('#')[0];
                    if (this.ShowAllTrue == true)
                    {
                        this.PaymentsToSuppliersList = FullPQList.Where(x => (x.SupplierName == SearchFilter)).ToList();
                    }
                    else
                    {
                        this.PaymentsToSuppliersList = DefaultList.Where(x => (x.SupplierName == SearchFilter)).ToList();
                    }

                    //DefaultList = DefaultList.Where(x => x.SupplierName == SearchFilter).ToList();
                }

                //DefaultList = DefaultList.Where(x => x.SupplierName == SearchFilter).ToList();

                if (parameter == "CashChequeNo")
                {
                    this.ShowAllCount = this.ShowAllCount;
                    //var searchname = SearchFilter.Split('#')[0];
                    if (this.ShowAllTrue == true)
                    {
                        this.PaymentsToSuppliersList = FullPQList.Where(x => x.CashChequeNo == SearchFilter).ToList();
                    }
                    else
                    {
                        this.PaymentsToSuppliersList = DefaultList.Where(x => x.CashChequeNo == SearchFilter).ToList();
                    }

                    //DefaultList = DefaultList.Where(x => x.SupplierName == SearchFilter).ToList();
                }

                if (parameter == "InvoiceNo")
                {
                    this.ShowAllCount = this.ShowAllCount;
                    //var searchname = SearchFilter.Split('#')[0];
                    if (this.ShowAllTrue == true)
                    {
                        this.PaymentsToSuppliersList = FullPQList.Where(x => x.InvoiceNo == SearchFilter).ToList();
                    }
                    else
                    {
                        this.PaymentsToSuppliersList = DefaultList.Where(x => x.InvoiceNo == SearchFilter).ToList();
                    }

                    //DefaultList = DefaultList.Where(x => x.SupplierName == SearchFilter).ToList();
                }
                //if (parameter == "InvoiceNo")
                //{
                //    this.ShowAllCount = this.ShowAllCount;
                //    this.PurchaseInvoiceList = DefaultList.Where(x => x.InvoiceNo == SearchFilter).ToList();
                //    DefaultList = DefaultList.Where(x => x.InvoiceNo == SearchFilter).ToList();
                //}
                //if (parameter == "SearchYear")
                //{
                //    this.ShowAllCount = this.ShowAllCount;
                //    this.PurchaseInvoiceList = DefaultList.Where(x => x.CreatedDate.Value.Year.ToString() == SearchFilter).ToList();
                //}
                //if (parameter == "Supplier")
                //{
                //    this.ShowAllCount = this.ShowAllCount;
                //    this.PurchaseInvoiceList = DefaultList.Where(x => x.SupplierName == SearchFilter).ToList();
                //}
                //if (parameter == "Supplier")
                //{
                //    this.ShowAllCount = this.ShowAllCount;
                //    this.PurchaseInvoiceList = DefaultList.Where(x => x.SupplierName == SearchFilter).ToList();
                //}
                //if (parameter == "Supplier")
                //{
                //    this.ShowAllCount = this.ShowAllCount;
                //    this.PurchaseInvoiceList = DefaultList.Where(x => x.SupplierName == SearchFilter).ToList();
                //}
                //if (parameter == "Supplier")
                //{
                //    this.ShowAllCount = this.ShowAllCount;
                //    this.PurchaseInvoiceList = DefaultList.Where(x => x.SupplierName == SearchFilter).ToList();
                //}
                //if (parameter == "Supplier")
                //{
                //    this.ShowAllCount = this.ShowAllCount;
                //    this.PurchaseInvoiceList = DefaultList.Where(x => x.SupplierName == SearchFilter).ToList();
                //}
            }
            else
            {
                if (this.ShowAllTrue == true)
                {
                    this.PaymentsToSuppliersList = FullPQList.ToList();
                }
                else
                {
                    this.PaymentsToSuppliersList = DefaultList.ToList();
                }
            }
            TotalCashChequeAmount = Convert.ToString(PaymentsToSuppliersList.Sum(e => e.CashChequeAmount));
            TotalPOPIAmount       = Convert.ToString(PaymentsToSuppliersList.Sum(e => e.InvoiceAmountValue));
        }
示例#3
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);
                    var year = Convert.ToInt32(this.SelectedSearchYear);
                    DefaultList = FullPQList.Where(x => x.CreatedDate.Value.Year == year).ToList();
                    //if (this.IncludingGSTTrue == true)
                    //    this.PurchaseInvoiceListInternal = DefaultList.Where(x => x.ExcIncGST == true).ToList();
                    //else
                    //    this.PurchaseInvoiceListInternal = DefaultList.Where(x => x.ExcIncGST == false).ToList();
                    this.PaymentsToSuppliersList = DefaultList;
                }
                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;
                    }
                    DefaultList = FullPQList.Where(x => x.CreatedDate.Value.Month == month1 || x.CreatedDate.Value.Month == month2 || x.CreatedDate.Value.Month == month3).ToList();
                    //if (this.IncludingGSTTrue == true)
                    //    this.PurchaseInvoiceListInternal = DefaultList.Where(x => x.ExcIncGST == true).ToList();
                    //else
                    //    this.PurchaseInvoiceListInternal = DefaultList.Where(x => x.ExcIncGST == false).ToList();
                    this.PaymentsToSuppliersList = DefaultList;
                    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);
                    DefaultList = FullPQList.Where(x => x.CreatedDate.Value.Month == month).ToList();
                    //if (this.IncludingGSTTrue == true)
                    //    this.PurchaseInvoiceListInternal = DefaultList.Where(x => x.ExcIncGST == true).ToList();
                    //else
                    //    this.PurchaseInvoiceListInternal = DefaultList.Where(x => x.ExcIncGST == false).ToList();
                    this.PaymentsToSuppliersList = DefaultList;
                }
                if (this.SelectedSearchStartDate != null && this.SelectedSearchEndDate != null)
                {
                    SearchEntity value = new SearchEntity();
                    value.FieldName = "StartDate";
                    //value.FieldValue = this.SelectedSearchStartDate.ToString();
                    value.FieldValue = string.Format("{0:MMM/dd/yyyy}", this.SelectedSearchStartDate);

                    SearchValues.Add(value);
                    //string[] value = new string[2];
                    SearchEntity value1 = new SearchEntity();
                    value1.FieldName = "EndDate";
                    //value1.FieldValue = this.SelectedSearchEndDate.ToString();
                    value1.FieldValue = string.Format("{0:MMM/dd/yyyy}", this.SelectedSearchEndDate);

                    DefaultList = FullPQList.Where(x => x.CreatedDate > this.SelectedSearchStartDate && x.CreatedDate < this.SelectedSearchEndDate).ToList();
                    //if (this.IncludingGSTTrue == true)
                    //    this.PurchaseInvoiceListInternal = DefaultList.Where(x => x.ExcIncGST == true).ToList();
                    //else
                    //    this.PurchaseInvoiceListInternal = DefaultList.Where(x => x.ExcIncGST == false).ToList();
                    this.PaymentsToSuppliersList = DefaultList;
                    SearchValues.Add(value);
                    SearchValues.Add(value1);
                }
                //if (this.SelectedSearchEndDate != null || this.SelectedSearchEndDate == string.Empty)
                //{
                //    string[] value = new string[2];
                //    value[0] = "EndDate";
                //    value[1] = this.SelectedSearchEndDate;
                //    SearchValues.Add(value);
                //}

                //this.PurchaseInvoiceList = this.PurchaseInvoiceListInternal;
                jsonSearch    = JsonConvert.SerializeObject(SearchValues);
                this.JsonData = jsonSearch;

                IPaymentsToSuppliersRepository purchaseRepository = new PaymentsToSuppliersRepository();
                var results = purchaseRepository.SaveSearchJson(jsonSearch, Convert.ToInt32(ScreenId.PaymentsToSuppliersList), "Payments_To_Suppliers_List");
                if (Count != 0)
                {
                    this.PaymentsToSuppliersList = purchaseRepository.GetAllPurInvoiceJson(jsonSearch);
                    //changedateformat(this.PaymentsToSuppliersList);
                    //changedateformat(this.PaymentsToSuppliersListcmb);
                    //changeNumberformat(this.PaymentsToSuppliersList);
                    changeNumberformat(this.PaymentsToSuppliersList);
                }

                this.PaymentsToSuppliersListcmb      = this.PaymentsToSuppliersList;
                this.PaymentsToSuppliersListcmbDebit = this.PaymentsToSuppliersListcmb.GroupBy(x => x.CashChequeNo).Select(g => g.First()).Where(y => y.CashChequeNo != null).ToList();
                this.PaymentsToSuppliersListcmbSup   = this.PaymentsToSuppliersList.GroupBy(x => x.SupplierName).Select(y => y.First()).Distinct().ToList();
                this.PaymentsToSuppliersListcmbInv   = this.PaymentsToSuppliersList.GroupBy(x => x.InvoiceNo).Select(y => y.First()).Distinct().ToList();
                if (this.ShowAllTrue == true)
                {
                    this.ShowSelectedCount = 0;
                }
                else
                {
                    this.ShowSelectedCount = this.PaymentsToSuppliersList.Count();
                }
                DefaultList = this.PaymentsToSuppliersListcmb;
            }
            TotalCashChequeAmount = Convert.ToString(PaymentsToSuppliersList.Sum(e => e.CashChequeAmount));
            TotalPOPIAmount       = Convert.ToString(PaymentsToSuppliersList.Sum(e => e.InvoiceAmountValue));
        }