Trapasos con pendientes por surtir,validar pagos,cambiar cliente de dispositivo,guardar PDF factura
This commit is contained in:
@@ -6382,7 +6382,7 @@ Public Class ClsPaginas
|
||||
Dim Archivo As New System.IO.FileInfo(RutaFormato)
|
||||
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))
|
||||
If Guardar Then
|
||||
If Not ArchivoPDF.Exists Then
|
||||
@@ -6405,7 +6405,28 @@ Public Class ClsPaginas
|
||||
Else
|
||||
params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa))
|
||||
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
|
||||
Catch ex As Exception
|
||||
GuardaLog(String.Format("Ocurrio un error al generar el reporte RLDC {0}", ex))
|
||||
|
||||
@@ -898,7 +898,7 @@ Namespace Modelos
|
||||
'If Not ImprimeAlert 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 ArchivoIng As New System.IO.FileInfo(String.Format("{0}Formatos/Factura.rdlc", UsuarioActual.Empresa.Ruta))
|
||||
@@ -1023,8 +1023,8 @@ Namespace Modelos
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer) 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))))
|
||||
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()
|
||||
@@ -1032,7 +1032,7 @@ Namespace Modelos
|
||||
Using request = New HttpRequestMessage(HttpMethod.Get, Url)
|
||||
request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}", CveEmpresa, DateTime.UtcNow.Ticks)))
|
||||
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
|
||||
End If
|
||||
End Using
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -522,7 +522,7 @@ Partial Class Inventarios_TraspasoAlmacen
|
||||
Dim Retorno = True
|
||||
|
||||
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()
|
||||
|
||||
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
|
||||
|
||||
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}'", "")}")
|
||||
'DtMovimientos.SUM("Cantidad", String.Format("CvePS = {0}", dr("CvePS").ToString.ToEntero))
|
||||
|
||||
@@ -697,7 +697,7 @@ Partial Class Inventarios_TraspasoAlmacen
|
||||
Next
|
||||
Else
|
||||
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
|
||||
If Existencia < 0 Then
|
||||
ErrorExistencia = True
|
||||
|
||||
@@ -4925,10 +4925,22 @@ Partial Class Clientes
|
||||
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
|
||||
Protected Sub DdlEmpresaDispositivo_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
CargaEmpresasUsuario(DdlEmpresaDispositivo.SelectedValue.ToEntero())
|
||||
End Sub
|
||||
CargaClienteDispositivos(DdlEmpresaDispositivo.SelectedValue.ToEntero())
|
||||
End Sub
|
||||
|
||||
|
||||
Protected Sub ImgMoverDispositivo_Click(sender As Object, e As EventArgs)
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
Me.NombreDispositivo = GvRow.DataKey("Display")
|
||||
|
||||
@@ -1142,6 +1142,15 @@ Partial Class Ventas
|
||||
End Set
|
||||
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
|
||||
|
||||
#Region "Propiedades PuntoVenta"
|
||||
@@ -4860,7 +4869,7 @@ Partial Class Ventas
|
||||
TrAtencionA.Visible = True
|
||||
tdVigencia.Visible = DdlTipoComprobante.SelectedValue.Contiene("Cot")
|
||||
tdFechaVigencia.Visible = DdlTipoComprobante.SelectedValue.Contiene("Cot")
|
||||
|
||||
Me.PermiteCredito = ObjCliente.PermiteCredito
|
||||
|
||||
LbAgregar.Enabled = True
|
||||
LnkAgregarPyME.Enabled = True
|
||||
@@ -16531,6 +16540,11 @@ Partial Class Ventas
|
||||
Private Function ValidaPagosContado() As Boolean
|
||||
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
|
||||
Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia)
|
||||
Retorno = True
|
||||
|
||||
Reference in New Issue
Block a user