Ejemplo n.º 1
0
 public DetalleAlbaranesActionForm(bool IsModal, OutputDeliveryList list)
     : base(IsModal)
 {
     this.InitializeComponent();
     base.SetFormData();
     this.Text   = "Informe: Detalle de Albaranes";
     this._lista = list;
 }
Ejemplo n.º 2
0
        public DeliverySelectForm(Form parent, ETipoEntidad holderType, OutputDeliveryList list)
            : base(true, parent, holderType, ETipoAlbaranes.Todos, list)
        {
            InitializeComponent();
            _view_mode = molView.Select;

            _action_result = DialogResult.Cancel;
        }
        public override void PrintList()
        {
            DetalleAlbaranesActionForm form = new DetalleAlbaranesActionForm(OutputDeliveryList.GetList(Datos.DataSource as IList <OutputDeliveryInfo>));

            form.Titulo = this.Text;
            form.Filtro = this.FilterValues;
            form.DoSubmit();
            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>);
            }
        }
Ejemplo n.º 5
0
        public static OutputDeliveryListViewModel Get(OutputDeliveryList sourceList)
        {
            OutputDeliveryListViewModel list = new OutputDeliveryListViewModel();

            foreach (OutputDeliveryInfo item in sourceList)
            {
                list.Add(OutputDeliveryViewModel.New(item));
            }

            return(list);
        }
Ejemplo n.º 6
0
        public static OutputDeliveryListViewModel Get()
        {
            OutputDeliveryListViewModel list = new OutputDeliveryListViewModel();

            OutputDeliveryList sourceList = OutputDeliveryList.GetList(ETipoEntidad.Cliente);

            foreach (OutputDeliveryInfo item in sourceList)
            {
                list.Add(OutputDeliveryViewModel.New(item));
            }

            return(list);
        }
Ejemplo n.º 7
0
        protected override void RefreshMainData()
        {
            Datos.DataSource          = _entity;
            _albaranes_factura        = _entity.AlbaranTickets.Clone();
            _conceptos_factura        = _entity.ConceptoTickets.Clone();
            Datos_Concepto.DataSource = _entity.ConceptoTickets;
            PgMng.Grow();

            _albaranes = OutputDeliveryList.GetListByTicket(true, _entity.Oid).GetListInfo();
            PgMng.Grow();

            Fecha_DTP.Value = _entity.Fecha;

            base.RefreshMainData();
        }
Ejemplo n.º 8
0
        protected void PrintDetail(OutputDeliveryList lista)
        {
            PgMng.Reset(4, 1, Face.Resources.Messages.LOADING_DATA, this);

            ClienteList clientes = ClienteList.GetList(false);

            PgMng.Grow();

            OutputDeliveryReportMng rptMng = new OutputDeliveryReportMng(AppContext.ActiveSchema, this.Text, string.Empty);
            ReportClass             report = rptMng.GetDetailListReport(lista, clientes, this._tipo, this.FInicial_DTP.Value, this.FFinal_DTP.Value);

            PgMng.FillUp();

            ShowReport(report);
        }
Ejemplo n.º 9
0
        protected override void SubmitAction()
        {
            _tipo = (ETipoAlbaranes)Enum.Parse(typeof(ETipoAlbaranes), this.TipoAlbaran_CB.Text);
            long serie = TodosSerie_CkB.Checked ? 0 : _serie.Oid;
            OutputDeliveryList lista = null;

            switch (this._tipo)
            {
            case ETipoAlbaranes.Todos:
            case ETipoAlbaranes.Lista:
                lista = OutputDeliveryList.GetList(true, 0, ETipoEntidad.Cliente, serie, this.FInicial_DTP.Value, this.FFinal_DTP.Value);
                break;

            case ETipoAlbaranes.Facturados:
                lista = OutputDeliveryList.GetFacturados(true, 0, serie, this.FInicial_DTP.Value, this.FFinal_DTP.Value);
                break;

            case ETipoAlbaranes.NoFacturados:
                lista = OutputDeliveryList.GetNoFacturados(true, 0, serie, this.FInicial_DTP.Value, this.FFinal_DTP.Value);
                break;

            case ETipoAlbaranes.Agrupados:
                lista = OutputDeliveryList.GetNoFacturadosAgrupados(serie, this.FInicial_DTP.Value, this.FFinal_DTP.Value, true);
                break;
            }

            if (this.Listado_RB.Checked)
            {
                if (this.Detallado_RB.Checked)
                {
                    this.PrintDetail(this._lista);
                }
                else
                {
                    this.PrintList(this._lista);
                }
            }
            else if (this.Detallado_RB.Checked)
            {
                this.PrintDetail(lista);
            }
            else
            {
                this.PrintList(lista);
            }

            _action_result = DialogResult.OK;
        }
Ejemplo n.º 10
0
        protected void PrintList(OutputDeliveryList lista)
        {
            PgMng.Reset(4, 1, Face.Resources.Messages.LOADING_DATA, this);

            ClienteList clientes = ClienteList.GetList(false);

            PgMng.Grow();

            OutputDeliveryReportMng rptMng = new OutputDeliveryReportMng(AppContext.ActiveSchema, Titulo, Filtro);

            ReportClass report = rptMng.GetListReport(lista, clientes);

            PgMng.FillUp();

            ShowReport(report);
        }
        protected override void RefreshMainData()
        {
            Datos.DataSource   = _entity;
            _albaranes_factura = _entity.AlbaranFacturas.Clone();
            _conceptos_factura = _entity.Conceptos.Clone();

            Lines_BS.DataSource = _entity.Conceptos;
            PgMng.Grow();

            _out_deliveries = OutputDeliveryList.GetListByFactura(true, _entity.Oid).GetListInfo();
            PgMng.Grow();

            Fecha_DTP.Value = _entity.Fecha;

            base.RefreshMainData();
        }
        public override void PrintList()
        {
            PgMng.Reset(4, 1, Face.Resources.Messages.LOADING_DATA, this);

            OutputDeliveryReportMng reportMng = new OutputDeliveryReportMng(AppContext.ActiveSchema, this.Text, this.FilterValues);

            PgMng.Grow(Face.Resources.Messages.BUILDING_REPORT);

            ExpedienteList work = ExpedienteList.GetList(ETipoExpediente.Work, false);

            PgMng.Grow();

            ReportClass report = reportMng.GetWorkDeliveryList(OutputDeliveryList.GetList(Datos.DataSource as IList <OutputDeliveryInfo>),
                                                               work);

            PgMng.FillUp();

            ShowReport(report);
        }
        public DeliveryMngForm(bool isModal, Form parent, ETipoEntidad holderType, ETipoAlbaranes tipo, OutputDeliveryList lista)
            : base(isModal, parent, lista)
        {
            InitializeComponent();

            SetView(molView.Normal);

            // Parche para poder abrir el formulario en modo diseño y no perder la configuracion de columnas
            DatosLocal_BS    = Datos;
            Tabla.DataSource = DatosLocal_BS;

            SetMainDataGridView(Tabla);
            Datos.DataSource = OutputDeliveryList.NewList().GetSortedList();
            SortProperty     = Fecha.DataPropertyName;
            SortDirection    = ListSortDirection.Descending;

            _holder_type   = holderType;
            _delivery_type = tipo;
        }
        public override void UpdateList()
        {
            switch (_current_action)
            {
            case molAction.Add:
            case molAction.Copy:
                if (_entity == null)
                {
                    return;
                }
                if (List.GetItem(_entity.Oid) != null)
                {
                    return;
                }
                List.AddItem(_entity.GetInfo(false));
                if (FilterType == IFilterType.Filter)
                {
                    OutputDeliveryList listA = OutputDeliveryList.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 <OutputDeliveryInfo> entities = (List <OutputDeliveryInfo>)_selected;
                    foreach (OutputDeliveryInfo item in entities)
                    {
                        List.GetItem(item.Oid).CopyFrom(item);
                        if (FilterType == IFilterType.Filter)
                        {
                            OutputDeliveryList list   = OutputDeliveryList.GetList(_filter_results);
                            OutputDeliveryInfo 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)
                {
                    OutputDeliveryList listD = OutputDeliveryList.GetList(_filter_results);
                    listD.RemoveItem(ActiveOID);
                    _filter_results = listD.GetSortedList();
                }
                break;
            }

            RefreshSources();
            if (_entity != null)
            {
                Select(_entity.Oid);
            }
            _entity = null;
        }
Ejemplo n.º 15
0
        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);
        }
Ejemplo n.º 16
0
 public DetalleAlbaranesActionForm(OutputDeliveryList list)
     : this(true, list)
 {
 }
        protected override void RefreshMainData()
        {
            PgMng.Grow(string.Empty, "OutputDelivery");

            _selectedOid = ActiveOID;

            switch (DataType)
            {
            case EntityMngFormTypeData.Default:

                switch (_delivery_type)
                {
                case ETipoAlbaranes.Todos:

                    if (Library.Common.ModulePrincipal.GetUseActiveYear())
                    {
                        List = OutputDeliveryList.GetList(false, _holder_type, Library.Common.ModulePrincipal.GetActiveYear().Year);
                    }
                    else
                    {
                        List = OutputDeliveryList.GetList(false, _holder_type);
                    }
                    break;

                case ETipoAlbaranes.Facturados:

                    if (Library.Common.ModulePrincipal.GetUseActiveYear())
                    {
                        List = OutputDeliveryList.GetFacturados(false, Library.Common.ModulePrincipal.GetActiveYear().Year);
                    }
                    else
                    {
                        List = OutputDeliveryList.GetFacturados(false);
                    }
                    break;

                case ETipoAlbaranes.NoFacturados:

                    if (Library.Common.ModulePrincipal.GetUseActiveYear())
                    {
                        List = OutputDeliveryList.GetNoFacturados(true, _oid_client, _oid_serie, Library.Common.ModulePrincipal.GetActiveYear().Year);
                    }
                    else
                    {
                        List = OutputDeliveryList.GetNoFacturados(true, _oid_client, _oid_serie);
                    }
                    break;

                case ETipoAlbaranes.Agrupados:

                    if (Library.Common.ModulePrincipal.GetUseActiveYear())
                    {
                        List = OutputDeliveryList.GetAgrupados(false, Library.Common.ModulePrincipal.GetActiveYear().Year);
                    }
                    else
                    {
                        List = OutputDeliveryList.GetAgrupados(false);
                    }
                    break;

                case ETipoAlbaranes.Work:

                    if (Library.Common.ModulePrincipal.GetUseActiveYear())
                    {
                        List = OutputDeliveryList.GetWorkList(false, Library.Common.ModulePrincipal.GetActiveYear().Year);
                    }
                    else
                    {
                        List = OutputDeliveryList.GetWorkList(false);
                    }
                    break;
                }
                break;

            case EntityMngFormTypeData.ByParameter:
                _sorted_list = List.GetSortedList();
                break;
            }
            PgMng.Grow(string.Empty, "Lista de Albaranes");
        }
        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);
        }
        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);
        }
        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();
                }
            }
        }