Exemplo n.º 1
0
        private void Facturas_DGW_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (Facturas_DGW.CurrentRow == null)
            {
                return;
            }
            if (e.ColumnIndex == -1)
            {
                return;
            }

            if (Facturas_DGW.Columns[e.ColumnIndex].Name == Asociar.Name)
            {
                DataGridViewRow  row  = Facturas_DGW.CurrentRow;
                LineaFomentoInfo item = row.DataBoundItem as LineaFomentoInfo;

                if (row.Cells[Asociar.Index].Value.ToString() == Library.Invoice.Resources.Labels.SET_COBRO)
                {
                    VinculaFacturaAction(row);
                }
                else
                {
                    DesvinculaFacturaAction(row);
                }

                SetUnlinkedGridValues(Facturas_DGW.Name);
                SetGridColors(Facturas_DGW);
            }
        }
        protected virtual void VerPendienteAction()
        {
            if (Pendientes_DGW.CurrentRow == null)
            {
                return;
            }

            LineaFomentoInfo linea = Pendientes_DGW.CurrentRow.DataBoundItem as LineaFomentoInfo;

            switch (linea.ETipoExpediente)
            {
            case ETipoExpediente.Alimentacion:
            case ETipoExpediente.Ganado:
            case ETipoExpediente.Maquinaria:
                ContenedorViewForm cform = new ContenedorViewForm(linea.OidExpediente, this);
                cform.ShowDialog(this);
                break;

            case ETipoExpediente.Almacen:
                ExpedienteAlmacenViewForm eform = new ExpedienteAlmacenViewForm(linea.OidExpediente, this);
                eform.ShowDialog(this);
                break;

            case ETipoExpediente.Work:
                WorkViewForm oform = new WorkViewForm(linea.OidExpediente, this);
                oform.ShowDialog(this);
                break;
            }
        }
Exemplo n.º 3
0
        protected override void UpdateFacturasCobro()
        {
            if (Datos_Cobros.Current == null)
            {
                Datos_LineasCobro.DataSource = null;
                return;
            }

            ChargeInfo cobro = (ChargeInfo)Datos_Cobros.Current;

            List <LineaFomentoInfo> lista = new List <LineaFomentoInfo>();

            foreach (CobroREAInfo cf in cobro.CobroREAs)
            {
                LineaFomentoInfo info = _facturas_cliente.GetItem(cf.OidExpedienteREA);
                if (info != null)
                {
                    lista.Add(info);
                }
            }

            Datos_LineasCobro.DataSource = LineaFomentoList.GetChildList(lista);

            SetUnlinkedGridValues(LineasFomento_DGW.Name);
        }
Exemplo n.º 4
0
        protected void MarkAsActiva(DataGridViewRow row)
        {
            LineaFomentoInfo item = row.DataBoundItem as LineaFomentoInfo;

            item.Vinculado = Library.Invoice.Resources.Labels.SET_COBRO;
            row.Cells[Asignacion.Index].Style.BackColor = row.Cells[Subvencion.Index].Style.BackColor;
        }
Exemplo n.º 5
0
        protected override void EditarImporteAction(DataGridViewRow row)
        {
            InputDecimalForm form = new InputDecimalForm();

            form.Message = Resources.Labels.IMPORTE_COBRO;

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                LineaFomentoInfo item = row.DataBoundItem as LineaFomentoInfo;

                _no_asignado += item.Asignado;

                CobroFactura cobro = _entity.CobroFacturas.GetItemByFactura(item.Oid);
                if (cobro != null)
                {
                    cobro.Cantidad = 0;
                }
                item.ImporteCobrado -= item.Asignado;
                item.Pendiente      += item.Asignado;

                item.Asignado = form.Value;
                VinculaFacturaAction(row, true);
                SetUnlinkedGridValues(Facturas_DGW.Name);
                Datos_Facturas.ResetBindings(false);
                SetGridColors(Facturas_DGW);
            }
        }
Exemplo n.º 6
0
 public virtual void CopyFrom(Charge cobro, LineaFomentoInfo linea)
 {
     OidCobro         = cobro.Oid;
     OidExpediente    = linea.OidExpediente;
     OidExpedienteREA = linea.Oid;
     CodigoExpediente = linea.IDExpediente;
     Cantidad         = linea.Asignado;
     FechaAsignacion  = DateTime.Now;
 }
Exemplo n.º 7
0
        protected override void SetRowFormat(DataGridViewRow row)
        {
            if (row.IsNewRow)
            {
                return;
            }

            LineaFomentoInfo item = (LineaFomentoInfo)row.DataBoundItem;

            Face.Common.ControlTools.Instance.SetRowColor(row, item.EEstado);
        }
Exemplo n.º 8
0
        public static CobroREA NewChild(Charge parent, LineaFomentoInfo linea)
        {
            if (!CanAddObject())
            {
                throw new System.Security.SecurityException(Library.Resources.Messages.USER_NOT_ALLOWED);
            }

            CobroREA obj = new CobroREA();

            obj.CopyFrom(parent, linea);

            return(obj);
        }
        protected override void SetFomentoFormat()
        {
            foreach (DataGridViewRow row in Fomento_DGW.Rows)
            {
                if (row.IsNewRow)
                {
                    return;
                }

                LineaFomentoInfo item = (LineaFomentoInfo)row.DataBoundItem;
                Face.Common.ControlTools.Instance.SetRowColor(row, item.EEstado);

                SetRowFormat(row, "FechaSolicitudLFomento", item.FechaSolicitud);
            }
        }
        protected virtual void PrintPendienteAction()
        {
            if (Pendientes_DGW.CurrentRow == null)
            {
                return;
            }

            LineaFomentoInfo linea = Pendientes_DGW.CurrentRow.DataBoundItem as LineaFomentoInfo;

            PgMng.Reset(6, 1, Face.Resources.Messages.RETRIEVING_DATA, this);

            ExpedientReportMng reportMng = new ExpedientReportMng(AppContext.ActiveSchema, this.Text, string.Empty);

            ReportClass report = reportMng.GetLineaFomentoListReport(Datos_LineasPendientes.DataSource as LineaFomentoList);

            PgMng.FillUp();

            ShowReport(report);
        }
Exemplo n.º 11
0
        protected override void DesvinculaFacturaAction(DataGridViewRow row)
        {
            if (row == null)
            {
                return;
            }

            LineaFomentoInfo item = row.DataBoundItem as LineaFomentoInfo;

            item.Asignado = 0;

            CobroREA cobro = Entity.CobroREAs.GetItemByExpedienteREA(item.Oid);

            if (cobro != null)
            {
                _entity.CobroREAs.Remove(cobro);
            }

            UpdateAsignado();

            MarkAsActiva(row);
        }
Exemplo n.º 12
0
        protected void ApportionAction(DataGridViewRow row, decimal totalSolicitado)
        {
            if (row == null)
            {
                return;
            }

            LineaFomentoInfo item = row.DataBoundItem as LineaFomentoInfo;

            if (item == null)
            {
                return;
            }

            item.Cobrado = true;

            decimal proportion = (_entity.Importe != 0)
                                                                                ? _entity.Importe * (item.Pendiente * 100 / totalSolicitado) / 100
                                                                                : 0;

            //Cobros en positivo
            if (_entity.Importe >= 0)
            {
                if (proportion <= NoAsignado)
                {
                    item.Asignado = proportion;
                }
                else
                {
                    item.Asignado = NoAsignado;
                }
            }
            //Cobros en negativo. Abonos
            else
            {
                if (proportion >= NoAsignado)
                {
                    item.Asignado = proportion;
                }
                else
                {
                    item.Asignado = NoAsignado;
                }
            }

            CobroREA cobro = _entity.CobroREAs.GetItemByExpedienteREA(item.Oid);

            if (cobro == null)
            {
                cobro = _entity.CobroREAs.NewItem(_entity, item);
                item.FechaAsignacion = DateTime.Now.ToShortDateString();
            }
            else
            {
                cobro.CopyFrom(_entity, item);
                item.FechaAsignacion = DateTime.Now.ToShortDateString();
            }

            UpdateAsignado();

            MarkAsNoActiva(row);
        }
Exemplo n.º 13
0
        protected void VinculaFacturaAction(DataGridViewRow row, bool inputValue)
        {
            if (row == null)
            {
                return;
            }

            //if (NoAsignado == 0)
            //{
            //    DesvinculaFacturaAction(row);
            //    return;
            //}

            LineaFomentoInfo item = row.DataBoundItem as LineaFomentoInfo;

            if (item == null)
            {
                return;
            }

            item.Cobrado = true;

            //Se le ha asignado algo a mano
            if (item.Asignado != 0 || inputValue)
            {
                //Cobros en positivo
                if (_entity.Importe >= 0)
                {
                    if (item.Asignado > NoAsignado)
                    {
                        item.Asignado = NoAsignado;
                    }
                    //if (item.Asignado > item.Pendiente) item.Asignado = item.Pendiente;
                }
                //Cobros en negativo. Abonos
                else
                {
                    if (item.Asignado < NoAsignado)
                    {
                        item.Asignado = NoAsignado;
                    }
                    if (item.Asignado < item.Pendiente)
                    {
                        item.Asignado = item.Pendiente;
                    }
                }
            }
            else
            {
                //Cobros en positivo
                if (_entity.Importe >= 0)
                {
                    if (item.Pendiente <= NoAsignado)
                    {
                        item.Asignado = item.Pendiente;
                    }
                    else
                    {
                        item.Asignado = NoAsignado;
                    }
                }
                //Cobros en negativo. Abonos
                else
                {
                    if (item.Pendiente >= NoAsignado)
                    {
                        item.Asignado = item.Pendiente;
                    }
                    else
                    {
                        item.Asignado = NoAsignado;
                    }
                }
            }

            CobroREA cobro = _entity.CobroREAs.GetItemByExpedienteREA(item.Oid);

            if (cobro == null)
            {
                cobro = _entity.CobroREAs.NewItem(_entity, item);
                item.FechaAsignacion = DateTime.Now.ToShortDateString();
            }
            else
            {
                cobro.CopyFrom(_entity, item);
                item.FechaAsignacion = DateTime.Now.ToShortDateString();
            }

            UpdateAsignado();

            MarkAsNoActiva(row);
        }
 protected virtual void BuildFomentoGrantAccountingEntry(LineaFomentoInfo linea, LineaRegistro lr)
 {
     throw new iQImplementationException("ContabilidadExporterBase::BuildFomentoGrantAccountingEntry");
 }
Exemplo n.º 15
0
 protected override void GetFormSourceData(long oid)
 {
     _entity  = LineaFomentoInfo.Get(oid);
     _mf_type = ManagerFormType.MFView;
 }
Exemplo n.º 16
0
 public CobroREA NewItem(Charge parent, LineaFomentoInfo line)
 {
     this.AddItem(CobroREA.NewChild(parent, line));
     return(this[Count - 1]);
 }