This commit is contained in:
Rakcsle Supertramp
2020-11-28 09:24:02 -07:00
11 changed files with 698 additions and 280 deletions

View File

@@ -454,6 +454,26 @@ Public Class ClsMovimientos
OnError("Ocurrió un error al consultar los Anticipos del Cliente.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
Public Function GetRemisionesNCCliente(CveCliente As Integer, MostarDetalle As Boolean, Optional CveMoneda As Integer = -1, Optional CveClienteSucursal As Integer = -1) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_ClienteRemisionesNC")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
.Add("@MostarDetalle", SqlDbType.Bit).Value = MostarDetalle
.Add("@CveClienteSucursal", SqlDbType.Int).Value = CveClienteSucursal
.Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As SqlException
OnError("Ocurrió un error al consultar los Anticipos del Cliente.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function

View File

@@ -764,6 +764,25 @@ Public Class ClsVentas
Return Retorno
End Function
Public Function UpdateVentaRNCUsado(CveVentaRNC As Integer, CveVenta As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_VentasRNCUsadosUpdate")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveVentaRNC", SqlDbType.Int).Value = CveVentaRNC
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al actualizar la relacion con el usado.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
Public Function UpdateCancelaVenta(CveVenta As Integer, FechaCancelacion As DateTime, SelloCancelacionSAT As String, CveEmpresa As Integer, Optional CvePAC As Integer = -1, Optional CveEstatusRefacturacion As Integer = 0) As Boolean
Dim Retorno As Boolean = False
@@ -4788,6 +4807,26 @@ Public Class ClsVentas
Return Retorno
End Function
Public Function AddVentaDetalleRNCFacturada(CveVentaDetalleRNC As Integer, CveVentaDetalle As Integer, CantidadFacturada As Decimal) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_VentaDetalleRNCFacturadaAdd")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveVentaDetalleRNC", SqlDbType.Int).Value = CveVentaDetalleRNC
.Add("@CveVentaDetalle", SqlDbType.Int).Value = CveVentaDetalle
.Add("@CantidadFacturada", SqlDbType.Float).Value = CantidadFacturada
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As SqlException
OnError("Ocurrió un error al agregar lo facturado de la RNC.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
#End Region

View File

@@ -74,17 +74,17 @@
<div id="DivDatos" style="overflow-y: auto; width: 750px; max-height: 360px;">
<asp:GridView ID="GvDatos" ClientIDMode="Static" runat="server" CssClass="table table-striped table-advance table-hover Widthall" AutoGenerateColumns="False" GridLines="None">
<Columns>
<asp:BoundField DataField="NumCuenta" ItemStyle-Width="100px" ItemStyle-HorizontalAlign="Center" HeaderText="Cuenta" />
<asp:BoundField DataField="FechaDocumento" DataFormatString="{0:d}" ItemStyle-Width="60px" ItemStyle-HorizontalAlign="Center" HeaderText="Fecha" />
<asp:BoundField DataField="NumCuenta" ItemStyle-Width="80px" HeaderText="Cuenta" />
<asp:BoundField DataField="FechaDocumento" DataFormatString="{0:d}" ItemStyle-Width="60px" HeaderText="Fecha" />
<asp:TemplateField HeaderText="Folio" ItemStyle-Width="80" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Literal ID="LtlFolio" runat="server"></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Importe" DataFormatString="{0:N2}" ItemStyle-Width="100px" ItemStyle-HorizontalAlign="Right" HeaderText="Importe" />
<asp:BoundField DataField="Moneda" ItemStyle-Width="40px" ItemStyle-HorizontalAlign="Center" HeaderText="Moneda" />
<asp:BoundField DataField="PagueseA" ItemStyle-Width="100px" ItemStyle-HorizontalAlign="Center" HeaderText="Beneficiario" />
<asp:BoundField DataField="EstatusIE" ItemStyle-Width="100px" ItemStyle-HorizontalAlign="Center" HeaderText="Estatus" />
<asp:BoundField DataField="MonedaAbreviatura" ItemStyle-Width="40px" ItemStyle-HorizontalAlign="Center" HeaderText="Moneda" />
<asp:BoundField DataField="PagueseA" HeaderText="Beneficiario" />
<asp:BoundField DataField="EstatusIE" ItemStyle-Width="50px" HeaderText="Estatus" />
</Columns>
</asp:GridView>
</div>

View File

@@ -311,8 +311,7 @@ Partial Class GPS_RepCombustible
End Sub
Protected Sub Lnkreportegral_Click(sender As Object, e As EventArgs)
Dim GloBalFileUrl As String = HttpContext.Current.Server.MapPath("~")
Dim file As String = $"{GloBalFileUrl}Empresas\Grales\Formatos\CombustibleGeneral.xlsx"
Dim file As String = $"{DirectorioBaseEmpresas}Empresas\Grales\Formatos\CombustibleGeneral.xlsx"
Try
Dim wb As New ClosedXML.Excel.XLWorkbook(file)
Dim libro = wb.Worksheets(0)

View File

@@ -27,6 +27,7 @@
CssClass="table table-striped table-advance table-hover ScrollAD mysmallbtn" data-sort="true" Width="100%" GridLines="None">
<Columns>
<asp:BoundField DataField="Codigo" HeaderText="Código" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="Marca" HeaderText="Marca" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="Modelo" HeaderText="Modelo" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="EstatusTexto" HeaderText="Estatus" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="FechaIng" ItemStyle-Width="15%" HeaderText="Fecha de Ingreso" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:d}" />

View File

@@ -853,7 +853,7 @@ Partial Class General_SaldosIniciales
If Codigo.Length > 0 Then
If ObjPS.AddPS(CveClasificacion, 1, CveUnidadMedida, Codigo, "", CodigoBarras, Descripcion, Precio, 0, 0, False, 0, False, True, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1, 1,
If ObjPS.AddPS(CveClasificacion, 1, CveUnidadMedida, Codigo, "", CodigoBarras, Descripcion, Precio, -1, 0, False, 0, False, True, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1, 1,
CveTipoPS:=CveTipoPS, CveSATPS:=CveSATPS, CveMarca:=CveMarca, CveTamaño:=CveTamaño, CveMedida:=CveMedida, CveRinTamaño:=CveRinTamaño,
CveModelo:=CveModelo, Litraje:=Litraje, IEPSPorcentaje:=IEPS, CveClasificacion2:=CveClasificacion2, CveClasificacionDetalle:=CveClasificacionDetalle) <= 0 Then
'If ObjPS.AddPS(CveClasificacion, 1, CveUnidadMedida, Codigo, "", "", Descripcion, 0, 0, 0, False, 0, False, True, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1, 1,

View File

@@ -2525,8 +2525,14 @@ Partial Class Inventarios_RecepcionUsados
If RblUsadosAjuste.SelectedValue = "1" Then
'agrego un registro extra del importe de ajuste
Dim PU As Decimal = TxtImporteAjuste.Text.ToDecimal
Dim CveSATNC As String = "84111506"
Dim Dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, SATClavePS:=CveSATNC, AplicaParaVenta:=1).FiltroPrimero("")
'CONSULTA EL CONCEPTO DE NC
Dim ArrayNC As String() = UsuarioActual.Empresa.Funcionalidad(591).Split(",".ToCharArray())
Dim NCAjuste As Integer = -1
If ArrayNC.Length > 5 Then
NCAjuste = ArrayNC(5).ToEntero()
End If
Dim Dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=NCAjuste, AplicaParaVenta:=1).FiltroPrimero("")
If Dr IsNot Nothing Then
Dim CveUnidadMedida, CveClasificacion, CvePS As Integer
@@ -2534,7 +2540,7 @@ Partial Class Inventarios_RecepcionUsados
CveClasificacion = Dr("CveClasificacion").ToString.ToEntero
CvePS = Dr("CvePS").ToString.ToEntero
Dim PorcentajeIVA As Decimal = 0.16D
Dim Obs As String = "Descuento por garantía"
Dim Obs As String = $"Descuento por garantía. BCI: {DdlBCIAjuste.SelectedValue}"
AddPSRNC(ObjRemisionNC.DtDetalle, 1, CveUnidadMedida, "", CveClasificacion, "", CvePS, "", Obs, PU, 0, -1, "",
ObjRemisionNC.CveSubProyecto, ObjRemisionNC.SubProyecto.SubProyecto, PorcentajeIVA:=PorcentajeIVA)
@@ -2806,13 +2812,6 @@ Partial Class Inventarios_RecepcionUsados
Dim ClasificacionPS As String = GlobalDTClasificaciones(CveEmpresa:=UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacionPS).FiltroPrimeroValor("Clasificacion").ToString()
Select Case TipoFolio
Case "GENERAL"
'20520 ACUM. AUTOMOTRIZ
'20522 ACUM. ESPECIALES
'20513 ACUM. ESTANDAR
'20521 ACUM. PESADO
'20512 ACUM. PREMIUM
'20514 ACUM. VALUE
'20229 Acumulador
ListaClasificacionesPermitidas.Add(20520) 'ACUM. AUTOMOTRIZ
ListaClasificacionesPermitidas.Add(20522) 'ACUM. ESPECIALES
ListaClasificacionesPermitidas.Add(20513) 'ACUM. ESTANDAR

View File

@@ -17,7 +17,7 @@ Partial Class Site
Return Convert.ToBoolean(HdnEsPopup.Value)
End Get
Set(value As Boolean)
HdnEsPopup.Value = value.ToString
HdnEsPopup.Value = value.ToString()
End Set
End Property
@@ -26,7 +26,7 @@ Partial Class Site
Return HdnPopUpWidth.Value.ToEntero
End Get
Set(value As Integer)
HdnPopUpWidth.Value = value.ToString
HdnPopUpWidth.Value = value.ToString()
End Set
End Property
Public Property userx As Usuario
@@ -39,7 +39,7 @@ Partial Class Site
End Property
Public Property countNotificaciones As Integer
Get
countNotificaciones = If(IsNothing(ViewState("countNotificaciones")), 0, ViewState("countNotificaciones").ToString.ToEntero)
countNotificaciones = If(IsNothing(ViewState("countNotificaciones")), 0, ViewState("countNotificaciones").ToString().ToEntero)
End Get
Set(value As Integer)
ViewState("countNotificaciones") = value
@@ -64,10 +64,10 @@ Partial Class Site
lblFecha.Text = DateTime.Now.ToString("dd.MMMyyyy HH:mm tt")
MasterChat.Visible = False
If Request("Masterimpoup") IsNot Nothing AndAlso Request("Masterimpoup").ToString = "true" Then EsPopup = True
If Request("Masterimpoup") IsNot Nothing AndAlso Request("Masterimpoup").ToString() = "true" Then EsPopup = True
If UsuarioActual IsNot Nothing Then
HdnCveE.Value = UsuarioActual.CveEmpresa.ToString
HdnCveU.Value = UsuarioActual.CveUsuario.ToString
HdnCveE.Value = UsuarioActual.CveEmpresa.ToString()
HdnCveU.Value = UsuarioActual.CveUsuario.ToString()
LitTit.Text = UsuarioActual.Empresa.EmpresaEncabezado
If UsuarioActual.CveUsuario = 100 Then
LitTit.Text = String.Format("<span style='color:white; font-size:x-large'></span>&nbsp;<span style='color: #32A1CF; font-size:x-large'>Mi Empresa de Ventas ({0})</span> ", UsuarioActual.CveEmpresa)
@@ -81,7 +81,7 @@ Partial Class Site
userx = New Usuario
userx.Empresa = New Empresa
userx.Referencia = Encripta(UsuarioActual.CveUsuario.ToString)
userx.Referencia = Encripta(UsuarioActual.CveUsuario.ToString())
userx.Usuario = Encripta(UsuarioActual.Usuario)
userx.Liga = Encripta(UsuarioActual.Rol)
@@ -143,7 +143,7 @@ Partial Class Site
Else
'VALIDACION DE SEGURIDAD, EN LA QUE SE VALIDA QUE LA EMPRESA EN LA QUE SE GENERO LA PAGINA SEA LA MISMA A LA DE LA SESION,
'DE NO SER ASI, SE REDIRECCIONA A INICIO.
If UsuarioActual IsNot Nothing AndAlso (HdnCveE.Value <> UsuarioActual.CveEmpresa.ToString OrElse HdnCveU.Value <> UsuarioActual.CveUsuario.ToString) Then
If UsuarioActual IsNot Nothing AndAlso (HdnCveE.Value <> UsuarioActual.CveEmpresa.ToString() OrElse HdnCveU.Value <> UsuarioActual.CveUsuario.ToString()) Then
Response.Redirect(FormsAuthentication.DefaultUrl)
End If
End If
@@ -186,7 +186,7 @@ Partial Class Site
' userstring.AppendFormat("{0}{1} ", prefix, item)
' prefix = ","
' Next
' stringusers = userstring.ToString
' stringusers = userstring.ToString()
' If userconectedlist.Count > 0 Then
' GlobalDTUsuarios = GlobalDTUsuarios.FiltraParametros(String.Format("CveUsuario in ({0})", userstring))
' RptChatEmpresa.DataSource = GlobalDTUsuarios.FiltraParametros("CveEmpresa >1", "", {"CveEmpresa", "Empresa"})
@@ -198,7 +198,7 @@ Partial Class Site
'End Sub
'Private stringusers As String = "0"
'Private Sub RptChatEmpresa_ItemDataBound(sender As Object, e As RepeaterItemEventArgs) Handles RptChatEmpresa.ItemDataBound
' Dim CveEmpresa As Integer = e.Item.DataItem("CveEmpresa").ToString.ToEntero
' Dim CveEmpresa As Integer = e.Item.DataItem("CveEmpresa").ToString().ToEntero
' Dim GlobalDTUsuarios As DataTable = DirectCast(Application("GlobalDTUsuarios"), DataTable).FiltraParametros(String.Format("CveUsuario in ({0}) AND CveEmpresa ={1}", stringusers, CveEmpresa))
' Dim rpthijo As Repeater = DirectCast(e.Item.FindControl("RPTChatuser"), Repeater)
@@ -312,61 +312,73 @@ Partial Class Site
Dim LinkNieto = ""
Dim ClassActive As String
CveModuloPadreSeleccionado = 0 : CveModuloHijoSeleccionado = 0 : CveModuloNietoSeleccionado = 0
Dim strdomain = Request.Url.AbsoluteUri.Replace(Request.Url.PathAndQuery, "")
If Request.Url.Port <> 80 Then
strdomain = strdomain.Replace(String.Format(":{0}", Request.Url.Port), "")
End If
Dim MenuHTML As New StringBuilder
For Each drP As DataRow In Inicio
CveModuloPadre = drP("CveModulo").ToString.ToEntero
LinkPadre = drP("LIGA").ToString
If drP("PopUp").ToString = "S" Then LinkPadre = String.Format("javascript:AbrirVentana('{0}',{1},{2},'N');", drP("LIGA"), drP("ANCHO"), drP("ALTO"))
CveModuloPadre = drP("CveModulo").ToString().ToEntero
LinkPadre = drP("LIGA").ToString()
If drP("PopUp").ToString() = "S" Then LinkPadre = String.Format("javascript:AbrirVentana('{0}',{1},{2},'N');", drP("LIGA"), drP("ANCHO"), drP("ALTO"))
Dim Hijos = From h In dt.AsEnumerable Where h!CvePadre.Equals(CveModuloPadre) Order By h!Orden
If CveModulo = drP("CveModulo").ToString.ToEntero Then
HeaderBar.AppendFormat("<i class='fa fa-angle-right'></i></li> <li><a href='{0}'>{1}</a>", LinkPadre, drP("Modulo").ToString)
ScriptColorGrupoModulo = ColorPage(drP("CveGrupoModulo").ToString.ToEntero)
If CveModulo = drP("CveModulo").ToString().ToEntero Then
HeaderBar.AppendFormat("<i class='fa fa-angle-right'></i></li> <li><a href='{0}'>{1}</a>", LinkPadre, drP("Modulo").ToString())
ScriptColorGrupoModulo = ColorPage(drP("CveGrupoModulo").ToString().ToEntero)
End If
If Hijos.Count > 0 Then
Linkpapa = LinkPadre
LinkPadre = LinkBase
MenuHTML.AppendFormat("<li id='m{3}'><a href='{0}'>{2}<span class='title'>{1}</span><span id='j{3}' ></span><span class='arrow '></span></a><ul class='sub-menu'>", LinkPadre, drP("Modulo"), If(drP("Estilo").ToString <> "", String.Format("<i class='{0}'></i>", drP("Estilo")), ""), drP("CveModulo"))
MenuHTML.AppendFormat("<li id='m{3}'><a href='{0}'>{2}<span class='title'>{1}</span><span id='j{3}' ></span><span class='arrow '></span></a><ul class='sub-menu'>", LinkPadre, drP("Modulo"), If(drP("Estilo").ToString() <> "", String.Format("<i class='{0}'></i>", drP("Estilo")), ""), drP("CveModulo"))
For Each drH As DataRow In Hijos
Dim CveModuloHijo As Integer = drH("CveModulo").ToString.ToEntero
LinkHijo = drH("LIGA").ToString
If CveModulo = drH("CveModulo").ToString.ToEntero Then
Dim CveModuloHijo As Integer = drH("CveModulo").ToString().ToEntero
LinkHijo = drH("LIGA").ToString()
If (drH("IsAngular").ToString() = "1") Then
LinkHijo = String.Format("{1}:84{0}", drH("LIGA"), strdomain)
End If
If CveModulo = drH("CveModulo").ToString().ToEntero Then
CveModuloPadreSeleccionado = CveModuloPadre
ClassActive = "class='active'"
HeaderBar.AppendFormat("<i class='fa fa-angle-right'></i> </li><li><a href='{0}'>{1}</a> <i class='fa fa-angle-right'></i> </li><li><a href='{2}'>{3}</a>", Linkpapa, drP("Modulo").ToString, LinkHijo, drH("Modulo").ToString)
ScriptColorGrupoModulo = ColorPage(drH("CveGrupoModulo").ToString.ToEntero)
HeaderBar.AppendFormat("<i class='fa fa-angle-right'></i> </li><li><a href='{0}'>{1}</a> <i class='fa fa-angle-right'></i> </li><li><a href='{2}'>{3}</a>", Linkpapa, drP("Modulo").ToString(), LinkHijo, drH("Modulo").ToString())
ScriptColorGrupoModulo = ColorPage(drH("CveGrupoModulo").ToString().ToEntero)
Else
ClassActive = ""
End If
If drH("PopUp").ToString = "S" Then LinkHijo = String.Format("javascript:AbrirVentana('{0}',{1},{2},'N');", drH("LIGA"), drH("ANCHO"), drH("ALTO"))
If drH("PopUp").ToString() = "S" Then LinkHijo = String.Format("javascript:AbrirVentana('{0}',{1},{2},'N');", drH("LIGA"), drH("ANCHO"), drH("ALTO"))
Dim Nietos = From h In dt.AsEnumerable Where h!CvePadre.Equals(CveModuloHijo) Order By h!Orden
If Nietos.Count > 0 Then
Linkson = LinkHijo
LinkHijo = LinkBase
MenuHTML.AppendFormat("<li id='m{3}'><a href='{0}'>{2}{1}<span class='arrow '></span> </a><ul class='sub-menu'>", LinkHijo, drH("Modulo"), If(drP("Estilo").ToString <> "", String.Format("<i class='{0}'></i>", drH("Estilo")), ""), drH("CveModulo"))
MenuHTML.AppendFormat("<li id='m{3}'><a href='{0}'>{2}{1}<span class='arrow '></span> </a><ul class='sub-menu'>", LinkHijo, drH("Modulo"), If(drP("Estilo").ToString() <> "", String.Format("<i class='{0}'></i>", drH("Estilo")), ""), drH("CveModulo"))
For Each drN As DataRow In Nietos
LinkNieto = drN("LIGA").ToString
If CveModulo = drN("CveModulo").ToString.ToEntero Then
LinkNieto = drN("LIGA").ToString()
If (drH("IsAngular").ToString() = "1") Then
LinkNieto = String.Format("{1}:4200{0}", drN("LIGA"), strdomain)
End If
If CveModulo = drN("CveModulo").ToString().ToEntero Then
CveModuloPadreSeleccionado = CveModuloPadre : CveModuloHijoSeleccionado = CveModuloHijo
ClassActive = "class='active'"
HeaderBar.AppendFormat("<i class='fa fa-angle-right'></i> </li><li><a href='{0}'>{1}</a> <i class='fa fa-angle-right'></i> </li><li><a href='{2}'>{3}</a> <i class='fa fa-angle-right'></i> </li><li><a href='{4}'>{5}</a>", Linkpapa, drP("Modulo").ToString, Linkson, drH("Modulo").ToString, LinkNieto, drN("Modulo"))
ScriptColorGrupoModulo = ColorPage(drN("CveGrupoModulo").ToString.ToEntero)
HeaderBar.AppendFormat("<i class='fa fa-angle-right'></i> </li><li><a href='{0}'>{1}</a> <i class='fa fa-angle-right'></i> </li><li><a href='{2}'>{3}</a> <i class='fa fa-angle-right'></i> </li><li><a href='{4}'>{5}</a>", Linkpapa, drP("Modulo").ToString(), Linkson, drH("Modulo").ToString(), LinkNieto, drN("Modulo"))
ScriptColorGrupoModulo = ColorPage(drN("CveGrupoModulo").ToString().ToEntero)
Else
ClassActive = ""
End If
If drN("PopUp").ToString = "S" Then LinkNieto = String.Format("javascript:AbrirVentana('{0}',{1},{2},'N');", drN("LIGA"), drN("ANCHO"), drN("ALTO"))
MenuHTML.AppendFormat("<li {3}><a href=""{0}"">{2}{1}</a></li>", LinkNieto, drN("Modulo"), If(drP("Estilo").ToString <> "", String.Format("<i class='{0}'></i>", drN("Estilo")), ""), ClassActive)
If drN("PopUp").ToString() = "S" Then LinkNieto = String.Format("javascript:AbrirVentana('{0}',{1},{2},'N');", drN("LIGA"), drN("ANCHO"), drN("ALTO"))
MenuHTML.AppendFormat("<li {3}><a href=""{0}"">{2}{1}</a></li>", LinkNieto, drN("Modulo"), If(drP("Estilo").ToString() <> "", String.Format("<i class='{0}'></i>", drN("Estilo")), ""), ClassActive)
Next
MenuHTML.AppendFormat("</ul></li>")
Else
MenuHTML.AppendFormat("<li {3}><a href=""{0}"">{2}{1}</a></li>", LinkHijo, drH("Modulo"), If(drP("Estilo").ToString <> "", String.Format("<i class='{0}'></i>", drH("Estilo")), ""), ClassActive)
MenuHTML.AppendFormat("<li {3}><a href=""{0}"">{2}{1}</a></li>", LinkHijo, drH("Modulo"), If(drP("Estilo").ToString() <> "", String.Format("<i class='{0}'></i>", drH("Estilo")), ""), ClassActive)
End If
Next
MenuHTML.AppendFormat("</ul></li>")
Else
MenuHTML.AppendFormat("<li><a href=""{0}"">{2}<span class='title'>{1}</span></a></li>", LinkPadre, drP("Modulo"), If(drP("Estilo").ToString <> "", String.Format("<i class='{0}'></i>", drP("Estilo")), ""))
MenuHTML.AppendFormat("<li><a href=""{0}"">{2}<span class='title'>{1}</span></a></li>", LinkPadre, drP("Modulo"), If(drP("Estilo").ToString() <> "", String.Format("<i class='{0}'></i>", drP("Estilo")), ""))
End If
Next
@@ -380,9 +392,9 @@ Partial Class Site
MenuHTML = MenuHTML.Replace(String.Format("id='j{0}'", CveModuloHijoSeleccionado), String.Format("id='j{0}' class='selected'", CveModuloHijoSeleccionado))
End If
HeaderBar.AppendFormat("</li>{0}", ScriptColorGrupoModulo)
BarraNavegacion.Text = HeaderBar.ToString
BarraNavegacion.Text = HeaderBar.ToString()
'CargaMenu(MenuHTML)
Menu.Text = MenuHTML.ToString
Menu.Text = MenuHTML.ToString()
MenuHTML.Clear()
HeaderBar.Clear()
End Sub
@@ -417,7 +429,7 @@ Partial Class Site
End Function
'Private Sub CargaMenu(Texto As StringBuilder)
' Menu.Text = Texto.ToString
' Menu.Text = Texto.ToString()
'End Sub
#Region "Notificaciones"
@@ -474,7 +486,7 @@ Partial Class Site
'End If
'OC.Dispose()
LtlMNotificaciones.Text = String.Format("{0}{1}", LtlMNotificaciones.Text, Notificaciones.ToString)
LtlMNotificaciones.Text = String.Format("{0}{1}", LtlMNotificaciones.Text, Notificaciones.ToString())
Notificaciones.Clear()
End Sub
@@ -484,7 +496,7 @@ Partial Class Site
Dim Archivo As String = String.Format("{0}Empresas\{1}\Certificados\{2}", ModExtensiones.DirectorioBaseEmpresas, UsuarioActual.CveEmpresa, UsuarioActual.Empresa.ArchivoCer)
If File.Exists(Archivo) Then
Dim CerFile As New FileStream(Archivo, FileMode.Open, FileAccess.Read)
Dim Size As Integer = CerFile.Length.ToString.ToEntero()
Dim Size As Integer = CerFile.Length.ToString().ToEntero()
Dim Data As Byte() = New Byte(Size - 1) {}
Size = CerFile.Read(Data, 0, Size)
CerFile.Close()

View File

@@ -9161,7 +9161,7 @@ Partial Class Clientes
End If
If ObjAcum.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa, TxtFechaIUsados.Text.ToDate, TxtFechaFUsados.Text.ToDate) Then
If ObjAcum.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) Then
GvUsadosResumen.DataSource = ObjAcum.DtResultados
End If
GvUsadosResumen.DataBind()

View File

@@ -2746,14 +2746,15 @@
<table>
<tr>
<td>Contrato:</td>
<td><asp:DropDownList ID="DdlContrato" runat="server" AppendDataBoundItems="true" Width="350px" AutoPostBack="true" DataTextField="NumeroContrato" DataValueField="CveContrato" CssClass="select2me" ></asp:DropDownList></td>
<td>
<asp:DropDownList ID="DdlContrato" runat="server" AppendDataBoundItems="true" Width="350px" AutoPostBack="true" DataTextField="NumeroContrato" DataValueField="CveContrato" CssClass="select2me"></asp:DropDownList></td>
</tr>
</table>
<asp:HyperLink ID="HLContrato" Target="_blank" CssClass="Texto" runat="server" Text="" Font-Bold="true"></asp:HyperLink>
<asp:GridView ID="GvEst" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron Estimaciones para este cliente" Width="100%" DataKeyNames="CveContrato,CveFamilias,CveSubFamilias,CveContratoAvance,Name,Importe,NumeroContrato,CveSubProyecto,FechaInicial" SelectedRowStyle-BackColor="#CCFF66" CssClass="table GvEst table-advance table-hover" Style="text-align: center;" GridLines="None">
<Columns>
@@ -2790,19 +2791,23 @@
<div id="ContratoDetalles" class="row" runat="server" visible="false">
<div class="col-md-12">
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<table>
<div class="row" style="margin-bottom: 10px;">
<div class="col-md-6">
<table>
<tr>
<td><asp:Label runat="server" Text="Contrato:"></asp:Label></td>
<td><asp:DropDownList runat="server" ID="DdlContratosModal" AutoPostBack="true" CssClass=" form-control input-sm select2me text-left" Width="400px" DataTextField="ContratoCompleto" DataValueField="CveContrato" /></td>
<td>
<asp:Label runat="server" Text="Contrato:"></asp:Label></td>
<td>
<asp:DropDownList runat="server" ID="DdlContratosModal" AutoPostBack="true" CssClass=" form-control input-sm select2me text-left" Width="400px" DataTextField="ContratoCompleto" DataValueField="CveContrato" /></td>
</tr>
<tr runat="server" id="DVEstimacionesObra" visible="false">
<td> Estimacion:</td>
<td> <asp:DropDownList ID="DdlEstimacionesObra" runat="server" AppendDataBoundItems="true" Width="400px" AutoPostBack="true" DataTextField="NumeroEstimacion" DataValueField="CveEstimacion" CssClass="select2me"></asp:DropDownList> </td>
<td>Estimacion:</td>
<td>
<asp:DropDownList ID="DdlEstimacionesObra" runat="server" AppendDataBoundItems="true" Width="400px" AutoPostBack="true" DataTextField="NumeroEstimacion" DataValueField="CveEstimacion" CssClass="select2me"></asp:DropDownList>
</td>
</tr>
</table>
</table>
</div>
@@ -2819,7 +2824,7 @@
<asp:ListItem Text="Venta" Value="2" Selected="True" />
<asp:ListItem Text="Suministro" Value="1" />
<%--<asp:ListItem Text="Consignación" Value="3" Enabled="false" />--%>
<asp:ListItem Text="Obra" Value="4" />
<asp:ListItem Text="Obra" Value="4" />
</asp:RadioButtonList>
</div>
<div class="col-md-6">
@@ -4314,7 +4319,7 @@
<asp:RadioButtonList ID="RblOpcionContrato" runat="server" CssClass="rbl" RepeatDirection="Horizontal" RepeatLayout="Table">
<asp:ListItem Text="Si" Value="2"></asp:ListItem>
<asp:ListItem Text="No" Value="1"></asp:ListItem>
</asp:RadioButtonList>
<asp:LinkButton ID="BtnIniciarContrato" runat="server" CssClass="btn btn-success" Text="Aceptar" />
@@ -6289,6 +6294,11 @@
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusquedaRNCCargos','{0}')", GvRemisionesNC.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div>
<div class="row">
<div class="col-md-12">
<asp:CheckBox ID="ChkMostarProductosRNC" runat="server" AutoPostBack="true" Text="Mostrar Productos" OnCheckedChanged="ChkMostarProductosRNC_CheckedChanged" />
</div>
</div>
<div class="row" id="DivRNCCargos" runat="server" visible="false">
<div class="col-md-12" style="max-height: 440px; overflow: auto">
<asp:GridView ID="GvRemisionesNC" runat="server" AutoGenerateColumns="False"
DataKeyNames="CveVenta" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn" GridLines="None">
@@ -6320,6 +6330,35 @@
</asp:GridView>
</div>
</div>
<div class="row" id="DivRNCCargosDetalle" runat="server" visible="false">
<div class="col-md-12" style="max-height: 440px; overflow: auto">
<asp:GridView ID="GvRemisionesNCDetalle" runat="server" AutoGenerateColumns="False"
DataKeyNames="CveVenta,CveVentaDetalleRNC,CvePS,PU,PorcentajeIVA" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn" GridLines="None">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="ChkAplicar" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Cantidad">
<ItemTemplate>
<asp:TextBox ID="TxtCantidadRNC" runat="server" Text='<%#Eval("CantidadPendiente").ToString%>' MaxLength="12" Width="46px" Height="24px"></asp:TextBox>
<asp:RangeValidator ID="RVCantRNC" runat="server" Type="Double" MinimumValue="0" MaximumValue='<%#Eval("CantidadPendiente").ToString%>' ErrorMessage="Cantidad Excedida" ControlToValidate="TxtCantidadRNC" Display="None" ValidationGroup="VGAplicarRNC"></asp:RangeValidator>
<ajax:ValidatorCalloutExtender ID="VCECantidad3" runat="server" HighlightCssClass="vco" TargetControlID="RVCantRNC" Width="300px"></ajax:ValidatorCalloutExtender>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="Producto" DataField="CodigoPS" ItemStyle-HorizontalAlign="Left" />
<asp:HyperLinkField DataNavigateUrlFields="CveVenta" Target="_blank" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" DataTextField="Folio" HeaderText="Folio" ItemStyle-Width="150px" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Fecha" DataField="Fecha" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" />
<asp:TemplateField HeaderText="Total" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Literal ID="TtlTotal" runat="server" Text='<%# Eval("Total", "{0:N2}") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</div>
<div class="row" id="DivSMU" runat="server" visible="false">
<div class="col-md-12">
<table border="0" rules="none" class="well TextTab" style="float: right;" runat="server">
@@ -6439,7 +6478,7 @@
<div class="col-md-2">
<asp:Button ID="BtnCalcularPenalizacion" runat="server" CssClass="btn btn-primary btn-sm" Text="Calcular" OnClick="BtnCalcularPenalizacion_Click" />
</div>
<div class="col-md-6"> </div>
<div class="col-md-6"></div>
</div>
<div class="row" style="margin-bottom: 10px;">
<div class="text-right col-md-offset-8 col-md-4">
@@ -7988,65 +8027,65 @@
}
function FnCambiaAnt(chk, txt, saldo) {
debugger;
function FnCambiaAnt(chk, txt, saldo) {
debugger;
var Total = ToDouble($get('TxtSubTotal').value);
let TipoAnticipo = $('#<%= DdlTipoAmortizacionAnticipo.ClientID %>').val();
let importeTxt = parseFloat(txt.value.replace(/,/g, ''));
var Total = ToDouble($get('TxtSubTotal').value);
let TipoAnticipo = $('#<%= DdlTipoAmortizacionAnticipo.ClientID %>').val();
let importeTxt = parseFloat(txt.value.replace(/,/g, ''));
if (isNaN(importeTxt)) {
importeTxt = 0;
} else {
if (importeTxt <= 0) {
if (isNaN(importeTxt)) {
importeTxt = 0;
chk.checked = false;
return;
} else {
if (importeTxt <= 0) {
importeTxt = 0;
chk.checked = false;
return;
}
}
saldo = (importeTxt > saldo) ? saldo : importeTxt;
var SaldoCompra = (Total - FnSumaValoresAnt() + ToDouble(txt.value)).toFixed(2); // le agrego lo del valor actual para validarlo //parseFloat(parseFloat($get('HdnVentaSaldo').value).toFixed(2));
if (SaldoCompra < 0) txt.value = SaldoCompra - txt.value;
//minimo entre saldocompra y el saldoanticipo
if (SaldoCompra < saldo) saldo = SaldoCompra;
if (ToDouble(txt.value) > 0) {
chk.checked = true;
} else {
chk.checked = false;
}
if (ToDouble(txt.value) > saldo) {
txt.value = saldo;
alert("El Importe no debe de exceder a el saldo");
}
$("#LblTotalAnticipos").text(FormatoNumero(FnSumaValoresAnt(), 2));
$get('HdnVentaSaldo').value = Total - FnSumaValoresAnt();
}
saldo = (importeTxt > saldo) ? saldo : importeTxt;
function FnSumaValoresAnt() {
debugger;
var totalPoints = 0;
var t = '';
$('input[name*=TxtAnticipo]').each(function () {
totalPoints += ToDouble($(this).val());
});
var SaldoCompra = (Total - FnSumaValoresAnt() + ToDouble(txt.value)).toFixed(2); // le agrego lo del valor actual para validarlo //parseFloat(parseFloat($get('HdnVentaSaldo').value).toFixed(2));
if (SaldoCompra < 0) txt.value = SaldoCompra - txt.value;
//minimo entre saldocompra y el saldoanticipo
if (SaldoCompra < saldo) saldo = SaldoCompra;
if (ToDouble(txt.value) > 0) {
chk.checked = true;
} else {
chk.checked = false;
return Math.round(totalPoints * 100) / 100;
}
if (ToDouble(txt.value) > saldo) {
txt.value = saldo;
alert("El Importe no debe de exceder a el saldo");
}
$("#LblTotalAnticipos").text(FormatoNumero(FnSumaValoresAnt(), 2));
$get('HdnVentaSaldo').value = Total - FnSumaValoresAnt();
}
function FnSumaValoresAnt() {
debugger;
var totalPoints = 0;
var t = '';
$('input[name*=TxtAnticipo]').each(function () {
totalPoints += ToDouble($(this).val());
});
return Math.round(totalPoints * 100) / 100;
}
function LimpiaModal() {
$('#<%= TxtDireccion.ClientID %>').val('');
function LimpiaModal() {
$('#<%= TxtDireccion.ClientID %>').val('');
$('#<%= TxtColonia.ClientID %>').val('');
$('#<%= TxtCiudad.ClientID %>').val('');
$('#<%= TxtEstado.ClientID %>').val('');
@@ -8271,68 +8310,68 @@
function ConvertirDolares(ChkConvertirDolares) {
//LIMPIA
$('#<%= LblDolaresConvertidos.ClientID %>').text('');
$("#TrConversionDolaresTexto").hide();
$("#TrConversionDolaresTexto").hide();
//CALCULA
if (ChkConvertirDolares.checked) {
ConvertirPesosDlls();
}
}
//CALCULA
if (ChkConvertirDolares.checked) {
ConvertirPesosDlls();
}
}
//FUNCIONES PARA MODAL "ModalAplicarNC"
function CalculaImporteNC() {
var ImporteReferencia = (($('#C_DdlNCNivelImporte').val() == "1") ? ToDouble($get('TxtTotal').value) : ToDouble($get('TxtSubTotal').value));
//var ImporteReferencia = ToDouble($get('TxtTotal').value);
//FUNCIONES PARA MODAL "ModalAplicarNC"
function CalculaImporteNC() {
var ImporteReferencia = (($('#C_DdlNCNivelImporte').val() == "1") ? ToDouble($get('TxtTotal').value) : ToDouble($get('TxtSubTotal').value));
//var ImporteReferencia = ToDouble($get('TxtTotal').value);
$get('TxtNCImporte').value = FormatoNumero((ToDouble($get('TxtNCPorcentaje').value) * ImporteReferencia) / 100, 2);
}
$get('TxtNCImporte').value = FormatoNumero((ToDouble($get('TxtNCPorcentaje').value) * ImporteReferencia) / 100, 2);
}
function CalculaPorcentajeNC() {
var ImporteReferencia = (($('#C_DdlNCNivelImporte').val() == "1") ? ToDouble($get('TxtTotal').value) : ToDouble($get('TxtSubTotal').value));
//var ImporteReferencia = ToDouble($get('TxtTotal').value);
$get('TxtNCPorcentaje').value = FormatoNumero((ToDouble($get('TxtNCImporte').value) * 100) / ImporteReferencia, 4);
}
function CalculaPorcentajeNC() {
var ImporteReferencia = (($('#C_DdlNCNivelImporte').val() == "1") ? ToDouble($get('TxtTotal').value) : ToDouble($get('TxtSubTotal').value));
//var ImporteReferencia = ToDouble($get('TxtTotal').value);
$get('TxtNCPorcentaje').value = FormatoNumero((ToDouble($get('TxtNCImporte').value) * 100) / ImporteReferencia, 4);
}
function CambioTipoMoneda(chk, saldo, txt, tipocambio, CveMoneda) {
debugger;
if (tipocambio.value.length > 0) {
function CambioTipoMoneda(chk, saldo, txt, tipocambio, CveMoneda) {
debugger;
if (tipocambio.value.length > 0) {
if (CveMoneda == 1) {
txt.value = FormatoNumero(ToDouble(saldo / tipocambio.value), 2);
} else {
txt.value = FormatoNumero(ToDouble(saldo * tipocambio.value), 2);
if (CveMoneda == 1) {
txt.value = FormatoNumero(ToDouble(saldo / tipocambio.value), 2);
} else {
txt.value = FormatoNumero(ToDouble(saldo * tipocambio.value), 2);
}
}
}
}
}
}
function BuscarOCRegistrada() {
$('#btnBuscarOCRegistrada').click();
}
function BuscarOCRegistrada() {
$('#btnBuscarOCRegistrada').click();
}
function ValidaAnticipoBoton() {
function ValidaAnticipoBoton() {
var Descuentototal = ToDouble($('#LblDescuentos').text()).toFixed(2);
var TotalAnticipos = ToDouble($('#LblTotalAnticipos').text()).toFixed(2);
var Descuentototal = ToDouble($('#LblDescuentos').text()).toFixed(2);
var TotalAnticipos = ToDouble($('#LblTotalAnticipos').text()).toFixed(2);
var IndexActualDdl = parseInt($('#<%= DdlTipoAmortizacionAnticipo.ClientID %>').prop('selectedIndex'));
var IndexActualDdl = parseInt($('#<%= DdlTipoAmortizacionAnticipo.ClientID %>').prop('selectedIndex'));
if (IndexActualDdl == 1 && IndexActualDd2 > 0 && TotalAnticipos > 0) {
if (TotalAnticipos > 0) {
$('#<%= BtnAceptarAnticipos.ClientID %>').prop('disabled', false);
} else {
$('#<%= BtnAceptarAnticipos.ClientID %>').prop('disabled', true);
}
} else {
$('#<%= BtnAceptarAnticipos.ClientID %>').prop('disabled', true);
}
} else {
$('#<%= BtnAceptarAnticipos.ClientID %>').prop('disabled', true);
}
} else {
$('#<%= BtnAceptarAnticipos.ClientID %>').prop('disabled', true);
}
}
}
function showDivEC() {
$('#<%= TxtRFCCliente.ClientID %>').val('');
function showDivEC() {
$('#<%= TxtRFCCliente.ClientID %>').val('');
$('#<%= TxtNombreCliente.ClientID %>').val('');
$('#<%= TxtDireccionCliente.ClientID %>').val('');
$('#<%= TxtNumExtCliente.ClientID %>').val('');

View File

@@ -144,6 +144,22 @@ Partial Class Ventas
ViewState("TmpDTRNCBonificacionesSeleccionadas") = value
End Set
End Property
Private Property TmpDTRNCDetalle As DataTable
Get
Return If(IsNothing(ViewState("TmpDTRNCDetalle")), Nothing, CType(ViewState("TmpDTRNCDetalle"), DataTable))
End Get
Set(value As DataTable)
ViewState("TmpDTRNCDetalle") = value
End Set
End Property
Private Property TmpDTRNCDetalleSelecciondas As DataTable
Get
Return If(IsNothing(ViewState("TmpDTRNCDetalleSelecciondas")), Nothing, CType(ViewState("TmpDTRNCDetalleSelecciondas"), DataTable))
End Get
Set(value As DataTable)
ViewState("TmpDTRNCDetalleSelecciondas") = value
End Set
End Property
Private Property TmpDTError As DataTable
Get
Return If(IsNothing(ViewState("TmpDTError")), Nothing, CType(ViewState("TmpDTError"), DataTable))
@@ -1861,6 +1877,22 @@ Partial Class Ventas
ViewState("SerieVenta") = value
End Set
End Property
Private Property AplicaDocumentoNuevoNC As Boolean
Get
Return CBool(IfNull(ViewState("AplicaDocumentoNuevoNC"), "False", ViewState("AplicaDocumentoNuevoNC")))
End Get
Set(value As Boolean)
ViewState("AplicaDocumentoNuevoNC") = value
End Set
End Property
Private Property AplicaRNCXDetalle As Boolean
Get
Return CBool(IfNull(ViewState("AplicaRNCXDetalle"), "False", ViewState("AplicaRNCXDetalle")))
End Get
Set(value As Boolean)
ViewState("AplicaRNCXDetalle") = value
End Set
End Property
#End Region
@@ -3928,6 +3960,7 @@ Partial Class Ventas
TmpDT = ObjVentas.DtResultados
TmpDT.Columns.Add("EntregaDirecta", GetType(Integer))
TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer))
TmpDT.Columns.Add("CveVentaDetalleRNC", GetType(Integer))
GvPS.DataSource = ObjVentas.DtResultados
GvPS.DataBind()
@@ -5618,7 +5651,7 @@ Partial Class Ventas
Dim ObjClientes As New ClsClientes
If ObjClientes.GetHistorialVentas(CveCliente, 1000, CveClienteSucursal:=-1, TipoDocto:="Ing", CveEstatusFactura:=-1, FechaI:=Now.AddMonths(-1)) Then
DdlVentaUsado.DataSource = ObjClientes.DtResultados
DdlVentaUsado.DataSource = ObjClientes.DtResultados.FiltraParametros("UsadoMarcado = 0")
End If
ObjClientes.Dispose()
@@ -8577,7 +8610,7 @@ Partial Class Ventas
End If
'SI NO ES REFACTURACION
If NuevaFactura <> 1 Then
If NuevaFactura <> 1 AndAlso Not AplicaDocumentoNuevoNC Then
If DtVentasNC Is Nothing Then InicializaDTVentasNC()
Dim Drt = DtVentasNC.NewRow
Drt("CveVenta") = ObjFactura.CveVenta
@@ -10499,6 +10532,15 @@ Partial Class Ventas
Catch ex As Exception
End Try
'SI SE FACTURA UNA RNC SE MUESTRA
If UsuarioActual.CveEmpresa = 140 AndAlso factura.TipoDocto = "Egs" Then
If Row("CveVentaDetalleRNC").ToString().ToEntero() > 0 Then
If Not ObjVentas.AddVentaDetalleRNCFacturada(Row("CveVentaDetalleRNC").ToString().ToEntero(), ObjVentas.CveVentaDetalle, Row("Cantidad").ToString().ToDecimal()) Then
ErrorList.Add("Ocurrió un error al agregar la venta detalle devolución.")
End If
End If
End If
End If
Next
@@ -11591,6 +11633,13 @@ Partial Class Ventas
CveCuenta = ObjFactura.Cliente.CveCuentaMonedaExtranjera
End If
'ACTUALIZA SI LA VENTA FUE MARCADA CON OTRA PARA EL FILTRO DE USADOS
If ObjRNC.Num3 > 0 Then
If Not ObjVentas.UpdateVentaRNCUsado(ObjRNC.CveVenta, ObjRNC.Num3.ToEntero()) Then
ErrorPrepoliza = True
End If
End If
IdCtaContableCliente = IdCtaContable
CveCuentaCliente = CveCuenta
@@ -16510,6 +16559,7 @@ Partial Class Ventas
TmpDT.Columns.Add("EsOutSourcing", GetType(Boolean))
TmpDT.Columns.Add("EsCargo", GetType(Boolean))
TmpDT.Columns.Add("CveVentaDetalleRNC", GetType(Integer))
TmpDT.Columns("EsOutSourcing").DefaultValue = False
TmpDT.Columns("EsCargo").DefaultValue = False
@@ -23572,6 +23622,18 @@ Partial Class Ventas
ObjMovtos.Dispose()
GvCxC.DataBind()
End Sub
Protected Sub ChkMostarProductosRNC_CheckedChanged(sender As Object, e As EventArgs)
If ChkMostarProductosRNC.Checked Then
DivRNCCargos.Visible = False
DivRNCCargosDetalle.Visible = True
CargaRNCDetalle(DdlVentaUsado.SelectedValue.ToEntero())
Else
DivRNCCargos.Visible = True
DivRNCCargosDetalle.Visible = False
CargaRNC(DdlVentaUsado.SelectedValue.ToEntero())
End If
UpModalRemisionesNC.Update()
End Sub
Private Sub CargaRNC(Optional CveVentaUsado As Integer = -1)
Dim DtNC As DataTable = Nothing
@@ -23605,8 +23667,58 @@ Partial Class Ventas
If ObjAcum.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) Then
Dim RowUsadosNC As DataRow = ObjAcum.DtResultados.Rows(2)
DivSMU.Visible = True
HdnSaldoMaximoUsados.Value = RowUsadosNC("Valor").ToString()
LtlSMU.Text = RowUsadosNC("Valor").ToString().ToDecimal().FormatoNumero(2)
HdnSaldoMaximoUsados.Value = RowUsadosNC("ValorConImpuestos").ToString()
LtlSMU.Text = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal().FormatoNumero(2)
Else
DivSMU.Visible = False
HdnSaldoMaximoUsados.Value = "0"
LtlSMU.Text = "0"
End If
ObjAcum.Dispose()
End If
UpModalRemisionesNC.Update()
UpDescNC.Update()
End Sub
Private Sub CargaRNCDetalle(Optional CveVentaUsado As Integer = -1)
Dim DtNC As DataTable = Nothing
Dim ObjMovtos As New ClsMovimientos()
If ObjMovtos.GetRemisionesNCCliente(CveCliente, True, CveMoneda:=-1, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero()) Then
Me.TmpDTRNCDetalle = ObjMovtos.DtResultados.Copy()
End If
ObjMovtos.Dispose()
Me.TmpDTRNCDetalle.Columns.Add(New DataColumn("CveVentaDetalleNCGenerada", GetType(Integer)))
Me.TmpDTRNCDetalleSelecciondas = Nothing
Me.TmpDTRNCDetalleSelecciondas = TmpDTRNCDetalle.Clone()
Me.TmpDTRNCDetalleSelecciondas.Clear()
GvRemisionesNCDetalle.DataSource = TmpDTRNCDetalle.FiltraParametros("TipoRNC = 1")
'GvRemisionesNCBon.DataSource = TmpDTRNCBonificacionesSeleccionadas
'Me.TmpDTRNCBonificacionesCliente = DtNC.FiltraParametros("TipoRNC = 2")
'Me.TmpDTRNCBonificacionesCliente.Columns.Add("ImporteBonificacion", GetType(Decimal))
'Me.TmpDTRNCBonificacionesCliente.Columns.Add("IVABonificacion", GetType(Decimal))
'Me.TmpDTRNCBonificacionesCliente.Columns.Add("CveVentaRNCCargo", GetType(Integer))
GvRemisionesNCDetalle.DataBind()
'GvRemisionesNCBon.DataBind()
If CveVentaUsado > 0 Then
DivSMU.Visible = True
Dim FacUsado As New Modelos.Factura(UsuarioActual, CveVentaUsado, UsuarioActual.CveEmpresa)
Dim SaldoMaximoUsados As Decimal = FacUsado.DtDetalle.SUM("Total", "EsCargo = True").ToDecimal() + FacUsado.DtDetalle.SUM("ImporteIVA", "EsCargo = True").ToDecimal()
HdnSaldoMaximoUsados.Value = SaldoMaximoUsados.ToString()
LtlSMU.Text = String.Format("{0:N2}", SaldoMaximoUsados)
Else
Dim ObjAcum As New ClsAcumuladores
If ObjAcum.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) Then
Dim RowUsadosNC As DataRow = ObjAcum.DtResultados.Rows(2)
DivSMU.Visible = True
HdnSaldoMaximoUsados.Value = RowUsadosNC("ValorConImpuestos").ToString()
LtlSMU.Text = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal().FormatoNumero(2)
Else
DivSMU.Visible = False
HdnSaldoMaximoUsados.Value = "0"
@@ -23816,6 +23928,15 @@ Partial Class Ventas
e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"LimitaSaldoRNCChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);")
End If
End Sub
Protected Sub GvRemisionesNCDetalle_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvRemisionesNCDetalle.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("CveVentaDetalleRNC").ToEntero() = 0 Then
e.Row.CssClass = "Totales"
e.Row.FCCheckBox("ChkAplicar").Visible = False
e.Row.FCTextBox("TxtCantidadRNC").Visible = False
End If
End If
End Sub
Protected Sub DdlNCNivelImporte_SelectedIndexChanged(sender As Object, e As EventArgs)
Dim ImporteReferencia As Double = 0, PorcentajeMaximo As Double = 0
@@ -23844,7 +23965,7 @@ Partial Class Ventas
'SOLO APLICA SI NO HAY DOCUMENTOS QUE SELECCIONAR
If UsuarioActual.CveEmpresa = 140 Then
If GvCxC.Rows.Count = 0 OrElse GvCxC.Rows.Cast(Of GridViewRow)().Count(Function(gvr) gvr.FCCheckBox("ChkCxC").Checked) = 0 Then
Alert("No se ha seleccionado ninguna nota de crédito, en caso de no seleccionar ninguna se creará una nueva nota de crédito. ¿Está seguro de realizar esta acción?", TipoMensaje.MsgConfirmacion, JSBtnAceptar:="BtnAplicaNuevaNC();", TextoConfirmacion:="&nbsp;&nbsp;&nbsp;&nbsp;Si&nbsp;&nbsp;&nbsp;&nbsp;", TextoCancelacion:="&nbsp;&nbsp;&nbsp;&nbsp;No&nbsp;&nbsp;&nbsp;&nbsp;")
Alert("No se ha seleccionado ninguna factura, en caso de no seleccionar ninguna se creará una nueva nota de crédito. ¿Está seguro de realizar esta acción?", TipoMensaje.MsgConfirmacion, JSBtnAceptar:="BtnAplicaNuevaNC();", TextoConfirmacion:="&nbsp;&nbsp;&nbsp;&nbsp;Si&nbsp;&nbsp;&nbsp;&nbsp;", TextoCancelacion:="&nbsp;&nbsp;&nbsp;&nbsp;No&nbsp;&nbsp;&nbsp;&nbsp;")
Else
AplicarNotaCreditoDesdeVenta()
End If
@@ -23900,6 +24021,7 @@ Partial Class Ventas
Private Sub AplicarNC(CvePS As Integer, Optional NCDescuento As Boolean = False, Optional EsNCAmortizacion As Boolean = False, Optional AplicaImpuestosLocales As Boolean = True, Optional AplicaNuevoDocumento As Boolean = False, Optional AplicoNCFacturaActual As Boolean = False)
Try
Me.AplicaDocumentoNuevoNC = AplicaNuevoDocumento
Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
If DrPS Is Nothing Then
Alert("Ocurrió un error al cargar la información del producto. Por favor comuniquese con asistencia SIG", TipoMensaje.MsgError)
@@ -24068,11 +24190,22 @@ Partial Class Ventas
TmpDTDescNC.Clear()
If UsuarioActual.CveEmpresa = 140 Then
If AplicaRNCXDetalle Then
CrearDTNCCargoDetalle(ListaNCDesc, TmpDTDescNC, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
Else
CrearDTNCCargo(ListaNCDesc, TmpDTDescNC, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
End If
CrearDTNCCargo(ListaNCDesc, DtImpuestos, TmpDTDescNC, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
'CONSULTA EL CONCEPTO DE NC
Dim ArrayNC As String() = UsuarioActual.Empresa.Funcionalidad(591).Split(",".ToCharArray())
Dim NCBonificacion As Integer = 0
If ArrayNC.Length > 4 Then
NCBonificacion = ArrayNC(4).ToEntero()
End If
'EN LA NC DE BONIFICACION EL CONCEPTO DEBE SER SIEMPRE 'BONIFICACION POR USADO'
Dim DrPSBonificacion = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=360481).FiltroPrimero("")
Dim DrPSBonificacion = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=NCBonificacion).FiltroPrimero("")
If DrPSBonificacion IsNot Nothing Then
CrearDTNCBonificacion(ListaNCDesc, DtImpuestosBonificacion, TmpDTDescNC, DrPSBonificacion, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
Else
@@ -24109,9 +24242,20 @@ Partial Class Ventas
'DEBE AGREGAR LOS USADOS DE LA REMISION EN LA NOTA DE CREDITO
If UsuarioActual.CveEmpresa = 140 AndAlso (ListaRemisionesNC IsNot Nothing AndAlso ListaRemisionesNC.Count > 0) Then
CrearDTNCCargo(ListaRemisionesNC, DtImpuestos, TmpDT, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
If AplicaRNCXDetalle Then
CrearDTNCCargoDetalle(ListaRemisionesNC, TmpDT, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
Else
CrearDTNCCargo(ListaRemisionesNC, TmpDT, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
End If
'EN LA NC DE BONIFICACION EL CONCEPTO DEBE SER SIEMPRE 'BONIFICACION POR USADO'
Dim DrPSBonificacion = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=360481).FiltroPrimero("")
'CONSULTA EL CONCEPTO DE NC
Dim ArrayNC As String() = UsuarioActual.Empresa.Funcionalidad(591).Split(",".ToCharArray())
Dim NCBonificacion As Integer = 0
If ArrayNC.Length > 4 Then
NCBonificacion = ArrayNC(4).ToEntero()
End If
Dim DrPSBonificacion = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=NCBonificacion).FiltroPrimero("")
If DrPSBonificacion IsNot Nothing Then
CrearDTNCBonificacion(ListaRemisionesNC, DtImpuestosBonificacion, TmpDT, DrPSBonificacion, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
Else
@@ -24172,42 +24316,104 @@ Partial Class Ventas
UPCondicionesPago.Update()
End Sub
Private Sub CrearDTNCCargo(ListaNC As List(Of Modelos.Factura), DtImpuestos As DataTable, ByRef TmpDTCargo As DataTable, DrPS As DataRow, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String)
For Each Dr As DataRow In DtImpuestos.Rows
For Each RNC In ListaNC
Dim UltimoRenglonRNC As Integer = 1
For Each RowUsado As DataRow In RNC.DtDetalle.Rows
Private Sub CrearDTNCCargo(ListaNC As List(Of Modelos.Factura), ByRef TmpDTCargo As DataTable, DrPS As DataRow, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String)
For Each RNC In ListaNC
Dim UltimoRenglonRNC As Integer = 1
Dim TotalAcumuladoRNC As Decimal = 0
Dim PorcentajeUsado = ((RowUsado("Total").ToString().ToDecimal() - RowUsado("Descuento").ToString().ToDecimal() + RowUsado("ImporteIVA").ToString().ToDecimal() + RowUsado("ImporteIEPS").ToString().ToDecimal() - RowUsado("ImporteRetIVA").ToString().ToDecimal() - RowUsado("ImporteRetISR").ToString().ToDecimal()) / RNC.Total) / ListaNC.Count
Dim Obs = RowUsado("CodigoPS").ToString()
For Each RowUsado As DataRow In RNC.DtDetalle.Rows
If Not String.IsNullOrEmpty(TxtNCObservaciones.Text.Trim()) Then
Obs = String.Format("{0} - {1}", Obs, TxtNCObservaciones.Text.Trim())
Dim PorcentajeAplicado = (RNC.TotalRemNCAplicado / RNC.Total)
Dim Cantidad As Decimal = RowUsado("Cantidad").ToString().ToDecimal() * PorcentajeAplicado
Dim Obs = RowUsado("CodigoPS").ToString()
If Not String.IsNullOrEmpty(TxtNCObservaciones.Text.Trim()) Then
Obs = String.Format("{0} - {1}", Obs, TxtNCObservaciones.Text.Trim())
End If
Dim ImportePU = RowUsado("PU").ToString().ToDecimal
Dim TotalCalculableImpuestos As Decimal = (Cantidad * ImportePU)
Dim ImporteIVA = (TotalCalculableImpuestos * RowUsado("PorcentajeIVA").ToString().ToDecimal).RoundSQL(2)
Dim ImporteIEPS = (TotalCalculableImpuestos * RowUsado("PorcentajeIEPS").ToString().ToDecimal).RoundSQL(2)
Dim ImporteRetIVA = (TotalCalculableImpuestos * RowUsado("PorcentajeRetIVA").ToString().ToDecimal).RoundSQL(2)
Dim ImporteRetISR = (TotalCalculableImpuestos * RowUsado("PorcentajeRetISR").ToString().ToDecimal).RoundSQL(2)
Dim ImporteTotal = TotalCalculableImpuestos
TotalAcumuladoRNC += (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR)
'SI ES EL ULTIMO REGLON REALIZA UN AJUSTE
If UltimoRenglonRNC = RNC.DtDetalle.Rows.Count Then
Dim Ajuste As Decimal = 0
If Math.Abs(RNC.TotalRemNCAplicado - TotalAcumuladoRNC) > 0.00 Then
Ajuste = RNC.TotalRemNCAplicado - TotalAcumuladoRNC
ImporteIVA += Ajuste
End If
End If
UltimoRenglonRNC += 1
Dim ImportePU = Dr("ImportePU").ToString().ToDecimal * PorcentajeUsado
Dim ImporteIVA = Dr("ImporteIVA").ToString().ToDecimal * PorcentajeUsado
Dim ImporteRetIVA = Dr("ImporteRetIVA").ToString().ToDecimal * PorcentajeUsado
Dim ImporteRetISR = Dr("ImporteRetISR").ToString().ToDecimal * PorcentajeUsado
Dim ImporteIEPS = Dr("ImporteIEPS").ToString().ToDecimal * PorcentajeUsado
Dim ImporteTotal = Dr("ImporteTotal").ToString().ToDecimal * PorcentajeUsado
'If UltimoRenglonRNC = RNC.DtDetalle.Rows.Count Then
' ImportePU += Ajuste
'End If
AgregaTempDT(TmpDTCargo, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
AgregaTempDT(TmpDTCargo, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
Obs, 1, ImportePU, Dr("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, Dr("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA,
Dr("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, Dr("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0.0, ImporteTotal, "", "", -1, -1,
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1)
UltimoRenglonRNC += 1
Next
Obs, Cantidad, ImportePU, RowUsado("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, RowUsado("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA,
RowUsado("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, RowUsado("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0.0, ImporteTotal, "", "", -1, -1,
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowUsado("CveVentaDetalle").ToString().ToEntero())
Next
Next
End Sub
Private Sub CrearDTNCCargoDetalle(ListaNC As List(Of Modelos.Factura), ByRef TmpDTCargo As DataTable, DrPS As DataRow, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String)
For Each RNC In ListaNC
Dim UltimoRenglonRNC As Integer = 1
Dim TotalAcumuladoRNC As Decimal = 0
For Each RowUsado As DataRow In Me.TmpDTRNCDetalleSelecciondas.FiltraParametros($"CveVenta={RNC.CveVenta}").Rows
Dim Cantidad As Decimal = RowUsado("Cantidad").ToString().ToDecimal()
Dim Obs = RowUsado("CodigoPS").ToString()
If Not String.IsNullOrEmpty(TxtNCObservaciones.Text.Trim()) Then
Obs = String.Format("{0} - {1}", Obs, TxtNCObservaciones.Text.Trim())
End If
Dim ImportePU = RowUsado("PU").ToString().ToDecimal
Dim TotalCalculableImpuestos As Decimal = (Cantidad * ImportePU)
Dim ImporteIVA = (TotalCalculableImpuestos * RowUsado("PorcentajeIVA").ToString().ToDecimal).RoundSQL(2)
Dim ImporteIEPS = 0 '(TotalCalculableImpuestos * RowUsado("PorcentajeIEPS").ToString().ToDecimal).RoundSQL(2)
Dim ImporteRetIVA = 0 ' (TotalCalculableImpuestos * RowUsado("PorcentajeRetIVA").ToString().ToDecimal).RoundSQL(2)
Dim ImporteRetISR = 0 ' (TotalCalculableImpuestos * RowUsado("PorcentajeRetISR").ToString().ToDecimal).RoundSQL(2)
Dim ImporteTotal = TotalCalculableImpuestos
TotalAcumuladoRNC += (TotalCalculableImpuestos + ImporteIVA)
'SI ES EL ULTIMO REGLON REALIZA UN AJUSTE
If UltimoRenglonRNC = RNC.DtDetalle.Rows.Count Then
Dim Ajuste As Decimal = 0
If Math.Abs(RNC.TotalRemNCAplicado - TotalAcumuladoRNC) > 0.00 Then
Ajuste = RNC.TotalRemNCAplicado - TotalAcumuladoRNC
ImporteIVA += Ajuste
End If
End If
UltimoRenglonRNC += 1
AgregaTempDT(TmpDTCargo, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
Obs, Cantidad, ImportePU, RowUsado("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, 0, ImporteRetIVA,
0, ImporteRetISR, 0, ImporteIEPS, -1, 0.0, ImporteTotal, "", "", -1, -1,
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowUsado("CveVentaDetalleRNC").ToString().ToEntero())
Next
Next
End Sub
Private Sub CrearDTNCBonificacion(ListaNC As List(Of Modelos.Factura), DtImpuestosBonificacion As DataTable, ByRef TmpDTNC As DataTable, DrPS As DataRow, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String)
'SI TIENE DE BONIFICACION LOS AGREGA
If DtImpuestosBonificacion IsNot Nothing AndAlso ListaNCBonificacion IsNot Nothing AndAlso ListaNCBonificacion.Count > 0 Then
@@ -24215,39 +24421,54 @@ Partial Class Ventas
TmpDTDescNCBonificacion = TmpDTNC.Clone()
TmpDTDescNCBonificacion.Clear()
For Each Dr As DataRow In DtImpuestosBonificacion.Rows
For Each RNC In ListaNCBonificacion
Dim UltimoRenglonRNC As Integer = 1
For Each RNCBonificacion In ListaNCBonificacion
Dim UltimoRenglonRNC As Integer = 1
Dim TotalAcumuladoRNC As Decimal = 0
Dim RNCCargo = ListaNC.Where(Function(f) f.CveVenta = RNC.CveVentaRNCCargo).FirstOrDefault()
Dim RNCCargo = ListaNC.Where(Function(f) f.CveVenta = RNCBonificacion.CveVentaRNCCargo).FirstOrDefault()
For Each RowCargo As DataRow In RNCCargo.DtDetalle.Rows
For Each RowCargo As DataRow In RNCCargo.DtDetalle.Rows
Dim PorcentajeCargo = ((RowCargo("Total").ToString().ToDecimal() - RowCargo("Descuento").ToString().ToDecimal() + RowCargo("ImporteIVA").ToString().ToDecimal() + RowCargo("ImporteIEPS").ToString().ToDecimal() - RowCargo("ImporteRetIVA").ToString().ToDecimal() - RowCargo("ImporteRetISR").ToString().ToDecimal()) / RNCCargo.Total) / ListaNCBonificacion.Count
Dim PorcentajeAplicado = (RNCBonificacion.TotalRemNCAplicado / RNCBonificacion.Total)
Dim Obs = RowCargo("CodigoPS").ToString()
Dim Cantidad As Decimal = RowCargo("Cantidad").ToString().ToDecimal() * PorcentajeAplicado
If Not String.IsNullOrEmpty(TxtNCObservaciones.Text.Trim()) Then
Obs = String.Format("{0} - {1}", Obs, TxtNCObservaciones.Text.Trim())
Dim Obs = RowCargo("CodigoPS").ToString()
If Not String.IsNullOrEmpty(TxtNCObservaciones.Text.Trim()) Then
Obs = String.Format("{0} - {1}", Obs, TxtNCObservaciones.Text.Trim())
End If
Dim ImportePU = RowCargo("PUBonificacion").ToString().ToDecimal
Dim TotalCalculableImpuestos As Decimal = (Cantidad * ImportePU)
Dim ImporteIVA = (TotalCalculableImpuestos * RowCargo("PorcentajeIVA").ToString().ToDecimal).RoundSQL(2)
Dim ImporteIEPS = (TotalCalculableImpuestos * RowCargo("PorcentajeIEPS").ToString().ToDecimal).RoundSQL(2)
Dim ImporteRetIVA = (TotalCalculableImpuestos * RowCargo("PorcentajeRetIVA").ToString().ToDecimal).RoundSQL(2)
Dim ImporteRetISR = (TotalCalculableImpuestos * RowCargo("PorcentajeRetISR").ToString().ToDecimal).RoundSQL(2)
Dim ImporteTotal = TotalCalculableImpuestos
TotalAcumuladoRNC += (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR)
'SI ES EL ULTIMO REGLON REALIZA UN AJUSTE
If UltimoRenglonRNC = RNCCargo.DtDetalle.Rows.Count Then
Dim Ajuste As Decimal = 0
If Math.Abs(RNCBonificacion.TotalRemNCAplicado - TotalAcumuladoRNC) > 0.00 Then
Ajuste = RNCBonificacion.TotalRemNCAplicado - TotalAcumuladoRNC
ImporteIVA += Ajuste
End If
End If
UltimoRenglonRNC += 1
Dim ImportePU = Dr("ImportePU").ToString().ToDecimal * PorcentajeCargo
Dim ImporteIVA = Dr("ImporteIVA").ToString().ToDecimal * PorcentajeCargo
Dim ImporteRetIVA = Dr("ImporteRetIVA").ToString().ToDecimal * PorcentajeCargo
Dim ImporteRetISR = Dr("ImporteRetISR").ToString().ToDecimal * PorcentajeCargo
Dim ImporteIEPS = Dr("ImporteIEPS").ToString().ToDecimal * PorcentajeCargo
Dim ImporteTotal = Dr("ImporteTotal").ToString().ToDecimal * PorcentajeCargo
AgregaTempDT(TmpDTDescNCBonificacion, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
AgregaTempDT(TmpDTDescNCBonificacion, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
Obs, 1, ImportePU, Dr("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, Dr("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA,
Dr("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, Dr("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0.0, ImporteTotal, "", "", -1, -1,
Obs, Cantidad, ImportePU, RowCargo("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, RowCargo("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA,
RowCargo("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, RowCargo("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0.0, ImporteTotal, "", "", -1, -1,
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1)
UltimoRenglonRNC += 1
Next
Next
Next
End If
End Sub
@@ -24362,7 +24583,7 @@ Partial Class Ventas
PorcentajeRetISR As Double, ImporteRetISR As Double, PorcentajeIEPS As Double, ImporteIEPS As Double, TipoDescuento As Integer, Descuento As Double,
Total As Double, Serie As String, TiempoEntrega As String, CvePresupuestoIngreso As Integer, EntregaDirecta As Integer, SATClaveProdServ As String,
SATClaveUM As String, CveContratoDetalle As Integer, CveVentaDetalle As Integer, CveMovimientoDetallePedido As Integer, CveOrdenCompraDetalle As Integer,
CveVentaDetalleRemision As Integer, CveVentaDetalleCotizacion As Integer, Optional CveTamaño As Integer = -1)
CveVentaDetalleRemision As Integer, CveVentaDetalleCotizacion As Integer, Optional CveTamaño As Integer = -1, Optional CveVentaDetalleRNC As Integer = -1)
Dim Row As DataRow = Nothing
Row = TmpDT.NewRow()
@@ -24422,6 +24643,7 @@ Partial Class Ventas
Row("CveVentaDetalleCotizacion") = CveVentaDetalleCotizacion
Row("CveTamaño") = CveTamaño
Row("CveVentaDetalleRNC") = CveVentaDetalleRNC
TmpDT.Rows.Add(Row)
End Sub
@@ -27237,6 +27459,8 @@ Partial Class Ventas
#Region "D E S C U E N T O S X R E M I S I O N D E N O T A D E C R E D I T O"
Protected Sub BtnAplicarRemisionNC_Click(sender As Object, e As EventArgs)
Me.AplicaRNCXDetalle = False
If ListaRemisionesNC Is Nothing Then
ListaRemisionesNC = New List(Of Modelos.Factura)
Else
@@ -27250,69 +27474,139 @@ Partial Class Ventas
End If
Dim TotalRemNCAplicado As Decimal = 0
For Each GvRow As GridViewRow In GvRemisionesNC.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
If GvRow.FCCheckBox("ChkAplicar").Checked Then
Dim RemNC As New Modelos.Factura(UsuarioActual, GvRow.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa)
RemNC.TotalRemNCAplicado = GvRow.FCTextBox("TxtImporte").Text.ToDecimal()
TotalRemNCAplicado += RemNC.TotalRemNCAplicado
If RemNC.TotalRemNCAplicado <= 0 Then
Alert($"Debe asignar un importe en la siguiente remisión: <b>{RemNC.SerieFolio}</b>", TipoMensaje.MsgAdvertencia)
ListaRemisionesNC.Clear()
Exit Sub
If ChkMostarProductosRNC.Checked Then
Me.AplicaRNCXDetalle = True
For Each GvRow As GridViewRow In GvRemisionesNCDetalle.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
If GvRow.FCCheckBox("ChkAplicar").Checked Then
Dim Rows = TmpDTRNCDetalle.Select($"CveVentaDetalleRNC = {GvRow.DataKey("CveVentaDetalleRNC").ToEntero()}")
For Each row In Rows
row("Cantidad") = GvRow.FCTextBox("TxtCantidadRNC").Text.ToEntero()
TmpDTRNCDetalleSelecciondas.Rows.Add(row.ItemArray)
Next
End If
ListaRemisionesNC.Add(RemNC)
End If
End If
Next
'SI TIENE ALGUN AJUSTE O GARANTIA
If ListaRemisionesNC.Any(Function(RNC) RNC.Num2 = 1) Then
For Each RNC In ListaRemisionesNC.Where(Function(x) x.Num2 = 1)
Dim Salir As Boolean = False
Using ObjAcum As New ClsAcumuladores
If ObjAcum.GetGarantiasDetalle(RNC.CveVenta) Then
'SI ES GARANTIA TOTAL
If ObjAcum.DtResultados.MAX("PorcentajeAjuste") = "1" Then
DdlNCPS.SelectedValueExist(443174)
DdlNCPS.Enabled = False
Salir = True
Else
DdlNCPS.SelectedValueExist(443173)
DdlNCPS.Enabled = False
End If
End If
End Using
If Salir Then
Exit For
End If
Next
For Each Dr As DataRow In TmpDTRNCDetalleSelecciondas.FiltraParametros("", DistinctColumns:={"CveVenta"}).Rows
Dim RemNC As New Modelos.Factura(UsuarioActual, Dr("CveVenta").ToString().ToEntero(), UsuarioActual.CveEmpresa)
Dim TotalRNC As Decimal = 0
For Each GvRow As GridViewRow In GvRemisionesNCDetalle.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
If GvRow.FCCheckBox("ChkAplicar").Checked AndAlso GvRow.DataKey("CveVenta").ToEntero() = Dr("CveVenta").ToString().ToEntero() Then
Dim Cantidad As Decimal = GvRow.FCTextBox("TxtCantidadRNC").Text.ToDecimal()
Dim PU = GvRow.DataKey("PU").ToDecimal()
Dim PorcentajeIVA As Decimal = GvRow.DataKey("PorcentajeIVA").ToDecimal()
Dim TotalCalculableImpuestos As Decimal = (Cantidad * PU)
Dim ImporteIVA As Decimal = (TotalCalculableImpuestos * PorcentajeIVA).RoundSQL(2)
Dim TotalRNCDetalle As Decimal = (TotalCalculableImpuestos + ImporteIVA)
TotalRNC += TotalRNCDetalle
End If
End If
Next
RemNC.TotalRemNCAplicado = TotalRNC
'MARCA LA VENTA QUE FUE USADA PARA EL FILTRO
RemNC.Num3 = DdlVentaUsado.SelectedValue.ToEntero()
TotalRemNCAplicado += RemNC.TotalRemNCAplicado
If RemNC.TotalRemNCAplicado <= 0 Then
Alert($"Debe asignar un importe en la siguiente remisión: <b>{RemNC.SerieFolio}</b>", TipoMensaje.MsgAdvertencia)
ListaRemisionesNC.Clear()
Exit Sub
End If
ListaRemisionesNC.Add(RemNC)
Next
Else
DdlNCPS.Enabled = True
End If
For Each GvRow As GridViewRow In GvRemisionesNC.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
If GvRow.FCCheckBox("ChkAplicar").Checked Then
Dim RemNC As New Modelos.Factura(UsuarioActual, GvRow.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa)
RemNC.TotalRemNCAplicado = GvRow.FCTextBox("TxtImporte").Text.ToDecimal()
'MARCA LA VENTA QUE FUE USADA PARA EL FILTRO
RemNC.Num3 = DdlVentaUsado.SelectedValue.ToEntero()
TotalRemNCAplicado += RemNC.TotalRemNCAplicado
For Each GvRow As GridViewRow In GvRemisionesNCBon.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
If GvRow.FCCheckBox("ChkAplicar").Checked Then
Dim RemNC As New Modelos.Factura(UsuarioActual, GvRow.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa)
RemNC.TotalRemNCAplicado = GvRow.FCTextBox("TxtImporte").Text.ToDecimal()
RemNC.CveVentaRNCCargo = GvRow.DataKey("CveVentaRNCCargo").ToEntero()
TotalRemNCAplicado += RemNC.TotalRemNCAplicado
If RemNC.TotalRemNCAplicado <= 0 Then
Alert($"Debe asignar un importe en la siguiente remisión: <b>{RemNC.SerieFolio}</b>", TipoMensaje.MsgAdvertencia)
ListaRemisionesNC.Clear()
Exit Sub
End If
If RemNC.TotalRemNCAplicado <= 0 Then
Alert($"Debe asignar un importe en la siguiente remisión: <b>{RemNC.SerieFolio}</b>", TipoMensaje.MsgAdvertencia)
ListaNCBonificacion.Clear()
Exit Sub
ListaRemisionesNC.Add(RemNC)
End If
End If
Next
'SI TIENE ALGUN AJUSTE O GARANTIA
If ListaRemisionesNC.Any(Function(RNC) RNC.Num2 = 1) Then
For Each RNC In ListaRemisionesNC.Where(Function(x) x.Num2 = 1)
Dim Salir As Boolean = False
Dim ArrayNC As String() = UsuarioActual.Empresa.Funcionalidad(591).Split(",".ToCharArray())
Dim NCAjuste As Integer = -1
Dim NCGarantiaTotal As Integer = -1
If ArrayNC.Length > 2 Then
NCAjuste = ArrayNC(1).ToEntero()
NCGarantiaTotal = ArrayNC(2).ToEntero()
End If
ListaNCBonificacion.Add(RemNC)
End If
Using ObjAcum As New ClsAcumuladores
If ObjAcum.GetGarantiasDetalle(RNC.CveVenta) Then
'SI ES GARANTIA TOTAL
If ObjAcum.DtResultados.MAX("PorcentajeAjuste") = "1" Then
DdlNCPS.SelectedValueExist(NCGarantiaTotal)
DdlNCPS.Enabled = False
Salir = True
Else
DdlNCPS.SelectedValueExist(NCAjuste)
DdlNCPS.Enabled = False
End If
End If
End Using
If Salir Then
Exit For
End If
Next
Else
DdlNCPS.Enabled = True
End If
Next
For Each GvRow As GridViewRow In GvRemisionesNCBon.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
If GvRow.FCCheckBox("ChkAplicar").Checked Then
Dim RemNC As New Modelos.Factura(UsuarioActual, GvRow.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa)
RemNC.TotalRemNCAplicado = GvRow.FCTextBox("TxtImporte").Text.ToDecimal()
RemNC.CveVentaRNCCargo = GvRow.DataKey("CveVentaRNCCargo").ToEntero()
TotalRemNCAplicado += RemNC.TotalRemNCAplicado
If RemNC.TotalRemNCAplicado <= 0 Then
Alert($"Debe asignar un importe en la siguiente remisión: <b>{RemNC.SerieFolio}</b>", TipoMensaje.MsgAdvertencia)
ListaNCBonificacion.Clear()
Exit Sub
End If
ListaNCBonificacion.Add(RemNC)
End If
End If
Next
End If
TxtImportesRemisionesNC.Text = TotalRemNCAplicado.FormatoNumero
TxtNCImporte.Text = TotalRemNCAplicado.FormatoNumero
@@ -27332,6 +27626,12 @@ Partial Class Ventas
Dim CveSATNC = "84111506"
Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, SATClavePS:=CveSATNC, AplicaParaVenta:=1).Rows(0)
Dim ArrayNC As String() = UsuarioActual.Empresa.Funcionalidad(591).Split(",".ToCharArray())
If ArrayNC.Length > 0 Then
Dim CvePSNC As Integer = ArrayNC(0).ToEntero()
DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSNC, AplicaParaVenta:=1).Rows(0)
End If
If DrPS Is Nothing Then
Alert("Ocurrió un error al cargar la información del Producto. Por favor vuelva a intentar.", TipoMensaje.MsgError)
Exit Sub
@@ -27374,14 +27674,22 @@ Partial Class Ventas
If ListaNCDesc.Any(Function(RNC) RNC.Num2 = 1) Then
For Each RNC In ListaRemisionesNC.Where(Function(x) x.Num2 = 1)
Dim Salir As Boolean = False
Dim NCAjuste As Integer = -1
Dim NCGarantiaTotal As Integer = -1
If ArrayNC.Length > 2 Then
NCAjuste = ArrayNC(1).ToEntero()
NCGarantiaTotal = ArrayNC(2).ToEntero()
End If
Using ObjAcum As New ClsAcumuladores
If ObjAcum.GetGarantiasDetalle(RNC.CveVenta) Then
'SI ES GARANTIA TOTAL
If ObjAcum.DtResultados.MAX("PorcentajeAjuste") = "1" Then
DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=443174, AplicaParaVenta:=1).Rows(0)
DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=NCGarantiaTotal, AplicaParaVenta:=1).Rows(0)
Salir = True
Else
DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=443173, AplicaParaVenta:=1).Rows(0)
DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=NCAjuste, AplicaParaVenta:=1).Rows(0)
End If
End If
End Using
@@ -27501,7 +27809,7 @@ Partial Class Ventas
#End Region
Protected Sub BtnModalAplicarRemisionesNC_Click(sender As Object, e As EventArgs)
CargaRNC()
ChkMostarProductosRNC_CheckedChanged(ChkMostarProductosRNC, EventArgs.Empty)
RegistraScript("$('#ModalAplicarRemisionesNC').modal({backdrop: 'static', keyboard: false });")
End Sub
@@ -28098,4 +28406,5 @@ Partial Class Ventas
Public ImporteBonificacion As Decimal = 0
Public IVABonificacion As Decimal = 0
End Class
End Class