Pendientes BDH

This commit is contained in:
2020-10-15 20:03:09 -07:00
parent eb399787a6
commit 6eb4cd9814
9 changed files with 557 additions and 330 deletions

View File

@@ -1366,10 +1366,6 @@ Namespace Modelos
End If End If
If Not GuardarUsados(ObjVentas.IniciaTransacSQL, ObjVentas.CveVenta, ObjVentas, factura.TipoDocto) Then
ErrorList.Add("Error al guardar usados")
End If
If ErrorList.Count = 0 AndAlso ObjVentas.CveVenta > 0 Then If ErrorList.Count = 0 AndAlso ObjVentas.CveVenta > 0 Then
@@ -1379,6 +1375,11 @@ Namespace Modelos
factura.Timbre.Comprobante.Serie = ObjVentas.Serie factura.Timbre.Comprobante.Serie = ObjVentas.Serie
factura.Timbre.Comprobante.Folio = ObjVentas.Folio.ToString factura.Timbre.Comprobante.Folio = ObjVentas.Folio.ToString
If Not GuardarUsados(ObjVentas.IniciaTransacSQL, ObjVentas, factura) Then
ErrorList.Add("Error al guardar usados")
End If
If factura.TipoDocto = "Egs" AndAlso NuevaFactura = 1 Then If factura.TipoDocto = "Egs" AndAlso NuevaFactura = 1 Then
If DtVentasNC Is Nothing Then If DtVentasNC Is Nothing Then
InicializaDTVentasNC() InicializaDTVentasNC()
@@ -1909,30 +1910,31 @@ Namespace Modelos
DtVentasNC.Rows.Add(Dr) DtVentasNC.Rows.Add(Dr)
End If End If
End Sub End Sub
Private Function GuardarUsados(SqlTransaccion As SqlClient.SqlTransaction, CveVenta As Integer, ByRef ObjVentas As ClsVentas, TipoDocto As String) As Boolean Private Function GuardarUsados(SqlTransaccion As SqlClient.SqlTransaction, ByRef ObjVentas As ClsVentas, factura As Modelos.Factura) As Boolean
Dim Resultado As Boolean = True Dim Resultado As Boolean = True
If UsuarioActual.Empresa.Funcionalidad(533).ToEntero > 0 AndAlso TipoDocto.Contiene("Ing", "Ant", "Rem") Then If UsuarioActual.Empresa.Funcionalidad(533).ToEntero > 0 AndAlso factura.TipoDocto.Contiene("Ing", "Rem") Then
If factura.TipoDocto = "Ing" AndAlso factura.Cliente.EsDistribuidor Then
Dim CvePSPSA As Integer = UsuarioActual.Empresa.Funcionalidad(533).ToEntero Dim CvePSPSA As Integer = UsuarioActual.Empresa.Funcionalidad(533).ToEntero
Dim ObjAcum As New ClsAcumuladores(SqlTransaccion) Dim ObjAcum As New ClsAcumuladores(SqlTransaccion)
For Each drow As DataRow In DtDetalle.Rows For Each drow As DataRow In factura.DtDetalle.Rows
If drow("CveTamaño").ToString.ToEntero > 0 And (CvePSPSA <> drow("CvePS").ToString.ToEntero) Then If drow("CveTamaño").ToString.ToEntero > 0 And (CvePSPSA <> drow("CvePS").ToString.ToEntero) Then
If ObjAcum.DistribuidorMovtosAdd(CveCliente, drow("Cantidad").ToString.ToEntero, drow("CveTamaño").ToString.ToEntero, 2, CveVenta, UsuarioActual.CveUsuario, If Not ObjAcum.DistribuidorMovtosAdd(CveCliente, drow("Cantidad").ToString.ToEntero, drow("CveTamaño").ToString.ToEntero, 2, CveVenta, UsuarioActual.CveUsuario,
UsuarioActual.CveEmpresa, 0D, "") Then UsuarioActual.CveEmpresa, 0D, "") Then
Else
Resultado = False Resultado = False
Exit For Exit For
End If End If
Else
Resultado = True
End If End If
Next Next
If TipoDocto.Contiene("Rem") Then End If
If DtRecepcionUsados IsNot Nothing Then
For Each drow As DataRow In DtRecepcionUsados.Rows If factura.TipoDocto.Contiene("Rem") Then
If factura.DtRecepcionUsados IsNot Nothing Then
For Each drow As DataRow In factura.DtRecepcionUsados.Rows
If Not ObjVentas.AddVentaUsado(CveVenta, drow("CvePS").ToString.ToEntero, drow("Cantidad").ToString.ToDecimal, drow("PU").ToString.ToDecimal, drow("CveBCIUsado").ToString.ToEntero, drow("CveModeloAuto").ToString.ToEntero) Then If Not ObjVentas.AddVentaUsado(CveVenta, drow("CvePS").ToString.ToEntero, drow("Cantidad").ToString.ToDecimal, drow("PU").ToString.ToDecimal, drow("CveBCIUsado").ToString.ToEntero, drow("CveModeloAuto").ToString.ToEntero) Then
Resultado = False Resultado = False
Exit For Exit For
@@ -9302,6 +9304,7 @@ Namespace Modelos
Public Property ClaveSATMunicipio As String Public Property ClaveSATMunicipio As String
Public Property ClaveSATColonia As String Public Property ClaveSATColonia As String
Public Property ClaveSATCP As String Public Property ClaveSATCP As String
Public Property EsDistribuidor As Boolean
End Class End Class

View File

@@ -972,9 +972,12 @@ Partial Class Inventarios_RecepcionAlmacen
CveAlmacenDevolucionProveedor = DtRecepcion.Rows(0)("CveAlmacenDevolucionProveedor").ToString.ToEntero CveAlmacenDevolucionProveedor = DtRecepcion.Rows(0)("CveAlmacenDevolucionProveedor").ToString.ToEntero
'SI ES MOTOBATERIA NO GENERA MOVIMIENTO VIRTUAL 'SI ES MOTOBATERIA NO GENERA MOVIMIENTO VIRTUAL
If UsuarioActual.Empresa.Funcionalidad(573) = "1" AndAlso (DtRecepcion.COUNT("CveTamaño", "CveTamaño > 0 AND CveTamaño <> 16") > 0 OrElse CargaSoloUsados) Then If UsuarioActual.Empresa.Funcionalidad(573) = "1" AndAlso (DtRecepcion.COUNT("CveTamaño", "CveTamaño > 0 AND CveTamaño <> 16") > 0) Then
RealizarMovimientoVirtual = True RealizarMovimientoVirtual = True
DivVirtualAdvertencia.Visible = True DivVirtualAdvertencia.Visible = True
Else
RealizarMovimientoVirtual = False
DivVirtualAdvertencia.Visible = False
End If End If
If TipoMovimiento = 2 AndAlso CveAlmacenDevolucionProveedor > 0 Then If TipoMovimiento = 2 AndAlso CveAlmacenDevolucionProveedor > 0 Then

View File

@@ -378,7 +378,7 @@
<i></i> <i></i>
</div> </div>
<div class="form-group form-md-line-input"> <div class="form-group form-md-line-input">
<asp:TextBox ID="TxtCodigo" runat="server" CssClass="form-control" MaxLength="25"></asp:TextBox> <asp:TextBox ID="TxtCodigo" runat="server" OnTextChanged="TxtCodigo_TextChanged" AutoPostBack="true" CssClass="form-control" MaxLength="25"></asp:TextBox>
<label for="<%= TxtCodigo.ClientID.ToString()%>">Código:</label> <label for="<%= TxtCodigo.ClientID.ToString()%>">Código:</label>
</div> </div>
<div class="form-group form-md-line-input"> <div class="form-group form-md-line-input">

View File

@@ -847,6 +847,12 @@ Partial Class Clientes
CargaDatosCRM() CargaDatosCRM()
End If End If
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then ' Funcionalidad Es Distribuidor
DivEsDistribuidor.Visible = True
DivCargoUsado.Visible = True
DivBonificacionUsado.Visible = True
End If
ChecaPermiteCredito() ChecaPermiteCredito()
@@ -10191,5 +10197,17 @@ Partial Class Clientes
End If End If
ObjBancos.Dispose() ObjBancos.Dispose()
End Sub End Sub
Protected Sub TxtCodigo_TextChanged(sender As Object, e As EventArgs)
If CveCliente <= 0 AndAlso UsuarioActual.CveEmpresa = 140 Then
DdlTipoCliente.SelectedValueExist("1")
ChkEsDistribuidor.Checked = True
ChkCargoUsado.Checked = True
ChkBonificacionUsado.Checked = True
End If
UpDatos.Update()
End Sub
End Class End Class

View File

@@ -2960,16 +2960,19 @@
</div> </div>
</div> </div>
</div> </div>
<div class="row" style="margin-top: 17px;"> <div class="row">
<div class="col-md-2"> <div class="col-md-12">
<div class="form-group form-md-line-input input-iconright"> <div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtPoliza" CssClass="form-control" runat="server" MaxLength="50"></asp:TextBox> <asp:TextBox ID="TxtPoliza" CssClass="form-control" runat="server" MaxLength="50" Width="100%"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVPoliza" runat="server" ControlToValidate="TxtPoliza" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Póliza''</b> es incorrecto, por favor ingréselo correctamente." ValidationGroup="GrpAddVenta"></asp:RequiredFieldValidator>
<%--<asp:RequiredFieldValidator ID="RFVPoliza" runat="server" ControlToValidate="TxtPoliza" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Poliza''</b> es necesario, por favor ingréselo." ValidationGroup="VGMAjuste"></asp:RequiredFieldValidator>--%> <%--<asp:RequiredFieldValidator ID="RFVPoliza" runat="server" ControlToValidate="TxtPoliza" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Poliza''</b> es necesario, por favor ingréselo." ValidationGroup="VGMAjuste"></asp:RequiredFieldValidator>--%>
<%--<ajax:ValidatorCalloutExtender ID="VCEPoliza" runat="server" HighlightCssClass="vco" TargetControlID="RFVPoliza"></ajax:ValidatorCalloutExtender>--%> <%--<ajax:ValidatorCalloutExtender ID="VCEPoliza" runat="server" HighlightCssClass="vco" TargetControlID="RFVPoliza"></ajax:ValidatorCalloutExtender>--%>
<label for="<%= TxtPoliza.ClientID.ToString()%>">Poliza:</label> <label for="<%= TxtPoliza.ClientID.ToString()%>">Póliza:</label>
</div> </div>
</div> </div>
<div class="col-md-4"> </div>
<div class="row" style="margin-top: 17px;">
<div class="col-md-6">
<div class="form-group form-md-line-input input-iconright"> <div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtImporteAjuste" CssClass="form-control" runat="server" Enabled="false" MaxLength="50"></asp:TextBox> <asp:TextBox ID="TxtImporteAjuste" CssClass="form-control" runat="server" Enabled="false" MaxLength="50"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVImporteAjuste" runat="server" ControlToValidate="TxtImporteAjuste" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Importe''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddVenta"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator ID="RFVImporteAjuste" runat="server" ControlToValidate="TxtImporteAjuste" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Importe''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddVenta"></asp:RequiredFieldValidator>
@@ -2978,7 +2981,7 @@
<label for="<%= TxtImporteAjuste.ClientID.ToString()%>">Importe:</label> <label for="<%= TxtImporteAjuste.ClientID.ToString()%>">Importe:</label>
</div> </div>
</div> </div>
<div class="col-md-4"> <div class="col-md-6">
<asp:Button ID="BtnCalcularImporteAjuste" CssClass="btn green-haze btn-outline btn-circle btn-sm" OnClick="BtnCalcularImporteAjuste_Click" runat="server" Text="Recalcular" UseSubmitBehavior="false" /> <asp:Button ID="BtnCalcularImporteAjuste" CssClass="btn green-haze btn-outline btn-circle btn-sm" OnClick="BtnCalcularImporteAjuste_Click" runat="server" Text="Recalcular" UseSubmitBehavior="false" />
</div> </div>
</div> </div>

View File

@@ -2306,6 +2306,10 @@ Partial Class PV
DdlEstadoSAT.DataBind() DdlEstadoSAT.DataBind()
DdlEstadoSAT.Items.Insert(0, New ListItem("Seleccione", "-1")) DdlEstadoSAT.Items.Insert(0, New ListItem("Seleccione", "-1"))
If UsuarioActual.CveEmpresa = 140 AndAlso ClaveSATPais = "MEX" Then
DdlEstadoSAT.SelectedValueExist("26")
End If
End Sub End Sub
Protected Sub DdlSATPais_SelectedIndexChanged(sender As Object, e As EventArgs) Protected Sub DdlSATPais_SelectedIndexChanged(sender As Object, e As EventArgs)
CargaEstados(DdlSATPais.SelectedValue) CargaEstados(DdlSATPais.SelectedValue)
@@ -2768,6 +2772,18 @@ Partial Class PV
DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString) DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString)
End If End If
'SELECCIONA VENDEDOR DEL USUARIO CUANDO SEA VENTA NUEVA Y SIN CLIENTE
If UsuarioActual.CveVendedor > 0 Then
If CveVenta = -1 AndAlso Not DdlVendedor.SelectedValue.ToEntero() > 0 Then DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString())
If DdlVendedor.SelectedValue.ToEntero() > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then
DdlVendedor.Enabled = False
End If
'multiples vendedores visible
If UsuarioActual.TienePermisoProceso(153) Then
DdlVendedor.Enabled = True
End If
End If
End Sub End Sub
Private Sub ObtenerFechaVencimientoCER() Private Sub ObtenerFechaVencimientoCER()
Try Try
@@ -6174,6 +6190,46 @@ Partial Class PV
CveTamanio = drPS("CveTamaño").ToString.ToEntero CveTamanio = drPS("CveTamaño").ToString.ToEntero
End If End If
If UsuarioActual.Empresa.Funcionalidad(404).ToEntero > 0 Then 'cuando el valor es 10.- secuencia Cliente/Sucursal, 20 - sucursal/cliente
Dim TipoPrecioLista As Integer = UsuarioActual.Empresa.Funcionalidad(404).ToEntero
' si es 10. primero el cliente
Dim CvePrecioListaPS As Integer
Dim PorcentajePrecio As Decimal = 0
If TipoPrecioLista = 10 Then
CvePrecioListaPS = GlobalDTCliente(UsuarioActual.CveEmpresa, Estatus:=-1, CveCliente:=CveCliente).FiltroPrimeroValor("CvePrecioLista").ToEntero()
If CvePrecioListaPS <= 0 Then
CvePrecioListaPS = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePrecioLista", "").ToEntero()
End If
Else
CvePrecioListaPS = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePrecioLista", "").ToEntero()
If CvePrecioListaPS <= 0 Then
CvePrecioListaPS = GlobalDTCliente(UsuarioActual.CveEmpresa, Estatus:=-1, CveCliente:=CveCliente).FiltroPrimeroValor("CvePrecioLista").ToEntero()
End If
End If
If CvePrecioListaPS > 0 Then
Dim ObjPS As New ClsProductosServicios
If ObjPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioListaPS, CvePS:=CvePSParametro) Then
PrecioSugerido = ObjPS.DtResultados.FiltroPrimeroValor("PrecioLista").ToDecimal
PorcentajePrecio = ObjPS.DtResultados.FiltroPrimeroValor("Porcentaje").ToDecimal
End If
ObjPS.Dispose()
End If
If PrecioSugerido = 0 Then
Dim ObjInventarios As New ClsInventarios
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
If CostoPS = 0 Then CostoPS = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, -1, CveTipoAlmacen:=1)
ObjInventarios.Dispose()
If CostoPS > 0 And PorcentajePrecio > 0 Then
PrecioSugerido = ((PorcentajePrecio / 100) + 1) * CostoPS
End If
End If
'CvePrecioLista = CvePrecioListaPS
End If
TxtPUFactura.Text = PrecioSugerido.FormatoNumero(2) TxtPUFactura.Text = PrecioSugerido.FormatoNumero(2)
If DTBCIUsados IsNot Nothing AndAlso CveTamanio > 0 Then If DTBCIUsados IsNot Nothing AndAlso CveTamanio > 0 Then

View File

@@ -1575,7 +1575,7 @@
</div> </div>
</div> </div>
</div> </div>
<asp:HiddenField ID="HdnTotalRNC" runat="server" ClientIDMode="Static" Value="0" />
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
</div> </div>
@@ -4316,23 +4316,18 @@
<div class="portlet-title"> <div class="portlet-title">
<div class="caption font-green"> <div class="caption font-green">
<%--<i class="fa fa-users font-green"></i>--%>
<span class="caption-subject bold uppercase">Bitacora</span> <span class="caption-subject bold uppercase">Bitacora</span>
</div> </div>
<div class="actions"> <div class="actions">
<div class="btn-group"> <div class="btn-group">
<%--<div class=" font-green" style="cursor: pointer;" runat="server" id="ImgAddObs" visible="false">
<i class="fa fa-commenting font-green"></i>
<span class="caption-subject bold">Agregar</span>
</div>--%>
<asp:HyperLink ID="ImgAddObs" CssClass="caption-subject bold" data-toggle="modal" data-target="#ModalBitacora" runat="server" Text=" <i class='fa fa-commenting font-green' style='font-weight: 700 !important;' ><span class='caption-subject bold'>Agregar</span></i>" Style="cursor: pointer;" ToolTip="Observaciones"></asp:HyperLink><br /> <asp:HyperLink ID="ImgAddObs" CssClass="caption-subject bold" data-toggle="modal" data-target="#ModalBitacora" runat="server" Text=" <i class='fa fa-commenting font-green' style='font-weight: 700 !important;' ><span class='caption-subject bold'>Agregar</span></i>" Style="cursor: pointer;" ToolTip="Observaciones"></asp:HyperLink><br />
<asp:HyperLink ID="HlEvento" CssClass="thickbox caption-subject bold" runat="server" Visible="false" Style="cursor: pointer; text-decoration: none;" ToolTip="Agendar"><i class='fa fa-calendar-plus-o font-green' style='font-weight: 700 !important;' ></i> <span class="caption-subject bold font-green">Agendar</span></asp:HyperLink><br /> <asp:HyperLink ID="HlEvento" CssClass="thickbox caption-subject bold" runat="server" Visible="false" Style="cursor: pointer; text-decoration: none;" ToolTip="Agendar"><i class='fa fa-calendar-plus-o font-green' style='font-weight: 700 !important;' ></i> <span class="caption-subject bold font-green">Agendar</span></asp:HyperLink><br />
<asp:Literal ID="LtlTareaNueva" runat="server"></asp:Literal> <asp:Literal ID="LtlTareaNueva" runat="server"></asp:Literal>
<UserControl:TareaNueva runat="server" id="TareaNueva" /> <UserControl:TareaNueva runat="server" id="TareaNueva" />
<script> function OnAddedTareaNueva() { <script>
function OnAddedTareaNueva() {
$('.btnupEventoBitacora').click(); $('.btnupEventoBitacora').click();
} }
</script> </script>
</div> </div>
</div> </div>
@@ -6799,7 +6794,7 @@
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField> <asp:TemplateField>
<ItemTemplate> <ItemTemplate>
<asp:TextBox ID="TxtImporte" CssClass="myvalue" runat="server" Width="75px" /> <asp:TextBox ID="TxtImporte" CssClass="myvalue ImportesRNCCargo" runat="server" Width="75px" />
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
</Columns> </Columns>
@@ -6876,8 +6871,6 @@
</asp:GridView> </asp:GridView>
</div> </div>
</div> </div>
</div>
</div>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<table border="0" rules="none" class="well TextTab" style="float: right;" runat="server"> <table border="0" rules="none" class="well TextTab" style="float: right;" runat="server">
@@ -6894,6 +6887,9 @@
</div> </div>
</div> </div>
</div> </div>
</div>
<asp:HiddenField ID="HdnSaldoMaximoUsados" runat="server" ClientIDMode="Static" Value="0" />
</div>
<div class="modal-footer"> <div class="modal-footer">
<button id="CancelarAplicarDescNC" type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button> <button id="CancelarAplicarDescNC" type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
<asp:Button Text="Aplicar Descuento" ID="BtnAplicarDesc" OnClick="BtnAplicarDesc_Click" CssClass="btn btn-primary" runat="server" /> <asp:Button Text="Aplicar Descuento" ID="BtnAplicarDesc" OnClick="BtnAplicarDesc_Click" CssClass="btn btn-primary" runat="server" />
@@ -7083,13 +7079,75 @@
} }
function CalculaSaldoRNCChk(TxtImporte, Saldo, Chk) { function CalculaSaldoRNCChk(TxtImporte, Saldo, Chk) {
//ImportesRNCCargo
if (Chk.checked) { if (Chk.checked) {
let SaldoMaximoUtilizable = ToDouble(HdnSaldoMaximoUsados.value)
let ImportesAsignados = 0;
$('.ImportesRNCCargo').each(function () {
if ($(this).context.id != TxtImporte.id) {
ImportesAsignados += ToDouble($(this).val());
}
});
let Importe = SaldoMaximoUtilizable - ImportesAsignados;
if (Importe > 0) {
if (Saldo > Importe) {
TxtImporte.value = FormatoNumero(Importe, 2);
} else {
TxtImporte.value = FormatoNumero(Saldo, 2); TxtImporte.value = FormatoNumero(Saldo, 2);
}
} else {
TxtImporte.value = "";
Chk.checked = false;
}
} else { } else {
TxtImporte.value = ""; TxtImporte.value = "";
} }
} }
function LimitaSaldoRNCChk(TxtImporte, Saldo) { function LimitaSaldoRNCChk(TxtImporte, Saldo) {
//var Importe = 0;
//if (TxtImporte.value.includes('.')) {
// return;
//}
//if (TxtImporte.value.includes(',')) {
// return;
//}
//var regex = new RegExp("^\d*\.?\d*$");
//if (regex.test(TxtImporte.value.trim())) {
// if (TxtImporte.value != '') {
// Importe = parseFloat(TxtImporte.value);
// }
//let SaldoMaximoUtilizable = ToDouble(HdnSaldoMaximoUsados.value)
//let ImportesAsignados = 0;
//$('.ImportesRNCCargo').each(function () {
// if ($(this).context.id != TxtImporte.id) {
// ImportesAsignados += ToDouble($(this).val());
// }
//});
// let ImporteDiferencia = SaldoMaximoUtilizable - ImportesAsignados;
// if (ImporteDiferencia < 0) {
// ImporteDiferencia = 0;
// }
// if (ImporteDiferencia > 0) {
// if (ImporteDiferencia > Importe) {
// TxtImporte.value = FormatoNumero(Importe, 2);
// } else {
// TxtImporte.value = FormatoNumero(ImporteDiferencia, 2);
// }
// } else {
// TxtImporte.value = "";
// }
//}
var Importe = 0; var Importe = 0;
if (TxtImporte.value.includes('.')) { if (TxtImporte.value.includes('.')) {
@@ -7106,8 +7164,17 @@
Importe = parseFloat(TxtImporte.value); Importe = parseFloat(TxtImporte.value);
} }
if (Importe > Saldo) { let SaldoMaximoUtilizable = parseFloat(HdnSaldoMaximoUsados.value)
TxtImporte.value = FormatoNumero(Saldo, 2); let ImportesAsignados = 0;
$('.ImportesRNCCargo').each(function () {
if ($(this).context.id != TxtImporte.id) {
ImportesAsignados += ToDouble($(this).val());
}
});
let ImporteDiferencia = SaldoMaximoUtilizable - ImportesAsignados;
if (Importe > ImporteDiferencia) {
TxtImporte.value = FormatoNumero(ImporteDiferencia, 2);
} else { } else {
TxtImporte.value = FormatoNumero(Importe, 2);; TxtImporte.value = FormatoNumero(Importe, 2);;
} }
@@ -7542,6 +7609,7 @@
var totalDebito = ToDouble($get("TxtImporteDebito").value); var totalDebito = ToDouble($get("TxtImporteDebito").value);
var totalCheque = ToDouble($get("TxtImporteCheque").value); var totalCheque = ToDouble($get("TxtImporteCheque").value);
var totalTransferencia = ToDouble($get("TxtImporteTransferencia").value); var totalTransferencia = ToDouble($get("TxtImporteTransferencia").value);
var totalRNC = ToDouble($get("HdnTotalRNC").value);
var TotalOtrosContado = 0; var TotalOtrosContado = 0;
@@ -7551,7 +7619,7 @@
} }
} catch (e) { } } catch (e) { }
var total = totalEfectivo + totalCredito + totalDebito + totalCheque + totalTransferencia + TotalOtrosContado; var total = totalEfectivo + totalCredito + totalDebito + totalCheque + totalTransferencia + TotalOtrosContado + totalRNC;
var totalVenta = ToDouble($get('TxtTotal').value); var totalVenta = ToDouble($get('TxtTotal').value);
if (total > totalVenta) { if (total > totalVenta) {

View File

@@ -3672,6 +3672,10 @@ Partial Class Ventas
DdlEstadoSAT.DataBind() DdlEstadoSAT.DataBind()
DdlEstadoSAT.Items.Insert(0, New ListItem("Seleccione", "-1")) DdlEstadoSAT.Items.Insert(0, New ListItem("Seleccione", "-1"))
If UsuarioActual.CveEmpresa = 140 AndAlso ClaveSATPais = "MEX" Then
DdlEstadoSAT.SelectedValueExist("26")
End If
End Sub End Sub
Protected Sub DdlSATPais_SelectedIndexChanged(sender As Object, e As EventArgs) Protected Sub DdlSATPais_SelectedIndexChanged(sender As Object, e As EventArgs)
CargaEstados(DdlSATPais.SelectedValue) CargaEstados(DdlSATPais.SelectedValue)
@@ -8306,6 +8310,7 @@ Partial Class Ventas
If ObjFolios.GetFolios(factura.TipoDocto, UsuarioActual.CveEmpresa) Then If ObjFolios.GetFolios(factura.TipoDocto, UsuarioActual.CveEmpresa) Then
Dim DT As DataTable = ObjFolios.DtResultados.FiltraParametros(String.Format(" CveSubProyecto = {0} And Estado = 'Activo'", DdlSubProyectoDatos.SelectedValue.ToEntero())) Dim DT As DataTable = ObjFolios.DtResultados.FiltraParametros(String.Format(" CveSubProyecto = {0} And Estado = 'Activo'", DdlSubProyectoDatos.SelectedValue.ToEntero()))
If DT.Rows.Count > 0 Then If DT.Rows.Count > 0 Then
factura.Serie = DT.Rows(0)("Serie").ToString()
factura.Folio = DT.Rows(0)("FActual").ToString().ToEntero() factura.Folio = DT.Rows(0)("FActual").ToString().ToEntero()
Else Else
ProcesoCorrecto = False ProcesoCorrecto = False
@@ -8493,6 +8498,11 @@ Partial Class Ventas
ObjFactura.FacturarSucursal = (Me.FacturarSucursal AndAlso DdlSucursalCliente.SelectedValue.ToEntero() > 0 AndAlso (Me.ClienteSucursal IsNot Nothing AndAlso Not String.IsNullOrEmpty(Me.ClienteSucursal.RFC))) ObjFactura.FacturarSucursal = (Me.FacturarSucursal AndAlso DdlSucursalCliente.SelectedValue.ToEntero() > 0 AndAlso (Me.ClienteSucursal IsNot Nothing AndAlso Not String.IsNullOrEmpty(Me.ClienteSucursal.RFC)))
ObjFactura.VentaDesglosaIEPS = Me.VentaDesglosaIEPS ObjFactura.VentaDesglosaIEPS = Me.VentaDesglosaIEPS
'ObjFactura.RefDocto = TxtDocto.Text.Trim 'ObjFactura.RefDocto = TxtDocto.Text.Trim
If EsCreaApartirDe Then
ViewState("EstablecioFolio") = False
End If
'si es cancelacion, debe de conservar el folio actual 'si es cancelacion, debe de conservar el folio actual
If Not EsCancelacion Then ObjFactura.Folio = If(EstablecioFolio Or VistaPrevia Or (CveVenta > 0 And (NuevaFactura.Contiene(0, 2))), TxtFolio.Text.Trim.ToEntero(), -1) If Not EsCancelacion Then ObjFactura.Folio = If(EstablecioFolio Or VistaPrevia Or (CveVenta > 0 And (NuevaFactura.Contiene(0, 2))), TxtFolio.Text.Trim.ToEntero(), -1)
@@ -10091,11 +10101,6 @@ Partial Class Ventas
End If End If
End If End If
If Not GuardarUsados(ObjVentas.IniciaTransacSQL, ObjVentas.CveVenta) Then
ErrorList.Add("Error al guardar usados")
End If
If ErrorList.Count = 0 AndAlso ObjVentas.CveVenta > 0 Then If ErrorList.Count = 0 AndAlso ObjVentas.CveVenta > 0 Then
factura.CveVenta = ObjVentas.CveVenta factura.CveVenta = ObjVentas.CveVenta
@@ -10105,6 +10110,10 @@ Partial Class Ventas
factura.Timbre.Comprobante.Serie = ObjVentas.Serie factura.Timbre.Comprobante.Serie = ObjVentas.Serie
factura.Timbre.Comprobante.Folio = ObjVentas.Folio.ToString() factura.Timbre.Comprobante.Folio = ObjVentas.Folio.ToString()
If Not GuardarUsados(ObjVentas.IniciaTransacSQL, factura) Then
ErrorList.Add("Error al guardar usados")
End If
If factura.TipoDocto = "Egs" AndAlso NuevaFactura = 1 Then If factura.TipoDocto = "Egs" AndAlso NuevaFactura = 1 Then
If DtVentasNC Is Nothing Then If DtVentasNC Is Nothing Then
InicializaDTVentasNC() InicializaDTVentasNC()
@@ -23078,6 +23087,7 @@ Partial Class Ventas
Me.TmpDTRNCBonificacionesCliente = DtNC.FiltraParametros("TipoRNC = 2") Me.TmpDTRNCBonificacionesCliente = DtNC.FiltraParametros("TipoRNC = 2")
Me.TmpDTRNCBonificacionesCliente.Columns.Add("ImporteBonificacion", GetType(Decimal)) Me.TmpDTRNCBonificacionesCliente.Columns.Add("ImporteBonificacion", GetType(Decimal))
Me.TmpDTRNCBonificacionesCliente.Columns.Add("IVABonificacion", GetType(Decimal))
Me.TmpDTRNCBonificacionesCliente.Columns.Add("CveVentaRNCCargo", GetType(Integer)) Me.TmpDTRNCBonificacionesCliente.Columns.Add("CveVentaRNCCargo", GetType(Integer))
GvRemisionesNC.DataBind() GvRemisionesNC.DataBind()
@@ -23085,7 +23095,7 @@ Partial Class Ventas
If CveVentaUsado > 0 Then If CveVentaUsado > 0 Then
Dim FacUsado As New Modelos.Factura(UsuarioActual, CveVentaUsado, UsuarioActual.CveEmpresa) Dim FacUsado As New Modelos.Factura(UsuarioActual, CveVentaUsado, UsuarioActual.CveEmpresa)
LtlSMU.Text = String.Format("{0:N2}", FacUsado.DtDetalle.SUM("Total", "EsCargo = True").ToDecimal()) LtlSMU.Text = String.Format("{0:N2}", FacUsado.DtDetalle.SUM("Total", "EsCargo = True").ToDecimal() + FacUsado.DtDetalle.SUM("ImporteIVA", "EsCargo = True").ToDecimal())
Else Else
LtlSMU.Text = String.Format("{0:N2}", 0) LtlSMU.Text = String.Format("{0:N2}", 0)
End If End If
@@ -23107,12 +23117,16 @@ Partial Class Ventas
Me.TmpDTRNCBonificacionesCliente = DtNC.FiltraParametros("TipoRNC = 2") Me.TmpDTRNCBonificacionesCliente = DtNC.FiltraParametros("TipoRNC = 2")
Me.TmpDTRNCBonificacionesCliente.Columns.Add("ImporteBonificacion", GetType(Decimal)) Me.TmpDTRNCBonificacionesCliente.Columns.Add("ImporteBonificacion", GetType(Decimal))
Me.TmpDTRNCBonificacionesCliente.Columns.Add("IVABonificacion", GetType(Decimal))
Me.TmpDTRNCBonificacionesCliente.Columns.Add("CveVentaRNCCargo", GetType(Integer)) Me.TmpDTRNCBonificacionesCliente.Columns.Add("CveVentaRNCCargo", GetType(Integer))
GvDescNCCargos.DataBind() GvDescNCCargos.DataBind()
GvDescNCBonificaciones.DataBind() GvDescNCBonificaciones.DataBind()
LblSaldoMaximoUsados.Text = String.Format("{0:N2}", Me.TmpDT.SUM("Total", "EsCargo = True").ToDecimal()) Dim SaldoMaximoUsados As Decimal = Me.TmpDT.SUM("Total", "EsCargo = True").ToDecimal() + Me.TmpDT.SUM("ImporteIVA", "EsCargo = True").ToDecimal()
LblSaldoMaximoUsados.Text = String.Format("{0:N2}", SaldoMaximoUsados)
HdnSaldoMaximoUsados.Value = SaldoMaximoUsados.ToString()
UpDescNC.Update() UpDescNC.Update()
End Sub End Sub
@@ -23125,28 +23139,52 @@ Partial Class Ventas
TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Clone() TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Clone()
End If End If
Dim CveVentaBonificacion As Integer = -1 Dim ListaBon As New List(Of VentasBonificaciones)
Dim ImporteBonificacion As Decimal = 0 Dim DtBon As DataTable = Nothing
Dim SbFiltro As New StringBuilder()
SbFiltro.Append("CveVenta IN(")
Using ObjAcum As New ClsAcumuladores Using ObjAcum As New ClsAcumuladores
If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=GvRow.DataKey("CveVenta").ToEntero()) Then If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=GvRow.DataKey("CveVenta").ToEntero()) Then
Dim RowMovto As DataRow = ObjAcum.DtResultados.FiltroPrimero("") DtBon = ObjAcum.DtResultados.Copy()
CveVentaBonificacion = RowMovto("CveVentaBonificacion").ToString().ToEntero()
ImporteBonificacion = RowMovto("ImporteBonificacion").ToString().ToDecimal()
End If End If
End Using End Using
If CveVentaBonificacion > 0 Then If DtBon IsNot Nothing Then
Dim RowBonificacion As DataRow = Me.TmpDTRNCBonificacionesCliente.FiltroPrimero($"CveVenta = {CveVentaBonificacion}") Dim queryBonificacion = From dr In DtBon
RowBonificacion("ImporteBonificacion") = ImporteBonificacion Group By CveVentaBonificacion = dr("CveVentaBonificacion").ToString().ToEntero
Into x = Group
Select New With {
.CveVentaBonificacion = CveVentaBonificacion,
.ImporteBonificacion = x.Sum(Function(s) s("ImporteBonificacion").ToString().ToDecimal),
.IVABonificacion = x.Sum(Function(s) s("IVABonificacion").ToString().ToDecimal)
}
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})
Next
SbFiltro.Remove(SbFiltro.Length - 1, 1)
SbFiltro.Append(")")
End If
If ListaBon.Count > 0 Then
Dim Bonificaciones = Me.TmpDTRNCBonificacionesCliente.Select(SbFiltro.ToString())
For Each RowBonificacion As DataRow In Bonificaciones
Dim RNCBonificacion = ListaBon.Where(Function(x) x.CveVentaBonificacion = RowBonificacion("CveVenta").ToString().ToEntero())
RowBonificacion("ImporteBonificacion") = RNCBonificacion.Sum(Function(x) x.ImporteBonificacion)
RowBonificacion("IVABonificacion") = RNCBonificacion.Sum(Function(x) x.IVABonificacion)
RowBonificacion("CveVentaRNCCargo") = GvRow.DataKey("CveVenta").ToEntero() RowBonificacion("CveVentaRNCCargo") = GvRow.DataKey("CveVenta").ToEntero()
If ChkAplicarRNC.Checked Then If ChkAplicarRNC.Checked Then
TmpDTRNCBonificacionesSeleccionadas.Rows.Add(RowBonificacion.ItemArray) TmpDTRNCBonificacionesSeleccionadas.Rows.Add(RowBonificacion.ItemArray)
Else Else
Dim RowEliminar As DataRow = Me.TmpDTRNCBonificacionesSeleccionadas.Select($"CveVenta = {CveVentaBonificacion}").FirstOrDefault() For Each RowEliminar In Me.TmpDTRNCBonificacionesSeleccionadas.Select(SbFiltro.ToString())
TmpDTRNCBonificacionesSeleccionadas.Rows.Remove(RowEliminar) RowEliminar.Delete()
Next
End If End If
Next
End If End If
@@ -23160,7 +23198,7 @@ Partial Class Ventas
GvDescNCBonificaciones.DataSource = TmpDTRNCBonificacionesSeleccionadas GvDescNCBonificaciones.DataSource = TmpDTRNCBonificacionesSeleccionadas
GvDescNCBonificaciones.DataBind() GvDescNCBonificaciones.DataBind()
LblSaldoMaximoBonificacion.Text = String.Format("{0:N2}", Me.TmpDTRNCBonificacionesSeleccionadas.SUM("ImporteBonificacion").ToDecimal()) LblSaldoMaximoBonificacion.Text = String.Format("{0:N2}", Me.TmpDTRNCBonificacionesSeleccionadas.SUM("ImporteBonificacion").ToDecimal() + Me.TmpDTRNCBonificacionesSeleccionadas.SUM("IVABonificacion").ToDecimal())
UpDescNC.Update() UpDescNC.Update()
@@ -23173,28 +23211,52 @@ Partial Class Ventas
TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Clone() TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Clone()
End If End If
Dim CveVentaBonificacion As Integer = -1 Dim ListaBon As New List(Of VentasBonificaciones)
Dim ImporteBonificacion As Decimal = 0 Dim DtBon As DataTable = Nothing
Dim SbFiltro As New StringBuilder()
SbFiltro.Append("CveVenta IN(")
Using ObjAcum As New ClsAcumuladores Using ObjAcum As New ClsAcumuladores
If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=GvRow.DataKey("CveVenta").ToEntero()) Then If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=GvRow.DataKey("CveVenta").ToEntero()) Then
Dim RowMovto As DataRow = ObjAcum.DtResultados.FiltroPrimero("") DtBon = ObjAcum.DtResultados.Copy()
CveVentaBonificacion = RowMovto("CveVentaBonificacion").ToString().ToEntero()
ImporteBonificacion = RowMovto("ImporteBonificacion").ToString().ToDecimal()
End If End If
End Using End Using
If CveVentaBonificacion > 0 Then If DtBon IsNot Nothing Then
Dim RowBonificacion As DataRow = Me.TmpDTRNCBonificacionesCliente.FiltroPrimero($"CveVenta = {CveVentaBonificacion}") Dim queryBonificacion = From dr In DtBon
RowBonificacion("ImporteBonificacion") = ImporteBonificacion Group By CveVentaBonificacion = dr("CveVentaBonificacion").ToString().ToEntero
Into x = Group
Select New With {
.CveVentaBonificacion = CveVentaBonificacion,
.ImporteBonificacion = x.Sum(Function(s) s("ImporteBonificacion").ToString().ToDecimal),
.IVABonificacion = x.Sum(Function(s) s("IVABonificacion").ToString().ToDecimal)
}
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})
Next
SbFiltro.Remove(SbFiltro.Length - 1, 1)
SbFiltro.Append(")")
End If
If ListaBon.Count > 0 Then
Dim Bonificaciones = Me.TmpDTRNCBonificacionesCliente.Select(SbFiltro.ToString())
For Each RowBonificacion As DataRow In Bonificaciones
Dim RNCBonificacion = ListaBon.Where(Function(x) x.CveVentaBonificacion = RowBonificacion("CveVenta").ToString().ToEntero())
RowBonificacion("ImporteBonificacion") = RNCBonificacion.Sum(Function(x) x.ImporteBonificacion)
RowBonificacion("IVABonificacion") = RNCBonificacion.Sum(Function(x) x.IVABonificacion)
RowBonificacion("CveVentaRNCCargo") = GvRow.DataKey("CveVenta").ToEntero() RowBonificacion("CveVentaRNCCargo") = GvRow.DataKey("CveVenta").ToEntero()
If ChkAplicarRNC.Checked Then If ChkAplicarRNC.Checked Then
TmpDTRNCBonificacionesSeleccionadas.Rows.Add(RowBonificacion.ItemArray) TmpDTRNCBonificacionesSeleccionadas.Rows.Add(RowBonificacion.ItemArray)
Else Else
Dim RowEliminar As DataRow = Me.TmpDTRNCBonificacionesSeleccionadas.Select($"CveVenta = {CveVentaBonificacion}").FirstOrDefault() For Each RowEliminar In Me.TmpDTRNCBonificacionesSeleccionadas.Select(SbFiltro.ToString())
TmpDTRNCBonificacionesSeleccionadas.Rows.Remove(RowEliminar) RowEliminar.Delete()
Next
End If End If
Next
End If End If
@@ -23208,7 +23270,7 @@ Partial Class Ventas
GvRemisionesNCBon.DataSource = TmpDTRNCBonificacionesSeleccionadas GvRemisionesNCBon.DataSource = TmpDTRNCBonificacionesSeleccionadas
GvRemisionesNCBon.DataBind() GvRemisionesNCBon.DataBind()
LtlSMUBon.Text = String.Format("{0:N2}", Me.TmpDTRNCBonificacionesSeleccionadas.SUM("ImporteBonificacion").ToDecimal()) LtlSMUBon.Text = String.Format("{0:N2}", Me.TmpDTRNCBonificacionesSeleccionadas.SUM("ImporteBonificacion").ToDecimal() + Me.TmpDTRNCBonificacionesSeleccionadas.SUM("IVABonificacion").ToDecimal())
UpModalRemisionesNC.Update() UpModalRemisionesNC.Update()
@@ -23570,7 +23632,7 @@ Partial Class Ventas
Dim UltimoRenglonRNC As Integer = 1 Dim UltimoRenglonRNC As Integer = 1
For Each RowUsado As DataRow In RNC.DtDetalle.Rows For Each RowUsado As DataRow In RNC.DtDetalle.Rows
Dim PorcentajeUsado = (RowUsado("Total").ToString().ToDecimal() - RowUsado("Descuento").ToString().ToDecimal() + RowUsado("ImporteIVA").ToString().ToDecimal() + RowUsado("ImporteIEPS").ToString().ToDecimal() - RowUsado("ImporteRetIVA").ToString().ToDecimal() - RowUsado("ImporteRetISR").ToString().ToDecimal()) / RNC.Total Dim PorcentajeUsado = ((RowUsado("Total").ToString().ToDecimal() - RowUsado("Descuento").ToString().ToDecimal() + RowUsado("ImporteIVA").ToString().ToDecimal() + RowUsado("ImporteIEPS").ToString().ToDecimal() - RowUsado("ImporteRetIVA").ToString().ToDecimal() - RowUsado("ImporteRetISR").ToString().ToDecimal()) / RNC.Total) / ListaNC.Count
Dim Obs = RowUsado("CodigoPS").ToString() Dim Obs = RowUsado("CodigoPS").ToString()
If Not String.IsNullOrEmpty(TxtNCObservaciones.Text.Trim()) Then If Not String.IsNullOrEmpty(TxtNCObservaciones.Text.Trim()) Then
@@ -23615,7 +23677,7 @@ Partial Class Ventas
For Each RowCargo As DataRow In RNCCargo.DtDetalle.Rows For Each RowCargo As DataRow In RNCCargo.DtDetalle.Rows
Dim PorcentajeCargo = (RowCargo("Total").ToString().ToDecimal() - RowCargo("Descuento").ToString().ToDecimal() + RowCargo("ImporteIVA").ToString().ToDecimal() + RowCargo("ImporteIEPS").ToString().ToDecimal() - RowCargo("ImporteRetIVA").ToString().ToDecimal() - RowCargo("ImporteRetISR").ToString().ToDecimal()) / RNCCargo.Total Dim PorcentajeCargo = ((RowCargo("Total").ToString().ToDecimal() - RowCargo("Descuento").ToString().ToDecimal() + RowCargo("ImporteIVA").ToString().ToDecimal() + RowCargo("ImporteIEPS").ToString().ToDecimal() - RowCargo("ImporteRetIVA").ToString().ToDecimal() - RowCargo("ImporteRetISR").ToString().ToDecimal()) / RNCCargo.Total) / ListaNCBonificacion.Count
Dim Obs = RowCargo("CodigoPS").ToString() Dim Obs = RowCargo("CodigoPS").ToString()
@@ -26505,29 +26567,21 @@ Partial Class Ventas
End If 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, factura As Modelos.Factura) As Boolean
Dim Resultado As Boolean = True Dim Resultado As Boolean = True
If ClienteEsDistribuidor Then If ClienteEsDistribuidor AndAlso factura.TipoDocto.Contiene("Ing") Then
'If UsuarioActual.Empresa.Funcionalidad(533).ToEntero() > 0 Then
' Dim CvePSPSA As Integer = UsuarioActual.Empresa.Funcionalidad(533).ToEntero()
Dim ObjAcum As New ClsAcumuladores(SqlTransaccion) Dim ObjAcum As New ClsAcumuladores(SqlTransaccion)
Dim CvePSPSA As Integer = UsuarioActual.Empresa.Funcionalidad(533).ToEntero
For Each drow As DataRow In TmpDT.Rows For Each drow As DataRow In factura.DtDetalle.Rows
If drow("CveTamaño").ToString().ToEntero() > 0 Then If drow("CveTamaño").ToString.ToEntero > 0 And (CvePSPSA <> drow("CvePS").ToString.ToEntero) Then
Dim TempDTAcums = GlobalDTAcumTamaños.FiltraParametros("CvePSCargo = " & drow("CvePS").ToString()) If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, drow("Cantidad").ToString.ToEntero, drow("CveTamaño").ToString.ToEntero, 2, CveVenta, UsuarioActual.CveUsuario,
If TempDTAcums IsNot Nothing AndAlso TempDTAcums.Rows.Count > 0 Then
If Not ObjAcum.DistribuidorMovtosAdd(CveCliente, drow("Cantidad").ToString().ToEntero(), drow("CveTamaño").ToString().ToEntero(), 2, CveVenta, UsuarioActual.CveUsuario,
UsuarioActual.CveEmpresa, 0D, "") Then UsuarioActual.CveEmpresa, 0D, "") Then
Resultado = False Resultado = False
Exit For Exit For
End If End If
Else
Resultado = True
End If
TempDTAcums.Dispose()
End If End If
Next Next
Else Else
@@ -26645,6 +26699,7 @@ Partial Class Ventas
RegistraScript("$('#ModalAplicarDescuentoNC').modal('show'); ") RegistraScript("$('#ModalAplicarDescuentoNC').modal('show'); ")
End Sub End Sub
Protected Sub BtnAplicarDesc_Click(sender As Object, e As EventArgs) Protected Sub BtnAplicarDesc_Click(sender As Object, e As EventArgs)
Try
Dim CveSATNC = "84111506" Dim CveSATNC = "84111506"
Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, SATClavePS:=CveSATNC, AplicaParaVenta:=1).Rows(0) Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, SATClavePS:=CveSATNC, AplicaParaVenta:=1).Rows(0)
@@ -26686,7 +26741,7 @@ Partial Class Ventas
End If End If
Next Next
Dim LimiteUsados As Decimal = Me.TmpDT.SUM("Total", "EsCargo = True").ToDecimal() Dim LimiteUsados As Decimal = LblSaldoMaximoUsados.Text.Trim().ToDecimal()
'VERIFICA EL LIMITE DE LOS USADOS 'VERIFICA EL LIMITE DE LOS USADOS
If TotalRemNCAplicado > LimiteUsados Then If TotalRemNCAplicado > LimiteUsados Then
@@ -26695,6 +26750,7 @@ Partial Class Ventas
Exit Sub Exit Sub
End If End If
For Each GvRow As GridViewRow In GvDescNCBonificaciones.Rows For Each GvRow As GridViewRow In GvDescNCBonificaciones.Rows
If GvRow.RowType = DataControlRowType.DataRow Then If GvRow.RowType = DataControlRowType.DataRow Then
If GvRow.FCCheckBox("ChkAplicar").Checked Then If GvRow.FCCheckBox("ChkAplicar").Checked Then
@@ -26714,12 +26770,25 @@ Partial Class Ventas
End If End If
Next Next
Dim LimiteBonficaciones As Decimal = LblSaldoMaximoBonificacion.Text.Trim().ToDecimal()
'VERIFICA EL LIMITE DE LOS USADOS
If ListaNCBonificacion.Sum(Function(x) x.TotalRemNCAplicado) > LimiteBonficaciones Then
Alert($"La suma de las remisiones de nota de crédito de tipo 'Cargo' no debe superar el total de Usados.<br/>Total RNC: {TotalRemNCAplicado:N2}.<br/>Total Usados: {LimiteUsados:N2}", TipoMensaje.MsgAdvertencia)
ListaNCDesc.Clear()
Exit Sub
End If
HdnTotalRNC.Value = TotalRemNCAplicado.ToString()
LblDescuentosRNC.Text = TotalRemNCAplicado.FormatoNumero LblDescuentosRNC.Text = TotalRemNCAplicado.FormatoNumero
LblTotalNC.Text = (TxtTotal.Text.ToDecimal() - TotalRemNCAplicado).FormatoNumero LblTotalNC.Text = (TxtTotal.Text.ToDecimal() - TotalRemNCAplicado).FormatoNumero
Dim CvePS = DrPS("CvePS").ToString().ToEntero() Dim CvePS = DrPS("CvePS").ToString().ToEntero()
AplicarNC(CvePS, True) AplicarNC(CvePS, True)
Catch ex As Exception
OnError("Ocurrió un error al aplicar remisiones de nota de crédito", ex)
End Try
UpPS.Update() UpPS.Update()
@@ -27321,4 +27390,11 @@ Partial Class Ventas
#End Region #End Region
Partial Class VentasBonificaciones
Public CveVentaRNCCargo As Integer = -1
Public CveVentaBonificacion As Integer = -1
Public ImporteBonificacion As Decimal = 0
Public IVABonificacion As Decimal = 0
End Class
End Class End Class