public override void UpdateList() { switch (_current_action) { case molAction.Add: if (_entity == null) { return; } List.AddItem(_entity.GetInfo(false)); if (FilterType == IFilterType.Filter) { InputInvoiceList listA = InputInvoiceList.GetList(_filter_results); listA.AddItem(_entity.GetInfo(false)); _filter_results = listA.GetSortedList(); } break; case molAction.Edit: case molAction.ChangeStateContabilizado: case molAction.ChangeStateEmitido: case molAction.Unlock: if (_entity == null) { return; } ActiveItem.CopyFrom(_entity); break; case molAction.Delete: if (ActiveItem == null) { return; } List.RemoveItem(ActiveItem.Oid); if (FilterType == IFilterType.Filter) { InputInvoiceList listD = InputInvoiceList.GetList(_filter_results); listD.RemoveItem(ActiveItem.Oid); _filter_results = listD.GetSortedList(); } break; } RefreshSources(); if (_entity != null) { Select(_entity.Oid); } _entity = null; }
public static string SELECT(InputInvoice factura) { string query; QueryConditions conditions = new QueryConditions { FacturaRecibida = factura.GetInfo(false) }; query = InputInvoiceLine.SELECT(conditions, true); return(query); }
protected override void SaveAction() { InputInvoiceList list = (InputInvoiceList)Cache.Instance.Get(typeof(InputInvoiceList)); if (list != null) { InputInvoiceInfo item = list.GetItemByNFactura(_entity.NFactura, _entity.Fecha.Year, _entity.OidAcreedor, _entity.ETipoAcreedor); if (item != null && item.Oid != _entity.Oid) { if (ProgressInfoMng.ShowQuestion(String.Format(Library.Store.Resources.Messages.FACTURA_RECIBIDA_DUPLICADA, _entity.Acreedor)) == DialogResult.No) { _action_result = DialogResult.Ignore; return; } } } Library.Store.QueryConditions conditions = new Library.Store.QueryConditions { FacturaRecibida = _entity.GetInfo(false), TipoAcreedor = new ETipoAcreedor[1] { _entity.ETipoAcreedor }, Estado = moleQule.Base.EEstado.NoAnulado }; conditions.FacturaRecibida.Oid = 0; InputInvoiceInfo prev_invoice = InputInvoiceInfo.Exists(conditions, false); if (prev_invoice.Oid != 0 && prev_invoice.Oid != _entity.Oid && prev_invoice.Total == _entity.Total) { if (DialogResult.No == ProgressInfoMng.ShowQuestion("Existe una factura de este proveedor con la misma fecha, número e importe. ¿Desea continuar?")) { _action_result = DialogResult.Cancel; return; } } if (_expediente != null) { _entity.SetExpediente(_expediente); } _action_result = SaveObject() ? DialogResult.OK : DialogResult.Ignore; }
public static string SELECT(InputInvoice item) { return(SELECT(new Library.Store.QueryConditions { FacturaRecibida = item.GetInfo(), PaymentType = ETipoPago.Factura })); }