Correcion de cancelacion en NC,mostar productos en ajuste PV

This commit is contained in:
2019-12-11 17:38:56 -07:00
parent 0969cfecc1
commit a7cd01859d
4 changed files with 167 additions and 48 deletions

View File

@@ -2344,13 +2344,14 @@ Public Class ClsVentas
#Region " ANTICIPOS/NOTASCREDITO - VENTAS "
Public Function GetVentasAntNC(CveVenta As Integer, CveVentaNC As Integer) As Boolean
Public Function GetVentasAntNC(CveVenta As Integer, CveVentaNC As Integer, Optional AplicaAmortizacion As Boolean = False) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_VentasAntNCGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
.Add("@CveVentaNC", SqlDbType.Int).Value = CveVentaNC
.Add("@AplicaAmortizacion", SqlDbType.Bit).Value = AplicaAmortizacion
End With
Try

View File

@@ -491,6 +491,10 @@ Namespace Modelos
If ObjVentas.GetVentasAntNC(-1, CveVenta) Then
Me.DtNCVinculadas = ObjVentas.DtResultados.Copy()
End If
If ObjVentas.GetVentasAntNC(-1, CveVenta, AplicaAmortizacion:=EsNCAmortizacion) Then
Me.DtAnticipos = ObjVentas.DtResultados.Copy()
End If
End If
End If
@@ -501,12 +505,6 @@ Namespace Modelos
ObjVentas.Dispose()
'Dim ObjMovtos As New ClsMovimientos()
'If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, CveMoneda) Then
' Me.DtAnticipos = ObjMovtos.DtResultados.FiltraParametros($"Saldo > 0 AND SaldoSubtotal > 0 {If(CveVenta < 0, "AND Tipo = 'Ant'", "")} {If(TipoDocto = "Ant", "AND Tipo = 'NC'", "")}")
'End If
'ObjMovtos.Dispose()
If Me.RealizarDevolucionAlmacen Then
Me.CveAlmacenDevolucion = Me.CveAlmacenDevolucionVenta
End If
@@ -2335,12 +2333,12 @@ Namespace Modelos
Exit Select
End If
If ObjFactura.TipoDocto = "Ing" AndAlso ValorMultiplicador = -1 Then
For Each row2 As DataRow In ObjFactura.DtAntNCVinculadas.Rows
If ObjFactura.TipoDocto.Contiene("Ing", "Egs") AndAlso ValorMultiplicador = -1 Then
For Each row2 As DataRow In ObjFactura.DtAnticipos.Rows
If row2("CveConceptoContable").ToString().ToEntero = 11 Then
importeMovimiento = row2("Importe").ToString().ToDecimal * ValorMultiplicador '- ((row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal / row2.DataKey("TotalAnticipo").ToDecimal) * row2.DataKey("IVAAnticipo").ToDecimal)
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
CveIEAnticipo = -1
IdCtaContable = ObjFactura.Cliente.IdCtaContAnticipos
CveCuenta = ObjFactura.Cliente.CveCuentaAnticipos
CveSubProyectoContabilizar = CveSubProyectoVenta
@@ -2358,38 +2356,40 @@ Namespace Modelos
Next
End If
'cuando es anticipo
' cuando es amortización de nota de crédito, y es la nc
' cuando es amortización por descuento, y es el ingreso
' cuando es amortización en cero
If ObjFactura.CveTipoAmortizacionAnticipo = 2 AndAlso ObjFactura.TipoDocto.Contiene("Egs") OrElse
ObjFactura.CveTipoAmortizacionAnticipo = 1 AndAlso ObjFactura.TipoDocto.Contiene("Ing") OrElse
ObjFactura.CveTipoAmortizacionAnticipo = 3 Then
For Each row2 As DataRow In ObjFactura.DtAnticipos.Rows
If row2("CveConceptoContable").ToString().ToEntero = 3 Then
CveIEAnticipo = row2("CveIE").ToString.ToEntero
importeMovimiento = row2("Importe").ToString().ToDecimal() '- ((row2.FCTextBox("TxtAnticipo" & row2.RowIndex).Text.ToDecimal / row2.DataKey("TotalAnticipo").ToDecimal) * row2.DataKey("IVAAnticipo").ToDecimal)
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
IdCtaContable = ObjFactura.Cliente.IdCtaContAnticipos
CveCuenta = ObjFactura.Cliente.CveCuentaAnticipos
CveSubProyectoContabilizar = CveSubProyectoVenta
If importeMovimiento <> 0 Then
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=row2("CveVenta").ToString.ToEntero,
CveVentaAmortizacion:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo,
ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta,
CveSubProyecto:=CveSubProyectoContabilizar) Then
ErrorPrepoliza = True
Exit For
Else
ObjFactura.SeGuardoPrePoliza = True
End If
End If
End If
Next
If ValorMultiplicador = 1 Then
'cuando es anticipo
' cuando es amortización de nota de crédito, y es la nc
' cuando es amortización por descuento, y es el ingreso
' cuando es amortización en cero
If ObjFactura.CveTipoAmortizacionAnticipo = 2 AndAlso ObjFactura.TipoDocto.Contiene("Egs") OrElse
ObjFactura.CveTipoAmortizacionAnticipo = 1 AndAlso ObjFactura.TipoDocto.Contiene("Ing") OrElse
ObjFactura.CveTipoAmortizacionAnticipo = 3 Then
For Each row2 As DataRow In ObjFactura.DtAnticipos.Rows
If row2("CveConceptoContable").ToString().ToEntero = 11 Then
CveIEAnticipo = -1
importeMovimiento = row2("Importe").ToString().ToDecimal()
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${importeMovimiento.FormatoNumero(2)}"
IdCtaContable = ObjFactura.Cliente.IdCtaContAnticipos
CveCuenta = ObjFactura.Cliente.CveCuentaAnticipos
CveSubProyectoContabilizar = CveSubProyectoVenta
If importeMovimiento <> 0 Then
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContable, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta,
CveVentaAmortizacion:=row2("CveVenta").ToString.ToEntero, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIEAnticipo,
ImporteMX:=importeMovimiento * tipoCambio, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveCuenta:=CveCuenta,
CveSubProyecto:=CveSubProyectoContabilizar) Then
ErrorPrepoliza = True
Exit For
Else
ObjFactura.SeGuardoPrePoliza = True
End If
End If
End If
Next
End If
End If
'Cuando la funcionalidad de amortizacion en PS esta activa
If Not ErrorPrepoliza Then
DT = TmpDTDetalle.FiltraParametros($"CvePS = {ObjFactura.CvePSAmortizacion}")
@@ -2667,7 +2667,7 @@ Namespace Modelos
importeMovimiento = 0
Case 150 'Descuento sobre ventas
If ObjFactura.TipoDocto.Contiene("Egs", "Dev") Then
If ObjFactura.TipoDocto.Contiene("Egs", "Dev") AndAlso Not EsNCAmortizacion Then
Dim ConceptoContableAplicar = 150
Dim CveVentaAplicar = ObjFactura.CveVenta
@@ -3859,7 +3859,7 @@ Namespace Modelos
End If
If ObjFactura.TipoDocto = "Ant" AndAlso ObjFactura.SaldoAmortizado > 0 Then
Retorno.Mensaje = "La factura no se puede cancelar debido a que esta amortizada."
Retorno.Mensaje = "La factura no se puede cancelar debido a que tiene pagos vinculados."
Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia
Return Retorno
@@ -5554,6 +5554,7 @@ Namespace Modelos
Public Property CveVentaRelacion As Integer = -1
Public Property ImporteRelacion As Decimal
Public Property EsNCAmortizacion As Boolean
#End Region
@@ -9746,6 +9747,119 @@ Namespace Modelos
Public Property RequierePersonal As Boolean
Public Property EsAcumulador As Boolean
End Class
#End Region
#Region "P O L I Z A - V I R T U A L"
Public Class MPolizaVentaLTHWSD
Public Property customer_name As String
Public Property customer_last_name1 As String
Public Property customer_last_name2 As String
Public Property customer_birthday As DateTime
Public Property customer_phone As String
Public Property customer_email As String
Public Property customer_gender As String
Public Property customer_advertising As Boolean
Public Property sale_date As DateTime
Public Property sale_paidby As String
Public Property sale_type As String
Public Property sale_type_service As String
Public Property product_code As String
Public Property product_unique_code As String
Public Property product_sale_type As String
Public Property used_product As Boolean
Public Property used_brand As String
Public Property used_bci As String
Public Property used_month As Integer
Public Property used_year As Integer
Public Property used_sale_date As DateTime
Public Property customer_car_brand As String
Public Property customer_car_model As String
Public Property customer_car_year As Integer
Public Property sale_discount As Decimal
Public Property sale_id As String
End Class
Public Class MPolizaVentaWS
Public Property customer_name As String
Public Property customer_last_name1 As String
Public Property customer_last_name2 As String
Public Property customer_birthday As DateTime
Public Property customer_phone As String
Public Property customer_email As String
Public Property customer_gender As String
Public Property customer_advertising As Boolean
Public Property sale_date As DateTime
Public Property sale_paidby As String
Public Property sale_type As String
Public Property sale_type_service As String
Public Property sale_total As Decimal
Public Property product_code As String
Public Property product_unique_code As String
Public Property product_sale_type As String
Public Property used_product As Boolean
Public Property used_brand As String
Public Property used_bci As String
Public Property used_month As Integer
Public Property used_year As Integer
Public Property used_sale_date As DateTime
Public Property customer_car_brand As String
Public Property customer_car_model As String
Public Property customer_car_year As Integer
Public Property sale_discount As Decimal
Public Property sale_id As String
End Class
Public Class MIndicador
Sub New(Optional UsaValoresPrueba As Boolean = False)
If UsaValoresPrueba Then
Dim Index As Integer = 0
For Each p As Reflection.PropertyInfo In Me.GetType().GetProperties()
Index = Index + 1
p.SetValue(Me, Convert.ChangeType(Index, p.PropertyType), Nothing)
Next
End If
End Sub
Public Property v_b_optima As Integer
Public Property v_b_fullpower As Integer
Public Property v_b_hitec As Integer
Public Property v_b_agm As Integer
Public Property v_b_suv As Integer
Public Property v_b_taxi As Integer
Public Property v_b_america As Integer
Public Property v_b_lth As Integer
Public Property v_b_cronos As Integer
Public Property v_b_diener As Integer
Public Property v_b_heavyduty As Integer
Public Property v_m_lth As Integer
Public Property v_o_filtros As Integer
Public Property v_o_lub1 As Integer
Public Property v_o_lubgalon As Integer
Public Property v_o_lub5 As Integer
Public Property v_o_aa As Integer
Public Property v_o_aaa As Integer
Public Property g_b_optima As Integer
Public Property g_b_fullpower As Integer
Public Property g_b_hitec As Integer
Public Property g_b_agm As Integer
Public Property g_b_suv As Integer
Public Property g_b_taxi As Integer
Public Property g_b_america As Integer
Public Property g_b_lth As Integer
Public Property g_b_cronos As Integer
Public Property g_b_diener As Integer
Public Property g_b_heavyduty As Integer
Public Property g_m_lth As Integer
Public Property a_b_optima As Integer
Public Property a_b_fullpower As Integer
Public Property a_b_hitec As Integer
Public Property a_b_agm As Integer
Public Property a_b_suv As Integer
Public Property a_b_taxi As Integer
Public Property a_b_america As Integer
Public Property a_b_lth As Integer
Public Property a_b_cronos As Integer
Public Property a_b_diener As Integer
Public Property a_b_heavyduty As Integer
End Class
#End Region
End Namespace

View File

@@ -336,7 +336,7 @@
<div id="DivVirtualAdvertencia" visible="false" clientidmode="Static" runat="server" class="alert alert-warning" style="padding: 5px; margin-bottom: 5px; padding-right: 25px;">
<button type="button" class="close" data-dismiss="alert" style="margin-top: 5px;" aria-hidden="true"></button>
<strong style="font-size: 20px; margin-right: 25px;">Información: </strong>
<asp:Literal Text="" runat="server" ID="Literal1"></asp:Literal>
<asp:Literal Text="La mercancía sera trasladada al almacén virtual" runat="server"></asp:Literal>
</div>
</div>
</div>

View File

@@ -1071,7 +1071,7 @@ Partial Class PV
CargaSucursales()
CargaClasificaciones()
CargaPS(-1, DdlPS)
CargaPS(-1, DdlPSAjuste)
CargaPS(-1, DdlPSAjuste, AplicaAlmacen:=False)
CargaEmpresa()
CreaDTVentas()
CargaMetodosPago()
@@ -1866,7 +1866,7 @@ Partial Class PV
End If
DdlClasificacion.DataBind()
End Sub
Private Sub CargaPS(CveClasificacion As Integer, Objeto As ADServerControl.Dropdownlost)
Private Sub CargaPS(CveClasificacion As Integer, Objeto As ADServerControl.Dropdownlost, Optional AplicaAlmacen As Boolean = True)
Objeto.setEsWebService(UsuarioActual.Empresa.Funcionalidad(141).ToString = "1")
If Not UsuarioActual.Empresa.Funcionalidad(141).ToString = "1" Then
Objeto.ddl.Items.Clear()
@@ -1877,7 +1877,11 @@ Partial Class PV
Else
Objeto.Attributes.Add("data-cvesubproyecto", DdlSubProyectoDatos.SelectedValue)
Objeto.ddlWS.Attributes.Add("data-cveclasificacion", CveClasificacion.ToString)
Objeto.ddlWS.Attributes.Add("data-pagina", "ventas/ventas")
If AplicaAlmacen Then
Objeto.ddlWS.Attributes.Add("data-pagina", "ventas/ventas")
Else
Objeto.ddlWS.Attributes.Add("data-pagina", "-1")
End If
Objeto.ddlWS.Attributes.Add("data-Estatus", "1")
End If
End Sub