This commit is contained in:
Oscar Irigoyen
2022-10-03 06:46:53 -07:00
8 changed files with 252 additions and 177 deletions

View File

@@ -5603,7 +5603,7 @@ Public Class ClsVentas
End Function
Public Function GetLineasAdicionalesSaldo(CveLineaAdicional As Integer, CveCliente As Integer, CveProveedor As Integer, CveMoneda As Integer, CveEmpresa As Integer, Optional ConSaldo As Integer = -1) As Boolean
Public Function GetLineasAdicionalesSaldo(CveLineaAdicional As Integer, CveCliente As Integer, CveProveedor As Integer, CveMoneda As Integer, CveEmpresa As Integer, Optional ConSaldo As Integer = -1, Optional FechaVencimientoConsulta As DateTime = MaxFecha) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_LineasAdicionalesSaldoGet")
@@ -5615,6 +5615,7 @@ Public Class ClsVentas
.Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@ConSaldo", SqlDbType.Int).Value = ConSaldo
.Add("@FechaVencimientoConsulta", SqlDbType.Date).Value = FechaVencimientoConsulta
End With
Try
SqlAdapter.Fill(Data)

View File

@@ -25,10 +25,18 @@
<DataField>CodigoPS</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Inicial">
<DataField>Inicial</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="E_Almacen">
<DataField>E_Almacen</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="E_Pub">
<DataField>E_Pub</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="E_Traspaso">
<DataField>E_Traspaso</DataField>
<rd:TypeName>System.String</rd:TypeName>
@@ -37,6 +45,10 @@
<DataField>E_Compra</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="E_Otros">
<DataField>E_Otros</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="S_Almacen">
<DataField>S_Almacen</DataField>
<rd:TypeName>System.String</rd:TypeName>
@@ -537,17 +549,18 @@
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="TipoAgrupador">
<Textbox Name="Inicial">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>0</Value>
<Value>=Fields!Inicial.Value</Value>
<Style>
<FontSize>7pt</FontSize>
<FontWeight>=IIF(Fields!CvePSCargo.Value &gt; 0, "Default","Bold")</FontWeight>
<Format>#,0;(#,0)</Format>
</Style>
</TextRun>
</TextRuns>
@@ -556,7 +569,7 @@
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>TipoAgrupador</rd:DefaultName>
<rd:DefaultName>Inicial</rd:DefaultName>
<Style>
<Border>
<Color>=IIF(Fields!CvePSCargo.Value &gt; 0, "White","Silver")</Color>
@@ -610,18 +623,18 @@
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Paqueteria1">
<Textbox Name="E_Pub">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>0</Value>
<Value>=Fields!E_Pub.Value</Value>
<Style>
<FontSize>7pt</FontSize>
<FontWeight>=IIF(Fields!CvePSCargo.Value &gt; 0, "Default","Bold")</FontWeight>
<Format>d</Format>
<Format>#,0;(#,0)</Format>
</Style>
</TextRun>
</TextRuns>
@@ -630,7 +643,7 @@
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>Paqueteria1</rd:DefaultName>
<rd:DefaultName>E_Pub</rd:DefaultName>
<Style>
<Border>
<Color>=IIF(Fields!CvePSCargo.Value &gt; 0, "White","Silver")</Color>
@@ -721,18 +734,18 @@
</TablixCell>
<TablixCell>
<CellContents>
<Textbox Name="Fecha">
<Textbox Name="E_Otros">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>0</Value>
<Value>=Fields!E_Otros.Value</Value>
<Style>
<FontSize>7pt</FontSize>
<FontWeight>=IIF(Fields!CvePSCargo.Value &gt; 0, "Default","Bold")</FontWeight>
<Format>d</Format>
<Format>#,0;(#,0)</Format>
</Style>
</TextRun>
</TextRuns>
@@ -741,7 +754,7 @@
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>Fecha</rd:DefaultName>
<rd:DefaultName>E_Otros</rd:DefaultName>
<Style>
<Border>
<Color>=IIF(Fields!CvePSCargo.Value &gt; 0, "White","Silver")</Color>

View File

@@ -2959,7 +2959,7 @@
</div>
</div>
<div class="col-md-6">
<label for="<%= TxtFechaAjuste.ClientID.ToString()%>">Fecha Vigencia:</label>
<label for="<%= TxtFechaVigencia.ClientID.ToString()%>">Fecha Vigencia:</label>
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 100% !important; padding: 0px;">
<asp:TextBox ID="TxtFechaVigencia" CssClass="form-control input-sm ADSMaskDate" Width="100%" runat="server"></asp:TextBox>
<span class="input-group-btn ">
@@ -3174,6 +3174,7 @@
</span>
<ajax:MaskedEditExtender ID="MEEFechaAjuste" runat="server" TargetControlID="TxtFechaAjuste" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CEEFechaAjuste" TargetControlID="TxtFechaAjuste" PopupButtonID="LnkFechaAjuste" PopupPosition="BottomLeft" Enabled="True" Format="dd/MM/yyyy"></ajax:CalendarExtender>
<asp:CompareValidator ID="CVFechaAJuste" runat="server" ControlToValidate="TxtFecha" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha''</b> no tiene el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="GrpAddVenta"></asp:CompareValidator>
<asp:RequiredFieldValidator ID="RFVFechaAjuste" runat="server" ControlToValidate="TxtFechaAjuste" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddVenta"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEFechaAjuste" runat="server" HighlightCssClass="vco" TargetControlID="RFVFechaAjuste"></ajax:ValidatorCalloutExtender>
</div>

View File

@@ -7130,12 +7130,22 @@ Partial Class PV
'End Sub
Private Function CalculaMesesUso() As Boolean
Dim FechaI As Date = TxtFechaAjuste.Text.ToDate.AddDays(1)
Dim FechaI As Date = Now
If IsDate(TxtFechaAjuste.Text) Then
FechaI = TxtFechaAjuste.Text.ToDate.AddDays(1)
Else
TxtMesesUso.Text = ""
Alert("La fecha de ajuste no tiene el formato correcto", TipoMensaje.MsgAdvertencia)
Return False
End If
Dim FechaF As Date = Now
If FechaI.AddDays(-1) > FechaF Then
TxtMesesUso.Text = ""
TxtFechaAjuste.Text = FechaF.ToString("dd/MM/yyyy")
Alert("La fecha de ajuste debe ser menor a la fecha actual", TipoMensaje.ToastAdventencia)
Alert("La fecha de ajuste debe ser menor a la fecha actual", TipoMensaje.MsgAdvertencia)
Return False
End If

View File

@@ -59,7 +59,7 @@
<tr align="left">
<td class="text-right"><b>Folio:</b></td>
<td>
<asp:TextBox ID="TxtFolio" runat="server" MaxLength="12" Width="230px" Height="30px" autofocus></asp:TextBox>
<asp:TextBox ID="TxtFolio" runat="server" MaxLength="12" Width="230px" Height="30px"></asp:TextBox>
</td>
<td class="text-right"><b>Folio Fiscal (UUID):</b></td>
<td>

View File

@@ -26,6 +26,8 @@ Partial Class PopUpBuscarFolio
CargaClasificaciones()
CargaPS(-1)
'CargaCodigoCliente()
RegistraScript($"$('#{TxtFolio.ClientID}').focus();", "A1")
End If
End Sub

View File

@@ -713,6 +713,15 @@
</asp:UpdatePanel>
</td>
</tr>
<tr id="TrLineaAdicional" runat="server" visible="false">
<td align="left"><b>Linea Adicional:</b></td>
<td align="left">
<asp:DropDownList ID="DdlLineaAdicional" DataTextField="InfoGeneral" DataValueField="CveLineaAdicional" AutoPostBack="true" CssClass=" form-control input-sm select2me" runat="server" Width="80%" OnSelectedIndexChanged="DdlLineaAdicional_SelectedIndexChanged">
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
</asp:DropDownList>
<asp:LinkButton runat="server" Visible="false" ID="LnkUpdateLineaAdicional" OnClick="LnkUpdateLineaAdicional_Click" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea actualizar la linea adicional de crédito de la factura?" data-btn-ok-label="si" Text="<i class='fa fa-check' style='color:green'></i>" CssClass="btn btn-default btn-circle btn-xs" ToolTip="Actualizar Linea adicional" />
</td>
</tr>
<tr align="left" id="TrAlmacenOrigen" runat="server" visible="False">
<td>
<asp:Label runat="server" ToolTip="Almacen Asignado" Font-Bold="true" Text="Almacen O:"></asp:Label>
@@ -2406,7 +2415,8 @@
</div>
</div>
</div>
</div> </div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="portlet light xspadding bordered whitoutcol" style="width: 100%;">
@@ -2417,12 +2427,12 @@
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
Emitir <asp:CheckBox ID="ChkEmitirComercioExterior" runat="server" CssClass="chksino" Text=" " OnCheckedChanged="ChkEmitirComercioExterior_CheckedChanged" AutoPostBack="true" />
Emitir
<asp:CheckBox ID="ChkEmitirComercioExterior" runat="server" CssClass="chksino" Text=" " OnCheckedChanged="ChkEmitirComercioExterior_CheckedChanged" AutoPostBack="true" />
<a href="javascript:;" onclick="CargaComercioExterior()" class="expand"></a>
</div>
</div>
@@ -2431,8 +2441,8 @@
<ContentTemplate>
<div class="form-body">
<%-- <div class="row rowpadding">
<%-- <div class="row rowpadding">
<label class="col-md-2">Emitir:</label>
<div class="col-md-10">
@@ -3443,17 +3453,7 @@
</div>
<div class="portlet-body formnombottom">
<table border="0" width="100%">
<tr id="TrLineaAdicional" runat="server" visible="false">
<td align="left">Linea Adicional:</td>
<td align="left">
<asp:DropDownList ID="DdlLineaAdicional" DataTextField="InfoGeneral" DataValueField="CveLineaAdicional" AutoPostBack="true" CssClass=" form-control input-sm select2me" runat="server" Width="200px" OnSelectedIndexChanged="DdlLineaAdicional_SelectedIndexChanged">
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
</asp:DropDownList>
</td>
<td align="left">
<asp:LinkButton runat="server" Visible="false" ID="LnkUpdateLineaAdicional" OnClick="LnkUpdateLineaAdicional_Click" data-toggle="confirmation" data-popout="true" data-original-title="¿Está seguro que desea actualizar la linea adicional de crédito de la factura?" data-btn-ok-label="si" Text="<i class='fa fa-check' style='color:green'></i>" CssClass="btn btn-default btn-circle btn-xs" ToolTip="Actualizar Linea adicional" />
</td>
</tr>
<tr id="TrFormaEntrega" runat="server" visible="false">
<td align="left">Forma de entrega:</td>
<td align="left">
@@ -7825,7 +7825,7 @@
</div>
</div>
<div class="tools">
<%-- <a href="javascript:;" class="collapse"></a>--%>
<%-- <a href="javascript:;" class="collapse"></a>--%>
</div>
</div>
<div class="portlet-body form-horizontal form-row-sepe formnombottom">

View File

@@ -2249,12 +2249,12 @@ Partial Class Ventas
End Set
End Property
Private Property CveClasificacionLineaAdicional As Integer
Private Property CveCategoriaLineaAdicional As Integer
Get
Return IfNull(ViewState("CveClasificacionLineaAdicional"), "-1", ViewState("CveClasificacionLineaAdicional")).ToString().ToEntero()
Return IfNull(ViewState("CveCategoriaLineaAdicional"), "-1", ViewState("CveCategoriaLineaAdicional")).ToString().ToEntero()
End Get
Set(value As Integer)
ViewState("CveClasificacionLineaAdicional") = value
ViewState("CveCategoriaLineaAdicional") = value
End Set
End Property
@@ -3173,6 +3173,7 @@ Partial Class Ventas
'TabE.Visible = False
LnkOCs.Visible = False
GvPS.Columns(8).Visible = False
DdlSubProyecto.Visible = False
TrEdit.Visible = True
ThProyecto.Visible = False
@@ -3194,6 +3195,7 @@ Partial Class Ventas
TabE.Visible = False
LnkOCs.Visible = False
GvPS.Columns(8).Visible = False
DdlSubProyecto.Visible = False
TrEdit.Visible = False
ThProyecto.Visible = False
@@ -8844,16 +8846,32 @@ Partial Class Ventas
'VALIDAR LINEAS ADICIONALES
If UsuarioActual.Empresa.Funcionalidad(705) = "1" AndAlso DdlLineaAdicional.SelectedValue.ToEntero() > 0 Then
'VERIFICA QUE LA CLASIFICACION DE LOS PRODUCTOS DEBE SER LA MISMA DE LA LINEA ADICIONAL
If TmpDT IsNot Nothing AndAlso Me.CveClasificacionLineaAdicional > 0 Then
For Each Row As DataRow In TmpDT.FiltraParametros("", DistinctColumns:={"CveClasificacion", "Clasificacion"}).Rows
If Me.CveClasificacionLineaAdicional <> Row("CveClasificacion").ToString().ToEntero() Then
Alert($"La clasificación '{Row("Clasificacion")}' no pertenece a la linea adicional.", TipoMensaje.MsgAdvertencia)
'VERIFICA QUE LA CATEGORIA DE LOS PRODUCTOS DEBE SER LA MISMA DE LA LINEA ADICIONAL
If TmpDT IsNot Nothing AndAlso Me.CveCategoriaLineaAdicional > 0 Then
For Each Row As DataRow In TmpDT.FiltraParametros("", DistinctColumns:={"CveClasificacion"}).Rows
Dim RowClasificacion = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=Row("CveClasificacion").ToString().ToEntero()).FiltroPrimero("")
If RowClasificacion IsNot Nothing Then
Dim CveCategoria As Integer = RowClasificacion("CveCategoria").ToString().ToEntero()
Dim Categoria As String = RowClasificacion("Categoria").ToString()
If Me.CveCategoriaLineaAdicional <> CveCategoria Then
Alert($"La categoría '{Categoria}' no pertenece a la linea adicional.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Else
Alert($"No se encontro la clasificación.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Next
End If
'SI NO ES A CREDITO NO SELECCIONAR LINEA ADICIONAL
If RBLPago.SelectedValue <> "1" Then
Alert($"La linea adicional debe ser utilizada en una venta a crédito.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If Me.SaldoLineaAdicional <= 0 Then
Alert("El saldo de la linea adicional debe ser mayor a cero", TipoMensaje.MsgAdvertencia)
Exit Sub
@@ -12906,7 +12924,7 @@ Partial Class Ventas
ErrorList.Add("Ocurrió un error al actualizar el estatus del pedidoA")
Else
'Remision
If Not ObjEventos.AddEventoBitacora($"Remisionado de autorización en: <a href='/Ventas/Ventas.aspx?CveVenta={ObjFactura.CveVenta}' target='_blank' class='Texto'>{ObjFactura.Folio}</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CvePedidoA) Then
If Not ObjEventos.AddEventoBitacora($"Remisionado de autorización en: <a href='/Ventas/Ventas.aspx?CveVenta={ObjFactura.CveVenta}' target='_blank' class='Texto'>{ObjFactura.SerieFolio}</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CvePedidoA) Then
ErrorList.Add("Ocurrió un error al agregar bitácora de Autorización")
End If
End If
@@ -14682,13 +14700,22 @@ Partial Class Ventas
ErrorPrepoliza = True
End If
'Factura
If Not ObjEventos.AddEventoBitacora($"Remisión facturada : <a href='/Ventas/Ventas.aspx?CveVenta={CveRemision}' target='_blank' class='Texto'>{ObjFactura.Folio}</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=ObjFactura.CveVenta) Then
If CveRemision > 0 Then
If ObjVentas.GetVenta(CveRemision, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then
Dim SerieFolioRem As String = ObjVentas.DtResultados.Rows(0)("SerieFolio").ToString()
'Factura
If Not ObjEventos.AddEventoBitacora($"Venta facturada de Remisión: <a href='/Ventas/Ventas.aspx?CveVenta={CveRemision}' target='_blank' class='Texto'>{SerieFolioRem}</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=ObjFactura.CveVenta) Then
ErrorPrepoliza = True
End If
Else
ErrorPrepoliza = True
End If
Else
ErrorPrepoliza = True
End If
'Remision
If Not ObjEventos.AddEventoBitacora($"Facturación de remisión en: <a href='/Ventas/Ventas.aspx?CveVenta={ObjFactura.CveVenta}' target='_blank' class='Texto'>{ObjFactura.Folio}</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveRemision) Then
If Not ObjEventos.AddEventoBitacora($"Remisión facturada en Venta: <a href='/Ventas/Ventas.aspx?CveVenta={ObjFactura.CveVenta}' target='_blank' class='Texto'>{ObjFactura.SerieFolio}</a>", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveRemision) Then
ErrorPrepoliza = True
End If
Next
@@ -18067,14 +18094,14 @@ Partial Class Ventas
Using ObjVentas As New ClsVentas
If CveVenta > 0 Then
If ObjVentas.GetLineasAdicionalesSaldo(-1, CveCliente, -1, DdlMoneda.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, ConSaldo:=-1) Then
If ObjVentas.GetLineasAdicionalesSaldo(-1, CveCliente, -1, DdlMoneda.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, ConSaldo:=-1, FechaVencimientoConsulta:=MinFecha) Then
If ObjVentas.DtResultados.Rows.Count > 0 Then
TrLineaAdicional.Visible = True
DdlLineaAdicional.DataSource = ObjVentas.DtResultados.FiltraParametros($"Saldo > 0 OR CveLineaAdicional = {Me.CveLineaAdicionalVenta}")
DdlLineaAdicional.DataSource = ObjVentas.DtResultados.FiltraParametros($"(Saldo > 0 AND FechaVencimiento <= '{Now.ToString("dd/MM/yyyy")}') OR CveLineaAdicional = {Me.CveLineaAdicionalVenta}")
End If
End If
Else
If ObjVentas.GetLineasAdicionalesSaldo(-1, CveCliente, -1, DdlMoneda.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, ConSaldo:=1) Then
If ObjVentas.GetLineasAdicionalesSaldo(-1, CveCliente, -1, DdlMoneda.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, ConSaldo:=1, FechaVencimientoConsulta:=Now) Then
If ObjVentas.DtResultados.Rows.Count > 0 Then
TrLineaAdicional.Visible = True
DdlLineaAdicional.DataSource = ObjVentas.DtResultados
@@ -18095,6 +18122,7 @@ Partial Class Ventas
End If
UpParametros.Update()
UPCondicionesPago.Update()
End Sub
@@ -26969,93 +26997,94 @@ Partial Class Ventas
End Sub
Private Sub CargaRNC(Optional CveVentaUsado As Integer = -1, Optional CargarBonificaciones As Boolean = False, Optional CargarSoloGarantias As Boolean = False)
Dim DtNC As DataTable = Nothing
Dim ObjMovtos As New ClsMovimientos()
If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, CveMoneda:=-1) Then
DtNC = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'RNC' AND CveVenta > 0 and Saldo > 0", "Moneda,Fecha,Folio")
End If
ObjMovtos.Dispose()
Me.TmpDTRNCBonificacionesSeleccionadas = Nothing
If DtNC IsNot Nothing Then
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))
If CargarBonificaciones Then
'Me.TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Copy()
CargaBonificaciones(-1, True)
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
Dim ObjMovtos As New ClsMovimientos()
If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, CveMoneda:=-1) Then
DtNC = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'RNC' AND CveVenta > 0 and Saldo > 0", "Moneda,Fecha,Folio")
End If
ObjMovtos.Dispose()
If CargarSoloGarantias Then
GvRemisionesNC.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = True")
Else
GvRemisionesNC.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = False")
End If
GvRemisionesNC.DataBind()
Me.TmpDTRNCBonificacionesSeleccionadas = Nothing
'GvRemisionesNCBon.DataSource = Me.TmpDTRNCBonificacionesSeleccionadas
'GvRemisionesNCBon.DataBind()
Dim SaldoMaximoUtilizable As Decimal = 0
If DtNC IsNot Nothing Then
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))
If CargarSoloGarantias Then
Dim SaldoMaximo As Decimal = DtNC.SUMD("Saldo", "TipoRNC = 1 AND EsGarantia = True")
If SaldoMaximo > 0 Then
SaldoMaximoUtilizable = SaldoMaximo
Else
SaldoMaximoUtilizable = 0
If CargarBonificaciones Then
'Me.TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Copy()
CargaBonificaciones(-1, True)
End If
Else
Dim ObjAcum As New ClsAcumuladores
If ObjAcum.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) Then
Dim RowUsadosNC As DataRow = ObjAcum.DtResultados.Rows(2)
DivSMU.Visible = True
Dim SaldoMaximo As Decimal = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal()
If CargarSoloGarantias Then
GvRemisionesNC.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = True")
Else
GvRemisionesNC.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = False")
End If
GvRemisionesNC.DataBind()
'GvRemisionesNCBon.DataSource = Me.TmpDTRNCBonificacionesSeleccionadas
'GvRemisionesNCBon.DataBind()
Dim SaldoMaximoUtilizable As Decimal = 0
If CargarSoloGarantias Then
Dim SaldoMaximo As Decimal = DtNC.SUMD("Saldo", "TipoRNC = 1 AND EsGarantia = True")
If SaldoMaximo > 0 Then
SaldoMaximoUtilizable = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal()
SaldoMaximoUtilizable = SaldoMaximo
Else
SaldoMaximoUtilizable = 0
End If
Else
SaldoMaximoUtilizable = 0
End If
ObjAcum.Dispose()
End If
Dim ObjAcum As New ClsAcumuladores
If ObjAcum.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) Then
Dim RowUsadosNC As DataRow = ObjAcum.DtResultados.Rows(2)
DivSMU.Visible = True
If CveVentaUsado > 0 Then
DivSMU.Visible = True
'Dim FacUsado As New Modelos.Factura(UsuarioActual, CveVentaUsado, UsuarioActual.CveEmpresa, CargaDatosCliente:=False, CargaDatosRelacionados:=False)
Dim DtDetalleUsado As DataTable = Nothing
Using ObjVentas As New ClsVentas
If ObjVentas.GetVentaDetalle(CveVentaUsado) Then
DtDetalleUsado = ObjVentas.DtResultados.Copy()
Dim SaldoMaximo As Decimal = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal()
If SaldoMaximo > 0 Then
SaldoMaximoUtilizable = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal()
Else
SaldoMaximoUtilizable = 0
End If
Else
SaldoMaximoUtilizable = 0
End If
End Using
ObjAcum.Dispose()
End If
If DtDetalleUsado IsNot Nothing Then
Dim SaldoMaximoUsadosFactura As Decimal = DtDetalleUsado.SUM("Total", "EsCargo = True").ToDecimal() + DtDetalleUsado.SUM("ImporteIVA", "EsCargo = True").ToDecimal()
If SaldoMaximoUtilizable < SaldoMaximoUsadosFactura Then
If CveVentaUsado > 0 Then
DivSMU.Visible = True
'Dim FacUsado As New Modelos.Factura(UsuarioActual, CveVentaUsado, UsuarioActual.CveEmpresa, CargaDatosCliente:=False, CargaDatosRelacionados:=False)
Dim DtDetalleUsado As DataTable = Nothing
Using ObjVentas As New ClsVentas
If ObjVentas.GetVentaDetalle(CveVentaUsado) Then
DtDetalleUsado = ObjVentas.DtResultados.Copy()
End If
End Using
If DtDetalleUsado IsNot Nothing Then
Dim SaldoMaximoUsadosFactura As Decimal = DtDetalleUsado.SUM("Total", "EsCargo = True").ToDecimal() + DtDetalleUsado.SUM("ImporteIVA", "EsCargo = True").ToDecimal()
If SaldoMaximoUtilizable < SaldoMaximoUsadosFactura Then
HdnSaldoMaximoUsados.Value = SaldoMaximoUtilizable.ToString()
LtlSMU.Text = String.Format("{0:N2}", SaldoMaximoUtilizable)
Else
HdnSaldoMaximoUsados.Value = SaldoMaximoUsadosFactura.ToString()
LtlSMU.Text = String.Format("{0:N2}", SaldoMaximoUsadosFactura)
End If
Else
HdnSaldoMaximoUsados.Value = SaldoMaximoUtilizable.ToString()
LtlSMU.Text = String.Format("{0:N2}", SaldoMaximoUtilizable)
Else
HdnSaldoMaximoUsados.Value = SaldoMaximoUsadosFactura.ToString()
LtlSMU.Text = String.Format("{0:N2}", SaldoMaximoUsadosFactura)
End If
Else
HdnSaldoMaximoUsados.Value = SaldoMaximoUtilizable.ToString()
LtlSMU.Text = String.Format("{0:N2}", SaldoMaximoUtilizable)
LtlSMU.Text = SaldoMaximoUtilizable.FormatoNumero(2)
End If
Else
HdnSaldoMaximoUsados.Value = SaldoMaximoUtilizable.ToString()
LtlSMU.Text = SaldoMaximoUtilizable.FormatoNumero(2)
HdnSaldoMaximoUsados.Value = "0"
LtlSMU.Text = "0"
End If
Else
HdnSaldoMaximoUsados.Value = "0"
LtlSMU.Text = "0"
End If
UpModalRemisionesNC.Update()
@@ -27064,81 +27093,83 @@ Partial Class Ventas
Private Sub CargaRNCDesc(Optional CargarBonificaciones As Boolean = False, Optional CargarSoloGarantias As Boolean = False)
Dim DtNC As DataTable = Nothing
Dim ObjMovtos As New ClsMovimientos()
If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, CveMoneda:=-1) Then
DtNC = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'RNC' AND CveVenta > 0 and Saldo > 0", "Moneda,Fecha,Folio")
End If
ObjMovtos.Dispose()
Me.TmpDTRNCBonificacionesSeleccionadas = Nothing
If DtNC IsNot Nothing Then
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))
If CargarBonificaciones Then
'Me.TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Copy()
CargaBonificacionesDesc("-1", True)
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
Dim ObjMovtos As New ClsMovimientos()
If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, CveMoneda:=-1) Then
DtNC = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'RNC' AND CveVenta > 0 and Saldo > 0", "Moneda,Fecha,Folio")
End If
ObjMovtos.Dispose()
If CargarSoloGarantias Then
GvDescNCCargos.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = True")
Else
GvDescNCCargos.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = False")
End If
GvDescNCCargos.DataBind()
Me.TmpDTRNCBonificacionesSeleccionadas = Nothing
Dim SaldoMaximoCliente As Decimal = 0
Dim SaldoEntregado As Decimal = 0
If DtNC IsNot Nothing Then
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))
If CargarSoloGarantias Then
Dim SaldoMaximo As Decimal = DtNC.SUMD("Saldo", "TipoRNC = 1 AND EsGarantia = True")
If SaldoMaximo > 0 Then
SaldoMaximoCliente = SaldoMaximo
Else
SaldoMaximoCliente = 0
If CargarBonificaciones Then
'Me.TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Copy()
CargaBonificacionesDesc("-1", True)
End If
Else
Dim ObjAcum As New ClsAcumuladores
If ObjAcum.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) Then
Dim RowUsadosNC As DataRow = ObjAcum.DtResultados.Rows(2)
DivSMU.Visible = True
Dim SaldoMaximo As Decimal = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal()
If CargarSoloGarantias Then
GvDescNCCargos.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = True")
Else
GvDescNCCargos.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = False")
End If
GvDescNCCargos.DataBind()
Dim SaldoMaximoCliente As Decimal = 0
Dim SaldoEntregado As Decimal = 0
If CargarSoloGarantias Then
Dim SaldoMaximo As Decimal = DtNC.SUMD("Saldo", "TipoRNC = 1 AND EsGarantia = True")
If SaldoMaximo > 0 Then
SaldoMaximoCliente = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal()
SaldoMaximoCliente = SaldoMaximo
Else
SaldoMaximoCliente = 0
End If
Dim RowEntregado As DataRow = ObjAcum.DtResultados.Rows(1)
SaldoEntregado = RowEntregado("ValorConImpuestos").ToString().ToDecimal()
Else
SaldoMaximoCliente = 0
Dim ObjAcum As New ClsAcumuladores
If ObjAcum.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) Then
Dim RowUsadosNC As DataRow = ObjAcum.DtResultados.Rows(2)
DivSMU.Visible = True
Dim SaldoMaximo As Decimal = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal()
If SaldoMaximo > 0 Then
SaldoMaximoCliente = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal()
Else
SaldoMaximoCliente = 0
End If
Dim RowEntregado As DataRow = ObjAcum.DtResultados.Rows(1)
SaldoEntregado = RowEntregado("ValorConImpuestos").ToString().ToDecimal()
Else
SaldoMaximoCliente = 0
End If
ObjAcum.Dispose()
End If
ObjAcum.Dispose()
End If
Dim SaldoMaximoUsadosFactura As Decimal = Me.TmpDT.SUM("Total", "EsCargo = True").ToDecimal() + Me.TmpDT.SUM("ImporteIVA", "EsCargo = True").ToDecimal()
Dim SaldoMaximoUsadosFactura As Decimal = Me.TmpDT.SUM("Total", "EsCargo = True").ToDecimal() + Me.TmpDT.SUM("ImporteIVA", "EsCargo = True").ToDecimal()
If SaldoMaximoCliente > 0 AndAlso SaldoMaximoCliente < SaldoMaximoUsadosFactura Then
SaldoMaximoUsadosFactura = SaldoMaximoCliente
End If
If SaldoMaximoCliente > 0 AndAlso SaldoMaximoCliente < SaldoMaximoUsadosFactura Then
SaldoMaximoUsadosFactura = SaldoMaximoCliente
End If
Dim SaldoMaximoUtilizable = If(SaldoMaximoUsadosFactura < SaldoEntregado, SaldoMaximoUsadosFactura, SaldoEntregado)
Dim SaldoMaximoUtilizable = If(SaldoMaximoUsadosFactura < SaldoEntregado, SaldoMaximoUsadosFactura, SaldoEntregado)
If SaldoMaximoUtilizable > 0 Then
HdnSaldoMaximoUsados.Value = SaldoMaximoUtilizable.ToString()
LblSaldoMaximoUsados.Text = String.Format("{0:N2}", SaldoMaximoUtilizable)
Else
HdnSaldoMaximoUsados.Value = "0"
LblSaldoMaximoUsados.Text = String.Format("{0:N2}", 0)
End If
If SaldoMaximoUtilizable > 0 Then
HdnSaldoMaximoUsados.Value = SaldoMaximoUtilizable.ToString()
LblSaldoMaximoUsados.Text = String.Format("{0:N2}", SaldoMaximoUtilizable)
Else
HdnSaldoMaximoUsados.Value = "0"
LblSaldoMaximoUsados.Text = String.Format("{0:N2}", 0)
LblSaldoMaximoUsados.Text = "0"
End If
Else
HdnSaldoMaximoUsados.Value = "0"
LblSaldoMaximoUsados.Text = "0"
End If
UpDescNC.Update()
@@ -35289,35 +35320,52 @@ Partial Class Ventas
RBLPago.Enabled = False
Using ObjVentas As New ClsVentas
If ObjVentas.GetLineasAdicionalesSaldo(DdlLineaAdicional.SelectedValue.ToEntero(), CveCliente, -1, DdlMoneda.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa) Then
If ObjVentas.GetLineasAdicionalesSaldo(DdlLineaAdicional.SelectedValue.ToEntero(), CveCliente, -1, DdlMoneda.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, FechaVencimientoConsulta:=MinFecha) Then
If ObjVentas.DtResultados.Rows.Count > 0 Then
TxtFechaPago.Text = ObjVentas.DtResultados.Rows(0)("FechaVencimiento").ToString().ToDateTime().ToString("dd/MM/yyyy")
Me.SaldoLineaAdicional = ObjVentas.DtResultados.Rows(0)("Saldo").ToString().ToDecimal()
Me.CveClasificacionLineaAdicional = ObjVentas.DtResultados.Rows(0)("CveClasificacionPS").ToString().ToEntero()
Me.CveCategoriaLineaAdicional = ObjVentas.DtResultados.Rows(0)("CveCategoria").ToString().ToEntero()
Me.CveMonedaLineaAdicional = ObjVentas.DtResultados.Rows(0)("CveMoneda").ToString().ToEntero()
End If
End If
End Using
Else
Me.SaldoLineaAdicional = 0
Me.CveClasificacionLineaAdicional = 0
Me.CveCategoriaLineaAdicional = 0
End If
UpParametros.Update()
UPCondicionesPago.Update()
End Sub
Protected Sub LnkUpdateLineaAdicional_Click(sender As Object, e As EventArgs)
'VALIDAR LINEAS ADICIONALES
If UsuarioActual.Empresa.Funcionalidad(705) = "1" AndAlso DdlLineaAdicional.SelectedValue.ToEntero() > 0 Then
'VERIFICA QUE LA CLASIFICACION DE LOS PRODUCTOS DEBE SER LA MISMA DE LA LINEA ADICIONAL
If TmpDT IsNot Nothing AndAlso Me.CveClasificacionLineaAdicional > 0 Then
For Each Row As DataRow In TmpDT.FiltraParametros("", DistinctColumns:={"CveClasificacion", "Clasificacion"}).Rows
If Me.CveClasificacionLineaAdicional <> Row("CveClasificacion").ToString().ToEntero() Then
Alert($"La clasificación '{Row("Clasificacion")}' no pertenece a la linea adicional.", TipoMensaje.MsgAdvertencia)
'VERIFICA QUE LA CATEGORIA DE LOS PRODUCTOS DEBE SER LA MISMA DE LA LINEA ADICIONAL
If TmpDT IsNot Nothing AndAlso Me.CveCategoriaLineaAdicional > 0 Then
For Each Row As DataRow In TmpDT.FiltraParametros("", DistinctColumns:={"CveClasificacion"}).Rows
Dim RowClasificacion = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=Row("CveClasificacion").ToString().ToEntero()).FiltroPrimero("")
If RowClasificacion IsNot Nothing Then
Dim CveCategoria As Integer = RowClasificacion("CveCategoria").ToString().ToEntero()
Dim Categoria As String = RowClasificacion("Categoria").ToString()
If Me.CveCategoriaLineaAdicional <> CveCategoria Then
Alert($"La categoría '{Categoria}' no pertenece a la linea adicional.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Else
Alert($"No se encontro la clasificación.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Next
End If
'SI NO ES A CREDITO NO SELECCIONAR LINEA ADICIONAL
If RBLPago.SelectedValue <> "1" Then
Alert($"La linea adicional debe ser utilizada en una venta a crédito.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If Me.SaldoLineaAdicional <= 0 Then
Alert("El saldo de la linea adicional debe ser mayor a cero", TipoMensaje.MsgAdvertencia)
Exit Sub