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);
                }
            }
        }
        protected override void GetFormSourceData(long oid, object[] parameters)
        {
            if (parameters[0] == null)
            {
                _entity = OutputInvoiceInfo.Get(oid);
            }
            else
            {
                _entity = (OutputInvoiceInfo)(parameters[0]);
            }

            _entity.LoadChilds(typeof(CobroFactura), false);
        }
        public override void EmailLinkAction()
        {
            if (ActiveItem == null)
            {
                return;
            }

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

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

            PgMng.Grow();

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

            PgMng.Grow();

            MailParams mail = new MailParams();

            string url = empresa.Url + String.Format(Library.Invoice.ModuleController.GetFacturaWebScript(), ActiveItem.Link);

            mail.To      = cliente.Email;
            mail.Body    = String.Format(Library.Invoice.Resources.Messages.FACTURA_EMAIL_LINK_BODY, url, empresa.Name);
            mail.Subject = Library.Invoice.Resources.Messages.FACTURA_EMAIL_SUBJECT;

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

                EMailSender.MailTo(mail);

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

                if (item.EEstado == EEstado.Abierto)
                {
                    ChangeStateAction(EEstadoItem.Emitido);
                }
            }
            catch
            {
                PgMng.ShowInfoException(moleQule.Face.Resources.Messages.NO_EMAIL_CLIENT);
            }
            finally
            {
                PgMng.FillUp();
            }
        }
        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();
            }
        }
示例#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);
        }
示例#6
0
        public override void OpenEditForm()
        {
            try
            {
                OutputInvoiceInfo factura = OutputInvoiceInfo.Get(ActiveItem.OidFactura, false);
                EntityBase.CheckEditAllowedEstado(factura.EEstado, EEstado.Abierto);
            }
            catch (iQException ex)
            {
                PgMng.ShowInfoException(ex);
                _action_result = DialogResult.Ignore;
                return;
            }

            InvoiceEditForm form = new InvoiceEditForm(ActiveItem.OidFactura, this);

            if (form.Entity != null)
            {
                AddForm(form);
                _action_result = DialogResult.OK;
            }
        }
        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();
            }
        }
示例#8
0
 protected override void GetFormSourceData(long oid)
 {
     _entity = OutputInvoiceInfo.Get(oid, true);
 }