diff --git a/App_Code/ClsMovimientos.vb b/App_Code/ClsMovimientos.vb index 9ea0c4866..3672bca91 100644 --- a/App_Code/ClsMovimientos.vb +++ b/App_Code/ClsMovimientos.vb @@ -1517,7 +1517,7 @@ Public Class ClsMovimientos Optional CveCuenta As Integer = -1, Optional Grupo As String = "-1", Optional TipoCambio As Integer = -1, Optional TCEspecifico As Double = 0, Optional CveMoneda As Integer = -1, Optional CveClienteClasificacion As Integer = -1, Optional Tipo As Integer = -1, - Optional EsDistribuidor As Integer = -1) As Boolean + Optional EsDistribuidor As Integer = -1, Optional FechaAplicadoI As Date = Nothing, Optional FechaAplicadoF As Date = Nothing) As Boolean Dim Retorno As Boolean = False @@ -1546,7 +1546,12 @@ Public Class ClsMovimientos .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda .Add("@CveClienteClasificacion", SqlDbType.Int).Value = CveClienteClasificacion .Add("@Tipo", SqlDbType.Int).Value = Tipo - .Add("@EsDistribuidor", SqlDbType.Int).Value = EsDistribuidor + .Add("@EsDistribuidor", SqlDbType.Int).Value = EsDistribuidor + + + .Add("@FechaAplicadoI", SqlDbType.Date).Value = FechaAplicadoI.ToShortDateString + .Add("@FechaAplicadoF", SqlDbType.Date).Value = FechaAplicadoF.ToShortDateString + End With Try diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index ee26608db..1203a0395 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -5276,14 +5276,14 @@ Public Class ClsPaginas Usuario.CerrarSession() End Sub - Public Sub Alert(Mensaje As String, Optional pOpcion As TipoMensaje = TipoMensaje.MsgInformacion, Optional JSBtnAceptar As String = "", Optional timeout As Integer = 5) + Public Sub Alert(Mensaje As String, Optional pOpcion As TipoMensaje = TipoMensaje.MsgInformacion, Optional JSBtnAceptar As String = "", Optional timeout As Integer = 5, Optional ShowCloseButton As Boolean = True) If DirectCast(pOpcion, Integer) >= 5 Then Mensaje = Mensaje.Replace("'"c, "\'").Replace(vbCrLf, "").Replace("""", "\'").Replace(vbLf, " ") JSBtnAceptar = JSBtnAceptar.Replace("'"c, "\'") Dim toastscript As String = String.Format("alertatoast({3},'{0}',function(){{{1}}},{2});", Mensaje, JSBtnAceptar, timeout, DirectCast(pOpcion, Integer)) ViewState("strToastMsglargonoreplace") = String.Format("{0}{1}", If(Not IsNothing(ViewState("strToastMsglargonoreplace")) AndAlso ViewState("strToastMsglargonoreplace").ToString().Length > 0, ViewState("strToastMsglargonoreplace").ToString(), ""), toastscript) Else - Mensaje.Alert(Mensaje, pOpcion, JSBtnAceptar, TimeoutToast:=timeout) + Mensaje.Alert(Mensaje, pOpcion, JSBtnAceptar, TimeoutToast:=timeout, ShowCloseButton:=ShowCloseButton) End If End Sub Protected Overridable Sub Page_PreRender(sender As Object, e As EventArgs) Handles Me.PreRender diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 391461856..e864519ea 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -4507,11 +4507,16 @@ Public Class ClsVentas End Try Return retorno End Function - Public Function GetMetasVendedores(CveEmpresa As Integer) As Boolean + Public Function GetMetasVendedores(CveEmpresa As Integer, Optional CveSubProyecto As Integer = -1, Optional CveVendedor As Integer = -1, Optional CveMarca As Integer = -1, Optional Mes As Integer = -1, Optional Anio As Integer = -1) As Boolean Dim retorno As Boolean = False DataAdapter("PA_Vta_MetasVendedoresGet", CommandType.StoredProcedure) With SqlAdapter.SelectCommand.Parameters .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor + .Add("@CveMarca", SqlDbType.Int).Value = CveMarca + .Add("@Mes", SqlDbType.Int).Value = Mes + .Add("@Anio", SqlDbType.Int).Value = Anio End With Try SqlAdapter.Fill(Data) diff --git a/App_Code/modExtensiones.vb b/App_Code/modExtensiones.vb index da8ccef26..ee3b331f1 100644 --- a/App_Code/modExtensiones.vb +++ b/App_Code/modExtensiones.vb @@ -311,7 +311,7 @@ Namespace Extensiones ToastAdventencia = 8 'Warning End Enum - Public Sub Alert(Obj As Object, Mensaje As String, pOpcion As TipoMensaje, Optional JSBtnAceptar As String = "", Optional TextoConfirmacion As String = "Aceptar", Optional TextoCancelacion As String = "Cancelar", Optional TimeoutToast As Integer = 5) + Public Sub Alert(Obj As Object, Mensaje As String, pOpcion As TipoMensaje, Optional JSBtnAceptar As String = "", Optional TextoConfirmacion As String = "Aceptar", Optional TextoCancelacion As String = "Cancelar", Optional TimeoutToast As Integer = 5, Optional ShowCloseButton As Boolean = True) If System.Web.HttpContext.Current IsNot Nothing AndAlso System.Web.HttpContext.Current.Handler IsNot Nothing AndAlso System.Web.HttpContext.Current.Handler.GetType().IsSubclassOf(GetType(Page)) Then Dim Titulo As String = "" @@ -331,6 +331,7 @@ Namespace Extensiones Dim b3title As String = "" Dim b3clas As String = "hide" Dim b3js As String = "" + Dim closeButtonOption As String = "" Select Case pOpcion Case TipoMensaje.MsgInformacion Titulo = " Información" @@ -371,15 +372,18 @@ Namespace Extensiones End Select Try - + 'No cerrar el alert obliga a hacer click en los botones de opcion + If Not ShowCloseButton Then + closeButtonOption = "backdrop : ""static"", keyboard : false, closeButton: false," + End If Dim Pag As Page = DirectCast(System.Web.HttpContext.Current.Handler, Page) Dim script As String = "" If showalert Then - script = String.Format("bootbox.dialog({{message: ""{0} "",className: ""{11}"",onEscape: function() {{ {12} }},title: ""{1}"",buttons: {{ success: {{ label: ""{2}"", className: "" {3}""," & + script = String.Format("bootbox.dialog({{message: ""{0} "", className: ""{11}"", {12} onEscape: function() {{ {12} }},title: ""{1}"",buttons: {{ success: {{ label: ""{2}"", className: "" {3}""," & "callback: function() {{ {4} }} }}, danger: {{ label: ""{5}"", className: "" {6}"",callback: function() {{ {7} }} }}," & "main: {{ label: ""{8}"", className: "" {9}"", callback: function() {{ {10} }} }} }} }});", - Mensaje, Titulo, b3title, b3clas, b3js, b2title, b2clas, b2js, b1title, b1clas, b1js, headerclas, onEscape) + Mensaje, Titulo, b3title, b3clas, b3js, b2title, b2clas, b2js, b1title, b1clas, b1js, headerclas, onEscape, closeButtonOption) Else script = String.Format("alertatoast({3},'{0}',function(){{{1}}},{2});", Mensaje, JSBtnAceptar, TimeoutToast, DirectCast(pOpcion, Integer)) @@ -3592,9 +3596,9 @@ Namespace Extensiones - End Class + End Class #End Region - + #Region "A T R I B U T O S" Public Class BasicAuthenticationAttribute Inherits AuthorizationFilterAttribute @@ -3660,7 +3664,7 @@ Namespace Extensiones actionContext.Response = actionContext.Request.CreateResponse(HttpStatusCode.Unauthorized) actionContext.Response.Headers.Add("WWW-Authenticate", "Basic Scheme='Data' location = 'http://localhost:") End Sub - End Class + End Class #End Region - + End Namespace diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx index 66bddceac..283f3403f 100644 --- a/Compras/Compras.aspx +++ b/Compras/Compras.aspx @@ -3217,6 +3217,12 @@ +
+ +
+ +
+
-
Fecha Inicio:
+
Fecha Aplicado Inicio:
@@ -194,7 +194,7 @@
-
Fecha Fin:
+
Fecha Aplicado Fin:
diff --git a/Ventas/RepRecuperacion.aspx.vb b/Ventas/RepRecuperacion.aspx.vb index d6303d9a0..c3c3b4e99 100644 --- a/Ventas/RepRecuperacion.aspx.vb +++ b/Ventas/RepRecuperacion.aspx.vb @@ -158,11 +158,12 @@ Partial Class Ventas_RepRecuperacion Private Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then Dim Css As String = "Texto" - Dim FechaI, FechaF As String + Dim FechaI, FechaF, FechaAplicadoI, FechaAplicadoF As String Dim CveClienteSucursal As Integer = -1 FechaI = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim(), "-1") - FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim(), "-1") - + FechaF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim(), "-1") + FechaAplicadoI = If(IsDate(TxtFechaAplicadoI.Text.Trim()), TxtFechaAplicadoI.Text.Trim(), MinFecha.ToShortDateString.ToString) + FechaAplicadoF = If(IsDate(TxtFechaAplicadoF.Text.Trim()), TxtFechaAplicadoF.Text.Trim(), MaxFecha.ToShortDateString.ToString) If e.Row.DBCampo("Orden") = "" Then e.Row.CssClass = "Totales" End If @@ -174,15 +175,15 @@ Partial Class Ventas_RepRecuperacion End If End If - Dim Liga4 As String = String.Format("/Ventas/RepRecuperacionDetalle.aspx?GPO={0}&CveCliente={1}&CveSubProyecto={2}&Vendedor={3}&CveUsuario={4}&CveEstatusFactura={5}&IVA={6}&FechaI={7}&FechaF={8}&CveResponsable={9}&TipoDocto={10}&CveClienteSucursal={11}&CveBanco{12}&CveCuenta{13}&Grupo={14}&TipoCambio={15}&TCEspecifico={16}&CveMoneda={17}&Tipo={18}&EsDistribuidor={19}", + Dim Liga4 As String = String.Format("/Ventas/RepRecuperacionDetalle.aspx?GPO={0}&CveCliente={1}&CveSubProyecto={2}&Vendedor={3}&CveUsuario={4}&CveEstatusFactura={5}&IVA={6}&FechaI={7}&FechaF={8}&CveResponsable={9}&TipoDocto={10}&CveClienteSucursal={11}&CveBanco{12}&CveCuenta{13}&Grupo={14}&TipoCambio={15}&TCEspecifico={16}&CveMoneda={17}&Tipo={18}&EsDistribuidor={19}&FechaAplicadoI={20}&FechaAplicadoF={21}", DdlGrupo.SelectedValue, e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveVendedor"), - e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF, DdlResponsable.SelectedValue, e.Row.DBCampo("TipoDocto"), CveClienteSucursal, e.Row.DBCampo("CveBanco"), e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("GPO"), e.Row.DBCampo("TipoCambio"), e.Row.DBCampo("TCEspecifico"), e.Row.DBCampo("CveMoneda"), 2, e.Row.DBCampo("EsDistribuidor")) + e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF, DdlResponsable.SelectedValue, e.Row.DBCampo("TipoDocto"), CveClienteSucursal, e.Row.DBCampo("CveBanco"), e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("GPO"), e.Row.DBCampo("TipoCambio"), e.Row.DBCampo("TCEspecifico"), e.Row.DBCampo("CveMoneda"), 2, e.Row.DBCampo("EsDistribuidor"), FechaAplicadoI, FechaAplicadoF) e.Row.FCHyperLink("HplPagado").NavigateUrl = Liga4 - Dim Liga5 As String = String.Format("/Ventas/RepRecuperacionDetalle.aspx?GPO={0}&CveCliente={1}&CveSubProyecto={2}&Vendedor={3}&CveUsuario={4}&CveEstatusFactura={5}&IVA={6}&FechaI={7}&FechaF={8}&CveResponsable={9}&TipoDocto={10}&CveClienteSucursal={11}&CveBanco{12}&CveCuenta{13}&Grupo={14}&TipoCambio={15}&TCEspecifico={16}&CveMoneda={17}&Tipo={18}&EsDistribuidor={19}", + Dim Liga5 As String = String.Format("/Ventas/RepRecuperacionDetalle.aspx?GPO={0}&CveCliente={1}&CveSubProyecto={2}&Vendedor={3}&CveUsuario={4}&CveEstatusFactura={5}&IVA={6}&FechaI={7}&FechaF={8}&CveResponsable={9}&TipoDocto={10}&CveClienteSucursal={11}&CveBanco{12}&CveCuenta{13}&Grupo={14}&TipoCambio={15}&TCEspecifico={16}&CveMoneda={17}&Tipo={18}&EsDistribuidor={19}&FechaAplicadoI={20}&FechaAplicadoF={21}", DdlGrupo.SelectedValue, e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveVendedor"), - e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF, DdlResponsable.SelectedValue, e.Row.DBCampo("TipoDocto"), CveClienteSucursal, e.Row.DBCampo("CveBanco"), e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("GPO"), e.Row.DBCampo("TipoCambio"), e.Row.DBCampo("TCEspecifico"), e.Row.DBCampo("CveMoneda"), 1, e.Row.DBCampo("EsDistribuidor")) + e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF, DdlResponsable.SelectedValue, e.Row.DBCampo("TipoDocto"), CveClienteSucursal, e.Row.DBCampo("CveBanco"), e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("GPO"), e.Row.DBCampo("TipoCambio"), e.Row.DBCampo("TCEspecifico"), e.Row.DBCampo("CveMoneda"), 1, e.Row.DBCampo("EsDistribuidor"), FechaAplicadoI, FechaAplicadoF) e.Row.FCHyperLink("HplVendido").NavigateUrl = Liga5 diff --git a/Ventas/RepRecuperacionDetalle.aspx b/Ventas/RepRecuperacionDetalle.aspx index b674b640d..a4b0ca3b5 100644 --- a/Ventas/RepRecuperacionDetalle.aspx +++ b/Ventas/RepRecuperacionDetalle.aspx @@ -186,6 +186,36 @@
+
Fecha Aplicado Inicio:
+
+
+ + + + +
+ + + + + + +
+
Fecha Aplicado Fin:
+
+
+ + + + +
+ + + + + + +
diff --git a/Ventas/RepRecuperacionDetalle.aspx.vb b/Ventas/RepRecuperacionDetalle.aspx.vb index 586baddf7..76a99761f 100644 --- a/Ventas/RepRecuperacionDetalle.aspx.vb +++ b/Ventas/RepRecuperacionDetalle.aspx.vb @@ -85,7 +85,7 @@ Partial Class Ventas_RepRecuperacionDetalle Private Sub CargaCombos() Dim CveCliente, CveVendedor, CveUsuario, CveSubProyecto, CveEstatus, CveResponsable, CveAgrupador, CveBanco, CveCuenta, CveClienteSucursal, CveMoneda, CveClienteClasificacion As Integer - Dim FechaI, FechaF, TipoDocto, TipoCambio As String + Dim FechaI, FechaF, TipoDocto, TipoCambio, FechaAplicadoI, FechaAplicadoF As String 'Carga Clientes If (UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1") Then @@ -144,7 +144,17 @@ Partial Class Ventas_RepRecuperacionDetalle End If If FechaI <> "-1" Then txtFechaI.Text = FechaI + End If + + FechaAplicadoI = If(Request("FechaAplicadoI") IsNot Nothing, Request("FechaAplicadoI").ToString, "-1").ToString + FechaAplicadoF = If(Request("FechaAplicadoF") IsNot Nothing, Request("FechaAplicadoF").ToString, "-1").ToString + If FechaAplicadoF <> "-1" Then + TxtFechaAplicadoF.Text = FechaAplicadoF End If + If FechaAplicadoI <> "-1" Then + TxtFechaAplicadoI.Text = FechaAplicadoI + End If + TipoDocto = IfNull(Request("TipoDocto"), "-1").ToString CveClienteSucursal = IfNull(Request("CveClienteSucursal"), "-1").ToString.ToEntero @@ -229,7 +239,7 @@ Partial Class Ventas_RepRecuperacionDetalle Iva.ToString, DdlGrupo.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlResponsable.SelectedValue.ToEntero, DdlTipoDocto.SelectedValue, CveUsuarioConsulta:=UsuarioActual.CveUsuario, CveBanco:=DdlBanco.SelectedValue.ToEntero, CveCuenta:=DdlCuentaBancaria.SelectedValue.ToEntero, Grupo:=Grupo, TipoCambio:=RblTipoCambio.SelectedValue.ToEntero, TCEspecifico:=TCEspecifico, CveMoneda:=DdlMoneda.SelectedValue.ToEntero, CveClienteClasificacion:=DdlClienteClasificacion.SelectedValue.ToEntero, Tipo:=Tipo, - EsDistribuidor:=DdlDistribuidor.SelectedValue.ToEntero()) Then + EsDistribuidor:=DdlDistribuidor.SelectedValue.ToEntero(), FechaAplicadoI:=TxtFechaAplicadoI.Text.ToDate, FechaAplicadoF:=TxtFechaAplicadoF.Text.ToDate) Then GvDatos.DataSource = ObjMovtos.DtResultados DtDatos = ObjMovtos.DtResultados diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 38f0a6c74..fb94fa794 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -5459,7 +5459,9 @@ Partial Class Ventas DdlMetodoPago33.Enabled = True End If - If CveVenta <= 0 Or EsCreaApartirDe Or NuevaFactura = 1 Then + Dim CveCotizacion As Integer = IfNull(ViewState("CveCotizacion"), 0).ToString().ToEntero() + + If (CveVenta <= 0 AndAlso CveCotizacion <= 0) Or EsCreaApartirDe Or NuevaFactura = 1 Then CveMetodoPagoCliente = ObjCliente.CveMetodoPago @@ -6241,7 +6243,9 @@ Partial Class Ventas ViewState("CliNoInt") = ObjCliente.NoInt PlazoCobranza = ObjCliente.PlazoCobranza - If CveVenta <= 0 Then + Dim CveCotizacion As Integer = IfNull(ViewState("CveCotizacion"), 0).ToString().ToEntero() + + If CveVenta <= 0 AndAlso CveCotizacion <= 0 Then CveMetodoPagoCliente = ObjCliente.CveMetodoPago DdlMetodoPago33.SelectedValueExist(ObjCliente.CveMetodoPago33) @@ -21405,7 +21409,7 @@ Partial Class Ventas LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.ArchivoBinario = ObjetoPDF, .NombreArchivo = $"AcuseCancelacion{Serie}-{Folio}.pdf"}) If ObjMail.SendMail(EmpresaActual, Mail, Asunto, Cuerpo, MailCC, LSRutasMail, Displayname:=DisplayName) Then ResultadoMail = 1 - Alert("El acuse de cancelación ha sido envíado correctamente.") + Alert("El acuse de cancelación ha sido envíado correctamente.", JSBtnAceptar:="BtnRefrescarPagina();") Else ResultadoMail = 0 End If @@ -26497,6 +26501,12 @@ Partial Class Ventas End Sub Private Sub BtnEditarCotizacion_Click(sender As Object, e As EventArgs) Handles BtnEditarCotizacion.Click + Dim VaFacturarCotizacion As Boolean = False + 'SI CARGA UNA COTIZACION DEBE GUARDAR TAMBIEN + If IfNull(ViewState("CveCotizacion"), 0).ToString().ToEntero() > 0 Then + ViewState("CveVenta") = IfNull(ViewState("CveCotizacion"), 0).ToString().ToEntero() + VaFacturarCotizacion = True + End If If Not TmpDT.Rows.Count > 0 Then Alert("Es necesario agregar al menos un producto o servicio a la factura.", TipoMensaje.MsgAdvertencia) @@ -26567,14 +26577,14 @@ Partial Class Ventas End If End If - If ObjConta.ValidacionPrePolizaCuadre(-1, 2, CveVenta) Then - If ObjConta.ValorPolizaDescuadre > 0 Then - If ObjConta.ValorPolizaDescuadre = 2 Then - OcurrioError = True - MensajeError = ObjConta.MensajePolizaDescuadre - End If - End If - End If + 'If ObjConta.ValidacionPrePolizaCuadre(-1, 2, CveVenta) Then + ' If ObjConta.ValorPolizaDescuadre > 0 Then + ' If ObjConta.ValorPolizaDescuadre = 2 Then + ' OcurrioError = True + ' MensajeError = ObjConta.MensajePolizaDescuadre + ' End If + ' End If + 'End If If OcurrioError Then ObjVentas.RollBack() @@ -26590,7 +26600,12 @@ Partial Class Ventas 'GENERA PDF NUEVO GeneraPDFCotizacion(ChkEnviarFactura.Checked) - Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion, "document.location.href=""/Ventas/Ventas.aspx?CveVenta=" & CveVenta & "&&Tipo=Cot"";") + If VaFacturarCotizacion Then + Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion, "document.location.href=""/Ventas/Ventas.aspx?CveCotizacion=" & CveVenta & """;") + Else + Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion, "document.location.href=""/Ventas/Ventas.aspx?CveVenta=" & CveVenta & "&&Tipo=Cot"";") + End If + End If ObjVentas.Dispose() @@ -26807,82 +26822,77 @@ Partial Class Ventas Private Function CalculaUsadosCotizacion(ByRef SbVentasDetalle As StringBuilder, ByVal DTSeleccionadas As DataTable, ByVal DtCotizaciones As DataTable) As List(Of MVentaDetalleCotizacion) Dim Retorno As New List(Of MVentaDetalleCotizacion) - If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Cot", "Dev") Then + Dim DTTamanios As DataTable = GlobalDTAcumTamaños() - Dim DTTamanios As DataTable = GlobalDTAcumTamaños() + Dim DTCvePSCostos As DataTable = DTTamanios.FiltraParametros("", "", {"CvePSCargo"}) - Dim DTCvePSCostos As DataTable = DTTamanios.FiltraParametros("", "", {"CvePSCargo"}) + For Each Dr As DataRow In DTSeleccionadas.Rows + Dim tCantidad = If(ChkCotProductos.Checked, GvCotPS.Rows(IndiceGVCotDataKey(GvCotPS, Dr("CveVentaDetalle").ToString())).FCTextBox("TxtCantidadCot").Text.ToDecimal, Dr("Cantidad")).ToString().ToDecimal + Dr("Cantidad") = tCantidad + Retorno.Add(New MVentaDetalleCotizacion() With {.CveVentaDetalle = Dr("CveVentaDetalle").ToString().ToEntero(), .Cantidad = tCantidad}) - For Each Dr As DataRow In DTSeleccionadas.Rows - Dim tCantidad = If(ChkCotProductos.Checked, GvCotPS.Rows(IndiceGVCotDataKey(GvCotPS, Dr("CveVentaDetalle").ToString())).FCTextBox("TxtCantidadCot").Text.ToDecimal, Dr("Cantidad")).ToString().ToDecimal - Dr("Cantidad") = tCantidad + Next - Retorno.Add(New MVentaDetalleCotizacion() With {.CveVentaDetalle = Dr("CveVentaDetalle").ToString().ToEntero(), .Cantidad = tCantidad}) + Dim TmpDTCalculo As DataRow() = DTSeleccionadas.Rows.Cast(Of DataRow).ToArray() - Next + Dim DTPSTemp As New DataTable '= TmpDT.Clone - Dim TmpDTCalculo As DataRow() = DTSeleccionadas.Rows.Cast(Of DataRow).ToArray() + DTPSTemp.Columns.Add("CveVenta", GetType(Integer)) + DTPSTemp.Columns.Add("Cantidad", GetType(Integer)) + DTPSTemp.Columns.Add("CvePS", GetType(Integer)) + DTPSTemp.Columns.Add("PU", GetType(Decimal)) - Dim DTPSTemp As New DataTable '= TmpDT.Clone + For Each DrowPartidas As DataRow In TmpDTCalculo + Dim CveTamanioTemp As Integer = DrowPartidas("CveTamaño").ToString().ToEntero() + Dim CveVenta As Integer = DrowPartidas("CveVenta").ToString().ToEntero() - DTPSTemp.Columns.Add("CveVenta", GetType(Integer)) - DTPSTemp.Columns.Add("Cantidad", GetType(Integer)) - DTPSTemp.Columns.Add("CvePS", GetType(Integer)) - DTPSTemp.Columns.Add("PU", GetType(Decimal)) + If CveTamanioTemp > 0 Then - For Each DrowPartidas As DataRow In TmpDTCalculo - Dim CveTamanioTemp As Integer = DrowPartidas("CveTamaño").ToString().ToEntero() - Dim CveVenta As Integer = DrowPartidas("CveVenta").ToString().ToEntero() + Dim DTTamanioTemp As New DataTable + Dim CvePsTemp As Integer = DTTamanios.FiltraParametros($"CveTamaño = { CveTamanioTemp } ").Rows(0)("CvePSCargo").ToString().ToEntero() - If CveTamanioTemp > 0 Then + Dim Cargo As Decimal = DTTamanios.FiltroPrimeroValor("Cargo", $" CveTamaño = { CveTamanioTemp }").ToDecimal - Dim DTTamanioTemp As New DataTable - Dim CvePsTemp As Integer = DTTamanios.FiltraParametros($"CveTamaño = { CveTamanioTemp } ").Rows(0)("CvePSCargo").ToString().ToEntero() + If DTPSTemp.FiltraParametros($"CvePs = { CvePsTemp }").Rows.Count > 0 Then - Dim Cargo As Decimal = DTTamanios.FiltroPrimeroValor("Cargo", $" CveTamaño = { CveTamanioTemp }").ToDecimal + For Each dRowUpdate As DataRow In DTPSTemp.Rows - If DTPSTemp.FiltraParametros($"CvePs = { CvePsTemp }").Rows.Count > 0 Then + If (dRowUpdate("CvePS").ToString().ToEntero() = CvePsTemp) Then + dRowUpdate("Cantidad") = dRowUpdate("Cantidad").ToString().ToDecimal + DrowPartidas("Cantidad").ToString().ToDecimal + dRowUpdate("PU") = Cargo ' dRowUpdate("Total").ToString().ToDecimal + ImporteCargo + dRowUpdate("CveVenta") = CveVenta + End If + Next - For Each dRowUpdate As DataRow In DTPSTemp.Rows + DTPSTemp.AcceptChanges() - If (dRowUpdate("CvePS").ToString().ToEntero() = CvePsTemp) Then - dRowUpdate("Cantidad") = dRowUpdate("Cantidad").ToString().ToDecimal + DrowPartidas("Cantidad").ToString().ToDecimal - dRowUpdate("PU") = Cargo ' dRowUpdate("Total").ToString().ToDecimal + ImporteCargo - dRowUpdate("CveVenta") = CveVenta - End If - Next + Else + Dim dRowNuevo As DataRow = DTPSTemp.NewRow - DTPSTemp.AcceptChanges() - - Else - Dim dRowNuevo As DataRow = DTPSTemp.NewRow - - dRowNuevo("CvePS") = CvePsTemp - dRowNuevo("Cantidad") = DrowPartidas("Cantidad").ToString().ToDecimal - dRowNuevo("PU") = Cargo - dRowNuevo("CveVenta") = CveVenta - - DTPSTemp.Rows.Add(dRowNuevo) - DTPSTemp.AcceptChanges() - End If + dRowNuevo("CvePS") = CvePsTemp + dRowNuevo("Cantidad") = DrowPartidas("Cantidad").ToString().ToDecimal + dRowNuevo("PU") = Cargo + dRowNuevo("CveVenta") = CveVenta + DTPSTemp.Rows.Add(dRowNuevo) + DTPSTemp.AcceptChanges() End If - Next - For Each drowPsTamaños As DataRow In DTPSTemp.Rows + End If + Next - If drowPsTamaños("PU").ToString().ToDecimal > 0 Then + For Each drowPsTamaños As DataRow In DTPSTemp.Rows - Dim CveVentaDetalleUsado = DtCotizaciones.FiltroPrimeroValor("CveVentaDetalle", $"CveVenta = {drowPsTamaños("CveVenta")} AND CvePS = {drowPsTamaños("CvePS")}").ToEntero() - SbVentasDetalle.AppendFormat("{0},", CveVentaDetalleUsado) + If drowPsTamaños("PU").ToString().ToDecimal > 0 Then - Retorno.Add(New MVentaDetalleCotizacion() With {.CveVentaDetalle = CveVentaDetalleUsado, .Cantidad = drowPsTamaños("Cantidad").ToString().ToDecimal()}) + Dim CveVentaDetalleUsado = DtCotizaciones.FiltroPrimeroValor("CveVentaDetalle", $"CveVenta = {drowPsTamaños("CveVenta")} AND CvePS = {drowPsTamaños("CvePS")}").ToEntero() + SbVentasDetalle.AppendFormat("{0},", CveVentaDetalleUsado) - End If - Next + Retorno.Add(New MVentaDetalleCotizacion() With {.CveVentaDetalle = CveVentaDetalleUsado, .Cantidad = drowPsTamaños("Cantidad").ToString().ToDecimal()}) - End If + End If + Next Return Retorno End Function