Pendientes BDH
This commit is contained in:
@@ -520,6 +520,11 @@ Namespace Modelos
|
||||
Me.DtOtrosConceptos = ObjVentas.DtResultados.Copy()
|
||||
End If
|
||||
|
||||
'CARGA REMISIONES RELACIONADAS
|
||||
If ObjVentas.GetRemisionesRelacionadas(CveVenta, TipoDocto) Then
|
||||
Me.DtRemisionesDocumentosRelacionados = ObjVentas.DtResultados.Copy()
|
||||
End If
|
||||
|
||||
ObjVentas.Dispose()
|
||||
|
||||
If Me.RealizarDevolucionAlmacen Then
|
||||
@@ -5806,6 +5811,8 @@ Namespace Modelos
|
||||
Public Property DtDocumentacionCliente As Data.DataTable
|
||||
Public Property DtContratosSerieDetalle As Data.DataTable
|
||||
Public Property DtOtrosConceptos As Data.DataTable
|
||||
|
||||
Public Property DtRemisionesDocumentosRelacionados As Data.DataTable
|
||||
Public Property DtInventario As Data.DataTable
|
||||
'Public Property DtAnticipoAmortizacion As Data.DataTable
|
||||
Public Property DtRemConceptosSurtidos As Data.DataTable
|
||||
|
||||
@@ -2307,6 +2307,7 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL())
|
||||
Dim ObjOC As New ClsOC(ObjInventario.IniciaTransacSQL())
|
||||
Dim ObjAcum As New ClsAcumuladores(ObjInventario.IniciaTransacSQL())
|
||||
Dim ObjVentas As New ClsVentas(ObjInventario.IniciaTransacSQL())
|
||||
Dim ObjContaAC As ClsContPAQi = Nothing
|
||||
Dim ObjContaContPAQ As ClsContPAQi = Nothing
|
||||
|
||||
@@ -2629,6 +2630,36 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
If Not ErrorMovInv Then
|
||||
MovtosEntradaExA.Add(MovEntradaExA.CveMovimiento)
|
||||
FoliosEntradaExA.Add(MovEntradaExA.Folio)
|
||||
|
||||
'SI LA REMISION FUE FACTURADA GENERA EL MOVIMIENTO DE SALIDA DIRECTA
|
||||
If ObjFactura.DtRemisionesDocumentosRelacionados.Rows.Count > 0 Then
|
||||
If ObjVentas.VerificarRemisionFacturada(ObjFactura.CveVenta) Then
|
||||
|
||||
Dim dttsalida As DataTable = dttexa.Copy
|
||||
'se limpia la seccion, para que lo tome automaticamente
|
||||
For Each drr As DataRow In dttsalida.Rows
|
||||
Dim RowFactura As DataRow = ObjVentas.DtResultados.FiltroPrimero($"CveVentaDetalleRemision={drr("CveVentaDetalle")}")
|
||||
drr("CveVentaDetalle") = RowFactura("CveVentaDetalleFacturada")
|
||||
drr("CveVenta") = RowFactura("CveVenta")
|
||||
Next
|
||||
|
||||
For Each DrFactura As DataRow In Dt.FiltraParametros("", DistinctColumns:={"CveVenta"}).Rows
|
||||
Dim dtSalidaFactura As DataTable = dttsalida.FiltraParametros($"CveVenta={DrFactura("CveVenta")}")
|
||||
Dim MovSalidaDirectaExA = GenerarMovimientoAlmacenVenta(ObjFactura.CveAlmacenTraspasoDestino, 40, DrFactura("CveVenta").ToString().ToEntero(), MovEntradaExA.CveMovimiento, dtSalidaFactura, ObjInventario, ObjConta, ObjContaContPAQ, False, "RA/G2R3")
|
||||
|
||||
ErrorMovInv = MovSalidaDirectaExA.CveMovimiento <= 0
|
||||
|
||||
If ErrorMovInv Then
|
||||
Exit For
|
||||
Else
|
||||
MovtosSalidaDirecta.Add(MovSalidaDirectaExA.CveMovimiento)
|
||||
FoliosSalidaDirecta.Add(MovSalidaDirectaExA.Folio)
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
@@ -3459,6 +3490,8 @@ Partial Class Inventarios_RecepcionAlmacen
|
||||
link = String.Format("<a href=""/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}"" target=""_blank"">{1}</a>", MovtosSalidaDirecta(index), FoliosSalidaDirecta(index))
|
||||
Msg.AppendFormat("<br/>Movimiento de Salida Folio: <b>{0}</b>", link)
|
||||
Next
|
||||
|
||||
|
||||
End If
|
||||
|
||||
'APARTADO
|
||||
|
||||
@@ -4281,7 +4281,7 @@
|
||||
|
||||
|
||||
<asp:BoundField DataField="Concepto" HeaderText="Concepto" />
|
||||
<asp:BoundField DataField="Tamaño" HeaderText="Tamaño" />
|
||||
<asp:BoundField DataField="CodigoPS" HeaderText="Tamaño" />
|
||||
|
||||
<asp:BoundField DataField="Cantidad" HeaderText="Cantidad" DataFormatString="{0:n}" ItemStyle-HorizontalAlign="Right" ControlStyle-BorderWidth="150px" />
|
||||
<asp:BoundField DataField="Puntos" HeaderText="Puntos" DataFormatString="{0:n}" ItemStyle-HorizontalAlign="Right" ControlStyle-BorderWidth="150px" />
|
||||
|
||||
@@ -9143,7 +9143,7 @@ Partial Class Clientes
|
||||
Dim ImporteBonificacion As Decimal = 0
|
||||
If ObjAcum.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) AndAlso ObjAcum.DtResultados.Rows.Count >= 4 Then
|
||||
GvUsadosResumen.DataSource = ObjAcum.DtResultados
|
||||
ImporteBonificacion = ObjAcum.DtResultados.Rows(4)("Valor").ToString().ToDecimal()
|
||||
ImporteBonificacion = ObjAcum.DtResultados.Rows(5)("Valor").ToString().ToDecimal()
|
||||
End If
|
||||
GvUsadosResumen.DataBind()
|
||||
|
||||
|
||||
@@ -1371,16 +1371,16 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr align="right">
|
||||
<td style="border: 1px none white"><b>Total NC:</b></td>
|
||||
<td style="border: 1px none white"><b>Pronto Pago:</b></td>
|
||||
<td>
|
||||
<asp:Label ID="LblTotalNC" ClientIDMode="Static" runat="server" Style="text-align: right;" Text="0.00" Width="78px"></asp:Label></td>
|
||||
<asp:Label ID="LblProntoPago" ClientIDMode="Static" runat="server" Style="text-align: right;" Text="0.00" Width="78px"></asp:Label></td>
|
||||
<td align="right">
|
||||
</td>
|
||||
</tr>
|
||||
<tr align="right">
|
||||
<td style="border: 1px none white"><b>Pronto Pago:</b></td>
|
||||
<td style="border: 1px none white"><b>Total a Pagar:</b></td>
|
||||
<td>
|
||||
<asp:Label ID="LblProntoPago" ClientIDMode="Static" runat="server" Style="text-align: right;" Text="0.00" Width="78px"></asp:Label></td>
|
||||
<asp:Label ID="LblTotalAPagar" ClientIDMode="Static" runat="server" Style="text-align: right;" Text="0.00" Width="78px"></asp:Label></td>
|
||||
<td align="right">
|
||||
</td>
|
||||
</tr>
|
||||
@@ -6340,8 +6340,8 @@
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<asp:RadioButtonList ID="RblRNCTipo" runat="server" RepeatDirection="Horizontal" CssClass="input-group col-md-12" CellSpacing="100" AutoPostBack="true" OnSelectedIndexChanged="RblRNCTipo_SelectedIndexChanged">
|
||||
<asp:ListItem Value="1" Class="one" Selected="True"><label><b>Cargos</b></label></asp:ListItem>
|
||||
<asp:ListItem Value="2" Class="one"><label><b>Bonificaciones</b></label></asp:ListItem>
|
||||
<asp:ListItem Value="1" Class="one" Selected="True"><label><b>Cargos</b></label></asp:ListItem>
|
||||
<asp:ListItem Value="3" Class="one"><label><b>Ajuste/Garantía</b></label></asp:ListItem>
|
||||
</asp:RadioButtonList>
|
||||
</div>
|
||||
|
||||
@@ -2582,7 +2582,7 @@ Partial Class Ventas
|
||||
'DdlEstatus.SelectedValueExist("2")
|
||||
|
||||
ConfiguraTipoDocto()
|
||||
CargaFolios()
|
||||
|
||||
|
||||
BtnEmitirImprimir.Text = "Facturar"
|
||||
BtnEmitirImprimir.Visible = True
|
||||
@@ -2615,6 +2615,7 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
If Not ExFolioFactura Then SetPermisos()
|
||||
If CveVenta < 1 Then CargaFolios()
|
||||
|
||||
'SELECCIONA VENDEDOR DEL USUARIO CUANDO SEA VENTA NUEVA Y SIN CLIENTE
|
||||
If UsuarioActual.CveVendedor > 0 Then
|
||||
@@ -4819,7 +4820,8 @@ Partial Class Ventas
|
||||
Else
|
||||
BtnGenerarRemision.Visible = False
|
||||
End If
|
||||
BtnsFacturar.Visible = True
|
||||
If UsuarioActual.TienePermisoProceso(60) Then BtnsFacturar.Visible = True 'puede facturar
|
||||
|
||||
LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
|
||||
End If
|
||||
End If
|
||||
@@ -5895,7 +5897,7 @@ Partial Class Ventas
|
||||
LnkCotizaciones.Visible = False
|
||||
End If
|
||||
UPCondicionesPago.Update()
|
||||
ElseIf UsuarioActual.CveEmpresa.Contiene(72, 80, 146, 119) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso CveVenta < 1 Then
|
||||
ElseIf UsuarioActual.CveEmpresa.Contiene(72, 80, 119, 146, 158, 140) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso CveVenta < 1 Then
|
||||
RBLPago.SelectedValue = "1"
|
||||
RBLPago_SelectedIndexChanged(Nothing, Nothing)
|
||||
UPCondicionesPago.Update()
|
||||
@@ -5969,7 +5971,7 @@ Partial Class Ventas
|
||||
End If
|
||||
If Alertas Then Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
|
||||
Else
|
||||
If Alertas Then Alert("El cliente tiene su límite de crédito agotado.", TipoMensaje.MsgAdvertencia)
|
||||
If Alertas AndAlso UsuarioActual.Empresa.Funcionalidad(518) = "1" Then Alert("El cliente tiene su límite de crédito agotado.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
'RBLPago.SelectedValue = "2"
|
||||
@@ -5990,6 +5992,9 @@ Partial Class Ventas
|
||||
LnkPedido2SinFacturar.Visible = False
|
||||
LnkCotizaciones.Visible = False
|
||||
LnkOCs.Visible = False
|
||||
|
||||
Else
|
||||
If Alertas AndAlso UsuarioActual.Empresa.Funcionalidad(518) = "1" Then Alert("El cliente tiene su límite de crédito agotado.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
End If
|
||||
UPPCreditoDisponible.Update()
|
||||
@@ -10795,19 +10800,30 @@ Partial Class Ventas
|
||||
End Try
|
||||
|
||||
'SI SE FACTURA UNA RNC SE MUESTRA
|
||||
If UsuarioActual.CveEmpresa = 140 AndAlso factura.TipoDocto = "Egs" Then
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso factura.TipoDocto = "Egs" Then
|
||||
If Row("CveVentaDetalleRNC").ToString().ToEntero() > 0 Then
|
||||
|
||||
If Not ObjVentas.AddVentaDetalleRNCFacturada(Row("CveVentaDetalleRNC").ToString().ToEntero(), ObjVentas.CveVentaDetalle, Row("Cantidad").ToString().ToDecimal()) Then
|
||||
ErrorList.Add("Ocurrió un error al agregar la venta detalle devolución.")
|
||||
End If
|
||||
|
||||
Dim EsCargo As Boolean = False
|
||||
Dim ListaRNC As List(Of Modelos.Factura) = Nothing
|
||||
|
||||
If NCDescuento Then
|
||||
EsCargo = (Not ListaNCDescuento.Any(Function(RNC) RNC.Num2 = 1))
|
||||
ListaRNC = ListaNCDescuento
|
||||
Else
|
||||
EsCargo = RblRNCTipo.SelectedValue = "1"
|
||||
ListaRNC = ListaRemisionesNC
|
||||
End If
|
||||
|
||||
'SI SE FACTURAN RNC DE CARGO, SE AGREGA EL CONCEPTO DE ACREDITAMIENTO
|
||||
If ClienteEsDistribuidor AndAlso RblRNCTipo.SelectedValue = "1" Then
|
||||
If ListaRNC IsNot Nothing AndAlso ClienteEsDistribuidor AndAlso EsCargo Then
|
||||
Dim ObjAcum As New ClsAcumuladores(ObjVentas.IniciaTransacSQL())
|
||||
|
||||
Dim CvePSCargo As Integer = -1
|
||||
For Each RNC In ListaRemisionesNC
|
||||
For Each RNC In ListaRNC
|
||||
CvePSCargo = RNC.DtDetalle.FiltroPrimeroValor("CvePS", $"CveVentaDetalle={Row("CveVentaDetalleRNC").ToString()}").ToEntero()
|
||||
If CvePSCargo > 0 Then
|
||||
Exit For
|
||||
@@ -15870,13 +15886,13 @@ Partial Class Ventas
|
||||
If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count > 0 AndAlso (Not CveVenta > 0 Or EsCreaApartirDe Or CveDevolucion > 0) Then RecalculaIVA()
|
||||
'ViewState("SubProyectoPorcentajeIVA") = dr("IVA")
|
||||
ViewState("TipoFormato") = dr("TipoFormato")
|
||||
ViewState("Serie") = dr("Serie")
|
||||
'ViewState("Serie") = dr("Serie")
|
||||
|
||||
If UsuarioActual.CveEmpresa = 140 AndAlso Me.CveVenta > 0 AndAlso Not EsCreaApartirDe AndAlso Not String.IsNullOrEmpty(SerieVenta) Then
|
||||
LblSerie.Text = SerieVenta
|
||||
Else
|
||||
LblSerie.Text = dr("Serie").ToString()
|
||||
End If
|
||||
'If UsuarioActual.CveEmpresa = 140 AndAlso Me.CveVenta > 0 AndAlso Not EsCreaApartirDe AndAlso Not String.IsNullOrEmpty(SerieVenta) Then
|
||||
' LblSerie.Text = SerieVenta
|
||||
'Else
|
||||
' LblSerie.Text = dr("Serie").ToString()
|
||||
'End If
|
||||
|
||||
If SerieXML <> "" Then LblSerie.Text = SerieXML
|
||||
Dim CveSubProyecto As Integer = GetSubProyectoSucursal()
|
||||
@@ -16274,7 +16290,7 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
'SI TIENE PRONTO PAGO CALCULA EL IMPORTE
|
||||
If RowPorcentaje("ProntoPago").ToString().ToDecimal() > 0 Then
|
||||
If DdlTipoComprobante.SelectedValue = "Ing" AndAlso RowPorcentaje("ProntoPago").ToString().ToDecimal() > 0 Then
|
||||
Dim TotalProntoPago As Decimal = (Cantidad * (PU)) - Descuento
|
||||
Dim PorcentajeProntoPago = RowPorcentaje("ProntoPago").ToString().ToDecimal() / 100D
|
||||
|
||||
@@ -17376,6 +17392,11 @@ Partial Class Ventas
|
||||
TotalAmortizacion = 0
|
||||
End If
|
||||
|
||||
Dim TotalRemNCAplicado As Decimal = 0
|
||||
|
||||
If TbDescuentosRNC.Visible AndAlso ListaNCDesc IsNot Nothing Then
|
||||
TotalRemNCAplicado = ListaNCDesc.Sum(Function(RNC) RNC.TotalRemNCAplicado)
|
||||
End If
|
||||
|
||||
Total = (TotalSubTotal - TotalDescuentos - TotalAmortizacion + TotalIVA + TotalIEPS - TotalRetIVA - TotalRetISR - TotalImpuestosLocales)
|
||||
LblSubTotal1.Text = TotalSubTotal.FormatoNumero(2)
|
||||
@@ -17391,6 +17412,8 @@ Partial Class Ventas
|
||||
HdnProntoPago.Value = TotalProntoPago.ToString()
|
||||
LblProntoPago.Text = TotalProntoPago.FormatoNumero(2)
|
||||
|
||||
LblTotalAPagar.Text = (TxtTotal.Text.ToDecimal() - TotalRemNCAplicado - TotalProntoPago).FormatoNumero
|
||||
|
||||
LblAmort.Text = TxtSubTotal.Text
|
||||
If CveVenta <= 0 OrElse (CveDevolucion > 0 And NuevaFactura = 1) Then
|
||||
HdnVentaSaldo.Value = Total.ToString()
|
||||
@@ -20111,7 +20134,7 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(572) = "1" Then
|
||||
Dim TotalNC As Decimal = If((ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0) OrElse (ListaNCBonificacion IsNot Nothing AndAlso ListaNCBonificacion.Count > 0), LblTotalNC.Text.Trim().ToDecimal(), 0)
|
||||
Dim TotalNC As Decimal = If((ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0) OrElse (ListaNCBonificacion IsNot Nothing AndAlso ListaNCBonificacion.Count > 0), LblTotalAPagar.Text.Trim().ToDecimal(), 0)
|
||||
If TotalNC > 0 Then
|
||||
If (DtPagos.SUM("Importe").ToString().ToDecimal() + AmortizacionNC + Total - TxtCambio.Text.ToDecimal) > TotalNC Then
|
||||
Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia)
|
||||
@@ -24204,7 +24227,8 @@ Partial Class Ventas
|
||||
Me.TmpDTRNCBonificacionesCliente.Columns.Add("CveVentaRNCCargo", GetType(Integer))
|
||||
|
||||
If CargarBonificaciones Then
|
||||
Me.TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Copy()
|
||||
'Me.TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Copy()
|
||||
CargaBonificaciones(-1, True)
|
||||
End If
|
||||
|
||||
If CargarSoloGarantias Then
|
||||
@@ -24212,10 +24236,10 @@ Partial Class Ventas
|
||||
Else
|
||||
GvRemisionesNC.DataSource = DtNC.FiltraParametros("TipoRNC = 1 AND EsGarantia = False")
|
||||
End If
|
||||
GvRemisionesNCBon.DataSource = Me.TmpDTRNCBonificacionesSeleccionadas
|
||||
|
||||
GvRemisionesNC.DataBind()
|
||||
GvRemisionesNCBon.DataBind()
|
||||
|
||||
'GvRemisionesNCBon.DataSource = Me.TmpDTRNCBonificacionesSeleccionadas
|
||||
'GvRemisionesNCBon.DataBind()
|
||||
|
||||
If CveVentaUsado > 0 Then
|
||||
DivSMU.Visible = True
|
||||
@@ -24344,6 +24368,11 @@ Partial Class Ventas
|
||||
Dim ChkAplicarRNC As CheckBox = DirectCast(sender, CheckBox)
|
||||
Dim GvRow As GridViewRow = DirectCast(ChkAplicarRNC.NamingContainer, GridViewRow)
|
||||
|
||||
CargaBonificacionesDesc(GvRow.DataKey("CveVenta").ToEntero(), ChkAplicarRNC.Checked)
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub CargaBonificacionesDesc(CveVentaRNCCargo As Integer, AplicarRNC As Boolean)
|
||||
If TmpDTRNCBonificacionesSeleccionadas Is Nothing Then
|
||||
TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Clone()
|
||||
End If
|
||||
@@ -24353,7 +24382,7 @@ Partial Class Ventas
|
||||
Dim SbFiltro As New StringBuilder()
|
||||
SbFiltro.Append("CveVenta IN(")
|
||||
Using ObjAcum As New ClsAcumuladores
|
||||
If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=GvRow.DataKey("CveVenta").ToEntero()) Then
|
||||
If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=CveVentaRNCCargo) Then
|
||||
DtBon = ObjAcum.DtResultados.Copy()
|
||||
End If
|
||||
End Using
|
||||
@@ -24370,7 +24399,7 @@ Partial Class Ventas
|
||||
|
||||
For Each bon In queryBonificacion
|
||||
SbFiltro.AppendFormat("'{0}',", bon.CveVentaBonificacion)
|
||||
ListaBon.Add(New VentasBonificaciones() With {.CveVentaRNCCargo = GvRow.DataKey("CveVenta").ToEntero(), .CveVentaBonificacion = bon.CveVentaBonificacion, .ImporteBonificacion = bon.ImporteBonificacion, .IVABonificacion = bon.IVABonificacion})
|
||||
ListaBon.Add(New VentasBonificaciones() With {.CveVentaRNCCargo = CveVentaRNCCargo, .CveVentaBonificacion = bon.CveVentaBonificacion, .ImporteBonificacion = bon.ImporteBonificacion, .IVABonificacion = bon.IVABonificacion})
|
||||
Next
|
||||
SbFiltro.Remove(SbFiltro.Length - 1, 1)
|
||||
SbFiltro.Append(")")
|
||||
@@ -24384,9 +24413,9 @@ Partial Class Ventas
|
||||
|
||||
RowBonificacion("ImporteBonificacion") = RNCBonificacion.Sum(Function(x) x.ImporteBonificacion)
|
||||
RowBonificacion("IVABonificacion") = RNCBonificacion.Sum(Function(x) x.IVABonificacion)
|
||||
RowBonificacion("CveVentaRNCCargo") = GvRow.DataKey("CveVenta").ToEntero()
|
||||
RowBonificacion("CveVentaRNCCargo") = CveVentaRNCCargo
|
||||
|
||||
If ChkAplicarRNC.Checked Then
|
||||
If AplicarRNC Then
|
||||
TmpDTRNCBonificacionesSeleccionadas.Rows.Add(RowBonificacion.ItemArray)
|
||||
Else
|
||||
For Each RowEliminar In Me.TmpDTRNCBonificacionesSeleccionadas.Select(SbFiltro.ToString())
|
||||
@@ -24410,12 +24439,16 @@ Partial Class Ventas
|
||||
LblSaldoMaximoBonificacion.Text = String.Format("{0:N2}", Me.TmpDTRNCBonificacionesSeleccionadas.SUM("ImporteBonificacion").ToDecimal() + Me.TmpDTRNCBonificacionesSeleccionadas.SUM("IVABonificacion").ToDecimal())
|
||||
|
||||
UpDescNC.Update()
|
||||
|
||||
End Sub
|
||||
Protected Sub ChkAplicarNCBon_CheckedChanged(sender As Object, e As EventArgs)
|
||||
Dim ChkAplicarRNC As CheckBox = DirectCast(sender, CheckBox)
|
||||
Dim GvRow As GridViewRow = DirectCast(ChkAplicarRNC.NamingContainer, GridViewRow)
|
||||
|
||||
CargaBonificaciones(GvRow.DataKey("CveVenta").ToEntero(), ChkAplicarRNC.Checked)
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub CargaBonificaciones(CveVentaRNCCargo As Integer, AplicarRNC As Boolean)
|
||||
If TmpDTRNCBonificacionesSeleccionadas Is Nothing Then
|
||||
TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Clone()
|
||||
End If
|
||||
@@ -24425,16 +24458,18 @@ Partial Class Ventas
|
||||
Dim SbFiltro As New StringBuilder()
|
||||
SbFiltro.Append("CveVenta IN(")
|
||||
Using ObjAcum As New ClsAcumuladores
|
||||
If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=GvRow.DataKey("CveVenta").ToEntero()) Then
|
||||
If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=CveVentaRNCCargo) Then
|
||||
DtBon = ObjAcum.DtResultados.Copy()
|
||||
End If
|
||||
End Using
|
||||
|
||||
If DtBon IsNot Nothing Then
|
||||
Dim queryBonificacion = From dr In DtBon
|
||||
Group By CveVentaBonificacion = dr("CveVentaBonificacion").ToString().ToEntero
|
||||
Where dr("CveVentaBonificacion").ToString().ToEntero > 0
|
||||
Group By CveVentaBonificacion = dr("CveVentaBonificacion").ToString().ToEntero, CveVenta = dr("CveVenta").ToString().ToEntero
|
||||
Into x = Group
|
||||
Select New With {
|
||||
.CveVentaRNCCargo = CveVenta,
|
||||
.CveVentaBonificacion = CveVentaBonificacion,
|
||||
.ImporteBonificacion = x.Sum(Function(s) s("ImporteBonificacion").ToString().ToDecimal),
|
||||
.IVABonificacion = x.Sum(Function(s) s("IVABonificacion").ToString().ToDecimal)
|
||||
@@ -24442,7 +24477,7 @@ Partial Class Ventas
|
||||
|
||||
For Each bon In queryBonificacion
|
||||
SbFiltro.AppendFormat("'{0}',", bon.CveVentaBonificacion)
|
||||
ListaBon.Add(New VentasBonificaciones() With {.CveVentaRNCCargo = GvRow.DataKey("CveVenta").ToEntero(), .CveVentaBonificacion = bon.CveVentaBonificacion, .ImporteBonificacion = bon.ImporteBonificacion, .IVABonificacion = bon.IVABonificacion})
|
||||
ListaBon.Add(New VentasBonificaciones() With {.CveVentaRNCCargo = bon.CveVentaRNCCargo, .CveVentaBonificacion = bon.CveVentaBonificacion, .ImporteBonificacion = bon.ImporteBonificacion, .IVABonificacion = bon.IVABonificacion})
|
||||
Next
|
||||
SbFiltro.Remove(SbFiltro.Length - 1, 1)
|
||||
SbFiltro.Append(")")
|
||||
@@ -24456,9 +24491,9 @@ Partial Class Ventas
|
||||
|
||||
RowBonificacion("ImporteBonificacion") = RNCBonificacion.Sum(Function(x) x.ImporteBonificacion)
|
||||
RowBonificacion("IVABonificacion") = RNCBonificacion.Sum(Function(x) x.IVABonificacion)
|
||||
RowBonificacion("CveVentaRNCCargo") = GvRow.DataKey("CveVenta").ToEntero()
|
||||
RowBonificacion("CveVentaRNCCargo") = CveVentaRNCCargo
|
||||
|
||||
If ChkAplicarRNC.Checked Then
|
||||
If AplicarRNC Then
|
||||
TmpDTRNCBonificacionesSeleccionadas.Rows.Add(RowBonificacion.ItemArray)
|
||||
Else
|
||||
For Each RowEliminar In Me.TmpDTRNCBonificacionesSeleccionadas.Select(SbFiltro.ToString())
|
||||
@@ -24482,7 +24517,6 @@ Partial Class Ventas
|
||||
LtlSMUBon.Text = String.Format("{0:N2}", Me.TmpDTRNCBonificacionesSeleccionadas.SUM("ImporteBonificacion").ToDecimal() + Me.TmpDTRNCBonificacionesSeleccionadas.SUM("IVABonificacion").ToDecimal())
|
||||
|
||||
UpModalRemisionesNC.Update()
|
||||
|
||||
End Sub
|
||||
Protected Sub GvDescNCCargos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDescNCCargos.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
@@ -24518,6 +24552,12 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Protected Sub GvRemisionesNCBon_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvRemisionesNCBon.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
e.Row.FCCheckBox("ChkAplicar").Attributes.Add("onclick", $"CalculaSaldoRNCBonChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);")
|
||||
e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"LimitaSaldoRNCBonChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble});")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub DdlNCNivelImporte_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
Dim ImporteReferencia As Double = 0, PorcentajeMaximo As Double = 0
|
||||
@@ -24905,7 +24945,7 @@ Partial Class Ventas
|
||||
Dim TotalAcumuladoRNC As Decimal = 0
|
||||
Dim Terminar As Boolean = False
|
||||
|
||||
For Each RowUsado As DataRow In RNC.DtDetalle.Rows
|
||||
For Each RowUsado As DataRow In RNC.DtDetalle.FiltraParametros("", Orderby:="PU").Rows
|
||||
|
||||
Dim Cantidad As Decimal = RowUsado("Cantidad").ToString().ToDecimal()
|
||||
|
||||
@@ -24989,7 +25029,7 @@ Partial Class Ventas
|
||||
Dim TotalAcumuladoRNC As Decimal = 0
|
||||
Dim Terminar As Boolean = False
|
||||
|
||||
For Each RowUsado As DataRow In Me.TmpDTRNCDetalleSelecciondas.FiltraParametros($"CveVenta={RNC.CveVenta}").Rows
|
||||
For Each RowUsado As DataRow In Me.TmpDTRNCDetalleSelecciondas.FiltraParametros($"CveVenta={RNC.CveVenta}", Orderby:="PU").Rows
|
||||
|
||||
Dim Cantidad As Decimal = RowUsado("Cantidad").ToString().ToDecimal()
|
||||
|
||||
@@ -25082,7 +25122,7 @@ Partial Class Ventas
|
||||
|
||||
Dim RNCCargo = ListaNC.Where(Function(f) f.CveVenta = RNCBonificacion.CveVentaRNCCargo).FirstOrDefault()
|
||||
|
||||
For Each RowCargo As DataRow In RNCCargo.DtDetalle.Rows
|
||||
For Each RowCargo As DataRow In RNCCargo.DtDetalle.FiltraParametros("", Orderby:="PU").Rows
|
||||
|
||||
Dim PorcentajeAplicado = (RNCBonificacion.TotalRemNCAplicado / RNCBonificacion.Total)
|
||||
|
||||
@@ -26494,8 +26534,12 @@ Partial Class Ventas
|
||||
If Not DtCotizaciones.Columns.Contains("Aplicado") Then
|
||||
DtCotizaciones.Columns.Add("Aplicado", Type.GetType("System.Boolean"))
|
||||
End If
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
GvCotPS.DataSource = DtCotizaciones.FiltraParametros("Cantidad > 0 AND EsAcumulador = False")
|
||||
Else
|
||||
GvCotPS.DataSource = DtCotizaciones.FiltraParametros("Cantidad > 0")
|
||||
End If
|
||||
|
||||
GvCotPS.DataSource = DtCotizaciones.FiltraParametros("Cantidad > 0")
|
||||
End If
|
||||
ObjVentas.Dispose()
|
||||
GvCotPS.DataBind()
|
||||
@@ -26563,6 +26607,11 @@ Partial Class Ventas
|
||||
For Each row As DataRow In DTSeleccionadas.FiltraParametros("", DistinctColumns:={"CveVenta"}).Rows
|
||||
CotizacionesLista.Add(row("CveVenta").ToString().ToEntero())
|
||||
Next
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
CalculaUsadosCotizacion(Cves, DTSeleccionadas, DtCotizaciones)
|
||||
End If
|
||||
|
||||
Else
|
||||
For Each row As DataRow In DTSeleccionadas.Rows
|
||||
If CveMetodoPago <> -1 And row("CveMetodoPago33").ToString().ToEntero() <> CveMetodoPago Then
|
||||
@@ -26607,6 +26656,74 @@ Partial Class Ventas
|
||||
UpPS.Update()
|
||||
UpParametros.Update()
|
||||
End Sub
|
||||
|
||||
Private Sub CalculaUsadosCotizacion(ByRef SbVentasDetalle As StringBuilder, ByVal DTSeleccionadas As DataTable, ByVal DtCotizaciones As DataTable)
|
||||
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Cot", "Dev") Then
|
||||
|
||||
Dim DTTamanios As DataTable = GlobalDTAcumTamaños()
|
||||
|
||||
Dim DTCvePSCostos As DataTable = DTTamanios.FiltraParametros("", "", {"CvePSCargo"})
|
||||
|
||||
Dim TmpDTCalculo As DataRow() = DTSeleccionadas.Rows.Cast(Of DataRow).ToArray()
|
||||
|
||||
Dim DTPSTemp As New DataTable '= TmpDT.Clone
|
||||
|
||||
DTPSTemp.Columns.Add("CveVenta", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("Cantidad", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("CvePS", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("PU", GetType(Decimal))
|
||||
|
||||
For Each DrowPartidas As DataRow In TmpDTCalculo
|
||||
Dim CveTamanioTemp As Integer = DrowPartidas("CveTamaño").ToString().ToEntero()
|
||||
Dim CveVenta As Integer = DrowPartidas("CveVenta").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()
|
||||
|
||||
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
|
||||
dRowUpdate("CveVenta") = CveVenta
|
||||
End If
|
||||
Next
|
||||
|
||||
DTPSTemp.AcceptChanges()
|
||||
|
||||
Else
|
||||
Dim dRowNuevo As DataRow = DTPSTemp.NewRow
|
||||
|
||||
dRowNuevo("CvePS") = CvePsTemp
|
||||
dRowNuevo("Cantidad") = DrowPartidas("Cantidad").ToString().ToDecimal
|
||||
dRowNuevo("PU") = Cargo
|
||||
dRowNuevo("CveVenta") = CveVenta
|
||||
|
||||
DTPSTemp.Rows.Add(dRowNuevo)
|
||||
DTPSTemp.AcceptChanges()
|
||||
End If
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
For Each drowPsTamaños As DataRow In DTPSTemp.Rows
|
||||
|
||||
If drowPsTamaños("PU").ToString().ToDecimal > 0 Then
|
||||
|
||||
Dim CveVentaDetalleUsado = DtCotizaciones.FiltroPrimeroValor("CveVentaDetalle", $"CveVenta = {drowPsTamaños("CveVenta")} AND CvePS = {drowPsTamaños("CvePS")}").ToEntero()
|
||||
SbVentasDetalle.AppendFormat("{0},", CveVentaDetalleUsado)
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
End If
|
||||
End Sub
|
||||
Private Sub VerificaCotizaciones(ByRef dt As DataTable)
|
||||
If ChkCotProductos.Checked Then
|
||||
For Each Gvr As GridViewRow In GvCotPS.Rows
|
||||
@@ -28377,13 +28494,15 @@ Partial Class Ventas
|
||||
End Sub
|
||||
Protected Sub BtnAplicarDesc_Click(sender As Object, e As EventArgs)
|
||||
Try
|
||||
Dim CveSATNC = "84111506"
|
||||
Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, SATClavePS:=CveSATNC, AplicaParaVenta:=1).Rows(0)
|
||||
|
||||
Dim DrPS As DataRow = Nothing
|
||||
Dim ArrayNC As String() = UsuarioActual.Empresa.Funcionalidad(591).Split(",".ToCharArray())
|
||||
If ArrayNC.Length > 0 Then
|
||||
Dim CvePSNC As Integer = ArrayNC(0).ToEntero()
|
||||
If ArrayNC.Length >= 4 Then
|
||||
Dim CvePSNC As Integer = ArrayNC(3).ToEntero()
|
||||
DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSNC, AplicaParaVenta:=1).Rows(0)
|
||||
Else
|
||||
Dim CveSATNC = "84111506"
|
||||
DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, SATClavePS:=CveSATNC, AplicaParaVenta:=1).Rows(0)
|
||||
End If
|
||||
|
||||
If DrPS Is Nothing Then
|
||||
@@ -28426,7 +28545,7 @@ Partial Class Ventas
|
||||
|
||||
'SI TIENE ALGUN AJUSTE O GARANTIA
|
||||
If ListaNCDesc.Any(Function(RNC) RNC.Num2 = 1) Then
|
||||
For Each RNC In ListaRemisionesNC.Where(Function(x) x.Num2 = 1)
|
||||
For Each RNC In ListaNCDesc.Where(Function(x) x.Num2 = 1)
|
||||
Dim Salir As Boolean = False
|
||||
|
||||
Dim NCAjuste As Integer = -1
|
||||
@@ -28491,9 +28610,12 @@ Partial Class Ventas
|
||||
ListaNCDesc.Clear()
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim TotalProntoPago As Decimal = TmpDT.SUM("ImporteProntoPago").ToDecimal
|
||||
|
||||
HdnTotalRNC.Value = TotalRemNCAplicado.ToString()
|
||||
LblDescuentosRNC.Text = TotalRemNCAplicado.FormatoNumero
|
||||
LblTotalNC.Text = (TxtTotal.Text.ToDecimal() - TotalRemNCAplicado).FormatoNumero
|
||||
LblTotalAPagar.Text = (TxtTotal.Text.ToDecimal() - TotalRemNCAplicado - TotalProntoPago).FormatoNumero
|
||||
|
||||
Dim CvePS = DrPS("CvePS").ToString().ToEntero()
|
||||
|
||||
@@ -29410,7 +29532,7 @@ Partial Class Ventas
|
||||
DtImpuestos.AcceptChanges()
|
||||
Dim AcumuladoNC As Decimal = 0
|
||||
|
||||
DtImpuestos.Merge(CargaDtImpuestosNC(ObjFactura.CveVenta, ObjFactura.DescuentoProntoPago), True, MissingSchemaAction.Ignore)
|
||||
DtImpuestos.Merge(CargaDtImpuestosNCProntoPago(ObjFactura.CveVenta, ObjFactura.DescuentoProntoPago), True, MissingSchemaAction.Ignore)
|
||||
|
||||
DtImpuestos = CargaTotalesImpuestosProntoPago(DtImpuestos)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user