Exemple #1
0
        public void LoadSearchResult(string customerName)
        {
            ISupplierHistoryRepository purchaseRepository = new SupplierHistoryRepository();

            this.ShowAllCount    = purchaseRepository.GetAllSalesInvoice().Count();
            this.SupplierHistory = purchaseRepository.GetAllSalesInvoice().Where(x => x.SupplierName == customerName).ToList();
        }
Exemple #2
0
        private void RefreshData()
        {
            ISupplierHistoryRepository purchaseRepository = new SupplierHistoryRepository();

            // this.DateFormat = purchaseRepository.GetDateFormat();
            //this.ShowAllCount = purchaseRepository.GetAllPurchaseInvoice().Count();
            GetOptionsandTaxValues();
            this.JsonData                 = purchaseRepository.GetLastSelectionData(Convert.ToInt32(ScreenId.SupplierHistory));
            this.SupplierHistory          = purchaseRepository.GetAllSalesInvoiceJson(this.JsonData, this.IncludingGSTTrue).ToList();
            this.SupplierHistorycmb       = purchaseRepository.GetAllSalesInvoice().OrderBy(x => x.SupplierName).ToList();
            this.ShowSelectedCount        = this.SupplierHistory.Count();
            this.SupplierHistorycmbCredit = this.SupplierHistorycmb.GroupBy(x => x.CashCreditNo).Select(g => g.First()).OrderBy(x => x.CreditCashNO).Where(y => y.CashCreditNo != null).ToList();
            this.SupplierHistorycmbSup    = this.SupplierHistory.GroupBy(x => x.SupplierName).Select(y => y.First()).OrderBy(x => x.SupplierName).Distinct().ToList();
            this.SupplierHistorycmbSup    = this.SupplierHistory.GroupBy(x => x.SupplierName).Select(y => y.First()).OrderBy(x => x.SupplierName).Distinct().ToList();
            this.SupplierHistorycmbInv    = this.SupplierHistory.GroupBy(x => x.InvoiceNo).Select(y => y.First()).OrderBy(x => x.SortInvoiceNo).Distinct().ToList();
            this.YearRange                = purchaseRepository.GetYearRange().ToList();

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

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

            TotalInvoiceAmount   = Convert.ToString(SupplierHistory.Sum(e => e.InvoiceAmountValue));
            TotalCCDAmount       = Convert.ToString(SupplierHistory.Sum(e => e.TotalAmount));
            this.TotalCusM1      = Convert.ToString(SupplierHistory.Sum(e => e.TotalM1));
            this.TotalCusM2      = Convert.ToString(SupplierHistory.Sum(e => e.TotalM2));
            this.TotalCusM3      = Convert.ToString(SupplierHistory.Sum(e => e.TotalM3));
            this.TotalCusQuarter = Convert.ToString(SupplierHistory.Sum(e => e.QuarterTotal));
            this.TotalCusYear    = Convert.ToString(SupplierHistory.Sum(e => e.YearTotal));
            //this.GetData(this.SelectedSearchSupplier);
        }
Exemple #3
0
        }//end

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

            this.SupplierHistory = purchaseRepository.GetAllSalesInvoiceJson(this.JsonData, this.IncludingGSTTrue).ToList();
            if (this.ShowAllTrue == false)
            {
                this.ShowSelectedCount = this.SupplierHistory.Count();
            }
            else
            {
                this.ShowSelectedCount = 0;
            }
            this.SupplierHistorycmb       = this.SupplierHistory.OrderBy(x => x.SupplierName).ToList();
            this.SupplierHistorycmbCredit = this.SupplierHistorycmb.GroupBy(x => x.CashCreditNo).Select(g => g.First()).OrderBy(x => x.CreditCashNO).Where(y => y.CashCreditNo != null).ToList();
            this.SupplierHistorycmbSup    = this.SupplierHistory.GroupBy(x => x.SupplierName).Select(y => y.First()).OrderBy(x => x.SupplierName).Distinct().ToList();
            this.SupplierHistorycmbInv    = this.SupplierHistory.GroupBy(x => x.InvoiceNo).Select(y => y.First()).OrderBy(x => x.SortInvoiceNo).Distinct().ToList();
            DefaultList = this.SupplierHistorycmb;

            Mouse.OverrideCursor = null;
        }
Exemple #4
0
        void GetOptionsandTaxValues()
        {
            OptionsEntity oData = new OptionsEntity();
            ISupplierHistoryRepository purchaseRepository = new SupplierHistoryRepository();

            oData = purchaseRepository.GetOptionSettings();
            if (oData != null)
            {
                this.CurrencyName = oData.CurrencyCode;     //there is no currency name field in database

                TaxModel objDefaultTax = new TaxModel();
                objDefaultTax = purchaseRepository.GetDefaultTaxes();
                if (objDefaultTax != null)
                {
                    this.TaxName = objDefaultTax.TaxName;
                }
                else
                {
                    this.TaxName = "GST";
                }
            }
        }
Exemple #5
0
        void showexcGST(object param)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            int decimalpoints = Convert.ToInt32(this.DecimalPlaces);

            ISupplierHistoryRepository purchaseRepository = new SupplierHistoryRepository();

            this.SupplierHistory = purchaseRepository.GetAllSalesInvoiceJson(this.JsonData, this.IncludingGSTTrue).ToList();
            if (this.ShowAllTrue == false)
            {
                this.ShowSelectedCount = this.SupplierHistory.Count();
            }
            else
            {
                this.ShowSelectedCount = 0;
            }
            this.SupplierHistorycmb       = this.SupplierHistory.OrderBy(x => x.SupplierName).ToList();
            this.SupplierHistorycmbCredit = this.SupplierHistorycmb.GroupBy(x => x.CashCreditNo).Select(g => g.First()).OrderBy(x => x.CreditCashNO).Where(y => y.CashCreditNo != null).ToList();
            this.SupplierHistorycmbSup    = this.SupplierHistory.GroupBy(x => x.SupplierName).Select(y => y.First()).OrderBy(x => x.SupplierName).Distinct().ToList();
            this.SupplierHistorycmbInv    = this.SupplierHistory.GroupBy(x => x.InvoiceNo).Select(y => y.First()).OrderBy(x => x.SortInvoiceNo).Distinct().ToList();
            DefaultList = this.SupplierHistorycmb;

            Mouse.OverrideCursor = null;
        }
Exemple #6
0
        void GetOptionsandTaxValues()
        {
            OptionsEntity oData = new OptionsEntity();
            ISupplierHistoryRepository purchaseRepository = new SupplierHistoryRepository();

            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.SupplierHistory)
                    //{
                    //    item.InvoiceAmount = Math.Round(Convert.ToDouble(item.InvoiceAmount), decimalpoints).ToString();
                    //}
                    //this.SupplierHistory = this.SupplierHistory.Where(x => x.ExcIncGST == true).ToList();
                }
                else
                {
                    this.IncludingGSTTrue  = false;
                    this.IncludingGSTFalse = true;
                    int decimalpoints = Convert.ToInt32(DecimalPlaces);
                    //foreach (var item in this.SupplierHistory)
                    //{
                    //    //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.SupplierHistory != null)
                    {
                        this.SupplierHistory = this.SupplierHistory.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;
            }
        }
Exemple #7
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);
                }
                else
                {
                    SearchEntity value = new SearchEntity();
                    value.FieldName  = "Year";
                    value.FieldValue = "0";
                    SearchValues.Add(value);
                    var year = Convert.ToInt32(this.SelectedSearchYear);
                }
                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);
                }
                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);
                    SearchValues.Add(value);
                    SearchValues.Add(value1);
                }
                jsonSearch    = JsonConvert.SerializeObject(SearchValues);
                this.JsonData = jsonSearch;

                ISupplierHistoryRepository purchaseRepository = new SupplierHistoryRepository();
                var results = purchaseRepository.SaveSearchJson(jsonSearch, Convert.ToInt32(ScreenId.SupplierHistory), "Purchase_Invoice_List");
                if (Count != 0)
                {
                    this.SupplierHistory = purchaseRepository.GetAllSalesInvoiceJson(jsonSearch, this.IncludingGSTTrue).ToList();
                    //changedateformat(this.SupplierHistory);
                    changeNumberformat(this.SupplierHistory);
                }

                this.SupplierHistorycmb       = this.SupplierHistory.OrderBy(x => x.SupplierName).ToList();
                this.SupplierHistorycmbCredit = this.SupplierHistorycmb.GroupBy(x => x.CashCreditNo).Select(g => g.First()).OrderBy(x => x.CreditCashNO).Where(y => y.CashCreditNo != null).ToList();
                this.SupplierHistorycmbSup    = this.SupplierHistory.GroupBy(x => x.SupplierName).Select(y => y.First()).OrderBy(x => x.SupplierName).Distinct().ToList();
                this.SupplierHistorycmbInv    = this.SupplierHistory.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.SupplierHistory.Count();
                }
                DefaultList = this.SupplierHistorycmb;

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