Guardar codigo unico en ventas

This commit is contained in:
2020-01-27 13:16:36 -07:00
parent def0645042
commit e26177e4e0
3 changed files with 107 additions and 9 deletions

View File

@@ -839,13 +839,14 @@ Public Class ClsAcumuladores
End Try End Try
Return Retorno Return Retorno
End Function 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 Dim Retorno As Boolean = False
SqlDataAdapter("PA_Vta_PolizaVirtualEnvioUpdate") SqlDataAdapter("PA_Vta_PolizaVirtualEnvioUpdate")
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters
.Add("@CvePolizaVirtual", SqlDbType.Int).Value = CvePolizaVirtual .Add("@CvePolizaVirtual", SqlDbType.Int).Value = CvePolizaVirtual
.Add("@Envio", SqlDbType.TinyInt).Value = Envio .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 End With
Try Try
SqlAdapter.Fill(Data) SqlAdapter.Fill(Data)

View File

@@ -357,14 +357,18 @@
<asp:LinkButton runat="server" ID="LnkImprimirFormatoCicovisa" Visible="false" OnClick="LnkImprimirFormatoCicovisa_Click">Imprimir Formato Cicovisa</asp:LinkButton> <asp:LinkButton runat="server" ID="LnkImprimirFormatoCicovisa" Visible="false" OnClick="LnkImprimirFormatoCicovisa_Click">Imprimir Formato Cicovisa</asp:LinkButton>
</li> </li>
<li> <li>
<asp:LinkButton runat="server" ID="LnkEnviarPolizaVirtual" Visible="false" OnClick="LnkEnviarPolizaVirtual_Click">Enviar Poliza Virtual</asp:LinkButton> <asp:LinkButton runat="server" ID="LnkEnviarPolizaVirtual" Visible="false" OnClick="LnkEnviarPolizaVirtual_Click">Enviar Póliza Virtual</asp:LinkButton>
</li> </li>
<%-- <li>
<asp:LinkButton runat="server" ID="LnkDescargarFacturaPrueba" OnClick="LnkDescargarFacturaPrueba_Click">Descargar Factura Prueba</asp:LinkButton>
</li>--%>
</ContentTemplate> </ContentTemplate>
<Triggers> <Triggers>
<asp:AsyncPostBackTrigger ControlID="LnkImprimir" EventName="Click" /> <asp:AsyncPostBackTrigger ControlID="LnkImprimir" EventName="Click" />
<asp:PostBackTrigger ControlID="BtnContabilizar" /> <asp:PostBackTrigger ControlID="BtnContabilizar" />
<asp:PostBackTrigger ControlID="BtnContabilizar" /> <asp:PostBackTrigger ControlID="BtnContabilizar" />
<asp:PostBackTrigger ControlID="LnkImprimirFormatoCicovisa" /> <asp:PostBackTrigger ControlID="LnkImprimirFormatoCicovisa" />
<%-- <asp:PostBackTrigger ControlID="LnkDescargarFacturaPrueba" />--%>
<%-- <asp:PostBackTrigger ControlID="LbDescargarExcel" />--%> <%-- <asp:PostBackTrigger ControlID="LbDescargarExcel" />--%>
</Triggers> </Triggers>
</asp:UpdatePanel> </asp:UpdatePanel>
@@ -620,7 +624,7 @@
<td><b>Fecha:</b></td> <td><b>Fecha:</b></td>
<td> <td>
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 117px !important; padding: 0px;"> <div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 117px !important; padding: 0px;">
<asp:TextBox ID="TxtFecha" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10"></asp:TextBox> <asp:TextBox ID="TxtFecha" runat="server" AutoPostBack="true" CssClass="form-control" CausesValidation="true" MaxLength="10" OnTextChanged="TxtFecha_TextChanged"></asp:TextBox>
<span class="input-group-btn "> <span class="input-group-btn ">
<asp:LinkButton ID="ImgFecha" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton> <asp:LinkButton ID="ImgFecha" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span> </span>

View File

@@ -4297,6 +4297,10 @@ Partial Class Ventas
End If End If
End If End If
If UsuarioActual.CveEmpresa = 48 Then
TxtFecha.AutoPostBack = True
End If
CargaCodigoUnico() CargaCodigoUnico()
UpPS.Update() UpPS.Update()
@@ -24018,8 +24022,16 @@ Partial Class Ventas
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
Dim Respuesta As String = "[]" Dim Respuesta As String = "[]"
Dim User As String = "cslth.7777@lth.com" Dim User As String = ""
Dim Password As String = "ff31580a95f36b51ad27f970428b77a5a9245076" 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 Try
Using wc As New HttpClient() Using wc As New HttpClient()
@@ -24066,22 +24078,28 @@ Partial Class Ventas
If resp.Count > 0 Then If resp.Count > 0 Then
Dim Msg As New StringBuilder() 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 If resp(0)("Codigo").ToString().Contiene("500", "501", "502", "503", "504", "505", "506", "507", "508") Then
Retorno = True Retorno = True
Dim ObjAcum As New ClsAcumuladores 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) Alert(Msg.ToString(), TipoMensaje.MsgInformacion)
End If End If
ObjAcum.Dispose() ObjAcum.Dispose()
Else Else
Dim ObjAcum As New ClsAcumuladores 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) Alert(Msg.ToString(), TipoMensaje.MsgAdvertencia)
End If End If
ObjAcum.Dispose() ObjAcum.Dispose()
End If 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 Else
Alert("No se envió la poliza virtual", TipoMensaje.MsgAdvertencia) Alert("No se envió la poliza virtual", TipoMensaje.MsgAdvertencia)
End If End If
@@ -24140,4 +24158,79 @@ Partial Class Ventas
End Sub 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 End Class