diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index b28b1630c..2e545adf1 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -1539,6 +1539,26 @@ Public Class ClsContabilidad Return Retorno End Function + Public Function DesAplicarPago(CvePrePoliza As Integer, CveConcepto As Integer, CveVenta As Integer, CveVentaAmortizacion As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Conta_DesAplicarMovimiento") + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza + .Add("@CveConceptoContable", SqlDbType.Int).Value = CveConcepto + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + .Add("@CveVentaAmortizacion", SqlDbType.Int).Value = CveVentaAmortizacion + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + + OnError("Ocurrió un error al desaplicar pago.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + + End Try + Return Retorno + End Function + Public Function GetEncabezadoPrePoliza(CvePrePoliza As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False @@ -4364,6 +4384,7 @@ Public Class ClsContabilidad End With Try + SqlAdapter.SelectCommand.CommandTimeout = 0 SqlAdapter.Fill(DSet) Retorno = True Catch ex As Exception diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index 6bc4d1389..1852ebb92 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -5963,7 +5963,7 @@ Public Class ClsInventarios - Public Function RepCompuestosVigencia(CveCompuesto As Integer, CveProveedor As Integer, FechaI As Date, FechaF As Date, VigenciaIndeterminada As Boolean, CveEmpresa As Integer, Optional ConCaducidad As Boolean = False) As Boolean + Public Function RepCompuestosVigencia(CveCompuesto As Integer, CveProveedor As Integer, FechaI As Date, FechaF As Date, VigenciaIndeterminada As Boolean, CveEmpresa As Integer, CveAlmacen As Integer, CveUsuario As Integer, Optional ConCaducidad As Boolean = False) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_CompuestosVigenciaRep") @@ -5975,9 +5975,10 @@ Public Class ClsInventarios .Add("@FechaI", SqlDbType.Date).Value = FechaI .Add("@FechaF", SqlDbType.Date).Value = FechaF .Add("@VigenciaIndeterminada", SqlDbType.Int).Value = VigenciaIndeterminada + .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@ConCaducidad", SqlDbType.Bit).Value = ConCaducidad - + .Add("@ConCaducidad", SqlDbType.Bit).Value = If(ConCaducidad, 1, 0) + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario End With Try diff --git a/App_Code/ClsNominas.vb b/App_Code/ClsNominas.vb index e688b1a85..a2d3ffa62 100644 --- a/App_Code/ClsNominas.vb +++ b/App_Code/ClsNominas.vb @@ -2733,7 +2733,7 @@ Public Class ClsNominas End Try Return retorno End Function - Public Function PersonalIncapacidadAdd(CveUsuarioCapturo As Integer, cvePersonal As Int32, folio As String, fechaInicio As DateTime, diasAutorizados As Int32, cveTipodeIncidencia As Int32, cveRamoSeguro As Int32, cveTipoRiesgo As Int32, porcentajedeIncapacidad As Int32, cveSecuelaConsecuencia As Int32, cveControlIncapacidad As Int32, descripcion As String) As Boolean + Public Function PersonalIncapacidadAdd(CveUsuarioCapturo As Integer, cvePersonal As Int32, folio As String, fechaInicio As DateTime, diasAutorizados As Int32, cveTipodeIncidencia As Int32, cveRamoSeguro As Int32, cveTipoRiesgo As Int32, porcentajedeIncapacidad As Int32, cveSecuelaConsecuencia As Int32, cveControlIncapacidad As Int32, descripcion As String, Optional DiasPagoEmpresa As Integer = 0) As Boolean Dim retorno As Boolean = False DataAdapter("PA_Nom_PersonalIncapacidadAdd", CommandType.StoredProcedure) Try @@ -2750,6 +2750,7 @@ Public Class ClsNominas .Add("@CveSecuelaConsecuencia", SqlDbType.Int).Value = cveSecuelaConsecuencia .Add("@CveControlIncapacidad", SqlDbType.Int).Value = cveControlIncapacidad .Add("@Descripcion", SqlDbType.VarChar).Value = descripcion + .Add("@DiasPagoEmpresa", SqlDbType.Int).Value = DiasPagoEmpresa End With SqlAdapter.Fill(Data) retorno = True @@ -2766,7 +2767,7 @@ Public Class ClsNominas End Try Return retorno End Function - Public Function PersonalIncapacidadUp(CveUsuarioCapturo As Integer, cvePersonalIncapacidad As Int32, folio As String, fechaInicio As DateTime, diasAutorizados As Int32, cveTipodeIncidencia As Int32, cveRamoSeguro As Int32, cveTipoRiesgo As Int32, porcentajedeIncapacidad As Int32, cveSecuelaConsecuencia As Int32, cveControlIncapacidad As Int32, descripcion As String) As Boolean + Public Function PersonalIncapacidadUp(CveUsuarioCapturo As Integer, cvePersonalIncapacidad As Int32, folio As String, fechaInicio As DateTime, diasAutorizados As Int32, cveTipodeIncidencia As Int32, cveRamoSeguro As Int32, cveTipoRiesgo As Int32, porcentajedeIncapacidad As Int32, cveSecuelaConsecuencia As Int32, cveControlIncapacidad As Int32, descripcion As String, Optional DiasPagoEmpresa As Integer = 0) As Boolean Dim retorno As Boolean = False DataAdapter("PA_Nom_PersonalIncapacidadUp", CommandType.StoredProcedure) Try @@ -2783,6 +2784,7 @@ Public Class ClsNominas .Add("@CveSecuelaConsecuencia", SqlDbType.Int).Value = cveSecuelaConsecuencia .Add("@CveControlIncapacidad", SqlDbType.Int).Value = cveControlIncapacidad .Add("@Descripcion", SqlDbType.VarChar).Value = descripcion + .Add("@DiasPagoEmpresa", SqlDbType.Int).Value = DiasPagoEmpresa End With SqlAdapter.Fill(Data) retorno = True @@ -3203,10 +3205,11 @@ Public Class ClsNominas End Function #Region "Visor sat" - Public Function SATSolicitudTimbreNominaGral(IDsolicitud As Integer, cveEmpresa As Integer, fechaInicio As String, fechaFin As String) As Boolean + Public Function SATSolicitudTimbreNominaGral(IDsolicitud As Integer, cveEmpresa As Integer, fechaInicio As String, fechaFin As String, TipoNomina As Integer) As Boolean Dim retorno As Boolean = False DataAdapter("[PA_SAT_SolicitudTimbreNominaGral]", CommandType.StoredProcedure) addParameters("@IDsolicitud", SqlDbType.Int, IDsolicitud) + addParameters("@TipoNomina", SqlDbType.Int, TipoNomina) addParameters("@CveEmpresa", SqlDbType.Int, cveEmpresa) addParameters("@FechaInicio", SqlDbType.VarChar, fechaInicio) addParameters("@FechaFin", SqlDbType.VarChar, fechaFin) diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 4f709540a..2e28fafa2 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -8689,7 +8689,7 @@ Public Class ClsPaginas End If DTPercepciones = ObjNomina.DtResultados.FiltraParametros($"((Tipo = 'P' OR (Tipo = 'D' AND Importe <0)) AND Importe <>0 AND EsPadre = 1 AND SoloVisible =0) {filtrop}") DTDeducciones = ObjNomina.DtResultados.FiltraParametros($"(Tipo = 'D' AND Importe >0 AND EsPadre = 1 AND SoloVisible =0) {friltrod}") - DTDeducciones2 = ObjNomina.DtResultados.FiltraParametros($"((Tipo = 'D' AND Importe >0 AND EsPadre = 1 AND SoloVisible =0) OR CveSistema IN (20,21)){friltrod}") + DTDeducciones2 = ObjNomina.DtResultados.FiltraParametros($"((Tipo = 'D' AND Importe >0 AND EsPadre = 1 AND SoloVisible =0) OR CveSistema IN (20,21) OR CveConcepto =4714){friltrod}") ajusteindemnizacion = ObjNomina.DtResultados.FiltraParametros($"((Tipo = 'P' OR (Tipo = 'D' AND Importe <0)) AND Importe <>0 AND EsPadre = 1 AND SoloVisible =0) AND CveSistema IN(10,11,32)").SUM("Importe") - ObjNomina.DtResultados.FiltraParametros($"(Tipo = 'D' AND Importe >0 AND EsPadre = 1 AND SoloVisible =0) AND CveSistema =47").SUM("Importe") @@ -9388,15 +9388,19 @@ Public Class ClsPaginas Dim FuncionalidadFluctuacionImpuestos As Boolean = If(UsuarioActual.Empresa.Funcionalidad(159) = "1", True, False) Dim tFecha As Date = Pago.Fecha - Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(tFecha) - If UsuarioActual.Empresa.Funcionalidad(703) = "1" AndAlso UltimaFluctuacion IsNot Nothing Then - If UltimaFluctuacion.FechaFluctuacion <= tFecha Then - 'FechaUltimaFluctuacion = UltimaFluctuacion.FechaFluctuacion - TCValuacion = UltimaFluctuacion.TCFluctuacion + If CompraActual.CveMoneda <> 1 OrElse Pago.CveMonedaPago <> 1 Then + Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(tFecha) + + If UsuarioActual.Empresa.Funcionalidad(703) = "1" AndAlso UltimaFluctuacion IsNot Nothing Then + If UltimaFluctuacion.FechaFluctuacion <= tFecha Then + 'FechaUltimaFluctuacion = UltimaFluctuacion.FechaFluctuacion + TCValuacion = UltimaFluctuacion.TCFluctuacion + End If End If End If + If CompraActual.CveMoneda = 1 And Pago.CveMonedaPago <> 1 Then 'factura pesos, pago en dolares tImportePago = ((Pago.ImportePago * TCValuacion / Pago.TCPago).RoundSQL * Pago.TCPago).RoundSQL ElseIf CompraActual.CveMoneda <> 1 And Pago.CveMonedaPago <> 1 Then 'factura dolares, pago en dolares @@ -9425,7 +9429,7 @@ Public Class ClsPaginas ImporteMN = (ImporteMovimiento * CompraActual.TC).RoundSQL If CompraActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento - Dim Ret As CompraRetenciones = CompraActual.ConceptoPrePolizaIVA + Dim Ret As ConceptosRetenciones = CompraActual.ConceptoPrePolizaIVA If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMN, Ret.CveConceptoxAcreditar, CompraActual.SerieFolio, Concepto, Ret.IdCtaContablexAcreditar, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, PorcentajeImpuesto:=CompraActual.PorcentajeIVA, CvePersonal:=Pago.CvePersonal, TipoCambio:=CompraActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) Then ErrorMovtos = True 'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe @@ -9451,7 +9455,7 @@ Public Class ClsPaginas ImporteMN = (ImporteMovimiento * CompraActual.TC).RoundSQL If CompraActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento - Dim Ret As CompraRetenciones = CompraActual.ConceptoPrePolizaRetIVA + Dim Ret As ConceptosRetenciones = CompraActual.ConceptoPrePolizaRetIVA If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, Ret.CveConceptoxAcreditar, CompraActual.SerieFolio, Concepto, Ret.IdCtaContablexAcreditar, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) Then ErrorMovtos = True 'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe @@ -9467,7 +9471,7 @@ Public Class ClsPaginas ImporteMN = (ImporteMovimiento * CompraActual.TC).RoundSQL If CompraActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento - Dim Ret As CompraRetenciones = CompraActual.ConceptoPrePolizaRetISR + Dim Ret As ConceptosRetenciones = CompraActual.ConceptoPrePolizaRetISR If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, Ret.CveConceptoxAcreditar, CompraActual.SerieFolio, Concepto, Ret.IdCtaContablexAcreditar, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) Then ErrorMovtos = True 'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe @@ -9483,7 +9487,7 @@ Public Class ClsPaginas ImporteMN = (ImporteMovimiento * CompraActual.TC).RoundSQL If CompraActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento - Dim Ret As New CompraRetenciones + Dim Ret As New ConceptosRetenciones If UsuarioActual.Empresa.TipoContabilidad = 2 Then If ObjConta.GetRetCuenta(26, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then Ret.IdCtaContableAcreditable = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSAcreditable").ToString.ToEntero @@ -9590,9 +9594,9 @@ Public Class ClsPaginas Public Property IdCtaContableProv As Integer Public Property IdCtaContableProvComplementaria As Integer - Public ReadOnly Property ConceptoPrePolizaIVA As CompraRetenciones + Public ReadOnly Property ConceptoPrePolizaIVA As ConceptosRetenciones Get - Dim Ret As New CompraRetenciones + Dim Ret As New ConceptosRetenciones If EsImportacion Then Ret.CveConceptoAcreditable = 288 Ret.CveConceptoxAcreditar = 287 @@ -9618,9 +9622,9 @@ Public Class ClsPaginas End Get End Property - Public ReadOnly Property ConceptoPrePolizaRetIVA As CompraRetenciones + Public ReadOnly Property ConceptoPrePolizaRetIVA As ConceptosRetenciones Get - Dim Ret As New CompraRetenciones + Dim Ret As New ConceptosRetenciones Dim Funcionalidad As Integer If CveConceptoRetIVA = 1 Then Funcionalidad = 308 @@ -9670,9 +9674,9 @@ Public Class ClsPaginas Return Ret End Get End Property - Public ReadOnly Property ConceptoPrePolizaRetISR As CompraRetenciones + Public ReadOnly Property ConceptoPrePolizaRetISR As ConceptosRetenciones Get - Dim Ret As New CompraRetenciones + Dim Ret As New ConceptosRetenciones Dim Funcionalidad As Integer If CveConceptoRetISR = 1 Then Funcionalidad = 316 @@ -9714,7 +9718,7 @@ Public Class ClsPaginas End Class - Public Class CompraRetenciones + Public Class ConceptosRetenciones Public Property CveConceptoxAcreditar As Integer Public Property CveConceptoAcreditable As Integer Public Property IdCtaContablexAcreditar As Integer @@ -9727,5 +9731,292 @@ Public Class ClsPaginas #End Region + + +#Region "P A G O D E V E N T A S " + + + Public Function AplicaPrePolizaPagoVenta(VentaActual As Venta, Pago As VentaPago, CvePrePoliza As Integer, ByRef ObjConta As ClsContabilidad) As Boolean + Dim ErrorMovtos As Boolean = False + Dim PorcentajePago As Decimal = Pago.ImportePago / VentaActual.Total + Dim ImporteMovimiento As Decimal = 0 + Dim ImporteMN As Decimal = 0 + Dim ImporteME As Decimal = 0 + Dim TCValuacion As Decimal + Dim TCValuacionVenta As Decimal = VentaActual.TC + Dim TCValuacionPago As Decimal = Pago.TCPago + Dim tFechaUltimaFluctuacion As Date + Dim tImportePago, tImporteVenta As Decimal + Dim CveConceptoContableComplementaria As Integer = 207 + + Pago.CveConceptoPago = If(Pago.CveConceptoPago = -1, 2, Pago.CveConceptoPago) 'si viene en parametro lo toma com primera opcion, sino el 2 + + If VentaActual.CveMoneda <> 1 Then + If Pago.TipoPago = "NC" Then Pago.CveConceptoPago = 301 : Pago.CveConceptoPago = 292 + End If + + Dim Concepto As String = String.Format("{0} F:{1}", VentaActual.ClienteNombre, VentaActual.SerieFolio) + Dim FuncionalidadFluctuacionImpuestos As Boolean = If(UsuarioActual.Empresa.Funcionalidad(159) = "1", True, False) + + Dim tFecha As Date = Pago.Fecha + Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(tFecha) + + If UsuarioActual.Empresa.Funcionalidad(703) = "1" AndAlso UltimaFluctuacion IsNot Nothing Then + If UltimaFluctuacion.FechaFluctuacion <= tFecha Then + tFechaUltimaFluctuacion = UltimaFluctuacion.FechaFluctuacion + TCValuacion = UltimaFluctuacion.TCFluctuacion + End If + If VentaActual.Fecha < tFechaUltimaFluctuacion Then TCValuacionVenta = TCValuacion + If Pago.FechaDocumentoRelacionado < tFechaUltimaFluctuacion Then TCValuacionPago = TCValuacion + + End If + + If VentaActual.CveMoneda = 1 And Pago.CveMonedaPago <> 1 Then 'factura pesos, pago en dolares + tImportePago = ((Pago.ImportePago * TCValuacionVenta / Pago.TCPago).RoundSQL * Pago.TCPago).RoundSQL + ElseIf VentaActual.CveMoneda <> 1 And Pago.CveMonedaPago <> 1 Then 'factura dolares, pago en dolares + 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 + tImportePago = (Pago.ImportePago * TCValuacionPago).RoundSQL + End If + If VentaActual.CveMoneda > 1 Then ImporteME = Pago.ImportePagoVenta + + 'movimiento de pago cliente + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Pago.ImportePagoVenta, Pago.ImportePagoVenta, Pago.CveConceptoPago, VentaActual.SerieFolio, Concepto, VentaActual.IdCtaContableCliente, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, CveVentaAmortizacion:=Pago.CveVentaAmortizacion, TipoCambio:=TCValuacion, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) Then ErrorMovtos = True + + 'movimiento de pago cliente Complementaria + If Not ErrorMovtos AndAlso VentaActual.CveMoneda > 1 Then + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Pago.ImportePagoVenta, (ImporteME * TCValuacion - ImporteME).RoundSQL, CveConceptoContableComplementaria, VentaActual.SerieFolio, Concepto, VentaActual.IdCtaContableClienteComplementaria, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, CveVentaAmortizacion:=Pago.CveVentaAmortizacion, TipoCambio:=TCValuacion, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) Then ErrorMovtos = True + + End If + + If Pago.AplicaTraslado Then + + 'si tiene iva y su proporcion + If Not ErrorMovtos AndAlso VentaActual.IVA <> 0 Then + ImporteMovimiento = (PorcentajePago * VentaActual.IVA).RoundSQL + ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL + If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 13, VentaActual.SerieFolio, Concepto, 0, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, PorcentajeImpuesto:=VentaActual.PorcentajeIVA, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) Then ErrorMovtos = True + + 'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe + If FuncionalidadFluctuacionImpuestos Then ImporteMN = (ImporteMovimiento * TCValuacionPago).RoundSQL + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMN, 61, VentaActual.SerieFolio, Concepto, 0, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, PorcentajeImpuesto:=VentaActual.PorcentajeIVA, CvePersonal:=Pago.CvePersonal, TipoCambio:=VentaActual.TC, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) Then ErrorMovtos = True + + End If + + End If + + 'si tiene RET IVA y su proporcion + If Not ErrorMovtos AndAlso VentaActual.RetIVA > 0 Then + ImporteMovimiento = (PorcentajePago * VentaActual.RetIVA).RoundSQL + ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL + If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMN, 8, VentaActual.SerieFolio, Concepto, 0, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) Then ErrorMovtos = True + + 'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe + If FuncionalidadFluctuacionImpuestos Then ImporteMN = (ImporteMovimiento * TCValuacionPago).RoundSQL + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 62, VentaActual.SerieFolio, Concepto, 0, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) Then ErrorMovtos = True + + End If + + 'si tiene Ret ISR y su proporcion + If Not ErrorMovtos AndAlso VentaActual.RetISR > 0 Then + ImporteMovimiento = (PorcentajePago * VentaActual.RetISR).RoundSQL + ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL + If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 9, VentaActual.SerieFolio, Concepto, 0, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) Then ErrorMovtos = True + + 'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe + If FuncionalidadFluctuacionImpuestos Then ImporteMN = (ImporteMovimiento * TCValuacionPago).RoundSQL + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMN, 63, VentaActual.SerieFolio, Concepto, 0, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) Then ErrorMovtos = True + + End If + + 'si tiene IEPS y su proporcion + If Not ErrorMovtos AndAlso VentaActual.IEPS > 0 Then + ImporteMovimiento = (PorcentajePago * VentaActual.IEPS).RoundSQL + ImporteMN = (ImporteMovimiento * VentaActual.TC).RoundSQL + If VentaActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento + + Dim Ret As New ConceptosRetenciones + If UsuarioActual.Empresa.TipoContabilidad = 2 Then + If ObjConta.GetRetCuenta(38, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then Ret.IdCtaContableAcreditable = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSAcreditable").ToString.ToEntero + + If ObjConta.GetRetCuenta(39, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then Ret.IdCtaContablexAcreditar = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSxAcreditar").ToString.ToEntero + + End If + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, 38, VentaActual.SerieFolio, Concepto, Ret.IdCtaContablexAcreditar, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) Then ErrorMovtos = True + + 'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe + If FuncionalidadFluctuacionImpuestos Then ImporteMN = (ImporteMovimiento * Pago.TCPago).RoundSQL + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMN, 39, VentaActual.SerieFolio, Concepto, Ret.IdCtaContableAcreditable, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) Then ErrorMovtos = True + + End If + 'concepto pago + Concepto = String.Format("{0} NC:{1}", VentaActual.ClienteNombre, Pago.Referencia) + + If Pago.TipoPago = "A" AndAlso Not ErrorMovtos Then 'A N T I C I P O + Dim Ret As New ConceptosRetenciones + If Pago.CveMonedaPago > 1 Then + 'Agregamos la Extranjera + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, Pago.ImportePago, 11, Pago.Referencia, Concepto, VentaActual.IdCtaContableClienteAnticipo, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, ImporteME:=Pago.ImportePago, TipoCambio:=TCValuacionPago, CveSubProyecto:=VentaActual.CveSubProyecto) Then ErrorMovtos = True + + ImporteMN = (Pago.ImportePago * TCValuacionPago - Pago.ImportePago).RoundSQL + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, ImporteMN, 207, Pago.Referencia, Concepto, VentaActual.IdCtaContableClienteAnticipoComplementaria, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, ImporteME:=Pago.ImportePago, TipoCambio:=TCValuacionPago, CveSubProyecto:=VentaActual.CveSubProyecto) Then ErrorMovtos = True + Else + 'Agregamos Nacional + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Pago.ImportePago, Pago.ImportePago, 11, Pago.Referencia, Concepto, VentaActual.IdCtaContableClienteAnticipoExtranjera, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambioPago:=Pago.TCPago) Then ErrorMovtos = True + + End If + + End If + + If Pago.TipoPago = "NC" AndAlso Not ErrorMovtos Then ' N O T A D E C R E D I T O + Dim Ret As New ConceptosRetenciones + If Pago.CveMonedaPago > 1 Then + 'Agregamos la Extranjera + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, Pago.ImportePago, 91, Pago.Referencia, Concepto, VentaActual.IdCtaContableCliente, CveVenta:=Pago.CveVentaAmortizacion, CveVentaAmortizacion:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, ImporteME:=Pago.ImportePago, TipoCambio:=TCValuacionPago, CveSubProyecto:=VentaActual.CveSubProyecto) Then ErrorMovtos = True + + ImporteMN = (Pago.ImportePago * TCValuacionPago - Pago.ImportePago).RoundSQL + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, ImporteMN, 203, Pago.Referencia, Concepto, VentaActual.IdCtaContableClienteComplementaria, CveVenta:=Pago.CveVentaAmortizacion, CveVentaAmortizacion:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, ImporteME:=Pago.ImportePago, TipoCambio:=TCValuacionPago, CveSubProyecto:=VentaActual.CveSubProyecto) Then ErrorMovtos = True + Else + 'Agregamos Nacional + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Pago.ImportePago, Pago.ImportePago, 91, Pago.Referencia, Concepto, VentaActual.IdCtaContableCliente, CveVenta:=Pago.CveVentaAmortizacion, CveVentaAmortizacion:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal) Then ErrorMovtos = True + + End If + + End If + + If Pago.TipoPago = "I" AndAlso Not ErrorMovtos Then 'I N G R E S O S X C O M P R O B A R + Dim Ret As New ConceptosRetenciones + If UsuarioActual.Empresa.TipoContabilidad = 2 Then + If ObjConta.GetRetCuenta(66, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then Ret.IdCtaContableAcreditable = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSAcreditable").ToString.ToEntero + If Pago.CveMonedaPago > 1 AndAlso ObjConta.GetRetCuenta(207, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then Ret.IdCtaContablexAcreditar = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSxAcreditar").ToString.ToEntero + + End If + + If Pago.CveMonedaPago > 1 Then + 'Agregamos la Extranjera + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, Pago.ImportePago, 66, Pago.Referencia, Concepto, Ret.IdCtaContableAcreditable, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, ImporteME:=Pago.ImportePago, TipoCambio:=TCValuacionPago, CveSubProyecto:=VentaActual.CveSubProyecto, CvePersonal:=Pago.CvePersonal) Then ErrorMovtos = True + + ImporteMN = (Pago.ImportePago * TCValuacionPago - Pago.ImportePago).RoundSQL + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, ImporteMN, 207, Pago.Referencia, Concepto, Ret.IdCtaContablexAcreditar, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, ImporteME:=Pago.ImportePago, TipoCambio:=TCValuacionPago, CveSubProyecto:=VentaActual.CveSubProyecto, CvePersonal:=Pago.CvePersonal) Then ErrorMovtos = True + Else + 'Agregamos Nacional + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Pago.ImportePago, Pago.ImportePago, 66, Pago.Referencia, Concepto, Ret.IdCtaContableAcreditable, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CveSubProyecto:=VentaActual.CveSubProyecto, CvePersonal:=Pago.CvePersonal) Then ErrorMovtos = True + + End If + + End If + + 'si tiene otros gastos/ingresos + ImporteMovimiento = Pago.OtroGastoIngreso + If Not ErrorMovtos AndAlso ImporteMovimiento <> 0 Then + Dim tOtCveCon As Integer = 211 + Dim tOtTipoMovto As Boolean = False + If ImporteMovimiento < 0 Then + tOtTipoMovto = True : tOtCveCon = 78 + ImporteMovimiento = Math.Abs(ImporteMovimiento) + End If + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, tOtTipoMovto, ImporteMovimiento, ImporteMovimiento, tOtCveCon, VentaActual.SerieFolio, Concepto, 0, CveVenta:=VentaActual.CveVenta, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, CveSubProyecto:=VentaActual.CveSubProyecto, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) Then ErrorMovtos = True + + End If + + If Not ErrorMovtos AndAlso VentaActual.TC <> Pago.TCPago Then + Dim ConceptoContable, IdCtaContable As Integer + Dim TipoMovimiento As Boolean + Dim Diferencia As Decimal = 0 + + If tImporteVenta <> tImportePago Then + If tImporteVenta > tImportePago Then + ConceptoContable = 64 : IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria + TipoMovimiento = True + Else + ConceptoContable = 65 : IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria + TipoMovimiento = False + End If + Diferencia = (tImporteVenta - tImportePago).Abs.RoundSQL + + End If + + If FuncionalidadFluctuacionImpuestos Then + Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, Pago.TCPago, VentaActual.TC) + Diferencia = (Pago.ImportePago * VentaActual.TC) - (Pago.ImportePago * Pago.TCPago) 'Añadimos la diferencia de perdida en la venta + Diferencia -= ((VentaActual.IVA * PorcentajePago) * VentaActual.TC) - ((VentaActual.IVA * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IVA + Diferencia += ((VentaActual.RetIVA * PorcentajePago) * VentaActual.TC) - ((VentaActual.RetIVA * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetIVA + Diferencia += ((VentaActual.RetISR * PorcentajePago) * VentaActual.TC) - ((VentaActual.RetISR * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetISR + Diferencia -= ((VentaActual.IEPS * PorcentajePago) * VentaActual.TC) - ((VentaActual.IEPS * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el IEPS + Diferencia = Diferencia.Abs.RoundSQL + End If + + If Diferencia <> 0 Then + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, Diferencia, Diferencia, ConceptoContable, Concepto, Concepto, IdCtaContable, CveVenta:=VentaActual.CveVenta, CveSubProyecto:=VentaActual.CveSubProyecto, CveCliente:=VentaActual.CveCliente, CveIE:=Pago.CveIE) Then + ErrorMovtos = True + End If + End If + End If + + Return ErrorMovtos + End Function + + + Public Class VentaPago + Public Property TipoPago As String = "B" ' B - Bancos, A - Anticipos, I - IxC, NC - Nota de crédito + Public FechaDocumentoRelacionado As Date + Public Fecha As Date + Public Property CveIE As Integer = -1 + Public Property CvePersonal As Integer = -1 + Public Property ImportePagoVenta As Decimal = 0 + Public Property ImportePago As Decimal = 0 + Public Property CveMonedaPago As Integer = 1 + Public Property TCPago As Decimal = 1 + Public Property CveVentaAmortizacion As Integer = 0 + Public Property OtroGastoIngreso As Decimal = 0 + Public Property CveConceptoPago As Integer = -1 'no definido de inicio + Public Property CveCreditoDetalle As Integer = -1 + Public Property AplicaTraslado As Boolean = True + Public Property Referencia As String + + End Class + + Public Class Venta + Public Property CveVenta As Integer = -1 + Public Property CveCliente As Integer + Public Property CveMoneda As Integer + Public Property Fecha As Date + Public Property SerieFolio As String = "" + Public Property ClienteNombre As String = "" + Public Property TC As Decimal = 1 + Public Property Total As Decimal + Public Property IVA As Decimal + Public Property IEPS As Decimal + Public Property RetIVA As Decimal + Public Property RetISR As Decimal + Public Property PorcentajeIVA As Decimal + Public Property CveSubProyecto As Integer + Public Property UsuarioActual As Usuario + Public Property IdCtaContableCliente As Integer + Public Property IdCtaContableClienteComplementaria As Integer + Public Property IdCtaContableClienteAnticipo As Integer + Public Property IdCtaContableClienteAnticipoExtranjera As Integer + Public Property IdCtaContableClienteAnticipoComplementaria As Integer + + End Class + +#End Region + + End Class diff --git a/App_Code/ClsRH.vb b/App_Code/ClsRH.vb index d7d2ecae0..d8aa2d0f5 100644 --- a/App_Code/ClsRH.vb +++ b/App_Code/ClsRH.vb @@ -7343,6 +7343,27 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo End Try Return Retorno End Function + Public Function estatusPersonalUp(Fecha As DateTime, CvePersonal As Integer, CveEstatusPersonal As Integer, CveEmpresa As Integer, CveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + Data = New DataTable + SqlDataAdapter("PA_RH_EstatusPersonalUp") + With SqlAdapter.SelectCommand.Parameters + .Add("@Fecha", SqlDbType.DateTime).Value = Fecha + .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal + .Add("@CveEstatusPersonal", SqlDbType.Int).Value = CveEstatusPersonal + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + Me.OnError("Ocurrió un error al guardar correos nominas", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Catch ex As Exception + OnError("Ocurrió un error al guardar correos nominas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function Public Function NomBitacoraCorreoAdd(CvePeriodo As Integer, CvePersonal As Integer, Correos As String, CveEmpresa As Integer, CveUsuario As Integer) As Boolean Dim Retorno As Boolean = False Data = New DataTable diff --git a/App_Code/ClsSisUsuarios.vb b/App_Code/ClsSisUsuarios.vb index fb2337fa3..613bc8b9a 100644 --- a/App_Code/ClsSisUsuarios.vb +++ b/App_Code/ClsSisUsuarios.vb @@ -720,7 +720,7 @@ Public Class ClsSisUsuarios #End Region #Region "U S U A R I O S" - Public Function GetUsuarios(CveUsuario As Integer, Optional CveRol As Integer = -1, Optional CveUsuarioControlado As Integer = -1) As Boolean + Public Function GetUsuarios(CveUsuario As Integer, Optional CveRol As Integer = -1, Optional CveUsuarioControlado As Integer = -1, Optional Estatus As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Sis_UsuariosGet") @@ -731,6 +731,9 @@ Public Class ClsSisUsuarios .Add("@Usuario", SqlDbType.VarChar).Value = "-1" .Add("@Contraseña", SqlDbType.VarChar).Value = "-1" .Add("@EsLogIn", SqlDbType.Bit).Value = 0 + .Add("@Estatus", SqlDbType.Int).Value = Estatus + + End With Try diff --git a/App_Code/LogicNominas.vb b/App_Code/LogicNominas.vb index a7b7cb98b..55071651d 100644 --- a/App_Code/LogicNominas.vb +++ b/App_Code/LogicNominas.vb @@ -206,9 +206,9 @@ Public Class LogicNominas End If If continuar AndAlso objNomina.GetNom_NominasDetalles(CveNomina, CvePersonal, CvePeriodo, "-1") Then If objNomina.DtResultados.Rows.Count > 0 Then - Dim filtropercepciones As String = "Tipo = 'P' AND EsPadre = 1 AND SoloVisible =0 AND SATCveConcepto NOT IN ('022', '023','025')" + Dim filtropercepciones As String = "Tipo = 'P' AND EsPadre = 1 AND SoloVisible =0 AND (TipoConceptoSAT<>'O' OR TipoConceptoSAT IS NULL) AND SATCveConcepto NOT IN ('022', '023','025')" If TimbreIndemnizacion Then - filtropercepciones = " Tipo = 'P' AND SATCveConcepto IN ('022', '023','025')" + filtropercepciones = " Tipo = 'P' AND SATCveConcepto IN ('022', '023','025') AND (TipoConceptoSAT<>'O' OR TipoConceptoSAT IS NULL) " End If DtPercepciones = objNomina.DtResultados.FiltraParametros(filtropercepciones) Dim filtrodeduc As String = "Tipo = 'D' AND EsPadre = 1 AND SoloVisible =0 AND (TipoConceptoSAT<>'O' OR TipoConceptoSAT IS NULL) AND CveSistema <> 47" diff --git a/App_Code/Timbrado.vb b/App_Code/Timbrado.vb index 48bfd0a27..09b82768c 100644 --- a/App_Code/Timbrado.vb +++ b/App_Code/Timbrado.vb @@ -4832,7 +4832,7 @@ Public Class Timbrado If ObjCFDITimbre.Conceptos IsNot Nothing AndAlso ObjCFDITimbre.Conceptos.Count > 0 Then For Each concep As CFDIConceptos In ObjCFDITimbre.Conceptos - cfdi.Concepto(concep.ClaveProdServ, concep.Noidentificacion, concep.Cantidad.ToString("0.00####"), concep.ClaveUnidad, concep.Unidad, concep.Descripcion, concep.ValorUnitario.ToString("0.00####"), concep.Importe, concep.Descuento, concep.ObjetoImpuesto) + cfdi.Concepto(concep.ClaveProdServ, concep.Noidentificacion, concep.Cantidad.ToString("0.00####").ToDouble(), concep.ClaveUnidad, concep.Unidad, concep.Descripcion, concep.ValorUnitario.ToString("0.00####").ToDouble(), concep.Importe, concep.Descuento, concep.ObjetoImpuesto) For Each imp As CFDIConceptosImpuestos In concep.Impuestos If imp.TrasladooRetencion = "T" Then cfdi.ConceptoTraslado(imp.Base, imp.Impuesto, imp.TipoFactor, imp.TasaOCuota, imp.Importe) diff --git a/Ashx/E140.ashx b/Ashx/E140.ashx new file mode 100644 index 000000000..b1e309b3d --- /dev/null +++ b/Ashx/E140.ashx @@ -0,0 +1,263 @@ +<%@ WebHandler Language="VB" Class="E140" %> + +Imports System +Imports System.Web +Imports System.Data +Imports Newtonsoft.Json +Imports Extensiones +Imports System.IO +Imports Microsoft.Reporting.WebForms + +Public Class E140 : Implements IHttpHandler, IRequiresSessionState + Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable + Get + Return False + End Get + End Property + Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest + + Try + Select Case context.Request("metodo") + Case "MetasVendedores" + MetasVendedores(context) + End Select + Catch ex As Exception + ex.GuardaLog(ex.Message) + End Try + End Sub + + + Private Shared Sub MetasVendedores(ByVal context As HttpContext) + + Dim CveEmpresa = 140 + Dim RutaEmpresa As String = String.Format("{0}Empresas\{1}\", DirectorioBaseEmpresas, CveEmpresa) + + Dim ObjEmpresa As New ClsSisEmpresas() + If ObjEmpresa.GetEmpresas(CveEmpresa, "-1", "-1", "-1", "-1") Then + End If + + If ObjEmpresa.Empresa.RutaArchivos.Trim.Length > 0 Then + RutaEmpresa = ObjEmpresa.Empresa.RutaArchivos.Trim + End If + + ObjEmpresa.Dispose() + + Dim DTVendedores As System.Data.DataTable = New System.Data.DataTable() + Dim Temporal As String = "" + + Temporal = String.Format("{0}\Temp\", RutaEmpresa, CveEmpresa) + Dim Empresa As String = "BDH BATERIAS DISTRIBUCIONES DE HERMOSILLO SA DE CV" + + DTVendedores.Columns.Add("CveSubProyecto", GetType(Integer)) + DTVendedores.Columns.Add("Sucursal") + DTVendedores.Columns.Add("Nombre") + DTVendedores.Columns.Add("Correo") + + Dim Row_11791 As DataRow = DTVendedores.NewRow + Dim Row_11993 As DataRow = DTVendedores.NewRow + Dim Row_11796 As DataRow = DTVendedores.NewRow + Dim Row_11797 As DataRow = DTVendedores.NewRow + Dim Row_11793 As DataRow = DTVendedores.NewRow + Dim Row_12010 As DataRow = DTVendedores.NewRow + Dim Row_12011 As DataRow = DTVendedores.NewRow + Dim Row_11790 As DataRow = DTVendedores.NewRow + Dim Row_11795 As DataRow = DTVendedores.NewRow + Dim Row_11794 As DataRow = DTVendedores.NewRow + + Row_11791("CveSubProyecto") = 11791 + Row_11791("Sucursal") = "SOLIDARIDAD" + Row_11791("Nombre") = "Fernando grijalva López" + Row_11791("Correo") = "hmo.martirezdecananea@bdhbaterias.com.mx" + + Row_11993("CveSubProyecto") = 11993 + Row_11993("Sucursal") = "PROGRESO" + Row_11993("Nombre") = "Brayam Uriel Corrales Soto" + Row_11993("Correo") = "cajaprogreso.hmo@bdhbaterias.com" + + Row_11796("CveSubProyecto") = 11796 + Row_11796("Sucursal") = "OBREGON" + Row_11796("Nombre") = "Brayam Uriel Corrales Soto" + Row_11796("Correo") = "cen.pisocentro@bdhbaterias.mx" + + Row_11797("CveSubProyecto") = 11797 + Row_11797("Sucursal") = "NAVOJOA" + Row_11797("Nombre") = "Orlando Lagarda Cantú" + Row_11797("Correo") = "almacen.nvj@bdhbaterias.mx" + + Row_11793("CveSubProyecto") = 11793 + Row_11793("Sucursal") = "LOMA LINDA" + Row_11793("Nombre") = "Adrian fernando murrieta Rodríguez" + Row_11793("Correo") = "adrian.murrieta@bdhbaterias.com" + + Row_12010("CveSubProyecto") = 12010 + Row_12010("Sucursal") = "LOS NOGALES" + Row_12010("Nombre") = "GERMAN LUNA CASTRO" + Row_12010("Correo") = "" + + Row_12011("CveSubProyecto") = 12011 + Row_12011("Sucursal") = "NOGALES CENTRO" + Row_12011("Nombre") = "GERMAN LUNA CASTRO" + Row_12011("Correo") = "german.luna@bdhbaterias.com" + + Row_11790("CveSubProyecto") = 11790 + Row_11790("Sucursal") = "MATRIZ" + Row_11790("Nombre") = "Luis Fernando grijalva cota" + Row_11790("Correo") = "luis.grijalva@bdhbaterias.com" + + + Row_11795("CveSubProyecto") = 11795 + Row_11795("Sucursal") = "GUAYMAS CENTRO" + Row_11795("Nombre") = "Gastelum Hurtado Juan Daniel" + Row_11795("Correo") = "daniel.gastelum@bdhbaterias.com" + + Row_11794("CveSubProyecto") = 11794 + Row_11794("Sucursal") = "GUAYMAS AURORA" + Row_11794("Nombre") = "Gastelum Hurtado Juan Daniel" + Row_11794("Correo") = "daniel.gastelum@bdhbaterias.com" + + DTVendedores.Rows.Add(Row_11791) + DTVendedores.Rows.Add(Row_11993) + DTVendedores.Rows.Add(Row_11796) + DTVendedores.Rows.Add(Row_11797) + DTVendedores.Rows.Add(Row_11793) + DTVendedores.Rows.Add(Row_12010) + DTVendedores.Rows.Add(Row_12011) + DTVendedores.Rows.Add(Row_11790) + DTVendedores.Rows.Add(Row_11795) + DTVendedores.Rows.Add(Row_11794) + + For Each dRow As System.Data.DataRow In DTVendedores.Rows + + + Dim CorreoSupervisor As String = dRow("Correo").ToString() + Dim Sucursal As String = dRow("Sucursal").ToString + Dim Vendedor As String = dRow("Nombre").ToString() + Dim CveSubProyecto As Integer = dRow("CveSubProyecto").ToString() + + + CorreoSupervisor = "oscar.irigoyen@adssistemas.mx;rene.molina@adssistemas.mx" + + Dim ObjGen = New ClsVentas + + Dim RutaRDLC As String = If(File.Exists($"{RutaEmpresa}\Formatos\MetasVendedores.rdlc"), $"{RutaEmpresa}\Formatos\MetasVendedores.rdlc", $"{DirectorioBaseEmpresas}\Empresas\Grales\Formatos\MetasVendedores.rdlc") + + If ObjGen.GetRepMetasVendedores(DateTime.Now, CveEmpresa, -1, -1, -1, -1, -1, CveSubProyecto, -1, -1, 0) Then + + + Dim Imagen As System.IO.FileInfo = New System.IO.FileInfo(String.Format("{0}/Logo.png", RutaEmpresa)) + Dim parametros As List(Of ReportParameter) = New List(Of ReportParameter)() + parametros.Add(New ReportParameter("pEmp", Empresa)) + + If Imagen.Exists Then + parametros.Add(New ReportParameter("pImg", $"file://{Imagen.FullName}")) + Else + parametros.Add(New ReportParameter("pImg", "")) + End If + + parametros.Add(New ReportParameter("UsuarioImprimio", "Sistema")) + parametros.Add(New ReportParameter("FechaImpresion", DateTime.Now.ToString("dd/MM/yyyy"))) + parametros.Add(New ReportParameter("SubProyecto", Sucursal)) + parametros.Add(New ReportParameter("Agente", Vendedor)) + + Dim bytes As Byte() = Nothing + + Dim rds1 As ReportDataSource = New ReportDataSource() + rds1.Name = "DataSet1" + rds1.Value = ObjGen.DtResultados + + If EsProduccion Then + + Dim wsreport As New WSRDLC2.WebServiceSoapClient + Dim params As New List(Of WSRDLC2.ReportParameter) + Dim reportobjects As New List(Of WSRDLC2.ReportObjects) + + Dim jsonData As String = Nothing + Dim ds As New DataSet + + Dim dt As DataTable = DirectCast(rds1.Value, Data.DataTable) + dt = dt.Copy() + dt.TableName = rds1.Name + ds.Tables.Add(dt) + + For Each rpds As ReportParameter In parametros + Dim param As New WSRDLC2.ReportParameter + param.Name = rpds.Name + 'SI ES TEXTO, QUITAR TABS Y OTROS ESPACIOS QUE DEN PROBLEMAS AL MANDAR LA PETICION + If rpds IsNot Nothing AndAlso rpds.Values IsNot Nothing AndAlso rpds.Values.Count > 0 AndAlso rpds.Values(0) IsNot Nothing AndAlso rpds.Values(0).GetType() = GetType(String) Then + param.Values = {rpds.Values(0).Replace(vbVerticalTab, "")} + Else + param.Values = {rpds.Values(0)} + End If + params.Add(param) + Next + + bytes = wsreport.StreamNEWPDFBytes(RutaRDLC, ds, reportobjects.ToArray(), params.ToArray(), "MetasVendedores", "PDF", CveEmpresa, 100, jsonData) + wsreport = Nothing + params = Nothing + ds.Dispose() : ds = Nothing + + Else + + Using MR As ReportViewer = New ReportViewer() + + MR.LocalReport.DataSources.Add(rds1) + MR.LocalReport.ReportPath = RutaRDLC + MR.ProcessingMode = ProcessingMode.Local + MR.LocalReport.EnableExternalImages = True + MR.LocalReport.SetParameters(parametros) + MR.LocalReport.Refresh() + Dim warnings As Warning() = Nothing + Dim streamids As String() = Nothing + Dim mimeType As String = Nothing + Dim encoding As String = Nothing + Dim extension As String = Nothing + + bytes = MR.LocalReport.Render("PDF", Nothing, mimeType, encoding, extension, streamids, warnings) + + End Using + + End If + + MandaCorreo(CorreoSupervisor, $"Envió de estado de scorecard sucursal {Sucursal} a {Now.ToString("dd/MM/yyyy")}", bytes) + bytes = Nothing + + End If + + ObjGen.Dispose() + + Next + + End Sub + + Private Shared Sub MandaCorreo(Para As String, Cuerpo As String, bytes As Byte()) + Try + Dim ListaArchivos As List(Of ClsSisMail.ArchivoMail) = New List(Of ClsSisMail.ArchivoMail)() + + Dim AdjuntoReporte As ClsSisMail.ArchivoMail = New ClsSisMail.ArchivoMail() + + AdjuntoReporte.NombreArchivo = "MetasVendedores.Pdf" + AdjuntoReporte.ArchivoBinario = bytes + ListaArchivos.Add(AdjuntoReporte) + + Dim Correo As ClsSisMail = New ClsSisMail() + + Dim Asunto As String = Cuerpo + Correo.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Cuerpo, Archivos:=ListaArchivos) + + Catch ex As Exception + Extensiones.ModExtensiones.GuardaLog(Nothing, $"Error Tareas Programadas 140 error enviar mail --> {ex.Message} ") + End Try + End Sub + + + Public Shared ReadOnly Property EsProduccion As Boolean + Get + If IsNothing(System.Configuration.ConfigurationManager.AppSettings("EsProduccion")) Then + Return False + Else + Return (System.Configuration.ConfigurationManager.AppSettings("EsProduccion").ToString() = "1") + End If + End Get + End Property + +End Class \ No newline at end of file diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb index 4c511f2c9..60e52e7ed 100644 --- a/Bancos/IE.aspx.vb +++ b/Bancos/IE.aspx.vb @@ -3359,11 +3359,11 @@ Partial Class Bancos_IE IdCtaIVADevolucionIMPUESTOS = IdCtaIVAXAcreditarDevDinC - If ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, -IVADev, ReferenciaAplicar, 14, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev) Then + If ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, -IVADev, ReferenciaAplicar, 14, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev, PorcentajeImpuesto:=PorcentajeCompraDevDinC) Then IdCtaIVADevolucionIMPUESTOS = IdCtaIVAAcreditableDevDinC - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, -IVADev, ReferenciaAplicar, 19, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, -IVADev, ReferenciaAplicar, 19, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev, PorcentajeImpuesto:=PorcentajeCompraDevDinC) Then MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución" ErrorDevolucionImpuestos = True End If @@ -3547,23 +3547,19 @@ Partial Class Bancos_IE PorcentajeCompraDevDinC = ObjCompras.DtResultados.Rows(0)("PorcentajeIVA").ToString.ToDecimal Dim DTCuentas As DataTable = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeCompraDevDinC) - Dim CveCuentaIVAxAcreditarDevDinC = 0 - Dim CveCuentaIVAAcreditableDevDinC = 0 Dim IdCtaIVAXAcreditarDevDinC As Integer Dim IdCtaIVAAcreditableDevDinC As Integer - If DTCuentas IsNot Nothing AndAlso DTCuentas.Rows.Count > 0 Then - IdCtaIVAXAcreditarDevDinC = DTCuentas.Rows(0)("IdCtaIVAXAcreditar").ToString.ToEntero - IdCtaIVAAcreditableDevDinC = DTCuentas.Rows(0)("IdCtaIVAAcreditable").ToString.ToEntero - Else - MsgError = "Sin Registros de porcentaje impuesto" - End If + 'If DTCuentas IsNot Nothing AndAlso DTCuentas.Rows.Count > 0 Then + ' IdCtaIVAXAcreditarDevDinC = DTCuentas.Rows(0)("IdCtaIVAXAcreditar").ToString.ToEntero + ' IdCtaIVAAcreditableDevDinC = DTCuentas.Rows(0)("IdCtaIVAAcreditable").ToString.ToEntero + 'Else + ' MsgError = "Sin Registros de porcentaje impuesto" + 'End If Dim IVADevMN As Decimal = 0 Dim IEPSDevMN As Decimal = 0 - - Dim PorcentajeDevolucion As Decimal = ((TxtImporte.Text.ToDecimal * 100D / TotalCompraDev) / 100).RoundSQL(2) IVADev = Math.Round(IVADev * PorcentajeDevolucion, 2) @@ -3587,11 +3583,11 @@ Partial Class Bancos_IE IdCtaIVADevolucionIMPUESTOS = IdCtaIVAXAcreditarDevDinC - If ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, -IVADev, ReferenciaAplicar, 14, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev) Then + If ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, -IVADev, ReferenciaAplicar, 14, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev, PorcentajeImpuesto:=PorcentajeCompraDevDinC) Then IdCtaIVADevolucionIMPUESTOS = IdCtaIVAAcreditableDevDinC - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, -IVADev, ReferenciaAplicar, 19, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, -IVADev, ReferenciaAplicar, 19, ConceptoAplicar, Now, IdCtaIVADevolucionIMPUESTOS, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=-IVADevMN, ImporteME:=-IVADev, PorcentajeImpuesto:=PorcentajeCompraDevDinC) Then MsgError = "Ocurrió un error al registrar el asiento de impuestos de devolución" ErrorDevolucionImpuestos = True End If diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index 5f77cd67e..a35a9eb35 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -198,6 +198,13 @@ Partial Class PopUpVerFactura End If If Request("onlyPrint") IsNot Nothing Then + If Request("onlyPrint").ToString() = "GeneraPDFNomina" AndAlso Not IsNothing(Request("CvePersonal")) AndAlso + Not IsNothing(Request("CvePeriodo")) AndAlso Not IsNothing(Request("indemnizacion")) Then + Dim CveEmpresa As Integer = UsuarioActual.CveEmpresa + Dim RutaEmpresa As String = UsuarioActual.Empresa.Ruta + Dim indemnizacion As Boolean = Request("indemnizacion").ToString.ToEntero() = 1 + GeneraPDFNomina(Request("CvePersonal").ToString.ToEntero(), Request("CvePeriodo").ToString.ToEntero(), CveEmpresa, RutaEmpresa, indemnizacion) + End If If Request("onlyPrint").ToString() = "Pallet" AndAlso Not IsNothing(Request("CvePallet")) Then imprimirpallet2(Request("CvePallet").ToString.ToEntero()) End If @@ -227,6 +234,297 @@ Partial Class PopUpVerFactura End Sub + Public Function GeneraPDFNomina(CvePersonal As Integer, CvePeriodo As Integer, CveEmpresa As Integer, RutaEmpresa As String, Optional indemnizacion As Boolean = False) As Byte() + + + Dim ObjNomina As New ClsNominas + Dim ObjPersonal As New ClsRH + Dim TieneError = False + Dim Retorno As Byte() = Nothing + + If Not ObjNomina.GetNom_Nominas(-1, CvePersonal, CvePeriodo, -1, CveEmpresa) Then + Alert("Ocurrio un erro al obtener datos de la nomina", TipoMensaje.MsgError) + ObjPersonal.Dispose() + ObjNomina.Dispose() + Return Nothing + End If + + Dim CveNomina = ObjNomina.CveNomina + Dim DTPercepciones As Data.DataTable + Dim DTDeducciones As Data.DataTable + Dim DTDeducciones2 As New Data.DataTable + + Dim Ruta As String = UsuarioActual.Empresa.Ruta + Dim PathXML As String = $"{Ruta}XML\Nomina\{ObjNomina.Serie }{If(indemnizacion, "F", "")}-{ObjNomina.Folio}.xml" + Dim FechaEmision, FechaCertificacion As DateTime + Dim FolioFiscal, NoSerieCertificado, NoSerieCertificadoContribuyente, SelloCFDi, SelloSAT As String + FolioFiscal = "" + NoSerieCertificado = "" + SelloCFDi = "" + SelloSAT = "" + NoSerieCertificadoContribuyente = "" + + Dim RutaCBB As String = String.Format("{0}CBB\Nomina\{1}.jpg", RutaEmpresa, ObjNomina.SerieFolio) + Dim ImagenCBB As New System.IO.FileInfo(RutaCBB) + Dim ImgCBB As String + + Dim RutaFormato As String = String.Format("{0}Formatos\Nomina.rdlc", RutaEmpresa) + Dim RutaFormatoDefault As String = String.Format("Empresas\Grales\Formatos\Nomina.rdlc") + + 'SI ESTA TIMBRADA - CON XML + + If System.IO.File.Exists(PathXML) Then + + Dim XmlDoc As New System.Xml.XmlDocument + 'XmlDoc.Load(Ruta & "XML\\Nomina\NOM A-3845.xml") + XmlDoc.Load(PathXML) + + If ValorNodoXML(XmlDoc.DocumentElement, "version").Contiene("3.3", "4.0") Then + FechaEmision = XmlDoc.DocumentElement.Attributes("Fecha").InnerText.ToDate + NoSerieCertificadoContribuyente = XmlDoc.DocumentElement.Attributes("NoCertificado").InnerText + + For i As Integer = 0 To XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes.Count - 1 + If XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Name = "tfd:TimbreFiscalDigital" Then + FolioFiscal = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("UUID").InnerText + NoSerieCertificado = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("NoCertificadoSAT").InnerText + FechaCertificacion = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("FechaTimbrado").InnerText.ToDate + SelloCFDi = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("SelloCFD").InnerText + SelloSAT = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("SelloSAT").InnerText + End If + Next + Else + FechaEmision = XmlDoc.DocumentElement.Attributes("fecha").InnerText.ToDate + NoSerieCertificadoContribuyente = XmlDoc.DocumentElement.Attributes("noCertificado").InnerText + + For i As Integer = 0 To XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes.Count - 1 + If XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Name = "tfd:timbreFiscalDigital" Then + FolioFiscal = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("UUID").InnerText + NoSerieCertificado = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("noCertificadoSAT").InnerText + FechaCertificacion = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("fechaTimbrado").InnerText.ToDate + SelloCFDi = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("selloCFD").InnerText + SelloSAT = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("selloSAT").InnerText + End If + Next + End If + + + 'SIN TIMBRAR - SIN XML + Else + FolioFiscal = "Sin Timbrar" + NoSerieCertificado = "Sin Timbrar" + SelloCFDi = "Sin Timbrar" + SelloSAT = "Sin Timbrar" + End If + + 'Si no tiene CBB, SE GENERA + If Not ImagenCBB.Exists Then + Dim CBB As New ClbNegBICFDv3_2.ClsNegCBBGenerar() + If ObjPersonal.GetPersonal(CvePersonal, CveEmpresa) Then + CBB.GenerarCBB(UsuarioActual.Empresa.RFC, ObjPersonal.RFC, ObjNomina.Total.ToString.ToDecimal, FolioFiscal, RutaCBB) + End If + End If + + ImgCBB = String.Format("{0}://{1}:{2}/Empresas/{3}/CBB/Nomina/{4}.jpg", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa, ObjNomina.SerieFolio) + + Dim cQr As Byte() = Nothing + Try + Dim CadenaOriginalCFD As String = "||1.0|" + FolioFiscal + "|" + FechaCertificacion.ToString("yyyy-MM-dd") + "T" + FechaCertificacion.ToString("HH:mm:ss") + "|" + SelloCFDi + "|" + NoSerieCertificado + "||" + + Dim RptParametro As New List(Of ReportParameter) + + + 'Datos Empresa + RptParametro.Add(New ReportParameter("RegistroPatronal", ObjNomina.RegistroPatronal)) + Dim ajusteindemnizacion As Double = 0 + 'PERCECIONES - DEDUCCIONES + If ObjNomina.GetNom_NominasDetalles(CveNomina, CvePersonal, CvePeriodo, "-1") Then + Dim filtrop As String = " AND CveSistema NOT IN(10,11,32)" + Dim friltrod As String = " AND CveSistema <>47" + If indemnizacion Then + filtrop = "AND CveSistema IN(10,11,32)" + friltrod = " AND CveSistema =47" + End If + DTPercepciones = ObjNomina.DtResultados.FiltraParametros($"((Tipo = 'P' OR (Tipo = 'D' AND Importe <0)) AND Importe <>0 AND EsPadre = 1 AND SoloVisible =0) {filtrop}") + DTDeducciones = ObjNomina.DtResultados.FiltraParametros($"(Tipo = 'D' AND Importe >0 AND EsPadre = 1 AND SoloVisible =0) {friltrod}") + DTDeducciones2 = ObjNomina.DtResultados.FiltraParametros($"((Tipo = 'D' AND Importe >0 AND EsPadre = 1 AND SoloVisible =0) OR CveSistema IN (20,21) OR CveConcepto =4714){friltrod}") + + ajusteindemnizacion = ObjNomina.DtResultados.FiltraParametros($"((Tipo = 'P' OR (Tipo = 'D' AND Importe <0)) AND Importe <>0 AND EsPadre = 1 AND SoloVisible =0) AND CveSistema IN(10,11,32)").SUM("Importe") - + ObjNomina.DtResultados.FiltraParametros($"(Tipo = 'D' AND Importe >0 AND EsPadre = 1 AND SoloVisible =0) AND CveSistema =47").SUM("Importe") + For Each row As DataRow In DTPercepciones.Rows + If row("Tipo").ToString() = "D" Then + row("Codigo") = row("Codigo").ToString().Replace("D", "OP") + row("Importe") = row("Importe").ToString().ToDecimal() * -1 + End If + Next + + Else + DTPercepciones = Nothing + DTDeducciones = Nothing + End If + 'DATOS DEL EMPLEADO + If ObjPersonal.GetPersonal(CvePersonal, CveEmpresa) Then + + RptParametro.Add(New ReportParameter("NoEmpleado", ObjPersonal.Codigo)) + RptParametro.Add(New ReportParameter("RFC", ObjPersonal.RFC)) + RptParametro.Add(New ReportParameter("CURP", ObjPersonal.CURP)) + + RptParametro.Add(New ReportParameter("NombreCompleto", String.Format("{0} {1} {2}", ObjPersonal.Nombres, ObjPersonal.APaterno, ObjPersonal.AMaterno).Trim())) + RptParametro.Add(New ReportParameter("Regimen", ObjPersonal.RegimenContratacion)) + RptParametro.Add(New ReportParameter("RiesgoPuesto", ObjPersonal.RiesgoPuesto)) + + RptParametro.Add(New ReportParameter("NSS", ObjPersonal.NumeroSS)) + RptParametro.Add(New ReportParameter("Departamento", ObjPersonal.Departamento)) + RptParametro.Add(New ReportParameter("Puesto", ObjPersonal.Puesto.ToString())) + RptParametro.Add(New ReportParameter("FechaIngreso", ObjPersonal.FechaIngreso.ToString("dd/MM/yyyy"))) + + RptParametro.Add(New ReportParameter("Contrato", ObjPersonal.TipoContrato.ToString)) + + RptParametro.Add(New ReportParameter("Jornada", ObjPersonal.Jornada)) + RptParametro.Add(New ReportParameter("Periodo", ObjNomina.TipoPeriodo)) + RptParametro.Add(New ReportParameter("SalarioBase", ObjPersonal.SalarioDiario.ToString)) + RptParametro.Add(New ReportParameter("SalarioDiarioInt", ObjPersonal.SDI.ToString)) + + RptParametro.Add(New ReportParameter("Banco", ObjPersonal.Banco)) + RptParametro.Add(New ReportParameter("CLABE", ObjPersonal.CLABE)) + + + 'DATOS NOMINA + If ObjNomina.GetNom_Nominas(CveNomina, CvePersonal, CvePeriodo, 1, CveEmpresa) Then + RptParametro.Add(New ReportParameter("ReciboNomina", ObjNomina.Folio.ToString)) + RptParametro.Add(New ReportParameter("Serie", ObjNomina.Serie)) + RptParametro.Add(New ReportParameter("Fecha", ObjNomina.Fecha.ToString)) + RptParametro.Add(New ReportParameter("Periodo", ObjNomina.TipoPeriodo)) + + RptParametro.Add(New ReportParameter("DiasPagados", ObjNomina.DiasPagados.ToString)) + RptParametro.Add(New ReportParameter("MetodoPago", ObjNomina.MetodoPago)) '"""PUE"" (Pago en una sola exhibición)" + RptParametro.Add(New ReportParameter("FormaPago", """99"" (Por definir)")) + + RptParametro.Add(New ReportParameter("Cantidad", "1")) + RptParametro.Add(New ReportParameter("Unidad", "ACT")) + RptParametro.Add(New ReportParameter("Descripcion", "PAGO DE NÓMINA")) + RptParametro.Add(New ReportParameter("Total", If(indemnizacion, ajusteindemnizacion, ObjNomina.Total - ajusteindemnizacion).ToString())) + + Dim CBB As New ClbNegBICFDv3_2.ClsNegCBBGenerar() + cQr = CBB.GenerarCBBBytes(UsuarioActual.Empresa.RFC, ObjPersonal.RFC, ObjNomina.Total.ToString().ToDecimal(), FolioFiscal) + RptParametro.Add(New ReportParameter("ImporteLetra", ObjNomina.Total.ToString.ToDouble.Texto2Letras)) + RptParametro.Add(New ReportParameter("Clave", "84111505")) + Else + TieneError = True + End If + Else + TieneError = True + End If + + If Not TieneError Then + If ObjNomina.GetPeriodos(-1, CveEmpresa, -1, -1, CvePeriodo) Then + RptParametro.Add(New ReportParameter("FechaInicio", ObjNomina.FechaInicio.ToString("dd/MM/yyyy"))) + RptParametro.Add(New ReportParameter("FechaFin", ObjNomina.FechaFin.ToString("dd/MM/yyyy"))) + Else + TieneError = True + End If + End If + + + RptParametro.Add(New ReportParameter("PU", DTPercepciones.SUM("Importe").ToString())) + RptParametro.Add(New ReportParameter("Importe", DTPercepciones.SUM("Importe").ToString())) + RptParametro.Add(New ReportParameter("ImporteDeducciones", DTDeducciones.SUM("Importe").ToString())) + + RptParametro.Add(New ReportParameter("SubTotal", DTPercepciones.SUM("Importe").ToString())) + RptParametro.Add(New ReportParameter("Descuentos", DTDeducciones.SUM("Importe", "SATCveConcepto <> '002'").ToString())) + RptParametro.Add(New ReportParameter("ISR", DTDeducciones.SUM("Importe", "SATCveConcepto = '002'").ToString())) + 'Timbrado + RptParametro.Add(New ReportParameter("FolioFiscal", FolioFiscal)) + RptParametro.Add(New ReportParameter("CertificadoSAT", NoSerieCertificado)) + RptParametro.Add(New ReportParameter("FechaCertificacion", FechaCertificacion.ToString)) + RptParametro.Add(New ReportParameter("SelloDigitalEmisor", SelloCFDi)) + RptParametro.Add(New ReportParameter("SelloDigitalSAT", SelloSAT)) + RptParametro.Add(New ReportParameter("CadenaOriginal", CadenaOriginalCFD)) + RptParametro.Add(New ReportParameter("QR", ImgCBB.ToString)) + + + Dim LSRds As New List(Of ReportDataSource) + + + Dim rds2 = New ReportDataSource() + + Dim dtqr As New DataTable + + Dim column As DataColumn = New DataColumn("ImagenByte") + column.DataType = System.Type.[GetType]("System.Byte[]") + column.AllowDBNull = True + column.Caption = "ImagenByte" + dtqr.Columns.Add(column) + Dim rowqr As DataRow = dtqr.NewRow() + rowqr("ImagenByte") = cQr + + dtqr.Rows.Add(rowqr) + rds2.Name = "dsImagenes" + rds2.Value = dtqr + LSRds.Add(rds2) + Dim numnewfiles As Integer = 0 + If DTPercepciones.Rows.Count > DTDeducciones2.Rows.Count Then + + numnewfiles = DTPercepciones.Rows.Count - DTDeducciones2.Rows.Count + For index = 1 To numnewfiles + + DTDeducciones2.Rows.Add(DTDeducciones2.NewRow) + Next + Else + + If DTDeducciones2.Rows.Count > DTPercepciones.Rows.Count Then + numnewfiles = DTDeducciones2.Rows.Count - DTPercepciones.Rows.Count + For index = 1 To numnewfiles + + DTPercepciones.Rows.Add(DTPercepciones.NewRow) + Next + + End If + End If + + Dim RptDS As New ReportDataSource + RptDS.Name = "DsOC" + RptDS.Value = DTPercepciones + LSRds.Add(RptDS) + + Dim RDS As New ReportDataSource + RDS.Name = "DataSet1" + RDS.Value = DTDeducciones2 + LSRds.Add(RDS) + Dim Archivo As New System.IO.FileInfo(RutaFormato) + + If Not TieneError Then + If Archivo.Exists Then + Retorno = StreamPDF(RutaFormato, LSRds, RptParametro, ObjNomina.SerieFolio, "PDF", MR:=Nothing) + Dim ArchivoPDF As New System.IO.FileInfo(String.Format("{0}PDF\\{1}.pdf", RutaEmpresa, ObjNomina.SerieFolio)) + If Not ArchivoPDF.Exists Then + Try + DirectoryExistsCreate(String.Format("{0}PDF", RutaEmpresa)) + DirectoryExistsCreate(String.Format("{0}PDF\{1}", RutaEmpresa, "Nomina")) + File.WriteAllBytes(String.Format("{0}PDF\Nomina\{1}.pdf", RutaEmpresa, ObjNomina.SerieFolio), Retorno) + Catch ex As Exception + Alert("Ocurrió un error al generar el PDF", TipoMensaje.MsgAdvertencia) + GuardaLog(String.Format("Ocurrió un error al generar el PDF {0}", ex)) + End Try + End If + Else + 'ImprimirPDF(String.Format("{0}\Formatos\Nomina.rdlc", RutaEmpresa), LSRds, RptParametro, ObjNomina.SerieFolio) + End If + Else + Alert("Ocurrio un error al obtener los datos de la Nomina") + End If + Catch ex As Exception + + GuardaLog(String.Format("Ocurrio un error al generar el reporte RLDC {0}", ex)) + End Try + + + ObjNomina.Dispose() + ObjPersonal.Dispose() + + Return Retorno + End Function + + Private Sub DescargaArchivoDirecto(RutaArchivo As String) If RutaArchivo <> "" Then diff --git a/Compras/ReembolsosComprobaciones.aspx b/Compras/ReembolsosComprobaciones.aspx index 772a28732..6b1e0781a 100644 --- a/Compras/ReembolsosComprobaciones.aspx +++ b/Compras/ReembolsosComprobaciones.aspx @@ -294,7 +294,7 @@ + DataKeyNames="CveCompra,FechaCompra,CveProveedor,CveMoneda,Proveedor,SerieFolio,SubTotal,IVA,RetIVA,RetISR,IEPS,Total,TipoCambio,IdCtaContProveedores,IdCtaContAcreedor,CvePrePoliza,IdPoliza,CveRetIVAConcepto,CveRetISRConcepto,IVAPorcentaje,IVADeducible,IVANoDeducible,CveTipoConcepto,CveSubProyecto,IVAPorPagar"> diff --git a/Compras/ReembolsosComprobaciones.aspx.vb b/Compras/ReembolsosComprobaciones.aspx.vb index 43a31ced1..a682a10fd 100644 --- a/Compras/ReembolsosComprobaciones.aspx.vb +++ b/Compras/ReembolsosComprobaciones.aspx.vb @@ -723,6 +723,7 @@ Partial Class Compras_ReembolsosComprobaciones CveIEPago = 0 Dim FolioIENew = ObjIE.GetNextFolio(CveCajaChica, 6).ToString CveIEPago = ObjIE.AddBancos_IE(CveCajaChica, 6, If(ChkReembolsarSinBancos.Checked, TxtFechaPrePoliza.Text.ToDate, TxtFechaDocumento.Text.ToDate), FolioIENew, gvr.DataKey("Proveedor"), ImporteMovto, CveMoneda, 0.0, $"{gvr.DataKey("Proveedor")} F:{gvr.DataKey("SerieFolio")} {If(DdlPersonal.Visible, DdlPersonal.SelectedItem.Text, DdlCajaChica.SelectedItem.Text)}", "", False, True, -1, CvePrePolizaPago, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FueConciliado:=If(ChkReembolsarSinBancos.Checked Or CveCajaChica > 0, True, False)) + TipoCambioPago = 1 Else CveIEPago = CveIERegistrado End If @@ -739,18 +740,18 @@ Partial Class Compras_ReembolsosComprobaciones Pago.OtroGastoIngreso = gvr.FCTextBox("TxtComision").Text.ToDecimal End If - If MsgError = "" AndAlso Not ChkReembolsarSinBancos.Checked AndAlso (Not HdnCheque.Value.ToEntero > 0 Or Not UsuarioActual.CveEmpresa.Contiene(119, 158)) Then - - 'Si es caja chica metemos el concepto 30, si es funcionario metemos 29 - ImporteMovto += Pago.OtroGastoIngreso ' si ajuste, sedebe de aplicar en su contraparte - If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, ImporteMovto, Referencia, If(CveCajaChica > 0, 30, 29), ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(CveCajaChica > 0, IdCuentaBancaria, IdCtaPersonal), -1, CveIE:=CveIEPago, CveIEDevolucion:=If(CveCajaChica > 0, If(DDlCheques.SelectedValue.ToEntero = -1, CveIECajaChica, DDlCheques.SelectedValue.ToEntero), -1), CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteMovto), ImporteMX:=ImporteMovto * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, Contabilizable:=If(CveCajaChica > 0 Or CvePersonal > 0, Not UsaSimplificacionCajaChica, True)) Then - MsgError = "Detalle" + If MsgError = "" Then + If Not ChkReembolsarSinBancos.Checked AndAlso (Not HdnCheque.Value.ToEntero > 0 Or Not UsuarioActual.CveEmpresa.Contiene(119, 158)) Then + 'Si es caja chica metemos el concepto 30, si es funcionario metemos 29 + ImporteMovto += Pago.OtroGastoIngreso ' si ajuste, sedebe de aplicar en su contraparte + If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, ImporteMovto, Referencia, If(CveCajaChica > 0, 30, 29), ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(CveCajaChica > 0, IdCuentaBancaria, IdCtaPersonal), -1, CveIE:=CveIEPago, CveIEDevolucion:=If(CveCajaChica > 0, If(DDlCheques.SelectedValue.ToEntero = -1, CveIECajaChica, DDlCheques.SelectedValue.ToEntero), -1), CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, ImporteMovto), ImporteMX:=ImporteMovto * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, Contabilizable:=If(CveCajaChica > 0 Or CvePersonal > 0, Not UsaSimplificacionCajaChica, True)) Then + MsgError = "Detalle" + End If End If If AplicaPrePolizaPago(CompraActual, Pago, CvePrePolizaPago, ObjMov) Then MsgError = "Detalle" End If - End If Dim SaldoExcedente As Decimal = gvr.FCTextBox("TxtSaldoExcedente").Text.ToDecimal diff --git a/Compras/eFacturas.aspx b/Compras/eFacturas.aspx index ec13217d4..670f7fa0d 100644 --- a/Compras/eFacturas.aspx +++ b/Compras/eFacturas.aspx @@ -30,6 +30,9 @@ .table table-striped table-hover dataTable no-footer { margin-top: 0px !important; } + .ajax__tab_xp .ajax__tab_body { + font-size: 12px !important; + } diff --git a/Compras/eFacturas.aspx.vb b/Compras/eFacturas.aspx.vb index 6fc2bdb8f..295d0a10a 100644 --- a/Compras/eFacturas.aspx.vb +++ b/Compras/eFacturas.aspx.vb @@ -778,6 +778,7 @@ Partial Class Compras_eFacturas CargaGvBitacora() CargaDatos() + MostrarSolcitudesSAT() End If removeasincevent() End Sub @@ -2976,6 +2977,18 @@ Partial Class Compras_eFacturas End If End Sub + Private Sub MostrarSolcitudesSAT() + LnkShowSolicitudes.Visible = False + + If UsuarioActual.Empresa.ArchivoPfx.Trim.Length > 0 Then + Dim ArchivoCertificado As String = $"{UsuarioActual.Empresa.Ruta}Certificados\{UsuarioActual.Empresa.ArchivoPfx}" + If File.Exists(ArchivoCertificado) Then + LnkShowSolicitudes.Visible = True + End If + End If + + End Sub + #End Region diff --git a/Contabilidad/PopUpAuxiliar.aspx b/Contabilidad/PopUpAuxiliar.aspx index 50fe4092b..0a5826bef 100644 --- a/Contabilidad/PopUpAuxiliar.aspx +++ b/Contabilidad/PopUpAuxiliar.aspx @@ -148,6 +148,7 @@ + diff --git a/Contabilidad/PopUpAuxiliar.aspx.vb b/Contabilidad/PopUpAuxiliar.aspx.vb index 6f0951149..250bd30f0 100644 --- a/Contabilidad/PopUpAuxiliar.aspx.vb +++ b/Contabilidad/PopUpAuxiliar.aspx.vb @@ -164,9 +164,6 @@ Partial Class PopUpAuxiliar Protected Sub GVAuxiliar_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVAuxiliar.RowDataBound - - - If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.RowIndex = 0 Then e.Row.BackColor = Drawing.Color.LightGray @@ -213,6 +210,17 @@ Partial Class PopUpAuxiliar e.Row.FCLiteral("LtlConcepto").Text = String.Format("{0}{1}", Liga, e.Row.DBCampo("ConceptoContable")) End If + If e.Row.DBCampo("CveConceptoContable").Contiene("91", "251", "301") Then 'desaplicar NC + + e.Row.FCLinkButton("LnkDesAplicar").Visible = True + e.Row.FCLinkButton("imgD").Visible = False + If e.Row.DBCampo("CveConceptoContable").Contiene("251", "301") Then + e.Row.FCLinkButton("LnkDesAplicar").CommandArgument = String.Format("{0}|{1}|{2}", e.Row.DBCampo("CvePrePoliza"), e.Row.DBCampo("CveVenta"), e.Row.DBCampo("CveVentaAmortizacion")) + Else + e.Row.FCLinkButton("LnkDesAplicar").CommandArgument = String.Format("{0}|{1}|{2}", e.Row.DBCampo("CvePrePoliza"), e.Row.DBCampo("CveVentaAmortizacion"), e.Row.DBCampo("CveVenta")) + End If + End If + If e.Row.DBCampo("TipoReferencia").ToEntero = 1 Then e.Row.FCHyperLink("HplReferencia").NavigateUrl = $"/Bancos/IE.aspx?CveIE={e.Row.DBCampo("CveReferencia").ToEntero}" 'If e.Row.DBCampo("CveReferencia").ToEntero > 0 Then @@ -418,7 +426,6 @@ Partial Class PopUpAuxiliar Alert(Str.ToString) Else ObjContabilidad.RollBack() - End If ObjContabilidad.Dispose() @@ -439,6 +446,43 @@ Partial Class PopUpAuxiliar RegistraScript(" $('#DivCancelar').modal('show'); ") End Sub + Private Sub GVAuxiliar_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GVAuxiliar.RowCommand + If e.CommandName = "DesAplicar" Then + + Dim CvePrePoliza, CveVenta, CveVentaAmortizacion As Integer + Dim TieneError = False + + Dim St As String() = e.CommandArgument.ToString.Split("|"c) + If St.Length > 0 Then + CvePrePoliza = St(0).ToEntero + CveVenta = St(1).ToEntero + CveVentaAmortizacion = St(2).ToEntero + End If + + If CvePrePoliza > 0 Then + Dim Conta As New ClsContabilidad() + Conta.IniciaTransacSQL() + + If Not Conta.UpdatePrePolizasDetalleBloquear(CvePrePoliza, False) Then + TieneError = True + End If + + If Not TieneError AndAlso Not Conta.DesAplicarPago(CvePrePoliza, 251, CveVenta, CveVentaAmortizacion) Then + TieneError = True + End If + + If Not TieneError Then + Conta.Commit() + Alert("Pago Desaplicado.", TipoMensaje.ToastInformacion) + Else + Conta.RollBack() + Alert("Pago no fue desaplicado.", TipoMensaje.ToastError) + End If + End If + + End If + + End Sub End Class diff --git a/Contabilidad/RegPrePolizaS.aspx.vb b/Contabilidad/RegPrePolizaS.aspx.vb index bd55a5b41..cd96ee540 100644 --- a/Contabilidad/RegPrePolizaS.aspx.vb +++ b/Contabilidad/RegPrePolizaS.aspx.vb @@ -1010,6 +1010,14 @@ Partial Class ContabilidadC_RegPrePolizaS If CveIE < 0 Then MsgError = "No se pudo registrar movimiento bancario" Exit For + Else + + If tFolio > 0 Then + FolioIE = tFolio + Else + FolioIE = ObjIE.Folio + End If + End If End If @@ -2409,7 +2417,7 @@ Partial Class ContabilidadC_RegPrePolizaS End If TipoMov = GlobalDTTipoTransacciones.FiltroPrimeroValor("CveTipoTransaccion", String.Format("TipoTransaccion = '{0}' ", Row("TipoTransferencia"))).ToEntero - TipoNaturaleza = GlobalDTTipoTransacciones.FiltroPrimeroValor("Tipo", String.Format("TipoTransaccion = '{0}' ", Row("TipoTransferencia"))).ToEntero + TipoNaturaleza = GlobalDTTipoTransacciones.FiltroPrimeroValor("Tipo", String.Format("TipoTransaccion = '{0}' ", Row("TipoTransferencia"))) FolioExcel = Row("Folio").ToString.ToEntero CveTipoTransaccion = TipoMov @@ -2421,7 +2429,7 @@ Partial Class ContabilidadC_RegPrePolizaS End If Folio = FolioExcel - ImporteDocumento = IIf(Row("Abono").ToString.ToDecimal > 0, Row("Abono").ToString.ToDecimal, Row("Cargo").ToString.ToDecimal) + ImporteDocumento = IIf(Row("Abono").ToString.ToDecimal <> 0, Row("Abono").ToString.ToDecimal, Row("Cargo").ToString.ToDecimal) Observaciones = Row("Referencia").ToString Beneficiario = Row("Concepto").ToString @@ -2430,11 +2438,19 @@ Partial Class ContabilidadC_RegPrePolizaS Exit Sub End If - If Row("Abono").ToString.ToDecimal > 0 And TipoNaturaleza = "Ing" Or Row("Cargo").ToString.ToDecimal > 0 And TipoNaturaleza = "Egs" Then + + If Not (TipoNaturaleza = "Ing" And ((TipoMovto = False And ImporteDocumento >= 0) Or (TipoMovto = True And ImporteDocumento <= 0)) Or + TipoNaturaleza = "Egs" And ((TipoMovto = True And ImporteDocumento >= 0) Or (TipoMovto = False And ImporteDocumento <= 0))) Then Alert($"El movimiento con cuenta: {NombreCuenta} , importe: {ImporteDocumento.ToString("###,###,###.00")} (registro {ContadorRegistros}), no tiene la naturaleza correcta", TipoMensaje.MsgAdvertencia) Exit Sub + End If + 'If Row("Abono").ToString.ToDecimal > 0 And TipoNaturaleza = "Ing" Or Row("Cargo").ToString.ToDecimal > 0 And TipoNaturaleza = "Egs" Then + ' Alert($"El movimiento con cuenta: {NombreCuenta} , importe: {ImporteDocumento.ToString("###,###,###.00")} (registro {ContadorRegistros}), no tiene la naturaleza correcta", TipoMensaje.MsgAdvertencia) + ' Exit Sub + 'End If + End If If Row("Abono").ToString.ToDecimal > 0 And Row("Cargo").ToString.ToDecimal > 0 Then diff --git a/Contabilidad2/RepAnexoCatalogoAnual.aspx.vb b/Contabilidad2/RepAnexoCatalogoAnual.aspx.vb index a4fcaef1c..ef64e84a7 100644 --- a/Contabilidad2/RepAnexoCatalogoAnual.aspx.vb +++ b/Contabilidad2/RepAnexoCatalogoAnual.aspx.vb @@ -181,6 +181,11 @@ Partial Class Contabilidad2_RepAnexoCatalogoAnual Private Sub CargaDatos() + If CveCuenta <= -1 Then + Alert("No hay una cuenta expecificada.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + DTHeaders = New DataTable DTDatos = New DataTable diff --git a/CxC/RepCxCDetalle.aspx.vb b/CxC/RepCxCDetalle.aspx.vb index e6a841ce5..3e189178f 100644 --- a/CxC/RepCxCDetalle.aspx.vb +++ b/CxC/RepCxCDetalle.aspx.vb @@ -426,8 +426,13 @@ Partial Class RepCxCDetalle If UsuarioActual.CveEmpresa.Contiene(72, 80, 146, 119) Then ChkAnticipos.Visible = True End Sub - Private Function CargaDatos() As DataTable - Dim dt As DataTable = Nothing + Private Function CargaDatos() As DataSet + + Dim DSRespuesta As New DataSet + + Dim DTaDAtos As New DataTable + Dim DTCartera As New DataTable + Dim ObjMovtos As New ClsMovimientos() Dim FechaI, FechaF, FechaVI, FechaVF As String @@ -452,10 +457,20 @@ Partial Class RepCxCDetalle CveClienteClasificacion:=DdlClienteClasificacion.SelectedValue.ToEntero, LimiteCredito:=LimiteCredito, TipoCliente:=DdlTipoCliente.SelectedValue.ToEntero, CveMoneda:=CveMoneda, EstatusCliente:=DdlEstatusCliente.SelectedValue.ToEntero, AplicaAnticiposPagados:=If(ChkAnticipos.Checked, 1, 0)) Then - GvDatos.DataSource = ObjMovtos.DSResultados.Tables(0) - dt = ObjMovtos.DSResultados.Tables(0) + GvDatos.DataSource = ObjMovtos.DSResultados.Tables(0) + + 'DTaDAtos = ObjMovtos.DSResultados.Tables(0) + 'DTaDAtos.TableName = "DTaDAtos" + DSRespuesta.Tables.Add(ObjMovtos.DSResultados.Tables(0).Copy) + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then + GvCartera.DataSource = ObjMovtos.DSResultados.Tables(1) + + 'DTCartera = ObjMovtos.DSResultados.Tables(1) + 'DTCartera.TableName = "DTCartera" + DSRespuesta.Tables.Add(ObjMovtos.DSResultados.Tables(1).Copy) + End If @@ -475,7 +490,7 @@ Partial Class RepCxCDetalle UPDatos.Update() UpCartera.Update() - Return dt + Return DSRespuesta End Function @@ -949,11 +964,36 @@ Partial Class RepCxCDetalle Else params.Add(New ReportParameter("LogoPath", "")) End If + + + Dim lrds As New List(Of ReportDataSource) + + Dim DSDatos As DataSet = CargaDatos() + + Dim rds As New ReportDataSource With {.Name = "DataSet1", .Value = DSDatos.Tables(0)} + lrds.Add(rds) + + + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then + Dim rdsCartera As New ReportDataSource With {.Name = "DSCartera", .Value = DSDatos.Tables(1)} + lrds.Add(rdsCartera) + Else + Dim DTCartera As New DataTable + DTCartera.Columns.Add("Rango") + DTCartera.Columns.Add("Saldo", GetType(Decimal)) + DTCartera.Columns.Add("Porcentaje", GetType(Decimal)) + DTCartera.Columns.Add("Objetivo", GetType(Decimal)) + Dim rdsCartera As New ReportDataSource With {.Name = "DSCartera", .Value = DTCartera} + lrds.Add(rdsCartera) + End If + + + Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/RepCxCDetalle.rdlc", UsuarioActual.Empresa.Ruta)) If Archivo.Exists Then - ImprimirPDF(String.Format("{0}Formatos/RepCxCDetalle.rdlc", UsuarioActual.Empresa.Ruta), CargaDatos, params, "ReporteCxCDetalle", TipoImpresion) + ImprimirPDF(String.Format("{0}Formatos/RepCxCDetalle.rdlc", UsuarioActual.Empresa.Ruta), lrds, params, "ReporteCxCDetalle", TipoImpresion) Else - ImprimirPDF("Empresas/Grales/Formatos/RepCxCDetalle.rdlc", CargaDatos, params, "ReporteCxCDetalle", TipoImpresion) + ImprimirPDF("Empresas/Grales/Formatos/RepCxCDetalle.rdlc", lrds, params, "ReporteCxCDetalle", TipoImpresion) End If diff --git a/Empresas/Grales/Formatos/RepCxCDetalle.rdlc b/Empresas/Grales/Formatos/RepCxCDetalle.rdlc index 4aeb0b169..4f7fbd6a6 100644 --- a/Empresas/Grales/Formatos/RepCxCDetalle.rdlc +++ b/Empresas/Grales/Formatos/RepCxCDetalle.rdlc @@ -1202,8 +1202,435 @@ + + + + + 2.5cm + + + 2.5cm + + + 2.5cm + + + 2.5cm + + + + + 0.49417cm + + + + + true + true + + + + + Rango Días + + + + + + + Textbox15 + + + + Black + + 1pt + + + Black + + 1pt + + + Black + + 1pt + + + Black + + 1pt + + Silver + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Importe + + + + + + + Textbox19 + + + + Black + + 1pt + + + Black + + 1pt + + + Black + + 1pt + + + Black + + 1pt + + Silver + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + % + + + + + + + Textbox23 + + + + Black + + 1pt + + + Black + + 1pt + + + Black + + 1pt + + + Black + + 1pt + + Silver + 2pt + 2pt + 2pt + 2pt + + + true + + + + + + true + true + + + + + Objetivo + + + + + + + Textbox26 + + + + Black + + 1pt + + + Black + + 1pt + + + Black + + 1pt + + + Black + + 1pt + + Silver + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.2825cm + + + + + true + true + + + + + =Fields!Rango.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Saldo.Value + + + + + + + Saldo1 + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Porcentaje.Value + + + + + + + Porcentaje + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Objetivo.Value + + + + + + + Objetivo + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + + After + + + + + + + DSCartera + 1.6429cm + 0.77667cm + 10cm + 1 + + =IIF(CountRows()>0,false,true) + + + + + - 0.78933in + 0.99425in - 0.11642cm + 0.11641cm 0.0635cm 0cm 26.34825cm @@ -1549,7 +1975,7 @@ Textbox13 - 0.6103cm + 0.61029cm 0.14cm 0.6cm 6.69369cm @@ -1651,6 +2077,38 @@ + + + DataSet + /* Local Query */ + + + + Rango + System.String + + + Saldo + System.Double + + + Porcentaje + System.Double + + + Objetivo + System.Double + + + + DataSet + C:\Users\Caudillo\Documents\Visual Studio 2013\WebSites\WebSite9\App_Code\DSCartera.xsd + DataTable1 + + + + + diff --git a/GPS/ReciboNom.rdlc b/GPS/ReciboNom.rdlc index 567941e6e..13eb33297 100644 --- a/GPS/ReciboNom.rdlc +++ b/GPS/ReciboNom.rdlc @@ -5162,7 +5162,7 @@ HERMOSILLO, SONORA - 0.6cm + 0.36187cm @@ -6471,7 +6471,7 @@ Firma del Trabajador DataSet1 0.15557cm 0.10265cm - 12.89958cm + 12.66146cm 19.12116cm - 5.31354in + 5.14687in