diff --git a/AC/RegNomina.aspx b/AC/RegNomina.aspx index db1709f12..4c71060cf 100644 --- a/AC/RegNomina.aspx +++ b/AC/RegNomina.aspx @@ -107,7 +107,7 @@ - + P. Empleados: diff --git a/AC/RegNomina.aspx.vb b/AC/RegNomina.aspx.vb index 38dda7c00..a85fa5425 100644 --- a/AC/RegNomina.aspx.vb +++ b/AC/RegNomina.aspx.vb @@ -379,6 +379,7 @@ Partial Class AC_RegNomina Dim IdCtaServicioMedico As Integer = 643 Dim IdCtaPension As Integer = 643 Dim IdCtaISRAsimilados As Integer = 4442 + Dim IdCtaPrestamoEmpleados As Integer = 4477 Dim Importe As Double Dim MsgError As String = "" @@ -617,6 +618,9 @@ Partial Class AC_RegNomina Importe = TxtISRAsimilados.Text.ToDouble If Importe > 0 AndAlso Not objAC.AddMovimiento(IDPoliza, IdCtaISRAsimilados, True, Importe, "", Concepto, 0, Fecha, "") Then TieneError = True + 'Registro Prestamo Empleados + Importe = TxtPrestamoEmpleados.Text.ToDouble + If Importe > 0 AndAlso Not objAC.AddMovimiento(IDPoliza, IdCtaPrestamoEmpleados, True, Importe, "", Concepto, 0, Fecha, "") Then TieneError = True ''Registro del Mov Devolución 'Importe = TxtISPT.Text.ToDouble - TxtCredSalario.Text.ToDouble diff --git a/AC/RepPresupuestoEgresos.aspx b/AC/RepPresupuestoEgresos.aspx index 587751c16..ba0579ec6 100644 --- a/AC/RepPresupuestoEgresos.aspx +++ b/AC/RepPresupuestoEgresos.aspx @@ -300,7 +300,7 @@ --%> - + diff --git a/App_Code/ClsBancos.vb b/App_Code/ClsBancos.vb index 0a78eb6fe..7cbae50f4 100644 --- a/App_Code/ClsBancos.vb +++ b/App_Code/ClsBancos.vb @@ -829,11 +829,12 @@ Public Class ClsBancos Return Retorno End Function - Public Function GetPrePolizasDetalle(CvePrePoliza As Integer, Optional CveIE As Integer = -1, Optional CveOC As Integer = -1) As Boolean + Public Function GetPrePolizasDetalle(CvePrePoliza As Integer, CveEmpresa As Integer, Optional CveIE As Integer = -1, Optional CveOC As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Conta_PrePolizasDetalleGet") With SqlAdapter.SelectCommand.Parameters .Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveIE", SqlDbType.Int).Value = CveIE .Add("@CveOC", SqlDbType.Int).Value = CveOC End With diff --git a/App_Code/ClsClientes.vb b/App_Code/ClsClientes.vb index 8163a318d..5cfb77001 100644 --- a/App_Code/ClsClientes.vb +++ b/App_Code/ClsClientes.vb @@ -76,18 +76,11 @@ Public Class ClsClientes Public Property IdCtaContAnticipos As Integer Public Property IdCtaContRetIVA As Integer Public Property IdCtaContRetISR As Integer - Public Property IdCtaContFondoGarantia As Integer - Public Property CveCuentaClientes As Integer - Public Property CveCuentaMonedaExtranjera As Integer - Public Property CveCuentaComplementaria As Integer - Public Property CveCuentaAnticipos As Integer - Public Property CveCuentaRetIVA As Integer - Public Property CveCuentaRetISR As Integer - Public Property CveCuentaFondoGarantia As Integer + Public Property IdCtaContFondoGarantia As Integer Public Property Codigo As String Public Property LimiteCredito As Double 'Public Property NumCtaPago As String - Public Property CveMetodoPago As Integer + 'Public Property CveMetodoPago As Integer Public Property AplicaFEMSA As Boolean Public Property FEMSA_NumSociedad As String Public Property FEMSA_NumProveedor As String @@ -334,15 +327,9 @@ Public Class ClsClientes _IdCtaContAnticipos = Data.Rows(0)("IdCtaContAnticipos").ToString.ToEntero _IdCtaContRetIVA = Data.Rows(0)("IdCtaContRetIVA").ToString.ToEntero _IdCtaContRetISR = Data.Rows(0)("IdCtaContRetISR").ToString.ToEntero - _IdCtaContFondoGarantia = Data.Rows(0)("IdCtaContFondoGarantia").ToString.ToEntero - _CveCuentaClientes = Data.Rows(0)("IdCtaContClientesSIG").ToString.ToEntero - _CveCuentaMonedaExtranjera = Data.Rows(0)("IdCtaContMonedaExtranjeraSIG").ToString.ToEntero - _CveCuentaComplementaria = Data.Rows(0)("IdCtaContComplementariaSIG").ToString.ToEntero - _CveCuentaAnticipos = Data.Rows(0)("IdCtaContAnticiposSIG").ToString.ToEntero - _CveCuentaRetIVA = Data.Rows(0)("IdCtaContRetIVASIG").ToString.ToEntero - _CveCuentaRetISR = Data.Rows(0)("IdCtaContRetISRSIG").ToString.ToEntero - _CveCuentaFondoGarantia = Data.Rows(0)("IdCtaContFondoGarantiaSIG").ToString.ToEntero - '_ConvenioCIE = Data.Rows(0)("ConvenioCIE").ToString + _IdCtaContFondoGarantia = Data.Rows(0)("IdCtaContFondoGarantia").ToString.ToEntero + + '_ConvenioCIE = Data.Rows(0)("ConvenioCIE").ToString _FormaFacturacion = Data(0)("FormaFacturacion").ToString _LimiteCredito = Data(0)("LimiteCredito").ToString.ToDouble '_NumCtaPago = Data(0)("NumCtaPago").ToString diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index d251f6f23..1621c3921 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -286,8 +286,18 @@ Public Class ClsContabilidad Try SqlAdapter.Fill(Data) Retorno = True + Catch ex As Exception - OnError("Ocurrió un error al Actualizar la Prepoliza", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + If ex.Message.Contains("CuentasResultados_SubProyectos") Then + OnError("El concepto requiere que se le especifique centro de costo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + Else + If ex.Message.Contains("concepto de bancos con un importe diferente") Then + OnError("No se puede editar el valor del bancos con un valor diferente a movimiento registrado", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + Else + OnError("Ocurrió un error al Actualizar la Prepoliza", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End If + End If + End Try Return Retorno @@ -1080,12 +1090,13 @@ Public Class ClsContabilidad Return Concepto End Function - Public Function GetPrePolizasDetalle(CvePrePoliza As Integer, Optional CveIE As Integer = -1) As Boolean + Public Function GetPrePolizasDetalle(CvePrePoliza As Integer, CveEmpresa As Integer, Optional CveIE As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Conta_PrePolizasDetalleGet") With SqlAdapter.SelectCommand.Parameters .Add("@CvePrePoliza", SqlDbType.Int).Value = CvePrePoliza .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa End With Try diff --git a/App_Code/ClsGenerales.vb b/App_Code/ClsGenerales.vb index 55c6e7eca..43c95d644 100644 --- a/App_Code/ClsGenerales.vb +++ b/App_Code/ClsGenerales.vb @@ -174,7 +174,7 @@ Public Class ClsGenerales Return retorno End Function - Public Function RepConciliacionSatGET(cveEmpresa As Int32, tipoDocto As String, fechaI As String, fechaF As String) As Boolean + Public Function RepConciliacionSATGet(cveEmpresa As Int32, tipoDocto As String, fechaI As String, fechaF As String) As Boolean Dim retorno As Boolean = False DataAdapter("PA_RepConciliacionSatGET", CommandType.StoredProcedure) With SqlAdapter.SelectCommand.Parameters diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index e21615b2c..e965a4e5b 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -2440,6 +2440,50 @@ Public Class ClsInventarios Return Retorno End Function + Public Function RemoveInventarioFisicoProveedores(CveInventarioFisico As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Inv_InventarioFisicoProveedoresRemove") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveInventarioFisico", SqlDbType.Int).Value = CveInventarioFisico + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + + Catch Ex1 As SqlException + Me.OnError("Ocurrió un error al eliminar el producto del servicio del inventario fisico.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Catch ex As Exception + OnError("Ocurrió un error al eliminar el producto del servicio del inventario fisico.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function AddInventarioFisicoProveedores(CveInventarioFisico As Integer, CveProveedor As Integer, Incluye As Boolean) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Inv_InventarioFisicoProveedoresAdd") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveInventarioFisico", SqlDbType.Int).Value = CveInventarioFisico + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@Incluye", SqlDbType.Bit).Value = If(Incluye, 1, 0) + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + + Catch Ex1 As SqlException + Me.OnError("Ocurrió un error al guardar el producto del servicio del inventario fisico.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Catch ex As Exception + OnError("Ocurrió un error al guardar el producto del servicio del inventario fisico.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function Public Function AddInventarioFisicoAlmacenes(CveInventarioFisico As Integer, CveAlmacen As Integer) As Boolean @@ -2535,6 +2579,28 @@ Public Class ClsInventarios Return Retorno End Function + Public Function GetInventarioFisicoDetallesProveedores(CveInventarioFisico As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Inv_InventarioFisicoDetallesProveedoresGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveInventarioFisico", SqlDbType.Int).Value = CveInventarioFisico + .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 la clasificacion del inventario fisico.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Catch ex As Exception + OnError("Ocurrió un error al obtener la clasificacion del inventario fisico.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + #Region "I N V E N T A R I O - F I S I C O - D E T A L L E" diff --git a/App_Code/ClsMovimientos.vb b/App_Code/ClsMovimientos.vb index 74e9f319d..0193ebf94 100644 --- a/App_Code/ClsMovimientos.vb +++ b/App_Code/ClsMovimientos.vb @@ -616,7 +616,7 @@ Public Class ClsMovimientos Optional FechaVI As String = "-1", Optional FechaVF As String = "-1", Optional FechaCorte As Date = Nothing, Optional CveUsuarioConsulta As Integer = -1, Optional CveTipoProveedor As Integer = -1, Optional Comprobaciones As Integer = -1, - Optional TipoDocto As String = "-1") As Boolean + Optional TipoDocto As String = "-1", Optional TipoAgrupacion As Integer = -1) As Boolean Dim Retorno As Boolean = False If FechaCorte = Nothing Then FechaCorte = Now @@ -645,6 +645,8 @@ Public Class ClsMovimientos .Add("@CveTipoProveedor", SqlDbType.Int).Value = CveTipoProveedor .Add("@Comprobaciones", SqlDbType.Int).Value = Comprobaciones .Add("@TipoDocto", SqlDbType.VarChar).Value = TipoDocto + .Add("@TipoAgrupacion", SqlDbType.Bit).Value = TipoAgrupacion + End With Try diff --git a/App_Code/ClsNominas.vb b/App_Code/ClsNominas.vb index 23ac5b7b2..48c37025e 100644 --- a/App_Code/ClsNominas.vb +++ b/App_Code/ClsNominas.vb @@ -277,6 +277,49 @@ Public Class ClsNominas End Try Return retorno End Function + Public Function ComparativoSATNominasGet(cveEmpresa As Integer, xml As String, FechaInicio As DateTime, FechaFin As DateTime, CveTipoPeriodo As Integer) As Boolean + Dim retorno As Boolean = False + DTSet = New DataSet() + DataAdapter("[PA_Nom_ComparativoSATNominasGet]", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@xml", SqlDbType.Xml).Value = xml + .Add("@CveEmpresa", SqlDbType.Int).Value = cveEmpresa + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + .Add("@TipoPeriodo", SqlDbType.Int).Value = CveTipoPeriodo + End With + Try + SqlAdapter.Fill(DTSet) + If DTSet.Tables.Count > 0 Then + Data = DTSet.Tables(0) + End If + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el reporte de Percepciones.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function + Public Function ReportedeNominasGet(cveEmpresa As Integer, FechaInicio As DateTime, FechaFin As DateTime, CveTipoPeriodo As Integer) As Boolean + Dim retorno As Boolean = False + DTSet = New DataSet() + DataAdapter("[PA_Nom_ReportedeNominasGet]", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = cveEmpresa + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + .Add("@TipoPeriodo", SqlDbType.Int).Value = CveTipoPeriodo + End With + Try + SqlAdapter.Fill(DTSet) + If DTSet.Tables.Count > 0 Then + Data = DTSet.Tables(0) + End If + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el reporte de Percepciones.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return retorno + End Function Public Function ReportedePercepcionesDeduccionesGet(cveEmpresa As Integer, FechaInicio As DateTime, FechaFin As DateTime, CveTipoPeriodo As Integer) As Boolean Dim retorno As Boolean = False DTSet = New DataSet() @@ -1020,26 +1063,6 @@ Public Class ClsNominas Return Retorno End Function - 'Reporte Personal Acumulados - Public Function GetRepPersonalAcumulados(CvePersonal As Integer, Ejercicio As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Nom_PersonalAcumuladosGetRep") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal - .Add("@Ejercicio", SqlDbType.Int).Value = Ejercicio - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Reporte Conceptos Acumulados.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - Public Function UpdateNom_NominasDetallesMasivoSueldo(CvePeriodo As Integer, CveConcepto As Integer, Salario As Double, Importe As Double, ImporteExento As Double, ImporteGravado As Double, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Nom_NominasDetallesUpdateMasivoSueldo") @@ -2236,8 +2259,6 @@ Public Class ClsNominas .Add("@RegimenContratacion", SqlDbType.Int).Value = RegimenContratacion .Add("@CvePersonal", SqlDbType.Decimal).Value = CvePersonal End With - - SqlAdapter.Fill(DTSet) retorno = True Catch sqEx As SqlException @@ -2260,7 +2281,6 @@ Public Class ClsNominas .Add("@Tipo", SqlDbType.Int).Value = Tipo .Add("@Fecha", SqlDbType.Date).Value = FechaCalculo End With - SqlAdapter.Fill(DTSet) retorno = True Catch sqEx As SqlException diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 2d8747e86..bf5d3e6f6 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -3853,7 +3853,7 @@ Public Class ClsPaginas PaginaDict.Add("/Nomina/ISRCalculoAnual.aspx".ToUpper(), 918) PaginaDict.Add("/Nomina/MovimientosSUA.aspx".ToUpper(), 919) - PaginaDict.Add("/Nomina/Acumulados.aspx".ToUpper(), 916) + 'PaginaDict.Add("/Nomina/Acumulados.aspx".ToUpper(), 916) PaginaDict.Add("/RH/CalculoSBC.aspx".ToUpper(), 915) PaginaDict.Add("/Inicio.aspx".ToUpper(), -1) PaginaDict.Add("/reporteador.aspx".ToUpper(), -1) @@ -3866,6 +3866,7 @@ Public Class ClsPaginas PaginaDict.Add("/Ventas/SolicitudesSAT.aspx".ToUpper(), 717) PaginaDict.Add("/Nomina/CatConceptos2.aspx".ToUpper(), -1) + PaginaDict.Add("/Nomina/NomTimbrados.aspx".ToUpper(), 920) PaginaDict.Add("/Nomina/Aguinaldo.aspx".ToUpper(), -1) PaginaDict.Add("/Nomina/RepInversiondeNomina.aspx".ToUpper(), 906) PaginaDict.Add("/RH/DiasFestivos.aspx".ToUpper(), -1) @@ -4419,8 +4420,8 @@ Public Class ClsPaginas PaginaDict.Add("/Contabilidad2/RepCambiosSituacionFinanciera.aspx".ToUpper(), 585) PaginaDict.Add("/Contabilidad2/RepSituacionFinanciera.aspx".ToUpper(), 586) PaginaDict.Add("/Contabilidad2/RepMovimientosAuxiliaresCatalogo.aspx".ToUpper(), 587) - PaginaDict.Add("/Contabilidad2/RegPoliza.aspx".ToUpper(), 588) - PaginaDict.Add("/Contabilidad2/PymeRegPoliza.aspx".ToUpper(), 588) + ' PaginaDict.Add("/Contabilidad2/RegPoliza.aspx".ToUpper(), 588) + 'PaginaDict.Add("/Contabilidad2/PymeRegPoliza.aspx".ToUpper(), 588) PaginaDict.Add("/Contabilidad2/RepAlmacenConta.aspx".ToUpper(), 539) PaginaDict.Add("/Contabilidad2/RepAnexoCatalogoMensual.aspx".ToUpper(), 589) @@ -4430,12 +4431,12 @@ Public Class ClsPaginas PaginaDict.Add("/Contabilidad2/CatCuentas.aspx".ToUpper(), 596) PaginaDict.Add("/Contabilidad2/RepLibroDiario.aspx".ToUpper(), 544) - PaginaDict.Add("/Contabilidad2/RepSituacionFinancieraSAT.aspx".ToUpper(), 615) - PaginaDict.Add("/Contabilidad2/RepEstadoActividadesSAT.aspx".ToUpper(), 616) - PaginaDict.Add("/Contabilidad2/RepBalanzaComprobacionSAT.aspx".ToUpper(), 617) - PaginaDict.Add("/Contabilidad2/RepAnexoCatalogoSAT.aspx".ToUpper(), 618) + 'PaginaDict.Add("/Contabilidad2/RepSituacionFinancieraSAT.aspx".ToUpper(), 615) + 'PaginaDict.Add("/Contabilidad2/RepEstadoActividadesSAT.aspx".ToUpper(), 616) + 'PaginaDict.Add("/Contabilidad2/RepBalanzaComprobacionSAT.aspx".ToUpper(), 617) + 'PaginaDict.Add("/Contabilidad2/RepAnexoCatalogoSAT.aspx".ToUpper(), 618) PaginaDict.Add("/Contabilidad2/MovimientosConProveedores.aspx".ToUpper(), 619) - PaginaDict.Add("/Contabilidad2/RepBalanceGeneral.aspx".ToUpper(), 530) + 'PaginaDict.Add("/Contabilidad2/RepBalanceGeneral.aspx".ToUpper(), 530) PaginaDict.Add("/Contabilidad2/CatCuentasAsignaciones.aspx".ToUpper(), 724) PaginaDict.Add("/Contabilidad2/CatContaEjercicios.aspx".ToUpper(), 725) PaginaDict.Add("/Contabilidad2/PolizasImpresion.aspx".ToUpper(), 726) @@ -4723,12 +4724,10 @@ Public Class ClsPaginas PaginaDict.Add("/Nomina/Nomina2.aspx".ToUpper(), 75) PaginaDict.Add("/Nomina/ReportedeAcumulados.aspx".ToUpper(), 75) PaginaDict.Add("/Nomina/ListaAsistencias.aspx".ToUpper(), 91) - PaginaDict.Add("/Nomina/ConceptosEspeciales.aspx".ToUpper(), 136) PaginaDict.Add("/Nomina/CatConceptos.aspx".ToUpper(), 172) PaginaDict.Add("/Nomina/ConceptoNomina.aspx".ToUpper(), 172) PaginaDict.Add("/Nomina/RegistroNomina.aspx".ToUpper(), 173) PaginaDict.Add("/Nomina/RepConceptosAcumulados.aspx".ToUpper(), 174) - PaginaDict.Add("/Nomina/RepPersonalAcumulados.aspx".ToUpper(), 393) PaginaDict.Add("/Nomina/CatPeriodos.aspx".ToUpper(), 177) PaginaDict.Add("/Nomina/Finiquito.aspx".ToUpper(), 197) PaginaDict.Add("/Nomina/CatSatBancos.aspx".ToUpper(), 255) diff --git a/App_Code/ClsSisEmpresas.vb b/App_Code/ClsSisEmpresas.vb index 40cc65235..0e5c9d088 100644 --- a/App_Code/ClsSisEmpresas.vb +++ b/App_Code/ClsSisEmpresas.vb @@ -420,20 +420,6 @@ Public Class ClsSisEmpresas _Empresa.IdCuentaIEPSTrasladado = Data.Rows(0)("IdCuentaIEPSTrasladado").ToString.ToEntero _Empresa.IdCuentaOtrosIngresos = Data.Rows(0)("Conta_IdCuentaOtrosIngresos").ToString.ToEntero - 'Contabilidad SIG - _Empresa.CveCuentaIVAxAcreditar = Data.Rows(0)("IdCuentaIVAxAcreditarSIG").ToString.ToEntero - _Empresa.CveCuentaIVAAcreditable = Data.Rows(0)("IdCuentaIVAAcreditableSIG").ToString.ToEntero - _Empresa.CveCuentaIVAxTrasladar = Data.Rows(0)("IdCuentaIVAxTrasladarSIG").ToString.ToEntero - _Empresa.CveCuentaIVATrasladado = Data.Rows(0)("IdCuentaIVATrasladadoSIG").ToString.ToEntero - _Empresa.CveCuentaRetIVACirculacion = Data.Rows(0)("IdCuentaRetIVACirculacionSIG").ToString.ToEntero - _Empresa.CveCuentaRetISRCirculacion = Data.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString.ToEntero - _Empresa.CveCuentaDSV = Data.Rows(0)("IdCuentaDescuentoVentaSIG").ToString.ToEntero - _Empresa.CveCuentaImpuestosLocales = Data.Rows(0)("IdCuentaImpuestosLocalesSIG").ToString.ToEntero - _Empresa.CveCuentaIEPSxAcreditar = Data.Rows(0)("IdCuentaIEPSxAcreditarSIG").ToString.ToEntero - _Empresa.CveCuentaIEPSAcreditable = Data.Rows(0)("IdCuentaIEPSAcreditableSIG").ToString.ToEntero - _Empresa.CveCuentaIEPSxTrasladar = Data.Rows(0)("IdCuentaIEPSxTrasladarSIG").ToString.ToEntero - _Empresa.CveCuentaIEPSTrasladado = Data.Rows(0)("IdCuentaIEPSTrasladadoSIG").ToString.ToEntero - '_Empresa.IdCtaProveedor = Data.Rows(0)("IdCtaProveedor").ToString.ToEntero '_Empresa.IdCtaCliente = Data.Rows(0)("IdCtaCliente").ToString.ToEntero '_Empresa.IdCtaDeudores = Data.Rows(0)("IdCtaDeudores").ToString.ToEntero diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index b485575cc..d2d08206d 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -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, Optional RFCReceptor As String = "", Optional Adjunto As String = "-1") 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 = "", Optional Adjunto As String = "-1", Optional DevolucionImportePagado As Decimal = 0) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_VentasAdd") @@ -438,6 +438,8 @@ Public Class ClsVentas .Add("@RFCReceptor", SqlDbType.VarChar).Value = RFCReceptor .Add("@Adjunto", SqlDbType.VarChar).Value = Adjunto + .Add("@DevolucionImportePagado", SqlDbType.Money).Value = DevolucionImportePagado + .Add("@RETURN_VALUE", SqlDbType.Int).Direction = ParameterDirection.ReturnValue End With 'SqlTypes.SqlDateTime.Null @@ -5018,7 +5020,41 @@ Public Class ClsVentas Return Retorno End Function + Public Function GetRNCRelacionadas(CveVenta As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_RNCRelacionadasGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener las ventas con usados.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function RemoveRNCFacturada(CveVentaNC As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_RNCRelacionadasRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveVentaNC", SqlDbType.Int).Value = CveVentaNC + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar las RNC Relacionadas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function #End Region diff --git a/App_Code/DtDatos.xsd b/App_Code/DtDatos.xsd index edcd0cb6f..72637b923 100644 --- a/App_Code/DtDatos.xsd +++ b/App_Code/DtDatos.xsd @@ -9,10 +9,10 @@ - + - + @@ -28,7 +28,7 @@ - + @@ -46,7 +46,7 @@ - + @@ -61,11 +61,12 @@ - + + - + @@ -88,7 +89,7 @@ - + @@ -112,7 +113,7 @@ - + @@ -138,7 +139,7 @@ - + @@ -154,7 +155,7 @@ - + @@ -171,7 +172,7 @@ - + @@ -180,7 +181,7 @@ - + @@ -216,7 +217,7 @@ - + @@ -241,7 +242,7 @@ - + @@ -257,7 +258,7 @@ - + @@ -296,7 +297,7 @@ - + @@ -306,7 +307,7 @@ - + diff --git a/App_Code/DtDatos.xss b/App_Code/DtDatos.xss index e18bb1b5a..325b31061 100644 --- a/App_Code/DtDatos.xss +++ b/App_Code/DtDatos.xss @@ -1,26 +1,26 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/App_Code/Empresa.vb b/App_Code/Empresa.vb index e445ab25d..3e8120dd8 100644 --- a/App_Code/Empresa.vb +++ b/App_Code/Empresa.vb @@ -108,12 +108,7 @@ Public Class Empresa Public Property IdCuentaIVAxTrasladar As Integer Public Property IdCuentaIVATrasladado As Integer Public Property IdCuentaPerdidaCambiaria As Integer - Public Property IdCuentaGananciaCambiaria As Integer - Public Property CveCuentaIVAxTrasladar As Integer - Public Property CveCuentaIVATrasladado As Integer - Public Property CveCuentaPerdidaCambiaria As Integer - Public Property CveCuentaGananciaCambiaria As Integer - + Public Property IdCuentaGananciaCambiaria As Integer Public Property ContaContabilizacionNC As Integer Public Property PV_TerminalTipo As Integer Public Property PlantillaMailVenta As String @@ -132,20 +127,9 @@ Public Class Empresa Public Property IdCtaAcreedores As Integer Public Property IdCtaDocXPagar As Integer Public Property IdCtaAnticipoCliente As Integer - Public Property IdCtaAnticipoProveedores As Integer - - Public Property CveCuentaIVAxAcreditar As Integer - Public Property CveCuentaIVAAcreditable As Integer - Public Property CveCuentaRetIVACirculacion As Integer - Public Property CveCuentaRetISRCirculacion As Integer - Public Property CveCuentaDSV As Integer - Public Property CveCuentaImpuestosLocales As Integer - Public Property CveCuentaIEPSxAcreditar As Integer - Public Property CveCuentaIEPSAcreditable As Integer - Public Property CveCuentaIEPSxTrasladar As Integer - Public Property CveCuentaIEPSTrasladado As Integer - - 'Nuevos Datos + Public Property IdCtaAnticipoProveedores As Integer + + 'Nuevos Datos Public Property IdCuentaIEPSxAcreditar As Integer Public Property IdCuentaIEPSAcreditable As Integer Public Property IdCuentaIEPSxTrasladar As Integer diff --git a/App_Code/LogicNominas.vb b/App_Code/LogicNominas.vb index 49432dc6c..8762937db 100644 --- a/App_Code/LogicNominas.vb +++ b/App_Code/LogicNominas.vb @@ -383,7 +383,7 @@ Public Class LogicNominas If DtOtrosPagos IsNot Nothing AndAlso DtOtrosPagos.Rows.Count > 0 Then For Each Row As DataRow In DtOtrosPagos.Rows - If (Row("Importe").ToString().ToDecimal() > 0) OrElse + If (Row("Importe").ToString().ToDecimal() <> 0) OrElse (Row("SATCveConcepto").ToString().ToEntero() = 2 AndAlso (CveRegimenContratacion.ToEntero() = 2 OrElse Row("Importe").ToString().ToDecimal() <> 0)) OrElse (Row("SATCveConcepto").ToString().ToEntero().Contiene(2, 4) AndAlso Row("Importe").ToString().ToDecimal() < 0) Then diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index a47720df8..afc155043 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -2268,7 +2268,6 @@ Namespace Modelos Dim FechaMovimiento As Date = ObjFactura.Fecha Dim IdCtaContable As Integer Dim IdCtaContableCliente As Integer - Dim CveCuentaCliente As Integer Dim Concepto As String = ObjFactura.SerieFolio Dim Referencia As String = ObjFactura.SerieFolio Dim Fecha = ObjFactura.Fecha @@ -2282,8 +2281,6 @@ Namespace Modelos Dim CveSubProyectoContabilizar As Integer Dim IdCtaIVAXTrasladar As Integer = 0 Dim IdCtaIVATrasladado As Integer = 0 - Dim CveCuentaIVAxTrasladar As Integer = 0 - Dim CveCuentaIVATrasladado As Integer = 0 Dim SeContabiliza As Boolean = True If (UsuarioActual.Empresa.Funcionalidad(343) = "1" AndAlso ObjFactura.TipoDocto = "Ant") Then @@ -2471,7 +2468,6 @@ Namespace Modelos End If IdCtaContable = ObjFactura.Cliente.IdCtaContMonedaExtranjera - 'CveCuenta = ObjFactura.Cliente.CveCuentaMonedaExtranjera End If CveSubProyectoContabilizar = CveSubProyectoVenta ImporteConcepto12 = importeMX.RoundSQL @@ -2847,7 +2843,6 @@ Namespace Modelos 'CTACONTABLE 'IdCtaContable = IdCtaContAnticipos - 'CveCuenta = CveCuentaAnticipos If tipoCambio = 1 Then IdCtaContable = ObjFactura.Cliente.IdCtaContClientes @@ -2967,6 +2962,85 @@ Namespace Modelos End If Next End If + + If UsuarioActual.Empresa.Funcionalidad(344) = "1" AndAlso ObjFactura.TipoDocto = "Egs" Then + Dim ListaNC As List(Of Modelos.Factura) = New List(Of Factura) + Dim DtRNCRelacionas As DataTable = Nothing + + If ObjVentas.GetRNCRelacionadas(CveVenta) Then + DtRNCRelacionas = ObjVentas.DtResultados.Copy + End If + + If DtRNCRelacionas IsNot Nothing Then + For Each RowRNC As DataRow In DtRNCRelacionas.Rows + ListaNC.Add(New Modelos.Factura(UsuarioActual, RowRNC("CveVenta").ToString().ToEntero(), UsuarioActual.CveEmpresa) With {.TotalRemNCAplicado = RowRNC("ImporteAplicado").ToString().ToDecimal()}) + Next + End If + + If ListaNC IsNot Nothing Then + For Each ObjRNC As Modelos.Factura In ListaNC + If ObjRNC.TipoDocto = "RNC" Then + importeMovimiento = ObjRNC.TotalRemNCAplicado + importeMX = importeMovimiento * tipoCambio * Multiplicador + FechaMovimiento = ObjFactura.FechaPago + CveSubProyectoContabilizar = CveSubProyectoVenta + If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" + + If tipoCambio = 1 Then + IdCtaContable = ObjFactura.Cliente.IdCtaContClientes + Else + IdCtaContable = ObjFactura.Cliente.IdCtaContMonedaExtranjera + End If + + IdCtaContableCliente = IdCtaContable + + Dim CveMovimiento As Integer = -1 + Dim CveAlmacen As Integer = -1 + + If ObjInventario IsNot Nothing AndAlso ObjInventario.GetInv_Mov(ObjRNC.CveVenta, UsuarioActual.CveEmpresa) Then + CveMovimiento = ObjInventario.DtResultados.FiltroPrimeroValor("CveMovimiento", "CvePS IS NULL AND CveConcepto = 42").ToEntero() + CveAlmacen = ObjInventario.DtResultados.FiltroPrimeroValor("CveAlmacen", "CvePS IS NULL AND CveConcepto = 42").ToEntero() + End If + + 'VERIFICA SI TIENE MOVIMIENTO DE ENTRADA DE USADO + If CveMovimiento > 0 AndAlso CveAlmacen > 0 Then + + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 277, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjRNC.CveVenta, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then + ErrorPrepoliza = True + End If + + Dim SubTotalCalculado As Decimal = (importeMovimiento / (1D + ObjRNC.PorcentajeIVA)).ToDecimal + + Dim Importe318 As Decimal = (SubTotalCalculado * ObjRNC.PorcentajeIVA).RoundSQL(2).ToDecimal() + + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, Importe318, Referencia, 318, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjRNC.CveVenta, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=Importe318, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then + ErrorPrepoliza = True + End If + + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, SubTotalCalculado, Referencia, 150, Concepto, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=ObjRNC.CveVenta, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, CveClasificacion:=ObjRNC.DtDetalle.MAX("CveClasificacion").ToEntero(), CveSubProyecto:=ObjRNC.CveSubProyecto, ImporteMX:=SubTotalCalculado, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, Contabilizable:=False) Then + ErrorPrepoliza = True + End If + + Else + If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 277, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjRNC.CveVenta, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 278, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjRNC.CveVenta, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then + ErrorPrepoliza = True + End If + Else + ErrorPrepoliza = True + End If + End If + + importeMovimiento = 0 + End If + Next + + If Not ObjVentas.RemoveRNCFacturada(CveVenta) Then + ErrorPrepoliza = True + End If + + End If + End If Else If ObjFactura.DtAnticipos IsNot Nothing Then For Each row2 As DataRow In ObjFactura.DtAnticipos.Rows @@ -2996,7 +3070,7 @@ Namespace Modelos End If If sumaAmorticaciones <> 0 Then If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, sumaAmorticaciones, Referencia, 251, Concepto, FechaMovimiento, - ObjFactura.Cliente.IdCtaContClientes, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=sumaAmorticaciones * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaCliente, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then + ObjFactura.Cliente.IdCtaContClientes, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=sumaAmorticaciones * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then ErrorPrepoliza = True Else ObjFactura.SeGuardoPrePoliza = True @@ -3052,9 +3126,6 @@ Namespace Modelos IdCtaContable = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaIngresos", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero End If - - 'CveCuenta = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaIngresosSIG", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero - If importeMovimiento <> 0 Then If IdCtaContable <= 0 Then @@ -3135,8 +3206,6 @@ Namespace Modelos If Row2("CveClasificacion").ToString = "19929" Then IdCtaContable = 1142 End If - 'CveCuenta = GlobalDTClasificaciones(ObjFactura.CveEmpresa).FiltroPrimeroValor("IdCuentaIngresosSIG", String.Format("CveClasificacion = {0}", Row2("CveClasificacion"))).ToEntero - If importeMovimiento <> 0 Then If IdCtaContable <= 0 Then @@ -3144,10 +3213,6 @@ Namespace Modelos idCuentaContabilizacion = 0 End If - 'If CveCuenta <= 0 Then - ' CuentasContablesInvalidasSIG.Append("
" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString + GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString}")) - ' CveCuentaContabilizacion = 0 - 'End If If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContableAplicar, Concepto, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVentaAplicar, CveVentaAmortizacion:=CveVentaAmortizacionAplicar, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, CveClasificacion:=Row2("CveClasificacion").ToString.ToEntero, CveSubProyecto:=Row2("CveSubProyecto").ToString.ToEntero, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, PorcentajeImpuesto:=Row2("PorcentajeIVA").ToString().ToDecimal) Then ErrorPrepoliza = True @@ -3171,7 +3236,6 @@ Namespace Modelos If importeMovimiento <> 0 AndAlso ObjConta.GetRetCuenta(ConceptoContable, ObjFactura.CveEmpresa) Then If ObjConta.DtResultados.Rows.Count > 0 Then IdCtaContable = ObjConta.DtResultados.Rows(0)("Conta_IdCuentaDescuentoVenta").ToString().ToEntero() - 'CveCuenta = ObjConta.DtResultados.Rows(0)("Conta_IdCuentaDescuentoVenta").ToString().ToEntero() End If End If @@ -3334,20 +3398,18 @@ Namespace Modelos ' If importeMovimiento <> 0 Then ' 'IVA X TRASLADAR ' IdCtaIVAXTrasladar = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar) - ' CveCuentaIVAxTrasladar = If(CveCuentaIVAxTrasladar > 0, CveCuentaIVAxTrasladar, UsuarioActual.Empresa.CveCuentaIVAxTrasladar) ' Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 13, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString()) - ' If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 13, Concepto, Fecha, IdCtaIVAXTrasladar, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=-1, ImporteMX:=importeMX * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaIVAxTrasladar, CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuesto) Then + ' If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 13, Concepto, Fecha, IdCtaIVAXTrasladar, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=-1, ImporteMX:=importeMX * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuesto) Then ' ErrorPrepoliza = True ' Exit For ' End If ' 'IVA PAGADO ' IdCtaIVATrasladado = If(IdCtaIVATrasladado > 0, IdCtaIVATrasladado, UsuarioActual.Empresa.IdCuentaIVATrasladado) - ' CveCuentaIVATrasladado = If(CveCuentaIVATrasladado > 0, CveCuentaIVATrasladado, UsuarioActual.Empresa.CveCuentaIVATrasladado) ' Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 61, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString()) - ' If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 61, Concepto, Fecha, IdCtaIVATrasladado, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=-1, ImporteMX:=importeMX * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaIVATrasladado, CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuesto) Then + ' If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 61, Concepto, Fecha, IdCtaIVATrasladado, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=-1, ImporteMX:=importeMX * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuesto) Then ' ErrorPrepoliza = True ' Exit For ' End If @@ -3437,7 +3499,6 @@ Namespace Modelos If GlobalDTBancosCuentas(UsuarioActual.CveUsuario, DrPago("CveCuenta").ToString.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows.Count = 1 Then IdCtaContable = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, DrPago("CveCuenta").ToString.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)("IdCtaContable").ToString.ToEntero - ' CveCuenta = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, DrPago("CveCuenta").ToString.ToEntero).Rows(0)("IdCtaContableSIG").ToString.ToEntero End If If IdCtaContable <= 0 Then @@ -3445,11 +3506,6 @@ Namespace Modelos idCuentaContabilizacion = 0 End If - 'If CveCuenta <= 0 Then - ' CuentasContablesInvalidasSIG.AppendFormat("
{0}", GlobalDTBancosCuentas(UsuarioActual.CveUsuario, DrPago("CveCuenta").ToString.ToEntero).Rows(0)("NumCuentaMoneda").ToString.ToEntero) - ' CveCuentaContabilizacion = 0 - 'End If - 'BANCOS Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 30, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString) If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, Fecha, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento)) Then @@ -3459,39 +3515,37 @@ Namespace Modelos 'CLIENTES Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 2, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString) - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 2, Concepto, Fecha, IdCtaContableCliente, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaCliente, CveSubProyecto:=CveSubProyectoContabilizar) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 2, Concepto, Fecha, IdCtaContableCliente, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then ErrorPrepoliza = True Exit For End If 'IVA X TRASLADAR IdCtaIVAXTrasladar = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar) - CveCuentaIVAxTrasladar = If(CveCuentaIVAxTrasladar > 0, CveCuentaIVAxTrasladar, UsuarioActual.Empresa.CveCuentaIVAxTrasladar) Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 13, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString) - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, (importeMovimiento * ObjFactura.IVA) / ObjFactura.Total, Referencia, 13, Concepto, Fecha, IdCtaIVAXTrasladar, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IVA) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaIVAxTrasladar, CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, (importeMovimiento * ObjFactura.IVA) / ObjFactura.Total, Referencia, 13, Concepto, Fecha, IdCtaIVAXTrasladar, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IVA) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then ErrorPrepoliza = True Exit For End If 'IVA PAGADO IdCtaIVATrasladado = If(IdCtaIVATrasladado > 0, IdCtaIVATrasladado, UsuarioActual.Empresa.IdCuentaIVATrasladado) - CveCuentaIVATrasladado = If(CveCuentaIVATrasladado > 0, CveCuentaIVATrasladado, UsuarioActual.Empresa.CveCuentaIVATrasladado) Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 61, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString) - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, (importeMovimiento * ObjFactura.IVA) / ObjFactura.Total, Referencia, 61, Concepto, Fecha, IdCtaIVATrasladado, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IVA) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaIVATrasladado, CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, (importeMovimiento * ObjFactura.IVA) / ObjFactura.Total, Referencia, 61, Concepto, Fecha, IdCtaIVATrasladado, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IVA) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then ErrorPrepoliza = True Exit For End If 'IEPS X TRASLADAR Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 38, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString) - If ObjFactura.IEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, (importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total, Referencia, 38, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSxTrasladar, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=UsuarioActual.Empresa.CveCuentaIEPSxTrasladar, CveSubProyecto:=CveSubProyectoContabilizar) Then + If ObjFactura.IEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, (importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total, Referencia, 38, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSxTrasladar, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then ErrorPrepoliza = True Exit For End If 'IEPS PAGADO Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 39, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString) - If ObjFactura.IEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, (importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total, Referencia, 39, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSTrasladado, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=UsuarioActual.Empresa.CveCuentaIEPSTrasladado, CveSubProyecto:=CveSubProyectoContabilizar) Then + If ObjFactura.IEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, (importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total, Referencia, 39, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSTrasladado, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then ErrorPrepoliza = True Exit For End If @@ -3515,11 +3569,6 @@ Namespace Modelos idCuentaContabilizacion = 0 End If - 'If CveCuenta <= 0 Then - ' CuentasContablesInvalidasSIG.Append("
" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) - ' CveCuentaContabilizacion = 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), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuesto, TipoCambio:=tipoCambio, Contabilizable:=SeContabiliza) Then ErrorPrepoliza = True Else @@ -3966,13 +4015,11 @@ Namespace Modelos Dim DtCostos = ObjInventario.DtResultados.Copy Dim DtCostosDistinct As DataTable = ObjInventario.DtResultados.FiltraParametros("", "", {"CveClasificacion"}) Dim IdCtaContable As Integer = 0 - Dim CveCuenta As Integer = 0 Dim ValorInventario As Decimal For Each RowInv As DataRow In DtCostosDistinct.Rows ValorInventario = DtCostos.SUM("Total", String.Format("CveClasificacion = {0}", RowInv("CveClasificacion"))).ToString.ToDecimal IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero - CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero Try If ValorInventario <> 0 Then If Not ObjConta.AddPrePolizasDetalle(Me.CvePrePoliza, False, ValorInventario, Me.SerieFolio, 69, Me.SerieFolio, Me.Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=Me.CveCliente, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario, CveSubProyecto:=Me.CveSubProyecto) Then @@ -3998,7 +4045,6 @@ Namespace Modelos End If End If - 'VALIDA QUE SE HALLAN AGREGADO DETALLES AL MOVIMIENTO If ContadorMovtosDetalles = 0 Then OcurrioError = True @@ -4008,8 +4054,6 @@ Namespace Modelos OcurrioError = True End If - - If OcurrioError Then Return -1 Else @@ -4121,7 +4165,6 @@ Namespace Modelos TotalCosto = DtCostos.SUMD("Total").RoundSQL Dim tmpCostos As DataTable = DtCostos.FiltraParametros("", "", {"CveClasificacion"}) Dim IdCtaContable As Integer = 0 - Dim CveCuenta As Integer = 0 If tmpCostos.Rows.Count > 0 Then Dim TotalCostoAcumulado As Decimal = 0 Dim cont As Integer = 1 @@ -4137,10 +4180,9 @@ Namespace Modelos 'Concepto = String.Format("{0} - {1}", Row2("Clasificacion").ToString(), Row2("SubProyecto").ToString()) IdCtaContable = GlobalDTClasificaciones(factura.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero() - 'CveCuenta = GlobalDTClasificaciones(factura.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero() 'If ValorInventario <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, TipoMovto69, ValorInventario, factura.SerieFolio, 69, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveSubProyecto:=factura.CveSubProyecto, CveClasificacion:=RowInv("CveClasificacion").ToString().ToEntero(), CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta) Then + If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, TipoMovto69, ValorInventario, factura.SerieFolio, 69, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveSubProyecto:=factura.CveSubProyecto, CveClasificacion:=RowInv("CveClasificacion").ToString().ToEntero(), CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario) Then OcurrioError = True End If 'End If @@ -4262,7 +4304,6 @@ Namespace Modelos TotalCosto = DtCostos.SUMD("Total").RoundSQL Dim tmpCostos As DataTable = DtCostos.FiltraParametros("", "", {"CveClasificacion"}) Dim IdCtaContable As Integer = 0 - Dim CveCuenta As Integer = 0 If tmpCostos.Rows.Count > 0 Then Dim TotalCostoAcumulado As Decimal = 0 Dim cont As Integer = 1 @@ -4278,10 +4319,9 @@ Namespace Modelos 'Concepto = String.Format("{0} - {1}", Row2("Clasificacion").ToString(), Row2("SubProyecto").ToString()) IdCtaContable = GlobalDTClasificaciones(factura.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero() - 'CveCuenta = GlobalDTClasificaciones(factura.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero() 'If ValorInventario <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, TipoMovto69, ValorInventario, factura.SerieFolio, 69, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveSubProyecto:=factura.CveSubProyecto, CveClasificacion:=RowInv("CveClasificacion").ToString().ToEntero(), CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta) Then + If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, TipoMovto69, ValorInventario, factura.SerieFolio, 69, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveSubProyecto:=factura.CveSubProyecto, CveClasificacion:=RowInv("CveClasificacion").ToString().ToEntero(), CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario) Then OcurrioError = True End If 'End If @@ -4347,7 +4387,7 @@ Namespace Modelos If factura.DtImpuestosLocales IsNot Nothing AndAlso factura.CvePrePoliza > 0 AndAlso Not factura.TipoDocto.Contiene("Cot", "Rem") Then Dim Importe As Decimal - Dim IdCtaContable, CveCuenta As Integer + Dim IdCtaContable As Integer Dim Concepto As String Dim tipoCambio As Decimal Dim CveSubProyectoContabilizar As Integer = factura.CveSubProyecto @@ -4357,7 +4397,6 @@ Namespace Modelos Importe = RowIL("Importe").ToString.ToDecimal * ValorMultiplicador IdCtaContable = RowIL("IdCtaContable").ToString.ToEntero - CveCuenta = RowIL("IdCtaContable").ToString.ToEntero Concepto = factura.SerieFolio If factura.CveMoneda = 2 AndAlso factura.TipoCambio > 0 Then @@ -4950,7 +4989,7 @@ Namespace Modelos 'CANCELA PREPOLIZA If Not ErrorCancelar Then ErrorCancelar = ProcesoPrepolizas(ObjFactura, ObjConta, -1, ObjFactura.DtDetalle, ObjAC, -1, ObjBancos, ObjVentas, ObjEventos, DtRemisionesRelacionadas:=DtRemisionesRelacionadas, SeCancelaRemisionProceso:=SeCancelaRemisionProceso, - CancelarRemisiones:=CancelarRemisiones, ListaRemisionesCancelar:=ListaRemisionesCancelar, CveEstatusRefacturacion:=CveEstatusRefacturacion) + CancelarRemisiones:=CancelarRemisiones, ListaRemisionesCancelar:=ListaRemisionesCancelar, CveEstatusRefacturacion:=CveEstatusRefacturacion, ObjInventario:=ObjInventario) MensajeError = "Ocurrió un error al generar la prepoliza de cancelación." End If @@ -5107,9 +5146,7 @@ Namespace Modelos Dim tmpCostos As DataTable = DtCostos.FiltraParametros("", "", {"CveClasificacion"}) Dim IdCtaContableAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", $"CveAlmacen = {CveAlmacenMovimiento}").ToEntero - 'Dim CveCuentaAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContableSIG", $"CveAlmacen = {CveAlmacenDevolucion}").ToEntero Dim IdCtaContable As Integer = 0 - Dim CveCuenta As Integer = 0 If tmpCostos.Rows.Count > 0 Then Dim Multiplicador As Decimal = -1D @@ -6133,6 +6170,8 @@ Namespace Modelos Public Property CveDireccionEnvio As Integer Public Property RefacturacionGeneroNC As Boolean = False Public Property Pagado As Decimal + Public Property PagadoBancos As Decimal + Public Property PagadoCveIE As Integer Public Property DescuentoProntoPago As Decimal Public Property CveVentaRNCCargo As Integer Public Property FacturarSucursal As Boolean = False @@ -6503,6 +6542,7 @@ Namespace Modelos Public Property FordGSDB As String = "" Public Property FordASN As String = "" Public Property FemsaFactura As Modelos.FemsaFactura + Public Property DevolucionImportePagado As Decimal = 0 Public Sub SetSubProyecto() If CveSubProyecto > 0 AndAlso UsuarioActual IsNot Nothing Then @@ -7735,24 +7775,6 @@ Namespace Modelos End Property - 'Property GlobalDTBancosCuentas(CveUsuario As Integer, Optional CveCuenta As Integer = -1, Optional Estatus As Integer = 1) As DataTable - ' Get - - ' Dim Str As String = String.Format("CveEmpresa = {0} ", UsuarioActual.CveEmpresa) - ' If CveUsuario > -1 Then Str = String.Format("{0} AND CveUsuario = {1}", Str, CveUsuario) - ' If CveCuenta > -1 Then Str = String.Format("{0} AND CveCuenta = {1}", Str, CveCuenta) - ' If Estatus > -1 Then Str = String.Format("{0} AND Estatus = '{1}'", Str, If(Estatus = 1, "Activo", "Inactivo")) - - ' Dim Dv As New DataView(DirectCast(HttpContext.Current.Application("GlobalDTBancosCuentas"), DataTable), Str, "", DataViewRowState.CurrentRows) - ' GlobalDTBancosCuentas = Dv.ToTable - ' Dv.Dispose() - ' 'GlobalDTBancosCuentas = DirectCast(HttpContext.Current.Application("GlobalDTBancosCuentas"), DataTable) - ' End Get - ' Set(value As DataTable) - ' HttpContext.Current.Application("GlobalDTBancosCuentas") = value - ' End Set - 'End Property - Property GlobalDTBancosCuentas(CveUsuario As Integer, Optional CveCuenta As Integer = -1, Optional Estatus As Integer = 1, Optional CveEmpresa As Integer = -1) As DataTable Get Dim AppNombre As String = String.Format("GlobalDTBancosCuentas-{0}", CveEmpresa) @@ -9846,12 +9868,6 @@ Namespace Modelos Public Property IdCtaContAnticipos As Integer Public Property IdCtaContRetIVA As Integer Public Property IdCtaContRetISR As Integer - Public Property CveCuentaClientes As Integer - Public Property CveCuentaMonedaExtranjera As Integer - Public Property CveCuentaComplementaria As Integer - Public Property CveCuentaAnticipos As Integer - Public Property CveCuentaRetIVA As Integer - Public Property CveCuentaRetISR As Integer Public Property ConvenioCIE As String Public Property FormaFacturacion As String Public Property LimiteCredito As Decimal diff --git a/App_Code/Timbrado.vb b/App_Code/Timbrado.vb index 3b94f4849..2c1587881 100644 --- a/App_Code/Timbrado.vb +++ b/App_Code/Timbrado.vb @@ -810,6 +810,23 @@ Public Class Timbrado Dim tCvePAC As Integer = UsuarioActual.Empresa.CvePAC If CvePACEspecial <> -1 Then tCvePAC = CvePACEspecial + 'validación especial. + If Ventas.TipoDocto.Contiene("Ing", "Dev") Then + + Dim CodigoIncorrecto = (From c In Ventas.Timbre.Conceptos Where (c.ClaveProdServ = "01010101") OrElse (c.ClaveProdServ = "84111506" AndAlso Not UsuarioActual.CveEmpresa.Contiene(2, 70)) + Select c.ClaveProdServ, c.Descripcion) + Dim Str As New StringBuilder + Str.Append("Los siguentes productos tienen especificado un código no permitido por el SAT:
") + For Each dr In CodigoIncorrecto + Str.AppendFormat(" - {0}
", dr.Descripcion) + Next + If CodigoIncorrecto.Count > 0 Then + MensajeErrorCFDI = Str.ToString + Return False + End If + + End If + Select Case tCvePAC Case 1 ' Retorno = TimbrarFacturaBIInform33(UsuarioActual, Ventas, FM, TmpDTConceptos, TmpDTImpuestos, TmpDT7Eleven, TmpDTComplementos, Ruta, LstFordASN, FordGSDBM, ObjV) diff --git a/App_Code/modExtensiones.vb b/App_Code/modExtensiones.vb index 24e6e11b6..d6e6e324a 100644 --- a/App_Code/modExtensiones.vb +++ b/App_Code/modExtensiones.vb @@ -1777,7 +1777,7 @@ Namespace Extensiones 'Dim UsuarioResponsable As String = "" Dim PreP As New ClsContabilidad - If PreP.GetPrePolizasDetalle(-1, pCveIE) Then + If PreP.GetPrePolizasDetalle(-1, tCveEmpresa, CveIE:=pCveIE) Then If PreP.DtResultados.Rows.Count > 0 Then CveProveedor = PreP.DtResultados.Rows(0)("CveProveedor").ToString.ToEntero CvePersonal = PreP.DtResultados.Rows(0)("CvePersonal").ToString.ToEntero diff --git a/Ashx/E48.ashx b/Ashx/E48.ashx new file mode 100644 index 000000000..ad1fdc507 --- /dev/null +++ b/Ashx/E48.ashx @@ -0,0 +1,479 @@ +<%@ WebHandler Language="VB" Class="E48" %> + +Imports System +Imports System.Web +Imports System.Data +Imports Newtonsoft.Json +Imports Extensiones +Imports System.IO +Imports System.Net.Http +Imports Newtonsoft.Json.Linq + +Public Class E48 : Implements IHttpHandler, IRequiresSessionState + Private ReadOnly Property CveEmpresa As Integer = 48 + + Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable + Get + Return False + End Get + End Property + + Public ReadOnly Property Application As HttpApplicationState + + Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest + + Try + Select Case context.Request("metodo") + Case "Salida" + Salida(context) + End Select + Catch ex As Exception + ex.GuardaLog(ex.Message) + End Try + End Sub + + Private Function Salida(ByVal context As HttpContext) As String + Dim retorno As String = "" + Dim ObjInv As New ClsInventarios + Dim Respuesta As New FidelityAppsResponse + Dim RespuestaError As New FidelityAppsResponseError + Dim TieneError As Boolean = False + Dim JsonRequest As JObject = Nothing + Dim UsuarioActual As Usuario = ValidaUsuarioSistema(100, CveEmpresa) + Dim ObjInventario As New ClsInventarios + Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL()) + Dim CveMovimiento As Integer = 0 + Dim Mensaje As String = "" + Dim SinExistencia As String = "No hay existencias suficientes del producto: " + + Dim ErrorAC As Boolean = False + Dim ErrorMovInv As Boolean = False + + If context.Request.InputStream IsNot Nothing Then + Using reader As New StreamReader(context.Request.InputStream) + Dim json = reader.ReadToEnd + + If Not String.IsNullOrEmpty(json) Then + JsonRequest = JObject.Parse(json) + If JsonRequest Is Nothing Then + TieneError = True + End If + Else + TieneError = True + End If + + End Using + End If + If TieneError Then + RespuestaError.Message = "Ocurrió un error al obtener el cuerpo de los parametros" + End If + + If Not TieneError AndAlso Not String.IsNullOrEmpty(JsonRequest("fecha")) AndAlso Not String.IsNullOrEmpty(JsonRequest("usuario")) AndAlso Not String.IsNullOrEmpty(JsonRequest("almacen")) AndAlso Not String.IsNullOrEmpty(JsonRequest("entrega")) AndAlso + Not String.IsNullOrEmpty(JsonRequest("observaciones")) AndAlso Not String.IsNullOrEmpty(JsonRequest("productos")) Then + Dim Inv As New ClsInventarios + Dim ObjProductosServicios As New ClsProductosServicios() + Dim ObjContaAC As ClsContPAQi = Nothing + Dim tFolio As Integer = Inv.GetFolioSiguiente(3, CveEmpresa) + Dim observaciones As String = JsonRequest("observaciones").ToString() + Dim CveAlmacen As Integer = 7 + Dim IDPoliza As Integer = 0 + + Dim Fecha As Date = JsonRequest("fecha").ToString().ToDate + Dim usuario As String = JsonRequest("usuario").ToString() + Dim almacen As String = JsonRequest("almacen").ToString() + Dim Recibe As String = JsonRequest("entrega").ToString() + Dim GlobalDTInvConceptos As DataTable + Dim CveModalidad As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=CveAlmacen).FiltroPrimeroValor("CveModalidad").ToEntero() + + Dim EsContabilizable As Boolean = (CveModalidad = 1) + If Inv.GetConceptos Then GlobalDTInvConceptos = Inv.DtResultados Else GlobalDTInvConceptos = Nothing + Try + + Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("ASHX/E48", 53, 0, 0, 1, Fecha, observaciones, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=3) + CveMovimiento = ObjInventario.AddMovimiento(CveAlmacen, 3, 1, Fecha, tFolio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=observaciones, Recibio:=Recibe, Modulo:="ASHX/E48") + + If CveMovimiento <= 0 OrElse CvePrePoliza <= 0 Then + RespuestaError.Message = "No se pudo almacenar el movimiento correctamente" + TieneError = True + ObjInventario.RollBack() 'deshace lo insertado + Else + + End If + + ''VALIDA EXISTENCIAS + Dim Cont As Integer = 0 + Dim ListaPS = JArray.Parse(JsonRequest("productos").ToString()) + + For Each JsonPS As JObject In ListaPS + + Dim Cantidad As Double = JsonPS("cantidad").ToString.ToDouble() + Dim CvePS As Integer = GlobalDTPSSimplificado(Codigo:=JsonPS("codigo").ToString()).FiltroPrimeroValor("CvePS").ToEntero() + Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") + Dim CveUM As Integer + If ObjProductosServicios.GetPS(CvePS, -1, CveEmpresa) Then + If ObjProductosServicios.DtResultados.Rows.Count > 0 Then + CveUM = ObjProductosServicios.CveUnidadMedida.ToString.ToEntero + End If + End If + If ObjInventario.GetExistenciasPS(CvePS, CveUM, CveEmpresa, CveAlmacen, FechaMovto:=String.Format("{0} 00:00", Fecha.ToString("yyyy/MM/dd"))) >= Cantidad Then + + If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Cantidad, CveUM, CvePS, 0, Observaciones:=observaciones, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then + Mensaje = "Error al guardar los movimientos" + RespuestaError.Message = Mensaje + + ErrorMovInv = True + Exit For + End If + Else + If UsuarioActual.TienePermisoProceso(114) Then + If ObjInventario.GetExistenciasPS(CvePS, CveUM, CveEmpresa, CveAlmacen, FechaMovto:=String.Format("{0} 00:00", Fecha.ToString("yyyy/MM/dd"))) >= Cantidad Then + Mensaje = "Error al guardar los movimientos" + RespuestaError.Message = Mensaje + ErrorMovInv = True + Exit For + End If + Else + SinExistencia += String.Format("{0}, ", JsonPS("codigo").ToString()) + RespuestaError.Message = SinExistencia + ErrorMovInv = True : Exit For + End If + + End If + Cont += 1 + Next + 'Registro la prepóliza + If Not ErrorMovInv AndAlso ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then + Dim tValorInventario As Decimal = ObjInventario.DtResultados.SUMD("Total", "").RoundSQL() + Dim tValorOtro As Decimal = tValorInventario + Dim idCtaContable As Integer = 0 + Dim IdCtaContableOtro As Integer = UsuarioActual.Empresa.IdCuentaOtrosIngresos + Dim TipoMovtoAlmacen As Boolean = False + Dim TipoMovtoOtro As Boolean = True + Dim tCveSubProyecto As Integer = -1 + + Dim drA2 As DataRow = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveAlmacen = {0}", CveAlmacen)) + If drA2 IsNot Nothing Then + idCtaContable = drA2("IdCtaContable").ToString.ToEntero + tCveSubProyecto = drA2("CveSubProyecto").ToString.ToEntero + End If + + + + Dim OrigenMov As Integer = GlobalDTInvConceptos.FiltroPrimeroValor("Origen", "CveConcepto = " & 3).ToEntero + If OrigenMov = 1 Then TipoMovtoAlmacen = False Else TipoMovtoAlmacen = True + TipoMovtoOtro = Not TipoMovtoAlmacen + + Dim CveConceptoContable As Integer = 78 + Dim CveClasificacion As Integer = -1 + + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoAlmacen, tValorInventario, observaciones, 68, observaciones, Fecha, idCtaContable, -1, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=tValorInventario, CveClasificacion:=CveClasificacion, Contabilizable:=EsContabilizable) Then + ErrorMovInv = True + Else + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoOtro, tValorOtro, observaciones, CveConceptoContable, observaciones, Fecha, IdCtaContableOtro, -1, CveMovimientoAlmacen:=CveMovimiento, ImporteMX:=tValorOtro, CveSubProyecto:=tCveSubProyecto, CveClasificacion:=CveClasificacion, Contabilizable:=EsContabilizable) Then + ErrorMovInv = True + End If + 'End Select + End If + Else + ErrorMovInv = True + End If + + '------------------------------------------------ + If Not ErrorMovInv Then + 'DEVENGAR + Dim TotalPorDevengar As Double = 0 + + 'cuando tiene AC y es salida de almacen, se manda al gasto, solo aplica si el almacen es contable + If UsuarioActual.Empresa.UsaAC AndAlso EsContabilizable Then + Dim DtII As DataTable = Nothing + Dim TotalDetalle As Double = 0.0 + Dim Importe As Decimal = 0 + 'NOTA. CUANDO ES SALIDA, EN AUTOMATICO NO TENEMOS LOS VALORES DE LA SALIDA TODAVIA, Y POR ESO IMPORTE ES CERO, ES RECARGAR CON LOS DATOS YA INSERTADOS + + If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then + DtII = ObjInventario.DtResultados + End If + + TotalPorDevengar += Importe ' GvInv.Rows.Cast(Of GridViewRow)().Sum(Function(Gvr) Math.Round(Gvr.DataKey("PU").ToString.ToDouble, 4) * Math.Round(Gvr.DataKey("CantidadF").ToString.ToDouble, 4)) + TotalPorDevengar = Math.Round(TotalPorDevengar, 4) + ObjContaAC = New ClsContPAQi(UsuarioActual.Empresa) + ObjContaAC.IniciaTransacSQL() + + Dim AC As New ClsAC + Dim DtPresupuestos As DataTable = Nothing + If AC.GetPresupuestoEgresos(-1, True, UsuarioActual.Empresa.EjercicioActual, UsuarioActual.CveEmpresa) Then + DtPresupuestos = AC.DtResultados.Copy + Else + Alert("Ocurrió un error al cargar los Presupuestos. Por favor vuelva a cargar la página", TipoMensaje.MsgError) + RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") + End If + AC.Dispose() + + IDPoliza = ObjContaAC.AddPoliza(3, "Salida de Almacen", TotalPorDevengar, TotalPorDevengar, UsuarioActual.CveUsuario, Fecha) + + If IDPoliza > 0 Then + Dim CuentaCargoCOG As Integer + Dim CuentaAbonoAlmacen As Integer = 0 + Dim drA As DataRow = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveAlmacen = {0}", CveAlmacen)) + + If drA IsNot Nothing Then CuentaAbonoAlmacen = drA("IdCtaContable").ToString.ToEntero + If UsuarioActual.CveEmpresa = 48 Then ' APH + CuentaCargoCOG = 1386 + End If + + Dim ConceptoRenglon As String = "Salida de Almacen" + + If IDPoliza > 0 Then + If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then + Dim DtMovtos = ObjInventario.DtResultados + Importe = DtMovtos.SUMD("Total", "Estatus = ''") + + If Importe > 0 Then + If CuentaCargoCOG > 0 AndAlso CuentaAbonoAlmacen > 0 Then + If ObjContaAC.AddMovimiento(IDPoliza, CuentaCargoCOG, False, Importe, "", ConceptoRenglon, 0, Fecha, "") Then + 'actualizo el idcuenta del presupuesto + If Not ObjContaAC.AddMovimiento(IDPoliza, CuentaAbonoAlmacen, True, Importe, "", ConceptoRenglon, 0, Fecha, "") Then + ErrorAC = True + Mensaje = "No se pudo insertar movimiento en la poliza 2." + End If + Else + ErrorAC = True + Mensaje = "No se pudo insertar movimiento en la poliza 1." + End If + End If + End If + + + End If + End If + + If IDPoliza > 0 Then + ObjInventario.UpdateMovimientoPoliza(IDPoliza, CveMovimiento, UsuarioActual.CveEmpresa) + End If + + Else + ErrorAC = True + Mensaje = "No se pudo insertar la poliza" + End If + End If + + + If Not ErrorAC And Not ErrorMovInv Then + Dim Msg As New StringBuilder + Msg.AppendFormat("
El Movimiento se registro con el Folio: {0}", ObjInventario.Folio) + Msg.AppendFormat("

Imprimir Movimiento ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimiento))) + + If ObjContaAC IsNot Nothing Then ObjContaAC.AjustaPoliza(IDPoliza) + If IDPoliza > 0 Then Msg = Msg.AppendFormat("

Ver Póliza", IDPoliza) + + ObjInventario.Commit() ' aplica los movimientos insertados + If ObjContaAC IsNot Nothing Then ObjContaAC.Commit() + + + 'Limpia Valores cuando inserta de campos especiales + + Else + ObjInventario.RollBack() + CveMovimiento = 0 + If ObjContaAC IsNot Nothing Then ObjContaAC.RollBack() + End If + + + Else + ObjInventario.RollBack() 'deshace lo insertado + CveMovimiento = 0 + If ObjContaAC IsNot Nothing Then ObjContaAC.RollBack() + End If + + + Catch ex As Exception + Try 'por si ya le habian dado rollback o commit + ObjInventario.RollBack() 'deshace lo insertad + Catch exx As Exception + + End Try + CveMovimiento = 0 + If ObjContaAC IsNot Nothing Then ObjContaAC.RollBack() + GuardaLog("Ocurrió un Error inesperado en el registro" & ex.ToString()) + Mensaje = "Ocurrió un Error inesperado en el registro" & ex.ToString() + + TieneError = True + End Try + + ObjInventario.Dispose() 'elimino la instancia + If ObjContaAC IsNot Nothing Then ObjContaAC.Dispose() + + + Else + TieneError = True + Mensaje = "Ocurrió un error al obtener el cuerpo de los parametros" + End If + + If TieneError Or ErrorAC Or ErrorMovInv Then + context.Response.StatusCode = 200 + RespuestaError.Message = Mensaje + retorno = JsonConvert.SerializeObject(RespuestaError).ToString + Else + context.Response.StatusCode = 200 + Respuesta.Message = "La existencia se obtuvo correctamente" + retorno = JsonConvert.SerializeObject(Respuesta).ToString + + End If + + context.Response.Write(retorno) + Return retorno + + End Function + + Private Class FidelityAppsResponse + Sub New() + isSuccess = "true" + End Sub + Public Property IsSuccess As String + Public Property Message As String + End Class + + Private Class FidelityAppsResponseError + Sub New() + isSuccess = "false" + End Sub + Public Property IsSuccess As String + Public Property Message As String + End Class + + Private Class AuthMessage + Public Property IsSucces As Boolean + Public Property ErrorMessage As FidelityAppsResponseError + Public Property StatusCode As Integer + End Class + + ReadOnly Property GlobalDTPS(CveEmpresa As Integer, Optional CvePS As Integer = -1, Optional SATClavePS As String = "-1", Optional AplicaParaVenta As Integer = -1, Optional Estatus As Integer = -1, Optional Codigo As String = "-1") As DataTable + Get + Dim ObjPS As New ClsProductosServicios + + If ObjPS.GetPS(CvePS, -1, CveEmpresa, Codigo:=Codigo, SATClavePS:=SATClavePS, pAplicaParaVenta:=AplicaParaVenta, pEstado:=Estatus) Then + GlobalDTPS = ObjPS.DtResultados + Else + GlobalDTPS = Nothing + End If + + ObjPS.Dispose() + End Get + End Property + + Public Property GlobalDTPSSimplificado(Optional CveClasificacion As Integer = -1, Optional Codigo As String = "-1", Optional Estatus As Integer = 1, Optional AplicaParaVenta As Integer = -1, Optional CvePS As Integer = -1) As DataTable + Get + Dim AppNombre As String = String.Format("GlobalDTPSSimplificado-{0}", CveEmpresa) + If CveEmpresa <> -1 Then + 'sino existe, recarga los datos + If HttpContext.Current.Application(AppNombre) Is Nothing Then + Dim ObjPS As New ClsProductosServicios + If ObjPS.GetPSSimplificado(CveEmpresa) Then HttpContext.Current.Application(AppNombre) = ObjPS.DtResultados.AsEnumerable() + ObjPS.Dispose() + + End If + + + Dim Cons = DirectCast(HttpContext.Current.Application(AppNombre), EnumerableRowCollection(Of DataRow)) + + Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveEmpresa) = CveEmpresa)) + If CveClasificacion >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveClasificacion) = CveClasificacion)) + Codigo = Codigo.ToUpper() + If Codigo <> "-1" Then Cons = Cons.Where((Function(a) Convert.ToString(a!Codigo).ToUpper() = Codigo)) + If Estatus >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveEstado) = Estatus)) + If AplicaParaVenta >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!AplicaParaVenta) = AplicaParaVenta)) + If CvePS >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CvePS) = CvePS)) + + Try + GlobalDTPSSimplificado = Cons.OrderBy(Function(a) a!PSCodigo).CopyToDataTable + Catch ex As Exception + GlobalDTPSSimplificado = New DataTable + End Try + + Else + GlobalDTPSSimplificado = DirectCast(HttpContext.Current.Application(AppNombre), EnumerableRowCollection(Of DataRow)).CopyToDataTable + End If + End Get + Set(value As DataTable) + Dim AppNombre As String = String.Format("GlobalDTPSSimplificado-{0}", CveEmpresa) + HttpContext.Current.Application(AppNombre) = value + End Set + End Property + Private Function ValidaUsuarioSistema(CveUsuario As Integer, CveEmpresa As Integer) As Usuario + Dim UsuarioActual As Usuario = Nothing + Dim ObjUsuarios As New ClsSisUsuarios + If ObjUsuarios.GetUsuarios(CveUsuario) Then + If ObjUsuarios.DtResultados.Rows.Count > 0 Then + Dim Usuario = ObjUsuarios.DtResultados.Rows(0)("Usuario").ToString() + Dim Contrasenia = ObjUsuarios.DtResultados.Rows(0)("Contraseña").ToString() + UsuarioActual = ObjUsuarios.ValidaUsuario(Usuario, Contrasenia, IMEI, CveEmpresa) + UsuarioActual.CveEmpresa = CveEmpresa + CreaObjetoEmpresa(UsuarioActual) + End If + End If + ObjUsuarios.Dispose() + Return UsuarioActual + End Function + Private Sub CreaObjetoEmpresa(ByRef UsuarioActual As Usuario) + + Dim ObjEmpresa As New ClsSisEmpresas() + If ObjEmpresa.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1") Then + If ObjEmpresa.GetEmpresasFuncionalidades(UsuarioActual.CveEmpresa) Then + Dim dttmp As Data.DataTable = ObjEmpresa.DtResultados + + Dim EmpresasFuncionalidades As New HybridDictionary + For Each Row As Data.DataRow In dttmp.Rows + EmpresasFuncionalidades.Add(Convert.ToInt32(Row("CveFuncionalidad")), Row("Valor").ToString) + Next + ObjEmpresa.Empresa.SetFuncionalidades(EmpresasFuncionalidades) + End If + + UsuarioActual.Empresa = ObjEmpresa.Empresa + End If + ObjEmpresa.Dispose() + End Sub + Property GlobalDTAlmacen(CveEmpresa As Integer, Optional CveTipoAlmacen As Integer = -1, Optional CveEstatus As Integer = 1, Optional CveAlmacen As Integer = -1) As DataTable + Get + Dim AppNombre As String = String.Format("GlobalDTAlmacen-{0}", CveEmpresa) + Dim dttemp As DataTable + 'sino existe, recarga los datos + Dim ObjUsr As New ClsInventarios + If ObjUsr.GetAlmacenes(-1, -1, CveEmpresa, -1) Then dttemp = ObjUsr.DtResultados + ObjUsr.Dispose() + + Dim Str As New StringBuilder + Str.Append("1=1 AND ") + If CveEmpresa <> -1 Then Str.AppendFormat(" CveEmpresa = {0} ", CveEmpresa) + If CveTipoAlmacen > 0 Then Str.AppendFormat("AND CveTipoAlmacen = {0}", CveTipoAlmacen) + If CveEstatus > 0 Then Str.AppendFormat("AND CveEstatus = {0}", CveEstatus) + If CveAlmacen > 0 Then Str.AppendFormat("AND CveAlmacen = {0}", CveAlmacen) + + Dim Dv As New DataView(DirectCast(dttemp, DataTable), Str.ToString, "", DataViewRowState.CurrentRows) + GlobalDTAlmacen = Dv.ToTable + Dv.Dispose() + End Get + Set(value As DataTable) + Dim dttemp As DataTable + Dim AppNombre As String = String.Format("GlobalDTAlmacen-{0}", CveEmpresa) + dttemp = value + End Set + 'Get + + ' Dim Str As New StringBuilder + ' Str.Append("1=1 AND ") + ' If CveEmpresa <> -1 Then Str.AppendFormat(" CveEmpresa = {0} ", CveEmpresa) + ' If CveTipoAlmacen > 0 Then Str.AppendFormat("AND CveTipoAlmacen = {0}", CveTipoAlmacen) + ' If CveEstatus > 0 Then Str.AppendFormat("AND CveEstatus = {0}", CveEstatus) + ' If CveAlmacen > 0 Then Str.AppendFormat("AND CveAlmacen = {0}", CveAlmacen) + + ' Dim Dv As New DataView(DirectCast(Application("GlobalDTAlmacen"), DataTable), Str.ToString, "", DataViewRowState.CurrentRows) + ' GlobalDTAlmacen = Dv.ToTable + ' Dv.Dispose() + + 'End Get + 'Set(value As DataTable) + ' Application("GlobalDTAlmacen") = value + 'End Set + End Property +End Class \ No newline at end of file diff --git a/Ashx/E72.ashx b/Ashx/E72.ashx index 78d0e2c55..310c93b60 100644 --- a/Ashx/E72.ashx +++ b/Ashx/E72.ashx @@ -26,46 +26,120 @@ Public Class E72 : Implements IHttpHandler, IRequiresSessionState End Sub Private Function contratoexistencia(ByVal context As HttpContext) As String + Dim retorno As String = "" + Dim ObjInv As New ClsInventarios Try - - - Dim retorno As String = "" - Dim ObjInv As New ClsInventarios + Dim DtPS As DataTable = CreaDT() ObjInv.GetRepEntradasSalidasXContrato(72, -1, MinFecha, Date.Now, -1, -1, 17, -1, -1, 3, -1, 1158) Dim DtRepEntradasSalidasXContrato As DataTable = ObjInv.DtResultados.FiltraParametros("CvePS > 0") ObjInv.ApartadosRep(-1, 70437, 259, 72, -1, MinFecha, Date.Now) - Dim DtApartados As DataTable = ObjInv.DtResultados.FiltraParametros("CvePS > 0", "", {"CvePS", "Cantidad"}) + Dim DtApartados As DataTable = ObjInv.DtResultados.FiltraParametros("CvePS > 0", "", {"CvePS", "Codigo", "Cantidad"}) Dim asd As Integer = DtApartados.Rows.Count - Dim DTapartado = From row In DtApartados.AsEnumerable - Group row By CvePS = row.Field(Of Integer)("CvePS") Into CvePSGroup = Group - Select New With { - Key CvePS, - .Cantidad = CvePSGroup.Sum(Function(r) r.Field(Of Decimal)("Cantidad")) - } + 'For Each tempApartados As DataRow In DtApartados.Rows + ' For Each tempEntradasSalidas As DataRow In DtRepEntradasSalidasXContrato.Rows + ' Dim dr As DataRow = DtMovimientos.NewRow + ' If tempEntradasSalidas("CvePS").ToString.ToEntero = tempApartados("CvePS").ToString.ToEntero Then + ' dr("Codigo") = tempEntradasSalidas("Codigo") + ' dr("Existencia") = tempEntradasSalidas("SaldoFCant") + ' dr("Cantidad") = tempApartados("Cantidad") + ' dr("Precio") = tempEntradasSalidas("PrecioVenta") + ' Else + ' dr("Codigo") = tempEntradasSalidas("Codigo") + ' dr("Existencia") = tempEntradasSalidas("SaldoFCant") + ' dr("Cantidad") = 0 + ' dr("Precio") = tempEntradasSalidas("PrecioVenta") + ' End If + ' DtMovimientos.Rows.Add(dr) - Dim DtTemp = From entradas In DtRepEntradasSalidasXContrato - Join apartados In DTapartado - On entradas.Field(Of Integer)("CvePS") Equals apartados.CvePS - Select New With { - .Codigo = entradas.Field(Of String)("Codigo"), - .Existencia = entradas.Field(Of Double)("SaldoFCant"), - .AlmacenAlt = apartados.Cantidad, - .Precio = entradas.Field(Of Double)("PrecioVenta") - } + ' Next + 'Next + For Each tempEntradasSalidas As DataRow In DtRepEntradasSalidasXContrato.Rows + Dim dr As DataRow = DtPS.NewRow + dr("Codigo") = tempEntradasSalidas("Codigo") + DtPS.Rows.Add(dr) + DtPS.AcceptChanges() - retorno = JsonConvert.SerializeObject(DtTemp).ToString + Next + + For Each tempApartados As DataRow In DtApartados.Rows + Dim dr As DataRow = DtPS.NewRow + dr("Codigo") = tempApartados("Codigo") + DtPS.Rows.Add(dr) + DtPS.AcceptChanges() + + Next + Dim DTtemp As DataTable = DtPS.FiltraParametros("", "", {"Codigo", "Existencia", "Cantidad", "Precio"}) + For Each Movs As DataRow In DTtemp.Rows + For Each tempEntradasSalidas As DataRow In DtRepEntradasSalidasXContrato.Rows + If tempEntradasSalidas("Codigo").ToString = Movs("Codigo").ToString Then + Movs("Existencia") = tempEntradasSalidas("SaldoFCant").ToString.ToDouble + Movs("Cantidad") = 0 + Movs("Precio") = tempEntradasSalidas("PrecioVenta").ToString.ToDouble + End If + Next + For Each tempApartados As DataRow In DtApartados.Rows + If tempApartados("Codigo").ToString = Movs("Codigo").ToString Then + Movs("Existencia") = IIf(Movs("Existencia").ToString.ToEntero > 0, Movs("Existencia"), 0) + Movs("Cantidad") = tempApartados("Cantidad").ToString.ToDouble + Movs("Precio") = IIf(Movs("Precio").ToString.ToEntero > 0, Movs("Existencia"), 0) + End If + Next + DtPS.AcceptChanges() + + Next + + 'Dim dtExistencias = From row In DtMovimientos.FiltraParametros("", "", {"Codigo", "Existencia", "Cantidad", "Precio"}) + ' Group row By Codigo = row.Field(Of String)("Codigo"), Existencia = row.Field(Of Double)("Existencia"), Precio = row.Field(Of Double)("Precio") Into CodigoGroup = Group + ' Select New With { + ' .Codigo = Codigo, + ' .Existencia = Existencia, + ' .Cantidad = CodigoGroup.Sum(Function(r) r.Field(Of Double)("Cantidad")), + ' .Precio = Precio} + + 'Dim LINQEntradasSalidas = From row In DtRepEntradasSalidasXContrato.AsEnumerable + ' Select New With { + ' .CvePS = row.Field(Of Integer)("CvePS"), + ' .Existencia = row.Field(Of Double)("SaldoFCant"), + ' .Cantidad = 0, + ' .Precio = row.Field(Of Double)("PrecioVenta"), + ' .Codigo = row.Field(Of String)("Codigo")} + + + 'Dim DtTemp = From LINQEntradasSalida In LINQEntradasSalidas.AsEnumerable + ' Group Join LINQapartados In LINQapartado.AsEnumerable + ' On LINQEntradasSalida.CvePS Equals LINQapartados.CvePS Into Group + ' From unido In Group.DefaultIfEmpty + ' Where unido IsNot Nothing + ' Order By LINQEntradasSalida.CvePS + ' Select New With {.Codigo = LINQEntradasSalida.Codigo, + ' .Existencia = LINQEntradasSalida.Existencia, + ' .Precio = LINQEntradasSalida.Precio} + + 'Dim Dtnum As Integer = DtMovimientos.su + + retorno = JsonConvert.SerializeObject(DTtemp).ToString context.Response.Write(retorno) - ObjInv.Dispose() - Return retorno + Catch ex As Exception - + context.Response.Write(String.Format("{0}", ex)) End Try - + ObjInv.Dispose() + Return retorno End Function + Private Function CreaDT() + Dim DtMovimientos As DataTable = New DataTable("Productos") + With DtMovimientos.Columns + .Add("Codigo", Type.GetType("System.String")) + .Add("Existencia", Type.GetType("System.Double")) + .Add("Cantidad", Type.GetType("System.Double")) + .Add("Precio", Type.GetType("System.Double")) + End With + Return DtMovimientos + End Function End Class \ No newline at end of file diff --git a/Bancos/Creditos.aspx.vb b/Bancos/Creditos.aspx.vb index 708bd7064..b82881c22 100644 --- a/Bancos/Creditos.aspx.vb +++ b/Bancos/Creditos.aspx.vb @@ -422,7 +422,7 @@ Partial Class Bancos_Creditos HLSaldoPrePoliza.NavigateUrl = $"/Contabilidad/RegPrePoliza.aspx?CvePrePoliza={ObjCreditos.CvePrePoliza}" LbSaldo.Text = $"Saldo Acreedor " - If ObjPrepoliza.GetPrePolizasDetalle(ObjCreditos.CvePrePoliza) AndAlso ObjPrepoliza.DtResultados.Rows.Count > 0 Then + If ObjPrepoliza.GetPrePolizasDetalle(ObjCreditos.CvePrePoliza, UsuarioActual.CveEmpresa) AndAlso ObjPrepoliza.DtResultados.Rows.Count > 0 Then LbSaldoAcreedor.Text = ObjPrepoliza.DtResultados.FiltraParametros("CveConceptoContable = 42").Rows(0)("Importe").ToString.FormatoNumero LbSaldoDocxPagar.Text = ObjPrepoliza.DtResultados.FiltraParametros("CveConceptoContable = 50").Rows(0)("Importe").ToString.FormatoNumero End If @@ -469,7 +469,7 @@ Partial Class Bancos_Creditos End If 'CARGA ANTICIPOS - If dr("CveIE").ToString.ToEntero > 0 AndAlso ObjPrepoliza.GetPrePolizasDetalle(-1, dr("CveIE").ToString.ToEntero) Then + If dr("CveIE").ToString.ToEntero > 0 AndAlso ObjPrepoliza.GetPrePolizasDetalle(-1, UsuarioActual.CveEmpresa, CveIE:=dr("CveIE").ToString.ToEntero) Then If ObjPrepoliza.DtResultados.Rows.Count > 0 Then TxtVehiculoAnticipo.Text = ObjPrepoliza.DtResultados.FiltraParametros("CveConceptoContable = 53").Rows(0)("Importe").ToString.FormatoNumero TxtComisionAnticipo.Text = ObjPrepoliza.DtResultados.FiltraParametros("CveConceptoContable = 54").Rows(0)("Importe").ToString.FormatoNumero diff --git a/Bancos/DepositoTerminal.aspx.vb b/Bancos/DepositoTerminal.aspx.vb index 210c6c88e..2c0a54b49 100644 --- a/Bancos/DepositoTerminal.aspx.vb +++ b/Bancos/DepositoTerminal.aspx.vb @@ -276,14 +276,8 @@ Partial Class Bancos_DepositoTerminal ViewState("IdCtaContMonedaExtranjera") = ObjCliente.IdCtaContMonedaExtranjera ViewState("IdCtaContComplementaria") = ObjCliente.IdCtaContComplementaria ViewState("IdCtaContRetIVA") = ObjCliente.IdCtaContRetIVA - ViewState("IdCtaContRetISR") = ObjCliente.IdCtaContRetISR - - ViewState("CveCuentaCliente") = ObjCliente.CveCuentaClientes - ViewState("CveCuentaMonedaExtranjera") = ObjCliente.CveCuentaMonedaExtranjera - ViewState("CveCuentaComplementaria") = ObjCliente.CveCuentaComplementaria - ViewState("CveCuentaRetIVA") = ObjCliente.CveCuentaRetIVA - ViewState("CveCuentaRetISR") = ObjCliente.CveCuentaRetISR - + ViewState("IdCtaContRetISR") = ObjCliente.IdCtaContRetISR + IdCuentaBancaria = 0 CveCuentaBancaria = 0 End If @@ -308,7 +302,6 @@ Partial Class Bancos_DepositoTerminal Dim importeMX As Decimal Dim FechaMovimiento As Date = TxtFecha.Text.ToDate Dim IdCtaContable As Integer = 0 - Dim CveCuenta As Integer = 0 Dim ConceptoMovimiento As String = ObjContabilidad.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, ConceptoContable, NombreComercial, gvr.DataKey("SerieFolio").ToString, TxtFolio.ToString) Dim Referencia As String = gvr.DataKey("SerieFolio").ToString Dim CveSubProyecto As Integer = gvr.DataKey("CveSubProyecto").ToEntero @@ -320,20 +313,17 @@ Partial Class Bancos_DepositoTerminal If tipoCambioVenta = 1 Then IdCtaContable = IdCuentaCliente - CveCuenta = CveCuentaCliente Else ConceptoMovimiento += $" TC:{tipoCambioVenta} ${ImporteMovimiento.FormatoNumero(2)}" IdCtaContable = IdCtaContComplementaria - CveCuenta = CveCuentaComplementaria If ImporteMovimiento <> 0 AndAlso IdCtaContable > 0 Then importeMX = ImporteMovimiento - If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, TipoMovimiento, 0, Referencia, ConceptoContable, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.FCHyperLink("HplF2").Text.ToEntero, -1, CveSubProyecto, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteMovimiento * tipoCambioVenta - ImporteMovimiento, CveCuenta:=CveCuenta) Then + If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, TipoMovimiento, 0, Referencia, ConceptoContable, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.FCHyperLink("HplF2").Text.ToEntero, -1, CveSubProyecto, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=ImporteMovimiento * tipoCambioVenta - ImporteMovimiento) Then MsgError = "No se pudo insertar la póliza" End If End If IdCtaContable = IdCtaContMonedaExtranjera - CveCuenta = CveCuentaMonedaExtranjera End If Case 8 'Ret IVA x Trasladar @@ -351,19 +341,9 @@ Partial Class Bancos_DepositoTerminal IdCtaContable = ObjContabilidad.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero End If End If - End If - - 'Conta SIG - If CveCuentaRetIVA <> 0 Then - CveCuenta = CveCuentaRetIVA - Else - If ObjContabilidad.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then - If ObjContabilidad.DtResultados.Rows.Count > 0 Then - CveCuenta = ObjContabilidad.DtResultados.Rows(0)("IdCuentaRetIVACirculacionSIG").ToString.ToEntero - End If - End If - End If - + End If + + Case 9 'Ret ISR x Trasladar ImporteMovimiento = gvr.DataKey("RetISR").ToDecimal * PorcentajePago @@ -379,25 +359,13 @@ Partial Class Bancos_DepositoTerminal IdCtaContable = ObjContabilidad.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero End If End If - End If - - 'Conta SIG - If CveCuentaRetISR <> 0 Then - CveCuenta = CveCuentaRetISR - Else - If ObjContabilidad.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then - If ObjContabilidad.DtResultados.Rows.Count > 0 Then - CveCuenta = ObjContabilidad.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString.ToEntero - End If - End If - End If - + End If + Case 13 'Iva por Trasladar ImporteMovimiento = gvr.DataKey("IVA").ToDecimal * PorcentajePago importeMX = Math.Round(ImporteMovimiento * tipoCambioVenta, 2) IdCtaContable = UsuarioActual.Empresa.IdCuentaIVAxTrasladar - CveCuenta = UsuarioActual.Empresa.CveCuentaIVAxTrasladar If tipoCambioVenta > 1 Then ConceptoMovimiento += $" TC:{tipoCambioVenta} ${ImporteMovimiento.FormatoNumero(2)}" Case 62 'Ret IVA Trasladado @@ -415,19 +383,9 @@ Partial Class Bancos_DepositoTerminal IdCtaContable = ObjContabilidad.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero End If End If - End If - - 'Conta SIG - If CveCuentaRetIVA <> 0 Then - CveCuenta = CveCuentaRetIVA - Else - If ObjContabilidad.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then - If ObjContabilidad.DtResultados.Rows.Count > 0 Then - CveCuenta = ObjContabilidad.DtResultados.Rows(0)("IdCuentaRetIVACirculacionSIG").ToString.ToEntero - End If - End If - End If - + End If + + Case 63 'Ret ISR Trasladado ImporteMovimiento = gvr.DataKey("RetISR").ToDecimal * PorcentajePago @@ -443,25 +401,13 @@ Partial Class Bancos_DepositoTerminal IdCtaContable = ObjContabilidad.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero End If End If - End If - - 'Conta SIG - If CveCuentaRetISR <> 0 Then - CveCuenta = CveCuentaRetISR - Else - If ObjContabilidad.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then - If ObjContabilidad.DtResultados.Rows.Count > 0 Then - CveCuenta = ObjContabilidad.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString.ToEntero - End If - End If - End If - + End If + Case 61 'Iva Trasladado ImporteMovimiento = gvr.DataKey("IVA").ToDecimal * PorcentajePago importeMX = Math.Round(ImporteMovimiento * tipoCambioManual, 2) IdCtaContable = UsuarioActual.Empresa.IdCuentaIVATrasladado - CveCuenta = UsuarioActual.Empresa.CveCuentaIVATrasladado If tipoCambioManual > 1 Then ConceptoMovimiento += $" TC:{tipoCambioManual} ${ImporteMovimiento.FormatoNumero(2)}" Case 38 'IEPS por trasladar @@ -470,14 +416,12 @@ Partial Class Bancos_DepositoTerminal importeMX = Math.Round(ImporteMovimiento * tipoCambioVenta, 2) IdCtaContable = UsuarioActual.Empresa.IdCuentaIEPSxTrasladar - CveCuenta = UsuarioActual.Empresa.CveCuentaIEPSxTrasladar Case 39 'IEPS Trasladado ImporteMovimiento = gvr.DataKey("IEPS").ToDecimal * PorcentajePago importeMX = Math.Round(ImporteMovimiento * tipoCambioManual, 2) IdCtaContable = UsuarioActual.Empresa.IdCuentaIEPSTrasladado - CveCuenta = UsuarioActual.Empresa.CveCuentaIEPSTrasladado Case 78 'Otros Ingresos If ChkAjusteOI.Checked Then @@ -500,15 +444,9 @@ Partial Class Bancos_DepositoTerminal If (IdCtaContable < 1 Or IdCuentaBancaria < 1) Then CuentasContablesInvalidas.Append("
" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) idCuentaContabilizacion = 0 - End If - - 'Conta SIG - If (CveCuenta < 1 Or CveCuentaBancaria < 1) Then - CuentasContablesInvalidasSIG.Append("
" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString) - CveCuentaContabilizacion = 0 - End If - - If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, TipoMovimiento, ImporteMovimiento, Referencia, ConceptoContable, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyecto, gvr.DataKey("CveCliente").ToEntero, ImporteMX:=importeMX, CveCuenta:=CveCuenta) Then + End If + + If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, TipoMovimiento, ImporteMovimiento, Referencia, ConceptoContable, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.DataKey("CveVenta").ToEntero, -1, CveSubProyecto, gvr.DataKey("CveCliente").ToEntero, ImporteMX:=importeMX) Then MsgError = "No se pudo insertar la póliza" End If End If diff --git a/Bancos/DepositosCaja.aspx b/Bancos/DepositosCaja.aspx index 3295a33f7..accb3c4ed 100644 --- a/Bancos/DepositosCaja.aspx +++ b/Bancos/DepositosCaja.aspx @@ -137,7 +137,7 @@ - +
@@ -166,13 +166,17 @@
-
+
Seleccionado: $ 0.00
+
+
+ +
@@ -265,7 +269,12 @@
- + +
+
+ + +
@@ -614,8 +623,28 @@ debugger; } - + function Depositar() { + LimppiarVariables(); + + } + function Consultar() { + LimppiarVariables(); + + } + + function LimppiarVariables() { + + ValorTotalSeleccionado = 0; + comision = 0; + descuento = 0; + saldo = 0; + IVA = 0; + ComisionIntermediario = 0; + + } + + diff --git a/Bancos/DepositosCaja.aspx.vb b/Bancos/DepositosCaja.aspx.vb index 21df2bcf2..8ad8491f4 100644 --- a/Bancos/DepositosCaja.aspx.vb +++ b/Bancos/DepositosCaja.aspx.vb @@ -31,7 +31,8 @@ Partial Class Bancos_DepositosCaja ChkFaltante.Attributes.Add("onclick", "CheckFaltante(this);") ChkDescuento.Attributes.Add("onclick", "CheckDescuento(this);") ChkIntermediario.Attributes.Add("onclick", "CheckIntermediario(this);") - + BtnConsultar.Attributes.Add("onclick", "Consultar(this);") + BtnDepositar.Attributes.Add("onclick", "Depositar(this);") End If End Sub @@ -98,11 +99,24 @@ Partial Class Bancos_DepositosCaja GvFacturas.DataSource = ObjBancos.DtResultados ObjBancos.Dispose() - UpGvFacturas.Update() + GvFacturas.DataBind() - lblValorTotal.Text = "0.00" + ChkFaltante.Checked = False + ChkDescuento.Checked = False + ChkIntermediario.Checked = False TxtComision.Text = "" + TxtDescuento.Text = "" + TxtIVA.Text = "" + TxtComisionIntermediario.Text = "" + lblValorTotal.Text = "0.0" + lblValorTotalSeleccionado.Text = "0.0" divLabelTotal.Visible = True + DdlSubProyectoDeposito.SelectedValueExist(DdlSubProyectos.SelectedValue.ToEntero) + DdlSubProyectoDescuento.SelectedValueExist(DdlSubProyectos.SelectedValue.ToEntero) + DdlSubProyectoIntermediario.SelectedValueExist(DdlSubProyectos.SelectedValue.ToEntero) + UpGvFacturas.Update() + UpParametros.Update() + UpComisiones.Update() End Sub Private Sub BtnDepositar_Click(sender As Object, e As EventArgs) Handles BtnDepositar.Click @@ -165,14 +179,19 @@ Partial Class Bancos_DepositosCaja Dim CveCuentaBancariaDestino As Integer = 0 Dim drOrigen As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveCuenta:=DdlCajaChica.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero("") Dim drDestino As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveCuenta:=DdlCuentaDeposito.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero("") - Dim CveSubProyecto As Integer = -1 - Dim CveSubProyectoDescuento As Integer = -1 + Dim CveSubProyecto As Integer = DdlSubProyectos.SelectedValue.ToEntero Dim CveClasificacion As Integer = -1 - Dim CveClasificacionDescuento As Integer = -1 + + Dim CveSubProyectoComision As Integer + Dim CveClasificacionComision As Integer + + Dim CveSubProyectoDescuento As Integer + Dim CveClasificacionDescuento As Integer + Dim documentos As String = "Los Depósitos se realizaron exitosamente

" Dim imprimirFolios As String = "" - Dim CveSubProyectoIntermediario As Integer = -1 - Dim CveClasificacionIntermediario As Integer = -1 + Dim CveSubProyectoIntermediario As Integer + Dim CveClasificacionIntermediario As Integer Dim CveProveedorIntermediario As Integer = -1 If drOrigen IsNot Nothing Then @@ -231,10 +250,10 @@ Partial Class Bancos_DepositosCaja If ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, False, TotalImporte, "Depósito Bancario", 30, "Depósito Bancario", Fecha, IdCuentaBancariaOrigen, -1, CveClasificacion:=CveClasificacion, CveSubProyecto:=CveSubProyecto, CveIE:=CveIEOrigen, ImporteMX:=TotalImporte * TipoCambio) Then If ChkFaltante.Checked Then - CveSubProyecto = DdlSubProyectoDeposito.SelectedValue.ToEntero - CveClasificacion = DdlClasificacion.SelectedValue.ToEntero + CveSubProyectoComision = DdlSubProyectoDeposito.SelectedValue.ToEntero + CveClasificacionComision = DdlClasificacion.SelectedValue.ToEntero If Comision <> 0 Then - If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, True, Comision, DdlClasificacion.SelectedItem.Text, 51, DdlClasificacion.SelectedItem.Text, Fecha, IdCuentaBancariaOrigen, -1, CveClasificacion:=CveClasificacion, CveSubProyecto:=CveSubProyecto, ImporteMX:=Comision * TipoCambio) Then + If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, True, Comision, DdlClasificacion.SelectedItem.Text, 51, DdlClasificacion.SelectedItem.Text, Fecha, IdCuentaBancariaOrigen, -1, CveClasificacion:=CveClasificacionComision, CveSubProyecto:=CveSubProyectoComision, ImporteMX:=Comision * TipoCambio) Then OcurrioError = True End If End If @@ -314,8 +333,9 @@ Partial Class Bancos_DepositosCaja TxtDescuento.Text = "" TxtIVA.Text = "" TxtComisionIntermediario.Text = "" - lblValorTotal.Text = "" - lblValorTotalSeleccionado.Text = "" + lblValorTotal.Text = "0.0" + lblValorTotalSeleccionado.Text = "0.0" + CargaDatos() ObjContabilidad.Dispose() End Sub @@ -329,6 +349,8 @@ Partial Class Bancos_DepositosCaja Next lblValorTotal.Text = Total.ToString("N") UpGvFacturas.Update() + UpParametros.Update() + End Sub Public Sub ChkFactura_Click(sender As Object, e As EventArgs) diff --git a/Bancos/IE.aspx b/Bancos/IE.aspx index a7455d22e..ecc119d3f 100644 --- a/Bancos/IE.aspx +++ b/Bancos/IE.aspx @@ -1183,7 +1183,7 @@ - +
diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb index a9e212a80..430b2e5e0 100644 --- a/Bancos/IE.aspx.vb +++ b/Bancos/IE.aspx.vb @@ -895,7 +895,7 @@ Partial Class Bancos_IE End If 'Detectamos a quien se le hizo el cobro (Cliente, proveedor, Funcionario/Empleado, etc.) - If ObjIE2.GetPrePolizasDetalle(-1, CveIE) Then + If ObjIE2.GetPrePolizasDetalle(-1, UsuarioActual.CveEmpresa, CveIE:=CveIE) Then If ObjIE2.DtResultados.Rows.Count > 0 Then Dim CveConceptoContable As Integer = ObjIE2.DtResultados.FiltroPrimeroValor("CveConceptoContable", "CveConceptoContable <> 30 and CveConceptoContable <> 61").ToEntero @@ -2845,7 +2845,7 @@ Partial Class Bancos_IE 'Agregamos el IVA If DivIvaIxC.Visible AndAlso TxtIvaIxC.Text.ToDecimal <> 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, TxtIvaIxC.Text.ToDecimal, Concepto, 61, Concepto, FechaMovimiento, UsuarioActual.Empresa.IdCuentaIVAxTrasladar, -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=TxtIvaIxC.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera, CveCuenta:=UsuarioActual.Empresa.CveCuentaIVAxTrasladar) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, TxtIvaIxC.Text.ToDecimal, Concepto, 61, Concepto, FechaMovimiento, UsuarioActual.Empresa.IdCuentaIVAxTrasladar, -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=TxtIvaIxC.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera) Then MsgError = "Ocurrió un error al registrar el asiento del ingreso." End If End If @@ -2853,7 +2853,7 @@ Partial Class Bancos_IE 'Agregamos complementaria Dim TC As Decimal = TxtTipoCambio.Text.ToDecimal - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Concepto, 226, Concepto, FechaMovimiento, IDCtaBeneficiarioComplementaria, -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=(importeMovimiento * TC - importeMovimiento).RoundSQL, ImporteME:=importeMovimiento, TipoCambio:=TC, CveCuenta:=0) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Concepto, 226, Concepto, FechaMovimiento, IDCtaBeneficiarioComplementaria, -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=(importeMovimiento * TC - importeMovimiento).RoundSQL, ImporteME:=importeMovimiento, TipoCambio:=TC) Then MsgError = "Ocurrió un error al registrar el asiento del ingreso." End If @@ -2869,7 +2869,7 @@ Partial Class Bancos_IE 'Agregamos complementaria Dim TC As Decimal = TxtTipoCambio.Text.ToDecimal - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Concepto, 204, Concepto, FechaMovimiento, IDCtaContableComplementaria, -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=(importeMovimiento * TC - importeMovimiento).RoundSQL, ImporteME:=importeMovimiento, TipoCambio:=TC, CveCuenta:=UsuarioActual.Empresa.CveCuentaIVAxTrasladar) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Concepto, 204, Concepto, FechaMovimiento, IDCtaContableComplementaria, -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=(importeMovimiento * TC - importeMovimiento).RoundSQL, ImporteME:=importeMovimiento, TipoCambio:=TC) Then MsgError = "Ocurrió un error al registrar el asiento del ingreso." End If Else @@ -2958,7 +2958,7 @@ Partial Class Bancos_IE End If 'IMPUESTOS - If ObjMov.GetPrePolizasDetalle(CvePrePolizaDevDin) Then + If ObjMov.GetPrePolizasDetalle(CvePrePolizaDevDin, UsuarioActual.CveEmpresa) Then Dim PorcentajePagoDevDin = (TxtImporte.Text.ToDecimal / ImporteOriginalDevDin).RoundSQL(6) Dim CveConceptoContableAplciar = -1 Dim TipoMovtoAplicar = False @@ -3561,7 +3561,7 @@ Partial Class Bancos_IE 'Agregamos complementaria Dim TC As Decimal = TxtTipoCambio.Text.ToDecimal - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Concepto, 204, Concepto, FechaMovimiento, IDCtaContableComplementaria, -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=(importeMovimiento * TC - importeMovimiento).RoundSQL, ImporteME:=importeMovimiento, TipoCambio:=TC, CveCuenta:=UsuarioActual.Empresa.CveCuentaIVAxTrasladar) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Concepto, 204, Concepto, FechaMovimiento, IDCtaContableComplementaria, -1, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=(importeMovimiento * TC - importeMovimiento).RoundSQL, ImporteME:=importeMovimiento, TipoCambio:=TC) Then MsgError = "Ocurrió un error al registrar el asiento del ingreso." End If End If @@ -4339,8 +4339,15 @@ Partial Class Bancos_IE Protected Sub BtnCancelarIE_Click(sender As Object, e As EventArgs) RegistraScript("$('#DivCancelarIE').modal('hide');") + Dim ExistenComplementosVigentes As Boolean = VerificaComplementos(True) + + If Not ExistenComplementosVigentes Then + CancelarIE() + Else + Alert("No se puede cancelar documento con complementos de pago vigentes", TipoMensaje.MsgError) + End If + - CancelarIE() End Sub Private Sub CancelarIE(Optional CancelarComplemento As Boolean = False) @@ -4350,8 +4357,8 @@ Partial Class Bancos_IE Exit Sub End If - If ChkConciliado.Checked Then - Alert("El documento seleccionado no se puede eliminar porque se encuentra conciliado.", TipoMensaje.MsgError) + If ChkConciliado.Checked AndAlso TxtFechaCancelacion.Text.ToDate < TxtFechaAplicado.Text.ToDate.FirstDayOfMonth.AddMonths(1) Then + Alert("El documento conciliado, no se puede cancelar con la fecha especificada.", TipoMensaje.MsgError) Exit Sub End If @@ -5973,7 +5980,7 @@ Partial Class Bancos_IE 'TxtFechaDesconciliado.Text = Now.ToShortDateString 'UpDesconciliar.Update() 'RegistraScript("$('#DModalDesconciliar').modal()") - Dim fechaCancelacion As String = DateTime.Now.AddMonths(1).FirstDayOfMonth.ToShortDateString + Dim fechaCancelacion As String = TxtFechaAplicado.Text.ToDate.AddMonths(1).FirstDayOfMonth.ToShortDateString RVTxtFechaCancelacion.MinimumValue = fechaCancelacion CalendarioCancelacion.StartDate = fechaCancelacion.ToDate UpEliminarCotizacion.Update() @@ -6451,13 +6458,12 @@ Partial Class Bancos_IE Protected Sub LnkCancelarComplemetno_Click(sender As Object, e As EventArgs) If ChkConciliado.Checked Then - Alert("El documento seleccionado no se puede eliminar porque se encuentra conciliado.", TipoMensaje.MsgAdvertencia) + Alert("El documento se encuentra conciliado, no se puede cancelar.", TipoMensaje.MsgAdvertencia) Exit Sub End If Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).BindingContainer, GridViewRow) - CveComplementoPagoCancelar = GvRow.DataKey("CveComplementoPago").ToEntero FolioFiscalCancelar = GvRow.DataKey("FolioFiscal").ToString '' Dim RFCEmisor As String = UsuarioActual.Empresa.RFC @@ -6467,8 +6473,6 @@ Partial Class Bancos_IE Dim ObjCancelacion As New Timbrado Dim ObjBanco As New ClsBancos - - If EstatusSATCancelado(FolioFiscalCancelar, UsuarioActual.Empresa.RFC, RFCReceptorCancelar) Then If ObjBanco.UpdateComplementoPago(CveComplementoPagoCancelar, "-1", -1, UsuarioActual.CveEmpresa, 2, CvePACCancelacion, FechaCancelacion:=Date.Now, SelloCancelacion:="") Then diff --git a/Bancos/PopIECompras.aspx.vb b/Bancos/PopIECompras.aspx.vb index 0f8a67eae..1582d5826 100644 --- a/Bancos/PopIECompras.aspx.vb +++ b/Bancos/PopIECompras.aspx.vb @@ -1538,7 +1538,6 @@ Partial Class Bancos_PopIECompras Dim ImporteMovimientoNoDeducible As Decimal = 0 Dim ImporteMXNoDeducible As Decimal = 0 Dim IdCtaContable As Integer = 0 - Dim CveCuenta As Integer = 0 Dim ConceptoMovimiento = ObjMov.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, ConceptoContable, NombreProveedor, TxtObservaciones.Text, TxtFolio.Text.Trim) Dim FuncionalidadFluctuacionImpuestos As Boolean = If(UsuarioActual.Empresa.Funcionalidad(159) = "1", True, False) Dim TimpocambioGeneral As Decimal = 1 @@ -1899,8 +1898,8 @@ Partial Class Bancos_PopIECompras ImporteMovimiento = (MovimientoPagar.RetIVA * PorcentajePago) ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) End If - ImporteMovimiento = Math.Round(ImporteMovimiento, 2) - ImporteMX = Math.Round(ImporteMX, 2) + ImporteMovimiento = ImporteMovimiento.RoundSQL + ImporteMX = ImporteMX.RoundSQL TimpocambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) If tipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{tipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}" @@ -1932,8 +1931,8 @@ Partial Class Bancos_PopIECompras ImporteMovimiento = (MovimientoPagar.RetIVA * PorcentajePago) ImporteMX = ImporteMovimiento * tipoCambioCompra End If - ImporteMovimiento = Math.Round(ImporteMovimiento, 2) - ImporteMX = Math.Round(ImporteMX, 2) + ImporteMovimiento = ImporteMovimiento.RoundSQL + ImporteMX = ImporteMX.RoundSQL TimpocambioGeneral = tipoCambioCompra If tipoCambioCompra > 1 Then ConceptoMovimiento += $" TC:{tipoCambioCompra} ${ImporteMovimiento.FormatoNumero(2)}" @@ -1966,8 +1965,8 @@ Partial Class Bancos_PopIECompras ImporteMovimiento = (MovimientoPagar.RetIVA * PorcentajePago) ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) End If - ImporteMovimiento = Math.Round(ImporteMovimiento, 2) - ImporteMX = Math.Round(ImporteMX, 2) + ImporteMovimiento = ImporteMovimiento.RoundSQL + ImporteMX = ImporteMX.RoundSQL TimpocambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) If tipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{tipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}" @@ -2000,8 +1999,8 @@ Partial Class Bancos_PopIECompras ImporteMovimiento = (MovimientoPagar.RetIVA * PorcentajePago) ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) End If - ImporteMovimiento = Math.Round(ImporteMovimiento, 2) - ImporteMX = Math.Round(ImporteMX, 2) + ImporteMovimiento = ImporteMovimiento.RoundSQL + ImporteMX = ImporteMX.RoundSQL TimpocambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) If tipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{tipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}" @@ -2033,9 +2032,9 @@ Partial Class Bancos_PopIECompras ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then ImporteMovimiento = (MovimientoPagar.RetIVA * PorcentajePago) ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) - End If - ImporteMovimiento = Math.Round(ImporteMovimiento, 2) - ImporteMX = Math.Round(ImporteMX, 2) + End If + ImporteMovimiento = ImporteMovimiento.RoundSQL + ImporteMX = ImporteMX.RoundSQL TimpocambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) If tipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{tipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}" @@ -2069,8 +2068,8 @@ Partial Class Bancos_PopIECompras ImporteMovimiento = (MovimientoPagar.RetIVA * PorcentajePago) ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) End If - ImporteMovimiento = Math.Round(ImporteMovimiento, 2) - ImporteMX = Math.Round(ImporteMX, 2) + ImporteMovimiento = ImporteMovimiento.RoundSQL + ImporteMX = ImporteMX.RoundSQL TimpocambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) If tipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{tipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}" @@ -2103,8 +2102,8 @@ Partial Class Bancos_PopIECompras ImporteMovimiento = (MovimientoPagar.RetIVA * PorcentajePago) ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) End If - ImporteMovimiento = Math.Round(ImporteMovimiento, 2) - ImporteMX = Math.Round(ImporteMX, 2) + ImporteMovimiento = ImporteMovimiento.RoundSQL + ImporteMX = ImporteMX.RoundSQL TimpocambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) If tipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{tipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}" @@ -2156,17 +2155,7 @@ Partial Class Bancos_PopIECompras ' End If ' End If - ' 'Conta SIG - ' If CveCuentaRetISR <> 0 Then - ' CveCuenta = CveCuentaRetISR - ' Else - ' If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then - ' If ObjMov.DtResultados.Rows.Count > 0 Then - ' CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString.ToEntero - ' End If - ' End If - ' End If - ' End If + 'Case 23 'Ret ISR Acreditable ' If MovimientoPagar.ConceptoRetISR = 1 Then ' If CveMoneda = 1 AndAlso CveMonedaCompra = 1 Then @@ -2201,16 +2190,6 @@ Partial Class Bancos_PopIECompras ' End If ' End If - ' 'Conta SIG - ' If CveCuentaRetISR <> 0 Then - ' CveCuenta = CveCuentaRetISR - ' Else - ' If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then - ' If ObjMov.DtResultados.Rows.Count > 0 Then - ' CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString.ToEntero - ' End If - ' End If - ' End If ' End If 'Case 243 'Ret ISR X Acreditar Terceros y Arrendamiento ' If MovimientoPagar.ConceptoRetISR = 2 Then @@ -2246,16 +2225,7 @@ Partial Class Bancos_PopIECompras ' End If ' End If - ' 'Conta SIG - ' If CveCuentaRetISR <> 0 Then - ' CveCuenta = CveCuentaRetISR - ' Else - ' If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then - ' If ObjMov.DtResultados.Rows.Count > 0 Then - ' CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString.ToEntero - ' End If - ' End If - ' End If + ' End If 'Case 244 'Ret ISR Acreditable Terceros y Arrendamiento ' If MovimientoPagar.ConceptoRetISR = 2 Then @@ -2291,16 +2261,7 @@ Partial Class Bancos_PopIECompras ' End If ' End If - ' 'Conta SIG - ' If CveCuentaRetISR <> 0 Then - ' CveCuenta = CveCuentaRetISR - ' Else - ' If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then - ' If ObjMov.DtResultados.Rows.Count > 0 Then - ' CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString.ToEntero - ' End If - ' End If - ' End If + ' End If Case 14 'Iva por Acreditar If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then @@ -2331,8 +2292,8 @@ Partial Class Bancos_PopIECompras ImporteMovimiento = MovimientoPagar.IVA ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) End If - ImporteMovimiento = Math.Round(ImporteMovimiento, 2) - ImporteMX = Math.Round(ImporteMX, 2) + ImporteMovimiento = ImporteMovimiento.RoundSQL + ImporteMX = ImporteMX.RoundSQL TimpocambioGeneral = tipoCambioCompra If tipoCambioCompra > 1 Then ConceptoMovimiento += $" TC:{tipoCambioCompra} ${ImporteMovimiento.FormatoNumero(2)}" @@ -2343,20 +2304,20 @@ Partial Class Bancos_PopIECompras Else If CveMoneda = 1 AndAlso CveMonedaCompra = 1 Then 'ImporteMovimiento = MovimientoPagar.IVA * PorcentajePago - ImporteMovimiento = MovimientoPagar.IVAPorPagar * PorcentajePago + ImporteMovimiento = MovimientoPagar.IVA * PorcentajePago ImporteMX = ImporteMovimiento ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then - ImporteMovimiento = (MovimientoPagar.IVAPorPagar * PorcentajePago) + ImporteMovimiento = (MovimientoPagar.IVA * PorcentajePago) ImporteMX = ImporteMovimiento * tipoCambioCompra ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then - ImporteMovimiento = (MovimientoPagar.IVAPorPagar * PorcentajePago) + ImporteMovimiento = (MovimientoPagar.IVA * PorcentajePago) ImporteMX = ImporteMovimiento * tipoCambioCompra ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then - ImporteMovimiento = (MovimientoPagar.IVAPorPagar * PorcentajePago) + ImporteMovimiento = (MovimientoPagar.IVA * PorcentajePago) ImporteMX = ImporteMovimiento * tipoCambioCompra End If - ImporteMovimiento = Math.Round(ImporteMovimiento, 2) - ImporteMX = Math.Round(ImporteMX, 2) + ImporteMovimiento = ImporteMovimiento.RoundSQL + ImporteMX = ImporteMX.RoundSQL TimpocambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) If tipoCambioCompra > 1 Then ConceptoMovimiento += $" TC:{tipoCambioCompra} ${ImporteMovimiento.FormatoNumero(2)}" @@ -2409,8 +2370,8 @@ Partial Class Bancos_PopIECompras ImporteMovimiento = (MovimientoPagar.IVADeducible) ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) End If - ImporteMovimiento = Math.Round(ImporteMovimiento, 2) - ImporteMX = Math.Round(ImporteMX, 2) + ImporteMovimiento = ImporteMovimiento.RoundSQL + ImporteMX = ImporteMX.RoundSQL TimpocambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) If tipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{tipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}" @@ -2433,8 +2394,8 @@ Partial Class Bancos_PopIECompras ImporteMovimiento = (MovimientoPagar.IVADeducible * PorcentajePago) ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) End If - ImporteMovimiento = Math.Round(ImporteMovimiento, 2) - ImporteMX = Math.Round(ImporteMX, 2) + ImporteMovimiento = ImporteMovimiento.RoundSQL + ImporteMX = ImporteMX.RoundSQL TimpocambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) If tipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{tipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}" @@ -2517,7 +2478,6 @@ Partial Class Bancos_PopIECompras If ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then If ObjMov.DtResultados.Rows.Count > 0 Then IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaIVAAcreditable").ToString.ToEntero - CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaIVAAcreditableSIG").ToString.ToEntero End If End If @@ -2559,8 +2519,8 @@ Partial Class Bancos_PopIECompras ImporteMovimiento = MovimientoPagar.IVA ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) End If - ImporteMovimiento = Math.Round(ImporteMovimiento, 2) - ImporteMX = Math.Round(ImporteMX, 2) + ImporteMovimiento = ImporteMovimiento.RoundSQL + ImporteMX = ImporteMX.RoundSQL TimpocambioGeneral = tipoCambioCompra If tipoCambioCompra > 1 Then ConceptoMovimiento += $" TC:{tipoCambioCompra} ${ImporteMovimiento.FormatoNumero(2)}" @@ -2582,8 +2542,8 @@ Partial Class Bancos_PopIECompras ImporteMovimiento = (MovimientoPagar.IVA * PorcentajePago) ImporteMX = ImporteMovimiento * tipoCambioCompra End If - ImporteMovimiento = Math.Round(ImporteMovimiento, 2) - ImporteMX = Math.Round(ImporteMX, 2) + ImporteMovimiento = ImporteMovimiento.RoundSQL + ImporteMX = ImporteMX.RoundSQL TimpocambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) If tipoCambioCompra > 1 Then ConceptoMovimiento += $" TC:{tipoCambioCompra} ${ImporteMovimiento.FormatoNumero(2)}" @@ -2603,7 +2563,6 @@ Partial Class Bancos_PopIECompras If ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then If ObjMov.DtResultados.Rows.Count > 0 Then IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero - CveCuenta = ObjMov.DtResultados.Rows(0)("IdCtaContableSIG").ToString.ToEntero End If End If @@ -2745,7 +2704,6 @@ Partial Class Bancos_PopIECompras If ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then If ObjMov.DtResultados.Rows.Count > 0 Then IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero - CveCuenta = ObjMov.DtResultados.Rows(0)("IdCtaContableSIG").ToString.ToEntero End If End If @@ -2828,7 +2786,6 @@ Partial Class Bancos_PopIECompras ' If ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then ' If ObjMov.DtResultados.Rows.Count > 0 Then ' IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaIVAAcreditable").ToString.ToEntero - ' CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaIVAAcreditableSIG").ToString.ToEntero ' End If ' End If Case 25 'IEPS por Acreditar @@ -2888,7 +2845,6 @@ Partial Class Bancos_PopIECompras If CveMoneda <> 1 OrElse CveMonedaCompra <> 1 Then IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria - CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) TimpocambioGeneral = TCImpuestos '' si tiene funcionalidad de flucturación con ivas, tomar tipocambioCompra @@ -2914,7 +2870,6 @@ Partial Class Bancos_PopIECompras If CveMoneda <> 1 OrElse CveMonedaCompra <> 1 Then IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria - CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra) '' si tiene funcionalidad de flucturación con ivas, tomar tipocambioCompra If tipoCambioPago > tipoCambioCompra AndAlso CveMonedaCompra = 2 Then diff --git a/Bancos/PopIEVentas.aspx.vb b/Bancos/PopIEVentas.aspx.vb index aa604a144..9f38b7a6d 100644 --- a/Bancos/PopIEVentas.aspx.vb +++ b/Bancos/PopIEVentas.aspx.vb @@ -826,16 +826,8 @@ Partial Class Bancos_PopIEVentas ViewState("IdCtaContRetISR") = ObjCliente.IdCtaContRetISR ViewState("IdCtaAnticipo") = ObjCliente.IdCtaContAnticipos ViewState("IdCtaContMonedaExtranjeraAnticipo") = ObjCliente.IdCtaMonedaExtranjeraAnticipos - ViewState("IdCtaContMonedaComplementariaAnticipo") = ObjCliente.IdCtaContCompAnticipos - - 'Conta SIG - CveCuentaCliente = ObjCliente.CveCuentaClientes - ViewState("CveCuentaMonedaExtranjera") = ObjCliente.CveCuentaMonedaExtranjera - ViewState("CveCuentaComplementaria") = ObjCliente.CveCuentaComplementaria - ViewState("CveCuentaRetIVA") = ObjCliente.CveCuentaRetIVA - ViewState("CveCuentaRetISR") = ObjCliente.CveCuentaRetISR - ViewState("CveCuentaAnticipo") = ObjCliente.CveCuentaAnticipos - + ViewState("IdCtaContMonedaComplementariaAnticipo") = ObjCliente.IdCtaContCompAnticipos + Else Alert("El cliente solicitado no existe, por favor intente de nuevo.", TipoMensaje.MsgAdvertencia) End If @@ -1587,7 +1579,6 @@ Partial Class Bancos_PopIEVentas Dim ImporteMX As Decimal = 0 Dim ImporteCliente As Decimal = 0 Dim IdCtaContable As Integer = 0 - Dim CveCuenta As Integer = 0 Dim Referencia As String = TxtObservaciones.Text Dim FuncionalidadFluctuacionImpuestos As Boolean = If(UsuarioActual.Empresa.Funcionalidad(159) = "1", True, False) Dim TimpocambioGeneral As Decimal = 1 @@ -1596,8 +1587,8 @@ Partial Class Bancos_PopIEVentas Select Case ConceptoContable Case 2 'Pago Cliente - If RBLContado.SelectedValue.Contiene("3", "4", "5") Then - 'If CveMonedaVenta > 1 Then ConceptoContable = 292 + If RBLContado.SelectedValue.Contiene("3", "4", "5") Then + If CveMonedaVenta > 1 Then ConceptoContable = 292 For Each rw As GridViewRow In GvIngresos.Rows If rw.FCCheckBox("Chk").Checked Then If CveMoneda = 1 AndAlso CveMonedaVenta = 1 Then @@ -1620,31 +1611,28 @@ Partial Class Bancos_PopIEVentas CveIE = rw.DataKey("CveIE").ToString.ToEntero 'si la factura es en dólares y trae complementaria, el importemn debe ser igual al importe - If CveMonedaVenta <> 1 AndAlso (IdCtaContComplementaria > 0 Or UsuarioActual.CveEmpresa = 119) Then + If CveMonedaVenta <> 1 Then ImporteMX = ImporteMovimiento IdCtaContable = IdCtaContMonedaExtranjera Else IdCtaContable = IdCuentaCliente - CveCuenta = CveCuentaCliente End If TotalPagarCliente = ImporteMovimiento - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, ReferenciaConcepto, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, CveVenta, -1, CveSubProyectoContabilizar, CveCliente:=CveClienteOriginal, ImporteMX:=ImporteMX, CveCuenta:=CveCuenta, TipoCambio:=tipoCambioVentaValuacion, TipoCambioPago:=tipoCambioPago) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, ReferenciaConcepto, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, CveVenta, -1, CveSubProyectoContabilizar, CveCliente:=CveClienteOriginal, ImporteMX:=ImporteMX, TipoCambio:=tipoCambioVentaValuacion, TipoCambioPago:=tipoCambioPago) Then MsgError = "No se pudo insertar la póliza" End If If CveMonedaVenta = 2 Then IdCtaContable = IdCtaContComplementaria - CveCuenta = CveCuentaComplementaria - If ImporteMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsuarioActual.CveEmpresa = 119) Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, ReferenciaConcepto, 207, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, CveVenta, -1, CveSubProyectoContabilizar, If(ViewState("CveCliente") IsNot Nothing, ViewState("CveCliente").ToString.ToEntero, -1), ImporteMX:=ImporteMovimiento * tipoCambioVentaValuacion - ImporteMovimiento, CveCuenta:=CveCuenta, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioVentaValuacion) Then + If ImporteMovimiento <> 0 Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, ReferenciaConcepto, 207, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, CveVenta, -1, CveSubProyectoContabilizar, If(ViewState("CveCliente") IsNot Nothing, ViewState("CveCliente").ToString.ToEntero, -1), ImporteMX:=ImporteMovimiento * tipoCambioVentaValuacion - ImporteMovimiento, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioVentaValuacion) Then MsgError = "No se pudo insertar la póliza" End If TotalPagarCliente += Math.Round(ImporteMovimiento * tipoCambioVentaValuacion - ImporteMovimiento, 2) 'le agrego la complementario ImporteMX = ImporteMovimiento IdCtaContable = IdCtaContMonedaExtranjera - CveCuenta = CveCuentaMonedaExtranjera End If End If @@ -1677,25 +1665,22 @@ Partial Class Bancos_PopIEVentas IdCtaContable = IdCtaContMonedaExtranjera Else IdCtaContable = IdCuentaCliente - CveCuenta = CveCuentaCliente End If TotalPagarCliente = ImporteMovimiento - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, ReferenciaConcepto, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, CveVenta, -1, CveSubProyectoContabilizar, If(ViewState("CveCliente") IsNot Nothing, ViewState("CveCliente").ToString.ToEntero, -1), ImporteMX:=ImporteMX, CveCuenta:=CveCuenta, TipoCambio:=tipoCambioVentaValuacion, TipoCambioPago:=tipoCambioPago) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, ReferenciaConcepto, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, CveVenta, -1, CveSubProyectoContabilizar, If(ViewState("CveCliente") IsNot Nothing, ViewState("CveCliente").ToString.ToEntero, -1), ImporteMX:=ImporteMX, TipoCambio:=tipoCambioVentaValuacion, TipoCambioPago:=tipoCambioPago) Then MsgError = "No se pudo insertar la póliza" End If If CveMonedaVenta = 2 Then IdCtaContable = IdCtaContComplementaria - CveCuenta = CveCuentaComplementaria - If ImporteMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsuarioActual.CveEmpresa = 119) Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, ReferenciaConcepto, 207, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, CveVenta, -1, CveSubProyectoContabilizar, If(ViewState("CveCliente") IsNot Nothing, ViewState("CveCliente").ToString.ToEntero, -1), ImporteMX:=ImporteMovimiento * tipoCambioVentaValuacion - ImporteMovimiento, CveCuenta:=CveCuenta, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioVentaValuacion) Then + If ImporteMovimiento <> 0 Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, ReferenciaConcepto, 207, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, CveVenta, -1, CveSubProyectoContabilizar, If(ViewState("CveCliente") IsNot Nothing, ViewState("CveCliente").ToString.ToEntero, -1), ImporteMX:=ImporteMovimiento * tipoCambioVentaValuacion - ImporteMovimiento, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioVentaValuacion) Then MsgError = "No se pudo insertar la póliza" End If ImporteMX = ImporteMovimiento TotalPagarCliente += Math.Round(ImporteMovimiento * tipoCambioVentaValuacion - ImporteMovimiento, 2) 'le agrego la complementario IdCtaContable = IdCtaContMonedaExtranjera - CveCuenta = CveCuentaMonedaExtranjera End If End If End If @@ -1726,25 +1711,22 @@ Partial Class Bancos_PopIEVentas IdCtaContable = IdCtaContMonedaExtranjera Else IdCtaContable = IdCuentaCliente - CveCuenta = CveCuentaCliente End If TotalPagarCliente = ImporteMovimiento - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, CveVenta, rw.DataKey("CveCompra").ToEntero, CveSubProyectoContabilizar, If(ViewState("CveCliente") IsNot Nothing, ViewState("CveCliente").ToString.ToEntero, -1), ImporteMX:=ImporteMX, CveCuenta:=CveCuenta, TipoCambio:=tipoCambioVentaValuacion, TipoCambioPago:=tipoCambioPago) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, CveVenta, rw.DataKey("CveCompra").ToEntero, CveSubProyectoContabilizar, If(ViewState("CveCliente") IsNot Nothing, ViewState("CveCliente").ToString.ToEntero, -1), ImporteMX:=ImporteMX, TipoCambio:=tipoCambioVentaValuacion, TipoCambioPago:=tipoCambioPago) Then MsgError = "No se pudo insertar la póliza" End If If CveMonedaVenta = 2 Then IdCtaContable = IdCtaContComplementaria - CveCuenta = CveCuentaComplementaria - If ImporteMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsuarioActual.CveEmpresa = 119) Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, rw.FCLiteral("LtlFolio").Text, 207, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, CveVenta, rw.DataKey("CveCompra").ToEntero, CveSubProyectoContabilizar, If(ViewState("CveCliente") IsNot Nothing, ViewState("CveCliente").ToString.ToEntero, -1), ImporteMX:=ImporteMovimiento * tipoCambioVentaValuacion - ImporteMovimiento, CveCuenta:=CveCuenta, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioVentaValuacion) Then + If ImporteMovimiento <> 0 Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, rw.FCLiteral("LtlFolio").Text, 207, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, CveVenta, rw.DataKey("CveCompra").ToEntero, CveSubProyectoContabilizar, If(ViewState("CveCliente") IsNot Nothing, ViewState("CveCliente").ToString.ToEntero, -1), ImporteMX:=ImporteMovimiento * tipoCambioVentaValuacion - ImporteMovimiento, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioVentaValuacion) Then MsgError = "No se pudo insertar la póliza" End If ImporteMX = ImporteMovimiento TotalPagarCliente += Math.Round(ImporteMovimiento * tipoCambioVentaValuacion - ImporteMovimiento, 2) 'le agrego la complementario IdCtaContable = IdCtaContMonedaExtranjera - CveCuenta = CveCuentaMonedaExtranjera End If End If @@ -1775,19 +1757,16 @@ Partial Class Bancos_PopIEVentas If CveMonedaVenta = 1 Then IdCtaContable = IdCuentaCliente - CveCuenta = CveCuentaCliente Else IdCtaContable = IdCtaContComplementaria - CveCuenta = CveCuentaComplementaria CveSubProyectoContabilizar = CveSubProyectoVenta - If ImporteMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsuarioActual.CveEmpresa = 119) Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, ReferenciaConcepto, 207, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, CveVenta, -1, CveSubProyectoContabilizar, If(ViewState("CveCliente") IsNot Nothing, ViewState("CveCliente").ToString.ToEntero, -1), ImporteMX:=ImporteMovimiento * tipoCambioVentaValuacion - ImporteMovimiento, CveCuenta:=CveCuenta, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioVentaValuacion) Then + If ImporteMovimiento <> 0 Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, ReferenciaConcepto, 207, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, CveVenta, -1, CveSubProyectoContabilizar, If(ViewState("CveCliente") IsNot Nothing, ViewState("CveCliente").ToString.ToEntero, -1), ImporteMX:=ImporteMovimiento * tipoCambioVentaValuacion - ImporteMovimiento, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioVentaValuacion) Then MsgError = "No se pudo insertar la póliza" End If ImporteMX = ImporteMovimiento TotalPagarCliente += Math.Round(ImporteMovimiento * tipoCambioVentaValuacion - ImporteMovimiento, 2) 'le agrego la complementario IdCtaContable = IdCtaContMonedaExtranjera - CveCuenta = CveCuentaMonedaExtranjera End If End If Case 8 'Ret IVA @@ -1822,19 +1801,8 @@ Partial Class Bancos_PopIEVentas IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero End If End If - End If - - 'Conta SIG - If CveCuentaRetIVA <> 0 Then - CveCuenta = CveCuentaRetIVA - Else - If ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then - If ObjMov.DtResultados.Rows.Count > 0 Then - CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacionSIG").ToString.ToEntero - End If - End If - End If - + End If + Case 9 'Ret ISR If CveMoneda = 1 AndAlso CveMonedaVenta = 1 Then ImporteMovimiento = MovimientoPagar.RetISR * PorcentajePago @@ -1867,19 +1835,8 @@ Partial Class Bancos_PopIEVentas IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero End If End If - End If - - 'Conta SIG - If CveCuentaRetISR <> 0 Then - CveCuenta = CveCuentaRetISR - Else - If ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then - If ObjMov.DtResultados.Rows.Count > 0 Then - CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString.ToEntero - End If - End If - End If - + End If + Case 13 'Iva por Trasladar If CveMoneda = 1 AndAlso CveMonedaVenta = 1 Then ImporteMovimiento = MovimientoPagar.IVA * PorcentajePago @@ -1905,16 +1862,13 @@ Partial Class Bancos_PopIEVentas PorcentajeImpuesto = MovimientoPagar.PorcentajeIVA - Dim IdCtaIVAXTrasladar As Integer = 0 - Dim CveCuentaIVAxTrasladar As Integer = 0 - + Dim IdCtaIVAXTrasladar As Integer = 0 + If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows.Count > 0 Then IdCtaIVAXTrasladar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAXTrasladar").ToString.ToEntero - CveCuentaIVAxTrasladar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("CveCuentaIVAXTrasladar").ToString.ToEntero End If IdCtaContable = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar) - CveCuenta = If(CveCuentaIVAxTrasladar > 0, CveCuentaIVAxTrasladar, UsuarioActual.Empresa.CveCuentaIVAxTrasladar) Case 61 'Iva Trasladado If CveMoneda = 1 AndAlso CveMonedaVenta = 1 Then @@ -1941,15 +1895,12 @@ Partial Class Bancos_PopIEVentas PorcentajeImpuesto = MovimientoPagar.PorcentajeIVA Dim IdCtaIVATrasladado As Integer = 0 - Dim CveCuentaIVATrasladado As Integer = 0 If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows.Count > 0 Then IdCtaIVATrasladado = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVATrasladado").ToString.ToEntero - CveCuentaIVATrasladado = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("CveCuentaIVATrasladado").ToString.ToEntero End If IdCtaContable = If(IdCtaIVATrasladado > 0, IdCtaIVATrasladado, UsuarioActual.Empresa.IdCuentaIVATrasladado) - CveCuenta = If(CveCuentaIVATrasladado > 0, CveCuentaIVATrasladado, UsuarioActual.Empresa.CveCuentaIVATrasladado) Case 38 'IEPS por trasladar If CveMoneda = 1 AndAlso CveMonedaVenta = 1 Then @@ -1975,7 +1926,6 @@ Partial Class Bancos_PopIEVentas If ImporteMovimiento > 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then If ObjMov.DtResultados.Rows.Count > 0 Then IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSxTrasladar").ToString.ToEntero - CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSxTrasladarSIG").ToString.ToEntero End If End If @@ -2004,7 +1954,6 @@ Partial Class Bancos_PopIEVentas If ImporteMovimiento > 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then If ObjMov.DtResultados.Rows.Count > 0 Then IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSTrasladado").ToString.ToEntero - CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSTrasladadoSIG").ToString.ToEntero End If End If @@ -2041,19 +1990,8 @@ Partial Class Bancos_PopIEVentas IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero End If End If - End If - - 'Conta SIG - If CveCuentaRetIVA <> 0 Then - CveCuenta = CveCuentaRetIVA - Else - If ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then - If ObjMov.DtResultados.Rows.Count > 0 Then - CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacionSIG").ToString.ToEntero - End If - End If - End If - + End If + Case 63 'Ret ISR Trasladado If CveMoneda = 1 AndAlso CveMonedaVenta = 1 Then ImporteMovimiento = MovimientoPagar.RetISR * PorcentajePago @@ -2087,23 +2025,11 @@ Partial Class Bancos_PopIEVentas IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero End If End If - End If - - 'Conta SIG - If CveCuentaRetISR <> 0 Then - CveCuenta = CveCuentaRetISR - Else - If ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then - If ObjMov.DtResultados.Rows.Count > 0 Then - CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString.ToEntero - End If - End If - End If - + End If + Case 64 'Ganancia If CveMoneda <> 1 OrElse CveMonedaVenta <> 1 Then IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria - CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria Dim tImporteVenta, tImportePago, Diferencia As Decimal ImporteMovimiento = 0 @@ -2210,17 +2136,14 @@ Partial Class Bancos_PopIEVentas If CveMoneda = 1 Then IdCtaContable = IdCuentaBancaria - CveCuenta = CveCuentaCliente Else IdCtaContable = IdCuentaBancariaComplementaria - CveCuenta = CveCuentaComplementaria If ImporteMovimiento <> 0 AndAlso IdCtaContable > 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, ObjIE.Folio, 204, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, CveVenta, -1, -1, If(ViewState("CveCliente") IsNot Nothing, ViewState("CveCliente").ToString.ToEntero, -1), ImporteMX:=ImporteMovimiento * tipoCambioPago - ImporteMovimiento, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioPago, CveCuenta:=CveCuenta) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, ObjIE.Folio, 204, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, CveVenta, -1, -1, If(ViewState("CveCliente") IsNot Nothing, ViewState("CveCliente").ToString.ToEntero, -1), ImporteMX:=ImporteMovimiento * tipoCambioPago - ImporteMovimiento, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioPago) Then MsgError = "No se pudo insertar la póliza" End If ImporteMX = ImporteMovimiento IdCtaContable = IdCuentaBancaria - CveCuenta = CveCuentaMonedaExtranjera TotalPagarCliente += Math.Round(ImporteMovimiento * tipoCambioPago - ImporteMovimiento, 2) End If End If @@ -2255,10 +2178,8 @@ Partial Class Bancos_PopIEVentas If CveMoneda = 2 Then ImporteMX = ImporteMovimiento IdCtaContable = IdCtaContMonedaExtranjeraAnticipo - CveCuenta = CveCuentaMonedaExtranjera Else IdCtaContable = IdCtaAnticipo - CveCuenta = CveCuentaAnticipo End If TotalPagarCliente = ImporteMovimiento @@ -2354,7 +2275,7 @@ Partial Class Bancos_PopIEVentas CveIE = rw.DataKey("CveIE").ToString.ToEntero - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, ReferenciaConcepto, ConceptoContable, ConceptoMovimiento, Fecha, rw.DataKey("IdCtaContDeudor").ToString.ToEntero, -1, CveIE, CveVenta:=CveVenta, CveProveedor:=CveProveedor2, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, ReferenciaConcepto, ConceptoContable, ConceptoMovimiento, Fecha, rw.DataKey("IdCtaContDeudor").ToString.ToEntero, -1, CveIE, CveVenta:=CveVenta, CveProveedor:=CveProveedor2, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, CveSubProyecto:=CveSubProyectoContabilizar) Then MsgError = "No se pudo insertar la póliza" End If End If @@ -2435,29 +2356,26 @@ Partial Class Bancos_PopIEVentas ImporteMX = Math.Round(ImporteMX, 2) 'si la factura es en dólares y trae complementaria, el importemn debe ser igual al importe - If rw.DataKey("CveMoneda").ToEntero <> 1 AndAlso (IdCtaContComplementaria > 0 Or UsuarioActual.CveEmpresa = 119) Then + If rw.DataKey("CveMoneda").ToEntero <> 1 Then ImporteMX = ImporteMovimiento IdCtaContable = IdCtaContComplementariaProveedor Else IdCtaContable = CtaProveedor - CveCuenta = CveCuentaProveedor End If - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, 275, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveVenta:=CveVenta, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, ImporteMX:=ImporteMX, CveCuenta:=CveCuenta, TipoCambio:=tipoCambioPago) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, 275, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveVenta:=CveVenta, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, ImporteMX:=ImporteMX, TipoCambio:=tipoCambioPago) Then MsgError = "No se pudo insertar la póliza" End If If rw.DataKey("CveMoneda").ToEntero = 2 Then IdCtaContable = IdCtaProveedorExtranjera - CveCuenta = CveCuentaProveedorExtranjera - If ImporteMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsuarioActual.CveEmpresa = 119) Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, rw.FCLiteral("LtlFolio").Text, 206, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, CveVenta:=CveVenta, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMovimiento * tipoCambioPago - ImporteMovimiento, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioPago, CveCuenta:=CveCuenta) Then + If ImporteMovimiento <> 0 Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, rw.FCLiteral("LtlFolio").Text, 206, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, CveVenta:=CveVenta, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMovimiento * tipoCambioPago - ImporteMovimiento, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioPago) Then MsgError = "No se pudo insertar la póliza" End If End If ImporteMX = ImporteMovimiento IdCtaContable = IdCtaContMonedaExtranjera - CveCuenta = CveCuentaMonedaExtranjera End If End If @@ -2500,21 +2418,10 @@ Partial Class Bancos_PopIEVentas IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero End If End If - End If - - 'Conta SIG - If CveCuentaRetIVAProveedor <> 0 Then - CveCuenta = CveCuentaRetIVAProveedor - Else - If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then - If ObjMov.DtResultados.Rows.Count > 0 Then - CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacionSIG").ToString.ToEntero - End If - End If - End If - + End If + If ImporteMovimiento > 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveVenta:=CveVenta, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, CveCuenta:=CveCuenta, TipoCambio:=rw.DataKey("TipoCambio").ToString.ToDecimal) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveVenta:=CveVenta, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, TipoCambio:=rw.DataKey("TipoCambio").ToString.ToDecimal) Then MsgError = "No se pudo insertar la póliza" End If End If @@ -2564,7 +2471,7 @@ Partial Class Bancos_PopIEVentas End If If ImporteMovimiento > 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveVenta:=CveVenta, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, CveCuenta:=CveCuenta, TipoCambio:=If(FuncionalidadFluctuacionImpuestos, rw.DataKey("TipoCambio").ToString.ToDecimal, tipoCambioPago)) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveVenta:=CveVenta, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, TipoCambio:=If(FuncionalidadFluctuacionImpuestos, rw.DataKey("TipoCambio").ToString.ToDecimal, tipoCambioPago)) Then MsgError = "No se pudo insertar la póliza" End If End If @@ -2610,21 +2517,10 @@ Partial Class Bancos_PopIEVentas IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero End If End If - End If - - 'Conta SIG - If CveCuentaRetIVAProveedor <> 0 Then - CveCuenta = CveCuentaRetIVAProveedor - Else - If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then - If ObjMov.DtResultados.Rows.Count > 0 Then - CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacionSIG").ToString.ToEntero - End If - End If - End If - + End If + If ImporteMovimiento > 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveVenta:=CveVenta, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, CveCuenta:=CveCuenta, TipoCambio:=rw.DataKey("TipoCambio").ToString.ToDecimal) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveVenta:=CveVenta, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, TipoCambio:=rw.DataKey("TipoCambio").ToString.ToDecimal) Then MsgError = "No se pudo insertar la póliza" End If End If @@ -2673,7 +2569,7 @@ Partial Class Bancos_PopIEVentas If ImporteMovimiento > 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveVenta:=CveVenta, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, CveCuenta:=CveCuenta, TipoCambio:=If(FuncionalidadFluctuacionImpuestos, rw.DataKey("TipoCambio").ToString.ToDecimal, tipoCambioPago)) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveVenta:=CveVenta, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, TipoCambio:=If(FuncionalidadFluctuacionImpuestos, rw.DataKey("TipoCambio").ToString.ToDecimal, tipoCambioPago)) Then MsgError = "No se pudo insertar la póliza" End If End If @@ -2721,20 +2617,8 @@ Partial Class Bancos_PopIEVentas End If End If - 'Conta SIG - If CveCuentaRetIVAProveedor <> 0 Then - CveCuenta = CveCuentaRetIVAProveedor - Else - If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then - If ObjMov.DtResultados.Rows.Count > 0 Then - CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacionSIG").ToString.ToEntero - End If - End If - End If - - If ImporteMovimiento > 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveVenta:=CveVenta, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, CveCuenta:=CveCuenta, TipoCambio:=rw.DataKey("TipoCambio").ToString.ToDecimal) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveVenta:=CveVenta, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, TipoCambio:=rw.DataKey("TipoCambio").ToString.ToDecimal) Then MsgError = "No se pudo insertar la póliza" End If End If @@ -2780,11 +2664,10 @@ Partial Class Bancos_PopIEVentas IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero End If End If - End If - - + End If + If ImporteMovimiento > 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveVenta:=CveVenta, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, CveCuenta:=CveCuenta, TipoCambio:=If(FuncionalidadFluctuacionImpuestos, rw.DataKey("TipoCambio").ToString.ToDecimal, tipoCambioPago)) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveVenta:=CveVenta, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, TipoCambio:=If(FuncionalidadFluctuacionImpuestos, rw.DataKey("TipoCambio").ToString.ToDecimal, tipoCambioPago)) Then MsgError = "No se pudo insertar la póliza" End If End If @@ -2833,7 +2716,7 @@ Partial Class Bancos_PopIEVentas If ImporteMovimiento > 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveVenta:=CveVenta, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, CveCuenta:=CveCuenta, TipoCambio:=If(FuncionalidadFluctuacionImpuestos, rw.DataKey("TipoCambio").ToString.ToDecimal, tipoCambioPago)) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveVenta:=CveVenta, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, TipoCambio:=If(FuncionalidadFluctuacionImpuestos, rw.DataKey("TipoCambio").ToString.ToDecimal, tipoCambioPago)) Then MsgError = "No se pudo insertar la póliza" End If End If @@ -2882,7 +2765,7 @@ Partial Class Bancos_PopIEVentas If ImporteMovimiento > 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveVenta:=CveVenta, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, CveCuenta:=CveCuenta, TipoCambio:=If(FuncionalidadFluctuacionImpuestos, rw.DataKey("TipoCambio").ToString.ToDecimal, tipoCambioPago)) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveVenta:=CveVenta, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, TipoCambio:=If(FuncionalidadFluctuacionImpuestos, rw.DataKey("TipoCambio").ToString.ToDecimal, tipoCambioPago)) Then MsgError = "No se pudo insertar la póliza" End If End If @@ -2942,7 +2825,7 @@ Partial Class Bancos_PopIEVentas ' End If ' If ImporteMovimiento > 0 Then - ' If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveVenta:=CveVenta, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, CveCuenta:=CveCuenta, TipoCambio:=rw.DataKey("TipoCambio").ToString.ToDecimal) Then + ' If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveVenta:=CveVenta, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, TipoCambio:=rw.DataKey("TipoCambio").ToString.ToDecimal) Then ' MsgError = "No se pudo insertar la póliza" ' End If ' End If @@ -2990,20 +2873,10 @@ Partial Class Bancos_PopIEVentas ' End If ' End If - ' 'Conta SIG - ' If CveCuentaRetISRProveedor <> 0 Then - ' CveCuenta = CveCuentaRetISRProveedor - ' Else - ' If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then - ' If ObjMov.DtResultados.Rows.Count > 0 Then - ' CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString.ToEntero - ' End If - ' End If - ' End If ' If ImporteMovimiento > 0 Then - ' If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveVenta:=CveVenta, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, CveCuenta:=CveCuenta, TipoCambio:=If(FuncionalidadFluctuacionImpuestos, rw.DataKey("TipoCambio").ToString.ToDecimal, tipoCambioPago)) Then + ' If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveVenta:=CveVenta, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, TipoCambio:=If(FuncionalidadFluctuacionImpuestos, rw.DataKey("TipoCambio").ToString.ToDecimal, tipoCambioPago)) Then ' MsgError = "No se pudo insertar la póliza" ' End If ' End If @@ -3050,19 +2923,9 @@ Partial Class Bancos_PopIEVentas ' End If ' End If - ' 'Conta SIG - ' If CveCuentaRetISRProveedor <> 0 Then - ' CveCuenta = CveCuentaRetISRProveedor - ' Else - ' If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then - ' If ObjMov.DtResultados.Rows.Count > 0 Then - ' CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString.ToEntero - ' End If - ' End If - ' End If ' If ImporteMovimiento > 0 Then - ' If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveVenta:=CveVenta, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, CveCuenta:=CveCuenta, TipoCambio:=rw.DataKey("TipoCambio").ToString.ToDecimal) Then + ' If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveVenta:=CveVenta, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, TipoCambio:=rw.DataKey("TipoCambio").ToString.ToDecimal) Then ' MsgError = "No se pudo insertar la póliza" ' End If ' End If @@ -3110,20 +2973,8 @@ Partial Class Bancos_PopIEVentas ' End If ' End If - ' 'Conta SIG - ' If CveCuentaRetISRProveedor <> 0 Then - ' CveCuenta = CveCuentaRetISRProveedor - ' Else - ' If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then - ' If ObjMov.DtResultados.Rows.Count > 0 Then - ' CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString.ToEntero - ' End If - ' End If - ' End If - - ' If ImporteMovimiento > 0 Then - ' If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveVenta:=CveVenta, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, CveCuenta:=CveCuenta, TipoCambio:=If(FuncionalidadFluctuacionImpuestos, rw.DataKey("TipoCambio").ToString.ToDecimal, tipoCambioPago)) Then + ' If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveVenta:=CveVenta, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, TipoCambio:=If(FuncionalidadFluctuacionImpuestos, rw.DataKey("TipoCambio").ToString.ToDecimal, tipoCambioPago)) Then ' MsgError = "No se pudo insertar la póliza" ' End If ' End If @@ -3206,13 +3057,12 @@ Partial Class Bancos_PopIEVentas If ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then If ObjMov.DtResultados.Rows.Count > 0 Then IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaIVAxAcreditar").ToString.ToEntero - CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaIVAxAcreditarSIG").ToString.ToEntero End If End If If ImporteMovimiento > 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, CveCuenta:=CveCuenta, TipoCambio:=rw.DataKey("TipoCambio").ToString.ToDecimal, PorcentajeImpuesto:=PorcentajeImpuesto) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, TipoCambio:=rw.DataKey("TipoCambio").ToString.ToDecimal, PorcentajeImpuesto:=PorcentajeImpuesto) Then MsgError = "No se pudo insertar la póliza" End If End If @@ -3294,12 +3144,11 @@ Partial Class Bancos_PopIEVentas If ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then If ObjMov.DtResultados.Rows.Count > 0 Then IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaIVAAcreditable").ToString.ToEntero - CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaIVAAcreditable").ToString.ToEntero End If End If If ImporteMovimiento > 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, CveCuenta:=CveCuenta, TipoCambio:=If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, rw.DataKey("TipoCambio").ToString.ToDecimal), PorcentajeImpuesto:=PorcentajeImpuesto) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, TipoCambio:=If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, rw.DataKey("TipoCambio").ToString.ToDecimal), PorcentajeImpuesto:=PorcentajeImpuesto) Then MsgError = "No se pudo insertar la póliza" End If End If @@ -3380,12 +3229,11 @@ Partial Class Bancos_PopIEVentas If ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then If ObjMov.DtResultados.Rows.Count > 0 Then IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaIVAAcreditable").ToString.ToEntero - CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaIVAAcreditable").ToString.ToEntero End If End If If ImporteMovimiento > 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, CveCuenta:=CveCuenta, TipoCambio:=If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, rw.DataKey("TipoCambio").ToString.ToDecimal), PorcentajeImpuesto:=PorcentajeImpuesto) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, TipoCambio:=If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, rw.DataKey("TipoCambio").ToString.ToDecimal), PorcentajeImpuesto:=PorcentajeImpuesto) Then MsgError = "No se pudo insertar la póliza" End If End If @@ -3419,12 +3267,11 @@ Partial Class Bancos_PopIEVentas If ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then If ObjMov.DtResultados.Rows.Count > 0 Then IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSxAcreditar").ToString.ToEntero - CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSxAcreditarSIG").ToString.ToEntero End If End If If ImporteMovimiento > 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, CveCuenta:=CveCuenta, TipoCambio:=rw.DataKey("TipoCambio").ToString.ToDecimal) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, TipoCambio:=rw.DataKey("TipoCambio").ToString.ToDecimal) Then MsgError = "No se pudo insertar la póliza" End If End If @@ -3458,12 +3305,11 @@ Partial Class Bancos_PopIEVentas If ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then If ObjMov.DtResultados.Rows.Count > 0 Then IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSAcreditable").ToString.ToEntero - CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSAcreditableSIG").ToString.ToEntero End If End If If ImporteMovimiento > 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, CveCuenta:=CveCuenta, TipoCambio:=If(FuncionalidadFluctuacionImpuestos, rw.DataKey("TipoCambio").ToString.ToDecimal, tipoCambioPago)) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, rw.FCLiteral("LtlFolio").Text, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, -1, CveCompra:=rw.DataKey("CveCompra").ToString.ToEntero, CveProveedor:=rw.DataKey("CveProveedor").ToString.ToEntero, CvePersonal:=CvePersonal, ImporteMX:=ImporteMX, TipoCambio:=If(FuncionalidadFluctuacionImpuestos, rw.DataKey("TipoCambio").ToString.ToDecimal, tipoCambioPago)) Then MsgError = "No se pudo insertar la póliza" End If End If @@ -3483,7 +3329,7 @@ Partial Class Bancos_PopIEVentas idCuentaContabilizacion = 0 End If - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, ReferenciaConcepto, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, CveVenta, -1, CveSubProyectoContabilizar, CveCliente:=CveClienteOriginal, ImporteMX:=ImporteMX, CveCuenta:=CveCuenta, CvePersonal:=CvePersonal, TipoCambio:=TimpocambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuesto) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, ReferenciaConcepto, ConceptoContable, ConceptoMovimiento, Fecha, IdCtaContable, -1, CveIE, CveVenta, -1, CveSubProyectoContabilizar, CveCliente:=CveClienteOriginal, ImporteMX:=ImporteMX, CvePersonal:=CvePersonal, TipoCambio:=TimpocambioGeneral, TipoCambioPago:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuesto) Then MsgError = "No se pudo insertar la póliza" Exit For End If diff --git a/Bancos/ProveedoresAbonar.aspx.vb b/Bancos/ProveedoresAbonar.aspx.vb index 10bdfd99c..056bb2fd1 100644 --- a/Bancos/ProveedoresAbonar.aspx.vb +++ b/Bancos/ProveedoresAbonar.aspx.vb @@ -1575,8 +1575,7 @@ Partial Class Bancos_ProveedoresAbonar importeMX = 0 End If Else - ImporteMovimiento = gvr.DataKey("IVAPorPagar").ToDecimal * PorcentajePago - + ImporteMovimiento = gvr.DataKey("IVA").ToDecimal * PorcentajePago If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then importeMX = ImporteMovimiento diff --git a/Bin/ClosedXML.dll b/Bin/ClosedXML.dll index 4065a321f..0bdfccd36 100644 Binary files a/Bin/ClosedXML.dll and b/Bin/ClosedXML.dll differ diff --git a/Bin/DocumentFormat.OpenXml.dll b/Bin/DocumentFormat.OpenXml.dll index 1698758e5..7978b0462 100644 Binary files a/Bin/DocumentFormat.OpenXml.dll and b/Bin/DocumentFormat.OpenXml.dll differ diff --git a/CRM/Acercamiento.aspx b/CRM/Acercamiento.aspx index bb3e9389d..2a0b2c928 100644 --- a/CRM/Acercamiento.aspx +++ b/CRM/Acercamiento.aspx @@ -996,7 +996,7 @@
diff --git a/CRM/Acercamiento.aspx.cs b/CRM/Acercamiento.aspx.cs index a0050887d..ad05f2e5d 100644 --- a/CRM/Acercamiento.aspx.cs +++ b/CRM/Acercamiento.aspx.cs @@ -1027,6 +1027,19 @@ public partial class CRM_Acercamiento : ClsPaginas Archivo = null; } + protected void EliminarFile(object sender, EventArgs e) + { + string cveEvento = string.Format("{0}",((LinkButton)sender).CommandArgument); + ClsOIEventos ObjEventoBitacora = new ClsOIEventos(); + ObjEventoBitacora.RemoveAgendaBitacora( cveEvento.ToEntero(), UsuarioActual.CveEmpresa); + ObjEventoBitacora.Dispose(); + UPAddEventoBitacora.Update(); + + //RECARGAMOS GRID BITACORA + CargaEventoBitacora(HdfEtapaSeleccionada.Value.ToEntero()); + UPBitacora.Update(); + } + protected void BtnGuardarEventoBitacora_Click(object sender, EventArgs e) { ClsOIEventos ObjEventoBitacora = new ClsOIEventos(); @@ -1109,6 +1122,9 @@ public partial class CRM_Acercamiento : ClsPaginas ScriptManager.GetCurrent(this).RegisterPostBackControl(e.Item.FindControl("LinkArchivo")); // Registro un evento Postbacktrigger, que recargue toda la pagina para que funcione ((Label)e.Item.FindControl("LblTipoArchivo")).Text = row["Archivo"].ToString().Split('.')[1].ToUpper(); + + ((LinkButton)e.Item.FindControl("LinkDelete")).CommandArgument = row["CveEvento"].ToString(); + } } diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 8ca21fd06..14ef4ef01 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -8343,9 +8343,9 @@ Partial Class Compras_Compras 'ACTUALIZA CVEFACTURA If Request("CveFactura") IsNot Nothing Then - If Not ObjCompras.UpdateCompraFactura(CveCompra, Request("CveFactura").ToEntero, TxtSerie.Text.Trim, TxtFolio.Text.Trim) Then - TieneError = True - End If + 'If Not ObjCompras.UpdateCompraFactura(CveCompra, Request("CveFactura").ToEntero, TxtSerie.Text.Trim, TxtFolio.Text.Trim) Then + ' TieneError = True + 'End If If UsuarioActual.Empresa.UsaAC Then MsgAccionAceptar = String.Format("window.opener.location.href = window.opener.location.href; window.open(""/Contabilidad/RegPoliza.aspx?IdPoliza={0}""); window.close();", IdPoliza) @@ -10357,7 +10357,7 @@ Partial Class Compras_Compras Dim CveProveedorConcepto As Integer = 0, CveIE As Integer = 0, CveCreditoDetalle As Integer = 0 Dim ConceptoPersonal As String = "", Concepto As String = "" - If Not ObjConta.GetPrePolizasDetalle(CvePrePoliza) Then + If Not ObjConta.GetPrePolizasDetalle(CvePrePoliza, UsuarioActual.CveEmpresa) Then ErrorPrepoliza = True Else If ObjConta.DtResultados.FiltraParametros("CveConceptoContable IN (6,68,49,205,176)").Rows.Count > 0 Then @@ -15010,7 +15010,7 @@ Partial Class Compras_Compras End If Else If CvePrePoliza > 0 Then - If ObjContabilidad.GetPrePolizasDetalle(CvePrePoliza) Then + If ObjContabilidad.GetPrePolizasDetalle(CvePrePoliza, UsuarioActual.CveEmpresa) Then dt = ObjContabilidad.DtResultados CvePrePolizaNueva = ObjContabilidad.AddPrePolizas("Compras/Cancelar", dt.Rows(0)("CvePlantillaPoliza").ToString.ToEntero, dt.Rows(0)("Cargos").ToString.ToDouble * -1, dt.Rows(0)("Abonos").ToString.ToDouble * -1, dt.Rows(0)("CveMoneda").ToString.ToEntero, TxtFechaCancelacion.Text.ToDate, String.Format("Cancelación: {0}", dt.Rows(0)("Concepto").ToString), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) @@ -15062,11 +15062,11 @@ Partial Class Compras_Compras 'LIMPIA PRE-POLIZA PONIENDO IMPORTE EN CEROS If CvePrePoliza > 0 Then - If ObjContabilidad.GetPrePolizasDetalle(CvePrePoliza) Then + If ObjContabilidad.GetPrePolizasDetalle(CvePrePoliza, UsuarioActual.CveEmpresa) Then dt = ObjContabilidad.DtResultados For Each dr As DataRow In dt.Rows - If Not ObjContabilidad.UpdatePrepolizasDetalle(dr("CvePrePolizaDetalle").ToString.ToEntero, dr("Concepto").ToString, dr("CveSubProyecto").ToString.ToEntero, dr("IdCtaContable").ToString.ToEntero, CBool(dr("TipoMovto").ToString), 0, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then + If Not ObjContabilidad.UpdatePrePolizasDetalle(dr("CvePrePolizaDetalle").ToString.ToEntero, dr("Concepto").ToString, dr("CveSubProyecto").ToString.ToEntero, dr("IdCtaContable").ToString.ToEntero, CBool(dr("TipoMovto").ToString), 0, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then ErrorCancelar = True : Exit For End If Next @@ -18689,7 +18689,7 @@ Partial Class Compras_Compras TmpDT.Rows(HdnAliasInd.Value.ToEntero)("CveClasificacion") = HdnPSAliasCveClasificacion.Value.ToEntero TmpDT.Rows(HdnAliasInd.Value.ToEntero)("Clasificacion") = HdnPSAliasClasificacion.Value TmpDT.Rows(HdnAliasInd.Value.ToEntero)("Obs") = TxtPSAlias.Text.Trim - TmpDT.Rows(HdnAliasInd.Value.ToEntero)("CveSATPS") = HdnPSAliasCveSATPS.Value + TmpDT.Rows(HdnAliasInd.Value.ToEntero)("CveSATPS") = HdnPSAliasCveSATPS.Value.ToEntero TmpDT.Rows(HdnAliasInd.Value.ToEntero)("SATClaveProductoServicio") = HdnPSAliasSATClavePS.Value 'busco si el producto está en otros renglones QUE NO LO TENGAN ASIGNADO, LO VINCULE @@ -18701,7 +18701,7 @@ Partial Class Compras_Compras drt("CveClasificacion") = HdnPSAliasCveClasificacion.Value.ToEntero drt("Clasificacion") = HdnPSAliasClasificacion.Value drt("Obs") = TxtPSAlias.Text.Trim - drt("CveSATPS") = HdnPSAliasCveSATPS.Value + drt("CveSATPS") = HdnPSAliasCveSATPS.Value.ToEntero drt("SATClaveProductoServicio") = HdnPSAliasSATClavePS.Value Next @@ -18710,14 +18710,12 @@ Partial Class Compras_Compras GvPS.DataBind() UpPS.Update() - Alert("Registro actualizado con exito.", TipoMensaje.MsgInformacion) + Alert("Registro actualizado con éxito.", TipoMensaje.MsgInformacion) RegistraScript("$('#ModalPSAlias').modal('hide');", "ModalPSAliasHide") End If PS.Dispose() - - End Sub Private Sub RecargaGlobalEquivalencias() diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index 29ddcca3a..4b94f49f8 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -2310,16 +2310,16 @@ Partial Class PopUpVerFactura Dim Archivo As New System.IO.FileInfo(String.Format(RutaFormato, UsuarioActual.Empresa.Ruta)) - If Archivo.Exists Then + If Archivo.Exists Then + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + + If Imagen.Exists Then + params.Add(New ReportParameter("LogoPath", logouri)) + Else + params.Add(New ReportParameter("LogoPath", "")) + End If If UsuarioActual.CveEmpresa = 140 Then - Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) - - If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) - Else - params.Add(New ReportParameter("LogoPath", "")) - End If params.Add(New ReportParameter("Origen", Almacen)) params.Add(New ReportParameter("Destino", AlmacenDestino)) params.Add(New ReportParameter("FechaImpresion", DateTime.Now.ToString("dd/MM/yyyy"))) @@ -2329,7 +2329,19 @@ Partial Class PopUpVerFactura params.Add(New ReportParameter("CantidadUsados", CantidadUsados.ToString())) params.Add(New ReportParameter("CveConceptoMovRelacionado", CveConceptoMovRelacionado.ToString())) params.Add(New ReportParameter("FolioRelacionado", FolioRelacionado)) - Else + ElseIf UsuarioActual.CveEmpresa = 153 Then + params.Add(New ReportParameter("Origen", Almacen)) + params.Add(New ReportParameter("Destino", AlmacenDestino)) + params.Add(New ReportParameter("FechaImpresion", DateTime.Now.ToString("dd/MM/yyyy"))) + params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) + params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa)) + params.Add(New ReportParameter("Observaciones", Observaciones)) 'TxtObservaciones.Text + params.Add(New ReportParameter("CveAlmacen", DtMovimientos(0)("CveTipoAlmacen").ToString)) + params.Add(New ReportParameter("CveTipoAlmacenDestino", DtMovimientos(0)("CveTipoAlmacenDestino").ToString)) + params.Add(New ReportParameter("CveVentaDetalle", DtMovimientos(0)("CveVentaDetalle").ToString)) + params.Add(New ReportParameter("FacturadoA", DtMovimientos(0)("Nombre").ToString)) + params.Add(New ReportParameter("Factura", DtMovimientos(0)("SerieFolio").ToString)) + Else params.Add(New ReportParameter("Observaciones", Observaciones)) 'TxtObservaciones.Text params.Add(New ReportParameter("CveAlmacen", DtMovimientos(0)("CveTipoAlmacen").ToString)) params.Add(New ReportParameter("CveTipoAlmacenDestino", DtMovimientos(0)("CveTipoAlmacenDestino").ToString)) @@ -2414,7 +2426,21 @@ Partial Class PopUpVerFactura params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa)) params.Add(New ReportParameter("CveConceptoMovRelacionado", CveConceptoMovRelacionado.ToString())) - params.Add(New ReportParameter("FolioRelacionado", FolioRelacionado)) + params.Add(New ReportParameter("FolioRelacionado", FolioRelacionado)) + ElseIf UsuarioActual.CveEmpresa = 153 Then + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + + If Imagen.Exists Then + params.Add(New ReportParameter("LogoPath", logouri)) + Else + params.Add(New ReportParameter("LogoPath", "")) + End If + params.Add(New ReportParameter("Origen", AlmacenDestino)) ' se invierte + params.Add(New ReportParameter("Destino", Almacen)) + params.Add(New ReportParameter("FechaImpresion", DateTime.Now.ToString("dd/MM/yyyy"))) + params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) + params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa)) End If @@ -3975,7 +4001,7 @@ Partial Class PopUpVerFactura End If ElseIf UsuarioActual.CveEmpresa.Contiene(119, 141) Then Dim PreP As New ClsContabilidad - If PreP.GetPrePolizasDetalle(-1, CveIE) Then + If PreP.GetPrePolizasDetalle(-1, UsuarioActual.CveEmpresa, CveIE:=CveIE) Then DtMovimientosPoliza = New DataTable DtMovimientosPoliza.Columns.Add("CODIGO", GetType(String)) DtMovimientosPoliza.Columns.Add("Cuenta", GetType(String)) @@ -4055,7 +4081,7 @@ Partial Class PopUpVerFactura tIdPoliza = ObjIE.IDPoliza Dim PreP As New ClsContabilidad - If PreP.GetPrePolizasDetalle(-1, CveIE) Then + If PreP.GetPrePolizasDetalle(-1, UsuarioActual.CveEmpresa, CveIE:=CveIE) Then If PreP.DtResultados.Rows.Count > 0 Then CveProveedor = PreP.DtResultados.Rows(0)("CveProveedor").ToString.ToEntero CvePersonal = PreP.DtResultados.Rows(0)("CvePersonal").ToString.ToEntero @@ -4256,7 +4282,7 @@ Partial Class PopUpVerFactura Dim dtMovs As New DataTable Dim Mov As New ClsContabilidad - If Mov.GetPrePolizasDetalle(-1, CveIE) Then + If Mov.GetPrePolizasDetalle(-1, UsuarioActual.CveEmpresa, CveIE:=CveIE) Then dtMovs = Mov.DtResultados.FiltraParametros("CveConceptoContable IN (17,2,308,309,312)") diff --git a/Compras/ReembolsosComprobaciones.aspx.vb b/Compras/ReembolsosComprobaciones.aspx.vb index 545597a2c..092cdd87e 100644 --- a/Compras/ReembolsosComprobaciones.aspx.vb +++ b/Compras/ReembolsosComprobaciones.aspx.vb @@ -102,31 +102,31 @@ Partial Class Compras_ReembolsosComprobaciones ObjPersonal.Dispose() - DdlPersonal.DataBind() + DdlPersonal.DataBind() - CargaTipoTransaccion() + CargaTipoTransaccion() - If UsuarioActual.Empresa.Funcionalidad(506) = "1" Then - CbPermitirExcedente.Visible = True - Else - CbPermitirExcedente.Visible = False - End If + If UsuarioActual.Empresa.Funcionalidad(506) = "1" Then + CbPermitirExcedente.Visible = True + Else + CbPermitirExcedente.Visible = False + End If ' If UsuarioActual.CveEmpresa.Contiene(1, 4, 7, 11, 12, 72, 80, 119) Then 'rowComisiones.Visible = True ' End If If UsuarioActual.CveEmpresa = 119 Then - ChkReembolsarSinBancos.Visible = True - End If - - TxtFechaPrePoliza.Text = Date.Now.ToShortDateString - - 'CargaCuentasDiferencia() - - 'TableDiferencia.Visible = False + ChkReembolsarSinBancos.Visible = True End If + TxtFechaPrePoliza.Text = Date.Now.ToShortDateString + + 'CargaCuentasDiferencia() + + 'TableDiferencia.Visible = False + End If + End Sub #Region " FILTROS " @@ -243,7 +243,7 @@ Partial Class Compras_ReembolsosComprobaciones Private Sub CargaCuentas() DdlCuenta.Items.Clear() DdlCuenta.SelectedIndex = -1 - Dim dt As DataTable = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa) + Dim dt As DataTable = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa, CveTipoCuenta:=2) 'solo cuentas "bancarias" dt = dt.FiltraParametros(String.Format("CveMoneda = {0}", 1)) @@ -799,7 +799,7 @@ Partial Class Compras_ReembolsosComprobaciones End If Else 'Agrego el IVA - If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, gvr.DataKey("IVAPorPagar").ToDecimal * PorcentajePago, Referencia, 14, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(IdCtaContIVAXAcreditar > 0, IdCtaContIVAXAcreditar, IdCtaIVAxAcreditar), -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("IVAPorPagar").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("IVAPorPagar").ToDecimal * PorcentajePago) * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, CvePersonal:=CvePersonal, PorcentajeImpuesto:=PorcentajeIVA) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaPago, True, gvr.DataKey("IVA").ToDecimal * PorcentajePago, Referencia, 14, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(IdCtaContIVAXAcreditar > 0, IdCtaContIVAXAcreditar, IdCtaIVAxAcreditar), -1, CveIE:=CveIEPago, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("IVA").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("IVA").ToDecimal * PorcentajePago) * tipoCambio, CvePrePolizaOriginal:=CvePrePolizaPagoOriginal, CvePersonal:=CvePersonal, PorcentajeImpuesto:=PorcentajeIVA) Then MsgError = "Detalle" End If 'Agrego el IVA @@ -1129,7 +1129,7 @@ Partial Class Compras_ReembolsosComprobaciones End If Else 'Agrego el IVA - If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, gvr.DataKey("IVAPorPagar").ToDecimal * PorcentajePago, Referencia, 14, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(IdCtaContIVAXAcreditar > 0, IdCtaContIVAXAcreditar, IdCtaIVAxAcreditar), -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("IVAPorPagar").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("IVAPorPagar").ToDecimal * PorcentajePago) * tipoCambio, CvePersonal:=CvePersonal, PorcentajeImpuesto:=PorcentajeIVA) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, gvr.DataKey("IVA").ToDecimal * PorcentajePago, Referencia, 14, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, If(IdCtaContIVAXAcreditar > 0, IdCtaContIVAXAcreditar, IdCtaIVAxAcreditar), -1, CveIE:=CveIEExcedente, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.DataKey("IVA").ToDecimal * PorcentajePago), ImporteMX:=(gvr.DataKey("IVA").ToDecimal * PorcentajePago) * tipoCambio, CvePersonal:=CvePersonal, PorcentajeImpuesto:=PorcentajeIVA) Then MsgError = "Detalle" End If diff --git a/Compras/RepCxP.aspx b/Compras/RepCxP.aspx index b6fa8a533..07bd70a8c 100644 --- a/Compras/RepCxP.aspx +++ b/Compras/RepCxP.aspx @@ -253,6 +253,12 @@
+
+
Ver por meses:
+
+ +
+
@@ -341,6 +347,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Total diff --git a/Compras/RepCxP.aspx.vb b/Compras/RepCxP.aspx.vb index c3a54da1d..f22fe1d7f 100644 --- a/Compras/RepCxP.aspx.vb +++ b/Compras/RepCxP.aspx.vb @@ -1,6 +1,8 @@ Imports Microsoft.Reporting.WebForms Imports Extensiones Imports System.Data +Imports GemBox.Spreadsheet + Partial Class Compras_RepCxP Inherits ClsPaginas @@ -71,6 +73,24 @@ Partial Class Compras_RepCxP End Set End Property + Private Property CantVencidos() As Integer + Get + Return If(IsNothing(ViewState("CantVencidos")), -1, CInt(ViewState("CantVencidos"))) + End Get + Set + ViewState("CantVencidos") = Value + End Set + End Property + + Private Property CantPorVencer() As Integer + Get + Return If(IsNothing(ViewState("CantPorVencer")), -1, CInt(ViewState("CantPorVencer"))) + End Get + Set + ViewState("CantPorVencer") = Value + End Set + End Property + Private Property TCEspecifico As Double #End Region @@ -82,6 +102,10 @@ Partial Class Compras_RepCxP CargaGvPersonalizarRaqngoColumnas() CargaDatos() CreaDataTableColor() + + If UsuarioActual.CveRol = 1 Then + divAgruparMes.Visible = True + End If End If End Sub @@ -154,10 +178,11 @@ Partial Class Compras_RepCxP If txtFechaF.Text = "" Then FechaF = "-1" If txtFechaVI.Text = "" Then FechaVI = "-1" If txtFechaVF.Text = "" Then FechaVF = "-1" + Dim TipoAgrupacion As Integer = IIf(chkAgruparMes.Checked, 1, -1) Dim TipoDocto As String = If(DdlTipoDocto.GetSelectedValuesM = "", "-1", DdlTipoDocto.GetSelectedValuesM) If Mov.GetCxP(FechaI, FechaF, DdlProveedor.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, DdlProveedoresClasificaciones.SelectedValue.ToEntero, -1, DdlUsuarioResponsable.SelectedValue.ToEntero, DdlUsuarioRegistro.SelectedValue.ToEntero, DdlEstatusCompra.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlGrupo.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, RblTipoCambio.SelectedValue.ToEntero, TCEspecifico, FechaVI, FechaVF, FechaCorte:=txtCorteA.Text.ToDate, CveUsuarioConsulta:=UsuarioActual.CveUsuario, CveTipoProveedor:=IIf(DdlTipoProveedor.SelectedValue.ToEntero = 3, -1, DdlTipoProveedor.SelectedValue.ToEntero), Comprobaciones:=DdlComprobacion.SelectedValue.ToEntero, - TipoDocto:=TipoDocto) Then + TipoDocto:=TipoDocto, TipoAgrupacion:=TipoAgrupacion) Then GvCxP.DataSource = Mov.DtResultados DtDatos = Mov.DtResultados DtGrafica = Mov.DtResultados @@ -165,113 +190,286 @@ Partial Class Compras_RepCxP Mov.Dispose() Dim NumCol As Integer - If DtDatos.Rows.Count > 0 Then + If chkAgruparMes.Checked Then + + Dim monthNames As String() = {"", "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"} GvCxP.Columns(2).Visible = False - GvCxP.Columns(3).Visible = False - GvCxP.Columns(4).Visible = False - GvCxP.Columns(5).Visible = False - GvCxP.Columns(6).Visible = False - GvCxP.Columns(7).Visible = False - GvCxP.Columns(8).Visible = False - GvCxP.Columns(9).Visible = False - GvCxP.Columns(10).Visible = False - Dim Contador As Integer = 2 - Dim CargaColumnaVencido As Boolean = False + GvCxP.Columns(3).Visible = True + GvCxP.Columns(4).Visible = True + GvCxP.Columns(5).Visible = True + GvCxP.Columns(6).Visible = True + GvCxP.Columns(7).Visible = True + GvCxP.Columns(8).Visible = True + GvCxP.Columns(9).Visible = True + GvCxP.Columns(10).Visible = True + GvCxP.Columns(11).Visible = True + GvCxP.Columns(12).Visible = True + GvCxP.Columns(13).Visible = True + GvCxP.Columns(14).Visible = True + GvCxP.Columns(15).Visible = True + GvCxP.Columns(16).Visible = True + Dim Dr As DataRow = DtDatos.Rows(0) - If Dr("NomC1").ToString <> "" Then - GvCxP.Columns(Contador).Visible = True - GvCxP.Columns(Contador).HeaderText = Dr("NomC1").ToString - Contador += 1 - End If - If Dr("TC2").ToString.ToEntero = 2 And Not CargaColumnaVencido Then - GvCxP.Columns(Contador).Visible = True - GvCxP.Columns(Contador).HeaderText = "Total" - Contador += 1 - CargaColumnaVencido = True - NumCol = 2 - End If - If Dr("NomC2").ToString <> "" Then - GvCxP.Columns(Contador).Visible = True - GvCxP.Columns(Contador).HeaderText = Dr("NomC2").ToString - Contador += 1 - End If - If Dr("TC3").ToString.ToEntero = 2 And Not CargaColumnaVencido Then - GvCxP.Columns(Contador).Visible = True - GvCxP.Columns(Contador).HeaderText = "Total" - Contador += 1 - CargaColumnaVencido = True - NumCol = 3 - End If - If Dr("NomC3").ToString <> "" Then - GvCxP.Columns(Contador).Visible = True - GvCxP.Columns(Contador).HeaderText = Dr("NomC3").ToString - Contador += 1 - End If - If Dr("TC4").ToString.ToEntero = 2 And Not CargaColumnaVencido Then - GvCxP.Columns(Contador).Visible = True - GvCxP.Columns(Contador).HeaderText = "Total" - Contador += 1 - CargaColumnaVencido = True - NumCol = 4 - End If - If Dr("NomC4").ToString <> "" Then - GvCxP.Columns(Contador).Visible = True - GvCxP.Columns(Contador).HeaderText = Dr("NomC4").ToString - Contador += 1 - End If - If Dr("TC5").ToString.ToEntero = 2 And Not CargaColumnaVencido Then - GvCxP.Columns(Contador).Visible = True - GvCxP.Columns(Contador).HeaderText = "Total" - Contador += 1 - CargaColumnaVencido = True - NumCol = 5 - End If - If Dr("NomC5").ToString <> "" Then - GvCxP.Columns(Contador).Visible = True - GvCxP.Columns(Contador).HeaderText = Dr("NomC5").ToString - Contador += 1 - End If - If Dr("TC6").ToString.ToEntero = 2 And Not CargaColumnaVencido Then - GvCxP.Columns(Contador).Visible = True - GvCxP.Columns(Contador).HeaderText = "Total" - Contador += 1 - CargaColumnaVencido = True - NumCol = 6 - End If - If Dr("NomC6").ToString <> "" Then - GvCxP.Columns(Contador).Visible = True - GvCxP.Columns(Contador).HeaderText = Dr("NomC6").ToString - Contador += 1 - End If - If Dr("TC7").ToString.ToEntero = 2 And Not CargaColumnaVencido Then - GvCxP.Columns(Contador).Visible = True - GvCxP.Columns(Contador).HeaderText = "Total" - Contador += 1 - CargaColumnaVencido = True - NumCol = 7 - End If - If Dr("NomC7").ToString <> "" Then - GvCxP.Columns(Contador).Visible = True - GvCxP.Columns(Contador).HeaderText = Dr("NomC7").ToString - Contador += 1 - End If - If Dr("TC8").ToString.ToEntero = 2 And Not CargaColumnaVencido Then - GvCxP.Columns(Contador).Visible = True - GvCxP.Columns(Contador).HeaderText = "Total" - Contador += 1 - CargaColumnaVencido = True - NumCol = 8 - End If - If Dr("NomC8").ToString <> "" Then - GvCxP.Columns(Contador).Visible = True - GvCxP.Columns(Contador).HeaderText = Dr("NomC8").ToString - Contador += 1 + GvCxP.Columns(2).HeaderText = "Vencido" + GvCxP.Columns(3).HeaderText = "Total" + GvCxP.Columns(4).HeaderText = monthNames(Dr("NomMes1").ToString.ToDate.Month) + GvCxP.Columns(5).HeaderText = monthNames(Dr("NomMes2").ToString.ToDate.Month) + GvCxP.Columns(6).HeaderText = monthNames(Dr("NomMes3").ToString.ToDate.Month) + GvCxP.Columns(7).HeaderText = monthNames(Dr("NomMes4").ToString.ToDate.Month) + GvCxP.Columns(8).HeaderText = monthNames(Dr("NomMes5").ToString.ToDate.Month) + GvCxP.Columns(9).HeaderText = monthNames(Dr("NomMes6").ToString.ToDate.Month) + GvCxP.Columns(10).HeaderText = monthNames(Dr("NomMes7").ToString.ToDate.Month) + GvCxP.Columns(11).HeaderText = monthNames(Dr("NomMes8").ToString.ToDate.Month) + GvCxP.Columns(12).HeaderText = monthNames(Dr("NomMes9").ToString.ToDate.Month) + GvCxP.Columns(13).HeaderText = monthNames(Dr("NomMes10").ToString.ToDate.Month) + GvCxP.Columns(14).HeaderText = monthNames(Dr("NomMes11").ToString.ToDate.Month) + GvCxP.Columns(15).HeaderText = monthNames(Dr("NomMes12").ToString.ToDate.Month) + GvCxP.Columns(16).HeaderText = "12+" + GvCxP.DataBind() + UPPDatos.Update() + Else + If DtDatos.Rows.Count > 0 Then + GvCxP.Columns(2).Visible = False + GvCxP.Columns(3).Visible = False + GvCxP.Columns(4).Visible = False + GvCxP.Columns(5).Visible = False + GvCxP.Columns(6).Visible = False + GvCxP.Columns(7).Visible = False + GvCxP.Columns(8).Visible = False + GvCxP.Columns(9).Visible = False + GvCxP.Columns(10).Visible = False + GvCxP.Columns(11).Visible = False + GvCxP.Columns(12).Visible = False + GvCxP.Columns(13).Visible = False + GvCxP.Columns(14).Visible = False + GvCxP.Columns(15).Visible = False + GvCxP.Columns(16).Visible = False + Dim Contador As Integer = 2 + + Dim CargaColumnaVencido As Boolean = False + Dim Dr As DataRow = DtDatos.Rows(0) + If Dr("NomC1").ToString <> "" Then + GvCxP.Columns(Contador).Visible = True + GvCxP.Columns(Contador).HeaderText = Dr("NomC1").ToString + Contador += 1 + If Dr("TC1").ToString.ToEntero = 1 Then + CantVencidos += 1 + Else + CantPorVencer += 1 + End If + End If + If Dr("TC2").ToString.ToEntero = 2 And Not CargaColumnaVencido Then + GvCxP.Columns(Contador).Visible = True + GvCxP.Columns(Contador).HeaderText = "Total" + Contador += 1 + CargaColumnaVencido = True + NumCol = 2 + End If + If Dr("NomC2").ToString <> "" Then + GvCxP.Columns(Contador).Visible = True + GvCxP.Columns(Contador).HeaderText = Dr("NomC2").ToString + Contador += 1 + If Dr("TC2").ToString.ToEntero = 1 Then + CantVencidos += 1 + Else + CantPorVencer += 1 + End If + End If + If Dr("TC3").ToString.ToEntero = 2 And Not CargaColumnaVencido Then + GvCxP.Columns(Contador).Visible = True + GvCxP.Columns(Contador).HeaderText = "Total" + Contador += 1 + CargaColumnaVencido = True + NumCol = 3 + End If + If Dr("NomC3").ToString <> "" Then + GvCxP.Columns(Contador).Visible = True + GvCxP.Columns(Contador).HeaderText = Dr("NomC3").ToString + Contador += 1 + If Dr("TC3").ToString.ToEntero = 1 Then + CantVencidos += 1 + Else + CantPorVencer += 1 + End If + End If + If Dr("TC4").ToString.ToEntero = 2 And Not CargaColumnaVencido Then + GvCxP.Columns(Contador).Visible = True + GvCxP.Columns(Contador).HeaderText = "Total" + Contador += 1 + CargaColumnaVencido = True + NumCol = 4 + End If + If Dr("NomC4").ToString <> "" Then + GvCxP.Columns(Contador).Visible = True + GvCxP.Columns(Contador).HeaderText = Dr("NomC4").ToString + Contador += 1 + If Dr("TC4").ToString.ToEntero = 1 Then + CantVencidos += 1 + Else + CantPorVencer += 1 + End If + End If + If Dr("TC5").ToString.ToEntero = 2 And Not CargaColumnaVencido Then + GvCxP.Columns(Contador).Visible = True + GvCxP.Columns(Contador).HeaderText = "Total" + Contador += 1 + CargaColumnaVencido = True + NumCol = 5 + End If + If Dr("NomC5").ToString <> "" Then + GvCxP.Columns(Contador).Visible = True + GvCxP.Columns(Contador).HeaderText = Dr("NomC5").ToString + Contador += 1 + If Dr("TC5").ToString.ToEntero = 1 Then + CantVencidos += 1 + Else + CantPorVencer += 1 + End If + End If + If Dr("TC6").ToString.ToEntero = 2 And Not CargaColumnaVencido Then + GvCxP.Columns(Contador).Visible = True + GvCxP.Columns(Contador).HeaderText = "Total" + Contador += 1 + CargaColumnaVencido = True + NumCol = 6 + End If + If Dr("NomC6").ToString <> "" Then + GvCxP.Columns(Contador).Visible = True + GvCxP.Columns(Contador).HeaderText = Dr("NomC6").ToString + Contador += 1 + If Dr("TC6").ToString.ToEntero = 1 Then + CantVencidos += 1 + Else + CantPorVencer += 1 + End If + End If + If Dr("TC7").ToString.ToEntero = 2 And Not CargaColumnaVencido Then + GvCxP.Columns(Contador).Visible = True + GvCxP.Columns(Contador).HeaderText = "Total" + Contador += 1 + CargaColumnaVencido = True + NumCol = 7 + End If + If Dr("NomC7").ToString <> "" Then + GvCxP.Columns(Contador).Visible = True + GvCxP.Columns(Contador).HeaderText = Dr("NomC7").ToString + Contador += 1 + If Dr("TC7").ToString.ToEntero = 1 Then + CantVencidos += 1 + Else + CantPorVencer += 1 + End If + End If + If Dr("TC8").ToString.ToEntero = 2 And Not CargaColumnaVencido Then + GvCxP.Columns(Contador).Visible = True + GvCxP.Columns(Contador).HeaderText = "Total" + Contador += 1 + CargaColumnaVencido = True + NumCol = 8 + End If + If Dr("NomC8").ToString <> "" Then + GvCxP.Columns(Contador).Visible = True + GvCxP.Columns(Contador).HeaderText = Dr("NomC8").ToString + Contador += 1 + If Dr("TC8").ToString.ToEntero = 1 Then + CantVencidos += 1 + Else + CantPorVencer += 1 + End If + End If + If Dr("TC9").ToString.ToEntero = 2 And Not CargaColumnaVencido Then + GvCxP.Columns(Contador).Visible = True + GvCxP.Columns(Contador).HeaderText = "Total" + Contador += 1 + CargaColumnaVencido = True + NumCol = 8 + End If + If Dr("NomC9").ToString <> "" Then + GvCxP.Columns(Contador).Visible = True + GvCxP.Columns(Contador).HeaderText = Dr("NomC9").ToString + Contador += 1 + If Dr("TC9").ToString.ToEntero = 1 Then + CantVencidos += 1 + Else + CantPorVencer += 1 + End If + End If + If Dr("TC10").ToString.ToEntero = 2 And Not CargaColumnaVencido Then + GvCxP.Columns(Contador).Visible = True + GvCxP.Columns(Contador).HeaderText = "Total" + Contador += 1 + CargaColumnaVencido = True + NumCol = 10 + End If + If Dr("NomC10").ToString <> "" Then + GvCxP.Columns(Contador).Visible = True + GvCxP.Columns(Contador).HeaderText = Dr("NomC10").ToString + Contador += 1 + If Dr("TC10").ToString.ToEntero = 1 Then + CantVencidos += 1 + Else + CantPorVencer += 1 + End If + End If + If Dr("TC11").ToString.ToEntero = 2 And Not CargaColumnaVencido Then + GvCxP.Columns(Contador).Visible = True + GvCxP.Columns(Contador).HeaderText = "Total" + Contador += 1 + CargaColumnaVencido = True + NumCol = 11 + End If + If Dr("NomC11").ToString <> "" Then + GvCxP.Columns(Contador).Visible = True + GvCxP.Columns(Contador).HeaderText = Dr("NomC11").ToString + Contador += 1 + If Dr("TC11").ToString.ToEntero = 1 Then + CantVencidos += 1 + Else + CantPorVencer += 1 + End If + End If + If Dr("TC12").ToString.ToEntero = 2 And Not CargaColumnaVencido Then + GvCxP.Columns(Contador).Visible = True + GvCxP.Columns(Contador).HeaderText = "Total" + Contador += 1 + CargaColumnaVencido = True + NumCol = 12 + End If + If Dr("NomC12").ToString <> "" Then + GvCxP.Columns(Contador).Visible = True + GvCxP.Columns(Contador).HeaderText = Dr("NomC12").ToString + Contador += 1 + If Dr("TC12").ToString.ToEntero = 1 Then + CantVencidos += 1 + Else + CantPorVencer += 1 + End If + End If + If Dr("TC13").ToString.ToEntero = 2 And Not CargaColumnaVencido Then + GvCxP.Columns(Contador).Visible = True + GvCxP.Columns(Contador).HeaderText = "Total" + Contador += 1 + CargaColumnaVencido = True + NumCol = 13 + End If + If Dr("NomC13").ToString <> "" Then + GvCxP.Columns(Contador).Visible = True + GvCxP.Columns(Contador).HeaderText = Dr("NomC13").ToString + Contador += 1 + If Dr("TC12").ToString.ToEntero = 1 Then + CantVencidos += 1 + Else + CantPorVencer += 1 + End If + End If + End If + GvCxP.DataBind() + UPPDatos.Update() + ActualizarDatatable(NumCol) + End If - GvCxP.DataBind() - UPPDatos.Update() - ActualizarDatatable(NumCol) Agrupador = DdlGrupo.SelectedItem.Text End Sub @@ -282,10 +480,17 @@ Partial Class Compras_RepCxP Protected Sub GvCxP_RowCreated(sender As Object, e As GridViewRowEventArgs) Handles GvCxP.RowCreated If e.Row.RowType = DataControlRowType.Header Then Dim FC As New SortedList - FC.Add(0, " ,2,1,Titulos") - FC.Add(2, "Vencido,4,1,Titulos") - FC.Add(3, "Por Vencer,5,1,Titulos") - + If chkAgruparMes.Checked Then + FC.Add(0, " ,2,1,Titulos") + FC.Add(2, "Vencido,2,1,Titulos") + FC.Add(3, "Por Vencer,14,1,Titulos") + Else + FC.Add(0, " ,2,1,Titulos") + FC.Add(2, String.Format("Vencido,{0},1,Titulos", CantVencidos + 2)) + FC.Add(3, String.Format("Por Vencer,{0},1,Titulos", CantPorVencer + 2)) + CantVencidos = 0 + CantPorVencer = 0 + End If GetMultiRowHeader(DirectCast(sender, GridView), e, FC, "Titulos") End If End Sub @@ -295,253 +500,482 @@ Partial Class Compras_RepCxP If e.Row.RowType = DataControlRowType.DataRow Then Dim Css As String = "Texto" + If chkAgruparMes.Checked Then + Dim TipoMoneda As Integer = RblTipoCambio.SelectedValue.ToEntero + ' Dim CveSubProyecto As Integer = DdlSubProyecto.SelectedValue.ToEntero + Dim Responsable As Integer = DdlUsuarioResponsable.SelectedValue.ToEntero + 'Dim CveClasificacion As Integer = DdlProveedoresClasificaciones.SelectedValue.ToEntero + Dim CveTipoProveedor As Integer = DdlTipoProveedor.SelectedValue.ToEntero + 'Dim CveProveedorSucursal As Integer = If(e.Row.DBCampo("CveProveedorSucursal").ToEntero > 0, e.Row.DBCampo("CveProveedorSucursal").ToEntero, -1) - If DdlGrupo.SelectedValue.ToEntero = 11 Then - If e.Row.DBCampo("CveSubProyecto") = "-1" Then - e.Row.CssClass = "Totales" - ElseIf e.Row.DBCampo("Orden") = "" Then - e.Row.CssClass = "SubTotales" + Dim FechaI, FechaF, FechaVI, FechaVF As String + FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim(), "-1") + FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim(), "-1") + FechaVI = If(IsDate(txtFechaVI.Text.Trim()), txtFechaVI.Text.Trim(), "-1") + FechaVF = If(IsDate(txtFechaVF.Text.Trim()), txtFechaVF.Text.Trim(), Date.Now.ToShortDateString) + If DdlGrupo.SelectedValue.ToEntero = 11 Then + If e.Row.DBCampo("CveSubProyecto") = "-1" Then + e.Row.CssClass = "Totales" + ElseIf e.Row.DBCampo("Orden") = "" Then + e.Row.CssClass = "SubTotales" + End If + Else + If e.Row.DBCampo("Orden") = "" Then + e.Row.CssClass = "Totales" + End If End If + If e.Row.DBCampo("Orden") <> "" Then + e.Row.Cells(1).BackColor = Drawing.Color.LightGray + e.Row.Cells(3).BackColor = Drawing.Color.LightGray + e.Row.Cells(17).BackColor = Drawing.Color.LightGray + End If + If DdlGrupo.SelectedValue = "10" AndAlso e.Row.RowIndex.Contiene(1, 3) Then + e.Row.Visible = False + End If + e.Row.FCHyperLink($"HplColumna1").Text = e.Row.DBCampo("vencido").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna2").Text = e.Row.DBCampo("vencido").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna3").Text = e.Row.DBCampo("Mes1").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna4").Text = e.Row.DBCampo("Mes2").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna5").Text = e.Row.DBCampo("Mes3").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna6").Text = e.Row.DBCampo("Mes4").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna7").Text = e.Row.DBCampo("Mes5").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna8").Text = e.Row.DBCampo("Mes6").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna9").Text = e.Row.DBCampo("Mes7").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna10").Text = e.Row.DBCampo("Mes8").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna11").Text = e.Row.DBCampo("Mes9").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna12").Text = e.Row.DBCampo("Mes10").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna13").Text = e.Row.DBCampo("Mes11").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna14").Text = e.Row.DBCampo("Mes12").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna15").Text = e.Row.DBCampo("Mes13").ToString.FormatoNumero + + Dim Liga1 As String = String.Format("/Compras/RepCxPDetalle.aspx?Op=S&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, FechaVI, FechaVF, TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) + e.Row.FCHyperLink($"HplColumna1").NavigateUrl = Liga1 + Liga1 = String.Format("/Compras/RepCxPDetalle.aspx?Op=S&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, FechaVI, FechaVF, TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) + e.Row.FCHyperLink($"HplColumna2").NavigateUrl = Liga1 + Liga1 = String.Format("/Compras/RepCxPDetalle.aspx?Op=S&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, e.Row.DBCampo("NomMes1"), e.Row.DBCampo("NomMesF1"), TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) + e.Row.FCHyperLink($"HplColumna3").NavigateUrl = Liga1 + Liga1 = String.Format("/Compras/RepCxPDetalle.aspx?Op=S&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, e.Row.DBCampo("NomMes2"), e.Row.DBCampo("NomMesF2"), TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) + e.Row.FCHyperLink($"HplColumna4").NavigateUrl = Liga1 + Liga1 = String.Format("/Compras/RepCxPDetalle.aspx?Op=S&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, e.Row.DBCampo("NomMes3"), e.Row.DBCampo("NomMesF3"), TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) + e.Row.FCHyperLink($"HplColumna5").NavigateUrl = Liga1 + Liga1 = String.Format("/Compras/RepCxPDetalle.aspx?Op=S&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, e.Row.DBCampo("NomMes4"), e.Row.DBCampo("NomMesF4"), TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) + e.Row.FCHyperLink($"HplColumna6").NavigateUrl = Liga1 + Liga1 = String.Format("/Compras/RepCxPDetalle.aspx?Op=S&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, e.Row.DBCampo("NomMes5"), e.Row.DBCampo("NomMesF5"), TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) + e.Row.FCHyperLink($"HplColumna7").NavigateUrl = Liga1 + Liga1 = String.Format("/Compras/RepCxPDetalle.aspx?Op=S&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, e.Row.DBCampo("NomMes6"), e.Row.DBCampo("NomMesF6"), TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) + e.Row.FCHyperLink($"HplColumna8").NavigateUrl = Liga1 + Liga1 = String.Format("/Compras/RepCxPDetalle.aspx?Op=S&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, e.Row.DBCampo("NomMes7"), e.Row.DBCampo("NomMesF7"), TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) + e.Row.FCHyperLink($"HplColumna9").NavigateUrl = Liga1 + Liga1 = String.Format("/Compras/RepCxPDetalle.aspx?Op=S&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, e.Row.DBCampo("NomMes8"), e.Row.DBCampo("NomMesF8"), TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) + e.Row.FCHyperLink($"HplColumna10").NavigateUrl = Liga1 + Liga1 = String.Format("/Compras/RepCxPDetalle.aspx?Op=S&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, e.Row.DBCampo("NomMes9"), e.Row.DBCampo("NomMesF9"), TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) + e.Row.FCHyperLink($"HplColumna11").NavigateUrl = Liga1 + Liga1 = String.Format("/Compras/RepCxPDetalle.aspx?Op=S&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, e.Row.DBCampo("NomMes10"), e.Row.DBCampo("NomMesF10"), TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) + e.Row.FCHyperLink($"HplColumna12").NavigateUrl = Liga1 + Liga1 = String.Format("/Compras/RepCxPDetalle.aspx?Op=S&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, e.Row.DBCampo("NomMes11"), e.Row.DBCampo("NomMesF11"), TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) + e.Row.FCHyperLink($"HplColumna13").NavigateUrl = Liga1 + Liga1 = String.Format("/Compras/RepCxPDetalle.aspx?Op=S&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, e.Row.DBCampo("NomMes12"), e.Row.DBCampo("NomMesF12"), TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) + e.Row.FCHyperLink($"HplColumna14").NavigateUrl = Liga1 + Liga1 = String.Format("/Compras/RepCxPDetalle.aspx?Op=S&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, e.Row.DBCampo("NomMes13"), "31/12/9999", TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) + e.Row.FCHyperLink($"HplColumna15").NavigateUrl = Liga1 + + If e.Row.FCHyperLink("HplSaldo").Text = "0.00" Then e.Row.FCHyperLink("HplSaldo").Text = "-" + If e.Row.FCHyperLink("HplColumna1").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna1").Text = "-" + If e.Row.FCHyperLink("HplColumna2").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna2").Text = "-" + If e.Row.FCHyperLink("HplColumna3").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna3").Text = "-" + If e.Row.FCHyperLink("HplColumna4").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna4").Text = "-" + If e.Row.FCHyperLink("HplColumna5").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna5").Text = "-" + If e.Row.FCHyperLink("HplColumna6").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna6").Text = "-" + If e.Row.FCHyperLink("HplColumna7").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna7").Text = "-" + If e.Row.FCHyperLink("HplColumna8").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna8").Text = "-" + If e.Row.FCHyperLink("HplColumna9").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna9").Text = "-" + If e.Row.FCHyperLink("HplColumna10").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna10").Text = "-" + If e.Row.FCHyperLink("HplColumna11").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna11").Text = "-" + If e.Row.FCHyperLink("HplColumna12").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna12").Text = "-" + If e.Row.FCHyperLink("HplColumna13").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna13").Text = "-" + If e.Row.FCHyperLink("HplColumna14").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna14").Text = "-" + If e.Row.FCHyperLink("HplColumna15").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna15").Text = "-" + + + If e.Row.FCHyperLink("LtlPorVencer").Text = "0.00" Then e.Row.FCHyperLink("LtlPorVencer").Text = "-" + If e.Row.FCHyperLink("LtlVentas").Text = "0.00" Then e.Row.FCHyperLink("LtlVentas").Text = "-" + If e.Row.FCHyperLink("LtlSaldo1").Text = "0.00" Then e.Row.FCHyperLink("LtlSaldo1").Text = "-" Else - If e.Row.DBCampo("Orden") = "" Then - e.Row.CssClass = "Totales" + If DdlGrupo.SelectedValue.ToEntero = 11 Then + If e.Row.DBCampo("CveSubProyecto") = "-1" Then + e.Row.CssClass = "Totales" + ElseIf e.Row.DBCampo("Orden") = "" Then + e.Row.CssClass = "SubTotales" + End If + Else + If e.Row.DBCampo("Orden") = "" Then + e.Row.CssClass = "Totales" + End If End If - End If - If e.Row.DBCampo("Orden") <> "" Then - e.Row.Cells(1).BackColor = Drawing.Color.LightGray - e.Row.Cells(11).BackColor = Drawing.Color.LightGray - End If + If e.Row.DBCampo("Orden") <> "" Then + e.Row.Cells(1).BackColor = Drawing.Color.LightGray + e.Row.Cells(17).BackColor = Drawing.Color.LightGray + End If - If DdlGrupo.SelectedValue = "10" AndAlso e.Row.RowIndex.Contiene(1, 3) Then - e.Row.Visible = False - End If + If DdlGrupo.SelectedValue = "10" AndAlso e.Row.RowIndex.Contiene(1, 3) Then + e.Row.Visible = False + End If - Dim TipoMoneda As Integer = RblTipoCambio.SelectedValue.ToEntero - ' Dim CveSubProyecto As Integer = DdlSubProyecto.SelectedValue.ToEntero - Dim Responsable As Integer = DdlUsuarioResponsable.SelectedValue.ToEntero - 'Dim CveClasificacion As Integer = DdlProveedoresClasificaciones.SelectedValue.ToEntero - Dim CveTipoProveedor As Integer = DdlTipoProveedor.SelectedValue.ToEntero - 'Dim CveProveedorSucursal As Integer = If(e.Row.DBCampo("CveProveedorSucursal").ToEntero > 0, e.Row.DBCampo("CveProveedorSucursal").ToEntero, -1) + Dim TipoMoneda As Integer = RblTipoCambio.SelectedValue.ToEntero + ' Dim CveSubProyecto As Integer = DdlSubProyecto.SelectedValue.ToEntero + Dim Responsable As Integer = DdlUsuarioResponsable.SelectedValue.ToEntero + 'Dim CveClasificacion As Integer = DdlProveedoresClasificaciones.SelectedValue.ToEntero + Dim CveTipoProveedor As Integer = DdlTipoProveedor.SelectedValue.ToEntero + 'Dim CveProveedorSucursal As Integer = If(e.Row.DBCampo("CveProveedorSucursal").ToEntero > 0, e.Row.DBCampo("CveProveedorSucursal").ToEntero, -1) - Dim FechaI, FechaF, FechaVI, FechaVF As String - FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim(), "-1") - FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim(), "-1") - FechaVI = If(IsDate(txtFechaVI.Text.Trim()), txtFechaVI.Text.Trim(), "-1") - FechaVF = If(IsDate(txtFechaVF.Text.Trim()), txtFechaVF.Text.Trim(), "-1") + Dim FechaI, FechaF, FechaVI, FechaVF As String + FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim(), "-1") + FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim(), "-1") + FechaVI = If(IsDate(txtFechaVI.Text.Trim()), txtFechaVI.Text.Trim(), "-1") + FechaVF = If(IsDate(txtFechaVF.Text.Trim()), txtFechaVF.Text.Trim(), "-1") - '/Bancos/RepProgramarRecursos.aspx --> Compras/RepCxPDetalle.aspx + '/Bancos/RepProgramarRecursos.aspx --> Compras/RepCxPDetalle.aspx - Dim LigaTot As String = String.Format("/Compras/RepCxPDetalle.aspx?Op=S&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + Dim LigaTot As String = String.Format("/Compras/RepCxPDetalle.aspx?Op=S&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, FechaVI, FechaVF, TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) - Dim Liga1 As String = String.Format("/Compras/RepCxPDetalle.aspx?Op=C1&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + Dim Liga1 As String = String.Format("/Compras/RepCxPDetalle.aspx?Op=C1&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, FechaVI, FechaVF, TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) - Dim Liga2 As String = String.Format("/Compras/RepCxPDetalle.aspx?Op=C2&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + Dim Liga2 As String = String.Format("/Compras/RepCxPDetalle.aspx?Op=C2&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, FechaVI, FechaVF, TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) - Dim Liga3 As String = String.Format("/Compras/RepCxPDetalle.aspx?Op=C3&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + Dim Liga3 As String = String.Format("/Compras/RepCxPDetalle.aspx?Op=C3&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, FechaVI, FechaVF, TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) - Dim Liga4 As String = String.Format("/Compras/RepCxPDetalle.aspx?Op=C4&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + Dim Liga4 As String = String.Format("/Compras/RepCxPDetalle.aspx?Op=C4&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, FechaVI, FechaVF, TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) - Dim Liga5 As String = String.Format("/Compras/RepCxPDetalle.aspx?Op=C5&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + Dim Liga5 As String = String.Format("/Compras/RepCxPDetalle.aspx?Op=C5&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, FechaVI, FechaVF, TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) - Dim Liga6 As String = String.Format("/Compras/RepCxPDetalle.aspx?Op=C6&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + Dim Liga6 As String = String.Format("/Compras/RepCxPDetalle.aspx?Op=C6&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, FechaVI, FechaVF, TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) - Dim Liga7 As String = String.Format("/Compras/RepCxPDetalle.aspx?Op=C7&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + Dim Liga7 As String = String.Format("/Compras/RepCxPDetalle.aspx?Op=C7&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, FechaVI, FechaVF, TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) - Dim Liga8 As String = String.Format("/Compras/RepCxPDetalle.aspx?Op=C8&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + Dim Liga8 As String = String.Format("/Compras/RepCxPDetalle.aspx?Op=C8&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, FechaVI, FechaVF, TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) + Dim Liga9 As String = String.Format("/Compras/RepCxPDetalle.aspx?Op=C9&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, FechaVI, FechaVF, TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) + Dim Liga10 As String = String.Format("/Compras/RepCxPDetalle.aspx?Op=C10&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, FechaVI, FechaVF, TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) + Dim Liga11 As String = String.Format("/Compras/RepCxPDetalle.aspx?Op=C11&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, FechaVI, FechaVF, TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) + Dim Liga12 As String = String.Format("/Compras/RepCxPDetalle.aspx?Op=C12&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, FechaVI, FechaVF, TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) + Dim Liga13 As String = String.Format("/Compras/RepCxPDetalle.aspx?Op=C13&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, FechaVI, FechaVF, TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) - Dim Liga9 As String = String.Format("/Compras/RepCxPDetalle.aspx?Op=S&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + Dim Liga14 As String = String.Format("/Compras/RepCxPDetalle.aspx?Op=S&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, FechaVI, FechaVF, TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) - Dim Liga10 As String = String.Format("/Compras/RepCxPDetalle.aspx?Op=TV&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + Dim Liga15 As String = String.Format("/Compras/RepCxPDetalle.aspx?Op=TV&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, FechaVI, FechaVF, TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) - Dim Liga11 As String = String.Format("/Compras/RepCxPDetalle.aspx?Op=TPV&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", + Dim Liga16 As String = String.Format("/Compras/RepCxPDetalle.aspx?Op=TPV&GPO={0}&Anio={1}&Mes={2}&AnioMes={3}&Fecha={4}&CveProveedor={5}&CveUsuario={6}&CveMoneda={7}&FechaI={8}&FechaF={9}&CveProveedorSucursal={10}&CveProveedorClasificacion={11}&CveSubProyecto={12}&CveEstatusFactura={13}&TipoMoneda={14}&CveUsuarioResponsable={15}&FechaVI={16}&FechaVF={17}&TCEspecifico={18}&FechaCorte={19}&CveTipoProveedor={20}&Comprobaciones={21}", e.Row.DBCampo("CveGpo"), e.Row.DBCampo("Anio"), e.Row.DBCampo("Mes"), e.Row.DBCampo("AnioMes"), e.Row.DBCampo("Fecha"), e.Row.DBCampo("CveProveedor"), e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveMoneda"), FechaI, FechaF, e.Row.DBCampo("CveProveedorSucursal"), e.Row.DBCampo("CveProveedorClasificacion"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveEstatusFactura"), TipoMoneda, Responsable, FechaVI, FechaVF, TCEspecifico, txtCorteA.Text, CveTipoProveedor, e.Row.DBCampo("Comprobaciones")) - Dim Contador As Integer = 1 - Dim ContadorColumna As Integer = 2 - Dim CargaColumnaVencido As Boolean = False - If e.Row.DBCampo("NomC1").ToString <> "" Then - e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("Columna1").ToString.FormatoNumero - e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga1 - Contador += 1 - ContadorColumna += 1 - End If - - If e.Row.DBCampo("TC2").ToString.ToEntero = 2 And Not CargaColumnaVencido Then - If Not e.Row.DBCampo("Orden") = "" Then - e.Row.Cells(ContadorColumna).BackColor = Drawing.Color.LightGray + Dim Contador As Integer = 1 + Dim ContadorColumna As Integer = 2 + Dim CargaColumnaVencido As Boolean = False + If e.Row.DBCampo("NomC1").ToString <> "" Then + e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("Columna1").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga1 + Contador += 1 + ContadorColumna += 1 End If - e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("vencido").ToString.FormatoNumero - e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga10 - Contador += 1 - CargaColumnaVencido = True - ContadorColumna += 1 - End If - If e.Row.DBCampo("NomC2").ToString <> "" Then - e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("Columna2").ToString.FormatoNumero - e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga2 - Contador += 1 - ContadorColumna += 1 - End If - - If e.Row.DBCampo("TC3").ToString.ToEntero = 2 And Not CargaColumnaVencido Then - If Not e.Row.DBCampo("Orden") = "" Then - e.Row.Cells(ContadorColumna).BackColor = Drawing.Color.LightGray + If e.Row.DBCampo("TC2").ToString.ToEntero = 2 And Not CargaColumnaVencido Then + If Not e.Row.DBCampo("Orden") = "" Then + e.Row.Cells(ContadorColumna).BackColor = Drawing.Color.LightGray + End If + e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("vencido").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga15 + Contador += 1 + CargaColumnaVencido = True + ContadorColumna += 1 End If - e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("vencido").ToString.FormatoNumero - e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga10 - Contador += 1 - CargaColumnaVencido = True - ContadorColumna += 1 - End If - If e.Row.DBCampo("NomC3").ToString <> "" Then - e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("Columna3").ToString.FormatoNumero - e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga3 - Contador += 1 - ContadorColumna += 1 - End If - - If e.Row.DBCampo("TC4").ToString.ToEntero = 2 And Not CargaColumnaVencido Then - If Not e.Row.DBCampo("Orden") = "" Then - e.Row.Cells(ContadorColumna).BackColor = Drawing.Color.LightGray + If e.Row.DBCampo("NomC2").ToString <> "" Then + e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("Columna2").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga2 + Contador += 1 + ContadorColumna += 1 End If - e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("vencido").ToString.FormatoNumero - e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga10 - Contador += 1 - CargaColumnaVencido = True - ContadorColumna += 1 - End If - If e.Row.DBCampo("NomC4").ToString <> "" Then - e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("Columna4").ToString.FormatoNumero - e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga4 - Contador += 1 - ContadorColumna += 1 - End If - - If e.Row.DBCampo("TC5").ToString.ToEntero = 2 And Not CargaColumnaVencido Then - If Not e.Row.DBCampo("Orden") = "" Then - e.Row.Cells(ContadorColumna).BackColor = Drawing.Color.LightGray + If e.Row.DBCampo("TC3").ToString.ToEntero = 2 And Not CargaColumnaVencido Then + If Not e.Row.DBCampo("Orden") = "" Then + e.Row.Cells(ContadorColumna).BackColor = Drawing.Color.LightGray + End If + e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("vencido").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga15 + Contador += 1 + CargaColumnaVencido = True + ContadorColumna += 1 End If - e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("vencido").ToString.FormatoNumero - e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga10 - Contador += 1 - CargaColumnaVencido = True - ContadorColumna += 1 - End If - If e.Row.DBCampo("NomC5").ToString <> "" Then - e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("Columna5").ToString.FormatoNumero - e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga5 - Contador += 1 - ContadorColumna += 1 - End If - - If e.Row.DBCampo("TC6").ToString.ToEntero = 2 And Not CargaColumnaVencido Then - If Not e.Row.DBCampo("Orden") = "" Then - e.Row.Cells(ContadorColumna).BackColor = Drawing.Color.LightGray + If e.Row.DBCampo("NomC3").ToString <> "" Then + e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("Columna3").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga3 + Contador += 1 + ContadorColumna += 1 End If - e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("vencido").ToString.FormatoNumero - e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga10 - Contador += 1 - CargaColumnaVencido = True - ContadorColumna += 1 - End If - If e.Row.DBCampo("NomC6").ToString <> "" Then - e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("Columna6").ToString.FormatoNumero - e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga6 - Contador += 1 - ContadorColumna += 1 - End If - - If e.Row.DBCampo("TC7").ToString.ToEntero = 2 And Not CargaColumnaVencido Then - If Not e.Row.DBCampo("Orden") = "" Then - e.Row.Cells(ContadorColumna).BackColor = Drawing.Color.LightGray + If e.Row.DBCampo("TC4").ToString.ToEntero = 2 And Not CargaColumnaVencido Then + If Not e.Row.DBCampo("Orden") = "" Then + e.Row.Cells(ContadorColumna).BackColor = Drawing.Color.LightGray + End If + e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("vencido").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga15 + Contador += 1 + CargaColumnaVencido = True + ContadorColumna += 1 End If - e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("vencido").ToString.FormatoNumero - e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga10 - Contador += 1 - CargaColumnaVencido = True - ContadorColumna += 1 - End If - If e.Row.DBCampo("NomC7").ToString <> "" Then - e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("Columna7").ToString.FormatoNumero - e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga7 - Contador += 1 - ContadorColumna += 1 - End If - - If e.Row.DBCampo("TC8").ToString.ToEntero = 2 And Not CargaColumnaVencido Then - If Not e.Row.DBCampo("Orden") = "" Then - e.Row.Cells(ContadorColumna).BackColor = Drawing.Color.LightGray + If e.Row.DBCampo("NomC4").ToString <> "" Then + e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("Columna4").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga4 + Contador += 1 + ContadorColumna += 1 End If - e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("vencido").ToString.FormatoNumero - e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga10 - Contador += 1 - CargaColumnaVencido = True - ContadorColumna += 1 + + If e.Row.DBCampo("TC5").ToString.ToEntero = 2 And Not CargaColumnaVencido Then + If Not e.Row.DBCampo("Orden") = "" Then + e.Row.Cells(ContadorColumna).BackColor = Drawing.Color.LightGray + End If + e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("vencido").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga15 + Contador += 1 + CargaColumnaVencido = True + ContadorColumna += 1 + End If + + If e.Row.DBCampo("NomC5").ToString <> "" Then + e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("Columna5").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga5 + Contador += 1 + ContadorColumna += 1 + End If + + If e.Row.DBCampo("TC6").ToString.ToEntero = 2 And Not CargaColumnaVencido Then + If Not e.Row.DBCampo("Orden") = "" Then + e.Row.Cells(ContadorColumna).BackColor = Drawing.Color.LightGray + End If + e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("vencido").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga15 + Contador += 1 + CargaColumnaVencido = True + ContadorColumna += 1 + End If + + If e.Row.DBCampo("NomC6").ToString <> "" Then + e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("Columna6").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga6 + Contador += 1 + ContadorColumna += 1 + End If + + If e.Row.DBCampo("TC7").ToString.ToEntero = 2 And Not CargaColumnaVencido Then + If Not e.Row.DBCampo("Orden") = "" Then + e.Row.Cells(ContadorColumna).BackColor = Drawing.Color.LightGray + End If + e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("vencido").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga15 + Contador += 1 + CargaColumnaVencido = True + ContadorColumna += 1 + End If + + If e.Row.DBCampo("NomC7").ToString <> "" Then + e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("Columna7").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga7 + Contador += 1 + ContadorColumna += 1 + End If + + If e.Row.DBCampo("TC8").ToString.ToEntero = 2 And Not CargaColumnaVencido Then + If Not e.Row.DBCampo("Orden") = "" Then + e.Row.Cells(ContadorColumna).BackColor = Drawing.Color.LightGray + End If + e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("vencido").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga15 + Contador += 1 + CargaColumnaVencido = True + ContadorColumna += 1 + End If + + If e.Row.DBCampo("NomC8").ToString <> "" Then + e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("Columna8").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga8 + Contador += 1 + ContadorColumna += 1 + End If + + If e.Row.DBCampo("TC9").ToString.ToEntero = 2 And Not CargaColumnaVencido Then + If Not e.Row.DBCampo("Orden") = "" Then + e.Row.Cells(ContadorColumna).BackColor = Drawing.Color.LightGray + End If + e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("vencido").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga15 + Contador += 1 + CargaColumnaVencido = True + ContadorColumna += 1 + End If + + If e.Row.DBCampo("NomC9").ToString <> "" Then + e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("Columna9").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga9 + Contador += 1 + ContadorColumna += 1 + End If + + If e.Row.DBCampo("TC10").ToString.ToEntero = 2 And Not CargaColumnaVencido Then + If Not e.Row.DBCampo("Orden") = "" Then + e.Row.Cells(ContadorColumna).BackColor = Drawing.Color.LightGray + End If + e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("vencido").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga15 + Contador += 1 + CargaColumnaVencido = True + ContadorColumna += 1 + End If + + If e.Row.DBCampo("NomC10").ToString <> "" Then + e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("Columna10").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga10 + Contador += 1 + ContadorColumna += 1 + End If + + If e.Row.DBCampo("TC11").ToString.ToEntero = 2 And Not CargaColumnaVencido Then + If Not e.Row.DBCampo("Orden") = "" Then + e.Row.Cells(ContadorColumna).BackColor = Drawing.Color.LightGray + End If + e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("vencido").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga15 + Contador += 1 + CargaColumnaVencido = True + ContadorColumna += 1 + End If + + If e.Row.DBCampo("NomC11").ToString <> "" Then + e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("Columna11").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga11 + Contador += 1 + ContadorColumna += 1 + End If + + If e.Row.DBCampo("TC12").ToString.ToEntero = 2 And Not CargaColumnaVencido Then + If Not e.Row.DBCampo("Orden") = "" Then + e.Row.Cells(ContadorColumna).BackColor = Drawing.Color.LightGray + End If + e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("vencido").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga15 + Contador += 1 + CargaColumnaVencido = True + ContadorColumna += 1 + End If + + If e.Row.DBCampo("NomC12").ToString <> "" Then + e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("Columna12").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga12 + Contador += 1 + ContadorColumna += 1 + End If + + If e.Row.DBCampo("TC13").ToString.ToEntero = 2 And Not CargaColumnaVencido Then + If Not e.Row.DBCampo("Orden") = "" Then + e.Row.Cells(ContadorColumna).BackColor = Drawing.Color.LightGray + End If + e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("vencido").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga15 + Contador += 1 + CargaColumnaVencido = True + ContadorColumna += 1 + End If + + If e.Row.DBCampo("NomC12").ToString <> "" Then + e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("Columna13").ToString.FormatoNumero + e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga13 + Contador += 1 + ContadorColumna += 1 + End If + + + + + e.Row.FCHyperLink("LtlPorVencer").NavigateUrl = Liga16 + e.Row.FCHyperLink("LtlVentas").NavigateUrl = Liga14 + e.Row.FCHyperLink("LtlSaldo1").NavigateUrl = LigaTot + e.Row.FCHyperLink("HplSaldo").NavigateUrl = LigaTot + + If e.Row.FCHyperLink("HplSaldo").Text = "0.00" Then e.Row.FCHyperLink("HplSaldo").Text = "-" + If e.Row.FCHyperLink("HplColumna1").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna1").Text = "-" + If e.Row.FCHyperLink("HplColumna2").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna2").Text = "-" + If e.Row.FCHyperLink("HplColumna3").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna3").Text = "-" + If e.Row.FCHyperLink("HplColumna4").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna4").Text = "-" + If e.Row.FCHyperLink("HplColumna5").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna5").Text = "-" + If e.Row.FCHyperLink("HplColumna6").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna6").Text = "-" + If e.Row.FCHyperLink("HplColumna7").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna7").Text = "-" + If e.Row.FCHyperLink("HplColumna8").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna8").Text = "-" + If e.Row.FCHyperLink("HplColumna9").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna9").Text = "-" + If e.Row.FCHyperLink("HplColumna10").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna10").Text = "-" + If e.Row.FCHyperLink("HplColumna11").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna11").Text = "-" + If e.Row.FCHyperLink("HplColumna12").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna12").Text = "-" + If e.Row.FCHyperLink("HplColumna13").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna13").Text = "-" + If e.Row.FCHyperLink("HplColumna14").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna14").Text = "-" + + If e.Row.FCHyperLink("LtlPorVencer").Text = "0.00" Then e.Row.FCHyperLink("LtlPorVencer").Text = "-" + If e.Row.FCHyperLink("LtlVentas").Text = "0.00" Then e.Row.FCHyperLink("LtlVentas").Text = "-" + If e.Row.FCHyperLink("LtlSaldo1").Text = "0.00" Then e.Row.FCHyperLink("LtlSaldo1").Text = "-" + + e.Row.Cells(2).Width = Unit.Pixel(75) + e.Row.Cells(3).Width = Unit.Pixel(75) + e.Row.Cells(4).Width = Unit.Pixel(75) + e.Row.Cells(5).Width = Unit.Pixel(75) + e.Row.Cells(6).Width = Unit.Pixel(75) + e.Row.Cells(7).Width = Unit.Pixel(75) + e.Row.Cells(8).Width = Unit.Pixel(75) + e.Row.Cells(9).Width = Unit.Pixel(75) + e.Row.Cells(10).Width = Unit.Pixel(75) + e.Row.Cells(11).Width = Unit.Pixel(75) + e.Row.Cells(12).Width = Unit.Pixel(75) + e.Row.Cells(13).Width = Unit.Pixel(75) + e.Row.Cells(14).Width = Unit.Pixel(75) + e.Row.Cells(15).Width = Unit.Pixel(75) + e.Row.Cells(16).Width = Unit.Pixel(75) + End If - - If e.Row.DBCampo("NomC8").ToString <> "" Then - e.Row.FCHyperLink($"HplColumna{Contador}").Text = e.Row.DBCampo("Columna8").ToString.FormatoNumero - e.Row.FCHyperLink($"HplColumna{Contador}").NavigateUrl = Liga8 - Contador += 1 - ContadorColumna += 1 - End If - - - e.Row.FCHyperLink("LtlPorVencer").NavigateUrl = Liga11 - e.Row.FCHyperLink("LtlVentas").NavigateUrl = Liga9 - e.Row.FCHyperLink("LtlSaldo1").NavigateUrl = LigaTot - e.Row.FCHyperLink("HplSaldo").NavigateUrl = LigaTot - - If e.Row.FCHyperLink("HplSaldo").Text = "0.00" Then e.Row.FCHyperLink("HplSaldo").Text = "-" - If e.Row.FCHyperLink("HplColumna1").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna1").Text = "-" - If e.Row.FCHyperLink("HplColumna2").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna2").Text = "-" - If e.Row.FCHyperLink("HplColumna3").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna3").Text = "-" - If e.Row.FCHyperLink("HplColumna4").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna4").Text = "-" - If e.Row.FCHyperLink("HplColumna5").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna5").Text = "-" - If e.Row.FCHyperLink("HplColumna6").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna6").Text = "-" - If e.Row.FCHyperLink("HplColumna7").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna7").Text = "-" - If e.Row.FCHyperLink("HplColumna8").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna8").Text = "-" - If e.Row.FCHyperLink("HplColumna9").Text.ToDouble = 0 Then e.Row.FCHyperLink("HplColumna9").Text = "-" - If e.Row.FCHyperLink("LtlPorVencer").Text = "0.00" Then e.Row.FCHyperLink("LtlPorVencer").Text = "-" - If e.Row.FCHyperLink("LtlVentas").Text = "0.00" Then e.Row.FCHyperLink("LtlVentas").Text = "-" - If e.Row.FCHyperLink("LtlSaldo1").Text = "0.00" Then e.Row.FCHyperLink("LtlSaldo1").Text = "-" - - e.Row.Cells(2).Width = Unit.Pixel(75) - e.Row.Cells(3).Width = Unit.Pixel(75) - e.Row.Cells(4).Width = Unit.Pixel(75) - e.Row.Cells(5).Width = Unit.Pixel(75) - e.Row.Cells(6).Width = Unit.Pixel(75) - e.Row.Cells(7).Width = Unit.Pixel(75) - e.Row.Cells(8).Width = Unit.Pixel(75) - e.Row.Cells(9).Width = Unit.Pixel(75) - e.Row.Cells(10).Width = Unit.Pixel(75) - e.Row.Cells(11).Width = Unit.Pixel(75) - End If End Sub @@ -584,7 +1018,356 @@ Partial Class Compras_RepCxP Protected Sub ImgExcel_Click(sender As Object, e As System.EventArgs) Handles ImgExcel.Click - GenerarPDF("EXCEL") + Dim Mov As New ClsMovimientos + Dim FechaI As String = txtFechaI.Text + Dim FechaF As String = txtFechaF.Text + Dim FechaVI As String = txtFechaVI.Text + Dim FechaVF As String = txtFechaVF.Text + If txtFechaI.Text = "" Then FechaI = "-1" + If txtFechaF.Text = "" Then FechaF = "-1" + If txtFechaVI.Text = "" Then FechaVI = "-1" + If txtFechaVF.Text = "" Then FechaVF = "-1" + Dim TipoAgrupacion As Integer = IIf(chkAgruparMes.Checked, 1, -1) + Dim TipoDocto As String = If(DdlTipoDocto.GetSelectedValuesM = "", "-1", DdlTipoDocto.GetSelectedValuesM) + If Mov.GetCxP(FechaI, FechaF, DdlProveedor.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, DdlProveedoresClasificaciones.SelectedValue.ToEntero, -1, DdlUsuarioResponsable.SelectedValue.ToEntero, DdlUsuarioRegistro.SelectedValue.ToEntero, DdlEstatusCompra.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlGrupo.SelectedValue.ToEntero, + DdlSubProyecto.SelectedValue.ToEntero, RblTipoCambio.SelectedValue.ToEntero, TCEspecifico, FechaVI, FechaVF, FechaCorte:=txtCorteA.Text.ToDate, CveUsuarioConsulta:=UsuarioActual.CveUsuario, CveTipoProveedor:=IIf(DdlTipoProveedor.SelectedValue.ToEntero = 3, -1, DdlTipoProveedor.SelectedValue.ToEntero), Comprobaciones:=DdlComprobacion.SelectedValue.ToEntero, + TipoDocto:=TipoDocto, TipoAgrupacion:=TipoAgrupacion) Then + + End If + Dim Dr As DataRow = Mov.DtResultados.Rows(0) + Dim NombreArchivo As String + SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet) + Dim workbook As New ExcelFile() + Dim worksheet = workbook.Worksheets.Add("Cxp") + Dim Mes(12) As String + Dim monthNames As String() = {"", "Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"} + Mes(0) = monthNames(Dr("NomMes1").ToString.ToDate.Month) + Mes(1) = monthNames(Dr("NomMes2").ToString.ToDate.Month) + Mes(2) = monthNames(Dr("NomMes3").ToString.ToDate.Month) + Mes(3) = monthNames(Dr("NomMes4").ToString.ToDate.Month) + Mes(4) = monthNames(Dr("NomMes5").ToString.ToDate.Month) + Mes(5) = monthNames(Dr("NomMes6").ToString.ToDate.Month) + Mes(6) = monthNames(Dr("NomMes7").ToString.ToDate.Month) + Mes(7) = monthNames(Dr("NomMes8").ToString.ToDate.Month) + Mes(8) = monthNames(Dr("NomMes9").ToString.ToDate.Month) + Mes(9) = monthNames(Dr("NomMes10").ToString.ToDate.Month) + Mes(10) = monthNames(Dr("NomMes11").ToString.ToDate.Month) + Mes(11) = monthNames(Dr("NomMes12").ToString.ToDate.Month) + Mes(12) = "12+" + If RblTipoCambio.SelectedValue = 3 And TxtEspecifico.Text <> "" Then + TCEspecifico = TxtEspecifico.Text + Else + TCEspecifico = -1 + End If + + + Dim DtExcel As DataTable + If chkAgruparMes.Checked Then + DtExcel = (From row As DataRow In Mov.DtResultados.Rows + Select New With + { + .GPO = row.Item("GPO"), + .Saldo = row.Item("Saldo"), + .TotalVencido = row.Item("vencido"), + .Mes1 = row.Item("Mes1"), + .Mes2 = row.Item("Mes2"), + .Mes3 = row.Item("Mes3"), + .Mes4 = row.Item("Mes4"), + .Mes5 = row.Item("Mes5"), + .Mes6 = row.Item("Mes6"), + .Mes7 = row.Item("Mes7"), + .Mes8 = row.Item("Mes8"), + .Mes9 = row.Item("Mes9"), + .Mes10 = row.Item("Mes10"), + .Mes11 = row.Item("Mes11"), + .Mes12 = row.Item("Mes12"), + .Mes13 = row.Item("Mes13"), + .TotalxVencer = row.Item("por_vencer") + }).QueryToDataTable(True) + Dim RowDolares As Integer = 0 + For Each row As DataRow In DtExcel.Rows + If row("GPO").ToString = "Dólares" Then + RowDolares += 1 + Exit For + Else + RowDolares += 1 + End If + Next + + worksheet.InsertDataTable(DtExcel, New InsertDataTableOptions() With + { + .ColumnHeaders = True, + .StartRow = 0, + .StartColumn = 0 + }) + worksheet.Columns("B").Style.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(217, 217, 217), SpreadsheetColor.FromArgb(255, 255, 255)) + worksheet.Columns("C").Style.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(217, 217, 217), SpreadsheetColor.FromArgb(255, 255, 255)) + worksheet.Columns("Q").Style.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(217, 217, 217), SpreadsheetColor.FromArgb(255, 255, 255)) + worksheet.Rows(0).Style.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(217, 217, 217), SpreadsheetColor.FromArgb(255, 255, 255)) + worksheet.Rows(1).Style.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(103, 128, 159), SpreadsheetColor.FromArgb(255, 255, 255)) + worksheet.Rows(RowDolares).Style.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(103, 128, 159), SpreadsheetColor.FromArgb(255, 255, 255)) + + Dim columnCount = worksheet.CalculateMaxUsedColumns() + For i = 0 To columnCount + worksheet.Columns(i).AutoFit(1, worksheet.Rows(0), worksheet.Rows(worksheet.Rows.Count - 1)) + Next + + worksheet.Cells("A1").Value = DdlGrupo.SelectedItem.Text + worksheet.Cells("D1").Value = Mes(0) + worksheet.Cells("E1").Value = Mes(1) + worksheet.Cells("F1").Value = Mes(2) + worksheet.Cells("G1").Value = Mes(3) + worksheet.Cells("H1").Value = Mes(4) + worksheet.Cells("I1").Value = Mes(5) + worksheet.Cells("J1").Value = Mes(6) + worksheet.Cells("K1").Value = Mes(7) + worksheet.Cells("L1").Value = Mes(8) + worksheet.Cells("M1").Value = Mes(9) + worksheet.Cells("N1").Value = Mes(10) + worksheet.Cells("O1").Value = Mes(11) + worksheet.Cells("P1").Value = Mes(12) + + + NombreArchivo = "CxP" + workbook.Save(Response, $"{NombreArchivo}.xlsx", SaveOptions.XlsxDefault) + Else + 'DtExcel = (From row As DataRow In Mov.DtResultados.Rows + ' Select New With + ' { + ' .GPO = row.Item("GPO"), + ' .Saldo = row.Item("Saldo"), + ' .Columna1vencido = row.Item("Columna1"), + ' .Columna2vencido = row.Item("Columna2"), + ' .Columna3vencido = row.Item("Columna3"), + ' .Columna4vencido = row.Item("Columna4"), + ' .Columna5vencido = row.Item("Columna5"), + ' .Columna6vencido = row.Item("Columna6"), + ' .Columna7vencido = row.Item("Columna7"), + ' .Columna8vencido = row.Item("Columna8"), + ' .Columna9vencido = row.Item("Columna9"), + ' .Columna10vencido = row.Item("Columna10"), + ' .Columna11vencido = row.Item("Columna11"), + ' .Columna12vencido = row.Item("Columna12"), + ' .Columna13vencido = row.Item("Columna13"), + ' .TotalVencido = row.Item("vencido"), + ' .Columna1xVencer = row.Item("Columna1"), + ' .Columna2xVencer = row.Item("Columna2"), + ' .Columna3xVencer = row.Item("Columna3"), + ' .Columna4xVencer = row.Item("Columna4"), + ' .Columna5xVencer = row.Item("Columna5"), + ' .Columna6xVencer = row.Item("Columna6"), + ' .Columna7xVencer = row.Item("Columna7"), + ' .Columna8xVencer = row.Item("Columna8"), + ' .Columna9xVencer = row.Item("Columna9"), + ' .Columna10xVencer = row.Item("Columna10"), + ' .Columna11xVencer = row.Item("Columna11"), + ' .Columna12xVencer = row.Item("Columna12"), + ' .Columna13xVencer = row.Item("Columna13"), + ' .TotalxVencer = row.Item("por_vencer") + ' }).QueryToDataTable(True) + GenerarPDF("EXCEL") + + End If + Mov.Dispose() + + + + + + 'If chkAgruparMes.Checked Then + + 'Else + ' Dim Vencido As Integer = 0 + ' Dim Xvencer As Integer = 0 + ' If Dr("TC1").ToString.ToEntero = 1 Then + ' worksheet.Cells("C1").Value = Dr("NomC1").ToString + ' Vencido += 1 + ' ElseIf Dr("TC1").ToString.ToEntero = 2 Then + ' worksheet.Cells("Q1").Value = Dr("NomC1").ToString + ' Xvencer += 1 + ' End If + ' If Dr("TC2").ToString.ToEntero = 1 Then + ' worksheet.Cells("D1").Value = Dr("NomC2").ToString + ' Vencido += 1 + ' ElseIf Dr("TC2").ToString.ToEntero = 2 Then + ' worksheet.Cells("R1").Value = Dr("NomC2").ToString + ' Xvencer += 1 + ' End If + ' If Dr("TC3").ToString.ToEntero = 1 Then + ' worksheet.Cells("E1").Value = Dr("NomC3").ToString + ' Vencido += 1 + ' ElseIf Dr("TC3").ToString.ToEntero = 2 Then + ' worksheet.Cells("S1").Value = Dr("NomC3").ToString + ' Xvencer += 1 + ' End If + ' If Dr("TC4").ToString.ToEntero = 1 Then + ' worksheet.Cells("F1").Value = Dr("NomC4").ToString + ' Vencido += 1 + ' ElseIf Dr("TC4").ToString.ToEntero = 2 Then + ' worksheet.Cells("T1").Value = Dr("NomC4").ToString + ' Xvencer += 1 + ' End If + ' If Dr("TC5").ToString.ToEntero = 1 Then + ' worksheet.Cells("G1").Value = Dr("NomC5").ToString + ' Vencido += 1 + ' ElseIf Dr("TC5").ToString.ToEntero = 2 Then + ' worksheet.Cells("U1").Value = Dr("NomC5").ToString + ' Xvencer += 1 + ' End If + ' If Dr("TC6").ToString = "1" Then + ' worksheet.Cells("H1").Value = Dr("NomC6").ToString + ' Vencido += 1 + ' ElseIf Dr("TC6").ToString.ToEntero = 2 Then + ' worksheet.Cells("V1").Value = Dr("NomC6").ToString + ' Xvencer += 1 + ' End If + ' If Dr("TC7").ToString.ToEntero = 1 Then + ' worksheet.Cells("I1").Value = Dr("NomC7").ToString + ' Vencido += 1 + ' ElseIf Dr("TC7").ToString.ToEntero = 2 Then + ' worksheet.Cells("W1").Value = Dr("NomC7").ToString + ' Xvencer += 1 + ' End If + ' If Dr("TC8").ToString.ToEntero = 1 Then + ' worksheet.Cells("J1").Value = Dr("NomC8").ToString + ' Vencido += 1 + ' ElseIf Dr("TC8").ToString.ToEntero = 2 Then + ' worksheet.Cells("X1").Value = Dr("NomC8").ToString + ' Xvencer += 1 + ' End If + ' If Dr("TC9").ToString.ToEntero = 1 Then + ' worksheet.Cells("K1").Value = Dr("NomC9").ToString + ' Vencido += 1 + ' ElseIf Dr("TC9").ToString.ToEntero = 2 Then + ' worksheet.Cells("Y1").Value = Dr("NomC9").ToString + ' Xvencer += 1 + ' End If + ' If Dr("TC10").ToString.ToEntero = 1 Then + ' worksheet.Cells("L1").Value = Dr("NomC10").ToString + ' Vencido += 1 + ' ElseIf Dr("TC10").ToString.ToEntero = 2 Then + ' worksheet.Cells("Z1").Value = Dr("NomC10").ToString + ' Xvencer += 1 + ' End If + ' If Dr("TC11").ToString.ToEntero = 1 Then + ' worksheet.Cells("M1").Value = Dr("NomC11").ToString + ' Vencido += 1 + ' ElseIf Dr("TC11").ToString.ToEntero = 2 Then + ' worksheet.Cells("AA1").Value = Dr("NomC11").ToString + ' Xvencer += 1 + ' End If + ' If Dr("TC12").ToString.ToEntero = 1 Then + ' worksheet.Cells("N1").Value = Dr("NomC12").ToString + ' Vencido += 1 + ' ElseIf Dr("TC12").ToString.ToEntero = 2 Then + ' worksheet.Cells("AB1").Value = Dr("NomC12").ToString + ' Xvencer += 1 + ' End If + ' If Dr("TC13").ToString.ToEntero = 1 Then + ' worksheet.Cells("O1").Value = Dr("NomC13").ToString + ' Vencido += 1 + ' ElseIf Dr("TC13").ToString.ToEntero = 2 Then + ' worksheet.Cells("AC1").Value = Dr("NomC13").ToString + ' Xvencer += 1 + ' End If + + + ' If Dr("TC13").ToString.ToEntero <> 2 Then + ' worksheet.Columns.Remove(28) + ' End If + ' If Dr("TC12").ToString.ToEntero <> 2 Then + ' worksheet.Columns.Remove(27) + ' End If + + ' If Dr("TC11").ToString.ToEntero <> 2 Then + ' worksheet.Columns.Remove(26) + ' End If + + ' If Dr("TC10").ToString.ToEntero <> 2 Then + ' worksheet.Columns.Remove(25) + ' End If + ' If Dr("TC9").ToString.ToEntero <> 2 Then + ' worksheet.Columns.Remove(24) + ' End If + + ' If Dr("TC8").ToString.ToEntero <> 2 Then + ' worksheet.Columns.Remove(23) + ' End If + ' If Dr("TC7").ToString.ToEntero <> 2 Then + ' worksheet.Columns.Remove(22) + ' End If + + ' If Dr("TC6").ToString.ToEntero <> 2 Then + ' worksheet.Columns.Remove(21) + ' End If + ' If Dr("TC5").ToString.ToEntero <> 2 Then + ' worksheet.Columns.Remove(20) + ' End If + + ' If Dr("TC4").ToString.ToEntero <> 2 Then + ' worksheet.Columns.Remove(19) + ' End If + ' If Dr("TC3").ToString.ToEntero <> 2 Then + ' worksheet.Columns.Remove(18) + ' End If + ' If Dr("TC2").ToString.ToEntero <> 2 Then + ' worksheet.Columns.Remove(17) + ' End If + ' If Dr("TC1").ToString.ToEntero <> 2 Then + ' worksheet.Columns.Remove(16) + ' End If + + + ' If Dr("TC13").ToString.ToEntero <> 1 Then + ' worksheet.Columns.Remove(14) + ' End If + + ' If Dr("TC12").ToString.ToEntero <> 1 Then + ' worksheet.Columns.Remove(13) + ' End If + + ' If Dr("TC11").ToString.ToEntero <> 1 Then + ' worksheet.Columns.Remove(12) + ' End If + + ' If Dr("TC10").ToString.ToEntero <> 1 Then + ' worksheet.Columns.Remove(11) + ' End If + ' If Dr("TC9").ToString.ToEntero <> 1 Then + ' worksheet.Columns.Remove(10) + ' End If + + ' If Dr("TC8").ToString.ToEntero <> 1 Then + ' worksheet.Columns.Remove(9) + ' End If + ' If Dr("TC7").ToString.ToEntero <> 1 Then + ' worksheet.Columns.Remove(8) + ' End If + + ' If Dr("TC6").ToString.ToEntero <> 1 Then + ' worksheet.Columns.Remove(7) + ' End If + ' If Dr("TC5").ToString.ToEntero <> 1 Then + ' worksheet.Columns.Remove(6) + ' End If + + ' If Dr("TC4").ToString.ToEntero <> 1 Then + ' worksheet.Columns.Remove(5) + ' End If + ' If Dr("TC3").ToString.ToEntero <> 1 Then + ' worksheet.Columns.Remove(4) + ' End If + ' If Dr("TC2").ToString.ToEntero <> 1 Then + ' worksheet.Columns.Remove(3) + ' End If + ' If Dr("TC1").ToString.ToEntero <> 1 Then + ' worksheet.Columns.Remove(2) + ' End If + 'End If + + + + End Sub Private Sub ImgImprimir_Click(sender As Object, e As EventArgs) Handles ImgImprimir.Click @@ -867,8 +1650,8 @@ Partial Class Compras_RepCxP Exit Sub End If - If DtPersonalizarRango.Rows.Count > 8 Then - Alert("Tiene que haber un maximo de 8 columnas.", TipoMensaje.MsgAdvertencia) + If DtPersonalizarRango.Rows.Count > 13 Then + Alert("Tiene que haber un maximo de 13 columnas.", TipoMensaje.MsgAdvertencia) Exit Sub End If diff --git a/Compras/RepCxPDetalle.aspx.vb b/Compras/RepCxPDetalle.aspx.vb index 8a61cd2fe..02d03676d 100644 --- a/Compras/RepCxPDetalle.aspx.vb +++ b/Compras/RepCxPDetalle.aspx.vb @@ -386,11 +386,11 @@ Partial Class RepCxPDetalle TMP_DTDatos = ObjMovtos.DtResultados TMP_DTDatos.Columns.Add("Cuenta") - If DdlGrupo.SelectedValue.ToEntero = 5 And UsuarioActual.Empresa.UsaContabilidad Then + If DdlGrupo.SelectedValue.ToEntero = 5 And UsuarioActual.Empresa.UsaContabilidad Then 'cuando es grupo por proveedor, se muestra la cuneta contable TMP_DTDatos = CargaCuentasContables(TMP_DTDatos) - GvDatos.Columns(7).Visible = True + GvDatos.Columns(11).Visible = True Else - GvDatos.Columns(7).Visible = False + GvDatos.Columns(11).Visible = False End If DtDatos = TMP_DTDatos diff --git a/Compras/RepNotasCredito.aspx.vb b/Compras/RepNotasCredito.aspx.vb index c8b67396c..23f1151b2 100644 --- a/Compras/RepNotasCredito.aspx.vb +++ b/Compras/RepNotasCredito.aspx.vb @@ -175,21 +175,18 @@ Partial Class Compras_RepNotasCredito Dim CveConceptoFluctua As Integer = 64 '64.ganacia, 65.perdida Dim TipoMovtoFluctua As Boolean = True Dim IdCtaContableFluctua As Integer - Dim CveCuenta As Integer = 0 If difFluctuacion < 0 Then CveConceptoFluctua = 65 TipoMovtoFluctua = False IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria - CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria Else CveConceptoFluctua = 64 TipoMovtoFluctua = True IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaGananciaCambiaria - CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria End If Dim ImporteFluctuacion As Decimal = Math.Abs((Importe * difFluctuacion).RoundSQL) - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoFluctua, ImporteFluctuacion, "", CveConceptoFluctua, Concepto, Now, IdCtaContableFluctua, -1, CveCompra:=gr.DataKey("CveCompra").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, ImporteMX:=ImporteFluctuacion, ImporteME:=ImporteFluctuacion, TipoCambio:=TCCompra, TipoCambioPago:=TC, CveCuenta:=CveCuenta) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoFluctua, ImporteFluctuacion, "", CveConceptoFluctua, Concepto, Now, IdCtaContableFluctua, -1, CveCompra:=gr.DataKey("CveCompra").ToEntero, CveProveedor:=gr.DataKey("CveProveedor").ToEntero, ImporteMX:=ImporteFluctuacion, ImporteME:=ImporteFluctuacion, TipoCambio:=TCCompra, TipoCambioPago:=TC) Then MsgError = "Ocurrio un Error al saldar el movimiento" End If End If diff --git a/Contabilidad/FiltraPolizas.aspx.vb b/Contabilidad/FiltraPolizas.aspx.vb index df68997dd..f31632150 100644 --- a/Contabilidad/FiltraPolizas.aspx.vb +++ b/Contabilidad/FiltraPolizas.aspx.vb @@ -379,7 +379,7 @@ Partial Class Contabilidad_FiltraPolizas 'If ObjPoliza.GetPoliza(IdPoliza, -1, -1, -1, -1) AndAlso ObjPoliza.DtResultados.Rows.Count > 0 Then - If ObjConta.GetPrePolizasDetalle(CvePrePoliza) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then + If ObjConta.GetPrePolizasDetalle(CvePrePoliza, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then Dim dtVC As DataTable Dim dr As DataRow dtVC = ObjConta.DtResultados.FiltraParametros("Contabilizable = 1", "Orden") diff --git a/Contabilidad/RegPrePoliza.aspx b/Contabilidad/RegPrePoliza.aspx index 1d6823ab4..172b43029 100644 --- a/Contabilidad/RegPrePoliza.aspx +++ b/Contabilidad/RegPrePoliza.aspx @@ -317,7 +317,9 @@
- + Cuenta diff --git a/Contabilidad/RegPrePoliza.aspx.vb b/Contabilidad/RegPrePoliza.aspx.vb index ec1965253..6fd47f81b 100644 --- a/Contabilidad/RegPrePoliza.aspx.vb +++ b/Contabilidad/RegPrePoliza.aspx.vb @@ -133,6 +133,14 @@ Partial Class ContabilidadC_RegPrePoliza ViewState("Actualizar") = value End Set End Property + Public Property IDMovEditar As Integer + Get + Return CType(ViewState("IDMovEditar"), Integer) + End Get + Set(value As Integer) + ViewState("IDMovEditar") = value + End Set + End Property Private ReadOnly Property CvePeriodo As Integer Get @@ -357,6 +365,12 @@ Partial Class ContabilidadC_RegPrePoliza .Add("TC", Type.GetType("System.Decimal")) .Add("PorcentajeImpuesto", Type.GetType("System.Decimal")) .Add("CveCuenta", Type.GetType("System.Int32")) + .Add("ContadoTipoTransaccion", Type.GetType("System.Int32")) + .Add("ContadoCuenta", Type.GetType("System.Int32")) + .Add("ContadoNumeroFolio", Type.GetType("System.String")) + .Add("ContadoImporte", Type.GetType("System.Double")) + .Add("ContadoBeneficiario", Type.GetType("System.String")) + .Add("ContadoObservaciones", Type.GetType("System.String")) End With End Sub @@ -518,7 +532,7 @@ Partial Class ContabilidadC_RegPrePoliza 'Asignamos los Subproyectos e.Row.FCDropDownList("DdlSubProyecto").DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) e.Row.FCDropDownList("DdlSubProyecto").DataBind() - 'e.Row.FCDropDownList("DdlSubProyecto").Items.Insert(0, New ListItem(" - ", "-1")) + e.Row.FCDropDownList("DdlSubProyecto").Items.Insert(0, New ListItem(" - ", "-1")) e.Row.FCDropDownList("DdlSubProyecto").SelectedValueExist(e.Row.DataKey("CveSubProyecto")) 'Asignamos los Tipos de Gasto @@ -931,9 +945,13 @@ Partial Class ContabilidadC_RegPrePoliza If e.Row.DataKey("CveConcepto").ToEntero().Contiene(30) Then e.Row.FCLinkButton("ImgBancos").Visible = True - If CveTipoTransaccion > 0 And CveCuenta > 0 And Folio.Length > 0 And ImporteDocumento > 0 And Beneficiario.Length > 0 Then + If e.Row.DataKey("ContadoTipoTransaccion").ToEntero > 0 And e.Row.DataKey("ContadoCuenta").ToEntero > 0 And e.Row.DataKey("ContadoNumeroFolio").ToString.Length > 0 And + e.Row.DataKey("ContadoImporte").ToDecimal > 0 And e.Row.DataKey("ContadoBeneficiario").ToString.Length > 0 Then e.Row.FCLinkButton("ImgBancos").CssClass = "btn btn-circle btn-sm green" End If + 'If CveTipoTransaccion > 0 And CveCuenta > 0 And Folio.Length > 0 And ImporteDocumento > 0 And Beneficiario.Length > 0 Then + ' e.Row.FCLinkButton("ImgBancos").CssClass = "btn btn-circle btn-sm green" + 'End If End If If e.Row.DataKey("CveConcepto").ToEntero().Contiene(17) Then @@ -971,10 +989,6 @@ Partial Class ContabilidadC_RegPrePoliza If CvePrePoliza > 0 Then 'Nuevo Modulo Charlie ActualizarPrePoliza() - - - - Else Dim MensajeAlert = New StringBuilder Dim ObjIE As New ClsBancos() @@ -999,10 +1013,6 @@ Partial Class ContabilidadC_RegPrePoliza Dim TipoMovto As Boolean = False Dim IdCtaContable As Integer = 0 Dim PorcentajeImpuesto As Decimal = 0 - - - - Dim CveProveedor As Integer = -1 Dim CveCompra As Integer = -1 @@ -1035,7 +1045,11 @@ Partial Class ContabilidadC_RegPrePoliza If CveConcepto = 30 AndAlso Importe <> 0 Then 'Registra movimieno bancario If CveConcepto = 30 Then - CveIE = ObjIE.AddBancos_IE(CveCuenta, CveTipoTransaccion, TxtFecha.Text, Folio, Beneficiario, ImporteDocumento, CveMoneda, 0, Observaciones, "", False, False, 0, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + + CveIE = ObjIE.AddBancos_IE(gvr.DataKey("ContadoCuenta").ToEntero, gvr.DataKey("ContadoTipoTransaccion").ToEntero, TxtFecha.Text, gvr.DataKey("ContadoNumeroFolio").ToString, + gvr.DataKey("ContadoBeneficiario").ToString, gvr.DataKey("ContadoImporte").ToString.ToDecimal, CveMoneda, 0, gvr.DataKey("ContadoObservaciones").ToString, "", + False, False, 0, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + If CveIE < 0 Then MsgError = "No se pudo registrar movimiento bancario" CveIEInsertado = CveIE If ObjIE.GetBancosIE(CveIE, -1, -1, "-1", -1, "-1", "-1", -1, -1, -1, -1, -1, MinFecha, MaxFecha, MinFecha, MaxFecha, MinFecha, MaxFecha, -1, -1, UsuarioActual.CveEmpresa) Then @@ -1069,6 +1083,9 @@ Partial Class ContabilidadC_RegPrePoliza Exit For End If End If + If CveIE > 0 AndAlso gvr.DataKey("CveConcepto").ToEntero = 30 Then + MensajeAlert.AppendFormat("

Folio Bancario:
{1}", CveIE, FolioIE) + End If Next @@ -1144,7 +1161,6 @@ Partial Class ContabilidadC_RegPrePoliza If Conta IsNot Nothing Then Conta.Dispose() End If End Sub - Private Sub ActualizarPrePoliza() Dim contador As Integer = 0 'Dim diferencia As String = "" @@ -1483,6 +1499,18 @@ Partial Class ContabilidadC_RegPrePoliza CargaTipoTransaccion("Egs") End If + Dim IdMov As Integer = GvRow.DataKey("IdMov").ToString.ToEntero + Dim Rows As DataRow() = DtMovimientos.Select("IdMov = " & IdMov) + IDMovEditar = IdMov + + If Rows.Count > 0 Then + Dim dr As DataRow = Rows(0) + DdlTipoTransaccion.SelectedValueExist(dr("ContadoTipoTransaccion").ToString.ToEntero) + DdlCuenta.SelectedValueExist(dr("ContadoCuenta").ToString.ToEntero) + TxtDocumentoFolio.Text = dr("ContadoNumeroFolio").ToString + TxtDocumentoObservaciones.Text = dr("ContadoObservaciones").ToString + TxtDocumentoBeneficiario.Text = dr("ContadoBeneficiario").ToString + End If TxtDocumentoImporte.Text = If(GvRow.FCTextBox("TxtAbono").Text = "", GvRow.FCTextBox("TxtCargo").Text.FormatoNumero, GvRow.FCTextBox("TxtAbono").Text.FormatoNumero) UpBancos.Update() @@ -1501,13 +1529,30 @@ Partial Class ContabilidadC_RegPrePoliza DdlCuenta.Items.Insert(0, New ListItem("Seleccione", "-1")) End Sub Private Sub BtnContado_Click(sender As Object, e As EventArgs) Handles BtnContado.Click - CveConcepto = 30 - CveTipoTransaccion = DdlTipoTransaccion.SelectedValue.ToEntero() - CveCuenta = DdlCuenta.SelectedValue.ToEntero() - Folio = TxtDocumentoFolio.Text - ImporteDocumento = TxtDocumentoImporte.Text.ToDecimal() - Observaciones = TxtDocumentoObservaciones.Text - Beneficiario = TxtDocumentoBeneficiario.Text + Dim Rows As DataRow() = DtMovimientos.Select("IdMov = " & IDMovEditar) + + If Rows.Count > 0 Then + Dim dr As DataRow = Rows(0) + + + dr("ContadoTipoTransaccion") = DdlTipoTransaccion.SelectedValue.ToEntero + dr("ContadoCuenta") = DdlCuenta.SelectedValue.ToEntero + dr("ContadoNumeroFolio") = TxtDocumentoFolio.Text + dr("ContadoImporte") = TxtDocumentoImporte.Text.ToDecimal + dr("ContadoBeneficiario") = TxtDocumentoBeneficiario.Text + dr("ContadoObservaciones") = TxtDocumentoObservaciones.Text + End If + DtMovimientos.AcceptChanges() + GvMov.DataSource = DtMovimientos + GvMov.DataBind() + 'CveTipoTransaccion = DdlTipoTransaccion.SelectedValue.ToEntero + 'CveCuenta = DdlCuenta.SelectedValue.ToEntero + 'Folio = TxtDocumentoFolio.Text + 'ImporteDocumento = TxtDocumentoImporte.Text.ToDecimal + 'Observaciones = TxtDocumentoObservaciones.Text + 'Beneficiario = TxtDocumentoBeneficiario.Text + + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivContadoModal")) GvMov.Rows(RowIndex).FCLinkButton("ImgBancos").CssClass = "btn btn-circle btn-sm green" UPMovs.Update() @@ -1900,7 +1945,7 @@ Partial Class ContabilidadC_RegPrePoliza 'If ObjPoliza.GetPoliza(IdPoliza, -1, -1, -1, -1) AndAlso ObjPoliza.DtResultados.Rows.Count > 0 Then - If ObjConta.GetPrePolizasDetalle(CvePrePoliza) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then + If ObjConta.GetPrePolizasDetalle(CvePrePoliza, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then Dim dtVC As DataTable Dim dr As DataRow dtVC = ObjConta.DtResultados diff --git a/Contabilidad/RegPrePolizaS.aspx b/Contabilidad/RegPrePolizaS.aspx index 1868ddeed..f579a6d2d 100644 --- a/Contabilidad/RegPrePolizaS.aspx +++ b/Contabilidad/RegPrePolizaS.aspx @@ -206,7 +206,7 @@ - +
@@ -224,9 +224,7 @@ - - - + @@ -521,8 +519,6 @@ Cuenta
- <%----%> - <%--
--%>
@@ -742,7 +738,7 @@ Cuenta:
-
+

diff --git a/Contabilidad/RegPrePolizaS.aspx.vb b/Contabilidad/RegPrePolizaS.aspx.vb index e9f305103..706b97522 100644 --- a/Contabilidad/RegPrePolizaS.aspx.vb +++ b/Contabilidad/RegPrePolizaS.aspx.vb @@ -1,5 +1,4 @@ - - + Imports System.Data Imports Extensiones Imports System.Linq @@ -625,12 +624,15 @@ Partial Class ContabilidadC_RegPrePolizaS Private Sub CargaCuentasContables() Dim ObjConta As New ClsContabilidad If ObjConta.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then - DdlCtaContable.DataSource = ObjConta.DtResultados + DdlCuentaContableE.DataSource = ObjConta.DtResultados + DdlCuentaContable.DataSource = ObjConta.DtResultados DtCuentasContables = ObjConta.DtResultados End If - ObjConta.Dispose() - DdlCtaContable.DataBind() - DdlCtaContable.Items.Insert(0, New ListItem("Sin Asignar", "0")) + ObjConta.Dispose() + DdlCuentaContable.DataBind() + DdlCuentaContable.Items.Insert(0, New ListItem("Seleccione", "0")) + DdlCuentaContableE.DataBind() + DdlCuentaContableE.Items.Insert(0, New ListItem("Sin Asignar", "0")) End Sub Private Sub CargaTiposGasto() @@ -729,20 +731,20 @@ Partial Class ContabilidadC_RegPrePolizaS IdCuenta = 0 CodigoCuenta = "" NombreCuenta = "" - If drt("IdCtaContable").ToString.ToEntero > 0 Then 'DtCuentasContables - Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", drt("IdCtaContable").ToString)) - If drr IsNot Nothing Then - IdCuenta = drt("IdCtaContable").ToString.ToEntero - CodigoCuenta = drr("CuentaFormato").ToString() - NombreCuenta = drr("Nombre").ToString() - 'Cuenta = drr("Nombre").ToString() - End If - EsComodin = 0 - End If + 'If drt("IdCtaContable").ToString.ToEntero > 0 Then 'DtCuentasContables + ' Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", drt("IdCtaContable").ToString)) + ' If drr IsNot Nothing Then + ' IdCuenta = drt("IdCtaContable").ToString.ToEntero + ' CodigoCuenta = drr("CuentaFormato").ToString() + ' NombreCuenta = drr("Nombre").ToString() + ' 'Cuenta = drr("Nombre").ToString() + ' End If + ' EsComodin = 0 + 'End If Dim dr As DataRow = DtMovimientos.NewRow - dr("CodigoCuenta") = CodigoCuenta & "
" & NombreCuenta + dr("CodigoCuenta") = drt("Codigo").ToString & "
" & drt("Nombre").ToString dr("Cuenta") = Cuenta 'TxtCuentaContable.Text dr("Referencia") = If(drt("CveConcepto").ToString.Contiene("29", "130"), drt("Personal"), drt("RazonSocial")) dr("Concepto") = TxtObservaciones.Text @@ -838,7 +840,7 @@ Partial Class ContabilidadC_RegPrePolizaS e.Row.FCLinkButton("ImgBancos").Visible = True If e.Row.DataKey("ContadoTipoTransaccion").ToEntero > 0 And e.Row.DataKey("ContadoCuenta").ToEntero > 0 And e.Row.DataKey("ContadoNumeroFolio").ToString.Length > 0 And - e.Row.DataKey("ContadoImporte").ToEntero > 0 And e.Row.DataKey("ContadoBeneficiario").ToString.Length > 0 Then + e.Row.DataKey("ContadoImporte").ToDecimal > 0 And e.Row.DataKey("ContadoBeneficiario").ToString.Length > 0 Then e.Row.FCLinkButton("ImgBancos").CssClass = "btn btn-circle btn-sm green" End If End If @@ -858,13 +860,28 @@ Partial Class ContabilidadC_RegPrePolizaS Next End If + 'validaciones + + If Not (TotalCargos = TotalAbonos AndAlso (GvPrePoliza.Rows.Count > 0 Or GvMov.Rows.Count > 0)) Then Alert($"La suma de los movimientos no son iguales ({TotalCargos}-{TotalAbonos})", TipoMensaje.MsgAdvertencia) Exit Sub - End If + End If + + For Each Gvr As GridViewRow In GvMov.Rows + If Gvr.DataKey("CveConceptoContable") = "30" AndAlso Gvr.FCTextBox("TxtCargo").Text.ToDecimal <> 0 Then 'si es movimietno de bancos, y tiene cantidad, deben de especificarse los datos del IE + If Gvr.DataKey("ContadoCuenta").ToEntero = 0 OrElse Gvr.DataKey("ContadoTipoTransaccion").ToEntero = 0 Then + Alert($"La suma de los movimientos no son iguales ({TotalCargos}-{TotalAbonos})", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + End If + + Next + + + 'terminan validaciones If CvePrePoliza > 0 Then - 'Nuevo Modulo Charlie ActualizarPrePoliza() Else Dim MensajeAlert = New StringBuilder @@ -902,10 +919,13 @@ Partial Class ContabilidadC_RegPrePolizaS CveIE = ObjIE.AddBancos_IE(gvr.DataKey("ContadoCuenta").ToEntero, gvr.DataKey("ContadoTipoTransaccion").ToEntero, TxtFecha.Text, gvr.DataKey("ContadoNumeroFolio").ToString, gvr.DataKey("ContadoBeneficiario").ToString, gvr.DataKey("ContadoImporte").ToString.ToDecimal, CveMoneda, 0, gvr.DataKey("ContadoObservaciones").ToString, "", False, False, 0, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - If CveIE < 0 Then MsgError = "No se pudo registrar movimiento bancario" - If ObjIE.GetBancosIE(CveIE, -1, -1, "-1", -1, "-1", "-1", -1, -1, -1, -1, -1, MinFecha, MaxFecha, MinFecha, MaxFecha, MinFecha, MaxFecha, -1, -1, UsuarioActual.CveEmpresa) Then - FolioIE = ObjIE.Folio + If CveIE < 0 Then + MsgError = "No se pudo registrar movimiento bancario" + Exit For End If + 'If ObjIE.GetBancosIE(CveIE, -1, -1, "-1", -1, "-1", "-1", -1, -1, -1, -1, -1, MinFecha, MaxFecha, MinFecha, MaxFecha, MinFecha, MaxFecha, -1, -1, UsuarioActual.CveEmpresa) Then + ' FolioIE = ObjIE.Folio + 'End If End If @@ -1045,7 +1065,7 @@ Partial Class ContabilidadC_RegPrePolizaS ImporteMX:=If(row.FCLiteral("TxtCargo").Text.ToDecimal <> 0, row.FCLiteral("TxtCargo").Text.ToDecimal, row.FCLiteral("TxtAbono").Text.ToDecimal), 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) Then + CvePersonal:=row.DataKey("CvePersonal").ToEntero, CveCuenta:=row.DataKey("CveCuenta").ToEntero) Then OcurrioError = True Exit For End If @@ -1123,7 +1143,7 @@ Partial Class ContabilidadC_RegPrePolizaS CargaTipoGastoE() DdlTipoGastoE.SelectedValueExist(CveTipoGasto) CargaCtaContableE() - DdlCtaContableE.SelectedValueExist(CveCuenta) + DdlCuentaContableE.SelectedValueExist(CveCuenta) If Cargo <> 0 Then TxtCargoE.Text = Cargo @@ -1160,12 +1180,12 @@ Partial Class ContabilidadC_RegPrePolizaS Private Sub CargaCtaContableE() Dim ObjConta As New ClsContabilidad If ObjConta.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then - DdlCtaContableE.DataSource = ObjConta.DtResultados + DdlCuentaContableE.DataSource = ObjConta.DtResultados End If ObjConta.Dispose() - DdlCtaContableE.DataBind() - DdlCtaContableE.Items.Insert(0, New ListItem("Sin Asignar", "0")) + DdlCuentaContableE.DataBind() + DdlCuentaContableE.Items.Insert(0, New ListItem("Sin Asignar", "0")) End Sub Private Sub DdlConceptosContablesE_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlConceptosContablesE.SelectedIndexChanged If DdlConceptosContablesE.SelectedValue.ToEntero.Contiene(5, 17, 201, 206, 14, 15, 16, 19, 25, 26, 21) Then @@ -1266,7 +1286,8 @@ Partial Class ContabilidadC_RegPrePolizaS If DtMovimientos Is Nothing Then CreaDT() If CvePrePoliza > 0 Then Dim dr As DataRow = DtMovimientos.NewRow - dr("IdCtaContable") = DdlCtaContableE.SelectedValue + dr("IdCtaContable") = DdlCuentaContableE.SelectedValue + dr("CveCuenta") = DdlCuentaContableE.SelectedValue dr("ConceptoContable") = DdlConceptosContablesE.SelectedItem.Text dr("CveConceptoContable") = DdlConceptosContablesE.SelectedValue dr("Concepto") = TxtConceptoE.Text @@ -1351,7 +1372,9 @@ Partial Class ContabilidadC_RegPrePolizaS If Rows.Count > 0 Then Dim dr As DataRow = Rows(0) - dr("IdCtaContable") = DdlCtaContableE.SelectedValue + dr("IdCtaContable") = DdlCuentaContableE.SelectedValue + dr("CveCuenta") = DdlCuentaContableE.SelectedValue + dr("CodigoNombreCuenta") = DdlCuentaContableE.SelectedItem.Text dr("ConceptoContable") = DdlConceptosContablesE.SelectedItem.Text dr("CveConceptoContable") = DdlConceptosContablesE.SelectedValue dr("Concepto") = TxtConceptoE.Text @@ -1366,8 +1389,6 @@ Partial Class ContabilidadC_RegPrePolizaS dr("CveCliente") = DdlClientesE.SelectedValue.ToEntero dr("CveVenta") = DdlVentasE.SelectedValue.ToEntero dr("FolioFactura") = If(DdlComprasE.Visible = True, DdlComprasE.SelectedItem.ToString, If(DdlVentasE.Visible = True, DdlVentasE.SelectedItem.ToString, "")) - dr("CveCuenta") = DdlCtaContableE.SelectedValue.ToEntero - dr("CodigoNombreCuenta") = DdlCtaContableE.SelectedItem.Text dr("Modificado") = True @@ -1445,10 +1466,10 @@ Partial Class ContabilidadC_RegPrePolizaS Dim dr As DataRow = Rows(0) Dim CodigoCuenta As String = "" Dim NombreCuenta As String = "" - dr("CveCuenta") = DdlCtaContable.SelectedValue + dr("CveCuenta") = DdlCuentaContable.SelectedValue - If DdlCtaContable.SelectedValue.ToEntero > 0 Then - Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("CveCuenta={0}", DdlCtaContable.SelectedValue)) + If DdlCuentaContable.SelectedValue.ToEntero > 0 Then + Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("CveCuenta={0}", DdlCuentaContable.SelectedValue)) If drr IsNot Nothing Then CodigoCuenta = drr("CuentaFormato").ToString() NombreCuenta = drr("Nombre").ToString() @@ -1472,7 +1493,6 @@ Partial Class ContabilidadC_RegPrePolizaS dr("CveClasificacion") = -1 dr("CveCliente") = DdlClientes.SelectedValue.ToEntero dr("CveVenta") = DdlVentas.SelectedValue.ToEntero - dr("CveCuenta") = DdlCtaContable.SelectedValue.ToEntero End If GvMov.DataSource = DtMovimientos GvMov.DataBind() @@ -1484,7 +1504,8 @@ Partial Class ContabilidadC_RegPrePolizaS If CvePrePoliza > 0 Then Dim dr As DataRow = DtMovimientos.NewRow - dr("IdCtaContable") = -1 'DdlCtaContable.SelectedValue + dr("IdCtaContable") = -1 'DdlCtaContable.SelectedValue + dr("CveCuenta") = DdlCuentaContable.SelectedValue dr("ConceptoContable") = DdlConceptosContables.SelectedItem.Text dr("CveConceptoContable") = DdlConceptosContables.SelectedValue dr("Concepto") = TxtDescripcion.Text @@ -1517,10 +1538,10 @@ Partial Class ContabilidadC_RegPrePolizaS Dim CodigoCuenta As String = "" Dim NombreCuenta As String = "" - dr("CveCuenta") = DdlCtaContable.SelectedValue + dr("CveCuenta") = DdlCuentaContable.SelectedValue - If DdlCtaContable.SelectedValue.ToEntero > 0 Then - Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("CveCuenta={0}", DdlCtaContable.SelectedValue)) + If DdlCuentaContable.SelectedValue.ToEntero > 0 Then + Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("CveCuenta={0}", DdlCuentaContable.SelectedValue)) If drr IsNot Nothing Then CodigoCuenta = drr("CuentaFormato").ToString() NombreCuenta = drr("Nombre").ToString() @@ -1716,7 +1737,7 @@ Partial Class ContabilidadC_RegPrePolizaS If DrM IsNot Nothing Then HdnCve.Value = idMov.ToString - DdlCtaContable.SelectedValue = DrM("CveCuenta") + DdlCuentaContable.SelectedValue = DrM("CveCuenta") TxtReferencia.Text = DrM("Referencia") TxtObservaciones.Text = DrM("Concepto") ' (Math.Abs(TxtCargo.Text.ToDouble) > 0, 0, 1) = dr("TipoMovto") @@ -1890,7 +1911,11 @@ Partial Class ContabilidadC_RegPrePolizaS Dim NombreArchivo As String SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet) Dim workbook As New ExcelFile() - Dim worksheet = workbook.Worksheets.Add(DdlPlantilla2.SelectedItem.Text.ToString) + Dim NombreHoja As String = DdlPlantilla2.SelectedItem.Text.ToString + If NombreHoja.Length > 30 Then + NombreHoja = NombreHoja.Substring(0, 29) + End If + Dim worksheet = workbook.Worksheets.Add(NombreHoja) Dim CvePlantilla As Integer = DdlPlantilla2.SelectedValue.ToEntero Dim Dt As DataTable = GlobalDTContaPlantillasPolizasDetalle(CvePlantilla).FiltraParametros(String.Format("CveEmpresa={0}", UsuarioActual.CveEmpresa), "Orden") @@ -1960,43 +1985,43 @@ Partial Class ContabilidadC_RegPrePolizaS If Not ErrorArchivo Then - If Not dt.Columns(0).ColumnName = "ConceptoAdministrativo" Then + If Not dt.Columns(0).ColumnName.ToUpper = "CONCEPTOADMINISTRATIVO" Then Alert("El nombre de la primera columna debe ser 'ConceptoAdmin'. Favor de corregirlo", TipoMensaje.MsgError) Exit Sub End If - If Not dt.Columns(1).ColumnName = "Cuenta" Then + If Not dt.Columns(1).ColumnName.ToUpper = "CUENTA" Then Alert("El nombre de la segunda columna debe ser 'Cuenta'.Favor de corregirlo", TipoMensaje.MsgError) Exit Sub End If - If Not dt.Columns(2).ColumnName = "NombreCuenta" Then + If Not dt.Columns(2).ColumnName.ToUpper = "NOMBRECUENTA" Then Alert("El nombre de la tercera columna debe ser 'NombreCuenta'.Favor de corregirlo", TipoMensaje.MsgError) Exit Sub End If - If Not dt.Columns(3).ColumnName = "Cargo" Then + If Not dt.Columns(3).ColumnName.ToUpper = "CARGO" Then Alert("El nombre de la cuarta columna debe ser 'Cargo'. Favor de corregirlo", TipoMensaje.MsgError) Exit Sub End If - If Not dt.Columns(4).ColumnName = "Abono" Then + If Not dt.Columns(4).ColumnName.ToUpper = "ABONO" Then Alert("El nombre de la quinta columna debe ser 'Abono' .Favor de corregirlo", TipoMensaje.MsgError) Exit Sub End If - If Not dt.Columns(5).ColumnName = "Referencia" Then + If Not dt.Columns(5).ColumnName.ToUpper = "REFERENCIA" Then Alert("El nombre de la sexta columna debe ser 'Referencia'. Favor de corregirlo", TipoMensaje.MsgError) Exit Sub End If - If Not dt.Columns(6).ColumnName = "Concepto" Then + If Not dt.Columns(6).ColumnName.ToUpper = "CONCEPTO" Then Alert("El nombre de la séptima columna debe ser 'Concepto'.Favor de corregirlo", TipoMensaje.MsgError) Exit Sub End If - If Not dt.Columns(7).ColumnName = "SubProyecto" Then + If Not dt.Columns(7).ColumnName.ToUpper = "SUBPROYECTO" Then Alert("El nombre de la octava columna debe ser 'SubProyecto'. Favor de corregirlo", TipoMensaje.MsgError) Exit Sub End If - If Not dt.Columns(8).ColumnName = "Folio" Then + If Not dt.Columns(8).ColumnName.ToUpper = "FOLIO" Then Alert("El nombre de la novena columna debe ser 'Folio'.Favor de corregirlo", TipoMensaje.MsgError) Exit Sub End If - If Not dt.Columns(9).ColumnName = "TipoTransferencia" Then + If Not dt.Columns(9).ColumnName.ToUpper = "TIPOTRANSFERENCIA" Then Alert("El nombre de la decima columna debe ser 'TipoTransferencia'. Favor de corregirlo", TipoMensaje.MsgError) Exit Sub End If @@ -2024,7 +2049,7 @@ Partial Class ContabilidadC_RegPrePolizaS Dim CveClasificacion As Integer = -1 Dim CveCuentaExcel As Integer = -1 Dim ObjConta2 As New ClsContabilidad - Dim FolioExcel As Integer = -1 + Dim FolioExcel As Long = -1 Dim TipoMov As Integer = -1 Dim CveBancoCuenta As Integer = -1 If ObjConta2.GetCuentas(-1, Row("Cuenta").ToString.Replace("-", "").Trim, 1, UsuarioActual.CveEmpresa) Then @@ -2039,20 +2064,36 @@ Partial Class ContabilidadC_RegPrePolizaS Exit For End If - If CveConceptoContable = 30 Then + If CveConceptoContable = 30 AndAlso Row("TipoTransferencia").ToString <> "" Then + Dim objconta3 As New ClsContabilidad objconta3.GetConta_CuentasDataContabilidad(CveCuentaExcel, UsuarioActual.CveEmpresa) If objconta3.DtResultados.Rows.Count > 0 Then Dim rowcc As DataRow = objconta3.DtResultados.Rows(0) CveBancoCuenta = rowcc("CveBancoCuenta").ToString().ToEntero() - DdlCuenta.SelectedValue = CveBancoCuenta + Else + CveBancoCuenta = 0 End If + objconta3.Dispose() + + If CveBancoCuenta = 0 Then + Alert(String.Format("La cuenta {0} no está vinculada a una cuenta bancaria administrativa favor de verificar el archivo.", Row("Cuenta").ToString), TipoMensaje.MsgAdvertencia) + DtMovimientos.Clear() + Exit For + End If + TipoMov = GlobalDTTipoTransacciones.FiltroPrimeroValor("CveTipoTransaccion", String.Format("TipoTransaccion = '{0}' ", Row("TipoTransferencia"))).ToEntero - FolioExcel = Row("Folio").ToString + FolioExcel = Row("Folio").ToString.ToEntero CveTipoTransaccion = TipoMov CveCuenta = CveBancoCuenta + 'carga el consecutivo + + If FolioExcel = 0 Then + FolioExcel = SiguienteFolioBancos(CveBancoCuenta, TipoMov) + End If + Folio = FolioExcel - ImporteDocumento = IIf(Row("Abono").ToString.ToEntero > 0, Row("Abono").ToString, Row("Cargo").ToString) + ImporteDocumento = IIf(Row("Abono").ToString.ToDecimal > 0, Row("Abono").ToString.ToDecimal, Row("Cargo").ToString.ToDecimal) Observaciones = Row("Referencia").ToString Beneficiario = Row("Concepto").ToString If Not TipoMov > 0 Then @@ -2062,7 +2103,6 @@ Partial Class ContabilidadC_RegPrePolizaS End If - 'sino viene el cveconcepto, busca por le nombre del concepto If CveConceptoContable = 0 Then Alert(String.Format("El concepto {0} no se reconoció, favor de verificar el archivo.", Row("ConceptoAdministrativo"))) @@ -2110,14 +2150,16 @@ Partial Class ContabilidadC_RegPrePolizaS dr("CveCuenta") = CveCuentaExcel dr("ContadoTipoTransaccion") = CveTipoTransaccion - dr("ContadoCuenta") = CveCuenta - dr("ContadoNumeroFolio") = Folio + dr("ContadoCuenta") = CveBancoCuenta + dr("ContadoNumeroFolio") = FolioExcel dr("ContadoImporte") = ImporteDocumento dr("ContadoBeneficiario") = Beneficiario dr("ContadoObservaciones") = Observaciones - DtMovimientos.Rows.Add(dr) - DtMovimientos.AcceptChanges() + If Row("Cargo").ToString.ToDecimal <> 0 OrElse Row("Abono").ToString.ToDecimal Then + DtMovimientos.Rows.Add(dr) + DtMovimientos.AcceptChanges() + End If Next TxtTotalCargos.Text = DtMovimientos.SUMD("Cargo").ToString.FormatoNumero @@ -2128,13 +2170,72 @@ Partial Class ContabilidadC_RegPrePolizaS UPMovs.Update() Catch ex As Exception - Alert("No se pudo cargar el excel") + Alert("No se pudo cargar el excel", TipoMensaje.MsgAdvertencia) + GuardaLog(ex.Message) End Try + ArregloCuentasFolios = Nothing End If End Sub #End Region +#Region "Siguiente Folio" + Public Property ArregloCuentasFolios As DataTable + Get + + If ViewState("ArregloCuentasFolios") Is Nothing Then + Dim dt = New DataTable("CuentasBancos") + With dt.Columns + .Add("CveCuenta", Type.GetType("System.Int32")) + .Add("CveTipoTransaccion", Type.GetType("System.Int32")) + .Add("Folio", Type.GetType("System.Double")) + End With + ViewState("ArregloCuentasFolios") = dt + End If + + Return CType(ViewState("ArregloCuentasFolios"), DataTable) + End Get + Set(value As DataTable) + ViewState("ArregloCuentasFolios") = value + End Set + End Property + + + + Public Function SiguienteFolioBancos(CveCuentaBancos As Integer, CveTipoTransaccionBancos As Integer) As String + Dim Retorno As String = "0" + + Dim Folio As Long = ArregloCuentasFolios.FiltroPrimeroValor("Folio", String.Format("CveCuenta = {0} and CveTipoTransaccion = {1}", CveCuentaBancos, CveTipoTransaccionBancos)).ToLong + + If Folio = 0 Then + Dim Banco As New ClsBancos + Folio = Banco.GetNextFolio(CveCuentaBancos, CveTipoTransaccionBancos) + Banco.Dispose() + End If + + Folio += 1 + + Dim a As DataRow() = ArregloCuentasFolios.Select(String.Format("CveCuenta = {0} and CveTipoTransaccion = {1}", CveCuentaBancos, CveTipoTransaccionBancos)) + + If a.Count = 0 Then + Dim dr As DataRow = ArregloCuentasFolios.NewRow + dr("Folio") = Folio + dr("CveCuenta") = CveCuentaBancos + dr("CveTipoTransaccion") = CveTipoTransaccionBancos + ArregloCuentasFolios.Rows.Add(dr) + Else + a(0)("Folio") = Folio 'actualizo el folio + End If + + ArregloCuentasFolios.AcceptChanges() + + Return Folio + End Function +#End Region + + + + #Region "Paquete Egresos" Protected Sub LnkImprimirPDF_Click(sender As Object, e As EventArgs) ImprimirPolizaPDF(IdPoliza) @@ -2149,7 +2250,7 @@ Partial Class ContabilidadC_RegPrePolizaS 'If ObjPoliza.GetPoliza(IdPoliza, -1, -1, -1, -1) AndAlso ObjPoliza.DtResultados.Rows.Count > 0 Then - If ObjConta.GetPrePolizasDetalle(CvePrePoliza) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then + If ObjConta.GetPrePolizasDetalle(CvePrePoliza, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then Dim dtVC As DataTable Dim dr As DataRow dtVC = ObjConta.DtResultados.FiltraParametros("Contabilizable = 1", "Orden") diff --git a/Contabilidad2/CatCuentas.aspx b/Contabilidad2/CatCuentas.aspx index 8e0b6c729..ad6288165 100644 --- a/Contabilidad2/CatCuentas.aspx +++ b/Contabilidad2/CatCuentas.aspx @@ -225,6 +225,15 @@ (0% - 100% )
+ +
+
+
+ + + +
+

diff --git a/Contabilidad2/CatCuentas.aspx.vb b/Contabilidad2/CatCuentas.aspx.vb index d4a8d1ef1..d36ba565b 100644 --- a/Contabilidad2/CatCuentas.aspx.vb +++ b/Contabilidad2/CatCuentas.aspx.vb @@ -278,6 +278,7 @@ Partial Class Contabilidad2_CatCuentas CveAlmacen = rowcc("CveAlmacen").ToString().ToEntero() DdlAlmacen.SelectedValue = -1 DdlAlmacen.SelectedValueExist(CveAlmacen) + DdlPersonal.SelectedValueExist(rowcc("CvePersonal").ToString().ToEntero()) End If End Using @@ -686,6 +687,10 @@ Partial Class Contabilidad2_CatCuentas Case 6 pnlOpcion6.Visible = True + Case 8 + pnlOpcion8.Visible = True + DdlPersonal.DataSource = GlobalDTRHPersonal(UsuarioActual.CveEmpresa) + DdlPersonal.DataBind() End Select End If diff --git a/Contabilidad2/CatCuentasAsignaciones.aspx b/Contabilidad2/CatCuentasAsignaciones.aspx index 2ba7351cd..e27cdb81e 100644 --- a/Contabilidad2/CatCuentasAsignaciones.aspx +++ b/Contabilidad2/CatCuentasAsignaciones.aspx @@ -25,7 +25,7 @@ + Style=" text-align: center;width:100%" GridLines="None"> diff --git a/Contabilidad2/CatCuentasAsignaciones.aspx.vb b/Contabilidad2/CatCuentasAsignaciones.aspx.vb index 3202ecc39..5564dc374 100644 --- a/Contabilidad2/CatCuentasAsignaciones.aspx.vb +++ b/Contabilidad2/CatCuentasAsignaciones.aspx.vb @@ -39,7 +39,7 @@ Partial Class Contabilidad2_CatCuentasAsignaciones DdlCconceptosContables.DataSource = ObjConta.DtResultados End If - If ObjConta.GetCuentas(-1, "-1", -1, UsuarioActual.CveEmpresa) Then + If ObjConta.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then DdlCuenta.DataSource = ObjConta.DtResultados End If ObjConta.Dispose() diff --git a/Contabilidad2/RepAnexoCatalogo.aspx.vb b/Contabilidad2/RepAnexoCatalogo.aspx.vb index 680266bcf..db401a85a 100644 --- a/Contabilidad2/RepAnexoCatalogo.aspx.vb +++ b/Contabilidad2/RepAnexoCatalogo.aspx.vb @@ -123,12 +123,11 @@ Partial Class AC2_RepAnexoCatalogo If Request("CveSubProyecto") IsNot Nothing AndAlso IsNumeric(Request("CveSubProyecto")) Then CveSubProyecto = Request("CveSubProyecto").ToString + DdlSubproyecto.SelectedValueExist(CveSubProyecto) End If - ErrorParametros = False - If Request("TP") IsNot Nothing AndAlso IsNumeric(Request("TP")) AndAlso Request("TP").ToEntero > 0 Then TipoReporte = Request("TP").ToEntero diff --git a/Contabilidad2/RepAnexoCatalogoSAT.aspx b/Contabilidad2/RepAnexoCatalogoSAT.aspx.exclude similarity index 100% rename from Contabilidad2/RepAnexoCatalogoSAT.aspx rename to Contabilidad2/RepAnexoCatalogoSAT.aspx.exclude diff --git a/Contabilidad2/RepAnexoCatalogoSAT.aspx.vb b/Contabilidad2/RepAnexoCatalogoSAT.aspx.vb.exclude similarity index 100% rename from Contabilidad2/RepAnexoCatalogoSAT.aspx.vb rename to Contabilidad2/RepAnexoCatalogoSAT.aspx.vb.exclude diff --git a/Contabilidad2/RepBalanceGeneral.aspx b/Contabilidad2/RepBalanceGeneral.aspx.exclude similarity index 100% rename from Contabilidad2/RepBalanceGeneral.aspx rename to Contabilidad2/RepBalanceGeneral.aspx.exclude diff --git a/Contabilidad2/RepBalanceGeneral.aspx.vb b/Contabilidad2/RepBalanceGeneral.aspx.vb.exclude similarity index 100% rename from Contabilidad2/RepBalanceGeneral.aspx.vb rename to Contabilidad2/RepBalanceGeneral.aspx.vb.exclude diff --git a/Contabilidad2/RepBalanzaComprobacion.aspx b/Contabilidad2/RepBalanzaComprobacion.aspx index 41b29877a..3386193c7 100644 --- a/Contabilidad2/RepBalanzaComprobacion.aspx +++ b/Contabilidad2/RepBalanzaComprobacion.aspx @@ -56,10 +56,10 @@ - +
- + diff --git a/Contabilidad2/RepBalanzaComprobacionSAT.aspx b/Contabilidad2/RepBalanzaComprobacionSAT.aspx.exclude similarity index 100% rename from Contabilidad2/RepBalanzaComprobacionSAT.aspx rename to Contabilidad2/RepBalanzaComprobacionSAT.aspx.exclude diff --git a/Contabilidad2/RepBalanzaComprobacionSAT.aspx.vb b/Contabilidad2/RepBalanzaComprobacionSAT.aspx.vb.exclude similarity index 100% rename from Contabilidad2/RepBalanzaComprobacionSAT.aspx.vb rename to Contabilidad2/RepBalanzaComprobacionSAT.aspx.vb.exclude diff --git a/Contabilidad2/RepEstadoActividadesSAT.aspx b/Contabilidad2/RepEstadoActividadesSAT.aspx.exclude similarity index 100% rename from Contabilidad2/RepEstadoActividadesSAT.aspx rename to Contabilidad2/RepEstadoActividadesSAT.aspx.exclude diff --git a/Contabilidad2/RepEstadoActividadesSAT.aspx.vb b/Contabilidad2/RepEstadoActividadesSAT.aspx.vb.exclude similarity index 100% rename from Contabilidad2/RepEstadoActividadesSAT.aspx.vb rename to Contabilidad2/RepEstadoActividadesSAT.aspx.vb.exclude diff --git a/Contabilidad2/RepEstadoResultadosHorizontal - Copy.aspx b/Contabilidad2/RepEstadoResultadosHorizontal - Copy.aspx deleted file mode 100644 index 32123d23c..000000000 --- a/Contabilidad2/RepEstadoResultadosHorizontal - Copy.aspx +++ /dev/null @@ -1,1593 +0,0 @@ -<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepEstadoResultadosHorizontal - Copy.aspx.vb" Inherits="Contabilidad_RepEstadoResultadosHorizontal" %> - - - - - - - - - - - - - -
  • - Generar Excel -
  • -
  • - Graficar -
  • -
    - - - - -
    -
    -
    - -
    -
    -
    -
      - - -
      - - -
      - - -
      - - -
      - - -
      - - - - - - - - - - - - - - -
      - - - -
      - - -
      - - -
      - - - - - -
      - - -
      - - NO - Trimestre - Cuatrimestre - -
      - -
    -
    -
    -
    -
    -
    -
    - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - <%-- --%> - - - - - - - - <%-- --%> - - - - - - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -
    - - - - - - - - - - - -
    -

    Resultados del Ejercicio:

    -
    - - - -
    -
    -
    - -
    -
    - - - - - - - - - - -
    - - - - - - - - - - <%----%> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <%-- - - - - - --%> - - <%----%> - - - - - - - - - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <%-- - - - - - --%> - - <%-- --%> - - - - - - - - - - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - - - - - -
    - - - - - - - - - - <%----%> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - - - - - - - - <%----%> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <%-- - - - - - --%> - - <%-- --%> - - - - - - - - - - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <%-- - - - - - --%> - <%-- --%> - - - - - - - - - - - -
    -
    -
    - - - - - - - - - - - - - - - -
    -
    - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <%-- - - - - - --%> - - <%----%> - - - - - - - <%----%> - - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <%-- - - - - - --%> - - <%-- --%> - - - - - - - - - - -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -
    - - - - - - - -
    -
    -
    - - - - - - - -
    - - - - - - - - - - - diff --git a/Contabilidad2/RepEstadoResultadosHorizontal - Copy.aspx.vb b/Contabilidad2/RepEstadoResultadosHorizontal - Copy.aspx.vb deleted file mode 100644 index bb9bbfec4..000000000 --- a/Contabilidad2/RepEstadoResultadosHorizontal - Copy.aspx.vb +++ /dev/null @@ -1,2295 +0,0 @@ -Option Explicit On -Option Strict On - -Imports System.Data -Imports System.Drawing -Imports System.IO -Imports Extensiones -Imports GemBox.Spreadsheet -Imports Microsoft.Reporting.WebForms - -Partial Class Contabilidad_RepEstadoResultadosHorizontal - Inherits ClsPaginas - -#Region "PROPIEDADES" - - - Private Property DtDatosMes As DataTable - Get - DtDatosMes = DirectCast(ViewState("DtDatosMes"), DataTable) - End Get - - Set(ByVal value As DataTable) - ViewState("DtDatosMes") = value - End Set - End Property - - Private Property DtIngresosMes As DataTable - Get - DtIngresosMes = DirectCast(ViewState("DtIngresosMes"), DataTable) - End Get - - Set(ByVal value As DataTable) - ViewState("DtIngresosMes") = value - End Set - End Property - Private Property DtGastosMes As DataTable - Get - DtGastosMes = DirectCast(ViewState("DtGastosMes"), DataTable) - End Get - - Set(ByVal value As DataTable) - ViewState("DtGastosMes") = value - End Set - End Property - Private Property TotalActualMes As Double - Get - TotalActualMes = ViewState("TotalActualMes").ToString.ToDouble - End Get - Set(value As Double) - ViewState("TotalActualMes") = value - End Set - End Property - Private Property TotalAnteriorMes As Double - Get - TotalAnteriorMes = ViewState("TotalAnteriorMes").ToString.ToDouble - End Get - Set(value As Double) - ViewState("TotalAnteriorMes") = value - End Set - End Property - Private Property FechaIMes As String - Get - Return ViewState("FechaIMes").ToString - End Get - Set(value As String) - ViewState("FechaIMes") = value - End Set - End Property - Private Property FechaFMes As String - Get - Return ViewState("FechaFMes").ToString - End Get - Set(value As String) - ViewState("FechaFMes") = value - End Set - End Property - - Private Property listacolores As List(Of String) - Get - Return DirectCast(ViewState("listacolores"), List(Of String)) - End Get - Set(value As List(Of String)) - ViewState("listacolores") = value - End Set - End Property - - Private Property listaCampos As List(Of String()) - Get - Return DirectCast(ViewState("listaCampos"), List(Of String())) - End Get - Set(value As List(Of String())) - ViewState("listaCampos") = value - End Set - End Property - Private Property listaCamposanios As List(Of String()) - Get - Return DirectCast(ViewState("listaCamposanios"), List(Of String())) - End Get - Set(value As List(Of String())) - ViewState("listaCamposanios") = value - End Set - End Property - Private Property listaCamposaniosGastos As List(Of String()) - Get - Return DirectCast(ViewState("listaCamposaniosGastos"), List(Of String())) - End Get - Set(value As List(Of String())) - ViewState("listaCamposaniosGastos") = value - End Set - End Property - Private Property listaCamposaniosTotal As List(Of String()) - Get - Return DirectCast(ViewState("listaCamposaniosTotal"), List(Of String())) - End Get - Set(value As List(Of String())) - ViewState("listaCamposaniosTotal") = value - End Set - End Property - - 'Private Property ReporteComplementario As Boolean - ' Get - ' ReporteComplementario = CBool(ViewState("ReporteComplementario").ToString) - ' End Get - ' Set(value As Boolean) - ' ViewState("ReporteComplementario") = value - ' End Set - 'End Property - -#End Region - - -#Region " M E S H O R I Z O N T A L " - - Private Property DtDatosMesH As DataTable - Get - DtDatosMesH = DirectCast(ViewState("DtDatosMesH"), DataTable) - End Get - - Set(ByVal value As DataTable) - ViewState("DtDatosMesH") = value - End Set - End Property - - Private Property DtIngresosMesH As DataTable - Get - DtIngresosMesH = DirectCast(ViewState("DtIngresosMesH"), DataTable) - End Get - - Set(ByVal value As DataTable) - ViewState("DtIngresosMesH") = value - End Set - End Property - - Private Property DtGastosMesH As DataTable - Get - DtGastosMesH = DirectCast(ViewState("DtGastosMesH"), DataTable) - End Get - - Set(ByVal value As DataTable) - ViewState("DtGastosMesH") = value - End Set - End Property - - Private Property DTTotalesMesH As DataTable - Get - DTTotalesMesH = DirectCast(ViewState("DTTotalesMesH"), DataTable) - End Get - - Set(ByVal value As DataTable) - ViewState("DTTotalesMesH") = value - End Set - End Property - -#End Region - - -#Region " A N U A L H O R I Z O N T A L " - - Private Property DtDatosAnualH As DataTable - Get - DtDatosAnualH = DirectCast(ViewState("DtDatosAnualH"), DataTable) - End Get - - Set(ByVal value As DataTable) - ViewState("DtDatosAnualH") = value - End Set - End Property - - Private Property DtIngresosAnualH As DataTable - Get - DtIngresosAnualH = DirectCast(ViewState("DtIngresosAnualH"), DataTable) - End Get - - Set(ByVal value As DataTable) - ViewState("DtIngresosAnualH") = value - End Set - End Property - - Private Property DtGastosAnualH As DataTable - Get - DtGastosAnualH = DirectCast(ViewState("DtGastosAnualH"), DataTable) - End Get - - Set(ByVal value As DataTable) - ViewState("DtGastosAnualH") = value - End Set - End Property - - Private Property DTTotalesAnualH As DataTable - Get - DTTotalesAnualH = DirectCast(ViewState("DTTotalesAnualH"), DataTable) - End Get - - Set(ByVal value As DataTable) - ViewState("DTTotalesAnualH") = value - End Set - End Property - - - Private Property CountDinamicoAnual As Integer - - Get - If ViewState("CountDinamicoAnual") Is Nothing Then - Return 0 - Else - Return ViewState("CountDinamicoAnual").ToString.ToEntero - End If - - End Get - Set(value As Integer) - ViewState("CountDinamicoAnual") = value - End Set - End Property - -#End Region - -#Region " S U B P R O Y E C T O H O R I Z O N T A L " - - Private Property DtDatosSubProyectoH As DataTable - Get - DtDatosSubProyectoH = DirectCast(ViewState("DtDatosSubProyectoH"), DataTable) - End Get - - Set(ByVal value As DataTable) - ViewState("DtDatosSubProyectoH") = value - End Set - End Property - - Private Property DtIngresosSubProyectoH As DataTable - Get - DtIngresosSubProyectoH = DirectCast(ViewState("DtIngresosSubProyectoH"), DataTable) - End Get - - Set(ByVal value As DataTable) - ViewState("DtIngresosSubProyectoH") = value - End Set - End Property - - Private Property DtGastosSubProyectoH As DataTable - Get - DtGastosSubProyectoH = DirectCast(ViewState("DtGastosSubProyectoH"), DataTable) - End Get - - Set(ByVal value As DataTable) - ViewState("DtGastosSubProyectoH") = value - End Set - End Property - - Private Property DTTotalesSubProyectoH As DataTable - Get - DTTotalesSubProyectoH = DirectCast(ViewState("DTTotalesSubProyectoH"), DataTable) - End Get - - Set(ByVal value As DataTable) - ViewState("DTTotalesSubProyectoH") = value - End Set - End Property - - Private Property DTSubProyectosCabecerasH As DataTable - - Get - DTSubProyectosCabecerasH = DirectCast(ViewState("DTSubProyectosCabecerasH"), DataTable) - End Get - - Set(ByVal value As DataTable) - ViewState("DTSubProyectosCabecerasH") = value - End Set - - End Property - - - Private Property CountDinamicoSubProyecto As Integer - - Get - If ViewState("CountDinamicoSubProyecto") Is Nothing Then - Return 0 - Else - Return ViewState("CountDinamicoSubProyecto").ToString.ToEntero - End If - - End Get - Set(value As Integer) - ViewState("CountDinamicoSubProyecto") = 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 - listacolores = New List(Of String) - listaCampos = New List(Of String()) - listaCamposanios = New List(Of String()) - listaCamposaniosGastos = New List(Of String()) - listaCamposaniosTotal = New List(Of String()) - listacolores.Add("#FF0F00") - listacolores.Add("#FF6600") - listacolores.Add("#F8FF01") - listacolores.Add("#04D215") - listacolores.Add("#2A0CD0") - listacolores.Add("#8A0CCF") - listacolores.Add("#CD0D74") - listacolores.Add("#754DEB") - listacolores.Add("#DDDDDD") - listacolores.Add("#999999") - listacolores.Add("#000000") - listacolores.Add("#FF0F00") - - TotalActualMes = 0 - TotalAnteriorMes = 0 - - CargaEjercicios() - - CargarCentrosDeCosto(Nothing, DdlSubproyecto, Nothing, LblSubProyecto) - TabSubProyecto.HeaderText = LblSubProyecto.Text & " " - - - - DdlEjercicio.SelectedValueExist(UsuarioActual.Empresa.EjercicioActual) - ValidaEjercicios() - - End If - End Sub - - Protected Sub Tab_ActiveTabChanged(sender As Object, e As EventArgs) - - If TAB.ActiveTabIndex = 0 Then - LiSubProyectoDdl.Visible = True - LiSubProyectoLbl.Visible = True - - LiEjercicioDdl.Visible = True - LiEjercicioLbl.Visible = True - - LiEjercicioDdl2.Visible = False - LiEjercicioLbl2.Visible = False - - LiPeriodoDdl.Visible = True - LiPeriodoLbl.Visible = True - - LiDivisorDdl.Visible = True - LiDivisorLbl.Visible = True - - LblTri.Visible = False - DVTri.Visible = False - End If - - If TAB.ActiveTabIndex = 1 Then - - LiSubProyectoDdl.Visible = True - LiSubProyectoLbl.Visible = True - - LiEjercicioDdl.Visible = True - LiEjercicioLbl.Visible = True - - LiEjercicioDdl2.Visible = False - LiEjercicioLbl2.Visible = False - - LiPeriodoDdl.Visible = True - LiPeriodoLbl.Visible = True - - LiDivisorDdl.Visible = True - LiDivisorLbl.Visible = True - - DdlPeriodo.SelectedValueExist(12) - - LblTri.Visible = True - DVTri.Visible = True - - - End If - - If TAB.ActiveTabIndex = 2 Then - - ValidaEjercicios() - - LiSubProyectoDdl.Visible = True - LiSubProyectoLbl.Visible = True - - LiEjercicioDdl.Visible = True - LiEjercicioLbl.Visible = True - - LiEjercicioDdl2.Visible = True - LiEjercicioLbl2.Visible = True - - LiPeriodoDdl.Visible = True - LiPeriodoLbl.Visible = True - - LiDivisorDdl.Visible = True - LiDivisorLbl.Visible = True - - LblTri.Visible = False - DVTri.Visible = False - - End If - - If TAB.ActiveTabIndex = 3 Then - LiSubProyectoDdl.Visible = True - LiSubProyectoLbl.Visible = True - - LiEjercicioDdl.Visible = True - LiEjercicioLbl.Visible = True - - LiEjercicioDdl2.Visible = False - LiEjercicioLbl2.Visible = False - - LiPeriodoDdl.Visible = True - LiPeriodoLbl.Visible = True - - LiDivisorDdl.Visible = True - LiDivisorLbl.Visible = True - - LblTri.Visible = False - DVTri.Visible = False - - End If - - UpFiltros.Update() - End Sub - - - Protected Sub DdlEjercicio_SelectedIndexChanged(sender As Object, e As EventArgs) - ValidaEjercicios() - End Sub - - Protected Sub DdlEjercicio2_SelectedIndexChanged(sender As Object, e As EventArgs) - ValidaEjercicios() - End Sub - - Private Sub ValidaEjercicios() - - - Dim EInicio As Integer = DdlEjercicio.SelectedValue.ToEntero - - - If EInicio > DdlEjercicio2.SelectedValue.ToEntero Then - - If DdlEjercicio2.Items.Count > 0 Then - DdlEjercicio2.SelectedIndex = DdlEjercicio2.Items.Count - 1 - End If - - Dim Fejerciosio As Integer = DdlEjercicio2.SelectedValue.ToEntero - - If Not EInicio + 1 > Fejerciosio Then - DdlEjercicio2.SelectedValueExist(EInicio + 1) - End If - - End If - - - UpFiltros.Update() - End Sub - - Private Sub CargaEjercicios() - 'Dim ClsConta As New ClsContPAQi(UsuarioActual.Empresa) - Dim ClsConta As New ClsContabilidad - If ClsConta.GetEjercicios(UsuarioActual.CveEmpresa) Then - DdlEjercicio.DataSource = ClsConta.DtResultados - DdlEjercicio2.DataSource = ClsConta.DtResultados - Else - DdlEjercicio.DataSource = Nothing - DdlEjercicio2.DataSource = Nothing - End If - ClsConta.Dispose() - DdlEjercicio.DataBind() - DdlEjercicio2.DataBind() - - DdlEjercicio.SelectedValueExist(UsuarioActual.Empresa.EjercicioActual.ToString) - If DdlEjercicio.Items.Count = 0 Then - DdlEjercicio.Items.Add(New ListItem(Now.Year.ToString, Now.Year.ToString)) - End If - DdlPeriodo.SelectedValue = Now.Month.ToString - End Sub - - Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) - TotalActualMes = 0 - TotalAnteriorMes = 0 - - 'Mes - If TAB.ActiveTabIndex = 0 Then - CargaDatosMes() - End If - - 'MES HORIZONTAL - If TAB.ActiveTabIndex = 1 Then - CargaDatosMesH() - End If - - 'AÑO HORIZONTAL - If TAB.ActiveTabIndex = 2 Then - - If DdlEjercicio.SelectedValue.ToEntero > DdlEjercicio2.SelectedValue.ToEntero Then - Alert("El ejercicio inicio no debe ser mayor al ejercicio fin.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - CargaDatosAnualH() - End If - - 'SUBPROYECTO - If TAB.ActiveTabIndex = 3 Then - CargaDatosSubProyectoH() - End If - - - - - End Sub - - -#Region "MES" - - - - - - Private Sub CargaDatosMes() - - - FechaIMes = String.Format("01/{0}/{1}", DdlPeriodo.SelectedValue.PadLeft(2, CChar("0")), DdlEjercicio.SelectedValue) - FechaFMes = DateAdd(DateInterval.Day, -1, DateAdd(DateInterval.Month, 1, CDate(FechaIMes))).ToString("dd/MM/yyyy") - 'Dim TipoReporte = DdlTipoReporte.SelectedValue.ToEntero 'If(ReporteComplementario, DdlTipoReporte.SelectedValue.ToEntero, 1) - Dim CveSubProyecto As Integer = DdlSubproyecto.SelectedValue.ToEntero - - 'Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa) - Dim ObjConta As New ClsContabilidad - If ObjConta.GetEstadosMensual(FechaIMes.ToDate, FechaFMes.ToDate, CveSubProyecto, DdlDivisor.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) Then - DtDatosMes = ObjConta.DtResultados.FiltraParametros("(ImporteActual <> 0 OR ImporteAcumulado <> 0)") - Else - DtDatosMes = Nothing - Alert("Ocurrio un error al cargar los datos del Estado de Actividades", TipoMensaje.MsgError) - End If - ObjConta.Dispose() - - If DtDatosMes IsNot Nothing Then - CargaGridsMes() - SumaTotales() - End If - - End Sub - Private Sub CargaGridsMes() - DtIngresosMes = DtDatosMes.FiltraParametros("Tipo ='H' ") - DtGastosMes = DtDatosMes.FiltraParametros("Tipo ='G' ") - Dim Row As DataRow = DtIngresosMes.NewRow - - - Dim TotalActual = 0.0, TotalAnterior = 0.0 - If DtIngresosMes.Rows.Count > 0 Then - - For Each dr As DataRow In DtIngresosMes.FiltraParametros("NOT CtaMayor in (3,4)").Rows - TotalActual += dr("ImporteActual").ToString.ToDouble - TotalAnterior += dr("ImporteAcumulado").ToString.ToDouble - Next - - Row.Item("Nombre") = "TOTAL INGRESOS " - Row.Item("ImporteActual") = TotalActual.ToString - Row.Item("PorcentajeActual") = "100.00" - Row.Item("ImporteAcumulado") = TotalAnterior.ToString - Row.Item("PorcentajeAcumulado") = "100.00" - Row.Item("CtaMayor") = -1 - DtIngresosMes.Rows.Add(Row) - Else - Row.Item("Nombre") = "TOTAL INGRESOS " - Row.Item("ImporteActual") = "0.00" - Row.Item("ImporteAcumulado") = "0.00" - Row.Item("CtaMayor") = -1 - DtIngresosMes.Rows.Add(Row) - End If - - Dim T1 = TotalActual, T2 = TotalAnterior - - TotalActual = 0 - TotalAnterior = 0 - - Row = DtGastosMes.NewRow - If DtGastosMes.Rows.Count > 0 Then - - For Each dr As DataRow In DtGastosMes.FiltraParametros("NOT CtaMayor in (3,4)").Rows - TotalActual += dr("ImporteActual").ToString.ToDouble - TotalAnterior += dr("ImporteAcumulado").ToString.ToDouble - Next - - Row.Item("Nombre") = "TOTAL GASTOS" - Row.Item("ImporteActual") = TotalActual - Row.Item("PorcentajeActual") = If(T1 > 0, (TotalActual * 100 / T1).ToString, "0").FormatoNumero - Row.Item("ImporteAcumulado") = TotalAnterior.ToString - Row.Item("PorcentajeAcumulado") = If(T2 > 0, (TotalAnterior * 100 / T2).ToString, "0").FormatoNumero - Row.Item("CtaMayor") = -1 - DtGastosMes.Rows.Add(Row) - Else - Row.Item("Nombre") = "TOTAL GASTOS" - Row.Item("ImporteActual") = "0.00" - Row.Item("ImporteAcumulado") = "0.00" - Row.Item("CtaMayor") = -1 - DtGastosMes.Rows.Add(Row) - End If - - - GvIngresosMes.DataSource = DtIngresosMes - GvIngresosMes.DataBind() - - GvGastosMes.DataSource = DtGastosMes - GvGastosMes.DataBind() - - UpDatos.Update() - - End Sub - - - - Private Sub SumaTotales() - 'Llena Lb´s Totales - - - If DdlDivisor.SelectedValue.ToEntero > 1 Then - LbTotalActual.Text = TotalActualMes.ToString("###,###,##0") - LbTotalAnterior.Text = TotalAnteriorMes.ToString("###,###,##0") - Else - LbTotalActual.Text = TotalActualMes.ToString("###,###,##0.00") - LbTotalAnterior.Text = TotalAnteriorMes.ToString("###,###,##0.00") - End If - - - - LbTotalActual.ForeColor = If(TotalActualMes < 0, Drawing.Color.Red, Color.Black) - - LbTotalAnterior.ForeColor = If(TotalAnteriorMes < 0, Drawing.Color.Red, Color.Black) - - - End Sub - -#Region "GV´S ROW DATA BOUND" - - Protected Sub GvIngresos_RowDataBound(sender As Object, e As GridViewRowEventArgs) - - If e.Row.RowType = DataControlRowType.DataRow Then - - If e.Row.DBCampo("CtaMayor").ToString.ToEntero < 0 Then - TotalActualMes += e.Row.DBCampo("ImporteActual").ToString.ToDouble - TotalAnteriorMes += e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble - 'e.Row.ControlStyle.BackColor = Drawing.Color.LightGray - 'e.Row.ControlStyle.ForeColor = Drawing.Color.White - e.Row.ControlStyle.Font.Bold = True - ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = 3 Then - 'e.Row.CssClass = "SubTotales3" - e.Row.ControlStyle.Font.Bold = True - End If - - If e.Row.DBCampo("CtaMayor").ToString.ToEntero > 0 Then - - e.Row.FCHyperLink("HLActual").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString, e.Row.DBCampo("FechaInicial").ToDate.ToShortDateString) - e.Row.FCHyperLink("HLAnterior").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString, e.Row.DBCampo("FechaInicial").ToDate.ToShortDateString) - - - If DdlDivisor.SelectedValue.ToEntero > 1 Then - e.Row.FCHyperLink("HLActual").Text = e.Row.DataKey("ImporteActual").ToEntero.ToString("###,###,##0") - e.Row.FCHyperLink("HLAnterior").Text = e.Row.DataKey("ImporteAcumulado").ToEntero.ToString("###,###,##0").ToString - Else - e.Row.FCHyperLink("HLActual").Text = e.Row.DataKey("ImporteActual").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLAnterior").Text = e.Row.DataKey("ImporteAcumulado").ToDecimal.ToString("###,###,##0.00").ToString - End If - - End If - - - If e.Row.DBCampo("ImporteActual").ToString.ToDouble < 0 Then - e.Row.FCHyperLink("HLActual").ForeColor = Drawing.Color.Red - End If - If e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble < 0 Then - e.Row.FCHyperLink("HLAnterior").ForeColor = Drawing.Color.Red - End If - End If - End Sub - - Protected Sub GvGastos_RowDataBound(sender As Object, e As GridViewRowEventArgs) - If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.DBCampo("CtaMayor").ToString.ToEntero < 0 Then - TotalActualMes -= e.Row.DBCampo("ImporteActual").ToString.ToDouble - TotalAnteriorMes -= e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble - 'e.Row.ControlStyle.BackColor = Drawing.Color.LightGray - 'e.Row.ControlStyle.ForeColor = Drawing.Color.White - e.Row.ControlStyle.Font.Bold = True - ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = 3 Then - 'e.Row.CssClass = "SubTotales" - e.Row.ControlStyle.Font.Bold = True - End If - - If e.Row.DBCampo("CtaMayor").ToString.ToEntero > 0 Then - e.Row.FCHyperLink("HLActual").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString, e.Row.DBCampo("FechaInicial").ToDate.ToShortDateString) - e.Row.FCHyperLink("HLAnterior").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString, e.Row.DBCampo("FechaInicial").ToDate.ToShortDateString) - End If - - If DdlDivisor.SelectedValue.ToEntero > 1 Then - e.Row.FCHyperLink("HLActual").Text = e.Row.DataKey("ImporteActual").ToEntero.ToString("###,###,##0") - e.Row.FCHyperLink("HLAnterior").Text = e.Row.DataKey("ImporteAcumulado").ToEntero.ToString("###,###,##0").ToString - Else - e.Row.FCHyperLink("HLActual").Text = e.Row.DataKey("ImporteActual").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLAnterior").Text = e.Row.DataKey("ImporteAcumulado").ToDecimal.ToString("###,###,##0.00").ToString - End If - - If e.Row.DBCampo("ImporteActual").ToString.ToDouble < 0 Then - e.Row.FCHyperLink("HLActual").ForeColor = Drawing.Color.Red - End If - If e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble < 0 Then - e.Row.FCHyperLink("HLAnterior").ForeColor = Drawing.Color.Red - End If - End If - End Sub - -#End Region - - - - -#End Region - - - -#Region "M E S H O R I Z O N T A L" - - Private Sub CargaDatosMesH() - - - FechaIMes = $"01/01/{DdlEjercicio.SelectedValue}" - Dim FechaFin As Date = $"01/{DdlPeriodo.SelectedValue.ToEntero.ToString("00")}/{DdlEjercicio.SelectedValue}".ToDate - FechaFMes = $"{FechaFin.LastDayOfMonth.Day.ToString("00")}/{DdlPeriodo.SelectedValue.ToEntero.ToString("00")}/{DdlEjercicio.SelectedValue}" - - Dim CveSubProyecto As Integer = DdlSubproyecto.SelectedValue.ToEntero - - 'Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa) - Dim ObjConta As New ClsContabilidad - If ObjConta.GetEstadosMensualHorizontal(FechaIMes.ToDate, FechaFMes.ToDate, CveSubProyecto, DdlDivisor.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) Then - DtDatosMesH = ObjConta.DtResultados.FiltraParametros("(ImporteActual <> 0 OR ImporteAcumulado <> 0)") - Else - DtDatosMesH = Nothing - Alert("Ocurrio un error al cargar los datos del Estado de Actividades", TipoMensaje.MsgError) - End If - ObjConta.Dispose() - - If DtDatosMesH IsNot Nothing Then - CargaGridsMesH() - Else - - End If - - End Sub - - Private Sub CargaGridsMesH() - - DtIngresosMesH = DtDatosMesH.FiltraParametros("Tipo ='H' ") - DtGastosMesH = DtDatosMesH.FiltraParametros("Tipo ='G' ") - DTTotalesMesH = DtDatosMesH.Clone() - - Dim Row As DataRow = DtIngresosMesH.NewRow - - Dim TotalActual = 0.0, TotalAnterior = 0.0 - - If DtIngresosMesH.Rows.Count > 0 Then - - For Each dr As DataRow In DtIngresosMesH.FiltraParametros("NOT CtaMayor in (3,4)").Rows - TotalActual += dr("ImporteActual").ToString.ToDouble - TotalAnterior += dr("ImporteAcumulado").ToString.ToDouble - Next - - Row.Item("Enero") = DtIngresosMesH.SUM("Enero", "NOT CtaMayor in (3,4)") - Row.Item("Febrero") = DtIngresosMesH.SUM("Febrero", "NOT CtaMayor in (3,4)") - Row.Item("Marzo") = DtIngresosMesH.SUM("Marzo", "NOT CtaMayor in (3,4)") - Row.Item("Abril") = DtIngresosMesH.SUM("Abril", "NOT CtaMayor in (3,4)") - Row.Item("Mayo") = DtIngresosMesH.SUM("Mayo", "NOT CtaMayor in (3,4)") - Row.Item("Junio") = DtIngresosMesH.SUM("Junio", "NOT CtaMayor in (3,4)") - Row.Item("Julio") = DtIngresosMesH.SUM("Julio", "NOT CtaMayor in (3,4)") - Row.Item("Agosto") = DtIngresosMesH.SUM("Agosto", "NOT CtaMayor in (3,4)") - Row.Item("Septiembre") = DtIngresosMesH.SUM("Septiembre", "NOT CtaMayor in (3,4)") - Row.Item("Octubre") = DtIngresosMesH.SUM("Octubre", "NOT CtaMayor in (3,4)") - Row.Item("Noviembre") = DtIngresosMesH.SUM("Noviembre", "NOT CtaMayor in (3,4)") - Row.Item("Diciembre") = DtIngresosMesH.SUM("Diciembre", "NOT CtaMayor in (3,4)") - - Row.Item("Tri1") = DtIngresosMesH.SUM("Tri1", "NOT CtaMayor in (3,4)") - Row.Item("Tri2") = DtIngresosMesH.SUM("Tri2", "NOT CtaMayor in (3,4)") - Row.Item("Tri3") = DtIngresosMesH.SUM("Tri3", "NOT CtaMayor in (3,4)") - Row.Item("Tri4") = DtIngresosMesH.SUM("Tri4", "NOT CtaMayor in (3,4)") - - Row.Item("Cua1") = DtIngresosMesH.SUM("Cua1", "NOT CtaMayor in (3,4)") - Row.Item("Cua2") = DtIngresosMesH.SUM("Cua2", "NOT CtaMayor in (3,4)") - Row.Item("Cua3") = DtIngresosMesH.SUM("Cua3", "NOT CtaMayor in (3,4)") - - - Row.Item("Nombre") = "TOTAL INGRESOS" - Row.Item("ImporteActual") = TotalActual.ToString - Row.Item("PorcentajeActual") = "100.00" - Row.Item("ImporteAcumulado") = TotalAnterior.ToString - Row.Item("PorcentajeAcumulado") = "100.00" - Row.Item("CtaMayor") = -1 - - DtIngresosMesH.Rows.Add(Row) - Else - Row.Item("Nombre") = "TOTAL INGRESOS " - Row.Item("ImporteActual") = "0.00" - Row.Item("ImporteAcumulado") = "0.00" - Row.Item("CtaMayor") = -1 - DtIngresosMesH.Rows.Add(Row) - End If - - Dim T1 = TotalActual, T2 = TotalAnterior - - TotalActual = 0 - TotalAnterior = 0 - - Row = DtGastosMesH.NewRow - If DtGastosMesH.Rows.Count > 0 Then - - For Each dr As DataRow In DtGastosMesH.FiltraParametros("NOT CtaMayor in (3,4)").Rows - TotalActual += dr("ImporteActual").ToString.ToDouble - TotalAnterior += dr("ImporteAcumulado").ToString.ToDouble - Next - - - Row.Item("Enero") = DtGastosMesH.SUM("Enero", "NOT CtaMayor in (3,4)") - Row.Item("Febrero") = DtGastosMesH.SUM("Febrero", "NOT CtaMayor in (3,4)") - Row.Item("Marzo") = DtGastosMesH.SUM("Marzo", "NOT CtaMayor in (3,4)") - Row.Item("Abril") = DtGastosMesH.SUM("Abril", "NOT CtaMayor in (3,4)") - Row.Item("Mayo") = DtGastosMesH.SUM("Mayo", "NOT CtaMayor in (3,4)") - Row.Item("Junio") = DtGastosMesH.SUM("Junio", "NOT CtaMayor in (3,4)") - Row.Item("Julio") = DtGastosMesH.SUM("Julio", "NOT CtaMayor in (3,4)") - Row.Item("Agosto") = DtGastosMesH.SUM("Agosto", "NOT CtaMayor in (3,4)") - Row.Item("Septiembre") = DtGastosMesH.SUM("Septiembre", "NOT CtaMayor in (3,4)") - Row.Item("Octubre") = DtGastosMesH.SUM("Octubre", "NOT CtaMayor in (3,4)") - Row.Item("Noviembre") = DtGastosMesH.SUM("Noviembre", "NOT CtaMayor in (3,4)") - Row.Item("Diciembre") = DtGastosMesH.SUM("Diciembre", "NOT CtaMayor in (3,4)") - - Row.Item("Tri1") = DtGastosMesH.SUM("Tri1", "NOT CtaMayor in (3,4)") - Row.Item("Tri2") = DtGastosMesH.SUM("Tri2", "NOT CtaMayor in (3,4)") - Row.Item("Tri3") = DtGastosMesH.SUM("Tri3", "NOT CtaMayor in (3,4)") - Row.Item("Tri4") = DtGastosMesH.SUM("Tri4", "NOT CtaMayor in (3,4)") - - Row.Item("Cua1") = DtGastosMesH.SUM("Cua1", "NOT CtaMayor in (3,4)") - Row.Item("Cua2") = DtGastosMesH.SUM("Cua2", "NOT CtaMayor in (3,4)") - Row.Item("Cua3") = DtGastosMesH.SUM("Cua3", "NOT CtaMayor in (3,4)") - - Row.Item("Nombre") = "TOTAL GASTOS" - Row.Item("ImporteActual") = TotalActual - Row.Item("PorcentajeActual") = If(T1 > 0, (TotalActual * 100 / T1).ToString, "0").FormatoNumero - Row.Item("ImporteAcumulado") = TotalAnterior.ToString - Row.Item("PorcentajeAcumulado") = If(T2 > 0, (TotalAnterior * 100 / T2).ToString, "0").FormatoNumero - Row.Item("CtaMayor") = -1 - DtGastosMesH.Rows.Add(Row) - Else - Row.Item("Nombre") = "TOTAL GASTOS" - Row.Item("ImporteActual") = "0.00" - Row.Item("ImporteAcumulado") = "0.00" - Row.Item("CtaMayor") = -1 - DtGastosMesH.Rows.Add(Row) - End If - - If DtIngresosMesH.Rows.Count > 0 Then - - Row = DTTotalesMesH.NewRow - - Row.Item("Enero") = DtIngresosMesH.SUM("Enero", "NOT CtaMayor in (-1,3,4)") - DtGastosMesH.SUM("Enero", "NOT CtaMayor in (-1,3,4)") - Row.Item("Febrero") = DtIngresosMesH.SUM("Febrero", "NOT CtaMayor in (-1,3,4)") - DtGastosMesH.SUM("Febrero", "NOT CtaMayor in (-1,3,4)") - Row.Item("Marzo") = DtIngresosMesH.SUM("Marzo", "NOT CtaMayor in (-1,3,4)") - DtGastosMesH.SUM("Marzo", "NOT CtaMayor in (-1,3,4)") - Row.Item("Abril") = DtIngresosMesH.SUM("Abril", "NOT CtaMayor in (-1,3,4)") - DtGastosMesH.SUM("Abril", "NOT CtaMayor in (-1,3,4)") - Row.Item("Mayo") = DtIngresosMesH.SUM("Mayo", "NOT CtaMayor in (-1,3,4)") - DtGastosMesH.SUM("Mayo", "NOT CtaMayor in (-1,3,4)") - Row.Item("Junio") = DtIngresosMesH.SUM("Junio", "NOT CtaMayor in (-1,3,4)") - DtGastosMesH.SUM("Junio", "NOT CtaMayor in (-1,3,4)") - Row.Item("Julio") = DtIngresosMesH.SUM("Julio", "NOT CtaMayor in (-1,3,4)") - DtGastosMesH.SUM("Julio", "NOT CtaMayor in (-1,3,4)") - Row.Item("Agosto") = DtIngresosMesH.SUM("Agosto", "NOT CtaMayor in (-1,3,4)") - DtGastosMesH.SUM("Agosto", "NOT CtaMayor in (-1,3,4)") - Row.Item("Septiembre") = DtIngresosMesH.SUM("Septiembre", "NOT CtaMayor in (-1,3,4)") - DtGastosMesH.SUM("Septiembre", "NOT CtaMayor in (-1,3,4)") - Row.Item("Octubre") = DtIngresosMesH.SUM("Octubre", "NOT CtaMayor in (-1,3,4)") - DtGastosMesH.SUM("Octubre", "NOT CtaMayor in (-1,3,4)") - Row.Item("Noviembre") = DtIngresosMesH.SUM("Noviembre", "NOT CtaMayor in (-1,3,4)") - DtGastosMesH.SUM("Noviembre", "NOT CtaMayor in (-1,3,4)") - Row.Item("Diciembre") = DtIngresosMesH.SUM("Diciembre", "NOT CtaMayor in (-1,3,4)") - DtGastosMesH.SUM("Diciembre", "NOT CtaMayor in (-1,3,4)") - - Row.Item("Tri1") = DtIngresosMesH.SUM("Tri1", "NOT CtaMayor in (-1,3,4)") - DtGastosMesH.SUM("Tri1", "NOT CtaMayor in (-1,3,4)") - Row.Item("Tri2") = DtIngresosMesH.SUM("Tri2", "NOT CtaMayor in (-1,3,4)") - DtGastosMesH.SUM("Tri2", "NOT CtaMayor in (-1,3,4)") - Row.Item("Tri3") = DtIngresosMesH.SUM("Tri3", "NOT CtaMayor in (-1,3,4)") - DtGastosMesH.SUM("Tri3", "NOT CtaMayor in (-1,3,4)") - Row.Item("Tri4") = DtIngresosMesH.SUM("Tri4", "NOT CtaMayor in (-1,3,4)") - DtGastosMesH.SUM("Tri4", "NOT CtaMayor in (-1,3,4)") - - Row.Item("Cua1") = DtIngresosMesH.SUM("Cua1", "NOT CtaMayor in (-1,3,4)") - DtGastosMesH.SUM("Cua1", "NOT CtaMayor in (-1,3,4)") - Row.Item("Cua2") = DtIngresosMesH.SUM("Cua2", "NOT CtaMayor in (-1,3,4)") - DtGastosMesH.SUM("Cua2", "NOT CtaMayor in (-1,3,4)") - Row.Item("Cua3") = DtIngresosMesH.SUM("Cua3", "NOT CtaMayor in (-1,3,4)") - DtGastosMesH.SUM("Cua3", "NOT CtaMayor in (-1,3,4)") - - Row.Item("Nombre") = "Resultados del Ejercicio:" - 'Row.Item("ImporteActual") = TotalActual.ToString - 'Row.Item("PorcentajeActual") = "100.00" - Row.Item("ImporteAcumulado") = DtIngresosMesH.SUM("ImporteAcumulado", "NOT CtaMayor in (-1,3,4)") - DtGastosMesH.SUM("ImporteAcumulado", "NOT CtaMayor in (-1,3,4)") ' TotalAnterior.ToString - 'Row.Item("PorcentajeAcumulado") = "100.00" - 'Row.Item("CtaMayor") = -1 - - DTTotalesMesH.Rows.Add(Row) - - End If - - GvIngresosMesH.DataSource = DtIngresosMesH - GvIngresosMesH.DataBind() - - GvGastosMesH.DataSource = DtGastosMesH - GvGastosMesH.DataBind() - - GvTotalesMesH.DataSource = DTTotalesMesH - GvTotalesMesH.DataBind() - - - If DdlTri.SelectedValue.ToEntero = 0 Then 'ocultar trimestre cuatrimestre - - GvIngresosMesH.Columns(4).Visible = False - GvIngresosMesH.Columns(9).Visible = False - GvIngresosMesH.Columns(14).Visible = False - GvIngresosMesH.Columns(18).Visible = False - - GvGastosMesH.Columns(4).Visible = False - GvGastosMesH.Columns(9).Visible = False - GvGastosMesH.Columns(14).Visible = False - GvGastosMesH.Columns(18).Visible = False - - GvTotalesMesH.Columns(4).Visible = False - GvTotalesMesH.Columns(9).Visible = False - GvTotalesMesH.Columns(14).Visible = False - GvTotalesMesH.Columns(18).Visible = False - - GvIngresosMesH.Columns(6).Visible = False - GvIngresosMesH.Columns(12).Visible = False - GvIngresosMesH.Columns(19).Visible = False - - GvGastosMesH.Columns(6).Visible = False - GvGastosMesH.Columns(12).Visible = False - GvGastosMesH.Columns(19).Visible = False - - GvTotalesMesH.Columns(6).Visible = False - GvTotalesMesH.Columns(12).Visible = False - GvTotalesMesH.Columns(19).Visible = False - - - ElseIf DdlTri.SelectedValue.ToEntero = 1 Then 'Mostrar Trimestre - - - GvIngresosMesH.Columns(4).Visible = True - GvIngresosMesH.Columns(9).Visible = True - GvIngresosMesH.Columns(14).Visible = True - GvIngresosMesH.Columns(18).Visible = True - - GvGastosMesH.Columns(4).Visible = True - GvGastosMesH.Columns(9).Visible = True - GvGastosMesH.Columns(14).Visible = True - GvGastosMesH.Columns(18).Visible = True - - GvTotalesMesH.Columns(4).Visible = True - GvTotalesMesH.Columns(9).Visible = True - GvTotalesMesH.Columns(14).Visible = True - GvTotalesMesH.Columns(18).Visible = True - - GvIngresosMesH.Columns(6).Visible = False - GvIngresosMesH.Columns(12).Visible = False - GvIngresosMesH.Columns(19).Visible = False - - GvGastosMesH.Columns(6).Visible = False - GvGastosMesH.Columns(12).Visible = False - GvGastosMesH.Columns(19).Visible = False - - GvTotalesMesH.Columns(6).Visible = False - GvTotalesMesH.Columns(12).Visible = False - GvTotalesMesH.Columns(19).Visible = False - - ElseIf DdlTri.SelectedValue.ToEntero = 2 Then 'Mostrar Cuatrimestre - - GvIngresosMesH.Columns(4).Visible = False - GvIngresosMesH.Columns(9).Visible = False - GvIngresosMesH.Columns(14).Visible = False - GvIngresosMesH.Columns(18).Visible = False - - GvGastosMesH.Columns(4).Visible = False - GvGastosMesH.Columns(9).Visible = False - GvGastosMesH.Columns(14).Visible = False - GvGastosMesH.Columns(18).Visible = False - - GvTotalesMesH.Columns(4).Visible = False - GvTotalesMesH.Columns(9).Visible = False - GvTotalesMesH.Columns(14).Visible = False - GvTotalesMesH.Columns(18).Visible = False - - - GvIngresosMesH.Columns(6).Visible = True - GvIngresosMesH.Columns(12).Visible = True - GvIngresosMesH.Columns(19).Visible = True - - GvGastosMesH.Columns(6).Visible = True - GvGastosMesH.Columns(12).Visible = True - GvGastosMesH.Columns(19).Visible = True - - GvTotalesMesH.Columns(6).Visible = True - GvTotalesMesH.Columns(12).Visible = True - GvTotalesMesH.Columns(19).Visible = True - - End If - - - UpDatosMesH.Update() - - End Sub - - - Protected Sub GvIngresosMesH_RowDataBound(sender As Object, e As GridViewRowEventArgs) - - If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.DBCampo("CtaMayor").ToString.ToEntero < 0 Then - TotalActualMes += e.Row.DBCampo("ImporteActual").ToString.ToDouble - TotalAnteriorMes += e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble - e.Row.ControlStyle.Font.Bold = True - ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = 3 Then - e.Row.ControlStyle.Font.Bold = True - End If - - If e.Row.DBCampo("CtaMayor").ToString.ToEntero > 0 Then - - - 'e.Row.FCHyperLink("HLNombre").NavigateUrl = $"./RepAnexoCatalogoMensualHorizontal.aspx?CveCuenta={e.Row.DBCampo("CveCuenta").ToString}&FF=31/12/{DdlEjercicio.SelectedValue}&FI=01/01/{DdlEjercicio.SelectedValue}&ER=1" - - e.Row.FCHyperLink("HLNombre").NavigateUrl = $"./RepAnexoCatalogoMensual.aspx?CveCuenta={e.Row.DBCampo("CveCuenta").ToString}&Ejercicio={DdlEjercicio.SelectedValue}&Divisor={DdlDivisor.SelectedValue}&CveSubProyecto={DdlSubproyecto.SelectedValue}&Periodo={DdlPeriodo.SelectedValue}&TRCU={DdlTri.SelectedValue}" - - e.Row.FCHyperLink("HLEnero").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/01/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/01/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLFebrero").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/02/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/02/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLMarzo").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/03/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/03/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLAbril").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/04/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/04/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLMayo").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/05/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/05/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLJunio").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/06/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/06/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLJulio").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/07/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/07/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLAgosto").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/08/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/08/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLSeptiembre").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/09/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/09/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLOctubre").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/10/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/10/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLNoviembre").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/11/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/11/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLDiciembre").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/12/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/12/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - - e.Row.FCHyperLink("HLTri1").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/03/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/01/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLTri2").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/06/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/04/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLTri3").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/09/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/07/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLTri4").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/12/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/10/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - - e.Row.FCHyperLink("HLCua1").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/04/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/01/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLCua2").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/08/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/05/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLCua3").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/12/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/09/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - - - ' e.Row.FCHyperLink("HLAnterior").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString, e.Row.DBCampo("FechaInicial").ToDate.ToShortDateString) - - e.Row.FCHyperLink("HLAnterior").NavigateUrl = $"./RepAnexoCatalogoMensual.aspx?CveCuenta={e.Row.DBCampo("CveCuenta").ToString}&Ejercicio={DdlEjercicio.SelectedValue}&Divisor={DdlDivisor.SelectedValue}&CveSubProyecto={DdlSubproyecto.SelectedValue}&Periodo={DdlPeriodo.SelectedValue}" - - End If - - If e.Row.DBCampo("CtaMayor").ToString.ToEntero > 0 Or e.Row.DBCampo("Nombre") = "TOTAL INGRESOS" Then - - If DdlDivisor.SelectedValue.ToEntero > 1 Then - - e.Row.FCHyperLink("HLEnero").Text = e.Row.DataKey("Enero").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLFebrero").Text = e.Row.DataKey("Febrero").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLMarzo").Text = e.Row.DataKey("Marzo").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLAbril").Text = e.Row.DataKey("Abril").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLMayo").Text = e.Row.DataKey("Mayo").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLJunio").Text = e.Row.DataKey("Junio").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLJulio").Text = e.Row.DataKey("Julio").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLAgosto").Text = e.Row.DataKey("Agosto").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLSeptiembre").Text = e.Row.DataKey("Septiembre").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLOctubre").Text = e.Row.DataKey("Octubre").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLNoviembre").Text = e.Row.DataKey("Noviembre").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLDiciembre").Text = e.Row.DataKey("Diciembre").ToDecimal.ToString("###,###,##0") - Else - e.Row.FCHyperLink("HLEnero").Text = e.Row.DataKey("Enero").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLFebrero").Text = e.Row.DataKey("Febrero").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLMarzo").Text = e.Row.DataKey("Marzo").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLAbril").Text = e.Row.DataKey("Abril").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLMayo").Text = e.Row.DataKey("Mayo").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLJunio").Text = e.Row.DataKey("Junio").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLJulio").Text = e.Row.DataKey("Julio").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLAgosto").Text = e.Row.DataKey("Agosto").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLSeptiembre").Text = e.Row.DataKey("Septiembre").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLOctubre").Text = e.Row.DataKey("Octubre").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLNoviembre").Text = e.Row.DataKey("Noviembre").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLDiciembre").Text = e.Row.DataKey("Diciembre").ToDecimal.ToString("###,###,##0.00") - End If - - End If - - setgrafica(e) - - - - - e.Row.FCHyperLink("HLEnero").ForeColor = If(e.Row.DataKey("Enero").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLEnero").ForeColor) - e.Row.FCHyperLink("HLFebrero").ForeColor = If(e.Row.DataKey("Febrero").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLFebrero").ForeColor) - e.Row.FCHyperLink("HLMarzo").ForeColor = If(e.Row.DataKey("Marzo").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLMarzo").ForeColor) - e.Row.FCHyperLink("HLAbril").ForeColor = If(e.Row.DataKey("Abril").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLAbril").ForeColor) - e.Row.FCHyperLink("HLMayo").ForeColor = If(e.Row.DataKey("Mayo").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLAbril").ForeColor) - e.Row.FCHyperLink("HLJunio").ForeColor = If(e.Row.DataKey("Junio").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLMayo").ForeColor) - e.Row.FCHyperLink("HLJulio").ForeColor = If(e.Row.DataKey("Julio").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLJulio").ForeColor) - e.Row.FCHyperLink("HLAgosto").ForeColor = If(e.Row.DataKey("Agosto").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLAgosto").ForeColor) - e.Row.FCHyperLink("HLSeptiembre").ForeColor = If(e.Row.DataKey("Septiembre").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLSeptiembre").ForeColor) - e.Row.FCHyperLink("HLOctubre").ForeColor = If(e.Row.DataKey("Octubre").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLOctubre").ForeColor) - e.Row.FCHyperLink("HLNoviembre").ForeColor = If(e.Row.DataKey("Noviembre").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLNoviembre").ForeColor) - e.Row.FCHyperLink("HLDiciembre").ForeColor = If(e.Row.DataKey("Diciembre").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLDiciembre").ForeColor) - - If e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble < 0 Then - e.Row.FCHyperLink("HLAnterior").ForeColor = Drawing.Color.Red - End If - - End If - - End Sub - - Protected Sub GvGastosMesH_RowDataBound(sender As Object, e As GridViewRowEventArgs) - If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.DBCampo("CtaMayor").ToString.ToEntero < 0 Then - TotalActualMes -= e.Row.DBCampo("ImporteActual").ToString.ToDouble - TotalAnteriorMes -= e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble - 'e.Row.ControlStyle.BackColor = Drawing.Color.LightGray - 'e.Row.ControlStyle.ForeColor = Drawing.Color.White - e.Row.ControlStyle.Font.Bold = True - ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = 3 Then - 'e.Row.CssClass = "SubTotales" - e.Row.ControlStyle.Font.Bold = True - End If - - If e.Row.DBCampo("CtaMayor").ToString.ToEntero > 0 Then - - Dim CveCuenta As Integer = e.Row.DataKey("CveCuenta").ToEntero - - 'e.Row.FCHyperLink("HLNombre").NavigateUrl = $"./RepAnexoCatalogoMensualHorizontal.aspx?CveCuenta={e.Row.DBCampo("CveCuenta").ToString}&FF=31/12/{DdlEjercicio.SelectedValue}&FI=01/01/{DdlEjercicio.SelectedValue}&ER=1" - e.Row.FCHyperLink("HLNombre").NavigateUrl = $"./RepAnexoCatalogoMensual.aspx?CveCuenta={e.Row.DBCampo("CveCuenta").ToString}&Ejercicio={DdlEjercicio.SelectedValue}&Divisor={DdlDivisor.SelectedValue}&CveSubProyecto={DdlSubproyecto.SelectedValue}&Periodo={DdlPeriodo.SelectedValue}&TRCU={DdlTri.SelectedValue}" - - e.Row.FCHyperLink("HLEnero").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/01/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/01/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLFebrero").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/02/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/02/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLMarzo").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/03/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/03/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLAbril").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/04/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/04/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLMayo").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/05/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/05/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLJunio").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/06/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/06/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLJulio").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/07/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/07/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLAgosto").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/08/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/08/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLSeptiembre").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/09/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/09/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLOctubre").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/10/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/10/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLNoviembre").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/11/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/11/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLDiciembre").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/12/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/12/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - - e.Row.FCHyperLink("HLTri1").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/03/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/01/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLTri2").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/06/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/04/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLTri3").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/09/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/07/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLTri4").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/12/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/10/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - - e.Row.FCHyperLink("HLCua1").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/04/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/01/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLCua2").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/08/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/05/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - e.Row.FCHyperLink("HLCua3").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), $"01/12/{DdlEjercicio.SelectedValue}".ToDate.LastDayOfMonth.ToShortDateString, $"01/09/{DdlEjercicio.SelectedValue}".ToDate.ToShortDateString) - - 'e.Row.FCHyperLink("HLAnterior").NavigateUrl = String.Format("/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1", e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("FechaFActual").ToDate.ToShortDateString, e.Row.DBCampo("FechaInicial").ToDate.ToShortDateString) - e.Row.FCHyperLink("HLAnterior").NavigateUrl = $"./RepAnexoCatalogoMensual.aspx?CveCuenta={e.Row.DBCampo("CveCuenta").ToString}&Ejercicio={DdlEjercicio.SelectedValue}&Divisor={DdlDivisor.SelectedValue}&CveSubProyecto={DdlSubproyecto.SelectedValue}&Periodo={DdlPeriodo.SelectedValue}" - - End If - - - - If e.Row.DBCampo("CtaMayor").ToString.ToEntero > 0 Or e.Row.DBCampo("Nombre") = "TOTAL GASTOS" Then - - If DdlDivisor.SelectedValue.ToEntero > 1 Then - - 'Enero,Febrero,Marzo,Abril,Mayo,Junio,Julio,Agosto,Septiembre,Octubre,Noviembre,Diciembre,PorcentajeAcumulado - e.Row.FCHyperLink("HLEnero").Text = e.Row.DataKey("Enero").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLFebrero").Text = e.Row.DataKey("Febrero").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLMarzo").Text = e.Row.DataKey("Marzo").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLAbril").Text = e.Row.DataKey("Abril").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLMayo").Text = e.Row.DataKey("Mayo").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLJunio").Text = e.Row.DataKey("Junio").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLJulio").Text = e.Row.DataKey("Julio").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLAgosto").Text = e.Row.DataKey("Agosto").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLSeptiembre").Text = e.Row.DataKey("Septiembre").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLOctubre").Text = e.Row.DataKey("Octubre").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLNoviembre").Text = e.Row.DataKey("Noviembre").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLDiciembre").Text = e.Row.DataKey("Diciembre").ToDecimal.ToString("###,###,##0") - - Else - e.Row.FCHyperLink("HLEnero").Text = e.Row.DataKey("Enero").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLFebrero").Text = e.Row.DataKey("Febrero").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLMarzo").Text = e.Row.DataKey("Marzo").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLAbril").Text = e.Row.DataKey("Abril").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLMayo").Text = e.Row.DataKey("Mayo").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLJunio").Text = e.Row.DataKey("Junio").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLJulio").Text = e.Row.DataKey("Julio").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLAgosto").Text = e.Row.DataKey("Agosto").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLSeptiembre").Text = e.Row.DataKey("Septiembre").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLOctubre").Text = e.Row.DataKey("Octubre").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLNoviembre").Text = e.Row.DataKey("Noviembre").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLDiciembre").Text = e.Row.DataKey("Diciembre").ToDecimal.ToString("###,###,##0.00") - End If - End If - - - setgrafica(e) - - - e.Row.FCHyperLink("HLEnero").ForeColor = If(e.Row.DataKey("Enero").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLEnero").ForeColor) - e.Row.FCHyperLink("HLFebrero").ForeColor = If(e.Row.DataKey("Febrero").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLFebrero").ForeColor) - e.Row.FCHyperLink("HLMarzo").ForeColor = If(e.Row.DataKey("Marzo").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLMarzo").ForeColor) - e.Row.FCHyperLink("HLAbril").ForeColor = If(e.Row.DataKey("Abril").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLAbril").ForeColor) - e.Row.FCHyperLink("HLMayo").ForeColor = If(e.Row.DataKey("Mayo").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLAbril").ForeColor) - e.Row.FCHyperLink("HLJunio").ForeColor = If(e.Row.DataKey("Junio").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLMayo").ForeColor) - e.Row.FCHyperLink("HLJulio").ForeColor = If(e.Row.DataKey("Julio").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLJulio").ForeColor) - e.Row.FCHyperLink("HLAgosto").ForeColor = If(e.Row.DataKey("Agosto").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLAgosto").ForeColor) - e.Row.FCHyperLink("HLSeptiembre").ForeColor = If(e.Row.DataKey("Septiembre").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLSeptiembre").ForeColor) - e.Row.FCHyperLink("HLOctubre").ForeColor = If(e.Row.DataKey("Octubre").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLOctubre").ForeColor) - e.Row.FCHyperLink("HLNoviembre").ForeColor = If(e.Row.DataKey("Noviembre").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLNoviembre").ForeColor) - e.Row.FCHyperLink("HLDiciembre").ForeColor = If(e.Row.DataKey("Diciembre").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLDiciembre").ForeColor) - - - - If e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble < 0 Then - e.Row.FCHyperLink("HLAnterior").ForeColor = Drawing.Color.Red - End If - End If - End Sub - - Protected Sub GvTotalesMesH_RowDataBound(sender As Object, e As GridViewRowEventArgs) - - If e.Row.RowType = DataControlRowType.Header Then - e.Row.Attributes.Add("style", "display:none") - End If - - If e.Row.RowType = DataControlRowType.DataRow Then - - e.Row.Attributes.Add("style", "Font-weight: bold") - - - If DdlDivisor.SelectedValue.ToEntero > 0 Then - - e.Row.FCHyperLink("HLEnero").Text = e.Row.DataKey("Enero").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLFebrero").Text = e.Row.DataKey("Febrero").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLMarzo").Text = e.Row.DataKey("Marzo").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLAbril").Text = e.Row.DataKey("Abril").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLMayo").Text = e.Row.DataKey("Mayo").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLJunio").Text = e.Row.DataKey("Junio").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLJulio").Text = e.Row.DataKey("Julio").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLAgosto").Text = e.Row.DataKey("Agosto").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLSeptiembre").Text = e.Row.DataKey("Septiembre").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLOctubre").Text = e.Row.DataKey("Octubre").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLNoviembre").Text = e.Row.DataKey("Noviembre").ToDecimal.ToString("###,###,##0") - e.Row.FCHyperLink("HLDiciembre").Text = e.Row.DataKey("Diciembre").ToDecimal.ToString("###,###,##0") - - Else - e.Row.FCHyperLink("HLEnero").Text = e.Row.DataKey("Enero").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLFebrero").Text = e.Row.DataKey("Febrero").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLMarzo").Text = e.Row.DataKey("Marzo").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLAbril").Text = e.Row.DataKey("Abril").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLMayo").Text = e.Row.DataKey("Mayo").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLJunio").Text = e.Row.DataKey("Junio").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLJulio").Text = e.Row.DataKey("Julio").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLAgosto").Text = e.Row.DataKey("Agosto").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLSeptiembre").Text = e.Row.DataKey("Septiembre").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLOctubre").Text = e.Row.DataKey("Octubre").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLNoviembre").Text = e.Row.DataKey("Noviembre").ToDecimal.ToString("###,###,##0.00") - e.Row.FCHyperLink("HLDiciembre").Text = e.Row.DataKey("Diciembre").ToDecimal.ToString("###,###,##0.00") - End If - - setgrafica(e) - - e.Row.FCHyperLink("HLEnero").ForeColor = If(e.Row.DataKey("Enero").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLEnero").ForeColor) - e.Row.FCHyperLink("HLFebrero").ForeColor = If(e.Row.DataKey("Febrero").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLFebrero").ForeColor) - e.Row.FCHyperLink("HLMarzo").ForeColor = If(e.Row.DataKey("Marzo").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLMarzo").ForeColor) - e.Row.FCHyperLink("HLAbril").ForeColor = If(e.Row.DataKey("Abril").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLAbril").ForeColor) - e.Row.FCHyperLink("HLMayo").ForeColor = If(e.Row.DataKey("Mayo").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLAbril").ForeColor) - e.Row.FCHyperLink("HLJunio").ForeColor = If(e.Row.DataKey("Junio").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLMayo").ForeColor) - e.Row.FCHyperLink("HLJulio").ForeColor = If(e.Row.DataKey("Julio").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLJulio").ForeColor) - e.Row.FCHyperLink("HLAgosto").ForeColor = If(e.Row.DataKey("Agosto").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLAgosto").ForeColor) - e.Row.FCHyperLink("HLSeptiembre").ForeColor = If(e.Row.DataKey("Septiembre").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLSeptiembre").ForeColor) - e.Row.FCHyperLink("HLOctubre").ForeColor = If(e.Row.DataKey("Octubre").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLOctubre").ForeColor) - e.Row.FCHyperLink("HLNoviembre").ForeColor = If(e.Row.DataKey("Noviembre").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLNoviembre").ForeColor) - e.Row.FCHyperLink("HLDiciembre").ForeColor = If(e.Row.DataKey("Diciembre").ToDecimal < 0, Drawing.Color.Red, e.Row.FCHyperLink("HLDiciembre").ForeColor) - - - End If - - End Sub - - Public Sub setgrafica(e As GridViewRowEventArgs) - - Dim lista As New List(Of Object) - lista.Add(New With {.Texto = "Enero", .Valor = e.Row.DataKey("Enero").ToDecimal(), .Color = "#FF0F00"}) - lista.Add(New With {.Texto = "Febrero", .Valor = e.Row.DataKey("Febrero").ToDecimal(), .Color = "#FF6600"}) - lista.Add(New With {.Texto = "Marzo", .Valor = e.Row.DataKey("Marzo").ToDecimal(), .Color = "#F8FF01"}) - lista.Add(New With {.Texto = "Abril", .Valor = e.Row.DataKey("Abril").ToDecimal(), .Color = "#04D215"}) - lista.Add(New With {.Texto = "Mayo", .Valor = e.Row.DataKey("Mayo").ToDecimal(), .Color = "#2A0CD0"}) - lista.Add(New With {.Texto = "Junio", .Valor = e.Row.DataKey("Junio").ToDecimal(), .Color = "#8A0CCF"}) - lista.Add(New With {.Texto = "Julio", .Valor = e.Row.DataKey("Julio").ToDecimal(), .Color = "#CD0D74"}) - lista.Add(New With {.Texto = "Agosto", .Valor = e.Row.DataKey("Agosto").ToDecimal(), .Color = "#754DEB"}) - lista.Add(New With {.Texto = "Septiembre", .Valor = e.Row.DataKey("Septiembre").ToDecimal(), .Color = "#DDDDDD"}) - lista.Add(New With {.Texto = "Octubre", .Valor = e.Row.DataKey("Octubre").ToDecimal(), .Color = "#999999"}) - lista.Add(New With {.Texto = "Noviembre", .Valor = e.Row.DataKey("Noviembre").ToDecimal(), .Color = "#000000"}) - lista.Add(New With {.Texto = "Diciembre", .Valor = e.Row.DataKey("Diciembre").ToDecimal(), .Color = "#FF0F00"}) - e.Row.FCHyperLink("Hypgrafica").Attributes.Add("data-values", Newtonsoft.Json.JsonConvert.SerializeObject(lista)) - End Sub -#End Region - - - -#Region "Anual H O R I Z O N T A L" - - Private Sub CargaDatosAnualH() - - - FechaIMes = $"01/01/{DdlEjercicio.SelectedValue}" - FechaFMes = $"31/12/{DdlEjercicio2.SelectedValue}" - - Dim CveSubProyecto As Integer = DdlSubproyecto.SelectedValue.ToEntero - - 'Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa) - Dim ObjConta As New ClsContabilidad - If ObjConta.GetEstadosAnualHorizontal(FechaIMes.ToDate, FechaFMes.ToDate, CveSubProyecto, DdlDivisor.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, DdlPeriodo.SelectedValue.ToEntero, Periodo:=DdlPeriodo.SelectedValue.ToEntero) Then - DtDatosAnualH = ObjConta.DtResultados.FiltraParametros("(ImporteActual <> 0 OR ImporteAcumulado <> 0)") - Else - DtDatosAnualH = Nothing - Alert("Ocurrio un error al cargar los datos del Estado de Actividades", TipoMensaje.MsgError) - End If - ObjConta.Dispose() - - If DtDatosAnualH IsNot Nothing Then - CargaGridsAnualH() - - End If - - End Sub - - Private Sub CargaGridsAnualH() - - DtIngresosAnualH = DtDatosAnualH.FiltraParametros("Tipo ='H' ") - DtGastosAnualH = DtDatosAnualH.FiltraParametros("Tipo ='G' ") - DTTotalesAnualH = DtDatosAnualH.Clone() - - Dim Row As DataRow = DtIngresosAnualH.NewRow - - Dim TotalActual = 0.0, TotalAnterior = 0.0 - - - Dim IndexData As Integer = 0 - Dim IndexGv As Integer = 1 - Dim IndexMax As Integer = 1 - - - Dim IDX_LIMPIAR As Integer = 1 - - For IDX_LIMPIAR = 1 To 25 - - GvIngresosAnualH.Columns(IDX_LIMPIAR).Visible = False - GvGastosAnualH.Columns(IDX_LIMPIAR).Visible = False - GvTotalesAnualH.Columns(IDX_LIMPIAR).Visible = False - Next - listaCamposanios.Clear() - listaCamposaniosGastos.Clear() - listaCamposaniosTotal.Clear() - - If DtIngresosAnualH.Rows.Count > 0 Then - - - - - For Each dCoumn As DataColumn In DtIngresosAnualH.Columns - - If IndexData >= 13 Then - - If dCoumn.ColumnName.ToEntero > 0 And dCoumn.ColumnName.ToEntero <= DdlEjercicio2.SelectedValue.ToEntero Then - - CType(GvIngresosAnualH.Columns(IndexGv), BoundField).DataField = dCoumn.ColumnName - CType(GvIngresosAnualH.Columns(IndexGv), BoundField).HeaderText = dCoumn.ColumnName - - - listaCamposanios.Add(New String() {dCoumn.ColumnName.ToString(), dCoumn.ColumnName.ToString()}) - - listaCamposaniosTotal.Add(New String() {dCoumn.ColumnName.ToString(), dCoumn.ColumnName.ToString()}) - 'CType(GvIngresosAnualH.Columns(IndexGv), BoundField).DataField = dCoumn.ColumnName - 'CType(GvIngresosAnualH.Columns(IndexGv), BoundField).HeaderText = dCoumn.ColumnName - GvIngresosAnualH.Columns(IndexGv).Visible = True - - - CType(GvTotalesAnualH.Columns(IndexGv), BoundField).DataField = dCoumn.ColumnName - CType(GvTotalesAnualH.Columns(IndexGv), BoundField).HeaderText = dCoumn.ColumnName - 'CType(GvTotalesAnualH.Columns(IndexGv), BoundField).DataField = dCoumn.ColumnName - 'CType(GvTotalesAnualH.Columns(IndexGv), BoundField).HeaderText = dCoumn.ColumnName - GvTotalesAnualH.Columns(IndexGv).Visible = True - - IndexMax = IndexData - Else - GvIngresosAnualH.Columns(IndexGv).Visible = False - GvTotalesAnualH.Columns(IndexGv).Visible = False - End If - - - - IndexGv = IndexGv + 1 - End If - - IndexData = IndexData + 1 - - Next - - - For Each dr As DataRow In DtIngresosAnualH.FiltraParametros("NOT CtaMayor in (3,4)").Rows - - TotalActual += dr("ImporteActual").ToString.ToDouble - TotalAnterior += dr("ImporteAcumulado").ToString.ToDouble - - Next - - IndexData = 13 - For IndexData = 13 To IndexMax - Row.Item(IndexData) = DtIngresosAnualH.SUM($"[{DtIngresosAnualH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (3,4)") - Next - - Row.Item("Nombre") = "TOTAL INGRESOS " - Row.Item("ImporteActual") = DtIngresosAnualH.SUM("ImporteActual", "NOT CtaMayor in (3,4)") 'TotalActual.ToString - Row.Item("PorcentajeActual") = "100.00" - Row.Item("ImporteAcumulado") = DtIngresosAnualH.SUM("ImporteAcumulado", "NOT CtaMayor in (3,4)") 'TotalAnterior.ToString - Row.Item("PorcentajeAcumulado") = "100.00" - Row.Item("CtaMayor") = -1 - Row.Item("CountDinamico") = DtGastosAnualH.MAX("CountDinamico") - CountDinamicoAnual = DtGastosAnualH.MAX("CountDinamico").ToEntero - DtIngresosAnualH.Rows.Add(Row) - Else - Row.Item("Nombre") = "TOTAL INGRESOS " - Row.Item("ImporteActual") = "0.00" - Row.Item("ImporteAcumulado") = "0.00" - Row.Item("CtaMayor") = -1 - DtIngresosAnualH.Rows.Add(Row) - End If - - Dim T1 = TotalActual, T2 = TotalAnterior - - TotalActual = 0 - TotalAnterior = 0 - - Row = DtGastosAnualH.NewRow - - If DtGastosAnualH.Rows.Count > 0 Then - - - IndexData = 0 - IndexGv = 1 - IndexMax = 0 - - For Each dCoumn As DataColumn In DtGastosAnualH.Columns - - If IndexData >= 13 Then - - If dCoumn.ColumnName.ToEntero > 0 And dCoumn.ColumnName.ToEntero <= DdlEjercicio2.SelectedValue.ToEntero Then - 'HyperLinkField - - CType(GvGastosAnualH.Columns(IndexGv), BoundField).DataField = dCoumn.ColumnName - CType(GvGastosAnualH.Columns(IndexGv), BoundField).HeaderText = dCoumn.ColumnName - listaCamposaniosGastos.Add(New String() {dCoumn.ColumnName.ToString(), dCoumn.ColumnName.ToString()}) - - 'CType(GvGastosAnualH.Columns(IndexGv), HyperLinkField).DataNavigateUrlFields = {"CveCuenta", "FechaInicial", "FechaFActual", "CveSubProyecto"} - 'CType(GvGastosAnualH.Columns(IndexGv), HyperLinkField).DataNavigateUrlFormatString = "/Contabilidad2/RepAnexoCatalogo.aspx?CveCuenta={0}&FF={1}&FI={2}&ER=1&CveSubProyecto{3}" - - 'CType(GvGastosAnualH.Columns(IndexGv), BoundField).DataField = dCoumn.ColumnName - 'CType(GvGastosAnualH.Columns(IndexGv), BoundField).HeaderText = dCoumn.ColumnName - - GvGastosAnualH.Columns(IndexGv).Visible = True - IndexMax = IndexData - Else - GvGastosAnualH.Columns(IndexGv).Visible = False - End If - - - - IndexGv = IndexGv + 1 - End If - - IndexData = IndexData + 1 - - Next - - - For Each dr As DataRow In DtGastosAnualH.FiltraParametros("Not CtaMayor In (3,4)").Rows - TotalActual += dr("ImporteActual").ToString.ToDouble - TotalAnterior += dr("ImporteAcumulado").ToString.ToDouble - Next - - IndexData = 13 - For IndexData = 13 To IndexMax - - Row.Item(IndexData) = DtGastosAnualH.SUM($"[{DtIngresosAnualH.Columns(IndexData).ColumnName}]", "Not CtaMayor In (3,4)") - - Next - - Row.Item("Nombre") = "TOTAL GASTOS" - Row.Item("ImporteActual") = TotalActual - Row.Item("PorcentajeActual") = If(T1 > 0, (TotalActual * 100 / T1).ToString, "0").FormatoNumero - Row.Item("ImporteAcumulado") = TotalAnterior.ToString - Row.Item("PorcentajeAcumulado") = If(T2 > 0, (TotalAnterior * 100 / T2).ToString, "0").FormatoNumero - Row.Item("CtaMayor") = -1 - Row.Item("CountDinamico") = DtGastosAnualH.MAX("CountDinamico") - DtGastosAnualH.Rows.Add(Row) - Else - Row.Item("Nombre") = "TOTAL GASTOS" - Row.Item("ImporteActual") = "0.00" - Row.Item("ImporteAcumulado") = "0.00" - Row.Item("CtaMayor") = -1 - DtGastosAnualH.Rows.Add(Row) - End If - - If DtIngresosAnualH.Rows.Count > 0 Then - - Row = DTTotalesAnualH.NewRow - - - IndexData = 13 - For IndexData = 13 To IndexMax - Row.Item(IndexData) = DtIngresosAnualH.SUM($"[{DtIngresosAnualH.Columns(IndexData).ColumnName}]", "Not CtaMayor In (-1,3,4)") - DtGastosAnualH.SUM($"[{DtGastosAnualH.Columns(IndexData).ColumnName}]", "Not CtaMayor In (-1,3,4)") - Next - - Row.Item("Nombre") = "Resultados del Ejercicio" - Row.Item("ImporteAcumulado") = DtIngresosAnualH.SUM($"ImporteAcumulado", "Not CtaMayor in (-1,3,4)") - DtGastosAnualH.SUM($"ImporteAcumulado", "Not CtaMayor in (-1,3,4)") - - - DTTotalesAnualH.Rows.Add(Row) - - End If - - GvIngresosAnualH.DataSource = DtIngresosAnualH - GvIngresosAnualH.DataBind() - - GvGastosAnualH.DataSource = DtGastosAnualH - GvGastosAnualH.DataBind() - - GvTotalesAnualH.DataSource = DTTotalesAnualH - GvTotalesAnualH.DataBind() - - UpDatosAnualH.Update() - - End Sub - - - - Protected Sub GvIngresosAnualH_RowDataBound(sender As Object, e As GridViewRowEventArgs) - If e.Row.RowType = DataControlRowType.DataRow Then - setgraficaCCAnual(e, listaCamposanios) - If e.Row.DBCampo("CtaMayor").ToString.ToEntero < 0 Then - TotalActualMes += e.Row.DBCampo("ImporteActual").ToString.ToDouble - TotalAnteriorMes += e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble - 'e.Row.ControlStyle.BackColor = Drawing.Color.LightGray - 'e.Row.ControlStyle.ForeColor = Drawing.Color.White - e.Row.ControlStyle.Font.Bold = True - ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = 3 Then - 'e.Row.CssClass = "SubTotales3" - e.Row.ControlStyle.Font.Bold = True - End If - - - Dim CveCuenta As Integer = e.Row.DataKey("CveCuenta").ToEntero - Dim CveSubProyecto As Integer = e.Row.DataKey("CveSubProyecto").ToEntero - - If e.Row.DBCampo("CtaMayor").ToString.ToEntero > 0 Then - - e.Row.FCHyperLink("HLNombre").NavigateUrl = $"./RepAnexoCatalogoAnual.aspx?CveCuenta={e.Row.DBCampo("CveCuenta").ToString}&Ejercicio={DdlEjercicio.SelectedValue}&Divisor={DdlDivisor.SelectedValue}&CveSubProyecto={DdlSubproyecto.SelectedValue}&EjercicioFinal={DdlEjercicio2.SelectedValue}&Periodo={DdlPeriodo.SelectedValue}" - - Dim CountDinamico As Integer = e.Row.DataKey("CountDinamico").ToEntero - Dim IndiceInicio As Integer = 1 - Dim IndiceMax As Integer = 1 + CountDinamico - - For IndiceInicio = 1 To IndiceMax - Dim Anio As String = CType(GvGastosAnualH.Columns(IndiceInicio), BoundField).DataField - Dim Importe As Decimal = e.Row.Cells(IndiceInicio).Text.ToDecimal - e.Row.Cells(IndiceInicio).Text = $"{ If(DdlDivisor.SelectedValue.ToEntero > 1, Importe.ToString("###,###,##0"), Importe.ToString("###,###,###.00")) }" - 'e.Row.Cells(IndiceInicio).ForeColor = If(Importe < 0, Drawing.Color.Red, e.Row.Cells(IndiceInicio).ForeColor) - Next IndiceInicio - - 'e.Row.FCHyperLink("HLAnterior").NavigateUrl = $"./RepAnexoCatalogo.aspx?CveCuenta={CveCuenta}&FF=31/12/{DdlEjercicio2.SelectedValue}&FI=01/01/{DdlEjercicio.SelectedValue}&ER=1&CveSubProyecto={CveSubProyecto}" - e.Row.FCHyperLink("HLAnterior").NavigateUrl = $"./RepAnexoCatalogoAnual.aspx?CveCuenta={e.Row.DBCampo("CveCuenta").ToString}&Ejercicio={DdlEjercicio.SelectedValue}&Divisor={DdlDivisor.SelectedValue}&CveSubProyecto={DdlSubproyecto.SelectedValue}&EjercicioFinal={DdlEjercicio2.SelectedValue}&Periodo={DdlPeriodo.SelectedValue}" - - - - ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = -1 Then - - Dim CountDinamico As Integer = e.Row.DataKey("CountDinamico").ToEntero - Dim IndiceInicio As Integer = 1 - Dim IndiceMax As Integer = 1 + CountDinamico - - For IndiceInicio = 1 To IndiceMax - - Dim Importe As Decimal = e.Row.Cells(IndiceInicio).Text.ToDecimal - e.Row.Cells(IndiceInicio).Text = $"{ If(DdlDivisor.SelectedValue.ToEntero > 1, Importe.ToString("###,###,##0"), Importe.ToString("###,###,###.00")) }" - - Next IndiceInicio - - - End If - - - - If e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble < 0 Then - e.Row.FCHyperLink("HLAnterior").ForeColor = Drawing.Color.Red - End If - End If - End Sub - - Protected Sub GvGastosAnualH_RowDataBound(sender As Object, e As GridViewRowEventArgs) - If e.Row.RowType = DataControlRowType.DataRow Then - setgraficaCCAnual(e, listaCamposaniosGastos) - If e.Row.DBCampo("CtaMayor").ToString.ToEntero < 0 Then - TotalActualMes -= e.Row.DBCampo("ImporteActual").ToString.ToDouble - TotalAnteriorMes -= e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble - 'e.Row.ControlStyle.BackColor = Drawing.Color.LightGray - 'e.Row.ControlStyle.ForeColor = Drawing.Color.White - e.Row.ControlStyle.Font.Bold = True - ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = 3 Then - 'e.Row.CssClass = "SubTotales" - e.Row.ControlStyle.Font.Bold = True - End If - - Dim CveCuenta As Integer = e.Row.DataKey("CveCuenta").ToEntero - Dim CveSubProyecto As Integer = e.Row.DataKey("CveSubProyecto").ToEntero - If e.Row.DBCampo("CtaMayor").ToString.ToEntero > 0 Then - - 'e.Row.FCHyperLink("HLNombre").NavigateUrl = $"./RepAnexoCatalogoAnual.aspx?CveCuenta={e.Row.DBCampo("CveCuenta").ToString}&Ejercicio={DdlEjercicio.SelectedValue}&Divisor={DdlDivisor.SelectedValue}&CveSubProyecto=-1&EjercicioFinal={DdlEjercicio2.SelectedValue}" - e.Row.FCHyperLink("HLNombre").NavigateUrl = $"./RepAnexoCatalogoAnual.aspx?CveCuenta={e.Row.DBCampo("CveCuenta").ToString}&Ejercicio={DdlEjercicio.SelectedValue}&Divisor={DdlDivisor.SelectedValue}&CveSubProyecto={DdlSubproyecto.SelectedValue}&EjercicioFinal={DdlEjercicio2.SelectedValue}&Periodo={DdlPeriodo.SelectedValue}" - - Dim CountDinamico As Integer = e.Row.DataKey("CountDinamico").ToEntero - Dim IndiceInicio As Integer = 1 - Dim IndiceMax As Integer = 1 + CountDinamico - For IndiceInicio = 1 To IndiceMax - Dim Anio As String = CType(GvGastosAnualH.Columns(IndiceInicio), BoundField).DataField - Dim Importe As Decimal = e.Row.Cells(IndiceInicio).Text.ToDecimal - e.Row.Cells(IndiceInicio).Text = $"{If(DdlDivisor.SelectedValue.ToEntero > 1, Importe.ToString("###,###,##0"), Importe.ToString("###,###,###.00"))}" - 'e.Row.Cells(IndiceInicio).ForeColor = If(Importe < 0, Drawing.Color.Red, e.Row.Cells(IndiceInicio).ForeColor) - Next IndiceInicio - - 'e.Row.FCHyperLink("HLAnterior").NavigateUrl = $"./RepAnexoCatalogo.aspx?CveCuenta={CveCuenta}&FF=31/12/{DdlEjercicio2.SelectedValue}&FI=01/01/{DdlEjercicio.SelectedValue}&ER=1&CveSubProyecto={CveSubProyecto}" - e.Row.FCHyperLink("HLAnterior").NavigateUrl = $"./RepAnexoCatalogoAnual.aspx?CveCuenta={e.Row.DBCampo("CveCuenta").ToString}&Ejercicio={DdlEjercicio.SelectedValue}&Divisor={DdlDivisor.SelectedValue}&CveSubProyecto={DdlSubproyecto.SelectedValue}&EjercicioFinal={DdlEjercicio2.SelectedValue}&Periodo={DdlPeriodo.SelectedValue}" - - - ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = -1 Then - - Dim CountDinamico As Integer = e.Row.DataKey("CountDinamico").ToEntero - Dim IndiceInicio As Integer = 1 - Dim IndiceMax As Integer = 1 + CountDinamico - - For IndiceInicio = 1 To IndiceMax - - Dim Importe As Decimal = e.Row.Cells(IndiceInicio).Text.ToDecimal - e.Row.Cells(IndiceInicio).Text = $"{ If(DdlDivisor.SelectedValue.ToEntero > 1, Importe.ToString("###,###,##0"), Importe.ToString("###,###,###.00")) }" - - Next IndiceInicio - - End If - - If e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble < 0 Then - e.Row.FCHyperLink("HLAnterior").ForeColor = Drawing.Color.Red - End If - End If - End Sub - - Protected Sub GvTotalesAnualH_RowDataBound(sender As Object, e As GridViewRowEventArgs) - - If e.Row.RowType = DataControlRowType.Header Then - e.Row.Attributes.Add("style", "display:none") - End If - - If e.Row.RowType = DataControlRowType.DataRow Then - setgraficaCCAnual(e, listaCamposaniosTotal) - e.Row.Attributes.Add("style", "Font-weight: bold") - End If - - End Sub - - Public Sub setgraficaCCAnual(e As GridViewRowEventArgs, listaCampos As List(Of String())) - Dim lista As New List(Of Object) - Dim colorindex As Integer = 0 - For Each campo As String() In listaCampos - lista.Add(New With {.Texto = campo(1), .Valor = e.Row.DBCampo(campo(0)).ToDecimal(), .Color = listacolores(colorindex)}) - colorindex = colorindex + 1 - If colorindex >= listacolores.Count Then - colorindex = 0 - End If - Next - e.Row.FCHyperLink("Hypgrafica").Attributes.Add("data-values", Newtonsoft.Json.JsonConvert.SerializeObject(lista)) - End Sub -#End Region - - -#Region "S U B P R O Y E C T O H O R I Z O N T A L" - - Private Sub CargaDatosSubProyectoH() - - - FechaIMes = $"01/01/{DdlEjercicio.SelectedValue}" - FechaFMes = $"01/{DdlPeriodo.SelectedValue.ToEntero.ToString("00")}/{DdlEjercicio.SelectedValue}" - FechaFMes = DateAdd(DateInterval.Day, -1, DateAdd(DateInterval.Month, 1, CDate(FechaFMes))).ToString("dd/MM/yyyy") - - Dim CveSubProyecto As Integer = DdlSubproyecto.SelectedValue.ToEntero - - - Dim ObjConta As New ClsContabilidad - If ObjConta.GetEstadosSubProyectoHorizontal(FechaIMes.ToDate, FechaFMes.ToDate, CveSubProyecto, DdlDivisor.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) Then - DTSubProyectosCabecerasH = ObjConta.DSResultados.Tables(0) - DtDatosSubProyectoH = ObjConta.DSResultados.Tables(1).FiltraParametros("(ImporteActual <> 0 OR ImporteAcumulado <> 0)") - Else - DtDatosSubProyectoH = Nothing - Alert("Ocurrio un error al cargar los datos del Estado de Actividades", TipoMensaje.MsgError) - End If - ObjConta.Dispose() - - If DtDatosSubProyectoH IsNot Nothing And DTSubProyectosCabecerasH IsNot Nothing Then - CargaGridsSubProyectoH() - End If - - End Sub - - Private Sub CargaGridsSubProyectoH() - - DtIngresosSubProyectoH = DtDatosSubProyectoH.FiltraParametros("Tipo ='H' ") - DtGastosSubProyectoH = DtDatosSubProyectoH.FiltraParametros("Tipo ='G' ") - DTTotalesSubProyectoH = DtDatosSubProyectoH.Clone() - - Dim Row As DataRow = DtIngresosSubProyectoH.NewRow - - Dim TotalActual = 0.0, TotalAnterior = 0.0 - - - Dim IndexData As Integer = 0 - Dim IndexGv As Integer = 1 - Dim IndexMax As Integer = 1 - Dim IndexSubProyecto = 0 - Dim IndexSubProyectoMAx As Integer = DTSubProyectosCabecerasH.Rows.Count - 1 - Dim IndexTotatles As Integer = 13 + IndexSubProyectoMAx - - '34 - Dim IDX_LIMPIAR As Integer = 1 - - For IDX_LIMPIAR = 1 To 35 - CType(GvIngresosSubProyectoH.Columns(IDX_LIMPIAR), BoundField).DataField = Nothing - CType(GvIngresosSubProyectoH.Columns(IDX_LIMPIAR), BoundField).HeaderText = "" - GvIngresosSubProyectoH.Columns(IDX_LIMPIAR).Visible = False - Next - listaCampos.Clear() - - - If DtIngresosSubProyectoH.Rows.Count > 0 Then - - For Each dCoumn As DataColumn In DtIngresosSubProyectoH.Columns - - If IndexData >= 13 Then - - If IndexSubProyecto <= IndexSubProyectoMAx Then - - CType(GvIngresosSubProyectoH.Columns(IndexGv), BoundField).DataField = dCoumn.ColumnName - GvIngresosSubProyectoH.Columns(IndexGv).Visible = True - - CType(GvTotalesSubProyectoH.Columns(IndexGv), BoundField).DataField = dCoumn.ColumnName - GvTotalesSubProyectoH.Columns(IndexGv).Visible = True - - If IndexSubProyecto <= IndexSubProyectoMAx Then - CType(GvIngresosSubProyectoH.Columns(IndexGv), BoundField).HeaderText = DTSubProyectosCabecerasH.Rows(IndexSubProyecto)(0).ToString - CType(GvTotalesSubProyectoH.Columns(IndexGv), BoundField).HeaderText = DTSubProyectosCabecerasH.Rows(IndexSubProyecto)(0).ToString - CType(GvGastosSubProyectoH.Columns(IndexGv), BoundField).HeaderText = DTSubProyectosCabecerasH.Rows(IndexSubProyecto)(0).ToString - End If - listaCampos.Add(New String() {dCoumn.ColumnName.ToString(), DTSubProyectosCabecerasH.Rows(IndexSubProyecto)(0).ToString()}) - Else - GvIngresosSubProyectoH.Columns(IndexGv).Visible = False - GvTotalesSubProyectoH.Columns(IndexGv).Visible = False - End If - - IndexGv = IndexGv + 1 - IndexSubProyecto = IndexSubProyecto + 1 - IndexMax = IndexMax + 1 - - End If - IndexData = IndexData + 1 - Next - - - For Each dr As DataRow In DtIngresosSubProyectoH.FiltraParametros("NOT CtaMayor in (3,4)").Rows - TotalActual += dr("ImporteActual").ToString.ToDouble - TotalAnterior += dr("ImporteAcumulado").ToString.ToDouble - Next - - IndexData = 13 - For IndexData = 13 To IndexTotatles - Row.Item(IndexData) = DtIngresosSubProyectoH.SUM($"[{DtIngresosSubProyectoH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (3,4)") - Next - - Row.Item("Nombre") = "TOTAL INGRESOS " - Row.Item("ImporteActual") = DtIngresosSubProyectoH.SUM("ImporteActual", "NOT CtaMayor in (3,4)") 'TotalActual.ToString - Row.Item("PorcentajeActual") = "100.00" - Row.Item("ImporteAcumulado") = DtIngresosSubProyectoH.SUM("ImporteAcumulado", "NOT CtaMayor in (3,4)") 'TotalAnterior.ToString - Row.Item("PorcentajeAcumulado") = "100.00" - Row.Item("CtaMayor") = -1 - Row.Item("CountDinamico") = DtIngresosSubProyectoH.MAX("CountDinamico") - CountDinamicoSubProyecto = DtIngresosSubProyectoH.MAX("CountDinamico").ToEntero - DtIngresosSubProyectoH.Rows.Add(Row) - Else - Row.Item("Nombre") = "TOTAL INGRESOS " - Row.Item("ImporteActual") = "0.00" - Row.Item("ImporteAcumulado") = "0.00" - Row.Item("CtaMayor") = -1 - DtIngresosSubProyectoH.Rows.Add(Row) - End If - - Dim T1 = TotalActual, T2 = TotalAnterior - - TotalActual = 0 - TotalAnterior = 0 - - Row = DtGastosSubProyectoH.NewRow - - If DtGastosSubProyectoH.Rows.Count > 0 Then - - - IndexData = 0 - IndexGv = 1 - IndexMax = 0 - IndexSubProyecto = 0 - - For Each dCoumn As DataColumn In DtIngresosSubProyectoH.Columns - If IndexData >= 13 Then - If IndexSubProyecto <= IndexSubProyectoMAx Then - CType(GvGastosSubProyectoH.Columns(IndexGv), BoundField).DataField = dCoumn.ColumnName - GvGastosSubProyectoH.Columns(IndexGv).Visible = True - CType(GvTotalesSubProyectoH.Columns(IndexGv), BoundField).DataField = dCoumn.ColumnName - GvTotalesSubProyectoH.Columns(IndexGv).Visible = True - Else - GvIngresosSubProyectoH.Columns(IndexGv).Visible = False - GvTotalesSubProyectoH.Columns(IndexGv).Visible = False - End If - - IndexGv = IndexGv + 1 - IndexSubProyecto = IndexSubProyecto + 1 - End If - IndexData = IndexData + 1 - Next - - - - For Each dr As DataRow In DtGastosSubProyectoH.FiltraParametros("NOT CtaMayor in (3,4)").Rows - TotalActual += dr("ImporteActual").ToString.ToDouble - TotalAnterior += dr("ImporteAcumulado").ToString.ToDouble - Next - - IndexData = 13 - For IndexData = 13 To IndexTotatles - Row.Item(IndexData) = DtGastosSubProyectoH.SUM($"[{DtIngresosSubProyectoH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (3,4)") - Next - - Row.Item("Nombre") = "TOTAL GASTOS" - Row.Item("ImporteActual") = TotalActual - Row.Item("PorcentajeActual") = If(T1 > 0, (TotalActual * 100 / T1).ToString, "0").FormatoNumero - Row.Item("ImporteAcumulado") = TotalAnterior.ToString - Row.Item("PorcentajeAcumulado") = If(T2 > 0, (TotalAnterior * 100 / T2).ToString, "0").FormatoNumero - Row.Item("CtaMayor") = -1 - Row.Item("CountDinamico") = DtGastosSubProyectoH.MAX("CountDinamico") - - DtGastosSubProyectoH.Rows.Add(Row) - Else - Row.Item("Nombre") = "TOTAL GASTOS" - Row.Item("ImporteActual") = "0.00" - Row.Item("ImporteAcumulado") = "0.00" - Row.Item("CtaMayor") = -1 - DtGastosSubProyectoH.Rows.Add(Row) - End If - - If DtIngresosSubProyectoH.Rows.Count > 0 Then - - Row = DTTotalesSubProyectoH.NewRow - - IndexData = 13 - For IndexData = 13 To IndexTotatles - Row.Item(IndexData) = DtIngresosSubProyectoH.SUM($"[{DtIngresosSubProyectoH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (-1,3,4)") - DtGastosSubProyectoH.SUM($"[{DtGastosSubProyectoH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (-1,3,4)") - Next - - Row.Item("Nombre") = "Resultado del ejercicio" - Row.Item("ImporteAcumulado") = DtIngresosSubProyectoH.SUM($"ImporteAcumulado", "NOT CtaMayor in (-1,3,4)") - DtGastosSubProyectoH.SUM($"ImporteAcumulado", "NOT CtaMayor in (-1,3,4)") - Row.Item("CtaMayor") = -2 - Row.Item("CountDinamico") = DtIngresosSubProyectoH.MAX("CountDinamico") - - DTTotalesSubProyectoH.Rows.Add(Row) - - End If - - DtIngresosSubProyectoH.Merge(DtGastosSubProyectoH) - DtIngresosSubProyectoH.Merge(DTTotalesSubProyectoH) - - - GvIngresosSubProyectoH.DataSource = DtIngresosSubProyectoH - GvIngresosSubProyectoH.DataBind() - - - - UpDatosSubProyectoH.Update() - - End Sub - - 'Private Sub SumaTotalesSubProyectoH() - ' ''Llena Lb´s Totales - ' ''********************************************************************************* - ' 'LbTotalActual.Text = TotalActualMes.ToString.FormatoNumero - ' 'LbTotalAnterior.Text = TotalAnteriorMes.ToString.FormatoNumero - - ' 'LbTotalActual.ForeColor = If(TotalActualMes < 0, Drawing.Color.Red, Color.Black) - ' 'LbTotalAnterior.ForeColor = If(TotalAnteriorMes < 0, Drawing.Color.Red, Color.Black) - - - 'End Sub - - Protected Sub GvIngresosSubProyectoH_RowDataBound(sender As Object, e As GridViewRowEventArgs) - - If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.DBCampo("CtaMayor").ToString.ToEntero = -1 Then - TotalActualMes += e.Row.DBCampo("ImporteActual").ToString.ToDouble - TotalAnteriorMes += e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble - 'e.Row.ControlStyle.BackColor = Drawing.Color.LightGray - 'e.Row.ControlStyle.ForeColor = Drawing.Color.White - e.Row.ControlStyle.Font.Bold = True - ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = 3 Then - 'e.Row.CssClass = "SubTotales3" - e.Row.ControlStyle.Font.Bold = True - - ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = -2 Then - - e.Row.ControlStyle.Font.Bold = True - e.Row.ControlStyle.Font.Size = 13 - End If - Dim CveCuenta As Integer = e.Row.DataKey("CveCuenta").ToEntero - setgraficaCC(e) - 'Dim CveSubProyecto As Integer = e.Row.DataKey("CveSubProyecto").ToEntero - If e.Row.DBCampo("CtaMayor").ToString.ToEntero > 0 Then - - e.Row.FCHyperLink("HLNombre").NavigateUrl = $"./RepAnexoCatalogoCC.aspx?CveCuenta={e.Row.DBCampo("CveCuenta").ToString}&Ejercicio={DdlEjercicio.SelectedValue}&Divisor={DdlDivisor.SelectedValue}&CveSubProyecto={DdlSubproyecto.SelectedValue}&Periodo={DdlPeriodo.SelectedValue}" - - Dim CountDinamico As Integer = e.Row.DataKey("CountDinamico").ToEntero - Dim IndiceInicio As Integer = 1 - Dim IndiceMax As Integer = 1 + CountDinamico - - Dim FEchaMesFinal As Date = New Date(DdlEjercicio.SelectedValue.ToEntero, DdlPeriodo.SelectedValue.ToEntero, 1).LastDayOfMonth - - For IndiceInicio = 1 To IndiceMax - - Dim CveSubProyectoIntermo As String = CType(GvGastosSubProyectoH.Columns(IndiceInicio), BoundField).DataField - Dim Importe As Decimal = e.Row.Cells(IndiceInicio).Text.ToDecimal - - - If CveSubProyectoIntermo.ToEntero > 0 Then - e.Row.Cells(IndiceInicio).Text = $"{ If(DdlDivisor.SelectedValue.ToEntero > 1, Importe.ToString("###,###,##0"), Importe.ToString("###,###,###.00")) }" - End If - - - - Next IndiceInicio - - e.Row.FCHyperLink("HLAnterior").NavigateUrl = $"./RepAnexoCatalogoCC.aspx?CveCuenta={e.Row.DBCampo("CveCuenta").ToString}&Ejercicio={DdlEjercicio.SelectedValue}&Divisor={DdlDivisor.SelectedValue}&CveSubProyecto={DdlSubproyecto.SelectedValue}&Periodo={DdlPeriodo.SelectedValue}" - - ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = -1 Then - - Dim CountDinamico As Integer = e.Row.DataKey("CountDinamico").ToEntero - Dim IndiceInicio As Integer = 1 - Dim IndiceMax As Integer = 1 + CountDinamico - - For IndiceInicio = 1 To IndiceMax - - Dim Importe As Decimal = e.Row.Cells(IndiceInicio).Text.ToDecimal - e.Row.Cells(IndiceInicio).Text = $"
    { If(DdlDivisor.SelectedValue.ToEntero > 1, Importe.ToString("###,###,##0"), Importe.ToString("###,###,###.00")) }
    " - Next IndiceInicio - - - - ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = -2 Then - - Dim CountDinamico As Integer = e.Row.DataKey("CountDinamico").ToEntero - Dim IndiceInicio As Integer = 1 - Dim IndiceMax As Integer = 1 + CountDinamico - - For IndiceInicio = 1 To IndiceMax - - Dim Importe As Decimal = e.Row.Cells(IndiceInicio).Text.ToDecimal - e.Row.Cells(IndiceInicio).Text = $"
    { If(DdlDivisor.SelectedValue.ToEntero > 1, Importe.ToString("###,###,##0"), Importe.ToString("###,###,###.00")) }
    " - - Next IndiceInicio - - - End If - e.Row.FCHyperLink("HLAnterior").Text = If(DdlDivisor.SelectedValue.ToEntero > 1, e.Row.DBCampo("ImporteAcumulado").ToString.ToDecimal.ToString("###,###,##0"), e.Row.DBCampo("ImporteAcumulado").ToString.ToDecimal.ToString("###,###,##0.00")) - If e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble < 0 Then - e.Row.FCHyperLink("HLAnterior").ForeColor = Drawing.Color.Red - End If - - End If - - End Sub - - Protected Sub GvGastosSubProyectoH_RowDataBound(sender As Object, e As GridViewRowEventArgs) - If e.Row.RowType = DataControlRowType.DataRow Then - setgraficaCC(e) - If e.Row.DBCampo("CtaMayor").ToString.ToEntero < 0 Then - TotalActualMes -= e.Row.DBCampo("ImporteActual").ToString.ToDouble - TotalAnteriorMes -= e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble - e.Row.ControlStyle.Font.Bold = True - ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = 3 Then - 'e.Row.CssClass = "SubTotales" - e.Row.ControlStyle.Font.Bold = True - End If - If e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble < 0 Then - e.Row.FCHyperLink("HLAnterior").ForeColor = Drawing.Color.Red - End If - End If - End Sub - - Protected Sub GvTotalesSubProyectoH_RowDataBound(sender As Object, e As GridViewRowEventArgs) - If e.Row.RowType = DataControlRowType.Header Then - ' e.Row.Attributes.Add("style", "display:none") - End If - If e.Row.RowType = DataControlRowType.DataRow Then - setgraficaCC(e) - e.Row.Attributes.Add("style", "Font-weight: bold") - End If - End Sub - - Public Sub setgraficaCC(e As GridViewRowEventArgs) - Dim lista As New List(Of Object) - Dim colorindex As Integer = 0 - For Each campo As String() In listaCampos - lista.Add(New With {.Texto = campo(1), .Valor = e.Row.DBCampo(campo(0)).ToDecimal(), .Color = listacolores(colorindex)}) - colorindex = colorindex + 1 - If colorindex >= listacolores.Count Then - colorindex = 0 - End If - Next - e.Row.FCHyperLink("Hypgrafica").Attributes.Add("data-values", Newtonsoft.Json.JsonConvert.SerializeObject(lista)) - End Sub -#End Region - - - - - -#Region "DESCARGA EXCEL" - - Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click - Imprimir("Excel") - End Sub - - Private Sub Imprimir(Optional reporte As String = "PDF") - - - If TAB.ActiveTabIndex = 0 AndAlso GvIngresosMes.Rows.Count > 0 Then - ExportToExcelG(GvIngresosMes, GvGastosMes, TMesT1, "Reporte_Mensual", UsuarioActual, "Mensual") - ElseIf TAB.ActiveTabIndex = 1 AndAlso GvIngresosMesH.Rows.Count > 0 Then - ExportToExcelG(GvIngresosMesH, GvGastosMesH, TMesT1, "Reporte_Mensual_Horizontal", UsuarioActual, "Mensual Horizontal", Gv3:=GvTotalesMesH) - ElseIf TAB.ActiveTabIndex = 2 AndAlso GvIngresosAnualH.Rows.Count > 0 Then - ExportToExcelG(GvIngresosAnualH, GvGastosAnualH, TMesT1, "Reporte_Anual_Horizontal", UsuarioActual, "Anual Horizontal", Gv3:=GvTotalesAnualH) - - ElseIf TAB.ActiveTabIndex = 3 AndAlso GvIngresosSubProyectoH.Rows.Count > 0 Then - - ExportToExcelG(GvIngresosSubProyectoH, GvGastosSubProyectoH, TMesT1, "Reporte_Proyecto_Horizontal", UsuarioActual, $"Estado de Resultados Horizontal por {LblSubProyecto.Text}", Gv3:=GvTotalesSubProyectoH, EsPorSubProtyecto:=True) - - End If - - - End Sub - - 'Public Sub ExportToExcelG(Gv1 As GridView, Gv2 As GridView, NombreArchivoXLSx As String, Optional Titulo As String = "Reporte", Optional Usuario As Usuario = Nothing, Optional Filtros As String = "", Optional AlturaImagen As Double = 100, Optional AnchoImagen As Double = 100) - Public Sub ExportToExcelG(Gv1 As GridView, Gv2 As GridView, TablaResultados As HtmlTable, NombreArchivoXLSx As String, Usuario As Usuario, Titulo As String, Optional AlturaImagen As Double = 100, Optional AnchoImagen As Double = 100, Optional Gv3 As GridView = Nothing, Optional EsPorSubProtyecto As Boolean = False) - - Dim sw1 As New StringWriter() - Dim htw1 As New HtmlTextWriter(sw1) - Gv1.RenderControl(htw1) - - Dim sw2 As New StringWriter() - Dim htw2 As New HtmlTextWriter(sw2) - Gv2.RenderControl(htw2) - - - TablaResultados.Width = Gv2.Width.ToString - - Dim sw3 As New StringWriter() - Dim htw3 As New HtmlTextWriter(sw3) - TablaResultados.RenderControl(htw3) - - Dim options = GemBox.Spreadsheet.LoadOptions.HtmlDefault - - Dim htmlStream1 = New MemoryStream(options.Encoding.GetBytes(sw1.ToString())) - Dim htmlStream2 = New MemoryStream(options.Encoding.GetBytes(sw2.ToString())) - Dim htmlStream3 = New MemoryStream(options.Encoding.GetBytes(sw3.ToString())) - - htmlStream1.Position = 0 - Dim sr1 As New StreamReader(htmlStream1) - - htmlStream2.Position = 0 - Dim sr2 As New StreamReader(htmlStream2) - - htmlStream3.Position = 0 - Dim sr3 As New StreamReader(htmlStream3) - - - Dim myStr1 = sr1.ReadToEnd() - Dim myStr2 = sr2.ReadToEnd() - Dim myStr3 = sr3.ReadToEnd() - - sr1.Dispose() - sr2.Dispose() - sr3.Dispose() - - htmlStream1.Dispose() - htmlStream2.Dispose() - htmlStream3.Dispose() - - sw1.Dispose() - sw2.Dispose() - sw3.Dispose() - - If Gv3 IsNot Nothing Then - - Gv3.ShowHeader = False - - Dim sw4 As New StringWriter() - Dim htw4 As New HtmlTextWriter(sw4) - Gv3.RenderControl(htw4) - Dim htmlStream4 = New MemoryStream(options.Encoding.GetBytes(sw4.ToString())) - htmlStream4.Position = 0 - Dim sr4 As New StreamReader(htmlStream4) - myStr3 = sr4.ReadToEnd() - - sr4.Dispose() - htmlStream2.Dispose() - sw4.Dispose() - - End If - - - Dim HtmlCompleto As String = myStr1 & "
    " & myStr2 & "
    " & myStr3 - - - HtmlCompleto = Regex.Replace(HtmlCompleto, "\<[\/]*a[^\>]*\>", "") - - - Dim htmlStream5 = New MemoryStream(options.Encoding.GetBytes(HtmlCompleto)) - - GemBox.Spreadsheet.SpreadsheetInfo.SetLicense(SerialGemBoxSpreadsheet) - - Dim excel As GemBox.Spreadsheet.ExcelFile - - excel = GemBox.Spreadsheet.ExcelFile.Load(htmlStream5, options) - - If Usuario IsNot Nothing Then - - Dim TotalRowHeader As Integer = 8 - Dim TotalRowFooter As Integer = 2 - - - Dim worksheet = excel.Worksheets(0) - worksheet.Rows.InsertEmpty(0, TotalRowHeader) - Dim celdasConTexto = worksheet.GetUsedCellRange(True) - celdasConTexto.Style.Font.Name = "Calibri Light" - - Dim RangoNombreEmpresa = worksheet.Cells.GetSubrangeAbsolute(1, celdasConTexto.FirstColumnIndex, 1, celdasConTexto.LastColumnIndex) - RangoNombreEmpresa.Merged = True - RangoNombreEmpresa.Value = Usuario.Empresa.Empresa - RangoNombreEmpresa.Style.Font.Size = 18 * 20 - RangoNombreEmpresa.Style.Font.Name = "Calibri Light" - RangoNombreEmpresa.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center - RangoNombreEmpresa.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center - - - Dim RangoTitulo = worksheet.Cells.GetSubrangeAbsolute(3, celdasConTexto.FirstColumnIndex, 3, celdasConTexto.LastColumnIndex) - RangoTitulo.Merged = True - RangoTitulo.Value = Titulo - RangoTitulo.Style.Font.Size = 20 * 20 - RangoTitulo.Style.Font.Name = "Calibri Light" - RangoTitulo.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center - RangoTitulo.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center - - Dim RangoFechas = worksheet.Cells.GetSubrangeAbsolute(4, celdasConTexto.FirstColumnIndex, 4, celdasConTexto.LastColumnIndex) - RangoFechas.Merged = True - RangoFechas.Value = $"Fechas: {FechaIMes} a {FechaFMes}" - RangoFechas.Style.Font.Size = 15 * 20 - RangoFechas.Style.Font.Name = "Calibri Light" - RangoFechas.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center - RangoFechas.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center - - - If EsPorSubProtyecto And DdlSubproyecto.SelectedValue.ToEntero > 0 Then - Dim RangoSubProyecto = worksheet.Cells.GetSubrangeAbsolute(5, celdasConTexto.FirstColumnIndex, 5, celdasConTexto.LastColumnIndex) - RangoSubProyecto.Merged = True - RangoSubProyecto.Value = DdlSubproyecto.SelectedItem.Text - RangoSubProyecto.Style.Font.Size = 20 * 20 - RangoSubProyecto.Style.Font.Name = "Calibri Light" - RangoSubProyecto.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center - RangoSubProyecto.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center - End If - - For i = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex - - worksheet.Rows(8).Cells(i).Style.Font.Size = 12 * 20 - worksheet.Rows(8).Cells(i).Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center - worksheet.Rows(8).Cells(i).Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center - - worksheet.Rows(8).Cells(i).Style.FillPattern.SetPattern(GemBox.Spreadsheet.FillPatternStyle.Solid, GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190), GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)) - worksheet.Rows(8).Cells(i).Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255) - - - - If Not EsPorSubProtyecto Then - worksheet.Rows(8 + Gv1.Rows.Count + 2).Cells(i).Style.FillPattern.SetPattern(GemBox.Spreadsheet.FillPatternStyle.Solid, GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190), GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)) - worksheet.Rows(8 + Gv1.Rows.Count + 2).Cells(i).Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255) - Else - worksheet.Rows(18).Cells(i).Style.FillPattern.SetPattern(GemBox.Spreadsheet.FillPatternStyle.Solid, GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190), GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)) - worksheet.Rows(18).Cells(i).Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255) - End If - - - - If i > 0 Then - Try - worksheet.Columns(i).AutoFit(1) - Catch ex As Exception - End Try - End If - Next - - Dim IndexEndTable As Integer = Gv1.Rows.Count + Gv2.Rows.Count + 4 + TotalRowHeader + TotalRowFooter - - worksheet.Rows(IndexEndTable).Cells(0).Value = "Usuario Imprimió" - worksheet.Rows(IndexEndTable + 1).Cells(0).Value = Usuario.Nombre - - worksheet.Rows(IndexEndTable).Cells(2).Value = "Fecha Impresión" - worksheet.Rows(IndexEndTable + 1).Cells(2).Value = DateTime.Now.ToString("dd/MM/yyyy") - - Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", Usuario.Empresa.Ruta)) - - If Imagen.Exists Then - Dim Ruta As String = String.Format("{0}/Logo.png", Usuario.Empresa.Ruta) - Using sr As New StreamReader(Ruta) - Dim ms As New MemoryStream() - sr.BaseStream.CopyTo(ms) - worksheet.Pictures.Add(ms, ExcelPictureFormat.Png, "A1", AnchoImagen, AlturaImagen, LengthUnit.Pixel) - End Using - End If - - - - - - - For I = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex - - If I > 0 Then - - If DdlDivisor.SelectedValue.ToEntero = 1 Then - worksheet.Columns(I + 1).Style.NumberFormat = "#,##0.00" - Else - worksheet.Columns(I + 1).Style.NumberFormat = "#,##" - End If - - Try - worksheet.Columns(I).AutoFit(1) - Catch ex As Exception - End Try - - End If - Next - - End If - - excel.Save(HttpContext.Current.Response, $"{NombreArchivoXLSx}.xlsx") - - - End Sub - - Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control) - End Sub - -#End Region - - - - - -End Class - diff --git a/Contabilidad2/RepEstadoResultadosHorizontal.aspx.vb b/Contabilidad2/RepEstadoResultadosHorizontal.aspx.vb index 5a89787b7..ad1698125 100644 --- a/Contabilidad2/RepEstadoResultadosHorizontal.aspx.vb +++ b/Contabilidad2/RepEstadoResultadosHorizontal.aspx.vb @@ -1712,6 +1712,26 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal If ObjConta.GetEstadosSubProyectoHorizontal(FechaIMes.ToDate, FechaFMes.ToDate, CveSubProyecto, DdlDivisor.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) Then DTSubProyectosCabecerasH = ObjConta.DSResultados.Tables(0) DtDatosSubProyectoH = ObjConta.DSResultados.Tables(1).FiltraParametros("(ImporteActual <> 0 OR ImporteAcumulado <> 0)") + 'se limpian los subproyectos con importe cero + Dim IndexData As Integer = 1 + Dim ColumnasEliminar As New ArrayList + For Each dColumn As DataColumn In DtDatosSubProyectoH.Columns + 'si el nombre es numerico, s la clave del subproyecto + If dColumn.ColumnName.ToEntero > 0 Then + If DtDatosSubProyectoH.MAX(String.Format("[{0}]", dColumn.ColumnName)).ToDecimal = 0 Then + ColumnasEliminar.Add(dColumn.ColumnName) + 'DtDatosSubProyectoH.Columns.Remove(dColumn.ColumnName) + End If + End If + + Next + + If ColumnasEliminar.Count > 0 Then + For Each columna As String In ColumnasEliminar + DtDatosSubProyectoH.Columns.Remove(columna) + Next + End If + Else DtDatosSubProyectoH = Nothing Alert("Ocurrio un error al cargar los datos del Estado de Actividades", TipoMensaje.MsgError) @@ -1739,43 +1759,59 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal Dim IndexGv As Integer = 1 Dim IndexMax As Integer = 1 Dim IndexSubProyecto = 0 - Dim IndexSubProyectoMAx As Integer = DTSubProyectosCabecerasH.Rows.Count - 1 - Dim IndexTotatles As Integer = 13 + IndexSubProyectoMAx + Dim IndexSubProyectoMax As Integer = DTSubProyectosCabecerasH.Rows.Count - 1 + + + If IndexSubProyectoMAx > GvIngresosSubProyectoH.Columns.Count - 2 Then + IndexSubProyectoMAx = GvIngresosSubProyectoH.Columns.Count - 2 + End If + Dim IndexTotales As Integer = 13 + IndexSubProyectoMax + If IndexTotales > DtIngresosSubProyectoH.Columns.Count - 2 Then + IndexTotales = DtIngresosSubProyectoH.Columns.Count - 2 + End If '34 Dim IDX_LIMPIAR As Integer = 1 - For IDX_LIMPIAR = 1 To 35 + For IDX_LIMPIAR = 1 To GvIngresosSubProyectoH.Columns.Count - 2 CType(GvIngresosSubProyectoH.Columns(IDX_LIMPIAR), BoundField).DataField = Nothing CType(GvIngresosSubProyectoH.Columns(IDX_LIMPIAR), BoundField).HeaderText = "" GvIngresosSubProyectoH.Columns(IDX_LIMPIAR).Visible = False Next listaCampos.Clear() - If DtIngresosSubProyectoH.Rows.Count > 0 Then - For Each dCoumn As DataColumn In DtIngresosSubProyectoH.Columns + For Each dColumn As DataColumn In DtIngresosSubProyectoH.Columns If IndexData >= 13 Then - If IndexSubProyecto <= IndexSubProyectoMAx Then + If IndexSubProyecto <= IndexSubProyectoMax Then - CType(GvIngresosSubProyectoH.Columns(IndexGv), BoundField).DataField = dCoumn.ColumnName - GvIngresosSubProyectoH.Columns(IndexGv).Visible = True + If GvIngresosSubProyectoH.Columns(IndexGv).GetType.Name = "BoundField" Then + CType(GvIngresosSubProyectoH.Columns(IndexGv), BoundField).DataField = dColumn.ColumnName + GvIngresosSubProyectoH.Columns(IndexGv).Visible = True - CType(GvTotalesSubProyectoH.Columns(IndexGv), BoundField).DataField = dCoumn.ColumnName - GvTotalesSubProyectoH.Columns(IndexGv).Visible = True + CType(GvTotalesSubProyectoH.Columns(IndexGv), BoundField).DataField = dColumn.ColumnName + GvTotalesSubProyectoH.Columns(IndexGv).Visible = True - If IndexSubProyecto <= IndexSubProyectoMAx Then - CType(GvIngresosSubProyectoH.Columns(IndexGv), BoundField).HeaderText = DTSubProyectosCabecerasH.Rows(IndexSubProyecto)(0).ToString - CType(GvTotalesSubProyectoH.Columns(IndexGv), BoundField).HeaderText = DTSubProyectosCabecerasH.Rows(IndexSubProyecto)(0).ToString - CType(GvGastosSubProyectoH.Columns(IndexGv), BoundField).HeaderText = DTSubProyectosCabecerasH.Rows(IndexSubProyecto)(0).ToString + If IndexSubProyecto <= IndexSubProyectoMax Then + Dim TxtSub As String = GlobalDTSubProyectos(-1, CveSubProyecto:=dColumn.ColumnName.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("SubProyecto") + CType(GvIngresosSubProyectoH.Columns(IndexGv), BoundField).HeaderText = TxtSub + CType(GvTotalesSubProyectoH.Columns(IndexGv), BoundField).HeaderText = TxtSub + CType(GvGastosSubProyectoH.Columns(IndexGv), BoundField).HeaderText = TxtSub + End If + listaCampos.Add(New String() {dColumn.ColumnName.ToString(), DTSubProyectosCabecerasH.Rows(IndexSubProyecto)(0).ToString()}) End If - listaCampos.Add(New String() {dCoumn.ColumnName.ToString(), DTSubProyectosCabecerasH.Rows(IndexSubProyecto)(0).ToString()}) + Else - GvIngresosSubProyectoH.Columns(IndexGv).Visible = False - GvTotalesSubProyectoH.Columns(IndexGv).Visible = False + If IndexGv < GvIngresosSubProyectoH.Columns.Count Then + GvIngresosSubProyectoH.Columns(IndexGv).Visible = False + GvTotalesSubProyectoH.Columns(IndexGv).Visible = False + Else + Exit For + End If + End If IndexGv = IndexGv + 1 @@ -1793,8 +1829,10 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal Next IndexData = 13 - For IndexData = 13 To IndexTotatles - Row.Item(IndexData) = DtIngresosSubProyectoH.SUM($"[{DtIngresosSubProyectoH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (3,4)") + For IndexData = 13 To IndexTotales + If DtIngresosSubProyectoH.Columns(IndexData).ColumnName.ToEntero > 0 Then 'filtro solo los que tienen número + Row.Item(IndexData) = DtIngresosSubProyectoH.SUM($"[{DtIngresosSubProyectoH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (3,4)") + End If Next Row.Item("Nombre") = "TOTAL INGRESOS " @@ -1823,7 +1861,6 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal If DtGastosSubProyectoH.Rows.Count > 1 Then - IndexData = 0 IndexGv = 1 IndexMax = 0 @@ -1832,13 +1869,20 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal For Each dCoumn As DataColumn In DtIngresosSubProyectoH.Columns If IndexData >= 13 Then If IndexSubProyecto <= IndexSubProyectoMAx Then - CType(GvGastosSubProyectoH.Columns(IndexGv), BoundField).DataField = dCoumn.ColumnName - GvGastosSubProyectoH.Columns(IndexGv).Visible = True - CType(GvTotalesSubProyectoH.Columns(IndexGv), BoundField).DataField = dCoumn.ColumnName - GvTotalesSubProyectoH.Columns(IndexGv).Visible = True + If GvIngresosSubProyectoH.Columns(IndexGv).GetType.Name = "BoundField" Then + CType(GvGastosSubProyectoH.Columns(IndexGv), BoundField).DataField = dCoumn.ColumnName + GvGastosSubProyectoH.Columns(IndexGv).Visible = True + CType(GvTotalesSubProyectoH.Columns(IndexGv), BoundField).DataField = dCoumn.ColumnName + GvTotalesSubProyectoH.Columns(IndexGv).Visible = True + End If + Else - GvIngresosSubProyectoH.Columns(IndexGv).Visible = False - GvTotalesSubProyectoH.Columns(IndexGv).Visible = False + If IndexGv < DtIngresosSubProyectoH.Columns.Count AndAlso IndexGv < GvIngresosSubProyectoH.Columns.Count Then + GvIngresosSubProyectoH.Columns(IndexGv).Visible = False + GvTotalesSubProyectoH.Columns(IndexGv).Visible = False + Else + Exit For + End If End If IndexGv = IndexGv + 1 @@ -1847,16 +1891,16 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal IndexData = IndexData + 1 Next - - For Each dr As DataRow In DtGastosSubProyectoH.FiltraParametros("NOT CtaMayor in (3,4)").Rows TotalActual += dr("ImporteActual").ToString.ToDouble TotalAnterior += dr("ImporteAcumulado").ToString.ToDouble Next IndexData = 13 - For IndexData = 13 To IndexTotatles - Row.Item(IndexData) = DtGastosSubProyectoH.SUM($"[{DtIngresosSubProyectoH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (3,4)") + For IndexData = 13 To IndexTotales + If DtIngresosSubProyectoH.Columns(IndexData).ColumnName.ToEntero > 0 Then 'filtro solo los que tienen número + Row.Item(IndexData) = DtGastosSubProyectoH.SUM($"[{DtIngresosSubProyectoH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (3,4)") + End If Next Row.Item("Nombre") = "TOTAL GASTOS" @@ -1881,8 +1925,10 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal Row = DTTotalesSubProyectoH.NewRow IndexData = 13 - For IndexData = 13 To IndexTotatles - Row.Item(IndexData) = DtIngresosSubProyectoH.SUM($"[{DtIngresosSubProyectoH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (-1,3,4)") - DtGastosSubProyectoH.SUM($"[{DtGastosSubProyectoH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (-1,3,4)") + For IndexData = 13 To IndexTotales + If DtIngresosSubProyectoH.Columns(IndexData).ColumnName.ToEntero > 0 Then 'filtro solo los que tienen número + Row.Item(IndexData) = DtIngresosSubProyectoH.SUM($"[{DtIngresosSubProyectoH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (-1,3,4)") - DtGastosSubProyectoH.SUM($"[{DtGastosSubProyectoH.Columns(IndexData).ColumnName}]", "NOT CtaMayor in (-1,3,4)") + End If Next Row.Item("Nombre") = "Resultado del ejercicio" @@ -1949,19 +1995,22 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal Dim IndiceMax As Integer = 1 + CountDinamico Dim FEchaMesFinal As Date = New Date(DdlEjercicio.SelectedValue.ToEntero, DdlPeriodo.SelectedValue.ToEntero, 1).LastDayOfMonth + If IndiceMax > GvIngresosSubProyectoH.Columns.Count - 2 Then + IndiceMax = GvIngresosSubProyectoH.Columns.Count - 2 + End If For IndiceInicio = 1 To IndiceMax - Dim CveSubProyectoIntermo As String = CType(GvGastosSubProyectoH.Columns(IndiceInicio), BoundField).DataField - Dim Importe As Decimal = e.Row.Cells(IndiceInicio).Text.ToDecimal + If GvGastosSubProyectoH.Columns(IndiceInicio).GetType.Name = "BoundField" Then + Dim CveSubProyectoInterno As String = CType(GvGastosSubProyectoH.Columns(IndiceInicio), BoundField).DataField + Dim Importe As Decimal = e.Row.Cells(IndiceInicio).Text.ToDecimal + If CveSubProyectoInterno.ToEntero > 0 Then + e.Row.Cells(IndiceInicio).Text = $"{ If(DdlDivisor.SelectedValue.ToEntero > 1, Importe.ToString("###,###,##0"), Importe.ToString("###,###,###.00")) }" + End If - If CveSubProyectoIntermo.ToEntero > 0 Then - e.Row.Cells(IndiceInicio).Text = $"{ If(DdlDivisor.SelectedValue.ToEntero > 1, Importe.ToString("###,###,##0"), Importe.ToString("###,###,###.00")) }" End If - - Next IndiceInicio e.Row.FCHyperLink("HLAnterior").NavigateUrl = $"./RepAnexoCatalogoCC.aspx?CveCuenta={e.Row.DBCampo("CveCuenta").ToString}&Ejercicio={DdlEjercicio.SelectedValue}&Divisor={DdlDivisor.SelectedValue}&CveSubProyecto={DdlSubproyecto.SelectedValue}&Periodo={DdlPeriodo.SelectedValue}" @@ -1971,20 +2020,23 @@ Partial Class Contabilidad_RepEstadoResultadosHorizontal Dim CountDinamico As Integer = e.Row.DataKey("CountDinamico").ToEntero Dim IndiceInicio As Integer = 1 Dim IndiceMax As Integer = 1 + CountDinamico + If IndiceMax > GvIngresosSubProyectoH.Columns.Count - 2 Then + IndiceMax = GvIngresosSubProyectoH.Columns.Count - 2 + End If For IndiceInicio = 1 To IndiceMax - Dim Importe As Decimal = e.Row.Cells(IndiceInicio).Text.ToDecimal e.Row.Cells(IndiceInicio).Text = $"
    { If(DdlDivisor.SelectedValue.ToEntero > 1, Importe.ToString("###,###,##0"), Importe.ToString("###,###,###.00")) }
    " Next IndiceInicio - - ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = -2 Then Dim CountDinamico As Integer = e.Row.DataKey("CountDinamico").ToEntero Dim IndiceInicio As Integer = 1 Dim IndiceMax As Integer = 1 + CountDinamico + If IndiceMax > GvIngresosSubProyectoH.Columns.Count - 2 Then + IndiceMax = GvIngresosSubProyectoH.Columns.Count - 2 + End If For IndiceInicio = 1 To IndiceMax diff --git a/Contabilidad2/RepSituacionFinancieraSAT.aspx b/Contabilidad2/RepSituacionFinancieraSAT.aspx.exclude similarity index 100% rename from Contabilidad2/RepSituacionFinancieraSAT.aspx rename to Contabilidad2/RepSituacionFinancieraSAT.aspx.exclude diff --git a/Contabilidad2/RepSituacionFinancieraSAT.aspx.vb b/Contabilidad2/RepSituacionFinancieraSAT.aspx.vb.exclude similarity index 100% rename from Contabilidad2/RepSituacionFinancieraSAT.aspx.vb rename to Contabilidad2/RepSituacionFinancieraSAT.aspx.vb.exclude diff --git a/Contabilidad2/Reportes/_________________RepSituacionFinanciera.rdlc b/Contabilidad2/Reportes/_________________RepSituacionFinanciera.rdlc deleted file mode 100644 index 69f81caa8..000000000 --- a/Contabilidad2/Reportes/_________________RepSituacionFinanciera.rdlc +++ /dev/null @@ -1,3060 +0,0 @@ - - - 0 - - - - System.Data.DataSet - /* Local Connection */ - - 3560db3f-20af-4776-9f09-85925745c52f - - - - - - DataSet1 - /* Local Query */ - - - - Nombre - System.String - - - ImporteActual - System.Int16 - - - ImporteAnterior - System.Int16 - - - CtaMayor - System.Int16 - - - Orden - System.String - - - Tipo - System.String - - - Sup - System.String - - - Level - System.Int16 - - - TipoCuenta - System.Int16 - - - - DataSet1 - c:\users\caudillo\documents\visual studio 2013\Projects\WebApplication1\WebApplication1\DataSet1.xsd - ActivoCirculante - - - - - - - - - - - - - - - 5.36361cm - - - 2.86585cm - - - 2.19558cm - - - - - 0.6cm - - - - - true - true - - - - - ACTIVO CIRCULANTE - - - - - - - Textbox7 - - - 2pt - 2pt - 2pt - 2pt - - - 3 - - - - - - - - 0.45cm - - - - - true - - - - - =Fields!Nombre.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!ImporteActual.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!ImporteAnterior.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - 0.6cm - - - - - true - - - - - TOTAL ACTIVO CIRCULANTE - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Sum(Fields!ImporteActual.Value) - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Sum(Fields!ImporteAnterior.Value) - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - - - - - - - - - - - - After - true - - - - - - - - - Before - - - - DataSet1 - - - =Fields!Tipo.Value - In - - =CStr("A,B,C").Split(",") - - - - =Fields!TipoCuenta.Value - Equal - - 1 - - - - 2.6512cm - 0.31432cm - 1.65cm - 10.42504cm - - - Verdana - 8pt - - - - - - - 5.36361cm - - - 2.86585cm - - - 2.19558cm - - - - - 0.6cm - - - - - true - true - - - - - ACTIVO NO CIRCULANTE - - - - - - - Textbox7 - - - 2pt - 2pt - 2pt - 2pt - - - 3 - - - - - - - - 0.45cm - - - - - true - - - - - =Fields!Nombre.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!ImporteActual.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!ImporteAnterior.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - 0.6cm - - - - - true - true - - - - - TOTAL ACTIVO NO CIRCULANTE - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Sum(Fields!ImporteActual.Value) - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Sum( Fields!ImporteAnterior.Value) - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - - - - - - - - - - - - After - true - - - - - - Before - - - - DataSet1 - - - =Fields!Tipo.Value - In - - =CStr("A,B,C").Split(",") - - - - =Fields!TipoCuenta.Value - Equal - - 2 - - - - 4.74417cm - 0.31432cm - 1.65cm - 10.42504cm - 1 - - - Verdana - 8pt - - - - - - - 5.21467cm - - - 2.56871cm - - - 1.91058cm - - - - - 0.6cm - - - - - true - true - - - - - PASIVO CIRCULANTE - - - - - - - Textbox7 - - - 2pt - 2pt - 2pt - 2pt - - - 3 - - - - - - - - 0.45cm - - - - - true - - - - - =Fields!Nombre.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!ImporteActual.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!ImporteAnterior.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - 0.6cm - - - - - true - true - - - - - TOTAL PASIVO CIRCULANTE - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Sum(Fields!ImporteActual.Value) - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Sum(Fields!ImporteAnterior.Value) - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - - - - - - - - - - - - After - true - - - - - - Before - - - - DataSet1 - - - =Fields!Tipo.Value - Equal - - D - - - - =Fields!TipoCuenta.Value - Equal - - 3 - - - - 2.6512cm - 10.77464cm - 1.65cm - 9.69395cm - 2 - - - Verdana - 8pt - - - - - - - 5.21467cm - - - 2.56871cm - - - 1.91058cm - - - - - 0.6cm - - - - - true - true - - - - - PASIVO NO CIRCULANTE - - - - - - - Textbox7 - - - 2pt - 2pt - 2pt - 2pt - - - 3 - - - - - - - - 0.45cm - - - - - true - - - - - =Fields!Nombre.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!ImporteActual.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!ImporteAnterior.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - 0.6cm - - - - - true - true - - - - - TOTAL PASIVO NO CIRCULANTE - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Sum(Fields!ImporteActual.Value) - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Sum(Fields!ImporteAnterior.Value) - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - - - - - - - - - - - - After - true - - - - - - Before - - - - DataSet1 - - - =Fields!Tipo.Value - Equal - - D - - - - =Fields!TipoCuenta.Value - Equal - - 4 - - - - 4.74417cm - 10.77464cm - 1.65cm - 9.69395cm - 3 - - - Verdana - 8pt - - - - true - true - - - - - ACTIVO - - - - - - - Textbox28 - 1.91009cm - 0.31432cm - 0.6cm - 10.46032cm - 4 - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - PASIVO - - - - - - - Textbox28 - 1.91009cm - 10.77464cm - 0.6cm - 9.69395cm - 5 - - - 2pt - 2pt - 2pt - 2pt - - - - - - - 5.21467cm - - - 2.56871cm - - - 1.91058cm - - - - - 0.6cm - - - - - true - true - - - - - CAPITAL CONTABLE - - - - - - - Textbox7 - - - 2pt - 2pt - 2pt - 2pt - - - 3 - - - - - - - - 0.45cm - - - - - true - - - - - =Fields!Nombre.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!ImporteActual.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!ImporteAnterior.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - 0.6cm - - - - - true - true - - - - - TOTAL CAPITAL - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Sum(Fields!ImporteActual.Value) - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Sum(Fields!ImporteAnterior.Value) - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - - - - - - - - - - - - After - true - - - - - - Before - - - - DataSet1 - - - =Fields!Tipo.Value - Equal - - F - - - - =Fields!TipoCuenta.Value - In - - 5 - 6 - 7 - 8 - - - - 8.30193cm - 10.77464cm - 1.65cm - 9.69395cm - 6 - - - Verdana - 8pt - - - - true - true - - - - - CAPITAL - - - - - - - Textbox28 - 7.52554cm - 10.77464cm - 0.6cm - 9.69395cm - 7 - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Total CAPITAL - - - - - - - Textbox45 - 10.22837cm - 10.77464cm - 0.6cm - 5.21467cm - 8 - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Variables!TotalPatrimonioHAnterior.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Variables!TotalPatrimonioHActual.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Total Pasivo y Patrimonio - - - - - - - Textbox45 - 11.12267cm - 10.77464cm - 0.6cm - 5.21467cm - 11 - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Variables!TotalpasivoYHaciendaAnterior.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Variables!TotalpasivoYHaciendaActual.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Total del Pasivo: - - - - - - - Textbox45 - 6.57056cm - 10.77464cm - 0.6cm - 5.21467cm - 14 - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Variables!TotalPasivoAnterior.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Variables!TotalPasivoActual.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Iif( Round(Math.Abs(Variables!TotalActivoActual.Value-Variables!TotalpasivoYHaciendaActual.Value),2) <.005,"" ,"La suma de los totales estan descuadradas." & round(Math.Abs(Variables!TotalActivoAnterior.Value-Variables!TotalpasivoYHaciendaAnterior.Value),2)) - - - - - - 2pt - 2pt - 2pt - 2pt - - - - External - = Parameters!pImg.Value - FitProportional - 0.03141cm - 0.31432cm - 1.5cm - 5.36361cm - 18 - - - - - - true - true - - - - - =Parameters!pEmp.Value - - - - - - - Textbox1 - 0.03141cm - 5.67793cm - 0.81167cm - 10.31137cm - 19 - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Estado de Situación Financiera al - - - - =Parameters!pFechaFin.Value - - - - - - - Textbox5 - 0.89924cm - 5.67793cm - 0.6cm - 10.31137cm - 20 - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - ="Fecha Impresión:" & vbcrlf & Format( Globals!ExecutionTime,"dd/MM/yyyy") - - - - - - - Textbox8 - 0.07056cm - 15.98931cm - 0.81167cm - 4.47928cm - 21 - - - 2pt - 2pt - 2pt - 2pt - - - - - - - 5.36361cm - - - 2.86585cm - - - 2.19558cm - - - - - 0.6cm - - - - - true - true - - - - - ACTIVO DIFERIDO - - - - - - - Textbox7 - - - 2pt - 2pt - 2pt - 2pt - - - 3 - - - - - - - - 0.45cm - - - - - true - - - - - =Fields!Nombre.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!ImporteActual.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Fields!ImporteAnterior.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - 0.6cm - - - - - true - true - - - - - TOTAL ACTIVO DIFERIDO - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Sum(Fields!ImporteActual.Value) - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - =Sum(Fields!ImporteAnterior.Value) - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - - - - - - - - - - - - After - true - - - - - - Before - - - - DataSet1 - - - =Fields!TipoCuenta.Value - Equal - - 9 - - - - 6.92554cm - 0.31432cm - 1.65cm - 10.42504cm - 22 - - - Verdana - 8pt - - - - true - true - - - - - Total del Activo - - - - - - - Textbox45 - 11.12267cm - 0.31432cm - 0.6cm - 5.36361cm - 23 - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Variables!TotalActivoAnterior.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Variables!TotalActivoActual.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - 4.88706in - - - - =Parameters!pFechaFin.Value - - - - - - - Textbox5 - 3.454cm - 0.6cm - 12.91455cm - - = (Globals.PageNumber=1) - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - ="Fecha Impresión:" & vbcrlf & Format( Globals!ExecutionTime,"dd/MM/yyyy") - - - - - - - Textbox8 - 0.02088cm - 16.62517cm - 0.57912cm - 3.49249cm - 1 - - = (Globals.PageNumber=1) - - - - 2pt - 2pt - - - - - - - - - 2.46062cm - true - true - - - true - true - - - - - ="Página " & Globals.PageNumber & " de " & Globals.TotalPages - - - - - - - Textbox3 - 1.86062cm - 16.37931cm - 0.6cm - 3.95896cm - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Parameters!pFirma2.Value - - - - Textbox2 - 0.10583cm - 1.71666cm - 0.99688cm - 8.02269cm - 1 - - = Iif((Globals.PageNumber=Globals.TotalPages) and (Parameters!pFirma2.Value <> ""),false,true) - - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Parameters!pFirma1.Value - - - - Textbox2 - 1.46374cm - 6.03938cm - 0.99688cm - 8.02269cm - 2 - - = Iif((Globals.PageNumber=Globals.TotalPages) and (Parameters!pFirma1.Value <> ""),false,true) - - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - - - - - - Textbox2 - 0.10582cm - 10.37435cm - 0.99688cm - 8.02269cm - 3 - - =Microsoft.VisualBasic.Interaction.Iif((Globals!PageNumber = Globals!TotalPages) And (Parameters!pFirma1.Value <> ""), False, True) - - - - - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - 27.94cm - 21.59cm - 0.5cm - 0.5cm - 0.5cm - 0.5cm - 0.13cm - @@ -542,9 +541,9 @@ Textbox15 + - #3a4173 + White 2pt 2pt 2pt @@ -566,7 +565,6 @@ @@ -578,9 +576,9 @@ Textbox16 + - #3a4173 + White 2pt 2pt 2pt @@ -602,7 +600,6 @@ @@ -614,9 +611,9 @@ Textbox28 + - #3a4173 + White 2pt 2pt 2pt @@ -642,7 +639,6 @@ @@ -654,9 +650,9 @@ Textbox46 + - #3a4173 + White 2pt 2pt 2pt @@ -678,7 +674,6 @@ @@ -690,9 +685,9 @@ Textbox52 + - #3a4173 + White 2pt 2pt 2pt @@ -714,7 +709,6 @@ @@ -726,9 +720,9 @@ Textbox66 + - #3a4173 + White 2pt 2pt 2pt @@ -1618,7 +1612,6 @@ @@ -1633,7 +1626,6 @@ @@ -1648,7 +1640,6 @@ @@ -1659,9 +1650,8 @@ Textbox4 0.19844cm - 2.10635in 1.6616cm - 9.94376cm + 19.38791cm @@ -1670,20 +1660,6 @@ 2pt - - Embedded - Logo - FitProportional - 0.00896cm - 2.5433cm - 4.13cm - 1 - - - - - - - - - - Textbox1 - - - - Black - - 1pt - - - Black - - 1pt - - #0e2455 - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - - - - - Código - - - - - - - Textbox3 - - - - Black - - 1pt - - - Black - - 1pt - - #0e2455 - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - - - - - U.M. - - - - - - - - - - - - - - - - Textbox7 - - - - Black - - 1pt - - - Black - - 1pt - - #0e2455 - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - - - - - Descripción - - - - - - - Textbox5 - - - - Black - - 1pt - - - Black - - 1pt - - #0e2455 - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - - - - - Serie - - - - - - - Textbox8 - - - - Black - - 1pt - - - Black - - 1pt - - #0e2455 - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - Sección Almacén - - - - - - - Textbox10 - - - - Black - - 1pt - - - Black - - 1pt - - #0e2455 - 2pt - 2pt - 2pt - 2pt - - - - - - - - 0.4095cm - - - - - true - true - - - - - =Fields!Cantidad.Value - - - - - - - Cantidad - - - Bottom - 2pt - 2pt - =IIf(rownumber(nothing) = 1, "2pt", "0pt") - - - - - - - - true - true - - - - - =Fields!Codigo.Value - - - - - - - Codigo - - - Bottom - 2pt - 2pt - =IIf(rownumber(nothing) = 1, "2pt", "0pt") - - - - - - - - true - true - - - - - =Fields!UnidadMedida.Value - - - - - - - UnidadMedida - - - Bottom - 2pt - 2pt - =IIf(rownumber(nothing) = 1, "2pt", "0pt") - - - - - - - - true - true - true - - - - - =Fields!PS.Value - - - - - - - PS - - - Bottom - 2pt - 2pt - =IIf(rownumber(nothing) = 1, "2pt", "0pt") - - - - - - - - true - true - - - - - =Fields!Serie.Value - - - - - - - Serie - - - Bottom - 2pt - 2pt - =IIf(rownumber(nothing) = 1, "2pt", "0pt") - - - - - - - - true - true - - - - - - - - - - - - SeccionAlmacen - - - Bottom - 2pt - 2pt - =IIf(rownumber(nothing) = 1, "2pt", "0pt") - - - - - - - - - - - - - - - - - - - - - - After - - - - - - - DsInventarios - 0.07056cm - 0.03488cm - 0.92264cm - 20.18483cm - - - - - - true - true - - - - - - - - #0e2455 - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Observaciones: - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Parameters!Observaciones.Value - - - 2pt - 2pt - 2pt - 2pt - - - - 0.8368in - - - - - - - Textbox2 - 0.35352cm - 2.55499cm - 0.54708cm - 7.88418cm - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Parameters!Fecha.Value - - - - - - - Textbox4 - 1.53516cm - 18.54466cm - 0.59998cm - 1.76305cm - 1 - - - 2pt - 2pt - - - - true - true - - - - - Fecha - - - - : - - - - Textbox5 - 1.53514cm - 16.7949cm - 0.6cm - 1.74976cm - 2 - - - 2pt - 2pt - - - - true - true - - - - - FOLIO: - - - - =Parameters!Folio.Value - - - - - - - Textbox4 - 0.92863cm - 16.7949cm - 0.6cm - 3.51281cm - 3 - - - 2pt - 2pt - - - - true - true - - - - - =iif(Parameters!CveConcepto.Value = 8, "AVISO", "RECEPCIÓN") & " DE TRASLADO" - - - - - - - Textbox2 - 0.03603cm - 12.87736cm - 0.86458cm - 7.45584cm - 4 - - - 2pt - 2pt - 2pt - 2pt - - - - - - true - true - - - - - Facturado a: - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Parameters!FacturadoA.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Factura: - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Parameters!Factura.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - 4.08989cm - 0.00055cm - 0.98871cm - 20.21916cm - 5 - - =IIF((Parameters!CveAlmacen.Value = "10" OrElse Parameters!CveTipoAlmacenDestino.Value = "10") AND Parameters!CveVentaDetalle.Value <> "", False,True) - - - - - - - Embedded - Logo1 - FitProportional - 0.07668in - 0.86392in - 1.0059in - 6 - - - - - - true - true - - - - - Detalles del movimiento: - - - - - - - - - Almacén Origen: - - - - =Parameters!AlmacenOrigen.Value - - - - - - - - - Almacén Destino: - - - - =Parameters!AlmacenDestino.Value - - - - - - - - - - - - Textbox36 - 2.42442cm - 1.64784cm - 9.61623cm - 7 - - - 2pt - 2pt - 2pt - 2pt - - - - - - - - - 4.79072cm - true - true - - - true - true - - - - - =Parameters!ResponsableCarga.Value - - - - - - - Textbox21 - 2.49498cm - 2.91702cm - 0.50243cm - 5.79375cm - - =iif(Parameters!CveConcepto.Value = 9,true,false) - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Parameters!ResponsableRecibio.Value - - - - - - - Textbox21 - 2.49498cm - 11.63893cm - 0.50243cm - 5.78664cm - 1 - - =iif(Parameters!CveConcepto.Value = 9,true,false) - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - ___________________________ - - - - - - Firma - - - - Textbox21 - 2.80753cm - 2.92497cm - 1.2cm - 5.78664cm - 2 - - =iif(Parameters!CveConcepto.Value = 9,true,false) - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - ___________________________ - - - - - - Nombre y Firma - - - - Textbox21 - 2.80754cm - 11.63893cm - 1.2cm - 5.78664cm - 3 - - =iif(Parameters!CveConcepto.Value = 9,true,false) - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - ENVIÓ - - - - - - - Textbox22 - 0.47625cm - 2.92497cm - 0.6cm - 5.78664cm - 4 - - =iif(Parameters!CveConcepto.Value = 9,true,false) - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Parameters!Accion.Value - - - - - - - Textbox22 - 0.47625cm - 11.63893cm - 0.6cm - 5.78664cm - 5 - - =iif(Parameters!CveConcepto.Value = 9,true,false) - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =IIF(Parameters!NombreAccion.Value= "-1" ,"",Parameters!NombreAccion.Value) - - - - Textbox21 - 0.854cm - 7.26733cm - 0.63528cm - 5.78664cm - 6 - - =iif(Parameters!CveConcepto.Value = 8, True, False) - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - ___________________________ - - - - - - Nombre y Firma - - - - Textbox21 - 2.80698cm - 7.27443cm - 1.2cm - 5.78664cm - 7 - - =iif(Parameters!CveConcepto.Value = 8, True, False) - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - =Parameters!Accion.Value - - - - - - - Textbox22 - 0.47625cm - 7.27443cm - 0.6cm - 5.78664cm - 8 - - =iif(Parameters!CveConcepto.Value = 8, True, False) - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Usuario: - - - - =Parameters!UsuarioImprimio.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - Fecha Impresión: - - - - =Parameters!FechaImpresion.Value - - - - - - 2pt - 2pt - 2pt - 2pt - - - - true - true - - - - - ="Página " & Globals.PageNumber & " de " & Globals.TotalPages - - - - - - - Textbox35 - 4.37091cm - 17.71971cm - 0.41981cm - 2.5cm - 11 - - - 2pt - 2pt - 2pt - 2pt - - - - 4.19452cm - 0.05952cm - 0cm - 20.27015cm - 12 - - - - - - - - - - 25cm - 21.59cm - 0.5cm - 0.5cm - 0.5cm - 0.5cm - 0.13cm - + + + + + + Textbox1 + + + + Black + + 1pt + + + Black + + 1pt + + #0e2455 + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + + + + + Código + + + + + + + Textbox3 + + + + Black + + 1pt + + + Black + + 1pt + + #0e2455 + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + + + + + U.M. + + + + + + + + + + + + + + + + Textbox7 + + + + Black + + 1pt + + + Black + + 1pt + + #0e2455 + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + + + + + Descripción + + + + + + + Textbox5 + + + + Black + + 1pt + + + Black + + 1pt + + #0e2455 + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + + + + + Serie + + + + + + + Textbox8 + + + + Black + + 1pt + + + Black + + 1pt + + #0e2455 + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Sección Almacén + + + + + + + Textbox10 + + + + Black + + 1pt + + + Black + + 1pt + + #0e2455 + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.4095cm + + + + + true + true + + + + + =Fields!Cantidad.Value + + + + + + + Cantidad + + + Bottom + 2pt + 2pt + =IIf(rownumber(nothing) = 1, "2pt", "0pt") + + + + + + + + true + true + + + + + =Fields!Codigo.Value + + + + + + + Codigo + + + Bottom + 2pt + 2pt + =IIf(rownumber(nothing) = 1, "2pt", "0pt") + + + + + + + + true + true + + + + + =Fields!UnidadMedida.Value + + + + + + + UnidadMedida + + + Bottom + 2pt + 2pt + =IIf(rownumber(nothing) = 1, "2pt", "0pt") + + + + + + + + true + true + true + + + + + =Fields!PS.Value + + + + + + + PS + + + Bottom + 2pt + 2pt + =IIf(rownumber(nothing) = 1, "2pt", "0pt") + + + + + + + + true + true + + + + + =Fields!Serie.Value + + + + + + + Serie + + + Bottom + 2pt + 2pt + =IIf(rownumber(nothing) = 1, "2pt", "0pt") + + + + + + + + true + true + + + + + + + + + + + + SeccionAlmacen + + + Bottom + 2pt + 2pt + =IIf(rownumber(nothing) = 1, "2pt", "0pt") + + + + + + + + + + + + + + + + + + + + + + After + + + + + + + DsInventarios + 0.07056cm + 0.03488cm + 0.92264cm + 20.18483cm + + + + + + true + true + + + + + + + + #0e2455 + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Observaciones: + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!Observaciones.Value + + + 2pt + 2pt + 2pt + 2pt + + + + 0.8368in + + + + + + + Textbox2 + 0.35352cm + 2.55499cm + 0.54708cm + 7.88418cm + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!Fecha.Value + + + + + + + Textbox4 + 1.53516cm + 18.54466cm + 0.59998cm + 1.76305cm + 1 + + + 2pt + 2pt + + + + true + true + + + + + Fecha + + + + : + + + + Textbox5 + 1.53514cm + 16.7949cm + 0.6cm + 1.74976cm + 2 + + + 2pt + 2pt + + + + true + true + + + + + FOLIO: + + + + =Parameters!Folio.Value + + + + + + + Textbox4 + 0.92863cm + 16.7949cm + 0.6cm + 3.51281cm + 3 + + + 2pt + 2pt + + + + true + true + + + + + =iif(Parameters!CveConcepto.Value = 8, "AVISO", "RECEPCIÓN") & " DE TRASLADO" + + + + + + + Textbox2 + 0.03603cm + 12.87736cm + 0.86458cm + 7.45584cm + 4 + + + 2pt + 2pt + 2pt + 2pt + + + + + + true + true + + + + + Facturado a: + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!FacturadoA.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Factura: + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!Factura.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + 4.08989cm + 0.00055cm + 0.98871cm + 20.21916cm + 5 + + =IIF((Parameters!CveAlmacen.Value = "10" OrElse Parameters!CveTipoAlmacenDestino.Value = "10") AND Parameters!CveVentaDetalle.Value <> "", False,True) + + + + + + + Embedded + Logo1 + FitProportional + 0.07668in + 0.86392in + 1.0059in + 6 + + + + + + true + true + + + + + Detalles del movimiento: + + + + + + + + + Almacén Origen: + + + + =Parameters!AlmacenOrigen.Value + + + + + + + + + Almacén Destino: + + + + =Parameters!AlmacenDestino.Value + + + + + + + + + + + + Textbox36 + 2.42442cm + 1.64784cm + 9.61623cm + 7 + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + 4.79072cm + true + true + + + true + true + + + + + =Parameters!ResponsableCarga.Value + + + + + + + Textbox21 + 2.49498cm + 2.91702cm + 0.50243cm + 5.79375cm + + =iif(Parameters!CveConcepto.Value = 9,true,false) + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!ResponsableRecibio.Value + + + + + + + Textbox21 + 2.49498cm + 11.63893cm + 0.50243cm + 5.78664cm + 1 + + =iif(Parameters!CveConcepto.Value = 9,true,false) + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + ___________________________ + + + + + + Firma + + + + Textbox21 + 2.80753cm + 2.92497cm + 1.2cm + 5.78664cm + 2 + + =iif(Parameters!CveConcepto.Value = 9,true,false) + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + ___________________________ + + + + + + Nombre y Firma + + + + Textbox21 + 2.80754cm + 11.63893cm + 1.2cm + 5.78664cm + 3 + + =iif(Parameters!CveConcepto.Value = 9,true,false) + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + ENVIÓ + + + + + + + Textbox22 + 0.47625cm + 2.92497cm + 0.6cm + 5.78664cm + 4 + + =iif(Parameters!CveConcepto.Value = 9,true,false) + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!Accion.Value + + + + + + + Textbox22 + 0.47625cm + 11.63893cm + 0.6cm + 5.78664cm + 5 + + =iif(Parameters!CveConcepto.Value = 9,true,false) + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =IIF(Parameters!NombreAccion.Value= "-1" ,"",Parameters!NombreAccion.Value) + + + + Textbox21 + 0.854cm + 7.26733cm + 0.63528cm + 5.78664cm + 6 + + =iif(Parameters!CveConcepto.Value = 8, True, False) + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + ___________________________ + + + + + + Nombre y Firma + + + + Textbox21 + 2.80698cm + 7.27443cm + 1.2cm + 5.78664cm + 7 + + =iif(Parameters!CveConcepto.Value = 8, True, False) + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + =Parameters!Accion.Value + + + + + + + Textbox22 + 0.47625cm + 7.27443cm + 0.6cm + 5.78664cm + 8 + + =iif(Parameters!CveConcepto.Value = 8, True, False) + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Usuario: + + + + =Parameters!UsuarioImprimio.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Fecha Impresión: + + + + =Parameters!FechaImpresion.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + ="Página " & Globals.PageNumber & " de " & Globals.TotalPages + + + + + + + Textbox35 + 4.37091cm + 17.71971cm + 0.41981cm + 2.5cm + 11 + + + 2pt + 2pt + 2pt + 2pt + + + + 4.19452cm + 0.05952cm + 0cm + 20.27015cm + 12 + + + + + + + + + + 25cm + 21.59cm + 0.5cm + 0.5cm + 0.5cm + 0.5cm + 0.13cm + + + + Reporte SAT + + + + + + + + + + + +
    +
    +
    +
    + + + + + +
    +
    + + + + + +
    +
    + +
    +
    + + + + + +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + + + diff --git a/Nomina/NomTimbrados.aspx.cs b/Nomina/NomTimbrados.aspx.cs new file mode 100644 index 000000000..b43e87d9f --- /dev/null +++ b/Nomina/NomTimbrados.aspx.cs @@ -0,0 +1,667 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Data; +using Extensiones; +using System.Xml; + +public partial class Nomina_NomTimbrados : ClsPaginas +{ + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + TxtRpdFechaInicio.Text = string.Format(" {0:dd/MM/yyyy}", DateTime.Now.AddMonths(-1).FirstDayOfMonth()); + TxtRpdFechaFin.Text = string.Format(" {0:dd/MM/yyyy}", DateTime.Now.AddMonths(-1).LastDayOfMonth()); + // readTimbres(); + } + } + public DataTable initxmldatatable() + { + DataTable dt = new DataTable(); + dt.Columns.Add("NOMBREReceptor", typeof(String)); + dt.Columns.Add("nrnumseguridadsocial", typeof(String)); + dt.Columns.Add("RFCReceptor", typeof(String)); + dt.Columns.Add("nrcurp", typeof(String)); + dt.Columns.Add("nrnumempleado", typeof(String)); + dt.Columns.Add("SERIE", typeof(String)); + dt.Columns.Add("FOLIO", typeof(String)); + dt.Columns.Add("TIPODECOMPROBANTE", typeof(String)); + dt.Columns.Add("TOTAL", typeof(decimal)); + dt.Columns.Add("SUBTOTAL", typeof(decimal)); + dt.Columns.Add("DESCUENTO", typeof(decimal)); + dt.Columns.Add("RFCEmisor", typeof(String)); + /*I nomina12:nomina*/ + dt.Columns.Add("tiponomina", typeof(String)); + dt.Columns.Add("fechapago", typeof(DateTime)); + dt.Columns.Add("fechainicialpago", typeof(DateTime)); + dt.Columns.Add("fechafinalpago", typeof(DateTime)); + dt.Columns.Add("numdiaspagados", typeof(Int32)); + dt.Columns.Add("totalpercepciones", typeof(decimal)); + dt.Columns.Add("totaldeducciones", typeof(decimal)); + dt.Columns.Add("totalotrospagos", typeof(decimal)); + /*E nomina12:nomina*/ + + /*I nomina12:emisor*/ + dt.Columns.Add("registropatronal", typeof(String)); + dt.Columns.Add("rfcpatronorigen", typeof(String)); + /*E nomina12:emisor*/ + + /*I nomina12:receptor*/ + dt.Columns.Add("nrfechainiciorellaboral", typeof(DateTime)); + dt.Columns.Add("nrantiguedad", typeof(String));//antigüedad + dt.Columns.Add("nrtipocontrato", typeof(String)); + dt.Columns.Add("nrsindicalizado", typeof(String)); + dt.Columns.Add("nrtipojornada", typeof(String)); + dt.Columns.Add("nrtiporegimen", typeof(String)); + dt.Columns.Add("nrdepartamento", typeof(String)); + dt.Columns.Add("nrpuesto", typeof(String)); + dt.Columns.Add("nrriesgopuesto", typeof(String)); + dt.Columns.Add("nrperiodicidadpago", typeof(String)); + dt.Columns.Add("nrbanco", typeof(String)); + dt.Columns.Add("nrcuentabancaria", typeof(String)); + dt.Columns.Add("nrsalariobasecotapor", typeof(decimal)); + dt.Columns.Add("nrsalariodiariointegrado", typeof(decimal)); + dt.Columns.Add("nrclaveentfed", typeof(String)); + /*E nomina12:receptor*/ + + /*I nomina12:percepciones*/ + dt.Columns.Add("totalsueldos", typeof(decimal)); + dt.Columns.Add("totalgravado", typeof(decimal)); + dt.Columns.Add("totalexento", typeof(decimal)); + /*E nomina12:percepciones*/ + + /*I nomina12:deducciones*/ + dt.Columns.Add("totalotrasdeducciones", typeof(decimal)); + dt.Columns.Add("totalimpuestosretenidos", typeof(decimal)); + /*E nomina12:deducciones*/ + + + dt.Columns.Add("uuid", typeof(String)); + dt.Columns.Add("fechatimbrado", typeof(DateTime)); + /*I nomina12:otrospagos*/ + //dt.Columns.Add("", typeof(decimal)); + /*E nomina12:otrospagos*/ + + return dt; + } + public string readTimbres() + { + string ruta = string.Format("{0}XML\\Nomina\\", UsuarioActual.Empresa.Ruta); + + string keyComprobante = "cfdi:Comprobante"; + string keyCfdiRelacionados = "cfdi:CfdiRelacionados".ToUpper(); + string keyEmisor = "cfdi:Emisor".ToUpper(); + string keyReceptor = "cfdi:Receptor".ToUpper(); + string keyConceptos = "cfdi:Conceptos".ToUpper(); + string keyImpuestos = "cfdi:Impuestos".ToUpper(); + string keyComplemento = "cfdi:Complemento".ToUpper(); + string[] PrimerNivel = new string[] { keyCfdiRelacionados, keyEmisor, keyReceptor, keyConceptos, keyImpuestos, keyComplemento }; + XmlReaderSettings settings = new XmlReaderSettings(); + settings.ConformanceLevel = ConformanceLevel.Fragment; + settings.IgnoreWhitespace = true; + settings.IgnoreComments = true; + DataTable dt = initxmldatatable(); + foreach (string txtName in System.IO.Directory.GetFiles(ruta, "*.xml")) + { + DataRow drow = dt.NewRow(); + bool canread = true; + using (XmlReader xtr = XmlReader.Create(txtName, settings)) + { + while (canread = xtr.Read()) + { + + if (xtr.NodeType == XmlNodeType.Element && xtr.Name.ToUpper() == keyComprobante.ToUpper()) + { + int Nivel = xtr.Depth; + bool cont = xtr.MoveToFirstAttribute(); + while (cont) + { + switch (xtr.Name.ToUpper()) + { + case "SERIE": drow["SERIE"] = xtr.Value; break; + case "FOLIO": drow["FOLIO"] = xtr.Value; break; + case "SUBTOTAL": drow["SUBTOTAL"] = xtr.Value; break; + case "TOTAL": drow["TOTAL"] = xtr.Value; break; + case "DESCUENTO": drow["DESCUENTO"] = xtr.Value; break; + case "TIPODECOMPROBANTE": drow["TIPODECOMPROBANTE"] = xtr.Value; break; + } + switch (xtr.Name.ToUpper()) + { + //case "XMLNS:CFDI": xmlCFDI.comprobante.xmlns_cfdi = xtr.Value; break; + //case "XMLNS:XSI": xmlCFDI.comprobante.xmlns_xsi = xtr.Value; break; + //case "XSI:SCHEMALOCATION": xmlCFDI.comprobante.xsi_schemaLocation = xtr.Value; break; + //case "VERSION": xmlCFDI.comprobante.Version = xtr.Value; break; + //case "SERIE": xmlCFDI.comprobante.Serie = xtr.Value; break; + //case "FOLIO": xmlCFDI.comprobante.Folio = xtr.Value; break; + //case "FECHA": xmlCFDI.comprobante.Fecha = xtr.Value; break; + //case "MONEDA": xmlCFDI.comprobante.Moneda = xtr.Value; break; + //case "SUBTOTAL": decimal SubTotal = 0; decimal.TryParse(xtr.Value, out SubTotal); xmlCFDI.comprobante.SubTotal = SubTotal; break; + //case "TOTAL": decimal Total = 0; decimal.TryParse(xtr.Value, out Total); xmlCFDI.comprobante.Total = Total; break; + //case "DESCUENTO": decimal Descuento = 0; decimal.TryParse(xtr.Value, out Descuento); xmlCFDI.comprobante.Descuento = Descuento; break; + //case "TIPOCAMBIO": decimal TipoCambio = 0; decimal.TryParse(xtr.Value, out TipoCambio); xmlCFDI.comprobante.TipoCambio = TipoCambio; break; + //case "TIPODECOMPROBANTE": xmlCFDI.comprobante.TipoDeComprobante = xtr.Value; break; + //case "FORMAPAGO": xmlCFDI.comprobante.FormaPago = xtr.Value; break; + //case "FORMADEPAGO": xmlCFDI.comprobante.FormaPago = xtr.Value; break; + //case "METODOPAGO": xmlCFDI.comprobante.MetodoPago = xtr.Value; break; + //case "METODODEPAGO": xmlCFDI.comprobante.MetodoPago = xtr.Value; break; + //case "CONDICIONESDEPAGO": xmlCFDI.comprobante.CondicionesDePago = xtr.Value; break; + //case "LUGAREXPEDICION": xmlCFDI.comprobante.LugarExpedicion = xtr.Value; break; + //case "CONFIRMACION": xmlCFDI.comprobante.Confirmacion = xtr.Value; break; + //case "NOCERTIFICADO": xmlCFDI.comprobante.NoCertificado = xtr.Value; break; + //case "SELLO": xmlCFDI.comprobante.Sello = xtr.Value; break; + //case "CERTIFICADO": xmlCFDI.comprobante.Certificado = xtr.Value; break; + } + cont = xtr.MoveToNextAttribute(); + } + cont = xtr.MoveToFirstAttribute(); + + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + while (canread && xtr.Depth > Nivel) + { + if (PrimerNivel.Contains(xtr.Name.ToUpper())) + { + if (xtr.NodeType == XmlNodeType.Element && xtr.Name == keyCfdiRelacionados) + { + int cDepth = xtr.Depth; + + string TipoRelacion = null; + cont = xtr.MoveToFirstAttribute(); + while (cont) + { + switch (xtr.Name.ToUpper()) + { + case "TIPORELACION": TipoRelacion = xtr.Value; break; + } + cont = xtr.MoveToNextAttribute(); + } + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + while (canread && xtr.Depth > cDepth) + { + //if (xtr.Name == "cfdi:CfdiRelacionado") + //{ + // CFDIRelacionado cfdir = new CFDIRelacionado(); + // cfdir.TipoRelacion = TipoRelacion; + // cfdir.UUID = xtr.GetAttribute("UUID"); + // xmlCFDI.cFDIRelacionados.Add(cfdir); + //} + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + } + + } + if (xtr.NodeType == XmlNodeType.Element && xtr.Name.ToUpper() == keyEmisor.ToUpper()) + { + + + int curentNivel = xtr.Depth; + cont = xtr.MoveToFirstAttribute(); + while (cont) + { + switch (xtr.Name.ToUpper()) + { + //case "REGIMENFISCAL": xmlCFDI.emisor.RegimenFiscal = xtr.Value; break; + //case "NOMBRE": xmlCFDI.emisor.Nombre = xtr.Value; break; + case "RFC": drow["RFCEmisor"] = xtr.Value; break; + } + cont = xtr.MoveToNextAttribute(); + } + while ((canread = xtr.Read()) && !(xtr.NodeType == XmlNodeType.Element && curentNivel >= xtr.Depth)) { }//continua hasta que no tenga nodos y (el nodo sea tipo elemnto y ete en el mismo nivel) + } + if (xtr.NodeType == XmlNodeType.Element && xtr.Name.ToUpper() == keyReceptor.ToUpper()) + { + int curentNivel = xtr.Depth; + cont = xtr.MoveToFirstAttribute(); + while (cont) + { + switch (xtr.Name.ToUpper()) + { + case "RFC": drow["RFCReceptor"] = xtr.Value; break; + case "NOMBRE": drow["NOMBREReceptor"] = xtr.Value; break; + //case "RESIDENCIAFISCAL": xmlCFDI.receptor.ResidenciaFiscal = xtr.Value; break; + //case "NUMREGIDTRIB": xmlCFDI.receptor.NumRegIdTrib = xtr.Value; break; + //case "USOCFDI": xmlCFDI.receptor.UsoCFDI = xtr.Value; break; + } + cont = xtr.MoveToNextAttribute(); + } + + while ((canread = xtr.Read()) && !(xtr.NodeType == XmlNodeType.Element && curentNivel >= xtr.Depth)) { }//continua hasta que no tenga nodos y (el nodo sea tipo elemnto y ete en el mismo nivel) + } + if (xtr.NodeType == XmlNodeType.Element && xtr.Name.ToUpper() == keyConceptos.ToUpper()) + { + int cDepth = xtr.Depth; + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + while (canread && xtr.Depth > cDepth) + { + if (xtr.Name == "cfdi:Concepto") + { + int cDepthb = xtr.Depth; + //CFDIConcepto concepto = new CFDIConcepto(); + + cont = xtr.MoveToFirstAttribute(); + while (cont) + { + switch (xtr.Name.ToUpper()) + { + //case "CLAVEPRODSERV": concepto.ClaveProdServ = xtr.Value; break; + //case "NOIDENTIFICACION": concepto.NoIdentificacion = xtr.Value; break; + //case "CANTIDAD": concepto.Cantidad = xtr.Value; break; + //case "CLAVEUNIDAD": concepto.ClaveUnidad = xtr.Value; break; + //case "UNIDAD": concepto.Unidad = xtr.Value; break; + //case "VALORUNITARIO": decimal ValorUnitario = 0; decimal.TryParse(xtr.Value, out ValorUnitario); concepto.ValorUnitario = ValorUnitario; ; break; + //case "IMPORTE": decimal Importe = 0; decimal.TryParse(xtr.Value, out Importe); concepto.Importe = Importe; ; break; + //case "DESCUENTO": decimal DDescuento = 0; decimal.TryParse(xtr.Value, out DDescuento); concepto.Descuento = DDescuento; ; break; + //case "DESCRIPCION": concepto.Descripcion = xtr.Value; break; + } + cont = xtr.MoveToNextAttribute(); + } + xtr.MoveToFirstAttribute(); + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + while (canread && xtr.Depth > cDepthb) + { + if (xtr.NodeType == XmlNodeType.Element && xtr.Name == "cfdi:Impuestos") + { + int cDepthc = xtr.Depth; + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + while (canread && xtr.Depth > cDepthc) + { + if (xtr.Name == "cfdi:Traslado" || xtr.Name == "cfdi:Retencion") + { + //CFDIConceptoImpuesto impuesto = new CFDIConceptoImpuesto(); + //impuesto.Impuesto = xtr.GetAttribute("Impuesto"); + //impuesto.Tipo = xtr.LocalName; + //decimal Base = 0; + //decimal.TryParse(xtr.GetAttribute("Base"), out Base); + //impuesto.Base = Base; + //impuesto.TipoFactor = xtr.GetAttribute("TipoFactor"); + //decimal tasaOCuota = 0; + //decimal.TryParse(xtr.GetAttribute("TasaOCuota"), out tasaOCuota); + //impuesto.TasaOCuota = impuesto.TipoFactor == "Tasa" ? (tasaOCuota * 100).ToString("N4") : xtr.GetAttribute("TasaOCuota"); + //decimal ImImporte = 0; + //decimal.TryParse(xtr.GetAttribute("Importe"), out ImImporte); + //impuesto.Importe = ImImporte; + + //concepto.Impuestos.Add(impuesto); + } + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + + } + } + else + { + bool rednew = true; + if (xtr.NodeType == XmlNodeType.Element && xtr.Name == "cfdi:InformacionAduanera") + { + //concepto.NumeroPedimento = xtr.GetAttribute("NumeroPedimento"); + rednew = false; while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + } + if (xtr.NodeType == XmlNodeType.Element && xtr.Name == "cfdi:CuentaPredial") + { + //concepto.CuentaPredial = xtr.GetAttribute("CuentaPredial"); + rednew = false; while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + } + if (rednew) { while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } } + + } + } + + //xmlCFDI.conceptos.Add(concepto); + } + } + } + if (xtr.NodeType == XmlNodeType.Element && xtr.Name.ToUpper() == keyImpuestos.ToUpper()) + { + int cDepth = xtr.Depth; + + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + while (canread && xtr.Depth > cDepth) + { + //CFDIImpuesto impuest = new CFDIImpuesto(); + //if (xtr.Name == "cfdi:Traslado" || xtr.Name == "cfdi:Retencion" && xmlCFDI.comprobante.Version != null) + //{ + // impuest.Tipo = xtr.LocalName == "Traslado" ? "Traslados" : (xtr.LocalName == "Retencion" ? "Retenciones" : ""); + // impuest.Impuesto = xmlCFDI.comprobante.Version == "3.3" ? xtr.GetAttribute("Impuesto") : xtr.GetAttribute("impuesto"); + // impuest.TipoFactor = xtr.GetAttribute("TipoFactor"); + // impuest.TasaOCuota = xmlCFDI.comprobante.Version == "3.3" ? xtr.GetAttribute("TasaOCuota") : xtr.GetAttribute("tasa"); + // decimal ImImporte = 0; + // decimal.TryParse((xmlCFDI.comprobante.Version == "3.3" ? xtr.GetAttribute("Importe") : xtr.GetAttribute("importe")), out ImImporte); + // impuest.Importe = ImImporte; + // xmlCFDI.Impuestos.Add(impuest); + //} + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + + } + } + if (xtr.NodeType == XmlNodeType.Element && xtr.Name.ToUpper() == keyComplemento.ToUpper()) + { + int cDepth = xtr.Depth; + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + while (canread && xtr.Depth > cDepth) + { + //string version = xmlCFDI.comprobante.Version != null ? xmlCFDI.comprobante.Version : ""; + if (xtr.NodeType == XmlNodeType.Element && xtr.LocalName.ToUpper() == "TimbreFiscalDigital".ToUpper()) + { + + cont = xtr.MoveToFirstAttribute(); + while (cont) + { + switch (xtr.Name.ToUpper()) + { + case "UUID": drow["uuid"] = xtr.Value; break; + case "FECHATIMBRADO": drow["fechatimbrado"] = xtr.Value; break; + } + cont = xtr.MoveToNextAttribute(); + } + xtr.MoveToFirstAttribute(); + //xmlCFDI.complemento.xmlns_tfd = xtr.GetAttribute("xmlns:tfd"); + //xmlCFDI.complemento.xsi_schemaLocation = xtr.GetAttribute("xsi:schemaLocation"); + //xmlCFDI.complemento.Version = xtr.GetAttribute("Version"); + //xmlCFDI.complemento.UUID = xtr.GetAttribute("UUID"); + //xmlCFDI.complemento.FechaTimbrado = xtr.GetAttribute("FechaTimbrado"); + //xmlCFDI.complemento.RfcProvCertif = xtr.GetAttribute("RfcProvCertif"); + //xmlCFDI.complemento.SelloCFD = version == "3.3" ? xtr.GetAttribute("SelloCFD") : xtr.GetAttribute("selloCFD"); + //xmlCFDI.complemento.NoCertificadoSAT = version == "3.3" ? xtr.GetAttribute("NoCertificadoSAT") : xtr.GetAttribute("noCertificadoSAT"); + //xmlCFDI.complemento.SelloSAT = version == "3.3" ? xtr.GetAttribute("SelloSAT") : xtr.GetAttribute("selloSAT"); + + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + } + else if (xtr.NodeType == XmlNodeType.Element && xtr.LocalName == "Pagos") + { + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + //xmlCFDI.complemento.Pagos = new CFDIPago(); + int depthpagos = xtr.Depth; + bool conts = xtr.MoveToFirstAttribute(); + while (conts) + { + + decimal Base = 0; + switch (xtr.Name.ToUpper()) + { + //case "FECHAPAGO": xmlCFDI.complemento.Pagos.FechaPago = xtr.Value; break; + //case "FORMADEPAGOP": xmlCFDI.complemento.Pagos.FormaDePagoP = xtr.Value; break; + //case "FORMADEPAGOPTEXT": xmlCFDI.complemento.Pagos.FormaDePagoPText = xtr.Value; break; + //case "MONEDAP": xmlCFDI.complemento.Pagos.MonedaP = xtr.Value; break; + //case "MONTO": decimal.TryParse(xtr.Value, out Base); xmlCFDI.complemento.Pagos.Monto = Base; break; + //case "TIPOCAMBIOP": decimal.TryParse(xtr.Value, out Base); xmlCFDI.complemento.Pagos.TipoCambioP = Base; break; + //case "NUMOPERACION": xmlCFDI.complemento.Pagos.NumOperacion = xtr.Value; break; + //case "NOMBANCOORDEXT": xmlCFDI.complemento.Pagos.NomBancoOrdExt = xtr.Value; break; + //case "RFCEMISORCTAORD": xmlCFDI.complemento.Pagos.RfcEmisorCtaOrd = xtr.Value; break; + //case "CTAORDENANTE": xmlCFDI.complemento.Pagos.CtaOrdenante = xtr.Value; break; + //case "RFCEMISORCTABEN": xmlCFDI.complemento.Pagos.RfcEmisorCtaBen = xtr.Value; break; + //case "CTABENEFICIARIO": xmlCFDI.complemento.Pagos.CtaBeneficiario = xtr.Value; break; + } + conts = xtr.MoveToNextAttribute(); + } + conts = xtr.MoveToFirstAttribute(); + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + while (canread && xtr.Depth > depthpagos) + { + //CFDIPagoDoctoRelacionado objpago = new CFDIPagoDoctoRelacionado(); + conts = xtr.MoveToFirstAttribute(); + while (conts) + { + + decimal Basep = 0; + switch (xtr.Name.ToUpper()) + { + //case "IDDOCUMENTO": objpago.IdDocumento = xtr.Value; break; + //case "SERIE": objpago.Serie = xtr.Value; break; + //case "FOLIO": objpago.Folio = xtr.Value; break; + //case "MONEDADR": objpago.MonedaDR = xtr.Value; break; + //case "METODODEPAGODR": objpago.MetodoDePagoDR = xtr.Value; break; + //case "NUMPARCIALIDAD": objpago.NumParcialidad = xtr.Value; break; + //case "IMPSALDOANT": decimal.TryParse(xtr.Value, out Basep); objpago.ImpSaldoAnt = Basep; break; + //case "IMPPAGADO": decimal.TryParse(xtr.Value, out Basep); objpago.ImpPagado = Basep; break; + //case "IMPSALDOINSOLUTO": decimal.TryParse(xtr.Value, out Basep); objpago.ImpSaldoInsoluto = Basep; break; + + } + conts = xtr.MoveToNextAttribute(); + } + conts = xtr.MoveToFirstAttribute(); + //xmlCFDI.complemento.Pagos.doctosRelacionados.Add(objpago); + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + } + } + else if (xtr.NodeType == XmlNodeType.Element && xtr.Name.ToUpper() == "nomina12:Nomina".ToUpper()) + { + cont = xtr.MoveToFirstAttribute(); + while (cont) + { + switch (xtr.Name.ToUpper()) + { + case "TIPONOMINA": drow["tiponomina"] = xtr.Value; break; + case "FECHAPAGO": drow["fechapago"] = xtr.Value; break; + case "FECHAINICIALPAGO": drow["fechainicialpago"] = xtr.Value; break; + case "FECHAFINALPAGO": drow["fechafinalpago"] = xtr.Value; break; + case "NUMDIASPAGADOS": drow["numdiaspagados"] = xtr.Value; break; + case "TOTALPERCEPCIONES": drow["totalpercepciones"] = xtr.Value; break; + case "TOTALDEDUCCIONES": drow["totaldeducciones"] = xtr.Value; break; + case "TOTALOTROSPAGOS": drow["totalotrospagos"] = xtr.Value; break; + } + cont = xtr.MoveToNextAttribute(); + } + xtr.MoveToFirstAttribute(); + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + } + else if (xtr.NodeType == XmlNodeType.Element && xtr.Name.ToUpper() == "nomina12:emisor".ToUpper()) + { + cont = xtr.MoveToFirstAttribute(); + while (cont) + { + switch (xtr.Name.ToUpper()) + { + case "REGISTROPATRONAL": drow["registropatronal"] = xtr.Value; break; + case "RFCPATRONORIGEN": drow["rfcpatronorigen"] = xtr.Value; break; + } + cont = xtr.MoveToNextAttribute(); + } + xtr.MoveToFirstAttribute(); + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + } + else if (xtr.NodeType == XmlNodeType.Element && xtr.Name.ToUpper() == "nomina12:Receptor".ToUpper()) + { + + cont = xtr.MoveToFirstAttribute(); + while (cont) + { + switch (xtr.Name.ToUpper()) + { + case "CURP": drow["nrcurp"] = xtr.Value; break; + case "NUMSEGURIDADSOCIAL": drow["nrnumseguridadsocial"] = xtr.Value; break; + case "FECHAINICIORELLABORAL": drow["nrfechainiciorellaboral"] = xtr.Value; break; + case "ANTIGÜEDAD": drow["nrantiguedad"] = xtr.Value; break; + case "TIPOCONTRATO": drow["nrtipocontrato"] = xtr.Value; break; + case "SINDICALIZADO": drow["nrsindicalizado"] = xtr.Value; break; + case "TIPOJORNADA": drow["nrtipojornada"] = xtr.Value; break; + case "TIPOREGIMEN": drow["nrtiporegimen"] = xtr.Value; break; + case "NUMEMPLEADO": drow["nrnumempleado"] = xtr.Value; break; + case "DEPARTAMENTO": drow["nrdepartamento"] = xtr.Value; break; + case "PUESTO": drow["nrpuesto"] = xtr.Value; break; + case "RIESGOPUESTO": drow["nrriesgopuesto"] = xtr.Value; break; + case "PERIODICIDADPAGO": drow["nrperiodicidadpago"] = xtr.Value; break; + case "BANCO": drow["nrbanco"] = xtr.Value; break; + case "CUENTABANCARIA": drow["nrcuentabancaria"] = xtr.Value; break; + case "SALARIOBASECOTAPOR": drow["nrsalariobasecotapor"] = xtr.Value; break; + case "SALARIODIARIOINTEGRADO": drow["nrsalariodiariointegrado"] = xtr.Value; break; + case "CLAVEENTFED": drow["nrclaveentfed"] = xtr.Value; break; + case "": drow[""] = xtr.Value; break; + } + cont = xtr.MoveToNextAttribute(); + } + xtr.MoveToFirstAttribute(); + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + + } + else if (xtr.NodeType == XmlNodeType.Element && xtr.Name == "nomina12:Percepciones") + { + cont = xtr.MoveToFirstAttribute(); + while (cont) + { + switch (xtr.Name.ToUpper()) + { + case "TOTALSUELDOS": drow["totalsueldos"] = xtr.Value; break; + case "TOTALGRAVADO": drow["totalgravado"] = xtr.Value; break; + case "TOTALEXENTO": drow["totalexento"] = xtr.Value; break; + } + cont = xtr.MoveToNextAttribute(); + } + xtr.MoveToFirstAttribute(); + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + } + else if (xtr.NodeType == XmlNodeType.Element && xtr.Name == "nomina12:Percepcion") + { + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + } + else if (xtr.NodeType == XmlNodeType.Element && xtr.Name == "nomina12:Deducciones") + { + cont = xtr.MoveToFirstAttribute(); + while (cont) + { + switch (xtr.Name.ToUpper()) + { + case "TOTALOTRASDEDUCCIONES": drow["totalotrasdeducciones"] = xtr.Value; break; + case "TOTALIMPUESTOSRETENIDOS": drow["totalimpuestosretenidos"] = xtr.Value; break; + } + cont = xtr.MoveToNextAttribute(); + } + xtr.MoveToFirstAttribute(); + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + + } + else if (xtr.NodeType == XmlNodeType.Element && xtr.Name == "nomina12:Deduccion") + { + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + } + else + { + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + + } + } + } + } + else + { + //si no entro en ninguna de los anteriores no se debe ciclar + while ((canread = xtr.Read()) && xtr.NodeType != XmlNodeType.Element) { } + } + } + } + } + } + dt.Rows.Add(drow); + //using (StreamReader sr = new StreamReader(txtName)) + //{ + // sb.AppendLine(txtName.ToString()); + // sb.AppendLine("= = = = = ="); + // sb.Append(sr.ReadToEnd()); + // sb.AppendLine(); + // sb.AppendLine(); + //} + } + dt.TableName = "satxml"; + //GVNominasXmlsat.DataSource = dt; + //GVNominasXmlsat.DataBind(); + + + System.Xml.Linq.XDocument doc = new System.Xml.Linq.XDocument(); + System.Xml.Linq.XElement element = new System.Xml.Linq.XElement("XmlNominas"); + foreach (DataRow item in dt.Rows) + { + + System.Xml.Linq.XElement elementrow = new System.Xml.Linq.XElement("nom"); + foreach (DataColumn col in dt.Columns) + { + System.Xml.Linq.XElement elementcol = new System.Xml.Linq.XElement(col.ColumnName); + if (col.DataType ==typeof(DateTime )) + { + if (item[col.ColumnName] == null) { } else + { + elementcol.Value =string.Format("{0:yyyy/MM/dd HH}:{0:mm}:{0:ss}", item[col.ColumnName]); + + } + } + else + { + elementcol.Value = item[col.ColumnName].ToString(); + + } + //elementrow.SetAttributeValue(new System.Xml.Linq.XName() {LocalName(col.ColumnName) }, item[col.ColumnName]); + elementrow.Add(elementcol); + } + element.Add(elementrow); + } + doc.Add(element); + + + // new System.Xml.Linq.XDocument(new System.Xml.Linq.XElement("XmlNominas", dt.Rows.Select(x => new System.Xml.Linq.XElement("XmlNomina", x)))); + + //System.IO.StringWriter writer = new System.IO.StringWriter(); + //dt.WriteXml(writer, XmlWriteMode.WriteSchema, false); + return doc.ToString(); + } + + public void loadinfo() + { + string xml =readTimbres(); + using (ClsNominas onom = new ClsNominas()) + { + if (onom.ComparativoSATNominasGet(UsuarioActual.CveEmpresa, xml, TxtRpdFechaInicio.Text.ToDateTime(), TxtRpdFechaFin.Text.ToDateTime(), DdlTipoPeriodo.SelectedValue.ToEntero()) ) + { + GVNominasXmlsat.DataSource = onom.DtResultados ; + GVNominasXmlsat.DataBind(); + } + } + Updatos.Update(); + } + + + //public bool AddUnoaUnoCuestionario(string Cuestionario, string Comentario, int CveUsuario, List ListPreguntas, int CveEmpresa) + //{ + // bool retorno = false; + + // System.Xml.Linq.XDocument xmlPreguntas = null; + // if (ListPreguntas != null && ListPreguntas.Count > 0) + // xmlPreguntas = new System.Xml.Linq.XDocument(new System.Xml.Linq.XElement("Preguntas", ListPreguntas.Select(x => new System.Xml.Linq.XElement("CveUnoaUnoPregunta", x)))); + // DataAdapter("PA_OI_UnoaUnoCuestionarioAdd", CommandType.StoredProcedure); + // { + // var withBlock = SqlAdapter.SelectCommand.Parameters; + // withBlock.Add("@Cuestionario", SqlDbType.VarChar).Value = (Cuestionario); + // withBlock.Add("@Comentario", SqlDbType.VarChar).Value = (Comentario); + // withBlock.Add("@CveUsuario", SqlDbType.Int).Value = (CveUsuario); + // withBlock.Add("@CveEmpresa", SqlDbType.Int).Value = (CveEmpresa); + // withBlock.Add("@xmlPreguntas", SqlDbType.Xml).Value = xmlPreguntas == null ? DBNull.Value : (object)xmlPreguntas.ToString(); + // } + // try + // { + // SqlAdapter.Fill(Data); + // retorno = true; + // } + // catch (Exception ex) + // { + // OnError("Ocurrió un error al agregar el cuestionario.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()); + // } + // return retorno; + //} + + + + protected void LnkConsultar_Click(object sender, EventArgs e) + { + loadinfo(); + } + + protected void GVNominasXmlsat_RowDataBound(object sender, GridViewRowEventArgs e) + { + if (e.Row.RowType == DataControlRowType.DataRow) + { + if (e.Row.DataKey("Tipo") == "1") + { + e.Row.CssClass = "SubTotales"; + } + } + } +} \ No newline at end of file diff --git a/Nomina/Nomina.aspx b/Nomina/Nomina.aspx index 369061bf9..f0db650f5 100644 --- a/Nomina/Nomina.aspx +++ b/Nomina/Nomina.aspx @@ -9,6 +9,10 @@ content: "\f1c1"; } + label.compoonenlabel { + padding-top: 5px; + } + .lblforchk { font-size: 13px; color: #888888; @@ -252,19 +256,19 @@
    - +
    - +
    - +
    @@ -272,16 +276,6 @@
    - -
    - - - -
    -
    - - -
    @@ -310,19 +304,25 @@
    - +
    - +
    - Fecha Pago: + +
    + + + +
    + Fecha Pago:
    @@ -341,7 +341,7 @@
    - +
    @@ -349,6 +349,10 @@
    +
    + + +
    @@ -592,33 +596,65 @@
    - +
    -
    - - - - +
    +
    +
    + + + + +
    +
    +
    +
    + + +
    +
    -
    - - -
    -
    - +
    +
    +
    + -
    -
    - +
    +
    +
    +
    + +
    +
    +
    +
    + + + + +
    +
    -
    - - - - +
    + +
    + + + + +
    +
    + +
    + + + + +
    +
    @@ -2330,7 +2366,8 @@ Neto a pagar - + + diff --git a/Nomina/Nomina.aspx.cs b/Nomina/Nomina.aspx.cs index c689f3b71..2e63ddb18 100644 --- a/Nomina/Nomina.aspx.cs +++ b/Nomina/Nomina.aspx.cs @@ -195,7 +195,13 @@ public partial class Nomina_Nomina2 : ClsPaginas LnkVerCalculoISR.Visible = (UsuarioActual.CveUsuario == 100); TxtPeriodo.Text = $"{DateTime.Now:yyyyMM}"; CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyecto, LblSubProyeccto); + CargarCentrosDeCosto(DdlAsisProyecto, DdlAsisSubProyecto, LblAsisProyecto, LblAsisSubProyecto); divddlproyeto.Visible = DdlProyecto.Visible; + PnlProyecto.Visible = DdlProyecto.Visible; + if (PnlProyecto.Visible) + { + PnlSubProyecto.CssClass = "col-md-6"; + } cargaEjercicios(); CargaTiposPeriodo(); cargaPeriodos(); @@ -442,9 +448,12 @@ public partial class Nomina_Nomina2 : ClsPaginas CvePeriodoSeleccionado = FiltCvePeriodo; continuar = true; } + if (dtempleados != null) + { LnkTimbrarTodos.Visible = (dtempleados.Rows.Count > 0 && dtempleados.COUNT("CvePersonal", "SeTimbro=0 AND CvePersonal >0 AND NomAutorizado =1") > 0); + } } } @@ -858,7 +867,10 @@ public partial class Nomina_Nomina2 : ClsPaginas } #endregion UpDatos.Update(); - LnkAutorizar.Visible = (dtempleados.COUNT("CvePersonal", " CvePersonal > 0 AND NomAutorizado =0") > 0) || (Estatus < 2); + if (dtempleados != null) + { + LnkAutorizar.Visible = (dtempleados.COUNT("CvePersonal", " CvePersonal > 0 AND NomAutorizado =0") > 0) || (Estatus < 2); + } } private void setGVNominas() { @@ -1960,9 +1972,7 @@ public partial class Nomina_Nomina2 : ClsPaginas LblSRSbc.Text = SalarioDiarioIMSS; #endregion - #region "Sobre Recibo" - cargasobrericiboconceptos(); - #endregion + cargasobrericiboconceptos(); #region "Infonavit" { using (ClsRH objper = new ClsRH()) @@ -2020,7 +2030,7 @@ public partial class Nomina_Nomina2 : ClsPaginas { DataTable dtper = dtConceptos.FiltraParametros("Tipo IN ('P') AND EsPadre = 1 "); - DataTable dtded = dtConceptos.FiltraParametros("Tipo IN ('D') AND EsPadre = 1 "); + DataTable dtded = dtConceptos.FiltraParametros("Tipo IN ('D') AND EsPadre = 1 AND CveSistema NOT IN(101)"); dtper.Columns.Add("BorradoLogico", typeof(int)); dtded.Columns.Add("BorradoLogico", typeof(int)); @@ -2045,7 +2055,10 @@ public partial class Nomina_Nomina2 : ClsPaginas && (dtempleadosConceptos.COUNT("CveConcepto", string.Format("CveConcepto={0} AND CvePersonal ={1} AND Estatus =2", CveConcepto, SRCvePersonal)) == 0) ) { - BorradoLogico = 1; + if(!row["CveSistema"].ToString().ToEntero().Contiene(new int[] { 20,21,112,202, 203 })) + { + BorradoLogico = 1; + } } row["BorradoLogico"] = BorradoLogico; } @@ -4900,7 +4913,7 @@ public partial class Nomina_Nomina2 : ClsPaginas using (ClsRH objpersonal = new ClsRH()) { - if (objpersonal.AddAsistencia(CvePersonal, -1, -1, fecha, DdlTipoAsistencias.SelectedValue.ToEntero(), TxtPorPago.Text.Trim().ToDouble(), TxtHorasDobles.Text.Trim().ToDouble(), + if (objpersonal.AddAsistencia(CvePersonal, -1, DdlAsisSubProyecto.SelectedValue.ToEntero(), fecha, DdlTipoAsistencias.SelectedValue.ToEntero(), TxtPorPago.Text.Trim().ToDouble(), TxtHorasDobles.Text.Trim().ToDouble(), TxtHorasTriples.Text.Trim().ToDouble(), DdlMotivoHoraExtra.SelectedValue.ToEntero(), TxtObservaciones.Text.Trim(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) { @@ -4915,6 +4928,7 @@ public partial class Nomina_Nomina2 : ClsPaginas DateTime fecha = TxtasisFecha.Text.ToDate(); DataRow drow = dtempleados.FiltroPrimero(string.Format("CvePersonal={0}", CvePersonal)); TxtPersonal.Text = drow["nombre"].ToString(); + DdlAsisSubProyecto.SelectedValueExist("-1"); if (DdlTipoAsistencias.Items.Count == 1) { DdlTipoAsistencias.DataSource = GlobalDTAsistenciasInasistencias.FiltraParametros(string.Format("CveEmpresa = {0}", UsuarioActual.CveEmpresa)); @@ -4935,6 +4949,7 @@ public partial class Nomina_Nomina2 : ClsPaginas { DataRow dr = objpersonal.DtResultados.Rows[0]; DdlTipoAsistencias.SelectedValueExist(dr["CveAsistenciasInasistencias"].ToString()); + DdlAsisSubProyecto.SelectedValueExist(dr["CveSubProyecto"].ToString()); TxtPorPago.Text = dr["PorcentajePago"].ToString(); TxtHorasDobles.Text = dr["HorasDobles"].ToString(); TxtHorasTriples.Text = dr["HorasTriples"].ToString(); diff --git a/Nomina/RepPersonalAcumulados.aspx b/Nomina/RepPersonalAcumulados.aspx.exclude similarity index 100% rename from Nomina/RepPersonalAcumulados.aspx rename to Nomina/RepPersonalAcumulados.aspx.exclude diff --git a/Nomina/RepPersonalAcumulados.aspx.vb b/Nomina/RepPersonalAcumulados.aspx.vb.exclude similarity index 100% rename from Nomina/RepPersonalAcumulados.aspx.vb rename to Nomina/RepPersonalAcumulados.aspx.vb.exclude diff --git a/Nomina/ReportedeAcumulados.aspx b/Nomina/ReportedeAcumulados.aspx index cbb93792a..65f0577e0 100644 --- a/Nomina/ReportedeAcumulados.aspx +++ b/Nomina/ReportedeAcumulados.aspx @@ -10,7 +10,7 @@ } } - + .GvConceptos tr td a { color: #5b9bd1; } @@ -74,10 +74,11 @@ .isOnlyBisibleP td:nth-child(-n+3) a { color: #999; } - + .isOnlyBisibleD td:nth-last-child(-n+3) a { color: #999; } + .isOnlyBisibleO td:nth-last-child(-n+3) a { color: #999; } @@ -135,6 +136,7 @@ + Acumulados de Nóminas @@ -167,11 +169,32 @@
    - + <%----%> + +
    + + + + + + + + +
    - + <%----%> +
    + + + + + + + + +
    @@ -254,186 +277,178 @@ - - - -
    -
    -
    - - Acumulados nómina -
    +
    +
    +
    + + Acumulados nómina +
    -
    - - -
    -
    -
    -
    -
    -
    - - -
    -
    -
    - - - - - - - - - - - Nombre - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -
    -
    - -
    - - - -
    -
    +
    + + +
    +
    +
    - - +
    +
    + + +
    +
    +
    + + - + + + + + + + + Nombre + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +
    + + + +
    +
    +
    - diff --git a/Nomina/ReportedeAcumulados.aspx.cs b/Nomina/ReportedeAcumulados.aspx.cs index 2c5b5ff60..5cbbc8a75 100644 --- a/Nomina/ReportedeAcumulados.aspx.cs +++ b/Nomina/ReportedeAcumulados.aspx.cs @@ -105,8 +105,8 @@ public partial class Nomina_ReportedeAcumulados : ClsPaginas FiltCveProyecto = DdlProyecto.SelectedValue.ToEntero(); FiltCveSubProyecto = -1; FiltCveTurno = DdlTurno.SelectedValue.ToEntero(); - FiltCvePeriodoI = TxtPeriodoInicio.Text.ToEntero(); - FiltCvePeriodoF = TxtPeriodoFin.Text.ToEntero(); + FiltCvePeriodoI = TxtRpdFechaInicio.Text.ToDateTime().ToString("yyyyMMdd").ToEntero(); + FiltCvePeriodoF = TxtRpdFechaFin.Text.ToDateTime().ToString("yyyyMMdd").ToEntero(); cargaDatos(); } @@ -159,7 +159,7 @@ public partial class Nomina_ReportedeAcumulados : ClsPaginas { DdlTipoPeriodo.DataSource = GlobalDTTipoPeriodo.FiltraParametros("Estatus = 'Activo'"); DdlTipoPeriodo.DataBind(); - DdlTipoPeriodo.Items.Insert(0, new ListItem("Seleccione", "-1")); + DdlTipoPeriodo.Items.Insert(0, new ListItem("Todos", "-1")); if (DdlTipoPeriodo.Items.Count > 0) { DdlTipoPeriodo.SelectedIndex = 0; @@ -393,8 +393,8 @@ public partial class Nomina_ReportedeAcumulados : ClsPaginas FiltCveProyecto = DdlProyecto.SelectedValue.ToEntero(); FiltCveSubProyecto = -1; FiltCveTurno = DdlTurno.SelectedValue.ToEntero(); - FiltCvePeriodoI = TxtPeriodoInicio.Text.ToEntero(); - FiltCvePeriodoF = TxtPeriodoFin.Text.ToEntero(); + FiltCvePeriodoI = TxtRpdFechaInicio.Text.ToDateTime().ToString("yyyyMMdd").ToEntero(); + FiltCvePeriodoF = TxtRpdFechaFin.Text.ToDateTime().ToString("yyyyMMdd").ToEntero(); cargaDatos(); if (dtempleados.Rows.Count > 0) { diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb index c5002a274..db8a6a6e8 100644 --- a/OC/OC.aspx.vb +++ b/OC/OC.aspx.vb @@ -463,12 +463,12 @@ Partial Class OC ViewState("CveConfianzaProveedor") = value End Set End Property - Private Property CveProveedorOrignal As Integer + Private Property CveProveedorOriginal As Integer Get - Return IfNull(ViewState("CveProveedorOrignal"), -1).ToString().ToEntero() + Return IfNull(ViewState("CveProveedorOriginal"), -1).ToString().ToEntero() End Get Set(value As Integer) - ViewState("CveProveedorOrignal") = value + ViewState("CveProveedorOriginal") = value End Set End Property Private Property CveEstatusSupervisada As Integer @@ -580,6 +580,7 @@ Partial Class OC If Not Page.IsPostBack Then CargaDatosAgregarPS() + CveProveedorOriginal = -1 'MODALIDAD MULTIEMPRESA CveEmpresaActual = UsuarioActual.CveEmpresa CargaEstatusUsuariosClasificaciones() @@ -844,27 +845,27 @@ Partial Class OC 'Nuevo Proceso que permite modificar detalles 'If Not UsuarioActual.TienePermisoProceso(131) Then If GlobalDTOCEstatus(UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveEstatus = {0}", CveEstatus)).Rows.Count > 0 Then - Dim Dr As DataRow - Dr = GlobalDTOCEstatus(UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveEstatus = {0}", CveEstatus))(0) - If UsuarioActual.TienePermisoProceso(203) And Dr("TipoTermino").ToString.ToEntero = 3 And Dr("Tipo").ToString = "OC" Then - CargaClasificaciones() - DesHabilitar() - GvD.Columns(9).Visible = True - LbAgregar.Enabled = True - txtPrecioUnitario.Enabled = True - DdlProyecto.Enabled = True - DdlSubProyecto.Enabled = True - TxtObsPS.Enabled = True - CboUnidadMedida.Enabled = True - DdlClasificacion.Enabled = True - DdlP2.Enabled = True - TxtCant.Enabled = True - BtnGuardar.Enabled = True - BtnCancelar.Enabled = True - ElseIf Dr("TipoTermino").ToString.ToEntero = 3 And Dr("Tipo").ToString = "OC" Then - DesHabilitar() - End If + Dim Dr As DataRow + Dr = GlobalDTOCEstatus(UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveEstatus = {0}", CveEstatus))(0) + If (UsuarioActual.TienePermisoProceso(203)) AndAlso Dr("TipoTermino").ToString.ToEntero = 3 AndAlso Dr("Tipo").ToString = "OC" Then + CargaClasificaciones() + If Not UsuarioActual.TienePermisoProceso(131) Then DesHabilitar() + GvD.Columns(9).Visible = True + LbAgregar.Enabled = True + txtPrecioUnitario.Enabled = True + DdlProyecto.Enabled = True + DdlSubProyecto.Enabled = True + TxtObsPS.Enabled = True + CboUnidadMedida.Enabled = True + DdlClasificacion.Enabled = True + DdlP2.Enabled = True + TxtCant.Enabled = True + BtnGuardar.Enabled = True + BtnCancelar.Enabled = True + ElseIf Dr("TipoTermino").ToString.ToEntero = 3 And Dr("Tipo").ToString = "OC" AndAlso Not UsuarioActual.TienePermisoProceso(131) Then + DesHabilitar() End If + End If 'End If 'NO PERMITE REGISTRAR PS @@ -1439,7 +1440,7 @@ Partial Class OC DdlProveedores.SelectedValue = objOC.CveProveedor.ToString If DdlProveedores.SelectedValue.ToEntero > 0 Then - CveProveedorOrignal = DdlProveedores.SelectedValue.ToEntero + CveProveedorOriginal = objOC.CveProveedor DdlProveedores.SelectedText = GlobalDTCompProveedores(UsuarioActual.CveEmpresa).FiltraParametros($"CveProveedor = {objOC.CveProveedor}").Rows(0)("RazonSocial").ToString Else DdlProveedores.SelectedText = "-" @@ -2727,7 +2728,7 @@ Partial Class OC DdlVendedor.SelectedValue.ToEntero, txtobsprioridad.Text, IVA:=IVA, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, FolioAdicional:=TxtFolioAdicional.Text, EntregaDirecta:=If(ChkEntregaDirecta.Checked, 1, -1), CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero, -1), Guia:=TxtGuia.Text.Trim, IEPS:=TxtIEPS.Text.ToDecimal, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero, Promocion:=Promocion, pCveProveedorSucursal:=DdlProveedorSucursal.SelectedValue.ToEntero, CveProveedorContacto:=CveProveedorContacto, PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2)) Then - If CveProveedorOrignal <> CveProveedor Then + If CveProveedorOriginal <> CveProveedor Then If Not ObjConta.UpdateProveedorPoliza(CveOrdenCompra, CveProveedor, Proveedor) Then TieneError = True End If @@ -3593,9 +3594,6 @@ Partial Class OC If Not (e.Row.RowState = DataControlRowState.Edit OrElse e.Row.RowState = 5) Then - - - If e.Row.RowState = DataControlRowState.Normal Or e.Row.RowState = DataControlRowState.Alternate Then If UsuarioActual.Empresa.Tipo_CentroCosto = 1 Or UsuarioActual.Empresa.Tipo_CentroCosto = 2 Then Dim Str As String = e.Row.DBCampo("SubProyecto") @@ -3608,7 +3606,6 @@ Partial Class OC 'comente esta linea, RMF: 2015.04.20 'If DtEstatusUsuarios.FiltraParametros(String.Format("CveSubProyecto = {0}", e.Row.DBCampo("CveSubProyecto"))).Rows.Count = 0 Then e.Row.FCImageButton("ImgEdit").Visible = False : e.Row.FCImageButton("ImgDelete").Visible = False - If TipoOC = "OC" AndAlso Not IsDBNull(e.Row.DBCampo("CveOrdenCompraPadre")) AndAlso IsNumeric(e.Row.DBCampo("CveOrdenCompraPadre")) Then GvD.Columns(10).Visible = True lblTipoPadreHijo.Visible = True @@ -3622,10 +3619,6 @@ Partial Class OC 'CveAFVinculado e.Row.FCLiteral("LitMaq").Text = String.Format("{1}", e.Row.DBCampo("CveActivoFijo"), e.Row.DBCampo("CodigoAF")) - - - - 'CveCompraDetalle Vinculada Dim ObjOC As New ClsOC If ObjOC.GetOCVinculadasPendientes(e.Row.DBCampo("CveOrdenCompraDetalle").ToEntero) Then @@ -3679,8 +3672,6 @@ Partial Class OC If e.Row.DBCampo("CveClasificacionOG").ToString.ToEntero > 0 Then e.Row.FCDropDownList("DdlAC5").SelectedValue = e.Row.DBCampo("CveClasificacionOG") End If - - 'CLASIFICACION If isWithFamily() Then e.Row.FCLabel("LblClasificacion").Text = e.Row.DBCampo("SubFamilia") @@ -3692,7 +3683,7 @@ Partial Class OC Drr = GlobalDTOCEstatus(UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveEstatus = {0}", CveEstatus))(0) If Drr IsNot Nothing AndAlso UsuarioActual.TienePermisoProceso(203) AndAlso Drr("TipoTermino").ToString.ToEntero = 3 AndAlso Drr("Tipo").ToString = "OC" Then If e.Row.DataKey("CveCompra").ToEntero > 0 Then - If Not UsuarioActual.CveUsuario = 100 Then '[IPP] PARA PODER EDITAR + If e.Row.DBCampo("CantidadNoEditable").ToDouble >= e.Row.DBCampo("Cantidad").ToDouble Then '[IPP] PARA PODER EDITAR e.Row.FCLinkButton("imgE").Enabled = False e.Row.FCLinkButton("imgE").ToolTip = "El concepto no se puede editar porque ya esta asignado a una compra" e.Row.FCLinkButton("imgD").Enabled = False @@ -3708,7 +3699,6 @@ Partial Class OC e.Row.FCLinkButton("imgD").Attributes.Remove("Data-toggle") e.Row.FCLinkButton("imgD").Attributes.Add("Data-toggle", "tooltip") End If - End If @@ -3728,6 +3718,14 @@ Partial Class OC FiltroClasificacion = String.Format("CveClasificacion = {0}", e.Row.DBCampo("CveClasificacion")) End If + If CveOrdenCompra > 0 AndAlso (e.Row.DBCampo("CantidadVinculadaCompra").ToDouble > 0 OrElse e.Row.DBCampo("CantidadSurtidaAlmacen").ToDouble > 0 OrElse e.Row.DBCampo("CantidadVinculada").ToDouble > 0) Then + e.Row.FCDropDownList("DdlPS").Enabled = False + e.Row.FCDropDownList("DdlClasificacion").Enabled = False + e.Row.FCDropDownList("CboUnidadMedidaEdit").Enabled = False + e.Row.FCTextBox("TxtImporteEdit").Enabled = False + e.Row.FCTextBox("TxtDescuentoEdit").Enabled = False + End If + 'DDL PS If e.Row.DBCampo("CveClasificacion").ToString() <> "" Then e.Row.FCDropDownList("DdlPS").DataSource = GlobalDTPS(CveEmpresaActual).FiltraParametros(FiltroClasificacion, "PS") @@ -3780,8 +3778,6 @@ Partial Class OC End If End If - - If UsuarioActual.Empresa.Funcionalidad(590).ToString.ToEntero = 1 Then 'empresa agricola e.Row.FCDropDownList("DdlCultivosCuadroEdit").Visible = True e.Row.FCDropDownList("DdlCultivosCuadroEdit").DataSource = GlobalDTCultivosCuadro(UsuarioActual.CveEmpresa).FiltraParametros($"CveSubProyecto = {e.Row.DBCampo("CveSubProyecto").ToEntero}") diff --git a/PortalCliente/PortalCliente.aspx.vb b/PortalCliente/PortalCliente.aspx.vb index 3f6f4a084..e6245a911 100644 --- a/PortalCliente/PortalCliente.aspx.vb +++ b/PortalCliente/PortalCliente.aspx.vb @@ -726,28 +726,20 @@ Partial Class Ventas_PortalCliente Dim MensajeAlert As New StringBuilder Dim ObjConta As New ClsContabilidad - Dim ObjCliente As New ClsClientes(ObjConta.IniciaTransacSQL) - - Dim CveCuentacliente = -1 + Dim ObjCliente As New ClsClientes(ObjConta.IniciaTransacSQL) + + Dim IdCuentaCliente = -1 - Dim IdCtaContMonedaExtranjera = -1 - Dim CveCuentaComplementaria = -1 - Dim CveCuentaMonedaExtranjera = -1 + Dim IdCtaContMonedaExtranjera = -1 Dim IdCtaContRetIVA = -1 - Dim IdCtaContRetISR = -1 - Dim CveCuentaRetIVA = -1 - Dim CveCuentaRetISR = -1 - + Dim IdCtaContRetISR = -1 + + If ObjCliente.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa, -1) AndAlso ObjCliente.DtResultados.Rows.Count > 0 Then IdCuentaCliente = ObjCliente.IdCtaContClientes - CveCuentacliente = ObjCliente.CveCuentaClientes IdCtaContMonedaExtranjera = ObjCliente.IdCtaContMonedaExtranjera - CveCuentaMonedaExtranjera = ObjCliente.CveCuentaMonedaExtranjera - CveCuentaComplementaria = ObjCliente.CveCuentaComplementaria IdCtaContRetIVA = ObjCliente.IdCtaContRetIVA IdCtaContRetISR = ObjCliente.IdCtaContRetISR - CveCuentaRetIVA = ObjCliente.CveCuentaRetIVA - CveCuentaRetISR = ObjCliente.CveCuentaRetISR Else TieneError = True MensajeError.Append("Ocurrió un error al cargar la información contable del cliente. Por favor vuelva a intentar
    ") @@ -766,8 +758,7 @@ Partial Class Ventas_PortalCliente Dim TipoMovimiento = False Dim ImporteMovimiento = 0.0D Dim importeMX = 0.0D - Dim IdCtaContable = 0 - Dim CveCuenta = 0 + Dim IdCtaContable = 0 Dim ConceptoMovimiento = "" Dim Referencia = "" Dim CveSubProyecto = -1 @@ -810,7 +801,6 @@ Partial Class Ventas_PortalCliente ImporteMovimiento = 0 importeMX = 0 IdCtaContable = 0 - CveCuenta = 0 PorcentajeImpuesto = 0 ConceptoMovimiento = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, ConceptoContable, LtlCliente.Text, DrPago("Factura").ToString, DrPago("Factura").ToString) 'VALORES DE LA VENTA @@ -843,14 +833,12 @@ Partial Class Ventas_PortalCliente If CveMonedaVenta = 1 Then IdCtaContable = IdCuentaCliente - CveCuenta = CveCuentacliente Else IdCtaContable = IdCtaContMonedaExtranjera - CveCuenta = CveCuentaComplementaria ConceptoMovimiento += $" TC:{TCPago} ${ImporteMovimiento.FormatoNumero(2)}" If ImporteMovimiento <> 0 AndAlso IdCtaContable > 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Referencia, 207, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, -1, CveVenta, -1, CveSubProyecto, CveCliente, ImporteMX:=(importeMX - ImporteMovimiento).RoundSQL(), ImporteME:=ImporteMovimiento, CveCuenta:=CveCuenta, TipoCambio:=TCVenta) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Referencia, 207, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, -1, CveVenta, -1, CveSubProyecto, CveCliente, ImporteMX:=(importeMX - ImporteMovimiento).RoundSQL(), ImporteME:=ImporteMovimiento, TipoCambio:=TCVenta) Then TieneError = True MensajeError.Append("No se pudo insertar el detalle de pago de la póliza
    ") Exit For @@ -858,7 +846,6 @@ Partial Class Ventas_PortalCliente End If IdCtaContable = IdCtaContMonedaExtranjera - CveCuenta = CveCuentaMonedaExtranjera End If Case 134 'PAGO INTERMEDIARIO @@ -882,7 +869,6 @@ Partial Class Ventas_PortalCliente TCGeneral = TCVenta IdCtaContable = UsuarioActual.Empresa.IdCuentaIVAxTrasladar - CveCuenta = UsuarioActual.Empresa.CveCuentaIVAxTrasladar If TCVenta > 1 Then ConceptoMovimiento += $" TC:{TCVenta} ${ImporteMovimiento.FormatoNumero(2)}" Case 61 'IVA TRASLADADO @@ -900,7 +886,6 @@ Partial Class Ventas_PortalCliente TCGeneral = TCFluctuacion IdCtaContable = UsuarioActual.Empresa.IdCuentaIVATrasladado - CveCuenta = UsuarioActual.Empresa.CveCuentaIVATrasladado If TCFluctuacion > 1 Then ConceptoMovimiento += $" TC:{TCFluctuacion} ${ImporteMovimiento.FormatoNumero(2)}" Case 8 'RETIVA X TRASLADAR @@ -926,16 +911,8 @@ Partial Class Ventas_PortalCliente If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then IdCtaContable = ObjConta.DtResultados.FiltroPrimeroValor("IdCuentaRetIVACirculacion").ToEntero End If - End If - - 'Conta SIG - If CveCuentaRetIVA <> 0 Then - CveCuenta = CveCuentaRetIVA - Else - If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then - CveCuenta = ObjConta.DtResultados.FiltroPrimeroValor("IdCuentaRetIVACirculacionSIG").ToEntero - End If - End If + End If + Case 62 'RETIVA TRASLADADO If CveMonedaVenta = 1 Then ImporteMovimiento = RetIVAVenta * PorcentajePago @@ -959,17 +936,9 @@ Partial Class Ventas_PortalCliente If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then IdCtaContable = ObjConta.DtResultados.FiltroPrimeroValor("IdCuentaRetIVACirculacion").ToEntero End If - End If - - 'Conta SIG - If CveCuentaRetIVA <> 0 Then - CveCuenta = CveCuentaRetIVA - Else - If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then - CveCuenta = ObjConta.DtResultados.FiltroPrimeroValor("IdCuentaRetIVACirculacionSIG").ToEntero - End If - End If - + End If + + Case 9 'RETISR X TRASLADAR If CveMonedaVenta = 1 Then ImporteMovimiento = RetISRVenta * PorcentajePago @@ -993,17 +962,9 @@ Partial Class Ventas_PortalCliente If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then IdCtaContable = ObjConta.DtResultados.FiltroPrimeroValor("IdCuentaRetISRCirculacion").ToEntero End If - End If - - 'Conta SIG - If CveCuentaRetISR <> 0 Then - CveCuenta = CveCuentaRetISR - Else - If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then - CveCuenta = ObjConta.DtResultados.FiltroPrimeroValor("IdCuentaRetISRCirculacionSIG").ToEntero - End If - End If - + End If + + Case 63 'RETISR TRASLADADO If CveMonedaVenta = 1 Then ImporteMovimiento = RetIVAVenta * PorcentajePago @@ -1027,17 +988,8 @@ Partial Class Ventas_PortalCliente If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then IdCtaContable = ObjConta.DtResultados.FiltroPrimeroValor("IdCuentaRetISRCirculacion").ToEntero End If - End If - - 'Conta SIG - If CveCuentaRetISR <> 0 Then - CveCuenta = CveCuentaRetISR - Else - If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then - CveCuenta = ObjConta.DtResultados.FiltroPrimeroValor("IdCuentaRetISRCirculacionSIG").ToEntero - End If - End If - + End If + Case 38 'IEPS X TRASLADAR If CveMonedaVenta = 1 Then ImporteMovimiento = IEPSVenta * PorcentajePago @@ -1053,7 +1005,6 @@ Partial Class Ventas_PortalCliente TCGeneral = TCVenta IdCtaContable = UsuarioActual.Empresa.IdCuentaIEPSxTrasladar - CveCuenta = UsuarioActual.Empresa.CveCuentaIEPSxTrasladar If TCVenta > 1 Then ConceptoMovimiento += $" TC:{TCVenta} ${ImporteMovimiento.FormatoNumero(2)}" Case 39 'IEPS TRASLADADO @@ -1071,14 +1022,12 @@ Partial Class Ventas_PortalCliente TCGeneral = TCFluctuacion IdCtaContable = UsuarioActual.Empresa.IdCuentaIEPSTrasladado - CveCuenta = UsuarioActual.Empresa.CveCuentaIEPSTrasladado If TCFluctuacion > 1 Then ConceptoMovimiento += $" TC:{TCFluctuacion} ${ImporteMovimiento.FormatoNumero(2)}" Case 64 'GANANCIA Continue For 'SKIPEA If CveMonedaVenta <> 1 Then IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria - CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria If TCPago > TCVenta AndAlso CveMonedaVenta = 2 Then ImporteMovimiento = (ImportePago * TCPago) - (ImportePago * TCVenta) ImporteMovimiento -= ((IVAVenta * PorcentajePago) * TCFluctuacion) - ((IVAVenta * PorcentajePago) * TCVenta) @@ -1094,7 +1043,6 @@ Partial Class Ventas_PortalCliente Continue For 'SKIPEA If CveMonedaVenta <> 1 Then IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria - CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria If TCPago < TCVenta AndAlso CveMonedaVenta = 2 Then ImporteMovimiento = (ImportePago * TCPago) - (ImportePago * TCVenta) ImporteMovimiento -= ((IVAVenta * PorcentajePago) * TCFluctuacion) - ((IVAVenta * PorcentajePago) * TCVenta) @@ -1110,7 +1058,7 @@ Partial Class Ventas_PortalCliente 'AGREGA PREPOLIZA DETALLE If ImporteMovimiento <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, Referencia, ConceptoContable, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, -1, CveVenta, -1, CveSubProyecto, CveCliente, CveProveedorContabilizar, ImporteMX:=importeMX, CveCuenta:=CveCuenta, TipoCambio:=TCGeneral, PorcentajeImpuesto:=PorcentajeImpuesto) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, Referencia, ConceptoContable, ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, -1, CveVenta, -1, CveSubProyecto, CveCliente, CveProveedorContabilizar, ImporteMX:=importeMX, TipoCambio:=TCGeneral, PorcentajeImpuesto:=PorcentajeImpuesto) Then TieneError = True MensajeError.Append("No se pudo insertar el detalle de la póliza
    ") Exit For @@ -1954,7 +1902,7 @@ Partial Class Ventas_PortalCliente End Select If importeMovimiento <> 0 Then - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, If(ConceptoContable = 30, ObjFactura.Cliente.IdCtaContClientes, ObjFactura.Cliente.IdCtaContAnticipos), -1, CveIE:=CveIE, CveCompra:=-1, CveProveedor:=-1, CvePersonal:=-1, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=importeMovimiento, ImporteME:=tImporteMonedaExtranjera, TipoCambio:=TxtTipoCambio.Text.ToDecimal, CveCuenta:=If(ConceptoContable = 30, ObjFactura.Cliente.CveCuentaClientes, ObjFactura.Cliente.CveCuentaAnticipos)) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, ConceptoContable, Concepto, FechaMovimiento, If(ConceptoContable = 30, ObjFactura.Cliente.IdCtaContClientes, ObjFactura.Cliente.IdCtaContAnticipos), -1, CveIE:=CveIE, CveCompra:=-1, CveProveedor:=-1, CvePersonal:=-1, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=importeMovimiento, ImporteME:=tImporteMonedaExtranjera, TipoCambio:=TxtTipoCambio.Text.ToDecimal) Then MsgError = "Ocurrió un error al registrar el asiento del ingreso." End If End If @@ -3198,9 +3146,7 @@ Partial Class Ventas_PortalCliente End If ViewState("IdCtaContRetIVA") = ObjCliente.IdCtaContRetIVA - ViewState("CveCuentaRetIVA") = ObjCliente.CveCuentaRetIVA ViewState("IdCtaContRetISR") = ObjCliente.IdCtaContRetISR - ViewState("CveCuentaRetISR") = ObjCliente.CveCuentaRetISR End If End If ObjCliente.Dispose() diff --git a/PortalProveedor/PortalProveedor.aspx b/PortalProveedor/PortalProveedor.aspx index a3ecb0e30..4bcd4e740 100644 --- a/PortalProveedor/PortalProveedor.aspx +++ b/PortalProveedor/PortalProveedor.aspx @@ -196,7 +196,7 @@ Aplica NC - + <%----%> @@ -246,7 +246,13 @@ - + + Aplica NC + + + + + <%----%> @@ -757,72 +763,6 @@ - <%--02/07/2018 - TAB CAMBIO DE CONTRASENIAS--%> - - - - -
    -
    -
    -
    -
    - - Cambio Contraseña -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    - - -
    - -
    -
    -
    -
    - -
    - - -
    - -
    -
    -
    -
    - -
    - - -
    - - -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - <%---2020/02/06 - Auditoria--%> diff --git a/PortalProveedor/PortalProveedor.aspx.vb b/PortalProveedor/PortalProveedor.aspx.vb index c9293c7b6..093cdb5ec 100644 --- a/PortalProveedor/PortalProveedor.aspx.vb +++ b/PortalProveedor/PortalProveedor.aspx.vb @@ -293,7 +293,6 @@ Partial Class Portal_PortalProveedor End If 'CARGA TAB CONTRASENIA PARA TODOS LOS USUARIOS - If UsuarioActual.CvePlataforma = 7 Then TabContraseña.Visible = True End If @@ -521,11 +520,15 @@ Partial Class Portal_PortalProveedor End If If e.Row.DBCampo("CveCompraNC").ToEntero > 0 Then - e.Row.FCHyperLink("HplNC").Visible = True - e.Row.FCHyperLink("HplNC").ImageUrl = "/Imagenes/flag_green.png" - e.Row.FCHyperLink("HplNC").ToolTip = "Notas de Crédito Aplicadas" - End If - + Dim asdas2 As Integer = e.Row.DBCampo("CveCompraNC").ToEntero + Dim asdas As String = e.Row.DBCampo("AplicaNotaCredito").ToString + If e.Row.DBCampo("AplicaNotaCredito").ToString = "True" Then + e.Row.FCHyperLink("HplNC").Visible = True + e.Row.FCHyperLink("HplNC").ImageUrl = "/Imagenes/flag_green.png" + e.Row.FCHyperLink("HplNC").ToolTip = "Notas de Crédito Aplicadas" + End If + End If + If CType(sender, GridView).ID = "GvCxPHistorial" Then If e.Row.DBCampo("CveCompra") = "" Then e.Row.BackColor = Drawing.Color.LightGray @@ -1375,39 +1378,11 @@ Partial Class Portal_PortalProveedor End If ObjMovtos.Dispose() Return retorno - End Function + End Function #End Region - -#Region "TAB CONTRASENIA" - - Protected Sub BtnGuardarContraseña_Click(sender As Object, e As EventArgs) Handles BtnGuardarContraseña.Click - - If Decripta(UsuarioActual.Contraseña) = TxtContraseniaActual.Text Then - - Dim ObjUsuario As New ClsSisUsuarios - Dim Usuario As Usuario = Nothing - If ObjUsuario.GetUsuariosPortal(UsuarioActual.CveUsuario, -1, -1) Then - - Dim dr As DataRow = ObjUsuario.DtResultados.FiltroPrimero("") - - If ObjUsuario.UpdateUsuarioPortal(dr("Usuario").ToString, dr("Nombre").ToString, dr("Correo").ToString, True, Encripta(TxtContrasenia1.Text), dr("CveCliente").ToString.ToEntero, dr("CveProveedor").ToString.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveUsuario) Then - UsuarioActual.Contraseña = Encripta(TxtContrasenia1.Text) - Alert("Contraseña Modificada.", TipoMensaje.MsgInformacion) - - End If - End If - - ObjUsuario.Dispose() - Else - Alert("La Contraseña Actual es incorrecta.", TipoMensaje.MsgAdvertencia) - End If - - End Sub -#End Region - - + #Region "AUDITORIA" - + Property DTDocumentacion As DataTable Get If ViewState("DTDocumentacion") Is Nothing Then diff --git a/RH/CalculoSBC.aspx.cs b/RH/CalculoSBC.aspx.cs index 0c473901c..3ebdb377b 100644 --- a/RH/CalculoSBC.aspx.cs +++ b/RH/CalculoSBC.aspx.cs @@ -9,16 +9,15 @@ using Extensiones; public partial class RH_CalculoSBC : ClsPaginas { - //private DataTable dtPeriodos - //{ - // get - // { - // if (ViewState["dtPeriodos"] == null) { return null; } - // else { return (DataTable)ViewState["dtPeriodos"]; } - // } - - // set { ViewState["dtPeriodos"] = value; } - //} + private DataTable dtDetalleParteVariable + { + get + { + if (ViewState["dtDetalleParteVariable"] == null) { return null; } + else { return (DataTable)ViewState["dtDetalleParteVariable"]; } + } + set { ViewState["dtDetalleParteVariable"] = value; } + } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) @@ -44,7 +43,8 @@ public partial class RH_CalculoSBC : ClsPaginas GVPV.DataSource = objnom.DTSetResultados.Tables[0]; if (objnom.DTSetResultados.Tables.Count >1) { - GVDetalleParteVariable.DataSource = objnom.DTSetResultados.Tables[1]; + dtDetalleParteVariable=objnom.DTSetResultados.Tables[1]; + GVDetalleParteVariable.DataSource = dtDetalleParteVariable; GVDetalleParteVariable.DataBind(); } } @@ -154,7 +154,8 @@ public partial class RH_CalculoSBC : ClsPaginas DataTable dt = GVToDT(GVCalculosSBC,"Salario"); DataTable dtPF = GVToDT(GVCFija, "Parte fija"); DataTable dtPV = GVToDT(GVPV, "Parte variable"); - DataTable dtPVD = GVToDT(GVDetalleParteVariable, "Detalle parte variable"); + dtDetalleParteVariable.TableName = "Detalle parte variable"; + DataTable dtPVD = dtDetalleParteVariable;//GVToDT(GVDetalleParteVariable, "Detalle parte variable"); ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook(); var libro = wb.AddWorksheet(dt); diff --git a/RH/Personal.aspx b/RH/Personal.aspx index 14d08582e..76908b21e 100644 --- a/RH/Personal.aspx +++ b/RH/Personal.aspx @@ -719,7 +719,9 @@
    - + @@ -727,11 +729,79 @@ + + + + + + + + + + + + + + + +
    diff --git a/RH/Personal.aspx.vb b/RH/Personal.aspx.vb index a30525de5..da16a8d97 100644 --- a/RH/Personal.aspx.vb +++ b/RH/Personal.aspx.vb @@ -6440,6 +6440,13 @@ Partial Class RH_Personal RegistraScript("$('#Dmodamodificarsalario').modal()") UpModSalario.Update() End Sub + + Protected Sub UpdatePersonalAlta_Click(sender As Object, e As EventArgs) + + End Sub + Protected Sub DeletePersonalAlta_Click(sender As Object, e As EventArgs) + + End Sub Protected Sub LnkDescargaFormatoParametros_Click(sender As Object, e As EventArgs) @@ -6499,4 +6506,83 @@ Partial Class RH_Personal End Sub + + Property CvePersonalAltas As Integer + Get + If ViewState("CvePersonalAltas") Is Nothing Then + Return 0 + Else + Return DirectCast(ViewState("CvePersonalAltas"), Integer) + End If + End Get + Set(value As Integer) + ViewState("CvePersonalAltas") = value + End Set + End Property + + Protected Sub LnkUpAltass_Click(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) + CvePersonalAltas = GvRow.DataKey("CvePersonalAltas").ToEntero() + TxtFechaInicioUA.Text = String.Format("{0:dd/MM/yyyy}", GvRow.DataKey("FechaInicio").ToDateTime()) + Dim fechafin As DateTime = GvRow.DataKey("FechaFin").ToDateTime() + If fechafin.Year < 1900 Then + TxtFechaFinUA.Text = "" + Else + TxtFechaFinUA.Text = String.Format("{0:dd/MM/yyyy}", fechafin) + End If + UpAltasUpdate.Update() + RegistraScript("$('#ModalUpAltas').modal();") + End Sub + + Protected Sub LnkDAltas_Click(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) + CvePersonalAltas = GvRow.DataKey("CvePersonalAltas").ToEntero() + Dim strquery As String = String.Format("DELETE [RH_PersonalAltas] WHERE CvePersonalAltas ={0} AND [CvePersonal] ={1}", CvePersonalAltas, CvePersonal) + Using objbase As New ClsClaseBase + If (objbase.runQuerystr(strquery)) Then + Using objrh As New ClsRH() + If objrh.GetPersonalAltas(CvePersonal) Then + GvPersonalAltas.DataSource = objrh.DtResultados + GvPersonalAltas.DataBind() + UpDatos.Update() + End If + End Using + Alert("Alta eliminada") + End If + End Using + End Sub + + Protected Sub LnkUpAltas_Click(sender As Object, e As EventArgs) + + Dim strfin As String = "" + Dim fechafin As DateTime = TxtFechaFinUA.Text.ToDateTime() + If fechafin.Year < 1900 Then + strfin = ",[FechaFin]=null" + Else + strfin = String.Format(",[FechaFin]='{0:yyyy-MM-dd}'", fechafin) + + End If + Dim strquery As String = String.Format("UPDATE [RH_PersonalAltas] SET [FechaInicio]='{2:yyyy-MM-dd}' {3} WHERE CvePersonalAltas ={0} AND [CvePersonal] ={1}", CvePersonalAltas, CvePersonal, TxtFechaInicioUA.Text.ToDateTime(), strfin) + Using objbase As New ClsClaseBase + If (objbase.runQuerystr(strquery)) Then + Using objrh As New ClsRH() + If objrh.GetPersonalAltas(CvePersonal) Then + GvPersonalAltas.DataSource = objrh.DtResultados + GvPersonalAltas.DataBind() + UpDatos.Update() + End If + End Using + Alert("Alta actualizada") + End If + End Using + End Sub + + Protected Sub GvPersonalAltas_RowDataBound(sender As Object, e As GridViewRowEventArgs) + If e.Row.RowType = DataControlRowType.DataRow Then + e.Row.FCLinkButton("LnkUpAltass").Visible = UsuarioActual.TienePermisoProceso(327) + e.Row.FCLinkButton("LnkDAltas").Visible = e.Row.FCLinkButton("LnkUpAltass").Visible + End If + + End Sub End Class + diff --git a/Ventas/CatAutorizacionLimites.aspx b/Ventas/CatAutorizacionLimites.aspx index b71f4c61e..905fde3d2 100644 --- a/Ventas/CatAutorizacionLimites.aspx +++ b/Ventas/CatAutorizacionLimites.aspx @@ -38,8 +38,7 @@
      -
    • Estatus: - +
    • Estatus: @@ -48,6 +47,13 @@
    • +
    • Cliente: + +
    • +
    • Vendedor: + + +
    diff --git a/Ventas/CatAutorizacionLimites.aspx.vb b/Ventas/CatAutorizacionLimites.aspx.vb index 0b450106d..916b3e41e 100644 --- a/Ventas/CatAutorizacionLimites.aspx.vb +++ b/Ventas/CatAutorizacionLimites.aspx.vb @@ -27,21 +27,38 @@ Partial Class Ventas_CatAutorizacionLimites Dim EsWS = If(UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1", True, False) If EsWS Then DdlCliente.setEsWebService(True) + DdlClienteFiltro.setEsWebService(True) Else DdlCliente.setEsWebService(False) DdlCliente.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1) DdlCliente.DataBind() DdlCliente.ddl.Items.Insert(0, New ListItem("Seleccione", "-1")) + + DdlClienteFiltro.setEsWebService(False) + DdlClienteFiltro.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa, -1) + DdlClienteFiltro.DataBind() + DdlClienteFiltro.ddl.Items.Insert(0, New ListItem("Seleccione", "-1")) End If DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa) DdlVendedor.DataBind() + DdlVendedorFiltro.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa) + DdlVendedorFiltro.DataBind() + DdlVendedorFiltro.Items.Insert(0, New ListItem("Todos", "-1")) + UpModal.Update() End Sub Private Sub CargaDatos() + Dim CveCliente As Integer = -1 + If DdlClienteFiltro.SelectedValue.ToEntero() <= 0 Then + CveCliente = -1 + Else + CveCliente = DdlClienteFiltro.SelectedValue.ToEntero() + End If + Dim ObjGral As New ClsVentas - If ObjGral.GetAutorizacionLimite(UsuarioActual.CveEmpresa, -1, -1, CveEstatus:=DdlEstatus.SelectedValue.ToEntero()) Then + If ObjGral.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedorFiltro.SelectedValue.ToEntero(), CveEstatus:=DdlEstatus.SelectedValue.ToEntero()) Then GvDatos.DataSource = ObjGral.DtResultados End If ObjGral.Dispose() @@ -78,24 +95,18 @@ Partial Class Ventas_CatAutorizacionLimites ltlMotititulo.Text = "Agregar autorización" UpModal.Update() RegistraScript("$('#DModal').modal()") End Sub Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) - If DdlTipoDocto.SelectedValue = "Ing" AndAlso DdlTipoAutorizacion.SelectedValue.ToEntero() <= 0 Then + If DdlTipoAutorizacion.SelectedValue.ToEntero() <= 0 Then Alert("Debe seleccionar un tipo de autorización", TipoMensaje.MsgAdvertencia) Exit Sub End If Dim CveEstatus As Integer = 1 Dim TipoDocto As String = DdlTipoDocto.SelectedValue - Dim CveTipoAutorizacion As Integer = -1 + Dim CveTipoAutorizacion As Integer = DdlTipoAutorizacion.SelectedValue.ToEntero() - Select Case TipoDocto - Case "Ing" - CveTipoAutorizacion = DdlTipoAutorizacion.SelectedValue.ToEntero() - Case "Egs" - CveTipoAutorizacion = -1 - End Select Dim ObjPS As New ClsVentas - If ObjPS.AddAutorizacionLimite(UsuarioActual.CveEmpresa, DdlCliente.SelectedValue.ToEntero(), DdlVendedor.SelectedValue.ToEntero(), TxtPrecio.Text.ToDecimal(), CveEstatus, UsuarioActual.CveUsuario, CveAutorizacion, TipoDocto) Then + If ObjPS.AddAutorizacionLimite(UsuarioActual.CveEmpresa, DdlCliente.SelectedValue.ToEntero(), DdlVendedor.SelectedValue.ToEntero(), TxtPrecio.Text.ToDecimal(), CveEstatus, UsuarioActual.CveUsuario, CveTipoAutorizacion, TipoDocto) Then RegistraScript("$('#DModal').modal('hide')") Alert("La autorización se agregó correctamente.", TipoMensaje.MsgInformacion) End If @@ -166,7 +177,6 @@ Partial Class Ventas_CatAutorizacionLimites CargaDatos() End Sub - Protected Sub LnkRechazar_Click(sender As Object, e As EventArgs) Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) @@ -204,11 +214,12 @@ Partial Class Ventas_CatAutorizacionLimites Dim TipoDocto As String = DdlTipoDocto.SelectedValue.ToString() Select Case TipoDocto Case "Ing" - DivAutorizacion.Visible = True - DivImporte.Visible = True + If DdlTipoAutorizacion.Items.FindByValue("2") Is Nothing Then + DdlTipoAutorizacion.Items.Insert(0, New ListItem("Vencimiento", "2")) + End If Case "Egs" - DivAutorizacion.Visible = False - DivImporte.Visible = False + 'QUITAR LA DE VENCIMIENTO + DdlTipoAutorizacion.Items.Remove(DdlTipoAutorizacion.Items.FindByValue("2")) End Select UpModal.Update() End Sub diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index 185575920..44392143f 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -3938,7 +3938,7 @@ Partial Class Clientes DtCxCFact = If(DdlTipoCuentasCxC.SelectedValue = "-1", ObjMovtos.DtResultados.FiltraParametros("", "TipoDocto").Copy, ObjMovtos.DtResultados.FiltraParametros("Tipo = 'Act'", "TipoDocto")) 'cargo los anticipos NC DtCxCFact.Columns.Add("SaldoAnticipo", GetType(Decimal)) - + DtCxCFact.Columns.Add("TipoRNC", GetType(String)) Dim dtt As DataTable = Nothing If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, -1, -1) Then dtt = If(DdlTipoCuentasCxC.SelectedValue = "-1", ObjMovtos.DtResultados.FiltraParametros("SaldoVentaAnticipo = 0 AND ((Tipo = 'IxC' AND CveIE > 0) OR (Tipo = 'Ant' AND CveVenta > 0) OR (Tipo = 'NC' AND CveVenta > 0) OR (Tipo = 'Egs' AND CveVenta > 0) OR (Tipo = 'RNC' AND CveVenta > 0) )"), ObjMovtos.DtResultados.FiltraParametros("Saldo > 0 AND SaldoVentaAnticipo = 0 AND ((Tipo = 'IxC' AND CveIE > 0) OR (Tipo = 'Ant' AND CveVenta > 0) OR (Tipo = 'NC' AND CveVenta > 0) OR (Tipo = 'Egs' AND CveVenta > 0) OR (Tipo = 'RNC' AND CveVenta > 0) )")) ' que tenga saldo de anticipo y no de cliente @@ -3954,7 +3954,8 @@ Partial Class Clientes drr("SaldoAnticipo") = drt("Saldo") drr("Fecha") = drt("Fecha") drr("Moneda") = drt("Moneda") - drr("CveMoneda") = drt("CveMoneda") + drr("CveMoneda") = drt("CveMoneda") + drr("TipoRNC") = If(drt("Tipo").ToString() = "RNC", If(drt("TipoRNC").ToString() = "2", "Bonificación", "Cargo"), "") DtCxCFact.Rows.Add(drr) Next diff --git a/Ventas/ClientesAbonar.aspx.vb b/Ventas/ClientesAbonar.aspx.vb index b105daf3f..17b13577e 100644 --- a/Ventas/ClientesAbonar.aspx.vb +++ b/Ventas/ClientesAbonar.aspx.vb @@ -875,7 +875,7 @@ Partial Class Ventas_ClientesAbonar Select Case ConceptoContable Case 2 'Pago Cliente - 'If gvr.DataKey("CveMoneda").ToEntero > 1 Then ConceptoContable = 292 + If gvr.DataKey("CveMoneda").ToEntero > 1 Then ConceptoContable = 292 If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then ImporteMovimiento = gvr.FCTextBox("TxtAbonar").Text.ToDecimal importeMX = ImporteMovimiento @@ -889,8 +889,8 @@ Partial Class Ventas_ClientesAbonar ImporteMovimiento = gvr.FCTextBox("TxtAbonar").Text.ToDecimal importeMX = ImporteMovimiento * tipoCambioVentaValuacion End If - ImporteMovimiento = Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero) - importeMX = Math.Round(importeMX, 2, MidpointRounding.AwayFromZero) + ImporteMovimiento = ImporteMovimiento.RoundSQL + importeMX = importeMX.RoundSQL TipoCambioGeneral = tipoCambioVentaValuacion CveSubProyectoContabilizar = CveSubProyecto @@ -900,7 +900,7 @@ Partial Class Ventas_ClientesAbonar Else ConceptoMovimiento += $" TC:{tipoCambioVentaValuacion} ${ImporteMovimiento.FormatoNumero(2)}" IdCtaContable = If(EsAnticipoEspecial, IdCtaContMonedaComplementariaAnticipo, IdCtaContComplementaria) - If ImporteMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsuarioActual.CveEmpresa.Contiene(119, 158)) Then + If ImporteMovimiento <> 0 Then importeMX = ImporteMovimiento If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, 0, Referencia, If(gvr.DataKey("TipoDocto") = "Ant" AndAlso UsuarioActual.CveEmpresa.Contiene(119, 158), 226, 207), ConceptoMovimiento, FechaMovimiento, IdCtaContable, -1, CveIE, gvr.FCHyperLink("HplF2").Text.ToEntero, -1, CveSubProyectoContabilizar, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=(ImporteMovimiento * tipoCambioVentaValuacion - ImporteMovimiento).RoundSQL, ImporteME:=ImporteMovimiento, TipoCambio:=tipoCambioVentaValuacion) Then MsgError = "No se pudo insertar la póliza" @@ -1499,31 +1499,31 @@ Partial Class Ventas_ClientesAbonar CveSubProyectoContabilizar = CveSubProyectoMaximo If tipoCambioPago > 1 AndAlso CveMoneda = 2 Then - If IdCuentaBancariaComplementaria > 0 Then - If CveMoneda = 2 AndAlso CveMonedaFiltro = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES - tipoCambioPago = TxtTCDolares.Text.ToDecimal - ElseIf CveMoneda = 2 AndAlso CveMonedaFiltro = 2 Then - tipoCambioPago = TxtTCDolaresDolares.Text.ToDecimal - End If - - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, TxtImporte.Text.ToDecimal, ObjIE.Folio, 30, TxtObservaciones.Text + If(CveMoneda = 2, $" TC:{tipoCambioPago}", ""), TxtFechaDocumento.Text, IdCuentaBancaria, -1, CveIE, -1, -1, CveSubProyectoContabilizar, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=TxtImporte.Text.Trim.ToDecimal, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago) Then - MsgError = "No se pudo insertar la póliza" - End If - - If MsgError = "" AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, If(CveMoneda = 1 AndAlso TxtTC.Visible, TxtImporte.Text.ToDecimal / TxtTC.Text.ToDecimal, TxtImporte.Text.ToDecimal), TxtObservaciones.Text, 204, TxtObservaciones.Text + If(CveMoneda = 2, $" TC:{tipoCambioPago}", ""), TxtFechaDocumento.Text, IdCuentaBancariaComplementaria, -1, CveIE, -1, -1, CveSubProyectoContabilizar, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=If(CveMoneda = 2, (TxtImporte.Text.Trim.ToDecimal * tipoCambioPago) - TxtImporte.Text.Trim.ToDecimal, TxtImporte.Text.Trim.ToDecimal), ImporteME:=If(CveMoneda = 2, TxtImporte.Text.Trim.ToDecimal, 0), TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago) Then - MsgError = "No se pudo insertar la póliza" - End If - Else - If CveMoneda = 2 AndAlso CveMonedaFiltro = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES - tipoCambioPago = TxtTCDolares.Text.ToDecimal - ElseIf CveMoneda = 2 AndAlso CveMonedaFiltro = 2 Then - tipoCambioPago = TxtTCDolaresDolares.Text.ToDecimal - End If - - If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, TxtImporte.Text.ToDecimal, ObjIE.Folio, 30, TxtObservaciones.Text + If(CveMoneda = 2, $" TC:{tipoCambioPago}", ""), TxtFechaDocumento.Text, IdCuentaBancaria, -1, CveIE, -1, -1, CveSubProyectoContabilizar, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=If(CveMoneda = 2, TxtImporte.Text.Trim.ToDecimal * tipoCambioPago, TxtImporte.Text.Trim.ToDecimal), ImporteME:=If(CveMoneda = 2, TxtImporte.Text.ToDecimal, 0), TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago) Then - MsgError = "No se pudo insertar la póliza" - End If + 'If IdCuentaBancariaComplementaria > 0 Then + If CveMoneda = 2 AndAlso CveMonedaFiltro = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES + tipoCambioPago = TxtTCDolares.Text.ToDecimal + ElseIf CveMoneda = 2 AndAlso CveMonedaFiltro = 2 Then + tipoCambioPago = TxtTCDolaresDolares.Text.ToDecimal End If + + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, TxtImporte.Text.ToDecimal, ObjIE.Folio, 30, TxtObservaciones.Text + If(CveMoneda = 2, $" TC:{tipoCambioPago}", ""), TxtFechaDocumento.Text, IdCuentaBancaria, -1, CveIE, -1, -1, CveSubProyectoContabilizar, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=TxtImporte.Text.Trim.ToDecimal, TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago) Then + MsgError = "No se pudo insertar la póliza" + End If + + If MsgError = "" AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, If(CveMoneda = 1 AndAlso TxtTC.Visible, TxtImporte.Text.ToDecimal / TxtTC.Text.ToDecimal, TxtImporte.Text.ToDecimal), TxtObservaciones.Text, 204, TxtObservaciones.Text + If(CveMoneda = 2, $" TC:{tipoCambioPago}", ""), TxtFechaDocumento.Text, IdCuentaBancariaComplementaria, -1, CveIE, -1, -1, CveSubProyectoContabilizar, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=If(CveMoneda = 2, (TxtImporte.Text.Trim.ToDecimal * tipoCambioPago) - TxtImporte.Text.Trim.ToDecimal, TxtImporte.Text.Trim.ToDecimal), ImporteME:=If(CveMoneda = 2, TxtImporte.Text.Trim.ToDecimal, 0), TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago) Then + MsgError = "No se pudo insertar la póliza" + End If + 'Else + ' If CveMoneda = 2 AndAlso CveMonedaFiltro = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES + ' tipoCambioPago = TxtTCDolares.Text.ToDecimal + ' ElseIf CveMoneda = 2 AndAlso CveMonedaFiltro = 2 Then + ' tipoCambioPago = TxtTCDolaresDolares.Text.ToDecimal + ' End If + + ' If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, TxtImporte.Text.ToDecimal, ObjIE.Folio, 30, TxtObservaciones.Text + If(CveMoneda = 2, $" TC:{tipoCambioPago}", ""), TxtFechaDocumento.Text, IdCuentaBancaria, -1, CveIE, -1, -1, CveSubProyectoContabilizar, ViewState("CveCliente").ToString.ToEntero, ImporteMX:=If(CveMoneda = 2, TxtImporte.Text.Trim.ToDecimal * tipoCambioPago, TxtImporte.Text.Trim.ToDecimal), ImporteME:=If(CveMoneda = 2, TxtImporte.Text.ToDecimal, 0), TipoCambio:=tipoCambioPago, TipoCambioPago:=tipoCambioPago) Then + ' MsgError = "No se pudo insertar la póliza" + ' End If + 'End If Else If CveMoneda = 2 AndAlso CveMonedaFiltro = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES tipoCambioPago = TxtTCDolares.Text.ToDecimal @@ -2579,7 +2579,6 @@ Partial Class Ventas_ClientesAbonar For Each gr As GridViewRow In GvCxC.Rows If gr.FCCheckBox("Chk").Checked Then Dim IdCtaContable As Integer = IdCuentaCliente - Dim CveCuenta As Integer = 0 Dim PorcentajePago As Decimal = gr.DataKey("Saldo").ToDecimal / gr.DataKey("Original").ToDecimal Dim Saldo As Decimal = gr.DataKey("Saldo").ToDecimal Dim RETIVA As Decimal = gr.DataKey("RetIVA").ToDecimal @@ -2648,16 +2647,16 @@ Partial Class Ventas_ClientesAbonar If UsaComplementaria AndAlso tCveMoneda = 2 Then 'normal - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, Saldo, gr.DataKey("SerieFolio").ToString, CveConceptoCliente, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=IdCtaContable, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, Saldo, Saldo), CveCuenta:=CveCuenta, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, Saldo, gr.DataKey("SerieFolio").ToString, CveConceptoCliente, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=IdCtaContable, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, Saldo, Saldo), TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then MsgError = "Ocurrio un error al saldar el movimiento" End If 'complementaria - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, 0, gr.DataKey("SerieFolio").ToString, 207, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=IdCtaContComplementaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, Saldo, (Saldo * TCVenta) - Saldo).RoundSQL, ImporteME:=Saldo, CveCuenta:=CveCuenta, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, 0, gr.DataKey("SerieFolio").ToString, 207, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=IdCtaContComplementaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, Saldo, (Saldo * TCVenta) - Saldo).RoundSQL, ImporteME:=Saldo, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then MsgError = "Ocurrio un error al saldar el movimiento" End If Else - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, Saldo, gr.DataKey("SerieFolio").ToString, CveConceptoCliente, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=IdCtaContable, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, Saldo, Saldo * TCVenta), CveCuenta:=CveCuenta, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, Saldo, gr.DataKey("SerieFolio").ToString, CveConceptoCliente, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=IdCtaContable, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, Saldo, Saldo * TCVenta), TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then MsgError = "Ocurrio un error al saldar el movimiento" End If @@ -2673,11 +2672,11 @@ Partial Class Ventas_ClientesAbonar End If If TCPago > TCVenta Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Math.Abs(ImporteFluctuacion), gr.DataKey("SerieFolio").ToString, 64, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=UsuarioActual.Empresa.IdCuentaGananciaCambiaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=Math.Abs(ImporteFluctuacion), CveCuenta:=CveCuenta, TipoCambio:=TCVenta, TipoCambioPago:=TCPago, CveSubProyecto:=CveSubProyecto) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Math.Abs(ImporteFluctuacion), gr.DataKey("SerieFolio").ToString, 64, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=UsuarioActual.Empresa.IdCuentaGananciaCambiaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=Math.Abs(ImporteFluctuacion), TipoCambio:=TCVenta, TipoCambioPago:=TCPago, CveSubProyecto:=CveSubProyecto) Then MsgError = "Ocurrio un error al saldar el movimiento" End If Else - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Math.Abs(ImporteFluctuacion), gr.DataKey("SerieFolio").ToString, 65, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=UsuarioActual.Empresa.IdCuentaPerdidaCambiaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=Math.Abs(ImporteFluctuacion), CveCuenta:=CveCuenta, TipoCambio:=TCVenta, TipoCambioPago:=TCPago, CveSubProyecto:=CveSubProyecto) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Math.Abs(ImporteFluctuacion), gr.DataKey("SerieFolio").ToString, 65, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable:=UsuarioActual.Empresa.IdCuentaPerdidaCambiaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=Math.Abs(ImporteFluctuacion), TipoCambio:=TCVenta, TipoCambioPago:=TCPago, CveSubProyecto:=CveSubProyecto) Then MsgError = "Ocurrio un error al saldar el movimiento" End If End If @@ -2700,19 +2699,17 @@ Partial Class Ventas_ClientesAbonar End If IdCtaContable = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar) - CveCuenta = If(CveCuentaIVAxTrasladar > 0, CveCuentaIVAxTrasladar, UsuarioActual.Empresa.CveCuentaIVAxTrasladar) - If (IVA > 0 Or UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12, 122) And IVA < 0) AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ImpuestosMovto, IVA, gr.DataKey("SerieFolio").ToString, 13, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable, -1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, IVA, IVA * TCVenta), CveCuenta:=CveCuenta, PorcentajeImpuesto:=PorcentajeImpuesto, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then + If (IVA > 0 Or UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12, 122) And IVA < 0) AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ImpuestosMovto, IVA, gr.DataKey("SerieFolio").ToString, 13, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable, -1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, IVA, IVA * TCVenta), PorcentajeImpuesto:=PorcentajeImpuesto, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then MsgError = "Ocurrio un error al saldar el movimiento" End If - If (RETIVA > 0 Or UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12, 122) And RETIVA < 0) AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, RETIVA, gr.DataKey("SerieFolio").ToString, 8, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContRetIVA, -1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, RETIVA, RETIVA * TCVenta), CveCuenta:=CveCuenta, PorcentajeImpuesto:=PorcentajeImpuesto, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then + If (RETIVA > 0 Or UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12, 122) And RETIVA < 0) AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, RETIVA, gr.DataKey("SerieFolio").ToString, 8, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContRetIVA, -1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, RETIVA, RETIVA * TCVenta), PorcentajeImpuesto:=PorcentajeImpuesto, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then MsgError = "Ocurrio un error al saldar el movimiento" End If IdCtaContable = UsuarioActual.Empresa.IdCuentaIEPSxTrasladar - CveCuenta = UsuarioActual.Empresa.CveCuentaIEPSxTrasladar - If IEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ImpuestosMovto, IEPS, gr.DataKey("SerieFolio").ToString, 38, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable, -1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, IEPS, IEPS * TCVenta), CveCuenta:=CveCuenta, PorcentajeImpuesto:=PorcentajeImpuesto, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then + If IEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ImpuestosMovto, IEPS, gr.DataKey("SerieFolio").ToString, 38, ConceptoPartida, TxtFechaIncobrable.Text.ToDate, IdCtaContable, -1, CveCliente:=gr.DataKey("CveCliente").ToEntero, CveVenta:=gr.DataKey("CveVenta").ToEntero, ImporteMX:=If(CveMonedaFiltro = 1, IEPS, IEPS * TCVenta), PorcentajeImpuesto:=PorcentajeImpuesto, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then MsgError = "Ocurrio un error al saldar el movimiento" End If diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb index f01634812..8208b730d 100644 --- a/Ventas/PV.aspx.vb +++ b/Ventas/PV.aspx.vb @@ -168,7 +168,7 @@ Partial Class PV Private ReadOnly Property CveVenta As Integer Get - Return ViewState("CveVenta").ToString.ToEntero + Return If(IsNothing(ViewState("CveVenta")), -1, ViewState("CveVenta").ToString.ToEntero) End Get End Property @@ -1008,6 +1008,7 @@ Partial Class PV Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then + ViewState("CveVenta") = -1 'VERIFICAR SI LA SESION SE ENCUENTRA BLOQUEADA If UsuarioActual.Empresa.Funcionalidad(599) = "1" Then Dim DrUsuario As DataRow = GlobalDTUsuarios(CveUsuario:=UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0) @@ -7111,7 +7112,7 @@ Partial Class PV Dim TotalCargos As Decimal = 0 Dim TotalCantidad As Decimal = 0 Dim StrTamanios As New StringBuilder() - StrTamanios.Append("Se recibierón los siguientes usados:") + StrTamanios.Append("Se recibieron los siguientes usados:") 'For Each Gvr As GridViewRow In Gv.Rows ' If Gvr.RowType = DataControlRowType.DataRow Then diff --git a/Ventas/Promociones.aspx b/Ventas/Promociones.aspx index b0f322748..581e8f021 100644 --- a/Ventas/Promociones.aspx +++ b/Ventas/Promociones.aspx @@ -254,7 +254,7 @@
    - + @@ -272,7 +272,7 @@
    -
    +
    @@ -287,9 +287,9 @@
    - + - +
    diff --git a/Ventas/Promociones.aspx.vb b/Ventas/Promociones.aspx.vb index c3a6844b2..5b7812691 100644 --- a/Ventas/Promociones.aspx.vb +++ b/Ventas/Promociones.aspx.vb @@ -104,7 +104,7 @@ Partial Class Ventas_Promociones DdlMarca.Items.Insert(0, New ListItem("Todos", "-1")) If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then - GvDatos.Columns(7).Visible = True + GvDatos.Columns(8).Visible = True DivRin.Visible = True Dim ObjGral As New ClsGenerales If ObjGral.GetRimTamanios(UsuarioActual.CveEmpresa) Then @@ -235,7 +235,7 @@ Partial Class Ventas_Promociones LbPUActual.Text = "" DdlTipoPromocion.SelectedValue = "-1" TxtPromocionConcepto.Text = "" - TxtCantMinima.Text = "" + TxtCantMinima.Text = "1" ChkRestricciones.Checked = False 'DivRestricciones.Visible = False @@ -259,6 +259,11 @@ Partial Class Ventas_Promociones Exit Sub End If + If TxtCantMinima.Text.ToEntero <= 0 Then + Alert("La cantidad minima debe ser de 1", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + Dim Dr As DataRow = Nothing If CveConsecutivo >= 0 Then @@ -291,11 +296,7 @@ Partial Class Ventas_Promociones Dr("PUPromocion") = LbPUActual.Text.ToDecimal - (LbPUActual.Text.ToDecimal * TxtPromocionConcepto.Text.ToDecimal / 100) End If - If DdlTipoPromocion.SelectedValue.ToEntero = 3 Then - Dr("CantidadMinima") = TxtCantMinima.Text.ToEntero - Else - Dr("CantidadMinima") = 1 - End If + Dr("CantidadMinima") = TxtCantMinima.Text.ToEntero If ChkRestricciones.Checked Then Dr("AplicaRestriccionTexto") = "Si" @@ -369,7 +370,7 @@ Partial Class Ventas_Promociones LbPUActual.Text = Gvr.DataKey("PUAnterior").FormatoNumero DdlTipoPromocion.SelectedValue = Gvr.DataKey("CveTipoPromocion") - DdlTipoPromocion_SelectedIndexChanged(sender, Nothing) + 'DdlTipoPromocion_SelectedIndexChanged(sender, Nothing) TxtPromocionConcepto.Text = Gvr.DataKey("Promocion").FormatoNumero(4) TxtCantMinima.Text = Gvr.DataKey("CantidadMinima") @@ -533,11 +534,11 @@ Partial Class Ventas_Promociones End Sub #End Region - Protected Sub DdlTipoPromocion_SelectedIndexChanged(sender As Object, e As EventArgs) - If DdlTipoPromocion.SelectedValue = "3" Then - DivCantMinima.Visible = True - Else - DivCantMinima.Visible = False - End If - End Sub + 'Protected Sub DdlTipoPromocion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoPromocion.SelectedIndexChanged + ' If DdlTipoPromocion.SelectedValue = "3" Then + ' DivCantMinima.Visible = True + ' Else + ' DivCantMinima.Visible = False + ' End If + 'End Sub End Class \ No newline at end of file diff --git a/Ventas/RepPS.aspx.vb b/Ventas/RepPS.aspx.vb index 7ff45a9fe..01cb8f2ba 100644 --- a/Ventas/RepPS.aspx.vb +++ b/Ventas/RepPS.aspx.vb @@ -254,644 +254,675 @@ Partial Class Ventas_RepPS ObjVentas.Dispose() If DataSet IsNot Nothing Then - SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet) + Try + SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet) - Dim FileExcel As New ExcelFile() + Dim FileExcel As New ExcelFile() - Dim worksheetName As String = $"{ToShortMonthName(FechaConsulta).ToUpper()}{FechaConsulta.Day}" - Const invalidCharsRegex As String = "[/\\*'?[\]:]+" - Const maxLength As Integer = 31 - Dim safeName As String = Regex.Replace(worksheetName, invalidCharsRegex, " ").Replace(" ", " ").Trim() + Dim worksheetName As String = $"{ToShortMonthName(FechaConsulta).ToUpper()}{FechaConsulta.Day}" + Const invalidCharsRegex As String = "[/\\*'?[\]:]+" + Const maxLength As Integer = 31 + Dim safeName As String = Regex.Replace(worksheetName, invalidCharsRegex, " ").Replace(" ", " ").Trim() - If String.IsNullOrEmpty(safeName) Then - safeName = "RepPSDiario" ' cannot be empty - ElseIf safeName.Length > maxLength Then - safeName = safeName.Substring(0, maxLength) - End If - - Dim worksheet = FileExcel.Worksheets.Add(safeName) - - Dim CellRangeTitulo = worksheet.Cells.GetSubrangeAbsolute(0, 0, 0, 12) - CellRangeTitulo.Merged = True - CellRangeTitulo.Value = $"{UsuarioActual.Empresa.Empresa}. VENTA DEL DIA {FechaConsulta.Day} DE {ToMonthName(FechaConsulta).ToUpper()} DEL {FechaConsulta.Year}." - CellRangeTitulo.Style.VerticalAlignment = VerticalAlignmentStyle.Center - CellRangeTitulo.Style.HorizontalAlignment = HorizontalAlignmentStyle.Center - -#Region "V E N T A S - L L A N T A S, R I N E S, A L I N E A C I O N E S" - Dim CeldaTotalVentaAcumulada As ExcelCell = Nothing - - worksheet.Cells(2, 0).Value = "Sucursal" - 'TITULO DE LLANTAS - worksheet.Cells.GetSubrangeAbsolute(1, 1, 1, 3).Merged = True - worksheet.Cells(1, 3).Value = "LLANTAS" - worksheet.Cells(2, 1).Value = "Ant" - worksheet.Cells(2, 2).Value = "Dia" - worksheet.Cells(2, 3).Value = "Acum" - 'TITULO DE RINES - worksheet.Cells.GetSubrangeAbsolute(1, 4, 1, 6).Merged = True - worksheet.Cells(1, 6).Value = "RINES" - worksheet.Cells(2, 4).Value = "Ant" - worksheet.Cells(2, 5).Value = "Dia" - worksheet.Cells(2, 6).Value = "Acum" - 'TITULO DE ALINEACIONES - worksheet.Cells.GetSubrangeAbsolute(1, 7, 1, 9).Merged = True - worksheet.Cells(1, 9).Value = "ALINEACIONES" - worksheet.Cells(2, 7).Value = "Ant" - worksheet.Cells(2, 8).Value = "Dia" - worksheet.Cells(2, 9).Value = "Acum" - 'TITULO DE VENTAS DEL DIA - worksheet.Cells.GetSubrangeAbsolute(1, 10, 1, 12).Merged = True - worksheet.Cells(1, 12).Value = "VENTA EN PESOS" - worksheet.Cells(2, 10).Value = "Ant" - worksheet.Cells(2, 11).Value = "Dia" - worksheet.Cells(2, 12).Value = "Acum" - - Dim StyleTitleTable1 = worksheet.Cells.GetSubrangeAbsolute(1, 1, 1, 12).Style - StyleTitleTable1.Font.Weight = ExcelFont.BoldWeight - StyleTitleTable1.Font.Name = "Calibri" - StyleTitleTable1.Font.Size = 8 * 20 - StyleTitleTable1.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - StyleTitleTable1.VerticalAlignment = VerticalAlignmentStyle.Center - StyleTitleTable1.HorizontalAlignment = HorizontalAlignmentStyle.Center - - Dim StyleSubTitleTable1 = worksheet.Cells.GetSubrangeAbsolute(2, 0, 2, 12).Style - StyleSubTitleTable1.Font.Weight = ExcelFont.BoldWeight - StyleSubTitleTable1.Font.Name = "Calibri" - StyleSubTitleTable1.Font.Size = 8 * 20 - StyleSubTitleTable1.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - StyleSubTitleTable1.VerticalAlignment = VerticalAlignmentStyle.Center - StyleSubTitleTable1.HorizontalAlignment = HorizontalAlignmentStyle.Center - - Dim DtSucursalesLLantasAlin As DataTable = DataSet.Tables(0) - - 'INICIA DESDE LA CUARTA FILA - Dim IdxSucursalesLlantasAlin As Integer = 3 - Dim idxTabla As Integer = 0 - For Each Row As DataRow In DtSucursalesLLantasAlin.Rows - idxTabla += 1 - worksheet.Cells(IdxSucursalesLlantasAlin, 0).Value = Row("SubProyecto") - - worksheet.Cells(IdxSucursalesLlantasAlin, 1).Value = Row("LlantasCantidadAnterior") - worksheet.Cells(IdxSucursalesLlantasAlin, 2).Value = Row("LlantasCantidadDia") - 'worksheet.Cells(IdxSucursalesLlantasAlin, 3).Value = Row("LlantasCantidadAcumulada") - worksheet.Cells(IdxSucursalesLlantasAlin, 3).Formula = $"=SUM({worksheet.Cells(IdxSucursalesLlantasAlin, 1).Name}:{worksheet.Cells(IdxSucursalesLlantasAlin, 2).Name})" - - worksheet.Cells(IdxSucursalesLlantasAlin, 4).Value = Row("RinCantidadAnterior") - worksheet.Cells(IdxSucursalesLlantasAlin, 5).Value = Row("RinCantidadDia") - 'worksheet.Cells(IdxSucursalesLlantasAlin, 6).Value = Row("RinCantidadAcumulada") - worksheet.Cells(IdxSucursalesLlantasAlin, 6).Formula = $"=SUM({worksheet.Cells(IdxSucursalesLlantasAlin, 4).Name}:{worksheet.Cells(IdxSucursalesLlantasAlin, 5).Name})" - - worksheet.Cells(IdxSucursalesLlantasAlin, 7).Value = Row("AlinCantidadAnterior") - worksheet.Cells(IdxSucursalesLlantasAlin, 8).Value = Row("AlinCantidadDia") - 'worksheet.Cells(IdxSucursalesLlantasAlin, 9).Value = Row("AlinCantidadAcumulada") - worksheet.Cells(IdxSucursalesLlantasAlin, 9).Formula = $"=SUM({worksheet.Cells(IdxSucursalesLlantasAlin, 7).Name}:{worksheet.Cells(IdxSucursalesLlantasAlin, 8).Name})" - - worksheet.Cells(IdxSucursalesLlantasAlin, 10).Value = Row("VentaAnterior") - worksheet.Cells(IdxSucursalesLlantasAlin, 11).Value = Row("VentaDia") - 'worksheet.Cells(IdxSucursalesLlantasAlin, 12).Value = Row("VentaAcumulada") - worksheet.Cells(IdxSucursalesLlantasAlin, 12).Formula = $"=SUM({worksheet.Cells(IdxSucursalesLlantasAlin, 10).Name}:{worksheet.Cells(IdxSucursalesLlantasAlin, 11).Name})" - - If idxTabla = DtSucursalesLLantasAlin.Rows.Count Then - CeldaTotalVentaAcumulada = worksheet.Cells(IdxSucursalesLlantasAlin, 12) + If String.IsNullOrEmpty(safeName) Then + safeName = "RepPSDiario" ' cannot be empty + ElseIf safeName.Length > maxLength Then + safeName = safeName.Substring(0, maxLength) End If - Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxSucursalesLlantasAlin, 0, IdxSucursalesLlantasAlin, 12).Style - StyleData.Font.Weight = ExcelFont.BoldWeight - StyleData.Font.Name = "Calibri" - StyleData.Font.Size = 8 * 20 - StyleData.VerticalAlignment = VerticalAlignmentStyle.Center - StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center - StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - StyleData.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-" + Dim worksheet = FileExcel.Worksheets.Add(safeName) - 'LAS VENTAS DEL DIA NO DEBEN ESTAR EN NEGRITAS - worksheet.Cells(IdxSucursalesLlantasAlin, 0).Style.Font.Weight = ExcelFont.NormalWeight - worksheet.Cells(IdxSucursalesLlantasAlin, 0).Style.HorizontalAlignment = HorizontalAlignmentStyle.Left + Dim CellRangeTitulo = worksheet.Cells.GetSubrangeAbsolute(0, 0, 0, 12) + CellRangeTitulo.Merged = True + CellRangeTitulo.Value = $"{UsuarioActual.Empresa.Empresa}. VENTA DEL DIA {FechaConsulta.Day} DE {ToMonthName(FechaConsulta).ToUpper()} DEL {FechaConsulta.Year}." + CellRangeTitulo.Style.VerticalAlignment = VerticalAlignmentStyle.Center + CellRangeTitulo.Style.HorizontalAlignment = HorizontalAlignmentStyle.Center - worksheet.Cells(IdxSucursalesLlantasAlin, 2).Style.Font.Weight = ExcelFont.NormalWeight - worksheet.Cells(IdxSucursalesLlantasAlin, 5).Style.Font.Weight = ExcelFont.NormalWeight - worksheet.Cells(IdxSucursalesLlantasAlin, 8).Style.Font.Weight = ExcelFont.NormalWeight - worksheet.Cells(IdxSucursalesLlantasAlin, 11).Style.Font.Weight = ExcelFont.NormalWeight +#Region "V E N T A S - L L A N T A S, R I N E S, A L I N E A C I O N E S" + Dim CeldaTotalVentaAcumulada As ExcelCell = Nothing - IdxSucursalesLlantasAlin += 1 - Next - 'LA FILA DE LOS TOTALES DEBE ESTAR EN NEGITAS - worksheet.Cells.GetSubrangeAbsolute(IdxSucursalesLlantasAlin - 1, 0, IdxSucursalesLlantasAlin - 1, 12).Style.Font.Weight = ExcelFont.BoldWeight + worksheet.Cells(2, 0).Value = "Sucursal" + 'TITULO DE LLANTAS + worksheet.Cells.GetSubrangeAbsolute(1, 1, 1, 3).Merged = True + worksheet.Cells(1, 3).Value = "LLANTAS" + worksheet.Cells(2, 1).Value = "Ant" + worksheet.Cells(2, 2).Value = "Dia" + worksheet.Cells(2, 3).Value = "Acum" + 'TITULO DE RINES + worksheet.Cells.GetSubrangeAbsolute(1, 4, 1, 6).Merged = True + worksheet.Cells(1, 6).Value = "RINES" + worksheet.Cells(2, 4).Value = "Ant" + worksheet.Cells(2, 5).Value = "Dia" + worksheet.Cells(2, 6).Value = "Acum" + 'TITULO DE ALINEACIONES + worksheet.Cells.GetSubrangeAbsolute(1, 7, 1, 9).Merged = True + worksheet.Cells(1, 9).Value = "ALINEACIONES" + worksheet.Cells(2, 7).Value = "Ant" + worksheet.Cells(2, 8).Value = "Dia" + worksheet.Cells(2, 9).Value = "Acum" + 'TITULO DE VENTAS DEL DIA + worksheet.Cells.GetSubrangeAbsolute(1, 10, 1, 12).Merged = True + worksheet.Cells(1, 12).Value = "VENTA EN PESOS" + worksheet.Cells(2, 10).Value = "Ant" + worksheet.Cells(2, 11).Value = "Dia" + worksheet.Cells(2, 12).Value = "Acum" + + Dim StyleTitleTable1 = worksheet.Cells.GetSubrangeAbsolute(1, 1, 1, 12).Style + StyleTitleTable1.Font.Weight = ExcelFont.BoldWeight + StyleTitleTable1.Font.Name = "Calibri" + StyleTitleTable1.Font.Size = 8 * 20 + StyleTitleTable1.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleTitleTable1.VerticalAlignment = VerticalAlignmentStyle.Center + StyleTitleTable1.HorizontalAlignment = HorizontalAlignmentStyle.Center + + Dim StyleSubTitleTable1 = worksheet.Cells.GetSubrangeAbsolute(2, 0, 2, 12).Style + StyleSubTitleTable1.Font.Weight = ExcelFont.BoldWeight + StyleSubTitleTable1.Font.Name = "Calibri" + StyleSubTitleTable1.Font.Size = 8 * 20 + StyleSubTitleTable1.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleSubTitleTable1.VerticalAlignment = VerticalAlignmentStyle.Center + StyleSubTitleTable1.HorizontalAlignment = HorizontalAlignmentStyle.Center + + Dim DtSucursalesLLantasAlin As DataTable = DataSet.Tables(0) + + 'INICIA DESDE LA CUARTA FILA + Dim IdxSucursalesLlantasAlin As Integer = 3 + Dim idxTabla As Integer = 0 + For Each Row As DataRow In DtSucursalesLLantasAlin.Rows + idxTabla += 1 + worksheet.Cells(IdxSucursalesLlantasAlin, 0).Value = Row("SubProyecto") + + worksheet.Cells(IdxSucursalesLlantasAlin, 1).Value = Row("LlantasCantidadAnterior") + worksheet.Cells(IdxSucursalesLlantasAlin, 2).Value = Row("LlantasCantidadDia") + 'worksheet.Cells(IdxSucursalesLlantasAlin, 3).Value = Row("LlantasCantidadAcumulada") + worksheet.Cells(IdxSucursalesLlantasAlin, 3).Formula = $"=SUM({worksheet.Cells(IdxSucursalesLlantasAlin, 1).Name}:{worksheet.Cells(IdxSucursalesLlantasAlin, 2).Name})" + + worksheet.Cells(IdxSucursalesLlantasAlin, 4).Value = Row("RinCantidadAnterior") + worksheet.Cells(IdxSucursalesLlantasAlin, 5).Value = Row("RinCantidadDia") + 'worksheet.Cells(IdxSucursalesLlantasAlin, 6).Value = Row("RinCantidadAcumulada") + worksheet.Cells(IdxSucursalesLlantasAlin, 6).Formula = $"=SUM({worksheet.Cells(IdxSucursalesLlantasAlin, 4).Name}:{worksheet.Cells(IdxSucursalesLlantasAlin, 5).Name})" + + worksheet.Cells(IdxSucursalesLlantasAlin, 7).Value = Row("AlinCantidadAnterior") + worksheet.Cells(IdxSucursalesLlantasAlin, 8).Value = Row("AlinCantidadDia") + 'worksheet.Cells(IdxSucursalesLlantasAlin, 9).Value = Row("AlinCantidadAcumulada") + worksheet.Cells(IdxSucursalesLlantasAlin, 9).Formula = $"=SUM({worksheet.Cells(IdxSucursalesLlantasAlin, 7).Name}:{worksheet.Cells(IdxSucursalesLlantasAlin, 8).Name})" + + worksheet.Cells(IdxSucursalesLlantasAlin, 10).Value = Row("VentaAnterior") + worksheet.Cells(IdxSucursalesLlantasAlin, 11).Value = Row("VentaDia") + 'worksheet.Cells(IdxSucursalesLlantasAlin, 12).Value = Row("VentaAcumulada") + worksheet.Cells(IdxSucursalesLlantasAlin, 12).Formula = $"=SUM({worksheet.Cells(IdxSucursalesLlantasAlin, 10).Name}:{worksheet.Cells(IdxSucursalesLlantasAlin, 11).Name})" + + If idxTabla = DtSucursalesLLantasAlin.Rows.Count Then + CeldaTotalVentaAcumulada = worksheet.Cells(IdxSucursalesLlantasAlin, 12) + End If + + Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxSucursalesLlantasAlin, 0, IdxSucursalesLlantasAlin, 9).Style + StyleData.Font.Weight = ExcelFont.BoldWeight + StyleData.Font.Name = "Calibri" + StyleData.Font.Size = 8 * 20 + StyleData.VerticalAlignment = VerticalAlignmentStyle.Center + StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center + StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleData.NumberFormat = "_-* 0_-;-* 0-;_-* ""-""??_-;_-@_-" + + Dim StyleDataVenta = worksheet.Cells.GetSubrangeAbsolute(IdxSucursalesLlantasAlin, 10, IdxSucursalesLlantasAlin, 12).Style + StyleDataVenta.Font.Weight = ExcelFont.BoldWeight + StyleDataVenta.Font.Name = "Calibri" + StyleDataVenta.Font.Size = 8 * 20 + StyleDataVenta.VerticalAlignment = VerticalAlignmentStyle.Center + StyleDataVenta.HorizontalAlignment = HorizontalAlignmentStyle.Center + StyleDataVenta.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleDataVenta.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-" + + 'LAS VENTAS DEL DIA NO DEBEN ESTAR EN NEGRITAS + worksheet.Cells(IdxSucursalesLlantasAlin, 0).Style.Font.Weight = ExcelFont.NormalWeight + worksheet.Cells(IdxSucursalesLlantasAlin, 0).Style.HorizontalAlignment = HorizontalAlignmentStyle.Left + + worksheet.Cells(IdxSucursalesLlantasAlin, 2).Style.Font.Weight = ExcelFont.NormalWeight + worksheet.Cells(IdxSucursalesLlantasAlin, 5).Style.Font.Weight = ExcelFont.NormalWeight + worksheet.Cells(IdxSucursalesLlantasAlin, 8).Style.Font.Weight = ExcelFont.NormalWeight + worksheet.Cells(IdxSucursalesLlantasAlin, 11).Style.Font.Weight = ExcelFont.NormalWeight + + IdxSucursalesLlantasAlin += 1 + Next + 'LA FILA DE LOS TOTALES DEBE ESTAR EN NEGITAS + worksheet.Cells.GetSubrangeAbsolute(IdxSucursalesLlantasAlin - 1, 0, IdxSucursalesLlantasAlin - 1, 12).Style.Font.Weight = ExcelFont.BoldWeight #End Region #Region "L L A N T A S M E S A Ñ O A N T E R I O R R E S U M E N" - Dim IdxRefMesAnioAnteriorLlantasResumen As Integer = IdxSucursalesLlantasAlin + 1 + Dim IdxRefMesAnioAnteriorLlantasResumen As Integer = IdxSucursalesLlantasAlin + 1 - worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 0).Value = "Mes" - worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 1).Value = String.Format("{0}", (FechaConsulta.Year - 1)) - worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 2).Value = String.Format("{0}", (FechaConsulta.Year)) - worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 3).Value = "DIF UDS" - worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 4).Value = "DIF %" + worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 0).Value = "Mes" + worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 1).Value = String.Format("{0}", (FechaConsulta.Year - 1)) + worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 2).Value = String.Format("{0}", (FechaConsulta.Year)) + worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 3).Value = "DIF UDS" + worksheet.Cells(IdxRefMesAnioAnteriorLlantasResumen, 4).Value = "DIF %" - Dim StyleTitleTable6 = worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantasResumen, 0, IdxRefMesAnioAnteriorLlantasResumen, 4).Style - StyleTitleTable6.Font.Weight = ExcelFont.BoldWeight - StyleTitleTable6.Font.Name = "Calibri" - StyleTitleTable6.Font.Size = 8 * 20 - StyleTitleTable6.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - StyleTitleTable6.VerticalAlignment = VerticalAlignmentStyle.Center - StyleTitleTable6.HorizontalAlignment = HorizontalAlignmentStyle.Center + Dim StyleTitleTable6 = worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantasResumen, 0, IdxRefMesAnioAnteriorLlantasResumen, 4).Style + StyleTitleTable6.Font.Weight = ExcelFont.BoldWeight + StyleTitleTable6.Font.Name = "Calibri" + StyleTitleTable6.Font.Size = 8 * 20 + StyleTitleTable6.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleTitleTable6.VerticalAlignment = VerticalAlignmentStyle.Center + StyleTitleTable6.HorizontalAlignment = HorizontalAlignmentStyle.Center - Dim DtMesAnioAnteriorLLantasResumen As DataTable = DataSet.Tables(5) - 'INICIA DESDE LA CUARTA FILA - Dim IdxMesAnioAnteriorLlantasResumen As Integer = IdxRefMesAnioAnteriorLlantasResumen + 1 + Dim DtMesAnioAnteriorLLantasResumen As DataTable = DataSet.Tables(5) + 'INICIA DESDE LA CUARTA FILA + Dim IdxMesAnioAnteriorLlantasResumen As Integer = IdxRefMesAnioAnteriorLlantasResumen + 1 - For Each Row As DataRow In DtMesAnioAnteriorLLantasResumen.Rows - worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 0).Value = ToMonthName(FechaConsulta).ToUpper() + " - LLANTAS" - worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Value = Row("LLantasAnioAnterior") - worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Value = Row("LLantas") - worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 3).Formula = $"=({worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Name} - {worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Name})" - worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 4).Formula = $"=+({worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Name} / {worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Name})" + For Each Row As DataRow In DtMesAnioAnteriorLLantasResumen.Rows + worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 0).Value = ToMonthName(FechaConsulta).ToUpper() + " - LLANTAS" + worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Value = Row("LLantasAnioAnterior") + worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Value = Row("LLantas") + worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 3).Formula = $"=({worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Name} - {worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Name})" + worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 4).Formula = $"=+({worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Name} / {worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Name})" - Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxMesAnioAnteriorLlantasResumen, 0, IdxMesAnioAnteriorLlantasResumen, 4).Style - StyleData.Font.Weight = ExcelFont.NormalWeight - StyleData.Font.Name = "Calibri" - StyleData.Font.Size = 8 * 20 - StyleData.VerticalAlignment = VerticalAlignmentStyle.Center - StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center - StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - StyleData.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-" + Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxMesAnioAnteriorLlantasResumen, 0, IdxMesAnioAnteriorLlantasResumen, 4).Style + StyleData.Font.Weight = ExcelFont.NormalWeight + StyleData.Font.Name = "Calibri" + StyleData.Font.Size = 8 * 20 + StyleData.VerticalAlignment = VerticalAlignmentStyle.Center + StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center + StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleData.NumberFormat = "_-* 0_-;-* 0-;_-* ""-""??_-;_-@_-" + + IdxMesAnioAnteriorLlantasResumen += 1 + Next IdxMesAnioAnteriorLlantasResumen += 1 - Next - IdxMesAnioAnteriorLlantasResumen += 1 + 'RESUMEN DE METAS + worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 0).Value = "Mes" + worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Value = "Meta" + worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Value = String.Format("{0}", (FechaConsulta.Year - 1)) + worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 3).Value = "DIF UDS" + worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 4).Value = "DIF %" - 'RESUMEN DE METAS - worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 0).Value = "Mes" - worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Value = "Meta" - worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Value = String.Format("{0}", (FechaConsulta.Year - 1)) - worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 3).Value = "DIF UDS" - worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 4).Value = "DIF %" - - Dim StyleTitleTableMeta = worksheet.Cells.GetSubrangeAbsolute(IdxMesAnioAnteriorLlantasResumen, 0, IdxMesAnioAnteriorLlantasResumen, 4).Style - StyleTitleTableMeta.Font.Weight = ExcelFont.BoldWeight - StyleTitleTableMeta.Font.Name = "Calibri" - StyleTitleTableMeta.Font.Size = 8 * 20 - StyleTitleTableMeta.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - StyleTitleTableMeta.VerticalAlignment = VerticalAlignmentStyle.Center - StyleTitleTableMeta.HorizontalAlignment = HorizontalAlignmentStyle.Center - - IdxMesAnioAnteriorLlantasResumen += 1 - - For Each Row As DataRow In DtMesAnioAnteriorLLantasResumen.Rows - worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 0).Value = ToMonthName(FechaConsulta).ToUpper() + " - LLANTAS" - worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Value = 0 - worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Value = Row("LLantasAnioAnterior") - worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 3).Formula = $"=({worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Name} - {worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Name})" - worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 4).Formula = $"=+({worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Name} / {worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Name})" - - Dim StyleDataMeta = worksheet.Cells.GetSubrangeAbsolute(IdxMesAnioAnteriorLlantasResumen, 0, IdxMesAnioAnteriorLlantasResumen, 4).Style - StyleDataMeta.Font.Weight = ExcelFont.NormalWeight - StyleDataMeta.Font.Name = "Calibri" - StyleDataMeta.Font.Size = 8 * 20 - StyleDataMeta.VerticalAlignment = VerticalAlignmentStyle.Center - StyleDataMeta.HorizontalAlignment = HorizontalAlignmentStyle.Center - StyleDataMeta.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - StyleDataMeta.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-" + Dim StyleTitleTableMeta = worksheet.Cells.GetSubrangeAbsolute(IdxMesAnioAnteriorLlantasResumen, 0, IdxMesAnioAnteriorLlantasResumen, 4).Style + StyleTitleTableMeta.Font.Weight = ExcelFont.BoldWeight + StyleTitleTableMeta.Font.Name = "Calibri" + StyleTitleTableMeta.Font.Size = 8 * 20 + StyleTitleTableMeta.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleTitleTableMeta.VerticalAlignment = VerticalAlignmentStyle.Center + StyleTitleTableMeta.HorizontalAlignment = HorizontalAlignmentStyle.Center IdxMesAnioAnteriorLlantasResumen += 1 - Next - DtMesAnioAnteriorLLantasResumen.Dispose() + For Each Row As DataRow In DtMesAnioAnteriorLLantasResumen.Rows + worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 0).Value = ToMonthName(FechaConsulta).ToUpper() + " - LLANTAS" + worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Value = 0 + worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Value = Row("LLantasAnioAnterior") + worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 3).Formula = $"=({worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Name} - {worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Name})" + worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 4).Formula = $"=+({worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 2).Name} / {worksheet.Cells(IdxMesAnioAnteriorLlantasResumen, 1).Name})" + + Dim StyleDataMeta = worksheet.Cells.GetSubrangeAbsolute(IdxMesAnioAnteriorLlantasResumen, 0, IdxMesAnioAnteriorLlantasResumen, 4).Style + StyleDataMeta.Font.Weight = ExcelFont.NormalWeight + StyleDataMeta.Font.Name = "Calibri" + StyleDataMeta.Font.Size = 8 * 20 + StyleDataMeta.VerticalAlignment = VerticalAlignmentStyle.Center + StyleDataMeta.HorizontalAlignment = HorizontalAlignmentStyle.Center + StyleDataMeta.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleDataMeta.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-" + + IdxMesAnioAnteriorLlantasResumen += 1 + Next + + DtMesAnioAnteriorLLantasResumen.Dispose() #End Region #Region "F R A N Q U I C I A S R E S U M E N" - Dim TotalFranquicias As Decimal = DtSucursalesLLantasAlin.FiltroPrimeroValor("LlantasCantidadAcumulada", "CveSubProyecto=11842").ToDecimal() + Dim TotalFranquicias As Decimal = DtSucursalesLLantasAlin.FiltroPrimeroValor("LlantasCantidadAcumulada", "CveSubProyecto=11842").ToDecimal() - DtSucursalesLLantasAlin.Dispose() + DtSucursalesLLantasAlin.Dispose() - Dim IdxRefFranquiciasResumen As Integer = IdxRefMesAnioAnteriorLlantasResumen + Dim IdxRefFranquiciasResumen As Integer = IdxRefMesAnioAnteriorLlantasResumen - Dim columnRefFranquiciasResumen As Integer = 6 + Dim columnRefFranquiciasResumen As Integer = 6 - 'PRM 19 - worksheet.Cells(IdxRefFranquiciasResumen, columnRefFranquiciasResumen).Value = $"PRM {Now.Year - 1}" - worksheet.Cells(IdxRefFranquiciasResumen, columnRefFranquiciasResumen + 1).Value = "ALM PS" - worksheet.Cells(IdxRefFranquiciasResumen, columnRefFranquiciasResumen + 2).Value = "" - worksheet.Cells(IdxRefFranquiciasResumen, columnRefFranquiciasResumen + 3).Value = TotalFranquicias + 'PRM 19 + worksheet.Cells(IdxRefFranquiciasResumen, columnRefFranquiciasResumen).Value = $"PRM {Now.Year - 1}" + worksheet.Cells(IdxRefFranquiciasResumen, columnRefFranquiciasResumen + 1).Value = "ALM PS" + worksheet.Cells(IdxRefFranquiciasResumen, columnRefFranquiciasResumen + 2).Value = "" + worksheet.Cells(IdxRefFranquiciasResumen, columnRefFranquiciasResumen + 3).Value = TotalFranquicias - 'TOMA EL VALOR DE DIF LLANTAS - worksheet.Cells(IdxRefFranquiciasResumen + 1, columnRefFranquiciasResumen).Formula = $"=({worksheet.Cells(IdxMesAnioAnteriorLlantasResumen - 4, 3).Name})" + 'TOMA EL VALOR DE DIF LLANTAS + worksheet.Cells(IdxRefFranquiciasResumen + 1, columnRefFranquiciasResumen).Formula = $"=({worksheet.Cells(IdxMesAnioAnteriorLlantasResumen - 4, 3).Name})" - worksheet.Cells(IdxRefFranquiciasResumen + 2, columnRefFranquiciasResumen + 1).Value = $"FRANQ {Now.Year}" - worksheet.Cells(IdxRefFranquiciasResumen + 2, columnRefFranquiciasResumen + 2).Value = 4988 + worksheet.Cells(IdxRefFranquiciasResumen + 2, columnRefFranquiciasResumen + 1).Value = $"FRANQ {Now.Year}" + worksheet.Cells(IdxRefFranquiciasResumen + 2, columnRefFranquiciasResumen + 2).Value = 4988 - worksheet.Cells(IdxRefFranquiciasResumen + 3, columnRefFranquiciasResumen).Value = $"PRM {Now.Year}" - worksheet.Cells(IdxRefFranquiciasResumen + 3, columnRefFranquiciasResumen + 1).Value = "" - worksheet.Cells(IdxRefFranquiciasResumen + 3, columnRefFranquiciasResumen + 2).Formula = $"=({worksheet.Cells(IdxRefFranquiciasResumen, columnRefFranquiciasResumen + 3).Name} - {worksheet.Cells(IdxRefFranquiciasResumen + 2, columnRefFranquiciasResumen + 2).Name})" - worksheet.Cells(IdxRefFranquiciasResumen + 3, columnRefFranquiciasResumen + 3).Formula = $"+({worksheet.Cells(IdxRefFranquiciasResumen + 3, columnRefFranquiciasResumen + 2)})" + worksheet.Cells(IdxRefFranquiciasResumen + 3, columnRefFranquiciasResumen).Value = $"PRM {Now.Year}" + worksheet.Cells(IdxRefFranquiciasResumen + 3, columnRefFranquiciasResumen + 1).Value = "" + worksheet.Cells(IdxRefFranquiciasResumen + 3, columnRefFranquiciasResumen + 2).Formula = $"=({worksheet.Cells(IdxRefFranquiciasResumen, columnRefFranquiciasResumen + 3).Name} - {worksheet.Cells(IdxRefFranquiciasResumen + 2, columnRefFranquiciasResumen + 2).Name})" + worksheet.Cells(IdxRefFranquiciasResumen + 3, columnRefFranquiciasResumen + 3).Formula = $"+({worksheet.Cells(IdxRefFranquiciasResumen + 3, columnRefFranquiciasResumen + 2)})" - 'TOMA EL VALOR DE DIF LLANTAS METAS - worksheet.Cells(IdxRefFranquiciasResumen + 4, columnRefFranquiciasResumen).Formula = $"=({worksheet.Cells(IdxMesAnioAnteriorLlantasResumen - 1, 3).Name})" + 'TOMA EL VALOR DE DIF LLANTAS METAS + worksheet.Cells(IdxRefFranquiciasResumen + 4, columnRefFranquiciasResumen).Formula = $"=({worksheet.Cells(IdxMesAnioAnteriorLlantasResumen - 1, 3).Name})" - Dim StyleTitleTableFR = worksheet.Cells.GetSubrangeAbsolute(IdxRefFranquiciasResumen, columnRefFranquiciasResumen, IdxRefFranquiciasResumen + 4, columnRefFranquiciasResumen + 3).Style - StyleTitleTableFR.Font.Weight = ExcelFont.BoldWeight - StyleTitleTableFR.Font.Name = "Calibri" - StyleTitleTableFR.Font.Size = 8 * 20 - StyleTitleTableFR.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - StyleTitleTableFR.VerticalAlignment = VerticalAlignmentStyle.Center - StyleTitleTableFR.HorizontalAlignment = HorizontalAlignmentStyle.Center + Dim StyleTitleTableFR = worksheet.Cells.GetSubrangeAbsolute(IdxRefFranquiciasResumen, columnRefFranquiciasResumen, IdxRefFranquiciasResumen + 4, columnRefFranquiciasResumen + 3).Style + StyleTitleTableFR.Font.Weight = ExcelFont.BoldWeight + StyleTitleTableFR.Font.Name = "Calibri" + StyleTitleTableFR.Font.Size = 8 * 20 + StyleTitleTableFR.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleTitleTableFR.VerticalAlignment = VerticalAlignmentStyle.Center + StyleTitleTableFR.HorizontalAlignment = HorizontalAlignmentStyle.Center - 'Dim StyleDataFranquicias = worksheet.Cells.GetSubrangeAbsolute(IdxMesAnioAnteriorLlantasResumen, 0, IdxMesAnioAnteriorLlantasResumen, 4).Style - 'StyleData.Font.Weight = ExcelFont.NormalWeight - 'StyleData.Font.Name = "Calibri" - 'StyleData.Font.Size = 8 * 20 - 'StyleData.VerticalAlignment = VerticalAlignmentStyle.Center - 'StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center - 'StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - 'StyleData.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-" + 'Dim StyleDataFranquicias = worksheet.Cells.GetSubrangeAbsolute(IdxMesAnioAnteriorLlantasResumen, 0, IdxMesAnioAnteriorLlantasResumen, 4).Style + 'StyleData.Font.Weight = ExcelFont.NormalWeight + 'StyleData.Font.Name = "Calibri" + 'StyleData.Font.Size = 8 * 20 + 'StyleData.VerticalAlignment = VerticalAlignmentStyle.Center + 'StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center + 'StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + 'StyleData.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-" - IdxRefFranquiciasResumen += 1 + IdxRefFranquiciasResumen += 1 #End Region #Region "A Ñ O R E S U M E N" - Dim IdxRefAnioResumen As Integer = IdxRefFranquiciasResumen - 1 + Dim IdxRefAnioResumen As Integer = IdxRefFranquiciasResumen - 1 - Dim columnRefAnioResumen As Integer = columnRefFranquiciasResumen + 5 + Dim columnRefAnioResumen As Integer = columnRefFranquiciasResumen + 5 - 'AÑO ANTERIOR - worksheet.Cells(IdxRefAnioResumen, columnRefAnioResumen).Value = Now.Year - 1 - Dim CellAnioAnterior = worksheet.Cells(IdxRefAnioResumen, columnRefAnioResumen + 1) - CellAnioAnterior.Value = 0 + 'AÑO ANTERIOR + worksheet.Cells(IdxRefAnioResumen, columnRefAnioResumen).Value = Now.Year - 1 + Dim CellAnioAnterior = worksheet.Cells(IdxRefAnioResumen, columnRefAnioResumen + 1) + CellAnioAnterior.Value = 0 - 'AÑO ACTUAL - worksheet.Cells(IdxRefAnioResumen + 1, columnRefAnioResumen).Value = Now.Year - Dim CellAnioActual = worksheet.Cells(IdxRefAnioResumen + 1, columnRefAnioResumen + 1) - CellAnioActual.Value = 0 + 'AÑO ACTUAL + worksheet.Cells(IdxRefAnioResumen + 1, columnRefAnioResumen).Value = Now.Year + Dim CellAnioActual = worksheet.Cells(IdxRefAnioResumen + 1, columnRefAnioResumen + 1) + CellAnioActual.Value = 0 - worksheet.Cells(IdxRefAnioResumen + 2, columnRefAnioResumen + 1).Formula = $"=({CeldaTotalVentaAcumulada.Name} - {worksheet.Cells(IdxRefAnioResumen, columnRefAnioResumen + 1).Name})" + worksheet.Cells(IdxRefAnioResumen + 2, columnRefAnioResumen + 1).Formula = $"=({CeldaTotalVentaAcumulada.Name} - {worksheet.Cells(IdxRefAnioResumen, columnRefAnioResumen + 1).Name})" - worksheet.Cells(IdxRefAnioResumen + 3, columnRefAnioResumen).Value = $"X DIA {Now.Year - 1}" - worksheet.Cells(IdxRefAnioResumen + 4, columnRefAnioResumen).Value = $"X DIA {Now.Year}" + worksheet.Cells(IdxRefAnioResumen + 3, columnRefAnioResumen).Value = $"X DIA {Now.Year - 1}" + worksheet.Cells(IdxRefAnioResumen + 4, columnRefAnioResumen).Value = $"X DIA {Now.Year}" - Dim DiasFinMes As Integer = 0 + Dim DiasFinMes As Integer = 0 - Dim Day As Integer = Now.Day - Dim DaysMonth As Integer = DateTime.DaysInMonth(Now.Year, Now.Month) - Dim Month As Integer = Now.Month - Dim Year As Integer = Now.Year + Dim Day As Integer = Now.Day + Dim DaysMonth As Integer = DateTime.DaysInMonth(Now.Year, Now.Month) + Dim Month As Integer = Now.Month + Dim Year As Integer = Now.Year - For i = Day To DaysMonth - Dim DayRef As DateTime = New DateTime(Year, Month, i) - If DayRef.DayOfWeek <> DayOfWeek.Sunday Then - DiasFinMes += 1 - End If - Next + For i = Day To DaysMonth + Dim DayRef As DateTime = New DateTime(Year, Month, i) + If DayRef.DayOfWeek <> DayOfWeek.Sunday Then + DiasFinMes += 1 + End If + Next - worksheet.Cells(IdxRefAnioResumen + 3, columnRefAnioResumen + 1).Formula = $"=({CellAnioAnterior.Name} - {CeldaTotalVentaAcumulada.Name})/{If(DiasFinMes > 0, DiasFinMes, 1)}" - worksheet.Cells(IdxRefAnioResumen + 3, columnRefAnioResumen + 2).Formula = $"=({CeldaTotalVentaAcumulada.Name}/{CellAnioAnterior.Name})" + worksheet.Cells(IdxRefAnioResumen + 3, columnRefAnioResumen + 1).Formula = $"=({CellAnioAnterior.Name} - {CeldaTotalVentaAcumulada.Name})/{If(DiasFinMes > 0, DiasFinMes, 1)}" + worksheet.Cells(IdxRefAnioResumen + 3, columnRefAnioResumen + 2).Formula = $"=({CeldaTotalVentaAcumulada.Name}/{CellAnioAnterior.Name})" - worksheet.Cells(IdxRefAnioResumen + 4, columnRefAnioResumen + 1).Formula = $"=({CellAnioActual.Name} - {CeldaTotalVentaAcumulada.Name})/{If(DiasFinMes > 0, DiasFinMes, 1)}" - worksheet.Cells(IdxRefAnioResumen + 4, columnRefAnioResumen + 2).Formula = $"=({CeldaTotalVentaAcumulada.Name}/{CellAnioActual.Name})" + worksheet.Cells(IdxRefAnioResumen + 4, columnRefAnioResumen + 1).Formula = $"=({CellAnioActual.Name} - {CeldaTotalVentaAcumulada.Name})/{If(DiasFinMes > 0, DiasFinMes, 1)}" + worksheet.Cells(IdxRefAnioResumen + 4, columnRefAnioResumen + 2).Formula = $"=({CeldaTotalVentaAcumulada.Name}/{CellAnioActual.Name})" - Dim StyleTitleTableAR = worksheet.Cells.GetSubrangeAbsolute(IdxRefAnioResumen, columnRefAnioResumen, IdxRefAnioResumen + 4, columnRefAnioResumen + 2).Style - StyleTitleTableAR.Font.Weight = ExcelFont.BoldWeight - StyleTitleTableAR.Font.Name = "Calibri" - StyleTitleTableAR.Font.Size = 8 * 20 - StyleTitleTableAR.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - StyleTitleTableAR.VerticalAlignment = VerticalAlignmentStyle.Center - StyleTitleTableAR.HorizontalAlignment = HorizontalAlignmentStyle.Center + Dim StyleTitleTableAR = worksheet.Cells.GetSubrangeAbsolute(IdxRefAnioResumen, columnRefAnioResumen, IdxRefAnioResumen + 4, columnRefAnioResumen + 2).Style + StyleTitleTableAR.Font.Weight = ExcelFont.BoldWeight + StyleTitleTableAR.Font.Name = "Calibri" + StyleTitleTableAR.Font.Size = 8 * 20 + StyleTitleTableAR.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleTitleTableAR.VerticalAlignment = VerticalAlignmentStyle.Center + StyleTitleTableAR.HorizontalAlignment = HorizontalAlignmentStyle.Center - Dim StyleDataAR = worksheet.Cells.GetSubrangeAbsolute(IdxRefAnioResumen, columnRefAnioResumen + 1, IdxRefAnioResumen + 4, columnRefAnioResumen + 2).Style - StyleDataAR.Font.Weight = ExcelFont.NormalWeight - StyleDataAR.Font.Name = "Calibri" - StyleDataAR.Font.Size = 8 * 20 - StyleDataAR.VerticalAlignment = VerticalAlignmentStyle.Center - StyleDataAR.HorizontalAlignment = HorizontalAlignmentStyle.Center - StyleDataAR.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - StyleDataAR.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-" + Dim StyleDataAR = worksheet.Cells.GetSubrangeAbsolute(IdxRefAnioResumen, columnRefAnioResumen + 1, IdxRefAnioResumen + 4, columnRefAnioResumen + 2).Style + StyleDataAR.Font.Weight = ExcelFont.NormalWeight + StyleDataAR.Font.Name = "Calibri" + StyleDataAR.Font.Size = 8 * 20 + StyleDataAR.VerticalAlignment = VerticalAlignmentStyle.Center + StyleDataAR.HorizontalAlignment = HorizontalAlignmentStyle.Center + StyleDataAR.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleDataAR.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-" - IdxRefAnioResumen += 1 + IdxRefAnioResumen += 1 #End Region #Region "L L A N T A S M E S A Ñ O A N T E R I O R" - Dim IdxRefMesAnioAnteriorLlantas As Integer = IdxSucursalesLlantasAlin + 8 + Dim IdxRefMesAnioAnteriorLlantas As Integer = IdxSucursalesLlantasAlin + 8 - worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantas - 1, 1, IdxRefMesAnioAnteriorLlantas - 1, 3).Merged = True - worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantas - 1, 4, IdxRefMesAnioAnteriorLlantas - 1, 6).Merged = True - worksheet.Cells(IdxRefMesAnioAnteriorLlantas - 1, 1).Value = "LLANTAS" - worksheet.Cells(IdxRefMesAnioAnteriorLlantas - 1, 4).Value = "%" + worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantas - 1, 1, IdxRefMesAnioAnteriorLlantas - 1, 3).Merged = True + worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantas - 1, 4, IdxRefMesAnioAnteriorLlantas - 1, 6).Merged = True + worksheet.Cells(IdxRefMesAnioAnteriorLlantas - 1, 1).Value = "LLANTAS" + worksheet.Cells(IdxRefMesAnioAnteriorLlantas - 1, 4).Value = "%" - worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 0).Value = "Sucursal" - worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 1).Value = String.Format("{0} {1}", ToShortMonthName(FechaConsulta).ToUpper(), (FechaConsulta.Year - 1)) - worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 2).Value = String.Format("{0} {1}", ToShortMonthName(FechaConsulta).ToUpper(), (FechaConsulta.Year)) - worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 3).Value = "DIF %" - worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 4).Value = String.Format("{0} - %", (FechaConsulta.Year - 1)) - worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 5).Value = String.Format("{0} - %", (FechaConsulta.Year)) - worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 6).Value = "DIF %" + worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 0).Value = "Sucursal" + worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 1).Value = String.Format("{0} {1}", ToShortMonthName(FechaConsulta).ToUpper(), (FechaConsulta.Year - 1)) + worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 2).Value = String.Format("{0} {1}", ToShortMonthName(FechaConsulta).ToUpper(), (FechaConsulta.Year)) + worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 3).Value = "DIF %" + worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 4).Value = String.Format("{0} - %", (FechaConsulta.Year - 1)) + worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 5).Value = String.Format("{0} - %", (FechaConsulta.Year)) + worksheet.Cells(IdxRefMesAnioAnteriorLlantas, 6).Value = "DIF %" - Dim StyleTitleTable5 = worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantas - 1, 0, IdxRefMesAnioAnteriorLlantas - 1, 6).Style - StyleTitleTable5.Font.Weight = ExcelFont.BoldWeight - StyleTitleTable5.Font.Name = "Calibri" - StyleTitleTable5.Font.Size = 8 * 20 - StyleTitleTable5.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - StyleTitleTable5.VerticalAlignment = VerticalAlignmentStyle.Center - StyleTitleTable5.HorizontalAlignment = HorizontalAlignmentStyle.Center + Dim StyleTitleTable5 = worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantas - 1, 0, IdxRefMesAnioAnteriorLlantas - 1, 6).Style + StyleTitleTable5.Font.Weight = ExcelFont.BoldWeight + StyleTitleTable5.Font.Name = "Calibri" + StyleTitleTable5.Font.Size = 8 * 20 + StyleTitleTable5.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleTitleTable5.VerticalAlignment = VerticalAlignmentStyle.Center + StyleTitleTable5.HorizontalAlignment = HorizontalAlignmentStyle.Center - Dim StyleSubTitleTable5 = worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantas, 0, IdxRefMesAnioAnteriorLlantas, 6).Style - StyleSubTitleTable5.Font.Weight = ExcelFont.BoldWeight - StyleSubTitleTable5.Font.Name = "Calibri" - StyleSubTitleTable5.Font.Size = 8 * 20 - StyleSubTitleTable5.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - StyleSubTitleTable5.VerticalAlignment = VerticalAlignmentStyle.Center - StyleSubTitleTable5.HorizontalAlignment = HorizontalAlignmentStyle.Center + Dim StyleSubTitleTable5 = worksheet.Cells.GetSubrangeAbsolute(IdxRefMesAnioAnteriorLlantas, 0, IdxRefMesAnioAnteriorLlantas, 6).Style + StyleSubTitleTable5.Font.Weight = ExcelFont.BoldWeight + StyleSubTitleTable5.Font.Name = "Calibri" + StyleSubTitleTable5.Font.Size = 8 * 20 + StyleSubTitleTable5.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleSubTitleTable5.VerticalAlignment = VerticalAlignmentStyle.Center + StyleSubTitleTable5.HorizontalAlignment = HorizontalAlignmentStyle.Center - Dim DtMesAnioAnteriorLLantas As DataTable = DataSet.Tables(4) - 'INICIA DESDE LA CUARTA FILA - Dim IdxMesAnioAnteriorLlantas As Integer = IdxRefMesAnioAnteriorLlantas + 1 + Dim DtMesAnioAnteriorLLantas As DataTable = DataSet.Tables(4) + 'INICIA DESDE LA CUARTA FILA + Dim IdxMesAnioAnteriorLlantas As Integer = IdxRefMesAnioAnteriorLlantas + 1 - For Each Row As DataRow In DtMesAnioAnteriorLLantas.Rows - worksheet.Cells(IdxMesAnioAnteriorLlantas, 0).Value = Row("Sucursal") - worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Value = Row("LLantasAnioAnterior") - worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Value = Row("LLantas") - worksheet.Cells(IdxMesAnioAnteriorLlantas, 3).Formula = $"=({worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Name} - {worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Name})" - worksheet.Cells(IdxMesAnioAnteriorLlantas, 4).Formula = $"=+(({worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Name} * 1.07) - {worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Name}) /12" - worksheet.Cells(IdxMesAnioAnteriorLlantas, 5).Formula = $"=+(({worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Name} * 1) - {worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Name}) /12" - worksheet.Cells(IdxMesAnioAnteriorLlantas, 6).Formula = $"=+({worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Name} / {worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Name}) - 1" + For Each Row As DataRow In DtMesAnioAnteriorLLantas.Rows + worksheet.Cells(IdxMesAnioAnteriorLlantas, 0).Value = Row("Sucursal") + worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Value = Row("LLantasAnioAnterior") + worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Value = Row("LLantas") + worksheet.Cells(IdxMesAnioAnteriorLlantas, 3).Formula = $"=({worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Name} - {worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Name})" + worksheet.Cells(IdxMesAnioAnteriorLlantas, 4).Formula = $"=+(({worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Name} * 1.07) - {worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Name}) /12" + worksheet.Cells(IdxMesAnioAnteriorLlantas, 5).Formula = $"=+(({worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Name} * 1) - {worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Name}) /12" + worksheet.Cells(IdxMesAnioAnteriorLlantas, 6).Formula = $"=+({worksheet.Cells(IdxMesAnioAnteriorLlantas, 2).Name} / {worksheet.Cells(IdxMesAnioAnteriorLlantas, 1).Name}) - 1" - Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxMesAnioAnteriorLlantas, 0, IdxMesAnioAnteriorLlantas, 6).Style - StyleData.Font.Weight = ExcelFont.NormalWeight - StyleData.Font.Name = "Calibri" - StyleData.Font.Size = 8 * 20 - StyleData.VerticalAlignment = VerticalAlignmentStyle.Center - StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center - StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - StyleData.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-" + Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxMesAnioAnteriorLlantas, 0, IdxMesAnioAnteriorLlantas, 6).Style + StyleData.Font.Weight = ExcelFont.NormalWeight + StyleData.Font.Name = "Calibri" + StyleData.Font.Size = 8 * 20 + StyleData.VerticalAlignment = VerticalAlignmentStyle.Center + StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center + StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleData.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-" - IdxMesAnioAnteriorLlantas += 1 - Next + IdxMesAnioAnteriorLlantas += 1 + Next - DtMesAnioAnteriorLLantas.Dispose() + DtMesAnioAnteriorLLantas.Dispose() #End Region #Region "A Ñ O A N T E R I O R" - Dim IdxRefAnioAnteriorLlantas As Integer = IdxRefMesAnioAnteriorLlantas + Dim IdxRefAnioAnteriorLlantas As Integer = IdxRefMesAnioAnteriorLlantas - Dim columnRefAnioAnterior As Integer = 9 + Dim columnRefAnioAnterior As Integer = 9 - worksheet.Cells(IdxRefAnioAnteriorLlantas, columnRefAnioAnterior).Value = "Sucursal" - worksheet.Cells(IdxRefAnioAnteriorLlantas, columnRefAnioAnterior + 1).Value = (FechaConsulta.Year - 1).ToString() - worksheet.Cells(IdxRefAnioAnteriorLlantas, columnRefAnioAnterior + 2).Value = FechaConsulta.Year.ToString() - worksheet.Cells(IdxRefAnioAnteriorLlantas, columnRefAnioAnterior + 3).Value = "Dif" + worksheet.Cells(IdxRefAnioAnteriorLlantas, columnRefAnioAnterior).Value = "Sucursal" + worksheet.Cells(IdxRefAnioAnteriorLlantas, columnRefAnioAnterior + 1).Value = (FechaConsulta.Year - 1).ToString() + worksheet.Cells(IdxRefAnioAnteriorLlantas, columnRefAnioAnterior + 2).Value = FechaConsulta.Year.ToString() + worksheet.Cells(IdxRefAnioAnteriorLlantas, columnRefAnioAnterior + 3).Value = "Dif" - Dim StyleTitleTable4 = worksheet.Cells.GetSubrangeAbsolute(IdxRefAnioAnteriorLlantas, columnRefAnioAnterior, IdxRefAnioAnteriorLlantas, columnRefAnioAnterior + 3).Style - StyleTitleTable4.Font.Weight = ExcelFont.BoldWeight - StyleTitleTable4.Font.Name = "Calibri" - StyleTitleTable4.Font.Size = 8 * 20 - StyleTitleTable4.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - StyleTitleTable4.VerticalAlignment = VerticalAlignmentStyle.Center - StyleTitleTable4.HorizontalAlignment = HorizontalAlignmentStyle.Center + Dim StyleTitleTable4 = worksheet.Cells.GetSubrangeAbsolute(IdxRefAnioAnteriorLlantas, columnRefAnioAnterior, IdxRefAnioAnteriorLlantas, columnRefAnioAnterior + 3).Style + StyleTitleTable4.Font.Weight = ExcelFont.BoldWeight + StyleTitleTable4.Font.Name = "Calibri" + StyleTitleTable4.Font.Size = 8 * 20 + StyleTitleTable4.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleTitleTable4.VerticalAlignment = VerticalAlignmentStyle.Center + StyleTitleTable4.HorizontalAlignment = HorizontalAlignmentStyle.Center - Dim DtAnioAnteriorLLantas As DataTable = DataSet.Tables(3) - 'INICIA DESDE LA CUARTA FILA - Dim IdxAnioAnteriorLlantas As Integer = IdxRefAnioAnteriorLlantas + 1 + Dim DtAnioAnteriorLLantas As DataTable = DataSet.Tables(3) + 'INICIA DESDE LA CUARTA FILA + Dim IdxAnioAnteriorLlantas As Integer = IdxRefAnioAnteriorLlantas + 1 - For Each Row As DataRow In DtAnioAnteriorLLantas.FiltraParametros("TipoFila > 1").Rows - worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior).Value = Row("Grupo") - worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 1).Value = Row("LLantasAnioAnterior") - worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 2).Value = Row("LLantas") - worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 3).Formula = $"=({worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 1).Name} - {worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 2).Name})" + For Each Row As DataRow In DtAnioAnteriorLLantas.FiltraParametros("TipoFila > 1").Rows + worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior).Value = Row("Grupo") + worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 1).Value = Row("LLantasAnioAnterior") + worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 2).Value = Row("LLantas") + worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 3).Formula = $"=({worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 1).Name} - {worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 2).Name})" - Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxAnioAnteriorLlantas, columnRefAnioAnterior, IdxAnioAnteriorLlantas, columnRefAnioAnterior + 3).Style - StyleData.Font.Weight = ExcelFont.NormalWeight - StyleData.Font.Name = "Calibri" - StyleData.Font.Size = 8 * 20 - StyleData.VerticalAlignment = VerticalAlignmentStyle.Center - StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center - StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - StyleData.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-" + Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxAnioAnteriorLlantas, columnRefAnioAnterior, IdxAnioAnteriorLlantas, columnRefAnioAnterior + 3).Style + StyleData.Font.Weight = ExcelFont.NormalWeight + StyleData.Font.Name = "Calibri" + StyleData.Font.Size = 8 * 20 + StyleData.VerticalAlignment = VerticalAlignmentStyle.Center + StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center + StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleData.NumberFormat = "_-* 0_-;-* 0-;_-* ""-""??_-;_-@_-" - If Row("TipoFila").ToString() = "2" Then + If Row("TipoFila").ToString() = "2" Then + StyleData.Font.Weight = ExcelFont.BoldWeight + StyleData.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(255, 215, 0), SpreadsheetColor.FromArgb(255, 255, 255)) + End If + + IdxAnioAnteriorLlantas += 1 + Next + + For Each Row As DataRow In DtAnioAnteriorLLantas.FiltraParametros("TipoFila = 1").Rows + worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior).Value = Row("Grupo") + worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 1).Value = Row("LLantasAnioAnterior") + worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 2).Value = Row("LLantas") + worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 3).Formula = $"=(+{worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 1).Name} - {worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 2).Name})" + + + Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxAnioAnteriorLlantas, columnRefAnioAnterior, IdxAnioAnteriorLlantas, columnRefAnioAnterior + 3).Style StyleData.Font.Weight = ExcelFont.BoldWeight + StyleData.Font.Name = "Calibri" + StyleData.Font.Size = 8 * 20 + StyleData.VerticalAlignment = VerticalAlignmentStyle.Center + StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center + StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleData.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-" StyleData.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(255, 215, 0), SpreadsheetColor.FromArgb(255, 255, 255)) - End If - IdxAnioAnteriorLlantas += 1 - Next - - For Each Row As DataRow In DtAnioAnteriorLLantas.FiltraParametros("TipoFila = 1").Rows - worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior).Value = Row("Grupo") - worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 1).Value = Row("LLantasAnioAnterior") - worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 2).Value = Row("LLantas") - worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 3).Formula = $"=(+{worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 1).Name} - {worksheet.Cells(IdxAnioAnteriorLlantas, columnRefAnioAnterior + 2).Name})" - - - Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxAnioAnteriorLlantas, columnRefAnioAnterior, IdxAnioAnteriorLlantas, columnRefAnioAnterior + 3).Style - StyleData.Font.Weight = ExcelFont.BoldWeight - StyleData.Font.Name = "Calibri" - StyleData.Font.Size = 8 * 20 - StyleData.VerticalAlignment = VerticalAlignmentStyle.Center - StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center - StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - StyleData.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-" - StyleData.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(255, 215, 0), SpreadsheetColor.FromArgb(255, 255, 255)) - - IdxAnioAnteriorLlantas += 1 - Next - DtAnioAnteriorLLantas.Dispose() + IdxAnioAnteriorLlantas += 1 + Next + DtAnioAnteriorLLantas.Dispose() #End Region #Region "V E N T A S - S E R V I C I O S D E I N S T A L A C I O N, A M O R T I G U A D O R E S, P O L I Z A S" - Dim IdxRefSucursalesServiciosAmortPolizas As Integer = IdxMesAnioAnteriorLlantas + 3 + Dim IdxRefSucursalesServiciosAmortPolizas As Integer = IdxMesAnioAnteriorLlantas + 3 - worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas, 0).Value = "Sucursal" - 'TITULO SERVICIOS DE INSTALACION - worksheet.Cells.GetSubrangeAbsolute(IdxRefSucursalesServiciosAmortPolizas - 1, 1, IdxRefSucursalesServiciosAmortPolizas - 1, 3).Merged = True - worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas - 1, 3).Value = "SERVICIOS DE INSTALACION" - worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas, 1).Value = "Ant" - worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas, 2).Value = "Dia" - worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas, 3).Value = "Acum" - 'TITULO AMORTIGUADORES - worksheet.Cells.GetSubrangeAbsolute(IdxRefSucursalesServiciosAmortPolizas - 1, 4, IdxRefSucursalesServiciosAmortPolizas - 1, 6).Merged = True - worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas - 1, 6).Value = "AMORTIGUADORES" - worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas, 4).Value = "Ant" - worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas, 5).Value = "Dia" - worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas, 6).Value = "Acum" - 'TITULO DE POLIZAS - worksheet.Cells.GetSubrangeAbsolute(IdxRefSucursalesServiciosAmortPolizas - 1, 7, IdxRefSucursalesServiciosAmortPolizas - 1, 9).Merged = True - worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas - 1, 9).Value = "POLIZAS" - worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas, 7).Value = "Ant" - worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas, 8).Value = "Dia" - worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas, 9).Value = "Acum" - 'TITULO DE VENTAS DEL DIA - worksheet.Cells.GetSubrangeAbsolute(IdxRefSucursalesServiciosAmortPolizas - 1, 10, IdxRefSucursalesServiciosAmortPolizas - 1, 12).Merged = True - worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas - 1, 12).Value = "MANO DE OBRA PESOS" - worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas, 10).Value = "Ant" - worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas, 11).Value = "Dia" - worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas, 12).Value = "Acum" + worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas, 0).Value = "Sucursal" + 'TITULO SERVICIOS DE INSTALACION + worksheet.Cells.GetSubrangeAbsolute(IdxRefSucursalesServiciosAmortPolizas - 1, 1, IdxRefSucursalesServiciosAmortPolizas - 1, 3).Merged = True + worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas - 1, 3).Value = "SERVICIOS DE INSTALACION" + worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas, 1).Value = "Ant" + worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas, 2).Value = "Dia" + worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas, 3).Value = "Acum" + 'TITULO AMORTIGUADORES + worksheet.Cells.GetSubrangeAbsolute(IdxRefSucursalesServiciosAmortPolizas - 1, 4, IdxRefSucursalesServiciosAmortPolizas - 1, 6).Merged = True + worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas - 1, 6).Value = "AMORTIGUADORES" + worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas, 4).Value = "Ant" + worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas, 5).Value = "Dia" + worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas, 6).Value = "Acum" + 'TITULO DE POLIZAS + worksheet.Cells.GetSubrangeAbsolute(IdxRefSucursalesServiciosAmortPolizas - 1, 7, IdxRefSucursalesServiciosAmortPolizas - 1, 9).Merged = True + worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas - 1, 9).Value = "POLIZAS" + worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas, 7).Value = "Ant" + worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas, 8).Value = "Dia" + worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas, 9).Value = "Acum" + 'TITULO DE VENTAS DEL DIA + worksheet.Cells.GetSubrangeAbsolute(IdxRefSucursalesServiciosAmortPolizas - 1, 10, IdxRefSucursalesServiciosAmortPolizas - 1, 12).Merged = True + worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas - 1, 12).Value = "MANO DE OBRA PESOS" + worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas, 10).Value = "Ant" + worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas, 11).Value = "Dia" + worksheet.Cells(IdxRefSucursalesServiciosAmortPolizas, 12).Value = "Acum" - Dim StyleTitleTable2 = worksheet.Cells.GetSubrangeAbsolute(IdxRefSucursalesServiciosAmortPolizas - 1, 1, IdxRefSucursalesServiciosAmortPolizas - 1, 12).Style - StyleTitleTable2.Font.Weight = ExcelFont.BoldWeight - StyleTitleTable2.Font.Name = "Calibri" - StyleTitleTable2.Font.Size = 8 * 20 - StyleTitleTable2.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - StyleTitleTable2.VerticalAlignment = VerticalAlignmentStyle.Center - StyleTitleTable2.HorizontalAlignment = HorizontalAlignmentStyle.Center + Dim StyleTitleTable2 = worksheet.Cells.GetSubrangeAbsolute(IdxRefSucursalesServiciosAmortPolizas - 1, 1, IdxRefSucursalesServiciosAmortPolizas - 1, 12).Style + StyleTitleTable2.Font.Weight = ExcelFont.BoldWeight + StyleTitleTable2.Font.Name = "Calibri" + StyleTitleTable2.Font.Size = 8 * 20 + StyleTitleTable2.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleTitleTable2.VerticalAlignment = VerticalAlignmentStyle.Center + StyleTitleTable2.HorizontalAlignment = HorizontalAlignmentStyle.Center - Dim StyleSubTitleTable2 = worksheet.Cells.GetSubrangeAbsolute(IdxRefSucursalesServiciosAmortPolizas, 0, IdxRefSucursalesServiciosAmortPolizas, 12).Style - StyleSubTitleTable2.Font.Weight = ExcelFont.BoldWeight - StyleSubTitleTable2.Font.Name = "Calibri" - StyleSubTitleTable2.Font.Size = 8 * 20 - StyleSubTitleTable2.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - StyleSubTitleTable2.VerticalAlignment = VerticalAlignmentStyle.Center - StyleSubTitleTable2.HorizontalAlignment = HorizontalAlignmentStyle.Center + Dim StyleSubTitleTable2 = worksheet.Cells.GetSubrangeAbsolute(IdxRefSucursalesServiciosAmortPolizas, 0, IdxRefSucursalesServiciosAmortPolizas, 12).Style + StyleSubTitleTable2.Font.Weight = ExcelFont.BoldWeight + StyleSubTitleTable2.Font.Name = "Calibri" + StyleSubTitleTable2.Font.Size = 8 * 20 + StyleSubTitleTable2.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleSubTitleTable2.VerticalAlignment = VerticalAlignmentStyle.Center + StyleSubTitleTable2.HorizontalAlignment = HorizontalAlignmentStyle.Center - Dim DtSucursalesServiciosAmortPolizas As DataTable = DataSet.Tables(1) + Dim DtSucursalesServiciosAmortPolizas As DataTable = DataSet.Tables(1) - 'INICIA DESDE LA CUARTA FILA - Dim IdxSucursalesServiciosAmortPolizas As Integer = IdxRefSucursalesServiciosAmortPolizas + 1 + 'INICIA DESDE LA CUARTA FILA + Dim IdxSucursalesServiciosAmortPolizas As Integer = IdxRefSucursalesServiciosAmortPolizas + 1 - For Each Row As DataRow In DtSucursalesServiciosAmortPolizas.Rows - worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 0).Value = Row("SubProyecto") + For Each Row As DataRow In DtSucursalesServiciosAmortPolizas.Rows + worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 0).Value = Row("SubProyecto") - worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 1).Value = Row("ServiciosCantidadAnterior") - worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 2).Value = Row("ServiciosCantidadDia") - 'worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 3).Value = Row("ServiciosCantidadAcumulada") - worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 3).Formula = $"=SUM({worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 1).Name}:{worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 2).Name})" + worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 1).Value = Row("ServiciosCantidadAnterior") + worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 2).Value = Row("ServiciosCantidadDia") + 'worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 3).Value = Row("ServiciosCantidadAcumulada") + worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 3).Formula = $"=SUM({worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 1).Name}:{worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 2).Name})" - worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 4).Value = Row("AmortCantidadAnterior") - worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 5).Value = Row("AmortCantidadDia") - 'worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 6).Value = Row("AmortCantidadAcumulada") - worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 6).Formula = $"=SUM({worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 4).Name}:{worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 5).Name})" + worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 4).Value = Row("AmortCantidadAnterior") + worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 5).Value = Row("AmortCantidadDia") + 'worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 6).Value = Row("AmortCantidadAcumulada") + worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 6).Formula = $"=SUM({worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 4).Name}:{worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 5).Name})" - worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 7).Value = Row("PolizasCantidadAnterior") - worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 8).Value = Row("PolizasCantidadDia") - 'worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 9).Value = Row("PolizasCantidadAcumulada") - worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 9).Formula = $"=SUM({worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 7).Name}:{worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 8).Name})" + worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 7).Value = Row("PolizasCantidadAnterior") + worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 8).Value = Row("PolizasCantidadDia") + 'worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 9).Value = Row("PolizasCantidadAcumulada") + worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 9).Formula = $"=SUM({worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 7).Name}:{worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 8).Name})" - worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 10).Value = Row("ManoObraCantidadAnterior") - worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 11).Value = Row("ManoObraCantidadDia") - 'worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 12).Value = Row("ManoObraCantidadAcumulada") - worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 12).Formula = $"=SUM({worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 10).Name}:{worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 11).Name})" + worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 10).Value = Row("ManoObraCantidadAnterior") + worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 11).Value = Row("ManoObraCantidadDia") + 'worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 12).Value = Row("ManoObraCantidadAcumulada") + worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 12).Formula = $"=SUM({worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 10).Name}:{worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 11).Name})" - Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxSucursalesServiciosAmortPolizas, 0, IdxSucursalesServiciosAmortPolizas, 12).Style - StyleData.Font.Weight = ExcelFont.BoldWeight - StyleData.Font.Name = "Calibri" - StyleData.Font.Size = 8 * 20 - StyleData.VerticalAlignment = VerticalAlignmentStyle.Center - StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center - StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - StyleData.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-" + Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxSucursalesServiciosAmortPolizas, 0, IdxSucursalesServiciosAmortPolizas, 9).Style + StyleData.Font.Weight = ExcelFont.BoldWeight + StyleData.Font.Name = "Calibri" + StyleData.Font.Size = 8 * 20 + StyleData.VerticalAlignment = VerticalAlignmentStyle.Center + StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center + StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleData.NumberFormat = "_-* 0_-;-* 0-;_-* ""-""??_-;_-@_-" - 'LAS VENTAS DEL DIA NO DEBEN ESTAR EN NEGRITAS - worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 0).Style.Font.Weight = ExcelFont.NormalWeight - worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 0).Style.HorizontalAlignment = HorizontalAlignmentStyle.Left + Dim StyleDataVenta = worksheet.Cells.GetSubrangeAbsolute(IdxSucursalesServiciosAmortPolizas, 10, IdxSucursalesServiciosAmortPolizas, 12).Style + StyleDataVenta.Font.Weight = ExcelFont.BoldWeight + StyleDataVenta.Font.Name = "Calibri" + StyleDataVenta.Font.Size = 8 * 20 + StyleDataVenta.VerticalAlignment = VerticalAlignmentStyle.Center + StyleDataVenta.HorizontalAlignment = HorizontalAlignmentStyle.Center + StyleDataVenta.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleDataVenta.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-" - worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 2).Style.Font.Weight = ExcelFont.NormalWeight - worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 5).Style.Font.Weight = ExcelFont.NormalWeight - worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 8).Style.Font.Weight = ExcelFont.NormalWeight - worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 11).Style.Font.Weight = ExcelFont.NormalWeight - IdxSucursalesServiciosAmortPolizas += 1 - Next - 'LA FILA DE LOS TOTALES DEBE ESTAR EN NEGITAS - worksheet.Cells.GetSubrangeAbsolute(IdxSucursalesServiciosAmortPolizas - 1, 0, IdxSucursalesServiciosAmortPolizas - 1, 12).Style.Font.Weight = ExcelFont.BoldWeight + 'LAS VENTAS DEL DIA NO DEBEN ESTAR EN NEGRITAS + worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 0).Style.Font.Weight = ExcelFont.NormalWeight + worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 0).Style.HorizontalAlignment = HorizontalAlignmentStyle.Left - DtSucursalesServiciosAmortPolizas.Dispose() + worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 2).Style.Font.Weight = ExcelFont.NormalWeight + worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 5).Style.Font.Weight = ExcelFont.NormalWeight + worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 8).Style.Font.Weight = ExcelFont.NormalWeight + worksheet.Cells(IdxSucursalesServiciosAmortPolizas, 11).Style.Font.Weight = ExcelFont.NormalWeight + + IdxSucursalesServiciosAmortPolizas += 1 + Next + 'LA FILA DE LOS TOTALES DEBE ESTAR EN NEGITAS + worksheet.Cells.GetSubrangeAbsolute(IdxSucursalesServiciosAmortPolizas - 1, 0, IdxSucursalesServiciosAmortPolizas - 1, 12).Style.Font.Weight = ExcelFont.BoldWeight + + DtSucursalesServiciosAmortPolizas.Dispose() #End Region #Region "P O R C E N T A J E S" - Dim IdxRefPorcentajes As Integer = IdxSucursalesServiciosAmortPolizas + 3 + Dim IdxRefPorcentajes As Integer = IdxSucursalesServiciosAmortPolizas + 3 - worksheet.Cells(IdxRefPorcentajes, 0).Value = "Sucursal" - 'TITULO SERVICIOS - worksheet.Cells.GetSubrangeAbsolute(IdxRefPorcentajes - 1, 1, IdxRefPorcentajes - 1, 2).Merged = True - worksheet.Cells(IdxRefPorcentajes - 1, 2).Value = "INSTALACION" - worksheet.Cells(IdxRefPorcentajes, 1).Value = "Cant" - worksheet.Cells(IdxRefPorcentajes, 2).Value = "%" - 'TITULO POLIZAS - worksheet.Cells.GetSubrangeAbsolute(IdxRefPorcentajes - 1, 3, IdxRefPorcentajes - 1, 4).Merged = True - worksheet.Cells(IdxRefPorcentajes - 1, 4).Value = "POLIZAS" - worksheet.Cells(IdxRefPorcentajes, 3).Value = "Cant" - worksheet.Cells(IdxRefPorcentajes, 4).Value = "%" - 'TITULO DE ALINEACIONES - worksheet.Cells.GetSubrangeAbsolute(IdxRefPorcentajes - 1, 5, IdxRefPorcentajes - 1, 6).Merged = True - worksheet.Cells(IdxRefPorcentajes - 1, 6).Value = "ALINEACIONES" - worksheet.Cells(IdxRefPorcentajes, 5).Value = "Cant" - worksheet.Cells(IdxRefPorcentajes, 6).Value = "%" + worksheet.Cells(IdxRefPorcentajes, 0).Value = "Sucursal" + 'TITULO SERVICIOS + worksheet.Cells.GetSubrangeAbsolute(IdxRefPorcentajes - 1, 1, IdxRefPorcentajes - 1, 2).Merged = True + worksheet.Cells(IdxRefPorcentajes - 1, 2).Value = "INSTALACION" + worksheet.Cells(IdxRefPorcentajes, 1).Value = "Cant" + worksheet.Cells(IdxRefPorcentajes, 2).Value = "%" + 'TITULO POLIZAS + worksheet.Cells.GetSubrangeAbsolute(IdxRefPorcentajes - 1, 3, IdxRefPorcentajes - 1, 4).Merged = True + worksheet.Cells(IdxRefPorcentajes - 1, 4).Value = "POLIZAS" + worksheet.Cells(IdxRefPorcentajes, 3).Value = "Cant" + worksheet.Cells(IdxRefPorcentajes, 4).Value = "%" + 'TITULO DE ALINEACIONES + worksheet.Cells.GetSubrangeAbsolute(IdxRefPorcentajes - 1, 5, IdxRefPorcentajes - 1, 6).Merged = True + worksheet.Cells(IdxRefPorcentajes - 1, 6).Value = "ALINEACIONES" + worksheet.Cells(IdxRefPorcentajes, 5).Value = "Cant" + worksheet.Cells(IdxRefPorcentajes, 6).Value = "%" - Dim StyleTitleTable3 = worksheet.Cells.GetSubrangeAbsolute(IdxRefPorcentajes - 1, 1, IdxRefPorcentajes - 1, 6).Style - StyleTitleTable3.Font.Weight = ExcelFont.BoldWeight - StyleTitleTable3.Font.Name = "Calibri" - StyleTitleTable3.Font.Size = 8 * 20 - StyleTitleTable3.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - StyleTitleTable3.VerticalAlignment = VerticalAlignmentStyle.Center - StyleTitleTable3.HorizontalAlignment = HorizontalAlignmentStyle.Center + Dim StyleTitleTable3 = worksheet.Cells.GetSubrangeAbsolute(IdxRefPorcentajes - 1, 1, IdxRefPorcentajes - 1, 6).Style + StyleTitleTable3.Font.Weight = ExcelFont.BoldWeight + StyleTitleTable3.Font.Name = "Calibri" + StyleTitleTable3.Font.Size = 8 * 20 + StyleTitleTable3.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleTitleTable3.VerticalAlignment = VerticalAlignmentStyle.Center + StyleTitleTable3.HorizontalAlignment = HorizontalAlignmentStyle.Center - Dim StyleSubTitleTable3 = worksheet.Cells.GetSubrangeAbsolute(IdxRefPorcentajes, 0, IdxRefPorcentajes, 6).Style - StyleSubTitleTable3.Font.Weight = ExcelFont.BoldWeight - StyleSubTitleTable3.Font.Name = "Calibri" - StyleSubTitleTable3.Font.Size = 8 * 20 - StyleSubTitleTable3.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - StyleSubTitleTable3.VerticalAlignment = VerticalAlignmentStyle.Center - StyleSubTitleTable3.HorizontalAlignment = HorizontalAlignmentStyle.Center + Dim StyleSubTitleTable3 = worksheet.Cells.GetSubrangeAbsolute(IdxRefPorcentajes, 0, IdxRefPorcentajes, 6).Style + StyleSubTitleTable3.Font.Weight = ExcelFont.BoldWeight + StyleSubTitleTable3.Font.Name = "Calibri" + StyleSubTitleTable3.Font.Size = 8 * 20 + StyleSubTitleTable3.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) + StyleSubTitleTable3.VerticalAlignment = VerticalAlignmentStyle.Center + StyleSubTitleTable3.HorizontalAlignment = HorizontalAlignmentStyle.Center - Dim DtPorcentajes As DataTable = DataSet.Tables(2) + Dim DtPorcentajes As DataTable = DataSet.Tables(2) - 'INICIA DESDE LA CUARTA FILA - Dim IdxPorcentajes As Integer = IdxRefPorcentajes + 1 + 'INICIA DESDE LA CUARTA FILA + Dim IdxPorcentajes As Integer = IdxRefPorcentajes + 1 - For Each Row As DataRow In DtPorcentajes.Rows - worksheet.Cells(IdxPorcentajes, 0).Value = Row("SubProyecto") + For Each Row As DataRow In DtPorcentajes.Rows + worksheet.Cells(IdxPorcentajes, 0).Value = Row("SubProyecto") - worksheet.Cells(IdxPorcentajes, 1).Value = Row("Servicios") - worksheet.Cells(IdxPorcentajes, 2).Value = Row("ServiciosPorcentaje") + worksheet.Cells(IdxPorcentajes, 1).Value = Row("Servicios") + worksheet.Cells(IdxPorcentajes, 2).Value = Row("ServiciosPorcentaje") - worksheet.Cells(IdxPorcentajes, 3).Value = Row("Polizas") - worksheet.Cells(IdxPorcentajes, 4).Value = Row("PolizasPorcentaje") + worksheet.Cells(IdxPorcentajes, 3).Value = Row("Polizas") + worksheet.Cells(IdxPorcentajes, 4).Value = Row("PolizasPorcentaje") - worksheet.Cells(IdxPorcentajes, 5).Value = Row("Alineaciones") - worksheet.Cells(IdxPorcentajes, 6).Value = Row("AlinPorcentaje") + worksheet.Cells(IdxPorcentajes, 5).Value = Row("Alineaciones") + worksheet.Cells(IdxPorcentajes, 6).Value = Row("AlinPorcentaje") - Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxPorcentajes, 0, IdxPorcentajes, 6).Style - StyleData.Font.Weight = ExcelFont.BoldWeight - StyleData.Font.Name = "Calibri" - StyleData.Font.Size = 8 * 20 - StyleData.VerticalAlignment = VerticalAlignmentStyle.Center - StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center - StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - StyleData.NumberFormat = "_-* #,##0.00_-;-* #,##0.00_-;_-* ""-""??_-;_-@_-" + Dim StyleData = worksheet.Cells.GetSubrangeAbsolute(IdxPorcentajes, 0, IdxPorcentajes, 6).Style + StyleData.Font.Weight = ExcelFont.BoldWeight + StyleData.Font.Name = "Calibri" + StyleData.Font.Size = 8 * 20 + StyleData.VerticalAlignment = VerticalAlignmentStyle.Center + StyleData.HorizontalAlignment = HorizontalAlignmentStyle.Center + StyleData.Borders.SetBorders(MultipleBorders.All, SpreadsheetColor.FromName(ColorName.Black), LineStyle.Thin) - 'LAS VENTAS DEL DIA NO DEBEN ESTAR EN NEGRITAS - worksheet.Cells(IdxPorcentajes, 0).Style.Font.Weight = ExcelFont.NormalWeight - worksheet.Cells(IdxPorcentajes, 0).Style.HorizontalAlignment = HorizontalAlignmentStyle.Left + Dim StyleDatInst = worksheet.Cells.GetSubrangeAbsolute(IdxPorcentajes, 1, IdxPorcentajes, 1).Style + StyleDatInst.NumberFormat = "_-* 0_-;-* 0-;_-* ""-""??_-;_-@_-" - worksheet.Cells(IdxPorcentajes, 1).Style.Font.Weight = ExcelFont.NormalWeight - worksheet.Cells(IdxPorcentajes, 3).Style.Font.Weight = ExcelFont.NormalWeight - worksheet.Cells(IdxPorcentajes, 5).Style.Font.Weight = ExcelFont.NormalWeight + Dim StyleDatPol = worksheet.Cells.GetSubrangeAbsolute(IdxPorcentajes, 3, IdxPorcentajes, 3).Style + StyleDatPol.NumberFormat = "_-* 0_-;-* 0-;_-* ""-""??_-;_-@_-" - IdxPorcentajes += 1 - Next - 'LA FILA DE LOS TOTALES DEBE ESTAR EN NEGITAS - worksheet.Cells.GetSubrangeAbsolute(IdxPorcentajes - 1, 0, IdxPorcentajes - 1, 6).Style.Font.Weight = ExcelFont.BoldWeight + Dim StyleDatAli = worksheet.Cells.GetSubrangeAbsolute(IdxPorcentajes, 5, IdxPorcentajes, 5).Style + StyleDatAli.NumberFormat = "_-* 0_-;-* 0-;_-* ""-""??_-;_-@_-" - DtPorcentajes.Dispose() + 'LAS VENTAS DEL DIA NO DEBEN ESTAR EN NEGRITAS + worksheet.Cells(IdxPorcentajes, 0).Style.Font.Weight = ExcelFont.NormalWeight + worksheet.Cells(IdxPorcentajes, 0).Style.HorizontalAlignment = HorizontalAlignmentStyle.Left + + worksheet.Cells(IdxPorcentajes, 1).Style.Font.Weight = ExcelFont.NormalWeight + worksheet.Cells(IdxPorcentajes, 3).Style.Font.Weight = ExcelFont.NormalWeight + worksheet.Cells(IdxPorcentajes, 5).Style.Font.Weight = ExcelFont.NormalWeight + + IdxPorcentajes += 1 + Next + 'LA FILA DE LOS TOTALES DEBE ESTAR EN NEGITAS + worksheet.Cells.GetSubrangeAbsolute(IdxPorcentajes - 1, 0, IdxPorcentajes - 1, 6).Style.Font.Weight = ExcelFont.BoldWeight + + DtPorcentajes.Dispose() #End Region - Dim columnCount = worksheet.CalculateMaxUsedColumns() + Dim columnCount = worksheet.CalculateMaxUsedColumns() - For i = 0 To columnCount - worksheet.Columns(i).AutoFit(1, worksheet.Rows(0), worksheet.Rows(worksheet.Rows.Count - 1)) - Next + For i = 0 To columnCount + worksheet.Columns(i).AutoFit(1, worksheet.Rows(0), worksheet.Rows(worksheet.Rows.Count - 1)) + Next - FileExcel.Save(Response, $"DIARIO_{FechaConsulta.ToString("dd_MM_yyyy")}.xlsx", SaveOptions.XlsxDefault) + FileExcel.Save(Response, $"DIARIO_{FechaConsulta.ToString("dd_MM_yyyy")}.xlsx", SaveOptions.XlsxDefault) + Catch ex As Exception + OnError("Ocurrió un error al generar el reporte", ex) + End Try End If diff --git a/Ventas/RepRecuperacionDetalle.aspx.vb b/Ventas/RepRecuperacionDetalle.aspx.vb index a9d1e44b0..bbbb91a97 100644 --- a/Ventas/RepRecuperacionDetalle.aspx.vb +++ b/Ventas/RepRecuperacionDetalle.aspx.vb @@ -133,8 +133,8 @@ Partial Class Ventas_RepRecuperacionDetalle DdlMoneda.Items.Insert(0, New ListItem("Todos", "-1")) DdlMoneda.DataBind() - txtFechaI.Text = $"01/{Now.Month}/{Now.Year}" - txtFechaF.Text = Now.ToShortDateString + 'txtFechaI.Text = $"01/{Now.Month}/{Now.Year}" + 'txtFechaF.Text = Now.ToShortDateString 'Cargamos las fechas FechaI = If(Request("FechaI") IsNot Nothing, Request("FechaI").ToString, "-1").ToString diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index e432c9bc9..164a4f081 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -3959,7 +3959,7 @@
    + DataKeyNames="ISTotal,Saldo,CveIE,Folio,Tipo,CveVenta,CveConceptoContable,CveConceptoContableAmor, TotalAnticipo, SubTotalAnticipo, IVAAnticipo,IEPS, ImpuestosLocalesAnticipo, SubTotalAmortizacion, SubTotal, Original, IVA, RetIVA, RetISR, IdCtaContableNC,FolioFiscal, CveClasificacionNC, TipoCambio,TipoCambioPago,TipoCambioHoy, CveMoneda,Fecha,SaldoSubTotal,SaldoConImpuestos,RegresarImpuesto,DevolucionImportePagado,CveCliente"> diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 9e455dceb..efc318b5f 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -781,11 +781,7 @@ Partial Class Ventas Return ViewState("IdCtaContClientes").ToString().ToEntero() End Get End Property - Private ReadOnly Property CveCuentaClientes As Integer - Get - Return ViewState("CveCuentaClientes").ToString().ToEntero() - End Get - End Property + Private ReadOnly Property IdCtaContMonedaExtranjera As Integer Get Return ViewState("IdCtaContMonedaExtranjera").ToString().ToEntero() @@ -801,31 +797,19 @@ Partial Class Ventas Return ViewState("IdCtaContAnticipos").ToString().ToEntero() End Get End Property - Private ReadOnly Property CveCuentaAnticipos As Integer - Get - Return ViewState("CveCuentaAnticipos").ToString().ToEntero() - End Get - End Property + Private ReadOnly Property IdCtaContRetIVA As Integer Get Return ViewState("IdCtaContRetIVA").ToString().ToEntero() End Get End Property - Private ReadOnly Property CveCuentaRetIVA As Integer - Get - Return ViewState("CveCuentaRetIVA").ToString().ToEntero() - End Get - End Property + Private ReadOnly Property IdCtaContRetISR As Integer Get Return ViewState("IdCtaContRetISR").ToString().ToEntero() End Get End Property - Private ReadOnly Property CveCuentaRetISR As Integer - Get - Return ViewState("CveCuentaRetISR").ToString().ToEntero() - End Get - End Property + Private ReadOnly Property CodCliente As String Get @@ -4135,7 +4119,7 @@ Partial Class Ventas End If If UsuarioActual.TienePermisoProceso(318) Then - If DdlTipoComprobante.SelectedValue.Contiene("Egs", "Ing", "Ant", "Dev") AndAlso String.IsNullOrEmpty(LblFolioFiscal.Text.Trim) Then HplFolioFiscalModal.Visible = True + If DdlTipoComprobante.SelectedValue.Contiene("Egs", "Ing", "Ant", "Dev") AndAlso String.IsNullOrEmpty(DbRowVenta("FolioFiscal").ToString.Trim) Then HplFolioFiscalModal.Visible = True End If Select Case DbRowVenta("TipoDocto").ToString() @@ -4915,11 +4899,11 @@ Partial Class Ventas 'ACTIVA CONVERSION DE MONEDA If DdlMoneda.SelectedValue.ToEntero() = 1 Then TrConversionDolares.Visible = True - ChkConvertirDolares.Enabled = True + ChkConvertirDolares.Enabled = Not UsuarioActual.TienePermisoProceso(324) TxtTipoCambioDlls.Enabled = True Else TrConversionTipoCambio.Visible = True - ChkConvertirDoctoPesos.Enabled = True + ChkConvertirDoctoPesos.Enabled = Not UsuarioActual.TienePermisoProceso(324) TxtTipoCambio.Enabled = True End If End If @@ -5311,10 +5295,10 @@ Partial Class Ventas Private Sub CargaMetodosPago() 'FACTURACION 3.3 - DdlMetodoPago33.DataSource = GlobalDTVtaMetodoPago + DdlMetodoPago33.DataBind() - DdlMetodoPago33.SelectedValue = "3" + DdlMetodoPago33.SelectedValueExist("3") CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero()) @@ -5599,15 +5583,11 @@ Partial Class Ventas ViewState("Vendedor") = ObjCliente.Vendedor ViewState("CtaContable") = ObjCliente.CuentaContable ViewState("IdCtaContClientes") = ObjCliente.IdCtaContClientes - ViewState("CveCuentaClientes") = ObjCliente.CveCuentaClientes ViewState("IdCtaContMonedaExtranjera") = ObjCliente.IdCtaContMonedaExtranjera ViewState("IdCtaContComplementaria") = ObjCliente.IdCtaContComplementaria ViewState("IdCtaContAnticipos") = ObjCliente.IdCtaContAnticipos - ViewState("CveCuentaAnticipos") = ObjCliente.CveCuentaAnticipos ViewState("IdCtaContRetIVA") = ObjCliente.IdCtaContRetIVA - ViewState("CveCuentaRetIVA") = ObjCliente.CveCuentaRetIVA ViewState("IdCtaContRetISR") = ObjCliente.IdCtaContRetISR - ViewState("CveCuentaRetISR") = ObjCliente.CveCuentaRetISR ViewState("CodCliente") = ObjCliente.Codigo ViewState("CvePrecioLista") = ObjCliente.CvePrecioLista @@ -5656,7 +5636,7 @@ Partial Class Ventas Me.CveFormaPago33Cliente = ObjCliente.CveFormaPago33 - If (CveVenta <= 0 AndAlso CveCotizacion <= 0) Or EsCreaApartirDe Or NuevaFactura = 1 Then + If (CveVenta <= 0 AndAlso CveCotizacion <= 0) Or EsCreaApartirDe Or NuevaFactura = 1 OrElse ModalidadEdicion Then 'CveMetodoPagoCliente = ObjCliente.CveMetodoPago @@ -5752,16 +5732,13 @@ Partial Class Ventas ViewState("AplicaFord") = ObjCliente.AplicaFord TxtFordGSDB.Text = ObjCliente.Ford_GSDB - 'SELECIONAMOS VENDEDOR - SI ESTA EN MODO EDICIÓN SE QUEDA EL VENDEDOR ORIGINAL - If Not ModalidadEdicion Then - If ObjCliente.DtResultados(0)("CveVendedor").ToString().ToEntero() > 0 Then - DdlVendedor.SelectedValueExist(ObjCliente.DtResultados(0)("CveVendedor").ToString().ToEntero()) - End If + If ObjCliente.DtResultados(0)("CveVendedor").ToString().ToEntero() > 0 Then + DdlVendedor.SelectedValueExist(ObjCliente.DtResultados(0)("CveVendedor").ToString().ToEntero()) + End If - 'SI EL CLIENTE NO TIENE VENDEDOR SELECCIONAMOS EL DEL USUARIO - If Not DdlVendedor.SelectedValue.ToEntero() > 0 Then - DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString()) - End If + 'SI EL CLIENTE NO TIENE VENDEDOR SELECCIONAMOS EL DEL USUARIO + If Not DdlVendedor.SelectedValue.ToEntero() > 0 Then + DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString()) End If If DdlVendedor.SelectedValue.ToEntero() > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then @@ -6155,6 +6132,24 @@ Partial Class Ventas End Sub Private Sub CargaRestriccionesCreditoCliente(Optional Alertas As Boolean = False, Optional CveVenta As Integer = -1) + 'RMF. validacion temporal + 'verifica si tiene autorizaciones de Nota de crédito autorizadas + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then ' si es empresa de acumuladores + Dim ObjVentas As New ClsVentas + + If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, -1, CveEstatus:=1) Then + Dim RowAutorizacion As DataRow = ObjVentas.DtResultados.FiltroPrimero($"CveVenta IS NULL AND CveTipoDocumento='Egs'", Orderby:="TipoAutorizacion") + + If RowAutorizacion IsNot Nothing Then + DdlTipoComprobante.SelectedValueExistInsert("Egs", "Egresos") + End If + + End If + + ObjVentas.Dispose() + End If + + 'OBLIGAR PAGO DE CONTADO SI EL CLIENTE NO PERMITE CREDITO If UsuarioActual.Empresa.Funcionalidad(570) = "1" AndAlso Me.PermiteCredito = False AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") AndAlso CveVenta < 1 Then RBLPago.SelectedValue = "2" RBLPago.Items(0).Enabled = False @@ -6167,7 +6162,9 @@ Partial Class Ventas 'si llegó por la opción de cotización no debe de restringuir If IfNull(Request("Op"), "").ToString() = "Cot" Then DdlTipoComprobante.SelectedValue = "Cot" DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing")) - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) + If Not UsuarioActual.TienePermisoProceso(325) Then + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) + End If DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem")) LnkPedido2SinFacturar.Visible = False LnkCotizaciones.Visible = False @@ -6186,7 +6183,6 @@ Partial Class Ventas If PorcentajeCredito > 80 Then TrPorcentajeCredito.Visible = True : LblPorcentajeCredito.Text = $"{PorcentajeCredito.FormatoNumero}%" If UsuarioActual.Empresa.Funcionalidad(597) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(268) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "PA") Then - 'If LblRFC.Text.Trim <> "XAXX010101000" Then Dim Vta As New ClsVentas Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa) @@ -6206,7 +6202,9 @@ Partial Class Ventas If IfNull(Request("Op"), "").ToString() = "Cot" Then DdlTipoComprobante.SelectedValue = "Cot" 'quito remisión y factura DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing")) - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) + If Not UsuarioActual.TienePermisoProceso(325) Then + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) + End If DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem")) If Opcion = 1 Then BtnEmitirImprimir.Visible = False @@ -6265,7 +6263,9 @@ Partial Class Ventas 'si llegó por la opción de cotización no debe de restringuir If IfNull(Request("Op"), "").ToString() = "Cot" Then DdlTipoComprobante.SelectedValue = "Cot" DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing")) - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) + If Not UsuarioActual.TienePermisoProceso(325) Then + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) + End If DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem")) BtnsFacturar.Visible = False LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274) @@ -6275,10 +6275,38 @@ Partial Class Ventas LnkOCs.Visible = False Else - If Alertas AndAlso UsuarioActual.Empresa.Funcionalidad(518) = "1" Then Alert("El cliente tiene su límite de crédito agotado.", TipoMensaje.MsgAdvertencia) + 'RMF. codigo temporal para pruebas + If Alertas AndAlso UsuarioActual.CveEmpresa = 140 AndAlso UsuarioActual.CveUsuario.Contiene(100, 1937, 2275) AndAlso Now.Hour > 5 AndAlso Now.Hour < 9 Then + Dim Vta As New ClsVentas + Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa) + Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón:

    {0}", Vta.SerieVenta) + Vta.Dispose() + If Opcion > 0 Then + LnkSolicitarCredito.Visible = True + Alert(OpcionMsg, TipoMensaje.MsgAdvertencia) + End If + Else + + If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then + RBLPago.SelectedValue = "2" + RBLPago.Items(0).Enabled = False + RBLPago_SelectedIndexChanged(Nothing, Nothing) + UPCondicionesPago.Update() + Else + 'este codigo no es temporal + If Alertas AndAlso UsuarioActual.Empresa.Funcionalidad(518) = "1" Then Alert("El cliente tiene su límite de crédito agotado.", TipoMensaje.MsgAdvertencia) + If UsuarioActual.CveEmpresa = 140 Then + LnkSolicitarCredito.Visible = True + DdlTipoAutorizacion.SelectedValueExist("1") + End If + End If + + + End If End If End If UPPCreditoDisponible.Update() + 'Si tiene credito disponible, Verificar limites de (verificar candados de venta, remisiones sin facturar, facturas que no tengan vencidas) ElseIf UsuarioActual.Empresa.Funcionalidad(597) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(268) AndAlso CveVenta > 0 AndAlso (DdlTipoComprobante.SelectedValue.Contiene("Pd2", "Cot") Or (DdlTipoComprobante.SelectedValue = "Rem" And ModalidadEdicion And ViewState("CveClienteAnterior").ToString().ToEntero() > 0 And LblRFC.Text.Trim <> "XAXX010101000")) Then Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero()) If CreditoDispo > 0 Then @@ -6302,7 +6330,9 @@ Partial Class Ventas Exit Sub ElseIf DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso EsCreaApartirDe Then DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing")) - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) + If Not UsuarioActual.TienePermisoProceso(325) Then + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) + End If DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem")) DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Pd2")) DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Egs")) @@ -7854,7 +7884,13 @@ Partial Class Ventas Dim ObjVentas As New ClsVentas Try If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, CveVendedor, CveEstatus:=1) Then - Dim RowAutorizacion As DataRow = ObjVentas.DtResultados.FiltroPrimero($"CveVenta IS NULL AND CveTipoDocumento='{DdlTipoComprobante.SelectedValue}'", Orderby:="TipoAutorizacion") + Dim RowAutorizacion As DataRow = Nothing + 'SI TIENE DIAS VENCIDOS BUSCAR POR TIPO VENCIMIENTO + If TieneDiasVencidos Then + RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 2 AND CveVenta IS NULL AND CveTipoDocumento='{DdlTipoComprobante.SelectedValue}'") + Else + RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='{DdlTipoComprobante.SelectedValue}'", Orderby:="Importe DESC") + End If If RowAutorizacion IsNot Nothing Then TipoDocumentoAutorizacion = RowAutorizacion("CveTipoDocumento").ToString() @@ -7894,12 +7930,22 @@ Partial Class Ventas End If End If - If DdlTipoComprobante.SelectedValue = "Egs" AndAlso CveAutorizacion <= 0 Then + If TieneDiasVencidos AndAlso DdlTipoComprobante.SelectedValue = "Egs" AndAlso CveAutorizacion <= 0 Then CveAutorizacion = -1 - Alert($"El crédito no esta autorizado. No tiene autorización para generar notas de crédito.", TipoMensaje.MsgAdvertencia) + Alert($"El crédito no esta autorizado. No tiene autorización para generar notas de crédito. El cliente tiene días vencidos", TipoMensaje.MsgAdvertencia) Exit Sub End If + If TipoDocumentoAutorizacion = "Egs" Then + If TipoAutorizacion = 1 Then + If ImporteAutorizacion < TxtTotal.Text.ToDecimal() Then + CveAutorizacion = -1 + Alert($"El crédito autorizado es insuficiente. Crédito Disponible:{ImporteAutorizacion:N2}", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + End If + End If + End If EmitirImprimirNew(TipoDoctoViejo) @@ -8244,7 +8290,7 @@ Partial Class Ventas Dim GeneroDescuentoProntoPago As Boolean = False 'SOLO GENERAR NC POR DESCUENTO PRONTO PAGO SI EL PAGO ES DE CONTADO - If RBLPago.SelectedValue = "2" AndAlso ObjFactura.DescuentoProntoPago > 0 Then + If ErrorList.Count = 0 AndAlso RBLPago.SelectedValue = "2" AndAlso ObjFactura.DescuentoProntoPago > 0 Then Dim ImportePagado = DtPagos.SUM("Importe").ToString().ToDecimal Dim ImporteRNC As Decimal = LblDescuentosRNC.Text.ToDecimal() @@ -11126,8 +11172,9 @@ Partial Class Ventas 'SI LA FACTURA ESTA PAGADA DEBE MARCAR LA DEVOLUCION POR SI SE QUIERE AMORTIZAR - If (ObjFacturaNC IsNot Nothing AndAlso ObjFacturaNC.Pagado > 0) AndAlso factura.TipoDocto = "Dev" Then + If (ObjFacturaNC IsNot Nothing AndAlso ObjFacturaNC.PagadoBancos > 0) AndAlso factura.TipoDocto = "Dev" Then factura.Alfa3 = "DEV" + factura.DevolucionImportePagado = ObjFacturaNC.Total / ObjFacturaNC.PagadoBancos 'falta tomar el dato 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) @@ -11169,7 +11216,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, RFCReceptor:=RFCReceptor, Adjunto:=Adjunto) Then + FormaPaqueteria:=RblPaqueteria.SelectedValue.ToEntero, FacturarSucursal:=factura.FacturarSucursal, VentaDesglosaIEPS:=factura.VentaDesglosaIEPS, RFCReceptor:=RFCReceptor, Adjunto:=Adjunto, DevolucionImportePagado:=factura.DevolucionImportePagado) Then ErrorList.Add("Ocurrió un error al Generar la Venta.
    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 @@ -11294,8 +11341,11 @@ Partial Class Ventas TmpDr("CveVentaDetalle") = ObjVentas.CveVentaDetalle Try - Dim InvDr As DataRow = DtInv.Select($"Consec = {Row("Consec").ToString()}")(0) - InvDr("CveVentaDetalle") = ObjVentas.CveVentaDetalle + If DtInv IsNot Nothing AndAlso DtInv.Rows.Count > 0 Then + Dim InvDr As DataRow = DtInv.Select($"Consec = {Row("Consec").ToString()}")(0) + InvDr("CveVentaDetalle") = ObjVentas.CveVentaDetalle + End If + Catch ex As Exception End Try @@ -11647,9 +11697,7 @@ Partial Class Ventas Dim importeMovimiento As Decimal Dim FechaMovimiento As Date = ObjFactura.Fecha Dim IdCtaContable As Integer - Dim CveCuenta As Integer Dim IdCtaContableCliente As Integer - Dim CveCuentaCliente As Integer Dim Concepto As String = ObjFactura.SerieFolio Dim Referencia As String = ObjFactura.SerieFolio Dim Fecha = TxtFecha.Text.Trim.ToDate @@ -11663,8 +11711,6 @@ Partial Class Ventas Dim CveSubProyectoContabilizar As Integer Dim IdCtaIVAXTrasladar As Integer = 0 Dim IdCtaIVATrasladado As Integer = 0 - Dim CveCuentaIVAxTrasladar As Integer = 0 - Dim CveCuentaIVATrasladado As Integer = 0 Dim SeContabiliza As Boolean = True Dim SimplificarPrePoliza As Boolean = False @@ -11675,9 +11721,7 @@ Partial Class Ventas If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows.Count > 0 Then IdCtaIVAXTrasladar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows(0)("IdCtaIVAXTrasladar").ToString().ToEntero() - CveCuentaIVAxTrasladar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows(0)("CveCuentaIVAXTrasladar").ToString().ToEntero() IdCtaIVATrasladado = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows(0)("IdCtaIVATrasladado").ToString().ToEntero() - CveCuentaIVATrasladado = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows(0)("CveCuentaIVATrasladado").ToString().ToEntero() End If Dim UsaComplementariaClientes As Boolean = True @@ -11691,7 +11735,6 @@ Partial Class Ventas TipoMovimiento = If(Row("TipoMovto").ToString() = "True", True, False) importeMovimiento = 0 IdCtaContable = 0 - CveCuenta = 0 CveSubProyectoContabilizar = 0 Multiplicador = (Row("Multiplicador").ToString().ToEntero()) Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, ConceptoContable, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", "") @@ -11714,23 +11757,19 @@ Partial Class Ventas If tipoCambio = 1 Then IdCtaContable = ObjFactura.Cliente.IdCtaContClientes - CveCuenta = ObjFactura.Cliente.CveCuentaClientes Else IdCtaContable = ObjFactura.Cliente.IdCtaContComplementaria - CveCuenta = 0 - If importeMovimiento <> 0 AndAlso (IdCtaContable > 0 Or CveCuenta > 0 Or UsaComplementariaClientes) Then + If importeMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsaComplementariaClientes) Then importeMX = importeMovimiento - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, 0, Referencia, 203, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=Math.Round(importeMovimiento * tipoCambio - importeMovimiento, 2, MidpointRounding.AwayFromZero), ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, 0, Referencia, 203, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=(importeMovimiento * tipoCambio - importeMovimiento).RoundSQL, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then ErrorPrepoliza = True End If End If IdCtaContable = ObjFactura.Cliente.IdCtaContMonedaExtranjera - CveCuenta = ObjFactura.Cliente.CveCuentaMonedaExtranjera End If IdCtaContableCliente = IdCtaContable - CveCuentaCliente = CveCuenta End If 'Case 7 'descuentos @@ -11752,7 +11791,6 @@ Partial Class Ventas importeMX = importeMovimiento * tipoCambio * Multiplicador FechaMovimiento = ObjFactura.FechaPago IdCtaContable = ObjFactura.Cliente.IdCtaContAnticipos - CveCuenta = ObjFactura.Cliente.CveCuentaAnticipos CveSubProyectoContabilizar = CveSubProyectoVenta If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" End If @@ -11767,16 +11805,13 @@ Partial Class Ventas If tipoCambio = 1 Then IdCtaContable = ObjFactura.Cliente.IdCtaContClientes - CveCuenta = ObjFactura.Cliente.CveCuentaClientes Else IdCtaContable = ObjFactura.Cliente.IdCtaContMonedaExtranjera - CveCuenta = ObjFactura.Cliente.CveCuentaMonedaExtranjera End If IdCtaContableCliente = IdCtaContable - CveCuentaCliente = CveCuenta - If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 190, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 193, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then + If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 190, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 193, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then ErrorPrepoliza = True End If Else @@ -11798,16 +11833,13 @@ Partial Class Ventas If tipoCambio = 1 Then IdCtaContable = ObjFactura.Cliente.IdCtaContClientes - CveCuenta = ObjFactura.Cliente.CveCuentaClientes Else IdCtaContable = ObjFactura.Cliente.IdCtaContMonedaExtranjera - CveCuenta = ObjFactura.Cliente.CveCuentaMonedaExtranjera End If IdCtaContableCliente = IdCtaContable - CveCuentaCliente = CveCuenta - If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 277, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 278, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then + If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 277, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 278, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then ErrorPrepoliza = True End If Else @@ -11829,15 +11861,13 @@ Partial Class Ventas If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" If tipoCambio = 1 Then IdCtaContable = ObjFactura.Cliente.IdCtaContClientes - CveCuenta = ObjFactura.Cliente.CveCuentaClientes ElseIf UsaComplementariaClientes Then IdCtaContable = ObjFactura.Cliente.IdCtaContComplementaria - CveCuenta = 0 - If importeMovimiento <> 0 AndAlso (IdCtaContable > 0 Or CveCuenta > 0 Or UsaComplementariaClientes) Then + If importeMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsaComplementariaClientes) Then importeMX = importeMovimiento - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, 0, Referencia, 203, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=Math.Round(importeMovimiento * tipoCambio - importeMovimiento, 2, MidpointRounding.AwayFromZero), ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, 0, Referencia, 203, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=Math.Round(importeMovimiento * tipoCambio - importeMovimiento, 2, MidpointRounding.AwayFromZero), ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, CveSubProyecto:=CveSubProyectoContabilizar) Then ErrorPrepoliza = True End If End If @@ -11856,7 +11886,7 @@ Partial Class Ventas ' CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString()) ' CveCuentaContabilizacion = 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), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar) Then + 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), CveSubProyecto:=CveSubProyectoContabilizar) Then ErrorPrepoliza = True Else ViewState("SeGuardoPrePoliza") = True @@ -11970,11 +12000,10 @@ Partial Class Ventas If DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then ImporteAnticipo = row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal / row2.DataKey("TotalAnticipo").ToDecimal * row2.DataKey("SubTotalAnticipo").ToDecimal IdCtaContable = IdCtaContAnticipos - CveCuenta = CveCuentaAnticipos CveSubProyectoContabilizar = CveSubProyectoVenta If importeMovimiento <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ImporteAnticipo, Referencia, 11, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=ImporteAnticipo * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ImporteAnticipo, Referencia, 11, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=ImporteAnticipo * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then ErrorPrepoliza = True Exit For Else @@ -12071,16 +12100,14 @@ Partial Class Ventas CveConceptoFluctua = 65 TipoMovtoFluctua = False IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria - CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria Else CveConceptoFluctua = 64 TipoMovtoFluctua = True IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaGananciaCambiaria - CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria End If Dim ImporteFluctuacion As Decimal = Math.Abs((Importe251 * difFluctuacion).RoundSQL) - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovtoFluctua, ImporteFluctuacion, Referencia, CveConceptoFluctua, Concepto, FechaMovimiento, IdCtaContableFluctua, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString().ToEntero(), ImporteMX:=ImporteFluctuacion, ImporteME:=ImporteFluctuacion, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=TipoCambioNC, TipoCambioPago:=Dr("TCCambioValuacion").ToString().ToDecimal, CveCuenta:=CveCuenta) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovtoFluctua, ImporteFluctuacion, Referencia, CveConceptoFluctua, Concepto, FechaMovimiento, IdCtaContableFluctua, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=Dr("CveVenta").ToString().ToEntero(), ImporteMX:=ImporteFluctuacion, ImporteME:=ImporteFluctuacion, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=TipoCambioNC, TipoCambioPago:=Dr("TCCambioValuacion").ToString().ToDecimal) Then ErrorPrepoliza = True Exit For End If @@ -12178,16 +12205,14 @@ Partial Class Ventas CveConceptoFluctua = 65 TipoMovtoFluctua = False IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria - CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria Else CveConceptoFluctua = 64 TipoMovtoFluctua = True IdCtaContableFluctua = UsuarioActual.Empresa.IdCuentaGananciaCambiaria - CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria End If Dim ImporteFluctuacion As Decimal = Math.Abs((importeMovimientoDev * difFluctuacion).RoundSQL) - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovtoFluctua, ImporteFluctuacion, Referencia, CveConceptoFluctua, Concepto, FechaMovimiento, IdCtaContableFluctua, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=CveVentaDevolucion, ImporteMX:=ImporteFluctuacion, ImporteME:=ImporteFluctuacion, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio, TipoCambioPago:=TipoCambioFactura, CveCuenta:=CveCuenta) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovtoFluctua, ImporteFluctuacion, Referencia, CveConceptoFluctua, Concepto, FechaMovimiento, IdCtaContableFluctua, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=CveVentaDevolucion, ImporteMX:=ImporteFluctuacion, ImporteME:=ImporteFluctuacion, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio, TipoCambioPago:=TipoCambioFactura) Then ErrorPrepoliza = True Exit For End If @@ -12252,11 +12277,10 @@ Partial Class Ventas If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" IdCtaContable = IdCtaContAnticipos - CveCuenta = CveCuentaAnticipos CveSubProyectoContabilizar = CveSubProyectoVenta If importeMovimiento <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then ErrorPrepoliza = True Exit For Else @@ -12277,11 +12301,10 @@ Partial Class Ventas If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" IdCtaContable = IdCtaContAnticipos - CveCuenta = CveCuentaAnticipos CveSubProyectoContabilizar = CveSubProyectoVenta If importeMovimiento <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVentaAnticipo, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVentaAnticipo, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then ErrorPrepoliza = True Exit For Else @@ -12310,11 +12333,10 @@ Partial Class Ventas If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" IdCtaContable = IdCtaContAnticipos - CveCuenta = CveCuentaAnticipos CveSubProyectoContabilizar = CveSubProyectoVenta If importeMovimiento <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToEntero(), CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then ErrorPrepoliza = True Exit For Else @@ -12335,12 +12357,11 @@ Partial Class Ventas For Each Row2 As DataRow In DT.Rows importeMovimiento = Math.Abs(Row2("PU").ToString().ToDecimal) IdCtaContable = IdCtaContAnticipos - CveCuenta = CveCuentaAnticipos CveSubProyectoContabilizar = CveSubProyectoVenta If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" If importeMovimiento <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then ErrorPrepoliza = True Else ViewState("SeGuardoPrePoliza") = True @@ -12379,8 +12400,8 @@ Partial Class Ventas If importeMovimiento <> 0 Then - If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, Referencia, 251, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVentaNC").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=ObjFactura.CveVenta, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, importeMovimiento, Referencia, 91, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=row2.DataKey("CveVentaNC").ToString().ToEntero(), ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then + If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, importeMovimiento, Referencia, 251, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVentaNC").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=ObjFactura.CveVenta, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, importeMovimiento, Referencia, 91, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=row2.DataKey("CveVentaNC").ToString().ToEntero(), ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then ErrorPrepoliza = True Exit For End If @@ -12406,12 +12427,11 @@ Partial Class Ventas sumaAmorticaciones += importeMovimiento If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" IdCtaContable = IdCtaContAnticipos - CveCuenta = CveCuentaAnticipos CveSubProyectoContabilizar = CveSubProyectoVenta If importeMovimiento <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=ObjFactura.CveVenta, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2.DataKey("CveVenta").ToString().ToEntero(), CveCliente:=ObjFactura.CveCliente, CveVentaAmortizacion:=ObjFactura.CveVenta, ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then ErrorPrepoliza = True End If End If @@ -12441,10 +12461,8 @@ Partial Class Ventas If tipoCambio = 1 Then IdCtaContable = ObjFactura.Cliente.IdCtaContClientes - CveCuenta = ObjFactura.Cliente.CveCuentaClientes Else IdCtaContable = ObjFactura.Cliente.IdCtaContMonedaExtranjera - CveCuenta = ObjFactura.Cliente.CveCuentaMonedaExtranjera End If 'ACTUALIZA SI LA VENTA FUE MARCADA CON OTRA PARA EL FILTRO DE USADOS @@ -12455,7 +12473,6 @@ Partial Class Ventas End If IdCtaContableCliente = IdCtaContable - CveCuentaCliente = CveCuenta Dim CveMovimiento As Integer = -1 Dim CveAlmacen As Integer = -1 @@ -12468,7 +12485,7 @@ Partial Class Ventas 'VERIFICA SI TIENE MOVIMIENTO DE ENTRADA DE USADO If CveMovimiento > 0 AndAlso CveAlmacen > 0 Then - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 277, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjRNC.CveVenta, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 277, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjRNC.CveVenta, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then ErrorPrepoliza = True End If @@ -12476,19 +12493,19 @@ Partial Class Ventas Dim Importe318 As Decimal = (SubTotalCalculado * ObjRNC.PorcentajeIVA).RoundSQL(2).ToDecimal() - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, Importe318, Referencia, 318, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjRNC.CveVenta, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=Importe318, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, Importe318, Referencia, 318, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjRNC.CveVenta, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=Importe318, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then ErrorPrepoliza = True End If - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, SubTotalCalculado, Referencia, 150, Concepto, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=ObjRNC.CveVenta, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, CveClasificacion:=ObjRNC.DtDetalle.MAX("CveClasificacion").ToEntero(), CveSubProyecto:=ObjRNC.CveSubProyecto, ImporteMX:=SubTotalCalculado, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, CveCuenta:=CveCuenta, Contabilizable:=False) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, SubTotalCalculado, Referencia, 150, Concepto, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=ObjRNC.CveVenta, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, CveClasificacion:=ObjRNC.DtDetalle.MAX("CveClasificacion").ToEntero(), CveSubProyecto:=ObjRNC.CveSubProyecto, ImporteMX:=SubTotalCalculado, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, Contabilizable:=False) Then ErrorPrepoliza = True Else ViewState("SeGuardoPrePoliza") = True End If Else - If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 277, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjRNC.CveVenta, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 278, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjRNC.CveVenta, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then + If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 277, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjRNC.CveVenta, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 278, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjRNC.CveVenta, CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then ErrorPrepoliza = True End If Else @@ -12504,7 +12521,7 @@ Partial Class Ventas If sumaAmorticaciones <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, sumaAmorticaciones, Referencia, 251, Concepto, FechaMovimiento, IdCtaContClientes, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=sumaAmorticaciones * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaCliente, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, sumaAmorticaciones, Referencia, 251, Concepto, FechaMovimiento, IdCtaContClientes, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=sumaAmorticaciones * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=Contabilizable) Then ErrorPrepoliza = True Else ViewState("SeGuardoPrePoliza") = True @@ -12592,11 +12609,6 @@ Partial Class Ventas idCuentaContabilizacion = 0 End If - 'If CveCuenta <= 0 Then - ' CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString() + GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString()}")) - ' CveCuentaContabilizacion = 0 - 'End If - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContableAplicar, Concepto, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVentaAplicar, CveVentaAmortizacion:=CveVentaAmortizacionAplicar, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, CveClasificacion:=Row2("CveClasificacion").ToString().ToEntero(), CveSubProyecto:=Row2("CveSubProyecto").ToString().ToEntero(), ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, PorcentajeImpuesto:=Row2("PorcentajeIVA").ToString().ToDecimal) Then ErrorPrepoliza = True Else @@ -12754,7 +12766,7 @@ Partial Class Ventas If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" 'SI LA FACTURA ESTA PAGADA EN SU TOTALIDAD DEBE REGRESAR EL IMPUESTO - If (ObjFacturaNC IsNot Nothing AndAlso ObjFacturaNC.Pagado > 0) AndAlso ObjFactura.TipoDocto = "Dev" Then + If (ObjFacturaNC IsNot Nothing AndAlso ObjFacturaNC.PagadoBancos > 0) AndAlso ObjFactura.TipoDocto = "Dev" Then TipoMovimiento = Not TipoMovimiento ConceptoContable = 62 importeMovimiento = importeMovimiento * -1 @@ -12772,16 +12784,6 @@ Partial Class Ventas End If End If - 'CONTABILIDAD SIG - If CveCuentaRetIVA > 0 Then - CveCuenta = CveCuentaRetIVA - Else - If importeMovimiento <> 0 AndAlso 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 313 'Ret Iva Servicios @@ -12793,7 +12795,7 @@ Partial Class Ventas If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" 'SI LA FACTURA ESTA PAGADA EN SU TOTALIDAD DEBE REGRESAR EL IMPUESTO - If (ObjFacturaNC IsNot Nothing AndAlso ObjFacturaNC.Pagado > 0) AndAlso ObjFactura.TipoDocto = "Dev" Then + If (ObjFacturaNC IsNot Nothing AndAlso ObjFacturaNC.PagadoBancos > 0) AndAlso ObjFactura.TipoDocto = "Dev" Then TipoMovimiento = Not TipoMovimiento ConceptoContable = 314 importeMovimiento = importeMovimiento * -1 @@ -12818,7 +12820,7 @@ Partial Class Ventas CveSubProyectoContabilizar = CveSubProyectoVenta 'SI LA FACTURA ESTA PAGADA EN SU TOTALIDAD DEBE REGRESAR EL IMPUESTO - If (ObjFacturaNC IsNot Nothing AndAlso ObjFacturaNC.Pagado > 0) AndAlso ObjFactura.TipoDocto = "Dev" Then + If (ObjFacturaNC IsNot Nothing AndAlso ObjFacturaNC.PagadoBancos > 0) AndAlso ObjFactura.TipoDocto = "Dev" Then TipoMovimiento = Not TipoMovimiento ConceptoContable = 63 importeMovimiento = importeMovimiento * -1 @@ -12838,16 +12840,6 @@ Partial Class Ventas 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 If Not ObjFactura.TipoDocto.Contiene("Rem", "RNC") And ObjFactura.IVA > 0 Then @@ -12857,17 +12849,15 @@ Partial Class Ventas PorcentajeImpuesto = TmpDT.MAX("PorcentajeIVA").ToDecimal 'SI LA FACTURA ESTA PAGADA EN SU TOTALIDAD DEBE REGRESAR EL IMPUESTO - If (ObjFacturaNC IsNot Nothing AndAlso ObjFacturaNC.Pagado > 0) AndAlso ObjFactura.TipoDocto = "Dev" Then + If (ObjFacturaNC IsNot Nothing AndAlso ObjFacturaNC.PagadoBancos > 0) AndAlso ObjFactura.TipoDocto = "Dev" Then TipoMovimiento = Not TipoMovimiento ConceptoContable = 61 importeMovimiento = importeMovimiento * -1 importeMX = importeMX * -1 IdCtaContable = If(IdCtaIVATrasladado > 0, IdCtaIVATrasladado, UsuarioActual.Empresa.IdCuentaIVATrasladado) - CveCuenta = If(CveCuentaIVATrasladado > 0, CveCuentaIVATrasladado, UsuarioActual.Empresa.CveCuentaIVATrasladado) Else IdCtaContable = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar) - CveCuenta = If(CveCuentaIVAxTrasladar > 0, CveCuentaIVAxTrasladar, UsuarioActual.Empresa.CveCuentaIVAxTrasladar) End If @@ -12875,39 +12865,6 @@ Partial Class Ventas If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}" End If - 'If ObjFactura.TipoDocto = "Egs" Then - - ' importeMovimiento = ObjFactura.IVA * ValorMultiplicador - ' importeMX = Math.Round(importeMovimiento * tipoCambio * Multiplicador, 2) - ' FechaMovimiento = ObjFactura.FechaPago - ' PorcentajeImpuesto = TmpDT.MAX("PorcentajeIVA").ToDecimal - - ' If importeMovimiento <> 0 Then - ' 'IVA X TRASLADAR - ' IdCtaIVAXTrasladar = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar) - ' CveCuentaIVAxTrasladar = If(CveCuentaIVAxTrasladar > 0, CveCuentaIVAxTrasladar, UsuarioActual.Empresa.CveCuentaIVAxTrasladar) - ' Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 13, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString()) - - ' If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 13, Concepto, Fecha, IdCtaIVAXTrasladar, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=-1, ImporteMX:=importeMX * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaIVAxTrasladar, CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuesto) Then - ' ErrorPrepoliza = True - ' Exit For - ' End If - - ' 'IVA PAGADO - ' IdCtaIVATrasladado = If(IdCtaIVATrasladado > 0, IdCtaIVATrasladado, UsuarioActual.Empresa.IdCuentaIVATrasladado) - ' CveCuentaIVATrasladado = If(CveCuentaIVATrasladado > 0, CveCuentaIVATrasladado, UsuarioActual.Empresa.CveCuentaIVATrasladado) - ' Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 61, ObjFactura.Cliente.Nombre, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString()) - - ' If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 61, Concepto, Fecha, IdCtaIVATrasladado, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=-1, ImporteMX:=importeMX * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaIVATrasladado, CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuesto) Then - ' ErrorPrepoliza = True - ' Exit For - ' End If - ' End If - - - ' importeMovimiento = 0 - ' importeMX = 0 - 'End If Case 38 'IEPS por Trasladar If Not ObjFactura.TipoDocto.Contiene("Rem") Then @@ -12917,23 +12874,22 @@ Partial Class Ventas CveSubProyectoContabilizar = CveSubProyectoVenta 'SI LA FACTURA ESTA PAGADA EN SU TOTALIDAD DEBE REGRESAR EL IMPUESTO - If (ObjFacturaNC IsNot Nothing AndAlso ObjFacturaNC.Pagado > 0) AndAlso ObjFactura.TipoDocto = "Dev" Then + If (ObjFacturaNC IsNot Nothing AndAlso ObjFacturaNC.PagadoBancos > 0) AndAlso ObjFactura.TipoDocto = "Dev" Then TipoMovimiento = Not TipoMovimiento ConceptoContable = 39 importeMovimiento = importeMovimiento * -1 importeMX = importeMX * -1 + CveIE = ObjFacturaNC.PagadoCveIE If importeMovimiento <> 0 AndAlso ObjConta.GetRetCuenta(ConceptoContable, ObjFactura.CveEmpresa) Then If ObjConta.DtResultados.Rows.Count > 0 Then IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSTrasladado").ToString().ToEntero() - CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSTrasladadoSIG").ToString().ToEntero() End If End If Else 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 End If @@ -12986,7 +12942,6 @@ Partial Class Ventas importeMovimiento = DrPago("Importe").ToString().ToDecimal * ValorMultiplicador importeMX = (importeMovimiento * tipoCambio * Multiplicador).RoundSQL IdCtaContable = 0 - CveCuenta = 0 CveSubProyectoContabilizar = CveSubProyectoVenta If GlobalDTBancosCuentas(UsuarioActual.CveUsuario, DrPago("CveCuenta").ToString().ToEntero(), CveEmpresa:=UsuarioActual.CveEmpresa).Rows.Count = 1 Then @@ -12999,15 +12954,11 @@ Partial Class Ventas idCuentaContabilizacion = 0 End If - 'If CveCuenta <= 0 Then - ' CuentasContablesInvalidasSIG.AppendFormat("
    {0}", GlobalDTBancosCuentas(UsuarioActual.CveUsuario, DrPago("CveCuenta").ToString().ToEntero()).Rows(0)("NumCuentaMoneda").ToString().ToEntero()) - ' CveCuentaContabilizacion = 0 - 'End If 'MONEDA EXTRANJERA If ObjFactura.CveMoneda > 1 Then 'BANCOS Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 30, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString()) - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, Fecha, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=importeMovimiento, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, Fecha, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=importeMovimiento, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then ErrorPrepoliza = True Exit For End If @@ -13017,14 +12968,14 @@ Partial Class Ventas Dim ImporteComplementaria As Decimal = ((importeMovimiento * tipoCambio) - importeMovimiento).RoundSQL Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 204, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString()) - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 204, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEPago, ImporteMX:=ImporteComplementaria, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, TipoCambioPago:=tipoCambio, CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 204, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEPago, ImporteMX:=ImporteComplementaria, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, TipoCambioPago:=tipoCambio, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then ErrorPrepoliza = True End If End If 'PAGO CLIENTES Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 2, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString()) - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 2, Concepto, Fecha, IdCtaContableCliente, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=importeMovimiento, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaCliente, CveSubProyecto:=CveSubProyectoContabilizar) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 2, Concepto, Fecha, IdCtaContableCliente, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=importeMovimiento, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then ErrorPrepoliza = True Exit For End If @@ -13034,7 +12985,7 @@ Partial Class Ventas Dim ImporteComplementaria As Decimal = ((importeMovimiento * tipoCambio) - importeMovimiento).RoundSQL Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 207, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString()) - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, 0, Referencia, 207, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEPago, ImporteMX:=ImporteComplementaria, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, TipoCambioPago:=tipoCambio, CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, 0, Referencia, 207, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEPago, ImporteMX:=ImporteComplementaria, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, TipoCambioPago:=tipoCambio, CveSubProyecto:=CveSubProyectoContabilizar, Contabilizable:=SeContabiliza) Then ErrorPrepoliza = True End If End If @@ -13044,14 +12995,14 @@ Partial Class Ventas Else 'BANCOS Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 30, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString()) - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, Fecha, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, Fecha, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then ErrorPrepoliza = True Exit For End If 'PAGO CLIENTES Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 2, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString()) - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 2, Concepto, Fecha, IdCtaContableCliente, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaCliente, CveSubProyecto:=CveSubProyectoContabilizar) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 2, Concepto, Fecha, IdCtaContableCliente, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar) Then ErrorPrepoliza = True Exit For End If @@ -13065,18 +13016,16 @@ Partial Class Ventas 'IVA X TRASLADAR IdCtaIVAXTrasladar = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar) - CveCuentaIVAxTrasladar = If(CveCuentaIVAxTrasladar > 0, CveCuentaIVAxTrasladar, UsuarioActual.Empresa.CveCuentaIVAxTrasladar) Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 13, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString()) - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, (importeMovimiento * ObjFactura.IVA) / ObjFactura.Total, Referencia, 13, Concepto, Fecha, IdCtaIVAXTrasladar, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IVA) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaIVAxTrasladar, CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, (importeMovimiento * ObjFactura.IVA) / ObjFactura.Total, Referencia, 13, Concepto, Fecha, IdCtaIVAXTrasladar, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IVA) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then ErrorPrepoliza = True Exit For End If 'IVA PAGADO IdCtaIVATrasladado = If(IdCtaIVATrasladado > 0, IdCtaIVATrasladado, UsuarioActual.Empresa.IdCuentaIVATrasladado) - CveCuentaIVATrasladado = If(CveCuentaIVATrasladado > 0, CveCuentaIVATrasladado, UsuarioActual.Empresa.CveCuentaIVATrasladado) Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 61, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString()) - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, (importeMovimiento * ObjFactura.IVA) / ObjFactura.Total, Referencia, 61, Concepto, Fecha, IdCtaIVATrasladado, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IVA) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuentaIVATrasladado, CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, (importeMovimiento * ObjFactura.IVA) / ObjFactura.Total, Referencia, 61, Concepto, Fecha, IdCtaIVATrasladado, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IVA) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then ErrorPrepoliza = True Exit For End If @@ -13089,14 +13038,14 @@ Partial Class Ventas 'IEPS X TRASLADAR Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 38, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString()) - If ObjFactura.IEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, (importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total, Referencia, 38, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSxTrasladar, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=UsuarioActual.Empresa.CveCuentaIEPSxTrasladar, CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then + If ObjFactura.IEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, (importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total, Referencia, 38, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSxTrasladar, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then ErrorPrepoliza = True Exit For End If 'IEPS PAGADO Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 39, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString()) - If ObjFactura.IEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, (importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total, Referencia, 39, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSTrasladado, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=UsuarioActual.Empresa.CveCuentaIEPSTrasladado, CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then + If ObjFactura.IEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, (importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total, Referencia, 39, Concepto, Fecha, UsuarioActual.Empresa.IdCuentaIEPSTrasladado, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.IEPS) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then ErrorPrepoliza = True Exit For End If @@ -13157,12 +13106,8 @@ Partial Class Ventas idCuentaContabilizacion = 0 End If - 'If CveCuenta <= 0 Then - ' CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString()) - ' CveCuentaContabilizacion = 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), CveCuenta:=CveCuenta, CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio, PorcentajeImpuesto:=PorcentajeImpuesto, Contabilizable:=SeContabiliza) Then + 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), CveSubProyecto:=CveSubProyectoContabilizar, TipoCambio:=tipoCambio, PorcentajeImpuesto:=PorcentajeImpuesto, Contabilizable:=SeContabiliza) Then ErrorPrepoliza = True Else ViewState("SeGuardoPrePoliza") = True @@ -14262,23 +14207,14 @@ Partial Class Ventas End If End Sub Protected Sub BtnAceptarAnticipos_Click(sender As Object, e As System.EventArgs) Handles BtnAceptarAnticipos.Click - Anticipos() + AplicaAnticipos() End Sub - Private Sub Anticipos() + Private Sub AplicaAnticipos() If CveVenta > 0 And CveCliente > 0 And Not EsCreaApartirDe And CveDevolucion <= 0 Then - 'Dim TotalAnticipo As Decimal = 0 - 'Dim DescuentoTotal As Decimal = LblDescuentos.Text.ToDecimal - 'Dim CveSubProyecto As Integer = -1 - - - 'If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count > 0 Then - ' CveSubProyecto = TmpDT.FiltroPrimeroValor("CveSubProyecto").ToEntero() - 'End If - Dim EsAnticipo2017Jam As Boolean = False For Each gvr As GridViewRow In GVAnticipos.Rows If gvr.FCCheckBox("Chk" & gvr.RowIndex) IsNot Nothing AndAlso gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked Then @@ -14306,7 +14242,6 @@ Partial Class Ventas Dim alertaContabilizacion As String = "Se enviaron correctamente las siguientes pólizas:

    " Dim CveCuentaContabilizacion As Integer = 1 Dim CuentasContablesInvalidas As New StringBuilder - Dim CuentasContablesInvalidasSIG As New StringBuilder Dim ContaIdPoliza As Integer = 0 Dim ConceptoAmortizacion As Integer = 0 Dim UsaComplementariaClientes As Boolean = True @@ -14343,8 +14278,7 @@ Partial Class Ventas Dim PorcentajeImpuestoAmortizacion As Decimal = TmpDT.MAX("PorcentajeIVA").ToDecimal Dim IdCtaIVAXTrasladar As Integer = 0 Dim IdCtaIVATrasladado As Integer = 0 - Dim CveCuentaIVAXTrasladar As Integer = 0 - Dim CveCuentaIVATrasladado As Integer = 0 + Dim CveSubProyectoVenta As Integer = DdlSubProyectoDatos.SelectedValue.ToEntero() @@ -14354,8 +14288,6 @@ Partial Class Ventas Dim Dr As DataRow = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).FiltroPrimero("") IdCtaIVAXTrasladar = Dr("IdCtaIVAXTrasladar").ToString().ToEntero() IdCtaIVATrasladado = Dr("IdCtaIVATrasladado").ToString().ToEntero() - CveCuentaIVAXTrasladar = Dr("CveCuentaIVAXTrasladar").ToString().ToEntero() - CveCuentaIVATrasladado = Dr("CveCuentaIVATrasladado").ToString().ToEntero() End If For Each gvr As GridViewRow In GVAnticipos.Rows @@ -14408,9 +14340,9 @@ Partial Class Ventas Dim importeMovimiento As Decimal = 0 Dim importeMX As Decimal = 0 Dim IdCtaContable As Integer = 0 - Dim CveCuenta As Integer = 0 Dim FechaMovimiento As Date = Now Dim Concepto As String = ViewState("VentaFolio").ToString() + Dim Referencia As String = ViewState("VentaFolio").ToString() Dim FuncionalidadFluctuacionImpuestos As Boolean = If(UsuarioActual.Empresa.Funcionalidad(159) = "1", True, False) Dim TipoCambioGeneral As Decimal = 1 Dim PorcentajeImpuesto As Decimal = 0 @@ -14441,7 +14373,6 @@ Partial Class Ventas 'CveCuenta = CveCuentaClientes Else IdCtaContable = IdCtaContComplementaria - CveCuenta = 0 'If(ObjFactura.Cliente IsNot Nothing AndAlso ObjFactura.Cliente.CveCuentaComplementaria > 0, ObjFactura.Cliente.CveCuentaComplementaria, -1) If importeMovimiento <> 0 AndAlso (IdCtaContable > 0 Or UsaComplementariaClientes) Then 'Conta ContPAQ If IdCtaContable <= 0 Then @@ -14449,28 +14380,23 @@ Partial Class Ventas idCuentaContabilizacion = 0 End If - ''Conta SIG - 'If CveCuenta <= 0 Then - ' CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString()) - ' 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, CveSubProyecto:=CveSubProyectoVenta) 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, TipoCambio:=tipoCambioVentaValuacion, CveSubProyecto:=CveSubProyectoVenta) Then ErrorConta = True End If importeMX = importeMovimiento IdCtaContable = IdCtaContMonedaExtranjera - CveCuenta = 0 End If End If + CveIEAnticipo = gvr.DataKey("CveIE").ToEntero() ConceptoContable = 251 ' cambia para dejar el concepto 2, solamente para pago en banco + End If Case 11 'Anticipo If gvr.DataKey("CveConceptoContable").ToString().ToEntero() = 3 Then - CveIEAnticipo = gvr.DataKey("CveIE").ToString().ToEntero() + CveIEAnticipo = gvr.DataKey("CveIE").ToEntero() importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("TotalAnticipo").ToDecimal) * gvr.DataKey("IVAAnticipo").ToDecimal) 'Mantenemos la integridad de la suma para el pagocliente @@ -14478,7 +14404,6 @@ Partial Class Ventas 'sumaAmorticaciones += row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal TipoCambioGeneral = tipoCambioPago IdCtaContable = IdCtaContAnticipos - CveCuenta = CveCuentaAnticipos If importeMovimiento <> 0 Then @@ -14488,13 +14413,7 @@ Partial Class Ventas idCuentaContabilizacion = 0 End If - ''Conta SIG - 'If CveCuenta <= 0 Then - ' CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString()) - ' 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, CveSubProyecto:=CveSubProyectoVenta) 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), CveSubProyecto:=CveSubProyectoVenta) Then ErrorConta = True End If End If @@ -14505,7 +14424,7 @@ Partial Class Ventas Dim Importe13 = gvr.DataKey("IVA").ToDecimal Dim Importe8 = gvr.DataKey("RetIVA").ToDecimal Dim Importe9 = gvr.DataKey("RetISR").ToDecimal - If Not AgregarPrePolizasXTrasladar(ObjConta, CvePrepoliza, PorcentajePago, tipoCambioPago, CuentasContablesInvalidas, idCuentaContabilizacion, CuentasContablesInvalidasSIG, CveCuentaContabilizacion, Importe13, Importe8, Importe9) Then + If Not AgregarPrePolizasXTrasladar(ObjConta, CvePrepoliza, PorcentajePago, tipoCambioPago, CuentasContablesInvalidas, idCuentaContabilizacion, CveCuentaContabilizacion, Importe13, Importe8, Importe9) Then ErrorConta = True End If End If @@ -14537,7 +14456,6 @@ Partial Class Ventas If ObjConta.GetRetCuenta(ConceptoContable, CveCliente) Then If ObjConta.DtResultados.Rows.Count > 0 Then IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCtaContable").ToString().ToEntero() - 'CveCuenta = ObjConta.DtResultados.Rows(0)("IdCtaContableSIG").ToString().ToEntero() End If End If @@ -14548,15 +14466,9 @@ Partial Class Ventas idCuentaContabilizacion = 0 End If - 'If CveCuenta <= 0 Then - ' CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString()) - ' CveCuentaContabilizacion = 0 - 'End If - Dim ImporteComplementaria As Decimal = 0 If UsaComplementariaClientes = True AndAlso gvr.DataKey("CveMoneda").ToString().ToDecimal > 1 Then IdCtaContable = IdCtaContComplementaria - 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, CveSubProyecto:=CveSubProyectoVenta) Then @@ -14564,15 +14476,13 @@ Partial Class Ventas Exit For End If IdCtaContable = IdCtaContMonedaExtranjera - CveCuenta = 0 End If If CveMonedaVenta > 1 AndAlso IdCtaContMonedaExtranjera > 0 Then IdCtaContable = IdCtaContMonedaExtranjera - 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, CveSubProyecto:=CveSubProyectoVenta) 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, TipoCambio:=TC, CveSubProyecto:=CveSubProyectoVenta) Then ErrorConta = True Exit For End If @@ -14580,8 +14490,8 @@ Partial Class Ventas 'AMORTIZA NC CONTRA ANTICIPO A CLIENTES 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(), CveSubProyecto:=CveSubProyectoVenta) Then + 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) 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, CveSubProyecto:=CveSubProyectoVenta) Then ErrorConta = True Exit For End If @@ -14595,11 +14505,10 @@ Partial Class Ventas Importe91 = importeMovimiento importeMovimiento = 0 Case 92 'Amortizacion Ingreso X Comprobar - If gvr.DataKey("CveIE").ToString().ToEntero() > 0 AndAlso gvr.DataKey("CveConceptoContable").ToString().ToEntero() = 66 Then - CveIEAnticipo = gvr.DataKey("CveIE").ToString().ToEntero() + If gvr.DataKey("CveIE").ToEntero() > 0 AndAlso gvr.DataKey("CveConceptoContable").ToEntero() = 66 Then + CveIEAnticipo = gvr.DataKey("CveIE").ToEntero() importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal IdCtaContable = IdCtaContClientes - CveCuenta = CveCuentaClientes If importeMovimiento <> 0 Then ' Agregamos el 2 @@ -14636,16 +14545,14 @@ Partial Class Ventas 'Agregamos el 13 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, CveSubProyecto:=CveSubProyectoVenta) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, importeMovimiento, Concepto, 13, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuestoAmortizacion, CveSubProyecto:=CveSubProyectoVenta) Then ErrorConta = True End If 'Agregamos el 61 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, CveSubProyecto:=CveSubProyectoVenta) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, Not TipoMovimiento, importeMovimiento, Concepto, 61, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuestoAmortizacion, CveSubProyecto:=CveSubProyectoVenta) Then ErrorConta = True End If End If @@ -14659,16 +14566,14 @@ Partial Class Ventas 'Agregamos el 38 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, CveSubProyecto:=CveSubProyectoVenta) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, importeMovimiento, Concepto, 38, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuestoAmortizacion, CveSubProyecto:=CveSubProyectoVenta) Then ErrorConta = True End If 'Agregamos el 39 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, CveSubProyecto:=CveSubProyectoVenta) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, Not TipoMovimiento, importeMovimiento, Concepto, 61, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMX, TipoCambio:=tipoCambioPago, PorcentajeImpuesto:=PorcentajeImpuestoAmortizacion, CveSubProyecto:=CveSubProyectoVenta) Then ErrorConta = True End If End If @@ -14678,7 +14583,6 @@ Partial Class Ventas importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal 'gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("TotalAnticipo" & gvr.RowIndex).ToDecimal) * gvr.DataKey("IVAAnticipo").ToDecimal) importeMX = Math.Round(importeMovimiento * tipoCambioPago, 2, MidpointRounding.AwayFromZero) IdCtaContable = IdCtaContAnticipos - CveCuenta = CveCuentaAnticipos If ObjCliente.GetClientes(gvr.DataKey("CveCliente").ToEntero(), "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then If ObjCliente.DtResultados.Rows.Count > 0 Then @@ -14713,7 +14617,6 @@ Partial Class Ventas Case 64 'Ganancia If CveMonedaVenta <> 1 OrElse gvr.DataKey("CveMoneda").ToEntero() <> 1 Then IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria - CveCuenta = UsuarioActual.Empresa.CveCuentaGananciaCambiaria If CveMonedaVenta = 1 And gvr.DataKey("CveMoneda").ToString().ToDecimal = 2 Then @@ -14726,7 +14629,7 @@ Partial Class Ventas Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, tipoCambioVentaValuacion, tipoCambioPago) TipoCambioGeneral = TCImpuestos Else - Dim TipoCambioGanancia As Decimal = If(Not (gvr.DataKey("CveIE").ToString().ToEntero() > 0 AndAlso gvr.DataKey("CveConceptoContable").ToString().ToEntero() = 66), tipoCambioVentaValuacion, tipoCambioVenta) + Dim TipoCambioGanancia As Decimal = If(Not (gvr.DataKey("CveIE").ToEntero() > 0 AndAlso gvr.DataKey("CveConceptoContable").ToString().ToEntero() = 66), tipoCambioVentaValuacion, tipoCambioVenta) If tipoCambioPago > TipoCambioGanancia AndAlso gvr.DataKey("CveMoneda").ToEntero() = 2 Then importeMovimiento = (gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * tipoCambioPago) - (gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * TipoCambioGanancia) 'Añadimos la diferencia de ganancia en la venta @@ -14743,7 +14646,6 @@ Partial Class Ventas Case 65 'Perdida If CveMonedaVenta <> 1 OrElse gvr.DataKey("CveMoneda").ToEntero() <> 1 Then IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria - CveCuenta = UsuarioActual.Empresa.CveCuentaPerdidaCambiaria If CveMonedaVenta = 1 And gvr.DataKey("CveMoneda").ToString().ToDecimal = 2 Then If tipoCambioVentaValuacion < tipoCambioPago AndAlso gvr.DataKey("CveMoneda").ToEntero() = 2 Then @@ -14755,7 +14657,7 @@ Partial Class Ventas Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, tipoCambioVentaValuacion, tipoCambioPago) TipoCambioGeneral = TCImpuestos Else - Dim TipoCambioPerdida As Decimal = If(Not (gvr.DataKey("CveIE").ToString().ToEntero() > 0 AndAlso gvr.DataKey("CveConceptoContable").ToString().ToEntero() = 66), tipoCambioVentaValuacion, tipoCambioVenta) + Dim TipoCambioPerdida As Decimal = If(Not (gvr.DataKey("CveIE").ToEntero() > 0 AndAlso gvr.DataKey("CveConceptoContable").ToString().ToEntero() = 66), tipoCambioVentaValuacion, tipoCambioVenta) If tipoCambioPago < TipoCambioPerdida AndAlso gvr.DataKey("CveMoneda").ToEntero() = 2 Then importeMovimiento = (gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * TipoCambioPerdida) - (gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * tipoCambioPago) 'Añadimos la diferencia de perdida en la venta @@ -14772,13 +14674,19 @@ Partial Class Ventas End If Case 13 ' IVA x Trasladar If gvr.DataKey("RegresarImpuesto") = "1" Then - importeMovimiento = gvr.DataKey("IVA").ToString().ToDecimal() + ''gvr.DataKey("DevolucionImportePagado"), de aqui se toma que % de pago tenia la DEV + + CveIEAnticipo = gvr.DataKey("CveIE").ToEntero() + importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * gvr.DataKey("DevolucionImportePagado").ToDecimal + PorcentajeImpuesto = TmpDT.MAX("PorcentajeIVA").ToDecimal '(importeMovimiento / TxtTotal.Text.ToDecimal()) 'falta TC + + importeMovimiento = (TxtIVA.Text.ToDecimal * (importeMovimiento / TxtTotal.Text.ToDecimal())).RoundSQL importeMX = importeMovimiento - PorcentajeImpuesto = (importeMovimiento / gvr.DataKey("SubTotal").ToString().ToDecimal()) - If importeMovimiento <> 0 Then - IdCtaContable = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar) - CveCuenta = If(CveCuentaIVAXTrasladar > 0, CveCuentaIVAXTrasladar, UsuarioActual.Empresa.CveCuentaIVAxTrasladar) - End If + IdCtaContable = IdCtaIVAXTrasladar + Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 13, NombreCliente, VentaFolio, "") + 'If importeMovimiento <> 0 Then + ' IdCtaContable = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar) + 'End If Else importeMovimiento = 0 PorcentajeImpuesto = 0 @@ -14786,13 +14694,14 @@ Partial Class Ventas Case 61 ' IVA Trasladado If gvr.DataKey("RegresarImpuesto") = "1" Then - importeMovimiento = gvr.DataKey("IVA").ToString().ToDecimal() + CveIEAnticipo = gvr.DataKey("CveIE").ToEntero() + importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * gvr.DataKey("DevolucionImportePagado").ToDecimal + PorcentajeImpuesto = TmpDT.MAX("PorcentajeIVA").ToDecimal + + importeMovimiento = (TxtIVA.Text.ToDecimal * (importeMovimiento / TxtTotal.Text.ToDecimal())).RoundSQL importeMX = importeMovimiento - PorcentajeImpuesto = (importeMovimiento / gvr.DataKey("SubTotal").ToString().ToDecimal()) - If importeMovimiento <> 0 Then - IdCtaContable = If(IdCtaIVATrasladado > 0, IdCtaIVATrasladado, UsuarioActual.Empresa.IdCuentaIVATrasladado) - CveCuenta = If(CveCuentaIVATrasladado > 0, CveCuentaIVATrasladado, UsuarioActual.Empresa.CveCuentaIVATrasladado) - End If + IdCtaContable = IdCtaIVATrasladado + Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 61, NombreCliente, VentaFolio, "") Else importeMovimiento = 0 PorcentajeImpuesto = 0 @@ -14800,15 +14709,18 @@ Partial Class Ventas Case 38 ' IEPS x Trasladar If gvr.DataKey("RegresarImpuesto") = "1" Then - importeMovimiento = gvr.DataKey("IEPS").ToString().ToDecimal() + CveIEAnticipo = gvr.DataKey("CveIE").ToEntero() + importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * gvr.DataKey("DevolucionImportePagado").ToDecimal + PorcentajeImpuesto = 0 '(importeMovimiento / TxtTotal.Text.ToDecimal()) 'falta TC + + importeMovimiento = (TxtIEPS.Text.ToDecimal * (importeMovimiento / TxtTotal.Text.ToDecimal())).RoundSQL importeMX = importeMovimiento - PorcentajeImpuesto = (importeMovimiento / gvr.DataKey("SubTotal").ToString().ToDecimal()) If importeMovimiento <> 0 AndAlso ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.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 + Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 38, NombreCliente, VentaFolio, "") Else importeMovimiento = 0 PorcentajeImpuesto = 0 @@ -14816,15 +14728,18 @@ Partial Class Ventas Case 39 ' IEPS Trasladado If gvr.DataKey("RegresarImpuesto") = "1" Then - importeMovimiento = gvr.DataKey("IEPS").ToString().ToDecimal() + CveIEAnticipo = gvr.DataKey("CveIE").ToEntero() + importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal * gvr.DataKey("DevolucionImportePagado").ToDecimal + PorcentajeImpuesto = 0 + + importeMovimiento = (TxtIEPS.Text.ToDecimal * (importeMovimiento / TxtTotal.Text.ToDecimal())).RoundSQL importeMX = importeMovimiento - PorcentajeImpuesto = (importeMovimiento / gvr.DataKey("SubTotal").ToString().ToDecimal()) If importeMovimiento <> 0 AndAlso ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then If ObjConta.DtResultados.Rows.Count > 0 Then IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSTrasladado").ToString().ToEntero() - CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaIEPSTrasladadoSIG").ToString().ToEntero() End If End If + Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 39, NombreCliente, VentaFolio, "") Else importeMovimiento = 0 PorcentajeImpuesto = 0 @@ -14841,13 +14756,8 @@ Partial Class Ventas idCuentaContabilizacion = 0 End If - 'If CveCuenta <= 0 Then - ' CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString()) - ' 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, + If Not ObjConta.AddPrePolizasDetalle(CvePrepoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, + CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=importeMX, TipoCambio:=TipoCambioGeneral, CveIE:=CveIEAnticipo, PorcentajeImpuesto:=PorcentajeImpuesto, CveSubProyecto:=CveSubProyectoVenta) Then ErrorConta = True Exit For @@ -15055,16 +14965,15 @@ Partial Class Ventas End Sub - Private Function AgregarPrePolizasXTrasladar(ObjConta As ClsContabilidad, CvePrePoliza As Integer, PorcentajeAmortizacion As Decimal, TipoCambio As Decimal, ByRef CuentasContablesInvalidas As StringBuilder, ByRef idCuentaContabilizacion As Integer, ByRef CuentasContablesInvalidasSIG As StringBuilder, ByRef CveCuentaContabilizacion As Integer, Importe13 As Decimal, Importe8 As Decimal, Importe9 As Decimal) As Boolean + Private Function AgregarPrePolizasXTrasladar(ObjConta As ClsContabilidad, CvePrePoliza As Integer, PorcentajeAmortizacion As Decimal, TipoCambio As Decimal, ByRef CuentasContablesInvalidas As StringBuilder, ByRef idCuentaContabilizacion As Integer, ByRef CveCuentaContabilizacion As Integer, Importe13 As Decimal, Importe8 As Decimal, Importe9 As Decimal) As Boolean Dim ImporteMovimiento As Decimal Dim ImporteMX As Decimal - Dim IdCtaContable, CveCuenta As Integer + Dim IdCtaContable As Integer Dim FechaMovimiento As Date = Now Dim Concepto As String = ViewState("VentaFolio").ToString() Dim PrePolizaCorrecta = True Dim PorcentajeImpuesto As Decimal = 0 Dim IdCtaIVAXTrasladar As Integer = 0 - Dim CveCuentaIVAxTrasladar As Integer = 0 '13 Iva x Trasladar ImporteMovimiento = Importe13 * PorcentajeAmortizacion @@ -15072,7 +14981,6 @@ Partial Class Ventas PorcentajeImpuesto = TmpDT.MAX("PorcentajeIVA").ToDecimal If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows.Count > 0 Then IdCtaIVAXTrasladar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAXTrasladar").ToString().ToEntero() - CveCuentaIVAxTrasladar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("CveCuentaIVAXTrasladar").ToString().ToEntero() End If IdCtaContable = If(IdCtaIVAXTrasladar > 0, IdCtaIVAXTrasladar, UsuarioActual.Empresa.IdCuentaIVAxTrasladar) ' CveCuenta = If(CveCuentaIVAxTrasladar > 0, CveCuentaIVAxTrasladar, UsuarioActual.Empresa.CveCuentaIVAxTrasladar) @@ -15083,12 +14991,8 @@ Partial Class Ventas idCuentaContabilizacion = 0 End If - 'If CveCuenta <= 0 Then - ' CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 13))("ConceptoContable").ToString()) - ' CveCuentaContabilizacion = 0 - 'End If - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, Concepto, 13, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=ImporteMX, CveCuenta:=CveCuenta, PorcentajeImpuesto:=PorcentajeImpuesto) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, Concepto, 13, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=ImporteMX, PorcentajeImpuesto:=PorcentajeImpuesto) Then PrePolizaCorrecta = False End If End If @@ -15099,12 +15003,10 @@ Partial Class Ventas If IdCtaContRetIVA <> 0 Then IdCtaContable = IdCtaContRetIVA - CveCuenta = CveCuentaRetIVA Else If ObjConta.GetRetCuenta(8, UsuarioActual.CveEmpresa) Then If ObjConta.DtResultados.Rows.Count > 0 Then IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString().ToEntero() - 'CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacionSIG").ToString().ToEntero() End If End If End If @@ -15115,12 +15017,7 @@ Partial Class Ventas idCuentaContabilizacion = 0 End If - 'If CveCuenta <= 0 Then - ' CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 8))("ConceptoContable").ToString()) - ' CveCuentaContabilizacion = 0 - 'End If - - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, Concepto, 8, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=ImporteMX, CveCuenta:=CveCuenta) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, Concepto, 8, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=ImporteMX) Then PrePolizaCorrecta = False End If End If @@ -15140,16 +15037,6 @@ Partial Class Ventas End If End If - 'ContaSIG - 'If CveCuentaRetISR <> 0 Then - ' CveCuenta = CveCuentaRetISR - 'Else - ' If ObjConta.GetRetCuenta(9, UsuarioActual.CveEmpresa) Then - ' If ObjConta.DtResultados.Rows.Count > 0 Then - ' CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString().ToEntero() - ' End If - ' End If - 'End If If ImporteMovimiento > 0 Then If IdCtaContable <= 0 Then @@ -15157,12 +15044,7 @@ Partial Class Ventas idCuentaContabilizacion = 0 End If - 'If IdCtaContable <= 0 Then - ' CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 9))("ConceptoContable").ToString()) - ' CveCuentaContabilizacion = 0 - 'End If - - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, Concepto, 9, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=ImporteMX, CveCuenta:=CveCuenta) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, Concepto, 9, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=ImporteMX) Then PrePolizaCorrecta = False End If End If @@ -15175,7 +15057,7 @@ Partial Class Ventas Dim ImporteMovimiento As Decimal Dim ImporteMX As Decimal - Dim IdCtaContable, CveCuenta As Integer + Dim IdCtaContable As Integer Dim FechaMovimiento As Date = Now Dim Concepto As String = ViewState("VentaFolio").ToString() Dim PrePolizaCorrecta = True @@ -15201,13 +15083,7 @@ Partial Class Ventas idCuentaContabilizacion = 0 End If - ''ContaSIG - 'If CveCuenta <= 0 Then - ' CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 61))("ConceptoContable").ToString()) - ' CveCuentaContabilizacion = 0 - 'End If - - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, Concepto, 61, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=ImporteMX, CveCuenta:=CveCuenta, PorcentajeImpuesto:=PorcentajeImpuesto) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, Concepto, 61, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=ImporteMX, PorcentajeImpuesto:=PorcentajeImpuesto) Then PrePolizaCorrecta = False End If End If @@ -15225,27 +15101,13 @@ Partial Class Ventas End If End If - ''Conta SIG - 'If CveCuentaRetIVA <> 0 Then - ' CveCuenta = CveCuentaRetIVA - 'Else - ' If ObjConta.GetRetCuenta(62, UsuarioActual.CveEmpresa) Then - ' CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacionSIG").ToString().ToEntero() - ' End If - 'End If - If ImporteMovimiento > 0 Then If IdCtaContable <= 0 Then CuentasContablesInvalidas.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 62))("ConceptoContable").ToString()) idCuentaContabilizacion = 0 End If - 'If CveCuenta <= 0 Then - ' CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 62))("ConceptoContable").ToString()) - ' CveCuentaContabilizacion = 0 - 'End If - - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, Concepto, 62, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=ImporteMX, CveCuenta:=CveCuenta) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, Concepto, 62, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=ImporteMX) Then PrePolizaCorrecta = False End If End If @@ -15265,15 +15127,6 @@ Partial Class Ventas End If End If - 'If CveCuentaRetISR <> 0 Then - ' CveCuenta = CveCuentaRetISR - 'Else - ' If ObjConta.GetRetCuenta(63, UsuarioActual.CveEmpresa) Then - ' If ObjConta.DtResultados.Rows.Count > 0 Then - ' CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacionSIG").ToString().ToEntero() - ' End If - ' End If - 'End If If ImporteMovimiento > 0 Then If IdCtaContable <= 0 Then @@ -15281,12 +15134,7 @@ Partial Class Ventas idCuentaContabilizacion = 0 End If - 'If CveCuenta <= 0 Then - ' CuentasContablesInvalidasSIG.Append("
    " & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 63))("ConceptoContable").ToString()) - ' CveCuentaContabilizacion = 0 - 'End If - - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, Concepto, 63, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=ImporteMX, CveCuenta:=CveCuenta) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, Concepto, 63, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=ImporteMX) Then PrePolizaCorrecta = False End If End If @@ -16862,11 +16710,11 @@ Partial Class Ventas Dim dr As DataRow = Nothing If DtPromociones IsNot Nothing AndAlso DtPromociones.Rows.Count > 0 Then - dr = DtPromociones.FiltroPrimero(String.Format("CvePS = {0} AND (CveSubProyecto = {1} OR CveSubProyecto IS NULL) AND (CveRinTamaño = {2} OR CveRinTamaño IS NULL) AND (TipoPromocion <> 3 OR (TipoPromocion = 3 AND CantidadMinima <= {3} ))", CvePS, DdlSubProyectoDatos.SelectedValue, CveRinTamañoPS, TxtCantidad.Text), Orderby:="CantidadMinima desc ") + dr = DtPromociones.FiltroPrimero(String.Format("CvePS = {0} AND (CveSubProyecto = {1} OR CveSubProyecto IS NULL) AND (CveRinTamaño = {2} OR CveRinTamaño IS NULL) AND ((TipoPromocion <> 3 AND (CantidadMinima <= {3} OR CantidadMinima IS NULL)) OR (TipoPromocion = 3 AND CantidadMinima <= {3} ))", CvePS, DdlSubProyectoDatos.SelectedValue, CveRinTamañoPS, TxtCantidad.Text), Orderby:="CantidadMinima desc ") If dr Is Nothing Then 'verifica marca, si tiene asignada la promocion - 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") + 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 AND (CantidadMinima <= {4} OR CantidadMinima IS NULL)) OR (TipoPromocion = 3 AND CantidadMinima <= {4} )) ", CveClasifPS, CveMarcaPS, DdlSubProyectoDatos.SelectedValue, CveRinTamañoPS, TxtCantidad.Text), Orderby:="CantidadMinima desc") End If End If @@ -20609,10 +20457,12 @@ Partial Class Ventas TxtTipoCambio.Text = "1" TxtTipoCambioDlls.Text = GlobalTipoCambio(TxtFecha.Text.ToDate).ToString() TrConversionDolares.Visible = True + ChkConvertirDolares.Enabled = Not UsuarioActual.TienePermisoProceso(324) Case "2" TxtTipoCambioDlls.Text = "1" TxtTipoCambio.Text = GlobalTipoCambio(TxtFecha.Text.ToDate).ToString() TrConversionTipoCambio.Visible = True + ChkConvertirDoctoPesos.Enabled = Not UsuarioActual.TienePermisoProceso(324) Case Else TxtTipoCambio.Text = GlobalTipoCambio(TxtFecha.Text.ToDate).ToString() TrConversionTipoCambio.Visible = True @@ -24487,7 +24337,6 @@ Partial Class Ventas Dim IdCtaContable As Integer = IdCtaContClientes - Dim CveCuenta As Integer = 0 Dim PorcentajePago As Decimal = SaldoVenta / TxtTotal.Text.ToDecimal Dim Saldo As Decimal = SaldoVenta Dim SubTotal As Decimal = PorcentajePago * TxtSubTotal.Text.ToDecimal @@ -24546,16 +24395,16 @@ Partial Class Ventas If UsaComplementaria AndAlso tCveMoneda = 2 Then 'normal - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, Saldo, SerieFolio, CveConceptoCliente, ConceptoPartida, FechaPago, IdCtaContable:=IdCtaContable, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=CveCliente, CveVenta:=CveVenta, ImporteMX:=If(tCveMoneda = 1, Saldo, Saldo), CveCuenta:=CveCuenta, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, Saldo, SerieFolio, CveConceptoCliente, ConceptoPartida, FechaPago, IdCtaContable:=IdCtaContable, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=CveCliente, CveVenta:=CveVenta, ImporteMX:=If(tCveMoneda = 1, Saldo, Saldo), TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then MsgError = "Ocurrio un error al saldar el movimiento" End If 'complementaria - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, 0, SerieFolio, 207, ConceptoPartida, FechaPago, IdCtaContable:=IdCtaContComplementaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=CveCliente, CveVenta:=CveVenta, ImporteMX:=If(tCveMoneda = 1, Saldo, (Saldo * TCVenta) - Saldo), ImporteME:=Saldo, CveCuenta:=CveCuenta, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, 0, SerieFolio, 207, ConceptoPartida, FechaPago, IdCtaContable:=IdCtaContComplementaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=CveCliente, CveVenta:=CveVenta, ImporteMX:=If(tCveMoneda = 1, Saldo, (Saldo * TCVenta) - Saldo), ImporteME:=Saldo, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then MsgError = "Ocurrio un error al saldar el movimiento" End If Else - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, Saldo, SerieFolio, CveConceptoCliente, ConceptoPartida, FechaPago, IdCtaContable:=IdCtaContable, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=CveCliente, CveVenta:=CveVenta, ImporteMX:=If(tCveMoneda = 1, Saldo, Saldo * TCVenta), CveCuenta:=CveCuenta, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ClienteMovto, Saldo, SerieFolio, CveConceptoCliente, ConceptoPartida, FechaPago, IdCtaContable:=IdCtaContable, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=CveCliente, CveVenta:=CveVenta, ImporteMX:=If(tCveMoneda = 1, Saldo, Saldo * TCVenta), TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then MsgError = "Ocurrio un error al saldar el movimiento" End If @@ -24566,11 +24415,11 @@ Partial Class Ventas Dim ImporteFluctuacion As Decimal = 0 ImporteFluctuacion = Saldo * (TCPago - TCVenta) If TCPago > TCVenta Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Math.Abs(ImporteFluctuacion), SerieFolio, 64, ConceptoPartida, FechaPago, IdCtaContable:=UsuarioActual.Empresa.IdCuentaGananciaCambiaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=CveCliente, CveVenta:=CveVenta, ImporteMX:=Math.Abs(ImporteFluctuacion), CveCuenta:=CveCuenta, TipoCambio:=TCVenta, TipoCambioPago:=TCPago, CveSubProyecto:=CveSubProyecto) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Math.Abs(ImporteFluctuacion), SerieFolio, 64, ConceptoPartida, FechaPago, IdCtaContable:=UsuarioActual.Empresa.IdCuentaGananciaCambiaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=CveCliente, CveVenta:=CveVenta, ImporteMX:=Math.Abs(ImporteFluctuacion), TipoCambio:=TCVenta, TipoCambioPago:=TCPago, CveSubProyecto:=CveSubProyecto) Then MsgError = "Ocurrio un error al saldar el movimiento" End If Else - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Math.Abs(ImporteFluctuacion), SerieFolio, 65, ConceptoPartida, FechaPago, IdCtaContable:=UsuarioActual.Empresa.IdCuentaPerdidaCambiaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=CveCliente, CveVenta:=CveVenta, ImporteMX:=Math.Abs(ImporteFluctuacion), CveCuenta:=CveCuenta, TipoCambio:=TCVenta, TipoCambioPago:=TCPago, CveSubProyecto:=CveSubProyecto) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Math.Abs(ImporteFluctuacion), SerieFolio, 65, ConceptoPartida, FechaPago, IdCtaContable:=UsuarioActual.Empresa.IdCuentaPerdidaCambiaria, CveIE:=-1, IdSegmentoNegocio:=-1, CveCliente:=CveCliente, CveVenta:=CveVenta, ImporteMX:=Math.Abs(ImporteFluctuacion), TipoCambio:=TCVenta, TipoCambioPago:=TCPago, CveSubProyecto:=CveSubProyecto) Then MsgError = "Ocurrio un error al saldar el movimiento" End If End If @@ -24584,23 +24433,18 @@ Partial Class Ventas ' iva Dim PorcentajeImpuesto As Decimal = DdlIVA.SelectedValue.ToEntero() - Dim IdCtaIVATrasladado As Integer = 0 - Dim CveCuentaIVATrasladado As Integer = 0 + Dim IdCtaIVAXTrasladar As Integer = 0 If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows.Count > 0 Then - IdCtaIVATrasladado = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVATrasladado").ToString().ToEntero() - CveCuentaIVATrasladado = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("CveCuentaIVATrasladado").ToString().ToEntero() + IdCtaIVAXTrasladar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAXTrasladar").ToString().ToEntero() End If - IdCtaContable = If(IdCtaIVATrasladado > 0, IdCtaIVATrasladado, UsuarioActual.Empresa.IdCuentaIVATrasladado) - CveCuenta = If(CveCuentaIVATrasladado > 0, CveCuentaIVATrasladado, UsuarioActual.Empresa.CveCuentaIVATrasladado) - If IVA > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ImpuestosMovto, IVA, SerieFolio, 61, ConceptoPartida, FechaPago, IdCtaContable, -1, CveCliente:=CveCliente, CveVenta:=CveVenta, ImporteMX:=If(tCveMoneda = 1, IVA, IVA * TCVenta), CveCuenta:=CveCuenta, PorcentajeImpuesto:=PorcentajeImpuesto, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then + If IVA > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ImpuestosMovto, IVA, SerieFolio, 13, ConceptoPartida, FechaPago, IdCtaIVAXTrasladar, -1, CveCliente:=CveCliente, CveVenta:=CveVenta, ImporteMX:=If(tCveMoneda = 1, IVA, IVA * TCVenta), PorcentajeImpuesto:=PorcentajeImpuesto, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then MsgError = "Ocurrio un error al saldar el movimiento" End If - IdCtaContable = UsuarioActual.Empresa.IdCuentaIEPSTrasladado - CveCuenta = UsuarioActual.Empresa.CveCuentaIEPSTrasladado - If IEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ImpuestosMovto, IEPS, SerieFolio, 39, ConceptoPartida, FechaPago, IdCtaContable, -1, CveCliente:=CveCliente, CveVenta:=CveVenta, ImporteMX:=If(tCveMoneda = 1, IEPS, IEPS * TCVenta), CveCuenta:=CveCuenta, PorcentajeImpuesto:=PorcentajeImpuesto, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then + IdCtaContable = UsuarioActual.Empresa.IdCuentaIEPSxTrasladar + If IEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, ImpuestosMovto, IEPS, SerieFolio, 38, ConceptoPartida, FechaPago, IdCtaContable, -1, CveCliente:=CveCliente, CveVenta:=CveVenta, ImporteMX:=If(tCveMoneda = 1, IEPS, IEPS * TCVenta), PorcentajeImpuesto:=PorcentajeImpuesto, TipoCambio:=TCVenta, TipoCambioPago:=TCPago) Then MsgError = "Ocurrio un error al saldar el movimiento" End If @@ -27761,7 +27605,7 @@ Partial Class Ventas If DdlMoneda.SelectedValue = "2" Then TrConversionTipoCambio.Visible = True End If - ChkConvertirDoctoPesos.Enabled = True + ChkConvertirDoctoPesos.Enabled = Not UsuarioActual.TienePermisoProceso(324) TxtTipoCambio.Enabled = True TxtTotal.ReadOnly = False TxtTotal.Attributes("readonly") = "readonly" @@ -28951,11 +28795,11 @@ Partial Class Ventas If DdlMoneda.SelectedValue.ToEntero() = 1 Then TrConversionDolares.Visible = True - ChkConvertirDolares.Enabled = True + ChkConvertirDolares.Enabled = Not UsuarioActual.TienePermisoProceso(324) TxtTipoCambioDlls.Enabled = True Else TrConversionTipoCambio.Visible = True - ChkConvertirDoctoPesos.Enabled = True + ChkConvertirDoctoPesos.Enabled = Not UsuarioActual.TienePermisoProceso(324) TxtTipoCambio.Enabled = True End If @@ -29460,7 +29304,7 @@ Partial Class Ventas 'Sección Detalle DdlMoneda.Enabled = True - ChkConvertirDoctoPesos.Enabled = True + ChkConvertirDoctoPesos.Enabled = Not UsuarioActual.TienePermisoProceso(324) TxtTipoCambio.Enabled = True TxtFechaEjecucion.ReadOnly = False TxtFechaEjecucion.Text = Now.ToShortDateString @@ -31810,15 +31654,29 @@ Partial Class Ventas DivImporteSolicitud.Visible = DdlTipoAutorizacion.SelectedValue.ToEntero() = 1 UpModalSolicitud.Update() End Sub + 'Protected Sub DdlTipoDocto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoDocto.SelectedIndexChanged + ' Dim TipoDocto As String = DdlTipoDocto.SelectedValue.ToString() + ' Select Case TipoDocto + ' Case "Ing" + ' DivAutorizacion.Visible = True + ' DivImporteSolicitud.Visible = True + ' Case "Egs" + ' DivAutorizacion.Visible = False + ' DivImporteSolicitud.Visible = False + ' End Select + ' UpModalSolicitud.Update() + 'End Sub + Protected Sub DdlTipoDocto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoDocto.SelectedIndexChanged Dim TipoDocto As String = DdlTipoDocto.SelectedValue.ToString() Select Case TipoDocto Case "Ing" - DivAutorizacion.Visible = True - DivImporteSolicitud.Visible = True + If DdlTipoAutorizacion.Items.FindByValue("2") Is Nothing Then + DdlTipoAutorizacion.Items.Insert(0, New ListItem("Vencimiento", "2")) + End If Case "Egs" - DivAutorizacion.Visible = False - DivImporteSolicitud.Visible = False + 'QUITAR LA DE VENCIMIENTO + DdlTipoAutorizacion.Items.Remove(DdlTipoAutorizacion.Items.FindByValue("2")) End Select UpModalSolicitud.Update() End Sub diff --git a/vwd.webinfo b/vwd.webinfo index 9a8ca7cdf..a4b7678ae 100644 --- a/vwd.webinfo +++ b/vwd.webinfo @@ -254,6 +254,18 @@ + + + + + + + + + + + +