Trapasos con pendientes por surtir,validar pagos,cambiar cliente de dispositivo,guardar PDF factura

This commit is contained in:
2019-10-07 15:58:00 -07:00
parent 6e379377f1
commit 6c9677a02b
6 changed files with 8688 additions and 8641 deletions

View File

@@ -6382,7 +6382,7 @@ Public Class ClsPaginas
Dim Archivo As New System.IO.FileInfo(RutaFormato) Dim Archivo As New System.IO.FileInfo(RutaFormato)
If Archivo.Exists Then If Archivo.Exists Then
retorno = StreamPDF(RutaFormato, lrds, params, NombreArchivo, "PDF", MR:=Nothing) retorno = StreamPDF(RutaFormatoDefault, lrds, params, NombreArchivo, "PDF", MR:=Nothing)
Dim ArchivoPDF As New System.IO.FileInfo(String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, Vta.TipoDocto, Vta.SerieFolio)) Dim ArchivoPDF As New System.IO.FileInfo(String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, Vta.TipoDocto, Vta.SerieFolio))
If Guardar Then If Guardar Then
If Not ArchivoPDF.Exists Then If Not ArchivoPDF.Exists Then
@@ -6405,7 +6405,28 @@ Public Class ClsPaginas
Else Else
params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa)) params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("RFC", UsuarioActual.Empresa.RFC)) params.Add(New ReportParameter("RFC", UsuarioActual.Empresa.RFC))
retorno = StreamPDF(RutaFormatoDefault, lrds, params, NombreArchivo, "PDF", MR:=Nothing) retorno = StreamPDF(RutaFormatoDefault, lrds, params, NombreArchivo, "PDF", MR:=Nothing)
Dim ArchivoPDF As New System.IO.FileInfo(String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, Vta.TipoDocto, Vta.SerieFolio))
If Guardar Then
If Not ArchivoPDF.Exists Then
Try
DirectoryExistsCreate(String.Format("{0}PDF", UsuarioActual.Empresa.Ruta))
DirectoryExistsCreate(String.Format("{0}PDF\{1}", UsuarioActual.Empresa.Ruta, Vta.TipoDocto))
File.WriteAllBytes(String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, Vta.TipoDocto, Vta.SerieFolio), retorno)
Catch ex As Exception
Alert("Ocurrió un error al generar el PDF", TipoMensaje.MsgAdvertencia)
End Try
Else
Try
ArchivoPDF.Delete()
File.WriteAllBytes(String.Format("{0}PDF\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, Vta.TipoDocto, Vta.SerieFolio), retorno)
Catch ex As Exception
Alert("Ocurrió un error al generar el PDF", TipoMensaje.MsgAdvertencia)
End Try
End If
End If
End If End If
Catch ex As Exception Catch ex As Exception
GuardaLog(String.Format("Ocurrio un error al generar el reporte RLDC {0}", ex)) GuardaLog(String.Format("Ocurrio un error al generar el reporte RLDC {0}", ex))

View File

@@ -898,7 +898,7 @@ Namespace Modelos
'If Not ImprimeAlert Then 'If Not ImprimeAlert Then
If Me.GenerarPDFFactura Then If Me.GenerarPDFFactura Then
DescargarFactura(CveVenta, CveEmpresa) DescargarFactura(CveVenta, CveEmpresa, False)
Dim ArchivoIngPyMe As New System.IO.FileInfo(String.Format("{0}Formatos/Factura.mrt", UsuarioActual.Empresa.Ruta)) Dim ArchivoIngPyMe As New System.IO.FileInfo(String.Format("{0}Formatos/Factura.mrt", UsuarioActual.Empresa.Ruta))
Dim ArchivoIng As New System.IO.FileInfo(String.Format("{0}Formatos/Factura.rdlc", UsuarioActual.Empresa.Ruta)) Dim ArchivoIng As New System.IO.FileInfo(String.Format("{0}Formatos/Factura.rdlc", UsuarioActual.Empresa.Ruta))
@@ -1023,8 +1023,8 @@ Namespace Modelos
Return Retorno Return Retorno
End Function End Function
Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer) As Byte() Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, Optional GetBytes As Boolean = true) As Byte()
Dim Url = New Uri(String.Format("{0}Compras/PopUpVerFactura.aspx?P={1}", ClsPaginas.UrlSitio, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta)))) 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 Dim File As Byte() = Nothing
Try Try
Using httpClient = New HttpClient() Using httpClient = New HttpClient()
@@ -1032,7 +1032,7 @@ Namespace Modelos
Using request = New HttpRequestMessage(HttpMethod.Get, Url) Using request = New HttpRequestMessage(HttpMethod.Get, Url)
request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}", CveEmpresa, DateTime.UtcNow.Ticks))) request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}", CveEmpresa, DateTime.UtcNow.Ticks)))
Dim response = httpClient.SendAsync(request).Result Dim response = httpClient.SendAsync(request).Result
If response.StatusCode = Net.HttpStatusCode.OK Then If GetBytes AndAlso response.StatusCode = Net.HttpStatusCode.OK Then
File = response.Content.ReadAsByteArrayAsync().Result File = response.Content.ReadAsByteArrayAsync().Result
End If End If
End Using End Using

File diff suppressed because it is too large Load Diff

View File

@@ -522,7 +522,7 @@ Partial Class Inventarios_TraspasoAlmacen
Dim Retorno = True Dim Retorno = True
Dim Inv As New ClsInventarios Dim Inv As New ClsInventarios
Dim Existencia As Double = Inv.GetExistenciasPS(CvePS, CveUnidadMedida, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), SerieLote:=SerieLote, Lote:=Lote, Batch:=Batch) Dim Existencia As Double = Inv.GetExistenciasPS(CvePS, CveUnidadMedida, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), SerieLote:=SerieLote, Lote:=Lote, Batch:=Batch, PendientePorSurtir:=1)
Inv.Dispose() Inv.Dispose()
If Existencia - Cantidad - DtMovimientos.SUM("Cantidad", $"CvePS = {CvePS} AND CveUM = {CveUnidadMedida} {If(SerieLote <> "-1", $" AND SerieLote = '{SerieLote}'", "")}") < 0 Then If Existencia - Cantidad - DtMovimientos.SUM("Cantidad", $"CvePS = {CvePS} AND CveUM = {CveUnidadMedida} {If(SerieLote <> "-1", $" AND SerieLote = '{SerieLote}'", "")}") < 0 Then
@@ -680,7 +680,7 @@ Partial Class Inventarios_TraspasoAlmacen
If Not CargadoDeMov Then If Not CargadoDeMov Then
For Each dr As DataRow In DtMovimientos.Rows For Each dr As DataRow In DtMovimientos.Rows
Existencia = ObjInventario.GetExistenciasPS(dr("CvePS").ToString.ToEntero, dr("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), SerieLote:=If(dr("SerieLote").ToString = "", "-1", dr("SerieLote").ToString)) Existencia = ObjInventario.GetExistenciasPS(dr("CvePS").ToString.ToEntero, dr("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), SerieLote:=If(dr("SerieLote").ToString = "", "-1", dr("SerieLote").ToString), PendientePorSurtir:=1)
Existencia -= DtMovimientos.SUM("Cantidad", $"CvePS = {dr("CvePS").ToString.ToEntero} AND CveUM = {dr("CveUM").ToString.ToEntero} {If(dr("SerieLote").ToString <> "-1", $" AND SerieLote = '{dr("SerieLote").ToString}'", "")}") Existencia -= DtMovimientos.SUM("Cantidad", $"CvePS = {dr("CvePS").ToString.ToEntero} AND CveUM = {dr("CveUM").ToString.ToEntero} {If(dr("SerieLote").ToString <> "-1", $" AND SerieLote = '{dr("SerieLote").ToString}'", "")}")
'DtMovimientos.SUM("Cantidad", String.Format("CvePS = {0}", dr("CvePS").ToString.ToEntero)) 'DtMovimientos.SUM("Cantidad", String.Format("CvePS = {0}", dr("CvePS").ToString.ToEntero))
@@ -697,7 +697,7 @@ Partial Class Inventarios_TraspasoAlmacen
Next Next
Else Else
For Each gvr As GridViewRow In GvDatos.Rows For Each gvr As GridViewRow In GvDatos.Rows
Existencia = ObjInventario.GetExistenciasPS(gvr.DataKey("CvePS").ToString.ToEntero, gvr.DataKey("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), SerieLote:=If(gvr.DataKey("SerieLote").ToString = "", "-1", gvr.DataKey("SerieLote").ToString)) Existencia = ObjInventario.GetExistenciasPS(gvr.DataKey("CvePS").ToString.ToEntero, gvr.DataKey("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDate.ToString("yyyy/MM/dd 23:59"), SerieLote:=If(gvr.DataKey("SerieLote").ToString = "", "-1", gvr.DataKey("SerieLote").ToString), PendientePorSurtir:=1)
Existencia -= gvr.FCTextBox("TxtCantidad2").Text.ToEntero Existencia -= gvr.FCTextBox("TxtCantidad2").Text.ToEntero
If Existencia < 0 Then If Existencia < 0 Then
ErrorExistencia = True ErrorExistencia = True

View File

@@ -4925,10 +4925,22 @@ Partial Class Clientes
End If End If
End If End If
End Sub
Private Sub CargaClienteDispositivos(CveEmpresa As Integer)
Dim Dt As DataTable = GlobalDTUsuarios(UsuarioActual.CveUsuario)
If Dt IsNot Nothing AndAlso Dt.Rows.Count > 0 Then
DdlClienteDispositivo.DataSource = Dt.FiltraParametros($"CvePlataforma = 3 AND CveEmpresa = {CveEmpresa}", "Empresa")
DdlClienteDispositivo.DataBind()
DdlClienteDispositivo.Items.Insert(0, New ListItem("Seleccione", "-1"))
End If
End Sub End Sub
Protected Sub DdlEmpresaDispositivo_SelectedIndexChanged(sender As Object, e As EventArgs) Protected Sub DdlEmpresaDispositivo_SelectedIndexChanged(sender As Object, e As EventArgs)
CargaEmpresasUsuario(DdlEmpresaDispositivo.SelectedValue.ToEntero()) CargaClienteDispositivos(DdlEmpresaDispositivo.SelectedValue.ToEntero())
End Sub End Sub
Protected Sub ImgMoverDispositivo_Click(sender As Object, e As EventArgs) Protected Sub ImgMoverDispositivo_Click(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Me.NombreDispositivo = GvRow.DataKey("Display") Me.NombreDispositivo = GvRow.DataKey("Display")

View File

@@ -1142,6 +1142,15 @@ Partial Class Ventas
End Set End Set
End Property End Property
Private Property PermiteCredito As Boolean
Get
Return If(IsNothing(ViewState("PermiteCredito")), False, CBool(ViewState("PermiteCredito")))
End Get
Set(value As Boolean)
ViewState("PermiteCredito") = value
End Set
End Property
#End Region #End Region
#Region "Propiedades PuntoVenta" #Region "Propiedades PuntoVenta"
@@ -4860,7 +4869,7 @@ Partial Class Ventas
TrAtencionA.Visible = True TrAtencionA.Visible = True
tdVigencia.Visible = DdlTipoComprobante.SelectedValue.Contiene("Cot") tdVigencia.Visible = DdlTipoComprobante.SelectedValue.Contiene("Cot")
tdFechaVigencia.Visible = DdlTipoComprobante.SelectedValue.Contiene("Cot") tdFechaVigencia.Visible = DdlTipoComprobante.SelectedValue.Contiene("Cot")
Me.PermiteCredito = ObjCliente.PermiteCredito
LbAgregar.Enabled = True LbAgregar.Enabled = True
LnkAgregarPyME.Enabled = True LnkAgregarPyME.Enabled = True
@@ -16531,6 +16540,11 @@ Partial Class Ventas
Private Function ValidaPagosContado() As Boolean Private Function ValidaPagosContado() As Boolean
Dim Retorno = False Dim Retorno = False
If (UsuarioActual.CveEmpresa = 140) AndAlso (Not PermiteCredito) AndAlso (DtPagos Is Nothing OrElse DtPagos.Rows.Count = 0) Then
Alert("Es necesario especificar un pago.", TipoMensaje.MsgAdvertencia)
Retorno = True
End If
If DtPagos.SUM("Importe").ToString.ToDecimal > TxtTotal.Text.ToDecimal Then If DtPagos.SUM("Importe").ToString.ToDecimal > TxtTotal.Text.ToDecimal Then
Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia) Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia)
Retorno = True Retorno = True