diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 27a11d1a5..f9f5b79ba 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -9141,7 +9141,11 @@ Partial Class Ventas Dim DrProducto = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CvePS:=CvePSNuevo).FiltroPrimero("") - If Not ValidaAgregarPS(Cantidad, CvePSNuevo, DdlUM.SelectedValue.ToEntero(), PU, DrProducto("CveTipoPS").ToString().ToEntero(), DdlCla.SelectedValue.ToEntero(), DdlSP.SelectedValue.ToEntero(), ObjDescuento, CantidadOriginal:=CantidadOriginal) Then + Dim CveUMPS As Integer = DrProducto("CveUnidadMedida").ToString().ToEntero() + + DdlUM.SelectedValueExist(CveUMPS) + + If Not ValidaAgregarPS(Cantidad, CvePSNuevo, DdlUM.SelectedValue.ToEntero(), PU, DrProducto("CveTipoPS").ToString().ToEntero(), DdlCla.SelectedValue.ToEntero(), DdlSubProyectoDatos.SelectedValue.ToEntero(), ObjDescuento, CantidadOriginal:=CantidadOriginal) Then Exit Sub End If @@ -9158,6 +9162,8 @@ Partial Class Ventas If TmpDT.Rows(e.RowIndex)("CvePS").ToString() <> GvPS.Rows(e.RowIndex).FCDropDownLost("DdlPS").SelectedValue Then 'eliminar y cargar el ps *** + Dim ConsecutivoActual As Integer = TmpDT.Rows(e.RowIndex)("Consec").ToString().ToEntero() + If DtPromociones IsNot Nothing AndAlso DtPromociones.Rows.Count > 0 Then ObjDescuento = CalcularDescuentos(GvPS.Rows(e.RowIndex).FCDropDownLost("DdlPS").SelectedValue.ToEntero(), Cantidad, PU) End If @@ -9196,7 +9202,7 @@ Partial Class Ventas GvPS.Rows(e.RowIndex).FCDropDownList("DdlProyecto").SelectedValue.ToEntero(), GvPS.Rows(e.RowIndex).FCDropDownList("DdlProyecto").SelectedItem.Text, GvPS.Rows(e.RowIndex).FCDropDownList("DdlSubProyecto").SelectedValue.ToEntero(), GvPS.Rows(e.RowIndex).FCDropDownList("DdlSubProyecto").SelectedItem.Text, CuentaPredial:=CuentaPredial, CveVentaDetalle:=GvPS.Rows(e.RowIndex).DataKey("CveVentaDetalle").ToString().ToEntero(), SeActualiza:=True, CvePromocionDetalle:=ObjDescuento.CvePromocionDetalle, - ObjDescuento:=ObjDescuento, NumTurnos:=NumTurnos, CvePrecioLista:=CvePrecioLista, PrecioLista:=PrecioLista) + ObjDescuento:=ObjDescuento, NumTurnos:=NumTurnos, CvePrecioLista:=CvePrecioLista, PrecioLista:=PrecioLista, ConsecutivoManual:=ConsecutivoActual) ' TmpDT.Rows(e.RowIndex)("CveUM") = Ddl.SelectedValue ' TmpDT.Rows(e.RowIndex)("UM") = Ddl.SelectedItem.Text @@ -19921,7 +19927,7 @@ Partial Class Ventas ObjDescuento = ObjDescuentoGral End If - If ValidaAgregarPS(Cantidad, CvePS, DdlUnidadMedida.SelectedValue.ToEntero(), PU, HdnTipoPS.Value.ToEntero(), DdlClasificacion.SelectedValue.ToEntero(), DdlSubProyecto.SelectedValue.ToEntero(), ObjDescuento) Then + If ValidaAgregarPS(Cantidad, CvePS, DdlUnidadMedida.SelectedValue.ToEntero(), PU, HdnTipoPS.Value.ToEntero(), DdlClasificacion.SelectedValue.ToEntero(), DdlSubProyectoDatos.SelectedValue.ToEntero(), ObjDescuento) Then If UsuarioActual.Empresa.Funcionalidad(507) = DdlPS.SelectedValue Then CvePSAmortizacion = DdlPS.SelectedValue.ToEntero().ToEntero() @@ -20253,7 +20259,7 @@ Partial Class Ventas Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0, Optional SeActualiza As Boolean = False, Optional CvePromocionDetalle As Integer = -1, Optional EsCargo As Boolean = False, Optional ImporteProntoPago As Decimal = 0, Optional ByRef ObjDescuento As Modelos.VentaDescuentos = Nothing, Optional CvePrecioLista As Integer = -1, Optional PrecioLista As String = "", Optional CveActivoFijo As Integer = -1, Optional AFDepreciacion As Decimal = 0D, Optional AFValorInicial As Decimal = 0D, Optional NumTurnos As Decimal = 0D, Optional CantidadConversion As Decimal = 0, - Optional Costo As Decimal = 0, Optional PorcentajeIVAFijo As Decimal = -1) As Boolean + Optional Costo As Decimal = 0, Optional PorcentajeIVAFijo As Decimal = -1, Optional ConsecutivoManual As Integer = 0) As Boolean Dim Retorno As Boolean = False Try @@ -20296,16 +20302,22 @@ Partial Class Ventas Row("SubProyecto") = SubProyecto Row("Serie") = Serie Row("TiempoEntrega") = TiempoEntrega - If Modalidad = "U" Then - Row("Orden") = Index + + If ConsecutivoManual > 0 Then + Row("Orden") = ConsecutivoManual Else - Dim ConsecutivoActual As Integer = TmpDT.MAX("Consec").ToEntero() - If ConsecutivoActual < 0 Then - ConsecutivoActual = 0 + If Modalidad = "U" Then + Row("Orden") = Index + Else + Dim ConsecutivoActual As Integer = TmpDT.MAX("Consec").ToEntero() + If ConsecutivoActual < 0 Then + ConsecutivoActual = 0 + End If + Row("Orden") = ConsecutivoActual + 1 End If - Row("Orden") = ConsecutivoActual + 1 End If + Dim DrPS As DataRow = Nothing DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") ' Estado = -1 @@ -20410,16 +20422,22 @@ Partial Class Ventas Row("ClaveSATUnidadAduana") = DrPS("ClaveSATUnidadAduana") Row("ClaveSATFraccionArancelariaDescripcion") = DrPS("ClaveSATFraccionArancelariaDescripcion") Row("ClaveSATUnidadAduanaDescripcion") = DrPS("ClaveSATUnidadAduanaDescripcion") - If Modalidad = "U" Then - Row("Consec") = Index + + If ConsecutivoManual > 0 Then + Row("Consec") = ConsecutivoManual Else - Dim ConsecutivoActual As Integer = TmpDT.MAX("Consec").ToEntero() - If ConsecutivoActual < 0 Then - ConsecutivoActual = 0 + If Modalidad = "U" Then + Row("Consec") = Index + Else + Dim ConsecutivoActual As Integer = TmpDT.MAX("Consec").ToEntero() + If ConsecutivoActual < 0 Then + ConsecutivoActual = 0 + End If + Row("Consec") = ConsecutivoActual + 1 End If - Row("Consec") = ConsecutivoActual + 1 End If + Row("PS") = DrPS("PS") Row("CodigoPS") = DrPS("PSCodigo").ToString() Row("CveTipoPS") = DrPS("CveTipoPS")