diff --git a/AF/CatAF.aspx.vb b/AF/CatAF.aspx.vb index 4a021ea00..1ee85db95 100644 --- a/AF/CatAF.aspx.vb +++ b/AF/CatAF.aspx.vb @@ -124,8 +124,8 @@ Partial Class AF_CatAF DdlTipoActivo.Items.Insert(0, New ListItem("Todos", "-1")) End Sub Private Sub CargaResponsable() - Dim DtPersonal = GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltraParametros("", "NombreCompleto") - DdlResponsable.DataSource = DtPersonal + + DdlResponsable.DataSource = GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltraParametros("", "NombreCompleto") DdlResponsable.DataBind() End Sub Protected Sub DdlTipoActivo_SelectedIndexChanged(sender As Object, e As EventArgs) @@ -454,7 +454,7 @@ Partial Class AF_CatAF End Sub Private Sub GenerarPDF(Optional Formato As String = "PDF") - If DtActivosFijos.Rows.Count > 0 Then + If DtActivosFijos IsNot Nothing AndAlso DtActivosFijos.Rows.Count > 0 Then Dim params As New List(Of ReportParameter) Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png") diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 66c8e9396..5ae2e572e 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -6914,6 +6914,13 @@ Public Class ClsPaginas params.Add(New ReportParameter("Tipo", TipoDocumento)) params.Add(New ReportParameter("Ref", TipoDocumentoRef)) params.Add(New ReportParameter("AplicaPagare", AplicaPagare)) + + If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then + params.Add(New ReportParameter("Documentacion", Vta.Cliente.Documentacion)) + params.Add(New ReportParameter("Medico", Vta.Medico)) + params.Add(New ReportParameter("Procedimiento", Vta.Procedimiento)) + params.Add(New ReportParameter("FechaCirugia", Vta.FechaEjecucion.ToString("dd/MM/yyyy HH:mm"))) + End If 'VSH If UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12, 122, 145) Then 'DATOS CLIENTES @@ -7197,6 +7204,46 @@ Public Class ClsPaginas GuardaLog("No se especifico el tipo de Impresion de venta (Venta, Remision, Cotización, Nota de Crédito).") Return Nothing End If + + If NombreArchivo = "FacturaUSA" Then + Dim DtBaseTotales = Vta.DtDeduccion.Clone() + + If Vta.DtDeduccion IsNot Nothing Then + Dim RowTotal_USA = DtBaseTotales.NewRow() + Dim RowPAYMENTS_USA = DtBaseTotales.NewRow() + Dim RowBALANCE_USA = DtBaseTotales.NewRow() + + Dim TOTAL_USA As Decimal = 0 + Dim PAYMENTS_USA As Decimal = 0 + Dim BALANCE_USA As Decimal = 0 + + For Each Row As DataRow In Vta.DtDeduccion.Rows + If Row("ImpuestoLocal").ToString() = "Total" Then + TOTAL_USA += Row("Importe").ToString().ToDecimal() + End If + Next + + RowTotal_USA("ImpuestoLocal") = "TOTAL" + RowTotal_USA("Importe") = TOTAL_USA + RowTotal_USA("Orden") = 1 + DtBaseTotales.Rows.Add(RowTotal_USA) + + RowPAYMENTS_USA("ImpuestoLocal") = "PAYMENTS/CREDITS" + RowPAYMENTS_USA("Importe") = PAYMENTS_USA + RowPAYMENTS_USA("Orden") = 2 + DtBaseTotales.Rows.Add(RowPAYMENTS_USA) + + BALANCE_USA = TOTAL_USA - PAYMENTS_USA + + RowBALANCE_USA("ImpuestoLocal") = "BALANCE DUE" + RowBALANCE_USA("Importe") = BALANCE_USA + RowBALANCE_USA("Orden") = 3 + DtBaseTotales.Rows.Add(RowBALANCE_USA) + + Vta.DtDeduccion = DtBaseTotales + End If + End If + 'TERMINA REGION PARAMETROS Dim lrds As New List(Of ReportDataSource) 'Si es ECLIPSE CREAR COLUMAS PARA FIRMAS EN DtDetalle. @@ -7273,6 +7320,7 @@ Public Class ClsPaginas If UsuarioActual.CveEmpresa.Contiene(141, 152, 159, 160, 161, 162, 163) AndAlso (RutaFormato.Contains("Factura") Or RutaFormato.Contains("Cotizacion")) Then params.Add(New ReportParameter("Kilometraje", Vta.Kilometraje.ToString)) End If + 'Imprime los parametros 'Dim ast As New StringBuilder 'For Each par As ReportParameter In params @@ -7550,6 +7598,7 @@ Public Class ClsPaginas End If End If ObjVentas.Dispose() + If Not IsNothing(Vta) Then PdfFactura(Vta) Vta = Nothing @@ -9163,7 +9212,7 @@ Public Class ClsPaginas End If If VentaActual.Fecha < tFechaUltimaFluctuacion Then TCValuacionVenta = TCValuacion 'si tiene fecha de documento, debe de evaluarse para su tc. y no la fecha de la prepóliza - If IIf(Pago.FechaDocumentoRelacionado > MinFecha, Pago.FechaDocumentoRelacionado, Pago.Fecha).ToString.ToDate < tFechaUltimaFluctuacion Then TCValuacionPago = TCValuacion + If IIf(Pago.FechaDocumentoRelacionado > MinFecha, Pago.FechaDocumentoRelacionado, Pago.Fecha).ToString.ToDate < tFechaUltimaFluctuacion AndAlso Pago.CveMonedaPago > 1 Then TCValuacionPago = TCValuacion End If End If If VentaActual.CveMoneda = 1 And Pago.CveMonedaPago <> 1 Then 'factura pesos, pago en dolares @@ -9173,7 +9222,7 @@ Public Class ClsPaginas tImporteVenta = (Pago.ImportePago * TCValuacionVenta).RoundSQL tImportePago = (Pago.ImportePago * TCValuacionPago).RoundSQL ElseIf VentaActual.CveMoneda <> 1 And Pago.CveMonedaPago = 1 Then 'factura dolares, pago en pesos - tImporteVenta = (Pago.ImportePago * TCValuacionVenta).RoundSQL + tImporteVenta = (Pago.ImportePagoVenta * TCValuacionVenta).RoundSQL tImportePago = (Pago.ImportePago * TCValuacionPago).RoundSQL End If If VentaActual.CveMoneda > 1 Then ImporteME = Pago.ImportePagoVenta diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 5839b9a96..cf9ba7c1b 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -576,7 +576,7 @@ Public Class ClsVentas Optional AtencionA As String = "", Optional PedidoContrato As String = "", Optional CveFormaPago33 As Integer = -1, Optional CveMetodoPago33 As Integer = -1, Optional CveCliente As Integer = -1, Optional CveClienteSucursal As Integer = -1, Optional OrdenCompra As String = "-1", Optional RetIVA As Decimal = -1, Optional RetISR As Decimal = -1, Optional Kilometraje As Decimal = 0, Optional CveUsoCFDi As Integer = -1, Optional ServicioDomicilio As Boolean = False, Optional CveVendedor As Integer = -1, - Optional RequiereOS As Boolean = False, Optional CveMedico As Integer = -1, Optional CveProcedimiento As Integer = -1) As Boolean + Optional RequiereOS As Boolean = False, Optional CveMedico As Integer = -1, Optional CveProcedimiento As Integer = -1, Optional FechaParaSurtir As DateTime = MinFecha) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_VentasUpdate") @@ -612,6 +612,7 @@ Public Class ClsVentas .Add("@RequiereOS", SqlDbType.Int).Value = RequiereOS .Add("@CveMedico", SqlDbType.Int).Value = CveMedico .Add("@CveProcedimiento", SqlDbType.Int).Value = CveProcedimiento + .Add("@FechaParaSurtir", SqlDbType.DateTime).Value = FechaParaSurtir End With Try @@ -625,7 +626,8 @@ Public Class ClsVentas End Function Public Function UpdateObservacionesVenta(CveVenta As Integer, CveEmpresa As Integer, CveVendedor As Integer, Observaciones As String, FormaPaqueteria As Integer, CorreoNotificaciones As String, ObservacionesAlm As String, - Pedido As String, OrdenCompra As String, FechaPago As String, CveUsoCFDI As Integer, Optional DescripcionVenta As String = "-1", Optional CveMedico As Integer = -1, Optional CveProcedimiento As Integer = -1) As Boolean + Pedido As String, OrdenCompra As String, FechaPago As String, CveUsoCFDI As Integer, Optional DescripcionVenta As String = "-1", Optional CveMedico As Integer = -1, Optional CveProcedimiento As Integer = -1, + Optional FechaParaSurtir As DateTime = MinFecha) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_VentasObservacionesUpdate") With SqlAdapter.SelectCommand.Parameters @@ -643,8 +645,42 @@ Public Class ClsVentas .Add("@DescripcionVenta", SqlDbType.VarChar).Value = DescripcionVenta .Add("@CveMedico", SqlDbType.Int).Value = CveMedico .Add("@CveProcedimiento", SqlDbType.Int).Value = CveProcedimiento + .Add("@FechaParaSurtir", SqlDbType.DateTime).Value = FechaParaSurtir + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar las observaciones de la venta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function + Public Function UpdateEstatusOCRelacionada(CveVenta As Integer, CveEstatusOrdenServicio As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_VentasOSEstatusUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + .Add("@CveEstatusOrdenServicio", SqlDbType.Int).Value = CveEstatusOrdenServicio + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar las observaciones de la venta.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function + + Public Function UpdateFechaOSVenta(CveVenta As Integer, FechaCita As DateTime, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_VentasOSFechaCitaUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + .Add("@FechaCita", SqlDbType.DateTime).Value = FechaCita + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa End With Try SqlAdapter.Fill(Data) diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index df92c7193..ebd40bcc6 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -6221,6 +6221,17 @@ Namespace Modelos End If End If + 'CANCELAR ORDEN DE SERVICIO + If Not ErrorCancelar Then + If ObjFactura.CveMedico > 0 Then + Dim CveEstatusCancelacion As Integer = ClsPaginas.GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveEstatusOrdenServicio", "TipoEstatus = 5", "Orden ASC").ToString().ToEntero() + If Not ObjVentas.UpdateEstatusOCRelacionada(ObjFactura.CveVenta, CveEstatusCancelacion, ObjFactura.CveEmpresa) Then + ErrorCancelar = True + MensajeError = "Ocurrió un error al cancelar la orden de servicio" + End If + End If + End If + End If 'MARCA LA VENTA PARA REALIZAR LA DEVOLUCION POSTERIORMENTE diff --git a/Ashx/SIGDesc.ashx b/Ashx/SIGDesc.ashx index 43f9264fe..e9b8053df 100644 --- a/Ashx/SIGDesc.ashx +++ b/Ashx/SIGDesc.ashx @@ -6,6 +6,7 @@ Imports System.IO Imports Extensiones Imports Microsoft.Reporting.WebForms Imports Newtonsoft.Json +Imports System.Net.Http Public Class SIGDesc : Implements IHttpHandler, IRequiresSessionState @@ -35,11 +36,47 @@ Public Class SIGDesc : Implements IHttpHandler, IRequiresSessionState context.Response.Flush() context.Response.WriteFile(FileInfo.FullName) context.Response.End() + Else + DescargarPDFVentaPeticion(context, ObjFactura) End If FileInfo = Nothing End If End Sub + + Private Sub DescargarPDFVentaPeticion(ByVal context As HttpContext, ObjFactura As Modelos.Factura) + Dim usuario As Usuario = UsuarioActual(context) + If Not IsNothing(usuario) Then + Dim strURLHOST = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port) + + Dim Url As New Uri(String.Format("{0}/Compras/PopUpVerFactura.aspx?P={1}", strURLHOST, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1®ENERAR={1}", ObjFactura.CveVenta, "1")))) + Dim File As Byte() = Nothing + Try + Using httpClient As New HttpClient() + httpClient.Timeout = New TimeSpan(0, 1, 0) + Using request As New HttpRequestMessage(HttpMethod.Get, Url) + request.Headers.Add("ADSToken", Encripta(String.Format("CVEEMPRESA={0}&TICKS={1}&CveUsuario={2}", ObjFactura.CveEmpresa, DateTime.UtcNow.Ticks, ObjFactura.CveUsuario))) + 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 + + context.Response.Buffer = True + context.Response.Clear() + context.Response.ContentType = "application/pdf" + context.Response.ClearHeaders() + context.Response.AddHeader("content-disposition", String.Format("{0}; filename=""{1}.{2}""", "attachment", ObjFactura.SerieFolio, "pdf")) + context.Response.BinaryWrite(File) ' create the file + context.Response.End() + End If + End Sub + Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable Get Return False diff --git a/Empresas/186/Formatos/Traslado.rdlc b/Empresas/186/Formatos/Traslado.rdlc index 7a9a096a5..1f5390b8a 100644 --- a/Empresas/186/Formatos/Traslado.rdlc +++ b/Empresas/186/Formatos/Traslado.rdlc @@ -724,7 +724,7 @@ 8.06981in - 4.8037cm + 5.67302cm true true @@ -824,7 +824,7 @@ CIUDAD DE MEXICO - =Microsoft.VisualBasic.Interaction.iif(Parameters!CveConcepto.Value = 8, "AVISO", "ENTRADA") & " DE TRASLADO " + =Microsoft.VisualBasic.Interaction.iif(Parameters!CveConcepto.Value = 8, "PRE-REMISIÓN", "ENTRADA DE TRASLADO") @@ -982,7 +982,7 @@ CIUDAD DE MEXICO Textbox12 - 2.21518cm + 2.85018cm 16.09549cm 0.44478cm 4.32987cm @@ -1187,7 +1187,7 @@ CIUDAD DE MEXICO true - 2.70907cm + 3.66157cm 2.01145cm 20.32792cm 8 @@ -1229,6 +1229,39 @@ CIUDAD DE MEXICO 2pt + + true + true + + + + + =Parameters!Observaciones.Value + + + + + + 2pt + 2pt + 2pt + 2pt + +