public static void UpdateWithValidation(tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaRow row) { ApplicationAssert.Check(row != null, "El argumento row no debe ser nulo.", ApplicationAssert.LineNumber); if (RowIsValid(row)) { Update(row); } }
public static void Update(tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaRow row) { if (row.RowState == DataRowState.Detached) { ((tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaDataTable)row.Table).Addtsa_ComprobanteDetalleDeudaRow(row); } Update(row.Table); }
/// <summary> /// Obtiene un registro de la tabla tsa_ComprobanteDetalleDeuda que luego puede ser persistido en la base de datos. /// </summary> public static tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaRow GetByPk(string IdComprobante, short Cuota) { tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaRow row = mz.erp.dataaccess.tsa_ComprobanteDetalleDeuda.GetByPk(IdComprobante, Cuota); if (row != null) { foreach (DataColumn dc in row.Table.Columns) { if (row[dc] == System.DBNull.Value) { row[dc] = Util.DefaultValue(dc.DataType); } } } return(row); }
private void CommitComprobanteDetalleDeuda() { tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaRow row = ((tsa_ComprobanteDetalleDeudaDataset)_dataComprobantesDetalleDeuda).tsa_ComprobanteDetalleDeuda.Newtsa_ComprobanteDetalleDeudaRow(); row.IdComprobante = mz.erp.systemframework.Util.NewStringId(); row.IdTipoDeComprobante = this.TipoComprobanteDestino; row.Numero = this.Numero; row.FechaEmision = mz.erp.systemframework.Util.AddTime(this.FechaComprobante, mz.erp.businessrules.Sistema.DateTime.Now); row.Cuota = 1; row.FechaVencimiento = row.FechaEmision; row.Importe = this._total * this._signoCuentaCorriente; row.Saldo = this._total * this._signoCuentaCorriente; row.IdMonedaCierre = Variables.GetValueString("Contabilidad.MonedaReferencia"); row.IdCotizacionCierre = Variables.GetValueString("Contabilidad.CotizacionReferencia"); row.IdSucursal = Security.IdSucursal; row.IdEmpresa = Security.IdEmpresa; ((tsa_ComprobanteDetalleDeudaDataset)_dataComprobantesDetalleDeuda).tsa_ComprobanteDetalleDeuda.Rows.Add(row); string IdCuenta = this._cuenta.IdCuenta; decimal Importe = row.Importe; string IdTipoDeComprobante = this.TipoComprobanteDestino; GuardarSaldoCuentaCorriente.GetInstance().CommitSaldoCuentaCorriente(this.GetProcessManagerParent().Process, IdCuenta, Importe, IdTipoDeComprobante); }
public void Commit() { if (this._origen.Equals("CLIENTES")) { bool masNegativos = _ctaCte.CantPagosNegativos >= _ctaCte.CantPagosPositivos; ArrayList negativos = _ctaCte.GetDetallePagos(-1); ArrayList positivos = _ctaCte.GetDetallePagos(1); ItemCuentaCorriente iccSingle = null; if (masNegativos) { #region Inserta Comporbantes con Signo Negativo iccSingle = (ItemCuentaCorriente)positivos[0]; #region para q sirve? // Para que sirve???? /*if ( this._origen.Equals("CLIENTES") ) * { * tsa_ComprobantesDataset.tsa_ComprobantesRow rowComp = mz.erp.dataaccess.tsa_Comprobantes.GetByPk(iccSingle.IdComprobante); * if (rowComp == null) * rowComp = mz.erp.businessrules.tsa_Comprobantes.GetByPk(iccSingle.IdComprobante); * _dataTsa_Comprobantes.tsa_Comprobantes.ImportRow(rowComp); * } * else * { * tpu_ComprobantesDataset.tpu_ComprobantesRow rowComp = mz.erp.dataaccess.tpu_Comprobantes.GetByPk(iccSingle.IdComprobante); * if (rowComp == null) * rowComp = mz.erp.businessrules.tpu_Comprobantes.GetByPk(iccSingle.IdComprobante); * _dataTpu_Comprobantes.tpu_Comprobantes.ImportRow(rowComp); * } * // ---------------- */ #endregion // iccSingle --> Recibos... // icc --> Fact, Prefacturas.... foreach (ItemCuentaCorriente icc in negativos) { tsa_AplicacionPagosDataset.tsa_AplicacionPagosRow row = _tsa_AplicacionPagosDataSet.tsa_AplicacionPagos.Newtsa_AplicacionPagosRow(); row.IdComprobanteOrigen = icc.IdComprobante; row.CuotaOrigen = (short)icc.Cuota; row.IdComprobanteDestino = iccSingle.IdComprobante; row.IdTipoComprobanteOrigen = icc.IdTipoDeComprobante; row.Importe = icc.Pago; row.IdTipoDeComprobanteDestino = iccSingle.IdTipoDeComprobante; row.CuotaDestino = 1; row.IdEmpresa = Security.IdEmpresa; row.IdSucursal = Security.IdSucursal; row.FechaCreacion = mz.erp.businessrules.Sistema.DateTime.Now; row.IdConexionCreacion = Security.IdConexion; row.IdConexionUltimaModificacion = Security.IdConexion; row.IdReservado = 0; row.RowId = Guid.Empty; _tsa_AplicacionPagosDataSet.tsa_AplicacionPagos.Addtsa_AplicacionPagosRow(row); #region borrar! si funciona lo de abajo /* * //tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaRow rowDeuda = mz.erp.dataaccess.tsa_ComprobanteDetalleDeuda.GetByPk(icc.IdComprobante, Convert.ToInt16(icc.Cuota)); * tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaRow rowDeuda = mz.erp.businessrules.tsa_ComprobanteDetalleDeuda.GetByPk(dcc.IdComprobante, Convert.ToInt16(dcc.Cuota)); * * if ( rowDeuda == null) * rowDeuda = mz.erp.businessrules.tsa_ComprobanteDetalleDeuda.GetByPk(icc.IdComprobante, Convert.ToInt16(icc.Cuota)); * * int signo = Convert.ToInt32( tsy_TiposDeComprobantes.GetByPk(Convert.ToString(rowDeuda.IdTipoDeComprobante)).signo); * rowDeuda.Saldo = (decimal) rowDeuda.Saldo * signo; * rowDeuda.Saldo = (decimal) rowDeuda.Saldo - icc.Pago; * rowDeuda.Saldo = (decimal) rowDeuda.Saldo * signo; * * _tsa_ComprobanteDetalleDeuda.tsa_ComprobantesDetalleDeuda.ImportRow(rowDeuda); */ #endregion try { tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaRow rowDeuda = _tsa_ComprobanteDetalleDeudaDataSet.tsa_ComprobanteDetalleDeuda.FindByIdComprobanteCuota(icc.IdComprobante, Convert.ToInt16(icc.Cuota)); int signo = Convert.ToInt32(tsy_TiposDeComprobantes.GetByPk((string)rowDeuda["IdTipoDeComprobante"]).signo); rowDeuda["saldo"] = (decimal)rowDeuda["saldo"] * signo; rowDeuda["Saldo"] = (decimal)rowDeuda["Saldo"] - icc.Pago; rowDeuda["Saldo"] = (decimal)rowDeuda["Saldo"] * signo; } catch (Exception e) { tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaRow rowDeuda2 = mz.erp.businessrules.tsa_ComprobanteDetalleDeuda.GetByPk(icc.IdComprobante, Convert.ToInt16(icc.Cuota)); if (rowDeuda2 != null) { int signo = Convert.ToInt32(tsy_TiposDeComprobantes.GetByPk((string)rowDeuda2["IdTipoDeComprobante"]).signo); rowDeuda2["saldo"] = (decimal )rowDeuda2["saldo"] * signo; rowDeuda2["Saldo"] = (decimal)rowDeuda2["Saldo"] - icc.Pago; rowDeuda2["Saldo"] = (decimal)rowDeuda2["Saldo"] * signo; _tsa_ComprobanteDetalleDeudaDataSet.tsa_ComprobanteDetalleDeuda.ImportRow(rowDeuda2); } } //System.Data.DataRow rowComprobanteImputado = data.tsa_Comprobantes.FindByIdComprobante(dcc.IdComprobante); //if (rowComprobanteImputado == null) // rowComprobanteImputado = mz.erp.businessrules.tsa_Comprobantes.GetByPk(dcc.IdComprobante); //data.tsa_Comprobantes.ImportRow(rowComprobanteImputado); } tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaRow rowDeudaSingle = mz.erp.dataaccess.tsa_ComprobanteDetalleDeuda.GetByPk(iccSingle.IdComprobante, Convert.ToInt16(iccSingle.Cuota)); if (rowDeudaSingle == null) { rowDeudaSingle = mz.erp.businessrules.tsa_ComprobanteDetalleDeuda.GetByPk(iccSingle.IdComprobante, Convert.ToInt16(iccSingle.Cuota)); } int signoSingle = Convert.ToInt32(tsy_TiposDeComprobantes.GetByPk(Convert.ToString(rowDeudaSingle.IdTipoDeComprobante)).signo); rowDeudaSingle.Saldo = (decimal)rowDeudaSingle.Saldo * signoSingle; rowDeudaSingle.Saldo = (decimal)rowDeudaSingle.Saldo - iccSingle.Pago; rowDeudaSingle.Saldo = (decimal)rowDeudaSingle.Saldo * signoSingle; _tsa_ComprobanteDetalleDeudaDataSet.tsa_ComprobanteDetalleDeuda.ImportRow(rowDeudaSingle); #endregion } else { #region Inserta Comporbantes con Signo Positivos iccSingle = (ItemCuentaCorriente)negativos[0]; // icc --> Recibos, Notas de creditos, RET foreach (ItemCuentaCorriente icc in positivos) { tsa_AplicacionPagosDataset.tsa_AplicacionPagosRow row = _tsa_AplicacionPagosDataSet.tsa_AplicacionPagos.Newtsa_AplicacionPagosRow(); row.IdComprobanteOrigen = iccSingle.IdComprobante; row.CuotaOrigen = 1; //(short) icc.Cuota; row.IdComprobanteDestino = icc.IdComprobante; row.IdTipoComprobanteOrigen = iccSingle.IdTipoDeComprobante; row.Importe = icc.Pago; row.IdTipoDeComprobanteDestino = icc.IdTipoDeComprobante; row.CuotaDestino = (short)icc.Cuota; //1; row.IdEmpresa = Security.IdEmpresa; row.IdSucursal = Security.IdSucursal; row.FechaCreacion = mz.erp.businessrules.Sistema.DateTime.Now; row.IdConexionCreacion = Security.IdConexion; row.IdConexionUltimaModificacion = Security.IdConexion; row.IdReservado = 0; row.RowId = Guid.Empty; _tsa_AplicacionPagosDataSet.tsa_AplicacionPagos.Addtsa_AplicacionPagosRow(row); try { tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaRow rowDeuda = _tsa_ComprobanteDetalleDeudaDataSet.tsa_ComprobanteDetalleDeuda.FindByIdComprobanteCuota(icc.IdComprobante, Convert.ToInt16(icc.Cuota)); int signo = Convert.ToInt32(tsy_TiposDeComprobantes.GetByPk((string)rowDeuda["IdTipoDeComprobante"]).signo); rowDeuda["saldo"] = (decimal )rowDeuda["saldo"] * signo; rowDeuda["Saldo"] = (decimal)rowDeuda["Saldo"] - icc.Pago; rowDeuda["Saldo"] = (decimal)rowDeuda["Saldo"] * signo; } catch (Exception e) { tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaRow rowDeuda2 = mz.erp.businessrules.tsa_ComprobanteDetalleDeuda.GetByPk(icc.IdComprobante, Convert.ToInt16(icc.Cuota)); if (rowDeuda2 != null) { int signo = Convert.ToInt32(tsy_TiposDeComprobantes.GetByPk((string)rowDeuda2["IdTipoDeComprobante"]).signo); rowDeuda2["saldo"] = (decimal )rowDeuda2["saldo"] * signo; rowDeuda2["Saldo"] = (decimal)rowDeuda2["Saldo"] - icc.Pago; rowDeuda2["Saldo"] = (decimal)rowDeuda2["Saldo"] * signo; _tsa_ComprobanteDetalleDeudaDataSet.tsa_ComprobanteDetalleDeuda.ImportRow(rowDeuda2); } } } tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaRow rowDeudaSingle = mz.erp.dataaccess.tsa_ComprobanteDetalleDeuda.GetByPk(iccSingle.IdComprobante, Convert.ToInt16(iccSingle.Cuota)); if (rowDeudaSingle == null) { rowDeudaSingle = mz.erp.businessrules.tsa_ComprobanteDetalleDeuda.GetByPk(iccSingle.IdComprobante, Convert.ToInt16(iccSingle.Cuota)); } int signoSingle = Convert.ToInt32(tsy_TiposDeComprobantes.GetByPk(Convert.ToString(rowDeudaSingle.IdTipoDeComprobante)).signo); rowDeudaSingle.Saldo = (decimal)rowDeudaSingle.Saldo * signoSingle; rowDeudaSingle.Saldo = (decimal)rowDeudaSingle.Saldo - iccSingle.Pago; rowDeudaSingle.Saldo = (decimal)rowDeudaSingle.Saldo * signoSingle; _tsa_ComprobanteDetalleDeudaDataSet.tsa_ComprobanteDetalleDeuda.ImportRow(rowDeudaSingle); #endregion } } else // "PROVEEDORES" { bool masNegativos = _ctaCte.CantPagosNegativos >= _ctaCte.CantPagosPositivos; ArrayList negativos = _ctaCte.GetDetallePagos(-1); ArrayList positivos = _ctaCte.GetDetallePagos(1); ItemCuentaCorriente iccSingle = null; if (masNegativos) { #region Inserta Comporbantes con Signo Negativo iccSingle = (ItemCuentaCorriente)positivos[0]; // icc Negativos --> Pagos y notas de ?? foreach (ItemCuentaCorriente icc in negativos) { // iccSingle --> FACT de Proveedores tpu_AplicacionPagosDataset.tpu_AplicacionPagosRow row = _tpu_AplicacionPagosDataSet.tpu_AplicacionPagos.Newtpu_AplicacionPagosRow(); row.IdComprobanteOrigen = icc.IdComprobante; row.CuotaOrigen = 1; //(short) icc.Cuota; row.IdComprobanteDestino = iccSingle.IdComprobante; row.IdTipoComprobanteOrigen = icc.IdTipoDeComprobante; row.Importe = icc.Pago; row.IdTipoDeComprobanteDestino = iccSingle.IdTipoDeComprobante; row.CuotaDestino = (short)icc.Cuota;; row.IdEmpresa = Security.IdEmpresa; row.IdSucursal = Security.IdSucursal; row.FechaCreacion = mz.erp.businessrules.Sistema.DateTime.Now; row.IdConexionCreacion = Security.IdConexion; row.IdConexionUltimaModificacion = Security.IdConexion; row.IdReservado = 0; row.RowId = Guid.Empty; _tpu_AplicacionPagosDataSet.tpu_AplicacionPagos.Addtpu_AplicacionPagosRow(row); try { tpu_ComprobanteDetalleDeudaDataset.tpu_ComprobanteDetalleDeudaRow rowDeuda = _tpu_ComprobanteDetalleDeudaDataSet.tpu_ComprobanteDetalleDeuda.FindByIdComprobanteCuota(icc.IdComprobante, Convert.ToInt16(icc.Cuota)); int signo = Convert.ToInt32(tsy_TiposDeComprobantes.GetByPk((string)rowDeuda["IdTipoDeComprobante"]).signo); rowDeuda["saldo"] = (decimal)rowDeuda["saldo"] * signo; rowDeuda["Saldo"] = (decimal)rowDeuda["Saldo"] - icc.Pago; rowDeuda["Saldo"] = (decimal)rowDeuda["Saldo"] * signo; rowDeuda["SaldoTemporal"] = (decimal)rowDeuda["SaldoTemporal"] * signo; rowDeuda["SaldoTemporal"] = (decimal)rowDeuda["SaldoTemporal"] - icc.Pago; rowDeuda["SaldoTemporal"] = (decimal)rowDeuda["SaldoTemporal"] * signo; } catch (Exception e) { tpu_ComprobanteDetalleDeudaDataset.tpu_ComprobanteDetalleDeudaRow rowDeuda2 = mz.erp.businessrules.tpu_ComprobanteDetalleDeuda.GetByPk(icc.IdComprobante, Convert.ToInt16(icc.Cuota)); if (rowDeuda2 != null) { int signo = Convert.ToInt32(tsy_TiposDeComprobantes.GetByPk((string)rowDeuda2["IdTipoDeComprobante"]).signo); rowDeuda2["saldo"] = (decimal )rowDeuda2["saldo"] * signo; rowDeuda2["Saldo"] = (decimal)rowDeuda2["Saldo"] - icc.Pago; rowDeuda2["Saldo"] = (decimal)rowDeuda2["Saldo"] * signo; rowDeuda2["SaldoTemporal"] = (decimal)rowDeuda2["SaldoTemporal"] * signo; rowDeuda2["SaldoTemporal"] = (decimal)rowDeuda2["SaldoTemporal"] - icc.Pago; rowDeuda2["SaldoTemporal"] = (decimal)rowDeuda2["SaldoTemporal"] * signo; _tpu_ComprobanteDetalleDeudaDataSet.tpu_ComprobanteDetalleDeuda.ImportRow(rowDeuda2); } } } tpu_ComprobanteDetalleDeudaDataset.tpu_ComprobanteDetalleDeudaRow rowDeudaSingle = mz.erp.dataaccess.tpu_ComprobanteDetalleDeuda.GetByPk(iccSingle.IdComprobante, Convert.ToInt16(iccSingle.Cuota)); if (rowDeudaSingle == null) { rowDeudaSingle = mz.erp.businessrules.tpu_ComprobanteDetalleDeuda.GetByPk(iccSingle.IdComprobante, Convert.ToInt16(iccSingle.Cuota)); } int signoSingle = Convert.ToInt32(tsy_TiposDeComprobantes.GetByPk(Convert.ToString(rowDeudaSingle.IdTipoDeComprobante)).signo); rowDeudaSingle.Saldo = (decimal)rowDeudaSingle.Saldo * signoSingle; rowDeudaSingle.Saldo = (decimal)rowDeudaSingle.Saldo - iccSingle.Pago; rowDeudaSingle.Saldo = (decimal)rowDeudaSingle.Saldo * signoSingle; rowDeudaSingle.SaldoTemporal = (decimal)rowDeudaSingle.SaldoTemporal * signoSingle; rowDeudaSingle.SaldoTemporal = (decimal)rowDeudaSingle.SaldoTemporal - iccSingle.Pago; rowDeudaSingle.SaldoTemporal = (decimal)rowDeudaSingle.SaldoTemporal * signoSingle; _tpu_ComprobanteDetalleDeudaDataSet.tpu_ComprobanteDetalleDeuda.ImportRow(rowDeudaSingle); #endregion } else { #region Inserta Comporbantes con Signo Positivos iccSingle = (ItemCuentaCorriente)negativos[0]; // icc --> FACT de Proveedores; Notas de ?? foreach (ItemCuentaCorriente icc in positivos) { // iccSingle --> Pagos a Proveedores tpu_AplicacionPagosDataset.tpu_AplicacionPagosRow row = _tpu_AplicacionPagosDataSet.tpu_AplicacionPagos.Newtpu_AplicacionPagosRow(); row.IdComprobanteOrigen = iccSingle.IdComprobante; row.CuotaOrigen = 1; row.IdComprobanteDestino = icc.IdComprobante; row.IdTipoComprobanteOrigen = iccSingle.IdTipoDeComprobante; row.Importe = icc.Pago; row.IdTipoDeComprobanteDestino = icc.IdTipoDeComprobante; row.CuotaDestino = (short)icc.Cuota; row.IdEmpresa = Security.IdEmpresa; row.IdSucursal = Security.IdSucursal; row.FechaCreacion = mz.erp.businessrules.Sistema.DateTime.Now; row.IdConexionCreacion = Security.IdConexion; row.IdConexionUltimaModificacion = Security.IdConexion; row.IdReservado = 0; row.RowId = Guid.Empty; _tpu_AplicacionPagosDataSet.tpu_AplicacionPagos.Addtpu_AplicacionPagosRow(row); try { tpu_ComprobanteDetalleDeudaDataset.tpu_ComprobanteDetalleDeudaRow rowDeuda = _tpu_ComprobanteDetalleDeudaDataSet.tpu_ComprobanteDetalleDeuda.FindByIdComprobanteCuota(icc.IdComprobante, Convert.ToInt16(icc.Cuota)); int signo = Convert.ToInt32(tsy_TiposDeComprobantes.GetByPk((string)rowDeuda["IdTipoDeComprobante"]).signo); rowDeuda["saldo"] = (decimal )rowDeuda["saldo"] * signo; rowDeuda["Saldo"] = (decimal)rowDeuda["Saldo"] - icc.Pago; rowDeuda["Saldo"] = (decimal)rowDeuda["Saldo"] * signo; rowDeuda["saldoTemporal"] = (decimal )rowDeuda["saldoTemporal"] * signo; rowDeuda["saldoTemporal"] = (decimal)rowDeuda["saldoTemporal"] - icc.Pago; rowDeuda["saldoTemporal"] = (decimal)rowDeuda["saldoTemporal"] * signo; } catch (Exception e) { tpu_ComprobanteDetalleDeudaDataset.tpu_ComprobanteDetalleDeudaRow rowDeuda2 = mz.erp.businessrules.tpu_ComprobanteDetalleDeuda.GetByPk(icc.IdComprobante, Convert.ToInt16(icc.Cuota)); if (rowDeuda2 != null) { int signo = Convert.ToInt32(tsy_TiposDeComprobantes.GetByPk((string)rowDeuda2["IdTipoDeComprobante"]).signo); rowDeuda2["saldo"] = (decimal )rowDeuda2["saldo"] * signo; rowDeuda2["Saldo"] = (decimal)rowDeuda2["Saldo"] - icc.Pago; rowDeuda2["Saldo"] = (decimal)rowDeuda2["Saldo"] * signo; rowDeuda2["saldoTemporal"] = (decimal )rowDeuda2["saldoTemporal"] * signo; rowDeuda2["saldoTemporal"] = (decimal)rowDeuda2["saldoTemporal"] - icc.Pago; rowDeuda2["saldoTemporal"] = (decimal)rowDeuda2["saldoTemporal"] * signo; _tpu_ComprobanteDetalleDeudaDataSet.tpu_ComprobanteDetalleDeuda.ImportRow(rowDeuda2); } } } tpu_ComprobanteDetalleDeudaDataset.tpu_ComprobanteDetalleDeudaRow rowDeudaSingle = mz.erp.dataaccess.tpu_ComprobanteDetalleDeuda.GetByPk(iccSingle.IdComprobante, Convert.ToInt16(iccSingle.Cuota)); if (rowDeudaSingle == null) { rowDeudaSingle = mz.erp.businessrules.tpu_ComprobanteDetalleDeuda.GetByPk(iccSingle.IdComprobante, Convert.ToInt16(iccSingle.Cuota)); } int signoSingle = Convert.ToInt32(tsy_TiposDeComprobantes.GetByPk(Convert.ToString(rowDeudaSingle.IdTipoDeComprobante)).signo); rowDeudaSingle.Saldo = (decimal)rowDeudaSingle.Saldo * signoSingle; rowDeudaSingle.Saldo = (decimal)rowDeudaSingle.Saldo - iccSingle.Pago; rowDeudaSingle.Saldo = (decimal)rowDeudaSingle.Saldo * signoSingle; rowDeudaSingle.SaldoTemporal = (decimal)rowDeudaSingle.SaldoTemporal * signoSingle; rowDeudaSingle.SaldoTemporal = (decimal)rowDeudaSingle.SaldoTemporal - iccSingle.Pago; rowDeudaSingle.SaldoTemporal = (decimal)rowDeudaSingle.SaldoTemporal * signoSingle; _tpu_ComprobanteDetalleDeudaDataSet.tpu_ComprobanteDetalleDeuda.ImportRow(rowDeudaSingle); #endregion } } }
/// <summary> /// Valida un tsa_ComprobanteDetalleDeudaRow. /// </summary> public static bool RowIsValid(tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaRow row) { ApplicationAssert.Check(row != null, "El argumento row no debe ser nulo.", ApplicationAssert.LineNumber); bool isValid = true; string mensaje; if (!IdComprobanteIsValid(row.IdComprobante, out mensaje)) { row.SetColumnError("IdComprobante", mensaje); isValid = false; } if (!IdTipoDeComprobanteIsValid(row.IdTipoDeComprobante, out mensaje)) { row.SetColumnError("IdTipoDeComprobante", mensaje); isValid = false; } if (!NumeroIsValid(row.Numero, out mensaje)) { row.SetColumnError("Numero", mensaje); isValid = false; } if (!FechaEmisionIsValid(row.FechaEmision, out mensaje)) { row.SetColumnError("FechaEmision", mensaje); isValid = false; } if (!FechaVencimientoIsValid(row.FechaVencimiento, out mensaje)) { row.SetColumnError("FechaVencimiento", mensaje); isValid = false; } if (!CuotaIsValid(row.Cuota, out mensaje)) { row.SetColumnError("Cuota", mensaje); isValid = false; } if (!ImporteIsValid(row.Importe, out mensaje)) { row.SetColumnError("Importe", mensaje); isValid = false; } if (!SaldoIsValid(row.Saldo, out mensaje)) { row.SetColumnError("Saldo", mensaje); isValid = false; } if (!IdMonedaCierreIsValid(row.IdMonedaCierre, out mensaje)) { row.SetColumnError("IdMonedaCierre", mensaje); isValid = false; } if (!IdCotizacionCierreIsValid(row.IdCotizacionCierre, out mensaje)) { row.SetColumnError("IdCotizacionCierre", mensaje); isValid = false; } if (!FechaCreacionIsValid(row.FechaCreacion, out mensaje)) { row.SetColumnError("FechaCreacion", mensaje); isValid = false; } if (!IdConexionCreacionIsValid(row.IdConexionCreacion, out mensaje)) { row.SetColumnError("IdConexionCreacion", mensaje); isValid = false; } if (!UltimaModificacionIsValid(row.UltimaModificacion, out mensaje)) { row.SetColumnError("UltimaModificacion", mensaje); isValid = false; } if (!IdConexionUltimaModificacionIsValid(row.IdConexionUltimaModificacion, out mensaje)) { row.SetColumnError("IdConexionUltimaModificacion", mensaje); isValid = false; } if (!IdReservadoIsValid(row.IdReservado, out mensaje)) { row.SetColumnError("IdReservado", mensaje); isValid = false; } if (!RowIdIsValid(row.RowId, out mensaje)) { row.SetColumnError("RowId", mensaje); isValid = false; } if (!IdSucursalIsValid(row.IdSucursal, out mensaje)) { row.SetColumnError("IdSucursal", mensaje); isValid = false; } if (!IdEmpresaIsValid(row.IdEmpresa, out mensaje)) { row.SetColumnError("IdEmpresa", mensaje); isValid = false; } ; return(isValid); }
/// <summary> /// Envia los cambios del tsa_ComprobanteDetalleDeudaRow a la base de datos. /// </summary> public static void Update(tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaRow row) { ApplicationAssert.Check(row != null, "El argumento row no debe ser nulo.", ApplicationAssert.LineNumber); mz.erp.dataaccess.tsa_ComprobanteDetalleDeuda.Update(row); }
public void Update(CuentaCorriente ctaCte) { ComprobanteDePago cdp = (ComprobanteDePago)this.Comprobante; bool aplicacionDePago = false; tsa_ComprobantesExDataset data = cdp.DatasetComprobante; foreach (DetalleCuentaCorriente dcc in ctaCte.Detalle) { if (dcc.Pago > 0) { //Pues es un comprobante de Pago que tiene Pago > 0 //Esto implica que estamos ante una Aplicacion de Pago de un comprobante de pago //en la Cuenta Corriente if (dcc.Signo == 1) { aplicacionDePago = true; } //Si dcc.Signo == 1 significa que es un recibo que ya esta en la cuenta corriente y que a su //vez tiene pago >0, osea que estamos ante una situacion de Aplicacion de Pago string IdComprobate = dcc.IdComprobante; short Cuota = (short)dcc.Cuota; /* * if(cdp.ComprobanteDeVenta != null) * { * System.Data.DataRow row = cdp.ComprobanteDeVenta.DatasetComprobante.tsa_ComprobanteDetalleDeuda.FindByIdComprobanteCuota(IdComprobate, Cuota); * int signo =Convert.ToInt32( tsy_TiposDeComprobantes.GetByPk((string) row["IdTipoDeComprobante"]).signo); * row["saldo"] = (decimal )row["saldo"] * signo; * row["Saldo"] =(decimal) row["Saldo"] - dcc.Pago; * row["Saldo"] = (decimal) row["Saldo"] * signo; * //data.tsa_ComprobanteDetalleDeuda.ImportRow(row); * //data.tsa_ComprobanteDetalleDeuda.LoadDataRow(row.ItemArray,true); * * * } * * else * { */ try { System.Data.DataRow row = data.tsa_ComprobanteDetalleDeuda.FindByIdComprobanteCuota(IdComprobate, Cuota); int signo = Convert.ToInt32(tsy_TiposDeComprobantes.GetByPk((string)row["IdTipoDeComprobante"]).signo); row["saldo"] = (decimal )row["saldo"] * signo; row["Saldo"] = (decimal)row["Saldo"] - dcc.Pago; row["Saldo"] = (decimal)row["Saldo"] * signo; } catch (Exception e) { tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaRow row = mz.erp.businessrules.tsa_ComprobanteDetalleDeuda.GetByPk(IdComprobate, Cuota); if (row != null) { int signo = Convert.ToInt32(tsy_TiposDeComprobantes.GetByPk((string)row["IdTipoDeComprobante"]).signo); row["saldo"] = (decimal )row["saldo"] * signo; row["Saldo"] = (decimal)row["Saldo"] - dcc.Pago; row["Saldo"] = (decimal)row["Saldo"] * signo; } // pues si es un recibo ya fue agregado en la tabla de Comprobantes // Para cualquier otro comprobante que tenga signo == -1 y que tenga Pago > 0 hay que agreagrlo a la tabla // tsa_Comprobantes para que no de error de Foreing Key cuando intenetmos guardar los registros // en tsa_ComprobanteDetalleDeuda /* if (signo == -1) * { * System.Data.DataRow rowComprobanteCabecera = mz.erp.businessrules.tsa_Comprobantes.GetByPk((string ) row["IdComprobante"]); * data.tsa_Comprobantes.ImportRow((System.Data.DataRow)rowComprobanteCabecera); * }*/ data.tsa_ComprobanteDetalleDeuda.ImportRow((System.Data.DataRow)row); } //} } } //En este caso el recibo, se esta creando, por ende no esta en la cuenta corriente, osea que //hay que actualizar el detalle de deuda de este recibo que ya fue creado if (!aplicacionDePago) { System.Data.DataRow row = data.tsa_ComprobanteDetalleDeuda.FindByIdComprobanteCuota(cdp.IdComprobante, 1); int signo = Convert.ToInt32(tsy_TiposDeComprobantes.GetByPk((string)row["IdTipoDeComprobante"]).signo); row["Saldo"] = cdp.Saldo * cdp.Signo; } }
/// <summary> ///Fuerza la escritura de los datos en memoria al dataset del comprobante para poder ser enviados a almacenar en el RDBM /// </summary> /// public void CommitWF() { ComprobanteDePago cdp = this.Parent; tsa_ComprobantesExDataset data = cdp.DatasetComprobante; CuentaCorriente cc = this._parent.CuentaCorriente; bool masNegativos = cc.CantPagosNegativos >= cc.CantPagosPositivos; ArrayList negativos = cc.GetDetallePagos(-1); ArrayList positivos = cc.GetDetallePagos(1); DetalleCuentaCorriente dccSingle = null; if (masNegativos) { #region Inserta Comporbantes con Signo Negativo dccSingle = (DetalleCuentaCorriente)positivos[0]; DataRow rowComp = data.tsa_Comprobantes.FindByIdComprobante(dccSingle.IdComprobante); if (rowComp == null) { rowComp = mz.erp.businessrules.tsa_Comprobantes.GetByPk(dccSingle.IdComprobante); } data.tsa_Comprobantes.ImportRow(rowComp); foreach (DetalleCuentaCorriente dcc in negativos) { tsa_ComprobantesExDataset.tsa_AplicacionPagosRow row = data.tsa_AplicacionPagos.Newtsa_AplicacionPagosRow(); row.IdComprobanteOrigen = dcc.IdComprobante; row.CuotaOrigen = (short)dcc.Cuota; row.IdComprobanteDestino = dccSingle.IdComprobante; row.IdTipoComprobanteOrigen = dcc.IdTipoDeComprobante; row.Importe = dcc.Pago; row.IdTipoDeComprobanteDestino = dccSingle.IdTipoDeComprobante; row.CuotaDestino = 1; row.IdEmpresa = Security.IdEmpresa; row.IdSucursal = Security.IdSucursal; row.FechaCreacion = mz.erp.businessrules.Sistema.DateTime.Now; row.IdConexionCreacion = Security.IdConexion; row.IdConexionUltimaModificacion = Security.IdConexion; row.IdReservado = 0; row.RowId = Guid.Empty; System.Data.DataRow rowComprobanteImputado = data.tsa_Comprobantes.FindByIdComprobante(dcc.IdComprobante); if (rowComprobanteImputado == null) { rowComprobanteImputado = mz.erp.businessrules.tsa_Comprobantes.GetByPk(dcc.IdComprobante); } data.tsa_Comprobantes.ImportRow(rowComprobanteImputado); data.tsa_AplicacionPagos.Addtsa_AplicacionPagosRow(row); try { System.Data.DataRow row1 = data.tsa_ComprobanteDetalleDeuda.FindByIdComprobanteCuota(dcc.IdComprobante, Convert.ToInt16(dcc.Cuota)); int signo = Convert.ToInt32(tsy_TiposDeComprobantes.GetByPk((string)row1["IdTipoDeComprobante"]).signo); row1["saldo"] = (decimal )row1["saldo"] * signo; row1["Saldo"] = (decimal)row1["Saldo"] - dcc.Pago; row1["Saldo"] = (decimal)row1["Saldo"] * signo; } catch (Exception e) { tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaRow row2 = mz.erp.businessrules.tsa_ComprobanteDetalleDeuda.GetByPk(dcc.IdComprobante, Convert.ToInt16(dcc.Cuota)); if (row2 != null) { int signo = Convert.ToInt32(tsy_TiposDeComprobantes.GetByPk((string)row2["IdTipoDeComprobante"]).signo); row2["saldo"] = (decimal )row2["saldo"] * signo; row2["Saldo"] = (decimal)row2["Saldo"] - dcc.Pago; row2["Saldo"] = (decimal)row2["Saldo"] * signo; data.tsa_ComprobanteDetalleDeuda.ImportRow((System.Data.DataRow)row2); } } } try { System.Data.DataRow row3 = data.tsa_ComprobanteDetalleDeuda.FindByIdComprobanteCuota(dccSingle.IdComprobante, Convert.ToInt16(dccSingle.Cuota)); int signo = Convert.ToInt32(tsy_TiposDeComprobantes.GetByPk((string)row3["IdTipoDeComprobante"]).signo); row3["saldo"] = (decimal )row3["saldo"] * signo; row3["Saldo"] = (decimal)row3["Saldo"] - dccSingle.Pago; row3["Saldo"] = (decimal)row3["Saldo"] * signo; } catch (Exception e) { tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaRow row4 = mz.erp.businessrules.tsa_ComprobanteDetalleDeuda.GetByPk(dccSingle.IdComprobante, Convert.ToInt16(dccSingle.Cuota)); if (row4 != null) { int signo = Convert.ToInt32(tsy_TiposDeComprobantes.GetByPk((string)row4["IdTipoDeComprobante"]).signo); row4["saldo"] = (decimal )row4["saldo"] * signo; row4["Saldo"] = (decimal)row4["Saldo"] - dccSingle.Pago; row4["Saldo"] = (decimal)row4["Saldo"] * signo; data.tsa_ComprobanteDetalleDeuda.ImportRow((System.Data.DataRow)row4); } } #endregion } else { #region Inserta Comporbantes con Signo Positivos dccSingle = (DetalleCuentaCorriente)negativos[0]; DataRow rowComp = data.tsa_Comprobantes.FindByIdComprobante(dccSingle.IdComprobante); if (rowComp == null) { rowComp = mz.erp.businessrules.tsa_Comprobantes.GetByPk(dccSingle.IdComprobante); } data.tsa_Comprobantes.ImportRow(rowComp); foreach (DetalleCuentaCorriente dcc in positivos) { tsa_ComprobantesExDataset.tsa_AplicacionPagosRow row = data.tsa_AplicacionPagos.Newtsa_AplicacionPagosRow(); row.IdComprobanteOrigen = dccSingle.IdComprobante; row.CuotaOrigen = 1; row.IdComprobanteDestino = dcc.IdComprobante; row.IdTipoComprobanteOrigen = dccSingle.IdTipoDeComprobante; row.Importe = dcc.Pago; row.IdTipoDeComprobanteDestino = dcc.IdTipoDeComprobante; row.CuotaDestino = (short)dcc.Cuota; row.IdEmpresa = Security.IdEmpresa; row.IdSucursal = Security.IdSucursal; row.FechaCreacion = mz.erp.businessrules.Sistema.DateTime.Now; row.IdConexionCreacion = Security.IdConexion; row.IdConexionUltimaModificacion = Security.IdConexion; row.IdReservado = 0; row.RowId = Guid.Empty; System.Data.DataRow rowComprobanteImputado = data.tsa_Comprobantes.FindByIdComprobante(dcc.IdComprobante); if (rowComprobanteImputado == null) { rowComprobanteImputado = mz.erp.businessrules.tsa_Comprobantes.GetByPk(dcc.IdComprobante); } data.tsa_Comprobantes.ImportRow(rowComprobanteImputado); data.tsa_AplicacionPagos.Addtsa_AplicacionPagosRow(row); try { System.Data.DataRow row1 = data.tsa_ComprobanteDetalleDeuda.FindByIdComprobanteCuota(dcc.IdComprobante, Convert.ToInt16(dcc.Cuota)); int signo = Convert.ToInt32(tsy_TiposDeComprobantes.GetByPk((string)row1["IdTipoDeComprobante"]).signo); row1["saldo"] = (decimal )row1["saldo"] * signo; row1["Saldo"] = (decimal)row1["Saldo"] - dcc.Pago; row1["Saldo"] = (decimal)row1["Saldo"] * signo; } catch (Exception e) { tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaRow row2 = mz.erp.businessrules.tsa_ComprobanteDetalleDeuda.GetByPk(dcc.IdComprobante, Convert.ToInt16(dcc.Cuota)); if (row2 != null) { int signo = Convert.ToInt32(tsy_TiposDeComprobantes.GetByPk((string)row2["IdTipoDeComprobante"]).signo); row2["saldo"] = (decimal )row2["saldo"] * signo; row2["Saldo"] = (decimal)row2["Saldo"] - dcc.Pago; row2["Saldo"] = (decimal)row2["Saldo"] * signo; data.tsa_ComprobanteDetalleDeuda.ImportRow((System.Data.DataRow)row2); } } } try { System.Data.DataRow row3 = data.tsa_ComprobanteDetalleDeuda.FindByIdComprobanteCuota(dccSingle.IdComprobante, Convert.ToInt16(dccSingle.Cuota)); int signo = Convert.ToInt32(tsy_TiposDeComprobantes.GetByPk((string)row3["IdTipoDeComprobante"]).signo); row3["saldo"] = (decimal )row3["saldo"] * signo; row3["Saldo"] = (decimal)row3["Saldo"] - dccSingle.Pago; row3["Saldo"] = (decimal)row3["Saldo"] * signo; } catch (Exception e) { tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaRow row4 = mz.erp.businessrules.tsa_ComprobanteDetalleDeuda.GetByPk(dccSingle.IdComprobante, Convert.ToInt16(dccSingle.Cuota)); if (row4 != null) { int signo = Convert.ToInt32(tsy_TiposDeComprobantes.GetByPk((string)row4["IdTipoDeComprobante"]).signo); row4["saldo"] = (decimal )row4["saldo"] * signo; row4["Saldo"] = (decimal)row4["Saldo"] - dccSingle.Pago; row4["Saldo"] = (decimal)row4["Saldo"] * signo; data.tsa_ComprobanteDetalleDeuda.ImportRow((System.Data.DataRow)row4); } } #endregion } }
public bool DesimputarCliente(ItemCuentaCorriente icc) { _data_tsa_AplicacionPagos.Clear(); _data_tsa_ComprobanteDetalleDeuda.Clear(); decimal pago = 0; if (icc.Signo == 1) { // Es un recibo o una nota de credito, por ende hay que buscarlo por el campo IdComporbanteDestino // en la tabla tsa_AplicacionPagos _data_tsa_AplicacionPagos = mz.erp.businessrules.tsa_AplicacionPagos.GetList(null, short.MinValue, decimal.MinValue, icc.IdTipoDeComprobante, icc.IdComprobante, Convert.ToInt16(icc.Cuota)); foreach (tsa_AplicacionPagosDataset.tsa_AplicacionPagosRow row in _data_tsa_AplicacionPagos.tsa_AplicacionPagos.Rows) { bool getByPk = false; string IdComprobante = (string)row["IdComprobanteOrigen"]; short cuota = (short)row["CuotaOrigen"]; pago = pago + row.Importe; tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaRow rowDet = _data_tsa_ComprobanteDetalleDeuda.tsa_ComprobanteDetalleDeuda.FindByIdComprobanteCuota(IdComprobante, cuota); if (rowDet == null) { rowDet = mz.erp.businessrules.tsa_ComprobanteDetalleDeuda.GetByPk(IdComprobante, cuota); getByPk = true; } if (rowDet != null) { // tener emn cuenta el signo del saldo. rowDet.Saldo = rowDet.Saldo + (-1) * row.Importe; if (getByPk) { _data_tsa_ComprobanteDetalleDeuda.tsa_ComprobanteDetalleDeuda.ImportRow(rowDet); } row.Delete(); } } tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaRow rowDetalle1 = mz.erp.businessrules.tsa_ComprobanteDetalleDeuda.GetByPk(icc.IdComprobante, (short)icc.Cuota); //Se multiplica por 1 pues signo de saldo es positivo. Solo para consolidar los signos if (rowDetalle1 != null) { rowDetalle1.Saldo = rowDetalle1.Saldo + 1 * pago; _data_tsa_ComprobanteDetalleDeuda.tsa_ComprobanteDetalleDeuda.ImportRow(rowDetalle1); } } else { // Es una factura o una nota de debito, por ende hay que buscarlo por el campo IdComporbanteOrigen // en la tabla tsa_AplicacionPagos _data_tsa_AplicacionPagos = mz.erp.businessrules.tsa_AplicacionPagos.GetList(icc.IdComprobante, Convert.ToInt16(icc.Cuota), decimal.MinValue, null, null, short.MinValue); foreach (tsa_AplicacionPagosDataset.tsa_AplicacionPagosRow row in _data_tsa_AplicacionPagos.tsa_AplicacionPagos.Rows) { bool getByPk = false; string IdComprobante = (string)row["IdComprobanteDestino"]; short cuota = (short)row["CuotaDestino"]; pago = pago + row.Importe; tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaRow rowDet = _data_tsa_ComprobanteDetalleDeuda.tsa_ComprobanteDetalleDeuda.FindByIdComprobanteCuota(IdComprobante, cuota); if (rowDet == null) { rowDet = mz.erp.businessrules.tsa_ComprobanteDetalleDeuda.GetByPk(IdComprobante, cuota); getByPk = true; } if (rowDet != null) { // tener en cuenta el signo del saldo. rowDet.Saldo = rowDet.Saldo + (+1) * row.Importe; if (getByPk) { _data_tsa_ComprobanteDetalleDeuda.tsa_ComprobanteDetalleDeuda.ImportRow(rowDet); } row.Delete(); } } tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaRow rowDetalle2 = mz.erp.businessrules.tsa_ComprobanteDetalleDeuda.GetByPk(icc.IdComprobante, (short)icc.Cuota); // Tener en cuenta el signo. Se multiplica por -1 pues this.Signo = -1 y pues el signo de saldo // es negativo; Consolidacion de signos. if (rowDetalle2 != null) { rowDetalle2.Saldo = rowDetalle2.Saldo + (-1) * pago; _data_tsa_ComprobanteDetalleDeuda.tsa_ComprobanteDetalleDeuda.ImportRow(rowDetalle2); } } // Chequeo que se haya eliminado alguna imputación return(pago > 0); }
//Elimina las asociaciones que hay con este comprobante en la tabla tsa_AplicacionPagos //Actualiza la el detalle de la Cuenta Corriente (tabla tsa_ComporbantesDetalleDeuda) public bool Desimputar() { _dataAplicacionDePagos = new tsa_AplicacionPagosDataset(); _dataDetalleDeuda = new tsa_ComprobanteDetalleDeudaDataset(); decimal pago = 0; //Es un recibo o una nota de credito, por ende hay que buscarlo por el campo IdComporbanteDestino // en la tabla tsa_AplicacionPagos if (this.Signo == 1) { _dataAplicacionDePagos = mz.erp.businessrules.tsa_AplicacionPagos.GetList(null, short.MinValue, decimal.MinValue, this.IdTipoDeComprobante, this.IdComprobante, Convert.ToInt16(this.Cuota)); foreach (tsa_AplicacionPagosDataset.tsa_AplicacionPagosRow row in _dataAplicacionDePagos.tsa_AplicacionPagos.Rows) { string IdComprobante = (string)row["IdComprobanteOrigen"]; short cuota = (short)row["CuotaOrigen"]; pago = pago + row.Importe; try { tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaRow rowDetalle = mz.erp.businessrules.tsa_ComprobanteDetalleDeuda.GetByPk(IdComprobante, cuota); //tener emn cuenta el signo del saldo rowDetalle.Saldo = rowDetalle.Saldo + (-1) * row.Importe; _dataDetalleDeuda.tsa_ComprobanteDetalleDeuda.ImportRow(rowDetalle); } catch (Exception e) { tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaRow rowDet; rowDet = _dataDetalleDeuda.tsa_ComprobanteDetalleDeuda.FindByIdComprobanteCuota(IdComprobante, cuota); if (rowDet != null) { rowDet.Saldo = rowDet.Saldo + (-1) * row.Importe; } } row.Delete(); } tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaRow rowDetalle1 = mz.erp.businessrules.tsa_ComprobanteDetalleDeuda.GetByPk(this.IdComprobante, (short)this.Cuota); //Semultiplica por 1 pues signo de saldo es positivo. Solo para consolidar los signos if (rowDetalle1 != null) { rowDetalle1.Saldo = rowDetalle1.Saldo + 1 * pago; _dataDetalleDeuda.tsa_ComprobanteDetalleDeuda.ImportRow(rowDetalle1); } } //Es una factura o una nota de debito, por ende hay que buscarlo por el campo IdComporbanteOrigen // en la tabla tsa_AplicacionPagos else { _dataAplicacionDePagos = mz.erp.businessrules.tsa_AplicacionPagos.GetList(this.IdComprobante, Convert.ToInt16(this.Cuota), decimal.MinValue, null, null, short.MinValue); foreach (tsa_AplicacionPagosDataset.tsa_AplicacionPagosRow row in _dataAplicacionDePagos.tsa_AplicacionPagos.Rows) { string IdComprobante = (string)row["IdComprobanteDestino"]; short cuota = (short)row["CuotaDestino"]; pago = pago + row.Importe; try { tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaRow rowDetalle = mz.erp.businessrules.tsa_ComprobanteDetalleDeuda.GetByPk(IdComprobante, cuota); //tener en cuenta el signo del saldo rowDetalle.Saldo = rowDetalle.Saldo + 1 * row.Importe; _dataDetalleDeuda.tsa_ComprobanteDetalleDeuda.ImportRow(rowDetalle); } catch (Exception e) { tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaRow rowDet; rowDet = _dataDetalleDeuda.tsa_ComprobanteDetalleDeuda.FindByIdComprobanteCuota(IdComprobante, cuota); rowDet.Saldo = rowDet.Saldo + 1 * row.Importe; } row.Delete(); } tsa_ComprobanteDetalleDeudaDataset.tsa_ComprobanteDetalleDeudaRow rowDetalle2 = mz.erp.businessrules.tsa_ComprobanteDetalleDeuda.GetByPk(this.IdComprobante, (short)this.Cuota); //Tener en cuenta el signo. Se multiplica por -1 pues this.Signo = -1 y pues el signo de saldo es negativo //Consolidacion de signos if (rowDetalle2 != null) { rowDetalle2.Saldo = rowDetalle2.Saldo + (-1) * pago; _dataDetalleDeuda.tsa_ComprobanteDetalleDeuda.ImportRow(rowDetalle2); } } //Chequeo que se haya echo alguna desimputacion return(pago > 0); }