From d0e6b39fb8d04d8db5cbc94d8ce4f156c88e42be Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 5 Oct 2022 15:22:30 -0700 Subject: [PATCH 1/3] Mostrar serie y producto con una entrada previa --- App_Code/ClsInventarios.vb | 14 ++++++-------- App_Code/modExtensiones.vb | 11 +++++++++++ Inventarios/RecepcionAlmacen.aspx.vb | 5 ++++- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index 19c44dfe0..05c4a0abe 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -1346,24 +1346,22 @@ Public Class ClsInventarios Retorno = True End If Catch Ex1 As SqlException - If Ex1.Message.Contains("50019") Then Me.OnError(" El producto no tiene existencia.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - ElseIf Ex1.Message.Contains("CK_Inv_MovimientosDetalle_MetodoInventario") Then - Me.OnError("El movimiento debe de tener una Serie.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - Else - If Ex1.Message.Contains("50021") Then - Me.OnError(" El producto ingresado previamente.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + If Ex1.Message.Contains("50021;") Then + If String.IsNullOrEmpty(Serie) Then + Me.OnError("El producto ya fue ingresado previamente.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Else + OnError(String.Format("El producto '{0}' con la serie: '{1}' ya fue ingresado previamente.", Ex1.Message.GetTagValue("codigops"), Serie), Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End If Else Me.OnError("Ocurrió un error al guardar los detalles del movimiento.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End If End If - Catch ex As Exception - OnError("Ocurrió un error al guardar los detalles del movimiento", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try diff --git a/App_Code/modExtensiones.vb b/App_Code/modExtensiones.vb index 40e68aafc..045c1e753 100644 --- a/App_Code/modExtensiones.vb +++ b/App_Code/modExtensiones.vb @@ -150,6 +150,17 @@ Namespace Extensiones #Region "Log" + + Public Function GetTagValue(Obj As String, tag As String) As String + Try + Dim Regex = New Regex($"<{tag}>(.*)") + Dim match = Regex.Match(Obj) + Return match.Groups(1).ToString() + Catch ex As Exception + Return "" + End Try + End Function + Public Sub GuardaLog(Str As String) diff --git a/Inventarios/RecepcionAlmacen.aspx.vb b/Inventarios/RecepcionAlmacen.aspx.vb index 70d75f8be..b1be09e13 100644 --- a/Inventarios/RecepcionAlmacen.aspx.vb +++ b/Inventarios/RecepcionAlmacen.aspx.vb @@ -3869,7 +3869,10 @@ Partial Class Inventarios_RecepcionAlmacen If ObjContaAC IsNot Nothing Then ObjContaAC.RollBack() If ObjContaContPAQ IsNot Nothing Then ObjContaContPAQ.RollBack() RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") - Alert($"Ocurrió un error al guardar el movimiento de almacén. Por favor vuelva a intentar.

{MensajeError}", TipoMensaje.MsgError) + + If Not String.IsNullOrEmpty(MensajeError) Then + Alert($"Ocurrió un error al guardar el movimiento de almacén. Por favor vuelva a intentar.

{MensajeError}", TipoMensaje.MsgError) + End If End If ObjInventario.Dispose() From 2d999d42feb57e32c91d548503939aaa55830849 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 5 Oct 2022 17:51:07 -0700 Subject: [PATCH 2/3] Sumar dias de vencimiento en fecha de pago en lineas adicionales, correcion de timbrado de NC en CFDI 4.0 --- Ventas/Ventas.aspx.vb | 69 +++++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 28 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 96797b397..e2fb23dd5 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -5773,7 +5773,7 @@ Partial Class Ventas ObjVentas = New ClsVentas() End If - If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then + If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then Dim drv As DataRow = ObjVentas.DtResultados.Rows(0) @@ -5915,7 +5915,7 @@ Partial Class Ventas 'cuando es refacturacion, la fecha de pago debe de ser la misma If UsuarioActual.Empresa.Funcionalidad(526) = "1" Then ' Dim ObjVenta As New ClsVentas - If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then + If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then If ObjVentas.DtResultados.Rows.Count > 0 Then TxtFechaPago.Text = ObjVentas.DtResultados(0)("FechaVencimiento").ToString().ToDate.ToShortDateString End If @@ -6784,7 +6784,7 @@ Partial Class Ventas Row("CveVenta") = DdlFacturaARelacionar.SelectedValue.ToEntero() Using ObjVentas As New ClsVentas - If ObjVentas.GetVenta(DdlFacturaARelacionar.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa) AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then + If ObjVentas.GetVenta(DdlFacturaARelacionar.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, VerificaAlmacen:=False) AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then Row("SerieFolio") = ObjVentas.DtResultados(0)("SerieFolio").ToString() Row("FolioFiscal") = ObjVentas.DtResultados(0)("FolioFiscal").ToString() End If @@ -7547,7 +7547,7 @@ Partial Class Ventas If DdlNCFactura.Items.Count = 0 Then Dim ObjClientes As New ClsVentas() - If ObjClientes.GetVenta(pCveVenta, UsuarioActual.CveEmpresa) AndAlso ObjClientes.DtResultados.Rows.Count > 0 Then + If ObjClientes.GetVenta(pCveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) AndAlso ObjClientes.DtResultados.Rows.Count > 0 Then DTFacNC = ObjClientes.DtResultados Dim drvv As DataRow = DTFacNC.FiltroPrimero("") DTFacNC.Columns.Add("Factura", GetType(String), " Folio + ' - ' +' $' + Total + ' - ' + Fecha ") @@ -22597,7 +22597,7 @@ Partial Class Ventas Private Sub InventarioMov(Optional CveVentaPadre As Integer = -1) If CveVentaPadre > 0 Then Dim ObjVentas As New ClsVentas() - If ObjVentas.GetVenta(CveVentaPadre, UsuarioActual.CveEmpresa) Then + If ObjVentas.GetVenta(CveVentaPadre, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then If ObjVentas.DtResultados.Rows.Count > 0 AndAlso ObjVentas.DtResultados.Rows(0)("TipoDocto").ToString() = "Ing" AndAlso DdlTipoComprobante.SelectedValue = "Ing" Then ' Dim CveEstatusRefacturacion As Integer = ObjVentas.DtResultados.Rows(0)("CveEstatusRefacturacion").ToString().ToEntero() @@ -22739,7 +22739,7 @@ Partial Class Ventas End Sub Protected Sub LBDevolucionAlmacen_Click(sender As Object, e As EventArgs) Dim ObjVentas As New ClsVentas - If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then + If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then If ObjVentas.DtResultados.Rows.Count > 0 Then Dim DbRowVenta As DataRow = ObjVentas.DtResultados.Rows(0) Me.DevolucionAlmacen = DbRowVenta("EsDevolucionVenta").ToString().ToEntero() @@ -24704,7 +24704,7 @@ Partial Class Ventas Dim ObjVentas As New ClsVentas() Dim ObjInventarios As New ClsInventarios - If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then + If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then Dim DbRowVenta As DataRow = ObjVentas.DtResultados.Rows(0) @@ -26133,7 +26133,7 @@ Partial Class Ventas ViewState("CveVenta") = IfNull(Request("CveVenta"), 0).ToString.ToEntero Dim Obj As New ClsVentas - If Obj.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then + If Obj.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then Dim DbRowVenta As DataRow = Obj.DtResultados.FiltroPrimero("") ViewState("SaldoVenta") = DbRowVenta("Saldo").ToString() Total = DbRowVenta("Total").ToString.ToDecimal @@ -28166,7 +28166,7 @@ Partial Class Ventas DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto, TxtNCObservaciones.Text.Trim, 1, Dr("ImportePU").ToString.ToDecimal, Dr("PorcentajeIVA").ToString.ToDecimal, Dr("ImporteIVA").ToString.ToDecimal, Dr("PorcentajeRetIVA").ToString().ToDecimal, Dr("ImporteRetIVA").ToString().ToDecimal, Dr("PorcentajeRetISR").ToString().ToDecimal, Dr("ImporteRetISR").ToString().ToDecimal, Dr("PorcentajeIEPS").ToString().ToDecimal, Dr("ImporteIEPS").ToString().ToDecimal, -1, 0, Dr("ImporteTotal").ToString().ToDecimal, "", "", -1, -1, - DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1) + DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CodigoObjetoImpuesto:=DrPS("CodigoObjetoImpuesto").ToString()) Next End If @@ -28237,7 +28237,7 @@ Partial Class Ventas DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto, TxtNCObservaciones.Text.Trim, 1, Dr("ImportePU").ToString().ToDecimal + Ajuste, Dr("PorcentajeIVA").ToString().ToDecimal, Dr("ImporteIVA").ToString().ToDecimal, Dr("PorcentajeRetIVA").ToString().ToDecimal, Dr("ImporteRetIVA").ToString().ToDecimal, Dr("PorcentajeRetISR").ToString().ToDecimal, Dr("ImporteRetISR").ToString().ToDecimal, Dr("PorcentajeIEPS").ToString().ToDecimal, Dr("ImporteIEPS").ToString().ToDecimal, -1, 0, Dr("ImporteTotal").ToString().ToDecimal(), "", "", -1, -1, - DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1) + DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CodigoObjetoImpuesto:=DrPS("CodigoObjetoImpuesto").ToString()) Next End If @@ -28369,7 +28369,7 @@ Partial Class Ventas DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto, Obs, Cantidad, ImportePU, RowUsado("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, RowUsado("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA, RowUsado("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, RowUsado("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1, - DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowUsado("CveVentaDetalle").ToString().ToEntero()) + DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowUsado("CveVentaDetalle").ToString().ToEntero(), CodigoObjetoImpuesto:=DrPS("CodigoObjetoImpuesto").ToString()) End If @@ -28462,7 +28462,7 @@ Partial Class Ventas DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto, Obs, Cantidad, ImportePU, RowUsado("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, 0, ImporteRetIVA, 0, ImporteRetISR, 0, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1, - DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowUsado("CveVentaDetalleRNC").ToString().ToEntero()) + DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowUsado("CveVentaDetalleRNC").ToString().ToEntero(), CodigoObjetoImpuesto:=DrPS("CodigoObjetoImpuesto").ToString()) End If @@ -28554,7 +28554,7 @@ Partial Class Ventas DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto, Obs, Cantidad, ImportePU, RowCargo("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, RowCargo("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA, RowCargo("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, RowCargo("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1, - DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1) + DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CodigoObjetoImpuesto:=DrPS("CodigoObjetoImpuesto").ToString()) End If Next @@ -28648,7 +28648,7 @@ Partial Class Ventas DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto, Obs, Cantidad, ImportePU, RowCargo("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, RowCargo("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA, RowCargo("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, RowCargo("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1, - DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1) + DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CodigoObjetoImpuesto:=DrPS("CodigoObjetoImpuesto").ToString()) End If Next @@ -28736,7 +28736,7 @@ Partial Class Ventas DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto, Obs, Cantidad, ImportePU, RowUsado("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, 0, ImporteRetIVA, 0, ImporteRetISR, 0, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1, - DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowUsado("CveVentaDetalleRNC").ToString().ToEntero()) + DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowUsado("CveVentaDetalleRNC").ToString().ToEntero(), CodigoObjetoImpuesto:=DrPS("CodigoObjetoImpuesto").ToString()) End If @@ -28823,7 +28823,7 @@ Partial Class Ventas DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto, Obs, Cantidad, ImportePU, RowRNC("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, RowRNC("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA, RowRNC("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, RowRNC("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1, - DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowRNC("CveVentaDetalle").ToString().ToEntero()) + DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowRNC("CveVentaDetalle").ToString().ToEntero(), CodigoObjetoImpuesto:=DrPS("CodigoObjetoImpuesto").ToString()) End If @@ -28859,7 +28859,7 @@ Partial Class Ventas Dim FechaFactura As DateTime = Now If AplicaNCMasiva OrElse AplicaNCUsado Then - If ObjVentas.GetVenta(CveVentaNC, UsuarioActual.CveEmpresa) Then + If ObjVentas.GetVenta(CveVentaNC, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then If ObjVentas.DtResultados.Rows.Count > 0 Then Total = ObjVentas.DtResultados()(0)("Total").ToString().ToDecimal SubTotal = ObjVentas.DtResultados()(0)("SubTotal").ToString().ToDecimal @@ -28965,7 +28965,8 @@ Partial Class Ventas PorcentajeRetISR As Decimal, ImporteRetISR As Decimal, PorcentajeIEPS As Decimal, ImporteIEPS As Decimal, TipoDescuento As Integer, Descuento As Decimal, Total As Decimal, Serie As String, TiempoEntrega As String, CvePresupuestoIngreso As Integer, EntregaDirecta As Integer, SATClaveProdServ As String, SATClaveUM As String, CveContratoDetalle As Integer, CveVentaDetalle As Integer, CveMovimientoDetallePedido As Integer, CveOrdenCompraDetalle As Integer, - CveVentaDetalleRemision As Integer, CveVentaDetalleCotizacion As Integer, Optional CveTamaño As Integer = -1, Optional CveVentaDetalleRNC As Integer = -1) + CveVentaDetalleRemision As Integer, CveVentaDetalleCotizacion As Integer, Optional CveTamaño As Integer = -1, Optional CveVentaDetalleRNC As Integer = -1, + Optional CodigoObjetoImpuesto As String = "") Dim Row As DataRow = Nothing Row = TmpDT.NewRow() @@ -29027,6 +29028,8 @@ Partial Class Ventas Row("CveTamaño") = CveTamaño Row("CveVentaDetalleRNC") = CveVentaDetalleRNC + Row("CodigoObjetoImpuesto") = CodigoObjetoImpuesto + TmpDT.Rows.Add(Row) End Sub @@ -29143,7 +29146,7 @@ Partial Class Ventas Else ObjVentasAplicar = New ClsVentas End If - If ObjVentasAplicar.GetVenta(pCveVenta, UsuarioActual.CveEmpresa) AndAlso ObjVentasAplicar.DtResultados.Rows.Count > 0 Then + If ObjVentasAplicar.GetVenta(pCveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) AndAlso ObjVentasAplicar.DtResultados.Rows.Count > 0 Then Folio = ObjVentasAplicar.DtResultados.FiltroPrimeroValor("SerieFolio").ToString() FolioFiscal = ObjVentasAplicar.DtResultados.FiltroPrimeroValor("FolioFiscal").ToString() TC = ObjVentasAplicar.DtResultados.FiltroPrimeroValor("TipoCambio").ToString().ToDecimal() @@ -29711,7 +29714,7 @@ Partial Class Ventas Guia = ObjInventario.DtResultados.Rows(0)("Guia").ToString() End If End If - If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then + If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then If ObjVentas.DtResultados.Rows.Count > 0 Then SerieFolio = ObjVentas.DtResultados.Rows(0)("SerieFolio").ToString() PedidoContrato = ObjVentas.DtResultados.Rows(0)("PedidoContrato").ToString() @@ -29762,7 +29765,7 @@ Partial Class Ventas Guia = ObjInventario.DtResultados.Rows(0)("Guia").ToString() End If End If - If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then + If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then If ObjVentas.DtResultados.Rows.Count > 0 Then SerieFolio = ObjVentas.DtResultados.Rows(0)("SerieFolio").ToString() PedidoContrato = ObjVentas.DtResultados.Rows(0)("PedidoContrato").ToString() @@ -32028,7 +32031,7 @@ Partial Class Ventas If TipoDoctoViejo = "PA" Then Dim RowVenta As DataRow = Nothing Dim ObjVentas As New ClsVentas - If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then + If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then RowVenta = ObjVentas.DtResultados.Rows(0) End If ObjVentas.Dispose() @@ -32063,7 +32066,7 @@ Partial Class Ventas Dim ErrorTrans As Boolean = False Dim FechaVencimientoAnterior As String = "" - If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then + If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then If ObjVentas.DtResultados.Rows.Count > 0 Then FechaVencimientoAnterior = ObjVentas.DtResultados.Rows(0)("FechaVencimiento").ToString().ToDate.ToShortDateString Else @@ -33969,7 +33972,7 @@ Partial Class Ventas TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer)) End If - If ObjVentas.GetVenta(CveVentaNC, UsuarioActual.CveEmpresa) Then + If ObjVentas.GetVenta(CveVentaNC, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then If ObjVentas.DtResultados.Rows.Count > 0 Then Total = ObjVentas.DtResultados()(0)("Total").ToString.ToDecimal SubTotal = ObjVentas.DtResultados()(0)("SubTotal").ToString.ToDecimal @@ -35322,16 +35325,26 @@ Partial Class Ventas Using ObjVentas As New ClsVentas If ObjVentas.GetLineasAdicionalesSaldo(DdlLineaAdicional.SelectedValue.ToEntero(), CveCliente, -1, DdlMoneda.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, FechaVencimientoConsulta:=MinFecha) Then If ObjVentas.DtResultados.Rows.Count > 0 Then - TxtFechaPago.Text = ObjVentas.DtResultados.Rows(0)("FechaVencimiento").ToString().ToDateTime().ToString("dd/MM/yyyy") - Me.SaldoLineaAdicional = ObjVentas.DtResultados.Rows(0)("Saldo").ToString().ToDecimal() - Me.CveCategoriaLineaAdicional = ObjVentas.DtResultados.Rows(0)("CveCategoria").ToString().ToEntero() - Me.CveMonedaLineaAdicional = ObjVentas.DtResultados.Rows(0)("CveMoneda").ToString().ToEntero() + Dim RowLinea As DataRow = ObjVentas.DtResultados.Rows(0) + If RowLinea IsNot Nothing 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") + End If + + Me.CveCategoriaLineaAdicional = RowLinea("CveCategoria").ToString().ToEntero() + Me.CveMonedaLineaAdicional = RowLinea("CveMoneda").ToString().ToEntero() + End If + End If End If End Using Else Me.SaldoLineaAdicional = 0 Me.CveCategoriaLineaAdicional = 0 + TxtFechaPago.Text = Now.ToString("dd/MM/yyyy") End If UpParametros.Update() From ae86c09e64ef84606573a91deb8d49718c6b0710 Mon Sep 17 00:00:00 2001 From: JORGE LUIS CAUDILLO ESPARZA Date: Thu, 6 Oct 2022 02:26:18 -0700 Subject: [PATCH 3/3] --- App_Code/ClsNominas.vb | 23 +++++++++++++++++++++++ App_Code/ClsRH.vb | 26 +++++++++++++++++++++++++- App_Code/ClsVentas.vb | 18 ++++++++++++++++++ App_Code/modExtensiones.vb | 7 +++++++ RH/CatPersonal.aspx | 2 +- RH/CatPersonal.aspx.vb | 2 +- Ventas/Ventas.aspx.vb | 12 ++++++++++++ 7 files changed, 87 insertions(+), 3 deletions(-) diff --git a/App_Code/ClsNominas.vb b/App_Code/ClsNominas.vb index 22921dad9..c2289f545 100644 --- a/App_Code/ClsNominas.vb +++ b/App_Code/ClsNominas.vb @@ -237,6 +237,29 @@ Public Class ClsNominas End Sub #End Region + Public Function AgroOrdenProduccionForVtaGet(CveEmpresa As Integer, CveUsuario As Integer, CveOrdenProduccion As Integer) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_Vta_AgroOrdenProduccionForVtaGet", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveOrdenProduccion", SqlDbType.Int).Value = CveOrdenProduccion + + End With + Try + SqlAdapter.Fill(DTSet) + If DTSet.Tables.Count > 0 Then + Data = DTSet.Tables(0) + End If + retorno = True + Catch Ex1 As SqlException + + Me.OnError("Ocurrió un error al obtener datos manifiesto.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Catch ex As Exception + OnError("Ocurrió un error al obtener los datos manifiesto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return retorno + End Function Public Function ManifiestoForVtaGet(CveEmpresa As Integer, CveUsuario As Integer, PersonalXml As String, CveEmbarqueManifiesto As Integer) As Boolean Dim retorno As Boolean = False DataAdapter("PA_Vta_ManifiestoForVtaGet", CommandType.StoredProcedure) diff --git a/App_Code/ClsRH.vb b/App_Code/ClsRH.vb index 8d4a1894e..b5c42d4a8 100644 --- a/App_Code/ClsRH.vb +++ b/App_Code/ClsRH.vb @@ -2226,9 +2226,33 @@ chkAplicaVacacion As Boolean, chkAplicaIncapacidad As Boolean, chkAplicaRetardo OnError("Ocurrió un error al intentar guardar los cambios en el Personal.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try Return Retorno + End Function + + Public Function PersonalSalarioUp(CvePersonal As Integer, Fecha As String, CveUsuario As Integer, CveEmpresa As Integer, SalarioDiario As Double, SDI As Double, SalarioDiarioSS As Double, SalarioDiarioPago As Double, SDUp As TipoUpdate, SDIUp As TipoUpdate, SDCUp As TipoUpdate) As Boolean + Dim Retorno As Boolean = False + SqlDataAdapter("PA_RH_PersonalSalarioUp") + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal + .Add("@Fecha", SqlDbType.Date).Value = Fecha + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@SalarioDiarioPago", SqlDbType.Money).Value = SalarioDiarioPago + .Add("@SalarioDiario", SqlDbType.Money).Value = SalarioDiario + .Add("@SDI", SqlDbType.Money).Value = SDI + .Add("@SalarioDiarioSS", SqlDbType.Money).Value = SalarioDiarioSS + .Add("@SDUp", SqlDbType.Int).Value = SDUp + .Add("@SDIUp", SqlDbType.Int).Value = SDIUp + .Add("@SDCUp", SqlDbType.Int).Value = SDCUp + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As SqlException + OnError("Ocurrió un error al intentar guardar los cambios en el Personal.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno End Function - Public Function GetMovimientosToSUA(CveEmpresa As Integer, FechaI As String, FechaF As String) As Boolean Dim Retorno As Boolean = False SqlDataAdapter("PA_RH_MovimientosToSUA") diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index ebcea89aa..7f7f2cc8d 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -181,6 +181,24 @@ Public Class ClsVentas Return Retorno End Function + Public Function AgroOrdenProduccionUpvta(cveVenta As Int32, cveUsuario As Int32, cveEmpresa As Int32, CveOrdenProduccion As Int32) As Boolean + Dim retorno As Boolean = False + DataAdapter("PA_AGRO_OrdenProduccionUpvta", CommandType.StoredProcedure) + With SqlAdapter.SelectCommand.Parameters + .Add("@CveVenta", SqlDbType.Int).Value = cveVenta + .Add("@CveEmpresa", SqlDbType.Int).Value = cveEmpresa + .Add("@CveOrdenProduccion", SqlDbType.Int).Value = CveOrdenProduccion + .Add("@CveUsuario", SqlDbType.Int).Value = cveUsuario + End With + + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar venta manifiesto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return retorno + End Function Public Function Embarque_ManifiestoUpvta(cveVenta As Int32, cveUsuario As Int32, cveEmpresa As Int32, cveEmbarqueManifiesto As Int32) As Boolean Dim retorno As Boolean = False DataAdapter("PA_AGRO_Embarque_ManifiestoUpvta", CommandType.StoredProcedure) diff --git a/App_Code/modExtensiones.vb b/App_Code/modExtensiones.vb index 40e68aafc..87171a475 100644 --- a/App_Code/modExtensiones.vb +++ b/App_Code/modExtensiones.vb @@ -301,6 +301,13 @@ Namespace Extensiones #Region "Alertas y notificaciones" + Public Enum TipoUpdate As Integer + + NoGuardar = 0 + Guardar = 1 + CalcularYGuardar = 2 + + End Enum Public Enum TipoMensaje As Integer MsgError = 1 diff --git a/RH/CatPersonal.aspx b/RH/CatPersonal.aspx index 4f78b5dc8..eb25ddb01 100644 --- a/RH/CatPersonal.aspx +++ b/RH/CatPersonal.aspx @@ -1115,7 +1115,7 @@
- +
diff --git a/RH/CatPersonal.aspx.vb b/RH/CatPersonal.aspx.vb index 95ec9d60b..2044c0802 100644 --- a/RH/CatPersonal.aspx.vb +++ b/RH/CatPersonal.aspx.vb @@ -1180,7 +1180,7 @@ Partial Class RH_CatPersonal Dim CvePersonal As Integer = 0 Using ObjPersonal As New ClsRH() ObjPersonal.IniciaTransacSQL() - If ObjPersonal.AddPersonal("-1", TxtAPaterno.Text.Trim, TxtAMaterno.Text.Trim, TxtNombres.Text.Trim, "", TxtFechaIngreso.Text.ToDate, + If ObjPersonal.AddPersonal(TxtCodigo.Text, TxtAPaterno.Text.Trim, TxtAMaterno.Text.Trim, TxtNombres.Text.Trim, "", TxtFechaIngreso.Text.ToDate, DdlTipoPeriodoAdd.SelectedValue.ToEntero, TxtNumeroSS.Text.Trim, True, SalarioDiario, SalarioDiario, 0, 0, 0, 15, 25, DdlMetodoPagoAdd.SelectedValue.ToEntero, TxtFechaIngreso.Text.Trim.ToDate, "-1", DdlTipoContratoAdd.SelectedValue.ToEntero, "", diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 96797b397..ae3516748 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -9703,6 +9703,18 @@ Partial Class Ventas Catch ex As Exception OnError("Ocurrió un error al actualizar el embarque", ex) End Try + Try + ViewState("CveVenta") = ObjFactura.CveVenta + + If Request("CveOrdenProduccion") IsNot Nothing AndAlso IsNumeric(Request("CveOrdenProduccion")) AndAlso Request("CveOrdenProduccion").ToEntero() > 0 Then + + If ObjVentas.AgroOrdenProduccionUpvta(ObjFactura.CveVenta, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, Request("CveOrdenProduccion").ToEntero()) Then + + End If + End If + Catch ex As Exception + OnError("Ocurrió un error al actualizar el embarque", ex) + End Try Try Dim DirectoriArchivoXML As String = String.Format("{0}{1}", UsuarioActual.Empresa.Ruta, ObjFactura.TipoDocto) ' System.IO.Path.Combine()