diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index 64f7f20dc..a8263551a 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -1140,7 +1140,9 @@ Public Class ClsContabilidad Optional ObjConta As ClsContPAQi = Nothing, Optional pIDPoliza As Integer = -1) As Boolean Dim StrLog As New StringBuilder Dim Retorno As Boolean = False - StrLog.AppendFormat("CvePrep:{0} - Inicio", CvePrePoliza) + Dim OcurrioError As Boolean = False + + StrLog.AppendFormat("CvePrep:{0} - Inicio -", CvePrePoliza) If Empresa.TipoContabilizacion = 1 Then ' contabilidad en SIG @@ -1154,7 +1156,7 @@ Public Class ClsContabilidad If CvePrePoliza <= 0 Then Return False - Dim OcurrioError As Boolean = False + Dim ContaCompartida As Boolean = False If ObjConta Is Nothing Then @@ -1263,6 +1265,7 @@ Public Class ClsContabilidad If Not ObjConta.AddMovimiento(tIdPoliza, dr("IdCtaContable").ToString.ToEntero, tipoMovimiento, dr("ImporteMN").ToString.ToDecimal, dr("Referencia").ToString, dr("Concepto").ToString, dr("IdSegmentoNegocio").ToString.ToEntero, Fecha, SigReferencia, dr("CvePrePolizaDetalle").ToString.ToEntero, ImporteMonedaExtranjera:=dr("ImporteME").ToString.ToDecimal) Then OcurrioError = True + StrLog.AppendFormat(" Error 1.1 - ") Exit For End If @@ -1271,6 +1274,7 @@ Public Class ClsContabilidad If Not ObjConta.AddMovimiento(tIdPoliza, dr("IdCtaContable").ToString.ToEntero, tipoMovimiento, dr("Importe").ToString.ToDecimal, dr("Referencia").ToString, dr("Concepto").ToString, dr("IdSegmentoNegocio").ToString.ToEntero, Fecha, SigReferencia, dr("CvePrePolizaDetalle").ToString.ToEntero, ImporteMonedaExtranjera:=dr("ImporteME").ToString.ToDecimal) Then OcurrioError = True + StrLog.AppendFormat(" Error 1.2 - ") Exit For End If @@ -1279,6 +1283,7 @@ Public Class ClsContabilidad End If Else OcurrioError = True + StrLog.AppendFormat(" Error 1.3 - ") Mensaje.Append(String.Format("
La cuenta contable {0} es invalida", dr("ConceptoContable"))) Exit For End If @@ -1298,6 +1303,7 @@ Public Class ClsContabilidad dr("ISRRetenido").ToString.ToDecimal, dr("IVARetenido").ToString.ToDecimal, False) Then OcurrioError = True + StrLog.AppendFormat(" Error 1.4 - ") End If End If @@ -1347,6 +1353,7 @@ Public Class ClsContabilidad IdProveedor = ObjConta.AddProveedor(IdCtaContProveedores, RFC, RazonSocial, "") If IdProveedor <= 0 Then OcurrioError = True + StrLog.AppendFormat(" Error 1.5 - ") End If End If @@ -1364,6 +1371,7 @@ Public Class ClsContabilidad dr("Serie").ToString.ToString, dr("Folio").ToString.StrToNum, dr("FolioFiscal").ToString, Empresa.CveEmpresa) Then OcurrioError = True + StrLog.AppendFormat(" Error 1.6 - ") Mensaje.Append("La Poliza o la Cuenta no son válidas ") End If @@ -1377,12 +1385,14 @@ Public Class ClsContabilidad If Not OcurrioError Then If Not UpdatePrePolizasDetalleBloquear(CvePrePoliza, True) Then + StrLog.AppendFormat(" Error 2.1 - ") OcurrioError = True End If End If If Not OcurrioError Then If Not UpdatePrePoliza(Fecha, ObjConta.Folio, CveTipoPoliza, tIdPoliza, CvePrePoliza, Empresa.CveEmpresa, CveUsuarioModifico:=CveUsuario) Then + StrLog.AppendFormat(" Error 2.2 - ") OcurrioError = True End If End If @@ -1404,11 +1414,13 @@ Public Class ClsContabilidad Else OcurrioError = True + StrLog.AppendFormat(" Error 3.1 - ") End If Catch ex As Exception + StrLog.AppendFormat(" Error 4.1 - ") If Not ContaCompartida Then ObjConta.RollBack() OnError("Ocurrió un error al intentar contabilizar la PrePoliza", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) 'Alert("Ocurrió un error al guardar la póliza", TipoMensaje.MsgAdvertencia) @@ -1417,8 +1429,9 @@ Public Class ClsContabilidad If Not ContaCompartida Then ObjConta.Dispose() End If + StrLog.AppendFormat(" - Con Retorno ({0}) - OcurrioError ({1} ", Retorno, OcurrioError) StrLog.AppendFormat(" - Fin") - StrLog.ToString.GuardaLogAD("LogContabilidazacion") + StrLog.ToString.GuardaLogAD("LogContabilizacion") Return Retorno End Function diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index 24520e128..fd1d81437 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -962,7 +962,7 @@ Public Class ClsInventarios Optional CveMovimientoRelacionado As Integer = -1, Optional TipoCambio As Double = -1, Optional CveVendedor As Integer = -1, Optional CveCliente As Integer = -1, Optional MovimientoFijo As Boolean = False, Optional CveContrato As Integer = -1, Optional CveProveedor As Integer = -1, Optional Remision As String = "", Optional CveClienteSucursal As Integer = -1, Optional DepartamentoEntrega As String = "", Optional PedidoContrato As String = "", Optional GastoIndirecto As Double = -1, Optional CveChofer As Integer = -1, Optional Placa As String = "", Optional FechaEntrega As String = "", Optional EspecifUnidad As String = "", Optional ResponsableCarga As String = "", Optional ResponsableRecibio As String = "", Optional Identificacion As String = "", Optional Domicilio As String = "", - Optional Telefono As String = "", Optional Ciudad As String = "", Optional Licencia As String = "", Optional Modulo As String = "") As Integer + Optional Telefono As String = "", Optional Ciudad As String = "", Optional Licencia As String = "", Optional Modulo As String = "", Optional CveOP As Integer = -1) As Integer Dim Retorno As Integer = -1 @@ -1016,6 +1016,7 @@ Public Class ClsInventarios .Add("@Ciudad", SqlDbType.VarChar).Value = Ciudad .Add("@Licencia", SqlDbType.VarChar).Value = Licencia .Add("@Modulo", SqlDbType.VarChar).Value = Modulo + .Add("@CveOP", SqlDbType.Int).Value = CveOP End With Try @@ -5259,13 +5260,13 @@ Public Class ClsInventarios Return Retorno End Function - Public Function DeleteMovimientosProyectados(TipoMovto As Integer) As Boolean + Public Function DeleteMovimientosProyectados(TipoMovto As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("Inv_MovimientosProyectadosDelete") With SqlAdapter.SelectCommand.Parameters .Add("@TipoMovto", SqlDbType.TinyInt).Value = TipoMovto - + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa End With Try diff --git a/App_Code/WS_PuntoVenta.vb b/App_Code/WS_PuntoVenta.vb index ee2e087e2..602e52a5b 100644 --- a/App_Code/WS_PuntoVenta.vb +++ b/App_Code/WS_PuntoVenta.vb @@ -850,7 +850,7 @@ Public Class WS_PuntoVenta If objVentas.GetVentaTerminal(objVenta.CveVentaTerminal, objVenta.Fecha, objVenta.CveSubProyecto, objVenta.CveEmpresa) Then - CvePrePoliza = ObjConta.AddPrePolizas("Vta", 4, objVenta.Total, objVenta.Total, objVenta.CveMoneda, objVenta.Fecha, "", objVenta.CveUsuario, objVenta.CveEmpresa) + CvePrePoliza = ObjConta.AddPrePolizas("Vta", 4, objVenta.Total, objVenta.Total, objVenta.CveMoneda, objVenta.Fecha, "Punto de Venta addVenta", objVenta.CveUsuario, objVenta.CveEmpresa) If objVentas.DtResultados.Rows.Count = 0 Then If objVentas.AddVenta(objVenta.TipoDocto, objVenta.FolioFact, objVenta.CveCliente, objVenta.CveClienteSucursal, @@ -858,7 +858,7 @@ Public Class WS_PuntoVenta objVenta.Total, objVenta.CveMoneda, objVenta.TipoCambio, objVenta.CveMetodoPago, objVenta.CondicionesPago, objVenta.FormaPago, Now, objVenta.Fecha, objVenta.MotivoDescuento, objVenta.Observaciones, objVenta.FechaEjecucion, objVenta.CveVendedor, If(objVenta.Alfa1 IsNot Nothing, objVenta.Alfa1, ""), If(objVenta.Alfa2 IsNot Nothing, objVenta.Alfa2, ""), If(objVenta.Alfa3 IsNot Nothing, objVenta.Alfa3, ""), objVenta.Num1, - objVenta.Num2, objVenta.Num3, Fech1, Fech2, Fech3, objVenta.CveCorte, objVenta.CveMesa, If(objVenta.NumeroPersonas > 255, 255, objVenta.NumeroPersonas), CvePrePoliza, objVenta.CveUsuario, objVenta.CveEmpresa, objVenta.Propina, objVenta.CveVentaTerminal) Then + objVenta.Num2, objVenta.Num3, Fech1, Fech2, Fech3, objVenta.CveCorte, objVenta.CveMesa, If(objVenta.NumeroPersonas > 255, 255, objVenta.NumeroPersonas), CvePrePoliza, objVenta.CveUsuario, objVenta.CveEmpresa, objVenta.Propina, objVenta.CveVentaTerminal, CveSubProyecto:=objVenta.CveSubProyecto, CveSubProyectoEjecucion:=objVenta.CveSubProyecto) Then objVenta.CveVenta = objVentas.CveVenta 'Ingresar los detalles For Each Detalle As ClsVentaWS.ClsVentaDetalleWS In objVenta.Detalle @@ -979,8 +979,9 @@ Public Class WS_PuntoVenta 'Se agrega movimiento separado por la cuenta de ventas (ER) ' For Each Row As DataRow In DT.Rows ImporteMov = objVenta.SubTotal ' TmpDT.SUM("Total", "IdCtaContVentas = '" & Row("IdCtaContVentas").ToString & "'") + Dim CveClasificacion_04 = -1 If ImporteMov <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimientoVenta, ImporteMov, " ", CveConceptoVenta, " ", objVenta.Fecha, -1, -1, CveVenta:=objVenta.CveVenta, CveCliente:=objVenta.CveCliente, CveIE:=CveIE) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimientoVenta, ImporteMov, " ", CveConceptoVenta, " ", objVenta.Fecha, -1, -1, CveVenta:=objVenta.CveVenta, CveCliente:=objVenta.CveCliente, CveIE:=CveIE, ImporteMX:=ImporteMov, CveSubProyecto:=objVenta.CveSubProyecto, CveClasificacion:=CveClasificacion_04) Then ErrorMovtosVentas = True End If End If @@ -989,7 +990,7 @@ Public Class WS_PuntoVenta 'Se agregan los DSV DESCUENTOS ImporteMov = objVenta.Descuento If ImporteMov <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimientoVenta, ImporteMov, " ", CveConceptoDSV, " ", objVenta.Fecha, IdCtaContDSV, -1, CveVenta:=objVenta.CveVenta, CveCliente:=objVenta.CveCliente, CveIE:=CveIE) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimientoVenta, ImporteMov, " ", CveConceptoDSV, " ", objVenta.Fecha, IdCtaContDSV, -1, CveVenta:=objVenta.CveVenta, CveCliente:=objVenta.CveCliente, CveIE:=CveIE, ImporteMX:=ImporteMov) Then ErrorMovtosDSV = True End If End If @@ -998,7 +999,7 @@ Public Class WS_PuntoVenta 'Se agregan las CxC ImporteMov = objVenta.Total - TotalPagado If ImporteMov <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimientoVenta, ImporteMov, " ", CveConceptoAfectacion, " ", objVenta.Fecha, IdCtaContClientes, -1, CveVenta:=objVenta.CveVenta, CveCliente:=objVenta.CveCliente, CveIE:=CveIE) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimientoVenta, ImporteMov, " ", CveConceptoAfectacion, " ", objVenta.Fecha, IdCtaContClientes, -1, CveVenta:=objVenta.CveVenta, CveCliente:=objVenta.CveCliente, CveIE:=CveIE, ImporteMX:=ImporteMov) Then ErrorMovtosCxC = True End If End If @@ -1006,7 +1007,8 @@ Public Class WS_PuntoVenta 'Si hubo un pago agregarlo ImporteMov = TotalPagado If ImporteMov <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimientoVenta, ImporteMov, " ", 2, " ", objVenta.Fecha, IdCtaContClientes, -1, CveVenta:=objVenta.CveVenta, CveCliente:=objVenta.CveCliente, CveIE:=CveIE) Then + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimientoVenta, ImporteMov, " ", 2, " ", objVenta.Fecha, IdCtaContClientes, -1, CveVenta:=objVenta.CveVenta, CveCliente:=objVenta.CveCliente, CveIE:=CveIE, ImporteMX:=ImporteMov) Then ErrorMovtosCxC = True End If End If @@ -1014,7 +1016,11 @@ Public Class WS_PuntoVenta 'Se agregan el Traslado de IVA ImporteMov = objVenta.IVA If ImporteMov <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimientoVenta, ImporteMov, " ", CveConceptoIVA, " ", objVenta.Fecha, 0, -1, CveVenta:=objVenta.CveVenta, CveCliente:=objVenta.CveCliente, CveIE:=CveIE) Then + Dim PorcentajeImpuesto = 0 + If objVenta.SubTotal > 0 Then + PorcentajeImpuesto = (objVenta.IVA / objVenta.SubTotal) + End If + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimientoVenta, ImporteMov, " ", CveConceptoIVA, " ", objVenta.Fecha, 0, -1, CveVenta:=objVenta.CveVenta, CveCliente:=objVenta.CveCliente, CveIE:=CveIE, ImporteMX:=ImporteMov, PorcentajeImpuesto:=PorcentajeImpuesto) Then ErrorMovtosTrasladoIVA = True End If End If @@ -1238,7 +1244,7 @@ Public Class WS_PuntoVenta Try - CvePrePoliza = ObjMov.AddPrePolizas("Banc", CvePlantillaPoliza, Importe, Importe, Moneda, Fecha, "", CveUsuario, CveEmpresa) + CvePrePoliza = ObjMov.AddPrePolizas("Banc", CvePlantillaPoliza, Importe, Importe, Moneda, Fecha, "Punto de venta IE", CveUsuario, CveEmpresa) 'valida prepoliza If CvePrePoliza > 0 Then @@ -1252,9 +1258,9 @@ Public Class WS_PuntoVenta If CveIE > 0 Then - If ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, Importe, "", CveConceptoContable, " ", Now, 0, -1, CveIE) Then + If ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, Importe, "", CveConceptoContable, " ", Now, 0, -1, CveIE, ImporteMX:=Importe) Then Dim IVA As Double = 0 - If ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, Importe - IVA - CIF, "", CveConceptoCompra, " ", Now, 0, -1, CveIE) Then + If ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, Importe - IVA - CIF, "", CveConceptoCompra, " ", Now, 0, -1, CveIE, ImporteMX:=Importe - IVA - CIF) Then Else MsgError = "no se pudo insertar el detalle de la póliza2" diff --git a/Ashx/SIGWeb.ashx b/Ashx/SIGWeb.ashx index eb6cd7d95..92c7de325 100644 --- a/Ashx/SIGWeb.ashx +++ b/Ashx/SIGWeb.ashx @@ -53,13 +53,36 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState context.Response.Write(sendMail(context)) Case "sendMailLPM" context.Response.Write(sendMailLPM(context)) + Case "GetTokenAngular" + context.Response.Write(GetTokenAngular(context)) + context.Response.End() End Select Catch ex As Exception ex.GuardaLog(ex.Message) End Try End Sub + Private Function GetTokenAngular(context As HttpContext) As String + Dim usuario As Usuario = UsuarioActual(context) + Dim tokenDescriptor = New Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor With { + .Subject = New System.Security.Claims.ClaimsIdentity(New System.Security.Claims.Claim() {New System.Security.Claims.Claim("CvePlataforma", usuario.CvePlataforma.ToString()), + New System.Security.Claims.Claim("CveUsuario", usuario.CveUsuario.ToString()), New System.Security.Claims.Claim("CveEmpresa", usuario.CveEmpresa.ToString()), + New System.Security.Claims.Claim("CveRol", usuario.CveRol.ToString()), New System.Security.Claims.Claim("Fecha", Date.Now.ToLongDateString())}), + .Expires = Date.UtcNow.AddHours(3), + .SigningCredentials = New Microsoft.IdentityModel.Tokens.SigningCredentials( + New Microsoft.IdentityModel.Tokens.SymmetricSecurityKey(Encoding.ASCII.GetBytes("*_AsistenciaDesarrolloSistemas-SIGAPI_*17-06-2020")), + Microsoft.IdentityModel.Tokens.SecurityAlgorithms.HmacSha256Signature)} + Dim tokenHandler = New System.IdentityModel.Tokens.Jwt.JwtSecurityTokenHandler() + Dim newtoken = tokenHandler.CreateToken(tokenDescriptor) + 'context.Response.AddHeader("Access-Control-Allow-Origin", "http://localhost:4200") + 'context.Response.AddHeader("Access-Control-Allow-Methods", "GET, POST") + 'context.Response.AddHeader("Access-Control-Allow-Headers", "Content-Type, Accept") + context.Response.AddHeader("Access-Control-Allow-Credentials", true ) + context.Response.StatusCode = 200 + Dim stokenn As String = tokenHandler.WriteToken(newtoken) + Return stokenn + End Function Private Function sendMailLPM(context As HttpContext) As String Dim retorno As String = "true" Dim nombre As String = "" diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 15d95c293..36819bc16 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -17669,7 +17669,7 @@ Partial Class Compras_Compras ViewState("IVAPS") = Drr("IVA").ToString().ToDouble() DdlProyecto.SelectedValueExist(Drr("CveProyecto")) - 'DdlIVA.Enabled = True + DdlIVA.Enabled = True If Not Modalidad = "U" Then @@ -17989,13 +17989,13 @@ Partial Class Compras_Compras Row("IEPSPSPorcentaje") = PorcentajeIEPS Else 'If DdlIVA.SelectedValue.ToDouble = 0 Then Row("IVA") = 0 Else Row("IVA") = Math.Round(IVA * Total, DecimalesPermitidos) - Row("IVA") = Math.Round(IVA * Total, DecimalesPermitidos) + Row("IVA") = Math.Round(IVA * Total, 2) Row("IVAPorcentaje") = IVA - Row("RetIVA") = Math.Round(RetIVA * Total, DecimalesPermitidos) + Row("RetIVA") = Math.Round(RetIVA * Total, 2) Row("RetIVAPorcentaje") = RetIVA - Row("RetISR") = Math.Round(RetISR * Total, DecimalesPermitidos) + Row("RetISR") = Math.Round(RetISR * Total, 2) Row("RetISRPorcentaje") = RetISR - Row("IEPSPS") = Math.Round(IEPSPS * Total, DecimalesPermitidos) + Row("IEPSPS") = Math.Round(IEPSPS * Total, 2) Row("IEPSPSPorcentaje") = IEPSPS End If Row("ImporteConImpuestos") = (Row("Cantidad").ToString.ToDouble * Row("PU").ToString.ToDouble) + Row("IVA").ToString.ToDouble + Row("IEPSPS").ToString.ToDouble - (Row("RetIVA").ToString.ToDouble + Row("RetISR").ToString.ToDouble) diff --git a/Compras/eFacturas.aspx b/Compras/eFacturas.aspx index 8d9162b84..6644f7db1 100644 --- a/Compras/eFacturas.aspx +++ b/Compras/eFacturas.aspx @@ -214,7 +214,7 @@ - + diff --git a/Empresas/132/Formatos/NotaDevolucion.rdlc b/Empresas/132/Formatos/NotaDevolucion.rdlc index 7b770e88d..f72b1bc6d 100644 --- a/Empresas/132/Formatos/NotaDevolucion.rdlc +++ b/Empresas/132/Formatos/NotaDevolucion.rdlc @@ -183,7 +183,7 @@ - R.F.C PPP885522PPP + R.F.C STJ180705IV4 - PPP885522PPP + STJ180705IV4 - PPP885522PPP + STJ180705IV4