Esempio n. 1
0
        protected void EditFacturaGastos(Expedient expediente, InputInvoiceInfo fac)
        {
            this.Enabled = false;

            try
            {
                PgMng.Reset(5, 1, "Recalculando gastos y costes del expediente...", this);
                PgMng.Grow();

                expediente.LoadConceptosAlbaranes(false);
                PgMng.Grow();

                expediente.UpdateGasto(fac, expediente.Conceptos, true);
                PgMng.Grow();

                UpdateExpensesList();
                UpdateBindings();
                PgMng.Grow();
            }
            finally
            {
                PgMng.FillUp();
                this.Enabled = true;
            }
        }
Esempio n. 2
0
        internal void Update(Expedient parent)
        {
            this.RaiseListChangedEvents = false;

            parent.UpdateTotalesProductos(this, true);

            // update (thus deleting) any deleted child objects
            foreach (Batch obj in DeletedList)
            {
                obj.DeleteSelf(parent);
            }

            // now that they are deleted, remove them from memory too
            DeletedList.Clear();

            // add/update any current child objects
            foreach (Batch obj in this)
            {
                if (obj.IsNew)
                {
                    obj.Insert(parent);
                }
                else
                {
                    obj.Update(parent);
                }
            }

            this.RaiseListChangedEvents = true;
        }
        public static string SELECT(Expedient expedient)
        {
            string ex  = nHManager.Instance.GetSQLTable(typeof(ExpedientRecord));
            string ch  = nHManager.Instance.GetSQLTable(typeof(ChargeRecord));
            string ba  = nHManager.Instance.GetSQLTable(typeof(BatchRecord));
            string rea = nHManager.Instance.GetSQLTable(typeof(CobroREARecord));

            string query = @"
			SELECT EX.*
					,""TOTAL_FACTURADO""
					,""TOTAL_COBRADO""
			FROM "             + ex + @" AS EX 
			LEFT JOIN (SELECT ""OID_EXPEDIENTE""
								,SUM(""AYUDA_RECIBIDA_KILO"") * SUM(""KILOS_INICIALES"") AS ""TOTAL_FACTURADO"" 
						FROM "                         + ba + @" 
						GROUP BY ""OID_EXPEDIENTE"") 
				AS PE ON PE.""OID_EXPEDIENTE"" = EX.""OID""
			LEFT JOIN (SELECT ""OID_EXPEDIENTE""
								,""OID_COBRO""
								,SUM(""CANTIDAD"") AS ""TOTAL_COBRADO"" 
						FROM "                         + rea + @"
						GROUP BY ""OID_EXPEDIENTE"", ""OID_COBRO"") 
				AS CR ON CR.""OID_EXPEDIENTE"" = EX.""OID""
			LEFT JOIN "             + ch + @" AS C ON C.""OID"" = CR.""OID_COBRO""
			WHERE EX.""OID"" = "             + expedient.Oid;

            return(query);
        }
Esempio n. 4
0
        protected void NewOtroGasto(Expedient expediente)
        {
            expediente.NuevoGasto(true);

            UpdateBindings();
            UpdateExpensesList();
        }
        internal void Update(Expedient parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            //Debe obtener la sesion del padre pq el objeto es padre a su vez
            SessionCode = parent.SessionCode;

            OidExpediente = parent.Oid;
            Fecha         = parent.FechaDespachoDestino;

            ValidationRules.CheckRules();

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

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

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

            MarkOld();
        }
        /*public FRecibidaSelectGastoForm(long oid, ETipoAcreedor tipo, Form parent)
         * : base(oid, tipo, parent)
         * {
         * InitializeComponent();
         * }*/

        public FRecibidaSelectGastoForm(InputInvoiceInfo factura, Expedient expediente, Form parent)
            : base(factura, parent)
        {
            InitializeComponent();

            _expediente = expediente;
        }
Esempio n. 7
0
        protected void RemoveFacturaGastos(Expedient expediente, InputInvoiceInfo fac)
        {
            this.Enabled = false;

            try
            {
                PgMng.Reset(5, 1, "Recalculando gastos y costes del expediente...", this);

                if (fac.Conceptos == null)
                {
                    fac.LoadChilds(typeof(InputInvoiceLine), false);
                }

                foreach (InputInvoiceLineInfo item in fac.Conceptos)
                {
                    item.IsSelected = true;
                }
                PgMng.Grow();

                expediente.LoadConceptosAlbaranes(false);
                PgMng.Grow();

                expediente.RemoveGasto(fac, expediente.Conceptos, true);
                PgMng.Grow();

                UpdateExpensesList();
                Datos.ResetBindings(false);
                PgMng.Grow();
            }
            finally
            {
                PgMng.FillUp();
                this.Enabled = true;
            }
        }
Esempio n. 8
0
        protected void ReparteGasto(Expedient expediente)
        {
            if (!ControlsMng.IsCurrentItemValid(ExpensesInvoices_DGW))
            {
                return;
            }

            InputInvoiceInfo fac = ControlsMng.GetCurrentItem(ExpensesInvoices_DGW) as InputInvoiceInfo;

            if (fac.Conceptos == null)
            {
                fac.LoadChilds(typeof(InputInvoiceLine), false);
            }

            FRecibidaSelectGastoForm form = new FRecibidaSelectGastoForm(fac, expediente, this);

            foreach (InputInvoiceLineInfo item in form.EntityInfo.Conceptos)
            {
                Expense expense = expediente.Gastos.GetItemByConceptoFactura(item);
                item.IsSelected = (expense != null);
            }

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                EditFacturaGastos(form.EntityInfo);

                UpdateExpensesList();
                Datos.ResetBindings(false);
            }
        }
Esempio n. 9
0
        public void SetValues(Expedient parent, InputInvoiceInfo factura, LineaFomento linea)
        {
            LineasFomento lista = GetListByFactura(factura, linea);

            if (lista.Count == 0)
            {
                linea.SetValues(factura);
            }
            else
            {
                decimal total_kilos = linea.Kilos;

                foreach (LineaFomento item in lista)
                {
                    total_kilos += item.Kilos;
                }

                linea.SetValues(factura, (linea.Kilos / total_kilos));

                foreach (LineaFomento item in lista)
                {
                    item.SetValues(factura, (item.Kilos / total_kilos));
                }
            }

            parent.UpdateTotalCostesCompensables();
        }
Esempio n. 10
0
        public Expense NewItem(Expedient parent, InputInvoiceInfo fac)
        {
            Expense item = Expense.NewChild(parent, fac);

            this.AddItem(item);
            return(item);
        }
Esempio n. 11
0
        internal void DeleteSelf(Expedient parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            // if we're new then don't update the database
            if (this.IsNew)
            {
                return;
            }

            try
            {
                SessionCode = parent.SessionCode;
                Session().Delete(Session().Get <CabezaRecord>(Oid));
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkNew();
        }
 public static string SELECT(Expedient item)
 {
     Library.Store.QueryConditions conditions = new Library.Store.QueryConditions {
         Expedient = item.GetInfo(false)
     };
     return(SELECT(conditions, false));
 }
        public JsonResult ListCheckProcess(int id)
        {
            //Pendiente de agregar tipo de proceso por consulta
            Expedient expedient = db.Expedient.Find(id);
            var       idType    = expedient.IdTypeProcess;



            var ListCheck = (from CT in db.CheckType
                             join C in db.Check on CT.IdChecck equals C.IdCheck
                             where CT.IdTypeProcess == idType
                             select new DocumentProcessMD()
            {
                Name = C.Name,
                //Descripcion = C.Description,
                idTypeProces = CT.IdTypeProcess,
                idCheckType = CT.IdCheckType,
                idExpedient = id,
                Complet = (from CP in db.CheckProcess
                           where CP.IdCheckType == CT.IdCheckType && CP.IdExpendient == id
                           select CP.Complete).FirstOrDefault()
            }).ToList();

            return(Json(ListCheck, JsonRequestBehavior.AllowGet));
        }
        /// <summary>
        /// Guarda en la bd el objeto actual
        /// </summary>
        protected override bool SaveObject()
        {
            this.Datos.RaiseListChangedEvents = false;

            Expedient temp = _entity.Clone();

            temp.ApplyEdit();

            // do the save
            try
            {
                _entity = temp.Save();
                _entity.ApplyEdit();

                return(true);
            }
            catch (Exception ex)
            {
                PgMng.ShowInfoException(ex.Message);
                return(false);
            }
            finally
            {
                this.Datos.RaiseListChangedEvents = true;
            }
        }
Esempio n. 15
0
        protected override void GetFormSourceData(object[] parameters)
        {
            moleQule.Store.Structs.ETipoExpediente tipo = (moleQule.Store.Structs.ETipoExpediente)parameters[0];

            _entity = Expedient.New(tipo);
            _entity.BeginEdit();
        }
Esempio n. 16
0
        internal void LoadLibroGanadero()
        {
            Hashtable oidExpedientes = new Hashtable();

            oidExpedientes.Add(0, 0);

            foreach (InputDeliveryLine item in this)
            {
                if (item.OidExpediente == 0)
                {
                    continue;
                }
                if (oidExpedientes.ContainsKey(item.OidExpediente))
                {
                    continue;
                }

                oidExpedientes.Add(item.OidExpediente, item.OidExpediente);

                Expedient expediente = Store.Expedient.Get(item.OidExpediente, false, true, SessionCode);
                if (expediente == null)
                {
                    continue;
                }
                if (expediente.ETipoExpediente != ETipoExpediente.Ganado)
                {
                    continue;
                }

                LivestockBook libro = LivestockBook.Get(1, false, true, SessionCode);
                libro.LoadLineasByExpediente(item.OidExpediente, false);
            }

            oidExpedientes.Clear();
        }
        public static ExpedienteList GetListFomento(string cod_aduanero,
                                                    NavieraInfo naviera,
                                                    PuertoInfo p_origen,
                                                    PuertoInfo p_destino,
                                                    DateTime from,
                                                    DateTime till)
        {
            CriteriaEx criteria = Expedient.GetCriteria(Expedient.OpenSession());

            criteria.Childs = false;

            //No criteria. Retrieve all de List

            if (nHManager.Instance.UseDirectSQL)
            {
                criteria.Query = ExpedienteList.SELECT_FOMENTO(cod_aduanero,
                                                               naviera,
                                                               p_origen,
                                                               p_destino,
                                                               from,
                                                               till);
            }

            ExpedienteList list = DataPortal.Fetch <ExpedienteList>(criteria);

            CloseSession(criteria.SessionCode);
            return(list);
        }
Esempio n. 18
0
        public Expense NewItem(Expedient parent, Expense gasto, InputDeliveryLineInfo ca)
        {
            Expense item = Expense.NewChild(parent, gasto, ca);

            this.AddItem(item);
            return(item);
        }
Esempio n. 19
0
        public Expense NewItem(Expedient parent, InputInvoiceInfo fac, ECategoriaGasto tipo)
        {
            Expense item = Expense.NewChild(parent, fac, tipo);

            this.AddItem(item);
            return(item);
        }
Esempio n. 20
0
        /// <summary>
        /// Realiza el Save de los objetos de la lista. Inserta, Actualiza o Borra en función
        /// de los flags de cada objeto de la lista
        /// </summary>
        /// <param name="parent">BusinessBaseEx padre de la lista</param>
        internal void Update(Expedient parent)
        {
            this.RaiseListChangedEvents = false;

            // update (thus deleting) any deleted child objects
            foreach (REAExpedient obj in DeletedList)
            {
                obj.DeleteSelf(parent);
            }

            // now that they are deleted, remove them from memory too
            DeletedList.Clear();

            // add/update any current child objects
            foreach (REAExpedient obj in this)
            {
                if (!this.Contains(obj))
                {
                    if (obj.IsNew)
                    {
                        SetNextCode(obj);
                        obj.Insert(parent);
                    }
                    else
                    {
                        obj.Update(parent);
                    }
                }
            }

            this.RaiseListChangedEvents = true;
        }
Esempio n. 21
0
        protected void RemoveOtroGasto(Expedient expedient, Expense expense)
        {
            expedient.RemoveGasto(expense, true);

            UpdateBindings();
            UpdateExpensesList();
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Expedient expedient = db.Expedient.Find(id);

            db.Expedient.Remove(expedient);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 23
0
 public void EditItem(Expedient parent, InputInvoiceLineInfo cf, Expense gasto)
 {
     if (gasto == null)
     {
         return;
     }
     gasto.CopyFrom(parent, cf);
 }
Esempio n. 24
0
        public Batch NewItem(Batch partida, Stock stock, Expedient expediente, ETipoStock tipo)
        {
            Batch item = Batch.NewChild(partida, stock, expediente, tipo);

            this.AddItem(item);
            SetNextCode(item);
            return(item);
        }
Esempio n. 25
0
        public static Batchs GetChildListFromList(Expedient parent, string list, bool childs)
        {
            CriteriaEx criteria = Batch.GetCriteria(parent.SessionCode);

            criteria.Query  = Batchs.SELECT_FROM_LIST(parent, list);
            criteria.Childs = childs;

            return(DataPortal.Fetch <Batchs>(criteria));
        }
Esempio n. 26
0
        public static Stocks GetChildListByPartidaFromList(Expedient parent, string list, bool childs)
        {
            CriteriaEx criteria = Stock.GetCriteria(parent.SessionCode);

            criteria.Query  = Stocks.SELECT_FROM_LIST_BY_PARTIDA(parent, list);
            criteria.Childs = childs;

            return(DataPortal.Fetch <Stocks>(criteria));
        }
Esempio n. 27
0
        public static Cabezas GetChildList(Expedient parent, bool childs)
        {
            CriteriaEx criteria = Cabeza.GetCriteria(parent.SessionCode);

            criteria.Query  = Cabezas.SELECT(parent);
            criteria.Childs = childs;

            return(DataPortal.Fetch <Cabezas>(criteria));
        }
Esempio n. 28
0
 public EditStockActionForm(bool IsModal, Stock stock, Expedient exp)
     : base(IsModal)
 {
     InitializeComponent();
     _entity    = stock;
     _expedient = exp;
     SetFormData();
     this.Text = Resources.Labels.STOCK_EDIT_TITLE;
 }
 public AddStockInputForm(bool isModal, Expedient exp)
     : base(isModal)
 {
     InitializeComponent();
     _expedient         = exp;
     _entity            = _expedient.Stocks.NewItem(exp);
     _entity.ETipoStock = ETipoStock.Merma;
     SetFormData();
 }
 public BatchEditForm(bool isModal, Batch batch, Expedient exp)
     : base(isModal)
 {
     InitializeComponent();
     _source     = batch;
     _entity     = batch.Clone();
     _expediente = exp;
     SetFormData();
 }