diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index e26c2b4f3..46f8dd8db 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -9325,6 +9325,7 @@ Public Class ClsPaginas PaginaDict.Add("/Ventas/RepCancelacionesVentas.aspx".ToUpper(), 1325) PaginaDict.Add("/Ventas/RepLineasAdicionales.aspx".ToUpper(), 1331) PaginaDict.Add("/Ventas/RepLineasAdicionales.aspx?OP=OP".ToUpper(), 1332) + PaginaDict.Add("/Ventas/FacturacionAcarreos.aspx".ToUpper(), 774) #End Region #Region "Varios" 'Portal Cliente/Proveedor diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 2f36c6a29..0ecf1a268 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -5829,6 +5829,115 @@ Public Class ClsVentas Return Retorno End Function + Public Function AddFacturacionAcarreos(Sucursal As String, RFCCliente As String, Cantidad As Decimal, PSGeneral As String, DireccionOrigen As String, DireccionDestino As String, FechaSalida As DateTime, FechaLlegada As DateTime, + Camion As String, Chofer As String, ConfigAutoTransporte As String, CamionRemolque1 As String, CamionRemolque2 As String, Distancia As Decimal, CveEmpresa As Integer) As String + Dim Retorno As String = "" + DataAdapter("PA_Vta_FacturacionAcarreosAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@SubProyecto", SqlDbType.VarChar).Value = Sucursal + .Add("@RFCCliente", SqlDbType.VarChar).Value = RFCCliente + .Add("@Cantidad", SqlDbType.Decimal).Value = Cantidad + .Add("@PSGeneral", SqlDbType.VarChar).Value = PSGeneral + .Add("@DireccionOrigen", SqlDbType.VarChar).Value = DireccionOrigen + .Add("@DireccionDestino", SqlDbType.VarChar).Value = DireccionDestino + .Add("@FechaSalida", SqlDbType.DateTime).Value = FechaSalida + .Add("@FechaLlegada", SqlDbType.DateTime).Value = FechaLlegada + .Add("@Camion", SqlDbType.VarChar).Value = Camion + .Add("@Chofer", SqlDbType.VarChar).Value = Chofer + .Add("@ConfigAutoTransporte", SqlDbType.VarChar).Value = ConfigAutoTransporte + .Add("@CamionRemolque1", SqlDbType.VarChar).Value = CamionRemolque1 + .Add("@CamionRemolque2", SqlDbType.VarChar).Value = CamionRemolque2 + .Add("@Distancia", SqlDbType.Decimal).Value = Distancia + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@ErrorMSG", SqlDbType.VarChar, 300).Direction = ParameterDirection.Output + End With + + Try + SqlAdapter.Fill(Data) + Retorno = SqlAdapter.SelectCommand.Parameters("@ErrorMSG").Value.ToString + Catch ex As Exception + OnError("Ocurrió un error al guardar los datos de facturación.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function GetFacturacionAcarreos(CveFacturacionAcarreo As Integer, CveCliente As Integer, CveSubProyecto As Integer, Estatus As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_FacturacionAcarreosGet") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveFacturacionAcarreo", SqlDbType.Int).Value = CveFacturacionAcarreo + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@Estatus", SqlDbType.Int).Value = Estatus + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los datos de facturación.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + + End Function + + Public Function UpdateFacturacionAcarreo(CveFacturacionAcarreo As Integer, CveVenta As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_FacturacionAcarreosUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveFacturacionAcarreo", SqlDbType.Int).Value = CveFacturacionAcarreo + .Add("@CveVenta", SqlDbType.Int).Value = CveVenta + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los actualizar los datos de facturación.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + + End Function + + Public Function RemoveFacturacionAcarreo(CveFacturacionAcarreo As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_FacturacionAcarreosRemove") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveFacturacionAcarreo", SqlDbType.Int).Value = CveFacturacionAcarreo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los eliminar los datos de facturación.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + + End Function + + Public Function RemoveFacturacionAcarreos(CveFacturacionAcarreo As Integer, CveEmpresa As Integer) As Boolean + + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_FacturacionAcarreosRemove") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveFacturacionAcarreo", SqlDbType.Int).Value = CveFacturacionAcarreo + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar los datos de facturación.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + + End Function + + #Region "IDisposable Support" diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index d51456f8c..98e5608c7 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -811,6 +811,13 @@ Namespace Modelos End If End If + 'VALIDA QUE EL PRECIO DEBA SER MAYOR A CERO + If Me.CveFacturacionAcarreo > 0 AndAlso Me.DtDetalle.SUMD("PU") <= 0 Then + ErrorList.Add("El precio unitario debe ser mayor a cero.") + Retorno.Mensajes = ErrorList + Return Retorno + End If + If Me.CveCliente > 0 Or Me.CveEmpresaCRM > 0 Then If DtDetalle.Rows.Count > 0 Then @@ -831,6 +838,7 @@ Namespace Modelos Dim ObjEventos As New ClsOIEventos(ObjVentas.IniciaTransacSQL()) Dim ObjCGame As New ClsCGame(ObjVentas.IniciaTransacSQL()) Dim ObjDocCliente As New ClsEdocumentacion(ObjVentas.IniciaTransacSQL()) + Dim ObjGeneral As New ClsGenerales(ObjVentas.IniciaTransacSQL()) Dim ObjAcum As New ClsAcumuladores(ObjVentas.IniciaTransacSQL()) Dim ObjContPaq As ClsContPAQi = Nothing Dim MensajeAlert = New StringBuilder @@ -863,8 +871,17 @@ Namespace Modelos Next End If + Dim CveTimbreCartaPorte As Integer = -1 + GuardarVenta(Me, ObjVentas, ObjConta, ObjInventario, ObjContr, DtDetalle, Me.CveNCaVincular, ObjContPaq, ObjBancos, ObjOS, ObjEventos, ObjCGame, ObjClientes, ObjAcum:=ObjAcum, Resp:=Retorno, Modulo:=Modulo) + If ErrorList.Count = 0 AndAlso Me.EmitirCartaPorte AndAlso Me.TipoDocto = "Ing" Then + CveTimbreCartaPorte = GuardarCartaPorte(Me, ObjGeneral, ObjVentas) + If CveTimbreCartaPorte <= 0 Then + ErrorList.Add("Ocurrió un error al registrar la carta porte") + End If + End If + 'SI ES REFACTURACION Dim ObjNC As List(Of Object) = Nothing If ErrorList.Count = 0 Then @@ -1016,6 +1033,12 @@ Namespace Modelos End If End If + If CveFacturacionAcarreo > 0 AndAlso ErrorList.Count = 0 Then + If Not ObjVentas.UpdateFacturacionAcarreo(Me.CveFacturacionAcarreo, CveVenta) Then + ErrorList.Add("No se pudo actualizar los datos de facturación de acarreo") + End If + End If + If ErrorList.Count = 0 AndAlso Me.CveVenta > 0 AndAlso DtDocumentacionCliente IsNot Nothing Then ' si se cargó algun documento If DtDocumentacionCliente.FiltraParametros("RutaArchivo <> ''").Rows.Count > 0 Then @@ -1064,6 +1087,16 @@ Namespace Modelos Dim ObjTimbrado As New Timbrado 'DOCUMENTO ACTUAL If DebeTimbrar Then + If Me.EmitirCartaPorte AndAlso CveTimbreCartaPorte > 0 Then + Dim RespCartaPorte = Timbres.PreParaCartaPorteFactura(CveTimbreCartaPorte, UsuarioActual) + If Not RespCartaPorte.TieneError Then + Me.Timbre.Complementos.CartaPorte = RespCartaPorte.CartaPorte + Else + DebeTimbrar = False + Retorno.Mensajes.Add(RespCartaPorte.Mensaje) + End If + End If + SeTimbro = ObjTimbrado.TimbrarFactura(UsuarioActual, Me) 'NOTA DE CREDITO - REFACTURADA - CASO ESPECIAL, TIMBRADO E IMPRESION @@ -1132,7 +1165,7 @@ Namespace Modelos If SeTimbro Then Dim ArchivoXML = String.Format("{0}/XML/{1}/{2}.xml", UsuarioActual.Empresa.Ruta, Me.TipoDocto, Me.SerieFolio) If File.Exists(ArchivoXML) Then - MensajeAlert.AppendFormat("", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", CveVenta, "XML", Me.SerieFolio, Me.TipoDocto))) + MensajeAlert.AppendFormat("", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", CveVenta, "XML", Me.SerieFolio, Me.TipoDocto))) End If End If @@ -1204,6 +1237,10 @@ Namespace Modelos MensajeAlert.AppendFormat("

Se generó una Nota de crédito Folio: {0} amortizando el anticipo
", FacturaDevolucion.Folio) End If + If SeTimbro AndAlso CveFacturacionAcarreo > 0 Then + MensajeAlert.AppendFormat("
", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1", CveVenta))) + End If + If TipoMensajeRespuesta = TipoMensajeRespuesta.HTML Then ListaMensajes.Add(MensajeAlert.ToString) Retorno.LigaCliente = $"document.location.href=""/Ventas/Clientes.aspx?CveCliente={Me.CveCliente}&Opt=3"";" @@ -1286,6 +1323,575 @@ Namespace Modelos Return Retorno End Function + Public Shared Function CrearVentaNueva(UsuarioActual As Usuario, CveSubProyecto As Integer, CveCliente As Integer, CveMoneda As Integer) As Modelos.Factura + Dim ObjFactura = New Modelos.Factura(UsuarioActual) + Try + ObjFactura.DirectorioServidor = HttpContext.Current.Server.MapPath("/") + + Dim CveProyecto As String = "" + Dim Proyecto As String = "" + Dim SubProyecto As String = "" + + ObjFactura.Version = "4.0" + ObjFactura.CveUsuario = UsuarioActual.CveUsuario + ObjFactura.CveEmpresa = UsuarioActual.CveEmpresa + ObjFactura.ConvertirPesos = False + ObjFactura.CveMoneda = CveMoneda + ObjFactura.Moneda = ClsPaginas.GlobalDTMonedas.FiltroPrimeroValor("Moneda", $"CveMoneda = {ObjFactura.CveMoneda} ") + ObjFactura.MonedaSAT = ClsPaginas.GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", $"CveMoneda = {ObjFactura.CveMoneda}") + ObjFactura.TipoCambio = If(ObjFactura.CveMoneda = 1, 1, ClsPaginas.GlobalTipoCambio(Now).ToDecimal()) + ObjFactura.TipoDocto = "Ing" + ObjFactura.RefDocto = "" + ObjFactura.Folio = -1 + ObjFactura.Serie = "-1" + ObjFactura.Fecha = Now + ObjFactura.CvePrePoliza = -1 + ObjFactura.CveMetodoPago = 1 + ObjFactura.MetodoPago = "Efectivo" + ObjFactura.FechaPago = DateTime.Today + ObjFactura.MotivoDescuento = "" + ObjFactura.Observaciones = "" + ObjFactura.FechaEjecucion = DateTime.Today + ObjFactura.UsuarioCreo = UsuarioActual.Usuario + ObjFactura.CveCondicionEntrega = -1 + ObjFactura.CondicionEntrega = "" + ObjFactura.NumeroCuenta = "" + ObjFactura.CondicionesPago = 0 + ObjFactura.FormaPago = 0 + ObjFactura.PedidoContrato = "" + ObjFactura.NumeroContrato = "" + ObjFactura.DescripcionContrato = "" + ObjFactura.CveCorte = -1 + ObjFactura.TipoDocumento = "Factura" + ObjFactura.Alfa1 = "" + ObjFactura.Alfa2 = "" + ObjFactura.Alfa3 = "" + 'Totales, Y se llena TmpDTImpuestos + ObjFactura.Descuento = 0 + ObjFactura.Amortizacion = 0 + ObjFactura.CveContrato = -1 + 'CLIENTE + ObjFactura.CveCliente = CveCliente + ObjFactura.SetCliente() + + Dim ObjCliente As New ClsClientes + If ObjCliente.GetClientes(ObjFactura.CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa, -1, TipoCliente:=-1) Then + If ObjCliente.DtResultados.Rows.Count > 0 Then + ObjFactura.CveFormaPago33 = ObjCliente.CveFormaPago33 + ObjFactura.FormaPago33 = ClsPaginas.GlobalDTVtaFormaPago.FiltroPrimeroValor("FormaPago", String.Format("CveFormaPago = {0}", ObjCliente.CveFormaPago33)) + ObjFactura.FormaPagoSAT33 = ClsPaginas.GlobalDTVtaFormaPago.FiltroPrimeroValor("ClaveFormaPagoSAT", String.Format("CveFormaPago = {0}", ObjCliente.CveFormaPago33)) + + ObjFactura.CveMetodoPago33 = ObjCliente.CveMetodoPago33 + ObjFactura.MetodoPago33 = ClsPaginas.GlobalDTVtaMetodoPago.FiltroPrimeroValor("MetodoPago", String.Format("CveMetodoPago = {0}", ObjCliente.CveMetodoPago33)) + ObjFactura.ClaveMetodoPagoSAT = ClsPaginas.GlobalDTVtaMetodoPago.FiltroPrimeroValor("ClaveMetodoPagoSAT", String.Format("CveMetodoPago = {0}", ObjCliente.CveMetodoPago33)) + + ObjFactura.CveUsoCFDI = ObjCliente.CveUsoCFDI + ObjFactura.UsoCFDI = ClsPaginas.GlobalDTSATUsosCFDI.FiltroPrimeroValor("Descripcion", String.Format("CveUsoCFDI = {0}", ObjCliente.CveUsoCFDI)) + ObjFactura.ClaveUsoCFDI = ClsPaginas.GlobalDTSATUsosCFDI.FiltroPrimeroValor("UsoCFDI", String.Format("CveUsoCFDI = {0}", ObjCliente.CveUsoCFDI)) + End If + End If + + If ObjCliente.GetSucursales(ObjFactura.CveCliente) Then + If ObjCliente.DtResultados.Rows.Count > 0 Then + ObjFactura.CveClienteSucursal = If(String.IsNullOrEmpty(ObjCliente.DtResultados.FiltroPrimeroValor("CveClienteSucursal", "Estatus = 'Activo'")), -1, ObjCliente.DtResultados.FiltroPrimeroValor("CveClienteSucursal", "Estatus = 'Activo'").ToEntero()) + Else + ObjFactura.CveClienteSucursal = -1 + End If + End If + ObjCliente.Dispose() + + ObjFactura.CveSubProyecto = CveSubProyecto.ToEntero + + ObjFactura.SetSubProyecto() + ObjFactura.SetSubProyectoMatriz() + + ObjFactura.CveSubProyectoCobranza = CveSubProyecto.ToEntero + ObjFactura.CveSubProyectoEjecucion = CveSubProyecto.ToEntero + 'DETALLES + ObjFactura.DtDetalle = CreaDTFactura() + + ObjFactura.SubTotal = ObjFactura.DtDetalle.SUMD("Total") + ObjFactura.IVA = ObjFactura.DtDetalle.SUMD("ImporteIVA") + ObjFactura.RetIVA = ObjFactura.DtDetalle.SUMD("ImporteRetIVA") + ObjFactura.RetISR = ObjFactura.DtDetalle.SUMD("ImporteRetISR") + ObjFactura.IEPS = ObjFactura.DtDetalle.SUMD("ImporteIEPS") + + ObjFactura.Total = ObjFactura.SubTotal + ObjFactura.IVA + ObjFactura.IEPS - (ObjFactura.RetIVA + ObjFactura.RetISR) + + 'SUBPROYECTO + Catch ex As Exception + ObjFactura = Nothing + End Try + + + Return ObjFactura + + End Function + + Private Shared Function CreaDTFactura() As DataTable + Dim TmpDT = New DataTable + TmpDT.Columns.Add("CveVenta", GetType(Integer)) + TmpDT.Columns.Add("Consec", GetType(Integer)) + TmpDT.Columns.Add("Cantidad", GetType(Decimal)) + TmpDT.Columns.Add("Codigo", GetType(String)) + TmpDT.Columns.Add("CveUM", GetType(Integer)) + TmpDT.Columns.Add("UM", GetType(String)) + TmpDT.Columns.Add("SATClaveUM", GetType(String)) + TmpDT.Columns.Add("CveClasificacion", GetType(Integer)) + TmpDT.Columns.Add("Clasificacion", GetType(String)) + TmpDT.Columns.Add("CvePS", GetType(Integer)) + TmpDT.Columns.Add("PS", GetType(String)) + TmpDT.Columns.Add("CodigoPS", GetType(String)) + TmpDT.Columns.Add("SATClaveProdServ", GetType(String)) + TmpDT.Columns.Add("NoIdentificacion", GetType(String)) + TmpDT.Columns.Add("CveTipoPS", GetType(Integer)) + TmpDT.Columns.Add("CveTipoInvPS", GetType(Integer)) + TmpDT.Columns.Add("Serie", GetType(String)) + TmpDT.Columns.Add("CuentaPredial", GetType(String)) + TmpDT.Columns.Add("Obs", GetType(String)) + TmpDT.Columns.Add("TiempoEntrega", GetType(String)) + TmpDT.Columns.Add("PU", GetType(Decimal)) + TmpDT.Columns.Add("IVA", GetType(Decimal)) + TmpDT.Columns.Add("ImporteIVA", GetType(Decimal)) + TmpDT.Columns.Add("PorcentajeIVA", GetType(Decimal)) + TmpDT.Columns.Add("ImporteRetIVA", GetType(Decimal)) + TmpDT.Columns.Add("ImporteRetISR", GetType(Decimal)) + TmpDT.Columns.Add("PorcentajeRetIVA", GetType(Decimal)) + TmpDT.Columns.Add("PorcentajeRetISR", GetType(Decimal)) + TmpDT.Columns.Add("ImporteIEPS", GetType(Decimal)) + TmpDT.Columns.Add("IEPS", GetType(Decimal)) + TmpDT.Columns.Add("PorcentajeIEPS", GetType(Decimal)) + TmpDT.Columns.Add("Descuento", GetType(Decimal)) + TmpDT.Columns.Add("TipoDescuento", GetType(Integer)) + TmpDT.Columns.Add("TotalImporte", GetType(Decimal)) + TmpDT.Columns.Add("Total", GetType(Decimal)) + TmpDT.Columns.Add("RetIVA", GetType(Decimal)) + TmpDT.Columns.Add("RetISR", GetType(Decimal)) + 'Para uso del módulo contable + TmpDT.Columns.Add("AsientoContableVentas", GetType(Integer)) + TmpDT.Columns.Add("IdCtaContVentas", GetType(Integer)) + TmpDT.Columns.Add("AplicaParaConcepto", GetType(Boolean)) + TmpDT.Columns.Add("CveProyecto", GetType(Integer)) + TmpDT.Columns.Add("Proyecto", GetType(String)) + TmpDT.Columns.Add("CveSubProyecto", GetType(Integer)) + TmpDT.Columns.Add("SubProyecto", GetType(String)) + TmpDT.Columns.Add("CveVentaDetallePadre", GetType(Integer)) + TmpDT.Columns.Add("CvePromocionDetalle", GetType(Integer)) + + 'TipoDescuento: 1 = Descuento * PU; 2 = Descuento por Total del concepto + TmpDT.Columns.Add("CvePresupuestoIngreso", GetType(Integer)) + TmpDT.Columns.Add("CveFuenteRecaudacion", GetType(Integer)) + 'Contratos + TmpDT.Columns.Add("CveContratoDetalle", GetType(Integer)) + 'Remisiones a Facturas + TmpDT.Columns.Add("CveVentaDetalle", GetType(Integer)) + TmpDT.Columns.Add("CveVentaDetalleRemision", GetType(Integer)) + TmpDT.Columns.Add("CveVentaDetalleCotizacion", GetType(Integer)) + + 'Pedido2 a Facturas + TmpDT.Columns.Add("CveVentaDetallePedido2", GetType(Integer)) + + TmpDT.Columns.Add("Origen", GetType(Integer)) + 'Ordenes Servicio + TmpDT.Columns.Add("CveOS", GetType(Integer)) + TmpDT.Columns.Add("CveOSDetalle", GetType(Integer)) + TmpDT.Columns.Add("SeFacturara", GetType(Integer)) + TmpDT.Columns.Add("Folio", GetType(Integer)) + TmpDT.Columns.Add("Estatus", GetType(String)) + 'Ordenamiento + TmpDT.Columns.Add("Orden", GetType(Integer)) + TmpDT.Columns.Add("TipoDocto", GetType(String)) + 'OC + TmpDT.Columns.Add("CveOrdenCompraDetalle", GetType(Integer)) + TmpDT.Columns.Add("EntregaDirecta", GetType(Integer)) + + TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer)) + TmpDT.Columns.Add("CantidadFacturadaRem", GetType(Decimal)) + TmpDT.Columns.Add("CantidadFacturadaCot", GetType(Decimal)) + TmpDT.Columns.Add("CantidadFacturadaPed2", GetType(Decimal)) + TmpDT.Columns.Add("CantidadInventario", GetType(Decimal)) + + TmpDT.Columns.Add("ClaveSATFraccionArancelaria", GetType(String)) + TmpDT.Columns.Add("ClaveSATUnidadAduana", GetType(String)) + TmpDT.Columns.Add("ClaveSATFraccionArancelariaDescripcion", GetType(String)) + TmpDT.Columns.Add("ClaveSATUnidadAduanaDescripcion", GetType(String)) + + TmpDT.Columns.Add("CveTamaño", GetType(Integer)) + TmpDT.Columns.Add("CveConcepto", GetType(Integer)) + TmpDT.Columns.Add("EsCargo", GetType(Boolean)) + TmpDT.Columns.Add("CveVentaDetalleRNC", GetType(Integer)) + + TmpDT.Columns.Add("TieneProntoPago", GetType(String)) + TmpDT.Columns.Add("ImporteProntoPago", GetType(Decimal)) + TmpDT.Columns.Add("CodigoObjetoImpuesto", GetType(String)) + TmpDT.Columns.Add("CveMarca", GetType(Integer)) + + TmpDT.Columns.Add("CvePrecioLista", GetType(Integer)) + TmpDT.Columns.Add("PrecioLista", GetType(String)) + + TmpDT.Columns.Add("CveActivoFijo", GetType(Integer)) + TmpDT.Columns.Add("AFDepreciacion", GetType(Decimal)) + TmpDT.Columns.Add("AFValorInicial", GetType(Decimal)) + TmpDT.Columns("EsCargo").DefaultValue = False + + TmpDT.Columns("TieneProntoPago").DefaultValue = "No" + TmpDT.Columns("ImporteProntoPago").DefaultValue = 0 + + TmpDT.Columns.Add("NumTurnos", GetType(Decimal)) + TmpDT.Columns("NumTurnos").DefaultValue = 0 + + Return TmpDT + End Function + + Public Function AgregarPS(CvePS As Integer, Cantidad As Decimal, PU As Decimal, Descuento As Decimal, Obs As String, + Optional CveUM As Integer = -1, Optional CveProyecto As Integer = -1, Optional Proyecto As String = "", Optional CveSubProyecto As Integer = -1, + Optional SubProyecto As String = "", Optional PorcentajeIVA As Decimal = -1, Optional CuentaPredial As String = "") As Boolean + + If Not CvePS > 0 Then + Alert("Ocurrió un error al cargar la información del producto a agregar. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgError) + Return False + End If + + Dim DrPS As DataRow = ClsPaginas.GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") ' Estado = -1 + + If DrPS Is Nothing Then + Alert("Ocurrió un error al cargar la información del Producto. Por favor vuelva a intentar.", TipoMensaje.MsgError) + Return False + End If + + If PU = -1 Then + PU = DrPS("Precio").ToString().ToDecimal() + End If + + Dim NumeroDecimales As Integer = 2 + + Dim Row As DataRow = Nothing + Dim TotalCalculableImpuestos As Decimal = 0 + Dim TotalCalculableImpuestosIVA As Decimal = 0 + PU = PU.RoundSQL(6) ' el precio unitario puede llevar hasta 6 decimales permitidos + Descuento = Descuento.RoundSQL(NumeroDecimales) + + If Not Me.DtDetalle.Columns.Contains("RetIVA") Then + Me.DtDetalle.Columns.Add("RetIVA", GetType(Decimal)) + End If + + 'SI NO TIENE SUBPROYECTO ASIGNADO TOMA EL DE LA FACTURA + If CveSubProyecto = -1 Then + CveSubProyecto = Me.CveSubProyecto + End If + + Row = Me.DtDetalle.NewRow() + Row("CveProyecto") = CveProyecto + Row("Proyecto") = Proyecto + Row("CveSubProyecto") = CveSubProyecto + Row("SubProyecto") = SubProyecto + Row("Serie") = "" + Row("TiempoEntrega") = "" + + Dim ConsecutivoActual As Integer = Me.DtDetalle.MAX("Consec").ToEntero() + If ConsecutivoActual < 0 Then + ConsecutivoActual = 0 + End If + Row("Orden") = ConsecutivoActual + 1 + Row("Consec") = ConsecutivoActual + 1 + + + Dim ClienteRetIVA = Me.Cliente.RetIVA + Dim ClienteRetISR = Me.Cliente.RetISR + + If ClienteRetIVA <= 0 AndAlso DrPS("RetIVA").ToString.ToDecimal > 0 Then + ClienteRetIVA = DrPS("RetIVA").ToString.ToDecimal + End If + + 'If ClienteRetIVA <= 0 Then + ' If DdlTipoRetencion.SelectedValue.Contiene("1", "2") Then + ' ClienteRetIVA = 0.106667D + ' ElseIf DdlTipoRetencion.SelectedValue.Contiene("3") Then + ' ClienteRetIVA = 0.04D + ' End If + 'End If + + 'SI NO ES REFACTURACION verifica si tiene ventaminima + If Me.NuevaFactura <> 1 Then + If Cantidad > 0 AndAlso DrPS("VentaMinima").ToString().ToDecimal > 0 Then + 'verifico que la cantidad sea multiplo de venta minima, es decir ventaminima =5, solo puede vender 5,10,15... + If Cantidad Mod DrPS("VentaMinima").ToString().ToDecimal <> 0 Then + Alert(String.Format("El producto se vende solo en cantidades de {0}", DrPS("VentaMinima").ToString()), TipoMensaje.MsgInformacion) + Return False + End If + End If + End If + + If CveUM <= 0 Then + CveUM = DrPS("CveUnidadMedida").ToString().ToEntero() + End If + + Row("Cantidad") = Cantidad + Row("CveUM") = CveUM + Row("UM") = DrPS("UnidadMedida") + Row("CveClasificacion") = DrPS("CveClasificacion") + Row("Clasificacion") = DrPS("Clasificacion") + Row("CvePS") = CvePS + Row("Obs") = Obs + + 'VERIFICA SI EN LA FACTURA PADRE SE DESGLOSO EL IEPS + 'Dim FacturaDesglosoIEPS As Boolean = ((CveDevolucion > 0 AndAlso NuevaFactura = 1) AndAlso (Me.ObjFacturaNC IsNot Nothing AndAlso Not Me.ObjFacturaNC.VentaDesglosaIEPS)) + + 'If Not ClienteDesglosaIEPS Then + ' If Not RegeneraIEPS AndAlso Not FacturaDesglosoIEPS Then + ' PU = PU * (1 + DrPS("IEPSPorcentaje").ToString().ToDecimal) + ' VentaDesglosaIEPS = True + ' End If + ' DrPS("IEPSPorcentaje") = 0 + 'End If + ''SI YA SE DESGLOSO EL IEPS SE GUARDA LA BANDERA EN ESTA FACTURA + 'If FacturaDesglosoIEPS Then + ' VentaDesglosaIEPS = True + 'End If + + 'SI NO HAY IVA ASIGNADO TOMA EL DEL SUBPROYECTO + If PorcentajeIVA = -1 Then + PorcentajeIVA = Me.SubProyecto.IVA + End If + + If DrPS("IVA").ToString().Contiene("-1", "") Then + Row("PorcentajeIVA") = PorcentajeIVA + Else + Row("PorcentajeIVA") = DrPS("IVA") + End If + + If UsuarioActual.Empresa.Funcionalidad(373) = "1" AndAlso Me.Cliente.RFC = "XEXX010101000" Then + DrPS("IVA") = 0 + Row("PorcentajeIVA") = 0 + End If + + 'If ClienteNODesglosaIVA Then + ' 'If Not RegeneraIEPS AndAlso Not FacturaDesglosoIEPS Then + ' PU = PU * (1 + Row("PorcentajeIVA").ToString().ToDecimal) + ' VentaNODesglosaIVA = True + ' 'End If + ' DrPS("IVA") = 0 + ' Row("PorcentajeIVA") = 0 + 'End If + + TotalCalculableImpuestos = ((Cantidad * (PU)) - Descuento) + TotalCalculableImpuestosIVA = TotalCalculableImpuestos * (1 + DrPS("IEPSPorcentaje").ToString().ToDecimal) + + Row("PU") = PU + Row("Codigo") = DrPS("Codigo") + Row("NoIdentificacion") = DrPS("Codigo") + Row("ClaveSATFraccionArancelaria") = DrPS("ClaveSATFraccionArancelaria") + Row("ClaveSATUnidadAduana") = DrPS("ClaveSATUnidadAduana") + Row("ClaveSATFraccionArancelariaDescripcion") = DrPS("ClaveSATFraccionArancelariaDescripcion") + Row("ClaveSATUnidadAduanaDescripcion") = DrPS("ClaveSATUnidadAduanaDescripcion") + Row("PS") = DrPS("PS") + Row("CodigoPS") = DrPS("PSCodigo").ToString() + Row("CveTipoPS") = DrPS("CveTipoPS") + Row("CveTipoInvPS") = DrPS("Inv_CveMetodoInventario") + Row("CveTamaño") = DrPS("CveTamaño") + Row("CodigoObjetoImpuesto") = DrPS("CodigoObjetoImpuesto") + + Row("CveClasificacion") = DrPS("CveClasificacion") + Row("Clasificacion") = DrPS("Clasificacion") + + Row("IVA") = Row("PorcentajeIVA") + Row("ImporteIVA") = (Row("PorcentajeIVA").ToString().ToDecimal * TotalCalculableImpuestosIVA).RoundSQL(NumeroDecimales) + Row("ImporteRetIVA") = (ClienteRetIVA * TotalCalculableImpuestos).RoundSQL(NumeroDecimales) + + Row("RetIVA") = (ClienteRetIVA * TotalCalculableImpuestos).RoundSQL(NumeroDecimales) + + Row("ImporteRetISR") = (ClienteRetISR * TotalCalculableImpuestos).RoundSQL(NumeroDecimales) + Row("PorcentajeRetIVA") = ClienteRetIVA + Row("PorcentajeRetISR") = ClienteRetISR + Row("PorcentajeIEPS") = DrPS("IEPSPorcentaje") + Row("ImporteIEPS") = (DrPS("IEPSPorcentaje").ToString().ToDecimal * TotalCalculableImpuestos).RoundSQL(NumeroDecimales) + Row("IEPS") = Row("ImporteIEPS") + Row("Descuento") = (Descuento).RoundSQL(NumeroDecimales) + Row("TipoDescuento") = -1 + Row("CvePromocionDetalle") = -1 + Row("Total") = (Cantidad * PU) + Row("TotalImporte") = (Cantidad * PU).RoundSQL(NumeroDecimales) + + 'Row("AsientoContableVentas") = DrPS("AsientoContableVentas") + ' Row("IdCtaContVentas") = IdCtaContable + ' Row("AplicaParaConcepto") = AplicaParaConcepto + + Row("SATClaveProdServ") = DrPS("SATClavePS") + Row("SATClaveUM") = DrPS("SATClaveUnidadMedida") + + If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso UsuarioActual.Empresa.UsaAC Then + Row("CvePresupuestoIngreso") = -1 + End If + + Row("EntregaDirecta") = 0 + 'Contratos + Row("CveContratoDetalle") = -1 + Row("CveVentaDetalle") = -1 + Row("CveMovimientoDetallePedido") = -1 + Row("CveOrdenCompraDetalle") = -1 + Row("CveVentaDetalleRemision") = -1 + Row("CveVentaDetalleCotizacion") = -1 + Row("CveVentaDetallePedido2") = -1 + Row("CuentaPredial") = CuentaPredial + Row("EsCargo") = 0 + + If Me.DtDetalle.Columns.Contains("CveMarca") Then + Row("CveMarca") = DrPS("CveMarca") + End If + + Row("CvePrecioLista") = -1 + Row("PrecioLista") = "" + + Row("CveActivoFijo") = -1 + Row("AFDepreciacion") = 0 + Row("AFValorInicial") = 0 + + Row("NumTurnos") = 0 + + Me.DtDetalle.Rows.Add(Row) + + Return True + End Function + + Public Sub CalculaTotales() + Me.SubTotal = Me.DtDetalle.SUMD("Total") + Me.IVA = Me.DtDetalle.SUMD("ImporteIVA") + Me.RetIVA = Me.DtDetalle.SUMD("ImporteRetIVA") + Me.RetISR = Me.DtDetalle.SUMD("ImporteRetISR") + Me.IEPS = Me.DtDetalle.SUMD("ImporteIEPS") + + Me.Total = Me.SubTotal + Me.IVA + Me.IEPS - (Me.RetIVA + Me.RetISR) + End Sub + + Public Sub PreparaTimbre() + Dim Timbre As New CFDITimbre + Timbre.Comprobante.Version = "4.0" + + Timbre.Comprobante.TipoComprobante = If(Me.TipoDocto.Contiene("Ing", "Ant"), "I", If(Me.TipoDocto.Contiene("Egs", "Dev"), "E", "")) + Timbre.Comprobante.Folio = Me.Folio.ToString() + Timbre.Comprobante.Serie = Me.Serie + Timbre.Comprobante.Fecha = Me.FechaCP + Timbre.Comprobante.FormadePago = Me.FormaPagoSAT33 + Timbre.Comprobante.CondicionesdePago = Me.FormaPago33 + Timbre.Comprobante.MetodoPago = Me.ClaveMetodoPagoSAT + Timbre.Comprobante.SubTotal = Me.SubTotal + Timbre.Comprobante.Descuentos = Me.Descuento + Timbre.Comprobante.Moneda = Me.MonedaSAT + Timbre.Comprobante.TipoCambio = If(Me.CveMoneda = 1, "1", Me.TipoCambio.ToString()) + Timbre.Comprobante.Total = Me.Total + + Timbre.Comprobante.LugarExpedicion = Me.SubProyecto.CP + If Timbre.Comprobante.LugarExpedicion = "" Then + Dim aa As String = "no se guardo lugar de expedicion" + aa.GuardaLog() + End If + + Timbre.Comprobante.Confirmacion = "" + + If Me.FacturarSucursal Then + Timbre.Receptor.RFC = Me.ClienteSucursal.RFC + Timbre.Receptor.Nombre = Me.ClienteSucursal.Nombre + Timbre.Receptor.DomicilioFiscalReceptor = Me.ClienteSucursal.CP + Else + Timbre.Receptor.RFC = Me.Cliente.RFC + Timbre.Receptor.Nombre = Me.Cliente.Nombre + Timbre.Receptor.DomicilioFiscalReceptor = Me.Cliente.CP + End If + + Timbre.Receptor.RegimenFiscalReceptor = Me.Cliente.CodigoRegimenFiscal + + Timbre.Receptor.ResidenciaFiscal = "" + Timbre.Receptor.NumeroRegistroTributario = "" + Timbre.Receptor.UsoCFDI = Me.ClaveUsoCFDI + + Dim totSubTotal As Decimal = Me.SubTotal + Dim totIVA As Decimal = Me.IVA + Dim totRetIVA As Decimal = Me.RetIVA + Dim totRetISR As Decimal = Me.RetISR + + Dim i As Integer = 1 + + 'detalles + Dim tPS As String = "" + + For Each drr As DataRow In Me.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 = 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 = Me.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 + 'concepto.ValorUnitario = totSubTotal / concepto.Cantidad + 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 + ' si es objimp = 01, significa que no lleva desglose de impuesto, está exento + If concepto.ObjetoImpuesto <> "01" AndAlso 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 concepto.ObjetoImpuesto <> "01" AndAlso 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 concepto.ObjetoImpuesto <> "01" AndAlso 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 concepto.ObjetoImpuesto <> "01" AndAlso 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 + + 'si el codigo objeto impuesto es 02 y no tiene desglose de impuestos por el descuento, debe asignar el valor 04 - Si objeto de impuesto y no causa impuesto + If concepto.Impuestos.Count = 0 AndAlso concepto.ObjetoImpuesto = "02" AndAlso (concepto.Importe - concepto.Descuento + concepto.ImporteGravaIVAAdicional).RoundSQL(2) = 0.00D Then + concepto.ObjetoImpuesto = "04" + End If + + Timbre.Conceptos.Add(concepto) + i += 1 + Next + + Dim AplicaComercioExteriorSubProyecto As Boolean = True + + Timbre.Complementos.ComercioExterior11.AplicaComercioExteriorSubProyecto = False + + Me.FemsaFactura = New Modelos.FemsaFactura + Me.Timbre = Timbre + End Sub + Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, Optional GetBytes As Boolean = True) As Byte() Dim Url = New Uri(String.Format("http://{0}:{1}/Compras/PopUpVerFactura.aspx?P={2}", HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta)))) Dim File As Byte() = Nothing @@ -1534,6 +2140,79 @@ Namespace Modelos End If End Sub + Private Function GuardarCartaPorte(ByRef ObjFactura As Modelos.Factura, ByRef ObjGral As ClsGenerales, ByRef ObjVentas As ClsVentas) As Integer + Dim ErrorProceso As Boolean = False + Dim CveTimbre As Integer = -1 + Try + Dim CveDireccionOrigen As Integer = -1 + Dim CveDireccionDestino As Integer = -1 + Dim Fechallegada As DateTime = MinFecha + Dim FechaEntrega As DateTime = MinFecha + Dim Distancia As Integer = 0 + Dim CveChofer As Integer = -1 + Dim CveCamion As Integer = -1 + Dim CveConfigAutoTransporte As Integer = -1 + Dim CveCamionRemolque1 As Integer = -1 + Dim CveCamionRemolque2 As Integer = -1 + + If ObjVentas.GetFacturacionAcarreos(ObjFactura.CveFacturacionAcarreo, -1, -1, -1, UsuarioActual.CveEmpresa) Then + Dim Row = ObjVentas.DtResultados.Rows(0) + + If Row IsNot Nothing Then + CveDireccionOrigen = Row("CveDireccionOrigen").ToString().ToEntero() + CveDireccionDestino = Row("CveDireccionDestino").ToString().ToEntero() + + Fechallegada = Row("Fechallegada").ToString().ToDateTime() + FechaEntrega = Row("FechaSalida").ToString().ToDateTime() + + Distancia = Row("Distancia").ToString().ToEntero() + CveChofer = Row("CveChofer").ToString().ToEntero() + CveCamion = Row("CveCamion").ToString().ToEntero() + + CveConfigAutoTransporte = Row("CveConfigAutoTransporte").ToString().ToEntero() + CveCamionRemolque1 = Row("CveCamionRemolque1").ToString().ToEntero() + CveCamionRemolque2 = Row("CveCamionRemolque2").ToString().ToEntero() + + End If + End If + + If Not (CveDireccionOrigen > 0 And CveDireccionDestino > 0) Then + ErrorProceso = True + Return -1 + End If + + + Dim CveEntregaAlmacen As Integer = ObjGral.AddInvEntregaAlmacenRuta(ObjFactura.CveSubProyecto, CveDireccionOrigen, CveDireccionDestino, -1, CveChofer, CveCamion, FechaEntrega, Fechallegada, "I", "-1", "-1", Fechallegada, 1, 1, Distancia, + CveConfigAutoTransporte:=CveConfigAutoTransporte, CveCamionRemolque1:=CveCamionRemolque1, CveCamionRemolque2:=CveCamionRemolque2) + If CveEntregaAlmacen > 0 Then + + For Each RowPS As DataRow In ObjFactura.DtMercancias.Rows + If Not ObjGral.AddEntregaAlmacenRutaDetalle(CveEntregaAlmacen, RowPS("CvePS").ToString().ToEntero, RowPS("Cantidad").ToString().ToDecimal, RowPS("CveUnidadMedida").ToString().ToEntero, UsuarioActual.CveUsuario) Then + ErrorProceso = True + Exit For + End If + Next + + CveTimbre = ObjGral.AddGralTimbre("Ing", ObjFactura.CveSubProyecto, ObjFactura.Fecha, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEntregaAlmacen:=CveEntregaAlmacen, AplicaCP:=True, CveVenta:=ObjFactura.CveVenta) + + If Not CveTimbre > 0 Then + ErrorProceso = True + End If + Else + ErrorProceso = True + End If + Catch ex As Exception + ErrorProceso = True + OnError("Ocurrió un error al guardar los datos de la carta porte", ex) + End Try + + If Not ErrorProceso Then + Return CveTimbre + Else + Return -1 + End If + + End Function Public Sub GuardarVenta(ByRef factura As Modelos.Factura, ByRef ObjVentas As ClsVentas, ByRef ObjConta As ClsContabilidad, ByRef ObjInventario As ClsInventarios, ByRef ObjContr As ClsContratos, ByRef TmpDTDetalle As DataTable, CveNCaVincular As Integer, ByRef objContPaqi As ClsContPAQi, Optional ByRef ObjBancos As ClsBancos = Nothing, Optional ByRef ObjOS As ClsOS = Nothing, ByRef Optional ObjEventos As ClsOIEventos = Nothing, ByRef Optional ObjCGame As ClsCGame = Nothing, ByRef Optional ObjCliente As ClsClientes = Nothing, Optional EsNotaCredito As Boolean = False, Optional ObjAcum As ClsAcumuladores = Nothing, ByRef Optional Resp As MMensajeFactura = Nothing, Optional Modulo As String = "Modelos/GuardarVentaM") Dim Msgok As New StringBuilder @@ -6771,6 +7450,8 @@ Namespace Modelos Public Property DevPed As Integer = -1 Public Property CveFactura As Integer Public Property CveCicloComercial As Integer + Public Property CveFacturacionAcarreo As Integer = -1 + Public Property EmitirCartaPorte As Boolean = False Public Property TipoDoctoDevolucion As String Public Property SeGuardoPrePoliza As Boolean Public Property DirectorioServidor As String diff --git a/App_Code/Timbrado.vb b/App_Code/Timbrado.vb index 64cca2945..fd0e8afac 100644 --- a/App_Code/Timbrado.vb +++ b/App_Code/Timbrado.vb @@ -590,11 +590,11 @@ Public Class Timbrado CancelacionFecha = xmlDoc.SelectSingleNode("Acuse").Attributes("Fecha").Value.ToDate Retorno.CancelacionAcuse = CancelacionAcuse Retorno.CancelacionFecha = CancelacionFecha - + Retorno.Verificado = True Else - CancelacionFecha = Now + Retorno.Verificado = False End If - Retorno.Verificado = True + Else MsgCancelacion.AppendFormat("-3.5") @@ -3261,6 +3261,8 @@ Public Class Timbrado If cfdi.Xml <> "" Then cfdi.EscribirXml(RutaArchivo & NombreArchivoXML & ".xml") End If + Else + Retorno = "XML No generado " End If #End Region diff --git a/RH/Personal.aspx b/RH/Personal.aspx index bb779887d..75acc3645 100644 --- a/RH/Personal.aspx +++ b/RH/Personal.aspx @@ -3030,12 +3030,21 @@

+ +