public void EnviarComproanteFallidos() { List <CENComprobSunat> listaComp = new List <CENComprobSunat>(); RequestApiBoleta dataVenta = new RequestApiBoleta(); CLNConexionServicio clnServicio = new CLNConexionServicio(); CLNConsultas consultas = new CLNConsultas(); CADcomprobSunat cADcomprob = new CADcomprobSunat(); ResponseApi respVenta = new ResponseApi(); string tramaSUNAT = CENConstante.g_const_vacio; int estadoSUNAT = CENConstante.g_const_0; bool estado = false; try { listaComp = ListarComprobantesFallidos(); foreach (CENComprobSunat comprobante in listaComp) { if (comprobante.codModulo == CENConstante.g_const_1 && comprobante.tipDocSunat == CENConstante.g_const_1) { //VENTA estado = ValidarVenta(comprobante.tramEntrada); if (estado) { dataVenta = JsonConvert.DeserializeObject <RequestApiBoleta>( comprobante.tramEntrada); respVenta = clnServicio.RegistrarBoleta(dataVenta); tramaSUNAT = JsonConvert.SerializeObject(respVenta); if (respVenta.sunatResponse.success) { //ACTUALIZAR COMPROBANTE DE LA SUNAT - CORRECTO estadoSUNAT = CENConstante.g_const_1; } else { //ACTUALIZAR COMPROBANTE DE LA SUNAT - INCORRECTO estadoSUNAT = CENConstante.g_const_2; } cADcomprob.ActualizarComprobSunat(comprobante.ntraComprob, tramaSUNAT, estadoSUNAT); } } } } catch (Exception ex) { throw ex; } }
public CENVentaFiltroPA listarVentaCodigo(int codigo) { CADVenta cadVenta = new CADVenta(); CENVentaFiltroPA data = new CENVentaFiltroPA(); CLNConsultas clnConsultas = new CLNConsultas(); try { data = cadVenta.listarVentaCodigo(codigo); data.nroDocumentoCadena = clnConsultas.ConvertirNroDocumento(data.nroDocumento); return(data); } catch (Exception ex) { throw ex; } }
public List <CENPreventaFiltroPA> listarPreventaFiltro(CENPreventaFiltro data) { CADVenta cadVenta = new CADVenta(); CLNConsultas consulta = new CLNConsultas(); List <CENPreventaFiltroPA> respuesta = new List <CENPreventaFiltroPA>(); try { respuesta = cadVenta.listarPreventaFiltro(data); for (int i = CENConstante.g_const_0; i < respuesta.Count; i++) { //respuesta[i].igv = consulta.RedondeoMontoFavorCliente(respuesta[i].igv); respuesta[i].total = consulta.RedondeoMontoFavorCliente(respuesta[i].total); //respuesta[i].recargo = consulta.RedondeoMontoFavorCliente(respuesta[i].recargo); } return(respuesta); } catch (Exception ex) { throw ex; } }
private CEN_DataVenta LlenarDataVenta(int codPreventa, int codCliente, int codVendedor, string fechPag, int tipoVenta, int tipoMoneda, double recargo, double IGV, double total, int sucursal, int tipoDocumentoVenta, int codPuntoEntrega) { CEN_DataVenta data = new CEN_DataVenta(); CLNConsultas consultas = new CLNConsultas(); try { data.codPreventa = codPreventa; data.codCliente = codCliente; data.codVendedor = codVendedor; data.fechaTransaccion = DateTime.Now; data.fechaPago = consultas.ConvertFechaStringToDate(fechPag); data.importeRecargo = recargo; data.importeTotal = total; data.IGV = IGV; data.sucursal = sucursal; data.tipoVenta = tipoVenta; data.tipoMoneda = tipoMoneda; data.proceso = CENConstante.g_const_1; data.tipoDocumentoVenta = tipoDocumentoVenta; data.codPuntoEntrega = codPuntoEntrega; data.estado = CENConstante.g_const_1; //Verificar registro pendiente de pago /* * TimeSpan timePago = data.fechaPago - DateTime.Now; * int diaPago = timePago.Days; * if (diaPago > CENConstante.g_const_0) * { */ if (data.tipoVenta == CENConstante.g_const_1) // contado { //Pendiente de pago //data.estado = CENConstante.g_const_1; //Registro de clase de pendiente de cobro data.cuentaCobro.fechaCobro = data.fechaPago; data.cuentaCobro.fechaTransaccion = DateTime.Now; data.cuentaCobro.horaTransaccion = DateTime.Now.ToString(CENConstante.g_const_horaFech); data.cuentaCobro.responsable = CENConstante.g_const_vacio; data.cuentaCobro.estado = CENConstante.g_const_1; data.cuentaCobro.importe = data.importeTotal; //Validamos que si se debe registrar cuenta cobro data.est_reg_cue_cob = CENConstante.g_const_1; } //Tipo de pago if (data.tipoVenta == CENConstante.g_const_1) // contado { //TOTAL data.tipoPago = CENConstante.g_const_1; } else //credito { //PARCIAL data.tipoPago = CENConstante.g_const_2; //Generar prestamo data.prestamo.fechaTransaccion = DateTime.Now; data.prestamo.importeTotal = total; data.prestamo.interesTotal = CENConstante.g_const_0; data.prestamo.nroCuotas = CENConstante.g_const_1; data.prestamo.estado = CENConstante.g_const_1; TimeSpan ts = data.fechaPago - DateTime.Now; data.prestamo.plazo = ts.Days; //Generar cronograma CENCronograma cronograma = new CENCronograma(); cronograma.fechaPago = data.fechaPago; cronograma.importe = total; cronograma.nroCuota = CENConstante.g_const_1; cronograma.estado = CENConstante.g_const_1; data.listCuotas.Add(cronograma); } return(data); } catch (Exception ex) { throw ex; } }