public void GetJsonFacturaDetalleTest()
        {
            FacturaCompraDetalleDataMapper target = new FacturaCompraDetalleDataMapper(); // TODO: Inicializar en un valor adecuado
            string expected = string.Empty;                                               // TODO: Inicializar en un valor adecuado
            string actual;

            actual = target.GetJsonFacturaDetalle();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Compruebe la exactitud de este método de prueba.");
        }
        public void GetDetallebyFacturaTest()
        {
            FacturaCompraDetalleDataMapper target = new FacturaCompraDetalleDataMapper(); // TODO: Inicializar en un valor adecuado
            FACTURA factura = new FACTURA();                                              // TODO: Inicializar en un valor adecuado

            factura.UNID_FACTURA = 20121202234231731;
            List <FACTURA_DETALLE> expected = null; // TODO: Inicializar en un valor adecuado
            List <FACTURA_DETALLE> actual;

            actual = target.GetDetallebyFactura(factura);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Compruebe la exactitud de este método de prueba.");
        }
Ejemplo n.º 3
0
        public void AttemptModifyFactura()
        {
            if (Catalog)
            {
                FacturaCompraDataMapper        fcdmp = new FacturaCompraDataMapper();
                FacturaCompraDetalleDataMapper fcdDm = new FacturaCompraDetalleDataMapper();

                //Actualizar Factura
                fcdmp.udpateElement(new FACTURA()
                {
                    UNID_FACTURA        = this.SelectedFactura.UnidFactura,
                    FACTURA_NUMERO      = this.NumeroFactura,
                    FECHA_FACTURA       = this.FechaFactura,
                    IS_ACTIVE           = true,
                    IVA_POR             = this.PorIva,
                    UNID_MONEDA         = this.SelectedMoneda.UnidMoneda,
                    UNID_PROVEEDOR      = this.SelectedProveedor.UnidProveedor,
                    NUMERO_PEDIMENTO    = this.NumeroPedimento,
                    UNID_TIPO_PEDIMENTO = this.SelectedTipoPedimento.UnidTipoPedimento,
                    TC = this.TC
                }, this.ActualUser);

                //Generar Array para insertar/actualizar/eliminar las factura detalle
                List <FACTURA_DETALLE> fds = new List <FACTURA_DETALLE>();
                foreach (FacturaCompraDetalleModel det in this.FacturaDetalles)
                {
                    fds.Add(det.ConvertToPoco(det));
                    fds[fds.Count - 1].UNID_FACTURA = this.SelectedFactura.UnidFactura;
                }

                if (fds.Count > 0)
                {
                    fcdDm.udpateElements(fds);
                }
            }

            if (this._SelectedFactura != null)
            {
                this._SelectedFactura.FechaFactura    = this.FechaFactura;
                this._SelectedFactura.Moneda          = this.SelectedMoneda;
                this._SelectedFactura.NumeroFactura   = this.NumeroFactura;
                this._SelectedFactura.NumeroPedimento = this.NumeroPedimento;
                this._SelectedFactura.PorIva          = this.PorIva;
                this._SelectedFactura.Proveedor       = this.SelectedProveedor;
                this._SelectedFactura.IsNew           = this.IsNew;
                this._SelectedFactura.IsModified      = this.IsModified;
                this._SelectedFactura.FacturaDetalle  = this.FacturaDetalles;
                this._SelectedFactura.TC            = this.TC;
                this._SelectedFactura.TipoPedimento = this.SelectedTipoPedimento;
            }
        }
Ejemplo n.º 4
0
        public string downloadFacturaDetalle(long?lastModifiedDate)
        {
            string respuesta = null;

            if (lastModifiedDate != null)
            {
                FacturaCompraDetalleDataMapper dataMapper = new FacturaCompraDetalleDataMapper();

                respuesta = dataMapper.GetJsonFacturaDetalle(lastModifiedDate);

                if (String.IsNullOrEmpty(respuesta))
                {
                    respuesta = null;
                }
            }
            return(respuesta);
        }
Ejemplo n.º 5
0
        private ObservableCollection <DeleteFacturaDetalleModel> GetDetallebyFactura(FACTURA factura)
        {
            ObservableCollection <DeleteFacturaDetalleModel> facturasmodel = new ObservableCollection <DeleteFacturaDetalleModel>();

            try
            {
                FacturaCompraDetalleDataMapper facDataMapper = new FacturaCompraDetalleDataMapper();
                List <FACTURA_DETALLE>         facturas      = facDataMapper.GetDetallebyFactura(factura);

                foreach (FACTURA_DETALLE o in facturas)
                {
                    facturasmodel.Add(new DeleteFacturaDetalleModel(o));
                }
            }
            catch (Exception)
            {
                ;
            }

            return(facturasmodel);
        }
        private void SaveFactura()
        {
            LoteModel lot = null;
            FacturaCompraDataMapper        fcdmp = new FacturaCompraDataMapper();
            FacturaCompraDetalleDataMapper fcdDm = new FacturaCompraDetalleDataMapper();

            //Guardar
            foreach (FacturaCompraModel item in this.Facturas)
            {
                if (item.IsNew)
                {
                    //insertar la nueva factura
                    if (lot == null)
                    {
                        lot          = new LoteModel(new LoteDataMapper());
                        lot.UnidLote = UNID.getNewUNID();
                        lot.UnidPOM  = UNID.getNewUNID();
                        lot.saveLote();
                    }

                    item.UnidLote    = lot.UnidLote;
                    item.UnidFactura = UNID.getNewUNID();
                    item.saveFactura();
                    //factura detalle
                    foreach (FacturaCompraDetalleModel fac in item.FacturaDetalle)
                    {
                        fac.Factura = item;
                        fac.saveFacturaDetalle();
                    }
                }
                else
                {
                    //Actualizar Factura
                    fcdmp.udpateElement(new FACTURA()
                    {
                        UNID_FACTURA        = item.UnidFactura,
                        FACTURA_NUMERO      = item.NumeroFactura,
                        FECHA_FACTURA       = item.FechaFactura,
                        IS_ACTIVE           = item.IsActive,
                        IVA_POR             = item.PorIva,
                        UNID_MONEDA         = item.Moneda.UnidMoneda,
                        UNID_PROVEEDOR      = item.Proveedor.UnidProveedor,
                        NUMERO_PEDIMENTO    = item.NumeroPedimento,
                        UNID_TIPO_PEDIMENTO = item.TipoPedimento.UnidTipoPedimento,
                        TC = item.TC
                    }, this.ActualUser);

                    //Generar Array para insertar/actualizar/eliminar las factura detalle
                    List <FACTURA_DETALLE> fds = new List <FACTURA_DETALLE>();
                    foreach (FacturaCompraDetalleModel det in item.FacturaDetalle)
                    {
                        fds.Add(det.ConvertToPoco(det));
                        fds[fds.Count - 1].UNID_FACTURA = item.UnidFactura;
                    }

                    if (fds.Count > 0)
                    {
                        fcdDm.udpateElements(fds);
                    }
                }
                //Borrar facturas
                fcdmp.deleteFacturas(this._DelFacturas, this.ActualUser);
            } //end foreach
        }     //end func