コード例 #1
0
        static void OnTotalAmountAffected(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            ActiveInventoryObject me = sender as ActiveInventoryObject;

            if (me != null)
            {
                me.TotalAmount = me.GetTotalPrice(PricingModelObject.GetPricingModel(Configuration.Current.CurrentPricingModel));
                OnChanged(sender, e);
            }
        }
コード例 #2
0
 public decimal GetPriceEach(PricingModelObject SelectedPricingModel)
 {
     if (SelectedPricingModel == null)
     {
         return(SellingPrice - (Discount / Quantity));
     }
     else
     {
         return(SelectedPricingModel.GetSalePrice(SellingPrice, WholeSalePrice + AdditionalOverhead, 0) - (Discount / Quantity));
     }
 }
コード例 #3
0
 public decimal GetTotalPrice(PricingModelObject SelectedPricingModel)
 {
     if (SelectedPricingModel == null)
     {
         return(SellingPrice * Quantity - Discount);
     }
     else
     {
         return(SelectedPricingModel.GetSalePrice(SellingPrice, WholeSalePrice + AdditionalOverhead, 0) * Quantity - Discount);
     }
 }
コード例 #4
0
 public static void Load()
 {
     Models.Clear();
     System.IO.DirectoryInfo d = new System.IO.DirectoryInfo(Configuration.GetDataPath());
     foreach (System.IO.FileInfo f in d.GetFiles("*.pmo"))
     {
         PricingModelObject pmo = new PricingModelObject();
         pmo.Load(f.FullName);
         Models.Add(pmo);
     }
 }
コード例 #5
0
 public static void Load()
 {
     Models.Clear();
     System.IO.DirectoryInfo d = new System.IO.DirectoryInfo(Configuration.GetDataPath());
     foreach (System.IO.FileInfo f in d.GetFiles("*.pmo"))
     {
         PricingModelObject pmo = new PricingModelObject();
         pmo.Load(f.FullName);
         Models.Add(pmo);
     }
 }
コード例 #6
0
 public decimal GetPriceEach(PricingModelObject SelectedPricingModel)
 {
     if (SelectedPricingModel == null)
     {
         return SellingPrice - (Discount / Quantity);
     }
     else
     {
         return SelectedPricingModel.GetSalePrice(SellingPrice, WholeSalePrice + AdditionalOverhead, 0) - (Discount / Quantity);
     }
 }
コード例 #7
0
 public decimal GetTotalPrice(PricingModelObject SelectedPricingModel)
 {
     if (SelectedPricingModel == null)
     {
         return SellingPrice *  Quantity - Discount;
     }
     else
     {
         return SelectedPricingModel.GetSalePrice(SellingPrice, WholeSalePrice + AdditionalOverhead, 0) * Quantity - Discount;
     }
 }
コード例 #8
0
        public static PricingModelObject GetPricingModel(string name)
        {
            PricingModelObject retVal = null;

            if (!string.IsNullOrEmpty(name))
            {
                foreach (PricingModelObject pmo in Models)
                {
                    if (pmo.Name == name)
                    {
                        retVal = pmo;
                        break;
                    }
                }
            }
            return(retVal);
        }
コード例 #9
0
        public static FinancialObject Post(ICollection <ActiveInventoryObject> Activity,
                                           string receiptID, decimal cash, decimal credit, decimal check,
                                           PricingModelObject selectedPricingModel, decimal tax, decimal profitLoss, string USStateOfSale, decimal totalSale, decimal discountAmount)
        {
            DateTime transTime    = DateTime.Now;
            decimal  discount     = 0;
            int      productCount = 0;

            if (Activity != null)
            {
                foreach (ActiveInventoryObject aio in Activity)
                {
                    InventoryTransactionObject tran = new InventoryTransactionObject();

                    //aio.TotalDollarChanged -= newItem_TotalDollarChanged;
                    tran.ReceiptID = receiptID;

                    tran.TransactionTime = transTime;
                    decimal amount = aio.GetTotalPrice(selectedPricingModel);

                    tran.TransactionAmount = amount;


                    productCount += aio.Quantity;

                    tran.Quantity = -aio.Quantity;  //Quantity to reflect change in ActiveInventory.  Negative to remove from Inventory.


                    //Part of Pair matching:
                    //tran.CostEach =
                    tran.Discount = aio.Discount;
                    // tran.DiscountRateLevel = aio.DiscountRateLevel;
                    tran.ExportedToWeb = false;
                    tran.IsSale        = true;
                    tran.PairMatched   = false;
                    tran.ProductID     = aio.ProductID;

                    decimal priceEach = aio.GetPriceEach(selectedPricingModel);
                    if (selectedPricingModel != null)
                    {
                        if (selectedPricingModel.IncludesSalesTax)
                        {
                            priceEach = priceEach / (1 + Configuration.Current.CurrentSalesTax);
                        }
                    }
                    tran.SellingPriceEach = priceEach;

                    tran.SKU = aio.SKU;

                    tran.UPC = aio.UPC;


                    Cache.Current.InventoryActivity.Add(tran);

                    discount += aio.Discount;
                }
            }
            Cache.Current.SaveInventoryActivity();

            FinancialObject fin = new FinancialObject();

            fin.ReceiptID      = receiptID;
            fin.DiscountAmount = discount;
            fin.TotalCash      = cash;
            fin.TotalCredit    = credit;
            fin.TotalCheck     = check;

            fin.TotalTax     = tax;
            fin.TotalSale    = fin.TotalCredit + fin.TotalCash + fin.TotalCheck - fin.TotalTax;
            fin.ProductCount = productCount;
            fin.ProfitLoss   = profitLoss;
            fin.Station      = Configuration.Current.StationID;
            fin.User         = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
            if (selectedPricingModel != null)
            {
                fin.PricingModelInEffect = selectedPricingModel.Name;
            }
            fin.USStateOfSale = USStateOfSale;

            fin.DiscountAmount += discountAmount;

            Cache.Current.CurrentFinancials.Add(fin);
            Cache.Current.SaveFinancials();
            return(fin);
        }
コード例 #10
0
        public static FinancialObject Post(ICollection<ActiveInventoryObject> Activity, 
            string receiptID, decimal cash, decimal credit, decimal check, 
            PricingModelObject selectedPricingModel, decimal tax, decimal profitLoss, string USStateOfSale, decimal totalSale, decimal discountAmount)
        {

            DateTime transTime = DateTime.Now;
            decimal discount = 0;
            int productCount = 0;
            if (Activity != null)
            {
                foreach (ActiveInventoryObject aio in Activity)
                {
                    InventoryTransactionObject tran = new InventoryTransactionObject();

                    //aio.TotalDollarChanged -= newItem_TotalDollarChanged;
                    tran.ReceiptID = receiptID;

                    tran.TransactionTime = transTime;
                    decimal amount = aio.GetTotalPrice(selectedPricingModel);

                    tran.TransactionAmount = amount;


                    productCount += aio.Quantity;

                    tran.Quantity = -aio.Quantity;  //Quantity to reflect change in ActiveInventory.  Negative to remove from Inventory.


                    //Part of Pair matching:
                    //tran.CostEach =
                    tran.Discount = aio.Discount;
                   // tran.DiscountRateLevel = aio.DiscountRateLevel;
                    tran.ExportedToWeb = false;
                    tran.IsSale = true;
                    tran.PairMatched = false;
                    tran.ProductID = aio.ProductID;

                    decimal priceEach = aio.GetPriceEach(selectedPricingModel);
                    if (selectedPricingModel != null)
                    {

                        if (selectedPricingModel.IncludesSalesTax)
                        {
                            priceEach = priceEach / (1 + Configuration.Current.CurrentSalesTax);
                        }
                    }
                    tran.SellingPriceEach = priceEach;

                    tran.SKU = aio.SKU;

                    tran.UPC = aio.UPC;


                    Cache.Current.InventoryActivity.Add(tran);

                    discount += aio.Discount;
                }
            }
            Cache.Current.SaveInventoryActivity();

            FinancialObject fin = new FinancialObject();
            fin.ReceiptID = receiptID;
            fin.DiscountAmount = discount;
            fin.TotalCash = cash;
            fin.TotalCredit = credit;
            fin.TotalCheck = check;

            fin.TotalTax = tax;
            fin.TotalSale = fin.TotalCredit + fin.TotalCash + fin.TotalCheck - fin.TotalTax;
            fin.ProductCount = productCount;
            fin.ProfitLoss = profitLoss;
            fin.Station = Configuration.Current.StationID;
            fin.User = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
            if (selectedPricingModel != null)
            {

                fin.PricingModelInEffect = selectedPricingModel.Name;
            }
            fin.USStateOfSale = USStateOfSale;

            fin.DiscountAmount += discountAmount;

            Cache.Current.CurrentFinancials.Add(fin);
            Cache.Current.SaveFinancials();
            return fin;
        }