--Layout para nomina banamex. inicial
This commit is contained in:
@@ -7198,11 +7198,11 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
}
|
||||
using (ClsNominas ObjMovt = new ClsNominas())
|
||||
{
|
||||
ObjMovt.GetMovtoPermanenteSaldos(UsuarioActual.CveEmpresa,SRCvePersonal, CcveMovtoPermanente);
|
||||
ObjMovt.GetMovtoPermanenteSaldos(UsuarioActual.CveEmpresa, SRCvePersonal, CcveMovtoPermanente);
|
||||
GVMovtoPermanenteSaldos.DataSource = ObjMovt.DtResultados;
|
||||
GVMovtoPermanenteSaldos.DataBind();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
CargaConcepto();
|
||||
DdlConcepto.SelectedValueExist(cveConcepto);
|
||||
TxtDescripcion.Text = descripcion.ToString();
|
||||
@@ -9829,7 +9829,8 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
{
|
||||
SinSelccion,
|
||||
Bancomer,
|
||||
Banorte
|
||||
Banorte,
|
||||
Banamex
|
||||
}
|
||||
|
||||
|
||||
@@ -9885,7 +9886,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
DdlCuenta.Items.Clear();
|
||||
DataTable DTCuentas = get_GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa: UsuarioActual.CveEmpresa).FiltraParametros(" CveTipoCuenta <> 1 AND UsaLayout = 'True' AND LEN(ConvenioPagoElectronico) > 0 ");
|
||||
DTCuentas.CaseSensitive = false;
|
||||
DdlCuenta.DataSource = DTCuentas.FiltraParametros(" Banco IN('BANCOMER','BANORTE','BBVA Bancomer','BBVA')");
|
||||
DdlCuenta.DataSource = DTCuentas.FiltraParametros(" Banco IN('BANCOMER','BANORTE','BBVA Bancomer','BBVA','BANAMEX')");
|
||||
DdlCuenta.DataBind();
|
||||
DdlCuenta.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
||||
DdlCuenta.SelectedValueExist("-1");
|
||||
@@ -9915,6 +9916,11 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
Banco = Bancos.Banorte;
|
||||
DivModalLayoutBancosFecha.Visible = true;
|
||||
}
|
||||
else if (DdlCuenta.SelectedItem.Text.ToUpper().Contains("BANAMEX"))
|
||||
{
|
||||
Banco = Bancos.Banamex;
|
||||
DivModalLayoutBancosFecha.Visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ConvenioPagoElectronico = string.Empty;
|
||||
@@ -10016,6 +10022,17 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if (Banco == Bancos.Banamex)
|
||||
{
|
||||
using (ClsNominas objnom = new ClsNominas())
|
||||
{
|
||||
if (objnom.GetDispersionnominaXLS(CvePeriodoSeleccionado, UsuarioActual.CveEmpresa))
|
||||
{
|
||||
CrearLayoutNominaBanamex(objnom.DtResultados.Copy());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10247,6 +10264,139 @@ public partial class Nomina_Nomina2 : ClsPaginas
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void CrearLayoutNominaBanamex(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;
|
||||
|
||||
//LAYOUT “C” FORMATOS PARA IMPORTACIÓN (TEF / TEF INTELAR)
|
||||
//DOC: https://www.banamex.com/resources/bancanets/premium/esp/contenedor/archivos/TEF_Version_C_PagosCobros_Masivos.pdf
|
||||
if (!ErroresValidaciones)
|
||||
{
|
||||
DataTable DTCuentas = get_GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa: UsuarioActual.CveEmpresa);
|
||||
DataRow RowCuenta = DTCuentas.FiltroPrimero($"CveCuenta={DdlCuenta.SelectedValue}");
|
||||
var ClaveMoneda = "001"; // PESOS MEXICANOS
|
||||
|
||||
//REGISTRO DE CONTROL - IMPORTACIÓN
|
||||
var TipoRegistro = "1";
|
||||
var NumeroCliente = ("111511111111").Trim().PadLeft(12, '0'); //CONVENIO
|
||||
|
||||
var Fecha = TxtModalLayoutBancosFecha.Text.ToDate();
|
||||
var FechaPago = $"{Fecha.Day.ToString().PadLeft(2, '0')}{Fecha.ToString("MM")}{Fecha.Year.ToString().Replace("20", "")}";
|
||||
var Secuencia = (1).ToString("0000");
|
||||
var RazonSocial = (UsuarioActual.Empresa.Empresa).Replace("-Prueba", "").Trim().PadRight(36);
|
||||
var Descripcion = ("TEST").Trim().PadRight(20);
|
||||
var Naturaleza = "12"; //= 12 Pagos interbancarios CLABE, 05 Nomina banamex
|
||||
var Instrucciones = ("").Trim().PadRight(40);
|
||||
var Version = "C";
|
||||
var Volumen = "0";
|
||||
var Caracteristicas = "1"; // 0= Si es modificable, 1 = Solo lectura
|
||||
|
||||
sb.AppendLine($"{TipoRegistro}{NumeroCliente}{FechaPago}{Secuencia}{RazonSocial}{Descripcion}{Naturaleza}{Instrucciones}{Version}{Volumen}{Caracteristicas}");
|
||||
|
||||
|
||||
//REGISTRO GLOBAL - IMPORTACIÓN
|
||||
var TipoReg2 = "2";
|
||||
var TipoOpe2 = "1"; //0 = Si es Abono, 1 = Si es Cargo
|
||||
var ImporteTotal = DTNomina.SUMD("Importe").ToString("0000000000000000.00").Replace(".", "");//16 enteros y 2 decimales
|
||||
var TipoCuenta = "01"; //CUENTA DE CHEQUES
|
||||
var Sucursal = "5555";
|
||||
var NumCuenta = ("9999999").Trim().PadLeft(20, '0'); //OBTENER DE BANCOS CUENTAS
|
||||
var Espacio = ("").Trim().PadRight(20);
|
||||
|
||||
sb.AppendLine($"{TipoReg2}{TipoOpe2}{ClaveMoneda}{ImporteTotal}{TipoCuenta}{Sucursal}{NumCuenta}{Espacio}");
|
||||
|
||||
//REGISTRO DE CARGOS O ABONOS INDIVIDUALES - IMPORTACIÓN
|
||||
int Count = 1;
|
||||
foreach (DataRow dRow in DTNomina.Rows)
|
||||
{
|
||||
var TipoReg3 = "3"; //Registro de Movtos. Individuales
|
||||
var TipoOpe3 = "0"; //0 = Si es Abono, 1 = Si es Cargo (solo aplica para cobros)
|
||||
|
||||
string Nombres = dRow["Nombres"].ToString().Replace("ñ,Ñ", "n").Replace("*,#,$,%,=,+", "");
|
||||
string APaterno = dRow["APaterno"].ToString().Replace("ñ,Ñ", "n").Replace("*,#,$,%,=,+", "");
|
||||
string AMaterno = dRow["AMaterno"].ToString().Replace("ñ,Ñ", "n").Replace("*,#,$,%,=,+", "");
|
||||
//string BancoNumCuenta = dRow["BancoNumCuenta"].ToString();
|
||||
|
||||
string CLABE = dRow["CLABE"].ToString();
|
||||
decimal Importe = dRow["Importe"].ToString().ToDecimal().RoundSQL(2);
|
||||
|
||||
var StrImporte = Importe.ToString("0000000000000000.00").Replace(".", "");
|
||||
var StrTipoCuenta = "01";// 01- Cheques / CLABE
|
||||
var StrCuenta = CLABE.Trim().PadLeft(20, '0');
|
||||
var ReferenciaAlfa = ("PAGO03072024NOM").PadRight(40); //No se ocupa si es nomina banamex
|
||||
var Beneficiario = ($"{Nombres},{APaterno}/{AMaterno}").PadRight(55);
|
||||
var Inst3 = ("").PadRight(40);
|
||||
var DescTEF = ("").PadRight(24);
|
||||
var ClaveBanco = ("0012").PadRight(4); //BANCOMER //No se ocupa si es nomina baname
|
||||
var ReferenciaNum = ("2222222").PadRight(7, '0'); //QUE TOME DE LA CvePersonal como folio
|
||||
var Plazo = "00"; // MISMO DIA
|
||||
|
||||
sb.AppendLine($"{TipoReg3}{TipoOpe3}{ClaveMoneda}{StrImporte}{StrTipoCuenta}{StrCuenta}{ReferenciaAlfa}{Beneficiario}{Inst3}{DescTEF}{ClaveBanco}{ReferenciaNum}{Plazo}00");
|
||||
|
||||
|
||||
Count = Count + 1;
|
||||
}
|
||||
|
||||
//REGISTRO DE TOTALES - IMPORTACIÓN
|
||||
var TipoReg4 = "4";
|
||||
var NumAbonos = Count.ToString("000000");
|
||||
var NumCargos = Count.ToString("000000");
|
||||
|
||||
sb.AppendLine($"{TipoReg4}{ClaveMoneda}{NumAbonos}{ImporteTotal}{NumCargos}{ImporteTotal}");
|
||||
|
||||
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.Write(sb.ToString());
|
||||
RegistraScript("$('#ModalLayoutBancos').modal('hide');");
|
||||
Response.Flush();
|
||||
Response.End();
|
||||
}
|
||||
else
|
||||
Alert(SbErrores.ToString(), TipoMensaje.MsgAdvertencia);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user