This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2020-07-23 18:48:41 -07:00
parent 101d25850d
commit 5935719e49
4 changed files with 396 additions and 193 deletions

View File

@@ -1425,6 +1425,93 @@ public partial class Nomina_Nomina2 : ClsPaginas
}
private class NConcepto
{
public string NoConceptoP { get; set; }
public string ConceptoP { get; set; }
public string LabelValorP { get; set; }
public int CveConceptoP { get; set; }
public double ImporteP { get; set; }
public double ValorP { get; set; }
public int EstatusP { get; set; }
public bool isEditedP { get; set; }
public int isOnlyBisibleP { get; set; }
public string NoConceptoD { get; set; }
public string ConceptoD { get; set; }
public string LabelValorD { get; set; }
public int CveConceptoD { get; set; }
public double ImporteD { get; set; }
public double ValorD { get; set; }
public int EstatusD { get; set; }
public bool isEditedD { get; set; }
public int isOnlyBisibleD { get; set; }
}
protected void GvConceptos_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
// Datakeys
// Concepto,CveConcepto,Importe,Estatus,ConceptoD,CveConceptoD,ImporteD,EstatusD
int CveConcepto = e.Row.DataKey("CveConceptoP").ToEntero();
int CveConceptoD = e.Row.DataKey("CveConceptoD").ToEntero();
// Dim Importe As Decimal = e.Row.DataKey("Importe").ToDecimal()
// Dim ImporteD As Decimal = e.Row.DataKey("ImporteD").ToDecimal()
int Estatus = e.Row.DataKey("EstatusP").ToEntero();
int EstatusD = e.Row.DataKey("EstatusD").ToEntero();
int isOnlyBisibleP = e.Row.DataKey("isOnlyBisibleP").ToEntero();
int isOnlyBisibleD = e.Row.DataKey("isOnlyBisibleD").ToEntero();
// Controles
Label LtlConcepto = e.Row.FCLabel("LtlConcepto");
LinkButton LnkConcepto = e.Row.FCLinkButton("LnkConcepto");
Label LtlConceptoD = e.Row.FCLabel("LtlConceptoD");
LinkButton LnkConceptoD = e.Row.FCLinkButton("LnkConceptod");
Label LtlImporte = e.Row.FCLabel("LtlImporte");
LinkButton LnkImporte = e.Row.FCLinkButton("LnkImporte");
Label LtlImporteD = e.Row.FCLabel("LtlImporteD");
LinkButton LnkImporteD = e.Row.FCLinkButton("LnkImporteD");
//isEditedD
if (isOnlyBisibleP == 1)
{
e.Row.CssClass = string.Format("{0} isOnlyBisibleP", e.Row.CssClass);
}
if (isOnlyBisibleD == 1)
{
e.Row.CssClass = string.Format("{0} isOnlyBisibleD", e.Row.CssClass);
}
if (Estatus < -1 | EstatusD < -1)
e.Row.CssClass = "ConceptosTotales";
if (CveConcepto == 0 && (Estatus == 0 || Estatus == -1 || Estatus == -3))
LtlImporte.Text = "";
if (CveConceptoD == 0 && (EstatusD == 0 || EstatusD == -1))
LtlImporteD.Text = "";
if (Estatus == -1)
LtlConcepto.Visible = false;
else if (Estatus > 0)
LtlImporte.Visible = false;
if (EstatusD == -1)
LtlConceptoD.Visible = false;
else if (EstatusD > 0)
LtlImporteD.Visible = false;
LnkConcepto.Visible = !LtlConcepto.Visible;
LnkConceptoD.Visible = !LtlConceptoD.Visible;
LnkImporte.Visible = !LtlImporte.Visible;
LnkImporteD.Visible = !LtlImporteD.Visible;
}
}
#endregion
protected void LnkFormatoTabular_Click(object sender, EventArgs e)
{
try
@@ -1641,93 +1728,6 @@ public partial class Nomina_Nomina2 : ClsPaginas
Alert("Ocurrio un error al generar el Formato de nominas" + ex.ToString());
}
}
private class NConcepto
{
public string NoConceptoP { get; set; }
public string ConceptoP { get; set; }
public string LabelValorP { get; set; }
public int CveConceptoP { get; set; }
public double ImporteP { get; set; }
public double ValorP { get; set; }
public int EstatusP { get; set; }
public bool isEditedP { get; set; }
public int isOnlyBisibleP { get; set; }
public string NoConceptoD { get; set; }
public string ConceptoD { get; set; }
public string LabelValorD { get; set; }
public int CveConceptoD { get; set; }
public double ImporteD { get; set; }
public double ValorD { get; set; }
public int EstatusD { get; set; }
public bool isEditedD { get; set; }
public int isOnlyBisibleD { get; set; }
}
protected void GvConceptos_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
// Datakeys
// Concepto,CveConcepto,Importe,Estatus,ConceptoD,CveConceptoD,ImporteD,EstatusD
int CveConcepto = e.Row.DataKey("CveConceptoP").ToEntero();
int CveConceptoD = e.Row.DataKey("CveConceptoD").ToEntero();
// Dim Importe As Decimal = e.Row.DataKey("Importe").ToDecimal()
// Dim ImporteD As Decimal = e.Row.DataKey("ImporteD").ToDecimal()
int Estatus = e.Row.DataKey("EstatusP").ToEntero();
int EstatusD = e.Row.DataKey("EstatusD").ToEntero();
int isOnlyBisibleP = e.Row.DataKey("isOnlyBisibleP").ToEntero();
int isOnlyBisibleD = e.Row.DataKey("isOnlyBisibleD").ToEntero();
// Controles
Label LtlConcepto = e.Row.FCLabel("LtlConcepto");
LinkButton LnkConcepto = e.Row.FCLinkButton("LnkConcepto");
Label LtlConceptoD = e.Row.FCLabel("LtlConceptoD");
LinkButton LnkConceptoD = e.Row.FCLinkButton("LnkConceptod");
Label LtlImporte = e.Row.FCLabel("LtlImporte");
LinkButton LnkImporte = e.Row.FCLinkButton("LnkImporte");
Label LtlImporteD = e.Row.FCLabel("LtlImporteD");
LinkButton LnkImporteD = e.Row.FCLinkButton("LnkImporteD");
//isEditedD
if (isOnlyBisibleP == 1)
{
e.Row.CssClass = string.Format("{0} isOnlyBisibleP", e.Row.CssClass);
}
if (isOnlyBisibleD == 1)
{
e.Row.CssClass = string.Format("{0} isOnlyBisibleD", e.Row.CssClass);
}
if (Estatus < -1 | EstatusD < -1)
e.Row.CssClass = "ConceptosTotales";
if (CveConcepto == 0 && (Estatus == 0 || Estatus == -1 || Estatus == -3))
LtlImporte.Text = "";
if (CveConceptoD == 0 && (EstatusD == 0 || EstatusD == -1))
LtlImporteD.Text = "";
if (Estatus == -1)
LtlConcepto.Visible = false;
else if (Estatus > 0)
LtlImporte.Visible = false;
if (EstatusD == -1)
LtlConceptoD.Visible = false;
else if (EstatusD > 0)
LtlImporteD.Visible = false;
LnkConcepto.Visible = !LtlConcepto.Visible;
LnkConceptoD.Visible = !LtlConceptoD.Visible;
LnkImporte.Visible = !LtlImporte.Visible;
LnkImporteD.Visible = !LtlImporteD.Visible;
}
}
#endregion
protected void LnkConcepto_Click(object sender, EventArgs e)
{

View File

@@ -10,20 +10,26 @@
Cargas Masivas
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
<li><asp:HyperLink data-toggle="modal" data-target="#DModalCargaexcel" runat="server"><i class="fa fa-ad-excel" style="margin-right:5px"></i> Carga Masiva</asp:HyperLink></li>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="C" runat="Server">
<asp:UpdatePanel ID="UPFiltros" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="portlet solid grey-cascade portlet-filter" style="">
<div class="portlet-title portlet-filterT" style="">
<div class="portlet-body" style="font-size:120%">
<div class="tools">
<asp:Button ID="BtnConsultar" runat="server" Text="Consultar" class="btn btn-primary" />
<a href="javascript:;" class="expand"></a>
<a onclick="document.getElementById('C_BtnConsultar').click();" class="reload"></a>
</div>
<div class="titlefiltros caption " style="font-size: 120%">
<ul class="list-inline">
<li>Cliente:
<%--<li>Cliente:
<asp:Button ID="BtnCargarClientes" runat="server" ClientIDMode="Static" Text="CargarClientes" Style="display: none;" />
<asp:DropDownList ID="DdlCliente" runat="server" AppendDataBoundItems="true" DataTextField="Nombre" DataValueField="CveCliente" Class="table-group-action-input form-control input-inline input-small input-sm" Style="width: 250px !important;">
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
</asp:DropDownList>
</li>
</li>--%>
<li>Proyecto:
<asp:DropDownList ID="DdlProyecto" runat="server" AppendDataBoundItems="true" AutoPostBack="true" DataTextField="Proyecto" DataValueField="CveProyecto" Class="table-group-action-input form-control input-inline input-small input-sm" Style="width: 200px !important;" ValidationGroup="GrpGuardar">
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
@@ -34,26 +40,21 @@
<asp:ListItem Selected="True" Text="Todos" Value="-1"></asp:ListItem>
</asp:DropDownList>
</li>
</ul>
</div>
<div class="tools">
<asp:Button ID="BtnConsultar" runat="server" Text="Consultar" class="btn btn-primary" />
<a href="javascript:;" class="expand"></a>
<a onclick="document.getElementById('C_BtnConsultar').click();" class="reload"></a>
</div>
</div>
<div class="portlet-body" style="display: none;font-size:120%">
<ul class="list-inline">
<li style="width: 297px;">&nbsp;&nbsp;Turno:
<li style="width: 297px;">&nbsp;&nbsp;Turno:
<asp:DropDownList ID="DdlTurno" runat="server" AppendDataBoundItems="true" DataTextField="Turno" DataValueField="CveTurno" Class="table-group-action-input form-control input-inline input-small input-sm" Style="width: 100px !important;" ValidationGroup="GrpGuardar">
<asp:ListItem Selected="True" Text="Todos" Value="-1"></asp:ListItem>
</asp:DropDownList>
</li>
<li>Supervisor:
</li>
</ul>
</div>
</div>
<div class="portlet-body" style="display: none; font-size: 120%">
<ul class="list-inline">
<%--<li>Supervisor:
<asp:DropDownList ID="DdlSupervisor" runat="server" AppendDataBoundItems="true" DataTextField="Nombre" DataValueField="CveUsuario" Class="table-group-action-input form-control input-inline input-small input-sm" Style="width: 200px !important;">
<asp:ListItem Selected="True" Text="Sin Supervisor Asignado" Value="-1"></asp:ListItem>
</asp:DropDownList>
</li>
</li>--%>
</ul>
</div>
</div>
@@ -61,55 +62,56 @@
</asp:UpdatePanel>
<br />
<asp:UpdatePanel ID="UPDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="right">
<ContentTemplate>
<div style="text-align:right">
<asp:Button ID="BtnGuardar" runat="server" Text="Guardar Cambios" ValidationGroup="GrpGuardar" class="btn btn-primary" />
</td>
</tr>
<tr>
<td align="left">
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" DataKeyNames="CvePersonal, CveSubProyecto" EmptyDataText="No se encontraron Ventas con los filtros especificados" ToolTip="Listado de Asistencias" CssClass="table table-striped table-advance table-hover" Style="margin-top: -10px; text-align: center;" GridLines="None">
<br />
<br />
</div>
<asp:GridView ID="GvDatos" runat="server" AutoGenerateColumns="False" DataKeyNames="CvePersonal, CveSubProyecto" EmptyDataText="No se encontraron Ventas con los filtros especificados" ToolTip="Listado de Asistencias"
CssClass="table table-striped table-advance table-hover Widthall" Style="margin-top: -10px; text-align: center;" GridLines="None">
<Columns>
<asp:TemplateField>
<HeaderTemplate>Nombre</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="LtlNombre" runat="server" Text='<%# Eval("Nombre") %>'></asp:Literal>
<asp:Literal ID="LtlNombre" runat="server" Text='<%# String.Format("{0}-{1}", Eval("Codigo"), Eval("Nombre"))%>'></asp:Literal>
</ItemTemplate>
<ItemStyle Width="250px" HorizontalAlign="Left" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Proyecto</HeaderTemplate>
<ItemTemplate>
<asp:DropDownList ID="DdlGVProyecto" runat="server" AutoPostBack="True" DataTextField="Proyecto" DataValueField="CveProyecto" OnSelectedIndexChanged="DdlGVProyecto_SelectedIndexChanged" Class="table-group-action-input form-control input-inline input-small input-sm" Style="width: 190px !important;"></asp:DropDownList>
<asp:Literal runat="server" Text='<%# Eval("Proyecto") %>'></asp:Literal>
<%--<asp:DropDownList ID="DdlGVProyecto" runat="server" AutoPostBack="True" DataTextField="Proyecto" DataValueField="CveProyecto" OnSelectedIndexChanged="DdlGVProyecto_SelectedIndexChanged" Class="table-group-action-input form-control input-inline input-small input-sm" Style="width: 190px !important;"></asp:DropDownList>--%>
</ItemTemplate>
<ItemStyle HorizontalAlign="Left" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Sub Proyecto</HeaderTemplate>
<ItemTemplate>
<asp:DropDownList ID="DdlGVSubProyecto" runat="server" DataTextField="SubProyecto" DataValueField="CveSubProyecto" Class="table-group-action-input form-control input-inline input-small input-sm" Style="width: 190px !important;"></asp:DropDownList>
<asp:Literal runat="server" Text='<%# Eval("SubProyecto") %>'></asp:Literal>
<%--<asp:DropDownList ID="DdlGVSubProyecto" runat="server" DataTextField="SubProyecto" DataValueField="CveSubProyecto" Class="table-group-action-input form-control input-inline input-small input-sm" Style="width: 190px !important;"></asp:DropDownList>--%>
</ItemTemplate>
<ItemStyle HorizontalAlign="Left" />
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Turno</HeaderTemplate>
<ItemTemplate>
<asp:DropDownList ID="DdlTurno" runat="server" DataTextField="Turno" DataValueField="CveTurno" Class="table-group-action-input form-control input-inline input-small input-sm" Style="width: 90px !important;">
</asp:DropDownList>
<asp:Literal runat="server" Text='<%# Eval("Turno") %>'></asp:Literal>
<%--<asp:DropDownList ID="DdlTurno" runat="server" DataTextField="Turno" DataValueField="CveTurno" Class="table-group-action-input form-control input-inline input-small input-sm" Style="width: 90px !important;"></asp:DropDownList>--%>
</ItemTemplate>
<ItemStyle HorizontalAlign="Left" />
</asp:TemplateField>
<asp:TemplateField>
<%--<asp:TemplateField>
<HeaderTemplate>Supervisor</HeaderTemplate>
<ItemTemplate>
<asp:Literal runat="server" Text='<%# Eval("Proyecto") %>'></asp:Literal>
<asp:DropDownList ID="DdlSupervisor" runat="server" DataTextField="Nombre" DataValueField="CveUsuario" Class="table-group-action-input form-control input-inline input-small input-sm" Style="width: 140px !important;">
</asp:DropDownList>
</ItemTemplate>
<ItemStyle HorizontalAlign="Left" />
</asp:TemplateField>
<asp:TemplateField>
</asp:TemplateField>--%>
<asp:TemplateField HeaderStyle-Width="80px">
<HeaderTemplate>SDD</HeaderTemplate>
<ItemTemplate>
<asp:TextBox ID="TxtSalarioDiario" runat="server" MaxLength="10" Text='<%# Eval("SalarioDiario", "{0:N2}") %>' Width="50px"></asp:TextBox>
@@ -117,7 +119,7 @@
<ajax:ValidatorCalloutExtender ID="VCOSalarioDiario" runat="server" HighlightCssClass="vco" TargetControlID="CVSalarioDiario" Width="300px"></ajax:ValidatorCalloutExtender>
</ItemTemplate>
<ItemStyle HorizontalAlign="Left" />
</asp:TemplateField>
</asp:TemplateField >
<asp:TemplateField>
<HeaderTemplate>SDI</HeaderTemplate>
<ItemTemplate>
@@ -125,9 +127,9 @@
<asp:CompareValidator ID="CVSDI" runat="server" ControlToValidate="TxtSDI" Display="None" ErrorMessage="El campo <b>''SDI''</b> no tiene el formato correcto, por favor corrija e intente de nuevo (Solo formato numérico)." Operator="DataTypeCheck" Type="Currency" ValidationGroup="GrpGuardar"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="VCOSDI" runat="server" HighlightCssClass="vco" TargetControlID="CVSDI" Width="300px"></ajax:ValidatorCalloutExtender>
</ItemTemplate>
<ItemStyle HorizontalAlign="Left" />
<ItemStyle HorizontalAlign="Left" Width="80px" />
</asp:TemplateField>
<asp:TemplateField>
<asp:TemplateField HeaderStyle-Width="80px">
<HeaderTemplate>SD IMSS</HeaderTemplate>
<ItemTemplate>
<asp:TextBox ID="TxtSalarioCotizado" runat="server" MaxLength="10" Text='<%# Eval("SalarioDiarioSS", "{0:N2}") %>' Width="60px"></asp:TextBox>
@@ -140,11 +142,69 @@
<RowStyle CssClass="Texto" />
<HeaderStyle CssClass="Titulos" />
</asp:GridView>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
<div id="DModalCargaexcel" class="modal ADS fade" role="dialog">
<asp:UpdatePanel ID="UpCargarexcel" class="modal-dialog" tabindex="-1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-content rowpadding">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" runat="server" style="text-align: left">Cargar Nomina de excel</h4>
</div>
<div class="modal-body">
<div class="portlet light smmallpadding bordered">
<div class="portlet-title">
<div class="caption font-green">
<i class="fa fa-download font-green"></i>
<span class="caption-subject bold uppercase">Paso 1: Descargar Plantilla</span>
</div>
<div class="tools">
<a href="javascript:;" class="collapse" data-original-title="" title=""></a>
</div>
</div>
<div class="portlet-body rowpadding text-center">
<asp:LinkButton ID="LnkFormato" OnClick="LnkFormato_Click" CssClass="btn btn-success" runat="server"><i class="fa fa-download"></i> Descargar Plantilla</asp:LinkButton>
</div>
</div>
<%-- -recuerda Solo editar de las tercer fila en adelante.<br />
-No se debe editar el nombre de la hoja 'Nomina'.<br />
-la columna para referenciar al emplado es la primer columna 'Codigo', la columna empleado es solo es informativa.<br />
-si desea agregar un empleado que no se encuentre en la lista solo debe de ingresar fila y el codigo del empleado.<br />
-si no desea insertar un concepto puede borrar la columna.<br />
-no se debe borrar la columna codigo.<br />--%>
<div class="portlet light smmallpadding bordered">
<div class="portlet-title">
<div class="caption font-green">
<i class="fa fa-upload font-green"></i>
<span class="caption-subject bold uppercase">Paso 2: cargar plantilla </span>
</div>
<div class="tools">
<a href="javascript:;" class="collapse" data-original-title="" title=""></a>
</div>
</div>
<div class="portlet-body rowpadding ">
<asp:TextBox ID="TxtArchivoNomina" CssClass="ADSdropzone hidden" runat="server"></asp:TextBox>
</div>
</div>
</div>
<div class="modal-footer">
<asp:LinkButton ID="LnkCargarSalarios" OnClick="LnkCargarSalarios_Click" CssClass="btn btn-primary" runat="server">Procesar</asp:LinkButton>
</div>
</div>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LnkFormato" />
</Triggers>
</asp:UpdatePanel>
</div>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
<script language="javascript" type="text/javascript">

View File

@@ -11,7 +11,7 @@ Partial Class RH_ActualizacionMasiva
If Not IsPostBack Then
SetPermisos()
DdlCliente.Attributes.Add("onclick", "CargaClientes();")
'DdlCliente.Attributes.Add("onclick", "CargaClientes();")
CargaProyecto()
CargaTurnos()
CargaSupervisores()
@@ -24,6 +24,14 @@ Partial Class RH_ActualizacionMasiva
#Region "Propiedades"
Private Property DTEmpleados As DataTable
Get
Return DirectCast(ViewState("DTEmpleados"), DataTable)
End Get
Set(value As DataTable)
ViewState("DTEmpleados") = value
End Set
End Property
Private ReadOnly Property DTUsuarios As DataTable
Get
Return DirectCast(ViewState("DTUsuarios"), DataTable)
@@ -53,22 +61,22 @@ Partial Class RH_ActualizacionMasiva
#Region "CargaCombos"
Private Sub CargaClientes()
Dim ObjClientes As New ClsClientes
If ObjClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then
DdlCliente.DataSource = ObjClientes.DtResultados
Else
DdlCliente.DataSource = Nothing
End If
ObjClientes.Dispose()
'Application("GlobalDTResponsable")
'Dim ObjClientes As New ClsClientes
'If ObjClientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then
' DdlCliente.DataSource = ObjClientes.DtResultados
'Else
' DdlCliente.DataSource = Nothing
'End If
'ObjClientes.Dispose()
''Application("GlobalDTResponsable")
DdlCliente.DataBind()
'DdlCliente.DataBind()
End Sub
Protected Sub BtnCargarClientes_Click(sender As Object, e As System.EventArgs) Handles BtnCargarClientes.Click
CargaClientes()
DdlCliente.Attributes.Remove("onclick")
End Sub
'Protected Sub BtnCargarClientes_Click(sender As Object, e As System.EventArgs) Handles BtnCargarClientes.Click
' CargaClientes()
' DdlCliente.Attributes.Remove("onclick")
'End Sub
Private Sub CargaProyecto()
ViewState("DTProyectos") = GlobalDTProyectos(UsuarioActual.Empresa.CveEmpresa)
@@ -102,8 +110,8 @@ Partial Class RH_ActualizacionMasiva
Row("CveUsuario") = -1 : Row("Nombre") = "Sin Supervisor Asignado"
DirectCast(ViewState("DTUsuarios"), DataTable).Rows.InsertAt(Row, 0)
DdlSupervisor.DataSource = GlobalDTUsuarios.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa & " AND EsSupervisorRH = 1 ")
DdlSupervisor.DataBind()
'DdlSupervisor.DataSource = GlobalDTUsuarios.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa & " AND EsSupervisorRH = 1 ")
'DdlSupervisor.DataBind()
End Sub
#End Region
@@ -113,15 +121,16 @@ Partial Class RH_ActualizacionMasiva
End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As System.EventArgs) Handles BtnConsultar.Click
Dim ObjPersonal As New ClsRH
If ObjPersonal.GetPersonalMasivo(DdlTurno.SelectedValue.ToEntero, DdlProyecto.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, DdlSupervisor.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
GvDatos.DataSource = ObjPersonal.DtResultados
Else
GvDatos.DataSource = Nothing
End If
Using ObjPersonal As New ClsRH
If ObjPersonal.GetPersonalMasivo(DdlTurno.SelectedValue.ToEntero, DdlProyecto.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) Then
GvDatos.DataSource = ObjPersonal.DtResultados
Else
GvDatos.DataSource = Nothing
End If
End Using
ObjPersonal.Dispose()
GvDatos.DataBind()
UPDatos.Update()
@@ -130,20 +139,20 @@ Partial Class RH_ActualizacionMasiva
Protected Sub GvDatos_RowCreated(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowCreated
If e.Row.RowType = DataControlRowType.DataRow AndAlso (e.Row.RowState = DataControlRowState.Alternate OrElse e.Row.RowState = DataControlRowState.Normal) Then
e.Row.FCDropDownList("DdlGVProyecto").DataSource = DTProyectos
e.Row.FCDropDownList("DdlGVProyecto").DataBind()
'e.Row.FCDropDownList("DdlGVProyecto").Items.Insert(0, New ListItem("Sin Proyecto asignado", "-1"))
'e.Row.FCDropDownList("DdlGVProyecto").DataSource = DTProyectos
'e.Row.FCDropDownList("DdlGVProyecto").DataBind()
''e.Row.FCDropDownList("DdlGVProyecto").Items.Insert(0, New ListItem("Sin Proyecto asignado", "-1"))
e.Row.FCDropDownList("DdlGVSubProyecto").DataSource = DTSubProyectos
e.Row.FCDropDownList("DdlGVSubProyecto").DataBind()
'e.Row.FCDropDownList("DdlGVSubProyecto").Items.Insert(0, New ListItem("Sin SubProyecto asignado", "-1"))
'e.Row.FCDropDownList("DdlGVSubProyecto").DataSource = DTSubProyectos
'e.Row.FCDropDownList("DdlGVSubProyecto").DataBind()
''e.Row.FCDropDownList("DdlGVSubProyecto").Items.Insert(0, New ListItem("Sin SubProyecto asignado", "-1"))
e.Row.FCDropDownList("DdlTurno").DataSource = DTTurno
e.Row.FCDropDownList("DdlTurno").DataBind()
'e.Row.FCDropDownList("DdlTurno").DataSource = DTTurno
'e.Row.FCDropDownList("DdlTurno").DataBind()
e.Row.FCDropDownList("DdlSupervisor").DataSource = DTUsuarios
e.Row.FCDropDownList("DdlSupervisor").DataBind()
'e.Row.FCDropDownList("DdlSupervisor").Items.Insert(0, New ListItem("Sin Supervisor Asignado", "-1"))
'e.Row.FCDropDownList("DdlSupervisor").DataSource = DTUsuarios
'e.Row.FCDropDownList("DdlSupervisor").DataBind()
''e.Row.FCDropDownList("DdlSupervisor").Items.Insert(0, New ListItem("Sin Supervisor Asignado", "-1"))
End If
@@ -154,25 +163,25 @@ Partial Class RH_ActualizacionMasiva
If e.Row.DBCampo("Turno") = "" AndAlso e.Row.DBCampo("Nombre") = "" Then
e.Row.FCLiteral("LtlNombre").Text = "<b>Sub Proyecto:</b> " & If(e.Row.DBCampo("SubProyecto") = String.Empty, "Sin Proyecto Asignado", e.Row.DBCampo("SubProyecto"))
e.Row.Cells(0).ColumnSpan = 8
For i As Integer = 1 To 7
e.Row.Cells(0).ColumnSpan = 7
For i As Integer = 1 To 6
e.Row.Cells(i).Visible = False
Next
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left
ElseIf e.Row.DBCampo("Turno") <> "" AndAlso e.Row.DBCampo("Nombre") = "" Then
e.Row.FCLiteral("LtlNombre").Text = "<b>Turno:</b> " & e.Row.DBCampo("Turno")
e.Row.Cells(0).ColumnSpan = 8
For i As Integer = 1 To 7
e.Row.Cells(0).ColumnSpan = 7
For i As Integer = 1 To 6
e.Row.Cells(i).Visible = False
Next
e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left
Else
If e.Row.DBCampo("CveProyecto") <> String.Empty Then e.Row.FCDropDownList("DdlGVProyecto").SelectedValue = e.Row.DBCampo("CveProyecto")
CargaSubProyectoGV(e.Row.FCDropDownList("DdlGVProyecto"), e.Row.FCDropDownList("DdlGVSubProyecto"))
If e.Row.DBCampo("CveSubProyecto") <> String.Empty Then e.Row.FCDropDownList("DdlGVSubProyecto").SelectedValue = e.Row.DBCampo("CveSubProyecto")
e.Row.FCDropDownList("DdlGVSubProyecto").Attributes.Add("onChange", "F(this, " & e.Row.FCDropDownList("DdlGVProyecto").ClientID & ")")
If e.Row.DBCampo("CveTurno") <> String.Empty Then e.Row.FCDropDownList("DdlTurno").SelectedValue = e.Row.DBCampo("CveTurno")
If e.Row.DBCampo("CveSupervisor") <> String.Empty Then e.Row.FCDropDownList("DdlSupervisor").SelectedValue = e.Row.DBCampo("CveSupervisor")
'If e.Row.DBCampo("CveProyecto") <> String.Empty Then e.Row.FCDropDownList("DdlGVProyecto").SelectedValue = e.Row.DBCampo("CveProyecto")
'CargaSubProyectoGV(e.Row.FCDropDownList("DdlGVProyecto"), e.Row.FCDropDownList("DdlGVSubProyecto"))
'If e.Row.DBCampo("CveSubProyecto") <> String.Empty Then e.Row.FCDropDownList("DdlGVSubProyecto").SelectedValue = e.Row.DBCampo("CveSubProyecto")
'e.Row.FCDropDownList("DdlGVSubProyecto").Attributes.Add("onChange", "F(this, " & e.Row.FCDropDownList("DdlGVProyecto").ClientID & ")")
'If e.Row.DBCampo("CveTurno") <> String.Empty Then e.Row.FCDropDownList("DdlTurno").SelectedValue = e.Row.DBCampo("CveTurno")
'If e.Row.DBCampo("CveSupervisor") <> String.Empty Then e.Row.FCDropDownList("DdlSupervisor").SelectedValue = e.Row.DBCampo("CveSupervisor")
e.Row.FCTextBox("TxtSalarioCotizado").Text = e.Row.FCTextBox("TxtSalarioCotizado").Text.Replace(",", "")
@@ -181,39 +190,48 @@ Partial Class RH_ActualizacionMasiva
'e.Row.Cells(5).Enabled = True : e.Row.Cells(6).Enabled = True : e.Row.Cells(7).Enabled = True
'25: CargaMasiva-Proy,Sup,Tur
If Not UsuarioActual.TienePermisoProceso(25) Then e.Row.Cells(1).Enabled = False : e.Row.Cells(2).Enabled = False : e.Row.Cells(3).Enabled = False : e.Row.Cells(4).Enabled = False
'26: CargaMasiva-Salarios
If Not UsuarioActual.TienePermisoProceso(26) Then e.Row.Cells(5).Enabled = False : e.Row.Cells(6).Enabled = False : e.Row.Cells(7).Enabled = False
'If Not UsuarioActual.TienePermisoProceso(25) Then e.Row.Cells(1).Enabled = False : e.Row.Cells(2).Enabled = False : e.Row.Cells(3).Enabled = False : e.Row.Cells(4).Enabled = False
End If
End If
End Sub
Protected Sub BtnGuardar_Click(sender As Object, e As System.EventArgs) Handles BtnGuardar.Click
Dim ObjPersonal As New ClsRH
ObjPersonal.IniciaTransacSQL()
'Dim ObjPersonal As New ClsRH
'ObjPersonal.IniciaTransacSQL()
Dim OcurrioError As Boolean = False
For Each Row As GridViewRow In GvDatos.Rows
If Row.DataKey("CvePersonal") <> "" Then
If Not ObjPersonal.UpdatePersonalMasivo(Row.FCDropDownList("DdlTurno").SelectedValue.ToEntero, Row.FCDropDownList("DdlGVSubProyecto").SelectedValue.ToEntero, Row.FCDropDownList("DdlSupervisor").SelectedValue.ToEntero,
Row.FCTextBox("TxtSalarioDiario").Text.ToDouble, Row.FCTextBox("TxtSDI").Text.ToDouble, Row.FCTextBox("TxtSalarioCotizado").Text.ToDouble,
Row.DataKey("CvePersonal").ToEntero, UsuarioActual.CveEmpresa) Then
OcurrioError = True
ObjPersonal.RollBack()
Exit For
Using ObjPersonal As ClsRH = New ClsRH()
For Each Row As GridViewRow In GvDatos.Rows
If Row.DataKey("CvePersonal") <> "" Then
'If Not ObjPersonal.UpdatePersonalMasivo(Row.FCDropDownList("DdlTurno").SelectedValue.ToEntero, Row.FCDropDownList("DdlGVSubProyecto").SelectedValue.ToEntero, Row.FCDropDownList("DdlSupervisor").SelectedValue.ToEntero,
' Row.FCTextBox("TxtSalarioDiario").Text.ToDouble, Row.FCTextBox("TxtSDI").Text.ToDouble, Row.FCTextBox("TxtSalarioCotizado").Text.ToDouble,
' Row.DataKey("CvePersonal").ToEntero, UsuarioActual.CveEmpresa) Then
' OcurrioError = True
' ObjPersonal.RollBack()
' Exit For
'End If
If ObjPersonal.UpdateSalarios(Row.DataKey("CvePersonal").ToEntero(), DateTime.Now.ToString("yyyy/MM/dd"), UsuarioActual.CveEmpresa, Row.FCTextBox("TxtSalarioDiario").Text.ToDecimal(), Row.FCTextBox("TxtSDI").Text.ToDecimal(), Row.FCTextBox("TxtSalarioCotizado").Text.ToDecimal(), Row.FCTextBox("TxtSalarioDiario").Text.ToDecimal()) Then
Else
OcurrioError = True
ObjPersonal.RollBack()
Exit For
End If
End If
Next
If Not OcurrioError Then
'ObjPersonal.Commit()
Alert("La información se guardó correctamente.", TipoMensaje.MsgInformacion)
Else
Alert("Ocurrió un error al guardar la información.", TipoMensaje.MsgError)
End If
Next
End Using
If Not OcurrioError Then
ObjPersonal.Commit()
Alert("La información se guardó correctamente.", TipoMensaje.MsgInformacion)
Else
Alert("Ocurrió un error al guardar la información.", TipoMensaje.MsgError)
End If
ObjPersonal.Dispose()
'ObjPersonal.Dispose()
End Sub
Private Sub CargaSubProyectoGV(DdlProyecto As DropDownList, DdlSubProyecto As DropDownList)
@@ -234,4 +252,129 @@ Partial Class RH_ActualizacionMasiva
If DdlGVSubProyecto IsNot Nothing Then CargaSubProyectoGV(DirectCast(sender, DropDownList), DdlGVSubProyecto)
End Sub
Protected Sub LnkFormato_Click(ByVal sender As Object, ByVal e As EventArgs)
Try
Dim wb As ClosedXML.Excel.XLWorkbook = New ClosedXML.Excel.XLWorkbook()
Dim libro = wb.AddWorksheet("Salario")
Dim column As Integer = 1
Dim Fila As Integer = 1
libro.Cell(Fila, column).Value = "Codigo"
column += 1
libro.Cell(Fila, column).Value = "Empleado"
column += 1
libro.Column(column).Width = 35
libro.Cell(Fila, column).Value = "SDD"
column += 1
libro.Cell(Fila, column).Value = "SDI"
column += 1
libro.Cell(Fila, column).Value = "SD IMSS"
column += 1
DTEmpleados = New DataTable()
libro.Row(1).CellsUsed().Style.Font.FontColor = ClosedXML.Excel.XLColor.White
libro.Row(1).CellsUsed().Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189))
Using ObjPersonal As New ClsRH
If ObjPersonal.GetPersonalMasivo(DdlTurno.SelectedValue.ToEntero, DdlProyecto.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, -1, UsuarioActual.CveEmpresa) Then
DTEmpleados = ObjPersonal.DtResultados
End If
End Using
For Each dro As DataRow In DTEmpleados.Select("CvePersonal > 0 AND LEN(Codigo)>0")
column = 1
Fila = Fila + 1
libro.Cell(Fila, column).Value = dro("Codigo")
column += 1
libro.Cell(Fila, column).Value = dro("Nombre")
column += 1
libro.Column(column).Width = 35
libro.Cell(Fila, column).Value = dro("SalarioDiario")
column += 1
libro.Cell(Fila, column).Value = dro("SDI")
column += 1
libro.Cell(Fila, column).Value = dro("SalarioDiarioSS")
column += 1
Next
Dim fs As System.IO.Stream = New System.IO.MemoryStream()
wb.SaveAs(fs)
fs.Position = 0
Dim memoryStream As System.IO.MemoryStream = New System.IO.MemoryStream()
Using input As System.IO.Stream = fs
input.CopyTo(memoryStream)
End Using
memoryStream.Position = 0
Response.Clear()
Response.Buffer = True
Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
Response.AddHeader("content-disposition", String.Format("attachment;filename={0}.xlsx", "FormatoCargaSalario"))
Response.BinaryWrite(memoryStream.ToArray())
Response.[End]()
Catch ex As Exception
Alert("Ocurrio un error al generar el Formato de salario" & ex.ToString())
End Try
End Sub
Protected Sub LnkCargarSalarios_Click(sender As Object, e As EventArgs)
Dim Filesgral As List(Of Archivo) = TxtArchivoNomina.getfiles().Archivos
Dim continuar As Boolean = Filesgral.Count > 0
Dim stringError As String = ""
Dim fileItem As Archivo = If(continuar, Filesgral(0), Nothing)
If continuar Then
Dim FileExtension As String = fileItem.Extencion.ToUpper()
If FileExtension = "XLS" Or FileExtension = "XLSX" Or FileExtension = "CSV" Then
Else
continuar = False
stringError = "No se inserto un archivo de tipo Excel"
End If
End If
Dim DTEXcel As DataTable = New DataTable()
If continuar Then
Try
DTEXcel = Extensiones.ModExtensiones.ReadExcelFile(fileItem.FileUrl, True).FiltraParametros(" LEN(Codigo)>0 ")
Catch ex As Exception
continuar = False
stringError = "Ocurrio un Error al procesar el excel "
String.Format("{0} " & vbCrLf & "{0}", stringError, ex.ToString()).GuardaLog()
End Try
End If
If continuar Then
Dim OcurrioError As Boolean = False
Using ObjPersonal As ClsRH = New ClsRH()
For Each Row As DataRow In DTEXcel.Rows
If Row("Codigo").ToString() <> "" Then
Dim drow As DataRow = DTEmpleados.FiltroPrimero(String.Format("Codigo='{0}'", Row("Codigo")))
If Not IsNothing(drow) Then
Dim CvePersonal As Integer = drow("CvePersonal").ToString().ToEntero()
If ObjPersonal.UpdateSalarios(CvePersonal, DateTime.Now.ToString("yyyy/MM/dd"), UsuarioActual.CveEmpresa, Row("SDD").ToString().ToDecimal(), Row("SDI").ToString().ToDecimal(), Row("SD IMSS").ToString().ToDecimal(), Row("SDD").ToString().ToDecimal()) Then
Else
OcurrioError = True
ObjPersonal.RollBack()
Exit For
End If
End If
End If
Next
If Not OcurrioError Then
'ObjPersonal.Commit()
Alert("La información se guardó correctamente.", TipoMensaje.MsgInformacion)
Else
Alert("Ocurrió un error al guardar la información.", TipoMensaje.MsgError)
End If
End Using
End If
End Sub
End Class

View File

@@ -33,7 +33,7 @@
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net4" />
<package id="Microsoft.Web.Xdt" version="1.0.0" targetFramework="net4" />
<package id="NC-OS-SessionStateProvider" version="4.4.0.0" targetFramework="net40" />
<package id="Newtonsoft.Json" version="10.0.1" targetFramework="net45" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net45" />
<package id="NuGet.Core" version="2.8.0" targetFramework="net4" />
<package id="Owin" version="1.0" targetFramework="net45" />
<package id="StackExchange.Redis.StrongName" version="1.0.488" targetFramework="net40" />