compras a decimal

This commit is contained in:
2021-10-02 13:27:48 -07:00
parent 0b77a695bc
commit 211a72aa6d

View File

@@ -2358,16 +2358,16 @@ Partial Class Compras_Compras
CveTipoPS = PSS.Rows(0)("CveTipoPS").ToString.ToEntero CveTipoPS = PSS.Rows(0)("CveTipoPS").ToString.ToEntero
End If End If
Dim Cantidad As Double = 1 Dim Cantidad As Decimal = 1
Dim CveSubProyectoContrato As String = "-1" Dim CveSubProyectoContrato As String = "-1"
Dim CveProyecto As String = "-1" Dim CveProyecto As String = "-1"
Dim SubProyecto As String = "SE" Dim SubProyecto As String = "SE"
Dim Proyecto As String = "SE" Dim Proyecto As String = "SE"
Dim Obs As String = "" Dim Obs As String = ""
Dim PU As Double = IEPS Dim PU As Decimal = IEPS
Dim Total As Double = Cantidad * PU Dim Total As Decimal = Cantidad * PU
Dim IVA As Double = 0 Dim IVA As Decimal = 0
Dim Descuento As Double = 0 Dim Descuento As Decimal = 0
If PSS2.Rows.Count > 0 Then If PSS2.Rows.Count > 0 Then
CveUM = PSS2.Rows(0)("CveUM").ToString.ToEntero CveUM = PSS2.Rows(0)("CveUM").ToString.ToEntero
@@ -3539,7 +3539,7 @@ Partial Class Compras_Compras
Dim Total As Decimal = 0 Dim Total As Decimal = 0
Dim PU As Decimal = 0 Dim PU As Decimal = 0
Dim Descuento As Double = 0 Dim Descuento As Decimal = 0
Dim CveUM As Integer = 0 Dim CveUM As Integer = 0
Dim UMM As String = "No Aplica" Dim UMM As String = "No Aplica"
Dim tCvePS As Integer = 0 Dim tCvePS As Integer = 0
@@ -3551,14 +3551,14 @@ Partial Class Compras_Compras
Dim PSS As String = "" Dim PSS As String = ""
Dim Obs As String = "" Dim Obs As String = ""
Dim SubTotalTemp = 0.0D Dim SubTotalTemp = 0.0D
Dim IVA As Double = 0 Dim IVA As Decimal = 0
Dim IEPS As Double = 0 Dim IEPS As Decimal = 0
Dim RetISR As Double = 0 Dim RetISR As Decimal = 0
Dim RetIVA As Double = 0 Dim RetIVA As Decimal = 0
Dim PorcentajeIVA As Double = 0 Dim PorcentajeIVA As Decimal = 0
Dim PorcentajeIEPS As Double = 0 Dim PorcentajeIEPS As Decimal = 0
Dim PorcentajeRetISR As Double = 0 Dim PorcentajeRetISR As Decimal = 0
Dim PorcentajeRetIVA As Double = 0 Dim PorcentajeRetIVA As Decimal = 0
Dim DtTemporalGuardados = New DataTable Dim DtTemporalGuardados = New DataTable
DtTemporalGuardados.Columns.Add("Contador", GetType(Integer)) DtTemporalGuardados.Columns.Add("Contador", GetType(Integer))
DtTemporalGuardados.Columns.Add("Tipo", GetType(Integer)) DtTemporalGuardados.Columns.Add("Tipo", GetType(Integer))
@@ -3622,7 +3622,7 @@ Partial Class Compras_Compras
If ValorXML(node, "cantidad").ToDecimal > 0 AndAlso ValorXML(node, "valorUnitario").ToDecimal >= (ValorXML(node, "importe").ToDecimal / ValorXML(node, "cantidad").ToDecimal) Then If ValorXML(node, "cantidad").ToDecimal > 0 AndAlso ValorXML(node, "valorUnitario").ToDecimal >= (ValorXML(node, "importe").ToDecimal / ValorXML(node, "cantidad").ToDecimal) Then
PU = ValorXML(node, "importe").ToDecimal / ValorXML(node, "cantidad").ToDecimal PU = ValorXML(node, "importe").ToDecimal / ValorXML(node, "cantidad").ToDecimal
End If End If
If ValorXML(node, "cantidad").ToDecimal > 0 AndAlso ValorXML(node, "valorUnitario").ToDouble <= 0 And ValorXML(node, "importe").ToDouble > 0 Then If ValorXML(node, "cantidad").ToDecimal > 0 AndAlso ValorXML(node, "valorUnitario").ToDecimal <= 0 And ValorXML(node, "importe").ToDecimal > 0 Then
PU = ValorXML(node, "importe").ToDecimal / ValorXML(node, "cantidad").ToDecimal PU = ValorXML(node, "importe").ToDecimal / ValorXML(node, "cantidad").ToDecimal
End If End If
@@ -3630,7 +3630,7 @@ Partial Class Compras_Compras
'OBTIENE DESCUENTO 'OBTIENE DESCUENTO
If ValorXML(node, "descuento") IsNot Nothing Then Descuento = ValorXML(node, "descuento").Trim.ToDouble If ValorXML(node, "descuento") IsNot Nothing Then Descuento = ValorXML(node, "descuento").Trim.ToDecimal
'OBTIENE TOTAL 'OBTIENE TOTAL
If ValorXML(node, "importe") IsNot Nothing Then Total = ValorXML(node, "importe").Trim.ToDecimal If ValorXML(node, "importe") IsNot Nothing Then Total = ValorXML(node, "importe").Trim.ToDecimal
@@ -3820,7 +3820,7 @@ Partial Class Compras_Compras
'' AGREGA PS '' AGREGA PS
'AGREGA A TMPDT 'AGREGA A TMPDT
AddPS(ValorXML(node, "cantidad").ToDouble, CveUM, UMM, tCveClasif, Clasif, tCvePS, PSS, TipoPS, "-1", "SE", "SE", "-1", Obs, PU, Total, IVA, RetIVA, RetISR, IEPS, 0, Descuento, PSCodigo:=tPSCodigo, TCalculaTotales:=False, CveSATPS:=ValorXML(node, "ClaveProdServ").ToEntero(), CargaXml:=True, PorcentajeIVA:=PorcentajeIVA, PorcentajeRetIVA:=PorcentajeRetIVA, PorcentajeRetISR:=PorcentajeRetISR, PorcentajeIEPS:=PorcentajeIEPS) AddPS(ValorXML(node, "cantidad").ToDecimal, CveUM, UMM, tCveClasif, Clasif, tCvePS, PSS, TipoPS, "-1", "SE", "SE", "-1", Obs, PU, Total, IVA, RetIVA, RetISR, IEPS, 0, Descuento, PSCodigo:=tPSCodigo, TCalculaTotales:=False, CveSATPS:=ValorXML(node, "ClaveProdServ").ToEntero(), CargaXml:=True, PorcentajeIVA:=PorcentajeIVA, PorcentajeRetIVA:=PorcentajeRetIVA, PorcentajeRetISR:=PorcentajeRetISR, PorcentajeIEPS:=PorcentajeIEPS)
@@ -5117,13 +5117,13 @@ Partial Class Compras_Compras
'AGREGA COMPRA DETALLE 'AGREGA COMPRA DETALLE
If Not ObjCompras.AddCompraDetalle(CveCompra, Row("CveUM").ToString.ToEntero, Row("CvePS").ToString.ToEntero, Row("CveSubProyecto").ToString.ToEntero, -1, CveAF, If Not ObjCompras.AddCompraDetalle(CveCompra, Row("CveUM").ToString.ToEntero, Row("CvePS").ToString.ToEntero, Row("CveSubProyecto").ToString.ToEntero, -1, CveAF,
Row("Cantidad").ToString.ToDouble, Row("PU").ToString.ToDouble, Row("IVA").ToString.ToDouble, Row("Total").ToString.ToDouble, Row("Descuento").ToString.ToDouble, Row("Cantidad").ToString.ToDecimal, Row("PU").ToString.ToDecimal, Row("IVA").ToString.ToDecimal, Row("Total").ToString.ToDecimal, Row("Descuento").ToString.ToDecimal,
Row("Obs").ToString, Row("CveOrdenCompraDetalle").ToString.ToEntero, TipoRecepcion, Row("CveContrato").ToString.ToEntero, Row("CvePresupuestoEgreso").ToString.ToEntero, Row("Obs").ToString, Row("CveOrdenCompraDetalle").ToString.ToEntero, TipoRecepcion, Row("CveContrato").ToString.ToEntero, Row("CvePresupuestoEgreso").ToString.ToEntero,
AplicaCostoIndirecto:=Row("AplicaCostoIndirecto").ToString.ToEntero, EstatusAlmacen:=Row("EntregaDirecta").ToString.ToEntero, CvePersonal:=CvePersonal, AplicaCostoIndirecto:=Row("AplicaCostoIndirecto").ToString.ToEntero, EstatusAlmacen:=Row("EntregaDirecta").ToString.ToEntero, CvePersonal:=CvePersonal,
CveTipoGasto:=Row("CveTipoGasto").ToString.ToEntero, AF_Medida:=Row("AFMedida").ToString.ToEntero, AF_TipoMantenimiento:=Row("AFTipoMantenimiento").ToString.ToEntero, Referencia:=Referencia, OtrosGastos:=Row("OtrosGastos").ToString.ToDecimal, CveTipoGasto:=Row("CveTipoGasto").ToString.ToEntero, AF_Medida:=Row("AFMedida").ToString.ToEntero, AF_TipoMantenimiento:=Row("AFTipoMantenimiento").ToString.ToEntero, Referencia:=Referencia, OtrosGastos:=Row("OtrosGastos").ToString.ToDecimal,
RetIVA:=Row("RetIVA").ToString.ToDouble, RetISR:=Row("RetISR").ToString.ToDouble, IEPSPS:=Row("IEPSPS").ToString.ToDouble.RoundSQL, IEPSPSIVA:=Row("IEPSPSIVA").ToString.ToDouble, RetIVA:=Row("RetIVA").ToString.ToDecimal, RetISR:=Row("RetISR").ToString.ToDecimal, IEPSPS:=Row("IEPSPS").ToString.ToDecimal.RoundSQL, IEPSPSIVA:=Row("IEPSPSIVA").ToString.ToDecimal,
IVAPorcentaje:=Row("IVAPorcentaje").ToString.ToDouble, RetIVAPorcentaje:=Row("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=Row("RetISRPorcentaje").ToString.ToDouble, IVAPorcentaje:=Row("IVAPorcentaje").ToString.ToDecimal, RetIVAPorcentaje:=Row("RetIVAPorcentaje").ToString.ToDecimal, RetISRPorcentaje:=Row("RetISRPorcentaje").ToString.ToDecimal,
IEPSPSPorcentaje:=Row("IEPSPSPorcentaje").ToString.ToDouble, IEPSPSIVAPorcentaje:=Row("IEPSPSIVAPorcentaje").ToString.ToDouble, NoDeducible:=If((Row("NoDeducible").ToString().ToUpper().Contiene("TRUE", "1")) AndAlso EsNoDeducible, True, False), IEPSPSPorcentaje:=Row("IEPSPSPorcentaje").ToString.ToDecimal, IEPSPSIVAPorcentaje:=Row("IEPSPSIVAPorcentaje").ToString.ToDecimal, NoDeducible:=If((Row("NoDeducible").ToString().ToUpper().Contiene("TRUE", "1")) AndAlso EsNoDeducible, True, False),
CveContratoDetalle:=Row("CveContratoDetalle").ToString.ToEntero, CveCultivoCuadroDetalle:=Row("CveCultivoCuadroDetalle").ToString.ToEntero) Then CveContratoDetalle:=Row("CveContratoDetalle").ToString.ToEntero, CveCultivoCuadroDetalle:=Row("CveCultivoCuadroDetalle").ToString.ToEntero) Then
ErrorDetalles = True ErrorDetalles = True
@@ -10258,13 +10258,13 @@ Partial Class Compras_Compras
End If End If
If Not ObjCompra.AddCompraDetalle(CveCompra, Row("CveUM").ToString.ToEntero, Row("CvePS").ToString.ToEntero, Row("CveSubProyecto").ToString.ToEntero, -1, CveAF, If Not ObjCompra.AddCompraDetalle(CveCompra, Row("CveUM").ToString.ToEntero, Row("CvePS").ToString.ToEntero, Row("CveSubProyecto").ToString.ToEntero, -1, CveAF,
Row("Cantidad").ToString.ToDouble, Row("PU").ToString.ToDouble, Row("IVA").ToString.ToDouble, Row("Total").ToString.ToDouble, Row("Descuento").ToString.ToDouble, Row("Cantidad").ToString.ToDecimal, Row("PU").ToString.ToDecimal, Row("IVA").ToString.ToDecimal, Row("Total").ToString.ToDecimal, Row("Descuento").ToString.ToDecimal,
Row("Obs").ToString, Row("CveOrdenCompraDetalle").ToString.ToEntero, TipoRecepcion, Row("CveContrato").ToString.ToEntero, Row("CvePresupuestoEgreso").ToString.ToEntero, Row("Obs").ToString, Row("CveOrdenCompraDetalle").ToString.ToEntero, TipoRecepcion, Row("CveContrato").ToString.ToEntero, Row("CvePresupuestoEgreso").ToString.ToEntero,
AplicaCostoIndirecto:=Row("AplicaCostoIndirecto").ToString.ToEntero, EstatusAlmacen:=Row("EntregaDirecta").ToString.ToEntero, CvePersonal:=CvePersonal, AplicaCostoIndirecto:=Row("AplicaCostoIndirecto").ToString.ToEntero, EstatusAlmacen:=Row("EntregaDirecta").ToString.ToEntero, CvePersonal:=CvePersonal,
CveTipoGasto:=Row("CveTipoGasto").ToString.ToEntero, AF_Medida:=Row("AFMedida").ToString.ToEntero, AF_TipoMantenimiento:=Row("AFTipoMantenimiento").ToString.ToEntero, Referencia:=Referencia, OtrosGastos:=Row("OtrosGastos").ToString.ToDecimal, CveTipoGasto:=Row("CveTipoGasto").ToString.ToEntero, AF_Medida:=Row("AFMedida").ToString.ToEntero, AF_TipoMantenimiento:=Row("AFTipoMantenimiento").ToString.ToEntero, Referencia:=Referencia, OtrosGastos:=Row("OtrosGastos").ToString.ToDecimal,
RetIVA:=Row("RetIVA").ToString.ToDouble, RetISR:=Row("RetISR").ToString.ToDouble, IEPSPS:=Row("IEPSPS").ToString.ToDouble.RoundSQL, IEPSPSIVA:=Row("IEPSPSIVA").ToString.ToDouble, RetIVA:=Row("RetIVA").ToString.ToDecimal, RetISR:=Row("RetISR").ToString.ToDecimal, IEPSPS:=Row("IEPSPS").ToString.ToDecimal.RoundSQL, IEPSPSIVA:=Row("IEPSPSIVA").ToString.ToDecimal,
IVAPorcentaje:=Row("IVAPorcentaje").ToString.ToDouble, RetIVAPorcentaje:=Row("RetIVAPorcentaje").ToString.ToDouble, RetISRPorcentaje:=Row("RetISRPorcentaje").ToString.ToDouble, IVAPorcentaje:=Row("IVAPorcentaje").ToString.ToDecimal, RetIVAPorcentaje:=Row("RetIVAPorcentaje").ToString.ToDecimal, RetISRPorcentaje:=Row("RetISRPorcentaje").ToString.ToDecimal,
IEPSPSPorcentaje:=Row("IEPSPSPorcentaje").ToString.ToDouble, IEPSPSIVAPorcentaje:=Row("IEPSPSIVAPorcentaje").ToString.ToDouble, NoDeducible:=If((Row("NoDeducible").ToString().ToUpper().Contiene("TRUE", "1")) AndAlso EsNoDeducible, True, False), IEPSPSPorcentaje:=Row("IEPSPSPorcentaje").ToString.ToDecimal, IEPSPSIVAPorcentaje:=Row("IEPSPSIVAPorcentaje").ToString.ToDecimal, NoDeducible:=If((Row("NoDeducible").ToString().ToUpper().Contiene("TRUE", "1")) AndAlso EsNoDeducible, True, False),
CveContratoDetalle:=Row("CveContratoDetalle").ToString.ToEntero, CveCultivoCuadroDetalle:=Row("CveCultivoCuadroDetalle").ToString.ToEntero) Then CveContratoDetalle:=Row("CveContratoDetalle").ToString.ToEntero, CveCultivoCuadroDetalle:=Row("CveCultivoCuadroDetalle").ToString.ToEntero) Then
Retorno = False Retorno = False
@@ -15111,22 +15111,22 @@ Partial Class Compras_Compras
Dim CveTipoPS As Integer = dr("CveTipoPS").ToString.ToEntero Dim CveTipoPS As Integer = dr("CveTipoPS").ToString.ToEntero
Dim Proyecto As String = dr("Proyecto").ToString Dim Proyecto As String = dr("Proyecto").ToString
Dim Obs As String = dr("Obs").ToString Dim Obs As String = dr("Obs").ToString
Dim PU As Double = dr("PU").ToString.ToDouble Dim PU As Decimal = dr("PU").ToString.ToDecimal
Dim IVA As Double = dr("IVA").ToString.ToDouble Dim IVA As Decimal = dr("IVA").ToString.ToDecimal
Dim RetIVA As Double = dr("RetIVA").ToString.ToDouble Dim RetIVA As Decimal = dr("RetIVA").ToString.ToDecimal
Dim RetISR As Double = dr("RetISR").ToString.ToDouble Dim RetISR As Decimal = dr("RetISR").ToString.ToDecimal
Dim IEPSPS As Double = dr("IEPSPSPorcentaje").ToString.ToDouble Dim IEPSPS As Decimal = dr("IEPSPSPorcentaje").ToString.ToDecimal
Dim IEPSPSIVA As Double = If(dr("IEPSGrabaIVA").ToString = "True", dr("IEPSPorcentaje").ToString.ToDouble, 0) Dim IEPSPSIVA As Decimal = If(dr("IEPSGrabaIVA").ToString = "True", dr("IEPSPorcentaje").ToString.ToDecimal, 0)
Dim Descuento As Double = dr("Descuento").ToString.ToDouble Dim Descuento As Decimal = dr("Descuento").ToString.ToDecimal
Dim CveOrdenCompraDetalle As Integer = dr("CveOrdenCompraDetalle").ToString.ToEntero Dim CveOrdenCompraDetalle As Integer = dr("CveOrdenCompraDetalle").ToString.ToEntero
For Each cadena As String In porcentajes For Each cadena As String In porcentajes
Dim valores As String() = cadena.Split(New Char() {","c}) Dim valores As String() = cadena.Split(New Char() {","c})
Dim Cantidad As Double = dr("Cantidad").ToString.ToDouble * (valores(1).ToDouble / 100) Dim Cantidad As Decimal = dr("Cantidad").ToString.ToDecimal * (valores(1).ToDecimal / 100)
Dim CveSubProyectoContrato As String = valores(0) Dim CveSubProyectoContrato As String = valores(0)
Dim CveProyecto As String = valores(0) Dim CveProyecto As String = valores(0)
Dim Total As Double = Cantidad * PU Dim Total As Decimal = Cantidad * PU
Dim drT As DataRow = GBSP.FiltroPrimero(String.Format("CveSubProyecto = {0} ", CveSubProyectoContrato)) Dim drT As DataRow = GBSP.FiltroPrimero(String.Format("CveSubProyecto = {0} ", CveSubProyectoContrato))
Dim drq As DataRow = GBSP.FiltroPrimero(String.Format("CveProyecto = {0} ", CveProyecto)) Dim drq As DataRow = GBSP.FiltroPrimero(String.Format("CveProyecto = {0} ", CveProyecto))
Dim SubProyecto As String = drT("SubProyecto").ToString Dim SubProyecto As String = drT("SubProyecto").ToString
@@ -15414,14 +15414,14 @@ Partial Class Compras_Compras
DivTipoCambioOC.Visible = False DivTipoCambioOC.Visible = False
End If End If
DTOCTemp.Columns.Add("PUTC", GetType(Double)) DTOCTemp.Columns.Add("PUTC", GetType(Decimal))
DTOCTemp.Columns.Add("TotalTC", GetType(Double)) DTOCTemp.Columns.Add("TotalTC", GetType(Decimal))
DTOCTemp.Columns.Add("DescuentoTC", GetType(Double)) DTOCTemp.Columns.Add("DescuentoTC", GetType(Decimal))
DTOCTemp.Columns.Add("IVATC", GetType(Double)) DTOCTemp.Columns.Add("IVATC", GetType(Decimal))
DTOCTemp.Columns.Add("IEPSPSTC", GetType(Double)) DTOCTemp.Columns.Add("IEPSPSTC", GetType(Decimal))
DTOCTemp.Columns.Add("IEPSPSIVATC", GetType(Double)) DTOCTemp.Columns.Add("IEPSPSIVATC", GetType(Decimal))
DTOCTemp.Columns.Add("RetIVATC", GetType(Double)) DTOCTemp.Columns.Add("RetIVATC", GetType(Decimal))
DTOCTemp.Columns.Add("RetISRTC", GetType(Double)) DTOCTemp.Columns.Add("RetISRTC", GetType(Decimal))
DTOCTemp.Columns.Add("FolioAlmacen", GetType(String)) DTOCTemp.Columns.Add("FolioAlmacen", GetType(String))
For Each Dr As DataRow In DTOCTemp.Rows For Each Dr As DataRow In DTOCTemp.Rows
Dr("PUTC") = Dr("Importe") Dr("PUTC") = Dr("Importe")
@@ -15855,11 +15855,11 @@ Partial Class Compras_Compras
'Dim IEPSPS As Double = gvr.FCHiddenField("HdnOC1IEPSImporte").Value.ToDecimal 'Dim IEPSPS As Double = gvr.FCHiddenField("HdnOC1IEPSImporte").Value.ToDecimal
'Dim IEPSPSIVA As Double = gvr.FCHiddenField("HdnOC1IEPSIVA").Value.ToDecimal 'Dim IEPSPSIVA As Double = gvr.FCHiddenField("HdnOC1IEPSIVA").Value.ToDecimal
Dim IVA As Decimal = dr("IVAPorcentaje").ToString.ToDecimal Dim IVA As Decimal = dr("IVAPorcentaje").ToString.ToDecimal
Dim RetIVA As Double = dr("RetIVAPorcentaje").ToString.ToDecimal Dim RetIVA As Decimal = dr("RetIVAPorcentaje").ToString.ToDecimal
Dim RetISR As Double = dr("RetISRPorcentaje").ToString.ToDecimal Dim RetISR As Decimal = dr("RetISRPorcentaje").ToString.ToDecimal
Dim IEPSPS As Double = dr("IEPSPSPorcentaje").ToString.ToDecimal Dim IEPSPS As Decimal = dr("IEPSPSPorcentaje").ToString.ToDecimal
Dim IEPSPSIVA As Double = dr("IEPSPSIVAPorcentaje").ToString.ToDecimal Dim IEPSPSIVA As Decimal = dr("IEPSPSIVAPorcentaje").ToString.ToDecimal
Dim Descuento As Double = If(TieneAmortizacion, TxtDescuento.Text.ToDouble / TotalRows, gvr.FCHiddenField("HdnOC1Descuento").Value.ToDecimal) Dim Descuento As Decimal = If(TieneAmortizacion, TxtDescuento.Text.ToDecimal / TotalRows, gvr.FCHiddenField("HdnOC1Descuento").Value.ToDecimal)
'Dim Descuento As Double = gvr.FCHiddenField("HdnOC1Descuento").Value.ToDecimal 'Dim Descuento As Double = gvr.FCHiddenField("HdnOC1Descuento").Value.ToDecimal
Dim CveOrdenCompraDetalle As Integer = dr("CveOrdenCompraDetalle").ToString.ToEntero Dim CveOrdenCompraDetalle As Integer = dr("CveOrdenCompraDetalle").ToString.ToEntero
Dim EntregaDirecta As Integer = dr("EntregaDirecta").ToString.ToEntero Dim EntregaDirecta As Integer = dr("EntregaDirecta").ToString.ToEntero
@@ -16037,7 +16037,7 @@ Partial Class Compras_Compras
OCVinculada = True OCVinculada = True
UpPSS.Update() UpPSS.Update()
AsignaValoresOriginales(TxtSubTotal.Text.ToDouble, TxtSubTotal2.Text.ToDouble, TxtIVA.Text.ToDouble, TxtRetIVA.Text.ToDouble, TxtRetISR.Text.ToDouble, TxtTotal.Text.ToDouble) AsignaValoresOriginales(TxtSubTotal.Text.ToDecimal, TxtSubTotal2.Text.ToDecimal, TxtIVA.Text.ToDecimal, TxtRetIVA.Text.ToDecimal, TxtRetISR.Text.ToDecimal, TxtTotal.Text.ToDecimal)
CargaGvInv() CargaGvInv()
@@ -16122,11 +16122,11 @@ Partial Class Compras_Compras
Dim Total As Decimal = gvr.FCTextBox("TxtTotalOC1").Text.ToDecimal Dim Total As Decimal = gvr.FCTextBox("TxtTotalOC1").Text.ToDecimal
Dim IVA As Decimal = dr("IVAPorcentaje").ToString.ToDecimal Dim IVA As Decimal = dr("IVAPorcentaje").ToString.ToDecimal
Dim RetIVA As Double = dr("RetIVAPorcentaje").ToString.ToDecimal Dim RetIVA As Decimal = dr("RetIVAPorcentaje").ToString.ToDecimal
Dim RetISR As Double = dr("RetISRPorcentaje").ToString.ToDecimal Dim RetISR As Decimal = dr("RetISRPorcentaje").ToString.ToDecimal
Dim IEPSPS As Double = dr("IEPSPSPorcentaje").ToString.ToDecimal Dim IEPSPS As Decimal = dr("IEPSPSPorcentaje").ToString.ToDecimal
Dim IEPSPSIVA As Double = dr("IEPSPSIVAPorcentaje").ToString.ToDecimal Dim IEPSPSIVA As Decimal = dr("IEPSPSIVAPorcentaje").ToString.ToDecimal
Dim Descuento As Double = gvr.FCHiddenField("HdnOC1Descuento").Value.ToDecimal Dim Descuento As Decimal = gvr.FCHiddenField("HdnOC1Descuento").Value.ToDecimal
Dim CveOrdenCompraDetalle As Integer = dr("CveOrdenCompraDetalle").ToString.ToEntero Dim CveOrdenCompraDetalle As Integer = dr("CveOrdenCompraDetalle").ToString.ToEntero
Dim EntregaDirecta As Integer = dr("EntregaDirecta").ToString.ToEntero Dim EntregaDirecta As Integer = dr("EntregaDirecta").ToString.ToEntero
Dim CveSATPS As Integer = gvr.FCDropDownLost("DdlSATPS").SelectedValue.ToEntero Dim CveSATPS As Integer = gvr.FCDropDownLost("DdlSATPS").SelectedValue.ToEntero
@@ -16211,7 +16211,7 @@ Partial Class Compras_Compras
CargaVinculacionOC() CargaVinculacionOC()
End Sub End Sub
Protected Sub BtnDividirCompra_Click(sender As Object, e As EventArgs) Protected Sub BtnDividirCompra_Click(sender As Object, e As EventArgs)
Dim Cantidad = CType(CType(sender, Button).NamingContainer, GridViewRow).FCTextBox("TxtDividir").Text.ToDouble Dim Cantidad = CType(CType(sender, Button).NamingContainer, GridViewRow).FCTextBox("TxtDividir").Text.ToDecimal
If Cantidad < 0.1 Then If Cantidad < 0.1 Then
Exit Sub Exit Sub
@@ -16222,10 +16222,10 @@ Partial Class Compras_Compras
drNuevo.ItemArray = dr.ItemArray drNuevo.ItemArray = dr.ItemArray
drNuevo("Cantidad") = Cantidad drNuevo("Cantidad") = Cantidad
drNuevo("Total") = drNuevo("Cantidad").ToString.ToEntero * drNuevo("PU").ToString.ToDouble drNuevo("Total") = drNuevo("Cantidad").ToString.ToEntero * drNuevo("PU").ToString.ToDecimal
dr("Cantidad") = dr("Cantidad").ToString.ToEntero - Cantidad dr("Cantidad") = dr("Cantidad").ToString.ToEntero - Cantidad
dr("Total") = dr("Cantidad").ToString.ToEntero * dr("PU").ToString.ToDouble dr("Total") = dr("Cantidad").ToString.ToEntero * dr("PU").ToString.ToDecimal
TmpDT.Rows.InsertAt(drNuevo, CType(CType(sender, Button).NamingContainer, GridViewRow).RowIndex) TmpDT.Rows.InsertAt(drNuevo, CType(CType(sender, Button).NamingContainer, GridViewRow).RowIndex)
@@ -18173,15 +18173,15 @@ Partial Class Compras_Compras
If PSRow IsNot Nothing Then If PSRow IsNot Nothing Then
SATClavePS = PSRow("SATClavePS").ToString.ToEntero SATClavePS = PSRow("SATClavePS").ToString.ToEntero
End If End If
Dim IVA As Double Dim IVA As Decimal
If chkImportacion.Checked Then If chkImportacion.Checked Then
IVA = (txtImportacion.Text.Trim.ToDouble / (TxtCantidad.Text.Trim.ToDouble * TxtPrecio.Text.Trim.ToDouble)) IVA = (txtImportacion.Text.Trim.ToDecimal / (TxtCantidad.Text.Trim.ToDecimal * TxtPrecio.Text.Trim.ToDecimal))
Else Else
IVA = Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2) IVA = Math.Round(DdlIVA.SelectedValue.ToDecimal - 1, 2)
End If 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, AddPS(TxtCantidad.Text.Trim.ToDecimal, 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, DdlSubProyecto.SelectedValue.ToString, DdlSubProyecto.SelectedItem.Text, DdlProyecto.SelectedItem.Text, DdlProyecto.SelectedValue.ToString, TxtObsPS.Text.Trim, TxtPrecio.Text.Trim.ToDecimal, 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, TxtRetIVAModal.Text.ToDecimal / 100, TxtRetISRModal.Text.ToDecimal / 100, TxtIEPSModal.Text.ToDecimal / 100, 0, TxtDescuentoModal.Text.ToDecimal, OtrosGastos:=TxtOtrosGastos.Text.ToDecimal, CveTipoGasto:=DdlTipoGasto.SelectedValue.ToEntero, TipoGasto:=DdlTipoGasto.SelectedItem.Text,
NoDeducible:=ChkEsNoDeduciblePS.Checked, CveSATPS:=SATClavePS, CveContratoDetalle:=CveContratoDetalle) NoDeducible:=ChkEsNoDeduciblePS.Checked, CveSATPS:=SATClavePS, CveContratoDetalle:=CveContratoDetalle)
AddPS2() AddPS2()
@@ -18218,11 +18218,11 @@ Partial Class Compras_Compras
''' Regresa el INDEX del row que acaba de agregar en el TMPDT ''' Regresa el INDEX del row que acaba de agregar en el TMPDT
''' </summary> ''' </summary>
''' <returns></returns> ''' <returns></returns>
Private Function AddPS(Cantidad As Double, CveUM As Integer, UM As String, CveClasificacion As Integer, Clasificacion As String, CvePS As Integer, PS As String, CveTipoPS As Integer, CveSubProyectoContrato As String, SubProyecto As String, Proyecto As String, CveProyecto As String, Private Function AddPS(Cantidad As Decimal, CveUM As Integer, UM As String, CveClasificacion As Integer, Clasificacion As String, CvePS As Integer, PS As String, CveTipoPS As Integer, CveSubProyectoContrato As String, SubProyecto As String, Proyecto As String, CveProyecto As String,
Obs As String, PU As Double, Total As Double, IVA As Double, RetIVA As Double, RetISR As Double, IEPSPS As Double, IEPSPSIVA As Double, Descuento As Double, Optional CveOrdenCompraDetalle As Integer = -1, Optional TCalculaTotales As Boolean = True, Obs As String, PU As Decimal, Total As Decimal, IVA As Decimal, RetIVA As Decimal, RetISR As Decimal, IEPSPS As Decimal, IEPSPSIVA As Decimal, Descuento As Decimal, Optional CveOrdenCompraDetalle As Integer = -1, Optional TCalculaTotales As Boolean = True,
Optional PSCodigo As String = "-", Optional PSDescripcion As String = "-", Optional CantidadF As Double = -1, Optional EntregaDirecta As Integer = -1, Optional OtrosGastos As Double = 0, Optional PSCodigo As String = "-", Optional PSDescripcion As String = "-", Optional CantidadF As Double = -1, Optional EntregaDirecta As Integer = -1, Optional OtrosGastos As Decimal = 0,
Optional CveSATPS As Integer = -1, Optional CargaXml As Boolean = False, Optional CveTipoGasto As Integer = -1, Optional TipoGasto As String = "", Optional PorcentajeIVA As Double = 0, Optional CveSATPS As Integer = -1, Optional CargaXml As Boolean = False, Optional CveTipoGasto As Integer = -1, Optional TipoGasto As String = "", Optional PorcentajeIVA As Decimal = 0,
Optional PorcentajeIEPS As Double = 0, Optional PorcentajeRetIVA As Double = 0, Optional PorcentajeRetISR As Double = 0, Optional NoDeducible As Boolean = False, Optional CveContratoDetalle As Integer = -1, Optional CveCultivoCuadroDetalle As Integer = -1, Optional CveSATPSActualizado As Boolean = False) As Integer Optional PorcentajeIEPS As Decimal = 0, Optional PorcentajeRetIVA As Decimal = 0, Optional PorcentajeRetISR As Decimal = 0, Optional NoDeducible As Boolean = False, Optional CveContratoDetalle As Integer = -1, Optional CveCultivoCuadroDetalle As Integer = -1, Optional CveSATPSActualizado As Boolean = False) As Integer
Dim Row As DataRow = Nothing Dim Row As DataRow = Nothing
@@ -18329,17 +18329,17 @@ Partial Class Compras_Compras
Row("IEPSPSPorcentaje") = PorcentajeIEPS Row("IEPSPSPorcentaje") = PorcentajeIEPS
Else Else
'If DdlIVA.SelectedValue.ToDouble = 0 Then Row("IVA") = 0 Else Row("IVA") = Math.Round(IVA * Total, DecimalesPermitidos) 'If DdlIVA.SelectedValue.ToDouble = 0 Then Row("IVA") = 0 Else Row("IVA") = Math.Round(IVA * Total, DecimalesPermitidos)
Row("IVA") = Math.Round(IVA * Total, 2) Row("IVA") = (IVA * Total).RoundSQL
Row("IVAPorcentaje") = IVA Row("IVAPorcentaje") = IVA
Row("RetIVA") = Math.Round(RetIVA * Total, 2) Row("RetIVA") = (RetIVA * Total).RoundSQL
Row("RetIVAPorcentaje") = RetIVA Row("RetIVAPorcentaje") = RetIVA
Row("RetISR") = Math.Round(RetISR * Total, 2) Row("RetISR") = (RetISR * Total).RoundSQL
Row("RetISRPorcentaje") = RetISR Row("RetISRPorcentaje") = RetISR
Row("IEPSPS") = Math.Round(IEPSPS * Total, 2) Row("IEPSPS") = (IEPSPS * Total).RoundSQL
Row("IEPSPSPorcentaje") = IEPSPS Row("IEPSPSPorcentaje") = IEPSPS
End If End If
Row("ImporteConImpuestos") = (Row("Cantidad").ToString.ToDouble * Row("PU").ToString.ToDouble) + Row("IVA").ToString.ToDouble + Row("IEPSPS").ToString.ToDouble - (Row("RetIVA").ToString.ToDouble + Row("RetISR").ToString.ToDouble) Row("ImporteConImpuestos") = (Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal) + Row("IVA").ToString.ToDecimal + Row("IEPSPS").ToString.ToDecimal - (Row("RetIVA").ToString.ToDecimal + Row("RetISR").ToString.ToDecimal)
Row("ImporteSinImpuestos") = Row("Cantidad").ToString.ToDouble * Row("PU").ToString.ToDouble Row("ImporteSinImpuestos") = Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal
Row("IEPSPSIVA") = Math.Round(IEPSPSIVA * Total, DecimalesPermitidos) Row("IEPSPSIVA") = Math.Round(IEPSPSIVA * Total, DecimalesPermitidos)
Row("IEPSPSIVAPorcentaje") = IEPSPSIVA Row("IEPSPSIVAPorcentaje") = IEPSPSIVA
@@ -18480,23 +18480,23 @@ Partial Class Compras_Compras
'IMPUESTOS: SI ES COMPRA, FACUTRA O CON OC, NO MODIFICA IMPUESTOS!! 'IMPUESTOS: SI ES COMPRA, FACUTRA O CON OC, NO MODIFICA IMPUESTOS!!
'Dim IVA = (TxtIVAModal.Text.ToDouble / 100) 'Dim IVA = (TxtIVAModal.Text.ToDouble / 100)
Dim IVA = Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2) Dim IVA = Math.Round(DdlIVA.SelectedValue.ToDecimal - 1, 2)
Dim RetISR = (TxtRetISRModal.Text.ToDouble / 100) Dim RetISR = (TxtRetISRModal.Text.ToDecimal / 100)
Dim RetIVA = (TxtRetIVAModal.Text.ToDouble / 100) Dim RetIVA = (TxtRetIVAModal.Text.ToDecimal / 100)
Dim IEPSPS = (TxtIEPSModal.Text.ToDouble / 100) Dim IEPSPS = (TxtIEPSModal.Text.ToDecimal / 100)
Dim IEPSPSIVA = 0 Dim IEPSPSIVA = 0
'I f Not (CveCompra > 0 Or CveFactura > 0 Or OCVinculada) Then 'I f Not (CveCompra > 0 Or CveFactura > 0 Or OCVinculada) Then
'If DdlIVA.SelectedValue.ToDouble = 0 Then DrPS("IVA") = 0 Else DrPS("IVA") = IVA * Total 'If DdlIVA.SelectedValue.ToDouble = 0 Then DrPS("IVA") = 0 Else DrPS("IVA") = IVA * Total
DrPS("IVA") = IVA * Total DrPS("IVA") = (IVA * Total).RoundSQL
DrPS("IVAPorcentaje") = IVA DrPS("IVAPorcentaje") = IVA
DrPS("RetIVA") = RetIVA * Total DrPS("RetIVA") = (RetIVA * Total).RoundSQL
DrPS("RetIVAPorcentaje") = RetIVA DrPS("RetIVAPorcentaje") = RetIVA
DrPS("RetISR") = RetISR * Total DrPS("RetISR") = RetISR * Total
DrPS("RetISRPorcentaje") = RetISR DrPS("RetISRPorcentaje") = RetISR
DrPS("IEPSPS") = IEPSPS * Total DrPS("IEPSPS") = (IEPSPS * Total).RoundSQL
DrPS("IEPSPSPorcentaje") = IEPSPS DrPS("IEPSPSPorcentaje") = IEPSPS
DrPS("IEPSPSIVA") = IEPSPSIVA * Total DrPS("IEPSPSIVA") = (IEPSPSIVA * Total).RoundSQL
DrPS("IEPSPSIVAPorcentaje") = IEPSPSIVA DrPS("IEPSPSIVAPorcentaje") = IEPSPSIVA
@@ -20927,9 +20927,9 @@ Partial Class Compras_Compras
Dim Proyecto As String = GvRow.DataKey("Proyecto") Dim Proyecto As String = GvRow.DataKey("Proyecto")
Dim CveProyecto As Integer = GvRow.DataKey("CveProyecto").ToEntero Dim CveProyecto As Integer = GvRow.DataKey("CveProyecto").ToEntero
Dim RetISR As Double = GvRow.DataKey("RetISR").ToString.ToDouble Dim RetISR As Decimal = GvRow.DataKey("RetISR").ToString.ToDecimal
Dim RetIVA As Double = GvRow.DataKey("RetIVA").ToString.ToDouble Dim RetIVA As Decimal = GvRow.DataKey("RetIVA").ToString.ToDecimal
Dim IvaPS As Double = GvRow.DataKey("IVA").ToString.ToDouble Dim IvaPS As Decimal = GvRow.DataKey("IVA").ToString.ToDecimal
If IvaPS = -1 Then If IvaPS = -1 Then
IvaPS = PorcentajeIVA IvaPS = PorcentajeIVA
@@ -20940,8 +20940,8 @@ Partial Class Compras_Compras
Dim CveClasificacion As Integer = GvRow.DataKey("CveClasificacion").ToString.ToEntero Dim CveClasificacion As Integer = GvRow.DataKey("CveClasificacion").ToString.ToEntero
Dim Clasificacion As String = GvRow.DataKey("Clasificacion") Dim Clasificacion As String = GvRow.DataKey("Clasificacion")
Dim IEPSPS As Double = GvRow.DataKey("IEPSPorcentaje").ToString.ToDouble Dim IEPSPS As Decimal = GvRow.DataKey("IEPSPorcentaje").ToString.ToDecimal
Dim IEPSPSIVA As Double = If(GvRow.DataKey("IEPSGrabaIVA").ToString = "True", IEPSPS, 0) Dim IEPSPSIVA As Decimal = If(GvRow.DataKey("IEPSGrabaIVA").ToString = "True", IEPSPS, 0)
If Cantidad > 0 Then If Cantidad > 0 Then