private void imprimir(string resp) { string comercio; string lote; string tid; string trx; string lectura; string autorizacion; decimal subtot; decimal iva; decimal total; string tarjeta; string aplabel; string numtarjeta; string nombre; decimal grabaiva; decimal nograbaiva; DateTime fecha; DateTime hora; try { UTILIDADES.mensaje("DEBUG : " + txtreq.Text.Substring(2, 2).Trim() + " == " + resp.Substring(4, 2), "LogTracerCOM", "log"); if (txtreq.Text.Substring(2, 2).Trim() == "01" || txtreq.Text.Substring(2, 2).Trim() == "02" || txtreq.Text.Substring(2, 2).Trim() == "05") { comercio = this.txtresp.Text.Substring(68, 15).PadLeft(15, ' '); UTILIDADES.mensaje("DEBUG : " + "comercio == " + comercio, "LogTracerCOM", "log"); lote = this.txtresp.Text.Substring(34, 6); UTILIDADES.mensaje("DEBUG : " + "lote == " + lote, "LogTracerCOM", "log"); tid = this.txtresp.Text.Substring(60, 8).PadLeft(8, ' '); UTILIDADES.mensaje("DEBUG : " + "tid == " + tid, "LogTracerCOM", "log"); numtarjeta = this.txtresp.Text.Substring(232, 20); UTILIDADES.mensaje("DEBUG : " + "numtarjeta == " + numtarjeta, "LogTracerCOM", "log"); trx = this.txtresp.Text.Substring(28, 6); UTILIDADES.mensaje("DEBUG : " + "trx == " + trx, "LogTracerCOM", "log"); autorizacion = this.txtresp.Text.Substring(54, 6); UTILIDADES.mensaje("DEBUG : " + "autorizacion == " + autorizacion, "LogTracerCOM", "log"); total = Convert.ToDecimal(this.txtreq.Text.Substring(6, 12)) / 100; UTILIDADES.mensaje("DEBUG : " + "total == " + total, "LogTracerCOM", "log"); grabaiva = Convert.ToDecimal(this.txtreq.Text.Substring(18, 12)) / 100; UTILIDADES.mensaje("DEBUG : " + "grabaiva == " + grabaiva, "LogTracerCOM", "log"); nograbaiva = Convert.ToDecimal(this.txtreq.Text.Substring(30, 12)) / 100; UTILIDADES.mensaje("DEBUG : " + "nograbaiva == " + nograbaiva, "LogTracerCOM", "log"); iva = Convert.ToDecimal(this.txtreq.Text.Substring(42, 12)) / 100; UTILIDADES.mensaje("DEBUG : " + "iva == " + iva, "LogTracerCOM", "log"); lectura = this.txtresp.Text.Substring(277, 2).Trim(); UTILIDADES.mensaje("DEBUG : " + "lectura == " + lectura, "LogTracerCOM", "log"); aplabel = this.txtresp.Text.Substring(331, 20).Trim(); UTILIDADES.mensaje("DEBUG : " + "aplabel == " + aplabel, "LogTracerCOM", "log"); tarjeta = this.txtresp.Text.Substring(252, 4).Trim(); UTILIDADES.mensaje("DEBUG : " + "tarjeta == " + tarjeta, "LogTracerCOM", "log"); nombre = this.txtresp.Text.Substring(279, 40).Trim(); UTILIDADES.mensaje("DEBUG : " + "nombre == " + nombre, "LogTracerCOM", "log"); subtot = grabaiva + nograbaiva; hora = Convert.ToDateTime(this.txtresp.Text.Substring(40, 2) + ":" + this.txtresp.Text.Substring(42, 2) + ":" + this.txtresp.Text.Substring(44, 2)); UTILIDADES.mensaje("DEBUG : " + "hora == " + hora, "LogTracerCOM", "log"); fecha = Convert.ToDateTime(this.txtresp.Text.Substring(46, 4) + "-" + this.txtresp.Text.Substring(50, 2) + "-" + this.txtresp.Text.Substring(52, 2)); UTILIDADES.mensaje("DEBUG : " + "fecha == " + fecha, "LogTracerCOM", "log"); if (lectura == "02") { lectura = "BANDA"; } if (lectura == "03") { lectura = "CHIP"; } if (lectura == "04" || lectura == "05") { lectura = "CHIP BANDA"; } UTILIDADES.mensaje("DEBUG : " + "lectura == " + lectura, "LogTracerCOM", "log"); AppDemo.DtsReport ds = new AppDemo.DtsReport(); AppDemo.DtsReport.compraDataTable dtcompra = new AppDemo.DtsReport.compraDataTable(); dtcompra.AddcompraRow(comercio, lote, tid, tarjeta, numtarjeta, lectura, trx, autorizacion, grabaiva, nograbaiva, subtot, iva, total, aplabel, nombre, fecha, hora); AppDemo.FrmVoucher frm = new AppDemo.FrmVoucher(dtcompra); frm.Show(); } if (this.txtreq.Text.Substring(2, 2) == "03") { comercio = this.txtresp.Text.Substring(68, 15).PadLeft(15, ' '); UTILIDADES.mensaje("DEBUG : " + "comercio == " + comercio, "LogTracerCOM", "log"); lote = this.txtresp.Text.Substring(34, 6); UTILIDADES.mensaje("DEBUG : " + "lote == " + lote, "LogTracerCOM", "log"); tid = this.txtresp.Text.Substring(60, 8).PadLeft(8, ' '); UTILIDADES.mensaje("DEBUG : " + "tid == " + tid, "LogTracerCOM", "log"); numtarjeta = this.txtresp.Text.Substring(232, 20); UTILIDADES.mensaje("DEBUG : " + "numtarjeta == " + numtarjeta, "LogTracerCOM", "log"); tarjeta = this.txtresp.Text.Substring(252, 4).Trim(); UTILIDADES.mensaje("DEBUG : " + "tarjeta == " + tarjeta, "LogTracerCOM", "log"); trx = this.txtresp.Text.Substring(28, 6); UTILIDADES.mensaje("DEBUG : " + "trx == " + trx, "LogTracerCOM", "log"); autorizacion = this.txtresp.Text.Substring(54, 6); UTILIDADES.mensaje("DEBUG : " + "autorizacion == " + autorizacion, "LogTracerCOM", "log"); total = Convert.ToDecimal(this.txtreq.Text.Substring(6, 12)) / 100; UTILIDADES.mensaje("DEBUG : " + "total == " + total, "LogTracerCOM", "log"); lectura = this.txtresp.Text.Substring(277, 2).Trim(); UTILIDADES.mensaje("DEBUG : " + "lectura == " + lectura, "LogTracerCOM", "log"); hora = Convert.ToDateTime(this.txtresp.Text.Substring(40, 2) + ":" + this.txtresp.Text.Substring(42, 2) + ":" + this.txtresp.Text.Substring(44, 2)); UTILIDADES.mensaje("DEBUG : " + "hora == " + hora, "LogTracerCOM", "log"); fecha = Convert.ToDateTime(this.txtresp.Text.Substring(46, 4) + "-" + this.txtresp.Text.Substring(50, 2) + "-" + this.txtresp.Text.Substring(52, 2)); UTILIDADES.mensaje("DEBUG : " + "fecha == " + fecha, "LogTracerCOM", "log"); if (lectura == "02") { lectura = "BANDA"; } if (lectura == "03") { lectura = "CHIP"; } if (lectura == "04" || lectura == "05") { lectura = "CHIP BANDA"; } AppDemo.DtsReport ds = new AppDemo.DtsReport(); AppDemo.DtsReport.anulacionDataTable dtanulacion = new AppDemo.DtsReport.anulacionDataTable(); dtanulacion.AddanulacionRow(comercio, lote, tid, tarjeta, numtarjeta, lectura, trx, autorizacion, trx, total, fecha, hora); AppDemo.FrmAnulacion frm = new AppDemo.FrmAnulacion(dtanulacion); frm.Show(); } } catch (Exception ex) { MessageBox.Show("OpciĆ³n no disponible " + ex.Message, "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Warning); throw; } }
public String Envio_requerimientoPinpad(String IP, int Puerto, int timeout, String trama, String RutaBines, int iGrabaLog) { string [] arrip; string ip = string.Empty; string puerto = string.Empty; try { TipoTrx = trama.Substring(0, 2); } catch (Exception ex) { if (iGrabaLog == 1) { UTILIDADES.mensaje("DEBUG : " + "Envio_requerimiento Error al obtener el tipo de transaccion " + ex.Message, "LogTracerCOM", "log"); } return(TipoTrx + ErrorCnxPinpad); } try { if (TipoTrx.Equals("RA") || TipoTrx.Equals("BB") || TipoTrx.Equals("PP") || TipoTrx.Equals("LT")) { if (String.IsNullOrEmpty(IP)) { return(Pinpad.SendPinpad(trama, Puerto, timeout, RutaBines, iGrabaLog)); } else { if (IP.Length > 0) { arrip = IP.Split(':'); ip = arrip[0].PadRight(15, ' '); puerto = arrip[1].PadRight(5, ' '); } if (ip.Length == 0) { if (iGrabaLog == 1) { UTILIDADES.mensaje("DEBUG : " + "Envio_requerimiento IP no enviada ip= " + ip, "LogTramas", "log"); } return(TipoTrx + ErrorCnxPinpad); } if (puerto.Length == 0) { if (iGrabaLog == 1) { UTILIDADES.mensaje("DEBUG : " + "Envio_requerimiento PUERTO no enviado Puerto= " + puerto, "LogTramas", "log"); } return(TipoTrx + ErrorCnxPinpad); } trama = trama + ip + puerto; return(Pinpad.SendPinpad(trama, Puerto, timeout, RutaBines, iGrabaLog)); } } else { return(Pinpad.SendPinpad(trama, Puerto, timeout, RutaBines, iGrabaLog)); } } catch (Exception e) { if (iGrabaLog == 1) { UTILIDADES.mensaje("DEBUG : " + "Envio_requerimiento Excepcion= " + e.Message, "LogTramas", "log"); } return(TipoTrx + ErrorCnxPinpad); } }