-pv. bonif

This commit is contained in:
2020-02-22 14:54:33 -07:00
15 changed files with 410 additions and 444 deletions

View File

@@ -78,16 +78,16 @@
<ContentTemplate>
<asp:GridView ID="GvAcum" Width="100%" runat="server" GridLines="None" CssClass="table table-striped table-advance table-hover ScrollAD "
ShowHeader="True" EmptyDataText="No se encontraron resultados." ShowHeaderWhenEmpty="true" AutoGenerateColumns="False" AllowPaging="False"
ShowFooter="False" DataKeyNames="CvePSCargo,Codigo,Inicial,E_Almacen,E_Pub,E_Traspaso,E_Compra,E_Otros,S_Almacen,S_Traspaso,S_Otros,Exist_Actual">
ShowFooter="False" DataKeyNames="CvePSCargo,CodigoPS,Inicial,E_Almacen,E_Pub,E_Traspaso,E_Compra,E_Otros,S_Almacen,S_Traspaso,S_Otros,Exist_Actual">
<Columns>
<asp:BoundField DataField="Codigo" HeaderText="Grupo" ReadOnly="true" ></asp:BoundField>
<asp:BoundField DataField="CodigoPS" HeaderText="Grupo" ReadOnly="true" ></asp:BoundField>
<asp:BoundField DataField="Inicial" HeaderText="Inicial" ReadOnly="true" DataFormatString="{0:N0}"><ItemStyle HorizontalAlign="Center"></ItemStyle></asp:BoundField>
<asp:BoundField DataField="E_Almacen" HeaderText="E.Alm" ReadOnly="true" DataFormatString="{0:N0}"><ItemStyle HorizontalAlign="Center"></ItemStyle></asp:BoundField>
<asp:BoundField DataField="E_Pub" HeaderText="E.Alm" ReadOnly="true" DataFormatString="{0:N0}"><ItemStyle HorizontalAlign="Center"></ItemStyle></asp:BoundField>
<asp:BoundField DataField="E_Pub" HeaderText="E.Pub" ReadOnly="true" DataFormatString="{0:N0}"><ItemStyle HorizontalAlign="Center"></ItemStyle></asp:BoundField>
<asp:BoundField DataField="E_Traspaso" HeaderText="E.Tras" ReadOnly="true" DataFormatString="{0:N0}"><ItemStyle HorizontalAlign="Center"></ItemStyle></asp:BoundField>
<asp:BoundField DataField="E_Compra" HeaderText="E.Compra" ReadOnly="true" DataFormatString="{0:N0}"><ItemStyle HorizontalAlign="Center"></ItemStyle></asp:BoundField>
<asp:BoundField DataField="E_Otros" HeaderText="Otros" ReadOnly="true" DataFormatString="{0:N0}"><ItemStyle HorizontalAlign="Center"></ItemStyle></asp:BoundField>
<asp:BoundField DataField="S_Almacen" HeaderText="E.Alm" ReadOnly="true" DataFormatString="{0:N0}"><ItemStyle HorizontalAlign="Center"></ItemStyle></asp:BoundField>
<asp:BoundField DataField="S_Almacen" HeaderText="S.Alm" ReadOnly="true" DataFormatString="{0:N0}"><ItemStyle HorizontalAlign="Center"></ItemStyle></asp:BoundField>
<asp:BoundField DataField="S_Traspaso" HeaderText="S.Tras" ReadOnly="true" DataFormatString="{0:N0}"><ItemStyle HorizontalAlign="Center"></ItemStyle></asp:BoundField>
<asp:BoundField DataField="S_Otros" HeaderText="Otros" ReadOnly="true" DataFormatString="{0:N0}"><ItemStyle HorizontalAlign="Center"></ItemStyle></asp:BoundField>
<asp:BoundField DataField="Exist_Actual" HeaderText="Exist. Actual" ReadOnly="true" DataFormatString="{0:N0}"><ItemStyle HorizontalAlign="Center"></ItemStyle></asp:BoundField>

View File

@@ -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

View File

@@ -82,7 +82,6 @@
<Columns>
<asp:BoundField HeaderText="Tipo" DataField="Codigo" />
<asp:BoundField HeaderText="Clientes/Grupos" DataField="Codigo_Clientes" />
<asp:BoundField HeaderText="Cantidad" DataField="Total" DataFormatString="{0:N0}" />
<asp:TemplateField HeaderText="Cantidad">
<ItemTemplate>
<%--OnClick="CargarVentasGrupo"--%>

View File

@@ -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()

View File

@@ -4602,7 +4602,10 @@ Public Class ClsContabilidad
Return Retorno
End Function
Public Function UpdateCuenta(CveCuenta As Integer, Nombre As String, Tipo As String, CtaMayor As Integer, CveMoneda As Integer, Optional DigAgrupador As Integer = -1, Optional CveAgrupadorSAT As Integer = -1, Optional NomIdioma As String = "") As Boolean
Public Function UpdateCuenta(CveCuenta As Integer, Nombre As String, Tipo As String, CtaMayor As Integer, CveMoneda As Integer, Optional DigAgrupador As Integer = -1,
Optional CveAgrupadorSAT As Integer = -1, Optional NomIdioma As String = "", Optional CveConceptoAdmin As Integer = -1, Optional CveProveedor As Integer = -1,
Optional CveCliente As Integer = -1, Optional CveClasificacion As Integer = -1, Optional PorcentajeImpuesto As Decimal = -1,
Optional CveBancoCuenta As Integer = -1) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Conta_UpdateCuentas")
@@ -4616,6 +4619,12 @@ Public Class ClsContabilidad
.Add("@DigAgrupador", SqlDbType.Int).Value = DigAgrupador
.Add("@NomIdioma", SqlDbType.VarChar).Value = NomIdioma
.Add("@CveAgrupadorSAT", SqlDbType.Int).Value = CveAgrupadorSAT
.Add("@CveConceptoAdmin", SqlDbType.Int).Value = CveConceptoAdmin
.Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
.Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion
.Add("@PorcentajeImpuesto", SqlDbType.Money).Value = PorcentajeImpuesto
.Add("@CveBancoCuenta", SqlDbType.Int).Value = CveBancoCuenta
End With
Try
@@ -4630,7 +4639,9 @@ Public Class ClsContabilidad
Return Retorno
End Function
Public Function AddCuenta(CvePadre As Integer, Codigo As String, Nombre As String, Tipo As String, CtaMayor As Integer, CveMoneda As Integer, Optional DigAgrupador As Integer = -1,
Optional CveAgrupadorSAT As Integer = -1, Optional NomIdioma As String = "", Optional CveEmpresaParam As Integer = -1) As Integer
Optional CveAgrupadorSAT As Integer = -1, Optional NomIdioma As String = "", Optional CveEmpresaParam As Integer = -1, Optional CveConceptoAdmin As Integer = -1,
Optional CveProveedor As Integer = -1, Optional CveCliente As Integer = -1, Optional CveClasificacion As Integer = -1, Optional PorcentajeImpuesto As Decimal = -1,
Optional CveBancoCuenta As Integer = -1) As Integer
Dim Retorno As Integer = 0
DataAdapter("PA_Conta_AddCuentas")
@@ -4645,6 +4656,12 @@ Public Class ClsContabilidad
.Add("@NomIdioma", SqlDbType.VarChar).Value = NomIdioma
.Add("@CveAgrupadorSAT", SqlDbType.Int).Value = CveAgrupadorSAT
.Add("@CveEmpresaParam", SqlDbType.Int).Value = CveEmpresaParam
.Add("@CveConceptoAdmin", SqlDbType.Int).Value = CveConceptoAdmin
.Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
.Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion
.Add("@PorcentajeImpuesto", SqlDbType.Money).Value = PorcentajeImpuesto
.Add("@CveBancoCuenta", SqlDbType.Int).Value = CveBancoCuenta
'.Add("@CveCuenta", SqlDbType.Int).Value = 0
'.Add("@Error", SqlDbType.VarChar).Value = ""
'.Add("@Error", SqlDbType.VarChar).Direction = ParameterDirection.Output
@@ -4690,6 +4707,23 @@ Public Class ClsContabilidad
Return Retorno
End Function
Public Function GetCuentasyConceptos(CveCliente As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Conta_GetCuentasyConceptos")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al consultar las cuentas y conceptos", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return Retorno
End Function
Public Function UpdateCuentaCompaq(CveCuenta As Integer, IdCompaq As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False

View File

@@ -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

View File

@@ -187,7 +187,7 @@
<HeaderTemplate>Excedente</HeaderTemplate>
<ItemTemplate>
<asp:TextBox ID="TxtSaldoExcedente" Width="80px" runat="server" Style="text-align: right;" onkeyup="FormatoMoneda(this)"></asp:TextBox>&nbsp;
<asp:RangeValidator ID="RVSaldoExcedente" runat="server" Enabled="false" Type="Currency" MinimumValue="0" MaximumValue='<%# Eval("Saldo", "{0:N2}") %>' ErrorMessage="*" ControlToValidate="TxtSaldoExcedente" Display="Dynamic"></asp:RangeValidator>
<asp:RangeValidator ID="RVSaldoExcedente" runat="server" Enabled="false" Type="Currency" MinimumValue="0" MaximumValue='<%#If(Eval("Saldo").ToString().Contains("-"), "0", Eval("Saldo", "{0:N2}")) %>' ErrorMessage="*" ControlToValidate="TxtSaldoExcedente" Display="Dynamic"></asp:RangeValidator>
</ItemTemplate>
</asp:TemplateField>

View File

@@ -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("<br/><br/><a Class=""Texto"" target='_blank' href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Ver Póliza</a>", 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("<br/><br/><a Class=""Texto"" target='_blank' href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Ver Póliza</a>", 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()

View File

@@ -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

View File

@@ -1058,6 +1058,32 @@
</div>
</div>
</div>
<div class="portlet light xspadding bordered">
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase">Cuentas y conceptos</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
</div>
<div class="portlet-body form-horizontal form-row-sepe">
<div class="form-body">
<asp:UpdatePanel runat="server" ID="UpCuentaConceptos" UpdateMode="Conditional">
<ContentTemplate>
<asp:GridView ID="GvCuentasContable" runat="server" DataKeyNames="ConceptoContable,NombreCuenta" AutoGenerateColumns="False" EmptyDataText="No se encontraron Ventas en el Cliente" ToolTip="Listado de Historial de Ventas" CssClass="table table-striped table-advance table-hover" Style="text-align: center; min-width: 783px; width: 100%;" GridLines="None">
<Columns>
<asp:BoundField HeaderText="Concepto Contable" DataField="ConceptoContable"/>
<asp:BoundField HeaderText="Nombre Cuenta" DataField="NombreCuenta"/>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</div>
</div>
</div>

View File

@@ -778,7 +778,7 @@ Partial Class Clientes
If Request("ATI") IsNot Nothing AndAlso IsNumeric(Request("ATI")) Then
Tab.ActiveTabIndex = Request("ATI").ToEntero
End If
CargaCuentasyConceptos()
Else
'Configuración de Modalidad Insert
@@ -1037,6 +1037,15 @@ Partial Class Clientes
DdlMonedaExtranjeraAnticipos.Attributes.Add("onclick", "CargaCuentas(9);")
End Sub
Private Sub CargaCuentasyConceptos()
Dim ObjConta As New ClsContabilidad
If ObjConta.GetCuentasyConceptos(CveCliente) Then
GvCuentasContable.DataSource = ObjConta.DtResultados
End If
ObjConta.Dispose()
GvCuentasContable.DataBind()
UpCuentaConceptos.Update()
End Sub
Protected Sub BtnCargarCuentas_Click(sender As Object, e As EventArgs) Handles BtnCargarCuentas.Click
If UsuarioActual.Empresa.ServerContPAQi = "" Then Exit Sub
@@ -1862,8 +1871,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()

View File

@@ -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--%>
@@ -2576,7 +2576,7 @@
</button>
<h4 class="modal-title" id="myModalLabelVenta">Registrar Venta</h4>
</div>
<div class="modal-body">
<div class="modal-body" onkeydown="return (event.keyCode!=13)">
<div class="row">
<div id="DivDatosVenta" runat="server" class="col-md-12">
<div class="portlet light xspadding bordered">
@@ -2595,7 +2595,7 @@
<div class="row">
<div class="col-md-4">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtCantidad" onkeyup="Recalcula();" Text="1" onkeypress="DisableEnterKey(event);" runat="server" CssClass="form-control " ClientIDMode="Static" MaxLength="12" ValidationGroup="GrpAddVenta" Width="60px"></asp:TextBox>
<asp:TextBox ID="TxtCantidad" inputmode="numeric" onkeyup="Recalcula();" Text="1" runat="server" CssClass="form-control " ClientIDMode="Static" MaxLength="12" ValidationGroup="GrpAddVenta" Width="60px"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="SoloNumerosCantidad" runat="server" TargetControlID="TxtCantidad" FilterType="Custom, Numbers" ValidChars="." />
<asp:RequiredFieldValidator ID="RFVCantidad" runat="server" ControlToValidate="TxtCantidad" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cantidad''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddVenta"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCOCantidad1" runat="server" HighlightCssClass="vco" TargetControlID="RFVCantidad" Width="300px"></ajax:ValidatorCalloutExtender>
@@ -2666,7 +2666,6 @@
</div>
<div id="DivRecepcionUsados" runat="server">
<div class="row">
<div class="col-md-6">
<label>Modelo:</label>
@@ -2677,7 +2676,7 @@
<div class="col-md-6">
<label>Año:</label>
<br />
<asp:TextBox ID="TxtAnioVehiculo" runat="server" Height="100%" Width="100%" CssClass="form-control" CausesValidation="true" MaxLength="500"></asp:TextBox>
<asp:TextBox ID="TxtAnioVehiculo" type="number" runat="server" Height="100%" Width="100%" CssClass="form-control" CausesValidation="true"></asp:TextBox>
</div>
</div>
<div class="row">
@@ -2709,12 +2708,6 @@
<ajax:FilteredTextBoxExtender ID="FTBECantidad" runat="server" TargetControlID="TxtCantidad" FilterType="Custom, Numbers" ValidChars="." />
</ItemTemplate>
</asp:TemplateField>
<%-- <asp:TemplateField HeaderText="Modelo" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="30%">
<ItemTemplate>
<asp:DropDownList ID="DdlModeloAuto" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="ModeloMarca" DataValueField="CveModeloAuto">
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>--%>
<asp:TemplateField HeaderText="BCI" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="25%">
<ItemTemplate>
<asp:DropDownList ID="DdlBCIUsado" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="BCI" DataValueField="CveBCIUsado" Width="90%">
@@ -2727,22 +2720,12 @@
</div>
</div>
<%-- <br />
<div class="row">
<div class="col-md-7">
<label>BCI:</label>
<br />
<asp:DropDownList ID="DdlBCIUsado" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="BCI" DataValueField="CveBCIUsado" Width="200px">
</asp:DropDownList>
</div>
</div>--%>
<br />
<div class="row">
<div class="col-md-3">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtPrecio" runat="server" onkeypress="setFocus(event,'LbAgregar');" onkeyup="Recalcula();" CausesValidation="true" lang="nb" ClientIDMode="Static" Text="0.00" MaxLength="12" ValidationGroup="GrpAddVenta" Width="76px" CssClass="form-control "></asp:TextBox>
<asp:TextBox ID="TxtPrecio" inputmode="numeric" runat="server" onkeyup="Recalcula();" CausesValidation="true" lang="nb" ClientIDMode="Static" Text="0.00" MaxLength="12" ValidationGroup="GrpAddVenta" Width="76px" CssClass="form-control "></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender4" runat="server" TargetControlID="TxtPrecio" FilterType="Custom, Numbers" ValidChars="." />
<asp:RequiredFieldValidator ID="RFVPrecio" runat="server" ControlToValidate="TxtPrecio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddVenta"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCPrecio" runat="server" HighlightCssClass="vco" TargetControlID="RFVPrecio" Width="300px"></ajax:ValidatorCalloutExtender>
@@ -2753,7 +2736,7 @@
</div>
<div class="col-md-3">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtDescuento" runat="server" onkeypress="setFocus(event,'LbAgregar');" onkeyup="Recalcula();" CausesValidation="true" lang="nb" ClientIDMode="Static" Text="0.00" MaxLength="12" ValidationGroup="GrpAddVenta" Width="100px" CssClass="form-control "></asp:TextBox>
<asp:TextBox ID="TxtDescuento" inputmode="numeric" runat="server" onkeyup="Recalcula();" CausesValidation="true" lang="nb" ClientIDMode="Static" Text="0.00" MaxLength="12" ValidationGroup="GrpAddVenta" Width="100px" CssClass="form-control "></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender2" runat="server" TargetControlID="TxtDescuento" FilterType="Custom, Numbers" ValidChars="." />
<asp:CustomValidator ID="CVDescuento" runat="server" ClientValidationFunction="ValidaDecimal6digits" ControlToValidate="TxtDescuento" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Descuento''</b> no tiene el formato correcto. Por favor rectifique y vuelva a intentar." ValidateEmptyText="True" ValidationGroup="GrpAddVenta"></asp:CustomValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender6" runat="server" HighlightCssClass="vco" TargetControlID="CVDescuento" Width="300px"></ajax:ValidatorCalloutExtender>
@@ -2777,7 +2760,7 @@
</div>
<div class="col-md-6" align="right" id="divagregrarotrops" runat="server">
<label>Agregar otro Producto:</label>
<asp:CheckBox ID="ChkAgregar" runat="server" Checked="true" />
<asp:CheckBox ID="ChkAgregar" runat="server" Checked="true" />
</div>
</div>
<div class="row">
@@ -2988,7 +2971,7 @@
</div>
</div>
<div class="col-md-4">
<asp:Button ID="BtnCalcularImporteAjuste" CssClass="btn green-haze btn-outline btn-circle btn-sm" OnClick="BtnCalcularImporteAjuste_Click" runat="server" Text="Recalcular" />
<asp:Button ID="BtnCalcularImporteAjuste" CssClass="btn green-haze btn-outline btn-circle btn-sm" OnClick="BtnCalcularImporteAjuste_Click" runat="server" Text="Recalcular" UseSubmitBehavior="false" />
</div>
</div>
</div>
@@ -3000,8 +2983,8 @@
<div class="modal-footer">
<asp:UpdatePanel ID="UpAgregar" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Button ID="BtnCalculaMesesUso" Text="" OnClick="BtnCalculaMesesUso_Click" ClientIDMode="Static" Style="display: none;" runat="server" />
<asp:Button ClientIDMode="Static" ID="LnkAgregarPS" OnClick="LnkAgregarPS_Click" runat="server" CssClass="btn btn-primary" Text="Agregar" ValidationGroup="GrpAddVenta" />
<%-- <asp:Button ID="BtnCalculaMesesUso" Text="" OnClick="BtnCalculaMesesUso_Click" ClientIDMode="Static" Style="display: none;" runat="server" />--%>
<asp:Button ClientIDMode="Static" ID="LnkAgregarPS" OnClick="LnkAgregarPS_Click" runat="server" CssClass="btn btn-primary" Text="Agregar" ValidationGroup="GrpAddVenta" UseSubmitBehavior="false" />
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
</ContentTemplate>
</asp:UpdatePanel>
@@ -3021,80 +3004,55 @@
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() {
$get("BtnCalculaMesesUso").click();
}
//function CalculaMesesUso() {
// $get("BtnCalculaMesesUso").click();
//}
function ConvertirDllsPesos() {
var totalPesos = FormatoNumero(ToDouble($get('TxtTotal').value) * ToDouble($get('TxtTipoCambio').value), 2)

View File

@@ -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"
@@ -1088,7 +1097,7 @@ Partial Class PV
'ImgCerrarEstadoCaja.Attributes.Add("OnClick", "$('#DivEstadoCaja').hide();")
TxtPorDescP.Attributes.Add("onKeyUp", "CalculaDescuento();")
TxtDescP.Attributes.Add("onKeyUp", "CalculaDescuentoMonto();")
TxtFechaAjuste.Attributes.Add("onchange", "CalculaMesesUso();")
'TxtFechaAjuste.Attributes.Add("onchange", "CalculaMesesUso();")
CreaDTmpC()
CreaDTmpF()
@@ -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 = ""
@@ -5902,35 +5917,46 @@ Partial Class PV
TxtPrecio.Enabled = Not Dr("CveVenta").ToString.ToEntero > 0
End If
End Sub
Protected Sub BtnCalculaMesesUso_Click(sender As Object, e As EventArgs)
CalculaMesesUso()
End Sub
'Protected Sub BtnCalculaMesesUso_Click(sender As Object, e As EventArgs)
' CalculaMesesUso()
'End Sub
Private Sub CalculaMesesUso()
Private Function CalculaMesesUso() As Boolean
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
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
If FechaI.AddDays(-1) > FechaF Then
TxtFechaAjuste.Text = FechaF.ToString("dd/MM/yyyy")
Alert("La fecha de ajuste debe ser menor a la fecha actual", TipoMensaje.ToastAdventencia)
Return False
End If
TxtMesesUso.Text = MesesTrascurridos.ToString
Dim Dia As Integer = FechaI.Day
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
CalculaPorcentajeAjuste()
End Sub
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
TxtMesesUso.Text = MesesTrascurridos.ToString
Catch ex As Exception
OnError("Ocurrió un error al calcular los meses de uso", ex)
End Try
Return True
End Function
Protected Sub DdlPSAjuste_selectedindexchange(sender As Object, e As EventArgs)
If DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso DdlFacturas.SelectedValue.ToEntero > 0 Then
Dim Contador As Integer = 1
Dim PUFactura As Decimal = 0
For Each Dr As DataRow In DtPUFacturas.Rows
@@ -5940,7 +5966,6 @@ Partial Class PV
Contador += 1
Next
TxtPUFactura.Text = PUFactura.FormatoNumero(2)
End If
If DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso DdlFacturas.SelectedValue.ToEntero <= 0 Then
@@ -5950,15 +5975,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"))
@@ -5972,10 +6005,9 @@ Partial Class PV
If Not DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso DdlFacturas.SelectedValue.ToEntero > 0 Then
TxtPUFactura.Text = ""
End If
CalculaPorcentajeAjuste()
If DdlPSAjuste.SelectedValue.ToEntero() > 0 Then
CalculaPorcentajeAjuste()
End If
End Sub
Protected Sub DdlTipoUso_SelectedIndexChanged(sender As Object, e As EventArgs)
@@ -5991,6 +6023,13 @@ 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
If Not CalculaMesesUso() Then
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 +6246,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
@@ -6252,12 +6291,13 @@ Partial Class PV
Dim Retorno As Boolean = True
If Modalidad = "U" Then
If TmpDTRecepcionUsados.Rows.Count > 0 Then
If TmpDTPolizaVirtual.Rows.Count > 0 Then
Dim Elimino As Boolean = False
For Each RowPoliza As DataRow In TmpDTPolizaVirtual.Rows
If RowPoliza("CvePS").ToString().ToEntero() = CvePS Then
RowPoliza.Delete()
Elimino = True
Exit For
End If
Next
If Elimino Then

View File

@@ -5261,7 +5261,7 @@
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="myModalLabelVenta">Registrar Venta</h4>
<h4 class="modal-title" id="myModalLabelVenta">Registrar Producto/Servicio</h4>
</div>
<div class="modal-body">
<div class="form-group form-md-line-input input-iconright">
@@ -5286,12 +5286,6 @@
</div>
</div>
</div>
<%-- <div class="form-group form-md-line-input input-iconright">
<ADS:Dropdownlost runat="server" ID="DdlPSPyME" CssStyle="width: 50%;" CssClass="form-control input-sm DdlPS" CssClassDdl="select2me " IncluyeTodos="false" DataTextField="PSCodigo" DataValueField="CvePS" data-onresult="CargaExistenciaAlmacenes" />
<label for="<%= DdlPSPyME.ClientID.ToString()%>">
Productos / Servicio:
<label>
</div>--%>
</ContentTemplate>
</asp:UpdatePanel>
<br />

View File

@@ -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 AndAlso CveVenta <= 0 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
@@ -9255,8 +9302,16 @@ Partial Class Ventas
ErrorList.Add("Ocurrió un error al Generar la Venta.<br />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
@@ -13965,10 +14020,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 IsNot Nothing AndAlso DtPromociones.Rows.Count > 0 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,101 +14122,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 DiasPlazo As Integer = RowPorcentaje("Plazo").ToString().ToEntero
TxtFechaPago.Text = Now.AddDays(DiasPlazo).ToShortDateString
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,
@@ -14090,18 +14147,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
@@ -14114,60 +14159,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)
@@ -14175,8 +14172,6 @@ Partial Class Ventas
CalculaUsados()
CalculaTotalesVenta()
ElseIf Modalidad = "U" Then
Dim ErrorEdit As Boolean = True
@@ -14357,49 +14352,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)
@@ -17022,7 +16974,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,
@@ -19740,55 +19691,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, "")
@@ -20011,8 +19915,6 @@ Partial Class Ventas
BtnAgregarPS.Enabled = True
End If
UpSerieConsignacion.Update()
TxtSerieLote.Text = ""
TxtSerieLote.Focus()
@@ -21766,7 +21668,7 @@ Partial Class Ventas
UPCondicionesPago.Update()
UpDetalle.Update()
BloqueaCondiconesPago()
End Sub
Private Sub InicializaDTVentasNC()
@@ -22085,6 +21987,8 @@ Partial Class Ventas
End If
Next
BloqueaCondiconesPago()
UpAnticipos.Update()
UpParametros.Update()
UpPS.Update()
@@ -22097,6 +22001,8 @@ Partial Class Ventas
UpnTools.Update()
UPObservaciones.Update()
UpAntNC.Update()
End Sub
#End Region
@@ -22542,6 +22448,7 @@ Partial Class Ventas
GvImpuestosLocales2.Enabled = True
BloqueaCondiconesPago()
UpPS.Update()
UPPDescuento.Update()
@@ -23891,6 +23798,7 @@ Partial Class Ventas
CambiaSucursalGeneral()
CargaAnticipos(CveCliente)
CargaRestriccionesCreditoCliente(CveVenta:=-1)
BloqueaCondiconesPago()
UpParametros.Update()
End Sub
@@ -24079,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
@@ -24105,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