public virtual void CopyFrom(InputDeliveryLineInfo source)
        {
            if (source == null)
            {
                return;
            }

            OidConceptoAlbaran = source.Oid;
            OidExpediente      = source.OidExpediente;
            OidAlmacen         = source.OidAlmacen;
            OidPartida         = source.OidPartida;
            OidProducto        = source.OidProducto;
            OidKit             = source.OidKit;
            OidImpuesto        = source.OidImpuesto;
            Concepto           = source.Concepto;
            CantidadBultos     = source.CantidadBultos;
            CantidadKilos      = source.CantidadKilos;
            PImpuestos         = source.PImpuestos;
            PDescuento         = source.PDescuento;
            Total                  = source.Total;
            Precio                 = source.Precio;
            FacturacionBulto       = source.FacturacionBulto;
            Subtotal               = source.Subtotal;
            Expediente             = source.CodigoExpediente;
            IDAlmacen              = source.IDAlmacen;
            Almacen                = source.Almacen;
            CodigoProductoAcreedor = source.CodigoProductoAcreedor;
            PIRPF                  = source.PIRPF;

            IDBatch = source.IDBatch;
        }
Beispiel #2
0
        public Expense NewItem(Expedient parent, Expense gasto, InputDeliveryLineInfo ca)
        {
            Expense item = Expense.NewChild(parent, gasto, ca);

            this.AddItem(item);
            return(item);
        }
Beispiel #3
0
        internal static string SELECT(long oid, bool lockTable)
        {
            QueryConditions conditions = new QueryConditions {
                ConceptoAlbaranProveedor = InputDeliveryLineInfo.New(oid)
            };

            return(SELECT(conditions, lockTable));
        }
        public static string SELECT(InputDeliveryLineInfo item)
        {
            string query = SELECT(new QueryConditions {
                ConceptoAlbaranProveedor = item
            });

            query += " ORDER BY ST.\"OID_BATCH\", ST.\"OID\"";
            return(query);
        }
Beispiel #5
0
        protected void CopyValues(InputDeliveryLineInfo source)
        {
            if (source == null)
            {
                return;
            }

            Oid = source.Oid;
            _base.CopyValues(source);
        }
 public void Remove(InputDeliveryLineInfo line)
 {
     foreach (InputInvoiceLine item in this)
     {
         if (item.OidConceptoAlbaran == line.Oid)
         {
             this.Remove(item);
             break;
         }
     }
 }
Beispiel #7
0
        public Expense GetItemByConceptos(InputInvoiceLineInfo cf, InputDeliveryLineInfo ca)
        {
            foreach (Expense item in this)            //Si la factura es nueva, item.OidConceptoFactura no va a ser igual a cf.Oid
            {
                if ((item.OidConceptoFactura == cf.Oid) && (item.OidConceptoAlbaran == ca.Oid))
                {
                    return(item);
                }
            }

            return(null);
        }
Beispiel #8
0
        public Expense GetItem(Expense gasto, InputDeliveryLineInfo ca)
        {
            foreach (Expense item in this)
            {
                if ((item.Serial == gasto.Serial) && (item.ECategoriaGasto == gasto.ECategoriaGasto) && (item.OidConceptoAlbaran == ca.Oid))
                {
                    return(item);
                }
            }

            return(null);
        }
        internal void Update(InputInvoice 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(moleQule.Resources.Messages.GENERIC_VALIDATION_ERROR);
            }

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

            long oid_exp_old = obj.OidExpediente;

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

            if ((OidExpediente != 0) && (parent.OidExpediente != OidExpediente))
            {
                Store.Expedient.Get(OidExpediente, false, true, parent.SessionCode);
            }

            if ((oid_exp_old != 0) && (OidExpediente != oid_exp_old))
            {
                Store.Expedient.Get(oid_exp_old, false, true, parent.SessionCode);

                InputDeliveryLineInfo ca = InputDeliveryLineInfo.Get(OidConceptoAlbaran, false);

                if (ca.OidExpediente != OidExpediente)
                {
                    InputDelivery albaran = InputDelivery.Get(ca.OidAlbaran, ETipoAcreedor.Todos, true, SessionCode);

                    albaran.Conceptos.GetItem(ca.Oid).OidExpediente = OidExpediente;

                    albaran.SaveAsChild();
                }
            }

            MarkOld();
        }
Beispiel #10
0
        internal void CopyValues(InputDeliveryLineInfo source)
        {
            if (source == null)
            {
                return;
            }

            _record.CopyValues(source._base.Record);

            _store      = source.Almacen;
            _store_id   = source.IDAlmacen;
            _expediente = source.Expediente;
            _ayuda_kilo = source.AyudaKilo;
            _oid_stock  = source.OidStock;
            _oid_pedido = source.OidPedido;
            _id_batch   = source.IDBatch;
        }
        public List <CuentaResumen> GetCuentas()
        {
            try
            {
                List <CuentaResumen> list      = new List <CuentaResumen>();
                ProductList          productos = ProductList.GetList(false, true);
                FamiliaList          familias  = FamiliaList.GetList(false, true);
                bool        nuevo;
                ProductInfo producto;
                FamiliaInfo familia;
                string      cuenta;

                foreach (InputInvoiceLineInfo item in _conceptos)
                {
                    nuevo    = true;
                    producto = productos.GetItem(item.OidProducto);
                    if (producto == null)
                    {
                        producto = productos.GetItem(InputDeliveryLineInfo.Get(item.OidConceptoAlbaran, false).OidProducto);
                    }
                    familia = familias.GetItem(producto.OidFamilia);

                    cuenta = (producto.CuentaContableCompra == string.Empty) ? familia.CuentaContableCompra : producto.CuentaContableCompra;

                    //Agrupamos los conceptos por cuentas contables
                    for (int i = 0; i < list.Count; i++)
                    {
                        CuentaResumen cr = list[i];

                        //Tiene prioridad la cuenta contable del producto
                        if (producto.CuentaContableCompra != string.Empty)
                        {
                            if (cr.CuentaContable == producto.CuentaContableCompra)
                            {
                                cr.Importe += item.BaseImponible;
                                list[i]     = cr;
                                nuevo       = false;
                                break;
                            }
                        }
                        //Luego la de la familia
                        else if (cr.CuentaContable == familia.CuentaContableCompra)
                        {
                            cr.Importe += item.BaseImponible;
                            list[i]     = cr;
                            nuevo       = false;
                            break;
                        }
                    }

                    if (nuevo)
                    {
                        list.Add(new CuentaResumen {
                            OidFamilia     = producto.OidFamilia,
                            Importe        = item.BaseImponible,
                            CuentaContable = cuenta
                        });
                    }
                }

                return(list);
            }
            catch
            {
                throw new iQException(String.Format(Resources.Messages.ERROR_FACTURA_CUENTA, NFactura, Acreedor));
            }
        }
Beispiel #12
0
 public InputDeliveryLine NewItem(InputDelivery parent, InputDeliveryLineInfo line)
 {
     this.NewItem(InputDeliveryLine.NewChild(parent, line));
     return(this[Count - 1]);
 }
Beispiel #13
0
        public Expense NewItem(Expedient parent, InputInvoiceInfo fac, InputInvoiceLineInfo cf, InputDeliveryLineInfo ca)
        {
            Expense item = Expense.NewChild(parent, fac, cf, ca);

            SetNextCode(item);
            this.AddItem(item);
            //parent.UpdateGastos();
            return(item);
        }