rpts IVA, CXC CXP Periodo
This commit is contained in:
@@ -7662,108 +7662,9 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
}
|
||||
loadtablas();
|
||||
}
|
||||
private void CrearLayout(DataTable DTNomina)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder SbErrores = new StringBuilder();
|
||||
bool ErroresValidaciones = false;
|
||||
|
||||
|
||||
|
||||
SbErrores.AppendLine("Se detectaron los siguientes errores en la generación del layout");
|
||||
|
||||
foreach (DataRow dRow in DTNomina.Rows)
|
||||
{
|
||||
string RFC = dRow["RFC"].ToString();
|
||||
string Nombre = dRow["Nombre"].ToString();
|
||||
string BancoNumCuenta = dRow["BancoNumCuenta"].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 (BancoNumCuenta.Trim().Length != 10)
|
||||
{
|
||||
SbErrores.AppendLine($"Empleado {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
|
||||
ErroresValidaciones = true;
|
||||
}
|
||||
}
|
||||
|
||||
ErroresValidaciones = false;
|
||||
|
||||
if (!ErroresValidaciones)
|
||||
{
|
||||
int Count = 1;
|
||||
foreach (DataRow dRow in DTNomina.Rows)
|
||||
{
|
||||
StringBuilder SbLinea = new StringBuilder();
|
||||
|
||||
string RFC = dRow["RFC"].ToString();
|
||||
string Nombre = dRow["Nombre"].ToString();
|
||||
string BancoNumCuenta = dRow["BancoNumCuenta"].ToString();
|
||||
decimal Importe = dRow["Importe"].ToString().ToDecimal().RoundSQL(2);
|
||||
|
||||
SbLinea.Append(Count.ToString("000000000"));
|
||||
SbLinea.Append(RFC.Trim().PadRight(16));
|
||||
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");
|
||||
|
||||
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{DateTime.Now.ToString("yyyyMMddhhmmss").ToString()}.txt\"");
|
||||
Response.AppendHeader("Content-Disposition", $"attachment;filename=\"Nomina {DdlPeriodo.SelectedItem.Text }.txt\"");
|
||||
Response.Write(sb.ToString());
|
||||
Response.End();
|
||||
}
|
||||
else
|
||||
Alert(SbErrores.ToString(), TipoMensaje.MsgAdvertencia);
|
||||
}
|
||||
protected void LnkLayoutContable_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
using (ClsNominas objnom = new ClsNominas())
|
||||
{
|
||||
if (objnom.GetDispersionnomina(CvePeriodoSeleccionado, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
CrearLayout(objnom.DtResultados);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void LnkAsistenciaIncidencias_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -8204,4 +8105,259 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
this.Alert("El Vacaciones_Empresas Se ha Eliminado");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region Layouts
|
||||
|
||||
protected void LnkLayoutContable_Click(object sender, EventArgs e)
|
||||
{
|
||||
RBLModalBancosLayout.SelectedValue = "1";
|
||||
DdlModalBancosLayout.SelectedValueExist("-1");
|
||||
this.RegistraScript("$('#ModalLayoutBancos').modal('show');");
|
||||
UpModalBancosLayout.Update();
|
||||
}
|
||||
|
||||
|
||||
protected void RBLModalBancosLayout_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void BtnModalBancosProcesar_Click(object sender, EventArgs e)
|
||||
{
|
||||
if(RBLModalBancosLayout.SelectedValue.ToEntero() == 1)
|
||||
{
|
||||
if (DdlModalBancosLayout.SelectedValue.ToEntero() == 1)
|
||||
{
|
||||
using (ClsNominas objnom = new ClsNominas())
|
||||
{
|
||||
if (objnom.GetDispersionnomina(CvePeriodoSeleccionado, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
CrearLayoutNominaBancomer(objnom.DtResultados);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if (DdlModalBancosLayout.SelectedValue.ToEntero() == 2)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
else if (RBLModalBancosLayout.SelectedValue.ToEntero() == 2)
|
||||
{
|
||||
if(DdlModalBancosLayout.SelectedValue.ToEntero() == 1 )
|
||||
{
|
||||
|
||||
}
|
||||
else if (DdlModalBancosLayout.SelectedValue.ToEntero() == 2)
|
||||
{
|
||||
//Banorte
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void CrearLayoutNominaBancomer(DataTable DTNomina)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder SbErrores = new StringBuilder();
|
||||
bool ErroresValidaciones = false;
|
||||
|
||||
|
||||
SbErrores.AppendLine("Se detectaron los siguientes errores en la generación del layout");
|
||||
|
||||
foreach (DataRow dRow in DTNomina.Rows)
|
||||
{
|
||||
string RFC = dRow["RFC"].ToString();
|
||||
string Nombre = dRow["Nombre"].ToString();
|
||||
string BancoNumCuenta = dRow["BancoNumCuenta"].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 (BancoNumCuenta.Trim().Length != 10)
|
||||
{
|
||||
SbErrores.AppendLine($"Empleado {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
|
||||
ErroresValidaciones = true;
|
||||
}
|
||||
}
|
||||
|
||||
ErroresValidaciones = false;
|
||||
|
||||
if (!ErroresValidaciones)
|
||||
{
|
||||
int Count = 1;
|
||||
foreach (DataRow dRow in DTNomina.Rows)
|
||||
{
|
||||
StringBuilder SbLinea = new StringBuilder();
|
||||
|
||||
string RFC = dRow["RFC"].ToString();
|
||||
string Nombre = dRow["Nombre"].ToString();
|
||||
string BancoNumCuenta = dRow["BancoNumCuenta"].ToString();
|
||||
decimal Importe = dRow["Importe"].ToString().ToDecimal().RoundSQL(2);
|
||||
|
||||
SbLinea.Append(Count.ToString("000000000"));
|
||||
SbLinea.Append(RFC.Trim().PadRight(16));
|
||||
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");
|
||||
|
||||
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{DateTime.Now.ToString("yyyyMMddhhmmss").ToString()}.txt\"");
|
||||
Response.AppendHeader("Content-Disposition", $"attachment;filename=\"Nomina {DdlPeriodo.SelectedItem.Text }.txt\"");
|
||||
Response.Write(sb.ToString());
|
||||
this.RegistraScript("$('#ModalLayoutBancos').modal('hide');");
|
||||
Response.Flush();
|
||||
Response.End();
|
||||
}
|
||||
else
|
||||
Alert(SbErrores.ToString(), TipoMensaje.MsgAdvertencia);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void CrearLayoutAltaBanorte(DataTable DTNomina, string Promotor, string NIE, string RazonSocial)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilder SbErrores = new StringBuilder();
|
||||
bool ErrorProceso = false;
|
||||
|
||||
|
||||
|
||||
Promotor = Promotor.Trim();
|
||||
NIE = NIE.Trim();
|
||||
RazonSocial = RazonSocial.Trim();
|
||||
|
||||
//SbErrores.AppendLine("Se detectaron los siguientes errores en la generación del layout");
|
||||
|
||||
|
||||
|
||||
if (DTNomina.Rows.Count > 0)
|
||||
{
|
||||
|
||||
//Tip oRegistro 1 1-1
|
||||
//Clave servicio 2 2-3
|
||||
sb.Append($"HNE");
|
||||
|
||||
|
||||
//Promotor 8 4-11
|
||||
if (Promotor.Length > 0 && Promotor.Length <= 8)
|
||||
{
|
||||
sb.Append(Promotor.PadLeft(8, '0'));
|
||||
}
|
||||
else
|
||||
{
|
||||
SbErrores.AppendLine($"Promotor {Promotor} debe de tener una logitud de entre 1 y 8<br/>");
|
||||
ErrorProceso = true;
|
||||
}
|
||||
|
||||
//NIE 5 12-26
|
||||
if (ErrorProceso == false && NIE.Length > 0 && NIE.Length <= 5)
|
||||
{
|
||||
sb.Append(NIE.PadLeft(5, ' '));
|
||||
}
|
||||
else
|
||||
{
|
||||
SbErrores.AppendLine($"NIE {NIE} debe de tener una NIE de entre 1 y 8<br/>");
|
||||
ErrorProceso = true;
|
||||
}
|
||||
|
||||
|
||||
//Nombre de Empresa ó Razón Social 40 17-56
|
||||
if (ErrorProceso == false && RazonSocial.Length > 0 && RazonSocial.Length <= 40)
|
||||
{
|
||||
sb.Append(RazonSocial.PadLeft(40, ' '));
|
||||
}
|
||||
else
|
||||
{
|
||||
SbErrores.AppendLine($"RazonSocial {RazonSocial} debe de tener una NIE de entre 1 y 40<br/>");
|
||||
ErrorProceso = true;
|
||||
}
|
||||
|
||||
//57-58consecutivo 1
|
||||
sb.Append("1");
|
||||
|
||||
|
||||
//Número de registros N 6 59-64
|
||||
sb.Append(DTNomina.Rows.ToString().PadRight(6, ' '));
|
||||
|
||||
//Filler A 283 65-347
|
||||
sb.Append(DTNomina.Rows.ToString().PadLeft(283, ' '));
|
||||
|
||||
|
||||
|
||||
if (!ErrorProceso)
|
||||
{
|
||||
foreach (DataRow dRow in DTNomina.Rows)
|
||||
{
|
||||
|
||||
|
||||
string CodigoEmpleado = dRow["CodigoEmpleado"].ToString().Trim();
|
||||
|
||||
//Tipo de registro A 1 1-1
|
||||
sb.AppendLine("D");
|
||||
|
||||
|
||||
//CodigoEmpleado A 10 2-11
|
||||
if (ErrorProceso == false && CodigoEmpleado.Length > 0 && CodigoEmpleado.Trim().Length <= 10)
|
||||
{
|
||||
sb.Append(CodigoEmpleado.PadLeft(10, '0'));
|
||||
}
|
||||
else
|
||||
{
|
||||
SbErrores.AppendLine($"RazonSocial {RazonSocial} debe de tener una NIE de entre 1 y 40<br/>");
|
||||
ErrorProceso = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user