cambios ventas, tipo de relación en DEV

This commit is contained in:
rrene
2019-10-26 14:00:20 -07:00
parent 302e3a4766
commit a282ce8aef
3 changed files with 140 additions and 17 deletions

View File

@@ -637,7 +637,7 @@ Partial Class Bancos_ProveedoresAbonar
e.Row.FCTextBox("TxtAbonar").Enabled = False e.Row.FCTextBox("TxtAbonar").Enabled = False
' si tiene un porcentaje mayor ingresado, que este halla sido por OC, debe de permitirlo ' 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.FCCheckBox("Chk").Enabled = True
e.Row.FCTextBox("TxtAbonar").Enabled = True e.Row.FCTextBox("TxtAbonar").Enabled = True
End If End If

View File

@@ -6,12 +6,8 @@ Partial Class Inventarios_PrestamosdeProveedor
Private Sub Inventarios_PrestamosdeProveedor_Load(sender As Object, e As EventArgs) Handles Me.Load Private Sub Inventarios_PrestamosdeProveedor_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then If Not Page.IsPostBack Then
CargaCombos() 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() CargaDatos()
End If End If
End Sub End Sub
@@ -173,7 +169,7 @@ Partial Class Inventarios_PrestamosdeProveedor
Dim CveConceptoContable As Integer = 69 Dim CveConceptoContable As Integer = 69
Dim CveClasifCosto As Integer = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveClasificacion", String.Format("CvePS ={0} ", CvePS)) 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 If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoAlmacen, tValorInventario, TxtObservacionesEntrega.Text.Trim, 68, TxtObservacionesEntrega.Text.Trim, Fecha, idCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoSalida, ImporteMX:=tValorInventario) Then

View File

@@ -5632,6 +5632,125 @@ Partial Class Ventas
End If End If
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 <b>{0}</b>. No se puede vender a un precio menor de su Costo <br/>", DatarowPS("PS").ToString)
If TienePermisoImportes Then
MensajeCosto.AppendFormat("El costo del producto es: <b>${0}</b> <br/>", Costo)
MensajeCosto.AppendFormat("El rango menor aceptado es: {0}% <b>${1}</b> <br/>", UsuarioActual.Empresa.Funcionalidad(129).ToEntero, CostoMenor)
MensajeCosto.AppendFormat("El precio indicado es: <b>${0}</b> ({1}% de ganancia) <br/>", 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 <b>{0}</b>. No se puede vender a un precio mayor de su rango aceptado<br/>", HdnPS.Value)
If TienePermisoImportes Then
MensajeCosto.AppendFormat("El costo del producto es: <b>${0}</b> <br/>", Costo)
MensajeCosto.AppendFormat("El rango mayor aceptado es: {0}% <b>${1}</b> <br/>", UsuarioActual.Empresa.Funcionalidad(133).ToEntero, CostoMayor)
MensajeCosto.AppendFormat("El precio indicado es: <b>${0}</b> ({1}% de ganancia) <br/>", 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 If TmpDT.Rows(e.RowIndex)("CvePS").ToString <> GvPS.Rows(e.RowIndex).FCDropDownLost("DdlPS").SelectedValue Then
'eliminar y cargar el ps *** 'eliminar y cargar el ps ***
Dim DdlUM As DropDownList = GvPS.Rows(e.RowIndex).FCDropDownList("DdlUnidadMedida") 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 If DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then
DtVentasNC.Rows(0)("Importe") = Total DtVentasNC.Rows(0)("Importe") = Total
DtVentasNC.Rows(0)("TC") = factura.TipoCambio
DtVentasNC.Rows(0)("TCCambioValuacion") = factura.TipoCambio
End If End If
ObjFacturaDevolucion.Timbre = PreParaTimbre(ObjFacturaDevolucion) ObjFacturaDevolucion.Timbre = PreParaTimbre(ObjFacturaDevolucion)
@@ -7859,16 +7980,19 @@ Partial Class Ventas
ObjFactura.AplicaDevolucion = Me.AplicaDevolucion ObjFactura.AplicaDevolucion = Me.AplicaDevolucion
ObjFactura.CveTipoAmortizacionAnticipo = DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero 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.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.TipoRelacion = "01"
ObjFactura.Timbre.CFDIRelacionados.TipoRelacionTexto = "Nota de Crédito aplicada a Ingreso" ObjFactura.Timbre.CFDIRelacionados.TipoRelacionTexto = "Nota de Crédito aplicada a Ingreso"
End If End If
If ObjFactura.TipoDocumento.Contiene("Nota de Devolución") Then If ObjFactura.TipoDocto = "Dev" Then
ObjFactura.Timbre.CFDIRelacionados.TipoRelacion = "03" ObjFactura.Timbre.CFDIRelacionados.TipoRelacion = "03"
ObjFactura.Timbre.CFDIRelacionados.TipoRelacionTexto = "Devolución aplicada a Ingreso" ObjFactura.Timbre.CFDIRelacionados.TipoRelacionTexto = "Devolución aplicada a Ingreso"
End If End If
ObjFactura.CveTipoRelacion = DdlTiposRelacion.SelectedValue.ToEntero
ObjFactura.Timbre.CFDIRelacionados.UUID.Add(HdnFolioFiscalNC.Value) ObjFactura.Timbre.CFDIRelacionados.UUID.Add(HdnFolioFiscalNC.Value)
End If End If
' cuando es refacturacoin es cfdirelacionado, con relacion 04 ' cuando es refacturacoin es cfdirelacionado, con relacion 04
@@ -7879,12 +8003,6 @@ Partial Class Ventas
End If 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 If ObjFactura.TipoDocto.Contiene("Ing", "Ant") AndAlso NuevaFactura = 1 Then ' refacturación
ObjFactura.CveTipoRelacion = DdlTiposRelacion.SelectedValue.ToEntero ObjFactura.CveTipoRelacion = DdlTiposRelacion.SelectedValue.ToEntero
End If End If
@@ -8288,7 +8406,7 @@ Partial Class Ventas
Else Else
'SI LA FACTURA VIENE DE SER CANCELADA SISTEMA CUANDO SE REFACTURO NO HAY QUE RELACIONAR '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 If Obj.CveTipoRelacion > 0 Then
Select Case Obj.CveTipoRelacion Select Case Obj.CveTipoRelacion
@@ -9901,6 +10019,13 @@ Partial Class Ventas
CveVentaAmortizacionAplicar = ObjFactura.CveVenta CveVentaAmortizacionAplicar = ObjFactura.CveVenta
End If 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 ' If UsuarioActual.CveEmpresa = 119 Then
'código fijo en base el porcentaje iva, que se afecten las clasificaciones '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) Gv.DataKey("SATClaveProdServ").ToString, Gv.DataKey("SATClaveUM").ToString, -1, Gv.DataKey("CveVentaDetalle").ToString.ToEntero, -1, -1, -1, -1)
End If End If
Next Next
TrTipoRelacion.Visible = True
DdlTiposRelacion.SelectedValueExist("3")
LimpiaDocumentoDEV() LimpiaDocumentoDEV()