Beispiel #1
0
        protected override void RefreshMainData()
        {
            Datos.DataSource    = _entity;
            Lines_BS.DataSource = _entity.ConceptoFacturas;
            PgMng.Grow();

            if (_entity.OidCliente > 0)
            {
                Client_BS.DataSource = ClienteInfo.Get(_entity.OidCliente, true);
            }
            PgMng.Grow();

            if (_entity.OidSerie > 0)
            {
                _serie        = SerieInfo.Get(_entity.OidSerie, false);
                Serie_TB.Text = _serie.Nombre;
                Nota_TB.Text  = _serie.Cabecera;
            }
            PgMng.Grow();

            if (_entity.OidTransportista > 0)
            {
                _transporter          = TransporterInfo.Get(_entity.OidTransportista, ETipoAcreedor.TransportistaDestino, false);
                Transportista_TB.Text = _transporter.Nombre;
            }
            PgMng.Grow();

            DiasPago_NTB.Text = _entity.DiasPago.ToString();
            Fecha_DTP.Value   = _entity.Fecha;
            Prevision_TB.Text = _entity.Prevision.ToShortDateString();

            base.RefreshMainData();
        }
        public override void PrintDetailAction()
        {
            if (ActiveItem == null)
            {
                return;
            }

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

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

            SerieInfo serie = SerieInfo.Get(ActiveItem.OidSerie, false);

            PgMng.Grow();

            ClienteInfo client = ClienteInfo.Get(ActiveItem.OidCliente, false);

            PgMng.Grow();

            TransporterInfo transporter = TransporterInfo.Get(ActiveItem.OidTransportista, ETipoAcreedor.TransportistaDestino, false);

            PgMng.Grow();

            FormatConfFacturaAlbaranReport conf = new FormatConfFacturaAlbaranReport();

            conf.nota            = (client.OidImpuesto == 1) ? Library.Invoice.Resources.Messages.NOTA_EXENTO_IGIC : string.Empty;
            conf.nota           += (conf.nota != string.Empty) ? Environment.NewLine : string.Empty;
            conf.nota           += (ActiveItem.Nota ? serie.Cabecera : "");
            conf.cuenta_bancaria = ActiveItem.CuentaBancaria;
            PgMng.Grow();

            OutputInvoiceInfo item = OutputInvoiceInfo.Get(ActiveOID, true);

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

            ReportClass report = reportMng.GetDetailReport(item, serie, client, transporter, conf);

            PgMng.FillUp();

            if (report != null)
            {
                if (SettingsMng.Instance.GetUseDefaultPrinter())
                {
                    int n_copias = SettingsMng.Instance.GetDefaultNCopies();
                    PrintReport(report, n_copias);
                }
                else
                {
                    ShowReport(report);
                }

                if (item.EEstado == EEstado.Abierto)
                {
                    ChangeStateAction(EEstadoItem.Emitido);
                }
            }
        }
Beispiel #3
0
        protected override void RefreshMainData()
        {
            if (_entity.OidSerie > 0)
            {
                SetSerie(SerieInfo.Get(_entity.OidSerie, false), false);
            }
            PgMng.Grow();

            if (_entity.OidTransportista > 0)
            {
                SetTransportista(TransporterInfo.Get(_entity.OidTransportista, ETipoAcreedor.TransportistaDestino, false));
            }
            PgMng.Grow();

            base.RefreshMainData();
        }
        public override void ExportPDFAction()
        {
            if (ActiveItem == null)
            {
                return;
            }

            try
            {
                PgMng.Reset(9, 1, Face.Resources.Messages.RETRIEVING_DATA, this);

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

                SerieInfo serie = SerieInfo.Get(ActiveItem.OidSerie, false);
                PgMng.Grow();

                ClienteInfo client = ClienteInfo.Get(ActiveItem.OidCliente, false);
                PgMng.Grow();

                TransporterInfo transporter = TransporterInfo.Get(ActiveItem.OidTransportista, ETipoAcreedor.TransportistaDestino, false);
                PgMng.Grow();

                FormatConfFacturaAlbaranReport conf = new FormatConfFacturaAlbaranReport();

                conf.nota            = (client.OidImpuesto == 1) ? Library.Invoice.Resources.Messages.NOTA_EXENTO_IGIC : string.Empty;
                conf.nota           += Environment.NewLine + (ActiveItem.Nota ? serie.Cabecera : "");
                conf.cuenta_bancaria = ActiveItem.CuentaBancaria;
                PgMng.Grow();

                OutputInvoiceInfo item = OutputInvoiceInfo.Get(ActiveOID, true);
                PgMng.Grow();

                ReportClass report = reportMng.GetDetailReport(item, serie, client, transporter, conf);
                PgMng.Grow();

                ExportPDF(report, ActiveItem.FileName);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                PgMng.FillUp();
            }
        }
Beispiel #5
0
        protected virtual void PrintPendienteAction()
        {
            if (Pendientes_DGW.CurrentRow == null)
            {
                return;
            }

            OutputInvoiceInfo in_invoice = Pendientes_DGW.CurrentRow.DataBoundItem as OutputInvoiceInfo;

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

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

            SerieInfo serie = SerieInfo.Get(in_invoice.OidSerie, false);

            PgMng.Grow();

            ClienteInfo client = ClienteInfo.Get(in_invoice.OidCliente, false);

            PgMng.Grow();

            TransporterInfo transporter = TransporterInfo.Get(in_invoice.OidTransportista, ETipoAcreedor.TransportistaDestino, false);

            PgMng.Grow();

            FormatConfFacturaAlbaranReport conf = new FormatConfFacturaAlbaranReport();

            conf.nota            = (client.OidImpuesto == 1) ? Library.Invoice.Resources.Messages.NOTA_EXENTO_IGIC : string.Empty;
            conf.nota           += Environment.NewLine + (in_invoice.Nota ? serie.Cabecera : "");
            conf.cuenta_bancaria = in_invoice.CuentaBancaria;
            PgMng.Grow();

            OutputInvoiceInfo item = OutputInvoiceInfo.Get(in_invoice.Oid, true);

            PgMng.Grow();

            ReportClass report = reportMng.GetDetailReport(item, serie, client, transporter, conf);

            PgMng.FillUp();

            ShowReport(report);
        }
        public override void RefreshSecondaryData()
        {
            base.RefreshSecondaryData();

            if (_entity.OidCliente != 0)
            {
                SetClient(ClienteInfo.Get(_entity.OidCliente, false));
            }
            PgMng.Grow();

            if (_entity.OidSerie != 0)
            {
                SetSerie(SerieInfo.Get(_entity.OidSerie, false), false);
            }
            PgMng.Grow();

            if (_entity.OidTransportista > 0)
            {
                SetTransporter(TransporterInfo.Get(_entity.OidTransportista, ETipoAcreedor.TransportistaDestino, false));
            }
            PgMng.Grow();
        }
        public override void ShowDocumentsAction()
        {
            switch (ActiveItem.ETipoAcreedor)
            {
            case ETipoAcreedor.Acreedor:
            case ETipoAcreedor.Proveedor:
            {
                ProveedorInfo agente = ProveedorInfo.Get(ActiveItem.Oid, ActiveItem.ETipoAcreedor, false);

                try
                {
                    AgenteInfo     agent = AgenteInfo.Get(typeof(Proveedor), agente);
                    AgenteEditForm form  = new AgenteEditForm(typeof(Proveedor), agente, this);
                    AddForm(form);
                }
                catch (HipatiaException ex)
                {
                    if (ex.Code == HipatiaCode.NO_AGENTE)
                    {
                        AgenteAddForm form = new AgenteAddForm(typeof(Proveedor), agente, this);
                        AddForm(form);
                    }
                }
            }
            break;

            case ETipoAcreedor.Naviera:
            {
                NavieraInfo agente = NavieraInfo.Get(ActiveItem.Oid, false);

                try
                {
                    AgenteInfo     agent = AgenteInfo.Get(typeof(Naviera), agente);
                    AgenteEditForm form  = new AgenteEditForm(typeof(Naviera), agente, this);
                    AddForm(form);
                }
                catch (HipatiaException ex)
                {
                    if (ex.Code == HipatiaCode.NO_AGENTE)
                    {
                        AgenteAddForm form = new AgenteAddForm(typeof(Naviera), agente, this);
                        AddForm(form);
                    }
                }
            }
            break;

            case ETipoAcreedor.Despachante:
            {
                DespachanteInfo agente = DespachanteInfo.Get(ActiveItem.Oid, false);

                try
                {
                    AgenteInfo     agent = AgenteInfo.Get(typeof(Despachante), agente);
                    AgenteEditForm form  = new AgenteEditForm(typeof(Despachante), agente, this);
                    AddForm(form);
                }
                catch (HipatiaException ex)
                {
                    if (ex.Code == HipatiaCode.NO_AGENTE)
                    {
                        AgenteAddForm form = new AgenteAddForm(typeof(Despachante), agente, this);
                        AddForm(form);
                    }
                }
            }
            break;

            case ETipoAcreedor.TransportistaOrigen:
            case ETipoAcreedor.TransportistaDestino:
            {
                TransporterInfo agente = TransporterInfo.Get(ActiveItem.Oid, ActiveItem.ETipoAcreedor, false);

                try
                {
                    AgenteInfo     agent = AgenteInfo.Get(typeof(Transporter), agente);
                    AgenteEditForm form  = new AgenteEditForm(typeof(Transporter), agente, this);
                    AddForm(form);
                }
                catch (HipatiaException ex)
                {
                    if (ex.Code == HipatiaCode.NO_AGENTE)
                    {
                        AgenteAddForm form = new AgenteAddForm(typeof(Transporter), agente, this);
                        AddForm(form);
                    }
                }
            }
            break;
            }
        }
Beispiel #8
0
        public void GoToSourceAction()
        {
            if (ActiveItem == null)
            {
                return;
            }
            if (ActiveItem.EEstado == EEstado.Anulado)
            {
                return;
            }

            switch (ActiveItem.ETipoMovimientoBanco)
            {
            case EBankLineType.Cobro:
            {
                switch (ActiveItem.ETipoTitular)
                {
                case ETipoTitular.Cliente:
                {
                    ClienteInfo   cliente = ClienteInfo.Get(ActiveItem.OidTitular, true);
                    ChargeSummary item    = ChargeSummary.Get(cliente);
                    CobroEditForm form    = new CobroEditForm(cliente.Oid, item, null, this);
                    form.ShowDialog(this);
                }
                break;

                case ETipoTitular.Fomento:
                {
                    ChargeInfo            cobro = ChargeInfo.Get(ActiveItem.OidTitular, ETipoCobro.Fomento, false);
                    CobrosFomentoEditForm form  = new CobrosFomentoEditForm(cobro, this);
                    form.ShowDialog(this);
                }
                break;

                case ETipoTitular.REA:
                {
                    ChargeInfo        cobro = ChargeInfo.Get(ActiveItem.OidTitular, ETipoCobro.REA, false);
                    CobrosREAEditForm form  = new CobrosREAEditForm(cobro, this);
                    form.ShowDialog();
                }
                break;
                }
            }
            break;

            case EBankLineType.PagoFactura:
            {
                ETipoAcreedor tipo = moleQule.Library.Store.EnumConvert.ToETipoAcreedor(ActiveItem.ETipoTitular);

                if ((new List <ETipoTitular> {
                        ETipoTitular.TransportistaOrigen, ETipoTitular.TransportistaOrigen
                    }).Contains(ActiveItem.ETipoTitular))
                {
                    TransporterInfo transporter = TransporterInfo.Get(ActiveItem.OidTitular, moleQule.Library.Store.EnumConvert.ToETipoAcreedor(ActiveItem.ETipoTitular), false);
                    tipo = transporter.ETipoAcreedor;
                }

                PaymentSummary  item = PaymentSummary.Get(tipo, ActiveItem.OidTitular);
                PaymentEditForm form = new PaymentEditForm(this, ActiveItem.OidTitular, item);
                form.ShowDialog(this);
            }
            break;

            case EBankLineType.PagoGasto:
            {
                ExpensePaymentEditForm form = new ExpensePaymentEditForm(ActiveItem.OidTitular, ETipoPago.Gasto, this);
                form.ShowDialog();
            }
            break;

            case EBankLineType.PagoNomina:
            {
                PaymentSummary          item = PaymentSummary.Get(ETipoAcreedor.Empleado, ActiveItem.OidTitular);
                EmployeePaymentEditForm form = new EmployeePaymentEditForm(this, ActiveItem.OidTitular, item);
                form.ShowDialog();
            }
            break;

            case EBankLineType.PagoPrestamo:
            {
                LoanPaymentEditForm form = new LoanPaymentEditForm(ActiveItem.OidTitular, ETipoPago.Prestamo, this);
                form.ShowDialog();
            }
            break;

            case EBankLineType.Prestamo:
            {
                LoanEditForm form = new LoanEditForm(ActiveItem.OidTitular, this);
                form.ShowDialog();
            }
            break;

            case EBankLineType.EntradaCaja:
            case EBankLineType.SalidaCaja:
            {
                CashLineInfo linea = CashLineInfo.Get(ActiveItem.OidOperacion);

                if (linea.OidCierre != 0)
                {
                    CashCountEditForm form = new CashCountEditForm(linea.OidCierre, this);
                    form.ShowDialog();
                }
                else
                {
                    CashEditForm form = new CashEditForm(linea.OidCaja, this);
                    form.ShowDialog();
                }
            }
            break;

            case EBankLineType.Traspaso:
            {
                TraspasoEditForm form = new TraspasoEditForm(ActiveItem.OidTitular, this);
                form.ShowDialog();
            }
            break;

            case EBankLineType.ExtractoTarjeta:
            {
                CreditCardPaymentEditForm form = new CreditCardPaymentEditForm(ActiveItem.OidOperacion, ETipoPago.ExtractoTarjeta, this);
                form.Show();
            }
            break;
            }
        }
        public override void EmailPDFAction()
        {
            if (ActiveItem == null)
            {
                return;
            }

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

            SerieInfo serie = SerieInfo.Get(ActiveItem.OidSerie, false);

            PgMng.Grow();

            ClienteInfo client = ClienteInfo.Get(ActiveItem.OidCliente, false);

            PgMng.Grow();

            TransporterInfo transporter = TransporterInfo.Get(ActiveItem.OidTransportista, ETipoAcreedor.TransportistaDestino, false);

            PgMng.Grow();

            CompanyInfo company = CompanyInfo.Get(AppContext.ActiveSchema.Oid);

            PgMng.Grow();

            FormatConfFacturaAlbaranReport conf = new FormatConfFacturaAlbaranReport();

            conf.nota            = (client.OidImpuesto == 1) ? Library.Invoice.Resources.Messages.NOTA_EXENTO_IGIC : string.Empty;
            conf.nota           += Environment.NewLine + (ActiveItem.Nota ? serie.Cabecera : "");
            conf.cuenta_bancaria = ActiveItem.CuentaBancaria;
            PgMng.Grow();

            OutputInvoiceInfo item = OutputInvoiceInfo.Get(ActiveOID, true);

            PgMng.Grow();

            OutputInvoiceReportMng reportMng = new OutputInvoiceReportMng(AppContext.ActiveSchema, this.Text, this.FilterValues);
            ReportClass            report    = reportMng.GetDetailReport(item, serie, client, transporter, conf);

            PgMng.Grow();

            if (report != null)
            {
                ExportOptions options = new ExportOptions();
                DiskFileDestinationOptions diskFileDestinationOptions = new DiskFileDestinationOptions();

                string fileName = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                fileName += "\\" + ActiveItem.FileName;

                PgMng.Grow(String.Format(Face.Resources.Messages.EXPORTING_PDF, fileName), string.Empty);

                diskFileDestinationOptions.DiskFileName = fileName;
                options.ExportFormatType         = CrystalDecisions.Shared.ExportFormatType.PortableDocFormat;
                options.ExportDestinationType    = CrystalDecisions.Shared.ExportDestinationType.DiskFile;
                options.ExportDestinationOptions = diskFileDestinationOptions;

                PgMng.Grow();

                report.Export(options);

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

                System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();

                mail.To.Add(new MailAddress(client.Email, client.Nombre));
                mail.From    = new MailAddress(SettingsMng.Instance.GetSMTPMail(), company.Name);
                mail.Body    = String.Format(Library.Invoice.Resources.Messages.FACTURA_EMAIL_ATTACHMENT_BODY, company.Name);
                mail.Subject = Library.Invoice.Resources.Messages.FACTURA_EMAIL_SUBJECT;
                mail.Attachments.Add(new Attachment(fileName));

                try
                {
                    PgMng.Grow(moleQule.Face.Resources.Messages.SENDING_EMAIL, string.Empty);

                    EMailClient.Instance.SmtpCliente.Send(mail);

                    if (item.EEstado == EEstado.Abierto)
                    {
                        ChangeStateAction(EEstadoItem.Emitido);
                    }

                    PgMng.ShowInfoException("Mensaje enviado con éxito");
                }
                catch (Exception ex)
                {
                    PgMng.ShowInfoException(ex.Message + Environment.NewLine + Environment.NewLine + moleQule.Library.Resources.Errors.SMTP_SETTINGS);
                }
                finally
                {
                    mail.Dispose();
                    PgMng.FillUp();
                }
            }
            else
            {
                PgMng.ShowInfoException(Face.Resources.Messages.NO_DATA_REPORTS);

                PgMng.FillUp();
            }
        }
 protected override void GetFormSourceData(long oid, object[] parameters)
 {
     _entity = TransporterInfo.Get(oid, (ETipoAcreedor)parameters[0], true);
 }