protected void SetTipo()
        {
            CashLine item = Lines_DGW.CurrentRow.DataBoundItem as CashLine;

            SelectEnumInputForm form = new SelectEnumInputForm(true);

            if (_linea_libre)
            {
                ETipoLineaCaja[] list = { ETipoLineaCaja.SalidaPorIngreso, ETipoLineaCaja.EntradaPorTraspaso, ETipoLineaCaja.EntradaPorTarjetaCredito, ETipoLineaCaja.Otros };
                form.SetDataSource(Library.Invoice.EnumText <ETipoLineaCaja> .GetList(list));
            }
            else
            {
                ETipoLineaCaja[] list = { ETipoLineaCaja.SalidaPorIngreso, ETipoLineaCaja.EntradaPorTraspaso, ETipoLineaCaja.EntradaPorTarjetaCredito };
                form.SetDataSource(Library.Invoice.EnumText <ETipoLineaCaja> .GetList(list));
            }

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ComboBoxSource tipo = form.Selected as ComboBoxSource;
                item.ETipoLinea = (ETipoLineaCaja)tipo.Oid;

                SetRowFormat(Lines_DGW.CurrentRow);

                Lines_BS.ResetBindings(false);
            }
        }
Example #2
0
        protected virtual void SetChargeStatusAction()
        {
            EEstado[] estados = new EEstado[3] {
                EEstado.Pendiente, EEstado.Charged, EEstado.Devuelto
            };

            SelectEnumInputForm form = new SelectEnumInputForm(true);

            form.SetDataSource(Library.Common.EnumText <EEstado> .GetList(estados));
            try
            {
                Datos.RaiseListChangedEvents = false;

                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    ComboBoxSource item = form.Selected as ComboBoxSource;

                    _entity.EstadoCobro = item.Oid;
                    EstadoCobro_TB.Text = _entity.EstadoCobroLabel;
                }
            }
            finally
            {
                Datos.RaiseListChangedEvents = true;
            }
        }
Example #3
0
        protected override void SetStatusAction()
        {
            if (!ControlsMng.IsCurrentItemValid(Payrolls_DGW))
            {
                return;
            }

            Payroll item = ControlsMng.GetCurrentItem(Payrolls_DGW) as Payroll;

            if (item.EEstado == moleQule.Base.EEstado.Anulado)
            {
                return;
            }
            if (item.EEstado == moleQule.Base.EEstado.Pagado)
            {
                return;
            }

            SelectEnumInputForm form = new SelectEnumInputForm(true);

            moleQule.Base.EEstado[] list = { moleQule.Base.EEstado.Abierto, moleQule.Base.EEstado.Contabilizado, moleQule.Base.EEstado.Anulado };
            form.SetDataSource(moleQule.Base.EnumText <moleQule.Base.EEstado> .GetList(list));

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ComboBoxSource estado = form.Selected as ComboBoxSource;

                ChangeState(item, (moleQule.Base.EEstado)estado.Oid);

                Payrolls_BS.ResetBindings(false);

                SetGridFormat();
            }
        }
Example #4
0
        protected virtual void SetPaymentStatusAction()
        {
            moleQule.Base.EEstado[] estados = new moleQule.Base.EEstado[3] {
                moleQule.Base.EEstado.Pendiente, moleQule.Base.EEstado.Pagado, moleQule.Base.EEstado.Devuelto
            };

            SelectEnumInputForm form = new SelectEnumInputForm(true);

            form.SetDataSource(moleQule.Base.EnumText <moleQule.Base.EEstado> .GetList(estados));

            try
            {
                Datos.RaiseListChangedEvents = false;

                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    ComboBoxSource item = form.Selected as ComboBoxSource;

                    _entity.EstadoPago    = item.Oid;
                    PaymentStatus_TB.Text = _entity.EstadoPagoLabel;
                }
            }
            finally
            {
                Datos.RaiseListChangedEvents = true;
            }
        }
Example #5
0
        private void Tipo_BT_Click(object sender, EventArgs e)
        {
            if (!_entity.CanChangeType())
            {
                return;
            }

            SelectEnumInputForm form = new SelectEnumInputForm(true);

            form.SetDataSource(moleQule.Store.Structs.EnumText <ETipoLineaLibroGanadero> .GetList(GetTypes()));

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ComboBoxSource estado = form.Selected as ComboBoxSource;
                _entity.Tipo = estado.Oid;
                Tipo_TB.Text = _entity.TipoLabel;

                switch (_entity.ETipo)
                {
                case ETipoLineaLibroGanadero.Nacimiento:
                    ChangeStateAction(moleQule.Base.EEstado.Alta);
                    break;

                case ETipoLineaLibroGanadero.Muerte:
                    ChangeStateAction(moleQule.Base.EEstado.Baja);
                    break;
                }
            }

            Status_BT.Enabled = _entity.ETipo == ETipoLineaLibroGanadero.TraspasoExplotacion;
        }
Example #6
0
        private void SetMedioPagoAction()
        {
            EMedioPago[]        list = { EMedioPago.Domiciliacion, EMedioPago.Ingreso, EMedioPago.Transferencia };
            SelectEnumInputForm form = new SelectEnumInputForm(true);

            form.SetDataSource(Library.Common.EnumText <EMedioPago> .GetList(list));

            try
            {
                Datos.RaiseListChangedEvents = false;

                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    ComboBoxSource item = form.Selected as ComboBoxSource;
                    _entity.MedioPago = item.Oid;
                    MedioPago_TB.Text = _entity.EMedioPagoLabel;

                    if (!Library.Common.EnumFunctions.NeedsCuentaBancaria(_entity.EMedioPago))
                    {
                        _entity.OidCuentaBancaria = 0;
                        _entity.CuentaBancaria    = string.Empty;
                        CuentaBancaria_TB.Text    = string.Empty;
                    }
                }
            }
            finally
            {
                Datos.RaiseListChangedEvents = true;
            }
        }
        protected override void SelectEstadoExpedienteREAAction()
        {
            if (ExpedienteREA_DGW.CurrentRow == null)
            {
                return;
            }

            REAExpedient item = (REAExpedient)ExpedienteREA_DGW.CurrentRow.DataBoundItem;

            SelectEnumInputForm form = new SelectEnumInputForm(true);

            moleQule.Base.EEstado[] list = { moleQule.Base.EEstado.Anulado, moleQule.Base.EEstado.Abierto, moleQule.Base.EEstado.Solicitado, moleQule.Base.EEstado.Aceptado, moleQule.Base.EEstado.Desestimado, moleQule.Base.EEstado.Charged };
            form.SetDataSource(moleQule.Base.EnumText <moleQule.Base.EEstado> .GetList(list));

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ComboBoxSource estado = form.Selected as ComboBoxSource;

                ChangeEstadoExpedienteREA(ExpedienteREA_DGW.CurrentRow, (moleQule.Base.EEstado)estado.Oid);

                ExpedienteREA_DGW.CurrentCell.Value = estado.Texto;

                SetExpedienteREAFormat();
            }
        }
        protected override void SelectEstadoLineaAction()
        {
            if (Lineas_DGW.CurrentRow.DataBoundItem == null)
            {
                return;
            }

            LineaPedido item = (LineaPedido)Lineas_DGW.CurrentRow.DataBoundItem;

            if (item == null)
            {
                return;
            }

            EEstado[] list = { EEstado.Anulado, EEstado.Abierto, EEstado.Solicitado, EEstado.Closed };

            SelectEnumInputForm form = new SelectEnumInputForm(true);

            form.SetDataSource(Library.Common.EnumText <EEstado> .GetList(list));

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ComboBoxSource estado = form.Selected as ComboBoxSource;

                item.Estado = estado.Oid;

                ControlsMng.UpdateBinding(Datos_Lineas);
            }
        }
        protected override void SelectTipoCuentaAction()
        {
            SelectEnumInputForm form = new SelectEnumInputForm(true);

            EBankLineType[] list = { EBankLineType.Manual, EBankLineType.Interes };
            form.SetDataSource(Library.Invoice.EnumText <EBankLineType> .GetList(list));

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ComboBoxSource tipo = form.Selected as ComboBoxSource;
                _entity.ETipoMovimientoBanco = ((EBankLineType)tipo.Oid);
            }
        }
        protected virtual void SelectEstadoAction()
        {
            SelectEnumInputForm form = new SelectEnumInputForm(true);

            EEstado[] list = { EEstado.Anulado, EEstado.Abierto };
            form.SetDataSource(Library.Common.EnumText <EEstado> .GetList(list));

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ComboBoxSource estado = form.Selected as ComboBoxSource;
                ChangeState((EEstado)estado.Oid);
            }
        }
        private void Estado_BT_Click(object sender, EventArgs e)
        {
            SelectEnumInputForm form = new SelectEnumInputForm(true);

            moleQule.Base.EEstado[] list = { moleQule.Base.EEstado.Active, moleQule.Base.EEstado.Baja };
            form.SetDataSource(moleQule.Base.EnumText <moleQule.Base.EEstado> .GetList(list));

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ComboBoxSource estado = form.Selected as ComboBoxSource;
                _entity.Estado = estado.Oid;
            }
        }
Example #12
0
        private void Sexo_BT_Click(object sender, EventArgs e)
        {
            SelectEnumInputForm form = new SelectEnumInputForm(true);

            form.SetDataSource(moleQule.Common.Structs.EnumText <ESexo> .GetList(false));

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ComboBoxSource sexo = form.Selected as ComboBoxSource;
                _entity.Sexo = sexo.Oid;
                Sexo_TB.Text = sexo.Texto;
            }
        }
        protected override void SelectTipoAction()
        {
            SelectEnumInputForm form = new SelectEnumInputForm(true);

            form.SetDataSource(Library.Instruction.EnumText <ETipoDiaNoLectivo> .GetList(false, false, false));

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ComboBoxSource tipo = form.Selected as ComboBoxSource;
                _entity.ETipo = (ETipoDiaNoLectivo)tipo.Oid;
                Tipo_TB.Text  = _entity.TipoLabel;
            }
        }
        protected void SetPayrollMethodAction()
        {
            SelectEnumInputForm form = new SelectEnumInputForm(true);

            form.SetDataSource(moleQule.Store.Structs.EnumText <EPayrollMethod> .GetList(false, false, false));

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ComboBoxSource payroll_method = form.Selected as ComboBoxSource;
                _entity.PayrollMethod = payroll_method.Oid;
                PayrollMethod_TB.Text = _entity.PayrollMethodLabel;
            }
        }
        protected virtual void SelectPrioridadPrecioAction()
        {
            SelectEnumInputForm form = new SelectEnumInputForm(true);

            form.SetDataSource(Library.Store.EnumText <EPrioridadPrecio> .GetList(false));

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ComboBoxSource tipo = form.Selected as ComboBoxSource;
                _entity.EPrioridadPrecio = (EPrioridadPrecio)tipo.Oid;
                PrioridadPrecio_TB.Text  = _entity.PrioridadPrecioLabel;
            }
        }
Example #16
0
        protected void SetEstadoAction()
        {
            SelectEnumInputForm form = new SelectEnumInputForm(true);

            moleQule.Base.EEstado[] list = { moleQule.Base.EEstado.Abierto, moleQule.Base.EEstado.Anulado, moleQule.Base.EEstado.Contabilizado, moleQule.Base.EEstado.Exportado };
            form.SetDataSource(moleQule.Base.EnumText <moleQule.Base.EEstado> .GetList(list));

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ComboBoxSource estado = form.Selected as ComboBoxSource;
                _entity.Estado = estado.Oid;
            }
        }
Example #17
0
        private void Status_BT_Click(object sender, EventArgs e)
        {
            SelectEnumInputForm form = new SelectEnumInputForm(true);

            EEstado[] list = { EEstado.Abierto, EEstado.Pagado };
            form.SetDataSource(Library.Common.EnumText <EEstado> .GetList(list));

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ComboBoxSource estado = form.Selected as ComboBoxSource;
                _entity.Estado = estado.Oid;
            }
        }
Example #18
0
        protected void SetCategoriaAction()
        {
            SelectEnumInputForm form = new SelectEnumInputForm(true);

            ECategoriaGasto[] list = { ECategoriaGasto.Administracion, ECategoriaGasto.Bancario, ECategoriaGasto.Impuesto, ECategoriaGasto.SeguroSocial, ECategoriaGasto.Otros };
            form.SetDataSource(moleQule.Store.Structs.EnumText <ECategoriaGasto> .GetList(list));

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ComboBoxSource categoria = form.Selected as ComboBoxSource;
                _entity.CategoriaGasto = categoria.Oid;
            }
        }
Example #19
0
        protected virtual void SelectStatusAction()
        {
            SelectEnumInputForm form = new SelectEnumInputForm(true);

            moleQule.Base.EEstado[] list = { moleQule.Base.EEstado.Active, moleQule.Base.EEstado.Baja };
            form.SetDataSource(moleQule.Base.EnumText <moleQule.Base.EEstado> .GetList(list));

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ComboBoxSource estado = form.Selected as ComboBoxSource;
                _entity.Status = estado.Oid;
            }
        }
Example #20
0
        protected void SetSaleMethodAction()
        {
            SelectEnumInputForm form = new SelectEnumInputForm(true);

            form.SetDataSource(moleQule.Common.Structs.EnumText <ETipoFacturacion> .GetList(false));

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ComboBoxSource tipo_venta = form.Selected as ComboBoxSource;
                _entity.ETipoFacturacion = (ETipoFacturacion)tipo_venta.Oid;
                FormaVenta_TB.Text       = _entity.TipoFacturacionLabel;
            }
        }
        protected virtual void SetEstadoAction()
        {
            EEstado[] list = { EEstado.Anulado };

            SelectEnumInputForm form = new SelectEnumInputForm(true);

            form.SetDataSource(Library.Common.EnumText <EEstado> .GetList(list));

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ComboBoxSource estado = form.Selected as ComboBoxSource;
                _entity.EEstado = (EEstado)estado.Oid;
                Estado_TB.Text  = _entity.EstadoLabel;
            }
        }
Example #22
0
        private void EstadoCobro_BT_Click(object sender, EventArgs e)
        {
            SelectEnumInputForm form = new SelectEnumInputForm(true);

            EEstado[] list = { EEstado.Pendiente, EEstado.Charged, EEstado.Devuelto };
            form.SetDataSource(Library.Common.EnumText <EEstado> .GetList(list));

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ComboBoxSource estado = form.Selected as ComboBoxSource;
                _entity.EstadoCobro = estado.Oid;
            }

            ReturnDate_DTP.Enabled = _entity.EEstadoCobro == EEstado.Devuelto;
        }
        protected virtual void SelectChargeStatusAction()
        {
            SelectEnumInputForm form = new SelectEnumInputForm(true);

            EEstado[] list = { EEstado.DudosoCobro, EEstado.Pendiente };
            form.SetDataSource(Library.Common.EnumText <EEstado> .GetList(list));

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ComboBoxSource estado = form.Selected as ComboBoxSource;
                _entity.UpdateEstadoCobro((EEstado)estado.Oid);

                EstadoCobro_TB.Text = _entity.EstadoCobroLabel;
            }
        }
        protected virtual void SelectEstadoAction()
        {
            moleQule.Base.EEstado[] list = { moleQule.Base.EEstado.Anulado, moleQule.Base.EEstado.Abierto, moleQule.Base.EEstado.Closed, moleQule.Base.EEstado.Cancelado };

            SelectEnumInputForm form = new SelectEnumInputForm(true);

            form.SetDataSource(moleQule.Base.EnumText <moleQule.Base.EEstado> .GetList(list));

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ComboBoxSource estado = form.Selected as ComboBoxSource;

                _entity.Estado = estado.Oid;
                Estado_TB.Text = estado.Texto;
            }
        }
        protected override void SelectTipoDescuentoLineaAction()
        {
            ProductoProveedor item = Productos_DGW.CurrentRow.DataBoundItem as ProductoProveedor;

            SelectEnumInputForm form = new SelectEnumInputForm(true);

            form.SetDataSource(moleQule.Common.Structs.EnumText <ETipoDescuento> .GetList(false));

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ComboBoxSource tipo = form.Selected as ComboBoxSource;
                item.ETipoDescuento = (ETipoDescuento)tipo.Oid;

                ControlsMng.UpdateBinding(Datos_Productos);
            }
        }
Example #26
0
        protected virtual void SelectSaleMethodAction()
        {
            if (_product != null && _product.ETipoFacturacion == ETipoFacturacion.Unitaria)
            {
                return;
            }

            SelectEnumInputForm form = new SelectEnumInputForm(true);

            form.SetDataSource(moleQule.Common.Structs.EnumText <ETipoFacturacion> .GetList(false, false, false));

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ComboBoxSource tipo_venta = form.Selected as ComboBoxSource;
                _entity.ETipoFacturacion = (ETipoFacturacion)tipo_venta.Oid;
                SaleMethod_TB.Text       = _entity.SaleMethodLabel;
            }
        }
Example #27
0
        protected override void SetTipoAction()
        {
            SelectEnumInputForm form = new SelectEnumInputForm(true);

            ETipoFactura[] list = { ETipoFactura.Ordinaria, ETipoFactura.Rectificativa };

            form.SetDataSource(Library.Store.EnumText <ETipoFactura> .GetList(list));

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                ComboBoxSource tipo = form.Selected as ComboBoxSource;

                if (_entity.Tipo != tipo.Oid)
                {
                    _entity.Tipo = tipo.Oid;
                    _entity.GetNewCode();
                }
                else
                {
                    _entity.Tipo = tipo.Oid;
                }
            }
        }
        /// <summary>Imprime la lista del objetos
        /// <returns>void</returns>
        /// </summary>
        public override void PrintList()
        {
            ETipoImpresionCronograma tipo = ETipoImpresionCronograma.Lista;
            SelectEnumInputForm      form = new SelectEnumInputForm(true);

            form.SetDataSource(Library.Instruction.EnumText <ETipoImpresionCronograma> .GetList(false, false, false));
            form.ShowDialog(this);

            if (form.ActionResult == DialogResult.OK)
            {
                ComboBoxSource combo = form.Selected as ComboBoxSource;
                tipo = (ETipoImpresionCronograma)combo.Oid;
            }

            ClaseTeoricaList         teoricas        = ClaseTeoricaList.GetList();
            ClasePracticaList        practicas       = ClasePracticaList.GetList(false);
            List <ClasePracticaList> lista_practicas = new List <ClasePracticaList>();

            lista_practicas.Add(null);
            lista_practicas.Add(practicas);
            lista_practicas.Add(practicas);
            ModuloList modulos = ModuloList.GetList(false);

            CronogramaReportMng reportMng = new CronogramaReportMng(AppContext.ActiveSchema);
            CronogramaRpt       report    = null;

            switch (FilterType)
            {
            case IFilterType.None:
                if (tipo == ETipoImpresionCronograma.Lista)
                {
                    bool        defecto = moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultBoolSetting();
                    CompanyInfo empresa = null;

                    if (defecto)
                    {
                        empresa = CompanyInfo.Get(moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultOidSetting(), false);
                    }
                    while (empresa == null)
                    {
                        moleQule.Face.Common.CompanySelectForm sform = new Common.CompanySelectForm(this);
                        DialogResult result = sform.ShowDialog();

                        try
                        {
                            if (result == DialogResult.OK)
                            {
                                empresa = form.Selected as CompanyInfo;
                            }
                        }
                        catch
                        { empresa = null; }
                    }

                    report = reportMng.GetCronogramaReport(_cronograma, empresa, modulos, teoricas, practicas, _sorted_list);

                    if (report != null)
                    {
                        report.SetParameterValue("Empresa", empresa.Name);
                        if (empresa.Oid == 2)
                        {
                            ((CrystalDecisions.CrystalReports.Engine.TextObject)(report.Section5.ReportObjects["Text1"])).Color = System.Drawing.Color.FromArgb(13, 176, 46);
                        }
                        ReportViewer.SetReport(report);
                        ReportViewer.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show(Resources.Messages.NO_DATA_REPORTS,
                                        moleQule.Face.Resources.Labels.ADVISE_TITLE,
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    Dictionary <Horario, ListaSesiones> horarios = Cronograma.GetHorarios(_sorted_list, teoricas, practicas);

                    if (horarios.Count > 0)
                    {
                        PgMng.Reset(horarios.Count + 5, 1, Resources.Messages.LOADING_DATA, this);

                        try
                        {
                            InstructorList instructores = InstructorList.GetList(false);
                            PgMng.Grow();

                            //EntidadInfo entidad = EntidadInfo.Get(typeof(Promocion), true);
                            //Agente agente = null;

                            //PromocionInfo promocion = PromocionInfo.Get(_cronograma.OidPromocion, true);

                            //if (entidad.Agentes.GetItemByProperty("OidAgenteExt", promocion.Oid) != null)
                            //    agente = Agente.Get(typeof(Promocion), promocion);
                            //else
                            //{
                            //    agente = Agente.New();
                            //    agente.CopyFrom(entidad, promocion);
                            //    agente.Codigo = agente.GetCode();
                            //}

                            PgMng.Grow();

                            string       sFile = "C:\\cronograma.pdf";
                            FileStream   fs    = new FileStream(sFile, FileMode.Create, FileAccess.Write, FileShare.None);
                            Document     doc   = new Document();
                            PdfSmartCopy copy  = new PdfSmartCopy(doc, fs);

                            doc.Open();

                            foreach (KeyValuePair <Horario, ListaSesiones> item in horarios)
                            {
                                item.Key.OidPlan      = _cronograma.OidPlan;
                                item.Key.OidPromocion = _cronograma.OidPromocion;
                                HorarioRpt rpt    = reportMng.GetHorarioReport(item.Key.GetInfo(false), true, teoricas, lista_practicas, null, instructores, modulos, item.Value, false, DateTime.Now);
                                PdfReader  reader = new PdfReader(rpt.ExportToStream(ExportFormatType.PortableDocFormat));
                                copy.AddPage(copy.GetImportedPage(reader, 1));
                                rpt.Close();
                                rpt.Dispose();
                                PgMng.Grow();
                            }

                            doc.Close();

                            System.Diagnostics.Process process = new System.Diagnostics.Process();
                            process.StartInfo.FileName = sFile;
                            process.Start();
                            try
                            {
                                process.WaitForExit();
                            }
                            catch { }
                            PgMng.Grow();

                            //Documento documento = Documento.New();
                            //documento.Fecha = DateTime.Now;
                            //documento.FechaAlta = DateTime.Now;
                            //documento.Nombre = documento.Fecha.ToString("yyyyMMdd") + "_CRONOGRAMA";
                            //documento.Ruta = "C:\\";
                            //documento.Tipo = "PDF";


                            //AgenteDocumento agente_documento = agente.Documentos.NewItem(agente);
                            //agente_documento.OidDocumento = documento.Oid;

                            //agente.Save();
                        }
                        catch (Exception ex) { throw ex; }
                        finally { PgMng.FillUp(); }
                    }
                }
                break;

            case IFilterType.Filter:
                if (tipo == ETipoImpresionCronograma.Lista)
                {
                    bool        defecto = moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultBoolSetting();
                    CompanyInfo empresa = null;

                    if (defecto)
                    {
                        empresa = CompanyInfo.Get(moleQule.Library.Instruction.ModulePrincipal.GetImpresionEmpresaDefaultOidSetting(), false);
                    }
                    while (empresa == null)
                    {
                        moleQule.Face.Common.CompanySelectForm sform = new Common.CompanySelectForm(this);
                        DialogResult result = sform.ShowDialog();

                        try
                        {
                            if (result == DialogResult.OK)
                            {
                                empresa = form.Selected as CompanyInfo;
                            }
                        }
                        catch
                        { empresa = null; }
                    }

                    report = reportMng.GetCronogramaReport(_cronograma, empresa, modulos, teoricas, practicas, _filter_results);

                    if (report != null)
                    {
                        report.SetParameterValue("Empresa", empresa.Name);
                        if (empresa.Oid == 2)
                        {
                            ((CrystalDecisions.CrystalReports.Engine.TextObject)(report.Section5.ReportObjects["Text1"])).Color = System.Drawing.Color.FromArgb(13, 176, 46);
                        }
                        ReportViewer.SetReport(report);
                        ReportViewer.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show(Resources.Messages.NO_DATA_REPORTS,
                                        moleQule.Face.Resources.Labels.ADVISE_TITLE,
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    Dictionary <Horario, ListaSesiones> horarios = Cronograma.GetHorarios(_filter_results, teoricas, practicas);

                    if (horarios.Count > 0)
                    {
                        PgMng.Reset(horarios.Count + 5, 1, Resources.Messages.LOADING_DATA, this);

                        try
                        {
                            InstructorList instructores = InstructorList.GetList(false);
                            PgMng.Grow();

                            //EntidadInfo entidad = EntidadInfo.Get(typeof(Promocion), true);
                            //Agente agente = null;

                            //PromocionInfo promocion = PromocionInfo.Get(_cronograma.OidPromocion, true);

                            //if (entidad.Agentes.GetItemByProperty("OidAgenteExt", promocion.Oid) != null)
                            //    agente = Agente.Get(typeof(Promocion), promocion);
                            //else
                            //{
                            //    agente = Agente.New();
                            //    agente.CopyFrom(entidad, promocion);
                            //    agente.Codigo = agente.GetCode();
                            //}

                            PgMng.Grow();

                            string       sFile = "C:\\cronograma.pdf";
                            FileStream   fs    = new FileStream(sFile, FileMode.Create, FileAccess.Write, FileShare.None);
                            Document     doc   = new Document();
                            PdfSmartCopy copy  = new PdfSmartCopy(doc, fs);

                            doc.Open();

                            foreach (KeyValuePair <Horario, ListaSesiones> item in horarios)
                            {
                                item.Key.OidPlan      = _cronograma.OidPlan;
                                item.Key.OidPromocion = _cronograma.OidPromocion;
                                HorarioRpt rpt    = reportMng.GetHorarioReport(item.Key.GetInfo(false), true, teoricas, lista_practicas, null, instructores, modulos, item.Value, false, DateTime.Now);
                                PdfReader  reader = new PdfReader(rpt.ExportToStream(ExportFormatType.PortableDocFormat));
                                copy.AddPage(copy.GetImportedPage(reader, 1));
                                rpt.Close();
                                rpt.Dispose();
                                PgMng.Grow();
                            }

                            doc.Close();

                            System.Diagnostics.Process process = new System.Diagnostics.Process();
                            process.StartInfo.FileName = sFile;
                            process.Start();
                            try
                            {
                                process.WaitForExit();
                            }
                            catch { }
                            PgMng.Grow();

                            //Documento documento = Documento.New();
                            //documento.Fecha = DateTime.Now;
                            //documento.FechaAlta = DateTime.Now;
                            //documento.Nombre = documento.Fecha.ToString("yyyyMMdd") + "_CRONOGRAMA";
                            //documento.Ruta = "C:\\";
                            //documento.Tipo = "PDF";


                            //AgenteDocumento agente_documento = agente.Documentos.NewItem(agente);
                            //agente_documento.OidDocumento = documento.Oid;

                            //agente.Save();
                        }
                        catch (Exception ex) { throw ex; }
                        finally { PgMng.FillUp(); }
                    }
                }
                break;
            }
        }
Example #29
0
        protected virtual void SetPaymentMethodAction()
        {
            SelectEnumInputForm form = new SelectEnumInputForm(true);

            form.SetDataSource(GetPaymentMethods());

            try
            {
                Datos.RaiseListChangedEvents = false;

                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    ComboBoxSource item = form.Selected as ComboBoxSource;

                    _entity.SetMedioPago(item.Oid);
                    MedioPago_TB.Text = _entity.MedioPagoLabel;

                    Importe_NTB.Enabled   = true;
                    Tarjeta_BT.Enabled    = false;
                    Cuenta_BT.Enabled     = true;
                    PaymentStatus_TB.Text = _entity.EstadoPagoLabel;

                    _credit_card = (_entity.EMedioPago != EMedioPago.Tarjeta) ? null : _credit_card;
                    _entity.OidTarjetaCredito = 0;
                    _entity.TarjetaCredito    = string.Empty;

                    switch (_entity.EMedioPago)
                    {
                    case EMedioPago.CompensacionFactura:
                    {
                        Importe_NTB.Text = _entity.Importe.ToString("N2");
                        ReleaseAction();
                        Importe_NTB.Enabled   = false;
                        PaymentStatus_TB.Text = _entity.EstadoPagoLabel;
                    }
                    break;

                    case EMedioPago.Tarjeta:
                    {
                        Tarjeta_BT.Enabled    = true;
                        Cuenta_BT.Enabled     = false;
                        PaymentStatus_TB.Text = _entity.EstadoPagoLabel;
                    }
                    break;

                    case EMedioPago.ComercioExterior:
                    {
                        SetBankAccountAction();
                        SetExpenses();
                    }
                    break;
                    }

                    if (moleQule.Common.EnumFunctions.NeedsCuentaBancaria(_entity.EMedioPago))
                    {
                        if ((_entity.EMedioPago == EMedioPago.Tarjeta) && (_entity.OidTarjetaCredito == 0))
                        {
                            SetCreditCardAction();
                        }
                        else if (_entity.OidCuentaBancaria == 0)
                        {
                            SetBankAccountAction();
                        }
                    }
                    else
                    {
                        Cuenta_TB.Text = string.Empty;
                    }

                    PaymentStatus_TB.Text = _entity.EstadoPagoLabel;
                }
            }
            finally
            {
                Datos.RaiseListChangedEvents = true;
            }
        }
        public override void OpenAddForm()
        {
            SelectEnumInputForm select_form = new SelectEnumInputForm(true);

            ETipoAcreedor[] tipos = new ETipoAcreedor[6] {
                ETipoAcreedor.Acreedor, ETipoAcreedor.Proveedor, ETipoAcreedor.Despachante, ETipoAcreedor.Naviera, ETipoAcreedor.TransportistaDestino, ETipoAcreedor.TransportistaOrigen
            };
            select_form.SetDataSource(moleQule.Common.Structs.EnumText <ETipoAcreedor> .GetList(tipos, false));

            if (select_form.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            ComboBoxSource estado = select_form.Selected as ComboBoxSource;

            switch ((ETipoAcreedor)(long)estado.Oid)
            {
            case ETipoAcreedor.Acreedor:
            case ETipoAcreedor.Proveedor:
            {
                ProveedorAddForm form = new ProveedorAddForm(this);
                if (form.Entity != null)
                {
                    AddForm(form);
                    if (form.ActionResult == DialogResult.OK)
                    {
                        _entity = new ProviderBase();
                        _entity.CopyValues(form.Entity.ProviderBase);
                        _entity.Record.CopyValues(form.Entity.Base.Record);
                    }
                }
            }
            break;

            case ETipoAcreedor.Despachante:
            {
                DespachanteAddForm form = new DespachanteAddForm(this);
                if (form.Entity != null)
                {
                    AddForm(form);
                    if (form.ActionResult == DialogResult.OK)
                    {
                        _entity = new ProviderBase();
                        _entity.CopyValues(form.Entity.ProviderBase);
                        _entity.Record.CopyValues(form.Entity.Base.Record);
                    }
                }
            }
            break;

            case ETipoAcreedor.Naviera:
            {
                NavieraAddForm form = new NavieraAddForm();
                if (form.Entity != null)
                {
                    AddForm(form);
                    if (form.ActionResult == DialogResult.OK)
                    {
                        _entity = new ProviderBase();
                        _entity.CopyValues(form.Entity.ProviderBase);
                        _entity.Record.CopyValues(form.Entity.Base.Record);
                    }
                }
            }
            break;

            case ETipoAcreedor.TransportistaOrigen:
            {
                TransporterAddForm form = new TransporterAddForm(this, ETipoAcreedor.TransportistaOrigen);
                if (form.Entity != null)
                {
                    AddForm(form);
                    if (form.ActionResult == DialogResult.OK)
                    {
                        _entity = new ProviderBase();
                        _entity.CopyValues(form.Entity.ProviderBase);
                        _entity.Record.CopyValues(form.Entity.Base.Record);
                    }
                }
            }
            break;

            case ETipoAcreedor.TransportistaDestino:
            {
                TransporterAddForm form = new TransporterAddForm(this, ETipoAcreedor.TransportistaDestino);
                if (form.Entity != null)
                {
                    AddForm(form);
                    if (form.ActionResult == DialogResult.OK)
                    {
                        _entity = new ProviderBase();
                        _entity.CopyValues(form.Entity.ProviderBase);
                        _entity.Record.CopyValues(form.Entity.Base.Record);
                    }
                }
            }
            break;
            }
        }