Ejemplo n.º 1
0
        /// <summary>
        /// This method is used to get new PQ
        /// </summary>
        public void GetNewPQ()
        {
            IsNew = true;
            ID    = 0;
            SelectedSupplierID = 0;
            BillToAddress      = string.Empty;
            ShipToAddress      = string.Empty;
            // ValidForDays = 0;
            InvoiceNo = string.Empty;
            // PQDetailsEntity.Clear();
            this.OurPONo           = GenerateNewInvoiceNo();
            TotalBeforeTax         = 0;
            TotalTax               = 0;
            TotalAfterTax          = 0;
            TotalBeforeTaxStr      = Convert.ToString(0);
            TotalTaxStr            = Convert.ToString(0);
            TotalAfterTaxStr       = Convert.ToString(0);
            PQErrors               = string.Empty;
            AllFieldsEnabled       = true;
            AllFieldsReadonly      = false;
            this.PaymentDueDateStr = null;
            this.InvoiceNo         = "PI-" + pqRepository.GetNewLatestInvoiceNo();
            PurchaseInvoiceEntity  = new PurchaseInvoiceEntity();
            BEDetailsEntity.Clear();
            LstSuppliers = supplierRepository.GetAllSupplier().Where(s => s.IsInActive != "Y").ToList();

            Accounts = Accounts.OrderBy(x => x.AccountName).Where(x => x.IsInactive == "N").ToObservable();
            //PQDetailsEntity = new ObservableCollection<DataGridViewModel>();
            var row = new AccountDataGridViewModel(AccountsList.Where(x => x.IsInactive == "N").ToList());

            row.TaxList = Taxes.ToList();;
            BEDetailsEntity.Add(row);
            OnPropertyChanged("BEDetailsEntity");
        }
Ejemplo n.º 2
0
        public PurchaseInvoicePandSViewModel(IRegionManager regionManager, IEventAggregator eventAggregator)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            this.regionManager   = regionManager;
            this.eventAggregator = eventAggregator;

            SaveCommand = new RelayCommand(SavePurchaseInvoice, CanSave);
            SupplierSelectionChangedCommand = new RelayCommand(OnSupplierChange);
            NewPQCommand             = new RelayCommand(OnNewPQ);
            DuplicateCommand         = new RelayCommand(OnDuplicatePQ, CanDuplicate);
            IncludeTaxCheckedCommand = new RelayCommand(OnIncludeTax);
            ExcludeTaxCheckedCommand = new RelayCommand(OnExcludeTax);
            DeleteCommand            = new RelayCommand(OnDeletePQ, CanDeletePQ);
            NavigateToClientCommand  = new RelayCommand(NavigatetoSupplier, CanNavigate);
            PaymentToSupplierCommand = new RelayCommand(OnPaymentToSupplier, CanPaymentToSupplier);
            PurchaseInvoiceEntity    = new PurchaseInvoiceEntity();
            PQDetailsEntity          = new ObservableCollection <DataGridViewModel>();


            int  minHeight   = 300;
            int  headerRows  = 369;//180+40+30+10;
            var  height      = System.Windows.SystemParameters.PrimaryScreenHeight - headerRows - 80;
            bool validHeight = int.TryParse(height.ToString(), out minHeight);

            this.PIFormGridHeight = minHeight;

            #region getting Options details
            GetOptionsData();
            #endregion

            AllFieldsEnabled  = true;
            AllFieldsReadonly = false;
            this.InvoiceDate  = DateTime.Now.Date;

            LoadSupplierBackground();

            //ProductList = pandsRepository.GetAllPandS().OrderBy(e => e.PSName);
            //ProductAndServices = new ObservableCollection<PandSDetailsModel>(ProductList);
            ProductList        = pandsRepository.GetPandSComboList();
            ProductAndServices = new ObservableCollection <PandSListModel>(ProductList).OrderBy(x => x.PSName).ToObservable();
            if (!String.IsNullOrEmpty(SharedValues.NewClick))
            {
                if (SharedValues.NewClick != "New")
                {
                    SupplierEnabled = false;//added on 23may2017
                    GetPurchaseInvoice(SharedValues.NewClick);
                }
                else if (SharedValues.NewClick == "New")
                {
                    SupplierEnabled = true;//added on 23may2017
                    GetNewPQ();
                }
            }
            Mouse.OverrideCursor = null;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// This method is used to get new PQ
        /// </summary>
        public void GetNewPQ()
        {
            VisibilityForImage = Visibility.Collapsed;
            IsNew = true;
            ID    = 0;
            SelectedSupplierID = 0;
            BillToAddress      = string.Empty;
            ShipToAddress      = string.Empty;
            // ValidForDays = 0;
            InvoiceNo             = GenerateNewInvoiceNo();
            TermsAndConditions    = TandC;
            TotalBeforeTax        = 0;
            TotalTax              = 0;
            TotalAfterTax         = 0;
            TotalBeforeTaxStr     = Convert.ToString(0);
            TotalTaxStr           = Convert.ToString(0);
            TotalAfterTaxStr      = Convert.ToString(0);
            PQErrors              = string.Empty;
            AllFieldsEnabled      = true;
            AllFieldsReadonly     = false;
            SupplierEnabled       = true;// added on 23 may 2017
            this.PaymentDueDate   = null;
            this.OurPONo          = string.Empty;
            PurchaseInvoiceEntity = new PurchaseInvoiceEntity();
            PQDetailsEntity.Clear();

            LstSuppliers       = supplierRepository.GetAllSupplier().Where(s => s.IsInActive != "Y").ToList();
            ProductAndServices = ProductAndServices.OrderBy(x => x.PSName).Where(x => x.IsInActive == "N").ToObservable();
            // PQDetailsEntity = new ObservableCollection<DataGridViewModel>();
            var row = new DataGridViewModel(ProductList.Where(x => x.IsInActive == "N").ToList());

            //row.PQQty = 1;
            //row.PQDiscount = 0;

            //row.GSTRate = TaxRate;
            //row.GSTRateStr = Convert.ToString(TaxRate) + "%";
            PQDetailsEntity.Add(row);
            OnPropertyChanged("PQDetailsEntity");
            var  lstOptions = pandsRepository.GetOptionDetails();
            bool?tax        = lstOptions.ShowAmountIncGST;

            if (tax == true)
            {
                ExcludingTax = false;
                IncludingTax = true;
            }
            else
            {
                IncludingTax = false;
                ExcludingTax = true;
            }
        }
Ejemplo n.º 4
0
        public PurchaseInvoiceForm GetDataIntoModel()
        {
            PurchaseInvoiceForm PQForm = new PurchaseInvoiceForm();

            PQForm.InvoiceDetails = new List <PurchaseInvoiceDetailEntity>();
            PurchaseInvoiceEntity model = new PurchaseInvoiceEntity();

            model.InvoiceNo      = this.InvoiceNo;
            model.InvoiceDate    = this.InvoiceDate;
            model.TotalBeforeTax = this.TotalBeforeTax;
            model.TotalTax       = this.TotalTax;
            model.TotalAfterTax  = this.TotalAfterTax;
            model.PaymentDueDate = this.PaymentDueDate;
            model.OurPONo        = this.OurPONo;
            model.SupplierID     = this.SelectedSupplierID;

            model.TermsAndConditions = this.TermsAndConditions;
            if (ExcludingTax == true)
            {
                model.ExcIncGST = false;
            }
            else
            {
                model.ExcIncGST = true;
            }

            PQForm.Invoice = model;

            foreach (var item in PQDetailsEntity)
            {
                PurchaseInvoiceDetailEntity pqEntity = new PurchaseInvoiceDetailEntity();
                pqEntity.PINo       = Convert.ToString(item.SelectedPSID);
                pqEntity.PandSCode  = item.PandSCode;
                pqEntity.PandSName  = item.PandSName;
                pqEntity.PIQty      = item.PQQty;
                pqEntity.PIPrice    = item.PQPrice;
                pqEntity.PIDiscount = item.PQDiscount;
                pqEntity.GSTRate    = item.GSTRate;
                pqEntity.GSTRateStr = Convert.ToString(item.GSTRate) + "%";
                pqEntity.PIAmount   = item.PQAmount;
                if (item.SelectedPSID != null && Convert.ToInt32(item.SelectedPSID) > 0)
                {
                    PQForm.InvoiceDetails.Add(pqEntity);
                }
            }
            return(PQForm);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 设置发票核销
 /// </summary>
 protected virtual void SetInvoices(bool isStatus)
 {
     InvokeItemLoader("InvoiceinItems");
     if (InvoiceinItems == null)
     {
         return;
     }
     foreach (var invoiceinItem in InvoiceinItems)
     {
         var invoice = new PurchaseInvoiceEntity
         {
             Purchase = invoiceinItem.Purchase,
             Amount   = isStatus?invoiceinItem.Amount:0 - invoiceinItem.Amount,
             Number   = InvoiceNumber,
             Remark   = "",
             SaveType = SaveType.Add
         };
         PurchaseInvoices.Add(invoice);
     }
 }
Ejemplo n.º 6
0
        public PurchaseInvoiceForm GetDataIntoModel()
        {
            try
            {
                OptionsEntity oData = new OptionsEntity();
                oData = customerRepository.GetOptionSettings();
                PurchaseInvoiceForm PQForm = new PurchaseInvoiceForm();
                PQForm.BEInvoiceDetails = new List <PurchaseInvoiceBEDetailsEntity>();
                PurchaseInvoiceEntity model = new PurchaseInvoiceEntity();
                // model.InvoiceNo = this.InvoiceNo;
                model.InvoiceDate    = DateTime.ParseExact(this.InvoiceDateStr, oData.DateFormat, null);
                model.TotalBeforeTax = this.TotalBeforeTax;
                model.TotalTax       = this.TotalTax;
                model.TotalAfterTax  = this.TotalAfterTax;
                model.PaymentDueDate = DateTime.ParseExact(this.PaymentDueDateStr, oData.DateFormat, null);
                model.OurPONo        = this.OurPONo;
                if (!string.IsNullOrEmpty(InvoiceNo))
                {
                    model.InvoiceNo = this.InvoiceNo;
                }
                else
                {
                    model.InvoiceNo = this.OurPONo;
                    this.InvoiceNo  = this.OurPONo;
                }
                model.SupplierID = this.SelectedSupplierID;

                model.TermsAndConditions = this.TermsAndConditions;
                if (ExcludingTax == true)
                {
                    model.ExcIncGST = false;
                }
                else
                {
                    model.ExcIncGST = true;
                }

                PQForm.Invoice = model;

                foreach (var item in BEDetailsEntity)
                {
                    PurchaseInvoiceBEDetailsEntity pqEntity = new PurchaseInvoiceBEDetailsEntity();
                    pqEntity.SelectedAccountId = item.SelectedAccountId;
                    if (item.SelectedAccountId != null)
                    {
                        var acc = Accounts.Where(e => e.AccountID == item.SelectedAccountId).SingleOrDefault();
                        if (acc != null)
                        {
                            pqEntity.AccountName = acc.AccountName;
                        }
                    }
                    pqEntity.Description   = item.Description;
                    pqEntity.SelectedTaxID = item.SelectedTaxID;
                    if (item.SelectedTaxID != null)
                    {
                        var tax = Taxes.Where(e => e.TaxID == item.SelectedTaxID).SingleOrDefault();
                        if (tax != null)
                        {
                            pqEntity.GSTCode = tax.TaxCode;
                            pqEntity.GSTRate = tax.TaxRate;
                        }
                    }
                    pqEntity.PQAmountStr = item.PQAmountStr;
                    pqEntity.PQAmount    = Convert.ToDecimal(item.PQAmountStr);
                    //pqEntity.TaxList = item.TaxList;
                    pqEntity.PIType = "BE";
                    //pqEntity.Amount= item.PQAmountStr;
                    //pqEntity.AmountBeforeTax= Convert.ToDecimal(item.PQAmountStr);
                    //pqEntity.TaxAmount = Convert.ToDecimal(item.PQAmountStr) * pqEntity.GSTRate;
                    //pqEntity.AmountAfterTax = pqEntity.AmountBeforeTax + pqEntity.TaxAmount;
                    if (item.SelectedAccountId != null && Convert.ToInt32(item.SelectedAccountId) > 0)
                    {
                        PQForm.BEInvoiceDetails.Add(pqEntity);
                    }
                }
                return(PQForm);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 7
0
        public PurchaseInvoiceBEViewModel(IRegionManager regionManager, IEventAggregator eventAggregator)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            this.regionManager   = regionManager;
            this.eventAggregator = eventAggregator;

            SaveCommand = new RelayCommand(SavePurchaseInvoice, CanSave);
            SupplierSelectionChangedCommand = new RelayCommand(OnSupplierChange);
            NewPQCommand             = new RelayCommand(OnNewPQ);
            DuplicateCommand         = new RelayCommand(OnDuplicatePQ, CanDuplicate);
            IncludeTaxCheckedCommand = new RelayCommand(OnIncludeTax);
            ExcludeTaxCheckedCommand = new RelayCommand(OnExcludeTax);
            //DeleteCommand = new RelayCommand(OnDeletePQ, CanDeletePQ);
            NavigateToClientCommand  = new RelayCommand(NavigatetoSupplier, CanNavigate);
            PaymentToSupplierCommand = new RelayCommand(OnPaymentToSupplier, CanPaymentToSupplier);
            NavigateToPICommand      = new RelayCommand(OnNavigateToPI);
            PurchaseInvoiceEntity    = new PurchaseInvoiceEntity();
            BEDetailsEntity          = new ObservableCollection <AccountDataGridViewModel>();
            CloseCommand             = new DelegateCommand(Close);
            AccountsList             = rmRepository.GetAccountDetails();
            //change in accounts type show
            var linkedAcnts = rmRepository.GetAccountDetails().Where(t => t.AccountType == Convert.ToByte(Account_TypeCode.UserCreatedExpenses) ||
                                                                     t.AccountType == Convert.ToByte(Account_TypeCode.UserCreatedAsset) || t.AccountType == Convert.ToByte(Account_TypeCode.UserCreatedCost)).ToList();

            //change account type show by 24th defects list

            Accounts = new ObservableCollection <AccountsEntity>(linkedAcnts).OrderBy(x => x.AccountName).ToObservable();
            TaxList  = customerRepository.GetTaxCodeAndRatesList();
            Taxes    = new ObservableCollection <TaxModel>(TaxList).OrderBy(x => x.TaxName).ToObservable();

            #region getting Options details
            GetOptionsData();
            #endregion

            AllFieldsEnabled  = true;
            AllFieldsReadonly = false;
            this.InvoiceDate  = DateTime.Now.Date;

            int  minHeight   = 300;
            int  headerRows  = 369;//180+40+30+10;
            var  height      = System.Windows.SystemParameters.PrimaryScreenHeight - headerRows - 80;
            bool validHeight = int.TryParse(height.ToString(), out minHeight);
            this.PIFormGridHeight = minHeight;

            LoadSupplierBackground();

            if (!String.IsNullOrEmpty(SharedValues.NewClick))
            {
                if (SharedValues.NewClick != "New")
                {
                    MustCompare = false;
                    GetPurchaseInvoice(SharedValues.NewClick);
                }
                else if (SharedValues.NewClick == "New")
                {
                    MustCompare = true;
                    GetNewPQ();
                }
            }
            Mouse.OverrideCursor = null;
        }