From 739834781e044baa2297fc3b0b2980f243c4e4b6 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 25 Jan 2023 14:52:54 -0700 Subject: [PATCH 1/7] Quitar boton de cancelar refacturada --- Ventas/RepCancelacionesPorRespuesta.aspx.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Ventas/RepCancelacionesPorRespuesta.aspx.cs b/Ventas/RepCancelacionesPorRespuesta.aspx.cs index 8269b0937..2811351fd 100644 --- a/Ventas/RepCancelacionesPorRespuesta.aspx.cs +++ b/Ventas/RepCancelacionesPorRespuesta.aspx.cs @@ -599,16 +599,16 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 1 && e.Row.DBCampo("CveEstatusFactura").ToString().ToEntero() == 23) { e.Row.FCLinkButton("LnkValidarRefac").Visible = false; - } + } if (e.Row.DBCampo("PuedeRefacturar") == "0" && e.Row.DBCampo("CveEstatusFactura") == "23" && e.Row.DBCampo("CveVentaSustitucion").ToEntero() > 0) { - if (e.Row.FCLinkButton("LnkCancelar")!= null) e.Row.FCLinkButton("LnkCancelar").Visible = true; + if (e.Row.FCLinkButton("LnkCancelar") != null) e.Row.FCLinkButton("LnkCancelar").Visible = true; //SOLO MOSTRAR SI LA FACTURA NUEVA ESTA EMITIDA - if (e.Row.DBCampo("CveEstatusRefacturacion") != "4" && e.Row.DBCampo("CveEstatusFacturaSustitucion") == "3") - { - if (e.Row.FCLinkButton("LnkCancelarFolioSustitucion") != null) e.Row.FCLinkButton("LnkCancelarFolioSustitucion").Visible = true; - } + //if (e.Row.DBCampo("CveEstatusRefacturacion") != "4" && e.Row.DBCampo("CveEstatusFacturaSustitucion") == "3") + //{ + // if (e.Row.FCLinkButton("LnkCancelarFolioSustitucion") != null) e.Row.FCLinkButton("LnkCancelarFolioSustitucion").Visible = true; + //} } } } From 17ab276f62a4651083e7994b67053ce06ebc3cbb Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 25 Jan 2023 14:54:46 -0700 Subject: [PATCH 2/7] Cambios de lineas adicionales, saldo por remisiones --- Ventas/Clientes.aspx | 190 ++++++++++++++++++++-------------------- Ventas/Clientes.aspx.vb | 151 ++++++++++++------------------- Ventas/Ventas.aspx.vb | 138 +++++++++++++++++++++++------ 3 files changed, 262 insertions(+), 217 deletions(-) diff --git a/Ventas/Clientes.aspx b/Ventas/Clientes.aspx index 97e44ab27..72c2b3aba 100644 --- a/Ventas/Clientes.aspx +++ b/Ventas/Clientes.aspx @@ -1643,20 +1643,20 @@
-
+
- Parametros + Parametros
- -
- + +
+
- +
@@ -1674,15 +1674,16 @@
- -
- - - - +
+ +
+ + + + +
-
@@ -1781,7 +1782,7 @@
- +
@@ -1789,7 +1790,7 @@
- +
@@ -1819,7 +1820,7 @@
- +
@@ -1835,25 +1836,25 @@
-
- +
-
-
-
- - -
-
+ +
-
- - +
+ + +
- +
+
+ + +
+
- +
@@ -1876,54 +1877,61 @@
- +
-
- -
- - - - - - +
+
+
+ + + + +
+ +
-
-
- - - - - - +
+
+
+ + + + +
+ +
-
-
- - - - +
+
+ +
+ + + + +
- - +
-
-
- - - - - - +
+
+
+ + + + +
+ +
@@ -1931,7 +1939,7 @@
- + @@ -1939,7 +1947,7 @@
- + @@ -1948,12 +1956,6 @@ - <%-- - - - - - --%>
@@ -1974,13 +1976,13 @@
-
- +
- +
@@ -1991,8 +1993,16 @@
+ Pago múltiples facturas Pagar múltiples facturas +   - + + " + style="display: inline-block; margin-right: -20px; width: 150px;" /> + " + style="margin-top: -3px; float: inherit;" class="btn btn-circle btn-sm label-info"> + @@ -2003,11 +2013,7 @@
-
-
- Pago múltiples facturas Pagar múltiples facturas      - -
+ <%--
-
+
--%>
@@ -2068,7 +2074,7 @@ - + @@ -2086,10 +2092,7 @@
-
- -
@@ -2102,6 +2105,11 @@ + " + style="display: inline-block; margin-right: -20px; width: 150px;" /> + " + style="margin-top: -3px; float: inherit;" class="btn btn-circle btn-sm label-info"> @@ -2111,15 +2119,7 @@
-
-
- " style="display: inline-block; margin-right: -20px; width: 150px;" /> - " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> -
- -
-
- +
diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index ebaf93626..759929266 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -513,7 +513,7 @@ Partial Class Clientes Set(value As Integer) ViewState("CveLineaAdicional") = value End Set - End Property + End Property Private Property FechaIngLineaAdicional As DateTime Get If ViewState("FechaIngLineaAdicional") Is Nothing Then @@ -526,13 +526,13 @@ Partial Class Clientes Set(value As DateTime) ViewState("FechaIngLineaAdicional") = value End Set - End Property - - - - + End Property + + + + #End Region - + #Region "Documentacion" Private Property DTDocumentacion As DataTable Get @@ -2964,14 +2964,14 @@ Partial Class Clientes #Region "G R I D V I E W S" Protected Sub GVHistorial_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVHistorial.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then - Dim HLSendMail As HtmlAnchor = DirectCast(e.Row.FindControl("HLSendMail"), HtmlAnchor) - 'Dim HLRemision As HtmlAnchor = DirectCast(e.Row.FindControl("HLRemision"), HtmlAnchor) - + Dim HLSendMail As HtmlAnchor = DirectCast(e.Row.FindControl("HLSendMail"), HtmlAnchor) + 'Dim HLRemision As HtmlAnchor = DirectCast(e.Row.FindControl("HLRemision"), HtmlAnchor) + If e.Row.RowIndex = 0 Then e.Row.BackColor = Drawing.Color.LightGray HLSendMail.Visible = False 'HLRemision.Visible = False - End If + End If Dim Liga As String = String.Format("< a class=""Texto"" href=""/Ventas/Ventas.aspx?CveVenta={0}"">", e.Row.DBCampo("CveVenta")) HLSendMail.HRef = String.Format("javascript:(function mail(){{$get('HdnTipoDocto').value='{0}';$get('HdnCveVenta').value='{1}';$get('HdnFolioVenta').value='{2}';$get('TxtParaMail').value='{3}';$get('HdnSerieFolio').value='{4}';$get('HdnSubProyecto').value='{5}';$('#ModalDivMail').modal();void(0);}})();", e.Row.DBCampo("TipoDocto"), e.Row.DBCampo("CveVenta"), e.Row.DBCampo("folio"), e.Row.DBCampo("Correo"), e.Row.DBCampo("SerieFolio"), e.Row.DBCampo("SubProyecto")) e.Row.FCLiteral("LtlFactura").Text = String.Format("{1}", e.Row.DBCampo("CveVenta"), e.Row.DBCampo("Folio")) @@ -2992,8 +2992,8 @@ Partial Class Clientes e.Row.Cells(7).Width = Unit.Pixel(90) e.Row.Cells(8).Width = Unit.Pixel(80) e.Row.Cells(9).Width = Unit.Pixel(70) - End If - + End If + If e.Row.DBCampo("Saldo").ToDouble < 0 Then e.Row.Cells(6).ForeColor = Drawing.Color.Red If e.Row.DBCampo("DiasVencidos").ToDouble > 0 AndAlso CType(sender, GridView).ID = "GvCxC" Then e.Row.Cells(4).ForeColor = Drawing.Color.Red If e.Row.DBCampo("Original").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlSaldoOriginal"), Literal).Text = "" @@ -4239,23 +4239,23 @@ Partial Class Clientes Try Dim File As Byte() If Archivo.Exists Then - Dim ArchivoSti As New System.IO.FileInfo(String.Format("{0}Formatos/RepClientesCxC.mrt", UsuarioActual.Empresa.Ruta)) - If ArchivoSti.Exists Then - Dim listass As New List(Of ReportParameter) - For Each item As CrystalParametro In lista - listass.Add(New ReportParameter(item.Nombre, item.Valor.ToString())) - Next - - Dim lrds As New List(Of ReportDataSource) - Dim rds As New ReportDataSource - rds.Name = "Datos" - rds.Value = DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha") - lrds.Add(rds) - - File = StreamBytesStimulsoft("Facturas", $"{UsuarioActual.Empresa.Ruta}Formatos/RepClientesCxC.mrt", lrds, listass, NombreArchivo:="Estado de cuenta", Formato:=Formato) - Else - File = ImprimirPDFCrystal($"{UsuarioActual.Empresa.Ruta}Formatos/RepClientesCxC.rpt", DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), lista, "Estado de cuenta", Formato) - End If + Dim ArchivoSti As New System.IO.FileInfo(String.Format("{0}Formatos/RepClientesCxC.mrt", UsuarioActual.Empresa.Ruta)) + If ArchivoSti.Exists Then + Dim listass As New List(Of ReportParameter) + For Each item As CrystalParametro In lista + listass.Add(New ReportParameter(item.Nombre, item.Valor.ToString())) + Next + + Dim lrds As New List(Of ReportDataSource) + Dim rds As New ReportDataSource + rds.Name = "Datos" + rds.Value = DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha") + lrds.Add(rds) + + File = StreamBytesStimulsoft("Facturas", $"{UsuarioActual.Empresa.Ruta}Formatos/RepClientesCxC.mrt", lrds, listass, NombreArchivo:="Estado de cuenta", Formato:=Formato) + Else + File = ImprimirPDFCrystal($"{UsuarioActual.Empresa.Ruta}Formatos/RepClientesCxC.rpt", DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), lista, "Estado de cuenta", Formato) + End If Else File = ImprimirPDFCrystal(Server.MapPath("~/Empresas/Grales/Formatos/RepClientesCxC.rpt"), DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), lista, "Estado de cuenta", Formato) End If @@ -4300,8 +4300,8 @@ Partial Class Clientes Dim listass As New List(Of ReportParameter) For Each item As CrystalParametro In lista listass.Add(New ReportParameter(item.Nombre, item.Valor.ToString())) - Next - ImprimirPDFStimulsoft($"{UsuarioActual.Empresa.Ruta}Formatos/RepClientesCxC.mrt", DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), listass, "Estado de cuenta", Formato) + Next + ImprimirPDFStimulsoft($"{UsuarioActual.Empresa.Ruta}Formatos/RepClientesCxC.mrt", DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), listass, "Estado de cuenta", Formato) Else ImprimirbytesPDF(ImprimirPDFCrystal($"{UsuarioActual.Empresa.Ruta}Formatos/RepClientesCxC.rpt", DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), lista, "Estado de cuenta", Formato), "Estado de cuenta", Formato) End If @@ -4353,8 +4353,8 @@ Partial Class Clientes Dim listass As New List(Of ReportParameter) For Each item As CrystalParametro In lista listass.Add(New ReportParameter(item.Nombre, item.Valor.ToString())) - Next - ImprimirPDFStimulsoft($"{UsuarioActual.Empresa.Ruta}Formatos/RepClientesCxC.mrt", DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), listass, "Estado de cuenta", Formato) + Next + ImprimirPDFStimulsoft($"{UsuarioActual.Empresa.Ruta}Formatos/RepClientesCxC.mrt", DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), listass, "Estado de cuenta", Formato) Else ImprimirbytesPDF(ImprimirPDFCrystal($"{UsuarioActual.Empresa.Ruta}Formatos/RepClientesCxC.rpt", DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), lista, "Estado de cuenta", Formato), "Estado de cuenta", Formato) End If @@ -4362,56 +4362,6 @@ Partial Class Clientes ImprimirbytesPDF(ImprimirPDFCrystal(Server.MapPath("~/Empresas/Grales/Formatos/RepClientesCxC.rpt"), DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), lista, "Estado de cuenta", Formato), "Estado de cuenta", Formato) End If End If - End Sub - - Public Sub ImprimirExcelStimulsoft(RutaReporte As String, DtDatos As DataTable, Parametros As List(Of ReportParameter), Optional NombreArchivo As String = "Reporte", Optional RDSName As String = "Datos", Optional Content_Disposition As String = "attachment") - Dim lrds As New List(Of ReportDataSource) - Dim rds As New ReportDataSource - rds.Name = RDSName - rds.Value = DtDatos - lrds.Add(rds) - - ImprimirbytesExcel(StreamBytesStimulsoft("Facturas", RutaReporte, lrds, Parametros, NombreArchivo:=NombreArchivo, Formato:="EXCEL"), NombreArchivo, "EXCEL", Content_Disposition:=Content_Disposition) - End Sub - Public Sub ImprimirbytesExcel(bytes As Byte(), Optional NombreArchivo As String = "Reporte", Optional Formato As String = "PDF", Optional Descarga As Boolean = False, Optional Content_Disposition As String = "attachment") - 'limpio ReportViwer - Dim mimeType As String = Nothing - Dim extension As String = Nothing - - 'If Descarga Then - ' Try - ' bytes = bytes - ' File.WriteAllBytes(String.Format("{0}PDF/whatever.gif", UsuarioActual.Empresa.Ruta), img) - ' Catch ex As Exception - ' If UsuarioActual.CveRol = 1 Then - ' Alert(ex.Message, TipoMensaje.MsgAdvertencia) - ' Else - ' Alert("Ocurrió un error al generar la descarga. Favor de contactar a soporte tecnico cod'IMPDFclspag'", TipoMensaje.MsgAdvertencia) - ' End If - ' End Try - 'End If - - Try - bytes = bytes - Response.Buffer = True - Response.Clear() - Response.ContentType = "application/vnd.ms-excel" - Response.ClearHeaders() - Response.AddHeader("content-disposition", String.Format("{0}; filename=""{1}.{2}""", Content_Disposition, NombreArchivo, If(Formato = "PDF", "pdf", "xlsx"))) - Response.BinaryWrite(bytes) ' create the file - Response.Flush() ' send it to the client to download - bytes = Nothing - HttpContext.Current.Response.SuppressContent = True - HttpContext.Current.ApplicationInstance.CompleteRequest() - 'HttpContext.Current.Response.End() - Catch ex As Exception - - If UsuarioActual.CveRol = 1 Then - Alert($"Error: {ex.Message} | Descripcion: {If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException IsNot Nothing AndAlso ex.InnerException.InnerException.Message IsNot Nothing, ex.InnerException.InnerException.Message, If(ex.InnerException IsNot Nothing AndAlso ex.InnerException.Message IsNot Nothing, ex.InnerException.Message, "Sin descripcion"))}", TipoMensaje.MsgAdvertencia) - Else - Alert("Ocurrió un error al generar la descarga. Favor de contactar a soporte tecnico cod:'IMPDFclspag'", TipoMensaje.MsgAdvertencia) - End If - End Try End Sub Private Sub MandaCorreoEstadoCuenta(CveUsuario As Integer, CveEmpresa As Integer, CveCliente As Integer, File As Byte(), Para As String, Asunto As String, Body As String, Optional GuardarBitacora As Boolean = False) @@ -7125,9 +7075,13 @@ Partial Class Clientes DdlIncoterm.DataBind() DdlClavePedimento.Items.Clear() - DdlClavePedimento.DataSource = GlobalDTClavePedimento() + Using ObjGrales As New ClsGenerales + If ObjGrales.GetSATClavePedimento() Then + DdlClavePedimento.DataSource = GlobalDTClavePedimento() + DdlClavePedimento.DataBind() + End If + End Using DdlClavePedimento.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlClavePedimento.DataBind() DdlMotivoTraslado.Items.Clear() DdlMotivoTraslado.DataSource = GlobalDTSATMotivoTraslado() @@ -9964,7 +9918,7 @@ Partial Class Clientes Alert("Puntuación Inicializada") End If Acum.Dispose() - End Sub + End Sub #End Region Protected Sub DdlTipoRetencion_SelectedIndexChanged(sender As Object, e As EventArgs) If UsuarioActual.Empresa.Funcionalidad(579) = "1" Then @@ -10506,11 +10460,16 @@ Partial Class Clientes ' Exit Sub 'End If + If DdlTipoLineaAdicionalModal.SelectedValue.ToEntero() <= 0 Then + Alert("Debe seleccionar el tipo de linea adicional", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + Dim ObjVentas As New ClsVentas - If CveLineaAdicional > 0 Then - - If DdlTipoLineaAdicionalModal.SelectedValue = "2" Then - TxtFechaVencimientoLineaAdicionalModal.Text = FechaIngLineaAdicional.AddDays(TxtDiasVencimientoLineaAdicionalModal.Text.ToEntero()).ToString("dd/MM/yyyy") + If CveLineaAdicional > 0 Then + + If DdlTipoLineaAdicionalModal.SelectedValue = "2" Then + TxtFechaVencimientoLineaAdicionalModal.Text = FechaIngLineaAdicional.AddDays(TxtDiasVencimientoLineaAdicionalModal.Text.ToEntero()).ToString("dd/MM/yyyy") End If If Not ObjVentas.UpdateLineasAdicionales(CveLineaAdicional, TxtLineaAdicionalModal.Text, CveCliente, DdlProveedorLineaAdicionalModal.SelectedValue.ToEntero, DdlTipoLineaAdicionalModal.SelectedValue.ToEntero, TxtImporteLineaAdicionalModal.Text.ToDecimal, @@ -10520,9 +10479,9 @@ Partial Class Clientes Else Alert("Linea Adicional Actualizada Correctamente") End If - Else - If DdlTipoLineaAdicionalModal.SelectedValue = "2" Then - TxtFechaVencimientoLineaAdicionalModal.Text = Now.AddDays(TxtDiasVencimientoLineaAdicionalModal.Text.ToEntero()).ToString("dd/MM/yyyy") + Else + If DdlTipoLineaAdicionalModal.SelectedValue = "2" Then + TxtFechaVencimientoLineaAdicionalModal.Text = Now.AddDays(TxtDiasVencimientoLineaAdicionalModal.Text.ToEntero()).ToString("dd/MM/yyyy") End If If Not ObjVentas.AddLineasAdicionales(TxtLineaAdicionalModal.Text, CveCliente, DdlProveedorLineaAdicionalModal.SelectedValue.ToEntero, DdlTipoLineaAdicionalModal.SelectedValue.ToEntero, TxtImporteLineaAdicionalModal.Text.ToDecimal, @@ -10551,7 +10510,7 @@ Partial Class Clientes CveLineaAdicional = GvRow.DataKey("CveLineaAdicional").ToEntero - FechaIngLineaAdicional = GvRow.DataKey("FechaIng").ToDateTime() + FechaIngLineaAdicional = GvRow.DataKey("FechaIng").ToDateTime() TxtLineaAdicionalModal.Text = GvRow.DataKey("LineaAdicional") DdlProveedorLineaAdicionalModal.txtText.Value = GvRow.DataKey("Proveedor") DdlProveedorLineaAdicionalModal.txtValue.Value = GvRow.DataKey("CveProveedor") @@ -10596,7 +10555,7 @@ Partial Class Clientes Protected Sub DdlTipoLineaAdicionalModal_SelectedIndexChanged(sender As Object, e As EventArgs) DvLineaAdicionalDiasVenciemientoModal.Visible = If(DdlTipoLineaAdicionalModal.SelectedValue.ToEntero = 2, True, False) - DvFechaVencimiento.Visible = If(DdlTipoLineaAdicionalModal.SelectedValue.ToEntero = 2, False, True) + DvFechaVencimiento.Visible = If(DdlTipoLineaAdicionalModal.SelectedValue.ToEntero = 2, False, True) UpLineaAdicionalmodal.Update() End Sub diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 6f69118b0..81acbd393 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -2280,6 +2280,14 @@ Partial Class Ventas ViewState("SaldoLineaAdicional") = value End Set End Property + Private Property SaldoIngresosLineaAdicional As Decimal + Get + Return (IfNull(ViewState("SaldoIngresosLineaAdicional"), "0", ViewState("SaldoIngresosLineaAdicional"))).ToString().ToDecimal() + End Get + Set(value As Decimal) + ViewState("SaldoIngresosLineaAdicional") = value + End Set + End Property Private Property CveCategoriaLineaAdicional As Integer Get @@ -2298,6 +2306,14 @@ Partial Class Ventas ViewState("CveMonedaLineaAdicional") = value End Set End Property + Private Property HabilitoFacturacionIngresoLineaAdicional As Boolean + Get + Return If(IsNothing(ViewState("HabilitoFacturacionIngresoLineaAdicional")), False, CType(ViewState("HabilitoFacturacionIngresoLineaAdicional"), Boolean)) + End Get + Set(value As Boolean) + ViewState("HabilitoFacturacionIngresoLineaAdicional") = value + End Set + End Property #End Region @@ -8839,6 +8855,11 @@ Partial Class Ventas Exit Sub End If + If DdlLineaAdicional.SelectedValue.ToEntero() > 0 AndAlso Not DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem") Then + Alert("No se puede seleccionar una linea adicional de crédito si no se genera una remisón.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + 'SI TIENE ANTICIPOS Y ESTA AMORTIZADO AL 100% EL DOCUMENTO (SALDO = 0) | NO VALIDA PU DEL CONCEPTO If Not (LblAmortizacion.Text.ToDouble > 0 And TxtTotal.Text.ToDouble <= 0) Then If Not DdlTipoComprobante.SelectedValue.Contiene("Ped", "Ant", "DPe") Then @@ -9057,18 +9078,6 @@ Partial Class Ventas Alert("El saldo de la linea adicional debe ser mayor a cero", TipoMensaje.MsgAdvertencia) Exit Sub End If - - 'VERIFICA QUE LA MONEDA DE LA LINEA ADICIONAL SEA LA MISMA QUE LA VENTA - If Me.CveMonedaLineaAdicional <> DdlMoneda.SelectedValue.ToEntero() Then - Alert("La moneda de la linea adicional de crédito debe ser la misma que la factura.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - 'VERIFICA QUE EL SALDO DISPONIBLE SEA MENOR AL IMPORTE - If Me.SaldoLineaAdicional <= TxtTotal.Text.ToDecimal() Then - Alert("El saldo de la linea adicional debe ser mayor o igual al de la factura", TipoMensaje.MsgAdvertencia) - Exit Sub - End If End If @@ -9406,6 +9415,30 @@ Partial Class Ventas Exit Sub End If + If UsuarioActual.Empresa.Funcionalidad(705) = "1" AndAlso DdlLineaAdicional.SelectedValue.ToEntero() > 0 Then + 'VERIFICA QUE LA MONEDA DE LA LINEA ADICIONAL SEA LA MISMA QUE LA VENTA + If Me.CveMonedaLineaAdicional <> ObjFactura.CveMoneda Then + Alert("La moneda de la linea adicional de crédito debe ser la misma que la factura.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + 'VERIFICA QUE EL SALDO DISPONIBLE SEA MENOR AL IMPORTE + If ObjFactura.TipoDocto = "Rem" AndAlso Me.SaldoLineaAdicional <= ObjFactura.Total Then + Alert("El saldo de la linea adicional debe ser mayor o igual al de la remisión", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + If ObjFactura.TipoDocto = "Ing" AndAlso (DtRemisionesPS Is Nothing OrElse DtRemisionesPS.Rows.Count = 0) Then + Alert("No se puede generar un ingreso con una linea adicional de credito si este no viene de una remisión", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + If ObjFactura.TipoDocto = "Ing" AndAlso Me.SaldoIngresosLineaAdicional <= ObjFactura.Total Then + Alert("El saldo de la linea adicional debe ser mayor o igual al de la factura", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + End If + 'If Not CveEmpresaCRM > 0 Then ' If ObjFactura.Cliente.AplicaComercioExterior Then ' If Not ValidaComercioExterior() Then @@ -18659,28 +18692,40 @@ Partial Class Ventas End Sub Private Sub CalculaLineasAdicionales() - If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem") AndAlso UsuarioActual.Empresa.Funcionalidad(705) = "1" Then + If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "PA") AndAlso UsuarioActual.Empresa.Funcionalidad(705) = "1" Then DdlLineaAdicional.DataSource = Nothing Using ObjVentas As New ClsVentas + 'SI ES VENTA EXISTENTE , SI SE VA EDITAR SOLO MOSTRAR LAS CON SALDO, FECHA DE VENCIMIENTO VIGENTE O LA LINEA ACTUAL If CveVenta > 0 Then - If ObjVentas.GetLineasAdicionalesSaldo(-1, CveCliente, -1, DdlMoneda.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, ConSaldo:=-1, FechaVencimientoConsulta:=MinFecha) Then + If ObjVentas.GetLineasAdicionalesSaldo(-1, CveCliente, -1, -1, UsuarioActual.CveEmpresa, ConSaldo:=-1, FechaVencimientoConsulta:=MinFecha) Then If ObjVentas.DtResultados.Rows.Count > 0 Then TrLineaAdicional.Visible = True DdlLineaAdicional.DataSource = ObjVentas.DtResultados.FiltraParametros($"(Saldo > 0 AND FechaVencimiento <= '{Now.ToString("dd/MM/yyyy")}') OR CveLineaAdicional = {Me.CveLineaAdicionalVenta}") End If End If Else - If ObjVentas.GetLineasAdicionalesSaldo(-1, CveCliente, -1, DdlMoneda.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, ConSaldo:=1, FechaVencimientoConsulta:=Now) Then - If ObjVentas.DtResultados.Rows.Count > 0 Then - TrLineaAdicional.Visible = True - DdlLineaAdicional.DataSource = ObjVentas.DtResultados + 'SI SE ESTA FACTURANDO UNA REMISION DEBE SELECCIONAR LA LINEA ADICIONAL DE ESTA + If Me.CveLineaAdicionalVenta > 0 Then + If ObjVentas.GetLineasAdicionalesSaldo(Me.CveLineaAdicionalVenta, CveCliente, -1, -1, UsuarioActual.CveEmpresa, ConSaldo:=-1, FechaVencimientoConsulta:=MinFecha) Then + If ObjVentas.DtResultados.Rows.Count > 0 Then + TrLineaAdicional.Visible = True + DdlLineaAdicional.DataSource = ObjVentas.DtResultados + End If + End If + Else + If ObjVentas.GetLineasAdicionalesSaldo(-1, CveCliente, -1, -1, UsuarioActual.CveEmpresa, ConSaldo:=1, FechaVencimientoConsulta:=Now) Then + If ObjVentas.DtResultados.Rows.Count > 0 Then + TrLineaAdicional.Visible = True + DdlLineaAdicional.DataSource = ObjVentas.DtResultados + End If End If End If End If End Using DdlLineaAdicional.DataBind() + DdlLineaAdicional.Items.Insert(0, New ListItem("Seleccione", "-1")) If Me.CveLineaAdicionalVenta > 0 Then @@ -31616,6 +31661,13 @@ Partial Class Ventas DdlMoneda.SelectedValue = GlobalDTMonedas.FiltroPrimeroValor("CveMoneda", $"Abreviatura = '{dtSeleccionadas.FiltroPrimeroValor("Abreviatura")}'") DdlMoneda.Enabled = False CambiaMoneda() + + If UsuarioActual.Empresa.Funcionalidad(705) = "1" Then + Me.CveLineaAdicionalVenta = dtSeleccionadas.FiltroPrimeroValor("CveLineaAdicional", "CveLineaAdicional > 0").ToEntero() + CalculaLineasAdicionales() + End If + + DdlUsoCFDI.SelectedValueExist(dtSeleccionadas.FiltroPrimeroValor("CveUsoCFDI")) DdlMetodoPago33.SelectedValueExist(dtSeleccionadas.FiltroPrimeroValor("CveMetodoPago")) CargaFormaPago(DdlMetodoPago33.SelectedValue.ToEntero()) @@ -36097,42 +36149,76 @@ Partial Class Ventas RBLPago.Enabled = False Using ObjVentas As New ClsVentas - If ObjVentas.GetLineasAdicionalesSaldo(DdlLineaAdicional.SelectedValue.ToEntero(), CveCliente, -1, DdlMoneda.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, FechaVencimientoConsulta:=MinFecha) Then + If ObjVentas.GetLineasAdicionalesSaldo(DdlLineaAdicional.SelectedValue.ToEntero(), CveCliente, -1, -1, UsuarioActual.CveEmpresa, FechaVencimientoConsulta:=MinFecha) Then If ObjVentas.DtResultados.Rows.Count > 0 Then Dim RowLinea As DataRow = ObjVentas.DtResultados.Rows(0) If RowLinea IsNot Nothing Then - TxtFechaPago.Text = RowLinea("FechaVencimiento").ToString().ToDateTime().ToString("dd/MM/yyyy") + If CveVenta <= 0 Then + TxtFechaPago.Text = RowLinea("FechaVencimiento").ToString().ToDateTime().ToString("dd/MM/yyyy") - 'AL FACTURAR CON LINEA ADICIONAL TIPO PO, SE SUMARÁN LOS DIAS DE VENCIMIENTO A LA FECHA ACTUAL - If RowLinea("TipoLinea").ToString() = "2" Then - TxtFechaPago.Text = Now.AddDays(RowLinea("DiasVencimiento").ToString().ToEntero()).ToString("dd/MM/yyyy") - TxtFechaPago.Enabled = False - imgCalendario.Visible = False + 'AL FACTURAR CON LINEA ADICIONAL TIPO PO, SE SUMARÁN LOS DIAS DE VENCIMIENTO A LA FECHA ACTUAL + If RowLinea("TipoLinea").ToString() = "2" Then + TxtFechaPago.Text = Now.AddDays(RowLinea("DiasVencimiento").ToString().ToEntero()).ToString("dd/MM/yyyy") + TxtFechaPago.Enabled = False + imgCalendario.Visible = False + End If + + TxtOrdenCompra.Text = RowLinea("LineaAdicionalComercializador").ToString() End If Me.CveCategoriaLineaAdicional = RowLinea("CveCategoria").ToString().ToEntero() Me.CveMonedaLineaAdicional = RowLinea("CveMoneda").ToString().ToEntero() Me.SaldoLineaAdicional = RowLinea("Saldo").ToString().ToDecimal() + Me.SaldoIngresosLineaAdicional = RowLinea("SaldoIngresos").ToString().ToDecimal() + + If CveVenta <= 0 Then + If DdlTipoComprobante.SelectedValue.Contiene("PA") Then + 'SI NO TIENE LA OPCION DE FACTURAR LA PERMITE + If DdlTipoComprobante.Items.FindByValue("Rem") Is Nothing Then + DdlTipoComprobante.Items.Insert(0, New ListItem("Remisión", "Rem")) + HabilitoFacturacionIngresoLineaAdicional = True + End If + DdlTipoComprobante.SelectedValueExist("Rem") + End If + End If + End If Else Alert("No se pudieron obtener datos de la linea adicional", TipoMensaje.MsgAdvertencia) Me.SaldoLineaAdicional = 0 + Me.SaldoIngresosLineaAdicional = 0 Me.CveCategoriaLineaAdicional = 0 End If Else Alert("No se pudieron obtener datos de la linea adicional", TipoMensaje.MsgAdvertencia) Me.SaldoLineaAdicional = 0 + Me.SaldoIngresosLineaAdicional = 0 Me.CveCategoriaLineaAdicional = 0 End If End Using Else Me.SaldoLineaAdicional = 0 + Me.SaldoIngresosLineaAdicional = 0 Me.CveCategoriaLineaAdicional = 0 - TxtFechaPago.Text = Now.ToString("dd/MM/yyyy") + + If CveVenta <= 0 Then + TxtFechaPago.Text = Now.ToString("dd/MM/yyyy") + TxtOrdenCompra.Text = "" + + 'SI SE HABILITO LA FACTURACION DESDE LA LINEA ADICIONAL DEBE QUITARLO + If HabilitoFacturacionIngresoLineaAdicional Then + DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Rem")) + DdlTipoComprobante.SelectedValueExist("PA") + + UpParametros.Update() + End If + End If + End If UpParametros.Update() UPCondicionesPago.Update() + UPObservaciones.Update() End Sub Protected Sub LnkUpdateLineaAdicional_Click(sender As Object, e As EventArgs) 'VALIDAR LINEAS ADICIONALES From c2de24b19e7b9091a9f66881eb635b5dc814ec81 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 25 Jan 2023 14:56:27 -0700 Subject: [PATCH 3/7] PrePolizde de movimiento de garantias, correcion de cancelacion de usados --- App_Code/Modelos.vb | 68 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 54 insertions(+), 14 deletions(-) diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb index 17861b78e..e6eeb845a 100644 --- a/App_Code/Modelos.vb +++ b/App_Code/Modelos.vb @@ -2109,10 +2109,10 @@ Namespace Modelos If DtMovimientos IsNot Nothing AndAlso DtMovimientos.Rows.Count > 0 Then For Each RowSalida As DataRow In DtMovimientos.Rows Dim Cantidad As Decimal = RowSalida("Cantidad").ToString().ToDecimal() * -1 - Dim Puntos As Decimal = RowSalida("Puntos").ToString().ToDecimal() + Dim Puntos As Decimal = RowSalida("Puntos").ToString().ToDecimal() * -1 - Dim ImporteCargo As Decimal = RowSalida("ImporteCargo").ToString().ToDecimal() - Dim ImporteBonificacion As Decimal = RowSalida("ImporteBonificacion").ToString().ToDecimal() + Dim ImporteCargo As Decimal = RowSalida("ImporteCargo").ToString().ToDecimal() * -1 + Dim ImporteBonificacion As Decimal = RowSalida("ImporteBonificacion").ToString().ToDecimal() * -1 Dim FacturadoBonificacion = False Dim CveVentaBonificacion As Integer = -1 @@ -2194,6 +2194,10 @@ Namespace Modelos For Each Dr As DataRow In factura.DtMovimientosUsados.Rows + If factura.EsGarantia Then + ImporteConcepto = Dr("PU").ToString().ToDecimal() + End If + If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, ImporteConcepto, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, Observaciones:=Dr("Observaciones").ToString, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then 'Mensaje = "Error al guardar los movimientos" Resultado = False @@ -2591,27 +2595,63 @@ Namespace Modelos CveMovimientoReferencia = CveMovimiento End If - If ObjInventario.GetMovimientosDetalle(CveMovimientoReferencia, UsuarioActual.CveEmpresa) Then - Dim Importe68 As Decimal = 0 + If ObjFactura.EsGarantia Then + If ObjInventario.GetMovimientosDetalle(CveMovimientoReferencia, UsuarioActual.CveEmpresa) Then + Dim Importe68 As Decimal = ObjInventario.DtResultados.SUMD("Total").RoundSQL * ValorMultiplicador - Dim IdCtaContable68 = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", $"CveAlmacen={CveAlmacen}").ToEntero + Dim IdCtaContable68 = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", $"CveAlmacen={CveAlmacen}").ToEntero - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovto68, Importe68, Referencia, 68, Concepto, FechaMovimiento, IdCtaContable68, -1, CveVenta:=CveVenta, CveMovimientoAlmacen:=CveMovimientoReferencia, ImporteMX:=Importe68, Contabilizable:=False) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovto68, Importe68, Referencia, 68, Concepto, FechaMovimiento, IdCtaContable68, -1, CveVenta:=CveVenta, CveMovimientoAlmacen:=CveMovimientoReferencia, ImporteMX:=Importe68, Contabilizable:=False) Then + ErrorPrepoliza = True + End If + + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 277, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then + ErrorPrepoliza = True + End If + + Dim Importe318 As Decimal = (Math.Abs(importeMovimiento) - Math.Abs(Importe68)) * ValorMultiplicador + + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, Importe318, Referencia, 318, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=Importe318, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then + ErrorPrepoliza = True + End If + + Else ErrorPrepoliza = True End If + Else + If ObjInventario.GetMovimientosDetalle(CveMovimientoReferencia, UsuarioActual.CveEmpresa) Then + Dim Importe68 As Decimal = 0 + Dim IdCtaContable68 = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", $"CveAlmacen={CveAlmacen}").ToEntero + + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovto68, Importe68, Referencia, 68, Concepto, FechaMovimiento, IdCtaContable68, -1, CveVenta:=CveVenta, CveMovimientoAlmacen:=CveMovimientoReferencia, ImporteMX:=Importe68, Contabilizable:=False) Then + ErrorPrepoliza = True + End If + + If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 277, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 278, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then + ErrorPrepoliza = True + End If + Else + ErrorPrepoliza = True + End If + + Else + ErrorPrepoliza = True + End If + End If + + Else + If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 277, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then + If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 278, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then + ErrorPrepoliza = True + End If Else ErrorPrepoliza = True End If End If - If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 277, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then - If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 278, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then - ErrorPrepoliza = True - End If - Else - ErrorPrepoliza = True - End If + importeMovimiento = 0 ObjFactura.SeGuardoPrePoliza = True From 1f73a40972c4cd92c7ebb070b56f6bda452fb45f Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 25 Jan 2023 14:57:37 -0700 Subject: [PATCH 4/7] global dt generales cat sessiones --- Sistemas/CatSesiones.aspx | 1 + Sistemas/CatSesiones.aspx.vb | 14 ++++++++++++++ Ventas/Clientes.aspx.vb | 9 ++------- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Sistemas/CatSesiones.aspx b/Sistemas/CatSesiones.aspx index 663e54e63..a311a8d4f 100644 --- a/Sistemas/CatSesiones.aspx +++ b/Sistemas/CatSesiones.aspx @@ -60,6 +60,7 @@ +    diff --git a/Sistemas/CatSesiones.aspx.vb b/Sistemas/CatSesiones.aspx.vb index b75094412..a5cd054d6 100644 --- a/Sistemas/CatSesiones.aspx.vb +++ b/Sistemas/CatSesiones.aspx.vb @@ -99,12 +99,26 @@ Partial Class Sistemas_CatSesiones CargaDTInvPSSeccionesAlmacen() ElseIf DdlVariable.SelectedItem.Value = "GlobalDTTipoTransacciones" Then CargaGlobalDTTipoTransacciones() + ElseIf DdlVariable.SelectedItem.Value = "GlobalSATGenerales" Then + CargaSATGenerales() End If End Sub + Private Sub CargaSATGenerales() + Using ObjGrales As New ClsGenerales + If ObjGrales.GetSATUsosCFDI Then Application("GlobalDTSATUsosCFDI") = ObjGrales.DtResultados + If ObjGrales.GetSATFraccionArancelaria Then Application("GlobalDTFraccionArancelaria") = ObjGrales.DtResultados.AsEnumerable() + If ObjGrales.GetSATIncoterm Then Application("GlobalDTIncoterm") = ObjGrales.DtResultados + If ObjGrales.GetSATTipoOperacion Then Application("GlobalDTTipoOperacion") = ObjGrales.DtResultados + If ObjGrales.GetSATMotivoTraslado Then Application("GlobalDTSATMotivoTraslado") = ObjGrales.DtResultados + If ObjGrales.GetSATUnidadesAduana Then Application("GlobalDTUnidadAduana") = ObjGrales.DtResultados + If ObjGrales.GetSATClavePedimento Then Application("GlobalDTClavePedimento") = ObjGrales.DtResultados + End Using + End Sub + Private Sub CargaGlobalDTTipoTransacciones() Using ObjBancos As New ClsBancos If ObjBancos.GetBancos_TiposTransaccion(-1) Then Application("GlobalDTTipoTransacciones") = ObjBancos.DtResultados Else Application("GlobalDTTipoTransacciones") = Nothing diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index 759929266..a93c2dc7f 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -7074,13 +7074,8 @@ Partial Class Clientes DdlIncoterm.Items.Insert(0, New ListItem("Seleccione", "-1")) DdlIncoterm.DataBind() - DdlClavePedimento.Items.Clear() - Using ObjGrales As New ClsGenerales - If ObjGrales.GetSATClavePedimento() Then - DdlClavePedimento.DataSource = GlobalDTClavePedimento() - DdlClavePedimento.DataBind() - End If - End Using + DdlClavePedimento.Items.Clear() + DdlClavePedimento.DataSource = GlobalDTClavePedimento() DdlClavePedimento.Items.Insert(0, New ListItem("Seleccione", "-1")) DdlMotivoTraslado.Items.Clear() From 07c93ec42d45dcde40805be1d9e018f64ae6c60f Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Fri, 27 Jan 2023 12:24:54 -0700 Subject: [PATCH 5/7] E141 Cambios de log de ejecucion de tarea programada --- Ashx/E141.ashx | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/Ashx/E141.ashx b/Ashx/E141.ashx index 95c0d6c4f..e1a263008 100644 --- a/Ashx/E141.ashx +++ b/Ashx/E141.ashx @@ -383,7 +383,10 @@ Public Class E141 : Implements IHttpHandler 'TAREAS PROGRAMADAS Select Case Metodo Case "CrearActualizarProductos" + + GuardaLogAD("NP-Inicia actualizacion de productos", "LogE141") respuesta = CrearActualizarProductos(If(FiltrarTodos = "1", True, False)) + GuardaLogAD("NP-Finaliza actualizacion de productos", "LogE141") If respuesta Then retorno = "True" Else @@ -392,7 +395,9 @@ Public Class E141 : Implements IHttpHandler Case "CrearActualizarProductosJson" retorno = CrearActualizarProductosJson(If(FiltrarTodos = "1", True, False)) Case "ActualizarPrecios" + GuardaLogAD("AP-Inicia actualizacion de precios", "LogE141") respuesta = ActualizarPrecios(If(FiltrarTodos = "1", True, False)) + GuardaLogAD("AP-Finaliza actualizacion de precios", "LogE141") If respuesta Then retorno = "True" Else @@ -401,7 +406,9 @@ Public Class E141 : Implements IHttpHandler Case "ActualizarPreciosJson" retorno = ActualizarPreciosJson(If(FiltrarTodos = "1", True, False)) Case "ActualizarExistencias" + GuardaLogAD("AE-Inicia actualizacion de existencias", "LogE141") respuesta = ActualizarExistencias() + GuardaLogAD("AE-Finaliza actualizacion de existencias", "LogE141") If respuesta Then retorno = "True" Else @@ -410,7 +417,9 @@ Public Class E141 : Implements IHttpHandler Case "ActualizarExistenciasJson" retorno = ActualizarExistenciasJson(If(FiltrarTodos = "1", True, False)) Case "ActualizarVendedores" + GuardaLogAD("AV-Inicia actualizacion de vendedores", "LogE141") respuesta = ActualizarVendedores(If(FiltrarTodos = "1", True, False)) + GuardaLogAD("AV-Finaliza actualizacion de vendedores", "LogE141") If respuesta Then retorno = "True" Else @@ -1923,7 +1932,12 @@ Public Class E141 : Implements IHttpHandler Dim respuesta = JObject.Parse(resp) If respuesta("status").ToString() = "success" Then CountPeticionesExitosas += 1 + GuardaLogAD("NP-Creacion/actualizacion de productos exitosa", "LogE141") + Else + GuardaLogAD($"NP-No se pudo realizar la Creacion/actualizacion de productos ${respuesta.ToString()}", "LogE141") End If + Else + GuardaLogAD($"NP-No se pudo realizar la Creacion/actualizacion de productos ${resp}", "LogE141") End If Else @@ -1958,7 +1972,12 @@ Public Class E141 : Implements IHttpHandler Dim respuesta = JObject.Parse(resp) If respuesta("status").ToString() = "success" Then CountPeticionesExitosas += 1 + GuardaLogAD("NP-Creacion/actualizacion de productos exitosa", "LogE141") + Else + GuardaLogAD($"NP-No se pudo realizar la Creacion/actualizacion de productos ${respuesta.ToString()}", "LogE141") End If + Else + GuardaLogAD($"NP-No se pudo realizar la Creacion/actualizacion de productos ${resp}", "LogE141") End If Threading.Thread.Sleep(1000) @@ -2071,8 +2090,13 @@ Public Class E141 : Implements IHttpHandler If IsValidJson(resp) Then Dim respuesta = JObject.Parse(resp) If respuesta("status").ToString() = "success" Then + GuardaLogAD("AP-Actualizacion de precios exitosa", "LogE141") CountPeticionesExitosas += 1 + Else + GuardaLogAD($"AP-No se pudo actualizar precios ${respuesta.ToString()}", "LogE141") End If + Else + GuardaLogAD($"AP-No se pudo actualizar precios ${resp}", "LogE141") End If Else @@ -2103,7 +2127,12 @@ Public Class E141 : Implements IHttpHandler Dim respuesta = JObject.Parse(resp) If respuesta("status").ToString() = "success" Then CountPeticionesExitosas += 1 + GuardaLogAD("AP-Actualizacion de precios exitosa", "LogE141") + Else + GuardaLogAD($"AP-No se pudo actualizar precios ${respuesta.ToString()}", "LogE141") End If + Else + GuardaLogAD($"AP-No se pudo actualizar precios ${resp}", "LogE141") End If Threading.Thread.Sleep(1000) @@ -2186,7 +2215,12 @@ Public Class E141 : Implements IHttpHandler Dim respuesta = JObject.Parse(resp) If respuesta("status").ToString() = "success" Then CountPeticionesExitosas += 1 + GuardaLogAD("AE-Actualizacion de existencias exitosa", "LogE141") + Else + GuardaLogAD($"AE-No se pudo actualizar existencias ${respuesta.ToString()}", "LogE141") End If + Else + GuardaLogAD($"AE-No se pudo actualizar existencias ${resp}", "LogE141") End If Else @@ -2217,7 +2251,12 @@ Public Class E141 : Implements IHttpHandler Dim respuesta = JObject.Parse(resp) If respuesta("status").ToString() = "success" Then CountPeticionesExitosas += 1 + GuardaLogAD("AE-Actualizacion de existencias exitosa", "LogE141") + Else + GuardaLogAD($"AE-No se pudo actualizar existencias ${respuesta.ToString()}", "LogE141") End If + Else + GuardaLogAD($"AE-No se pudo actualizar existencias ${resp}", "LogE141") End If Threading.Thread.Sleep(1000) End While @@ -2338,7 +2377,12 @@ Public Class E141 : Implements IHttpHandler Dim respuesta = JObject.Parse(resp) If respuesta("status").ToString() = "success" Then CountPeticionesExitosas += 1 + GuardaLogAD("AV-Actualizacion de vendedores exitosa", "LogE141") + Else + GuardaLogAD($"AV-No se pudo actualizar vendedores ${respuesta.ToString()}", "LogE141") End If + Else + GuardaLogAD($"AV-No se pudo actualizar vendedores ${resp}", "LogE141") End If End If From 59b7743779e408a1d589cc7bb3059ee316f6b402 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Fri, 27 Jan 2023 12:26:53 -0700 Subject: [PATCH 6/7] E13. Contrato y descripcion de ventas (Parte 1) --- App_Code/ClsMovimientos.vb | 9 ++++--- App_Code/ClsVentas.vb | 3 ++- CxC/RepCxC.aspx | 8 ++++++ CxC/RepCxC.aspx.vb | 14 +++++++++++ Ventas/Ventas.aspx | 32 +++++++++++++++++++++--- Ventas/Ventas.aspx.vb | 51 +++++++++++++++++++++++++++++++++++--- 6 files changed, 106 insertions(+), 11 deletions(-) diff --git a/App_Code/ClsMovimientos.vb b/App_Code/ClsMovimientos.vb index 0cbfb0931..cf9c2e04c 100644 --- a/App_Code/ClsMovimientos.vb +++ b/App_Code/ClsMovimientos.vb @@ -249,7 +249,7 @@ Public Class ClsMovimientos TipoCambio As Integer, Optional TCEspecifico As Double = -1, Optional TipoDocto As String = "-1", Optional FechaVI As String = "-1", Optional FechaVF As String = "-1", Optional FechaCorte As Date = Nothing, Optional EstatusCliente As Integer = -1, Optional CveUsuarioConsulta As Integer = -1, Optional CveCobranzaEstatus As Integer = -1, Optional CveClienteClasificacion As Integer = -1, Optional TipoCliente As Integer = -1, Optional AplicaAnticiposPagados As Integer = 1, Optional CveMoneda As Integer = -1, - Optional TieneLineaAdicional As Integer = -1) As Boolean + Optional TieneLineaAdicional As Integer = -1, Optional CveContrato As Integer = -1) As Boolean Dim Retorno As Boolean = False 'Data = New DataTable @@ -284,7 +284,8 @@ Public Class ClsMovimientos .Add("@TipoCliente", SqlDbType.Int).Value = TipoCliente .Add("@AplicaAnticiposPagados", SqlDbType.Int).Value = AplicaAnticiposPagados .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda - .Add("@TieneLineaAdicional", SqlDbType.Int).Value = TieneLineaAdicional + .Add("@TieneLineaAdicional", SqlDbType.Int).Value = TieneLineaAdicional + .Add("@CveContrato", SqlDbType.Int).Value = CveContrato End With Try @@ -335,7 +336,8 @@ Public Class ClsMovimientos CveResponsable As Integer, TipoCambio As Integer, Optional TCEspecifico As Double = -1, Optional TipoDocto As String = "-1", Optional FechaVI As String = "-1", Optional FechaVF As String = "1", Optional FechaCorte As Date = Nothing, Optional CveUsuarioConsulta As Integer = -1, Optional CveCobranzaEstatus As Integer = -1, Optional CveClienteClasificacion As Integer = -1, Optional LimiteCredito As Decimal = -1, - Optional TipoCliente As Integer = -1, Optional CveMoneda As Integer = -1, Optional EstatusCliente As Integer = -1, Optional AplicaAnticiposPagados As Integer = 1, Optional TieneLineaAdicional As Integer = -1) As Boolean + Optional TipoCliente As Integer = -1, Optional CveMoneda As Integer = -1, Optional EstatusCliente As Integer = -1, Optional AplicaAnticiposPagados As Integer = 1, + Optional TieneLineaAdicional As Integer = -1, Optional CveContrato As Integer = -1) As Boolean Dim Retorno As Boolean = False DS = New DataSet @@ -379,6 +381,7 @@ Public Class ClsMovimientos .Add("@EstatusCliente", SqlDbType.Int).Value = EstatusCliente .Add("@AplicaAnticiposPagados", SqlDbType.Int).Value = AplicaAnticiposPagados .Add("@TieneLineaAdicional", SqlDbType.Int).Value = TieneLineaAdicional + .Add("@CveContrato", SqlDbType.Int).Value = CveContrato End With Try diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 67d37fb3b..4b7dd81fb 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -418,7 +418,7 @@ Public Class ClsVentas Optional CveTipoAmortizacionAnticipo As Integer = -1, Optional CveVentaRelacion As Integer = -1, Optional ImporteRelacion As Decimal = -1, Optional CveEmpresaCRM As Integer = -1, Optional EsInterno As Integer = -1, Optional CveAcercamientoCRM As Integer = -1, Optional DiasCredito As Integer = 0, Optional EsDiasCreditoFijo As Boolean = False, Optional AnticipoEspecial As Boolean = False, Optional Kilometraje As Double = 0, Optional EsAmortizacion As Boolean = False, Optional CveTipoRetencion As Integer = 0, Optional CorreoNotificacion As String = "", Optional FormaPaqueteria As Integer = 1, Optional FacturarSucursal As Boolean = False, Optional VentaDesglosaIEPS As Boolean = False, Optional ServicioDomicilio As Boolean = False, Optional RFCReceptor As String = "", Optional Adjunto As String = "-1", - Optional DevolucionImportePagado As Decimal = 0, Optional EsGarantia As Boolean = False, Optional CveLineaAdicional As Integer = -1) As Boolean + Optional DevolucionImportePagado As Decimal = 0, Optional EsGarantia As Boolean = False, Optional CveLineaAdicional As Integer = -1, Optional DescripcionVenta As String = "") As Boolean Dim Retorno As Boolean = False DataAdapter("PA_VentasAdd") @@ -517,6 +517,7 @@ Public Class ClsVentas .Add("@DevolucionImportePagado", SqlDbType.Money).Value = DevolucionImportePagado .Add("@EsGarantia", SqlDbType.Bit).Value = EsGarantia .Add("@CveLineaAdicional", SqlDbType.Int).Value = CveLineaAdicional + .Add("@DescripcionVenta", SqlDbType.VarChar).Value = DescripcionVenta .Add("@RETURN_VALUE", SqlDbType.Int).Direction = ParameterDirection.ReturnValue End With 'SqlTypes.SqlDateTime.Null diff --git a/CxC/RepCxC.aspx b/CxC/RepCxC.aspx index d574ce5a0..e66c3446e 100644 --- a/CxC/RepCxC.aspx +++ b/CxC/RepCxC.aspx @@ -362,6 +362,14 @@
+
+ Contrato: +
+
+ + + +
diff --git a/CxC/RepCxC.aspx.vb b/CxC/RepCxC.aspx.vb index 487a913fc..59a32dac7 100644 --- a/CxC/RepCxC.aspx.vb +++ b/CxC/RepCxC.aspx.vb @@ -172,6 +172,20 @@ Partial Class RepCxC ' Next 'End If 'ObjSisUsuarios.Dispose() + If UsuarioActual.CveEmpresa = 13 Then + CargaContratos() + End If + + End Sub + + Private Sub CargaContratos() + Dim ObjContratos As New ClsContratos + If ObjContratos.GetContratos(-1, UsuarioActual.CveEmpresa, CveCliente:=-1) Then + DdlContrato.DataSource = ObjContratos.DtResultados + End If + + ObjContratos.Dispose() + DdlContrato.DataBind() End Sub diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index 8ee7e4337..043bfd18a 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -512,7 +512,7 @@ Empresa:  - Enviar Mail: + Enviar Mail: @@ -907,6 +907,32 @@
+ + + +
+
+ + Descripción +
+
+
+
+
+
+ +
+
+
+ + + + +
+
+
+
+
@@ -2578,7 +2604,7 @@
Destino:
- +
@@ -2615,7 +2641,7 @@
- +
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 81acbd393..32ecd1137 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -3463,6 +3463,13 @@ Partial Class Ventas UPObservaciones.Update() End If + If UsuarioActual.CveEmpresa = 13 Then + UpDescripcionVenta.Visible = True + If CveVenta <= 0 Then + TxtDescripcionVenta.Enabled = True + End If + End If + End If End Sub @@ -4813,6 +4820,11 @@ Partial Class Ventas End If End If + If UsuarioActual.CveEmpresa = 13 Then + UpDescripcionVenta.Visible = True + TxtDescripcionVenta.Text = DbRowVenta("DescripcionVenta").ToString() + End If + HplDownXML.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=FactVta&CVEVENTA={0}&EXT={1}&SERIEFOLIO={2}&TIPODOCTO={3}", CveVenta, "XML", DbRowVenta("SerieFolio"), DbRowVenta("TipoDocto")))) Case "Egs" @@ -9418,22 +9430,30 @@ Partial Class Ventas If UsuarioActual.Empresa.Funcionalidad(705) = "1" AndAlso DdlLineaAdicional.SelectedValue.ToEntero() > 0 Then 'VERIFICA QUE LA MONEDA DE LA LINEA ADICIONAL SEA LA MISMA QUE LA VENTA If Me.CveMonedaLineaAdicional <> ObjFactura.CveMoneda Then + TmpDT = TmpDTError.Copy() + CalculaTotalesVenta(RecalcularTotalOriginal:=False) Alert("La moneda de la linea adicional de crédito debe ser la misma que la factura.", TipoMensaje.MsgAdvertencia) Exit Sub End If 'VERIFICA QUE EL SALDO DISPONIBLE SEA MENOR AL IMPORTE If ObjFactura.TipoDocto = "Rem" AndAlso Me.SaldoLineaAdicional <= ObjFactura.Total Then + TmpDT = TmpDTError.Copy() + CalculaTotalesVenta(RecalcularTotalOriginal:=False) Alert("El saldo de la linea adicional debe ser mayor o igual al de la remisión", TipoMensaje.MsgAdvertencia) Exit Sub End If If ObjFactura.TipoDocto = "Ing" AndAlso (DtRemisionesPS Is Nothing OrElse DtRemisionesPS.Rows.Count = 0) Then + TmpDT = TmpDTError.Copy() + CalculaTotalesVenta(RecalcularTotalOriginal:=False) Alert("No se puede generar un ingreso con una linea adicional de credito si este no viene de una remisión", TipoMensaje.MsgAdvertencia) Exit Sub End If If ObjFactura.TipoDocto = "Ing" AndAlso Me.SaldoIngresosLineaAdicional <= ObjFactura.Total Then + TmpDT = TmpDTError.Copy() + CalculaTotalesVenta(RecalcularTotalOriginal:=False) Alert("El saldo de la linea adicional debe ser mayor o igual al de la factura", TipoMensaje.MsgAdvertencia) Exit Sub End If @@ -9775,6 +9795,24 @@ Partial Class Ventas End If + If UsuarioActual.Empresa.Funcionalidad(558) = "1" AndAlso ErrorList.Count = 0 AndAlso ObjFactura.TipoDocto = "Ing" Then + Dim RowVenta As DataRow = Nothing + If ObjVentas.GetVenta(ObjFactura.CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then + RowVenta = ObjVentas.DtResultados.Rows(0) + Else + ErrorList.Add("No se pudieron validar los datos de la venta") + End If + + If RowVenta IsNot Nothing Then + 'SI FUE VENTA DE CONTADO VALIDA QUE SE HAYA PAGADO EN SU TOTALIDAD + If RowVenta("CondicionesPago").ToString().ToEntero() = 0 AndAlso RowVenta("Saldo").ToString().ToDecimal() > 0.01D Then + ErrorList.Add("La venta no fue pagada en su totalidad") + End If + Else + ErrorList.Add("No se pudieron validar los datos de la venta") + End If + End If + 'MARCA PARA NO SURTIR VENTA DE COTNRATO DE CONSIGNACION DE VENTA | [IPP] : PARCHE If ErrorList.Count = 0 Then If ObjFactura.CveVenta > 0 And CveAlmacenExistenciasContrato > 0 And DdlTipoComprobante.SelectedValue = "Ing" Then @@ -13041,6 +13079,11 @@ Partial Class Ventas End If + Dim DescripcionVenta As String = "" + If factura.TipoDocto = "Ing" AndAlso UsuarioActual.CveEmpresa = 13 Then + DescripcionVenta = TxtDescripcionVenta.Text + End If + If Not ObjVentas.AddVenta(factura.TipoDocto, factura.Folio, factura.CveCliente, factura.CveClienteSucursal, factura.SubTotalTC, factura.DescuentoTC, factura.AmortizacionTC, factura.IVATC, factura.RetIVATC, factura.RetISRTC, factura.TotalTC, factura.CveMoneda, factura.TipoCambio, factura.CveMetodoPago, factura.CondicionesPago, factura.FormaPago, factura.FechaPago, factura.Fecha, factura.MotivoDescuento, @@ -13057,7 +13100,7 @@ Partial Class Ventas DiasCredito:=factura.DiasCredito, EsDiasCreditoFijo:=factura.EsDiasCreditoFijo, AnticipoEspecial:=If(TrAntEspecial.Visible, ChkAntEspecial.Checked, False), Kilometraje:=TxtKilometraje.Text.ToDouble, EsAmortizacion:=EsNCAmortizacion, CveTipoRetencion:=factura.CveTipoRetencion, CorreoNotificacion:=TxtCorreoNotificaciones.Text, FormaPaqueteria:=RblPaqueteria.SelectedValue.ToEntero, FacturarSucursal:=factura.FacturarSucursal, VentaDesglosaIEPS:=factura.VentaDesglosaIEPS, RFCReceptor:=RFCReceptor, Adjunto:=Adjunto, DevolucionImportePagado:=factura.DevolucionImportePagado, EsGarantia:=factura.EsGarantia, ServicioDomicilio:=TrServicioDomicilio.Visible, - CveLineaAdicional:=DdlLineaAdicional.SelectedValue.ToEntero()) Then + CveLineaAdicional:=DdlLineaAdicional.SelectedValue.ToEntero(), DescripcionVenta:=DescripcionVenta) Then ErrorList.Add("Ocurrió un error al Generar la Venta.
Revise su factura y cualquier detalle comuníquese a Soporte Técnico") Else If factura.TipoDocto.Contiene("Dev", "Egs") OrElse DtVentasNC IsNot Nothing OrElse CveEstatusRefacturacion > 0 OrElse CveAnticipoPadre > 0 Then @@ -22341,9 +22384,9 @@ Partial Class Ventas CargaAnticipos(CveCliente) End If - If CveVenta <= 0 Then - CalculaLineasAdicionales() - End If + 'If CveVenta <= 0 Then + ' CalculaLineasAdicionales() + 'End If End Sub Private Sub btnBuscarPrecio_Click(sender As Object, e As EventArgs) Handles btnBuscarPrecio.Click From a995cbf951f6b0ecb6e784b1ffa87d0e75363520 Mon Sep 17 00:00:00 2001 From: Oscar Irigoyen Date: Fri, 27 Jan 2023 19:25:02 -0700 Subject: [PATCH 7/7] RepServicioDomicilio mejoras, compras requeriri vinculacion de nc a facturas caundoe s acumuladora. --- App_Code/ClsContabilidad.vb | 3 +- App_Code/ClsOS.vb | 14 +- App_Code/ClsSisUsuarios.vb | 3 +- Compras/Compras.aspx.vb | 44 ++ Contabilidad2/RepBalanzaComprobacion.aspx | 38 +- Contabilidad2/RepBalanzaComprobacion.aspx.vb | 2 +- OS/RepServicioDomicilio.aspx | 67 ++- OS/RepServicioDomicilio.aspx.vb | 144 +++++- Planeacion/CatSubProyectos.aspx.vb | 13 +- RH/Reclutamiento.aspx.vb | 4 + Ventas/Clientes.aspx.vb | 518 +++++++++---------- 11 files changed, 539 insertions(+), 311 deletions(-) diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index d61a22728..e0a31b773 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -3866,7 +3866,7 @@ Public Class ClsContabilidad Return Retorno End Function - Public Function GetBalanzaComprobacion(FechaI As Date, FechaF As Date, TipoCuentas As Integer, TipoReporte As Integer, CveSubProyecto As String, CveEmpresa As Integer, Optional Sat As Integer = 0) As Boolean + Public Function GetBalanzaComprobacion(FechaI As Date, FechaF As Date, TipoCuentas As Integer, TipoReporte As Integer, CveSubProyecto As String, CveEmpresa As Integer, Optional Sat As Integer = 0, Optional NivelCuenta As Integer = -1) As Boolean Dim Retorno = False @@ -3880,6 +3880,7 @@ Public Class ClsContabilidad .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@SAT", SqlDbType.Int).Value = Sat + .Add("@NivelCuenta", SqlDbType.Int).Value = NivelCuenta End With SqlAdapter.SelectCommand.CommandTimeout = 0 diff --git a/App_Code/ClsOS.vb b/App_Code/ClsOS.vb index 04e539117..cad410eeb 100644 --- a/App_Code/ClsOS.vb +++ b/App_Code/ClsOS.vb @@ -726,7 +726,7 @@ Public Class ClsOS End Function - Public Function UpdateOrdenesServiciosFinaliza(CveOS As Integer, CveOSDetalle As Integer, CvePS As Integer, CveEmpresa As Integer) As Boolean + Public Function UpdateOrdenesServiciosFinaliza(CveOS As Integer, CveOSDetalle As Integer, CvePS As Integer, CveEmpresa As Integer, Optional Opcion As Integer = 1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_OS_OrdenesServiciosFinalizaUpdate") @@ -736,6 +736,7 @@ Public Class ClsOS .Add("@CveOSDetalle", SqlDbType.Int).Value = CveOSDetalle .Add("@CvePS", SqlDbType.Int).Value = CvePS .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Opcion", SqlDbType.Int).Value = Opcion End With @@ -744,7 +745,16 @@ Public Class ClsOS Retorno = True Catch ex As Exception - OnError("Ocurrió un error al guardar los cambios en La Orden de Servicio.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + + If Opcion = 1 Then + OnError("Ocurrió un error al finalizar la orden de servicio.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + ElseIf Opcion = 2 Then + OnError("Ocurrió un error al cencelar la orden de servicio.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + Else + OnError("Ocurrió un error al finalizar la orden de servicio.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End If + + End Try Return Retorno diff --git a/App_Code/ClsSisUsuarios.vb b/App_Code/ClsSisUsuarios.vb index 352595214..115bacd73 100644 --- a/App_Code/ClsSisUsuarios.vb +++ b/App_Code/ClsSisUsuarios.vb @@ -1316,7 +1316,7 @@ Public Class ClsSisUsuarios Return Retorno End Function - Public Function GetPermisosPorUsuarioProcesos(CveUsuario As Integer, CvePadre As Integer, CveRol As Integer, CveModulo As Integer, CveProceso As Integer, Optional CveUsuarioActual As Integer = -1) As Boolean + Public Function GetPermisosPorUsuarioProcesos(CveUsuario As Integer, CvePadre As Integer, CveRol As Integer, CveModulo As Integer, CveProceso As Integer, Optional CveUsuarioActual As Integer = -1, Optional CveEmpresa As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Sis_PermisosPorUsuarioProcesosGet") @@ -1327,6 +1327,7 @@ Public Class ClsSisUsuarios .Add("@CveModulo", SqlDbType.Int).Value = CveModulo .Add("@CveProceso", SqlDbType.Int).Value = CveProceso .Add("@CveUsuarioActual", SqlDbType.Int).Value = CveUsuarioActual + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa 'Opcional si se envia en -1 se cargan los usuarios de la empresa de los usuarios enviados End With Try diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 004593a48..6e0bcca33 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -4198,6 +4198,13 @@ Partial Class Compras_Compras '------------------ INICIA VALIDACIONES ------------------ + If Not ValidaVincuacionNotaFactura() Then + Alert("Se requiere que la nota este aplciada a las facturas", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + + If Not ValidaSeleccionAnticipo() Then Alert("El proveedor tiene anticipos sin aplicar, favor de especiar uno.", TipoMensaje.MsgAdvertencia) Exit Sub @@ -8327,6 +8334,34 @@ Partial Class Compras_Compras End If End Sub + Private Function ValidaVincuacionNotaFactura() As Boolean + + Dim Respuesta As Boolean = False + + + If DdlTipoComprobante.SelectedValue.Contiene("NC") Then + If UsuarioActual.Empresa.Funcionalidad(531).ToString.ToEntero = 1 Then + + For Each GvRow As GridViewRow In GvFacturaNC.Rows + If GvRow.RowType = DataControlRowType.DataRow Then + If GvRow.FCCheckBox("ChkFacturaNC").Checked Then + Respuesta = True + Exit For + End If + End If + Next + + Else + Respuesta = True + End If + Else + Respuesta = True + End If + + + Return Respuesta + + End Function Private Function AjustaCombustibles() As Boolean @@ -16127,6 +16162,15 @@ Partial Class Compras_Compras End If + + If CveFactura > 0 Then + If DdlTipoComprobante.SelectedValue = "NC" Then + NCSeleccionFacturasRelacionadas(UUIDSList) + End If + End If + + + UPCondicionesPago.Update() End Sub diff --git a/Contabilidad2/RepBalanzaComprobacion.aspx b/Contabilidad2/RepBalanzaComprobacion.aspx index 3386193c7..877a335dd 100644 --- a/Contabilidad2/RepBalanzaComprobacion.aspx +++ b/Contabilidad2/RepBalanzaComprobacion.aspx @@ -30,7 +30,7 @@
-
+
@@ -44,7 +44,7 @@
-
+
@@ -58,7 +58,7 @@
- + @@ -76,23 +76,31 @@

@@ -662,6 +664,8 @@
@@ -722,32 +726,8 @@
-
- -
- -<%--
-
- -
- -
- - - - -
-
- - - - -
-
--%> - -
+ + + +
diff --git a/OS/RepServicioDomicilio.aspx.vb b/OS/RepServicioDomicilio.aspx.vb index 42c9ac8da..b5b44b6ad 100644 --- a/OS/RepServicioDomicilio.aspx.vb +++ b/OS/RepServicioDomicilio.aspx.vb @@ -255,6 +255,22 @@ Partial Class OS_RepServicioDomicilio End Property + Private Property DTTecnicos As DataTable + Get + If ViewState("DTTecnicos") Is Nothing Then + ViewState("DTTecnicos") = New DataTable + End If + + Return DirectCast(ViewState("DTTecnicos"), DataTable) + End Get + + Set(ByVal value As DataTable) + ViewState("DTTecnicos") = value + End Set + End Property + + + Enum OSModalTipoAccion Agregar @@ -268,7 +284,7 @@ Partial Class OS_RepServicioDomicilio Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then - + CargaUsuariosTecnicos() CargarCentrosDeCosto(Nothing, DdlSubProyecto, Nothing, LblSubProyectoEtiqueta) LblSubProyectoFiltro.Text = LblSubProyectoEtiqueta.Text ' LblModalSubProyectoLabel.Text = LblSubProyectoEtiqueta.Text @@ -281,10 +297,15 @@ Partial Class OS_RepServicioDomicilio cargaDropsModal() CargaClientePublicoGeneral() + If UsuarioActual.TienePermisoProceso(348) Then DVModalAsignacion.Visible = True End If + If UsuarioActual.TienePermisoProceso(352) Then + LnkCancelarOrden.Visible = True + End If + 'RegistraScript(" PrimeraCargaCalendario = true;") @@ -293,6 +314,18 @@ Partial Class OS_RepServicioDomicilio End If End Sub + Private Sub CargaUsuariosTecnicos() + + DTTecnicos = New DataTable + + Dim ObjUsuarios As New ClsSisUsuarios + If ObjUsuarios.GetPermisosPorUsuarioProcesos(-1, -1, -1, -1, 351, UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa) Then + DTTecnicos = ObjUsuarios.DtResultados.FiltraParametros(" CveProcesoUsuarioAcceso > 0") + End If + ObjUsuarios.Dispose() + + End Sub + #Region "CARGAS" #End Region @@ -323,7 +356,7 @@ Partial Class OS_RepServicioDomicilio End Sub Private Sub CargaTecnicos() - DdlTecnico.DataSource = GlobalDTUsuarios(CveEmpresa:=UsuarioActual.CveEmpresa) + DdlTecnico.DataSource = DTTecnicos 'GlobalDTUsuarios(CveEmpresa:=UsuarioActual.CveEmpresa) DdlTecnico.DataBind() DdlTecnico.Items.Insert(0, New ListItem("Todos", "-1")) End Sub @@ -352,7 +385,7 @@ Partial Class OS_RepServicioDomicilio 'ObjOS.Dispose() - DdlTecnicoAsignar.DataSource = GlobalDTUsuarios(-1, UsuarioActual.CveEmpresa).FiltraParametros("Estatus = 'True'") + DdlTecnicoAsignar.DataSource = DTTecnicos 'GlobalDTUsuarios(-1, UsuarioActual.CveEmpresa).FiltraParametros("Estatus = 'True'") DdlTecnicoAsignar.DataBind() DdlTecnicoAsignar.Items.Insert(0, New ListItem("Seleccione uno", "-1")) @@ -716,6 +749,9 @@ Partial Class OS_RepServicioDomicilio HLkFolio.Text = ObjOS.Folio.ToString HLkFolio.NavigateUrl = $"/OS/OrdenesServicios.aspx?CveOS={ObjOS.CveOS}" + HLKPDF.NavigateUrl = $"/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=OS&CVEOS={0}", ObjOS.CveOS))}" + + HFCveOS.Value = ObjOS.CveOS.ToString HFCveOsDetalle.Value = ObjOS.CveOSDetalle.ToString TxtDescripcion.Text = ObjOS.Descripcion @@ -743,18 +779,31 @@ Partial Class OS_RepServicioDomicilio FechaInicioOriginal = ObjOS.FechaInicio TxtModalFechaOS.Text = ObjOS.FechaInicio.ToString.ToDate.ToString("dd/MM/yyyy HH:mm") DvModalSubProyecto.Visible = True + LblModalOStitulo.Text = "Actualizar Orden de Servicio" 'TSTimeSelector.Hour = If(ObjOS.FechaInicio.Hour > 12, ObjOS.FechaInicio.Hour - 12, ObjOS.FechaInicio.Hour) 'TSTimeSelector.Minute = ObjOS.FechaInicio.Minute 'TSTimeSelector.AmPm = If(ObjOS.FechaInicio.Hour > 12, MKB.TimePicker.TimeSelector.AmPmSpec.PM, MKB.TimePicker.TimeSelector.AmPmSpec.AM) End If + + Dim TipoEstatus As Integer = 0 + TipoEstatus = GlobalDTEstatusOrdenServicios(UsuarioActual.CveEmpresa).FiltroPrimeroValor("TipoEstatus", String.Format("CveEstatusOrdenServicio = {0}", ObjOS.CveEstatusOrdenServicio), "CveEstatusOrdenServicio ASC").ToEntero + + LnkModalAsignar.Visible = If(TipoEstatus.Contiene(5), False, True) + LnkCancelarOrden.Visible = If(TipoEstatus.Contiene(5), False, True) + + If (TipoEstatus = 5) Then + LblModalOStitulo.Text = "Orden Cancelada" + End If + RegistraScript("$('#DVModalOS').modal('show');") End If + ObjOS.Dispose() - LblModalOStitulo.Text = "Actualizar Orden de Servicio" + ElseIf False Then ' Anterior @@ -1255,7 +1304,7 @@ Partial Class OS_RepServicioDomicilio DdlTecnicoAsignarHorario.Items.Clear() - DdlTecnicoAsignarHorario.DataSource = GlobalDTUsuarios(-1, UsuarioActual.CveEmpresa).FiltraParametros("Estatus = 'True'") + DdlTecnicoAsignarHorario.DataSource = DTTecnicos 'GlobalDTUsuarios(-1, UsuarioActual.CveEmpresa).FiltraParametros("Estatus = 'True'") DdlTecnicoAsignarHorario.DataBind() DdlTecnicoAsignarHorario.Items.Insert(0, New ListItem("Seleccione uno", "-1")) DdlTecnicoAsignarHorario.SelectedValueExist("-1") @@ -1393,4 +1442,89 @@ Partial Class OS_RepServicioDomicilio End Sub + + Protected Sub LnkCancelarOrden_Click(sender As Object, e As EventArgs) + + + + RegistraScript($"$('#{TxtModalCancelarOrdenMotivo.ClientID}').focus();;$('#DVModalCancelacionOrden').modal('show');") + + + TxtModalCancelarOrdenMotivo.Focus() + TxtModalCancelarOrdenMotivo.Text = "" + UpmodalCacelaOrden.Update() + + + + End Sub + + + 'Protected Sub BtnGuardarEventoBitacora_Click(sender As Object, e As EventArgs) Handles BtnGuardarEventoBitacora.Click + ' Dim ObjEventoBitacora As New ClsOIEventos + + ' Dim FileExtension As String = "-1" + ' Dim filesgral As List(Of Archivo) = Anexo.getfiles().Archivos + ' Dim filemove As String = "" + + ' For Each fileItem As Archivo In filesgral + ' FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") + ' filemove = fileItem.filename + ' Next + + ' If ObjEventoBitacora.AddEventoBitacora(TxtEventoDescripcion.Text.Trim, String.Format(".{0}", FileExtension), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, CveOS, -1, -1, -1, -1) Then + ' If filemove <> "" Then + ' filemove.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("{0}OI", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase:=False) + ' End If + + ' GvEB.DataSource = ObjEventoBitacora.DtResultados + ' TxtEventoDescripcion.Text = "" + ' Anexo.Text = "[]" + ' Alert("La bitácora/observación se guardó correctamente", TipoMensaje.MsgInformacion) + ' RegistraScript("$('#ModalBitacora').modal('hide')", "hidemodal") + ' End If + ' ObjEventoBitacora.Dispose() + ' GvEB.DataBind() + + ' UPEventoBitacora.Update() + ' CargaEventoBitacora() + ' UPAddEventoBitacora.Update() + 'End Sub + + + + Protected Sub LnkmodalCancelarORdenServicio_Click(sender As Object, e As EventArgs) + + Dim TieneError As Boolean = True + + Dim CveOS As Integer = HFCveOS.Value.ToEntero + + + Dim objOS As New ClsOS + Dim ObjEventoBitacora As New ClsOIEventos(objOS.IniciaTransacSQL) + + + If objOS.UpdateOrdenesServiciosFinaliza(CveOS, -1, -1, UsuarioActual.CveEmpresa, Opcion:=2) Then 'Opcion:=2 Es para cancelar + If ObjEventoBitacora.AddEventoBitacora($"Motivo Cancelación: {TxtModalCancelarOrdenMotivo.Text.Trim}", "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, CveOS, -1, -1, -1, -1) Then + TieneError = False + End If + End If + + If TieneError Then + objOS.RollBack() + Else + objOS.Commit() + End If + + objOS.Dispose() + + + If Not TieneError Then + Alert("Orden Cancelada Correctamente", TipoMensaje.MsgInformacion, "location.reload(true);") + RegistraScript("$('#DVModalCancelacionOrden').modal('hide');") + RegistraScript("$('#DVModalFinalizarOrden').modal('hide');") + End If + + + + End Sub End Class diff --git a/Planeacion/CatSubProyectos.aspx.vb b/Planeacion/CatSubProyectos.aspx.vb index 3fcafaebd..3e06969e5 100644 --- a/Planeacion/CatSubProyectos.aspx.vb +++ b/Planeacion/CatSubProyectos.aspx.vb @@ -206,13 +206,20 @@ Partial Class CatSubProyectos End If End Sub - Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting - Dim ObjSubProyectos As New ClsSubProyectos + Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting + + Dim ObjSubProyectos As New ClsSubProyectos + + ObjSubProyectos.IniciaTransacSQL() + If ObjSubProyectos.RemoveSubProyecto(GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then + ObjSubProyectos.Commit() GvDatos.EditIndex = -1 ViewState("DTSubProyectos") = ObjSubProyectos.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) GlobalDTSubProyectos(UsuarioActual.CveEmpresa) = ObjSubProyectos.DtResultados - Alert("El SubProyecto se eliminó correctamente.", TipoMensaje.MsgInformacion) + Alert("El SubProyecto se eliminó correctamente.", TipoMensaje.MsgInformacion) + Else + ObjSubProyectos.RollBack() End If ObjSubProyectos.Dispose() diff --git a/RH/Reclutamiento.aspx.vb b/RH/Reclutamiento.aspx.vb index 8f96ec1af..2a4efd573 100644 --- a/RH/Reclutamiento.aspx.vb +++ b/RH/Reclutamiento.aspx.vb @@ -804,6 +804,10 @@ Partial Class RH_Reclutamiento If Not Page.IsPostBack Then + + + + CrearEstructuraTablasTemporales() DDLEstadoCivil4.DataSource = GlobalDTEstadoCivil diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index b676fa27d..da137665e 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -12,9 +12,9 @@ Imports Newtonsoft.Json Imports Newtonsoft.Json.Linq Partial Class Clientes - Inherits ClsPaginas - - 'Configuración + Inherits ClsPaginas + + 'Configuración #Region "P R O P I E D A D E S" Private Const NumeroDecimales As Integer = 2 Private CveVentaDeduccion As Integer @@ -643,21 +643,21 @@ Partial Class Clientes Set(value As String) ViewState("AdjuntoDocumentacion") = value End Set - End Property - 'Private ReadOnly Property CvePersonal As Integer - ' Get - ' If ViewState("CvePersonal") Is Nothing Then - ' Return -1 - ' Else - ' Return ViewState("CvePersonal").ToString().Toentero() - ' End If - ' End Get - 'End Property - + End Property + 'Private ReadOnly Property CvePersonal As Integer + ' Get + ' If ViewState("CvePersonal") Is Nothing Then + ' Return -1 + ' Else + ' Return ViewState("CvePersonal").ToString().Toentero() + ' End If + ' End Get + 'End Property + #End Region - - - + + + #Region " A C U M U L A D O R E S" Property CveVentaNota As Integer Get @@ -697,10 +697,10 @@ Partial Class Clientes Set(value As String) ViewState("SerieNotaAcumulador") = value End Set - End Property - + End Property + #End Region - + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then @@ -960,12 +960,12 @@ Partial Class Clientes ChkPermiso5.Enabled = False ChkPermiso6.Enabled = False - End Sub - - - + End Sub + + + #Region " PERMISOS PAGINAS " - + Private Sub MostrarTxtDireccionesClienteEnvio() If UsuarioActual.CveEmpresa.Contiene(72, 80, 146) Then @@ -1002,18 +1002,18 @@ Partial Class Clientes If Not ChkEsDistribuidor.Checked Then BtnGuardar.Visible = PermiteEditar() End If - End Sub - - + End Sub + + #End Region - - + + #Region "C A R G A S" - - - - - + + + + + Private Sub CreaDtPago() DtPagos = New DataTable DtPagos.Columns.Add("CveTipoMovimiento", GetType(String)) @@ -1207,9 +1207,9 @@ Partial Class Clientes Select Case HdnCuenta.Value Case "1" - CargaDdlCuentasContables(DdlCtaContableClientes, 1)'UsuarioActual.Empresa.Funcionalidad(246).Toentero() + CargaDdlCuentasContables(DdlCtaContableClientes, 1)'UsuarioActual.Empresa.Funcionalidad(246).Toentero() Case "2" - CargaDdlCuentasContables(DdlCtaContableAnticipos, 1)' UsuarioActual.Empresa.Funcionalidad(237).Toentero() + CargaDdlCuentasContables(DdlCtaContableAnticipos, 1)' UsuarioActual.Empresa.Funcionalidad(237).Toentero() Case "3" CargaDdlCuentasContables(DdlCtaContableRetIVA, -1) Case "4" @@ -1217,11 +1217,11 @@ Partial Class Clientes Case "5" CargaDdlCuentasContables(DdlCtaContableFondoGarantia, -1) Case "6" - CargaDdlCuentasContables(DdlCtaContableCompClientes, 1)'UsuarioActual.Empresa.Funcionalidad(248).Toentero() + CargaDdlCuentasContables(DdlCtaContableCompClientes, 1)'UsuarioActual.Empresa.Funcionalidad(248).Toentero() Case "7" CargaDdlCuentasContables(DdlCtaContableCompAnticipos, -1) Case "8" - CargaDdlCuentasContables(DdlMonedaExtranjeraClientes, 1)'UsuarioActual.Empresa.Funcionalidad(247).Toentero() + CargaDdlCuentasContables(DdlMonedaExtranjeraClientes, 1)'UsuarioActual.Empresa.Funcionalidad(247).Toentero() Case "9" CargaDdlCuentasContables(DdlMonedaExtranjeraAnticipos, 1) 'UsuarioActual.Empresa.Funcionalidad(542).Toentero() End Select @@ -2148,11 +2148,11 @@ Partial Class Clientes DdlSucursalUsoCFDI.Items.Clear() DdlSucursalUsoCFDI.DataSource = GlobalDTSATUsosCFDI(UsuarioActual.Empresa.EsPersonaFisica, RegimenFiscalReceptor:=RegimenFiscalCliente) DdlSucursalUsoCFDI.DataBind() - End Sub + End Sub #End Region - + #Region "V E R M Á S" - + Protected Sub BtnVerMasVentas_Click(sender As Object, e As EventArgs) If BtnVerMasVentas.Text = "Ver Más" Then CargaHistorial(-1) @@ -2182,12 +2182,12 @@ Partial Class Clientes CargaBancos(51) BtnVerMasBancos.Text = "Ver Más" End If - End Sub - + End Sub + #End Region - + #Region "B A N C O S" - 'CuentasxCobrar Activas (Pagos Recibidos) + 'CuentasxCobrar Activas (Pagos Recibidos) Private Sub CargaBancos(Optional SelectTop As Integer = 51, Optional CveClienteSucursal As Integer = -1) Dim ObjMovtos As New ClsMovimientos() 'CxC Activas @@ -2257,9 +2257,9 @@ Partial Class Clientes TxtParaMail.Text = TxtCobranzaCorreo.Text UpSendMail.Update() RegistraScript("$('#ModalDivMail').modal('show');") - End Sub + End Sub #End Region - + #Region "B T N ´ S" Protected Sub BtnEliminar_Click(sender As Object, e As System.EventArgs) Handles BtnEliminar.Click Dim ObjClientes As New ClsClientes() @@ -2600,85 +2600,85 @@ Partial Class Clientes Dim errorContPaq As Boolean = False Dim IdContPaqi As Integer = 0 - Dim CodigoPersona As Integer = 0 - - + Dim CodigoPersona As Integer = 0 + + #Region "comentado" - 'If UsuarioActual.Empresa.Funcionalidad(522).ToString() = "1" Then - - ' Dim ObjContPaqi As New ClsContPAQi(UsuarioActual.Empresa) - - ' If ObjContPaqi.GetPersona(TxtRFC.Text) Then - - ' If ObjContPaqi.DtResultados.Rows.Count > 0 Then - - ' IdContPaqi = ObjContPaqi.DtResultados.Rows(0)("Id").ToString().Toentero() - ' CodigoPersona = ObjContPaqi.DtResultados.Rows(0)("Codigo").ToString().Toentero() - - ' Dim Cont_EsProveedor As Integer = If(Boolean.Parse(ObjContPaqi.DtResultados.Rows(0)("EsProveedor").ToString()), 1, 0) - ' Dim Cont_Nombre As String = ObjContPaqi.DtResultados(0)("Nombre").ToString() - ' Dim Cont_RFC As String = ObjContPaqi.DtResultados(0)("RFC").ToString() - - ' If ObjContPaqi.UpdatePersona(IdContPaqi, Cont_Nombre, Cont_RFC, 1, Cont_EsProveedor) Then - ' errorContPaq = False - ' Else - ' errorContPaq = True - ' End If - - ' Else - ' If ObjContPaqi.AddPersona(TxtNombre.Text.Trim, TxtRFC.Text.Trim, 1, 0) Then - - ' IdContPaqi = ObjContPaqi.DtResultados.Rows(0)("IdContPaqiPersona").ToString().Toentero() - ' CodigoPersona = ObjContPaqi.DtResultados.Rows(0)("Codigo").ToString().Toentero() - ' errorContPaq = False - ' Else - ' errorContPaq = True - ' End If - ' End If - ' End If - - - ' If Not errorContPaq Then - ' Dim IdContPaqiCliente As Integer - - ' If ObjContPaqi.GetCliente(-1, CodigoPersona) Then - - ' If ObjContPaqi.DtResultados.Rows.Count > 0 Then - - ' IdContPaqiCliente = ObjContPaqi.DtResultados.Rows(0)("IdContPaqiClient").ToString().Toentero() - - ' If ObjContPaqi.UpdateCliente(IdContPaqiCliente, CodigoPersona, CodigoPersona, "", "") Then - ' errorContPaq = False - ' Else - ' errorContPaq = True - ' End If - ' Else - ' If ObjContPaqi.AddCliente(CodigoPersona, CodigoPersona, "", "") Then - ' errorContPaq = False - ' Else - ' errorContPaq = True - ' End If - ' End If - ' Else - ' errorContPaq = True - ' End If - ' End If - - - ' If Not errorContPaq Then - ' ObjContPaqi.Commit() - ' ObjContPaqi.Dispose() - ' Else - ' ObjContPaqi.RollBack() - ' ObjContPaqi.Dispose() - ' Alert("Se presento un error al guardar en ContPAQi", TipoMensaje.MsgError) - ' Exit Sub - ' End If - - - 'End If + 'If UsuarioActual.Empresa.Funcionalidad(522).ToString() = "1" Then + + ' Dim ObjContPaqi As New ClsContPAQi(UsuarioActual.Empresa) + + ' If ObjContPaqi.GetPersona(TxtRFC.Text) Then + + ' If ObjContPaqi.DtResultados.Rows.Count > 0 Then + + ' IdContPaqi = ObjContPaqi.DtResultados.Rows(0)("Id").ToString().Toentero() + ' CodigoPersona = ObjContPaqi.DtResultados.Rows(0)("Codigo").ToString().Toentero() + + ' Dim Cont_EsProveedor As Integer = If(Boolean.Parse(ObjContPaqi.DtResultados.Rows(0)("EsProveedor").ToString()), 1, 0) + ' Dim Cont_Nombre As String = ObjContPaqi.DtResultados(0)("Nombre").ToString() + ' Dim Cont_RFC As String = ObjContPaqi.DtResultados(0)("RFC").ToString() + + ' If ObjContPaqi.UpdatePersona(IdContPaqi, Cont_Nombre, Cont_RFC, 1, Cont_EsProveedor) Then + ' errorContPaq = False + ' Else + ' errorContPaq = True + ' End If + + ' Else + ' If ObjContPaqi.AddPersona(TxtNombre.Text.Trim, TxtRFC.Text.Trim, 1, 0) Then + + ' IdContPaqi = ObjContPaqi.DtResultados.Rows(0)("IdContPaqiPersona").ToString().Toentero() + ' CodigoPersona = ObjContPaqi.DtResultados.Rows(0)("Codigo").ToString().Toentero() + ' errorContPaq = False + ' Else + ' errorContPaq = True + ' End If + ' End If + ' End If + + + ' If Not errorContPaq Then + ' Dim IdContPaqiCliente As Integer + + ' If ObjContPaqi.GetCliente(-1, CodigoPersona) Then + + ' If ObjContPaqi.DtResultados.Rows.Count > 0 Then + + ' IdContPaqiCliente = ObjContPaqi.DtResultados.Rows(0)("IdContPaqiClient").ToString().Toentero() + + ' If ObjContPaqi.UpdateCliente(IdContPaqiCliente, CodigoPersona, CodigoPersona, "", "") Then + ' errorContPaq = False + ' Else + ' errorContPaq = True + ' End If + ' Else + ' If ObjContPaqi.AddCliente(CodigoPersona, CodigoPersona, "", "") Then + ' errorContPaq = False + ' Else + ' errorContPaq = True + ' End If + ' End If + ' Else + ' errorContPaq = True + ' End If + ' End If + + + ' If Not errorContPaq Then + ' ObjContPaqi.Commit() + ' ObjContPaqi.Dispose() + ' Else + ' ObjContPaqi.RollBack() + ' ObjContPaqi.Dispose() + ' Alert("Se presento un error al guardar en ContPAQi", TipoMensaje.MsgError) + ' Exit Sub + ' End If + + + 'End If #End Region - + Dim LT As String = If(HDLT.Value.ToDouble <> 0, HDLT.Value, "0") Dim LG As String = If(HDLG.Value.ToDouble <> 0, HDLG.Value, "0") @@ -2933,11 +2933,11 @@ Partial Class Clientes ObjClientes.Dispose() objDoc.Dispose() RecargaGlobal() - End Sub - + End Sub + #End Region - - + + #Region "G L O B L A L" Private Sub RecargaGlobal() 'Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDT) @@ -2951,10 +2951,10 @@ Partial Class Clientes ' Application("GlobalDTCliente") = Objclientes.DtResultados 'End If 'Objclientes.Dispose() - End Sub + End Sub #End Region - - + + #Region "G R I D V I E W S" Protected Sub GVHistorial_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVHistorial.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then @@ -3095,11 +3095,11 @@ Partial Class Clientes End If End If - End Sub + End Sub #End Region - + #Region "R H" - + Private Sub CargaPersonalAsignado() Dim ObjPersonal As New ClsRH If ObjPersonal.GetPersonal(-1, "-1", "-1", "-1", "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, CveCliente, "-1", -1, -1, -1, -1, -1, -1, "-1", "-1", "-1", "-1", UsuarioActual.CveEmpresa) Then @@ -3172,9 +3172,9 @@ Partial Class Clientes End If End If - End Sub + End Sub #End Region - + #Region "S U C U R S A L E S" Private Sub LbAgregarSucursal_Click(sender As Object, e As EventArgs) Handles LbAgregarSucursal.Click ChkEstatusSucursal.Checked = True @@ -3306,7 +3306,7 @@ Partial Class Clientes UpModalDivMapa.Update() - End Sub + End Sub #Region "G V S U C U R S A L E S" Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVSucursales.RowDataBound @@ -3428,9 +3428,9 @@ Partial Class Clientes Else CargaGrid("", 0) End If - End Sub + End Sub #End Region - + #Region "G V U S U A R I O S P O R T A L" Protected Sub GvUsuariosPortal_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GvUsuariosPortal.RowCommand If e.CommandName = "RestablecerContraseña" Then @@ -3582,9 +3582,9 @@ Partial Class Clientes CargaGrid("", 1) End If - End Sub + End Sub #End Region - + #Region "O R D E N A M I E N T O" Private Sub CargaGrid(Orden As String, gvi As Integer) If gvi = 0 Then @@ -3616,12 +3616,12 @@ Partial Class Clientes UPPUsuarios.Update() End If - End Sub + End Sub #End Region - - + + #End Region - + #Region "U S U A R I O S" Protected Sub LbSolicitudPortal_Click(sender As Object, e As EventArgs) Handles LbEnviarActivacionPortal.Click Dim ObjUsuario As New ClsSisUsuarios @@ -3803,9 +3803,9 @@ Partial Class Clientes ChkPermiso5.Checked = False ChkPermiso6.Checked = False ChkPermiso7.Checked = False - End Sub + End Sub #End Region - + #Region "E V E N T O - B I T A C O R A" Protected Sub GVEventoBitacora_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvEB.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then @@ -4014,11 +4014,11 @@ Partial Class Clientes BtnActivaRegistroISR.Visible = True End If - End Sub + End Sub #End Region - + #Region " I M P R I M I R P D F" - + Protected Sub ChkAntIXCNC_CheckedChanged(sender As Object, e As EventArgs) DdlTipoDocto.ClearSelection() If ChkAntIXCNC.Checked Then @@ -4429,9 +4429,9 @@ Partial Class Clientes End Using End If - End Sub + End Sub #End Region - + #Region "E N V I O C O R R E O" Private Sub EnviaCorreo(Liga As String, LigaActivar As String) @@ -4499,11 +4499,11 @@ Partial Class Clientes a.GuardaLog() Dim Mail As New ClsSisMail() Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body) - End Sub + End Sub #End Region - + #Region " COTIZACIONES " - + Protected Sub BtnVerMasCot_Click(sender As Object, e As EventArgs) If BtnVerMasCot.Text = "Ver Más" Then CargaCotizaciones(-1) @@ -4573,11 +4573,11 @@ Partial Class Clientes HLFacturar.HRef = $"/Ventas/Ventas.aspx?CveCotizacion={e.Row.DBCampo("CveVenta")}" End If End If - End Sub + End Sub #End Region - + #Region "D I R E C C I O N E N V I O " - + Private Sub CargaCombosDirecionesClientesSAT() CargaDirClientePais() CargaDirClienteEstado() @@ -4800,12 +4800,12 @@ Partial Class Clientes End If CargaDireccionesEnvio() - End Sub - + End Sub + #End Region - + #Region " IMPORTAR SALDOS " - + Private Sub HLImportarSaldos_Click(sender As Object, e As EventArgs) Handles HLImportarSaldos.Click CargaClientesImportarSaldos() RegistraScript(String.Format("$('#{0}').modal();", "DivImportarSaldos")) @@ -4909,9 +4909,9 @@ Partial Class Clientes e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("ChkSaldo(this,{0},{1});", e.Row.FCTextBox("TxtImporte").ClientID, e.Row.DBCampo("Saldo"))) e.Row.FCTextBox("TxtImporte").Attributes.Add("onKeyUp", String.Format("CambiaSaldo({0},this,{1});", e.Row.FCCheckBox("Chk").ClientID, e.Row.DBCampo("Saldo"))) End If - End Sub + End Sub #End Region - + #Region "Cuentas/Equipos" Public Sub BtnAgregarCtaEquipo_Click(sender As Object, e As EventArgs) HdnModalidad.Value = "I" @@ -5499,9 +5499,9 @@ Partial Class Clientes End If Return Retorno - End Function + End Function #End Region - + #Region "GPS" Protected Sub btnCargaArrayDisp_Click(sender As Object, e As EventArgs) Handles btnCargaArrayDisp.Click If hdnArrayDispositivo.Value.Length > 0 Then @@ -5642,10 +5642,10 @@ Partial Class Clientes UpMoverDispositivo.Update() RegistraScript($"CargaModalMoverDispositivo({GvRow.DataKey("CveDispositivo")});") - End Sub - + End Sub + #End Region - + #Region "Sucursales" Public Sub CreaDTSucursales() @@ -5879,14 +5879,14 @@ Partial Class Clientes End If End If End If - End Sub - + End Sub + #End Region - + #Region "G P S" - - - + + + Private Sub EnviaCorreoGPS(Liga As String, LigaActivar As String) Try @@ -5957,16 +5957,16 @@ Partial Class Clientes End If ObjClientes.Dispose() - End Sub - - + End Sub + + #End Region - + #Region "C O N T R A T O S" - - - - + + + + Private Sub CargaDatosContrato() If CveCliente <= 0 Then Exit Sub @@ -6011,10 +6011,10 @@ Partial Class Clientes e.Row.CssClass = "Totales white" End If End If - End Sub - + End Sub + #End Region - + #Region "M E T O D O S " Protected Sub RblTipo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RblTipo.SelectedIndexChanged If DTHistorialVentas IsNot Nothing AndAlso RblTipo.SelectedValue <> "-1" Then @@ -6424,13 +6424,13 @@ Partial Class Clientes End If - End Sub - + End Sub + #End Region - + #Region "IMPRIMIR GVHistorial" - - + + Protected Sub BtnExcelHistorial_Click(sender As Object, e As EventArgs) Dim retorno As Byte() = Nothing Dim Imagen As New System.IO.FileInfo($"{UsuarioActual.Empresa.Ruta}/Logo.png") @@ -6505,18 +6505,18 @@ Partial Class Clientes ObjClientes.Dispose() Return retorno - End Function - - + End Function + + #End Region - + #Region "C O B R A N Z A" Public Sub Visitas_Click(sender As Object, e As EventArgs) RegistraScript(String.Format("$('#{0}').modal();", "DivVisitas")) - End Sub - + End Sub + #End Region - + #Region "Usuarios" Protected Sub GvUsuarios_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvUsuarios.RowDeleting Dim CveUsuario As Integer = GvUsuarios.Rows(e.RowIndex).DataKey("CveUsuario").ToEntero() @@ -6551,12 +6551,12 @@ Partial Class Clientes e.Row.Cells(5).Visible = False End If End If - End Sub + End Sub #End Region - - + + #Region "C U E N T A S - B A N C A R I A S" - + Private Sub CargaCuentasBancarias(Optional RecargaGlobal As Boolean = False) If CveCliente <= 0 Then Exit Sub @@ -6729,8 +6729,8 @@ Partial Class Clientes TxtNumeroCuenta2.Text = "" TxtConvenioCIE2.Text = "" TxtReferencia2.Text = "" - End Sub - + End Sub + #Region "GRIDVIEW - CUENTAS BANCARIAS" Protected Sub GvBancosCuentas_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvBancosCuentas.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then @@ -6786,10 +6786,10 @@ Partial Class Clientes GlobalDTCuentasDepositosClientes(UsuarioActual.CveEmpresa, -1, True) = Nothing End If - End Sub - + End Sub + #End Region - + Private Sub CargaPSGridCuentasBancos() If CveCliente > 0 Then GvBancosCuentas.DataSource = DTCuentasBancos @@ -6847,9 +6847,9 @@ Partial Class Clientes divestatus.Visible = True UpAddBancos.Update() RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddCuentasBancarias")) - End Sub + End Sub #End Region - + #Region "C L I E N T E S P A G O S R E A L I Z A D O S I M P R I M I R P D F/Excel" Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkPagosClientesBancosExcel.Click GenerarPDF("Excel") @@ -6871,11 +6871,11 @@ Partial Class Clientes ImprimirPDF("Empresas\Grales\Formatos\RepClientesPagosBancos.rdlc", DTCobrosRealizados, params, "RepClientesPagosBancos_" & Now.ToString("yyyyMMddhhmmss"), Formato:=Formato) - End Sub + End Sub #End Region - + #Region "VENTAS" - + Public Function imprimirFacturaVenta(CveVenta As Integer) As Byte() Dim ObjVentas As New ClsVentas Dim Vta As Modelos.Factura = Nothing @@ -7106,10 +7106,10 @@ Partial Class Clientes ObjVentas.Dispose() Return PdfFactura(Vta) - End Function - + End Function + #End Region - + #Region "COMERCIO EXTERIOR" Public Sub CargaCombosComercioExterior() @@ -7233,12 +7233,12 @@ Partial Class Clientes End Sub Protected Sub DdlMunicipio_SelectedIndexChanged(sender As Object, e As EventArgs) CargaColonia() - End Sub - + End Sub + #End Region - + #Region "D O C U M E N T A C I O N " - + Private Sub CargaDocumentacionCliente() Dim objRH As New ClsEdocumentacion() @@ -7876,12 +7876,12 @@ Partial Class Clientes RegistraScript("Download('" & baseUrl & "')") - End Sub - + End Sub + #End Region - + #Region "D O C U M E N T O S V E N T A S" - + Private Sub CargaDocumentosVenta(tCveCliente As Integer) Dim objInv As New ClsEdocumentacion @@ -8052,11 +8052,11 @@ Partial Class Clientes objRH.Dispose() - End Sub - - + End Sub + + #End Region - + #Region "PERSONA FISICA" Protected Sub LnkPersonaFisica_Click(sender As Object, e As EventArgs) RegistraScript("$('#DivModalPersonaFisica').modal();") @@ -8081,9 +8081,9 @@ Partial Class Clientes ObjCliente.Dispose() UpDatos.Update() - End Sub + End Sub #End Region - + #Region "USUARIOS PLATAFORMA CLIENTE - 6 " Protected Sub CargaUsuariosPortalCliente() Dim objUsuario As ClsSisUsuarios = New ClsSisUsuarios @@ -8092,19 +8092,19 @@ Partial Class Clientes GvUsuarios.DataBind() End If objUsuario.Dispose() - End Sub + End Sub #End Region - + #Region " DEVOLVER DINERO ANT/NC " Private Sub InicializaDevolverDinero() If UsuarioActual.TienePermisoProceso(247) Then GVAnticipos.Columns(6).Visible = True End If - End Sub + End Sub #End Region - + #Region "MODAL GRAFICA/PEDIDOS" - + Protected Sub LnkVerGrafica_Click(sender As Object, e As EventArgs) If CargaDatatables() Then RegistraScript("$('#DivModalGrafica').modal('show')") @@ -8441,13 +8441,13 @@ Partial Class Clientes RegistraScript($"CargaGraficaCompratamientoSaldoMensual({Dt5.ToJson},{Dt6.ToJson.Replace($"{Chr(34)}True{Chr(34)}", "true").Replace($"{Chr(34)}False{Chr(34)}", "false")})", "55") UPModalProd.Update() - End Sub - - + End Sub + + #End Region - + #Region "TAB - COMPORTAMIENTO DE VENTAS" - + Private Sub CargaGrupo() DdlGrupo.Items.Insert(0, New ListItem("Categoria", "3")) DdlGrupo.Items.Insert(1, New ListItem("Clasificacion", "4")) @@ -8631,12 +8631,12 @@ Partial Class Clientes ObjVentas.Dispose() GvComportamientoVenta.DataBind() UpDatosComportamientoVenta.Update() - End Sub - + End Sub + #End Region - + #Region "DISPOSITIVOS" - + Protected Sub LnkMoverDispositivo_Click(sender As Object, e As EventArgs) Dim CveDispositivo As Integer = HdnCveDispositivoMover.Value.ToEntero() Dim CveCliente As Integer = DdlClienteDispositivo.SelectedValue.ToEntero() @@ -8674,10 +8674,10 @@ Partial Class Clientes CargaEventoBitacora() NombreDispositivo = "" RegistraScript("$('#DivMoverDispositivo').modal('hide');") - End Sub - + End Sub + #End Region - + #Region "CRM" Protected Sub CargaDatosCRM() Dim ObjCRM = New ClsCRM() @@ -8777,9 +8777,9 @@ Partial Class Clientes Alert("Se Unificó correctamente al Cliente con la Empresa CRM.") End If End If - End Sub + End Sub #End Region - + #Region "PORCENTAJE PRECIO DE MARCAS" Private Sub LnkPorcentajeMarcas_Click(sender As Object, e As EventArgs) Handles LnkPorcentajeMarcas.Click RegistraScript(String.Format("$('#{0}').modal();", "DivPorcentajeMarcas")) @@ -9004,9 +9004,9 @@ Partial Class Clientes ObjPS.Dispose() - End Sub + End Sub #End Region - + #Region "PORCENTAJE PRECIO DE PRODUCTOS" Private Sub LnkPorcentajePrecios_Click(sender As Object, e As EventArgs) Handles LnkPorcentajePrecios.Click RegistraScript(String.Format("$('#{0}').modal();", "DivPorcentajePrecios")) @@ -9242,12 +9242,12 @@ Partial Class Clientes Protected Sub BtnCambiaPorcentaje_Click(sender As Object, e As EventArgs) DdlProducto2IndexChange(DdlProducto2.SelectedValue.ToEntero(), DdlProducto2) - End Sub + End Sub #End Region - + #Region " A C U M U L A D O R E S" - - + + Protected Sub LnkFacturaUsadosCargos_Click(sender As Object, e As EventArgs) 'CveVentaNota = 0 @@ -9890,11 +9890,11 @@ Partial Class Clientes ' ObjFactura.Timbre = PreParaTimbre(ObjFactura) - End Sub - - + End Sub + + #End Region - + #Region "C L I E N T E S G R I D S I M P R I M I R P D F/Excel" Private Sub LnkCotizacionesPDF_Click(sender As Object, e As EventArgs) Handles LnkCotizacionesPDF.Click ImprimeGridsProveedores("PDF", DtCotizaciones, "RepClientesCotizaciones")