public void OnSelectionChange(object param)
 {
     if (SelectedCustomerID != 0)
     {
         BalAndUnpaidInv    = uiRepository.GetAllUnPaidInvoice(SelectedCustomerID, Convert.ToString(SelectedStatementDate));
         LstBalances        = BalAndUnpaidInv.LstBalances;
         LstInvoiceDetails  = BalAndUnpaidInv.LstInvoices;
         LstInvoiceDetails  = LstInvoiceDetails.OrderBy(e => e.InvoiceDate).ToList();
         TotalInvoiceAmount = Convert.ToString(LstInvoiceDetails.Sum(e => e.InvoiceAmount));
         TotalPaidAmount    = Convert.ToString(LstInvoiceDetails.Sum(e => e.AmountPaid));
         TotalDueAmount     = Convert.ToString(LstInvoiceDetails.Sum(e => e.AmountDue));
         LstCustomers.Where(x => x.CustomerID == SelectedCustomerID).ToList().ForEach(x => { x.IsSelected = false; });
         //LstCustomers.Where(x => x.CustomerID != SelectedCustomerID).ToList().ForEach(x => { x.IsSelected = false; });
     }
     else
     {
         if (param != null)
         {
             var SelectedCustomerID = param.ToString();
             BalAndUnpaidInv    = uiRepository.GetAllUnPaidInvoice(Convert.ToInt32(SelectedCustomerID), Convert.ToString(SelectedStatementDate));
             LstBalances        = BalAndUnpaidInv.LstBalances;
             LstInvoiceDetails  = BalAndUnpaidInv.LstInvoices;
             LstInvoiceDetails  = LstInvoiceDetails.OrderBy(e => e.InvoiceDate).ToList();
             TotalInvoiceAmount = Convert.ToString(LstInvoiceDetails.Sum(e => e.InvoiceAmount));
             TotalPaidAmount    = Convert.ToString(LstInvoiceDetails.Sum(e => e.AmountPaid));
             TotalDueAmount     = Convert.ToString(LstInvoiceDetails.Sum(e => e.AmountDue));
         }
     }
 }
Exemplo n.º 2
0
        public void PrintDocument(object param)
        {
            LstCustomers.RemoveAll(s => s.IsSelected == false);
            IEnumerable <int> selectedcustomers = (IEnumerable <int>)LstCustomers.Select(v => v.CustomerID);
            var SelectedDate = param.ToString();

            SharedValues.CustomersID = selectedcustomers;
            SharedValues.Print_Id    = SelectedCustomerID.ToString();

            var mainview = ServiceLocator.Current.GetInstance <SalesInvoiceCreditPayementReport>();

            var mainregion = this.regionManager.Regions[RegionNames.MainRegion];

            mainregion.Add(mainview);
            if (mainregion != null)
            {
                mainregion.Activate(mainview);
            }
        }
        public bool CanPrint(object param)
        {
            //bool a = false;
            List <CustomersUnpaidInvoicesEntity> demo = new List <CustomersUnpaidInvoicesEntity>();

            if (LstCustomers != null)
            {
                demo = LstCustomers.Where(x => x.IsSelected == true).ToList();
            }
            else
            {
                return(false);
            }

            if (demo.Count <= 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
        public void PrintDocument(object param)
        {
            LstCustomers.RemoveAll(s => s.IsSelected == false);
            IEnumerable <int> selectedcustomers = (IEnumerable <int>)LstCustomers.Select(v => v.CustomerID);

            SharedValues.CustomersID = selectedcustomers;
            var SelectedDate = param.ToString();

            SharedValues.Print_Id  = SelectedCustomerID.ToString();
            SharedValues.PrintDate = SelectedDate;
            //PrintSalesOrder();
            var mainview = ServiceLocator.Current.GetInstance <UnpaidSalesInvoiceReport>();

            var mainregion = this.regionManager.Regions[RegionNames.MainRegion];

            mainregion.Add(mainview);
            if (mainregion != null)
            {
                mainregion.Activate(mainview);
            }////

            // eventAggregator.GetEvent<TitleChangedEvent>().Publish("Customer Report");
        }
Exemplo n.º 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);
                    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);
                }
                else
                {
                    SearchEntity value = new SearchEntity();
                    value.FieldName  = "Month";
                    value.FieldValue = "0";
                    SearchValues.Add(value);
                }

                jsonSearch    = JsonConvert.SerializeObject(SearchValues);
                this.JsonData = jsonSearch;
                SharedValues.JsonDataValues = JsonData;
                IInvoiceCreditPaymentsRepository invRepository = new InvoiceCreditPaymentsRepository();
                var results = invRepository.SaveSearchJson(jsonSearch, Convert.ToInt32(ScreenId.InvoiceCreditPaymentsList), "InvoiceCreditPayments_List");
                if (Count != 0)
                {
                    this.LstCustomers = invRepository.GetCustomersList(jsonSearch).ToList();

                    var sup = LstCustomers.FirstOrDefault();
                    if (sup != null)
                    {
                        SelectedCustomerID = sup.SelectedCustomerID;
                    }
                }
            }
        }