Ejemplo n.º 1
0
        protected override void UpdateFacturasCobro()
        {
            if (Datos_Cobros.Current == null)
            {
                Datos_Facturas.DataSource = null;
                return;
            }

            ChargeInfo cobro = (ChargeInfo)Datos_Cobros.Current;

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

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

            Datos_Facturas.DataSource = FacREAList.GetList(lista);

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

            FacREAInfo factura = Pendientes_DGW.CurrentRow.DataBoundItem as FacREAInfo;

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

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

            case (long)ETipoExpediente.Work:
                WorkViewForm oform = new WorkViewForm(factura.OidExpediente, this);
                oform.ShowDialog(this);
                break;
            }
        }
Ejemplo n.º 3
0
        protected override void EditarImporteAction(DataGridViewRow row)
        {
            InputDecimalForm form = new InputDecimalForm();

            form.Message = Resources.Labels.IMPORTE_COBRO;

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

                _no_asignado += item.Asignado;

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

                item.Asignado = form.Value;
                VinculaFacturaAction(row);
                SetUnlinkedGridValues(Facturas_DGW.Name);
                Datos_Facturas.ResetBindings(false);
                SetGridColors(Facturas_DGW);
            }
        }
Ejemplo n.º 4
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;
                FacREAInfo      item = row.DataBoundItem as FacREAInfo;

                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);
            }
        }
Ejemplo n.º 5
0
        protected void MarkAsActiva(DataGridViewRow row)
        {
            FacREAInfo item = row.DataBoundItem as FacREAInfo;

            item.Vinculado = Library.Invoice.Resources.Labels.SET_COBRO;
            row.Cells[Asignacion.Index].Style.BackColor = row.Cells[Pendiente.Index].Style.BackColor;
        }
        protected virtual void PrintPendienteAction()
        {
            if (Pendientes_DGW.CurrentRow == null)
            {
                return;
            }

            FacREAInfo factura = Pendientes_DGW.CurrentRow.DataBoundItem as FacREAInfo;

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

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

            ReportClass report = reportMng.GetExpedienteREAListReport(ExpedienteREAList.GetList());

            PgMng.FillUp();

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

            FacREAInfo item = row.DataBoundItem as FacREAInfo;

            item.Asignado = 0;

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

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

            UpdateAsignado();

            MarkAsActiva(row);
        }
Ejemplo n.º 8
0
        protected override void VinculaFacturaAction(DataGridViewRow row)
        {
            if (row == null)
            {
                return;
            }

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

            FacREAInfo item = row.DataBoundItem as FacREAInfo;

            if (item == null)
            {
                return;
            }

            //Se le ha asignado algo a mano
            if (item.Asignado != 0)
            {
                //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.OidExpedienteREA);

            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);
        }