Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
@@ -1,32 +1,42 @@
|
||||
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepEntradasUsadosClientes.aspx.vb" Inherits="Acumuladores_RepEntradasUsadosClientes" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="CP" Runat="Server">
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="Css" Runat="Server">
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="E" Runat="Server">
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="HB" Runat="Server">
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
|
||||
<asp:UpdatePanel ID="UpAcciones" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<li>
|
||||
<asp:LinkButton runat="server" ID="BtnImprimir" OnClick="BtnImprimir_Click" data-toggle="tooltip" data-placement="left" title="Agregar un Defecto" Text="<i class='fa fa-file-pdf-o'></i>Imprimir"></asp:LinkButton>
|
||||
</li>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:PostBackTrigger ControlID="BtnImprimir" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="H" Runat="Server">
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content6" ContentPlaceHolderID="HA" Runat="Server">
|
||||
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content7" ContentPlaceHolderID="C" Runat="Server">
|
||||
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
|
||||
<asp:UpdatePanel ID="UPFiltros" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="portlet solid grey-cascade portlet-filter">
|
||||
<div class="portlet-title portlet-filterT smalltitle">
|
||||
<div class="tools">
|
||||
<asp:Button ID="BtnConsultar" runat="server" Text="Consultar" class="btn btn-primary" />
|
||||
<asp:Button ID="BtnConsultar" runat="server" Text="Consultar" class="btn btn-primary" />
|
||||
<a href="javascript;" data-idchekbox="<%= chkexpand.ClientID%>" class=" <%= IIf(chkexpand.Checked = True, "collapse", "expand")%>"></a>
|
||||
<asp:CheckBox ID="chkexpand" CssClass="hidden" runat="server" />
|
||||
</div>
|
||||
<div class="titlefiltros caption">
|
||||
<div class="col-md-1 truncate v-center" style="text-align: right!important">Almacen:</div>
|
||||
<div class="col-md-2 v-center">
|
||||
<asp:ListBox ID="DdlAlmacen" CssClass="form-control input-sm select2me" DataTextField="Almacen" DataValueField="CveAlmacen" Style="width: 100%;" runat="server"></asp:ListBox>
|
||||
</div>
|
||||
<div class="col-md-2 v-center">
|
||||
<asp:ListBox ID="DdlAlmacen" CssClass="form-control input-sm select2me" DataTextField="Almacen" DataValueField="CveAlmacen" Style="width: 100%;" runat="server"></asp:ListBox>
|
||||
</div>
|
||||
<div class="row v-center">
|
||||
<div class="col-md-1 truncate" style="text-align: right!important">Fecha Inicio:</div>
|
||||
<div class="col-md-1 v-center">
|
||||
@@ -50,16 +60,27 @@
|
||||
<ajax:MaskedEditExtender ID="MEEFechaF" runat="server" TargetControlID="TxtFechaF" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
|
||||
<ajax:CalendarExtender runat="server" ID="CalendarExtender1" TargetControlID="TxtFechaF" PopupButtonID="ImgFechaF" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
<asp:UpdatePanel ID="UpDatos" UpdateMode="Conditional" runat="server">
|
||||
<ContentTemplate>
|
||||
<asp:GridView runat="server" ID="GvDatos" data-sort="true" AutoGenerateColumns="False" EmptyDataText="No se encontraron datos con los filtros seleccionados" ToolTip="Listado de Movimientos" DataKeyNames="Codigo,Codigo_Clientes,Total" CssClass="Widthall table table-striped table-hover ScrollAD" GridLines="None">
|
||||
<Columns>
|
||||
<asp:BoundField HeaderText="Tipo" DataField="Codigo"/>
|
||||
<asp:BoundField HeaderText="Clientes/Grupos" DataField="Codigo_Clientes"/>
|
||||
<asp:BoundField HeaderText="Cantidad" DataField="Total"/>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
<asp:GridView runat="server" id="GvDatos"></asp:GridView>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content8" ContentPlaceHolderID="JS" Runat="Server">
|
||||
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
|
||||
</asp:Content>
|
||||
|
||||
|
||||
@@ -1,9 +1,20 @@
|
||||
Imports Extensiones
|
||||
Imports System.Data
|
||||
Imports System
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
|
||||
Partial Class Acumuladores_RepEntradasUsadosClientes
|
||||
Inherits ClsPaginas
|
||||
|
||||
Private Property DatosEntradasUsadosClientes() As DataTable
|
||||
Get
|
||||
Return CType(ViewState("DatosEntradasUsados"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DatosEntradasUsados") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Sub Acumuladores_EntradasUsados_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
|
||||
If Not Page.IsPostBack Then
|
||||
@@ -38,11 +49,44 @@ Partial Class Acumuladores_RepEntradasUsadosClientes
|
||||
Dim Acum As New ClsAcumuladores
|
||||
|
||||
If Acum.EntradasUsadosClientesRep(CveAlmacen, FechaI, FechaF, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
GvDatos.datasource = Acum.DtResultados
|
||||
GvDatos.DataSource = Acum.DtResultados
|
||||
DatosEntradasUsadosClientes = Acum.DtResultados.FiltraParametros("Codigo_Clientes <> 'Total:'")
|
||||
End If
|
||||
|
||||
Acum.Dispose()
|
||||
GvDatos.databind
|
||||
GvDatos.DataBind()
|
||||
UpDatos.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
If e.Row.DBCampo("EsHeader").ToString = "-1" Then
|
||||
e.Row.CssClass = "SubTotales2"
|
||||
End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnImprimir_Click(sender As Object, e As EventArgs)
|
||||
|
||||
|
||||
Dim Dia As String = {"lunes", "martes", "miércoles", "jueves", "viernes", "sábado", "domingo"}(If((Weekday(Today) - 2) = -1, 7, Weekday(Today) - 2))
|
||||
Dim Mes As String = {"enero", "febrero", "marzo", "abril", "mayo", "junio", "julio", "agosto", "septiembre", "octubre", "noviembre", "diciembre"}(Month(Today) - 1)
|
||||
|
||||
Dim FechaConFormato As String = String.Format("{0}, {1} de {2} de {3}", Dia, Month(Today), Mes, Year(Today))
|
||||
|
||||
Dim params As New List(Of ReportParameter)
|
||||
|
||||
params.Add(New ReportParameter("Direccion", "Tamaulipas Esq. con Guadalupe Victoria"))
|
||||
params.Add(New ReportParameter("FechaConFormato", FechaConFormato))
|
||||
params.Add(New ReportParameter("FechaInicial", TxtFechaI.Text))
|
||||
params.Add(New ReportParameter("FechaFinal", TxtFechaF.Text))
|
||||
|
||||
Dim rds As New ReportDataSource With {.Name = "DataSet1", .Value = DatosEntradasUsadosClientes}
|
||||
|
||||
ImprimirPDF(String.Format("Empresas/{0}/Formatos/RepEntradasUsadosClientes.rdlc", UsuarioActual.CveEmpresa), DatosEntradasUsadosClientes, params, "Entradas usados clientes", "PDF")
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
396
Acumuladores/RepIndicadorDiario.aspx
Normal file
396
Acumuladores/RepIndicadorDiario.aspx
Normal file
@@ -0,0 +1,396 @@
|
||||
<%@ Page Title="Reporte de Compras Clasificación" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepIndicadorDiario.aspx.vb" Inherits="ACumuladores_RepIndicadorDiario" %>
|
||||
|
||||
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="H" runat="Server">
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkPdf" OnClick="LnkPdf_Click" runat="server"> <i class="fa fa-ad-pdf"></i> Generar PDF</asp:LinkButton>
|
||||
</li>
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkExportar" runat="server">
|
||||
<i class="fa fa-ad-excel"></i> Exportar Excel
|
||||
</asp:LinkButton>
|
||||
</li>
|
||||
|
||||
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="E" runat="Server">
|
||||
Reporte Indicador Diario
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="Css" runat="Server">
|
||||
<style>
|
||||
.Widthall {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.dataTables_scrollHeadInner {
|
||||
width: 100% !important;
|
||||
background-color: #dddddd;
|
||||
padding-left: 0px !important;
|
||||
}
|
||||
|
||||
.dataTables_scrollFoot {
|
||||
display: none;
|
||||
position: static;
|
||||
}
|
||||
|
||||
.table-scrollable {
|
||||
margin: 0px !important;
|
||||
}
|
||||
|
||||
.dataTables_scroll {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
|
||||
.table.dataTable {
|
||||
margin-top: 0px !important;
|
||||
}
|
||||
|
||||
.dataTables_scrollBody {
|
||||
overflow: hidden !important;
|
||||
}
|
||||
|
||||
.dataTables_scrollBody table th {
|
||||
padding: 0px !important;
|
||||
padding-right: 4px !important;
|
||||
padding-left: 4px !important;
|
||||
}
|
||||
|
||||
/* 31/05/2018 - ListBoxs */
|
||||
.select2 .select2-selection__rendered {
|
||||
line-height: 1;
|
||||
color: #111;
|
||||
}
|
||||
|
||||
.select2 .select2-selection--multiple {
|
||||
box-sizing: border-box;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
min-height: 20px;
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
}
|
||||
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__choice {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.select2-selection__rendered {
|
||||
margin-top: 0px;
|
||||
height: 25px;
|
||||
}
|
||||
|
||||
.select2-selection {
|
||||
margin-top: 0px;
|
||||
height: 31px;
|
||||
}
|
||||
|
||||
.select2-container--default.select2-container--focus .select2-selection--multiple {
|
||||
border: none;
|
||||
outline: 0;
|
||||
}
|
||||
#chartdiv {
|
||||
width: 100%;
|
||||
height: 500px;
|
||||
}
|
||||
</style>
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="C" runat="Server">
|
||||
|
||||
<asp:UpdatePanel ID="UPFiltros" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="portlet solid grey-cascade portlet-filter" id="idnecesaria">
|
||||
<div class="portlet-title portlet-filterT smalltitle">
|
||||
<div class="tools">
|
||||
<asp:Button ID="BtnConsultar" runat="server" Text="Consultar" class="btn btn-primary" />
|
||||
<a href="javascript:;" class="expand"></a>
|
||||
</div>
|
||||
<div class="titlefiltros caption ">
|
||||
<div class="row">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="col-md-1 truncate">
|
||||
Fecha Inicio:
|
||||
</div>
|
||||
<div class="col-md-1" style="min-width:115px">
|
||||
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 100px !important; padding: 0px;">
|
||||
<asp:TextBox Width="80px" ID="txtFechaI" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10"></asp:TextBox>
|
||||
<span class="input-group-btn ">
|
||||
<asp:LinkButton ID="imgCalendario" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
|
||||
</span>
|
||||
</div>
|
||||
<ajax:MaskedEditExtender ID="MEEFechaI" runat="server" TargetControlID="txtFechaI" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
|
||||
<ajax:CalendarExtender runat="server" ID="Calendario" TargetControlID="txtFechaI" PopupButtonID="ImgCalendario" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
|
||||
<asp:RequiredFieldValidator ID="rfvFechaI" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator>
|
||||
<asp:CompareValidator ID="cvFechaI" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="vcoFfvFI" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
<ajax:ValidatorCalloutExtender ID="vcoCvFI" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
</div>
|
||||
<div class="col-md-1 truncate">
|
||||
Fecha Fin:
|
||||
</div>
|
||||
<div class="col-md-1" style="min-width:115px">
|
||||
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 100px !important; padding: 0px;">
|
||||
<asp:TextBox Width="80px" ID="txtFechaF" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10"></asp:TextBox>
|
||||
<span class="input-group-btn ">
|
||||
<asp:LinkButton ID="imgCalendarioF" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
|
||||
</span>
|
||||
</div>
|
||||
<ajax:MaskedEditExtender ID="MEEFechaF" runat="server" TargetControlID="txtFechaF" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
|
||||
<ajax:CalendarExtender runat="server" ID="Calendario2" TargetControlID="txtFechaF" PopupButtonID="imgCalendarioF" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
|
||||
<asp:RequiredFieldValidator ID="rfvFechaF" runat="server" ControlToValidate="txtFechaF" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator>
|
||||
<asp:CompareValidator ID="cvFechaF" runat="server" ControlToValidate="txtFechaF" Display="None" ErrorMessage="El campo <b>''Fecha Final''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="vcoRfvFF" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaF" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
<ajax:ValidatorCalloutExtender ID="vcoCvFF" runat="server" HighlightCssClass="vco" TargetControlID="cvFechaF" Width="350px"></ajax:ValidatorCalloutExtender>
|
||||
</div>
|
||||
|
||||
<asp:Label runat="server" ID="LblSubProyecto" CssClass="col-md-1">SubProyecto:</asp:Label>
|
||||
<div class="col-md-2">
|
||||
<%-- <asp:DropDownList ID="DdlSubProyecto" CssClass="select2me" AppendDataBoundItems="true" runat="server" DataTextField="SubProyecto" DataValueField="CveSubProyecto" Width="100%">
|
||||
<asp:ListItem Selected="true" Text="Todos" Value="-1"></asp:ListItem>
|
||||
</asp:DropDownList>--%>
|
||||
<asp:ListBox ID="DdlSubProyecto" AppendDataBoundItems="true" DataTextField="SubProyecto" DataValueField="CveSubProyecto" CssClass="select2me" Style="width: 100%;" runat="server"></asp:ListBox>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body" style="display: none">
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
<br />
|
||||
<asp:UpdatePanel ID="UPDatos" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<asp:GridView ID="GvDatos" runat="server" data-sort="true" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" GridLines="None" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros" ToolTip=""
|
||||
DataKeyNames="Tipo,Seccion,TipoCategoria,Ordernador2"
|
||||
>
|
||||
<Columns>
|
||||
<asp:TemplateField ItemStyle-Width="60">
|
||||
<HeaderTemplate>
|
||||
Concepto
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtlTipo" runat="server" Text='<%# Eval("Tipo") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField ItemStyle-Width="100" ItemStyle-HorizontalAlign="Right">
|
||||
<HeaderTemplate>
|
||||
Acumulado
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtlCantidadAcumulado" runat="server" Text='<%# Eval("CantidadAcumulado") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField ItemStyle-Width="20" ItemStyle-HorizontalAlign="Right">
|
||||
<HeaderTemplate>
|
||||
Importe Acumulado
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtlImporteAcumulado" runat="server" Text='<%# Eval("ImporteAcumulado", "{0:N2}") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField ItemStyle-Width="80" ItemStyle-HorizontalAlign="Right">
|
||||
<HeaderTemplate>
|
||||
Venta Diaria
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtlCantidadAlDia" runat="server" Text='<%# Eval("CantidadAldia") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField ItemStyle-Width="80" ItemStyle-HorizontalAlign="Right">
|
||||
<HeaderTemplate>
|
||||
Importe Al Día
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtlImporteAldia" runat="server" Text='<%# Eval("ImporteAlDia", "{0:N2}") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
<asp:TemplateField ItemStyle-Width="60" ItemStyle-HorizontalAlign="Right">
|
||||
<HeaderTemplate>
|
||||
Cantidad Total
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtlCantidadTotal" runat="server" Text='<%# Eval("CantidadTotal")%>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
<asp:TemplateField ItemStyle-Width="80" ItemStyle-HorizontalAlign="Right" >
|
||||
<HeaderTemplate>
|
||||
Total
|
||||
</HeaderTemplate>
|
||||
<ItemTemplate>
|
||||
<asp:Label ID="LtlTotal" style="margin-right:10px" runat="server" Text='<%# Eval("Total", "{0:N2}") %>'></asp:Label>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
|
||||
|
||||
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
<asp:UpdatePanel runat="server" ID="UpTipoCambio" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div id="DivTipoCambio" class="modal fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">
|
||||
<asp:Label ID="Label1" runat="server" ClientIDMode="Static" Text="Cambiar Tipo Cambio de Dólares"></asp:Label></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<asp:UpdatePanel runat="server" ID="UpBodyTipoCambio" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
|
||||
<asp:RadioButtonList runat="server" ID="RblTipoCambio" AutoPostBack="true">
|
||||
<asp:ListItem Selected="true" Text="Moneda Original" Value="1"></asp:ListItem>
|
||||
<asp:ListItem Text="Dólares en Tipo Cambio de la Fecha Compra" Value="2"></asp:ListItem>
|
||||
<asp:ListItem Text="Tipo Cambio Especifico" Value="3"></asp:ListItem>
|
||||
</asp:RadioButtonList>
|
||||
|
||||
<div class="row" style="margin-left: 10px;" runat="server" id="LiEspecifico" visible="false">
|
||||
Especifico:
|
||||
<asp:TextBox ID="TxtEspecifico" runat="server" Width="55px" />
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<asp:Button ID="BtnTipoCambio" runat="server" Text="Aceptar" class="btn btn-primary" />
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
<div id="DivModalGrafica" class="modal ADS fade" role="dialog">
|
||||
<asp:UpdatePanel class="modal-dialog modal-lg" runat="server" ID="UPModalProd" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">
|
||||
<asp:Label ID="LblTituloGrafica" runat="server" ClientIDMode="Static" Text=""></asp:Label>
|
||||
</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-md-2"></div>
|
||||
<label class="col-md-1 truncate">Grafica:</label>
|
||||
<div class="col-md-2">
|
||||
<asp:DropDownList ID="DdlGrafica" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DdlGrafica_SelectedIndexChanged" AppendDataBoundItems="true" Class="table-group-action-input form-control input-inline input-small input-sm select2me">
|
||||
<asp:ListItem Selected="True" Text="Barras" Value="1"></asp:ListItem>
|
||||
<asp:ListItem Text="Pastel" Value="2"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
<label class="col-md-1 truncate"> Ver:</label>
|
||||
<div class="col-md-2">
|
||||
<asp:DropDownList ID="DdlVer" runat="server" AutoPostBack="true" OnSelectedIndexChanged="DdlVer_SelectedIndexChanged" AppendDataBoundItems="true" Class="table-group-action-input form-control input-inline input-small input-sm select2me">
|
||||
<asp:ListItem Selected="True" Text="Total" Value="1"></asp:ListItem>
|
||||
<asp:ListItem Text="SubTotal" Value="2"></asp:ListItem>
|
||||
<asp:ListItem Text="IVA" Value="3"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div id="chartdiv"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
|
||||
<script src="/Metronic/assets/global/scripts/datatable.js"></script>
|
||||
<script src="/Metronic/assets/global/plugins/datatables/all.min.js"></script>
|
||||
<script src="https://www.amcharts.com/lib/3/amcharts.js"></script>
|
||||
<script src="https://www.amcharts.com/lib/3/serial.js"></script>
|
||||
<script src="https://www.amcharts.com/lib/3/pie.js"></script>
|
||||
<script src="https://www.amcharts.com/lib/3/plugins/export/export.min.js"></script>
|
||||
<link rel="stylesheet" href="https://www.amcharts.com/lib/3/plugins/export/export.css" type="text/css" media="all" />
|
||||
<script src="https://www.amcharts.com/lib/3/themes/light.js"></script>
|
||||
<script>
|
||||
|
||||
function CargaGraficaBarras(data) {
|
||||
|
||||
var chart = AmCharts.makeChart("chartdiv", {
|
||||
"type": "serial",
|
||||
"theme": "light",
|
||||
"dataProvider": data,
|
||||
"startDuration": 2,
|
||||
"valueAxes": [{
|
||||
"position": "left",
|
||||
"title": "Ventas"
|
||||
}],
|
||||
"graphs": [{
|
||||
"balloonText": "[[category]]: <b>[[value]]</b> [[Moneda]]",
|
||||
"colorField": "Color",
|
||||
"fillAlphas": 1,
|
||||
"lineAlpha": 0.1,
|
||||
"type": "column",
|
||||
"valueField": "Valor"
|
||||
}],
|
||||
"depth3D": 20,
|
||||
"angle": 30,
|
||||
"chartCursor": {
|
||||
"categoryBalloonEnabled": false,
|
||||
"cursorAlpha": 0,
|
||||
"zoomable": false
|
||||
},
|
||||
"categoryField": "Texto",
|
||||
"categoryAxis": {
|
||||
"gridPosition": "start",
|
||||
"labelRotation": 90
|
||||
},
|
||||
"export": {
|
||||
"enabled": true
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function CargaGraficaPastel(data) {
|
||||
|
||||
var chart = AmCharts.makeChart("chartdiv", {
|
||||
"type": "pie",
|
||||
"theme": "light",
|
||||
"dataProvider":
|
||||
data,
|
||||
"valueField": "Valor",
|
||||
"titleField": "Texto",
|
||||
"outlineAlpha": 0.4,
|
||||
"depth3D": 0,
|
||||
"balloonText": "[[title]]<br><span style='font-size:14px'><b>[[value]]</b> ([[percents]]% [[Moneda]])</span>",
|
||||
"angle": 0,
|
||||
"export": {
|
||||
"enabled": true
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
</asp:Content>
|
||||
366
Acumuladores/RepIndicadorDiario.aspx.vb
Normal file
366
Acumuladores/RepIndicadorDiario.aspx.vb
Normal file
@@ -0,0 +1,366 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports Extensiones
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
Imports System.Data
|
||||
|
||||
Partial Class ACumuladores_RepIndicadorDiario
|
||||
Inherits ClsPaginas
|
||||
|
||||
#Region " PROPIEDADES "
|
||||
Private Property DtDatos As DataTable
|
||||
Get
|
||||
DtDatos = DirectCast(ViewState("DtDatos"), DataTable)
|
||||
End Get
|
||||
|
||||
Set(ByVal value As DataTable)
|
||||
ViewState("DtDatos") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property NumeroRemesa As String
|
||||
Get
|
||||
NumeroRemesa = ViewState("NumeroRemesa").ToString
|
||||
End Get
|
||||
Set(value As String)
|
||||
ViewState("NumeroRemesa") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property TCEspecifico As Double
|
||||
Get
|
||||
If ViewState("TCEspecifico") Is Nothing Then
|
||||
Return -1
|
||||
Else
|
||||
Return DirectCast(ViewState("TCEspecifico"), Double)
|
||||
End If
|
||||
End Get
|
||||
Set(value As Double)
|
||||
ViewState("TCEspecifico") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property DtColor As DataTable
|
||||
Get
|
||||
Return DirectCast(ViewState("DtColor"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DtColor") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property Agrupador As String
|
||||
Get
|
||||
Return ViewState("Agrupador").ToString
|
||||
End Get
|
||||
|
||||
Set(value As String)
|
||||
ViewState("Agrupador") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property CveMoneda As Integer
|
||||
Get
|
||||
CveMoneda = ViewState("CveMoneda").ToString.ToEntero
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveMoneda") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
#End Region
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
|
||||
txtFechaI.Text = Now.FirstDayOfMonth().ToString("dd/MM/yyyy")
|
||||
txtFechaF.Text = Now.ToString("dd/MM/yyyy")
|
||||
|
||||
CargaCombos()
|
||||
|
||||
CargaDatos()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#Region "CARGAS"
|
||||
|
||||
Private Sub CargaCombos()
|
||||
|
||||
DdlSubProyecto.DataSource = GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa)
|
||||
DdlSubProyecto.DataBind()
|
||||
DdlSubProyecto.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
DdlSubProyecto.SelectedValuesIfExist("-1")
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
Private Sub CargaDatos()
|
||||
|
||||
Dim ObjAcum As New ClsAcumuladores()
|
||||
|
||||
Dim FechaI, FechaF As Date
|
||||
FechaI = txtFechaI.Text.ToDate
|
||||
FechaF = txtFechaF.Text.ToDate
|
||||
|
||||
If RblTipoCambio.SelectedValue.ToEntero = 3 And TxtEspecifico.Text <> "" Then
|
||||
TCEspecifico = TxtEspecifico.Text.ToDouble
|
||||
Else
|
||||
TCEspecifico = -1
|
||||
End If
|
||||
|
||||
If ObjAcum.GetRepIndicadorDiario(FechaI, FechaF, DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
|
||||
GvDatos.DataSource = ObjAcum.DtResultados
|
||||
DtDatos = ObjAcum.DtResultados
|
||||
Else
|
||||
GvDatos.DataSource = Nothing
|
||||
End If
|
||||
|
||||
ObjAcum.Dispose()
|
||||
GvDatos.DataBind()
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "SELECTED INDEX CHANGE"
|
||||
|
||||
|
||||
|
||||
Private Sub RblTipoCambio_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RblTipoCambio.SelectedIndexChanged
|
||||
If RblTipoCambio.SelectedValue.ToEntero = 3 Then
|
||||
Dim TipoCambio As Double
|
||||
LiEspecifico.Visible = True
|
||||
TipoCambio = GlobalTipoCambio(Now)
|
||||
TxtEspecifico.Text = TipoCambio.ToString
|
||||
Else
|
||||
LiEspecifico.Visible = False
|
||||
End If
|
||||
UpBodyTipoCambio.Update()
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "CONSULTAR"
|
||||
|
||||
Protected Sub BtnConsultar_Click(sender As Object, e As System.EventArgs) Handles BtnConsultar.Click
|
||||
CargaDatos()
|
||||
UPDatos.Update()
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "GRIDVIEW"
|
||||
|
||||
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
||||
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
If e.Row.DataKey("Ordernador2").ToEntero = 100 Or e.Row.DataKey("Seccion").ToEntero = 3 And (e.Row.DataKey("TipoCategoria").ToEntero = 6 Or e.Row.DataKey("TipoCategoria").ToEntero = 7) Then
|
||||
e.Row.Font.Bold = True
|
||||
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region " IMPRIMIR "
|
||||
|
||||
Protected Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click
|
||||
'GvDatos.ExportToExcel("ReporteComprasClasificacion" & Now.ToShortDateString)
|
||||
GenerarPDF("EXCEL")
|
||||
End Sub
|
||||
|
||||
Protected Sub LnkPdf_Click(sender As Object, e As EventArgs)
|
||||
GenerarPDF("PDF")
|
||||
End Sub
|
||||
Private Sub GenerarPDF(Opcion As String)
|
||||
Dim FechaI = If(txtFechaI.Text = "" Or txtFechaI.Text = "__/__/____", "-1", txtFechaI.Text)
|
||||
Dim FechaF = If(txtFechaF.Text = "" Or txtFechaF.Text = "__/__/____", "-1", txtFechaF.Text)
|
||||
|
||||
|
||||
|
||||
Dim FechaIn As String = $" <b>Fecha Inicio:</b> {txtFechaI.Text}"
|
||||
Dim FechaFn As String = $" <b>Fecha Fin:</b> {txtFechaF.Text}"
|
||||
If txtFechaI.Text = "" Then FechaIn = ""
|
||||
If txtFechaF.Text = "" Then FechaFn = ""
|
||||
|
||||
|
||||
Dim SubProyecto = If(DdlSubProyecto.GetSelectedText = "", "", $" <b>SubProyecto:</b> {DdlSubProyecto.GetSelectedText}")
|
||||
|
||||
|
||||
Dim FechaIF, FechaFF As String
|
||||
FechaIF = If(IsDate(txtFechaI.Text.Trim()), txtFechaI.Text.Trim(), "-1")
|
||||
FechaFF = If(IsDate(txtFechaF.Text.Trim()), txtFechaF.Text.Trim(), "-1")
|
||||
|
||||
|
||||
|
||||
If DtDatos IsNot Nothing AndAlso DtDatos.Rows.Count > 0 Then
|
||||
|
||||
|
||||
|
||||
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
|
||||
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
|
||||
|
||||
Dim params As New List(Of ReportParameter)
|
||||
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
|
||||
params.Add(New ReportParameter("FechaInicio", FechaI))
|
||||
params.Add(New ReportParameter("FechaFin", FechaF))
|
||||
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
||||
params.Add(New ReportParameter("FechaImpresion", Now.ToString))
|
||||
params.Add(New ReportParameter("AgrupadoPor", $"<b>Filtros Por:</b> {FechaIn} {FechaFn} {SubProyecto} "))
|
||||
|
||||
If Imagen.Exists Then
|
||||
params.Add(New ReportParameter("LogoPath", logouri))
|
||||
Else
|
||||
params.Add(New ReportParameter("LogoPath", ""))
|
||||
End If
|
||||
ImprimirPDF("Empresas/Grales/Formatos/RepIndicadorDiario.rdlc", DtDatos, params, $"RepIndicadorDiario_{Now.ToString("yyyyMMddhhmmss")}", Opcion)
|
||||
Else
|
||||
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
#Region "GRAFICA"
|
||||
|
||||
Protected Sub LnkVerGrafica_Click(sender As Object, e As EventArgs)
|
||||
If Not DtDatos IsNot Nothing AndAlso DtDatos.Rows.Count > 0 Then
|
||||
Alert("No hay datos disponibles", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
LblTituloGrafica.Text = $"Agrupado por: {Agrupador}"
|
||||
RegistraScript("$('#DivModalGrafica').modal('show')")
|
||||
CambioGrafica()
|
||||
End Sub
|
||||
Private Sub CreaDataTableColor()
|
||||
DtColor = New DataTable
|
||||
DtColor.Columns.Add("Color")
|
||||
Dim RowColor As DataRow = Nothing
|
||||
RowColor = DtColor.NewRow()
|
||||
RowColor("Color") = "#FF0F00"
|
||||
DtColor.Rows.Add(RowColor)
|
||||
RowColor = Nothing
|
||||
RowColor = DtColor.NewRow()
|
||||
RowColor("Color") = "#FF6600"
|
||||
DtColor.Rows.Add(RowColor)
|
||||
RowColor = Nothing
|
||||
RowColor = DtColor.NewRow()
|
||||
RowColor("Color") = "#FF9E01"
|
||||
DtColor.Rows.Add(RowColor)
|
||||
RowColor = Nothing
|
||||
RowColor = DtColor.NewRow()
|
||||
RowColor("Color") = "#FCD202"
|
||||
DtColor.Rows.Add(RowColor)
|
||||
RowColor = Nothing
|
||||
RowColor = DtColor.NewRow()
|
||||
RowColor("Color") = "#F8FF01"
|
||||
DtColor.Rows.Add(RowColor)
|
||||
RowColor = Nothing
|
||||
RowColor = DtColor.NewRow()
|
||||
RowColor("Color") = "#B0DE09"
|
||||
DtColor.Rows.Add(RowColor)
|
||||
RowColor = Nothing
|
||||
RowColor = DtColor.NewRow()
|
||||
RowColor("Color") = "#04D215"
|
||||
DtColor.Rows.Add(RowColor)
|
||||
RowColor = Nothing
|
||||
RowColor = DtColor.NewRow()
|
||||
RowColor("Color") = "#0D8ECF"
|
||||
DtColor.Rows.Add(RowColor)
|
||||
RowColor = Nothing
|
||||
RowColor = DtColor.NewRow()
|
||||
RowColor("Color") = "#0D52D1"
|
||||
DtColor.Rows.Add(RowColor)
|
||||
RowColor = Nothing
|
||||
RowColor = DtColor.NewRow()
|
||||
RowColor("Color") = "#2A0CD0"
|
||||
DtColor.Rows.Add(RowColor)
|
||||
RowColor = Nothing
|
||||
RowColor = DtColor.NewRow()
|
||||
RowColor("Color") = "#8A0CCF"
|
||||
DtColor.Rows.Add(RowColor)
|
||||
RowColor = Nothing
|
||||
RowColor = DtColor.NewRow()
|
||||
RowColor("Color") = "#CD0D74"
|
||||
DtColor.Rows.Add(RowColor)
|
||||
RowColor = Nothing
|
||||
RowColor = DtColor.NewRow()
|
||||
RowColor("Color") = "#754DEB"
|
||||
DtColor.Rows.Add(RowColor)
|
||||
RowColor = Nothing
|
||||
RowColor = DtColor.NewRow()
|
||||
RowColor("Color") = "#DDDDDD"
|
||||
DtColor.Rows.Add(RowColor)
|
||||
RowColor = Nothing
|
||||
RowColor = DtColor.NewRow()
|
||||
RowColor("Color") = "#999999"
|
||||
DtColor.Rows.Add(RowColor)
|
||||
RowColor = Nothing
|
||||
RowColor = DtColor.NewRow()
|
||||
RowColor("Color") = "#333333"
|
||||
DtColor.Rows.Add(RowColor)
|
||||
RowColor = Nothing
|
||||
RowColor = DtColor.NewRow()
|
||||
RowColor("Color") = "#000000"
|
||||
DtColor.Rows.Add(RowColor)
|
||||
End Sub
|
||||
|
||||
Private Sub CambioGrafica()
|
||||
Dim Dt As New DataTable()
|
||||
Dt.Columns.Add("Texto")
|
||||
Dt.Columns.Add("Valor")
|
||||
Dt.Columns.Add("Color")
|
||||
Dt.Columns.Add("Moneda")
|
||||
Dim RowColorIndex As Integer = 0
|
||||
For Each Dr As DataRow In DtDatos.Rows
|
||||
If Not Dr("CveCompra").ToString.ToEntero > 0 Then
|
||||
Dim Row As DataRow = Nothing
|
||||
Row = Dt.NewRow()
|
||||
Row("Texto") = $"{Dr("GPO").ToString} {GlobalDTMonedas().FiltraParametros($"CveMoneda = {CveMoneda}").Rows(0)("Abreviatura").ToString}"
|
||||
Select Case DdlVer.SelectedValue.ToEntero
|
||||
Case 1
|
||||
Row("Valor") = Dr("Total").ToString.FormatoNumero
|
||||
Case 2
|
||||
Row("Valor") = Dr("SubTotal").ToString.FormatoNumero
|
||||
Case 3
|
||||
Row("Valor") = Dr("IVA").ToString.FormatoNumero
|
||||
End Select
|
||||
Row("Color") = DtColor.Rows(RowColorIndex)("Color").ToString
|
||||
Row("Moneda") = GlobalDTMonedas().FiltraParametros($"CveMoneda = {CveMoneda}").Rows(0)("Moneda").ToString
|
||||
Dt.Rows.Add(Row)
|
||||
RowColorIndex += 1
|
||||
If RowColorIndex = 17 Then
|
||||
RowColorIndex = 0
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
Dim query = From s In Dt.AsEnumerable() Select New With {.Texto = s("Texto").ToString(), .Valor = s("Valor").ToString().ToDouble(), .Color = s("Color").ToString(), .Moneda = s("Moneda").ToString()}
|
||||
Dim json As String = Newtonsoft.Json.JsonConvert.SerializeObject(query)
|
||||
Select Case DdlGrafica.SelectedValue.ToEntero
|
||||
Case 1
|
||||
RegistraScript($"CargaGraficaBarras({json})", "22")
|
||||
Case 2
|
||||
RegistraScript($"CargaGraficaPastel({json})", "22")
|
||||
End Select
|
||||
UPModalProd.Update()
|
||||
End Sub
|
||||
Protected Sub DdlGrafica_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
CambioGrafica()
|
||||
End Sub
|
||||
|
||||
Protected Sub DdlVer_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
CambioGrafica()
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
@@ -583,12 +583,27 @@ Public Class ClsAcumuladores
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
End Function
|
||||
|
||||
Public Function GetNuevoConsecutivoFolio(CveFolioGarantia As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
SqlDataAdapter(String.Format("SELECT MAX(Consecutivo) + 1 AS NuevoConsecutivo FROM Acum_GarantiasDetalle d WHERE d.CveFolioGarantia = {0}", CveFolioGarantia), CommandType.Text)
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError(String.Format("Ocurrió un error al consultar un nuevo consecutivo para el folio {0}", CveFolioGarantia), ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
End Try
|
||||
Return Retorno
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
#Region " GARANTÍAS MESES "
|
||||
|
||||
|
||||
Public Function GarantiasMesesGet(CveGarantiaMes As Integer, CveEmpresa As Integer, Optional CveMarca As Integer = -1, Optional CveTipoUso As Integer = -1, Optional Mes As Integer = -1) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
'Data = New DataTable
|
||||
@@ -703,7 +718,7 @@ Public Class ClsAcumuladores
|
||||
Public Function AddGarantiasDetalle(CveVentaDetalle As Integer, CvePS As Integer, CveFolioGarantia As Integer, CveTipoUso As Integer,
|
||||
CodigoEnsamble As String, CodigoLinea As String, CodigoInspeccion As String,
|
||||
CveTipoDefecto As Integer, NumPoliza As String, Importe As Double,
|
||||
Consecutivo As String) As Boolean
|
||||
Consecutivo As String, FechaAjuste As DateTime) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
SqlDataAdapter("PA_Acum_GarantiasDetalleAdd")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
@@ -717,7 +732,8 @@ Public Class ClsAcumuladores
|
||||
.Add("@CveTipoDefecto", SqlDbType.Int).Value = CveTipoDefecto
|
||||
.Add("@NumPoliza", SqlDbType.VarChar).Value = NumPoliza
|
||||
.Add("@Importe", SqlDbType.Float).Value = Importe
|
||||
.Add("@Consecutivo", SqlDbType.VarChar).Value = Consecutivo
|
||||
.Add("@Consecutivo", SqlDbType.VarChar).Value = Consecutivo
|
||||
.Add("@FechaAjuste", SqlDbType.DateTime).Value = FechaAjuste
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
@@ -894,16 +910,16 @@ Public Class ClsAcumuladores
|
||||
End Function
|
||||
|
||||
|
||||
Public Function GetRepInicadorDiario(FechaInicio As Date, FechaFin As Date, CveSubProeycto As Integer, CveEmpresa As Integer) As Boolean
|
||||
Public Function GetRepIndicadorDiario(FechaInicio As Date, FechaFin As Date, CveSubProeycto As Integer, CveEmpresa As Integer) As Boolean
|
||||
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
SqlDataAdapter("PA_Acum_RepInicadorDiarioGet")
|
||||
SqlDataAdapter("PA_Acum_RepIndicadorDiarioGet")
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio
|
||||
.Add("@FechaFin", SqlDbType.Date).Value = FechaFin
|
||||
.Add("@CveSubProeycto", SqlDbType.Int).Value = CveSubProeycto
|
||||
.Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProeycto
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
End With
|
||||
|
||||
|
||||
@@ -4457,6 +4457,8 @@ Public Class ClsPaginas
|
||||
PaginaDict.Add("/Ventas/RepArqueosDetalle.aspx".ToUpper(), 680)
|
||||
PaginaDict.Add("/Ventas/RepCotizacionesxFacturar.aspx".ToUpper(), 686)
|
||||
PaginaDict.Add("/Ventas/RepRemisionesNC.aspx".ToUpper(), 687)
|
||||
PaginaDict.Add("/Ventas/CatCobranzaEstatus.aspx".ToUpper(), 7003)
|
||||
PaginaDict.Add("/Ventas/CatCobranzaEstatusTurno.aspx".ToUpper(), 7004)
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@ Public Class ClsProductosServicios
|
||||
|
||||
Public Property CvePS As Integer
|
||||
Public Property CveClasificacion As Integer
|
||||
Public Property Clasificacion As String
|
||||
Public Property CveUnidadMedida As Integer
|
||||
Public Property CveSATPS As Integer
|
||||
Public Property SATClavePS As String
|
||||
@@ -226,6 +227,7 @@ Public Class ClsProductosServicios
|
||||
If Data.Rows.Count > 0 Then
|
||||
Me.CvePS = Data.Rows(0)("CvePS").ToString().ToEntero
|
||||
Me.CveClasificacion = Data.Rows(0)("CveClasificacion").ToString.ToEntero
|
||||
Me.Clasificacion = Data.Rows(0)("Clasificacion").ToString
|
||||
CveUnidadMedida = Data.Rows(0)("CveUnidadMedida").ToString.ToEntero
|
||||
CveSATPS = Data.Rows(0)("CveSATPS").ToString.ToEntero
|
||||
Me.SATClavePS = Data.Rows(0)("SATClavePS").ToString
|
||||
|
||||
@@ -3130,6 +3130,149 @@ Public Class ClsVentas
|
||||
End Try
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function GetCobranzaEstatus(CveEmpresa As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
DataAdapter("PA_Vta_CobranzaEstatusGet")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As SqlException
|
||||
Me.OnError("Ocurrió un error al intentar obtener los estatus de cobranza", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
|
||||
End Function
|
||||
|
||||
Public Function AddCobranzaEstatus(CobranzaEstatus As String, CveEmpresa As Integer, Estatus As Boolean, CveUsuario As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
DataAdapter("PA_Vta_CobranzaEstatusAdd")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CobranzaEstatus", SqlDbType.VarChar).Value = CobranzaEstatus
|
||||
.Add("@Estatus", SqlDbType.Int).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 SqlException
|
||||
Me.OnError("Ocurrió un error al intentar agregar el estatus de cobranza", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
|
||||
End Function
|
||||
|
||||
Public Function RemoveCobranzaEstatus(CveCobranzaEstatus As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
DataAdapter("PA_Vta_CobranzaEstatusDelete")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveCobranzaEstatus", SqlDbType.Int).Value = CveCobranzaEstatus
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As SqlException
|
||||
Me.OnError("Ocurrió un error al intentar agregar el estatus de cobranza", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
|
||||
End Function
|
||||
|
||||
Public Function UpdateCobranzaEstatus(CveCobranzaEstatus As Integer, CobranzaEstatus As String, Estatus As Boolean) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
DataAdapter("PA_Vta_CobranzaEstatusUpdate")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveCobranzaEstatus", SqlDbType.Int).Value = CveCobranzaEstatus
|
||||
.Add("@CobranzaEstatus", SqlDbType.VarChar).Value = CobranzaEstatus
|
||||
.Add("@Estatus", SqlDbType.Bit).Value = Estatus
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As SqlException
|
||||
Me.OnError("Ocurrió un error al intentar agregar el estatus de cobranza", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
|
||||
End Function
|
||||
|
||||
Public Function AddCobranzaEstatusTurno(CobranzaEstatusTurno As String, CveEmpresa As Integer, Estatus As Boolean, CveUsuario As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
DataAdapter("PA_Vta_CobranzaEstatusTurnoAdd")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CobranzaEstatusTurno", SqlDbType.VarChar).Value = CobranzaEstatusTurno
|
||||
.Add("@Estatus", SqlDbType.Int).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 SqlException
|
||||
Me.OnError("Ocurrió un error al intentar agregar el estatus turno de cobranza", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
|
||||
End Function
|
||||
|
||||
Public Function RemoveCobranzaEstatusTurno(CveCobranzaEstatus As Integer) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
DataAdapter("PA_Vta_CobranzaEstatusTurnoDelete")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveCobranzaEstatusTurno", SqlDbType.Int).Value = CveCobranzaEstatus
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As SqlException
|
||||
Me.OnError("Ocurrió un error al intentar agregar el estatus de cobranza", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
|
||||
End Function
|
||||
|
||||
Public Function UpdateCobranzaEstatusTurno(CveCobranzaEstatus As Integer, CobranzaEstatus As String, Estatus As Boolean) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
DataAdapter("PA_Vta_CobranzaEstatusTurnoUpdate")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveCobranzaEstatusTurno", SqlDbType.Int).Value = CveCobranzaEstatus
|
||||
.Add("@CobranzaEstatusTurno", SqlDbType.VarChar).Value = CobranzaEstatus
|
||||
.Add("@Estatus", SqlDbType.Bit).Value = Estatus
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As SqlException
|
||||
Me.OnError("Ocurrió un error al intentar agregar el estatus de cobranza", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
#Region "C O M P L E M E N T O S"
|
||||
|
||||
@@ -1349,7 +1349,7 @@ Namespace Modelos
|
||||
For Each Dr As DataRow In DtAjustes.Rows
|
||||
If Not ObjAcum.AddGarantiasDetalle(Dr("CveVentaDetalle").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("CveFolioGarantia").ToString.ToEntero, Dr("CveTipoUso").ToString.ToEntero,
|
||||
Dr("CodigoEnsamble").ToString, Dr("CodigoLinea").ToString, Dr("CodigoInspeccion").ToString, Dr("CveTipoDefecto").ToString.ToEntero,
|
||||
Dr("NumPoliza").ToString, Dr("Importe").ToString.ToDouble, Dr("Consecutivo").ToString) Then
|
||||
Dr("NumPoliza").ToString, Dr("Importe").ToString.ToDouble, Dr("Consecutivo").ToString, Dr("FechaAjuste").ToString.ToDateTime()) Then
|
||||
ErrorList.Add("Ocurrió un error al agregar la garantia detalle.")
|
||||
End If
|
||||
Next
|
||||
|
||||
@@ -93,7 +93,7 @@ Public Class SIGPolizaVirtual : Implements IHttpHandler, IRequiresSessionState
|
||||
obj.sale_type = "01" 'PISO
|
||||
obj.sale_type_service = "01" 'PARTICULAR
|
||||
obj.sale_total = ObjFactura.Total
|
||||
obj.sale_discount = ObjFactura.SubTotal
|
||||
obj.sale_discount = 0 'ObjFactura.SubTotal
|
||||
obj.sale_id = GuidGenerator.GenerateTimeBasedGuid().ToString()
|
||||
|
||||
'Dim PS = ObjFactura.DtDetalle.Rows(0)
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
<%@ WebHandler Language="VB" Class="TareasProgramadas" %>
|
||||
|
||||
<%@ WebHandler Language="VB" Class="TareasProgramadas" %>
|
||||
|
||||
Imports System
|
||||
Imports System.Web
|
||||
Imports System.Data
|
||||
Imports Newtonsoft.Json
|
||||
Imports Newtonsoft.Json
|
||||
Imports Newtonsoft.Json.Linq
|
||||
Imports Extensiones
|
||||
Imports System.IO
|
||||
Imports System.IO
|
||||
Imports CrystalDecisions.CrystalReports.Engine
|
||||
Imports CrystalDecisions.Shared
|
||||
|
||||
Public Class TareasProgramadas : Implements IHttpHandler
|
||||
|
||||
@@ -14,21 +17,38 @@ Public Class TareasProgramadas : Implements IHttpHandler
|
||||
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
|
||||
context.Response.ContentType = "text/plain"
|
||||
currentcontext = context
|
||||
'timbrarNominab()
|
||||
Dim retorno As String = "no se encontro la variable"
|
||||
Try
|
||||
URLParametros = Parametros(context.Request("var"))
|
||||
Dim metodo As String = URLParametros("metodo")
|
||||
Try
|
||||
Dim metodo As String = ""
|
||||
If context.Request("var") IsNot Nothing Then
|
||||
URLParametros = Parametros(context.Request("var"))
|
||||
metodo = URLParametros("metodo")
|
||||
ElseIf context.Request.Headers("Content-Type") IsNot Nothing AndAlso context.Request.Headers("Content-Type").Contains("json") AndAlso context.Request.InputStream IsNot Nothing Then
|
||||
context.Response.ContentType = "application/json"
|
||||
Using reader As New StreamReader(context.Request.InputStream)
|
||||
Dim json = reader.ReadToEnd()
|
||||
Dim JsonRequest As JObject = JObject.Parse(json)
|
||||
If JsonRequest IsNot Nothing Then
|
||||
metodo = JsonRequest("Metodo").ToString
|
||||
End If
|
||||
End Using
|
||||
End If
|
||||
|
||||
Select Case metodo
|
||||
Case "TimbrarNomina"
|
||||
retorno = "Error Timbrado Nomina"
|
||||
retorno = timbrarNomina()
|
||||
retorno = ""
|
||||
retorno = ""
|
||||
context.Response.Write(retorno)
|
||||
Case "EstadosCuenta"
|
||||
'CargaEstadosCuenta(context, 119, 227736)
|
||||
CargaEstadosCuenta(context, -1, -1)
|
||||
End Select
|
||||
Catch ex As Exception
|
||||
ex.GuardaLog(ex.ToString())
|
||||
ex.GuardaLog(ex.ToString())
|
||||
context.Response.Write(retorno)
|
||||
End Try
|
||||
context.Response.Write(retorno)
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -127,18 +147,18 @@ Public Class TareasProgramadas : Implements IHttpHandler
|
||||
|
||||
|
||||
Private Function GetUsuario(CveEmpresa As Integer, Optional CveUsuario As Integer = -1, Optional username As String = "", Optional pass As String = "") As Usuario
|
||||
Dim usuario As Usuario = Nothing
|
||||
Dim usuario As Usuario = Nothing
|
||||
#Region "Valido que los campos usuario contraseña no sean nulos"
|
||||
|
||||
|
||||
If IsNothing(username) Then
|
||||
username = ""
|
||||
End If
|
||||
If IsNothing(pass) Then
|
||||
pass = ""
|
||||
End If
|
||||
End If
|
||||
#End Region
|
||||
#Region "Si el CveUsuario es mayor que cero asigno el username y pass la de la CveUsuario"
|
||||
|
||||
|
||||
If CveUsuario > 0 Then
|
||||
Using Dv As New DataView(DirectCast(currentcontext.Application("GlobalDTUsuarios"), DataTable), $"CveUsuario = 100 AND CveEmpresa ={CveEmpresa}", "", DataViewRowState.CurrentRows)
|
||||
Using GlobalDTUsuarios As DataTable = Dv.ToTable()
|
||||
@@ -149,13 +169,13 @@ Public Class TareasProgramadas : Implements IHttpHandler
|
||||
End If
|
||||
End Using
|
||||
End Using
|
||||
End If
|
||||
End If
|
||||
#End Region
|
||||
#Region "obtengo el usuario con el username y la pass"
|
||||
|
||||
|
||||
Using ObjUsuario As New ClsSisUsuarios()
|
||||
usuario = ObjUsuario.ValidaUsuario(username, pass, IMEI, CveEmpresa)
|
||||
End Using
|
||||
End Using
|
||||
#End Region
|
||||
#Region "Asigno la empresa al usuario"
|
||||
If Not IsNothing(usuario) Then
|
||||
@@ -179,7 +199,7 @@ Public Class TareasProgramadas : Implements IHttpHandler
|
||||
End If
|
||||
End Using
|
||||
|
||||
End If
|
||||
End If
|
||||
#End Region
|
||||
Return usuario
|
||||
End Function
|
||||
@@ -224,8 +244,6 @@ Public Class TareasProgramadas : Implements IHttpHandler
|
||||
Return retorno
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
Private Function Parametros(Cadena As String) As Hashtable
|
||||
Cadena = Decripta(Cadena)
|
||||
Dim P1() As String = Cadena.Split("&"c)
|
||||
@@ -244,6 +262,436 @@ Public Class TareasProgramadas : Implements IHttpHandler
|
||||
Get
|
||||
Return False
|
||||
End Get
|
||||
End Property
|
||||
End Property
|
||||
|
||||
|
||||
#Region "E S T A D O S D E C U E N T A"
|
||||
Private Sub CargaEstadosCuenta(ByVal context As HttpContext, pCveEmpresa As Integer, pCveCliente As Integer)
|
||||
Dim Retorno As New JArray()
|
||||
Dim DtEmpresas As DataTable = Nothing
|
||||
Using ObjEmpresas As New ClsSisEmpresas()
|
||||
If ObjEmpresas.GetEmpresas(pCveEmpresa, "-1", "-1", "-1", "-1") Then
|
||||
DtEmpresas = ObjEmpresas.DtResultados.FiltraParametros("", "", {"CveEmpresa"})
|
||||
End If
|
||||
End Using
|
||||
|
||||
If DtEmpresas IsNot Nothing Then
|
||||
For Each Row As DataRow In DtEmpresas.Rows
|
||||
Dim Usuario = ValidaUsuarioSistema(Row("CveEmpresa").ToString().ToEntero())
|
||||
Dim obj = EjecutarEnvioEstadoCuenta(Usuario, pCveCliente:=pCveCliente)
|
||||
|
||||
Retorno.Add(obj)
|
||||
Next
|
||||
End If
|
||||
|
||||
context.Response.Write(Retorno.ToString())
|
||||
End Sub
|
||||
|
||||
|
||||
Private Function ValidaUsuarioSistema(CveEmpresa As Integer) As Usuario
|
||||
Dim UsuarioActual As Usuario = Nothing
|
||||
Dim ObjUsuarios As New ClsSisUsuarios
|
||||
If ObjUsuarios.GetUsuarios(100) Then
|
||||
If ObjUsuarios.DtResultados.Rows.Count > 0 Then
|
||||
Dim Usuario = ObjUsuarios.DtResultados.Rows(0)("Usuario").ToString()
|
||||
Dim Contrasenia = ObjUsuarios.DtResultados.Rows(0)("Contraseña").ToString()
|
||||
UsuarioActual = ObjUsuarios.ValidaUsuario(Usuario, Contrasenia, IMEI, CveEmpresa)
|
||||
UsuarioActual.CveEmpresa = CveEmpresa
|
||||
CreaObjetoEmpresa(UsuarioActual)
|
||||
End If
|
||||
End If
|
||||
ObjUsuarios.Dispose()
|
||||
Return UsuarioActual
|
||||
End Function
|
||||
Private Sub CreaObjetoEmpresa(ByRef UsuarioActual As Usuario)
|
||||
|
||||
Dim ObjEmpresa As New ClsSisEmpresas()
|
||||
If ObjEmpresa.GetEmpresas(UsuarioActual.CveEmpresa, "-1", "-1", "-1", "-1") Then
|
||||
If ObjEmpresa.GetEmpresasFuncionalidades(UsuarioActual.CveEmpresa) Then
|
||||
Dim dttmp As Data.DataTable = ObjEmpresa.DtResultados
|
||||
|
||||
Dim EmpresasFuncionalidades As New HybridDictionary
|
||||
For Each Row As Data.DataRow In dttmp.Rows
|
||||
EmpresasFuncionalidades.Add(Convert.ToInt32(Row("CveFuncionalidad")), Row("Valor").ToString)
|
||||
Next
|
||||
ObjEmpresa.Empresa.SetFuncionalidades(EmpresasFuncionalidades)
|
||||
End If
|
||||
|
||||
UsuarioActual.Empresa = ObjEmpresa.Empresa
|
||||
End If
|
||||
ObjEmpresa.Dispose()
|
||||
End Sub
|
||||
|
||||
|
||||
Private Function EjecutarEnvioEstadoCuenta(UsuarioActual As Usuario, Optional pCveCliente As Integer = -1) As JObject
|
||||
Dim ClientesSinEnviar As New JArray()
|
||||
|
||||
Dim Json As New JObject(
|
||||
New JProperty("Empresa", UsuarioActual.Empresa.Empresa),
|
||||
New JProperty("Usuario", UsuarioActual.Usuario),
|
||||
New JProperty("Fecha", DateTime.Now.ToString("dd/MM/yyy HH:mm:ss"))
|
||||
)
|
||||
Dim DTClientes As DataTable = Nothing
|
||||
|
||||
Using ObjCliente As New ClsClientes
|
||||
If ObjCliente.GetClientes(pCveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa, TipoCliente:=-1, Estatus:=1) Then
|
||||
If ObjCliente.DtResultados.Rows.Count > 0 Then
|
||||
DTClientes = ObjCliente.DtResultados.Copy()
|
||||
End If
|
||||
End If
|
||||
End Using
|
||||
|
||||
If DTClientes IsNot Nothing Then
|
||||
For Each RowCliente As DataRow In DTClientes.Rows
|
||||
Dim CveCliente As Integer = RowCliente("CveCliente").ToString().ToEntero()
|
||||
Dim Correo As String = RowCliente("CobranzaCorreo").ToString()
|
||||
|
||||
Dim Cliente As New Modelos.ClienteModel(CveCliente, UsuarioActual.CveEmpresa)
|
||||
|
||||
Dim Envio = EnviarEstadoCuenta(UsuarioActual, Correo, Cliente)
|
||||
|
||||
If Envio Then
|
||||
Using ObjBitacora As New ClsOIEventos
|
||||
ObjBitacora.AddEventoBitacora("Se envió correo con el estado de cuenta del cliente", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCliente:=Cliente.CveCliente)
|
||||
End Using
|
||||
Else
|
||||
ClientesSinEnviar.Add(New JObject(
|
||||
New JProperty("CveCliente", Cliente.CveCliente),
|
||||
New JProperty("Cliente", Cliente.Nombre)
|
||||
))
|
||||
End If
|
||||
Next
|
||||
DTClientes.Dispose()
|
||||
End If
|
||||
Json.Add(New JProperty("ClientesSinEnviar", ClientesSinEnviar))
|
||||
|
||||
Return Json
|
||||
End Function
|
||||
|
||||
Private Function EnviarEstadoCuenta(UsuarioActual As Usuario, Correo As String, Cliente As Modelos.ClienteModel) As Boolean
|
||||
Dim Retorno As Boolean = True
|
||||
|
||||
Dim ArchivoPDF As Byte() = Nothing
|
||||
|
||||
Dim Formato As String = "PDF"
|
||||
Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/RepClientesCxC.rpt", UsuarioActual.Empresa.Ruta))
|
||||
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
|
||||
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, UsuarioActual.CveEmpresa)
|
||||
'OBTENEMOS LOS DATOS
|
||||
Dim DtCxCFact As DataTable = Nothing
|
||||
|
||||
Dim SaldoIngDolares As Double = 0
|
||||
Dim SaldoIngPesos As Double = 0
|
||||
Dim SaldoIngDolaresPesos As Double = 0
|
||||
Dim TotalIng As Double = 0
|
||||
Dim SaldoAntDolares As Double = 0
|
||||
Dim SaldoAntPesos As Double = 0
|
||||
Dim SaldoAntDolaresPesos As Double = 0
|
||||
Dim TotalAnt As Double = 0
|
||||
Dim ContaIng As Integer = 0
|
||||
Dim ContaAnt As Integer = 0
|
||||
Dim FechaCorte As Date = ("9999/01/01").ToDate
|
||||
|
||||
Dim TipoDocto2 As String = "'Ing','NC','Dev'"
|
||||
Dim FechaVencimientoI As String = "-1"
|
||||
Dim FechaVencimientoF As String = "-1"
|
||||
Dim FI As String = "-1"
|
||||
Dim FF As String = "-1"
|
||||
Dim dtt As DataTable = Nothing
|
||||
|
||||
Try
|
||||
Using ObjMovtos As New ClsMovimientos()
|
||||
If ObjMovtos.GetCxCClienteDetalle(Cliente.CveCliente, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa, CveClienteSucursal:=-1) Then
|
||||
DtCxCFact = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'Act'", "TipoDocto")
|
||||
'cargo los anticipos NC
|
||||
DtCxCFact.Columns.Add("SaldoAnticipo", GetType(Decimal))
|
||||
If ObjMovtos.GetAnticiposNCIxCCliente(Cliente.CveCliente, -1, -1) Then
|
||||
dtt = ObjMovtos.DtResultados.FiltraParametros("Saldo > 0 AND SaldoVentaAnticipo = 0 AND ((Tipo = 'IxC' AND CveIE > 0) OR (Tipo = 'Ant' AND CveVenta > 0) OR (Tipo = 'NC' AND CveVenta > 0) OR (Tipo = 'Egs' AND CveVenta > 0) )")
|
||||
End If
|
||||
End If
|
||||
End Using
|
||||
Catch ex As Exception
|
||||
Retorno = False
|
||||
dtt = Nothing
|
||||
OnError("Ocurrió un erro al obtener el CxC", ex)
|
||||
End Try
|
||||
|
||||
If Not Retorno Then
|
||||
Return Retorno
|
||||
End If
|
||||
|
||||
Try
|
||||
If dtt IsNot Nothing AndAlso dtt.Rows.Count > 0 Then
|
||||
For Each drt As DataRow In dtt.Rows
|
||||
Dim drr As DataRow = DtCxCFact.NewRow
|
||||
drr("TipoDocto") = drt("Tipo")
|
||||
drr("SerieFolio") = drt("Folio")
|
||||
drr("Original") = drt("Original")
|
||||
drr("TipoCambio") = drt("TipoCambio")
|
||||
drr("Saldo") = 0
|
||||
drr("SaldoAnticipo") = drt("Saldo")
|
||||
drr("Fecha") = drt("Fecha")
|
||||
drr("Moneda") = drt("Moneda")
|
||||
drr("CveMoneda") = drt("CveMoneda")
|
||||
DtCxCFact.Rows.Add(drr)
|
||||
Next
|
||||
Else
|
||||
Retorno = False
|
||||
Return Retorno
|
||||
End If
|
||||
|
||||
If DtCxCFact IsNot Nothing Then
|
||||
For Each Row As DataRow In DtCxCFact.FiltraParametros($"TipoDocto IN ({TipoDocto2})").Rows
|
||||
If Row("TipoDocto").ToString = "Ing" Or Row("TipoDocto").ToString = "Rem" Or (Row("TipoDocto").ToString = "Ant" And Row("Saldo").ToString.ToDouble > 0) Then 'Ingresos
|
||||
ContaIng = ContaIng + 1
|
||||
If Row("CveMoneda").ToString.ToEntero = 1 Then
|
||||
SaldoIngPesos = SaldoIngPesos + Row("Saldo").ToString.ToDouble
|
||||
ElseIf Row("CveMoneda").ToString.ToEntero = 2 Then
|
||||
SaldoIngDolares = SaldoIngDolares + Row("Saldo").ToString.ToDouble
|
||||
SaldoIngDolaresPesos = SaldoIngDolaresPesos + (Row("Saldo").ToString.ToDouble * Row("TipoCambio").ToString.ToDouble)
|
||||
End If
|
||||
|
||||
ElseIf (Row("TipoDocto").ToString = "Ant" And Row("Saldo").ToString.ToDouble = 0) Or Row("TipoDocto").ToString = "IxC" Or Row("TipoDocto").ToString = "NC" Or Row("TipoDocto").ToString = "Dev" Then 'Anticipos, NC, IxC
|
||||
ContaAnt = ContaAnt + 1
|
||||
If Row("CveMoneda").ToString.ToEntero = 1 Then
|
||||
If Row("TipoDocto").ToString = "Dev" Then
|
||||
SaldoAntPesos = SaldoAntPesos + Row("Saldo").ToString.ToDouble
|
||||
Else
|
||||
SaldoAntPesos = SaldoAntPesos + Row("SaldoAnticipo").ToString.ToDouble
|
||||
End If
|
||||
ElseIf Row("CveMoneda").ToString.ToEntero = 2 Then
|
||||
SaldoAntDolares = SaldoAntDolares + Row("Saldo").ToString.ToDouble
|
||||
SaldoAntDolaresPesos = SaldoAntDolaresPesos + (Row("SaldoAnticipo").ToString.ToDouble * Row("TipoCambio").ToString.ToDouble)
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
TotalIng = SaldoIngPesos + SaldoIngDolaresPesos
|
||||
TotalAnt = SaldoAntPesos + SaldoAntDolaresPesos
|
||||
|
||||
Dim DtCxCFact2 As DataTable = DtCxCFact.FiltraParametros($"TipoDocto IN ({TipoDocto2})")
|
||||
|
||||
'INGRESOS
|
||||
If SaldoIngPesos > 0 Then
|
||||
Dim drr As DataRow = DtCxCFact2.NewRow
|
||||
drr("SerieFolio") = "Total Ing Pesos"
|
||||
drr("Original") = DtCxCFact2.FiltraParametros("CveMoneda = 1").SUM("Original", "TipoDocto IN ('Ing','Rem') OR (TipoDocto = 'Ant' AND Saldo > 0)")
|
||||
drr("Abonado") = DtCxCFact2.FiltraParametros("CveMoneda = 1").SUM("Abonado", "TipoDocto IN ('Ing','Rem') OR (TipoDocto = 'Ant' AND Saldo > 0)")
|
||||
drr("Saldo") = SaldoIngPesos
|
||||
drr("CveMoneda") = 1
|
||||
DtCxCFact2.Rows.Add(drr)
|
||||
End If
|
||||
If SaldoIngDolares > 0 Then
|
||||
Dim drr As DataRow = DtCxCFact2.NewRow
|
||||
drr("SerieFolio") = "Total Ing Dólares"
|
||||
drr("Original") = DtCxCFact2.FiltraParametros("CveMoneda = 2").SUM("Original", "TipoDocto IN ('Ing','Rem') OR (TipoDocto = 'Ant' AND Saldo > 0)")
|
||||
drr("Abonado") = DtCxCFact2.FiltraParametros("CveMoneda = 2").SUM("Abonado", "TipoDocto IN ('Ing','Rem') OR (TipoDocto = 'Ant' AND Saldo > 0)")
|
||||
drr("Saldo") = SaldoIngDolares
|
||||
drr("CveMoneda") = 2
|
||||
DtCxCFact2.Rows.Add(drr)
|
||||
End If
|
||||
|
||||
'ANTICIPOS
|
||||
If SaldoAntPesos > 0 Then
|
||||
Dim drr As DataRow = DtCxCFact2.NewRow
|
||||
drr("SerieFolio") = "Total Pesos"
|
||||
drr("SaldoAnticipo") = SaldoAntPesos
|
||||
drr("CveMoneda") = 1
|
||||
DtCxCFact2.Rows.Add(drr)
|
||||
End If
|
||||
If SaldoAntDolares > 0 Then
|
||||
Dim drr As DataRow = DtCxCFact2.NewRow
|
||||
drr("SerieFolio") = "Total Dólares"
|
||||
drr("SaldoAnticipo") = SaldoAntDolares
|
||||
drr("CveMoneda") = 2
|
||||
DtCxCFact2.Rows.Add(drr)
|
||||
End If
|
||||
|
||||
If DtCxCFact2 IsNot Nothing AndAlso DtCxCFact2.Rows.Count > 0 Then
|
||||
Dim dr As DataRow = DtCxCFact2.Rows(0)
|
||||
Dim lista = New List(Of CrystalParametro)
|
||||
lista.Add(New CrystalParametro("Empresa", UsuarioActual.Empresa.Empresa))
|
||||
lista.Add(New CrystalParametro("TipoCuentas", "Con Saldo"))
|
||||
lista.Add(New CrystalParametro("NombreCliente", Cliente.Nombre))
|
||||
lista.Add(New CrystalParametro("FechaInicio", If(FI = "-1", "-", FI)))
|
||||
lista.Add(New CrystalParametro("FechaFin", If(FF = "-1", DateTime.Now.ToShortDateString, FF)))
|
||||
lista.Add(New CrystalParametro("UsuarioImprimio", UsuarioActual.Nombre))
|
||||
lista.Add(New CrystalParametro("DireccionCliente", String.Format("Calle {0} #{1} Colonia {2}", Cliente.Direccion, If(Cliente.NoExt = "", "S/N", Cliente.NoExt), Cliente.Colonia)))
|
||||
lista.Add(New CrystalParametro("ClienteCP", Cliente.CP))
|
||||
lista.Add(New CrystalParametro("ClienteCiudad", Cliente.Ciudad))
|
||||
lista.Add(New CrystalParametro("ClienteRFC", Cliente.RFC))
|
||||
lista.Add(New CrystalParametro("ClienteTelefono", Cliente.Telefono))
|
||||
lista.Add(New CrystalParametro("DiasCredito", Cliente.PlazoCobranza))
|
||||
lista.Add(New CrystalParametro("LimiteCredito", Cliente.LimiteCredito))
|
||||
lista.Add(New CrystalParametro("SaldoDisponible", (Cliente.LimiteCredito - DtCxCFact2(0)("Saldo").ToString.ToDouble).FormatoNumero))
|
||||
lista.Add(New CrystalParametro("SaldoIngDolares", SaldoIngDolares.FormatoNumero))
|
||||
lista.Add(New CrystalParametro("SaldoIngPesos", SaldoIngPesos.FormatoNumero))
|
||||
lista.Add(New CrystalParametro("TotalIng", TotalIng.FormatoNumero))
|
||||
lista.Add(New CrystalParametro("SaldoAntDolares", SaldoAntDolares.FormatoNumero))
|
||||
lista.Add(New CrystalParametro("SaldoAntPesos", SaldoAntPesos.FormatoNumero))
|
||||
lista.Add(New CrystalParametro("TotalAnt", TotalAnt.FormatoNumero))
|
||||
lista.Add(New CrystalParametro("ContaIng", ContaIng))
|
||||
lista.Add(New CrystalParametro("ContaAnt", ContaAnt))
|
||||
|
||||
If Imagen.Exists Then
|
||||
lista.Add(New CrystalParametro("LogoPath", logouri))
|
||||
Else
|
||||
lista.Add(New CrystalParametro("LogoPath", ""))
|
||||
End If
|
||||
|
||||
Try
|
||||
If Archivo.Exists Then
|
||||
ArchivoPDF = ImprimirPDFCrystal($"{UsuarioActual.Empresa.Ruta}Formatos/RepClientesCxC.rpt", DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), lista, "Estado de cuenta", Formato)
|
||||
Else
|
||||
ArchivoPDF = ImprimirPDFCrystal(HttpContext.Current.Server.MapPath("~/Empresas/Grales/Formatos/RepClientesCxC.rpt"), DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), lista, "Estado de cuenta", Formato)
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió error al mandar MAIL de Orden de Compra", ex)
|
||||
End Try
|
||||
Else
|
||||
Dim lista = New List(Of CrystalParametro)
|
||||
lista.Add(New CrystalParametro("Empresa", UsuarioActual.Empresa.Empresa))
|
||||
lista.Add(New CrystalParametro("TipoCuentas", "Con Saldo"))
|
||||
lista.Add(New CrystalParametro("NombreCliente", Cliente.Nombre))
|
||||
lista.Add(New CrystalParametro("FechaInicio", If(FI = "-1", "-", FI)))
|
||||
lista.Add(New CrystalParametro("FechaFin", If(FF = "-1", DateTime.Now.ToShortDateString, FF)))
|
||||
lista.Add(New CrystalParametro("UsuarioImprimio", UsuarioActual.Nombre))
|
||||
lista.Add(New CrystalParametro("DireccionCliente", String.Format("Calle {0} #{1} Colonia {2}", Cliente.Direccion, If(Cliente.NoExt = "", "S/N", Cliente.NoExt), Cliente.Colonia)))
|
||||
lista.Add(New CrystalParametro("ClienteCP", Cliente.CP))
|
||||
lista.Add(New CrystalParametro("ClienteCiudad", Cliente.Ciudad))
|
||||
lista.Add(New CrystalParametro("ClienteRFC", Cliente.RFC))
|
||||
lista.Add(New CrystalParametro("ClienteTelefono", Cliente.Telefono))
|
||||
lista.Add(New CrystalParametro("DiasCredito", Cliente.PlazoCobranza))
|
||||
lista.Add(New CrystalParametro("LimiteCredito", Cliente.LimiteCredito))
|
||||
lista.Add(New CrystalParametro("SaldoDisponible", (Cliente.LimiteCredito).FormatoNumero))
|
||||
|
||||
lista.Add(New CrystalParametro("SaldoIngDolares", SaldoIngDolares.FormatoNumero))
|
||||
lista.Add(New CrystalParametro("SaldoIngPesos", SaldoIngPesos.FormatoNumero))
|
||||
lista.Add(New CrystalParametro("TotalIng", TotalIng.FormatoNumero))
|
||||
lista.Add(New CrystalParametro("SaldoAntDolares", SaldoAntDolares.FormatoNumero))
|
||||
lista.Add(New CrystalParametro("SaldoAntPesos", SaldoAntPesos.FormatoNumero))
|
||||
lista.Add(New CrystalParametro("TotalAnt", TotalAnt.FormatoNumero))
|
||||
lista.Add(New CrystalParametro("ContaIng", ContaIng))
|
||||
lista.Add(New CrystalParametro("ContaAnt", ContaAnt))
|
||||
|
||||
If Imagen.Exists Then
|
||||
lista.Add(New CrystalParametro("LogoPath", logouri))
|
||||
Else
|
||||
lista.Add(New CrystalParametro("LogoPath", ""))
|
||||
End If
|
||||
|
||||
Dim drr As DataRow = DtCxCFact2.NewRow
|
||||
drr("SerieFolio") = "Total Ing Pesos"
|
||||
drr("Original") = DtCxCFact2.FiltraParametros("CveMoneda = 1").SUM("Original", "TipoDocto IN ('Ing','Rem') OR (TipoDocto = 'Ant' AND Saldo > 0)")
|
||||
drr("Abonado") = DtCxCFact2.FiltraParametros("CveMoneda = 1").SUM("Abonado", "TipoDocto IN ('Ing','Rem') OR (TipoDocto = 'Ant' AND Saldo > 0)")
|
||||
drr("Saldo") = 0
|
||||
drr("SaldoAnticipo") = 0
|
||||
drr("CveMoneda") = 1
|
||||
DtCxCFact2.Rows.Add(drr)
|
||||
|
||||
If Archivo.Exists Then
|
||||
ArchivoPDF = ImprimirPDFCrystal($"{UsuarioActual.Empresa.Ruta}Formatos/RepClientesCxC.rpt", DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), lista, "Estado de cuenta", Formato)
|
||||
Else
|
||||
ArchivoPDF = ImprimirPDFCrystal(HttpContext.Current.Server.MapPath("~/Empresas/Grales/Formatos/RepClientesCxC.rpt"), DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), lista, "Estado de cuenta", Formato)
|
||||
End If
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al generar el pdf", ex)
|
||||
ArchivoPDF = Nothing
|
||||
End Try
|
||||
|
||||
If ArchivoPDF IsNot Nothing Then
|
||||
Try
|
||||
Dim Cuerpo As String = String.Format("Estimado cliente {0}, al presente del correo se anexa su estado actual de cartera en {1}.<br />
|
||||
<br />
|
||||
Quedamos a sus ordenes para cualquier duda o aclaración con su agente de Ventas.<br />
|
||||
<br />
|
||||
<br />
|
||||
Gracias por la atención brindada al presente.<br /> Reciba un cordial saludo.<br />
|
||||
<br />
|
||||
<b>ESTE CORREO SE GENERO EN FORMA AUTOMATICA.</b>", Cliente.NombreComercial, UsuarioActual.Empresa.Empresa)
|
||||
|
||||
Retorno = MandaCorreo(ArchivoPDF, Correo, $"Estado Actual de Cartera {UsuarioActual.Empresa.Empresa}", Cuerpo)
|
||||
Catch ex As Exception
|
||||
Retorno = False
|
||||
OnError("Ocurrió un error al enviar el correo", ex)
|
||||
End Try
|
||||
Else
|
||||
Retorno = False
|
||||
End If
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
Public Function ImprimirPDFCrystal(RutaReporte As String, DataSource As DataTable, Parametros As List(Of CrystalParametro), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional MR As ReportDocument = Nothing) As Byte()
|
||||
'limpio ReportViwer
|
||||
Dim sw As New System.Diagnostics.Stopwatch()
|
||||
sw.Start()
|
||||
If IsNothing(MR) Then MR = New ReportDocument()
|
||||
Dim Bytes As Byte() = Nothing
|
||||
Dim formatType As ExportFormatType = ExportFormatType.NoFormat
|
||||
Try
|
||||
MR.Load(RutaReporte)
|
||||
MR.SetDataSource(DataSource)
|
||||
|
||||
For Each item As CrystalParametro In Parametros
|
||||
MR.SetParameterValue(item.Nombre, item.Valor)
|
||||
Next
|
||||
|
||||
Select Case Formato
|
||||
Case "PDF"
|
||||
formatType = ExportFormatType.PortableDocFormat
|
||||
'Format = "Application/pdf"
|
||||
Case "EXCEL"
|
||||
formatType = ExportFormatType.Excel
|
||||
'Format = "application/ms-excel"
|
||||
End Select
|
||||
Dim Stream As IO.Stream = MR.ExportToStream(formatType)
|
||||
Dim BD As New BinaryReader(MR.ExportToStream(formatType))
|
||||
Bytes = BD.ReadBytes(CInt(MR.ExportToStream(formatType).Length))
|
||||
BD.Dispose()
|
||||
Stream.Dispose()
|
||||
'Dim Buffer(CInt(Stream.Length)) As Byte
|
||||
'Bytes = Buffer
|
||||
'MR.ExportToHttpResponse(formatType, Response, True, NombreArchivo)
|
||||
Catch ex As CrystalReportsException
|
||||
GuardaLog(If(ex.InnerException IsNot Nothing AndAlso ex.Message IsNot Nothing,
|
||||
$"Error: {If(ex.InnerException.Message, ex.Message)} | Descripcion: {If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException.Message IsNot Nothing,
|
||||
ex.InnerException.InnerException.Message, If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, "Sin descripcion"))} Ruta {RutaReporte}", $"Sin descripción - Ruta {RutaReporte}"))
|
||||
'HAY QUE VALIDAR QUE LOS OBJETOS QUE SE USAN PARA GUARDAR LOG EXISTEN!!! IPP 14 AGOSTO 2017
|
||||
'GuardaLog($"Error: {ex.InnerException.Message} | Descripcion: {If(ex.InnerException.InnerException IsNot Nothing, ex.InnerException.InnerException.Message, "Sin descripcion")} - Ruta {RutaReporte}")
|
||||
Catch ex As Exception
|
||||
GuardaLog(If(ex.InnerException IsNot Nothing AndAlso ex.Message IsNot Nothing,
|
||||
$"Error: {If(ex.InnerException.Message, ex.Message)} | Descripcion: {If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException.Message IsNot Nothing,
|
||||
ex.InnerException.InnerException.Message, If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, "Sin descripcion"))} Ruta {RutaReporte}", $"Sin descripción - Ruta {RutaReporte}"))
|
||||
|
||||
'HAY QUE VALIDAR QUE LOS OBJETOS QUE SE USAN PARA GUARDAR LOG EXISTEN!!! IPP 14 AGOSTO 2017
|
||||
'GuardaLog($"Error {ex.InnerException.Message} | Descripcion: {If(ex.InnerException.InnerException IsNot Nothing, ex.InnerException.InnerException.Message, "Sin descripcion")} - Ruta {RutaReporte}")
|
||||
End Try
|
||||
sw.Stop()
|
||||
If sw.Elapsed.TotalSeconds > 10 Then
|
||||
GuardaLog($"Reporte:{RutaReporte} | Tiempo Renderizado Milisegundos: {sw.ElapsedMilliseconds},Total Segundos: {sw.Elapsed.TotalSeconds} ")
|
||||
End If
|
||||
If MR IsNot Nothing Then MR.Dispose()
|
||||
Return Bytes
|
||||
End Function
|
||||
|
||||
Private Function MandaCorreo(File As Byte(), Para As String, Asunto As String, Body As String) As Boolean
|
||||
|
||||
Dim a As String = String.Format("{0} -- {1} ---- -->", Asunto, Para)
|
||||
'a.GuardaLog()
|
||||
Dim Mail As New ClsSisMail()
|
||||
|
||||
Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail)
|
||||
LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.ArchivoBinario = File, .NombreArchivo = "EstadoDeCuenta.pdf"})
|
||||
|
||||
Return Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body, Archivos:=LSRutasMail)
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
@@ -6639,10 +6639,10 @@ Partial Class Compras_Compras
|
||||
|
||||
IdCtaContable = CtaProveedorExtranjera
|
||||
CveCuenta = CveCuentaProveedorExtranjera
|
||||
If ObjConta.AddPrePolizasDetalle(CvePrePolizaTemp, False, importeMovimientoNC, Referencia, 17, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=Gvr.DataKey("CveCompra").ToEntero, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimientoNC, ImporteME:=importeMovimientoNC, TipoCambio:=TipoCambioFactura, CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza) Then
|
||||
If ObjConta.AddPrePolizasDetalle(CvePrePolizaTemp, False, importeMovimientoNC, Referencia, 272, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=Gvr.DataKey("CveCompra").ToEntero, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMovimientoNC, ImporteME:=importeMovimientoNC, TipoCambio:=TipoCambioFactura, CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza, CveCompraAmortizacion:=CveCompra) Then
|
||||
IdCtaContable = CtaProveedorComplementaria
|
||||
CveCuenta = CveCuentaProveedorComplementaria
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaTemp, False, importeMNNC - importeMovimientoNC, Referencia, 206, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=Gvr.DataKey("CveCompra").ToEntero, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMNNC - importeMovimientoNC, ImporteME:=importeMovimientoNC, TipoCambio:=TipoCambioFactura, CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza) Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePolizaTemp, False, importeMNNC - importeMovimientoNC, Referencia, 206, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=Gvr.DataKey("CveCompra").ToEntero, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMNNC - importeMovimientoNC, ImporteME:=importeMovimientoNC, TipoCambio:=TipoCambioFactura, CveCuenta:=CveCuenta, Contabilizable:=SeContabiliza, CveCompraAmortizacion:=CveCompra) Then
|
||||
ErrorPrepoliza = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
@@ -111,9 +111,16 @@ Partial Class Compras_eFacturas
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property Serie() As String
|
||||
Private Property Serie() As String
|
||||
|
||||
Get
|
||||
Return m_Serie
|
||||
If m_Serie Is Nothing Then
|
||||
Return ""
|
||||
Else
|
||||
Return m_Serie
|
||||
End If
|
||||
|
||||
|
||||
End Get
|
||||
Set
|
||||
m_Serie = Value
|
||||
@@ -2535,15 +2542,80 @@ Partial Class Compras_eFacturas
|
||||
BtnOcultar.Visible = False
|
||||
BtnMostrar.Visible = True
|
||||
UpBitacora.Update()
|
||||
End Sub
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
|
||||
Property MSGComplemento As String
|
||||
Get
|
||||
If ViewState("MSGComplemento") Is Nothing Then
|
||||
Return ""
|
||||
Else
|
||||
Return ViewState("MSGComplemento").ToString
|
||||
End If
|
||||
End Get
|
||||
Set(value As String)
|
||||
ViewState("MSGComplemento") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Property ViculacionConPUE As Boolean
|
||||
Get
|
||||
If ViewState("ViculacionConPUE") Is Nothing Then
|
||||
Return False
|
||||
Else
|
||||
Return Boolean.Parse(ViewState("ViculacionConPUE").ToString)
|
||||
End If
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
ViewState("ViculacionConPUE") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
Property ListaComprasPUE As List(Of Integer)
|
||||
Get
|
||||
If ViewState("ListaComprasPUE") Is Nothing Then
|
||||
Return New List(Of Integer)
|
||||
Else
|
||||
Return DirectCast(ViewState("ListaComprasPUE"), List(Of Integer))
|
||||
End If
|
||||
End Get
|
||||
Set(value As List(Of Integer))
|
||||
ViewState("ListaComprasPUE") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
Property ComplementoConPUE As String
|
||||
Get
|
||||
If ViewState("ComplementoConPUE") Is Nothing Then
|
||||
Return ""
|
||||
Else
|
||||
Return ViewState("ComplementoConPUE").ToString
|
||||
End If
|
||||
End Get
|
||||
Set(value As String)
|
||||
ViewState("ComplementoConPUE") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
#Region "V I N C U L A R P A G O"
|
||||
|
||||
|
||||
Protected Sub LnkAgregarPago_Click(sender As Object, e As EventArgs)
|
||||
|
||||
|
||||
MSGComplemento = ""
|
||||
ViculacionConPUE = False
|
||||
ListaComprasPUE.Clear()
|
||||
ComplementoConPUE = ""
|
||||
|
||||
|
||||
Dim ListaComprasPUEInterna As New List(Of Integer)
|
||||
|
||||
|
||||
Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
|
||||
Dim CveComplementoPagoCompra As Integer = gvRow.DataKey("CveComplementoPagoCompra").ToString.ToEntero
|
||||
|
||||
@@ -2567,9 +2639,10 @@ Partial Class Compras_eFacturas
|
||||
Dim DiferenciaImportes As Double = 0
|
||||
Dim TextoDiferenciaImporte As String = ""
|
||||
Dim FechaPago As Date
|
||||
Dim PagosCantidad As Integer = 0
|
||||
Dim MSGComplemento As String = ""
|
||||
|
||||
Dim PagosCantidad As Integer = 0
|
||||
|
||||
|
||||
|
||||
Dim XMLDoc As New XmlDocument
|
||||
Dim Archivo As String = String.Format("{0}Empresas\{1}\Compras\{2}\{3}", AppDomain.CurrentDomain.BaseDirectory, UsuarioActual.CveEmpresa, gvRow.DataKey("RFCDe"), gvRow.DataKey("XML"))
|
||||
If IO.File.Exists(Archivo) Then
|
||||
@@ -2724,9 +2797,12 @@ Partial Class Compras_eFacturas
|
||||
For Each dRow2 As DataRow In DTDocumentosRelacionados.Rows
|
||||
If dRow2("CveMetodoPago").ToString.ToEntero > 0 Then
|
||||
If dRow2("CveMetodoPago").ToString.ToEntero = 1 Then
|
||||
|
||||
MSGComplemento = MSGComplemento & $" Compra {dRow2("SerieFolioCompra").ToString } bloqueado Tipo ""PUE"". "
|
||||
|
||||
ListaComprasPUEInterna.Add(dRow2("CveCompra").ToString.ToEntero)
|
||||
|
||||
ComplementoConPUE = $"{SeriePago}-{FolioPago}"
|
||||
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
@@ -2776,8 +2852,10 @@ Partial Class Compras_eFacturas
|
||||
|
||||
Next
|
||||
|
||||
If MSGComplemento.Trim.Length > 0 Then
|
||||
BtnVincularPago.Visible = False
|
||||
If MSGComplemento.Trim.Length > 0 Then
|
||||
|
||||
' BtnVincularPago.Visible = False
|
||||
ViculacionConPUE = True
|
||||
End If
|
||||
|
||||
|
||||
@@ -2820,8 +2898,11 @@ Partial Class Compras_eFacturas
|
||||
|
||||
|
||||
GvVincularPago.DataBind()
|
||||
UpVincularPago.Update()
|
||||
|
||||
UpVincularPago.Update()
|
||||
|
||||
|
||||
ListaComprasPUE = ListaComprasPUEInterna
|
||||
|
||||
RegistraScript("$('#ModalVincularPago').modal('show')", "VincularPagoModalShow")
|
||||
End Sub
|
||||
|
||||
@@ -2858,14 +2939,30 @@ Partial Class Compras_eFacturas
|
||||
TieneError = True
|
||||
End If
|
||||
|
||||
If Not TieneError Then
|
||||
|
||||
|
||||
If Not TieneError Then
|
||||
|
||||
Dim objEventos As New ClsOIEventos(ObjCompra.IniciaTransacSQL)
|
||||
|
||||
If ViculacionConPUE Then
|
||||
|
||||
|
||||
|
||||
|
||||
For Each CveCompraVinculada In ListaComprasPUE
|
||||
|
||||
objEventos.AddEventoBitacora($"Complemento { ComplementoConPUE } vinculado manualmente (Compra PUE) ", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCompra:=CveCompraVinculada)
|
||||
Next
|
||||
|
||||
|
||||
|
||||
End If
|
||||
|
||||
|
||||
ObjCompra.Commit()
|
||||
|
||||
Alert("El pago fue vinculado correctamente", TipoMensaje.MsgInformacion)
|
||||
RegistraScript("$('#ModalVincularPago').modal('hide')", "VincularPagoModalHide")
|
||||
CargaDatos()
|
||||
RegistraScript("$('#ModalVincularPago').modal('hide')", "VincularPagoModalHide")
|
||||
CargaDatos()
|
||||
Else
|
||||
ObjCompra.RollBack()
|
||||
Alert("Ocurrió un error al vincular el pago. Por favor verifique y vuelva a intentar", TipoMensaje.MsgError)
|
||||
|
||||
@@ -151,6 +151,7 @@
|
||||
<td width="60px" align="center">Número</td>
|
||||
<td width="300px" align="left">Concepto</td>
|
||||
<td width="100px" align="center">Referencia</td>
|
||||
<td width="100px" align="center">SubProyecto</td>
|
||||
<td width="100px" align="center">Cargos</td>
|
||||
<td width="100px" align="center">Abonos</td>
|
||||
<td width="100px" align="center">Saldo</td>
|
||||
@@ -194,6 +195,9 @@
|
||||
<td width="100px">
|
||||
<asp:Label ID="LbReferencia" runat="server" Text='<%# Eval("Referencia")%>'></asp:Label>
|
||||
</td>
|
||||
<td width="100px">
|
||||
<asp:Label ID="LblSubProyecto" runat="server" Text='<%# Eval("SubProyecto")%>'></asp:Label>
|
||||
</td>
|
||||
<td width="100px" align="right">
|
||||
<asp:Label ID="LbCargos" runat="server"></asp:Label>
|
||||
</td>
|
||||
|
||||
@@ -15,11 +15,14 @@
|
||||
<Width>1.49458cm</Width>
|
||||
</TablixColumn>
|
||||
<TablixColumn>
|
||||
<Width>7.13431cm</Width>
|
||||
<Width>4.81952cm</Width>
|
||||
</TablixColumn>
|
||||
<TablixColumn>
|
||||
<Width>1.99729cm</Width>
|
||||
</TablixColumn>
|
||||
<TablixColumn>
|
||||
<Width>2.3148cm</Width>
|
||||
</TablixColumn>
|
||||
<TablixColumn>
|
||||
<Width>2.10313cm</Width>
|
||||
</TablixColumn>
|
||||
@@ -149,11 +152,12 @@
|
||||
<PaddingBottom>2pt</PaddingBottom>
|
||||
</Style>
|
||||
</Textbox>
|
||||
<ColSpan>3</ColSpan>
|
||||
<ColSpan>4</ColSpan>
|
||||
</CellContents>
|
||||
</TablixCell>
|
||||
<TablixCell />
|
||||
<TablixCell />
|
||||
<TablixCell />
|
||||
<TablixCell>
|
||||
<CellContents>
|
||||
<Textbox Name="Textbox22">
|
||||
@@ -387,6 +391,44 @@
|
||||
</Textbox>
|
||||
</CellContents>
|
||||
</TablixCell>
|
||||
<TablixCell>
|
||||
<CellContents>
|
||||
<Textbox Name="Textbox2">
|
||||
<CanGrow>true</CanGrow>
|
||||
<KeepTogether>true</KeepTogether>
|
||||
<Paragraphs>
|
||||
<Paragraph>
|
||||
<TextRuns>
|
||||
<TextRun>
|
||||
<Value>Subproyecto</Value>
|
||||
<Style>
|
||||
<FontFamily>Verdana</FontFamily>
|
||||
<FontSize>8pt</FontSize>
|
||||
<FontWeight>Bold</FontWeight>
|
||||
</Style>
|
||||
</TextRun>
|
||||
</TextRuns>
|
||||
<Style />
|
||||
</Paragraph>
|
||||
</Paragraphs>
|
||||
<rd:DefaultName>Textbox2</rd:DefaultName>
|
||||
<Style>
|
||||
<Border>
|
||||
<Style>None</Style>
|
||||
</Border>
|
||||
<BottomBorder>
|
||||
<Color>Black</Color>
|
||||
<Style>Solid</Style>
|
||||
<Width>1pt</Width>
|
||||
</BottomBorder>
|
||||
<PaddingLeft>2pt</PaddingLeft>
|
||||
<PaddingRight>2pt</PaddingRight>
|
||||
<PaddingTop>2pt</PaddingTop>
|
||||
<PaddingBottom>2pt</PaddingBottom>
|
||||
</Style>
|
||||
</Textbox>
|
||||
</CellContents>
|
||||
</TablixCell>
|
||||
<TablixCell>
|
||||
<CellContents>
|
||||
<Textbox Name="Textbox17">
|
||||
@@ -605,10 +647,11 @@
|
||||
<PaddingBottom>2pt</PaddingBottom>
|
||||
</Style>
|
||||
</Textbox>
|
||||
<ColSpan>2</ColSpan>
|
||||
<ColSpan>3</ColSpan>
|
||||
</CellContents>
|
||||
</TablixCell>
|
||||
<TablixCell />
|
||||
<TablixCell />
|
||||
<TablixCell>
|
||||
<CellContents>
|
||||
<Textbox Name="Textbox21">
|
||||
@@ -844,6 +887,38 @@
|
||||
</Textbox>
|
||||
</CellContents>
|
||||
</TablixCell>
|
||||
<TablixCell>
|
||||
<CellContents>
|
||||
<Textbox Name="SubProyecto">
|
||||
<CanGrow>true</CanGrow>
|
||||
<KeepTogether>true</KeepTogether>
|
||||
<Paragraphs>
|
||||
<Paragraph>
|
||||
<TextRuns>
|
||||
<TextRun>
|
||||
<Value>=Fields!SubProyecto.Value</Value>
|
||||
<Style>
|
||||
<FontFamily>Verdana</FontFamily>
|
||||
<FontSize>7pt</FontSize>
|
||||
</Style>
|
||||
</TextRun>
|
||||
</TextRuns>
|
||||
<Style />
|
||||
</Paragraph>
|
||||
</Paragraphs>
|
||||
<rd:DefaultName>SubProyecto</rd:DefaultName>
|
||||
<Style>
|
||||
<Border>
|
||||
<Style>None</Style>
|
||||
</Border>
|
||||
<PaddingLeft>2pt</PaddingLeft>
|
||||
<PaddingRight>2pt</PaddingRight>
|
||||
<PaddingTop>2pt</PaddingTop>
|
||||
<PaddingBottom>2pt</PaddingBottom>
|
||||
</Style>
|
||||
</Textbox>
|
||||
</CellContents>
|
||||
</TablixCell>
|
||||
<TablixCell>
|
||||
<CellContents>
|
||||
<Textbox Name="CargosMovto">
|
||||
@@ -1053,6 +1128,40 @@
|
||||
</TablixCell>
|
||||
<TablixCell />
|
||||
<TablixCell />
|
||||
<TablixCell>
|
||||
<CellContents>
|
||||
<Textbox Name="Textbox12">
|
||||
<CanGrow>true</CanGrow>
|
||||
<KeepTogether>true</KeepTogether>
|
||||
<Paragraphs>
|
||||
<Paragraph>
|
||||
<TextRuns>
|
||||
<TextRun>
|
||||
<Value />
|
||||
<Style>
|
||||
<FontFamily>Verdana</FontFamily>
|
||||
<FontSize>7pt</FontSize>
|
||||
</Style>
|
||||
</TextRun>
|
||||
</TextRuns>
|
||||
<Style>
|
||||
<TextAlign>Right</TextAlign>
|
||||
</Style>
|
||||
</Paragraph>
|
||||
</Paragraphs>
|
||||
<rd:DefaultName>Textbox12</rd:DefaultName>
|
||||
<Style>
|
||||
<Border>
|
||||
<Style>None</Style>
|
||||
</Border>
|
||||
<PaddingLeft>2pt</PaddingLeft>
|
||||
<PaddingRight>2pt</PaddingRight>
|
||||
<PaddingTop>2pt</PaddingTop>
|
||||
<PaddingBottom>2pt</PaddingBottom>
|
||||
</Style>
|
||||
</Textbox>
|
||||
</CellContents>
|
||||
</TablixCell>
|
||||
<TablixCell>
|
||||
<CellContents>
|
||||
<Textbox Name="Cargos">
|
||||
@@ -1172,6 +1281,7 @@
|
||||
<TablixMember />
|
||||
<TablixMember />
|
||||
<TablixMember />
|
||||
<TablixMember />
|
||||
</TablixMembers>
|
||||
</TablixColumnHierarchy>
|
||||
<TablixRowHierarchy>
|
||||
@@ -1208,9 +1318,9 @@
|
||||
</TablixRowHierarchy>
|
||||
<KeepTogether>true</KeepTogether>
|
||||
<DataSetName>DataSet1</DataSetName>
|
||||
<Top>0.06348cm</Top>
|
||||
<Top>0.06346cm</Top>
|
||||
<Height>3cm</Height>
|
||||
<Width>20.37043cm</Width>
|
||||
<Width>20.37044cm</Width>
|
||||
<Style>
|
||||
<Border>
|
||||
<Style>None</Style>
|
||||
@@ -1221,7 +1331,7 @@
|
||||
<Height>1.2061in</Height>
|
||||
<Style />
|
||||
</Body>
|
||||
<Width>8.04763in</Width>
|
||||
<Width>8.01986in</Width>
|
||||
<Page>
|
||||
<PageHeader>
|
||||
<Height>0.81597in</Height>
|
||||
@@ -1360,7 +1470,7 @@
|
||||
</Paragraph>
|
||||
</Paragraphs>
|
||||
<rd:DefaultName>Textbox3</rd:DefaultName>
|
||||
<Top>0.07025cm</Top>
|
||||
<Top>0.07023cm</Top>
|
||||
<Left>15.87314cm</Left>
|
||||
<Height>0.6cm</Height>
|
||||
<Width>4.4973cm</Width>
|
||||
@@ -1463,6 +1573,10 @@
|
||||
<DataField>Saldo</DataField>
|
||||
<rd:TypeName>System.String</rd:TypeName>
|
||||
</Field>
|
||||
<Field Name="SubProyecto">
|
||||
<DataField>SubProyecto</DataField>
|
||||
<rd:TypeName>System.String</rd:TypeName>
|
||||
</Field>
|
||||
</Fields>
|
||||
<rd:DataSetInfo>
|
||||
<rd:DataSetName>DataSet</rd:DataSetName>
|
||||
|
||||
@@ -1,552 +0,0 @@
|
||||
|
||||
Imports System.Data
|
||||
Imports Extensiones
|
||||
Imports System.Xml
|
||||
'Imports msExcel = Microsoft.Office.Interop.Excel
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
Partial Class General_SaldosIniciales
|
||||
Inherits ClsPaginas
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Protected Sub BtnCargaExcel_Click(sender As Object, e As EventArgs) Handles BtnCargaExcel.Click
|
||||
If TxtExcel.getfiles().Archivos.Count > 0 Then
|
||||
Dim file As Archivo = TxtExcel.getfiles().Archivos(0)
|
||||
Dim Directorio As String = AppDomain.CurrentDomain.BaseDirectory & file.patch
|
||||
Dim Tipo As String = If(file.Extencion.Contiene("xlsx", "xlsx", "xlsm", "xlsb"), "EXCEL", "CSV")
|
||||
CargarArchivo(Directorio, file.filename, Tipo)
|
||||
Else
|
||||
Alert("No existe el archivo.Favor de subir un archivo csv o excel a la plataforma", TipoMensaje.MsgError)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargarArchivo(Ruta As String, FileName As String, Tipo As String)
|
||||
Dim dt As New DataTable
|
||||
Dim Conexion As Odbc.OdbcConnection = Nothing
|
||||
Dim ErrorArchivo = False
|
||||
Dim ErrorExcel = False
|
||||
Dim strConnString As String = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" + Ruta + FileName + ";Extended Properties=Excel 8.0;"
|
||||
Dim objDbFactory As Common.DbProviderFactory = Common.DbProviderFactories.GetFactory("System.Data.OleDb")
|
||||
Dim objDbAdapter As Common.DbDataAdapter = objDbFactory.CreateDataAdapter()
|
||||
Dim objDbConnection As Common.DbConnection = objDbFactory.CreateConnection()
|
||||
objDbConnection.ConnectionString = strConnString
|
||||
objDbConnection.Open()
|
||||
Dim objSheetNames As DataTable = objDbConnection.GetSchema("Tables")
|
||||
Dim HojaExcel As String = objSheetNames.FiltroPrimeroValor("TABLE_NAME")
|
||||
Try
|
||||
Select Case Tipo
|
||||
Case "CSV"
|
||||
Conexion = New Odbc.OdbcConnection("Driver={Microsoft Access Text Driver (*.txt, *.csv)};Dbq=" + Ruta + ";Extensions=asc,csv,tab,txt;")
|
||||
Conexion.Open()
|
||||
Dim cmd = Conexion.CreateCommand()
|
||||
cmd.CommandType = CommandType.Text
|
||||
cmd.CommandText = $"SELECT * FROM [{FileName}]"
|
||||
Dim DataAdapter = New Odbc.OdbcDataAdapter(cmd)
|
||||
DataAdapter.Fill(dt)
|
||||
Case "EXCEL"
|
||||
Conexion = New Odbc.OdbcConnection("Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" + Ruta + FileName + ";")
|
||||
Conexion.Open()
|
||||
Dim cmd = Conexion.CreateCommand()
|
||||
cmd.CommandType = CommandType.Text
|
||||
cmd.CommandText = $"SELECT * FROM [{HojaExcel}]"
|
||||
Dim DataAdapter = New Odbc.OdbcDataAdapter(cmd)
|
||||
DataAdapter.Fill(dt)
|
||||
Case Else
|
||||
Alert("El archivo no tiene el formato correcto", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End Select
|
||||
Catch ex As Exception
|
||||
ErrorArchivo = True
|
||||
OnError("Ocurrio un error al leer el archivo <br/>" & ex.Message, ex)
|
||||
End Try
|
||||
Conexion.Close()
|
||||
If Not ErrorArchivo Then
|
||||
If RblFormato.SelectedValue = "1" Or RblFormato.SelectedValue = "2" Then
|
||||
If Not dt.Columns(0).ColumnName = "Codigo" Then
|
||||
Alert("El nombre de la primera columna debe ser 'Codigo'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(1).ColumnName = "RazonSocial" Then
|
||||
Alert("El nombre de la segunda columna debe ser 'Fecha'.Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(2).ColumnName = "RFC" Then
|
||||
Alert("El nombre de la tercera columna debe ser 'RFC'.Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(3).ColumnName = "Calle" Then
|
||||
Alert("El nombre de la cuarta columna debe ser 'Calle'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(4).ColumnName = "Número exterior" Then
|
||||
Alert("El nombre de la quinta columna debe ser 'Número exterior' .Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(5).ColumnName = "Colonia" Then
|
||||
Alert("El nombre de la sexta columna debe ser 'Colonia'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(6).ColumnName = "Código postal" Then
|
||||
Alert("El nombre de la séptima columna debe ser 'Código postal'.Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(7).ColumnName = "Población" Then
|
||||
Alert("El nombre de la octava columna debe ser 'Población'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(8).ColumnName = "Estado" Then
|
||||
Alert("El nombre de la novena columna debe ser 'Estado'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(9).ColumnName = "Teléfono" Then
|
||||
Alert("El nombre de la décima columna debe ser 'Teléfono'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(10).ColumnName = "Contacto" Then
|
||||
Alert("El nombre de la onceava columna debe ser 'Contacto'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(11).ColumnName = "Celular Contacto" Then
|
||||
Alert("El nombre de la doceava columna debe ser 'Celular Contacto'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
ElseIf RblFormato.SelectedValue = "3" Or RblFormato.SelectedValue = "4" Then
|
||||
If Not dt.Columns(0).ColumnName = "Sucursal" Then
|
||||
Alert("El nombre de la primera columna debe ser 'Sucursal'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If Not dt.Columns(1).ColumnName = "RFC" Then
|
||||
Alert("El nombre de la segunda columna debe ser 'RFC'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If Not dt.Columns(2).ColumnName = "Serie" Then
|
||||
Alert("El nombre de la tercera columna debe ser 'Serie'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If Not dt.Columns(3).ColumnName = "Folio" Then
|
||||
Alert("El nombre de la cuarta columna debe ser 'Folio'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If Not dt.Columns(4).ColumnName = "Fecha" Then
|
||||
Alert("El nombre de la quinta columna debe ser 'Fecha'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(5).ColumnName = "SubTotal" Then
|
||||
Alert("El nombre de la sexta columna debe ser 'SubTotal'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(6).ColumnName = "IVA" Then
|
||||
Alert("El nombre de la séptima columna debe ser 'IVA'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(7).ColumnName = "Total" Then
|
||||
Alert("El nombre de la octava columna debe ser 'Total'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(8).ColumnName = "Saldo" Then
|
||||
Alert("El nombre de la novena columna debe ser 'Saldo'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(9).ColumnName = "Tipo Documento" Then
|
||||
Alert("El nombre de la décima columna debe ser 'Tipo Documento'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
ElseIf RblFormato.SelectedValue = "5" Then
|
||||
|
||||
If Not dt.Columns(0).ColumnName = "Codigo" Then
|
||||
Alert("El nombre de la primera columna debe ser 'Código'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If Not dt.Columns(1).ColumnName = "Descripción" Then
|
||||
Alert("El nombre de la segunda columna debe ser 'Descripcion'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If Not dt.Columns(2).ColumnName = "Marca" Then
|
||||
Alert("El nombre de la tercera columna debe ser 'Serie'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If Not dt.Columns(3).ColumnName = "Código de Barras" Then
|
||||
Alert("El nombre de la cuarta columna debe ser 'Código de Barras'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If Not dt.Columns(4).ColumnName = "Unidad de Medida" Then
|
||||
Alert("El nombre de la quinta columna debe ser 'Unidad de Medida'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(5).ColumnName = "Producto/Servicio" Then
|
||||
Alert("El nombre de la sexta columna debe ser 'Producto/Servicio'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(6).ColumnName = "Clasificación" Then
|
||||
Alert("El nombre de la séptima columna debe ser 'Clasificacion'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(7).ColumnName = "Precio" Then
|
||||
Alert("El nombre de la octava columna debe ser 'Precio'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
End If
|
||||
dt.TableName = "Datos"
|
||||
Dim NumRows As Integer = dt.Rows.Count
|
||||
|
||||
If Not ErrorArchivo Then
|
||||
'P R O V E E D O R E S
|
||||
If RblFormato.SelectedValue = "1" Then
|
||||
Dim ObjProv As New ClsCompProveedores
|
||||
Dim ErrorProv As Boolean = False
|
||||
Dim Contador As Integer = 0
|
||||
Dim ExisteProveedor As Boolean = False
|
||||
|
||||
ObjProv.IniciaTransacSQL()
|
||||
For Each Row As DataRow In dt.Rows
|
||||
Dim Codigo As String = Row("Codigo").ToString
|
||||
Dim RazonSocial As String = Row("RazonSocial").ToString
|
||||
Dim RFC As String = Row("RFC").ToString.Trim
|
||||
Dim Calle As String = Row("Calle").ToString
|
||||
Dim NumExt As Decimal = Row("Número exterior").ToString.ToDecimal
|
||||
Dim Colonia As String = Row("Colonia").ToString
|
||||
Dim CodigoPostal As Decimal = Row("Código Postal").ToString.ToDecimal
|
||||
Dim Poblacion As String = Row("Población").ToString
|
||||
Dim Estado As String = Row("Estado").ToString
|
||||
Dim Telefono As String = Row("Teléfono").ToString
|
||||
Dim Contacto As String = Row("Contacto").ToString
|
||||
Dim CelularContacto As String = Row("Celular Contacto").ToString
|
||||
Dim CveProveedor As Integer = GlobalDTCompProveedores(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveProveedor", $"RFC = '{RFC}'").ToString.ToEntero
|
||||
|
||||
If CveProveedor > 0 Then
|
||||
ExisteProveedor = True
|
||||
Contador = Contador + 1
|
||||
Else
|
||||
If Not ObjProv.AddProveedor(Codigo, RazonSocial, RazonSocial, RazonSocial, RFC, Calle, Telefono,
|
||||
Contacto, "", Telefono, -1, -1, "", 0, 0, 0, -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "",
|
||||
-1, "", -1, "", -1, "", -1, "", -1, "", -1, "", -1, "", 1, -1, "", "", False, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
ErrorProv = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
If Not ErrorProv Then
|
||||
ObjProv.Commit()
|
||||
If ObjProv.GetProveedores(ClsCompProveedores.TipoConsulta.ParaGlobalDT, -1, "-1", "-1", "-1", "-1", "-1", "-1", "-1", 1, -1) Then Application("GlobalDTCompProveedores") = ObjProv.DtResultados
|
||||
If Contador > 0 Then
|
||||
Alert(String.Format("Se agregaron: <b>{0}</b> Proveedores correctamente. <br>Se Omitieron: <b>{1}</b> Clientes ya que ya se encontraban registrados.", NumRows - Contador, Contador), TipoMensaje.MsgInformacion)
|
||||
Else
|
||||
Alert(String.Format("Se agregaron: <b>{0}</b> Proveedores correctamente.", NumRows), TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
TxtExcel.Text = ""
|
||||
UpDatos.Update()
|
||||
Else
|
||||
ObjProv.RollBack()
|
||||
End If
|
||||
ObjProv.Dispose()
|
||||
|
||||
' C L I E N T E S
|
||||
ElseIf RblFormato.SelectedValue = "2" Then
|
||||
Dim ObjClientes As New ClsClientes
|
||||
Dim ErrorClientes As Boolean = False
|
||||
Dim ExisteCliente As Boolean = False
|
||||
Dim Contador As Integer = 0
|
||||
ObjClientes.IniciaTransacSQL()
|
||||
For Each Row As DataRow In dt.FiltraParametros("RFC <> ''").Rows
|
||||
Dim Codigo As String = Row("Codigo").ToString
|
||||
Dim RazonSocial As String = Row("RazonSocial").ToString
|
||||
Dim RFC As String = Row("RFC").ToString.Trim
|
||||
Dim Calle As String = Row("Calle").ToString
|
||||
Dim NumExt As Decimal = Row("Número exterior").ToString.ToDecimal
|
||||
Dim Colonia As String = Row("Colonia").ToString
|
||||
Dim CodigoPostal As Decimal = Row("Código Postal").ToString.ToDecimal
|
||||
Dim Poblacion As String = Row("Población").ToString
|
||||
Dim Estado As String = Row("Estado").ToString
|
||||
Dim Telefono As String = Row("Teléfono").ToString
|
||||
Dim Contacto As String = Row("Contacto").ToString
|
||||
Dim CelularContacto As String = Row("Celular Contacto").ToString
|
||||
Dim CveCliente As Integer = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveCliente", $"RFC = '{RFC}'").ToString.ToEntero
|
||||
|
||||
If CveCliente > 0 Then
|
||||
ExisteCliente = True
|
||||
Contador = Contador + 1
|
||||
Else
|
||||
If Not ObjClientes.AddCliente(RazonSocial, RazonSocial, Calle, "", "", Colonia, "", "", Estado, RFC, CodigoPostal, "", "", Contacto, "", "", "", "", -1, False, 1, -1, -1, False, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", -1, -1, -1,
|
||||
"-1", "-1", "", 0, "", 0, "0", -1, "0", 0, "", 0, "", 0, "", 0, "", "", "", "", 0, "", 1, False, "", "", "", False, "", "", "", "", "", False, "", "", "", False) Then
|
||||
ErrorClientes = True
|
||||
RFC.GuardaLog
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
If Not ErrorClientes Then
|
||||
ObjClientes.Commit()
|
||||
If ObjClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1) Then Application("GlobalDTCliente") = ObjClientes.DtResultados
|
||||
If Contador > 0 Then
|
||||
Alert(String.Format("Se agregaron: <b>{0}</b> Clientes correctamente. <br>Se Omitieron: <b>{1}</b> Clientes ya que ya se encontraban registrados.", NumRows - Contador, Contador), TipoMensaje.MsgInformacion)
|
||||
Else
|
||||
Alert(String.Format("Se agregaron: <b>{0}</b> Clientes correctamente.", NumRows), TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
TxtExcel.Text = ""
|
||||
UpDatos.Update()
|
||||
Else
|
||||
ObjClientes.RollBack()
|
||||
End If
|
||||
ObjClientes.Dispose()
|
||||
|
||||
'P R O V E E D O R E S - F A C T U R A S
|
||||
ElseIf RblFormato.SelectedValue = "3" Then
|
||||
Dim ObjCompras As New ClsCompras
|
||||
Dim ErrorCompras As Boolean = False
|
||||
Dim ObjConta As New ClsContabilidad(ObjCompras.IniciaTransacSQL())
|
||||
Dim CveCompra As Integer
|
||||
Dim Contador As Integer = 0
|
||||
Dim ExisteCompra As Boolean = False
|
||||
Dim DtProveedores = New DataTable
|
||||
DtProveedores = GlobalDTCompProveedores(UsuarioActual.CveEmpresa)
|
||||
|
||||
For Each Row As DataRow In dt.Rows
|
||||
Dim Sucursal As String = Row("Sucursal").ToString
|
||||
Dim RFC As String = Row("RFC").ToString.Trim
|
||||
Dim Serie As String = Row("Serie").ToString
|
||||
Dim Folio As Integer = Row("Folio").ToString.ToEntero
|
||||
Dim Fecha As Date = Row("Fecha").ToString.ToDate
|
||||
Dim SubTotal As Double = Row("SubTotal").ToString.ToDouble
|
||||
Dim IVA As Double = Row("IVA").ToString.ToDouble
|
||||
Dim Total As Double = Row("Total").ToString.ToDouble
|
||||
Dim Saldo As Double = Row("Saldo").ToString.ToDouble
|
||||
Dim TipoDocto As String = Row("Tipo Documento").ToString
|
||||
Dim CveProveedor As Integer = DtProveedores.FiltroPrimeroValor("CveProveedor", $"RFC = '{RFC}'").ToString.ToEntero
|
||||
Dim CvePS As Integer = GlobalDTProductosServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePS").ToString.ToEntero
|
||||
Dim CveUnidadMedida As Integer = GlobalDTProductosServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveUnidadMedida").ToString.ToEntero
|
||||
|
||||
If Not CvePS > 0 Then Alert(String.Format("No se encontró el Producto Servicio"), TipoMensaje.MsgError) : ErrorCompras = True
|
||||
If Not CveUnidadMedida > 0 Then Alert(String.Format("No se encontró la Unidad de Medida."), TipoMensaje.MsgError) : ErrorCompras = True
|
||||
If Not CveProveedor > 0 Then Alert(String.Format("No se encontró el Proveedor con el RFC: {0}", {RFC}), TipoMensaje.MsgError) : ErrorCompras = True : Exit For
|
||||
TipoDocto = IIf(TipoDocto = "Ingresos", "Fac", "NC")
|
||||
|
||||
'PrePóliza
|
||||
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Compras/SaldoInicial", 1, Total, Total, 1, Fecha, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
If Not CvePrePoliza > 0 Then ErrorCompras = True : Exit For
|
||||
|
||||
'Compra
|
||||
If Not ObjCompras.AddCompra(TipoDocto, "", Serie, Folio, Folio, CveProveedor.ToEntero, SubTotal, 0, 0, IVA, 0, 0, 0, 0, 0, Total, Fecha, 1, 1, "-1".ToDate,
|
||||
True, "", 1, CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
ErrorCompras = True
|
||||
Exit For
|
||||
End If
|
||||
CveCompra = ObjCompras.CveCompra
|
||||
|
||||
'Compra Detalle
|
||||
If Not ObjCompras.AddCompraDetalle(CveCompra, CveUnidadMedida, CvePS, -1, -1, 0, 1, SubTotal, 0.16, SubTotal, 0, "Carga Inicial", -1) Then
|
||||
ErrorCompras = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
'PrePólizaDetalle
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Total, Folio, IIf(TipoDocto = "Fac", 5, 18), String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor) Then ErrorCompras = True : Exit For
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, SubTotal, Folio, 6, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor) Then ErrorCompras = True : Exit For
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, IVA, Folio, 14, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor) Then ErrorCompras = True : Exit For
|
||||
|
||||
'Saldo
|
||||
If Saldo < Total Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Total - Saldo, Folio, 17, Folio, Fecha, -1, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor) Then ErrorCompras = True : Exit For
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Total - Saldo, Folio, 95, Folio, Fecha, -1, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor) Then ErrorCompras = True : Exit For
|
||||
End If
|
||||
|
||||
|
||||
Next
|
||||
If Not ErrorCompras Then
|
||||
If Contador > 0 Then
|
||||
Alert(String.Format("Se agregaron: <b>{0}</b> Compras correctamente.<br>Se Omitieron: <b>{1}</b> Compras ya que ya se encuentran registradas.", NumRows - Contador, Contador), TipoMensaje.MsgInformacion)
|
||||
Else
|
||||
Alert(String.Format("Se agregaron: <b>{0}</b> Compras correctamente.", NumRows), TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
Alert(String.Format("Se agregaron: <b>{0}</b> Compras correctamente.", NumRows), TipoMensaje.MsgInformacion)
|
||||
ObjCompras.Commit()
|
||||
TxtExcel.Text = ""
|
||||
UpDatos.Update()
|
||||
Else
|
||||
ObjCompras.RollBack()
|
||||
End If
|
||||
ObjCompras.Dispose()
|
||||
|
||||
'C L I E N T E S - F A C T U R A S
|
||||
ElseIf RblFormato.SelectedValue = "4" Then
|
||||
Dim ObjVentas As New ClsVentas
|
||||
Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL())
|
||||
Dim ErrorVentas As Boolean = False
|
||||
Dim CveVenta As Integer
|
||||
Dim DtClientes = New DataTable
|
||||
' Dim ExisteVenta As Boolean = False
|
||||
'Dim Contador As Integer = 0
|
||||
DtClientes = GlobalDTCliente(UsuarioActual.CveEmpresa)
|
||||
|
||||
Dim CveSucursal As Integer = GlobalDTSucursales(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSucursal").ToString.ToEntero
|
||||
Dim CvePS As Integer = GlobalDTProductosServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePS").ToString.ToEntero
|
||||
Dim CveUnidadMedida As Integer = GlobalDTProductosServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveUnidadMedida").ToString.ToEntero
|
||||
|
||||
If Not CvePS > 0 Then Alert(String.Format("No se encontró el Producto Servicio"), TipoMensaje.MsgError) : ErrorVentas = True
|
||||
If Not CveSucursal > 0 Then Alert("No se encontró la sucursal.", TipoMensaje.MsgError) : ErrorVentas = True
|
||||
If Not CveUnidadMedida > 0 Then Alert(String.Format("No se encontró la Unidad de Medida."), TipoMensaje.MsgError) : ErrorVentas = True
|
||||
|
||||
For Each Row As DataRow In dt.Rows
|
||||
Dim Sucursal As String = Row("Sucursal").ToString
|
||||
Dim TipoDocto As String = Row("Tipo Documento").ToString
|
||||
Dim RFC As String = Row("RFC").ToString.Trim
|
||||
Dim Serie As String = Row("Serie").ToString
|
||||
Dim Folio As Integer = Row("Folio").ToString.ToEntero
|
||||
Dim Fecha As Date = Row("Fecha").ToString.ToDate
|
||||
Dim SubTotal As Double = Row("SubTotal").ToString.ToDouble
|
||||
Dim IVA As Double = Row("IVA").ToString.ToDouble
|
||||
Dim Total As Double = Row("Total").ToString.ToDouble
|
||||
Dim Saldo As Double = Row("Saldo").ToString.ToDouble
|
||||
Dim CveCliente As Integer = DtClientes.FiltroPrimeroValor("CveCliente", $"RFC = '{RFC}'").ToString.ToEntero
|
||||
|
||||
If Not CveCliente > 0 Then Alert(String.Format("No se encontró el cliente con el RFC: {0}", {RFC}), TipoMensaje.MsgError) : ErrorVentas = True : RFC.GuardaLog : Exit For
|
||||
TipoDocto = IIf(TipoDocto = "Ingresos", "Ing", "Egs")
|
||||
'PrePóliza
|
||||
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Venta/SaldoIncial", 1, Total, Total, 1, Fecha, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
If Not CvePrePoliza > 0 Then ErrorVentas = True : Exit For
|
||||
|
||||
'Venta
|
||||
If Not ObjVentas.AddVenta(TipoDocto, Folio, CveCliente.ToEntero, -1, SubTotal, 0, 0, IVA, 0, 0, Total, 1, 1,
|
||||
0, 0, 0, Fecha, Fecha, "", "", Fecha, 0, CveSucursal, CveSucursal, "", "", "", 0, 0, 0, "-1".ToDate, "-1".ToDate, "-1".ToDate, -1, -1, 0, CvePrePoliza,
|
||||
UsuarioActual.CveUsuario, CveSucursal, UsuarioActual.CveEmpresa, Serie:=Serie) Then
|
||||
ErrorVentas = True
|
||||
Exit For
|
||||
End If
|
||||
CveVenta = ObjVentas.CveVenta
|
||||
|
||||
If Not ObjVentas.AddVentaDetalle(CveVenta, CvePS, 1, CveUnidadMedida, SubTotal, 0.16, SubTotal, "Saldo Inicial", 0, 0, -1, 0) Then
|
||||
ErrorVentas = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
|
||||
'PrePólizaDetalle
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, SubTotal, Folio, 4, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveClasificacion:=1) Then ErrorVentas = True : Exit For
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Total, Folio, 1, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente) Then ErrorVentas = True : Exit For
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, IVA, Folio, 13, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente) Then ErrorVentas = True : Exit For
|
||||
|
||||
'Saldo
|
||||
If Saldo < Total Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Total - Saldo, Folio, 2, Folio, Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente) Then ErrorVentas = True : Exit For
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Total - Saldo, Folio, 95, Folio, Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente) Then ErrorVentas = True : Exit For
|
||||
End If
|
||||
|
||||
Next
|
||||
If Not ErrorVentas Then
|
||||
Alert(String.Format("Se agregaron: <b>{0}</b> Ventas correctamente.", NumRows), TipoMensaje.MsgInformacion)
|
||||
ObjVentas.Commit()
|
||||
TxtExcel.Text = ""
|
||||
UpDatos.Update()
|
||||
Else
|
||||
ObjVentas.RollBack()
|
||||
End If
|
||||
ObjVentas.Dispose()
|
||||
|
||||
|
||||
'P R O D U C T O S / S E R V I C I O S
|
||||
ElseIf RblFormato.SelectedValue = "5" Then
|
||||
Dim ObjPS As New ClsProductosServicios
|
||||
Dim ErrorPS As Boolean = False
|
||||
Dim ExistePS As Boolean = False
|
||||
Dim Contador As Integer = 0
|
||||
' ObjPS.IniciaTransacSQL()
|
||||
|
||||
For Each Row As DataRow In dt.Rows
|
||||
Dim Codigo As String = Row("Codigo").ToString
|
||||
Dim Descripcion As String = Row("Descripcion").ToString
|
||||
Dim TipoPS As String = Row("Tipo").ToString.Trim
|
||||
Dim CodigoBarras As String = Row("Código Barras").ToString
|
||||
Dim UnidadMedida As String = Row("Unidad Medida").ToString
|
||||
Dim Clasificacion As String = Row("Clasificacion").ToString
|
||||
Dim Marca As Decimal = Row("Marca").ToString.ToDecimal
|
||||
Dim AplicaSerie As String = Row("AplicaSerie").ToString
|
||||
Dim Precio As String = Row("Precio").ToString
|
||||
Dim IEPS As String = Row("IEPS").ToString
|
||||
Dim CvePS As Integer = GlobalDTProductosServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePS", $"Codigo = '{Codigo}'").ToString.ToEntero
|
||||
|
||||
If CvePS > 0 Then
|
||||
ExistePS = True
|
||||
Contador = Contador + 1
|
||||
Else
|
||||
If Not ObjPS.AddPS(1, 1, 1, Codigo, "", "", Descripcion, Precio, 0, 0, False, True, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1, 1) Then
|
||||
ErrorPS = True
|
||||
Codigo.GuardaLog
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
If Not ErrorPS Then
|
||||
'ObjPS.Commit()
|
||||
If ObjPS.GetPS(-1, -1, -1) Then Application("GlobalDTProductosServicios") = ObjPS.DtResultados.AsEnumerable()
|
||||
If Contador > 0 Then
|
||||
Alert(String.Format("Se agregaron: <b>{0}</b> Productos/Servicios correctamente. <br>Se Omitieron: <b>{1}</b> Productos/Servicios ya que ya se encontraban registrados.", NumRows - Contador, Contador), TipoMensaje.MsgInformacion)
|
||||
Else
|
||||
Alert(String.Format("Se agregaron: <b>{0}</b> Productos/Servicios correctamente.", NumRows), TipoMensaje.MsgInformacion)
|
||||
End If
|
||||
TxtExcel.Text = ""
|
||||
UpDatos.Update()
|
||||
Else
|
||||
'ObjPS.RollBack()
|
||||
End If
|
||||
ObjPS.Dispose()
|
||||
|
||||
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Protected Sub BtnDescargar_Click(sender As Object, e As EventArgs) Handles BtnDescargar.Click
|
||||
Dim Directorio As String = ""
|
||||
If RblFormato.SelectedValue = "1" Then
|
||||
Directorio = AppDomain.CurrentDomain.BaseDirectory & "Empresas\Grales\SaldosIniciales\FormatoProveedores.xlsx"
|
||||
ElseIf RblFormato.SelectedValue = "2" Then
|
||||
Directorio = AppDomain.CurrentDomain.BaseDirectory & "Empresas\Grales\SaldosIniciales\FormatoClientes.xlsx"
|
||||
ElseIf RblFormato.SelectedValue = "3" Then
|
||||
Directorio = AppDomain.CurrentDomain.BaseDirectory & "Empresas\Grales\SaldosIniciales\FormatoProveedores-Facturas.xlsx"
|
||||
ElseIf RblFormato.SelectedValue = "4" Then
|
||||
Directorio = AppDomain.CurrentDomain.BaseDirectory & "Empresas\Grales\SaldosIniciales\FormatoClientes-Facturas.xlsx"
|
||||
End If
|
||||
|
||||
Dim Archivo As New IO.FileInfo(Directorio)
|
||||
If Archivo.Exists Then
|
||||
Response.Clear()
|
||||
Response.ClearHeaders()
|
||||
Response.ClearContent()
|
||||
Response.AddHeader("Content-Disposition", "attachment; filename=" + Archivo.Name)
|
||||
Response.AddHeader("Content-Length", Archivo.Length.ToString())
|
||||
Response.ContentType = "text/plain"
|
||||
Response.Flush()
|
||||
Response.TransmitFile(Archivo.FullName)
|
||||
Response.End()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
@@ -681,7 +681,7 @@ Partial Class General_SaldosIniciales
|
||||
|
||||
Dim CveTipoPS As Integer = If(TipoPS.ToUpper = "PRODUCTO", 2, 1)
|
||||
Dim CveClasificacion As Integer = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveClasificacion", $"Clasificacion = '{Clasificacion}'").ToString.ToEntero
|
||||
Dim CveUnidadMedida As Integer = GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveUnidadMedida", $"UnidadMedida = '{UnidadMedida}'").ToString.ToEntero
|
||||
Dim CveUnidadMedida As Integer = GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveUnidadMedida", $"UnidadMedida = '{UnidadMedida}' OR Abreviatura = '{UnidadMedida}'").ToString.ToEntero
|
||||
Dim CveSATPS As Integer = GlobalDTPSATPS.FiltroPrimeroValor("CveSATPS", $"SATClavePS = '{SATClavePS}'").ToString.ToEntero
|
||||
Dim CveTamaño As Integer = GlobalDTAcumTamaños.FiltroPrimeroValor("CveTamaño", $"Tamaño = '{Tamaño}' AND CveEmpresa = {UsuarioActual.CveEmpresa}").ToString.ToEntero
|
||||
Dim CveClasificacion2 As Integer = GlobalDTClasificaciones2(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveClasificacion", $"Clasificacion = '{Clasificacion2}'").ToString.ToEntero
|
||||
@@ -816,19 +816,24 @@ Partial Class General_SaldosIniciales
|
||||
End If
|
||||
|
||||
Else
|
||||
If ObjPS.AddPS(CveClasificacion, 1, CveUnidadMedida, Codigo, "", CodigoBarras, Descripcion, Precio, 0, 0, False, 0, False, True, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1, 1,
|
||||
CveTipoPS:=CveTipoPS, CveSATPS:=CveSATPS, CveMarca:=CveMarca, CveTamaño:=CveTamaño, CveMedida:=CveMedida, CveRinTamaño:=CveRinTamaño,
|
||||
CveModelo:=CveModelo, Litraje:=Litraje, IEPSPorcentaje:=IEPS, CveClasificacion2:=CveClasificacion2) <= 0 Then
|
||||
'If ObjPS.AddPS(CveClasificacion, 1, CveUnidadMedida, Codigo, "", "", Descripcion, 0, 0, 0, False, 0, False, True, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1, 1,
|
||||
' CveTipoPS:=CveTipoPS, CveSATPS:=CveSATPS, CveMarca:=CveMarca, CveTamaño:=CveTamaño, CveMedida:=CveMedida) <= 0 Then
|
||||
ErrorPS = True
|
||||
Codigo.GuardaLog
|
||||
Exit For
|
||||
Else
|
||||
If ObjPS.GetPS(-1, -1, UsuarioActual.CveEmpresa) Then
|
||||
DTPS = ObjPS.DtResultados
|
||||
End If
|
||||
End If
|
||||
|
||||
If Codigo.Length > 0 Then
|
||||
|
||||
If ObjPS.AddPS(CveClasificacion, 1, CveUnidadMedida, Codigo, "", CodigoBarras, Descripcion, Precio, 0, 0, False, 0, False, True, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1, 1,
|
||||
CveTipoPS:=CveTipoPS, CveSATPS:=CveSATPS, CveMarca:=CveMarca, CveTamaño:=CveTamaño, CveMedida:=CveMedida, CveRinTamaño:=CveRinTamaño,
|
||||
CveModelo:=CveModelo, Litraje:=Litraje, IEPSPorcentaje:=IEPS, CveClasificacion2:=CveClasificacion2) <= 0 Then
|
||||
'If ObjPS.AddPS(CveClasificacion, 1, CveUnidadMedida, Codigo, "", "", Descripcion, 0, 0, 0, False, 0, False, True, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1, 1,
|
||||
' CveTipoPS:=CveTipoPS, CveSATPS:=CveSATPS, CveMarca:=CveMarca, CveTamaño:=CveTamaño, CveMedida:=CveMedida) <= 0 Then
|
||||
ErrorPS = True
|
||||
Codigo.GuardaLog
|
||||
Exit For
|
||||
Else
|
||||
If ObjPS.GetPS(-1, -1, UsuarioActual.CveEmpresa) Then
|
||||
DTPS = ObjPS.DtResultados
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
|
||||
@@ -3270,6 +3270,9 @@ Partial Class Inventarios_EntradasSalidas
|
||||
Dim ValorInventario As Decimal = 0
|
||||
Dim ValorInventarioME As Decimal = 0
|
||||
|
||||
Dim CvePrePolizaRegistrada As Integer = -1
|
||||
|
||||
|
||||
ObjInventario.GetMovimientos(CveMovimiento, -1, -1, UsuarioActual.CveEmpresa)
|
||||
Dim CveVenta As Integer = ObjInventario.CveVenta
|
||||
Dim MovAlmacen As Boolean = True
|
||||
@@ -3287,6 +3290,7 @@ Partial Class Inventarios_EntradasSalidas
|
||||
If tmpCostos.Rows.Count > 0 Then
|
||||
Dim Concepto As String = If(TxtObservaciones.Text = "", ConceptoPoliza, $" {TxtObservaciones.Text}")
|
||||
Dim CvePrePoliza = ObjConta.AddPrePolizas("Inv_EntradaSalida", 74, DtCostos.SUM("Total"), DtCostos.SUM("Total"), 1, TxtFecha.Text.ToDate, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
CvePrePolizaRegistrada = CvePrePoliza
|
||||
|
||||
If HdnCveOrdenCompra.Value.ToEntero > 0 Then
|
||||
MovAlmacen = False
|
||||
@@ -3362,11 +3366,24 @@ Partial Class Inventarios_EntradasSalidas
|
||||
End If
|
||||
|
||||
If ErrorMovInv = False Then
|
||||
ObjInventario.Commit()
|
||||
ObjInventario.Commit()
|
||||
ObjInventario.Dispose()
|
||||
ObjConta.Dispose()
|
||||
|
||||
If CvePrePolizaRegistrada > 0 Then
|
||||
Response.Redirect($"../Contabilidad/RegPrePoliza.aspx?CvePrePoliza={CvePrePolizaRegistrada}", True)
|
||||
End If
|
||||
|
||||
|
||||
Else
|
||||
|
||||
|
||||
ObjInventario.Dispose()
|
||||
ObjConta.Dispose()
|
||||
|
||||
End If
|
||||
|
||||
ObjInventario.Dispose()
|
||||
ObjConta.Dispose()
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -89,21 +89,30 @@
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="HB" runat="Server">
|
||||
<li>
|
||||
<asp:LinkButton ID="btnFin" runat="server" Text="Finalizar" data-toggle="confirmation" data-popout="true" data-original-title="Finalizar el inventario" data-btn-ok-label="si" />
|
||||
</li>
|
||||
<li>
|
||||
<asp:LinkButton ID="LBAvance" OnClick="LBAvance_Click" runat="server" Text="Ver Avance" Visible="false" />
|
||||
</li>
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkPDF" runat="server"><i class="fa fa-ad-pdf"></i> Imprimir PDF</asp:LinkButton>
|
||||
</li>
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkPDFResumido" runat="server"><i class="fa fa-ad-pdf"></i> Imprimir PDF Resumido</asp:LinkButton>
|
||||
</li>
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkExcel" runat="server"><i class="fa fa-ad-excel"></i> Imprimir EXCEL</asp:LinkButton>
|
||||
</li>
|
||||
<asp:UpdatePanel ID="UpAcciones" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<li>
|
||||
<asp:LinkButton ID="btnFin" runat="server" Text="Finalizar" data-toggle="confirmation" data-popout="true" data-original-title="Finalizar el inventario" data-btn-ok-label="si" />
|
||||
</li>
|
||||
<li>
|
||||
<asp:LinkButton ID="LBAvance" OnClick="LBAvance_Click" runat="server" Text="Ver Avance" Visible="false" />
|
||||
</li>
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkPDF" runat="server"><i class="fa fa-ad-pdf"></i> Imprimir PDF</asp:LinkButton>
|
||||
</li>
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkPDFResumido" runat="server"><i class="fa fa-ad-pdf"></i> Imprimir PDF Resumido</asp:LinkButton>
|
||||
</li>
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkExcel" runat="server"><i class="fa fa-ad-excel"></i> Imprimir EXCEL</asp:LinkButton>
|
||||
</li>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:PostBackTrigger ControlID="LnkPDF" />
|
||||
<asp:PostBackTrigger ControlID="LnkPDFResumido" />
|
||||
<asp:PostBackTrigger ControlID="LnkExcel" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="E" runat="Server">
|
||||
|
||||
@@ -432,8 +432,8 @@ Partial Class Inventarios_InventarioFisicoDetalle
|
||||
Protected Sub Impimir(Optional Formato As String = "PDF", Optional Agrupar As Boolean = False)
|
||||
Dim DtDatos As New DataTable
|
||||
Dim ObjInventario As New ClsInventarios()
|
||||
If ObjInventario.GetInventarioFisicoDetalle(CveInventarioFisico, UsuarioActual.CveUsuario, Agrupar:=Agrupar) Then
|
||||
DtDatos = ObjInventario.DtResultados
|
||||
If ObjInventario.GetInventarioFisicoDetalle(CveInventarioFisico, ddlUsuario.SelectedValue, Agrupar:=Agrupar) Then
|
||||
DtDatos = ObjInventario.DtResultados.Copy
|
||||
End If
|
||||
ObjInventario.Dispose()
|
||||
|
||||
|
||||
@@ -343,11 +343,16 @@ Partial Class Inventarios_Kardex
|
||||
EntradaSalida = " Solo Salidas"
|
||||
End If
|
||||
|
||||
Dim CveTiposAlmacen = ""
|
||||
For Each item As ListItem In CBLTiposAlmacen.Items
|
||||
CveTiposAlmacen += If(item.Selected, $"{item.Value},", "")
|
||||
Next
|
||||
|
||||
Dim Serie As String = If(TxtSerie.Text <> "", TxtSerie.Text, "-1")
|
||||
|
||||
Dim SerieAgrupado As String = If(TxtSerie.Text = "", "", $"<b>Existencia y costos calculada por numero de serie:</b> {TxtSerie.Text} ")
|
||||
|
||||
If Movimientos.GetKardex(Entrada, Salida, CvePS, FechaI, FechaF, CveAlmacen, "1", DdlUnidadMedida.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, ChkAgruparAlmacen.Checked, Serie) Then
|
||||
If Movimientos.GetKardex(Entrada, Salida, CvePS, FechaI, FechaF, CveAlmacen, CveTiposAlmacen.Substring(0, CveTiposAlmacen.Length - 1), DdlUnidadMedida.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, ChkAgruparAlmacen.Checked, Serie) Then
|
||||
|
||||
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
|
||||
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
|
||||
|
||||
@@ -1886,14 +1886,18 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
Dim CveConceptoMovimientoVirtual As Integer = -1
|
||||
Dim CveAlmacenVirtual As Integer = -1
|
||||
Dim CveMovimientoRelacionadoVirtual As Integer = -1
|
||||
Dim ValidaVirtual As Boolean = False
|
||||
|
||||
If TipoMovimiento = 1 Then
|
||||
For Each GvRow As GridViewRow In GvDatos.Rows
|
||||
If GvRow.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
For Each Tam As DataRow In DtTamanios.Rows
|
||||
If Tam("CveTamaño").ToString() = GvRow.DataKey("CveTamaño") Then
|
||||
Dim CvePSCargo = Tam("CvePSCargo").ToString().ToEntero()
|
||||
If GvRow.datakey("CveTamaño").tostring.toentero > 0 Then
|
||||
ValidaVirtual = True ' si tiene tamaño, debe de tener virtual
|
||||
Dim drr As DataRow = DtTamanios.FiltroPrimero(String.Format("CveTamaño={0}", GvRow.DataKey("CveTamaño")))
|
||||
If drr IsNot Nothing Then
|
||||
|
||||
Dim CvePSCargo = drr("CvePSCargo").ToString().ToEntero()
|
||||
Dim Row As DataRow = DtPSVirtual.NewRow()
|
||||
Row("CvePS") = CvePSCargo
|
||||
Row("Cantidad") = GvRow.FCTextBox("TbCantidadF").Text.ToDecimal()
|
||||
@@ -1901,9 +1905,9 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
Row("CveUM") = GvRow.DataKey("CveUM").ToEntero()
|
||||
|
||||
DtPSVirtual.Rows.Add(Row)
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
Next
|
||||
@@ -1911,6 +1915,7 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
CveAlmacenVirtual = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 24).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto={CveSubProyecto}").ToEntero()
|
||||
|
||||
ElseIf TipoMovimiento = 2 Then
|
||||
ValidaVirtual = True
|
||||
Dim CveMovimientoSalidaDev As Integer = -1
|
||||
If ObjInventario.GetInv_Mov(CveVentaSurtir, UsuarioActual.CveEmpresa) Then
|
||||
Dim RowMovimiento As DataRow = ObjInventario.DtResultados.FiltroPrimero("CvePS IS NULL AND CveTipoAlmacen = 24 AND CveConcepto = 3 AND CveVenta > 0")
|
||||
@@ -1919,6 +1924,7 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
CveMovimientoRelacionadoVirtual = CveMovimientoSalidaDev
|
||||
Else
|
||||
ErrorMovInv = True
|
||||
TextoError = "Ocurrió un error al procesar el movimiento. Por favor vuelva a intentar."
|
||||
End If
|
||||
|
||||
'CARGA CONCEPTOS DEVUELTOS EN LA VENTA
|
||||
@@ -1926,6 +1932,7 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
DtPSVirtual = ObjInventario.DtResultados.Copy()
|
||||
Else
|
||||
ErrorMovInv = True
|
||||
TextoError = "Ocurrió un error al procesar los movimientos de devolución. Por favor vuelva a intentar."
|
||||
End If
|
||||
CveConceptoMovimientoVirtual = 18
|
||||
End If
|
||||
@@ -1953,11 +1960,16 @@ Partial Class Inventarios_RecepcionEntrega
|
||||
End If
|
||||
|
||||
Else
|
||||
ErrorMovInv = True
|
||||
If ValidaVirtual Then
|
||||
ErrorMovInv = True
|
||||
TextoError = "Ocurrió un error al procesar el movimiento en almacen virtual. Por favor vuelva a intentar."
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
If DtPSVirtual.Rows.Count = 0 Then
|
||||
If DtPSVirtual.Rows.Count = 0 AndAlso ValidaVirtual = True Then
|
||||
ErrorMovInv = True
|
||||
TextoError = "No se tienen productos para el almacen virtual."
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ Partial Class Inventarios_RepAlmacen
|
||||
DdlTipoAlmacen.DataBind()
|
||||
DdlTipoAlmacen.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
|
||||
DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1)
|
||||
DdlAlmacen.DataBind()
|
||||
DdlAlmacen.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
|
||||
|
||||
@@ -31,6 +31,16 @@
|
||||
Reporte Indice Rotación de Personal
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="HB" Runat="Server">
|
||||
<asp:UpdatePanel ID="UpAcciones" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<li>
|
||||
<asp:LinkButton runat="server" ID="BtnImprimir" OnClick="BtnImprimir_Click" data-toggle="tooltip" data-placement="left" title="Agregar un Defecto" Text="<i class='fa fa-file-pdf-o'></i>Imprimir"></asp:LinkButton>
|
||||
</li>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:PostBackTrigger ControlID="BtnImprimir" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="H" Runat="Server">
|
||||
</asp:Content>
|
||||
|
||||
@@ -3,10 +3,24 @@ Option Explicit On
|
||||
|
||||
Imports Extensiones
|
||||
Imports System.Data
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
|
||||
Partial Class Ventas_RepIndiceRotacionPersonal
|
||||
Inherits ClsPaginas
|
||||
|
||||
Private Property DTGvDatos As DataTable
|
||||
Get
|
||||
If ViewState("DTGvDatos") Is Nothing Then
|
||||
Return New DataTable
|
||||
Else
|
||||
Return DirectCast(ViewState("DTGvDatos"), DataTable)
|
||||
End If
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("DTGvDatos") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Sub Ventas_RepIndiceRotacionPersonal_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
txtInicio.Text = Date.Now.AddDays(-30).ToString("dd/MM/yyyy")
|
||||
@@ -84,7 +98,7 @@ Partial Class Ventas_RepIndiceRotacionPersonal
|
||||
If rh.GetReporteRotacionPersonal(FechaInicio, FechaFin, CveTurno, CveProyecto, CveSubproyecto, UsuarioActual.Empresa.CveEmpresa) Then
|
||||
dTable = rh.DtResultados
|
||||
End If
|
||||
|
||||
DTGvDatos = dTable
|
||||
GVRegDatos.DataSource = dTable
|
||||
GVRegDatos.DataBind()
|
||||
|
||||
@@ -138,4 +152,29 @@ Partial Class Ventas_RepIndiceRotacionPersonal
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnImprimir_Click(sender As Object, e As EventArgs)
|
||||
'"Empresas/Grales/Formatos/ClienteHistorial.rdlc"
|
||||
If GVRegDatos.Rows.Count > 0 Then
|
||||
|
||||
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
|
||||
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
|
||||
|
||||
Dim params As New List(Of ReportParameter)
|
||||
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
|
||||
params.Add(New ReportParameter("FechaInicial", txtInicio.Text))
|
||||
params.Add(New ReportParameter("FechaFinal", txtFin.Text))
|
||||
params.Add(New ReportParameter("FechaRealizado", Date.Now().ToString()))
|
||||
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
|
||||
|
||||
If Imagen.Exists Then
|
||||
params.Add(New ReportParameter("LogoPath", logouri))
|
||||
Else
|
||||
params.Add(New ReportParameter("LogoPath", ""))
|
||||
End If
|
||||
|
||||
ImprimirPDF("Empresas/Grales/Formatos/RepIndiceRotacionPersonal.rdlc", DTGvDatos, params, "Reporte de Historial", "PDF")
|
||||
|
||||
End If
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
@@ -75,11 +75,13 @@ Partial Class Ventas_ActualizarPrecios
|
||||
|
||||
Public Sub CargaPreciosLista()
|
||||
|
||||
DdlPrecioLista.ITEMS.CLEAR
|
||||
DdlPrecioLista.ITEMS.Clear
|
||||
Dim ObjVta As New ClsVentas
|
||||
Dim primerItem As String = ""
|
||||
If ObjVta.GetPrecioListas(UsuarioActual.CveEmpresa) Then
|
||||
DdlPrecioLista.DataSource = ObjVta.DtResultados.Copy()
|
||||
DdlPrecioListaCarga.DataSource = ObjVta.DtResultados.Copy()
|
||||
primerItem = ObjVta.DtResultados.FiltroPrimeroValor("CvePrecioLista")
|
||||
End If
|
||||
ObjVta.Dispose()
|
||||
|
||||
@@ -87,6 +89,10 @@ Partial Class Ventas_ActualizarPrecios
|
||||
DdlPrecioLista.DataBind()
|
||||
DdlPrecioListaCarga.DataBind()
|
||||
|
||||
If (DdlPrecioLista.Items.Count = 1) Then
|
||||
DdlPrecioLista.Items.FindByValue(primerItem).Selected = True
|
||||
End If
|
||||
|
||||
DdlPrecioLista.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
If UsuarioActual.CveEmpresa.Contiene(1, 140) Then
|
||||
DdlPrecioLista.Items.Insert(0, New ListItem("Sin Precio Lista", "-2"))
|
||||
|
||||
198
Ventas/CatCobranzaEstatus.aspx
Normal file
198
Ventas/CatCobranzaEstatus.aspx
Normal file
@@ -0,0 +1,198 @@
|
||||
<%@ Page Title="RH - Catálogo de Documentos" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatCobranzaEstatus.aspx.vb" Inherits="Vta_CatCobranzaEstatus" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
|
||||
Catálogo Cobranza Estatus
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
|
||||
<asp:UpdatePanel ID="UPAcciones" runat="server">
|
||||
<ContentTemplate>
|
||||
<li>
|
||||
<asp:LinkButton ID="BtnAgregarEstatus" runat="server" data-toggle="tooltip" data-placement="left" title="Agregar Estado de Cobranza" Text="<i class='fa fa-plus'></i> Agregar Estatus"></asp:LinkButton>
|
||||
</li>
|
||||
<li>
|
||||
<asp:LinkButton ID="BtnAgregarEstatusTurno" runat="server" data-toggle="tooltip" data-placement="left" title="Agregar Estado de Cobranza" Text="<i class='fa fa-plus'></i> Agregar Turno"></asp:LinkButton>
|
||||
</li>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content6" ContentPlaceHolderID="C" runat="Server">
|
||||
<ajax:TabContainer runat="server" ActiveTabIndex="0" Width="100%" CssClass="tabBodyOverride">
|
||||
<ajax:TabPanel runat="server" ID="TabCatalogo" HeaderText="Estatus">
|
||||
<ContentTemplate>
|
||||
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" DataKeyNames="CveCobranzaEstatus,CobranzaEstatus,Estatus,FechaIng" EmptyDataText="No se encontraron estatus de cobranza" ToolTip="Listado de Motivo de Baja" CssClass="table table-striped table-advance table-hover" Style="margin-top: -10px; text-align: center; width: 100%" GridLines="None">
|
||||
<Columns>
|
||||
<asp:BoundField DataField="CobranzaEstatus" HeaderText="Estatus cobranza" ItemStyle-HorizontalAlign="Left" />
|
||||
<asp:BoundField DataField="Estatus" HeaderText="Estado" ItemStyle-HorizontalAlign="Left" />
|
||||
<asp:TemplateField ItemStyle-HorizontalAlign="Right">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="imgE" runat="server" AlternateText="Editar" CausesValidation="False" OnClick="Edit_Click" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-pencil'></i>" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField ItemStyle-HorizontalAlign="Left">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="imgD" runat="server" AlternateText="Eliminar" CausesValidation="False" CommandName="Delete" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="Confirmar" data-btn-ok-label="si" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</ContentTemplate>
|
||||
</ajax:TabPanel>
|
||||
<ajax:TabPanel runat="server" ID="TabPanel1" HeaderText="Estatus Turno">
|
||||
<ContentTemplate>
|
||||
<asp:UpdatePanel ID="UpDatosTurno" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<asp:GridView ID="GvDatosTurno" runat="server" AutoGenerateColumns="False" DataKeyNames="CveCobranzaEstatusTurno,CobranzaEstatusTurno,Estatus,FechaIng" EmptyDataText="No se encontraron estatus de cobranza" ToolTip="Listado de Motivo de Baja" CssClass="table table-striped table-advance table-hover" Style="margin-top: -10px; text-align: center; width: 100%" GridLines="None">
|
||||
<Columns>
|
||||
<asp:BoundField DataField="CobranzaEstatusTurno" HeaderText="Estatus cobranza turno" ItemStyle-HorizontalAlign="Left" />
|
||||
<asp:BoundField DataField="Estatus" HeaderText="Estado" ItemStyle-HorizontalAlign="Left" />
|
||||
<asp:TemplateField ItemStyle-HorizontalAlign="Right">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="imgETurno" runat="server" AlternateText="Editar" CausesValidation="False" OnClick="EditTurno_Click" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-pencil'></i>" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField ItemStyle-HorizontalAlign="Left">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="imgDTurno" runat="server" AlternateText="Eliminar" CausesValidation="False" CommandName="Delete" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="Confirmar" data-btn-ok-label="si" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</ContentTemplate>
|
||||
</ajax:TabPanel>
|
||||
</ajax:TabContainer>
|
||||
|
||||
<div id="divAddEstatusCobranza" class="modal ADS fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<asp:UpdatePanel ID="UpAddEstatus" class="modal-content" tabindex="-1" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title" id="myModalLabel">Estados de Cobranza</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:TextBox ID="TxtEstatusCobranza" runat="server" CssClass="form-control" CausesValidation="true"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="RFVEstatusCobranza" runat="server" CssClass="help-block errorimput" ControlToValidate="TxtEstatusCobranza" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Estatus''</b> es necesario, por favor ingréselo." ValidationGroup="GrpObligatorio"></asp:RequiredFieldValidator>
|
||||
<label for="<%= TxtEstatusCobranza.ClientID.ToString()%>">Estatus de Cobranza:</label>
|
||||
</div>
|
||||
<br />
|
||||
<div id="CheckActiveSection" runat="server" class="form-group form-md-line-input input-iconright">
|
||||
<label for="ChkEstatus">Estado:</label>
|
||||
<asp:CheckBox ID="ChkEstatus" runat="server" CssClass="make-switchsd" data-size="small" Text=" " Checked="true" />
|
||||
<i></i>
|
||||
</div>
|
||||
<br />
|
||||
<div class="modal-footer">
|
||||
<asp:UpdatePanel ID="UpFooter" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<asp:Button ID="BtnAgregarEstatusCobranza" runat="server" class="btn btn-success" Text="Agregar" />
|
||||
<%--<asp:LinkButton ID="BtnAgregarEstatusOS" runat="server" CssClass="btn btn-primary" ValidationGroup="GrpObligatorio"> <i class='material-icons'>done_all</i> Agregar</asp:LinkButton>--%>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="divAddEstatusCobranzaTurno" class="modal ADS fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<asp:UpdatePanel ID="UpAddEstatusTurno" class="modal-content" tabindex="-1" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
<h4 class="modal-title" id="myModalLabelTurno">Estados de turno de cobranza</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:TextBox ID="TxtEstatusCobranzaTurno" runat="server" CssClass="form-control" CausesValidation="true"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="RFVEstatusCobranzaTurno" runat="server" CssClass="help-block errorimput" ControlToValidate="TxtEstatusCobranzaTurno" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Estatus''</b> es necesario, por favor ingréselo." ValidationGroup="GrpObligatorio"></asp:RequiredFieldValidator>
|
||||
<label for="<%= TxtEstatusCobranzaTurno.ClientID.ToString()%>">Estatus de Cobranza:</label>
|
||||
</div>
|
||||
<br/>
|
||||
<div id="Div1" runat="server" class="form-group form-md-line-input input-iconright">
|
||||
<label for="ChkEstatusTurno">Estado:</label>
|
||||
<asp:CheckBox ID="ChkEstatusTurno" runat="server" CssClass="make-switchsd" data-size="small" Text=" " Checked="true" />
|
||||
<i></i>
|
||||
</div>
|
||||
<br/>
|
||||
<div class="modal-footer">
|
||||
<asp:UpdatePanel ID="UpFooterTurno" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<asp:Button ID="BtnAgregarEstatusCobranzaTurno" runat="server" class="btn btn-success" Text="Agregar" />
|
||||
<%--<asp:LinkButton ID="BtnAgregarEstatusOS" runat="server" CssClass="btn btn-primary" ValidationGroup="GrpObligatorio"> <i class='material-icons'>done_all</i> Agregar</asp:LinkButton>--%>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</div>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
|
||||
<script src="/Metronic/assets/global/scripts/datatable.js"></script>
|
||||
<script src="/Metronic/assets/global/plugins/datatables/all.min.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
function ShowDivRegistro() {
|
||||
$('#divAddImpuestoLocal').modal();
|
||||
}
|
||||
|
||||
function OrdenarGV() {
|
||||
var Tam = TamañoVentana();
|
||||
var Alto = Tam.height - 270;
|
||||
if (Alto < 100) {
|
||||
Alto = 100;
|
||||
}
|
||||
$('#C_GvDatos').DataTable({
|
||||
scrollY: Alto + 'px',
|
||||
scrollCollapse: true,
|
||||
paging: false,
|
||||
searching: false,
|
||||
info: false
|
||||
});
|
||||
$('#C_GvDatos').parent().parent().children().first().css("position", "static");
|
||||
}
|
||||
|
||||
|
||||
function SetObjects(Clasificacion) {
|
||||
debugger;
|
||||
document.getElementById(TxtEstatusOS).value = Clasificacion;
|
||||
}
|
||||
|
||||
function SetValue(Hidden, Value) {
|
||||
document.getElementById(Hidden).value = Value;
|
||||
}
|
||||
|
||||
function LimpiaModal() {
|
||||
<%--$('#<%= TxtEstatusOS.ClientID %>').val('');
|
||||
$('#<%= ChkEstatus.ClientID %>').prop("checked", false);--%>
|
||||
|
||||
var $example = $(".js-Impuesto-programmatic").select2();
|
||||
$example.val('1').trigger("change");
|
||||
}
|
||||
</script>
|
||||
</asp:Content>
|
||||
|
||||
162
Ventas/CatCobranzaEstatus.aspx.vb
Normal file
162
Ventas/CatCobranzaEstatus.aspx.vb
Normal file
@@ -0,0 +1,162 @@
|
||||
Imports System.Data
|
||||
Imports Extensiones
|
||||
|
||||
Partial Class Vta_CatCobranzaEstatus
|
||||
Inherits ClsPaginas
|
||||
|
||||
Private Property CveCobranzaEstatus As Integer
|
||||
Get
|
||||
Return ViewState("CveCobranzaEstatus").ToString.ToEntero
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveCobranzaEstatus") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property CveCobranzaEstatusTurno As Integer
|
||||
Get
|
||||
Return ViewState("CveCobranzaEstatusTurno").ToString.ToEntero
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveCobranzaEstatusTurno") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Sub page_load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
CargaDatos()
|
||||
CargaDatosTurno()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatos()
|
||||
Dim ObjVentas As New ClsVentas
|
||||
If ObjVentas.GetCobranzaEstatus(UsuarioActual.CveEmpresa) Then
|
||||
GvDatos.DataSource = ObjVentas.DtResultados
|
||||
End If
|
||||
ObjVentas.Dispose()
|
||||
GvDatos.DataBind()
|
||||
End Sub
|
||||
|
||||
Public Sub BtnAgregarEstatus_Click(sender As Object, e As EventArgs) Handles BtnAgregarEstatus.Click
|
||||
TxtEstatusCobranza.Text = ""
|
||||
ChkEstatus.Checked = True
|
||||
BtnAgregarEstatusCobranza.Text = "Agregar"
|
||||
UpAddEstatus.Update()
|
||||
RegistraScript(String.Format("$('#{0}').modal();", "divAddEstatusCobranza"))
|
||||
End Sub
|
||||
|
||||
Public Sub Edit_Click(sender As Object, e As EventArgs)
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
CveCobranzaEstatus = GvRow.DataKey("CveCobranzaEstatus").ToEntero
|
||||
TxtEstatusCobranza.Text = GvRow.DataKey("CobranzaEstatus").ToString
|
||||
ChkEstatus.Checked = GvRow.DataKey("Estatus")
|
||||
BtnAgregarEstatusCobranza.Text = "Actualizar"
|
||||
UpAddEstatus.Update()
|
||||
RegistraScript(String.Format("$('#{0}').modal();", "divAddEstatusCobranza"))
|
||||
End Sub
|
||||
|
||||
Public Sub BtnAgregarEstatusCobranza_Click(sender As Object, e As EventArgs) Handles BtnAgregarEstatusCobranza.Click
|
||||
|
||||
Dim ObjVentas As New ClsVentas
|
||||
|
||||
If BtnAgregarEstatusCobranza.Text = "Agregar" Then
|
||||
If ObjVentas.AddCobranzaEstatus(TxtEstatusCobranza.Text, UsuarioActual.CveEmpresa, ChkEstatus.Checked, UsuarioActual.CveUsuario) Then
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddEstatusCobranza"))
|
||||
Alert("Estatus agregado con exito")
|
||||
CargaDatos()
|
||||
UpDatos.Update()
|
||||
Else
|
||||
Alert("Error al agregar")
|
||||
End If
|
||||
Else
|
||||
If ObjVentas.UpdateCobranzaEstatus(CveCobranzaEstatus, TxtEstatusCobranza.Text, ChkEstatus.Checked) Then
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddEstatusCobranza"))
|
||||
Alert("Estatus agregado con exito")
|
||||
CargaDatos()
|
||||
UpDatos.Update()
|
||||
Else
|
||||
Alert("Error al actualizar")
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting
|
||||
Dim ObjVentas As New ClsVentas
|
||||
Dim CveEstatusOrdenServicio As Integer = GvDatos.Rows(e.RowIndex).DataKey("CveCobranzaEstatus").ToEntero
|
||||
|
||||
If ObjVentas.RemoveCobranzaEstatus(CveEstatusOrdenServicio) Then
|
||||
GvDatos.EditIndex = -1
|
||||
CargaDatos()
|
||||
UpDatos.Update()
|
||||
Alert("Estatus de cobranza eliminado")
|
||||
End If
|
||||
ObjVentas.Dispose()
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatosTurno()
|
||||
Dim ObjVentas As New ClsVentas
|
||||
If ObjVentas.GetCobranzaTurnoEstatus(-1, UsuarioActual.CveEmpresa) Then
|
||||
GvDatosTurno.DataSource = ObjVentas.DtResultados
|
||||
End If
|
||||
ObjVentas.Dispose()
|
||||
GvDatosTurno.DataBind()
|
||||
End Sub
|
||||
|
||||
Public Sub BtnAgregarEstatusTurno_Click(sender As Object, e As EventArgs) Handles BtnAgregarEstatusTurno.Click
|
||||
TxtEstatusCobranzaTurno.Text = ""
|
||||
ChkEstatusTurno.Checked = True
|
||||
BtnAgregarEstatusCobranzaTurno.Text = "Agregar"
|
||||
UpAddEstatusTurno.Update()
|
||||
RegistraScript(String.Format("$('#{0}').modal();", "divAddEstatusCobranzaTurno"))
|
||||
End Sub
|
||||
|
||||
Public Sub EditTurno_Click(sender As Object, e As EventArgs)
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
CveCobranzaEstatusTurno = GvRow.DataKey("CveCobranzaEstatusTurno").ToEntero
|
||||
TxtEstatusCobranzaTurno.Text = GvRow.DataKey("CobranzaEstatusTurno").ToString
|
||||
ChkEstatusTurno.Checked = GvRow.DataKey("Estatus")
|
||||
BtnAgregarEstatusCobranzaTurno.Text = "Actualizar"
|
||||
UpAddEstatusTurno.Update()
|
||||
RegistraScript(String.Format("$('#{0}').modal();", "divAddEstatusCobranzaTurno"))
|
||||
End Sub
|
||||
|
||||
Public Sub BtnAgregarEstatusCobranzaTurno_Click(sender As Object, e As EventArgs) Handles BtnAgregarEstatusCobranzaTurno.Click
|
||||
|
||||
Dim ObjVentas As New ClsVentas
|
||||
|
||||
If BtnAgregarEstatusCobranzaTurno.Text = "Agregar" Then
|
||||
If ObjVentas.AddCobranzaEstatusTurno(TxtEstatusCobranzaTurno.Text, UsuarioActual.CveEmpresa, ChkEstatusTurno.Checked, UsuarioActual.CveUsuario) Then
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddEstatusCobranzaTurno"))
|
||||
Alert("Estatus agregado con exito")
|
||||
CargaDatosTurno()
|
||||
UpDatosTurno.Update()
|
||||
Else
|
||||
Alert("Error al agregar")
|
||||
End If
|
||||
Else
|
||||
If ObjVentas.UpdateCobranzaEstatusTurno(CveCobranzaEstatusTurno, TxtEstatusCobranzaTurno.Text, ChkEstatusTurno.Checked) Then
|
||||
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddEstatusCobranzaTurno"))
|
||||
Alert("Estatus agregado con exito")
|
||||
CargaDatosTurno()
|
||||
UpDatosTurno.Update()
|
||||
Else
|
||||
Alert("Error al actualizar")
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub GvDatosTurno_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatosTurno.RowDeleting
|
||||
Dim ObjVentas As New ClsVentas
|
||||
Dim CveEstatusOrdenServicio As Integer = GvDatosTurno.Rows(e.RowIndex).DataKey("CveCobranzaEstatusTurno").ToEntero
|
||||
|
||||
If ObjVentas.RemoveCobranzaEstatusTurno(CveEstatusOrdenServicio) Then
|
||||
GvDatosTurno.EditIndex = -1
|
||||
CargaDatosTurno()
|
||||
UpDatosTurno.Update()
|
||||
Alert("Turno de estatus de cobranza eliminado")
|
||||
End If
|
||||
ObjVentas.Dispose()
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -3902,7 +3902,7 @@ Partial Class Clientes
|
||||
End If
|
||||
|
||||
Try
|
||||
Dim Cuerpo As String = String.Format("Estimado cliente {0}, al presente se correo se anexa su estado actual de cartera en {1}.<br />
|
||||
Dim Cuerpo As String = String.Format("Estimado cliente {0}, al presente del correo se anexa su estado actual de cartera en {1}.<br />
|
||||
<br />
|
||||
Quedamos a sus ordenes para cualquier duda o aclaración con su agente de Ventas.<br />
|
||||
<br />
|
||||
|
||||
@@ -2840,7 +2840,7 @@
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:DropDownList ID="DdlFolioGarantia" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="FolioGarantia" DataValueField="CveFolioGarantia" Width="100%">
|
||||
<asp:DropDownList ID="DdlFolioGarantia" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="FolioGarantia" DataValueField="CveFolioGarantia" Width="100%" AutoPostBack="true">
|
||||
</asp:DropDownList>
|
||||
<asp:RequiredFieldValidator ID="RFVFolioGarantia" runat="server" ControlToValidate="DdlFolioGarantia" InitialValue="-1" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Folio''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddVenta"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCEFolioGarantia" runat="server" HighlightCssClass="vco" TargetControlID="RFVFolioGarantia"></ajax:ValidatorCalloutExtender>
|
||||
|
||||
@@ -5427,6 +5427,16 @@ Partial Class PV
|
||||
RegistraScript("Recalcula();", "Recalcula")
|
||||
End Sub
|
||||
|
||||
Protected Sub DdlFolioGarantia_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlFolioGarantia.SelectedIndexChanged
|
||||
Dim ObjAcumuladores As New ClsAcumuladores
|
||||
If ObjAcumuladores.GetNuevoConsecutivoFolio(DdlFolioGarantia.SelectedValue.ToEntero) Then
|
||||
Dim resultado As String = ObjAcumuladores.DtResultados.FiltroPrimeroValor("NuevoConsecutivo")
|
||||
TxtConsecutivoAjuste.Text = resultado
|
||||
UpAjuste.Update()
|
||||
End If
|
||||
ObjAcumuladores.Dispose()
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "U S A D O S"
|
||||
@@ -5587,9 +5597,8 @@ Partial Class PV
|
||||
|
||||
Dim CveUnidadMedidaPSA As Integer = -1
|
||||
Dim UnidadMedidaPSA As String = "Unidad"
|
||||
Dim CveClacificacionPSA As Integer = -1
|
||||
|
||||
Dim ClacificacionPSA As String = ""
|
||||
Dim CveClasificacionPSA As Integer = -1
|
||||
Dim ClasificacionPSA As String = ""
|
||||
|
||||
Dim CveSubProyectoPSA As Integer = -1
|
||||
Dim SubProyectoPSA As String = ""
|
||||
@@ -5601,8 +5610,8 @@ Partial Class PV
|
||||
DTPSTemp.Columns.Add("Cantidad", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("CveUnidadMedida", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("UnidadMedida", GetType(String))
|
||||
DTPSTemp.Columns.Add("CveClacificacion", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("Clacificacion", GetType(String))
|
||||
DTPSTemp.Columns.Add("CveClasificacion", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("Clasificacion", GetType(String))
|
||||
DTPSTemp.Columns.Add("CvePS", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("PS", GetType(String))
|
||||
DTPSTemp.Columns.Add("PU", GetType(Decimal))
|
||||
@@ -5626,21 +5635,14 @@ Partial Class PV
|
||||
|
||||
If ObjProductosServicios.GetPS(CvePsTemp, -1, UsuarioActual.CveEmpresa) Then
|
||||
CveUnidadMedidaPSA = ObjProductosServicios.CveUnidadMedida
|
||||
CveClacificacionPSA = ObjProductosServicios.CveClasificacion
|
||||
CveClasificacionPSA = ObjProductosServicios.CveClasificacion
|
||||
ClasificacionPSA = ObjProductosServicios.Clasificacion
|
||||
UnidadMedidaPSA = ObjProductosServicios.DtResultados.FiltroPrimeroValor("UnidadMedida")
|
||||
PSPSA = ObjProductosServicios.PS
|
||||
End If
|
||||
|
||||
|
||||
If UsuarioActual.Empresa.UsaAC Then
|
||||
ClacificacionPSA = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion:=If(UsuarioActual.Empresa.UsaContabilidad, CveClacificacionPSA, -1)).FiltroPrimeroValor("Clasificacion", " Codigo = '' OR Codigo IS NULL ", Orderby:="Clasificacion")
|
||||
Else
|
||||
ClacificacionPSA = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion:=If(UsuarioActual.Empresa.UsaContabilidad, CveClacificacionPSA, -1)).FiltroPrimeroValor("Clasificacion", Orderby:="Clasificacion")
|
||||
End If
|
||||
|
||||
Dim Cargo As Decimal = DTTamanios.FiltroPrimeroValor("Cargo", $" CveTamaño = { CveTamanioTemp }").ToDecimal
|
||||
|
||||
|
||||
If DTPSTemp.FiltraParametros($"CvePs = { CvePsTemp }").Rows.Count > 0 Then
|
||||
|
||||
For Each dRowUpdate As DataRow In DTPSTemp.Rows
|
||||
@@ -5660,8 +5662,8 @@ Partial Class PV
|
||||
dRowNuevo("PU") = Cargo
|
||||
dRowNuevo("CveUnidadMedida") = CveUnidadMedidaPSA
|
||||
dRowNuevo("UnidadMedida") = UnidadMedidaPSA
|
||||
dRowNuevo("CveClacificacion") = CveClacificacionPSA
|
||||
dRowNuevo("Clacificacion") = ClacificacionPSA
|
||||
dRowNuevo("CveClasificacion") = CveClasificacionPSA
|
||||
dRowNuevo("Clasificacion") = ClasificacionPSA
|
||||
dRowNuevo("CvePS") = CvePsTemp
|
||||
dRowNuevo("PS") = PSPSA
|
||||
|
||||
@@ -5686,7 +5688,7 @@ Partial Class PV
|
||||
For Each drowPsTamaños As DataRow In DTPSTemp.Rows
|
||||
If drowPsTamaños("PU").ToString.ToDecimal > 0 Then
|
||||
Dim Concec = AgregarProductoServicio(drowPsTamaños("Cantidad").ToString.ToEntero, drowPsTamaños("CveUnidadMedida").ToString.ToEntero, drowPsTamaños("UnidadMedida").ToString,
|
||||
drowPsTamaños("CveClacificacion").ToString.ToEntero, drowPsTamaños("Clacificacion").ToString, drowPsTamaños("CvePS").ToString.ToEntero,
|
||||
drowPsTamaños("CveClasificacion").ToString.ToEntero, drowPsTamaños("Clasificacion").ToString, drowPsTamaños("CvePS").ToString.ToEntero,
|
||||
drowPsTamaños("PS").ToString, "", drowPsTamaños("PU").ToString.ToDecimal, 0, -1, "", drowPsTamaños("CveSubProyecto").ToString.ToEntero,
|
||||
drowPsTamaños("SubProyecto").ToString, EsCargo:=True, ConsecPSPadre:=drowPsTamaños("ConsecPSPadre").ToString.ToEntero)
|
||||
If Consec > 0 Then
|
||||
|
||||
@@ -9,6 +9,7 @@ Imports Microsoft.Reporting.WebForms
|
||||
Imports System.Security.Cryptography.X509Certificates
|
||||
Imports System.Globalization
|
||||
Imports System.Net.Http
|
||||
Imports Newtonsoft.Json.Linq
|
||||
|
||||
Partial Class Ventas
|
||||
Inherits ClsPaginas
|
||||
@@ -5330,6 +5331,11 @@ Partial Class Ventas
|
||||
DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString)
|
||||
End If
|
||||
|
||||
'SI LA VENTA YA ESTA REGISTRADA NO DEBE HABILITAR ACCIONES
|
||||
If CveVenta <= 0 Then
|
||||
LnkRemisiones.Visible = If(UsuarioActual.TienePermisoProceso(199), True, False) : LnkOCs.Visible = True : LnkCotizaciones.Visible = True : LnkPedido2SinFacturar.Visible = True : InicializaAplicarNCMasiva()
|
||||
End If
|
||||
|
||||
UPPVentas.Update()
|
||||
UpEstatus.Update()
|
||||
UPCondicionesPago.Update()
|
||||
@@ -6733,11 +6739,11 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
'ENVIAR POLIZA VIRTUAL
|
||||
If ErrorList.Count = 0 Then
|
||||
If UsuarioActual.Empresa.Funcionalidad(576) = "1" Then
|
||||
GeneraPolizaVentaWS(ObjFactura)
|
||||
End If
|
||||
End If
|
||||
'If ErrorList.Count = 0 Then
|
||||
' If UsuarioActual.Empresa.Funcionalidad(576) = "1" Then
|
||||
' GeneraPolizaVentaWS(ObjFactura)
|
||||
' End If
|
||||
'End If
|
||||
|
||||
If ObjFactura.CveVenta > 0 AndAlso ErrorList.Count = 0 Then
|
||||
|
||||
@@ -15307,7 +15313,6 @@ Partial Class Ventas
|
||||
If UsuarioActual.Empresa.Funcionalidad(575) = "1" Then
|
||||
'Le damos salida normal
|
||||
If ConSalida Then
|
||||
|
||||
GeneroMovimientoAlmacen = GenerarMovimientoAlmacen(ObjInventario, MovDetalle, CveAlmacenSalida, 40, CveMoneda, CveRemision, AplicaMovimientoDetalleEntrada:=AplicaMovimientoDetalleEntrada, MovimientoPrePoliza:=True, ObjConta:=ObjConta) > 0
|
||||
|
||||
If Not GeneroMovimientoAlmacen Then
|
||||
@@ -15317,14 +15322,9 @@ Partial Class Ventas
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(573) = "1" Then
|
||||
If Not GeneroMovimientoAlmacen Then
|
||||
GeneroMovimientoAlmacen = GenerarMovimientoAlmacenVirtual(ObjInventario, ObjFactura) > 0
|
||||
|
||||
If Not GeneroMovimientoAlmacen Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
OcurrioError = Not GenerarMovimientoAlmacenVirtual(CveRemision, ObjInventario, ObjFactura)
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
Else
|
||||
'Le damos salida de apartado por traspaso
|
||||
@@ -15349,12 +15349,7 @@ Partial Class Ventas
|
||||
If ConSalida AndAlso Not OcurrioError Then
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(573) = "1" Then
|
||||
|
||||
GeneroMovimientoAlmacen = GenerarMovimientoAlmacenVirtual(ObjInventario, ObjFactura) > 0
|
||||
|
||||
If Not GeneroMovimientoAlmacen Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
OcurrioError = Not GenerarMovimientoAlmacenVirtual(CveRemision, ObjInventario, ObjFactura)
|
||||
End If
|
||||
|
||||
If Not OcurrioError Then
|
||||
@@ -15610,119 +15605,61 @@ Partial Class Ventas
|
||||
'Return Not OcurrioError
|
||||
|
||||
End Function
|
||||
Private Function GenerarMovimientoAlmacenVirtual(ByRef ObjInventario As ClsInventarios, ObjFactura As Modelos.Factura) As Integer
|
||||
Private Function GenerarMovimientoAlmacenVirtual(CveRemision As Integer, ByRef ObjInventario As ClsInventarios, ObjFactura As Modelos.Factura) As Boolean
|
||||
Dim OcurrioError As Boolean = False
|
||||
Dim CveMovimientoVirtual As Integer = -1
|
||||
|
||||
Dim DtPSVirtual As New DataTable("DtTamanios")
|
||||
DtPSVirtual.Columns.Add(New DataColumn("CvePS", GetType(Integer)))
|
||||
DtPSVirtual.Columns.Add(New DataColumn("Cantidad", GetType(Decimal)))
|
||||
DtPSVirtual.Columns.Add(New DataColumn("PU", GetType(Decimal)))
|
||||
DtPSVirtual.Columns.Add(New DataColumn("CveUM", GetType(Integer)))
|
||||
Try
|
||||
Dim CveMovimientoVirtual As Integer = -1
|
||||
Dim CveAlmacenVirtual As Integer = -1
|
||||
Dim CveConceptoMovimientoVirtual As Integer = 3
|
||||
Dim DtPSVirtual As DataTable = Nothing
|
||||
Dim DtTamanios As DataTable = Nothing
|
||||
Dim CveMovimientoEntradaDev As Integer = -1
|
||||
|
||||
Dim DtTamanios As DataTable = Nothing
|
||||
Dim ObjAcumuladores As New ClsAcumuladores
|
||||
If ObjAcumuladores.TamañoGet(-1, UsuarioActual.CveEmpresa) Then
|
||||
DtTamanios = ObjAcumuladores.DtResultados.Copy()
|
||||
End If
|
||||
ObjAcumuladores.Dispose()
|
||||
If ObjInventario.GetInv_Mov(CveRemision, UsuarioActual.CveEmpresa) Then
|
||||
Dim RowMovimiento As DataRow = ObjInventario.DtResultados.FiltroPrimero("CvePS IS NULL AND CveTipoAlmacen = 24 AND CveConcepto = 2 AND CveVenta > 0")
|
||||
|
||||
Dim CveConceptoMovimientoVirtual As Integer = 3
|
||||
Dim CveAlmacenVirtual As Integer = -1
|
||||
|
||||
For Each GvRow As DataRow In ObjFactura.DtDetalle.Rows
|
||||
For Each Tam As DataRow In DtTamanios.Rows
|
||||
If Tam("CveTamaño").ToString() = GvRow("CveTamaño").ToString() Then
|
||||
Dim CvePSCargo = Tam("CvePSCargo").ToString().ToEntero()
|
||||
Dim Row As DataRow = DtPSVirtual.NewRow()
|
||||
|
||||
Row("CvePS") = CvePSCargo
|
||||
Row("Cantidad") = GvRow("Cantidad").ToString().ToDecimal()
|
||||
Row("PU") = 0
|
||||
Row("CveUM") = GvRow("CveUM").ToString().ToEntero()
|
||||
|
||||
DtPSVirtual.Rows.Add(Row)
|
||||
|
||||
End If
|
||||
Next
|
||||
Next
|
||||
CveAlmacenVirtual = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 24).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto={ObjFactura.CveSubProyecto}").ToEntero()
|
||||
|
||||
If DtPSVirtual IsNot Nothing AndAlso DtPSVirtual.Rows.Count > 0 AndAlso CveAlmacenVirtual > 0 Then
|
||||
CveMovimientoVirtual = ObjInventario.AddMovimiento(CveAlmacenVirtual, CveConceptoMovimientoVirtual, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, ObjFactura.CveVenta, -1, -1, Modulo:="Vta/E")
|
||||
|
||||
If CveMovimientoVirtual > 0 Then
|
||||
For Each RowUsado As DataRow In DtPSVirtual.Rows
|
||||
Dim CvePS = RowUsado("CvePS").ToString().ToEntero()
|
||||
Dim CantidadUsado As Double = RowUsado("Cantidad").ToString().ToDouble()
|
||||
Dim PU As Double = RowUsado("PU").ToString().ToDouble()
|
||||
Dim CveUM As Integer = RowUsado("CveUM").ToString().ToEntero()
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtual, CantidadUsado, CveUM, CvePS, PU, -1) Then
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
CveMovimientoEntradaDev = RowMovimiento("CveMovimiento").ToString().ToEntero()
|
||||
CveAlmacenVirtual = RowMovimiento("CveAlmacen").ToString().ToEntero()
|
||||
Else
|
||||
OcurrioError = True
|
||||
End If
|
||||
|
||||
Else
|
||||
'CARGA CONCEPTOS DEVUELTOS EN LA VENTA
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoEntradaDev, UsuarioActual.CveEmpresa) Then
|
||||
DtPSVirtual = ObjInventario.DtResultados.Copy()
|
||||
Else
|
||||
OcurrioError = True
|
||||
End If
|
||||
|
||||
If Not OcurrioError AndAlso DtPSVirtual.Rows.Count > 0 Then
|
||||
|
||||
CveMovimientoVirtual = ObjInventario.AddMovimiento(CveAlmacenVirtual, CveConceptoMovimientoVirtual, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, ObjFactura.CveVenta, -1, -1, Modulo:="Vta/V")
|
||||
|
||||
If CveMovimientoVirtual > 0 Then
|
||||
For Each RowUsado As DataRow In DtPSVirtual.Rows
|
||||
Dim CvePS = RowUsado("CvePS").ToString().ToEntero()
|
||||
Dim CantidadUsado As Double = RowUsado("Cantidad").ToString().ToDouble()
|
||||
Dim PU As Double = RowUsado("PU").ToString().ToDouble()
|
||||
Dim CveUM As Integer = RowUsado("CveUM").ToString().ToEntero()
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtual, CantidadUsado, CveUM, CvePS, PU, -1) Then
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
OcurrioError = True
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al generar el almacen virtual.", ex)
|
||||
OcurrioError = True
|
||||
End If
|
||||
End Try
|
||||
|
||||
If DtPSVirtual.Rows.Count = 0 Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
|
||||
'Dim ContadorMovtosDetalles = 0
|
||||
|
||||
'Dim DtMovDetalle As DataTable = Nothing
|
||||
'If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then
|
||||
' DtMovDetalle = ObjInventario.DtResultados.Copy()
|
||||
'End If
|
||||
|
||||
''Creamos el movimiento
|
||||
'Dim CveMovimientoInventario As Integer = ObjInventario.AddMovimiento(CveAlmacen, 2, CveMoneda, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, -1, -1, CveMovimientoRelacionado:=CveMovimientoSalida)
|
||||
|
||||
'If CveMovimientoInventario > 0 Then
|
||||
|
||||
' 'Agregamos los detalles
|
||||
' For Each MovDet As DataRow In DtMovDetalle.Rows
|
||||
' Dim Cantidad = MovDet("Cantidad").ToString.ToDecimal
|
||||
' Dim CveUnidad As Integer = MovDet("CveUM").ToString.ToEntero
|
||||
' Dim PU As Decimal = MovDet("PU").ToString.ToDecimal
|
||||
' Dim CveProducto As Integer = MovDet("CvePS").ToString.ToEntero
|
||||
' Dim SerieLote As String = MovDet("SerieLote").ToString
|
||||
|
||||
' If Cantidad < 0 Then
|
||||
' Alert("Ocurrió un Error al generar los movimientos de almacén. Por favor comuniquese con atención SIG.", TipoMensaje.MsgError)
|
||||
' OcurrioError = True
|
||||
' Exit For
|
||||
' End If
|
||||
|
||||
' If ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, -1, SerieLote:=SerieLote) Then
|
||||
' ContadorMovtosDetalles += 1
|
||||
' Else
|
||||
' OcurrioError = True
|
||||
' Exit For
|
||||
' End If
|
||||
' Next
|
||||
|
||||
' 'VALIDA QUE SE HALLAN AGREGADO DETALLES AL MOVIMIENTO
|
||||
' If ContadorMovtosDetalles = 0 Then
|
||||
' OcurrioError = True
|
||||
' End If
|
||||
|
||||
'Else
|
||||
' OcurrioError = True
|
||||
'End If
|
||||
|
||||
If OcurrioError Then
|
||||
Return -1
|
||||
Else
|
||||
Return CveMovimientoVirtual
|
||||
End If
|
||||
Return Not OcurrioError
|
||||
|
||||
End Function
|
||||
Private Function SalidaAlmacenMateriales(ByRef ObjInventario As ClsInventarios, CveOS As Integer, ByRef ObjConta As ClsContabilidad, ConSalida As Boolean, ConceptoMovimiento As Integer) As Boolean
|
||||
@@ -23528,9 +23465,9 @@ Partial Class Ventas
|
||||
|
||||
Dim CveUnidadMedidaPSA As Integer = -1
|
||||
Dim UnidadMedidaPSA As String = "Unidad"
|
||||
Dim CveClacificacionPSA As Integer = -1
|
||||
Dim CveClasificacionPSA As Integer = -1
|
||||
|
||||
Dim ClacificacionPSA As String = ""
|
||||
Dim ClasificacionPSA As String = ""
|
||||
|
||||
Dim CveSubProyectoPSA As Integer = -1
|
||||
Dim SubProyectoPSA As String = ""
|
||||
@@ -23538,12 +23475,12 @@ Partial Class Ventas
|
||||
Dim PSPSA As String = ""
|
||||
|
||||
Dim DTPSTemp As New DataTable '= TmpDT.Clone
|
||||
'AgregarProductoServicio(1, CveUnidadMedidaPSA, UnidadMedidaPSA, CveClacificacionPSA, ClacificacionPSA, CvePSPSA, PSPSA, "", ImporteCargo, 0, -1, "", CveSubProyectoPSA, SubProyectoPSA)
|
||||
|
||||
DTPSTemp.Columns.Add("Cantidad", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("CveUnidadMedida", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("UnidadMedida", GetType(String))
|
||||
DTPSTemp.Columns.Add("CveClacificacion", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("Clacificacion", GetType(String))
|
||||
DTPSTemp.Columns.Add("CveClasificacion", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("Clasificacion", GetType(String))
|
||||
DTPSTemp.Columns.Add("CvePS", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("PS", GetType(String))
|
||||
DTPSTemp.Columns.Add("PU", GetType(Decimal))
|
||||
@@ -23563,20 +23500,16 @@ Partial Class Ventas
|
||||
SubProyectoPSA = DrowPartidas("SubProyecto").ToString
|
||||
|
||||
Dim ObjProductosServicios As New ClsProductosServicios()
|
||||
|
||||
If ObjProductosServicios.GetPS(CvePsTemp, -1, UsuarioActual.CveEmpresa) Then
|
||||
CveUnidadMedidaPSA = ObjProductosServicios.CveUnidadMedida
|
||||
CveClacificacionPSA = ObjProductosServicios.CveClasificacion
|
||||
CveClasificacionPSA = ObjProductosServicios.CveClasificacion
|
||||
ClasificacionPSA = ObjProductosServicios.Clasificacion
|
||||
UnidadMedidaPSA = ObjProductosServicios.DtResultados.FiltroPrimeroValor("UnidadMedida")
|
||||
PSPSA = ObjProductosServicios.PS
|
||||
End If
|
||||
ObjProductosServicios.Dispose()
|
||||
|
||||
If UsuarioActual.Empresa.UsaAC Then
|
||||
ClacificacionPSA = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion:=If(UsuarioActual.Empresa.UsaContabilidad, CveClacificacionPSA, -1)).FiltroPrimeroValor("Clasificacion", " Codigo = '' OR Codigo IS NULL ", Orderby:="Clasificacion")
|
||||
Else
|
||||
ClacificacionPSA = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion:=If(UsuarioActual.Empresa.UsaContabilidad, CveClacificacionPSA, -1)).FiltroPrimeroValor("Clasificacion", Orderby:="Clasificacion")
|
||||
End If
|
||||
|
||||
Dim Cargo As Decimal = DTTamanios.FiltroPrimeroValor("Cargo", $" CveTamaño = { CveTamanioTemp }").ToDecimal
|
||||
|
||||
|
||||
@@ -23599,8 +23532,8 @@ Partial Class Ventas
|
||||
dRowNuevo("PU") = Cargo
|
||||
dRowNuevo("CveUnidadMedida") = CveUnidadMedidaPSA
|
||||
dRowNuevo("UnidadMedida") = UnidadMedidaPSA
|
||||
dRowNuevo("CveClacificacion") = CveClacificacionPSA
|
||||
dRowNuevo("Clacificacion") = ClacificacionPSA
|
||||
dRowNuevo("CveClasificacion") = CveClasificacionPSA
|
||||
dRowNuevo("Clasificacion") = ClasificacionPSA
|
||||
dRowNuevo("CvePS") = CvePsTemp
|
||||
dRowNuevo("PS") = PSPSA
|
||||
|
||||
@@ -23619,7 +23552,7 @@ Partial Class Ventas
|
||||
Modalidad = "A"
|
||||
If drowPsTamaños("PU").ToString.ToDecimal > 0 Then
|
||||
AgregarProductoServicio(drowPsTamaños("Cantidad").ToString.ToEntero, drowPsTamaños("CveUnidadMedida").ToString.ToEntero, drowPsTamaños("UnidadMedida").ToString,
|
||||
drowPsTamaños("CveClacificacion").ToString.ToEntero, drowPsTamaños("Clacificacion").ToString, drowPsTamaños("CvePS").ToString.ToEntero,
|
||||
drowPsTamaños("CveClasificacion").ToString.ToEntero, drowPsTamaños("Clasificacion").ToString, drowPsTamaños("CvePS").ToString.ToEntero,
|
||||
drowPsTamaños("PS").ToString, "", drowPsTamaños("PU").ToString.ToDecimal, 0, -1, "", drowPsTamaños("CveSubProyecto").ToString.ToEntero,
|
||||
drowPsTamaños("SubProyecto").ToString)
|
||||
End If
|
||||
@@ -23812,49 +23745,61 @@ Partial Class Ventas
|
||||
CargaRNC()
|
||||
RegistraScript("$('#ModalAplicarRemisionesNC').modal({backdrop: 'static', keyboard: false });")
|
||||
End Sub
|
||||
Protected Function GeneraPolizaVentaWS(ObjFactura As Modelos.Factura) As Boolean
|
||||
Dim obj As New Modelos.MPolizaVentaWS
|
||||
'DATOS DEL CLIENTE
|
||||
obj.customer_name = ObjFactura.Cliente.Nombre
|
||||
obj.customer_last_name1 = ""
|
||||
obj.customer_last_name2 = ""
|
||||
obj.customer_birthday = Nothing
|
||||
obj.customer_phone = ObjFactura.Cliente.Telefono
|
||||
obj.customer_email = ObjFactura.Cliente.Mail
|
||||
obj.customer_gender = "03" 'OTRO GENERO
|
||||
obj.customer_advertising = False
|
||||
obj.customer_car_brand = "00"
|
||||
obj.customer_car_model = "00"
|
||||
obj.customer_car_year = ObjFactura.Fecha.Year
|
||||
Protected Sub GeneraPolizaVentaWS(ObjFactura As Modelos.Factura)
|
||||
Dim DtUsados As DataTable = Nothing
|
||||
Dim ObjAcum As New ClsAcumuladores
|
||||
If ObjAcum.GetGarantiasDetalle(ObjFactura.CveVenta) Then
|
||||
DtUsados = ObjAcum.DtResultados.Copy()
|
||||
End If
|
||||
ObjAcum.Dispose()
|
||||
|
||||
'DATOS DE VENTA
|
||||
obj.sale_date = Now
|
||||
obj.sale_paidby = "01"
|
||||
obj.sale_type = "01" 'PISO
|
||||
obj.sale_type_service = "01" 'PARTICULAR
|
||||
obj.sale_total = ObjFactura.Total
|
||||
obj.sale_discount = ObjFactura.SubTotal
|
||||
obj.sale_id = ObjFactura.CveVenta.ToString()
|
||||
For Each Row As DataRow In DtUsados.Rows
|
||||
Dim obj As New Modelos.MPolizaVentaWS
|
||||
'DATOS DEL CLIENTE
|
||||
obj.customer_name = ObjFactura.Cliente.Nombre
|
||||
obj.customer_last_name1 = ""
|
||||
obj.customer_last_name2 = ""
|
||||
obj.customer_birthday = Nothing
|
||||
obj.customer_phone = ObjFactura.Cliente.Telefono
|
||||
obj.customer_email = ObjFactura.Cliente.Mail
|
||||
obj.customer_gender = "03" 'OTRO GENERO
|
||||
obj.customer_advertising = False
|
||||
obj.customer_car_brand = "00"
|
||||
obj.customer_car_model = "00"
|
||||
obj.customer_car_year = ObjFactura.Fecha.Year
|
||||
|
||||
'DATOS DEL PRODUCTO
|
||||
obj.product_code = "174925"
|
||||
obj.product_unique_code = "65047187"
|
||||
obj.product_sale_type = "02" 'AJUSTE
|
||||
'DATOS DE VENTA
|
||||
obj.sale_date = ObjFactura.Fecha
|
||||
obj.sale_paidby = "01"
|
||||
obj.sale_type = "01" 'PISO
|
||||
obj.sale_type_service = "02" 'COMERCIAL
|
||||
obj.sale_total = ObjFactura.Total
|
||||
obj.sale_discount = ObjFactura.Descuento
|
||||
obj.sale_id = String.Format("{0}{1}{2}", ObjFactura.Serie, ObjFactura.Folio, ObjFactura.CveVenta)
|
||||
|
||||
'DATOS DE USADO
|
||||
obj.used_product = True
|
||||
obj.used_brand = "01"
|
||||
obj.used_bci = "25"
|
||||
obj.used_month = 1
|
||||
obj.used_year = 2015
|
||||
obj.used_sale_date = ObjFactura.Fecha
|
||||
'DATOS DEL PRODUCTO
|
||||
obj.product_code = Row("Code17").ToString()
|
||||
obj.product_unique_code = "" 'se indique el código único de la batería.
|
||||
obj.product_sale_type = "01 " 'VENTA
|
||||
|
||||
Return False
|
||||
'EnviarPolizaVentaWS(obj)
|
||||
End Function
|
||||
Dim FechaUsado As DateTime = Row("FechaAjuste").ToString().ToDateTime()
|
||||
|
||||
Protected Sub EnviarPolizaVentaWS(obj As Modelos.MPolizaVentaWS)
|
||||
Dim Retorno As String = "[]"
|
||||
'DATOS DE USADO
|
||||
obj.used_product = True
|
||||
obj.used_brand = Row("IdModelo").ToString() 'MARCAR DEL USADO
|
||||
obj.used_bci = Row("CveBCIUsado").ToString() 'VALOR DEL BCI
|
||||
obj.used_month = FechaUsado.Month
|
||||
obj.used_year = FechaUsado.Year
|
||||
obj.used_sale_date = FechaUsado
|
||||
|
||||
EnviarPolizaVentaWS(obj)
|
||||
Next
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Function EnviarPolizaVentaWS(obj As Modelos.MPolizaVentaWS) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
Dim Respuesta As String = "[]"
|
||||
|
||||
Dim User As String = "cslth.2809@jcilink.com"
|
||||
Dim Password As String = "ff31580a95f36b51ad27f970428b77a5a9245076"
|
||||
@@ -23898,14 +23843,30 @@ Partial Class Ventas
|
||||
Dim content As New FormUrlEncodedContent(Parametros)
|
||||
Dim response = wc.PostAsync(Url, content).Result
|
||||
|
||||
Retorno = response.Content.ReadAsStringAsync().Result
|
||||
Respuesta = response.Content.ReadAsStringAsync().Result
|
||||
|
||||
Dim resp = JArray.Parse(Respuesta)
|
||||
|
||||
If resp.Count > 0 Then
|
||||
Dim Msg = resp(0)("Descripcion").ToString()
|
||||
|
||||
If resp(0)("Codigo").ToString().Contiene("500", "501", "502", "503", "504", "505", "506", "507", "508") Then
|
||||
Alert(Msg, TipoMensaje.MsgInformacion)
|
||||
Retorno = True
|
||||
Else
|
||||
Alert(Msg, TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
Else
|
||||
Alert("No se envió la poliza virtual", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
End Using
|
||||
|
||||
Catch ex As Exception
|
||||
ex.GuardaLog(ex.Message)
|
||||
End Try
|
||||
|
||||
|
||||
End Sub
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
End Class
|
||||
Reference in New Issue
Block a user