diff --git a/App_Code/CalendarEvent.vb b/App_Code/CalendarEvent.vb index 58abbdf3b..b9d3ff484 100644 --- a/App_Code/CalendarEvent.vb +++ b/App_Code/CalendarEvent.vb @@ -23,5 +23,7 @@ Public Class CalendarEvent Public Property CveTipoEvento As Integer Public Property Importe As Double Public Property EmpresaCRM As String + Public Property SubProyecto As String + Public Property CveSubProyecto As Integer End Class diff --git a/App_Code/ClsMovimientos.vb b/App_Code/ClsMovimientos.vb index 7553f2d76..4b90021f3 100644 --- a/App_Code/ClsMovimientos.vb +++ b/App_Code/ClsMovimientos.vb @@ -613,7 +613,7 @@ Public Class ClsMovimientos 'CveAplicaNC Public Function GetCxPProveedor(CveProveedor As Integer, FechaI As String, FechaF As String, CveUsuarioProgramo As Integer, CveUsuarioRegistro As Integer, CveUsuarioResponsable As Integer, CveClasificacionProveedor As Integer, CveMoneda As Integer, CveEstatus As Integer, CveProveedorSucursal As Integer, CveAplicaNC As Integer, - Optional FechaVI As String = "-1", Optional FechaVF As String = "-1", Optional CodigoProgramacion As String = "-1") As Boolean + Optional FechaVI As String = "-1", Optional FechaVF As String = "-1", Optional CodigoProgramacion As String = "-1", Optional CveSubProyecto As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Comp_ProveedorCxP") With SqlAdapter.SelectCommand.Parameters @@ -631,6 +631,7 @@ Public Class ClsMovimientos .Add("@FechaVI", SqlDbType.VarChar).Value = FechaVI .Add("@FechaVF", SqlDbType.VarChar).Value = FechaVF .Add("@CodigoProgramacion", SqlDbType.VarChar).Value = CodigoProgramacion + .Add("@CveSubProyecto", SqlDbType.SmallInt).Value = CveSubProyecto End With diff --git a/App_Code/ClsNominas.vb b/App_Code/ClsNominas.vb index a2d3ffa62..22921dad9 100644 --- a/App_Code/ClsNominas.vb +++ b/App_Code/ClsNominas.vb @@ -3218,8 +3218,7 @@ Public Class ClsNominas End Function - Public Function SATSolicitudTimbreIngresosRep(CveEmpresa As Integer, FechaInicio As Date, FechaFin As DateTime, Opcion As Integer) As Boolean - + Public Function SATSolicitudTimbreIngresosRep(CveEmpresa As Integer, FechaInicio As Date, FechaFin As DateTime, Opcion As Integer, Vista As Integer) As Boolean Dim retorno As Boolean = False Try @@ -3229,6 +3228,7 @@ Public Class ClsNominas .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio .Add("@FechaFin", SqlDbType.DateTime).Value = FechaFin .Add("@Opcion", SqlDbType.Int).Value = Opcion + .Add("@Vista", SqlDbType.Int).Value = Vista End With SqlAdapter.Fill(Data) diff --git a/App_Code/ClsOIEventos.vb b/App_Code/ClsOIEventos.vb index 41770f405..05ec2309d 100644 --- a/App_Code/ClsOIEventos.vb +++ b/App_Code/ClsOIEventos.vb @@ -1853,7 +1853,7 @@ Public Class ClsOIEventos Return Retorno End Function - Public Function FinalizaEvento(FechaFin As DateTime, CveEventoEstatus As Integer, Geom As String, CveEvento As Integer) As Boolean + Public Function FinalizaEvento(FechaFin As DateTime, CveEventoEstatus As Integer, Geom As String, CveEvento As Integer, Optional CveOS As Integer = -1, Optional CveUsuario As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_OI_EventoFinalizar") @@ -1863,6 +1863,8 @@ Public Class ClsOIEventos .Add("@Geom", SqlDbType.VarChar).Value = Geom .Add("@FechaFin", SqlDbType.DateTime).Value = FechaFin .Add("@CveEvento", SqlDbType.Int).Value = CveEvento + .Add("@CveOS", SqlDbType.Int).Value = CveOS + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario End With Try @@ -2432,12 +2434,13 @@ Public Class ClsOIEventos Optional CveOS As Integer = -1, Optional CveOC As Integer = -1, Optional CvePersonal As Integer = -1, Optional CveProveedor As Integer = -1, Optional CveEventoPadre As Integer = -1, Optional RecurrenciaTipo As Integer = -1, Optional Frecuencia As Integer = -1, Optional DiasSemana As String = "-1", Optional Dia As Integer = -1, Optional Mes As Integer = -1, Optional RecurrenciaFin As String = "-1", Optional CveTipoEvento As Integer = 2, Optional Importe As Double = -1, - Optional CveEmpresaCRM As Integer = -1, Optional CveContactoCRM As Integer = -1, Optional CveAcercamientoCRM As Integer = -1, Optional CveTipoProcesoCRM As Integer = -1, Optional CveEtapaProcesoCRM As Integer = -1) As Boolean + Optional CveEmpresaCRM As Integer = -1, Optional CveContactoCRM As Integer = -1, Optional CveAcercamientoCRM As Integer = -1, Optional CveTipoProcesoCRM As Integer = -1, Optional CveEtapaProcesoCRM As Integer = -1, + Optional CveSubProyecto As Integer = -1) As Boolean Dim Retorno As Boolean = False Retorno = AddEvento(CveTipoEvento, CveAgendaTipo, Asunto, Descripcion, Prioridad, -1, CveUsuarioIng, FechaInicio, FechaFin, -1, -1, "-1", CveUsuarioIng, CveEmpresa, CveActivoFijo, CveIE, CveProspecto, CveCliente, CveOS, CveOC, CvePersonal, CvePersonal, CveEventoPadre:=CveEventoPadre, RecurrenciaTipo:=RecurrenciaTipo, Frecuencia:=Frecuencia, DiasSemana:=DiasSemana, Dia:=Dia, Mes:=Mes, RecurrenciaFin:=RecurrenciaFin, Importe:=Importe, - CveEmpresaCRM:=CveEmpresaCRM, CveContactoCRM:=CveContactoCRM, CveAcercamientoCRM:=CveAcercamientoCRM, CveTipoProcesoCRM:=CveTipoProcesoCRM, CveEtapaProcesoCRM:=CveEtapaProcesoCRM) + CveEmpresaCRM:=CveEmpresaCRM, CveContactoCRM:=CveContactoCRM, CveAcercamientoCRM:=CveAcercamientoCRM, CveTipoProcesoCRM:=CveTipoProcesoCRM, CveEtapaProcesoCRM:=CveEtapaProcesoCRM, CveSubProyecto:=CveSubProyecto) Return Retorno End Function diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index e3d5653d6..c0d1df576 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -5195,6 +5195,7 @@ Public Class ClsPaginas PaginaDict.Add("/OS/PopUpOS_PS_Especificaciones.aspx".ToUpper(), 135) PaginaDict.Add("/OS/PopUpMateriales.aspx".ToUpper(), 135) PaginaDict.Add("/OS/Asignaciones.aspx".ToUpper(), 125) + PaginaDict.Add("/OS/RepServicioDomicilio.aspx".ToUpper(), 1330) #End Region 'OC #Region "OC" @@ -5606,7 +5607,7 @@ Public Class ClsPaginas PaginaDict.Add("/Contabilidad/OCDetalleAlmacen.aspx".ToUpper(), -1) PaginaDict.Add("/Agropecuaria/CierreCultivo.aspx".ToUpper(), 1326) - + PaginaDict.Add("/Inventarios/RepRSCO.aspx".ToUpper(), 1328) @@ -5643,6 +5644,9 @@ Public Class ClsPaginas + + + 'ECOMMERCE PaginaDict.Add("/Ecommerce/Insignias.aspx".ToUpper(), 7002) @@ -7041,6 +7045,54 @@ Public Class ClsPaginas Vta.SelloCFDi = "Sin Timbrar" Vta.SelloSAT = "Sin Timbrar" + +#Region "COMERCIO EXTERIOR VARIABLES Y TABLAS" + + Dim CETipoOperacion = "", CEClavePedimento As String = "", CEIncoterm As String = "", CEId As String = "", CEMotivoTraslado As String = "", CETipoCambio As String = "" + Dim RCETipoOperacion As String = "", RCEClavePedimento As String = "", RCEIncoterm As String = "", RCEMotivoTraslado As String = "" + + + Dim CE_DT_Cabecera As New DataTable + + + CE_DT_Cabecera.Columns.Add("Version") + CE_DT_Cabecera.Columns.Add("MotivoTraslado") + CE_DT_Cabecera.Columns.Add("TipoOperacion") + CE_DT_Cabecera.Columns.Add("ClaveDePedimento") + CE_DT_Cabecera.Columns.Add("CertificadoOrigen") + CE_DT_Cabecera.Columns.Add("Incoterm") + CE_DT_Cabecera.Columns.Add("Subdivision") + CE_DT_Cabecera.Columns.Add("TipoCambioUSD", GetType(Decimal)) + CE_DT_Cabecera.Columns.Add("TotalUSD", GetType(Decimal)) + + + Dim CE_DT_Emisor As New DataTable + CE_DT_Emisor.Columns.Add("Calle") + CE_DT_Emisor.Columns.Add("NumeroExterior") + CE_DT_Emisor.Columns.Add("Colonia") + CE_DT_Emisor.Columns.Add("Municipio") + CE_DT_Emisor.Columns.Add("Estado") + CE_DT_Emisor.Columns.Add("Pais") + CE_DT_Emisor.Columns.Add("CodigoPostal") + CE_DT_Emisor.Columns.Add("Tipo", GetType(Integer)) + + Dim CE_DT_Receptor As New DataTable + Dim CE_DT_Destinatario As New DataTable + + CE_DT_Receptor = CE_DT_Emisor.Copy + CE_DT_Destinatario = CE_DT_Emisor.Copy + + + Dim CE_DT_Mercancias As New DataTable + CE_DT_Mercancias.Columns.Add("NoIdentificacion") + CE_DT_Mercancias.Columns.Add("FraccionArancelaria") + CE_DT_Mercancias.Columns.Add("CantidadAduana") + CE_DT_Mercancias.Columns.Add("UnidadAduana") + CE_DT_Mercancias.Columns.Add("ValorUnitarioAduana", GetType(Decimal)) + CE_DT_Mercancias.Columns.Add("ValorDolares", GetType(Decimal)) +#End Region + + 'SI ESTA TIMBRADA - CON XML If File.Exists(PathXML) AndAlso Vta.Serie <> "VistaPrevia" Then 'Cuando es vista previe y coincide la serie y folio se ponen los datos fiscales Dim XmlDoc As New System.Xml.XmlDocument @@ -7077,6 +7129,130 @@ Public Class ClsPaginas Vta.SelloCFDi = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("SelloCFD").InnerText Vta.SelloSAT = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("SelloSAT").InnerText End If + + +#Region "COMERCIO EXTERIOR LECTURA DATOS XML" + If XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Name = "cce11:ComercioExterior" Then + + Dim nRowCECabecera As DataRow = CE_DT_Cabecera.NewRow + + CETipoOperacion = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("TipoOperacion").InnerText + CEClavePedimento = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("ClaveDePedimento").InnerText + CEIncoterm = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("Incoterm").InnerText + + + nRowCECabecera("Version") = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("Version").InnerText + nRowCECabecera("MotivoTraslado") = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("MotivoTraslado").InnerText + nRowCECabecera("TipoOperacion") = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("TipoOperacion").InnerText + nRowCECabecera("ClaveDePedimento") = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("ClaveDePedimento").InnerText + nRowCECabecera("CertificadoOrigen") = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("CertificadoOrigen").InnerText + nRowCECabecera("Incoterm") = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("Incoterm").InnerText + nRowCECabecera("Subdivision") = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("Subdivision").InnerText + nRowCECabecera("TipoCambioUSD") = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("TipoCambioUSD").InnerText.ToDecimal + nRowCECabecera("TotalUSD") = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("TotalUSD").InnerText.ToDecimal + + CE_DT_Cabecera.Rows.Add(nRowCECabecera) + + Dim nodo As XmlNode = XmlDoc.DocumentElement + Dim VersionCFDI As String = ValorXML(nodo, "version") + + Dim cfdVer As String = "" + If VersionCFDI = "3.2" Then + cfdVer = "http://www.sat.gob.mx/cfd/2" + ElseIf VersionCFDI = "3.3" Then + cfdVer = "http://www.sat.gob.mx/cfd/3" + Else ' se considera que es la version 4.0 + cfdVer = "http://www.sat.gob.mx/cfd/4" + End If + + Dim namespaces As XmlNamespaceManager = New XmlNamespaceManager(XmlDoc.NameTable) + + namespaces.AddNamespace("cfdi", cfdVer) + namespaces.AddNamespace("cce11", "http://www.sat.gob.mx/ComercioExterior11") + + CEId = "" + Try + CEId = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).SelectSingleNode("//cce11:Destinatario", namespaces).Attributes("NumRegIdTrib").InnerText 'XmlDoc.SelectNodes("//cfdi:Complemento/tfd:TimbreFiscalDigital/cce11:Destinatario") + Catch ex As Exception + + End Try + + + CEMotivoTraslado = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("MotivoTraslado").InnerText + CETipoCambio = XmlDoc.DocumentElement("cfdi:Complemento").ChildNodes(i).Attributes("TipoCambioUSD").InnerText + + + RCETipoOperacion = GlobalDTTipoOperacion.FiltroPrimeroValor("Descripcion", $"ClaveSATTipoOperacion = '{CETipoOperacion}'") + RCEClavePedimento = GlobalDTClavePedimento.FiltroPrimeroValor("Descripcion", $"ClaveSATPedimento = '{CEClavePedimento}'") + RCEIncoterm = GlobalDTIncoterm.FiltroPrimeroValor("Descripcion", $"ClaveSATIncoterm = '{CEIncoterm}'") + RCEMotivoTraslado = GlobalDTSATMotivoTraslado.FiltroPrimeroValor("MotivoTraslado", $"ClaveSATMotivoTraslado = '{CEMotivoTraslado}'") + + + Dim CENodosEmisor As XmlNodeList = XmlDoc.DocumentElement.SelectNodes("//cfdi:Complemento/cce11:ComercioExterior/cce11:Emisor", namespaces) 'XmlDoc.SelectNodes("cfdi:Complemento/{0}:Traslados", "") + Dim CENodosReceptor As XmlNodeList = XmlDoc.DocumentElement.SelectNodes("//cfdi:Complemento/cce11:ComercioExterior/cce11:Receptor", namespaces) + Dim CEnodosDestinatario As XmlNodeList = XmlDoc.DocumentElement.SelectNodes("//cfdi:Complemento/cce11:ComercioExterior/cce11:Destinatario", namespaces) + Dim CEnodosMercancias As XmlNodeList = XmlDoc.DocumentElement.SelectNodes("//cfdi:Complemento/cce11:ComercioExterior/cce11:Mercancias", namespaces) + + + For Each node As XmlNode In CENodosEmisor + Dim nRowEmisor As DataRow = CE_DT_Emisor.NewRow + nRowEmisor("Calle") = ValorNodoXML(node.FirstChild, "Calle") + nRowEmisor("NumeroExterior") = ValorXML(node.FirstChild, "NumeroExterior") + nRowEmisor("Colonia") = ValorXML(node.FirstChild, "Colonia") + nRowEmisor("Municipio") = ValorXML(node.FirstChild, "Municipio") + nRowEmisor("Estado") = ValorXML(node.FirstChild, "Estado") + nRowEmisor("Pais") = ValorXML(node.FirstChild, "Pais") + nRowEmisor("CodigoPostal") = ValorXML(node.FirstChild, "CodigoPostal") + nRowEmisor("Tipo") = 1 + CE_DT_Emisor.Rows.Add(nRowEmisor) + Exit For + Next + + For Each node As XmlNode In CENodosReceptor + Dim nRowReceptor As DataRow = CE_DT_Receptor.NewRow + nRowReceptor("Calle") = ValorXML(node.FirstChild, "Calle") + nRowReceptor("NumeroExterior") = ValorXML(node.FirstChild, "NumeroExterior") + nRowReceptor("Colonia") = ValorXML(node.FirstChild, "Colonia") + nRowReceptor("Municipio") = ValorXML(node.FirstChild, "Municipio") + nRowReceptor("Estado") = ValorXML(node.FirstChild, "Estado") + nRowReceptor("Pais") = ValorXML(node.FirstChild, "Pais") + nRowReceptor("CodigoPostal") = ValorXML(node.FirstChild, "CodigoPostal") + nRowReceptor("Tipo") = 2 + CE_DT_Receptor.Rows.Add(nRowReceptor) + Exit For + Next + + For Each node As XmlNode In CEnodosDestinatario + Dim nRowDestinatario As DataRow = CE_DT_Destinatario.NewRow + nRowDestinatario("Calle") = ValorXML(node.FirstChild, "Calle") + nRowDestinatario("NumeroExterior") = ValorXML(node.FirstChild, "NumeroExterior") + nRowDestinatario("Colonia") = ValorXML(node.FirstChild, "Colonia") + nRowDestinatario("Municipio") = ValorXML(node.FirstChild, "Municipio") + nRowDestinatario("Estado") = ValorXML(node.FirstChild, "Estado") + nRowDestinatario("Pais") = ValorXML(node.FirstChild, "Pais") + nRowDestinatario("CodigoPostal") = ValorXML(node.FirstChild, "CodigoPostal") + nRowDestinatario("Tipo") = 3 + CE_DT_Destinatario.Rows.Add(nRowDestinatario) + Exit For + Next + + For Each node As XmlNode In CEnodosMercancias + Dim nRowMercancias As DataRow = CE_DT_Mercancias.NewRow + nRowMercancias("NoIdentificacion") = ValorXML(node.FirstChild, "NoIdentificacion") + nRowMercancias("FraccionArancelaria") = ValorXML(node.FirstChild, "FraccionArancelaria") + nRowMercancias("CantidadAduana") = ValorXML(node.FirstChild, "CantidadAduana") + nRowMercancias("UnidadAduana") = ValorXML(node.FirstChild, "UnidadAduana") + nRowMercancias("ValorUnitarioAduana") = ValorXML(node.FirstChild, "ValorUnitarioAduana").ToDecimal + nRowMercancias("ValorDolares") = ValorXML(node.FirstChild, "ValorDolares").ToDecimal + CE_DT_Mercancias.Rows.Add(nRowMercancias) + Next + Dim asddd As String = "" + + End If +#End Region + + + Next End If @@ -7191,6 +7367,17 @@ Public Class ClsPaginas Dim params As New List(Of ReportParameter) + + If RCETipoOperacion.Trim.Length > 0 Then + params.Add(New ReportParameter("CETipoOperacion", RCETipoOperacion)) + params.Add(New ReportParameter("CEClavePedimento", RCEClavePedimento)) + params.Add(New ReportParameter("CEIncoterm", RCEIncoterm)) + params.Add(New ReportParameter("CEId", CEId)) + params.Add(New ReportParameter("CEMotivoTraslado", RCEMotivoTraslado)) + params.Add(New ReportParameter("CETipoCamvio", CETipoCambio)) + End If + + If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then params.Add(New ReportParameter("CFDIVersion", Vta.Version)) If Vta.Cliente.CodigoRegimenFiscal.ToString.Length > 0 Then @@ -7776,6 +7963,26 @@ Public Class ClsPaginas Dim rds5 As New ReportDataSource With {.Name = "DataSet5", .Value = If(Vta.DtNCVinculadas IsNot Nothing, Vta.DtNCVinculadas, New DataTable)} ' sino esta creado el objeto, lo creamos, para que no truene el reporte lrds.Add(rds5) + + If RCETipoOperacion.Trim.Length > 0 Then + Dim rds6 As New ReportDataSource With {.Name = "CE_DT_Emisor", .Value = CE_DT_Emisor} + lrds.Add(rds6) + + Dim rds7 As New ReportDataSource With {.Name = "CE_DT_Receptor", .Value = CE_DT_Receptor} + lrds.Add(rds7) + + Dim rds8 As New ReportDataSource With {.Name = "CE_DT_Destinatario", .Value = CE_DT_Destinatario} + lrds.Add(rds8) + + Dim rds9 As New ReportDataSource With {.Name = "CE_DT_Mercancias", .Value = CE_DT_Mercancias} + lrds.Add(rds9) + + Dim rds10 As New ReportDataSource With {.Name = "CE_DT_Cabecera", .Value = CE_DT_Cabecera} + lrds.Add(rds10) + + End If + + If UsuarioActual.CveEmpresa.Contiene(141, 152, 159, 160, 161, 162, 163) AndAlso (RutaFormato.Contains("Factura") Or RutaFormato.Contains("Cotizacion")) Then params.Add(New ReportParameter("Kilometraje", Vta.Kilometraje.ToString)) End If @@ -7915,7 +8122,7 @@ Public Class ClsPaginas Dim payload As New JObject( New JProperty("formato", Formato), New JProperty("ruta", RutaReporte), - New JProperty("UsarFormatoCompilado", false), + New JProperty("UsarFormatoCompilado", False), New JProperty("parametros", paramsArray), New JProperty("dataSource", dataSourceArray) ) @@ -9363,8 +9570,7 @@ Public Class ClsPaginas #Region "P A G O D E C O M P R A S " - - Public Function AplicaPrePolizaPago(CompraActual As Compra, Pago As CompraPago, CvePrePoliza As Integer, ByRef ObjConta As ClsContabilidad) As Boolean + Public Function AplicaPrePolizaPagoCompra(CompraActual As Compra, Pago As CompraPago, CvePrePoliza As Integer, ByRef ObjConta As ClsContabilidad) As Boolean Dim ErrorMovtos As Boolean = False Dim PorcentajePago As Decimal = Pago.ImportePago / CompraActual.Total Dim ImporteMovimiento As Decimal = 0 @@ -9470,14 +9676,18 @@ Public Class ClsPaginas ImporteMovimiento = (PorcentajePago * CompraActual.RetISR).RoundSQL ImporteMN = (ImporteMovimiento * CompraActual.TC).RoundSQL If CompraActual.CveMoneda > 1 Then ImporteME = ImporteMovimiento + Dim ContabilizableISR As Boolean = False + If UsuarioActual.CveEmpresa = 140 Then + ContabilizableISR = True + End If Dim Ret As ConceptosRetenciones = CompraActual.ConceptoPrePolizaRetISR - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, Ret.CveConceptoxAcreditar, CompraActual.SerieFolio, Concepto, Ret.IdCtaContablexAcreditar, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) Then ErrorMovtos = True + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteMovimiento, ImporteMN, Ret.CveConceptoxAcreditar, CompraActual.SerieFolio, Concepto, Ret.IdCtaContablexAcreditar, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, Contabilizable:=ContabilizableISR) Then ErrorMovtos = True 'si tiene funcionalidad para tomar el TC de pago. se recalcula el importe If FuncionalidadFluctuacionImpuestos Then ImporteMN = (ImporteMovimiento * Pago.TCPago).RoundSQL - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMN, Ret.CveConceptoAcreditable, CompraActual.SerieFolio, Concepto, Ret.IdCtaContableAcreditable, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) Then ErrorMovtos = True + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteMovimiento, ImporteMN, Ret.CveConceptoAcreditable, CompraActual.SerieFolio, Concepto, Ret.IdCtaContableAcreditable, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME, Contabilizable:=ContabilizableISR) Then ErrorMovtos = True End If @@ -9509,15 +9719,17 @@ Public Class ClsPaginas If Not ErrorMovtos AndAlso ImporteMovimiento <> 0 Then Dim tOtCveCon As Integer = 211 Dim tOtTipoMovto As Boolean = False + Dim IdCta As Integer = If(UsuarioActual.Empresa.TipoContabilidad = 2, UsuarioActual.Empresa.Funcionalidad(266).ToEntero(), 0) If ImporteMovimiento < 0 Then tOtTipoMovto = True : tOtCveCon = 78 ImporteMovimiento = Math.Abs(ImporteMovimiento) + IdCta = If(UsuarioActual.Empresa.TipoContabilidad = 2, UsuarioActual.Empresa.IdCuentaOtrosIngresos, 0) End If - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, tOtTipoMovto, ImporteMovimiento, ImporteMovimiento, tOtCveCon, CompraActual.SerieFolio, Concepto, 0, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, CveSubProyecto:=CompraActual.CveSubProyecto, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) Then ErrorMovtos = True + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, tOtTipoMovto, ImporteMovimiento, ImporteMovimiento, tOtCveCon, CompraActual.SerieFolio, Concepto, IdCta, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, CveSubProyecto:=CompraActual.CveSubProyecto, TipoCambioPago:=Pago.TCPago, ImporteME:=ImporteME) Then ErrorMovtos = True End If - If Not ErrorMovtos AndAlso CompraActual.TC <> Pago.TCPago Then + If Not ErrorMovtos AndAlso TCValuacion <> Pago.TCPago Then Dim ConceptoContable, IdCtaContable As Integer Dim TipoMovimiento As Boolean Dim Diferencia As Decimal = 0 @@ -9625,50 +9837,52 @@ Public Class ClsPaginas Public ReadOnly Property ConceptoPrePolizaRetIVA As ConceptosRetenciones Get Dim Ret As New ConceptosRetenciones - Dim Funcionalidad As Integer + Dim Funcionalidad, FuncionalidadxAcred As Integer If CveConceptoRetIVA = 1 Then - Funcionalidad = 308 + Funcionalidad = 308 : FuncionalidadxAcred = 307 Ret.CveConceptoAcreditable = 22 Ret.CveConceptoxAcreditar = 15 ElseIf CveConceptoRetIVA = 2 Then - Funcionalidad = 310 + Funcionalidad = 310 : FuncionalidadxAcred = 309 Ret.CveConceptoAcreditable = 184 Ret.CveConceptoxAcreditar = 183 ElseIf CveConceptoRetIVA = 3 Then - Funcionalidad = 312 + Funcionalidad = 312 : FuncionalidadxAcred = 311 Ret.CveConceptoAcreditable = 186 Ret.CveConceptoxAcreditar = 185 ElseIf CveConceptoRetIVA = 4 Then - Funcionalidad = 314 + Funcionalidad = 314 : FuncionalidadxAcred = 313 Ret.CveConceptoAcreditable = 249 Ret.CveConceptoxAcreditar = 248 ElseIf CveConceptoRetIVA = 5 Then - Funcionalidad = 578 + Funcionalidad = 578 : FuncionalidadxAcred = 578 Ret.CveConceptoAcreditable = 286 Ret.CveConceptoxAcreditar = 285 ElseIf CveConceptoRetIVA = 6 Then - Funcionalidad = 578 + Funcionalidad = 578 : FuncionalidadxAcred = 578 Ret.CveConceptoAcreditable = 333 Ret.CveConceptoxAcreditar = 334 End If If UsuarioActual.Empresa.TipoContabilidad = 2 Then - If UsuarioActual.Empresa.Funcionalidad(Funcionalidad).ToEntero > 0 Then - Ret.IdCtaContablexAcreditar = UsuarioActual.Empresa.Funcionalidad(Funcionalidad).ToEntero + + Dim ObjConta As New ClsContabilidad + If UsuarioActual.Empresa.Funcionalidad(FuncionalidadxAcred).ToEntero > 0 Then + Ret.IdCtaContablexAcreditar = UsuarioActual.Empresa.Funcionalidad(FuncionalidadxAcred).ToEntero Else - Dim ObjConta As New ClsContabilidad - If ObjConta.GetRetCuenta(Ret.CveConceptoAcreditable, UsuarioActual.CveEmpresa) Then - If ObjConta.DtResultados.Rows.Count > 0 Then - Ret.IdCtaContablexAcreditar = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero - End If - End If If ObjConta.GetRetCuenta(Ret.CveConceptoxAcreditar, UsuarioActual.CveEmpresa) Then - If ObjConta.DtResultados.Rows.Count > 0 Then - Ret.IdCtaContableAcreditable = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero - End If + If ObjConta.DtResultados.Rows.Count > 0 Then Ret.IdCtaContablexAcreditar = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero End If - ObjConta.Dispose() End If + + If UsuarioActual.Empresa.Funcionalidad(Funcionalidad).ToEntero > 0 Then + Ret.IdCtaContableAcreditable = UsuarioActual.Empresa.Funcionalidad(Funcionalidad).ToEntero + Else + If ObjConta.GetRetCuenta(Ret.CveConceptoAcreditable, UsuarioActual.CveEmpresa) Then + If ObjConta.DtResultados.Rows.Count > 0 Then Ret.IdCtaContableAcreditable = ObjConta.DtResultados.Rows(0)("IdCuentaRetIVACirculacion").ToString.ToEntero + End If + End If + ObjConta.Dispose() End If Return Ret @@ -9677,38 +9891,41 @@ Public Class ClsPaginas Public ReadOnly Property ConceptoPrePolizaRetISR As ConceptosRetenciones Get Dim Ret As New ConceptosRetenciones - Dim Funcionalidad As Integer + Dim Funcionalidad, FuncionalidadxAcred As Integer If CveConceptoRetISR = 1 Then - Funcionalidad = 316 + Funcionalidad = 316 : FuncionalidadxAcred = 315 Ret.CveConceptoAcreditable = 23 Ret.CveConceptoxAcreditar = 16 ElseIf CveConceptoRetISR = 2 Then - Funcionalidad = 318 + Funcionalidad = 318 : FuncionalidadxAcred = 317 Ret.CveConceptoAcreditable = 244 Ret.CveConceptoxAcreditar = 243 ElseIf CveConceptoRetISR = 3 Then - Funcionalidad = 348 + Funcionalidad = 349 : FuncionalidadxAcred = 348 Ret.CveConceptoAcreditable = 328 Ret.CveConceptoxAcreditar = 327 End If If UsuarioActual.Empresa.TipoContabilidad = 2 Then + + Dim ObjConta As New ClsContabilidad + If UsuarioActual.Empresa.Funcionalidad(FuncionalidadxAcred).ToEntero > 0 Then + Ret.IdCtaContablexAcreditar = UsuarioActual.Empresa.Funcionalidad(FuncionalidadxAcred).ToEntero + Else + If ObjConta.GetRetCuenta(Ret.CveConceptoxAcreditar, UsuarioActual.CveEmpresa) Then + If ObjConta.DtResultados.Rows.Count > 0 Then Ret.IdCtaContablexAcreditar = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero + End If + End If + If UsuarioActual.Empresa.Funcionalidad(Funcionalidad).ToEntero > 0 Then Ret.IdCtaContableAcreditable = UsuarioActual.Empresa.Funcionalidad(Funcionalidad).ToEntero Else - Dim ObjConta As New ClsContabilidad - If ObjConta.GetRetCuenta(Ret.CveConceptoxAcreditar, UsuarioActual.CveEmpresa) Then - If ObjConta.DtResultados.Rows.Count > 0 Then - Ret.IdCtaContablexAcreditar = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero - End If - End If If ObjConta.GetRetCuenta(Ret.CveConceptoAcreditable, UsuarioActual.CveEmpresa) Then - If ObjConta.DtResultados.Rows.Count > 0 Then - Ret.IdCtaContableAcreditable = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero - End If + If ObjConta.DtResultados.Rows.Count > 0 Then Ret.IdCtaContableAcreditable = ObjConta.DtResultados.Rows(0)("IdCuentaRetISRCirculacion").ToString.ToEntero End If - ObjConta.Dispose() End If + ObjConta.Dispose() + End If Return Ret @@ -9751,7 +9968,9 @@ Public Class ClsPaginas Pago.CveConceptoPago = If(Pago.CveConceptoPago = -1, 2, Pago.CveConceptoPago) 'si viene en parametro lo toma com primera opcion, sino el 2 - If VentaActual.CveMoneda <> 1 Then Pago.CveConceptoPago = 292 + If VentaActual.CveMoneda <> 1 Then + If Pago.TipoPago = "NC" Then Pago.CveConceptoPago = 301 : Pago.CveConceptoPago = 292 + End If Dim Concepto As String = String.Format("{0} F:{1}", VentaActual.ClienteNombre, VentaActual.SerieFolio) Dim FuncionalidadFluctuacionImpuestos As Boolean = If(UsuarioActual.Empresa.Funcionalidad(159) = "1", True, False) diff --git a/App_Code/ClsSisUsuarios.vb b/App_Code/ClsSisUsuarios.vb index fb2337fa3..613bc8b9a 100644 --- a/App_Code/ClsSisUsuarios.vb +++ b/App_Code/ClsSisUsuarios.vb @@ -720,7 +720,7 @@ Public Class ClsSisUsuarios #End Region #Region "U S U A R I O S" - Public Function GetUsuarios(CveUsuario As Integer, Optional CveRol As Integer = -1, Optional CveUsuarioControlado As Integer = -1) As Boolean + Public Function GetUsuarios(CveUsuario As Integer, Optional CveRol As Integer = -1, Optional CveUsuarioControlado As Integer = -1, Optional Estatus As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Sis_UsuariosGet") @@ -731,6 +731,9 @@ Public Class ClsSisUsuarios .Add("@Usuario", SqlDbType.VarChar).Value = "-1" .Add("@Contraseña", SqlDbType.VarChar).Value = "-1" .Add("@EsLogIn", SqlDbType.Bit).Value = 0 + .Add("@Estatus", SqlDbType.Int).Value = Estatus + + End With Try diff --git a/App_Code/Timbrado.vb b/App_Code/Timbrado.vb index 09b82768c..9dc3d44bd 100644 --- a/App_Code/Timbrado.vb +++ b/App_Code/Timbrado.vb @@ -4832,7 +4832,7 @@ Public Class Timbrado If ObjCFDITimbre.Conceptos IsNot Nothing AndAlso ObjCFDITimbre.Conceptos.Count > 0 Then For Each concep As CFDIConceptos In ObjCFDITimbre.Conceptos - cfdi.Concepto(concep.ClaveProdServ, concep.Noidentificacion, concep.Cantidad.ToString("0.00####").ToDouble(), concep.ClaveUnidad, concep.Unidad, concep.Descripcion, concep.ValorUnitario.ToString("0.00####").ToDouble(), concep.Importe, concep.Descuento, concep.ObjetoImpuesto) + cfdi.Concepto(concep.ClaveProdServ, concep.Noidentificacion, concep.Cantidad.ToString("0.00####"), concep.ClaveUnidad, concep.Unidad, concep.Descripcion, concep.ValorUnitario.ToString("0.00####"), concep.Importe, concep.Descuento, concep.ObjetoImpuesto) For Each imp As CFDIConceptosImpuestos In concep.Impuestos If imp.TrasladooRetencion = "T" Then cfdi.ConceptoTraslado(imp.Base, imp.Impuesto, imp.TipoFactor, imp.TasaOCuota, imp.Importe) @@ -4919,81 +4919,81 @@ Public Class Timbrado #End Region - #Region "Comercio Exterior" - 'If Ventas.Cliente.AplicaComercioExterior And ObjCFDITimbre.Complementos.ComercioExterior11.AplicaComercioExteriorSubProyecto Then - ' If ObjCFDITimbre.Complementos.ComercioExterior11 IsNot Nothing Then + If Ventas.Cliente.AplicaComercioExterior And ObjCFDITimbre.Complementos.ComercioExterior11.AplicaComercioExteriorSubProyecto Then + If ObjCFDITimbre.Complementos.ComercioExterior11 IsNot Nothing Then - ' 'DATOS GENERALES - ' cfdi.ComercioExterior11(ObjCFDITimbre.Complementos.ComercioExterior11.MotivoTraslado, - ' ObjCFDITimbre.Complementos.ComercioExterior11.TipoOperacion, - ' ObjCFDITimbre.Complementos.ComercioExterior11.ClavedePedimento, - ' ObjCFDITimbre.Complementos.ComercioExterior11.CertificadoOrigen, - ' ObjCFDITimbre.Complementos.ComercioExterior11.NumCertificadoOrigen, - ' ObjCFDITimbre.Complementos.ComercioExterior11.NumeroExportadorConfiable, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Incoterm, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Subdivision, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Observaciones, - ' ObjCFDITimbre.Complementos.ComercioExterior11.TipoCambioUSD, - ' ObjCFDITimbre.Complementos.ComercioExterior11.TotalUSD) - ' 'EMISOR - ' cfdi.ComercioExterior11Emisor(If(EmisorRFC.Length >= 12, "", ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.CURP)) - ' cfdi.ComercioExterior11Domicilio(ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Calle, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.NumeroExterior, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.NumeroInterior, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Colonia, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Localidad, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Referencia, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Municipio, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Estado, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Pais, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.CP) - ' 'RECEPTOR - ' cfdi.ComercioExterior11Receptor(ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.NumRegIdTrib) - ' cfdi.ComercioExterior11DomicilioReceptor(ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.Calle, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.NumeroExterior, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.NumeroInterior, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.Colonia, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.Localidad, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.Referencia, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.Municipio, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.Estado, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.Pais, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.CP) - ' cfdi.ComercioExterior11Destinatario(ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.NumRegIdTrib, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.Nombre, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.Calle, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.NumeroExterior, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.NumeroInterior, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.Colonia, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.Localidad, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.Referencia, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.Municipio, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.Estado, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.Pais, - ' ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.CP) - ' 'MERCANCIAS - ' If ObjCFDITimbre.Complementos.ComercioExterior11.Mercancias IsNot Nothing AndAlso ObjCFDITimbre.Complementos.ComercioExterior11.Mercancias.Count > 0 Then - ' For Each concep As CFDIComercioExterior11Mercancias In ObjCFDITimbre.Complementos.ComercioExterior11.Mercancias - ' cfdi.ComercioExterior11Mercancia(concep.NoIdentificacion, concep.FraccionArancelaria, concep.CantidadAduana, concep.UnidadAduana, concep.ValorUnitarioAduana, concep.ValorDolares) - ' If concep.DescripcionesEspecificas.Marca <> "" Then - ' cfdi.ComercioExterior11MercanciaDescripcionesEspeciales(concep.DescripcionesEspecificas.Marca, - ' concep.DescripcionesEspecificas.Modelo, - ' concep.DescripcionesEspecificas.SubModelo, - ' concep.DescripcionesEspecificas.NumeroSerie) - ' End If - ' Next + 'DATOS GENERALES + cfdi.ComercioExterior11(ObjCFDITimbre.Complementos.ComercioExterior11.MotivoTraslado, + ObjCFDITimbre.Complementos.ComercioExterior11.TipoOperacion, + ObjCFDITimbre.Complementos.ComercioExterior11.ClavedePedimento, + ObjCFDITimbre.Complementos.ComercioExterior11.CertificadoOrigen, + ObjCFDITimbre.Complementos.ComercioExterior11.NumCertificadoOrigen, + ObjCFDITimbre.Complementos.ComercioExterior11.NumeroExportadorConfiable, + ObjCFDITimbre.Complementos.ComercioExterior11.Incoterm, + ObjCFDITimbre.Complementos.ComercioExterior11.Subdivision, + ObjCFDITimbre.Complementos.ComercioExterior11.Observaciones, + ObjCFDITimbre.Complementos.ComercioExterior11.TipoCambioUSD, + ObjCFDITimbre.Complementos.ComercioExterior11.TotalUSD) + 'EMISOR + cfdi.ComercioExterior11Emisor(If(EmisorRFC.Length >= 12, "", ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.CURP)) + cfdi.ComercioExterior11Domicilio(ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Calle, + ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.NumeroExterior, + ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.NumeroInterior, + ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Colonia, + ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Localidad, + ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Referencia, + ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Municipio, + ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Estado, + ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.Pais, + ObjCFDITimbre.Complementos.ComercioExterior11.Emisor.CP) + 'RECEPTOR + cfdi.ComercioExterior11Receptor(ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.NumRegIdTrib) + cfdi.ComercioExterior11DomicilioReceptor(ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.Calle, + ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.NumeroExterior, + ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.NumeroInterior, + ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.Colonia, + ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.Localidad, + ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.Referencia, + ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.Municipio, + ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.Estado, + ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.Pais, + ObjCFDITimbre.Complementos.ComercioExterior11.Receptor.CP) + cfdi.ComercioExterior11Destinatario(ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.NumRegIdTrib, + ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.Nombre, + ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.Calle, + ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.NumeroExterior, + ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.NumeroInterior, + ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.Colonia, + ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.Localidad, + ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.Referencia, + ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.Municipio, + ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.Estado, + ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.Pais, + ObjCFDITimbre.Complementos.ComercioExterior11.Destinatario.CP) + 'MERCANCIAS + If ObjCFDITimbre.Complementos.ComercioExterior11.Mercancias IsNot Nothing AndAlso ObjCFDITimbre.Complementos.ComercioExterior11.Mercancias.Count > 0 Then + For Each concep As CFDIComercioExterior11Mercancias In ObjCFDITimbre.Complementos.ComercioExterior11.Mercancias + cfdi.ComercioExterior11Mercancia(concep.NoIdentificacion, concep.FraccionArancelaria, concep.CantidadAduana, concep.UnidadAduana, concep.ValorUnitarioAduana, concep.ValorDolares) + If concep.DescripcionesEspecificas.Marca <> "" Then + cfdi.ComercioExterior11MercanciaDescripcionesEspeciales(concep.DescripcionesEspecificas.Marca, + concep.DescripcionesEspecificas.Modelo, + concep.DescripcionesEspecificas.SubModelo, + concep.DescripcionesEspecificas.NumeroSerie) + End If + Next - ' End If + End If - ' End If - 'End If + End If + End If #End Region + End If diff --git a/Ashx/CargaEventos.ashx b/Ashx/CargaEventos.ashx index f74549f7e..b25e72291 100644 --- a/Ashx/CargaEventos.ashx +++ b/Ashx/CargaEventos.ashx @@ -22,22 +22,60 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState Dim FI As Date Dim FF As Date - If context.Request("U").ToEntero > 0 Then - CveUsuario = context.Request("U").ToEntero - CveEmpresa = context.Request("E").ToEntero - FI = context.Request("start").ToDate + If context.Request("METODO") IsNot Nothing Then - FF = context.Request("end").ToDate - If Not GetEventos(CveUsuario, CveEmpresa, FI, FF) Then - 'Convierte el objeto de Eventos en JSON - 'Dim oSerializer As System.Web.Script.Serialization.JavaScriptSerializer = New System.Web.Script.Serialization.JavaScriptSerializer - Dim sJSON As String = Newtonsoft.Json.JsonConvert.SerializeObject(events) + Select Case context.Request("METODO") + Case "servicio_domicilio" + + If context.Request("U").ToEntero > 0 Then + + CveUsuario = context.Request("U").ToEntero + CveEmpresa = context.Request("E").ToEntero + FI = context.Request("start").ToDate + FF = context.Request("end").ToDate + + If Not GetEventos(CveUsuario, CveEmpresa, FI, FF, CveOS:=-2) Then + 'Convierte el objeto de Eventos en JSON + 'Dim oSerializer As System.Web.Script.Serialization.JavaScriptSerializer = New System.Web.Script.Serialization.JavaScriptSerializer + Dim sJSON As String = Newtonsoft.Json.JsonConvert.SerializeObject(events) + + context.Response.Write(sJSON) + End If + + End If + + + Exit Select + Case Else + Exit Select + End Select + + + + Else + If context.Request("U").ToEntero > 0 Then + CveUsuario = context.Request("U").ToEntero + CveEmpresa = context.Request("E").ToEntero + FI = context.Request("start").ToDate + + FF = context.Request("end").ToDate + If Not GetEventos(CveUsuario, CveEmpresa, FI, FF) Then + 'Convierte el objeto de Eventos en JSON + 'Dim oSerializer As System.Web.Script.Serialization.JavaScriptSerializer = New System.Web.Script.Serialization.JavaScriptSerializer + Dim sJSON As String = Newtonsoft.Json.JsonConvert.SerializeObject(events) + + context.Response.Write(sJSON) + End If - context.Response.Write(sJSON) End If - End If + + + + + + End Sub Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable @@ -47,14 +85,15 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState End Property - Private Function GetEventos(CveUsuario As Integer, CveEmpresa As Integer, pFI As Date, pFF As Date) As Boolean + Private Function GetEventos(CveUsuario As Integer, CveEmpresa As Integer, pFI As Date, pFF As Date, Optional CveOS As Integer = -1) As Boolean Dim ObjEventos As New ClsOIEventos Dim ErrorEventos = False Dim CveEmpresaCRM As Integer = 0 - If ObjEventos.GetEventos(-1, -1, -1, "-1", "-1", -1, CveUsuario, CveUsuario, -1, -1, -1, "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, CveUsuario, CveUsuario, CveUsuario, CveEmpresa, pFI, pFF) Then + If ObjEventos.GetEventos(-1, -1, -1, "-1", "-1", -1, CveUsuario, CveUsuario, -1, -1, -1, "-1", -1, -1, -1, -1, CveOS, -1, -1, -1, -1, -1, CveUsuario, CveUsuario, CveUsuario, CveEmpresa, pFI, pFF) Then If ObjEventos.DtResultados.Rows.Count > 0 Then events = New List(Of CalendarEvent) + Try For Each dr As DataRow In ObjEventos.DtResultados.Rows Dim cevent As CalendarEvent = New CalendarEvent() @@ -78,6 +117,8 @@ Public Class CargaEventos : Implements IHttpHandler, IRequiresSessionState cevent.Prospecto = dr("Prospecto").ToString cevent.CveTipoEvento = dr("Prospecto").ToString.ToEntero cevent.EmpresaCRM = dr("EmpresaCRM").ToString + cevent.SubProyecto = dr("SubProyecto").ToString + cevent.CveSubProyecto = dr("CveSubProyecto").ToString.ToEntero '11/05/2018 - Evento Gasto Recurrente cevent.CveTipoEvento = dr("CveTipoEvento").ToString.ToEntero diff --git a/Bancos/DepositosCaja.aspx.vb b/Bancos/DepositosCaja.aspx.vb index 97b6df623..069a5dd6c 100644 --- a/Bancos/DepositosCaja.aspx.vb +++ b/Bancos/DepositosCaja.aspx.vb @@ -314,7 +314,7 @@ Partial Class Bancos_DepositosCaja CveIEDestino = ObjBancos.AddBancos_IE(DdlCajaChica.SelectedValue.ToEntero, 2, Fecha, FolioIE.ToString, String.Format("Depósito Bancario: {0}", SerieFolio), Importe, CveMoneda, 1, TxtObservaciones.Text, "", False, False, -1, NuevaCvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, True, Importe, SerieFolio, 30, String.Format("Depósito Bancario: {0}", SerieFolio), Fecha, IdCuentaBancariaDestino, -1, CveClasificacion:=CveClasificacion, CveSubProyecto:=CveSubProyecto, CveVenta:=CveVenta, CveIE:=CveIEDestino, ImporteMX:=Importe * TipoCambio, CveCuenta:=CveCuentaBancariaDestino) Then + If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, True, Importe, SerieFolio, 30, String.Format("Depósito Bancario: {0}", SerieFolio), Fecha, IdCuentaBancariaDestino, -1, CveClasificacion:=CveClasificacion, CveSubProyecto:=CveSubProyecto, CveVenta:=CveVenta, CveIE:=CveIEDestino, ImporteMX:=Importe * TipoCambio) Then OcurrioError = True Exit For End If diff --git a/Bancos/PagoDeudor.aspx.cs b/Bancos/PagoDeudor.aspx.cs index c4e0bac4f..611b02810 100644 --- a/Bancos/PagoDeudor.aspx.cs +++ b/Bancos/PagoDeudor.aspx.cs @@ -365,7 +365,7 @@ public partial class Bancos_PagoDeudor : ClsPaginas { MsgError = "No se pudo insertar concepto de bancos complementaria"; } - s + // BANCOS if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, true, TxtImportePrestamo.Text.ToDecimal(), Ref, CveConceptoContableBanco, Conc, IDCtaContableBancosPrestamo, CveIE, CveProveedor: DdlProveedorPrestamo.SelectedValue.ToEntero(), ImporteMX: TxtImportePrestamo.Text.ToDecimal(), ImporteME: TxtImportePrestamo.Text.ToDecimal(), TipoCambio: tipoCambio, CveSubProyecto: DdlSubProyecto.SelectedValue.ToEntero())) { diff --git a/Bancos/ProveedoresAbonar.aspx.vb b/Bancos/ProveedoresAbonar.aspx.vb index dcd828b1a..b552cb479 100644 --- a/Bancos/ProveedoresAbonar.aspx.vb +++ b/Bancos/ProveedoresAbonar.aspx.vb @@ -203,6 +203,21 @@ Partial Class Bancos_ProveedoresAbonar End Set End Property + + Private Property CveSubProyectoFiltro As Integer + Get + If ViewState("CveSubProyectoFiltro") Is Nothing Then + ViewState("CveSubProyectoFiltro") = -1 + End If + Return ViewState("CveSubProyectoFiltro").ToString.ToEntero + + End Get + Set(value As Integer) + ViewState("CveSubProyectoFiltro") = value + End Set + End Property + + Private Property DtDatos As DataTable Get Return DirectCast(ViewState("DtDatos"), DataTable) @@ -278,6 +293,7 @@ Partial Class Bancos_ProveedoresAbonar CveAplicaNC = IfNull(Request("CveAplicaNC"), "-1").ToString.ToEntero CveProveedorSucursal = IfNull(Request("CveProveedorSucursal"), "-1").ToString.ToEntero CodigoProgramacion = IfNull(Request("CodigoProgramacion"), "-1").ToString + CveSubProyectoFiltro = IfNull(Request("CveSubProyecto"), -1).ToString.ToEntero TxtOtrosImportes.Attributes.Add("onKeyUp", String.Format("FnSuma(this,{0},{1});", "TxtTotal", 0)) @@ -382,7 +398,7 @@ Partial Class Bancos_ProveedoresAbonar TxtImporte.Text = "" TxtTotal.Text = "" - If Mov.GetCxPProveedor(CveProveedor, FechaI, FechaF, CveUsuarioProgramo, CveUsuarioRegistro, CveUsuarioResponsable, CveClasificacionProveedor, tCveMoneda, CveEstatus, CveProveedorSucursal, CveAplicaNC, "-1", "-1", CodigoProgramacion) Then + If Mov.GetCxPProveedor(CveProveedor, FechaI, FechaF, CveUsuarioProgramo, CveUsuarioRegistro, CveUsuarioResponsable, CveClasificacionProveedor, tCveMoneda, CveEstatus, CveProveedorSucursal, CveAplicaNC, "-1", "-1", CodigoProgramacion, CveSubProyecto:=CveSubProyectoFiltro) Then DtDatos = Mov.DtResultados.FiltraParametros("Saldo > 0", "Fecha,SerieFolio") GvCxP.DataSource = DtDatos DtDatos.Columns.Add("Movimiento") @@ -488,7 +504,7 @@ Partial Class Bancos_ProveedoresAbonar If e.Row.DBCampo("Saldo").ToDouble < 0 Then e.Row.Cells(7).ForeColor = Drawing.Color.Red If e.Row.DBCampo("DiasVencidos").ToDouble > 0 AndAlso CType(sender, GridView).ID = "GvCxC" Then e.Row.Cells(4).ForeColor = Drawing.Color.Red - If e.Row.DBCampo("Original").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlSaldoOriginal"), Literal).Text = "" + If e.Row.DBCampo("TotalOriginal").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlSaldoOriginal"), Literal).Text = "" If e.Row.DBCampo("Abonado").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlAbonado"), Literal).Text = "" If e.Row.DBCampo("Saldo").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlSaldo"), Literal).Text = "" @@ -835,6 +851,7 @@ Partial Class Bancos_ProveedoresAbonar CompraActual.EsImportacion = gvr.DataKey("EsImportacion") = "True" CompraActual.UsuarioActual = UsuarioActual CompraActual.CveSubProyecto = gvr.DataKey("CveSubProyecto").ToEntero + CompraActual.IdCtaContableProv = CtaProveedor 'Importe de pago Pago.ImportePago = gvr.FCTextBox("TxtAbonar").Text.ToDecimal @@ -850,6 +867,8 @@ Partial Class Bancos_ProveedoresAbonar If gvr.FCTextBox("TxtComision").Text.ToDecimal <> 0 Then Pago.OtroGastoIngreso = gvr.FCTextBox("TxtComision").Text.ToDecimal + Else + Pago.OtroGastoIngreso = 0 End If If AplicaPrePolizaPago(CompraActual, Pago, CvePrePoliza, ObjMov) Then @@ -867,7 +886,8 @@ Partial Class Bancos_ProveedoresAbonar Dim UsaComplementariaBancos As Boolean = Not UsuarioActual.CveEmpresa.Contiene(7, 11, 122, 145) Dim ConceptoMovimiento As String = $"{TxtPagueseA.Text.Trim} - {TxtObservaciones.Text} {If(Pago.TCPago > 1, $" TC:{Pago.TCPago}", "")}" Dim Referencia As String = $"{HdnTipoTransaccionAbreviatura.Value}: {TxtFolio.Text.Trim}" - Dim tImporteMN As Decimal = Pago.ImportePago + Dim tImporteMN As Decimal = TxtImporte.Text.ToDecimal + Pago.ImportePago = tImporteMN If DivTarjeta.Visible AndAlso DdlTarjeta.SelectedValue.ToEntero > 0 Then Dim ObjCreditos As New ClsBancos @@ -891,7 +911,7 @@ Partial Class Bancos_ProveedoresAbonar MsgError = "No se pudo insertar la póliza" End If - If UsaComplementariaBancos Then + If Pago.CveMonedaPago = 2 AndAlso UsaComplementariaBancos Then If MsgError = "" AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, Pago.ImportePago, (Pago.ImportePago * Pago.TCPago - Pago.ImportePago).RoundSQL, 204, Referencia, ConceptoMovimiento, IdCuentaBancariaComplementaria, CveIE:=CveIE, CveProveedor:=CveProveedor, ImporteME:=Pago.ImportePago, TipoCambio:=Pago.TCPago, CveSubProyecto:=CveSubProyecto) Then MsgError = "No se pudo insertar la póliza" End If @@ -1001,7 +1021,7 @@ Partial Class Bancos_ProveedoresAbonar For Each gvr As GridViewRow In GvCxP.Rows If gvr.FCCheckBox("Chk").Checked Then 'obtengo su poliza para ver que presupuestos afecto - If gvr.DataKey("Original").ToDouble > 0 Then PorcentajePago = gvr.FCTextBox("TxtAbonar").Text.ToDouble / gvr.DataKey("Original").ToDouble Else PorcentajePago = 1 + If gvr.DataKey("TotalOriginal").ToDouble > 0 Then PorcentajePago = gvr.FCTextBox("TxtAbonar").Text.ToDouble / gvr.DataKey("TotalOriginal").ToDouble Else PorcentajePago = 1 If ObjComp.GetPresupuestosCompras(gvr.DataKey("CveCompra").ToEntero) Then dtAC.Merge(ObjComp.DtResultados) @@ -1890,7 +1910,7 @@ Partial Class Bancos_ProveedoresAbonar End If End If - Dim PorcentajePago As Decimal = gr.DataKey("Saldo").ToDecimal / gr.DataKey("Original").ToDecimal + Dim PorcentajePago As Decimal = gr.DataKey("Saldo").ToDecimal / gr.DataKey("TotalOriginal").ToDecimal If MsgError = "" AndAlso gr.DataKey("IVA").ToDecimal > 0 Then Dim PorcentajeImpuesto As Decimal = gr.DataKey("PorcentajeIVA").ToDecimal diff --git a/Bancos/RepProveedoresPagos.aspx.vb b/Bancos/RepProveedoresPagos.aspx.vb index c8562b697..cae394bf3 100644 --- a/Bancos/RepProveedoresPagos.aspx.vb +++ b/Bancos/RepProveedoresPagos.aspx.vb @@ -162,7 +162,8 @@ Partial Class Bancos_RepProveedoresPagos CveUsuarioProgramo = DdlUsuarioProgramo.SelectedValue.ToEntero End If - e.Row.FCHyperLink("ImgAbonar").NavigateUrl = String.Format("/Bancos/ProveedoresAbonar.aspx?CveProveedor={0}&FechaI={1}&FechaF={2}&CveUsuarioProgramo={3}&TipoPago={4}&CveUsuarioRegistro={5}&CveUsuarioResponsable={6}&CveClasificacion={7}&CveMoneda={8}&CveEstatus={9}&CveProveedorSucursal={10}&CveAplicaNC={11}&CodigoProgramacion={12}", e.Row.DBCampo("CveProveedor"), If(txtFechaI.Text <> "", txtFechaI.Text, "-1"), If(txtFechaF.Text <> "", txtFechaF.Text, "-1"), CveUsuarioProgramo, -1, DdlUsuarioRegistro.SelectedValue, DdlUsuarioResponsable.SelectedValue, DdlProveedoresClasificaciones.SelectedValue, e.Row.DBCampo("CveMoneda"), DdlEstatusCompra.SelectedValue, e.Row.DBCampo("CveProveedorSucursal"), AplicaNC.SelectedValue, DdlCodigoProgramacion.SelectedValue) + e.Row.FCHyperLink("ImgAbonar").NavigateUrl = String.Format("/Bancos/ProveedoresAbonar.aspx?CveProveedor={0}&FechaI={1}&FechaF={2}&CveUsuarioProgramo={3}&TipoPago={4}&CveUsuarioRegistro={5}&CveUsuarioResponsable={6}&CveClasificacion={7}&CveMoneda={8}&CveEstatus={9}&CveProveedorSucursal={10}&CveAplicaNC={11}&CodigoProgramacion={12}&CveSubProyecto={13}", e.Row.DBCampo("CveProveedor"), If(txtFechaI.Text <> "", txtFechaI.Text, "-1"), If(txtFechaF.Text <> "", txtFechaF.Text, "-1"), CveUsuarioProgramo, -1, DdlUsuarioRegistro.SelectedValue, DdlUsuarioResponsable.SelectedValue, DdlProveedoresClasificaciones.SelectedValue, e.Row.DBCampo("CveMoneda"), DdlEstatusCompra.SelectedValue, e.Row.DBCampo("CveProveedorSucursal"), AplicaNC.SelectedValue, DdlCodigoProgramacion.SelectedValue, DdlSubProyecto.SelectedValue) + End If End Sub diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx index f0da08cbc..a55268f82 100644 --- a/Compras/Compras.aspx +++ b/Compras/Compras.aspx @@ -6246,7 +6246,9 @@ }); $('input[name*=HdnOC1IVA]').each(function () { - SumaIVA += ToDouble($(this).val()); + + let tmpiva = (ToDouble($(this).val())).toFixed(2) + SumaIVA += ToDouble(tmpiva); }); $('input[name*=HdnOC1RetIVA]').each(function () { diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index fe2fe1bfd..a6f617e3a 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -5385,7 +5385,7 @@ Partial Class Compras_Compras End If - 'agregamos la salida gasto + 'agregamos la salida folio = ObjInventario.GetFolioSiguiente(3, UsuarioActual.CveEmpresa) cvemovimientosalidagasto = ObjInventario.AddMovimiento(tcvealmacen, 3, DdlMoneda.SelectedValue.ToEntero, fecha.AddSeconds(1), folio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompra, -1, -1, -1, Modulo:="Comp/G3") If cvemovimientosalidagasto <= 0 Then @@ -5965,7 +5965,7 @@ Partial Class Compras_Compras Pago.CveCompraAmortizacion = -1 Pago.CveCreditoDetalle = CveCreditoDetalle - ErrorMovtosCxP = AplicaPrePolizaPago(CompraActual, Pago, CvePrePoliza, ObjConta) + ErrorMovtosCxP = AplicaPrePolizaPagoCompra(CompraActual, Pago, CvePrePoliza, ObjConta) End If @@ -6036,7 +6036,7 @@ Partial Class Compras_Compras Pago.CveCompraAmortizacion = -1 'Pago.CveConceptoPago = CveConceptoPago - ErrorMovtosCxP = AplicaPrePolizaPago(CompraActual, Pago, CvePrePoliza, ObjConta) + ErrorMovtosCxP = AplicaPrePolizaPagoCompra(CompraActual, Pago, CvePrePoliza, ObjConta) End If Case 14 'IVA X Acreditar @@ -6091,14 +6091,6 @@ Partial Class Compras_Compras End If End If - 'Case 224 'Otros impuestos - ' If Not DdlTipoComprobante.SelectedValue.Contiene("Ant") Then - ' importeMovimiento = OtrosImpuestos - ' importeMN = Math.Round(importeMovimiento, 2) * tipoCambioActual * Multiplicador - ' If tipoCambioActual > 1 Then Concepto += $" TC{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}" - ' IdCtaContable = If(UsuarioActual.CveEmpresa = 119, 1171, -1) - ' End If - Case 15 'RetIVA X Acreditar Honorarios/Serv. Prof. If Not DdlTipoComprobante.SelectedValue.Contiene("Ant") Then If DdlRetIVAConcepto.Items.Count > 0 AndAlso DdlRetIVAConcepto.SelectedValue.ToEntero() > 0 Then @@ -6157,7 +6149,7 @@ Partial Class Compras_Compras funcionalidad = 317 ConceptoContable = 243 ElseIf DdlRetISRConcepto.SelectedValue.ToEntero = 3 Then - funcionalidad = 348 + funcionalidad = 349 ConceptoContable = 327 End If importeMovimiento = CompraActual.RetISR @@ -6269,10 +6261,12 @@ Partial Class Compras_Compras DT = TmpDT.FiltraParametros("ISNULL(TipoAF,0) <> 2 And ISNULL(CveAlmacen,0) > 0", "", {"CveAlmacen"}) 'RECORREMOS PARA DETECTAR LA MODALIDAD DEL ALMACEN, EN CASO DE SER SOLO EXISTENCIA LIMPIAMOS CVEALMACEN 'SI LA COMPRA ES DE TIPO GASTO CON ALMACEN DEBE REGISTRAR MOVIMIENTO + Dim AlmacenSoloExistencia As Boolean = False If DdlTipoCompra.SelectedValue <> "10" Then For Each Dr As DataRow In DT.Rows If DtAlmacenes.FiltroPrimeroValor("Modalidad", $"CveAlmacen = {Dr("CveAlmacen").ToString.ToEntero}").ToString = "Solo Existencia" Then Dr("CveAlmacen") = 0 + AlmacenSoloExistencia = True End If Dr.AcceptChanges() Next @@ -6296,7 +6290,6 @@ Partial Class Compras_Compras End If End If - If importeMN <> 0 Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMN, Referencia, 6, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveIE:=CveIE, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), TipoCambio:=tipoCambioActual, CveClasificacion:=RowDetalle("CveClasificacion").ToString().ToEntero(), CveSubProyecto:=RowDetalle("CveSubProyecto").ToString().ToEntero(), Contabilizable:=SeContabiliza) Then @@ -6317,15 +6310,14 @@ Partial Class Compras_Compras IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero End If End If - End If - - - If importeMN <> 0 Then 'Conta ContPAQ If IdCtaContable = 0 Then CuentasContablesInvalidas.Append("
" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", 68))("ConceptoContable").ToString) idCuentaContabilizacion = 0 End If + End If + + If importeMN <> 0 Then 'SI ES GASTO CON ALMACEN NO DEBE CONTABILIZAR CONCEPTO 68 If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMN, Referencia, 68, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveIE:=CveIE, CvePersonal:=CvePersonal, CveMovimientoAlmacen:=CveMovimientoInventario, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), TipoCambio:=tipoCambioActual, Contabilizable:=If(DdlTipoCompra.SelectedValue = "10", False, SeContabiliza)) Then @@ -6349,9 +6341,6 @@ Partial Class Compras_Compras importeMovimiento = 0 IdCtaContable = 0 - ''FLETES - 'If UsuarioActual.CveEmpresa.Contiene(119) And UsuarioActual.Empresa.UsaInventarios And DdlTipoComprobante.SelectedValue <> "NC" And Not UsuarioActual.Empresa.Funcionalidad(126) = "1" And CveConceptoContableAlmacen.Contiene(237, 240) Then - 'End If Dim CostoIndirectoAcum176 As Decimal = 0 'INV [MERCANCIA RECIBIDA POR ADELANTADO (OC) | MERCANCIA PENDIENTE POR RECIBIR (COMPRA) ] @@ -7047,7 +7036,6 @@ Partial Class Compras_Compras End If End If End If - End If Next @@ -7096,7 +7084,7 @@ Partial Class Compras_Compras Pago.CveIE = -1 Pago.CvePersonal = CvePersonal - ErrorPrepoliza = AplicaPrePolizaPago(CompraActual, Pago, CvePrePoliza, ObjConta) + ErrorPrepoliza = AplicaPrePolizaPagoCompra(CompraActual, Pago, CvePrePoliza, ObjConta) End If @@ -7250,7 +7238,7 @@ Partial Class Compras_Compras Pago.CveIE = Ant.CveIE Pago.CveMonedaPago = 1 - ErrorMovtosCxP = AplicaPrePolizaPago(CompraActual, Pago, CvePrePoliza, ObjConta) + ErrorMovtosCxP = AplicaPrePolizaPagoCompra(CompraActual, Pago, CvePrePoliza, ObjConta) End If @@ -7293,7 +7281,7 @@ Partial Class Compras_Compras Pago.TCPago = Ant.TCCompra Pago.CveMonedaPago = If(Ant.TCCompra > 1, 2, 1) - ErrorPrepoliza = AplicaPrePolizaPago(CompraActual, Pago, CvePrePoliza, ObjConta) + ErrorPrepoliza = AplicaPrePolizaPagoCompra(CompraActual, Pago, CvePrePoliza, ObjConta) End If @@ -7405,9 +7393,6 @@ Partial Class Compras_Compras End If End If - - - '' A N T I C I P O S If UsuarioActual.Empresa.UsaAC Then If ArrAnticipos.Count > 0 Then @@ -7475,7 +7460,6 @@ Partial Class Compras_Compras End If End If - '' F U N C I O N A R I O S Y E M P L E A D O S If RBLContado.SelectedValue = "2" AndAlso DdlFuncionarioEmpleado.SelectedValue.ToEntero > 0 Then TxtDocumentoImporte.Text = TxtDocumentoImporteFE.Text @@ -7489,25 +7473,20 @@ Partial Class Compras_Compras 'se agrego un movimiento de pago If CveIE > 0 Then - If ImporteCompra <> 0 Then 'inserto los movimientos de la conta para abonar al saldo Dim Pago As New CompraPago Pago.ImportePago = ImporteCompra Pago.CveIE = CveIE Pago.CveMonedaPago = 1 - - ErrorMovtosCxP = AplicaPrePolizaPago(CompraActual, Pago, CvePrePoliza, ObjConta) + ErrorMovtosCxP = AplicaPrePolizaPagoCompra(CompraActual, Pago, CvePrePoliza, ObjConta) End If - Else ErrorMovtosIE = True End If - End If - 'movimiento de compra '[IPP] PARCHE PROVISIONAL DE CLASIFICACION Y SUBPROYECTO [CveClasificacion:=TmpDT.FiltroPrimeroValor("CveClasificacion").ToString.ToEntero] [CveSubProyecto:=TmpDT.FiltroPrimeroValor("CveSubProyecto").ToString.ToEntero] If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimientoCompra, TxtSubTotal2.Text.ToDecimal, " ", CveConceptoCompra, " ", TxtFechaPago.Text.ToDate, 0, -1, CveClasificacion:=TmpDT.FiltroPrimeroValor("CveClasificacion").ToString.ToEntero, CveSubProyecto:=TmpDT.FiltroPrimeroValor("CveSubProyecto").ToString.ToEntero, CveCompra:=CveCompra, CveProveedor:=CveProveedorLocal, CveIE:=CveIE, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=TxtSubTotal2.Text.ToDecimal) Then @@ -7622,7 +7601,7 @@ Partial Class Compras_Compras Pago.CveCompraAmortizacion = CveCompraNC Pago.CveConceptoPago = CveConceptoPago - ErrorMovtosCxP = AplicaPrePolizaPago(CompraActual, Pago, CvePrePoliza, ObjConta) + ErrorMovtosCxP = AplicaPrePolizaPagoCompra(CompraActual, Pago, CvePrePoliza, ObjConta) Else ErrorMovtosCxP = True @@ -7730,7 +7709,7 @@ Partial Class Compras_Compras Pago.CveIE = CveIE Pago.CveMonedaPago = 1 - ErrorMovtosCxP = AplicaPrePolizaPago(CompraActual, Pago, CvePrePoliza, ObjConta) + ErrorMovtosCxP = AplicaPrePolizaPagoCompra(CompraActual, Pago, CvePrePoliza, ObjConta) Else ErrorMovtosCxP = True @@ -8983,16 +8962,6 @@ Partial Class Compras_Compras End If - '[IPP] COMENTADO PORQUE REUNIFICABA AMORTIZACIÓN NC 27/Agosto/2018 - 'If Not CompraUnificada Then - ' 'Unificacion de PrePolizas - ' If UsuarioActual.Empresa.Funcionalidad(219) = "1" Then - ' If Not ObjConta.PrePolizaUnificacion(gvr.DataKey("CvePrePoliza").ToEntero, CvePrepolizaPadre) Then - ' ErrorMovtosCxP = 1 - ' Alert("No se pudo unificar la prepoliza", TipoMensaje.MsgError) - ' End If - ' End If - 'End If End If Next @@ -9011,8 +8980,6 @@ Partial Class Compras_Compras ErrorMovtosCxP = 1 End If End If - - End If End If @@ -10055,17 +10022,17 @@ Partial Class Compras_Compras If UsuarioActual.Empresa.UsaInventarios AndAlso Not UsuarioActual.Empresa.Funcionalidad(126) = "1" And ConceptoContabilizacionAlmacen = 0 Then DT = TmpDT.FiltraParametros("ISNULL(TipoAF,0) <> 2 AND ISNULL(CveAlmacen,0) > 0", "", {"CveAlmacen"}) 'RECORREMOS PARA DETECTAR LA MODALIDAD DEL ALMACEN, EN CASO DE SER SOLO EXISTENCIA LIMPIAMOS CVEALMACEN - If DdlTipoCompra.SelectedValue <> "10" Then - For Each Dr As DataRow In DT.Rows - If DtAlmacenes.FiltroPrimeroValor("Modalidad", $"CveAlmacen = {Dr("CveAlmacen").ToString.ToEntero}").ToString = "Solo Existencia" Then - Dr("CveAlmacen") = 0 - End If - Dr.AcceptChanges() - Next - End If + + 'For Each Dr As DataRow In DT.Rows + ' If DtAlmacenes.FiltroPrimeroValor("Modalidad", $"CveAlmacen = {Dr("CveAlmacen").ToString.ToEntero}").ToString = "Solo Existencia" Then + ' Dr("CveAlmacen") = 0 + ' End If + ' Dr.AcceptChanges() + 'Next + DT.AcceptChanges() DT = DT.FiltraParametros("ISNULL(CveAlmacen,0) > 0") - If DT.Rows.Count > 0 AndAlso Not DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV", "Ant") Then + If (DT.Rows.Count > 0) AndAlso Not DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV", "Ant") Then For Each Row2 As DataRow In DT.Rows importeMovimiento = TmpDT.SUM("Total", $"CveAlmacen = {Row2("CveAlmacen")}").ToString.ToDecimal + TmpDT.SUM("CostoIndirectoAlmacen", $"CveAlmacen = {Row2("CveAlmacen")}").ToString.ToDecimal 'Row2("Total").ToString.ToDecimal + Row2("CostoIndirectoAlmacen").ToString.ToDecimal @@ -10186,17 +10153,10 @@ Partial Class Compras_Compras End If End If - ''SEGMENTO DE NEGOCIO - Dim IdSegmentoNegocio As Integer = -1 - 'Dim drT As DataRow = GlobalDTSubProyectos(-1, CveSubProyecto:=Row2("CveSubProyecto").ToString.ToEntero).FiltroPrimero(String.Format("CveSubProyecto = {0} ", Row2("CveSubProyecto").ToString.ToEntero)) - 'If drT IsNot Nothing Then - ' IdSegmentoNegocio = drT("IdSegNeg").ToString.ToEntero - 'End If - 'AGREGA MOVIMIENTO If importeMovimiento <> 0 AndAlso Not DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV", "Ant") Then Concepto = $"{NombreProveedor} {TxtSerie.Text} - {TxtFolio.Text}" - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 6, Concepto, FechaMovimiento, IdCtaContable, IdSegmentoNegocio, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveIE:=CveIE, CveCreditoDetalle:=CveCreditoDetalle, CveClasificacion:=Row2("CveClasificacion").ToString.ToEntero, CveSubProyecto:=Row2("CveSubProyecto").ToString.ToEntero, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveTipoGasto:=Row2("CveTipoGasto").ToString.ToEntero) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 6, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveIE:=CveIE, CveCreditoDetalle:=CveCreditoDetalle, CveClasificacion:=Row2("CveClasificacion").ToString.ToEntero, CveSubProyecto:=Row2("CveSubProyecto").ToString.ToEntero, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveTipoGasto:=Row2("CveTipoGasto").ToString.ToEntero) Then ErrorPrepoliza = True End If End If @@ -15027,7 +14987,7 @@ Partial Class Compras_Compras Dim Cont As Integer = 0 For Each gvr As GridViewRow In GvOC1.Rows - RegistraScript($"CalculaTotalOCEdit('{gvr.DataKey("PS").Replace("'", "")}', {gvr.DataKey("Cantidad").ToString.ToDouble}, {gvr.FCTextBox("TxtCantidad").ClientID}, {gvr.FCTextBox("TxtPU").ClientID}, {gvr.FCTextBox("TxtTotalOC1").ClientID}, {gvr.DataKey("IEPSPS").ToString.ToDouble},{gvr.FCHiddenField("HdnOC1IEPSImporte").ClientID}, {gvr.DataKey("IVA").ToString.ToDouble},{gvr.FCHiddenField("HdnOC1IVA").ClientID},{gvr.DataKey("RetIVA").ToString.ToDouble},{gvr.FCHiddenField("HdnOC1RetIVA").ClientID},{gvr.DataKey("RetISR").ToString.ToDouble},{gvr.FCHiddenField("HdnOC1RetISR").ClientID},{gvr.DataKey("IEPSPS").ToString.ToDouble},{gvr.FCHiddenField("HdnOC1IEPSIVA").ClientID},{gvr.DataKey("Descuento")},{gvr.FCHiddenField("HdnOC1Descuento").ClientID},{gvr.DataKey("IVAPorcentaje").ToString.ToDouble},{gvr.DataKey("RetIVAPorcentaje").ToString.ToDouble},{gvr.DataKey("RetISRPorcentaje").ToString.ToDouble},{gvr.DataKey("IEPSPSPorcentaje").ToString.ToDouble},{gvr.DataKey("IEPSPSIVAPorcentaje").ToString.ToDouble});", $"Gv{Cont}") + RegistraScript($"CalculaTotalOCEdit('{ gvr.DataKey("PS").Replace("'", "").Replace(vbLf, " ").Replace(vbCrLf, " ") }', {gvr.DataKey("Cantidad").ToString.ToDouble}, {gvr.FCTextBox("TxtCantidad").ClientID}, {gvr.FCTextBox("TxtPU").ClientID}, {gvr.FCTextBox("TxtTotalOC1").ClientID}, {gvr.DataKey("IEPSPS").ToString.ToDouble},{gvr.FCHiddenField("HdnOC1IEPSImporte").ClientID}, {gvr.DataKey("IVA").ToString.ToDouble},{gvr.FCHiddenField("HdnOC1IVA").ClientID},{gvr.DataKey("RetIVA").ToString.ToDouble},{gvr.FCHiddenField("HdnOC1RetIVA").ClientID},{gvr.DataKey("RetISR").ToString.ToDouble},{gvr.FCHiddenField("HdnOC1RetISR").ClientID},{gvr.DataKey("IEPSPS").ToString.ToDouble},{gvr.FCHiddenField("HdnOC1IEPSIVA").ClientID},{gvr.DataKey("Descuento")},{gvr.FCHiddenField("HdnOC1Descuento").ClientID},{gvr.DataKey("IVAPorcentaje").ToString.ToDouble},{gvr.DataKey("RetIVAPorcentaje").ToString.ToDouble},{gvr.DataKey("RetISRPorcentaje").ToString.ToDouble},{gvr.DataKey("IEPSPSPorcentaje").ToString.ToDouble},{gvr.DataKey("IEPSPSIVAPorcentaje").ToString.ToDouble});", $"Gv{Cont}") Cont += 1 Next @@ -15043,7 +15003,7 @@ Partial Class Compras_Compras Protected Sub GvOC1_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvOC1.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then - Dim JSCambiaScript = $"CalculaTotalOCEdit('{e.Row.DBCampo("PS").Replace("'", "")}', {e.Row.DBCampo("Cantidad").ToString.ToDouble}, {e.Row.FCTextBox("TxtCantidad").ClientID}, {e.Row.FCTextBox("TxtPU").ClientID}, {e.Row.FCTextBox("TxtTotalOC1").ClientID}, {e.Row.DBCampo("IEPSPS").ToString.ToDouble},{e.Row.FCHiddenField("HdnOC1IEPSImporte").ClientID}, {e.Row.DBCampo("IVA").ToString.ToDouble},{e.Row.FCHiddenField("HdnOC1IVA").ClientID},{e.Row.DBCampo("RetIVA").ToString.ToDouble},{e.Row.FCHiddenField("HdnOC1RetIVA").ClientID},{e.Row.DBCampo("RetISR").ToString.ToDouble},{e.Row.FCHiddenField("HdnOC1RetISR").ClientID},{e.Row.DBCampo("IEPSPS").ToString.ToDouble},{e.Row.FCHiddenField("HdnOC1IEPSIVA").ClientID},{e.Row.DBCampo("Descuento")},{e.Row.FCHiddenField("HdnOC1Descuento").ClientID},{e.Row.DBCampo("IVAPorcentaje").ToString.ToDouble},{e.Row.DBCampo("RetIVAPorcentaje").ToString.ToDouble},{e.Row.DBCampo("RetISRPorcentaje").ToString.ToDouble},{e.Row.DBCampo("IEPSPSPorcentaje").ToString.ToDouble},{e.Row.DBCampo("IEPSPSIVAPorcentaje").ToString.ToDouble});" + Dim JSCambiaScript = $"CalculaTotalOCEdit('{e.Row.DBCampo("PS").Replace("'", "").Replace(vbLf, " ").Replace(vbCrLf, " ")}', {e.Row.DBCampo("Cantidad").ToString.ToDouble}, {e.Row.FCTextBox("TxtCantidad").ClientID}, {e.Row.FCTextBox("TxtPU").ClientID}, {e.Row.FCTextBox("TxtTotalOC1").ClientID}, {e.Row.DBCampo("IEPSPS").ToString.ToDouble},{e.Row.FCHiddenField("HdnOC1IEPSImporte").ClientID}, {e.Row.DBCampo("IVA").ToString.ToDouble},{e.Row.FCHiddenField("HdnOC1IVA").ClientID},{e.Row.DBCampo("RetIVA").ToString.ToDouble},{e.Row.FCHiddenField("HdnOC1RetIVA").ClientID},{e.Row.DBCampo("RetISR").ToString.ToDouble},{e.Row.FCHiddenField("HdnOC1RetISR").ClientID},{e.Row.DBCampo("IEPSPS").ToString.ToDouble},{e.Row.FCHiddenField("HdnOC1IEPSIVA").ClientID},{e.Row.DBCampo("Descuento")},{e.Row.FCHiddenField("HdnOC1Descuento").ClientID},{e.Row.DBCampo("IVAPorcentaje").ToString.ToDouble},{e.Row.DBCampo("RetIVAPorcentaje").ToString.ToDouble},{e.Row.DBCampo("RetISRPorcentaje").ToString.ToDouble},{e.Row.DBCampo("IEPSPSPorcentaje").ToString.ToDouble},{e.Row.DBCampo("IEPSPSIVAPorcentaje").ToString.ToDouble});" e.Row.FCTextBox("TxtCantidad").Attributes.Add("onkeyup", $"LimitaCantidadOC({e.Row.DBCampo("CantidadPendienteVincular")}, this);{JSCambiaScript}") e.Row.FCTextBox("TxtPU").Attributes.Add("onkeyup", JSCambiaScript) diff --git a/Compras/ReembolsosComprobaciones.aspx.vb b/Compras/ReembolsosComprobaciones.aspx.vb index a682a10fd..103f9c9a0 100644 --- a/Compras/ReembolsosComprobaciones.aspx.vb +++ b/Compras/ReembolsosComprobaciones.aspx.vb @@ -113,6 +113,7 @@ Partial Class Compras_ReembolsosComprobaciones CveCuentaBancaria = -1 ViewState("CveMoneda") = 1 CveMonedaPago = 1 + TipoCambioPago = 1 Folio = "" 'Cargar Filtros @@ -376,7 +377,7 @@ Partial Class Compras_ReembolsosComprobaciones ChkOtrosIngresosCheque.Visible = True - If UsuarioActual.TienePermisoProceso(113) Then TrChequeExcedente.Visible = True + 'If UsuarioActual.TienePermisoProceso(113) Then TrChequeExcedente.Visible = True CargaDatos(DDlCheques.SelectedValue.ToEntero) @@ -392,7 +393,7 @@ Partial Class Compras_ReembolsosComprobaciones ChkOtrosIngresosCheque.Visible = False - If UsuarioActual.TienePermisoProceso(113) Then TableExpedirCheque.Visible = True + 'If UsuarioActual.TienePermisoProceso(113) Then TableExpedirCheque.Visible = True LimpiaDatos() @@ -547,7 +548,7 @@ Partial Class Compras_ReembolsosComprobaciones End If Else If drp IsNot Nothing Then - If drp("IdPoliza").ToString.ToEntero > 0 Then + If drp("FolioPoliza").ToString.ToEntero > 0 Then CvePrePolizaIERegistrado = ObjMov.AddPrePolizas("Compras/Comprobaciones2", 9, TxtImporteVinculado.Text.ToDecimal, TxtImporteVinculado.Text.ToDecimal, CveMoneda, TxtFechaPrePoliza.Text.ToDate, If(TxtObservaciones.Text.Trim = "", concepto, TxtObservaciones.Text.Trim), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) IdPoliza = drp("IdPoliza").ToString.ToEntero Else @@ -749,7 +750,7 @@ Partial Class Compras_ReembolsosComprobaciones End If End If - If AplicaPrePolizaPago(CompraActual, Pago, CvePrePolizaPago, ObjMov) Then + If AplicaPrePolizaPagoCompra(CompraActual, Pago, CvePrePolizaPago, ObjMov) Then MsgError = "Detalle" End If End If @@ -798,6 +799,7 @@ Partial Class Compras_ReembolsosComprobaciones CveIEPago = 0 Dim FolioIENew = ObjIE.GetNextFolio(CveCajaChica, 6).ToString CveIEPago = ObjIE.AddBancos_IE(CveCajaChica, 6, TxtFechaPrePoliza.Text.ToDate, FolioIENew, gvr.DataKey("Proveedor"), ImporteMovto, CveMoneda, 0.0, $"{gvr.DataKey("Proveedor")} F:{gvr.DataKey("SerieFolio")} {If(DdlPersonal.Visible, DdlPersonal.SelectedItem.Text, DdlCajaChica.SelectedItem.Text)}", "", False, True, -1, CvePrePolizaPago, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FueConciliado:=If(ChkReembolsarSinBancos.Checked Or CveCajaChica > 0, True, False)) + TipoCambioPago = 1 End If End If @@ -811,7 +813,7 @@ Partial Class Compras_ReembolsosComprobaciones MsgError = "no se pudo insertar el detalle de la poliza" End If - If Not AplicaPrePolizaPago(CompraActual, Pago, CvePrePolizaPago, ObjMov) Then + If Not AplicaPrePolizaPagoCompra(CompraActual, Pago, CvePrePolizaPago, ObjMov) Then MsgError = "Detalle" End If diff --git a/Contabilidad/PopUpAuxiliar.aspx.vb b/Contabilidad/PopUpAuxiliar.aspx.vb index b324091bd..250bd30f0 100644 --- a/Contabilidad/PopUpAuxiliar.aspx.vb +++ b/Contabilidad/PopUpAuxiliar.aspx.vb @@ -210,11 +210,11 @@ Partial Class PopUpAuxiliar e.Row.FCLiteral("LtlConcepto").Text = String.Format("{0}{1}", Liga, e.Row.DBCampo("ConceptoContable")) End If - If e.Row.DBCampo("CveConceptoContable").Contiene("91", "251") Then 'desaplicar NC + If e.Row.DBCampo("CveConceptoContable").Contiene("91", "251", "301") Then 'desaplicar NC e.Row.FCLinkButton("LnkDesAplicar").Visible = True e.Row.FCLinkButton("imgD").Visible = False - If e.Row.DBCampo("CveConceptoContable").Contiene("251") Then + If e.Row.DBCampo("CveConceptoContable").Contiene("251", "301") Then e.Row.FCLinkButton("LnkDesAplicar").CommandArgument = String.Format("{0}|{1}|{2}", e.Row.DBCampo("CvePrePoliza"), e.Row.DBCampo("CveVenta"), e.Row.DBCampo("CveVentaAmortizacion")) Else e.Row.FCLinkButton("LnkDesAplicar").CommandArgument = String.Format("{0}|{1}|{2}", e.Row.DBCampo("CvePrePoliza"), e.Row.DBCampo("CveVentaAmortizacion"), e.Row.DBCampo("CveVenta")) diff --git a/Contabilidad/RegPrePolizaS.aspx.vb b/Contabilidad/RegPrePolizaS.aspx.vb index af366386b..2b6a245a2 100644 --- a/Contabilidad/RegPrePolizaS.aspx.vb +++ b/Contabilidad/RegPrePolizaS.aspx.vb @@ -434,6 +434,10 @@ Partial Class ContabilidadC_RegPrePolizaS ' TxtEstatus.Text = If(Boolean.Parse(dr("Estatus").ToString), "Activa", "Inactiva") CvePlantillaPoliza = dr("CvePlantillaPoliza").ToString + If UsuarioActual.CveRol = 1 Then + TxtUsuarioElaboro.ToolTip = dr("Modulo").ToString + End If + If UsuarioActual.CveRol = 1 OrElse UsuarioActual.TienePermisoProceso(221) Then 'DivAgregarConceptos.Visible = True LnkAddConcepto.Visible = True @@ -2417,7 +2421,7 @@ Partial Class ContabilidadC_RegPrePolizaS End If TipoMov = GlobalDTTipoTransacciones.FiltroPrimeroValor("CveTipoTransaccion", String.Format("TipoTransaccion = '{0}' ", Row("TipoTransferencia"))).ToEntero - TipoNaturaleza = GlobalDTTipoTransacciones.FiltroPrimeroValor("Tipo", String.Format("TipoTransaccion = '{0}' ", Row("TipoTransferencia"))).ToEntero + TipoNaturaleza = GlobalDTTipoTransacciones.FiltroPrimeroValor("Tipo", String.Format("TipoTransaccion = '{0}' ", Row("TipoTransferencia"))) FolioExcel = Row("Folio").ToString.ToEntero CveTipoTransaccion = TipoMov @@ -2438,11 +2442,19 @@ Partial Class ContabilidadC_RegPrePolizaS Exit Sub End If - If Row("Abono").ToString.ToDecimal > 0 And TipoNaturaleza = "Ing" Or Row("Cargo").ToString.ToDecimal > 0 And TipoNaturaleza = "Egs" Then + + If Not (TipoNaturaleza = "Ing" And ((TipoMovto = False And ImporteDocumento >= 0) Or (TipoMovto = True And ImporteDocumento <= 0)) Or + TipoNaturaleza = "Egs" And ((TipoMovto = True And ImporteDocumento >= 0) Or (TipoMovto = False And ImporteDocumento <= 0))) Then Alert($"El movimiento con cuenta: {NombreCuenta} , importe: {ImporteDocumento.ToString("###,###,###.00")} (registro {ContadorRegistros}), no tiene la naturaleza correcta", TipoMensaje.MsgAdvertencia) Exit Sub + End If + 'If Row("Abono").ToString.ToDecimal > 0 And TipoNaturaleza = "Ing" Or Row("Cargo").ToString.ToDecimal > 0 And TipoNaturaleza = "Egs" Then + ' Alert($"El movimiento con cuenta: {NombreCuenta} , importe: {ImporteDocumento.ToString("###,###,###.00")} (registro {ContadorRegistros}), no tiene la naturaleza correcta", TipoMensaje.MsgAdvertencia) + ' Exit Sub + 'End If + End If If Row("Abono").ToString.ToDecimal > 0 And Row("Cargo").ToString.ToDecimal > 0 Then diff --git a/Contabilidad2/RepAnexoCatalogoAnual.aspx.vb b/Contabilidad2/RepAnexoCatalogoAnual.aspx.vb index a4fcaef1c..ef64e84a7 100644 --- a/Contabilidad2/RepAnexoCatalogoAnual.aspx.vb +++ b/Contabilidad2/RepAnexoCatalogoAnual.aspx.vb @@ -181,6 +181,11 @@ Partial Class Contabilidad2_RepAnexoCatalogoAnual Private Sub CargaDatos() + If CveCuenta <= -1 Then + Alert("No hay una cuenta expecificada.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + DTHeaders = New DataTable DTDatos = New DataTable diff --git a/Contabilidad2/RepSituacionFinanciera.aspx b/Contabilidad2/RepSituacionFinanciera.aspx index f44b3bb98..448192f6a 100644 --- a/Contabilidad2/RepSituacionFinanciera.aspx +++ b/Contabilidad2/RepSituacionFinanciera.aspx @@ -20,7 +20,7 @@ <%-- --%>
  • - Cerrar Ejercicio + Cerrar Ejercicio
  • @@ -603,8 +603,8 @@ -
    - +
    +
    diff --git a/Contabilidad2/RepSituacionFinanciera.aspx.vb b/Contabilidad2/RepSituacionFinanciera.aspx.vb index fb092acf1..ebb573ad5 100644 --- a/Contabilidad2/RepSituacionFinanciera.aspx.vb +++ b/Contabilidad2/RepSituacionFinanciera.aspx.vb @@ -173,6 +173,7 @@ Partial Class AC2_SituacionFinanciera DdlSubproyecto.DataSource = GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa, -1) DdlSubproyecto.DataBind() + If UsuarioActual.TienePermisoProceso(346) Then LnkCerrar.Visible = True 'DdlEjercicio.SelectedValueExist(UsuarioActual.Empresa.EjercicioActual.ToString) DdlPeriodo.SelectedValue = Now.Month.ToString diff --git a/Empresas/1/Formatos/Factura.rdlc b/Empresas/1/Formatos/Factura.rdlc index 677f609ca..a31ef96d2 100644 --- a/Empresas/1/Formatos/Factura.rdlc +++ b/Empresas/1/Formatos/Factura.rdlc @@ -3173,8 +3173,3379 @@ + + + + + + + 2.5cm + + + 2.5cm + + + 3.82884cm + + + 3.01563cm + + + 2.64663cm + + + 2.65875cm + + + 2.5cm + + + + + 0.46771cm + + + + + true + true + + + + + Calle + + + + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Numero Exterior + + + + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Colonia + + + + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Municipio + + + + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Estado + + + + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Pais + + + + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + CP + + + + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.41479cm + + + + + true + true + + + + + =Fields!Calle.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!NumeroExterior.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Colonia.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Municipio.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Estado.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Pais.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!CodigoPostal.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + + + + + After + + + + + + + CE_DT_Emisor + 2.41413cm + 0.10658cm + 0.8825cm + 19.64985cm + + + + + + + + + 1.19894cm + + + 2.31479cm + + + 2.19123cm + + + 2.5cm + + + 2.79104cm + + + 2.5cm + + + 2.5cm + + + 2.25801cm + + + 2.19045cm + + + + + 0.49417cm + + + + + true + true + + + + + Version + + + + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Motivo Traslado + + + + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Tipo Operacion + + + + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Clave De Pedimento + + + + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Certificado Origen + + + + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Incoterm + + + + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Sub Division + + + + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Tipo Cambio + + + + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Total + + + + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.41479cm + + + + + true + true + + + + + =Fields!Version.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!MotivoTraslado.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!TipoOperacion.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!ClaveDePedimento.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!CertificadoOrigen.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Incoterm.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Subdivision.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!TipoCambioUSD.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!TotalUSD.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + + + + + + + After + + + + + + + CE_DT_Cabecera + 0.75784cm + 0.07193cm + 0.90896cm + 20.44446cm + 1 + + + + + + + + + 2.5cm + + + 3.13031cm + + + 2.5cm + + + 2.5cm + + + 3.31794cm + + + 2.5cm + + + + + 0.41479cm + + + + + true + true + + + + + No Identificacion + + + + + + + Black + + + + Black + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Fraccion Arancelaria + + + + + + + Black + + + + Black + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Cantidad Aduana + + + + + + + Black + + + + Black + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Unidad Aduana + + + + + + + Black + + + + Black + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Valor Unitario Aduana + + + + + + + Black + + + + Black + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Valor Dolares + + + + + + + Black + + + + Black + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.38834cm + + + + + true + true + + + + + =Fields!NoIdentificacion.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!FraccionArancelaria.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!CantidadAduana.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!UnidadAduana.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!ValorUnitarioAduana.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!ValorDolares.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + + + + After + + + + + + + CE_DT_Mercancias + 6.856cm + 0.10658cm + 0.80313cm + 16.44825cm + 2 + + + + + + + + true + true + + + + + Dirección Emisor + + + + + + + Textbox16 + 0.46316cm + 19.64985cm + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + true + 1.90158cm + 0.10658cm + 0.46316cm + 19.64985cm + 3 + + + + + + + + + 2.5cm + + + 2.5cm + + + 3.82884cm + + + 3.01563cm + + + 2.64663cm + + + 2.65875cm + + + 2.5cm + + + + + 0.41479cm + + + + + true + true + + + + + Calle + + + + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Numero Exterior + + + + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Colonia + + + + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Municipio + + + + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Estado + + + + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Pais + + + + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + CP + + + + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.41479cm + + + + + true + true + + + + + =Fields!Calle.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!NumeroExterior.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Colonia.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Municipio.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Estado.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Pais.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!CodigoPostal.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + + + + + After + + + + + + + CE_DT_Receptor + 3.9195cm + 0.10658cm + 0.82958cm + 19.64985cm + 4 + + + + + + + + true + true + + + + + Dirección Receptor + + + + + + + Textbox16 + 0.46316cm + 19.64985cm + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + true + 3.40695cm + 0.10658cm + 0.46316cm + 19.64985cm + 5 + + + + + + + + + 2.5cm + + + 2.5cm + + + 3.82884cm + + + 3.01563cm + + + 2.64663cm + + + 2.65875cm + + + 2.5cm + + + + + 0.46771cm + + + + + true + true + + + + + Calle + + + + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Numero Exterior + + + + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Colonia + + + + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Municipio + + + + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Estado + + + + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + Pais + + + + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + CP + + + + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + + + + + 0.41479cm + + + + + true + true + + + + + =Fields!Calle.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!NumeroExterior.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Colonia.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Municipio.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Estado.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!Pais.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + true + true + + + + + =Fields!CodigoPostal.Value + + + + + + 2pt + 2pt + 2pt + 2pt + + + + + + + + + + + + + + + + + + + + + + + After + + + + + + + CE_DT_Destinatario + 5.36923cm + 0.10658cm + 0.8825cm + 19.64985cm + 6 + + + + + + + + true + true + + + + + Dirección Destinatario + + + + + + + Textbox16 + 0.46316cm + 19.64985cm + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + true + 4.85668cm + 0.10658cm + 0.46316cm + 19.64985cm + 7 + + + + + + true + true + + + + + Complemento Comercio Exterior + + + + + + + Textbox16 + 0.07193cm + 0.72256cm + 20.37753cm + 8 + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + true + true + + + + + Mercancia + + + + + + + Textbox16 + 6.39284cm + 0.10658cm + 0.46316cm + 16.44825cm + 9 + + + + Black + + + + Black + + + White + 2pt + 2pt + 2pt + 2pt + + + + true + 16.99253cm + 7.7575cm + 20.51639cm + 47 + + = IIF( LEN(Parameters!CETipoOperacion.Value) > 0, False, True) + + + + + - 16.79496cm + 24.75003cm + + + + + + Textbox22 + + + #c4d79b + 2pt + 2pt + 2pt + 2pt + + + + @@ -1847,6 +1890,44 @@ + + + + true + true + + + + + =Fields!CodigoObjetoImpuesto.Value + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + @@ -2049,7 +2130,7 @@ - 4.44265cm + 3.47821cm @@ -2195,7 +2276,7 @@ - 6.28682cm + 4.82589cm @@ -2337,6 +2418,44 @@ + + + + true + true + + + + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + @@ -2598,6 +2717,42 @@ + + + + true + true + + + + + + + + + + + + + + 2pt + 2pt + 2pt + 2pt + + + + @@ -2683,6 +2838,7 @@ + @@ -2708,7 +2864,7 @@ 4.14415cm 0.11516cm 2.29418cm - 19.97108cm + 19.94648cm 11 - - - - - - #eb831f - - 1pt - - - #eb831f - - 1pt - - - #eb831f - - 1pt - - - #eb831f - - 1pt - - #eb831f - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - - - - - - - - #eb831f - - 1pt - - - #eb831f - - 1pt - - - #eb831f - - 1pt - - - #eb831f - - 1pt - - #eb831f - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - - - - - - - - #eb831f - - 1pt - - - #eb831f - - 1pt - - - #eb831f - - 1pt - - - #eb831f - - 1pt - - #eb831f - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - - - - - - - - Textbox23 - - - - #eb831f - - 1pt - - - #eb831f - - 1pt - - - #eb831f - - 1pt - - - #eb831f - - 1pt - - #eb831f - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - - - - - - - - Textbox33 - - - - #eb831f - - 1pt - - - #eb831f - - 1pt - - - #eb831f - - 1pt - - - #eb831f - - 1pt - - #eb831f - 2pt - 2pt - 2pt - 2pt - - - - - - @@ -889,12 +610,11 @@ - DataSet2 3.16535cm - 1.17062cm + 0.98541cm 20.53564cm + 4 + + + @@ -1108,64 +838,6 @@ - - - - true - true - - - - - Método Pago - - - - - - - Textbox13 - - - - #eb831f - - 1pt - - - #eb831f - - 1pt - - - #eb831f - - 1pt - - - #eb831f - - 1pt - - #eb831f - 2pt - 2pt - 2pt - 2pt - - - - @@ -1454,8 +1126,12 @@ 2pt + 4 + + + @@ -1562,59 +1238,6 @@ - - - - true - true - - - - - =Fields!MetodoDePagoDR.Value - - - - - - - #eb831f - - 1pt - - - #eb831f - - 1pt - - - #eb831f - - 1pt - - - #eb831f - - 1pt - - 2pt - 2pt - 2pt - 2pt - - - - @@ -1833,6 +1456,2345 @@ + + 0.23979cm + + + + + true + true + + + + + Impuesto + + + + + + + Textbox108 + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Tra001BaseDR.Value > 0 Or Fields!Tra002BaseDR.Value > 0 Or Fields!Tra003BaseDR.Value > 0 Or Fields!Ret001BaseDR.Value > 0 Or Fields!Ret002BaseDR.Value > 0 Or Fields!Ret003BaseDR.Value > 0, False, True) + + + + + #eb831f + + Top + + + + + + + + true + true + + + + + Tipo + + + + + + + Textbox109 + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Tra001BaseDR.Value > 0 Or Fields!Tra002BaseDR.Value > 0 Or Fields!Tra003BaseDR.Value > 0 Or Fields!Ret001BaseDR.Value > 0 Or Fields!Ret002BaseDR.Value > 0 Or Fields!Ret003BaseDR.Value > 0, False, True) + + + + Top + + + + + + + + true + true + + + + + Base + + + + + + + Textbox110 + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Tra001BaseDR.Value > 0 Or Fields!Tra002BaseDR.Value > 0 Or Fields!Tra003BaseDR.Value > 0 Or Fields!Ret001BaseDR.Value > 0 Or Fields!Ret002BaseDR.Value > 0 Or Fields!Ret003BaseDR.Value > 0, False, True) + + + + Top + + + + + + + + true + true + + + + + Tipo Factor + + + + + + + Textbox111 + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Tra001BaseDR.Value > 0 Or Fields!Tra002BaseDR.Value > 0 Or Fields!Tra003BaseDR.Value > 0 Or Fields!Ret001BaseDR.Value > 0 Or Fields!Ret002BaseDR.Value > 0 Or Fields!Ret003BaseDR.Value > 0, False, True) + + + + Top + + + + + + + + true + true + + + + + Tasa/Cuota + + + + + + + Textbox112 + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Tra001BaseDR.Value > 0 Or Fields!Tra002BaseDR.Value > 0 Or Fields!Tra003BaseDR.Value > 0 Or Fields!Ret001BaseDR.Value > 0 Or Fields!Ret002BaseDR.Value > 0 Or Fields!Ret003BaseDR.Value > 0, False, True) + + + + Top + + + + + + + + true + true + + + + + Importe + + + + + + + Textbox113 + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Tra001BaseDR.Value > 0 Or Fields!Tra002BaseDR.Value > 0 Or Fields!Tra003BaseDR.Value > 0 Or Fields!Ret001BaseDR.Value > 0 Or Fields!Ret002BaseDR.Value > 0 Or Fields!Ret003BaseDR.Value > 0, False, True) + + + + Top + + + + + + + + true + true + + + + + + + + + + + + #eb831f + + 1pt + + + White + + 1pt + + + White + + 1pt + + + #eb831f + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + 4 + + + + + + + + + 0.07938cm + + + + + true + true + + + + + ISR + + + + + + + Textbox61 + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Tra001BaseDR.Value > 0, False, True) + + + + + + + + + + + #eb831f + + + + + + + + + + + + + true + true + + + + + Traslado + + + + + + + Textbox204 + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Tra001BaseDR.Value > 0, False, True) + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + =Fields!ImpPagado.Value + + + + + + + ImpPagado + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Tra001BaseDR.Value > 0, False, True) + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + =Fields!Tra001TipoFactorDR.Value + + + + + + + ImpPagado + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Tra001BaseDR.Value > 0, False, True) + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + =Fields!Tra001TasaOCuotaDR.Value + + + + + + + ImpPagado + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Tra001BaseDR.Value > 0, False, True) + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + =Fields!Tra001ImporteDR.Value + + + + + + + ImpPagado + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Tra001BaseDR.Value > 0, False, True) + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + + + + + + + + White + + 1pt + + + #eb831f + + 1pt + + + White + + 1pt + + + #eb831f + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + 4 + + + + + + + + + 0.07938cm + + + + + true + true + + + + + IVA + + + + + + + Textbox61 + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Tra002BaseDR.Value > 0, False, True) + + + + + + + + + + + #eb831f + + + + + + + + + + + + + true + true + + + + + Traslado + + + + + + + Textbox204 + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Tra002BaseDR.Value > 0, False, True) + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + =Fields!ImpPagado.Value + + + + + + + ImpPagado + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Tra002BaseDR.Value > 0, False, True) + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + =Fields!Tra002TipoFactorDR.Value + + + + + + + ImpPagado + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Tra002BaseDR.Value > 0, False, True) + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + =Fields!Tra002TasaOCuotaDR.Value + + + + + + + ImpPagado + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Tra002BaseDR.Value > 0, False, True) + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + =Fields!Tra002ImporteDR.Value + + + + + + + ImpPagado + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Tra002BaseDR.Value > 0, False, True) + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + + + + + + + + White + + 1pt + + + #eb831f + + 1pt + + + White + + 1pt + + + #eb831f + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + 4 + + + + + + + + + 0.07938cm + + + + + true + true + + + + + IEPS + + + + + + + Textbox61 + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Tra003BaseDR.Value > 0, False, True) + + + + + + + + + + + #eb831f + + + + + + + + + + + + + true + true + + + + + Traslado + + + + + + + Textbox204 + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Tra003BaseDR.Value > 0, False, True) + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + =Fields!ImpPagado.Value + + + + + + + ImpPagado + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Tra003BaseDR.Value > 0, False, True) + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + =Fields!Tra003TipoFactorDR.Value + + + + + + + ImpPagado + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Tra003BaseDR.Value > 0, False, True) + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + =Fields!Tra003TasaOCuotaDR.Value + + + + + + + ImpPagado + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Tra003BaseDR.Value > 0, False, True) + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + =Fields!Tra003ImporteDR.Value + + + + + + + ImpPagado + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Tra003BaseDR.Value > 0, False, True) + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + + + + + + + + White + + 1pt + + + #eb831f + + 1pt + + + White + + 1pt + + + #eb831f + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + 4 + + + + + + + + + 0.07938cm + + + + + true + true + + + + + ISR + + + + + + + Textbox61 + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Ret001BaseDR.Value > 0, False, True) + + + + + + + + + + + #eb831f + + + + + + + + + + + + + true + true + + + + + Retención + + + + + + + Textbox207 + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Ret001BaseDR.Value > 0, False, True) + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + =Fields!ImpPagado.Value + + + + + + + ImpPagado + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Ret001BaseDR.Value > 0, False, True) + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + =Fields!Ret001TipoFactorDR.Value + + + + + + + ImpPagado + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Ret001BaseDR.Value > 0, False, True) + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + =Fields!Ret001TasaOCuotaDR.Value + + + + + + + ImpPagado + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Ret001BaseDR.Value > 0, False, True) + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + =Fields!Ret001ImporteDR.Value + + + + + + + ImpPagado + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Ret001BaseDR.Value > 0, False, True) + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + + + + + + + + White + + 1pt + + + #eb831f + + 1pt + + + White + + 1pt + + + #eb831f + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + 4 + + + + + + + + + 0.07938cm + + + + + true + true + + + + + IVA + + + + + + + Textbox61 + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Ret002BaseDR.Value > 0, False, True) + + + + + + + + + + + #eb831f + + + + + + + + + + + + + true + true + + + + + Retención + + + + + + + Textbox207 + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Ret002BaseDR.Value > 0, False, True) + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + =Fields!ImpPagado.Value + + + + + + + ImpPagado + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Ret002BaseDR.Value > 0, False, True) + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + =Fields!Ret002TipoFactorDR.Value + + + + + + + ImpPagado + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Ret002BaseDR.Value > 0, False, True) + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + =Fields!Ret002TasaOCuotaDR.Value + + + + + + + ImpPagado + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Ret002BaseDR.Value > 0, False, True) + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + =Fields!Ret002ImporteDR.Value + + + + + + + ImpPagado + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Ret002BaseDR.Value > 0, False, True) + + + + + + + + + + + + + + + + + + + + + + + true + true + + + + + + + + + + + + White + + 1pt + + + #eb831f + + 1pt + + + White + + 1pt + + + #eb831f + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + 4 + + + + + + + + + 0.09729cm + + + + + true + true + + + + + IEPS + + + + + + + Textbox59 + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Ret003BaseDR.Value > 0, False, True) + + + + + White + + + + #eb831f + + + + #eb831f + + + + White + + + + + + + + + + true + true + + + + + Retención + + + + + + + Textbox207 + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Ret003BaseDR.Value > 0, False, True) + + + + + White + + + + #eb831f + + + + White + + + + White + + + + + + + + + + true + true + + + + + =Fields!ImpPagado.Value + + + + + + + ImpPagado + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Ret003BaseDR.Value > 0, False, True) + + + + + White + + + + #eb831f + + + + White + + + + White + + + + + + + + + + true + true + + + + + =Fields!Ret003TipoFactorDR.Value + + + + + + + ImpPagado + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Ret003BaseDR.Value > 0, False, True) + + + + + White + + + + #eb831f + + + + White + + + + White + + + + + + + + + + true + true + + + + + =Fields!Ret003TasaOCuotaDR.Value + + + + + + + ImpPagado + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Ret003BaseDR.Value > 0, False, True) + + + + + White + + + + #eb831f + + + + White + + + + White + + + + + + + + + + true + true + + + + + =Fields!Ret003ImporteDR.Value + + + + + + + ImpPagado + + =Microsoft.VisualBasic.Interaction.IIF(Fields!Ret003BaseDR.Value > 0, False, True) + + + + + White + + + + #eb831f + + + + White + + + + White + + + es-MX + + + + + + + + true + true + + + + + + + + + + + + White + + 1pt + + + #eb831f + + 1pt + + + White + + 1pt + + + #eb831f + + 1pt + + 2pt + 2pt + 2pt + 2pt + + + 4 + + + + + + + @@ -1845,6 +3807,8 @@ + + @@ -1854,12 +3818,22 @@ + + + + + + + + + + DataSet2 - 5.05cm - 1.09cm + 4.8595cm + 1.82398cm 20.5314cm 1 - 16.1771cm + 16.43651cm @@ -4070,7 +6043,7 @@ FitProportional 0.10737cm 1.5776cm - 2.88998cm + 2.74887cm 2.5499cm 4 - 0.84667cm + 0.41981cm true true @@ -4279,7 +6252,6 @@ Textbox35 - 0.17639cm 17.56289cm 0.41981cm 2.94979cm @@ -4326,7 +6298,6 @@ Textbox29 - 0.21343cm 0.01844cm 0.41981cm 6.8491cm @@ -4375,7 +6346,6 @@ Textbox31 - 0.21343cm 9.17244cm 0.41981cm 6.02198cm @@ -4510,6 +6480,134 @@ TipoCambioDR System.String + + RetIVA + System.Float + + + RetISR + System.Float + + + Tra001ImpuestoDR + System.String + + + Tra001TipoFactorDR + System.String + + + Tra001TasaOCuotaDR + System.String + + + Tra001ImporteDR + System.Float + + + Tra002ImpuestoDR + System.String + + + Tra002TipoFactorDR + System.String + + + Tra002TasaOCuotaDR + System.String + + + Tra002ImporteDR + System.Float + + + Tra003ImpuestoDR + System.String + + + Tra003TipoFactorDR + System.String + + + Tra003TasaOCuotaDR + System.String + + + Tra003ImporteDR + System.Float + + + Ret001ImpuestoDR + System.String + + + Ret001TipoFactorDR + System.String + + + Ret001TasaOCuotaDR + System.String + + + Ret001ImporteDR + System.Float + + + Ret002ImpuestoDR + System.String + + + Ret002TipoFactorDR + System.String + + + Ret002TasaOCuotaDR + System.String + + + Ret002ImporteDR + System.Float + + + Ret003ImpuestoDR + System.String + + + Ret003TipoFactorDR + System.String + + + Ret003TasaOCuotaDR + System.String + + + Ret003ImporteDR + System.Float + + + Tra001BaseDR + System.Float + + + Tra002BaseDR + System.Float + + + Tra003BaseDR + System.Float + + + Ret001BaseDR + System.Float + + + Ret002BaseDR + System.Float + + + Ret003BaseDR + System.Float + DataSet @@ -4816,6 +6914,18 @@ true ReportParameter1 + + String + true + true + ReportParameter1 + + + String + true + true + ReportParameter1 + diff --git a/General/SaldosIniciales.aspx.vb b/General/SaldosIniciales.aspx.vb index b0ec4c360..74362e4c2 100644 --- a/General/SaldosIniciales.aspx.vb +++ b/General/SaldosIniciales.aspx.vb @@ -1559,38 +1559,42 @@ Partial Class General_SaldosIniciales For Each Row As DataRow In dt.Rows - NombreCuenta = Row("NombreCuenta").ToString - CuentaPadre = Row("CuentaPadre").ToString - Dim Cuenta As String = Row("Cuenta").ToString - Dim TipoCuenta As String = Row("TipoCuenta").ToString - Dim AgrupadorSAT As String = Row("AgrupadorSAT").ToString - Dim CveCuentaPadre As Integer = -1 - Dim CveAgrupadorSAT As Integer = If(AgrupadorSAT = "0", -1, AgrupadoresSAT.FiltroPrimeroValor("CveAgrupadorSAT", String.Format("CodigoNombre LIKE '%{0}%'", AgrupadorSAT)).ToEntero) + Dim Cuenta As String = Row("Cuenta").ToString.Trim + If Cuenta <> "" Then + NombreCuenta = Row("NombreCuenta").ToString.Trim + CuentaPadre = Row("CuentaPadre").ToString.Trim - If Not CuentaPadre = "" Then - If ObjConta.GetCuentas(-1, CuentaPadre.Replace("-", ""), -1, UsuarioActual.CveEmpresa) Then - If ObjConta.DtResultados.Rows.Count > 0 Then - CveCuentaPadre = ObjConta.DtResultados().FiltroPrimeroValor("Id").ToEntero + Dim TipoCuenta As String = Row("TipoCuenta").ToString.Trim + Dim AgrupadorSAT As String = Row("AgrupadorSAT").ToString.Trim + Dim CveCuentaPadre As Integer = -1 + Dim CveAgrupadorSAT As Integer = If(AgrupadorSAT = "0", -1, AgrupadoresSAT.FiltroPrimeroValor("CveAgrupadorSAT", String.Format("CodigoNombre LIKE '%{0}%'", AgrupadorSAT)).ToEntero) + + If Not CuentaPadre = "" Then + If ObjConta.GetCuentas(-1, CuentaPadre.Replace("-", ""), -1, UsuarioActual.CveEmpresa) Then + If ObjConta.DtResultados.Rows.Count > 0 Then + CveCuentaPadre = ObjConta.DtResultados().FiltroPrimeroValor("Id").ToEntero + Else + TieneError = True + Exit For + End If Else TieneError = True Exit For End If + Else + CveCuentaPadre = -2 + End If + + Dim IdNew = ObjConta.AddCuenta(CveCuentaPadre, Cuenta.Replace("-", ""), NombreCuenta, TipoCuenta, 1, 1, CveEmpresaParam:=UsuarioActual.CveEmpresa, CveAgrupadorSAT:=CveAgrupadorSAT) + If IdNew > 0 Then + ContadorUpdate = ContadorUpdate + 1 Else TieneError = True + ContadorError = ContadorError + 1 Exit For End If - Else - CveCuentaPadre = -2 End If - Dim IdNew = ObjConta.AddCuenta(CveCuentaPadre, Cuenta.Replace("-", ""), NombreCuenta, TipoCuenta, 1, 1, CveEmpresaParam:=UsuarioActual.CveEmpresa, CveAgrupadorSAT:=CveAgrupadorSAT) - If IdNew > 0 Then - ContadorUpdate = ContadorUpdate + 1 - Else - TieneError = True - ContadorError = ContadorError + 1 - Exit For - End If Next Else Alert("No se tienen asociados Agrupadores para esta empresa") @@ -1598,12 +1602,12 @@ Partial Class General_SaldosIniciales End If If Not TieneError Then ObjConta.Commit() + Alert($"Se agregaron {ContadorUpdate} Cuentas Correctamente y se omitieron: {ContadorError} cuentas.") Else Alert($"No pudimos agregar la cuenta en ContaSIG: {NombreCuenta} - Cuenta Padre: {CuentaPadre}", TipoMensaje.MsgError) ObjConta.RollBack() End If - Alert($"Se agregaron {ContadorUpdate} Cuentas Correctamente y se omitieron: {ContadorError} cuentas.") Catch ex As Exception ObjConta.RollBack() diff --git a/Inicio.aspx.vb b/Inicio.aspx.vb index 0c46cefdd..971d81b2e 100644 --- a/Inicio.aspx.vb +++ b/Inicio.aspx.vb @@ -357,7 +357,7 @@ Partial Class Inicio Dim ObjInventarios As New ClsInventarios - If ObjInventarios.RepCompuestosVigencia(-1, -1, MinFecha, Now.AddDays(30), 1, UsuarioActual.CveEmpresa, True) Then + If ObjInventarios.RepCompuestosVigencia(-1, -1, MinFecha, Now.AddYears(1), 1, UsuarioActual.CveEmpresa, -1, UsuarioActual.CveUsuario, True) Then If ObjInventarios.DtResultados.Rows.Count > 0 Then GvModalRSCOPorCaducar.DataSource = ObjInventarios.DtResultados diff --git a/Inventarios/EntradasSalidas.aspx.vb b/Inventarios/EntradasSalidas.aspx.vb index c57e02d42..5cb82bd97 100644 --- a/Inventarios/EntradasSalidas.aspx.vb +++ b/Inventarios/EntradasSalidas.aspx.vb @@ -1411,12 +1411,6 @@ Partial Class Inventarios_EntradasSalidas tCveSubProyecto = drA2("CveSubProyecto").ToString.ToEntero End If - If UsuarioActual.CveEmpresa = 119 AndAlso Not tCveSubProyecto.ToString.Contiene(UsuarioActual.Empresa.Funcionalidad(347).Split(","c)) Then - FechaCaducidadVal = MinFecha - FechaCaducidad = MinFecha - Lote = "" - End If - 'salida If Valido AndAlso DdlConcepto.SelectedValue.Contiene({"3", "5", "7", "8", "11", "12", "13", "15", "16", "17", "20", "21", "30", "31"}) Then ' salida de almacen @@ -4682,11 +4676,6 @@ Partial Class Inventarios_EntradasSalidas Dim CveSubProyectoAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=DdlAlmacenInventarioFisico.SelectedValue.ToEntero).FiltroPrimeroValor("CveSubProyecto").ToString.ToEntero - If UsuarioActual.CveEmpresa = 119 AndAlso Not CveSubProyectoAlmacen.ToString.Contiene(UsuarioActual.Empresa.Funcionalidad(347).Split(","c)) Then - AplicaLote = False - AplicaCaducidad = False - End If - 'activa seccion ThSeccionEntrada.Visible = AplicaSeccion TrSeccionEntrada.Visible = AplicaSeccion @@ -4724,10 +4713,6 @@ Partial Class Inventarios_EntradasSalidas Dim CveSubProyectoAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=DdlAlmacenInventarioFisico.SelectedValue.ToEntero).FiltroPrimeroValor("CveSubProyecto").ToString.ToEntero - If UsuarioActual.CveEmpresa = 119 AndAlso Not CveSubProyectoAlmacen.ToString.Contiene(UsuarioActual.Empresa.Funcionalidad(347).Split(","c)) Then - AplicaLote = False - AplicaCaducidad = False - End If 'activa seccion ThSeccionSalida.Visible = AplicaSeccion TrSeccionSalida.Visible = AplicaSeccion diff --git a/Inventarios/EntregaAlmacen.aspx b/Inventarios/EntregaAlmacen.aspx index f9af8792f..d23155cc2 100644 --- a/Inventarios/EntregaAlmacen.aspx +++ b/Inventarios/EntregaAlmacen.aspx @@ -66,40 +66,10 @@
    • Cliente: - - - - - - - - - - - - - - - <%----%>
    • Serie-Folio: - - - - - - - - - - - - - - - @@ -108,25 +78,17 @@
    - <%----%> +
    - - -
    -
    <%--DATOS DE LA VENTA--%> @@ -556,7 +518,7 @@ <%--GV DATOS--%> + DataKeyNames="Consec,CvePS,Codigo,CodigoBarras,CveUM,CantidadC,CantidadF,UM,PS,CveClasificacion,CveCategoria,CveVentaDetalle,CveTamaño,AplicaSeccion, AplicaSerie,AplicaLote,AplicaCaducidad" HeaderStyle-CssClass="Titulos" CssClass="table table-striped table-hover Widthall ScrollAD gvInventario mysmallbtn" data-heighterror="450" data-freezerows="1" GridLines="None"> diff --git a/Inventarios/EntregaAlmacen.aspx.vb b/Inventarios/EntregaAlmacen.aspx.vb index 66162fb19..f4b716677 100644 --- a/Inventarios/EntregaAlmacen.aspx.vb +++ b/Inventarios/EntregaAlmacen.aspx.vb @@ -269,14 +269,6 @@ Partial Class Inventarios_EntregaAlmacen End Set End Property - Private Property ValidaLoteCaducidad As Boolean - Get - Return CType(ViewState("ValidaLoteCaducidad"), Boolean) - End Get - Set(value As Boolean) - ViewState("ValidaLoteCaducidad") = value - End Set - End Property #End Region @@ -606,7 +598,7 @@ Partial Class Inventarios_EntregaAlmacen CveContrato = drE("CveContrato").ToString().ToEntero() CveVendedor = drE("CveVendedor").ToString().ToEntero() CveCliente = drE("CveCliente").ToString().ToEntero() - ClienteEntregaPersonal(CveCliente) + 'ClienteEntregaPersonal(CveCliente) CveSubProyecto = drE("CveSubProyecto").ToString().ToEntero() EsInterno = CBool(DtDatos.Rows(0)("EsInterno").ToString()) CveDireccionEnvio = drE("CveDireccionEnvio").ToString.ToEntero @@ -665,17 +657,6 @@ Partial Class Inventarios_EntregaAlmacen End If End If - If UsuarioActual.CveEmpresa = 119 Then - Dim CveSubProyectoAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=CveAlmacen).FiltroPrimeroValor("CveSubProyecto", "").ToEntero - - If CveSubProyectoAlmacen.ToString.Contiene(UsuarioActual.Empresa.Funcionalidad(347).Split(","c)) Then - ValidaLoteCaducidad = True - Else - ValidaLoteCaducidad = False - End If - - End If - If Not DtDatos.Columns.Contains("Serie") Then DtDatos.Columns.Add("Serie", GetType(String)) If Not DtDatos.Columns.Contains("Lote") Then DtDatos.Columns.Add("Lote", GetType(String)) @@ -957,7 +938,6 @@ Partial Class Inventarios_EntregaAlmacen e.Row.FCTextBox("TbCantidadF").Text = "0" End If - If TipoDocto = "DPe" Then CveConsecSerie = e.Row.DBCampo("Consec").ToString().ToEntero() PSSerie = e.Row.DBCampo("PS").ToString() @@ -995,52 +975,41 @@ Partial Class Inventarios_EntregaAlmacen e.Row.FCDropDownList("DdlSeccionAlmacen").Visible = True If DdlAlmacen.SelectedValue.ToEntero() > 0 Then CargaSeccionesAlmacen(e.Row.FCDropDownList("DdlSeccionAlmacen"), DdlAlmacen.SelectedValue.ToEntero(), e.Row.DBCampo("CvePS").ToEntero(), UsuarioActual.CveEmpresa, True) - 'Dim dtt As DataTable = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero(), e.Row.DBCampo("CvePS").ToEntero()) - 'e.Row.FCDropDownList("DdlSeccionAlmacen").DataSource = dtt - 'e.Row.FCDropDownList("DdlSeccionAlmacen").DataBind() - 'If dtt.Rows.Count > 1 Then - ' e.Row.FCDropDownList("DdlSeccionAlmacen").Items.Insert(0, New ListItem("Seleccione", "-1")) - 'End If - 'dtt.Dispose() End If - Else e.Row.FCDropDownList("DdlSeccionAlmacen").Visible = False End If - If (ValidaLoteCaducidad) OrElse (UsuarioActual.CveEmpresa <> 119) Then - If CBool(e.Row.DBCampo("AplicaCaducidad")) Then - e.Row.FCTextBox("TxtCaducidad").Visible = True - e.Row.FCLinkButton("LnkCaducidad").Visible = True - e.Row.FCTextBox("TxtCaducidad").ReadOnly = True - CType(e.Row.FindControl("RFVCaducidad"), RequiredFieldValidator).Enabled = False + If CBool(e.Row.DBCampo("AplicaCaducidad")) Then + e.Row.FCTextBox("TxtCaducidad").Visible = True + e.Row.FCLinkButton("LnkCaducidad").Visible = True + e.Row.FCTextBox("TxtCaducidad").ReadOnly = True + CType(e.Row.FindControl("RFVCaducidad"), RequiredFieldValidator).Enabled = False - 'si aplica caducidad y viene vacía (posible por venta anterior), que se active su registro - If e.Row.FCTextBox("TxtCaducidad").Text = "" OrElse e.Row.FCTextBox("TxtCaducidad").Text.ToDate <= MinFecha Then - e.Row.FCTextBox("TxtCaducidad").ReadOnly = False - CType(e.Row.FindControl("RFVCaducidad"), RequiredFieldValidator).Enabled = True - e.Row.FCTextBox("TxtCaducidad").Enabled = True - End If - Else - e.Row.FCTextBox("TxtCaducidad").Visible = False - e.Row.FCLinkButton("LnkCaducidad").Visible = False + 'si aplica caducidad y viene vacía (posible por venta anterior), que se active su registro + If e.Row.FCTextBox("TxtCaducidad").Text = "" OrElse e.Row.FCTextBox("TxtCaducidad").Text.ToDate <= MinFecha Then + e.Row.FCTextBox("TxtCaducidad").ReadOnly = False + CType(e.Row.FindControl("RFVCaducidad"), RequiredFieldValidator).Enabled = True e.Row.FCTextBox("TxtCaducidad").Enabled = True End If + Else + e.Row.FCTextBox("TxtCaducidad").Visible = False + e.Row.FCLinkButton("LnkCaducidad").Visible = False + e.Row.FCTextBox("TxtCaducidad").Enabled = True + End If - If CBool(e.Row.DBCampo("AplicaLote")) Then - e.Row.FCTextBox("TxtLote").Visible = True - 'si aplica caducidad y viene vacía (posible por venta anterior), que se active su registro - If e.Row.FCTextBox("TxtLote").Text = "" Then - e.Row.FCTextBox("TxtLote").ReadOnly = False - e.Row.FCTextBox("TxtLote").Enabled = True - Else - e.Row.FCTextBox("TxtLote").ReadOnly = True - End If - + If CBool(e.Row.DBCampo("AplicaLote")) Then + e.Row.FCTextBox("TxtLote").Visible = True + 'si aplica caducidad y viene vacía (posible por venta anterior), que se active su registro + If e.Row.FCTextBox("TxtLote").Text = "" Then + e.Row.FCTextBox("TxtLote").ReadOnly = False + e.Row.FCTextBox("TxtLote").Enabled = True Else - e.Row.FCTextBox("TxtLote").Visible = False + e.Row.FCTextBox("TxtLote").ReadOnly = True End If + Else + e.Row.FCTextBox("TxtLote").Visible = False End If e.Row.FCButton("BtnDividir").Attributes.Add("onclick", String.Format("Dividir('{0}');", e.Row.FCTextBox("TxtDividir").ClientID)) @@ -1049,19 +1018,27 @@ Partial Class Inventarios_EntregaAlmacen 'FUNCIONALIDAD PISTOLA DE CODIGOS - If UsuarioActual.Empresa.Funcionalidad(132) = "1" And e.Row.DBCampo("CodigoBarras").Trim <> "" Then - e.Row.FCTextBox("TbCantidadF").Text = "0" + If e.Row.DBCampo("CodigoBarras").Trim <> "" AndAlso UsuarioActual.Empresa.Funcionalidad(132) = "1" Then + 'NO BLOQUEA PARA ROL AD If UsuarioActual.CveRol = 1 Then If AplicaSerie Then e.Row.FCTextBox("TbCantidadF").Enabled = False + e.Row.FCTextBox("TbCantidadF").Text = "0" Else e.Row.FCTextBox("TbCantidadF").Text = e.Row.DBCampo("CantidadF").ToDecimal.ToString("#,##0.######") End If End If - If Not UsuarioActual.CveRol = 1 Then - e.Row.FCTextBox("TbCantidadF").Enabled = False + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then 'acumuladoras + If e.Row.DBCampo("CveCategoria") <> "249" Then + e.Row.FCTextBox("TbCantidadF").Enabled = True + End If + Else + If Not UsuarioActual.CveRol = 1 Then + e.Row.FCTextBox("TbCantidadF").Enabled = False + e.Row.FCTextBox("TbCantidadF").Text = "0" + End If End If End If @@ -1070,7 +1047,6 @@ Partial Class Inventarios_EntregaAlmacen e.Row.FCCheckBox("cbInv").Enabled = False End If - End If End Sub @@ -1140,9 +1116,9 @@ Partial Class Inventarios_EntregaAlmacen DtDatosDetalle.Columns.Add("FueTraspaso", GetType(Integer)) End If End Sub - Private Sub CargaSerie(Optional CerrarCompletado As Boolean = False) - RegistraScript("$('#DivSerie').modal('show')", "show") + Private Sub CargaSerie(Optional CerrarCompletado As Boolean = False, Optional CargaMasivo As Boolean = False) + If Not CargaMasivo Then RegistraScript("$('#DivSerie').modal('show')", "show") Dim AplicaCaducidad = False If GlobalDTPS(UsuarioActual.CveEmpresa, ).FiltraParametros("").Rows(0) IsNot Nothing Then @@ -1196,7 +1172,7 @@ Partial Class Inventarios_EntregaAlmacen Dim Mensaje As New StringBuilder Mensaje.AppendFormat("Serie Recomendado: {0}", DtSerie.Rows(0)("Serie")) - If AplicaCaducidad Then Mensaje.AppendFormat(", Caducicdad: {0}", DtSerie.Rows(0)("FechaCaducidad").ToString().ToDate.ToShortDateString) + If AplicaCaducidad Then Mensaje.AppendFormat(", Caducidad: {0}", DtSerie.Rows(0)("FechaCaducidad").ToString().ToDate.ToShortDateString) LbSerieRecomendado.Text = Mensaje.ToString() 'String.Format("Serie / Lote Recomendado: {0}, Caducicdad: {1}", ObjInventarios.DtResultados.Rows(0)("SerieLote"), ObjInventarios.DtResultados.Rows(0)("FechaCaducidad").ToString().ToDate.ToShortDateString) Else LbSerieRecomendado.Text = "No se encontro ningun Serie/Lote." @@ -1250,7 +1226,7 @@ Partial Class Inventarios_EntregaAlmacen End If End Sub - Private Sub AgregaSerie(Serie As String, Tipo As Integer) + Private Sub AgregaSerie(Serie As String, Tipo As Integer, Optional CargaMasivo As Boolean = False) If Serie.Trim = "" Then Alert("El campo Serie es obligatorio. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) @@ -1312,7 +1288,7 @@ Partial Class Inventarios_EntregaAlmacen End If If Tipo < 3 Then - CargaSerie(True) + CargaSerie(True, cargaMasivo) End If End Sub @@ -1570,8 +1546,7 @@ Partial Class Inventarios_EntregaAlmacen End If End If - - If Gvr.DataKey("AplicaSerieLote") = "True" Then + If Gvr.DataKey("AplicaSerie") = "True" Then TdSeriePS.Visible = True TxtSeriePS.Focus() @@ -1582,7 +1557,6 @@ Partial Class Inventarios_EntregaAlmacen Exit Sub End If - Dim CantidadEspecial = Gvr.DataKey("CveClasificacion").ToString().ToEntero().Contiene(17601, 17881) OrElse Gvr.DataKey("CvePS").ToString().ToEntero().Contiene(343032, 343033) If CantidadEspecial Then @@ -1636,7 +1610,7 @@ Partial Class Inventarios_EntregaAlmacen End If End Sub Protected Sub BtnSeriePS_Click(sender As Object, e As EventArgs) - AgregaSerie(TxtSeriePS.Text.Trim, 2) + AgregaSerie(TxtSeriePS.Text.Trim, 2, True) TdSeriePS.Visible = False TxtSeriePS.Text = "" @@ -1719,11 +1693,9 @@ Partial Class Inventarios_EntregaAlmacen Next - If (Not ValidaLoteCaducidad) OrElse (UsuarioActual.CveEmpresa <> 119) Then - ValidaSeccion = False - ValidaCaducidad = False - ValidaLote = False - End If + ValidaSeccion = False + ValidaCaducidad = False + ValidaLote = False If ValidaSeccion Then Alert("La sección de almacen no ha sido especificada en todos los productos.", TipoMensaje.MsgAdvertencia) @@ -1866,11 +1838,6 @@ Partial Class Inventarios_EntregaAlmacen FechaCaducidad = If(CBool(Dr("AplicaCaducidad")) AndAlso Dr("FechaCaducidad").ToString() <> "", Dr("FechaCaducidad").ToString().ToDate, MinFecha) Lote = If(CBool(Dr("AplicaLote")), Dr("Lote").ToString().Trim, "-1") - If Not ValidaLoteCaducidad Then - FechaCaducidad = MinFecha - Lote = "-1" - End If - If Dr("CantidadGV").ToString().ToDecimal > 0 Then If CBool(Dr("AplicaSerie")) Then DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Dr("Consec"))) @@ -2076,15 +2043,14 @@ Partial Class Inventarios_EntregaAlmacen Next End If - If Not ErrorMovInv AndAlso CveMovimientoSalida > 0 Then + If Not ErrorMovInv AndAlso CveMovimientoSalida > 0 AndAlso TipoDocto.Contiene("Rem") Then Dim CvePrePolizaSinCosto As Integer = ObjConta.AddPrePolizas("EA/SinCost", 53, 0, 0, 1, TxtFecha.Text.ToDate, "Entrega", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) If CvePrePolizaSinCosto > 0 Then If Not ErrorMovInv AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePolizaSinCosto, True, 0, 0, 68, TxtObservaciones.Text, TxtObservaciones.Text, -1, -1, CveMovimientoAlmacen:=CveMovimientoSalida, Contabilizable:=False) Then ErrorMovInv = True End If - - If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaSinCosto, False, 0, 0, 68, TxtObservaciones.Text, TxtObservaciones.Text, -1, -1, CveMovimientoAlmacen:=CveMovimientoEntrada, Contabilizable:=False) Then + If Not ErrorMovInv AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePolizaSinCosto, False, 0, 0, 68, TxtObservaciones.Text, TxtObservaciones.Text, -1, -1, CveMovimientoAlmacen:=CveMovimientoEntradaApartado, Contabilizable:=False) Then ErrorMovInv = True End If @@ -2152,12 +2118,6 @@ Partial Class Inventarios_EntregaAlmacen CantidadPendiente = 1 - 'If CBool(Dr("AplicaSeccion")) Then - ' CveSeccionAlmacen = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, Dr2("CveAlmacen").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero()).FiltroPrimeroValor("CveSeccionAlmacen").ToEntero() - ' Dim a As String = String.Format("CveAlmacen={0}-CvePS:{1}-CveseccionAlmacen={2}", Dr2("CveAlmacen"), Dr("CvePS"), CveSeccionAlmacen) - 'Else - ' CveSeccionAlmacen = -1 - 'End If CveSeccionAlmacen = -3 If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, CantidadPendiente.ToString().ToDecimal, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), 0, Serie:=Dr1("Serie").ToString(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero(), FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString().ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString(), "-1"), CveSeccionAlmacen:=CveSeccionAlmacen) Then @@ -2529,7 +2489,7 @@ Partial Class Inventarios_EntregaAlmacen If TipoMovimiento = 2 AndAlso DtExistencias IsNot Nothing Then 'CveSeccionAlmacen = DtExistencias.FiltroPrimeroValor("CveSeccionAlmacen", $"ISNULL(CveTipoAlmacenDevolucion,0) <> 26 AND CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString().ToEntero()} AND Serie = '{Dr1("Serie").ToString()}'").ToString().ToEntero - PU = DtExistencias.FiltroPrimeroValor("PU", $"CveTipoAlmacenDevolucion <> 26 AND CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString().ToEntero()} AND Serie = '{Dr1("Serie").ToString()}'").ToString().ToDecimal + PU = DtExistencias.FiltroPrimeroValor("PU", $"ISNULL(CveTipoAlmacenDevolucion,-1) <> 26 AND CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString().ToEntero()} AND Serie = '{Dr1("Serie").ToString()}'").ToString().ToDecimal End If If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, 1, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), PU, Serie:=Dr1("Serie").ToString(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero(), CveVentaDetalleRemision:=Dr("CveVentaDetalleRemision").ToString().ToEntero(), FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString().ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString(), "-1"), CveSeccionAlmacen:=-3) Then diff --git a/Inventarios/RecepcionAlmacen.aspx.vb b/Inventarios/RecepcionAlmacen.aspx.vb index c6c6fc156..6d6a5c989 100644 --- a/Inventarios/RecepcionAlmacen.aspx.vb +++ b/Inventarios/RecepcionAlmacen.aspx.vb @@ -28,14 +28,6 @@ Partial Class Inventarios_RecepcionAlmacen End Set End Property - Private Property ValidaLoteCaducidad As Boolean - Get - Return CType(ViewState("ValidaLoteCaducidad"), Boolean) - End Get - Set(value As Boolean) - ViewState("ValidaLoteCaducidad") = value - End Set - End Property Private Property CveTipoAlmacen As Integer Get Return CType(ViewState("CveTipoAlmacen"), Integer) @@ -606,21 +598,11 @@ Partial Class Inventarios_RecepcionAlmacen Dim drr As DataRow = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=DdlAlmacen.SelectedValue.ToEntero).FiltroPrimero("") If drr IsNot Nothing Then - '("CveSubProyecto").ToEntero - Dim CveSubProyecto As Integer = drr("CveSubProyecto").ToString.ToEntero - 'RMF condición temporal - If UsuarioActual.CveEmpresa = 119 AndAlso CveSubProyecto.ToString.Contiene(UsuarioActual.Empresa.Funcionalidad(347).Split(","c)) Then - ValidaLoteCaducidad = True - Else - ValidaLoteCaducidad = False - End If CveTipoAlmacen = drr("CveTipoAlmacen").ToString.ToEntero End If - - CargaGVInv() 'For Each Gvr As GridViewRow In GvInv.Rows ' If Gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue = "-1" Then @@ -1412,6 +1394,9 @@ Partial Class Inventarios_RecepcionAlmacen If Not TmDT.Columns.Contains("CantidadSeleccionada") Then TmDT.Columns.Add("CantidadSeleccionada", GetType(Decimal)) End If + If Not TmDT.Columns.Contains("CveCategoria") Then + TmDT.Columns.Add("CveCategoria", GetType(Integer)) + End If GvInv.Columns(2).Visible = False @@ -1490,6 +1475,10 @@ Partial Class Inventarios_RecepcionAlmacen e.Row.FCButton("BtnSerie").Visible = False e.Row.FCTextBox("TbCantidadF").Enabled = True e.Row.FCCheckBox("cbInv").Enabled = True + + If UsuarioActual.TienePermisoProceso(345) Then 'carga la cantidad con el rol AD + e.Row.FCTextBox("TbCantidadF").Text = e.Row.DBCampo("CantidadF").FormatoNumero + End If End If End If @@ -1517,7 +1506,7 @@ Partial Class Inventarios_RecepcionAlmacen e.Row.FCTextBox("TbCantidadF").Text = e.Row.DBCampo("CantidadF").FormatoNumero e.Row.FCTextBox("TbCantidadF").Enabled = False End If - If UsuarioActual.CveRol = 1 Then 'carga la cantidad con el rol AD + If UsuarioActual.TienePermisoProceso(345) Then 'carga la cantidad con el rol AD e.Row.FCTextBox("TbCantidadF").Text = e.Row.DBCampo("CantidadF").FormatoNumero End If End If @@ -1547,23 +1536,20 @@ Partial Class Inventarios_RecepcionAlmacen e.Row.FCDropDownList("DdlSeccionAlmacen").Visible = False End If - If (ValidaLoteCaducidad) OrElse (UsuarioActual.CveEmpresa <> 119) Then - If CBool(e.Row.DBCampo("AplicaCaducidad")) Then - e.Row.FCTextBox("TxtCaducidad").Visible = True - e.Row.FCLinkButton("LnkCaducidad").Visible = True - e.Row.FCTextBox("TxtCaducidad").Text = Now.ToShortDateString - e.Row.FCTextBox("TxtDividir").Visible = True - Else - e.Row.FCTextBox("TxtCaducidad").Visible = False - e.Row.FCLinkButton("LnkCaducidad").Visible = False - End If - - If CBool(e.Row.DBCampo("AplicaLote")) Then - e.Row.FCTextBox("TxtLote").Visible = True - Else - e.Row.FCTextBox("TxtLote").Visible = False - End If + If CBool(e.Row.DBCampo("AplicaCaducidad")) Then + e.Row.FCTextBox("TxtCaducidad").Visible = True + e.Row.FCLinkButton("LnkCaducidad").Visible = True + e.Row.FCTextBox("TxtCaducidad").Text = Now.ToShortDateString + e.Row.FCTextBox("TxtDividir").Visible = True + Else + e.Row.FCTextBox("TxtCaducidad").Visible = False + e.Row.FCLinkButton("LnkCaducidad").Visible = False + End If + If CBool(e.Row.DBCampo("AplicaLote")) Then + e.Row.FCTextBox("TxtLote").Visible = True + Else + e.Row.FCTextBox("TxtLote").Visible = False End If e.Row.FCButton("BtnDividir").Attributes.Add("onclick", String.Format("Dividir('{0}');", e.Row.FCTextBox("TxtDividir").ClientID)) @@ -1574,6 +1560,11 @@ Partial Class Inventarios_RecepcionAlmacen 'FUNCIONALIDAD PISTOLA DE CODIGOS If UsuarioActual.Empresa.Funcionalidad(132) = "1" And e.Row.DBCampo("CodigoBarras").Trim <> "" And Not UsuarioActual.TienePermisoProceso(174) Then e.Row.FCTextBox("TbCantidadF").Enabled = False + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then 'acumuladoras + If e.Row.DBCampo("CveCategoria") <> "249" Then + e.Row.FCTextBox("TbCantidadF").Enabled = True + End If + End If End If If e.Row.DBCampo("CantidadF").ToDecimal = 0 Then @@ -1623,7 +1614,7 @@ Partial Class Inventarios_RecepcionAlmacen Dim TxtCantidad = GvInv.Rows(Gvr.RowIndex).FCTextBox("TbCantidadF") If Gvr.DataKey("CantidadF").ToDecimal - TxtCantidad.Text.ToDecimal - 1 >= 0 Then - If Gvr.DataKey("AplicaSerieLote") = "True" Then + If Gvr.DataKey("AplicaSerie") = "True" Then TdSeriePS.Visible = True TxtSeriePS.Focus() @@ -1690,11 +1681,14 @@ Partial Class Inventarios_RecepcionAlmacen End Sub Protected Sub BtnSeriePS_Click(sender As Object, e As EventArgs) - AgregaSerie(TxtSeriePS.Text.Trim, 2) + AgregaSerie(TxtSeriePS.Text.Trim, 2, CargaMasivaSeries:=True) TdSeriePS.Visible = False TxtSeriePS.Text = "" TxtCodigoPS.Text = "" TxtCodigoPS.Focus() + UPInv.Update() + GvInv.DataSource = DtInv + GvInv.DataBind() End Sub Protected Sub BtnGuardarCantidadEspecial_Click(sender As Object, e As EventArgs) AgregaCantidadEspecial() @@ -1792,7 +1786,6 @@ Partial Class Inventarios_RecepcionAlmacen DtInv.AcceptChanges() Next - UPInv.Update() UpSerie.Update() TxtSerie.Text = "" @@ -1831,7 +1824,7 @@ Partial Class Inventarios_RecepcionAlmacen End If 'PARA VALIDAR SI LA SERIE ES IGUAL AL CODIGO O CODIGOBARRAS - If Serie.ToUpper = dr("Codigo").ToString.ToUpper Or Serie.ToUpper = dr("CodigoBarras").ToString.ToUpper Then + If Serie.ToUpper = dr("Codigo").ToString.ToUpper OrElse Serie.ToUpper = dr("CodigoBarras").ToString.ToUpper Then MensajeAlert.Append($"
    El numero de Serie {Serie} coincide con el codigo o codigo de barras del producto. Por favor rectifique y vuelva a intentar.") Continue For End If @@ -1846,20 +1839,21 @@ Partial Class Inventarios_RecepcionAlmacen Dim MensajeSinExistencias As New StringBuilder Dim ObjInventarios As New ClsInventarios Dim Index = 0 + Dim Cantidad As Integer = LbCantidad.Text.ToEntero + + If CargaMasivaSeries Then Cantidad = DtInv.FiltroPrimeroValor("CantidadF", "Consec = " & CveConsecSerie).ToEntero + 'DtInv For Each Serie In SeriesArreglo If Serie <> "" Then - - Dim Row = DtDatosDetalle.NewRow + Dim Row = DtDatosDetalle.NewRow Index = Index + 1 - If Index > LbCantidad.Text.ToEntero Then - Exit For - End If + If Index > Cantidad Then Exit For 'VALIDA QUE SIGA AGREGANDO - If Not DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerie)).Rows.Count < LbCantidad.Text.ToEntero Then - Exit For + If Not DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerie)).Rows.Count < Cantidad Then + MensajeAlert.Append("series cargadas en su totalidad") : Exit For End If 'VERIFICA EXISTENCIAS @@ -2281,12 +2275,6 @@ Partial Class Inventarios_RecepcionAlmacen Index += 1 Next - If (Not ValidaLoteCaducidad) OrElse (UsuarioActual.CveEmpresa <> 119) Then - ValidaSeccion = False - ValidaCaducidad = False - ValidaLote = False - End If - If ValidaSeccion Then Alert("La sección de almacen no ha sido especificada en todos los productos.", TipoMensaje.MsgAdvertencia) Return False @@ -2327,7 +2315,7 @@ Partial Class Inventarios_RecepcionAlmacen End If End If - Dim Existencia = ObjInventarios.GetExistenciasPS(gvr.DataKey("CvePS").ToEntero, gvr.DataKey("CveUM").ToEntero, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm")) + Dim Existencia = ObjInventarios.GetExistenciasPS(gvr.DataKey("CvePS").ToEntero, gvr.DataKey("CveUM").ToEntero, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, FechaMovto:= (TxtFecha.Text & " " & Now.ToShortTimeString).ToDateTime.ToString("yyyy/MM/dd HH:mm")) If Existencia < ExistenciaActual Then MensajeExistencias.Append($"Producto: {GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=gvr.DataKey("CvePS").ToString.ToEntero).FiltroPrimeroValor("PSCodigo")}.
    ") Continue For @@ -3254,6 +3242,12 @@ Partial Class Inventarios_RecepcionAlmacen End If Else + + Dim CveTipoAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=DdlAlmacen.SelectedValue.ToEntero()).FiltroPrimeroValor("CveTipoAlmacen").ToEntero() + If CveTipoAlmacen = 21 Then 'tipo: devs a proveedore + RealizarMovimientoVirtual = False + End If + If RealizarMovimientoVirtual Then Dim DtPSVirtual As New DataTable("DtTamanios") diff --git a/Inventarios/RecepcionUsados.aspx.vb b/Inventarios/RecepcionUsados.aspx.vb index 7850ebe3f..17cc978e4 100644 --- a/Inventarios/RecepcionUsados.aspx.vb +++ b/Inventarios/RecepcionUsados.aspx.vb @@ -1082,7 +1082,7 @@ Partial Class Inventarios_RecepcionUsados If Valido And AgregarUsado Then If ObjFactura IsNot Nothing AndAlso Me.CveRemisionRecibida > 0 Then - Dim RowDetalle As DataRow = ObjFactura.DtDetalle.FiltroPrimero($"CvePS={CvePS}") + Dim RowDetalle As DataRow = ObjFactura.DtDetalle.FiltroPrimero($"CveVentaDetalle={CveVentaDetalle}") If RowDetalle IsNot Nothing Then diff --git a/Inventarios/RepProductosPorCaducar.aspx.cs b/Inventarios/RepProductosPorCaducar.aspx.cs index 18fc44e5a..3fbb2a6d8 100644 --- a/Inventarios/RepProductosPorCaducar.aspx.cs +++ b/Inventarios/RepProductosPorCaducar.aspx.cs @@ -57,11 +57,11 @@ public partial class Inventarios_RepProductosPorCaducar : ClsPaginas DTDatos = ObjInventarios.DtResultados; if (DdlOpcion.SelectedValue == "1") { - GvDatos.Columns[4].HeaderText = "F.Elaboración"; + GvDatos.Columns[5].HeaderText = "F.Elaboración"; } else { - GvDatos.Columns[4].HeaderText = "F.Caducidad"; + GvDatos.Columns[5].HeaderText = "F.Caducidad"; } } @@ -230,11 +230,11 @@ public partial class Inventarios_RepProductosPorCaducar : ClsPaginas { if (ChkTiempoCaducidad.Checked) { - GvDatos.Columns[5].Visible = true; + GvDatos.Columns[6].Visible = true; } else { - GvDatos.Columns[5].Visible = false; + GvDatos.Columns[6].Visible = false; } CargarDatos();//Si no se recarga no se muestran los valores dela la columna de tiempo caducindad laprimera vez que pasa de oculta a mostrarse UpDatos.Update(); diff --git a/Inventarios/RepRSCO.aspx b/Inventarios/RepRSCO.aspx index ae968ebcf..1f68826c3 100644 --- a/Inventarios/RepRSCO.aspx +++ b/Inventarios/RepRSCO.aspx @@ -13,7 +13,7 @@ - Rep RSCO + Reporte RSCO diff --git a/Inventarios/TraspasoAlmacen.aspx b/Inventarios/TraspasoAlmacen.aspx index dc13d3ed7..f38825243 100644 --- a/Inventarios/TraspasoAlmacen.aspx +++ b/Inventarios/TraspasoAlmacen.aspx @@ -657,7 +657,7 @@
    - + <%-- diff --git a/Inventarios/TraspasoAlmacen.aspx.vb b/Inventarios/TraspasoAlmacen.aspx.vb index f4ea14462..771a5a7f4 100644 --- a/Inventarios/TraspasoAlmacen.aspx.vb +++ b/Inventarios/TraspasoAlmacen.aspx.vb @@ -365,7 +365,7 @@ Partial Class Inventarios_TraspasoAlmacen Private Sub CargaMovimientoGarantia(CveFolioGarantia As Integer) Using ObjAcum As New ClsAcumuladores - If ObjAcum.GetFoliosGarantiasDetalle(CveFolioGarantia) Then + If ObjAcum.GetFoliosGarantiasDetalle(CveFolioGarantia, CveEstatusConsecutivo:=1) Then ''carga Dim dra As DataRow = ObjAcum.DtResultados(0) DivMov.Visible = True @@ -572,7 +572,7 @@ Partial Class Inventarios_TraspasoAlmacen If TxtnSerie.Visible Then Cantidad = 1 If String.IsNullOrEmpty(TxtnSerie.Text.Trim()) OrElse String.IsNullOrWhiteSpace(TxtnSerie.Text.Trim()) Then - Alert("Serie es necesario", TipoMensaje.MsgAdvertencia) + Alert("Serie es necesario.", TipoMensaje.MsgAdvertencia) RegistraScript("playsonidito(''142608__autistic-lucario__error.wav'')") Exit Sub End If @@ -597,14 +597,14 @@ Partial Class Inventarios_TraspasoAlmacen 'codigo provisional. Dim CveSubP As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=DdlAlmacenOrigen.SelectedValue.ToEntero).FiltroPrimeroValor("CveSubProyecto", "").ToEntero - If DrPS("AplicaCaducidad").ToString = "True" AndAlso CveSubP.ToString.Contiene(UsuarioActual.Empresa.Funcionalidad(347).Split(","c)) Then + If DrPS("AplicaCaducidad").ToString = "True" Then If Not ChkSugiereFechaCaducidad.Checked AndAlso (TxtnFechaCaducidad.Text = "" OrElse TxtnLote.Text = "") Then Alert("Falta Especificar lote/Fecha del producto", TipoMensaje.MsgAdvertencia) Exit Sub End If End If - If DrPS("AplicaCaducidad").ToString = "True" AndAlso ChkSugiereFechaCaducidad.Checked And CveSubP.ToString.Contiene(UsuarioActual.Empresa.Funcionalidad(347).Split(","c)) Then + If DrPS("AplicaCaducidad").ToString = "True" AndAlso ChkSugiereFechaCaducidad.Checked Then Dim ObjInventarios As New ClsInventarios If ObjInventarios.GetExistenciasCaducidad(CveProducto, DdlAlmacenOrigen.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DdlAlmacenOrigen.SelectedValue) Then @@ -641,12 +641,7 @@ Partial Class Inventarios_TraspasoAlmacen tLote = If(TxtnLote.Visible, TxtnLote.Text, "-1") tCaducidad = If(TxtnFechaCaducidad.Visible, TxtnFechaCaducidad.Text.ToDate, MinFecha) - If Not CveSubP.ToString.Contiene(UsuarioActual.Empresa.Funcionalidad(347).Split(","c)) Then - tLote = "-1" - tCaducidad = MinFecha - End If - - Dim tSerie As String = If(TxtnSerie.Visible, TxtnSerie.Text, "-1") + Dim tSerie As String = If(TxtnSerie.Visible, TxtnSerie.Text, "-1").Trim Dim Valido = ValidaExistencia(Cantidad, CveProducto, DdlUnidad.SelectedValue.ToEntero, DdlSeccionAlmacen.SelectedValue.ToEntero, tSerie, tLote, tCaducidad) @@ -725,14 +720,12 @@ Partial Class Inventarios_TraspasoAlmacen Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") - If ChkEmitirTimbrado.Checked AndAlso ChkEmitirCartaPorte.Checked Then If Not ValidaPSSAT(DrPS) Then Exit Sub End If End If - If DrPS IsNot Nothing Then CveClasificacion = DrPS("CveClasificacion").ToString.ToEntero Dim DrUM = GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa).FiltroPrimero($"CveUnidadMedida = {CveUnidadMedida}") @@ -745,7 +738,7 @@ Partial Class Inventarios_TraspasoAlmacen registro.Item("CvePS") = CvePS registro.Item("PS") = DrPS("PSCodigo") registro.Item("Observaciones") = Observaciones - registro.Item("Serie") = Serie + registro.Item("Serie") = Serie.Trim registro.Item("Lote") = Lote If FechaCaducidad > MinFecha Then registro.Item("FechaCaducidad") = FechaCaducidad registro.Item("CveClasificacion") = CveClasificacion @@ -902,6 +895,11 @@ Partial Class Inventarios_TraspasoAlmacen RealizarMovimientoVirtual = True End If + 'SI VA PASAR POR EL ALMACEN TRANSITORIO, DEBE TRASPASAR LOS VIRTUALES AHI PRIMERO + If ChkTransitorio.Checked Then + CveAlmacenVirtualEntrada = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=DdlAlmacenTransitorio.SelectedValue.ToEntero).FiltroPrimero("")("CveAlmacenVirtual").ToString().ToEntero() + End If + 'VALIDA ALMACEN DISTINTA SUCURSAL DEBE SER TRANSITORIO If Not UsuarioActual.CveEmpresa.Contiene(7, 140) Then '[IPP] EMPRESA VIGILANCIA NO OCUPA TRANSITORIOS - TIENEN MIL SUCURSALES Xd If Not ChkTransitorio.Checked Then @@ -1129,6 +1127,7 @@ Partial Class Inventarios_TraspasoAlmacen dtvirtual = ObjInventario.DtResultados If dtvirtual.Rows.Count > 0 Then + 'SALIDA VIRTUAL CveMovimientoVirtualSalida = ObjInventario.AddMovimiento(CveAlmacenVirtualSalida, 37, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Modulo:="TA/V", CveMovimientoRelacionado:=CveMovimientoSalida, CveAlmacenDestino:=CveAlmacenVirtualEntrada) FolioVirtualSalida = ObjInventario.Folio Dim Contabilizable As Boolean = False @@ -1148,9 +1147,9 @@ Partial Class Inventarios_TraspasoAlmacen End If Next - 'SALIDA VIRTUAL + 'ENTRADA VIRTUAL Dim importevirtual As Decimal = 0 - CveMovimientoVirtualEntrada = ObjInventario.AddMovimiento(CveAlmacenVirtualSalida, 36, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Modulo:="TA/S3", CveMovimientoRelacionado:=CveMovimientoEntrada, CveAlmacenDestino:=CveAlmacenVirtualEntrada) + CveMovimientoVirtualEntrada = ObjInventario.AddMovimiento(CveAlmacenVirtualEntrada, 36, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Modulo:="TA/S3", CveMovimientoRelacionado:=CveMovimientoEntrada, CveAlmacenDestino:=CveAlmacenVirtualEntrada) FolioVirtualEntrada = ObjInventario.Folio If CveMovimientoVirtualEntrada > 0 Then Dim DtCostosVirtual As DataTable @@ -1487,7 +1486,7 @@ Partial Class Inventarios_TraspasoAlmacen Private Sub CargaGvDatos() EscondeColumnasGVM(DtMovimientos) - GvDatos.DataSource = DtMovimientos + GvDatos.DataSource = DtMovimientos.FiltraParametros("", "No desc") GvDatos.DataBind() UpDatos.Update() End Sub @@ -1799,13 +1798,6 @@ Partial Class Inventarios_TraspasoAlmacen If CBool(e.Row.DBCampo("AplicaSeccion")) AndAlso DdlAlmacenRecepcion.SelectedValue.ToEntero > 0 Then CargaSeccionesAlmacen(e.Row.FCDropDownList("DdlSeccionAlmacen"), DdlAlmacenRecepcion.SelectedValue.ToEntero, e.Row.DBCampo("CvePS").ToEntero, UsuarioActual.CveEmpresa) - 'Dim dtt As DataTable = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, DdlAlmacenRecepcion.SelectedValue.ToEntero, e.Row.DBCampo("CvePS").ToEntero) - 'e.Row.FCDropDownList("DdlSeccionAlmacen").DataSource = dtt - 'e.Row.FCDropDownList("DdlSeccionAlmacen").DataBind() - 'If dtt.Rows.Count > 1 Then - ' e.Row.FCDropDownList("DdlSeccionAlmacen").Items.Insert(0, New ListItem("Seleccione", "-1")) - 'End If - 'dtt.Dispose() End If @@ -1822,9 +1814,12 @@ Partial Class Inventarios_TraspasoAlmacen 'FUNCIONALIDAD PISTOLA DE CODIGOS If UsuarioActual.Empresa.Funcionalidad(132) = "1" And e.Row.DBCampo("CodigoBarras").Trim <> "" Then e.Row.FCTextBox("TxtCantidad").Enabled = False + If e.Row.DBCampo("CveCategoria") <> "249" Then + e.Row.FCTextBox("TxtCantidad").Enabled = True + End If End If - End If + End If End Sub Protected Sub BtnCancelarTraspaso_Click(sender As Object, e As EventArgs) @@ -1839,6 +1834,8 @@ Partial Class Inventarios_TraspasoAlmacen Dim TextoError As String = "" Dim Fecha As Date = TxtFechaRecepcion.Text.ToDate Dim CveMovimientoVirtualEntrada As Integer = 0 + Dim CveMovimientoVirtualSalida As Integer = 0 + Dim CveMovimientoSalidaTransitorio As Integer = 0 Dim FolioVirtualEntrada As Integer = 0 @@ -1922,6 +1919,7 @@ Partial Class Inventarios_TraspasoAlmacen If UsuarioActual.Empresa.Funcionalidad(573) = "1" Then Dim CveAlmacenVirtual As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=GvDatosRecepcion.Rows(0).DataKey("CveAlmacenSalida").ToEntero).FiltroPrimeroValor("CveAlmacenVirtual", "").ToEntero() + Dim CveAlmacenVirtualSalida As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=CveAlmacenTransitorio).FiltroPrimeroValor("CveAlmacenVirtual", "").ToEntero() 'SI EL ALMACEN ORIGEN ES DE APOPYO LOGISTICO EL ALMACEN VIRTUAL DEBE SER DE APOYO LOGISTICO 'Dim CveAlmacenVirtual As Integer = -1 @@ -1932,15 +1930,21 @@ Partial Class Inventarios_TraspasoAlmacen 'End If 'VERIFICA SI TIENE ALMACEN VIRTUAL ASIGNADA - If CveAlmacenVirtual > 0 Then + If CveAlmacenVirtual > 0 And CveAlmacenVirtualSalida > 0 Then Dim dtvirtual As DataTable = Nothing + Dim importePoliza As Decimal = 0 If ObjInventario.GetMovimientosDetalleVirtual(CveMovimientoEntrada, UsuarioActual.CveEmpresa, CveMovimientoRelacionado:=CveMovimientoSalida) Then dtvirtual = ObjInventario.DtResultados If dtvirtual.Rows.Count > 0 Then + CveMovimientoVirtualEntrada = ObjInventario.AddMovimiento(CveAlmacenVirtual, 36, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservacionesRecepcion.Text.Trim, CveMovimientoRelacionado:=CveMovimientoEntrada, Modulo:="TA/C2") + + CveMovimientoVirtualSalida = ObjInventario.AddMovimiento(CveAlmacenVirtualSalida, 37, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservacionesRecepcion.Text.Trim, CveMovimientoRelacionado:=CveMovimientoSalidaTransitorio, Modulo:="TA/C3") + FolioVirtualEntrada = ObjInventario.Folio + For Each RowVirtual As DataRow In dtvirtual.Rows Dim CvePS = RowVirtual("CvePS").ToString().ToEntero() Dim CantidadUsado As Decimal = RowVirtual("Cantidad").ToString().ToDecimal() @@ -1948,21 +1952,54 @@ Partial Class Inventarios_TraspasoAlmacen Dim CveUM As Integer = RowVirtual("CveUM").ToString().ToEntero() Dim CostoIndirecto As Decimal = RowVirtual("CostoIndirecto").ToString().ToDecimal() + + importePoliza = importePoliza + (CantidadUsado * PU) + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtualEntrada, CantidadUsado, CveUM, CvePS, PU, -1, CostoIndirecto:=CostoIndirecto, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then ErrorMovInv = True Exit For End If + + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtualSalida, CantidadUsado, CveUM, CvePS, PU, -1, CostoIndirecto:=CostoIndirecto, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then + ErrorMovInv = True + Exit For + End If + Next End If - Else - TextoError = "No se pudo registrar el movimiento virtual" - ErrorMovInv = True + 'Else + ' TextoError = "No se pudo registrar el movimiento virtual" + ' ErrorMovInv = True End If + + + If Not ErrorMovInv AndAlso (CveMovimientoSalida > 0 And CveMovimientoVirtualEntrada > 0) Then + + Dim CvePrePolizaMovVirtual As Integer = ObjConta.AddPrePolizas("TA/C2|TA/C3", 53, importePoliza, importePoliza, 1, TxtFecha.Text.ToDate, "TA/C2|TA/C3", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + If CvePrePolizaMovVirtual > 0 Then + If Not ErrorMovInv AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePolizaMovVirtual, True, importePoliza, importePoliza, 68, TxtObservacionesRecepcion.Text, TxtObservacionesRecepcion.Text, -1, -1, CveMovimientoAlmacen:=CveMovimientoVirtualSalida, Contabilizable:=False) Then + ErrorMovInv = True + End If + + If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaMovVirtual, False, importePoliza, importePoliza, 68, TxtObservacionesRecepcion.Text, TxtObservacionesRecepcion.Text, -1, -1, CveMovimientoAlmacen:=CveMovimientoVirtualEntrada, Contabilizable:=False) Then + ErrorMovInv = True + End If + Else + ErrorMovInv = True + End If + + End If + + 'Else ' TextoError = "La Sucursal no tiene creado un almacen virtual" ' ErrorMovInv = True End If + + + + End If If Not ErrorMovInv Then @@ -2127,11 +2164,6 @@ Partial Class Inventarios_TraspasoAlmacen Dim tSerie As String = gvr.FCTextBox("TxtSerie").Text 'gvr.DataKey("Serie").ToString Dim tFechaCaducidad As Date = gvr.DataKey("FechaCaducidad").ToDate - If CveSubProyectoRecibe.ToString.Contiene(UsuarioActual.Empresa.Funcionalidad(347).Split(","c)) Then - tLote = gvr.FCTextBox("TxtLote").Text - tFechaCaducidad = gvr.FCTextBox("TxtCaducidad").Text.ToDate - End If - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal, gvr.DataKey("CveUM").ToString.ToEntero, gvr.DataKey("CvePS").ToString.ToEntero, PrecioEntrada, CveAF:=gvr.DataKey("CveAF").ToString.ToEntero, CveSeccionAlmacen:=gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero, Serie:=tSerie, Lote:=tLote, FechaCaducidad:=tFechaCaducidad, CveMovimientoDetalleEntrada:=CveMovimientoDetalleEntrada) Then ErrorMovInv = True TextoError = "Ocurrió un error al guardar los movimientos de salida" @@ -2324,44 +2356,39 @@ Partial Class Inventarios_TraspasoAlmacen #Region " AGREGA CON TXT | CODIGO - SERIE " Protected Sub BtnCodigoPS_Click(sender As Object, e As EventArgs) - If TxtCodigoPS.Text = "" Then - Exit Sub - End If + If TxtCodigoPS.Text = "" Then Exit Sub TdSeriePS.Visible = False - Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa).FiltroPrimero($"CodigoBarras = '{TxtCodigoPS.Text}'") + Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa).FiltroPrimero($"CodigoBarras = '{TxtCodigoPS.Text.Trim}'") If DrPS Is Nothing Then - Alert($"No se ha encontrado un producto del Codigo ""{TxtCodigoPS.Text}"". ", TipoMensaje.MsgAdvertencia, "window.setTimeout(Focus,200);") + Alert($"No se ha encontrado un producto del Código: ""{TxtCodigoPS.Text}"". ", TipoMensaje.MsgAdvertencia, "window.setTimeout(Focus,200);") RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") TxtCodigoPS.Text = "" Exit Sub End If - If DrPS("Inv_CveMetodoInventario").ToString.ToEntero = 5 Then + If DrPS("AplicaSerie").ToString = "True" Then TdSeriePS.Visible = True TxtSeriePS.Focus() CvePSSerie = DrPS("CvePS").ToString.ToEntero CveUMSerie = DrPS("CveUnidadMedida").ToString.ToEntero Exit Sub + Else + AgregarPS(1, DrPS("CvePS").ToString.ToEntero, DrPS("CveUnidadMedida").ToString.ToEntero) + + TxtCodigoPS.Text = "" End If - AgregarPS(1, DrPS("CvePS").ToString.ToEntero, DrPS("CveUnidadMedida").ToString.ToEntero) - - TxtCodigoPS.Text = "" - End Sub Protected Sub BtnSeriePS_Click(sender As Object, e As EventArgs) - If TxtSeriePS.Text.Trim = "" Then - Exit Sub - End If + If TxtSeriePS.Text.Trim = "" Then Exit Sub txtCantidad.Text = "1" - Dim Valido = ValidaExistencia(1, CvePSSerie, CveUMSerie, -1, TxtSeriePS.Text.Trim, "-1", MinFecha) If Valido Then - AgregarPS(1, CvePSSerie, CveUMSerie, TxtSeriePS.Text.Trim) + AgregarPS(1, CvePSSerie, CveUMSerie, Serie:=TxtSeriePS.Text.Trim.ToUpper) Else TxtSeriePS.Text = "" TxtSeriePS.Focus() @@ -2413,7 +2440,7 @@ Partial Class Inventarios_TraspasoAlmacen If Existe Then Alert($"Ya se ha cargado la totalidad del Producto ""{PSTemp}"" con el Codigo ""{TxtCodigoPSRecepcion.Text}"".", TipoMensaje.MsgAdvertencia, "window.setTimeout(Focus1,200);") Else - Alert($"No se ha encontrado un producto para surtir con el Codigo ""{TxtCodigoPSRecepcion.Text}"". ", TipoMensaje.MsgAdvertencia, "window.setTimeout(Focus1,200);") + Alert($"No se ha encontrado un producto para surtir con el Código: ""{TxtCodigoPSRecepcion.Text}"".", TipoMensaje.MsgAdvertencia, "window.setTimeout(Focus1,200);") End If RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") @@ -2427,7 +2454,7 @@ Partial Class Inventarios_TraspasoAlmacen End If For Each Gvr As GridViewRow In GvDatosRecepcion.Rows - If Gvr.DataKey("CodigoBarras") = TxtCodigoPSRecepcion.Text.Trim And Gvr.DataKey("Serie") = TxtSeriePSRecepcion.Text.Trim Then + If Gvr.DataKey("CodigoBarras") = TxtCodigoPSRecepcion.Text.Trim And Gvr.DataKey("Serie") = TxtSeriePSRecepcion.Text.Trim.ToUpper Then Dim TxtCantidad = GvDatosRecepcion.Rows(Gvr.RowIndex).FCTextBox("TxtCantidad") If Gvr.DataKey("Cantidad").ToDecimal - TxtCantidad.Text.ToDecimal - 1 >= 0 Then @@ -2439,15 +2466,15 @@ Partial Class Inventarios_TraspasoAlmacen Exit Sub End If - Alert($"Ya se ha cargado la totalidad del Producto ""{Gvr.DataKey("PS").ToString}"" con el Codigo ""{TxtCodigoPSRecepcion.Text}"".", TipoMensaje.MsgAdvertencia, "window.setTimeout(Focus1,200);") + Alert($"Ya se ha cargado la totalidad del Producto ""{Gvr.DataKey("PS").ToString}"" con el Código ""{TxtCodigoPSRecepcion.Text}"".", TipoMensaje.MsgAdvertencia, "window.setTimeout(Focus1,200);") RegistraScript("playsonidito(''142608__autistic-lucario__error.wav'')") End If Next - Alert($"No se ha encontrado un producto para surtir con el Codigo ""{TxtCodigoPSRecepcion.Text}"". ", TipoMensaje.MsgAdvertencia, "window.setTimeout(Focus1,200);") + Alert($"No se ha encontrado un producto para surtir con el Codigo ""{TxtCodigoPSRecepcion.Text}"". Serie:{TxtSeriePSRecepcion.Text.Trim} ", TipoMensaje.MsgAdvertencia, "window.setTimeout(Focus1,200);") RegistraScript("playsonidito(''142608__autistic-lucario__error.wav'')") - 'Alert($"Ya se han cargado todos los productos o no se ha encontrado un producto de la Serie ""{TxtSeriePSRecepcion.Text}"". ", TipoMensaje.MsgAdvertencia, "window.setTimeout(Focus2,200);") + TxtSeriePSRecepcion.Text = "" End Sub #End Region diff --git a/OC/OC.aspx b/OC/OC.aspx index 0f3e4323b..9071c6e29 100644 --- a/OC/OC.aspx +++ b/OC/OC.aspx @@ -1,4 +1,4 @@ -<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="OC.aspx.vb" EnableEventValidation="false" Inherits="OC" %> +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="OC.aspx.vb" EnableEventValidation="false" Inherits="OC_OC" %> @@ -255,7 +255,7 @@ <%--linea 5--%>
    - +
    @@ -284,25 +284,19 @@
    <%--linea 6--%> - +
    - <%-- - - --%> - - <%-- - --%> - +
    +
    -
    @@ -326,10 +320,7 @@
    - -
    -
    @@ -438,16 +429,11 @@ - - - - - - + + - - - + +
    diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb index 5348222a8..d9b4a082b 100644 --- a/OC/OC.aspx.vb +++ b/OC/OC.aspx.vb @@ -6,7 +6,7 @@ Imports Extensiones Imports GemBox.Spreadsheet Imports Newtonsoft.Json -Partial Class OC +Partial Class OC_OC Inherits ClsPaginas Private Shared missing As Object = System.Reflection.Missing.Value @@ -820,12 +820,11 @@ Partial Class OC DdlSubProyectoContrato.DataBind() DdlSubProyectoContrato.Items.Insert(0, New ListItem("Seleccione", "-1")) - - If UsuarioActual.Empresa.Funcionalidad(590).ToString.ToEntero = 1 Then + If UsuarioActual.Empresa.Funcionalidad(590) = "1" Then DVCultivosCuadro.Visible = True DdlSubProyecto.AutoPostBack = True - DdlCultivosCuadro.DataSource = GlobalDTCultivosCuadro(UsuarioActual.CveEmpresa).FiltraParametros($"CveSubProyecto = {DdlSubProyecto.SelectedValue} AND Estatus =1") + DdlCultivosCuadro.DataSource = GlobalDTCultivosCuadro(UsuarioActual.CveEmpresa).FiltraParametros($"CveSubProyecto = {DdlSubProyecto.SelectedValue} And Estatus =1") DdlCultivosCuadro.DataBind() DdlCultivosCuadro.Items.Insert(0, New ListItem("Seleccione uno", "-1")) @@ -896,17 +895,17 @@ Partial Class OC UPPDetalle.Update() PermisosPagina() - RegistraScript("$get('HdnWidth').value = $('#C_Tab_TabC_DivConceptosContenido').width();") + RegistraScript("$Get('HdnWidth').value = $('#C_Tab_TabC_DivConceptosContenido').width();") 'NO MOSTRAR LA OPCION DE ENTREGA DIRECTA (ECONOLLANTAS) If UsuarioActual.CveEmpresa = 141 Then - DivEntregaDirecta.Visible = False - ChkEntregaDirecta.Enabled = False - ChkEntregaDirecta.Checked = False - End If + DivEntregaDirecta.Visible = False + ChkEntregaDirecta.Enabled = False + ChkEntregaDirecta.Checked = False + End If - End If - MostrarUsuarioAsignado() + End If + MostrarUsuarioAsignado() Me.Form.DefaultButton = "" End Sub @@ -2219,9 +2218,18 @@ Partial Class OC End If End If - 'Si es Proveedor Extranjero el IVA es 0% - If GlobalDTCompProveedores(CveEmpresaActual).FiltraParametros($"CveProveedor = {DdlProveedores.SelectedValue} AND RFC = 'XEXX010101000'").Rows.Count = 1 Then - IvaPS = 0 + If DdlProveedores.SelectedValue.ToEntero > 0 Then + 'Si es Proveedor Extranjero el IVA es 0% + Dim drProv As DataRow = GlobalDTCompProveedores(CveEmpresaActual, CveProveedor:=DdlProveedores.SelectedValue.ToEntero).FiltroPrimero("") + + If drProv IsNot Nothing Then + If drProv("RFC").ToString = "XEXX010101000" Then + IvaPS = 0 + End If + If drProv("CodigoRegimenFiscal").ToString = "626" Then 'simplificado lleva retencion de 1.25 de isr + RetISR = 0.0125 + End If + End If End If AddPS(TxtCant.Text, DdlP2.SelectedValue.ToEntero, DdlP2.SelectedText, TxtObsPS.Text, ImportePS, TxtDescuentoAdd.Text.ToDecimal, TotalPS, @@ -4027,7 +4035,19 @@ Partial Class OC ' IEPSPSIVA = If(DrPS("IEPSGrabaIVA").ToString = "True", DrPS("IEPSPorcentaje").ToString.ToDecimal, 0) End If + If DdlProveedores.SelectedValue.ToEntero > 0 Then + 'Si es Proveedor Extranjero el IVA es 0% + Dim drProv As DataRow = GlobalDTCompProveedores(CveEmpresaActual, CveProveedor:=DdlProveedores.SelectedValue.ToEntero).FiltroPrimero("") + If drProv IsNot Nothing Then + If drProv("RFC").ToString = "XEXX010101000" Then + IvaPS = 0 + End If + If drProv("CodigoRegimenFiscal").ToString = "626" Then 'simplificado lleva retencion de 1.25 de isr + RetISR = 0.0125 + End If + End If + End If CveSubProyecto = gvr.FCDropDownList("DdlSubProyectoEdit").SelectedValue.ToEntero SubProyecto = gvr.FCDropDownList("DdlSubProyectoEdit").SelectedItem.Text @@ -4039,8 +4059,6 @@ Partial Class OC Cuadro = gvr.FCDropDownList("DdlCultivosCuadroEdit").SelectedItem.Text End If - - If UsuarioActual.Empresa.Tipo_CentroCosto = 1 Or UsuarioActual.Empresa.Tipo_CentroCosto = 2 Then CveProyecto = -1 Proyecto = "Seleccione" @@ -4083,9 +4101,6 @@ Partial Class OC End If End If - - - 'Agarra el nuevo AF si se modifico o deja el pasado CveActivoFijo = If(gvr.FCHiddenField("HdnCveActivoFijo").Value.ToEntero > 0, gvr.FCHiddenField("HdnCveActivoFijo").Value.ToEntero, HdnEditCveActivoFijo.Value.ToEntero) Codigo = If(gvr.FCHiddenField("HdnCodigoAF").Value <> "-1", gvr.FCHiddenField("HdnCodigoAF").Value, HdnEditCodigo.Value) @@ -6960,7 +6975,7 @@ Partial Class OC #End Region #Region " ACTUALIZA OC " - Protected Sub ImgCambiaProv_Click(sender As Object, e As ImageClickEventArgs) Handles ImgCambiaProv.Click + Private Sub ImgCambiaProv_Click(sender As Object, e As EventArgs) Handles ImgCambiaProv.Click Dim OC As New ClsOC If OC.UpdateProveedorOrdenCompra(DdlProveedores.SelectedValue.ToEntero, CveOrdenCompra, UsuarioActual.CveUsuario, CveEmpresaActual) Then CargaHistorial() @@ -8728,35 +8743,20 @@ Partial Class OC - Private Function ValidaNumRemision(NumRemision As String, TipoOC As String, CveProveedor As Integer, Optional OcTranasaccion As System.Data.SqlClient.SqlTransaction = Nothing, Optional CveOrdenCompraValida As Integer = -1) As Boolean + Private Function ValidaNumRemision(NumRemision As String, TipoOC As String, CveProveedor As Integer, Optional OcTransaccion As SqlClient.SqlTransaction = Nothing, Optional CveOrdenCompraValida As Integer = -1) As Boolean Dim NumRemisionValida As Boolean = False - - If NumRemision.Trim.Length > 0 Then - If UsuarioActual.Empresa.Funcionalidad(590).ToString.ToEntero = 1 AndAlso UsuarioActual.CveRol = 1 Then - - Dim ObjOC As ClsOC - - If OcTranasaccion IsNot Nothing Then - ObjOC = New ClsOC(OcTranasaccion) - Else - ObjOC = New ClsOC - End If - + If UsuarioActual.Empresa.Funcionalidad(590) = "1" AndAlso UsuarioActual.CveRol = 1 Then + Dim ObjOC As New ClsOC(OcTransaccion) If ObjOC.GetVerificaNumRemision(CveProveedor, TipoOC, NumRemision, UsuarioActual.CveEmpresa, CveOrdenCompraValida) Then - If ObjOC.DtResultados.Rows.Count > 0 Then - Alert($"La remision ya se encuentra asiganada a la { If(TipoOC = "OC", "Orden de compra", "Requisición")} {ObjOC.DtResultados.Rows(0)("Folio").ToString() }", TipoMensaje.MsgAdvertencia) + Alert($"La remision ya se encuentra asignada a la { If(TipoOC = "OC", "Orden de compra", "Requisición")} {ObjOC.DtResultados.Rows(0)("Folio").ToString() }", TipoMensaje.MsgAdvertencia) Else NumRemisionValida = True End If - End If - - - Else NumRemisionValida = True End If @@ -8764,10 +8764,6 @@ Partial Class OC NumRemisionValida = True End If - - - - Return NumRemisionValida End Function diff --git a/OS/Asignaciones.aspx b/OS/Asignaciones.aspx index fb112083e..38ac67998 100644 --- a/OS/Asignaciones.aspx +++ b/OS/Asignaciones.aspx @@ -175,7 +175,7 @@
    - diff --git a/OS/Asignaciones.aspx.vb b/OS/Asignaciones.aspx.vb index 6b1b23c3a..2d55cdcdf 100644 --- a/OS/Asignaciones.aspx.vb +++ b/OS/Asignaciones.aspx.vb @@ -191,6 +191,9 @@ Partial Class OS_Asignaciones Dim time As DateTime Dim contadorOrdenesAsignadas As Integer = 0 + + ObjOS.IniciaTransacSQL() + For Each row As GridViewRow In GvNA.Rows If row.RowType = DataControlRowType.DataRow Then @@ -215,20 +218,45 @@ Partial Class OS_Asignaciones If Not TieneError Then + If Not ObjOS.UpdateOrdenesServiciosEstatus(CveEstatusOS.ToEntero, UsuarioActual.CveUsuario, row.DataKey("CveOS").ToEntero) Then TieneError = True End If + + + If Not TieneError Then + + Dim RecurrenciaTipo = 0, Frecuencia = -1, DiasSemana = "-1", Dias = -1, Mes = -1, RecurrenciaFin = "-1" + Dim Fecha As DateTime = time + + + Dim OIDescripcion As String = $"{DdlTecnico.SelectedItem.Text} Orden de servicio {row.DataKey("Folio")} " + + Dim ObjEventos As New ClsOIEventos(ObjOS.IniciaTransacSQL()) + If Not ObjEventos.AddEventoAgenda(2, DdlTecnico.SelectedItem.Text, OIDescripcion, 2, time, time.AddHours(1), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, + RecurrenciaTipo:=RecurrenciaTipo, Frecuencia:=Frecuencia, DiasSemana:=DiasSemana, Dia:=Dias, Mes:=Mes, RecurrenciaFin:=RecurrenciaFin, CveTipoEvento:=2, + Importe:=0, CveOS:=row.DataKey("CveOS").ToEntero, CveSubProyecto:=row.DataKey("CveSubProyecto").ToEntero) Then + TieneError = True + End If + + End If + + End If End If End If Next + If contadorOrdenesAsignadas > 0 Then + If Not TieneError Then + ObjOS.Commit() Alert("Se asignaron las ordenes de servicio correctamente", TipoMensaje.MsgInformacion) CargaOrdenesServiciosAsignadasXPersona() CargaOrdenesServiciosNoAsignadas() End If Else + ObjOS.RollBack() Alert("No se han seleccionado ordenes de servicio para asignar", TipoMensaje.MsgAdvertencia) End If diff --git a/OS/OrdenesServicios.aspx.vb b/OS/OrdenesServicios.aspx.vb index 4f8681043..2c20c8bc5 100644 --- a/OS/OrdenesServicios.aspx.vb +++ b/OS/OrdenesServicios.aspx.vb @@ -359,6 +359,8 @@ Partial Class OS_OrdenesServicios hdnEsThickbox.Value = "S" hdnClientIDLink.Value = "NoDefinido" + + End If End Sub @@ -1080,6 +1082,22 @@ Partial Class OS_OrdenesServicios Next + + 'If Not Errores Then + + ' Dim TipoEstatusSeleccionado As Integer = EstatusOSDelUsuario.FiltroPrimeroValor("TipoEstatus", String.Format("CveEstatusOrdenServicio = {0}", DdlEstatusOS.SelectedValue), "Orden ASC").ToEntero + ' If TipoEstatusSeleccionado = 3 Then + + ' Dim objEventos As New ClsOIEventos(ObjOrdenServicio.IniciaTransacSQL) + + ' If Not objEventos.FinalizaEvento(Now, 3, "", -1, CveOS) Then + ' Errores = True + ' End If + + + ' End If + 'End If + If Not Errores Then ViewState("CveOS") = ObjOrdenServicio.CveOS ViewState("Folio") = ObjOrdenServicio.Folio @@ -1098,8 +1116,8 @@ Partial Class OS_OrdenesServicios LimpiaDatos() Else ObjOrdenServicio.RollBack() - End If + Else If CveTecnico = UsuarioActual.CveUsuario Then If ObjOrdenServicio.UpdateOrdenesServicios(TxtSolicito.Text, TxtFechaRecibido.Text, TxtDescripcion.Text, UsuarioActual.CveUsuario, DdlEstatusOS.SelectedValue.ToEntero, CveOS, UsuarioActual.CveUsuario, DdlTipoOrdenOS.SelectedValue.ToEntero, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) Then @@ -1185,6 +1203,24 @@ Partial Class OS_OrdenesServicios Errores = True End If + + If Not Errores Then + + Dim TipoEstatusSeleccionado As Integer = EstatusOSDelUsuario.FiltroPrimeroValor("TipoEstatus", String.Format("CveEstatusOrdenServicio = {0}", DdlEstatusOS.SelectedValue), "Orden ASC").ToEntero + If TipoEstatusSeleccionado = 4 Then + + Dim objEventos As New ClsOIEventos(ObjOrdenServicio.IniciaTransacSQL) + + If Not objEventos.FinalizaEvento(Now, 3, "", -1, CveOS, UsuarioActual.CveUsuario) Then + Errores = True + End If + + + End If + End If + + + If Not Errores Then ObjOrdenServicio.Commit() @@ -1335,6 +1371,8 @@ Partial Class OS_OrdenesServicios AddPS(Consecutivo, -1, DdlPSDetalle.SelectedValue.ToEntero, DdlPSDetalle.SelectedItem.Text, TxtCantidad.Text.ToEntero, TxtObservacionesServicioDetalle.Text, HdnEspecificaciones.Value.ToString, LtlPSEspecificaciones.Text, "", DdlIdentificador.SelectedValue.ToEntero, DdlIdentificador.SelectedItem.Text, "-1", -1, "-1", "-1", "-1", -1, "-1", ChkSeFacturara.Checked, ChkSeSuperviso.Checked, False, If(Filename <> "", Archivo.Name, "-1"), "", UsuarioActual.CveUsuario) + + Else Dim Consecutivo As Integer = TmpDT.Rows.Count - 1 @@ -1425,6 +1463,10 @@ Partial Class OS_OrdenesServicios DivCuentaDetalle.Visible = True End If + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then + DivCuentaDetalle.Visible = False + End If + UpBodyGv.Update() UpFooterGv.Update() RegistraScript("showDivGv();") diff --git a/OS/RepServicioDomicilio.aspx b/OS/RepServicioDomicilio.aspx new file mode 100644 index 000000000..27dfe5531 --- /dev/null +++ b/OS/RepServicioDomicilio.aspx @@ -0,0 +1,750 @@ +<%@ Page Title="Reporte Servicio a Domicilio" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepServicioDomicilio.aspx.vb" Inherits="OS_RepServicioDomicilio" %> + + + + + + + + + + + + + + + + + Reporte Servicios a Domicilio + + + + + + +
    +
    + +
    +
    +
    + + Servicios a Domicilio +
    +
    +
    + +
    +
    + + + + + + + + +
    +
    +
    +
    + + + + +
    + + + + + + + + diff --git a/OS/RepServicioDomicilio.aspx.vb b/OS/RepServicioDomicilio.aspx.vb new file mode 100644 index 000000000..ac80205c3 --- /dev/null +++ b/OS/RepServicioDomicilio.aspx.vb @@ -0,0 +1,273 @@ +Option Explicit On +Option Strict On + +Imports Extensiones +Imports System.Data +Imports Microsoft.Reporting.WebForms +Imports System.Web.Services + +Partial Class OS_RepServicioDomicilio + Inherits ClsPaginas + +#Region "PROPIEDADES" + + + Private Property DtDatos As DataTable + Get + DtDatos = DirectCast(ViewState("DtDatos"), DataTable) + End Get + + Set(ByVal value As DataTable) + ViewState("DtDatos") = value + End Set + End Property + + Private Property DtColor As DataTable + Get + Return DirectCast(ViewState("DtColor"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtColor") = value + End Set + End Property + Private Property Agrupador As String + Get + Return ViewState("Agrupador").ToString + End Get + + Set(value As String) + ViewState("Agrupador") = value + End Set + End Property + Private Property TCEspecifico As Double + Get + Return ViewState("TCEspecifico").ToString.ToDouble + End Get + + Set(value As Double) + ViewState("TCEspecifico") = value + End Set + End Property + Private Property TipoCambio As Integer + Get + Return ViewState("TipoCambio").ToString.ToEntero + End Get + + Set(value As Integer) + ViewState("TipoCambio") = value + End Set + End Property + + +#End Region + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not IsPostBack Then + CargarCentrosDeCosto(Nothing, Nothing, Nothing, LblSubProyectoEtiqueta) + InicializaCalendar() + End If + End Sub + +#Region "CARGAS" + + Private Sub SetValues() + + + + End Sub + + + Private Sub CargaDatos() + + + End Sub + +#End Region + +#Region " FULL CALENDAR " + Private Sub InicializaCalendar() + RegistraScript("InitCalendar();") + + HdnU.Value = UsuarioActual.CveUsuario.ToString + HdnE.Value = UsuarioActual.CveEmpresa.ToString + + DirectCast(Master.FindControl("TSM"), ScriptManager).EnablePageMethods = True + CargaTiposAgenda() + CheckRecurrencia.Attributes.Add("onclick", "CheckAdd(this);") + End Sub + Private Sub CargaTiposAgenda() + Dim ObjEventos As New ClsOIEventos + + If ObjEventos.GetAgendaTipo() Then + DdlAgedaTipo.DataSource = ObjEventos.DtResultados + DdlAgedaTipo.DataBind() + DdlAgedaTipo.Items.Insert(0, New ListItem("Seleccione", "-1")) + Else + Alert("Ocurrió un error al obtener los tipos de agenda. Por favor recargue la página", TipoMensaje.MsgError) + End If + + ObjEventos.Dispose() + End Sub + Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) + Dim ObjEventos As New ClsOIEventos + + Dim FechaInicio = TxtFechaInicioAgenda.Text.ToDateTime() + Dim FechaFin = TxtFechaFinAgenda.Text.ToDateTime() + + RegistraScript("GetView();") + + Dim RecurrenciaTipo = 0, Frecuencia = -1, DiasSemana = "-1", Dias = -1, Mes = -1, RecurrenciaFin = "-1" + If CheckRecurrencia.Checked Then + RecurrenciaTipo = RBLRecurrencia.SelectedValue.ToEntero + Frecuencia = TxtFrecuencia.Text.ToEntero + + 'OBTENEMOS LOS DIAS SELECCIONADOS EN LA OPCION DE RECURRENCIA POR SEMANA + Select Case RecurrenciaTipo + Case 3 + Dim StringDias = "" + For Each item As ListItem In CheckDiasSemana.Items + If item.Selected Then + If StringDias.Length > 0 Then + StringDias += "," + End If + StringDias += item.Value + End If + Next + If StringDias.Length > 0 Then + DiasSemana = StringDias + End If + End Select + + + 'If RBSinFechaFinAdd.Checked Then + ' RecurrenciaFin = "-1" + 'Else + If RBNumeroOcurrencias.Checked Then + RecurrenciaFin = TxtNumeroOcurrencias.Text + ElseIf RBFechaFin.Checked Then + RecurrenciaFin = TxtFechaFinRecurrencia.Text + Else + RecurrenciaFin = "-1" + End If + Else + If HdnCveEvento.Value.ToEntero > 0 Then + Frecuencia = -2 : DiasSemana = "-2" : Dias = -2 : Mes = -2 : RecurrenciaFin = "-2" + End If + End If + + '11/05/2018 - GASTO RECURRENTE + Dim CveTipoEvento As Integer = IIf(ChkGastoRecurrente.Checked, 10, 2).ToString().ToEntero() + Dim Importe As Double = Convert.ToDouble(IIf(ChkGastoRecurrente.Checked, TxtImporteGastoRecurrente.Text, "-1")) + + If HdnCveEvento.Value.ToEntero > 0 Then + If ObjEventos.UpdateEvento(TxtAsuntoAgenda.Text, TxtDescripcionAgenda.Text, DdlPrioridad.SelectedValue.ToEntero, DdlAgedaTipo.SelectedValue.ToEntero, -1, FechaInicio, FechaFin, -1, "-1", HdnCveEvento.Value.ToEntero, "-1", + RecurrenciaTipo, Frecuencia, DiasSemana, Dias, Mes, RecurrenciaFin, Importe:=Importe) Then + Alert("El Evento se actualizó correctamente", TipoMensaje.MsgInformacion) + Else + Alert("Ocurrió un error al actualizar el evento", TipoMensaje.MsgAdvertencia) + End If + Else + If ObjEventos.AddEventoAgenda(DdlAgedaTipo.SelectedValue.ToEntero, TxtAsuntoAgenda.Text, TxtDescripcionAgenda.Text, DdlPrioridad.SelectedValue.ToEntero, FechaInicio, FechaFin, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, + RecurrenciaTipo:=RecurrenciaTipo, Frecuencia:=Frecuencia, DiasSemana:=DiasSemana, Dia:=Dias, Mes:=Mes, RecurrenciaFin:=RecurrenciaFin, CveTipoEvento:=CveTipoEvento, Importe:=Importe) Then + + Alert("El Evento se guardó correctamente", TipoMensaje.MsgInformacion) + Else + Alert("Ocurrió un error al Guardar el evento", TipoMensaje.MsgAdvertencia) + End If + End If + + ObjEventos.Dispose() + RegistraScript("Calendario();SetView();$('#ModalAgenda').modal('hide');", "1234") + LimpiaModalAgenda() + + End Sub + Private Sub LimpiaModalAgenda() + TxtDescripcionAgenda.Text = "" + TxtAsuntoAgenda.Text = "" + DdlPrioridad.SelectedValue = "1" + TxtNumeroOcurrencias.Text = "" + TxtFechaFinRecurrencia.Text = "" + RBFechaFin.Checked = False + RBNumeroOcurrencias.Checked = False + RBLRecurrencia.SelectedValue = "1" + CheckDiasSemana.ClearSelection() + RBLRecurrencia_SelectedIndexChanged(RBLRecurrencia, EventArgs.Empty) + TxtFrecuencia.Text = "1" + LblEmpresaCRM.Text = "" + End Sub + + Protected Sub BtnEliminar_Click(sender As Object, e As EventArgs) + + Dim ObjEventos As New ClsOIEventos + RegistraScript("GetView();") + + If ObjEventos.RemoveEvento(HdnCveEvento.Value.ToEntero, UsuarioActual.CveEmpresa) Then + RegistraScript("Calendario();SetView();$('#ModalAgenda').modal('hide');", "1234") + Alert("El evento se eliminó correctamente", TipoMensaje.MsgInformacion) + Else + Alert("Ocurrió un error al eliminar el evento, por favor intente de nuevo.", TipoMensaje.MsgError) + End If + + ObjEventos.Dispose() + End Sub + + + Public Shared Function EliminaEvento(CveEvento As Integer, CveEmpresa As Integer) As String + Dim ObjEventos As New ClsOIEventos + + ObjEventos.RemoveEvento(CveEvento, CveEmpresa) + + ObjEventos.Dispose() + Return CveEvento.ToString + End Function + + + Public Shared Function ActualizaEvento(ClsEvent As CalendarEvent) As String + Dim ObjEventos As New ClsOIEventos + + Dim FechaInicio = DateTimeOffset.Parse(ClsEvent.start).DateTime + Dim FechaFin = DateTimeOffset.Parse(ClsEvent.end).DateTime + + If ObjEventos.UpdateEvento("-1", "-1", -1, -1, -1, FechaInicio, FechaFin, -1, "-1", ClsEvent.id) Then + End If + + ObjEventos.Dispose() + Return "a" + End Function + Protected Sub RBLRecurrencia_SelectedIndexChanged(sender As Object, e As EventArgs) + Select Case RBLRecurrencia.SelectedValue.ToEntero + Case 1 + LblTextoFrecuencia.Text = "Hora(s)" + TrDiasSemanaAdd.Style("display") = "none" + Case 2 + LblTextoFrecuencia.Text = "Dia(s)" + TrDiasSemanaAdd.Style("display") = "none" + Case 3 + LblTextoFrecuencia.Text = "Semana(s)" + TrDiasSemanaAdd.Style("display") = "block" + + 'Chequea los dias seleccionados en la recurrencia + For Each item As ListItem In CheckDiasSemana.Items + If HdnDiasSemanaAgendar.Value.Contains(item.Value) Then + item.Selected = True + Else + item.Selected = False + End If + Next + Case 4 + LblTextoFrecuencia.Text = "Mes(es)" + TrDiasSemanaAdd.Style("display") = "none" + Case 5 + LblTextoFrecuencia.Text = "Año(s)" + TrDiasSemanaAdd.Style("display") = "none" + Case Else + End Select + UpRecurrencia.Update() + End Sub + Protected Sub BtnActualizaAdd_Click(sender As Object, e As EventArgs) + RBLRecurrencia_SelectedIndexChanged(RBLRecurrencia, EventArgs.Empty) + End Sub +#End Region + + +End Class diff --git a/Sistemas/Usuarios.aspx b/Sistemas/Usuarios.aspx index 734b666dc..5e27abb3f 100644 --- a/Sistemas/Usuarios.aspx +++ b/Sistemas/Usuarios.aspx @@ -42,16 +42,34 @@ +
    +
    + Empresa: +
    +
    + +
    +
    + + - - + +
    Empresa: + Empresa: + Estatus: + + + + + +
    diff --git a/Sistemas/Usuarios.aspx.vb b/Sistemas/Usuarios.aspx.vb index 3bc9a29e5..77a00c22f 100644 --- a/Sistemas/Usuarios.aspx.vb +++ b/Sistemas/Usuarios.aspx.vb @@ -70,7 +70,7 @@ Partial Class Sistemas_Usuarios Public Sub CargaDatos() Dim Usuario As New ClsSisUsuarios - If Usuario.GetUsuarios(-1, -1) Then + If Usuario.GetUsuarios(-1, -1, Estatus:=DdlEsatus.SelectedValue.ToEntero) Then If UsuarioActual.CveRol <> 1 Then DtUsuarios = Usuario.DtResultados.FiltraParametros(String.Format("CveEmpresa = {0} AND CveRol <> 1", DdlEmpresa.SelectedValue)) 'DtUsuarios = Usuario.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index c126a59cd..7a7a9a74b 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -12,9 +12,9 @@ Imports Newtonsoft.Json Imports Newtonsoft.Json.Linq Partial Class Clientes - Inherits ClsPaginas - - 'Configuración + Inherits ClsPaginas + + 'Configuración #Region "P R O P I E D A D E S" Private Const NumeroDecimales As Integer = 2 Private CveVentaDeduccion As Integer @@ -499,10 +499,10 @@ Partial Class Clientes Set(value As String) ViewState("linkDescargaPagare") = value End Set - End Property - + End Property + #End Region - + #Region "Documentacion" Private Property DTDocumentacion As DataTable Get @@ -613,21 +613,21 @@ Partial Class Clientes Set(value As String) ViewState("AdjuntoDocumentacion") = value End Set - End Property - 'Private ReadOnly Property CvePersonal As Integer - ' Get - ' If ViewState("CvePersonal") Is Nothing Then - ' Return -1 - ' Else - ' Return ViewState("CvePersonal").ToString().Toentero() - ' End If - ' End Get - 'End Property - + End Property + 'Private ReadOnly Property CvePersonal As Integer + ' Get + ' If ViewState("CvePersonal") Is Nothing Then + ' Return -1 + ' Else + ' Return ViewState("CvePersonal").ToString().Toentero() + ' End If + ' End Get + 'End Property + #End Region - - - + + + #Region " A C U M U L A D O R E S" Property CveVentaNota As Integer Get @@ -667,10 +667,10 @@ Partial Class Clientes Set(value As String) ViewState("SerieNotaAcumulador") = value End Set - End Property - + End Property + #End Region - + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then @@ -751,10 +751,10 @@ Partial Class Clientes If UsuarioActual.Empresa.Funcionalidad(350).Contiene("1", "2") Then divRegimen.Visible = True - End If - - If UsuarioActual.CveEmpresa.Contiene(1) Or UsuarioActual.Empresa.Funcionalidad(531) = "1" Then - DivRepresentanteLegal.Visible = True + End If + + If UsuarioActual.CveEmpresa.Contiene(1) Or UsuarioActual.Empresa.Funcionalidad(531) = "1" Then + DivRepresentanteLegal.Visible = True End If If Request("CveCliente") IsNot Nothing AndAlso IsNumeric(Request("CveCliente")) AndAlso Request("CveCliente").ToEntero() > 0 Then @@ -924,10 +924,10 @@ Partial Class Clientes ChkPermiso5.Enabled = False ChkPermiso6.Enabled = False - End Sub - + End Sub + #Region " PERMISOS PAGINAS " - + Private Sub MostrarTxtDireccionesClienteEnvio() If UsuarioActual.CveEmpresa.Contiene(72, 80, 146) Then @@ -964,18 +964,18 @@ Partial Class Clientes If Not ChkEsDistribuidor.Checked Then BtnGuardar.Visible = PermiteEditar() End If - End Sub - - + End Sub + + #End Region - - + + #Region "C A R G A S" - - - - - + + + + + Private Sub CreaDtPago() DtPagos = New DataTable DtPagos.Columns.Add("CveTipoMovimiento", GetType(String)) @@ -1093,13 +1093,13 @@ Partial Class Clientes End Sub - Private Sub CargaSubProyectosSuscursales() - - - CargarCentrosDeCosto(Nothing, DdlSubProyectoClienteSucursal, Nothing, LblSubProyectoClienteSucursal) - - - + Private Sub CargaSubProyectosSuscursales() + + + CargarCentrosDeCosto(Nothing, DdlSubProyectoClienteSucursal, Nothing, LblSubProyectoClienteSucursal) + + + End Sub @@ -1169,9 +1169,9 @@ Partial Class Clientes Select Case HdnCuenta.Value Case "1" - CargaDdlCuentasContables(DdlCtaContableClientes, 1)'UsuarioActual.Empresa.Funcionalidad(246).Toentero() + CargaDdlCuentasContables(DdlCtaContableClientes, 1)'UsuarioActual.Empresa.Funcionalidad(246).Toentero() Case "2" - CargaDdlCuentasContables(DdlCtaContableAnticipos, 1)' UsuarioActual.Empresa.Funcionalidad(237).Toentero() + CargaDdlCuentasContables(DdlCtaContableAnticipos, 1)' UsuarioActual.Empresa.Funcionalidad(237).Toentero() Case "3" CargaDdlCuentasContables(DdlCtaContableRetIVA, -1) Case "4" @@ -1179,11 +1179,11 @@ Partial Class Clientes Case "5" CargaDdlCuentasContables(DdlCtaContableFondoGarantia, -1) Case "6" - CargaDdlCuentasContables(DdlCtaContableCompClientes, 1)'UsuarioActual.Empresa.Funcionalidad(248).Toentero() + CargaDdlCuentasContables(DdlCtaContableCompClientes, 1)'UsuarioActual.Empresa.Funcionalidad(248).Toentero() Case "7" CargaDdlCuentasContables(DdlCtaContableCompAnticipos, -1) Case "8" - CargaDdlCuentasContables(DdlMonedaExtranjeraClientes, 1)'UsuarioActual.Empresa.Funcionalidad(247).Toentero() + CargaDdlCuentasContables(DdlMonedaExtranjeraClientes, 1)'UsuarioActual.Empresa.Funcionalidad(247).Toentero() Case "9" CargaDdlCuentasContables(DdlMonedaExtranjeraAnticipos, 1) 'UsuarioActual.Empresa.Funcionalidad(542).Toentero() End Select @@ -1460,14 +1460,14 @@ Partial Class Clientes ' CargaDocs() CargaCombos() CargaDocumentacionCliente() - CargaSubProyectosSuscursales() - 'CargaMetodosPago33() - 'CargaFormaPago33() - 'CargaComboCFDI() - 'CargarPagosNoBancarios() - - - + CargaSubProyectosSuscursales() + 'CargaMetodosPago33() + 'CargaFormaPago33() + 'CargaComboCFDI() + 'CargarPagosNoBancarios() + + + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then LnkPorcentajeMarcas.Visible = True LnkPorcentajePrecios.Visible = True @@ -1874,11 +1874,11 @@ Partial Class Clientes End If - RdTipoPersona.SelectedValue = If(ObjClientes.TipoPersona, "1", "0") - RdTipoPersona_SelectedIndexChanged(Nothing, Nothing) - - TxtRepresentanteLegal.Text = ObjClientes.RepresentanteLegal - + RdTipoPersona.SelectedValue = If(ObjClientes.TipoPersona, "1", "0") + RdTipoPersona_SelectedIndexChanged(Nothing, Nothing) + + TxtRepresentanteLegal.Text = ObjClientes.RepresentanteLegal + End If UpActivacionPortal.Update() UpModalPersonaFisica.Update() @@ -2079,31 +2079,31 @@ Partial Class Clientes DdlSucursalFormaPago33.DataSource = GlobalDTVtaFormaPago DdlSucursalFormaPago33.DataBind() End Sub - Private Sub CargaComboCFDI() - Dim RegimenFiscalCliente = DdlRegimenFiscal.SelectedValue.ToString() - If Not UsuarioActual.Empresa.Funcionalidad(350).Contiene("1", "2") Then - RegimenFiscalCliente = "-1" - End If + Private Sub CargaComboCFDI() + Dim RegimenFiscalCliente = DdlRegimenFiscal.SelectedValue.ToString() + If Not UsuarioActual.Empresa.Funcionalidad(350).Contiene("1", "2") Then + RegimenFiscalCliente = "-1" + End If DdlUsoCFDI.Items.Clear() - If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then - Dim EsPersonaMoral As Boolean = (RdTipoPersona.SelectedValue = "1") - DdlUsoCFDI.DataSource = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente) - Else - DdlUsoCFDI.DataSource = GlobalDTSATUsosCFDI(UsuarioActual.Empresa.EsPersonaFisica, RegimenFiscalReceptor:=RegimenFiscalCliente) - End If - + If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then + Dim EsPersonaMoral As Boolean = (RdTipoPersona.SelectedValue = "1") + DdlUsoCFDI.DataSource = GlobalDTSATUsosCFDI(If(Not EsPersonaMoral, 1, 0), RegimenFiscalReceptor:=RegimenFiscalCliente) + Else + DdlUsoCFDI.DataSource = GlobalDTSATUsosCFDI(UsuarioActual.Empresa.EsPersonaFisica, RegimenFiscalReceptor:=RegimenFiscalCliente) + End If + DdlUsoCFDI.DataBind() DdlUsoCFDI.Items.Insert(0, New ListItem("Seleccione", "-1")) DdlSucursalUsoCFDI.Items.Clear() DdlSucursalUsoCFDI.DataSource = GlobalDTSATUsosCFDI(UsuarioActual.Empresa.EsPersonaFisica, RegimenFiscalReceptor:=RegimenFiscalCliente) DdlSucursalUsoCFDI.DataBind() - End Sub + End Sub #End Region - + #Region "V E R M Á S" - + Protected Sub BtnVerMasVentas_Click(sender As Object, e As EventArgs) If BtnVerMasVentas.Text = "Ver Más" Then CargaHistorial(-1) @@ -2133,12 +2133,12 @@ Partial Class Clientes CargaBancos(51) BtnVerMasBancos.Text = "Ver Más" End If - End Sub - + End Sub + #End Region - + #Region "B A N C O S" - 'CuentasxCobrar Activas (Pagos Recibidos) + 'CuentasxCobrar Activas (Pagos Recibidos) Private Sub CargaBancos(Optional SelectTop As Integer = 51, Optional CveClienteSucursal As Integer = -1) Dim ObjMovtos As New ClsMovimientos() 'CxC Activas @@ -2201,9 +2201,9 @@ Partial Class Clientes TxtParaMail.Text = TxtCobranzaCorreo.Text UpSendMail.Update() RegistraScript("$('#ModalDivMail').modal('show');") - End Sub + End Sub #End Region - + #Region "B T N ´ S" Protected Sub BtnEliminar_Click(sender As Object, e As System.EventArgs) Handles BtnEliminar.Click Dim ObjClientes As New ClsClientes() @@ -2487,34 +2487,34 @@ Partial Class Clientes If UsuarioActual.Empresa.Funcionalidad(350).Contiene("1", "2") Then - If TxtRFC.Text.ToUpper.Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlRegimenFiscal.SelectedValue <> "11" Then - - Alert("El Regimen fiscal del cliente debe ser '616 - Sin obligaciones fiscales' cuando se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia) - Exit Sub - - End If - - If TxtRFC.Text.ToUpper.Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlUsoCFDI.SelectedValue <> "23" Then - - Alert("El Regimen fiscal del cliente debe ser 'S01 - Sin efectos fiscales' cuando se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia) - Exit Sub - - End If - - - End If - - 'CargaSucursal() - 'If UsuarioActual.TienePermisoProceso(170) AndAlso TxtCodigo.Text.Trim = "" Then - ' Alert("Es necesario ingresar un Código", TipoMensaje.MsgAdvertencia) - ' Exit Sub - 'End If - - 'Dim rowcodigo As DataTable = GlobalDTCliente.FiltraParametros(String.Format("Codigo='{0}' AND CveEmpresa={1} ", TxtCodigo.Text.Trim, UsuarioActual.CveEmpresa)) - 'If (Not IsNothing(rowcodigo)) AndAlso (rowcodigo.Rows.Count > 0) AndAlso (rowcodigo.Rows(0)("CveCliente").ToString().Toentero() <> CveCliente) Then - ' Alert(String.Format("ya existe un Cliente Con este Codigo '{0}'", TxtCodigo.Text.Trim), TipoMensaje.MsgAdvertencia) - ' Exit Sub - 'End If + If TxtRFC.Text.ToUpper.Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlRegimenFiscal.SelectedValue <> "11" Then + + Alert("El Regimen fiscal del cliente debe ser '616 - Sin obligaciones fiscales' cuando se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia) + Exit Sub + + End If + + If TxtRFC.Text.ToUpper.Contiene("XAXX010101000", "XEXX010101000") AndAlso DdlUsoCFDI.SelectedValue <> "23" Then + + Alert("El Regimen fiscal del cliente debe ser 'S01 - Sin efectos fiscales' cuando se utiliza el RFC genérico.", TipoMensaje.MsgAdvertencia) + Exit Sub + + End If + + + End If + + 'CargaSucursal() + 'If UsuarioActual.TienePermisoProceso(170) AndAlso TxtCodigo.Text.Trim = "" Then + ' Alert("Es necesario ingresar un Código", TipoMensaje.MsgAdvertencia) + ' Exit Sub + 'End If + + 'Dim rowcodigo As DataTable = GlobalDTCliente.FiltraParametros(String.Format("Codigo='{0}' AND CveEmpresa={1} ", TxtCodigo.Text.Trim, UsuarioActual.CveEmpresa)) + 'If (Not IsNothing(rowcodigo)) AndAlso (rowcodigo.Rows.Count > 0) AndAlso (rowcodigo.Rows(0)("CveCliente").ToString().Toentero() <> CveCliente) Then + ' Alert(String.Format("ya existe un Cliente Con este Codigo '{0}'", TxtCodigo.Text.Trim), TipoMensaje.MsgAdvertencia) + ' Exit Sub + 'End If Dim ObjClientes As New ClsClientes() Dim objDoc As New ClsEdocumentacion(ObjClientes.IniciaTransacSQL()) Dim MsgCuentaContable As String = "" @@ -2545,85 +2545,85 @@ Partial Class Clientes Dim errorContPaq As Boolean = False Dim IdContPaqi As Integer = 0 - Dim CodigoPersona As Integer = 0 - - + Dim CodigoPersona As Integer = 0 + + #Region "comentado" - 'If UsuarioActual.Empresa.Funcionalidad(522).ToString() = "1" Then - - ' Dim ObjContPaqi As New ClsContPAQi(UsuarioActual.Empresa) - - ' If ObjContPaqi.GetPersona(TxtRFC.Text) Then - - ' If ObjContPaqi.DtResultados.Rows.Count > 0 Then - - ' IdContPaqi = ObjContPaqi.DtResultados.Rows(0)("Id").ToString().Toentero() - ' CodigoPersona = ObjContPaqi.DtResultados.Rows(0)("Codigo").ToString().Toentero() - - ' Dim Cont_EsProveedor As Integer = If(Boolean.Parse(ObjContPaqi.DtResultados.Rows(0)("EsProveedor").ToString()), 1, 0) - ' Dim Cont_Nombre As String = ObjContPaqi.DtResultados(0)("Nombre").ToString() - ' Dim Cont_RFC As String = ObjContPaqi.DtResultados(0)("RFC").ToString() - - ' If ObjContPaqi.UpdatePersona(IdContPaqi, Cont_Nombre, Cont_RFC, 1, Cont_EsProveedor) Then - ' errorContPaq = False - ' Else - ' errorContPaq = True - ' End If - - ' Else - ' If ObjContPaqi.AddPersona(TxtNombre.Text.Trim, TxtRFC.Text.Trim, 1, 0) Then - - ' IdContPaqi = ObjContPaqi.DtResultados.Rows(0)("IdContPaqiPersona").ToString().Toentero() - ' CodigoPersona = ObjContPaqi.DtResultados.Rows(0)("Codigo").ToString().Toentero() - ' errorContPaq = False - ' Else - ' errorContPaq = True - ' End If - ' End If - ' End If - - - ' If Not errorContPaq Then - ' Dim IdContPaqiCliente As Integer - - ' If ObjContPaqi.GetCliente(-1, CodigoPersona) Then - - ' If ObjContPaqi.DtResultados.Rows.Count > 0 Then - - ' IdContPaqiCliente = ObjContPaqi.DtResultados.Rows(0)("IdContPaqiClient").ToString().Toentero() - - ' If ObjContPaqi.UpdateCliente(IdContPaqiCliente, CodigoPersona, CodigoPersona, "", "") Then - ' errorContPaq = False - ' Else - ' errorContPaq = True - ' End If - ' Else - ' If ObjContPaqi.AddCliente(CodigoPersona, CodigoPersona, "", "") Then - ' errorContPaq = False - ' Else - ' errorContPaq = True - ' End If - ' End If - ' Else - ' errorContPaq = True - ' End If - ' End If - - - ' If Not errorContPaq Then - ' ObjContPaqi.Commit() - ' ObjContPaqi.Dispose() - ' Else - ' ObjContPaqi.RollBack() - ' ObjContPaqi.Dispose() - ' Alert("Se presento un error al guardar en ContPAQi", TipoMensaje.MsgError) - ' Exit Sub - ' End If - - - 'End If + 'If UsuarioActual.Empresa.Funcionalidad(522).ToString() = "1" Then + + ' Dim ObjContPaqi As New ClsContPAQi(UsuarioActual.Empresa) + + ' If ObjContPaqi.GetPersona(TxtRFC.Text) Then + + ' If ObjContPaqi.DtResultados.Rows.Count > 0 Then + + ' IdContPaqi = ObjContPaqi.DtResultados.Rows(0)("Id").ToString().Toentero() + ' CodigoPersona = ObjContPaqi.DtResultados.Rows(0)("Codigo").ToString().Toentero() + + ' Dim Cont_EsProveedor As Integer = If(Boolean.Parse(ObjContPaqi.DtResultados.Rows(0)("EsProveedor").ToString()), 1, 0) + ' Dim Cont_Nombre As String = ObjContPaqi.DtResultados(0)("Nombre").ToString() + ' Dim Cont_RFC As String = ObjContPaqi.DtResultados(0)("RFC").ToString() + + ' If ObjContPaqi.UpdatePersona(IdContPaqi, Cont_Nombre, Cont_RFC, 1, Cont_EsProveedor) Then + ' errorContPaq = False + ' Else + ' errorContPaq = True + ' End If + + ' Else + ' If ObjContPaqi.AddPersona(TxtNombre.Text.Trim, TxtRFC.Text.Trim, 1, 0) Then + + ' IdContPaqi = ObjContPaqi.DtResultados.Rows(0)("IdContPaqiPersona").ToString().Toentero() + ' CodigoPersona = ObjContPaqi.DtResultados.Rows(0)("Codigo").ToString().Toentero() + ' errorContPaq = False + ' Else + ' errorContPaq = True + ' End If + ' End If + ' End If + + + ' If Not errorContPaq Then + ' Dim IdContPaqiCliente As Integer + + ' If ObjContPaqi.GetCliente(-1, CodigoPersona) Then + + ' If ObjContPaqi.DtResultados.Rows.Count > 0 Then + + ' IdContPaqiCliente = ObjContPaqi.DtResultados.Rows(0)("IdContPaqiClient").ToString().Toentero() + + ' If ObjContPaqi.UpdateCliente(IdContPaqiCliente, CodigoPersona, CodigoPersona, "", "") Then + ' errorContPaq = False + ' Else + ' errorContPaq = True + ' End If + ' Else + ' If ObjContPaqi.AddCliente(CodigoPersona, CodigoPersona, "", "") Then + ' errorContPaq = False + ' Else + ' errorContPaq = True + ' End If + ' End If + ' Else + ' errorContPaq = True + ' End If + ' End If + + + ' If Not errorContPaq Then + ' ObjContPaqi.Commit() + ' ObjContPaqi.Dispose() + ' Else + ' ObjContPaqi.RollBack() + ' ObjContPaqi.Dispose() + ' Alert("Se presento un error al guardar en ContPAQi", TipoMensaje.MsgError) + ' Exit Sub + ' End If + + + 'End If #End Region - + Dim LT As String = If(HDLT.Value.ToDouble <> 0, HDLT.Value, "0") Dim LG As String = If(HDLG.Value.ToDouble <> 0, HDLG.Value, "0") @@ -2874,11 +2874,11 @@ Partial Class Clientes ObjClientes.Dispose() objDoc.Dispose() RecargaGlobal() - End Sub - + End Sub + #End Region - - + + #Region "G L O B L A L" Private Sub RecargaGlobal() 'Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDT) @@ -2892,10 +2892,10 @@ Partial Class Clientes ' Application("GlobalDTCliente") = Objclientes.DtResultados 'End If 'Objclientes.Dispose() - End Sub + End Sub #End Region - - + + #Region "G R I D V I E W S" Protected Sub GVHistorial_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVHistorial.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then @@ -3056,11 +3056,11 @@ Partial Class Clientes End If End If - End Sub + End Sub #End Region - + #Region "R H" - + Private Sub CargaPersonalAsignado() Dim ObjPersonal As New ClsRH If ObjPersonal.GetPersonal(-1, "-1", "-1", "-1", "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, CveCliente, "-1", -1, -1, -1, -1, -1, -1, "-1", "-1", "-1", "-1", UsuarioActual.CveEmpresa) Then @@ -3133,9 +3133,9 @@ Partial Class Clientes End If End If - End Sub + End Sub #End Region - + #Region "S U C U R S A L E S" Private Sub LbAgregarSucursal_Click(sender As Object, e As EventArgs) Handles LbAgregarSucursal.Click ChkEstatusSucursal.Checked = True @@ -3267,7 +3267,7 @@ Partial Class Clientes UpModalDivMapa.Update() - End Sub + End Sub #Region "G V S U C U R S A L E S" Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVSucursales.RowDataBound @@ -3389,9 +3389,9 @@ Partial Class Clientes Else CargaGrid("", 0) End If - End Sub + End Sub #End Region - + #Region "G V U S U A R I O S P O R T A L" Protected Sub GvUsuariosPortal_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GvUsuariosPortal.RowCommand If e.CommandName = "RestablecerContraseña" Then @@ -3543,9 +3543,9 @@ Partial Class Clientes CargaGrid("", 1) End If - End Sub + End Sub #End Region - + #Region "O R D E N A M I E N T O" Private Sub CargaGrid(Orden As String, gvi As Integer) If gvi = 0 Then @@ -3577,12 +3577,12 @@ Partial Class Clientes UPPUsuarios.Update() End If - End Sub + End Sub #End Region - - + + #End Region - + #Region "U S U A R I O S" Protected Sub LbSolicitudPortal_Click(sender As Object, e As EventArgs) Handles LbEnviarActivacionPortal.Click Dim ObjUsuario As New ClsSisUsuarios @@ -3764,9 +3764,9 @@ Partial Class Clientes ChkPermiso5.Checked = False ChkPermiso6.Checked = False ChkPermiso7.Checked = False - End Sub + End Sub #End Region - + #Region "E V E N T O - B I T A C O R A" Protected Sub GVEventoBitacora_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvEB.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then @@ -3913,17 +3913,17 @@ Partial Class Clientes IdCtaContableRetISR = IdCuentaContable End Select - If CveCliente > 0 Then - Dim ObjClientes As New ClsClientes - If Not ObjClientes.VincularCuentasContables(IdCtaContableClientes, IdCtaContableAnticipos, IdCtaContableRetIVA, IdCtaContableRetISR, CveCliente) Then - TieneError = True - End If - - ObjClientes.Dispose() - End If - - - + If CveCliente > 0 Then + Dim ObjClientes As New ClsClientes + If Not ObjClientes.VincularCuentasContables(IdCtaContableClientes, IdCtaContableAnticipos, IdCtaContableRetIVA, IdCtaContableRetISR, CveCliente) Then + TieneError = True + End If + + ObjClientes.Dispose() + End If + + + Else TieneError = True End If @@ -3975,11 +3975,11 @@ Partial Class Clientes BtnActivaRegistroISR.Visible = True End If - End Sub + End Sub #End Region - + #Region " I M P R I M I R P D F" - + Protected Sub ChkAntIXCNC_CheckedChanged(sender As Object, e As EventArgs) DdlTipoDocto.ClearSelection() If ChkAntIXCNC.Checked Then @@ -4216,20 +4216,20 @@ Partial Class Clientes
    Gracias por la atención brindada al presente.
    Reciba un cordial saludo.

    - ESTE CORREO SE GENERO EN FORMA AUTOMATICA.", TxtNombreComercial.Text, UsuarioActual.Empresa.Empresa) - - If UsuarioActual.CveEmpresa = 140 Then + ESTE CORREO SE GENERO EN FORMA AUTOMATICA.", TxtNombreComercial.Text, UsuarioActual.Empresa.Empresa) + + If UsuarioActual.CveEmpresa = 140 Then Cuerpo = String.Format("Estimado cliente {0}, se anexa su estado de cuenta con adeudo actual en {1}.

    Quedamos a sus ordenes para cualquier duda o aclaración: con su asesor comercial, al teléfono celular del área de Crédito y Cobranza 6624 52 99 64 o a los correos:

    - credito@bdhbaterias.com
    + credito@bdhbaterias.com
    cobranza@bdhbaterias.com

    Gracias por la atención brindada al presente.
    Reciba un cordial saludo.

    - ESTE CORREO SE GENERO EN FORMA AUTOMATICA, FAVOR DE NO RESPONDERLO.", TxtNombreComercial.Text, UsuarioActual.Empresa.Empresa) + ESTE CORREO SE GENERO EN FORMA AUTOMATICA, FAVOR DE NO RESPONDERLO.", TxtNombreComercial.Text, UsuarioActual.Empresa.Empresa) End If Dim Hilo As New System.Threading.Thread(Sub() MandaCorreoEstadoCuenta(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, Me.CveCliente, File, TxtCobranzaCorreo.Text, $"Estado Actual de Cartera en {UsuarioActual.Empresa.Empresa}", Cuerpo, GuardarBitacora:=True)) Hilo.Start() @@ -4315,9 +4315,9 @@ Partial Class Clientes End Using End If - End Sub + End Sub #End Region - + #Region "E N V I O C O R R E O" Private Sub EnviaCorreo(Liga As String, LigaActivar As String) @@ -4385,11 +4385,11 @@ Partial Class Clientes a.GuardaLog() Dim Mail As New ClsSisMail() Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body) - End Sub + End Sub #End Region - + #Region " COTIZACIONES " - + Protected Sub BtnVerMasCot_Click(sender As Object, e As EventArgs) If BtnVerMasCot.Text = "Ver Más" Then CargaCotizaciones(-1) @@ -4459,11 +4459,11 @@ Partial Class Clientes HLFacturar.HRef = $"/Ventas/Ventas.aspx?CveCotizacion={e.Row.DBCampo("CveVenta")}" End If End If - End Sub + End Sub #End Region - + #Region "D I R E C C I O N E N V I O " - + Private Sub CargaCombosDirecionesClientesSAT() CargaDirClientePais() CargaDirClienteEstado() @@ -4577,32 +4577,32 @@ Partial Class Clientes CargaDirClienteEstado() DdlDirClienteEstado.SelectedValueExist(GvRow.DataKey("CveEstado")) CargaDirClienteMunicipio() - DdlDirClienteMunicipio.SelectedValueExist(GvRow.DataKey("CveMunicipio")) - - + DdlDirClienteMunicipio.SelectedValueExist(GvRow.DataKey("CveMunicipio")) + + CargaDirClienteLocalidad() - DdlDirClienteLocalidad.SelectedValueExist(GvRow.DataKey("CveLocalidad")) - - - CargaDirClienteColonia() + DdlDirClienteLocalidad.SelectedValueExist(GvRow.DataKey("CveLocalidad")) + + + CargaDirClienteColonia() DdlDirClienteColonia.SelectedValueExist(GvRow.DataKey("CveColonia")) - ChkEstatus.Checked = If(GvRow.DataKey("Estatus").ToString() = "True", True, False) - - If GvRow.DataKey("CveClienteSucursal").ToEntero() > 0 Then - DdlClienteSucursalEnvio.SelectedValueExist(GvRow.DataKey("CveClienteSucursal")) - Else + ChkEstatus.Checked = If(GvRow.DataKey("Estatus").ToString() = "True", True, False) + + If GvRow.DataKey("CveClienteSucursal").ToEntero() > 0 Then + DdlClienteSucursalEnvio.SelectedValueExist(GvRow.DataKey("CveClienteSucursal")) + Else DdlClienteSucursalEnvio.SelectedValueExist("-1") - End If - - - Dim CveSubProyectoClienteSucursal As Integer = GvRow.DataKey("CveSubProyecto").ToEntero - - DdlSubProyectoClienteSucursal.SelectedValueExist("-1") - If CveSubProyectoClienteSucursal > 0 Then - DdlSubProyectoClienteSucursal.SelectedValueExist(CveSubProyectoClienteSucursal) - End If - + End If + + + Dim CveSubProyectoClienteSucursal As Integer = GvRow.DataKey("CveSubProyecto").ToEntero + + DdlSubProyectoClienteSucursal.SelectedValueExist("-1") + If CveSubProyectoClienteSucursal > 0 Then + DdlSubProyectoClienteSucursal.SelectedValueExist(CveSubProyectoClienteSucursal) + End If + UpAddDireccion.Update() RegistraScript("$('#divAddDireccionEnvio').modal();") End Sub @@ -4648,7 +4648,7 @@ Partial Class Clientes TxtEnvioTel.Text = "" DdlClienteSucursalEnvio.SelectedValue = "-1" - CargaCombosDirecionesClientesSAT() + CargaCombosDirecionesClientesSAT() DdlSubProyectoClienteSucursal.SelectedValueExist("-1") 'DdlDirClientePais.SelectedValueExist(-1) @@ -4678,12 +4678,12 @@ Partial Class Clientes End If CargaDireccionesEnvio() - End Sub - + End Sub + #End Region - + #Region " IMPORTAR SALDOS " - + Private Sub HLImportarSaldos_Click(sender As Object, e As EventArgs) Handles HLImportarSaldos.Click CargaClientesImportarSaldos() RegistraScript(String.Format("$('#{0}').modal();", "DivImportarSaldos")) @@ -4787,9 +4787,9 @@ Partial Class Clientes e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("ChkSaldo(this,{0},{1});", e.Row.FCTextBox("TxtImporte").ClientID, e.Row.DBCampo("Saldo"))) e.Row.FCTextBox("TxtImporte").Attributes.Add("onKeyUp", String.Format("CambiaSaldo({0},this,{1});", e.Row.FCCheckBox("Chk").ClientID, e.Row.DBCampo("Saldo"))) End If - End Sub + End Sub #End Region - + #Region "Cuentas/Equipos" Public Sub BtnAgregarCtaEquipo_Click(sender As Object, e As EventArgs) HdnModalidad.Value = "I" @@ -5377,9 +5377,9 @@ Partial Class Clientes End If Return Retorno - End Function + End Function #End Region - + #Region "GPS" Protected Sub btnCargaArrayDisp_Click(sender As Object, e As EventArgs) Handles btnCargaArrayDisp.Click If hdnArrayDispositivo.Value.Length > 0 Then @@ -5520,10 +5520,10 @@ Partial Class Clientes UpMoverDispositivo.Update() RegistraScript($"CargaModalMoverDispositivo({GvRow.DataKey("CveDispositivo")});") - End Sub - + End Sub + #End Region - + #Region "Sucursales" Public Sub CreaDTSucursales() @@ -5757,14 +5757,14 @@ Partial Class Clientes End If End If End If - End Sub - + End Sub + #End Region - + #Region "G P S" - - - + + + Private Sub EnviaCorreoGPS(Liga As String, LigaActivar As String) Try @@ -5835,16 +5835,16 @@ Partial Class Clientes End If ObjClientes.Dispose() - End Sub - - + End Sub + + #End Region - + #Region "C O N T R A T O S" - - - - + + + + Private Sub CargaDatosContrato() If CveCliente <= 0 Then Exit Sub @@ -5889,10 +5889,10 @@ Partial Class Clientes e.Row.CssClass = "Totales white" End If End If - End Sub - + End Sub + #End Region - + #Region "M E T O D O S " Protected Sub RblTipo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RblTipo.SelectedIndexChanged If DTHistorialVentas IsNot Nothing AndAlso RblTipo.SelectedValue <> "-1" Then @@ -6302,13 +6302,13 @@ Partial Class Clientes End If - End Sub - + End Sub + #End Region - + #Region "IMPRIMIR GVHistorial" - - + + Protected Sub BtnExcelHistorial_Click(sender As Object, e As EventArgs) Dim retorno As Byte() = Nothing Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) @@ -6391,18 +6391,18 @@ Partial Class Clientes ObjClientes.Dispose() Return retorno - End Function - - + End Function + + #End Region - + #Region "C O B R A N Z A" Public Sub Visitas_Click(sender As Object, e As EventArgs) RegistraScript(String.Format("$('#{0}').modal();", "DivVisitas")) - End Sub - + End Sub + #End Region - + #Region "Usuarios" Protected Sub GvUsuarios_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvUsuarios.RowDeleting Dim CveUsuario As Integer = GvUsuarios.Rows(e.RowIndex).DataKey("CveUsuario").ToEntero() @@ -6437,12 +6437,12 @@ Partial Class Clientes e.Row.Cells(5).Visible = False End If End If - End Sub + End Sub #End Region - - + + #Region "C U E N T A S - B A N C A R I A S" - + Private Sub CargaCuentasBancarias(Optional RecargaGlobal As Boolean = False) If CveCliente <= 0 Then Exit Sub @@ -6615,8 +6615,8 @@ Partial Class Clientes TxtNumeroCuenta2.Text = "" TxtConvenioCIE2.Text = "" TxtReferencia2.Text = "" - End Sub - + End Sub + #Region "GRIDVIEW - CUENTAS BANCARIAS" Protected Sub GvBancosCuentas_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvBancosCuentas.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then @@ -6672,10 +6672,10 @@ Partial Class Clientes GlobalDTCuentasDepositosClientes(UsuarioActual.CveEmpresa, -1, True) = Nothing End If - End Sub - + End Sub + #End Region - + Private Sub CargaPSGridCuentasBancos() If CveCliente > 0 Then GvBancosCuentas.DataSource = DTCuentasBancos @@ -6733,9 +6733,9 @@ Partial Class Clientes divestatus.Visible = True UpAddBancos.Update() RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddCuentasBancarias")) - End Sub + End Sub #End Region - + #Region "C L I E N T E S P A G O S R E A L I Z A D O S I M P R I M I R P D F/Excel" Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkPagosClientesBancosExcel.Click GenerarPDF("Excel") @@ -6761,11 +6761,11 @@ Partial Class Clientes ImprimirPDF("Empresas\Grales\Formatos\RepClientesPagosBancos.rdlc", DTCobrosRealizados, params, "RepClientesPagosBancos_" & Now.ToString("yyyyMMddhhmmss"), Formato:=Formato) - End Sub + End Sub #End Region - + #Region "VENTAS" - + Public Function imprimirFacturaVenta(CveVenta As Integer) As Byte() Dim ObjVentas As New ClsVentas Dim Vta As Modelos.Factura = Nothing @@ -6996,10 +6996,10 @@ Partial Class Clientes ObjVentas.Dispose() Return PdfFactura(Vta) - End Function - + End Function + #End Region - + #Region "COMERCIO EXTERIOR" Public Sub CargaCombosComercioExterior() @@ -7123,12 +7123,12 @@ Partial Class Clientes End Sub Protected Sub DdlMunicipio_SelectedIndexChanged(sender As Object, e As EventArgs) CargaColonia() - End Sub - + End Sub + #End Region - + #Region "D O C U M E N T A C I O N " - + Private Sub CargaDocumentacionCliente() Dim objRH As New ClsEdocumentacion() @@ -7423,9 +7423,9 @@ Partial Class Clientes Dim stringDescargaDocumento As String = "" - If GvRow.DataKey("Documentacion") = "Pagaré" AndAlso UsuarioActual.CveEmpresa = 140 Then - - + If GvRow.DataKey("Documentacion") = "Pagaré" AndAlso UsuarioActual.CveEmpresa = 140 Then + + stringDescargaDocumento = UsuarioActual.Empresa.Ruta & "Formatos\Pagaré.docx" linkDescargaPagare = stringDescargaDocumento TxtDireccionAval.Text = "" @@ -7462,64 +7462,89 @@ Partial Class Clientes Protected Sub ImprimirPagare(sender As Object, e As EventArgs) Handles BtnAgregarPagare.Click Dim memoryStreamDoc As New System.IO.MemoryStream - Dim objGemBoxDocument As New clsGemBoxDocument(linkDescargaPagare) - Dim Tags As New List(Of TagsDocumentos) - Dim ObjClientes As New ClsClientes - Dim monto As String = "" - Dim razonSocial As String = "" - Dim direccion As String = "" - Dim ciudad As String = "" - Dim Telefono As String = "" - Dim mesArray = New String() {"Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"} - Dim hoy As DateTime = DateTime.Now - Dim fechaConFormato As String = String.Format("{0} de {1} del {2}", hoy.Day, mesArray(hoy.Month), hoy.Year) - - If ObjClientes.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then - monto = ObjClientes.DtResultados.FiltroPrimeroValor("LimiteCredito").ToDouble.ToString("N") - razonSocial = ObjClientes.DtResultados.FiltroPrimeroValor("NombreComercial") - direccion = ObjClientes.DtResultados.FiltroPrimeroValor("Direccion") - ciudad = ObjClientes.DtResultados.FiltroPrimeroValor("Ciudad") - Telefono = ObjClientes.DtResultados.FiltroPrimeroValor("Telefono") - End If - - Tags.Add(New TagsDocumentos("{Monto}", monto)) - Tags.Add(New TagsDocumentos("{Fecha}", fechaConFormato)) - Tags.Add(New TagsDocumentos("{FechaConFormato}", fechaConFormato)) - Tags.Add(New TagsDocumentos("{CantidadLetra}", monto.ToDouble.Texto2Letras(1))) - Tags.Add(New TagsDocumentos("{RazonSocial}", razonSocial)) - Tags.Add(New TagsDocumentos("{Direccion}", direccion)) - Tags.Add(New TagsDocumentos("{Ciudad}", ciudad)) - Tags.Add(New TagsDocumentos("{Telefono}", Telefono)) - Tags.Add(New TagsDocumentos("{RazonSocialAval}", TxtAval.Text)) - Tags.Add(New TagsDocumentos("{DireccionAval}", TxtDireccionAval.Text)) - Tags.Add(New TagsDocumentos("{CiudadAval}", TxtCiudadAval.Text)) - Tags.Add(New TagsDocumentos("{TelefonoAval}", TxtTelefonoAval.Text)) - Tags.Add(New TagsDocumentos("{RepresentanteLegal}", TxtRepresentanteLegal.Text)) - - - - If Not ObjClientes.AddClientePagare(CveCliente, UsuarioActual.CveEmpresa, TxtAval.Text, TxtDireccionAval.Text) Then - Alert("no se pudo registrar el pagare") + If Not File.Exists(linkDescargaPagare) Then + Alert("No existe el formato", TipoMensaje.MsgAdvertencia) Exit Sub End If + Dim objGemBoxDocument As New clsGemBoxDocument(linkDescargaPagare) + Dim Tags As New List(Of TagsDocumentos) + + Dim ObjClientes As New ClsClientes + Dim TieneError As Boolean = False + + Try + Dim monto As String = "" + Dim razonSocial As String = "" + Dim direccion As String = "" + Dim colonia As String = "" + Dim noInt As String = "" + Dim noExt As String = "" + Dim ciudad As String = "" + Dim estado As String = "" + Dim Telefono As String = "" + Dim mesArray = New String() {"Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"} + Dim hoy As DateTime = DateTime.Now + Dim fechaConFormato As String = String.Format("{0} de {1} del {2}", hoy.Day, mesArray(hoy.Month), hoy.Year) + + If ObjClientes.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then + monto = ObjClientes.DtResultados.FiltroPrimeroValor("LimiteCredito").ToDouble.ToString("N") + razonSocial = ObjClientes.DtResultados.FiltroPrimeroValor("NombreComercial") + direccion = ObjClientes.DtResultados.FiltroPrimeroValor("Direccion") + colonia = ObjClientes.DtResultados.FiltroPrimeroValor("Colonia") + noInt = ObjClientes.DtResultados.FiltroPrimeroValor("NoInt") + noExt = ObjClientes.DtResultados.FiltroPrimeroValor("NoExt") + ciudad = ObjClientes.DtResultados.FiltroPrimeroValor("Ciudad") + estado = ObjClientes.DtResultados.FiltroPrimeroValor("Estado") + Telefono = ObjClientes.DtResultados.FiltroPrimeroValor("Telefono") + End If + + Tags.Add(New TagsDocumentos("{Monto}", monto)) + Tags.Add(New TagsDocumentos("{Fecha}", fechaConFormato)) + Tags.Add(New TagsDocumentos("{FechaConFormato}", fechaConFormato)) + Tags.Add(New TagsDocumentos("{CantidadLetra}", monto.ToDouble.Texto2Letras(1))) + Tags.Add(New TagsDocumentos("{RazonSocial}", razonSocial)) + Tags.Add(New TagsDocumentos("{Direccion}", String.Format("{0} #{1} {2}, COL.{3}", direccion, noInt, noExt, colonia).ToUpper())) + Tags.Add(New TagsDocumentos("{Ciudad}", String.Format("{0}, {1}", ciudad, estado).ToUpper())) + Tags.Add(New TagsDocumentos("{Telefono}", Telefono)) + Tags.Add(New TagsDocumentos("{RazonSocialAval}", TxtAval.Text)) + Tags.Add(New TagsDocumentos("{DireccionAval}", TxtDireccionAval.Text)) + Tags.Add(New TagsDocumentos("{CiudadAval}", TxtCiudadAval.Text)) + Tags.Add(New TagsDocumentos("{TelefonoAval}", TxtTelefonoAval.Text)) + Tags.Add(New TagsDocumentos("{RepresentanteLegal}", TxtRepresentanteLegal.Text)) + + If Not ObjClientes.AddClientePagare(CveCliente, UsuarioActual.CveEmpresa, TxtAval.Text, TxtDireccionAval.Text) Then + Alert("no se pudo registrar el pagare") + TieneError = True + End If + + If Not TieneError Then + Alert("Pagaré registrado con exito") + End If + Catch ex As Exception + OnError("Ocurrió un error al registrar el pagare", ex) + End Try + ObjClientes.Dispose() + 'objGemBoxDocument.AgregarImagen(RutaLogo, 61.0, 53.0) RegistraScript("$('#ModalDivPagare').modal('hide')") - Alert("Pagaré registrado con exito") - objGemBoxDocument.SustituirTags(Tags) - objGemBoxDocument.GuardarStream() - Dim memoryStream As New System.IO.MemoryStream(objGemBoxDocument.GetBytesDocumento()) - objGemBoxDocument.Dispose() - ObjClientes.Dispose() - Response.Clear() - Response.ContentType = "application/text" - Response.AddHeader("content-disposition", "attachment;filename=pagare.docx") - Response.Buffer = True - memoryStream.WriteTo(Response.OutputStream) - Response.End() - memoryStream.Dispose() + If Not TieneError Then + objGemBoxDocument.SustituirTags(Tags) + objGemBoxDocument.GuardarStream() + Dim memoryStream As New System.IO.MemoryStream(objGemBoxDocument.GetBytesDocumento()) + objGemBoxDocument.Dispose() + + Response.Clear() + Response.ContentType = "application/text" + Response.AddHeader("content-disposition", "attachment;filename=pagare.docx") + Response.Buffer = True + memoryStream.WriteTo(Response.OutputStream) + Response.End() + memoryStream.Dispose() + End If + End Sub @@ -7626,19 +7651,19 @@ Partial Class Clientes End If End Sub - Public Sub DownLoadFormato_ClickDocumentacion(sender As Object, e As EventArgs) - - + Public Sub DownLoadFormato_ClickDocumentacion(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) Dim Adjunto As String = GvRow.DataKey("Adjunto") Dim stringDescargaDocumento As String = "" - Dim asdasd = GvRow.DataKey("Documentacion") - - If GvRow.DataKey("Documentacion").ToUpper = "Pagaré".ToUpper AndAlso UsuarioActual.CveEmpresa = 140 Then - - + Dim asdasd = GvRow.DataKey("Documentacion") + + If GvRow.DataKey("Documentacion").ToUpper = "Pagaré".ToUpper AndAlso UsuarioActual.CveEmpresa = 140 Then + + stringDescargaDocumento = UsuarioActual.Empresa.Ruta & "Formatos\Pagaré.docx" linkDescargaPagare = stringDescargaDocumento TxtDireccionAval.Text = "" @@ -7648,30 +7673,30 @@ Partial Class Clientes RegistraScript("$('#ModalDivPagare').modal('show')") - Else - - - Dim CveDocumentacion As Integer = GvRow.DataKey("CveDocumentacion").ToString().ToEntero() - Dim DocumentacionFormato As String = CveDocumentacion & "_" & GvRow.DataKey("DocumentacionFormato") - + Else + + + Dim CveDocumentacion As Integer = GvRow.DataKey("CveDocumentacion").ToString().ToEntero() + Dim DocumentacionFormato As String = CveDocumentacion & "_" & GvRow.DataKey("DocumentacionFormato") + DescarFormato(DocumentacionFormato) - End If - - - - - - + End If + + + + + + End Sub Public Sub DescarFormato(documento As String) Dim PathRoot As String = Server.MapPath("/") Dim PathSource As String Dim pathDesti As String - Dim fname As String = "" - - - + Dim fname As String = "" + + + PathSource = UsuarioActual.Empresa.Ruta & "Formatos\" & documento pathDesti = PathRoot & "Temp\" & CveCliente & documento @@ -7720,20 +7745,20 @@ Partial Class Clientes End If - End Sub - - - + End Sub + + + Private Sub RegistraDescargaJavaScript(baseUrl As String) RegistraScript("Download('" & baseUrl & "')") - End Sub - + End Sub + #End Region - + #Region "D O C U M E N T O S V E N T A S" - + Private Sub CargaDocumentosVenta(tCveCliente As Integer) Dim objInv As New ClsEdocumentacion @@ -7904,11 +7929,11 @@ Partial Class Clientes objRH.Dispose() - End Sub - - + End Sub + + #End Region - + #Region "PERSONA FISICA" Protected Sub LnkPersonaFisica_Click(sender As Object, e As EventArgs) RegistraScript("$('#DivModalPersonaFisica').modal();") @@ -7933,9 +7958,9 @@ Partial Class Clientes ObjCliente.Dispose() UpDatos.Update() - End Sub + End Sub #End Region - + #Region "USUARIOS PLATAFORMA CLIENTE - 6 " Protected Sub CargaUsuariosPortalCliente() Dim objUsuario As ClsSisUsuarios = New ClsSisUsuarios @@ -7944,19 +7969,19 @@ Partial Class Clientes GvUsuarios.DataBind() End If objUsuario.Dispose() - End Sub + End Sub #End Region - + #Region " DEVOLVER DINERO ANT/NC " Private Sub InicializaDevolverDinero() If UsuarioActual.TienePermisoProceso(247) Then GVAnticipos.Columns(6).Visible = True End If - End Sub + End Sub #End Region - + #Region "MODAL GRAFICA/PEDIDOS" - + Protected Sub LnkVerGrafica_Click(sender As Object, e As EventArgs) If CargaDatatables() Then RegistraScript("$('#DivModalGrafica').modal('show')") @@ -8293,13 +8318,13 @@ Partial Class Clientes RegistraScript($"CargaGraficaCompratamientoSaldoMensual({Dt5.ToJson},{Dt6.ToJson.Replace($"{Chr(34)}True{Chr(34)}", "true").Replace($"{Chr(34)}False{Chr(34)}", "false")})", "55") UPModalProd.Update() - End Sub - - + End Sub + + #End Region - + #Region "TAB - COMPORTAMIENTO DE VENTAS" - + Private Sub CargaGrupo() DdlGrupo.Items.Insert(0, New ListItem("Categoria", "3")) DdlGrupo.Items.Insert(1, New ListItem("Clasificacion", "4")) @@ -8483,12 +8508,12 @@ Partial Class Clientes ObjVentas.Dispose() GvComportamientoVenta.DataBind() UpDatosComportamientoVenta.Update() - End Sub - + End Sub + #End Region - + #Region "DISPOSITIVOS" - + Protected Sub LnkMoverDispositivo_Click(sender As Object, e As EventArgs) Dim CveDispositivo As Integer = HdnCveDispositivoMover.Value.ToEntero() Dim CveCliente As Integer = DdlClienteDispositivo.SelectedValue.ToEntero() @@ -8526,10 +8551,10 @@ Partial Class Clientes CargaEventoBitacora() NombreDispositivo = "" RegistraScript("$('#DivMoverDispositivo').modal('hide');") - End Sub - + End Sub + #End Region - + #Region "CRM" Protected Sub CargaDatosCRM() Dim ObjCRM = New ClsCRM() @@ -8629,9 +8654,9 @@ Partial Class Clientes Alert("Se Unificó correctamente al Cliente con la Empresa CRM.") End If End If - End Sub + End Sub #End Region - + #Region "PORCENTAJE PRECIO DE MARCAS" Private Sub LnkPorcentajeMarcas_Click(sender As Object, e As EventArgs) Handles LnkPorcentajeMarcas.Click RegistraScript(String.Format("$('#{0}').modal();", "DivPorcentajeMarcas")) @@ -8855,9 +8880,9 @@ Partial Class Clientes ObjPS.Dispose() - End Sub + End Sub #End Region - + #Region "PORCENTAJE PRECIO DE PRODUCTOS" Private Sub LnkPorcentajePrecios_Click(sender As Object, e As EventArgs) Handles LnkPorcentajePrecios.Click RegistraScript(String.Format("$('#{0}').modal();", "DivPorcentajePrecios")) @@ -9093,12 +9118,12 @@ Partial Class Clientes Protected Sub BtnCambiaPorcentaje_Click(sender As Object, e As EventArgs) DdlProducto2IndexChange(DdlProducto2.SelectedValue.ToEntero(), DdlProducto2) - End Sub + End Sub #End Region - + #Region " A C U M U L A D O R E S" - - + + Protected Sub LnkFacturaUsadosCargos_Click(sender As Object, e As EventArgs) 'CveVentaNota = 0 @@ -9270,8 +9295,8 @@ Partial Class Clientes e.Row.FCCheckBox("ChkBonificacion").Visible = False End If - If e.Row.DBCampo("ImporteBonificacion").ToDecimal() = 0 Then - e.Row.FCCheckBox("ChkBonificacion").Visible = False + If e.Row.DBCampo("ImporteBonificacion").ToDecimal() = 0 Then + e.Row.FCCheckBox("ChkBonificacion").Visible = False End If End If @@ -9741,11 +9766,11 @@ Partial Class Clientes ' ObjFactura.Timbre = PreParaTimbre(ObjFactura) - End Sub - - + End Sub + + #End Region - + #Region "C L I E N T E S G R I D S I M P R I M I R P D F/Excel" Private Sub LnkCotizacionesPDF_Click(sender As Object, e As EventArgs) Handles LnkCotizacionesPDF.Click ImprimeGridsProveedores("PDF", DtCotizaciones, "RepClientesCotizaciones") @@ -9820,7 +9845,7 @@ Partial Class Clientes End If Acum.Dispose() - End Sub + End Sub #End Region Protected Sub DdlTipoRetencion_SelectedIndexChanged(sender As Object, e As EventArgs) If UsuarioActual.Empresa.Funcionalidad(579) = "1" Then @@ -10249,39 +10274,39 @@ Partial Class Clientes Alert("Los cambios se guardaron satisfactoriamente.") End Using - End Sub - - Protected Sub RdTipoPersona_SelectedIndexChanged(sender As Object, e As EventArgs) - - DVRegimenSociedad.Visible = False - DivRazonSocial2.Attributes.Add("class", "col-md-12") - - If RdTipoPersona.SelectedValue.ToEntero = 1 And UsuarioActual.Empresa.Funcionalidad(350).Contiene("1", "2") Then - DivRazonSocial2.Attributes.Add("class", "col-md-8") - DVRegimenSociedad.Visible = True - TxtNombreComercial.Enabled = False - Else - TxtNombreComercial.Enabled = True - End If - ' DdlRegimenFiscal.SelectedIndex = -1 - - Dim dt As DataTable = GlobalDTRegimenesFiscales(RdTipoPersona.SelectedValue.ToEntero).FiltraParametros("", "CodigoRegimenFiscal") - Dim Val As String - - If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then - 'verifico que sino existe el valor. lo limpie - Val = dt.FiltroPrimeroValor("CveRegimenFiscal", "CveRegimenFiscal = " & DdlRegimenFiscal.SelectedValue) - If Val = "" Then 'sino encuentra valor, lo limpia - DdlRegimenFiscal.Items.Clear() - DdlRegimenFiscal.SelectedValue = Nothing - End If - End If - - DdlRegimenFiscal.DataSource = dt - DdlRegimenFiscal.DataBind() - DdlRegimenFiscal.SelectedValueExist(Val) - UpDatos.Update() - End Sub - + End Sub + + Protected Sub RdTipoPersona_SelectedIndexChanged(sender As Object, e As EventArgs) + + DVRegimenSociedad.Visible = False + DivRazonSocial2.Attributes.Add("class", "col-md-12") + + If RdTipoPersona.SelectedValue.ToEntero = 1 And UsuarioActual.Empresa.Funcionalidad(350).Contiene("1", "2") Then + DivRazonSocial2.Attributes.Add("class", "col-md-8") + DVRegimenSociedad.Visible = True + TxtNombreComercial.Enabled = False + Else + TxtNombreComercial.Enabled = True + End If + ' DdlRegimenFiscal.SelectedIndex = -1 + + Dim dt As DataTable = GlobalDTRegimenesFiscales(RdTipoPersona.SelectedValue.ToEntero).FiltraParametros("", "CodigoRegimenFiscal") + Dim Val As String + + If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then + 'verifico que sino existe el valor. lo limpie + Val = dt.FiltroPrimeroValor("CveRegimenFiscal", "CveRegimenFiscal = " & DdlRegimenFiscal.SelectedValue) + If Val = "" Then 'sino encuentra valor, lo limpia + DdlRegimenFiscal.Items.Clear() + DdlRegimenFiscal.SelectedValue = Nothing + End If + End If + + DdlRegimenFiscal.DataSource = dt + DdlRegimenFiscal.DataBind() + DdlRegimenFiscal.SelectedValueExist(Val) + UpDatos.Update() + End Sub + End Class diff --git a/Ventas/ClientesAbonar.aspx.vb b/Ventas/ClientesAbonar.aspx.vb index d31a60e0f..c01610754 100644 --- a/Ventas/ClientesAbonar.aspx.vb +++ b/Ventas/ClientesAbonar.aspx.vb @@ -319,7 +319,10 @@ Partial Class Ventas_ClientesAbonar Private Sub CargaCuentas() DdlCuenta.Items.Clear() - Dim dt As DataTable = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa, CveTipoCuenta:=2) + Dim CveTipoCuenta As Integer = 2 + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then CveTipoCuenta = -1 'que se muestren todas, para empresa acumuladores + + Dim dt As DataTable = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa, CveTipoCuenta:=CveTipoCuenta) If ChkPagarPesos.Checked Then dt = dt.FiltraParametros(String.Format("CveMoneda = {0}", 1)) @@ -783,7 +786,7 @@ Partial Class Ventas_ClientesAbonar Dim SeriesPago As New List(Of String) Dim MsgError As String = "" - Dim NCGeneradas As New List(Of Modelos.Factura.MMensajeFactura) + Dim NCGeneradas As New List(Of RespuestaNotaCredrito) Dim ListaFacturasGenerarNC As New List(Of Modelos.Factura) Dim ImporteSeleccionado As Decimal = 0 @@ -1560,13 +1563,14 @@ Partial Class Ventas_ClientesAbonar If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso MsgError = "" Then If MsgError = "" Then If ListaFacturasGenerarNC.Count > 0 Then + For Each Fac As Modelos.Factura In ListaFacturasGenerarNC Dim ListaNC As New List(Of Modelos.Factura) ListaNC.Add(Fac) - Dim Resp As Modelos.Factura.MMensajeFactura = GenerarNC(ObjIE.IniciaTransacSQL(), ObjConta, ListaNC) + Dim Resp = GenerarNC(ObjIE.IniciaTransacSQL(), ObjConta, ListaNC) - If Resp.CveVenta > 0 Then + If Resp IsNot Nothing AndAlso Resp.Respuesta IsNot Nothing AndAlso Resp.Respuesta.CveVenta > 0 Then NCGeneradas.Add(Resp) Else MsgError = "No se pudo generar la nota de crédito" @@ -1688,8 +1692,20 @@ Partial Class Ventas_ClientesAbonar Dim TextoComplementoPago = EmitirComplementoPago(CveIE, CveVentasPago, SeriesPago) - For Each NC In NCGeneradas - StrMsg.AppendFormat("Nota de crédito generada correctamente.

    Folio: {1}
    ", NC.CveVenta, NC.SerieFolio) + For Each RespuestaNotaCredito In NCGeneradas + If RespuestaNotaCredito IsNot Nothing AndAlso RespuestaNotaCredito.Respuesta IsNot Nothing Then + Try + Dim ObjTimbradoNC As New Timbrado + Dim TimbroNC = ObjTimbradoNC.TimbrarFactura(UsuarioActual, RespuestaNotaCredito.ObjFacturaNC) + If Not TimbroNC Then + Alert(ObjTimbradoNC.MensajeErrorCFDI, TipoMensaje.MsgError) + End If + ObjTimbradoNC = Nothing + Catch ex As Exception + OnError("Ocurrió un error al timbrar la NC.", ex) + End Try + StrMsg.AppendFormat("Nota de crédito generada correctamente.

    Folio: {1}
    ", RespuestaNotaCredito.Respuesta.CveVenta, RespuestaNotaCredito.Respuesta.SerieFolio) + End If Next Alert($"{StrMsg.ToString}

    {TextoComplementoPago}", TipoMensaje.MsgInformacion, If(ChkSeguirRegistrando.Checked, "location.href =""#""", "location.href =""/Bancos/RepCxCCliente.aspx""")) @@ -1738,177 +1754,335 @@ Partial Class Ventas_ClientesAbonar End Function #Region " N O T A - D E - C R E D I T O" + Private Class RespuestaNotaCredrito + Public Property ObjFacturaNC As Modelos.Factura + Public Property Respuesta As Modelos.Factura.MMensajeFactura + End Class - Private Function GenerarNC(SqlTransaccion As SqlClient.SqlTransaction, ObjConta As ClsContPAQi, ListaVentasGenerarNC As List(Of Modelos.Factura)) As Modelos.Factura.MMensajeFactura - Dim ObjFacturaDevolucion = New Modelos.Factura(UsuarioActual) - ObjFacturaDevolucion.TipoMensajeRespuesta = Modelos.TipoMensajeRespuesta.HTML - ObjFacturaDevolucion.CveUsuario = UsuarioActual.CveUsuario - ObjFacturaDevolucion.UsuarioCreo = UsuarioActual.Usuario + Private Function GenerarNC(SqlTransaccion As SqlClient.SqlTransaction, ObjConta As ClsContPAQi, ListaVentasGenerarNC As List(Of Modelos.Factura)) As RespuestaNotaCredrito + Dim Retorno As New RespuestaNotaCredrito() + Try - Dim CveSubProyecto As Integer = Me.CveSubProyecto - Dim CveMoneda As Integer = Me.CveMoneda - Dim CveCliente As Integer = Me.CveCliente + Dim ObjFacturaDevolucion = New Modelos.Factura(UsuarioActual) + ObjFacturaDevolucion.TipoMensajeRespuesta = Modelos.TipoMensajeRespuesta.HTML + ObjFacturaDevolucion.CveUsuario = UsuarioActual.CveUsuario + ObjFacturaDevolucion.UsuarioCreo = UsuarioActual.Usuario - If CveSubProyecto <= 0 Then - CveSubProyecto = ListaVentasGenerarNC(0).CveSubProyecto - End If - - If CveMoneda <= 0 Then - CveMoneda = ListaVentasGenerarNC(0).CveMoneda - End If - - If CveCliente <= 0 Then - CveCliente = ListaVentasGenerarNC(0).CveCliente - End If - - Dim Folio As Integer = -1 - Dim Serie As String = "-1" - - - ObjFacturaDevolucion.CveEmpresa = UsuarioActual.CveEmpresa - ObjFacturaDevolucion.TipoCambio = If(Me.CveMoneda = 1, 1, GlobalTipoCambio(Now).FormatoNumero(4).ToDecimal()) - ObjFacturaDevolucion.ConvertirPesos = False - ObjFacturaDevolucion.CveMoneda = CveMoneda - ObjFacturaDevolucion.Moneda = GlobalDTMonedas.FiltroPrimeroValor("Moneda", $"CveMoneda = {CveMoneda}") - ObjFacturaDevolucion.MonedaSAT = GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", $"CveMoneda = {CveMoneda}") - ObjFacturaDevolucion.Serie = Serie - ObjFacturaDevolucion.Folio = Folio - ObjFacturaDevolucion.Fecha = Now - ObjFacturaDevolucion.CvePrePoliza = -1 - ObjFacturaDevolucion.CveMetodoPago = 0 - ObjFacturaDevolucion.CondicionesPago = 0 ' 0 - Contado, 1 - Credito (CHECAR) - ObjFacturaDevolucion.FormaPago = 0 - - ObjFacturaDevolucion.TipoDocto = "Egs" - ObjFacturaDevolucion.Fecha = Now - - ObjFacturaDevolucion.Version = "3.3" - ObjFacturaDevolucion.CveMetodoPago33 = 1 - ObjFacturaDevolucion.MetodoPago33 = "Pago en una sola exhibición" - ObjFacturaDevolucion.ClaveMetodoPagoSAT = "PUE" - - ObjFacturaDevolucion.CveFormaPago33 = 21 - ObjFacturaDevolucion.FormaPago33 = "Aplicación de anticipos" - ObjFacturaDevolucion.FormaPagoSAT33 = "30" - - ObjFacturaDevolucion.MetodoPago = "" - ObjFacturaDevolucion.ClaveMetodoPagoSAT = GlobalDTMetodosPago.FiltroPrimeroValor("ClaveSAT", $"CveMetodoPago = {ObjFacturaDevolucion.CveMetodoPago33}") - - ObjFacturaDevolucion.CveSubProyecto = CveSubProyecto - ObjFacturaDevolucion.SetSubProyecto() - - ObjFacturaDevolucion.CveCliente = CveCliente - ObjFacturaDevolucion.SetCliente() - - Dim ObjCliente As New ClsClientes - If ObjCliente.GetClientes(ObjFacturaDevolucion.CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa, -1, TipoCliente:=-1) Then - If ObjCliente.DtResultados.Rows.Count > 0 Then - - ObjFacturaDevolucion.CveUsoCFDI = ObjCliente.CveUsoCFDI - ObjFacturaDevolucion.UsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("Descripcion", String.Format("CveUsoCFDI = {0}", ObjCliente.CveUsoCFDI)) - ObjFacturaDevolucion.ClaveUsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("UsoCFDI", String.Format("CveUsoCFDI = {0}", ObjCliente.CveUsoCFDI)) - - ObjFacturaDevolucion.DtDetalle = CreaDTDetalleNC() - - CargaImpuestos(ObjFacturaDevolucion, ListaVentasGenerarNC, ObjCliente.DesglosaIEPS, ObjCliente.RetIVA, ObjCliente.RetISR) + Dim CveSubProyecto As Integer = Me.CveSubProyecto + Dim CveMoneda As Integer = Me.CveMoneda + Dim CveCliente As Integer = Me.CveCliente + If CveSubProyecto <= 0 Then + CveSubProyecto = ListaVentasGenerarNC(0).CveSubProyecto End If - End If - If ObjCliente.GetSucursales(CveCliente) Then - If ObjCliente.DtResultados.Rows.Count > 0 Then - ObjFacturaDevolucion.CveClienteSucursal = If(String.IsNullOrEmpty(ObjCliente.DtResultados.FiltroPrimeroValor("CveClienteSucursal", "Estatus = 'Activo'")), -1, ObjCliente.DtResultados.FiltroPrimeroValor("CveClienteSucursal", "Estatus = 'Activo'").ToEntero()) + If CveMoneda <= 0 Then + CveMoneda = ListaVentasGenerarNC(0).CveMoneda + End If + + If CveCliente <= 0 Then + CveCliente = ListaVentasGenerarNC(0).CveCliente + End If + + Dim Folio As Integer = -1 + Dim Serie As String = "-1" + + ObjFacturaDevolucion.CveEmpresa = UsuarioActual.CveEmpresa + ObjFacturaDevolucion.TipoCambio = If(Me.CveMoneda = 1, 1, GlobalTipoCambio(Now).FormatoNumero(4).ToDecimal()) + ObjFacturaDevolucion.ConvertirPesos = False + ObjFacturaDevolucion.CveMoneda = CveMoneda + ObjFacturaDevolucion.Moneda = GlobalDTMonedas.FiltroPrimeroValor("Moneda", $"CveMoneda = {CveMoneda}") + ObjFacturaDevolucion.MonedaSAT = GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", $"CveMoneda = {CveMoneda}") + ObjFacturaDevolucion.Serie = Serie + ObjFacturaDevolucion.Folio = Folio + ObjFacturaDevolucion.Fecha = Now + ObjFacturaDevolucion.CvePrePoliza = -1 + ObjFacturaDevolucion.CveMetodoPago = 0 + ObjFacturaDevolucion.CondicionesPago = 0 ' 0 - Contado, 1 - Credito (CHECAR) + ObjFacturaDevolucion.FormaPago = 0 + + ObjFacturaDevolucion.TipoDocto = "Egs" + ObjFacturaDevolucion.Fecha = Now + + If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then + ObjFacturaDevolucion.Version = "4.0" + + 'If ObjFacturaDevolucion.Cliente Is Nothing Then + ' ObjFacturaDevolucion.Cliente = New Modelos.ClienteModel + 'End If + + 'ObjFacturaDevolucion.Cliente.CodigoRegimenFiscal = ClienteCodigoRegimenFiscal + 'ObjFacturaDevolucion.Cliente.RegimenFiscal = ClienteRegimenFiscal Else - ObjFacturaDevolucion.CveClienteSucursal = -1 + ObjFacturaDevolucion.Version = "3.3" End If + + ObjFacturaDevolucion.CveMetodoPago33 = 1 + ObjFacturaDevolucion.MetodoPago33 = "PUE - Pago en una sola exhibición" + ObjFacturaDevolucion.ClaveMetodoPagoSAT = "PUE" + + ObjFacturaDevolucion.CveFormaPago33 = 21 + ObjFacturaDevolucion.FormaPago33 = "30 - Aplicación de anticipos" + ObjFacturaDevolucion.FormaPagoSAT33 = "30" + + ObjFacturaDevolucion.CveSubProyecto = CveSubProyecto + ObjFacturaDevolucion.SetSubProyecto() + + ObjFacturaDevolucion.CveCliente = CveCliente + ObjFacturaDevolucion.SetCliente() + + Dim ObjCliente As New ClsClientes + If ObjCliente.GetClientes(ObjFacturaDevolucion.CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa, -1, TipoCliente:=-1) Then + If ObjCliente.DtResultados.Rows.Count > 0 Then + + ObjFacturaDevolucion.CveUsoCFDI = ObjCliente.CveUsoCFDI + ObjFacturaDevolucion.UsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("Descripcion", String.Format("CveUsoCFDI = {0}", ObjCliente.CveUsoCFDI)) + ObjFacturaDevolucion.ClaveUsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("UsoCFDI", String.Format("CveUsoCFDI = {0}", ObjCliente.CveUsoCFDI)) + + ObjFacturaDevolucion.DtDetalle = CreaDTDetalleNC() + + CargaImpuestos(ObjFacturaDevolucion, ListaVentasGenerarNC, ObjCliente.DesglosaIEPS, ObjCliente.RetIVA, ObjCliente.RetISR) + + End If + End If + + If ObjCliente.GetSucursales(CveCliente) Then + If ObjCliente.DtResultados.Rows.Count > 0 Then + ObjFacturaDevolucion.CveClienteSucursal = If(String.IsNullOrEmpty(ObjCliente.DtResultados.FiltroPrimeroValor("CveClienteSucursal", "Estatus = 'Activo'")), -1, ObjCliente.DtResultados.FiltroPrimeroValor("CveClienteSucursal", "Estatus = 'Activo'").ToEntero()) + Else + ObjFacturaDevolucion.CveClienteSucursal = -1 + End If + End If + ObjCliente.Dispose() + + ObjFacturaDevolucion.CveTipoRelacion = 1 + ObjFacturaDevolucion.TipoRelacion = "01" + ObjFacturaDevolucion.DtVentasRelacionadas = New DataTable + ObjFacturaDevolucion.DtVentasRelacionadas.Columns.Add("CveVenta", GetType(Integer)) + + Dim Fol As New List(Of String) + For Each Fac In ListaVentasGenerarNC + Fol.Add(Fac.FolioFiscal) + + Dim RowVenta As DataRow = ObjFacturaDevolucion.DtVentasRelacionadas.NewRow + RowVenta("CveVenta") = Fac.CveVenta + + ObjFacturaDevolucion.DtVentasRelacionadas.Rows.Add(RowVenta) + Next + + ObjFacturaDevolucion.UUIDRelacionados = Fol + + Select Case ObjFacturaDevolucion.TipoDocto + Case "Ing" + ObjFacturaDevolucion.TipoDocumento = "Factura" + Case "REM" + ObjFacturaDevolucion.TipoDocumento = "Remision" + Case "Cot" + ObjFacturaDevolucion.TipoDocumento = "Cotizacion" + Case "Egs" + ObjFacturaDevolucion.TipoDocumento = "Nota de Crédito" + Case "Dev" + ObjFacturaDevolucion.TipoDocumento = "Nota de Devolución" + Case Else + ObjFacturaDevolucion.TipoDocumento = "" + End Select + + ObjFacturaDevolucion.FechaPago = Now + + ObjFacturaDevolucion.CveCorte = -1 + ObjFacturaDevolucion.CveMesa = -1 + ObjFacturaDevolucion.NumeroPersonas = 0 + ObjFacturaDevolucion.CveContrato = -1 + ObjFacturaDevolucion.DescripcionContrato = "" + ObjFacturaDevolucion.CveClienteSucursal = -1 + ObjFacturaDevolucion.Entrega = "" + ObjFacturaDevolucion.CveAlmacen = -1 + + Dim DtVentasNC = InicializaDTVentasNC() + + Dim TotalImporte As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("TotalImporte") + Dim ImporteIVA As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("ImporteIVA") + Dim ImporteRetIVA As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("ImporteRetIVA") + Dim ImporteRetISR As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("ImporteRetISR") + Dim ImporteIEPS As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("ImporteIEPS") + Dim Descuento As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("Descuento") + Dim Amortizacion As Decimal = 0 + + Dim Total As Decimal = (TotalImporte + ImporteIVA + ImporteIEPS) - (ImporteRetIVA + ImporteRetISR + Descuento + Amortizacion) + + 'DETALLES + ObjFacturaDevolucion.SubTotal = TotalImporte + ObjFacturaDevolucion.Descuento = Descuento + ObjFacturaDevolucion.Amortizacion = Amortizacion + ObjFacturaDevolucion.IVA = ImporteIVA + ObjFacturaDevolucion.RetIVA = ImporteRetIVA + ObjFacturaDevolucion.RetISR = ImporteRetISR + ObjFacturaDevolucion.IEPS = ImporteIEPS + ObjFacturaDevolucion.Total = Total + ObjFacturaDevolucion.TotalOtrosConceptos = 0 + + For Each Fac In ListaVentasGenerarNC + Dim Drt = DtVentasNC.NewRow + Drt("CveVenta") = Fac.CveVenta + Drt("Importe") = Fac.DescuentoProntoPago + Drt("FolioFiscal") = Fac.FolioFiscal + DtVentasNC.Rows.Add(Drt) + Next + + DtVentasNC.AcceptChanges() + + ObjFacturaDevolucion.DtVentasNC = DtVentasNC + + ObjFacturaDevolucion.Timbre = PreParaTimbre(ObjFacturaDevolucion, ListaVentasGenerarNC) + + Try + Dim Resp = ObjFacturaDevolucion.EmitirFactura(False, Transac:=SqlTransaccion, ObjContPaqTransac:=ObjConta) + Retorno.Respuesta = Resp + Catch ex As Exception + OnError("Ocurrió un error al guardar la NC de pronto pago", ex) + Retorno.Respuesta = Nothing + End Try + Retorno.ObjFacturaNC = ObjFacturaDevolucion + + Catch ex As Exception + OnError("Ocurrió un error al generar la NC de pronto pago", ex) + Retorno = Nothing + End Try + + Return Retorno + + End Function + + Private Function PreParaTimbre(Obj As Modelos.Factura, ListaVentasGenerarNC As List(Of Modelos.Factura)) As CFDITimbre + Dim Timbre As New CFDITimbre + Timbre.Comprobante.TipoComprobante = If(Obj.TipoDocto.Contiene("Ing", "Ant"), "I", If(Obj.TipoDocto.Contiene("Egs", "Dev"), "E", "")) + Timbre.Comprobante.Folio = Obj.Folio.ToString() + Timbre.Comprobante.Serie = Obj.Serie + Timbre.Comprobante.Fecha = Obj.FechaCP + Timbre.Comprobante.FormadePago = Obj.FormaPagoSAT33 + Timbre.Comprobante.CondicionesdePago = Obj.FormaPago33 + Timbre.Comprobante.MetodoPago = Obj.ClaveMetodoPagoSAT + Timbre.Comprobante.SubTotal = Obj.SubTotal + Timbre.Comprobante.Descuentos = Obj.Descuento + Timbre.Comprobante.Moneda = Obj.MonedaSAT + Timbre.Comprobante.TipoCambio = If(Obj.CveMoneda = 1, "1", Obj.TipoCambio.ToString()) + Timbre.Comprobante.Total = Obj.Total + + Timbre.Comprobante.LugarExpedicion = Obj.SubProyecto.CP + If Timbre.Comprobante.LugarExpedicion = "" Then + Dim aa As String = "no se guardo lugar de expedicion" + aa.GuardaLog() End If - ObjCliente.Dispose() - ObjFacturaDevolucion.CveTipoRelacion = 7 - ObjFacturaDevolucion.TipoRelacion = "07" - ObjFacturaDevolucion.DtVentasRelacionadas = New DataTable - ObjFacturaDevolucion.DtVentasRelacionadas.Columns.Add("CveVenta", GetType(Integer)) + Timbre.Comprobante.Confirmacion = "" - Dim Fol As New List(Of String) - For Each Fac In ListaVentasGenerarNC - Fol.Add(Fac.FolioFiscal) + If Obj.FacturarSucursal Then + Timbre.Receptor.RFC = Obj.ClienteSucursal.RFC + Timbre.Receptor.Nombre = Obj.ClienteSucursal.Nombre + Timbre.Receptor.DomicilioFiscalReceptor = Obj.ClienteSucursal.CP + Else + Timbre.Receptor.RFC = Obj.Cliente.RFC + If UsuarioActual.Empresa.Funcionalidad(350) = "1" Then + Timbre.Receptor.Nombre = Obj.Cliente.Nombre + Else + Timbre.Receptor.Nombre = Obj.Cliente.Nombre + " " + Obj.Cliente.RegimenSociedad + End If + Timbre.Receptor.DomicilioFiscalReceptor = Obj.Cliente.CP + End If - Dim RowVenta As DataRow = ObjFacturaDevolucion.DtVentasRelacionadas.NewRow - RowVenta("CveVenta") = Fac.CveVenta + Timbre.Receptor.RegimenFiscalReceptor = Obj.Cliente.CodigoRegimenFiscal - ObjFacturaDevolucion.DtVentasRelacionadas.Rows.Add(RowVenta) + Timbre.Receptor.ResidenciaFiscal = "" + Timbre.Receptor.NumeroRegistroTributario = "" + Timbre.Receptor.UsoCFDI = Obj.ClaveUsoCFDI + + If ListaVentasGenerarNC IsNot Nothing Then + Timbre.CFDIRelacionados.UUID.Clear() + + Dim RowTipoRelacion As DataRow = GlobalDTVtaTiposRelacion().FiltroPrimero($"CveTipoRelacion = {Obj.CveTipoRelacion}") + + Timbre.CFDIRelacionados.TipoRelacion = RowTipoRelacion("SATClaveTipoRelacion").ToString() + Timbre.CFDIRelacionados.TipoRelacionTexto = RowTipoRelacion("SATTipoRelacion").ToString() + + For Each Fac In ListaVentasGenerarNC + Timbre.CFDIRelacionados.UUID.Add(Fac.FolioFiscal) + Next + End If + + Dim totSubTotal As Decimal = If(UsuarioActual.Empresa.CvePAC = 3, Obj.DtDetalle.SUMD("Total"), Obj.SubTotal) 'Obj.SubTotal + Dim totIVA As Decimal = Obj.IVA + Dim totRetIVA As Decimal = Obj.RetIVA + Dim totRetISR As Decimal = Obj.RetISR + + Dim i As Integer = 1 + + 'detalles + Dim tPS As String = "" + + For Each drr As DataRow In Obj.DtDetalle.Rows + If drr("PS").ToString().Length = 1 Then + tPS = drr("Obs").ToString() + Else + If drr("PS").ToString().Length = 0 Then + tPS = "" + Else + tPS = String.Format("{0} {1}", drr("PS"), drr("Obs")) + End If + End If + + tPS = tPS.Replace("|", " ") + + If tPS.Length >= 1000 Then + Dim tPSRecortado = tPS.Remove(999, tPS.Length - 999) + tPS = tPSRecortado + End If + + 'condicionante, especial + If UsuarioActual.CveEmpresa = 15 Then drr("UM") = "" ' les comentan que no debe de ir la etiqueta de "unidad" en el producto + + Dim concepto As New CFDIConceptos With {.Cantidad = drr("Cantidad").ToString().ToDecimal, + .Descripcion = tPS, + .ValorUnitario = drr("PU").ToString().ToDecimal, + .Importe = If(UsuarioActual.Empresa.CvePAC = 3, drr("Total").ToString().ToDecimal.RoundSQL(2), drr("TotalImporte").ToString().ToDecimal), + .Descuento = drr("Descuento").ToString().ToDecimal.RoundSQL(2), + .Unidad = drr("UM").ToString(), + .ClaveUnidad = drr("SATClaveUM").ToString(), + .ClaveProdServ = drr("SATClaveProdServ").ToString(), + .Noidentificacion = drr("Noidentificacion").ToString(), + .CuentaPredial = drr("CuentaPredial").ToString(), + .ImporteGravaIVAAdicional = drr("ImporteIEPS").ToString().ToDecimal, + .ObjetoImpuesto = drr("CodigoObjetoImpuesto").ToString()} + 'verifica suma subtotales + If i = Obj.DtDetalle.Rows.Count AndAlso totSubTotal.RoundSQL(2) <> concepto.Importe.RoundSQL(2) AndAlso Math.Abs(totSubTotal.RoundSQL(2) - concepto.Importe.RoundSQL(2)) <= 0.01 Then 'proceso de ajusta de decimales + concepto.Importe = totSubTotal + End If + totSubTotal = totSubTotal - concepto.Importe + + 'siempre estaremos agregando el iva, auqnue sea en importe cero o tasa cero, para que se emita la factura + ' If drr("ImporteIVA").ToString().ToDouble > 0 Then + + 'si es ingreso amortizado por la totalidad, y arroja el valor total de cero, no debe de impuestos, y si la BASE de calculo es mayor a cero + If Timbre.Comprobante.Total > 0 AndAlso concepto.Importe - concepto.Descuento + concepto.ImporteGravaIVAAdicional > 0 Then + concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = (concepto.Importe - concepto.Descuento + concepto.ImporteGravaIVAAdicional).RoundSQL(6), .TasaOCuota = drr("PorcentajeIVA").ToString().ToDecimal, .Impuesto = "002", .Importe = drr("ImporteIVA").ToString().ToDecimal}) + End If + + If drr("ImporteIEPS").ToString().ToDouble > 0 Then + concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "T", .Base = (concepto.Importe - concepto.Descuento).RoundSQL(6), .TasaOCuota = drr("PorcentajeIEPS").ToString().ToDecimal, .Impuesto = "003", .Importe = drr("ImporteIEPS").ToString().ToDecimal}) + End If + + If drr("ImporteRetIVA").ToString().ToDouble > 0 Then 'si hay retenciones + concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = (concepto.Importe - concepto.Descuento).RoundSQL(6), .TasaOCuota = drr("PorcentajeRetIVA").ToString().ToDecimal, .Impuesto = "002", .Importe = drr("ImporteRetIVA").ToString().ToDecimal}) + End If + + If drr("ImporteRetISR").ToString().ToDouble > 0 Then 'retención de ISR + concepto.Impuestos.Add(New CFDIConceptosImpuestos With {.TrasladooRetencion = "R", .Base = (concepto.Importe - concepto.Descuento).RoundSQL(6), .TasaOCuota = drr("PorcentajeRetISR").ToString().ToDecimal, .Impuesto = "001", .Importe = drr("ImporteRetISR").ToString().ToDecimal}) + End If + + Timbre.Conceptos.Add(concepto) + i += 1 Next - ObjFacturaDevolucion.UUIDRelacionados = Fol - - Select Case ObjFacturaDevolucion.TipoDocto - Case "Ing" - ObjFacturaDevolucion.TipoDocumento = "Factura" - Case "REM" - ObjFacturaDevolucion.TipoDocumento = "Remision" - Case "Cot" - ObjFacturaDevolucion.TipoDocumento = "Cotizacion" - Case "Egs" - ObjFacturaDevolucion.TipoDocumento = "Nota de Crédito" - Case "Dev" - ObjFacturaDevolucion.TipoDocumento = "Nota de Devolución" - Case Else - ObjFacturaDevolucion.TipoDocumento = "" - End Select - - ObjFacturaDevolucion.FechaPago = Now - - ObjFacturaDevolucion.CveCorte = -1 - ObjFacturaDevolucion.CveMesa = -1 - ObjFacturaDevolucion.NumeroPersonas = 0 - ObjFacturaDevolucion.CveContrato = -1 - ObjFacturaDevolucion.DescripcionContrato = "" - ObjFacturaDevolucion.CveClienteSucursal = -1 - ObjFacturaDevolucion.Entrega = "" - ObjFacturaDevolucion.CveAlmacen = -1 - - Dim DtVentasNC = InicializaDTVentasNC() - - Dim TotalImporte As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("TotalImporte") - Dim ImporteIVA As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("ImporteIVA") - Dim ImporteRetIVA As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("ImporteRetIVA") - Dim ImporteRetISR As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("ImporteRetISR") - Dim ImporteIEPS As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("ImporteIEPS") - Dim Descuento As Decimal = ObjFacturaDevolucion.DtDetalle.SUMD("Descuento") - Dim Amortizacion As Decimal = 0 - - Dim Total As Decimal = (TotalImporte + ImporteIVA + ImporteIEPS) - (ImporteRetIVA + ImporteRetISR + Descuento + Amortizacion) - - 'DETALLES - ObjFacturaDevolucion.SubTotal = TotalImporte - ObjFacturaDevolucion.Descuento = Descuento - ObjFacturaDevolucion.Amortizacion = Amortizacion - ObjFacturaDevolucion.IVA = ImporteIVA - ObjFacturaDevolucion.RetIVA = ImporteRetIVA - ObjFacturaDevolucion.RetISR = ImporteRetISR - ObjFacturaDevolucion.IEPS = ImporteIEPS - ObjFacturaDevolucion.Total = Total - ObjFacturaDevolucion.TotalOtrosConceptos = 0 - - For Each Fac In ListaVentasGenerarNC - Dim Drt = DtVentasNC.NewRow - Drt("CveVenta") = Fac.CveVenta - Drt("Importe") = Fac.DescuentoProntoPago - Drt("FolioFiscal") = Fac.FolioFiscal - DtVentasNC.Rows.Add(Drt) - Next - - DtVentasNC.AcceptChanges() - - ObjFacturaDevolucion.DtVentasNC = DtVentasNC - - Dim Resp = ObjFacturaDevolucion.EmitirFactura(False, Transac:=SqlTransaccion, ObjContPaqTransac:=ObjConta) - - ObjFacturaDevolucion.Dispose() - - - Return Resp - + Return Timbre End Function @@ -1975,7 +2149,10 @@ Partial Class Ventas_ClientesAbonar Row("CveOrdenCompraDetalle") = CveOrdenCompraDetalle Row("CveVentaDetalleRemision") = CveVentaDetalleRemision Row("CveVentaDetalleCotizacion") = CveVentaDetalleCotizacion - + Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") + If DrPS IsNot Nothing Then + Row("CodigoObjetoImpuesto") = DrPS("CodigoObjetoImpuesto") + End If TmpDT.Rows.Add(Row) End Sub @@ -2193,6 +2370,7 @@ Partial Class Ventas_ClientesAbonar TmpDT.Columns.Add("ClaveSATUnidadAduanaDescripcion", GetType(String)) TmpDT.Columns.Add("CveTamaño", GetType(Integer)) TmpDT.Columns.Add("EsCargo", GetType(Boolean)) + TmpDT.Columns.Add("CodigoObjetoImpuesto", GetType(String)) Return TmpDT End Function diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb index c45973ddb..b3b17aef3 100644 --- a/Ventas/PV.aspx.vb +++ b/Ventas/PV.aspx.vb @@ -5211,7 +5211,12 @@ Partial Class PV 'SOLO VALIDA EXISTENCIAS Y COSTO: SI USA INVENTARIOS, SOLO PRODUCTOS TIPO PRODUCTO, SOLO REMISIONES E INGRESOS If UsuarioActual.Empresa.UsaInventarios AndAlso CveTipoPS = 2 AndAlso (DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "PA") Or (DdlTipoComprobante.SelectedValue.Contiene("Cot") And UsuarioActual.CveEmpresa.Contiene(119, 140))) Then Dim ObjInventarios As New ClsInventarios - Dim Existencia As Decimal = ObjInventarios.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=-1) + Dim CveTipoAlmacen As Integer = 1 + If ChkServicioDomicilio.Checked Then + CveTipoAlmacen = 29 + End If + + Dim Existencia As Decimal = ObjInventarios.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, -1, CveTipoAlmacen:=CveTipoAlmacen, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1) Dim Costo As Decimal = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero) ObjInventarios.Dispose() Dim PrecioMinimo As Decimal = 0 diff --git a/Ventas/RepCancelacionesPorRespuesta.aspx.cs b/Ventas/RepCancelacionesPorRespuesta.aspx.cs index a2f74d2bd..977fb4f16 100644 --- a/Ventas/RepCancelacionesPorRespuesta.aspx.cs +++ b/Ventas/RepCancelacionesPorRespuesta.aspx.cs @@ -62,9 +62,9 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas } ObjVentas.Dispose(); - GvDatos.DataSource = DtVentas.FiltraParametros("(CveEstatusFactura = 20 AND CveEstatusRefacturacion IN (0,4))"); + GvDatos.DataSource = DtVentas.FiltraParametros("(CveEstatusFactura IN (20,23) AND CveEstatusRefacturacion IN (0,4))"); - var DtRefacturar = DtVentas.FiltraParametros("CveEstatusRefacturacion IN (1,3) OR (CveEstatusFactura = 20 AND CveEstatusRefacturacion IN (1,2,3)) OR CveEstatusFactura = 23"); + var DtRefacturar = DtVentas.FiltraParametros("CveEstatusRefacturacion IN (1,3) OR (CveEstatusFactura IN (20,23) AND CveEstatusRefacturacion IN (1,2,3))"); if (DtRefacturar != null && DtRefacturar.Rows.Count > 0) { DivRefacturar.Visible = true; @@ -595,15 +595,10 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas // - //if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 1 && e.Row.DBCampo("CveEstatusFactura").ToString().ToEntero() == 23) - //{ - // e.Row.FCLinkButton("LnkValidarRefac").Visible = false; - //} - - if (e.Row.DBCampo("CveEstatusFactura").ToEntero() == 23) + if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 1 && e.Row.DBCampo("CveEstatusFactura").ToString().ToEntero() == 23) { e.Row.FCLinkButton("LnkValidarRefac").Visible = false; - } + } if (e.Row.DBCampo("PuedeRefacturar") == "0" && e.Row.DBCampo("CveEstatusFactura") == "23" && e.Row.DBCampo("CveVentaSustitucion").ToEntero() > 0) { diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index 07dd3e8e0..24d824ff0 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -2406,8 +2406,7 @@
    -
    -
    +
    @@ -2418,10 +2417,12 @@
    +
    + Emitir
    @@ -2429,6 +2430,16 @@
    + + + <%--
    + +
    + +
    +
    +
    --%> +
    diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index ec39ffe05..702b2b7b4 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -5148,7 +5148,6 @@ Partial Class Ventas 'ESTATUS FACTURA If Not (CveRemision > 0 Or CveCotizacion > 0) Then CveEstatus = DbRowVenta("CveEstatusFactura").ToString().ToEntero() - End If TxtTipoCambio.Text = DbRowVenta("TipoCambio").ToString() @@ -6334,6 +6333,10 @@ Partial Class Ventas LblTipoOperacion.Text = ObjCliente.ClaveSATTipoOperacionDescripcion LblClavePedimento.Text = ObjCliente.ClaveSATPedimentoDescripcion + If ObjCliente.AplicaComercioExterior Then + ChkEmitirComercioExterior.Checked = True + End If + If ObjCliente.AplicaComercioExterior Then DdlSATMotivoTraslado.DataSource = GlobalDTSATMotivoTraslado DdlSATMotivoTraslado.DataBind() @@ -6365,6 +6368,8 @@ Partial Class Ventas TxtComExtCalle.Text = ObjCliente.Direccion TxtComExtNumero.Text = ObjCliente.NoExt TxtComExtCP.Text = ObjCliente.CP + 'en comercio exterior como regla de timbrado se utiliza el TC del día anterior + TxtTipoCambio.Text = GlobalTipoCambio(TxtFecha.Text.ToDate.AddDays(-1)).ToString() End If @@ -7772,6 +7777,11 @@ Partial Class Ventas e.Row.FCLiteral("LtCantidadFacturada").Text = e.Row.DBCampo("CantidadFacturadaPed2").ToDecimal.ToString("#,##0.##") End Select + If EsCreaApartirDe Then + e.Row.FCLinkButton("imgD").Visible = True + e.Row.FCLinkButton("imgE").Visible = True + End If + 'If GvInv.Rows.Count > 0 AndAlso ModalidadEdicion AndAlso DdlTipoComprobante.SelectedValue = "Rem" AndAlso e.Row.DataKey("CveVentaDetalle").ToString().ToEntero() > 0 Then ' e.Row.FCLinkButton("imgE").Enabled = False ' e.Row.FCLinkButton("imgE").ToolTip = "No se puede editar debido a que ya hay un movimiento de almacen." @@ -8624,17 +8634,41 @@ Partial Class Ventas If TipoDocumentoAutorizacion = "Ing" 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 If TieneDiasVencidos Then CveAutorizacion = -1 Alert($"El crédito no esta autorizado. El cliente tiene días vencidos", TipoMensaje.MsgAdvertencia) Exit Sub End If + + If ImporteAutorizacion < TxtTotal.Text.ToDecimal() Then + Dim BloquearCredito As Boolean = True + CveAutorizacion = -1 + + 'VERIFICA SI TIENE CREDITO DISPONIBLE DENTRO DEL CLIENTE + Dim ObjCred As New ClsVentas + If ObjCred.ObtenerCreditoRestante(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero()) AndAlso ObjCred.DtResultados.Rows.Count > 0 Then + 'SI TIENE CREDITO DISPONIBLE NO BLOQUEAR AUNQUE LA AUTORIZACION NO TENGA EL IMPORTE DEL DOCUMENTO + If DdlSucursalCliente.SelectedValue.ToEntero() > 0 Then + If (ObjCred.DtResultados(0)("LimiteRestanteSucursal").ToString().ToDecimal - If(TxtTipoCambio.Visible, TxtTotal.Text.ToDecimal * TxtTipoCambio.Text.ToDecimal, TxtTotal.Text.ToDecimal)) > 0 Then + BloquearCredito = False + End If + Else + If (ObjCred.DtResultados(0)("LimiteRestanteCliente").ToString().ToDecimal - If(TxtTipoCambio.Visible, TxtTotal.Text.ToDecimal * TxtTipoCambio.Text.ToDecimal, TxtTotal.Text.ToDecimal)) > 0 Then + BloquearCredito = False + End If + End If + End If + ObjCred.Dispose() + + + If BloquearCredito Then + Alert($"El crédito autorizado es insuficiente. Crédito Disponible:{ImporteAutorizacion:N2}", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + End If + End If 'If TipoAutorizacion = 2 Then @@ -11735,6 +11769,10 @@ Partial Class Ventas Private Function PreParaTimbre(Obj As Modelos.Factura) As CFDITimbre Dim Timbre As New CFDITimbre + + + Timbre.Comprobante.Version = If(UsuarioActual.Empresa.Funcionalidad(350) = "1", "4.0", "3.3") + Timbre.Comprobante.TipoComprobante = If(Obj.TipoDocto.Contiene("Ing", "Ant"), "I", If(Obj.TipoDocto.Contiene("Egs", "Dev"), "E", "")) Timbre.Comprobante.Folio = Obj.Folio.ToString() Timbre.Comprobante.Serie = Obj.Serie @@ -11943,104 +11981,121 @@ Partial Class Ventas i += 1 Next - Dim AplicaComercioExteriorSubProyecto As Boolean = If(GlobalDTSubProyectos(-1, Obj.CveSubProyecto, CveEmpresa:=UsuarioActual.CveEmpresa)(0)("AplicaComercioExterior").ToString() = "True", True, False) - Timbre.Complementos.ComercioExterior11.AplicaComercioExteriorSubProyecto = AplicaComercioExteriorSubProyecto - If Obj.Cliente.AplicaComercioExterior And AplicaComercioExteriorSubProyecto Then - 'DATOS GENERALES - Timbre.Complementos.ComercioExterior11.TipoOperacion = GlobalDTTipoOperacion().FiltraParametros($"CveTipoOperacion={CveTipoOperacion}")(0)("ClaveSATTipoOperacion").ToString() - Timbre.Complementos.ComercioExterior11.ClavedePedimento = GlobalDTClavePedimento().FiltraParametros($"CvePedimento={CvePedimento}")(0)("ClaveSATPedimento").ToString() - Timbre.Complementos.ComercioExterior11.CertificadoOrigen = "0" - Timbre.Complementos.ComercioExterior11.Incoterm = GlobalDTIncoterm.FiltroPrimeroValor("ClaveSATIncoterm", $"CveIncoterm={DdlIncoterm.SelectedValue}") - Timbre.Complementos.ComercioExterior11.Subdivision = "0" - Timbre.Complementos.ComercioExterior11.TipoCambioUSD = If(Obj.CveMoneda = 1, 1, Obj.TipoCambio.ToString().ToDecimal) - Timbre.Complementos.ComercioExterior11.MotivoTraslado = GlobalDTSATMotivoTraslado.FiltroPrimeroValor("ClaveSATMotivoTraslado", $"CveMotivoTraslado={DdlSATMotivoTraslado.SelectedValue}") + Dim AplicaComercioExteriorSubProyecto As Boolean + + If ChkEmitirComercioExterior.Checked Then + AplicaComercioExteriorSubProyecto = If(GlobalDTSubProyectos(-1, Obj.CveSubProyecto, CveEmpresa:=UsuarioActual.CveEmpresa)(0)("AplicaComercioExterior").ToString() = "True", True, False) + Timbre.Complementos.ComercioExterior11.AplicaComercioExteriorSubProyecto = AplicaComercioExteriorSubProyecto + + If Obj.Cliente.AplicaComercioExterior And AplicaComercioExteriorSubProyecto Then + 'DATOS GENERALES + + Timbre.Comprobante.Exportacion = "02" + Timbre.Complementos.ComercioExterior11.TipoOperacion = GlobalDTTipoOperacion().FiltraParametros($"CveTipoOperacion={CveTipoOperacion}")(0)("ClaveSATTipoOperacion").ToString() + Timbre.Complementos.ComercioExterior11.ClavedePedimento = GlobalDTClavePedimento().FiltraParametros($"CvePedimento={CvePedimento}")(0)("ClaveSATPedimento").ToString() + Timbre.Complementos.ComercioExterior11.CertificadoOrigen = "0" + Timbre.Complementos.ComercioExterior11.Incoterm = GlobalDTIncoterm.FiltroPrimeroValor("ClaveSATIncoterm", $"CveIncoterm={DdlIncoterm.SelectedValue}") + Timbre.Complementos.ComercioExterior11.Subdivision = "0" + Timbre.Complementos.ComercioExterior11.TipoCambioUSD = If(Obj.CveMoneda = 1, 1, Obj.TipoCambio.ToString().ToDecimal) + Timbre.Complementos.ComercioExterior11.MotivoTraslado = GlobalDTSATMotivoTraslado.FiltroPrimeroValor("ClaveSATMotivoTraslado", $"CveMotivoTraslado={DdlSATMotivoTraslado.SelectedValue}") - 'EMISOR - Dim Dr As DataRow - Dr = Nothing - If GlobalDTSubProyectos(-1, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveEmpresa:=UsuarioActual.CveEmpresa).Rows.Count > 0 Then - Dr = GlobalDTSubProyectos(-1, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveEmpresa:=UsuarioActual.CveEmpresa)(0) - End If - Timbre.Complementos.ComercioExterior11.Emisor.CURP = UsuarioActual.Empresa.CURP - Timbre.Complementos.ComercioExterior11.Emisor.Calle = Dr("Calle").ToString() - Timbre.Complementos.ComercioExterior11.Emisor.NumeroExterior = Dr("NoExt").ToString() - Timbre.Complementos.ComercioExterior11.Emisor.NumeroInterior = Dr("NoInt").ToString() - Timbre.Complementos.ComercioExterior11.Emisor.Colonia = Dr("ClaveSATColonia").ToString() - Timbre.Complementos.ComercioExterior11.Emisor.Localidad = "" - Timbre.Complementos.ComercioExterior11.Emisor.Municipio = Dr("ClaveSATMunicipio").ToString() - Timbre.Complementos.ComercioExterior11.Emisor.Estado = Dr("ClaveSATEstado").ToString() - Timbre.Complementos.ComercioExterior11.Emisor.Pais = Dr("ClaveSATPais").ToString() - Timbre.Complementos.ComercioExterior11.Emisor.CP = Dr("ClaveSATCP").ToString() - 'RECEPTOR - Timbre.Complementos.ComercioExterior11.Receptor.NumRegIdTrib = "" ' EN LA VERSION 3.3 NO DEBE DE REGISTRARSE ESTE VALOR - Timbre.Complementos.ComercioExterior11.Receptor.Calle = Obj.Cliente.Direccion - Timbre.Complementos.ComercioExterior11.Receptor.NumeroExterior = Obj.Cliente.NoExt - Timbre.Complementos.ComercioExterior11.Receptor.NumeroInterior = Obj.Cliente.NoInt - Timbre.Complementos.ComercioExterior11.Receptor.Colonia = Obj.Cliente.ClaveSATColonia - Timbre.Complementos.ComercioExterior11.Receptor.Localidad = "" - Timbre.Complementos.ComercioExterior11.Receptor.Referencia = Obj.Cliente.ReferenciaFiscal - Timbre.Complementos.ComercioExterior11.Receptor.Municipio = Obj.Cliente.Ciudad - Timbre.Complementos.ComercioExterior11.Receptor.CP = Obj.Cliente.CP - Timbre.Complementos.ComercioExterior11.Receptor.Estado = Obj.Cliente.ClaveSATEstado - Timbre.Complementos.ComercioExterior11.Receptor.Pais = Obj.Cliente.ClaveSATPais - Timbre.Receptor.ResidenciaFiscal = Obj.Cliente.ClaveSATPais - Timbre.Receptor.NumeroRegistroTributario = Obj.Cliente.NumRegIdTrib + 'EMISOR + Dim Dr As DataRow + Dr = Nothing + If GlobalDTSubProyectos(-1, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveEmpresa:=UsuarioActual.CveEmpresa).Rows.Count > 0 Then + Dr = GlobalDTSubProyectos(-1, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveEmpresa:=UsuarioActual.CveEmpresa)(0) + End If + Timbre.Complementos.ComercioExterior11.Emisor.CURP = UsuarioActual.Empresa.CURP + Timbre.Complementos.ComercioExterior11.Emisor.Calle = Dr("Calle").ToString() + Timbre.Complementos.ComercioExterior11.Emisor.NumeroExterior = Dr("NoExt").ToString() + Timbre.Complementos.ComercioExterior11.Emisor.NumeroInterior = Dr("NoInt").ToString() + Timbre.Complementos.ComercioExterior11.Emisor.Colonia = Dr("ClaveSATColonia").ToString() + Timbre.Complementos.ComercioExterior11.Emisor.Localidad = "" + Timbre.Complementos.ComercioExterior11.Emisor.Municipio = Dr("ClaveSATMunicipio").ToString() + Timbre.Complementos.ComercioExterior11.Emisor.Estado = Dr("ClaveSATEstado").ToString() + Timbre.Complementos.ComercioExterior11.Emisor.Pais = Dr("ClaveSATPais").ToString() + Timbre.Complementos.ComercioExterior11.Emisor.CP = Dr("ClaveSATCP").ToString() - Dim ComExtPais, ComExtEstado, ComExtMunicipio, ComExtColonia, ComExtCalle, ComExtNumero, ComExtCP As String - ComExtColonia = "" : ComExtMunicipio = "" - ComExtPais = GlobalDTGralPaises.FiltroPrimeroValor("ClaveSATPais", $"CvePais={DdlComExtPais.SelectedValue}") - ComExtCalle = TxtComExtCalle.Text.Trim - ComExtNumero = TxtComExtNumero.Text.Trim - ComExtCP = TxtComExtCP.Text.Trim - If ComExtPais = "MEX" Then - ComExtEstado = GlobalDTGralEstados(ComExtPais).FiltroPrimeroValor("ClaveSATEstado", $"CveEstado={DdlComExtEstado.SelectedValue}") - ComExtMunicipio = GlobalDTGralMunicipios(ComExtEstado).FiltroPrimeroValor("ClaveSATMunicipio", $"CveMunicipio={DdlComExtMunicipio.SelectedValue}") - ComExtColonia = GlobalDTGralColonias("-1", "-1", "-1", CveColonia:=DdlComExtColonia.SelectedValue.ToEntero).FiltroPrimeroValor("ClaveSATColonia", "") - Else - If ComExtPais.Contiene("USA", "CAN") Then + 'RECEPTOR + Timbre.Complementos.ComercioExterior11.Receptor.NumRegIdTrib = If(Timbre.Comprobante.Version = "4.0", Obj.Cliente.NumRegIdTrib, "") ' EN LA VERSION 3.3 NO DEBE DE REGISTRARSE ESTE VALOR + Timbre.Complementos.ComercioExterior11.Receptor.Calle = Obj.Cliente.Direccion + Timbre.Complementos.ComercioExterior11.Receptor.NumeroExterior = Obj.Cliente.NoExt + Timbre.Complementos.ComercioExterior11.Receptor.NumeroInterior = Obj.Cliente.NoInt + Timbre.Complementos.ComercioExterior11.Receptor.Colonia = Obj.Cliente.ClaveSATColonia + Timbre.Complementos.ComercioExterior11.Receptor.Localidad = "" + Timbre.Complementos.ComercioExterior11.Receptor.Referencia = Obj.Cliente.ReferenciaFiscal + Timbre.Complementos.ComercioExterior11.Receptor.Municipio = Obj.Cliente.Ciudad + Timbre.Complementos.ComercioExterior11.Receptor.CP = Obj.Cliente.CP + Timbre.Complementos.ComercioExterior11.Receptor.Estado = Obj.Cliente.ClaveSATEstado + Timbre.Complementos.ComercioExterior11.Receptor.Pais = Obj.Cliente.ClaveSATPais + Timbre.Receptor.ResidenciaFiscal = Obj.Cliente.ClaveSATPais + Timbre.Receptor.NumeroRegistroTributario = Obj.Cliente.NumRegIdTrib + + Dim ComExtPais, ComExtEstado, ComExtMunicipio, ComExtColonia, ComExtCalle, ComExtNumero, ComExtCP As String + ComExtColonia = "" : ComExtMunicipio = "" + ComExtPais = GlobalDTGralPaises.FiltroPrimeroValor("ClaveSATPais", $"CvePais={DdlComExtPais.SelectedValue}") + ComExtCalle = TxtComExtCalle.Text.Trim + ComExtNumero = TxtComExtNumero.Text.Trim + ComExtCP = TxtComExtCP.Text.Trim + + If ComExtPais = "MEX" Then ComExtEstado = GlobalDTGralEstados(ComExtPais).FiltroPrimeroValor("ClaveSATEstado", $"CveEstado={DdlComExtEstado.SelectedValue}") + ComExtMunicipio = GlobalDTGralMunicipios(ComExtEstado).FiltroPrimeroValor("ClaveSATMunicipio", $"CveMunicipio={DdlComExtMunicipio.SelectedValue}") + ComExtColonia = GlobalDTGralColonias("-1", "-1", "-1", CveColonia:=DdlComExtColonia.SelectedValue.ToEntero).FiltroPrimeroValor("ClaveSATColonia", "") Else - ComExtEstado = TxtComExtEstado.Text.Trim + If ComExtPais.Contiene("USA", "CAN") Then + ComExtEstado = GlobalDTGralEstados(ComExtPais).FiltroPrimeroValor("ClaveSATEstado", $"CveEstado={DdlComExtEstado.SelectedValue}") + Else + ComExtEstado = TxtComExtEstado.Text.Trim + End If + ComExtMunicipio = TxtComExtMunicipio.Text.Trim + ComExtColonia = TxtComExtColonia.Text.Trim End If - ComExtMunicipio = TxtComExtMunicipio.Text.Trim - ComExtColonia = TxtComExtColonia.Text.Trim + + 'DESTINATARIO + Timbre.Complementos.ComercioExterior11.Destinatario.Nombre = TxtDestinatarioNombre.Text.Trim + Timbre.Complementos.ComercioExterior11.Destinatario.Calle = ComExtCalle + Timbre.Complementos.ComercioExterior11.Destinatario.NumeroExterior = ComExtNumero + Timbre.Complementos.ComercioExterior11.Destinatario.NumeroInterior = "" + Timbre.Complementos.ComercioExterior11.Destinatario.Colonia = ComExtColonia + Timbre.Complementos.ComercioExterior11.Destinatario.Localidad = "" + Timbre.Complementos.ComercioExterior11.Destinatario.Referencia = Obj.Cliente.ReferenciaFiscal + Timbre.Complementos.ComercioExterior11.Destinatario.Municipio = ComExtMunicipio + Timbre.Complementos.ComercioExterior11.Destinatario.CP = ComExtCP + Timbre.Complementos.ComercioExterior11.Destinatario.Estado = ComExtEstado + Timbre.Complementos.ComercioExterior11.Destinatario.Pais = ComExtPais + Timbre.Complementos.ComercioExterior11.Destinatario.NumRegIdTrib = TxtNumRegIdTrib.Text.Trim + + + 'MERCANCIAS + For Each Gvr As GridViewRow In GvComercioExterior.Rows + Dim mercancia As New CFDIComercioExterior11Mercancias With {.CantidadAduana = Gvr.FCTextBox("TxtCantidad").Text.ToDecimal, + .FraccionArancelaria = Gvr.DataKey("ClaveSATFraccionArancelaria").ToString(), + .UnidadAduana = Gvr.DataKey("ClaveSATUnidadAduana").ToString(), + .ValorDolares = Math.Round(Gvr.FCTextBox("TxtCantidad").Text.ToDecimal * Gvr.FCTextBox("TxtValorUnitario").Text.ToDecimal, 2), + .ValorUnitarioAduana = Gvr.FCTextBox("TxtValorUnitario").Text.ToDecimal, + .NoIdentificacion = Gvr.DataKey("Codigo")} + If Gvr.FCTextBox("TxtMarca").Text <> "" Then + mercancia.DescripcionesEspecificas.Marca = Gvr.FCTextBox("TxtMarca").Text + End If + + Timbre.Complementos.ComercioExterior11.Mercancias.Add(mercancia) + i += 1 + Next End If - 'DESTINATARIO - Timbre.Complementos.ComercioExterior11.Destinatario.Nombre = TxtDestinatarioNombre.Text.Trim - Timbre.Complementos.ComercioExterior11.Destinatario.Calle = ComExtCalle - Timbre.Complementos.ComercioExterior11.Destinatario.NumeroExterior = ComExtNumero - Timbre.Complementos.ComercioExterior11.Destinatario.NumeroInterior = "" - Timbre.Complementos.ComercioExterior11.Destinatario.Colonia = ComExtColonia - Timbre.Complementos.ComercioExterior11.Destinatario.Localidad = "" - Timbre.Complementos.ComercioExterior11.Destinatario.Referencia = Obj.Cliente.ReferenciaFiscal - Timbre.Complementos.ComercioExterior11.Destinatario.Municipio = ComExtMunicipio - Timbre.Complementos.ComercioExterior11.Destinatario.CP = ComExtCP - Timbre.Complementos.ComercioExterior11.Destinatario.Estado = ComExtEstado - Timbre.Complementos.ComercioExterior11.Destinatario.Pais = ComExtPais - Timbre.Complementos.ComercioExterior11.Destinatario.NumRegIdTrib = TxtNumRegIdTrib.Text.Trim - - 'MERCANCIAS - For Each Gvr As GridViewRow In GvComercioExterior.Rows - Dim mercancia As New CFDIComercioExterior11Mercancias With {.CantidadAduana = Gvr.FCTextBox("TxtCantidad").Text.ToDecimal, - .FraccionArancelaria = Gvr.DataKey("ClaveSATFraccionArancelaria").ToString(), - .UnidadAduana = Gvr.DataKey("ClaveSATUnidadAduana").ToString(), - .ValorDolares = Math.Round(Gvr.FCTextBox("TxtCantidad").Text.ToDecimal * Gvr.FCTextBox("TxtValorUnitario").Text.ToDecimal, 2), - .ValorUnitarioAduana = Gvr.FCTextBox("TxtValorUnitario").Text.ToDecimal, - .NoIdentificacion = Gvr.DataKey("Codigo")} - If Gvr.FCTextBox("TxtMarca").Text <> "" Then - mercancia.DescripcionesEspecificas.Marca = Gvr.FCTextBox("TxtMarca").Text - End If - - Timbre.Complementos.ComercioExterior11.Mercancias.Add(mercancia) - i += 1 - Next + Else + Timbre.Complementos.ComercioExterior11.AplicaComercioExteriorSubProyecto = False End If + + + + Return Timbre End Function @@ -15615,16 +15670,12 @@ Partial Class Ventas Dim TipoMovimiento As Boolean = True Dim Concepto As String = VentaActual.SerieFolio Dim Referencia As String = VentaActual.SerieFolio + CveIEAnticipo = gvr.DataKey("CveIE").ToEntero() Select Case gvr.DataKey("CveConceptoContable").ToString() Case "3" - 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) - ' TipoCambioGeneral = tipoCambioPago - ' IdCtaContable = IdCtaContAnticipos - If importeMovimiento <> 0 Then Dim Pago As New VentaPago @@ -15682,6 +15733,8 @@ Partial Class Ventas Pago.TipoPago = "NC" Pago.CveVentaAmortizacion = gvr.DataKey("CveVenta").ToEntero() Pago.AplicaTraslado = gvr.DataKey("RegresarImpuesto") = "1" + Pago.Referencia = gvr.DataKey("Folio") + Pago.CveConceptoPago = 251 ErrorConta = AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjConta) SimplificaPrePoliza = False @@ -15689,7 +15742,7 @@ Partial Class Ventas Case "66" If gvr.DataKey("CveIE").ToEntero() > 0 Then - CveIEAnticipo = gvr.DataKey("CveIE").ToEntero() + importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal IdCtaContable = IdCtaContClientes @@ -15702,6 +15755,7 @@ Partial Class Ventas Pago.TipoPago = "A" Pago.CveVentaAmortizacion = gvr.DataKey("CveVenta").ToEntero() Pago.AplicaTraslado = gvr.DataKey("RegresarImpuesto") = "1" + Pago.Referencia = gvr.DataKey("Folio") ErrorConta = AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjConta) @@ -29293,8 +29347,9 @@ Partial Class Ventas Private Sub CargaEstado() DdlComExtEstado.Items.Clear() If DdlComExtPais.SelectedValue.ToEntero() > 0 Then - DdlComExtEstado.DataSource = GlobalDTGralEstados("-1", CvePais:=DdlComExtPais.SelectedValue.ToEntero)(0)("ClaveSATPais").ToString() + DdlComExtEstado.DataSource = GlobalDTGralEstados("-1", CvePais:=DdlComExtPais.SelectedValue.ToEntero) '(0)("ClaveSATPais").ToString() End If + DdlComExtEstado.Visible = True DdlComExtEstado.Items.Insert(0, New ListItem("Seleccione", "-1")) DdlComExtEstado.DataBind() End Sub @@ -33151,6 +33206,15 @@ Partial Class Ventas UpFacturar.Update() End If ObjVentas.Dispose() + + 'REGENERAR EL PDF + Try + Dim strURLHOST = String.Format("{0}://{1}:{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port) + Dim Hilo As New System.Threading.Thread(Sub() RegenerarPDF(CveVenta, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, strURLHOST)) + Hilo.Start() + Catch ex As Exception + OnError("Ocurrió un error al regenerar el PDF", ex) + End Try End Sub Private Function DeshabilitarAplicarNotaDeCredito(RFC As String) As Boolean @@ -34981,5 +35045,10 @@ Partial Class Ventas End Function + Protected Sub ChkEmitirComercioExterior_CheckedChanged(sender As Object, e As EventArgs) + + End Sub + + End Class