Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
@@ -2152,7 +2152,14 @@ Partial Class Ventas
|
||||
ViewState("EsGarantia") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property DtMercancias As DataTable
|
||||
Get
|
||||
Return If(IsNothing(ViewState("DtMercancias")), Nothing, CType(ViewState("DtMercancias"), DataTable))
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtMercancias") = value
|
||||
End Set
|
||||
End Property
|
||||
#End Region
|
||||
|
||||
'#Region "AuxiliarConta"
|
||||
@@ -2452,6 +2459,7 @@ Partial Class Ventas
|
||||
|
||||
CargaClasificaciones()
|
||||
CargaPS(-1, DdlPS)
|
||||
CargaPS(-1, DdlPSMercancia)
|
||||
'CargaPSRemision(-1, DdlPSRemision)
|
||||
CargaPSPyME(-1, DdlPSPyME)
|
||||
|
||||
@@ -5322,6 +5330,11 @@ Partial Class Ventas
|
||||
BtnsFacturar.Visible = True
|
||||
End If
|
||||
|
||||
'VERIFICA SI YA SE FACTURO COMPLETAMENTE
|
||||
If TmpDT.SUM("CantidadFacturadaRem") = TmpDT.SUM("Cantidad") Then
|
||||
BtnsFacturar.Visible = False
|
||||
End If
|
||||
|
||||
'VERIFICA SI TIENE USADOS O GARANTIAS PENDIENTES
|
||||
If BtnsFacturar.Visible Then
|
||||
If (Not EsGarantia AndAlso (DtUsadosPendientes IsNot Nothing AndAlso DtUsadosPendientes.Rows.Count > 0)) Then
|
||||
@@ -11021,12 +11034,18 @@ Partial Class Ventas
|
||||
|
||||
ObjFactura.EsGarantia = Me.EsGarantia
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(558).ToEntero() = 1 AndAlso TrKilometraje.Visible Then
|
||||
ObjFactura.Kilometraje = TxtKilometraje.Text.Trim.ToDecimal()
|
||||
End If
|
||||
|
||||
'ASIGNAR RFC RECEPTOR
|
||||
If ObjFactura.Timbre IsNot Nothing Then
|
||||
If ObjFactura.Timbre.Receptor IsNot Nothing Then
|
||||
ObjFactura.RFCReceptor = ObjFactura.Timbre.Receptor.RFC
|
||||
End If
|
||||
End If
|
||||
|
||||
ObjFactura.DtMercancias = DtMercancias
|
||||
End Sub
|
||||
|
||||
Private Sub CreaObjetosVentaDevolucion()
|
||||
@@ -11358,7 +11377,7 @@ Partial Class Ventas
|
||||
Timbre.Receptor.DomicilioFiscalReceptor = Obj.ClienteSucursal.CP
|
||||
Else
|
||||
Timbre.Receptor.RFC = Obj.Cliente.RFC
|
||||
Timbre.Receptor.Nombre = Obj.Cliente.Nombre
|
||||
Timbre.Receptor.Nombre = Obj.Cliente.NombreComercial
|
||||
Timbre.Receptor.DomicilioFiscalReceptor = Obj.Cliente.CP
|
||||
End If
|
||||
|
||||
@@ -14383,15 +14402,16 @@ Partial Class Ventas
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Dim DebeGenerarMovimiento As Boolean = TmpDT.COUNT("CvePS", "CveTipoPS = 2") > 0
|
||||
'VERIFICA QUE SE REALIZO EL MOVIMIENTO DE ALMACEN
|
||||
If DebeGenerarMovimiento AndAlso UsuarioActual.Empresa.Funcionalidad(558) = "1" AndAlso UsuarioActual.Empresa.Funcionalidad(567) = "1" AndAlso factura.TipoDocto.Contiene("Ing", "Rem") Then
|
||||
If Not (ObjInventario.GetInv_Mov(factura.CveVenta, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0) Then
|
||||
OcurrioError = True
|
||||
ErrorList.Add("Ocurrió un error al verificar inventario.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
|
||||
'DEBE GENERAR MOVIMIENTO SI SE FACTURAON PRODUCTOS, O NO SE REALIZA UNA REFACTURACION
|
||||
Dim DebeGenerarMovimiento As Boolean = TmpDT.COUNT("CvePS", "CveTipoPS = 2") > 0 AndAlso (NuevaFactura <> 1)
|
||||
'VERIFICA QUE SE REALIZO EL MOVIMIENTO DE ALMACEN
|
||||
If Not OcurrioError AndAlso DebeGenerarMovimiento AndAlso UsuarioActual.Empresa.Funcionalidad(558) = "1" AndAlso UsuarioActual.Empresa.Funcionalidad(567) = "1" AndAlso factura.TipoDocto.Contiene("Ing", "Rem") Then
|
||||
If Not (ObjInventario.GetInv_Mov(factura.CveVenta, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0) Then
|
||||
OcurrioError = True
|
||||
ErrorList.Add("Ocurrió un error al verificar inventario.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
@@ -14831,12 +14851,11 @@ Partial Class Ventas
|
||||
|
||||
'TIMBRADO NUEVO
|
||||
Try
|
||||
PdfFactura(ObjFactura)
|
||||
'If DdlTipoComprobante.SelectedValue = "Ing" Or DdlTipoComprobante.SelectedValue = "Ant" Then
|
||||
' PdfFactura(ObjFactura)
|
||||
' 'Else
|
||||
' ' pdf = PdfFactura(ObjFactura)
|
||||
'End If
|
||||
Dim ObjetoPDF As Byte() = DescargarFactura(ObjFactura.CveVenta, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario)
|
||||
|
||||
If ObjetoPDF Is Nothing OrElse ObjetoPDF.Length = 0 Then
|
||||
PdfFactura(ObjFactura, AplicaPagare:=If(ObjFactura.TipoDocto.Contiene("Ing", "Rem", "Ant"), "1", "0"))
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
Alert("Ocurrió un error al generar el PDF", TipoMensaje.MsgError)
|
||||
@@ -14935,7 +14954,7 @@ Partial Class Ventas
|
||||
|
||||
'TIMBRADO NUEVO
|
||||
Try
|
||||
pdf = PdfFactura(ObjFactura)
|
||||
pdf = PdfFactura(ObjFactura, AplicaPagare:="1")
|
||||
Catch ex As Exception
|
||||
Alert("Ocurrió un error al generar el PDF", TipoMensaje.MsgError)
|
||||
End Try
|
||||
@@ -22241,10 +22260,10 @@ Partial Class Ventas
|
||||
Return Retorno
|
||||
End If
|
||||
|
||||
If Not PermiteCredito AndAlso TienePagos AndAlso TxtTotal.Text.ToDecimal > 0 Then
|
||||
If (Not PermiteCredito OrElse RBLPago.SelectedValue = "2") AndAlso TienePagos AndAlso TxtTotal.Text.ToDecimal > 0 Then
|
||||
Dim TotalPago As Decimal = DtPagos.SUM("Importe").ToDecimal() + AmortizacionNC
|
||||
|
||||
If TotalPago < TxtTotal.Text.ToDecimal Then
|
||||
If TotalPago <> TxtTotal.Text.ToDecimal Then
|
||||
If MostrarAlertas Then
|
||||
Alert("La suma de los pagos debe ser igual al total de la venta.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
@@ -22319,7 +22338,7 @@ Partial Class Ventas
|
||||
If Not PermiteCredito AndAlso TienePagos AndAlso TxtTotal.Text.ToDecimal > 0 Then
|
||||
Dim TotalPago As Decimal = DtPagos.SUM("Importe").ToDecimal() + AmortizacionNC
|
||||
|
||||
If TotalPago < TxtTotal.Text.ToDecimal Then
|
||||
If TotalPago <> TxtTotal.Text.ToDecimal Then
|
||||
If MostrarAlertas Then
|
||||
Alert("La suma de los pagos debe ser igual al total de la venta.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
@@ -22640,6 +22659,7 @@ Partial Class Ventas
|
||||
|
||||
GvInv.DataSource = DtTemporal
|
||||
GvInv.DataBind()
|
||||
|
||||
UpINV.Update()
|
||||
End Sub
|
||||
#End Region
|
||||
@@ -32994,27 +33014,27 @@ Partial Class Ventas
|
||||
|
||||
' 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
|
||||
Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, CveUsuarioCreo As Integer, Optional GetBytes As Boolean = True) As Byte()
|
||||
Dim Url = New Uri(String.Format("{0}://{1}:{2}/Compras/PopUpVerFactura.aspx?P={3}", HttpContext.Current.Request.Url.Scheme, 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, 2, 0)
|
||||
Using request = New HttpRequestMessage(HttpMethod.Get, Url)
|
||||
request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}&CveUsuario={2}", CveEmpresa, DateTime.UtcNow.Ticks, CveUsuarioCreo)))
|
||||
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
|
||||
Return File
|
||||
End Function
|
||||
Protected Sub LnkGenerarOC_Click(sender As Object, e As EventArgs)
|
||||
Response.Redirect($"~/OC/OC.aspx?CveCotizacion={Me.CveVenta}&Tipo=OC")
|
||||
End Sub
|
||||
@@ -34281,7 +34301,7 @@ Partial Class Ventas
|
||||
|
||||
If CveEntregaAlmacen > 0 Then
|
||||
|
||||
For Each RowPS As DataRow In ObjFactura.DtDetalle.FiltraParametros("CveTipoPS = 2").Rows
|
||||
For Each RowPS As DataRow In ObjFactura.DtMercancias.Rows
|
||||
If Not ObjGral.AddEntregaAlmacenRutaDetalle(CveEntregaAlmacen, RowPS("CvePS").ToString().ToEntero, RowPS("Cantidad").ToString().ToEntero, RowPS("CveUM").ToString().ToEntero, UsuarioActual.CveUsuario) Then
|
||||
ErrorProceso = True
|
||||
Exit For
|
||||
@@ -34458,6 +34478,65 @@ Partial Class Ventas
|
||||
|
||||
UpEmitirTransitorio.Update()
|
||||
End Sub
|
||||
Protected Sub LnkAgregarMercancia_Click(sender As Object, e As EventArgs)
|
||||
TxtCantidadMercancia.Text = ""
|
||||
DdlPSMercancia.SelectedValue = ""
|
||||
DdlPSMercancia.SelectedText = "Seleccione"
|
||||
|
||||
UpAgregarMercancia.Update()
|
||||
RegistraScript("$('#DivAddMercancia').modal('show');", "M1")
|
||||
End Sub
|
||||
Protected Sub LnkAddPSMercancia_Click(sender As Object, e As EventArgs)
|
||||
If DtMercancias Is Nothing Then
|
||||
DtMercancias = New DataTable()
|
||||
DtMercancias.Columns.Add(New DataColumn("Consec", GetType(Integer)))
|
||||
DtMercancias.Columns.Add(New DataColumn("Cantidad", GetType(Integer)))
|
||||
DtMercancias.Columns.Add(New DataColumn("CvePS", GetType(Integer)))
|
||||
DtMercancias.Columns.Add(New DataColumn("CveUM", GetType(Integer)))
|
||||
DtMercancias.Columns.Add(New DataColumn("CodigoPS", GetType(String)))
|
||||
End If
|
||||
Dim CvePS As Integer = DdlPSMercancia.SelectedValue.ToEntero()
|
||||
|
||||
Dim DrPS As DataRow = GlobalDTPSSimplificado(CveEmpresa:=UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
|
||||
If DrPS Is Nothing Then
|
||||
Alert("No se encontró el producto/servicio", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim NewRow As DataRow = DtMercancias.NewRow
|
||||
NewRow("Consec") = DtMercancias.MAX("Consec").ToEntero() + 1
|
||||
NewRow("Cantidad") = TxtCantidadMercancia.Text.ToDecimal()
|
||||
NewRow("CvePS") = DrPS("CvePS")
|
||||
NewRow("CveUM") = DrPS("CveUnidadMedida")
|
||||
NewRow("CodigoPS") = DrPS("PSCodigo")
|
||||
|
||||
DtMercancias.Rows.Add(NewRow)
|
||||
|
||||
GvMercanciasCP.DataSource = DtMercancias
|
||||
GvMercanciasCP.DataBind()
|
||||
|
||||
TxtCantidadMercancia.Text = ""
|
||||
DdlPSMercancia.SelectedValue = ""
|
||||
DdlPSMercancia.SelectedText = "Seleccione"
|
||||
|
||||
UpAgregarMercancia.Update()
|
||||
UpEmitirTransitorio.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub GvMercanciasCP_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvMercanciasCP.RowDeleting
|
||||
|
||||
Dim DbRow As DataRow = Nothing
|
||||
DbRow = DtMercancias.Rows(e.RowIndex)
|
||||
DtMercancias.Rows.Remove(DbRow)
|
||||
|
||||
GvMercanciasCP.DataSource = DtMercancias
|
||||
GvMercanciasCP.DataBind()
|
||||
|
||||
Alert("Eliminado Correctamente.", TipoMensaje.MsgInformacion)
|
||||
|
||||
UpEmitirTransitorio.Update()
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
Protected Sub BtnGenerarPoliza_Click(sender As Object, e As EventArgs)
|
||||
@@ -34499,5 +34578,7 @@ Partial Class Ventas
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user