Пример #1
0
        public ScanResponse prueba(DataAccess.SirCoPV.Venta pru)
        {
            var ctxpv = new DataAccess.SirCoPVDataContext();

            ctxpv.Ventas.Add(pru);
            ctxpv.SaveChanges();
            return(null);
        }
Пример #2
0
        public void CambioMismaCorridaCambioPrecioMayorPromocion()
        {
            /*
             * 1	NULL	0000003678429	AC	539.00	CTA	    682	16-	A	15	17	324
             * 2	NULL	0000003522471	AC	539.00	CTA	    682	15	A	15	17	324
             * 3	NULL	0000003776476	AC	589.00	CTA	    682	19-	B	17-	21	324
             * 4	NULL	0000003776472	AC	589.00	CTA	    682	18-	B	17-	21	324
             * 5	NULL	0000003678238	AC	649.00	CTA	    682	24	C	21-	26	324
             * 6	NULL	0000003676610	AC	649.00	CTA	    682	25	C	21-	26	324
             */

            var model = new Common.Entities.SaleRequest()
            {
                Sucursal   = "01",
                VendedorId = 132
            };

            model.Productos = new Common.Entities.SerieFormasPago[] {
                new Common.Entities.SerieFormasPago {
                    Serie = "0000003678429", FormasPago = new Common.Constants.FormaPago[] { Common.Constants.FormaPago.EF }
                }
            };
            model.Pagos = new Common.Entities.Pago[] {
                new Common.Entities.Pago {
                    FormaPago = Common.Constants.FormaPago.EF, Importe = 539
                }
            };

            _context.RequestProducto("0000003678429", 0);

            Common.Entities.SaleResponse folio = null;
            using (ShimsContext.Create())
            {
                System.Fakes.ShimDateTime.NowGet = () => { return(DateTime.Parse("2019-03-06")); };
                folio = _context.Sale(model, 0);
            }

            Assert.AreEqual("434054", folio.Folio);

            var ctx = new DataAccess.SirCoPVDataContext();
            var det = ctx.VentasDetalle.Where(i => i.sucursal == model.Sucursal &&
                                              i.venta == "434054" && i.serie == "0000003678429").Single();

            det.idpromocion = 18;     //prueba
            det.precdesc    = 269.5m; //539 / 2 = 50%
            ctx.SaveChanges();

            var sctx = new DataAccess.SirCoDataContext();
            var cor  = sctx.Corridas.Where(i => i.marca == "CTA" && i.estilon.Trim() == "682" && i.corrida == "A").Single();

            cor.precio = 600;
            sctx.SaveChanges();

            var crequest = new Common.Entities.ChangeRequest
            {
                Sucursal = "01",
                Folio    = "434054",
                Items    = new Common.Entities.ChangeItem[]
                {
                    new Common.Entities.ChangeItem {
                        OldItem = "0000003678429", NewItem = "0000003522471"
                    }
                }
            };

            _context.RequestProducto("0000003522471", 0);
            Common.Entities.ChangeResponse cres = null;
            using (ShimsContext.Create())
            {
                System.Fakes.ShimDateTime.NowGet = () => { return(DateTime.Parse("2019-03-07")); };
                cres = _context.Change(crequest, 0, "08");
            }

            Assert.AreEqual("295595", cres.Venta);
            Assert.AreEqual("023287", cres.Devolucion);

            var dev = ctx.Devoluciones.Where(i => i.sucursal == "08" && i.devolvta == "023287").Single();

            Assert.AreEqual(0m, dev.disponible);

            var vdet = ctx.VentasDetalle.Where(i => i.sucursal == "08" && i.venta == "295595" && i.serie == "0000003522471").Single();

            Assert.AreEqual(539m, vdet.precio);
            Assert.AreEqual(269.5m, vdet.precdesc);
        }