Beispiel #1
0
        void ShowAll(object param)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            //  this.YearmonthQuartTrue = false;//added after client feedback
            // this.StartEndDateTrue = false;//added after client feedback
            this.PandSHistoryList    = FullPQList.OrderBy(x => x.ProductCode).ToList();
            this.PandSHistoryListcmb = FullPQList.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 == false)
            //    this.ShowSelectedCount = this.PandSHistory.Count();
            //else
            //    this.ShowSelectedCount = 0;

            this.SelectedSearchEndDate   = null;
            this.SelectedSearchMonth     = null;
            this.SelectedSearchQuarter   = null;
            this.SelectedSearchYear      = null;
            this.SelectedSearchStartDate = null;
            this.SelectedSearchEndDate   = null;
            if (this.IncludingGST == true)
            {
                this.PandSHistoryList = FullPQList.Where(x => x.ExcIncGST == true).OrderBy(x => x.ProductCode).ToList();
            }
            else
            {
                this.PandSHistoryList = FullPQList.Where(x => x.ExcIncGST == false).OrderBy(x => x.ProductCode).ToList();
            }
            Search(null);
            Mouse.OverrideCursor = null;
        }
 void ShowAll(object param)
 {
     this.ShowAllTrue             = true;
     Mouse.OverrideCursor         = Cursors.Wait;
     this.YearmonthQuartTrue      = false; //added after client feedback
     this.StartEndDateTrue        = false; //added after client feedback
     this.CreditNoteList          = FullPQList.OrderBy(x => x.CustomerName).ToList();
     this.CreditNoteListcmb       = FullPQList.OrderBy(x => x.CustomerName).ToList();
     this.CreditNoteListcmbCredit = this.CreditNoteList.GroupBy(x => x.InvoiceNoCashChequeNo).Select(g => g.First()).Where(y => !string.IsNullOrEmpty(y.InvoiceNoCashChequeNo) || !string.IsNullOrWhiteSpace(y.InvoiceNoCashChequeNo)).OrderBy(x => x.InvoiceNoCashChequeNo).ToList();
     this.CreditNoteListcmbCus    = this.CreditNoteList.GroupBy(x => x.CustomerName).Select(y => y.First()).Distinct().OrderBy(x => x.CustomerName).ToList();
     this.CreditNoteListcmbInv    = this.CreditNoteList.GroupBy(x => x.CreditNo).Select(y => y.First()).Distinct().OrderBy(x => x.SortCreditNoteNo).ToList();
     //if (this.ShowAllTrue == false)
     //    this.ShowSelectedCount = this.CreditNoteList.Count();
     //else
     //    this.ShowSelectedCount = 0;
     this.SelectedSearchEndDate   = null;
     this.SelectedSearchMonth     = null;
     this.SelectedSearchQuarter   = null;
     this.SelectedSearchYear      = null;
     this.SelectedSearchStartDate = null;
     this.SelectedSearchEndDate   = null;
     if (this.IncludingGSTTrue == true)
     {
         this.CreditNoteList = FullPQList.Where(x => x.ExcIncGST == true).OrderBy(x => x.CustomerName).ToList();
     }
     else
     {
         this.CreditNoteList = FullPQList.Where(x => x.ExcIncGST == false).OrderBy(x => x.CustomerName).ToList();
     }
     Search(null);
     Mouse.OverrideCursor = null;
 }
Beispiel #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.RefundFromSuppliersList = 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.RefundFromSuppliersList = 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.RefundFromSuppliersList = 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.CashChequeDateDate > this.SelectedSearchStartDate && x.CashChequeDateDate < 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.RefundFromSuppliersList = 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;

                IRefundFromSuppliersListRepository purchaseRepository = new RefundFromSuppliersListRepository();
                var results = purchaseRepository.SaveSearchJson(jsonSearch, Convert.ToInt32(ScreenId.RefundFromSuppliersList), "RefundFromSuppliers_List");
                if (Count != 0)
                {
                    this.RefundFromSuppliersList = purchaseRepository.GetAllPurInvoiceJson(jsonSearch);
                    //changedateformat(this.RefundFromSuppliersList);
                    //changedateformat(this.RefundFromSuppliersListcmb);
                    //changeNumberformat(this.RefundFromSuppliersList);
                    changeNumberformat(this.RefundFromSuppliersList);
                }

                this.RefundFromSuppliersListcmb      = this.RefundFromSuppliersList;
                this.RefundFromSuppliersListcmbDebit = this.RefundFromSuppliersListcmb.GroupBy(x => x.CashChequeNo).Select(g => g.First()).Where(y => y.CashChequeNo != null).ToList();
                this.RefundFromSuppliersListcmbSup   = this.RefundFromSuppliersList.GroupBy(x => x.SupplierName).Select(y => y.First()).Distinct().ToList();
                this.RefundFromSuppliersListcmbInv   = this.RefundFromSuppliersList.GroupBy(x => x.InvoiceNo).Select(y => y.First()).Distinct().ToList();
                if (this.ShowAllTrue == true)
                {
                    this.ShowSelectedCount = this.RefundFromSuppliersList.Count();
                }
                else
                {
                    this.ShowSelectedCount = this.RefundFromSuppliersList.Count();
                }
                DefaultList = this.RefundFromSuppliersListcmb;
            }
            TotalCashChequeAmount = Convert.ToString(RefundFromSuppliersList.Sum(e => e.CashChequeAmount));
            TotalPOPIAmount       = Convert.ToString(RefundFromSuppliersList.Sum(e => e.InvoiceAmountValue));
        }