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); } }
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; } }
protected override void GetFormSourceData(object[] parameters) { _entity = (InputInvoiceInfo)parameters[0]; if (_entity.Conceptos == null) { _entity.LoadChilds(typeof(InputInvoiceLine), false); } }
protected void AddFacturaGastos(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) { if ((item.OidExpediente != expediente.Oid) && (item.OidExpediente != 0)) { item.IsSelected = false; } else { item.IsSelected = true; item.OidExpediente = expediente.Oid; item.Expediente = expediente.Codigo; } } PgMng.Grow(); expediente.LoadConceptosAlbaranes(false); PgMng.Grow(); expediente.NuevoGasto(fac, expediente.Conceptos, true); PgMng.Grow(); UpdateExpensesList(); UpdateBindings(); PgMng.Grow(); } catch (iQException ex) { PgMng.ShowInfoException(ex); } finally { PgMng.FillUp(); this.Enabled = true; } }