public override Lfx.Types.OperationResult SolicitudEliminacion(Lbl.ListaIds codigos) { using (Lui.Forms.YesNoDialog Pregunta = new Lui.Forms.YesNoDialog(@"Una vez anulados, los comprobantes deberán ser archivados en todas sus copias y no podrán ser rehabilitados ni reutilizados.", @"¿Está seguro de que desea anular?")) { Pregunta.DialogButtons = Lui.Forms.DialogButtons.YesNo; if (Pregunta.ShowDialog() == System.Windows.Forms.DialogResult.OK) { int IdRemito = codigos[0]; System.Data.IDbTransaction Trans = this.Connection.BeginTransaction(System.Data.IsolationLevel.Serializable); System.Data.DataTable Tabla = this.Connection.Select("select id_comprob from comprob where id_remito=" + IdRemito + " and anulada=0;"); if (Tabla == null || Tabla.Rows.Count == 0) { Lbl.Comprobantes.ComprobanteConArticulos Rem = new Lbl.Comprobantes.ComprobanteConArticulos(Connection, IdRemito); if (Rem.Anulado == false) { Rem.Anular(false); Trans.Commit(); } } else { Lui.Forms.MessageBox.Show("No se puede anular si se encuentra relacionada con una factura", "¡Error!"); } } } return(new Lfx.Types.SuccessOperationResult()); }
private void DepositarPagar_Click(object sender, System.EventArgs e) { if (this.Emitidos == false) { //Depositar Lbl.ListaIds Codigos = this.CodigosSeleccionados; if (Codigos == null || Codigos.Count == 0) { Lui.Forms.MessageBox.Show("Por favor seleccione uno o más cheques.", "Error"); } else { Lui.Forms.YesNoDialog Pregunta = new Lui.Forms.YesNoDialog("Al depositar un cheque en una cuenta bancaria propia, puede marcarlo como depositado para control interno.\nSirve sólamente para depositos en cajas propias. Para depósitos en cajas de terceros utilice la opción 'Efectivizar'.", "¿Desea marcar los cheques seleccionados como depositados?"); if (Pregunta.ShowDialog() == DialogResult.OK) { using (IDbTransaction Trans = this.Connection.BeginTransaction()) { qGen.Update Depo = new qGen.Update("bancos_cheques"); Depo.ColumnValues.AddWithValue("estado", 5); Depo.WhereClause = new qGen.Where(); Depo.WhereClause.AddWithValue("estado", 0); Depo.WhereClause.AddWithValue("id_cheque", qGen.ComparisonOperators.In, Codigos); this.Connection.ExecuteNonQuery(Depo); Trans.Commit(); } foreach (System.Windows.Forms.ListViewItem itm in Listado.Items) { if (itm.Checked) { itm.Checked = false; } } this.RefreshList(); } } } else { Lfx.Types.OperationResult Res = this.Pagar(); if (Res.Success == false && Res.Message != null) { Lfx.Workspace.Master.RunTime.Toast(Res.Message, "Error"); } } }
private void BotonEfectivizar_Click(object sender, System.EventArgs e) { if (this.Emitidos == false) { //Depositar Lbl.ListaIds Codigos = this.CodigosSeleccionados; if (Codigos == null || Codigos.Count == 0) { Lui.Forms.MessageBox.Show("Por favor seleccione uno o más cheques.", "Error"); } else { Lfx.Types.OperationResult Res = this.Efectivizar(); if (Res.Success == false && Res.Message != null) { Lfx.Workspace.Master.RunTime.Toast(Res.Message, "Error"); } } } else { Lfx.Workspace.Master.RunTime.Toast("Esta opción sólo sirve para cheques recibidos.", "Aviso"); } }
public override Lfx.Types.OperationResult SolicitudEliminacion(Lbl.ListaIds codigos) { Lfx.Workspace.Master.RunTime.Execute("INSTANCIAR Lfc.Comprobantes.Recibos.Anular " + codigos[0].ToString()); return(new Lfx.Types.SuccessOperationResult()); }
public override Lfx.Types.OperationResult Guardar() { this.Articulos.ElementoPadre = this; qGen.TableCommand Comando; if (this.Existe == false) { Comando = new qGen.Insert(this.Connection, this.TablaDatos); } else { Comando = new qGen.Update(this.Connection, this.TablaDatos); Comando.WhereClause = new qGen.Where(this.CampoId, this.Id); } if (this.Existe == false && this.Numero == 0 && this.Tipo.NumerarAlGuardar) { this.Numerar(false); } if (this.Fecha.Year == 1) { Comando.Fields.AddWithValue("fecha", qGen.SqlFunctions.Now); } else { Comando.Fields.AddWithValue("fecha", this.Fecha); } if (this.ComprobanteOriginal == null) Comando.Fields.AddWithValue("id_comprob_orig", null); else Comando.Fields.AddWithValue("id_comprob_orig", this.ComprobanteOriginal.Id); if(this.FormaDePago == null) Comando.Fields.AddWithValue("id_formapago", null); else Comando.Fields.AddWithValue("id_formapago", FormaDePago.Id); if (this.Vendedor == null) Comando.Fields.AddWithValue("id_vendedor", null); else Comando.Fields.AddWithValue("id_vendedor", this.Vendedor.Id); if (this.Sucursal == null) Comando.Fields.AddWithValue("id_sucursal", Lfx.Workspace.Master.CurrentConfig.Empresa.SucursalActual); else Comando.Fields.AddWithValue("id_sucursal", this.Sucursal.Id); if (this.IdRemito == 0) Comando.Fields.AddWithValue("id_remito", null); else Comando.Fields.AddWithValue("id_remito", this.IdRemito); Comando.Fields.AddWithValue("pv", this.PV); Comando.Fields.AddWithValue("numero", this.Numero); Comando.Fields.AddWithValue("nombre", this.PV.ToString("0000") + "-" + this.Numero.ToString("00000000")); Comando.Fields.AddWithValue("id_cliente", Lfx.Data.Connection.ConvertZeroToDBNull(this.Cliente.Id)); if (this.SituacionOrigen == null) Comando.Fields.AddWithValue("situacionorigen", null); else Comando.Fields.AddWithValue("situacionorigen", this.SituacionOrigen.Id); if (this.SituacionDestino == null) Comando.Fields.AddWithValue("situaciondestino", null); else Comando.Fields.AddWithValue("situaciondestino", this.SituacionDestino.Id); Comando.Fields.AddWithValue("tipo_fac", this.Tipo.Nomenclatura); Comando.Fields.AddWithValue("subtotal", this.SubTotalSinIva); Comando.Fields.AddWithValue("descuento", this.Descuento); Comando.Fields.AddWithValue("interes", this.Recargo); Comando.Fields.AddWithValue("cuotas", this.Cuotas); Comando.Fields.AddWithValue("total", this.Total); Comando.Fields.AddWithValue("iva", this.ImporteIva); Comando.Fields.AddWithValue("totalreal", this.TotalSinRedondeo); Comando.Fields.AddWithValue("gastosenvio", this.GastosDeEnvio); Comando.Fields.AddWithValue("otrosgastos", this.OtrosGastos); Comando.Fields.AddWithValue("obs", this.Obs); // Lo comprobantes de compra se marcan siempre como impresos Comando.Fields.AddWithValue("impresa", this.Compra ? 1 : (this.Impreso ? 1 : 0)); Comando.Fields.AddWithValue("compra", this.Compra ? 1 : 0); Comando.Fields.AddWithValue("estado", this.Estado); Comando.Fields.AddWithValue("series", this.Articulos.DatosSeguimiento); if (this.Tipo.EsFacturaOTicket == false && this.Tipo.EsNotaDebito == false) { // Este comprobante no es cancelable this.ImporteCancelado = this.Total; Comando.Fields.AddWithValue("cancelado", this.Total); } this.AgregarTags(Comando); this.Connection.Execute(Comando); this.ActualizarId(); this.GuardarDetalle(); if (this.Compra) { if (this.Tipo.MueveExistencias != 0) { // Comprobantes de compra mueven stock al guardar Lfx.Types.OperationResult Res = VerificarSeries(); if (Res.Success == false) return Res; } if (this.Tipo.EsFacturaNCoND) this.AsentarPago(false); if (this.Tipo.MueveExistencias != 0) { // Comprobantes de compra mueven stock al guardar this.MoverExistencias(false); Lbl.ListaIds ArticulosAfectados = new Lbl.ListaIds(); foreach (DetalleArticulo Det in m_Articulos) { if (Det.IdArticulo != 0 && ArticulosAfectados.Contains(Det.IdArticulo) == false) ArticulosAfectados.Add(Det.IdArticulo); } if (m_ArticulosOriginales != null) { foreach (DetalleArticulo Det in m_ArticulosOriginales) { if (Det.IdArticulo > 0 && ArticulosAfectados.Contains(Det.IdArticulo) == false) ArticulosAfectados.Add(Det.IdArticulo); } } if (ArticulosAfectados.Count > 0) { string ArtCsv = ArticulosAfectados.ToString(); // Actualizo cantidades pedidas y a pedir Connection.ExecuteSql(@"UPDATE articulos SET apedir=( SELECT SUM(cantidad) FROM comprob, comprob_detalle WHERE comprob.id_comprob=comprob_detalle.id_comprob AND comprob.compra=1 AND tipo_fac='NP' AND estado=50 AND comprob_detalle.id_articulo=articulos.id_articulo) WHERE control_stock=1 AND id_articulo IN (" + ArtCsv + " )"); Connection.ExecuteSql(@"UPDATE articulos SET pedido=( SELECT SUM(cantidad) FROM comprob, comprob_detalle WHERE comprob.id_comprob=comprob_detalle.id_comprob AND comprob.compra=1 AND tipo_fac='PD' AND estado=50 AND comprob_detalle.id_articulo=articulos.id_articulo) WHERE control_stock=1 AND id_articulo IN (" + ArtCsv + " )"); } } } return base.Guardar(); }