コード例 #1
0
        private void Init(string action, RelacionesComprobanteDeCompraOrigenDestino relaciones)
        {
            switch (action.ToUpper())
            {
            case "NEW":
                break;

            case "EDIT":
                break;

            case "STEP":
                FillStepData(relaciones);
                break;
            }
        }
コード例 #2
0
        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;
        }
コード例 #3
0
        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;
            }
            }
        }
コード例 #4
0
        private void FillLoadData(ItemComprobante item, string TipoDeComprobanteDestino, RelacionesComprobanteDeCompraOrigenDestino relaciones)
        {
            //Tomar el XML con lo guardado
            switch (this._state)
            {
            case "NEW":
            {
                DatasetComprobante = new tpu_ComprobantesExDataset();
                try
                {
                    DatasetComprobante.ReadXml(mz.erp.systemframework.Util.ResourcePath() + "/temp/pedido" + Security.IdUsuario + ".xml");
                    FillStaticData("EDIT", item, null, null);
                }
                catch (Exception e)
                {
                    DatasetComprobante = mz.erp.businessrules.tpu_ComprobantesEx.NewDataSet();
                    FillStaticData("NEW", item, null, null);
                }



                break;
            }

            case "STEP":
            {
                this.DatasetComprobante = new mz.erp.commontypes.data.tpu_ComprobantesExDataset();

                this.IdResponsable = relaciones.IdResponsable;


                this.IdProveedor = relaciones.IdProveedor;

                this.TipoComprobanteDestino = TipoDeComprobanteDestino;

                this.FechaComprobante = System.DateTime.Now;
                this.IdComprobante    = Util.NewStringId();

                this.Numero = string.Empty;
                this.Items  = new ItemsComprobantesCompra("STEP", this, relaciones);
                this.Total  = 0;
                break;
                break;
            }
            }
            SetEditablesProperty();
        }
コード例 #5
0
        private void Init(string Action, ItemComprobante item, string momento, string idTipoDeComprobanteDestino, RelacionesComprobanteDeCompraOrigenDestino relaciones)
        {
            this.Momento = momento;
            switch (Action.ToUpper())
            {
            case "NEW":
            {
                this._state = "NEW";
                FillLoadData(item, null, null);
                break;
            }

            case "STEP":
            {
                this._state = "STEP";
                FillLoadData(null, idTipoDeComprobanteDestino, relaciones);
                break;
            }
            }
        }
コード例 #6
0
 public ComprobanteDeCompra(string action, ItemComprobante item, string momento, string idTipoComprobanteDestino, RelacionesComprobanteDeCompraOrigenDestino relaciones)
 {
     Init(action, item, momento, idTipoComprobanteDestino, relaciones);
 }
コード例 #7
0
 public ItemsComprobantesCompra(string action, ComprobanteDeCompra parent, RelacionesComprobanteDeCompraOrigenDestino relaciones)
 {
     this._parent = parent;
     Init(action, relaciones);
 }