--CITRUS. Fix recalculo de comercio exterior
This commit is contained in:
@@ -2722,7 +2722,7 @@ Partial Class Ventas
|
||||
If Request("CveManifiesto") IsNot Nothing AndAlso IsNumeric(Request("CveManifiesto")) AndAlso Request("CveManifiesto").ToEntero() > 0 Then
|
||||
Using ObjCGame As New ClsCGame()
|
||||
|
||||
If ObjCGame.ManifiestoGet(Request("CveManifiesto").ToEntero(), -1, -1, -1, -1, -1, -1, -1, -1, UsuarioActual.CveEmpresa, "-1", "-1") Then
|
||||
If ObjCGame.ManifiestoGet(Request("CveManifiesto").ToEntero(), -1, -1, -1, -1, -1, -1, -1, -1, UsuarioActual.CveEmpresa, "-1", "-1") AndAlso ObjCGame.DtResultados.Rows.Count > 0 Then
|
||||
DdlSubProyectoDatos.SelectedValueExist(ObjCGame.DtResultados.Rows(0)("CveSubProyecto").ToString())
|
||||
End If
|
||||
|
||||
@@ -2733,6 +2733,10 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
End Using
|
||||
|
||||
If AplicaComercioExterior Then
|
||||
CargaGvComercioExterior()
|
||||
End If
|
||||
End If
|
||||
|
||||
If Request("CveEmbarqueManifiesto") IsNot Nothing AndAlso IsNumeric(Request("CveEmbarqueManifiesto")) AndAlso Request("CveEmbarqueManifiesto").ToEntero() > 0 Then
|
||||
@@ -8294,6 +8298,7 @@ Partial Class Ventas
|
||||
End Sub
|
||||
Protected Sub GvPS_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvPS.RowUpdating
|
||||
'Dim TipoDescuento As Integer
|
||||
|
||||
Dim Cantidad, PU, CantidadInventario As Decimal
|
||||
Dim ObjDescuento As New Modelos.VentaDescuentos
|
||||
Dim CuentaPredial As String
|
||||
@@ -8326,6 +8331,7 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
Dim CantidadOriginal As Decimal = GvPS.Rows(e.RowIndex).DataKey("Cantidad").ToDecimal()
|
||||
Dim TotalOriginal As Decimal = GvPS.Rows(e.RowIndex).DataKey("Total").ToDecimal()
|
||||
|
||||
Dim DatarowPS As DataRow = Nothing
|
||||
DatarowPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=TmpDT.Rows(e.RowIndex)("CvePS").ToString().ToEntero()).FiltroPrimero("") ' Estado = -1
|
||||
@@ -8631,6 +8637,30 @@ Partial Class Ventas
|
||||
ObjDescuento.Consec = TmpDT.Rows(e.RowIndex)("Consec").ToString().ToEntero()
|
||||
End If
|
||||
|
||||
'RECALCULA LA CANTIDAD DE CONVERSION
|
||||
If CantidadOriginal <> Cantidad Then
|
||||
Dim CantidadConversion As Decimal = TmpDT.Rows(e.RowIndex)("CantidadConversion").ToString().ToDecimal()
|
||||
If AplicaComercioExterior Then
|
||||
'SI NO VIENE DE MANIFIESTO UTILIZA EL PESO DEL PRODUCTO
|
||||
If Request("CveManifiesto") Is Nothing Then
|
||||
If DrPS("PesoKg").ToString().ToDecimal() > 0 Then
|
||||
CantidadConversion = Cantidad * DrPS("PesoKg").ToString().ToDecimal()
|
||||
Else
|
||||
CantidadConversion = Cantidad
|
||||
End If
|
||||
Else
|
||||
Dim TotalNuevo As Decimal = TmpDT.Rows(e.RowIndex)("Total").ToString().ToDecimal()
|
||||
Dim PorcentajeConversion As Decimal = CantidadConversion / TotalOriginal
|
||||
|
||||
CantidadConversion = TotalNuevo * PorcentajeConversion
|
||||
End If
|
||||
Else
|
||||
CantidadConversion = Cantidad
|
||||
End If
|
||||
|
||||
TmpDT.Rows(e.RowIndex)("CantidadConversion") = CantidadConversion
|
||||
End If
|
||||
|
||||
|
||||
DrPS = Nothing
|
||||
|
||||
@@ -18466,7 +18496,7 @@ Partial Class Ventas
|
||||
'SI NO SE UTILIZA LA CONVERSION, UTILIZA LA CANTIDAD
|
||||
If CantidadConversion = 0 Then
|
||||
If DrPS("PesoKg").ToString().ToDecimal() > 0 Then
|
||||
CantidadConversion = DrPS("PesoKg").ToString().ToDecimal()
|
||||
CantidadConversion = Cantidad * DrPS("PesoKg").ToString().ToDecimal()
|
||||
Else
|
||||
CantidadConversion = Cantidad
|
||||
End If
|
||||
@@ -29688,9 +29718,9 @@ Partial Class Ventas
|
||||
|
||||
Protected Sub GvComercioExterior_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
Dim CantidadConversion = CDbl(e.Row.DBCampo("CantidadConversion"))
|
||||
Dim CantidadBase = CDbl(e.Row.DBCampo("Cantidad"))
|
||||
Dim PUBase = CDbl(e.Row.DBCampo("PU"))
|
||||
Dim CantidadConversion = e.Row.DBCampo("CantidadConversion").ToDecimal()
|
||||
Dim CantidadBase = e.Row.DBCampo("Cantidad").ToDecimal()
|
||||
Dim PUBase = e.Row.DBCampo("PU").ToDecimal()
|
||||
|
||||
Dim TotalUSD = (CantidadBase * PUBase)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user