Beispiel #1
0
        public static DialogResult ValidateAllocation(Payment payment, decimal deallocated, IEnumerable <ITransactionPayment> transactionPayments = null)
        {
            switch (payment.EMedioPago)
            {
            case EMedioPago.CompensacionFactura:
            {
                decimal importe = 0;

                foreach (ITransactionPayment item in transactionPayments ?? new List <ITransactionPayment>())
                {
                    if (item.Vinculado == Library.Store.Resources.Labels.RESET_PAGO)
                    {
                        importe += item.Asignado;
                    }
                }

                if (importe != 0)
                {
                    ProgressInfoMng.ShowInfo(Resources.Messages.IMPORTE_PAGO_COMPENSACION);
                    return(DialogResult.Ignore);
                }
            }
            break;

            default:
            {
                if (payment.Pendiente == 0)
                {
                    return(DialogResult.OK);
                }

                if (payment.Importe < 0)
                {
                    if (deallocated < payment.Pendiente)
                    {
                        ProgressInfoMng.ShowInfo(string.Format(Resources.Messages.PAYMENT_LESS_ALLOCATION, deallocated, payment.Pendiente));
                        return(DialogResult.Ignore);
                    }
                }
                else
                {
                    if (deallocated > payment.Pendiente)
                    {
                        ProgressInfoMng.ShowInfo(string.Format(Resources.Messages.PAYMENT_BIGGER_ALLOCATION, deallocated, payment.Pendiente));
                        return(DialogResult.Ignore);
                    }
                }
            }
            break;
            }

            return(DialogResult.OK);
        }
        private void SetDestinationCompany(CompanyInfo source)
        {
            if (source.Oid == AppContext.ActiveSchema.Oid)
            {
                ProgressInfoMng.ShowInfo(Library.Invoice.Resources.Messages.EXPORTING_COMPANY_EQUALS);
                return;
            }

            _destination_company = source;

            Company_TB.Text = (_destination_company != null) ? _destination_company.Name : string.Empty;

            _config.DestinationCompany = _destination_company;
        }
        protected override void SelectLineExpedientAction()
        {
            if (_entity.EHolderType == ETipoEntidad.WorkReport)
            {
                return;
            }

            if (Lines_BS.Current == null)
            {
                return;
            }

            OutputDeliveryLine item = Lines_BS.Current as OutputDeliveryLine;

            if (item.OidPartida != 0)
            {
                ProgressInfoMng.ShowInfo(Resources.Messages.DELIVERY_LINE_EXPEDIENT_WARNING);
                return;
            }

            ExpedienteList expedientes = ExpedienteList.GetListByStockProducto(item.GetInfo(false));

            ExpedienteSelectForm form = new ExpedienteSelectForm(this, expedientes);

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ExpedientInfo source = (ExpedientInfo)form.Selected;

                if (source.StockKilos < item.CantidadKilos)
                {
                    PgMng.ShowErrorException(Resources.Messages.STOCK_INSUFICIENTE + " " + source.StockKilos.ToString());
                    return;
                }

                item.OidExpediente = source.Oid;
                item.Expediente    = source.Codigo;

                AddCacheItem(source);
            }
        }
        private void SelectProviderAction(ESchema schemaType)
        {
            if (schemaType == ESchema.Source)
            {
                ProviderSelectForm form = new ProviderSelectForm(this, EEstado.Active);

                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    _source_provider          = form.Selected as IAcreedorInfo;
                    DestinationHolder_TB.Text = _source_provider.Nombre;
                }
            }
            else
            {
                if (_destination_company == null)
                {
                    ProgressInfoMng.ShowInfo(Resources.Messages.NO_COMPANY_SELECTED);
                    return;
                }

                _source_company = AppContext.ActiveSchema as CompanyInfo;

                AppContext.Principal.ChangeUserSchema(_destination_company);

                ProviderSelectForm form = new ProviderSelectForm(this, EEstado.Active);

                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    _destination_provider     = form.Selected as IAcreedorInfo;
                    DestinationHolder_TB.Text = _destination_provider.Nombre;

                    _config.DestinationHolder = _destination_provider;
                }

                AppContext.Principal.ChangeUserSchema(_source_company);
            }
        }
        protected void SelectClientAction(ESchema schemaType)
        {
            if (schemaType == ESchema.Source)
            {
                ClientSelectForm form = new ClientSelectForm(this, EEstado.Active);

                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    SetSourceClient(form.Selected as ClienteInfo);
                }
            }
            else
            {
                if (_destination_company == null)
                {
                    ProgressInfoMng.ShowInfo(Resources.Messages.NO_COMPANY_SELECTED);
                    return;
                }

                _source_company = AppContext.ActiveSchema as CompanyInfo;

                AppContext.Principal.ChangeUserSchema(_destination_company);

                ClientSelectForm form = new ClientSelectForm(this, EEstado.Active);

                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    _destination_client       = form.Selected as ClienteInfo;
                    DestinationHolder_TB.Text = _destination_client.Nombre;

                    _config.DestinationHolder = _destination_client;
                }

                AppContext.Principal.ChangeUserSchema(_source_company);
            }
        }
        protected override void SubmitAction()
        {
            if (!GetSettings())
            {
                _action_result = DialogResult.Ignore;
                return;
            }

            PgMng.Reset(12, 1, Resources.Messages.INICIANDO_EXPORTACION, this);

            try
            {
                _exporter = ExporterMng.GetExporter(_config);

                PgMng.Grow();
                if (SourceOutDelivery_RB.Checked)
                {
                    PgMng.Grow(Resources.Messages.EXPORTING_OUTPUT_DELIVERIES);
                    _exporter.Export();
                }

                PgMng.Grow();
                if (SourceOutInvoice_RB.Checked)
                {
                    PgMng.Grow(Resources.Messages.EXPORTING_OUTPUT_INVOICES);
                    _exporter.Export();
                }

                _exporter.Close();

                PgMng.FillUp();

                ProgressInfoMng.ShowInfo(Resources.Messages.EXPORTACION_SUCCESS);

                /*if (ProgressInfoMng.ShowQuestion(Resources.Messages.EXPORTACION_SUCCESS) == DialogResult.Yes)
                 * {
                 *      RegistroViewForm form = new RegistroViewForm(_exporter.Registry.Oid, this);
                 *      form.ShowDialog(this);
                 * }	*/

                _action_result = DialogResult.OK;
            }
            catch (iQException ex)
            {
                PgMng.FillUp();
                PgMng.ShowInfoException(ex);

                _exporter.Close();
                _action_result = DialogResult.Ignore;

                if (ex.Args != null)
                {
                    OpenForm((ETipoEntidad)ex.Args[0], (long)ex.Args[1]);
                }
            }
            catch (Exception ex)
            {
                PgMng.FillUp();
                PgMng.ShowInfoException(ex);

                _exporter.Close();
                _action_result = DialogResult.Ignore;
            }
        }