From 6df11284939b3b08e131bd6b46a9116af702bd8b Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 7 Sep 2022 20:53:45 -0700 Subject: [PATCH 1/6] --Mejoras en facturacion masiva --- App_Code/ClsContratos.vb | 9 ++- Contratos/Contrato.aspx | 10 +++ Contratos/Contrato.aspx.vb | 61 +++++++++++++++- Contratos/FacturacionMasiva.aspx.vb | 8 +++ Ventas/Ventas.aspx | 2 +- Ventas/Ventas.aspx.vb | 105 +++++++++++++++++++++++++++- 6 files changed, 186 insertions(+), 9 deletions(-) diff --git a/App_Code/ClsContratos.vb b/App_Code/ClsContratos.vb index 17a30f6bb..5b34123a5 100644 --- a/App_Code/ClsContratos.vb +++ b/App_Code/ClsContratos.vb @@ -319,7 +319,7 @@ Public Class ClsContratos Optional CveContratosEstatus As Integer = -1, Optional CveContratoTipo As Integer = -1, Optional TipoCambio As Double = 1, Optional CveSucursalCliente As Integer = -1, Optional CveAlmacenOrigen As Integer = -1, Optional CveAlmacenDestino As Integer = -1, Optional PorcentajeComision As Integer = -1, Optional TipoGarantia As Integer = -1, Optional Folio As Integer = -1, Optional FechaVenc As Date = Nothing, Optional EstatusFianza As Integer = -1, Optional CvePeriodo As Integer = -1, Optional CveContratoPlantilla As Integer = -1, Optional CveCuentaEquipo As Integer = -1, Optional CveVendedor As Integer = -1, Optional Observaciones As String = "", Optional CveDireccionEnvio As Integer = -1, Optional AplicaImpuestosLocales As Boolean = False, Optional CorreoNotificacionPedDev As String = "", - Optional FacturacionCicilica As Boolean = False, Optional FacturacionCiclicaAutomatico As Boolean = False, Optional DiaMesFacturacion As Integer = 1) As Integer + Optional FacturacionCicilica As Boolean = False, Optional FacturacionCiclicaAutomatico As Boolean = False, Optional DiaMesFacturacion As Integer = 1, Optional ObservacionesGenerales As String = "") As Integer Dim Retorno As Integer = -1 DataAdapter("PA_Con_ContratosAdd") @@ -374,6 +374,7 @@ Public Class ClsContratos .Add("@FacturacionCicilica", SqlDbType.Bit).Value = FacturacionCicilica .Add("@FacturacionCiclicaAutomatico", SqlDbType.Bit).Value = FacturacionCiclicaAutomatico .Add("@DiaMesFacturacion", SqlDbType.TinyInt).Value = DiaMesFacturacion + .Add("@ObservacionesGenerales", SqlDbType.VarChar).Value = ObservacionesGenerales End With @@ -399,7 +400,7 @@ Public Class ClsContratos Optional CveContratosEstatus As Integer = -1, Optional CveContratoTipo As Integer = -1, Optional TipoCambio As Double = 1.0, Optional CveSucursalCliente As Integer = -1, Optional CveAlmacenOrigen As Integer = -1, Optional CveAlmacenDestino As Integer = -1, Optional PorcentajeComision As Integer = -1, Optional TipoGarantia As Integer = -1, Optional Folio As Integer = -1, Optional FechaVenc As Date = Nothing, Optional EstatusFianza As Integer = -1, Optional CveContratoPlantilla As Integer = -1, Optional CveCuentaEquipo As Integer = -1, Optional CveVendedor As Integer = -1, Optional Observaciones As String = "", Optional CveDireccionEnvio As Integer = -1, Optional AplicaImpuestosLocales As Boolean = False, Optional CorreoNotificacionPedDev As String = "", Optional FacturacionCicilica As Boolean = False, Optional FacturacionCiclicaAutomatico As Boolean = False, - Optional DiaMesFacturacion As Integer = 1, Optional CvePeriodo As Integer = -1) As Boolean + Optional DiaMesFacturacion As Integer = 1, Optional CvePeriodo As Integer = -1, Optional ObservacionesGenerales As String = "") As Boolean Dim Retorno = False DataAdapter("PA_Con_ContratosUpdate") @@ -453,7 +454,9 @@ Public Class ClsContratos .Add("@FacturacionCicilica", SqlDbType.Bit).Value = FacturacionCicilica .Add("@FacturacionCiclicaAutomatico", SqlDbType.Bit).Value = FacturacionCiclicaAutomatico .Add("@DiaMesFacturacion", SqlDbType.TinyInt).Value = DiaMesFacturacion - .Add("@CvePeriodo", SqlDbType.Int).Value = CvePeriodo + .Add("@CvePeriodo", SqlDbType.Int).Value = CvePeriodo + .Add("@ObservacionesGenerales", SqlDbType.VarChar).Value = ObservacionesGenerales + End With Try diff --git a/Contratos/Contrato.aspx b/Contratos/Contrato.aspx index 5bf9b8cb8..3655cedbf 100644 --- a/Contratos/Contrato.aspx +++ b/Contratos/Contrato.aspx @@ -1973,6 +1973,16 @@ +
+
+ +
+ +
+
+ +
+
diff --git a/Contratos/Contrato.aspx.vb b/Contratos/Contrato.aspx.vb index 50bb6f76a..c4049ee0c 100644 --- a/Contratos/Contrato.aspx.vb +++ b/Contratos/Contrato.aspx.vb @@ -1383,7 +1383,8 @@ Partial Class Contratos_Default CveAlmacenOrigen:=DdlAlmacenOrigen.SelectedValue.ToEntero, CveAlmacenDestino:=DdlAlmacenDestino.SelectedValue.ToEntero, PorcentajeComision:=TxtPorcentajeComision.Text.ToEntero, TipoGarantia:=DdlTipoGarantia.SelectedValue.ToEntero, Folio:=TxtFolio.Text.ToEntero, FechaVenc:=txtFechaVenc.Text.ToDate, EstatusFianza:=DdlEstatusFianza.SelectedValue.ToEntero, CveContratoPlantilla:=DdlPlantillaContrato.SelectedValue.ToEntero, CveCuentaEquipo:=DdlCuentaEquipo.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, Observaciones:=TxtObservaciones.Text, CveDireccionEnvio:=DdlClienteDireccionEnvio.SelectedValue.ToEntero, AplicaImpuestosLocales:=ChkImpuestosLocales.Checked, - CorreoNotificacionPedDev:=TxtCorreoNotificacion.Text.Trim(), FacturacionCicilica:=ChkAplicaFacCiclica.Checked, FacturacionCiclicaAutomatico:=ChkFacAutomatica.Checked, DiaMesFacturacion:=If(DdlDiaFact.SelectedValue.ToEntero() < 0, 0, DdlDiaFact.SelectedValue.ToEntero()), CvePeriodo:=DdlPeriodo.SelectedValue.ToEntero()) Then + CorreoNotificacionPedDev:=TxtCorreoNotificacion.Text.Trim(), FacturacionCicilica:=ChkAplicaFacCiclica.Checked, FacturacionCiclicaAutomatico:=ChkFacAutomatica.Checked, DiaMesFacturacion:=If(DdlDiaFact.SelectedValue.ToEntero() < 0, 0, DdlDiaFact.SelectedValue.ToEntero()), + CvePeriodo:=DdlPeriodo.SelectedValue.ToEntero(), ObservacionesGenerales:=TxtObsGeneral.Text.Trim) Then TieneError = Not GuardaFianzas(ObjContratos) @@ -4028,7 +4029,8 @@ Partial Class Contratos_Default TxtUbicacion.Text, TxtResponsable.Text, DdlSubProyectoContrato.SelectedValue.ToEntero, TxtPorIVA.Text.ToDouble, TxtPorAnticipo.Text.ToDouble, TxtPorAmortizacionAnticipo.Text.ToDouble, TxtPorGarantia.Text.ToDouble, "." & Session("FileExtension").ToString, "", CveContrato, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, Minimo, Maximo, Total, DdlMoneda.SelectedValue.ToEntero, ModalidadDetalle, If(UsuarioActual.Empresa.CvePlataforma = 3, 1, CveEstatusInicial), TipoContrato, TxtTipoCambio.Text.ToDouble, CveSucursalCliente:=DdlSucursalCliente.SelectedValue.ToEntero, CveAlmacenOrigen:=DdlAlmacenOrigen.SelectedValue.ToEntero, CveAlmacenDestino:=DdlAlmacenDestino.SelectedValue.ToEntero, PorcentajeComision:=TxtPorcentajeComision.Text.ToEntero, - TipoGarantia:=DdlTipoGarantia.SelectedValue.ToEntero, Folio:=TxtFolio.Text.ToEntero, FechaVenc:=txtFechaVenc.Text.ToDate, EstatusFianza:=DdlEstatusFianza.SelectedValue.ToEntero, CvePeriodo:=DdlPeriodo.SelectedValue.ToEntero, CveCuentaEquipo:=DdlCuentaEquipo.SelectedValue.ToEntero, CveContratoPlantilla:=DdlPlantillaContrato.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero) + TipoGarantia:=DdlTipoGarantia.SelectedValue.ToEntero, Folio:=TxtFolio.Text.ToEntero, FechaVenc:=txtFechaVenc.Text.ToDate, EstatusFianza:=DdlEstatusFianza.SelectedValue.ToEntero, CvePeriodo:=DdlPeriodo.SelectedValue.ToEntero, CveCuentaEquipo:=DdlCuentaEquipo.SelectedValue.ToEntero, CveContratoPlantilla:=DdlPlantillaContrato.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, + ObservacionesGenerales:=TxtObsGeneral.Text.Trim) If CveContratoHijo > 0 Then @@ -4578,6 +4580,61 @@ Partial Class Contratos_Default Plantilla = Plantilla.ToString().Replace("{FINMESANTERIOR}", mesAnterior) End If + Alert(Plantilla) + End Sub + Protected Sub BtnVerPlantilla2_Click(sender As Object, e As EventArgs) + Dim Plantilla As String = TxtObsGeneral.Text + + If Plantilla.Contains("{DIA}") Then + Plantilla = Plantilla.Replace("{DIA}", DateTime.Now.Day.ToString()) + End If + + If Plantilla.Contains("{MES}") Then + Dim fecha As DateTime = DateTime.Now + Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat + Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper() + + Plantilla = Plantilla.ToString().Replace("{MES}", nombreMes) + End If + + If Plantilla.Contains("{AÑO}") Then + Plantilla = Plantilla.Replace("{AÑO}", DateTime.Now.Year.ToString()) + End If + + If Plantilla.Contains("{TC}") Then + Plantilla = Plantilla.Replace("{TC}", GlobalTipoCambio(Now).FormatoNumero) + End If + + If Plantilla.Contains("{MESANTERIOR}") Then + Dim fecha As DateTime = DateTime.Now.AddMonths(-1) + Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat + Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper() + + Plantilla = Plantilla.ToString().Replace("{MESANTERIOR}", nombreMes) + End If + + If Plantilla.Contains("{INICIOMESANTERIOR}") Then + Dim fecha As DateTime = DateTime.Now.AddMonths(-1) + Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat + Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper() + + Dim mesAnterior As String = String.Format("01 {0} {1}", nombreMes, fecha.Year) + + Plantilla = Plantilla.ToString().Replace("{INICIOMESANTERIOR}", mesAnterior) + End If + + If Plantilla.Contains("{FINMESANTERIOR}") Then + Dim fecha As DateTime = DateTime.Now.AddMonths(-1) + Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat + Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper() + + Dim LastDayOfMonth = DateTime.DaysInMonth(fecha.Year, fecha.Month) + + Dim mesAnterior As String = String.Format("{0} {1} {2}", LastDayOfMonth, nombreMes, fecha.Year) + + Plantilla = Plantilla.ToString().Replace("{FINMESANTERIOR}", mesAnterior) + End If + Alert(Plantilla) End Sub End Class diff --git a/Contratos/FacturacionMasiva.aspx.vb b/Contratos/FacturacionMasiva.aspx.vb index 01c6fc60e..4057e0c9d 100644 --- a/Contratos/FacturacionMasiva.aspx.vb +++ b/Contratos/FacturacionMasiva.aspx.vb @@ -142,6 +142,14 @@ Partial Class Contratos_FacturacionMasiva Row("Observaciones") = Row("Observaciones").ToString().Replace("{MES}", nombreMes) End If + If Row("Observaciones").ToString().Contains("{MESANTERIOR}") Then + Dim fecha As DateTime = DateTime.Now.AddMonths(-1) + Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat + Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper() + + Row("Observaciones") = Row("Observaciones").ToString().Replace("{MESANTERIOR}", nombreMes) + End If + If Row("Observaciones").ToString().Contains("{AÑO}") Then Row("Observaciones") = Row("Observaciones").ToString().Replace("{AÑO}", DateTime.Now.Year.ToString()) End If diff --git a/Ventas/Ventas.aspx b/Ventas/Ventas.aspx index 24d824ff0..36662c5fb 100644 --- a/Ventas/Ventas.aspx +++ b/Ventas/Ventas.aspx @@ -6886,7 +6886,7 @@
+ DataKeyNames="CveVenta,CveMetodoPago33,CveFormaPago33,CveMoneda" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn" GridLines="None"> diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 702b2b7b4..9dc5ed8ca 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -3986,9 +3986,12 @@ Partial Class Ventas UpPS.Update() Exit Sub Else + + Dim ObsPlantilla As String = PlantillaContrato(Row.DataKey("Observaciones")) + SeleccionadoContrato += Row.FCTextBox("TxtCant").Text.ToEntero() * Row.FCLiteral("LtlPU").Text.ToDouble AgregarProductoServicio(Row.FCTextBox("TxtCant").Text.ToEntero(), Row.DataKey("CveUM").ToEntero(), Row.FCLiteral("LtlUM").Text, Row.DataKey("CveClasificacion").ToEntero(), - Row.DataKey("Clasificacion"), Row.DataKey("CvePS").ToEntero(), Row.FCLiteral("LtlPS").Text, If(CveCicloComercial > 0, Row.DataKey("Observaciones"), $"/ {Row.FCLiteral("LtCveInterna").Text}"), Row.FCLiteral("LtlPU").Text.ToDecimal, 0, + Row.DataKey("Clasificacion"), Row.DataKey("CvePS").ToEntero(), Row.FCLiteral("LtlPS").Text, If(CveCicloComercial > 0, ObsPlantilla, $"/ {Row.FCLiteral("LtCveInterna").Text}"), Row.FCLiteral("LtlPU").Text.ToDecimal, 0, DrContrato("CveProyecto").ToString().ToEntero(), DrContrato("ProyectoContrato").ToString(), DrContrato("CveSubProyecto").ToString().ToEntero(), DrContrato("SubProyectoContrato").ToString(), CveContratoDetalle:=Row.DataKey("CveContratoDetalle").ToEntero()) 'AddPS(Row.FCTextBox("TxtCant").Text.ToEntero(), Row.DataKey("CveUM").ToEntero(), Row.FCLiteral("LtlUM").Text, Row.DataKey("CveClasificacion").ToEntero(), Row.DataKey("Clasificacion"), ' Row.DataKey("CvePS").ToEntero(), Row.FCLiteral("LtlPS").Text, If(CveCicloComercial > 0, Row.DataKey("Observaciones"), $"/ {Row.FCLiteral("LtCveInterna").Text}"), Row.FCLiteral("LtlPU").Text.ToDouble, If(Row.DataKey("IVA").ToDouble = -1, ViewState("IVA").ToString().ToDouble, Row.DataKey("IVA").ToDouble), 0, 0, 1, 0, True, "", @@ -7825,6 +7828,21 @@ Partial Class Ventas GvPS.Rows(e.NewEditIndex).FCTextBox("TxtPrecio").Enabled = False GvPS.Rows(e.NewEditIndex).FCTextBox("TxtDescuento").Enabled = False End If + + If CveCicloComercial > 0 Then + For Each gvr As GridViewRow In GvContratoDetalles.Rows + If gvr.RowType = DataControlRowType.DataRow Then + If gvr.DataKey("Cantidad").ToString().ToDecimal() = GvPS.Rows(e.NewEditIndex).DataKey("Cantidad").ToString().ToDecimal() AndAlso gvr.DataKey("CvePS").ToString().ToEntero() = GvPS.Rows(e.NewEditIndex).DataKey("CvePS").ToString().ToEntero() Then + If gvr.DataKey("LimitarCantidad").ToString() = "False" Then + GvPS.Rows(e.NewEditIndex).FCTextBox("TxtCantidad").Enabled = True + Exit For + End If + End If + End If + Next + + End If + End Sub Protected Sub GvPS_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GvPS.RowCancelingEdit GvPS.EditIndex = -1 @@ -12538,7 +12556,7 @@ Partial Class Ventas CveTipoAmortizacionAnticipo:=factura.CveTipoAmortizacionAnticipo, CveEmpresaCRM:=CveEmpresaCRM, EsInterno:=EsInterno, CveAcercamientoCRM:=CveAcercamientoCRM, 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) Then + FormaPaqueteria:=RblPaqueteria.SelectedValue.ToEntero, FacturarSucursal:=factura.FacturarSucursal, VentaDesglosaIEPS:=factura.VentaDesglosaIEPS, RFCReceptor:=RFCReceptor, Adjunto:=Adjunto, DevolucionImportePagado:=factura.DevolucionImportePagado, EsGarantia:=factura.EsGarantia, ServicioDomicilio:=TrServicioDomicilio.Visible) 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 @@ -24088,7 +24106,15 @@ Partial Class Ventas DdlContratosModal.DataSource = ObjContratos.DtResultados DdlContratosModal.SelectedValue = ObjContratos.DtResultados(0)("CveContrato").ToString() DdlContratosModal_SelectedIndexChanged(Nothing, Nothing) - GvContratoDetalles.HeaderRow.Cells(1).Style.Add("display", "none") + + If GvContratoDetalles.HeaderRow IsNot Nothing Then + If GvContratoDetalles.HeaderRow.Cells.Count > 0 Then + GvContratoDetalles.HeaderRow.Cells(1).Style.Add("display", "none") + End If + End If + + TxtObsFact.Text = PlantillaContrato(ObjContratos.DtResultados(0)("ObservacionesGenerales").ToString()) + BtnCargarContratoDetalles_Click(Nothing, Nothing) LbAgregar.Visible = True UpPS.Update() @@ -24103,6 +24129,62 @@ Partial Class Ventas End If ObjContratos.Dispose() End Sub + + Private Function PlantillaContrato(texto As String) As String + Dim Plantilla As String = texto + + If Plantilla.Contains("{DIA}") Then + Plantilla = Plantilla.Replace("{DIA}", DateTime.Now.Day.ToString()) + End If + + If Plantilla.Contains("{MES}") Then + Dim fecha As DateTime = DateTime.Now + Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat + Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper() + + Plantilla = Plantilla.ToString().Replace("{MES}", nombreMes) + End If + + If Plantilla.Contains("{AÑO}") Then + Plantilla = Plantilla.Replace("{AÑO}", DateTime.Now.Year.ToString()) + End If + + If Plantilla.Contains("{TC}") Then + Plantilla = Plantilla.Replace("{TC}", GlobalTipoCambio(Now).FormatoNumero) + End If + + If Plantilla.Contains("{MESANTERIOR}") Then + Dim fecha As DateTime = DateTime.Now.AddMonths(-1) + Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat + Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper() + + Plantilla = Plantilla.ToString().Replace("{MESANTERIOR}", nombreMes) + End If + + If Plantilla.Contains("{INICIOMESANTERIOR}") Then + Dim fecha As DateTime = DateTime.Now.AddMonths(-1) + Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat + Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper() + + Dim mesAnterior As String = String.Format("01 {0} {1}", nombreMes, fecha.Year) + + Plantilla = Plantilla.ToString().Replace("{INICIOMESANTERIOR}", mesAnterior) + End If + + If Plantilla.Contains("{FINMESANTERIOR}") Then + Dim fecha As DateTime = DateTime.Now.AddMonths(-1) + Dim formatoFecha = Globalization.CultureInfo.CurrentCulture.DateTimeFormat + Dim nombreMes = formatoFecha.GetMonthName(fecha.Month).ToUpper() + + Dim LastDayOfMonth = DateTime.DaysInMonth(fecha.Year, fecha.Month) + + Dim mesAnterior As String = String.Format("{0} {1} {2}", LastDayOfMonth, nombreMes, fecha.Year) + + Plantilla = Plantilla.ToString().Replace("{FINMESANTERIOR}", mesAnterior) + End If + + Return Plantilla + End Function #End Region #Region "DESCARGAR E IMPRIMIR LISTADO" @@ -27621,6 +27703,23 @@ Partial Class Ventas End If End If + Dim Monedas As New List(Of Integer) + For Each gvr As GridViewRow In GvCxC.Rows + If gvr.FCCheckBox("ChkCxC").Checked Then + Monedas.Add(gvr.DataKey("CveMoneda").ToString().ToEntero()) + End If + Next + + Monedas = Monedas.Distinct().ToList() + + If Monedas.Count > 0 Then + If Monedas.Count > 1 Then + Alert($"Debe seleccionar facturas de la misma moneda", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + DdlMoneda.SelectedValueExist(Monedas(0).ToString()) + End If + RegistraScript("$('#ModalAplicarNC').modal('hide');", "EscondeModalNC") CveVentaUsadoDevolucionEfectivo = -1 From c396278825789c3eca2f4c5e15c26661ea96d9e9 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 7 Sep 2022 20:54:29 -0700 Subject: [PATCH 2/6] Devoluciones y notas de credito de compra en reporte sin almacen --- Inventarios/RepNotasSinAlmacen.aspx | 2 ++ Inventarios/RepNotasSinAlmacen.aspx.vb | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Inventarios/RepNotasSinAlmacen.aspx b/Inventarios/RepNotasSinAlmacen.aspx index 8d2148f99..eeb3a3dbc 100644 --- a/Inventarios/RepNotasSinAlmacen.aspx +++ b/Inventarios/RepNotasSinAlmacen.aspx @@ -132,6 +132,8 @@ + +
<%--
Sucursal:
diff --git a/Inventarios/RepNotasSinAlmacen.aspx.vb b/Inventarios/RepNotasSinAlmacen.aspx.vb index 5fccd46e7..4838bd1b0 100644 --- a/Inventarios/RepNotasSinAlmacen.aspx.vb +++ b/Inventarios/RepNotasSinAlmacen.aspx.vb @@ -146,7 +146,7 @@ Partial Class RepNotasSinAlmacen CveClienteProveedor = DdlProveedor.SelectedValue.ToEntero End If - If Reporte.RepNotasSinAlmacen(2, CveClienteProveedor, FechaInicial, FechaFinal, DdlTipoDocto2.SelectedValue.ToEntero, DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.Empresa.CveEmpresa) Then + If Reporte.RepNotasSinAlmacen(2, CveClienteProveedor, FechaInicial, FechaFinal, DdlTipoDocto2.SelectedValue, DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.Empresa.CveEmpresa) Then GvCompras.DataSource = Reporte.DtResultados DtNotasSinAlmacenCompras = Reporte.DtResultados Else From acd580af52b299c393231cef2019fadecb50157f Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 7 Sep 2022 20:55:25 -0700 Subject: [PATCH 3/6] Correcion de error al calcular el BCI --- Inventarios/RecepcionUsados.aspx.vb | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Inventarios/RecepcionUsados.aspx.vb b/Inventarios/RecepcionUsados.aspx.vb index 17cc978e4..a6f23b581 100644 --- a/Inventarios/RecepcionUsados.aspx.vb +++ b/Inventarios/RecepcionUsados.aspx.vb @@ -2980,6 +2980,9 @@ Partial Class Inventarios_RecepcionUsados Dim CveTamanio As Integer = -1 Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSParametro).FiltroPrimero("") + DdlBCIAjuste.SelectedValue = Nothing + DdlBCIAjuste.Items.Clear() + If drPS IsNot Nothing Then Dim CvePrecioListaPS As Integer = GlobalDTCliente(UsuarioActual.CveEmpresa, Estatus:=-1, CveCliente:=DdlClientes.SelectedValue.ToEntero).FiltroPrimeroValor("CvePrecioLista").ToEntero() If CvePrecioListaPS > 0 Then @@ -2994,6 +2997,17 @@ Partial Class Inventarios_RecepcionUsados CveClasificacion = drPS("CveClasificacion").ToString.ToEntero CveTamanio = drPS("CveTamaño").ToString.ToEntero + If DTBCIUsados IsNot Nothing AndAlso CveTamanio > 0 Then + DdlBCIAjuste.DataSource = DTBCIUsados.FiltraParametros($"CveTamaño={CveTamanio}") + DdlBCIAjuste.DataBind() + DdlBCIAjuste.Items.Insert(0, New ListItem("Seleccione", "-1")) + If CveTamanio = 16 Then 'motobaterias + DdlBCIAjuste.Items.Insert(0, New ListItem(" - ", "0")) + End If + Else + DdlBCIAjuste.Items.Insert(0, New ListItem(" - ", "0")) + End If + Dim Arr = PS.Split("-"c) If Arr.Count > 1 Then If (DdlBCIAjuste.Items.FindByText(Arr(1).ToString) IsNot Nothing) Then @@ -3001,7 +3015,6 @@ Partial Class Inventarios_RecepcionUsados End If End If - End If HdnPSAjusteMarca.Value = CveMarca.ToString() @@ -3054,19 +3067,6 @@ Partial Class Inventarios_RecepcionUsados 'CvePrecioLista = CvePrecioListaPS End If - DdlBCIAjuste.Items.Clear() - If DTBCIUsados IsNot Nothing AndAlso CveTamanio > 0 Then - DdlBCIAjuste.DataSource = DTBCIUsados.FiltraParametros($"CveTamaño={CveTamanio}") - DdlBCIAjuste.DataBind() - DdlBCIAjuste.Items.Insert(0, New ListItem("Seleccione", "-1")) - If CveTamanio = 16 Then 'motobaterias - DdlBCIAjuste.Items.Insert(0, New ListItem(" - ", "0")) - End If - 'UPPDatosUsado.Update() ''refresca el RFV - Else - DdlBCIAjuste.Items.Insert(0, New ListItem(" - ", "0")) - End If - DdlTipoUso.Items.Clear() DdlTipoUso.DataSource = GlobalDTAcumGarantiasMesesTipoUso(UsuarioActual.CveEmpresa, CveMarca) DdlTipoUso.Items.Insert(0, New ListItem("Seleccione", "-1")) From 0bcdb8df74ae7d3b907a38837229541ee6d8986b Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 7 Sep 2022 20:55:52 -0700 Subject: [PATCH 4/6] CveSubProyecto al loguear --- asmx/WSApp.asmx | 444 ++++++++++++++++++++++++------------------------ 1 file changed, 225 insertions(+), 219 deletions(-) diff --git a/asmx/WSApp.asmx b/asmx/WSApp.asmx index 8506eb55c..12557d044 100644 --- a/asmx/WSApp.asmx +++ b/asmx/WSApp.asmx @@ -1,5 +1,5 @@ -<%@ WebService Language="VB" Class="WSApp" %> - +<%@ WebService Language="VB" Class="WSApp" %> + Option Explicit On Imports System.Data @@ -22,26 +22,26 @@ Imports Newtonsoft.Json.Linq Public Class WSApp - Inherits System.Web.Services.WebService + Inherits System.Web.Services.WebService #Region "G L O B A L - D T" - + Public ReadOnly Property UrlSitio As String Get Return ConfigurationManager.AppSettings("UrlSitio").ToString End Get End Property - ReadOnly Property GlobalDTPS(CveEmpresa As Integer, Optional CvePS As Integer = -1, Optional SATClavePS As String = "-1", Optional AplicaParaVenta As Integer = -1, Optional Estatus As Integer = -1, Optional Codigo As String = "-1") As DataTable - Get - Dim ObjPS As New ClsProductosServicios - - If ObjPS.GetPS(CvePS, -1, CveEmpresa, Codigo:=Codigo, SATClavePS:=SATClavePS, pAplicaParaVenta:=AplicaParaVenta, pEstado:=Estatus) Then - GlobalDTPS = ObjPS.DtResultados - Else - GlobalDTPS = Nothing - End If - - ObjPS.Dispose() - End Get + ReadOnly Property GlobalDTPS(CveEmpresa As Integer, Optional CvePS As Integer = -1, Optional SATClavePS As String = "-1", Optional AplicaParaVenta As Integer = -1, Optional Estatus As Integer = -1, Optional Codigo As String = "-1") As DataTable + Get + Dim ObjPS As New ClsProductosServicios + + If ObjPS.GetPS(CvePS, -1, CveEmpresa, Codigo:=Codigo, SATClavePS:=SATClavePS, pAplicaParaVenta:=AplicaParaVenta, pEstado:=Estatus) Then + GlobalDTPS = ObjPS.DtResultados + Else + GlobalDTPS = Nothing + End If + + ObjPS.Dispose() + End Get End Property Property GlobalDTMonedas() As DataTable @@ -67,37 +67,37 @@ Public Class WSApp Set(value As DataTable) Application("GlobalDTVtaFormaPago") = value End Set - End Property - Public Property GlobalDTSubProyectos(CveProyecto As Integer, Optional CveSubProyecto As Integer = -1, Optional CveEmpresa As Integer = -1, Optional Estatus As Integer = 1) As DataTable - Get - Dim AppNombre As String = String.Format("GlobalDTSubProyectos-{0}", CveEmpresa) - 'sino existe, recarga los datos - If DirectCast(Application(AppNombre), DataTable) Is Nothing Or (DirectCast(Application(AppNombre), DataTable) IsNot Nothing AndAlso DirectCast(Application(AppNombre), DataTable).Rows.Count = 0) Then - Dim P As New ClsSubProyectos - If P.GetSubProyectos(CveEmpresa:=CveEmpresa) Then Application(AppNombre) = P.DtResultados - P.Dispose() - End If - - If CveProyecto <> -1 OrElse CveSubProyecto <> -1 OrElse CveEmpresa <> -1 OrElse Estatus <> -1 Then - Dim StrSQL As New StringBuilder - If CveProyecto <> -1 Then StrSQL.AppendFormat(" AND CveProyecto = {0}", CveProyecto) - If CveSubProyecto <> -1 Then StrSQL.AppendFormat(" AND CveSubProyecto = {0}", CveSubProyecto) - If Estatus <> -1 Then StrSQL.AppendFormat(" AND CveEstatus = {0}", Estatus) - If CveEmpresa <> -1 Then StrSQL.AppendFormat(" AND CveEmpresa = {0}", CveEmpresa) - - Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows) - GlobalDTSubProyectos = Dv.ToTable - Dv.Dispose() - - Else - GlobalDTSubProyectos = DirectCast(Application(AppNombre), DataTable) - End If - - End Get - Set(ByVal value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTSubProyectos-{0}", CveEmpresa) - Application(AppNombre) = value - End Set + End Property + Public Property GlobalDTSubProyectos(CveProyecto As Integer, Optional CveSubProyecto As Integer = -1, Optional CveEmpresa As Integer = -1, Optional Estatus As Integer = 1) As DataTable + Get + Dim AppNombre As String = String.Format("GlobalDTSubProyectos-{0}", CveEmpresa) + 'sino existe, recarga los datos + If DirectCast(Application(AppNombre), DataTable) Is Nothing Or (DirectCast(Application(AppNombre), DataTable) IsNot Nothing AndAlso DirectCast(Application(AppNombre), DataTable).Rows.Count = 0) Then + Dim P As New ClsSubProyectos + If P.GetSubProyectos(CveEmpresa:=CveEmpresa) Then Application(AppNombre) = P.DtResultados + P.Dispose() + End If + + If CveProyecto <> -1 OrElse CveSubProyecto <> -1 OrElse CveEmpresa <> -1 OrElse Estatus <> -1 Then + Dim StrSQL As New StringBuilder + If CveProyecto <> -1 Then StrSQL.AppendFormat(" AND CveProyecto = {0}", CveProyecto) + If CveSubProyecto <> -1 Then StrSQL.AppendFormat(" AND CveSubProyecto = {0}", CveSubProyecto) + If Estatus <> -1 Then StrSQL.AppendFormat(" AND CveEstatus = {0}", Estatus) + If CveEmpresa <> -1 Then StrSQL.AppendFormat(" AND CveEmpresa = {0}", CveEmpresa) + + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), StrSQL.ToString.Trim.TrimStart("A"c, "N"c, "D"c), "", DataViewRowState.CurrentRows) + GlobalDTSubProyectos = Dv.ToTable + Dv.Dispose() + + Else + GlobalDTSubProyectos = DirectCast(Application(AppNombre), DataTable) + End If + + End Get + Set(ByVal value As DataTable) + Dim AppNombre As String = String.Format("GlobalDTSubProyectos-{0}", CveEmpresa) + Application(AppNombre) = value + End Set End Property Property GlobalDTSATUsosCFDI(Optional EsPersonaFisica As Integer = -1) As DataTable Get @@ -249,43 +249,43 @@ Public Class WSApp Application("GlobalTipoCambio") = value End Set - End Property - - Property GlobalDTOCEstatusUsuarios(CveEmpresa As Integer, Optional CveUsuario As Integer = -1, Optional Tipo As String = "") As DataTable - Get - - Dim AppNombre As String = String.Format("GlobalDTOCEstatusUsuarios-{0}", CveEmpresa) - 'sino existe, recarga los datos - If DirectCast(HttpContext.Current.Application(AppNombre), DataTable) Is Nothing Then - - Dim ObjOC As New ClsOC - If ObjOC.GetEstatusUsuarios(-1, -1, -1, -1, CveEmpresa) Then - HttpContext.Current.Application(AppNombre) = ObjOC.DtResultados - Else - HttpContext.Current.Application(AppNombre) = Nothing - End If - - ObjOC.Dispose() - - End If - - Dim filtro As New StringBuilder - filtro.AppendFormat("CveEmpresa = {0} ", CveEmpresa) - If CveUsuario > 0 Then - filtro.AppendFormat(" AND CveUsuario={0} ", CveUsuario) - End If - If Tipo <> "" Then - filtro.AppendFormat(" AND Tipo='{0}'", Tipo) - End If - Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), filtro.ToString, "", DataViewRowState.CurrentRows) - GlobalDTOCEstatusUsuarios = Dv.ToTable - Dv.Dispose() - - End Get - Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTOCEstatusUsuarios-{0}", CveEmpresa) - HttpContext.Current.Application(AppNombre) = value - End Set + End Property + + Property GlobalDTOCEstatusUsuarios(CveEmpresa As Integer, Optional CveUsuario As Integer = -1, Optional Tipo As String = "") As DataTable + Get + + Dim AppNombre As String = String.Format("GlobalDTOCEstatusUsuarios-{0}", CveEmpresa) + 'sino existe, recarga los datos + If DirectCast(HttpContext.Current.Application(AppNombre), DataTable) Is Nothing Then + + Dim ObjOC As New ClsOC + If ObjOC.GetEstatusUsuarios(-1, -1, -1, -1, CveEmpresa) Then + HttpContext.Current.Application(AppNombre) = ObjOC.DtResultados + Else + HttpContext.Current.Application(AppNombre) = Nothing + End If + + ObjOC.Dispose() + + End If + + Dim filtro As New StringBuilder + filtro.AppendFormat("CveEmpresa = {0} ", CveEmpresa) + If CveUsuario > 0 Then + filtro.AppendFormat(" AND CveUsuario={0} ", CveUsuario) + End If + If Tipo <> "" Then + filtro.AppendFormat(" AND Tipo='{0}'", Tipo) + End If + Dim Dv As New DataView(DirectCast(HttpContext.Current.Application(AppNombre), DataTable), filtro.ToString, "", DataViewRowState.CurrentRows) + GlobalDTOCEstatusUsuarios = Dv.ToTable + Dv.Dispose() + + End Get + Set(value As DataTable) + Dim AppNombre As String = String.Format("GlobalDTOCEstatusUsuarios-{0}", CveEmpresa) + HttpContext.Current.Application(AppNombre) = value + End Set End Property 'Property GlobalDTOCEstatusUsuarios(CveEmpresa As Integer, Optional CveUsuario As Integer = -1, Optional Tipo As String = "") As DataTable @@ -327,42 +327,42 @@ Public Class WSApp Application("GlobalDTCompProveedores") = value End Set End Property - Public Property GlobalDTPSSimplificado(CveEmpresa As Integer, Optional CveClasificacion As Integer = -1, Optional PSCodigo As String = "-1", Optional Estatus As Integer = 1, Optional AplicaParaVenta As Integer = -1, Optional CvePS As Integer = -1) As DataTable - Get - Dim AppNombre As String = String.Format("GlobalDTPSSimplificado-{0}", CveEmpresa) - If CveEmpresa <> -1 Then - 'sino existe, recarga los datos - If Application(AppNombre) Is Nothing Then - Dim ObjPS As New ClsProductosServicios - If ObjPS.GetPSSimplificado(CveEmpresa) Then Application(AppNombre) = ObjPS.DtResultados.AsEnumerable() - ObjPS.Dispose() - - End If - - - Dim Cons = DirectCast(Application(AppNombre), EnumerableRowCollection(Of DataRow)) - - Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveEmpresa) = CveEmpresa)) - If CveClasificacion >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveClasificacion) = CveClasificacion)) - If PSCodigo <> "-1" Then Cons = Cons.Where((Function(a) Convert.ToString(a!PSCodigo) = PSCodigo)) - If Estatus >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveEstado) = Estatus)) - If AplicaParaVenta >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!AplicaParaVenta) = AplicaParaVenta)) - If CvePS >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CvePS) = CvePS)) - - Try - GlobalDTPSSimplificado = Cons.OrderBy(Function(a) a!PSCodigo).CopyToDataTable - Catch ex As Exception - GlobalDTPSSimplificado = New DataTable - End Try - - Else - GlobalDTPSSimplificado = DirectCast(Application(AppNombre), EnumerableRowCollection(Of DataRow)).CopyToDataTable - End If - End Get - Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTPSSimplificado-{0}", CveEmpresa) - Application(AppNombre) = value - End Set + Public Property GlobalDTPSSimplificado(CveEmpresa As Integer, Optional CveClasificacion As Integer = -1, Optional PSCodigo As String = "-1", Optional Estatus As Integer = 1, Optional AplicaParaVenta As Integer = -1, Optional CvePS As Integer = -1) As DataTable + Get + Dim AppNombre As String = String.Format("GlobalDTPSSimplificado-{0}", CveEmpresa) + If CveEmpresa <> -1 Then + 'sino existe, recarga los datos + If Application(AppNombre) Is Nothing Then + Dim ObjPS As New ClsProductosServicios + If ObjPS.GetPSSimplificado(CveEmpresa) Then Application(AppNombre) = ObjPS.DtResultados.AsEnumerable() + ObjPS.Dispose() + + End If + + + Dim Cons = DirectCast(Application(AppNombre), EnumerableRowCollection(Of DataRow)) + + Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveEmpresa) = CveEmpresa)) + If CveClasificacion >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveClasificacion) = CveClasificacion)) + If PSCodigo <> "-1" Then Cons = Cons.Where((Function(a) Convert.ToString(a!PSCodigo) = PSCodigo)) + If Estatus >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CveEstado) = Estatus)) + If AplicaParaVenta >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!AplicaParaVenta) = AplicaParaVenta)) + If CvePS >= 0 Then Cons = Cons.Where((Function(a) Convert.ToInt32(a!CvePS) = CvePS)) + + Try + GlobalDTPSSimplificado = Cons.OrderBy(Function(a) a!PSCodigo).CopyToDataTable + Catch ex As Exception + GlobalDTPSSimplificado = New DataTable + End Try + + Else + GlobalDTPSSimplificado = DirectCast(Application(AppNombre), EnumerableRowCollection(Of DataRow)).CopyToDataTable + End If + End Get + Set(value As DataTable) + Dim AppNombre As String = String.Format("GlobalDTPSSimplificado-{0}", CveEmpresa) + Application(AppNombre) = value + End Set End Property Property GlobalDTClasificaciones(Optional CveEmpresa As Integer = -1, Optional CveCategoria As Integer = -1) As DataTable Get @@ -471,34 +471,34 @@ Public Class WSApp Set(value As DataTable) Application("GlobalDTMotivosHorasExtras") = value End Set - End Property - - - Public Property GlobalDTUnidadesMedida(Optional CveEmpresa As Integer = -1) As DataTable - Get - Dim AppNombre As String = String.Format("GlobalDTUnidadesMedida-{0}", CveEmpresa) - 'sino existe, recarga los datos - If DirectCast(Application(AppNombre), DataTable) Is Nothing Or (DirectCast(Application(AppNombre), DataTable) IsNot Nothing AndAlso DirectCast(Application(AppNombre), DataTable).Rows.Count = 0) Then - Dim ObjUnidadesMedida As New ClsUnidadesMedida() - If ObjUnidadesMedida.GetUnidadesMedida(CveEmpresa) Then Application(AppNombre) = ObjUnidadesMedida.DtResultados - ObjUnidadesMedida.Dispose() - End If - - If CveEmpresa <> -1 Then - Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), " UnidadMedida", DataViewRowState.CurrentRows) - GlobalDTUnidadesMedida = Dv.ToTable - Dv.Dispose() - Else - GlobalDTUnidadesMedida = DirectCast(Application(AppNombre), DataTable) - End If - End Get - Set(value As DataTable) - Dim AppNombre As String = String.Format("GlobalDTUnidadesMedida-{0}", CveEmpresa) - Application(AppNombre) = value - End Set - End Property + End Property + + + Public Property GlobalDTUnidadesMedida(Optional CveEmpresa As Integer = -1) As DataTable + Get + Dim AppNombre As String = String.Format("GlobalDTUnidadesMedida-{0}", CveEmpresa) + 'sino existe, recarga los datos + If DirectCast(Application(AppNombre), DataTable) Is Nothing Or (DirectCast(Application(AppNombre), DataTable) IsNot Nothing AndAlso DirectCast(Application(AppNombre), DataTable).Rows.Count = 0) Then + Dim ObjUnidadesMedida As New ClsUnidadesMedida() + If ObjUnidadesMedida.GetUnidadesMedida(CveEmpresa) Then Application(AppNombre) = ObjUnidadesMedida.DtResultados + ObjUnidadesMedida.Dispose() + End If + + If CveEmpresa <> -1 Then + Dim Dv As New DataView(DirectCast(Application(AppNombre), DataTable), String.Format("CveEmpresa = {0}", CveEmpresa), " UnidadMedida", DataViewRowState.CurrentRows) + GlobalDTUnidadesMedida = Dv.ToTable + Dv.Dispose() + Else + GlobalDTUnidadesMedida = DirectCast(Application(AppNombre), DataTable) + End If + End Get + Set(value As DataTable) + Dim AppNombre As String = String.Format("GlobalDTUnidadesMedida-{0}", CveEmpresa) + Application(AppNombre) = value + End Set + End Property #End Region - + Public Property CveEmpresa As Integer = 143 Private Sub CreaObjetoEmpresa(ByRef UsuarioActual As Usuario) @@ -519,7 +519,7 @@ Public Class WSApp Else End If ObjEmpresa.Dispose() - End Sub + End Sub #Region "M E T O D O S - S E R V I C I O" Public Function ValidaUsuario(CveUsuario As Integer) As Usuario Dim UsuarioActual As Usuario = Nothing @@ -535,6 +535,7 @@ Public Class WSApp ObjUsuarios.Dispose() Return UsuarioActual End Function + Public Function Login(Usuario As String, Contrasenia As String) As String Dim retorno As String = "" @@ -562,15 +563,17 @@ Public Class WSApp If ObjClientes.DtResultados.Rows.Count > 0 Then Salida.Cliente = ObjClientes.Nombre Salida.CvePrecioLista = ObjClientes.CvePrecioLista - Salida.CveEstatusCliente = If(ObjClientes.Estatus, 1, 0) - + Salida.CveEstatusCliente = If(ObjClientes.Estatus, 1, 0) + If ObjClientes.CveSubProyecto > 0 Then + Salida.CveSubProyecto = ObjClientes.CveSubProyecto + End If retorno = JsonConvert.SerializeObject(Salida) - End If - Else + End If + Else retorno = "{}" - End If - - + End If + + Else retorno = "{}" End If @@ -610,6 +613,9 @@ Public Class WSApp Salida.Cliente = ObjClientes.Nombre Salida.CvePrecioLista = ObjClientes.CvePrecioLista Salida.CveEstatusCliente = If(ObjClientes.Estatus, 1, 0) + If ObjClientes.CveSubProyecto > 0 Then + Salida.CveSubProyecto = ObjClientes.CveSubProyecto + End If End If End If @@ -725,40 +731,40 @@ Public Class WSApp End If If ListaPS IsNot Nothing Then Dim Continuar As Boolean = False - Dim ObjPS As New ClsProductosServicios - Try - For Each PS In ListaPS - Dim CveTipoPS As Integer = GlobalDTPSSimplificado(CveEmpresa, CvePS:=PS.CvePS).FiltroPrimeroValor("CveTipoPS").ToEntero() - If CveTipoPS > 0 Then - If CveTipoPS = 2 Then - If ObjPS.GetPSExistencias(PS.CvePS, -1, -1, CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm")) Then - If ObjPS.DtResultados.Rows.Count > 0 Then - Dim Existencia As Decimal = ObjPS.DtResultados.Rows(0)("Existencia").ToString().ToDecimal() - 'Dim CveTipoPS As Integer = ObjPS.DtResultados.Rows(0)("CveTipoPS").ToString().ToEntero() - - Continuar = Existencia > 0 - - If Not Continuar Then - Retorno.Mensajes.Add($"El producto/servicio {ObjPS.DtResultados.Rows(0)("PS")} no tiene existencia.") - Exit For - End If - Else - Continuar = False - Retorno.Mensajes.Add("No se pudo comprobar la existencia.") - Exit For - End If - End If - ElseIf CveTipoPS = 1 Then - Continuar = True - End If - Else - Continuar = False - Retorno.Mensajes.Add("No se pudo comprobar si es producto o servicio.") - End If - Next - Catch ex As Exception - OnError("Ocurrió un error al consultar la existencia", ex) - Continuar = False + Dim ObjPS As New ClsProductosServicios + Try + For Each PS In ListaPS + Dim CveTipoPS As Integer = GlobalDTPSSimplificado(CveEmpresa, CvePS:=PS.CvePS).FiltroPrimeroValor("CveTipoPS").ToEntero() + If CveTipoPS > 0 Then + If CveTipoPS = 2 Then + If ObjPS.GetPSExistencias(PS.CvePS, -1, -1, CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm")) Then + If ObjPS.DtResultados.Rows.Count > 0 Then + Dim Existencia As Decimal = ObjPS.DtResultados.Rows(0)("Existencia").ToString().ToDecimal() + 'Dim CveTipoPS As Integer = ObjPS.DtResultados.Rows(0)("CveTipoPS").ToString().ToEntero() + + Continuar = Existencia > 0 + + If Not Continuar Then + Retorno.Mensajes.Add($"El producto/servicio {ObjPS.DtResultados.Rows(0)("PS")} no tiene existencia.") + Exit For + End If + Else + Continuar = False + Retorno.Mensajes.Add("No se pudo comprobar la existencia.") + Exit For + End If + End If + ElseIf CveTipoPS = 1 Then + Continuar = True + End If + Else + Continuar = False + Retorno.Mensajes.Add("No se pudo comprobar si es producto o servicio.") + End If + Next + Catch ex As Exception + OnError("Ocurrió un error al consultar la existencia", ex) + Continuar = False End Try ObjPS.Dispose() @@ -774,15 +780,15 @@ Public Class WSApp Dim Correo As String = If(CveSubProyecto.Contiene(11714, 11761), "mezclas.pescadito@gmail.com", "pedidosaguas@gmail.com") 'Dim Correo As String = "japmx95@gmail.com" Dim SerieFolio As String = Factura.SerieFolio - Dim DireccionEnvio As String = "" - Using ObjClientes As New ClsClientes - If ObjClientes.DireccionEnvioGet(-1, CveCliente, -1) Then - If ObjClientes.DtResultados.Rows.Count > 0 Then - DireccionEnvio = ObjClientes.DtResultados.FiltroPrimeroValor("DireccionEnvioContacto") - End If - End If - End Using - Factura.Dispose() + Dim DireccionEnvio As String = "" + Using ObjClientes As New ClsClientes + If ObjClientes.DireccionEnvioGet(-1, CveCliente, -1) Then + If ObjClientes.DtResultados.Rows.Count > 0 Then + DireccionEnvio = ObjClientes.DtResultados.FiltroPrimeroValor("DireccionEnvioContacto") + End If + End If + End Using + Factura.Dispose() EnviarCorreo(Correo, Factura, Retorno, DireccionEnvio, UsuarioActual) Else Factura.Dispose() @@ -801,7 +807,7 @@ Public Class WSApp End Try Return JsonConvert.SerializeObject(Retorno) - End Function + End Function Private Sub EnviarCorreo(Correo As String, Factura As Modelos.Factura, Retorno As Modelos.Factura.MMensajeFactura, DireccionEnvio As String, UsuarioActual As Usuario) Try Dim Hilo As New System.Threading.Thread(Sub() EnviarCorreoFactura(Correo, Factura, Retorno, DireccionEnvio, UsuarioActual)) @@ -809,17 +815,17 @@ Public Class WSApp Catch ex As Exception OnError("Ocurrió error al mandar el correo de facturación", ex) End Try - End Sub - Private Sub EnviarCorreoFactura(Correo As String, Factura As Modelos.Factura, Retorno As Modelos.Factura.MMensajeFactura, DireccionEnvio As String, UsuarioActual As Usuario) - Dim Body = GeneraCorreoRemision(Retorno.CveVenta, Retorno.SerieFolio, Factura.Cliente.Nombre, Factura.Cliente.NombreComercial, DireccionEnvio, Factura.Observaciones, DateTime.Now) - Factura.Dispose() - Try - Dim Asunto As String = String.Format("SIG - Se ha realizado un pedido: {0}", Retorno.SerieFolio) - Dim Mail As New ClsSisMail() - Mail.SendMail(UsuarioActual.Empresa, Correo, Asunto, Body) - Catch ex As Exception - OnError("Ocurrió error al mandar MAIL por cambio de Estatus", ex) - End Try + End Sub + Private Sub EnviarCorreoFactura(Correo As String, Factura As Modelos.Factura, Retorno As Modelos.Factura.MMensajeFactura, DireccionEnvio As String, UsuarioActual As Usuario) + Dim Body = GeneraCorreoRemision(Retorno.CveVenta, Retorno.SerieFolio, Factura.Cliente.Nombre, Factura.Cliente.NombreComercial, DireccionEnvio, Factura.Observaciones, DateTime.Now) + Factura.Dispose() + Try + Dim Asunto As String = String.Format("SIG - Se ha realizado un pedido: {0}", Retorno.SerieFolio) + Dim Mail As New ClsSisMail() + Mail.SendMail(UsuarioActual.Empresa, Correo, Asunto, Body) + Catch ex As Exception + OnError("Ocurrió error al mandar MAIL por cambio de Estatus", ex) + End Try End Sub Public Function CancelarDocumento(CveVenta As Integer, CveUsuario As Integer) As String @@ -885,9 +891,9 @@ Public Class WSApp Retorno.Mensajes.Add("Ocurrió un error al eliminar el movimiento. Por favor vuelva a intetar.") End If ObjInv.Dispose() - End Sub + End Sub #End Region - + #Region "P E D I D O S" Private Function PreParaTimbre(Obj As Modelos.Factura) As CFDITimbre Dim Timbre As New CFDITimbre @@ -1001,9 +1007,9 @@ Public Class WSApp i += 1 Next Return Timbre - End Function + End Function #End Region - + #Region "R E M I S I O N E S" Private Function CreaFactura(ByRef Retorno As Modelos.Factura.MMensajeFactura, CveCliente As Integer, CveAlmacen As Integer, CveSubProyecto As Integer, CveMoneda As Integer, UsuarioActual As Usuario, Observaciones As String, ListaPS As List(Of MVentaProductos)) As Modelos.Factura If CveSubProyecto <= 0 Then @@ -1411,8 +1417,8 @@ Public Class WSApp Row("Total") = (PS.Cantidad.Value * PS.Precio) Row("TotalImporte") = Math.Round(PS.Cantidad.Value * PS.Precio, 2) - - Row("SATClaveProdServ") = DrPS("SATClavePS") + + Row("SATClaveProdServ") = DrPS("SATClavePS") Row("SATClaveUM") = DrPS("SATClaveUnidadMedida") Row("EntregaDirecta") = EntregaDirecta @@ -1530,10 +1536,10 @@ Public Class WSApp End Try ObjVentas.Dispose() Return strBody.ToString - End Function + End Function #End Region - - + + End Class Namespace WebServiceAppModels2 From 129a45f29a8299bc79e258b5c874e14f626136eb Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 8 Sep 2022 10:04:14 -0700 Subject: [PATCH 5/6] - --- Bancos/Devoluciones.aspx.cs | 4 +-- Bancos/IE.aspx | 47 ++------------------------- Bancos/IE.aspx.vb | 65 ++++--------------------------------- 3 files changed, 11 insertions(+), 105 deletions(-) diff --git a/Bancos/Devoluciones.aspx.cs b/Bancos/Devoluciones.aspx.cs index 1f602c371..9bcabe81d 100644 --- a/Bancos/Devoluciones.aspx.cs +++ b/Bancos/Devoluciones.aspx.cs @@ -579,9 +579,9 @@ public partial class Bancos_Devoluciones : ClsPaginas // OTROS INGRESOS if (gvr.FCTextBox("TxtComision").Text.ToDecimal() != 0) { - int tcvecon = 78; + int tcvecon = 255; if (gvr.FCTextBox("TxtComision").Text.ToDecimal() > 0) - tcvecon = 255; + tcvecon = 78; if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoDevolucion, gvr.FCTextBox("TxtComision").Text.ToDecimal(), Ref, tcvecon, Conc, DateTime.Now, UsuarioActual.Empresa.IdCuentaOtrosIngresos, -1, CveIE: gvr.DataKey("CveIE").ToEntero(), CveSubProyecto: DdlSubProyecto.SelectedValue.ToEntero(), CveProveedor: cveProveedor, CvePersonal: cvePersonal, ImporteMX: gvr.FCTextBox("TxtComision").Text.ToDecimal(), CveIEDevolucion: CveIE)) { diff --git a/Bancos/IE.aspx b/Bancos/IE.aspx index 0e1eb9aa6..d5bbf5332 100644 --- a/Bancos/IE.aspx +++ b/Bancos/IE.aspx @@ -25,11 +25,7 @@ Complemento Pago - - -
  • - Actualizar Tipo Cambio -
  • +
  • PrePoliza
  • @@ -268,7 +264,7 @@ Clientes Proveedor - Viaticos - Personal + Viáticos @@ -1458,44 +1454,7 @@
    - - <%-- ACTUALIZAR TIPO CAMBIO PREPOLIZA --%> - +