This commit is contained in:
2019-11-08 09:31:21 -07:00
18 changed files with 1260 additions and 100 deletions

View File

@@ -2729,7 +2729,16 @@
<label for="<%= TxtPrecio.ClientID.ToString()%>">Precio:</label>
</div>
</div>
<div class="col-md-8">
<div class="col-md-3">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtDescuento" runat="server" onkeypress="setFocus(event,'LbAgregar');" onkeyup="Recalcula();" CausesValidation="true" lang="nb" ClientIDMode="Static" Text="0.00" MaxLength="12" ValidationGroup="GrpAddVenta" Width="100px" CssClass="form-control "></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender2" runat="server" TargetControlID="TxtDescuento" FilterType="Custom, Numbers" ValidChars="." />
<asp:CustomValidator ID="CVDescuento" runat="server" ClientValidationFunction="ValidaDecimal6digits" ControlToValidate="TxtDescuento" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Descuento''</b> no tiene el formato correcto. Por favor rectifique y vuelva a intentar." ValidateEmptyText="True" ValidationGroup="GrpAddVenta"></asp:CustomValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender6" runat="server" HighlightCssClass="vco" TargetControlID="CVDescuento" Width="300px"></ajax:ValidatorCalloutExtender>
<label for="<%= TxtDescuento.ClientID.ToString()%>">Descuento:</label>
</div>
</div>
<div class="col-md-1" >
<asp:UpdatePanel ID="UpBtnDescuento" runat="server" class="portlet-body form" UpdateMode="Conditional">
<ContentTemplate>
<asp:LinkButton ID="ImgDescPU" runat="server" Text="<i class='fa fa-tags' style='color:dimgray;'></i>" Style="cursor: pointer;" AlternateText="Agregar Descuento" />
@@ -3115,15 +3124,27 @@
var Descuento = parseFloat($get("TxtPorDescP").value);
$get("LblPrecioFinal").innerText = formato_numero(Monto - ((Monto * Descuento) / 100), 2, '.', ',');
$get("TxtPrecio").value = formato_numero(parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", "")), 2, '.', ',');
$get("LblTotalPS").innerText = formato_numero(parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", "")), 2, '.', ',');
var Total = Monto - parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", ""));
$get("LblDescuento").innerText = formato_numero(Total, 2, '.', ',');
$get("LblDescuento").innerText = formato_numero(Total, 2, '.', ',');
$get("TxtDescuento").value = formato_numero(Total, 2, '.', ',');
$get("TxtDescP").value = formato_numero(0, 2, '.', ',');
$get("HdnDescuento").value = Total;
if (TipoDescuento == 2) {
$get("LblDescuentos").innerText = formato_numero(Total, 2, '.', ',');
}
}
else if ($get("TxtDescP").value != "0" && $get("TxtDescP").value) {
else {
$get("LblPrecioFinal").innerText = "0.00";
$get("LblDescuento").innerText = "0.00";
$get("HdnDescuento").value = "0.00";
}
}
function CalculaDescuentoMonto() {
if ($get("TxtDescP").value != "0" && $get("TxtDescP").value) {
var Monto = 0;
var TipoDescuento = $get("HdnTipoDescuento").value;
@@ -3141,11 +3162,12 @@
}
var Descuento = parseFloat($get("TxtDescP").value);
$get("TxtPorDescP").value = Descuento * 100 / Monto * 10
$get("TxtPorDescP").value = formato_numero((Descuento * 100 / Monto), 2, '.', ',');
$get("LblPrecioFinal").innerText = formato_numero(Monto - Descuento, 2, '.', ',');
$get("TxtPrecio").value = formato_numero(parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", "")), 2, '.', ',');
$get("LblTotalPS").innerText = formato_numero(parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", "")), 2, '.', ',');
var Total = Monto - parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", ""));
$get("LblDescuento").innerText = formato_numero(Total, 2, '.', ',');
$get("LblDescuento").innerText = formato_numero(Total, 2, '.', ',');
$get("TxtDescuento").value = formato_numero(Total, 2, '.', ',');
$get("HdnDescuento").value = Total;
if (TipoDescuento == 2) {
Monto - parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", ""));
@@ -3156,7 +3178,6 @@
$get("LblDescuento").innerText = "0.00";
$get("HdnDescuento").value = "0.00";
}
}
function BorraDescuentos() {

View File

@@ -1062,7 +1062,7 @@ Partial Class PV
'ImgCerrarIE.Attributes.Add("OnClick", "$('#DivIngresoEgreso').hide();")
'ImgCerrarEstadoCaja.Attributes.Add("OnClick", "$('#DivEstadoCaja').hide();")
TxtPorDescP.Attributes.Add("onKeyUp", "CalculaDescuento();")
TxtDescP.Attributes.Add("onKeyUp", "CalculaDescuento();")
TxtDescP.Attributes.Add("onKeyUp", "CalculaDescuentoMonto();")
TxtFechaAjuste.Attributes.Add("onchange", "CalculaMesesUso();")
CreaDTmpC()
@@ -2771,6 +2771,9 @@ Partial Class PV
Exit Sub
End If
TxtDescuento.Text = FormatoNumero(0, 2)
TxtPrecio.Text = ""
If CvePSParametro > 0 Then
Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSParametro).FiltroPrimero("")
@@ -2828,6 +2831,7 @@ Partial Class PV
End If
If PrecioSugerido > 0 Then
TxtPrecio.Text = PrecioSugerido.FormatoNumero()
RegistraScript("$get('LblPrecio1').innerText = formato_numero(" + PrecioSugerido.ToString + ", 2, '.', ',');")
End If
@@ -3478,13 +3482,50 @@ Partial Class PV
Return False
End If
Dim CantidadUsados As Decimal = 0
'Validacion de Recepción de Usados
Dim Vendido As Decimal = 0
Dim Entregado As Decimal = 0
Dim UltimoEntregado As Decimal = 0
For Each Gvr As GridViewRow In GvRecepcionUsados.Rows
If Gvr.RowType = DataControlRowType.DataRow Then
CantidadUsados = CantidadUsados + Gvr.FCTextBox("TxtCantidad").Text.ToEntero()
If Gvr.FCTextBox("TxtCantidad").Text.ToEntero() > 0 Then
Entregado += (Gvr.FCTextBox("TxtCantidad").Text.ToEntero * Gvr.DataKey("Cargo").ToDecimal)
UltimoEntregado = Gvr.DataKey("Cargo").ToDecimal
End If
End If
Next
If Entregado > 0 Then
'Calcular Vendido
Dim DTTamanios As New DataTable
Dim ObjAcum As New ClsAcumuladores
If ObjAcum.TamañoGet(-1, UsuarioActual.CveEmpresa) Then
DTTamanios = ObjAcum.DtResultados
End If
ObjAcum.Dispose()
Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
If DTTamanios.Rows.Count > 0 And DTTamanios IsNot Nothing And DrPS("CveTamaño").ToString.ToEntero > 0 Then
Vendido = DTTamanios.FiltroPrimeroValor("Cargo", $" CveTamaño = { DrPS("CveTamaño") }").ToDecimal
End If
If Entregado > Vendido Then
If (Entregado - Vendido) >= UltimoEntregado Then
Alert("No puede entregar un cargo mayor a lo Vendido", TipoMensaje.MsgAdvertencia)
Return False
End If
End If
End If
'Dim CantidadUsados As Decimal = 0
'For Each Gvr As GridViewRow In GvRecepcionUsados.Rows
' If Gvr.RowType = DataControlRowType.DataRow Then
' CantidadUsados = CantidadUsados + Gvr.FCTextBox("TxtCantidad").Text.ToEntero()
' End If
'Next
'If CantidadUsados > TxtCantidad.Text.ToEntero() Then
' Alert("No puede tener una cantidad mayor a la de los cargos", TipoMensaje.MsgAdvertencia)
' Return False
@@ -4294,7 +4335,7 @@ Partial Class PV
Private Sub CargaCuentas()
DdlCuentaEfectivo.Items.Clear()
'DdlCuentaEfectivo.Items.Clear()
DdlCuentaTarjetaCredito.Items.Clear()
DdlCuentaTarjetaDebito.Items.Clear()
DdlCuentaCheque.Items.Clear()
@@ -4351,6 +4392,11 @@ Partial Class PV
If total <= 0 Then Alert("No se ha ingresado importe", TipoMensaje.MsgAdvertencia) : Exit Sub
If TxtCambio.Text.ToDecimal > 0 And TxtImporteEfectivo.Text.ToDecimal < TxtCambio.Text.ToDecimal Then
Alert("Debe haber un pago en efectivo y ser mayor que el cambio. Si no, ser pago exacto.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If (DtPagos.SUM("Importe").ToString.ToDecimal + total - TxtCambio.Text.ToDecimal) > TxtTotal.Text.ToDecimal Then
Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor rectifique.", TipoMensaje.MsgAdvertencia)
Exit Sub
@@ -4911,7 +4957,7 @@ Partial Class PV
TmpDTAjustes.Columns.Add("CveUM", GetType(Integer))
TmpDTAjustes.Columns.Add("CveVentaDetalle", GetType(Integer))
TmpDTAjustes.Columns.Add("CveVenta", GetType(Integer))
TmpDTAjustes.Columns.Add("PUFactura", GetType(Integer))
TmpDTAjustes.Columns.Add("PUFactura", GetType(Double))
End Sub
@@ -5085,18 +5131,21 @@ Partial Class PV
End Sub
Private Sub CalculaMesesUso()
Dim FechaI = TxtFechaAjuste.Text.ToDate.AddDays(1)
Dim FechaF = Now
'Dim NumDiasAlMes As Double = (365 / 12)
'Dim DiasTranscurridos = DateDiff(DateInterval.Day, FechaI, FechaF)
'Dim MesesTranscurridos As Double = (DiasTranscurridos / NumDiasAlMes)
'Dim Diff = Math.Round(MesesTranscurridos - Math.Truncate(MesesTranscurridos), 2)
Dim FechaI As Date = TxtFechaAjuste.Text.ToDate.AddDays(1)
Dim FechaF As Date = Now
Dim FechaT As Date = String.Format("{0}/{1}/{2}", FechaI.Day, FechaF.Month, FechaF.Year).ToDate 'armo la fecha con el día del mes actual
'Dim NoMesesTrascurridos = Math.Ceiling(MesesTranscurridos)
Dim NoMesesTrascurridos2 = DateDiff(DateInterval.Month, FechaI, FechaF)
Dim MesesTrascurridos As Integer = Math.Round(DateDiff(DateInterval.Day, FechaI, FechaT) / 30.4, 2).ToEntero 'saco los meses y lo redondeo
If FechaT > FechaF Then
'todavía está en el mes actual.
MesesTrascurridos = MesesTrascurridos
Else
MesesTrascurridos = MesesTrascurridos + 1
End If
TxtMesesUso.Text = MesesTrascurridos.ToString
'TxtMesesUso.Text = If(Diff > 0.5, NoMesesTrascurridos, NoMesesTrascurridos2).ToString()
TxtMesesUso.Text = NoMesesTrascurridos2
CalculaPorcentajeAjuste()
End Sub
@@ -5168,6 +5217,13 @@ Partial Class PV
End If
End If
'el ajuste no puede ser mayor al precio de lo vendido de nuevo
If (TxtPrecio.Text.ToDouble - ((TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoActual - CargoAnterior))) < 0 Then
TxtDescuentoAjuste.Text = TxtPrecio.Text
TxtImporteAjuste.Text = "0.00"
CargoAnterior = CargoActual
End If
TxtDescuentoAjuste.Text = ((TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoActual - CargoAnterior)).FormatoNumero
TxtDescuentoAjuste.ToolTip = $"La diferencia de ajuste fue: {(TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble).FormatoNumero()}. La diferencia de tamaños fue: {(CargoActual - CargoAnterior).FormatoNumero}."
End If
@@ -5285,6 +5341,7 @@ Partial Class PV
End If
Dr("Descuento") = Math.Round((TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoActual - CargoAnterior), NumeroDecimales)
If Dr("Descuento").ToString.ToDouble > TxtPrecio.Text.ToDouble Then Dr("Descuento") = TxtPrecio.Text.ToDouble
Dim TotalCalculableImpuestos As Decimal = (Dr("Cantidad").ToString.ToDecimal * (Dr("PU").ToString.ToDecimal)) - Dr("Descuento").ToString.ToDecimal
Dr("ImporteIVA") = Math.Round(Dr("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)

View File

@@ -216,7 +216,9 @@ Partial Class Ventas_RepVentasUtilidad
e.Row.CssClass = "Totales"
End If
If e.Row.DBCampo("CveVenta").ToEntero > 0 AndAlso Not CBool(e.Row.DBCampo("TienePago")) Then
e.Row.Cells(15).BackColor = Drawing.Color.LightPink
End If
Dim Liga As String = String.Format("/Ventas/RepVentasUtilidadDetalle.aspx?CveVenta={0}&CveVendedor={1}&FechaI={2:d}&FechaF={3:d}&CveCliente={4}&Orden={5}&CveSubProyecto={6}&CvePS={7}&CveClasificacion={8}",

View File

@@ -9576,24 +9576,24 @@ Partial Class Ventas
TCFluctuacion = GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal
End If
If DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Not Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
ImporteMN251 = Dr("Importe").ToString.ToDecimal * TCFluctuacion
ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
ImporteMN251 = Dr("Importe").ToString.ToDecimal * TCFluctuacion
ElseIf DdlMoneda.SelectedValue.ToEntero = 1 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
Importe251 = Dr("Importe").ToString.ToDecimal / TCFluctuacion
ImporteMN251 = Dr("Importe").ToString.ToDecimal
Else
ImporteMN251 = Dr("Importe").ToString.ToDecimal
End If
If DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Not Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
ImporteMN251 = Dr("Importe").ToString.ToDecimal * TCFluctuacion
ElseIf DdlMoneda.SelectedValue.ToEntero = 2 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
ImporteMN251 = Dr("Importe").ToString.ToDecimal * TCFluctuacion
ElseIf DdlMoneda.SelectedValue.ToEntero = 1 AndAlso Dr("TCCambioValuacion").ToString.ToDecimal > 1 Then
Importe251 = Dr("Importe").ToString.ToDecimal / TCFluctuacion
ImporteMN251 = Dr("Importe").ToString.ToDecimal
Else
ImporteMN251 = Dr("Importe").ToString.ToDecimal
End If
Importe251 = (Importe251 * Multiplicador).RoundSQL
Importe251 = Importe251.RoundSQL
Importe91 = (Importe91 * ValorMultiplicador).RoundSQL
ImporteMN91 = (ImporteMN91 * Multiplicador).RoundSQL
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${Importe91.FormatoNumero(2)}"
Importe91 = (Importe91).RoundSQL
ImporteMN91 = (ImporteMN91 * Multiplicador).RoundSQL
If tipoCambio > 1 Then Concepto += $" TC:{tipoCambio} ${Importe91.FormatoNumero(2)}"
CveUltimaVenta = Dr("CveVenta").ToString.ToEntero
CveUltimaVenta = Dr("CveVenta").ToString.ToEntero
Dim ImporteComplementarioIngreso As Decimal = 0
If UsaComplementariaClientes = True AndAlso tipoCambio > 1 Then
@@ -10304,9 +10304,9 @@ Partial Class Ventas
Exit For
End If
If DrPago("CveTipoMovimiento").ToString.ToEntero = 8 Then '13
DrPago("Importe") = DrPago("Importe").ToString.ToDecimal - TxtCambio.Text.ToDecimal
End If
'If DrPago("CveTipoMovimiento").ToString.ToEntero = 8 Then '13
' DrPago("Importe") = DrPago("Importe").ToString.ToDecimal - TxtCambio.Text.ToDecimal
'End If
CveIEPago = ObjBancos.AddBancos_IE(DrPago("CveCuenta").ToString.ToEntero, DrPago("CveTipoMovimiento").ToString.ToEntero, Fecha, FolioIE.ToString, String.Format("PAGO: {0}", TxtFolio.Text), DrPago("Importe").ToString.ToDouble, DdlMoneda.SelectedValue.ToEntero, tipoCambio, DrPago("Observaciones").ToString, "", False, False, -1, ObjFactura.CvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCorte:=CveCorte, MesesSinIntereses:=DrPago("MesesSinIntereses").ToString.ToEntero)
@@ -16464,10 +16464,15 @@ Partial Class Ventas
If total <= 0 Then Alert("No se ha ingresado importe", TipoMensaje.MsgAdvertencia) : Exit Sub
'If DtPagos.SUM("Importe").ToString.ToDecimal + total > TxtTotal.Text.ToDecimal Then
' Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor rectifique.", TipoMensaje.MsgAdvertencia)
' Exit Sub
'End If
If TxtCambio.Text.ToDecimal > 0 And TxtImporteEfectivo.Text.ToDecimal < TxtCambio.Text.ToDecimal Then
Alert("Debe haber un pago en efectivo y ser mayor que el cambio. Si no, ser pago exacto.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If (DtPagos.SUM("Importe").ToString.ToDecimal + total - TxtCambio.Text.ToDecimal) > TxtTotal.Text.ToDecimal Then
Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor rectifique.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
'Pago en Efectivo
If TxtImporteEfectivo.Text.ToDecimal > 0 Then
@@ -16477,7 +16482,7 @@ Partial Class Ventas
DrEfectivo("TipoMovimiento") = "Pago en Efectivo"
DrEfectivo("CveCuenta") = DdlCuentaEfectivo.SelectedValue
DrEfectivo("Cuenta") = DdlCuentaEfectivo.SelectedItem.Text
DrEfectivo("Importe") = TxtImporteEfectivo.Text
DrEfectivo("Importe") = TxtImporteEfectivo.Text.ToDecimal - TxtCambio.Text.ToDecimal
DrEfectivo("Folio") = CargaFolioContado(DdlCuentaEfectivo.SelectedValue.ToEntero, 6)
DrEfectivo("Observaciones") = ""
DrEfectivo("Tipo") = "Caja Chica"
@@ -16674,15 +16679,15 @@ Partial Class Ventas
Private Function ValidaPagosContado() As Boolean
Dim Retorno = False
If (UsuarioActual.CveEmpresa = 140) AndAlso (Not PermiteCredito) AndAlso (DtPagos Is Nothing OrElse DtPagos.Rows.Count = 0) Then
If (UsuarioActual.CveEmpresa = 140) AndAlso (Not PermiteCredito) AndAlso (DtPagos Is Nothing OrElse DtPagos.Rows.Count = 0) And TxtTotal.Text.ToDecimal > 0 Then
Alert("Es necesario especificar un pago.", TipoMensaje.MsgAdvertencia)
Retorno = True
End If
'If DtPagos.SUM("Importe").ToString.ToDecimal > TxtTotal.Text.ToDecimal Then
' Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia)
' Retorno = True
'End If
If (DtPagos.SUM("Importe").ToString.ToDecimal + Total - TxtCambio.Text.ToDecimal) > TxtTotal.Text.ToDecimal Then
Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia)
Retorno = True
End If
Return Retorno
End Function