This commit is contained in:
2025-02-01 12:29:28 -07:00
17 changed files with 1524 additions and 1126 deletions

View File

@@ -8019,6 +8019,10 @@ Public Class ClsPaginas
params.Add(New ReportParameter("Comprador", ObjOC.UsuarioAsignado)) params.Add(New ReportParameter("Comprador", ObjOC.UsuarioAsignado))
End If End If
If UsuarioActual.CveEmpresa.Contiene(189) Then
params.Add(New ReportParameter("DiasCreditoOC", dtOC(0)("DiasCreditoOC").ToString))
End If
If UsuarioActual.CveEmpresa.Contiene(13, 83) Then If UsuarioActual.CveEmpresa.Contiene(13, 83) Then
'Dim ObjCuentasBancos As New ClsGenerales() 'Dim ObjCuentasBancos As New ClsGenerales()
'If ObjCuentasBancos.GetCuentasDepositos(CveProveedor:=ObjOC.CveProveedor) Then 'If ObjCuentasBancos.GetCuentasDepositos(CveProveedor:=ObjOC.CveProveedor) Then

View File

@@ -2611,6 +2611,27 @@ Public Class ClsVentas
Return Retorno Return Retorno
End Function End Function
Public Function UpdatePromocionEstatus(CvePromocion As Integer, Estatus As Boolean, CveUsuario As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_PromocionEstatusUpdate")
With SqlAdapter.SelectCommand.Parameters
.Add("@CvePromocion", SqlDbType.Float).Value = CvePromocion
.Add("@Estatus", SqlDbType.Bit).Value = Estatus
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al actualizar el estatus la Promoción.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
Public Function RemovePromociones(CvePromocion As Integer, CveEmpresa As Integer) As Boolean Public Function RemovePromociones(CvePromocion As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_Vta_PromocionesRemove") DataAdapter("PA_Vta_PromocionesRemove")
@@ -3267,7 +3288,8 @@ Public Class ClsVentas
Return Retorno Return Retorno
End Function End Function
Public Function GetRepRemisionesSinFacturar(FechaI As String, FechaF As String, FechaV As String, CveSubProyecto As String, CveCliente As Integer, CveContrato As Integer, CveVendedor As String, CveEmpresa As Integer, Optional CveUsuarioConsulta As Integer = -1, Optional ConsultaInventario As Boolean = False) As Boolean Public Function GetRepRemisionesSinFacturar(FechaI As String, FechaF As String, FechaV As String, CveSubProyecto As String, CveCliente As Integer, CveContrato As Integer, CveVendedor As String, CveEmpresa As Integer,
Optional CveUsuarioConsulta As Integer = -1, Optional ConsultaInventario As Boolean = False, Optional PrimerProducto As Boolean = False) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_Vta_RepRemisionesGet") DataAdapter("PA_Vta_RepRemisionesGet")
@@ -3282,6 +3304,7 @@ Public Class ClsVentas
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@CveUsuarioConsulta", SqlDbType.Int).Value = CveUsuarioConsulta .Add("@CveUsuarioConsulta", SqlDbType.Int).Value = CveUsuarioConsulta
.Add("@ConsultaInventario", SqlDbType.Bit).Value = ConsultaInventario .Add("@ConsultaInventario", SqlDbType.Bit).Value = ConsultaInventario
.Add("@PrimerProducto", SqlDbType.Bit).Value = PrimerProducto
End With End With
Try Try

View File

@@ -858,6 +858,7 @@ Partial Class Bancos_ProveedoresAbonar
Pago.CveMonedaPago = CveMoneda Pago.CveMonedaPago = CveMoneda
'inserto las compras que voy a pagar 'inserto las compras que voy a pagar
Dim nRow As Integer = 1
For Each gvr As GridViewRow In GvCxP.Rows For Each gvr As GridViewRow In GvCxP.Rows
If gvr.FCCheckBox("Chk").Checked Then If gvr.FCCheckBox("Chk").Checked Then
@@ -963,7 +964,7 @@ Partial Class Bancos_ProveedoresAbonar
If serieFolioArray.Length = 2 Then If serieFolioArray.Length = 2 Then
SerieRNC = serieFolioArray(0) SerieRNC = serieFolioArray(0)
FolioRNC = serieFolioArray(1) FolioRNC = serieFolioArray(1)
SerieFolioRNC = $"{FolioRNC}-D-{SerieRNC = serieFolioArray(0)}" SerieFolioRNC = $"D-{SerieRNC}-{ FolioRNC}"
Else Else
FolioRNC = serieFolioArray(0) FolioRNC = serieFolioArray(0)
@@ -992,9 +993,19 @@ Partial Class Bancos_ProveedoresAbonar
End If End If
Dim ExisteRNC As Boolean = False
If ObjComp.GetCompras(-1, $"D-{SerieRNC}", FolioRNC, CveProveedor, -1, UsuarioActual.CveEmpresa) Then
Dim dtRNC As DataTable = ObjComp.DtResultados.FiltraParametros(" TipoDocto ='RNC' ")
If dtRNC.Rows.Count > 0 Then
ExisteRNC = True
SerieFolioRNC = $"D{nRow}-{SerieRNC}-{ FolioRNC}"
End If
End If
Dim CveCompraRNC As Integer = GeneraRNC(Descuento, ObjComp.IniciaTransacSQL, gvr.DataKey("CveCompra").ToEntero, CompraActual, ObjMov, CvePrePoliza, CveProveedor, HplProveedor.Text, TxtFechaDocumento.Text.ToDate, Dim CveCompraRNC As Integer = GeneraRNC(Descuento, ObjComp.IniciaTransacSQL, gvr.DataKey("CveCompra").ToEntero, CompraActual, ObjMov, CvePrePoliza, CveProveedor, HplProveedor.Text, TxtFechaDocumento.Text.ToDate,
$"Remisión Nota de Crédito pago {gvr.DataKey("SerieFolio").ToString}", gvr.DataKey("CveMoneda").ToEntero, TxtTC.Text.ToDecimal, SerieRNC, FolioRNC, PorcentajeIVA:=PorcentajeIVA, $"Remisión Nota de Crédito pago {gvr.DataKey("SerieFolio").ToString}", gvr.DataKey("CveMoneda").ToEntero, TxtTC.Text.ToDecimal, SerieRNC, FolioRNC, PorcentajeIVA:=PorcentajeIVA,
CveSubProyecto:=gvr.DataKey("CveSubProyecto").ToEntero) CveSubProyecto:=gvr.DataKey("CveSubProyecto").ToEntero, nRow:=nRow, ExisteRNC:=ExisteRNC)
If CveCompraRNC > 0 Then If CveCompraRNC > 0 Then
@@ -1012,6 +1023,7 @@ Partial Class Bancos_ProveedoresAbonar
End If End If
nRow = nRow + 1
Next Next
Dim UsaComplementariaBancos As Boolean = Not UsuarioActual.CveEmpresa.Contiene(7, 11, 122, 145, 13, 83) Dim UsaComplementariaBancos As Boolean = Not UsuarioActual.CveEmpresa.Contiene(7, 11, 122, 145, 13, 83)
@@ -1956,7 +1968,7 @@ Partial Class Bancos_ProveedoresAbonar
Public Function GeneraRNC(ImporteRNC As Decimal, ByRef sqltransaccion As SqlTransaction, CveCompraAmortizada As Integer, ByRef CompraActual As Compra, ByRef ObjConta As ClsContabilidad, CvePrePoliza As Integer, Public Function GeneraRNC(ImporteRNC As Decimal, ByRef sqltransaccion As SqlTransaction, CveCompraAmortizada As Integer, ByRef CompraActual As Compra, ByRef ObjConta As ClsContabilidad, CvePrePoliza As Integer,
CveProveedor As Integer, NombreProveedor As String, Fecha As Date, Descripcion As String, CveMoneda As Integer, TipoCambio As Decimal, Serie As String, Folio As String, Optional EsDRMN As Boolean = False, CveProveedor As Integer, NombreProveedor As String, Fecha As Date, Descripcion As String, CveMoneda As Integer, TipoCambio As Decimal, Serie As String, Folio As String, Optional EsDRMN As Boolean = False,
Optional TmpListadoPS As DataTable = Nothing, Optional PorcentajeIVA As Decimal = 0, Optional CveSubProyecto As Integer = -1) As Integer Optional TmpListadoPS As DataTable = Nothing, Optional PorcentajeIVA As Decimal = 0, Optional CveSubProyecto As Integer = -1, Optional nRow As Integer = -1, Optional ExisteRNC As Boolean = False) As Integer
Dim CveCompraRNC As Integer = -1 Dim CveCompraRNC As Integer = -1
Dim respuesta As Boolean = True Dim respuesta As Boolean = True
'Dim PorcentajeIVA As Decimal = TmpDT.MAX("IVAPorcentaje").ToDecimal 'Dim PorcentajeIVA As Decimal = TmpDT.MAX("IVAPorcentaje").ToDecimal
@@ -1990,7 +2002,7 @@ Partial Class Bancos_ProveedoresAbonar
.Fecha = Fecha, .Fecha = Fecha,
.CveMoneda = CveMoneda, .CveMoneda = CveMoneda,
.TipoCambio = If(CveMoneda = 1, 1, TipoCambio), .TipoCambio = If(CveMoneda = 1, 1, TipoCambio),
.Serie = $"D-{Serie}", .Serie = If(ExisteRNC, $"D{nRow}-{Serie}", $"D-{Serie}"),
.Folio = Folio, .Folio = Folio,
.CveCompraAmortizacion = CveCompraAmortizada, .CveCompraAmortizacion = CveCompraAmortizada,
.CveCompraRelacionada = CveCompraAmortizada .CveCompraRelacionada = CveCompraAmortizada

View File

@@ -1810,19 +1810,21 @@
</Style> </Style>
</TextRun> </TextRun>
<TextRun> <TextRun>
<Value>=Parameters!FechaImpresion.Value</Value> <Value>=Format(Now, "dd/MM/yyyy HH:mm:ss")</Value>
<Style> <Style>
<FontFamily>Myriad Pro</FontFamily> <FontFamily>Myriad Pro</FontFamily>
<FontSize>8pt</FontSize> <FontSize>8pt</FontSize>
</Style> </Style>
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style /> <Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>Textbox31</rd:DefaultName> <rd:DefaultName>Textbox31</rd:DefaultName>
<Top>0.17639cm</Top> <Top>0.03528cm</Top>
<Left>8.8256cm</Left> <Left>7.58219cm</Left>
<Height>0.41981cm</Height> <Height>0.41981cm</Height>
<Width>6.02198cm</Width> <Width>6.02198cm</Width>
<Style> <Style>

View File

@@ -745,7 +745,6 @@
</Border> </Border>
</Style> </Style>
</Textbox> </Textbox>
<rd:Selected>true</rd:Selected>
</CellContents> </CellContents>
</TablixCell> </TablixCell>
<TablixCell> <TablixCell>
@@ -1819,6 +1818,37 @@
<TextAlign>Left</TextAlign> <TextAlign>Left</TextAlign>
</Style> </Style>
</Paragraph> </Paragraph>
<Paragraph>
<TextRuns>
<TextRun>
<Value>Condiciones de Pago: </Value>
<Style>
<FontFamily>calibri</FontFamily>
<FontSize>9pt</FontSize>
<FontWeight>SemiBold</FontWeight>
</Style>
</TextRun>
<TextRun>
<Value>=Parameters!DiasCreditoOC.Value</Value>
<Style>
<FontFamily>calibri</FontFamily>
<FontSize>9pt</FontSize>
<FontWeight>Normal</FontWeight>
</Style>
</TextRun>
<TextRun>
<Value> días.</Value>
<Style>
<FontFamily>calibri</FontFamily>
<FontSize>9pt</FontSize>
<FontWeight>Normal</FontWeight>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Left</TextAlign>
</Style>
</Paragraph>
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
@@ -2830,6 +2860,12 @@
<AllowBlank>true</AllowBlank> <AllowBlank>true</AllowBlank>
<Prompt>ReportParameter1</Prompt> <Prompt>ReportParameter1</Prompt>
</ReportParameter> </ReportParameter>
<ReportParameter Name="DiasCreditoOC">
<DataType>String</DataType>
<Nullable>true</Nullable>
<AllowBlank>true</AllowBlank>
<Prompt>ReportParameter1</Prompt>
</ReportParameter>
</ReportParameters> </ReportParameters>
<EmbeddedImages> <EmbeddedImages>
<EmbeddedImage Name="Logo"> <EmbeddedImage Name="Logo">

File diff suppressed because it is too large Load Diff

View File

@@ -1187,6 +1187,15 @@
</div> </div>
<asp:GridView ID="GvVentasEmail" runat="server" GridLines="None" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-sort="true" BorderWidth="1" BorderColor="#D3D3D3" CellSpacing="0" Width="100%" AutoGenerateColumns="False" data-heighterror="800" EmptyDataText="No se encontraron registros"> <asp:GridView ID="GvVentasEmail" runat="server" GridLines="None" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-sort="true" BorderWidth="1" BorderColor="#D3D3D3" CellSpacing="0" Width="100%" AutoGenerateColumns="False" data-heighterror="800" EmptyDataText="No se encontraron registros">
<Columns> <Columns>
<asp:TemplateField HeaderText="Seleccionar">
<HeaderTemplate>
<input type="checkbox" id="chkSelectAll" onclick="toggleCheckboxes()" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" CssClass="chkItem" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:HyperLinkField HeaderText="Serie-Folio" ItemStyle-Width="15%" DataNavigateUrlFields="CveVenta" DataTextField="SerieFolio" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" Target="_blank" /> <asp:HyperLinkField HeaderText="Serie-Folio" ItemStyle-Width="15%" DataNavigateUrlFields="CveVenta" DataTextField="SerieFolio" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" Target="_blank" />
<asp:BoundField DataField="Fecha" ItemStyle-Width="15%" HeaderText="Fecha" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:d}" /> <asp:BoundField DataField="Fecha" ItemStyle-Width="15%" HeaderText="Fecha" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:d}" />
@@ -1196,6 +1205,7 @@
</asp:GridView> </asp:GridView>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<asp:Button runat="server" Text="Enviar Seleccionados" CssClass="btn btn-primary" ID="BtnEnviarVentasSinCorreo" />
<button data-dismiss="modal" class="btn btn-default">Cancelar</button> <button data-dismiss="modal" class="btn btn-default">Cancelar</button>
</div> </div>
</ContentTemplate> </ContentTemplate>
@@ -2167,6 +2177,15 @@
} }
function toggleCheckboxes() {
var isChecked = $('#chkSelectAll').prop('checked');
// Buscar solo los elementos INPUT de tipo CHECKBOX dentro del GridView
$('#<%= GvVentasEmail.ClientID %> input[type="checkbox"][id*=chkSelect]').each(function () {
$(this).prop('checked', isChecked);
});
}
</script> </script>
<%-- TERMINA FULL CALENDAR --%> <%-- TERMINA FULL CALENDAR --%>

View File

@@ -113,6 +113,13 @@
font-weight: 600; font-weight: 600;
color: #3e4f5e; color: #3e4f5e;
} }
.modal-dialog {
display: flex;
align-items: center;
justify-content: center;
min-height: 50vh;
}
</style> </style>
</asp:Content> </asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HB" runat="Server"> <asp:Content ID="Content3" ContentPlaceHolderID="HB" runat="Server">
@@ -418,7 +425,7 @@
</asp:UpdatePanel> </asp:UpdatePanel>
<div class="row"> <div class="row">
<div class="col-md-6"> <div class="col-md-8">
<asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="UpNumeroParte"> <asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="UpNumeroParte">
<ContentTemplate> <ContentTemplate>
<asp:Label runat="server" ID="LblNumeroParte" Text="" Visible ="false"></asp:Label> <asp:Label runat="server" ID="LblNumeroParte" Text="" Visible ="false"></asp:Label>
@@ -426,7 +433,25 @@
</asp:UpdatePanel> </asp:UpdatePanel>
</div> </div>
<div class="col-md-6"> <div class="col-md-2" style="text-align:right!important">
<asp:UpdatePanel runat="server" ID="UpOCS" UpdateMode="Conditional">
<ContentTemplate>
<div id="DivIndicadorOC2" runat="server" visible="false" >
<div style=" color: gray;font-size: 12px;font-weight: bold;">
OC
</div>
<div style=" color: blue; font-size: 20px; font-weight: bold;">
<asp:LinkButton ID="LnkIndicador_OC2" Text="" OnClick="LnkIndicador_OC_Click" runat="server" CssClass="Texto" />
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="col-md-2">
<div class="text-right" style="margin: 5px 0px;"> <div class="text-right" style="margin: 5px 0px;">
<input type="text" id="TxtBusqueda2" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda2','{0}')", GvM.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" /> <input type="text" id="TxtBusqueda2" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda2','{0}')", GvM.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda2','{0}')", GvM.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a> <a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda2','{0}')", GvM.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>

View File

@@ -301,7 +301,7 @@ Partial Class Inventarios_Kardex
If NumeroParte.Trim.Length > 0 Then If NumeroParte.Trim.Length > 0 Then
If UsuarioActual.TienePermisoPagina(13) Then If UsuarioActual.TienePermisoPagina(13) Then
LblNumeroParte.Text = $" Producto: <a href='../Ventas/ProductosServicios.aspx?CvePS={CvePS}' class='Texto' target='_blank' > {Codigo} -{NumeroParte} - {PS}</a>" LblNumeroParte.Text = $" Producto: <a href='../Ventas/ProductosServicios.aspx?CvePS={CvePS}' class='Texto' target='_blank' >{Codigo}</a> - <a href='../Ventas/ProductosServicios.aspx?CvePS={CvePS}' class='Texto' target='_blank' >{NumeroParte}</a> - <a href='../Ventas/ProductosServicios.aspx?CvePS={CvePS}' class='Texto' target='_blank' >{PS}</a>"
Else Else
LblNumeroParte.Text = $" Producto: {NumeroParte}" LblNumeroParte.Text = $" Producto: {NumeroParte}"
End If End If
@@ -333,10 +333,12 @@ Partial Class Inventarios_Kardex
If ObjOC.PendientesCompra(ddlProducto2.SelectedValue.ToEntero, tCveSubProyectos, UsuarioActual.CveEmpresa) Then If ObjOC.PendientesCompra(ddlProducto2.SelectedValue.ToEntero, tCveSubProyectos, UsuarioActual.CveEmpresa) Then
GvOC.DataSource = ObjOC.DtResultados.Copy.FiltraParametros("", "Fecha Desc") GvOC.DataSource = ObjOC.DtResultados.Copy.FiltraParametros("", "Fecha Desc")
LnkIndicador_OC.Text = ObjOC.DtResultados.Copy.SUM("CantidadPendienteVincular").ToString() LnkIndicador_OC.Text = ObjOC.DtResultados.Copy.SUM("CantidadPendienteVincular").ToString()
LnkIndicador_OC2.Text = ObjOC.DtResultados.Copy.SUM("CantidadPendienteVincular").ToString()
End If End If
ObjOC.Dispose() ObjOC.Dispose()
GvOC.DataBind() GvOC.DataBind()
UpModalOC.Update() UpModalOC.Update()
UpOCS.Update()
End Sub End Sub
Private Function CargarKardex(CvePS As Integer) As DataTable Private Function CargarKardex(CvePS As Integer) As DataTable
@@ -408,6 +410,8 @@ Partial Class Inventarios_Kardex
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
CargarOCPendientesCompra() CargarOCPendientesCompra()
DivIndicadorOC.Visible = True DivIndicadorOC.Visible = True
DivIndicadorOC2.Visible = True
UpOCS.Update()
End If End If
UpIndicadores.Update() UpIndicadores.Update()

View File

@@ -174,7 +174,7 @@
<asp:BoundField HeaderText="Tipo Docto" DataField="TipoDocto" ItemStyle-Width="55px" /> <asp:BoundField HeaderText="Tipo Docto" DataField="TipoDocto" ItemStyle-Width="55px" />
<%--1--%> <%--1--%>
<asp:HyperLinkField DataNavigateUrlFields="CveVenta" DataNavigateUrlFormatString="~/Ventas/Ventas.aspx?CveVenta={0}" Target="_blank" ItemStyle-Width="80px" HeaderText="SerieFolio" ControlStyle-CssClass="Texto" DataTextField="SerieFolio" /> <asp:HyperLinkField DataNavigateUrlFields="CveVenta" DataNavigateUrlFormatString="~/Ventas/Ventas.aspx?CveVenta={0}" Target="_blank" ItemStyle-Width="80px" HeaderText="SerieFolio" ControlStyle-CssClass="Texto" DataTextField="SerieFolio" />
<asp:TemplateField HeaderText="Fecha" ItemStyle-Width="90px" ItemStyle-HorizontalAlign="Center"> <asp:TemplateField HeaderText="Fecha" ItemStyle-Width="150px" ItemStyle-HorizontalAlign="Center">
<ItemTemplate> <ItemTemplate>
<asp:Label ID="LtlFechaFactura" runat="server" ></asp:Label> <asp:Label ID="LtlFechaFactura" runat="server" ></asp:Label>
</ItemTemplate> </ItemTemplate>
@@ -184,7 +184,7 @@
<%--3--%> <%--3--%>
<asp:BoundField HeaderText="Total" DataField="Total" DataFormatString="{0:n2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="Total" DataField="Total" DataFormatString="{0:n2}" ItemStyle-HorizontalAlign="Right" />
<%--4--%> <%--4--%>
<asp:BoundField HeaderText="Sucursal" DataField="SubProyecto" ItemStyle-Width="100px" /> <asp:BoundField HeaderText="Sucursal" DataField="SubProyecto" ItemStyle-Width="200px" />
<%--5--%> <%--5--%>
<asp:BoundField HeaderText="Tipo Venta" DataField="TipoVenta" Visible="false" /> <asp:BoundField HeaderText="Tipo Venta" DataField="TipoVenta" Visible="false" />
<%--6--%> <%--6--%>

View File

@@ -329,7 +329,7 @@ Partial Class RepNotasSinAlmacen
If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then ' es empresa hospitalaria If UsuarioActual.Empresa.Funcionalidad(578) = "1" Then ' es empresa hospitalaria
e.Row.Cells(2).Text = $"<div style='display:none'>{e.Row.DBCampo("Fecha").ToDateTime.ToString("dd/MM/yyyy")}</div> {e.Row.DBCampo("Fecha").ToDateTime.ToString("dd/MM/yyyy HH:mm")}" e.Row.Cells(2).Text = $"<div style='display:none'>{e.Row.DBCampo("Fecha").ToDateTime.ToString("dd/MM/yyyy")}</div> {e.Row.DBCampo("Fecha").ToDateTime.ToString("dd/MM/yyyy HH:mm")}"
Else Else
e.Row.Cells(2).Text = $"{e.Row.DBCampo("Fecha").ToDateTime.ToString("dd/MM/yyyy")}" e.Row.Cells(2).Text = $"{e.Row.DBCampo("Fecha").ToDateTime.ToString("dd/MM/yyyy HH:mm:ss")}"
End If End If
If e.Row.DataKey("EsDevolucionVenta").ToEntero = 1 Then If e.Row.DataKey("EsDevolucionVenta").ToEntero = 1 Then

View File

@@ -18,11 +18,24 @@ Partial Class ListadoContratos
ViewState("DtAvanceDocumento") = value ViewState("DtAvanceDocumento") = value
End Set End Set
End Property End Property
Private Property DtDatos As DataTable
Get
Return CType(ViewState("DtDatos"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtDatos") = value
End Set
End Property
#End Region #End Region
#Region "Carga Página" #Region "Carga Página"
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then If Not IsPostBack Then
DtDatos = New DataTable
txtFechaI.Text = DateTime.Now.AddMonths(-1).ToShortDateString txtFechaI.Text = DateTime.Now.AddMonths(-1).ToShortDateString
txtFechaF.Text = DateTime.Now.AddDays(1).ToShortDateString txtFechaF.Text = DateTime.Now.AddDays(1).ToShortDateString
InicializaCombos() InicializaCombos()
@@ -63,6 +76,7 @@ Partial Class ListadoContratos
If ObjContratos.GetContratosReporte(UsuarioActual.CveEmpresa, MinFecha, MaxFecha, DdlCliente.SelectedValue.ToEntero, DdlEstatus.SelectedValue.ToEntero, CveSubProyecto:=DdlCentroCostos.SelectedValue.ToEntero, CveTipoAF:=DdlTipoUnidad.SelectedValue.ToEntero, CveChofer:=DdlChofer.SelectedValue.ToEntero, If ObjContratos.GetContratosReporte(UsuarioActual.CveEmpresa, MinFecha, MaxFecha, DdlCliente.SelectedValue.ToEntero, DdlEstatus.SelectedValue.ToEntero, CveSubProyecto:=DdlCentroCostos.SelectedValue.ToEntero, CveTipoAF:=DdlTipoUnidad.SelectedValue.ToEntero, CveChofer:=DdlChofer.SelectedValue.ToEntero,
FechaInicioIngreso:=txtFechaI.Text.ToDate, FechaFinIngreso:=txtFechaF.Text.ToDate) Then FechaInicioIngreso:=txtFechaI.Text.ToDate, FechaFinIngreso:=txtFechaF.Text.ToDate) Then
GvContratos.DataSource = ObjContratos.DtResultados GvContratos.DataSource = ObjContratos.DtResultados
DtDatos = ObjContratos.DtResultados.Copy
End If End If
ObjContratos.Dispose() ObjContratos.Dispose()
@@ -265,15 +279,19 @@ Partial Class ListadoContratos
UpModal.Update() UpModal.Update()
End Sub End Sub
Protected Sub LnkExcel_Click(sender As Object, e As EventArgs) Handles LnkExcel.Click Protected Sub LnkExcel_Click(sender As Object, e As EventArgs) Handles LnkExcel.Click
GvContratos.ExportToExcel("ReporteCompras" & NowADS().ToShortDateString) 'GvContratos.ExportToExcel("ReporteCompras" & NowADS().ToShortDateString)
ImprimeReporte("Excel")
End Sub End Sub
Protected Sub LnkPDF_Click(sender As Object, e As EventArgs) Handles LnkPdf.Click Protected Sub LnkPDF_Click(sender As Object, e As EventArgs) Handles LnkPdf.Click
Dim ObjContratos As New ClsContratos ImprimeReporte("PDF")
If ObjContratos.GetContratos(-1, UsuarioActual.CveEmpresa, TipoContrato:=2) Then End Sub
Private Sub ImprimeReporte(Formato As String)
'Dim ObjContratos As New ClsContratos
If DtDatos.Rows.Count > 0 Then
Dim Imagen As New IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png") Dim Imagen As New IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png")
Dim logouri As String = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) Dim logouri As String = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
Dim Cliente As String = If(DdlClientes.SelectedValue = "-1", "", $"&emsp;<b>Cliente:</b>&nbsp;{DdlClientes.SelectedText}") Dim Cliente As String = If(DdlClientes.SelectedValue = "-1", "", $"&emsp;<b>Cliente:</b>&nbsp;{DdlClientes.SelectedText}")
Dim dt As DataTable = ObjContratos.DtResultados
Dim params As New List(Of ReportParameter) From { Dim params As New List(Of ReportParameter) From {
New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa), New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa),
New ReportParameter("FechaInicio", "-1"), New ReportParameter("FechaInicio", "-1"),
@@ -283,11 +301,11 @@ Partial Class ListadoContratos
New ReportParameter("FechaImpresion", NowADS().ToDateTime.ToShortDateString), New ReportParameter("FechaImpresion", NowADS().ToDateTime.ToShortDateString),
New ReportParameter("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", "")) New ReportParameter("LogoPath", If(Imagen.Exists, $"file://{Imagen.FullName}", ""))
} }
ImprimirPDF("Empresas/Grales/Formatos/RepContratos.rdlc", dt, params, NombreArchivo:="Reporte Contratos") ImprimirPDF("Empresas/Grales/Formatos/RepContratos.rdlc", DtDatos, params, NombreArchivo:="Reporte Contratos", Formato:=Formato)
Else Else
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia) Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
End If End If
ObjContratos.Dispose()
End Sub End Sub
Protected Sub Consultar(sender As Object, e As EventArgs) Protected Sub Consultar(sender As Object, e As EventArgs)
CargaDatos() CargaDatos()

View File

@@ -8,6 +8,9 @@
<li> <li>
<asp:LinkButton ID="ImgAddPromocion" PostBackUrl="/Ventas/Promociones.aspx" CommandArgument="-1" runat="server"><i class="fa fa-plus-circle"></i>Nueva Promoción</asp:LinkButton> <asp:LinkButton ID="ImgAddPromocion" PostBackUrl="/Ventas/Promociones.aspx" CommandArgument="-1" runat="server"><i class="fa fa-plus-circle"></i>Nueva Promoción</asp:LinkButton>
</li> </li>
<li>
<asp:LinkButton ID="LnkAccInactivar" runat="server" OnClick="LnkAccInactivar_Click" Visible="false"><i class="fa fa-times" aria-hidden="true"></i>Inactivar</asp:LinkButton>
</li>
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
</asp:Content> </asp:Content>
@@ -90,16 +93,47 @@
<div class="row" style="margin-right: 10px; margin-top: 18px;" align="right"> <div class="row" style="margin-right: 10px; margin-top: 18px;" align="right">
<input type="text" id="TxtBusqueda" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvDatos.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvDatos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a> <div class="col-md-8">
</div>
<div class="col-md-2">
<asp:UpdatePanel runat="server" ID="UpInactivar" UpdateMode="Conditional">
<ContentTemplate>
<asp:LinkButton runat="server" ID="LnkInactivar" CssClass="btn btn-primary" OnClick="LnkInactivar_Click" Visible="false"
data-toggle="confirmation" data-popout="true" data-original-title="¿Inactivar selección?" data-btn-ok-label="si" ><i class="fa fa-times" aria-hidden="true"></i> Inactivar</asp:LinkButton>
</ContentTemplate>
</asp:UpdatePanel>
</div> </div>
<div class="col-md-2">
<input type="text" id="TxtBusqueda" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvDatos.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvDatos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div>
</div>
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional"> <asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<asp:GridView ID="GvDatos" CssClass="table table-striped table-hover Widthall ScrollAD" data-sort="true" runat="server" AutoGenerateColumns="False" GridLines="None"> <asp:GridView ID="GvDatos" CssClass="table table-striped table-hover Widthall ScrollAD" data-sort="true" runat="server" AutoGenerateColumns="False" GridLines="None"
DataKeyNames="CvePromocion"
>
<Columns> <Columns>
<asp:TemplateField HeaderText="" ItemStyle-HorizontalAlign="Left" Visible="false" >
<HeaderTemplate>
<input type="checkbox" id="chkSelectAll" onclick="checkAll()" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox runat="server" ID="chk" CssClass="selChk" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Promoción" ItemStyle-HorizontalAlign="Left"> <asp:TemplateField HeaderText="Promoción" ItemStyle-HorizontalAlign="Left">
<ItemTemplate> <ItemTemplate>
<asp:HyperLink runat="server" ID="HLPromocion" Text='<%# Eval("Promocion").ToString %>' NavigateUrl ='<%# Eval("CvePromocion", "/Ventas/Promociones.aspx?CvePromocion={0}") %>' CssClass="Texto"></asp:HyperLink> <asp:HyperLink runat="server" ID="HLPromocion" Text='<%# Eval("Promocion").ToString %>' NavigateUrl ='<%# Eval("CvePromocion", "/Ventas/Promociones.aspx?CvePromocion={0}") %>' CssClass="Texto"></asp:HyperLink>
@@ -128,5 +162,18 @@
</asp:Content> </asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="JS" runat="Server"> <asp:Content ID="Content6" ContentPlaceHolderID="JS" runat="Server">
<script>
function checkAll() {
var isChecked = $('#chkSelectAll').prop('checked');
$('#<%= GvDatos.ClientID %> input[type="checkbox"][id*=chk]').each(function () {
$(this).prop('checked', isChecked);
});
}
</script>
</asp:Content> </asp:Content>

View File

@@ -22,18 +22,25 @@ Partial Class Ventas_CatPromociones
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then If Not Page.IsPostBack Then
If UsuarioActual.TienePermisoProceso(386) Then
LnkAccInactivar.Visible = True
End If
InicializaControles() InicializaControles()
OcultarMostrarInactivar(True)
CargaDatos() CargaDatos()
End If End If
End Sub End Sub
Private Sub InicializaControles() Private Sub InicializaControles()
CargarCentrosDeCosto(Nothing, Nothing, Nothing, LblSubProyecto) CargarCentrosDeCosto(Nothing, Nothing, Nothing, LblSubProyecto)
GvDatos.Columns(6).HeaderText = LblSubProyecto.Text GvDatos.Columns(7).HeaderText = LblSubProyecto.Text
DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa) DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa)
DdlSubProyecto.DataBind() DdlSubProyecto.DataBind()
@@ -95,4 +102,50 @@ Partial Class Ventas_CatPromociones
CargaDatos() CargaDatos()
End Sub End Sub
Protected Sub LnkAccInactivar_Click(sender As Object, e As EventArgs)
OcultarMostrarInactivar(True)
End Sub
Private Sub OcultarMostrarInactivar(Mostrar As Boolean)
GvDatos.Columns(0).Visible = Mostrar
LnkInactivar.Visible = Mostrar
UpInactivar.Update()
UpDatos.Update()
End Sub
Protected Sub LnkInactivar_Click(sender As Object, e As EventArgs)
Dim ObjVentas As New ClsVentas
ObjVentas.IniciaTransacSQL()
Dim ErrorProceo As Boolean = False
Dim ContInactivadas As Integer = 0
For Each GvRow As GridViewRow In GvDatos.Rows
Dim Chk As CheckBox = GvRow.FCCheckBox("chk")
Dim CvePromocion As Integer = GvRow.DataKey("CvePromocion").ToEntero
If Chk.Checked Then
If ObjVentas.UpdatePromocionEstatus(CvePromocion, False, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
ContInactivadas = ContInactivadas + 1
Else
ErrorProceo = True
Exit Sub
End If
End If
Next
If ErrorProceo Then
ObjVentas.RollBack()
Else
ObjVentas.Commit()
Alert($"Se inactivaron {ContInactivadas} promociones.")
OcultarMostrarInactivar(False)
End If
ObjVentas.Dispose()
End Sub
End Class End Class

View File

@@ -216,13 +216,13 @@
</div> </div>
<asp:UpdatePanel ID="UPDatos" runat="server" UpdateMode="Conditional"> <asp:UpdatePanel ID="UPDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontró ninguna remisión pendiente por facturar" DataKeyNames="CveVenta" <asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontró ninguna remisión pendiente por facturar" DataKeyNames="CveVenta,Fecha"
ToolTip="Remisiones sin Facturar" ToolTip="Remisiones sin Facturar"
CssClass="table table-striped table-advance table-hover Widthall ScrollAD" CssClass="table table-striped table-advance table-hover Widthall ScrollAD"
data-sort="true" GridLines="None"> data-sort="true" GridLines="None">
<Columns> <Columns>
<asp:HyperLinkField HeaderText="Folio" ItemStyle-Width="100px" DataTextField ="Folio" DataNavigateUrlFormatString="/Ventas/RepRemisionesDetalle.aspx?CveVenta={0}" DataNavigateUrlFields="CveVenta" Target="_blank" /> <asp:HyperLinkField HeaderText="Folio" ItemStyle-Width="100px" DataTextField ="Folio" DataNavigateUrlFormatString="/Ventas/RepRemisionesDetalle.aspx?CveVenta={0}" DataNavigateUrlFields="CveVenta" Target="_blank" />
<asp:HyperLinkField HeaderText="Fecha" ItemStyle-Width="100px" DataTextField ="Fecha" DataTextFormatString="{0:d}" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" DataNavigateUrlFields="CveVenta" /> <asp:HyperLinkField HeaderText="Fecha" ItemStyle-Width="150px" DataTextField ="Fecha" DataTextFormatString="{0:d}" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" DataNavigateUrlFields="CveVenta" />
<asp:BoundField HeaderText="Vencimiento" DataField="FechaVencimiento" DataFormatString="{0:d}" /> <asp:BoundField HeaderText="Vencimiento" DataField="FechaVencimiento" DataFormatString="{0:d}" />
<asp:BoundField HeaderText="Cliente" DataField="Cliente" /> <asp:BoundField HeaderText="Cliente" DataField="Cliente" />
<asp:BoundField HeaderText="Contrato" DataField="TieneContrato" Visible="false" /> <asp:BoundField HeaderText="Contrato" DataField="TieneContrato" Visible="false" />
@@ -230,6 +230,7 @@
<asp:BoundField HeaderText="Procedimiento" DataField="Procedimiento" Visible="false" /> <asp:BoundField HeaderText="Procedimiento" DataField="Procedimiento" Visible="false" />
<asp:BoundField HeaderText="Folio Rem" DataField="Alfa1" Visible="false" /> <asp:BoundField HeaderText="Folio Rem" DataField="Alfa1" Visible="false" />
<asp:BoundField HeaderText="Vendedor" DataField="Vendedor" /> <asp:BoundField HeaderText="Vendedor" DataField="Vendedor" />
<asp:BoundField HeaderText="Producto" DataField="PrimerCodigoPS" Visible="false" />
<asp:BoundField DataField="PorcentajeAvance" HeaderText="Facturado" DataFormatString="{0:F}%" HtmlEncode="false" /> <asp:BoundField DataField="PorcentajeAvance" HeaderText="Facturado" DataFormatString="{0:F}%" HtmlEncode="false" />
<asp:BoundField DataField="SubTotal" HeaderText="SubTotal" DataFormatString="{0:N2}" Visible="false" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField DataField="SubTotal" HeaderText="SubTotal" DataFormatString="{0:N2}" Visible="false" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField DataField="Descuento" HeaderText="Descuento" DataFormatString="{0:N2}" Visible="false" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField DataField="Descuento" HeaderText="Descuento" DataFormatString="{0:N2}" Visible="false" ItemStyle-HorizontalAlign="Right" />

View File

@@ -67,7 +67,12 @@ Partial Class RepRemisiones
#End Region #End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then If Not Page.IsPostBack Then
If UsuarioActual.CveEmpresa.Contiene(189) Then
GvDatos.Columns(9).Visible = True
End If
CargaSucursales() CargaSucursales()
CargaCliente() CargaCliente()
CargaContrato() CargaContrato()
@@ -89,18 +94,19 @@ Partial Class RepRemisiones
Sucursales = IIf(DdlSubProyectos.GetSelectedValuesM = "", "-1", DdlSubProyectos.GetSelectedValuesM).ToString Sucursales = IIf(DdlSubProyectos.GetSelectedValuesM = "", "-1", DdlSubProyectos.GetSelectedValuesM).ToString
Dim Vendedores As String = IIf(DdlVendedor.GetSelectedValuesM = "", "-1", DdlVendedor.GetSelectedValuesM).ToString Dim Vendedores As String = IIf(DdlVendedor.GetSelectedValuesM = "", "-1", DdlVendedor.GetSelectedValuesM).ToString
Dim PrimerProducto As Boolean = If(UsuarioActual.CveEmpresa.Contiene(189), True, False)
Dim ObjVentas As New ClsVentas Dim ObjVentas As New ClsVentas
If ObjVentas.GetRepRemisionesSinFacturar(FechaI, FechaF, FechaV, Sucursales, CveCliente, CveContrato, Vendedores, UsuarioActual.CveEmpresa, CveUsuarioConsulta:=UsuarioActual.CveUsuario, ConsultaInventario:=chkInv.Checked) Then If ObjVentas.GetRepRemisionesSinFacturar(FechaI, FechaF, FechaV, Sucursales, CveCliente, CveContrato, Vendedores, UsuarioActual.CveEmpresa, CveUsuarioConsulta:=UsuarioActual.CveUsuario, ConsultaInventario:=chkInv.Checked, PrimerProducto:=PrimerProducto) Then
DtVentas = ObjVentas.DtResultados.Copy() DtVentas = ObjVentas.DtResultados.Copy()
GvDatos.DataSource = DtVentas GvDatos.DataSource = DtVentas
End If End If
If DtVentas IsNot Nothing Then If DtVentas IsNot Nothing Then
GvDatos.Columns(11).Visible = DtVentas.SUMD("Descuento") > 0 GvDatos.Columns(12).Visible = DtVentas.SUMD("Descuento") > 0
End If End If
GvDatos.Columns(14).Visible = chkInv.Checked 'solo se visualiza si está selccionada GvDatos.Columns(15).Visible = chkInv.Checked 'solo se visualiza si está selccionada
ObjVentas.Dispose() ObjVentas.Dispose()
GvDatos.DataBind() GvDatos.DataBind()
@@ -124,7 +130,10 @@ Partial Class RepRemisiones
e.Row.Cells(2).ForeColor = Drawing.Color.Red e.Row.Cells(2).ForeColor = Drawing.Color.Red
End If End If
e.Row.Cells(1).Text = $"<a href='./Ventas.aspx?CveVenta={e.Row.DataKey("CveVenta")}' targen='_blank'>{e.Row.DataKey("Fecha").ToDate().ToString("dd/MM/yyyy HH:mm:ss")}</a>"
End If End If
e.Row.FCLiteral("LtlTotal").Text = "<a class=""Texto"" target=""_blank"" href=""/Ventas/RepRemisionesDetalle.aspx?CveVenta=" & e.Row.DBCampo("CveVenta") & "&FechaI=" & FechaI & "&FechaF=" & FechaF & "&FechaV=" & FechaV & "&CveCliente=" & If(e.Row.DBCampo("CveCliente").ToString().ToEntero() > 0, e.Row.DBCampo("CveCliente").ToString(), DdlClientes.SelectedValue) & "&CveContrato=" & CveContrato & "&CveSubProyecto=" & Sucursales & "&CveMoneda=" & e.Row.DBCampo("CveMoneda") & """>" & e.Row.FCLiteral("LtlTotal").Text & "</a>" e.Row.FCLiteral("LtlTotal").Text = "<a class=""Texto"" target=""_blank"" href=""/Ventas/RepRemisionesDetalle.aspx?CveVenta=" & e.Row.DBCampo("CveVenta") & "&FechaI=" & FechaI & "&FechaF=" & FechaF & "&FechaV=" & FechaV & "&CveCliente=" & If(e.Row.DBCampo("CveCliente").ToString().ToEntero() > 0, e.Row.DBCampo("CveCliente").ToString(), DdlClientes.SelectedValue) & "&CveContrato=" & CveContrato & "&CveSubProyecto=" & Sucursales & "&CveMoneda=" & e.Row.DBCampo("CveMoneda") & """>" & e.Row.FCLiteral("LtlTotal").Text & "</a>"
End If End If

View File

@@ -5703,6 +5703,7 @@ Partial Class Ventas
VentaActual.PorcentajeIVA = DbRowVenta("PorcentajeIVA").ToString.ToDecimal VentaActual.PorcentajeIVA = DbRowVenta("PorcentajeIVA").ToString.ToDecimal
VentaActual.UsuarioActual = UsuarioActual VentaActual.UsuarioActual = UsuarioActual
VentaActual.CveSubProyecto = DbRowVenta("CveSubProyecto").ToString.ToEntero VentaActual.CveSubProyecto = DbRowVenta("CveSubProyecto").ToString.ToEntero
VentaActual.CveUsoCFDI = DbRowVenta("CveUsoCFDI").ToString.ToEntero
HdnAmortizacion.Value = LblAmort.Text.ToDouble.ToString() HdnAmortizacion.Value = LblAmort.Text.ToDouble.ToString()
HdnSubTotalDescuestos.Value = (TxtSubTotal.Text.Replace(",", "").ToDouble - LblDescuentos.Text.Replace(",", "").ToDouble - LblAmortizacion.Text.Trim.Replace(",", "").ToDouble - TxtRetISR.Text.Replace(",", "").ToDouble).FormatoNumero(2) HdnSubTotalDescuestos.Value = (TxtSubTotal.Text.Replace(",", "").ToDouble - LblDescuentos.Text.Replace(",", "").ToDouble - LblAmortizacion.Text.Trim.Replace(",", "").ToDouble - TxtRetISR.Text.Replace(",", "").ToDouble).FormatoNumero(2)
@@ -8328,7 +8329,7 @@ Partial Class Ventas
End If End If
'SOLO HABILITAR PARA GENERAR NOTAS DE CREDITO 'SOLO HABILITAR PARA GENERAR NOTAS DE CREDITO
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso Not PermiteCredito AndAlso Not LnkSolicitarCredito.Visible Then If UsuarioActual.Empresa.Funcionalidad(595) = "2" AndAlso Not LnkSolicitarCredito.Visible Then
LnkSolicitarCredito.Visible = True LnkSolicitarCredito.Visible = True
If DdlSolCreditoTipoDocto.Items.FindByValue("Ing") IsNot Nothing Then If DdlSolCreditoTipoDocto.Items.FindByValue("Ing") IsNot Nothing Then
@@ -17525,6 +17526,123 @@ Partial Class Ventas
End If End If
End If End If
End Sub End Sub
Private Function GenerarNC(ImporteTotal As Decimal, CveVendedor As Integer, ByRef Venta As Venta, GvRowAnticipo As GridViewRow, ByRef ObjVentas As ClsVentas) As Modelos.Factura.MMensajeFactura
Dim Retorno As Modelos.Factura.MMensajeFactura = Nothing
Dim SbAlert As New StringBuilder()
Try
Dim ObjNC = Modelos.Factura.CrearVentaNueva(UsuarioActual, Venta.CveSubProyecto, Venta.CveCliente, Venta.CveMoneda, "Egs")
ObjNC.CveMoneda = Venta.CveMoneda
If ObjNC.CveMoneda = 2 Then
ObjNC.TipoCambio = GlobalTipoCambio(Now).ToString().ToDecimal()
Else
ObjNC.TipoCambio = 1
End If
Dim Total As Decimal = ImporteTotal
Dim subTotal As Decimal = (Total / (1D + Venta.PorcentajeIVA))
'Dim IVA = (subTotal * Factura.PorcentajeIVA).RoundSQL(2)
Dim PU As Decimal = subTotal
Dim Cantidad As Decimal = 1D
Dim Descuento As Decimal = 0
Dim Obs = ""
Dim CvePSAnticipo As Integer = 1
Dim DatarowPS = GlobalDTPS(UsuarioActual.CveEmpresa, SATClavePS:="84111506").FiltroPrimero("CodigoPS LIKE '%ANTICIPO%' OR CodigoPS LIKE '%anticipo%' OR CodigoPS LIKE '%Anticipo%'")
If DatarowPS IsNot Nothing Then
CvePSAnticipo = DatarowPS("CvePS").ToString().ToEntero()
End If
ObjNC.AgregarPS(CvePSAnticipo, Cantidad, PU, Descuento, Obs, CveSubProyecto:=Venta.CveSubProyecto, PorcentajeIVA:=Venta.PorcentajeIVA)
ObjNC.CalculaTotales()
Dim DtVentasNC = New DataTable
DtVentasNC.Columns.Add("CveVenta", GetType(Integer))
DtVentasNC.Columns.Add("Importe", GetType(Decimal))
DtVentasNC.Columns.Add("FolioFiscal", GetType(String))
DtVentasNC.Columns.Add(New DataColumn With {.ColumnName = "TC", .DataType = GetType(Decimal), .DefaultValue = 1})
DtVentasNC.Columns.Add(New DataColumn With {.ColumnName = "TCCambioValuacion", .DataType = GetType(Decimal), .DefaultValue = 1})
DtVentasNC.Columns.Add(New DataColumn With {.ColumnName = "CveEstatusFactura", .DataType = GetType(Integer), .DefaultValue = -1})
DtVentasNC.Columns.Add(New DataColumn With {.ColumnName = "Folio", .DataType = GetType(String), .DefaultValue = ""})
DtVentasNC.Rows.Add(Venta.CveVenta, Total, "")
ObjNC.DtVentasNC = DtVentasNC
Dim DtVentasRelacionadas As New DataTable()
DtVentasRelacionadas.Columns.Add("CveVenta", GetType(Integer))
DtVentasRelacionadas.Rows.Add(Venta.CveVenta)
ObjNC.DtVentasRelacionadas = DtVentasRelacionadas
Dim DtAnticipos As New DataTable()
DtAnticipos.Columns.Add("CveVenta", GetType(Integer))
DtAnticipos.Columns.Add("Importe", GetType(Decimal))
DtAnticipos.Columns.Add("CveConceptoContable", GetType(Integer))
DtAnticipos.Columns.Add("CveIE", GetType(Integer))
DtAnticipos.Columns.Add("FolioFiscal", GetType(String))
DtAnticipos.Columns.Add("Descuentos", GetType(Decimal))
DtAnticipos.Columns.Add("TotalAnticipo", GetType(Decimal))
DtAnticipos.Columns.Add("SubTotalAnticipo", GetType(Decimal))
DtAnticipos.Columns.Add("CveMoneda", GetType(Decimal))
DtAnticipos.Columns.Add("Fecha", GetType(DateTime))
DtAnticipos.Columns.Add("TipoCambioPago", GetType(Decimal))
DtAnticipos.Columns.Add("Folio", GetType(String))
DtAnticipos.Columns.Add("Tipo", GetType(String))
If GvRowAnticipo IsNot Nothing Then
Dim CveVenta = GvRowAnticipo.DataKey("CveVenta").ToEntero()
Dim Importe = GvRowAnticipo.FCTextBox(String.Format("TxtAnticipo{0}", GvRowAnticipo.RowIndex)).Text.ToDecimal()
Dim CveConceptoContable = GvRowAnticipo.DataKey("CveConceptoContable").ToEntero()
Dim CveIE = GvRowAnticipo.DataKey("CveIE").ToEntero()
Dim FolioFiscal = GvRowAnticipo.DataKey("FolioFiscal")
Dim Descuentos As Decimal = GvRowAnticipo.DataKey("Descuentos").ToDecimal()
Dim TotalAnticipo As Decimal = GvRowAnticipo.DataKey("TotalAnticipo").ToDecimal()
Dim SubTotalAnticipo As Decimal = GvRowAnticipo.DataKey("SubTotalAnticipo").ToDecimal()
Dim CveMoneda As Integer = GvRowAnticipo.DataKey("CveMoneda").ToEntero()
Dim Fecha As DateTime = GvRowAnticipo.DataKey("Fecha").ToDateTime()
Dim TipoCambioPago As Decimal = GvRowAnticipo.DataKey("TipoCambioPago").ToDecimal()
Dim Folio = GvRowAnticipo.DataKey("Folio")
Dim Tipo = GvRowAnticipo.DataKey("Tipo")
DtAnticipos.Rows.Add(CveVenta, Importe, CveConceptoContable, CveIE, FolioFiscal, Descuentos, TotalAnticipo, SubTotalAnticipo, CveMoneda, Fecha, TipoCambioPago, Folio, Tipo)
End If
ObjNC.EsNCAmortizacion = True
ObjNC.CveTipoAmortizacionAnticipo = 2
ObjNC.DtAnticiposAplicados = DtAnticipos
ObjNC.CveFormaPago = 21 'Aplicación de anticipos
ObjNC.CveMetodoPago = 1
ObjNC.CveUsoCFDI = Venta.CveUsoCFDI
ObjNC.CveVendedor = CveVendedor
ObjNC.CveTipoRelacion = 7
ObjNC.PreparaTimbre()
AjustarTimbreNC(ObjNC)
Retorno = ObjNC.EmitirFactura(False, Transac:=ObjVentas.IniciaTransacSQL(), Modulo:="Cobranza/GuardarVenta", MostrarURL:=True)
Retorno.Factura = ObjNC
If Retorno IsNot Nothing AndAlso Retorno.CveVenta > 0 Then
For Each msg In Retorno.Mensajes
SbAlert.AppendFormat("{0} <br/>", msg)
Next
SbAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF Factura</a></li></ul><br/>", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", Retorno.CveVenta)))
Else
SbAlert.Append("Ocurrió un error al generar la nota de crédito")
End If
Catch ex As Exception
SbAlert.Append("Ocurrió un error al generar el documento")
GuardaLog(ex.ToString())
End Try
Return Retorno
End Function
Protected Sub BtnAceptarAnticipos_Click(sender As Object, e As System.EventArgs) Handles BtnAceptarAnticipos.Click Protected Sub BtnAceptarAnticipos_Click(sender As Object, e As System.EventArgs) Handles BtnAceptarAnticipos.Click
AplicaAnticipos() AplicaAnticipos()
End Sub End Sub
@@ -17554,6 +17672,8 @@ Partial Class Ventas
Dim CveIEAnticipo As Integer Dim CveIEAnticipo As Integer
Dim CvePlantillaPoliza As Integer = 10 Dim CvePlantillaPoliza As Integer = 10
Dim ListaNC As New List(Of Modelos.Factura.MMensajeFactura)
Try Try
CvePrePoliza = ObjConta.AddPrePolizas("Ventas/Anticipos", CvePlantillaPoliza, TxtTotal.Text.ToDecimal, TxtTotal.Text.ToDecimal, DdlMoneda.SelectedValue.ToEntero(), TxtFechaAnticipoCliente.Text.ToDate, String.Format("{0} {1} {2}-{3}", If(EsAnticipo2017Jam, "Aplicación Anticipo 2017", ""), NombreCliente, Serie, TxtFolio.Text), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) CvePrePoliza = ObjConta.AddPrePolizas("Ventas/Anticipos", CvePlantillaPoliza, TxtTotal.Text.ToDecimal, TxtTotal.Text.ToDecimal, DdlMoneda.SelectedValue.ToEntero(), TxtFechaAnticipoCliente.Text.ToDate, String.Format("{0} {1} {2}-{3}", If(EsAnticipo2017Jam, "Aplicación Anticipo 2017", ""), NombreCliente, Serie, TxtFolio.Text), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
@@ -17616,27 +17736,46 @@ Partial Class Ventas
Select Case gvr.DataKey("CveConceptoContable").ToString() Select Case gvr.DataKey("CveConceptoContable").ToString()
Case "3", "295" Case "3", "295"
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("TotalAnticipo").ToDecimal) * gvr.DataKey("IVAAnticipo").ToDecimal)
importeMN = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal If UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso DdlMoneda.SelectedValue.ToEntero() = 1 Then
Dim ImporteNC As Decimal = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal
If importeMovimiento <> 0 Then Dim RespNC = GenerarNC(ImporteNC, DdlVendedor.SelectedValue.ToEntero(), Me.VentaActual, gvr, ObjVenta)
Dim Pago As New VentaPago If RespNC IsNot Nothing Then
Pago.ImportePagoVenta = importeMN If RespNC.TieneError Then
Pago.ImportePago = importeMovimiento ErrorConta = True
Pago.CveIE = CveIEAnticipo Exit For
Pago.CveMonedaPago = gvr.DataKey("CveMoneda").ToEntero() Else
Pago.TipoPago = "A" ListaNC.Add(RespNC)
Pago.Fecha = TxtFechaAnticipoCliente.Text.ToDate 'TCPago = gvr.DataKey("TipoCambio").todecimal End If
Pago.CveVentaAmortizacion = gvr.DataKey("CveVenta").ToEntero() Else
Pago.TCPago = gvr.DataKey("TipoCambio").ToDecimal ErrorConta = True
Pago.AplicaTraslado = gvr.DataKey("RegresarImpuesto") = "1" End If
Pago.Referencia = gvr.DataKey("Folio")
Pago.AplicaConceptoImpuestoPendiente = (Not gvr.DataKey("RegresarImpuesto") = "1") AndAlso (VentaActual.IVA > 0 OrElse VentaActual.IEPS > 0)
ErrorConta = AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjConta) Else
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("TotalAnticipo").ToDecimal) * gvr.DataKey("IVAAnticipo").ToDecimal)
importeMN = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal
If importeMovimiento <> 0 Then
Dim Pago As New VentaPago
Pago.ImportePagoVenta = importeMN
Pago.ImportePago = importeMovimiento
Pago.CveIE = CveIEAnticipo
Pago.CveMonedaPago = gvr.DataKey("CveMoneda").ToEntero()
Pago.TipoPago = "A"
Pago.Fecha = TxtFechaAnticipoCliente.Text.ToDate 'TCPago = gvr.DataKey("TipoCambio").todecimal
Pago.CveVentaAmortizacion = gvr.DataKey("CveVenta").ToEntero()
Pago.TCPago = gvr.DataKey("TipoCambio").ToDecimal
Pago.AplicaTraslado = gvr.DataKey("RegresarImpuesto") = "1"
Pago.Referencia = gvr.DataKey("Folio")
Pago.AplicaConceptoImpuestoPendiente = (Not gvr.DataKey("RegresarImpuesto") = "1") AndAlso (VentaActual.IVA > 0 OrElse VentaActual.IEPS > 0)
ErrorConta = AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjConta)
End If
End If End If
Case "12" Case "12"
@@ -17743,26 +17882,69 @@ Partial Class Ventas
If ErrorConta Then If ErrorConta Then
Alert("Ocurrió un error al amortizar el documento. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgError) Alert("Ocurrió un error al amortizar el documento. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgError)
ObjConta.RollBack() ObjConta.RollBack()
ObjConta.Dispose()
ObjVenta.Dispose()
ObjIE.Dispose()
ObjCliente.Dispose()
Else Else
Dim Msg As New StringBuilder Dim Msg As New StringBuilder
Msg.Append("Se ha amortizado correctamente") Msg.Append("Se ha amortizado correctamente. <br/>")
'AJUSTA POLIZA 'AJUSTA POLIZA
If ObjConta.ContaFolio > 0 Then If ObjConta.ContaFolio > 0 Then
Msg.AppendFormat("<br/><br/><a class=""Texto"" target='_blank' href=""/Contabilidad/RegPrePolizas.aspx?CvePrePoliza={0}"">Ver Póliza</a>", CvePrePoliza) Msg.AppendFormat("<br/><br/><a class=""Texto"" target='_blank' href=""/Contabilidad/RegPrePolizas.aspx?CvePrePoliza={0}"">Ver Póliza</a>", CvePrePoliza)
End If End If
ObjConta.Commit() ObjConta.Commit()
ObjConta.Dispose()
ObjVenta.Dispose()
ObjIE.Dispose()
ObjCliente.Dispose()
Dim MsgTimbrado As String = ""
Try
If ListaNC.Count > 0 Then
For Each respNC In ListaNC
Msg.AppendFormat("<span style=""font-size:14px;""> La nota de crédito <a class=""Texto"" target=""_blank"" style=""font-size:18px;font-weight:bold;"" href=""/Ventas/Ventas.aspx?CveVenta={0}"">{1}</a> se genero correctamente.</span> <br/>", respNC.CveVenta, respNC.SerieFolio)
Dim SeTimbroNC As Boolean = False
If LblSeTimbro.Text = "Si" Then
MsgTimbrado = TimbrarNC(respNC.Factura, SeTimbroNC)
Else
MsgTimbrado = "No se pudo timbrar porque la factura de ingreso no ha sido timbrada previamente"
End If
If Not String.IsNullOrEmpty(MsgTimbrado) Then
Dim StrEr As String = $"<br/><div id = 'DivTipoCambioAdvertencia' class='alert alert-danger' style='padding: 5px; margin-bottom: 5px; padding-right: 25px;'><strong style = 'font-size: 20px; margin-right: 25px;' > Comprobante no emitido : </strong><br/> {MsgTimbrado}<br/>Por favor inténtelo de nuevo a través del botón 'Emitir' en ventas.</div>"
MsgTimbrado = StrEr
End If
If SeTimbroNC Then
Dim xml = String.Format("<ul><li><a class=""Texto"" target=""_blank"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar XML</a></li></ul>", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", respNC.CveVenta, "XML", respNC.SerieFolio, respNC.Factura.TipoDocto)))
Msg.AppendFormat("{0}", xml)
End If
Dim pdfNC = String.Format("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF</a></li></ul>", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1", respNC.CveVenta)))
Msg.AppendFormat("{0}", pdfNC)
If Not String.IsNullOrEmpty(MsgTimbrado) Then
Msg.AppendFormat("{0}", MsgTimbrado)
End If
Next
End If
Catch ex As Exception
GuardaLogAD(ex.ToString())
Msg.AppendFormat("<br/>{0}<br/>", MsgTimbrado)
End Try
BtnAceptarAnticipos.Enabled = False BtnAceptarAnticipos.Enabled = False
Alert(Msg.ToString(), TipoMensaje.MsgInformacion, JSBtnAceptar:="BtnRefrescarPagina();", ShowCloseButton:=False) Alert(Msg.ToString(), TipoMensaje.MsgInformacion, JSBtnAceptar:="BtnRefrescarPagina();", ShowCloseButton:=False)
End If End If
ObjConta.Dispose()
ObjVenta.Dispose()
ObjIE.Dispose()
ObjCliente.Dispose()
Else Else
'cuando no se ha registrado la venta 'cuando no se ha registrado la venta
@@ -17970,6 +18152,47 @@ Partial Class Ventas
End Sub End Sub
Private Sub AjustarTimbreNC(ByRef ObjNC As Modelos.Factura)
If LblSeTimbro.Text = "Si" Then
ObjNC.Timbre.CFDIRelacionados.UUID.Clear()
ObjNC.Timbre.CFDIRelacionados.UUID.Add(LblFolioFiscal.Text.Trim())
ObjNC.Timbre.CFDIRelacionados.TipoRelacion = "07"
ObjNC.Timbre.CFDIRelacionados.TipoRelacionTexto = "07-CFDI por aplicación de anticipo"
End If
ObjNC.Timbre.Comprobante.MetodoPago = GlobalDTVtaMetodoPago.FiltroPrimeroValor("ClaveMetodoPagoSAT", $"CveMetodoPago = {ObjNC.CveMetodoPago}") ' Obj.ClaveMetodoPagoSAT
ObjNC.Timbre.Comprobante.FormadePago = GlobalDTVtaFormaPago.FiltroPrimeroValor("ClaveFormaPagoSAT", $"CveFormaPago = {ObjNC.CveFormaPago}") 'Obj.ClaveFormaPagoSAT
ObjNC.Timbre.Receptor.UsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("UsoCFDI", $"CveUsoCFDI = {ObjNC.CveUsoCFDI}")
End Sub
Private Function TimbrarNC(ByRef ObjNC As Modelos.Factura, ByRef SeTimbroNC As Boolean) As String
Dim MsgErrorTimbrado As String = ""
'Dim SeTimbro As Boolean = False
'Dim TimbroNC As Boolean = False
Dim ObjTimbrado As New Timbrado
Try
If ObjNC.Timbre IsNot Nothing Then
Dim ObjTimbradoNC As New Timbrado
SeTimbroNC = ObjTimbradoNC.TimbrarFactura(UsuarioActual, ObjNC)
If Not SeTimbroNC Then
MsgErrorTimbrado = $"{MsgErrorTimbrado} {ObjTimbradoNC.MensajeErrorCFDI}"
End If
ObjTimbradoNC = Nothing
End If
Catch ex As Exception
OnError("Ocurrió un error al generar el timbrado", ex)
End Try
If Not String.IsNullOrEmpty(MsgErrorTimbrado) Then
GuardaLogAD(MsgErrorTimbrado, Archivo:="LogTimbrado")
End If
Return MsgErrorTimbrado
End Function
Private Function AgregarPrePolizasXTrasladar(ObjConta As ClsContabilidad, CvePrePoliza As Integer, PorcentajeAmortizacion As Decimal, TipoCambio As Decimal, ByRef CuentasContablesInvalidas As StringBuilder, ByRef CveCuentaContabilizacion As Integer, Importe13 As Decimal, Importe8 As Decimal, Importe9 As Decimal) As Boolean Private Function AgregarPrePolizasXTrasladar(ObjConta As ClsContabilidad, CvePrePoliza As Integer, PorcentajeAmortizacion As Decimal, TipoCambio As Decimal, ByRef CuentasContablesInvalidas As StringBuilder, ByRef CveCuentaContabilizacion As Integer, Importe13 As Decimal, Importe8 As Decimal, Importe9 As Decimal) As Boolean
Dim ImporteMovimiento As Decimal Dim ImporteMovimiento As Decimal
Dim ImporteMX As Decimal Dim ImporteMX As Decimal
@@ -18793,7 +19016,7 @@ Partial Class Ventas
Dim ActualizarPrecios As Boolean = False Dim ActualizarPrecios As Boolean = False
If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then If UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
ActualizarPrecios = true ActualizarPrecios = True
End If End If
If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then