diff --git a/Bancos/ProveedoresAbonar.aspx b/Bancos/ProveedoresAbonar.aspx index 48f92f474..9d5d23cab 100644 --- a/Bancos/ProveedoresAbonar.aspx +++ b/Bancos/ProveedoresAbonar.aspx @@ -369,7 +369,7 @@ diff --git a/Bancos/ProveedoresAbonar.aspx.vb b/Bancos/ProveedoresAbonar.aspx.vb index cdd2e3557..9c6fc4e0e 100644 --- a/Bancos/ProveedoresAbonar.aspx.vb +++ b/Bancos/ProveedoresAbonar.aspx.vb @@ -574,7 +574,6 @@ Partial Class Bancos_ProveedoresAbonar FiltroInv = "" 'queno considera lo proporcional End If - If PorcentajeAlmacen = 0 Then ' sin recibir e.Row.FCLabel("LbEstatusInv").Text = "" e.Row.FCLabel("LbEstatusInv").ForeColor = Drawing.Color.Red @@ -732,11 +731,6 @@ Partial Class Bancos_ProveedoresAbonar ImporteSeleccionado += gvr.FCTextBox("TxtAbonar").Text.ToDecimal If gvr.DataKey("UUID") <> "" Then - '529 - - - - Valida.Verificar(gvr.DataKey("UUID"), gvr.DataKey("RFC"), UsuarioActual.Empresa.RFC, gvr.DataKey("TotalOriginal").ToDecimal) If Not UsuarioActual.Empresa.FacturaProduccion OrElse UsuarioActual.CveEmpresa < 2 Then @@ -770,7 +764,6 @@ Partial Class Bancos_ProveedoresAbonar ObjCompra.Dispose() Else MsgValidadas.AppendFormat("Factura Cancelada: {0} - {1} con movimientos de almacen, relacione su factura nueva para descontar saldo
", gvr.DataKey("SerieFolio"), gvr.DataKey("Descripcion")) - End If Else @@ -807,7 +800,7 @@ Partial Class Bancos_ProveedoresAbonar Dim ObjMov As New ClsContabilidad(ObjIE.IniciaTransacSQL) Dim ObjComp As New ClsCompras(ObjIE.IniciaTransacSQL) Dim ObjConta As ClsContPAQi = Nothing - If UsuarioActual.Empresa.UsaContabilidad Then + If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso UsuarioActual.Empresa.UsaContabilidad Then ObjConta = New ClsContPAQi(UsuarioActual.Empresa) ObjConta.IniciaTransacSQL() End If @@ -892,7 +885,6 @@ Partial Class Bancos_ProveedoresAbonar End If Anexo.Text = "" - 'inserto los movimientos de la conta para abonar al saldo If CvePrePoliza > 0 Then @@ -935,21 +927,6 @@ Partial Class Bancos_ProveedoresAbonar End If End If - 'If ObjIE.GetFluctuacionesBitacora(UsuarioActual.CveEmpresa) Then - ' If ObjIE.DtResultados.Rows.Count > 0 Then - ' Dim tFecha As Date = TxtFechaDocumento.Text.ToDate - ' Dim FechaC As String = String.Format("{0}/{1}/{2}", tFecha.Year, tFecha.Month, tFecha.Day) - ' Dim drr As DataRow = ObjIE.DtResultados.FiltroPrimero("Fecha < #" & FechaC & "#", "Fecha DESC") - - ' If drr IsNot Nothing Then - ' FechaUltimaFluctuacion = drr("Fecha").ToString.ToDate - ' TipoCambioFluctuacion = drr("TipoCambio").ToString.ToDecimal - ' End If - - ' End If - 'End If - - Dim DttPlantilla As DataTable = Nothing If ObjMov.GetPlantillaConceptos(UsuarioActual.CveEmpresa, CvePlantillaPoliza) Then DttPlantilla = ObjMov.DtResultados @@ -961,31 +938,24 @@ Partial Class Bancos_ProveedoresAbonar For Each gvr As GridViewRow In GvCxP.Rows If gvr.FCCheckBox("Chk").Checked Then Dim EsImportacion As Boolean = False - + tipoCambioCompra = gvr.DataKey("TipoCambioOriginal").ToDecimal + PorcentajePago = (gvr.FCTextBox("TxtAbonar").Text.ToDecimal) / gvr.DataKey("Original").ToDecimal + tipoCambioCompraValuacion = 1 'Tipos de cambio If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then 'Si la venta viene en Pesos y se va a pagar en Pesos TipoCambioPago = 1 - tipoCambioCompra = 1 - PorcentajePago = gvr.FCTextBox("TxtAbonar").Text.ToDecimal / gvr.DataKey("Original").ToDecimal ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then 'Si la venta viene en Dolares y se va a pagar en Pesos TipoCambioPago = TxtTC.Text.ToDecimal - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - tipoCambioCompraValuacion = If(gvr.DataKey("Fecha").ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, gvr.DataKey("TipoCambio").ToDecimal) - PorcentajePago = ((gvr.FCTextBox("TxtAbonar").Text.ToDecimal) / gvr.DataKey("Original").ToDecimal).RoundSQL + tipoCambioCompraValuacion = If(gvr.DataKey("Fecha").ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, tipoCambioCompra) ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then 'Si la venta viene en Dolares y se va a pagar en DOLARES 'TipoCambioPago = 'GlobalTipoCambio(TxtFechaDocumento.Text.ToDate).ToString.ToDecimal TipoCambioPago = TxtTCDolaresDolares.Text.ToDecimal - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - tipoCambioCompraValuacion = If(gvr.DataKey("Fecha").ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, gvr.DataKey("TipoCambio").ToDecimal) - PorcentajePago = gvr.FCTextBox("TxtAbonar").Text.ToDecimal / gvr.DataKey("Original").ToDecimal + tipoCambioCompraValuacion = If(gvr.DataKey("Fecha").ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, tipoCambioCompra) ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES TipoCambioPago = TxtTCDolares.Text.ToDecimal - tipoCambioCompra = 1 - PorcentajePago = (gvr.FCTextBox("TxtAbonar").Text.ToDecimal) / gvr.DataKey("Original").ToDecimal End If CveSubProyecto = gvr.DataKey("CveSubProyecto").ToEntero - 'If ObjMov.GetPlantillaConceptos(UsuarioActual.CveEmpresa, CvePlantillaPoliza) Then If DttPlantilla IsNot Nothing AndAlso DttPlantilla.Rows.Count > 0 Then For Each Row As DataRow In DttPlantilla.Rows ConceptoContable = Row("CveConcepto").ToString.ToEntero @@ -996,7 +966,6 @@ Partial Class Bancos_ProveedoresAbonar Referencia = gvr.DataKey("SerieFolio").ToString Dim PorcentajeImpuesto As Decimal = 0 - Select Case ConceptoContable Case 17 'Pago Proveedores @@ -1011,21 +980,8 @@ Partial Class Bancos_ProveedoresAbonar End Select End If - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.FCTextBox("TxtAbonar").Text.ToDecimal - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - ImporteMovimiento = gvr.FCTextBox("TxtAbonar").Text.ToDecimal - importeMX = gvr.FCTextBox("TxtAbonar").Text.ToDecimal * tipoCambioCompraValuacion - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.FCTextBox("TxtAbonar").Text.ToDecimal - importeMX = gvr.FCTextBox("TxtAbonar").Text.ToDecimal * tipoCambioCompraValuacion - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - ImporteMovimiento = gvr.FCTextBox("TxtAbonar").Text.ToDecimal - importeMX = ImporteMovimiento * tipoCambioCompraValuacion - End If - ImporteMovimiento = ImporteMovimiento.RoundSQL - importeMX = importeMX.RoundSQL + ImporteMovimiento = gvr.FCTextBox("TxtAbonar").Text.ToDecimal.RoundSQL + importeMX = (gvr.FCTextBox("TxtAbonar").Text.ToDecimal * tipoCambioCompraValuacion).RoundSQL TipoCambioGeneral = tipoCambioCompraValuacion ConceptoMovimiento = $"{HplProveedor.Text} F:{gvr.DataKey("SerieFolio")}" 'cuando son dolares, y tienen complementaria, se hace el registro @@ -1070,26 +1026,10 @@ Partial Class Bancos_ProveedoresAbonar ConceptoContable = 285 End If - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.DataKey("RetIVA").ToDecimal * PorcentajePago - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = gvr.DataKey("RetIVA").ToDecimal * PorcentajePago - importeMX = ImporteMovimiento * tipoCambioCompra - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.DataKey("RetIVA").ToDecimal * PorcentajePago - importeMX = ImporteMovimiento * tipoCambioCompra - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = gvr.DataKey("RetIVA").ToDecimal * PorcentajePago - importeMX = ImporteMovimiento * tipoCambioCompra - End If - ImporteMovimiento = ImporteMovimiento.RoundSQL - importeMX = importeMX.RoundSQL + ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago).RoundSQL + importeMX = (ImporteMovimiento * tipoCambioCompra).RoundSQL + TipoCambioGeneral = tipoCambioCompra - - If tipoCambioCompra > 1 Then ConceptoMovimiento += $" TC:{tipoCambioCompra} ${ImporteMovimiento.FormatoNumero(2)}" 'Conta ContPAQ @@ -1127,23 +1067,10 @@ Partial Class Bancos_ProveedoresAbonar Funcionalidad = 578 ConceptoContable = 286 End If - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.DataKey("RetIVA").ToDecimal * PorcentajePago - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * tipoCambioCompra - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) - End If - ImporteMovimiento = ImporteMovimiento.RoundSQL - importeMX = importeMX.RoundSQL + + ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago).RoundSQL + importeMX = (ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)).RoundSQL + TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) If TipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{TipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}" @@ -1177,21 +1104,9 @@ Partial Class Bancos_ProveedoresAbonar ConceptoContable = 328 End If - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.DataKey("RetISR").ToDecimal * PorcentajePago - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - ImporteMovimiento = (gvr.DataKey("RetISR").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * tipoCambioCompra - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = (gvr.DataKey("RetISR").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * tipoCambioCompra - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - ImporteMovimiento = (gvr.DataKey("RetISR").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * tipoCambioCompra - End If - ImporteMovimiento = Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero) - importeMX = Math.Round(importeMX, 2, MidpointRounding.AwayFromZero) + ImporteMovimiento = (gvr.DataKey("RetISR").ToDecimal * PorcentajePago).RoundSQL + importeMX = (ImporteMovimiento * tipoCambioCompra).RoundSQL + TipoCambioGeneral = tipoCambioCompra If tipoCambioCompra > 1 Then ConceptoMovimiento += $" TC:{tipoCambioCompra} ${ImporteMovimiento.FormatoNumero(2)}" @@ -1221,22 +1136,8 @@ Partial Class Bancos_ProveedoresAbonar funcionalidad = 348 ConceptoContable = 328 End If - - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.DataKey("RetISR").ToDecimal * PorcentajePago - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - ImporteMovimiento = (gvr.DataKey("RetISR").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = (gvr.DataKey("RetISR").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * tipoCambioCompra - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - ImporteMovimiento = (gvr.DataKey("RetISR").ToDecimal * PorcentajePago) - importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) - End If - ImporteMovimiento = ImporteMovimiento.RoundSQL - importeMX = importeMX.RoundSQL + ImporteMovimiento = (gvr.DataKey("RetISR").ToDecimal * PorcentajePago).RoundSQL + importeMX = (ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)).RoundSQL TipoCambioGeneral = TipoCambioPago If TipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{TipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}" @@ -1254,7 +1155,6 @@ Partial Class Bancos_ProveedoresAbonar End If End If - End If Case 14 'Iva X Acreditar @@ -1263,23 +1163,8 @@ Partial Class Bancos_ProveedoresAbonar 'funcionalidad que toma el 100% del pago para acreditamiento de iva If TotalImporte = gvr.DataKey("Saldo").ToDecimal Then - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.DataKey("IVA").ToDecimal - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = gvr.DataKey("IVA").ToDecimal - importeMX = ImporteMovimiento * tipoCambioCompra - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.DataKey("IVA").ToDecimal - importeMX = ImporteMovimiento * tipoCambioCompra - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = gvr.DataKey("IVA").ToDecimal - importeMX = ImporteMovimiento * tipoCambioCompra - End If - ImporteMovimiento = ImporteMovimiento.RoundSQL - importeMX = importeMX.RoundSQL + ImporteMovimiento = (gvr.DataKey("IVA").ToDecimal).RoundSQL + importeMX = (ImporteMovimiento * tipoCambioCompra).RoundSQL If tipoCambioCompra > 1 Then ConceptoMovimiento += $" TC:{tipoCambioCompra} ${ImporteMovimiento.FormatoNumero(2)}" Else @@ -1287,23 +1172,10 @@ Partial Class Bancos_ProveedoresAbonar importeMX = 0 End If Else - ImporteMovimiento = gvr.DataKey("IVA").ToDecimal * PorcentajePago - - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - importeMX = ImporteMovimiento * tipoCambioCompra - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - importeMX = ImporteMovimiento * tipoCambioCompra - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - importeMX = ImporteMovimiento * tipoCambioCompra - End If - ImporteMovimiento = ImporteMovimiento.RoundSQL - importeMX = importeMX.RoundSQL - + ImporteMovimiento = (gvr.DataKey("IVA").ToDecimal * PorcentajePago).RoundSQL + importeMX = (ImporteMovimiento * tipoCambioCompra).RoundSQL If tipoCambioCompra > 1 Then ConceptoMovimiento += $" TC:{tipoCambioCompra} ${ImporteMovimiento.FormatoNumero(2)}" + End If TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) @@ -1330,24 +1202,10 @@ Partial Class Bancos_ProveedoresAbonar Dim TotalImporte As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then 'funcionalidad que toma el 100% del pago para acreditamiento de iva + If TotalImporte = gvr.DataKey("Saldo").ToDecimal Then - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.DataKey("IVADeducible").ToDecimal - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = gvr.DataKey("IVADeducible").ToDecimal - importeMX = gvr.DataKey("IVADeducible").ToDecimal * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - ImporteMovimiento = gvr.DataKey("IVADeducible").ToDecimal - importeMX = ImporteMovimiento * tipoCambioCompra - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - ImporteMovimiento = gvr.DataKey("IVADeducible").ToDecimal - importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) - End If - ImporteMovimiento = Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero) - importeMX = Math.Round(importeMX, 2, MidpointRounding.AwayFromZero) + ImporteMovimiento = (gvr.DataKey("IVADeducible").ToDecimal).RoundSQL + importeMX = (ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)).RoundSQL If TipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{TipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}" Else @@ -1356,19 +1214,8 @@ Partial Class Bancos_ProveedoresAbonar End If Else ImporteMovimiento = gvr.DataKey("IVADeducible").ToDecimal * PorcentajePago + importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - importeMX = ImporteMovimiento * tipoCambioCompra - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - - importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) - End If ImporteMovimiento = ImporteMovimiento.RoundSQL importeMX = importeMX.RoundSQL @@ -1411,20 +1258,8 @@ Partial Class Bancos_ProveedoresAbonar Case 25 'IEPS X Acreditar Dim TotalImporte As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal - ImporteMovimiento = gvr.DataKey("IEPSPorPagar").ToDecimal * PorcentajePago - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - importeMX = ImporteMovimiento * tipoCambioCompra - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - importeMX = ImporteMovimiento * tipoCambioCompra - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - importeMX = ImporteMovimiento * tipoCambioCompra - End If - ImporteMovimiento = Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero) - importeMX = Math.Round(importeMX, 2, MidpointRounding.AwayFromZero) + ImporteMovimiento = (gvr.DataKey("IEPSPorPagar").ToDecimal * PorcentajePago).RoundSQL + importeMX = (ImporteMovimiento * tipoCambioCompra).RoundSQL TipoCambioGeneral = tipoCambioCompra If tipoCambioCompra > 1 Then ConceptoMovimiento += $" TC:{tipoCambioCompra} ${ImporteMovimiento.FormatoNumero(2)}" @@ -1435,20 +1270,8 @@ Partial Class Bancos_ProveedoresAbonar End If Case 26 'IEPS Acreditable Dim TotalImporte As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal - ImporteMovimiento = gvr.DataKey("IEPSPorPagar").ToDecimal * PorcentajePago - If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - importeMX = ImporteMovimiento - ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then - importeMX = ImporteMovimiento * tipoCambioCompra - ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal - importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) - End If - ImporteMovimiento = Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero) - importeMX = Math.Round(importeMX, 2, MidpointRounding.AwayFromZero) + ImporteMovimiento = (gvr.DataKey("IEPSPorPagar").ToDecimal * PorcentajePago).RoundSQL + importeMX = (ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)).RoundSQL TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra) If ImporteMovimiento <> 0 AndAlso TipoContabilidad <> 1 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) Then @@ -1456,6 +1279,7 @@ Partial Class Bancos_ProveedoresAbonar IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCuentaIEPSAcreditable").ToString.ToEntero End If End If + Case 64 'Ganancia If CveMoneda <> 1 OrElse gvr.DataKey("CveMoneda").ToEntero <> 1 Then @@ -1479,37 +1303,6 @@ Partial Class Bancos_ProveedoresAbonar importeMX = ImporteMovimiento End If - '' si tiene funcionalidad de flucturación con ivas, tomar tipocambioventa - 'If tipoCambioPago > tipoCambioVentaDiferenciaCambiaria AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - ' ImporteMovimiento = (gvr.FCTextBox("TxtAbonar").Text.ToDecimal * tipoCambioPago) - (gvr.FCTextBox("TxtAbonar").Text.ToDecimal * tipoCambioVentaDiferenciaCambiaria) 'Añadimos la diferencia de ganancia en la venta - ' ImporteMovimiento -= ((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * TCImpuestos) - ((gvr.DataKey("IVA").ToDecimal * PorcentajePago) * tipoCambioVentaDiferenciaCambiaria) 'Añadimos la diferencia de ganancia en el IVA - ' ImporteMovimiento += ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * TCImpuestos) - ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * tipoCambioVentaDiferenciaCambiaria) 'Añadimos la diferencia de ganancia en el RetIVA - ' ImporteMovimiento += ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * TCImpuestos) - ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambioVentaDiferenciaCambiaria) 'Añadimos la diferencia de ganancia en el RetISR - ' ImporteMovimiento -= ((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * TCImpuestos) - ((gvr.DataKey("IEPS").ToDecimal * PorcentajePago) * tipoCambioVentaDiferenciaCambiaria) 'Añadimos la diferencia de ganancia en el IEPS - ' ImporteMovimiento = Math.Abs(Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero)) - ' importeMX = ImporteMovimiento - 'End If - - - 'Dim TotalImporte As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal - - ''Dim IVA As Decimal = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal, gvr.DataKey("IVAPorPagar").ToDecimal, gvr.DataKey("IVA").ToDecimal * PorcentajePago) - 'Dim IVA As Decimal = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IVAPorPagar").ToDecimal - (gvr.DataKey("IVA").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IVAPorPagar").ToDecimal, gvr.DataKey("IVA").ToDecimal * PorcentajePago) - 'Dim IEPS As Decimal = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IEPSPorPagar").ToDecimal - (gvr.DataKey("IEPS").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IEPSPorPagar").ToDecimal, gvr.DataKey("IEPS").ToDecimal * PorcentajePago) 'If(TotalImporte = gvr.DataKey("Saldo").ToDecimal, gvr.DataKey("IEPSPorPagar").ToDecimal, gvr.DataKey("IEPS").ToDecimal * PorcentajePago) - - 'IdCtaContable = UsuarioActual.Empresa.IdCuentaGananciaCambiaria - 'Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompraValuacion) - 'TipoCambioGeneral = TCImpuestos - '''' si tiene funcionalidad de flucturación con ivas, tomar tipocambioCompra - 'If TipoCambioPago < tipoCambioCompra AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - ' ImporteMovimiento = (gvr.FCTextBox("TxtAbonar").Text.ToDecimal * TipoCambioPago) - (gvr.FCTextBox("TxtAbonar").Text.ToDecimal * tipoCambioCompra) 'Añadimos la diferencia de ganancia en la venta - ' ImporteMovimiento -= (IVA * TCImpuestos) - (IVA * tipoCambioCompra) 'Añadimos la diferencia de ganancia en el IVA - ' ImporteMovimiento += ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * TCImpuestos) - ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * tipoCambioCompra) 'Añadimos la diferencia de ganancia en el RetIVA - ' ImporteMovimiento += ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * TCImpuestos) - ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambioCompra) 'Añadimos la diferencia de ganancia en el RetISR - ' ImporteMovimiento -= (IEPS * TCImpuestos) - (IEPS * tipoCambioCompra) 'Añadimos la diferencia de ganancia en el IEPS - ' ImporteMovimiento = Math.Abs(Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero)) - ' importeMX = ImporteMovimiento - 'End If Else ImporteMovimiento = 0 End If @@ -1531,23 +1324,6 @@ Partial Class Bancos_ProveedoresAbonar ImporteMovimiento = Math.Abs(Diferencia) importeMX = ImporteMovimiento End If - - 'Dim TotalImporte As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal - 'Dim IVA As Decimal = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IVAPorPagar").ToDecimal - (gvr.DataKey("IVA").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IVAPorPagar").ToDecimal, gvr.DataKey("IVA").ToDecimal * PorcentajePago) - 'Dim IEPS As Decimal = If(TotalImporte = gvr.DataKey("Saldo").ToDecimal AndAlso Math.Abs(Math.Round(gvr.DataKey("IEPSPorPagar").ToDecimal - (gvr.DataKey("IEPS").ToDecimal * PorcentajePago), 2)) <= 0.02, gvr.DataKey("IEPSPorPagar").ToDecimal, gvr.DataKey("IEPS").ToDecimal * PorcentajePago) 'If(TotalImporte = gvr.DataKey("Saldo").ToDecimal, gvr.DataKey("IEPSPorPagar").ToDecimal, gvr.DataKey("IEPS").ToDecimal * PorcentajePago) - - 'IdCtaContable = UsuarioActual.Empresa.IdCuentaPerdidaCambiaria - 'Dim TCImpuestos As Decimal = If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompraValuacion) - '' si tiene funcionalidad de flucturación con ivas, tomar tipocambioCompra - 'If TipoCambioPago > tipoCambioCompra AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then - ' ImporteMovimiento = (gvr.FCTextBox("TxtAbonar").Text.ToDecimal * tipoCambioCompra) - (gvr.FCTextBox("TxtAbonar").Text.ToDecimal * TipoCambioPago) 'Añadimos la diferencia de ganancia en la venta - ' ImporteMovimiento -= (IVA * tipoCambioCompra) - (IVA * TCImpuestos) 'Añadimos la diferencia de ganancia en el IVA - ' ImporteMovimiento += ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * tipoCambioCompra) - ((gvr.DataKey("RetIVA").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetIVA - ' ImporteMovimiento += ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * tipoCambioCompra) - ((gvr.DataKey("RetISR").ToDecimal * PorcentajePago) * TCImpuestos) 'Añadimos la diferencia de ganancia en el RetISR - ' ImporteMovimiento -= (IEPS * tipoCambioCompra) - (IEPS * TCImpuestos) 'Añadimos la diferencia de ganancia en el IEPS - ' ImporteMovimiento = Math.Abs(Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero)) - ' importeMX = ImporteMovimiento - 'End If Else ImporteMovimiento = 0 End If @@ -1645,8 +1421,6 @@ Partial Class Bancos_ProveedoresAbonar ObjComp.ProgramarCompra(gvr.DataKey("CveCompra").ToEntero, 0, UsuarioActual.CveUsuario, -1) End If - ' End If - End If Next ConceptoMovimiento = $"{TxtPagueseA.Text.Trim} - {TxtObservaciones.Text} {If(TipoCambioPago > 1, $" TC:{TipoCambioPago}", "")}" @@ -1816,7 +1590,6 @@ Partial Class Bancos_ProveedoresAbonar Exit For Else - 'IVA. siempre se registra aunque sea cero If MsgError = "" Then diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 3ef2befb7..3da432e53 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -9132,18 +9132,16 @@ Partial Class Compras_Compras If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then If sumaAmortizacion = CompraSaldo Then ImporteMovimiento = TxtIVA.Text.ToDecimal - If ImporteMovimiento > 0 Then IVACompleto = True End If - Else ImporteMovimiento = 0 End If Else ImporteMovimiento = Math.Round(PorcentajePago * TxtIVA.Text.ToDecimal, 2) End If - importeMN = ImporteMovimiento * tipoCambio + importeMN = ImporteMovimiento * tipoCambioNC PorcentajeImpuesto = TmpDT.MAX("IVAPorcentaje").ToDecimal IdCtaContable = If(IdCtaIVAXAcreditar > 0, IdCtaIVAXAcreditar, 0) @@ -9157,31 +9155,6 @@ Partial Class Compras_Compras End If End If End If - 'Case 287 'Iva X Acreditar importacion - ' If Not gvr.DataKey("TipoDocto").Contiene("NC", "DEV", "Ant") AndAlso chkImportacion.checked Then - ' If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then - ' If sumaAmortizacion = CompraSaldo Then - ' ImporteMovimiento = TxtIVA.Text.ToDecimal - - ' If ImporteMovimiento > 0 Then - ' IVACompleto = True - ' End If - - ' Else - ' ImporteMovimiento = 0 - ' End If - ' Else - ' ImporteMovimiento = Math.Round(PorcentajePago * TxtIVA.Text.ToDecimal, 2) - ' End If - ' importeMN = ImporteMovimiento * tipoCambio - ' PorcentajeImpuesto = TmpDT.MAX("IVAPorcentaje").ToDecimal - ' IdCtaContable = If(IdCtaIVAXAcreditar > 0, IdCtaIVAXAcreditar, 0) - ' If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then - ' If ObjConta.DtResultados.Rows.Count > 0 Then - ' IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaIVAxAcreditar").ToString.ToEntero - ' End If - ' End If - ' End If Case 19 'Iva Acreditado @@ -9196,7 +9169,7 @@ Partial Class Compras_Compras Else ImporteMovimiento = Math.Round(PorcentajePago * TxtIVA.Text.ToDecimal, 2) End If - importeMN = ImporteMovimiento * tipoCambio + importeMN = ImporteMovimiento * tipoCambioNC PorcentajeImpuesto = TmpDT.MAX("IVAPorcentaje").ToDecimal IdCtaContable = If(IdCtaIVAAcreditable > 0, IdCtaIVAAcreditable, 0) @@ -9246,7 +9219,7 @@ Partial Class Compras_Compras End If ImporteMovimiento = Math.Round(PorcentajePago * TxtRetIVA.Text.ToDecimal, 2) - importeMN = ImporteMovimiento * tipoCambio + importeMN = ImporteMovimiento * tipoCambioNC If CtaProveedorRetIVA > 0 Then @@ -9261,20 +9234,9 @@ Partial Class Compras_Compras End If End If - - 'If UsuarioActual.Empresa.Funcionalidad(577).ToEntero = 1 Then - ' IdCtaContable = UsuarioActual.Empresa.Funcionalidad(578).ToEntero - 'End If - - 'If DdlRetIVAConcepto.SelectedValue.ToEntero = 5 Then - ' IdCtaContable = UsuarioActual.Empresa.Funcionalidad(578).ToEntero - 'End If - End If End If - - Case 183 'RetIVA x Acreditar Fletes P.F. If Not gvr.DataKey("TipoDocto").Contiene("NC", "DEV", "Ant") Then If DdlRetIVAConcepto.Items.Count > 0 Then @@ -9484,9 +9446,6 @@ Partial Class Compras_Compras importeMN = ImporteMovimiento End If - - - If ImporteMovimiento <> 0 Then Dim CveSubProyecto64 As Integer = TmpDT.FiltroPrimeroValor("CveSubProyecto", " CveSubProyecto > 0").ToEntero @@ -9532,7 +9491,7 @@ Partial Class Compras_Compras End If - If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaNueva, TipoMovimiento, ImporteMovimiento, Concepto, ConceptoContable, Concepto, Fecha, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=importeMN, CvePrePolizaOriginal:=CvePrePoliza, ImporteME:=If(tipoCambio = 1, 0, ImporteMovimiento), PorcentajeImpuesto:=PorcentajeImpuesto) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaNueva, TipoMovimiento, ImporteMovimiento, Concepto, ConceptoContable, Concepto, Fecha, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveIE:=CveIE, ImporteMX:=importeMN, CvePrePolizaOriginal:=CvePrePoliza, ImporteME:=If(tipoCambio = 1, 0, ImporteMovimiento), PorcentajeImpuesto:=PorcentajeImpuesto, TipoCambio:=tipoCambioNC) Then ErrorMovtosCxP = 1 Exit For End If diff --git a/Contabilidad/RegPrePolizaS.aspx.vb b/Contabilidad/RegPrePolizaS.aspx.vb index c5fd7b7f2..536dc89fc 100644 --- a/Contabilidad/RegPrePolizaS.aspx.vb +++ b/Contabilidad/RegPrePolizaS.aspx.vb @@ -1579,6 +1579,7 @@ Partial Class ContabilidadC_RegPrePolizaS If DrConceptoContable IsNot Nothing Then Dim AplicaComplementaria = Boolean.Parse(DrConceptoContable("EsComplementaria").ToString) + Dim AplicaBancos = Boolean.Parse(DrConceptoContable("AplicaBancos").ToString) If AplicaComplementaria Then Dim Importe As Decimal = IIf(TxtCargoE.Text.ToDecimal <> 0, TxtCargoE.Text.ToDecimal, TxtAbonoE.Text.ToDecimal) @@ -1593,6 +1594,13 @@ Partial Class ContabilidadC_RegPrePolizaS End If End If + If AplicaBancos Then + If DdlModalConceptoTipoTransaccion.SelectedValue.ToEntero <= 0 Then + Alert("seleccione las opciones de bancos ") + Retorno = False + End If + End If + End If Return Retorno End Function @@ -2290,8 +2298,6 @@ Partial Class ContabilidadC_RegPrePolizaS DtMovimientos.Clear() - Dim ObjConta As New ClsContabilidad() - ObjConta.IniciaTransacSQL() Try Dim ContadorRegistros As Integer = 2 @@ -2449,16 +2455,15 @@ Partial Class ContabilidadC_RegPrePolizaS DtMovimientos.AcceptChanges() End If ContadorRegistros = ContadorRegistros + 1 - Next - TxtTotalCargos.Text = DtMovimientos.SUMD("Cargo").ToString.FormatoNumero - TxtTotalAbonos.Text = DtMovimientos.SUMD("Abono").ToString.FormatoNumero - GvPrePoliza.DataSource = DtMovimientos GvPrePoliza.DataBind() UpPrePoliza.Update() + TxtTotalCargos.Text = DtMovimientos.SUMD("Cargo").ToString.FormatoNumero + TxtTotalAbonos.Text = DtMovimientos.SUMD("Abono").ToString.FormatoNumero + Catch ex As Exception Alert("No se pudo cargar el excel", TipoMensaje.MsgAdvertencia) GuardaLog(ex.Message) diff --git a/Inicio.aspx.vb b/Inicio.aspx.vb index c7073fe77..644f1ede8 100644 --- a/Inicio.aspx.vb +++ b/Inicio.aspx.vb @@ -156,7 +156,7 @@ Partial Class Inicio LtlTitulo.Text = "Sistema Integral de Información Gluyas" End If - If UsuarioActual.Empresa.UsaContabilidad Then + If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso UsuarioActual.Empresa.UsaContabilidad Then Dim ObjPolizas As New ClsContPAQi(UsuarioActual.Empresa) If ObjPolizas.GetPolizasCuadre() And ObjPolizas.DtResultados.Rows.Count > 0 Then Dim ObjNotificacion = ItemNotificaciones(String.Format("Polizas de cuadre {0}", ObjPolizas.DtResultados.Rows.Count), Ico:="icon-calculator", Tipo:="warning", Link:="/Contabilidad/RepPolizasCuadre.aspx") diff --git a/Inventarios/EntregaAlmacen.aspx.vb b/Inventarios/EntregaAlmacen.aspx.vb index 04bee566c..eb384fd34 100644 --- a/Inventarios/EntregaAlmacen.aspx.vb +++ b/Inventarios/EntregaAlmacen.aspx.vb @@ -2330,7 +2330,7 @@ Partial Class Inventarios_EntregaAlmacen Dim PU As Decimal = RowGarantia("Importe").ToString().ToDecimal() ' / RowGarantia("Cantidad").ToString().ToDouble() Dim Serie As String = RowGarantia("Comprobante").ToString - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoGarantia, RowGarantia("Cantidad").ToString().ToDouble(), CveUM, CvePS, PU, Serie:=Serie, CveVentaDetalle:=RowGarantia("CveVentaDetalle").ToString.ToEntero) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoGarantia, RowGarantia("Cantidad").ToString().ToDouble(), CveUM, CvePS, PU, Serie:=Serie, CveVentaDetalle:=IIf(RowGarantia("MismoCvePS").ToString = "1", RowGarantia("CveVentaDetalle"), -1).ToString.ToEntero) Then ErrorMovInv = True TextoError.AppendFormat("Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar.") Exit For @@ -2430,8 +2430,9 @@ Partial Class Inventarios_EntregaAlmacen ConceptoMovimiento = If(CveAlmacenTraspasoDestino > 0, 8, ConceptoMovimiento) Dim Almacen1 As Integer = DdlAlmacen.SelectedValue.ToEntero() + Dim tCveAlmacenTraspasoDestino As Integer = CveAlmacenTraspasoDestino - If TipoDocto = "Rem" AndAlso CveAlmacenTraspasoDestino = 0 Then + If TipoDocto = "Rem" AndAlso tCveAlmacenTraspasoDestino = 0 Then ErrorMovInv = True TextoError.AppendFormat("Ocurrió un error. no se tiene definido el almacen destino") End If @@ -2440,14 +2441,14 @@ Partial Class Inventarios_EntregaAlmacen If TipoMovimiento = 2 And TipoDocto = "Rem" Then ConceptoMovimiento = 8 Almacen1 = CveAlmacenTraspasoDestino - CveAlmacenTraspasoDestino = DdlAlmacen.SelectedValue.ToEntero() + tCveAlmacenTraspasoDestino = DdlAlmacen.SelectedValue.ToEntero() End If 'CANCELACION DE DEVOLUCION If TipoMovimiento = 2 And TipoDocto = "Dev" And EsDevolucionVenta = 1 Then ConceptoMovimiento = 3 Almacen1 = DdlAlmacen.SelectedValue.ToEntero() - CveAlmacenTraspasoDestino = DdlAlmacen.SelectedValue.ToEntero() + tCveAlmacenTraspasoDestino = DdlAlmacen.SelectedValue.ToEntero() End If 'DEVOLUCION DIRECTA A ENTREGA POR ADELANTADO @@ -2456,7 +2457,7 @@ Partial Class Inventarios_EntregaAlmacen End If CveMovimiento = ObjInventario.AddMovimiento(Almacen1, ConceptoMovimiento, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, - CveContrato:=CveContrato, CveAlmacenDestino:=CveAlmacenTraspasoDestino, Modulo:="RE/G7") + CveContrato:=CveContrato, CveAlmacenDestino:=tCveAlmacenTraspasoDestino, Modulo:="RE/G7") Folio = ObjInventario.Folio 'SALIDA DE ALMACEN - SALIDA POR TRASPASO CUANDO ES REMISION - DEVOLUCION (SI ES TRASPASO Y TIENE CONTRATO NO HACE DEVOLUCIóN) @@ -2555,8 +2556,8 @@ Partial Class Inventarios_EntregaAlmacen 'ENTRADA POR TRASPASO CUANDO ES REMISION If Not ErrorMovInv Then - If CveAlmacenTraspasoDestino > 0 AndAlso Not (TipoMovimiento = 2 And TipoDocto = "Dev" And EsDevolucionVenta = 1) Then ' TRASPASO CUANDO ES REMISION - CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacenTraspasoDestino, 9, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveContrato:=CveContrato, + If tCveAlmacenTraspasoDestino > 0 AndAlso Not (TipoMovimiento = 2 And TipoDocto = "Dev" And EsDevolucionVenta = 1) Then ' TRASPASO CUANDO ES REMISION + CveMovimientoEntrada = ObjInventario.AddMovimiento(tCveAlmacenTraspasoDestino, 9, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveContrato:=CveContrato, CveMovimientoRelacionado:=CveMovimiento, CveAlmacenDestino:=DdlAlmacen.SelectedValue.ToEntero(), Modulo:="RE/G8") FolioEntrada = ObjInventario.Folio Dim ImporteAlmacen As Decimal = 0 diff --git a/Ventas/CatMetasVendedores.aspx.vb b/Ventas/CatMetasVendedores.aspx.vb index f7e55c204..22cad0f55 100644 --- a/Ventas/CatMetasVendedores.aspx.vb +++ b/Ventas/CatMetasVendedores.aspx.vb @@ -284,7 +284,7 @@ Partial Class CatMetasVendedores Dim Correcto As Boolean = True ObjMetas.IniciaTransacSQL() Try - Dim DtVendedores As DataTable = GlobalDTVendedores(UsuarioActual.CveEmpresa) + Dim DtVendedores As DataTable = GlobalDTVendedores(UsuarioActual.CveEmpresa, Estatus:=-1, VendedorTipo:=-1) Dim DtClasificaciones As DataTable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) Dim DtClasificaciones2 As DataTable = GlobalDTClasificaciones2(UsuarioActual.CveEmpresa) @@ -293,7 +293,7 @@ Partial Class CatMetasVendedores If Correcto Then Dim TieneError As Boolean = False - Dim CveVendedor As Integer = DtVendedores.FiltroPrimeroValor("CveVendedor", String.Format("trim(Vendedor) LIKE '%{0}%'", row("Vendedor").ToString().TrimStart().TrimEnd())).ToEntero + Dim CveVendedor As Integer = DtVendedores.FiltroPrimeroValor("CveVendedor", String.Format("trim(Vendedor) LIKE '%{0}%'", row("Vendedor").ToString().TrimStart().TrimEnd().ToUpper)).ToEntero Dim CveClasificacion As Integer = DtClasificaciones.FiltroPrimeroValor("CveClasificacion", String.Format("trim(Clasificacion)='{0}'", row("Clasificación Superior").ToString().TrimStart().TrimEnd())).ToEntero Dim CveClasificacion2 As Integer = DtClasificaciones2.FiltroPrimeroValor("CveClasificacion", String.Format("trim(Clasificacion)='{0}'", row("Clasificación").ToString().TrimStart().TrimEnd())).ToEntero Dim CveMarca As Integer = DtMarcas.FiltroPrimeroValor("CveMarca", String.Format("Marca='{0}'", row("Marca").ToString().TrimStart().TrimEnd())).ToEntero @@ -309,6 +309,8 @@ Partial Class CatMetasVendedores If Correcto Then RowsCargados += 1 End If + Else + Correcto = False End If If Not Correcto Then @@ -318,7 +320,7 @@ Partial Class CatMetasVendedores Next Catch ex As Exception - OnError("Ocurrió un error al cargar los precios.", ex) + OnError("Ocurrió un error al cargar las metas.", ex) Finally Dim MensajeFinal As New StringBuilder() diff --git a/Ventas/ClientesAbonar.aspx.vb b/Ventas/ClientesAbonar.aspx.vb index 911dc6847..ffc8b2843 100644 --- a/Ventas/ClientesAbonar.aspx.vb +++ b/Ventas/ClientesAbonar.aspx.vb @@ -1082,7 +1082,7 @@ Partial Class Ventas_ClientesAbonar Exit Select End If - ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago * tipoCambioVenta).RoundSQL + ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago).RoundSQL ImporteMN = (ImporteMovimiento * tipoCambioVenta).RoundSQL TipoCambioGeneral = tipoCambioVenta CveSubProyectoContabilizar = CveSubProyecto @@ -1104,7 +1104,7 @@ Partial Class Ventas_ClientesAbonar If EsAnticipoEspecial Then Exit Select If gvr.DataKey("CveTipoRetencion").ToEntero = 4 Then - ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago * tipoCambioVenta).RoundSQL + ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago).RoundSQL ImporteMN = (ImporteMovimiento * tipoCambioVenta).RoundSQL TipoCambioGeneral = tipoCambioVenta CveSubProyectoContabilizar = CveSubProyecto @@ -1125,7 +1125,7 @@ Partial Class Ventas_ClientesAbonar Case 9 'Ret ISR x Trasladar If EsAnticipoEspecial Then Exit Select - ImporteMovimiento = (gvr.DataKey("RetISR").ToDecimal * PorcentajePago * tipoCambioVenta).RoundSQL + ImporteMovimiento = (gvr.DataKey("RetISR").ToDecimal * PorcentajePago).RoundSQL ImporteMN = (ImporteMovimiento * tipoCambioVenta).RoundSQL TipoCambioGeneral = tipoCambioVenta CveSubProyectoContabilizar = CveSubProyecto @@ -1147,7 +1147,7 @@ Partial Class Ventas_ClientesAbonar Case 13 'Iva por Trasladar If EsAnticipoEspecial Then Exit Select - ImporteMovimiento = (gvr.DataKey("IVA").ToDecimal * PorcentajePago * tipoCambioVenta).RoundSQL + ImporteMovimiento = (gvr.DataKey("IVA").ToDecimal * PorcentajePago).RoundSQL ImporteMN = (ImporteMovimiento * tipoCambioVenta).RoundSQL TipoCambioGeneral = tipoCambioVenta CveSubProyectoContabilizar = CveSubProyecto @@ -1167,7 +1167,7 @@ Partial Class Ventas_ClientesAbonar Exit Select End If - ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago * tipoCambioVenta).RoundSQL + ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago).RoundSQL ImporteMN = (ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)).RoundSQL TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) CveSubProyectoContabilizar = CveSubProyecto @@ -1188,7 +1188,7 @@ Partial Class Ventas_ClientesAbonar If EsAnticipoEspecial Then Exit Select If gvr.DataKey("CveTipoRetencion").ToEntero = 4 Then - ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago * tipoCambioVenta).RoundSQL + ImporteMovimiento = (gvr.DataKey("RetIVA").ToDecimal * PorcentajePago).RoundSQL ImporteMN = (ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)).RoundSQL TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) CveSubProyectoContabilizar = CveSubProyecto @@ -1207,7 +1207,7 @@ Partial Class Ventas_ClientesAbonar Case 63 'Ret ISR Trasladado If EsAnticipoEspecial Then Exit Select - ImporteMovimiento = (gvr.DataKey("RetISR").ToDecimal * PorcentajePago * tipoCambioVenta).RoundSQL + ImporteMovimiento = (gvr.DataKey("RetISR").ToDecimal * PorcentajePago).RoundSQL ImporteMN = (ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)).RoundSQL TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) CveSubProyectoContabilizar = CveSubProyecto @@ -1229,7 +1229,7 @@ Partial Class Ventas_ClientesAbonar Case 61 'Iva Trasladado If EsAnticipoEspecial Then Exit Select - ImporteMovimiento = (gvr.DataKey("IVA").ToDecimal * PorcentajePago * tipoCambioVenta).RoundSQL + ImporteMovimiento = (gvr.DataKey("IVA").ToDecimal * PorcentajePago).RoundSQL ImporteMN = (ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)).RoundSQL TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) CveSubProyectoContabilizar = CveSubProyecto @@ -1246,7 +1246,7 @@ Partial Class Ventas_ClientesAbonar Case 38 'IEPS por trasladar If EsAnticipoEspecial Then Exit Select - ImporteMovimiento = (gvr.DataKey("IEPS").ToDecimal * PorcentajePago * tipoCambioVenta).RoundSQL + ImporteMovimiento = (gvr.DataKey("IEPS").ToDecimal * PorcentajePago).RoundSQL ImporteMN = (ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta)).RoundSQL TipoCambioGeneral = tipoCambioVenta CveSubProyectoContabilizar = CveSubProyecto @@ -1255,7 +1255,7 @@ Partial Class Ventas_ClientesAbonar Case 39 'IEPS Trasladado If EsAnticipoEspecial Then Exit Select - ImporteMovimiento = (gvr.DataKey("IEPS").ToDecimal * PorcentajePago * tipoCambioVenta).RoundSQL + ImporteMovimiento = (gvr.DataKey("IEPS").ToDecimal * PorcentajePago).RoundSQL ImporteMN = (ImporteMovimiento * tipoCambioVenta).RoundSQL TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioVenta) diff --git a/Ventas/MetasVendedores.aspx b/Ventas/MetasVendedores.aspx index 913d8faf7..072a2a9e9 100644 --- a/Ventas/MetasVendedores.aspx +++ b/Ventas/MetasVendedores.aspx @@ -110,7 +110,7 @@
- +
@@ -118,7 +118,7 @@
- +
@@ -130,6 +130,17 @@
+
+
+ +
+ + + + + +
+
@@ -159,7 +170,7 @@ %Inte - +
@@ -207,7 +218,7 @@ %Inte - + diff --git a/Ventas/MetasVendedores.aspx.vb b/Ventas/MetasVendedores.aspx.vb index 27db649af..f92b781f9 100644 --- a/Ventas/MetasVendedores.aspx.vb +++ b/Ventas/MetasVendedores.aspx.vb @@ -15,8 +15,8 @@ Partial Class MetasVendedores End Property Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then - CargaDatosFiltros() - CargarDatosReporte() + CargaDatosFiltros() + End If End Sub Private Sub CargaDatosFiltros() @@ -43,20 +43,18 @@ Partial Class MetasVendedores DdlCategoria.DataBind() DdlCategoria.Items.Insert(0, New ListItem("Todos", "-1")) - DdlClasificaciones.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) + DdlClasificaciones.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion:=1) DdlClasificaciones.DataBind() DdlClasificaciones.Items.Insert(0, New ListItem("Todos", "-1")) DdlClasificacion2.DataSource = GlobalDTClasificaciones2(UsuarioActual.CveEmpresa) DdlClasificacion2.DataBind() - DdlClasificacion2.Items.Insert(0, New ListItem("Todos", "-1")) - - 'DdlCliente.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa) - 'DdlCliente.DataBind() - 'DdlCliente.Items.Insert(0, New ListItem("Todos", "-1")) + DdlClasificacion2.Items.Insert(0, New ListItem("Todos", "-1")) + + End Sub - Private Sub CargarDatosReporte() + Private Sub CargarDatos() Dim CveCliente As Integer = -1 If DdlClientes.SelectedValue.ToEntero > 0 Then CveCliente = DdlClientes.SelectedValue.ToEntero @@ -65,7 +63,7 @@ Partial Class MetasVendedores Dim ObjVentas As New ClsVentas If ObjVentas.GetRepMetasVendedores(TxtFechaMes.Text, UsuarioActual.CveEmpresa, DdlVendedorFiltro.SelectedValue.ToEntero, DdlCategoria.SelectedValue.ToEntero, DdlClasificaciones.SelectedValue.ToEntero, DdlClasificacion2.SelectedValue.ToEntero, DdlMarcaFiltro.SelectedValue.ToEntero, - DdlSubProyectoFiltro.SelectedValue.ToEntero, CveCliente, DdlGrupo.SelectedValue.ToEntero) Then + DdlSubProyectoFiltro.SelectedValue.ToEntero, CveCliente, DdlDistribuidor.SelectedValue.ToEntero, DdlGrupo.SelectedValue.ToEntero) Then GV.DataSource = ObjVentas.DtResultados DtDatos = ObjVentas.DtResultados End If @@ -74,7 +72,7 @@ Partial Class MetasVendedores End Sub Protected Sub btConsultar_Click(sender As Object, e As EventArgs) Handles btConsultar.Click - CargarDatosReporte() + CargarDatos() UPDatos.Update() End Sub @@ -87,16 +85,7 @@ Partial Class MetasVendedores Select Case e.Row.DBCampo("TipoFila") Case "1" e.Row.CssClass = "Totales" - ' e.Row.FCLabel("lblRealMes").Text = "" - ' e.Row.FCLabel("lblVtaMesAA").Text = "" - ' e.Row.FCLabel("lblObjMes").Text = "" - ' e.Row.FCLabel("lblRealAcumulado").Text = "" - ' e.Row.FCLabel("lblRealMesPorcentaje").Text = "" - ' e.Row.FCLabel("lblAAntAcumulado").Text = "" - ' e.Row.FCLabel("lblObjAcumulado").Text = "" - ' e.Row.FCLabel("lblVarVSAAPerc").Text = "" - ' e.Row.FCLabel("lblVarVSAA").Text = "" - ' e.Row.FCLabel("lblVarVSObjAcum").Text = "" + Case "2" e.Row.CssClass = "SubTotales2" Case "3" @@ -128,5 +117,30 @@ Partial Class MetasVendedores params.Add(New ReportParameter("Agente", DdlVendedorFiltro.SelectedItem.ToString)) ImprimirPDF("Empresas/Grales/Formatos/MetasVendedores.rdlc", DtDatos, params, "Rep. Metas por vendedores", "PDF", RDSName:="DataSet1") - End Sub + End Sub + + Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + + Dim params As New List(Of ReportParameter) + params.Add(New ReportParameter("pEmp", UsuarioActual.Empresa.Empresa)) + If Imagen.Exists Then + params.Add(New ReportParameter("pImg", logouri)) + Else + params.Add(New ReportParameter("pImg", "")) + End If + params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Usuario)) + params.Add(New ReportParameter("FechaImpresion", Today)) + params.Add(New ReportParameter("SubProyecto", DdlSubProyectoFiltro.SelectedItem.ToString)) + params.Add(New ReportParameter("Agente", DdlVendedorFiltro.SelectedItem.ToString)) + + ImprimirPDF("Empresas/Grales/Formatos/MetasVendedores.rdlc", DtDatos, params, "Rep. Metas por vendedores", "Excel", RDSName:="DataSet1") + End Sub + + Private Sub DdlCategoria_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlCategoria.SelectedIndexChanged + DdlClasificaciones.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveCategoria:=DdlCategoria.SelectedValue.ToEntero, UsoClasificacion:=1) + DdlClasificaciones.DataBind() + DdlClasificaciones.Items.Insert(0, New ListItem("Todos", "-1")) + End Sub End Class