protected virtual void EditAmountAction(DataGridViewRow row) { InputDecimalForm form = new InputDecimalForm(); form.Message = Resources.Labels.IMPORTE_COBRO; if (form.ShowDialog(this) == DialogResult.OK) { OutputInvoiceInfo item = row.DataBoundItem as OutputInvoiceInfo; _no_asignado += item.Asignado; CobroFactura cobro = _entity.CobroFacturas.GetItemByFactura(item.Oid); if (cobro != null) { cobro.Cantidad = 0; } item.Cobrado -= item.Asignado; item.PendienteVencido += item.Asignado; item.Asignado = form.Value; LinkInvoiceAction(row); SetUnlinkedGridValues(Facturas_DGW.Name); Datos_Facturas.ResetBindings(false); SetGridColors(Facturas_DGW.Name); } }
protected override void UpdateFacturasCobro() { if (Datos_Cobros.Current == null) { Datos_FCobro.DataSource = null; return; } Charge cobro = (Charge)Datos_Cobros.Current; List <OutputInvoiceInfo> lista = new List <OutputInvoiceInfo>(); foreach (CobroFactura cf in cobro.CobroFacturas) { OutputInvoiceInfo info = _facturas_cliente.GetItem(cf.OidFactura); if (info != null) { lista.Add(info); } } Datos_FCobro.DataSource = OutputInvoiceList.GetChildList(lista); SetUnlinkedGridValues(Facturas_DGW.Name); }
protected void MarkAsActiva(DataGridViewRow row) { OutputInvoiceInfo item = row.DataBoundItem as OutputInvoiceInfo; item.Vinculado = Library.Invoice.Resources.Labels.SET_COBRO; row.Cells[Asignacion.Index].Style.BackColor = row.Cells[Pendiente.Index].Style.BackColor; }
private void Facturas_DGW_CellClick(object sender, DataGridViewCellEventArgs e) { if (Facturas_DGW.CurrentRow == null) { return; } if (e.ColumnIndex == -1) { return; } if (Facturas_DGW.Columns[e.ColumnIndex].Name == Vinculado.Name) { DataGridViewRow row = Facturas_DGW.CurrentRow; OutputInvoiceInfo item = row.DataBoundItem as OutputInvoiceInfo; if (row.Cells[Vinculado.Index].Value.ToString() == Library.Invoice.Resources.Labels.SET_COBRO) { LinkInvoiceAction(row); } else { UnlinkInvoiceAction(row); } SetUnlinkedGridValues(Facturas_DGW.Name); SetGridColors(Facturas_DGW.Name); } }
protected virtual void UnlinkInvoiceAction(DataGridViewRow row) { if (row == null) { return; } OutputInvoiceInfo item = row.DataBoundItem as OutputInvoiceInfo; if (item == null) { return; } UpdateAsignado(); item.Asignado = 0; CobroFactura cobro = _entity.CobroFacturas.GetItemByFactura(item.Oid); if (cobro != null) { _entity.CobroFacturas.Remove(cobro); item.Cobrado -= cobro.Cantidad; item.PendienteVencido += cobro.Cantidad; } UpdateAsignado(); MarkAsActiva(row); }
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 SetRowFormat(DataGridViewRow row) { if (!row.Displayed) { return; } if (row.IsNewRow) { return; } OutputInvoiceInfo item = row.DataBoundItem as OutputInvoiceInfo; Tabla.SuspendLayout(); Face.Common.ControlTools.Instance.SetRowColor(row, item.EEstado); if (item.EEstadoCobro == EEstado.DudosoCobro) { row.Cells[DiasTranscurridos.Name].Style = Face.Common.ControlTools.Instance.PendienteStyleE; } else { if (item.Cobrada) { return; } /*{ * row.Cells[DiasTranscurridos.Name].Style = Face.Common.ControlTools.Instance.CobradoStyle; * }*/ else if (0 <= item.DiasTranscurridos && item.DiasTranscurridos < 15) { row.Cells[DiasTranscurridos.Name].Style = Face.Common.ControlTools.Instance.PendienteStyleA; } else if (15 <= item.DiasTranscurridos && item.DiasTranscurridos < 31) { row.Cells[DiasTranscurridos.Name].Style = Face.Common.ControlTools.Instance.PendienteStyleB; } else if (31 <= item.DiasTranscurridos && item.DiasTranscurridos < 45) { row.Cells[DiasTranscurridos.Name].Style = Face.Common.ControlTools.Instance.PendienteStyleC; } else if (45 <= item.DiasTranscurridos && item.DiasTranscurridos < 60) { row.Cells[DiasTranscurridos.Name].Style = Face.Common.ControlTools.Instance.PendienteStyleD; } else { row.Cells[DiasTranscurridos.Name].Style = Face.Common.ControlTools.Instance.PendienteStyleE; } } Tabla.ResumeLayout(); }
protected bool Asignar() { if (_entity.EMedioPago == EMedioPago.CompensacionFactura) { decimal importe = 0; Datos_Facturas.MoveFirst(); foreach (DataGridViewRow row in Facturas_DGW.Rows) { OutputInvoiceInfo item = row.DataBoundItem as OutputInvoiceInfo; if (item.Vinculado == Library.Invoice.Resources.Labels.RESET_COBRO) { importe += item.Asignado; } Datos_Facturas.MoveNext(); } if (importe != 0) { PgMng.ShowInfoException("El importe total para este tipo de cobro debe ser 0."); _action_result = DialogResult.Ignore; return(false); } } else { if (_entity.Pendiente == 0) { return(true); } if (_entity.Importe < 0) { if (NoAsignado < _entity.Pendiente) { PgMng.ShowInfoException(string.Format("La asignación {0:C2} es inferior a la cantidad pendiente en el cobro {1:C2}.", NoAsignado, _entity.Pendiente)); _action_result = DialogResult.Ignore; return(false); } } else { if (NoAsignado > _entity.Pendiente) { PgMng.ShowInfoException(string.Format("La asignación {0:C2} es superior a la cantidad pendiente en el cobro {1:C2}.", NoAsignado, _entity.Pendiente)); _action_result = DialogResult.Ignore; return(false); } } } return(true); }
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); }
protected virtual void ViewFacturaEAction() { if (!ControlsMng.IsCurrentItemValid(FacturasE_DGW)) { return; } OutputInvoiceInfo invoice = ControlsMng.GetCurrentItem(FacturasE_DGW) as OutputInvoiceInfo; InvoiceViewForm form = new InvoiceViewForm(invoice.Oid, this); form.ShowDialog(this); }
protected virtual void VerPendienteAction() { if (Pendientes_DGW.CurrentRow == null) { return; } OutputInvoiceInfo factura = Pendientes_DGW.CurrentRow.DataBoundItem as OutputInvoiceInfo; InvoiceViewForm form = new InvoiceViewForm(factura.Oid, this); form.ShowDialog(this); }
public void SetOutputInvoiceSource(OutputInvoiceInfo source) { if (source == null) { return; } SetSourceClient(ClienteInfo.Get(source.OidCliente, false)); _out_invoices.Clear(); _out_invoices.Add(source); SetSourceDeliveries(_out_deliveries); }
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(); } }
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 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; } }
protected virtual void LinkInvoiceAction(DataGridViewRow row) { if (row == null) { return; } OutputInvoiceInfo item = row.DataBoundItem as OutputInvoiceInfo; if (item == null) { return; } UpdateAsignado(); if (_entity.EMedioPago != EMedioPago.CompensacionFactura) { //No permitimos asociar facturas si no queda asignado y la factura es distinto de cero if ((NoAsignado == 0) && (item.Total != 0)) { UnlinkInvoiceAction(row); return; } } //Se le ha asignado algo a mano if (item.Asignado != 0) { if (_entity.EMedioPago != EMedioPago.CompensacionFactura) { //Cobros en positivo if (_entity.Importe >= 0) { if (item.Asignado > NoAsignado) { item.Asignado = NoAsignado; } if (item.Asignado > item.PendienteVencido) { item.Asignado = item.PendienteVencido; } } //Cobros en negativo. Abonos else { if (item.Asignado < NoAsignado) { item.Asignado = NoAsignado; } if (item.Asignado < item.PendienteVencido) { item.Asignado = item.PendienteVencido; } } } } else { if (_entity.EMedioPago != EMedioPago.CompensacionFactura) { //Cobros en positivo if (_entity.Importe >= 0) { if (item.PendienteVencido <= NoAsignado) { item.Asignado = item.PendienteVencido; } else { item.Asignado = NoAsignado; } } //Cobros en negativo. Abonos else { if (item.PendienteVencido >= NoAsignado) { item.Asignado = item.PendienteVencido; } else { item.Asignado = NoAsignado; } } } else { item.Asignado = item.PendienteVencido; } } CobroFactura cobro = _entity.CobroFacturas.GetItemByFactura(item.Oid); if (cobro == null) { cobro = _entity.CobroFacturas.NewItem(_entity, item); item.FechaAsignacion = DateTime.Now.ToShortDateString(); item.Cobrado += cobro.Cantidad; item.PendienteVencido -= cobro.Cantidad; } else { item.Cobrado -= cobro.Cantidad; item.PendienteVencido += cobro.Cantidad; cobro.CopyFrom(_entity, item); item.Cobrado += cobro.Cantidad; item.PendienteVencido -= cobro.Cantidad; item.FechaAsignacion = DateTime.Now.ToShortDateString(); } UpdateAsignado(); MarkAsNoActiva(row); }
protected override void GetFormSourceData(long oid) { _entity = OutputInvoiceInfo.Get(oid, true); }
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(); } }
public CompanyExporterActionForm(Form parent, OutputInvoiceInfo source) : this(parent) { SetOutputInvoiceSource(source); }
public InvoiceChargesForm(OutputInvoiceInfo source, Form parent) : this(-1, new object[1] { source }, parent) { }