From f2a4f5f9d1d75cf60bef5ee3b38c62f6a2d0706a Mon Sep 17 00:00:00 2001 From: rrene Date: Sat, 24 Jul 2021 11:51:23 -0700 Subject: [PATCH 01/10] parametro de empresa y grupo, en contratos detalle --- App_Code/ClsContratos.vb | 4 +++- Contratos/Contrato.aspx.vb | 2 +- Contratos/Contrato.vb | 2 +- Contratos/ContratoObra.aspx.vb | 2 +- Contratos/FacturacionMasiva.aspx.vb | 2 +- GPS/FacturacionMasiva.aspx.vb | 2 +- Inventarios/TrasladoSolicitud.aspx.vb | 4 ++-- OC/OC.aspx.vb | 6 +++--- 8 files changed, 13 insertions(+), 11 deletions(-) diff --git a/App_Code/ClsContratos.vb b/App_Code/ClsContratos.vb index c867464e4..7c27793f3 100644 --- a/App_Code/ClsContratos.vb +++ b/App_Code/ClsContratos.vb @@ -1084,12 +1084,14 @@ Public Class ClsContratos End Function - Public Function GetContratosDetalle(CveContrato As Integer) As Boolean + Public Function GetContratosDetalle(CveContrato As Integer, CveEmpresa As Integer, Optional Grupo As Integer = 1) As Boolean Dim Retorno = False DataAdapter("PA_Con_ContratosDetalleGet") With SqlAdapter.SelectCommand.Parameters .Add("@CveContrato", SqlDbType.Int).Value = CveContrato + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Grupo", SqlDbType.Int).Value = Grupo End With Try diff --git a/Contratos/Contrato.aspx.vb b/Contratos/Contrato.aspx.vb index b5bcf8cf4..31f16c46a 100644 --- a/Contratos/Contrato.aspx.vb +++ b/Contratos/Contrato.aspx.vb @@ -1182,7 +1182,7 @@ Partial Class Contratos_Default If TipoContrato = 4 Then TabPI.Visible = True End If - If ObjContratos.GetContratosDetalle(CveContrato) Then + If ObjContratos.GetContratosDetalle(CveContrato, UsuarioActual.CveEmpresa) Then TmpDT = ObjContratos.DtResultados If TmpDT.MAX("Cantidad_Original").ToString.ToEntero > 0 OrElse TmpDT.MAX("PU_Original").ToString.ToEntero > 0 Then BtnAutorizar.Visible = False diff --git a/Contratos/Contrato.vb b/Contratos/Contrato.vb index 546200e3f..7972d98d8 100644 --- a/Contratos/Contrato.vb +++ b/Contratos/Contrato.vb @@ -529,7 +529,7 @@ Partial Class Contratos_Default If TipoContrato = 4 Then TabPI.Visible = True End If - If ObjContratos.GetContratosDetalle(CveContrato) Then + If ObjContratos.GetContratosDetalle(CveContrato, UsuarioActual.CveEmpresa) Then TmpDT = ObjContratos.DtResultados If TmpDT.MAX("Cantidad_Original").ToString.ToEntero > 0 OrElse TmpDT.MAX("PU_Original").ToString.ToEntero > 0 Then BtnAutorizar.Visible = False diff --git a/Contratos/ContratoObra.aspx.vb b/Contratos/ContratoObra.aspx.vb index 8d67cbbde..368397521 100644 --- a/Contratos/ContratoObra.aspx.vb +++ b/Contratos/ContratoObra.aspx.vb @@ -902,7 +902,7 @@ Partial Class Contratos_ContratoObra If TipoContrato = 4 Then TabPI.Visible = True End If - If ObjContratos.GetContratosDetalle(CveContrato) Then + If ObjContratos.GetContratosDetalle(CveContrato, UsuarioActual.CveEmpresa) Then TmpDT = ObjContratos.DtResultados If TmpDT.MAX("Cantidad_Original").ToString.ToEntero > 0 OrElse TmpDT.MAX("PU_Original").ToString.ToEntero > 0 Then BtnAutorizar.Visible = False diff --git a/Contratos/FacturacionMasiva.aspx.vb b/Contratos/FacturacionMasiva.aspx.vb index e7f136f5d..01c6fc60e 100644 --- a/Contratos/FacturacionMasiva.aspx.vb +++ b/Contratos/FacturacionMasiva.aspx.vb @@ -467,7 +467,7 @@ Partial Class Contratos_FacturacionMasiva SubProyecto = DR("SubProyectoContrato").ToString Dim objContratos As New ClsContratos - If objContratos.GetContratosDetalle(DR("CveContrato").ToString.ToEntero) Then + If objContratos.GetContratosDetalle(DR("CveContrato").ToString.ToEntero, UsuarioActual.CveEmpresa) Then DTDetalle = objContratos.DtResultados.FiltraParametros("CveTipoPresupuesto=2") Else DTDetalle = Nothing diff --git a/GPS/FacturacionMasiva.aspx.vb b/GPS/FacturacionMasiva.aspx.vb index c5ac0022e..5fcd2b16c 100644 --- a/GPS/FacturacionMasiva.aspx.vb +++ b/GPS/FacturacionMasiva.aspx.vb @@ -548,7 +548,7 @@ Partial Class Contratos_FacturacionMasiva End If ObjFolios.Dispose() - If objContratos.GetContratosDetalle(DR("CveContrato").ToString.ToEntero) Then + If objContratos.GetContratosDetalle(DR("CveContrato").ToString.ToEntero, UsuarioActual.CveEmpresa) Then DTDetalle = objContratos.DtResultados Else DTDetalle = Nothing diff --git a/Inventarios/TrasladoSolicitud.aspx.vb b/Inventarios/TrasladoSolicitud.aspx.vb index 3fd260b3e..2fb44a88f 100644 --- a/Inventarios/TrasladoSolicitud.aspx.vb +++ b/Inventarios/TrasladoSolicitud.aspx.vb @@ -547,7 +547,7 @@ Partial Class Inventarios_TrasladoSolicitud End Sub Private Sub DdlContratos_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlContratos.SelectedIndexChanged Dim ObjContratos As New ClsContratos - If ObjContratos.GetContratosDetalle(DdlContratos.SelectedValue.ToEntero) Then + If ObjContratos.GetContratosDetalle(DdlContratos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then GvContratos.DataSource = ObjContratos.DtResultados GvContratos.DataBind() If ObjContratos.DtResultados.Rows.Count > 0 Then @@ -974,7 +974,7 @@ Partial Class Inventarios_TrasladoSolicitud Dim DTContratosTemporal As New DataTable Dim ObjContratos As New ClsContratos - If ObjContratos.GetContratosDetalle(DdlContratos.SelectedValue.ToEntero) Then + If ObjContratos.GetContratosDetalle(DdlContratos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then DTContratosTemporal = ObjContratos.DtResultados End If ObjContratos.Dispose() diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb index a52d631e0..d27decf12 100644 --- a/OC/OC.aspx.vb +++ b/OC/OC.aspx.vb @@ -2101,7 +2101,7 @@ Partial Class OC Dim dttemp As DataTable = Nothing 'GlobalDTContratos(UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveSubProyecto = {0}", DdlSubProyecto.SelectedValue.ToString)) If dttemp IsNot Nothing AndAlso dttemp.Rows.Count > 0 Then Dim drContrato As DataRow = dttemp.Rows(0) - If ObjContratos.GetContratosDetalle(drContrato("CveContrato").ToString.ToEntero) Then + If ObjContratos.GetContratosDetalle(drContrato("CveContrato").ToString.ToEntero, UsuarioActual.CveEmpresa) Then Dim dtContratodetalle As DataTable = ObjContratos.DtResultados.FiltraParametros(String.Format("CvePS = {0}", DdlP2.SelectedValue.ToString)) If dtContratodetalle IsNot Nothing AndAlso dtContratodetalle.Rows.Count > 0 Then Dim drContratoDetalle As DataRow = dtContratodetalle(0) @@ -7449,7 +7449,7 @@ Partial Class OC Private Sub CargaContratos() Dim ObjContratos As New ClsContratos - If ObjContratos.GetContratosDetalle(DdlContratos.SelectedValue.ToEntero) Then + If ObjContratos.GetContratosDetalle(DdlContratos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then GvContratos.DataSource = ObjContratos.DtResultados End If ObjContratos.Dispose() @@ -7479,7 +7479,7 @@ Partial Class OC Private Sub DdlContratos_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlContratos.SelectedIndexChanged Dim ObjContratos As New ClsContratos - If ObjContratos.GetContratosDetalle(DdlContratos.SelectedValue.ToEntero) Then + If ObjContratos.GetContratosDetalle(DdlContratos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then GvContratos.DataSource = ObjContratos.DtResultados GvContratos.DataBind() End If From f9abc091bac305617fc7db62d247fafa8d9888b6 Mon Sep 17 00:00:00 2001 From: rrene Date: Sun, 25 Jul 2021 17:39:43 -0700 Subject: [PATCH 02/10] -- cambio en liga de diferncias --- Inventarios/InventarioFisico.aspx | 7 +++++-- Inventarios/InventarioFisico.aspx.vb | 4 ++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Inventarios/InventarioFisico.aspx b/Inventarios/InventarioFisico.aspx index 0c82738ba..42c3a4559 100644 --- a/Inventarios/InventarioFisico.aspx +++ b/Inventarios/InventarioFisico.aspx @@ -89,8 +89,11 @@ - + + + + + diff --git a/Inventarios/InventarioFisico.aspx.vb b/Inventarios/InventarioFisico.aspx.vb index 619d2ea0d..22808380d 100644 --- a/Inventarios/InventarioFisico.aspx.vb +++ b/Inventarios/InventarioFisico.aspx.vb @@ -626,6 +626,10 @@ Partial Class Inventarios_InventarioFisico If e.Row.DBCampo("CveEstatus") = "3" Then e.Row.FCLinkButton("imgE").Visible = False e.Row.FCLinkButton("imgD").Visible = False + ElseIf e.Row.DBCampo("CveEstatus") = "1" Then ' cuando es en proceso + e.Row.FCHyperLink("HplDif").NavigateUrl = String.Format("/Inventarios/RepAnomalias.aspx?CveInventarioFisico={0}&EsAvance=1", e.Row.DBCampo("CveInventarioFisico")) + ElseIf e.Row.DBCampo("CveEstatus") = "0" Then ' Nuevo + e.Row.FCHyperLink("HplDif").Visible = False End If End If From 81a730ae55d125cc876b82c6cccb28e77aaf8af4 Mon Sep 17 00:00:00 2001 From: rrene Date: Mon, 26 Jul 2021 14:44:05 -0700 Subject: [PATCH 03/10] -- lbl de cantidad, dentro del UPPanel --- Inventarios/RepAnomalias.aspx | 58 ++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/Inventarios/RepAnomalias.aspx b/Inventarios/RepAnomalias.aspx index ef815c938..1b930ed61 100644 --- a/Inventarios/RepAnomalias.aspx +++ b/Inventarios/RepAnomalias.aspx @@ -207,22 +207,23 @@
-
-
- -
-
- Número de registros: -
-
- " style="display: inline-block; margin-right: -20px; width: 150px;" /> - " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> -
-
-
-
+ +
+
+ +
+
+ Número de registros: +
+
+ " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
+
+
+
@@ -256,22 +257,23 @@

-
-
- -
-
- Número de registros: -
-
- " style="display: inline-block; margin-right: -20px; width: 150px;" /> - " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> -
-
-
-
+ +
+
+ +
+
+ Número de registros: +
+
+ " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
+
+
+
From 5b0ebc5eb00b8bbf335c0d5c01086d0ae47de8a6 Mon Sep 17 00:00:00 2001 From: rrene Date: Mon, 26 Jul 2021 15:08:40 -0700 Subject: [PATCH 04/10] Globales --- App_Code/ClsContabilidad.vb | 65 +++++++++++++++++ Contabilidad2/CatCuentasAsignaciones.aspx | 73 +++++++++++++++++++- Contabilidad2/CatCuentasAsignaciones.aspx.vb | 52 +++++++++++++- 3 files changed, 188 insertions(+), 2 deletions(-) diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index 4556220f6..fbf0a6182 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -5852,6 +5852,71 @@ Public Class ClsContabilidad Return Retorno End Function +#Region "Globales" + Public Function GetCuentasGlobales(CveEmpresa As Integer) As Boolean + Dim Retorno = False + + DataAdapter("PA_Conta_CuentasGlobalesGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + Me.OnError("Ocurrió un error al obtener el catálogo de cuentas globales", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddCuentasGlobales(CveConceptoContable As Integer, CveCuenta As Integer, TipoGlobal As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno = False + + DataAdapter("PA_Conta_CuentasGlobalesAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveConceptoContable", SqlDbType.Int).Value = CveConceptoContable + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta + .Add("@TipoGlobal", SqlDbType.Int).Value = TipoGlobal + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar el catálogo de cuentas asignación", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function RemoveCuentasGlobales(CveConceptoContable As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno = False + + DataAdapter("PA_Conta_CuentasGlobalesDelete") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveConceptoContable", SqlDbType.Int).Value = CveConceptoContable + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar el catálogo de globales", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + +#End Region + Public Function GetContaEjercicio(CveEmpresa As Integer) As Boolean Dim Retorno = False diff --git a/Contabilidad2/CatCuentasAsignaciones.aspx b/Contabilidad2/CatCuentasAsignaciones.aspx index e518412a9..ea32e31b3 100644 --- a/Contabilidad2/CatCuentasAsignaciones.aspx +++ b/Contabilidad2/CatCuentasAsignaciones.aspx @@ -14,7 +14,10 @@
  • - + +
  • +
  • +
  • @@ -86,6 +89,27 @@
    +
    + + + + + + + + + + + + + + + + + + @@ -171,6 +195,53 @@ + + + + + + + diff --git a/Contabilidad2/CatCuentasAsignaciones.aspx.vb b/Contabilidad2/CatCuentasAsignaciones.aspx.vb index 2dcb413aa..526852767 100644 --- a/Contabilidad2/CatCuentasAsignaciones.aspx.vb +++ b/Contabilidad2/CatCuentasAsignaciones.aspx.vb @@ -40,8 +40,14 @@ Partial Class Contabilidad2_CatCuentasAsignaciones If ObjConta.GetCuentasAsignacionesSistema(UsuarioActual.CveEmpresa, DdlTipo.SelectedValue.ToEntero, DdlOpcion.SelectedValue.ToEntero) Then GvDatos.DataSource = ObjConta.DtResultados End If + + If ObjConta.GetCuentasGlobales(UsuarioActual.CveEmpresa) Then + GvGlobal.DataSource = ObjConta.DtResultados + End If + ObjConta.Dispose() GvDatos.DataBind() + GvGlobal.DataBind() UpDatos.Update() End Sub @@ -53,10 +59,12 @@ Partial Class Contabilidad2_CatCuentasAsignaciones If ObjConta.GetConta_ConceptosContables() Then DdlCconceptosContables.DataSource = ObjConta.DtResultados + DdlConceptoGlobal.DataSource = ObjConta.DtResultados.FiltraParametros("EsCuentaUnica = false AND EsSistema = True AND EsGlobal = True") End If If ObjConta.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then DdlCuenta.DataSource = ObjConta.DtResultados + DdlCuentaGlobal.DataSource = ObjConta.DtResultados End If ObjConta.Dispose() DdlProveedor.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) @@ -79,7 +87,9 @@ Partial Class Contabilidad2_CatCuentasAsignaciones DdlCuentaBancaria.DataBind() DdlCconceptosContables.DataBind() + DdlConceptoGlobal.DataBind() DdlCuenta.DataBind() + DdlCuentaGlobal.DataBind() DdlProveedor.DataBind() 'DdlPersonal.DataBind() DdlClasificacion.DataBind() @@ -145,6 +155,11 @@ Partial Class Contabilidad2_CatCuentasAsignaciones End If End If + If Dr("AplicaImpuesto").ToString = "True" Then + divPorcentajeIVA.Visible = True + End If + + If Dr("AplicaClasificacion").ToString = "True" Then divClasificacion.Visible = True End If @@ -184,7 +199,24 @@ Partial Class Contabilidad2_CatCuentasAsignaciones ObjConta.Dispose() End Sub - Protected Sub BtnAgregarMotivoD_Click(sender As Object, e As EventArgs) Handles BtnAgregarMotivoD.Click + Protected Sub BtnAgregarGlobal_Click(sender As Object, e As EventArgs) Handles BtnAgregarGlobal.Click + + UppModalGlobal.Update() + RegistraScript("$('#ModalGlobal').modal();") + End Sub + + Protected Sub EliminarRowGlobal(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim ObjConta As New ClsContabilidad + If ObjConta.RemoveCuentasGlobales(GvRow.DataKey("CveConceptoContable").ToEntero, GvRow.DataKey("CveEmpresa").ToEntero) Then + Alert("se elimino correctamente") + End If + CargaDatosSistema() + UpDatos.Update() + ObjConta.Dispose() + End Sub + + Protected Sub BtnAgregarAsignacion_Click(sender As Object, e As EventArgs) Handles BtnAgregarAsignacion.Click LimpiarDatos() LbAgregar.Text = "Agregar" @@ -238,4 +270,22 @@ Partial Class Contabilidad2_CatCuentasAsignaciones CargaDatosSistema() UpDatos.Update() End Sub + + Protected Sub LBAgregaGlobal_Click(sender As Object, e As EventArgs) + + Dim ErrorString As String = "" + Dim ObjConta As New ClsContabilidad + If Not ObjConta.AddCuentasGlobales(DdlConceptoGlobal.SelectedValue.ToEntero, DdlCuentaGlobal.SelectedValue.ToEntero, DdlTipoGlobal.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then + ErrorString = "Error al agregar" + End If + ObjConta.Dispose() + + If ErrorString.Length > 0 Then + Alert(ErrorString) + Else + Alert("Agregado correctamente") + End If + CargaDatosSistema() + UpDatos.Update() + End Sub End Class From 4bb5d0537d1b4d63554bbb8747191bc84aad07ec Mon Sep 17 00:00:00 2001 From: rrene Date: Mon, 26 Jul 2021 15:09:16 -0700 Subject: [PATCH 05/10] Funcionalidad 545, para validar productos de contratos de obra --- Compras/Compras.aspx.vb | 140 ++++++++++++++++++---------------------- 1 file changed, 63 insertions(+), 77 deletions(-) diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 28a827454..f65919d08 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -4281,10 +4281,12 @@ Partial Class Compras_Compras Next If ErrorValidacion Then Exit Sub - Dim dtPSInvalidos As String = ValidarPSContrato(TmpDT.FiltraParametros("", "", {"CveSubProyecto", "CvePS", "Cantidad", "PU"})) - If dtPSInvalidos <> "" Then - Alert(dtPSInvalidos, TipoMensaje.MsgAdvertencia) - Exit Sub + If UsuarioActual.Empresa.Funcionalidad(545) = "1" Then + Dim dtPSInvalidos As String = ValidarPSContrato(TmpDT.FiltraParametros("", "", {"CveSubProyecto", "CvePS", "Cantidad", "PU"})) + If dtPSInvalidos <> "" Then + Alert(dtPSInvalidos, TipoMensaje.MsgAdvertencia) + Exit Sub + End If End If 'RECORRO LOS PRODUCTOS O SERVICIOS PARA REGISTRARLOS LOS QUE NO EXISTEN EN EL CATÁLOGO @@ -18106,25 +18108,31 @@ Partial Class Compras_Compras End If ActualizaTotales = True - Dim ObjContratos As New ClsContratos - Dim TieneError As Boolean = False - Dim dttemp As New DataTable ' GlobalDTContratos().FiltraParametros(String.Format("CveSubProyecto = {0}", DdlSubProyecto.SelectedValue.ToString)) - dttemp.Columns.Add("CveSubProyecto", GetType(Integer)) - dttemp.Columns.Add("CvePS", GetType(Integer)) - dttemp.Columns.Add("Cantidad", GetType(Decimal)) - dttemp.Columns.Add("PU", GetType(Decimal)) - Dim DrPS = dttemp.NewRow - DrPS("CveSubProyecto") = DdlSubProyecto.SelectedValue.ToString.ToEntero - DrPS("CvePS") = DdlPS.SelectedValue.ToString.ToEntero - DrPS("Cantidad") = TxtCantidad.Text.Trim.ToDecimal - DrPS("PU") = TxtPrecio.Text.Trim.ToDecimal - dttemp.Rows.Add(DrPS) + If UsuarioActual.Empresa.Funcionalidad(545) = "1" Then + Dim TieneError As Boolean = False + Dim dttemp As New DataTable '= GlobalDTContratos().FiltraParametros(String.Format("CveSubProyecto = {0}", DdlSubProyecto.SelectedValue.ToString)) + dttemp.Columns.Add("CveSubProyecto", GetType(Integer)) + dttemp.Columns.Add("CvePS", GetType(Integer)) + dttemp.Columns.Add("Cantidad", GetType(Decimal)) + dttemp.Columns.Add("PU", GetType(Decimal)) - Dim dtPSInvalidos As String = ValidarPSContrato(dttemp) - If dtPSInvalidos <> "" Then - TieneError = True + Dim DrPS = dttemp.NewRow + DrPS("CveSubProyecto") = DdlSubProyecto.SelectedValue.ToString.ToEntero + DrPS("CvePS") = DdlPS.SelectedValue.ToString.ToEntero + DrPS("Cantidad") = TxtCantidad.Text.Trim.ToDecimal + DrPS("PU") = TxtPrecio.Text.Trim.ToDecimal + dttemp.Rows.Add(DrPS) + + Dim dtPSInvalidos As String = ValidarPSContrato(dttemp) + If dtPSInvalidos <> "" Then + TieneError = True + Alert(dtPSInvalidos, TipoMensaje.MsgAdvertencia) + Exit Sub + End If End If + + 'If dttemp IsNot Nothing AndAlso dttemp.Rows.Count > 0 Then ' Dim drContrato As DataRow = dttemp.Rows(0) ' If ObjContratos.GetContratosDetalle(drContrato("CveContrato").ToString.ToEntero) Then @@ -18157,75 +18165,52 @@ Partial Class Compras_Compras ' End If 'End If - ObjContratos.Dispose() - If Not TieneError Then - Select Case Modalidad - Case "A" 'ADD - Dim SATClavePS = -1 - Dim PSRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPS.SelectedValue.ToEntero).FiltroPrimero("") - If PSRow IsNot Nothing Then - SATClavePS = PSRow("SATClavePS").ToString.ToEntero - End If - Dim IVA As Double - If chkImportacion.Checked Then - IVA = (txtImportacion.Text.Trim.ToDouble / (TxtCantidad.Text.Trim.ToDouble * TxtPrecio.Text.Trim.ToDouble)) - Else - IVA = Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2) - End If - AddPS(TxtCantidad.Text.Trim.ToDouble, ddlUM.SelectedValue.ToEntero, ddlUM.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text, DdlPS.SelectedValue.ToEntero, DdlPS.SelectedText, HdnTipoPS.Value.ToEntero, + + + Select Case Modalidad + Case "A" 'ADD + + Dim SATClavePS = -1 + Dim PSRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPS.SelectedValue.ToEntero).FiltroPrimero("") + If PSRow IsNot Nothing Then + SATClavePS = PSRow("SATClavePS").ToString.ToEntero + End If + Dim IVA As Double + If chkImportacion.Checked Then + IVA = (txtImportacion.Text.Trim.ToDouble / (TxtCantidad.Text.Trim.ToDouble * TxtPrecio.Text.Trim.ToDouble)) + Else + IVA = Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2) + End If + AddPS(TxtCantidad.Text.Trim.ToDouble, ddlUM.SelectedValue.ToEntero, ddlUM.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text, DdlPS.SelectedValue.ToEntero, DdlPS.SelectedText, HdnTipoPS.Value.ToEntero, DdlSubProyecto.SelectedValue.ToString, DdlSubProyecto.SelectedItem.Text, DdlProyecto.SelectedItem.Text, DdlProyecto.SelectedValue.ToString, TxtObsPS.Text.Trim, TxtPrecio.Text.Trim.ToDouble, Total, IVA, TxtRetIVAModal.Text.ToDouble / 100, TxtRetISRModal.Text.ToDouble / 100, TxtIEPSModal.Text.ToDouble / 100, 0, TxtDescuentoModal.Text.ToDouble, OtrosGastos:=TxtOtrosGastos.Text.ToDouble, CveTipoGasto:=DdlTipoGasto.SelectedValue.ToEntero, TipoGasto:=DdlTipoGasto.SelectedItem.Text, NoDeducible:=ChkEsNoDeduciblePS.Checked, CveSATPS:=SATClavePS) - AddPS2() - LimpiaAgregar() + AddPS2() + LimpiaAgregar() - If ChkAgregar.Checked = True And Modalidad = "A" Then - RegistraScript("displayToastr(1);", "display") - Else - RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddProducto")) - End If - - Case "U" 'UPDATE - UpdatePS() - Alert("Concepto actualizado Correctamente.", TipoMensaje.MsgInformacion) - RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddProducto")) - End Select - ActualizaTotales = False - - If UsuarioActual.Empresa.Funcionalidad(562).ToEntero > 0 Then CargaGastosServicios(UsuarioActual.Empresa.Funcionalidad(562).ToEntero) - - If UsuarioActual.Empresa.UsaAC Then - CompruebaAgregar() - GuardaAC() - End If + If ChkAgregar.Checked = True And Modalidad = "A" Then + RegistraScript("displayToastr(1);", "display") Else - Alert(dtPSInvalidos, TipoMensaje.MsgAdvertencia) + RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddProducto")) End If + Case "U" 'UPDATE + UpdatePS() + Alert("Concepto actualizado Correctamente.", TipoMensaje.MsgInformacion) + RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddProducto")) + End Select + ActualizaTotales = False - 'If UsuarioActual.Empresa.Funcionalidad(577).ToString = "1" Then + If UsuarioActual.Empresa.Funcionalidad(562).ToEntero > 0 Then CargaGastosServicios(UsuarioActual.Empresa.Funcionalidad(562).ToEntero) - ' 'If UsuarioActual.CveRol = 1 Then - ' ' Alert($"Ok funcionalidad 577 RetencionIVA { RetencionIVA} IVAOriginal {IVAOriginal}") - ' 'End If + If UsuarioActual.Empresa.UsaAC Then + CompruebaAgregar() + GuardaAC() + End If - ' If RetencionIVA = 0 And IVAOriginal > 0 Then - ' For Each dRow As DataRow In TmpDT.Rows - ' If dRow("CveTipoPS").ToString.ToEntero = 1 Then - ' 'Comnetado para reubicar el boton - ' 'tdIVA6.Visible = True - ' Exit For - ' End If - ' Next - ' End If - - 'End If - - - - UpPS.Update() + UpPS.Update() CargaGvPersonal() End Sub ''' @@ -20938,6 +20923,7 @@ Partial Class Compras_Compras Next End If End If + objContratos.Dispose() If MensajeProducto.Length <> 64 Then Retorno = MensajeProducto From 325daa3d117600ccde1c6448513bcc06d2802107 Mon Sep 17 00:00:00 2001 From: rrene Date: Mon, 26 Jul 2021 15:09:37 -0700 Subject: [PATCH 06/10] parametro de contratosdetalle --- Ventas/Ventas.aspx.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 9b8ada6eb..8d26f91be 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -3359,7 +3359,7 @@ Partial Class Ventas Dim ObjContrato As New ClsContratos Dim NoId As Integer = 0 - If ObjContrato.GetContratosDetalle(DdlContratosModal.SelectedValue.ToEntero()) Then + If ObjContrato.GetContratosDetalle(DdlContratosModal.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa) Then 'SI ES CONTRATO DE CONSIGNACION DE VENTA AGARRA LAS EXISTENCIAS DEL ALMACEN CreaConsignacionSerieDetalle() From e2578fd836c34fa0869541490ccac9a2ad7c2fec Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Tue, 27 Jul 2021 16:13:16 -0700 Subject: [PATCH 07/10] Bonificaciones por productos al aplicar NC. pt2 --- Ventas/Ventas.aspx | 104 +++++++++++++- Ventas/Ventas.aspx.vb | 325 ++++++++++++++++++++++++++++++++---------- 2 files changed, 352 insertions(+), 77 deletions(-) diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index 02584370f..c54c6f784 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -6680,11 +6680,16 @@
    +
    +
    + +
    +
    " style="display: inline-block; margin-right: -20px; width: 150px;" /> " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info">
    -
    +
    @@ -6716,6 +6721,35 @@
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    @@ -7769,7 +7803,6 @@ } - function CalculaSaldoRNCChkDetalleBonificacion(TxtCantidad, CantidadPendiente, ImporteTotal, Chk) { //ImportesRNCCargo let Importe = 0; @@ -7836,6 +7869,73 @@ } + } + function CalculaSaldoRNCChkDetalleBon(TxtCantidad, CantidadPendiente, ImporteTotal, Chk) { + //ImportesRNCCargo + let Importe = 0; + if (Chk.checked) { + let SaldoMaximoUtilizable = ToDouble(HdnSMUBon.value); + let ImportesAsignados = 0; + + $('.ImportesRNCDetalleBonificacion').each(function () { + + if (Chk.id != $(this).find("td").eq(0).find(":checkbox").attr('id')) { + let seleccionado = $(this).find("td").eq(0).find(":checkbox").is(':checked'); + + if (seleccionado) { + let cantidad = ToDouble($(this).find("td").eq(1).find(":text").val()); + let porcentajeIVA = ToDouble($(this).find("td").eq(0).find(":hidden").val()); + let precio = ToDouble($(this).find("td").eq(5).find(":hidden").val()); + + let totalcalculableImpuestos = (cantidad * precio); + let iva = ToDouble((totalcalculableImpuestos * porcentajeIVA).toFixed(2)); + + ImportesAsignados += totalcalculableImpuestos + iva; + } + } + + }); + + Importe = SaldoMaximoUtilizable - ImportesAsignados; + + if (Importe > 0) { + + } else { + if (SaldoMaximoUtilizable > 0) { + Importe = 0; + Chk.checked = false; + } else { + Importe = 0; + } + } + + } else { + Importe = 0; + } + + Importe = ToDouble(Importe.toFixed(2)); + + if (Importe > 0) { + + let pu = (ImporteTotal / CantidadPendiente); + + if (pu > 0) { + const cantidadSugerida = (Importe / pu); + if (cantidadSugerida > CantidadPendiente) { + TxtCantidad.value = CantidadPendiente.toString(); + }else { + TxtCantidad.value = cantidadSugerida.toString(); + } + + }else { + TxtCantidad.value = "0"; + } + + }else { + TxtCantidad.value = "0"; + } + + } function LimitaSaldoRNCChk(TxtImporte, Saldo) { diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 04e5da7ab..39549059b 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -2150,7 +2150,7 @@ Partial Class Ventas DdlTipoComprobante.Items.Insert(DdlTipoComprobante.Items.Count, New ListItem("Autorización", "PA")) End If - If Not UsuarioActual.CveEmpresa.Contiene(141, 152, 159, 160, 161, 162, 163) Then + If Not UsuarioActual.Empresa.Funcionalidad(558) = "1" Then LnkAgregarCliente.Visible = False End If @@ -25124,6 +25124,18 @@ Partial Class Ventas End If UpModalRemisionesNC.Update() End Sub + Protected Sub ChkMostarProductosRNCBon_CheckedChanged(sender As Object, e As EventArgs) + If ChkMostarProductosRNCBon.Checked Then + DivRNCBonificaciones.Visible = False + DivRNCBonificacionesDetalle.Visible = True + CargaRNCDetalleBonificacion(DdlVentaUsado.SelectedValue.ToEntero()) + Else + DivRNCBonificaciones.Visible = True + DivRNCBonificacionesDetalle.Visible = False + RblRNCTipo_SelectedIndexChanged(RblRNCTipo, EventArgs.Empty) + End If + UpModalRemisionesNC.Update() + End Sub Protected Sub ChkMostarProductosRNCDesc_CheckedChanged(sender As Object, e As EventArgs) RblRNCTipoDesc_SelectedIndexChanged(RblRNCTipo, EventArgs.Empty) @@ -25336,7 +25348,63 @@ Partial Class Ventas UpDescNC.Update() End Sub + Private Sub CargaRNCDetalleBonificacion(Optional CveVentaUsado As Integer = -1) + 'Dim ObjMovtos As New ClsMovimientos() + 'If ObjMovtos.GetRemisionesNCCliente(CveCliente, True, CveMoneda:=-1, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero()) Then + ' Me.TmpDTRNCBonificacionDetalle = ObjMovtos.DtResultados.Copy() + 'End If + 'ObjMovtos.Dispose() + + 'Me.TmpDTRNCBonificacionDetalle.Columns.Add(New DataColumn("CveVentaDetalleNCGenerada", GetType(Integer))) + + 'Me.TmpDTRNCBonificacionDetalleSeleccionadas = Nothing + 'Me.TmpDTRNCBonificacionDetalleSeleccionadas = TmpDTRNCBonificacionDetalle.Clone() + 'Me.TmpDTRNCBonificacionDetalleSeleccionadas.Clear() + + 'GvRemisionesNCBonDetalle.DataSource = TmpDTRNCBonificacionDetalle.FiltraParametros("TipoRNC = 2") + 'GvRemisionesNCBonDetalle.DataBind() + + Dim ObjMovtos As New ClsMovimientos() + If ObjMovtos.GetRemisionesNCCliente(CveCliente, True, CveMoneda:=-1, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero()) Then + Me.TmpDTRNCDetalle = ObjMovtos.DtResultados.Copy() + End If + ObjMovtos.Dispose() + + Me.TmpDTRNCDetalle.Columns.Add(New DataColumn("CveVentaDetalleNCGenerada", GetType(Integer))) + + Me.TmpDTRNCDetalleSelecciondas = Nothing + Me.TmpDTRNCDetalleSelecciondas = TmpDTRNCDetalle.Clone() + Me.TmpDTRNCDetalleSelecciondas.Clear() + + GvRemisionesNCBonDetalle.DataSource = TmpDTRNCDetalle.FiltraParametros("TipoRNC = 2") + GvRemisionesNCBonDetalle.DataBind() + + Dim ObjAcum As New ClsAcumuladores + If ObjAcum.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) Then + Dim RowUsadosNC As DataRow = ObjAcum.DtResultados.Rows(5) + DivSMU.Visible = True + HdnSMUBon.Value = RowUsadosNC("ValorConImpuestos").ToString() + LtlSMUBon.Text = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal().FormatoNumero(2) + Else + 'DivSMU.Visible = False + HdnSMUBon.Value = "0" + LtlSMUBon.Text = "0" + End If + ObjAcum.Dispose() + + 'Dim SaldoMaximoUsados As Decimal = Me.TmpDT.SUM("Total", "EsCargo = True").ToDecimal() + Me.TmpDT.SUM("ImporteIVA", "EsCargo = True").ToDecimal() + + 'If SaldoMaximoUsados > 0 Then + ' HdnSaldoMaximoUsados.Value = SaldoMaximoUsados.ToString() + ' LblSaldoMaximoUsados.Text = String.Format("{0:N2}", SaldoMaximoUsados) + 'Else + ' HdnSaldoMaximoUsados.Value = "0" + ' LblSaldoMaximoUsados.Text = "0" + 'End If + + UpModalRemisionesNC.Update() + End Sub Private Sub CargaRNCDetalleDescBonificacion() Dim DtNC As DataTable = Nothing @@ -25372,74 +25440,95 @@ Partial Class Ventas If TmpDTRNCBonificacionesSeleccionadas Is Nothing Then TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Clone() End If + If ChkMostarProductosRNCBon.Checked Then + DivRNCBonificaciones.Visible = False + DivRNCBonificacionesDetalle.Visible = True - Dim ListaBon As New List(Of VentasBonificaciones) - Dim DtBon As DataTable = Nothing - Dim SbFiltro As New StringBuilder() - SbFiltro.Append("CveVenta IN(") - Using ObjAcum As New ClsAcumuladores - If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=CveVentaRNCCargo) Then - DtBon = ObjAcum.DtResultados.Copy() - End If - End Using - - If DtBon IsNot Nothing Then - Dim queryBonificacion = From dr In DtBon - Where dr("CveVentaBonificacion").ToString().ToEntero > 0 - Group By CveVentaBonificacion = dr("CveVentaBonificacion").ToString().ToEntero, CveVenta = dr("CveVenta").ToString().ToEntero - Into x = Group - Select New With { - .CveVentaRNCCargo = CveVenta, - .CveVentaBonificacion = CveVentaBonificacion, - .ImporteBonificacion = x.Sum(Function(s) s("ImporteBonificacion").ToString().ToDecimal), - .IVABonificacion = x.Sum(Function(s) s("IVABonificacion").ToString().ToDecimal) - } - - For Each bon In queryBonificacion - SbFiltro.AppendFormat("'{0}',", bon.CveVentaBonificacion) - ListaBon.Add(New VentasBonificaciones() With {.CveVentaRNCCargo = bon.CveVentaRNCCargo, .CveVentaBonificacion = bon.CveVentaBonificacion, .ImporteBonificacion = bon.ImporteBonificacion, .IVABonificacion = bon.IVABonificacion}) - Next - SbFiltro.Remove(SbFiltro.Length - 1, 1) - SbFiltro.Append(")") - End If - - If ListaBon.Count > 0 Then - Dim Bonificaciones = Me.TmpDTRNCBonificacionesCliente.Select(SbFiltro.ToString()) - - For Each RowBonificacion As DataRow In Bonificaciones - Dim RNCBonificacion = ListaBon.Where(Function(x) x.CveVentaBonificacion = RowBonificacion("CveVenta").ToString().ToEntero()) - - RowBonificacion("ImporteBonificacion") = RNCBonificacion.Sum(Function(x) x.ImporteBonificacion) - RowBonificacion("IVABonificacion") = RNCBonificacion.Sum(Function(x) x.IVABonificacion) - RowBonificacion("CveVentaRNCCargo") = CveVentaRNCCargo - - If AplicarRNC Then - TmpDTRNCBonificacionesSeleccionadas.Rows.Add(RowBonificacion.ItemArray) - Else - For Each RowEliminar In Me.TmpDTRNCBonificacionesSeleccionadas.Select(SbFiltro.ToString()) - RowEliminar.Delete() - Next - End If - Next - - End If - - 'VERIFICA SI TIENE BONIFICACIONES PARA AGREGARLAS - If TmpDTRNCBonificacionesSeleccionadas IsNot Nothing AndAlso TmpDTRNCBonificacionesSeleccionadas.Rows.Count > 0 Then - DivRNCBon.Visible = True + CargaRNCDetalleBonificacion() Else - DivRNCBon.Visible = False + DivRNCBonificaciones.Visible = True + DivRNCBonificacionesDetalle.Visible = False + + Dim ListaBon As New List(Of VentasBonificaciones) + Dim DtBon As DataTable = Nothing + Dim SbFiltro As New StringBuilder() + SbFiltro.Append("CveVenta IN(") + Using ObjAcum As New ClsAcumuladores + If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=CveVentaRNCCargo) Then + DtBon = ObjAcum.DtResultados.Copy() + End If + End Using + + If DtBon IsNot Nothing Then + Dim queryBonificacion = From dr In DtBon + Where dr("CveVentaBonificacion").ToString().ToEntero > 0 + Group By CveVentaBonificacion = dr("CveVentaBonificacion").ToString().ToEntero, CveVenta = dr("CveVenta").ToString().ToEntero + Into x = Group + Select New With { + .CveVentaRNCCargo = CveVenta, + .CveVentaBonificacion = CveVentaBonificacion, + .ImporteBonificacion = x.Sum(Function(s) s("ImporteBonificacion").ToString().ToDecimal), + .IVABonificacion = x.Sum(Function(s) s("IVABonificacion").ToString().ToDecimal) + } + + For Each bon In queryBonificacion + SbFiltro.AppendFormat("'{0}',", bon.CveVentaBonificacion) + ListaBon.Add(New VentasBonificaciones() With {.CveVentaRNCCargo = bon.CveVentaRNCCargo, .CveVentaBonificacion = bon.CveVentaBonificacion, .ImporteBonificacion = bon.ImporteBonificacion, .IVABonificacion = bon.IVABonificacion}) + Next + SbFiltro.Remove(SbFiltro.Length - 1, 1) + SbFiltro.Append(")") + End If + + If ListaBon.Count > 0 Then + Dim Bonificaciones = Me.TmpDTRNCBonificacionesCliente.Select(SbFiltro.ToString()) + + For Each RowBonificacion As DataRow In Bonificaciones + Dim RNCBonificacion = ListaBon.Where(Function(x) x.CveVentaBonificacion = RowBonificacion("CveVenta").ToString().ToEntero()) + + RowBonificacion("ImporteBonificacion") = RNCBonificacion.Sum(Function(x) x.ImporteBonificacion) + RowBonificacion("IVABonificacion") = RNCBonificacion.Sum(Function(x) x.IVABonificacion) + RowBonificacion("CveVentaRNCCargo") = CveVentaRNCCargo + + If AplicarRNC Then + TmpDTRNCBonificacionesSeleccionadas.Rows.Add(RowBonificacion.ItemArray) + Else + For Each RowEliminar In Me.TmpDTRNCBonificacionesSeleccionadas.Select(SbFiltro.ToString()) + RowEliminar.Delete() + Next + End If + Next + + End If + + 'VERIFICA SI TIENE BONIFICACIONES PARA AGREGARLAS + If TmpDTRNCBonificacionesSeleccionadas IsNot Nothing AndAlso TmpDTRNCBonificacionesSeleccionadas.Rows.Count > 0 Then + DivRNCBon.Visible = True + Else + DivRNCBon.Visible = False + End If + + GvRemisionesNCBon.DataSource = TmpDTRNCBonificacionesSeleccionadas + GvRemisionesNCBon.DataBind() + + 'Dim SMUBon As Decimal = Me.TmpDTRNCBonificacionesSeleccionadas.SUM("ImporteBonificacion").ToDecimal() + Me.TmpDTRNCBonificacionesSeleccionadas.SUM("IVABonificacion").ToDecimal() + + 'LtlSMUBon.Text = String.Format("{0:N2}", SMUBon) + 'HdnSMUBon.Value = SMUBon.ToString() + + Dim ObjAcum2 As New ClsAcumuladores + If ObjAcum2.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) Then + Dim RowUsadosNC As DataRow = ObjAcum2.DtResultados.Rows(5) + HdnSMUBon.Value = RowUsadosNC("ValorConImpuestos").ToString() + LtlSMUBon.Text = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal().FormatoNumero(2) + Else + HdnSMUBon.Value = "0" + LtlSMUBon.Text = "0" + End If + ObjAcum2.Dispose() + + UpModalRemisionesNC.Update() End If - GvRemisionesNCBon.DataSource = TmpDTRNCBonificacionesSeleccionadas - GvRemisionesNCBon.DataBind() - - Dim SMUBon As Decimal = Me.TmpDTRNCBonificacionesSeleccionadas.SUM("ImporteBonificacion").ToDecimal() + Me.TmpDTRNCBonificacionesSeleccionadas.SUM("IVABonificacion").ToDecimal() - - LtlSMUBon.Text = String.Format("{0:N2}", SMUBon) - HdnSMUBon.Value = SMUBon.ToString() - - UpModalRemisionesNC.Update() End Sub 'Protected Sub ChkAplicarRNC_CheckedChanged(sender As Object, e As EventArgs) @@ -25620,6 +25709,22 @@ Partial Class Ventas End If End If End Sub + + Protected Sub GvRemisionesNCBonDetalle_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvRemisionesNCBonDetalle.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + + If e.Row.DBCampo("CveVentaDetalleRNC").ToEntero() = 0 Then + e.Row.CssClass = "Totales" + e.Row.FCCheckBox("ChkAplicar").Visible = False + e.Row.FCTextBox("TxtCantidadRNC").Visible = False + Else + e.Row.CssClass = "ImportesRNCDetalle" + e.Row.FCCheckBox("ChkAplicar").Attributes.Add("onclick", $"CalculaSaldoRNCChkDetalleBon({e.Row.FCTextBox("TxtCantidadRNC").ClientID},{e.Row.DBCampo("CantidadPendiente").ToDouble},{e.Row.DBCampo("Total").ToDouble}, this);") + 'e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"LimitaSaldoRNCChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble});") + + End If + End If + End Sub Protected Sub GvRNCDevoluciones_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvRNCDevoluciones.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then e.Row.FCCheckBox("ChkAplicar").Attributes.Add("onclick", $"CalculaSaldoRNCBonChkDesc({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);") @@ -30034,7 +30139,8 @@ Partial Class Ventas NCConcepto = ArrayNC(1).ToEntero() End Select - If ChkMostarProductosRNC.Checked Then + 'CARGOS/AJUSTES POR GARANTIA POR PRODUCTO + If RblRNCTipo.SelectedValue.Contiene("1", "3") AndAlso ChkMostarProductosRNC.Checked Then Dim TotalAcumulado As Decimal = 0 Me.AplicaRNCXDetalle = True @@ -30102,8 +30208,8 @@ Partial Class Ventas Exit For End If Next - - Else + 'CARGOS/AJUSTES POR GARANTIA POR TOTAL + ElseIf RblRNCTipo.SelectedValue.Contiene("1", "3") AndAlso Not ChkMostarProductosRNC.Checked Then For Each GvRow As GridViewRow In GvRemisionesNC.Rows If GvRow.RowType = DataControlRowType.DataRow Then @@ -30153,7 +30259,77 @@ Partial Class Ventas Else DdlNCPS.Enabled = True End If + 'BONIFICACIONES POR PRODUCTO + ElseIf RblRNCTipo.SelectedValue.Contiene("2") AndAlso ChkMostarProductosRNCBon.Checked Then + Dim TotalAcumulado As Decimal = 0 + Me.AplicaRNCXDetalle = True + For Each GvRow As GridViewRow In GvRemisionesNCBonDetalle.Rows + If GvRow.RowType = DataControlRowType.DataRow Then + If GvRow.FCCheckBox("ChkAplicar").Checked Then + Dim Rows = TmpDTRNCDetalle.Select($"CveVentaDetalleRNC = {GvRow.DataKey("CveVentaDetalleRNC").ToEntero()}") + For Each row In Rows + row("Cantidad") = GvRow.FCTextBox("TxtCantidadRNC").Text.ToDecimal() + TmpDTRNCDetalleSelecciondas.Rows.Add(row.ItemArray) + Next + End If + End If + Next + Dim TerminarCiclo As Boolean = False + + For Each Dr As DataRow In TmpDTRNCDetalleSelecciondas.FiltraParametros("", DistinctColumns:={"CveVenta"}).Rows + Dim RemNC As New Modelos.Factura(UsuarioActual, Dr("CveVenta").ToString().ToEntero(), UsuarioActual.CveEmpresa) + + Dim TotalRNC As Decimal = 0 + For Each GvRow As GridViewRow In GvRemisionesNCBonDetalle.Rows + If GvRow.RowType = DataControlRowType.DataRow Then + + If GvRow.FCCheckBox("ChkAplicar").Checked AndAlso GvRow.DataKey("CveVenta").ToEntero() = Dr("CveVenta").ToString().ToEntero() Then + + Dim Cantidad As Decimal = GvRow.FCTextBox("TxtCantidadRNC").Text.ToDecimal() + Dim PU = GvRow.DataKey("PU").ToDecimal() + Dim PorcentajeIVA As Decimal = GvRow.DataKey("PorcentajeIVA").ToDecimal() + + Dim TotalCalculableImpuestos As Decimal = (Cantidad * PU) + Dim ImporteIVA As Decimal = (TotalCalculableImpuestos * PorcentajeIVA).RoundSQL(2) + + Dim TotalRNCDetalle As Decimal = (TotalCalculableImpuestos + ImporteIVA) + + TotalRNC += TotalRNCDetalle + + + End If + + End If + Next + TotalAcumulado += TotalRNC + + 'SI SE EXECE RESTA AL ULTIMO + If TotalAcumulado > LtlSMUBon.Text.ToDecimal() Then + TerminarCiclo = True + TotalAcumulado -= TotalRNC + TotalRNC = LtlSMUBon.Text.ToDecimal() - TotalAcumulado + End If + + RemNC.TotalRemNCAplicado = TotalRNC + 'MARCA LA VENTA QUE FUE USADA PARA EL FILTRO + RemNC.Num3 = DdlVentaUsado.SelectedValue.ToEntero() + TotalRemNCAplicado += RemNC.TotalRemNCAplicado + + If RemNC.TotalRemNCAplicado <= 0 Then + Alert($"Debe asignar un importe en la siguiente remisión: {RemNC.SerieFolio}", TipoMensaje.MsgAdvertencia) + ListaRemisionesNC.Clear() + Exit Sub + End If + + ListaRemisionesNC.Add(RemNC) + + If TerminarCiclo Then + Exit For + End If + Next + 'BONIFICACIONES POR TOTAL + ElseIf RblRNCTipo.SelectedValue.Contiene("2") AndAlso Not ChkMostarProductosRNCBon.Checked Then For Each GvRow As GridViewRow In GvRemisionesNCBon.Rows If GvRow.RowType = DataControlRowType.DataRow Then If GvRow.FCCheckBox("ChkAplicar").Checked Then @@ -30164,21 +30340,20 @@ Partial Class Ventas If RemNC.TotalRemNCAplicado <= 0 Then Alert($"Debe asignar un importe en la siguiente remisión: {RemNC.SerieFolio}", TipoMensaje.MsgAdvertencia) - ListaNCBonificacion.Clear() + ListaRemisionesNC.Clear() Exit Sub End If - ListaNCBonificacion.Add(RemNC) + ListaRemisionesNC.Add(RemNC) End If End If Next 'SI SON SOLO BONIFICACIONES GENERA LA NC PRINCIPAL EN BASE A ESAS - If RblRNCTipo.SelectedValue.ToString() = "2" AndAlso ListaRemisionesNC.Count = 0 Then - ListaRemisionesNC.AddRange(ListaNCBonificacion) - ListaNCBonificacion.Clear() - End If - + 'If RblRNCTipo.SelectedValue.ToString() = "2" AndAlso ListaRemisionesNC.Count = 0 Then + ' ListaRemisionesNC.AddRange(ListaNCBonificacion) + ' ListaNCBonificacion.Clear() + 'End If End If Dim DrPSSeleccionado As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=NCConcepto).FiltroPrimero("") From 71d8953cf75d2236a898e588f274249086add6e7 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Tue, 27 Jul 2021 16:28:42 -0700 Subject: [PATCH 08/10] Descuento definido por el porcentaje maximo autorizado --- Ventas/PV.aspx | 22 ++++++++++++ Ventas/PV.aspx.vb | 85 ++++++++++++++++++++++++----------------------- 2 files changed, 65 insertions(+), 42 deletions(-) diff --git a/Ventas/PV.aspx b/Ventas/PV.aspx index fc06bd5a1..a36f25ad3 100644 --- a/Ventas/PV.aspx +++ b/Ventas/PV.aspx @@ -1571,6 +1571,7 @@