Пример #1
0
        public virtual void CopyValues(OutputInvoiceLineRecord source)
        {
            if (source == null)
            {
                return;
            }

            Oid                   = source.Oid;
            _oid_factura          = source.OidFactura;
            _oid_partida          = source.OidPartida;
            _oid_expediente       = source.OidExpediente;
            _oid_producto         = source.OidProducto;
            _oid_kit              = source.OidKit;
            _oid_concepto_albaran = source.OidConceptoAlbaran;
            _concepto             = source.Concepto;
            _facturacion_bulto    = source.FacturacionBulto;
            _cantidad_kilos       = source.CantidadKilos;
            _cantidad_bultos      = source.CantidadBultos;
            _p_impuestos          = source.PImpuestos;
            _p_descuento          = source.PDescuento;
            _total                = source.Total;
            _precio               = source.Precio;
            _subtotal             = source.Subtotal;
            _gastos               = source.Gastos;
            _oid_impuesto         = source.OidImpuesto;
            //_oid_almacen = source.OidAlmacen;
            _codigo_producto_cliente = source.CodigoProductoCliente;
        }
Пример #2
0
        internal void Update(OutputInvoice parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            this.OidFactura = parent.Oid;

            ValidationRules.CheckRules();

            if (!IsValid)
            {
                throw new iQValidationException(Library.Resources.Messages.GENERIC_VALIDATION_ERROR);
            }

            SessionCode = parent.SessionCode;
            OutputInvoiceLineRecord obj = Session().Get <OutputInvoiceLineRecord>(Oid);

            obj.CopyValues(Base.Record);
            Session().Update(obj);

            if (OidPartida == 0)
            {
                OutputDeliveries albaranes = OutputDeliveries.GetList(parent.GetAlbaranes(), true, true, parent.SessionCode);

                OutputDeliveryLine concepto = null;
                OutputDelivery     albaran  = null;

                foreach (OutputDelivery item in albaranes)
                {
                    albaran = item;

                    foreach (OutputDeliveryLine ca in item.Conceptos)
                    {
                        if (ca.Oid == OidConceptoAlbaran)
                        {
                            concepto = ca;
                            break;
                        }
                    }

                    if (concepto != null)
                    {
                        break;
                    }
                }

                if (concepto != null)
                {
                    concepto.CopyFrom(this);
                    albaran.CalculateTotal();
                }
            }

            MarkOld();
        }