private void AddMix() { if (_batch == null) { return; } _entity.Expediente = _batch.Expediente; _delivery.Conceptos.NewItem(_entity); OutputDeliveryLine concepto; foreach (BatchInfo item in _batch.Componentes) { concepto = OutputDeliveryLine.NewChild(_delivery); concepto.CopyFrom(item); concepto.OidKit = _batch.Oid; concepto.OidExpediente = _batch.OidExpediente; concepto.PImpuestos = _serie.PImpuesto; concepto.FacturacionBulto = false; concepto.Precio = item.PrecioVentaKilo; concepto.CantidadKilos = _entity.CantidadKilos * item.Proporcion / 100; concepto.CantidadBultos = concepto.CantidadKilos / item.KilosPorBulto; concepto.Expediente = _batch.Expediente; concepto.FacturacionBulto = _entity.FacturacionBulto; _delivery.Conceptos.NewItem(concepto); } }
public static OutputDeliveryList GetChildList(IList <OutputDelivery> list) { OutputDeliveryList flist = new OutputDeliveryList(); if (list != null) { int sessionCode = OutputDelivery.OpenSession(); CriteriaEx criteria = null; flist.IsReadOnly = false; foreach (OutputDelivery item in list) { criteria = OutputDeliveryLine.GetCriteria(sessionCode); criteria.AddEq("OidAlbaran", item.Oid); item.Conceptos = OutputDeliveryLines.GetChildList(criteria.List <OutputDeliveryLine>()); flist.AddItem(item.GetInfo()); } flist.IsReadOnly = true; OutputDelivery.CloseSession(sessionCode); } return(flist); }
protected override void EditLineAction() { if (Lines_BS.Current == null) { return; } OutputDeliveryLine cf = (OutputDeliveryLine)Lines_BS.Current; _cliente = Client_BS.Current as ClienteInfo; if (cf.OidPartida == 0) { DeliveryLineEditForm form = new DeliveryLineEditForm(ETipoProducto.Libres, _entity, _serie, _cliente, cf, this); if (form.ShowDialog(this) == DialogResult.OK) { _entity.CalculateTotal(); } } else { DeliveryLineEditForm form = new DeliveryLineEditForm(ETipoProducto.Almacen, _entity, _serie, _cliente, cf, this); if (form.ShowDialog(this) == DialogResult.OK) { _entity.CalculateTotal(); } } }
internal void Update(OutputInvoice 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(Library.Resources.Messages.GENERIC_VALIDATION_ERROR); } SessionCode = parent.SessionCode; OutputInvoiceLineRecord obj = Session().Get <OutputInvoiceLineRecord>(Oid); obj.CopyValues(Base.Record); Session().Update(obj); if (OidPartida == 0) { OutputDeliveries albaranes = OutputDeliveries.GetList(parent.GetAlbaranes(), true, true, parent.SessionCode); OutputDeliveryLine concepto = null; OutputDelivery albaran = null; foreach (OutputDelivery item in albaranes) { albaran = item; foreach (OutputDeliveryLine ca in item.Conceptos) { if (ca.Oid == OidConceptoAlbaran) { concepto = ca; break; } } if (concepto != null) { break; } } if (concepto != null) { concepto.CopyFrom(this); albaran.CalculateTotal(); } } MarkOld(); }
/// <summary>Aplica las reglas de validación de usuarios al formulario. /// <returns>void</returns> /// </summary> protected override void ApplyAuthorizationRules() { Tabla.Visible = OutputDeliveryLine.CanGetObject(); Add_Button.Enabled = OutputDeliveryLine.CanAddObject(); Edit_Button.Enabled = OutputDeliveryLine.CanEditObject(); Delete_Button.Enabled = OutputDeliveryLine.CanDeleteObject(); Print_Button.Enabled = OutputDeliveryLine.CanGetObject(); View_Button.Enabled = OutputDeliveryLine.CanGetObject(); }
protected override void RefreshMainData() { _entity = OutputDeliveryLine.NewChild(_delivery); _entity.PImpuestos = _serie.PImpuesto; Datos.DataSource = _entity; PgMng.Grow(); base.RefreshMainData(); }
protected override void UpdateDeliveryAction() { OutputDeliveryLine item = Lines_BS.Current as OutputDeliveryLine; ProductInfo producto = ProductInfo.Get(item.OidProducto, false, false); BatchInfo partida = BatchInfo.Get(item.OidPartida, false, false); item.AjustaCantidad(producto, (partida.Oid == 0) ? null : partida); _entity.CalculateTotal(); ControlsMng.UpdateBinding(Lines_BS); }
private static OutputDeliveryLineList GetList(string query, bool childs) { CriteriaEx criteria = OutputDeliveryLine.GetCriteria(OutputDeliveryLine.OpenSession()); criteria.Childs = childs; criteria.Query = query; OutputDeliveryLineList list = DataPortal.Fetch <OutputDeliveryLineList>(criteria); CloseSession(criteria.SessionCode); return(list); }
protected void AddCacheItem(OutputDeliveryLine item) { if (item == null) { return; } _oidAlmacenes.Add(item.OidAlmacen); _oidExpedientes.Add(item.OidExpediente); _oidPartidas.Add(item.OidPartida); _oidProductos.Add(item.OidProducto); _oidPedidos.Add(item.OidPedido); }
public static OutputDeliveryLineList GetChildList(OutputDeliveryInfo parent, bool childs) { CriteriaEx criteria = OutputDeliveryLine.GetCriteria(OutputDeliveryLine.OpenSession()); criteria.Query = OutputDeliveryLineList.SELECT(parent); criteria.Childs = childs; OutputDeliveryLineList list = DataPortal.Fetch <OutputDeliveryLineList>(criteria); CloseSession(criteria.SessionCode); return(list); }
public DeliveryLineEditForm(ETipoProducto tipo, OutputDelivery delivery, SerieInfo serie, ClienteInfo cliente, OutputDeliveryLine line, Form parent) : base(tipo, delivery, serie, cliente, parent) { InitializeComponent(); this.Text = Resources.Labels.CONCEPTO_EDIT_TITLE; _entity = line; RefreshMainData(); // Va aquí porque si no peta en el padre porque _entity es nulo _entity.PropertyChanged += new PropertyChangedEventHandler(Entity_PropertyChanged); }
public static OutputDeliveryLineList GetListByExpediente(long oidExpedient, bool childs) { CriteriaEx criteria = OutputDeliveryLine.GetCriteria(OutputDeliveryLine.OpenSession()); criteria.Childs = childs; QueryConditions conditions = new QueryConditions { Expediente = ExpedientInfo.New(oidExpedient) }; criteria.Query = OutputDeliveryLineList.SELECT(conditions); OutputDeliveryLineList list = DataPortal.Fetch <OutputDeliveryLineList>(criteria); CloseSession(criteria.SessionCode); return(list); }
protected override void SelectLineTaxAction() { if (Lines_BS.Current == null) { return; } OutputDeliveryLine item = Lines_BS.Current as OutputDeliveryLine; ImpuestoSelectForm form = new ImpuestoSelectForm(this); if (form.ShowDialog(this) == DialogResult.OK) { ImpuestoInfo source = (ImpuestoInfo)form.Selected; item.OidImpuesto = source.Oid; item.PImpuestos = source.Porcentaje; _entity.CalculateTotal(); } }
protected override void SelectLineExpedientAction() { if (_entity.EHolderType == ETipoEntidad.WorkReport) { return; } if (Lines_BS.Current == null) { return; } OutputDeliveryLine item = Lines_BS.Current as OutputDeliveryLine; if (item.OidPartida != 0) { ProgressInfoMng.ShowInfo(Resources.Messages.DELIVERY_LINE_EXPEDIENT_WARNING); return; } ExpedienteList expedientes = ExpedienteList.GetListByStockProducto(item.GetInfo(false)); ExpedienteSelectForm form = new ExpedienteSelectForm(this, expedientes); if (form.ShowDialog(this) == DialogResult.OK) { ExpedientInfo source = (ExpedientInfo)form.Selected; if (source.StockKilos < item.CantidadKilos) { PgMng.ShowErrorException(Resources.Messages.STOCK_INSUFICIENTE + " " + source.StockKilos.ToString()); return; } item.OidExpediente = source.Oid; item.Expediente = source.Codigo; AddCacheItem(source); } }
public static string SELECT(QueryConditions conditions) { return(OutputDeliveryLine.SELECT(conditions, false)); }
public override void UpdateList() { switch (_current_action) { case molAction.Add: if (_entity == null) { return; } if (List.GetItem(_entity.Oid) != null) { return; } List.AddItem(_entity.GetInfo(false)); if (FilterType == IFilterType.Filter) { OutputDeliveryLineList listA = OutputDeliveryLineList.GetList(_filter_results); listA.AddItem(_entity.GetInfo(false)); _filter_results = listA.GetSortedList(); } break; case molAction.CustomAction1: case molAction.CustomAction2: case molAction.Edit: case molAction.Lock: case molAction.Unlock: if (_selected != null) { List <OutputDeliveryLineInfo> entities = (List <OutputDeliveryLineInfo>)_selected; foreach (OutputDeliveryLineInfo item in entities) { List.GetItem(item.Oid).CopyFrom(item); if (FilterType == IFilterType.Filter) { OutputDeliveryLineList list = OutputDeliveryLineList.GetList(_filter_results); OutputDeliveryLineInfo entity = list.GetItem(item.Oid); if (entity != null) { entity.CopyFrom(item); } _filter_results = list.GetSortedList(); } } } if (_entity == null) { return; } ActiveItem.CopyFrom(_entity); break; case molAction.Delete: if (ActiveItem == null) { return; } List.RemoveItem(ActiveOID); if (FilterType == IFilterType.Filter) { OutputDeliveryLineList listD = OutputDeliveryLineList.GetList(_filter_results); listD.RemoveItem(ActiveOID); _filter_results = listD.GetSortedList(); } break; } RefreshSources(); if (_entity != null) { Select(_entity.Oid); } _entity = null; }
public void CopyFrom(OutputDeliveryLine source) { _base.CopyValues(source); }