/// <summary> /// Agrega una nueva instancia del item a la coleccion de items. /// </summary> /// <param name="sender"></param> /// <param name="item"></param> public virtual void Add(ComprobanteDeCompra sender, ItemComprobanteCompra item) { this.Parent = sender; this.Add(item); // item.OnRecalcItem += new ItemComprobante.RecalcularItem( this.EscuchoRecalculo ); // item.OnRefreshItem += new ItemComprobante.RefrescarItem( this.EscuchoRefresco ); // if ( OnRecalcItems != null ) // { // this.OnRecalcItems( this, new System.EventArgs() ); // } }
public bool Contains(ItemComprobanteCompra item) { foreach (ItemComprobanteCompra it in this.List) { if (it.IdProducto.Equals(item.IdProducto)) { return(true); } } return(false); }
public virtual int IndexOf(ItemComprobanteCompra item) { int index = 0; foreach (ItemComprobanteCompra it in this.List) { if (!it.IdProducto.Equals(item.IdProducto)) { index++; } } return(index); }
private void FillStepData(RelacionesComprobanteDeCompraOrigenDestino relaciones) { long idSucursal = Security.IdSucursal; long idEmpresa = Security.IdEmpresa; foreach (RelacionComprobanteDeCompraOrigenDestino relacion in relaciones) { if (idSucursal != relacion.IdSucursal) { idSucursal = relacion.IdSucursal; idEmpresa = relacion.IdEmpresa; } if (relacion.CantidadDestino > 0) { System.Data.DataRow row = (System.Data.DataRow)mz.erp.businessrules.tpu_ComprobantesDet.GetByPk(relacion.IdComprobante, relacion.OrdinalOrigen); Productos miProducto = new mz.erp.businessrules.Productos(relacion.IdProducto, relacion.IdSucursal, relacion.IdEmpresa); ItemComprobanteCompra.ItemCompra item = new ItemComprobanteCompra.ItemCompra(); item.IdProducto = relacion.IdProducto; item.Codigo = miProducto.Codigo; item.Cantidad = relacion.CantidadDestino; item.OrdinalOrigen = relacion.OrdinalOrigen; item.IdComprobanteOrigen = relacion.IdComprobante; item.IdTipoComprobanteOrigen = relacion.IdTipoDeComprobante; item.OrdinalDestino = this.Count; item.Descripcion = miProducto.Descripcion; item.DescripcionCorta = miProducto.DescripcionCorta; item.DescripcionLarga = miProducto.DescripcionLarga; item.PrecioCosto = (decimal)row["PrecioDeCosto"]; ItemComprobanteCompra miItemComprobante = new ItemComprobanteCompra("STEP", item, this); this.Add(miItemComprobante); } } //this.Parent.IdSucursal = idSucursal; //this.Parent.IdEmpresa = idEmpresa; }
public virtual void Add(ItemComprobanteCompra item) { if (this.Contains(item)) { ItemComprobanteCompra it = (ItemComprobanteCompra)this.List[this.IndexOf(item)]; it.Cantidad = it.Cantidad + item.Cantidad; //List.Add(it); } else { List.Add(item); } //this.IsDirty = true; //item.OnRecalcItem += new ItemComprobante.RecalcularItem( this.EscuchoRecalculo ); //item.OnRefreshItem += new ItemComprobante.RefrescarItem( this.EscuchoRefresco ); //item.Ordinal = List.Count - 1; //if ( OnRecalcItems != null ) //{ // this.OnRecalcItems( this, new System.EventArgs() ); //} }
private void FillStaticData(string Action, ItemComprobante item, string idTipoDeComprobanteDestino, RelacionesComprobanteDeCompraOrigenDestino relaciones) { switch (Action.ToUpper()) { case "NEW": { this.IdComprobante = mz.erp.systemframework.Util.NewStringId(); this.IdResponsable = Security.IdPersona; this.IdProveedor = Variables.GetValueString("Compras.Pedidos.ProveedorPorDefault"); this.FechaComprobante = DateTime.Now; this._itemsComprobantesCompras = new ItemsComprobantesCompra("New", this); //this.IdComprobanteDestino = "CPE"; this._tipoComprobanteDestino = "CPE"; //this.TipoComprobanteDestino = mz.erp.businessrules.tsy_TiposDeComprobantes.GetByPk(this.IdComprobanteDestino).Descripcion; if (item != null) { ItemComprobanteCompra itemCompra = new ItemComprobanteCompra(item, this._itemsComprobantesCompras); this._itemsComprobantesCompras.Add(itemCompra); } break; } case "EDIT": { tpu_ComprobantesExDataset.tpu_ComprobantesDataTable tableComp = this.DatasetComprobante.tpu_Comprobantes; tpu_ComprobantesExDataset.tpu_ComprobantesRow rowComp = (tpu_ComprobantesExDataset.tpu_ComprobantesRow)tableComp.Rows[0]; this.IdComprobante = rowComp.IdComprobante; this.IdComprobanteDestino = rowComp.IdComprobante; this.IdResponsable = rowComp.IdResponsable; this.FechaComprobante = rowComp.Fecha; this.TipoComprobanteDestino = rowComp.IdTipoDeComprobante; this.IdProveedor = rowComp.IdProveedor; this.Total = rowComp.Total; this._itemsComprobantesCompras = new ItemsComprobantesCompra("New", this); ItemComprobanteCompra itemCompra; tpu_ComprobantesExDataset.tpu_ComprobantesDetDataTable tableDet = this.DatasetComprobante.tpu_ComprobantesDet; foreach (tpu_ComprobantesExDataset.tpu_ComprobantesDetRow rowDet in tableDet.Rows) { itemCompra = new ItemComprobanteCompra(rowDet, this._itemsComprobantesCompras); this._itemsComprobantesCompras.Add(itemCompra); } if (item != null) { if (!this._itemsComprobantesCompras.Contains(item)) { itemCompra = new ItemComprobanteCompra(item, this._itemsComprobantesCompras); this._itemsComprobantesCompras.Add(itemCompra); } } break; } } }
/// <summary> /// Sobrecargado. Elimina un item de la coleccion /// </summary> /// <param name="item"></param> public virtual void Remove(ItemComprobanteCompra item) { Remove((object)item); }