public void GetDetalleCuentaCorrienteSoloPendientes(string process) { bool visualizaDetalle = Variables.GetValueBool("Momentos." + process + ".VisualizaDetalleComprobantes"); string metodoVisualizacion = Variables.GetValueString("Momentos." + process + ".MetodoVisualizacionDetalle"); bool VerHTML = false; if (visualizaDetalle && metodoVisualizacion.Equals("AUTOMATICO")) { VerHTML = true; } System.Data.DataSet data = tsa_CuentaCorriente.GetDetalleCuentaCorriente(this.IdCuenta, this.FechaDesde, this.FechaHasta, this.OrderBy, this.Comprobantes(process), VerHTML); System.Data.DataTable tabla = data.Tables[0]; //System.Data.DataView view = new System.Data.DataView(tabla,"Saldo >0",null,System.Data.DataViewRowState.OriginalRows); //tabla = view.Table; decimal saldoAnteriorSoloPendientes = this.SaldoAnterior; this.Detalle = new ArrayList(); foreach (System.Data.DataRow row in tabla.Rows) { if (Convert.ToInt32(row["Saldo"]) != 0) { DetalleCuentaCorriente dcc = this.GetDetalleCuentaCorriente(row); saldoAnteriorSoloPendientes = saldoAnteriorSoloPendientes - dcc.Saldo; dcc.SaldoAcumuladoSoloPendientes = saldoAnteriorSoloPendientes; this.Detalle.Add(dcc); } } }
private DetalleCuentaCorriente GetDetalleCuentaCorrienteDatosMinimos(System.Data.DataRow row) { DetalleCuentaCorriente dcc = new DetalleCuentaCorriente(); dcc.ExtractDatosMinimos(row); return(dcc); }
/* public static CuentaCorriente GetCuentaCorrienteGeneral(DateTime fecha, string orderBy) * { * CuentaCorriente ctaCte = new CuentaCorriente(); * ctaCte.IdCuenta= null; * ctaCte.FechaDesde= mz.erp.businessrules.Sistema.DateTime.Now; * ctaCte.FechaHasta= fecha; * ctaCte.SaldoAnterior = 0; * ctaCte.Detalle = new ArrayList(); * ctaCte.SaldoPosterior=0; * ctaCte.TotalImputado = 0; * ctaCte.OrderBy = orderBy; * ctaCte.Cuenta = null; * return ctaCte; * }*/ #endregion #region DetalleCuentaCorriente public static DetalleCuentaCorriente GetDetalleCuentaCorriente(string IdComprobante, string Comprobante, string Numero, DateTime FechaVencimiento, DateTime FechaEmision, int Cuota, decimal Importe, decimal Saldo, decimal Total, int signo, string IdTipoDeComprobante) { DetalleCuentaCorriente dcc = new DetalleCuentaCorriente(); dcc.IdComprobante = IdComprobante; dcc.Comprobante = Comprobante; dcc.Numero = Numero; dcc.FechaVencimiento = FechaVencimiento; dcc.FechaEmision = FechaEmision; dcc.Cuota = Cuota; dcc.Importe = Importe; dcc.Signo = signo; //Para engañar al setter de Pago dcc.Saldo = Importe; dcc.Total = Total; dcc.Pago = 0; dcc.Saldo = Saldo; dcc.IdTipoDeComprobante = IdTipoDeComprobante; if (IdTipoDeComprobante != null && !IdTipoDeComprobante.Equals(string.Empty)) { System.Data.DataRow row = mz.erp.businessrules.tsy_TiposDeComprobantes.GetByPk(IdTipoDeComprobante); if (row != null) { dcc.TipoDeComprobante = Convert.ToString(row["Descripcion"]); } } return(dcc); }
public DetalleCuentaCorrienteView(DetalleCuentaCorriente dcc, decimal SaldoAnterior, decimal SaldoPostrior, bool SoloPendientes, string nombre, DateTime desde, DateTime hasta) { _comprobante = dcc.Comprobante; _cuota = dcc.Cuota; _debe = dcc.Debe; _fechaEmision = dcc.FechaEmision; _fechaVencimiento = dcc.FechaVencimiento; _haber = dcc.Haber; _idTipoDeComprobante = dcc.IdTipoDeComprobante; _importe = dcc.Importe; _numero = dcc.Numero; _pago = dcc.Pago; _saldo = dcc.Saldo; if (SoloPendientes) { _saldoAcumulado = dcc.SaldoAcumuladoSoloPendientes; } else { _saldoAcumulado = dcc.SaldoAcumulado; } _signo = dcc.Signo; _total = dcc.Total; _saldoAnterior = SaldoAnterior; _saldoPosterior = SaldoPostrior; _nombreClienteFilter = nombre; _fechaDesdeFilter = desde; _fechaHastaFilter = hasta; }
//Este metodo se llama desde FrmAplicacionDePagos public void GetDetalleComprobantesAImputar(string process) { System.Data.DataSet data = tsa_CuentaCorriente.GetDetalleCuentaCorriente(this.IdCuenta, this.FechaDesde, this.FechaHasta, this.OrderBy, this.Comprobantes(process), false); if (data.Tables.Count > 0) { System.Data.DataTable tabla = data.Tables[0]; string VarCompImputar = Variables.GetValueString(process, "Imputar", "Comprobantes"); ArrayList comprobantesImputar = mz.erp.systemframework.Util.Parse(VarCompImputar, ","); string VarCompDeAnulacion = Variables.GetValueString(process, "Anular", "ComprobantesDeAnulacion"); ArrayList comprobantesDeAnulacion = mz.erp.systemframework.Util.Parse(VarCompDeAnulacion, ","); foreach (System.Data.DataRow row in tabla.Rows) { //Es una factura, prefactura, Nota de Debito y tienen saldo >0, osea que se pueden imputar if (((Convert.ToInt32(row["signo"])) == -1) && ((Convert.ToDecimal(row["Saldo"])) < 0) && !(comprobantesDeAnulacion.Contains(Convert.ToString(row["IdTipoDeComprobante"]))) && (comprobantesImputar.Contains(Convert.ToString(row["IdTipoDeComprobante"])))) { DetalleCuentaCorriente dcc = this.GetDetalleCuentaCorriente(row); dcc.PagoChanged += new EventHandler(RecalcularTotalPago); this.Detalle.Add(dcc); } //Es un recibo o nota de credito y tienen saldo > 0, osea que se pueden utilizar para aplicarlos else if (((Convert.ToInt32(row["signo"])) == 1) && ((Convert.ToDecimal(row["Saldo"])) > 0) && !(comprobantesDeAnulacion.Contains(Convert.ToString(row["IdTipoDeComprobante"]))) && (comprobantesImputar.Contains(Convert.ToString(row["IdTipoDeComprobante"])))) { DetalleCuentaCorriente dcc = this.GetDetalleCuentaCorriente(row); dcc.PagoChanged += new EventHandler(RecalcularTotalPago); this.Detalle.Add(dcc); } } } }
public static DetalleCuentaCorriente GetDetalleCuentaCorriente(System.Data.DataRow row) { string IdComprobante = (string)row["IdComprobante"]; string Comprobante; if (row.Table.Columns.Contains("Comprobante")) { Comprobante = Convert.ToString(row["Comprobante"]); } else { Comprobante = Convert.ToString(row["IdComprobante"]); } string Numero = Convert.ToString(row["Numero"]); DateTime FechaVencimiento = (DateTime)row["FechaVencimiento"]; DateTime FechaEmision = (DateTime)row["FechaEmision"]; short Cuota = (short)row["Cuota"]; decimal Importe = (decimal)row["Importe"]; decimal Saldo = (decimal)row["Saldo"]; decimal Total = (decimal)row["Importe"]; string IdTipoDeComprobante = Convert.ToString(row["IdTipoDeComprobante"]); int signo = Convert.ToInt32(mz.erp.businessrules.tsy_TiposDeComprobantes.GetByPk(IdTipoDeComprobante).signo); DetalleCuentaCorriente dcc = Factory.GetDetalleCuentaCorriente(IdComprobante, Comprobante, Numero, FechaVencimiento, FechaEmision, Cuota, Importe, Saldo, Total, signo, IdTipoDeComprobante); return(dcc); }
public int Compare(object x, object y) { DetalleCuentaCorriente detalle1 = (DetalleCuentaCorriente)x; DetalleCuentaCorriente detalle2 = (DetalleCuentaCorriente)y; return(detalle2.FechaEmision.CompareTo(detalle1.FechaEmision)); }
public int Compare(object x, object y) { DetalleCuentaCorriente detalle1 = (DetalleCuentaCorriente)x; DetalleCuentaCorriente detalle2 = (DetalleCuentaCorriente)y; return(detalle2.FechaVencimiento.CompareTo(detalle1.FechaVencimiento)); }
public void GetDetalleComprobantesAImputar(ArrayList comprobantesAImputar) { foreach (ItemCuentaCorriente item in comprobantesAImputar) { DetalleCuentaCorriente dcc = new DetalleCuentaCorriente(item); this.Detalle.Add(dcc); } }
public ArrayList GetDetalleCuentaCorriente(string IdCuenta, DateTime fechaDesde, DateTime fechaHasta, string OrderBy, string comprobantes, bool verHTML) { System.Data.DataSet data = tsa_CuentaCorriente.GetDetalleCuentaCorriente(IdCuenta, fechaDesde, fechaHasta, OrderBy, comprobantes, verHTML); System.Data.DataTable tabla = data.Tables[0]; this.Detalle = new ArrayList(); foreach (System.Data.DataRow row in tabla.Rows) { DetalleCuentaCorriente dcc = this.GetDetalleCuentaCorriente(row); this.Detalle.Add(dcc); } return(this.Detalle); }
public static DetalleCuentaCorriente GetDetalleCuentaCorriente(ComprobanteDePago comprobante) { string IdComprobante = comprobante.IdComprobante; string Comprobante = comprobante.IdComprobante; string Numero = comprobante.Numero; DateTime FechaVencimiento = comprobante.FechaComprobante; DateTime FechaEmision = comprobante.FechaComprobante; short Cuota = 1; decimal Importe = comprobante.Total; decimal Saldo = comprobante.Saldo; decimal Total = comprobante.Total; int signo = comprobante.SignoCuentaCorriente; string IdTipoDeComprobante = comprobante.TipoComprobanteDestino; DetalleCuentaCorriente dcc = Factory.GetDetalleCuentaCorriente(IdComprobante, Comprobante, Numero, FechaVencimiento, FechaEmision, Cuota, Importe, Saldo, Total, signo, IdTipoDeComprobante); return(dcc); }
//Esta sobrecarga recibe como parametro el IdComprobante del comprobante //que esta imputado o no con un comprobante de pago //Esta sobrecarga debe recuperar primero el comprobante de pago public static ComprobanteDePago GetComprobanteDePago(string IdComprobanteDeVenta, string IdCondicionDeVenta) { ComprobanteDePago cdp = null; CuentaCorriente ctacte = Factory.GetCuentaCorriente(); string IdComprobanteDePago = ""; System.Data.DataSet data = mz.erp.businessrules.tsa_AplicacionPagos.GetList(IdComprobanteDeVenta, 1, decimal.MinValue, null, null, short.MinValue); if (data.Tables[0].Rows.Count > 0) { IdComprobanteDePago = Convert.ToString(data.Tables[0].Rows[0]["IdComprobanteDestino"]); } if (IdComprobanteDePago != null && !IdComprobanteDePago.Equals(string.Empty)) { System.Data.DataRow rowComprobanteDePago = mz.erp.businessrules.tsa_Comprobantes.GetByPk(IdComprobanteDePago); System.Data.DataRow rowDetalleDeudaComprobanteDePago = mz.erp.businessrules.tsa_ComprobanteDetalleDeuda.GetByPk(IdComprobanteDePago, 1); System.Data.DataSet dataDetalleDeudaComprobanteDeVenta = mz.erp.businessrules.tsa_ComprobanteDetalleDeuda.GetList(IdComprobanteDeVenta, null, null); foreach (System.Data.DataRow rowDetalleDeudaComprobanteDeVenta in dataDetalleDeudaComprobanteDeVenta.Tables[0].Rows) { DetalleCuentaCorriente dccComprobanteDeVenta = Factory.GetDetalleCuentaCorriente(rowDetalleDeudaComprobanteDeVenta); ctacte.Detalle.Add(dccComprobanteDeVenta); } ctacte.RecalcularTotalPago(); decimal total = (decimal)rowComprobanteDePago["Total"]; decimal pago = 0; if (rowDetalleDeudaComprobanteDePago != null) { pago = total - (decimal)rowDetalleDeudaComprobanteDePago["Saldo"]; } else { pago = total; } cdp = Factory.GetComprobanteDePago(IdComprobanteDePago, total, pago, ctacte, IdCondicionDeVenta); cdp.Anular = true; cdp.TipoComprobanteDestino = (string)rowComprobanteDePago["IdTipoDeComprobante"]; } else { cdp = Factory.GetComprobanteDePago(); } return(cdp); }
public static DetalleCuentaCorriente GetDetalleCuentaCorriente(DetalleCuotas cuota, Comprobante comprobante) { string IdComprobante = comprobante.IdComprobante; string Numero = comprobante.Numero; DateTime FechaVencimiento = cuota.FechaVencimiento; DateTime FechaEmision = comprobante.FechaComprobante; short Cuota = Convert.ToInt16(cuota.IdCuota); decimal Importe = cuota.Monto * comprobante.SignoCuentaCorriente; decimal Saldo = cuota.Monto * comprobante.SignoCuentaCorriente; decimal Total = comprobante.Total * comprobante.SignoCuentaCorriente; int signo = comprobante.SignoCuentaCorriente; string IdTipoDeComprobante = comprobante.TipoComprobanteDestino; string Comprobante = mz.erp.businessrules.tsy_TiposDeComprobantes.GetByPk(IdTipoDeComprobante).Descripcion; DetalleCuentaCorriente dcc = Factory.GetDetalleCuentaCorriente(IdComprobante, Comprobante, Numero, FechaVencimiento, FechaEmision, Cuota, Importe, Saldo, Total, signo, IdTipoDeComprobante); return(dcc); }
public static DetalleCuentaCorriente GetDetalleCuentaCorriente(string IdComprobante, string Comprobante, string Numero, DateTime FechaVencimiento, DateTime FechaEmision, int Cuota, decimal Importe, decimal Saldo, decimal Total, int signo, string IdTipoDeComprobante) { DetalleCuentaCorriente dcc = new DetalleCuentaCorriente(); dcc.IdComprobante = IdComprobante; dcc.Comprobante = Comprobante; dcc.Numero = Numero; dcc.FechaVencimiento = FechaVencimiento; dcc.FechaEmision = FechaEmision; dcc.Cuota = Cuota; dcc.Importe = Importe; dcc.Saldo = Saldo; dcc.Total = Total; dcc.Signo = signo; dcc.IdTipoDeComprobante = IdTipoDeComprobante; return(dcc); }
/*Este metodo se llama desde el ComprobanteDePago*/ public void GetDetalleComprobantesAImputar(string ProcessName, string TaskName) { string VarCompImputar = Variables.GetValueString(ProcessName, TaskName, "Imputar.Comprobantes"); if (VarCompImputar != string.Empty) { System.Data.DataSet data = tsa_CuentaCorriente.GetDetalleCuentaCorriente(this.IdCuenta, this.FechaDesde, this.FechaHasta, VarCompImputar); if (data.Tables.Count > 0) { System.Data.DataTable tabla = data.Tables[0]; //System.Data.DataView view = new System.Data.DataView(tabla,"signo = 1 And Saldo >0",null,System.Data.DataViewRowState.OriginalRows); //System.Data.DataTable tablaFiltrada = view.Table; ArrayList comprobantesImputar = mz.erp.systemframework.Util.Parse(VarCompImputar, ","); string VarCompDeAnulacion = Variables.GetValueString(ProcessName, "Anular", "ComprobantesDeAnulacion"); ArrayList comprobantesDeAnulacion = mz.erp.systemframework.Util.Parse(VarCompDeAnulacion, ","); foreach (System.Data.DataRow row in tabla.Rows) { //Es una factura, prefactura, Nota de Debito y tienen saldo >0, osea que se pueden imputar if (((Convert.ToInt32(row["signo"])) == -1) && ((Convert.ToDecimal(row["Saldo"])) < 0) && !(comprobantesDeAnulacion.Contains(Convert.ToString(row["IdTipoDeComprobante"]))) && (comprobantesImputar.Contains(Convert.ToString(row["IdTipoDeComprobante"])))) { DetalleCuentaCorriente dcc = this.GetDetalleCuentaCorrienteDatosMinimos(row); dcc.PagoChanged += new EventHandler(RecalcularTotalPago); this.Detalle.Add(dcc); } //Es un recibo o nota de credito y tienen saldo > 0, osea que se pueden utilizar para aplicarlos else if (((Convert.ToInt32(row["signo"])) == 1) && ((Convert.ToDecimal(row["Saldo"])) > 0) && !(comprobantesDeAnulacion.Contains(Convert.ToString(row["IdTipoDeComprobante"]))) && (comprobantesImputar.Contains(Convert.ToString(row["IdTipoDeComprobante"])))) { DetalleCuentaCorriente dcc = this.GetDetalleCuentaCorrienteDatosMinimos(row); dcc.PagoChanged += new EventHandler(RecalcularTotalPago); this.Detalle.Add(dcc); } } } } }
/*public void GetDetalleCuentaCorrienteGeneral(string process) * { * System.Data.DataSet data = tsa_CuentaCorriente.GetDetalleCuentaCorrienteGeneral(this.FechaHasta, "FAA"); * System.Data.DataTable tabla = data.Tables[0]; * this.Detalle = new ArrayList(); * * foreach(System.Data.DataRow row in tabla.Rows) * { * DetalleCuentaCorriente dcc = this.GetDetalleCuentaCorriente(row); * this.Detalle.Add(dcc); * } * }*/ public void Add(DetalleCuentaCorriente detalleCtaCte) { detalleCtaCte.PagoChanged += new EventHandler(RecalcularTotalPago); this.Detalle.Add(detalleCtaCte); }
//Esta sobrecarga recibe como parametro el IdComprobante del comprobante //que esta imputado o no con un comprobante de pago //Esta sobrecarga debe recuperar primero el comprobante de pago public static ComprobanteDePago GetComprobanteDePago(string IdComprobanteDeVenta, string IdCondicionDeVenta) { ComprobanteDePago cdp; CuentaCorriente ctacte = Factory.GetCuentaCorriente(); string IdComprobanteDePago = ""; tsa_ComprobanteValoresVarAuxDataset.tsa_ComprobanteValoresVarAuxRow rowVarAux = mz.erp.businessrules.tsa_ComprobanteValoresVarAux.GetByPk(IdComprobanteDeVenta, "11"); if (rowVarAux != null) { IdComprobanteDePago = rowVarAux.Valor; } //mz.erp.businessrules.tsa_ComprobanteValoresVarAux.GetByPk(IdComprobanteDeVenta,"11").Valor; } //se chequea que exista un comprobante de pago asociado, puesto que puede que no se haya generado comprobante de pago //No se generan comprobantes de pagos si no se han ingresado valores if (IdComprobanteDePago != null && !IdComprobanteDePago.Equals(string.Empty)) { System.Data.DataRow rowComprobanteDePago = mz.erp.businessrules.tsa_Comprobantes.GetByPk(IdComprobanteDePago); System.Data.DataRow rowDetalleDeudaComprobanteDePago = mz.erp.businessrules.tsa_ComprobanteDetalleDeuda.GetByPk(IdComprobanteDePago, 1); System.Data.DataSet dataDetalleDeudaComprobanteDeVenta = mz.erp.businessrules.tsa_ComprobanteDetalleDeuda.GetList(IdComprobanteDeVenta, null, null); if (ComprobantesRules.Comprobantes_CondicionDeVenta_Permite_Imputar(IdCondicionDeVenta)) { //DetalleCuentaCorriente dccComprobanteDePago = Factory.GetDetalleCuentaCorriente(rowDetalleDeudaComprobanteDePago); //DetalleCuentaCorriente dccComprobanteDeVenta = Factory.GetDetalleCuentaCorriente(rowDetalleDeudaComprobanteDeVenta); //ctacte.Detalle.Add(dccComprobanteDePago); //ctacte.Detalle.Add(dccComprobanteDeVenta); foreach (System.Data.DataRow rowDetalleDeudaComprobanteDeVenta in dataDetalleDeudaComprobanteDeVenta.Tables[0].Rows) { DetalleCuentaCorriente dccComprobanteDeVenta = Factory.GetDetalleCuentaCorriente(rowDetalleDeudaComprobanteDeVenta); ctacte.Detalle.Add(dccComprobanteDeVenta); } decimal total = (decimal)rowComprobanteDePago["Total"]; decimal pago = total - (decimal)rowDetalleDeudaComprobanteDePago["Saldo"]; cdp = Factory.GetComprobanteDePago(IdComprobanteDePago, total, pago, ctacte, IdCondicionDeVenta); } else { //decimal total = (decimal) rowComprobanteDePago["Total"]; //decimal pago = total - (decimal) rowDetalleDeudaComprobanteDePago["Saldo"]; cdp = Factory.GetComprobanteDePago(IdComprobanteDePago, 0, 0, ctacte, IdCondicionDeVenta); cdp.Total = (decimal)rowComprobanteDePago["Total"]; cdp.Saldo = (decimal)rowDetalleDeudaComprobanteDePago["Saldo"]; cdp.TotalPago = cdp.Total - cdp.Saldo; } cdp.Anular = true; cdp.TipoComprobanteDestino = (string)rowComprobanteDePago["IdTipoDeComprobante"]; } else { cdp = Factory.GetComprobanteDePago(); } return(cdp); }
/// <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 void SetRowValues(tsa_ComprobantesExDataset.tsa_AplicacionPagosRow row, DetalleCuentaCorriente dcc, System.Data.DataRow rowComprobante) { row.IdComprobanteOrigen = dcc.IdComprobante; row.CuotaOrigen = (short)dcc.Cuota; row.IdComprobanteDestino = (string)rowComprobante["IdComprobante"]; row.IdTipoComprobanteOrigen = dcc.IdTipoDeComprobante; row.Importe = dcc.Pago; row.IdTipoDeComprobanteDestino = (string)rowComprobante["IdTipoDeComprobante"]; //se deberia modificar row.CuotaDestino = 1; row.IdEmpresa = Security.IdEmpresa; row.IdSucursal = Security.IdSucursal; row.FechaCreacion = mz.erp.businessrules.Sistema.DateTime.Now; row.IdConexionCreacion = Security.IdConexion; // row.UltimaModificacion = null; row.IdConexionUltimaModificacion = Security.IdConexion; row.IdReservado = 0; row.RowId = Guid.Empty; }
public void UpdatePago(DetalleCuentaCorriente Item) { Item.Pago = Math.Abs(Item.Saldo); }
private DetalleCuentaCorriente GetDetalleCuentaCorriente(System.Data.DataRow row) { DetalleCuentaCorriente dcc = new DetalleCuentaCorriente(row); return(dcc); }
public ArrayList GetAsociaciones(CuentaCorriente cc, string ProcessName) { ArrayList resul = new ArrayList(); tsa_AplicacionPagosDataset data = new tsa_AplicacionPagosDataset(); CuentaCorriente ccClone = Factory.GetCuentaCorriente(cc.IdCuenta, DateTime.MinValue, DateTime.MaxValue, null); ArrayList dccs = ccClone.GetDetalleCuentaCorriente(ProcessName); //Es un comprobante origen en la tabla tsa_AplicacionesDePago (Factura, Nota de Debito, etc...) if (this.Signo == -1) { data = mz.erp.businessrules.tsa_AplicacionPagos.GetList(this.IdComprobante, Convert.ToInt16(this.Cuota), decimal.MinValue, null, null, short.MinValue); //Busco lo s recibos asociados a la factura foreach (DetalleCuentaCorriente dcc in dccs) { foreach (tsa_AplicacionPagosDataset.tsa_AplicacionPagosRow row in data.tsa_AplicacionPagos.Rows) { //Los recibos estan en la columna IdComprobanteDestino en la tabla tsa_AplicacionPagos if (dcc.IdComprobante.Equals(Convert.ToString(row["IdComprobanteDestino"])) && (dcc.Cuota == ((short)row["CuotaDestino"]))) { DetalleCuentaCorriente dccClone = (DetalleCuentaCorriente)dcc.MemberwiseClone(); //truco para engañar al setter de Pago decimal saldo = dccClone.Saldo; dccClone.Saldo = row.Importe * dccClone.Signo; dccClone.Pago = row.Importe; dccClone.Saldo = saldo; dccClone.FechaPago = row.FechaCreacion; resul.Add(dccClone); } } } } //Es un comprobante destino en la tabla tsa_AplicacionesDePago (Recibos, Notas de Creditos, etc...) else { data = mz.erp.businessrules.tsa_AplicacionPagos.GetList(null, short.MinValue, decimal.MinValue, this.IdTipoDeComprobante, this.IdComprobante, Convert.ToInt16(this.Cuota)); //Busco las facturas asociadas al recibo //Las facturas estan en la columna IdComprobanteOrigen en la tabla tsa_AplicacionPagos foreach (DetalleCuentaCorriente dcc in dccs) { foreach (tsa_AplicacionPagosDataset.tsa_AplicacionPagosRow row in data.tsa_AplicacionPagos.Rows) { if (dcc.IdComprobante.Equals((string)row["IdComprobanteOrigen"]) && (dcc.Cuota == ((short)row["CuotaOrigen"]))) { DetalleCuentaCorriente dccClone = (DetalleCuentaCorriente)dcc.MemberwiseClone(); //truco para engañar al setter de Pago decimal saldo = dccClone.Saldo; dccClone.Saldo = row.Importe * dccClone.Signo; dccClone.Pago = row.Importe; dccClone.Saldo = saldo; dccClone.FechaPago = row.FechaCreacion; resul.Add(dccClone); } } } } return(resul); }