From f483ac93a059cdbfe6c57972cbc245be0e88ffd6 Mon Sep 17 00:00:00 2001 From: Rene Molina Date: Thu, 9 Jan 2020 11:26:14 -0700 Subject: [PATCH] -clasif, recarga Global --- Ventas/CatClasificaciones.aspx.vb | 28 +++++++++++----------- Ventas/Ventas.aspx.vb | 40 +++++++++++++++++++++---------- 2 files changed, 41 insertions(+), 27 deletions(-) diff --git a/Ventas/CatClasificaciones.aspx.vb b/Ventas/CatClasificaciones.aspx.vb index 1714fc630..d23b8bc90 100644 --- a/Ventas/CatClasificaciones.aspx.vb +++ b/Ventas/CatClasificaciones.aspx.vb @@ -89,7 +89,6 @@ Partial Class CatClasificaciones CargaDdlSATPS() CargaDDLs() - CargaGlobal() DdlCategoriaFiltro.DataSource = GlobalDTGralCategorias(UsuarioActual.CveEmpresa) DdlCategoriaFiltro.Items.Insert(0, New ListItem("Todos", "-1")) @@ -152,20 +151,20 @@ Partial Class CatClasificaciones CargaGrid() End Sub - Public Sub CargaGlobal() + 'Public Sub CargaGlobal() - Dim ObjClasificaciones As New ClsClasificaciones + ' Dim ObjClasificaciones As New ClsClasificaciones - If ObjClasificaciones.GetClasificaciones() Then - ViewState("DTClasificaciones") = ObjClasificaciones.DtResultados.FiltraParametros($"(Codigo IS NULL OR Codigo = '') AND CveEmpresa = {UsuarioActual.CveEmpresa} AND (CveCategoria = {DdlCategoriaFiltro.SelectedValue.ToEntero} OR {DdlCategoriaFiltro.SelectedValue.ToEntero} = -1) AND (UsoClasificacion = {DdlTipoClasificacion.SelectedValue.ToEntero} OR {DdlTipoClasificacion.SelectedValue.ToEntero} = -1 ) AND (Estado = {DdlEstatus.SelectedValue.ToEntero} OR {DdlEstatus.SelectedValue.ToEntero} = -1)") - GlobalDTClasificaciones = ObjClasificaciones.DtResultados - Else - Me.GvDatos.DataSource = Nothing - Alert("Ocurrió un error al cargar las clasificaciones. Por favor vuelva a intentar.", TipoMensaje.MsgError) - End If + ' If ObjClasificaciones.GetClasificaciones(UsuarioActual.CveEmpresa) Then + ' ViewState("DTClasificaciones") = ObjClasificaciones.DtResultados.FiltraParametros($"(Codigo IS NULL OR Codigo = '') AND CveEmpresa = {UsuarioActual.CveEmpresa} AND (CveCategoria = {DdlCategoriaFiltro.SelectedValue.ToEntero} OR {DdlCategoriaFiltro.SelectedValue.ToEntero} = -1) AND (UsoClasificacion = {DdlTipoClasificacion.SelectedValue.ToEntero} OR {DdlTipoClasificacion.SelectedValue.ToEntero} = -1 ) AND (Estado = {DdlEstatus.SelectedValue.ToEntero} OR {DdlEstatus.SelectedValue.ToEntero} = -1)") + ' GlobalDTClasificaciones(UsuarioActual.CveEmpresa) = Nothing + ' Else + ' Me.GvDatos.DataSource = Nothing + ' Alert("Ocurrió un error al cargar las clasificaciones. Por favor vuelva a intentar.", TipoMensaje.MsgError) + ' End If - ObjClasificaciones.Dispose() - End Sub + ' ObjClasificaciones.Dispose() + 'End Sub Protected Sub LbAgregar_Click(sender As Object, e As System.EventArgs) Handles LbAgregar.Click @@ -212,7 +211,7 @@ Partial Class CatClasificaciones End If End If - CargaGlobal() + GlobalDTClasificaciones(UsuarioActual.CveEmpresa) = Nothing ObjClasificaciones.Dispose() CargaDatos() @@ -317,6 +316,7 @@ Partial Class CatClasificaciones If ObjClasificaciones.RemoveClasificacion(GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then GvDatos.EditIndex = -1 ViewState("DTClasificaciones") = ObjClasificaciones.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) + GlobalDTClasificaciones(UsuarioActual.CveEmpresa) = Nothing Alert("La Clasificación se eliminó correctamente.", TipoMensaje.MsgInformacion) Else Alert("Ocurrió un error al eliminar la clasificación. Por favor vuelva a intentar.", TipoMensaje.MsgError) @@ -324,7 +324,7 @@ Partial Class CatClasificaciones ObjClasificaciones.Dispose() CargaGrid() - CargaGlobal() + End Sub #End Region diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index b90e64ea0..28a3b9ef1 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -7798,21 +7798,32 @@ Partial Class Ventas 'CONVERTIR REMISION - TIPO MONEDA -DOLARES A PESOS REGISTRO DIRECTO SIN VENTA ElseIf (EditoRemision = False AndAlso ObjFactura.CveMoneda = 2 AndAlso ObjFactura.ConvertirPesos = True) Then + + Dim TotalCalculableImpuestos, TotalCalculableImpuestosIVA As Decimal For Each Row As DataRow In TmpDT.Rows - Row("PU") = Math.Round(Row("PU").ToString.ToDouble * ObjFactura.TipoCambio, 6) + Row("PU") = Math.Round(Row("PU").ToString.ToDecimal * ObjFactura.TipoCambio, 6) + + Row("Descuento") = Math.Round(Row("Descuento").ToString.ToDouble * ObjFactura.TipoCambio, NumeroDecimales) + TotalCalculableImpuestos = (Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal) - Row("Descuento").ToString.ToDecimal + TotalCalculableImpuestosIVA = TotalCalculableImpuestos * (1 + Row("PorcentajeIEPS").ToString.ToDecimal) + + + Row("IVA") = Row("PorcentajeIVA") + Row("ImporteIVA") = Math.Round(Row("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestosIVA, NumeroDecimales) + Row("ImporteRetIVA") = Math.Round(ClienteRetIVA * TotalCalculableImpuestos, NumeroDecimales) + Row("ImporteRetISR") = Math.Round(ClienteRetISR * TotalCalculableImpuestos, NumeroDecimales) + + Row("ImporteIEPS") = Math.Round(Row("PorcentajeIEPS").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales) + Row("IEPS") = Row("ImporteIEPS") + Row("Total") = Math.Round(Row("Cantidad").ToString.ToDouble * Row("PU").ToString.ToDouble, NumeroDecimales) Row("TotalImporte") = Math.Round(Row("Cantidad").ToString.ToDouble * Row("PU").ToString.ToDouble, NumeroDecimales) - Row("Descuento") = Math.Round(Row("Descuento").ToString.ToDouble * ObjFactura.TipoCambio, NumeroDecimales) - Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString.ToDouble * ObjFactura.TipoCambio, NumeroDecimales) - Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString.ToDouble * ObjFactura.TipoCambio, NumeroDecimales) - Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString.ToDouble * ObjFactura.TipoCambio, NumeroDecimales) - Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString.ToDouble * ObjFactura.TipoCambio, NumeroDecimales) Next Dim ImpuestosLocales As Double = 0 For Each gvr As GridViewRow In GvImpuestosLocales2.Rows If gvr.RowType = DataControlRowType.DataRow Then - gvr.FCTextBox("TxtImpuestoLocalPS").Text = (gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble * ObjFactura.TipoCambio).FormatoNumero + gvr.FCTextBox("TxtImpuestoLocalPS").Text = (gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal * ObjFactura.TipoCambio).FormatoNumero ImpuestosLocales += Math.Round(gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble * ObjFactura.TipoCambio, NumeroDecimales) End If Next @@ -23524,12 +23535,15 @@ Partial Class Ventas End If For Each drow As DataRow In TmpDT.Rows - For Each drow2 As DataRow In DTCvePSCostos.Rows - If drow("CvePS").ToString.ToEntero = drow2("CvePSCargo").ToString.ToEntero Then - drow("Eliminar") = 1 - Exit For - End If - Next + If DTCvePSCostos IsNot Nothing Then + For Each drow2 As DataRow In DTCvePSCostos.Rows + If drow("CvePS").ToString.ToEntero = drow2("CvePSCargo").ToString.ToEntero Then + drow("Eliminar") = 1 + Exit For + End If + Next + End If + Next Dim TmpDTView As New DataView(TmpDT)