From a282ce8aef16bb0844ed70d909510c26c021da5b Mon Sep 17 00:00:00 2001 From: rrene Date: Sat, 26 Oct 2019 14:00:20 -0700 Subject: [PATCH] =?UTF-8?q?cambios=20ventas,=20tipo=20de=20relaci=C3=B3n?= =?UTF-8?q?=20en=20DEV?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bancos/ProveedoresAbonar.aspx.vb | 2 +- Inventarios/PrestamosdeProveedor.aspx.vb | 10 +- Ventas/Ventas.aspx.vb | 145 +++++++++++++++++++++-- 3 files changed, 140 insertions(+), 17 deletions(-) diff --git a/Bancos/ProveedoresAbonar.aspx.vb b/Bancos/ProveedoresAbonar.aspx.vb index a9a546aa5..37b1b3a67 100644 --- a/Bancos/ProveedoresAbonar.aspx.vb +++ b/Bancos/ProveedoresAbonar.aspx.vb @@ -637,7 +637,7 @@ Partial Class Bancos_ProveedoresAbonar e.Row.FCTextBox("TxtAbonar").Enabled = False ' si tiene un porcentaje mayor ingresado, que este halla sido por OC, debe de permitirlo - If e.Row.DBCampo("ImporteAlmacenPorcentaje").ToDecimal >= 100 Then 'si ya se recibió el 100% + If e.Row.DBCampo("ImporteAlmacenPorcentaje").ToDecimal >= 99.0 Then 'si ya se recibió el 100% e.Row.FCCheckBox("Chk").Enabled = True e.Row.FCTextBox("TxtAbonar").Enabled = True End If diff --git a/Inventarios/PrestamosdeProveedor.aspx.vb b/Inventarios/PrestamosdeProveedor.aspx.vb index b55283484..40839cf55 100644 --- a/Inventarios/PrestamosdeProveedor.aspx.vb +++ b/Inventarios/PrestamosdeProveedor.aspx.vb @@ -6,12 +6,8 @@ Partial Class Inventarios_PrestamosdeProveedor Private Sub Inventarios_PrestamosdeProveedor_Load(sender As Object, e As EventArgs) Handles Me.Load If Not Page.IsPostBack Then CargaCombos() - Dim a As New ClsValidaCFDi("EBFD0EF4-F7D2-4243-9A79-9C484D6C1323", "FRU880930R72", "AJA850608L7A", 39) - Alert(a.EsValida) - Dim lista As New List(Of String) - lista.Add("93") - lista.Add("100") - Notificaciones.AlertaVentana("hola", lista) + + CargaDatos() End If End Sub @@ -173,7 +169,7 @@ Partial Class Inventarios_PrestamosdeProveedor Dim CveConceptoContable As Integer = 69 Dim CveClasifCosto As Integer = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveClasificacion", String.Format("CvePS ={0} ", CvePS)) - idCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGasto", $"CveClasificacion = {CveClasifCosto}").ToEntero + IdCtaContableOtro = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGasto", $"CveClasificacion = {CveClasifCosto}").ToEntero If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoAlmacen, tValorInventario, TxtObservacionesEntrega.Text.Trim, 68, TxtObservacionesEntrega.Text.Trim, Fecha, idCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoSalida, ImporteMX:=tValorInventario) Then diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index f552f9ac6..e595dd1dc 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -5632,6 +5632,125 @@ Partial Class Ventas End If End If + + 'si es remisión, ingreso, anticipo debe de considerar el preciominimo + + If Not UsuarioActual.TienePermisoProceso(169) Then ' NO VALIDA EXISTENCIAS NI COSTO - PERMISO PARA NO VALIDAR + Dim CvePS As Integer = DatarowPS("CvePS").ToString.ToEntero + 'SOLO VALIDA EXISTENCIAS Y COSTO: SI USA INVENTARIOS, SOLO PRODUCTOS TIPO PRODUCTO, SOLO REMISIONES E INGRESOS + If UsuarioActual.Empresa.UsaInventarios AndAlso (DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "PA") Or (DdlTipoComprobante.SelectedValue.Contiene("Cot") And UsuarioActual.CveEmpresa.Contiene(119))) Then + Dim ObjInventarios As New ClsInventarios + Dim Existencia As Decimal = ObjInventarios.GetExistenciasPS(CvePS, -1, UsuarioActual.CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=-1) + Dim Costo As Decimal = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero) + + 'si el costo es cero, puede ser que no halla movimientos del producto, en esa sucursal. y se volverá a sacar sin especificar sucursal + If Costo = 0 Then Costo = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, -1) + + ObjInventarios.Dispose() + Dim PrecioMinimo As Decimal = 0 + 'RMF. condicion temporal, para reubicación, precio mínimo + If UsuarioActual.CveEmpresa = 119 Then + 'Dim CvePrecioLista As Integer = 38 + Dim objPS As New ClsProductosServicios + If objPS.GetPSSucursalesALL(CvePS, UsuarioActual.CveEmpresa, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero) Then + PrecioMinimo = objPS.DtResultados.FiltroPrimeroValor("PrecioMinimo", "").ToDecimal + If PrecioMinimo > 0 Then + Costo = PrecioMinimo + End If + End If + objPS.Dispose() + + End If + + If DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False Then + 'VALIDA EXISTENCIA + If UsuarioActual.CveEmpresa.Contiene({72, 80, 119}) Then + If Existencia - TmpDT.SUM("Cantidad", $"CvePS = {CvePS}") < TxtCantidad.Text.ToDouble Then + Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.FormatoNumero(2) + ".", TipoMensaje.MsgAdvertencia) + + End If + End If + End If + + 'VALIDA COSTOS + If Not CveContrato > 0 Then + + 'BANDERAS PARA VALIDACIONES + Dim EsValido = False + Dim EsValidoMayor = False + Dim CostoMenor = 0.0D + Dim CostoMayor = 0.0D + + 'PRECIO MINIMO + If UsuarioActual.Empresa.Funcionalidad(129).ToEntero > 0 AndAlso UsuarioActual.CveUsuario <> 1560 Then + CostoMenor = Costo + ((UsuarioActual.Empresa.Funcionalidad(129).ToDecimal / 100) * Costo) + If PrecioMinimo > 0 Then CostoMenor = PrecioMinimo + + 'SI EL PRECIO ES MAYOR AL COSTO, SI PASA + If PU * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal) >= CostoMenor Then + EsValido = True + End If + Else + EsValido = True + End If + + 'PRECIO MAXIMO + If UsuarioActual.Empresa.Funcionalidad(133).ToEntero > 0 AndAlso UsuarioActual.CveUsuario <> 1560 Then + CostoMayor = Costo + ((UsuarioActual.Empresa.Funcionalidad(133).ToDecimal / 100) * Costo) + 'SI EL PRECIO ES MAYOR AL COSTO MAXIMO, SI PASA + If PU * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal) <= CostoMayor Then + EsValidoMayor = True + End If + Else + EsValidoMayor = True + End If + + ''VALIDA PROMOCION: SI TIENE PROMOCION Y EL PRECIO ES MENOR AL PRECIO DE PROMOCION, NO PASA | SI YA CUMPLE NO VUELVE A VALIDAR + ''SIRVE PARA VALIDAR PRECIOS DEBAJO DEL PRECIO MINIMO PERMITIDO + 'If Not EsValido Then + ' If DtPromociones.FiltraParametros($"CvePS = {CvePS}").Rows.Count > 0 Then + ' If PU * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal) >= DtPromociones.FiltroPrimeroValor("PUPromocion", $"CvePS = {CvePS}").ToDecimal Then + ' EsValido = True + ' End If + ' End If + 'End If + + 'NO DEJA REGISTRAR MENOS AL PRECIO MINIMO + Dim MensajeCosto As New StringBuilder + Dim TienePermisoImportes As Boolean = UsuarioActual.TienePermisoProceso(201) + If Not EsValido Then + MensajeCosto.AppendFormat("El Producto {0}. No se puede vender a un precio menor de su Costo
", DatarowPS("PS").ToString) + If TienePermisoImportes Then + MensajeCosto.AppendFormat("El costo del producto es: ${0}
", Costo) + MensajeCosto.AppendFormat("El rango menor aceptado es: {0}% ${1}
", UsuarioActual.Empresa.Funcionalidad(129).ToEntero, CostoMenor) + MensajeCosto.AppendFormat("El precio indicado es: ${0} ({1}% de ganancia)
", PU.FormatoNumero, (If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)).FormatoNumero) + End If + + + Alert(String.Format(MensajeCosto.ToString), TipoMensaje.MsgAdvertencia) + e.Cancel = True + Exit Sub + End If + + 'NO DEJA REGISTRAR MAS AL PRECIO MAXIMO + If Not EsValidoMayor Then + MensajeCosto.AppendFormat("El Producto {0}. No se puede vender a un precio mayor de su rango aceptado
", HdnPS.Value) + If TienePermisoImportes Then + MensajeCosto.AppendFormat("El costo del producto es: ${0}
", Costo) + MensajeCosto.AppendFormat("El rango mayor aceptado es: {0}% ${1}
", UsuarioActual.Empresa.Funcionalidad(133).ToEntero, CostoMayor) + MensajeCosto.AppendFormat("El precio indicado es: ${0} ({1}% de ganancia)
", PU.FormatoNumero, (If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)).FormatoNumero) + End If + Alert(MensajeCosto.ToString, TipoMensaje.MsgAdvertencia) + e.Cancel = True + Exit Sub + End If + + End If + End If + End If + + + If TmpDT.Rows(e.RowIndex)("CvePS").ToString <> GvPS.Rows(e.RowIndex).FCDropDownLost("DdlPS").SelectedValue Then 'eliminar y cargar el ps *** Dim DdlUM As DropDownList = GvPS.Rows(e.RowIndex).FCDropDownList("DdlUnidadMedida") @@ -7311,6 +7430,8 @@ Partial Class Ventas If DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then DtVentasNC.Rows(0)("Importe") = Total + DtVentasNC.Rows(0)("TC") = factura.TipoCambio + DtVentasNC.Rows(0)("TCCambioValuacion") = factura.TipoCambio End If ObjFacturaDevolucion.Timbre = PreParaTimbre(ObjFacturaDevolucion) @@ -7859,16 +7980,19 @@ Partial Class Ventas ObjFactura.AplicaDevolucion = Me.AplicaDevolucion ObjFactura.CveTipoAmortizacionAnticipo = DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero + ObjFactura.Timbre.Comprobante.TipoComprobante = If(ObjFactura.TipoDocto.Contiene("Ing", "Ant"), "I", If(ObjFactura.TipoDocto.Contiene("Egs", "Dev"), "E", "")) If ObjFactura.Timbre.Comprobante.TipoComprobante = "E" Then - If ObjFactura.TipoDocumento.Contiene("Nota de Crédito") Then + If ObjFactura.TipoDocto = "Egs" Then ObjFactura.Timbre.CFDIRelacionados.TipoRelacion = "01" ObjFactura.Timbre.CFDIRelacionados.TipoRelacionTexto = "Nota de Crédito aplicada a Ingreso" + End If - If ObjFactura.TipoDocumento.Contiene("Nota de Devolución") Then + If ObjFactura.TipoDocto = "Dev" Then ObjFactura.Timbre.CFDIRelacionados.TipoRelacion = "03" ObjFactura.Timbre.CFDIRelacionados.TipoRelacionTexto = "Devolución aplicada a Ingreso" End If + ObjFactura.CveTipoRelacion = DdlTiposRelacion.SelectedValue.ToEntero ObjFactura.Timbre.CFDIRelacionados.UUID.Add(HdnFolioFiscalNC.Value) End If ' cuando es refacturacoin es cfdirelacionado, con relacion 04 @@ -7879,12 +8003,6 @@ Partial Class Ventas End If - If ObjFactura.TipoDocto = "Egs" Then - ObjFactura.CveTipoRelacion = DdlTiposRelacion.SelectedValue.ToEntero - End If - If ObjFactura.TipoDocto = "Dev" Then - ObjFactura.CveTipoRelacion = DdlTiposRelacion.SelectedValue.ToEntero - End If If ObjFactura.TipoDocto.Contiene("Ing", "Ant") AndAlso NuevaFactura = 1 Then ' refacturación ObjFactura.CveTipoRelacion = DdlTiposRelacion.SelectedValue.ToEntero End If @@ -8288,7 +8406,7 @@ Partial Class Ventas Else 'SI LA FACTURA VIENE DE SER CANCELADA SISTEMA CUANDO SE REFACTURO NO HAY QUE RELACIONAR - If (CveEstatusFacturaPadre > 0 AndAlso CveEstatusFacturaPadre <> 4) OrElse (DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0) Then + If (CveEstatusFacturaPadre > 0 AndAlso CveEstatusFacturaPadre <> 4) OrElse (DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0) OrElse HdnFolioFiscalNC.Value.ToString <> "" Then If Obj.CveTipoRelacion > 0 Then Select Case Obj.CveTipoRelacion @@ -9901,6 +10019,13 @@ Partial Class Ventas CveVentaAmortizacionAplicar = ObjFactura.CveVenta End If + ''Cuando se está amortizando con un anticipo y es la modalidad de NC + 'If ObjFactura.TipoDocto.Contiene("Ing") AndAlso CveAnticipo > 0 AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then + ' ConceptoContableAplicar = 11 + ' CveVentaAplicar = CveAnticipo + ' CveVentaAmortizacionAplicar = ObjFactura.CveVenta + 'End If + ' If UsuarioActual.CveEmpresa = 119 Then 'código fijo en base el porcentaje iva, que se afecten las clasificaciones @@ -20872,6 +20997,8 @@ Partial Class Ventas Gv.DataKey("SATClaveProdServ").ToString, Gv.DataKey("SATClaveUM").ToString, -1, Gv.DataKey("CveVentaDetalle").ToString.ToEntero, -1, -1, -1, -1) End If Next + TrTipoRelacion.Visible = True + DdlTiposRelacion.SelectedValueExist("3") LimpiaDocumentoDEV()