Ejemplo n.º 1
0
        private void GetModelData(AdjustDebitNoteForm pqf)
        {
            if (IsNew == false)
            {
                this.ID = pqf.AdjustDebitNote.ID;
                this.SelectedSupplierID = pqf.AdjustDebitNote.SupplierID;
                this.DebitNoteNo        = pqf.AdjustDebitNote.DebitNoteNo;
                this.SelectedAccountID  = pqf.AdjustDebitNote.AccountId;
                this.Date      = pqf.AdjustDebitNote.Date;
                this.AmountStr = pqf.AdjustDebitNote.AmountStr;
                this.IsCheque  = pqf.AdjustDebitNote.IsCheque;
                if (IsCheque == true)
                {
                    IsChequeTrue = true;
                }
                else
                {
                    IsChequeFalse = true;
                }
                //this.CashChequeNo = pqf.AdjustDebitNote.CashChequeNo;
                this.Remarks = pqf.AdjustDebitNote.Remarks;
                if (this.ListSuppliers != null)
                {
                    foreach (var item in this.ListSuppliers)
                    {
                        if (item.ID == this.SelectedSupplierID)
                        {
                            this.SelectedSupplierName = item.SupplierName;
                        }
                    }
                }
            }

            var result = pqf.AdjustDebitNoteDetails.OrderByDescending(e => e.UpdatedDate).GroupBy(e => e.PurchaseNo).Select(e => e.First()).ToList();

            this.PQDetailsEntity = new ObservableCollection <CollectAmountDataGridViewModel>();
            if (result != null)
            {
                foreach (var item in result)
                {
                    CollectAmountDataGridViewModel pqEntity = new CollectAmountDataGridViewModel();
                    pqEntity.PurchaseNo        = item.PurchaseNo;
                    pqEntity.PurchaseDate      = item.PurchaseDate;
                    pqEntity.PurchaseDateStr   = changedateformat(item.PurchaseDate);
                    pqEntity.PurchaseAmountStr = Convert.ToString(item.PurchaseAmount);
                    pqEntity.PurchaseAmount    = item.PurchaseAmount;
                    pqEntity.PaymentDueDate    = item.PaymentDueDate;
                    pqEntity.PaymentDueDateStr = changedateformat(item.PaymentDueDate);
                    pqEntity.AmountDueStr      = Convert.ToString(item.AmountDue);
                    //pqEntity.AmountDue = item.AmountDue;
                    //pqEntity.AmountAdjusted = item.AmountAdjusted;
                    //pqEntity.AmountAdjustedStr = Convert.ToString(item.AmountAdjusted);
                    //pqEntity.Discount = item.Discount;

                    PQDetailsEntity.Add(pqEntity);
                    OnPropertyChanged("PQDetailsEntity");
                }
            }
            PQDetailsEntityLst = PQDetailsEntity;
        }
        private void GetModelData(PaymentFromCustomerForm pqf)
        {
            if (IsNew == false)
            {
                // this.ID = pqf.PaymentFromCustomer.ID;
                this.SelectedCustomerID = pqf.PaymentFromCustomer.CustomerID;
                this.SelectedAccountID  = pqf.PaymentFromCustomer.AccountId;

                this.AmountStr    = pqf.PaymentFromCustomer.AmountStr;
                this.IsCheque     = pqf.PaymentFromCustomer.IsCheque;
                this.CashChequeNo = pqf.PaymentFromCustomer.CashChequeNo;
                this.Remarks      = pqf.PaymentFromCustomer.Remarks;

                if (IsCheque == true)
                {
                    IsChequeTrue  = true;
                    IsChequeFalse = false;
                }
                else
                {
                    IsChequeFalse = true;
                    IsChequeTrue  = false;
                }
            }

            var result = pqf.PaymentFromCustomerDetails.OrderByDescending(e => e.CreatedDate).GroupBy(e => e.SalesNo).Select(e => e.First()).ToList();

            this.PQDetailsEntity = new ObservableCollection <CollectSalesAmountDataGridViewModel>();
            foreach (var item in result)
            {
                CollectSalesAmountDataGridViewModel pqEntity = new CollectSalesAmountDataGridViewModel();
                pqEntity.SalesNo           = item.SalesNo;
                pqEntity.SalesDate         = item.SalesDate;
                pqEntity.SalesDateStr      = changedateformat(item.SalesDate);
                pqEntity.SalesAmountStr    = Convert.ToString(item.SalesAmount);
                pqEntity.SalesAmount       = item.SalesAmount;
                pqEntity.PaymentDueDate    = item.PaymentDueDate;
                pqEntity.PaymentDueDateStr = changedateformat(item.PaymentDueDate);
                pqEntity.AmountDue         = item.AmountDue;
                pqEntity.AmountDueStr      = Convert.ToString(item.AmountDue);
                pqEntity.AmountAdjusted    = item.AmountAdjusted;
                pqEntity.AmountAdjustedStr = Convert.ToString(item.AmountAdjusted);
                pqEntity.Discount          = item.Discount;

                PQDetailsEntity.Add(pqEntity);
                OnPropertyChanged("PQDetailsEntity");
            }

            TotalSalesAmount = Convert.ToString(PQDetailsEntity.Sum(e => e.SalesAmount));
            TotalAmountDue   = Convert.ToString(PQDetailsEntity.Sum(e => e.AmountDue));
            TotalAmountPaid  = Convert.ToString(PQDetailsEntity.Sum(e => e.AmountAdjusted));

            PQDetailsEntityLst = PQDetailsEntity;
        }
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
        private void GetModelData(RefundToCustomerForm pqf)
        {
            if (IsNew == false)
            {
                this.ID = pqf.RefundToCustomer.ID;
                this.SelectedCustomerID = pqf.RefundToCustomer.CustomerID;
                this.SelectedAccountID  = pqf.RefundToCustomer.AccountId;

                this.AmountStr = pqf.RefundToCustomer.AmountStr;
                this.IsCheque  = pqf.RefundToCustomer.IsCheque;
                if (IsCheque == true)
                {
                    IsChequeTrue = true;
                }
                else
                {
                    IsChequeFalse = true;
                }
                this.CashChequeNo = pqf.RefundToCustomer.CashChequeNo;
                this.Remarks      = pqf.RefundToCustomer.Remarks;
            }

            this.PQDetailsEntity = new ObservableCollection <CollectSalesAmountDataGridViewModel>();
            foreach (var item in pqf.RefundToCustomerDetails)
            {
                CollectSalesAmountDataGridViewModel pqEntity = new CollectSalesAmountDataGridViewModel();
                pqEntity.SalesNo      = item.SalesNo;
                pqEntity.SalesDate    = item.SalesDate;
                pqEntity.SalesDateStr = changedateformat(item.SalesDate);

                pqEntity.SalesAmount       = Math.Abs(decimal.Parse(item.SalesAmount.ToString()));
                pqEntity.SalesAmountStr    = Convert.ToString(pqEntity.SalesAmount);
                pqEntity.PaymentDueDate    = item.PaymentDueDate;
                pqEntity.PaymentDueDateStr = changedateformat(item.PaymentDueDate);
                pqEntity.AmountDue         = Math.Abs(decimal.Parse(item.AmountDue.ToString()));
                pqEntity.AmountDueStr      = Convert.ToString(pqEntity.AmountDue);
                pqEntity.AmountAdjusted    = Math.Abs(decimal.Parse(item.AmountAdjusted.ToString()));
                pqEntity.AmountAdjustedStr = Convert.ToString(pqEntity.AmountAdjusted);
                pqEntity.Discount          = item.Discount;

                PQDetailsEntity.Add(pqEntity);
                OnPropertyChanged("PQDetailsEntity");
            }
            TotalSalesAmount   = Convert.ToString(PQDetailsEntity.Sum(e => e.SalesAmount));
            TotalAmountDue     = Convert.ToString(PQDetailsEntity.Sum(e => e.AmountDue));
            TotalAmountPaid    = Convert.ToString(PQDetailsEntity.Sum(e => e.AmountAdjusted));
            PQDetailsEntityLst = PQDetailsEntity;
        }
Ejemplo n.º 5
0
        private void GetModelData(RefundFromSupplierForm pqf)
        {
            if (IsNew == false)
            {
                //this.ID = pqf.RefundFromSupplier.ID;
                this.SelectedSupplierID = pqf.RefundFromSupplier.SupplierID;
                this.SelectedAccountID  = pqf.RefundFromSupplier.AccountId;
                this.Date      = pqf.RefundFromSupplier.Date;
                this.AmountStr = pqf.RefundFromSupplier.AmountStr;
                this.IsCheque  = pqf.RefundFromSupplier.IsCheque;
                if (IsCheque == true)
                {
                    IsChequeTrue = true;
                }
                else
                {
                    IsChequeFalse = true;
                }
                this.CashChequeNo = pqf.RefundFromSupplier.CashChequeNo;
                this.Remarks      = pqf.RefundFromSupplier.Remarks;
            }

            var result = pqf.RefundFromSupplierDetails.OrderByDescending(e => e.CreatedDate).GroupBy(e => e.PurchaseNo).Select(e => e.First()).ToList();

            this.PQDetailsEntity = new ObservableCollection <CollectAmountDataGridViewModel>();
            foreach (var item in result)
            {
                CollectAmountDataGridViewModel pqEntity = new CollectAmountDataGridViewModel();
                pqEntity.PurchaseNo        = item.PurchaseNo;
                pqEntity.PurchaseDate      = item.PurchaseDate;
                pqEntity.PurchaseDateStr   = changedateformat(item.PurchaseDate);
                pqEntity.PurchaseAmountStr = Convert.ToString(item.PurchaseAmount);
                pqEntity.PurchaseAmount    = item.PurchaseAmount;
                pqEntity.PaymentDueDate    = item.PaymentDueDate;
                pqEntity.PaymentDueDateStr = changedateformat(item.PaymentDueDate);
                pqEntity.AmountDue         = Math.Abs(decimal.Parse(Convert.ToString(item.AmountDue)));
                pqEntity.AmountDueStr      = Convert.ToString(Math.Abs(decimal.Parse(Convert.ToString(item.AmountDue))));
                pqEntity.AmountAdjusted    = item.AmountAdjusted;
                pqEntity.AmountAdjustedStr = Convert.ToString(item.AmountAdjusted);
                pqEntity.Discount          = item.Discount;
                pqEntity.DiscountStr       = Convert.ToString(item.Discount);

                PQDetailsEntity.Add(pqEntity);
                OnPropertyChanged("PQDetailsEntity");
            }
            PQDetailsEntityLst = PQDetailsEntity;
        }
Ejemplo n.º 6
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);
                }
            }
        }
Ejemplo n.º 7
0
        public void GetCreditNote(object param)
        {
            if (param != null)
            {
                CreditNoteForm pqf = dnRepository.GetCreditNoteDetails(Convert.ToString(param));

                this.ID                      = pqf.CreditNote.ID;
                this.CreditNo                = pqf.CreditNote.CreditNo;
                this.CreditDate              = pqf.CreditNote.CreditDate;
                this.CustomerDebitNoteNo     = pqf.CreditNote.CustomerDebitNoteNo;
                this.CustomerDebitNoteDate   = pqf.CreditNote.CustomerDebitNoteDate;
                this.CustomerDebitNoteAmount = pqf.CreditNote.CustomerDebitNoteAmount;
                this.SelectedCustomerID      = pqf.CreditNote.CustomerID;
                this.SalesInvoiceID          = pqf.CreditNote.SalesInvoiceID;
                this.SalesInvoiceNo          = pqf.CreditNote.SalesInvoiceNo;
                this.TermsAndConditions      = pqf.CreditNote.TermsAndConditions;

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

                this.Status = pqf.CreditNote.Status;


                this.PQDetailsEntity = new ObservableCollection <DataGridViewModel>();
                foreach (var item in pqf.InvoiceDetails)
                {
                    DataGridViewModel pqEntity = new DataGridViewModel(ProductList);
                    pqEntity.SelectedPSID = Convert.ToString(item.SINo);
                    pqEntity.PandSCode    = item.PandSCode;
                    pqEntity.PandSName    = item.PandSName;
                    pqEntity.GSTRate      = item.GSTRate;
                    pqEntity.SQQty        = item.SIQty;
                    pqEntity.SQPrice      = Convert.ToString(item.Price);
                    pqEntity.SQDiscount   = item.SIDiscount;

                    //  PQDEntity.GSTRate = item.GSTRate;
                    pqEntity.SQAmount = item.SIAmount;

                    PQDetailsEntity.Add(pqEntity);
                }
            }
        }
Ejemplo n.º 8
0
 void GetNewPS(object param)
 {
     IsNew = true;
     // SelectedCustomerID = 0;
     IsCustomerEnabled = true;
     IsCreditNoEnabled = true;
     PSErrors          = string.Empty;
     GetNewPS();
     if (PQDetailsEntity != null)
     {
         if (PQDetailsEntity.Count > 0)
         {
             PQDetailsEntity.Clear();
             var row = new CollectSalesAmountDataGridViewModel();
             PQDetailsEntity.Add(row);
             OnPropertyChanged("PQDetailsEntity");
         }
     }
 }
Ejemplo n.º 9
0
        public void GetPurchaseInvoice(string pqNo)
        {
            // Mouse.OverrideCursor = Cursors.Wait;
            PurchaseInvoiceForm pqf = pqRepository.GetPurchaseInvoice(pqNo);

            this.ID             = pqf.Invoice.ID;
            this.InvoiceNo      = pqf.Invoice.InvoiceNo;
            this.OurPONo        = pqf.Invoice.OurPONo;
            this.InvoiceDate    = pqf.Invoice.InvoiceDate;
            this.PaymentDueDate = pqf.Invoice.PaymentDueDate;

            this.SelectedSupplierID = pqf.Invoice.SupplierID;
            //if (this.SelectedSupplierID > 0)
            //{
            //    GetSupplierDetails();
            //}

            this.TermsAndConditions = pqf.Invoice.TermsAndConditions;

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

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

            if (this.PIStatus == Convert.ToByte(PI_Status.Paid))
            {
                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.PIStatus = pqf.Invoice.PIStatus;
            if (PIStatus == Convert.ToByte(PI_Status.Cancelled))
            {
                StatusString       = "Cancelled";
                VisibilityForImage = Visibility.Visible;
                AllFieldsEnabled   = false;
                AllFieldsReadonly  = true;
            }
            else if (PIStatus == Convert.ToByte(PI_Status.Paid))
            {
                StatusString       = "    Paid";
                VisibilityForImage = Visibility.Visible;
                AllFieldsEnabled   = false;
                AllFieldsReadonly  = true;
            }
            else if (PIStatus == Convert.ToByte(PI_Status.Adjusted))
            {
                StatusString       = "Adjusted";
                VisibilityForImage = Visibility.Visible;
                AllFieldsEnabled   = false;
                AllFieldsReadonly  = true;
            }
            else
            {
                StatusString       = "";
                VisibilityForImage = Visibility.Collapsed;
                AllFieldsEnabled   = true;
                AllFieldsReadonly  = false;
            }


            SupplierEnabled      = false;// added on 23 may 2017
            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);
            }
        }
Ejemplo n.º 10
0
        public int ManageDuplicatePandS()
        {
            int rowFocusindex = -1;

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

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

            if (query.Count > 0 && PQDetailsEntity.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;
                    PQDetailsEntity[index1] = obj1;
                    var row = new DataGridViewModel(ProductList);
                    //row.PQQty = 1;
                    //row.GSTRate = TaxRate;
                    //row.GSTRateStr = Convert.ToString(TaxRate) + "%";
                    PQDetailsEntity[index2] = row;
                    rowFocusindex           = index2;
                }
                //for (int i = 0; i < 2; i++)
                //{
                //    var p = PQDetailsEntity.Where(e => e.SelectedPSID == obj2.SelectedPSID ).FirstOrDefault();
                //    if (p.PQPrice == null)
                //    {
                //        PQDetailsEntity.Remove(p);
                //    }
                //}

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

            return(rowFocusindex);
        }
        private void GetModelData(AdjustDebitNoteForm pqf)
        {
            if (IsNew == false)
            {
                this.ID = pqf.AdjustDebitNote.ID;
                this.SelectedSupplierID = pqf.AdjustDebitNote.SupplierID;
                this.DebitNoteNo        = pqf.AdjustDebitNote.DebitNoteNo;
                this.SelectedAccountID  = pqf.AdjustDebitNote.AccountId;
                this.Date                  = pqf.AdjustDebitNote.Date;
                this.AmountStr             = pqf.AdjustDebitNote.AmountStr;
                this.IsCheque              = pqf.AdjustDebitNote.IsCheque;
                this.AdjustDebitNoteNumber = pqf.AdjustDebitNote.AdjustDebitNoteNumber;


                if (IsCheque == true)
                {
                    IsChequeTrue = true;
                }
                else
                {
                    IsChequeFalse = true;
                }
                //this.CashChequeNo = pqf.AdjustDebitNote.CashChequeNo;
                this.Remarks = pqf.AdjustDebitNote.Remarks;
                if (this.ListSuppliers != null)
                {
                    foreach (var item in this.ListSuppliers)
                    {
                        if (item.ID == this.SelectedSupplierID)
                        {
                            this.SelectedSupplierName = item.SupplierName;
                        }
                    }
                }
            }

            var                       result             = pqf.AdjustDebitNoteDetails.OrderByDescending(e => e.UpdatedDate).GroupBy(e => e.PurchaseNo).Select(e => e.First()).ToList();
            OptionsEntity             oData              = new OptionsEntity();
            ISalesOrderListRepository purchaseRepository = new SalesOrderListRepository();

            oData = purchaseRepository.GetOptionSettings();
            this.PQDetailsEntity = new ObservableCollection <CollectAmountDataGridViewModel>();
            if (result != null)
            {
                foreach (var item in result)
                {
                    CollectAmountDataGridViewModel pqEntity = new CollectAmountDataGridViewModel();
                    pqEntity.PurchaseNo = item.PurchaseNo;
                    if (item.PurchaseDate != null)
                    {
                        pqEntity.PurchaseDate = item.PurchaseDate;
                        DateTime Dateinstr = (DateTime)item.PurchaseDate;
                        pqEntity.PurchaseDateStr = Dateinstr.ToString(oData.DateFormat);
                    }
                    else
                    {
                    }
                    pqEntity.PurchaseAmountStr = Convert.ToString(item.PurchaseAmount);
                    pqEntity.PurchaseAmount    = item.PurchaseAmount;
                    if (item.PaymentDueDate != null)
                    {
                        pqEntity.PaymentDueDate = item.PaymentDueDate;
                        DateTime Dateinstr1 = (DateTime)item.PaymentDueDate;
                        pqEntity.PaymentDueDateStr = changedateformat(item.PaymentDueDate);
                    }
                    else
                    {
                    }
                    pqEntity.AmountDueStr = Convert.ToString(item.AmountDue);
                    //pqEntity.AmountDue = item.AmountDue;
                    pqEntity.AmountAdjusted    = item.AmountAdjusted;
                    pqEntity.AmountAdjustedStr = Convert.ToString(item.AmountAdjusted);
                    //pqEntity.Discount = item.Discount;

                    PQDetailsEntity.Add(pqEntity);
                    TotalPurchaseAmount = Convert.ToString(PQDetailsEntity.Sum(e => e.PurchaseAmount));
                    TotalAdjutedAmount  = Convert.ToString(PQDetailsEntity.Sum(e => e.AmountAdjusted));
                    OnPropertyChanged("PQDetailsEntity");
                }
            }
            PQDetailsEntityLst = PQDetailsEntity;
        }
Ejemplo n.º 12
0
        public void GetCreditNote(object param)
        {
            OptionsEntity             oData = new OptionsEntity();
            ISalesOrderListRepository purchaseRepository = new SalesOrderListRepository();

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

                this.ID                  = pqf.CreditNote.ID;
                this.CreditNo            = pqf.CreditNote.CreditNo;
                this.CreditDate          = pqf.CreditNote.CreditDate;
                this.CustomerDebitNoteNo = pqf.CreditNote.CustomerDebitNoteNo;

                if (CustomerDebitNoteDate == null)
                {
                    this.CustomerDebitNoteDate = pqf.CreditNote.CustomerDebitNoteDate;
                }
                else
                {
                    DateTime DateinStr = (DateTime)pqf.CreditNote.CustomerDebitNoteDate;
                    this.CustomerDebitNoteDateStr = DateinStr.ToString(oData.DateFormat);
                }

                this.CustomerDebitNoteAmount = pqf.CreditNote.CustomerDebitNoteAmount;
                this.SelectedCustomerID      = pqf.CreditNote.CustomerID;
                this.SalesInvoiceID          = pqf.CreditNote.SalesInvoiceID;
                this.SalesInvoiceNo          = pqf.CreditNote.SalesInvoiceNo;
                this.TermsAndConditions      = pqf.CreditNote.TermsAndConditions;

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

                this.Status = pqf.CreditNote.Status;
                if (this.Status == 1)
                {
                    RubberAdjusted = true;
                }

                this.PQDetailsEntity = new ObservableCollection <DataGridViewModel>();
                foreach (var item in pqf.InvoiceDetails)
                {
                    DataGridViewModel pqEntity = new DataGridViewModel(ProductList);
                    pqEntity.SelectedPSID = Convert.ToString(item.SINo);
                    pqEntity.PandSCode    = item.PandSCode;
                    pqEntity.PandSName    = item.PandSName;
                    pqEntity.GSTRate      = item.GSTRate;
                    pqEntity.SQQty        = item.SIQty;
                    pqEntity.SQPrice      = Convert.ToString(item.Price);
                    pqEntity.SQDiscount   = item.SIDiscount;

                    //  PQDEntity.GSTRate = item.GSTRate;
                    pqEntity.SQAmount = item.SIAmount;

                    PQDetailsEntity.Add(pqEntity);
                }
            }
        }
Ejemplo n.º 13
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);
            }
        }