This commit is contained in:
HECTOR RODRIGUEZ
2021-05-22 12:11:51 -07:00
56 changed files with 4818 additions and 2520 deletions

View File

@@ -16,6 +16,9 @@ Public Class CFDITimbre
Public Property Nomina As CFDINomina
Public Property ComplementoPagos As CFDIComplementoPagos
Public Property Complementos As CFDIComplementos
Public Property Timbrado As Boolean
Public Property IStimbreFiniquito As Boolean
Public ReadOnly Property TotalImpuestosRetenidos As Decimal
Get
Return (From c In Conceptos
@@ -128,6 +131,8 @@ Public Class CFDINomina
Public Property OtrosPagos As List(Of CFDINominaOtrosPagos)
Public Property HorasExtras As List(Of CFDINominaHorasExtras)
Public Property CveNomina As Integer
Public Property Antiguedad As Integer
Public Property UltimoSueldoOrdinario As Decimal
Public ReadOnly Property TotalPercepciones As Double
Get

View File

@@ -256,13 +256,13 @@ Public Class ClsContabilidad
Return Retorno
End Function
Public Function UpdatePrepolizasDetalle(CvePrePolizaDetalle As Integer, Concepto As String, CveSubProyecto As Integer, IdCtaContable As Integer, TipoMovto As Boolean, ImporteMN As Decimal, Optional CveTipoGasto As Integer = -1,
Public Function UpdatePrePolizasDetalle(CvePrePolizaDetalle As Integer, Concepto As String, CveSubProyecto As Integer, IdCtaContable As Integer, TipoMovto As Boolean, ImporteMN As Decimal, Optional CveTipoGasto As Integer = -1,
Optional CveConceptoContable As Integer = -1, Optional CveProveedor As Integer = -1, Optional CveCompra As Integer = -1, Optional CvePersonal As Integer = -1, Optional CveCliente As Integer = -1, Optional CveVenta As Integer = -1,
Optional Referencia As String = "-1", Optional CveUsuarioModifico As Integer = -1) As Boolean
Optional Referencia As String = "-1", Optional CveUsuarioModifico As Integer = -1, Optional CveCuenta As Integer = -1) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_PrePolizaDetalleUpdate")
DataAdapter("PA_Conta_PrePolizasDetalleUpdate")
With SqlAdapter.SelectCommand.Parameters
.Add("@CvePrePolizaDetalle", SqlDbType.Int).Value = CvePrePolizaDetalle
@@ -280,6 +280,7 @@ Public Class ClsContabilidad
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
.Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico
.Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta
End With
Try

View File

@@ -463,24 +463,24 @@ Public Class ClsNominas
Return Retorno
End Function
Public Function UpdateProvisionNomina(CvePeriodo As Integer, CvePrePoliza As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Nom_ProvisionNominaUpdate")
'Public Function UpdateProvisionNomina(CvePeriodo As Integer, CvePrePoliza As Integer, CveEmpresa As Integer) As Boolean
' Dim Retorno As Boolean = False
' DataAdapter("PA_Nom_ProvisionNominaUpdate")
With SqlAdapter.SelectCommand.Parameters
.Add("@CvePeriodo", SqlDbType.Int).Value = CvePeriodo
.Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al actualizar el periodo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
' With SqlAdapter.SelectCommand.Parameters
' .Add("@CvePeriodo", SqlDbType.Int).Value = CvePeriodo
' .Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza
' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
' End With
' Try
' SqlAdapter.Fill(Data)
' Retorno = True
' Catch ex As Exception
' OnError("Ocurrió un error al actualizar el periodo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
' End Try
Return Retorno
End Function
' Return Retorno
'End Function
Public Function GetNom_NominasDetalles(CveNomina As Integer, CvePersonal As Integer, CvePeriodo As Integer, Tipo As String) As Boolean
Dim Retorno As Boolean = False
@@ -852,7 +852,7 @@ Public Class ClsNominas
Return Retorno
End Function
Public Function UpdateEstatusNomNominas(Estatus As Integer, CvePAC As Integer, FolioFiscal As String, SelloSAT As String, FechaCancelacion As DateTime, CveNomina As Integer, Optional SubTotal As Double = -1, Optional Descuento As Double = -1, Optional ISR As Double = -1, Optional Total As Double = -1, Optional DiasPagados As Double = -1) As Boolean
Public Function UpdateEstatusNomNominas(Estatus As Integer, CvePAC As Integer, FolioFiscal As String, SelloSAT As String, FechaCancelacion As DateTime, CveNomina As Integer, Optional SubTotal As Double = -1, Optional Descuento As Double = -1, Optional ISR As Double = -1, Optional Total As Double = -1, Optional DiasPagados As Double = -1, Optional isFiniquito As Boolean = False) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Nom_NominasUpdateEstatus")
@@ -870,6 +870,7 @@ Public Class ClsNominas
.Add("@Total", SqlDbType.Money).Value = Total
.Add("@DiasPagados", SqlDbType.Int).Value = DiasPagados
.Add("@CveNomina", SqlDbType.Int).Value = CveNomina
.Add("@isFiniquito", SqlDbType.Bit).Value = isFiniquito
End With
Try
@@ -2182,7 +2183,7 @@ Public Class ClsNominas
End Try
Return retorno
End Function
Public Function GetNominaEmpleado(CveProyecto As Integer, CveSubProyecto As Integer, CveTurno As Integer, CvePeriodo As Integer, CveEmpresa As Integer, Agrupador As Integer, Optional RegimenContratacion As Integer = 1, Optional CvePersonal As Integer = -1) As Boolean
Public Function GetNominaEmpleado(CveProyecto As Integer, CveSubProyecto As Integer, CveTurno As Integer, CvePeriodo As Integer, CveEmpresa As Integer, Agrupador As Integer, Optional RegimenContratacion As Integer = 1, Optional CvePersonal As Integer = -1, Optional SalarioDiario As Decimal = 0) As Boolean
Dim retorno As Boolean = False
Try
DTSet = New DataSet()
@@ -2196,6 +2197,7 @@ Public Class ClsNominas
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@RegimenContratacion", SqlDbType.Int).Value = RegimenContratacion
.Add("@CvePersonal", SqlDbType.Decimal).Value = CvePersonal
.Add("@SalarioDiario", SqlDbType.Decimal).Value = SalarioDiario
End With

View File

@@ -3855,6 +3855,7 @@ Public Class ClsPaginas
PaginaDict.Add("/Nomina/CatConceptos2.aspx".ToUpper(), -1)
PaginaDict.Add("/Nomina/Aguinaldo.aspx".ToUpper(), -1)
PaginaDict.Add("/Nomina/RepInversiondeNomina.aspx".ToUpper(), 906)
PaginaDict.Add("/RH/DiasFestivos.aspx".ToUpper(), -1)
PaginaDict.Add("/Nomina/FiniquitoB.aspx".ToUpper(), -1)
''CONFIGURACIONES GENERALES
PaginaDict.Add("/Sistemas/SistemaSIG.aspx".ToUpper(), 9999)
@@ -4681,7 +4682,6 @@ Public Class ClsPaginas
PaginaDict.Add("/Inventarios/EntregasPorRealizar.aspx".ToUpper(), 728)
PaginaDict.Add("/Inventarios/CatAlmacenClasificacionSecciones.aspx".ToUpper(), 764)
PaginaDict.Add("/Inventarios/ReconstruirCostos.aspx".ToUpper(), 764)
PaginaDict.Add("/Inventarios/RecepcionDevolucion.aspx".ToUpper(), 696)
#End Region
@@ -4802,6 +4802,7 @@ Public Class ClsPaginas
#End Region
#Region "Planeacion"
'PLANEACIÓN
PaginaDict.Add("/Planeacion/CatSucursales.aspx".ToUpper(), 17)
PaginaDict.Add("/Planeacion/Sucursal.aspx".ToUpper(), 17)
PaginaDict.Add("/Planeacion/CatProyectos.aspx".ToUpper(), 34)
PaginaDict.Add("/Planeacion/CatSubProyectos.aspx".ToUpper(), 35)
@@ -6150,8 +6151,7 @@ Public Class ClsPaginas
params.Add(New CrystalParametro("ClienteTelefono", Vta.ClienteSucursal.TelefonoSucursal))
Else
params.Add(New CrystalParametro("ClienteContactoMail", Vta.Cliente.MailCotizacion))
params.Add(New CrystalParametro("ClienteTelefono", If(Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso Vta.Cliente.Telefono.Length > 6, Vta.Cliente.Telefono, Vta.TelefonoGenerico)))
params.Add(New CrystalParametro("ClienteTelefono", If(Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso Vta.Cliente.RFC = "XAXX010101000", Vta.TelefonoGenerico, Vta.Cliente.Telefono)))
End If
If UsuarioActual.CveEmpresa.Contiene(17) Then
@@ -6719,7 +6719,7 @@ Public Class ClsPaginas
params.Add(New ReportParameter("ClienteTelefono", Vta.ClienteSucursal.TelefonoSucursal))
ElseIf Vta.CveCliente.ToEntero > 0 Then
params.Add(New ReportParameter("ClienteContactoMail", Vta.Cliente.MailCotizacion))
params.Add(New ReportParameter("ClienteTelefono", If(Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso Vta.Cliente.Telefono.Length > 6, Vta.Cliente.Telefono, Vta.TelefonoGenerico)))
params.Add(New ReportParameter("ClienteTelefono", If(Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso Vta.Cliente.Telefono.Length > 6, Vta.TelefonoGenerico, Vta.Cliente.Telefono)))
End If
If UsuarioActual.CveEmpresa.Contiene(17) Then
@@ -7837,7 +7837,7 @@ Public Class ClsPaginas
#Region "PDF NOMINA"
Public Function GeneraPDFNomina(CvePersonal As Integer, CvePeriodo As Integer, CveEmpresa As Integer, RutaEmpresa As String) As Byte()
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
@@ -7857,7 +7857,7 @@ Public Class ClsPaginas
Dim DTDeducciones2 As New Data.DataTable
Dim Ruta As String = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{CveEmpresa}\"
Dim PathXML As String = $"{Ruta}XML\Nomina\{ObjNomina.SerieFolio}.xml"
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 = ""
@@ -7937,7 +7937,32 @@ Public Class ClsPaginas
'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)){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
@@ -7979,7 +8004,7 @@ Public Class ClsPaginas
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", ObjNomina.Total.ToString()))
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)
@@ -8001,22 +8026,6 @@ Public Class ClsPaginas
End If
End If
'PERCECIONES - DEDUCCIONES
If ObjNomina.GetNom_NominasDetalles(CveNomina, CvePersonal, CvePeriodo, "-1") Then
DTPercepciones = ObjNomina.DtResultados.FiltraParametros("(Tipo = 'P' OR (Tipo = 'D' AND Importe <0)) AND Importe <>0 AND EsPadre = 1 AND SoloVisible =0")
DTDeducciones = ObjNomina.DtResultados.FiltraParametros("Tipo = 'D' AND Importe >0 AND EsPadre = 1 AND SoloVisible =0")
DTDeducciones2 = ObjNomina.DtResultados.FiltraParametros("(Tipo = 'D' AND Importe >0 AND EsPadre = 1 AND SoloVisible =0) OR CveConcepto IN (1471,1491)")
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
RptParametro.Add(New ReportParameter("PU", DTPercepciones.SUM("Importe").ToString()))
RptParametro.Add(New ReportParameter("Importe", DTPercepciones.SUM("Importe").ToString()))

View File

@@ -122,9 +122,74 @@ Public Class ClsRH
CveConexion = 0
End If
End Sub
End Sub
#End Region
#Region "DiasFestivos"
Public Function DiasFestivosGet(CveEmpresa As Int32) As Boolean
Dim retorno As Boolean = False
DataAdapter("PA_RH_DiasFestivosGet", CommandType.StoredProcedure)
With SqlAdapter.SelectCommand.Parameters
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try
SqlAdapter.Fill(Data)
retorno = True
Catch Ex1 As SqlException
Me.OnError("Ocurrió un error al obtener los días festivos", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
Catch ex As Exception
OnError("Ocurrió un error al Guardar el Tipo de A-I", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return retorno
End Function
Public Function DiasFestivosAdd(fecha As DateTime, cveEmpresa As Int32, CveUsuario As Int32) As Boolean
Dim retorno As Boolean = False
DataAdapter("PA_RH_DiasFestivosAdd", CommandType.StoredProcedure)
With SqlAdapter.SelectCommand.Parameters
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
.Add("@CveEmpresa", SqlDbType.Int).Value = cveEmpresa
.Add("@Fecha", SqlDbType.DateTime).Value = fecha
End With
Try
SqlAdapter.Fill(Data)
retorno = True
Catch Ex1 As SqlException
If Ex1.Message.Contains("Número: 2627;") Then
Alert($"Ya existe un día festivo con fecha '{fecha:dd/MM/yyyy}'.", TipoMensaje.MsgAdvertencia)
Else
Me.OnError("Ocurrió un error al guardar el día festivo.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End If
Catch ex As Exception
OnError("Ocurrió un error al Guardar el Tipo de A-I", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return retorno
End Function
Public Function DiasFestivosRemove(fecha As DateTime, cveEmpresa As Int32) As Boolean
Dim retorno As Boolean = False
DataAdapter("PA_RH_DiasFestivosRemove", CommandType.StoredProcedure)
With SqlAdapter.SelectCommand.Parameters
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
.Add("@CveEmpresa", SqlDbType.Int).Value = cveEmpresa
.Add("@Fecha", SqlDbType.DateTime).Value = fecha
End With
Try
SqlAdapter.Fill(Data)
retorno = True
Catch Ex1 As SqlException
Me.OnError("Ocurrió un error al eliminar el día festivo.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
Catch ex As Exception
OnError("Ocurrió un error al eliminar el día festivo", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return retorno
End Function
#End Region
#Region "ClsRHAsistenciasInasistencias"
Public Function GetAsistenciasInasistencias() As Boolean
Dim Retorno As Boolean = False
@@ -2145,7 +2210,7 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo
Return Retorno
End Function
Public Function UpPersonalAltas(CvePersonal As Integer, fechaInicio As String, fechaFin As String, CvePeriodoFiniquito As Integer, CveMotivoBaja As Integer, esLiquidacion As Boolean) As Boolean
Public Function UpPersonalAltas(CvePersonal As Integer, fechaInicio As String, fechaFin As String, CvePeriodoFiniquito As Integer, CveMotivoBaja As Integer, esLiquidacion As Boolean, ValIndemnizacion As Boolean, ValSeparacionunica As Boolean, ValPrimadeantiguedad As Boolean) As Boolean
Dim Retorno As Boolean = False
SqlDataAdapter("PA_RH_PersonalAltasUp")
@@ -2156,6 +2221,9 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo
.Add("@CvePeriodoFiniquito", SqlDbType.Int).Value = CvePeriodoFiniquito
.Add("@CveMotivoBaja", SqlDbType.Int).Value = CveMotivoBaja
.Add("@esLiquidacion", SqlDbType.Int).Value = If(esLiquidacion, 1, 0)
.Add("@ValIndemnizacion", SqlDbType.Bit).Value = If(ValIndemnizacion, 1, 0)
.Add("@ValSeparacionunica", SqlDbType.Bit).Value = If(ValSeparacionunica, 1, 0)
.Add("@ValPrimadeantiguedad", SqlDbType.Bit).Value = If(ValPrimadeantiguedad, 1, 0)
End With
Try
SqlAdapter.Fill(Data)

View File

@@ -341,7 +341,7 @@ Public Class ClsVentas
Optional CveFormaPago33 As Integer = -1, Optional CveMetodoPago33 As Integer = -1, Optional CveUsoCFDI As Integer = -1, Optional OrdenCompra As String = "-1", Optional CveCuentaTerminal As Integer = -1, Optional CveTipoRelacion As Integer = -1, Optional ImpuestoLocal As Double = 0,
Optional CveTipoAmortizacionAnticipo As Integer = -1, Optional CveVentaRelacion As Integer = -1, Optional ImporteRelacion As Decimal = -1, Optional CveEmpresaCRM As Integer = -1, Optional EsInterno As Integer = -1, Optional CveAcercamientoCRM As Integer = -1,
Optional DiasCredito As Integer = 0, Optional EsDiasCreditoFijo As Boolean = False, Optional AnticipoEspecial As Boolean = False, Optional Kilometraje As Double = 0, Optional EsAmortizacion As Boolean = False, Optional CveTipoRetencion As Integer = 0,
Optional CorreoNotificacion As String = "", Optional FormaPaqueteria As Integer = 1, Optional FacturarSucursal As Boolean = False, Optional VentaDesglosaIEPS As Boolean = False, Optional ServicioDomicilio As Boolean = False) As Boolean
Optional CorreoNotificacion As String = "", Optional FormaPaqueteria As Integer = 1, Optional FacturarSucursal As Boolean = False, Optional VentaDesglosaIEPS As Boolean = False, Optional ServicioDomicilio As Boolean = False, Optional RFCReceptor As String = "") As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_VentasAdd")
@@ -435,6 +435,7 @@ Public Class ClsVentas
.Add("@FacturarSucursal", SqlDbType.Bit).Value = FacturarSucursal
.Add("@VentaDesglosaIEPS", SqlDbType.Bit).Value = VentaDesglosaIEPS
.Add("@ServicioDomicilio", SqlDbType.Bit).Value = ServicioDomicilio
.Add("@RFCReceptor", SqlDbType.VarChar).Value = RFCReceptor
.Add("@RETURN_VALUE", SqlDbType.Int).Direction = ParameterDirection.ReturnValue
End With
@@ -679,7 +680,7 @@ Public Class ClsVentas
End Function
Public Function UpdateEstatusFactura(Estatus As Integer, FolioFiscal As String, SelloSAT As String, FechaCancelacion As DateTime, CveVenta As Integer,
Optional IdPolizaCancelacion As Integer = -1, Optional CvePAC As Integer = -1, Optional CveEstatusRefacturacion As Integer = 0,
Optional CveUsuarioCambiaEstatus As Integer = -1, Optional FechaCambioEstatus As String = "-1") As Boolean
Optional CveUsuarioCambiaEstatus As Integer = -1, Optional FechaCambioEstatus As String = "-1", Optional RFCReceptor As String = "-1") As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_VentasUpdateEstatus")
@@ -695,6 +696,7 @@ Public Class ClsVentas
.Add("@CveEstatusRefacturacion", SqlDbType.TinyInt).Value = CveEstatusRefacturacion
.Add("@CveUsuarioCambiaEstatus", SqlDbType.Int).Value = CveUsuarioCambiaEstatus
.Add("@FechaCambioEstatus", SqlDbType.VarChar).Value = FechaCambioEstatus
.Add("@RFCReceptor", SqlDbType.VarChar).Value = RFCReceptor
End With
Try

View File

@@ -20,20 +20,53 @@ Public Class LogicNominas
sw.Start()
End If
Dim cfdi As CFDITimbre = PreTimbrar(CveNomina, UsuarioActual) 'CvePersonal, CvePeriodo,
Dim cfdi As CFDITimbre = PreTimbrar(CveNomina, UsuarioActual, False) 'CvePersonal, CvePeriodo,
If cfdi IsNot Nothing AndAlso cfdi.Mensaje = "" Then
Dim ObjTimbrado As New Timbrado
Dim ObjFactura As New Modelos.Factura
ObjFactura.TipoDocto = "Nomina"
ObjFactura.Folio = cfdi.Comprobante.Folio.ToEntero()
ObjFactura.Serie = cfdi.Comprobante.Serie
ObjFactura.Timbre = cfdi
If Not ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura, CvePAC) Then
Retorno = ObjTimbrado.MensajeErrorCFDI
If Not cfdi.Timbrado Then
Dim ObjTimbrado As New Timbrado
Dim ObjFactura As New Modelos.Factura
ObjFactura.TipoDocto = "Nomina"
ObjFactura.Folio = cfdi.Comprobante.Folio.ToEntero()
ObjFactura.Serie = cfdi.Comprobante.Serie
ObjFactura.Timbre = cfdi
If Not ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura, CvePAC) Then
Retorno = ObjTimbrado.MensajeErrorCFDI
End If
End If
If Retorno <> "" Then
Retorno = $"{Retorno} - {cfdi.Receptor.Nombre}"
Else
If hasfiniquito Then
cfdi = PreTimbrar(CveNomina, UsuarioActual, True) 'CvePersonal, CvePeriodo,
If cfdi IsNot Nothing AndAlso cfdi.Mensaje = "" Then
If Not cfdi.Timbrado Then
Dim ObjTimbrado As New Timbrado
Dim ObjFactura As New Modelos.Factura
ObjFactura.TipoDocto = "Nomina"
ObjFactura.Folio = cfdi.Comprobante.Folio.ToEntero()
ObjFactura.Serie = cfdi.Comprobante.Serie
ObjFactura.Timbre = cfdi
If Not ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura, CvePAC) Then
Retorno = ObjTimbrado.MensajeErrorCFDI
End If
If Retorno <> "" Then
Retorno = $"{Retorno} - {cfdi.Receptor.Nombre}"
Else
End If
End If
Else
If cfdi Is Nothing Then
Retorno = $"No se pudo generar el pretimbre(GetError): <br/> {GetError}"
Else
Retorno = $"No se pudo generar el pretimbre: <br/> {cfdi.Mensaje}"
End If
End If
End If
End If
Else
If cfdi Is Nothing Then
@@ -48,10 +81,10 @@ Public Class LogicNominas
End If
Return Retorno
End Function
Private Function PreTimbrar(CveNomina As Integer, UsuarioActual As Usuario) As CFDITimbre
Dim hasfiniquito As Boolean
Private Function PreTimbrar(CveNomina As Integer, UsuarioActual As Usuario, TimbreIndemnizacion As Boolean) As CFDITimbre
Dim continuar As Boolean = True
hasfiniquito = False
Dim CvePersonal As Integer = -1
Dim CvePeriodo As Integer = -1
Dim DtPercepciones As Data.DataTable = Nothing
@@ -107,13 +140,26 @@ Public Class LogicNominas
Dim ObjIncapacidades As New List(Of CFDINominaIncapacidades)
'Conexiones a la Base de Datos
Dim cfdi As New CFDITimbre
cfdi.Nomina = New CFDINomina
Using objNomina As ClsNominas = New ClsNominas()
Using objPersonal As ClsRH = New ClsRH()
If objNomina.GetNom_Nominas(CveNomina, -1, -1, -1, UsuarioActual.CveEmpresa) AndAlso objNomina.DtResultados.Rows.Count > 0 Then
CvePersonal = objNomina.DtResultados.Rows(0)("CvePersonal").ToString().ToEntero()
CvePeriodo = objNomina.DtResultados.Rows(0)("CvePeriodo").ToString().ToEntero()
Dim drow As DataRow = objNomina.DtResultados.Rows(0)
CvePersonal = drow("CvePersonal").ToString().ToEntero()
CvePeriodo = drow("CvePeriodo").ToString().ToEntero()
cfdi.Nomina.Antiguedad = drow("Antiguedad").ToString().ToEntero()
cfdi.Nomina.UltimoSueldoOrdinario = drow("UltimoSueldoOrdinario").ToString().ToDecimal()
Serie = objNomina.Serie
Folio = objNomina.Folio.ToString()
If TimbreIndemnizacion Then
cfdi.Timbrado = drow("SeTimbroFiniquitoVal").ToString().ToEntero() = 1
cfdi.IStimbreFiniquito = True
Serie = $"{objNomina.Serie}F"
Else
cfdi.Timbrado = drow("SeTimbroVal").ToString().ToEntero() = 1
cfdi.IStimbreFiniquito = False
End If
Else
If continuar Then GetError = "No se pudo obtener la información de la nomina" 'si continuar= true el error se origino en este nodo y se le asigno el error
continuar = False
@@ -148,18 +194,27 @@ 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"
Dim filtropercepciones As String = "Tipo = 'P' AND EsPadre = 1 AND SoloVisible =0 AND SATCveConcepto NOT IN ('022', '023','025')"
If TimbreIndemnizacion Then
filtropercepciones = " Tipo = 'P' AND SATCveConcepto IN ('022', '023','025')"
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)"
Dim filtrodeduc As String = "Tipo = 'D' AND EsPadre = 1 AND SoloVisible =0 AND (TipoConceptoSAT<>'O' OR TipoConceptoSAT IS NULL) AND CveSistema <> 47"
If TimbreIndemnizacion Then
filtrodeduc = " Tipo = 'D' AND CveSistema =47"
End If
DtDeducciones = objNomina.DtResultados.FiltraParametros(filtrodeduc)
DtOtrosPagos = objNomina.DtResultados.FiltraParametros(" TipoConceptoSAT='O'")
If Not TimbreIndemnizacion Then
DtOtrosPagos = objNomina.DtResultados.FiltraParametros(" TipoConceptoSAT='O'")
End If
Dim disrcomp As DataRow = DtOtrosPagos.FiltroPrimero("Codigo ='D999'")
For Each drow As DataRow In DtDeducciones.Rows
If drow("Codigo").ToString() = "D038" Then
End If
Next
hasfiniquito = objNomina.DtResultados.COUNT("SATCveConcepto", "(Tipo = 'P' AND SATCveConcepto IN ('022', '023','025')) OR (Tipo = 'D' AND SATCveConcepto = '101')") > 0
TotalPercepciones = DtPercepciones.SUM("Importe").ToString().ToDecimal()
@@ -170,53 +225,70 @@ Public Class LogicNominas
If continuar Then GetError = "No se pudo obtener el detalle de la nomina" 'si continuar= true el error se origino en este nodo y le asigno el error
continuar = False
End If
If continuar AndAlso objNomina.GetHorasExtras(CvePersonal, CvePeriodo, UsuarioActual.CveEmpresa) Then
DtHorasExtras = objNomina.DtResultados
If Not TimbreIndemnizacion Then
If continuar AndAlso objNomina.GetHorasExtras(CvePersonal, CvePeriodo, UsuarioActual.CveEmpresa) Then
DtHorasExtras = objNomina.DtResultados
Else
continuar = False
End If
Else
continuar = False
DtHorasExtras = New DataTable()
End If
If continuar AndAlso objNomina.GetPeriodos(-1, UsuarioActual.CveEmpresa, -1, -1, CvePeriodo) AndAlso objNomina.DtResultados.Rows().Count > 0 Then
Dim DrPeriodo As DataRow = objNomina.DtResultados.Rows(0)
FechaInicio = DrPeriodo("FechaInicio").ToString().ToDate
FechaFin = DrPeriodo("FechaFin").ToString().ToDate
FechaPago = DrPeriodo("FechaPago").ToString().ToDate
TipoNomina = If(objNomina.CveTipoPeriodo = 6, "E", "O")
FechaFin = DrPeriodo("FechaFin").ToString().ToDate()
FechaPago = DrPeriodo("FechaPago").ToString().ToDate()
If Not TimbreIndemnizacion Then
FechaInicio = DrPeriodo("FechaInicio").ToString().ToDate()
TipoNomina = If(objNomina.CveTipoPeriodo = 6, "E", "O")
Else
FechaInicio = FechaFin
TipoNomina = "E"
End If
Else
If continuar Then GetError = "No se pudo obtener la información del periodo" 'si continuar= true el error se origino en este nodo y le asigno el error
continuar = False
End If
If continuar AndAlso objPersonal.GetAsistencias(CvePersonal, -1, -1, -1, -1, -1, FechaInicio, FechaFin, UsuarioActual.CveEmpresa) Then
If Not TimbreIndemnizacion Then
If continuar AndAlso objPersonal.GetAsistencias(CvePersonal, -1, -1, -1, -1, -1, FechaInicio, FechaFin, UsuarioActual.CveEmpresa) Then
Dim Asistencias As Integer = objPersonal.DtResultados.SUM("AplicaAsistencia").ToEntero()
'If Asistencias > 15 Then
' Asistencias = 15
'End If
Dim Vacaciones As Integer = objPersonal.DtResultados.SUM("AplicaVacacion").ToEntero()
DiasIncapacitados = objPersonal.DtResultados.SUM("AplicaIncapacidad").ToEntero()
DiasPagados = Asistencias - Vacaciones
If DiasPagados < 0 Then DiasPagados = 0
Else
continuar = False
End If
If DiasIncapacitados > 0 Then
If objNomina.GetIncapacidades(CvePersonal, CvePeriodo, UsuarioActual.CveEmpresa) Then
If objNomina.DtResultados IsNot Nothing AndAlso objNomina.DtResultados.Rows.Count > 0 Then
For Each dr As DataRow In objNomina.DtResultados.Rows
ObjIncapacidades.Add(New CFDINominaIncapacidades With {.DiasIncapacidad = dr("Dias").ToString().ToEntero().ToString(), .TipoIncapacidad = dr("ClaveTipoIncapacidad").ToString(), .Importe = dr("Descuento").ToString().ToDecimal})
Next
End If
Dim Asistencias As Integer = objPersonal.DtResultados.SUM("AplicaAsistencia").ToEntero()
'If Asistencias > 15 Then
' Asistencias = 15
'End If
Dim Vacaciones As Integer = objPersonal.DtResultados.SUM("AplicaVacacion").ToEntero()
DiasIncapacitados = objPersonal.DtResultados.SUM("AplicaIncapacidad").ToEntero()
DiasPagados = Asistencias - Vacaciones
If DiasPagados < 0 Then DiasPagados = 0
Else
If continuar Then GetError = "No se pudo obtener las incapacidades del periodo" 'si continuar= true el error se origino en este nodo y le asigno el error
continuar = False
End If
Else
DiasPagados = 1
DiasIncapacitados = 0
End If
If continuar AndAlso DiasIncapacitados > 0 Then
If Not TimbreIndemnizacion Then
If objNomina.GetIncapacidades(CvePersonal, CvePeriodo, UsuarioActual.CveEmpresa) Then
If objNomina.DtResultados IsNot Nothing AndAlso objNomina.DtResultados.Rows.Count > 0 Then
For Each dr As DataRow In objNomina.DtResultados.Rows
ObjIncapacidades.Add(New CFDINominaIncapacidades With {.DiasIncapacidad = dr("Dias").ToString().ToEntero().ToString(), .TipoIncapacidad = dr("ClaveTipoIncapacidad").ToString(), .Importe = dr("Descuento").ToString().ToDecimal})
Next
End If
Else
If continuar Then GetError = "No se pudo obtener las incapacidades del periodo" 'si continuar= true el error se origino en este nodo y le asigno el error
continuar = False
End If
End If
End If
End Using
End Using
'Lnado del CFDITimbre
Dim cfdi As New CFDITimbre
cfdi.Nomina = New CFDINomina
'Lnado del CFDITimbre
cfdi.Nomina.Version = "1.2"
cfdi.Nomina.TipoNomina = TipoNomina
cfdi.Nomina.FechaPago = FechaPago
@@ -326,7 +398,7 @@ Public Class LogicNominas
Next
End If
If CveRegimenContratacion.ToEntero() = 2 AndAlso ((ObjOtrosPagos.FirstOrDefault(Function(m) m.TipoOtroPago.ToEntero().Contiene(2, 7, 8))) Is Nothing) Then
If Not TimbreIndemnizacion AndAlso CveRegimenContratacion.ToEntero() = 2 AndAlso ((ObjOtrosPagos.FirstOrDefault(Function(m) m.TipoOtroPago.ToEntero().Contiene(2, 7, 8))) Is Nothing) Then
ObjOtrosPagos.Add(New CFDINominaOtrosPagos With {.TipoOtroPago = "002", ' codigo fijo, por ser referente a subsidio al empleo
.Clave = "D051", .Concepto = "Subs al Empleo acreditado", .Importe = 0D, .Subsidiocausado = 0D})
@@ -361,9 +433,9 @@ Public Class LogicNominas
cfdi.Nomina.Receptor.NSS = NumeroSS
cfdi.Nomina.Receptor.FechaInicioContrato = FechaInicioContrato
cfdi.Nomina.Receptor.Antiguedad = $"P{AntiguedadSemanas}W"
cfdi.Nomina.Receptor.TipoContrato = CodigoTipoContrato
cfdi.Nomina.Receptor.TipoContrato = If(TimbreIndemnizacion, "99", CodigoTipoContrato)
cfdi.Nomina.Receptor.CodigoTipoJornada = ClaveTipoJornada
cfdi.Nomina.Receptor.CodigoRegimenContratacion = CveRegimenContratacion
cfdi.Nomina.Receptor.CodigoRegimenContratacion = If(TimbreIndemnizacion, "13", CveRegimenContratacion)
cfdi.Nomina.Receptor.CodigoEmpleado = Codigo
cfdi.Nomina.Receptor.Departamento = Departamento
cfdi.Nomina.Receptor.Puesto = Puesto

View File

@@ -1453,6 +1453,27 @@ Namespace Modelos
factura.CvePrePoliza = ObjConta.AddPrePolizas("Modelos/GuardarVentaM", factura.CvePlantillaPoliza, factura.TotalTC, factura.TotalTC, factura.CveMoneda, factura.Fecha, If(factura.CveEmpresaCRM > 0, factura.EmpresaCRM, factura.Cliente.Nombre), factura.CveUsuario, factura.CveEmpresa)
Dim RFCReceptor As String = ""
If factura.Timbre IsNot Nothing AndAlso factura.Timbre.Receptor IsNot Nothing Then
If Not String.IsNullOrEmpty(factura.Timbre.Receptor.RFC) Then
RFCReceptor = factura.Timbre.Receptor.RFC.Trim
End If
End If
'SI NO SE VA TIMBRAR TOMA EL DEL CLIENTE
If String.IsNullOrEmpty(RFCReceptor) Then
If Not String.IsNullOrEmpty(factura.Cliente.RFC) Then
RFCReceptor = factura.Cliente.RFC
End If
If factura.FacturarSucursal Then
If factura.ClienteSucursal IsNot Nothing Then
RFCReceptor = factura.ClienteSucursal.RFC
End If
End If
End If
If Not ObjVentas.AddVenta(factura.TipoDocto, factura.Folio, factura.CveCliente, factura.CveClienteSucursal, factura.SubTotalTC, factura.DescuentoTC,
factura.AmortizacionTC, factura.IVATC, factura.RetIVATC, factura.RetISRTC,
factura.TotalTC, factura.CveMoneda, factura.TipoCambio, factura.CveMetodoPago, factura.CondicionesPago, factura.FormaPago, factura.FechaPago, factura.Fecha, factura.MotivoDescuento,
@@ -1467,7 +1488,7 @@ Namespace Modelos
PedidoContrato:=factura.PedidoContrato, ObservacionesAlmacen:=factura.ObservacionesAlmacen, CveSubProyecto:=factura.CveSubProyecto, CveSubProyectoCobranza:=factura.CveSubProyectoCobranza, CveSubProyectoEjecucion:=factura.CveSubProyectoEjecucion, CveFormaPago33:=factura.CveFormaPago33,
CveMetodoPago33:=factura.CveMetodoPago33, CveUsoCFDI:=factura.CveUsoCFDI, OrdenCompra:=factura.OrdenCompra, CveCuentaTerminal:=factura.CveCuentaTerminal, CveTipoRelacion:=factura.CveTipoRelacion, ImpuestoLocal:=TotalImpuestoLocal,
CveVentaRelacion:=(If(factura.CveVentaRelacion.ToEntero > 0, factura.CveVentaRelacion, -1)), ImporteRelacion:=(If(factura.ImporteRelacion <> Nothing, factura.ImporteRelacion, -1)),
CveTipoAmortizacionAnticipo:=factura.CveTipoAmortizacionAnticipo, CveEmpresaCRM:=CveEmpresaCRM, EsInterno:=EsInterno, ServicioDomicilio:=factura.ServicioDomicilio) Then
CveTipoAmortizacionAnticipo:=factura.CveTipoAmortizacionAnticipo, CveEmpresaCRM:=CveEmpresaCRM, EsInterno:=EsInterno, ServicioDomicilio:=factura.ServicioDomicilio, RFCReceptor:=RFCReceptor) Then
ErrorList.Add("Ocurrió un error al Generar la Venta.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
@@ -1482,6 +1503,16 @@ Namespace Modelos
factura.Timbre.Comprobante.Serie = ObjVentas.Serie
factura.Timbre.Comprobante.Folio = ObjVentas.Folio.ToString
If factura.TipoDocto.Contiene("Dev", "Egs") OrElse DtVentasRelacionadas IsNot Nothing Then
For Each row As DataRow In DtVentasRelacionadas.Rows
If row("CveVenta").ToString().ToEntero() > 0 Then
If Not ObjVentas.AddVentasRelacionadas(factura.CveVenta, row("CveVenta").ToString().ToEntero()) Then
ErrorList.Add("Ocurrió un error al relacionar las ventas entre si comuníquese a Soporte Técnico")
End If
End If
Next
End If
If factura.TipoDocto = "Egs" AndAlso NuevaFactura = 1 Then
If DtVentasNC Is Nothing Then
InicializaDTVentasNC()
@@ -4987,6 +5018,8 @@ Namespace Modelos
Dim TieneSalida As Boolean = False
Dim DtInventario As DataTable = Nothing
Dim DtSalidas As DataTable = Nothing
Dim DtVirtuales As DataTable = Nothing
Dim DtDevPrevias As DataTable = Nothing
Dim DtDevoluciones As DataTable = Nothing
Dim DtExistencias As DataTable = Nothing
Dim DtRemisionesFacturadas As DataTable = Nothing
@@ -5002,8 +5035,12 @@ Namespace Modelos
If Not ErrorCancelar Then
Dim Filtro As String = ""
Dim FiltroDevAlmacen As String = ""
Select Case ObjFactura.TipoDocto
Case "Ing", "Ped"
Case "Ing"
Filtro = "CveConcepto IN (3, 40)"
FiltroDevAlmacen = "CveConcepto IN (18, 41)"
Case "Ped"
Filtro = "CveConcepto IN (3, 40)"
Case "Dev"
Filtro = "CveConcepto = 18"
@@ -5022,6 +5059,15 @@ Namespace Modelos
If ObjInventario.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then
DtInventario = ObjInventario.DtResultados.Copy()
DtSalidas = DtInventario.FiltraParametros($"CvePS IS NULL AND {Filtro}")
If UsuarioActual.Empresa.Funcionalidad(573) = "1" Then
DtVirtuales = DtInventario.FiltraParametros($"CvePS IS NULL AND CveConcepto = 37 AND CveTipoAlmacen = 24")
End If
If ObjFactura.TipoDocto = "Ing" Then
DtDevPrevias = DtInventario.FiltraParametros($"CvePS IS NULL AND {FiltroDevAlmacen}")
End If
DtExistencias = DtInventario.FiltraParametros($"CvePS IS NOT NULL AND {Filtro} AND CveTipoPS = 2")
TieneSalida = DtExistencias.Rows.Count > 0
Else
@@ -5183,6 +5229,22 @@ Namespace Modelos
End If
End If
End If
'AGREGA BITACORA A VENTA
If Not ErrorCancelar AndAlso RealizarDevolucionAlmacen AndAlso CveMovimientoDevolucion > 0 Then
Dim MensajeBitacora = "Devuelta"
If Not ObjEventos.AddEventoBitacora(String.Format("Venta {2} en Folio: <a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a>", CveMovimientoDevolucion, Folio, MensajeBitacora), "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta) Then
MensajeError = "Ocurrió un error al agregar la bitacora."
ErrorCancelar = True
End If
End If
Else
'SI EXISTE UNA DEVOLUCION PREVIAMENTE HECHA UTILIZAR COMO REFERENCIA
If DtDevPrevias IsNot Nothing AndAlso DtDevPrevias.Rows.Count > 0 Then
CveMovimientoDevolucion = DtDevPrevias.FiltroPrimeroValor("CveMovimiento", $"CveConcepto = {CveConceptoMovimiento}").ToEntero()
End If
End If
@@ -5195,20 +5257,14 @@ Namespace Modelos
End If
End If
'REALIZA LA DEVOLUCION AL ALMACEN VIRTUAL
If Not ErrorCancelar AndAlso Not GeneraMovimientosVirtuales(CveVenta, CveMovimientoDevolucion, RowMovimiento("CveMovimiento").ToString().ToEntero(), ObjInventario) Then
ErrorCancelar = True
MensajeError = "Ocurrió un error al cargar los datos de devolución. Por favor vuelva a intentar."
End If
'AGREGA BITACORA A VENTA
If Not ErrorCancelar AndAlso RealizarDevolucionAlmacen AndAlso CveMovimientoDevolucion > 0 Then
Dim MensajeBitacora = "Devuelta"
If Not ObjEventos.AddEventoBitacora(String.Format("Venta {2} en Folio: <a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a>", CveMovimientoDevolucion, Folio, MensajeBitacora), "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVenta) Then
MensajeError = "Ocurrió un error al agregar la bitacora."
ErrorCancelar = True
End If
If DtVirtuales IsNot Nothing Then
For Each RowVirtual As DataRow In DtVirtuales.Rows
'REALIZA LA DEVOLUCION AL ALMACEN VIRTUAL
If Not ErrorCancelar AndAlso Not GeneraMovimientosVirtuales(CveVenta, CveMovimientoDevolucion, RowVirtual("CveMovimiento").ToString().ToEntero(), ObjInventario) Then
ErrorCancelar = True
MensajeError = "Ocurrió un error al cargar los datos de devolución. Por favor vuelva a intentar."
End If
Next
End If
If ErrorCancelar Then
@@ -5217,6 +5273,7 @@ Namespace Modelos
Next
'SI EXISTEN HAY EXISTENCIA EN (ENTREGA POR ADELANTADO) SE TIENE QUE REGRESAR AL ALMACEN ORGINAL (GENERAL,SIN COSTO)
If Not ErrorCancelar AndAlso ListaRemisionesCancelar IsNot Nothing AndAlso ListaRemisionesCancelar.Count > 0 Then
@@ -5502,10 +5559,10 @@ Namespace Modelos
Dim ValidaVirtual = True
Dim DtPSVirtual As New DataTable("DtTamanios")
Dim tCveAlmacen As Integer = -1
Dim CveAlmacenVirtual As Integer = -1
If ObjInventario.GetMovimientos(CveMovimiento, -1, -1, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
tCveAlmacen = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen").ToEntero()
If ObjInventario.GetMovimientos(CveMovimientoRelacionado, -1, -1, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
CveAlmacenVirtual = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen").ToEntero()
End If
If ObjInventario.GetMovimientosDetalleVirtual(CveMovimiento, UsuarioActual.CveEmpresa, CveMovimientoRelacionado:=CveMovimientoRelacionado) Then
@@ -5513,11 +5570,8 @@ Namespace Modelos
End If
Dim CveConceptoMovimientoVirtual As Integer = 36
Dim CveAlmacenVirtual As Integer = -1
Dim CveMovimientoRelacionadoVirtual As Integer = CveMovimiento
CveAlmacenVirtual = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=tCveAlmacen).FiltroPrimeroValor("CveAlmacenVirtual").ToEntero()
If DtPSVirtual IsNot Nothing AndAlso DtPSVirtual.Rows.Count > 0 AndAlso CveAlmacenVirtual > 0 AndAlso CveConceptoMovimientoVirtual > 0 Then
CveMovimientoVirtual = ObjInventario.AddMovimiento(CveAlmacenVirtual, CveConceptoMovimientoVirtual, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, -1, -1,
Observaciones:="", Guia:="", CveMovimientoRelacionado:=CveMovimientoRelacionadoVirtual, Modulo:="Modelos/CancelarVirtual")
@@ -6059,6 +6113,7 @@ Namespace Modelos
#Region "P R O P I E D A D E S"
Public Property RFCReceptor As String = ""
Public Property ServicioDomicilio As Boolean
Public Property CveEstatusRefacturacion As Integer = 0
Public Property NuevaFactura As Integer
@@ -6139,6 +6194,7 @@ Namespace Modelos
Public Property DtRecepcionUsados As Data.DataTable
Public Property DtPolizasVirtuales As Data.DataTable
Public Property DtVentasNC As Data.DataTable
Public Property DtVentasRelacionadas As Data.DataTable
Public Property DtDeduccion As Data.DataTable
Public Property DtFirmas As Data.DataTable
Public Property DtDesgloseImpuestos As Data.DataTable

View File

@@ -3,9 +3,12 @@ Option Strict On
Imports Extensiones
Imports System.IO
Imports System.Linq
Imports Newtonsoft.Json.Linq
Imports System.Net.Http
Imports System.Xml
Imports System.Data
Imports System.Xml.Serialization
Public Class Timbrado
#Region "P R O P I E D A D E S"
@@ -2021,57 +2024,66 @@ Public Class Timbrado
End If
#End Region
If ObjCFDITimbre.Nomina IsNot Nothing Then
'If cfdi.Nomina12SeparacionIndemnizacion Then
If ObjCFDITimbre.Nomina.Percepciones IsNot Nothing AndAlso ObjCFDITimbre.Nomina.Percepciones.Count > 0 Then
cfdi.Nomina12Percepciones(ObjCFDITimbre.Nomina.TotalSueldos, ObjCFDITimbre.Nomina.TotalIndemnizacion, ObjCFDITimbre.Nomina.TotalJubilacion, ObjCFDITimbre.Nomina.TotalPercepcionesGravado, ObjCFDITimbre.Nomina.TotalPercepcionesExento)
For Each percep As CFDINominaPercepciones In ObjCFDITimbre.Nomina.Percepciones
cfdi.Nomina12Percepcion(percep.TipoPercepcion, percep.Clave, percep.Concepto, Math.Round(percep.ImporteGravado, 2), Math.Round(percep.ImporteExento, 2))
If percep.TipoPercepcion.ToEntero() = 19 Then
cfdi.Nomina12Percepciones(ObjCFDITimbre.Nomina.TotalSueldos, ObjCFDITimbre.Nomina.TotalIndemnizacion, ObjCFDITimbre.Nomina.TotalJubilacion, ObjCFDITimbre.Nomina.TotalPercepcionesGravado, ObjCFDITimbre.Nomina.TotalPercepcionesExento)
For Each percep As CFDINominaPercepciones In ObjCFDITimbre.Nomina.Percepciones
cfdi.Nomina12Percepcion(percep.TipoPercepcion, percep.Clave, percep.Concepto, Math.Round(percep.ImporteGravado, 2), Math.Round(percep.ImporteExento, 2))
If percep.TipoPercepcion.ToEntero() = 19 Then
If ObjCFDITimbre.Nomina.HorasExtras IsNot Nothing AndAlso ObjCFDITimbre.Nomina.HorasExtras.Count > 0 Then
For Each HoraExtra As CFDINominaHorasExtras In ObjCFDITimbre.Nomina.HorasExtras
cfdi.Nomina12HorasExtra(HoraExtra.Dias.ToEntero, HoraExtra.TipoHoras, HoraExtra.HorasExtra, HoraExtra.ImportePagado)
Next
End If
End If
Next
End If
'deducciones al final
If ObjCFDITimbre.Nomina.Deducciones IsNot Nothing AndAlso ObjCFDITimbre.Nomina.Deducciones.Count > 0 Then
cfdi.Nomina12Deducciones(ObjCFDITimbre.Nomina.TotalDeduccionesOtras, Math.Round(ObjCFDITimbre.Nomina.TotalDeduccionesImpuestosRetenidos, 2))
For Each deduc As CFDINominaDeducciones In ObjCFDITimbre.Nomina.Deducciones
cfdi.Nomina12Deduccion(deduc.TipoDeduccion, deduc.Clave, deduc.Concepto, Math.Round(deduc.Importe, 2))
Next
End If
If ObjCFDITimbre.Nomina.OtrosPagos IsNot Nothing Then
' cfdi.agregarNominaOtrosPagosOtroPago12("002", "002", "Subsidio", "10.00");
' cfdi.agregarNominaOtrosPagosOtroPagoSubsidioAlEmpleo12("10.00");
If ObjCFDITimbre.Nomina.OtrosPagos IsNot Nothing AndAlso ObjCFDITimbre.Nomina.OtrosPagos.Count > 0 Then
For Each otpag As CFDINominaOtrosPagos In ObjCFDITimbre.Nomina.OtrosPagos
cfdi.Nomina12OtroPago(otpag.TipoOtroPago, otpag.Clave, otpag.Concepto, otpag.Importe)
If otpag.TipoOtroPago = "002" Then
cfdi.Nomina12SubsidioAlEmpleo(otpag.Subsidiocausado)
End If
If otpag.TipoOtroPago = "004" AndAlso otpag.Importe > 0 Then
If otpag.ejercicio > 0 Then
cfdi.CompensacionSaldosAFavor(otpag.SaldoAFavor, otpag.ejercicio, otpag.RemanenteSalFav) 'otpag.SaldoAFavor
If ObjCFDITimbre.Nomina.HorasExtras IsNot Nothing AndAlso ObjCFDITimbre.Nomina.HorasExtras.Count > 0 Then
For Each HoraExtra As CFDINominaHorasExtras In ObjCFDITimbre.Nomina.HorasExtras
cfdi.Nomina12HorasExtra(HoraExtra.Dias.ToEntero, HoraExtra.TipoHoras, HoraExtra.HorasExtra, HoraExtra.ImportePagado)
Next
End If
End If
Next
End If
If ObjCFDITimbre.IStimbreFiniquito Then
'ObjCFDITimbre.Nomina.
Dim UltimoSueldoOrdinario As Double = ObjCFDITimbre.Nomina.UltimoSueldoOrdinario.ToString().ToDouble()
Dim TotalIndemnizacion As Double = ObjCFDITimbre.Nomina.TotalIndemnizacion
Dim t1 As Double = If(UltimoSueldoOrdinario < TotalIndemnizacion, UltimoSueldoOrdinario, TotalIndemnizacion)
Dim t2 As Double = If(UltimoSueldoOrdinario < TotalIndemnizacion, TotalIndemnizacion, UltimoSueldoOrdinario)
cfdi.Nomina12SeparacionIndemnizacion(TotalIndemnizacion, ObjCFDITimbre.Nomina.Antiguedad, UltimoSueldoOrdinario, t1, t2 - t1)
End If
'deducciones al final
If ObjCFDITimbre.Nomina.Deducciones IsNot Nothing AndAlso ObjCFDITimbre.Nomina.Deducciones.Count > 0 Then
cfdi.Nomina12Deducciones(ObjCFDITimbre.Nomina.TotalDeduccionesOtras, Math.Round(ObjCFDITimbre.Nomina.TotalDeduccionesImpuestosRetenidos, 2))
For Each deduc As CFDINominaDeducciones In ObjCFDITimbre.Nomina.Deducciones
cfdi.Nomina12Deduccion(deduc.TipoDeduccion, deduc.Clave, deduc.Concepto, Math.Round(deduc.Importe, 2))
Next
End If
If ObjCFDITimbre.Nomina.OtrosPagos IsNot Nothing Then
' cfdi.agregarNominaOtrosPagosOtroPago12("002", "002", "Subsidio", "10.00");
' cfdi.agregarNominaOtrosPagosOtroPagoSubsidioAlEmpleo12("10.00");
If ObjCFDITimbre.Nomina.OtrosPagos IsNot Nothing AndAlso ObjCFDITimbre.Nomina.OtrosPagos.Count > 0 Then
For Each otpag As CFDINominaOtrosPagos In ObjCFDITimbre.Nomina.OtrosPagos
cfdi.Nomina12OtroPago(otpag.TipoOtroPago, otpag.Clave, otpag.Concepto, otpag.Importe)
If otpag.TipoOtroPago = "002" Then
cfdi.Nomina12SubsidioAlEmpleo(otpag.Subsidiocausado)
End If
If otpag.TipoOtroPago = "004" AndAlso otpag.Importe > 0 Then
If otpag.ejercicio > 0 Then
cfdi.CompensacionSaldosAFavor(otpag.SaldoAFavor, otpag.ejercicio, otpag.RemanenteSalFav) 'otpag.SaldoAFavor
End If
End If
Next
End If
End If
If ObjCFDITimbre.Nomina.Incapacidades IsNot Nothing AndAlso ObjCFDITimbre.Nomina.Incapacidades.Count > 0 Then
For Each Incap As CFDINominaIncapacidades In ObjCFDITimbre.Nomina.Incapacidades
cfdi.Nomina12Incapacidad(Incap.DiasIncapacidad.ToEntero, Incap.TipoIncapacidad, Incap.Importe)
Next
End If
End If
If ObjCFDITimbre.Nomina.Incapacidades IsNot Nothing AndAlso ObjCFDITimbre.Nomina.Incapacidades.Count > 0 Then
For Each Incap As CFDINominaIncapacidades In ObjCFDITimbre.Nomina.Incapacidades
cfdi.Nomina12Incapacidad(Incap.DiasIncapacidad.ToEntero, Incap.TipoIncapacidad, Incap.Importe)
Next
End If
End If
#End Region
sw.Stop()
sw.Stop()
swTiempo.AppendFormat("Armado: ({0}) {1} ", sw.ElapsedMilliseconds - swmili, sw.ElapsedMilliseconds)
swmili = sw.ElapsedMilliseconds
sw.Start()
@@ -2150,7 +2162,7 @@ Public Class Timbrado
If ObjCFDITimbre.Comprobante.TipoComprobante = "N" Then
Using ObjNomina2 As New ClsNominas()
If ObjNomina2.UpdateEstatusNomNominas(3, CvePACEspecial, FolioFiscal, "", ("01/01/2000").ToDate, ObjCFDITimbre.Nomina.CveNomina, 0, 0, 0, 0, 0) Then
If ObjNomina2.UpdateEstatusNomNominas(3, CvePACEspecial, FolioFiscal, "", ("01/01/2000").ToDate, ObjCFDITimbre.Nomina.CveNomina, 0, 0, 0, 0, 0, isFiniquito:=Ventas.Timbre.IStimbreFiniquito) Then
Retorno = ""
Else
Retorno = "Error"
@@ -2213,41 +2225,26 @@ Public Class Timbrado
' 'Sucursal matriz de la empresa
Dim ArchivoLLave As String = String.Format("{0}Certificados\{1}", UsuarioActual.Empresa.Ruta, UsuarioActual.Empresa.ArchivoKey)
Dim ArchivoCertificado As String = String.Format("{0}Certificados\{1}", UsuarioActual.Empresa.Ruta, UsuarioActual.Empresa.ArchivoCer)
Dim UsuarioServicio As String = If(CvePACEspecial = 2, UsuarioActual.Empresa.RFC, "rene.molina@adsistemas.mx")
Dim ClaveServicio As String = If(CvePACEspecial = 2, UsuarioActual.Empresa.RFC.ToLower, "rene2018")
Dim UsuarioServicio As String = "rene.molina@adssistemas.mx"
Dim ClaveServicio As String = "Facturacion2021#"
Dim Clave As String = UsuarioActual.Empresa.ContraseñaKey
Dim EmisorRFC As String = UsuarioActual.Empresa.RFC
Dim UrlServicio As String = "" ' Produccion
Dim RutaArchivo As String = String.Format("{0}XML\{1}\", UsuarioActual.Empresa.Ruta, Ventas.TipoDocto)
Dim NombreArchivoXML As String = ObjCFDITimbre.Comprobante.SerieFolio
Dim SubTotal As Decimal = 0
Dim TimbraProduccion As Boolean = True
If Not Directory.Exists(RutaArchivo) Then Directory.CreateDirectory(RutaArchivo)
Select Case CvePACEspecial
Case 2
UrlServicio = "http://generacfdi.com.mx/rvltimbrado/service1.asmx?WSDL" 'productivo
Case 4
'UrlServicio = "http://juancalderon-001-site1.ftempurl.com/timbrado.asmx?WSDL"
UrlServicio = "http://alterno.gofac.com.mx/cfdi/timbrado.asmx?WSDL" ' alterno
End Select
If Not UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa = 1 Then
EmisorRFC = "AAA010101AAA"
ArchivoLLave = $"{UsuarioActual.Empresa.Ruta}Certificados\CSD01_AAA010101AAA.key"
ArchivoCertificado = $"{UsuarioActual.Empresa.Ruta}Certificados\CSD01_AAA010101AAA.cer"
EmisorRFC = "ZUÑ920208KL4"
ArchivoLLave = $"{UsuarioActual.Empresa.Ruta}Certificados\CSD01_ZUÑ920208KL4.key"
ArchivoCertificado = $"{UsuarioActual.Empresa.Ruta}Certificados\CSD01_ZUÑ920208KL4.cer"
Clave = "12345678a"
TimbraProduccion = False
Select Case CvePACEspecial
Case 2
UsuarioServicio = "fgomez"
ClaveServicio = "12121212"
UrlServicio = "http://generacfdi.com.mx/rvltimbrado/service1.asmx?WSDL" '"http://108.60.211.43/rvltimbrado/service1.asmx"
Case 4
UsuarioServicio = "UserTest"
ClaveServicio = "1234567890"
UrlServicio = "http://juancalderon-001-site1.ftempurl.com/timbrado.asmx?WSDL"
End Select
End If
#Region "Valida"
@@ -2294,19 +2291,15 @@ Public Class Timbrado
End Try
#End Region
sw.Stop()
swTiempo.AppendFormat("Verificado : ({0}) {1} ", sw.ElapsedMilliseconds - swmili, sw.ElapsedMilliseconds)
swmili = sw.ElapsedMilliseconds
sw.Start()
' cfdi.saltarValidacion("bNtMuvZockPVhEjaPj0E")
' cfdi.Decimales = 4
#Region "Certificado"
cfdi.CertificadoArchivo(ArchivoCertificado)
#End Region
sw.Stop()
swTiempo.AppendFormat("Certificado : ({0}) {1} ", sw.ElapsedMilliseconds - swmili, sw.ElapsedMilliseconds)
swmili = sw.ElapsedMilliseconds
@@ -2379,6 +2372,7 @@ Public Class Timbrado
cfdi.Impuestos(ObjCFDITimbre.TotalImpuestosRetenidos, ObjCFDITimbre.TotalImpuestosTrasladados)
End If
#End Region
#Region " Traslados y Retenciones"
@@ -2582,8 +2576,6 @@ Public Class Timbrado
End If
#End Region
#Region "Nomina12"
If ObjCFDITimbre.Comprobante.TipoComprobante = "N" Then
@@ -2676,7 +2668,7 @@ Public Class Timbrado
Dim ArchivoGenerado As Boolean = False
Try
cfdi.GenerarXMLB64(llaveBase64, Clave)
ArchivoGenerado = True
If cfdi.Xml <> "" Then ArchivoGenerado = True
Catch ex As Exception
Retorno = cfdi.MensajeError
If Retorno = "" OrElse IsNothing(Retorno) Then
@@ -2694,111 +2686,131 @@ Public Class Timbrado
#Region "Timbra"
If ArchivoGenerado Then
Dim opciones As String() = New String(0) {"CALCULAR_SELLO"}
Dim pade = New PADE33.PadeTimbradoServiceClient
Dim Respuesta As String = pade.timbradoPrueba("72330711-cac6-4106-8051-cbcda1aef495", "rene.molina@adssistemas.mx", "Facturacion2021#", cfdi.Xml, opciones)
'Dim opciones As String() = New String(0) {""}
'Dim pade = New PADETimbrado.PadeTimbradoServiceClient
'Dim Respuesta As String = pade.timbradoConCSD("72330711-cac6-4106-8051-cbcda1aef495", UsuarioServicio, ClaveServicio, cfdi.Xml, certByte, llaveByte, Clave, Not TimbraProduccion, opciones)
Dim TokenAuth As String = $"{UsuarioServicio}:{ClaveServicio}".ToBase64Encode()
Dim payload As New JObject(
New JProperty("contrato", "72330711-cac6-4106-8051-cbcda1aef495"),
New JProperty("certBase64", certBase64),
New JProperty("keyBase64", llaveBase64),
New JProperty("keyPass", Clave),
New JProperty("xmlBase64", cfdi.Xml.ToBase64Encode()),
New JProperty("prueba", (Not TimbraProduccion).ToString().ToLower),
New JProperty("opciones", New String(0) {""})
)
Dim Respuesta = EnviarInformacionPADE("https://timbrado.pade.mx/servicio/rest/timbrado/timbrarConCSD", payload.ToString(), TokenAuth)
' Aumentamos el timeout de la operación
If Not String.IsNullOrEmpty(Respuesta) Then
Dim FolioFiscal As String
FolioFiscal = obtenerAtributo(Respuesta, "TimbreFiscalDigital", "UUID") 'XmlDoc.DocumentElement("cfdi:Complemento").FirstChild.Attributes("UUID").InnerText
Dim result As PADEServicioTimbradoResp = Nothing
Dim serializer As XmlSerializer = New XmlSerializer(GetType(PADEServicioTimbradoResp))
Try
Using reader As TextReader = New StringReader(Respuesta)
result = CType(serializer.Deserialize(reader), PADEServicioTimbradoResp)
End Using
Catch ex As Exception
OnError("Ocurrió un error al obtener los resultados", ex)
End Try
'cfdi.TimbrarCfdi(UsuarioServicio, ClaveServicio, UrlServicio, TimbraProduccion)
If result IsNot Nothing Then
If result.timbradoOk Then
Dim FolioFiscal As String = result.UUID
'sw.Stop()
'swTiempo.AppendFormat("Timbrado: ({0}) {1} ", sw.ElapsedMilliseconds - swmili, sw.ElapsedMilliseconds)
'swmili = sw.ElapsedMilliseconds
'sw.Start()
''Verifica el error
'If cfdi.CodigoError = 0 Then
cfdi.EscribirXML(cfdi.Xml, RutaArchivo, NombreArchivoXML)
' Dim FolioFiscal As String
If ObjCFDITimbre.Comprobante.TipoComprobante <> "P" Then
' UUID = cfdi.UUID
' FolioFiscal = cfdi.UUID 'obtenerAtributo(cfdi.XmlTimbrado, "TimbreFiscalDigital", "UUID") 'XmlDoc.DocumentElement("cfdi:Complemento").FirstChild.Attributes("UUID").InnerText
'Actualiza Estatus Factura
If Ventas.CveVenta > 0 Then
' If FolioFiscal <> "" Then
Using ObjVentas As New ClsVentas()
' cfdi.EscribirXML(cfdi.Xml, RutaArchivo, NombreArchivoXML)
If ObjVentas.UpdateEstatusFactura(3, FolioFiscal, "", ObjCFDITimbre.Comprobante.Fecha, Ventas.CveVenta, CvePAC:=CvePACEspecial, RFCReceptor:=ObjCFDITimbre.Receptor.RFC) Then
Retorno = ""
Else
Retorno = "Error"
End If
End Using
' sw.Stop()
' swTiempo.AppendFormat("Guardado: ({0}) {1} ", sw.ElapsedMilliseconds - swmili, sw.ElapsedMilliseconds)
' swmili = sw.ElapsedMilliseconds
' sw.Start()
'Genero la addenda Ford
If Ventas.Cliente.Ford_GSDB <> "" Then
' If ObjCFDITimbre.Comprobante.TipoComprobante <> "P" Then
Dim RutaCadena As String = String.Format("{0}{1}.xml", RutaArchivo, NombreArchivoXML) 'If(UsuarioActual.Empresa.FacturaProduccion, String.Format("{0}XML\{1}\{2}.xml", Ruta, Ventas.SerieFolio), String.Format("{0}XML\{1}\{2}.xml", Ruta, Ventas.TipoDocto, Ventas.SerieFolio))
' 'Actualiza Estatus Factura
' If Ventas.CveVenta > 0 Then
Dim FolioFactura As String = ""
If UsuarioActual.CveEmpresa = 8 Then FolioFactura = Ventas.Folio.ToString ' sogo, pordefault manda el folio de la factura
GeneraAddendaFord(RutaCadena, FolioFactura, Ventas.FordASN, Ventas.FordGSDB)
' Using ObjVentas As New ClsVentas()
End If
' If ObjVentas.UpdateEstatusFactura(3, FolioFiscal, "", ObjCFDITimbre.Comprobante.Fecha, Ventas.CveVenta, CvePAC:=CvePACEspecial) Then
' Retorno = ""
' Else
' Retorno = "Error"
' End If
' End Using
End If
' 'Genero la addenda Ford
' If Ventas.Cliente.Ford_GSDB <> "" Then
If ObjCFDITimbre.Comprobante.TipoComprobante = "N" Then
Using ObjNomina2 As New ClsNominas()
' Dim RutaCadena As String = String.Format("{0}{1}.xml", RutaArchivo, NombreArchivoXML) 'If(UsuarioActual.Empresa.FacturaProduccion, String.Format("{0}XML\{1}\{2}.xml", Ruta, Ventas.SerieFolio), String.Format("{0}XML\{1}\{2}.xml", Ruta, Ventas.TipoDocto, Ventas.SerieFolio))
If ObjNomina2.UpdateEstatusNomNominas(3, CvePACEspecial, FolioFiscal, "", ("01/01/2000").ToDate, ObjCFDITimbre.Nomina.CveNomina, 0, 0, 0, 0, 0) Then
Retorno = ""
Else
Retorno = "Error"
End If
End Using
End If
' Dim FolioFactura As String = ""
' If UsuarioActual.CveEmpresa = 8 Then FolioFactura = Ventas.Folio.ToString ' sogo, pordefault manda el folio de la factura
' GeneraAddendaFord(RutaCadena, FolioFactura, Ventas.FordASN, Ventas.FordGSDB)
If ObjCFDITimbre.Comprobante.TipoComprobante = "T" Then
Using ObjInv As New ClsInventarios()
If ObjInv.UpdateMovimientoTimbrado(Ventas.Inv_CveMovimiento, 1, FolioFiscal, MinFecha) Then
Retorno = ""
Else
Retorno = "Error"
End If
End Using
End If
End If
' End If
If Not IO.Directory.Exists($"{UsuarioActual.Empresa.Ruta}CBB\") Then IO.Directory.CreateDirectory($"{UsuarioActual.Empresa.Ruta}CBB\")
' End If
Try
Dim RutaCBB As String = $"{UsuarioActual.Empresa.Ruta}CBB\{ObjCFDITimbre.Comprobante.SerieFolio}.jpg"
Dim b As Byte() = cfdi.QrCode($"?re={UsuarioActual.Empresa.RFC}&rr={ObjCFDITimbre.Receptor.RFC}&tt={String.Format("{0,12:F6}", ObjCFDITimbre.Comprobante.Total).Trim()}&id={FolioFiscal}")
File.WriteAllBytes(RutaCBB, b)
Catch ex As Exception
OnError("Ocurrió un error al generar el QR", ex)
End Try
Retorno = ""
Else
If String.IsNullOrEmpty(result.mensaje) Then
Retorno = Respuesta
MensajeErrorCFDI = ""
Else
Retorno = result.mensaje
MensajeErrorCFDI = result.codigo
If cfdi.Xml <> "" Then cfdi.EscribirXML(cfdi.Xml, RutaArchivo, NombreArchivoXML)
End If
' If ObjCFDITimbre.Comprobante.TipoComprobante = "N" Then
' Using ObjNomina2 As New ClsNominas()
' If ObjNomina2.UpdateEstatusNomNominas(3, CvePACEspecial, FolioFiscal, "", ("01/01/2000").ToDate, ObjCFDITimbre.Nomina.CveNomina, 0, 0, 0, 0, 0) Then
' Retorno = ""
' Else
' Retorno = "Error"
' End If
' End Using
' End If
' If ObjCFDITimbre.Comprobante.TipoComprobante = "T" Then
' Using ObjInv As New ClsInventarios()
' If ObjInv.UpdateMovimientoTimbrado(Ventas.Inv_CveMovimiento, 1, FolioFiscal, MinFecha) Then
' Retorno = ""
' Else
' Retorno = "Error"
' End If
' End Using
' End If
' End If
' If Not IO.Directory.Exists($"{UsuarioActual.Empresa.Ruta}CBB\") Then IO.Directory.CreateDirectory($"{UsuarioActual.Empresa.Ruta}CBB\")
' Try
' Dim RutaCBB As String = $"{UsuarioActual.Empresa.Ruta}CBB\{ObjCFDITimbre.Comprobante.SerieFolio}.jpg"
' Dim b As Byte() = cfdi.QrCode($"?re={UsuarioActual.Empresa.RFC}&rr={ObjCFDITimbre.Receptor.RFC}&tt={String.Format("{0,12:F6}", ObjCFDITimbre.Comprobante.Total).Trim()}&id={FolioFiscal}")
' File.WriteAllBytes(RutaCBB, b)
' Catch ex As Exception
' OnError("Ocurrió un error al generar el QR", ex)
' End Try
' Retorno = ""
' Else
' Retorno = "No se pudo timbrar ante el SAT. UUID no generado."
' End If
' sw.Stop()
' swTiempo.AppendFormat("Actualizado: ({0}) {1} ", sw.ElapsedMilliseconds - swmili, sw.ElapsedMilliseconds)
' swmili = sw.ElapsedMilliseconds
' sw.Start()
'Else
' Retorno = cfdi.MensajeError
' MensajeErrorCFDI = cfdi.MensajeError
' If cfdi.Xml <> "" Then cfdi.EscribirXML(cfdi.Xml, RutaArchivo, NombreArchivoXML)
' End If
End If
Else
If String.IsNullOrEmpty(Respuesta) Then
Retorno = "Ocurrió un error al obtener la respuesta"
MensajeErrorCFDI = ""
Else
Retorno = Respuesta
MensajeErrorCFDI = ""
End If
End If
Else
Retorno = "Ocurrió un error al obtener la respuesta"
MensajeErrorCFDI = ""
End If
Else
Retorno = "Ocurrió un error al generar el xml"
MensajeErrorCFDI = ""
End If
#End Region
@@ -2806,6 +2818,45 @@ Public Class Timbrado
Return Retorno
End Function
Private Function EnviarInformacionPADE(url As String, payload As String, tokenAuth As String) As String
Dim Retorno As String = ""
Try
Using httpClient = New HttpClient()
httpClient.Timeout = New TimeSpan(0, 1, 0)
Using request = New HttpRequestMessage(HttpMethod.Post, New Uri(url))
request.Headers.Add("Authorization", $"Basic {tokenAuth}")
Using content = New StringContent(payload, Encoding.UTF8, "application/json")
request.Content = content
Dim response = httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead).Result
Retorno = response.Content.ReadAsStringAsync().Result
End Using
End Using
End Using
Catch ex As Exception
Retorno = ""
OnError("Ocurrió un error al enviar la informacion", ex)
End Try
Return Retorno
End Function
<Serializable(), XmlRoot("servicioTimbrado")>
Public Class PADEServicioTimbradoResp
<XmlElement("id")>
Public Property id As String
<XmlElement("timbradoOk")>
Public Property timbradoOk As Boolean
<XmlElement("contrato")>
Public Property contrato As String
<XmlElement("codigo")>
Public Property codigo As String
<XmlElement("mensaje")>
Public Property mensaje As String
<XmlElement("UUID")>
Public Property UUID As String
End Class
Public Sub GuardaLogTimbrado(Str As String, CvePAC As Integer)
Dim ArchivoW As StreamWriter
Dim strLineaTMP As String

View File

@@ -2805,6 +2805,18 @@ Namespace Extensiones
Return img
End Function
<Runtime.CompilerServices.Extension()>
Public Function ToBase64Encode(ByVal plainText As String) As String
Dim plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText)
Return System.Convert.ToBase64String(plainTextBytes)
End Function
<Runtime.CompilerServices.Extension()>
Public Function ToBase64Decode(ByVal base64EncodedData As String) As String
Dim base64EncodedBytes = System.Convert.FromBase64String(base64EncodedData)
Return System.Text.Encoding.UTF8.GetString(base64EncodedBytes)
End Function
Public Function DecriptaConexion() As String
Dim Salida As String
Dim stringtodecrypt As String = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString

View File

@@ -57,12 +57,77 @@ Public Class SIGPolizaVirtual : Implements IHttpHandler, IRequiresSessionState
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
context.Response.ContentType = "application/json"
Dim usuario = ValidaUsuarioSistema(140, 100)
Dim ObjFactura As New Modelos.Factura(usuario, 898028, 140)
GeneraPolizaVentaWS(context, ObjFactura)
'GeneraPolizaVentaLTHWSD(context)
'GeneraIndicadores(context)
Dim UsuarioActual = ValidaUsuarioSistema(1, 100)
'Dim ObjFactura As New Modelos.Factura(usuario, 898028, 140)
Dim UsuarioServicio As String = "rene.molina@adssistemas.mx"
Dim ClaveServicio As String = "Facturacion2021#"
Dim RutaArchivo As String = String.Format("{0}XML\{1}\", UsuarioActual.Empresa.Ruta, "Ing")
Dim NombreArchivoXML As String = "test"
If Not Directory.Exists(RutaArchivo) Then Directory.CreateDirectory(RutaArchivo)
Dim EmisorRFC As String = "ZUÑ920208KL4"
Dim ArchivoLLave As String = $"{UsuarioActual.Empresa.Ruta}Certificados\CSD01_ZUÑ920208KL4.key"
Dim ArchivoCertificado As String = $"{UsuarioActual.Empresa.Ruta}Certificados\CSD01_ZUÑ920208KL4.cer"
Dim Clave = "12345678a"
Dim TimbraProduccion = False
If Not File.Exists(ArchivoCertificado) Then
context.Response.Write("El archivo de llave privada no existe")
Exit Sub
End If
If Not File.Exists(ArchivoLLave) Then
context.Response.Write("El archivo de llave privada no existe")
Exit Sub
End If
If UsuarioActual.Empresa.ContraseñaKey = "" Then
context.Response.Write("La clave no puede ser vacía")
Exit Sub
End If
Dim llaveByte As Byte(), certByte As Byte()
Dim llaveBase64 As String = "", certBase64 As String = ""
Dim cfdi As New GoFac.GoCfdi()
Dim complemento As String = ""
Dim complementoConcepto As String = ""
Try
llaveByte = System.IO.File.ReadAllBytes(ArchivoLLave)
llaveBase64 = Convert.ToBase64String(llaveByte)
Catch ex As Exception
context.Response.Write($"Error al leer la llave privada: {ex.Message}")
Exit Sub
End Try
Try
certByte = System.IO.File.ReadAllBytes(ArchivoCertificado)
certBase64 = Convert.ToBase64String(certByte)
Catch ex As Exception
context.Response.Write($"Error al leer el certificado: {ex.Message}")
Exit Sub
End Try
Dim TokenAuth As String = ToBase64Encode($"{UsuarioServicio}:{ClaveServicio}")
Dim XmlBase64 As String = ToBase64Encode(XMLPrueba)
Dim payload As New JObject(
New JProperty("contrato", "72330711-cac6-4106-8051-cbcda1aef495"),
New JProperty("certBase64", certBase64),
New JProperty("keyBase64", llaveBase64),
New JProperty("keyPass", Clave),
New JProperty("xmlBase64", XmlBase64),
New JProperty("prueba", (Not TimbraProduccion).ToString().ToLower),
New JProperty("opciones", New String(0) {""})
)
Dim resp = EnviarInformacionPADE("https://timbrado.pade.mx/servicio/rest/timbrado/timbrarConCSD", payload.ToString(), TokenAuth)
context.Response.Write(resp)
End Sub
@@ -72,6 +137,44 @@ Public Class SIGPolizaVirtual : Implements IHttpHandler, IRequiresSessionState
End Get
End Property
Private Function EnviarInformacionPADE(url As String, payload As String, tokenAuth As String) As String
Dim Retorno As String = "{}"
Try
Using httpClient = New HttpClient()
httpClient.Timeout = New TimeSpan(0, 5, 0)
Using request = New HttpRequestMessage(HttpMethod.Post, New Uri(url))
request.Headers.Add("Authorization", $"Basic {tokenAuth}")
Using content = New StringContent(payload, Encoding.UTF8, "application/json")
request.Content = content
Dim response = httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead).Result
Retorno = response.Content.ReadAsStringAsync().Result
End Using
End Using
End Using
Catch ex As Exception
OnError("Ocurrió un error al enviar la informacion", ex)
End Try
Return Retorno
End Function
Public Function ToBase64Encode(ByVal plainText As String) As String
Dim plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText)
Return System.Convert.ToBase64String(plainTextBytes)
End Function
Public Function ToBase64Decode(ByVal base64EncodedData As String) As String
Dim base64EncodedBytes = System.Convert.FromBase64String(base64EncodedData)
Return System.Text.Encoding.UTF8.GetString(base64EncodedBytes)
End Function
Public Property XMLPrueba As String = "<?xml version=""1.0"" encoding=""UTF-8""?><cfdi:Comprobante xmlns:cfdi=""http://www.sat.gob.mx/cfd/3"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xsi:schemaLocation=""http://www.sat.gob.mx/cfd/3 http://www.sat.gob.mx/sitio_internet/cfd/3/cfdv33.xsd"" Version=""3.3"" Serie=""HM"" Folio=""1682"" Fecha=""2021-05-20T17:43:32"" Sello=""BdE1N3CwiqU6KKOWT80N6X/9kELGK22bRmfHfXHUaYvOCmOixuAN3a0yyd5Yzf4lD0sVs+OScZ1rgNKhWWyRwAJzw/avfGod2l7LIGbyYLGoUHUPpY3swDgTk+zq29PUbf3500YPf4qkXx3GcKYkIb4TnQPnvFnjE8FvcV+p8wETuvijm5T3HzFKCXG6ePrERIt2PN1NM26p2NIOzMSUksSNUtC6rqEI8G2yIUIMZqQ4bHTo1WdV0UPKBaqjkPLyY8Q1TMFZDbiudE454bUJWjxv6KYicXgfH17HJY91XTncCgwwrwlcPrKK7ea/xPzYumHMurEl5arjfqE6+nI3Fw=="" FormaPago=""01"" NoCertificado=""30001000000400002442"" Certificado=""MIIFuzCCA6OgAwIBAgIUMzAwMDEwMDAwMDA0MDAwMDI0NDIwDQYJKoZIhvcNAQELBQAwggErMQ8wDQYDVQQDDAZBQyBVQVQxLjAsBgNVBAoMJVNFUlZJQ0lPIERFIEFETUlOSVNUUkFDSU9OIFRSSUJVVEFSSUExGjAYBgNVBAsMEVNBVC1JRVMgQXV0aG9yaXR5MSgwJgYJKoZIhvcNAQkBFhlvc2Nhci5tYXJ0aW5lekBzYXQuZ29iLm14MR0wGwYDVQQJDBQzcmEgY2VycmFkYSBkZSBjYWRpejEOMAwGA1UEEQwFMDYzNzAxCzAJBgNVBAYTAk1YMRkwFwYDVQQIDBBDSVVEQUQgREUgTUVYSUNPMREwDwYDVQQHDAhDT1lPQUNBTjERMA8GA1UELRMIMi41LjQuNDUxJTAjBgkqhkiG9w0BCQITFnJlc3BvbnNhYmxlOiBBQ0RNQS1TQVQwHhcNMTkwNjE3MjAxODA2WhcNMjMwNjE3MjAxODA2WjCB4jEnMCUGA1UEAxQeWkFQQVRFUklBIFVSVEFETyDRRVJJIFNBIERFIENWMScwJQYDVQQpFB5aQVBBVEVSSUEgVVJUQURPINFFUkkgU0EgREUgQ1YxJzAlBgNVBAoUHlpBUEFURVJJQSBVUlRBRE8g0UVSSSBTQSBERSBDVjElMCMGA1UELRQcWlXROTIwMjA4S0w0IC8gS0FITzY0MTEwMUIzOTEeMBwGA1UEBRMVIC8gS0FITzY0MTEwMUhOVExLUzA2MR4wHAYDVQQLFBVaYXBhdGVy7WEgVXJ0YWRvINFlcmkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCX4ICuLAA/GYfEdRUMBLolOHKOUTDyw//CQjcj6dmCUWP8Y2UIhbq1JJ5nClsmhg6WThXjYqzRiYSAYagzrtwWri8I7oURIoTDeuxU69UOg1shuCEo89prJfx8ZIGKwB+GedC6dFdKGZLKn4ksSuyfntXmW4rZLup2j24mQx+jpdmcQIGMe6A/2668ZhpYpCw/vwfH8edkS5X41yp/zj6Z9mIySRWaMHm5eT/X0D01l3gX2gJVXY5ebUsKIEmDCP5pmBmyFyJjqYUhYi3+nYARrVPdZ53RPigcoLspXyIBVf2CPansqOYiRIqxLjfsL6B1qGJmpFN1RHd+XF9GzkHzAgMBAAGjHTAbMAwGA1UdEwEB/wQCMAAwCwYDVR0PBAQDAgbAMA0GCSqGSIb3DQEBCwUAA4ICAQAw5nqLkVuaTWX/qnPqWpOlSfrfVF2plqAPu1sdgzU/vZGgZCLxq3cY3Dg02khdsM74A3fYFQGxFFo6zDt5Ru9VySBks2gmbebRuuYKAKHMoi0tNpvI2arOMaiJsq2yzGAox6e+MXhhQ1oV+28HaxjYIWuVSwWAzie+n6VloWXMDDxTg7t9URJ7d8E7ZrPZ2X0+7h6b8sfnOjTljUm+Mt6e6AIl1+lA7Ar4YeJgIOeU/RKSOcvrCGDNtz7kpn0XdsFC/m1xG1bIdhyv0zkRmKvtpVGROsSEHPLBwuTENIkm0Cw2/FQsPrG8S9Yer451Jv0H+heFfJXqVrHv8Azba5OkotK5IlPaHm9voxfhwI1aXHbUS+NwpTHHOeVsvzsC9LQDiLGO3MQLn7VFZebFa84CddwLWf/JTyPYIcg3I/BRDFqbrVNRRDJwVlxIgbU7ZhRIcjiRLFx6UbAd8B2fe+GHgxw/x/6Pop65ca32iGAJgojtXWdD5gZvh6PlhEhWMhIOCvAesE52L4wmIHofAIZjlPRXNaitZ74xDEIpQ9f5X0w/4ltB7OOBYYfu8z9lzCc4M2iSmtq1rvSYxnLI/nvt7D0uYrq82ZeG3kzungcS8qNjufGJeEHNeyDxMXF9rYU4KLxK8KLzA2Ldh7+3zywU/pwXhW/aTS42EViWPbffng=="" CondicionesDePago=""01 - Efectivo"" SubTotal=""100.00"" Moneda=""MXN"" TipoCambio=""1"" Total=""116.00"" TipoDeComprobante=""I"" MetodoPago=""PPD"" LugarExpedicion=""82250""><cfdi:Emisor Rfc=""ZUÑ920208KL4"" Nombre=""Empresa de DEMO"" RegimenFiscal=""601"" /><cfdi:Receptor Rfc=""VOC990129I26"" Nombre=""Cliente Demostracion"" UsoCFDI=""G03"" /><cfdi:Conceptos><cfdi:Concepto ClaveProdServ=""10101902"" NoIdentificacion=""124"" Cantidad=""1.00"" ClaveUnidad=""EA"" Unidad=""PZA"" Descripcion=""ESCOBA "" ValorUnitario=""100.00"" Importe=""100.00""><cfdi:Impuestos><cfdi:Traslados><cfdi:Traslado Base=""100.00"" Impuesto=""002"" TipoFactor=""Tasa"" TasaOCuota=""0.160000"" Importe=""16.00"" /></cfdi:Traslados></cfdi:Impuestos></cfdi:Concepto></cfdi:Conceptos><cfdi:Impuestos TotalImpuestosTrasladados=""16.00""><cfdi:Traslados><cfdi:Traslado Impuesto=""002"" TipoFactor=""Tasa"" TasaOCuota=""0.160000"" Importe=""16.00"" /></cfdi:Traslados></cfdi:Impuestos></cfdi:Comprobante>"
#Region "P O L I Z A - V I R T U A L"
Protected Sub GeneraPolizaVentaWS(ByVal context As HttpContext, ObjFactura As Modelos.Factura)
Dim obj As New MPolizaVentaWS
'DATOS DEL CLIENTE
@@ -320,6 +423,7 @@ Public Class SIGPolizaVirtual : Implements IHttpHandler, IRequiresSessionState
context.Response.Write(Retorno)
End Sub
#End Region
End Class

View File

@@ -690,7 +690,7 @@ Partial Class Bancos_PopIEVentas
If Not UsuarioActual.Empresa.Funcionalidad(529) = "1" AndAlso dr("FolioFiscal").ToString() <> "" Then
Dim Valida As New ClsValidaCFDi(dr("FolioFiscal").ToString(), UsuarioActual.Empresa.RFC, dr("ClienteRFC").ToString, dr("Total").ToString.ToDecimal)
Dim Valida As New ClsValidaCFDi(dr("FolioFiscal").ToString(), UsuarioActual.Empresa.RFC, dr("RFCReceptor").ToString, dr("Total").ToString.ToDecimal)
If Valida.EsValida > 0 Then
If Valida.EsValida = 2 Then

View File

@@ -176,7 +176,7 @@
<div class="row" id="trNotificar" runat="server" visible="False">
<label class="col-md-2 control-label">Notificar:</label>
<div class="col-md-7">
<asp:TextBox ID="TxtNotificarA" runat="server" MaxLength="12" CssClass="form-control input-sm" Rows="2" TextMode="MultiLine" ClientIDMode="Static"></asp:TextBox>
<asp:TextBox ID="TxtNotificarA" runat="server" MaxLength="100" CssClass="form-control input-sm" Rows="2" TextMode="MultiLine" ClientIDMode="Static"></asp:TextBox>
</div>
<div>

View File

@@ -1938,6 +1938,7 @@ Partial Class Bancos_ProveedoresAbonar
End If
Case 42 'Acreedores
If DivTarjeta.Visible AndAlso DdlTarjeta.SelectedValue.ToEntero > 0 Then
Dim ObjCreditos As New ClsBancos
ObjCreditos.GetTarjetasCreditos(DdlCuenta.SelectedValue.ToEntero, DdlTarjeta.SelectedValue.ToEntero)
@@ -1947,10 +1948,12 @@ Partial Class Bancos_ProveedoresAbonar
IdCtaContable = IdCuenta
End If
ImporteMovimiento = TxtImporte.Text.ToDecimal
importeMX = If(CveMoneda = 2, If(DivTC.Visible, TxtImporte.Text.ToDecimal / TxtTC.Text.ToDecimal * TipoCambioPago, TxtImporte.Text.ToDecimal * TipoCambioPago), TxtImporte.Text.ToDecimal)
Dim Importe42 As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
ImporteMovimiento = Importe42
importeMX = If(CveMoneda = 2, If(DivTC.Visible, Importe42 / TxtTC.Text.ToDecimal * TipoCambioPago, Importe42 * TipoCambioPago), Importe42)
TipoCambioGeneral = TipoCambioPago
End If
Case 30
'Conta ContPAQ
If IdCuenta < 1 Then

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -1458,7 +1458,22 @@ Partial Class Compras_Proveedores
#Region "LL E N A R - C O M B O S"
Private Sub CargaResponsable()
'DdlCveUsuarioResponsable.DataSource = GlobalDTUsuarioResponsable.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa, DistinctColumns:={"CveUsuario", "Nombre"})
DdlCveUsuarioResponsable.DataSource = GlobalDTUsuarios(-1, UsuarioActual.CveEmpresa).FiltraParametros("", DistinctColumns:={"CveUsuario", "Nombre"})
Dim DtUsuarios As DataTable = Nothing
Dim ObjUsuarios As New ClsSisUsuarios
Try
If ObjUsuarios.GetUsuarios(-1) Then
DtUsuarios = ObjUsuarios.DtResultados.FiltraParametros($"CveEmpresaPredeterminada = {UsuarioActual.CveEmpresa}", DistinctColumns:={"CveUsuario", "Nombre", "Estatus"})
If CveProveedor <= 0 AndAlso DtUsuarios IsNot Nothing Then
DtUsuarios = DtUsuarios.FiltraParametros("Estatus = True", DistinctColumns:={"CveUsuario", "Nombre"})
End If
End If
Catch ex As Exception
OnError("Ocurrio un error al obtener los responsables", ex)
End Try
ObjUsuarios.Dispose()
DdlCveUsuarioResponsable.DataSource = DtUsuarios 'GlobalDTUsuarios(-1, UsuarioActual.CveEmpresa).FiltraParametros("", DistinctColumns:={"CveUsuario", "Nombre"})
DdlCveUsuarioResponsable.DataBind()
End Sub
Private Sub CargaClasificacionProveedor()

View File

@@ -355,6 +355,8 @@
<asp:Literal ID="LtlDescuentos" runat="server" Text='<%# Eval("Descuento", "{0:N2}") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="RetIVA" HeaderText="Ret IVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="RetISR" HeaderText="Ret ISR" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:TemplateField ItemStyle-Width="80">
<HeaderTemplate>
Total
@@ -498,6 +500,13 @@
<asp:CheckBox ID="ChkFecha" runat="server" Text="Fecha Movimiento" /></td>
<td></td>
</tr>
<tr>
<td>
<asp:CheckBox ID="ChkRetIVA" runat="server" Text="Ret IVA" Checked="true" /></td>
<td>
<asp:CheckBox ID="ChkRetISR" runat="server" Text="Ret ISR" Checked="true" /></td>
<td></td>
</tr>
</table>
</div>
<div class="modal-footer">

View File

@@ -368,14 +368,13 @@ Partial Class Compras_RepComprasDetalle
e.Row.FCHyperLink("HplSerieFolio").Text = ""
End If
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left
e.Row.Cells(7).HorizontalAlign = HorizontalAlign.Left
e.Row.Cells(8).HorizontalAlign = HorizontalAlign.Left
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left
e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Right
e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Right
e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Right
e.Row.Cells(6).HorizontalAlign = HorizontalAlign.Right
e.Row.Cells(6).HorizontalAlign = HorizontalAlign.Right
e.Row.Cells(9).HorizontalAlign = HorizontalAlign.Right
End If
End Sub
@@ -604,13 +603,15 @@ Partial Class Compras_RepComprasDetalle
GvDatos.Columns(4).Visible = ChkIVA.Checked
GvDatos.Columns(5).Visible = ChkIEPS.Checked
GvDatos.Columns(6).Visible = ChkDesc.Checked
GvDatos.Columns(7).Visible = ChkTotal.Checked
GvDatos.Columns(8).Visible = ChkAbre.Checked
GvDatos.Columns(9).Visible = ChkRazon.Checked
GvDatos.Columns(10).Visible = ChkFolio.Checked
GvDatos.Columns(11).Visible = ChkFecha.Checked
GvDatos.Columns(12).Visible = ChkObs.Checked
GvDatos.Columns(13).Visible = ChkDescripcion.Checked
GvDatos.Columns(7).Visible = Chkretiva.Checked
GvDatos.Columns(8).Visible = Chkretisr.Checked
GvDatos.Columns(9).Visible = ChkTotal.Checked
GvDatos.Columns(10).Visible = ChkAbre.Checked
GvDatos.Columns(11).Visible = ChkRazon.Checked
GvDatos.Columns(12).Visible = ChkFolio.Checked
GvDatos.Columns(13).Visible = ChkFecha.Checked
GvDatos.Columns(14).Visible = ChkObs.Checked
GvDatos.Columns(15).Visible = ChkDescripcion.Checked
UPDatos.Update()
End Sub

View File

@@ -141,7 +141,7 @@ Partial Class Contabilidad_PlantillasPolizasDetalle
DdlCtaContable.Items.Insert(0, New ListItem("Seleccione", "-1"))
If UsuarioActual.Empresa.TipoContabilizacion = 2 Or UsuarioActual.Empresa.TipoContabilidad = 1 Then
If UsuarioActual.Empresa.TipoContabilidad = 1 Then
Dim Conta As New ClsContabilidad
Dim dtt As New DataTable
@@ -383,7 +383,7 @@ Partial Class Contabilidad_PlantillasPolizasDetalle
'cargar la cuenta
If UsuarioActual.Empresa.TipoContabilizacion = 0 Then
If UsuarioActual.Empresa.TipoContabilidad = 1 Then
'busco en la cuenta contable, lo que tenga asignado
Dim Con As New ClsContabilidad
Dim dtt As DataTable = Nothing
@@ -483,7 +483,7 @@ Partial Class Contabilidad_PlantillasPolizasDetalle
DDLSubProyecto.SelectedIndex = 0
DDLProveedor.SelectedIndex = 0
DdlPersonal.SelectedIndex = 0
TxtOrden.Text = ""
TxtOrden.Text = ""
UpModal.Update()
HdnModalidad.Value = "I"
RegistraScript(String.Format("$('#{0}').modal();", "divAgregarSucursal"))

View File

@@ -41,7 +41,7 @@ Partial Class Contabilidad_PolizasImpresion
Dim objcont As New ClsContPAQi(UsuarioActual.Empresa)
If objcont.GetPolizasMasivo(TxtFechaInicio.Text.ToDate, TxtFechaFin.Text.ToDate, foli, folf, ddlTipoPoliza.SelectedValue.ToEntero, DdlUsuarioRegistro.SelectedValue.ToEntero, DdlSegmentoNeg.SelectedValue.ToEntero, DdlCuenta.SelectedValue.ToEntero, DdlGrupoPlantilla.SelectedValue.ToEntero, DdlTipoProveedor.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
If objcont.DtResultados.Rows.Count < 10000 Then
If objcont.DtResultados.Rows.Count < 15000 Then
If objcont.DtResultados.Rows.Count > 0 Then
Dim dr As DataRow

View File

@@ -247,17 +247,15 @@ Partial Class PopUpAuxiliar
Dim TieneError = False
If Not TieneError Then
If Not Conta.UpdatePrePolizasDetalleBloquear(ClavePrePoliza, False) Then
TieneError = True
End If
End If
If Not Conta.RemovePrePolizas(ClavePrePoliza, UsuarioActual.CveEmpresa) Then
If Not Conta.UpdatePrePolizasDetalleBloquear(ClavePrePoliza, False) Then
TieneError = True
End If
If Conta.ValidacionPrePolizaCuadre(ClavePrePoliza, -1) Then
If Not TieneError AndAlso Not Conta.RemovePrePolizas(ClavePrePoliza, UsuarioActual.CveEmpresa) Then
TieneError = True
End If
If Not TieneError AndAlso Conta.ValidacionPrePolizaCuadre(ClavePrePoliza, -1) Then
If Conta.ValorPolizaDescuadre > 0 Then
TieneError = True
End If

View File

@@ -80,9 +80,6 @@
<li>
<asp:LinkButton ID="LnkComprobante" runat="server" Visible="false" data-toggle="modal" data-target="#ModalUpload" Style="color: #686868;"><i class="fa fa-upload" style="color:#686868;"></i> Cargar Comprobante</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="LnkImprimirPoliza" runat="server" Visible="true" OnClick="LnkImprimirPoliza_Click" Style="color: #686868;"><i class="fa fa-print" style="color:#686868;"></i> Imprimir Poliza</asp:LinkButton>
</li>
@@ -410,7 +407,7 @@
<asp:UpdatePanel ID="UpPrePoliza" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div style="width: 100%; min-height: 200px; overflow-scrolling: auto;">
<asp:GridView ID="GvPrePoliza" runat="server" AutoGenerateColumns="False" DataKeyNames="CvePrePolizaDetalle, CveConceptoContable, IdCtaContable, CveSubProyecto, CveTipoGasto,Referencia,CveVenta,CveCompra,CveOC" Width="100%" CssClass="table table-striped table-advance table-hover" GridLines="None">
<asp:GridView ID="GvPrePoliza" runat="server" AutoGenerateColumns="False" DataKeyNames="CvePrePolizaDetalle, CveConceptoContable, IdCtaContable, CveSubProyecto, CveTipoGasto,Referencia,CveVenta,CveCompra,CveOC,Concepto,TipoMovto,ImporteMN" Width="100%" CssClass="table table-striped table-advance table-hover" GridLines="None">
<Columns>
<asp:TemplateField>
<HeaderTemplate>Movimiento</HeaderTemplate>

File diff suppressed because it is too large Load Diff

View File

@@ -342,7 +342,7 @@
</div>
<div class="portlet-body nomarginleftright form-horizontal form-row-sepe formnombottom ">
<asp:GridView ID="GvMov" runat="server" AutoGenerateColumns="False" ShowHeader="False"
DataKeyNames="IdMov,IDCuenta,Cargo,Abono,TipoMovto,CveConcepto,CveProveedor,CvePersonal, CveCompra,CveClasificacion,CveCliente,CveVenta" Width="100%" CssClass=" GvMov GvSize table table-striped table-advance table-hover mysmallbtn" GridLines="None">
DataKeyNames="IdMov,Cargo,Abono,TipoMovto,CveConcepto,CveProveedor,CvePersonal, CveCompra,CveClasificacion,CveCliente,CveVenta,CveCuenta" Width="100%" CssClass=" GvMov GvSize table table-striped table-advance table-hover mysmallbtn" GridLines="None">
<Columns>
<asp:TemplateField>
<HeaderTemplate>Cuenta</HeaderTemplate>

View File

@@ -261,23 +261,23 @@ Partial Class ContabilidadC_RegPrePolizaS
CargaCuentas()
If Request("CvePeriodo") IsNot Nothing AndAlso IsNumeric(Request("CvePeriodo")) AndAlso Request("CvePeriodo").ToEntero > 0 Then
ViewState("CvePeriodo") = Request("CvePeriodo").ToEntero
ViewState("CveProyecto") = Request("CveProyecto").ToEntero
ViewState("CveSubProyecto") = Request("CveSubProyecto").ToEntero
ViewState("CveTurno") = Request("CveTurno").ToEntero
'If Request("CvePeriodo") IsNot Nothing AndAlso IsNumeric(Request("CvePeriodo")) AndAlso Request("CvePeriodo").ToEntero > 0 Then
' ViewState("CvePeriodo") = Request("CvePeriodo").ToEntero
' ViewState("CveProyecto") = Request("CveProyecto").ToEntero
' ViewState("CveSubProyecto") = Request("CveSubProyecto").ToEntero
' ViewState("CveTurno") = Request("CveTurno").ToEntero
DdlPlantilla.Items.Add(New ListItem("Pago Nomina", "61"))
DdlPlantilla.SelectedValue = "61"
DdlPlantilla.Enabled = False
DivAgregarConceptos.Visible = False
' DdlPlantilla.Items.Add(New ListItem("Pago Nomina", "61"))
' DdlPlantilla.SelectedValue = "61"
' DdlPlantilla.Enabled = False
' DivAgregarConceptos.Visible = False
CargaNomina()
' CargaNomina()
RegistraScript("$(document).ready(function () { calculateCargo(); Sys.Application.add_load(function (s, e) { calculateCargo(); }); } );", 1)
RegistraScript("$(document).ready(function () { calculateAbono(); Sys.Application.add_load(function (s, e) { calculateAbono(); }); } );", 2)
RegistraScript("$(document).ready(function () { comparar(); Sys.Application.add_load(function (s, e) { comparar(); }); } );", 3)
End If
' RegistraScript("$(document).ready(function () { calculateCargo(); Sys.Application.add_load(function (s, e) { calculateCargo(); }); } );", 1)
' RegistraScript("$(document).ready(function () { calculateAbono(); Sys.Application.add_load(function (s, e) { calculateAbono(); }); } );", 2)
' RegistraScript("$(document).ready(function () { comparar(); Sys.Application.add_load(function (s, e) { comparar(); }); } );", 3)
'End If
If IfNull(Request("Tipo"), "").ToString <> "NOMPROV" Then
GvPrePoliza.Columns(4).Visible = False
@@ -293,8 +293,7 @@ Partial Class ContabilidadC_RegPrePolizaS
Private Sub CreaDT()
DtMovimientos = New DataTable("Movimientos")
Dim IDMov As DataColumn = DtMovimientos.Columns.Add("IdMov", Type.GetType("System.Int32")) : IDMov.AutoIncrement = True
With DtMovimientos.Columns
.Add("IdCuenta", Type.GetType("System.Int32"))
With DtMovimientos.Columns
.Add("CodigoCuenta", Type.GetType("System.String"))
.Add("Cuenta", Type.GetType("System.String"))
.Add("Referencia", Type.GetType("System.String"))
@@ -318,84 +317,85 @@ Partial Class ContabilidadC_RegPrePolizaS
.Add("CveConceptoContable", Type.GetType("System.Int32"))
.Add("IdCtaContable", Type.GetType("System.Int32"))
.Add("ConceptoContable", Type.GetType("System.String"))
.Add("CveCuenta", Type.GetType("System.Int32"))
End With
End Sub
Private Sub CargaNomina()
Dim CvePlantilla As Integer = DdlPlantilla.SelectedValue.ToEntero
Dim ObjNomina As New ClsNominas
Dim ObjConta As New ClsContabilidad
'Private Sub CargaNomina()
' Dim CvePlantilla As Integer = DdlPlantilla.SelectedValue.ToEntero
' Dim ObjNomina As New ClsNominas
' Dim ObjConta As New ClsContabilidad
Dim Dt As DataTable = Nothing
Dim Cuenta As String = ""
Dim Concepto As String = ""
Dim IdCuenta As Integer = 0
Dim TipoMovto As Integer
Dim CveConcepto As Integer
Dim CodigoCuenta As String = ""
Dim NombreCuenta As String = ""
Dim Referencia As String = ""
Dim EsComodin As Integer = 0
DtMovimientos.Clear()
' Dim Dt As DataTable = Nothing
' Dim Cuenta As String = ""
' Dim Concepto As String = ""
' Dim IdCuenta As Integer = 0
' Dim TipoMovto As Integer
' Dim CveConcepto As Integer
' Dim CodigoCuenta As String = ""
' Dim NombreCuenta As String = ""
' Dim Referencia As String = ""
' Dim EsComodin As Integer = 0
' DtMovimientos.Clear()
If ObjNomina.GetProvisionNomina(CveProyecto, CveSubProyecto, CveTurno, CvePeriodo, UsuarioActual.CveEmpresa) Then
Dt = ObjNomina.DtResultados
' If ObjNomina.GetProvisionNomina(CveProyecto, CveSubProyecto, CveTurno, CvePeriodo, UsuarioActual.CveEmpresa) Then
' Dt = ObjNomina.DtResultados
For Each drt As DataRow In Dt.Rows
Dim dr As DataRow = DtMovimientos.NewRow
' For Each drt As DataRow In Dt.Rows
' Dim dr As DataRow = DtMovimientos.NewRow
If drt("NombreCompleto").ToString = "" AndAlso ObjConta.GetRetCuenta(31, UsuarioActual.CveEmpresa) Then
CveConcepto = 98
Cuenta = "Nominas por Pagar"
IdCuenta = ObjConta.DtResultados(0)("IdCtaContable").ToString.ToEntero
Concepto = "Pago Nomina"
Referencia = "Pago Nomina"
Else
Concepto = drt("NombreCompleto")
Referencia = ""
CveConcepto = drt("CveConceptoContable").ToString.ToEntero
Cuenta = drt("ConceptoContable").ToString
IdCuenta = drt("IdCtaContable").ToString.ToEntero
End If
' If drt("NombreCompleto").ToString = "" AndAlso ObjConta.GetRetCuenta(31, UsuarioActual.CveEmpresa) Then
' CveConcepto = 98
' Cuenta = "Nominas por Pagar"
' IdCuenta = ObjConta.DtResultados(0)("IdCtaContable").ToString.ToEntero
' Concepto = "Pago Nomina"
' Referencia = "Pago Nomina"
' Else
' Concepto = drt("NombreCompleto")
' Referencia = ""
' CveConcepto = drt("CveConceptoContable").ToString.ToEntero
' Cuenta = drt("ConceptoContable").ToString
' IdCuenta = drt("IdCtaContable").ToString.ToEntero
' End If
Dim drr As DataRow = DtCuentasContables.FiltroPrimero($"Id={IdCuenta}")
CodigoCuenta = If(drr IsNot Nothing, drr("CuentaFormato").ToString(), "")
NombreCuenta = If(drr IsNot Nothing, drr("Nombre").ToString(), "")
' Dim drr As DataRow = DtCuentasContables.FiltroPrimero($"Id={IdCuenta}")
' CodigoCuenta = If(drr IsNot Nothing, drr("CuentaFormato").ToString(), "")
' NombreCuenta = If(drr IsNot Nothing, drr("Nombre").ToString(), "")
TipoMovto = drt("TipoMovto")
' TipoMovto = drt("TipoMovto")
If TipoMovto = 0 Then
dr("Cargo") = Math.Abs(drt("Importe").ToString.ToDecimal)
dr("Abono") = 0
Else
dr("Cargo") = 0
dr("Abono") = Math.Abs(drt("Importe").ToString.ToDecimal)
End If
' If TipoMovto = 0 Then
' dr("Cargo") = Math.Abs(drt("Importe").ToString.ToDecimal)
' dr("Abono") = 0
' Else
' dr("Cargo") = 0
' dr("Abono") = Math.Abs(drt("Importe").ToString.ToDecimal)
' End If
dr("IdCuenta") = IdCuenta
dr("CodigoCuenta") = CodigoCuenta & "<br>" & NombreCuenta
dr("Cuenta") = Cuenta
dr("Concepto") = Concepto
dr("Descripcion") = Concepto
dr("Referencia") = Referencia
dr("TipoMovto") = TipoMovto
dr("EsComodin") = EsComodin
dr("CveConcepto") = CveConcepto
dr("CveProveedor") = "-1"
dr("CveSubProyecto") = drt("CveSubProyecto")
dr("CvePersonal") = drt("CvePersonal")
dr("CveClasificacion") = drt("CveClasificacion")
dr("CveTipoGasto") = drt("CveTipoGasto")
' dr("IdCuenta") = IdCuenta
' dr("CodigoCuenta") = CodigoCuenta & "<br>" & NombreCuenta
' dr("Cuenta") = Cuenta
' dr("Concepto") = Concepto
' dr("Descripcion") = Concepto
' dr("Referencia") = Referencia
' dr("TipoMovto") = TipoMovto
' dr("EsComodin") = EsComodin
' dr("CveConcepto") = CveConcepto
' dr("CveProveedor") = "-1"
' dr("CveSubProyecto") = drt("CveSubProyecto")
' dr("CvePersonal") = drt("CvePersonal")
' dr("CveClasificacion") = drt("CveClasificacion")
' dr("CveTipoGasto") = drt("CveTipoGasto")
DtMovimientos.Rows.Add(dr)
Next
' DtMovimientos.Rows.Add(dr)
' Next
GvMov.DataSource = DtMovimientos
GvMov.DataBind()
UPMovs.Update()
End If
' GvMov.DataSource = DtMovimientos
' GvMov.DataBind()
' UPMovs.Update()
' End If
End Sub
'End Sub
Private Sub CargaPrePoliza()
BtnEliminar.Visible = True
@@ -723,8 +723,8 @@ Partial Class ContabilidadC_RegPrePolizaS
EsComodin = 0
End If
Dim dr As DataRow = DtMovimientos.NewRow
dr("IdCuenta") = IdCuenta
Dim dr As DataRow = DtMovimientos.NewRow
dr("CodigoCuenta") = CodigoCuenta & "<br>" & NombreCuenta
dr("Cuenta") = Cuenta 'TxtCuentaContable.Text
dr("Referencia") = If(drt("CveConcepto").ToString.Contiene("29", "130"), drt("Personal"), drt("RazonSocial"))
@@ -738,7 +738,8 @@ Partial Class ContabilidadC_RegPrePolizaS
dr("CveProveedor") = drt("CveProveedor")
dr("CvePersonal") = drt("CvePersonal")
dr("CveClasificacion") = -1
dr("MultipleSubProyecto") = drt("MultipleSubProyecto")
dr("MultipleSubProyecto") = drt("MultipleSubProyecto")
dr("CveCuenta") = drt("CveCuenta")
'dr("FolioPoliza") = 0 'drt("FolioPoliza")
DtMovimientos.Rows.Add(dr)
@@ -756,7 +757,7 @@ Partial Class ContabilidadC_RegPrePolizaS
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left
e.Row.Height = Unit.Pixel(1)
e.Row.Cells(0).ToolTip = e.Row.DBCampo("IdCuenta")
e.Row.Cells(0).ToolTip = e.Row.DBCampo("CveCuenta")
If e.Row.DBCampo("TipoMovto") = "1" Then
e.Row.FCTextBox("TxtAbono").Visible = True
@@ -851,8 +852,8 @@ Partial Class ContabilidadC_RegPrePolizaS
Else
Dim MensajeAlert = New StringBuilder
Dim ObjIE As New ClsBancos()
Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL)
Dim ObjNom As New ClsNominas(ObjIE.IniciaTransacSQL)
Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL)
' Dim ObjNom As New ClsNominas(ObjIE.IniciaTransacSQL)
Dim Conta As ClsContPAQi = Nothing
Dim IDPoliza As Integer = 0
Dim MsgError As String = ""
@@ -884,9 +885,9 @@ Partial Class ContabilidadC_RegPrePolizaS
'inserto las compras que voy a pagarDdlSaldos
For Each gvr As GridViewRow In GvMov.Rows
If gvr.DataKey("IDCuenta").ToEntero > 0 Then
IdCtaContable = gvr.DataKey("IDCuenta")
End If
'If gvr.DataKey("IDCuenta").ToEntero > 0 Then
' IdCtaContable = gvr.DataKey("IDCuenta")
'End If
If gvr.DataKey("TipoMovto").ToDouble > 0 Then
Importe = gvr.FCTextBox("TxtAbono").Text.ToDouble
@@ -911,12 +912,18 @@ Partial Class ContabilidadC_RegPrePolizaS
idCuentaContabilizacion = 0
End If
If Importe > 0 Then
Dim tCveCuenta As Integer = -1
If gvr.datakey("CveConcepto") = "299" Then
tCveCuenta = gvr.datakey("CveCuenta").toentero
End If
If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Importe, gvr.FCLiteral("LtlReferencia").Text, gvr.DataKey("CveConcepto").ToEntero, gvr.FCTextBox("TxtConcepto").Text,
TxtFecha.Text.ToDate, IdCtaContable, -1, CveSubProyecto:=gvr.FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero, CveIE:=CveIE,
CveProveedor:=gvr.DataKey("CveProveedor").ToEntero, CveCompra:=gvr.DataKey("CveCompra").ToEntero,
CvePersonal:=gvr.DataKey("CvePersonal").ToEntero, CveClasificacion:=gvr.DataKey("CveClasificacion").ToEntero,
ImporteMX:=Importe, CveTipoGasto:=gvr.FCDropDownList("DdlTipoGasto").SelectedValue.ToEntero,
CveCliente:=gvr.DataKey("CveCliente").ToEntero, CveVenta:=gvr.DataKey("CveVenta").ToEntero) Then
CveCliente:=gvr.DataKey("CveCliente").ToEntero, CveVenta:=gvr.DataKey("CveVenta").ToEntero, CveCuenta:=tCveCuenta) Then
Else
MsgError = "No se pudo insertar el detalle de la póliza2"
Exit For
@@ -924,11 +931,11 @@ Partial Class ContabilidadC_RegPrePolizaS
End If
Next
If CvePeriodo > 0 Then
If Not ObjNom.UpdateProvisionNomina(CvePeriodo, CvePrePoliza, UsuarioActual.CveEmpresa) Then
MsgError = "No se pudo actualizar el periodo de la nómina"
End If
End If
'If CvePeriodo > 0 Then
' If Not ObjNom.UpdateProvisionNomina(CvePeriodo, CvePrePoliza, UsuarioActual.CveEmpresa) Then
' MsgError = "No se pudo actualizar el periodo de la nómina"
' End If
'End If
If ObjMov.ValidacionPrePolizaCuadre(CvePrePoliza, 1) Then
If ObjMov.ValorPolizaDescuadre > 0 Then
@@ -1001,11 +1008,11 @@ Partial Class ContabilidadC_RegPrePolizaS
For Each row As GridViewRow In GvPrePoliza.Rows
If row.DataKey("CvePrePolizaDetalle").ToEntero > 0 Then
If row.FCCheckBox("chkModificado").Checked Then
If Not ObjContabilidad.UpdatePrepolizasDetalle(row.DataKey("CvePrePolizaDetalle").ToEntero, row.FCLiteral("TxtConcepto").Text, row.DataKey("CveSubProyecto").ToEntero,
If Not ObjContabilidad.UpdatePrePolizasDetalle(row.DataKey("CvePrePolizaDetalle").ToEntero, row.FCLiteral("TxtConcepto").Text, row.DataKey("CveSubProyecto").ToEntero,
row.DataKey("IdCtaContable").ToEntero, If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0, False, True), If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0,
row.FCLiteral("TxtCargo").Text.ToDecimal, row.FCLiteral("TxtAbono").Text.ToDecimal), CveTipoGasto:=If(DdlTipoGasto.Visible, row.DataKey("CveTipoGasto").ToEntero, row.DataKey("CveTipoGasto").ToEntero),
CveConceptoContable:=row.DataKey("CveConceptoContable").ToEntero, CveProveedor:=row.DataKey("CveProveedor").ToEntero, CveCompra:=row.DataKey("CveCompra").ToEntero,
CveCliente:=row.DataKey("CveCliente").ToEntero, CveVenta:=row.DataKey("CveVenta").ToEntero, CvePersonal:=row.DataKey("CvePersonal").ToEntero, Referencia:=row.FCLiteral("TxtRef").Text, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
CveCliente:=row.DataKey("CveCliente").ToEntero, CveVenta:=row.DataKey("CveVenta").ToEntero, CvePersonal:=row.DataKey("CvePersonal").ToEntero, Referencia:=row.FCLiteral("TxtRef").Text, CveCuenta:=row.DataKey("CveCuenta").ToEntero, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
OcurrioError = True
Exit For
End If
@@ -1406,7 +1413,7 @@ Partial Class ContabilidadC_RegPrePolizaS
Dim dr As DataRow = Rows(0)
Dim CodigoCuenta As String = ""
Dim NombreCuenta As String = ""
dr("IdCuenta") = DdlCtaContable.SelectedValue
dr("CveCuenta") = DdlCtaContable.SelectedValue
If DdlCtaContable.SelectedValue.ToEntero > 0 Then
Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("CveCuenta={0}", DdlCtaContable.SelectedValue))
@@ -1433,6 +1440,7 @@ Partial Class ContabilidadC_RegPrePolizaS
dr("CveClasificacion") = -1
dr("CveCliente") = DdlClientes.SelectedValue.ToEntero
dr("CveVenta") = DdlVentas.SelectedValue.ToEntero
dr("CveCuenta") = DdlCtaContable.SelectedValue.ToEntero
End If
LbCancelarEdicion.Visible = False
LbAgregar.Text = "Agregar"
@@ -1474,7 +1482,7 @@ Partial Class ContabilidadC_RegPrePolizaS
Dim CodigoCuenta As String = ""
Dim NombreCuenta As String = ""
dr("IdCuenta") = DdlCtaContable.SelectedValue
dr("CveCuenta") = DdlCtaContable.SelectedValue
If DdlCtaContable.SelectedValue.ToEntero > 0 Then
Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("CveCuenta={0}", DdlCtaContable.SelectedValue))
@@ -1548,7 +1556,7 @@ Partial Class ContabilidadC_RegPrePolizaS
End Sub
Private Sub CargaTipoTransaccion(Tipo As String)
DdlTipoTransaccion.Items.Clear()
DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones.FiltraParametros($"Tipo = '{Tipo}'")
DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones.FiltraParametros($"Tipo = '{Tipo}' AND Estatus = 1 ")
DdlTipoTransaccion.DataBind()
DdlTipoTransaccion.Items.Insert(0, New ListItem("Seleccione Tipo Movimiento", "-1"))
End Sub
@@ -1644,7 +1652,7 @@ Partial Class ContabilidadC_RegPrePolizaS
If DrM IsNot Nothing Then
HdnCve.Value = idMov.ToString
DdlCtaContable.SelectedValue = DrM("IdCuenta")
DdlCtaContable.SelectedValue = DrM("CveCuenta")
TxtReferencia.Text = DrM("Referencia")
TxtObservaciones.Text = DrM("Concepto")
' (Math.Abs(TxtCargo.Text.ToDouble) > 0, 0, 1) = dr("TipoMovto")

View File

@@ -2003,7 +2003,7 @@
</div>
<div class="row">
<div class="col-md-12">
<asp:GridView ID="GvCiclosComerciales" ClientIDMode="Static" ShowHeader="true" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron documentos." CssClass="table table-striped table-hover Widthall" BorderColor="#D3D3D3" GridLines="None">
<asp:GridView ID="GvCiclosComerciales" ClientIDMode="Static" ShowHeader="true" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron documentos." CssClass="table table-striped table-hover ScrollAD Widthall" data-heighterror="450" data-freezerows="1" BorderColor="#D3D3D3" GridLines="None">
<Columns>
<asp:BoundField HeaderText="Fecha Vencimiento" DataField="FechaVenc" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:d}" />
<asp:BoundField HeaderText="Fue Facturado" DataField="FueFacturadoTexto" ItemStyle-Width="10%" ItemStyle-HorizontalAlign="Center" />

View File

@@ -1021,6 +1021,7 @@ Partial Class Contratos_Default
If ObjContratos.DtResultados.Rows(0)("CvePeriodo").ToString().ToEntero() > 0 Then
DdlPeriodo.SelectedValueExist(ObjContratos.DtResultados.Rows(0)("CvePeriodo").ToString().ToEntero())
DdlPeriodo_SelectedIndexChanged(DdlPeriodo, EventArgs.Empty)
DdlDiaFact.SelectedValueExist(ObjContratos.DtResultados.Rows(0)("DiaMesFacturacion").ToString())
End If
UpFacCiclica.Update()
@@ -1235,6 +1236,16 @@ Partial Class Contratos_Default
Exit Sub
End If
If ChkAplicaFacCiclica.Checked AndAlso DdlPeriodo.SelectedValue.ToEntero() <= 0 Then
Alert("Debe seleccionar un periodo para la facturación ciclica", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If ChkAplicaFacCiclica.Checked AndAlso DdlDiaFact.SelectedValue.ToEntero() <= 0 Then
Alert("Debe seleccionar un día para la facturación ciclica", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim TieneError = False
Dim Modificado = False
' Dim Extension = Session("FileExtension").ToString
@@ -1508,7 +1519,8 @@ Partial Class Contratos_Default
For Ciclo As Integer = 1 To CiclosComercialesEnMeses
Dim FechaRef As DateTime = FechaI.AddMonths(PeriodoMeses * Ciclo)
Dim lastDayOfMonth = DateTime.DaysInMonth(FechaRef.Year, FechaRef.Month)
Dim DiaMes As Integer = If(FechaRef.Day < DdlDiaFact.SelectedValue.ToEntero(), lastDayOfMonth, DdlDiaFact.SelectedValue.ToEntero())
Dim DiaMes As Integer = If(lastDayOfMonth < DdlDiaFact.SelectedValue.ToEntero(), lastDayOfMonth, DdlDiaFact.SelectedValue.ToEntero())
Dim FechaFact = New DateTime(FechaRef.Year, FechaRef.Month, DiaMes)
FechaFact = If(FechaFact > FechaF, FechaF, FechaFact)
@@ -2304,7 +2316,7 @@ Partial Class Contratos_Default
If ObjContratos.RemoveContratosDetalle(CveContratoDetalle, CveContrato) Then
TmpDT.Rows.Remove(DbRow)
CargaGVPresupuestosInsumos(TmpDT.FiltraParametros("CveTipoPresupuesto=1"))
LbTotalGeneralInsumos.Text = GvInsumos.Rows.Cast(Of GridViewRow)().Sum(Function(gvr) gvr.FCLiteral("LtTotal").Text.ToDouble).ToString.FormatoNumero
LbTotalGeneralInsumos.Text = GvInsumos.Rows.Cast(Of GridViewRow)().Sum(Function(gvr) gvr.FCLabel("LtTotal").Text.ToDouble).ToString.FormatoNumero
Else
Alert("Ocurrió un error al eliminar el detalle (Producto/Servicio). Por favor vuelva a intentar", TipoMensaje.MsgError)
End If

View File

@@ -1,166 +1,167 @@
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="FacturacionMasiva.aspx.vb" Inherits="Contratos_FacturacionMasiva" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" Runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="E" Runat="Server">
Facturación Masiva
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="HB" Runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" Runat="Server">
<li>
<asp:UpdatePanel ID="UpnRefresh" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="FacturacionMasiva.aspx.vb" Inherits="Contratos_FacturacionMasiva" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
Facturación Masiva
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
<li>
<asp:UpdatePanel ID="UpnRefresh" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:LinkButton ID="ImgFacturarTodos" runat="server"><i class="fa fa-repeat"></i>
Facturar Todas</asp:LinkButton>
</ContentTemplate>
</asp:UpdatePanel>
</li>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="HA" Runat="Server">
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="C" Runat="Server">
<asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="UpFiltros">
<ContentTemplate>
<div class="portlet solid grey-cascade portlet-filter">
<div class="portlet-title portlet-filterT smalltitle magindate">
<div class="tools">
<asp:Button ID="BtnCargaAsignados" ClientIDMode="Static" runat="server" Text="Consultar" class="btn btn-default" />
<a href="javascript:;" id="ex" class="expand"></a>
</div>
<div class="titlefiltros caption ">
<ul class="list-inline" style="font-size: 12px;">
Facturar Todas</asp:LinkButton>
</ContentTemplate>
</asp:UpdatePanel>
</li>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
<asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="UpFiltros">
<ContentTemplate>
<div class="portlet solid grey-cascade portlet-filter">
<div class="portlet-title portlet-filterT smalltitle magindate">
<div class="tools">
<asp:Button ID="BtnCargaAsignados" ClientIDMode="Static" runat="server" Text="Consultar" class="btn btn-default" />
<a href="javascript:;" id="ex" class="expand"></a>
</div>
<div class="titlefiltros caption ">
<ul class="list-inline" style="font-size: 12px;">
<li>Cliente:
<ADS:Dropdownlost ID="DdlCliente" runat="server" Width="230px" CssStyle="width: 100%;" UsaWebService="true" AppendDataBoundItems="true" CssClass="select2me" data-metodo="getcliente" DataTextField="NombreComercial" DataValueField="CveCliente"></ADS:Dropdownlost>
</li>
<ADS:Dropdownlost ID="DdlCliente" runat="server" Width="230px" CssStyle="width: 100%;" UsaWebService="true" AppendDataBoundItems="true" CssClass="select2me" data-metodo="getcliente" DataTextField="NombreComercial" DataValueField="CveCliente"></ADS:Dropdownlost>
</li>
<li>Contrato:
<ADS:Dropdownlost ID="DdlContrato" runat="server" Width="230px" CssStyle="width: 100%;" UsaWebService="true" AppendDataBoundItems="true" CssClass="select2me" data-metodo="getcontratos" DataTextField="NumeroContrato" DataValueField="CveContrato">
</ADS:Dropdownlost>
</li>
<li>
Sucursal:
<asp:DropDownList ID="DdlSucursal" Width="230px" AppendDataBoundItems="true" runat="server" DataTextField="SubProyecto" DataValueField="CveSubProyecto" CssClass="form-control input-sm select2me">
<asp:ListItem Selected="True" Text="Todos" Value="-1"></asp:ListItem>
</asp:DropDownList>
</li>
</ul>
</div>
</div>
<div class="portlet-body" style="display:none">
<div class="row">
<label class="col-md-1">Fecha I.: </label>
<div class="col-md-2">
<div class="input-group input-sm date date-picker " data-date-format="dd/mm/yyyy" style="display: inline-block;">
<asp:TextBox ID="txtFechaI" runat="server" CssClass="form-control input-sm" CausesValidation="true" MaxLength="10" Width="82px "></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="imgCalendario" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
</div>
<ajax:MaskedEditExtender ID="MEEFechaI" runat="server" TargetControlID="txtFechaI" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="Calendario" TargetControlID="txtFechaI" PopupButtonID="ImgCalendario" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="rfvFechaI" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="cvFechaI" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="vcoFfvFI" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="vcoCvFI" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
<label class="col-md-1">Fecha F.: </label>
<div class="col-md-2">
<div class="input-group input-sm date date-picker " data-date-format="dd/mm/yyyy" style="display: inline-block;">
<asp:TextBox ID="txtFechaF" runat="server" CssClass="form-control input-sm" CausesValidation="true" MaxLength="10" Width="82px "></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="imgCalendarioF" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
</div>
<ajax:MaskedEditExtender ID="MEEFechaF" runat="server" TargetControlID="txtFechaF" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="Calendario2" TargetControlID="txtFechaF" PopupButtonID="imgCalendarioF" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="rfvFechaF" runat="server" ControlToValidate="txtFechaF" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="cvFechaF" runat="server" ControlToValidate="txtFechaF" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="vcoRfvFF" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaF" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="vcoCvFF" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaF" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel UpdateMode="Conditional" ID="UpGv" runat="server">
<ContentTemplate>
<div class="row">
<div class="col-md-12">
<asp:GridView ID="GvCiclosComerciales" runat="server" DataKeyNames="CveCicloComercial, NumeroContrato, CveSubProyecto, FechaVenc" AutoGenerateColumns="False" ShowHeader="True" EmptyDataText="No se encontraron pendientes por facturar" GridLines="none" ToolTip="Listado de Pendientes" CssClass="table table-striped table-hover Widthall">
<Columns>
<asp:TemplateField ItemStyle-HorizontalAlign="center" headertext="" ItemStyle-Width="10%">
<ItemTemplate>
<asp:CheckBox runat="server" ID="chkDis" />
</ItemTemplate>
</asp:TemplateField>
<asp:HyperLinkField DataTextField="NumeroContrato" DataNavigateUrlFields="CveContrato" DataNavigateUrlFormatString="/Contratos/Contrato.aspx?CveContrato={0}" HeaderText="Número Contrato" ItemStyle-Width="10%" Target="_blank" />
<asp:BoundField HeaderText="Descripción" DataField="DescripcionContrato" ItemStyle-CssClass="truncate" ItemStyle-Width="25%" />
<asp:HyperLinkField DataTextField="Cliente" HeaderText="Cliente" DataNavigateUrlFields="CveCliente" DataNavigateUrlFormatString="/Ventas/Clientes.aspx?CveCliente={0}" ItemStyle-Width="15%" Target="_blank" />
<asp:BoundField HeaderText="Fecha Factura" DataField="FechaVenc" DataFormatString="{0:d}" ItemStyle-Width="10%" />
<asp:BoundField HeaderText="Observación" DataField="Observaciones" ItemStyle-Width="10%" />
<asp:HyperLinkField Text="Ir" DataNavigateUrlFields="CveCicloComercial" HeaderText="Factura Manual" ItemStyle-Width="15%" Target="_blank" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveCicloComercial={0}" />
</Columns>
</asp:GridView>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<br />
<asp:UpdatePanel ID="upRecargar" runat="server">
<ContentTemplate>
<div class="row">
<div class="col-md-12">
<asp:LinkButton ID="btnFacturarAqui" runat="server" CssClass="btn btn-primary" style="float:right" onclientclick="javascript:$('#divAgregar').modal();return false;" Text="Facturar Seleccionadas" CausesValidation="False" />
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div id="divAgregar" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<asp:UpdatePanel ID="UpAgregar" class="modal-content rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="myModalLabel">Agregar Observación</h4>
</div>
<div class="modal-body">
<asp:UpdatePanel ID="UpBodyEstatus" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<div class="form-group form-md-line-input input-iconright" style="margin-bottom:5px">
<div class="row">
<div class="col-md-10">
<div class="form-group form-md-line-input input-iconright">
<label style="margin-bottom: 0; font-size: 13px; color: #888888; opacity: 1; bottom: auto;">Observación Adicional por Partida:</label>
<br />
<asp:TextBox ID="TxtObservaciones" CssClass="form-control" runat="server"></asp:TextBox>
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div class="modal-footer">
<asp:UpdatePanel ID="UpFooter" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:LinkButton ID="BtnFacturar" runat="server" Text="Facturar Ahora" CssClass="btn btn-primary" ValidationGroup="GrpObligatorio"></asp:LinkButton>
<button id="btnCancelar" data-dismiss="modal" class="btn btn-default">Cancelar</button>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" Runat="Server">
</asp:Content>
<ADS:Dropdownlost ID="DdlContrato" runat="server" Width="230px" CssStyle="width: 100%;" UsaWebService="true" AppendDataBoundItems="true" CssClass="select2me" data-metodo="getcontratos" DataTextField="NumeroContrato" DataValueField="CveContrato"></ADS:Dropdownlost>
</li>
<li>Sucursal:
<asp:DropDownList ID="DdlSucursal" Width="230px" AppendDataBoundItems="true" runat="server" DataTextField="SubProyecto" DataValueField="CveSubProyecto" CssClass="form-control input-sm select2me">
<asp:ListItem Selected="True" Text="Todos" Value="-1"></asp:ListItem>
</asp:DropDownList>
</li>
</ul>
</div>
</div>
<div class="portlet-body" style="display: none">
<div class="row">
<label class="col-md-1">Fecha I.: </label>
<div class="col-md-2">
<div class="input-group input-sm date date-picker " data-date-format="dd/mm/yyyy" style="display: inline-block;">
<asp:TextBox ID="txtFechaI" runat="server" CssClass="form-control input-sm" CausesValidation="true" MaxLength="10" Width="82px "></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="imgCalendario" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
</div>
<ajax:MaskedEditExtender ID="MEEFechaI" runat="server" TargetControlID="txtFechaI" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="Calendario" TargetControlID="txtFechaI" PopupButtonID="ImgCalendario" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="rfvFechaI" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="cvFechaI" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="vcoFfvFI" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="vcoCvFI" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
<label class="col-md-1">Fecha F.: </label>
<div class="col-md-2">
<div class="input-group input-sm date date-picker " data-date-format="dd/mm/yyyy" style="display: inline-block;">
<asp:TextBox ID="txtFechaF" runat="server" CssClass="form-control input-sm" CausesValidation="true" MaxLength="10" Width="82px "></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="imgCalendarioF" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
</div>
<ajax:MaskedEditExtender ID="MEEFechaF" runat="server" TargetControlID="txtFechaF" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="Calendario2" TargetControlID="txtFechaF" PopupButtonID="imgCalendarioF" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="rfvFechaF" runat="server" ControlToValidate="txtFechaF" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="cvFechaF" runat="server" ControlToValidate="txtFechaF" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="vcoRfvFF" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaF" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="vcoCvFF" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaF" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel UpdateMode="Conditional" ID="UpGv" runat="server">
<ContentTemplate>
<div class="row">
<div class="col-md-12">
<asp:GridView ID="GvCiclosComerciales" runat="server" DataKeyNames="CveCicloComercial, NumeroContrato, CveSubProyecto, FechaVenc" AutoGenerateColumns="False" ShowHeader="True" EmptyDataText="No se encontraron pendientes por facturar" GridLines="none" ToolTip="Listado de Pendientes" CssClass="table table-striped table-hover Widthall">
<Columns>
<asp:TemplateField ItemStyle-HorizontalAlign="center" HeaderText="" ItemStyle-Width="10%">
<ItemTemplate>
<asp:CheckBox runat="server" ID="chkDis" />
</ItemTemplate>
</asp:TemplateField>
<asp:HyperLinkField DataTextField="NumeroContrato" DataNavigateUrlFields="CveContrato" DataNavigateUrlFormatString="/Contratos/Contrato.aspx?CveContrato={0}" HeaderText="Número Contrato" ItemStyle-Width="10%" Target="_blank" />
<asp:BoundField HeaderText="Descripción" DataField="DescripcionContrato" ItemStyle-CssClass="truncate" ItemStyle-Width="25%" />
<asp:HyperLinkField DataTextField="Cliente" HeaderText="Cliente" DataNavigateUrlFields="CveCliente" DataNavigateUrlFormatString="/Ventas/Clientes.aspx?CveCliente={0}" ItemStyle-Width="15%" Target="_blank" />
<asp:BoundField HeaderText="Fecha Factura" DataField="FechaVenc" DataFormatString="{0:d}" ItemStyle-Width="10%" />
<asp:BoundField HeaderText="Observación" DataField="Observaciones" ItemStyle-Width="10%" />
<asp:HyperLinkField Text="Ir" DataNavigateUrlFields="CveCicloComercial" HeaderText="Factura Manual" ItemStyle-Width="15%" Target="_blank" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveCicloComercial={0}" />
</Columns>
</asp:GridView>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<br />
<asp:UpdatePanel ID="upRecargar" runat="server">
<ContentTemplate>
<div class="row">
<div class="col-md-12">
<asp:LinkButton ID="btnFacturarAqui" runat="server" CssClass="btn btn-primary" Style="float: right" OnClientClick="javascript:$('#divAgregar').modal();return false;" Text="Facturar Seleccionadas" CausesValidation="False" />
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div id="divAgregar" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<asp:UpdatePanel ID="UpAgregar" class="modal-content rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="myModalLabel">Agregar Observación</h4>
</div>
<div class="modal-body">
<asp:UpdatePanel ID="UpBodyEstatus" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<div class="form-group form-md-line-input input-iconright" style="margin-bottom: 5px">
<div class="row">
<div class="col-md-10">
<div class="form-group form-md-line-input input-iconright">
<label style="margin-bottom: 0; font-size: 13px; color: #888888; opacity: 1; bottom: auto;">Observación Adicional por Partida:</label>
<br />
<asp:TextBox ID="TxtObservaciones" CssClass="form-control" runat="server"></asp:TextBox>
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="modal-footer">
<asp:UpdatePanel ID="UpFooter" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:LinkButton ID="BtnFacturar" runat="server" Text="Facturar Ahora" CssClass="btn btn-primary" ValidationGroup="GrpObligatorio"></asp:LinkButton>
<button id="btnCancelar" data-dismiss="modal" class="btn btn-default">Cancelar</button>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
</asp:Content>

View File

@@ -202,22 +202,35 @@ Partial Class Contratos_FacturacionMasiva
RegistraScript("$('#ex').removeClass('expand');$('#ex').addClass('collapse');$('.portlet-body').css('display', '');")
End Sub
Protected Sub ImgFacturarTodos_Click(sender As Object, e As EventArgs) Handles BtnFacturar.Click
EjecutarFacturacion()
Protected Sub ImgFacturarTodos_Click(sender As Object, e As EventArgs) Handles ImgFacturarTodos.Click
EjecutarFacturacion(FacturarTodos:=True)
Dim CveContrato As Integer = If(DdlContrato.SelectedValue.ToEntero <= 0, -1, DdlContrato.SelectedValue.ToEntero)
Dim CveCliente As Integer = If(DdlCliente.SelectedValue.ToEntero <= 0, -1, DdlCliente.SelectedValue.ToEntero)
CargaDatos(CveContrato, CveCliente)
End Sub
Protected Sub btnFacturarAqui_Click(sender As Object, e As EventArgs) Handles BtnFacturar.Click
EjecutarFacturacion(FacturarTodos:=False)
Dim CveContrato As Integer = If(DdlContrato.SelectedValue.ToEntero <= 0, -1, DdlContrato.SelectedValue.ToEntero)
Dim CveCliente As Integer = If(DdlCliente.SelectedValue.ToEntero <= 0, -1, DdlCliente.SelectedValue.ToEntero)
CargaDatos(CveContrato, CveCliente)
RegistraScript("$('#divAgregar').modal('hide')")
UpBodyEstatus.Update()
End Sub
Private Sub EjecutarFacturacion()
Private Sub EjecutarFacturacion(Optional FacturarTodos As Boolean = False)
Dim FacturadoCorrecto = True
Dim sb As New StringBuilder()
For Each row As GridViewRow In GvCiclosComerciales.Rows
If row.FCCheckBox("chkDis").Checked Then
If FacturarTodos OrElse row.FCCheckBox("chkDis").Checked Then
Dim Resp = EmitirImprimir(row.DataKey("CveCicloComercial").ToString.ToEntero)
For Each Msg In Resp.Mensajes
sb.AppendFormat("{0}</br></br>", Msg)
Next
sb.AppendFormat("{0}</br></br>", Resp.Mensaje)
If Not FacturadoCorrecto Then
If Mensaje = "" Then
@@ -234,155 +247,75 @@ Partial Class Contratos_FacturacionMasiva
Else
Alert("No se generaron facturas", TipoMensaje.MsgAdvertencia)
End If
Dim CveContrato As Integer = If(DdlContrato.SelectedValue.ToEntero <= 0, -1, DdlContrato.SelectedValue.ToEntero)
Dim CveCliente As Integer = If(DdlCliente.SelectedValue.ToEntero <= 0, -1, DdlCliente.SelectedValue.ToEntero)
CargaDatos(CveContrato, CveCliente)
RegistraScript("$('#divAgregar').modal('hide')")
UpBodyEstatus.Update()
End Sub
Protected Sub btnFacturarAqui_Click(sender As Object, e As EventArgs)
EjecutarFacturacion()
End Sub
Private Function EmitirImprimir(pCveCicloComercial As Integer) As Modelos.Factura.MMensajeFactura
Dim Resp As New Modelos.Factura.MMensajeFactura
Private Function EmitirImprimir(pCveCicloComercial As Integer) As MMensajeFacturacion
Dim Retorno As New MMensajeFacturacion
ViewState("CveCicloComercial") = pCveCicloComercial
CreaObjetosVenta()
If ObjFactura Is Nothing Or ObjFactura.Cliente Is Nothing Then
Alert("Ocurrió un error al procesar los datos de la Venta.", TipoMensaje.MsgError)
ObjFactura = Nothing
Return Resp
Return Retorno
End If
If ObjFactura.CveCliente > 0 Then
If ObjFactura.DtDetalle.Rows.Count > 0 Then
Dim TieneError As Boolean = False
Dim RespFactura As Modelos.Factura.MMensajeFactura = Nothing
Try
RespFactura = ObjFactura.EmitirFactura(Timbrar:=False)
If RespFactura IsNot Nothing AndAlso RespFactura.CveVenta <= 0 OrElse RespFactura.TieneError Then
TieneError = True
End If
Catch ex As Exception
TieneError = True
OnError("Ocurrió un error al generar la factura", ex)
End Try
If Not TieneError AndAlso RespFactura.CveVenta > 0 Then
Retorno.CveVenta = RespFactura.CveVenta
Retorno.SerieFolio = RespFactura.SerieFolio
Retorno.SeTimbro = ObjFactura.TimbrarFactura()
End If
Dim SbMensajes As New StringBuilder
If Not TieneError Then
SbMensajes.AppendFormat("La factura <a class=""Texto"" target='_blank' href=""/Ventas/Ventas.aspx?CveVenta={0}"">{1}</a> se guardo correctamente.", Retorno.CveVenta, Retorno.SerieFolio)
If Not Retorno.SeTimbro Then
SbMensajes.AppendFormat("<br/> La factura no se pudo timbrar.")
End If
Else
SbMensajes.Append("Ocurrió un error al generar la factura.")
If RespFactura IsNot Nothing Then
For Each msg As String In RespFactura.Mensajes
SbMensajes.Append(msg)
Next
End If
End If
Retorno.Mensaje = SbMensajes.ToString()
Resp = ObjFactura.EmitirFactura()
'Dim ObjVentas As New ClsVentas()
'Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL())
'Dim ObjInventario As New ClsInventarios(ObjVentas.IniciaTransacSQL())
'Dim ObjContr As New ClsContratos(ObjVentas.IniciaTransacSQL())
'Dim ObjOS As New ClsOS(ObjVentas.IniciaTransacSQL())
'Dim ObjBancos As New ClsBancos(ObjVentas.IniciaTransacSQL())
'Dim ObjClientes As New ClsClientes(ObjVentas.IniciaTransacSQL())
'Dim ObjContPaq As ClsContPAQi = Nothing
''Dim ObjFolios As New ClsGralFolios(ObjVentas.IniciaTransacSQL())
'ErrorList = New List(Of String)
'MensajeAlert = New StringBuilder
''CONTABILIDAD AUTOMATICA Y AC
'If UsuarioActual.Empresa.UsaAC OrElse UsuarioActual.Empresa.Funcionalidad(200) = "1" Then
' ObjContPaq = New ClsContPAQi(UsuarioActual.Empresa)
'End If
''GUARDA VENTA
'GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjFactura, TmpDT, ObjFactura.CveNCaVincular, ObjContPaq, ObjBancos, ObjOS)
'If pCveCicloComercial > 0 AndAlso ErrorList.Count = 0 Then
' If Not ObjContr.CicloComercialUpdate(pCveCicloComercial, True, UsuarioActual.CveEmpresa) Then
' ErrorList.Add("No se pudo actualizar ")
' End If
'End If
'If ObjFactura.CveVenta > 0 AndAlso ErrorList.Count = 0 AndAlso (SeGuardoPrePoliza Or ObjFactura.TipoDocto.Contiene("Ped", "Cot")) Then
' ObjVentas.Commit()
' If ObjContPaq IsNot Nothing Then ObjContPaq.Commit()
' ViewState("CveVenta") = ObjFactura.CveVenta
' Dim SeTimbro As Boolean = False
' 'TIMBRADO Y CASO ESPECIAL NOTA DE CREDITO
' If ObjFactura.TipoDocto.Contiene("Ing", "Egs", "Ant") Then
' If UsuarioActual.Empresa.TipoFacturacion = "CFDi" AndAlso UsuarioActual.Empresa.FacturaProduccion Then
' Dim sw As New Diagnostics.Stopwatch
' sw.Start()
' 'FACTURA INGRESO/EGRESO
' Dim ObjTimbrado As New Timbrado
' SeTimbro = ObjTimbrado.TimbrarFactura(UsuarioActual, ObjFactura)
' sw.Stop()
' GuardaLogTimbrado(sw.ElapsedMilliseconds.ToString, UsuarioActual.Empresa.CvePAC)
' End If
' 'MENSAJE PRINCIPAL
' MensajeAlert.AppendFormat(String.Format("<br/>La {0}: <b>{1}</b> se generó correctamente.<br/><br/>", ObjFactura.TipoDocumento, ObjFactura.SerieFolio))
' If SeTimbro Then
' 'XML
' Dim ArchivoXML = String.Format("{0}/XML/{1}/{2}.xml", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto, ObjFactura.SerieFolio)
' If File.Exists(ArchivoXML) Then
' MensajeAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar XML</a></li></ul>", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", ObjFactura.CveVenta, "XML", ObjFactura.SerieFolio, ObjFactura.TipoDocto)))
' End If
' 'IMPRESION
' GeneraPDFFactura(False)
' Else
' MensajeAlert.AppendFormat("La factura no se pudo timbrar.</b> Por favor intentelo de nuevo a traves del boton Emitir o póngase en contacto con soporte técnico.")
' End If
' 'MUESTA ALERT OK
' Dim Liga = If(UsuarioActual.CveRol = 1165, "document.location.href=""/Ventas/Ventas.aspx?CveVenta=-1"";", $"document.location.href=""/Ventas/Clientes.aspx?CveCliente={ObjFactura.CveCliente}&Opt=3"";")
' retorno = True
' ObjFactura = Nothing
' Else
' ObjVentas.RollBack()
' If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack()
' For Each ErrorItem In ErrorList
' Alert(ErrorItem, TipoMensaje.MsgAdvertencia)
' Next
' 'MUESTA ALERT ERROR
' Alert("Ocurrió un error al procesar los datos. Por favor rectifique y vuelta a intentar.", TipoMensaje.MsgError)
' End If
' ObjVentas.Dispose()
' ObjConta.Dispose()
' ObjInventario.Dispose()
' ObjContr.Dispose()
' ErrorList = Nothing
' MensajeAlert = Nothing
' If ObjContPaq IsNot Nothing Then ObjContPaq.Dispose()
'Else
' ObjVentas.RollBack()
' If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack()
' For Each ErrorItem In ErrorList
' Alert(ErrorItem, TipoMensaje.MsgAdvertencia)
' Next
' 'MUESTA ALERT ERROR
' Alert("Ocurrió un error al procesar los datos. Por favor rectifique y vuelta a intentar.", TipoMensaje.MsgError)
' ObjVentas.Dispose()
' ObjConta.Dispose()
' ObjInventario.Dispose()
' ObjContr.Dispose()
' 'ObjFolios.Dispose()
' ErrorList = Nothing
' MensajeAlert = Nothing
' If ObjContPaq IsNot Nothing Then ObjContPaq.Dispose()
'End If
Else
Mensaje = "No se pudo completar facturación por que no se encontraron partidas "
Retorno.Mensaje = "No se pudo completar facturación por que no se encontraron partidas "
End If
End If
If ObjFactura IsNot Nothing Then
ObjFactura.Dispose()
End If
TmpDT.Clear()
Return Resp
Return Retorno
End Function
@@ -500,13 +433,13 @@ Partial Class Contratos_FacturacionMasiva
ObjFactura.Folio = -1
ObjFactura.Serie = "-1"
ObjFactura.CveMesa = -1
ObjFactura.Fecha = DR("FechaVenc").ToString.ToDate
ObjFactura.Fecha = DR("FechaVenc").ToString.ToDate 'If(DR("FechaVenc").ToString.ToDate > Now, Now, DR("FechaVenc").ToString.ToDate)
ObjFactura.CvePrePoliza = -1
ObjFactura.CveMetodoPago = 1
ObjFactura.MetodoPago = "Efectivo"
ObjFactura.FechaPago = DateTime.Today
ObjFactura.MotivoDescuento = ""
ObjFactura.Observaciones = TxtObservaciones.Text + " " + DR("Observaciones").ToString
ObjFactura.Observaciones = If(String.IsNullOrEmpty(TxtObservaciones.Text), "", TxtObservaciones.Text + " ") + DR("Observaciones").ToString
ObjFactura.FechaEjecucion = DateTime.Today
'ObjFactura.ClaveMetodoPagoSAT = GlobalDTMetodosPago.FiltroPrimeroValor("ClaveSAT", $"CveMetodoPago = {1}")
ObjFactura.UsuarioCreo = UsuarioActual.Usuario
@@ -643,7 +576,10 @@ Partial Class Contratos_FacturacionMasiva
ObjFactura.SetSubProyecto(Me)
ObjFactura.Timbre = PreParaTimbre(ObjFactura)
ObjFactura.FemsaFactura = New Modelos.FemsaFactura() With {
.AplicaFEMSA = False,
.FEMSA_Version = 1
}
End Sub
Private Function PreParaTimbre(Obj As Modelos.Factura) As CFDITimbre
@@ -769,372 +705,11 @@ Partial Class Contratos_FacturacionMasiva
Return Timbre
End Function
Private Sub GuardarVenta(ObjVentas As ClsVentas, ObjConta As ClsContabilidad, ObjInventario As ClsInventarios, ObjContr As ClsContratos, factura As Modelos.Factura, TmpDTDetalle As DataTable, CveNCaVincular As Integer, objContPaqi As ClsContPAQi, Optional ObjBancos As ClsBancos = Nothing, Optional ObjOS As ClsOS = Nothing)
Dim Msgok As New StringBuilder
Dim CveAlmacenTraspasoOrigen As Integer = -1
Dim CveAlmacenTraspasoDestino As Integer = -1
Dim EsDevolucionVenta = -1
Dim CveSubProyecto = TmpDTDetalle.Rows(0)("CveSubProyecto").ToString.ToEntero
factura.CvePrePoliza = ObjConta.AddPrePolizas("Contratos/FacturacionMasiva", factura.CvePlantillaPoliza, factura.Total, factura.Total, factura.CveMoneda, factura.Fecha, factura.Cliente.Nombre, factura.CveUsuario, factura.CveEmpresa)
If Not ObjVentas.AddVenta(factura.TipoDocto, factura.Folio, factura.CveCliente, factura.CveClienteSucursal, factura.SubTotalTC, factura.DescuentoTC,
factura.AmortizacionTC, factura.IVATC, factura.RetIVATC, factura.RetISRTC,
factura.TotalTC, factura.CveMoneda, factura.TipoCambio, factura.CveMetodoPago, factura.CondicionesPago, factura.FormaPago, factura.FechaPago, factura.Fecha, factura.MotivoDescuento,
factura.Observaciones, factura.FechaEjecucion, factura.CveVendedor, factura.Alfa1, factura.Alfa2,
factura.Alfa3, factura.Num1, factura.Num2, factura.Num3,
factura.Fech1, factura.Fech2, factura.Fech3, factura.CveCorte, factura.CveMesa, factura.NumeroPersonas, factura.CvePrePoliza, factura.CveUsuario, factura.CveEmpresa,
AtencionA:=factura.AtencionA, TelefonoGenerico:="", CveContrato:=factura.CveContrato, CveVentaPadre:=factura.CveVentaPadre, Det_FechaOrdenCompra:=factura.Det_FechaOrdenCompra, Det_OrdenCompra:=factura.Det_OrdenCompra, otros:=factura.Otros,
Entrega:="", Vigencia:=MinFecha,
CveAlmacenTraspasoDestino:=CveAlmacenTraspasoDestino, CveAlmacenTraspasoOrigen:=CveAlmacenTraspasoOrigen, CveDireccionEnvio:=-1, CveOC:=-1, IEPS:=factura.IEPSTC, Serie:=factura.Serie, CveCondicionEntrega:=-1,
PedidoContrato:="", CveSubProyecto:=CveSubProyecto, CveSubProyectoCobranza:=CveSubProyecto, CveSubProyectoEjecucion:=CveSubProyecto, CveFormaPago33:=factura.CveFormaPago33,
CveMetodoPago33:=factura.CveMetodoPago33, CveUsoCFDI:=factura.CveUsoCFDI) Then
ErrorList.Add("Ocurrió un error al Generar la Venta.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
End If
If ErrorList.Count = 0 AndAlso ObjVentas.CveVenta > 0 Then
factura.CveVenta = ObjVentas.CveVenta
factura.Serie = ObjVentas.Serie
factura.Folio = ObjVentas.Folio
ViewState("VentaFolio") = ObjVentas.SerieFolio
'Se agregan los PS
For Each Row As DataRow In TmpDTDetalle.Rows
Dim Observacion As String = Row("Observacion").ToString
If TxtObservaciones.Text.Trim <> "" Then
Observacion = $"{Observacion} {TxtObservaciones.Text}"
End If
If Not ObjVentas.AddVentaDetalle(ObjVentas.CveVenta, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDouble, Row("CveUM").ToString.ToEntero,
Row("PU").ToString.ToDouble(If(ObjFactura.ConvertirPesos, factura.TipoCambio, 1)), Row("IVA").ToString.ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)), Math.Round((Row("Total").ToString.ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)) * (1 + Row("IVA").ToString.ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)))), 6),
Observacion, 0, 0, Row("CveSubProyecto").ToString.ToEntero, -1,
TiempoEntrega:="", CveVentaDetallePadre:=-1, CveContratoDetalle:=Row("CveContratoDetalle").ToString.ToEntero, CvePromocionDetalle:=-1, IEPS:=Row("ImporteIEPS").ToString.ToDouble,
ImporteRetIVA:=Row("ImporteRetIVA").ToString.ToDouble, ImporteRetISR:=Row("ImporteRetISR").ToString.ToDouble,
PorcentajeIEPS:=Row("PorcentajeIEPS").ToString.ToDouble, PorcentajeRetIVA:=Row("PorcentajeRetIVA").ToString.ToDouble, PorcentajeRetISR:=Row("PorcentajeRetISR").ToString.ToDouble) Then
ErrorList.Add("Ocurrió un error al agregar un Producto o Servicio a la Factura.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
Exit For
Else
Dim TmpDr As DataRow = TmpDT.Select($"Consec = {Row("Consec").ToString}")(0)
TmpDr("CveVentaDetalle") = ObjVentas.CveVentaDetalle
End If
Next
GuardarContratoAvanceEstimaciones(ObjVentas, factura, ErrorList, 1)
If ErrorList.Count = 0 Then
'prepoliza
GuardarVentaPrePolizas(ObjConta, factura, TmpDTDetalle, CveNCaVincular, objContPaqi, ObjBancos, ObjVentas)
End If
End If
End Sub
Private Sub GuardarVentaPrePolizas(ObjConta As ClsContabilidad, factura As Modelos.Factura, TmpDTDetalleMovimientos As DataTable, CveNCaVincular As Integer, objContPaqi As ClsContPAQi, Optional ObjBancos As ClsBancos = Nothing, ByRef Optional ObjVentas As ClsVentas = Nothing)
Dim CveIE As Integer = -1
Dim DT As DataTable = Nothing
Dim CveConceptoAfectacion As Integer = 1 'Cliente
Dim CveConceptoAntCli As Integer = 3 'Anticipo Cliente
Dim CveConceptoVenta As Integer = 4 'Venta
Dim CveConceptoCanAnt As Integer = 11 'Cancelacion Anticipos
Dim CveConceptoDSV As Integer = 12 ' DSV
Dim CveConceptoIVA As Integer = 13 'IVA Trasladado
Dim CveConceptoRetIVA As Integer = 8 'Ret IVA
Dim CveConceptoRetISR As Integer = 9 'Ret ISR
'P R E P O L I Z A S
If factura.CvePrePoliza > 0 Then
If ProcesoPrepolizas(ObjConta, factura, CveIE, TmpDTDetalleMovimientos, objContPaqi, 1, ObjBancos, ObjVentas) Then
ErrorList.Add("Ocurrió un error al agregar los Movimientos de la prepoliza.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
End If
Else
ErrorList.Add("Ocurrió un error al agregar los Movimientos de la prepoliza.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
End If
End Sub
Private Function ProcesoPrepolizas(ObjConta As ClsContabilidad, ObjFactura As Modelos.Factura, CveIE As Integer, TmpDTDetalle As DataTable, objContPaqi As ClsContPAQi, Optional ValorMultiplicador As Integer = 1, ByRef Optional ObjBancos As ClsBancos = Nothing, ByRef Optional ObjVentas As ClsVentas = Nothing) As Boolean
Dim DT As DataTable
Dim CvePlantilaPoliza As Integer
Dim PorcentajeAmortizacion As Decimal = 0
Dim sumaAmorticaciones As Decimal = 0
Dim ivaTrasladado As Decimal = 0
Dim retIvaTrasladado As Decimal = 0
Dim retIsrTrasladado As Decimal = 0
Dim ErrorPrepoliza As Boolean = False
Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:<br><br>"
Dim idCuentaContabilizacion As Integer = 1
Dim tipoCambio As Decimal
Dim CuentasContablesInvalidas As New StringBuilder
If ObjFactura.TipoDocto = "Ing" Or ObjFactura.TipoDocto = "Ant" Or ObjFactura.TipoDocto = "Com" Then
CvePlantilaPoliza = 4
ElseIf ObjFactura.TipoDocto.Contiene("Egs", "Dev") Then
CvePlantilaPoliza = 7
ElseIf ObjFactura.TipoDocto = "Rem" Then
CvePlantilaPoliza = 4
End If
If ObjFactura.CveMoneda = 2 Then
tipoCambio = GlobalTipoCambio(ObjFactura.Fecha).ToString.ToDecimal
Else
tipoCambio = 1
End If
Dim ConceptoContable As Integer
Dim TipoMovimiento As Boolean
Dim importeMovimiento As Decimal
Dim FechaMovimiento As Date = Date.Today
Dim IdCtaContable As Integer
Dim CveCuenta As Integer
Dim IdCtaContableCliente As Integer
Dim Concepto As String = ViewState("VentaFolio").ToString
Dim Referencia As String = ViewState("VentaFolio").ToString
Dim Fecha = ObjFactura.Fecha
Dim importeMX As Decimal
Dim Multiplicador As Integer
'Dim CveIEPago As Integer
' Dim FolioIE As Long
If ObjConta.GetPlantillaConceptos(ObjFactura.CveEmpresa, CvePlantilaPoliza) Then
For Each Row As DataRow In ObjConta.DtResultados.Rows
ConceptoContable = Row("CveConcepto").ToString.ToEntero
TipoMovimiento = If(Row("TipoMovto").ToString = "True", True, False)
importeMovimiento = 0
IdCtaContable = 0
CveCuenta = 0
Multiplicador = (Row("Multiplicador").ToString.ToEntero)
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, ConceptoContable, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", "")
Dim PorcentajeImpuesto As Decimal = 0
Select Case ConceptoContable
Case 1 'Cliente
If ObjFactura.TipoDocto <> "Egs" Then
importeMovimiento = (ObjFactura.Total) * ValorMultiplicador
importeMX = importeMovimiento * tipoCambio * Multiplicador
FechaMovimiento = ObjFactura.FechaPago
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
If tipoCambio = 1 Then
IdCtaContable = ObjFactura.Cliente.IdCtaContClientes
Else
IdCtaContable = ObjFactura.Cliente.IdCtaContComplementaria
If importeMovimiento <> 0 AndAlso IdCtaContable > 0 Then
importeMX = importeMovimiento
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, 0, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMovimiento * tipoCambio - importeMovimiento, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento)) Then
ErrorPrepoliza = True
End If
End If
IdCtaContable = ObjFactura.Cliente.IdCtaContMonedaExtranjera
End If
IdCtaContableCliente = IdCtaContable
End If
Case 4 'Venta Clasificacion
If ObjFactura.TipoDocto <> "Ant" Then
DT = TmpDTDetalle.FiltraParametros($"CvePS <> {0}", "", {"CveClasificacion", "CveSubProyecto"})
If DT.Rows.Count > 0 Then
'Se agrega movimiento separado por la cuenta de ventas (ER)
For Each Row2 As DataRow In DT.Rows
importeMovimiento = (TmpDTDetalle.SUM("Total", String.Format("CveClasificacion = {0} AND CveSubProyecto = {1}", Row2("CveClasificacion"), Row2("CveSubProyecto"))).ToString.ToDecimal) * ValorMultiplicador
importeMX = importeMovimiento * tipoCambio * Multiplicador
FechaMovimiento = ObjFactura.FechaPago
Concepto = $"{ViewState("VentaFolio").ToString} {If(Row2("CveClasificacion").ToString.ToEntero > 0, GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString}"), "")} - {If(Row2("CveSubProyecto").ToString.ToEntero > 0, GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa).FiltroPrimeroValor("SubProyecto", $"CveSubProyecto = {Row2("CveSubProyecto").ToString}"), "Sin SubProyecto Asignado")}"
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
IdCtaContable = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaIngresos", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero
If importeMovimiento <> 0 Then
If IdCtaContable <= 0 Then
CuentasContablesInvalidas.Append("<br>" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString + GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString}"))
idCuentaContabilizacion = 0
End If
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, CveClasificacion:=Row2("CveClasificacion").ToString.ToEntero, CveSubProyecto:=Row2("CveSubProyecto").ToString.ToEntero, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento)) Then
ErrorPrepoliza = True
Else
ViewState("SeGuardoPrePoliza") = True
End If
End If
Next
End If
End If
importeMovimiento = 0
Case 8 'Ret IVA por Trasladar
If Not ObjFactura.TipoDocto.Contiene("Rem") Then
importeMovimiento = ObjFactura.RetIVA * ValorMultiplicador
importeMX = Math.Round(importeMovimiento, 2) * tipoCambio * Multiplicador
FechaMovimiento = ObjFactura.FechaPago
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
'Contabilidad ContPAQ
If IdCtaContRetIVA > 0 Then
IdCtaContable = IdCtaContRetIVA
Else
If ObjConta.GetRetCuenta(ConceptoContable, ObjFactura.CveEmpresa) Then
If ObjConta.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero
End If
End If
End If
'Contabilidad SIG
If CveCuentaRetIVA > 0 Then
CveCuenta = CveCuentaRetIVA
Else
If ObjConta.GetRetCuenta(ConceptoContable, ObjFactura.CveEmpresa) Then
If ObjConta.DtResultados.Rows.Count > 0 Then
CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacionSIG").ToString.ToEntero
End If
End If
End If
End If
Case 9 'Ret ISR por Trasladar
If Not ObjFactura.TipoDocto.Contiene("Rem") Then
importeMovimiento = ObjFactura.RetISR * ValorMultiplicador
importeMX = Math.Round(importeMovimiento, 2) * tipoCambio * Multiplicador
FechaMovimiento = ObjFactura.FechaPago
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
'Contabilidad ContPAQ
If IdCtaContRetISR > 0 Then
IdCtaContable = IdCtaContRetISR
Else
If ObjConta.GetRetCuenta(ConceptoContable, ObjFactura.CveEmpresa) Then
If ObjConta.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero
End If
End If
End If
'Contabilidad SIG
If CveCuentaRetISR > 0 Then
CveCuenta = CveCuentaRetISR
Else
If ObjConta.GetRetCuenta(ConceptoContable, ObjFactura.CveEmpresa) Then
If ObjConta.DtResultados.Rows.Count > 0 Then
CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString.ToEntero
End If
End If
End If
End If
Case 13 'Iva por Trasladar
importeMovimiento = ObjFactura.IVA * ValorMultiplicador
importeMX = Math.Round(importeMovimiento, 2) * tipoCambio * Multiplicador
FechaMovimiento = ObjFactura.FechaPago
IdCtaContable = UsuarioActual.Empresa.IdCuentaIVAxTrasladar
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
PorcentajeImpuesto = TmpDTDetalle.MAX("PorcentajeIVA").ToDecimal
Case 38 'IEPS por Trasladar
If Not ObjFactura.TipoDocto.Contiene("Rem") Then
importeMovimiento = ObjFactura.IEPS * ValorMultiplicador
importeMX = Math.Round(importeMovimiento * tipoCambio * Multiplicador, 2)
FechaMovimiento = ObjFactura.Fecha
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
If importeMovimiento > 0 AndAlso ObjConta.GetRetCuenta(ConceptoContable, ObjFactura.CveEmpresa) Then
If ObjConta.DtResultados.Rows.Count > 0 Then
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSxTrasladar").ToString.ToEntero
CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSxTrasladarSIG").ToString.ToEntero
End If
End If
PorcentajeImpuesto = TmpDTDetalle.MAX("PorcentajeIEPS").ToDecimal
End If
End Select
If importeMovimiento <> 0 Then
If IdCtaContable <= 0 Then
CuentasContablesInvalidas.Append("<br>" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString)
idCuentaContabilizacion = 0
End If
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), PorcentajeImpuesto:=PorcentajeImpuesto) Then
ErrorPrepoliza = True
Else
ViewState("SeGuardoPrePoliza") = True
End If
End If
Next
End If
Return ErrorPrepoliza
End Function
Private Sub GeneraPDFFactura(EnviaCorreo As Boolean)
'If Not ImprimeAlert Then
Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/Factura.rdlc", UsuarioActual.Empresa.Ruta))
Dim Archivo2 As New System.IO.FileInfo(String.Format("{0}Formatos/Remision.rdlc", UsuarioActual.Empresa.Ruta))
'CASO NORMAL NEW
If Archivo.Exists Or Archivo2.Exists Then
MensajeAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF</a></li></ul><br/>", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1", ObjFactura.CveVenta)))
Else
MensajeAlert.Append("Ocurrió un error al generar el PDF. Por favor vuelva a entrar a la factura para imprimir el PDF. ")
End If
Dim pdf As Byte() = Nothing
'GUARDA PDF
Dim LocalSerieFolio As String = String.Empty
Dim LocalTipoDocto As String = String.Empty
'TIMBRADO NUEVO
Try
pdf = PdfFactura(ObjFactura)
' File.WriteAllBytes(String.Format("{0}PDF/{1}/{2}.pdf", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto, ObjFactura.SerieFolio), pdf)
Catch ex As Exception
Alert("Ocurrió un error al generar el PDF", TipoMensaje.MsgAdvertencia)
End Try
LocalSerieFolio = ObjFactura.SerieFolio
LocalTipoDocto = ObjFactura.TipoDocto
'End If
End Sub
Private Sub GuardarContratoAvanceEstimaciones(ObjVentas As ClsVentas, factura As Modelos.Factura, ErrorList As List(Of String), Multiplicador As Integer, Optional CrearAvance As Boolean = False)
If factura.CveContrato > 0 Then
Dim ObjContratos As New ClsContratos(ObjVentas.IniciaTransacSQL())
Dim CveEstimacion As Integer = -1
If ObjContratos.AddEstimaciones(factura.CveContrato, factura.Fecha, -1, factura.CveVenta, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
CveEstimacion = ObjContratos.DtResultados(0)("CveEstimacion").ToString.ToEntero
For Each row As DataRow In TmpDT.Rows
If Not ObjContratos.AddContratosAvance(row("CveContratoDetalle").ToString.ToEntero, row("Cantidad").ToString.ToEntero * Multiplicador, factura.Fecha, UsuarioActual.CveUsuario, CveEstimacion:=CveEstimacion) Then
ErrorList.Add("Ocurrió un error al agregar los avances")
End If
Next
Else
ErrorList.Add("Ocurrió un error al agregar las estimaciones")
End If
End If
End Sub
Public Class MMensajeFacturacion
Public Property CveVenta As Integer = -1
Public Property SerieFolio As String = ""
Public Property Mensaje As String = ""
Public Property SeTimbro As Boolean = False
End Class
End Class

View File

@@ -28,7 +28,7 @@ public partial class GPS_CatEstatusTrayectos : ClsPaginas
{
if (ObjGPS.GetEstatusTrayectos(-1, UsuarioActual.CveCliente))
{
DtEstatus = ObjGPS.DtResultados;
DtEstatus = ObjGPS.DtResultados.FiltraParametros("CveCliente > 0");
GvEstatus.DataSource = DtEstatus;
GvEstatus.DataBind();
CargaEstatus();

View File

@@ -1599,16 +1599,60 @@ Partial Class GPS_Rastreo
Else
Dim filtros As String = $"Fechas: {FechaI.ToString("dd/MM/yyyy")} a {FechaF.ToString("dd/MM/yyyy")}"
If DtDatos.Rows.Count > 0 AndAlso String.IsNullOrEmpty(DtDatos.Rows(0)("Vehiculo").ToString()) Then
DtDatos.Rows(0)("Vehiculo") = "Total Kilometros Recorridos"
Dim DtImprimir As DataTable = DtDatos.Copy
'DtImprimir.Columns.Add("DistSTR", GetType(String))
'DtImprimir.Columns.Add("TiempoOperativoSTR", GetType(String))
'DtImprimir.Columns.Add("TiempoOperativoHRSTR", GetType(String))
If DtImprimir.Rows.Count > 0 AndAlso String.IsNullOrEmpty(DtImprimir.Rows(0)("Vehiculo").ToString()) Then
DtImprimir.Rows(0)("Vehiculo") = "Total Kilometros Recorridos"
'DtImprimir.Rows(0)("TiempoOperativoSTR") = Decimal.Round(DtImprimir.SUM("TiempoOperativo", "Vehiculo IS NOT NULL").ToDecimal / 60, 1).ToString("###,###,##0.##")
'DtImprimir.Rows(0)("TiempoOperativoHRSTR") = Decimal.Round(DtImprimir.SUM("TiempoOperativo", "Vehiculo IS NOT NULL").ToDecimal, 1).ToString("#,##0.##")
'DtImprimir.Rows(0)("DistSTR") = Decimal.Round(DtImprimir.SUM("Dist", "Vehiculo IS NOT NULL").ToDecimal, 2).ToString("###,###,##0.00")
'For Each Row As DataRow In DtImprimir.Rows
' Row("TiempoOperativoSTR") = Decimal.Round(Row("TiempoOperativo").ToString().ToDecimal(), 1).ToString("N2")
' Row("TiempoOperativoHRSTR") = Decimal.Round(Row("TiempoOperativoHR").ToString().ToDecimal(), 1).ToString("N2")
' Row("DistSTR") = Decimal.Round(Row("Dist").ToString().ToDecimal(), 1).ToString("N2")
'Next
'e.Row.Cells(1).Text = $"{Decimal.Round(DtDatos.SUM("TiempoOperativo", "Vehiculo IS NOT NULL").ToDecimal / 60, 1).ToString("###,###,##0.##")} Hrs ({DtDatos.SUM("TiempoOperativo", "Vehiculo IS NOT NULL").ToDecimal.ToString("#,##0.##")} minutos)"
DtImprimir.Rows(0)("Dist") = DtDatos.SUM("Dist", "Vehiculo IS NOT NULL").ToDecimal
DtImprimir.Rows(0)("TiempoOperativo") = DtDatos.SUM("TiempoOperativo", "Vehiculo IS NOT NULL").ToDecimal
DtImprimir.Rows(0)("TiempoOperativoHR") = DtDatos.SUM("TiempoOperativoHR", "Vehiculo IS NOT NULL").ToDecimal
'DtImprimir.Rows(0)("TiempoOperativo") = Decimal.Round(DtImprimir.SUM("TiempoOperativo", "Vehiculo IS NOT NULL").ToDecimal, 1)
'DtImprimir.Rows(0)("TiempoOperativoHR") = Decimal.Round(DtImprimir.SUM("TiempoOperativoHR", "Vehiculo IS NOT NULL").ToDecimal, 1)
'DtImprimir.Rows(0)("Dist") = Decimal.Round(DtImprimir.SUM("Dist", "Vehiculo IS NOT NULL").ToDecimal, 2)
For Each Row As DataRow In DtImprimir.Rows
Row("TiempoOperativo") = Decimal.Round(Row("TiempoOperativo").ToString().ToDecimal(), 1).ToString("N2")
Row("TiempoOperativoHR") = Decimal.Round(Row("TiempoOperativoHR").ToString().ToDecimal(), 1).ToString("N2")
Row("Dist") = Decimal.Round(Row("Dist").ToString().ToDecimal(), 1).ToString("N2")
Next
End If
DtDatos.Columns.RemoveAt(0)
DtDatos.Columns("Vehiculo").ColumnName = "Vehículo"
DtDatos.Columns("TiempoOperativo").ColumnName = "Tiempo Operativo"
DtDatos.Columns("Dist").ColumnName = "Kilometros Recorridos"
DtImprimir.Columns.RemoveAt(0)
DtImprimir.Columns("Vehiculo").ColumnName = "Vehículo"
ImprimirExcelG(DtDatos, "ReporteKMRecorridos.xlsx", "Reporte de Kilometros Recorridos", filtros, NombreHoja:="RepKM")
'DtImprimir.Columns.Remove(DtImprimir.Columns("TiempoOperativoHR"))
'DtImprimir.Columns.Remove(DtImprimir.Columns("TiempoOperativo"))
'DtImprimir.Columns.Remove(DtImprimir.Columns("Dist"))
'DtImprimir.Columns("TiempoOperativoHRSTR").ColumnName = "Tiempo Operativo (HR)"
'DtImprimir.Columns("TiempoOperativoSTR").ColumnName = "Tiempo Operativo (Min)"
'DtImprimir.Columns("DistSTR").ColumnName = "Kilometros Recorridos"
DtImprimir.Columns("TiempoOperativoHR").ColumnName = "Tiempo Operativo (HR)"
DtImprimir.Columns("TiempoOperativo").ColumnName = "Tiempo Operativo (Min)"
DtImprimir.Columns("Dist").ColumnName = "Kilometros Recorridos"
ImprimirExcelG(DtImprimir, "ReporteKMRecorridos.xlsx", "Reporte de Kilometros Recorridos", filtros, NombreHoja:="RepKM")
DtImprimir.Dispose()
End If
Else

View File

@@ -36,9 +36,12 @@
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
<asp:UpdatePanel runat="server" UpdateMode="Conditional">
<ContentTemplate>
<li>
<li>
<asp:LinkButton runat="server" ID="BtnTerminarTrayeto" OnClick="BtnTerminarTrayeto_Click"><i class="fa fa-map-marker"></i>Terminar Trayecto</asp:LinkButton>
</li>
</li>
<li>
<asp:LinkButton runat="server" ID="LnkActualizarEstatus" OnClick="LnkActualizarEstatus_Click"><i class="fa fa-refresh"></i>Actualizar al estatus siguiente</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="LnkAgregar" OnClick="LnkAgregar_Click" runat="server"><i class="fa fa-plus"></i>Agregar Gasto</asp:LinkButton>
</li>
@@ -223,6 +226,16 @@
<div class="col-md-4 v-center">
<asp:Literal ID="LtlExcesosVelo" runat="server"></asp:Literal>
</div>
<div class="col-md-2 v-center">
<b>
<asp:Literal runat="server" Text="Tiempo Estimado:"></asp:Literal></b>
</div>
<div class="col-md-3 v-center">
<asp:Label ID="LblETA" runat="server" ClientIDMode="Static"></asp:Label>
</div>
<div class="col-md-1 v-center">
<asp:LinkButton ID="BtnRecalcular" runat="server" Text="" OnClick="BtnRecalcular_Click" CssClass="btn btn-sm btn-circle btn-primary" ><i class='fa fa-refresh' aria-hidden='true'></i></asp:LinkButton>
</div>
</div>
</div>
</div>
@@ -469,7 +482,7 @@
</div>
<div class="portlet-body form">
<div style="max-height: 392px; overflow-y: scroll">
<asp:GridView ID="GvGastos" runat="server" GridLines="None" CssClass="table table-striped table-advance table-hover Widthall ScrollAD"
<asp:GridView ID="GvGastos" runat="server" GridLines="None" CssClass="table table-striped table-advance table-hover Widthall ScrollAD"
data-sort="true" data-rows="1" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros" OnRowDataBound="GvGastos_RowDataBound">
<Columns>
<asp:BoundField DataField="Cantidad" HeaderText="Cantidad" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Left" />
@@ -547,28 +560,70 @@
</ContentTemplate>
</asp:UpdatePanel>
</div>
<asp:Button ID="BtnRefrescarPagina" runat="server" ClientIDMode="Static" Text="Refrescar" Style="display: none;" />
</asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
<script type="text/javascript">
var map;
function initMap() {
map = new google.maps.Map(document.getElementById('map'), {
center: { lat: 29.0730, lng: -110.9559 },
zoom: 7
});
}
var polylines = [];
var polygons = [];
var polybounds = [];
var markers = [];
var GeoReferencias = []
var GeoReferencias = [];
var posicionesETA = [];
var lastOpenedInfoWindow;
var directionsDisplay;
var posInicio, posFin;
function initMap() {
polylines = [];
polygons = [];
polybounds = [];
markers = [];
GeoReferencias = [];
posicionesETA = [];
map = new google.maps.Map(document.getElementById('map'), {
center: { lat: 29.0730, lng: -110.9559 },
zoom: 7
});
//CalcularRuta();
}
function RefrescarPagina() {
$('#BtnRefrescarPagina').click();
}
function CalcularRuta() {
var origin1 = new google.maps.LatLng(55.930385, -3.118425);
var destinationA = 'Stockholm, Sweden';
var destinationB = new google.maps.LatLng(50.087692, 14.421150);
var service = new google.maps.DistanceMatrixService();
service.getDistanceMatrix(
{
origins: [origin1],
destinations: [destinationA, destinationB],
travelMode: 'DRIVING'
//transitOptions: TransitOptions,
//drivingOptions: DrivingOptions,
//unitSystem: UnitSystem,
//avoidHighways: Boolean,
//avoidTolls: Boolean,
}, callback);
function callback(response, status) {
if (status !== "OK") {
alert("Error was: " + status);
} else {
alert(JSON.stringify(response));
}
}
}
//$(document).ready(function () {
// initMap();
// DeleteMarkers();
//});
function DeleteMarkers() {
for (var i = 0; i < markers.length; i++) {
markers[i].setMap(null);
@@ -582,13 +637,14 @@
directionsDisplay.setMap(null);
}
}
function doScaledCLick(boton) {
setTimeout(function () {
$(boton).click();
}, 250);
}
function creaPoligono(coords, color, Geocerca, Estatus, InicioFin, CveEstatus, CveEstatusAnterior) {
function creaPoligono(coords, color, Geocerca, Estatus, InicioFin, CveEstatus, CveEstatusAnterior, cruzo) {
var polygon = new google.maps.Polygon({
paths: coords,
strokeColor: color,
@@ -600,11 +656,10 @@
polygon.setMap(map);
polygons.push(polygon);
CreaMarcadorPoligono(coords, Geocerca, Estatus, InicioFin, CveEstatus, CveEstatusAnterior)
CreaMarcadorPoligono(coords, Geocerca, Estatus, InicioFin, CveEstatus, CveEstatusAnterior, cruzo)
}
var posInicio, posFin;
function CreaMarcadorPoligono(coords, GeoCerca, Estatus, InicioFin, CveEstatus, CveEstatusAnterior) {
function CreaMarcadorPoligono(coords, GeoCerca, Estatus, InicioFin, CveEstatus, CveEstatusAnterior, cruzo) {
var bounds = new google.maps.LatLngBounds();
for (i = 0; i < coords.length; i++) {
bounds.extend(coords[i]);
@@ -629,6 +684,12 @@
calculateAndDisplayRoute(directionsService, directionsDisplay, posInicio, posFin);
}
if (cruzo == "0") {
var center = bounds.getCenter();
posicionesETA.push({ lat: center.lat(), lng: center.lng() });
}
var marker = new google.maps.Marker({
position: bounds.getCenter(),
title: GeoCerca,
@@ -647,6 +708,7 @@
markers.push(marker);
}
function calculateAndDisplayRoute(directionsService, directionsDisplay, pointA, pointB) {
var waypts = [];
var orden = GeoReferencias.sort((a, b) => parseInt(a.CveEstatusAnterior) - parseInt(b.CveEstatusAnterior));
@@ -669,6 +731,7 @@
}
});
}
function CenterPoligono(coords) {
var bounds = new google.maps.LatLngBounds();
for (i = 0; i < coords.length; i++) {
@@ -706,6 +769,29 @@
map.fitBounds(bounds)
}
function CreaMarcadorPI(coords, nomPunto, ContentString) {
var marker = new google.maps.Marker({
position: coords,
title: nomPunto,
map: map
});
var infowindow = new google.maps.InfoWindow({
content: ContentString
});
marker.addListener('click', function () {
closeLastOpenedInfoWindow();
infowindow.open(map, marker);
lastOpenedInfoWindow = infowindow;
});
markers.push(marker);
if (markers.length > 1) {
fitBoundsToVisibleMarkers()
} else if (markers.length === 1) {
map.setZoom(15);
map.setCenter(coords);
}
}
function CreaMarcador(coords, nomEquipo, ContentString, imagen) {
//setTimeout(function () {
@@ -729,7 +815,7 @@
lastOpenedInfoWindow = infowindow;
});
markers.push(marker);
posicionesETA.push(coords);
}
function creaPolyline(coords, color, GeoCerca) {
@@ -782,7 +868,97 @@
}
function CreaCirculo(coords, color) {
//var Circle = new google.maps.Circle({
// strokeColor: color,
// strokeOpacity: 0.8,
// strokeWeight: 2,
// fillColor: color,
// fillOpacity: 0.35,
// map: map,
// center: coords,
// radius: 15
//});
var Circle = new google.maps.Marker({
position: coords,
icon: {
path: google.maps.SymbolPath.CIRCLE,
scale: 10,
fillColor: color,
fillOpacity: 0.35,
strokeWeight: 2,
strokeColor: color,
strokeOpacity: 0.8
},
map: map
});
circles.push(Circle);
}
function CalcularETA() {
if (posicionesETA.length > 1) {
var latlongs = [];
var destinations = [];
var sources = [];
for (var i = 0; i < posicionesETA.length; i++) {
latlongs.push([posicionesETA[i].lng, posicionesETA[i].lat]);
if (i > 0) {
destinations.push(i);
}
if (i < posicionesETA.length - 1) {
sources.push(i);
}
}
const body = { locations: latlongs, destinations: destinations, sources: sources, resolve_locations: true };
fetch('https://api.openrouteservice.org/v2/matrix/driving-car', {
method: 'POST', // or 'PUT'
headers: {
'Content-Type': 'application/json',
'Authorization': '5b3ce3597851110001cf624839503f1e326e4ab8aa8a27afbcf30f6a'
},
body: JSON.stringify(body),
})
.then(response => response.json())
.then(data => {
let duracionTotal = 0;
if (data.durations.length > 0) {
for (var j = 0; j < data.durations.length; j++) {
let duracionPunto = data.durations[j][j]
duracionTotal += duracionPunto;
}
}
LblETA.innerText = formatETA(duracionTotal);
})
.catch((error) => {
alert('Error:' + error);
});
}
}
function formatETA(time) {
// Hours, minutes and seconds
var hrs = ~~(time / 3600);
var mins = ~~((time % 3600) / 60);
var secs = ~~time % 60;
// Output like "1:01" or "4:03:59" or "123:03:59"
var ret = "";
if (hrs > 0) {
ret += "" + hrs + " horas " + (mins < 10 ? "0" : "");
}
ret += "" + mins + " minutos " + (secs < 10 ? "0" : "");
ret += "" + secs + " segundos";
return ret;
}
</script>
<script src="<%= String.Format("https://maps.googleapis.com/maps/api/js?key={0}&libraries=places", Extensiones.GOOGLE_MAPS_API_KEY) %>"></script>
</asp:Content>

View File

@@ -9,10 +9,12 @@ Imports Microsoft.Reporting.WebForms
Imports Newtonsoft.Json.Linq
Imports System.Linq
Imports System.Net.Http
Imports System.Net.Http.Headers
Imports Newtonsoft.Json
Partial Class GPS_TrayectoDetalle
Inherits ClsPaginas
Inherits ClsPaginas
#Region "P R O P I E D A D E S"
Private Property DtGeocercas As DataTable
Get
@@ -29,9 +31,8 @@ Partial Class GPS_TrayectoDetalle
Set(value As DataTable)
ViewState("DtPosiciones") = value
End Set
End Property
#End Region
End Property
Private Property CveTrayecto As Integer
Get
Return CType(ViewState("CveTrayecto"), Integer)
@@ -39,8 +40,20 @@ Partial Class GPS_TrayectoDetalle
Set(value As Integer)
ViewState("CveTrayecto") = value
End Set
End Property
End Property
Private Property CveEstatusActual As Integer
Get
Return CType(ViewState("CveEstatusActual"), Integer)
End Get
Set(value As Integer)
ViewState("CveEstatusActual") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
DirectCast(Master.FindControl("TSM"), ScriptManager).EnablePageMethods = True
@@ -52,102 +65,205 @@ Partial Class GPS_TrayectoDetalle
End If
End Sub
Private Sub CargaTrayectoHistorial(CveTrayecto As Integer)
Dim ObjGPS As New ClsGPS
Try
If CveTrayecto > 0 Then
RegistraScript("initMap();")
If ObjGPS.GetTrayectosEstatusHistorial(CveTrayecto) Then
Dim Direcciones = ConsultarDirecciones(ObjGPS.DtResultados)
For Each Dir As JObject In Direcciones
ObjGPS.DtResultados.Rows(Dir("Indice").ToEntero())("Direccion") = Dir("Direccion").ToString()
Next
GvEstatus.DataSource = ObjGPS.DtResultados
GvEstatus.DataBind()
End If
If ObjGPS.GetTrayectosDatos(CveTrayecto) Then
Dim DtDatos = ObjGPS.DtSetResultados.Tables(0)
If DtDatos.Rows.Count > 0 Then
Dim RowEstatus As DataRow = DtDatos.Rows(0)
LblTitulo.Text = $"Trayecto: {RowEstatus("Trayecto")}"
LtlEstatusActual.Text = RowEstatus("Estatus").ToString()
LtlDispositivo.Text = RowEstatus("Vehiculo").ToString()
LtlFechaI.Text = If(String.IsNullOrEmpty(RowEstatus("FechaInicio").ToString()), "No ha ingresado a la geocerca de inicio", String.Format("{0:dd/MM/yyyy HH:mm tt}", RowEstatus("FechaInicio").ToString().ToDateTime()))
LtlFechaF.Text = If(String.IsNullOrEmpty(RowEstatus("FechaFin").ToString()), "No ha Terminado", String.Format("{0:dd/MM/yyyy HH:mm tt}", RowEstatus("FechaFin").ToString().ToDateTime()))
LtlVMedia.Text = String.Format("{0:N2} KM/H", RowEstatus("VMedia"))
LtlVMax.Text = String.Format("{0:N2} KM/H", RowEstatus("VMax"))
LtlTiempo.Text = String.Format("{0}", RowEstatus("TiempoOperativo"))
LtlKM.Text = String.Format("{0:N2} KM", RowEstatus("Dist"))
LtlExcesosVelo.Text = String.Format("{0}", RowEstatus("ExcesosVelocidad"))
LtlCombustibleI.Text = If(String.IsNullOrEmpty(RowEstatus("CombustibleInicial").ToString()), "No Disponible", String.Format("{0:N2}", RowEstatus("CombustibleInicial")))
LtlCombustibleF.Text = If(String.IsNullOrEmpty(RowEstatus("CombustibleFinal").ToString()), "No Disponible", String.Format("{0:N2}", RowEstatus("CombustibleFinal")))
LtlCargas.Text = String.Format("{0:N0}", RowEstatus("Cargas"))
LtlDescargas.Text = String.Format("{0:N0}", RowEstatus("Descargas"))
LtlCombustibleConsumido.Text = String.Format("{0:N2} L", RowEstatus("CombustibleConsumido"))
LtlRendimiento.Text = String.Format("{0:N2} KM/L", RowEstatus("Rendimiento"))
GvIgnicion.DataSource = ObjGPS.DtSetResultados.Tables(1)
GvIgnicion.DataBind()
GvExcesos.DataSource = ObjGPS.DtSetResultados.Tables(2)
GvExcesos.DataBind()
GvRalenti.DataSource = ObjGPS.DtSetResultados.Tables(3)
GvRalenti.DataBind()
GvCombustible.DataSource = ObjGPS.DtSetResultados.Tables(4)
GvCombustible.DataBind()
GvGastos.DataSource = ObjGPS.DtSetResultados.Tables(5)
GvGastos.DataBind()
End If
End If
Dim count = 0
If ObjGPS.GetTrayectosGeoReferencias(CveTrayecto) Then
DtGeocercas = ObjGPS.DtResultados
If DtGeocercas IsNot Nothing Then
Dim Coord As String = ""
Dim CoordAnterior As String = ""
Dim CveEstatus As Integer = -1
Dim CveEstatusAnterior As Integer = -1
'GEOCERCAS
For Each Row As DataRow In DtGeocercas.Rows
count += 1
Coord = SQLToGmaps(Row("Geom").ToString, "POLYGON")
CveEstatus = Row("CveEstatusTrayecto").ToString.ToEntero
CveEstatusAnterior = Row("CveEstatusAnterior").ToString.ToEntero
Dim EsInicio As Boolean = CBool(IfNull(Row("EsInicio"), 0))
Dim EsFin As Boolean = CBool(IfNull(Row("EsFin"), 0))
Dim InicioFin As Integer = If(EsInicio, 1, If(EsFin, 2, 0))
RegistraScript($"creaPoligono({Coord}, '{Row("Color").ToString}', '{Row("GeoReferencia")}', '{Row("EstatusTrayecto")}',{InicioFin},{CveEstatus},{CveEstatusAnterior})", count.ToString())
Next
End If
End If
If ObjGPS.GetTrayectosHistorial(CveTrayecto, UsuarioActual.CveCliente) Then
DtPosiciones = ObjGPS.DtResultados
If DtPosiciones IsNot Nothing Then
Dim Fecha, Vehiculo, Icono, CoordDis, Info As String
For Each Row As DataRow In DtPosiciones.Rows
CoordDis = Row("PosicionVehiculo").ToString.SQLToGmaps("POINT")
Fecha = Row("FechaTrama").ToString
Vehiculo = Row("Vehiculo").ToString
Info = InfoWindow($"{Row("EventoTexto")}", "-1", Row("CveDispositivo").ToString.ToEntero, Row, PermisoComandos:=False)
If Row("Velocidad").ToString.ToDouble > 1 Then
Icono = $"/Imagenes/{Row("Icono")}green.png"
Else
Icono = $"/Imagenes/{Row("Icono")}.png"
End If
RegistraScript($"CreaMarcador({CoordDis},'{Row("Vehiculo")}', '{Info}', '{Icono}');", count.ToString())
Next
End If
End If
End If
Catch ex As Exception
OnError("Ocurrió un error al consultar el trayecto.", ex)
End Try
ObjGPS.Dispose()
If CveTrayecto > 0 Then
Dim CveDispositivo As Integer = -1
Dim ObjGPS As New ClsGPS
Dim DtEstatusHistorial As DataTable = Nothing
Dim DtPuntosInteres As DataTable = Nothing
Dim DsDatos As DataSet = Nothing
Dim FechaInicio As DateTime = MinFecha
Dim FechaFin As DateTime = MaxFecha
Try
If ObjGPS.GetTrayectosDatos(CveTrayecto) Then
DsDatos = ObjGPS.DtSetResultados.Copy
If DsDatos IsNot Nothing AndAlso DsDatos.Tables.Count > 0 Then
CveDispositivo = DsDatos.Tables(0).Rows(0)("CveDispositivo").ToString().ToEntero
If Not String.IsNullOrEmpty(DsDatos.Tables(0).Rows(0)("FechaInicio").ToString()) Then
FechaInicio = DsDatos.Tables(0).Rows(0)("FechaInicio").ToString().ToDateTime
End If
If Not String.IsNullOrEmpty(DsDatos.Tables(0).Rows(0)("FechaFin").ToString()) Then
FechaFin = DsDatos.Tables(0).Rows(0)("FechaFin").ToString().ToDateTime
End If
End If
End If
If ObjGPS.GetTrayectosGeoReferencias(CveTrayecto) Then
DtGeocercas = ObjGPS.DtResultados.Copy
End If
'If ObjGPS.GetTrayectosHistorial(CveTrayecto, UsuarioActual.CveCliente) Then
' DtPosiciones = ObjGPS.DtResultados.Copy()
'End If
If CveDispositivo > 0 Then
If ObjGPS.UltimaPosicionEquipoGet(CveDispositivo.ToString(), UsuarioActual.CveCliente) Then
DtPosiciones = ObjGPS.DtResultados.Copy()
End If
End If
If ObjGPS.GetTrayectosEstatusHistorial(CveTrayecto) Then
DtEstatusHistorial = ObjGPS.DtResultados.Copy
End If
If FechaInicio > MinFecha Then
If FechaFin <= MinFecha Then
FechaFin = MaxFecha
End If
If ObjGPS.RepPuntosGet(-1, CveDispositivo.ToString(), FechaInicio, FechaFin, UsuarioActual.CveCliente) Then
DtPuntosInteres = ObjGPS.DtResultados.Copy
End If
End If
Catch ex As Exception
OnError("Ocurrió un error al consultar el trayecto.", ex)
End Try
ObjGPS.Dispose()
Try
RegistraScript("initMap();")
If DtEstatusHistorial IsNot Nothing AndAlso DtEstatusHistorial.Rows.Count > 0 Then
Dim Direcciones = ConsultarDirecciones(DtEstatusHistorial)
For Each Dir As JObject In Direcciones
DtEstatusHistorial.Rows(Dir("Indice").ToEntero())("Direccion") = Dir("Direccion").ToString()
Next
GvEstatus.DataSource = DtEstatusHistorial
GvEstatus.DataBind()
End If
If DsDatos IsNot Nothing AndAlso DsDatos.Tables.Count > 0 Then
Dim RowEstatus As DataRow = DsDatos.Tables(0).Rows(0)
LblTitulo.Text = $"Trayecto: {RowEstatus("Trayecto")}"
LtlEstatusActual.Text = RowEstatus("Estatus").ToString()
CveEstatusActual = RowEstatus("CveEstatusActual").ToString().ToEntero()
If CBool(RowEstatus("EsFin")) Then
BtnTerminarTrayeto.Visible = False
LnkActualizarEstatus.Visible = False
BtnRecalcular.Visible = False
LblETA.Text = "TERMINADO"
End If
LtlDispositivo.Text = RowEstatus("Vehiculo").ToString()
LtlFechaI.Text = If(String.IsNullOrEmpty(RowEstatus("FechaInicio").ToString()), "No ha ingresado a la geocerca de inicio", String.Format("{0:dd/MM/yyyy HH:mm tt}", RowEstatus("FechaInicio").ToString().ToDateTime()))
LtlFechaF.Text = If(String.IsNullOrEmpty(RowEstatus("FechaFin").ToString()), "No ha Terminado", String.Format("{0:dd/MM/yyyy HH:mm tt}", RowEstatus("FechaFin").ToString().ToDateTime()))
LtlVMedia.Text = String.Format("{0:N2} KM/H", RowEstatus("VMedia"))
LtlVMax.Text = String.Format("{0:N2} KM/H", RowEstatus("VMax"))
LtlTiempo.Text = String.Format("{0}", RowEstatus("TiempoOperativo"))
LtlKM.Text = String.Format("{0:N2} KM", RowEstatus("Dist"))
LtlExcesosVelo.Text = String.Format("{0}", RowEstatus("ExcesosVelocidad"))
LtlCombustibleI.Text = If(String.IsNullOrEmpty(RowEstatus("CombustibleInicial").ToString()), "No Disponible", String.Format("{0:N2}", RowEstatus("CombustibleInicial")))
LtlCombustibleF.Text = If(String.IsNullOrEmpty(RowEstatus("CombustibleFinal").ToString()), "No Disponible", String.Format("{0:N2}", RowEstatus("CombustibleFinal")))
LtlCargas.Text = String.Format("{0:N0}", RowEstatus("Cargas"))
LtlDescargas.Text = String.Format("{0:N0}", RowEstatus("Descargas"))
LtlCombustibleConsumido.Text = String.Format("{0:N2} L", RowEstatus("CombustibleConsumido"))
LtlRendimiento.Text = String.Format("{0:N2} KM/L", RowEstatus("Rendimiento"))
GvIgnicion.DataSource = DsDatos.Tables(1)
GvIgnicion.DataBind()
GvExcesos.DataSource = DsDatos.Tables(2)
GvExcesos.DataBind()
GvRalenti.DataSource = DsDatos.Tables(3)
GvRalenti.DataBind()
GvCombustible.DataSource = DsDatos.Tables(4)
GvCombustible.DataBind()
GvGastos.DataSource = DsDatos.Tables(5)
GvGastos.DataBind()
End If
Dim count = 0
If DtPosiciones IsNot Nothing AndAlso DtPosiciones.Rows.Count > 0 Then
Dim Fecha, Vehiculo, Icono, CoordDis, Info As String
For Each Row As DataRow In DtPosiciones.Rows
count += 1
CoordDis = Row("Posicion").ToString.SQLToGmaps("POINT")
Fecha = Row("FechaTrama").ToString
Vehiculo = Row("NombreVehiculo").ToString
Info = InfoWindow($"{Vehiculo}", "-1", Row("CveDispositivo").ToString.ToEntero, Row, PermisoComandos:=False)
If Row("Velocidad").ToString.ToDouble > 1 Then
Icono = $"/Imagenes/{Row("Icono")}green.png"
Else
Icono = $"/Imagenes/{Row("Icono")}.png"
End If
RegistraScript($"CreaMarcador({CoordDis},'{Vehiculo}', '{Info}', '{Icono}');", count.ToString())
Next
End If
If DtGeocercas IsNot Nothing AndAlso DtGeocercas.Rows.Count > 0 Then
Dim Coord As String = ""
Dim CoordAnterior As String = ""
Dim CveEstatus As Integer = -1
Dim CveEstatusAnterior As Integer = -1
'GEOCERCAS
For Each Row As DataRow In DtGeocercas.Rows
count += 1
Coord = SQLToGmaps(Row("Geom").ToString, "POLYGON")
CveEstatus = Row("CveEstatusTrayecto").ToString.ToEntero
CveEstatusAnterior = Row("CveEstatusAnterior").ToString.ToEntero
Dim EsInicio As Boolean = CBool(IfNull(Row("EsInicio"), 0))
Dim EsFin As Boolean = CBool(IfNull(Row("EsFin"), 0))
Dim InicioFin As Integer = If(EsInicio, 1, If(EsFin, 2, 0))
Dim Cruzo As String = IfNull(Row("Cruzo"), "0").ToString()
RegistraScript($"creaPoligono({Coord}, '{Row("Color").ToString}', '{Row("GeoReferencia")}', '{Row("EstatusTrayecto")}',{InicioFin},{CveEstatus},{CveEstatusAnterior},{Cruzo})", count.ToString())
Next
End If
If DtPuntosInteres IsNot Nothing Then
Dim SBBody As New StringBuilder
Dim CoordsPoligono = ""
Dim Coords = ""
Dim Titulo = ""
Dim Info = ""
Dim GeoCercas = ""
Dim Color = ""
For Each RowPI As DataRow In DtPuntosInteres.Rows
count += 1
Coords = SQLToGmaps(RowPI("Punto").ToString, "POINT")
SBBody.Append($"<div>")
SBBody.Append($"<div><h5><b> Punto: {RowPI("PuntoDeInteres")}</b></h5></div>")
Color = "#26C281"
SBBody.Append($"<div><table>")
SBBody.Append($"<tr><td><b>{RowPI("Vehiculo")}:</b> {RowPI("Visitas")} visitas</td></tr>")
SBBody.Append($"<tr><td>Última Visita: {RowPI("UltimaVisita")}</td></tr>")
SBBody.Append($"</table></div>")
SBBody.Append($"</div>")
RegistraScript($"CreaCirculo({Coords},'{Color}');CreaMarcadorPI({Coords},'{RowPI("PuntoDeInteres")}','{SBBody.ToString}');", count.ToString())
Next
count += 1
RegistraScript("CalcularETA();", count.ToString())
End If
Catch ex As Exception
OnError("Ocurrió un error al cargar los datos del trayecto", ex)
End Try
End If
'UpIgniciones.Update()
'UpEventos.Update()
@@ -206,17 +322,24 @@ Partial Class GPS_TrayectoDetalle
Protected Sub BtnTerminarTrayeto_Click(sender As Object, e As EventArgs)
Dim DtEstatus As DataTable = Nothing
Dim ObjGPS As New ClsGPS
If ObjGPS.GetEstatusTrayectos(-1, UsuarioActual.CveCliente) Then
DtEstatus = ObjGPS.DtResultados.Copy()
End If
Dim CveEstatusFinal As Integer = DtEstatus.FiltroPrimeroValor("CveEstatusTrayecto", "EsFin = True").ToEntero()
If CveEstatusFinal > 0 Then
If ObjGPS.UpdateTrayectoEstatus(CveTrayecto, CveEstatusFinal) Then
Alert("El trayecto se finalizo correctamente")
End If
Else
Alert("No se pudo obtener el estatus final", TipoMensaje.MsgError)
End If
Try
If ObjGPS.GetEstatusTrayectos(-1, UsuarioActual.CveCliente) Then
DtEstatus = ObjGPS.DtResultados.Copy()
End If
Dim CveEstatusFinal As Integer = DtEstatus.FiltroPrimeroValor("CveEstatusTrayecto", "EsFin = True").ToEntero()
If CveEstatusFinal > 0 Then
If ObjGPS.UpdateTrayectoEstatus(CveTrayecto, CveEstatusFinal) Then
Alert("El trayecto se finalizo correctamente", JSBtnAceptar:="RefrescarPagina();", ShowCloseButton:=False)
End If
Else
Alert("No se pudo obtener el estatus final", TipoMensaje.MsgError)
End If
Catch ex As Exception
OnError("Ocurrió un error al actualizar el trayecto", ex)
End Try
ObjGPS.Dispose()
End Sub
Protected Sub GvGastos_RowDataBound(sender As Object, e As GridViewRowEventArgs)
@@ -256,4 +379,59 @@ Partial Class GPS_TrayectoDetalle
2, UsuarioActual.CveUsuario, UsuarioActual.CveCliente, CveTrayecto:=Me.CveTrayecto) Then
RegistraScript("$('#DModal').modal('hide')")
Alert("El Gasto se agregó correctamente.", TipoMensaje.MsgInformacion)
End If
ObjPS.Dispose()
'CargaDatos()
End Sub
Protected Sub BtnRecalcular_Click(sender As Object, e As EventArgs)
If CveTrayecto > 0 Then
CargaTrayectoHistorial(CveTrayecto)
CargaReporte()
End If
End Sub
Protected Sub LnkActualizarEstatus_Click(sender As Object, e As EventArgs)
Dim CveEstatusSiguiente As Integer = -1
Dim Estatus As String = ""
Using ObjGPS As New ClsGPS
If ObjGPS.GetTrayectosGeoReferencias(CveTrayecto) Then
If CveEstatusActual = 1 Then
'TOMA LA GEOCERCA DE INICIO
Dim Row As DataRow = ObjGPS.DtResultados.FiltroPrimero($"EsInicio = True")
If Row IsNot Nothing Then
CveEstatusSiguiente = Row("CveEstatusTrayecto").ToString().ToEntero()
End If
Else
Dim Row As DataRow = ObjGPS.DtResultados.FiltroPrimero($"CveEstatusTrayecto = {CveEstatusActual}")
If Row IsNot Nothing Then
CveEstatusSiguiente = Row("CveEstatusSiguiente").ToString().ToEntero()
End If
End If
End If
If CveEstatusSiguiente > 0 Then
If ObjGPS.GetEstatusTrayectos(CveEstatusSiguiente, UsuarioActual.CveCliente) Then
Estatus = ObjGPS.DtResultados.FiltroPrimeroValor("Estatus")
End If
If Not String.IsNullOrEmpty(Estatus) Then
If ObjGPS.UpdateTrayectoEstatus(CveTrayecto, CveEstatusSiguiente) Then
Alert($"El trayecto se cambió al estatus <b>{Estatus}</b>.", JSBtnAceptar:="RefrescarPagina();", ShowCloseButton:=False)
End If
Else
Alert("No se pudo cambiar al estatus siguiente.", TipoMensaje.MsgError)
End If
Else
Alert("No se pudo cambiar al estatus siguiente.", TipoMensaje.MsgError)
End If
End Using
End Sub

View File

@@ -126,7 +126,7 @@
</li>
<li>Mostrar Solo Activas:
<asp:CheckBox ID="ChkActivas" Text=" " runat="server" CssClass="chksino" Width="250px"></asp:CheckBox>
<asp:CheckBox ID="ChkActivas" Text=" " runat="server" CssClass="chksino" Width="250px" Checked="true"></asp:CheckBox>
</li>
</ul>
</div>
@@ -134,18 +134,29 @@
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div class="row">
<div class="col-md-12">
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right" align="left">
<div style="margin-right: 15px">
<input type="text" id="TxtBusquedaG" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaG','{0}')", GvBarra.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusquedaG','{0}')", GvBarra.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div>
</div>
<asp:UpdatePanel runat="server" ID="UPGV" UpdateMode="Conditional">
<ContentTemplate>
<asp:UpdatePanel runat="server" ID="UPGV" UpdateMode="Conditional">
<ContentTemplate>
<div class="row">
<div class="col-md-12">
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right" align="left">
<div class="col-md-6">
<div class="row">
<label class="col-md-3 trucate"><b>Consultar Automaticamente</b></label>
<div class="col-md-1">
<asp:CheckBox ID="ChkTimmer" OnCheckedChanged="ChkTimmer_CheckedChanged" AutoPostBack="true" Text=" " runat="server" CssClass="chksino" Checked="true"></asp:CheckBox>
</div>
<div class="col-md-8">
<asp:Timer runat="server" ID="TimmerRefresh" Interval="30000" OnTick="TimmerRefresh_Tick"></asp:Timer>
</div>
</div>
</div>
<div style="margin-right: 15px">
<input type="text" id="TxtBusquedaG" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaG','{0}')", GvBarra.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusquedaG','{0}')", GvBarra.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div>
</div>
<asp:HiddenField ID="HdnTrayecto" runat="server" ClientIDMode="Static" Value="" />
<asp:GridView ID="GvBarra" runat="server" Style="overflow-x: auto;" GridLines="None" OnRowDataBound="GvBarra_RowDataBound" OnRowDeleting="GvBarra_RowDeleting1"
<asp:GridView ID="GvBarra" runat="server" Style="overflow-x: auto;" GridLines="None" OnRowDataBound="GvBarra_RowDataBound" OnRowDeleting="GvBarra_RowDeleting1"
DataKeyNames="CveTrayecto,EnviarNotificacion,CorreosNotificacion,Intervalo,EnviarLiga" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-sort="true" data-sortindex="1" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros" ToolTip="Listado de Trayectos">
<Columns>
<asp:BoundField DataField="Trayecto" HeaderText="Nombre del Trayecto" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="20%" />
@@ -170,11 +181,10 @@
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div id="DivAgregar" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">

View File

@@ -44,6 +44,7 @@ Partial Class GPS_Trayectos
If Not Page.IsPostBack Then
DirectCast(Master.FindControl("TSM"), ScriptManager).EnablePageMethods = True
CargaDatos()
TimmerRefresh.Enabled = ChkTimmer.Checked
End If
End Sub
Private Sub CargaDatos()
@@ -111,7 +112,7 @@ Partial Class GPS_Trayectos
Public Sub CargaEstatus()
Dim ObjGPS As New ClsGPS
If ObjGPS.GetEstatusTrayectos(-1, UsuarioActual.CveCliente) Then
GvEstatus.DataSource = ObjGPS.DtResultados
GvEstatus.DataSource = ObjGPS.DtResultados.FiltraParametros("CveCliente > 0")
GvEstatusNuevo.DataSource = ObjGPS.DtResultados
DdlEstatusTrayecto.DataSource = ObjGPS.DtResultados
End If
@@ -443,4 +444,12 @@ Partial Class GPS_Trayectos
Alert("No se pudo identificar el trayecto", TipoMensaje.MsgError)
End If
End Sub
Protected Sub TimmerRefresh_Tick(sender As Object, e As EventArgs)
CargaTrayectos()
End Sub
Protected Sub ChkTimmer_CheckedChanged(sender As Object, e As EventArgs)
TimmerRefresh.Enabled = ChkTimmer.Checked
UPGV.Update()
End Sub
End Class

File diff suppressed because it is too large Load Diff

View File

@@ -81,18 +81,27 @@ Partial Class Inventarios_Kardex
ddlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1)
ddlAlmacen.DataBind()
If IfNull(Request("CveAlmacen"), "-1").ToString.ToEntero > 0 Then ddlAlmacen.SelectedValuesIfExist(Request("CveAlmacen").ToString)
Dim CveTipoAlmacen As Integer
If IfNull(Request("CveAlmacen"), "-1").ToString.ToEntero > 0 Then
ddlAlmacen.SelectedValuesIfExist(Request("CveAlmacen").ToString)
CveTipoAlmacen = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=Request("CveAlmacen").ToString.ToEntero).FiltroPrimeroValor("CveTipoAlmacen").ToEntero
' If CveTipoAlmacen = 3 Then chktransitorio.checked = True
End If
CargaClasificaciones()
CBLTiposAlmacen.DataSource = GlobalDTTipoAlmacen(-1)
CBLTiposAlmacen.DataBind()
For Each item As ListItem In CBLTiposAlmacen.Items
If item.Text.Contiene("Entrega Adelantado", "Transitorio") Then
item.Selected = False
If CveTipoAlmacen = 3 Then
item.Selected = True
Else
item.Selected = False
End If
Else
item.Selected = True
End If
Next
End Sub
Private Sub CargaFuncionalidad105()

View File

@@ -124,6 +124,7 @@
<asp:ListItem Text="Egresos" Value="Egs"></asp:ListItem>
<asp:ListItem Text="Remisión" Value="Rem"></asp:ListItem>
<asp:ListItem Text="Pedido" Value="Ped"></asp:ListItem>
<asp:ListItem Text="Devolución Pedido" Value="DPe"></asp:ListItem>
</asp:DropDownList>
</div>
<div class="col-md-1 truncate" id="DivTipoDoctoCompra" style="text-align: right!important;" runat="server" visible="false">Tipo Documento:</div>

View File

@@ -10,12 +10,14 @@
input[disabled="disabled"] ~ .CodeMirror.cm-s-material {
cursor: not-allowed;
}
input[disabled="disabled"] ~ .CodeMirror.cm-s-material input {
cursor: not-allowed;
}
input[disabled="disabled"] ~ .CodeMirror.cm-s-material pre {
cursor: not-allowed;
}
input[disabled="disabled"] ~ .CodeMirror.cm-s-material input {
cursor: not-allowed;
}
input[disabled="disabled"] ~ .CodeMirror.cm-s-material pre {
cursor: not-allowed;
}
.CodeMirror-hints {
z-index: 700;
@@ -218,23 +220,23 @@
<div class="col-md-5">
<div class="portlet smmallpadding light bordered">
<div class="portlet-title">
<div class="caption uppercase " style="position: relative;">
<i class="fa fa-info-circle font-yellow-gold"></i>
<span class="caption-subject font-yellow-gold bold uppercase">Fórmulas </span>
</div>
<div class="actions">
<div class="btn-group">
<asp:LinkButton ID="LnkActualizarFormula" OnClick="LnkActualizarFormula_Click" CssClass="btn btn-success" runat="server">Actualizar</asp:LinkButton>
<asp:UpdatePanel ID="UpFormulas" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="portlet smmallpadding light bordered" id="Divformula" runat="server">
<div class="portlet-title">
<div class="caption uppercase " style="position: relative;">
<i class="fa fa-info-circle font-yellow-gold"></i>
<span class="caption-subject font-yellow-gold bold uppercase">Fórmulas </span>
</div>
<div class="actions">
<div class="btn-group">
<asp:LinkButton ID="LnkActualizarFormula" OnClick="LnkActualizarFormula_Click" CssClass="btn btn-success" runat="server">Actualizar</asp:LinkButton>
</div>
</div>
</div>
</div>
</div>
<div class="portlet-body rowpadding">
<div class="portlet-body rowpadding">
<asp:UpdatePanel ID="UpFormulas" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<ajax:TabContainer ID="TabsFormulas" runat="server" Width="100%" CssClass="tabBodyOverride" ActiveTabIndex="0" AutoPostBack="true">
<ajax:TabPanel ID="tabFormulaImporte" runat="server" HeaderText="Valor">
@@ -254,9 +256,8 @@
</ContentTemplate>
</ajax:TabPanel>
</ajax:TabContainer>
</ContentTemplate>
</asp:UpdatePanel>
<%--<div class="row">
<%--<div class="row">
<div class="col-md-12">
<div class="form-group form-md-line-input form-md-floating-label input-iconright">
<asp:Label runat="server" Text="Formula" AssociatedControlID="TxtFormula"></asp:Label>
@@ -265,10 +266,10 @@
</div>
</div>
</div>--%>
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div class="portlet smmallpadding light bordered">
<div class="portlet-title">
<div class="caption uppercase " style="position: relative;">
@@ -343,6 +344,13 @@
</div>
</div>
</div>
<div class="row">
<label class="col-md-3 truncate ">Movimiento Permanente:</label>
<div class="col-md-3">
<asp:CheckBox ID="ChkMovtoPermanente" AutoPostBack="true" OnCheckedChanged ="ChkMovtoPermanente_CheckedChanged" CssClass="chksino" Text=" " runat="server" />
</div>
</div>
</div>
</div>
</div>

View File

@@ -323,6 +323,22 @@ public partial class Nomina_CatConcepto : ClsPaginas
{
TieneError = !ObjNomina.UpdateConcepto(codigo, concepto, tipo, formula, sistema, estado, CveConceptoPadre, CveConcepto, retencion, CveClasificacion, IdCtaContable, CveTipoGasto, tipoCalculo, CveConceptoContable, AplicaFiniquito, AutomaticoGlobal, Especie, Imprimir, CveSATConcepto,UsuarioActual.CveEmpresa);
if(!TieneError)
{
if (ChkMovtoPermanente.Checked)
{
ObjNomina.UpdateConceptoFormula(CveConcepto, "FNC.[MovimientosPermanentes]", 1);
}
else
{
if(TxtFormulaTotal.Text == "FNC.[MovimientosPermanentes]")
{
// ObjNomina.UpdateConceptoFormula(CveConcepto, "FNC.[MovimientosPermanentes] ", 1);
}
}
}
if (TieneError)
{
ObjNomina.RollBack();
@@ -337,6 +353,22 @@ public partial class Nomina_CatConcepto : ClsPaginas
{
CveConcepto = ObjNomina.AddConcepto(codigo, concepto, tipo, formula, sistema, estado, CveConceptoPadre, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, retencion, CveClasificacion, IdCtaContable, CveTipoGasto, tipoCalculo, CveConceptoContable, AplicaFiniquito, AutomaticoGlobal, Especie, Imprimir, CveSATConcepto);
if (CveConcepto>0)
{
if (ChkMovtoPermanente.Checked)
{
ObjNomina.UpdateConceptoFormula(CveConcepto, "FNC.[MovimientosPermanentes]", 1);
}
else
{
if (TxtFormulaTotal.Text == "FNC.[MovimientosPermanentes]")
{
// ObjNomina.UpdateConceptoFormula(CveConcepto, "FNC.[MovimientosPermanentes] ", 1);
}
}
}
if (CveConcepto == -1)
{
ObjNomina.RollBack();
@@ -403,6 +435,9 @@ public partial class Nomina_CatConcepto : ClsPaginas
DdlTipo.SelectedValueExist(drow["Tipo"]);
TxtFormulaImporte.Text = drow["Formula"].ToString();
TxtFormulaTotal.Text = drow["FormulaTotal"].ToString();
ChkMovtoPermanente.Checked=(TxtFormulaTotal.Text == "FNC.[MovimientosPermanentes]");
ChkMovtoPermanente_CheckedChanged(null, null);
TxtFormulaGravada.Text = drow["FormulaGravada"].ToString();
if (drow["EsRetencion"].Equals("1")) ChkRetencion.Checked = true;
if (drow["TipoCalculo"].Equals("True")) ChkTipoCalculo.Checked = true;
@@ -529,4 +564,18 @@ public partial class Nomina_CatConcepto : ClsPaginas
}
}
}
protected void ChkMovtoPermanente_CheckedChanged(object sender, EventArgs e)
{
Divformula.Visible = !ChkMovtoPermanente.Checked;
//if (Divformula.Visible)
//{
//TxtFormulaTotal.Text = "";
//}
//else
//{
// TxtFormulaTotal.Text = "FNC.[MovimientosPermanentes]";
//}
}
}

View File

@@ -4,6 +4,16 @@
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
<style>
.tconceptos {
background-color: #E87E04;
color: #fff;
padding: 5px;
}
.gconceptos {
border: 1px solid #E87E04;
}
.dtosEmpleado .row {
padding-top: 10px;
padding-bottom: 10px;
@@ -77,7 +87,7 @@
</li>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID ="LnkFormatoRenuncia" />
<asp:PostBackTrigger ControlID="LnkFormatoRenuncia" />
</Triggers>
</asp:UpdatePanel>
</asp:Content>
@@ -108,11 +118,17 @@
<br />
<asp:HyperLink ID="HypCodigo" CssClass="LinkEmpleado TextLink" Text="--" runat="server"></asp:HyperLink>
</div>
<div class="col-sm-9">
<div class="col-sm-6">
<span class="bold">Empleado:</span>
<br />
<asp:HyperLink ID="HypEmpleado" CssClass="LinkEmpleado TextLink" Text="--" runat="server"></asp:HyperLink>
</div>
<div class="col-sm-3">
<span class="bold">Area geografica:</span>
<br />
<asp:Literal ID="LtlAreaGeografica" runat="server">--</asp:Literal>
</div>
</div>
<div class="row ">
<div class="col-sm-3 ">
@@ -120,12 +136,12 @@
<br />
<asp:Label ID="LblFechaAlta" runat="server" Text="--"></asp:Label>
</div>
<div class="col-sm-5">
<div class="col-sm-6">
<span class="bold">Puesto:</span>
<br />
<asp:Label ID="LblPuesto" runat="server" Text="--"></asp:Label>
</div>
<div class="col-sm-4">
<div class="col-sm-3">
<span class="bold">Salario:</span>
<br />
<asp:Label ID="LblSalario" runat="server" Text="--"></asp:Label>
@@ -151,8 +167,8 @@
</div>
<div class="actions">
<div class="btn-group">
<asp:LinkButton ID="LnkSimular" OnClick="LnkSimular_Click" ValidationGroup="GrpGuardar" CssClass="btn yellow-gold" runat="server">Simular</asp:LinkButton>
<asp:LinkButton ID="LnkCancelar" Visible="false" OnClick="LnkCancelar_Click" ValidationGroup="GrpGuardarcan" CssClass="btn btn-danger" runat="server">Cancelar</asp:LinkButton>
<asp:LinkButton ID="LnkSimular" OnClick="LnkSimular_Click" ValidationGroup="GrpGuardar" CssClass="btn yellow-gold" runat="server">Simular</asp:LinkButton>
<asp:LinkButton ID="LnkCancelar" Visible="false" OnClick="LnkCancelar_Click" ValidationGroup="GrpGuardarcan" CssClass="btn btn-danger" runat="server">Cancelar</asp:LinkButton>
<asp:LinkButton ID="LnkGuardarDatos" OnClick="LnkGuardarDatos_Click" ValidationGroup="GrpGuardar" CssClass="btn btn-primary" runat="server">Guardar</asp:LinkButton>
</div>
</div>
@@ -160,63 +176,87 @@
<div class="portlet-body dtosEmpleado">
<div class="row">
<div class="col-md-4">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlMotivoBaja" runat="server" AppendDataBoundItems="True" DataTextField="MotivoBaja" DataValueField="CveMotivoBaja" Width="100%"
CssClass="form-control select2me" ValidationGroup="GrpGuardar">
<asp:ListItem Selected="True" Text="Sin asignar Motivo de baja" Value="-1"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RfvMotivoBaja" runat="server" ControlToValidate="DdlMotivoBaja" CssClass=" dnone" InitialValue="-1"
ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />Seleccione el <b>''motivo''</b>."
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<asp:Label runat="server" Text="Motivo de Baja: " AssociatedControlID="DdlMotivoBaja"></asp:Label>
<asp:UpdatePanel ID="upddtosEmpleado" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="row">
<div class="col-md-4">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlMotivoBaja" runat="server" AppendDataBoundItems="True" DataTextField="MotivoBaja" DataValueField="CveMotivoBaja" Width="100%"
CssClass="form-control select2me" ValidationGroup="GrpGuardar">
<asp:ListItem Selected="True" Text="Sin asignar Motivo de baja" Value="-1"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RfvMotivoBaja" runat="server" ControlToValidate="DdlMotivoBaja" CssClass=" dnone" InitialValue="-1"
ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />Seleccione el <b>''motivo''</b>."
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<asp:Label runat="server" Text="Motivo de Baja: " AssociatedControlID="DdlMotivoBaja"></asp:Label>
</div>
<ajax:ValidatorCalloutExtender ID="vcoMotivoBaja" runat="server" HighlightCssClass="vco" TargetControlID="RfvMotivoBaja" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
<div class="col-md-4">
<div class="form-group form-md-line-input input-iconright" style="width: 120px; display: inline-block">
<asp:TextBox ID="TxtFechaBaja" runat="server" CausesValidation="True" CssClass="form-control"></asp:TextBox>
<asp:RequiredFieldValidator ID="RfvTxtFechaBaja" runat="server" ControlToValidate="TxtFechaBaja" CssClass="dnone"
ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha de Baja''</b> es necesario "
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<asp:Label runat="server" Text="Fecha de Baja: " AssociatedControlID="TxtFechaBaja"></asp:Label>
<ajax:MaskedEditExtender ID="MKEFechaBaja" runat="server" TargetControlID="TxtFechaBaja" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left" BehaviorID="_content_MKEFechaBaja" Century="2000" CultureAMPMPlaceholder="" CultureCurrencySymbolPlaceholder="" CultureDateFormat="" CultureDatePlaceholder="" CultureDecimalPlaceholder="" CultureThousandsPlaceholder="" CultureTimePlaceholder=""></ajax:MaskedEditExtender>
<ajax:CalendarExtender ID="CEFechaBaja" runat="server" TargetControlID="TxtFechaBaja" PopupButtonID="ImgFechaBaja" PopupPosition="BottomRight" BehaviorID="_content_CEFechaBaja"></ajax:CalendarExtender>
<asp:CompareValidator ID="CVFechaBaja" runat="server" ControlToValidate="TxtFechaBaja" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha de Baja''</b> no tiene el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="GrpGuardar" Visible="False"></asp:CompareValidator>
</div>
<span class="input-group-btn " style="display: inline-block">
<asp:LinkButton ID="ImgFechaBaja" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:ValidatorCalloutExtender ID="vcoTxtFechaBaja" runat="server" HighlightCssClass="vco" TargetControlID="RfvTxtFechaBaja" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
<div class="col-md-3">
¿es liquidación?<br />
<asp:CheckBox ID="ChkesLiquidacion" AutoPostBack="true" OnCheckedChanged="ChkesLiquidacion_CheckedChanged" CssClass="chksino" Text=" " runat="server" />
</div>
<div class="col-md-1">
</div>
</div>
<ajax:ValidatorCalloutExtender ID="vcoMotivoBaja" runat="server" HighlightCssClass="vco" TargetControlID="RfvMotivoBaja" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
<div class="col-md-4">
<div class="form-group form-md-line-input input-iconright" style="width: 120px; display: inline-block">
<asp:TextBox ID="TxtFechaBaja" runat="server" CausesValidation="True" CssClass="form-control"></asp:TextBox>
<asp:RequiredFieldValidator ID="RfvTxtFechaBaja" runat="server" ControlToValidate="TxtFechaBaja" CssClass="dnone"
ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha de Baja''</b> es necesario "
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<asp:Label runat="server" Text="Fecha de Baja: " AssociatedControlID="TxtFechaBaja"></asp:Label>
<ajax:MaskedEditExtender ID="MKEFechaBaja" runat="server" TargetControlID="TxtFechaBaja" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left" BehaviorID="_content_MKEFechaBaja" Century="2000" CultureAMPMPlaceholder="" CultureCurrencySymbolPlaceholder="" CultureDateFormat="" CultureDatePlaceholder="" CultureDecimalPlaceholder="" CultureThousandsPlaceholder="" CultureTimePlaceholder=""></ajax:MaskedEditExtender>
<ajax:CalendarExtender ID="CEFechaBaja" runat="server" TargetControlID="TxtFechaBaja" PopupButtonID="ImgFechaBaja" PopupPosition="BottomRight" BehaviorID="_content_CEFechaBaja"></ajax:CalendarExtender>
<asp:CompareValidator ID="CVFechaBaja" runat="server" ControlToValidate="TxtFechaBaja" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha de Baja''</b> no tiene el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="GrpGuardar" Visible="False"></asp:CompareValidator>
<div class="row">
<div class="col-md-4">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtAntiguedad" runat="server" Enabled="false" Text="--" CausesValidation="True" CssClass="form-control"></asp:TextBox>
<asp:Label runat="server" Text="Antiguedad: " AssociatedControlID="TxtAntiguedad"></asp:Label>
</div>
</div>
<div class="col-md-4">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtDiasTransAnio" runat="server" Enabled="false" Text="--" CausesValidation="True" CssClass="form-control"></asp:TextBox>
<asp:Label runat="server" Text="Dias trans. en el año: " AssociatedControlID="TxtDiasTransAnio"></asp:Label>
</div>
</div>
<div class="col-md-4">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtSalarioMinimo" runat="server" Enabled="false" Text="--" CausesValidation="True" CssClass="form-control"></asp:TextBox>
<asp:Label runat="server" Text="Salario minimo: " AssociatedControlID="TxtSalarioMinimo"></asp:Label>
</div>
</div>
</div>
<span class="input-group-btn " style="display: inline-block">
<asp:LinkButton ID="ImgFechaBaja" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:ValidatorCalloutExtender ID="vcoTxtFechaBaja" runat="server" HighlightCssClass="vco" TargetControlID="RfvTxtFechaBaja" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
<div class="col-md-3">
¿es liquidación?<br />
<asp:CheckBox ID="ChkesLiquidacion" CssClass="chksino" Text=" " runat="server" />
</div>
<div class="col-md-1">
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtAntiguedad" runat="server" Enabled="false" Text="--" CausesValidation="True" CssClass="form-control"></asp:TextBox>
<asp:Label runat="server" Text="Antiguedad: " AssociatedControlID="TxtAntiguedad"></asp:Label>
<div class="gconceptos" runat="server" id="gconceptos">
<div class="text-center tconceptos">Conceptos a incluir</div>
<div class="row">
<div class="col-md-4 text-center">
Indemnización
<br />
<asp:CheckBox ID="chkIndemnizacion" CssClass="chksino" Text=" " runat="server" />
</div>
<div class="col-md-4 text-center">
Separación unica
<br />
<asp:CheckBox ID="chkSeparacionUnica" CssClass="chksino" Text=" " runat="server" />
</div>
<div class="col-md-4 text-center">
Prima de antiguedad
<br />
<asp:CheckBox ID="chkPrimaantiguedad" CssClass="chksino" Text=" " runat="server" />
</div>
</div>
</div>
</div>
<div class="col-md-4">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtDiasTransAnio" runat="server" Enabled="false" Text="--" CausesValidation="True" CssClass="form-control"></asp:TextBox>
<asp:Label runat="server" Text="Dias trans. en el año: " AssociatedControlID="TxtDiasTransAnio"></asp:Label>
</div>
</div>
<div class="col-md-4">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtSalarioMinimo" runat="server" Enabled="false" Text="--" CausesValidation="True" CssClass="form-control"></asp:TextBox>
<asp:Label runat="server" Text="Salario minimo: " AssociatedControlID="TxtSalarioMinimo"></asp:Label>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<%--<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlTipoPeriodo" runat="server" AppendDataBoundItems="true" Width="100%" CssClass="form-control select2me" AutoPostBack="true" DataTextField="TipoPeriodo" DataValueField="CveTipoPeriodo" OnSelectedIndexChanged="DdlTipoPeriodo_SelectedIndexChanged">
<asp:ListItem Selected="True" Text="Ordinario" Value="-1"></asp:ListItem>
@@ -233,7 +273,6 @@
</div>
</div>
</div>
</div>
<div class="row">
@@ -278,7 +317,9 @@
<ItemTemplate>
<asp:Label ID="LtlImporte" runat="server" Text='<%# Eval("ImporteP", "${0:N}") %>' Style="word-break: break-all;"></asp:Label>
<asp:LinkButton ID="LnkImporte" OnClick="LnkConcepto_Click" runat="server"></asp:LinkButton>
<asp:LinkButton ID="LnkImportexCalculo" OnClick="LnkImportexCalculo_Click" runat="server" CssClass="btn btn-circle btn-sm btn-xs red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea eliminar el importe fijo?" data-btn-ok-label="si"></asp:LinkButton>
<div style="display: inline-block; width: 29px;">
<asp:LinkButton ID="LnkImportexCalculo" OnClick="LnkImportexCalculo_Click" runat="server" CssClass="btn btn-circle btn-sm btn-xs red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea eliminar el importe fijo?" data-btn-ok-label="si"></asp:LinkButton>
</div>
</ItemTemplate>
<ItemStyle HorizontalAlign="Right" Width="13%" />
</asp:TemplateField>
@@ -299,7 +340,9 @@
<ItemTemplate>
<asp:Label ID="LtlImporteD" runat="server" Text='<%# Eval("ImporteD", "${0:N}") %>' Style="word-break: break-all;"></asp:Label>
<asp:LinkButton ID="LnkImporteD" OnClick="LnkConcepto_Click" runat="server"></asp:LinkButton>
<asp:LinkButton ID="LnkImporteDxCalculo" OnClick="LnkImportexCalculo_Click" runat="server" CssClass="btn btn-circle btn-sm btn-xs red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea eliminar el importe fijo?" data-btn-ok-label="si"></asp:LinkButton>
<div style="display: inline-block; width: 29px;">
<asp:LinkButton ID="LnkImporteDxCalculo" OnClick="LnkImportexCalculo_Click" runat="server" CssClass="btn btn-circle btn-sm btn-xs red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea eliminar el importe fijo?" data-btn-ok-label="si"></asp:LinkButton>
</div>
</ItemTemplate>
<ItemStyle HorizontalAlign="Right" Width="13%" />
</asp:TemplateField>
@@ -349,7 +392,9 @@
<ItemTemplate>
<asp:Label ID="LtlImporte" runat="server" Text='<%# Eval("ImporteP", "${0:N}") %>' Style="word-break: break-all;"></asp:Label>
<asp:LinkButton ID="LnkImporte" OnClick="LnkConcepto_Click" runat="server"></asp:LinkButton>
<asp:LinkButton ID="LnkImportexCalculo" OnClick="LnkImportexCalculo_Click" runat="server" CssClass="btn btn-circle btn-sm btn-xs red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea eliminar el importe fijo?" data-btn-ok-label="si"></asp:LinkButton>
<div style="display: inline-block; width: 29px;">
<asp:LinkButton ID="LnkImportexCalculo" OnClick="LnkImportexCalculo_Click" runat="server" CssClass="btn btn-circle btn-sm btn-xs red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea eliminar el importe fijo?" data-btn-ok-label="si"></asp:LinkButton>
</div>
</ItemTemplate>
<ItemStyle HorizontalAlign="Right" Width="13%" />
</asp:TemplateField>
@@ -370,7 +415,9 @@
<ItemTemplate>
<asp:Label ID="LtlImporteD" runat="server" Text='<%# Eval("ImporteD", "${0:N}") %>' Style="word-break: break-all;"></asp:Label>
<asp:LinkButton ID="LnkImporteD" OnClick="LnkConcepto_Click" runat="server"></asp:LinkButton>
<asp:LinkButton ID="LnkImporteDxCalculo" OnClick="LnkImportexCalculo_Click" runat="server" CssClass="btn btn-circle btn-sm btn-xs red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea eliminar el importe fijo?" data-btn-ok-label="si"></asp:LinkButton>
<div style="display: inline-block; width: 29px;">
<asp:LinkButton ID="LnkImporteDxCalculo" OnClick="LnkImportexCalculo_Click" runat="server" CssClass="btn btn-circle btn-sm btn-xs red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea eliminar el importe fijo?" data-btn-ok-label="si"></asp:LinkButton>
</div>
</ItemTemplate>
<ItemStyle HorizontalAlign="Right" Width="13%" />
</asp:TemplateField>
@@ -381,48 +428,48 @@
</div>
</div>
</div>
<div id="ModalUpConcepto" class="modal ADS fade" role="dialog">
<asp:UpdatePanel class="modal-dialog " runat="server" ID="UPpanelModalUpConcepto" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-content">
<div class="modal-header ">
<h4 class="modal-title">Modificar o agregar concepto :
<div id="ModalUpConcepto" class="modal ADS fade" role="dialog">
<asp:UpdatePanel class="modal-dialog " runat="server" ID="UPpanelModalUpConcepto" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-content">
<div class="modal-header ">
<h4 class="modal-title">Modificar o agregar concepto :
<asp:Label ID="LblConceptoMod" runat="server" Text=""></asp:Label></h4>
</div>
<div class="modal-body">
<div class="form-group form-md-line-input input-iconright">
<asp:Label runat="server" AssociatedControlID="DdlmcConceptos" Enabled="false" Text="Concepto"></asp:Label>
<asp:DropDownList ID="DdlmcConceptos" CssClass="select2me form-control" Width="100%" DataValueField="CveConcepto" DataTextField="CodigoConcepto" OnSelectedIndexChanged="DdlmcConceptos_SelectedIndexChanged" AutoPostBack=" true" runat="server">
<asp:ListItem Value="-1" Text="Seleccione"></asp:ListItem>
</asp:DropDownList>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox CssClass="form-control" ID="TxtmcImporte" runat="server" MaxLength="10"></asp:TextBox>
<asp:Label runat="server" AssociatedControlID="TxtmcImporte" Enabled="false" Text="Importe"></asp:Label>
<i></i>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox CssClass="form-control" ID="TxtmcImporteGrabado" runat="server" MaxLength="10"></asp:TextBox>
<asp:Label runat="server" AssociatedControlID="TxtmcImporteGrabado" Enabled="false" Text="Gravado"></asp:Label>
<i></i>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox CssClass="form-control" ID="Txtmcvalor" runat="server" MaxLength="10"></asp:TextBox>
<asp:Label runat="server" AssociatedControlID="Txtmcvalor" Enabled="false" Text="Valor"></asp:Label>
<i></i>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
<asp:Button ID="BtnAceptarMC" CssClass="btn btn-primary" OnClick="BtnAceptarMC_Click" runat="server" Text="Aceptar" />
</div>
</div>
<div class="modal-body">
<div class="form-group form-md-line-input input-iconright">
<asp:Label runat="server" AssociatedControlID="DdlmcConceptos" Enabled="false" Text="Concepto"></asp:Label>
<asp:DropDownList ID="DdlmcConceptos" CssClass="select2me form-control" Width="100%" DataValueField="CveConcepto" DataTextField="CodigoConcepto" OnSelectedIndexChanged="DdlmcConceptos_SelectedIndexChanged" AutoPostBack=" true" runat="server">
<asp:ListItem Value="-1" Text="Seleccione"></asp:ListItem>
</asp:DropDownList>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox CssClass="form-control" ID="TxtmcImporte" runat="server" MaxLength="10"></asp:TextBox>
<asp:Label runat="server" AssociatedControlID="TxtmcImporte" Enabled="false" Text="Importe"></asp:Label>
<i></i>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox CssClass="form-control" ID="TxtmcImporteGrabado" runat="server" MaxLength="10"></asp:TextBox>
<asp:Label runat="server" AssociatedControlID="TxtmcImporteGrabado" Enabled="false" Text="Gravado"></asp:Label>
<i></i>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox CssClass="form-control" ID="Txtmcvalor" runat="server" MaxLength="10"></asp:TextBox>
<asp:Label runat="server" AssociatedControlID="Txtmcvalor" Enabled="false" Text="Valor"></asp:Label>
<i></i>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
<asp:Button ID="BtnAceptarMC" CssClass="btn btn-primary" OnClick="BtnAceptarMC_Click" runat="server" Text="Aceptar" />
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div id="ModalEmpleados" class="modal ADS fade " role="dialog" data-backdrop="static" data-keyboard="false">
<asp:UpdatePanel class="modal-dialog" runat="server" ID="UpModalEmpleados" UpdateMode="Conditional">
@@ -434,7 +481,7 @@
</div>
<div class="modal-body">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlPersonal" DataTextField="Nombre" DataValueField="CvePersonal" runat="server" Width="100%" AppendDataBoundItems="true" CssClass="form-control select2me">
<asp:DropDownList ID="DdlPersonal" DataTextField="CodigoNombreCompleto" DataValueField="CvePersonal" runat="server" Width="100%" AppendDataBoundItems="true" CssClass="form-control select2me">
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
</asp:DropDownList>
<asp:Label runat="server" Text="Empleado: " AssociatedControlID="DdlPersonal"></asp:Label>

View File

@@ -87,8 +87,10 @@ public partial class Nomina_Finiquito : ClsPaginas
if (Request["CvePersonal"] != null && Request["CvePersonal"].ToString().ToEntero() > 0)
{
ViewState["CvePersonal"] = Request["CvePersonal"].ToString().ToEntero();
CargaPersonal();
HypCodigo.NavigateUrl = $"/RH/Personal.aspx?CvePersonal={CvePersonal}";
HypEmpleado.NavigateUrl = $"/RH/Personal.aspx?CvePersonal={CvePersonal}";
CargaMotivoBaja();
CargaPersonal();
}
else
{
@@ -97,9 +99,14 @@ public partial class Nomina_Finiquito : ClsPaginas
LtlEmpleadoCancelar.Visible = false;
RegistraScript("$('#ModalEmpleados').modal();");
}
gconceptos.Visible = ChkesLiquidacion.Checked;
}
}
protected void ChkesLiquidacion_CheckedChanged(object sender, EventArgs e)
{
gconceptos.Visible = ChkesLiquidacion.Checked;
}
private void CargaMotivoBaja()
{
DdlMotivoBaja.DataSource = GlobalDTMotivoBaja.FiltraParametros("CveEmpresa = " + UsuarioActual.CveEmpresa);
@@ -126,8 +133,11 @@ public partial class Nomina_Finiquito : ClsPaginas
DataRow drow = ObjPersonal.DtResultados.Rows[0];
HypCodigo.Text = drow["Codigo"].ToString();
HypEmpleado.Text = drow["NombreCompleto"].ToString();
HypCodigo.NavigateUrl =$"/RH/Personal.aspx?CvePersonal={drow["CvePersonal"]}";
LblPuesto.Text = drow["Puesto"].ToString();
LblSalario.Text = drow["SalarioDiario"].ToString();
LtlAreaGeografica.Text = drow["AreaGeografica"].ToString();
if (ObjPersonal.GetPersonalAltas(CvePersonal) && ObjPersonal.DtResultados.Rows.Count > 0)
{
DtAltas = ObjPersonal.DtResultados.FiltraParametros("", "FechaInicio");
@@ -136,7 +146,24 @@ public partial class Nomina_Finiquito : ClsPaginas
LblFechaAlta.Text = string.Format("{0:dd/MM/yyyy}", da["FechaInicio"]);
FechaInicio = LblFechaAlta.Text.ToDateTime();
TxtFechaBaja.Text = string.Format("{0:dd/MM/yyyy}", da["FechaFin"]);
{
if(da["CveMotivoBaja"].ToString() == "")
{
chkIndemnizacion.Checked = true;
chkSeparacionUnica.Checked = true;
chkPrimaantiguedad.Checked = true;
}
else
{
chkIndemnizacion.Checked = da["ValIndemnizacion"].ToString().ToUpper().Contiene(new string[] { "1", "TRUE" });
chkSeparacionUnica.Checked = da["ValSeparacionunica"].ToString().ToUpper().Contiene(new string[] { "1", "TRUE" });
chkPrimaantiguedad.Checked = da["ValPrimadeantiguedad"].ToString().ToUpper().Contiene(new string[] { "1", "TRUE" });
}
}
DdlMotivoBaja.SelectedValueExist(da["CveMotivoBaja"]);
TxtSalarioMinimo.Text = $"{da["SalarioMinimo"]:N2}" ;
ChkesLiquidacion.Checked = (da["esLiquidacion"].ToString() == "1" || da["esLiquidacion"].ToString().ToUpper() == "TRUE");
CvePeriodoIndemnizacion = da["CvePeriodoIndemnizacion"].ToString().ToEntero();
CvePeriodoFiniquito = da["CvePeriodoFiniquito"].ToString().ToEntero();
@@ -161,7 +188,7 @@ public partial class Nomina_Finiquito : ClsPaginas
private void CamposCalculados()
{
TxtSalarioMinimo.Text = "123.22";
//TxtSalarioMinimo.Text = "123.22";
if (TxtFechaBaja.Text.Length > 9)
{
DateTime fechafin = TxtFechaBaja.Text.ToDateTime();
@@ -179,15 +206,19 @@ public partial class Nomina_Finiquito : ClsPaginas
private decimal getyearsresult(DateTime fechafin, DateTime fechainicio)
{
decimal retorno = 0;
DateTime zeroTime = new DateTime(1, 1, 1);
decimal mes =12;
retorno =(fechafin.Year -fechainicio.Year ) - (fechafin.Month > fechainicio.Month ? 0 : (fechafin.Month == fechainicio.Month && fechafin.Day > fechainicio.Day ? 0 : 1));
retorno +=(((fechafin.Month == fechainicio.Month && fechafin.Day > fechainicio.Day ? fechainicio.Month : fechafin.Month + (fechafin.Month > fechainicio.Month ? 0 : 12)) - fechainicio.Month) / mes);
/* DateTime zeroTime = new DateTime(1, 1, 1);
TimeSpan span;
if (fechainicio < fechafin)
{
span = fechafin - fechainicio;
decimal years = (zeroTime + span).Year - 1;
retorno = Math.Round(years + (span.TotalDays.ToString().ToDecimal() / 365), 4);
}
}*/
return retorno;
}
@@ -257,11 +288,36 @@ public partial class Nomina_Finiquito : ClsPaginas
}
//PnlConceptoPersonal.Visible = false;
//DdlmcConceptos_SelectedIndexChanged(DdlmcConceptos, null);
DdlmcConceptos_SelectedIndexChanged(DdlmcConceptos, null);
RegistraScript(string.Format("$('#ModalUpConcepto').on('shown.bs.modal', function () {{$('#{0}').trigger('focus')}});$('#ModalUpConcepto').modal();", TxtmcImporte.ClientID));
UPpanelModalUpConcepto.Update();
}
protected void DdlmcConceptos_SelectedIndexChanged(object sender, EventArgs e)
{
int CveConcepto = DdlmcConceptos.SelectedValue.ToEntero();
TxtmcImporte.Text = "";
TxtmcImporteGrabado.Text = "";
Txtmcvalor.Text = "";
if (CveConcepto > 0)
{
DataRow drow = dtempleadosConceptos.FiltroPrimero(string.Format("CveConcepto={0} AND CvePersonal ={1}", CveConcepto, CvePersonal));
if (drow != null)
{
TxtmcImporte.Text = string.Format("{0:N2}", drow["Importe"]);
TxtmcImporteGrabado.Text = string.Format("{0:N2}", drow["ImporteGravado"]);
Txtmcvalor.Text = string.Format("{0:N2}", drow["Valor"]);
}
}
else
{
if (e != null)
{
Alert("Seleccione un concepto.", TipoMensaje.MsgAdvertencia);
}
}
UPpanelModalUpConcepto.Update();
}
int CveConceptoPolgvc, CveConceptoDolgvc;
protected void GvConceptos_RowDataBound(object sender, GridViewRowEventArgs e)
{
@@ -745,8 +801,30 @@ public partial class Nomina_Finiquito : ClsPaginas
private List<NConcepto> cargasobrericiboconceptos(DataTable dtConceptos, DataTable dtempleadosConceptos, DataTable dtempleados)
{
int SRCvePersonal = this.CvePersonal;
DataTable dtper = dtConceptos.FiltraParametros("Tipo IN ('P') AND EsPadre = 1 ");
DataTable dtded = dtConceptos.FiltraParametros("Tipo IN ('D') AND EsPadre = 1 ");
DataTable dtper = dtConceptos.FiltraParametros("Tipo IN ('P') AND EsPadre = 1 And CveSistema NOT IN(10,11,32) ");
DataTable dtded = dtConceptos.FiltraParametros("Tipo IN ('D') AND EsPadre = 1 AND CveSistema <> 47");
double percepcionesindem = 0;
double deduccionesindem = 0;
foreach (DataRow row in dtConceptos.FiltraParametros("Tipo IN ('P') AND EsPadre = 1 And CveSistema IN(10,11,32) ").Rows)
{
int CveConcepto = row["CveConcepto"].ToString().ToEntero();
string Concepto = row["Concepto"].ToString();
string Codigo = row["Codigo"].ToString();
//bool visible = (dtempleados.SUM(string.Format("[V_{0}]", CveConcepto)) > 0);
double Importe = dtempleados.SUM(string.Format("[V_{0}]", CveConcepto), string.Format("CvePersonal = {0}", SRCvePersonal));
percepcionesindem += Importe;
}
foreach (DataRow row in dtConceptos.FiltraParametros("Tipo IN ('D') AND EsPadre = 1 AND CveSistema =47").Rows)
{
int CveConcepto = row["CveConcepto"].ToString().ToEntero();
string Concepto = row["Concepto"].ToString();
string Codigo = row["Codigo"].ToString();
//bool visible = (dtempleados.SUM(string.Format("[V_{0}]", CveConcepto)) > 0);
double Importe = dtempleados.SUM(string.Format("[V_{0}]", CveConcepto), string.Format("CvePersonal = {0}", SRCvePersonal));
deduccionesindem += Importe;
}
dtper.Columns.Add("BorradoLogico", typeof(int));
dtded.Columns.Add("BorradoLogico", typeof(int));
@@ -824,19 +902,145 @@ public partial class Nomina_Finiquito : ClsPaginas
SubTotales.CveConceptoP = 0;
SubTotales.ConceptoP = "Total Percepciones";
SubTotales.EstatusP = -2;
SubTotales.ImporteP = dtempleados.SUM("SumaPercepciones", string.Format("CvePersonal = {0}", SRCvePersonal));
SubTotales.ImporteP = dtempleados.SUM("SumaPercepciones", string.Format("CvePersonal = {0}", SRCvePersonal))- percepcionesindem;
///Alert(SubTotales.ImporteP.ToString());
SubTotales.CveConceptoD = 0;
SubTotales.ConceptoD = "Total Deducciones";
SubTotales.EstatusD = -2;
SubTotales.ImporteD = dtempleados.SUM("SumaDeducciones", string.Format("CvePersonal = {0}", SRCvePersonal));
SubTotales.ImporteD = dtempleados.SUM("SumaDeducciones", string.Format("CvePersonal = {0}", SRCvePersonal))- deduccionesindem;
double neto = SubTotales.ImporteP - SubTotales.ImporteD;
NConcepto Totales = new NConcepto();
Totales.CveConceptoD = 0;
Totales.ConceptoD = "Total";
Totales.EstatusD = -3;
Totales.ImporteD = dtempleados.SUM("Total", string.Format("CvePersonal = {0}", SRCvePersonal));
Totales.ImporteD = neto;
lconc.Add(SubTotales);
lconc.Add(Totales);
return lconc;
}
private List<NConcepto> cargasobrericiboconceptosIndemnizacion(DataTable dtConceptos, DataTable dtempleadosConceptos, DataTable dtempleados)
{
int SRCvePersonal = this.CvePersonal;
DataTable dtper = dtConceptos.FiltraParametros("Tipo IN ('P') AND EsPadre = 1 AND CveSistema IN(10,11,32) ");
DataTable dtded = dtConceptos.FiltraParametros("Tipo IN ('D') AND EsPadre = 1 AND CveSistema = 47");
double percepcionesindem = 0;
double deduccionesindem = 0;
foreach (DataRow row in dtConceptos.FiltraParametros("Tipo IN ('P') AND EsPadre = 1 And CveSistema IN(10,11,32) ").Rows)
{
int CveConcepto = row["CveConcepto"].ToString().ToEntero();
string Concepto = row["Concepto"].ToString();
string Codigo = row["Codigo"].ToString();
//bool visible = (dtempleados.SUM(string.Format("[V_{0}]", CveConcepto)) > 0);
double Importe = dtempleados.SUM(string.Format("[V_{0}]", CveConcepto), string.Format("CvePersonal = {0}", SRCvePersonal));
percepcionesindem += Importe;
}
foreach (DataRow row in dtConceptos.FiltraParametros("Tipo IN ('D') AND EsPadre = 1 AND CveSistema =47").Rows)
{
int CveConcepto = row["CveConcepto"].ToString().ToEntero();
string Concepto = row["Concepto"].ToString();
string Codigo = row["Codigo"].ToString();
//bool visible = (dtempleados.SUM(string.Format("[V_{0}]", CveConcepto)) > 0);
double Importe = dtempleados.SUM(string.Format("[V_{0}]", CveConcepto), string.Format("CvePersonal = {0}", SRCvePersonal));
deduccionesindem += Importe;
}
dtper.Columns.Add("BorradoLogico", typeof(int));
dtded.Columns.Add("BorradoLogico", typeof(int));
foreach (DataRow row in dtper.Rows)
{
int BorradoLogico = 0;
int CveConcepto = row["CveConcepto"].ToString().ToEntero();
if (!(dtempleados.SUM(string.Format("[V_{0}]", CveConcepto)) != 0))
{
BorradoLogico = 1;
}
row["BorradoLogico"] = BorradoLogico;
}
dtper.AcceptChanges();
foreach (DataRow row in dtded.Rows)
{
int BorradoLogico = 0;
int CveConcepto = row["CveConcepto"].ToString().ToEntero();
if (!(dtempleados.SUM(string.Format("[V_{0}]", CveConcepto)) != 0))
{
BorradoLogico = 1;
}
row["BorradoLogico"] = BorradoLogico;
}
dtded.AcceptChanges();
dtper = dtper.FiltraParametros("BorradoLogico=0");
dtded = dtded.FiltraParametros("BorradoLogico=0");
int maxper = dtper.Rows.Count;
int maxded = dtded.Rows.Count;
int i = 0;
List<NConcepto> lconc = new List<NConcepto>();
for (i = 0; i < maxper || i < maxded; i++)
{
NConcepto nConcepto = new NConcepto();
DataRow row;
if (maxper > i)
{
row = dtper.Rows[i];
int CveConcepto = row["CveConcepto"].ToString().ToEntero();
string Concepto = row["Concepto"].ToString();
string Codigo = row["Codigo"].ToString();
//bool visible = (dtempleados.SUM(string.Format("[V_{0}]", CveConcepto)) > 0);
double Importe = dtempleados.SUM(string.Format("[V_{0}]", CveConcepto), string.Format("CvePersonal = {0}", SRCvePersonal));
nConcepto.CveConceptoP = CveConcepto;
nConcepto.ConceptoP = Concepto;
nConcepto.NoConceptoP = Codigo;
nConcepto.ImporteP = Importe;
nConcepto.ValorP = dtempleados.SUM(string.Format("[VAL_{0}]", CveConcepto), string.Format("CvePersonal = {0}", SRCvePersonal));
nConcepto.isOnlyBisibleP = row["SoloVisible"].ToString().ToEntero();
nConcepto.isEditedP = dtempleadosConceptos.COUNT("CveConcepto", string.Format("CveConcepto={0} AND CvePersonal ={1} AND Estatus =2", CveConcepto, SRCvePersonal));
}
if (maxded > i)
{
row = dtded.Rows[i];
int CveConcepto = row["CveConcepto"].ToString().ToEntero();
string Concepto = row["Concepto"].ToString();
string Codigo = row["Codigo"].ToString();
//bool visible = (dtempleados.SUM(string.Format("[V_{0}]", CveConcepto)) > 0);
double Importe = dtempleados.SUM(string.Format("[V_{0}]", CveConcepto), string.Format("CvePersonal = {0}", SRCvePersonal));
nConcepto.CveConceptoD = CveConcepto;
nConcepto.ConceptoD = Concepto;
nConcepto.NoConceptoD = Codigo;
nConcepto.ImporteD = Importe;
nConcepto.ValorD = dtempleados.SUM(string.Format("[VAL_{0}]", CveConcepto), string.Format("CvePersonal = {0}", SRCvePersonal));
nConcepto.isOnlyBisibleD = row["SoloVisible"].ToString().ToEntero();
nConcepto.isEditedD = dtempleadosConceptos.COUNT("CveConcepto", string.Format("CveConcepto={0} AND CvePersonal ={1} AND Estatus =2", CveConcepto, SRCvePersonal));
}
lconc.Add(nConcepto);
}
lconc.Add(new NConcepto());
NConcepto SubTotales = new NConcepto();
SubTotales.CveConceptoP = 0;
SubTotales.ConceptoP = "Total Percepciones";
SubTotales.EstatusP = -2;
SubTotales.ImporteP = percepcionesindem;
///Alert(SubTotales.ImporteP.ToString());
SubTotales.CveConceptoD = 0;
SubTotales.ConceptoD = "Total Deducciones";
SubTotales.EstatusD = -2;
SubTotales.ImporteD = deduccionesindem;
double neto = SubTotales.ImporteP - SubTotales.ImporteD;
NConcepto Totales = new NConcepto();
Totales.CveConceptoD = 0;
Totales.ConceptoD = "Total";
Totales.EstatusD = -3;
Totales.ImporteD = neto;
lconc.Add(SubTotales);
lconc.Add(Totales);
@@ -858,7 +1062,7 @@ public partial class Nomina_Finiquito : ClsPaginas
using (ClsRH ObjPersonal = new ClsRH())
using (ClsNominas onom = new ClsNominas(ObjPersonal.IniciaTransacSQL()))
{
if (ObjPersonal.UpPersonalAltas(CvePersonal, "", TxtFechaBaja.Text.ToDateTime().ToString("yyyy/MM/dd"), -1, DdlMotivoBaja.SelectedValue.ToEntero(), ChkesLiquidacion.Checked) && ObjPersonal.GetPersonalAltas(CvePersonal) && ObjPersonal.DtResultados.Rows.Count > 0)
if (ObjPersonal.UpPersonalAltas(CvePersonal, "", TxtFechaBaja.Text.ToDateTime().ToString("yyyy/MM/dd"), -1, DdlMotivoBaja.SelectedValue.ToEntero(), ChkesLiquidacion.Checked,chkIndemnizacion.Checked ,chkSeparacionUnica.Checked, chkPrimaantiguedad.Checked) && ObjPersonal.GetPersonalAltas(CvePersonal) && ObjPersonal.DtResultados.Rows.Count > 0)
{
DataRow da = ObjPersonal.DtResultados.Rows[0];
CvePeriodoIndemnizacion = da["CvePeriodoIndemnizacion"].ToString().ToEntero();
@@ -894,6 +1098,7 @@ public partial class Nomina_Finiquito : ClsPaginas
DataTable dtempleados = null;
*/
/*
if (objnom.GetNominaEmpleado(-1, -1, -1, CvePeriodoIndemnizacion, UsuarioActual.CveEmpresa, 1, 3, CvePersonal) && objnom.DTSetResultados.Tables.Count > 1)
{
dtempleados = objnom.DTSetResultados.Tables[3];
@@ -903,7 +1108,7 @@ public partial class Nomina_Finiquito : ClsPaginas
if (dtConceptos != null && dtempleadosConceptos != null && dtempleados != null)
{
finindem = cargasobrericiboconceptos(dtConceptos, dtempleadosConceptos, dtempleados);
}
}*/
dtempleadosConceptos = null;
dtempleados = null;
if (objnom.GetNominaEmpleado(-1, -1, -1, CvePeriodoFiniquito, UsuarioActual.CveEmpresa, 1, 3, CvePersonal) && objnom.DTSetResultados.Tables.Count > 1)
@@ -919,6 +1124,7 @@ public partial class Nomina_Finiquito : ClsPaginas
if (dtConceptos != null && dtempleadosConceptos != null && dtempleados != null)
{
finordin = cargasobrericiboconceptos(dtConceptos, dtempleadosConceptos, dtempleados);
finindem = cargasobrericiboconceptosIndemnizacion(dtConceptos, dtempleadosConceptos, dtempleados);
}
GvFinOrdinario.DataSource = finordin;
@@ -1105,7 +1311,7 @@ public partial class Nomina_Finiquito : ClsPaginas
using (ClsRH ObjPersonal = new ClsRH())
using (ClsNominas onom = new ClsNominas(ObjPersonal.IniciaTransacSQL()))
{
if (ObjPersonal.UpPersonalAltas(CvePersonal, "", TxtFechaBaja.Text.ToDateTime().ToString("yyyy/MM/dd"), -1, DdlMotivoBaja.SelectedValue.ToEntero(), ChkesLiquidacion.Checked) && ObjPersonal.GetPersonalAltas(CvePersonal) && ObjPersonal.DtResultados.Rows.Count > 0)
if (ObjPersonal.UpPersonalAltas(CvePersonal, "", TxtFechaBaja.Text.ToDateTime().ToString("yyyy/MM/dd"), -1, DdlMotivoBaja.SelectedValue.ToEntero(), ChkesLiquidacion.Checked, chkIndemnizacion.Checked, chkSeparacionUnica.Checked, chkPrimaantiguedad.Checked) && ObjPersonal.GetPersonalAltas(CvePersonal) && ObjPersonal.DtResultados.Rows.Count > 0)
{
DataRow da = ObjPersonal.DtResultados.Rows[0];
CvePeriodoIndemnizacion = da["CvePeriodoIndemnizacion"].ToString().ToEntero();
@@ -1131,12 +1337,7 @@ public partial class Nomina_Finiquito : ClsPaginas
}
UPDatos.Update();
}
protected void DdlmcConceptos_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void BtnAceptarMC_Click(object sender, EventArgs e)
{
@@ -1211,7 +1412,7 @@ public partial class Nomina_Finiquito : ClsPaginas
loadsobrerecibo(objNomina);
}
Alert("El cambio se ha guardado correctamente.");
}
}
}
else
@@ -1227,4 +1428,5 @@ public partial class Nomina_Finiquito : ClsPaginas
}
}
}

View File

@@ -4,6 +4,11 @@
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
<style>
.fa-ad-pdf.fa::before {
background: #999;
content: "\f1c1";
}
.lblforchk {
font-size: 13px;
color: #888888;
@@ -194,6 +199,9 @@
<li>
<asp:LinkButton ID="LnkVerTablas" OnClick="LnkVerTablas_Click" runat="server"><i class="fa fa-columns" aria-hidden="true"></i>Tablas de cálculo</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="LnkVerCalculoISR" OnClick="LnkVerCalculoISR_Click" runat="server"><i class="fa fa-columns" aria-hidden="true"></i>Cálculo ISR</asp:LinkButton>
</li>
<li>
<asp:HyperLink ID="HypAsistencia" NavigateUrl="/RH/Asistencias.aspx" runat="server"><i class="fa fa-list" aria-hidden="true"></i>Ir a asistencia</asp:HyperLink>
</li>
@@ -254,10 +262,10 @@
<asp:LinkButton ID="LnkConsultar" OnClick="LnkConsultar_Click" runat="server" Text="Calcular" Visible="False" class="btn btn-primary" />
<%--<asp:Label AssociatedControlID="chkesListaderaya" runat="server" Text="¿es lista de raya?"></asp:Label>--%>
<%--<asp:CheckBox ID="chkesListaderaya" Text=" " data-checkbox=" icheckbox_minimal-blue blue " Checked="false" CssClass="icheck chekVal " runat="server" />--%>
<asp:Button ID="BtnAutorizar" runat="server" Text="Autorizar" Visible="False" class="btn btn-primary" />
<asp:Button ID="BtnGeneraPDF" runat="server" Text="PDF" Visible="False" class="btn btn-primary" />
<asp:Button ID="BtnEmitir" runat="server" Text="Timbrar" Visible="False" class="btn btn-primary" />
<asp:Button ID="BtnActualizaNomina" runat="server" Text="Act Nomina" Visible="False" class="btn btn-primary" />
<asp:Button ID="BtnAutorizar" UseSubmitBehavior="false" runat="server" Text="Autorizar" Visible="False" class="btn btn-primary" />
<asp:Button ID="BtnGeneraPDF" UseSubmitBehavior="false" runat="server" Text="PDF" Visible="False" class="btn btn-primary" />
<asp:Button ID="BtnEmitir" UseSubmitBehavior="false" runat="server" Text="Timbrar" Visible="False" class="btn btn-primary" />
<asp:Button ID="BtnActualizaNomina" UseSubmitBehavior="false" runat="server" Text="Act Nomina" Visible="False" class="btn btn-primary" />
<a style="display: none;" href="/Coolings.docx">Recibos</a>
</div>
</div>
@@ -340,7 +348,7 @@
<div class="portlet-title">
<div class="caption ">
<i class="fa fa-bookmark font-yellow-gold"></i>
<span class="caption-subject font-yellow-gold bold uppercase">Nomina</span>
<span class="caption-subject font-yellow-gold bold uppercase">Nomina <asp:Literal ID="LtlPeriodoseleccionado" runat="server"></asp:Literal></span>
</div>
<div class="tools">
@@ -357,7 +365,7 @@
</div>
</div>
<div class="portlet-body nomarginleftright form-horizontal form-row-sepe formnombottom ">
<asp:GridView ID="GvNominas" runat="server" DataKeyNames="CvePeriodo,CvePersonal,CveNomina,SeTimbro,SerieFolio,Nombre,Correo,Codigo,Turno,Departamento,SubProyecto,NomAutorizado" AutoGenerateColumns="False" OnRowDataBound="GvNominas_RowDataBound"
<asp:GridView ID="GvNominas" runat="server" DataKeyNames="CvePeriodo,CvePersonal,CveNomina,SeTimbro,SeTimbroFiniquito,EsRenuncia,SerieFolio,Nombre,Correo,Codigo,Turno,Departamento,SubProyecto,NomAutorizado" AutoGenerateColumns="False" OnRowDataBound="GvNominas_RowDataBound"
CssClass="table table-striped table-advance table-hover mysmallbtn ScrollAD Widthall GvNominas" Style="text-align: center;" GridLines="None" data-cols="2" data-rows="2" data-heighterror="360">
<Columns>
@@ -495,9 +503,9 @@
<asp:TemplateField>
<ItemTemplate>
<div style="width: 100px; text-align: right; white-space: nowrap; padding-right: 10px;">
<asp:HyperLink ID="HypXml" Visible="false" NavigateUrl="#" runat="server">XML</asp:HyperLink>
<asp:HyperLink ID="HypPDF" CssClass="btn btn-circle btn-sm blue mysmallbtn" Visible="false" NavigateUrl="#" runat="server"><i class="fa fa-ad-pdf"></i></asp:HyperLink>
<div style="min-width: 100px; text-align: right; white-space: nowrap; padding-right: 10px;">
<asp:HyperLink ID="HypXml" ToolTip="Formato xml" Visible="false" CssClass="btn btn-circle btn-sm blue mysmallbtn" NavigateUrl="#" runat="server"><i class="fa fa-file-o"></i></asp:HyperLink>
<asp:HyperLink ID="HypPDF" ToolTip="Formato Timbre" CssClass="btn btn-circle btn-sm red mysmallbtn" Visible="false" NavigateUrl="#" runat="server"><i class="fa fa-file-pdf-o"></i></asp:HyperLink>
<asp:LinkButton runat="server" ID="LnkTimbrar" CssClass="btn btn-circle btn-sm blue mysmallbtn" Text="<i class='fa fa-bell'></i>" OnClick="LnkTimbrar_Click" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea Timbrar?" data-btn-ok-label="si" />
<asp:LinkButton runat="server" ID="ImgDelete" CssClass="btn btn-circle btn-sm red mysmallbtn" Text="<i class='icon-trash'></i>" OnClick="ImgDelete_Click" CommandArgument='<%# Eval("CveNomina") %>' Visible='<%# (Eval("CveNomina").ToString() != "" && Eval("SeTimbro").ToString() == "False"? true :false)%>' data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea eliminar la nómina?" data-btn-ok-label="si" />
<asp:LinkButton runat="server" ID="LnkCancelar" CssClass="btn btn-circle btn-sm red mysmallbtn" Text="<i class='fa fa-ban'></i>" OnClick="LnkCancelar_Click" CommandArgument='<%# Eval("CveNomina") %>' Visible='<%# (Eval("CveNomina").ToString() != "" && PermisoCancelarEmitido && Eval("SeTimbro").ToString() == "True"? true :false)%>' data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea cancelar la nómina?" data-btn-ok-label="si" />
@@ -613,7 +621,7 @@
</div>
<asp:Button ID="BtnImprimirsobrerecibo" OnClick="BtnImprimirsobrerecibo_Click" runat="server" Text="Imprimir" CssClass="btn btn-primary hidden" />
<asp:Button ID="BtnImprimirsobrerecibo" OnClick="BtnImprimirsobrerecibo_Click" UseSubmitBehavior="false" runat="server" Text="Imprimir" CssClass="btn btn-primary hidden" />
<div id="ModalConceptos" class="modal ADS fade" role="dialog">
<asp:UpdatePanel class="modal-dialog modal-lg" runat="server" ID="UpModalConceptos" UpdateMode="Conditional">
@@ -767,7 +775,9 @@
<ItemTemplate>
<asp:Label ID="LtlImporte" runat="server" Text='<%# Eval("ImporteP", "${0:N}") %>' Style="word-break: break-all;"></asp:Label>
<asp:LinkButton ID="LnkImporte" OnClick="LnkConcepto_Click" runat="server"></asp:LinkButton>
<asp:LinkButton ID="LnkImportexCalculo" OnClick="LnkImportexCalculo_Click" runat="server" CssClass="btn btn-circle btn-sm btn-xs red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea eliminar el importe fijo?" data-btn-ok-label="si"></asp:LinkButton>
<div style="display: inline-block; width: 29px;">
<asp:LinkButton ID="LnkImportexCalculo" OnClick="LnkImportexCalculo_Click" runat="server" CssClass="btn btn-circle btn-sm btn-xs red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea eliminar el importe fijo?" data-btn-ok-label="si"></asp:LinkButton>
</div>
</ItemTemplate>
<ItemStyle HorizontalAlign="Right" Width="13%" />
</asp:TemplateField>
@@ -788,7 +798,9 @@
<ItemTemplate>
<asp:Label ID="LtlImporteD" runat="server" Text='<%# Eval("ImporteD", "${0:N}") %>' Style="word-break: break-all;"></asp:Label>
<asp:LinkButton ID="LnkImporteD" OnClick="LnkConcepto_Click" runat="server"></asp:LinkButton>
<asp:LinkButton ID="LnkImporteDxCalculo" OnClick="LnkImportexCalculo_Click" runat="server" CssClass="btn btn-circle btn-sm btn-xs red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea eliminar el importe fijo?" data-btn-ok-label="si"></asp:LinkButton>
<div style="display: inline-block; width: 29px;">
<asp:LinkButton ID="LnkImporteDxCalculo" OnClick="LnkImportexCalculo_Click" runat="server" CssClass="btn btn-circle btn-sm btn-xs red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea eliminar el importe fijo?" data-btn-ok-label="si"></asp:LinkButton>
</div>
</ItemTemplate>
<ItemStyle HorizontalAlign="Right" Width="13%" />
</asp:TemplateField>
@@ -877,7 +889,7 @@
</div>
</div>
<div class="text-right">
<asp:Button ID="BtnGuardarInfornavit" OnClick="BtnGuardarInfornavit_Click" runat="server" Text="Guardar" class="btn btn-primary" />
<asp:Button ID="BtnGuardarInfornavit" UseSubmitBehavior="false" OnClick="BtnGuardarInfornavit_Click" runat="server" Text="Guardar" class="btn btn-primary" />
</div>
</div>
</div>
@@ -1144,6 +1156,11 @@
<div class="tools">
<a href="javascript:;" class="collapse" data-original-title="" title=""></a>
</div>
<div class="actions">
<div class="btn-group">
<asp:LinkButton ID="LnkShowAddVacaciones" OnClick="LnkShowAddVacaciones_Click" CssClass="btn yellow-gold" runat="server">Agregar</asp:LinkButton>
</div>
</div>
</div>
<div class="portlet-body">
@@ -1297,7 +1314,16 @@
</asp:TemplateField>
<asp:TemplateField HeaderText="Dias autorizados">
<ItemTemplate>
<asp:LinkButton runat="server" Text='<%# Eval("DiasAutorizados")%>' OnClick="LnkPersonalIncapacidad_Click" data-toggle="tooltip" title="Editar" Width="100%"> </asp:LinkButton>
<asp:LinkButton runat="server" OnClick="LnkPersonalIncapacidad_Click" data-toggle="tooltip" title="Editar" Width="100%">
<div class="row">
<div class="col-md-6">
<%# Eval("DiasAutorizados")%>
</div>
<div class="col-md-6 text-right">
<label class="btn btn-circle btn-sm green mysmallbtn"><i class="fa fa-pencil"></i></label>
</div>
</div>
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
@@ -1478,7 +1504,7 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
<asp:Button ID="BtnAceptarMC" CssClass="btn btn-primary" OnClick="BtnAceptarMC_Click" runat="server" Text="Aceptar" />
<asp:Button ID="BtnAceptarMC" UseSubmitBehavior="false" CssClass="btn btn-primary" OnClick="BtnAceptarMC_Click" runat="server" Text="Aceptar" />
</div>
</div>
@@ -1603,9 +1629,71 @@
<asp:GridView ID="GVVigISRAnual" runat="server" CssClass="table table-striped table-hover mysmallbtn Widthall GvNominas" GridLines="None"></asp:GridView>
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel ID="TTVigISRMensual" runat="server" HeaderText="ISR Mensual">
<ajax:TabPanel ID="TTVigISRMensual" runat="server" HeaderText="ISR ">
<ContentTemplate>
<asp:GridView ID="GVVigISRMensual" runat="server" CssClass="table table-striped table-hover mysmallbtn Widthall GvNominas" GridLines="None"></asp:GridView>
<div class="portlet light xspadding bordered">
<div class="portlet-title">
<div class="caption ">
<i class="fa fa-bookmark font-yellow-gold"></i>
<span class="caption-subject bold uppercase font-yellow-gold">Mensual</span>
</div>
<div class="tools">
<a href="javascript:;" class="collapse" data-original-title="" title=""></a>
<a href="javascript:;" class="fullscreen" data-original-title="" title=""></a>
</div>
</div>
<div class="portlet-body ">
<asp:GridView ID="GVVigISRMensual" runat="server" CssClass="table table-striped table-hover mysmallbtn Widthall GvNominas" GridLines="None"></asp:GridView>
</div>
</div>
<div class="portlet light xspadding bordered">
<div class="portlet-title">
<div class="caption ">
<i class="fa fa-bookmark font-yellow-gold"></i>
<span class="caption-subject bold uppercase font-yellow-gold">Semana</span>
</div>
<div class="tools">
<a href="javascript:;" class="collapse" data-original-title="" title=""></a>
<a href="javascript:;" class="fullscreen" data-original-title="" title=""></a>
</div>
</div>
<div class="portlet-body ">
<asp:GridView ID="GVVigISRSemanal" runat="server" CssClass="table table-striped table-hover mysmallbtn Widthall GvNominas" GridLines="None"></asp:GridView>
</div>
</div>
<div class="portlet light xspadding bordered">
<div class="portlet-title">
<div class="caption ">
<i class="fa fa-bookmark font-yellow-gold"></i>
<span class="caption-subject bold uppercase font-yellow-gold">Decenal</span>
</div>
<div class="tools">
<a href="javascript:;" class="collapse" data-original-title="" title=""></a>
<a href="javascript:;" class="fullscreen" data-original-title="" title=""></a>
</div>
</div>
<div class="portlet-body ">
<asp:GridView ID="GVVigISRDecenal" runat="server" CssClass="table table-striped table-hover mysmallbtn Widthall GvNominas" GridLines="None"></asp:GridView>
</div>
</div>
<div class="portlet light xspadding bordered">
<div class="portlet-title">
<div class="caption ">
<i class="fa fa-bookmark font-yellow-gold"></i>
<span class="caption-subject bold uppercase font-yellow-gold">Quincenal</span>
</div>
<div class="tools">
<a href="javascript:;" class="collapse" data-original-title="" title=""></a>
<a href="javascript:;" class="fullscreen" data-original-title="" title=""></a>
</div>
</div>
<div class="portlet-body ">
<asp:GridView ID="GVVigISRQuincenal" runat="server" CssClass="table table-striped table-hover mysmallbtn Widthall GvNominas" GridLines="None"></asp:GridView>
</div>
</div>
</ContentTemplate>
</ajax:TabPanel>
<ajax:TabPanel ID="TTVigSubEmpAnual" runat="server" HeaderText="Subsidio Anual" Visible="false">
@@ -1674,6 +1762,80 @@
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div id="ModalCalculoISR" class="modal ADS fade" role="dialog">
<asp:UpdatePanel class="modal-dialog modal-lg" runat="server" ID="UpCalculoISR" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-content">
<div class="modal-header ">
<h4 class="modal-title">
<asp:Label runat="server" Text="CálculoISR"></asp:Label></h4>
</div>
<div class="modal-body">
<asp:GridView ID="GVCalculoISR" runat="server" CssClass="table table-striped table-hover mysmallbtn Widthall ScrollAD" GridLines="None" AutoGenerateColumns="false"
ShowHeaderWhenEmpty ="true">
<Columns>
<asp:TemplateField HeaderText="Empleado">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("Nombre")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Base gravable">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("SumaPercepcionesG","{0:N2}")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Limite inferior">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("LimiteInferior","{0:N2}")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Excedente L.I.">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("ExedenteLI","{0:N2}")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Porcentaje sobre excedente">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("PorcentajeSE","{0:N2}")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Impuesto marginal">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("ImpuestoMarginal","{0:N2}")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Cuota fija">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("cuotafija","{0:N2}")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Impuesto antes de subsidio">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("Impuestoantessubs","{0:N2}")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Subsidio">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("subsidio","{0:N2}")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Impuesto a cargo o a favor">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("Impuesto","{0:N2}")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div id="DModalNominas" class="modal ADS fade" role="dialog">
<asp:UpdatePanel ID="UpCargarNomina" class="modal-dialog" tabindex="-1" runat="server" UpdateMode="Conditional">
@@ -1865,7 +2027,7 @@
</table>--%>
<asp:GridView ID="GvConceptossimulador" runat="server" AutoGenerateColumns="False" CssClass="table table-striped table-hover Widthall GvConceptossimulador"
Style="text-align: center;" GridLines="None" OnRowDataBound="GvConceptos_RowDataBound" ShowHeaderWhenEmpty="true"
DataKeyNames="ConceptoP,CveConceptoP,ImporteP,ValorP,EstatusP,ConceptoD,CveConceptoD,ImporteD,EstatusD,ValorD,isOnlyBisibleD,isOnlyBisibleP,isEditedD,isEditedP">
DataKeyNames="ConceptoP,CveConceptoP,ImporteP,ValorP,EstatusP,ConceptoD,CveConceptoD,ImporteD,EstatusD,ValorD,isOnlyBisibleD,isOnlyBisibleP,isEditedD,isEditedP,isOnlyBisibleO">
<Columns>
<asp:TemplateField HeaderText="Concepto">
<ItemTemplate>
@@ -2023,7 +2185,7 @@
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" runat="server" style="text-align: left">Reporte de incidencias</h4>
<h4 class="modal-title" runat="server" style="text-align: left">Reporte de acumulados</h4>
</div>
<div class="modal-body">
@@ -2066,7 +2228,7 @@
<asp:Label runat="server" AssociatedControlID="TxtRIFechaInicio">Fecha Inicio</asp:Label>
<ajax:MaskedEditExtender ID="MaskedEditExtender3" runat="server" TargetControlID="TxtRpdFechaInicio" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CalendarExtender3" TargetControlID="TxtRpdFechaInicio" PopupPosition="BottomRight" Enabled="True" Format="dd/MM/yyyy"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="rfvRpdFechaInicio" runat="server" ControlToValidate="TxtRpdFechaInicio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Inicio''</b> es necesario, por favor ingréselo." ValidationGroup="VGReporteInicidencia"></asp:RequiredFieldValidator>
<asp:RequiredFieldValidator ID="rfvRpdFechaInicio" runat="server" ControlToValidate="TxtRpdFechaInicio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Inicio''</b> es necesario, por favor ingréselo." ValidationGroup="VGReporterepperde"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" HighlightCssClass="vco" TargetControlID="rfvRpdFechaInicio"></ajax:ValidatorCalloutExtender>
</div>
</div>
@@ -2076,7 +2238,7 @@
<asp:Label runat="server" AssociatedControlID="TxtRIFechaFin">Fecha Fin</asp:Label>
<ajax:MaskedEditExtender ID="MaskedEditExtender5" runat="server" TargetControlID="TxtRpdFechaFin" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CalendarExtender4" TargetControlID="TxtRpdFechaFin" PopupPosition="BottomRight" Enabled="True" Format="dd/MM/yyyy"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="rfvRpdFechaFin" runat="server" ControlToValidate="TxtRpdFechaFin" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Fin''</b> es necesario, por favor ingréselo." ValidationGroup="VGReporteInicidencia"></asp:RequiredFieldValidator>
<asp:RequiredFieldValidator ID="rfvRpdFechaFin" runat="server" ControlToValidate="TxtRpdFechaFin" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Fin''</b> es necesario, por favor ingréselo." ValidationGroup="VGReporterepperde"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender2" runat="server" HighlightCssClass="vco" TargetControlID="rfvRpdFechaFin"></ajax:ValidatorCalloutExtender>
</div>
</div>
@@ -2180,7 +2342,161 @@
</div>
<div class="portlet-body rowpadding " style="display: none;">
<div style="width: 1200px; min-height: 340px;">
<table id="headerProcesaSUA" style="display: none">
<tr>
<th colspan="5"></th>
<th colspan="10">Obrera</th>
<th colspan="10">Patronal</th>
</tr>
<tr>
<th></th>
<th colspan="2">Salario</th>
<th colspan="2">Días</th>
<th colspan="2">Cuota Excedente</th>
<th colspan="2">Prestaciones en Dinero</th>
<th colspan="2">Gastos Medicos</th>
<th colspan="2">Invalidez y Vida</th>
<th colspan="2">Cesantia y Vejez</th>
<th colspan="2">Cuota Fija</th>
<th colspan="2">Riesgos de Trabajo</th>
<th colspan="2">Guarderia</th>
<th colspan="2">Retiro</th>
<th colspan="2">Cesantia y Vejez</th>
</tr>
</table>
<asp:GridView ID="GVProcesarSUA" runat="server" GridLines="None" CssClass="table table-hover table-striped ScrollAD" AutoGenerateColumns="False"
OnRowDataBound="GVProcesarSUA_RowDataBound" data-height="300" data-tableheader="#headerProcesaSUA"
DataKeyNames="CvePersonal,CodigoNombreCompleto,CuotaFijaSUA,CuotaFijaSIG,CuotaExcedenteSUA,CuotaExcedenteSIG,PrestacionesDineroSUA,PrestacionesSIG,GastosMedPenSUA,GastosMedicosSIG,RiesgosdeTrabajoSUA,RiesgoTrabajoSIG,InvalidezyVidaSUA,InvalidezyVidaSIG,GuarderiaSUA,GuarderiaSIG,RetiroSUA,RetiroSIG,SalarioSUA,SalarioSIG,CesantiayVejezObreraSUA,CesantiayVejezObreraSIG,CesantiayVejezPatronalSUA,CesantiayVejezPatronalSIG">
<Columns>
<asp:TemplateField HeaderText="Nombre">
<ItemTemplate>
<asp:Label ID="lblcodigoNombreCompleto" runat="server" Text='<%# Eval("CodigoNombreCompleto")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SUA">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("SalarioSUA","{0:N2}")%>'> </asp:Label></td>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SIG">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("SalarioSIG","{0:N2}")%>'> </asp:Label></td>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SUA">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("DiasMes","{0:N0}")%>'> </asp:Label></td>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SIG">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("DiasAsistio","{0:N0}")%>'> </asp:Label></td>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SUA">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("CuotaExcedenteSUA","{0:N2}")%>'> </asp:Label></td>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SIG">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("CuotaExcedenteSIG","{0:N2}")%>'> </asp:Label></td>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SUA">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("PrestacionesDineroSUA","{0:N2}")%>'> </asp:Label></td>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SIG">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("PrestacionesSIG","{0:N2}")%>'> </asp:Label></td>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SUA">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("GastosMedPenSUA","{0:N2}")%>'> </asp:Label></td>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SIG">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("GastosMedicosSIG","{0:N2}")%>'> </asp:Label></td>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SUA">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("InvalidezyVidaSUA","{0:N2}")%>'> </asp:Label></td>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SIG">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("InvalidezyVidaSIG","{0:N2}")%>'> </asp:Label></td>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SUA">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("CesantiayVejezObreraSUA","{0:N2}")%>'> </asp:Label></td>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SIG">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("CesantiayVejezObreraSIG","{0:N2}")%>'> </asp:Label></td>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SUA">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("CuotaFijaSUA","{0:N2}")%>'> </asp:Label></td>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SIG">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("CuotaFijaSIG","{0:N2}")%>'> </asp:Label></td>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SUA">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("RiesgosdeTrabajoSUA","{0:N2}")%>'> </asp:Label></td>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SIG">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("RiesgoTrabajoSIG","{0:N2}")%>'> </asp:Label></td>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SUA">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("GuarderiaSUA","{0:N2}")%>'> </asp:Label></td>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SIG">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("GuarderiaSIG","{0:N2}")%>'> </asp:Label></td>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SUA">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("RetiroSUA","{0:N2}")%>'> </asp:Label></td>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SIG">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("RetiroSIG","{0:N2}")%>'> </asp:Label></td>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SUA">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("CesantiayVejezPatronalSUA","{0:N2}")%>'> </asp:Label></td>,
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SIG">
<ItemTemplate>
<asp:Label runat="server" Text='<%# Eval("CesantiayVejezPatronalSIG","{0:N2}")%>'> </asp:Label></td>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<%--<table id="headerProcesaSUA" style="display: none">
<tr>
<th></th>
<th colspan="2">Salario</th>
@@ -2305,8 +2621,7 @@
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</asp:GridView>--%>
</div>
</div>
</div>
@@ -2380,11 +2695,11 @@
</div>
<div class="form-group form-md-line-input">
<asp:Label CssClass="lblforchk" runat="server" Text="Altas:"></asp:Label>
<asp:Label CssClass="lblforchk" runat="server" Text="Altas:"></asp:Label>
<asp:CheckBox ID="ChkSuaAltas" Text=" " CssClass="chksino" runat="server" />
</div>
<div class="form-group form-md-line-input">
<asp:Label CssClass="lblforchk" runat="server" Text="Bajas:"></asp:Label>
<asp:Label CssClass="lblforchk" runat="server" Text="Bajas:"></asp:Label>
<asp:CheckBox ID="ChkSuaBajas" Text=" " CssClass="chksino" runat="server" />
</div>
<%--<div class="form-group form-md-line-input">
@@ -2411,7 +2726,16 @@
<asp:TextBox ID="TxtCvePeriodo" CssClass="TxtCvePeriodo hidden" runat="server"></asp:TextBox>
<asp:TextBox ID="TxtCvePersonal" CssClass="TxtCvePersonal hidden" runat="server"></asp:TextBox>
<asp:Button ID="BtnGeneratepdf" CssClass="BtnGeneratepdf hidden" OnClick="BtnGeneratepdf_Click" UseSubmitBehavior="false" runat="server" Text="Button" />
<asp:Button ID="BtnGenerateXml" CssClass="BtnGenerateXml hidden" OnClick="BtnGenerateXml_Click" UseSubmitBehavior="false" runat="server" Text="Button" />
<asp:UpdatePanel runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Button ID="BtnGenerateXml" CssClass="BtnGenerateXml hidden" OnClick="BtnGenerateXml_Click" UseSubmitBehavior="false" runat="server" Text="Button" />
<span class="ltlxml">
<asp:Literal ID="LtlXml" runat="server"></asp:Literal></span>
<span class="ltlxmlfin">
<asp:Literal ID="LtlXmlfin" runat="server"></asp:Literal></span>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
<script>
@@ -2463,6 +2787,27 @@
setTimeout(function () { loadadscroll(); }, 50);
}, 400);
}
function bin2String(array) {
var result = "";
for (var i = 0; i < array.length; i++) {
result += String.fromCharCode(parseInt(array[i], 2));
}
return result;
}
function Savexml(filename, data) {
var blob = new Blob([data], { type: 'text/xml' });
if (window.navigator.msSaveOrOpenBlob) {
window.navigator.msSaveBlob(blob, filename);
}
else {
var elem = window.document.createElement('a');
elem.href = window.URL.createObjectURL(blob);
elem.download = filename;
document.body.appendChild(elem);
elem.click();
document.body.removeChild(elem);
}
}
function SaveCsv(filename, data) {
var blob = new Blob([data], { type: 'text/csv' });
if (window.navigator.msSaveOrOpenBlob) {

View File

@@ -181,11 +181,14 @@ public partial class Nomina_Nomina2 : ClsPaginas
{
if (!IsPostBack)
{
LnkVerCalculoISR.Visible = (UsuarioActual.CveUsuario == 100);
TxtPeriodo.Text = $"{DateTime.Now:yyyyMM}";
CargarCentrosDeCosto(DdlProyecto, null, LblProyecto, LblSubProyeccto);
CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyeccto);
cargaEjercicios();
CargaTiposPeriodo();
cargaPeriodos();
DdlTurno.DataSource = GlobalDTTurno.FiltraParametros($"CveEmpresa = { UsuarioActual.CveEmpresa}");
DdlTurno.DataBind();
//Permisos
if (UsuarioActual.TienePermisoProceso(82))
{
@@ -348,6 +351,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
FiltCveSubProyecto = DdlSubProyecto.SelectedValue.ToEntero();
FiltCveTurno = DdlTurno.SelectedValue.ToEntero();
FiltCvePeriodo = DdlPeriodo.SelectedValue.ToEntero();
LtlPeriodoseleccionado.Text = DdlPeriodo.SelectedItem.Text;
FiltAgrupador = 1;
HypPDFSTimbrados.Attributes.Add("onclick", string.Format("GETPDF({0},{1})", -1, FiltCvePeriodo));
cargaDatos();
@@ -904,6 +908,8 @@ public partial class Nomina_Nomina2 : ClsPaginas
int CvePeriodo = e.Row.DataKey("CvePeriodo").ToEntero();
int CveNomina = e.Row.DataKey("CveNomina").ToEntero();
string SeTimbro = e.Row.DataKey("SeTimbro").ToString();
string SeTimbroFiniquito = e.Row.DataKey("SeTimbroFiniquito").ToString();
string EsRenuncia = e.Row.DataKey("EsRenuncia").ToString();
string NomAutorizado = e.Row.DataKey("NomAutorizado").ToString();
string Nombre = e.Row.DataKey("Nombre").ToString();
string Codigo = e.Row.DataKey("Codigo").ToString();
@@ -923,7 +929,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
}
else
{
if (SeTimbro == "False")
if (!SeTimbro.ToUpper().Contiene("TRUE", "1"))
{
LnkTimbrar.Visible = true;
e.Row.CssClass = "info";
@@ -937,6 +943,12 @@ public partial class Nomina_Nomina2 : ClsPaginas
e.Row.FindControl("HypPDF").Visible = true;
e.Row.FindControl("HypXml").Visible = true;
e.Row.CssClass = "success";
if (EsRenuncia.ToUpper().Contiene("TRUE", "1") && !SeTimbroFiniquito.ToUpper().Contiene("TRUE", "1"))
{
LnkTimbrar.Visible = true;
e.Row.CssClass = "danger";
e.Row.ToolTip = "sin timbrar conceptos de indemnización";
}
}
}
@@ -1487,6 +1499,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
protected void LnkSobreRecibo_Click(object sender, EventArgs e)
{
GridViewRow gvrow = (GridViewRow)(((LinkButton)sender).NamingContainer);
LnkSRVacacionesADD.Visible = false;
if (DdlCtaContable.Items.Count == 0)
{
@@ -2343,10 +2356,14 @@ public partial class Nomina_Nomina2 : ClsPaginas
}
LnkImporte.CommandArgument = (CveConcepto > 0 ? CveConcepto.ToString() : "P");
LnkImporteD.CommandArgument = (CveConceptoD > 0 ? CveConceptoD.ToString() : "D");
LnkImportexCalculo.CommandArgument = LnkImporte.CommandArgument;
LnkImporteDxCalculo.CommandArgument = LnkImporteD.CommandArgument;
LnkImportexCalculo.Visible = isEditedP;
LnkImporteDxCalculo.Visible = isEditedD;
if (LnkImportexCalculo != null)
{
LnkImportexCalculo.CommandArgument = LnkImporte.CommandArgument;
LnkImporteDxCalculo.CommandArgument = LnkImporteD.CommandArgument;
LnkImportexCalculo.Visible = isEditedP;
LnkImporteDxCalculo.Visible = isEditedD;
}
LnkImporte.Text = (CveConcepto > 0 ? string.Format("${0:N2}", e.Row.DataKey("ImporteP").ToDecimal()) : (CveConceptoPolgvc > 0 ? "<i class=\"fa fa-plus\"></i>" : ""));
LnkImporteD.Text = (CveConceptoD > 0 ? string.Format("${0:N2}", e.Row.DataKey("ImporteD").ToDecimal()) : (CveConceptoDolgvc > 0 ? "<i class=\"fa fa-plus\"></i>" : ""));
@@ -2651,6 +2668,12 @@ public partial class Nomina_Nomina2 : ClsPaginas
GVInfonavitSegViv.DataSource = objnom.DTSetResultados.Tables[3];
GVVigISRMensual.DataSource = objnom.DTSetResultados.Tables[4];
GVVigSubEmpMensual.DataSource = objnom.DTSetResultados.Tables[5];
GVVigISRSemanal.DataSource = objnom.DTSetResultados.Tables[7];
GVVigISRDecenal.DataSource = objnom.DTSetResultados.Tables[8];
GVVigISRQuincenal.DataSource = objnom.DTSetResultados.Tables[9];
}
if (objnom.RH_TablasValoresGet(UsuarioActual.CveEmpresa, 1))
{
@@ -2664,7 +2687,9 @@ public partial class Nomina_Nomina2 : ClsPaginas
GVInfonavitSegViv.DataBind();
GVVigISRMensual.DataBind();
GVVigSubEmpMensual.DataBind();
GVVigSubEmpMensual.DataBind();
GVVigISRSemanal.DataBind();
GVVigISRDecenal.DataBind();
GVVigISRQuincenal.DataBind();
GVUma.DataBind();
UpModalTablas.Update();
}
@@ -2710,6 +2735,91 @@ public partial class Nomina_Nomina2 : ClsPaginas
loadtablas();
RegistraScript("$('#ModalTablas').modal();");
}
protected void LnkVerCalculoISR_Click(object sender, EventArgs e)
{
DataTable dt = dtempleados.FiltraParametros("CvePersonal >0", "", new string[] { "CvePersonal", "Nombre", "Codigo", "SumaPercepcionesG" });
//dt.Columns.Add("SumaPercepcionesG");
dt.Columns.Add("LimiteInferior");
dt.Columns.Add("ExedenteLI");
dt.Columns.Add("PorcentajeSE");
dt.Columns.Add("ImpuestoMarginal");
dt.Columns.Add("cuotafija");
dt.Columns.Add("Impuestoantessubs");
dt.Columns.Add("subsidio");
dt.Columns.Add("Impuesto");
DataTable dtquin = null;
using (ClsNominas objnom = new ClsNominas())
{
if (objnom.GetTablasNomina(UsuarioActual.CveEmpresa) && objnom.DTSetResultados.Tables.Count > 1)
{
//GVFactorDesctInfonavit.DataSource = objnom.DTSetResultados.Tables[0];
//GVSalariosMinimos.DataSource = objnom.DTSetResultados.Tables[1];
//GVIMMSRiesgot.DataSource = objnom.DTSetResultados.Tables[2];
//GVInfonavitSegViv.DataSource = objnom.DTSetResultados.Tables[3];
//GVVigISRMensual.DataSource = objnom.DTSetResultados.Tables[4];
//GVVigSubEmpMensual.DataSource = objnom.DTSetResultados.Tables[5];
//GVVigISRSemanal.DataSource = objnom.DTSetResultados.Tables[7];
//GVVigISRDecenal.DataSource = objnom.DTSetResultados.Tables[8];
//GVVigISRQuincenal.DataSource = objnom.DTSetResultados.Tables[9];
dtquin = objnom.DTSetResultados.Tables[9];
}
//if (objnom.RH_TablasValoresGet(UsuarioActual.CveEmpresa, 1))
//{
// GVUma.DataSource = objnom.DtResultados;
//}
}
if (dtquin != null)
{
foreach (DataRow item in dt.Rows)
{
decimal SumaPercepcionesG = item["SumaPercepcionesG"].ToString().ToDecimal();
decimal Limiteinferior = 0;
decimal CuotaFija = 0;
decimal Porcentaje = 0;
foreach (DataRow drow in dtquin.Rows)
{
decimal limite = drow["Limite inferior"].ToString().ToDecimal();
if (limite > SumaPercepcionesG) {
break;
}
else
{
Limiteinferior = drow["Limite inferior"].ToString().ToDecimal();
CuotaFija = drow["Cuota fija"].ToString().ToDecimal();
Porcentaje = drow["Porcentaje"].ToString().ToDecimal();
}
}
decimal Impuestomarginal = (SumaPercepcionesG - Limiteinferior) * (Porcentaje / 100);
decimal Impuestoantessubs= Impuestomarginal+ CuotaFija;
item["LimiteInferior"] = Limiteinferior;
item["ExedenteLI"] = SumaPercepcionesG - Limiteinferior;
item["PorcentajeSE"] = Porcentaje;
item["ImpuestoMarginal"] = Impuestomarginal;
item["cuotafija"] = CuotaFija;
item["Impuestoantessubs"] = Impuestoantessubs;
item["subsidio"] =0;
item["Impuesto"] = Impuestoantessubs;
//[Limite inferior],FORMAT(CuotaFija,'###,####,###0.00') [Cuota fija],FORMAT(Porcentaje,'###,####,###0.00') Porcentaje
}
dt.AcceptChanges();
}
UpCalculoISR.Update();
GVCalculoISR.DataSource = dt;
GVCalculoISR.DataBind();
RegistraScript("$('#ModalCalculoISR').modal();");
}
private void ImprimirReporte()
{
@@ -4093,13 +4203,13 @@ public partial class Nomina_Nomina2 : ClsPaginas
protected void CargaConcepto()
{
DdlConcepto.Items.Clear();
if (DdlTipo.SelectedValue == "-1")
if (DdlTipo.SelectedValue.Contiene("P", "D", "O"))
{
DdlConcepto.DataSource = get_GlobalDTNomConceptos(UsuarioActual.CveEmpresa);
DdlConcepto.DataSource = get_GlobalDTNomConceptos(UsuarioActual.CveEmpresa).FiltraParametros(string.Format("Tipo ='{0}' AND FormulaTotal = 'FNC.[MovimientosPermanentes]'", DdlTipo.SelectedValue));
}
else
{
DdlConcepto.DataSource = get_GlobalDTNomConceptos(UsuarioActual.CveEmpresa).FiltraParametros(string.Format("Tipo ='{0}'", DdlTipo.SelectedValue));
DdlConcepto.DataSource = get_GlobalDTNomConceptos(UsuarioActual.CveEmpresa).FiltraParametros(" FormulaTotal = 'FNC.[MovimientosPermanentes]'");
}
DdlConcepto.DataBind();
DdlConcepto.Items.Insert(0, new ListItem("Seleccione", "-1"));
@@ -4220,6 +4330,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
DdlTipo.SelectedValueExist(tipo);
DdlTipo_SelectedIndexChanged(null, null);
}
CargaConcepto();
DdlConcepto.SelectedValueExist(cveConcepto);
TxtDescripcion.Text = descripcion.ToString();
DdlTipoDescto.SelectedValueExist(tipoDescuento.ToString());
@@ -4534,6 +4645,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
{
GvConceptossimulador.DataSource = new DataTable();
GvConceptossimulador.DataBind();
DdlTipoPeriodoSim.SelectedValue = "1";
RegistraScript("$('#DSimulador').modal()");
UpSimulador.Update();
}
@@ -4544,12 +4656,12 @@ public partial class Nomina_Nomina2 : ClsPaginas
int CveProyecto = -1;
int CveSubProyecto = 1;
int CveTurno = -1;
int CvePeriodo = 12551;
int CvePeriodo = (DdlTipoPeriodoSim.SelectedValue == "1") ? 12706 : 12551;
int CveEmpresa = UsuarioActual.CveEmpresa;
int Agrupador = -1;
decimal Neto = TxtNetoaPagar.Text.ToDecimal();
decimal NetoSimulado = 0;
decimal SDI = (Neto * 1.25M) / 15;
decimal SDI = (Neto * 1.25M) / (DdlTipoPeriodoSim.SelectedValue == "1" ? 7 : 15);
decimal SDIOLD = 0;
decimal sumador = 100;
decimal multiplicador = 1;
@@ -4567,7 +4679,8 @@ public partial class Nomina_Nomina2 : ClsPaginas
while (Neto != NetoSimulado && continuarV)
{
if (objnom.GetNominaEmpleadoSimulador(CveProyecto, CveSubProyecto, CveTurno, CvePeriodo, CveEmpresa, Agrupador, SDI) && objnom.DTSetResultados.Tables.Count > 1)
if (objnom.GetNominaEmpleado(CveProyecto, CveSubProyecto, CveTurno, CvePeriodo, CveEmpresa, Agrupador, -1, 1, SDI)
&& objnom.DTSetResultados.Tables.Count > 1)
{
dtempleados = objnom.DTSetResultados.Tables[3];
dtempleadosConceptos = objnom.DTSetResultados.Tables[4];
@@ -4620,12 +4733,13 @@ public partial class Nomina_Nomina2 : ClsPaginas
if (continuar)
{
{
DataTable dtper = dtConceptos.FiltraParametros("Tipo IN ('P') AND EsPadre = 1 ");
DataTable dtded = dtConceptos.FiltraParametros("Tipo IN ('D') AND EsPadre = 1 ");
DataTable dtObl = dtConceptos.FiltraParametros("Tipo IN ('O') AND EsPadre = 1 ");
dtper.Columns.Add("BorradoLogico", typeof(int));
dtded.Columns.Add("BorradoLogico", typeof(int));
dtObl.Columns.Add("BorradoLogico", typeof(int));
DataTable dtx = dtConceptos.Copy();
dtx.Columns.Add("BorradoLogico", typeof(int));
DataTable dtper = dtx.FiltraParametros("Tipo IN ('P') AND EsPadre = 1 ");
DataTable dtded = dtx.FiltraParametros("Tipo IN ('D') AND EsPadre = 1 ");
DataTable dtObl = dtx.FiltraParametros("Tipo IN ('O') AND EsPadre = 1 ");
////dtded.Columns.Add("BorradoLogico", typeof(int));
////dtObl.Columns.Add("BorradoLogico", typeof(int));
foreach (DataRow row in dtper.Rows)
{
@@ -4862,6 +4976,10 @@ public partial class Nomina_Nomina2 : ClsPaginas
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.RowIndex == 0)
{
e.Row.CssClass = "Totales";
}
string SalarioSUA = string.Format("{0:N2}", e.Row.DataKey("SalarioSUA").ToDecimal());
string SalarioSIG = string.Format("{0:N2}", e.Row.DataKey("SalarioSIG").ToDecimal());
int celda = 1;
@@ -4871,14 +4989,6 @@ public partial class Nomina_Nomina2 : ClsPaginas
e.Row.Cells[celda + 1].CssClass = "cellFail";
}
celda = celda + 4;
string CuotaFijaSUA = string.Format("{0:N2}", e.Row.DataKey("CuotaFijaSUA").ToDecimal());
string CuotaFijaSIG = string.Format("{0:N2}", e.Row.DataKey("CuotaFijaSIG").ToDecimal());
if (CuotaFijaSUA != CuotaFijaSIG)
{
e.Row.Cells[celda].CssClass = "cellFail";
e.Row.Cells[celda + 1].CssClass = "cellFail";
}
celda = celda + 2;
string CuotaExcedenteSUA = string.Format("{0:N2}", e.Row.DataKey("CuotaExcedenteSUA").ToDecimal());
string CuotaExcedenteSIG = string.Format("{0:N2}", e.Row.DataKey("CuotaExcedenteSIG").ToDecimal());
if (CuotaExcedenteSUA != CuotaExcedenteSIG)
@@ -4903,17 +5013,33 @@ public partial class Nomina_Nomina2 : ClsPaginas
e.Row.Cells[celda + 1].CssClass = "cellFail";
}
celda = celda + 2;
string RiesgosdeTrabajoSUA = string.Format("{0:N2}", e.Row.DataKey("RiesgosdeTrabajoSUA").ToDecimal());
string RiesgoTrabajoSIG = string.Format("{0:N2}", e.Row.DataKey("RiesgoTrabajoSIG").ToDecimal());
if (RiesgosdeTrabajoSUA != RiesgoTrabajoSIG)
string InvalidezyVidaSUA = string.Format("{0:N2}", e.Row.DataKey("InvalidezyVidaSUA").ToDecimal());
string InvalidezyVidaSIG = string.Format("{0:N2}", e.Row.DataKey("InvalidezyVidaSIG").ToDecimal());
if (InvalidezyVidaSUA != InvalidezyVidaSIG)
{
e.Row.Cells[celda].CssClass = "cellFail";
e.Row.Cells[celda + 1].CssClass = "cellFail";
}
celda = celda + 2;
string InvalidezyVidaSUA = string.Format("{0:N2}", e.Row.DataKey("InvalidezyVidaSUA").ToDecimal());
string InvalidezyVidaSIG = string.Format("{0:N2}", e.Row.DataKey("InvalidezyVidaSIG").ToDecimal());
if (InvalidezyVidaSUA != InvalidezyVidaSIG)
string CesantiayVejezObreraSUA = string.Format("{0:N2}", e.Row.DataKey("CesantiayVejezObreraSUA").ToDecimal());
string CesantiayVejezObreraSIG = string.Format("{0:N2}", e.Row.DataKey("CesantiayVejezObreraSIG").ToDecimal());
if (CesantiayVejezObreraSUA != CesantiayVejezObreraSIG)
{
e.Row.Cells[celda].CssClass = "cellFail";
e.Row.Cells[celda + 1].CssClass = "cellFail";
}
celda = celda + 2;
string CuotaFijaSUA = string.Format("{0:N2}", e.Row.DataKey("CuotaFijaSUA").ToDecimal());
string CuotaFijaSIG = string.Format("{0:N2}", e.Row.DataKey("CuotaFijaSIG").ToDecimal());
if (CuotaFijaSUA != CuotaFijaSIG)
{
e.Row.Cells[celda].CssClass = "cellFail";
e.Row.Cells[celda + 1].CssClass = "cellFail";
}
celda = celda + 2;
string RiesgosdeTrabajoSUA = string.Format("{0:N2}", e.Row.DataKey("RiesgosdeTrabajoSUA").ToDecimal());
string RiesgoTrabajoSIG = string.Format("{0:N2}", e.Row.DataKey("RiesgoTrabajoSIG").ToDecimal());
if (RiesgosdeTrabajoSUA != RiesgoTrabajoSIG)
{
e.Row.Cells[celda].CssClass = "cellFail";
e.Row.Cells[celda + 1].CssClass = "cellFail";
@@ -4934,6 +5060,14 @@ public partial class Nomina_Nomina2 : ClsPaginas
e.Row.Cells[celda].CssClass = "cellFail";
e.Row.Cells[celda + 1].CssClass = "cellFail";
}
celda = celda + 2;
string CesantiayVejezPatronalSUA = string.Format("{0:N2}", e.Row.DataKey("CesantiayVejezPatronalSUA").ToDecimal());
string CesantiayVejezPatronalSIG = string.Format("{0:N2}", e.Row.DataKey("CesantiayVejezPatronalSIG").ToDecimal());
if (CesantiayVejezPatronalSUA != CesantiayVejezPatronalSIG)
{
e.Row.Cells[celda].CssClass = "cellFail";
e.Row.Cells[celda + 1].CssClass = "cellFail";
}
}
}
@@ -5113,7 +5247,6 @@ public partial class Nomina_Nomina2 : ClsPaginas
int cveControlIncapacidad = gvRow.DataKey("CveControlIncapacidad").ToEntero();
string descripcion = gvRow.DataKey("Descripcion");
#endregion
TxtSRINCfolio.Text = folio.ToString();
TxtSRINCfechaInicio.Text = $"{fechaInicio:dd/MM/yyyy}";
TxtSRINCdiasAutorizados.Text = diasAutorizados.ToString();
@@ -5459,6 +5592,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
{
byte[] pdf = new byte[1];
string nombre = "recibo";
bool confiniquito = false;
int CvePersonal = TxtCvePersonal.Text.ToEntero(); int CvePeriodo = TxtCvePeriodo.Text.ToEntero();
if (CvePersonal > 0)
{
@@ -5469,8 +5603,20 @@ public partial class Nomina_Nomina2 : ClsPaginas
nombre = ObjNomina.SerieFolio;
}
if (ObjNomina.GetNom_NominasDetalles(-1, CvePersonal, CvePeriodo, "-1"))
{
confiniquito = ObjNomina.DtResultados.COUNT("CveConcepto", " CveSistema IN(10,11,32,47) AND Importe <>0") > 0;
}
}
pdf = GeneraPDFNomina(CvePersonal, CvePeriodo, UsuarioActual.CveEmpresa, UsuarioActual.Empresa.Ruta);
if (confiniquito)
{
List<byte[]> pdfs = new List<byte[]>();
pdfs.Add(pdf);
pdfs.Add(GeneraPDFNomina(CvePersonal, CvePeriodo, UsuarioActual.CveEmpresa, UsuarioActual.Empresa.Ruta, true));
pdf = MergeFiles(pdfs);
}
}
else
{
@@ -5581,41 +5727,66 @@ public partial class Nomina_Nomina2 : ClsPaginas
{
string Ruta = "";
string PathXML = "";
string PathXMLF = "";
string Xmlname = "";
string XmlnameF = "";
string empleado = "";
DataRow dr = dtempleados.FiltroPrimero(string.Format("CvePersonal ={0}", TxtCvePersonal.Text.ToEntero()));
if (dr != null)
{
empleado = string.Format("{0} - {1}", dr["Codigo"], dr["Nombre"]);
}
using (ClsNominas ObjNomina = new ClsNominas())
{
if (ObjNomina.GetNom_Nominas(-1, TxtCvePersonal.Text.ToEntero(), TxtCvePeriodo.Text.ToEntero(), -1, UsuarioActual.CveEmpresa))
{
Ruta = $@"{ModExtensiones.DirectorioBaseEmpresas}Empresas\{UsuarioActual.CveEmpresa}\";
PathXML = $@"{Ruta}XML\Nomina\{ObjNomina.SerieFolio}.xml";
Ruta = $"{ModExtensiones.DirectorioBaseEmpresas}Empresas\\{UsuarioActual.CveEmpresa}\\";
PathXML = $"{Ruta}XML\\Nomina\\{ObjNomina.SerieFolio}.xml";
PathXMLF = $"{Ruta}XML\\Nomina\\{ObjNomina.Serie}F-{ObjNomina.Folio}.xml";
Xmlname = ObjNomina.SerieFolio;
XmlnameF = $"{ObjNomina.Serie}F-{ObjNomina.Folio}";
}
}
try
{
string script = "";
if (!string.IsNullOrEmpty(PathXML) && System.IO.File.Exists(PathXML))
{
System.IO.FileInfo file = new System.IO.FileInfo(PathXML);
string mimeType = "text/plain";
try
{
mimeType = MimeMapping.GetMimeMapping(PathXML);
}
catch (Exception)
{
}
// Response.Write(path)
Response.Clear();
Response.ClearHeaders();
Response.ClearContent();
Response.AddHeader("Content-Disposition", $"attachment; filename= {Uri.EscapeDataString(file.Name)}");
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = mimeType;
Response.Flush();
Response.TransmitFile(file.FullName);
Response.End();
LtlXml.Text = System.IO.File.ReadAllText(PathXML);
script = string.Format("Savexml(\"{0} {1}.xml\", $('.ltlxml').html());", Xmlname, empleado);
//System.IO.FileInfo file = new System.IO.FileInfo(PathXML);
//string mimeType = "text/plain";
//try
//{
// mimeType = MimeMapping.GetMimeMapping(PathXML);
//}
//catch (Exception)
//{
//}
//// Response.Write(path)
//Response.Clear();
//Response.ClearHeaders();
//Response.ClearContent();
//Response.AddHeader("Content-Disposition", $"attachment; filename= {Uri.EscapeDataString(file.Name)}");
//Response.AddHeader("Content-Length", file.Length.ToString());
//Response.ContentType = mimeType;
//Response.Flush();
//Response.TransmitFile(file.FullName);
//Response.End();
}
if (!string.IsNullOrEmpty(PathXML) && System.IO.File.Exists(PathXMLF))
{
LtlXmlfin.Text = System.IO.File.ReadAllText(PathXMLF);
script = string.Format("{1}Savexml(\"{0}(Indemnización) {2}.xml\", $('.ltlxmlfin').html());", Xmlname, script, empleado);
}
if (script.Trim().Length > 0)
{
RegistraScript(script);
}
else
{
Alert("No se encontro el archivo");
}
}
catch (Exception)
@@ -5825,12 +5996,54 @@ public partial class Nomina_Nomina2 : ClsPaginas
{
if (nom.ReportedeAcumuladosGET(UsuarioActual.CveEmpresa, TxtPeriodo.Text.ToEntero(), 4))
{
DateTime datei = new DateTime();
DateTime datef = datei;
try
{
datei = $"{TxtPeriodo.Text}01".ToDateTime();
datef = datei.AddMonths(1).AddDays(-1);
}
catch (Exception) { }
DataTable dt = nom.DTSetResultados.Tables[0];
var libro = wb.AddWorksheet(dt, "Acumulados");
libro.Tables.FirstOrDefault().Theme = ClosedXML.Excel.XLTableTheme.None;
int crow = 1;
foreach (DataRow item in dt.Rows)
{
crow++;
//220,230,241
//79,129,189
switch (item["Grupoid"].ToString())
{
case "1":
libro.Range(crow, 1, crow, 11).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
libro.Range(crow, 1, crow, 11).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
break;
case "2":
libro.Range(crow, 1, crow, 11).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(220, 230, 241));
//libro.Range(crow, 1, crow, 10).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
break;
case "3":
break;
case "4":
libro.Range(crow, 1, crow, 11).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
libro.Range(crow, 1, crow, 11).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
break;
case "5":
var libro = wb.AddWorksheet(nom.DTSetResultados.Tables[0], "Acumulados");
libro.Range(crow, 1, crow, 11).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
libro.Range(crow, 1, crow, 11).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
break;
}
}
libro.Range(2, 3, crow, 11).Style.NumberFormat.Format = "$##,###,###,0.00";
libro.Range(2, 3, crow, 11).DataType = ClosedXML.Excel.XLDataType.Number;
libro.Column(1).Delete();
libro.ColumnsUsed().AdjustToContents();
libro.Row(1).InsertRowsAbove(4);
libro.Range(1, 2, 1, 6).Merge().Value = UsuarioActual.Empresa.Empresa;
libro.Range(2, 2, 2, 6).Merge().Value = "Reporte de Acumulados";
libro.Range(2, 2, 2, 6).Merge().Value = $"Reporte de Acumulados del {datei:dd/MM/yyyy} al {datef:dd/MM/yyyy}";
//libro.Range(3, 2, 3, 6).Merge().Value = $"del {fechai:dd/MM/yyyy} al {fechaf:dd/MM/yyyy}";
libro.Range(2, 7, 2, 9).Merge().Value = $"Fecha:{DateTime.Now:dd/MM/yyyy}";
libro.Range(3, 7, 3, 9).Merge().Value = $"Hora:{DateTime.Now:HH:mm}";
@@ -5869,25 +6082,77 @@ public partial class Nomina_Nomina2 : ClsPaginas
protected void LinkButton1_Click(object sender, EventArgs e)
{
}
protected void LnkrRepPercpDed_Click(object sender, EventArgs e)
{
DateTime fechai = TxtRIFechaInicio.Text.ToDateTime();
DateTime fechaf = TxtRIFechaFin.Text.ToDateTime();
DateTime fechai = TxtRpdFechaInicio.Text.ToDateTime();
DateTime fechaf = TxtRpdFechaFin.Text.ToDateTime();
ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook();
using (ClsNominas nom = new ClsNominas())
{
if (nom.ReportedePercepcionesDeduccionesGet(UsuarioActual.CveEmpresa, fechai, fechaf, 4))
{
DataTable dt = nom.DTSetResultados.Tables[0];
var libro = wb.AddWorksheet(nom.DTSetResultados.Tables[0], "Percepciones y deducciones");
libro.ColumnsUsed().AdjustToContents();
libro.Tables.FirstOrDefault().Theme = ClosedXML.Excel.XLTableTheme.None;
int crow = 1;
foreach (DataRow item in dt.Rows)
{
crow++;
//220,230,241
//79,129,189
switch (item["Grupoid"].ToString())
{
case "10":
libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(184, 204, 228));
break;
case "8":
case "11":
libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
libro.Range(crow, 1, crow, 11).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
break;
case "6":
libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(216, 228, 188));
break;
case "5":
case "7":
libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(155, 187, 89));
libro.Range(crow, 1, crow, 9).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
break;
case "2":
//libro.Range(crow, 1, crow, 11).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(216, 228, 188));
break;
case "1":
case "3":
libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(75, 172, 198));
libro.Range(crow, 1, crow, 9).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
break;
}
}
libro.Range(2, 4, crow, 9).Style.NumberFormat.Format = "$##,###,###,0.00";
libro.Range(2, 4, crow, 9).DataType = ClosedXML.Excel.XLDataType.Number;
libro.Column(1).Delete();
libro.ColumnsUsed().AdjustToContents();
libro.Row(1).InsertRowsAbove(4);
libro.Range(1, 2, 1, 6).Merge().Value = UsuarioActual.Empresa.Empresa;
libro.Range(2, 2, 2, 6).Merge().Value = $"Reporte de percepciones y deducciones del {fechai:dd/MM/yyyy} al {fechaf:dd/MM/yyyy}";
libro.Range(1, 2, 2, 6).Style.Font.SetBold(true);
libro.Range(1, 2, 2, 6).Style.Font.SetFontSize(16);
libro.Range(2, 2, 2, 6).Style.Font.SetFontSize(14);
libro.Range(1, 2, 2, 6).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Center;
//libro.Range(3, 2, 3, 6).Merge().Value = $"del {fechai:dd/MM/yyyy} al {fechaf:dd/MM/yyyy}";
libro.Range(2, 7, 2, 9).Merge().Value = $"Fecha:{DateTime.Now:dd/MM/yyyy}";
libro.Range(3, 7, 3, 9).Merge().Value = $"Hora:{DateTime.Now:HH:mm}";
//ws.Row(1).InsertRowsAbove(1);
}
}
@@ -5912,4 +6177,9 @@ public partial class Nomina_Nomina2 : ClsPaginas
Response.BinaryWrite(memoryStream.ToArray());
Response.End();
}
protected void LnkShowAddVacaciones_Click(object sender, EventArgs e)
{
LnkSRVacacionesADD.Visible = true;
}
}

View File

@@ -4,11 +4,11 @@
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
<style>
.GVCalculosSBC tr th:nth-child(n+9):not(:nth-child(n+13)) {
.GVCalculosSBC tr th:nth-child(n+6):not(:nth-child(n+10)) {
background-color: #a9a9e8 !important;
}
.GVCalculosSBC tr th:nth-child(n+13):not(:nth-child(n+16)) {
.GVCalculosSBC tr th:nth-child(n+10):not(:nth-child(n+13)) {
background-color: #88d6cd !important;
}
</style>
@@ -88,7 +88,7 @@
<ContentTemplate>
<table id="tableheader" style="display: none">
<tr>
<th colspan="8"></th>
<th colspan="5"></th>
<th colspan="4" style="background-color: #a9a9e8 !important;">Actual</th>
<th colspan="3" style="background-color: #88d6cd !important;">Nuevo</th>
<th></th>
@@ -117,24 +117,9 @@
<asp:Label ID="lblfechaInicio" runat="server" Text='<%# Eval("FechaInicio","{0:dd/MM/yyyy}")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Antiguedad">
<asp:TemplateField HeaderText="NSS">
<ItemTemplate>
<asp:Label ID="lblnumeroSS" runat="server" Text='<%# Eval("Antiguedad")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Días aguinaldo">
<ItemTemplate>
<asp:Label ID="lblDiasAguinaldo" runat="server" Text='<%# Eval("NumDiasAguinaldo")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Días vacaciones">
<ItemTemplate>
<asp:Label ID="lblDiasVacaciones" runat="server" Text='<%# Eval("diasVacaciones")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Prima vacacional">
<ItemTemplate>
<asp:Label ID="LblPrimaVacacional" runat="server" Text='<%# Eval("PorPrimaVacacional","{0:P2}")%>'> </asp:Label>
<asp:Label ID="lblnumeroSS" runat="server" Text='<%# Eval("NumeroSS")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Tipo salario">

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
@@ -27,12 +28,12 @@ public partial class RH_CalculoSBC : ClsPaginas
{
using (ClsNominas objnom = new ClsNominas())
{
if (objnom.GetCalculoSBC(UsuarioActual.CveEmpresa,DdlTipo.SelectedValue.ToEntero(), TxtFechaPago.Text))
if (objnom.GetCalculoSBC(UsuarioActual.CveEmpresa, DdlTipo.SelectedValue.ToEntero(), TxtFechaPago.Text))
{
GVCalculosSBC.DataSource = objnom.DTSetResultados.Tables[0];
GVCFija.DataSource = objnom.DTSetResultados.Tables[0];
GVPV.DataSource = objnom.DTSetResultados.Tables[0];
if(objnom.DTSetResultados.Tables.Count > 0)
if (objnom.DTSetResultados.Tables.Count >1)
{
GVDetalleParteVariable.DataSource = objnom.DTSetResultados.Tables[1];
GVDetalleParteVariable.DataBind();
@@ -75,8 +76,8 @@ public partial class RH_CalculoSBC : ClsPaginas
//}
foreach (GridViewRow item in GVCalculosSBC.Rows)
{
double SalarioDiarioSSNuevo =Math.Round( item.DataKey("SalarioDiarioSSNuevo").ToDouble(),2);
double SalarioDiarioSS = Math.Round(item.DataKey("SalarioDiarioSS").ToDouble(),2);
double SalarioDiarioSSNuevo = Math.Round(item.DataKey("SalarioDiarioSSNuevo").ToDouble(), 2);
double SalarioDiarioSS = Math.Round(item.DataKey("SalarioDiarioSS").ToDouble(), 2);
if (SalarioDiarioSSNuevo != SalarioDiarioSS)
{
MovtosmodSalario = string.Format("{0}{1}{2}", MovtosmodSalario, concater, item.DataKey("Movtotxt"));
@@ -113,9 +114,9 @@ public partial class RH_CalculoSBC : ClsPaginas
int CvePersonal = item.DataKey("CvePersonal").ToEntero();//,,,
double SalarioDiario = item.DataKey("SalarioDiario").ToDouble();
double SDINuevo = item.DataKey("SDINuevo").ToDouble();
double SalarioDiarioSSNuevo = Math.Round(item.DataKey("SalarioDiarioSSNuevo").ToDouble(),2);
double SalarioDiarioSSNuevo = Math.Round(item.DataKey("SalarioDiarioSSNuevo").ToDouble(), 2);
double SalarioVariableNuevo = item.DataKey("SalarioVariableNuevo").ToDouble();
double SalarioDiarioSS = Math.Round(item.DataKey("SalarioDiarioSS").ToDouble(),2);
double SalarioDiarioSS = Math.Round(item.DataKey("SalarioDiarioSS").ToDouble(), 2);
if (continuar && SalarioDiarioSSNuevo != SalarioDiarioSS && (continuar = objrh.UpdateSalarios(CvePersonal, fecha, UsuarioActual.CveEmpresa, SalarioDiario, SDINuevo, SalarioDiarioSSNuevo, SalarioDiario)))
{
@@ -141,22 +142,118 @@ public partial class RH_CalculoSBC : ClsPaginas
protected void LnkDescargar_Click(object sender, EventArgs e)
{
if (Tab.ActiveTab == TabSBC)
DataTable dt = GVToDT(GVCalculosSBC,"Salario");
DataTable dtPF = GVToDT(GVCFija, "Parte fija");
DataTable dtPV = GVToDT(GVPV, "Parte variable");
DataTable dtPVD = GVToDT(GVDetalleParteVariable, "Detalle parte variable");
ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook();
var libro = wb.AddWorksheet(dt);
var libroPF = wb.AddWorksheet(dtPF);
var libroPV = wb.AddWorksheet(dtPV);
var libroPVD = wb.AddWorksheet(dtPVD);
libro.ColumnsUsed().AdjustToContents();
libroPF.ColumnsUsed().AdjustToContents();
libroPV.ColumnsUsed().AdjustToContents();
libroPVD.ColumnsUsed().AdjustToContents();
libro.ColumnsUsed().AdjustToContents();
libro.Row(1).InsertRowsAbove(5);
libro.Range(1, 2, 1, 6).Merge().Value = UsuarioActual.Empresa.Empresa;
libro.Range(2, 2, 2, 6).Merge().Value = $"Reporte de calculo de sbc {TxtFechaPago.Text}.";
libro.Range(1, 2, 2, 6).Style.Font.SetBold(true);
libro.Range(1, 2, 2, 6).Style.Font.SetFontSize(16);
libro.Range(2, 2, 2, 6).Style.Font.SetFontSize(14);
libro.Range(1, 2, 2, 6).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Center;
//libro.Range(3, 2, 3, 6).Merge().Value = $"del {fechai:dd/MM/yyyy} al {fechaf:dd/MM/yyyy}";
libro.Range(2, 7, 2, 9).Merge().Value = $"Fecha:{DateTime.Now:dd/MM/yyyy}";
libro.Range(3, 7, 3, 9).Merge().Value = $"Hora:{DateTime.Now:HH:mm}";
libro.Range(5, 6, 5, 9).Merge().Value = "Actual";
libro.Range(5, 10, 5, 12).Merge().Value = "Nuevo";
libro.Range(5, 1, 6, 14).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Center;
libro.Range(5, 1, 6, 13).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
libro.Range(5, 1, 5, 13).Style.Border.BottomBorder = ClosedXML.Excel.XLBorderStyleValues.None;
libro.Range(5, 6, 6, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(128, 100, 162));
libro.Range(5, 6, 6, 9).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
libro.Range(5, 10, 6, 12).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(136, 214, 205));
libro.Range(5, 10, 6, 12).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
libro.Range(7, 6, 7 + dt.Rows.Count, 12).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Right;
libro.Range(7, 6, 7+ dt.Rows.Count, 12).Style.NumberFormat.Format = "$##,###,###,0.00";
System.IO.Stream fs = new System.IO.MemoryStream();
wb.SaveAs(fs);
fs.Position = 0;
System.IO.MemoryStream memoryStream = new System.IO.MemoryStream();
using (System.IO.Stream input = fs)
{
GVCalculosSBC.ExportToExcel("Salario");
}
if (Tab.ActiveTab == TabParteFija)
{
GVCFija.ExportToExcel("Salario");
}
if (Tab.ActiveTab == TabParteVariable)
{
GVPV.ExportToExcel("Salario");
}
if (Tab.ActiveTab == TabDetalleParteVariable)
{
GVDetalleParteVariable.ExportToExcel("Salario");
input.CopyTo(memoryStream);
}
memoryStream.Position = 0;
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
Response.AddHeader("content-disposition", string.Format("attachment;filename={0}.xlsx", "Salario"));
Response.BinaryWrite(memoryStream.ToArray());
Response.End();
}
public string limpiarcelda( string celdatext)
{
celdatext = celdatext.Replace("<br />", "\r\n").Replace(" ", " ");
while (celdatext.Contains(" ")){
celdatext = celdatext.Replace(" ", " ");
}
celdatext = celdatext.Replace("\n ", " ");
celdatext = celdatext.Replace("\r ", " ");
return celdatext;
}
public DataTable GVToDT(GridView GridView, string NombreArchivoXLSX)
{
DataTable dt = new DataTable(NombreArchivoXLSX);
if (GridView != null && GridView.Rows.Count > 0)
{
int i = 0;
List<int> ArrColumnasVisibles = new List<int>(); // solo recorro las columnas visibles
foreach (TableCell cell in GridView.HeaderRow.Cells)
{
string titulo = HttpUtility.HtmlDecode(Extensiones.ModExtensiones.TextoCelda(cell)).Trim();
titulo = limpiarcelda( titulo);
if (GridView.Columns[i].Visible && titulo.Length > 0)
{
if (dt.Columns.Contains(titulo))
titulo = titulo + i;
dt.Columns.Add(titulo);
ArrColumnasVisibles.Add(i);
}
i += 1;
}
i = 0;
foreach (GridViewRow row in GridView.Rows)
{
dt.Rows.Add();
i = 0;
foreach (int j in ArrColumnasVisibles)
{
dt.Rows[dt.Rows.Count - 1][i] = limpiarcelda(Extensiones.ModExtensiones.TextoCelda(row.Cells[j]).Replace("<br />", "\r\n"));
i = i + 1;
}
}
}
return dt;
}
}

View File

@@ -62,6 +62,9 @@
<li>
<asp:LinkButton ID="LnkExportar" runat="server"><i class="fa fa-file-excel-o" style="margin-right:5px;font-weight:bold"></i>Descargar Excel</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="LnkCargaMasiva" OnClick="LnkCargaMasiva_Click" runat="server"><i class="fa fa-file-excel-o" style="margin-right:5px;font-weight:bold"></i>Formato saldos iniciales</asp:LinkButton>
</li>
<li>
<asp:HyperLink NavigateUrl="#" data-toggle="modal" data-target="#DivPersonalizar" ID="HyperLink1" runat="server" Style="color: #686868;"><i class="fa fa-pencil" style="color:#686868;margin-left:3px;margin-right:2px"></i>Personalizar</asp:HyperLink>
</li>
@@ -77,6 +80,7 @@
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LnkDescarPersonalizados" />
<asp:PostBackTrigger ControlID="LnkCargaMasiva" />
</Triggers>
</asp:UpdatePanel>
<li>

View File

@@ -680,4 +680,366 @@ Partial Class RH_CatPersonal
End If
End Sub
Protected Sub LnkCargaMasiva_Click(sender As Object, e As EventArgs)
Dim wb As ClosedXML.Excel.XLWorkbook = New ClosedXML.Excel.XLWorkbook()
Dim libro = wb.AddWorksheet("Personal")
Dim crow As Integer = 1
Dim ccol As Integer = 1
Dim colLugarNacimiento As Integer = 1
Dim rowLugarNacimiento As Integer = 1
#Region "Regimen de contratación"
Dim Catalogos = wb.AddWorksheet("Catalogos")
crow = 1
ccol = 1
Dim colRegimenContratacion As Integer = 1
Dim rowRegimenContratacion As Integer = 1
Catalogos.Cell(crow, ccol).Value = "Regimen de contratación"
For Each row As DataRow In GlobalDTNomSatRegimenContratacion.Rows
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveSATRegimenContratacion"), row("RegimenContratacion"))
Next
colRegimenContratacion = ccol
rowRegimenContratacion = crow
#End Region
#Region "Estado civil"
Dim colEstadoCivil As Integer = 1
Dim rowEstadoCivil As Integer = 1
crow = 1
ccol = ccol + 1
Catalogos.Cell(crow, ccol).Value = "Estado civil"
For Each row As DataRow In GlobalDTEstadoCivil.Rows
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveEstadoCivil"), row("EstadoCivil"))
Next
colEstadoCivil = ccol
rowEstadoCivil = crow
#End Region
#Region "Escolaridad"
Dim colEscolaridad As Integer = 1
Dim rowEscolaridad As Integer = 1
crow = 1
ccol = ccol + 1
Catalogos.Cell(crow, ccol).Value = "Escolaridad"
For Each row As DataRow In GlobalDTEscolaridad.Rows
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveEscolaridad"), row("Escolaridad"))
Next
colEscolaridad = ccol
rowEscolaridad = crow
#End Region
#Region "Tipo Periodo"
Dim colTipoPeriodo As Integer = 1
Dim rowTipoPeriodo As Integer = 1
crow = 1
ccol = ccol + 1
Catalogos.Cell(crow, ccol).Value = "Tipo Periodo"
For Each row As DataRow In GlobalDTTipoPeriodo.Rows
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveTipoPeriodo"), row("TipoPeriodo"))
Next
colTipoPeriodo = ccol
rowTipoPeriodo = crow
#End Region
#Region "Estatus"
Dim colEstatusPersonal As Integer = 1
Dim rowEstatusPersonal As Integer = 1
crow = 1
ccol = ccol + 1
Catalogos.Cell(crow, ccol).Value = "Estatus"
For Each row As DataRow In GlobalDTEstatusPersonal.Rows
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveEstatusPersonal"), row("EstatusPersonal"))
Next
colEstatusPersonal = ccol
rowEstatusPersonal = crow
#End Region
#Region "Tipo Contratro"
Dim colTipoContrato As Integer = 1
Dim rowTipoContrato As Integer = 1
crow = 1
ccol = ccol + 1
Catalogos.Cell(crow, ccol).Value = "Tipo Contratro"
For Each row As DataRow In GlobalDTTiposContrato.Rows
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = String.Format("{0}", row("TipoContrato"))
Next
colTipoContrato = ccol
rowTipoContrato = crow
#End Region
#Region "Departamento"
Dim colDepartamento As Integer = 1
Dim rowDepartamento As Integer = 1
crow = 1
ccol = ccol + 1
Catalogos.Cell(crow, ccol).Value = "Departamento"
For Each row As DataRow In GlobalDTDepartamentos.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa).Rows
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveDepartamento"), row("Departamento"))
Next
colDepartamento = ccol
rowDepartamento = crow
#End Region
#Region "Turno"
Dim colTurno As Integer = 1
Dim rowTurno As Integer = 1
crow = 1
ccol = ccol + 1
Catalogos.Cell(crow, ccol).Value = "Turno"
For Each row As DataRow In GlobalDTTurno.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa).Rows
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveTurno"), row("Turno"))
Next
colTurno = ccol
rowTurno = crow
#End Region
#Region "Puesto"
Dim colPuesto As Integer = 1
Dim rowPuesto As Integer = 1
crow = 1
ccol = ccol + 1
Catalogos.Cell(crow, ccol).Value = "Puesto"
For Each row As DataRow In GlobalDTRHPuestos(UsuarioActual.CveEmpresa).Rows
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CvePuesto"), row("Puesto"))
Next
colPuesto = ccol
rowPuesto = crow
#End Region
#Region "Estado"
Dim colEstado As Integer = 1
Dim rowEstado As Integer = 1
crow = 1
ccol = ccol + 1
Catalogos.Cell(crow, ccol).Value = "Estado"
For Each row As DataRow In GlobalDTGralEstados(1).Rows
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveEstado"), row("Estado"))
Next
colEstado = ccol
rowEstado = crow
#End Region
#Region "Tipo salario"
Dim colTipoSalario As Integer = 1
Dim rowTipoSalario As Integer = 1
crow = 1
ccol = ccol + 1
Catalogos.Cell(crow, ccol).Value = "Tipo salario"
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = "1: Salario fijo"
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = "2: Salario variable"
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = "3: Salario mixto"
colTipoSalario = ccol
rowTipoSalario = crow
#End Region
#Region "Genero"
Dim colSexo As Integer = 1
Dim rowSexo As Integer = 1
crow = 1
ccol = ccol + 1
Catalogos.Cell(crow, ccol).Value = "Genero"
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = "1: Masculino"
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = "2: Femenino"
colSexo = ccol
rowSexo = crow
#End Region
#Region "Sindicalizado"
Dim colsindicalizado As Integer = 1
Dim rowsindicalizado As Integer = 1
crow = 1
ccol = ccol + 1
Catalogos.Cell(crow, ccol).Value = "Sindicalizado"
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = "1: Sí"
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = "0: No"
colsindicalizado = ccol
rowsindicalizado = crow
#End Region
#Region "Area geografica"
Dim colAreaGeografica As Integer = 1
Dim rowAreaGeografica As Integer = 1
crow = 1
ccol = ccol + 1
Catalogos.Cell(crow, ccol).Value = "Area geografica"
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = "A"
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = "B"
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = "C"
colAreaGeografica = ccol
rowAreaGeografica = crow
#End Region
#Region "Metodo pago"
Dim colmetodopago = 0
Dim rowmetodopago = 0
crow = 1
ccol = ccol + 1
Catalogos.Cell(crow, ccol).Value = "Metodo pago"
For Each row As DataRow In GlobalDTMetodosPago.Rows
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveMetodoPago"), row("MetodoPago"))
Next
colmetodopago = ccol
rowmetodopago = crow
#End Region
#Region "subproyecto"
Dim colsubproyecto = 0
Dim rowsubproyecto = 0
crow = 1
ccol = ccol + 1
Catalogos.Cell(crow, ccol).Value = "subproyecto"
Dim dtsubproyecto = If(Not UsuarioActual.TienePermisoProceso(110), GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1), GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa, 1))
For Each row As DataRow In dtsubproyecto.Rows
crow = crow + 1
Catalogos.Cell(crow, ccol).Value = String.Format("{0}: {1}", row("CveSubProyecto"), row("SubProyecto"))
Next
colsubproyecto = ccol
rowsubproyecto = crow
#End Region
Catalogos.Range(1, 1, 1, ccol).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189))
Catalogos.Range(1, 1, 1, ccol).Style.Font.FontColor = ClosedXML.Excel.XLColor.White
crow = 1
ccol = 1
libro.Cell(crow, ccol).Value = "Código" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Apellido Paterno" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Apellido Materno" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Nombre" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Correo Electronico" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Fecha Nacimiento" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Sexo" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colSexo, rowSexo, colSexo), True) : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Lugar Nacimiento" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Dirección" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Ciudad" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Estado Civil" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colEstadoCivil, rowEstadoCivil, colEstadoCivil), True) : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Teléfono" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Celular" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "RFC" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "CURP" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Numero SS" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "CLABE" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Fecha Ingreso" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Fecha Baja" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Alta IMSS" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Código Postal" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Estatus Personal" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colEstatusPersonal, rowEstatusPersonal, colEstatusPersonal), True) : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Estado" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colEstado, rowEstado, colEstado), True) : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Nombre Padre" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Nombre Madre" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Puesto" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colPuesto, rowPuesto, colPuesto), True) : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Turno" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colTurno, rowTurno, colTurno), True) : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Tipo Contrato" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colTipoContrato, rowTipoContrato, colTipoContrato), True) : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Departamento" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colDepartamento, rowDepartamento, colDepartamento), True) : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Tipo Periodo" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colTipoPeriodo, rowTipoPeriodo, colTipoPeriodo), True) : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Escolaridad" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colEscolaridad, rowEscolaridad, colEscolaridad), True) : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Salario Diario" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Tipo Salario" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colTipoSalario, rowTipoSalario, colTipoSalario), True) : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Salario variable" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Sindicalizado" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colsindicalizado, rowsindicalizado, colsindicalizado), True) : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "SubProyecto " : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colsubproyecto, rowsubproyecto, colsubproyecto), True) : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "RegimenContratacion" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colRegimenContratacion, rowRegimenContratacion, colRegimenContratacion), True) : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Area Geografica" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colAreaGeografica, rowAreaGeografica, colAreaGeografica), True) : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Prima vacacional" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Dias aguinaldo" : ccol = ccol + 1
libro.Cell(crow, ccol).Value = "Metodo Pago" : libro.Range(crow + 1, ccol, 50000, ccol).SetDataValidation().List(Catalogos.Range(2, colmetodopago, rowmetodopago, colmetodopago), True) : ccol = ccol + 1
libro.Range(crow, 1, crow, ccol - 1).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189))
libro.Range(crow, 1, crow, ccol - 1).Style.Font.FontColor = ClosedXML.Excel.XLColor.White
Catalogos.ColumnsUsed().AdjustToContents()
libro.ColumnsUsed().AdjustToContents()
'AreaGeografica ABC
'GlobalDTMetodosPago MetodoPago" DataValueField="CveMetodoPago
Dim fs As System.IO.Stream = New System.IO.MemoryStream()
wb.SaveAs(fs)
fs.Position = 0
Dim memoryStream As System.IO.MemoryStream = New System.IO.MemoryStream()
Using input As System.IO.Stream = fs
input.CopyTo(memoryStream)
End Using
memoryStream.Position = 0
Response.Clear()
Response.Buffer = True
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
Response.AddHeader("content-disposition", String.Format("attachment;filename=SaldosInicialesRH.xlsx", ""))
Response.BinaryWrite(memoryStream.ToArray())
Response.[End]()
'Using nom As ClsNominas = New ClsNominas()
' If nom.ReportedePercepcionesDeduccionesGet(UsuarioActual.CveEmpresa, fechai, fechaf, 4) Then
' Dim dt As DataTable = nom.DTSetResultados.Tables(0)
' Dim libro = wb.AddWorksheet(nom.DTSetResultados.Tables(0), "Percepciones y deducciones")
' libro.Tables.FirstOrDefault().Theme = ClosedXML.Excel.XLTableTheme.None
' Dim crow As Integer = 1
' For Each item As DataRow In dt.Rows
' crow += 1
' Select Case item("Grupoid").ToString()
' Case "10"
' libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(184, 204, 228))
' Case "8", "11"
' libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189))
' libro.Range(crow, 1, crow, 11).Style.Font.FontColor = ClosedXML.Excel.XLColor.White
' Case "6"
' libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(216, 228, 188))
' Case "5", "7"
' libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(155, 187, 89))
' libro.Range(crow, 1, crow, 9).Style.Font.FontColor = ClosedXML.Excel.XLColor.White
' Case "2"
' Case "1", "3"
' libro.Range(crow, 1, crow, 9).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(75, 172, 198))
' libro.Range(crow, 1, crow, 9).Style.Font.FontColor = ClosedXML.Excel.XLColor.White
' End Select
' Next
' libro.Range(2, 4, crow, 9).Style.NumberFormat.Format = "$##,###,###,0.00"
' libro.Range(2, 4, crow, 9).DataType = ClosedXML.Excel.XLDataType.Number
' libro.Column(1).Delete()
' libro.ColumnsUsed().AdjustToContents()
' libro.Row(1).InsertRowsAbove(4)
' libro.Range(1, 2, 1, 6).Merge().Value = UsuarioActual.Empresa.Empresa
' libro.Range(2, 2, 2, 6).Merge().Value = $"Reporte de percepciones y deducciones del {fechai} al {fechaf}"
' libro.Range(1, 2, 2, 6).Style.Font.SetBold(True)
' libro.Range(1, 2, 2, 6).Style.Font.SetFontSize(16)
' libro.Range(2, 2, 2, 6).Style.Font.SetFontSize(14)
' libro.Range(1, 2, 2, 6).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Center
' libro.Range(2, 7, 2, 9).Merge().Value = $"Fecha:{DateTime.Now}"
' libro.Range(3, 7, 3, 9).Merge().Value = $"Hora:{DateTime.Now}"
' End If
'End Using
End Sub
End Class
S

79
RH/DiasFestivos.aspx Normal file
View File

@@ -0,0 +1,79 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="DiasFestivos.aspx.cs" Inherits="RH_DiasFestivos" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" Runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="E" Runat="Server">
Catalogo de días festivos
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="HB" Runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" Runat="Server">
<li ><asp:LinkButton ID = "LnkAgregarDiasFestivos" OnClick ="LnkAgregarDias_Click" runat = "server" ><i class="fa fa-plus"></i>días festivos</asp:LinkButton></li>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="HA" Runat="Server">
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="C" Runat="Server">
<asp:UpdatePanel ID="upDatosDias" runat ="server" UpdateMode="Conditional" >
<ContentTemplate>
<asp:GridView ID="GVDiasFestivos" runat="server" GridLines="None" CssClass ="table table-hover table-striped ScrollAD Widthall" AutoGenerateColumns="False"
datakeynames="CveDiainabil,Fecha,CveEmpresa">
<Columns>
<asp:TemplateField HeaderText="Fecha">
<ItemTemplate>
<asp:Label ID="lblfecha" runat="server" Text='<%# Eval("Fecha","{0:dd/MM/yyyy}")%>'> </asp:Label>
</ItemTemplate>
</asp:TemplateField>
<%--<asp:TemplateField ItemStyle-Width="25">
<ItemTemplate>
<asp:LinkButton data-toggle="tooltip" title="Editar" ID="LnkEditar" OnClick="LnkEditarDias_Click" CssClass="btn btn-circle btn-sm green" runat="server" Text="<i class='fa fa-pencil'></i>"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>--%>
<asp:TemplateField ItemStyle-Width="25">
<ItemTemplate>
<asp:LinkButton ID="imgD" runat="server" OnClick="LnkEliminarDias_Click" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea eliminar el DiasFestivos?" data-btn-ok-label="si" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
<div id="DModalDiasFestivos" class="modal ADS fade" role="dialog">
<asp:UpdatePanel class="modal-dialog" runat="server" ID="UPModalDias" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-content" >
<div class="modal-header ">
<h4 class="modal-title"><asp:Literal ID="ltlDiastitulo" runat="server"> </asp:Literal></h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-4 truncate ">Fecha</div>
<div class="col-md-8">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px; ">
<asp:TextBox ID="TxtDiasfecha" CssClass="form-control input-sm ADSMaskDate" Style="width: 118px" runat="server"></asp:TextBox>
<span class="input-group-btn "> <asp:LinkButton ID="LnkDiasfecha" class="btn default " Text=" <i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton> </span>
</div>
<ajax:MaskedEditExtender ID="MEEDiasfecha" runat="server" TargetControlID="TxtDiasfecha" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CEEDiasfecha" TargetControlID="TxtDiasfecha" PopupButtonID="LnkDiasfecha" PopupPosition="BottomRight" Enabled="True" Format="dd/MM/yyyy"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="RfvDiasfecha" runat="server" ControlToValidate="TxtDiasfecha" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha''</b> es necesario, por favor ingréselo." ValidationGroup="VGMDias"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VcoDiasfecha" runat="server" HighlightCssClass="vco" TargetControlID="RfvDiasfecha"></ajax:ValidatorCalloutExtender>
</div>
</div>
</div>
<div class="modal-footer ">
<div class="modal-btn">
<asp:Button ID="BtnDiasADD" OnClick="BtnDiasADD_Click" runat="server" Text="Agregar" CssClass="btn btn-primary" ValidationGroup="VGMDias" />
<%--<asp:Button ID="BtnDiasEdit" OnClick="BtnDiasEdit_Click" runat="server" Text="Actualizar" CssClass="btn btn-primary" ValidationGroup="VGMDias" ></asp:Button>--%>
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" Runat="Server">
</asp:Content>

74
RH/DiasFestivos.aspx.cs Normal file
View File

@@ -0,0 +1,74 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Extensiones;
public partial class RH_DiasFestivos : ClsPaginas
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
CargaDiasFestivos();
}
}
protected void CargaDiasFestivos()
{
ClsRH ObjDias = new ClsRH();
ObjDias.DiasFestivosGet(UsuarioActual.CveEmpresa );
GVDiasFestivos.DataSource = ObjDias.DtResultados;
ObjDias.Dispose();
GVDiasFestivos.DataBind();
upDatosDias.Update();
}
protected void LimpiaDiasFestivos()
{
TxtDiasfecha.Text = "";
UPModalDias.Update();
}
protected void LnkAgregarDias_Click(object sender, EventArgs e)
{
this.RegistraScript("$('#DModalDiasFestivos').modal();");
LimpiaDiasFestivos();
BtnDiasADD.Visible = true;
UPModalDias.Update();
}
protected void BtnDiasADD_Click(object sender, EventArgs e)
{
DateTime fecha = TxtDiasfecha.Text.ToDate();
ClsRH ObjDias = new ClsRH();
bool Continuar = ObjDias.DiasFestivosAdd(fecha, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario);
ObjDias.Dispose();
if (Continuar)
{
this.RegistraScript("$('#DModalDiasFestivos').modal('hide');");
LimpiaDiasFestivos();
CargaDiasFestivos();
UPModalDias.Update();
this.Alert("El dìa festivos se ha agregado");
}
}
protected void LnkEliminarDias_Click(object sender, EventArgs e)
{
GridViewRow gvRow = (GridViewRow)(((LinkButton)sender).NamingContainer);
DateTime fecha = gvRow.DataKey("CveDiainabil").ToDateTime();
ClsRH ObjDias = new ClsRH();
bool Continuar = ObjDias.DiasFestivosRemove(fecha, UsuarioActual.CveEmpresa);
ObjDias.Dispose();
if (Continuar)
{
CargaDiasFestivos();
this.Alert("El dìa festivos se ha Eliminado");
}
}
}

View File

@@ -26,7 +26,7 @@ public class TareasJam : IHttpHandler
switch (Metodo)
{
case "TestConexion":
retorno = PruebaConexionFTP("ftp://us2.hostedftp.com/", "agrojam", "A12345678");
retorno = PruebaConexionFTP("ftp://thalamus.exavault.com", "agrojam", "A12345678");
break;
case "EjecutaThalamus":
@@ -112,7 +112,7 @@ public class TareasJam : IHttpHandler
//string FTPPass = "agj-3500";
string FTPServer = "ftp://us2.hostedftp.com";
string FTPServer = "ftp://thalamus.exavault.com";
string TFPUsr = "agrojam";
string FTPPass = "A12345678";
@@ -375,7 +375,10 @@ public class TareasJam : IHttpHandler
ErrorProceso = true;
Respuesta = false;
}
// ErrorProceso = true;
if (!ErrorProceso)
{

View File

@@ -651,7 +651,24 @@ Partial Class Ventas_ClientesAbonar
Protected Sub BtnIEGuardar_Click(sender As Object, e As EventArgs) Handles BtnIEGuardar.Click
'SI ES EMPRESA DE ACUMULADORES DEBE OBLIGAR A SUBIR UN ARCHIVO
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
Dim files = Anexo.getfiles()
If files IsNot Nothing Then
If files.Archivos IsNot Nothing Then
If files.Archivos.Count = 0 Then
Alert("Debe anexar un archivo", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Else
Alert("Debe anexar un archivo", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Else
Alert("Debe anexar un archivo", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
Dim ValFechaDocumento As Boolean = False
Dim FoliosFechasValFechaDocumento As New StringBuilder
@@ -1948,11 +1965,19 @@ Partial Class Ventas_ClientesAbonar
ObjFacturaDevolucion.CveTipoRelacion = 7
ObjFacturaDevolucion.TipoRelacion = "07"
ObjFacturaDevolucion.DtVentasRelacionadas = New DataTable
ObjFacturaDevolucion.DtVentasRelacionadas.Columns.Add("CveVenta", GetType(Integer))
Dim Fol As New List(Of String)
For Each Fac In ListaVentasGenerarNC
Fol.Add(Fac.FolioFiscal)
Dim RowVenta As DataRow = ObjFacturaDevolucion.DtVentasRelacionadas.NewRow
RowVenta("CveVenta") = Fac.CveVenta
ObjFacturaDevolucion.DtVentasRelacionadas.Rows.Add(RowVenta)
Next
ObjFacturaDevolucion.UUIDRelacionados = Fol
Select Case ObjFacturaDevolucion.TipoDocto

View File

@@ -899,7 +899,11 @@ Partial Class RepVentaDetalle
pathPDF = Server.MapPath(String.Format("~/Empresas/{0}/PDF/{1}/{2}.pdf", UsuarioActual.CveEmpresa, TipoDocto, gvr.DataKey("SerieFolio").ToString))
If IO.File.Exists(pathPDF) Then
DescargaZIP.AddFile(pathPDF, "")
'NO AGREGAR ARCHIVOS REPETIDOS
Dim File As New IO.FileInfo(pathPDF)
If Not DescargaZIP.Any(Function(x) x.FileName.Contains(File.Name)) Then
DescargaZIP.AddFile(pathPDF, gvr.DataKey("TipoDocumento").ToString)
End If
End If
End If
Next
@@ -910,7 +914,7 @@ Partial Class RepVentaDetalle
Response.End()
End Sub
Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, CveUsuarioCreo As Integer) As Byte()
Dim Url = New Uri(String.Format("{0}Compras/PopUpVerFactura.aspx?P={1}", "http://localhost/", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta))))
Dim Url = New Uri(String.Format("{0}Compras/PopUpVerFactura.aspx?P={1}", "http://localhost:85/", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta))))
Dim File As Byte() = Nothing
Try
Using httpClient = New HttpClient()
@@ -961,7 +965,11 @@ Partial Class RepVentaDetalle
pathXML = Server.MapPath(String.Format("~/Empresas/{0}/XML/{1}/{2}.xml", UsuarioActual.CveEmpresa, TipoDocto, gvr.DataKey("SerieFolio").ToString))
If IO.File.Exists(pathXML) Then
DescargaZIP.AddFile(pathXML, "")
'NO AGREGAR ARCHIVOS REPETIDOS
Dim File As New IO.FileInfo(pathXML)
If Not DescargaZIP.Any(Function(x) x.FileName.Contains(File.Name)) Then
DescargaZIP.AddFile(pathXML, gvr.DataKey("TipoDocumento").ToString)
End If
End If
End If
Next

View File

@@ -3401,7 +3401,7 @@
</div>
</div>
<div class="chequesie1">
<div class="chequesie1" id="DivTransferencia" runat="server">
<div class="row">
<label class="col-md-2">Transf.:</label>
<div class="col-md-4 input-icon">
@@ -3725,8 +3725,8 @@
<asp:Button ID="BtnEditarCotizacion" runat="server" Text="Actualizar" Visible="false" CssClass="btn myventasbutton btn-primary" />
<asp:Button ID="BtnPermisoEditarCotizacion" runat="server" Text="Editar" Visible="false" CssClass="btn myventasbutton btn-primary" />
<asp:Button ID="BtnEditarRemision" runat="server" Text="Actualizar Remision" CssClass="btn myventasbutton btn-primary" Visible="false" />
<asp:Button ID="BtnPermisoEditarRemision" runat="server" Text="Editar Remision" CssClass="btn myventasbutton btn-primary" Visible="false" />
<asp:Button ID="BtnEditarRemision" runat="server" Text="Actualizar Remisión" CssClass="btn myventasbutton btn-primary" Visible="false" />
<asp:Button ID="BtnPermisoEditarRemision" runat="server" Text="Editar Remisión" CssClass="btn myventasbutton btn-primary" Visible="false" />
<asp:Button ID="BtnMandaMail" runat="server" Text="MandaMail" CssClass="btn myventasbutton btn-primary" Visible="false" />
<asp:Button ID="BtnCrearApartirDe" runat="server" Text="Crear a partir de" CssClass="btn myventasbutton btn-primary" Visible="false" />
@@ -4761,10 +4761,10 @@
</div>
<div class="row">
<div class="col-md-12">
<asp:RadioButtonList ID="RblTipo" runat="server" RepeatDirection="Horizontal" CssClass="input-group col-md-12" CellSpacing="100">
<asp:ListItem Value="1" Class="one" Selected="True"><label><b>Total General</b></label></asp:ListItem>
<asp:ListItem Value="2" Class="one"><label><b>Total x Remisión</b></label></asp:ListItem>
<asp:RadioButtonList ID="RblTipo" runat="server" AutoPostBack="true" RepeatDirection="Horizontal" CssClass="input-group col-md-12" CellSpacing="100">
<asp:ListItem Value="3" Class="one" Selected="True"><label><b>Total x Concepto</b></label></asp:ListItem>
<asp:ListItem Value="1" Class="one"><label><b>Total General</b></label></asp:ListItem>
<asp:ListItem Value="2" Class="one"><label><b>Total x Remisión</b></label></asp:ListItem>
</asp:RadioButtonList>
</div>
</div>
@@ -6909,7 +6909,7 @@
<asp:CheckBox ID="ChkCancelarRemision" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:HyperLinkField DataTextField="SerieFolio" HeaderText="Remision" Target="_blank" DataNavigateUrlFields="CveVenta" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" />
<asp:HyperLinkField DataTextField="SerieFolio" HeaderText="Remisión" Target="_blank" DataNavigateUrlFields="CveVenta" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" />
</Columns>
</asp:GridView>
</div>

View File

@@ -1298,6 +1298,16 @@ Partial Class Ventas
ViewState("CveFormaPago33Cliente") = value
End Set
End Property
Private Property RFCReceptorVenta As String
Get
Return If(IsNothing(ViewState("RFCReceptorVenta")), "", ViewState("RFCReceptorVenta").ToString())
End Get
Set(value As String)
ViewState("RFCReceptorVenta") = value
End Set
End Property
#End Region
#Region "Propiedades PuntoVenta"
@@ -1573,7 +1583,7 @@ Partial Class Ventas
Private Property EnviarCorreoCliente As Boolean
Get
Return CBool(ViewState("EnviarCorreoCliente").ToString())
Return CBool(IfNull(ViewState("EnviarCorreoCliente"), False))
End Get
Set(value As Boolean)
ViewState("EnviarCorreoCliente") = value
@@ -2867,6 +2877,14 @@ Partial Class Ventas
End If
End If
'VALIDA ESTATUS CLIENTE - SOLO SE PUEDE USAR EL CLIENTE PARA COTIZAR EN CASO DE ESTAR INACTIVO
If Not CveVenta > 0 AndAlso Not BtnEmitirImprimir.Visible AndAlso Request("Op") IsNot Nothing AndAlso Request("Op").ToString() <> "" Then
If DdlTipoComprobante.SelectedValue.Contiene("Cot") Then
BtnEmitirImprimir.Visible = True
TrVistaPrevia.Visible = True
End If
End If
End If
''EN REALIDAD SE OCUPAN ESTAS COSAS DENTRO DEL POSTABCK ???
@@ -3975,6 +3993,8 @@ Partial Class Ventas
ObjUsados.Dispose()
End If
RFCReceptorVenta = DbRowVenta("RFCReceptor").ToString()
ViewState("CveSubProyectoVenta") = DbRowVenta("CveSubProyecto").ToString().ToEntero()
Me.CveEstatusFacturaPadre = DbRowVenta("CveEstatusFacturaPadre").ToString().ToEntero()
@@ -10922,6 +10942,29 @@ Partial Class Ventas
End If
factura.CvePrePoliza = ObjConta.AddPrePolizas("Ventas/GuardarVenta", factura.CvePlantillaPoliza, factura.Total, factura.Total, factura.CveMoneda, factura.Fecha, If(CveEmpresaCRM > 0, LblEmpresaCRM.Text, factura.Cliente.Nombre), factura.CveUsuario, factura.CveEmpresa)
Dim RFCReceptor As String = ""
If factura.Timbre IsNot Nothing AndAlso factura.Timbre.Receptor IsNot Nothing Then
If Not String.IsNullOrEmpty(factura.Timbre.Receptor.RFC) Then
RFCReceptor = factura.Timbre.Receptor.RFC.Trim
End If
End If
'SI NO SE VA TIMBRAR TOMA EL DEL CLIENTE
If String.IsNullOrEmpty(RFCReceptor) Then
If Not String.IsNullOrEmpty(LblRFC.Text) Then
RFCReceptor = LblRFC.Text.Trim
End If
If factura.FacturarSucursal Then
If factura.ClienteSucursal IsNot Nothing Then
RFCReceptor = factura.ClienteSucursal.RFC
End If
End If
End If
If Not ObjVentas.AddVenta(factura.TipoDocto, factura.Folio, factura.CveCliente, factura.CveClienteSucursal, factura.SubTotalTC, factura.DescuentoTC,
factura.AmortizacionTC, factura.IVATC, factura.RetIVATC, factura.RetISRTC,
factura.TotalTC, factura.CveMoneda, factura.TipoCambio, factura.CveMetodoPago, factura.CondicionesPago, factura.FormaPago, factura.FechaPago, factura.Fecha, factura.MotivoDescuento,
@@ -10937,7 +10980,7 @@ Partial Class Ventas
CveTipoAmortizacionAnticipo:=factura.CveTipoAmortizacionAnticipo, CveEmpresaCRM:=CveEmpresaCRM, EsInterno:=EsInterno, CveAcercamientoCRM:=CveAcercamientoCRM,
DiasCredito:=factura.DiasCredito, EsDiasCreditoFijo:=factura.EsDiasCreditoFijo, AnticipoEspecial:=If(TrAntEspecial.Visible, ChkAntEspecial.Checked, False),
Kilometraje:=TxtKilometraje.Text.ToDouble, EsAmortizacion:=EsNCAmortizacion, CveTipoRetencion:=factura.CveTipoRetencion, CorreoNotificacion:=TxtCorreoNotificaciones.Text,
FormaPaqueteria:=RblPaqueteria.SelectedValue.ToEntero, FacturarSucursal:=factura.FacturarSucursal, VentaDesglosaIEPS:=factura.VentaDesglosaIEPS) Then
FormaPaqueteria:=RblPaqueteria.SelectedValue.ToEntero, FacturarSucursal:=factura.FacturarSucursal, VentaDesglosaIEPS:=factura.VentaDesglosaIEPS, RFCReceptor:=RFCReceptor) Then
ErrorList.Add("Ocurrió un error al Generar la Venta.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
Else
If factura.TipoDocto.Contiene("Dev", "Egs") Or DtVentasNC IsNot Nothing Or CveEstatusRefacturacion = 1 Then
@@ -12732,7 +12775,7 @@ Partial Class Ventas
' DrPago("Importe") = DrPago("Importe").ToString().ToDecimal - TxtCambio.Text.ToDecimal
'End If
CveIEPago = ObjBancos.AddBancos_IE(DrPago("CveCuenta").ToString().ToEntero(), DrPago("CveTipoMovimiento").ToString().ToEntero(), Fecha, FolioIE.ToString(), String.Format("PAGO: {0}", TxtFolio.Text), DrPago("Importe").ToString().ToDouble, DdlMoneda.SelectedValue.ToEntero(), tipoCambio, DrPago("Observaciones").ToString(), "", False, False, -1, ObjFactura.CvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCorte:=CveCorte, MesesSinIntereses:=DrPago("MesesSinIntereses").ToString().ToEntero())
CveIEPago = ObjBancos.AddBancos_IE(DrPago("CveCuenta").ToString().ToEntero(), DrPago("CveTipoMovimiento").ToString().ToEntero(), Fecha, FolioIE.ToString(), String.Format("PAGO: {0}", TxtFolio.Text), DrPago("Importe").ToString().ToDouble, DdlMoneda.SelectedValue.ToEntero(), tipoCambio, DrPago("Observaciones").ToString(), "", False, False, -1, ObjFactura.CvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCorte:=CveCorte, MesesSinIntereses:=DrPago("MesesSinIntereses").ToString().ToEntero(), Modulo:="Ventas/Guardar")
If CveIEPago > 0 Then
@@ -14089,6 +14132,8 @@ Partial Class Ventas
Dim CveCuentaIVAXTrasladar As Integer = 0
Dim CveCuentaIVATrasladado As Integer = 0
Dim CveSubProyectoVenta As Integer = DdlSubProyectoDatos.SelectedValue.ToEntero()
Dim Importe91 As Decimal = 0
If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows.Count > 0 Then
@@ -14196,7 +14241,7 @@ Partial Class Ventas
' CveCuentaContabilizacion = 0
'End If
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, 0, Concepto, 207, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=Math.Round(importeMovimiento * tipoCambioVenta - importeMovimiento, 2, MidpointRounding.AwayFromZero), ImporteME:=importeMovimiento, CveCuenta:=CveCuenta, TipoCambio:=tipoCambioVentaValuacion) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, 0, Concepto, 207, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=Math.Round(importeMovimiento * tipoCambioVenta - importeMovimiento, 2, MidpointRounding.AwayFromZero), ImporteME:=importeMovimiento, CveCuenta:=CveCuenta, TipoCambio:=tipoCambioVentaValuacion, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
@@ -14235,7 +14280,7 @@ Partial Class Ventas
' CveCuentaContabilizacion = 0
'End If
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=gvr.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento * tipoCambioPago, ImporteME:=If(tipoCambioPago = 1, 0, importeMovimiento), CveCuenta:=CveCuenta) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=gvr.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento * tipoCambioPago, ImporteME:=If(tipoCambioPago = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
End If
@@ -14300,7 +14345,7 @@ Partial Class Ventas
CveCuenta = 0
importeMX = importeMovimiento
ImporteComplementaria = ((importeMovimiento * TC) - importeMovimiento).RoundSQL
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, False, importeMovimiento, Concepto, 203, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=gvr.DataKey("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, ImporteMX:=ImporteComplementaria, ImporteME:=If(gvr.DataKey("TipoCambio").ToString().ToDecimal = 1, 0, importeMovimiento), TipoCambio:=TC) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, False, importeMovimiento, Concepto, 203, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=gvr.DataKey("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, ImporteMX:=ImporteComplementaria, ImporteME:=If(gvr.DataKey("TipoCambio").ToString().ToDecimal = 1, 0, importeMovimiento), TipoCambio:=TC, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
Exit For
End If
@@ -14313,7 +14358,7 @@ Partial Class Ventas
CveCuenta = 0
End If
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=gvr.DataKey("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, ImporteMX:=importeMX, CveCuenta:=CveCuenta, TipoCambio:=TC) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=gvr.DataKey("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, ImporteMX:=importeMX, CveCuenta:=CveCuenta, TipoCambio:=TC, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
Exit For
End If
@@ -14322,7 +14367,7 @@ Partial Class Ventas
If Not ErrorConta And DdlTipoComprobante.SelectedValue = "Ant" Then
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("Original").ToDecimal) * gvr.DataKey("IVA").ToDecimal)
If ObjConta.AddPrePolizasDetalle(CvePrepoliza, False, importeMovimiento, Concepto, 11, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveVentaAmortizacion:=gvr.DataKey("CveVenta").ToString().ToEntero(), ImporteMX:=importeMovimiento * TC, CveCuenta:=CveCuenta) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, True, importeMovimiento, Concepto, 4, Concepto, FechaMovimiento, gvr.DataKey("IdCtaContableNC").ToEntero(), -1, CveClasificacion:=gvr.DataKey("CveClasificacionNC").ToEntero(), CveVenta:=gvr.DataKey("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, ImporteMX:=importeMovimiento * TC, CveCuenta:=gvr.DataKey("IdCtaContableNCSIG").ToEntero()) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, True, importeMovimiento, Concepto, 4, Concepto, FechaMovimiento, gvr.DataKey("IdCtaContableNC").ToEntero(), -1, CveClasificacion:=gvr.DataKey("CveClasificacionNC").ToEntero(), CveVenta:=gvr.DataKey("CveVenta").ToString().ToEntero(), CveCliente:=CveCliente, CveVentaAmortizacion:=CveVenta, ImporteMX:=importeMovimiento * TC, CveCuenta:=gvr.DataKey("IdCtaContableNCSIG").ToEntero(), CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
Exit For
End If
@@ -14345,23 +14390,23 @@ Partial Class Ventas
If importeMovimiento <> 0 Then
' Agregamos el 2
If tipoCambioPago = 1 Then
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, Not TipoMovimiento, importeMovimiento, Concepto, 2, Concepto, FechaMovimiento, IdCtaContClientes, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, Not TipoMovimiento, importeMovimiento, Concepto, 2, Concepto, FechaMovimiento, IdCtaContClientes, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
Else 'Cuando son dolares
If importeMovimiento <> 0 Then
If IdCtaContComplementaria > 0 Or 0 > 0 Then
'Agregamos la Complementaria
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, Not TipoMovimiento, 0, Concepto, 207, Concepto, FechaMovimiento, IdCtaContComplementaria, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=Math.Round(importeMovimiento * tipoCambioVenta - importeMovimiento, 2, MidpointRounding.AwayFromZero), ImporteME:=importeMovimiento, CveCuenta:=0, TipoCambio:=tipoCambioVenta) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, Not TipoMovimiento, 0, Concepto, 207, Concepto, FechaMovimiento, IdCtaContComplementaria, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=Math.Round(importeMovimiento * tipoCambioVenta - importeMovimiento, 2, MidpointRounding.AwayFromZero), ImporteME:=importeMovimiento, CveCuenta:=0, TipoCambio:=tipoCambioVenta, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
'Agregamos la Extranjera
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, Not TipoMovimiento, importeMovimiento, Concepto, 2, Concepto, FechaMovimiento, IdCtaContMonedaExtranjera, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento, ImporteME:=importeMovimiento, CveCuenta:=0, TipoCambio:=tipoCambioVenta) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, Not TipoMovimiento, importeMovimiento, Concepto, 2, Concepto, FechaMovimiento, IdCtaContMonedaExtranjera, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento, ImporteME:=importeMovimiento, CveCuenta:=0, TipoCambio:=tipoCambioVenta, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
Else
'Agregamos la Extranjera
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, Not TipoMovimiento, importeMovimiento, Concepto, 2, Concepto, FechaMovimiento, IdCtaContMonedaExtranjera, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=Math.Round(importeMovimiento * tipoCambioVenta, 2, MidpointRounding.AwayFromZero), ImporteME:=importeMovimiento, CveCuenta:=0, TipoCambio:=tipoCambioVenta) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, Not TipoMovimiento, importeMovimiento, Concepto, 2, Concepto, FechaMovimiento, IdCtaContMonedaExtranjera, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=Math.Round(importeMovimiento * tipoCambioVenta, 2, MidpointRounding.AwayFromZero), ImporteME:=importeMovimiento, CveCuenta:=0, TipoCambio:=tipoCambioVenta, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
End If
@@ -14378,7 +14423,7 @@ Partial Class Ventas
IdCtaContable = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar)
CveCuenta = If(CveCuentaIVAXTrasladar > 0, CveCuentaIVAXTrasladar, UsuarioActual.Empresa.CveCuentaIVAxTrasladar)
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, importeMovimiento, Concepto, 13, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, CveCuenta:=CveCuenta, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuestoAmortizacion) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, importeMovimiento, Concepto, 13, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, CveCuenta:=CveCuenta, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuestoAmortizacion, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
@@ -14386,7 +14431,7 @@ Partial Class Ventas
IdCtaContable = If(IdCtaIVATrasladado > 0, IdCtaIVATrasladado, UsuarioActual.Empresa.IdCuentaIVATrasladado)
CveCuenta = If(CveCuentaIVATrasladado > 0, CveCuentaIVATrasladado, UsuarioActual.Empresa.CveCuentaIVATrasladado)
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, Not TipoMovimiento, importeMovimiento, Concepto, 61, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, CveCuenta:=CveCuenta, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuestoAmortizacion) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, Not TipoMovimiento, importeMovimiento, Concepto, 61, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, CveCuenta:=CveCuenta, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuestoAmortizacion, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
End If
@@ -14401,7 +14446,7 @@ Partial Class Ventas
IdCtaContable = UsuarioActual.Empresa.IdCuentaIEPSxTrasladar
CveCuenta = UsuarioActual.Empresa.CveCuentaIEPSxTrasladar
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, importeMovimiento, Concepto, 38, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, CveCuenta:=CveCuenta, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuestoAmortizacion) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, importeMovimiento, Concepto, 38, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, CveCuenta:=CveCuenta, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuestoAmortizacion, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
@@ -14409,7 +14454,7 @@ Partial Class Ventas
IdCtaContable = UsuarioActual.Empresa.IdCuentaIEPSTrasladado
CveCuenta = UsuarioActual.Empresa.CveCuentaIEPSTrasladado
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, Not TipoMovimiento, importeMovimiento, Concepto, 61, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, CveCuenta:=CveCuenta, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuestoAmortizacion) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, Not TipoMovimiento, importeMovimiento, Concepto, 61, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, CveCuenta:=CveCuenta, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuestoAmortizacion, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
End If
@@ -14443,7 +14488,7 @@ Partial Class Ventas
End If
End If
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, CveCuenta:=-1, TipoCambio:=tipoCambioPago) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, CveCuenta:=-1, TipoCambio:=tipoCambioPago, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
End If
@@ -14587,7 +14632,9 @@ Partial Class Ventas
' CveCuentaContabilizacion = 0
'End If
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=importeMX, CveCuenta:=CveCuenta, TipoCambio:=TipoCambioGeneral, PorcentajeImpuesto:=PorcentajeImpuesto) Then
If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1,
CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=importeMX, CveCuenta:=CveCuenta, TipoCambio:=TipoCambioGeneral,
PorcentajeImpuesto:=PorcentajeImpuesto, CveSubProyecto:=CveSubProyectoVenta) Then
ErrorConta = True
Exit For
End If
@@ -14746,7 +14793,12 @@ Partial Class Ventas
'cuando es AMORTIZACIÓN CON FACTURA EN CERO
If DdlTipoAmortizacionAnticipo.SelectedValue = "3" Then
If Amortizacion < TxtSubTotal.Text.ToDecimal Then
Dim SubTotalRef As Decimal = TxtSubTotal.Text.ToDecimal
If LblDescuentos.Text.ToDecimal() > 0D Then
SubTotalRef = TxtSubTotal.Text.ToDecimal - LblDescuentos.Text.ToDecimal()
End If
If Amortizacion < SubTotalRef Then
'[IPP] LIMPIA LO SELECCIONADO EN CASO DE QUE NO SEA AMORTIZACIÓN DEL 100% 15Junio2018
Amortizacion = 0
@@ -14767,7 +14819,7 @@ Partial Class Ventas
End If
CalculaTotalesVenta()
CalculaTotalesVenta(ValidarDescuentos:=True)
End If
End If
@@ -16582,7 +16634,7 @@ Partial Class Ventas
If dr Is Nothing Then
'verifica marca, si tiene asignada la promocion
dr = DtPromociones.FiltroPrimero(String.Format("CveClasificacion = {0} AND (CveMarca = {1} OR CveMarca IS NULL) AND (CveSubProyecto = {2} OR CveSubProyecto IS NULL) AND (CveRinTamaño = {3} OR CveRinTamaño IS NULL) AND (TipoPromocion <> 3 OR (TipoPromocion = 3 AND CantidadMinima <= {4} )) ", CveClasifPS, CveMarcaPS, DdlSubProyectoDatos.SelectedValue, CveRinTamañoPS, TxtCantidad.Text), Orderby:="CantidadMinima desc")
dr = DtPromociones.FiltroPrimero(String.Format("CvePS IS NULL AND CveClasificacion = {0} AND (CveMarca = {1} OR CveMarca IS NULL) AND (CveSubProyecto = {2} OR CveSubProyecto IS NULL) AND (CveRinTamaño = {3} OR CveRinTamaño IS NULL) AND (TipoPromocion <> 3 OR (TipoPromocion = 3 AND CantidadMinima <= {4} )) ", CveClasifPS, CveMarcaPS, DdlSubProyectoDatos.SelectedValue, CveRinTamañoPS, TxtCantidad.Text), Orderby:="CantidadMinima desc")
End If
End If
@@ -17969,9 +18021,11 @@ Partial Class Ventas
ConfiguraTipoDocto()
End If
End Sub
Private Sub CalculaTotalesVenta(Optional RecalculaImpuestosLocales As Boolean = True, Optional NCDescuento As Boolean = False)
Private Sub CalculaTotalesVenta(Optional RecalculaImpuestosLocales As Boolean = True, Optional NCDescuento As Boolean = False, Optional ValidarDescuentos As Boolean = False)
Dim TotalSubTotal As Decimal = TmpDT.SUMD("TotalImporte")
Dim TotalSubTotalRef As Decimal = TotalSubTotal
Dim TotalDescuentos As Decimal = TmpDT.SUMD("Descuento")
Dim TotalAmortizacion As Decimal = LblAmortizacion.Text.ToDecimal
Dim TotalIVA As Decimal = TmpDT.SUMD("ImporteIVA")
@@ -17983,7 +18037,11 @@ Partial Class Ventas
Dim TotalProntoPago As Decimal = 0
If TotalAmortizacion > 0 AndAlso TotalSubTotal = TotalAmortizacion Then ' si se amortizó completa la factura, debe de limpiar los impuestos
If ValidarDescuentos Then
TotalSubTotalRef = TotalSubTotal - TotalDescuentos
End If
If TotalAmortizacion > 0 AndAlso TotalSubTotalRef = TotalAmortizacion Then ' si se amortizó completa la factura, debe de limpiar los impuestos
If DdlTipoAmortizacionAnticipo.SelectedValue.Contiene("3") Then
For Each dr As DataRow In TmpDT.Rows
dr("ImporteIVA") = 0 : dr("ImporteIEPS") = 0 : dr("ImporteRetIVA") = 0 : dr("ImporteRetISR") = 0 : dr("PorcentajeIVA") = 0 : dr("IVA") = 0
@@ -19766,7 +19824,6 @@ Partial Class Ventas
End If
Else
sb.Append("<b>No encontrado</b> <br/>")
script = "BtnRefacturacionConfirmarAceptacion();"
End If
Else
sb.Append("¿Desea realizar la refacturación?<br/>")
@@ -20408,6 +20465,9 @@ Partial Class Ventas
Case 2 'CONTADO
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") Or (UsuarioActual.Empresa.Funcionalidad(558).ToEntero() = 1 And DdlTipoComprobante.SelectedValue = "Cot") Then
DivContado.Visible = True
If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
DivTransferencia.Visible = False
End If
TxtImporteContado.Text = TxtTotal.Text
End If
TxtFechaPago.Text = Now.ToShortDateString
@@ -22040,13 +22100,21 @@ Partial Class Ventas
sb.Append("La factura se encuentra en el siguiente estatus del SAT:<br/>")
Dim TotalT As Decimal = TxtTotal.Text.ToDecimal
Dim RFCReceptor As String = LblRFC.Text.Trim
'SI SE FACTURO LA SUCURSAL DEL CLIENTE TOMA EL RFC DE ESTA
If FacturarSucursal AndAlso Me.ClienteSucursal IsNot Nothing Then
RFCReceptor = Me.ClienteSucursal.RFC
Dim RFCReceptor As String = ""
If String.IsNullOrEmpty(Me.RFCReceptorVenta) Then
RFCReceptor = LblRFC.Text.Trim
'SI SE FACTURO LA SUCURSAL DEL CLIENTE TOMA EL RFC DE ESTA
If FacturarSucursal AndAlso Me.ClienteSucursal IsNot Nothing Then
RFCReceptor = Me.ClienteSucursal.RFC
End If
Else
RFCReceptor = Me.RFCReceptorVenta
End If
Dim SWatch As New Stopwatch
SWatch.Start()
Dim Vigencia = Timbrado.VerificarVigenciaSAT(FolioFiscal, UsuarioActual.Empresa.RFC, RFCReceptor, TotalT.ToString(), True)
@@ -28249,6 +28317,15 @@ Partial Class Ventas
End Sub
Protected Sub RblTipo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RblTipo.SelectedIndexChanged
HuboCambioRemi = Not HuboCambioRemi
'TOTAL X CONCEPTO
If RblTipo.SelectedValue = "3" Then
ChkRemProductos.Visible = True
Else
ChkRemProductos.Visible = False
ChkRemProductos.Checked = False
End If
ChkRemProductos_CheckedChanged(ChkRemProductos, EventArgs.Empty)
End Sub
Protected Sub BtnGuardarRemisiones_Click(sender As Object, e As EventArgs) Handles BtnGuardarRemisiones.Click
If GvRem.Rows.Count > 0 Or GvRemPS.Rows.Count > 0 Then