public override void PrintObject() { if (Client_BS.Current == null) { return; } OutputInvoiceReportMng reportMng = new OutputInvoiceReportMng(AppContext.ActiveSchema); FormatConfFacturaAlbaranReport conf = new FormatConfFacturaAlbaranReport(); ClienteInfo client = Client_BS.Current as ClienteInfo; 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 += EntityInfo.Nota ? Nota_TB.Text : ""; conf.cuenta_bancaria = Cuenta_TB.Text; ReportClass report = reportMng.GetDetailReport((EntityInfo.ConceptoFacturas != null) ? EntityInfo : Entity.GetInfo(true), _serie, client, _transporter, conf); if (SettingsMng.Instance.GetUseDefaultPrinter()) { int n_copias = SettingsMng.Instance.GetDefaultNCopies(); PrintReport(report, n_copias); } else { ShowReport(report); } }
protected virtual void PrintPendienteListAction() { OutputInvoiceReportMng reportMng = new OutputInvoiceReportMng(AppContext.ActiveSchema, Resources.Labels.FACTURA_PENDIENTES, "Cliente = " + Entity.Nombre); ReportClass report = reportMng.GetListReport(OutputInvoiceList.GetList(Datos_FPendientes.DataSource as IList <OutputInvoiceInfo>), SerieList.GetList(false)); ShowReport(report); }
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); } } }
public override void PrintList() { PgMng.Reset(3, 1, Face.Resources.Messages.LOADING_DATA, this); OutputInvoiceReportMng reportMng = new OutputInvoiceReportMng(AppContext.ActiveSchema, this.Text, this.FilterValues); PgMng.Grow(Face.Resources.Messages.BUILDING_REPORT); ReportClass report = reportMng.GetListReport(OutputInvoiceList.GetList(Datos.DataSource as IList <OutputInvoiceInfo>), SerieList.GetList(false)); PgMng.FillUp(); ShowReport(report); }
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(); } }
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); }
protected override void PrintAction() { PgMng.Reset(5, 1, Face.Resources.Messages.RETRIEVING_DATA, this); Library.Invoice.QueryConditions conditions = new Library.Invoice.QueryConditions(); conditions.Cliente = TodosCliente_CkB.Checked ? null : _cliente; conditions.Serie = TodosSerie_CkB.Checked ? null : _serie; conditions.MedioPago = MedioPago_CB.SelectedValue != null ? (EMedioPago)(long)MedioPago_CB.SelectedValue : EMedioPago.Todos; conditions.FechaIni = FInicial_DTP.Checked ? FInicial_DTP.Value : DateTime.MinValue; conditions.FechaFin = FFinal_DTP.Checked ? FFinal_DTP.Value : DateTime.MaxValue; string filter = GetFilterValues(); PgMng.Grow(); OutputInvoiceList in_invoices = OutputInvoiceList.GetList(conditions, false); PgMng.Grow(); ProductList products = ProductList.GetList(false); PgMng.Grow(); ExpedienteList expedients = ExpedienteList.GetList(false); PgMng.FillUp(); PgMng.Reset(in_invoices.Count + 2, 1, Face.Resources.Messages.RETRIEVING_DATA, this); Dictionary <long, ClientProductList> client_products = new Dictionary <long, ClientProductList>(); foreach (OutputInvoiceInfo in_invoice in in_invoices) { in_invoice.LoadChilds(typeof(OutputInvoiceLine), false); decimal invoice_cost = 0; foreach (OutputInvoiceLineInfo line in in_invoice.ConceptoFacturas) { ProductInfo product = products.GetItem(line.OidProducto); if (product.BeneficioCero) { if (!client_products.ContainsKey(in_invoice.OidCliente)) { client_products.Add(in_invoice.OidCliente, ClientProductList.GetByClientList(in_invoice.OidCliente, false)); #if TRACE AppControllerBase.AppControler.Timer.Record("Productos del Cliente"); #endif } ProductoClienteInfo product_client = client_products[in_invoice.OidCliente].GetByProducto(line.OidProducto); if (product_client != null) { invoice_cost += product_client.PrecioCompra; } else { invoice_cost += line.Subtotal; } } else { if (line.OidPartida != 0) { ExpedientInfo expedient = expedients.GetItem(line.OidExpediente); if (expedient != null) { if (expedient.Partidas == null) { expedient.LoadExpenses(Estimated_CB.Checked); #if TRACE AppControllerBase.AppControler.Timer.Record("Gastos del Expediente"); #endif } BatchInfo batch = expedient.Partidas.GetItem(line.OidPartida); invoice_cost += line.CantidadKilos * batch.CosteNetoKg; } else { invoice_cost += line.CantidadKilos * product.PrecioCompra; } } else { invoice_cost += (product != null) ? line.CantidadKilos * product.PrecioCompra : 0; } } } in_invoice.PrecioCoste = invoice_cost; in_invoice.Beneficio = Decimal.Round(in_invoice.BaseImponible - in_invoice.PrecioCoste, 2); in_invoice.PBeneficio = in_invoice.PrecioCoste != 0 ? Decimal.Round(((in_invoice.BaseImponible - in_invoice.PrecioCoste) * 100) / in_invoice.PrecioCoste, 2) : 0; PgMng.Grow(); } client_products.Clear(); PgMng.Grow(Face.Resources.Messages.BUILDING_REPORT); OutputInvoiceReportMng reportMng = new OutputInvoiceReportMng(AppContext.ActiveSchema, this.Text, filter); ReportClass rpt = reportMng.GetBenefitsReport(in_invoices); PgMng.FillUp(); ShowReport(rpt); _action_result = DialogResult.Ignore; }
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(); } }