diff --git a/App_Code/ClsAcumuladores.vb b/App_Code/ClsAcumuladores.vb index 24713eabf..56eb8028b 100644 --- a/App_Code/ClsAcumuladores.vb +++ b/App_Code/ClsAcumuladores.vb @@ -839,13 +839,14 @@ Public Class ClsAcumuladores End Try Return Retorno End Function - Public Function UpdateEnvioPolizaVirutal(CvePolizaVirtual As Integer, Envio As Boolean, FechaEnvio As DateTime) As Boolean + Public Function UpdateEnvioPolizaVirutal(CvePolizaVirtual As Integer, Envio As Boolean, FechaEnvio As DateTime, CodigoUnico As String) As Boolean Dim Retorno As Boolean = False SqlDataAdapter("PA_Vta_PolizaVirtualEnvioUpdate") With SqlAdapter.SelectCommand.Parameters .Add("@CvePolizaVirtual", SqlDbType.Int).Value = CvePolizaVirtual .Add("@Envio", SqlDbType.TinyInt).Value = Envio - .Add("@FechaEnvio", SqlDbType.DateTime).Value = FechaEnvio + .Add("@FechaEnvio", SqlDbType.DateTime).Value = FechaEnvio + .Add("@CodigoUnico", SqlDbType.VarChar).Value = CodigoUnico End With Try SqlAdapter.Fill(Data) diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index 959db35a3..4a65d41f7 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -357,14 +357,18 @@ Imprimir Formato Cicovisa
  • - Enviar Poliza Virtual + Enviar Póliza Virtual
  • +<%--
  • + Descargar Factura Prueba +
  • --%> + <%-- --%> <%-- --%> @@ -620,7 +624,7 @@ Fecha:
    - + diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 952ba1f49..ef321821b 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -4297,6 +4297,10 @@ Partial Class Ventas End If End If + If UsuarioActual.CveEmpresa = 48 Then + TxtFecha.AutoPostBack = True + End If + CargaCodigoUnico() UpPS.Update() @@ -24018,8 +24022,16 @@ Partial Class Ventas Dim Retorno As Boolean = False Dim Respuesta As String = "[]" - Dim User As String = "cslth.7777@lth.com" - Dim Password As String = "ff31580a95f36b51ad27f970428b77a5a9245076" + Dim User As String = "" + Dim Password As String = "" + + If UsuarioActual.Empresa.FacturaProduccion Then + User = "cslth.2809@jcilink.com" + Password = "ff31580a95f36b51ad27f970428b77a5a9245076" + Else + User = "cslth.7777@lth.com" + Password = "ff31580a95f36b51ad27f970428b77a5a9245076" + End If Try Using wc As New HttpClient() @@ -24066,22 +24078,28 @@ Partial Class Ventas If resp.Count > 0 Then Dim Msg As New StringBuilder() - Msg.AppendFormat("Mensaje Poliza Virtual: {0}", resp(0)("Descripcion").ToString()) + Msg.AppendFormat("Mensaje Póliza Virtual: {0}", resp(0)("Descripcion").ToString()) If resp(0)("Codigo").ToString().Contiene("500", "501", "502", "503", "504", "505", "506", "507", "508") Then Retorno = True Dim ObjAcum As New ClsAcumuladores - If ObjAcum.UpdateEnvioPolizaVirutal(CvePolizaVirtual, True, Now) Then + If ObjAcum.UpdateEnvioPolizaVirutal(CvePolizaVirtual, True, Now, obj.product_unique_code) Then Alert(Msg.ToString(), TipoMensaje.MsgInformacion) End If ObjAcum.Dispose() Else Dim ObjAcum As New ClsAcumuladores - If ObjAcum.UpdateEnvioPolizaVirutal(CvePolizaVirtual, False, Now) Then + If ObjAcum.UpdateEnvioPolizaVirutal(CvePolizaVirtual, False, Now, obj.product_unique_code) Then Alert(Msg.ToString(), TipoMensaje.MsgAdvertencia) End If ObjAcum.Dispose() End If + + Dim ObjEventos As New ClsOIEventos() + If Not ObjEventos.AddEventoBitacora(Msg.ToString(), "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=Me.CveVenta) Then + ErrorList.Add("Ocurrió un error al agregar la bitacora de Póliza Virtual.") + End If + ObjEventos.Dispose() Else Alert("No se envió la poliza virtual", TipoMensaje.MsgAdvertencia) End If @@ -24140,4 +24158,79 @@ Partial Class Ventas End Sub + Protected Sub TxtFecha_TextChanged(sender As Object, e As EventArgs) + 'SI USUARIO USA AMORTIZACIÓN CONTABLE, se carga las tablas para usarlas mas adelante + If UsuarioActual.CveEmpresa = 48 AndAlso UsuarioActual.Empresa.UsaAC Then + + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem")) + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Cot")) + DdlTipoComprobante.Items.Add(New ListItem("Compromisos", "Com")) + DdlTipoComprobante.Items.Add(New ListItem("Orden Pago", "OP")) + + Dim AC As New ClsAC + If AC.GetPresupuestoIngresos(-1, TxtFecha.Text.ToDateTime().Year, True, UsuarioActual.CveEmpresa) Then + DdlFuenteRecaudacion.DataSource = AC.DtResultados() + DTPresupuestoIngresos = AC.DtResultados() + ViewState("DTFuenteRecaudacion") = AC.DtResultados() + 'GenerarPolizasAC() + End If + AC.Dispose() + 'columna de Fuente de recaudacion + GvPS.Columns(21).Visible = True + nomostrar.Visible = True + nomostrar2.Visible = True + 'GvPS.Width = 1250 + DdlFuenteRecaudacion.DataBind() + Else + TFuenteRecaudacion.Visible = False + End If + End Sub + 'Protected Sub LnkDescargarFacturaPrueba_Click(sender As Object, e As EventArgs) + ' 'Dim Hilo As New System.Threading.Thread(Sub() DescargarFactura(Me.CveVenta, UsuarioActual.CveEmpresa)) + ' 'Hilo.Start() + ' Dim facBytes = DescargarFactura(Me.CveVenta, UsuarioActual.CveEmpresa) + ' ImprimirbytesPDF(facBytes, "Factura") + 'End Sub + 'Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer) As Byte() + ' Dim Url = New Uri(String.Format("{0}Compras/PopUpVerFactura.aspx?P={1}", "https://sig.adssistemas.mx/", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta)))) + ' Dim File As Byte() = Nothing + ' Try + ' Using httpClient = New HttpClient() + ' httpClient.Timeout = New TimeSpan(0, 15, 0) + ' Using request = New HttpRequestMessage(HttpMethod.Get, Url) + ' request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}&CVEUSUARIO=100", CveEmpresa, DateTime.UtcNow.Ticks))) + ' Dim response = httpClient.SendAsync(request).Result + ' If response.StatusCode = Net.HttpStatusCode.OK Then + ' File = response.Content.ReadAsByteArrayAsync().Result + ' End If + ' End Using + ' End Using + ' Catch ex As Exception + ' File = Nothing + ' OnError("Ocurrió un error al descargar la factura", ex) + ' End Try + + ' Return File + 'End Function + 'Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, Optional GetBytes As Boolean = True) As Byte() + ' Dim Url = New Uri(String.Format("http://{0}:{1}/Compras/PopUpVerFactura.aspx?P={2}", HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta)))) + ' Dim File As Byte() = Nothing + ' Try + ' Using httpClient = New HttpClient() + ' httpClient.Timeout = New TimeSpan(0, 15, 0) + ' Using request = New HttpRequestMessage(HttpMethod.Get, Url) + ' request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}&CveUsuario=100", CveEmpresa, DateTime.UtcNow.Ticks))) + ' Dim response = httpClient.SendAsync(request).Result + ' If GetBytes AndAlso response.StatusCode = Net.HttpStatusCode.OK Then + ' File = response.Content.ReadAsByteArrayAsync().Result + ' End If + ' End Using + ' End Using + ' Catch ex As Exception + ' File = Nothing + ' OnError("Ocurrió un error al descargar la factura", ex) + ' End Try + + ' Return File + 'End Function End Class \ No newline at end of file