local
This commit is contained in:
@@ -19,6 +19,16 @@
|
||||
<li>
|
||||
<asp:HyperLink ID="HlAgregarExcel" NavigateUrl="#" Visible="True" data-toggle="modal" data-target="#DivCargaExcel" runat="server"><i class='fa fa-server'></i> Importar Listado</asp:HyperLink>
|
||||
</li>
|
||||
<li>
|
||||
<asp:UpdatePanel ID="UpExportarExcel" runat="server">
|
||||
<ContentTemplate>
|
||||
<asp:LinkButton ID="LnkExportarExcel" Text="<i class='fa fa-file-excel-o'></i> ExportarExcel" runat="server" OnClick="LnkExportarExcel_Click"></asp:LinkButton>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:PostBackTrigger ControlID="LnkExportarExcel"/>
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
</li>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content6" ContentPlaceHolderID="C" runat="Server">
|
||||
|
||||
|
||||
@@ -5,7 +5,8 @@ Option Strict On
|
||||
Imports Extensiones
|
||||
Imports System.Data
|
||||
Imports GemBox.Spreadsheet
|
||||
|
||||
Imports System.IO
|
||||
|
||||
Partial Class Ventas_ActualizarPrecios
|
||||
Inherits ClsPaginas
|
||||
|
||||
@@ -17,6 +18,16 @@ Partial Class Ventas_ActualizarPrecios
|
||||
ViewState("DtSubProyectos") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property DtDatosPrecios As DataTable
|
||||
Get
|
||||
Return If(IsNothing(ViewState("DtDatosPrecios")), Nothing, CType(ViewState("DtDatosPrecios"), DataTable))
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtDatosPrecios") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property CveSucursal As Integer
|
||||
Get
|
||||
If ViewState("CveSucursal") Is Nothing Then
|
||||
@@ -145,7 +156,7 @@ Partial Class Ventas_ActualizarPrecios
|
||||
End Sub
|
||||
Private Sub CargarModelos()
|
||||
If UsuarioActual.Empresa.Funcionalidad(558).ToString = "1" Then
|
||||
lblModelo.visible = True
|
||||
lblModelo.Visible = True
|
||||
DdlModelo.Visible = True
|
||||
Dim ObjGeneral As New ClsGenerales
|
||||
If ObjGeneral.GetModelos(UsuarioActual.CveEmpresa) Then
|
||||
@@ -173,7 +184,8 @@ Partial Class Ventas_ActualizarPrecios
|
||||
|
||||
If objPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, DdlPrecioLista.SelectedValue.ToEntero, DDlClasificacion.SelectedValue.ToEntero, CvePS,
|
||||
CveProveedor:=CveProveedor, Estado:=DdlEstado.SelectedValue.ToEntero, Marcas:=Marcas, CveModelo:=DdlModelo.SelectedValue.ToEntero) Then
|
||||
GVPrecios.DataSource = objPS.DtResultados
|
||||
DtDatosPrecios = objPS.DtResultados
|
||||
GVPrecios.DataSource = DtDatosPrecios
|
||||
End If
|
||||
objPS.Dispose()
|
||||
|
||||
@@ -246,8 +258,8 @@ Partial Class Ventas_ActualizarPrecios
|
||||
TxtImporte.Text = ""
|
||||
TxtPrecio.Text = ""
|
||||
TxtPorcentaje.Text = ""
|
||||
End Sub
|
||||
|
||||
End Sub
|
||||
|
||||
#Region "MODAL PRECIOS MINIMOS"
|
||||
Public Sub LnkPrecioMinActual_Click(sender As Object, e As EventArgs)
|
||||
|
||||
@@ -305,10 +317,10 @@ Partial Class Ventas_ActualizarPrecios
|
||||
|
||||
ObjProductosServicios.Dispose()
|
||||
|
||||
End Sub
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
#Region "C A R G A R E X C E L "
|
||||
Private Sub BtnDescargarFormato_Click(sender As Object, e As EventArgs) Handles BtnDescargarFormato.Click
|
||||
|
||||
@@ -544,9 +556,9 @@ Partial Class Ventas_ActualizarPrecios
|
||||
End While
|
||||
|
||||
Return dataTable
|
||||
End Function
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
|
||||
Protected Sub gvSucursal_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
e.Row.FCTextBox("TxtPrecioMinimo").Attributes.Add("onKeyUp", String.Format("FncSeleccionaChk({0});", e.Row.FCCheckBox("chkSucursal").ClientID))
|
||||
@@ -592,5 +604,200 @@ Partial Class Ventas_ActualizarPrecios
|
||||
Return True
|
||||
End If
|
||||
|
||||
End Function
|
||||
End Function
|
||||
Protected Sub LnkExportarExcel_Click(sender As Object, e As EventArgs)
|
||||
Dim DtExcel As New DataTable("Precios")
|
||||
DtExcel.Columns.Add(New DataColumn("Código", GetType(String)))
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then 'Empresa Acumuladores
|
||||
DtExcel.Columns.Add(New DataColumn("Código CPK", GetType(String)))
|
||||
End If
|
||||
|
||||
DtExcel.Columns.Add(New DataColumn("Producto/Servicio", GetType(String)))
|
||||
DtExcel.Columns.Add(New DataColumn("Clasificación", GetType(String)))
|
||||
DtExcel.Columns.Add(New DataColumn("Importe", GetType(Decimal)))
|
||||
DtExcel.Columns.Add(New DataColumn("Precio Mínimo", GetType(Decimal)))
|
||||
DtExcel.Columns.Add(New DataColumn("U.M.", GetType(String)))
|
||||
DtExcel.Columns.Add(New DataColumn("Moneda", GetType(String)))
|
||||
|
||||
If UsuarioActual.CveEmpresa = 153 Then 'Empresa servec
|
||||
DtExcel.Columns.Add(New DataColumn("C. Promedio", GetType(Decimal)))
|
||||
End If
|
||||
|
||||
DtExcel.Columns.Add(New DataColumn("E. Mínimo", GetType(Decimal)))
|
||||
DtExcel.Columns.Add(New DataColumn("Importe Anterior", GetType(Decimal)))
|
||||
DtExcel.Columns.Add(New DataColumn("Precio Mínimo Anterior", GetType(Decimal)))
|
||||
DtExcel.Columns.Add(New DataColumn("Fecha Modificación", GetType(DateTime)))
|
||||
DtExcel.Columns.Add(New DataColumn("Usuario Modificó", GetType(String)))
|
||||
DtExcel.Columns.Add(New DataColumn("Porcentaje", GetType(Decimal)))
|
||||
DtExcel.Columns.Add(New DataColumn("Fecha Ingreso", GetType(Decimal)))
|
||||
DtExcel.Columns.Add(New DataColumn("Usuario Ingresó", GetType(String)))
|
||||
|
||||
|
||||
If DtDatosPrecios IsNot Nothing Then
|
||||
For Each Row As DataRow In DtDatosPrecios.Rows
|
||||
Dim NewRow As DataRow = DtExcel.NewRow()
|
||||
|
||||
NewRow("Código") = Row("Codigo")
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then 'Empresa Acumuladores
|
||||
NewRow("Código CPK") = Row("Codigo2")
|
||||
End If
|
||||
|
||||
NewRow("Producto/Servicio") = Row("PS")
|
||||
NewRow("Clasificación") = Row("Clasificacion")
|
||||
NewRow("Importe") = Row("PrecioLista")
|
||||
NewRow("Precio Mínimo") = Row("PrecioMinimo")
|
||||
NewRow("U.M.") = Row("UnidadMedida")
|
||||
NewRow("Moneda") = Row("Moneda")
|
||||
|
||||
If UsuarioActual.CveEmpresa = 153 Then 'Empresa servec
|
||||
NewRow("C. Promedio") = Row("CostoPromedio")
|
||||
End If
|
||||
|
||||
NewRow("E. Mínimo") = Row("VentaMinima")
|
||||
NewRow("Importe Anterior") = Row("ImporteAnterior")
|
||||
NewRow("Precio Mínimo Anterior") = Row("PrecioMinimoAnterior")
|
||||
NewRow("Fecha Modificación") = Row("FechaModificacion")
|
||||
NewRow("Usuario Modificó") = Row("UsuarioModifico")
|
||||
NewRow("Porcentaje") = Row("Porcentaje")
|
||||
NewRow("Fecha Ingreso") = Row("FechaIng")
|
||||
NewRow("Usuario Ingresó") = Row("Usuario")
|
||||
|
||||
DtExcel.Rows.Add(NewRow)
|
||||
Next
|
||||
End If
|
||||
|
||||
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
|
||||
|
||||
Dim FileExcel As New ExcelFile()
|
||||
|
||||
Dim worksheet = FileExcel.Worksheets.Add(DtExcel.TableName)
|
||||
worksheet.InsertDataTable(DtExcel, New InsertDataTableOptions() With
|
||||
{
|
||||
.ColumnHeaders = True,
|
||||
.StartRow = 0,
|
||||
.StartColumn = 0
|
||||
})
|
||||
worksheet.Rows(0).Style.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(75, 119, 190), SpreadsheetColor.FromArgb(255, 255, 255))
|
||||
worksheet.Rows(0).Style.Font.Color = SpreadsheetColor.FromArgb(255, 255, 255)
|
||||
|
||||
Dim columnCount = worksheet.CalculateMaxUsedColumns()
|
||||
For i = 0 To columnCount
|
||||
worksheet.Columns(i).AutoFit(1, worksheet.Rows(0), worksheet.Rows(worksheet.Rows.Count - 1))
|
||||
Next
|
||||
|
||||
Dim FechaIMes As String = "", FechaFMes As String = "", Titulo As String = "LISTADO DE PRECIOS", ListaPrecios As String = DdlPrecioLista.SelectedItem.Text, Divisor As Integer = 1, AlturaImagen As Double = 100, AnchoImagen As Double = 100, DatoTituloExtra As String = ""
|
||||
|
||||
|
||||
Dim TotalRowHeader As Integer = 8
|
||||
Dim TotalRowFooter As Integer = 2
|
||||
|
||||
|
||||
worksheet.Rows.InsertEmpty(0, TotalRowHeader)
|
||||
Dim celdasConTexto = worksheet.GetUsedCellRange(True)
|
||||
celdasConTexto.Style.Font.Name = "Calibri Light"
|
||||
|
||||
Dim RangoNombreEmpresa = worksheet.Cells.GetSubrangeAbsolute(1, celdasConTexto.FirstColumnIndex, 1, celdasConTexto.LastColumnIndex)
|
||||
RangoNombreEmpresa.Merged = True
|
||||
RangoNombreEmpresa.Value = UsuarioActual.Empresa.Empresa
|
||||
RangoNombreEmpresa.Style.Font.Size = 20 * 20
|
||||
RangoNombreEmpresa.Style.Font.Name = "Calibri Light"
|
||||
RangoNombreEmpresa.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
|
||||
RangoNombreEmpresa.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
|
||||
|
||||
|
||||
Dim RangoTitulo = worksheet.Cells.GetSubrangeAbsolute(3, celdasConTexto.FirstColumnIndex, 3, celdasConTexto.LastColumnIndex)
|
||||
RangoTitulo.Merged = True
|
||||
RangoTitulo.Value = Titulo
|
||||
RangoTitulo.Style.Font.Size = 17 * 20
|
||||
RangoTitulo.Style.Font.Name = "Calibri Light"
|
||||
RangoTitulo.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
|
||||
RangoTitulo.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
|
||||
|
||||
|
||||
'If FechaIMes.Trim.Length > 0 And FechaFMes.Trim.Length > 0 Then
|
||||
' Dim RangoFechas = worksheet.Cells.GetSubrangeAbsolute(4, celdasConTexto.FirstColumnIndex, 4, celdasConTexto.LastColumnIndex)
|
||||
' RangoFechas.Merged = True
|
||||
' RangoFechas.Value = $"Fechas: {FechaIMes} a {FechaFMes}"
|
||||
' RangoFechas.Style.Font.Size = 15 * 20
|
||||
' RangoFechas.Style.Font.Name = "Calibri Light"
|
||||
' RangoFechas.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
|
||||
' RangoFechas.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
|
||||
'End If
|
||||
|
||||
|
||||
If ListaPrecios.Length > 0 Then
|
||||
Dim RangoSubProyecto = worksheet.Cells.GetSubrangeAbsolute(5, celdasConTexto.FirstColumnIndex, 5, celdasConTexto.LastColumnIndex)
|
||||
RangoSubProyecto.Merged = True
|
||||
RangoSubProyecto.Value = $"Lista de precio: {ListaPrecios}"
|
||||
RangoSubProyecto.Style.Font.Size = 14 * 20
|
||||
RangoSubProyecto.Style.Font.Name = "Calibri Light"
|
||||
RangoSubProyecto.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
|
||||
RangoSubProyecto.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
|
||||
End If
|
||||
|
||||
|
||||
For i = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex
|
||||
|
||||
worksheet.Rows(8).Cells(i).Style.Font.Size = 12 * 20
|
||||
worksheet.Rows(8).Cells(i).Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
|
||||
worksheet.Rows(8).Cells(i).Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
|
||||
|
||||
worksheet.Rows(8).Cells(i).Style.FillPattern.SetPattern(GemBox.Spreadsheet.FillPatternStyle.Solid, GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190), GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255))
|
||||
worksheet.Rows(8).Cells(i).Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)
|
||||
|
||||
|
||||
|
||||
If i > 0 Then
|
||||
Try
|
||||
worksheet.Columns(i).AutoFit(1)
|
||||
Catch ex As Exception
|
||||
End Try
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
|
||||
Dim IndexEndTable As Integer = DtExcel.Rows.Count + TotalRowHeader + TotalRowFooter
|
||||
|
||||
worksheet.Rows(IndexEndTable).Cells(0).Value = "Usuario Imprimió"
|
||||
worksheet.Rows(IndexEndTable + 1).Cells(0).Value = UsuarioActual.Nombre
|
||||
|
||||
worksheet.Rows(IndexEndTable).Cells(2).Value = "Fecha Impresión"
|
||||
worksheet.Rows(IndexEndTable + 1).Cells(2).Value = DateTime.Now.ToString("dd/MM/yyyy")
|
||||
|
||||
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
|
||||
|
||||
If Imagen.Exists Then
|
||||
Dim Ruta As String = String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)
|
||||
Using sr As New StreamReader(Ruta)
|
||||
Dim ms As New MemoryStream()
|
||||
sr.BaseStream.CopyTo(ms)
|
||||
worksheet.Pictures.Add(ms, ExcelPictureFormat.Png, "A1", AnchoImagen, AlturaImagen, LengthUnit.Pixel)
|
||||
End Using
|
||||
End If
|
||||
|
||||
|
||||
For I = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex
|
||||
|
||||
If I > 0 Then
|
||||
|
||||
If Divisor = 1 Then
|
||||
worksheet.Columns(I + 1).Style.NumberFormat = "#,##0.00"
|
||||
Else
|
||||
worksheet.Columns(I + 1).Style.NumberFormat = "#,##"
|
||||
End If
|
||||
|
||||
Try
|
||||
worksheet.Columns(I).AutoFit(1)
|
||||
Catch ex As Exception
|
||||
End Try
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
FileExcel.Save(Response, "Precios.xlsx", SaveOptions.XlsxDefault)
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
155
Ventas/PV.aspx
155
Ventas/PV.aspx
@@ -1584,6 +1584,12 @@
|
||||
<asp:Label ID="LblAmort" runat="server" ClientIDMode="Static" Text="0.00" Style="display: none;"></asp:Label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="TrDescuentoIncluido" runat="server" visible="false">
|
||||
<td>Descuento Incluido:</td>
|
||||
<td>
|
||||
<asp:Label ID="LblDescuentoIncluido" runat="server" ClientIDMode="Static" Text="0.00"></asp:Label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Por Porcentaje</td>
|
||||
<td>
|
||||
@@ -1604,6 +1610,12 @@
|
||||
($)
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="TrDescuentoAdicional" runat="server" visible="false">
|
||||
<td>Descuento Adicional:</td>
|
||||
<td>
|
||||
<asp:Label ID="LblDescuentoAdicional" runat="server" ClientIDMode="Static" Text="0.00"></asp:Label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<b>
|
||||
@@ -2846,6 +2858,7 @@
|
||||
<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>
|
||||
<asp:HiddenField ID="HdnDescuentoOriginal" runat="server" Value="0" ClientIDMode="Static" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
@@ -3374,6 +3387,68 @@
|
||||
|
||||
}
|
||||
|
||||
function CalculaDescuentoAdicional() {
|
||||
if ($get("TxtPorDescP").value != "0" && $get("TxtPorDescP").value != "") {
|
||||
var MontoOriginal = ToDouble($get("HdnDescuentoOriginal").value);
|
||||
|
||||
var Monto = 0;
|
||||
var TipoDescuento = $get("HdnTipoDescuento").value;
|
||||
|
||||
if (TipoDescuento == 0) {
|
||||
Monto = parseFloat($get("LblPrecio1").innerText.replace(",", "").replace(",", ""));
|
||||
}
|
||||
else if (TipoDescuento == 1) {
|
||||
Monto = parseFloat($get("LblTotalPS1").innerText.replace(",", "").replace(",", ""));
|
||||
}
|
||||
else if (TipoDescuento == 2) {
|
||||
Monto = parseFloat($get("LblSubTotal1").innerText.replace(",", "").replace(",", ""));
|
||||
}
|
||||
else if (TipoDescuento == 3) {
|
||||
Monto = parseFloat($get("LblSubTotal1").innerText.replace(",", "").replace(",", ""));
|
||||
}
|
||||
|
||||
if (MontoOriginal > 0) {
|
||||
Monto = Monto - MontoOriginal;
|
||||
}
|
||||
|
||||
var Descuento = parseFloat($get("TxtPorDescP").value);
|
||||
var PorcentajeDescuentoMaximo = parseFloat($get("HdnPorcentajeDescuentoMaximo").value);
|
||||
|
||||
if (PorcentajeDescuentoMaximo > 0 && Descuento > PorcentajeDescuentoMaximo) {
|
||||
$get("TxtDescP").value = "0";
|
||||
$get("TxtPorDescP").value = "0";
|
||||
$get("LblDescuentoAdicional").innerText = "0.00";
|
||||
Descuento = 0;
|
||||
alert("No puede exceder el descuento maximo autorizado.");
|
||||
}
|
||||
|
||||
$get("LblPrecioFinal").innerText = formato_numero(Monto - ((Monto * Descuento) / 100), 2, '.', ',');
|
||||
$get("LblTotalPS").innerText = formato_numero(parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", "")), 2, '.', ',');
|
||||
var Total = (Monto - parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", ""))) ;
|
||||
|
||||
$get("LblDescuentoAdicional").innerText = formato_numero(Total, 2, '.', ',');
|
||||
|
||||
//SUMA EL DESCUENTO YA EXISTENTE AL ORIGINAL
|
||||
Total = Total + MontoOriginal;
|
||||
|
||||
$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 {
|
||||
$get("LblPrecioFinal").innerText = "0.00";
|
||||
$get("LblDescuento").innerText = "0.00";
|
||||
$get("HdnDescuento").value = "0.00";
|
||||
$get("LblDescuentoAdicional").innerText = "0.00";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function CalculaDescuentoMonto() {
|
||||
|
||||
if ($get("TxtDescP").value != "0" && $get("TxtDescP").value) {
|
||||
@@ -3423,6 +3498,69 @@
|
||||
}
|
||||
}
|
||||
|
||||
function CalculaDescuentoMontoAdicional() {
|
||||
|
||||
if ($get("TxtDescP").value != "0" && $get("TxtDescP").value) {
|
||||
var MontoOriginal = ToDouble($get("HdnDescuentoOriginal").value);
|
||||
|
||||
var Monto = 0;
|
||||
var TipoDescuento = $get("HdnTipoDescuento").value;
|
||||
|
||||
if (TipoDescuento == 0) {
|
||||
Monto = parseFloat($get("LblPrecio1").innerText.replace(",", "").replace(",", ""));
|
||||
}
|
||||
else if (TipoDescuento == 1) {
|
||||
Monto = parseFloat($get("LblTotalPS1").innerText.replace(",", "").replace(",", ""));
|
||||
}
|
||||
else if (TipoDescuento == 2) {
|
||||
Monto = parseFloat($get("LblSubTotal1").innerText.replace(",", "").replace(",", ""));
|
||||
}
|
||||
else if (TipoDescuento == 3) {
|
||||
Monto = parseFloat($get("LblSubTotal1").innerText.replace(",", "").replace(",", ""));
|
||||
}
|
||||
|
||||
if (MontoOriginal > 0) {
|
||||
Monto = Monto - MontoOriginal;
|
||||
}
|
||||
|
||||
var Descuento = parseFloat($get("TxtDescP").value);
|
||||
|
||||
var PorcentajeDescuento = (Descuento * 100 / Monto)
|
||||
var PorcentajeDescuentoMaximo = parseFloat($get("HdnPorcentajeDescuentoMaximo").value);
|
||||
|
||||
if (PorcentajeDescuentoMaximo > 0 && PorcentajeDescuento > PorcentajeDescuentoMaximo) {
|
||||
$get("TxtDescP").value = "0";
|
||||
$get("TxtPorDescP").value = "0";
|
||||
$get("LblDescuentoAdicional").innerText = "0.00";
|
||||
Descuento = 0;
|
||||
alert("No puede exceder el descuento maximo autorizado.");
|
||||
}
|
||||
|
||||
$get("TxtPorDescP").value = formato_numero((Descuento * 100 / Monto), 2, '.', ',');
|
||||
$get("LblPrecioFinal").innerText = formato_numero(Monto - Descuento, 2, '.', ',');
|
||||
$get("LblTotalPS").innerText = formato_numero(parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", "")), 2, '.', ',');
|
||||
var Total = Monto - parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", ""));
|
||||
|
||||
$get("LblDescuentoAdicional").innerText = formato_numero(Total, 2, '.', ',');
|
||||
|
||||
//SUMA EL DESCUENTO YA EXISTENTE AL ORIGINAL
|
||||
Total = Total + MontoOriginal;
|
||||
|
||||
$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(",", ""));
|
||||
}
|
||||
}
|
||||
else {
|
||||
$get("LblPrecioFinal").innerText = "0.00";
|
||||
$get("LblDescuento").innerText = "0.00";
|
||||
$get("HdnDescuento").value = "0.00";
|
||||
$get("LblDescuentoAdicional").innerText = "0.00";
|
||||
}
|
||||
}
|
||||
|
||||
function BorraDescuentos() {
|
||||
$get("TxtPorDescP").value = "0";
|
||||
$get("TxtDescP").value = "0";
|
||||
@@ -3433,6 +3571,23 @@
|
||||
$("#LblSubTotal1").text($("#TxtSubTotal").val());
|
||||
}
|
||||
|
||||
function AbrirModalDescuentoAdicional()
|
||||
{
|
||||
$('#ModalDescuento').modal();
|
||||
$get('LblTitulo1').style.display = '';
|
||||
$get('LblTitulo2').style.display = 'none';
|
||||
$get('LblTituloTipo1').style.display = '';
|
||||
$get('LblTituloTipo2').style.display = 'none';
|
||||
$get('HdnTipoDescuento').value = '0';
|
||||
$get('LblPrecio1').style.display = '';
|
||||
$get('LblTotalPS1').style.display = 'none';
|
||||
$get('LblSubTotal1').style.display = 'none';
|
||||
$get('LblAmort').style.display = 'none';
|
||||
$get('BtnAplicarDescP').style.display = '';
|
||||
$get('BtnAplicarDescG').style.display = 'none';
|
||||
$get('TrMotivoDescuento').style.display = '';
|
||||
}
|
||||
|
||||
function formato_numero(numero, decimales, separador_decimal, separador_miles) { // v2007-08-06
|
||||
numero = parseFloat(numero);
|
||||
if (isNaN(numero)) {
|
||||
|
||||
@@ -1062,7 +1062,7 @@ Partial Class PV
|
||||
ViewState("ClienteRetIVA") = 0
|
||||
ViewState("ClienteRetISR") = 0
|
||||
ViewState("EnviarCorreoCliente") = False
|
||||
HdnPorcentajeDescuentoMaximo.Value = UsuarioActual.DescuentoAutorizado.ToString()
|
||||
HdnPorcentajeDescuentoMaximo.Value = If(UsuarioActual.DescuentoAutorizado > 0, UsuarioActual.DescuentoAutorizado, 15).ToString()
|
||||
CveVentaDetalle = -1
|
||||
EstablecioFolio = False
|
||||
EstatusCliente = False
|
||||
@@ -1113,7 +1113,19 @@ Partial Class PV
|
||||
LblUsuario.Text = UsuarioActual.Usuario
|
||||
TxtCantidad.Attributes.Add("onKeyUp ", "Recalcula();")
|
||||
TxtPrecio.Attributes.Add("onKeyUp ", "Recalcula();")
|
||||
ImgDescPU.Attributes.Add("onclick", "javascript:$('#ModalDescuento').modal(); $get('LblTitulo1').style.display = ''; $get('LblTitulo2').style.display = 'none'; $get('LblTituloTipo1').style.display = ''; $get('LblTituloTipo2').style.display = 'none'; $get('HdnTipoDescuento').value = '0'; $get('LblPrecio1').style.display = ''; $get('LblTotalPS1').style.display = 'none'; $get('LblSubTotal1').style.display = 'none'; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = ''; $get('BtnAplicarDescG').style.display = 'none'; $get('TrMotivoDescuento').style.display = '';")
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
ImgDescPU.Attributes.Add("onclick", "javascript:AbrirModalDescuentoAdicional();")
|
||||
TxtPorDescP.Attributes.Add("onKeyUp", "CalculaDescuentoAdicional();")
|
||||
TxtDescP.Attributes.Add("onKeyUp", "CalculaDescuentoMontoAdicional();")
|
||||
TrDescuentoIncluido.Visible = True
|
||||
TrDescuentoAdicional.Visible = True
|
||||
Else
|
||||
ImgDescPU.Attributes.Add("onclick", "javascript:$('#ModalDescuento').modal(); $get('LblTitulo1').style.display = ''; $get('LblTitulo2').style.display = 'none'; $get('LblTituloTipo1').style.display = ''; $get('LblTituloTipo2').style.display = 'none'; $get('HdnTipoDescuento').value = '0'; $get('LblPrecio1').style.display = ''; $get('LblTotalPS1').style.display = 'none'; $get('LblSubTotal1').style.display = 'none'; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = ''; $get('BtnAplicarDescG').style.display = 'none'; $get('TrMotivoDescuento').style.display = '';")
|
||||
TxtPorDescP.Attributes.Add("onKeyUp", "CalculaDescuento();")
|
||||
TxtDescP.Attributes.Add("onKeyUp", "CalculaDescuentoMonto();")
|
||||
End If
|
||||
|
||||
'ImgDescConcepto.Attributes.Add("onclick", "javascript:$('#ModalDescuento').modal(); $get('LblTitulo1').style.display = ''; $get('LblTitulo2').style.display = 'none'; $get('LblTituloTipo1').style.display = ''; $get('LblTituloTipo2').style.display = 'none'; $get('HdnTipoDescuento').value = '1'; $get('LblPrecio1').style.display = 'none'; $get('LblTotalPS1').style.display = ''; $get('LblSubTotal1').style.display = 'none'; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = ''; $get('BtnAplicarDescG').style.display = 'none'; $get('TrMotivoDescuento').style.display = '';")
|
||||
'ImgDescTotal.Attributes.Add("onclick", "javascript:$('#ModalDescuento').modal(); $get('LblTitulo1').style.display = ''; $get('LblTitulo2').style.display = 'none'; $get('LblTituloTipo1').style.display = ''; $get('LblTituloTipo2').style.display = 'none'; $get('HdnTipoDescuento').value = '2'; $get('LblPrecio1').style.display = 'none'; $get('LblTotalPS1').style.display = 'none'; $get('LblSubTotal1').style.display = ''; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = 'none'; $get('BtnAplicarDescG').style.display = ''; $get('TrMotivoDescuento').style.display = '';")
|
||||
ImgOtrosConceptos.Attributes.Add("onclick", "javascript:$('#ModalOtrosConceptos').modal();")
|
||||
@@ -1131,8 +1143,8 @@ Partial Class PV
|
||||
'ImgCerrarTerminoCorte.Attributes.Add("OnClick", "$('#DivTerminarCorte').hide();")
|
||||
'ImgCerrarIE.Attributes.Add("OnClick", "$('#DivIngresoEgreso').hide();")
|
||||
'ImgCerrarEstadoCaja.Attributes.Add("OnClick", "$('#DivEstadoCaja').hide();")
|
||||
TxtPorDescP.Attributes.Add("onKeyUp", "CalculaDescuento();")
|
||||
TxtDescP.Attributes.Add("onKeyUp", "CalculaDescuentoMonto();")
|
||||
|
||||
|
||||
'TxtFechaAjuste.Attributes.Add("onchange", "CalculaMesesUso();")
|
||||
|
||||
CreaDTmpC()
|
||||
@@ -4049,6 +4061,14 @@ Partial Class PV
|
||||
TxtDescuento.Text = (PrecioSugerido * ClasificacionesDescuentos(drPS("CveClasificacion").ToString.ToEntero)).ToString("F2")
|
||||
End If
|
||||
|
||||
HdnDescuentoOriginal.Value = TxtDescuento.Text.ToDecimal().ToString()
|
||||
LblDescuentoIncluido.Text = TxtDescuento.Text.ToDecimal().FormatoNumero(2)
|
||||
|
||||
If PrecioSugerido > 0 AndAlso TxtDescuento.Text.ToDecimal() > 0 Then
|
||||
TxtPrecio.Text = PrecioSugerido.FormatoNumero()
|
||||
RegistraScript("$get('LblPrecio1').innerText = formato_numero(" + PrecioSugerido.ToString() + ", 2, '.', ',');", "A1")
|
||||
End If
|
||||
|
||||
If ChkAjuste.Checked Then
|
||||
CalculaMesesUso()
|
||||
UpAjuste.Update()
|
||||
@@ -4072,6 +4092,7 @@ Partial Class PV
|
||||
UpPS.Update()
|
||||
UpUnidadMedida.Update()
|
||||
UpAddVenta.Update()
|
||||
UPPDescuento.Update()
|
||||
End Sub
|
||||
Protected Sub DdlPS_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DdlPS.selectedindexchange
|
||||
DdlPSIndexChange(DdlPS.SelectedValue.ToEntero, DdlPS)
|
||||
|
||||
@@ -223,24 +223,32 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
|
||||
//sb.AppendFormat("{0} <br/>", respCancelacion.Mensaje);
|
||||
if (!respCancelacion.HuboError)
|
||||
{
|
||||
retorno.EnviarAcuse = true;
|
||||
CveEstatus = respCancelacion.CveEstatus;
|
||||
var ObjVentas = new ClsVentas();
|
||||
if (ObjVentas.UpdateEstatusVenta(CveVenta, CveEstatus, UsuarioActual.CveEmpresa))
|
||||
if (respCancelacion.CveEstatus > 0)
|
||||
{
|
||||
sb.Append("El estatus de la factura fue cambiado a 'Cancelada'.");
|
||||
retorno.EnviarAcuse = true;
|
||||
CveEstatus = respCancelacion.CveEstatus;
|
||||
var ObjVentas = new ClsVentas();
|
||||
if (ObjVentas.UpdateEstatusVenta(CveVenta, CveEstatus, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
sb.Append("El estatus de la factura fue cambiado a 'Cancelada'.");
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append("Ocurrió un error al cambiar el estatus de la factura.");
|
||||
}
|
||||
ObjVentas.Dispose();
|
||||
sb.Append("El documento se canceló correctamente.");
|
||||
sb.Append($"</br> <a href='/Compras/PopUpVerFactura.aspx?P={Encripta($"OP=CAN&CVEVTA={CveVenta}")}' class='Texto' target='_blank'>Imprimir Acuse</a>");
|
||||
if (!EsRefacturacion)
|
||||
{
|
||||
sb.Append("</br></br> ¿Desea enviar el Acuse de Cancelación al Cliente?");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.Append("Ocurrió un error al cambiar el estatus de la factura.");
|
||||
}
|
||||
ObjVentas.Dispose();
|
||||
sb.Append("El documento se canceló correctamente.");
|
||||
sb.Append($"</br> <a href='/Compras/PopUpVerFactura.aspx?P={Encripta($"OP=CAN&CVEVTA={CveVenta}")}' class='Texto' target='_blank'>Imprimir Acuse</a>");
|
||||
if (!EsRefacturacion)
|
||||
{
|
||||
sb.Append("</br></br> ¿Desea enviar el Acuse de Cancelación al Cliente?");
|
||||
sb.Append(respCancelacion.Mensaje);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (respCancelacion.CveEstatus.Contiene(4, 5) && EsRefacturacion)
|
||||
|
||||
@@ -2628,6 +2628,10 @@ Partial Class Ventas
|
||||
'DdlEstatus.Enabled = False
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
LnkAgregarCliente.Visible = True
|
||||
End If
|
||||
|
||||
End If
|
||||
CargaEstatusFactura(Opcion)
|
||||
|
||||
@@ -5632,7 +5636,7 @@ Partial Class Ventas
|
||||
ViewState("ClienteRetIVA") = ObjCliente.RetIVA / 100
|
||||
ViewState("ClienteRetISR") = ObjCliente.RetISR / 100
|
||||
|
||||
If CveVenta <= 0 Then
|
||||
If CveVenta <= 0 OrElse EsCreaApartirDe Then
|
||||
DdlTipoRetencion.SelectedValueExist(ObjCliente.DtResultados(0)("CveTipoRetencion").ToString())
|
||||
DdlTipoRetencion_SelectedIndexChanged(DdlTipoRetencion, EventArgs.Empty)
|
||||
|
||||
@@ -7689,13 +7693,7 @@ Partial Class Ventas
|
||||
Dim CveProducto As Integer
|
||||
Dim Existencia As Double
|
||||
Dim CveAlmacen = ddlAlmacen.SelectedValue.ToEntero()
|
||||
For Each dr As DataRow In TmpDT.Rows
|
||||
|
||||
'SI ES SERVICIO NO VALIDA
|
||||
'GlobalDTProductosServicios
|
||||
If GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=dr("CvePS").ToString().ToEntero()).FiltroPrimeroValor("CveTipoPS").ToString().ToEntero() = 1 Then
|
||||
Continue For
|
||||
End If
|
||||
For Each dr As DataRow In TmpDT.FiltraParametros("CveTipoPS = 2").Rows
|
||||
|
||||
If DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False Then
|
||||
'VALIDA EXISTENCIA
|
||||
@@ -18966,6 +18964,12 @@ Partial Class Ventas
|
||||
' rowSurtidos("Surtido").ToString().ToDouble < rowSurtidos("Cantidad").ToString().ToDouble AndAlso (dr("CantidadDisponible").ToString().ToDouble - rowSurtidos("Surtido").ToString().ToDouble > 0 Or dr("Serie").ToString() <> "")
|
||||
If rowSurtidos("Surtido").ToString().ToDecimal < rowSurtidos("Cantidad").ToString().ToDecimal Then
|
||||
Dim CantidadSurtida As Double = If(dr("CantidadDisponible").ToString().ToDecimal < rowSurtidos("Cantidad").ToString().ToDouble, dr("CantidadDisponible").ToString().ToDecimal, rowSurtidos("Cantidad").ToString().ToDecimal)
|
||||
|
||||
'SI LA CANTIDAD SURTIDA SUPERA LO REQUERIDO, TOMA SOLO LO NECESARIO PARA COMPLETAR
|
||||
If (rowSurtidos("Surtido").ToString().ToDecimal + CantidadSurtida) > rowSurtidos("Cantidad").ToString().ToDecimal Then
|
||||
CantidadSurtida = (rowSurtidos("Cantidad").ToString().ToDecimal - rowSurtidos("Surtido").ToString().ToDecimal)
|
||||
End If
|
||||
|
||||
MovDTCuadrados.ImportRow(dr)
|
||||
MovDTCuadrados(MovDTCuadrados.Rows.Count - 1)("Cantidad") = CantidadSurtida
|
||||
DtRemConceptosSurtidos(Indice)("Surtido") = rowSurtidos("Surtido").ToString().ToDecimal + CantidadSurtida
|
||||
@@ -26913,7 +26917,7 @@ Partial Class Ventas
|
||||
|
||||
For Each Dr As DataRow In DtImpuestosLocal.Rows
|
||||
FiltroStr = String.Format("ISNULL(PorcentajeIVA,0) = {0} AND ISNULL(PorcentajeRetIVA,0) = {1} AND ISNULL(PorcentajeRetISR,0) = {2} AND ISNULL(PorcentajeIEPS,0) = {3} AND ISNULL(CveSubProyecto,0) = {4} ", Dr("PorcentajeIVA").ToString().ToDecimal, Dr("PorcentajeRetIVA").ToString().ToDecimal, Dr("PorcentajeRetISR").ToString().ToDecimal, Dr("PorcentajeIEPS").ToString().ToDecimal, Dr("CveSubProyecto"))
|
||||
Dim importePuTemp As Decimal = (Porcentaje * (TmpDT.SUMD("Total", FiltroStr) - TmpDT.SUMD("Descuento", FiltroStr)))
|
||||
Dim importePuTemp As Decimal = (Porcentaje * (TmpDT.SUMD("TotalImporte", FiltroStr) - TmpDT.SUMD("Descuento", FiltroStr)))
|
||||
|
||||
If Not AplicaImpuestosLocales Then
|
||||
importePuTemp = importePuTemp - TotalImpuestosLocalesVentaOriginal
|
||||
@@ -29767,7 +29771,7 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
ObjCliente.Dispose()
|
||||
'DdlTipoRetencion_SelectedIndexChanged(DdlTipoRetencion, EventArgs.Empty)
|
||||
DdlTipoRetencion_SelectedIndexChanged(DdlTipoRetencion, EventArgs.Empty)
|
||||
|
||||
TrVistaPrevia.Visible = True
|
||||
TxtFechaVencimientoCotizacion.Text = Now.ToShortDateString
|
||||
@@ -31158,6 +31162,8 @@ Partial Class Ventas
|
||||
tClienteRetIVA = 0.04D
|
||||
ElseIf DdlTipoRetencion.SelectedValue.Contiene("4") AndAlso CBool(RowServicio("EsOutSourcing").ToString()) Then
|
||||
tClienteRetIVA = 0.06D
|
||||
ElseIf DdlTipoRetencion.SelectedValue.Contiene("0") Then
|
||||
tClienteRetIVA = 0.00D
|
||||
End If
|
||||
ViewState("ClienteRetIVA") = tClienteRetIVA
|
||||
End If
|
||||
|
||||
Reference in New Issue
Block a user