Example #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;
            }
        }
Example #2
0
        public void GetDebitNote(object param)
        {
            if (param != null)
            {
                DebitNoteForm pqf = dnRepository.GetDebitNoteDetails(Convert.ToString(param));

                this.ID                       = pqf.DebitNote.ID;
                this.DebitNo                  = pqf.DebitNote.DebitNo;
                this.DebitDate                = pqf.DebitNote.DebitDate;
                this.SupplierCreditNoteNo     = pqf.DebitNote.SupplierCreditNoteNo;
                this.SupplierCreditNoteDate   = pqf.DebitNote.SupplierCreditNoteDate;
                this.SupplierCreditNoteAmount = pqf.DebitNote.SupplierCreditNoteAmount;
                this.SelectedSupplierID       = pqf.DebitNote.SupplierID;
                this.PurchaseInvoiceID        = pqf.DebitNote.PurchaseInvoiceID;
                this.PurchaseInvoiceNo        = pqf.DebitNote.PurchaseInvoiceNo;
                this.TermsAndConditions       = pqf.DebitNote.TermsAndConditions;

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

                this.Status = pqf.DebitNote.Status;


                this.PQDetailsEntity = new ObservableCollection <DataGridViewModel>();
                foreach (var item in pqf.InvoiceDetails)
                {
                    DataGridViewModel pqEntity = new DataGridViewModel(ProductList);
                    pqEntity.SelectedPSID = Convert.ToString(item.PINo);
                    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.PIQty;
                    pqEntity.PQPrice      = Convert.ToString(item.Price);
                    pqEntity.PQDiscount   = Math.Round((decimal)item.PIDiscount, 2);

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

                    PQDetailsEntity.Add(pqEntity);
                }
            }
        }
Example #3
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);
            }
        }
Example #4
0
        public int ManageDuplicatePandS()
        {
            int rowFocusindex = -1;

            lst = new ObservableCollection <DataGridViewModel>();
            lst = PODetailsEntity;

            var query = lst.GroupBy(x => x.SelectedPSID)
                        .Where(g => g.Count() > 1)
                        .ToList();

            if (query.Count > 0 && PODetailsEntity.Count > 1)
            {
                var     obj1          = query[0].ElementAt(0);
                var     obj2          = query[0].ElementAt(1);
                int?    qty           = 1;
                decimal?productPrice2 = 0;
                decimal?discountP2    = 0;
                qty           = query[0].ElementAt(0).PQQty + query[0].ElementAt(1).PQQty;
                productPrice2 = Convert.ToDecimal(query[0].ElementAt(1).PQPrice);
                discountP2    = query[0].ElementAt(1).PQDiscount;

                var index1 = lst.IndexOf(query[0].ElementAt(0));
                var index2 = lst.IndexOf(query[0].ElementAt(1));

                if (productPrice2 != null)
                {
                    obj1.PQQty              = qty;
                    obj1.PQPrice            = Convert.ToString(productPrice2);
                    obj1.PQDiscount         = discountP2;
                    PODetailsEntity[index1] = obj1;
                    var row = new DataGridViewModel(ProductList);
                    //row.PQQty = 1;
                    //row.GSTRate = TaxRate;
                    //row.GSTRateStr = Convert.ToString(TaxRate) + "%";
                    PODetailsEntity[index2] = row;
                    rowFocusindex           = index2;
                }
                //for (int i = 0; i < 2; i++)
                //{
                //    var p = PODetailsEntity.Where(e => e.SelectedPSID == obj2.SelectedPSID ).FirstOrDefault();
                //    if (p.POPrice == null)
                //    {
                //        PODetailsEntity.Remove(p);
                //    }
                //}

                OnPropertyChanged("PODetailsEntity");
            }
            else
            {
                int count = PODetailsEntity.Count(x => x.SelectedPSID == null);
                if (count == 0)
                {
                    var row = new DataGridViewModel(ProductList);
                    //row.PQQty = 1;
                    //row.GSTRate = TaxRate;
                    //row.GSTRateStr = Convert.ToString(TaxRate) + "%";
                    PODetailsEntity.Add(row);
                    OnPropertyChanged("PODetailsEntity");
                    rowFocusindex = -1;
                }
                else
                {
                    var emptyRow = lst.Where(y => y.SelectedPSID == null).FirstOrDefault();
                    rowFocusindex = PODetailsEntity.IndexOf(emptyRow);
                }
            }

            return(rowFocusindex);
        }
        public void GetDebitNote(object param)
        {
            OptionsEntity             oData = new OptionsEntity();
            ISalesOrderListRepository purchaseRepository = new SalesOrderListRepository();

            oData = purchaseRepository.GetOptionSettings();
            if (param != null)
            {
                DebitNoteForm pqf = dnRepository.GetDebitNoteDetails(Convert.ToString(param));

                this.ID                   = pqf.DebitNote.ID;
                this.DebitNo              = pqf.DebitNote.DebitNo;
                this.DebitDate            = pqf.DebitNote.DebitDate;
                this.SupplierCreditNoteNo = pqf.DebitNote.SupplierCreditNoteNo;
                if (SupplierCreditNoteDate == null)
                {
                    this.SupplierCreditNoteDate = pqf.DebitNote.SupplierCreditNoteDate;
                }
                else
                {
                    DateTime DateinStr = (DateTime)pqf.DebitNote.SupplierCreditNoteDate;
                    this.SupplierCreditNoteDateStr = DateinStr.ToString(oData.DateFormat);
                }

                this.SupplierCreditNoteAmount = pqf.DebitNote.SupplierCreditNoteAmount;
                this.SelectedSupplierID       = pqf.DebitNote.SupplierID;
                this.PurchaseInvoiceID        = pqf.DebitNote.PurchaseInvoiceID;
                this.PurchaseInvoiceNo        = pqf.DebitNote.PurchaseInvoiceNo;
                this.TermsAndConditions       = pqf.DebitNote.TermsAndConditions;

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

                this.Status = pqf.DebitNote.Status;
                if (this.Status == 1)
                {
                    RubberStampDN = true;
                }
                else
                {
                    RubberStampDN = false;
                }


                this.PQDetailsEntity = new ObservableCollection <DataGridViewModel>();
                foreach (var item in pqf.InvoiceDetails)
                {
                    DataGridViewModel pqEntity = new DataGridViewModel(ProductList);
                    pqEntity.SelectedPSID = Convert.ToString(item.PINo);
                    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.PIQty;
                    pqEntity.PQPrice      = Convert.ToString(item.Price);
                    pqEntity.PQDiscount   = item.PIDiscount;

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

                    PQDetailsEntity.Add(pqEntity);
                }
            }
        }
Example #6
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);
            }
        }