diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 0809c0dc4..15ef51251 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -3988,9 +3988,11 @@ Partial Class Compras_Compras Protected Sub BtnGuardar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnGuardar.Click - AjustaCombustibles() + 'If Not AjustaCombustibles() Then + ' Exit Sub + 'End If - '------------------INICIA VALIDACIONES------------------ + '------------------ INICIA VALIDACIONES ------------------ Dim EstatusCredito As Integer = 0 Dim CveSubProyecto As Integer = 0 'Credito Multiple @@ -4303,7 +4305,7 @@ Partial Class Compras_Compras Next If ErrorValidacion Then Exit Sub - '------------------TERMINA VALIDACIONES------------------ + 'RECORRO LOS PRODUCTOS O SERVICIOS PARA REGISTRARLOS LOS QUE NO EXISTEN EN EL CATÁLOGO Dim tCve As Integer @@ -4374,6 +4376,17 @@ Partial Class Compras_Compras UM.Dispose() PSS.Dispose() + 'VALIDA IMPORTES + If Not ValidaTotalesGuardar() Then + Exit Sub + End If + + If Not AjustaCombustibles() Then + Exit Sub + End If + + '------------------TERMINA VALIDACIONES------------------ + 'si hay necesidad de actualizar el globaldtps If RegeneraPS Then 'Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDT) @@ -4423,10 +4436,7 @@ Partial Class Compras_Compras TmpDT.AcceptChanges() If Correcto Then - 'VALIDA IMPORTES - If Not ValidaTotalesGuardar() Then - Exit Sub - End If + Dim ObjCompras As New ClsCompras() @@ -4650,6 +4660,8 @@ Partial Class Compras_Compras End If Next + + 'Compra If ObjCompras.AddCompra(DdlTipoComprobante.SelectedValue, TxtDescripcion.Text.Trim, TxtSerie.Text.Trim, TxtFolio.Text.Trim, TxtFolioSecundario.Text.Trim, CveProveedor, TxtSubTotal.Text.ToDouble, TxtDescuento.Text.ToDouble, LblAmortizacion.Text.ToDouble, TxtIVA.Text.ToDouble, TxtRetIVA.Text.ToDouble, TxtRetISR.Text.ToDouble, TxtIEPS.Text.ToDouble, TxtOtrosImpuestos.Text.ToDouble, @@ -8486,6 +8498,8 @@ Partial Class Compras_Compras End If Alert(Msg.ToString, TipoMensaje.MsgInformacion, MsgAccionAceptar) + BtnGuardar.Enabled = False + UpFacturar.Update() End If @@ -8530,7 +8544,12 @@ Partial Class Compras_Compras End Sub - Private Sub AjustaCombustibles() + Private Function AjustaCombustibles() As Boolean + + Dim Respuesta As Boolean = False + + Dim IVADetalles As Decimal = TmpDT.SUM("IVA", " IVA > 0 ").ToDecimal + Dim DiferenciaIVas As Decimal = TxtIVA.Text.ToDecimal - IVADetalles If Not TmpDT.Columns.Contains("AplicaIEPS") Then @@ -8561,18 +8580,14 @@ Partial Class Compras_Compras Dim IndiceUltimo As Integer = 0 For Each dRow As DataRow In TmpDT.Rows - If Boolean.Parse(dRow("AplicaIEPS").ToString) And Boolean.Parse(dRow("IEPSGrabaIVA").ToString) = False And dRow("IVA").ToString.ToDecimal > 0 Then IndiceUltimo = IndiceContador End If - IndiceContador = IndiceContador + 1 - Next - - Dim IVADetalles As Decimal = TmpDT.SUM("IVA", " IVA > 0 ").ToDecimal - Dim DiferenciaIVas As Decimal = TxtIVA.Text.ToDecimal - IVADetalles + IVADetalles = TmpDT.SUM("IVA", " IVA > 0 ").ToDecimal + DiferenciaIVas = TxtIVA.Text.ToDecimal - IVADetalles If Math.Abs(DiferenciaIVas) > 0.01D Then TmpDT.Rows(IndiceUltimo)("IVA") = TmpDT.Rows(IndiceUltimo)("IVA").ToString.ToDecimal + DiferenciaIVas @@ -8582,7 +8597,36 @@ Partial Class Compras_Compras End If - End Sub + 'Revalidacion de ajuste + IVADetalles = TmpDT.SUM("IVA", " IVA > 0 ").ToDecimal + DiferenciaIVas = TxtIVA.Text.ToDecimal - IVADetalles + + + + If Math.Abs(DiferenciaIVas) > 0.01D Then + + If IVADetalles > 0 Then + + For Each dRow As DataRow In TmpDT.Rows + If dRow("IVA").ToString.ToDecimal > 0 Then + dRow("IVA") = dRow("IVA").ToString.ToDecimal + DiferenciaIVas + TmpDT.AcceptChanges() + Respuesta = True + Exit For + End If + Next + + Else + Alert("Los productos especificados en el lisado no tienen asigando impuesto IVA, favor de realizar la correción en el producto que aplique el impúesto.", TipoMensaje.MsgAdvertencia) + Respuesta = False + End If + Else + Respuesta = True + End If + + Return Respuesta + + End Function Protected Sub TxtCodigo_TextChanged(sender As Object, e As System.EventArgs) Handles TxtCodigo.TextChanged Dim ObjProveedores As New ClsCompProveedores() @@ -12650,6 +12694,7 @@ Partial Class Compras_Compras TmpDT.Rows(Indice)("PU") = TmpDT.Rows(Indice)("PU").ToString.ToDouble + tPU TmpDT.Rows(Indice)("Total") = TmpDT.Rows(Indice)("Total").ToString.ToDouble + ImporteAjuste TmpDT.Rows(Indice)("IEPSPS") = (TmpDT.Rows(Indice)("Total").ToString.ToDouble() * TmpDT.Rows(Indice)("IEPSPSPorcentaje").ToString.ToDouble()).RoundAD(2) + TmpDT.Rows(Indice)("IVA") = TmpDT.Rows(Indice)("PU").ToString.ToDecimal * TmpDT.Rows(Indice)("Cantidad").ToString.ToDecimal * TmpDT.Rows(Indice)("IVAPorcentaje").ToString.ToDecimal 'Row("IEPSPS") = Math.Round(IEPSPS, DecimalesPermitidos) 'Row("IEPSPSPorcentaje") = PorcentajeIEPS TmpDT.AcceptChanges() diff --git a/Empresas/72/Formatos/ResguardoAF.rdlc b/Empresas/72/Formatos/ResguardoAF.rdlc index 46a19ecc7..a3f114ece 100644 --- a/Empresas/72/Formatos/ResguardoAF.rdlc +++ b/Empresas/72/Formatos/ResguardoAF.rdlc @@ -1287,7 +1287,7 @@ - 8.4664cm + 7.77848cm true true @@ -1573,51 +1573,6 @@ 2pt - - true - true - - - - - Fecha Impresión: - - - - - - - - =Today - - - - - - 2pt - 2pt - 2pt - 2pt - -