E143. Generar remisiones en portal del cliente
This commit is contained in:
@@ -2071,6 +2071,13 @@
|
|||||||
catch (e) { alert(e); }
|
catch (e) { alert(e); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function CerrarModalVenta() {
|
||||||
|
try {
|
||||||
|
$('#DivVenta').modal('hide');
|
||||||
|
}
|
||||||
|
catch (e) { alert(e); }
|
||||||
|
}
|
||||||
|
|
||||||
//VALIDA QUE LA CANTIDAD DE T (TXT) NO SEA MAYOR A C
|
//VALIDA QUE LA CANTIDAD DE T (TXT) NO SEA MAYOR A C
|
||||||
function ValidarCantidad(t, c) {
|
function ValidarCantidad(t, c) {
|
||||||
t.value = (ToDouble(t.value) > ToDouble(c) ? c : t.value)
|
t.value = (ToDouble(t.value) > ToDouble(c) ? c : t.value)
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ Imports System.IO.Compression
|
|||||||
Imports System.Net
|
Imports System.Net
|
||||||
Imports Microsoft.Reporting.WebForms
|
Imports Microsoft.Reporting.WebForms
|
||||||
Imports System.Net.Http
|
Imports System.Net.Http
|
||||||
|
Imports Newtonsoft.Json.Linq
|
||||||
|
|
||||||
Partial Class Ventas_PortalCliente
|
Partial Class Ventas_PortalCliente
|
||||||
Inherits ClsPaginas
|
Inherits ClsPaginas
|
||||||
@@ -26,6 +27,15 @@ Partial Class Ventas_PortalCliente
|
|||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
Private Property CvePrecioLista As Integer
|
||||||
|
Get
|
||||||
|
Return IfNull(ViewState("CvePrecioLista"), "-1", ViewState("CvePrecioLista")).ToString().ToEntero()
|
||||||
|
End Get
|
||||||
|
Set(value As Integer)
|
||||||
|
ViewState("CvePrecioLista") = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
Private Property Destino As String
|
Private Property Destino As String
|
||||||
Set(value As String)
|
Set(value As String)
|
||||||
ViewState("Destino") = value
|
ViewState("Destino") = value
|
||||||
@@ -223,8 +233,13 @@ Partial Class Ventas_PortalCliente
|
|||||||
CargarTipoBuzon()
|
CargarTipoBuzon()
|
||||||
CargarClienteSucursal()
|
CargarClienteSucursal()
|
||||||
End If
|
End If
|
||||||
|
If UsuarioActual.CveEmpresa = 143 Then
|
||||||
|
TabPedidos.Visible = True
|
||||||
|
CargaPedidos(TipoDocto:="Rem")
|
||||||
|
Else
|
||||||
CargaPedidos()
|
CargaPedidos()
|
||||||
|
End If
|
||||||
|
|
||||||
CargaCuentasDepositos()
|
CargaCuentasDepositos()
|
||||||
|
|
||||||
'??ESTE TAB VA DESAPARECER - PARA QUE SOLO LA EMPRESA GESTIONE A LOS USUARIOS POR CLIENTE??
|
'??ESTE TAB VA DESAPARECER - PARA QUE SOLO LA EMPRESA GESTIONE A LOS USUARIOS POR CLIENTE??
|
||||||
@@ -260,6 +275,7 @@ Partial Class Ventas_PortalCliente
|
|||||||
If ObjClientes.DtResultados.Rows.Count > 0 Then
|
If ObjClientes.DtResultados.Rows.Count > 0 Then
|
||||||
'Campos para Modificación
|
'Campos para Modificación
|
||||||
LtlCliente.Text = ObjClientes.Nombre
|
LtlCliente.Text = ObjClientes.Nombre
|
||||||
|
CvePrecioLista = ObjClientes.CvePrecioLista
|
||||||
Else
|
Else
|
||||||
Alert("El Cliente Solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia)
|
Alert("El Cliente Solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia)
|
||||||
End If
|
End If
|
||||||
@@ -1736,11 +1752,11 @@ Partial Class Ventas_PortalCliente
|
|||||||
|
|
||||||
UpIxC.Update()
|
UpIxC.Update()
|
||||||
End Sub
|
End Sub
|
||||||
Private Sub CargaPedidos(Optional TopPedidos As Integer = 21)
|
Private Sub CargaPedidos(Optional TopPedidos As Integer = 21, Optional TipoDocto As String = "Pd2")
|
||||||
Dim FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim.ToDate, MinFecha)
|
Dim FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim.ToDate, MinFecha)
|
||||||
Dim FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim.ToDate, MaxFecha)
|
Dim FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim.ToDate, MaxFecha)
|
||||||
Dim ObjClientes As New ClsClientes
|
Dim ObjClientes As New ClsClientes
|
||||||
If ObjClientes.GetHistorialVentas(CveCliente, UsuarioActual.CveEmpresa, TopPedidos, CveClienteSucursal:=-1, TipoDocto:="Pd2", CveEstatusFactura:=DdlEstatus.SelectedValue.ToEntero(), FechaI:=FechaI, FechaF:=FechaF) Then
|
If ObjClientes.GetHistorialVentas(CveCliente, UsuarioActual.CveEmpresa, TopPedidos, CveClienteSucursal:=-1, TipoDocto:=TipoDocto, CveEstatusFactura:=DdlEstatus.SelectedValue.ToEntero(), FechaI:=FechaI, FechaF:=FechaF) Then
|
||||||
GvPedidos.DataSource = ObjClientes.DtResultados
|
GvPedidos.DataSource = ObjClientes.DtResultados
|
||||||
If ObjClientes.DtResultados.Rows.Count < 21 Then
|
If ObjClientes.DtResultados.Rows.Count < 21 Then
|
||||||
LnkVerMasPedidos.Visible = False
|
LnkVerMasPedidos.Visible = False
|
||||||
@@ -1753,15 +1769,24 @@ Partial Class Ventas_PortalCliente
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
|
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
|
||||||
CargaPedidos()
|
Dim TipoDocto As String = "Pd2"
|
||||||
|
If UsuarioActual.CveEmpresa = 143 Then
|
||||||
|
TipoDocto = "Rem"
|
||||||
|
End If
|
||||||
|
CargaPedidos(TipoDocto:=TipoDocto)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Protected Sub BtnVerMasPedidos_Click(sender As Object, e As EventArgs)
|
Protected Sub BtnVerMasPedidos_Click(sender As Object, e As EventArgs)
|
||||||
|
Dim TipoDocto As String = "Pd2"
|
||||||
|
If UsuarioActual.CveEmpresa = 143 Then
|
||||||
|
TipoDocto = "Rem"
|
||||||
|
End If
|
||||||
|
|
||||||
If BtnVerMasVentas.Text = "Ver Más" Then
|
If BtnVerMasVentas.Text = "Ver Más" Then
|
||||||
CargaPedidos(-1)
|
CargaPedidos(-1, TipoDocto:=TipoDocto)
|
||||||
BtnVerMasVentas.Text = "Ver Menos"
|
BtnVerMasVentas.Text = "Ver Menos"
|
||||||
Else
|
Else
|
||||||
CargaPedidos(21)
|
CargaPedidos(21, TipoDocto:=TipoDocto)
|
||||||
BtnVerMasVentas.Text = "Ver Más"
|
BtnVerMasVentas.Text = "Ver Más"
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
@@ -2532,7 +2557,7 @@ Partial Class Ventas_PortalCliente
|
|||||||
|
|
||||||
#Region "CARGAS"
|
#Region "CARGAS"
|
||||||
|
|
||||||
Private Sub CargaFolios()
|
Private Sub CargaFolios(Optional TipoDocto As String = "Pd2")
|
||||||
|
|
||||||
If CveSubProyecto <= 0 Then
|
If CveSubProyecto <= 0 Then
|
||||||
Alert("No se tienen asignadas sucursales", TipoMensaje.MsgError)
|
Alert("No se tienen asignadas sucursales", TipoMensaje.MsgError)
|
||||||
@@ -2540,7 +2565,7 @@ Partial Class Ventas_PortalCliente
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
Dim ObjFolios As New ClsGralFolios()
|
Dim ObjFolios As New ClsGralFolios()
|
||||||
If ObjFolios.GetFolios("Pd2", UsuarioActual.CveEmpresa) Then
|
If ObjFolios.GetFolios(TipoDocto, UsuarioActual.CveEmpresa) Then
|
||||||
Dim DT As DataTable = ObjFolios.DtResultados.FiltraParametros(String.Format("CveSubProyecto = {0} And Estado = 'Activo'", CveSubProyecto))
|
Dim DT As DataTable = ObjFolios.DtResultados.FiltraParametros(String.Format("CveSubProyecto = {0} And Estado = 'Activo'", CveSubProyecto))
|
||||||
If DT.Rows.Count > 0 Then
|
If DT.Rows.Count > 0 Then
|
||||||
ViewState("CveFolio") = DT.Rows(0)("CveFolio").ToString.ToEntero
|
ViewState("CveFolio") = DT.Rows(0)("CveFolio").ToString.ToEntero
|
||||||
@@ -2593,7 +2618,12 @@ Partial Class Ventas_PortalCliente
|
|||||||
TxtPrecio.Attributes.Add("onKeyUp ", "Recalcula();")
|
TxtPrecio.Attributes.Add("onKeyUp ", "Recalcula();")
|
||||||
TxtCantidad.Attributes.Add("onKeyUp ", "Recalcula();")
|
TxtCantidad.Attributes.Add("onKeyUp ", "Recalcula();")
|
||||||
|
|
||||||
|
If UsuarioActual.CveEmpresa = 143 Then
|
||||||
|
CargaFolios("Rem")
|
||||||
|
Else
|
||||||
CargaFolios()
|
CargaFolios()
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
Dim Dt = New DataSet
|
Dim Dt = New DataSet
|
||||||
Dt.Tables.Add("Datos")
|
Dt.Tables.Add("Datos")
|
||||||
@@ -2751,6 +2781,7 @@ Partial Class Ventas_PortalCliente
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Protected Sub DdlPS_selectedindexchange(sender As Object, e As EventArgs)
|
Protected Sub DdlPS_selectedindexchange(sender As Object, e As EventArgs)
|
||||||
|
TxtPrecio.Text = ""
|
||||||
DdlPSIndexChange()
|
DdlPSIndexChange()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -2771,8 +2802,21 @@ Partial Class Ventas_PortalCliente
|
|||||||
DdlUM.DataBind()
|
DdlUM.DataBind()
|
||||||
DdlUM.SelectedValueExist(drPS("CveUnidadMedida").ToString)
|
DdlUM.SelectedValueExist(drPS("CveUnidadMedida").ToString)
|
||||||
|
|
||||||
TxtPrecio.Text = drPS("Precio").ToString.FormatoNumero(2).Replace(","c, "")
|
If UsuarioActual.CveEmpresa = 143 Then
|
||||||
|
If CvePrecioLista > 0 Then
|
||||||
|
Dim ObjPS As New ClsProductosServicios
|
||||||
|
If ObjPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioLista, CvePS:=DdlPS.SelectedValue.ToEntero()) Then
|
||||||
|
If ObjPS.DtResultados.Rows.Count > 0 Then
|
||||||
|
TxtPrecio.Text = ObjPS.DtResultados.Rows(0)("PrecioLista").ToString().ToDecimal().FormatoNumero()
|
||||||
|
Else
|
||||||
|
TxtPrecio.Text = ""
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
TxtPrecio.Text = ""
|
||||||
|
End If
|
||||||
|
ObjPS.Dispose()
|
||||||
|
End If
|
||||||
|
Else
|
||||||
If UsuarioActual.CveEmpresa = 80 Then
|
If UsuarioActual.CveEmpresa = 80 Then
|
||||||
'busca el precio de la sucursal
|
'busca el precio de la sucursal
|
||||||
Dim ObjPS As New ClsProductosServicios
|
Dim ObjPS As New ClsProductosServicios
|
||||||
@@ -2787,6 +2831,13 @@ Partial Class Ventas_PortalCliente
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
ObjPS.Dispose()
|
ObjPS.Dispose()
|
||||||
|
Else
|
||||||
|
TxtPrecio.Text = drPS("Precio").ToString.FormatoNumero(2).Replace(","c, "")
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
If TxtPrecio.Text.ToDecimal() <= 0 Then
|
||||||
|
Alert("No se encontro un precio para el producto seleccionado", TipoMensaje.MsgAdvertencia)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If DdlClasificacion.SelectedIndex = 0 Then
|
If DdlClasificacion.SelectedIndex = 0 Then
|
||||||
@@ -2804,6 +2855,7 @@ Partial Class Ventas_PortalCliente
|
|||||||
Else
|
Else
|
||||||
Alert("Es necesario seleccionar el cliente al cual se le va a facturar.", TipoMensaje.MsgAdvertencia, "AbrirVentana(""/Ventas/PopUpBuscarClientes.aspx?Opt=Fact"", 800, 547, ""N"", ""PopUpBuscar"")")
|
Alert("Es necesario seleccionar el cliente al cual se le va a facturar.", TipoMensaje.MsgAdvertencia, "AbrirVentana(""/Ventas/PopUpBuscarClientes.aspx?Opt=Fact"", 800, 547, ""N"", ""PopUpBuscar"")")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
RegistraScript("Recalcula();")
|
RegistraScript("Recalcula();")
|
||||||
UpVenta.Update()
|
UpVenta.Update()
|
||||||
|
|
||||||
@@ -2819,6 +2871,21 @@ Partial Class Ventas_PortalCliente
|
|||||||
|
|
||||||
#Region "AGREGAR/EDITAR/ELIMINAR"
|
#Region "AGREGAR/EDITAR/ELIMINAR"
|
||||||
Protected Sub LnkAddPedido_Click(sender As Object, e As EventArgs)
|
Protected Sub LnkAddPedido_Click(sender As Object, e As EventArgs)
|
||||||
|
If TmpDT IsNot Nothing Then
|
||||||
|
TmpDT.Rows.Clear()
|
||||||
|
TxtObsFact.Text = ""
|
||||||
|
|
||||||
|
GvPS.DataSource = TmpDT
|
||||||
|
GvPS.DataBind()
|
||||||
|
|
||||||
|
CalculaTotalesVenta()
|
||||||
|
End If
|
||||||
|
|
||||||
|
If UsuarioActual.CveEmpresa = 143 Then
|
||||||
|
DdlMoneda.SelectedValueExist(1)
|
||||||
|
DdlMoneda.Enabled = False
|
||||||
|
End If
|
||||||
|
|
||||||
RegistraScript("$('#DivVenta').modal({backdrop: 'static',keyboard: false});")
|
RegistraScript("$('#DivVenta').modal({backdrop: 'static',keyboard: false});")
|
||||||
End Sub
|
End Sub
|
||||||
Protected Sub LnkAddPSVenta_Click(sender As Object, e As EventArgs)
|
Protected Sub LnkAddPSVenta_Click(sender As Object, e As EventArgs)
|
||||||
@@ -2837,6 +2904,12 @@ Partial Class Ventas_PortalCliente
|
|||||||
DdlClasificacion.SelectedIndex = -1
|
DdlClasificacion.SelectedIndex = -1
|
||||||
DdlUM.Items.Clear()
|
DdlUM.Items.Clear()
|
||||||
ChkAgregar.Checked = True
|
ChkAgregar.Checked = True
|
||||||
|
|
||||||
|
If UsuarioActual.CveEmpresa = 143 Then
|
||||||
|
TxtPrecio.Enabled = False
|
||||||
|
End If
|
||||||
|
|
||||||
|
UpVenta.Update()
|
||||||
UpAddPedido.Update()
|
UpAddPedido.Update()
|
||||||
|
|
||||||
RegistraScript("$('#DivAddVenta').modal({backdrop: 'static',keyboard: false});")
|
RegistraScript("$('#DivAddVenta').modal({backdrop: 'static',keyboard: false});")
|
||||||
@@ -2850,7 +2923,7 @@ Partial Class Ventas_PortalCliente
|
|||||||
CargaPS(DdlClasificacion.SelectedValue.ToEntero, DdlPS)
|
CargaPS(DdlClasificacion.SelectedValue.ToEntero, DdlPS)
|
||||||
UpClasificacion.Update()
|
UpClasificacion.Update()
|
||||||
If Not UsuarioActual.Empresa.Funcionalidad(141).ToString = "1" Then
|
If Not UsuarioActual.Empresa.Funcionalidad(141).ToString = "1" Then
|
||||||
DdlPS.SelectedValue = GvRow.DataKey("CvePS")
|
DdlPS.ddl.SelectedValueExist(GvRow.DataKey("CvePS"))
|
||||||
Else
|
Else
|
||||||
DdlPS.SelectedValue = GvRow.DataKey("CvePS")
|
DdlPS.SelectedValue = GvRow.DataKey("CvePS")
|
||||||
DdlPS.SelectedText = GvRow.DataKey("PS")
|
DdlPS.SelectedText = GvRow.DataKey("PS")
|
||||||
@@ -2906,6 +2979,20 @@ Partial Class Ventas_PortalCliente
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub AgregarPS()
|
Private Sub AgregarPS()
|
||||||
|
If TxtPrecio.Text.ToDecimal() <= 0 Then
|
||||||
|
Alert("El precio del producto debe ser mayor a cero", TipoMensaje.MsgAdvertencia)
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
|
||||||
|
If UsuarioActual.CveEmpresa = 143 Then
|
||||||
|
For Each Row As DataRow In TmpDT.FiltraParametros("", DistinctColumns:={"CveClasificacion", "Clasificacion"}).Rows
|
||||||
|
If DdlClasificacion.SelectedValue.ToEntero <> Row("CveClasificacion").ToString().ToEntero() Then
|
||||||
|
Alert($"El pedido actual solo es para la clasificación '{Row("Clasificacion")}'. Debe seleccionar productos de la misma clasificación", TipoMensaje.MsgAdvertencia)
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
|
||||||
If Modalidad = "U" Then
|
If Modalidad = "U" Then
|
||||||
|
|
||||||
Dim ErrorEdit As Boolean = True
|
Dim ErrorEdit As Boolean = True
|
||||||
@@ -3181,7 +3268,7 @@ Partial Class Ventas_PortalCliente
|
|||||||
Timbre.Comprobante.FormadePago = Obj.FormaPagoSAT33
|
Timbre.Comprobante.FormadePago = Obj.FormaPagoSAT33
|
||||||
Timbre.Comprobante.CondicionesdePago = Obj.FormaPago33
|
Timbre.Comprobante.CondicionesdePago = Obj.FormaPago33
|
||||||
Timbre.Comprobante.MetodoPago = Obj.ClaveMetodoPagoSAT
|
Timbre.Comprobante.MetodoPago = Obj.ClaveMetodoPagoSAT
|
||||||
Timbre.Comprobante.Subtotal = Obj.SubTotal
|
Timbre.Comprobante.SubTotal = Obj.SubTotal
|
||||||
Timbre.Comprobante.Descuentos = Obj.Descuento
|
Timbre.Comprobante.Descuentos = Obj.Descuento
|
||||||
Timbre.Comprobante.Moneda = Obj.MonedaSAT
|
Timbre.Comprobante.Moneda = Obj.MonedaSAT
|
||||||
Timbre.Comprobante.TipoCambio = If(Obj.CveMoneda = 1, "1", Obj.TipoCambio.ToString)
|
Timbre.Comprobante.TipoCambio = If(Obj.CveMoneda = 1, "1", Obj.TipoCambio.ToString)
|
||||||
@@ -3287,8 +3374,136 @@ Partial Class Ventas_PortalCliente
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs)
|
Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs)
|
||||||
|
|
||||||
|
If UsuarioActual.CveEmpresa = 143 Then
|
||||||
|
GuardarWS()
|
||||||
|
Else
|
||||||
|
Guardar()
|
||||||
|
End If
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Function SubProyectosClasificaciones() As Hashtable
|
||||||
|
Dim retorno As New Hashtable()
|
||||||
|
|
||||||
|
'CVECLASIFICACION/CVESUBPROYECTO
|
||||||
|
retorno.Add(20331, 11713)
|
||||||
|
retorno.Add(20332, 11761)
|
||||||
|
retorno.Add(20333, 11714)
|
||||||
|
|
||||||
|
Return retorno
|
||||||
|
End Function
|
||||||
|
|
||||||
|
Private Sub GuardarWS()
|
||||||
|
|
||||||
|
Dim DtClasificaciones As DataTable = TmpDT.FiltraParametros("", DistinctColumns:={"CveClasificacion", "Clasificacion"})
|
||||||
|
|
||||||
|
If DtClasificaciones IsNot Nothing AndAlso DtClasificaciones.Rows.Count > 1 Then
|
||||||
|
Alert("El pedido debe tener productos de una misma clasificación", TipoMensaje.MsgAdvertencia)
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim CveSubProyectoPedido As Integer = -1
|
||||||
|
|
||||||
|
Dim CveClasificacion As Integer = TmpDT.FiltroPrimeroValor("CveClasificacion").ToEntero()
|
||||||
|
|
||||||
|
Dim SubProyectos = SubProyectosClasificaciones()
|
||||||
|
|
||||||
|
'VERIFICA SI LA CLASIFICACION PERTENECE AL SUBPROYECTO
|
||||||
|
If SubProyectos.ContainsKey(CveClasificacion) Then
|
||||||
|
CveSubProyectoPedido = SubProyectos(CveClasificacion).ToString().ToEntero()
|
||||||
|
Else
|
||||||
|
CveSubProyectoPedido = Me.CveSubProyecto
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim productos As New JArray()
|
||||||
|
For Each Row As DataRow In TmpDT.Rows
|
||||||
|
productos.Add(New JObject(
|
||||||
|
New JProperty("CvePS", Row("CvePS").ToString().ToEntero()),
|
||||||
|
New JProperty("Cantidad", Row("Cantidad").ToString().ToDecimal()),
|
||||||
|
New JProperty("Obs", Row("Obs").ToString()),
|
||||||
|
New JProperty("Precio", Row("PU").ToString().ToDecimal()),
|
||||||
|
New JProperty("Descuento", Row("Descuento").ToString().ToDecimal())
|
||||||
|
)
|
||||||
|
)
|
||||||
|
Next
|
||||||
|
|
||||||
|
Dim URLAPI As String = "https://sig.adssistemas.mx/asmx/WSApp.asmx?WSDL"
|
||||||
|
|
||||||
|
If Not EsProduccion Then
|
||||||
|
URLAPI = "http://localhost:85/asmx/WSApp.asmx?WSDL"
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim jsonResp = EnviarPedidoWS(URLAPI, CveCliente, CveSubProyectoPedido, UsuarioActual.CveUsuario, TxtObsFact.Text, productos.ToString())
|
||||||
|
|
||||||
|
If Not String.IsNullOrEmpty(jsonResp) Then
|
||||||
|
Dim resp As JObject = JObject.Parse(jsonResp)
|
||||||
|
Dim TieneError As Boolean = CBool(resp("TieneError"))
|
||||||
|
If Not TieneError Then
|
||||||
|
Alert($"La remisión <b>'{resp("SerieFolio")}'</b> se genero correctamente.", JSBtnAceptar:="CerrarModalVenta();", ShowCloseButton:=False)
|
||||||
|
CargaPedidos(TipoDocto:="Rem")
|
||||||
|
Else
|
||||||
|
Alert($"Ocurrió un error al generar el pedido.", TipoMensaje.MsgError)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Function EnviarPedidoWS(ByVal url As String, CveCliente As Integer, CveSubProyecto As Integer, CveUsuario As Integer, Observaciones As String, Productos As String) As String
|
||||||
|
Dim retorno = ""
|
||||||
|
|
||||||
|
Try
|
||||||
|
Dim request As HttpWebRequest = CType(WebRequest.Create($"{url}"), HttpWebRequest)
|
||||||
|
request.ContentType = "text/xml;charset=""utf-8"""
|
||||||
|
request.Accept = "text/xml"
|
||||||
|
request.Method = "POST"
|
||||||
|
Dim XMLString As String = $"<Envelope xmlns=""http://schemas.xmlsoap.org/soap/envelope/"">
|
||||||
|
<Body>
|
||||||
|
<AddPedido xmlns=""http://ADSistemas.org/"">
|
||||||
|
<CveCliente>{CveCliente}</CveCliente>
|
||||||
|
<CveSubProyecto>{CveSubProyecto}</CveSubProyecto>
|
||||||
|
<CveUsuario>{CveUsuario}</CveUsuario>
|
||||||
|
<Observaciones>{Observaciones}</Observaciones>
|
||||||
|
<Productos>{Productos}</Productos>
|
||||||
|
</AddPedido>
|
||||||
|
</Body>
|
||||||
|
</Envelope>"
|
||||||
|
Dim SOAPReqBody As XmlDocument = New XmlDocument()
|
||||||
|
SOAPReqBody.LoadXml(XMLString)
|
||||||
|
|
||||||
|
Using stream As Stream = request.GetRequestStream()
|
||||||
|
SOAPReqBody.Save(stream)
|
||||||
|
End Using
|
||||||
|
|
||||||
|
Dim response As String = ""
|
||||||
|
|
||||||
|
Using Serviceres As WebResponse = request.GetResponse()
|
||||||
|
Using rd As StreamReader = New StreamReader(Serviceres.GetResponseStream())
|
||||||
|
response = rd.ReadToEnd()
|
||||||
|
End Using
|
||||||
|
End Using
|
||||||
|
|
||||||
|
If Not String.IsNullOrEmpty(response) Then
|
||||||
|
Dim xmlRetorno = New XmlDocument()
|
||||||
|
xmlRetorno.LoadXml(response)
|
||||||
|
retorno = xmlRetorno.InnerText
|
||||||
|
Else
|
||||||
|
Alert($"Ocurrió un error al leer la respuesta.", TipoMensaje.MsgError)
|
||||||
|
retorno = ""
|
||||||
|
End If
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
retorno = ""
|
||||||
|
OnError("Ocurrió un error al guardar el pedido", ex)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Return retorno
|
||||||
|
End Function
|
||||||
|
|
||||||
|
|
||||||
|
Private Sub Guardar()
|
||||||
If TmpDT Is Nothing OrElse TmpDT.Rows.Count = 0 Then
|
If TmpDT Is Nothing OrElse TmpDT.Rows.Count = 0 Then
|
||||||
Alert("Es necesario tener al menos un concepto registrado.", TipoMensaje.MsgAdvertencia)
|
Alert("Es necesario tener al menos un concepto registrado.", TipoMensaje.MsgAdvertencia)
|
||||||
Exit Sub
|
Exit Sub
|
||||||
@@ -3424,8 +3639,8 @@ Partial Class Ventas_PortalCliente
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub EnviarCorreoPedido(ObjFactura As Modelos.Factura)
|
Private Sub EnviarCorreoPedido(ObjFactura As Modelos.Factura)
|
||||||
Dim Hilo As New System.Threading.Thread(Sub() MandaMails(UsuarioActual, ObjFactura.CveVenta, True, ObjFactura))
|
Dim Hilo As New System.Threading.Thread(Sub() MandaMails(UsuarioActual, ObjFactura.CveVenta, True, ObjFactura))
|
||||||
Hilo.Start()
|
Hilo.Start()
|
||||||
|
|||||||
Reference in New Issue
Block a user