From 54981499aee7d15fe1e891b0bf80b2867376bdb3 Mon Sep 17 00:00:00 2001 From: JORGE LUIS CAUDILLO ESPARZA Date: Wed, 29 Dec 2021 14:42:13 -0700 Subject: [PATCH] --- App_Code/ClsNominas.vb | 40 ++++++ Bancos/RepIE.aspx | 4 +- Compras/PopUpVerFactura.aspx.vb | 51 ++++++- GPS/EmbarqueManifiesto.rdlc | 238 ++++++++++++++++++++------------ Nomina/CalculoISRAnual.aspx | 178 ++++++++++++++++++++---- Nomina/CalculoISRAnual.aspx.cs | 211 +++++++++++++++++++++++++++- RH/CalculoSBC.aspx.cs | 3 +- vwd.webinfo | 6 + 8 files changed, 603 insertions(+), 128 deletions(-) diff --git a/App_Code/ClsNominas.vb b/App_Code/ClsNominas.vb index ed48b6e96..b3cf9ba5b 100644 --- a/App_Code/ClsNominas.vb +++ b/App_Code/ClsNominas.vb @@ -174,6 +174,46 @@ Public Class ClsNominas End Sub #End Region + Public Function AutorizaCalculoAnual(CveEmpresa As Integer, CveUsuario As Integer, PersonalXml As String) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_Nom_AutorizaCalculoAnual", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@PersonalXml", SqlDbType.Xml).Value = If(String.IsNullOrEmpty(PersonalXml), DBNull.Value, DirectCast(PersonalXml, Object)) + End With + Try + SqlAdapter.Fill(Data) + retorno = True + Catch Ex1 As SqlException + + Me.OnError("Ocurrió un error al aplicar calculo anual.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Catch ex As Exception + OnError("Ocurrió un error al obtener los agro departamentos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return retorno + End Function + Public Function PersonalAplicaCalculoAnual(CveEmpresa As Integer, CveUsuario As Integer, CvePersonal As Integer, Aplica As Integer, motivo As String) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_Nom_PersonalAplicaCalculoAnual", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@Aplica", SqlDbType.Int).Value = Aplica + .Add("@Motivo", SqlDbType.VarChar).Value = motivo + End With + Try + SqlAdapter.Fill(Data) + retorno = True + Catch Ex1 As SqlException + + Me.OnError("Ocurrió un error al aplicar calculo anual.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Catch ex As Exception + OnError("Ocurrió un error al obtener los agro departamentos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return retorno + End Function #Region "ClsNominas_Nominas" Public Function NominaUpMetododepago(cveEmpresa As Integer, CvePersonal As Integer, CvePeriodo As Integer, MetodoPagoFijo As Boolean, diff --git a/Bancos/RepIE.aspx b/Bancos/RepIE.aspx index ae5d9e704..d44810e5d 100644 --- a/Bancos/RepIE.aspx +++ b/Bancos/RepIE.aspx @@ -329,8 +329,8 @@
- " style="display: inline-block; margin-right: -20px; width: 150px;" /> - " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> + " style="display: inline-block; margin-right: -20px; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info">
diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index bbeb59cd2..9cb7e9dd9 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -194,7 +194,8 @@ Partial Class PopUpVerFactura If UrlParametros("OP") IsNot Nothing AndAlso UrlParametros("OP").ToString <> "" Then SeleccionaReporte(UrlParametros) End If - End If + End If + If Request("onlyPrint") IsNot Nothing Then If Request("onlyPrint").ToString() = "Pallet" Then imprimirpallet2(Request("CvePallet").ToString.ToEntero()) @@ -216,6 +217,16 @@ Partial Class PopUpVerFactura Dim SubProyecto As String = "" Dim AgenciaAduanalUSA As String = "" Dim AgenciaAduanalMEX As String = "" + Dim Temperatura As String = "" + Dim Hora As String = "" + Dim Chofer As String = "" + Dim CamPlaca As String = "" + Dim Camion As String = "" + Dim Rem1Placa As String = "" + Dim Remolque1 As String = "" + Dim NoPallets As String = "" + Dim NoBultos As String = "" + Dim NoKgManifiesto As String = "" Dim tablaReporte As New DataTable 'Envase = "1 1/9" @@ -227,13 +238,34 @@ Partial Class PopUpVerFactura If objnom.PA_AGRO_Embarque_ManifiestoGet(-1, -1, -1, cveEmbarqueManifiesto) And objnom.DtResultados.Rows.Count > 0 Then Dim row As DataRow = objnom.DtResultados.Rows(0) NoEmbarque = row("NoEmbarque").ToString() - Fecha = row("Fecha").ToString() + Fecha = String.Format("{0:dd/MM/yyyy}", row("Fecha")) SubProyecto = row("SubProyecto").ToString() AgenciaAduanalUSA = row("AgenciaAduanalUSA").ToString() AgenciaAduanalMEX = row("AgenciaAduanalMEX").ToString() + Temperatura = row("Temperatura").ToString() + Hora = String.Format("{0:hh }:{0:mm }:{0:ss tt}:", row("FechaIng")) + Chofer = row("Chofer").ToString() + CamPlaca = row("CamPlaca").ToString() + Camion = String.Format("{0} {1}", row("CamAnio"), row("CamEspecificacion")) + Rem1Placa = row("Rem1Placa").ToString() + Remolque1 = String.Format("{0} {1}", row("Rem1Anio"), row("Rem1Especificacion")) + If row("CveCamionRemolque1").ToString() = "1" Then + Rem1Placa = "12-TF-5E" + Remolque1 = "Remolque 1" + Else + Rem1Placa = "15-TF-7f" + Remolque1 = "Remolque 2" + End If + + If objnom.PA_Agro_Embarque_PalletGet(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, cveEmbarqueManifiesto, -1) And objnom.DtResultados.Rows.Count > 0 Then + NoPallets = objnom.DtResultados.Rows.Count.ToString() + NoKgManifiesto = objnom.DtResultados.SUM("Peso").ToString("N2") + NoBultos = objnom.DtResultados.SUM("NoCajas").ToString("N0") + tablaReporte = objnom.DtResultados + End If End If - + 'Remolque 1 12-TF-5E' }, { cveCamion: 2, placa: 'Remolque 2 15-TF-7f End Using Dim params As New List(Of ReportParameter) params.Add(New ReportParameter("NoEmbarque", NoEmbarque)) @@ -241,9 +273,18 @@ Partial Class PopUpVerFactura params.Add(New ReportParameter("SubProyecto", SubProyecto)) params.Add(New ReportParameter("AgenciaAduanalUSA", AgenciaAduanalUSA)) params.Add(New ReportParameter("AgenciaAduanalMEX", AgenciaAduanalMEX)) - params.Add(New ReportParameter("Temperatura", "45")) + params.Add(New ReportParameter("Temperatura", Temperatura)) + params.Add(New ReportParameter("Hora", Hora)) + params.Add(New ReportParameter("Chofer", Chofer)) + params.Add(New ReportParameter("CamPlaca", CamPlaca)) + params.Add(New ReportParameter("Camion", Camion)) + params.Add(New ReportParameter("Rem1Placa", Rem1Placa)) + params.Add(New ReportParameter("Remolque1", Remolque1)) + params.Add(New ReportParameter("NoBultos", NoBultos)) + params.Add(New ReportParameter("NoPallets", NoPallets)) + params.Add(New ReportParameter("NoKgManifiesto", NoKgManifiesto)) @@ -1609,7 +1650,7 @@ Partial Class PopUpVerFactura Timbre.Comprobante.FormadePago = Obj.FormaPagoSAT33 Timbre.Comprobante.CondicionesdePago = Obj.FormaPago33 Timbre.Comprobante.MetodoPago = Obj.ClaveMetodoPagoSAT - Timbre.Comprobante.Subtotal = Obj.SubTotal + Timbre.Comprobante.SubTotal = Obj.SubTotal Timbre.Comprobante.Descuentos = Obj.Descuento Timbre.Comprobante.Moneda = Obj.MonedaSAT Timbre.Comprobante.TipoCambio = If(Obj.CveMoneda = 1, "1", Obj.TipoCambio.ToString) diff --git a/GPS/EmbarqueManifiesto.rdlc b/GPS/EmbarqueManifiesto.rdlc index ce19a6260..9a570754e 100644 --- a/GPS/EmbarqueManifiesto.rdlc +++ b/GPS/EmbarqueManifiesto.rdlc @@ -303,7 +303,7 @@ - 06:44:07 p. m. + =Parameters!Hora.Value @@ -506,7 +506,7 @@ - Textbox496 + Textbox4 @@ -614,14 +614,14 @@ - + true true - 18,172.00 + =Parameters!NoKgManifiesto.Value @@ -632,7 +632,7 @@ - Textbox499 + Textbox8 @@ -874,14 +874,14 @@ - + true true - 20 + =Parameters!NoPallets.Value @@ -892,7 +892,7 @@ - Textbox508 + Textbox6 @@ -2768,7 +2768,7 @@ - + =Parameters!Chofer.Value @@ -3188,7 +3188,13 @@ - 45 °F + =Parameters!Temperatura.Value + + + + °F @@ -3327,7 +3333,7 @@ - + =Parameters!CamPlaca.Value @@ -3389,7 +3395,7 @@ - + =Parameters!Camion.Value @@ -3475,14 +3481,14 @@ - + true true - LCT-03 + =Parameters!Remolque1.Value @@ -3493,7 +3499,7 @@ - Textbox157 + Textbox9 @@ -3541,14 +3547,14 @@ - + true true - 67-UA-1Z + =Parameters!Rem1Placa.Value @@ -3559,7 +3565,7 @@ - Textbox222 + Textbox10 @@ -5364,7 +5370,7 @@ - =Parameters!AgenciaAduanalUSA.Value + =Parameters!AgenciaAduanalMEX.Value @@ -5470,7 +5476,7 @@ - =Parameters!AgenciaAduanalMEX.Value + =Parameters!AgenciaAduanalUSA.Value @@ -7167,21 +7173,21 @@ - + true true - + =Fields!NoPallets.Value + + 2pt + 2pt + 2pt + 2pt + + + true + + + + + + true + true + + + + + =Fields!Etiqueta.Value + - - 2pt - 2pt - 2pt - 2pt - - - - - - - - true - true - - - - - 1 1/9 GROWER - - + Calculo ISR anual - + - +
  • - Excel + Excel
  • -
    - - - - + - +
  • + Autoriza +
  • +
    +
    +
    + + + + + + + +
    +
    +
    +
    + +
    + +
    +
    + + +
    + +
    +
    +
    + <%----%> +
    +
    + +
    +
    +
    + + + + + + <%# Eval("Aplica").ToString() =="1" ?"✓" :"✘" %> + + + + + + + - + + + + + + + @@ -38,47 +92,52 @@ - + - + - + - + - + + + + + + - + - + - + - + - + @@ -89,7 +148,72 @@ + + + + +
    - + diff --git a/Nomina/CalculoISRAnual.aspx.cs b/Nomina/CalculoISRAnual.aspx.cs index 624902bf0..4392add3e 100644 --- a/Nomina/CalculoISRAnual.aspx.cs +++ b/Nomina/CalculoISRAnual.aspx.cs @@ -1,25 +1,57 @@ using System; using System.Collections.Generic; +using System.Data; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; +using System.Xml.Linq; +using Extensiones; public partial class Nomina_CalculoISRAnual : ClsPaginas { + + protected int CvePersonal + { + get + { + if (ViewState["CvePersonal"] == null) { return 0; } + else { return ViewState["CvePersonal"].ToString().ToEntero(); } + } + + set { ViewState["CvePersonal"] = value; } + } + protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { + cargaddls(); CargaCalculoISRAnual(); } } + public void cargaddls() + { + + DataTable dtejercicio = new DataTable(); + using (ClsNominas objnom = new ClsNominas()) + { + if (objnom.GetEjercicios(UsuarioActual.CveEmpresa)) + { + dtejercicio = objnom.DtResultados; + } + } + DdlEjercicios.DataSource = dtejercicio; + DdlEjercicios.DataBind(); + string anio = DateTime.Now.Year.ToString(); + DdlEjercicios.SelectedValueExistInsert(anio, anio); + } protected void CargaCalculoISRAnual() { using (ClsNominas onom = new ClsNominas()) { - onom.CalculoISRAnual(2021, UsuarioActual.Empresa.CveEmpresa); + onom.CalculoISRAnual(DdlEjercicios.SelectedValue.ToEntero(), UsuarioActual.Empresa.CveEmpresa); GVCalculoISRAnual.DataSource = onom.DtResultados; } @@ -27,8 +59,185 @@ public partial class Nomina_CalculoISRAnual : ClsPaginas upDatos.Update(); } + protected void LnkConsultar_Click(object sender, EventArgs e) + { + CargaCalculoISRAnual(); + } protected void LnkdownExcel_Click(object sender, EventArgs e) { + + //DataTable dtCon = generateTable("\r\n"); + + + ClosedXML.Excel.XLWorkbook wb = new ClosedXML.Excel.XLWorkbook(); + var libro = wb.AddWorksheet("Asistencia"); + int column = 1; + + int row = 1; + + libro.Cell(row, column++).Value = "Aplica"; + libro.Cell(row, column++).Value = "Causa"; + libro.Cell(row, column++).Value = "Código"; + libro.Cell(row, column++).Value = "Nombre"; + libro.Cell(row, column++).Value = "Tipo ingreso"; + libro.Cell(row, column++).Value = "Ingresos totales"; + libro.Cell(row, column++).Value = "Base gravada"; + libro.Cell(row, column++).Value = "Base exenta"; + libro.Cell(row, column++).Value = "ISR retenido"; + libro.Cell(row, column++).Value = "Art 152"; + libro.Cell(row, column++).Value = "Subs. Correspondiente"; + libro.Cell(row, column++).Value = "Impuesto anual"; + libro.Cell(row, column++).Value = "A cargo"; + libro.Cell(row, column++).Value = "A compensar"; + libro.Range(row, 1, row, column - 1).CellsUsed().Style.Font.FontColor = ClosedXML.Excel.XLColor.White; + libro.Range(row, 1, row, column - 1).CellsUsed().Style.Fill.SetBackgroundColor(ClosedXML.Excel.XLColor.FromArgb(79, 129, 189)); + row++; + using (ClsNominas onom = new ClsNominas()) + { + if (onom.CalculoISRAnual(DdlEjercicios.SelectedValue.ToEntero(), UsuarioActual.Empresa.CveEmpresa) && onom.DtResultados.Rows.Count > 0) + { + foreach (DataRow drow in onom.DtResultados.Rows) + { + + column = 1; + libro.Cell(row, column++).Value = drow["Aplica"].ToString()=="1"?"Si":"No"; + libro.Cell(row, column++).Value = drow["causa"]; + libro.Cell(row, column++).Value = drow["Codigo"]; + libro.Cell(row, column++).Value = drow["NombreCompleto"]; + libro.Cell(row, column++).Value = string.Format("{0} - {1:dd/MM/yyyy}", drow["TipoIngreso"], drow["FechaInicio"]); + libro.Cell(row, column++).Value = drow["IngresosTotales"]; + libro.Cell(row, column++).Value = drow["BaseGravada"]; + libro.Cell(row, column++).Value = drow["BaseExcenta"]; + libro.Cell(row, column++).Value = drow["ISRRetenido"]; + libro.Cell(row, column++).Value = drow["Art152"]; + libro.Cell(row, column++).Value = drow["SubsCorrespondiente"]; + libro.Cell(row, column++).Value = drow["ImpuestoAnual"]; + libro.Cell(row, column++).Value = drow["Acargo"]; + libro.Cell(row, column++).Value = drow["Acompensar"]; + row++; + } + } + } + + libro.SheetView.Freeze(1, 4); + libro.ColumnsUsed().AdjustToContents(); + libro.Range(1, 6, 1, column).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Center; + libro.Range(2, 6, row, column).Style.Alignment.Horizontal = ClosedXML.Excel.XLAlignmentHorizontalValues.Right; + libro.Range(2, 6, row, column).SetDataType(ClosedXML.Excel.XLDataType.Number); + libro.Range(2, 6, row, column).Style.NumberFormat.Format = "$#,###,###,###,###,###,0.00"; + + + System.IO.Stream fs = new System.IO.MemoryStream(); + wb.SaveAs(fs); + fs.Position = 0; + System.IO.MemoryStream memoryStream = new System.IO.MemoryStream(); + using (System.IO.Stream input = fs) + + { + input.CopyTo(memoryStream); + } + 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", "Calculo Anual")); + Response.BinaryWrite(memoryStream.ToArray()); + Response.End(); + } + + + protected void LnkAplicar_Click(object sender, EventArgs e) + { + GridViewRow gvrow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CvePersonal = gvrow.DataKey("CvePersonal").ToString().ToEntero(); + using (ClsNominas onom = new ClsNominas()) + { + if (onom.PersonalAplicaCalculoAnual(UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, CvePersonal, 1, "")) + { + Alert("El empleado sera incluido al calculo anual"); + CargaCalculoISRAnual(); + } + } + } + + protected void LnkCancelar_Click(object sender, EventArgs e) + { + GridViewRow gvrow = (GridViewRow)(((LinkButton)sender).NamingContainer); + CvePersonal = gvrow.DataKey("CvePersonal").ToString().ToEntero(); + RegistraScript("$('#DModalcancelarEmpleado').modal();"); + } + + protected void LnkGuardarCancelarAplica_Click(object sender, EventArgs e) + { + using (ClsNominas onom = new ClsNominas()) + { + if(onom.PersonalAplicaCalculoAnual(UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, CvePersonal, 0, TxtMotivo.Text)) + { + Alert("El empleado sera omitido del calculo anual"); + RegistraScript("$('#DModalcancelarEmpleado').modal('hide');"); + CargaCalculoISRAnual(); + } + } + } + + protected void LnkOpenModalAutoriza_Click(object sender, EventArgs e) + { + using(ClsNominas onom = new ClsNominas()) + { + if (onom.GetConceptos(UsuarioActual.CveEmpresa, "-1", -1, -1, -1)) + { + DdlConceptoCargo.DataSource = onom.DtResultados; + DdlConceptoCompensar.DataSource = onom.DtResultados; + DdlConceptoCargo.DataBind(); + DdlConceptoCompensar.DataBind(); + DataRow drow = onom.DtResultados.FiltroPrimero(string.Format("CveSistema ={0}",46)); + if (drow != null) + { + DdlConceptoCargo.SelectedValueExist(drow["CveConcepto"]); + } + drow = null; drow = onom.DtResultados.FiltroPrimero(string.Format("CveSistema ={0}", 49)); + if (drow != null) + { + DdlConceptoCompensar.SelectedValueExist(drow["CveConcepto"]); + } + } + } + RegistraScript("$('#DModalAutoriza').modal();"); + UpAutorizaCalculo.Update(); + } + + protected void LnkAutoriza_Click(object sender, EventArgs e) + { + bool continuar = true; + + + System.Xml.Linq.XDocument xmlarchivos = new System.Xml.Linq.XDocument(); + XElement xfolder = new XElement("personal"); + foreach (GridViewRow item in GVCalculoISRAnual.Rows ) + { + XElement xempleado = new XElement("empleado"); + xempleado.SetAttributeValue("CvePersonal", item.DataKey("CvePersonal")); + xempleado.SetAttributeValue("ACarago", item.DataKey("Acargo")); + xempleado.SetAttributeValue("ACompensar", item.DataKey("Acompensar")); + + xfolder.Add(xempleado); + } + xmlarchivos.Add(xfolder); + string xmlpeople= xmlarchivos.ToString(); + + using (ClsNominas onom = new ClsNominas()) + { + continuar = onom.AutorizaCalculoAnual(UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, xmlpeople); + } + if (continuar) + { + Alert("El calculo a sido autorizado"); + RegistraScript("$('#DModalAutoriza').modal('hide');"); + } + + RegistraScript(string.Format("console.log('{0}');debugger", xmlpeople)); } } \ No newline at end of file diff --git a/RH/CalculoSBC.aspx.cs b/RH/CalculoSBC.aspx.cs index 85844e675..656215346 100644 --- a/RH/CalculoSBC.aspx.cs +++ b/RH/CalculoSBC.aspx.cs @@ -154,7 +154,8 @@ public partial class RH_CalculoSBC : ClsPaginas double SalarioDiarioSSNuevo = Math.Round(item.DataKey("SalarioDiarioSSNuevo").ToDouble(), 2); double SalarioVariableNuevo = item.DataKey("SalarioVariableNuevo").ToDouble(); double SalarioDiarioSS = Math.Round(item.DataKey("SalarioDiarioSS").ToDouble(), 2); - if (continuar && SalarioDiarioSSNuevo != SalarioDiarioSS && (continuar = objrh.UpdateSalarios(CvePersonal, fecha, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, SalarioDiario, SDINuevo, SalarioDiarioSSNuevo, SalarioDiario))) + if (continuar && SalarioDiarioSSNuevo != SalarioDiarioSS && + (continuar = objrh.UpdateSalarios(CvePersonal, fecha, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, SalarioDiario, SDINuevo, SalarioDiarioSSNuevo, SalarioDiario))) { } diff --git a/vwd.webinfo b/vwd.webinfo index 0461c6771..77f975b92 100644 --- a/vwd.webinfo +++ b/vwd.webinfo @@ -384,6 +384,12 @@ + + + + + +