Esempio n. 1
0
        internal void CopyValues(IDataReader source)
        {
            if (source == null)
            {
                return;
            }

            long tipo_query = Format.DataReader.GetInt64(source, "TIPO_QUERY");

            //switch ((ConceptoFactura.ETipoQuery)tipo_query)
            //{
            //    case ConceptoFactura.ETipoQuery.GENERAL:
            //        {
            //            _oid_factura = Format.DataReader.GetInt64(source, "OID_FACTURA");
            //            _oid_expediente = Format.DataReader.GetInt64(source, "OID_EXPEDIENTE");
            //            _oid_partida = Format.DataReader.GetInt64(source, "OID_BATCH");
            //            _oid_producto = Format.DataReader.GetInt64(source, "OID_PRODUCTO");
            //            _oid_concepto_albaran = Format.DataReader.GetInt64(source, "OID_CONCEPTO_ALBARAN");
            //            _oid_kit = Format.DataReader.GetInt64(source, "OID_KIT");
            //            _oid_impuesto = Format.DataReader.GetInt64(source, "OID_IMPUESTO");
            //            _concepto = Format.DataReader.GetString(source, "CONCEPTO");
            //            _cantidad = Format.DataReader.GetDecimal(source, "CANTIDAD");
            //            _cantidad_bultos = Format.DataReader.GetDecimal(source, "CANTIDAD_BULTOS");
            //            _facturacion_bulto = Format.DataReader.GetBool(source, "FACTURACION_BULTO");
            //            _p_impuestos = Format.DataReader.GetDecimal(source, "P_IGIC");
            //            _p_descuento = Format.DataReader.GetDecimal(source, "P_DESCUENTO");
            //            _total = Format.DataReader.GetDecimal(source, "TOTAL");
            //            _precio = Format.DataReader.GetDecimal(source, "PRECIO");
            //            _subtotal = Format.DataReader.GetDecimal(source, "SUBTOTAL");
            //            _gastos = Format.DataReader.GetDecimal(source, "GASTOS");
            //            _codigo_producto_cliente = Format.DataReader.GetString(source, "CODIGO_PRODUCTO_CLIENTE");

            //            _oid_almacen = Format.DataReader.GetInt64(source, "OID_ALMACEN");
            //            _almacen = Format.DataReader.GetString(source, "ALMACEN");
            //            _expediente = Format.DataReader.GetString(source, "EXPEDIENTE");
            //            _cuenta_contable = Format.DataReader.GetString(source, "CUENTA_CONTABLE");
            //        }
            //        break;
            //    case ConceptoFactura.ETipoQuery.BY_EXPEDIENTE:
            //        {

            _record.CopyValues(source);

            _oid_almacen     = Format.DataReader.GetInt64(source, "OID_ALMACEN");
            _store           = Format.DataReader.GetString(source, "STORE");
            _store_id        = Format.DataReader.GetString(source, "STORE_ID");
            _expediente      = Format.DataReader.GetString(source, "EXPEDIENTE");
            _cuenta_contable = Format.DataReader.GetString(source, "CUENTA_CONTABLE");
            _n_factura       = Format.DataReader.GetString(source, "N_FACTURA");
            _fecha_factura   = Format.DataReader.GetDateTime(source, "FECHA_FACTURA");
            _cliente         = Format.DataReader.GetString(source, "CLIENTE");
            //        }
            //        break;
            //}
        }
Esempio n. 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();
        }