merge con el local

This commit is contained in:
Antonio Gonzalez
2019-12-11 11:26:14 -07:00
22 changed files with 550 additions and 369 deletions

View File

@@ -1,19 +0,0 @@
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="EntradasUsados.aspx.vb" Inherits="Acumuladores_EntradasUsados" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" Runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="E" Runat="Server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="HB" Runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" Runat="Server">
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="HA" Runat="Server">
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="C" Runat="Server">
</asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" Runat="Server">
</asp:Content>

View File

@@ -1,5 +0,0 @@

Partial Class Acumuladores_EntradasUsados
Inherits System.Web.UI.Page
End Class

View File

@@ -0,0 +1,65 @@
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepEntradasUsadosClientes.aspx.vb" Inherits="Acumuladores_RepEntradasUsadosClientes" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" Runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="E" Runat="Server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="HB" Runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" Runat="Server">
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="HA" Runat="Server">
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="C" Runat="Server">
<asp:UpdatePanel ID="UPFiltros" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="portlet solid grey-cascade portlet-filter">
<div class="portlet-title portlet-filterT smalltitle">
<div class="tools">
<asp:Button ID="BtnConsultar" runat="server" Text="Consultar" class="btn btn-primary" />
<a href="javascript;" data-idchekbox="<%= chkexpand.ClientID%>" class=" <%= IIf(chkexpand.Checked = True, "collapse", "expand")%>"></a>
<asp:CheckBox ID="chkexpand" CssClass="hidden" runat="server" />
</div>
<div class="titlefiltros caption">
<div class="col-md-1 truncate v-center" style="text-align: right!important">Almacen:</div>
<div class="col-md-2 v-center">
<asp:ListBox ID="DdlAlmacen" CssClass="form-control input-sm select2me" DataTextField="Almacen" DataValueField="CveAlmacen" Style="width: 100%;" runat="server"></asp:ListBox>
</div>
<div class="row v-center">
<div class="col-md-1 truncate" style="text-align: right!important">Fecha Inicio:</div>
<div class="col-md-1 v-center">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 95px !important; padding: 0px;">
<asp:TextBox Style="width: 80px !important;" ID="TxtFechaI" runat="server" CssClass="form-control" MaxLength="10"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="ImgFechaI" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
</div>
<ajax:MaskedEditExtender ID="MEEFechaI" runat="server" TargetControlID="TxtFechaI" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CEFechaI" TargetControlID="TxtFechaI" PopupButtonID="ImgFechaI" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
</div>
<div class="col-md-1 truncate" style="text-align: right!important">Fecha Fin:</div>
<div class="col-md-1 v-center">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 95px !important; padding: 0px;">
<asp:TextBox Style="width: 80px !important;" ID="TxtFechaF" runat="server" CssClass="form-control" MaxLength="10"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="ImgFechaF" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
</div>
<ajax:MaskedEditExtender ID="MEEFechaF" runat="server" TargetControlID="TxtFechaF" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CalendarExtender1" TargetControlID="TxtFechaF" PopupButtonID="ImgFechaF" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
</div>
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:GridView runat="server" id="GvDatos"></asp:GridView>
</asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" Runat="Server">
</asp:Content>

View File

@@ -0,0 +1,48 @@
Imports Extensiones
Imports System
Partial Class Acumuladores_RepEntradasUsadosClientes
Inherits ClsPaginas
Private Sub Acumuladores_EntradasUsados_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
CargaCombos()
End If
End Sub
Private Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click
CargaDatos()
End Sub
Public Sub CargaCombos()
DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
DdlAlmacen.DataBind()
DdlAlmacen.Items.Insert(0, New ListItem("Todos", "-1"))
TxtFechaI.text = now.Firstdayofmonth
txtfechaf.text = now.toshortdatestring
End Sub
Private Sub CargaDatos()
Dim FechaI, FechaF As Date
FechaI = If(IsDate(TxtFechaI.Text.Trim()), TxtFechaI.Text.Trim.todate, minfecha)
FechaF = If(IsDate(TxtFechaF.Text.Trim()), TxtFechaF.Text.Trim.todate, maxfecha)
Dim CveAlmacen As Integer = If(DdlAlmacen.SelectedValue = "", "-1", DdlAlmacen.SelectedValue).ToString.toentero
Dim Acum As New ClsAcumuladores
If Acum.EntradasUsadosClientesRep(CveAlmacen, FechaI, FechaF, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
GvDatos.datasource = Acum.DtResultados
End If
Acum.Dispose()
GvDatos.databind
End Sub
End Class

View File

@@ -866,11 +866,11 @@ Public Class ClsAcumuladores
Return Retorno Return Retorno
End Function End Function
Public Function EntradasUsadosGet(CveAlmacen As Integer, FechaI As Date, FechaF As Date, CveUsuario As Integer, CveEmpresa As Integer) As Boolean Public Function EntradasUsadosClientesRep(CveAlmacen As Integer, FechaI As Date, FechaF As Date, CveUsuario As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
'Data = New DataTable 'Data = New DataTable
SqlDataAdapter("PA_Acum_EntradasUsadosGet") SqlDataAdapter("PA_Acum_EntradasUsadosClientesGet")
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters
.Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen

View File

@@ -1778,7 +1778,11 @@ Public Class ClsInventarios
Retorno = SqlAdapter.SelectCommand.Parameters("@Existencia").Value.ToString.ToDecimal() Retorno = SqlAdapter.SelectCommand.Parameters("@Existencia").Value.ToString.ToDecimal()
Me.CvePS = SqlAdapter.SelectCommand.Parameters("@CvePSRetorno").Value.ToString.ToEntero Me.CvePS = SqlAdapter.SelectCommand.Parameters("@CvePSRetorno").Value.ToString.ToEntero
Catch Ex1 As SqlException Catch Ex1 As SqlException
Me.OnError("Ocurrió un error al obtener las existencias del producto.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) If Ex1.Message.Contains("deadlocked") Then
Me.OnError("Ocurrió un error al obtener las existencias del producto. Puede intentarlo de nuevo", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
Else
Me.OnError("Ocurrió un error al obtener las existencias del producto.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End If
Catch ex As Exception Catch ex As Exception
OnError("Ocurrió un error al obtener las existencias del producto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) OnError("Ocurrió un error al obtener las existencias del producto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try End Try
@@ -3290,8 +3294,27 @@ Public Class ClsInventarios
End Function End Function
#End Region #End Region
Public Function GetMovimientoMetodoNulo(CveMovimiento As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Inv_MovimientoMetodoNulo")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveMovimiento", SqlDbType.Int).Value = CveMovimiento
.Add("@Valido", SqlDbType.Int).Direction = ParameterDirection.Output
End With
Try
SqlAdapter.Fill(Data)
Retorno = If(SqlAdapter.SelectCommand.Parameters("@Valido").Value.ToString.ToEntero = 1, True, False)
Catch ex As Exception
OnError("Ocurrió un error al obtener El Costo del Producto/Servicio.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
#Region " INVENTARIOS - COSTO PS " #Region " INVENTARIOS - COSTO PS "
Public Function GetCostoPS(CvePS As Integer, Cantidad As Double, CveAlmacen As Integer, SerieLote As String, FechaFin As Date, Optional CveSubProyecto As Integer = -1, Optional CveTipoAlmacen As Integer = 1) As Decimal Public Function GetCostoPS(CvePS As Integer, Cantidad As Double, CveAlmacen As Integer, SerieLote As String, FechaFin As Datetime, Optional CveSubProyecto As Integer = -1, Optional CveTipoAlmacen As Integer = 1) As Decimal
Dim Retorno As Decimal = -1D Dim Retorno As Decimal = -1D
DataAdapter("PA_Inv_PSCostoGet") DataAdapter("PA_Inv_PSCostoGet")
@@ -3300,7 +3323,7 @@ Public Class ClsInventarios
.Add("@Cantidad", SqlDbType.Float).Value = Cantidad .Add("@Cantidad", SqlDbType.Float).Value = Cantidad
.Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen
.Add("@SerieLote", SqlDbType.VarChar).Value = SerieLote .Add("@SerieLote", SqlDbType.VarChar).Value = SerieLote
.Add("@FechaFin", SqlDbType.Date).Value = FechaFin .Add("@FechaFin", SqlDbType.DateTime).Value = FechaFin
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto
.Add("@CveTipoAlmacen", SqlDbType.Int).Value = CveTipoAlmacen .Add("@CveTipoAlmacen", SqlDbType.Int).Value = CveTipoAlmacen
.Add("@Costo", SqlDbType.Money).Direction = ParameterDirection.Output .Add("@Costo", SqlDbType.Money).Direction = ParameterDirection.Output

View File

@@ -1696,6 +1696,41 @@ Public Class ClsProductosServicios
Return Retorno Return Retorno
End Function End Function
Public Function UpdatePSPrecios(Importe As Decimal, CvePrecioLista As Integer, Porcentaje As Decimal, CvePS As Integer, CveUsuario As Integer, Fecha As DateTime, Fijo As Boolean, Optional PrecioMinimo As Decimal = Nothing) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_PSPrecioUpdate")
With SqlAdapter.SelectCommand.Parameters
If Importe = -1 Then
.Add("@Importe", SqlDbType.Float).Value = DBNull.Value
Else
.Add("@Importe", SqlDbType.Float).Value = Importe
End If
If Porcentaje = -1 Then
.Add("@Porcentaje", SqlDbType.Money).Value = DBNull.Value
Else
.Add("@Porcentaje", SqlDbType.Money).Value = Porcentaje
End If
.Add("@PrecioMinimo", SqlDbType.Decimal).Value = PrecioMinimo
.Add("@CvePS", SqlDbType.Int).Value = CvePS
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
.Add("@Fecha", SqlDbType.DateTime).Value = Fecha
.Add("@Fijo", SqlDbType.Bit).Value = Fijo
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al actualizar los precios de lista.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return Retorno
End Function
Public Function GetPSPrecioLista(CvePS As Integer, CveEmpresa As Integer, Optional CvePrecioLista As Integer = -1) As Boolean Public Function GetPSPrecioLista(CvePS As Integer, CveEmpresa As Integer, Optional CvePrecioLista As Integer = -1) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False

View File

@@ -3858,6 +3858,13 @@ Namespace Modelos
Return Retorno Return Retorno
End If End If
If ObjFactura.TipoDocto = "Ant" AndAlso ObjFactura.SaldoAmortizado > 0 Then
Retorno.Mensaje = "La factura no se puede cancelar debido a que esta amortizada."
Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia
Return Retorno
End If
'SI LA REMISION ESTA FACTURADA NO SE PUEDE CANCELAR 'SI LA REMISION ESTA FACTURADA NO SE PUEDE CANCELAR
If ObjFactura.TipoDocto = "Rem" Then If ObjFactura.TipoDocto = "Rem" Then
Dim ObjV As New ClsVentas Dim ObjV As New ClsVentas
@@ -4283,11 +4290,6 @@ Namespace Modelos
End If End If
End If End If
'REALIZA LA DEVOLUCION AL ALMACEN VIRTUAL
If Not GeneraMovimientosVirtuales(CveVenta, ObjInventario) Then
ErrorCancelar = True
MensajeError = "Ocurrió un error al cargar los datos de devolución. Por favor vuelva a intentar."
End If
Else Else
'UTILIZA LA DEVOLUCION YA REALIZADA 'UTILIZA LA DEVOLUCION YA REALIZADA
If ObjInventario.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then If ObjInventario.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then
@@ -4298,6 +4300,12 @@ Namespace Modelos
End If End If
End If End If
'REALIZA LA DEVOLUCION AL ALMACEN VIRTUAL
If Not GeneraMovimientosVirtuales(CveVenta, ObjInventario) Then
ErrorCancelar = True
MensajeError = "Ocurrió un error al cargar los datos de devolución. Por favor vuelva a intentar."
End If
'DEVOLUCION REMISION - REGRESA LAS EXISTENCIAS A ENTREGA POR ADELANTADO SI LA FACTURA VIENE DE REMISION 'DEVOLUCION REMISION - REGRESA LAS EXISTENCIAS A ENTREGA POR ADELANTADO SI LA FACTURA VIENE DE REMISION
If Not ErrorCancelar AndAlso RevivirRemisiones Then If Not ErrorCancelar AndAlso RevivirRemisiones Then
If Not GeneraMovimientosEntregaPorAdelantadoRemision(CveMovimiento, ObjVentas, ObjInventario, DtDevRem, ListaRemisionesCancelar) Then If Not GeneraMovimientosEntregaPorAdelantadoRemision(CveMovimiento, ObjVentas, ObjInventario, DtDevRem, ListaRemisionesCancelar) Then
@@ -5057,6 +5065,8 @@ Namespace Modelos
Public Property SaldoVentaDevolucion As Decimal Public Property SaldoVentaDevolucion As Decimal
Public Property Saldo As Decimal Public Property Saldo As Decimal
Public Property SaldoAlmacen As Decimal Public Property SaldoAlmacen As Decimal
Public Property SaldoAnticipo As Decimal
Public Property SaldoAmortizado As Decimal
Public Property CvePAC As Integer Public Property CvePAC As Integer
Public Property CveAnticipo As Integer Public Property CveAnticipo As Integer
Public Property RemisionesLista As List(Of Integer) Public Property RemisionesLista As List(Of Integer)

View File

@@ -367,9 +367,9 @@ Namespace Extensiones
End Sub End Sub
<Runtime.CompilerServices.Extension()> <Runtime.CompilerServices.Extension()>
Public Sub OnError(Obj As Object, Mensaje As String, Exeption As Exception, Optional InfoAdicional As String = "") Public Sub OnError(Obj As Object, Mensaje As String, Exeption As Exception, Optional InfoAdicional As String = "", Optional TipoMensaje As TipoMensaje = TipoMensaje.MsgError)
GuardaLog(String.Format("{0} DESCRIPCIÓN DETALLADA: {1} {2} {3}", Mensaje, Exeption.ToString, vbCrLf, InfoAdicional)) GuardaLog(String.Format("{0} DESCRIPCIÓN DETALLADA: {1} {2} {3}", Mensaje, Exeption.ToString, vbCrLf, InfoAdicional))
Alert(Obj, Mensaje, TipoMensaje.MsgError) Alert(Obj, Mensaje, TipoMensaje)
If WebConfigurationManager.AppSettings("SiteName") IsNot Nothing AndAlso WebConfigurationManager.AppSettings("SiteName").ToString = "1" Then MandaCorreoError(String.Format("{0} DESCRIPCIÓN DETALLADA: {1} {2} {3}", Mensaje, Exeption.ToString, vbCrLf, InfoAdicional)) If WebConfigurationManager.AppSettings("SiteName") IsNot Nothing AndAlso WebConfigurationManager.AppSettings("SiteName").ToString = "1" Then MandaCorreoError(String.Format("{0} DESCRIPCIÓN DETALLADA: {1} {2} {3}", Mensaje, Exeption.ToString, vbCrLf, InfoAdicional))
End Sub End Sub

View File

@@ -157,6 +157,20 @@
<asp:Literal ID="LtlTotalVentas" runat="server" Text='<%# Eval("VentasCorte", "{0:N2}") %>'></asp:Literal> <asp:Literal ID="LtlTotalVentas" runat="server" Text='<%# Eval("VentasCorte", "{0:N2}") %>'></asp:Literal>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Right">
<HeaderTemplate>
<asp:Label Text="N.C." runat="server" CausesValidation="false"> </asp:Label>
<asp:Literal runat="server" Text=" <i class='fa fa-sort' style='color:#999' ></i>"></asp:Literal>
</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="LtlNotasCredito" runat="server" Text='<%# Eval("NotasCredito", "{0:N2}") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Right"> <asp:TemplateField ItemStyle-HorizontalAlign="Right">
<HeaderTemplate> <HeaderTemplate>
<asp:Label Text="Ventas Credito" runat="server" CausesValidation="false"> </asp:Label> <asp:Label Text="Ventas Credito" runat="server" CausesValidation="false"> </asp:Label>

View File

@@ -291,7 +291,7 @@
<asp:HiddenField runat="server" ID="HdnFechasComprasVinculadas" Value="-1" ClientIDMode="Static" /> <asp:HiddenField runat="server" ID="HdnFechasComprasVinculadas" Value="-1" ClientIDMode="Static" />
<asp:GridView ID="GvCxP" GridLines="None" CssClass="table table-hover table-advance Widthall" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontraron Cuentas por Pagar pendientes" DataKeyNames="CveCompra,FechaCompra,Proveedor,SerieFolio,Original,SubTotal,IVA,RetIVA,RetISR,IdCtaContProveedores,IdCtaContProveedoresSIG,CvePrePoliza,IdPoliza,CveRetIVAConcepto,CveRetISRConcepto,IVAPorcentaje,NoDeducible,IVADeducible,IVANoDeducible"> <asp:GridView ID="GvCxP" GridLines="None" CssClass="table table-hover table-advance Widthall" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontraron Cuentas por Pagar pendientes" DataKeyNames="CveCompra,FechaCompra,Proveedor,SerieFolio,Original,SubTotal,IVA,RetIVA,RetISR,IdCtaContProveedores,IdCtaContProveedoresSIG,CvePrePoliza,IdPoliza,CveRetIVAConcepto,CveRetISRConcepto,IVAPorcentaje,IVADeducible,IVANoDeducible">
<Columns> <Columns>
<asp:TemplateField> <asp:TemplateField>
<HeaderTemplate> <HeaderTemplate>

View File

@@ -105,7 +105,7 @@ Partial Class Contabilidad_PlantillasPolizasDetalle
Me.GvDatos.DataSource = Nothing Me.GvDatos.DataSource = Nothing
End If End If
OrdenaDatos() ' OrdenaDatos()
End Sub End Sub
Public Sub CargaDatosPoliza(CvePlantillaPoliza As Integer) Public Sub CargaDatosPoliza(CvePlantillaPoliza As Integer)
Dim ObjPlantillaPolizas As New ClsContabilidad Dim ObjPlantillaPolizas As New ClsContabilidad

View File

@@ -83,23 +83,22 @@ Partial Class Inicio
CargaSubProyectos() CargaSubProyectos()
End If End If
If UsuarioActual.TienePermisoProceso(271) Then MuestraVentasPUE()
If UsuarioActual.TienePermisoProceso(270) Then MuestraComprasPUE()
Dim EsDEV = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString.Contains("Desarrollo2017")
If Not EsDEV Then
If UsuarioActual.CveUsuario.Contiene(93, 1425, 2, 1606, 1472, 100) Then MuestraInconsistencias() '100
End If
'Ventas no timbradas por centro de costo 'Ventas no timbradas por centro de costo
If UsuarioActual.TienePermisoProceso(208) Then MuestraNoTimbradasCentroCosto() If UsuarioActual.TienePermisoProceso(208) Then MuestraNoTimbradasCentroCosto()
'Reporte facaturas pendientes por autorizar Oscar 2016-07-06 'Reporte facaturas pendientes por autorizar Oscar 2016-07-06
If UsuarioActual.TienePermisoProceso(158) Then If UsuarioActual.TienePermisoProceso(158) Then
RegistraScript("$( document ).ready(function() { AbrirVentana('/Compras/PopUpFacturasPendientesAutorizar.aspx');});", "repFacturas") RegistraScript("$( document ).ready(function() { AbrirVentana('/Compras/PopUpFacturasPendientesAutorizar.aspx');});", "repFacturas")
End If End If
If UsuarioActual.TienePermisoProceso(271) Then MuestraVentasPUE()
If UsuarioActual.TienePermisoProceso(270) Then MuestraComprasPUE()
Dim EsDEV = Not UsuarioActual.Empresa.FacturaProduccion
If Not EsDEV Then
If UsuarioActual.CveUsuario.Contiene(93, 1425, 2, 1606, 1472, 100) Then MuestraInconsistencias() '100
End If
'MUESTRA CALENDARIO SOLO ROL ADMINISTRADOR-AD 'MUESTRA CALENDARIO SOLO ROL ADMINISTRADOR-AD
InicializaCalendar() InicializaCalendar()

View File

@@ -301,10 +301,11 @@ Partial Class Inventarios_PaquetesArmadoDesarmado
Dim CveUMTemp = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPaqueteDesarmado.SelectedValue.ToEntero).FiltroPrimeroValor("CveUM").ToEntero Dim CveUMTemp = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPaqueteDesarmado.SelectedValue.ToEntero).FiltroPrimeroValor("CveUM").ToEntero
CveVendedor = If(RowApartadosDesarmado.Visible, DdlVendedorDesarmado.SelectedValue.ToEntero, -1) CveVendedor = If(RowApartadosDesarmado.Visible, DdlVendedorDesarmado.SelectedValue.ToEntero, -1)
CveCliente = If(RowClienteDesarmado.Visible, DdlClienteDesarmado.SelectedValue.ToEntero, -1) CveCliente = If(RowClienteDesarmado.Visible, DdlClienteDesarmado.SelectedValue.ToEntero, -1)
Dim FechaFin As String = TxtFechaDesarmado.Text.ToDateTime.ToString("yyyy/MM/dd 23:59")
Dim ObjInventarios As New ClsInventarios Dim ObjInventarios As New ClsInventarios
Dim Existencia = ObjInventarios.GetExistenciasPS(DdlPaqueteDesarmado.SelectedValue.ToEntero, CveUMTemp, UsuarioActual.CveEmpresa, DdlAlmacenDesarmado.SelectedValue.ToEntero, FechaMovto:=TxtFechaDesarmado.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente)) Dim Existencia = ObjInventarios.GetExistenciasPS(DdlPaqueteDesarmado.SelectedValue.ToEntero, CveUMTemp, UsuarioActual.CveEmpresa, DdlAlmacenDesarmado.SelectedValue.ToEntero, FechaMovto:=FechaFin, CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente))
Dim CostoPromedio = ObjInventarios.GetCostoPS(DdlPaqueteDesarmado.SelectedValue.ToEntero, TxtCantidadDesarmado.Text.ToDouble, DdlAlmacenDesarmado.SelectedValue.ToEntero, "-1", TxtFechaDesarmado.Text.ToDate) Dim CostoPromedio = ObjInventarios.GetCostoPS(DdlPaqueteDesarmado.SelectedValue.ToEntero, TxtCantidadDesarmado.Text.ToDouble, DdlAlmacenDesarmado.SelectedValue.ToEntero, "-1", FechaFin.ToDate, CveTipoAlmacen:=-1)
ObjInventarios.Dispose() ObjInventarios.Dispose()
If Existencia - TxtCantidadDesarmado.Text.ToDouble < 0 Then If Existencia - TxtCantidadDesarmado.Text.ToDouble < 0 Then

View File

@@ -2261,10 +2261,38 @@ Partial Class Inventarios_RecepcionEntrega
End If End If
End If End If
'QUEMAR REMISIONES
If Not ErrorMovInv And EsDevolucionVenta = 1 And TipoDocto = "Ing" Then
Dim DtDevRem As New DataTable
'CARGA REMISIONES DE LA VENTA DEVUELTA
If ObjInventario.GetDevolucionRemisionesFacturadas(CveVentaSurtir) Then
DtDevRem = ObjInventario.DtResultados.FiltraParametros("CantidadAlmacen = 0")
Else
ErrorMovInv = True
End If
If Not ErrorMovInv Then
If DtDevRem.Rows.Count > 0 Then
For Each DrMovtos As DataRow In DtDevRem.FiltraParametros("", "CveRem", {"CveRem"}).Rows
If Not ObjInventario.ActualizarEsDevolucionVenta(DrMovtos("CveRem").ToString.ToEntero, 2) Then
TextoError = "Ocurrió un error al hacer la devolución hacia la remision. Por favor vuelva a intentar."
ErrorMovInv = True
Exit For
End If
Next
End If
Else
TextoError = "Ocurrió un error al hacer la devolucion a remisión. Por favor vuelva a intentar."
ErrorMovInv = True
End If
End If
'QUEMA DEVOLUCION | QUEMA = LA QUITA DE PENDIENTE POR RECIBIR (DEVOLVER) 'QUEMA DEVOLUCION | QUEMA = LA QUITA DE PENDIENTE POR RECIBIR (DEVOLVER)
If Not ErrorMovInv And EsDevolucionVenta = 1 Then If Not ErrorMovInv And EsDevolucionVenta = 1 Then
If Not ObjVentas.UpdateVentasDevolucionAlmacen(2, CveVentaSurtir) Then If Not ObjVentas.UpdateVentasDevolucionAlmacen(2, CveVentaSurtir) Then
TextoError = "Ocurrió un error al hacer la devolucion. Por favor vuelva a intentar." TextoError = "Ocurrió un error al hacer la devolución. Por favor vuelva a intentar."
ErrorMovInv = True ErrorMovInv = True
End If End If
End If End If

View File

@@ -105,7 +105,7 @@
<label class="col-md-1 truncate" style="width: 110px">Movimiento:</label> <label class="col-md-1 truncate" style="width: 110px">Movimiento:</label>
<div class="col-md-2"> <div class="col-md-2">
<asp:RadioButtonList runat="server" ID="RBLOpcion" RepeatDirection="Horizontal" AutoPostBack="true" Font-Size="18pt"> <asp:RadioButtonList runat="server" ID="RBLOpcion" RepeatDirection="Horizontal" AutoPostBack="true" Font-Size="18pt">
<asp:ListItem Selected="True" Value="2">Entrada</asp:ListItem> <asp:ListItem Selected="True" Value="42">Entrada</asp:ListItem>
<asp:ListItem Value="3">Salida</asp:ListItem> <asp:ListItem Value="3">Salida</asp:ListItem>
</asp:RadioButtonList> </asp:RadioButtonList>
</div> </div>

View File

@@ -1066,10 +1066,10 @@ Partial Class Inventarios_RecepcionUsados
For Each Dr As DataRow In DtMovimientos.Rows For Each Dr As DataRow In DtMovimientos.Rows
If CveConcepto = 2 AndAlso DdlMoneda.SelectedValue.ToEntero = 2 Then If CveConcepto = 42 AndAlso DdlMoneda.SelectedValue.ToEntero = 2 Then
ImporteConcepto = Dr("PU").ToString.ToDouble * GlobalTipoCambio(TxtFecha.Text.ToDate) ImporteConcepto = Dr("PU").ToString.ToDouble * GlobalTipoCambio(TxtFecha.Text.ToDate)
Else Else
ImporteConcepto = Dr("PU").ToString.ToDouble ImporteConcepto = Dr("PU").ToString.ToDouble
End If End If
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, ImporteConcepto, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, Dr("Observaciones").ToString, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, ImporteConcepto, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, Dr("Observaciones").ToString, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
@@ -1083,10 +1083,10 @@ Partial Class Inventarios_RecepcionUsados
ErrorMovInv = True ErrorMovInv = True
Exit For Exit For
End If End If
'si es selectedvalue = 2, es entrada ,3 -salida 'si es selectedvalue = 42, es entrada ,3 -salida
Dim CveConceptoUsados As Integer = If(RBLOpcion.SelectedValue.ToEntero = 2, 1, 2) Dim CveConceptoUsados As Integer = If(RBLOpcion.SelectedValue.ToEntero = 42, 1, 2)
If RBLOpcion.SelectedValue.ToEntero = 2 AndAlso EsDistribuidor Then If RBLOpcion.SelectedValue.ToEntero = 42 AndAlso EsDistribuidor Then
If Not ObjAcum.DistribuidorMovtosAdd(DdlClientes.SelectedValue.ToEntero, Dr("Cantidad").ToString.ToEntero(), Dr("CveTamaño").ToString.ToEntero, CveConceptoUsados, CveVenta, UsuarioActual.CveUsuario, If Not ObjAcum.DistribuidorMovtosAdd(DdlClientes.SelectedValue.ToEntero, Dr("Cantidad").ToString.ToEntero(), Dr("CveTamaño").ToString.ToEntero, CveConceptoUsados, CveVenta, UsuarioActual.CveUsuario,
UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, CveMovimiento:=CveMovimiento) Then UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, CveMovimiento:=CveMovimiento) Then

View File

@@ -64,6 +64,8 @@ Partial Class RH_CatPersonalRequerido
CargaProyectos() CargaProyectos()
CargaTurno() CargaTurno()
CargaDepartamento()
ReqProyectoDdl.SelectedValueExist(-1) ReqProyectoDdl.SelectedValueExist(-1)
ReqSubProyectoDdl.SelectedValueExist(-1) ReqSubProyectoDdl.SelectedValueExist(-1)
ReqTurnoDdl.SelectedValueExist(-1) ReqTurnoDdl.SelectedValueExist(-1)

View File

@@ -34,7 +34,7 @@
<div class="row v-center"> <div class="row v-center">
<label class="col-md-1 v-center truncate">Precio de Lista:</label> <label class="col-md-1 v-center truncate">Precio de Lista:</label>
<div class="col-md-1 v-center"> <div class="col-md-1 v-center">
<asp:DropDownList ID="DdlPrecioLista" runat="server" Width="100%" CssClass="select2me" DataValueField="CvePrecioLista" DataTextField="PrecioLista"></asp:DropDownList> <asp:DropDownList ID="DdlPrecioLista" runat="server" AppendDataBoundItems="true" Width="100%" CssClass="select2me" DataValueField="CvePrecioLista" DataTextField="PrecioLista"></asp:DropDownList>
</div> </div>
<label class="col-md-1 v-center truncate">Clasificación:</label> <label class="col-md-1 v-center truncate">Clasificación:</label>
<div class="col-md-1 v-center"> <div class="col-md-1 v-center">
@@ -303,7 +303,7 @@
<div class="col-md-6 v-center"> <div class="col-md-6 v-center">
<label class="col-md-6 v-center truncate">Precio de Lista:</label> <label class="col-md-6 v-center truncate">Precio de Lista:</label>
<div class="col-md-6 v-center"> <div class="col-md-6 v-center">
<asp:DropDownList ID="DdlPrecioListaCarga" runat="server" Width="100%" CssClass="select2me" DataValueField="CvePrecioLista" DataTextField="PrecioLista"></asp:DropDownList> <asp:DropDownList ID="DdlPrecioListaCarga" runat="server" AppendDataBoundItems="true" Width="100%" CssClass="select2me" DataValueField="CvePrecioLista" DataTextField="PrecioLista"></asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVPrecioListaCarga" runat="server" ControlToValidate="DdlPrecioListaCarga" InitialValue="-1" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio Lista''</b> es necesario, por favor selecionarlo." ValidationGroup="GrpCargarExcel"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator ID="RFVPrecioListaCarga" runat="server" ControlToValidate="DdlPrecioListaCarga" InitialValue="-1" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio Lista''</b> es necesario, por favor selecionarlo." ValidationGroup="GrpCargarExcel"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEPrecioListaCarga" runat="server" HighlightCssClass="vco" TargetControlID="RFVPrecioListaCarga" Width="300px"></ajax:ValidatorCalloutExtender> <ajax:ValidatorCalloutExtender ID="VCEPrecioListaCarga" runat="server" HighlightCssClass="vco" TargetControlID="RFVPrecioListaCarga" Width="300px"></ajax:ValidatorCalloutExtender>
</div> </div>

View File

@@ -74,6 +74,8 @@ Partial Class Ventas_ActualizarPrecios
End Sub End Sub
Public Sub CargaPreciosLista() Public Sub CargaPreciosLista()
DdlPrecioLista.ITEMS.CLEAR
Dim ObjVta As New ClsVentas Dim ObjVta As New ClsVentas
If ObjVta.GetPrecioListas(UsuarioActual.CveEmpresa) Then If ObjVta.GetPrecioListas(UsuarioActual.CveEmpresa) Then
DdlPrecioLista.DataSource = ObjVta.DtResultados.Copy() DdlPrecioLista.DataSource = ObjVta.DtResultados.Copy()
@@ -81,10 +83,17 @@ Partial Class Ventas_ActualizarPrecios
End If End If
ObjVta.Dispose() ObjVta.Dispose()
DdlPrecioLista.DataBind() DdlPrecioLista.DataBind()
DdlPrecioListaCarga.DataBind() DdlPrecioListaCarga.DataBind()
DdlPrecioListaCarga.Items.Insert(0, New ListItem("Seleccione", "-1")) DdlPrecioLista.Items.Insert(0, New ListItem("Seleccione", "-1"))
If UsuarioActual.CveEmpresa.Contiene(1, 140) Then
DdlPrecioLista.Items.Insert(0, New ListItem("Sin Precio Lista", "-2"))
DdlPrecioListaCarga.Items.Insert(0, New ListItem("Sin Precio Lista", "-2"))
End If
End Sub End Sub
Public Sub CargaPS() Public Sub CargaPS()
@@ -271,7 +280,7 @@ Partial Class Ventas_ActualizarPrecios
.PS = row.DataKey("PS"), .PS = row.DataKey("PS"),
.Precio = row.FCTextBox("TxtPrecio").Text.ToDecimal() .Precio = row.FCTextBox("TxtPrecio").Text.ToDecimal()
}).QueryToDataTable(True) }).QueryToDataTable(True)
If DtExcel.Rows.Count < 2 Then If DtExcel.Rows.Count < 1 Then
Alert("No hay resutados en la busqueda.", TipoMensaje.MsgAdvertencia) Alert("No hay resutados en la busqueda.", TipoMensaje.MsgAdvertencia)
Exit Sub Exit Sub
End If End If
@@ -350,7 +359,7 @@ Partial Class Ventas_ActualizarPrecios
End Try End Try
If Not ErrorArchivo AndAlso dt IsNot Nothing Then If Not ErrorArchivo AndAlso dt IsNot Nothing Then
If DdlPrecioListaCarga.SelectedValue.ToEntero() <= 0 Then If DdlPrecioListaCarga.SelectedValue.ToEntero() = -1 Then
Alert("Debe Seleccionar la lista de precios a cargar. Favor de corregirlo", TipoMensaje.MsgError) Alert("Debe Seleccionar la lista de precios a cargar. Favor de corregirlo", TipoMensaje.MsgError)
Exit Sub Exit Sub
End If End If
@@ -380,16 +389,26 @@ Partial Class Ventas_ActualizarPrecios
Dim Correcto As Boolean = False Dim Correcto As Boolean = False
Dim CvePS As Integer = DtPS.FiltroPrimeroValor("CvePS", String.Format("Codigo='{0}' AND CveEmpresa={1}", row(0).ToString(), UsuarioActual.CveEmpresa)) Dim CvePS As Integer = DtPS.FiltroPrimeroValor("CvePS", String.Format("Codigo='{0}' AND CveEmpresa={1}", row(0).ToString(), UsuarioActual.CveEmpresa))
Dim CvePrecioLista As Integer = DdlPrecioListaCarga.SelectedValue.ToEntero() Dim CvePrecioLista As Integer = DdlPrecioListaCarga.SelectedValue.ToEntero()
Dim PrecioNuevo As Decimal = row("Precio").ToString().ToDecimal()
Dim Porcentaje As Decimal = -1
If CvePS > 0 AndAlso CvePrecioLista > 0 Then If CvePS > 0 AndAlso CvePrecioLista > 0 Then
Dim Porcentaje As Decimal = -1
Dim PrecioNuevo As Decimal = row("Precio").ToString().ToDecimal()
Correcto = ObjPS.UpdatePSPreciosLista(PrecioNuevo, CvePrecioLista, Porcentaje, CvePS, UsuarioActual.CveUsuario, DateTime.Now, True) Correcto = ObjPS.UpdatePSPreciosLista(PrecioNuevo, CvePrecioLista, Porcentaje, CvePS, UsuarioActual.CveUsuario, DateTime.Now, True)
If Correcto Then If Correcto Then
RowsCargados += 1 RowsCargados += 1
End If End If
Else Else
Correcto = False If CvePS > 0 AndAlso CvePrecioLista = -2 Then
Correcto = ObjPS.UpdatePSPrecios(PrecioNuevo, CvePrecioLista, Porcentaje, CvePS, UsuarioActual.CveUsuario, DateTime.Now, True)
If Correcto Then
RowsCargados += 1
End If
Else
Correcto = False
End If
End If End If
If Not Correcto Then If Not Correcto Then
ProductosNoCargados.AppendFormat("{0},", row("Producto / Servicio").ToString()) ProductosNoCargados.AppendFormat("{0},", row("Producto / Servicio").ToString())

View File

@@ -1988,8 +1988,6 @@ Partial Class PV
CalculaTotalesVenta() CalculaTotalesVenta()
Alert("Eliminado Correctamente.", TipoMensaje.MsgInformacion) Alert("Eliminado Correctamente.", TipoMensaje.MsgInformacion)
'JJMQ 20160506: Se agrego para la validacion de pago de contado.
'CVImporteContado.ValueToCompare = TxtTotal.Text.Replace(",", "")
UpContado.Update() UpContado.Update()
End Sub End Sub
@@ -3071,7 +3069,7 @@ Partial Class PV
TmpDT.Columns.Add("EsCargo", GetType(Boolean)) TmpDT.Columns.Add("EsCargo", GetType(Boolean))
TmpDT.Columns.Add("PUOriginal", GetType(Decimal)) TmpDT.Columns.Add("PUOriginal", GetType(Decimal))
TmpDT.Columns.Add("ConsecPSPadre", GetType(Integer))
End Sub End Sub
@@ -3264,7 +3262,8 @@ Partial Class PV
Optional SerieLote As String = "", Optional TiempoEntrega As String = "", Optional EntregaDirecta As Integer = 0, Optional SerieLote As String = "", Optional TiempoEntrega As String = "", Optional EntregaDirecta As Integer = 0,
Optional CveContratoDetalle As Integer = 0, Optional CveVentaDetalle As Integer = 0, Optional CveMovimientoDetallePedido As Integer = 0, Optional CveContratoDetalle As Integer = 0, Optional CveVentaDetalle As Integer = 0, Optional CveMovimientoDetallePedido As Integer = 0,
Optional CveOrdenCompraDetalle As Integer = 0, Optional CveVentaDetalleRemision As Integer = 0, Optional CveVentaDetalleCotizacion As Integer = 0, Optional CveOrdenCompraDetalle As Integer = 0, Optional CveVentaDetalleRemision As Integer = 0, Optional CveVentaDetalleCotizacion As Integer = 0,
Optional CuentaPredial As String = "", Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0, Optional EsCargo As Boolean = False) As Integer Optional CuentaPredial As String = "", Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0, Optional EsCargo As Boolean = False,
Optional ConsecPSPadre As Integer = -1) As Integer
Dim Retorno As Integer = -1 Dim Retorno As Integer = -1
If Not CvePS > 0 Then If Not CvePS > 0 Then
@@ -3427,6 +3426,10 @@ Partial Class PV
Row("CuentaPredial") = CuentaPredial Row("CuentaPredial") = CuentaPredial
Row("EsCargo") = EsCargo Row("EsCargo") = EsCargo
If EsCargo AndAlso ConsecPSPadre >= 0 Then
Row("ConsecPSPadre") = ConsecPSPadre
End If
If UsuarioActual.CveEmpresa = 119 Then If UsuarioActual.CveEmpresa = 119 Then
If Not RemisionesLista.Count > 0 Then 'SI VIENE DE REMISION NO SE CONSIDERA If Not RemisionesLista.Count > 0 Then 'SI VIENE DE REMISION NO SE CONSIDERA
@@ -5213,8 +5216,6 @@ Partial Class PV
Exit Sub Exit Sub
End If End If
Try Try
If DdlTipoUso.SelectedValue.ToEntero > 0 AndAlso DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso TxtMesesUso.Text <> "" AndAlso DdlPS.SelectedValue.ToEntero > 0 Then If DdlTipoUso.SelectedValue.ToEntero > 0 AndAlso DdlPSAjuste.SelectedValue.ToEntero > 0 AndAlso TxtMesesUso.Text <> "" AndAlso DdlPS.SelectedValue.ToEntero > 0 Then
Dim CveMarca As Integer = -1 Dim CveMarca As Integer = -1
@@ -5570,177 +5571,148 @@ Partial Class PV
CalculaTotalesVenta() CalculaTotalesVenta()
End Sub End Sub
Private Function CalculaUsados(Consec As Integer) As List(Of Integer) Private Function CalculaUsados(Consec As Integer) As List(Of Integer)
If Modalidad = "U" Then
'If Modalidad = "U" Then EliminarUsados(Consec)
' EliminarUsados(Consec) End If
'End If
Dim ListaPScargo As New List(Of Integer) Dim ListaPScargo As New List(Of Integer)
Dim DTTamanios As New DataTable Dim DTTamanios As DataTable = GlobalDTAcumTamaños()
Dim ObjAcum As New ClsAcumuladores Dim DTCvePSCostos = DTTamanios.FiltraParametros("", "", {"CvePSCargo"})
If ObjAcum.TamañoGet(-1, UsuarioActual.CveEmpresa) Then
DTTamanios = ObjAcum.DtResultados
Dim DTCvePSCostos = ObjAcum.DtResultados.FiltraParametros("", "", {"CvePSCargo"})
Dim CveUnidadMedidaPSA As Integer = -1 Dim CveUnidadMedidaPSA As Integer = -1
Dim UnidadMedidaPSA As String = "Unidad" Dim UnidadMedidaPSA As String = "Unidad"
Dim CveClacificacionPSA As Integer = -1 Dim CveClacificacionPSA As Integer = -1
Dim ClacificacionPSA As String = "" Dim ClacificacionPSA As String = ""
Dim CveSubProyectoPSA As Integer = -1 Dim CveSubProyectoPSA As Integer = -1
Dim SubProyectoPSA As String = "" Dim SubProyectoPSA As String = ""
Dim PSPSA As String = "" Dim PSPSA As String = ""
Dim DTPSTemp As New DataTable '= TmpDT.Clone Dim DTPSTemp As New DataTable '= TmpDT.Clone
DTPSTemp.Columns.Add("Cantidad", GetType(Integer)) DTPSTemp.Columns.Add("Cantidad", GetType(Integer))
DTPSTemp.Columns.Add("CveUnidadMedida", GetType(Integer)) DTPSTemp.Columns.Add("CveUnidadMedida", GetType(Integer))
DTPSTemp.Columns.Add("UnidadMedida", GetType(String)) DTPSTemp.Columns.Add("UnidadMedida", GetType(String))
DTPSTemp.Columns.Add("CveClacificacion", GetType(Integer)) DTPSTemp.Columns.Add("CveClacificacion", GetType(Integer))
DTPSTemp.Columns.Add("Clacificacion", GetType(String)) DTPSTemp.Columns.Add("Clacificacion", GetType(String))
DTPSTemp.Columns.Add("CvePS", GetType(Integer)) DTPSTemp.Columns.Add("CvePS", GetType(Integer))
DTPSTemp.Columns.Add("PS", GetType(String)) DTPSTemp.Columns.Add("PS", GetType(String))
DTPSTemp.Columns.Add("PU", GetType(Decimal)) DTPSTemp.Columns.Add("PU", GetType(Decimal))
DTPSTemp.Columns.Add("CveSubProyecto", GetType(Integer)) DTPSTemp.Columns.Add("CveSubProyecto", GetType(Integer))
DTPSTemp.Columns.Add("SubProyecto", GetType(String)) DTPSTemp.Columns.Add("SubProyecto", GetType(String))
DTPSTemp.Columns.Add("ConsecPSPadre", GetType(Integer))
Dim ObjProductosServicios As New ClsProductosServicios() Dim ObjProductosServicios As New ClsProductosServicios()
For Each DrowPartidas As DataRow In TmpDT.Select($"Consec = {Consec}") For Each DrowPartidas As DataRow In TmpDT.Select($"Consec = {Consec}")
Dim CveTamanioTemp As Integer = DrowPartidas("CveTamaño").ToString.ToEntero Dim CveTamanioTemp As Integer = DrowPartidas("CveTamaño").ToString.ToEntero
If CveTamanioTemp > 0 Then If CveTamanioTemp > 0 Then
Dim DTTamanioTemp As New DataTable Dim DTTamanioTemp As New DataTable
Dim CvePsTemp As Integer = DTTamanios.FiltraParametros($"CveTamaño = { CveTamanioTemp } ").Rows(0)("CvePSCargo").ToString.ToEntero Dim CvePsTemp As Integer = DTTamanios.FiltraParametros($"CveTamaño = { CveTamanioTemp } ").Rows(0)("CvePSCargo").ToString.ToEntero
CveSubProyectoPSA = DrowPartidas("CveSubProyecto").ToString.ToEntero CveSubProyectoPSA = DrowPartidas("CveSubProyecto").ToString.ToEntero
SubProyectoPSA = DrowPartidas("SubProyecto").ToString SubProyectoPSA = DrowPartidas("SubProyecto").ToString
If ObjProductosServicios.GetPS(CvePsTemp, -1, UsuarioActual.CveEmpresa) Then
CveUnidadMedidaPSA = ObjProductosServicios.CveUnidadMedida
CveClacificacionPSA = ObjProductosServicios.CveClasificacion
UnidadMedidaPSA = ObjProductosServicios.DtResultados.FiltroPrimeroValor("UnidadMedida")
PSPSA = ObjProductosServicios.PS
End If
If UsuarioActual.Empresa.UsaAC Then
ClacificacionPSA = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion:=If(UsuarioActual.Empresa.UsaContabilidad, CveClacificacionPSA, -1)).FiltroPrimeroValor("Clasificacion", " Codigo = '' OR Codigo IS NULL ", Orderby:="Clasificacion")
Else
ClacificacionPSA = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion:=If(UsuarioActual.Empresa.UsaContabilidad, CveClacificacionPSA, -1)).FiltroPrimeroValor("Clasificacion", Orderby:="Clasificacion")
End If
Dim Cargo As Decimal = DTTamanios.FiltroPrimeroValor("Cargo", $" CveTamaño = { CveTamanioTemp }").ToDecimal
If DTPSTemp.FiltraParametros($"CvePs = { CvePsTemp }").Rows.Count > 0 Then
For Each dRowUpdate As DataRow In DTPSTemp.Rows
If (dRowUpdate("CvePS").ToString.ToEntero = CvePsTemp) Then
dRowUpdate("Cantidad") = dRowUpdate("Cantidad").ToString.ToDecimal + DrowPartidas("Cantidad").ToString.ToDecimal
dRowUpdate("PU") = Cargo ' dRowUpdate("Total").ToString.ToDecimal + ImporteCargo
End If
Next
DTPSTemp.AcceptChanges()
Else
Dim dRowNuevo As DataRow = DTPSTemp.NewRow
dRowNuevo("Cantidad") = DrowPartidas("Cantidad").ToString.ToDecimal
dRowNuevo("PU") = Cargo
dRowNuevo("CveUnidadMedida") = CveUnidadMedidaPSA
dRowNuevo("UnidadMedida") = UnidadMedidaPSA
dRowNuevo("CveClacificacion") = CveClacificacionPSA
dRowNuevo("Clacificacion") = ClacificacionPSA
dRowNuevo("CvePS") = CvePsTemp
dRowNuevo("PS") = PSPSA
dRowNuevo("CveSubProyecto") = DrowPartidas("CveSubProyecto").ToString.ToEntero
dRowNuevo("SubProyecto") = DrowPartidas("SubProyecto").ToString
DTPSTemp.Rows.Add(dRowNuevo)
DTPSTemp.AcceptChanges()
End If
If ObjProductosServicios.GetPS(CvePsTemp, -1, UsuarioActual.CveEmpresa) Then
CveUnidadMedidaPSA = ObjProductosServicios.CveUnidadMedida
CveClacificacionPSA = ObjProductosServicios.CveClasificacion
UnidadMedidaPSA = ObjProductosServicios.DtResultados.FiltroPrimeroValor("UnidadMedida")
PSPSA = ObjProductosServicios.PS
End If
If UsuarioActual.Empresa.UsaAC Then
ClacificacionPSA = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion:=If(UsuarioActual.Empresa.UsaContabilidad, CveClacificacionPSA, -1)).FiltroPrimeroValor("Clasificacion", " Codigo = '' OR Codigo IS NULL ", Orderby:="Clasificacion")
Else
ClacificacionPSA = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion:=If(UsuarioActual.Empresa.UsaContabilidad, CveClacificacionPSA, -1)).FiltroPrimeroValor("Clasificacion", Orderby:="Clasificacion")
End If
Dim Cargo As Decimal = DTTamanios.FiltroPrimeroValor("Cargo", $" CveTamaño = { CveTamanioTemp }").ToDecimal
If DTPSTemp.FiltraParametros($"CvePs = { CvePsTemp }").Rows.Count > 0 Then
For Each dRowUpdate As DataRow In DTPSTemp.Rows
If (dRowUpdate("CvePS").ToString.ToEntero = CvePsTemp) Then
dRowUpdate("Cantidad") = dRowUpdate("Cantidad").ToString.ToDecimal + DrowPartidas("Cantidad").ToString.ToDecimal
dRowUpdate("PU") = Cargo ' dRowUpdate("Total").ToString.ToDecimal + ImporteCargo
End If
Next
DTPSTemp.AcceptChanges()
Else
Dim dRowNuevo As DataRow = DTPSTemp.NewRow
dRowNuevo("Cantidad") = DrowPartidas("Cantidad").ToString.ToDecimal
dRowNuevo("PU") = Cargo
dRowNuevo("CveUnidadMedida") = CveUnidadMedidaPSA
dRowNuevo("UnidadMedida") = UnidadMedidaPSA
dRowNuevo("CveClacificacion") = CveClacificacionPSA
dRowNuevo("Clacificacion") = ClacificacionPSA
dRowNuevo("CvePS") = CvePsTemp
dRowNuevo("PS") = PSPSA
dRowNuevo("CveSubProyecto") = DrowPartidas("CveSubProyecto").ToString.ToEntero
dRowNuevo("SubProyecto") = DrowPartidas("SubProyecto").ToString
dRowNuevo("ConsecPSPadre") = Consec
DTPSTemp.Rows.Add(dRowNuevo)
DTPSTemp.AcceptChanges()
End If End If
Next
ObjProductosServicios.Dispose()
Dim ModalidadBack = Modalidad
'CAMBIA LA MODALIDAD PARA AGREGAR LOS PS CARGO
If Modalidad = "U" Then
Modalidad = "A"
End If End If
Next
ObjProductosServicios.Dispose()
For Each drowPsTamaños As DataRow In DTPSTemp.Rows Dim ModalidadBack = Modalidad
If drowPsTamaños("PU").ToString.ToDecimal > 0 Then 'CAMBIA LA MODALIDAD PARA AGREGAR LOS PS CARGO
Dim Concec = AgregarProductoServicio(drowPsTamaños("Cantidad").ToString.ToEntero, drowPsTamaños("CveUnidadMedida").ToString.ToEntero, drowPsTamaños("UnidadMedida").ToString, If Modalidad = "U" Then
Modalidad = "A"
End If
For Each drowPsTamaños As DataRow In DTPSTemp.Rows
If drowPsTamaños("PU").ToString.ToDecimal > 0 Then
Dim Concec = AgregarProductoServicio(drowPsTamaños("Cantidad").ToString.ToEntero, drowPsTamaños("CveUnidadMedida").ToString.ToEntero, drowPsTamaños("UnidadMedida").ToString,
drowPsTamaños("CveClacificacion").ToString.ToEntero, drowPsTamaños("Clacificacion").ToString, drowPsTamaños("CvePS").ToString.ToEntero, drowPsTamaños("CveClacificacion").ToString.ToEntero, drowPsTamaños("Clacificacion").ToString, drowPsTamaños("CvePS").ToString.ToEntero,
drowPsTamaños("PS").ToString, "", drowPsTamaños("PU").ToString.ToDecimal, 0, -1, "", drowPsTamaños("CveSubProyecto").ToString.ToEntero, drowPsTamaños("PS").ToString, "", drowPsTamaños("PU").ToString.ToDecimal, 0, -1, "", drowPsTamaños("CveSubProyecto").ToString.ToEntero,
drowPsTamaños("SubProyecto").ToString, EsCargo:=True) drowPsTamaños("SubProyecto").ToString, EsCargo:=True, ConsecPSPadre:=drowPsTamaños("ConsecPSPadre").ToString.ToEntero)
If Consec > 0 Then If Consec > 0 Then
ListaPScargo.Add(drowPsTamaños("CvePS").ToString.ToEntero) ListaPScargo.Add(drowPsTamaños("CvePS").ToString.ToEntero)
End If
End If End If
Next End If
Next
Modalidad = ModalidadBack Modalidad = ModalidadBack
End If
ObjAcum.Dispose()
Return ListaPScargo Return ListaPScargo
End Function End Function
Private Sub EliminarUsados(Consec As Integer) Private Sub EliminarUsados(Consec As Integer)
Dim DTTamanios As New DataTable
Dim ObjAcum As New ClsAcumuladores 'ELIMINAR EL USADO EXTRAS
For Each drow As DataRow In TmpDT.Select($"ConsecPSPadre ={Consec}")
drow.Delete()
Next
If ObjAcum.TamañoGet(-1, UsuarioActual.CveEmpresa) Then 'ELIMINAR LOS USADOS QUE SE MANDAN A RECEPCION
For Each drow As DataRow In TmpDT.Select($"Consec ={Consec}")
DTTamanios = ObjAcum.DtResultados For Each RowRecepcionUsados As DataRow In TmpDTRecepcionUsados.Rows
Dim DTCvePSCostos = ObjAcum.DtResultados.FiltraParametros("", "", {"CvePSCargo"}) If (RowRecepcionUsados("CvePSRelacionado").ToString() = drow("CvePS").ToString()) Then
RowRecepcionUsados.Delete()
If Not TmpDT.Columns.Contains("Eliminar") Then End If
TmpDT.Columns.Add("Eliminar", GetType(Integer))
End If
For Each drow As DataRow In TmpDT.FiltraParametros($"Consec ={Consec}").Rows
For Each drow2 As DataRow In DTCvePSCostos.Rows
If drow("CvePS").ToString.ToEntero = drow2("CvePSCargo").ToString.ToEntero Then
drow("Eliminar") = 1
Exit For
End If
Next
Next Next
Next
Dim TmpDTView As New DataView(TmpDT) TmpDT.AcceptChanges()
TmpDTView.RowFilter = "Eliminar = 1" TmpDTRecepcionUsados.AcceptChanges()
For Each dRowEliminar As DataRowView In TmpDTView
For Each RowRecepcionUsados As DataRow In TmpDTRecepcionUsados.Rows
If (RowRecepcionUsados("CvePS").ToString() = dRowEliminar("CvePS").ToString()) Then
RowRecepcionUsados.Delete()
End If
Next
dRowEliminar.Delete()
Next
TmpDT.AcceptChanges()
TmpDTRecepcionUsados.AcceptChanges()
End If
ObjAcum.Dispose()
End Sub End Sub
#End Region #End Region

View File

@@ -4292,7 +4292,7 @@ Partial Class Ventas
Retorno = True Retorno = True
Else Else
CveVenta = -1 ViewState("CveVenta") = -1
Alert("El documento solicitado no existe, favor de revisar su búsqueda.", TipoMensaje.MsgAdvertencia) Alert("El documento solicitado no existe, favor de revisar su búsqueda.", TipoMensaje.MsgAdvertencia)
End If End If
End If End If
@@ -5748,10 +5748,10 @@ Partial Class Ventas
Existencia = ObjInventarios.GetExistenciasPS(CvePS, -1, UsuarioActual.CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=-1) Existencia = ObjInventarios.GetExistenciasPS(CvePS, -1, UsuarioActual.CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=-1)
End If End If
Dim Costo As Decimal = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero) Dim Costo As Decimal = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero, CveTipoAlmacen:=1)
'si el costo es cero, puede ser que no halla movimientos del producto, en esa sucursal. y se volverá a sacar sin especificar sucursal 'si el costo es cero, puede ser que no halla movimientos del producto, en esa sucursal. y se volverá a sacar sin especificar sucursal
If Costo = 0 Then Costo = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, -1) If Costo = 0 Then Costo = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, -1, CveTipoAlmacen:=1)
ObjInventarios.Dispose() ObjInventarios.Dispose()
Dim PrecioMinimo As Decimal = 0 Dim PrecioMinimo As Decimal = 0
@@ -5900,7 +5900,7 @@ Partial Class Ventas
Dim TotalCalculableImpuestos As Decimal = ((Cantidad * PU) - (Descuento)) Dim TotalCalculableImpuestos As Decimal = ((Cantidad * PU) - (Descuento))
Dim TotalCalculableImpuestosIVA As Decimal = 0 Dim TotalCalculableImpuestosIVA As Decimal = 0
TotalCalculableImpuestosIVA = TotalCalculableImpuestos * (1 + TmpDT.Rows(e.RowIndex)("IEPSPorcentaje").ToString.ToDecimal) TotalCalculableImpuestosIVA = TotalCalculableImpuestos * (1 + TmpDT.Rows(e.RowIndex)("PorcentajeIEPS").ToString.ToDecimal)
TmpDT.Rows(e.RowIndex)("CveUM") = GvPS.Rows(e.RowIndex).FCDropDownList("DdlUnidadMedida").SelectedValue.ToEntero TmpDT.Rows(e.RowIndex)("CveUM") = GvPS.Rows(e.RowIndex).FCDropDownList("DdlUnidadMedida").SelectedValue.ToEntero
@@ -6352,7 +6352,7 @@ Partial Class Ventas
EsValidoMayor = False EsValidoMayor = False
EsValidoPU = True EsValidoPU = True
PU = dr("PU").ToString.ToDecimal * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal) PU = dr("PU").ToString.ToDecimal * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal)
Costo = ObjInventarios.GetCostoPS(dr("CvePS").ToString.ToEntero, dr("Cantidad").ToString.ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero) Costo = ObjInventarios.GetCostoPS(dr("CvePS").ToString.ToEntero, dr("Cantidad").ToString.ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero, CveTipoAlmacen:=1)
Dim PrecioMinimo As Decimal = 0 Dim PrecioMinimo As Decimal = 0
'RMF. condicion temporal, para reubicación, precio mínimo 'RMF. condicion temporal, para reubicación, precio mínimo
@@ -9121,7 +9121,12 @@ Partial Class Ventas
'Si es devolucion se agregan a la tabla de Vta_VentasDetalleDevolucion 'Si es devolucion se agregan a la tabla de Vta_VentasDetalleDevolucion
If factura.AplicaDevolucion Then If factura.AplicaDevolucion Then
If Not ObjVentas.AddVentaDetalleDevolucion(Row("CveVentaDetalle").ToString.ToEntero, ObjVentas.CveVentaDetalle, Row("Cantidad").ToString.ToDouble) Then If Not ObjVentas.AddVentaDetalleDevolucion(Row("CveVentaDetalle").ToString.ToEntero, ObjVentas.CveVentaDetalle, Row("Cantidad").ToString.ToDouble) Then
ErrorList.Add("Ocurrió un error al agregar la venta detalle devolucion.") ErrorList.Add("Ocurrió un error al agregar la venta detalle devolución.")
End If
If ErrorList.Count = 0 Then
If Not ObjEventos.AddEventoBitacora(String.Format("Se aplicó una devolución en Folio: <a href=""/Ventas/Ventas.aspx?CveVenta={0}"" target=""_blank"">{1}</a>", factura.CveVenta, factura.SerieFolio), "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVentaDevolucion) Then
ErrorList.Add("Ocurrió un error al agregar la bitacora de devolución.")
End If
End If End If
End If End If
@@ -13054,9 +13059,9 @@ Partial Class Ventas
If PrecioSugerido = 0 Then If PrecioSugerido = 0 Then
Dim ObjInventarios As New ClsInventarios Dim ObjInventarios As New ClsInventarios
Dim CostoPS = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero) Dim CostoPS = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero, CveTipoAlmacen:=1)
'si el costo es cero, puede ser que no halla movimientos del producto, en esa sucursal. y se volverá a sacar sin especificar sucursal 'si el costo es cero, puede ser que no halla movimientos del producto, en esa sucursal. y se volverá a sacar sin especificar sucursal
If CostoPS = 0 Then CostoPS = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, -1) If CostoPS = 0 Then CostoPS = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, -1, CveTipoAlmacen:=1)
ObjInventarios.Dispose() ObjInventarios.Dispose()
If CostoPS > 0 And PorcentajePrecio > 0 Then If CostoPS > 0 And PorcentajePrecio > 0 Then
PrecioSugerido = ((PorcentajePrecio / 100) + 1) * CostoPS PrecioSugerido = ((PorcentajePrecio / 100) + 1) * CostoPS
@@ -13631,10 +13636,10 @@ Partial Class Ventas
If UsuarioActual.Empresa.UsaInventarios AndAlso CveTipoPS = 2 AndAlso (DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "PA") Or (DdlTipoComprobante.SelectedValue.Contiene("Cot") And UsuarioActual.CveEmpresa.Contiene(119))) Then If UsuarioActual.Empresa.UsaInventarios AndAlso CveTipoPS = 2 AndAlso (DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "PA") Or (DdlTipoComprobante.SelectedValue.Contiene("Cot") And UsuarioActual.CveEmpresa.Contiene(119))) Then
Dim ObjInventarios As New ClsInventarios Dim ObjInventarios As New ClsInventarios
Dim Existencia As Decimal = ObjInventarios.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=-1) Dim Existencia As Decimal = ObjInventarios.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=-1)
Dim Costo As Decimal = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero) Dim Costo As Decimal = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero, CveTipoAlmacen:=1)
'si el costo es cero, puede ser que no halla movimientos del producto, en esa sucursal. y se volverá a sacar sin especificar sucursal 'si el costo es cero, puede ser que no halla movimientos del producto, en esa sucursal. y se volverá a sacar sin especificar sucursal
If Costo = 0 Then Costo = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, -1) If Costo = 0 Then Costo = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, -1, CveTipoAlmacen:=1)
ObjInventarios.Dispose() ObjInventarios.Dispose()
Dim PrecioMinimo As Decimal = 0 Dim PrecioMinimo As Decimal = 0
@@ -14238,10 +14243,10 @@ Partial Class Ventas
PrecioSugerido = ObjPS.DtResultados.FiltroPrimeroValor("PrecioLista").ToDecimal PrecioSugerido = ObjPS.DtResultados.FiltroPrimeroValor("PrecioLista").ToDecimal
If PrecioSugerido = 0 Then If PrecioSugerido = 0 Then
Dim ObjInventarios As New ClsInventarios Dim ObjInventarios As New ClsInventarios
Dim CostoPS = ObjInventarios.GetCostoPS(CvePSAdicional, DrPoliza("Cantidad").ToString.ToDecimal, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero) Dim CostoPS = ObjInventarios.GetCostoPS(CvePSAdicional, DrPoliza("Cantidad").ToString.ToDecimal, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero, CveTipoAlmacen:=1)
'si el costo es cero, puede ser que no halla movimientos del producto, en esa sucursal. y se volverá a sacar sin especificar sucursal 'si el costo es cero, puede ser que no halla movimientos del producto, en esa sucursal. y se volverá a sacar sin especificar sucursal
If CostoPS = 0 Then CostoPS = ObjInventarios.GetCostoPS(CvePSAdicional, DrPoliza("Cantidad").ToString.ToDecimal, -1, "-1", TxtFecha.Text.ToDate, -1) If CostoPS = 0 Then CostoPS = ObjInventarios.GetCostoPS(CvePSAdicional, DrPoliza("Cantidad").ToString.ToDecimal, -1, "-1", TxtFecha.Text.ToDate, -1, CveTipoAlmacen:=1)
ObjInventarios.Dispose() ObjInventarios.Dispose()
Dim PorcentajePrecio = ObjPS.DtResultados.FiltroPrimeroValor("Porcentaje").ToDecimal Dim PorcentajePrecio = ObjPS.DtResultados.FiltroPrimeroValor("Porcentaje").ToDecimal
@@ -23173,6 +23178,8 @@ Partial Class Ventas
'CUANDO ES CREAR APARTIR DE SE LIMPIAN FUNCIONALIDADES DE DOCUMENTOS YA REGISTRADOS 'CUANDO ES CREAR APARTIR DE SE LIMPIAN FUNCIONALIDADES DE DOCUMENTOS YA REGISTRADOS
BtnGenerarRemision.Visible = False BtnGenerarRemision.Visible = False
BtnEditarRemision.Visible = False
BtnPermisoEditarRemision.Visible = False
BtnPermisoEditarCotizacion.Visible = False BtnPermisoEditarCotizacion.Visible = False
BtnEditarCotizacion.Visible = False BtnEditarCotizacion.Visible = False
BtnGenerarOS.Visible = False BtnGenerarOS.Visible = False
@@ -23480,154 +23487,136 @@ Partial Class Ventas
Private Sub CalculaUsados() Private Sub CalculaUsados()
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem") Then
Dim DTTamanios As DataTable = GlobalDTAcumTamaños()
Dim DTCvePSCostos As DataTable
DTCvePSCostos = DTTamanios.FiltraParametros("", "", {"CvePSCargo"})
If Not TmpDT.Columns.Contains("Eliminar") Then
TmpDT.Columns.Add("Eliminar", GetType(Integer))
End If
For Each drow As DataRow In TmpDT.Rows
For Each drow2 As DataRow In DTCvePSCostos.Rows
If drow("CvePS").ToString.ToEntero = drow2("CvePSCargo").ToString.ToEntero Then
drow("Eliminar") = 1
Exit For
End If
Next
Next
Dim TmpDTView As New DataView(TmpDT)
TmpDTView.RowFilter = "Eliminar = 1"
For Each dRowEliminar As DataRowView In TmpDTView
dRowEliminar.Delete()
Next
TmpDT.AcceptChanges()
If ViewState("CargoUsado").ToString = "False" Then
Exit Sub
End If
Dim CveUnidadMedidaPSA As Integer = -1
Dim UnidadMedidaPSA As String = "Unidad"
Dim CveClacificacionPSA As Integer = -1
Dim ClacificacionPSA As String = ""
Dim CveSubProyectoPSA As Integer = -1
Dim SubProyectoPSA As String = ""
Dim PSPSA As String = ""
Dim DTPSTemp As New DataTable '= TmpDT.Clone
'AgregarProductoServicio(1, CveUnidadMedidaPSA, UnidadMedidaPSA, CveClacificacionPSA, ClacificacionPSA, CvePSPSA, PSPSA, "", ImporteCargo, 0, -1, "", CveSubProyectoPSA, SubProyectoPSA)
DTPSTemp.Columns.Add("Cantidad", GetType(Integer))
DTPSTemp.Columns.Add("CveUnidadMedida", GetType(Integer))
DTPSTemp.Columns.Add("UnidadMedida", GetType(String))
DTPSTemp.Columns.Add("CveClacificacion", GetType(Integer))
DTPSTemp.Columns.Add("Clacificacion", GetType(String))
DTPSTemp.Columns.Add("CvePS", GetType(Integer))
DTPSTemp.Columns.Add("PS", GetType(String))
DTPSTemp.Columns.Add("PU", GetType(Decimal))
DTPSTemp.Columns.Add("CveSubProyecto", GetType(Integer))
DTPSTemp.Columns.Add("SubProyecto", GetType(String))
For Each DrowPartidas As DataRow In TmpDT.Rows
Dim CveTamanioTemp As Integer = DrowPartidas("CveTamaño").ToString.ToEntero
If CveTamanioTemp > 0 Then
Dim DTTamanioTemp As New DataTable
Dim CvePsTemp As Integer = DTTamanios.FiltraParametros($"CveTamaño = { CveTamanioTemp } ").Rows(0)("CvePSCargo").ToString.ToEntero
'' If ClienteEsDistribuidor Then CveSubProyectoPSA = DrowPartidas("CveSubProyecto").ToString.ToEntero
SubProyectoPSA = DrowPartidas("SubProyecto").ToString
Dim DTTamanios As DataTable = Nothing Dim ObjProductosServicios As New ClsProductosServicios()
' Dim ObjAcum As New ClsAcumuladores If ObjProductosServicios.GetPS(CvePsTemp, -1, UsuarioActual.CveEmpresa) Then
CveUnidadMedidaPSA = ObjProductosServicios.CveUnidadMedida
CveClacificacionPSA = ObjProductosServicios.CveClasificacion
UnidadMedidaPSA = ObjProductosServicios.DtResultados.FiltroPrimeroValor("UnidadMedida")
PSPSA = ObjProductosServicios.PS
End If
ObjProductosServicios.Dispose()
'If ObjAcum.TamañoGet(-1, UsuarioActual.CveEmpresa) Then If UsuarioActual.Empresa.UsaAC Then
ClacificacionPSA = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion:=If(UsuarioActual.Empresa.UsaContabilidad, CveClacificacionPSA, -1)).FiltroPrimeroValor("Clasificacion", " Codigo = '' OR Codigo IS NULL ", Orderby:="Clasificacion")
Else
ClacificacionPSA = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion:=If(UsuarioActual.Empresa.UsaContabilidad, CveClacificacionPSA, -1)).FiltroPrimeroValor("Clasificacion", Orderby:="Clasificacion")
End If
DTTamanios = GlobalDTAcumTamaños() 'ObjAcum.DtResultados Dim Cargo As Decimal = DTTamanios.FiltroPrimeroValor("Cargo", $" CveTamaño = { CveTamanioTemp }").ToDecimal
Dim DTCvePSCostos As DataTable
DTCvePSCostos = DTTamanios.FiltraParametros("", "", {"CvePSCargo"})
If Not TmpDT.Columns.Contains("Eliminar") Then If DTPSTemp.FiltraParametros($"CvePs = { CvePsTemp }").Rows.Count > 0 Then
TmpDT.Columns.Add("Eliminar", GetType(Integer))
End If For Each dRowUpdate As DataRow In DTPSTemp.Rows
If (dRowUpdate("CvePS").ToString.ToEntero = CvePsTemp) Then
dRowUpdate("Cantidad") = dRowUpdate("Cantidad").ToString.ToDecimal + DrowPartidas("Cantidad").ToString.ToDecimal
dRowUpdate("PU") = Cargo ' dRowUpdate("Total").ToString.ToDecimal + ImporteCargo
End If
Next
DTPSTemp.AcceptChanges()
Else
Dim dRowNuevo As DataRow = DTPSTemp.NewRow
dRowNuevo("Cantidad") = DrowPartidas("Cantidad").ToString.ToDecimal
dRowNuevo("PU") = Cargo
dRowNuevo("CveUnidadMedida") = CveUnidadMedidaPSA
dRowNuevo("UnidadMedida") = UnidadMedidaPSA
dRowNuevo("CveClacificacion") = CveClacificacionPSA
dRowNuevo("Clacificacion") = ClacificacionPSA
dRowNuevo("CvePS") = CvePsTemp
dRowNuevo("PS") = PSPSA
dRowNuevo("CveSubProyecto") = DrowPartidas("CveSubProyecto").ToString.ToEntero
dRowNuevo("SubProyecto") = DrowPartidas("SubProyecto").ToString
DTPSTemp.Rows.Add(dRowNuevo)
DTPSTemp.AcceptChanges()
End If
For Each drow As DataRow In TmpDT.Rows
For Each drow2 As DataRow In DTCvePSCostos.Rows
If drow("CvePS").ToString.ToEntero = drow2("CvePSCargo").ToString.ToEntero Then
drow("Eliminar") = 1
Exit For
End If End If
Next Next
Next
Dim TmpDTView As New DataView(TmpDT)
TmpDTView.RowFilter = "Eliminar = 1"
For Each dRowEliminar As DataRowView In TmpDTView
dRowEliminar.Delete()
Next
TmpDT.AcceptChanges() For Each drowPsTamaños As DataRow In DTPSTemp.Rows
If ViewState("CargoUsado").ToString = "False" Then Modalidad = "A"
Exit Sub If drowPsTamaños("PU").ToString.ToDecimal > 0 Then
AgregarProductoServicio(drowPsTamaños("Cantidad").ToString.ToEntero, drowPsTamaños("CveUnidadMedida").ToString.ToEntero, drowPsTamaños("UnidadMedida").ToString,
drowPsTamaños("CveClacificacion").ToString.ToEntero, drowPsTamaños("Clacificacion").ToString, drowPsTamaños("CvePS").ToString.ToEntero,
drowPsTamaños("PS").ToString, "", drowPsTamaños("PU").ToString.ToDecimal, 0, -1, "", drowPsTamaños("CveSubProyecto").ToString.ToEntero,
drowPsTamaños("SubProyecto").ToString)
End If
Next
End If End If
Dim ObjProductosServicios As New ClsProductosServicios()
Dim CveUnidadMedidaPSA As Integer = -1
Dim UnidadMedidaPSA As String = "Unidad"
Dim CveClacificacionPSA As Integer = -1
Dim ClacificacionPSA As String = ""
Dim CveSubProyectoPSA As Integer = -1
Dim SubProyectoPSA As String = ""
Dim PSPSA As String = ""
Dim DTPSTemp As New DataTable '= TmpDT.Clone
'AgregarProductoServicio(1, CveUnidadMedidaPSA, UnidadMedidaPSA, CveClacificacionPSA, ClacificacionPSA, CvePSPSA, PSPSA, "", ImporteCargo, 0, -1, "", CveSubProyectoPSA, SubProyectoPSA)
DTPSTemp.Columns.Add("Cantidad", GetType(Integer))
DTPSTemp.Columns.Add("CveUnidadMedida", GetType(Integer))
DTPSTemp.Columns.Add("UnidadMedida", GetType(String))
DTPSTemp.Columns.Add("CveClacificacion", GetType(Integer))
DTPSTemp.Columns.Add("Clacificacion", GetType(String))
DTPSTemp.Columns.Add("CvePS", GetType(Integer))
DTPSTemp.Columns.Add("PS", GetType(String))
DTPSTemp.Columns.Add("PU", GetType(Decimal))
DTPSTemp.Columns.Add("CveSubProyecto", GetType(Integer))
DTPSTemp.Columns.Add("SubProyecto", GetType(String))
For Each DrowPartidas As DataRow In TmpDT.Rows
Dim CveTamanioTemp As Integer = DrowPartidas("CveTamaño").ToString.ToEntero
If CveTamanioTemp > 0 Then
Dim DTTamanioTemp As New DataTable
Dim CvePsTemp As Integer = DTTamanios.FiltraParametros($"CveTamaño = { CveTamanioTemp } ").Rows(0)("CvePSCargo").ToString.ToEntero
CveSubProyectoPSA = DrowPartidas("CveSubProyecto").ToString.ToEntero
SubProyectoPSA = DrowPartidas("SubProyecto").ToString
If ObjProductosServicios.GetPS(CvePsTemp, -1, UsuarioActual.CveEmpresa) Then
CveUnidadMedidaPSA = ObjProductosServicios.CveUnidadMedida
CveClacificacionPSA = ObjProductosServicios.CveClasificacion
UnidadMedidaPSA = ObjProductosServicios.DtResultados.FiltroPrimeroValor("UnidadMedida")
PSPSA = ObjProductosServicios.PS
End If
If UsuarioActual.Empresa.UsaAC Then
ClacificacionPSA = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion:=If(UsuarioActual.Empresa.UsaContabilidad, CveClacificacionPSA, -1)).FiltroPrimeroValor("Clasificacion", " Codigo = '' OR Codigo IS NULL ", Orderby:="Clasificacion")
Else
ClacificacionPSA = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion:=If(UsuarioActual.Empresa.UsaContabilidad, CveClacificacionPSA, -1)).FiltroPrimeroValor("Clasificacion", Orderby:="Clasificacion")
End If
Dim Cargo As Decimal = DTTamanios.FiltroPrimeroValor("Cargo", $" CveTamaño = { CveTamanioTemp }").ToDecimal
If DTPSTemp.FiltraParametros($"CvePs = { CvePsTemp }").Rows.Count > 0 Then
For Each dRowUpdate As DataRow In DTPSTemp.Rows
If (dRowUpdate("CvePS").ToString.ToEntero = CvePsTemp) Then
dRowUpdate("Cantidad") = dRowUpdate("Cantidad").ToString.ToDecimal + DrowPartidas("Cantidad").ToString.ToDecimal
dRowUpdate("PU") = Cargo ' dRowUpdate("Total").ToString.ToDecimal + ImporteCargo
End If
Next
DTPSTemp.AcceptChanges()
Else
Dim dRowNuevo As DataRow = DTPSTemp.NewRow
dRowNuevo("Cantidad") = DrowPartidas("Cantidad").ToString.ToDecimal
dRowNuevo("PU") = Cargo
dRowNuevo("CveUnidadMedida") = CveUnidadMedidaPSA
dRowNuevo("UnidadMedida") = UnidadMedidaPSA
dRowNuevo("CveClacificacion") = CveClacificacionPSA
dRowNuevo("Clacificacion") = ClacificacionPSA
dRowNuevo("CvePS") = CvePsTemp
dRowNuevo("PS") = PSPSA
dRowNuevo("CveSubProyecto") = DrowPartidas("CveSubProyecto").ToString.ToEntero
dRowNuevo("SubProyecto") = DrowPartidas("SubProyecto").ToString
DTPSTemp.Rows.Add(dRowNuevo)
DTPSTemp.AcceptChanges()
End If
End If
Next
For Each drowPsTamaños As DataRow In DTPSTemp.Rows
Modalidad = "A"
If drowPsTamaños("PU").ToString.ToDecimal > 0 Then
AgregarProductoServicio(drowPsTamaños("Cantidad").ToString.ToEntero, drowPsTamaños("CveUnidadMedida").ToString.ToEntero, drowPsTamaños("UnidadMedida").ToString,
drowPsTamaños("CveClacificacion").ToString.ToEntero, drowPsTamaños("Clacificacion").ToString, drowPsTamaños("CvePS").ToString.ToEntero,
drowPsTamaños("PS").ToString, "", drowPsTamaños("PU").ToString.ToDecimal, 0, -1, "", drowPsTamaños("CveSubProyecto").ToString.ToEntero,
drowPsTamaños("SubProyecto").ToString)
End If
Next
ObjProductosServicios.Dispose()
'End If
' ObjAcum.Dispose()
'End If
End Sub End Sub
Private Function GuardarUsados(SqlTransaccion As SqlClient.SqlTransaction, CveVenta As Integer) As Boolean Private Function GuardarUsados(SqlTransaccion As SqlClient.SqlTransaction, CveVenta As Integer) As Boolean