Exemple #1
0
        /// <summary>
        /// This method is used to get new PO
        /// </summary>
        public void GetNewPO()
        {
            VisibilityForImage = Visibility.Collapsed;
            IsNew = true;
            ID    = 0;
            SelectedSupplierID = 0;
            BillToAddress      = string.Empty;
            ShipToAddress      = string.Empty;
            //ValidForDays = 0;
            OrderNo             = GenerateNewOrderNo();
            TermsAndConditions  = TandC;
            OrderDate           = DateTime.Now.Date;
            DeliveryDate        = DateTime.Now.Date;
            TotalBeforeTax      = 0;
            TotalTax            = 0;
            TotalAfterTax       = 0;
            TotalBeforeTaxStr   = Convert.ToString(0);
            TotalTaxStr         = Convert.ToString(0);
            TotalAfterTaxStr    = Convert.ToString(0);
            POErrors            = string.Empty;
            AllFieldsEnabled    = true;
            AllFieldsReadonly   = false;
            SupplierEnabled     = true;// added on 23 may 2017
            PurchaseOrderEntity = new PurchaseOrderEntity();
            PODetailsEntity.Clear();

            LstSuppliers       = supplierRepository.GetAllSupplier().Where(s => s.IsInActive != "Y").ToList();
            ProductAndServices = ProductAndServices.OrderBy(x => x.PSName).Where(x => x.IsInActive == "N").ToObservable();
            // PODetailsEntity = 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) + "%";
            PODetailsEntity.Add(row);
            OnPropertyChanged("PODetailsEntity");
            var  lstOptions = pandsRepository.GetOptionDetails();
            bool?tax        = lstOptions.ShowAmountIncGST;

            if (tax == true)
            {
                ExcludingTax = false;
                IncludingTax = true;
            }
            else
            {
                IncludingTax = false;
                ExcludingTax = true;
            }
        }
Exemple #2
0
        public void GetPurchaseOrder(string pqNo)
        {
            // Mouse.OverrideCursor = Cursors.Wait;
            PurchaseOrderForm pqf = pqRepository.GetPurchaseOrder(pqNo);

            this.ID        = pqf.Order.ID;
            this.OrderNo   = pqf.Order.OrderNo;
            this.OrderDate = pqf.Order.OrderDate;
            //this.ValidForDays = pqf.Order.ValidForDays;
            this.DeliveryDate       = pqf.Order.DeliveryDate;
            this.SelectedSupplierID = pqf.Order.SupplierID;
            //if (this.SelectedSupplierID > 0)
            //{
            //    GetSupplierDetails();
            //}

            this.TermsAndConditions = pqf.Order.TermsAndConditions;

            this.TotalBeforeTax    = pqf.Order.TotalBeforeTax;
            this.TotalTax          = pqf.Order.TotalTax;
            this.TotalAfterTax     = pqf.Order.TotalAfterTax;
            this.TotalBeforeTaxStr = Convert.ToString(this.TotalBeforeTax);
            this.TotalTaxStr       = Convert.ToString(TotalTax);
            this.TotalAfterTaxStr  = Convert.ToString(TotalAfterTax);

            if (pqf.Order.ExcIncGST == true)
            {
                ExcludingTax = false;
                IncludingTax = true;
                //  PODEntity.GSTRate = 0;
            }
            else
            {
                ExcludingTax = true;
                IncludingTax = false;
                // PODEntity.GSTRate = TaxRate;
            }

            if (PO_Conv_to_PI == true)
            {
                AllFieldsReadonly = true;
                AllFieldsEnabled  = false;
            }
            else
            {
                AllFieldsReadonly  = false;
                AllFieldsEnabled   = true;
                LstSuppliers       = supplierRepository.GetAllSupplier().Where(s => s.IsInActive != "Y").ToList();
                ProductAndServices = ProductAndServices.OrderBy(x => x.PSName).Where(x => x.IsInActive != "Y").ToObservable();
            }

            this.Status = pqf.Order.Status;
            if (Status == Convert.ToByte(PO_Status.Cancelled))
            {
                StatusString       = "Cancelled";
                VisibilityForImage = Visibility.Visible;
                AllFieldsEnabled   = false;
                AllFieldsReadonly  = true;
            }
            else if (Status == Convert.ToByte(PO_Status.Collected))
            {
                StatusString       = "Collected";
                VisibilityForImage = Visibility.Visible;
                AllFieldsEnabled   = false;
                AllFieldsReadonly  = true;
            }
            else if (Status == Convert.ToByte(PO_Status.Refunded))
            {
                StatusString       = "Refunded";
                VisibilityForImage = Visibility.Visible;
                AllFieldsEnabled   = false;
                AllFieldsReadonly  = true;
            }
            else
            {
                StatusString       = "";
                VisibilityForImage = Visibility.Collapsed;
                AllFieldsEnabled   = true;
                AllFieldsReadonly  = false;
            }

            //this.PO_Conv_to_PO = pqf.Order.PO_Conv_to_PO;
            this.PO_Conv_to_PI = pqf.Order.PO_Conv_to_PI;

            SupplierEnabled = false;// added on 23 may 2017

            this.PODetailsEntity = new ObservableCollection <DataGridViewModel>();
            foreach (var item in pqf.OrderDetails)
            {
                DataGridViewModel pqEntity = new DataGridViewModel(ProductList);
                pqEntity.SelectedPSID = Convert.ToString(item.PONo);
                pqEntity.PandSCode    = item.PandSCode;
                pqEntity.PandSName    = item.PandSName;
                pqEntity.GSTRate      = Math.Round(Convert.ToDecimal(item.GSTRate), DecimalPlaces);
                pqEntity.GSTRateStr   = Convert.ToString(pqEntity.GSTRate) + "%";
                pqEntity.PQQty        = item.POQty;
                pqEntity.PQPrice      = Convert.ToString(item.Price);
                pqEntity.PQDiscount   = item.PODiscount;

                //  PODEntity.GSTRate = item.GSTRate;
                pqEntity.PQAmount = item.POAmount;

                PODetailsEntity.Add(pqEntity);
            }
        }
Exemple #3
0
        public void GetPurchaseQuotation(string pqNo)
        {
            // Mouse.OverrideCursor = Cursors.Wait;
            PurchaseQuotationForm pqf = pqRepository.GetPurchaseQuotation(pqNo);

            this.ID                 = pqf.Quotation.ID;
            this.QuotationNo        = pqf.Quotation.QuotationNo;
            this.QuotationDate      = pqf.Quotation.QuotationDate;
            this.ValidForDays       = pqf.Quotation.ValidForDays;
            this.SelectedSupplierID = pqf.Quotation.SupplierID;
            //if (this.SelectedSupplierID > 0)
            //{
            //    GetSupplierDetails();
            //}

            this.TermsAndConditions = pqf.Quotation.TermsAndConditions;

            this.TotalBeforeTax    = pqf.Quotation.TotalBeforeTax;
            this.TotalTax          = pqf.Quotation.TotalTax;
            this.TotalAfterTax     = pqf.Quotation.TotalAfterTax;
            this.TotalBeforeTaxStr = Convert.ToString(this.TotalBeforeTax);
            this.TotalTaxStr       = Convert.ToString(TotalTax);
            this.TotalAfterTaxStr  = Convert.ToString(TotalAfterTax);

            if (pqf.Quotation.ExcIncGST == true)
            {
                ExcludingTax = false;
                IncludingTax = true;
                //  PQDEntity.GSTRate = 0;
            }
            else
            {
                ExcludingTax = true;
                IncludingTax = false;
                // PQDEntity.GSTRate = TaxRate;
            }

            this.PQ_Conv_to_PO = pqf.Quotation.PQ_Conv_to_PO;
            this.PQ_Conv_to_PI = pqf.Quotation.PQ_Conv_to_PI;

            if (PQ_Conv_to_PO == true || PQ_Conv_to_PI == true)
            {
                AllFieldsReadonly = true;
                AllFieldsEnabled  = false;
            }
            else
            {
                AllFieldsReadonly  = false;
                AllFieldsEnabled   = true;
                LstSuppliers       = supplierRepository.GetAllSupplier().Where(s => s.IsInActive != "Y").ToList();
                ProductAndServices = ProductAndServices.OrderBy(x => x.PSName).Where(x => x.IsInActive != "Y").ToObservable();
            }
            SupplierEnabled = false;


            this.PQDetailsEntity = new ObservableCollection <DataGridViewModel>();
            foreach (var item in pqf.QuotationDetails)
            {
                DataGridViewModel pqEntity = new DataGridViewModel(ProductList);
                pqEntity.SelectedPSID = Convert.ToString(item.PQNo);
                pqEntity.PandSCode    = item.PandSCode;
                pqEntity.PandSName    = item.PandSName;
                pqEntity.GSTRate      = Math.Round(Convert.ToDecimal(item.GSTRate), DecimalPlaces);
                pqEntity.GSTRateStr   = Convert.ToString(pqEntity.GSTRate) + "%";
                pqEntity.PQQty        = item.PQQty;
                pqEntity.PQPrice      = Convert.ToString(item.Price);
                pqEntity.PQDiscount   = item.PQDiscount;

                //  PQDEntity.GSTRate = item.GSTRate;
                pqEntity.PQAmount = item.PQAmount;

                PQDetailsEntity.Add(pqEntity);
            }
        }