-- simplificación de método para dispersión.
This commit is contained in:
@@ -642,27 +642,28 @@ Public Class ClsNominas
|
||||
retorno = RunQuery("Ocurrió un error al obtener el valor de la UMA.")
|
||||
Return retorno
|
||||
End Function
|
||||
Public Function GetDispersionnominaXLS(CvePeriodo As Int32, CveEmpresa As Int32) As Boolean
|
||||
'Public Function GetDispersionnominaXLS(CvePeriodo As Int32, CveEmpresa As Int32) As Boolean
|
||||
' Dim retorno As Boolean = False
|
||||
' DataAdapter("PA_Nom_DispersionnominaXLS", CommandType.StoredProcedure)
|
||||
' With SqlAdapter.SelectCommand.Parameters
|
||||
' .Add("@CvePeriodo", SqlDbType.Int).Value = CvePeriodo
|
||||
' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
' End With
|
||||
' Try
|
||||
' SqlAdapter.Fill(Data)
|
||||
' retorno = True
|
||||
' Catch ex As Exception
|
||||
' OnError("Ocurrió un error al obtener el layout de nóminas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
' End Try
|
||||
' Return retorno
|
||||
'End Function
|
||||
Public Function GetDispersionNomina(CvePeriodo As Int32, CveEmpresa As Int32, CveSATBanco As Int32) As Boolean
|
||||
Dim retorno As Boolean = False
|
||||
DataAdapter("PA_Nom_DispersionnominaXLS", CommandType.StoredProcedure)
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CvePeriodo", SqlDbType.Int).Value = CvePeriodo
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al obtener el layout de nóminas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
Return retorno
|
||||
End Function
|
||||
Public Function GetDispersionnomina(CvePeriodo As Int32, CveEmpresa As Int32) As Boolean
|
||||
Dim retorno As Boolean = False
|
||||
DataAdapter("PA_Nom_Dispersionnomina", CommandType.StoredProcedure)
|
||||
DataAdapter("PA_Nom_DispersionNomina", CommandType.StoredProcedure)
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CvePeriodo", SqlDbType.Int).Value = CvePeriodo
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
.Add("@CveSATBanco", SqlDbType.Int).Value = CveSATBanco
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
@@ -3744,21 +3745,21 @@ Public Class ClsNominas
|
||||
End Function
|
||||
|
||||
|
||||
Public Function GetDispersionNominaBanorte(CvePeriodo As Integer, CveEmpresa As Integer) As Boolean
|
||||
Dim retorno As Boolean = False
|
||||
DataAdapter("PA_Nom_DispersionNominaBanorteGet", CommandType.StoredProcedure)
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CvePeriodo", SqlDbType.Int).Value = CvePeriodo
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al obtener el layout de nominas Banorte.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
End Try
|
||||
Return retorno
|
||||
End Function
|
||||
'Public Function GetDispersionNominaBanorte(CvePeriodo As Integer, CveEmpresa As Integer) As Boolean
|
||||
' Dim retorno As Boolean = False
|
||||
' DataAdapter("PA_Nom_DispersionNominaBanorteGet", CommandType.StoredProcedure)
|
||||
' With SqlAdapter.SelectCommand.Parameters
|
||||
' .Add("@CvePeriodo", SqlDbType.Int).Value = CvePeriodo
|
||||
' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
' End With
|
||||
' Try
|
||||
' SqlAdapter.Fill(Data)
|
||||
' retorno = True
|
||||
' Catch ex As Exception
|
||||
' OnError("Ocurrió un error al obtener el layout de nominas Banorte.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||
' End Try
|
||||
' Return retorno
|
||||
'End Function
|
||||
|
||||
Public Function PreNominaTotalSemana(numeroPeriodo As Int32, cveEmpresa As Int32, cveSubProyecto As Int32, cveTipoNomina As Int32, tipoTrabajador As String, ejercicio As Int32, facturado As Boolean) As Boolean
|
||||
Dim retorno As Boolean = False
|
||||
|
||||
@@ -9891,15 +9891,10 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
DdlCuenta.DataBind();
|
||||
DdlCuenta.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
||||
DdlCuenta.SelectedValueExist("-1");
|
||||
|
||||
}
|
||||
|
||||
protected void DdlCuenta_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
{
|
||||
ConvenioPagoElectronico = string.Empty;
|
||||
DivModalLayoutBancosFecha.Visible = false;
|
||||
|
||||
@@ -9907,10 +9902,9 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
{
|
||||
|
||||
ConvenioPagoElectronico = get_GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa: UsuarioActual.CveEmpresa).FiltroPrimeroValor("ConvenioPagoElectronico", $" CveCuenta = {DdlCuenta.SelectedValue}").ToString();
|
||||
if (DdlCuenta.SelectedItem.Text.ToUpper().Contains("BANCOMER"))
|
||||
if (DdlCuenta.SelectedItem.Text.ToUpper().Contains("BANCOMER") || DdlCuenta.SelectedItem.Text.ToUpper().Contains("BBVA"))
|
||||
{
|
||||
Banco = Bancos.Bancomer;
|
||||
|
||||
}
|
||||
else if (DdlCuenta.SelectedItem.Text.ToUpper().Contains("BANORTE"))
|
||||
{
|
||||
@@ -9925,16 +9919,12 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
else
|
||||
{
|
||||
ConvenioPagoElectronico = string.Empty;
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Banco = Bancos.SinSelccion;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void BtnLayoutXLS_Click(object sender, EventArgs e)
|
||||
@@ -9958,7 +9948,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
libro.Range(1, 1, row, column - 1).Style.Font.FontColor = ClosedXML.Excel.XLColor.White;
|
||||
libro.Range(1, 1, row, column - 1).Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189));
|
||||
|
||||
if (objnom.GetDispersionnominaXLS(CvePeriodoSeleccionado, UsuarioActual.CveEmpresa))
|
||||
if (objnom.GetDispersionNomina(CvePeriodoSeleccionado, UsuarioActual.CveEmpresa,-1))
|
||||
{
|
||||
foreach (DataRow dRow in objnom.DtResultados.Rows)
|
||||
{
|
||||
@@ -9994,12 +9984,8 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
Response.AddHeader("content-disposition", string.Format("attachment;filename={0}.xlsx", "ListadePago"));
|
||||
Response.BinaryWrite(memoryStream.ToArray());
|
||||
Response.End();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void BtnEfectivaleXLS_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
@@ -10075,84 +10061,73 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
{
|
||||
using (ClsNominas objnom = new ClsNominas())
|
||||
{
|
||||
if (objnom.GetDispersionnomina(CvePeriodoSeleccionado, UsuarioActual.CveEmpresa))
|
||||
if (objnom.GetDispersionNomina(CvePeriodoSeleccionado, UsuarioActual.CveEmpresa,4))
|
||||
{
|
||||
CrearLayoutNominaBancomer(objnom.DtResultados);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if (Banco == Bancos.Banorte)
|
||||
{
|
||||
using (ClsNominas objnom = new ClsNominas())
|
||||
{
|
||||
if (objnom.GetDispersionNominaBanorte(CvePeriodoSeleccionado, UsuarioActual.CveEmpresa))
|
||||
if (objnom.GetDispersionNomina (CvePeriodoSeleccionado, UsuarioActual.CveEmpresa,18))
|
||||
{
|
||||
CrearLayoutNominaBanorte(objnom.DtResultados, ConvenioPagoElectronico, 1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if (Banco == Bancos.Banamex)
|
||||
{
|
||||
using (ClsNominas objnom = new ClsNominas())
|
||||
{
|
||||
if (objnom.GetDispersionnominaXLS(CvePeriodoSeleccionado, UsuarioActual.CveEmpresa))
|
||||
if (objnom.GetDispersionNomina(CvePeriodoSeleccionado, UsuarioActual.CveEmpresa,1))
|
||||
{
|
||||
CrearLayoutNominaBanamex(objnom.DtResultados.FiltraParametros(" (BancoNombre) like '%BANAMEX%'"));
|
||||
CrearLayoutNominaBanamex(objnom.DtResultados);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void CrearLayoutNominaBancomer(DataTable DTNomina)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder SbErrores = new StringBuilder();
|
||||
bool ErroresValidaciones = false;
|
||||
int modalidadnomina = 1;
|
||||
if (UsuarioActual.CveEmpresa == 189) modalidadnomina = 2;
|
||||
|
||||
|
||||
SbErrores.AppendLine("Se detectaron los siguientes errores en la generación del layout");
|
||||
SbErrores.AppendLine("Se detectaron los siguientes errores en la generación del layout:<br/>");
|
||||
|
||||
foreach (DataRow dRow in DTNomina.Rows)
|
||||
{
|
||||
string RFC = dRow["RFC"].ToString();
|
||||
string Nombre = dRow["Nombre"].ToString();
|
||||
string BancoNumCuenta = dRow["BancoNumCuenta"].ToString();
|
||||
string BancoNumCuenta = dRow["NumeroCuenta"].ToString();
|
||||
decimal Importe = dRow["Importe"].ToString().ToDecimal();
|
||||
|
||||
|
||||
|
||||
if (RFC.Trim().Length == 0)
|
||||
SbErrores.AppendLine($"El RFC es requerido del empleado {Nombre}<br/>");
|
||||
|
||||
System.Text.RegularExpressions.Match Coincidencia = System.Text.RegularExpressions.Regex.Match(RFC, @"/^([A-Z,Ñ,&]{3,4}([0-9]{2})(0[1-9]|1[0-2])(0[1-9]|1[0-9]|2[0-9]|3[0-1])[A-Z|\d]{3})$/");
|
||||
if (!Coincidencia.Success)
|
||||
{
|
||||
SbErrores.AppendLine($"El RFC {RFC} del empleado {Nombre} no es valido <br/>");
|
||||
ErroresValidaciones = true;
|
||||
}
|
||||
//if (!Coincidencia.Success)
|
||||
//{
|
||||
// SbErrores.AppendLine($"El RFC {RFC} del empleado {Nombre} no es valido <br/>");
|
||||
// ErroresValidaciones = true;
|
||||
//}
|
||||
|
||||
if (BancoNumCuenta.Trim().Length != 10)
|
||||
{
|
||||
SbErrores.AppendLine($"Empleado {Nombre} numero de cuenta incorrecto, la cuenta debe de tener 10 caracteres<br/>"); // Bancomer 10 caracteres
|
||||
SbErrores.AppendLine($"- {Nombre} numero de cuenta incorrecto, la cuenta debe de tener 10 caracteres<br/>"); // Bancomer 10 caracteres
|
||||
ErroresValidaciones = true;
|
||||
}
|
||||
|
||||
|
||||
if (Importe <= 0)
|
||||
{
|
||||
SbErrores.AppendLine($"Empleado {Nombre} el importe debe de ser mayor a 0 importe {Importe}"); // importe mayot a 0
|
||||
SbErrores.AppendLine($"- {Nombre} el importe debe de ser mayor a 0 importe {Importe}"); // importe mayot a 0
|
||||
ErroresValidaciones = true;
|
||||
}
|
||||
}
|
||||
|
||||
ErroresValidaciones = false;
|
||||
|
||||
|
||||
if (!ErroresValidaciones)
|
||||
{
|
||||
int Count = 1;
|
||||
@@ -10162,40 +10137,39 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
|
||||
string RFC = dRow["RFC"].ToString();
|
||||
string Nombre = dRow["Nombre"].ToString();
|
||||
string BancoNumCuenta = dRow["BancoNumCuenta"].ToString();
|
||||
string BancoNumCuenta = dRow["NumeroCuenta"].ToString();
|
||||
decimal Importe = dRow["Importe"].ToString().ToDecimal().RoundSQL(2);
|
||||
|
||||
SbLinea.Append(Count.ToString("000000000"));
|
||||
SbLinea.Append(RFC.Trim().PadRight(16));
|
||||
SbLinea.Append("03");
|
||||
if (modalidadnomina == 2) SbLinea.Append("99"); else SbLinea.Append("03");
|
||||
SbLinea.Append(BancoNumCuenta.Trim().PadRight(20));
|
||||
SbLinea.Append(Importe.ToString("0000000000000.00").Replace(".", ""));
|
||||
|
||||
|
||||
if (Nombre.Trim().Length > 40)
|
||||
Nombre = Nombre.Substring(0, 40);
|
||||
|
||||
SbLinea.Append(Nombre.Trim().PadRight(40));
|
||||
|
||||
SbLinea.Append("012");
|
||||
SbLinea.Append("000");
|
||||
|
||||
if (modalidadnomina == 2)
|
||||
{
|
||||
SbLinea.Append("001"); SbLinea.Append("001");
|
||||
}
|
||||
else {
|
||||
SbLinea.Append("012"); SbLinea.Append("000");
|
||||
}
|
||||
sb.AppendLine(SbLinea.ToString());
|
||||
|
||||
|
||||
Count = Count + 1;
|
||||
}
|
||||
|
||||
|
||||
Response.Clear();
|
||||
Response.ClearHeaders();
|
||||
Response.AppendHeader("Content-Length", sb.ToString());
|
||||
Response.ContentType = "text/plain";
|
||||
//Response.AppendHeader("Content-Disposition", $"attachment;filename=\"Nomina{NowADS().ToString("yyyyMMddhhmmss").ToString()}.txt\"");
|
||||
Response.AppendHeader("Content-Disposition", $"attachment;filename=\"Nomina {DdlPeriodo.SelectedItem.Text}.txt\"");
|
||||
Response.AppendHeader("Content-Disposition", $"attachment;filename=\"Nomina_BBVA_{DdlPeriodo.SelectedItem.Text}.txt\"");
|
||||
Response.Write(sb.ToString());
|
||||
RegistraScript("$('#ModalLayoutBancos').modal('hide');");
|
||||
Response.Flush();
|
||||
//RegistraScript("$('#ModalLayoutBancos').modal('hide');");
|
||||
// Response.Flush();
|
||||
Response.End();
|
||||
}
|
||||
else
|
||||
@@ -10249,7 +10223,6 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
{
|
||||
foreach (DataRow dRow in DTNomina.Rows)
|
||||
{
|
||||
|
||||
// Codigo ReferenciaDelServicio ReferenciaLeyendaDelOrdenante Importe NumeroBancoReceptor TipoCuenta NumeroCuenta TipoMovimiento Accion ImporteIvaOperacion
|
||||
string Codigo = dRow["Codigo"].ToString().Trim();
|
||||
string ReferenciaDelServicio = dRow["ReferenciaDelServicio"].ToString().Trim();
|
||||
@@ -10262,7 +10235,6 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
string Accion = dRow["Accion"].ToString().Trim();
|
||||
string ImporteIvaOperacion = dRow["ImporteIvaOperacion"].ToString().Trim();
|
||||
|
||||
|
||||
//Linea Nueva
|
||||
sb.AppendLine("");
|
||||
|
||||
@@ -10281,7 +10253,6 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
SbErrores.AppendLine($"{Codigo} Codigo {Codigo} debe de tener una logitud de entre 1 y 10<br/>");
|
||||
ErrorProceso = true;
|
||||
}
|
||||
|
||||
//ReferenciaDelServicio A 40 20-29
|
||||
sb.Append(ReferenciaDelServicio.PadLeft(40, Espacio));
|
||||
//ReferenciaLeyendaDelOrdenante A 40 60-99
|
||||
@@ -10302,19 +10273,13 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
sb.Append(ImporteIvaOperacion.PadLeft(8, Cero));
|
||||
//filler 18 148-165
|
||||
sb.Append(string.Empty.PadLeft(18, Espacio));
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (!ErrorProceso)
|
||||
{
|
||||
sb.AppendLine("");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (!ErrorProceso)
|
||||
{
|
||||
Response.Clear();
|
||||
@@ -10324,7 +10289,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
Response.AppendHeader("Content-Disposition", $"attachment;filename=\"NI{Emisora.PadLeft(5, Cero)}{Consecutivo.ToString("00")}.PAG\"");
|
||||
Response.Write(sb.ToString());
|
||||
RegistraScript("$('#ModalLayoutBancos').modal('hide');");
|
||||
Response.Flush();
|
||||
//Response.Flush();
|
||||
Response.End();
|
||||
}
|
||||
else
|
||||
@@ -10349,7 +10314,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
{
|
||||
//string RFC = dRow["RFC"].ToString();
|
||||
string Nombre = dRow["Nombre"].ToString();
|
||||
string BancoNumCuenta = dRow["BancoNumCuenta"].ToString();
|
||||
string BancoNumCuenta = dRow["NumeroCuenta"].ToString();
|
||||
decimal Importe = dRow["Importe"].ToString().ToDecimal();
|
||||
|
||||
//if (RFC.Trim().Length == 0)
|
||||
@@ -10362,7 +10327,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
// ErroresValidaciones = true;
|
||||
//}
|
||||
|
||||
if (BancoNumCuenta.Trim().Length != 10)
|
||||
if (BancoNumCuenta.Trim().Length != 10 || BancoNumCuenta.Trim().Length != 16)
|
||||
{
|
||||
SbErrores.AppendLine($"Empleado {Nombre} numero de cuenta incorrecto, la cuenta debe de tener 10 caracteres<br/>"); // Bancomer 10 caracteres
|
||||
ErroresValidaciones = true;
|
||||
@@ -10428,7 +10393,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
string AMaterno = dRow["AMaterno"].ToString().Replace("ñ,Ñ", "n").Replace("*,#,$,%,=,+", "");
|
||||
//string BancoNumCuenta = dRow["BancoNumCuenta"].ToString();
|
||||
|
||||
string BancoNumCuenta = dRow["BancoNumCuenta"].ToString();
|
||||
string BancoNumCuenta = dRow["NumeroCuenta"].ToString();
|
||||
decimal Importe = dRow["Importe"].ToString().ToDecimal().RoundSQL(2);
|
||||
|
||||
var StrImporte = Importe.ToString("0000000000000000.00").Replace(".", "");
|
||||
@@ -10463,10 +10428,10 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
Response.AppendHeader("Content-Length", sb.ToString());
|
||||
Response.ContentType = "text/plain";
|
||||
//Response.AppendHeader("Content-Disposition", $"attachment;filename=\"Nomina{NowADS().ToString("yyyyMMddhhmmss").ToString()}.txt\"");
|
||||
Response.AppendHeader("Content-Disposition", $"attachment;filename=\"Nomina {DdlPeriodo.SelectedItem.Text}.txt\"");
|
||||
Response.AppendHeader("Content-Disposition", $"attachment;filename=\"Nomina_Banamex_{DdlPeriodo.SelectedItem.Text}.txt\"");
|
||||
Response.Write(sb.ToString());
|
||||
RegistraScript("$('#ModalLayoutBancos').modal('hide');");
|
||||
Response.Flush();
|
||||
//RegistraScript("$('#ModalLayoutBancos').modal('hide');");
|
||||
//Response.Flush();
|
||||
Response.End();
|
||||
}
|
||||
else
|
||||
@@ -10474,9 +10439,6 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
|
||||
protected void LnkBitacoraCorreo_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (ClsRH objrh = new ClsRH())
|
||||
|
||||
Reference in New Issue
Block a user