protected void btnRechazar_Click(object sender, EventArgs e) { DBConn oConn = new DBConn(); if (oConn.Open()) { cAntPagos oPagos = new cAntPagos(ref oConn); oPagos.CodPagos = hdd_cod_pago.Value; oPagos.ImporteTotalRecibido = hdd_importetotal_recibido.Value; oPagos.Discrepancia = hdd_total_discrepancia.Value; oPagos.Estado = "A"; oPagos.Accion = "EDITAR"; oPagos.Put(); oConn.Close(); } StringBuilder sHmtl = new StringBuilder(); sHmtl.Append("Se informa que la valija # ").Append(lblValija.Text).Append(" a sido rechazada."); AppSettingsReader appReader = new System.Configuration.AppSettingsReader(); string sEmlAddr = appReader.GetValue("AntalisMail", typeof(string)).ToString(); oEmailing.FromName = Application["NameSender"].ToString(); oEmailing.From = Application["EmailSender"].ToString(); oEmailing.Address = sEmlAddr; oEmailing.Subject = "Valija # " + lblValija.Text + ", RECHAZADA"; oEmailing.Body = sHmtl; oEmailing.EmailSend(); Log oLog = new Log(); oLog.IdUsuario = oIsUsuario.CodUsuario; oLog.ObsLog = "RECHAZO VALIJA #" + hdd_cod_pago.Value; oLog.CodEvtLog = "2"; oLog.AppLog = "ANTALIS"; oLog.putLog(); Response.Redirect("controllerpagos.aspx"); }
protected void btnAceptar_Click(object sender, EventArgs e) { DBConn oConn = new DBConn(); if (oConn.Open()) { cAntPagos oPagos = new cAntPagos(ref oConn); oPagos.CodPagos = hdd_cod_pago.Value; oPagos.ImporteTotalRecibido = hdd_importetotal_recibido.Value; oPagos.Discrepancia = hdd_total_discrepancia.Value; oPagos.Estado = "V"; oPagos.Accion = "EDITAR"; oPagos.Put(); oConn.Close(); } string lblTitulo = string.Empty; switch (hdd_tipo_documento.Value) { case "1": lblTitulo = "CHEQUES AL DÍA"; break; case "2": lblTitulo = "CHEQUES AL FECHA"; break; case "4": lblTitulo = "LETRA"; break; case "5": lblTitulo = "TARJETA"; break; case "6": lblTitulo = "TRANSFERENCIA"; break; } StringBuilder sHmtl = new StringBuilder(); sHmtl.Append("Se informa que la valija # ").Append(lblValija.Text).Append(", de tipo de pago ").Append(lblTitulo).Append(" a sido validada."); AppSettingsReader appReader = new System.Configuration.AppSettingsReader(); string sEmlAddr = appReader.GetValue("AntalisMail", typeof(string)).ToString(); oEmailing.FromName = Application["NameSender"].ToString(); oEmailing.From = Application["EmailSender"].ToString(); oEmailing.Address = sEmlAddr; oEmailing.Subject = "Valija # " + lblValija.Text + ", VALIDADA"; oEmailing.Body = sHmtl; oEmailing.EmailSend(); Log oLog = new Log(); oLog.IdUsuario = oIsUsuario.CodUsuario; oLog.ObsLog = "VALIDADO VALIJA #" + hdd_cod_pago.Value; oLog.CodEvtLog = "2"; oLog.AppLog = "ANTALIS"; oLog.putLog(); Response.Redirect("controllerpagos.aspx"); }
protected void gdPagos_RowDeleting(object sender, GridViewDeleteEventArgs e) { string pCodPago = gdPagos.DataKeys[e.RowIndex].Value.ToString(); DBConn oConn = new DBConn(); if (oConn.Open()) { int nImporteFactura; int nSaldo; int nAplicacionPagoFactura; //int nSaldoNotaCredito; int nAplicacionNotaCredito; DataTable dt; cAntFactura oFactura; cAntNotaCredito oNotaCredito; cAntDocumentosPago oDocumentosPago = new cAntDocumentosPago(ref oConn); oDocumentosPago.CodPagos = pCodPago; DataTable dtDocPago = oDocumentosPago.Get(); if (dtDocPago != null) { foreach (DataRow oRow in dtDocPago.Rows) { nSaldo = 0; nImporteFactura = int.Parse(oRow["importe_factura"].ToString()); nAplicacionPagoFactura = int.Parse(oRow["aplicacion_pago_factura"].ToString()); //nSaldoNotaCredito = int.Parse(oRow["saldo_nota_credito"].ToString()); nAplicacionNotaCredito = int.Parse(oRow["aplicacion_nota_credito"].ToString()); int nValorFactura = 0; oFactura = new cAntFactura(ref oConn); oFactura.CodFactura = oRow["cod_factura"].ToString(); dt = oFactura.Get(); if (dt != null) { if (dt.Rows.Count > 0) { nValorFactura = int.Parse(dt.Rows[0]["valor_factura"].ToString()); } } dt = null; if (nValorFactura < (nAplicacionPagoFactura + nAplicacionNotaCredito)) { oFactura.SaldoFactura = nValorFactura.ToString(); } else { if (nValorFactura < (nImporteFactura + nAplicacionPagoFactura + nAplicacionNotaCredito)) { oFactura.SaldoFactura = nValorFactura.ToString(); } else { oFactura.SaldoFactura = (nImporteFactura + nAplicacionPagoFactura + nAplicacionNotaCredito).ToString(); } } oFactura.Accion = "EDITAR"; oFactura.Put(); if (!string.IsNullOrEmpty(oFactura.Error)) { Response.Write("[Eliminar / Factura Editar] Se ha encontrado el siguiente error : " + oFactura.Error); Response.End(); } //if (!string.IsNullOrEmpty(oRow["cod_nota_credito"].ToString())) { oNotaCredito = new cAntNotaCredito(ref oConn); oNotaCredito.CodDocumento = oRow["cod_documento"].ToString(); DataTable dtNC = oNotaCredito.GetDocNotaCredito(); if (dtNC != null) { if (dtNC.Rows.Count > 0) { foreach (DataRow oRowNC in dtNC.Rows) { oNotaCredito.CodNotaCredito = oRowNC["cod_nota_credito"].ToString(); dt = oNotaCredito.Get(); if (dt != null) { if (dt.Rows.Count > 0) { oNotaCredito.SaldoNotaCredito = (int.Parse(dt.Rows[0]["saldo_nota_credito"].ToString()) + int.Parse(oRowNC["aplicacion_nota_credito"].ToString())).ToString(); oNotaCredito.Accion = "EDITAR"; oNotaCredito.Put(); if (!string.IsNullOrEmpty(oNotaCredito.Error)) { Response.Write("[Eliminar / Nota Credito Editar] Se ha encontrado el siguiente error : " + oNotaCredito.Error); Response.End(); } } } dt = null; oNotaCredito.Accion = "ELIMINAR"; oNotaCredito.PutDocNotaCredito(); if (!string.IsNullOrEmpty(oNotaCredito.Error)) { Response.Write("[Eliminar / REL Nota Credito - DOC] Se ha encontrado el siguiente error : " + oNotaCredito.Error); Response.End(); } } } } dtNC = null; //} oDocumentosPago.CodDocumento = oRow["cod_documento"].ToString(); oDocumentosPago.Accion = "ELIMINAR"; oDocumentosPago.Put(); if (!string.IsNullOrEmpty(oDocumentosPago.Error)) { Response.Write("[Eliminar / Documento Pago] Se ha encontrado el siguiente error : " + oDocumentosPago.Error); Response.End(); } } } dtDocPago = null; cAntPagos oPagos = new cAntPagos(ref oConn); oPagos.CodPagos = pCodPago; oPagos.Accion = "ELIMINAR"; oPagos.Put(); if (!string.IsNullOrEmpty(oPagos.Error)) { Response.Write("[Eliminar / Pagos] Se ha encontrado el siguiente error : " + oPagos.Error); Response.End(); } } oConn.Close(); onLoadGrid(); }