//  private static IEnumerable<PandSDetailsModel> ProductList;

        public DebitNoteViewModel(IRegionManager regionManager, IEventAggregator eventAggregator)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            this.regionManager   = regionManager;
            this.eventAggregator = eventAggregator;

            DebitNoteEntity = new DebitNoteEntity();
            PQDetailsEntity = new ObservableCollection <DataGridViewModel>();

            int  minHeight   = 300;
            int  headerRows  = 369;
            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;
            RubberStampDN     = false;

            LoadSupplierBackground();

            NavigateToClientCommand         = new RelayCommand(NavigatetoSupplier);
            SaveCommand                     = new RelayCommand(UpdateDebitNote, CanSave);
            CollectMoneyFromSupplierCommand = new RelayCommand(CollectMoneyFromSupplier, CanCollect);
            AdjustDebitNoteCommand          = new RelayCommand(AdjustDebitNote, CanAdjust);
            NavigateToPICommand             = new RelayCommand(NavigateToPI);
            PrintClickCommand               = new RelayCommand(PrintFunction, CanPrint);
            CloseCommand                    = new DelegateCommand(Close);
            if (!String.IsNullOrEmpty(SharedValues.NewClick))
            {
                if (SharedValues.NewClick != "New")
                {
                    MustCompare = false;
                    GetDebitNote(SharedValues.NewClick);
                }
                else if (SharedValues.NewClick == "New")
                {
                    MustCompare = true;
                }
            }
            Mouse.OverrideCursor = null;
        }
        public DebitNoteForm GetDataIntoModel()
        {
            OptionsEntity             oData = new OptionsEntity();
            ISalesOrderListRepository purchaseRepository = new SalesOrderListRepository();

            oData = purchaseRepository.GetOptionSettings();
            DebitNoteForm PQForm = new DebitNoteForm();

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

            model.DebitNo                  = this.DebitNo;
            model.DebitDate                = this.DebitDate;
            model.TotalBeforeTax           = this.TotalBeforeTax;
            model.TotalTax                 = this.TotalTax;
            model.TotalAfterTax            = this.TotalAfterTax;
            model.SupplierCreditNoteNo     = this.SupplierCreditNoteNo;
            model.SupplierCreditNoteDate   = DateTime.ParseExact(this.SupplierCreditNoteDateStr, oData.DateFormat, null);
            model.SupplierCreditNoteAmount = this.SupplierCreditNoteAmount;
            model.SupplierID               = this.SelectedSupplierID;

            model.TermsAndConditions = this.TermsAndConditions;

            PQForm.DebitNote = 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.º 3
0
        public DebitNoteForm GetDataIntoModel()
        {
            DebitNoteForm PQForm = new DebitNoteForm();

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

            model.DebitNo                  = this.DebitNo;
            model.DebitDate                = this.DebitDate;
            model.TotalBeforeTax           = this.TotalBeforeTax;
            model.TotalTax                 = this.TotalTax;
            model.TotalAfterTax            = this.TotalAfterTax;
            model.SupplierCreditNoteNo     = this.SupplierCreditNoteNo;
            model.SupplierCreditNoteDate   = this.SupplierCreditNoteDate;
            model.SupplierCreditNoteAmount = this.SupplierCreditNoteAmount;
            model.SupplierID               = this.SelectedSupplierID;

            model.TermsAndConditions = this.TermsAndConditions;

            PQForm.DebitNote = 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 = Math.Round((decimal)item.PQDiscount, 2);
                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);
        }