示例#1
0
        public QuotationViewModel(TableViewModel parent)
        {
            Parent = parent;

            var subTotal = new VatAble();
            var tax      = new Vat(subTotal);
            var total    = new Total(subTotal, tax);

            Quotations.Add(subTotal);
            Quotations.Add(tax);
            Total = total;

            foreach (var work in Quotations)
            {
                work.AddParent(this);
            }
        }
示例#2
0
        public QuotationViewModel(TableViewModel parent)
        {
            Parent = parent;

            var subTotal = new SubTotal();
            var tax      = new Tax(subTotal);

            Quotations.Add(subTotal);
            Quotations.Add(tax);

            foreach (var work in Quotations)
            {
                work.AddParent(this);
            }

            OnPropertyChanged();
        }
示例#3
0
        // Methods
        private void CreateNewQuotation()
        {
            QuotationViewModel quotation = new QuotationViewModel(new Quotation(new QuotationStatus(DateTime.Now, QuotationStatusType.Created)));

            Quotations.Add(quotation);
            _unitOfWork.QuotationRepository.Add(quotation.QuotationModel);
            _unitOfWork.Save();

            IWindowService configureQuotationView = _windowFactory.GetWindowService(WindowType.ConfigureQuotationView);
            ConfigureQuotationViewModel configureQuotationViewModel = new ConfigureQuotationViewModel(configureQuotationView.Close, quotation, ActiveCustomers, _windowFactory);

            configureQuotationView.OpenAsDialog(configureQuotationViewModel);

            if (!configureQuotationViewModel.NeedToBeAdded)
            {
                _unitOfWork.QuotationRepository.Delete(quotation.QuotationModel);
                Quotations.Remove(quotation);
                _unitOfWork.Save();
            }
        }
示例#4
0
        /// <summary>
        /// 見積書改訂
        /// </summary>
        public void RevisionQuotation()
        {
            if (Quotations.Count.Equals(0))
            {
                Quotations.Add(new DataFileInfo(DataKind.Quotation, 0, DateTime.Now, 1, false));
            }
            else
            {
                Quotations.Add(new DataFileInfo(DataKind.Quotation, Quotations[Quotations.Count - 1].Revision + 1, DateTime.Now, 1, false));
            }

            SelectedQuotation = Quotations[Quotations.Count - 1];

            var file = new QuotationFile(SelectedQuotation)
            {
                JobName    = Name,
                QuoteNo    = new DocumentNoFile().UpdateDocumentNo(DataKind.Quotation),
                ClientName = SelectedClient?.Name
            };

            file.Save();
        }