protected override void DeleteDeliveryAction() { if (Entity.AlbaranFacturas.Count == 0) { return; } DeliverySelectForm form = new DeliverySelectForm(this, ETipoEntidad.Cliente, OutputDeliveryList.GetList(_out_deliveries)); form.ShowDialog(this); if (form.DialogResult == DialogResult.OK) { List <OutputDeliveryInfo> results = form.Selected as List <OutputDeliveryInfo>; foreach (OutputDeliveryInfo item in results) { _entity.Extract(item); _out_deliveries.Remove(item); } } if (_entity.AlbaranFacturas.Count == 0) { Serie_BT.Enabled = true; } Lines_BS.ResetBindings(false); }
protected override void EliminarAlbaranAction() { if (Entity.AlbaranTickets.Count == 0) { return; } DeliverySelectForm form = new DeliverySelectForm(this, ETipoEntidad.Cliente, OutputDeliveryList.GetList(_albaranes)); form.ShowDialog(this); if (form.DialogResult == DialogResult.OK) { List <OutputDeliveryInfo> results = form.Selected as List <OutputDeliveryInfo>; foreach (OutputDeliveryInfo item in results) { _entity.Extract(item); _albaranes.Remove(item); } } if (_entity.AlbaranTickets.Count == 0) { Serie_BT.Enabled = true; } Datos_Concepto.ResetBindings(false); }
public virtual void CrearFacturaAction() { DeliverySelectForm form = new DeliverySelectForm(this, ETipoEntidad.Cliente, OutputDeliveryList.GetNoFacturados(true)); form.ShowDialog(this); if (form.DialogResult == DialogResult.OK) { try { PgMng.Reset(4, 1, Resources.Messages.GENERANDO_FACTURAS, this); List <OutputDeliveryInfo> albaranes = form.Selected as List <OutputDeliveryInfo>; PgMng.Grow(); OutputInvoices facturas = OutputInvoices.NewList(); facturas.NewItems(albaranes); PgMng.Grow(); facturas.Save(); facturas.CloseSession(); _selected = albaranes; _action_result = DialogResult.OK; } catch (Exception ex) { PgMng.ShowInfoException(ex); } finally { PgMng.FillUp(); } } }
protected void SelectDeliveryAction() { OutputDeliveryList list = OutputDeliveryList.GetByClientList(_source_client.Oid); DeliverySelectForm form = new DeliverySelectForm(this, _source_client.ETipoEntidad, list); if (form.ShowDialog(this) == DialogResult.OK) { SetSourceDeliveries(form.Selected as List <OutputDeliveryInfo>); } }
private bool AddAlbaran() { if (_entity.OidSerie == 0) { PgMng.ShowInfoException(Resources.Messages.NO_SERIE_SELECTED); return(false); } OutputDeliveryList list = null; if (!_entity.AlbaranContado) { if (_entity.OidCliente != 0) { list = OutputDeliveryList.GetNoFacturados(true, _entity.OidCliente, _entity.OidSerie, (_entity.Rectificativa ? ETipoFactura.Rectificativa : ETipoFactura.Ordinaria)); } else { list = OutputDeliveryList.GetNoFacturados(true, 0, _entity.OidSerie, (_entity.Rectificativa ? ETipoFactura.Rectificativa : ETipoFactura.Ordinaria)); } } else { list = OutputDeliveryList.GetNoFacturadosAgrupados(_entity.OidSerie, true); } //Quitamos de la lista los ya añadidos List <OutputDeliveryInfo> lista = new List <OutputDeliveryInfo>(); foreach (OutputDeliveryInfo item in list) { if (_entity.AlbaranFacturas.GetItemByAlbaran(item.Oid) == null) { lista.Add(item); } } OutputDeliveryList lista_completa = OutputDeliveryList.GetListByCliente(true, _entity.OidCliente); //Añadimos a lista los eliminados foreach (AlbaranFactura item in _albaranes_factura) { if (_entity.AlbaranFacturas.GetItemByAlbaran(item.OidAlbaran) == null) { lista.Add(lista_completa.GetItem(item.OidAlbaran)); } } DeliverySelectForm form = new DeliverySelectForm(this, ETipoEntidad.Cliente, OutputDeliveryList.GetList(lista)); form.ShowDialog(this); if (form.DialogResult == DialogResult.OK) { _results = form.Selected as List <OutputDeliveryInfo>; if (_entity.Rectificativa && (_results.Count > 1)) { PgMng.ShowInfoException("No es posible asignar varios albaranes a una factura rectificativa."); return(false); } foreach (OutputDeliveryInfo item in _results) { if (item.OidHolder != _results[0].OidHolder) { PgMng.ShowInfoException("No es posible asignar albaranes de clientes distintos a una misma Factura."); return(false); } } _back_job = BackJob.AddAlbaran; //PgMng.StartBackJob(this); DoAddAlbaran(null); if (Result == BGResult.OK) { Serie_BT.Enabled = false; Datos.ResetBindings(false); } } if ((_entity.AlbaranContado) && (_entity.Conceptos.Count < 0)) { Agrupada_CkB.Enabled = false; } return(false); }