From 8420af01e6541940b3647433e90831476caade04 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Tue, 27 Feb 2024 20:25:43 -0700 Subject: [PATCH] SMS 2024.02.26 --- App_Code/ClsInventarios.vb | 3 +- Ashx/SIGWeb.ashx | 3 +- General/SaldosIniciales.aspx.vb | 22 +++++-- Scripts/custom.js | 3 +- Ventas/Ventas.aspx.vb | 107 ++++++++++++++++++++------------ 5 files changed, 89 insertions(+), 49 deletions(-) diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index fcef9ea54..fd07547a1 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -2178,7 +2178,7 @@ Public Class ClsInventarios Return Retorno End Function - Public Function GetExistenciasProductosLike(PS As String, CveClasificacion As Integer, CveSubProyecto As Integer, Estatus As Integer, AplicaParaVenta As Integer, CveEmpresa As Integer, Optional CveMarca As Integer = -1, Optional MostrarTodosAlmacenes As Boolean = False) As Boolean + Public Function GetExistenciasProductosLike(PS As String, CveClasificacion As Integer, CveSubProyecto As Integer, Estatus As Integer, AplicaParaVenta As Integer, CveEmpresa As Integer, Optional CveMarca As Integer = -1, Optional MostrarTodosAlmacenes As Boolean = False, Optional CveAlmacen As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_ProductosServiciosInventario") @@ -2191,6 +2191,7 @@ Public Class ClsInventarios .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveMarca", SqlDbType.Int).Value = CveMarca .Add("@MostrarTodosAlmacenes", SqlDbType.Bit).Value = MostrarTodosAlmacenes + .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen End With Try diff --git a/Ashx/SIGWeb.ashx b/Ashx/SIGWeb.ashx index afd2898b0..9d6cd2c89 100644 --- a/Ashx/SIGWeb.ashx +++ b/Ashx/SIGWeb.ashx @@ -927,6 +927,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState Dim UsoClasificacion = IfNull(context.Request("usoclasificacion"), "-1").ToString.ToEntero Dim AplicaParaVenta = IfNull(context.Request("aplicaparaventa"), "1").ToString.ToEntero Dim CveMarca = IfNull(context.Request("cvemarca"), "-1").ToString.ToEntero + Dim CveAlmacen = IfNull(context.Request("cvealmacen"), "-1").ToString.ToEntero Dim UsaGlobal As Boolean = True Dim MostrarTodosAlmacenes As Boolean = False @@ -941,7 +942,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState Dim objInv As New ClsInventarios Try - If objInv.GetExistenciasProductosLike(Name, CveClasificacion, CveSubProyecto, Estatus.ToEntero, AplicaParaVenta, CveEmpresa, CveMarca, MostrarTodosAlmacenes:=MostrarTodosAlmacenes) Then + If objInv.GetExistenciasProductosLike(Name, CveClasificacion, CveSubProyecto, Estatus.ToEntero, AplicaParaVenta, CveEmpresa, CveMarca, MostrarTodosAlmacenes:=MostrarTodosAlmacenes, CveAlmacen:=CveAlmacen) Then ' limpio los almacenes donde no tiene ningun producto existencia diff --git a/General/SaldosIniciales.aspx.vb b/General/SaldosIniciales.aspx.vb index 618cb935f..21187f697 100644 --- a/General/SaldosIniciales.aspx.vb +++ b/General/SaldosIniciales.aspx.vb @@ -1627,6 +1627,12 @@ Partial Class General_SaldosIniciales TotalDetalles = (CantidadDetalle * PUDetalle) + IVA - RetIVA - RetISR + IEPSDetalle End If + If Math.Abs(TotalDetalles - Total) > 0.01 Then + ErrorCompras = True + Alert($"Registro {CountRow} El total no councide con el calculo de los detalles, total: {Total.ToString("###,###,###.00")} calculo detatalles: {TotalDetalles.ToString("###,###,###.00")}", TipoMensaje.MsgAdvertencia) + Exit For + End If + If Not ObjCompras.AddCompraDetalle(CveCompra, CveUnidadMedida, CvePS, CveSubProyecto, -1, 0, CantidadDetalle, PUDetalle, (CantidadDetalle * PUDetalle) * PorcentajeIVA, TotalDetalles, 0, "Carga Inicial", -1, IVAPorcentaje:=PorcentajeIVA, RetIVAPorcentaje:=RetIVAPorcentaje, RetISRPorcentaje:=RetISRPorcentaje, IEPSPS:=IEPSDetalle) Then ErrorCompras = True Exit For @@ -1756,6 +1762,7 @@ Partial Class General_SaldosIniciales Dim FolioFiscal As String = If(dt.Columns.Contains("Folio Fiscal"), Row("Folio Fiscal").ToString(), "") Dim PorcentajeIVA As Decimal = If(dt.Columns.Contains("PorcentajeIVA"), Round(Row("PorcentajeIVA").ToString().ToDecimal, 4), 0) Dim PorcentajeRetIVA As Decimal = If(dt.Columns.Contains("PorcentajeRetIVA"), Round(Row("PorcentajeRetIVA").ToString().ToDecimal, 4), 0) + Dim PorcentajeRetISR As Decimal = If(dt.Columns.Contains("PorcentajeRetISR"), Round(Row("PorcentajeRetISR").ToString().ToDecimal, 4), 0) Dim PedidoContrato As String = If(dt.Columns.Contains("Pedido"), Row("Pedido").ToString(), "") @@ -1882,9 +1889,14 @@ Partial Class General_SaldosIniciales TotalDetalles = (CantidadDetalle * PUDetalle) + IVA - RetIVA - RetISR + IEPSDetalle End If + If Math.Abs(TotalDetalles - Total) > 0.01 Then + ErrorVentas = True + Alert($"Registro {CountRow} El total no councide con el calculo de los detalles, total: {Total.ToString("###,###,###.00")} calculo detatalles: {TotalDetalles.ToString("###,###,###.00")}", TipoMensaje.MsgAdvertencia) + Exit For + End If If Not ObjVentas.AddVentaDetalle(CveVenta, CvePS, CantidadDetalle, CveUnidadMedida, PUDetalle * CantidadDetalle, IVADetalle, TotalDetalles, "Saldo Inicial", 0, 0, Sucursal.ToEntero(), 0, - PorcentajeIVA:=PorcentajeIVA, PorcentajeRetIVA:=PorcentajeRetIVA, ImporteRetIVA:=RetIVA, IEPS:=IEPSDetalle) Then + PorcentajeIVA:=PorcentajeIVA, PorcentajeRetIVA:=PorcentajeRetIVA, ImporteRetIVA:=RetIVA, IEPS:=IEPSDetalle, PorcentajeRetISR:=PorcentajeRetISR) Then ErrorVentas = True Exit For End If @@ -1926,12 +1938,12 @@ Partial Class General_SaldosIniciales 'If IEPS > 0 AndAlso Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, IEPS, Folio.ToString(), 38, String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=IEPS) Then ErrorVentas = True : Exit For If RetIVA > 0 Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, RetIVA, RetIVA, 8, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, PorcentajeImpuesto:=PorcentajeIVA, Contabilizable:=False) Then ErrorVentas = True : Exit For + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, RetIVA, RetIVA, 8, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, PorcentajeImpuesto:=PorcentajeRetIVA, Contabilizable:=False) Then ErrorVentas = True : Exit For End If - 'If RetISR > 0 Then - ' If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, RetISR, RetISR, 9, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, PorcentajeImpuesto:=Porce, Contabilizable:=False) Then ErrorVentas = True : Exit For - 'End If + If RetISR > 0 Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, RetISR, RetISR, 9, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, PorcentajeImpuesto:=PorcentajeRetISR, Contabilizable:=False) Then ErrorVentas = True : Exit For + End If If ImpuestoLocal > 0 Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImpuestoLocal, ImpuestoLocal, 27, Folio.ToString(), String.Format("{0}-{1}", Serie, Folio), CveVenta:=CveVenta, CveCliente:=CveCliente, PorcentajeImpuesto:=PorcentajeIVA, Contabilizable:=False) Then ErrorVentas = True : Exit For diff --git a/Scripts/custom.js b/Scripts/custom.js index bf0f194b8..5f92540ff 100644 --- a/Scripts/custom.js +++ b/Scripts/custom.js @@ -1274,7 +1274,8 @@ function setwebservice(idDdlWS, idhdValue, idhdText, btn) { aplicaparaventa: (!(DdlWS.data('aplicaparaventa')) || DdlWS.data('aplicaparaventa') == '') ? -1 : DdlWS.data('aplicaparaventa'), cvemarca: (!(DdlWS.data('cvemarca')) || DdlWS.data('cvemarca') == '') ? -1 : DdlWS.data('cvemarca'), esdistribuidor: (!(DdlWS.data('esdistribuidor')) || DdlWS.data('esdistribuidor') == '') ? -1 : DdlWS.data('esdistribuidor'), - cveclienteclasificacion: (!(DdlWS.data('cveclienteclasificacion')) || DdlWS.data('cveclienteclasificacion') == '') ? -1 : DdlWS.data('cveclienteclasificacion') + cveclienteclasificacion: (!(DdlWS.data('cveclienteclasificacion')) || DdlWS.data('cveclienteclasificacion') == '') ? -1 : DdlWS.data('cveclienteclasificacion'), + cvealmacen: (!(DdlWS.data('cvealmacen')) || DdlWS.data('cvealmacen') == '') ? -1 : DdlWS.data('cvealmacen') //Metodo: metodo diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 5636dd9da..8bf412498 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -2320,6 +2320,21 @@ Partial Class Ventas End Property + Public Property CveAlamcenFiltroDdl As Integer + Get + If ViewState("CveAlamcenFiltroDdl") Is Nothing Then + ViewState("CveAlamcenFiltroDdl") = -1 + End If + Return ViewState("CveAlamcenFiltroDdl").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveAlamcenFiltroDdl") = value + End Set + End Property + + + + #Region "VENTA MEDICA" Property EsVentaMedica As Boolean @@ -8049,8 +8064,16 @@ Partial Class Ventas Objeto.ddlWS.Attributes.Add("data-pagina", "ventas/ventas") Objeto.ddlWS.Attributes.Add("data-AplicaparaVenta", "1") End If + + If UsuarioActual.Empresa.Funcionalidad(578).ToEntero = 1 Then + Objeto.Attributes.Add("data-CveAlmacen", $"{CveAlamcenFiltroDdl}") + Objeto.ddlWS.Attributes.Add("data-CveAlmacen", $"{CveAlamcenFiltroDdl}") + End If + End If + + End Sub Private Sub CargaPSRemision(CveClasificacion As Integer, Objeto As ADServerControl.Dropdownlost) @@ -13472,7 +13495,17 @@ Partial Class Ventas If UsuarioActual.Empresa.Funcionalidad(578) = "1" AndAlso EsVentaMedica Then - CveAlmacenTraspasoDestino = CveAlmacenAsignado + If DdlSucursalCliente.SelectedValue.ToEntero > 0 Then + Dim objclientes As New ClsClientes + If objclientes.GetSucursales(CveCliente, -1) Then + CveAlmacenTraspasoDestino = objclientes.DtResultados.FiltroPrimeroValor("CveAlmacenAsignado", $" CveClienteSucursal = {DdlSucursalCliente.SelectedValue.ToEntero}").ToEntero + End If + objclientes.Dispose() + End If + + If Not CveAlmacenTraspasoDestino > 0 Then + CveAlmacenTraspasoDestino = CveAlmacenAsignado + End If If RBLTipoVenta.SelectedValue.ToEntero = 2 Then If Not ChkRequiereTecnico.Checked Then @@ -36627,34 +36660,6 @@ Partial Class Ventas End Sub - 'Private Sub CargaSucursalesModal(CveClienteSeleccionado As Integer) - - ' DdlSucursalClienteModal.Items.Clear() - ' DdlSucursalClienteModal.ClearSelection() - ' DdlSucursalClienteModal.SelectedValue = Nothing - - ' Dim ObjCliente As New ClsClientes - ' If ObjCliente.GetSucursales(CveClienteSeleccionado) Then - ' DdlSucursalClienteModal.DataSource = ObjCliente.DtResultados - ' If ObjCliente.DtResultados.Rows.Count > 0 Then - ' DvModalClientesucursal.Visible = True - ' Else - ' DvModalClientesucursal.Visible = False - ' End If - ' Else - ' DvModalClientesucursal.Visible = False - ' DdlSucursalClienteModal.DataSource = Nothing - ' End If - ' ObjCliente.Dispose() - - ' DdlSucursalClienteModal.DataBind() - ' DdlSucursalClienteModal.Items.Insert(0, New ListItem("Matriz", "-1")) - - ' UpDvModalTipoVenta.FindDataSourceControl - - 'End Sub - - Private Sub CargaDdlClientesSucursal() @@ -36751,13 +36756,6 @@ Partial Class Ventas UpDvModalTipoVenta.Update() End Sub - 'Protected Sub DdlClientesWS_selectedindexchange(sender As Object, e As EventArgs) - - ' CargaPSProcedimiento(DdlProcedimiento.SelectedValue.ToEntero, DdlClientesWS.SelectedValue.ToEntero, DdlSubProyectoDatos.SelectedValue.ToEntero) - ' 'CargaSucursalesModal(DdlClientesWS.SelectedValue.ToEntero) - - 'End Sub - Protected Sub DdlClienteSucursal_SelectedIndexChanged(sender As Object, e As EventArgs) Dim CveClienteSplit As Integer = -1 @@ -36821,9 +36819,7 @@ Partial Class Ventas ChkRequiereTecnicoModal.Enabled = True - 'DdlClientesWS.txtText.Value = "" - 'DdlClientesWS.txtValue.Value = "" - 'DdlClientesWS.ddl.SelectedValueExist(-1) + DdlClienteSucursal.SelectedValueExist(-1) DvModalRequiereOSFecha.Visible = False @@ -36885,8 +36881,6 @@ Partial Class Ventas End If End If - - For Each GvRow As GridViewRow In GvProductosProcedimiento.Rows Dim Cantidad As Decimal = GvRow.FCTextBox("TxtCantidad").Text.ToDecimal Dim CveUnidadMedida As Integer = GvRow.DataKey("CveUnidadMedida").ToEntero @@ -36968,6 +36962,9 @@ Partial Class Ventas End If + + + DdlTipoComprobante.Enabled = False CargaCliente(CveCliente) @@ -37020,10 +37017,17 @@ Partial Class Ventas UpParametros.Update() End If + If RBLTipoVenta.SelectedValue.Contiene("5", "6") Then + AsignaAlamacenWS() + CargaPS(-1, DdlPS) + End If + RegistraScript("$('#DvModalTipoVenta').modal('hide');") UpCliente.Update() End Sub + + Protected Sub GvProductosProcedimiento_RowDataBound(sender As Object, e As GridViewRowEventArgs) If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.DataKey("Precio").ToDecimal = 0 Then @@ -37183,6 +37187,27 @@ Partial Class Ventas CargaProcedimientos(HdnCveProcedimientoNuevo.Value.ToEntero) End Sub + Private Sub AsignaAlamacenWS() + + CveAlamcenFiltroDdl = -1 + + If UsuarioActual.Empresa.Funcionalidad(578).ToEntero = 1 Then + If DdlSucursalCliente.SelectedValue.ToEntero > 0 Then + Dim objclientes As New ClsClientes + If objclientes.GetSucursales(CveCliente, -1) Then + CveAlamcenFiltroDdl = objclientes.DtResultados.FiltroPrimeroValor("CveAlmacenAsignado", $" CveClienteSucursal = {DdlSucursalCliente.SelectedValue.ToEntero}").ToEntero + End If + objclientes.Dispose() + End If + If Not CveAlamcenFiltroDdl > 0 Then + CveAlamcenFiltroDdl = If(CveAlmacenAsignado > 0, CveAlmacenAsignado, -1) + End If + + End If + + End Sub + + #End Region 'Protected Sub LnkCancelarSoloCFDI_Click(sender As Object, e As EventArgs)