From d8b0e1ee36f7b7cf45ac5c7e5d0e9e3a423bedd5 Mon Sep 17 00:00:00 2001 From: JORGE LUIS CAUDILLO ESPARZA Date: Thu, 20 Feb 2020 11:52:20 -0700 Subject: [PATCH 01/15] --- Compras/RepRembolsoComprobaciones.aspx | 2 +- vwd.webinfo | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Compras/RepRembolsoComprobaciones.aspx b/Compras/RepRembolsoComprobaciones.aspx index 854a49898..ec1a2b43f 100644 --- a/Compras/RepRembolsoComprobaciones.aspx +++ b/Compras/RepRembolsoComprobaciones.aspx @@ -187,7 +187,7 @@ Excedente   - + diff --git a/vwd.webinfo b/vwd.webinfo index 824b76cb0..0770194b6 100644 --- a/vwd.webinfo +++ b/vwd.webinfo @@ -17,6 +17,8 @@ + + \ No newline at end of file From c6208153667007679777029b55282d7db12a8999 Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Thu, 20 Feb 2020 14:04:02 -0700 Subject: [PATCH 02/15] =?UTF-8?q?correccion=20en=20ventas=20y=20mejora=20e?= =?UTF-8?q?n=20Entradas=20Usados=20Clientes=20para=20buscar=20las=20ventas?= =?UTF-8?q?=20de=20los=20grupos=20de=20tama=C3=B1os?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Acumuladores/RepEntradasUsadosClientes.aspx | 1 - Acumuladores/RepEntradasUsadosClientes.aspx.vb | 4 ++-- Ventas/Ventas.aspx.vb | 12 ++++++++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Acumuladores/RepEntradasUsadosClientes.aspx b/Acumuladores/RepEntradasUsadosClientes.aspx index 2a92b403e..f1fe85c14 100644 --- a/Acumuladores/RepEntradasUsadosClientes.aspx +++ b/Acumuladores/RepEntradasUsadosClientes.aspx @@ -82,7 +82,6 @@ - <%--OnClick="CargarVentasGrupo"--%> diff --git a/Acumuladores/RepEntradasUsadosClientes.aspx.vb b/Acumuladores/RepEntradasUsadosClientes.aspx.vb index b21eba707..9d266557c 100644 --- a/Acumuladores/RepEntradasUsadosClientes.aspx.vb +++ b/Acumuladores/RepEntradasUsadosClientes.aspx.vb @@ -94,9 +94,9 @@ Partial Class Acumuladores_RepEntradasUsadosClientes Dim renglon As GridViewRow = CType(tempLink.NamingContainer, GridViewRow) LbCliente.Text = renglon.DataKey("NombreComercial") - LbTam.Text = renglon.DataKey("Codigo") + LbTam.Text = renglon.DataKey("Codigo_Clientes") Dim ObjAcum As New ClsAcumuladores - If ObjAcum.GetUsadosClasificacionVentas(renglon.DataKey("CveCliente"), renglon.DataKey("Codigo"), TxtFechaI.Text, TxtFechaF.Text) Then + If ObjAcum.GetUsadosClasificacionVentas(renglon.DataKey("CveCliente"), renglon.DataKey("Codigo_Clientes"), TxtFechaI.Text, TxtFechaF.Text) Then GvVentas.DataSource = ObjAcum.DtResultados End If ObjAcum.Dispose() diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 71c5d88eb..e1aa52757 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -9255,8 +9255,16 @@ Partial Class Ventas ErrorList.Add("Ocurrió un error al Generar la Venta.
Revise su factura y cualquier detalle comuníquese a Soporte Técnico") Else If factura.TipoDocto.Contiene("Dev") Or DtVentasNC IsNot Nothing Then - If Not ObjVentas.AddVentasRelacionadas(ObjVentas.CveVenta, CveVenta) Then - ErrorList.Add("Ocurrió un error al relacionar las ventas entre si comuníquese a Soporte Técnico") + If DtVentasNC IsNot Nothing Then + For Each row As DataRow In DtVentasNC.Rows + If Not ObjVentas.AddVentasRelacionadas(ObjVentas.CveVenta, row("CveVenta").ToString.ToEntero) Then + ErrorList.Add("Ocurrió un error al relacionar las ventas entre si comuníquese a Soporte Técnico") + End If + Next + Else + If Not ObjVentas.AddVentasRelacionadas(ObjVentas.CveVenta, CveVenta) Then + ErrorList.Add("Ocurrió un error al relacionar las ventas entre si comuníquese a Soporte Técnico") + End If End If End If End If From b792eee1a32bbb789fb4ca47d435c628da1137b6 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Thu, 20 Feb 2020 16:50:44 -0700 Subject: [PATCH 03/15] Condiciones Comercailes --- Ventas/Ventas.aspx.vb | 400 ++++++++++++++++-------------------------- 1 file changed, 151 insertions(+), 249 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 71c5d88eb..ae8cf578e 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -2446,7 +2446,29 @@ Partial Class Ventas End If - If UsuarioActual.Empresa.CvePlataforma = 2 OrElse UsuarioActual.CveRol = 1 Then + 'MOSTRAR LA OPCION DE AGREGAR PS EN BDH + If UsuarioActual.CveEmpresa = 140 Then + ImgOtrosConceptos.Visible = False + TrFormaEntrega.Visible = False + TabDetalleVentas.Visible = False + TabE.Visible = False + LnkOCs.Visible = False + GvPS.Columns(8).Visible = False + TrEdit.Visible = True + + ThProyecto.Visible = False + For Each Gvr As GridViewRow In GvPS.Rows + Gvr.FCLinkButton("imgE").Visible = False + Gvr.FCLinkButton("imgEPyME").Visible = True + Next + LnkAddVenta.Visible = True + divproyectos.Visible = False + + DivAddClasificacionPyME.Visible = False + DivAddUMPyME.Visible = False + End If + + If UsuarioActual.Empresa.CvePlataforma = 2 Then ImgOtrosConceptos.Visible = False TrFormaEntrega.Visible = False TabDetalleVentas.Visible = False @@ -2454,6 +2476,7 @@ Partial Class Ventas LnkOCs.Visible = False GvPS.Columns(8).Visible = False TrEdit.Visible = False + ThProyecto.Visible = False For Each Gvr As GridViewRow In GvPS.Rows Gvr.FCLinkButton("imgE").Visible = False @@ -2565,6 +2588,24 @@ Partial Class Ventas TxtFecha.Enabled = True CargaPorcentajeMarcas() + + BloqueaCondiconesPago() + End Sub + + Private Sub BloqueaCondiconesPago() + If UsuarioActual.TienePermisoProceso(289) Then + DdlFormaEntrega.Enabled = False + DdlUsoCFDI.Enabled = False + DdlMetodoPago33.Enabled = False + DdlFormaPago33.Enabled = False + DdlTiposRelacion.Enabled = False + TxtFechaPago.ReadOnly = True + TxtFechaPago.Enabled = False + RBLPago.Enabled = False + imgCalendario.Visible = False + End If + + UPCondicionesPago.Update() End Sub Private Sub ConfiguraEmpresa() @@ -5107,9 +5148,11 @@ Partial Class Ventas UpModalTitleUploadDocumentoCliente.Update() UpModalButtonUploadDocumentoCliente.Update() UPObservaciones.Update() + + ' RegistraScript("$('#DivDocsClienteUpload').modal({ backdrop: 'static', keyboard: false});", "modalOC") End If - + BloqueaCondiconesPago() End Sub Private Sub CargaRestriccionesCreditoCliente(Optional Alertas As Boolean = False, Optional CveVenta As Integer = -1) @@ -5778,6 +5821,10 @@ Partial Class Ventas Descuento = (GvPS.Rows(e.RowIndex).FCTextBox("TxtDescuento").Text.ToDecimal).RoundSQL(NumeroDecimales) CuentaPredial = GvPS.Rows(e.RowIndex).FCTextBox("TxtPredial").Text.Trim + If UsuarioActual.CveEmpresa = 140 Then + Descuento = CalcularDescuentos(TmpDT.Rows(e.RowIndex)("CvePS").ToString.ToEntero, Cantidad, PU) + End If + Dim CantidadOriginal As Decimal = GvPS.Rows(e.RowIndex).DataKey("Cantidad").ToDecimal() Dim DatarowPS As DataRow = Nothing @@ -13965,10 +14012,100 @@ Partial Class Ventas Return True End Function - Private Sub AgregarPS() + Private Function CalcularDescuentos(CvePS As Integer, Cantidad As Decimal, PU As Decimal) As Decimal + Dim Descuento As Decimal = HdnDescuento.Value.ToDecimal + If UsuarioActual.Empresa.Funcionalidad(572) = "1" AndAlso Not TbDescuentosRNC.Visible Then + TbDescuentosRNC.Visible = True + End If + + If HdnTipoDescuento.Value = "0" Then + Descuento = HdnDescuento.Value.ToDecimal * Cantidad + End If + + 'AGREGA PROMOCION EN EL DESCUENTO + Dim TipoPromo As Integer = 0 + Dim TotalPromocion As Decimal = 0 + Dim PromocionPorcentaje As Decimal = 0 + Dim CantMinima As Integer = 0 + + If DtPromociones.Rows.Count > 0 And DtPromociones IsNot Nothing Then + Dim dr As DataRow = DtPromociones.FiltroPrimero($"CvePS = {CvePS}") + If dr IsNot Nothing Then + TipoPromo = dr("TipoPromocion").ToString.ToEntero + TotalPromocion = dr("PUPromocion").ToString.ToDecimal * TxtCantidad.Text.ToDecimal + PromocionPorcentaje = dr("Promocion").ToString.ToDecimal + CantMinima = dr("CantidadMinima").ToString.ToEntero + End If + End If + + If TipoPromo = 1 Then 'Promocion por Importe $ + Descuento = Descuento + TotalPromocion + ElseIf TipoPromo = 2 Then 'Promocion por % + Descuento = Descuento + ((PU * PromocionPorcentaje / 100) * Cantidad) + ElseIf TipoPromo = 3 Then 'Promocion por Cantidad + If Cantidad >= CantMinima Then + Descuento = Descuento + TotalPromocion + End If + End If + + Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") + Dim ValidaCondicionesComerciales As Boolean = True + + If DrPS IsNot Nothing AndAlso DrPS("CveClasificacion").ToString.ToEntero = 20636 Then + ValidaCondicionesComerciales = False + End If + + 'VERIFICA SI APLICAN CONDICIONES COMERCIALES + If ValidaCondicionesComerciales AndAlso DtPorcentajeMarcas IsNot Nothing AndAlso DtPorcentajeMarcas.Rows.Count > 0 Then + 'VERIFICA SI EL PRODUCTO TIENE ESPECIFICADA UNA MARCA + If Not String.IsNullOrEmpty(DrPS("CveMarca").ToString()) AndAlso DrPS("CveMarca").ToString().ToEntero() > 0 Then + Dim RowPorcentaje = DtPorcentajeMarcas.FiltroPrimero($"CveMarca={DrPS("CveMarca").ToString()}") + 'REALIZA LOS DESCUENTOS DE ACUERDO AL PORCENTAJE POR MARCA + If RowPorcentaje IsNot Nothing Then + 'LIMPIAR LOS DESCUENTOS + Descuento = 0 + Dim PorcentajeProducto = RowPorcentaje("PorcentajeProducto").ToString().ToDecimal() / 100D + Dim PorcentajeProducto2 = RowPorcentaje("PorcentajeProducto2").ToString().ToDecimal() / 100D + Dim PorcentajeProducto3 = RowPorcentaje("PorcentajeProducto3").ToString().ToDecimal() / 100D + + Dim TotalInicial As Decimal = (Cantidad * (PU)) - Descuento + Dim TotalFinal = TotalInicial + 'SI APLICA EL PRIMER DESCUENTO + If PorcentajeProducto > 0 Then + Dim Descuento1 As Decimal = (TotalInicial * PorcentajeProducto).RoundSQL(2) + Dim Total2 = (TotalInicial - Descuento1) + + 'SI APLICA EL SEGUNDO DESCUENTO + If PorcentajeProducto2 > 0 Then + Dim Descuento2 As Decimal = (Total2 * PorcentajeProducto2).RoundSQL(2) + Dim Total3 = (Total2 - Descuento2) + + 'SI APLICA EL TERCER DESCUENTO + If PorcentajeProducto3 > 0 Then + Dim Descuento3 As Decimal = (Total3 * PorcentajeProducto3).RoundSQL(2) + TotalFinal = Total3 - Descuento3 + Else + TotalFinal = Total3 + End If + Else + TotalFinal = Total2 + End If + Else + TotalFinal = TotalInicial + End If + + Descuento += ((Cantidad * PU) - TotalFinal) + + End If + End If + End If + + Return Descuento + End Function + Private Sub AgregarPS() 'SELECCIONA EL PS DEPENDIENDO LA MODALIDAD (CODIGO BARRAS - DDL) - Dim CvePS = -1 + Dim CvePS As Integer = -1 If DIVCod.Visible Then CvePS = HdnCvePS.Value.ToEntero Else @@ -13977,99 +14114,13 @@ Partial Class Ventas If ValidaAgregarPS(CvePS, DdlUnidadMedida.SelectedValue.ToEntero, TxtPrecio.Text.Trim.ToDouble, HdnTipoPS.Value.ToEntero) Then - If UsuarioActual.Empresa.Funcionalidad(572) = "1" AndAlso Not TbDescuentosRNC.Visible Then - TbDescuentosRNC.Visible = True - End If - If UsuarioActual.Empresa.Funcionalidad(507) = DdlPS.SelectedValue Then CvePSAmortizacion = DdlPS.SelectedValue.ToEntero.ToEntero End If - Dim Descuento As Decimal = HdnDescuento.Value.ToDecimal - If HdnTipoDescuento.Value = "0" Then - Descuento = HdnDescuento.Value.ToDecimal * TxtCantidad.Text.ToDecimal - End If - - - 'Agrega Promocion en el Descuento - Dim TipoPromo As Integer = 0 - Dim TotalPromocion As Decimal = 0 - Dim PromocionPorcentaje As Decimal = 0 - Dim CantMinima As Integer = 0 - - If DtPromociones.Rows.Count > 0 And DtPromociones IsNot Nothing Then - Dim dr As DataRow = DtPromociones.FiltroPrimero($"CvePS = {CvePS}") - If dr IsNot Nothing Then - TipoPromo = dr("TipoPromocion").ToString.ToEntero - TotalPromocion = dr("PUPromocion").ToString.ToDecimal * TxtCantidad.Text.ToDecimal - PromocionPorcentaje = dr("Promocion").ToString.ToDecimal - CantMinima = dr("CantidadMinima").ToString.ToEntero - End If - End If - - If TipoPromo = 1 Then 'Promocion por Importe $ - Descuento = Descuento + TotalPromocion - ElseIf TipoPromo = 2 Then 'Promocion por % - Descuento = Descuento + ((TxtPrecio.Text.Trim.ToDecimal * PromocionPorcentaje / 100) * TxtCantidad.Text.ToDecimal) - ElseIf TipoPromo = 3 Then 'Promocion por Cantidad - If TxtCantidad.Text.ToDecimal >= CantMinima Then - Descuento = Descuento + TotalPromocion - End If - End If - Dim Cantidad As Decimal = TxtCantidad.Text.ToDecimal Dim PU As Decimal = If(CvePSAmortizacion > 0, TxtPrecio.Text.Trim.ToDecimal * -1, TxtPrecio.Text.Trim.ToDecimal) - - Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") ' Estado = -1 - Dim ValidaCondicionesComerciales As Boolean = True - - If DrPS IsNot Nothing AndAlso DrPS("CveClasificacion").ToString.ToEntero = 20636 Then - ValidaCondicionesComerciales = False - End If - - 'VERIFICA SI APLICAN CONDICIONES COMERCIALES - If ValidaCondicionesComerciales AndAlso DtPorcentajeMarcas IsNot Nothing AndAlso DtPorcentajeMarcas.Rows.Count > 0 Then - 'VERIFICA SI EL PRODUCTO TIENE ESPECIFICADA UNA MARCA - If Not String.IsNullOrEmpty(DrPS("CveMarca").ToString()) AndAlso DrPS("CveMarca").ToString().ToEntero() > 0 Then - Dim RowPorcentaje = DtPorcentajeMarcas.FiltroPrimero($"CveMarca={DrPS("CveMarca").ToString()}") - 'REALIZA LOS DESCUENTOS DE ACUERDO AL PORCENTAJE POR MARCA - If RowPorcentaje IsNot Nothing Then - Dim PorcentajeProducto = RowPorcentaje("PorcentajeProducto").ToString().ToDecimal() / 100D - Dim PorcentajeProducto2 = RowPorcentaje("PorcentajeProducto2").ToString().ToDecimal() / 100D - Dim PorcentajeProducto3 = RowPorcentaje("PorcentajeProducto3").ToString().ToDecimal() / 100D - - Dim TotalInicial As Decimal = (Cantidad * (PU)) - Descuento - Dim TotalFinal = TotalInicial - 'SI APLICA EL PRIMER DESCUENTO - If PorcentajeProducto > 0 Then - Dim Descuento1 As Decimal = (TotalInicial * PorcentajeProducto).RoundSQL(2) - Dim Total2 = (TotalInicial - Descuento1) - - 'SI APLICA EL SEGUNDO DESCUENTO - If PorcentajeProducto2 > 0 Then - Dim Descuento2 As Decimal = (Total2 * PorcentajeProducto2).RoundSQL(2) - Dim Total3 = (Total2 - Descuento2) - - 'SI APLICA EL TERCER DESCUENTO - If PorcentajeProducto3 > 0 Then - Dim Descuento3 As Decimal = (Total3 * PorcentajeProducto3).RoundSQL(2) - TotalFinal = Total3 - Descuento3 - Else - TotalFinal = Total3 - End If - Else - TotalFinal = Total2 - End If - Else - TotalFinal = TotalInicial - End If - - Descuento += ((Cantidad * PU) - TotalFinal) - - End If - End If - - End If + Dim Descuento As Decimal = CalcularDescuentos(CvePS, Cantidad, PU) AgregarProductoServicio(Cantidad, DdlUnidadMedida.SelectedValue.ToEntero, DdlUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text, CvePS, "", TxtObsPS.Text.Trim, PU, Descuento, @@ -14088,18 +14139,6 @@ Partial Class Ventas End If End If - ''NO SIRVE PARA NADA - NO SE USAN LAS VARIABLES - IPP 28 AGOSTO 2017 - 'For Each gvr As GridViewRow In GVAnticipos.Rows - ' Dim total As Decimal = TxtTotal.Text.ToString.ToDecimal - ' Dim saldo As Decimal = gvr.DataKey("Saldo").ToDecimal - ' Dim maxsaldo As Decimal - ' If total > saldo Then - ' maxsaldo = saldo - ' Else - ' maxsaldo = total - ' End If - 'Next - End Sub @@ -14112,60 +14151,12 @@ Partial Class Ventas Dim CveSubProyecto As Integer = IIf(DdlSubProyectoPyME.SelectedValue <> "-1", DdlSubProyectoPyME.SelectedValue, "0").ToString.ToEntero Dim SubProyecto As String = IIf(DdlSubProyectoPyME.SelectedValue <> "-1", DdlSubProyectoPyME.SelectedItem.Text, "").ToString - Dim Descuento As Decimal = 0 Dim PU As Decimal = TxtPrecioPyME.Text.ToDecimal() Dim Cantidad As Decimal = TxtCantidadPyME.Text.ToDecimal() Dim CvePS As Integer = DdlPSPyME.SelectedValue.ToEntero - Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") ' Estado = -1 - Dim ValidaCondicionesComerciales As Boolean = True - If DrPS IsNot Nothing AndAlso DrPS("CveClasificacion").ToString.ToEntero = 20636 Then - ValidaCondicionesComerciales = False - End If - 'VERIFICA SI APLICAN CONDICIONES COMERCIALES - If ValidaCondicionesComerciales AndAlso DtPorcentajeMarcas IsNot Nothing AndAlso DtPorcentajeMarcas.Rows.Count > 0 Then - 'VERIFICA SI EL PRODUCTO TIENE ESPECIFICADA UNA MARCA - If Not String.IsNullOrEmpty(DrPS("CveMarca").ToString()) AndAlso DrPS("CveMarca").ToString().ToEntero() > 0 Then - Dim RowPorcentaje = DtPorcentajeMarcas.FiltroPrimero($"CveMarca={DrPS("CveMarca").ToString()}") - 'REALIZA LOS DESCUENTOS DE ACUERDO AL PORCENTAJE POR MARCA - If RowPorcentaje IsNot Nothing Then - Dim PorcentajeProducto = RowPorcentaje("PorcentajeProducto").ToString().ToDecimal() / 100D - Dim PorcentajeProducto2 = RowPorcentaje("PorcentajeProducto2").ToString().ToDecimal() / 100D - Dim PorcentajeProducto3 = RowPorcentaje("PorcentajeProducto3").ToString().ToDecimal() / 100D - - Dim TotalInicial As Decimal = (Cantidad * (PU)) - Descuento - Dim TotalFinal = TotalInicial - 'SI APLICA EL PRIMER DESCUENTO - If PorcentajeProducto > 0 Then - Dim Descuento1 As Decimal = (TotalInicial * PorcentajeProducto).RoundSQL(2) - Dim Total2 = (TotalInicial - Descuento1) - - 'SI APLICA EL SEGUNDO DESCUENTO - If PorcentajeProducto2 > 0 Then - Dim Descuento2 As Decimal = (Total2 * PorcentajeProducto2).RoundSQL(2) - Dim Total3 = (Total2 - Descuento2) - - 'SI APLICA EL TERCER DESCUENTO - If PorcentajeProducto3 > 0 Then - Dim Descuento3 As Decimal = (Total3 * PorcentajeProducto3).RoundSQL(2) - TotalFinal = Total3 - Descuento3 - Else - TotalFinal = Total3 - End If - Else - TotalFinal = Total2 - End If - Else - TotalFinal = TotalInicial - End If - - Descuento += ((Cantidad * PU) - TotalFinal) - - End If - End If - - End If + Dim Descuento As Decimal = CalcularDescuentos(CvePS, Cantidad, PU) AgregarProductoServicio(Cantidad, DdlUMPyME.SelectedValue.ToEntero, DdlUMPyME.SelectedItem.Text, DdlClasificacionPyME.SelectedValue.ToEntero, DdlClasificacionPyME.SelectedItem.Text, CvePS, DdlPSPyME.SelectedText, TxtObsPyME.Text, PU, Descuento, CveProyecto, Proyecto, CveSubProyecto, SubProyecto) @@ -14173,8 +14164,6 @@ Partial Class Ventas CalculaUsados() CalculaTotalesVenta() - - ElseIf Modalidad = "U" Then Dim ErrorEdit As Boolean = True @@ -14355,49 +14344,6 @@ Partial Class Ventas DrPS("IEPSPorcentaje") = 0 End If - ''VERIFICA SI APLICAN CONDICIONES COMERCIALES - 'If DtPorcentajeMarcas IsNot Nothing AndAlso DtPorcentajeMarcas.Rows.Count > 0 Then - ' 'VERIFICA SI EL PRODUCTO TIENE ESPECIFICADA UNA MARCA - ' If Not String.IsNullOrEmpty(DrPS("CveMarca").ToString()) AndAlso DrPS("CveMarca").ToString().ToEntero() > 0 Then - ' Dim RowPorcentaje = DtPorcentajeMarcas.FiltroPrimero($"CveMarca={DrPS("CveMarca").ToString()}") - ' 'REALIZA LOS DESCUENTOS DE ACUERDO AL PORCENTAJE POR MARCA - ' If RowPorcentaje IsNot Nothing Then - ' Dim PorcentajeProducto = RowPorcentaje("PorcentajeProducto").ToString().ToDecimal() / 100D - ' Dim PorcentajeProducto2 = RowPorcentaje("PorcentajeProducto2").ToString().ToDecimal() / 100D - ' Dim PorcentajeProducto3 = RowPorcentaje("PorcentajeProducto3").ToString().ToDecimal() / 100D - - ' Dim TotalInicial = (Cantidad * (PU)) - Descuento - ' Dim TotalFinal = TotalInicial - ' 'SI APLICA EL PRIMER DESCUENTO - ' If PorcentajeProducto > 0 Then - ' Dim Descuento1 = TotalInicial * PorcentajeProducto - ' Dim Total2 = (TotalInicial - Descuento1) - - ' 'SI APLICA EL SEGUNDO DESCUENTO - ' If PorcentajeProducto2 > 0 Then - ' Dim Descuento2 = Total2 * PorcentajeProducto2 - ' Dim Total3 = (Total2 - Descuento2) - - ' 'SI APLICA EL TERCER DESCUENTO - ' If PorcentajeProducto3 > 0 Then - ' Dim Descuento3 = Total3 * PorcentajeProducto3 - ' TotalFinal = Total3 - Descuento3 - ' Else - ' TotalFinal = Total3 - ' End If - ' Else - ' TotalFinal = Total2 - ' End If - ' Else - ' TotalFinal = TotalInicial - ' End If - - ' Descuento += ((Cantidad * PU) - TotalFinal) - - ' End If - ' End If - - 'End If TotalCalculableImpuestos = (Cantidad * (PU)) - Descuento TotalCalculableImpuestosIVA = TotalCalculableImpuestos * (1 + DrPS("IEPSPorcentaje").ToString.ToDecimal) @@ -17020,7 +16966,6 @@ Partial Class Ventas DrProducto("CvePS").ToString.ToEntero, DrProducto("PS").ToString, TxtObsPS.Text.Trim, TxtPrecio.Text.Trim.ToDecimal, 0, DdlProyecto.SelectedValue.ToEntero, DdlProyecto.SelectedItem.Text, DdlSubProyecto.SelectedValue.ToEntero, DdlSubProyecto.SelectedItem.Text) - 'AddPS(TxtCantidad.Text.Trim.ToDouble, DrProducto("CveUM").ToString.ToEntero, DrProducto("UnidadMedida").ToString, DrProducto("CveClasificacion").ToString.ToEntero, DrProducto("Clasificacion").ToString, ' DrProducto("CvePS").ToString.ToEntero, DrProducto("PS").ToString, TxtObsPS.Text.Trim, TxtPrecio.Text.Trim.ToDouble, HdnIVAPS.Value.ToDouble, 0, 0, ' -1, -1, True, DrProducto("Codigo").ToString, DdlProyecto.SelectedValue.ToEntero, @@ -19738,55 +19683,8 @@ Partial Class Ventas Dim Cantidad As Decimal = TxtCantidadPyME.Text.ToDecimal() Dim PU As Decimal = TxtPrecioPyME.Text.ToDecimal() - Dim Descuento As Decimal = 0 - Dim ValidaCondicionesComerciales As Boolean = True - If drPS IsNot Nothing AndAlso drPS("CveClasificacion").ToString.ToEntero = 20636 Then - ValidaCondicionesComerciales = False - End If - 'VERIFICA SI APLICAN CONDICIONES COMERCIALES - If ValidaCondicionesComerciales AndAlso DtPorcentajeMarcas IsNot Nothing AndAlso DtPorcentajeMarcas.Rows.Count > 0 Then - 'VERIFICA SI EL PRODUCTO TIENE ESPECIFICADA UNA MARCA - If Not String.IsNullOrEmpty(drPS("CveMarca").ToString()) AndAlso drPS("CveMarca").ToString().ToEntero() > 0 Then - Dim RowPorcentaje = DtPorcentajeMarcas.FiltroPrimero($"CveMarca={drPS("CveMarca").ToString()}") - 'REALIZA LOS DESCUENTOS DE ACUERDO AL PORCENTAJE POR MARCA - If RowPorcentaje IsNot Nothing Then - Dim PorcentajeProducto = RowPorcentaje("PorcentajeProducto").ToString().ToDecimal() / 100D - Dim PorcentajeProducto2 = RowPorcentaje("PorcentajeProducto2").ToString().ToDecimal() / 100D - Dim PorcentajeProducto3 = RowPorcentaje("PorcentajeProducto3").ToString().ToDecimal() / 100D - - Dim TotalInicial As Decimal = (Cantidad * (PU)) - Descuento - Dim TotalFinal = TotalInicial - 'SI APLICA EL PRIMER DESCUENTO - If PorcentajeProducto > 0 Then - Dim Descuento1 As Decimal = (TotalInicial * PorcentajeProducto).RoundSQL(2) - Dim Total2 = (TotalInicial - Descuento1) - - 'SI APLICA EL SEGUNDO DESCUENTO - If PorcentajeProducto2 > 0 Then - Dim Descuento2 As Decimal = (Total2 * PorcentajeProducto2).RoundSQL(2) - Dim Total3 = (Total2 - Descuento2) - - 'SI APLICA EL TERCER DESCUENTO - If PorcentajeProducto3 > 0 Then - Dim Descuento3 As Decimal = (Total3 * PorcentajeProducto3).RoundSQL(2) - TotalFinal = Total3 - Descuento3 - Else - TotalFinal = Total3 - End If - Else - TotalFinal = Total2 - End If - Else - TotalFinal = TotalInicial - End If - - Descuento += ((Cantidad * PU) - TotalFinal) - - End If - End If - - End If + Dim Descuento As Decimal = CalcularDescuentos(DdlPSPyME.SelectedValue.ToEntero, Cantidad, PU) TxtDescuentoPyME.Text = Descuento.FormatoNumero(2).Replace(","c, "") @@ -20009,8 +19907,6 @@ Partial Class Ventas BtnAgregarPS.Enabled = True End If - - UpSerieConsignacion.Update() TxtSerieLote.Text = "" TxtSerieLote.Focus() @@ -21764,7 +21660,7 @@ Partial Class Ventas UPCondicionesPago.Update() UpDetalle.Update() - + BloqueaCondiconesPago() End Sub Private Sub InicializaDTVentasNC() @@ -22083,6 +21979,8 @@ Partial Class Ventas End If Next + BloqueaCondiconesPago() + UpAnticipos.Update() UpParametros.Update() UpPS.Update() @@ -22095,6 +21993,8 @@ Partial Class Ventas UpnTools.Update() UPObservaciones.Update() UpAntNC.Update() + + End Sub #End Region @@ -22540,6 +22440,7 @@ Partial Class Ventas GvImpuestosLocales2.Enabled = True + BloqueaCondiconesPago() UpPS.Update() UPPDescuento.Update() @@ -23889,6 +23790,7 @@ Partial Class Ventas CambiaSucursalGeneral() CargaAnticipos(CveCliente) CargaRestriccionesCreditoCliente(CveVenta:=-1) + BloqueaCondiconesPago() UpParametros.Update() End Sub From e2380a2d870ad6f65f363030ba8f244b9e1e5363 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Thu, 20 Feb 2020 18:43:46 -0700 Subject: [PATCH 04/15] Mostar seleccione en uso de cfdi en clientes --- Ventas/Clientes.aspx.vb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index d37ad69e5..384674203 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -1862,8 +1862,9 @@ Partial Class Clientes Private Sub CargaComboCFDI() DdlUsoCFDI.Items.Clear() DdlUsoCFDI.DataSource = GlobalDTSATUsosCFDI(UsuarioActual.Empresa.EsPersonaFisica) - DdlUsoCFDI.DataBind() - + DdlUsoCFDI.DataBind() + DdlUsoCFDI.Items.Insert(0, New ListItem("Seleccione", "-1")) + DdlSucursalUsoCFDI.Items.Clear() DdlSucursalUsoCFDI.DataSource = GlobalDTSATUsosCFDI(UsuarioActual.Empresa.EsPersonaFisica) DdlSucursalUsoCFDI.DataBind() From cba0a5e6efe75955fa1c0ad4a20059b1fc9691f4 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Thu, 20 Feb 2020 18:44:19 -0700 Subject: [PATCH 05/15] Unificacion en el reporte de reembolsos comprobaciones --- Compras/RepRembolsoComprobaciones.aspx | 2 +- Compras/RepRembolsoComprobaciones.aspx.vb | 84 +++++++++++------------ 2 files changed, 43 insertions(+), 43 deletions(-) diff --git a/Compras/RepRembolsoComprobaciones.aspx b/Compras/RepRembolsoComprobaciones.aspx index ec1a2b43f..7d3509703 100644 --- a/Compras/RepRembolsoComprobaciones.aspx +++ b/Compras/RepRembolsoComprobaciones.aspx @@ -187,7 +187,7 @@ Excedente   - +
diff --git a/Compras/RepRembolsoComprobaciones.aspx.vb b/Compras/RepRembolsoComprobaciones.aspx.vb index 33994b2a3..77316d8e8 100644 --- a/Compras/RepRembolsoComprobaciones.aspx.vb +++ b/Compras/RepRembolsoComprobaciones.aspx.vb @@ -161,64 +161,64 @@ Partial Class Compras_RepRembolsoComprobaciones Dim ObjComp As New ClsCompras() Dim ObjMov As New ClsContabilidad(ObjComp.IniciaTransacSQL) Dim ObjAC As ClsContPAQi = Nothing - If UsuarioActual.Empresa.UsaContabilidad Then - ObjAC = New ClsContPAQi(UsuarioActual.Empresa) - ObjAC.IniciaTransacSQL() - End If + Dim TieneError = False Dim CvePrePoliza As Integer = 0 Dim IdPoliza As Integer = 0 Dim Msg As New StringBuilder - CvePrePoliza = ObjMov.AddPrePolizas("Compras/Registrar", 1, DtDatos(0)("Original").ToString.ToDecimal, DtDatos(0)("Original").ToString.ToDecimal, CveMoneda, TxtFechaUnificacion.Text.Trim.ToDate(), TxtConcepto.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=3) + Try + CvePrePoliza = ObjMov.AddPrePolizas("Compras/Registrar", 1, DtDatos(0)("Original").ToString.ToDecimal, DtDatos(0)("Original").ToString.ToDecimal, CveMoneda, TxtFechaUnificacion.Text.Trim.ToDate(), TxtConcepto.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=3) - If CvePrePoliza > 0 AndAlso DdlPersonal.SelectedValue.ToEntero > 0 Then - If Not ObjComp.UnificarComprasPersonal(CvePrePoliza, DdlPersonal.SelectedValue.ToEntero, -1, TxtNumeroReembolso.Text, UsuarioActual.CveEmpresa) Then - TieneError = True - End If - Else - If CvePrePoliza > 0 AndAlso DdlCajaChica.SelectedValue.ToEntero > 0 Then - If Not ObjComp.UnificarComprasPersonal(CvePrePoliza, -1, DdlCajaChica.SelectedValue.ToEntero, TxtNumeroReembolso.Text, UsuarioActual.CveEmpresa) Then + If CvePrePoliza > 0 AndAlso DdlPersonal.SelectedValue.ToEntero > 0 Then + If Not ObjComp.UnificarComprasPersonal(CvePrePoliza, DdlPersonal.SelectedValue.ToEntero, -1, TxtNumeroReembolso.Text, UsuarioActual.CveEmpresa) Then TieneError = True End If Else - TieneError = True - End If - - End If - - If ObjMov.ValidacionPrePolizaCuadre(CvePrePoliza, -1) Then - If ObjMov.ValorPolizaDescuadre > 0 Then - GuardaLogAD($"Compras/RepRembolsoComprobaciones - Unificar | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") - Alert(ObjMov.MensajePolizaDescuadre, TipoMensaje.MsgError) - TieneError = True - End If - End If - - If Not TieneError Then - Msg.AppendFormat("Se unificaron todas las compras con éxito") - End If - - If UsuarioActual.Empresa.Funcionalidad(200).ToString = "1" AndAlso Not TieneError Then - If ObjAC Is Nothing Then - TieneError = True - End If - - If Not TieneError Then - If Not ObjMov.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjAC) Then - TieneError = True - Alert($"Ocurrio un error al contabilizar {ObjMov.AlertaMensaje}", TipoMensaje.MsgAdvertencia) + If CvePrePoliza > 0 AndAlso DdlCajaChica.SelectedValue.ToEntero > 0 Then + If Not ObjComp.UnificarComprasPersonal(CvePrePoliza, -1, DdlCajaChica.SelectedValue.ToEntero, TxtNumeroReembolso.Text, UsuarioActual.CveEmpresa) Then + TieneError = True + End If Else - IdPoliza = ObjMov.ContaIdPoliza + TieneError = True + End If + + End If + + If ObjMov.ValidacionPrePolizaCuadre(CvePrePoliza, -1) Then + If ObjMov.ValorPolizaDescuadre > 0 Then + GuardaLogAD($"Compras/RepRembolsoComprobaciones - Unificar | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas") + Alert(ObjMov.MensajePolizaDescuadre, TipoMensaje.MsgError) + TieneError = True End If End If - If IdPoliza > 0 AndAlso Not TieneError Then - Msg.AppendFormat("

Ver Póliza", IdPoliza) + If Not TieneError Then + Msg.AppendFormat("Se unificaron todas las compras con éxito") End If - End If + If UsuarioActual.Empresa.Funcionalidad(200).ToString = "1" AndAlso Not TieneError Then + ObjAC = New ClsContPAQi(UsuarioActual.Empresa) + ObjAC.IniciaTransacSQL() + If Not TieneError Then + If Not ObjMov.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjAC) Then + TieneError = True + Alert($"Ocurrio un error al contabilizar {ObjMov.AlertaMensaje}", TipoMensaje.MsgAdvertencia) + Else + IdPoliza = ObjMov.ContaIdPoliza + End If + End If + + If IdPoliza > 0 AndAlso Not TieneError Then + Msg.AppendFormat("

Ver Póliza", IdPoliza) + End If + + End If + Catch ex As Exception + TieneError = True + OnError("Ocurrió un error al unificar las compras", ex) + End Try If Not TieneError Then ObjComp.Commit() From cac91f7fc966035a5a82d21aeba771102e232220 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Fri, 21 Feb 2020 10:01:23 -0700 Subject: [PATCH 06/15] Editar cotizaciones --- Ventas/Ventas.aspx.vb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 261bbce35..3097d4661 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -23987,7 +23987,7 @@ Partial Class Ventas If Me.CveVenta <= 0 OrElse DtUsadosDevolucion IsNot Nothing Then TmpDTCalculo = TmpDT.Rows.Cast(Of DataRow).ToArray() 'SI ES EDICION DE REMISION SOLO CONSIDERAR LOS PRODUCTOS NUEVOS - ElseIf Me.CveVenta > 0 AndAlso DtUsadosDevolucion Is Nothing AndAlso DdlTipoComprobante.SelectedValue = "Rem" Then + ElseIf Me.CveVenta > 0 AndAlso DtUsadosDevolucion Is Nothing AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem", "Cot") Then TmpDTCalculo = TmpDT.Select("CveVentaDetalle IS NULL OR CveVentaDetalle <=0") End If @@ -24013,7 +24013,7 @@ Partial Class Ventas If Me.CveVenta <= 0 OrElse DtUsadosDevolucion IsNot Nothing Then TmpDTCalculo = TmpDT.Rows.Cast(Of DataRow).ToArray() 'SI ES EDICION DE REMISION SOLO CONSIDERAR LOS PRODUCTOS NUEVOS - ElseIf Me.CveVenta > 0 AndAlso DtUsadosDevolucion Is Nothing AndAlso DdlTipoComprobante.SelectedValue = "Rem" Then + ElseIf Me.CveVenta > 0 AndAlso DtUsadosDevolucion Is Nothing AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem", "Cot") Then TmpDTCalculo = TmpDT.Select("CveVentaDetalle IS NULL OR CveVentaDetalle <=0") End If From d3481a125258ecec3ab01a863de2911769a4a3b5 Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Fri, 21 Feb 2020 12:55:09 -0700 Subject: [PATCH 07/15] agregando el uso de cfdi en un nuevo cliente --- General/SaldosIniciales.aspx.vb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/General/SaldosIniciales.aspx.vb b/General/SaldosIniciales.aspx.vb index dd79a2a08..44105439a 100644 --- a/General/SaldosIniciales.aspx.vb +++ b/General/SaldosIniciales.aspx.vb @@ -1051,15 +1051,14 @@ Partial Class General_SaldosIniciales Dim BonificacionUsado As Boolean = If(Row("EmitirBon Usado").ToString.ToUpper = "SI", True, False) Dim LimiteCredito As Decimal = Row("Limite Credito").ToString.ToDecimal - Dim CobranzaCorreo As String = Row("CorreoPago").ToString + Dim CobranzaCorreo As String = Row("CorreoPagos").ToString Dim PlazoCobranza As Integer = Row("Plazo Cobranza").ToString.ToEntero Dim DìaVisita As String = Row("Dia Pago").ToString Dim DiasPagoEspecifico As String = Row("Dìa Visita").ToString Dim CobranzaContacto As String = Row("Encargado Pago").ToString Dim CobranzaTelefono As String = Row("Celular Contacto").ToString.Replace("-", "").Replace(" ", "").Replace("(", "").Replace(")", "") - - + Dim CveUsoCFDI As Integer = If(Row("UsoCFDI").ToString = "", -1, GlobalDTSATUsosCFDI().FiltroPrimeroValor("CveUsoCFDI", String.Format("UsoCFDI = '{0}'", Row("UsoCFDI").ToString)).ToEntero) ' CobranzaContacto = Regex.Replace(CobranzaContacto, "[^0-9]", "") 'Telefono @@ -1169,7 +1168,7 @@ Partial Class General_SaldosIniciales If Not ObjClientes.AddCliente(RazonSocial, RazonSocial, Calle, NumExt.ToString, "", Colonia, Poblacion, Poblacion, Estado, Pais, RFC, CodigoPostal, Telefono, Contacto, "", "", "", "", "", -1, False, 0, 0, False, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", CveVendedor, PlazoCobranza, -1, "-1", "-1", -1, "-1", -1, "0", -1, "0", 0, "", 0, "", 0, "", 0, "", "", "", Codigo, LimiteCredito, "", 1, False, "", "", "", False, "", "", "", "", "", False, "", "", "", False, 0, -1, EsDistribuidor:=EsDistribuidor, CveClienteClasificacion:=CveClasificación, CargoUsado:=CargoUsado, - BonificacionUsado:=BonificacionUsado, CobranzaContacto:=CobranzaContacto, CobranzaCorreo:=CobranzaCorreo, DiasEspecifico:=DiasPagoEspecifico, DiasRevision:=DìaVisita, CobranzaTelefono:=CobranzaTelefono, CveFormaPago33:=CveFormaPago33) Then + BonificacionUsado:=BonificacionUsado, CobranzaContacto:=CobranzaContacto, CobranzaCorreo:=CobranzaCorreo, DiasEspecifico:=DiasPagoEspecifico, DiasRevision:=DìaVisita, CobranzaTelefono:=CobranzaTelefono, CveFormaPago33:=CveFormaPago33, CveUsoCFDI:=CveUsoCFDI) Then ErrorClientes = True RFC.GuardaLog From 0bd3a99894fdd3642e7e5dc7a39aab81c6277d2a Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Fri, 21 Feb 2020 17:49:05 -0700 Subject: [PATCH 08/15] CACULO CORRECTO DE CODIGOS DE INSPECCION,LINEA,ENSAMBLE --- Ventas/PV.aspx | 79 ++++++++++++++++----------------------------- Ventas/PV.aspx.vb | 82 ++++++++++++++++++++++++++++++++--------------- 2 files changed, 83 insertions(+), 78 deletions(-) diff --git a/Ventas/PV.aspx b/Ventas/PV.aspx index 07ff5a1dc..84ed1799d 100644 --- a/Ventas/PV.aspx +++ b/Ventas/PV.aspx @@ -1,4 +1,4 @@ -<%@ Page Title="Ventas - Facturación" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="PV.aspx.vb" Inherits="PV" EnableEventValidation="false" %> +<%@ Page Title="Ventas - Facturación" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="PV.aspx.vb" Inherits="PV" EnableEventValidation="false"%> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> <%--Necesario para el modal que no se cierra--%> @@ -2913,7 +2913,7 @@ - + @@ -3021,75 +3021,50 @@ function ValidarCodigoEnsamble(source, arguments) { let CveMarca = HdnPSAjusteMarca.value; let CveClasificacion = HdnPSAjusteClasificacion.value; - let regex = ""; - - //SI ES MOTOBATERIA - if (CveClasificacion = "20517") { - regex = "[1X]|" - //regex = "[*]|" - //SI ES OPTIMA - } else if (CveClasificacion = "20511") { - regex = "[1X]|" - } //MARCA OPTIMA if (CveMarca == "1086") { - let re = new RegExp("^" + regex + "[0-9]+$"); - arguments.IsValid = re.test(parseInt(arguments.Value)); + let regex = new RegExp("^[0-9]+$"); + arguments.IsValid = regex.test(arguments.Value); return; + //MARCA MOTOBATERIAS + } else if ((CveMarca == "1090" || CveMarca == "1091") || CveClasificacion == "20517") { + let regex = new RegExp("^[1X]"); + arguments.IsValid = regex.test(arguments.Value); + return; + //AUTOMOTRIZ-ACUMULADORES } else { - let re = new RegExp("^" + regex + "[0-9][A-HJ-M]([[0-2][0-9]|3[0-1])[0-9A-Z][ACEN][2-5]$"); - arguments.IsValid = re.test(arguments.Value); + let regex = new RegExp("^[1X]|^[0-9][A-HJ-M]([[0-2][0-9]|3[0-1])[0-9A-Z][ACEN][2-5]$"); + arguments.IsValid = regex.test(arguments.Value); return; } } function ValidarCodigoLinea(source, arguments) { - var CveMarca = HdnPSAjusteMarca.value; - let CveClasificacion = HdnPSAjusteClasificacion.value; - let regex = ""; - - //SI ES MOTOBATERIA - if (CveClasificacion = "20517") { - regex = "[*]|"; - } else { - regex = ""; - } - - if (CveMarca == "1086") { - var re = new RegExp("^" + regex + "[0-9]+$"); - arguments.IsValid = re.test(parseInt(arguments.Value)); - } else { - var re = new RegExp("^" + regex + "$"); - arguments.IsValid = re.test(arguments.Value); - } + var regex = new RegExp("^[*]"); + arguments.IsValid = regex.test(arguments.Value); } function ValidarCodigoInspeccion(source, arguments) { + let CveMarca = HdnPSAjusteMarca.value; let CveClasificacion = HdnPSAjusteClasificacion.value; - let clasificaciones = ["20517", "20511"] - - //SI ES MOTOBATERIA - if (CveClasificacion = "20517") { - var re = new RegExp("^[X]|[x]|[A-L][0-9][1-9A-Z][A-HJ-M]$"); - arguments.IsValid = re.test(arguments.Value); + //MARCA OPTIMA + if (CveMarca == "1086") { + var regex = new RegExp("^\d{4}$|^[A-L][0-9][1-9A-Z][A-HJ-M]$"); + arguments.IsValid = regex.test(arguments.Value); return; + //MARCA MOTOBATERIAS + } else if ((CveMarca == "1090" || CveMarca == "1091") || CveClasificacion == "20517") { + var regex = new RegExp("^[A-L][0-9][1-9A-Z][A-HJ-M]$"); + arguments.IsValid = regex.test(arguments.Value); + return; + //AUTOMOTRIZ-ACUMULADORES } else { - var re = new RegExp("^[A-L][0-9][1-9A-Z][A-HJ-M]$"); - arguments.IsValid = re.test(arguments.Value); + var regex = new RegExp("^[X]|^[x]|[A-L][0-9][1-9A-Z][A-HJ-M]$"); + arguments.IsValid = regex.test(arguments.Value); return; } - //if (clasificaciones.includes(CveClasificacion)) { - // //var re = new RegExp("^[*]|[A-L][0-9][1-9A-Z][A-HJ-M]$"); - // var re = new RegExp("^[X]|[A-L][0-9][1-9A-Z][A-HJ-M]$"); - // arguments.IsValid = re.test(parseInt(arguments.Value)); - // return; - //} else { - // var re = new RegExp("^[A-L][0-9][1-9A-Z][A-HJ-M]$"); - // arguments.IsValid = re.test(arguments.Value); - // return; - //} } function CalculaMesesUso() { diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb index 1435bcd1a..ed5039389 100644 --- a/Ventas/PV.aspx.vb +++ b/Ventas/PV.aspx.vb @@ -568,7 +568,7 @@ Partial Class PV End Property Private Property CveVentaDetalle As Integer Get - Return ViewState("CveVentaDetalle").ToString.ToEntero + Return If(ViewState("CveVentaDetalle") Is Nothing, -1, ViewState("CveVentaDetalle").ToString.ToEntero) End Get Set(value As Integer) ViewState("CveVentaDetalle") = value @@ -682,6 +682,15 @@ Partial Class PV ViewState("EnviarCorreoCliente") = value End Set End Property + + Private ReadOnly Property ClasificacionesDescuentos As Dictionary(Of Integer, Decimal) + Get + Return New Dictionary(Of Integer, Decimal) From { + {20516, 0.23D}, 'Descuento para lubricantes LTH + {20515, 0.24D} 'Descuento para filtros LTH + } + End Get + End Property #End Region #Region "PROPIEDADES DE PUNTO DE VENTA" @@ -3570,11 +3579,7 @@ Partial Class PV End If 'Descuento por clasificación If drPS("CveClasificacion").ToString.ToEntero.Contiene(20516, 20515) Then - Dim clasificacionesDescuentos As New Dictionary(Of Integer, Double) From { - {20516, 0.23}, 'Descuento para lubricantes LTH - {20515, 0.24} 'Descuento para filtros LTH - } - TxtDescuento.Text = (PrecioSugerido * clasificacionesDescuentos(drPS("CveClasificacion").ToString.ToEntero)).ToString("F2") + TxtDescuento.Text = (PrecioSugerido * ClasificacionesDescuentos(drPS("CveClasificacion").ToString.ToEntero)).ToString("F2") End If If ChkAjuste.Checked Then @@ -3935,6 +3940,7 @@ Partial Class PV TxtObsPS.Text = "" TxtPrecio.Text = "" + TxtDescuento.Text = "" LblTotalPS.Text = "0.00" HdnIVAPS.Value = "-1" HdnIVARetAPS.Value = "-1" @@ -4414,7 +4420,7 @@ Partial Class PV ChkAgregar.Checked = True divagregrarotrops.Visible = True UpVenta.Update() - RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddVenta")) + RegistraScript("$('#DivAddVenta').modal({backdrop: 'static', keyboard: false});") End Sub Private Sub CargaBCI() 'Dim ObjGral As New ClsGenerales @@ -4448,6 +4454,7 @@ Partial Class PV TxtCantidad.Text = GvRow.DataKey("Cantidad") TxtObsPS.Text = GvRow.DataKey("Obs") TxtPrecio.Text = GvRow.DataKey("PU") + TxtDescuento.Text = GvRow.DataKey("Descuento") LblTotalPS.Text = GvRow.DataKey("Total") ChkAgregar.Checked = False divagregrarotrops.Visible = False @@ -4456,7 +4463,7 @@ Partial Class PV End If AddPolizaVirtual(DdlPS.SelectedValue.ToEntero()) UpVenta.Update() - RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddVenta"), "EdicionVenta") + RegistraScript("$('#DivAddVenta').modal({backdrop: 'static', keyboard: false});", "EdicionVenta") End Sub Protected Sub LnkAgregarPS_Click(sender As Object, e As EventArgs) If AgregarPS() Then @@ -4490,9 +4497,13 @@ Partial Class PV 'SELECCIONA EL PS DEPENDIENDO LA MODALIDAD (CODIGO BARRAS - DDL) Dim CvePS = DdlPS.SelectedValue.ToEntero + Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") If ValidaAgregarPS(CvePS, DdlUnidadMedida.SelectedValue.ToEntero, TxtPrecio.Text.Trim.ToDouble, HdnTipoPS.Value.ToEntero, TxtCantidad.Text.ToDecimal) Then + Dim Cantidad As Decimal = TxtCantidad.Text.ToDecimal + Dim PU As Decimal = If(CvePSAmortizacion > 0, TxtPrecio.Text.Trim.ToDecimal * -1, TxtPrecio.Text.Trim.ToDecimal).RoundSQL(6) + If UsuarioActual.Empresa.Funcionalidad(507) = DdlPS.SelectedValue Then CvePSAmortizacion = DdlPS.SelectedValue.ToEntero.ToEntero End If @@ -4502,11 +4513,15 @@ Partial Class PV Descuento = HdnDescuento.Value.ToDecimal * TxtCantidad.Text.ToDecimal End If + If DrPS("CveClasificacion").ToString.ToEntero.Contiene(20516, 20515) Then + Descuento = ((Cantidad * PU) * ClasificacionesDescuentos(DrPS("CveClasificacion").ToString.ToEntero)) + End If + Dim CveProyecto As Integer = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)("CveProyecto").ToString.ToEntero Dim Proyecto As String = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)("Proyecto").ToString - Dim Consec = AgregarProductoServicio(TxtCantidad.Text.ToDecimal, DdlUnidadMedida.SelectedValue.ToEntero, DdlUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text, - CvePS, "", TxtObsPS.Text.Trim, If(CvePSAmortizacion > 0, TxtPrecio.Text.Trim.ToDecimal * -1, TxtPrecio.Text.Trim.ToDecimal), Descuento, + Dim Consec = AgregarProductoServicio(Cantidad, DdlUnidadMedida.SelectedValue.ToEntero, DdlUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text, + CvePS, "", TxtObsPS.Text.Trim, PU, Descuento, CveProyecto, Proyecto, DdlSubProyectoDatos.SelectedValue.ToEntero, DdlSubProyectoDatos.SelectedItem.Text, SerieLote:="", TiempoEntrega:="", CuentaPredial:="", RegeneraIEPS:=ClienteDesglosaIEPS, CveVentaDetalle:=CveVentaDetalle, EsCargo:=EsCargo) @@ -5856,7 +5871,7 @@ Partial Class PV TxtCodEnsamble.Text = "" DdlTipoUso.SelectedIndex = -1 TxtCodLinea.Text = "" - TxtPrecio.Text = "" + 'TxtPrecio.Text = "" TxtFechaAjuste.Text = Now.ToShortDateString CEEFechaAjuste.EndDate = Now TxtCodInspeccion.Text = "" @@ -5910,22 +5925,27 @@ Partial Class PV Dim FechaI As Date = TxtFechaAjuste.Text.ToDate.AddDays(1) Dim FechaF As Date = Now Dim Dia As Integer = FechaI.Day - 'validación adicional, para saber si el mes tiene 31 días y el actua es menor. - If FechaI.Day > Today.LastDayOfMonth.Day Then Dia = Today.LastDayOfMonth.Day - Dim FechaT As Date = String.Format("{0}/{1}/{2}", Dia, FechaF.Month, FechaF.Year).ToDate 'armo la fecha con el día del mes actual + Try + 'validación adicional, para saber si el mes tiene 31 días y el actua es menor. + If FechaI.Day > Today.LastDayOfMonth.Day Then Dia = Today.LastDayOfMonth.Day + Dim FechaT As Date = String.Format("{0}/{1}/{2}", Dia, FechaF.Month, FechaF.Year).ToDate 'armo la fecha con el día del mes actual - Dim MesesTrascurridos As Integer = Math.Round(DateDiff(DateInterval.Day, FechaI, FechaT) / 30.4, 2).ToEntero 'saco los meses y lo redondeo + Dim MesesTrascurridos As Integer = Math.Round(DateDiff(DateInterval.Day, FechaI, FechaT) / 30.4, 2).ToEntero 'saco los meses y lo redondeo - If FechaT > FechaF Then - 'todavía está en el mes actual. - MesesTrascurridos = MesesTrascurridos - Else - MesesTrascurridos = MesesTrascurridos + 1 - End If + If FechaT > FechaF Then + 'todavía está en el mes actual. + MesesTrascurridos = MesesTrascurridos + Else + MesesTrascurridos = MesesTrascurridos + 1 + End If - TxtMesesUso.Text = MesesTrascurridos.ToString + TxtMesesUso.Text = MesesTrascurridos.ToString + + CalculaPorcentajeAjuste() + Catch ex As Exception + OnError("Ocurrió un error al calcular los meses de uso", ex) + End Try - CalculaPorcentajeAjuste() End Sub Protected Sub DdlPSAjuste_selectedindexchange(sender As Object, e As EventArgs) @@ -5950,15 +5970,23 @@ Partial Class PV Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSParametro).FiltroPrimero("") Dim CveMarca As Integer = -1 Dim CveClasificacion As Integer = -1 + Dim CveTamanio As Integer = -1 If drPS IsNot Nothing Then PrecioSugerido = drPS("Precio").ToString.ToDecimal CveMarca = drPS("CveMarca").ToString.ToEntero CveClasificacion = drPS("CveClasificacion").ToString.ToEntero + CveTamanio = drPS("CveTamaño").ToString.ToEntero End If TxtPUFactura.Text = PrecioSugerido.FormatoNumero(2) + If DTBCIUsados IsNot Nothing AndAlso CveTamanio > 0 Then + DdlBCIAjuste.Items.Clear() + DdlBCIAjuste.DataSource = DTBCIUsados.FiltraParametros($"CveTamaño={CveTamanio}") + DdlBCIAjuste.DataBind() + End If + DdlTipoUso.Items.Clear() DdlTipoUso.DataSource = GlobalDTAcumGarantiasMesesTipoUso(UsuarioActual.CveEmpresa, CveMarca) DdlTipoUso.Items.Insert(0, New ListItem("Seleccione", "-1")) @@ -5973,8 +6001,6 @@ Partial Class PV TxtPUFactura.Text = "" End If - - CalculaPorcentajeAjuste() End Sub @@ -5991,6 +6017,10 @@ Partial Class PV Alert("No se ha especificado producto a entregar") Exit Sub End If + If DdlPSAjuste.SelectedValue.ToEntero <= 0 Then + Alert("No se ha especificado producto de ajuste a entregar") + Exit Sub + End If Try TxtImporteAjuste.Text = "0.00" If DdlTipoUso.SelectedValue.ToEntero > 0 AndAlso DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso TxtMesesUso.Text <> "" AndAlso DdlPS.SelectedValue.ToEntero > 0 Then @@ -6207,7 +6237,7 @@ Partial Class PV DivDatosVenta.Attributes.Add("class", "col-md-12") End If UpModalVenta.Update() - RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddVenta")) + RegistraScript("$('#DivAddVenta').modal({backdrop: 'static', keyboard: false});") RegistraScript("Recalcula();", "Recalcula") End Sub From 55088c7c2507e8cb019822d772371fdadaa28077 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Fri, 21 Feb 2020 17:49:15 -0700 Subject: [PATCH 09/15] DEVOLUCION DE MERCANCIA AL PROVEEDOR CON NC --- Compras/Compras.aspx.vb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index c848d70b9..835abc0c4 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -4396,7 +4396,7 @@ Partial Class Compras_Compras 'End If 'METODO DE PREPOLIZA DE ALMACEN - If UsuarioActual.CveEmpresa.Contiene(1, 119, 72, 80) And UsuarioActual.Empresa.UsaInventarios And Not UsuarioActual.Empresa.Funcionalidad(126) = "1" Then + If UsuarioActual.CveEmpresa.Contiene(1, 119, 72, 80, 140) And UsuarioActual.Empresa.UsaInventarios And Not UsuarioActual.Empresa.Funcionalidad(126) = "1" Then Dim ImporteAlmacen = TmpDT.SUM(If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0, "ImporteSinImpuestos", "Total"), $"ISNULL(TipoAF,0) <> 2 AND ISNULL(CveAlmacen,0) = 0 AND ISNULL(AplicaCostoIndirecto,0) <> 1 AND CveTipoPS = 2").ToString.ToDecimal If ImporteAlmacen > 0 Then If Not DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV", "Ant") Then @@ -4412,8 +4412,6 @@ Partial Class Compras_Compras CveConceptoContableAlmacen = 205 End If Else - - CveConceptoContableAlmacen = 225 End If @@ -6237,7 +6235,7 @@ Partial Class Compras_Compras End If Case 6 'Compra - Dim AgregaMercanciaInventario As Boolean = UsuarioActual.CveEmpresa.Contiene(1, 72, 80, 119) AndAlso UsuarioActual.Empresa.UsaInventarios AndAlso Not UsuarioActual.Empresa.Funcionalidad(126) = "1" + Dim AgregaMercanciaInventario As Boolean = UsuarioActual.CveEmpresa.Contiene(1, 72, 80, 119, 140) AndAlso UsuarioActual.Empresa.UsaInventarios AndAlso Not UsuarioActual.Empresa.Funcionalidad(126) = "1" Dim RegistraConcepto225 As Boolean = UsuarioActual.Empresa.UsaInventarios AndAlso DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV") AndAlso Not UsuarioActual.Empresa.Funcionalidad(126) = "1" If RBLPago.SelectedValue.ToEntero = 4 Then From e2af0a218ebfd5bd6b61ca5f037ead3bd6289abf Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Fri, 21 Feb 2020 18:38:11 -0700 Subject: [PATCH 10/15] filtrar almacenes de usados --- Acumuladores/EntradasUsadosResumenRep.aspx.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Acumuladores/EntradasUsadosResumenRep.aspx.vb b/Acumuladores/EntradasUsadosResumenRep.aspx.vb index 799484355..ced8542ab 100644 --- a/Acumuladores/EntradasUsadosResumenRep.aspx.vb +++ b/Acumuladores/EntradasUsadosResumenRep.aspx.vb @@ -26,7 +26,7 @@ Partial Class Acumuladores_RepEntradasUsados End Sub Protected Sub CargarDatos() - DdlAlmacenes.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1) + DdlAlmacenes.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros("CveTipoAlmacen = 22") DdlAlmacenes.DataBind() End Sub From 3ef3455353c359e244e653483d40fda0e399fa9c Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Fri, 21 Feb 2020 19:17:14 -0700 Subject: [PATCH 11/15] Validaciones en el punto de venta --- Ventas/PV.aspx | 41 ++++++++++++----------------------------- Ventas/PV.aspx.vb | 34 ++++++++++++++++++++++------------ 2 files changed, 34 insertions(+), 41 deletions(-) diff --git a/Ventas/PV.aspx b/Ventas/PV.aspx index 84ed1799d..71004d7e2 100644 --- a/Ventas/PV.aspx +++ b/Ventas/PV.aspx @@ -2576,7 +2576,7 @@ -