From fa562fec01630150bc5129ea6d49a273867adb09 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Mon, 19 Jul 2021 13:37:01 -0700 Subject: [PATCH 01/14] Funcionalidad para limite de credito y restricciones de venta --- Ventas/Ventas.aspx.vb | 578 +++++++++++++++++++----------------------- 1 file changed, 257 insertions(+), 321 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 5257b1b11..4bb92c596 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -2243,7 +2243,7 @@ Partial Class Ventas CargaClasificaciones() CargaPS(-1, DdlPS) - CargaPSRemision(-1, DdlPSRemision) + 'CargaPSRemision(-1, DdlPSRemision) CargaPSPyME(-1, DdlPSPyME) CreaDTVentas() @@ -5181,7 +5181,8 @@ Partial Class Ventas AgregarProductoServicio(dr("Cantidad").ToString().ToDecimal, dr("CveUM").ToString().ToEntero(), dr("UM").ToString(), dr("CveClasificacion").ToString().ToEntero(), dr("Clasificacion").ToString(), dr("CvePS").ToString().ToEntero(), dr("PS").ToString(), dr("Obs").ToString(), dr("PU").ToString().ToDecimal, dr("Descuento").ToString().ToDecimal, dr("CveProyecto").ToString().ToEntero(), dr("Proyecto").ToString(), dr("CveSubProyecto").ToString().ToEntero(), dr("SubProyecto").ToString(), - CveContratoDetalle:=dr("CveContratoDetalle").ToString().ToEntero(), CveVentaDetalleCotizacion:=dr("CveVentaDetalleCotizacion").ToString().ToEntero(), RegeneraIEPS:=False, SeActualiza:=True) + CveContratoDetalle:=dr("CveContratoDetalle").ToString().ToEntero(), CveVentaDetalleCotizacion:=dr("CveVentaDetalleCotizacion").ToString().ToEntero(), + CveVentaDetalle:=dr("CveVentaDetalle").ToString().ToEntero(), RegeneraIEPS:=False, SeActualiza:=True) Next @@ -5595,15 +5596,11 @@ Partial Class Ventas ViewState("Vendedor") = ObjCliente.Vendedor ViewState("CtaContable") = ObjCliente.CuentaContable ViewState("IdCtaContClientes") = ObjCliente.IdCtaContClientes - ViewState("CveCuentaClientes") = ObjCliente.CveCuentaClientes ViewState("IdCtaContMonedaExtranjera") = ObjCliente.IdCtaContMonedaExtranjera ViewState("IdCtaContComplementaria") = ObjCliente.IdCtaContComplementaria ViewState("IdCtaContAnticipos") = ObjCliente.IdCtaContAnticipos - ViewState("CveCuentaAnticipos") = ObjCliente.CveCuentaAnticipos ViewState("IdCtaContRetIVA") = ObjCliente.IdCtaContRetIVA - ViewState("CveCuentaRetIVA") = ObjCliente.CveCuentaRetIVA ViewState("IdCtaContRetISR") = ObjCliente.IdCtaContRetISR - ViewState("CveCuentaRetISR") = ObjCliente.CveCuentaRetISR ViewState("CodCliente") = ObjCliente.Codigo ViewState("CvePrecioLista") = ObjCliente.CvePrecioLista @@ -6148,25 +6145,10 @@ Partial Class Ventas End Sub Private Sub CargaRestriccionesCreditoCliente(Optional Alertas As Boolean = False, Optional CveVenta As Integer = -1) - 'RMF. validacion temporal - 'verifica si tiene autorizaciones de Nota de crédito autorizadas - If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then ' si es empresa de acumuladores - Dim ObjVentas As New ClsVentas - - If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, -1, CveEstatus:=1) Then - Dim RowAutorizacion As DataRow = ObjVentas.DtResultados.FiltroPrimero($"CveVenta IS NULL AND CveTipoDocumento='Egs'", Orderby:="TipoAutorizacion") - - If RowAutorizacion IsNot Nothing Then - DdlTipoComprobante.SelectedValueExistInsert("Egs", "Egresos") - End If - - End If - - ObjVentas.Dispose() - End If + Dim ValorAutorizacion As String = UsuarioActual.Empresa.Funcionalidad(595) 'OBLIGAR PAGO DE CONTADO SI EL CLIENTE NO PERMITE CREDITO - If UsuarioActual.Empresa.Funcionalidad(570) = "1" AndAlso Me.PermiteCredito = False AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") AndAlso CveVenta < 1 Then + If UsuarioActual.Empresa.Funcionalidad(570) = "1" AndAlso Me.PermiteCredito = False AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") AndAlso CveVenta <= 0 Then RBLPago.SelectedValue = "2" RBLPago.Items(0).Enabled = False RBLPago_SelectedIndexChanged(Nothing, Nothing) @@ -6187,209 +6169,153 @@ Partial Class Ventas End If UPCondicionesPago.Update() 'CARGAR CREDITO DISPONIBLE AL GENERAR UNA FACTURA - ElseIf UsuarioActual.Empresa.Funcionalidad(596) = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso CveVenta < 1 Then - RBLPago.SelectedValue = "1" - RBLPago_SelectedIndexChanged(Nothing, Nothing) - UPCondicionesPago.Update() - Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero()) + End If - If CreditoDispo > 0 Then - TrCreditoDisponible.Visible = True - LblCreditoDisponible.Text = CreditoDispo.FormatoNumero - If PorcentajeCredito > 80 Then TrPorcentajeCredito.Visible = True : LblPorcentajeCredito.Text = $"{PorcentajeCredito.FormatoNumero}%" - If UsuarioActual.Empresa.Funcionalidad(597) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(268) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "PA") Then + If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso CveVenta <= 0 AndAlso RBLPago.SelectedValue = "1" AndAlso PermiteCredito Then + If Not UsuarioActual.Empresa.Funcionalidad(702) = "1" Then + RBLPago.SelectedValue = "1" + RBLPago_SelectedIndexChanged(Nothing, Nothing) + UPCondicionesPago.Update() + Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero()) - Dim Vta As New ClsVentas - Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa) - Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón:

{0}", Vta.SerieVenta) - Vta.Dispose() - If Opcion > 0 Then - 'si la cotización no debe de existir este canddado - If Alertas Then Alert(OpcionMsg, TipoMensaje.MsgAdvertencia) - 'RBLPago.SelectedValue = "2" - 'RBLPago.Items(0).Enabled = False - RBLPago_SelectedIndexChanged(Nothing, Nothing) - UPCondicionesPago.Update() - DdlTipoComprobante.SelectedValueExistInsert("PA", "Autorización") - DdlTipoComprobante.SelectedValue = "PA" - TxtFechaPago.Text = Now.AddDays(PlazoCobranza).ToShortDateString - 'si llegó por la opción de cotización no debe de restringuir - If IfNull(Request("Op"), "").ToString() = "Cot" Then DdlTipoComprobante.SelectedValue = "Cot" - 'quito remisión y factura - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing")) - If Not UsuarioActual.TienePermisoProceso(325) Then - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) - End If - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem")) - If Opcion = 1 Then - BtnEmitirImprimir.Visible = False - BtnsFacturar.Visible = False - LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274) - BtnGenerarRemision.Visible = False - LnkPedido2SinFacturar.Visible = False - LnkCotizaciones.Visible = False - LnkOCs.Visible = False - End If - Else - ' el cliente tiene crédito disponible, no tiene bloqueo - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("PA")) + If CreditoDispo > 0 Then + TrCreditoDisponible.Visible = True + LblCreditoDisponible.Text = CreditoDispo.FormatoNumero + If PorcentajeCredito > 80 Then TrPorcentajeCredito.Visible = True : LblPorcentajeCredito.Text = $"{PorcentajeCredito.FormatoNumero}%" - If UsuarioActual.TienePermisoProceso(60) Then DdlTipoComprobante.SelectedValueExistInsert("Ing", "Ingresos") 'puede facturar - If UsuarioActual.TienePermisoProceso(199) Then DdlTipoComprobante.SelectedValueExistInsert("Rem", "Remisión") ' puede remisionar - DdlTipoComprobante.SelectedValueExist(UsuarioActual.CveTipoDocumento) - - TxtFechaPago.Text = If(DdlTipoComprobante.SelectedValue = "Rem", Now.AddDays(PlazoCobranzaRemision), Now.AddDays(PlazoCobranza)).ToShortDateString - End If - - 'Else - ' 'que no de crédito, solo contado - ' RBLPago.SelectedValue = "2" - ' RBLPago.Items(0).Enabled = False - 'End If - - End If - Else - 'GENERAR AUTORIZACION SI TIENE EXCEDIO EL LIMITE DE CREDITO - If UsuarioActual.Empresa.Funcionalidad(595) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(268) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "Ant", "PA") Then - - 'VERIFICAR CANDADOS DE VENTA, REMISIONES SIN FACTURAR, FACTURAS QUE NO TENGAN VENCIDAS - If UsuarioActual.Empresa.Funcionalidad(597) = "1" Then + If Not UsuarioActual.TienePermisoProceso(268) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "PA") Then Dim Vta As New ClsVentas Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa) Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón:

{0}", Vta.SerieVenta) Vta.Dispose() If Opcion > 0 Then - If Opcion = 1 Then - BtnEmitirImprimir.Visible = False - End If + 'si la cotización no debe de existir este canddado If Alertas Then Alert(OpcionMsg, TipoMensaje.MsgAdvertencia) - Else - If Alertas AndAlso UsuarioActual.Empresa.Funcionalidad(518) = "1" Then Alert("El cliente tiene su límite de crédito agotado.", TipoMensaje.MsgAdvertencia) - End If - End If - - 'RBLPago.SelectedValue = "2" - 'RBLPago.Items(0).Enabled = False - RBLPago_SelectedIndexChanged(Nothing, Nothing) - UPCondicionesPago.Update() - DdlTipoComprobante.SelectedValueExistInsert("PA", "Autorización") - DdlTipoComprobante.SelectedValue = "PA" - TxtFechaPago.Text = Now.AddDays(PlazoCobranza).ToShortDateString - 'si llegó por la opción de cotización no debe de restringuir - If IfNull(Request("Op"), "").ToString() = "Cot" Then DdlTipoComprobante.SelectedValue = "Cot" - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing")) - If Not UsuarioActual.TienePermisoProceso(325) Then - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) - End If - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem")) - BtnsFacturar.Visible = False - LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274) - BtnGenerarRemision.Visible = False - LnkPedido2SinFacturar.Visible = False - LnkCotizaciones.Visible = False - LnkOCs.Visible = False - - Else - 'RMF. codigo temporal para pruebas - If Alertas AndAlso UsuarioActual.CveEmpresa = 140 AndAlso UsuarioActual.CveUsuario.Contiene(100, 1937, 2275) AndAlso Now.Hour > 5 AndAlso Now.Hour < 9 Then - Dim Vta As New ClsVentas - Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa) - Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón:

{0}", Vta.SerieVenta) - Vta.Dispose() - If Opcion > 0 Then - LnkSolicitarCredito.Visible = True - Alert(OpcionMsg, TipoMensaje.MsgAdvertencia) - End If - Else - - If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then - RBLPago.SelectedValue = "2" - RBLPago.Items(0).Enabled = False + 'RBLPago.SelectedValue = "2" + 'RBLPago.Items(0).Enabled = False RBLPago_SelectedIndexChanged(Nothing, Nothing) UPCondicionesPago.Update() - Else - 'este codigo no es temporal - If Alertas AndAlso UsuarioActual.Empresa.Funcionalidad(518) = "1" Then Alert("El cliente tiene su límite de crédito agotado.", TipoMensaje.MsgAdvertencia) - If UsuarioActual.CveEmpresa = 140 Then - LnkSolicitarCredito.Visible = True - DdlTipoAutorizacion.SelectedValueExist("1") + DdlTipoComprobante.SelectedValueExistInsert("PA", "Autorización") + DdlTipoComprobante.SelectedValue = "PA" + TxtFechaPago.Text = Now.AddDays(PlazoCobranza).ToShortDateString + 'si llegó por la opción de cotización no debe de restringuir + If IfNull(Request("Op"), "").ToString() = "Cot" Then DdlTipoComprobante.SelectedValue = "Cot" + 'quito remisión y factura + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing")) + If Not UsuarioActual.TienePermisoProceso(325) Then + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) End If - End If - - - End If - End If - End If - UPPCreditoDisponible.Update() - 'Si tiene credito disponible, Verificar limites de (verificar candados de venta, remisiones sin facturar, facturas que no tengan vencidas) - ElseIf UsuarioActual.Empresa.Funcionalidad(597) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(268) AndAlso CveVenta > 0 AndAlso (DdlTipoComprobante.SelectedValue.Contiene("Pd2", "Cot") Or (DdlTipoComprobante.SelectedValue = "Rem" And ModalidadEdicion And ViewState("CveClienteAnterior").ToString().ToEntero() > 0 And LblRFC.Text.Trim <> "XAXX010101000")) Then - Dim CreditoDispo As Decimal = CargaCreditoDisponible(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero()) - If CreditoDispo > 0 Then - Dim Vta As New ClsVentas - Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa) - Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón:

{0}", Vta.SerieVenta) - Vta.Dispose() - If Opcion > 0 Then - If ModalidadEdicion AndAlso ViewState("CveCliente").ToString().ToEntero() <> ViewState("CveClienteAnterior").ToString().ToEntero() And DdlTipoComprobante.SelectedValue = "Rem" And ViewState("CveClienteAnterior").ToString().ToEntero() > 0 And LblRFC.Text.Trim <> "XAXX010101000" Then - ViewState("CveCliente") = ViewState("CveClienteAnterior").ToString().ToEntero() - - CargaCliente(ViewState("CveCliente").ToString().ToEntero()) - If Opcion > 0 Then - If Alertas Then Alert(OpcionMsg, TipoMensaje.MsgAdvertencia) - Else - If Alertas Then Alert("El cliente tiene su límite de crédito agotado.", TipoMensaje.MsgAdvertencia) - End If - BtnEmitirImprimir.Visible = False - BtnVistaPrevia.Visible = False - UpFacturar.Update() - Exit Sub - ElseIf DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso EsCreaApartirDe Then - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing")) - If Not UsuarioActual.TienePermisoProceso(325) Then - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) - End If - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem")) - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Pd2")) - DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Egs")) - BtnGenerarRemision.Visible = False - BtnGenerarOS.Visible = False - BtnEmitirImprimir.Visible = True - BtnsFacturar.Visible = False - LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274) - Else - If DdlTipoComprobante.SelectedValue.Contiene("Pd2") Then - BtnGeneraAutorizacion.Visible = If(CveEstatus <> 21, True, False) - End If - BtnGenerarRemision.Visible = False - BtnGenerarOS.Visible = False - BtnEmitirImprimir.Visible = False - BtnsFacturar.Visible = False - LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274) - If ViewState("CveCliente").ToString().ToEntero() <> ViewState("CveClienteAnterior").ToString().ToEntero() Then - If Opcion > 0 Then - If Alertas Then Alert(OpcionMsg, TipoMensaje.MsgAdvertencia) - Else - If Alertas Then Alert("El cliente tiene límite de crédito agotado.", TipoMensaje.MsgAdvertencia) + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem")) + If Opcion = 1 Then + BtnEmitirImprimir.Visible = False + BtnsFacturar.Visible = False + LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274) + BtnGenerarRemision.Visible = False + LnkPedido2SinFacturar.Visible = False + LnkCotizaciones.Visible = False + LnkOCs.Visible = False End If + Else + ' el cliente tiene crédito disponible, no tiene bloqueo + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("PA")) + + If UsuarioActual.TienePermisoProceso(60) Then DdlTipoComprobante.SelectedValueExistInsert("Ing", "Ingresos") 'puede facturar + If UsuarioActual.TienePermisoProceso(199) Then DdlTipoComprobante.SelectedValueExistInsert("Rem", "Remisión") ' puede remisionar + DdlTipoComprobante.SelectedValueExist(UsuarioActual.CveTipoDocumento) + + TxtFechaPago.Text = If(DdlTipoComprobante.SelectedValue = "Rem", Now.AddDays(PlazoCobranzaRemision), Now.AddDays(PlazoCobranza)).ToShortDateString End If + + End If Else - BtnGeneraAutorizacion.Visible = False - If DdlTipoComprobante.SelectedValue.Contiene("Pd2") Then - If UsuarioActual.TienePermisoProceso(199) Then - BtnGenerarRemision.Visible = If(CveEstatus <> 21, True, False) - Else - BtnGenerarRemision.Visible = False - End If - End If - End If - Else - BtnGenerarRemision.Visible = False - If DdlTipoComprobante.SelectedValue.Contiene("Pd2") Then - BtnGeneraAutorizacion.Visible = If(CveEstatus <> 21, True, False) + 'GENERAR AUTORIZACION SI TIENE EXCEDIO EL LIMITE DE CREDITO + Select Case ValorAutorizacion + Case "1" 'CREAR DOCUMENTO DE AUTORIZACION PA + If Not UsuarioActual.TienePermisoProceso(268) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "Ant", "PA") Then + + 'VERIFICAR CANDADOS DE VENTA, REMISIONES SIN FACTURAR, FACTURAS QUE NO TENGAN VENCIDAS + Dim Vta As New ClsVentas + Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa) + Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón:

{0}", Vta.SerieVenta) + Vta.Dispose() + If Opcion > 0 Then + If Opcion = 1 Then + BtnEmitirImprimir.Visible = False + End If + If Alertas Then Alert(OpcionMsg, TipoMensaje.MsgAdvertencia) + Else + If Alertas Then Alert("El cliente tiene su límite de crédito agotado.", TipoMensaje.MsgAdvertencia) + End If + + 'RBLPago.SelectedValue = "2" + 'RBLPago.Items(0).Enabled = False + RBLPago_SelectedIndexChanged(Nothing, Nothing) + UPCondicionesPago.Update() + DdlTipoComprobante.SelectedValueExistInsert("PA", "Autorización") + DdlTipoComprobante.SelectedValue = "PA" + TxtFechaPago.Text = Now.AddDays(PlazoCobranza).ToShortDateString + 'si llegó por la opción de cotización no debe de restringuir + If IfNull(Request("Op"), "").ToString() = "Cot" Then DdlTipoComprobante.SelectedValue = "Cot" + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing")) + If Not UsuarioActual.TienePermisoProceso(325) Then + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) + End If + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem")) + BtnsFacturar.Visible = False + LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274) + BtnGenerarRemision.Visible = False + LnkPedido2SinFacturar.Visible = False + LnkCotizaciones.Visible = False + LnkOCs.Visible = False + End If + Case "2" 'Autorizacion desde una solicitud del catalogo de autorizaciones + 'RMF. validacion temporal + 'verifica si tiene autorizaciones de Nota de crédito autorizadas + Dim ObjVentas As New ClsVentas + If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, -1, CveEstatus:=1) Then + Dim RowAutorizacion As DataRow = ObjVentas.DtResultados.FiltroPrimero($"CveVenta IS NULL AND CveTipoDocumento='Egs'", Orderby:="TipoAutorizacion") + If RowAutorizacion IsNot Nothing Then + DdlTipoComprobante.SelectedValueExistInsert("Egs", "Egresos") + End If + End If + ObjVentas.Dispose() + Case Else 'SI NO TIENE NINGUN TIPO DE AUTORIZACION CONFIGURADO + 'RMF. codigo temporal para pruebas + If Alertas AndAlso UsuarioActual.CveEmpresa = 140 AndAlso UsuarioActual.CveUsuario.Contiene(100, 1937, 2275) AndAlso Now.Hour > 5 AndAlso Now.Hour < 9 Then + Dim Vta As New ClsVentas + Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa) + Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón:

{0}", Vta.SerieVenta) + Vta.Dispose() + If Opcion > 0 Then + LnkSolicitarCredito.Visible = True + Alert(OpcionMsg, TipoMensaje.MsgAdvertencia) + End If + Else + + If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then + RBLPago.SelectedValue = "2" + RBLPago.Items(0).Enabled = False + RBLPago_SelectedIndexChanged(Nothing, Nothing) + UPCondicionesPago.Update() + Else + 'este codigo no es temporal + If Alertas Then Alert("El cliente tiene su límite de crédito agotado.", TipoMensaje.MsgAdvertencia) + If UsuarioActual.CveEmpresa = 140 Then + LnkSolicitarCredito.Visible = True + DdlTipoAutorizacion.SelectedValueExist("1") + End If + End If + + + End If + End Select + End If End If + + UPPCreditoDisponible.Update() End If 'Puede hacer pedido @@ -6556,49 +6482,45 @@ Partial Class Ventas End Sub Private Function CargaCreditoDisponible(tCveCliente As Integer, tCveSucursalCliente As Integer, Optional ByRef ObjVentas As ClsVentas = Nothing) As Decimal Dim Retorno As Decimal = 0 - If UsuarioActual.Empresa.Funcionalidad(518) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(185) Then + Dim ObjVentasAplciar As ClsVentas = Nothing + If ObjVentas IsNot Nothing Then + ObjVentasAplciar = ObjVentas + Else + ObjVentasAplciar = New ClsVentas + End If - Dim ObjVentasAplciar As ClsVentas = Nothing - If ObjVentas IsNot Nothing Then - ObjVentasAplciar = ObjVentas - Else - ObjVentasAplciar = New ClsVentas - End If + If ObjVentasAplciar.ObtenerCreditoRestante(tCveCliente, tCveSucursalCliente) Then + If ObjVentasAplciar.DtResultados.Rows.Count > 0 Then - If ObjVentasAplciar.ObtenerCreditoRestante(tCveCliente, tCveSucursalCliente) Then - If ObjVentasAplciar.DtResultados.Rows.Count > 0 Then + If tCveSucursalCliente > 0 Then - If tCveSucursalCliente > 0 Then + Dim LimiteRestanteSucursal As Decimal = ObjVentasAplciar.DtResultados(0)("LimiteRestanteSucursal").ToString().ToDecimal + Dim PorcentajeSaldoSucursal As Decimal = ObjVentasAplciar.DtResultados(0)("PorcentajeSaldoSucursal").ToString().ToDecimal - Dim LimiteRestanteSucursal As Decimal = ObjVentasAplciar.DtResultados(0)("LimiteRestanteSucursal").ToString().ToDecimal - Dim PorcentajeSaldoSucursal As Decimal = ObjVentasAplciar.DtResultados(0)("PorcentajeSaldoSucursal").ToString().ToDecimal + Dim LimiteRestanteCliente As Decimal = ObjVentasAplciar.DtResultados(0)("LimiteRestanteCliente").ToString().ToDecimal + Dim PorcentajeSaldoCliente As Decimal = ObjVentasAplciar.DtResultados(0)("PorcentajeSaldoCliente").ToString().ToDecimal - Dim LimiteRestanteCliente As Decimal = ObjVentasAplciar.DtResultados(0)("LimiteRestanteCliente").ToString().ToDecimal - Dim PorcentajeSaldoCliente As Decimal = ObjVentasAplciar.DtResultados(0)("PorcentajeSaldoCliente").ToString().ToDecimal - - 'SI EL LIMITE DE LA SUCURSAL ES MAYOR AL DEL CLIENTE DEBE LIMITAR AL DEL CLIENTE - If LimiteRestanteSucursal > LimiteRestanteCliente Then - Retorno = LimiteRestanteCliente - PorcentajeCredito = PorcentajeSaldoCliente - ElseIf LimiteRestanteSucursal < LimiteRestanteCliente Then - Retorno = LimiteRestanteSucursal - PorcentajeCredito = PorcentajeSaldoSucursal - ElseIf LimiteRestanteSucursal = LimiteRestanteCliente Then - Retorno = LimiteRestanteSucursal - PorcentajeCredito = PorcentajeSaldoSucursal - End If - - Else - Retorno = ObjVentasAplciar.DtResultados(0)("LimiteRestanteCliente").ToString().ToDecimal - PorcentajeCredito = ObjVentasAplciar.DtResultados(0)("PorcentajeSaldoCliente").ToString().ToDecimal + 'SI EL LIMITE DE LA SUCURSAL ES MAYOR AL DEL CLIENTE DEBE LIMITAR AL DEL CLIENTE + If LimiteRestanteSucursal > LimiteRestanteCliente Then + Retorno = LimiteRestanteCliente + PorcentajeCredito = PorcentajeSaldoCliente + ElseIf LimiteRestanteSucursal < LimiteRestanteCliente Then + Retorno = LimiteRestanteSucursal + PorcentajeCredito = PorcentajeSaldoSucursal + ElseIf LimiteRestanteSucursal = LimiteRestanteCliente Then + Retorno = LimiteRestanteSucursal + PorcentajeCredito = PorcentajeSaldoSucursal End If + + Else + Retorno = ObjVentasAplciar.DtResultados(0)("LimiteRestanteCliente").ToString().ToDecimal + PorcentajeCredito = ObjVentasAplciar.DtResultados(0)("PorcentajeSaldoCliente").ToString().ToDecimal End If End If + End If - If ObjVentas Is Nothing Then - ObjVentasAplciar.Dispose() - End If - + If ObjVentas Is Nothing Then + ObjVentasAplciar.Dispose() End If Return Retorno End Function @@ -7635,38 +7557,38 @@ Partial Class Ventas 'No exceder el limite de credito, Si no tiene contrato limita el credito, si tiene no hace nada. Si no tiene remisiones tampoco hace nada. If (Not CveContrato > 0 Or CveContratoTipo.Contiene(28)) AndAlso (Not NuevaFactura = 1) AndAlso RBLPago.SelectedValue = "1" AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") AndAlso RemisionesLista.Count <= 0 AndAlso TxtTotal.Text.ToDecimal > 0 AndAlso Not CvePedidoA > 0 Then - If UsuarioActual.Empresa.Funcionalidad(518) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(185) Then - Dim ObjVentas As New ClsVentas + 'If UsuarioActual.Empresa.Funcionalidad(518) = "1" AndAlso Not UsuarioActual.TienePermisoProceso(185) Then + Dim ObjVentas As New ClsVentas - If ObjVentas.ObtenerCreditoRestante(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero()) Then - If ObjVentas.DtResultados.Rows.Count > 0 Then + If ObjVentas.ObtenerCreditoRestante(CveCliente, DdlSucursalCliente.SelectedValue.ToEntero()) Then + If ObjVentas.DtResultados.Rows.Count > 0 Then - If DdlSucursalCliente.SelectedValue.ToEntero() > 0 Then - If ObjVentas.DtResultados(0)("LimiteRestanteSucursal").ToString().ToDecimal - If(TxtTipoCambio.Visible, TxtTotal.Text.ToDecimal * TxtTipoCambio.Text.ToDecimal, TxtTotal.Text.ToDecimal) < 0 Then - ObjVentas.Dispose() - Alert("Se está excediendo el límite de credito permitido de la Sucursal del Cliente.", TipoMensaje.MsgInformacion) - Exit Sub - End If - Else - If ObjVentas.DtResultados(0)("LimiteRestanteCliente").ToString().ToDecimal - If(TxtTipoCambio.Visible, TxtTotal.Text.ToDecimal * TxtTipoCambio.Text.ToDecimal, TxtTotal.Text.ToDecimal) < 0 Then - ObjVentas.Dispose() - Alert("Se está excediendo el límite de credito permitido del Cliente.", TipoMensaje.MsgInformacion) - Exit Sub - End If + If DdlSucursalCliente.SelectedValue.ToEntero() > 0 Then + If ObjVentas.DtResultados(0)("LimiteRestanteSucursal").ToString().ToDecimal - If(TxtTipoCambio.Visible, TxtTotal.Text.ToDecimal * TxtTipoCambio.Text.ToDecimal, TxtTotal.Text.ToDecimal) < 0 Then + ObjVentas.Dispose() + Alert("Se está excediendo el límite de credito permitido de la Sucursal del Cliente.", TipoMensaje.MsgInformacion) + Exit Sub End If - Else - ObjVentas.Dispose() - Alert("Ocurrio un error al obtener el limite de credito del cliente", TipoMensaje.MsgError) - Exit Sub + If ObjVentas.DtResultados(0)("LimiteRestanteCliente").ToString().ToDecimal - If(TxtTipoCambio.Visible, TxtTotal.Text.ToDecimal * TxtTipoCambio.Text.ToDecimal, TxtTotal.Text.ToDecimal) < 0 Then + ObjVentas.Dispose() + Alert("Se está excediendo el límite de credito permitido del Cliente.", TipoMensaje.MsgInformacion) + Exit Sub + End If End If + Else ObjVentas.Dispose() Alert("Ocurrio un error al obtener el limite de credito del cliente", TipoMensaje.MsgError) Exit Sub End If + Else ObjVentas.Dispose() + Alert("Ocurrio un error al obtener el limite de credito del cliente", TipoMensaje.MsgError) + Exit Sub End If + ObjVentas.Dispose() + 'End If End If @@ -8239,15 +8161,17 @@ Partial Class Ventas Dim DtMovDetalles As DataTable = Nothing If ObjInventario.GetSaldoVentaDetalle(CveDevolucion, UsuarioActual.CveEmpresa) Then DtMovDetalles = ObjInventario.DtResultados.Copy() + Else + ErrorList.Add("No se pudo verificar los movimientos de almacen de la factura") End If If DtMovDetalles IsNot Nothing Then For Each Row As DataRow In DtMovDetalles.Rows - Dim SaldoAlmacen As Decimal = Row("SaldoAlmacen").ToString().ToEntero() + Dim SaldoAlmacen As Decimal = Row("SaldoAlmacen").ToString().ToDecimal() If SaldoAlmacen < 0 Then - ObjInventario.UpdateEstatusAlmacen(Row("CveVentaDetalleNueva").ToString().ToEntero(), 1) - ElseIf SaldoAlmacen = 0 Then - ObjInventario.UpdateEstatusAlmacen(Row("CveVentaDetalleNueva").ToString().ToEntero(), 0) + If Not ObjInventario.UpdateEstatusAlmacen(Row("CveVentaDetalleNueva").ToString().ToEntero(), 1) Then + ErrorList.Add("No se pudo actualizar el movimiento de almacen de la factura") + End If End If Next End If @@ -14158,6 +14082,9 @@ Partial Class Ventas saldo = e.Row.DataKey("SaldoSubTotal").ToString().ToDecimal End If + e.Row.FCLiteral("LtlAnticipos").Text = saldo.FormatoNumero + ElseIf CveVenta > 0 AndAlso e.Row.DBCampo("Tipo").ToString() = "Ant" Then + saldo = e.Row.DataKey("SaldoConImpuestos").ToString().ToDecimal e.Row.FCLiteral("LtlAnticipos").Text = saldo.FormatoNumero End If @@ -15019,7 +14946,6 @@ Partial Class Ventas If IdCtaContRetIVA <> 0 Then IdCtaContable = IdCtaContRetIVA - CveCuenta = CveCuentaRetIVA Else If ObjConta.GetRetCuenta(8, UsuarioActual.CveEmpresa) Then If ObjConta.DtResultados.Rows.Count > 0 Then @@ -20592,9 +20518,9 @@ Partial Class Ventas DdlMetodoPago33.Enabled = False If UsuarioActual.CveEmpresa.Contiene(72, 80, 146) Then + CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero()) DdlFormaPago33.Enabled = False DdlFormaPago33.SelectedValueExist("20") - CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero()) End If End If @@ -20978,7 +20904,7 @@ Partial Class Ventas Dim AmortizacionNC As Decimal = 0 'SI ES AMORTIZACION POR NOTA DE CREDITO DEBE SUMAR LA TOTALIDAD PARA COMPARAR EL PAGO - If DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then + If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant") AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then For Each gvr As GridViewRow In GVAnticipos.Rows If gvr.FCCheckBox("Chk" & gvr.RowIndex) IsNot Nothing AndAlso gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked AndAlso gvr.DataKey("CveConceptoContable").ToEntero().Contiene(3) Then AmortizacionNC += gvr.FCTextBox(String.Format("TxtAnticipo{0}", gvr.RowIndex)).Text.ToDecimal @@ -25198,53 +25124,58 @@ Partial Class Ventas Me.TmpDTRNCBonificacionesSeleccionadas = Nothing - Me.TmpDTRNCBonificacionesCliente = DtNC.FiltraParametros("TipoRNC = 2") - Me.TmpDTRNCBonificacionesCliente.Columns.Add("ImporteBonificacion", GetType(Decimal)) - Me.TmpDTRNCBonificacionesCliente.Columns.Add("IVABonificacion", GetType(Decimal)) - Me.TmpDTRNCBonificacionesCliente.Columns.Add("CveVentaRNCCargo", GetType(Integer)) + If DtNC IsNot Nothing Then + Me.TmpDTRNCBonificacionesCliente = DtNC.FiltraParametros("TipoRNC = 2") + Me.TmpDTRNCBonificacionesCliente.Columns.Add("ImporteBonificacion", GetType(Decimal)) + Me.TmpDTRNCBonificacionesCliente.Columns.Add("IVABonificacion", GetType(Decimal)) + Me.TmpDTRNCBonificacionesCliente.Columns.Add("CveVentaRNCCargo", GetType(Integer)) - If CargarBonificaciones Then - 'Me.TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Copy() - CargaBonificaciones(-1, True) - End If + If CargarBonificaciones Then + 'Me.TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Copy() + CargaBonificaciones(-1, True) + End If - If CargarSoloGarantias Then - GvRemisionesNC.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = True") - Else - GvRemisionesNC.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = False") - End If - GvRemisionesNC.DataBind() + If CargarSoloGarantias Then + GvRemisionesNC.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = True") + Else + GvRemisionesNC.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = False") + End If + GvRemisionesNC.DataBind() - 'GvRemisionesNCBon.DataSource = Me.TmpDTRNCBonificacionesSeleccionadas - 'GvRemisionesNCBon.DataBind() + 'GvRemisionesNCBon.DataSource = Me.TmpDTRNCBonificacionesSeleccionadas + 'GvRemisionesNCBon.DataBind() - If CveVentaUsado > 0 Then - DivSMU.Visible = True - Dim FacUsado As New Modelos.Factura(UsuarioActual, CveVentaUsado, UsuarioActual.CveEmpresa) - Dim SaldoMaximoUsados As Decimal = FacUsado.DtDetalle.SUM("Total", "EsCargo = True").ToDecimal() + FacUsado.DtDetalle.SUM("ImporteIVA", "EsCargo = True").ToDecimal() - HdnSaldoMaximoUsados.Value = SaldoMaximoUsados.ToString() - LtlSMU.Text = String.Format("{0:N2}", SaldoMaximoUsados) - Else - Dim ObjAcum As New ClsAcumuladores - If ObjAcum.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) Then - Dim RowUsadosNC As DataRow = ObjAcum.DtResultados.Rows(2) + If CveVentaUsado > 0 Then DivSMU.Visible = True + Dim FacUsado As New Modelos.Factura(UsuarioActual, CveVentaUsado, UsuarioActual.CveEmpresa) + Dim SaldoMaximoUsados As Decimal = FacUsado.DtDetalle.SUM("Total", "EsCargo = True").ToDecimal() + FacUsado.DtDetalle.SUM("ImporteIVA", "EsCargo = True").ToDecimal() + HdnSaldoMaximoUsados.Value = SaldoMaximoUsados.ToString() + LtlSMU.Text = String.Format("{0:N2}", SaldoMaximoUsados) + Else + Dim ObjAcum As New ClsAcumuladores + If ObjAcum.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) Then + Dim RowUsadosNC As DataRow = ObjAcum.DtResultados.Rows(2) + DivSMU.Visible = True + + Dim SaldoMaximo As Decimal = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal() + If SaldoMaximo > 0 Then + HdnSaldoMaximoUsados.Value = RowUsadosNC("ValorConImpuestos").ToString() + LtlSMU.Text = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal().FormatoNumero(2) + Else + HdnSaldoMaximoUsados.Value = "0" + LtlSMU.Text = "0" + End If - Dim SaldoMaximo As Decimal = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal() - If SaldoMaximo > 0 Then - HdnSaldoMaximoUsados.Value = RowUsadosNC("ValorConImpuestos").ToString() - LtlSMU.Text = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal().FormatoNumero(2) Else + 'DivSMU.Visible = False HdnSaldoMaximoUsados.Value = "0" LtlSMU.Text = "0" End If - - Else - 'DivSMU.Visible = False - HdnSaldoMaximoUsados.Value = "0" - LtlSMU.Text = "0" + ObjAcum.Dispose() End If - ObjAcum.Dispose() + Else + HdnSaldoMaximoUsados.Value = "0" + LtlSMU.Text = "0" End If UpModalRemisionesNC.Update() @@ -25261,26 +25192,31 @@ Partial Class Ventas Me.TmpDTRNCBonificacionesSeleccionadas = Nothing - Me.TmpDTRNCBonificacionesCliente = DtNC.FiltraParametros("TipoRNC = 2") - Me.TmpDTRNCBonificacionesCliente.Columns.Add("ImporteBonificacion", GetType(Decimal)) - Me.TmpDTRNCBonificacionesCliente.Columns.Add("IVABonificacion", GetType(Decimal)) - Me.TmpDTRNCBonificacionesCliente.Columns.Add("CveVentaRNCCargo", GetType(Integer)) + If DtNC IsNot Nothing Then + Me.TmpDTRNCBonificacionesCliente = DtNC.FiltraParametros("TipoRNC = 2") + Me.TmpDTRNCBonificacionesCliente.Columns.Add("ImporteBonificacion", GetType(Decimal)) + Me.TmpDTRNCBonificacionesCliente.Columns.Add("IVABonificacion", GetType(Decimal)) + Me.TmpDTRNCBonificacionesCliente.Columns.Add("CveVentaRNCCargo", GetType(Integer)) - If CargarBonificaciones Then - 'Me.TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Copy() - CargaBonificacionesDesc("-1", True) - End If + If CargarBonificaciones Then + 'Me.TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Copy() + CargaBonificacionesDesc("-1", True) + End If - If CargarSoloGarantias Then - GvDescNCCargos.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = True") + If CargarSoloGarantias Then + GvDescNCCargos.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = True") + Else + GvDescNCCargos.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = False") + End If + GvDescNCCargos.DataBind() + + Dim SaldoMaximoUsados As Decimal = Me.TmpDT.SUM("Total", "EsCargo = True").ToDecimal() + Me.TmpDT.SUM("ImporteIVA", "EsCargo = True").ToDecimal() + HdnSaldoMaximoUsados.Value = SaldoMaximoUsados.ToString() + LblSaldoMaximoUsados.Text = String.Format("{0:N2}", SaldoMaximoUsados) Else - GvDescNCCargos.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = False") + HdnSaldoMaximoUsados.Value = "0" + LblSaldoMaximoUsados.Text = "0" End If - GvDescNCCargos.DataBind() - - Dim SaldoMaximoUsados As Decimal = Me.TmpDT.SUM("Total", "EsCargo = True").ToDecimal() + Me.TmpDT.SUM("ImporteIVA", "EsCargo = True").ToDecimal() - HdnSaldoMaximoUsados.Value = SaldoMaximoUsados.ToString() - LblSaldoMaximoUsados.Text = String.Format("{0:N2}", SaldoMaximoUsados) UpDescNC.Update() End Sub @@ -28471,7 +28407,7 @@ Partial Class Ventas ChkRemProductos.Visible = True Else 'DivPSRemision.Visible = True - CargaPSRemision(-1, DdlPSRemision) + 'CargaPSRemision(-1, DdlPSRemision) ChkRemProductos.Visible = False ChkRemProductos.Checked = False End If From 865a41e1041e08e8ce7ac2ef254ee28103517ca1 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Mon, 19 Jul 2021 13:37:24 -0700 Subject: [PATCH 02/14] Reporte de comisiones de servec --- App_Code/ClsPaginas.vb | 2 + App_Code/ClsVentas.vb | 44 +++++++++ Ventas/RepComisionesServec.aspx | 104 ++++++++++++++++++++ Ventas/RepComisionesServec.aspx.vb | 63 +++++++++++++ Ventas/RepComisionesServecDetalle.aspx | 110 ++++++++++++++++++++++ Ventas/RepComisionesServecDetalle.aspx.vb | 85 +++++++++++++++++ 6 files changed, 408 insertions(+) create mode 100644 Ventas/RepComisionesServec.aspx create mode 100644 Ventas/RepComisionesServec.aspx.vb create mode 100644 Ventas/RepComisionesServecDetalle.aspx create mode 100644 Ventas/RepComisionesServecDetalle.aspx.vb diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index e9dae6449..7c3e1743f 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -5085,6 +5085,8 @@ Public Class ClsPaginas PaginaDict.Add("/Ventas/CatMetasVendedores.aspx".ToUpper(), 723) PaginaDict.Add("/Ventas/RepAuxiliarFacturas.aspx".ToUpper(), 567) PaginaDict.Add("/Ventas/CatAutorizacionLimites.aspx".ToUpper(), 781) + PaginaDict.Add("/Ventas/RepComisionesServec.aspx".ToUpper(), 782) + PaginaDict.Add("/Ventas/RepComisionesServecDetalle.aspx".ToUpper(), 783) #End Region diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index d2d08206d..576c9b935 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -3825,6 +3825,50 @@ Public Class ClsVentas Return Retorno End Function + Public Function GetRepComisionesServec(CveVendedor As Integer, FechaI As Date, FechaF As Date, CveSubProyecto As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_ReporteComisionesServecGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor + .Add("@FechaI", SqlDbType.Date).Value = FechaI + .Add("@FechaF", SqlDbType.Date).Value = FechaF + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Reporte de Comisiones.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + + Public Function GetRepComisionesServecDetalle(CveVendedor As Integer, FechaI As Date, FechaF As Date, CveSubProyecto As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Vta_ReporteComisionesServecDetalleGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor + .Add("@FechaI", SqlDbType.Date).Value = FechaI + .Add("@FechaF", SqlDbType.Date).Value = FechaF + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Reporte de Comisiones Detalle.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + #End Region #Region "REPORTE DE PRODUCTOS SERVICIOS PERIODO" diff --git a/Ventas/RepComisionesServec.aspx b/Ventas/RepComisionesServec.aspx new file mode 100644 index 000000000..86fcd5566 --- /dev/null +++ b/Ventas/RepComisionesServec.aspx @@ -0,0 +1,104 @@ +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepComisionesServec.aspx.vb" Inherits="Ventas_RepComisionesServec" %> + + + + + + + Reporte de comisiones + + + + + + + + + + +
+
+
+ +
+
+
+ +
+ + + +
+ +
+ + + +
+ +
+
+ + + + +
+ + + + + + +
+ +
+
+ + + + +
+ + + + + + +
+
+
+ +
+
+
+
+
+
+

Importes expresados en moneda nacional

+
+
+ " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
+
+ + + + + + + + + + + + + + + + + +
+ + + diff --git a/Ventas/RepComisionesServec.aspx.vb b/Ventas/RepComisionesServec.aspx.vb new file mode 100644 index 000000000..594a94faa --- /dev/null +++ b/Ventas/RepComisionesServec.aspx.vb @@ -0,0 +1,63 @@ +Option Explicit On +Option Strict On + +Imports Extensiones +Imports System.Data + +Partial Class Ventas_RepComisionesServec + Inherits ClsPaginas + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not IsPostBack Then + DdlSubProyecto.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) + DdlSubProyecto.DataBind() + + InicializaValores() + End If + End Sub + +#Region " INICIALIZA VALORES " + + Private Sub InicializaValores() + txtFechaI.Text = FirstDayOfMonth(Now).ToShortDateString + txtFechaF.Text = Now.LastDayOfMonth.ToShortDateString + + DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa) + DdlVendedor.DataBind() + + End Sub + +#End Region + + Protected Sub BtnConsultar_Click(sender As Object, e As System.EventArgs) Handles BtnConsultar.Click + CargaDatos() + UPDatos.Update() + End Sub + + Private Sub CargaDatos() + Dim FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim().ToDate, MinFecha) + Dim FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim().ToDate, MaxFecha) + Dim ObjVentas As New ClsVentas() + + If ObjVentas.GetRepComisionesServec(DdlVendedor.SelectedValue.ToEntero, FechaI, FechaF, DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then + GvDatos.DataSource = ObjVentas.DtResultados + Else + GvDatos.DataSource = Nothing + End If + ObjVentas.Dispose() + GvDatos.DataBind() + End Sub + + Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + Select Case e.Row.DBCampo("TipoFila").ToString.ToEntero() + Case 1 + e.Row.CssClass = "Totales" + Case Else + e.Row.CssClass = "Texto" + End Select + + e.Row.FCHyperLink("HLVendedor").NavigateUrl = String.Format("/Ventas/RepComisionesServecDetalle.aspx?CveVendedor={0}&CveSubProyecto={1}&FechaI={2:dd/MM/yyy}&FechaF={3:dd/MM/yyy}", e.Row.DBCampo("CveVendedor"), DdlSubProyecto.SelectedValue, If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim().ToDate, MinFecha), If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim().ToDate, MaxFecha)) + End If + End Sub +End Class diff --git a/Ventas/RepComisionesServecDetalle.aspx b/Ventas/RepComisionesServecDetalle.aspx new file mode 100644 index 000000000..11d57435d --- /dev/null +++ b/Ventas/RepComisionesServecDetalle.aspx @@ -0,0 +1,110 @@ +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepComisionesServecDetalle.aspx.vb" Inherits="Ventas_RepComisionesServecDetalle" %> + + + + + + + Reporte de comisiones - Detalle + + + + + + + + + + +
+
+
+ +
+
+
+ +
+ + + +
+ +
+ + + +
+ +
+
+ + + + +
+ + + + + + +
+ +
+
+ + + + +
+ + + + + + +
+
+
+ +
+
+
+
+
+
+

Importes expresados en moneda nacional

+
+
+ " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
+
+ + + + + + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/Ventas/RepComisionesServecDetalle.aspx.vb b/Ventas/RepComisionesServecDetalle.aspx.vb new file mode 100644 index 000000000..9ba00bafd --- /dev/null +++ b/Ventas/RepComisionesServecDetalle.aspx.vb @@ -0,0 +1,85 @@ +Option Explicit On +Option Strict On + +Imports Extensiones +Imports System.Data + +Partial Class Ventas_RepComisionesServecDetalle + Inherits ClsPaginas + + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not IsPostBack Then + DdlSubProyecto.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) + DdlSubProyecto.DataBind() + + InicializaValores() + CargaParametrosDetalle() + End If + End Sub + +#Region " INICIALIZA VALORES " + + Private Sub InicializaValores() + DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa) + DdlVendedor.DataBind() + End Sub + + Private Sub CargaParametrosDetalle() + Dim CveVendedor, CveSubProyecto, FechaI, FechaF As String + + CveVendedor = If(Request("CveVendedor") IsNot Nothing AndAlso Request("CveVendedor").ToEntero() > 0, Request("CveVendedor").ToEntero(), -1).ToString + CveSubProyecto = If(Request("CveSubProyecto") IsNot Nothing AndAlso Request("CveSubProyecto").ToEntero() > 0, Request("CveSubProyecto").ToEntero(), -1).ToString + + FechaI = If(Request("FechaI") IsNot Nothing, Request("FechaI").ToString, "-1").ToString + FechaF = If(Request("FechaF") IsNot Nothing, Request("FechaF").ToString, "-1").ToString + + DdlVendedor.SelectedValueExist(CveVendedor) + DdlSubProyecto.SelectedValueExist(CveSubProyecto) + + If FechaI <> "-1" Then + txtFechaI.Text = FechaI + End If + If FechaF <> "-1" Then + txtFechaF.Text = FechaF + End If + CargaDatos() + End Sub + +#End Region + + Protected Sub BtnConsultar_Click(sender As Object, e As System.EventArgs) Handles BtnConsultar.Click + CargaDatos() + UPDatos.Update() + End Sub + + Private Sub CargaDatos() + Dim FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim().ToDate, MinFecha) + Dim FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim().ToDate, MaxFecha) + Dim ObjVentas As New ClsVentas() + + If ObjVentas.GetRepComisionesServecDetalle(DdlVendedor.SelectedValue.ToEntero, FechaI, FechaF, DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then + GvDatos.DataSource = ObjVentas.DtResultados + Else + GvDatos.DataSource = Nothing + End If + ObjVentas.Dispose() + GvDatos.DataBind() + End Sub + + Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + Select Case e.Row.DBCampo("TipoFila").ToString.ToEntero() + Case 1 + e.Row.CssClass = "Totales" + Case 2 + e.Row.CssClass = "SubTotales" + Case 3 + e.Row.CssClass = "SubTotales2" + Case 4 + e.Row.FCHyperLink("HLGrupo").NavigateUrl = String.Format("/Ventas/Ventas.aspx?CveVenta={0}", e.Row.DBCampo("CveVenta")) + End Select + + End If + End Sub + +End Class From 7894d1cd6047600bf6da700a5e086d9edbc0372a Mon Sep 17 00:00:00 2001 From: rakcsle Date: Tue, 20 Jul 2021 08:43:36 -0700 Subject: [PATCH 03/14] Ajuste combustibles, cuando el ajuste es negativo lo distribuye entre llas partidas que apliquen ieps y tengan iva --- Compras/Compras.aspx.vb | 82 ++++++++++++++++++++++++++--------------- 1 file changed, 52 insertions(+), 30 deletions(-) diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 14a68d83c..6bb549eac 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -4359,7 +4359,7 @@ Partial Class Compras_Compras If Not AjustaCombustibles() Then Exit Sub End If - + Exit Sub '------------------TERMINA VALIDACIONES------------------ @@ -8523,10 +8523,12 @@ Partial Class Compras_Compras Dim IndiceContador As Integer = 0 Dim IndiceUltimo As Integer = 0 + Dim CantidadRegistroConIVA As Decimal For Each dRow As DataRow In TmpDT.Rows If Boolean.Parse(dRow("AplicaIEPS").ToString) And Boolean.Parse(dRow("IEPSGrabaIVA").ToString) = False And dRow("IVA").ToString.ToDecimal > 0 Then IndiceUltimo = IndiceContador + CantidadRegistroConIVA = CantidadRegistroConIVA + 1 End If IndiceContador = IndiceContador + 1 Next @@ -8535,8 +8537,26 @@ Partial Class Compras_Compras DiferenciaIVas = TxtIVA.Text.ToDecimal - IVADetalles If Math.Abs(DiferenciaIVas) > 0.01D Then - TmpDT.Rows(IndiceUltimo)("IVA") = TmpDT.Rows(IndiceUltimo)("IVA").ToString.ToDecimal + DiferenciaIVas + + If (TmpDT.Rows(IndiceUltimo)("IVA").ToString.ToDecimal + DiferenciaIVas) < 0 Then + + Dim AjusteteDividido As Decimal = Math.Abs(DiferenciaIVas) / CantidadRegistroConIVA + + For Each dRow As DataRow In TmpDT.Rows + If Boolean.Parse(dRow("AplicaIEPS").ToString) And Boolean.Parse(dRow("IEPSGrabaIVA").ToString) = False And dRow("IVA").ToString.ToDecimal > 0 Then + dRow("IVA") = dRow("IVA").ToString.ToDecimal - AjusteteDividido + End If + Next + + + Else + TmpDT.Rows(IndiceUltimo)("IVA") = TmpDT.Rows(IndiceUltimo)("IVA").ToString.ToDecimal + DiferenciaIVas + End If + + + TmpDT.AcceptChanges() + End If End If @@ -8549,22 +8569,22 @@ Partial Class Compras_Compras If Math.Abs(DiferenciaIVas) > 0.01D Then + Respuesta = False + 'If IVADetalles > 0 Then - If IVADetalles > 0 Then + ' For Each dRow As DataRow In TmpDT.Rows + ' If dRow("IVA").ToString.ToDecimal > 0 Then + ' dRow("IVA") = dRow("IVA").ToString.ToDecimal + DiferenciaIVas + ' TmpDT.AcceptChanges() + ' Respuesta = True + ' Exit For + ' End If + ' Next - For Each dRow As DataRow In TmpDT.Rows - If dRow("IVA").ToString.ToDecimal > 0 Then - dRow("IVA") = dRow("IVA").ToString.ToDecimal + DiferenciaIVas - TmpDT.AcceptChanges() - Respuesta = True - Exit For - End If - Next - - Else - Alert("Los productos especificados en el lisado no tienen asigando impuesto IVA, favor de realizar la correción en el producto que aplique el impúesto.", TipoMensaje.MsgAdvertencia) - Respuesta = False - End If + 'Else + ' Alert("Los productos especificados en el lisado no tienen asigando impuesto IVA, favor de realizar la correción en el producto que aplique el impúesto.", TipoMensaje.MsgAdvertencia) + ' Respuesta = False + 'End If Else Respuesta = True End If @@ -18447,20 +18467,22 @@ Partial Class Compras_Compras Dim IEPSPS = (TxtIEPSModal.Text.ToDouble / 100) Dim IEPSPSIVA = 0 - If Not (CveCompra > 0 Or CveFactura > 0 Or OCVinculada) Then - 'If DdlIVA.SelectedValue.ToDouble = 0 Then DrPS("IVA") = 0 Else DrPS("IVA") = IVA * Total - DrPS("IVA") = IVA * Total - DrPS("IVAPorcentaje") = IVA - DrPS("RetIVA") = RetIVA * Total - DrPS("RetIVAPorcentaje") = RetIVA - DrPS("RetISR") = RetISR * Total - DrPS("RetISRPorcentaje") = RetISR - DrPS("IEPSPS") = IEPSPS * Total - DrPS("IEPSPSPorcentaje") = IEPSPS - DrPS("IEPSPSIVA") = IEPSPSIVA * Total - DrPS("IEPSPSIVAPorcentaje") = IEPSPSIVA - AplicaCalculaTotales = True - End If + 'I f Not (CveCompra > 0 Or CveFactura > 0 Or OCVinculada) Then + 'If DdlIVA.SelectedValue.ToDouble = 0 Then DrPS("IVA") = 0 Else DrPS("IVA") = IVA * Total + DrPS("IVA") = IVA * Total + DrPS("IVAPorcentaje") = IVA + DrPS("RetIVA") = RetIVA * Total + DrPS("RetIVAPorcentaje") = RetIVA + DrPS("RetISR") = RetISR * Total + DrPS("RetISRPorcentaje") = RetISR + DrPS("IEPSPS") = IEPSPS * Total + DrPS("IEPSPSPorcentaje") = IEPSPS + DrPS("IEPSPSIVA") = IEPSPSIVA * Total + DrPS("IEPSPSIVAPorcentaje") = IEPSPSIVA + + + AplicaCalculaTotales = True + 'End If TmpDT.AcceptChanges() From 99ddf612da404a28e09ec666595c787b3d4f7d63 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Tue, 20 Jul 2021 10:09:47 -0700 Subject: [PATCH 04/14] Cantidad minima promo en popupexistenciasalmacen --- Inventarios/PopUpExistenciasAlmacen.aspx | 1 + Inventarios/PopUpExistenciasAlmacen.aspx.vb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Inventarios/PopUpExistenciasAlmacen.aspx b/Inventarios/PopUpExistenciasAlmacen.aspx index 6f5122421..db5dc9c11 100644 --- a/Inventarios/PopUpExistenciasAlmacen.aspx +++ b/Inventarios/PopUpExistenciasAlmacen.aspx @@ -150,6 +150,7 @@ + diff --git a/Inventarios/PopUpExistenciasAlmacen.aspx.vb b/Inventarios/PopUpExistenciasAlmacen.aspx.vb index 08d54fcc4..d00f0f716 100644 --- a/Inventarios/PopUpExistenciasAlmacen.aspx.vb +++ b/Inventarios/PopUpExistenciasAlmacen.aspx.vb @@ -188,7 +188,7 @@ Partial Class Inventarios_Default End If If UsuarioActual.CveEmpresa = 119 Then - GV.Columns(5).Visible = True + GV.Columns(6).Visible = True End If End If End Sub From c907edad0fe26ab77150d7674bcc0c81fa2d1445 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Tue, 20 Jul 2021 10:10:08 -0700 Subject: [PATCH 05/14] Servicio web KimberlyClark --- .../WSKimberlyClark/Reference.svcmap | 31 + .../WSKimberlyClark/Service.disco | 6 + .../WSKimberlyClark/Service.wsdl | 1435 +++++++++++++++++ .../WSKimberlyClark/configuration.svcinfo | 13 + .../WSKimberlyClark/configuration91.svcinfo | 549 +++++++ 5 files changed, 2034 insertions(+) create mode 100644 App_WebReferences/WSKimberlyClark/Reference.svcmap create mode 100644 App_WebReferences/WSKimberlyClark/Service.disco create mode 100644 App_WebReferences/WSKimberlyClark/Service.wsdl create mode 100644 App_WebReferences/WSKimberlyClark/configuration.svcinfo create mode 100644 App_WebReferences/WSKimberlyClark/configuration91.svcinfo diff --git a/App_WebReferences/WSKimberlyClark/Reference.svcmap b/App_WebReferences/WSKimberlyClark/Reference.svcmap new file mode 100644 index 000000000..0edd3683f --- /dev/null +++ b/App_WebReferences/WSKimberlyClark/Reference.svcmap @@ -0,0 +1,31 @@ + + + + false + true + + false + false + false + + + true + Auto + true + true + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/App_WebReferences/WSKimberlyClark/Service.disco b/App_WebReferences/WSKimberlyClark/Service.disco new file mode 100644 index 000000000..f7c20e50e --- /dev/null +++ b/App_WebReferences/WSKimberlyClark/Service.disco @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/App_WebReferences/WSKimberlyClark/Service.wsdl b/App_WebReferences/WSKimberlyClark/Service.wsdl new file mode 100644 index 000000000..926141c97 --- /dev/null +++ b/App_WebReferences/WSKimberlyClark/Service.wsdl @@ -0,0 +1,1435 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Autenticacion necesaria para la operacion por parte de los prestadores + + + + + Cierre de sesion explicito por parte del prestador + + + + + Inserta un evento, reconoce el prestador por medio del login previo + + + + + Loguea e inserta multiples eventos en modo batch + + + + + Loguea e inserta un evento + + + + + Loguea e inserta un evento indicando ademas de incorporar los sensores + + + + + + + + + Retorna el primer comando de la lista + + + + + Indica que el comando ya fue procesado + + + + + Metodo para informar el estado del comando, retorna verdadero su fue insertado correctamente + + + + + Metodo para el cambio de clave, retorna verdadero si la clave es realmente cambiada. + + + + + Loguea cambia la clave, retorna verdadero si la clave es realmente cambiada. + + + + + Realiza el login y retorna el primer comando de la lista + + + + + Realiza el login y finaliza un comando + + + + + Realiza el login y actualiza el estado de un comando en proceso + + + + + Realiza el login y retorna el primer comando de la lista + + + + + + + Autenticacion necesaria para la operacion por parte de los prestadores + + + + + Cierre de sesion explicito por parte del prestador + + + + + Inserta un evento, reconoce el prestador por medio del login previo + + + + + Loguea e inserta un evento + + + + + + + + + Retorna el primer comando de la lista + + + + + Indica que el comando ya fue procesado + + + + + Metodo para informar el estado del comando, retorna verdadero su fue insertado correctamente + + + + + Metodo para el cambio de clave, retorna verdadero si la clave es realmente cambiada. + + + + + Loguea cambia la clave, retorna verdadero si la clave es realmente cambiada. + + + + + Realiza el login y retorna el primer comando de la lista + + + + + Realiza el login y finaliza un comando + + + + + Realiza el login y actualiza el estado de un comando en proceso + + + + + Realiza el login y retorna el primer comando de la lista + + + + + + + Autenticacion necesaria para la operacion por parte de los prestadores + + + + + Cierre de sesion explicito por parte del prestador + + + + + Inserta un evento, reconoce el prestador por medio del login previo + + + + + Loguea e inserta un evento + + + + + + + + + Retorna el primer comando de la lista + + + + + Indica que el comando ya fue procesado + + + + + Metodo para informar el estado del comando, retorna verdadero su fue insertado correctamente + + + + + Metodo para el cambio de clave, retorna verdadero si la clave es realmente cambiada. + + + + + Loguea cambia la clave, retorna verdadero si la clave es realmente cambiada. + + + + + Realiza el login y retorna el primer comando de la lista + + + + + Realiza el login y finaliza un comando + + + + + Realiza el login y actualiza el estado de un comando en proceso + + + + + Realiza el login y retorna el primer comando de la lista + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/App_WebReferences/WSKimberlyClark/configuration.svcinfo b/App_WebReferences/WSKimberlyClark/configuration.svcinfo new file mode 100644 index 000000000..210b37bc7 --- /dev/null +++ b/App_WebReferences/WSKimberlyClark/configuration.svcinfo @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/App_WebReferences/WSKimberlyClark/configuration91.svcinfo b/App_WebReferences/WSKimberlyClark/configuration91.svcinfo new file mode 100644 index 000000000..291b32d20 --- /dev/null +++ b/App_WebReferences/WSKimberlyClark/configuration91.svcinfo @@ -0,0 +1,549 @@ + + + + + + + ServiceSoap + + + + + + + + + + + + + + + + + + + + + StrongWildcard + + + + + + 65536 + + + + + + + + + System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + System.Text.UTF8Encoding + + + Buffered + + + + + + Text + + + System.ServiceModel.Configuration.BasicHttpSecurityElement + + + Transport + + + System.ServiceModel.Configuration.HttpTransportSecurityElement + + + None + + + None + + + System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement + + + Never + + + TransportSelected + + + (Collection) + + + + + + System.ServiceModel.Configuration.BasicHttpMessageSecurityElement + + + UserName + + + Default + + + + + + + ServiceSoap1 + + + + + + + + + + + + + + + + + + + + + StrongWildcard + + + + + + 65536 + + + + + + + + + System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + System.Text.UTF8Encoding + + + Buffered + + + + + + Text + + + System.ServiceModel.Configuration.BasicHttpSecurityElement + + + None + + + System.ServiceModel.Configuration.HttpTransportSecurityElement + + + None + + + None + + + System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement + + + Never + + + TransportSelected + + + (Collection) + + + + + + System.ServiceModel.Configuration.BasicHttpMessageSecurityElement + + + UserName + + + Default + + + + + + + ServiceSoap12 + + + + + + + + + + + + + + + System.ServiceModel.Configuration.TextMessageEncodingElement + + + 64 + + + 16 + + + Soap12 + + + System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + System.Text.UTF8Encoding + + + System.ServiceModel.Configuration.HttpsTransportElement + + + False + + + 524288 + + + 65536 + + + False + + + 00:00:00 + + + Anonymous + + + False + + + True + + + StrongWildcard + + + True + + + 65536 + + + 0 + + + System.ServiceModel.Configuration.HttpMessageHandlerFactoryElement + + + (Collection) + + + + + + + + + Anonymous + + + + + + Buffered + + + False + + + True + + + System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement + + + Never + + + TransportSelected + + + (Collection) + + + System.ServiceModel.Configuration.WebSocketTransportSettingsElement + + + Never + + + False + + + 00:00:00 + + + + + + False + + + 0 + + + False + + + + + + + + + https://unigis2.unisolutions.com.ar/HUB/UNIGIS/MAPI/SOAP/GPS/Service.asmx + + + + + + basicHttpBinding + + + ServiceSoap + + + WSKimberlyClark.ServiceSoap + + + System.ServiceModel.Configuration.AddressHeaderCollectionElement + + + <Header /> + + + System.ServiceModel.Configuration.IdentityElement + + + System.ServiceModel.Configuration.UserPrincipalNameElement + + + + + + System.ServiceModel.Configuration.ServicePrincipalNameElement + + + + + + System.ServiceModel.Configuration.DnsElement + + + + + + System.ServiceModel.Configuration.RsaElement + + + + + + System.ServiceModel.Configuration.CertificateElement + + + + + + System.ServiceModel.Configuration.CertificateReferenceElement + + + My + + + LocalMachine + + + FindBySubjectDistinguishedName + + + + + + False + + + ServiceSoap + + + + + + + + + + + + + https://unigis2.unisolutions.com.ar/HUB/UNIGIS/MAPI/SOAP/GPS/Service.asmx + + + + + + customBinding + + + ServiceSoap12 + + + WSKimberlyClark.ServiceSoap + + + System.ServiceModel.Configuration.AddressHeaderCollectionElement + + + <Header /> + + + System.ServiceModel.Configuration.IdentityElement + + + System.ServiceModel.Configuration.UserPrincipalNameElement + + + + + + System.ServiceModel.Configuration.ServicePrincipalNameElement + + + + + + System.ServiceModel.Configuration.DnsElement + + + + + + System.ServiceModel.Configuration.RsaElement + + + + + + System.ServiceModel.Configuration.CertificateElement + + + + + + System.ServiceModel.Configuration.CertificateReferenceElement + + + My + + + LocalMachine + + + FindBySubjectDistinguishedName + + + + + + False + + + ServiceSoap12 + + + + + + + + + + + \ No newline at end of file From ca8a75bf1ca065c5fd60d81e374f5adbd823ca16 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Tue, 20 Jul 2021 10:10:29 -0700 Subject: [PATCH 06/14] Validaciones y correciones en punto de venta --- Ventas/PV.aspx.vb | 70 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 63 insertions(+), 7 deletions(-) diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb index b6305efd8..db90d09e2 100644 --- a/Ventas/PV.aspx.vb +++ b/Ventas/PV.aspx.vb @@ -584,7 +584,7 @@ Partial Class PV 'Estimaciones Private Property CveContrato As Integer Get - Return ViewState("CveContrato").ToString.ToEntero + Return If(IsNothing(ViewState("CveContrato")), -1, ViewState("CveContrato").ToString.ToEntero) End Get Set(value As Integer) @@ -1181,7 +1181,10 @@ Partial Class PV 'CARGA VENTA If Request("CveVenta") IsNot Nothing Then ViewState("CveVenta") = Request("CveVenta").ToString().ToEntero() + SetPermisos() CargaVenta() + Else + SetPermisos() End If @@ -1198,7 +1201,7 @@ Partial Class PV End If If UsuarioActual.CveVendedor > 0 Then - If CveVenta = -1 AndAlso Not DdlVendedor.SelectedValue.ToEntero > 0 Then DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString) + If CveVenta <= 0 AndAlso Not DdlVendedor.SelectedValue.ToEntero > 0 Then DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString) If DdlVendedor.SelectedValue.ToEntero > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then DdlVendedor.Enabled = False End If @@ -1268,6 +1271,49 @@ Partial Class PV End If End Sub + Private Sub SetPermisos() + If CveVenta <= 0 Then + 'Puede cotizar + If Not UsuarioActual.TienePermisoProceso(59) Then + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Cot")) + End If + + 'Puede Hacer NC + If Not UsuarioActual.TienePermisoProceso(175) Then + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Egs")) + End If + + 'Puede Hacer Devolución + If Not UsuarioActual.TienePermisoProceso(264) Then + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Dev")) + End If + + 'Puede facturar + If Not UsuarioActual.TienePermisoProceso(60) Then + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ing")) + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Ant")) + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Egs")) + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Dev")) + End If + + 'Puede remisionar + If Not UsuarioActual.TienePermisoProceso(199) Then + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem")) + End If + + 'Puede hacer pedido + If Me.CveVenta <= 0 Then + If Not UsuarioActual.TienePermisoProceso(177) Then + If DdlTipoComprobante.Items.FindByValue("Pd2") IsNot Nothing Then + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Pd2")) + End If + End If + End If + + ConfiguraTipoDocto() + End If + End Sub + Private Sub CargaMarcasFiltro() Using ObjMarcas As New ClsProductosServicios @@ -2856,12 +2902,22 @@ Partial Class PV Dim CveVendedorActual = DdlVendedor.SelectedValue DdlVendedor.Items.Clear() - If UsuarioActual.Empresa.Funcionalidad(302) = "1" AndAlso DdlSubProyectoDatos.SelectedValue.ToEntero > 0 Then - DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveSubProyecto = {0}", DdlSubProyectoDatos.SelectedValue)).FiltraParametros("VendedorTipo = 1") - Else - DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltraParametros("VendedorTipo = 1") + + Dim DtVendedores As DataTable = Nothing + + Dim ObjVendedores As New ClsVtaVendedores + If ObjVendedores.GetVendedores(UsuarioActual.CveEmpresa) Then DtVendedores = ObjVendedores.DtResultados.Copy + ObjVendedores.Dispose() + + If DtVendedores IsNot Nothing Then + If UsuarioActual.Empresa.Funcionalidad(302) = "1" AndAlso DdlSubProyectoDatos.SelectedValue.ToEntero > 0 Then + DdlVendedor.DataSource = DtVendedores.FiltraParametros(String.Format("CveSubProyecto = {0}", DdlSubProyectoDatos.SelectedValue)).FiltraParametros("VendedorTipo IN(1,4)") + Else + DdlVendedor.DataSource = DtVendedores.FiltraParametros("VendedorTipo IN(1,4)") + End If End If + DdlVendedor.SelectedValue = "0" DdlVendedor.Items.Insert(0, New ListItem("Sin Asignar", "0")) DdlVendedor.DataBind() @@ -2874,7 +2930,7 @@ Partial Class PV 'SELECCIONA VENDEDOR DEL USUARIO CUANDO SEA VENTA NUEVA Y SIN CLIENTE If UsuarioActual.CveVendedor > 0 Then - If CveVenta = -1 AndAlso Not DdlVendedor.SelectedValue.ToEntero() > 0 Then DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString()) + If CveVenta <= 0 AndAlso Not DdlVendedor.SelectedValue.ToEntero() > 0 Then DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString()) If DdlVendedor.SelectedValue.ToEntero() > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then DdlVendedor.Enabled = False End If From 8d8a8935e7b0eadc9b9815e8a398df7b8e91a011 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Tue, 20 Jul 2021 10:10:55 -0700 Subject: [PATCH 07/14] Habilitar pagueseA cuando es cheque emitido --- Compras/ReembolsosComprobaciones.aspx.vb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Compras/ReembolsosComprobaciones.aspx.vb b/Compras/ReembolsosComprobaciones.aspx.vb index 092cdd87e..b05473cb0 100644 --- a/Compras/ReembolsosComprobaciones.aspx.vb +++ b/Compras/ReembolsosComprobaciones.aspx.vb @@ -341,7 +341,7 @@ Partial Class Compras_ReembolsosComprobaciones Protected Sub DDlCheques_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DDlCheques.SelectedIndexChanged If DDlCheques.SelectedValue.ToEntero > 0 Then - + TxtAboneA.Enabled = False PnlChequeInfo.Visible = True ChkOtrosIngresosCheque.Visible = True @@ -357,7 +357,7 @@ Partial Class Compras_ReembolsosComprobaciones HlCheque.Text = "" HlCheque.NavigateUrl = "" - + TxtAboneA.Enabled = True HdnCheque.Value = "-1" ChkOtrosIngresosCheque.Visible = False From 088264ec70156154c642cdf57cb9d2e02e18818a Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Tue, 20 Jul 2021 10:11:17 -0700 Subject: [PATCH 08/14] Quitar validador de rin en promociones --- Ventas/Promociones.aspx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Ventas/Promociones.aspx b/Ventas/Promociones.aspx index 581e8f021..2f576384e 100644 --- a/Ventas/Promociones.aspx +++ b/Ventas/Promociones.aspx @@ -289,8 +289,8 @@
- - + <%-- + --%>
From 9cf67b2c5c87178a83329153469b24f525a776d0 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Tue, 20 Jul 2021 10:11:48 -0700 Subject: [PATCH 09/14] Reducir sleep en envio de informacion, API Econo --- Ashx/E141.ashx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ashx/E141.ashx b/Ashx/E141.ashx index 90a17dc54..4f74331ac 100644 --- a/Ashx/E141.ashx +++ b/Ashx/E141.ashx @@ -2106,7 +2106,7 @@ Public Class E141 : Implements IHttpHandler End If End If - Threading.Thread.Sleep(3000) + Threading.Thread.Sleep(1000) End While End If From 40a0f7e27329cdbcdb43804295890a7571d3b80d Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Tue, 20 Jul 2021 10:13:06 -0700 Subject: [PATCH 10/14] Correciones en trayectos --- .gitignore | 1 + GPS/TrayectoDetalle.aspx | 2 +- GPS/TrayectoDetalle.aspx.vb | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index dc964f860..52ab644c4 100644 --- a/.gitignore +++ b/.gitignore @@ -278,3 +278,4 @@ __pycache__/ vwd.webinfo /Bin.rar +/Ashx/sigfox.ashx diff --git a/GPS/TrayectoDetalle.aspx b/GPS/TrayectoDetalle.aspx index 7348e02c5..f93043055 100644 --- a/GPS/TrayectoDetalle.aspx +++ b/GPS/TrayectoDetalle.aspx @@ -375,7 +375,7 @@ - +
diff --git a/GPS/TrayectoDetalle.aspx.vb b/GPS/TrayectoDetalle.aspx.vb index fe58efe5d..9c6208757 100644 --- a/GPS/TrayectoDetalle.aspx.vb +++ b/GPS/TrayectoDetalle.aspx.vb @@ -308,8 +308,8 @@ Partial Class GPS_TrayectoDetalle End Try End If - 'UpIgniciones.Update() - 'UpEventos.Update() + UpIgniciones.Update() + UpEventos.Update() End Sub Public Sub CargaReporte() Dim ObjGPS As New ClsGPS From 3745123a0122f882577b7fee4c193e3d0d2a44bd Mon Sep 17 00:00:00 2001 From: rrene Date: Tue, 20 Jul 2021 12:54:16 -0700 Subject: [PATCH 11/14] -- carga excel, ignora la comilla sencilla --- Contratos/ContratoObra.aspx.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Contratos/ContratoObra.aspx.vb b/Contratos/ContratoObra.aspx.vb index acff7db4c..716e6cac0 100644 --- a/Contratos/ContratoObra.aspx.vb +++ b/Contratos/ContratoObra.aspx.vb @@ -3327,7 +3327,7 @@ Partial Class Contratos_ContratoObra Dim StrReturn As String = String.Empty Dim CvePS As Integer = 0 - CvePS = GlobalDTPS(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePS", Opt & " = '" & Valor & "'").ToString.ToEntero + CvePS = GlobalDTPS(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePS", String.Format("{0}= '{1}'", Opt, Valor.Replace("'", ""))).ToString.ToEntero If CvePS > 0 Then StrReturn = "True|" & CvePS.ToString From 495323bf2ec893c9d6607828d035d20312d637e4 Mon Sep 17 00:00:00 2001 From: rrene Date: Tue, 20 Jul 2021 12:54:40 -0700 Subject: [PATCH 12/14] - columnas de %Neto e $ Neto --- Ventas/RepVentasUtilidad.aspx | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/Ventas/RepVentasUtilidad.aspx b/Ventas/RepVentasUtilidad.aspx index 755ce2a34..ce157c38a 100644 --- a/Ventas/RepVentasUtilidad.aspx +++ b/Ventas/RepVentasUtilidad.aspx @@ -231,9 +231,9 @@
- - - + + +
VentaCostoUtilidad/PérdidaVentaCostoUtilidad/Pérdida
@@ -262,6 +262,16 @@ + + + + + + + + + + @@ -269,7 +279,7 @@ - + @@ -281,7 +291,7 @@ - + From cde33e42583ced9fefd52eccd7308500af75ed22 Mon Sep 17 00:00:00 2001 From: rrene Date: Tue, 20 Jul 2021 14:08:22 -0700 Subject: [PATCH 13/14] =?UTF-8?q?al=20refacturar=20d=C3=B3lares,=20que=20r?= =?UTF-8?q?ecalcule=20el=20TC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ventas/Ventas.aspx.vb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index efc318b5f..579b5afba 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -2452,9 +2452,12 @@ Partial Class Ventas ObjInv.Dispose() End If - + 'regenrea el tipo de cambio CargaNuevaFactura(Nothing) + CambiaMoneda() + + 'NOTA DE CREDITO If NuevaFactura = 2 Then From 8b1b610ee71079104500b7c3768fd6b5a067c7b7 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Tue, 20 Jul 2021 14:44:48 -0700 Subject: [PATCH 14/14] correccion exit sub --- Compras/Compras.aspx.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 1b4e83ad2..0ef56395a 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -4359,7 +4359,7 @@ Partial Class Compras_Compras If Not AjustaCombustibles() Then Exit Sub End If - Exit Sub + '------------------TERMINA VALIDACIONES------------------