public void Update_filter_price_on_okp_source_price()
        {
            var origin = price;

            price.CreateAssortmentBoundSynonyms(
                "9 МЕСЯЦЕВ КРЕМ Д/ПРОФИЛАКТИКИ И КОРРЕКЦИИ РАСТЯЖЕК 150МЛ",
                "Валента Фармацевтика/Королев Ф");
            var core = new TestCore(price.ProductSynonyms[0], price.ProducerSynonyms[0])
            {
                CodeOKP = 931201
            };

            session.Save(core);

            var okpPrice = new TestPrice(price.Supplier);
            var format   = Configure(okpPrice);

            format.FCodeOkp = "F5";
            session.Save(okpPrice);

            var localOkpPrice = session.Load <Price>(okpPrice.Id);

            localPrice.CodeOkpFilterPrice = localOkpPrice;
            session.Save(localPrice);

            price = okpPrice;
            CreateDefaultSynonym();
            Formalize(@"9 МЕСЯЦЕВ КРЕМ Д/ПРОФИЛАКТИКИ И КОРРЕКЦИИ РАСТЯЖЕК 150МЛ;Валента Фармацевтика/Королев Ф;2864;220.92;931201;");

            price = origin;
            var count = MatrixItems().Rows.Count;

            Assert.That(count, Is.EqualTo(1));
        }
        private TestPrice CreateAssortmentPrice()
        {
            var assortPrice = new TestPrice {
                AgencyEnabled = true,
                Enabled       = true,
                Supplier      = supplier,
                PriceType     = PriceType.Assortment,
                PriceName     = "Ассортиментный"
            };

            session.Save(assortPrice);
            client.Settings.AssortmentPriceId = assortPrice.Id;
            session.Save(client.Settings);
            var synonym = new TestProductSynonym("Тестовый синоним товара",
                                                 session.Load <TestProduct>(_product.Id), assortPrice);

            session.Save(synonym);
            var prSynonym = new TestProducerSynonym("Тестовый синоним производителя",
                                                    session.Load <TestProducer>(_producer.Id),
                                                    assortPrice);

            session.Save(prSynonym);
            var core = new TestCore(synonym, prSynonym)
            {
                Code     = "0000",
                Quantity = "1",
                Period   = "01.01.2100"
            };

            assortPrice.Core.Add(core);

            session.Save(core);
            session.Flush();
            return(assortPrice);
        }
        public void Intersect_with_oktp_catalog()
        {
            var okpPrice = new TestPrice(price.Supplier);

            okpPrice.CreateAssortmentBoundSynonyms(
                "9 МЕСЯЦЕВ КРЕМ Д/ПРОФИЛАКТИКИ И КОРРЕКЦИИ РАСТЯЖЕК 150МЛ",
                "Валента Фармацевтика/Королев Ф");
            var core = new TestCore(okpPrice.ProductSynonyms[0], okpPrice.ProducerSynonyms[0])
            {
                CodeOKP = 1
            };

            session.Save(okpPrice);
            session.Save(core);
            session.Flush();
            var localOkpPrice = session.Load <Price>(okpPrice.Id);

            localPrice.CodeOkpFilterPrice = localOkpPrice;

            priceItem.Format.FCodeOkp = "F5";
            session.Save(localPrice);

            CreateDefaultSynonym();
            Formalize(@"9 МЕСЯЦЕВ КРЕМ Д/ПРОФИЛАКТИКИ И КОРРЕКЦИИ РАСТЯЖЕК 150МЛ;Валента Фармацевтика/Королев Ф;2864;220.92;1;
5 ДНЕЙ ВАННА Д/НОГ СМЯГЧАЮЩАЯ №10 ПАК. 25Г;Санкт-Петербургская ф.ф.;24;73.88;;
911 ВЕНОЛГОН ГЕЛЬ Д/ НОГ ПРИ ТЯЖЕСТИ БОЛИ И ОТЕКАХ ТУБА 100МЛ;Твинс Тэк;40;44.71;;");

            var count = MatrixItems().Rows.Count;

            Assert.That(count, Is.EqualTo(1), "код прайс листа {0}", price.Id);
        }
        public void Update_price_name_from_source_file()
        {
            Formalize("FarmaimpeksSmallPrice.xml");
            var price = TestPrice.Find(prices[1].Id);

            Assert.That(price.PriceName, Is.EqualTo("Прайс Опт ДП"));
        }
        public void Setup()
        {
            prices = new List <TestPrice>();
            using (new SessionScope()) {
                var supplier = TestSupplier.Create();
                var price    = supplier.Prices[0];
                var cost     = price.Costs[0];
                cost.Name = "116";
                priceItem = cost.PriceItem;
                priceItem.Format.PriceFormat = PriceFormatType.FarmaimpeksXml;
                price.SaveAndFlush();
                prices.Add(price);

                price.CreateAssortmentBoundSynonyms("Аспирин-С №10 таб.шип.", "Bayer AG, Франция");
                price.CreateAssortmentBoundSynonyms("Абактал 400мг №10 таб.п/о", "Lek, Словения");

                price = new TestPrice(supplier)
                {
                    CostType      = CostType.MultiColumn,
                    ParentSynonym = price.Id,
                };
                cost      = price.Costs[0];
                cost.Name = "2";
                price.SaveAndFlush();
                supplier.Maintain();
                prices.Add(price);
            }
        }
예제 #6
0
        public override void Execute(ISession session)
        {
            var user = User(session);

            if (Verbose && Denied.Length == 0 && Warning.Length == 0)
            {
                var price  = user.GetActivePricesNaked(session).First(p => p.PositionCount > 1);
                var offer1 = price.Price.Core[0];
                var offer2 = price.Price.Core.First(c => c.Product != offer1.Product);
                Console.WriteLine("Запрет заказа {0}", offer1.Product.FullName);
                Console.WriteLine("Предупреждение при заказе {0}", offer2.Product.FullName);
                Denied = new[] {
                    offer1.Product.Id
                };
                Warning = new[] {
                    offer2.Product.Id
                };
            }

            var supplier    = TestSupplier.CreateNaked(session, TestRegion.Inforoom);
            var priceDenied = supplier.Prices[0];

            priceDenied.PriceType = PriceType.Assortment;
            priceDenied.Matrix    = new TestMatrix();

            var warnPrice = new TestPrice(supplier, PriceType.Assortment);

            warnPrice.Matrix = new TestMatrix();
            supplier.Prices.Add(warnPrice);
            session.Save(supplier);
            session.Flush();

            foreach (var productId in Denied)
            {
                session.Save(new TestBuyingMatrix(priceDenied, session.Load <TestProduct>(productId)));
            }

            foreach (var productId in Warning)
            {
                session.Save(new TestBuyingMatrix(warnPrice, session.Load <TestProduct>(productId)));
            }

            var settings = user.Client.Settings;

            settings.BuyingMatrix        = priceDenied.Matrix;
            settings.BuyingMatrixAction  = TestMatrixAction.Block;
            settings.BuyingMatrixType    = TestMatrixType.BlackList;
            settings.BuyingMatrixPriceId = priceDenied.Id;

            settings.OfferMatrix        = warnPrice.Matrix;
            settings.OfferMatrixAction  = TestMatrixAction.Warning;
            settings.OfferMatrixType    = TestMatrixType.BlackList;
            settings.OfferMatrixPriceId = warnPrice.Id;

            session.Save(settings.BuyingMatrix);
            session.Save(settings.OfferMatrix);
        }
        public void SetUp()
        {
            var supplier = TestSupplier.CreateNaked(session);

            supplier.Prices[0].Costs[0].PriceItem.Format.PriceFormat = PriceFormatType.NativeDbf;
            price = supplier.Prices[0];

            resolver = new ProducerSynonymResolver(price.Id);
        }
예제 #8
0
        public void Setup()
        {
            data = new DataTable();
            data.Columns.Add("MNFGRNX");
            data.Columns.Add("MNFNX");
            data.Columns.Add("MNFNMR");
            data.Columns.Add("COUNTRYR");
            data.Columns.Add("DRUGTXT");
            data.Columns.Add("SERNM");
            data.Columns.Add("LETTERSNR");
            data.Columns.Add("LETTERSDT", typeof(DateTime));
            data.Columns.Add("LABNMR");
            data.Columns.Add("QUALNMR");

            data.Rows.Add(null, null,
                          "Биохимик ОАО", null,
                          "Диклофенак р-р для в/м введ 25 мг/мл  (ампулы) 3 мл №10",
                          "171209",
                          "04И-851/10",
                          "02/09/2010",
                          null,
                          "Отзыв предприятием-производителем. Описание.Цветность.");

            data.Rows.Add(null, null,
                          "Уралбиофарм ОАО", null,
                          "Мукалтин табл. 50мг (упак. ячейковые контурные) № 10",
                          "151109",
                          "04И-849/10",
                          "02/09/2010",
                          null,
                          "Описание. Средняя масса. Отклонение от средней массы.");

            var supplier = TestSupplier.CreateNaked(session);

            price           = supplier.Prices[0];
            price.PriceType = PriceType.Assortment;
            priceItem       = price.Costs[0].PriceItem;
            var format = priceItem.Format;

            format.PriceFormat = PriceFormatType.NativeDbf;
            format.FName1      = "DRUGTXT";
            format.FFirmCr     = "MNFNMR";
            format.FCode       = "SERNM";
            format.FCodeCr     = "LETTERSNR";
            format.FNote       = "LETTERSDT";
            format.FDoc        = "QUALNMR";
            session.Save(price);
            session.Save(format);

            realPrice           = session.Load <Price>(price.Id);
            realPrice.IsRejects = true;
            session.Save(realPrice);

            price.CreateAssortmentBoundSynonyms(session,
                                                "Диклофенак р-р для в/м введ 25 мг/мл (ампулы) 3 мл №10", "Биохимик ОАО");
        }
예제 #9
0
        public void SetUp()
        {
            var supplier = TestSupplier.Create();

            _testPrice = supplier.Prices[0];
            _testPrice.Costs[0].FormRule.FieldName           = "name";
            _testPrice.Costs[0].PriceItem.Format.PriceEncode = 1251;
            session.Save(_testPrice);
            session.Save(_testPrice.Costs[0].PriceItem.Format);
        }
        protected void CreatePrice()
        {
            supplier  = TestSupplier.CreateNaked(session);
            price     = supplier.Prices[0];
            priceItem = price.Costs.First().PriceItem;
            Configure(price);

            session.Save(supplier);
            Flush();
        }
예제 #11
0
        public void DeleteCostColumn()
        {
            TestPrice price;

            using (var scope = new TransactionScope(OnDispose.Rollback)) {
                price = CreateTestSupplierWithPrice();
                scope.VoteCommit();
            }
            var prices = FillPrices();
            var rows   = prices.Select(String.Format("PFirmCode = {0}", price.Supplier.Id));

            Assert.That(rows.Count(), Is.EqualTo(2));
            rows = prices.Select(String.Format("PFirmCode = {0} and PCostType = 1 and PIsParent = 0", price.Supplier.Id));
            Assert.That(rows.Count(), Is.EqualTo(1));
            rows[0].Delete();

            var changes = prices.GetChanges();

            With.Transaction((c, t) => {
                var mcmdDPrice = new MySqlCommand();
                var daPrice    = new MySqlDataAdapter();

                mcmdDPrice.CommandText = "usersettings.DeleteCost";
                mcmdDPrice.CommandType = CommandType.StoredProcedure;
                mcmdDPrice.Parameters.Clear();
                mcmdDPrice.Parameters.Add("?inCostCode", MySqlDbType.Int64, 0, "PCostCode");
                mcmdDPrice.Parameters["?inCostCode"].Direction = ParameterDirection.Input;

                mcmdDPrice.Connection = c;
                daPrice.DeleteCommand = mcmdDPrice;
                daPrice.TableMappings.Clear();
                daPrice.TableMappings.Add("Table", prices.TableName);

                daPrice.Update(changes);
                prices.AcceptChanges();
            });


            using (var scope = new TransactionScope(OnDispose.Rollback)) {
                var resprice = TestPrice.Find(price.Id);
                Assert.That(resprice.Costs.Count, Is.EqualTo(1));

                var cost = TestPriceCost.TryFind(costForDelete.Id);
                Assert.That(cost, Is.EqualTo(null));

                var item = TestPriceItem.TryFind(costForDelete.PriceItem.Id);
                Assert.That(item, Is.EqualTo(null));

                var source = TestPriceSource.TryFind(costForDelete.PriceItem.Source.Id);
                Assert.That(source, Is.EqualTo(null));

                var format = TestFormat.TryFind(costForDelete.PriceItem.Format.Id);
                Assert.That(format, Is.EqualTo(null));
            }
        }
        public void SetUp()
        {
            var supplier = TestSupplier.CreateNaked();

            _price           = supplier.Prices[0];
            _price.PriceType = PriceType.Assortment;
            Save(_price);
            _priceItem = _price.Costs[0].PriceItem;
            _priceItem.Format.PriceFormat = PriceFormatType.FarmaimpeksOKPFormalizer;
            Save(_priceItem);
        }
예제 #13
0
        public void SetUp()
        {
            orders = new List <OrderHead>();
            client = TestClient.Create(session);
            var testAddress = client.Addresses[0];

            address = Address.Find(testAddress.Id);
            var supplier = TestSupplier.Create(session);

            price       = supplier.Prices[0];
            appSupplier = Supplier.Find(supplier.Id);
        }
예제 #14
0
 public void Setup()
 {
     client       = TestClient.Create(session);
     testAddress  = client.Addresses[0];
     address      = Address.Find(testAddress.Id);
     settings     = WaybillSettings.Find(client.Id);
     supplier     = TestSupplier.CreateNaked(session);
     price        = supplier.Prices[0];
     appSupplier  = Supplier.Find(supplier.Id);
     docRoot      = Path.Combine(Settings.Default.DocumentPath, address.Id.ToString());
     waybillsPath = Path.Combine(docRoot, "Waybills");
     Directory.CreateDirectory(waybillsPath);
 }
        public ActionResult GetTestDetailById(int testId, string result)
        {
            var testInfo  = _objIHospitalMaster.GetMedicalTestDetailsById(testId);
            var quantity  = 1;
            var allTaxes  = labTaxService.GetTaxesPercentByTestId(testId);
            var resultIfo = new TestPrice(allTaxes)
            {
                TESTNAME     = testInfo.TESTNAME,
                SELLINGPRICE = Math.Round((testInfo.SELLIGPRICE.Value * quantity), 2)
            };

            resultIfo.CalculateTax();
            return(Json(resultIfo, JsonRequestBehavior.AllowGet));
        }
        protected TestFormat Configure(TestPrice okpPrice)
        {
            priceItem = okpPrice.Costs[0].PriceItem;
            var rules = priceItem.Format;

            rules.PriceFormat       = PriceFormatType.NativeDelim;
            rules.Delimiter         = ";";
            rules.FName1            = "F1";
            rules.FFirmCr           = "F2";
            rules.FQuantity         = "F3";
            rules.FOptimizationSkip = "F6";

            okpPrice.Costs.Single().FormRule.FieldName = "F4";
            return(rules);
        }
예제 #17
0
        public void ThirdChoiceMaxPlusOK()
        {
            // create an instance of the class we want to create
            clsOrder AnOrder = new clsOrder();
            // string variable to store any error message
            String Error = "";
            // create some test data to pass to the method
            Int32 TestPrice;

            TestPrice = 11;
            string ThirdPrice = TestPrice.ToString();

            // invoke the method
            Error = AnOrder.Valid(FirstPrice, SecondPrice, ThirdPrice, OrderTotal);
            // test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
예제 #18
0
        public void MenuItemPriceExtremeMax()    // 100 int FAIL
        {
            //create an instance of the class we want to create
            clsMenuItem AMenuItem = new clsMenuItem();
            //string variable to store any error message
            String Error = "";
            //create some test data to pass to the method
            Int32 TestPrice;

            TestPrice = 100;
            string MenuItemPrice = TestPrice.ToString();

            //invoke the method
            Error = AMenuItem.Valid(MenuItem, MenuItemPrice);
            //test to see that the result is correct
            Assert.AreNotEqual(Error, "");
        }
예제 #19
0
        public void PriceMid()
        {
            //create an instance of the class we want to create
            clsStock AStock = new clsStock();
            //string variable to store any error message
            String  Error = "";
            Decimal TestPrice;

            //set the date totodays date
            TestPrice = 5000000;
            //convert the date variable to a string variable
            string Price = TestPrice.ToString();

            Error = AStock.Valid(CarModel, BHP, Price, DateAdded);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
        public void PriceMin()
        {
            //create an instance of the class we want to create
            clsCourses aCourse = new clsCourses();
            //string variable to store any error message
            String Error = "";
            //create a variable to store the test date data
            Decimal TestPrice;

            //set TestPrice to a value
            TestPrice = 00.00m;
            //convert the decimal variable to a string variable
            string Price = TestPrice.ToString();

            //invoke the method
            Error = aCourse.Valid(Title, Category, Tutor, LiveDate, Price);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
예제 #21
0
        public void PriceMinPlusOne()
        {
            //create an instance of the class we want to create
            clsStock AStock = new clsStock();
            //string variable to store any error message
            String Error = "";
            //create some test data to pass to the method
            double TestPrice;

            //set the date todays date
            TestPrice = 0.01;
            //change the date to whatever the date is less 100years
            //convert the date variable to a string varaible
            string Price = TestPrice.ToString();

            //invoke the method
            Error = AStock.Valid(BookName, AuthorName, Price, PublishDate);
            //test to see that the result is correct
            Assert.AreEqual(Error, "");
        }
        public void Setup()
        {
            xml = @"<Price>
	<Item>
		<Code>109054</Code>
		<Product>Маска трехслойная на резинках медицинская Х3 Инд. уп. И/м</Product>
		<Producer>Вухан Лифарма Кемикалз Ко</Producer>
		<Volume>400</Volume>
		<Quantity>296</Quantity>
		<Period>01.01.2013</Period>
		<VitallyImportant>0</VitallyImportant>
		<NDS>10</NDS>
		<RequestRatio>20</RequestRatio>
		<Cost>
			<Id>PRICE6</Id>
			<Value>10.0</Value>
			<MinOrderCount>20</MinOrderCount>
		</Cost>
		<Cost>
			<Id>PRICE1</Id>
			<Value>10.0</Value>
			<MinOrderCount>20</MinOrderCount>
		</Cost>
	</Item>
</Price>
";

            var supplier = TestSupplier.Create(session);

            price     = supplier.Prices[0];
            priceItem = price.Costs[0].PriceItem;
            var format = priceItem.Format;

            format.PriceFormat = PriceFormatType.UniversalXml;
            format.Save();

            price.CreateAssortmentBoundSynonyms("Маска трехслойная на резинках медицинская Х3 Инд. уп. И/м", "Вухан Лифарма Кемикалз Ко");
            price.Save();
        }
        private void CreatePrices()
        {
            using (var scope = new TransactionScope(OnDispose.Rollback)) {
                rootPrice = supplier.Prices[0];
                rootPrice.SetFormat(PriceFormatType.NativeDbf);
                rootPrice.Save();
                scope.VoteCommit();
            }

            var supplier2 = TestSupplier.Create();

            using (var scope = new TransactionScope(OnDispose.Rollback)) {
                childPrice = supplier2.Prices[0];
                childPrice.SetFormat(PriceFormatType.NativeDbf);

                new TestUnrecExp("test", "test", childPrice).Save();
                new TestUnrecExp("test", "test", rootPrice).Save();
                childPrice.ParentSynonym = rootPrice.Id;
                childPrice.Save();
                scope.VoteCommit();
            }
        }
예제 #24
0
        public override void Execute(ISession session)
        {
            //этот товар должен обязательно присутствовать, он проверяется в тестах
            var product = session.Query <TestProduct>().FirstOrDefault(x => x.CatalogProduct.CatalogName.Name == "ПАПАВЕРИНА ГИДРОХЛОРИД" &&
                                                                       x.CatalogProduct.CatalogForm.Form == "супп. 20 мг N10");

            if (product == null)
            {
                throw new Exception("Справочник товаров пуст, выполни bake db:setup для загрузки");
            }
            mandatory = new [] { product };

            var supplier = TestSupplier.CreateNaked(session);

            supplier.Name += " " + supplier.Id;
            CreateSampleContactInfo(supplier);
            CreateSampleCore(session, supplier);

            var supplier1 = TestSupplier.CreateNaked(session);

            supplier1.Name += " " + supplier1.Id;
            CreateSampleContactInfo(supplier1);
            CreateSampleCore(session, supplier1);

            var minReqSupplier = TestSupplier.CreateNaked(session);

            minReqSupplier.Name += " минимальный заказ " + minReqSupplier.Id;
            CreateSampleContactInfo(minReqSupplier);
            //устанавливаем максимальную цену товара такую что бы при заказе одной позиции
            //она всегда не добирала до минимального заказа тк тесты ожидают этого
            CreateSampleCore(session, minReqSupplier, 1000);

            MaxProducerCosts = CreateMaxProduceCosts(session, supplier);
            Client           = CreateUser(session, DebugLogin());
            session.CreateSQLQuery("update Usersettings.RetClientsSet set IsStockEnabled = 1 where ClientCode = :id")
            .SetParameter("id", Client.Id)
            .ExecuteUpdate();

            var user = Client.Users.First();

            session.Query <TestAddressIntersection>()
            .Where(i => i.Intersection.Price.Supplier.Name.Contains("минимальный заказ") &&
                   i.Intersection.Client == user.Client)
            .Each(r => {
                r.MinReq        = 1500;
                r.ControlMinReq = true;
            });

            ExecuteFixture(new CreateMail(), session);

            DataMother.CreateNews(session);

            SimpleFixture.InnerCreateOrderReject(session,
                                                 Tuple.Create(session.Query <TestProduct>().First(p => !p.Hidden).FullName, 0u, 10u),
                                                 Tuple.Create(product.FullName, product.Id, 1u),
                                                 Tuple.Create(product.FullName, 0u, 1u));

            var requestLog = new RequestLog(session.Load <Common.Models.User>(Client.Users[0].Id), new Version());
            var exporter   = new Exporter(session, Config, requestLog)
            {
                Prefix = "",
                MaxProducerCostPriceId = MaxProducerCosts.Id,
                MaxProducerCostCostId  = MaxProducerCosts.Costs[0].Id,
            };

            exporter.Export();
            Files = exporter.Result;
        }