diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index fad317df6..55cd012c9 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -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 diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index a9b95dc41..8397a6619 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -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 \ No newline at end of file diff --git a/Inventarios/RecepcionEntrega.aspx b/Inventarios/RecepcionEntrega.aspx index 43992542a..e6bf45a69 100644 --- a/Inventarios/RecepcionEntrega.aspx +++ b/Inventarios/RecepcionEntrega.aspx @@ -336,7 +336,7 @@
Información: - +
diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb index 950ef277f..f2ed1bd58 100644 --- a/Ventas/PV.aspx.vb +++ b/Ventas/PV.aspx.vb @@ -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