From 02656f7935e5adef7892f0ee329ff3ef163ccb16 Mon Sep 17 00:00:00 2001 From: rrene Date: Tue, 22 Dec 2020 18:33:51 -0700 Subject: [PATCH 01/22] --valida en facturar una cotizacion, que tenga el permiso de facturar --- Ventas/Ventas.aspx.vb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index f95d74192..25b9992a0 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -4817,7 +4817,8 @@ Partial Class Ventas Else BtnGenerarRemision.Visible = False End If - BtnsFacturar.Visible = True + If UsuarioActual.TienePermisoProceso(60) Then BtnsFacturar.Visible = True 'puede facturar + LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274) End If End If @@ -5893,7 +5894,7 @@ Partial Class Ventas LnkCotizaciones.Visible = False End If UPCondicionesPago.Update() - ElseIf UsuarioActual.CveEmpresa.Contiene(72, 80, 146, 119) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso CveVenta < 1 Then + ElseIf UsuarioActual.CveEmpresa.Contiene(72, 80, 146, 119, 140, 158) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso CveVenta < 1 Then RBLPago.SelectedValue = "1" RBLPago_SelectedIndexChanged(Nothing, Nothing) UPCondicionesPago.Update() @@ -5956,7 +5957,7 @@ Partial Class Ventas End If Else - If UsuarioActual.CveEmpresa = 119 AndAlso Not UsuarioActual.TienePermisoProceso(268) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "Ant", "PA") Then + If UsuarioActual.CveEmpresa.Contiene(119) AndAlso Not UsuarioActual.TienePermisoProceso(268) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "Ant", "PA") Then Dim Vta As New ClsVentas Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa) Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón:

{0}", Vta.SerieVenta) @@ -5988,6 +5989,9 @@ Partial Class Ventas LnkPedido2SinFacturar.Visible = False LnkCotizaciones.Visible = False LnkOCs.Visible = False + + Else + If Alertas Then Alert("El cliente tiene su límite de crédito agotado.", TipoMensaje.MsgAdvertencia) End If End If UPPCreditoDisponible.Update() From 36002df307c5af03add10bc6f22b0f4f4873b94e Mon Sep 17 00:00:00 2001 From: rrene Date: Tue, 22 Dec 2020 18:34:26 -0700 Subject: [PATCH 02/22] correcion, del txt de numero de reembolso, estaba repetido el txt. se dejo uno solo --- Compras/Compras.aspx | 16 ++++------------ Compras/Compras.aspx.vb | 32 +++++++++++++------------------- 2 files changed, 17 insertions(+), 31 deletions(-) diff --git a/Compras/Compras.aspx b/Compras/Compras.aspx index 9d90e76a0..7150832a1 100644 --- a/Compras/Compras.aspx +++ b/Compras/Compras.aspx @@ -3748,15 +3748,7 @@ -
- -
- - - -
- -
+
@@ -3768,9 +3760,9 @@
- <%-- - --%> -
+ + +

diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 4f8101173..b109f0059 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -13130,49 +13130,43 @@ Partial Class Compras_Compras PnlContadoBancos.Visible = True TxtDocumentoImporte.Text = (TxtTotal.Text.ToDecimal - LblAmortizacion.Text.ToDecimal).FormatoNumero ChkCreditoMultiple.Visible = False - DivReembolsoModal.Visible = False - RfvTxtRembolsoModal.Enabled = False - TxtRembolsoModal.Text = "" + RfvTxtNumeroReembolso.Enabled = False + TxtNumeroReembolso.Text = "" TxtRembolsoNumero.Text = "" Case "2" ' F y E PnlContadoFyE.Visible = True CargaFuncionariosEmpleados() ChkCreditoMultiple.Visible = False - DivReembolsoModal.Visible = True - RfvTxtRembolsoModal.Enabled = True + RfvTxtNumeroReembolso.Enabled = True TxtRembolsoNumero.Text = "" - TxtRembolsoModal.Text = "" + TxtNumeroReembolso.Text = "" Case "3" ' Creditos PnlContadoCreditos.Visible = True ChkCreditoMultiple.Visible = True CargaCreditos() - DivReembolsoModal.Visible = False - RfvTxtRembolsoModal.Enabled = False - TxtRembolsoModal.Text = "" + RfvTxtNumeroReembolso.Enabled = False + RfvTxtNumeroReembolso.Text = "" TxtRembolsoNumero.Text = "" Case "4" ' Deudores PnlContadoDeudores.Visible = True CargaDeudores() ChkCreditoMultiple.Visible = False - DivReembolsoModal.Visible = False - RfvTxtRembolsoModal.Enabled = False - TxtRembolsoModal.Text = "" + RfvTxtNumeroReembolso.Enabled = False + TxtNumeroReembolso.Text = "" TxtRembolsoNumero.Text = "" Case "5" ' ACREEDORES PnlContadoAcreedores.Visible = True ChkCreditoMultiple.Visible = True CargaAcreedores() - DivReembolsoModal.Visible = False - RfvTxtRembolsoModal.Enabled = False - TxtRembolsoModal.Text = "" + RfvTxtNumeroReembolso.Enabled = False + TxtNumeroReembolso.Text = "" TxtRembolsoNumero.Text = "" Case "6" ' Caja Chica PnlContadoCajaChica.Visible = True TxtDocumentoImporteCaja.Text = (TxtTotal.Text.ToDecimal - LblAmortizacion.Text.ToDecimal).FormatoNumero ChkCreditoMultiple.Visible = False - DivReembolsoModal.Visible = True - RfvTxtRembolsoModal.Enabled = True - TxtRembolsoModal.Text = "" + RfvTxtNumeroReembolso.Enabled = True + TxtNumeroReembolso.Text = "" TxtRembolsoNumero.Text = "" End Select @@ -13180,7 +13174,7 @@ Partial Class Compras_Compras End Sub Protected Sub BtnContado_Click(sender As Object, e As EventArgs) - TxtRembolsoNumero.Text = TxtRembolsoModal.Text + TxtRembolsoNumero.Text = TxtNumeroReembolso.Text RegistraScript(String.Format("$('#{0}').modal('hide');", "DivContadoModal")) End Sub From 3c4953095f18aeebb15465b3aa30f1e9fd07d696 Mon Sep 17 00:00:00 2001 From: rrene Date: Tue, 22 Dec 2020 18:34:45 -0700 Subject: [PATCH 03/22] . --- App_Code/ClsContabilidad.vb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index ed8ddbc71..d82eed1e6 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -2406,7 +2406,7 @@ Public Class ClsContabilidad Public Function AddConta_PlantillasPolizasDetalles(CvePlantillaPoliza As Integer, CveConcepto As Integer, TipoMovto As Integer, IdCtaContable As Integer, Orden As Integer, CveUsuario As Integer, CveEmpresa As Integer, CveSubProyecto As Integer, CveProveedor As Integer, Optional CvePersonal As Integer = -1, - Optional PorcentajeImpuesto As Decimal = 0) As Boolean + Optional PorcentajeImpuesto As Decimal = 0, Optional CveCuenta As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Conta_PlantillasPolizasDetalleAdd") @@ -2423,6 +2423,7 @@ Public Class ClsContabilidad .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor .Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal .Add("@PorcentajeImpuesto", SqlDbType.SmallMoney).Value = PorcentajeImpuesto + .Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta End With Try From df50f316411c9986fd32ac37429312efd183c12d Mon Sep 17 00:00:00 2001 From: rrene Date: Thu, 24 Dec 2020 11:17:12 -0700 Subject: [PATCH 04/22] foliado en cotizacion. registra en prepoliza si el inventario = 0 --- Ventas/Ventas.aspx.vb | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 25b9992a0..4a4ecc7da 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -2582,7 +2582,7 @@ Partial Class Ventas 'DdlEstatus.SelectedValueExist("2") ConfiguraTipoDocto() - CargaFolios() + BtnEmitirImprimir.Text = "Facturar" BtnEmitirImprimir.Visible = True @@ -2615,6 +2615,7 @@ Partial Class Ventas End If If Not ExFolioFactura Then SetPermisos() + If CveVenta < 1 Then CargaFolios() 'SELECCIONA VENDEDOR DEL USUARIO CUANDO SEA VENTA NUEVA Y SIN CLIENTE If UsuarioActual.CveVendedor > 0 Then @@ -5894,7 +5895,7 @@ Partial Class Ventas LnkCotizaciones.Visible = False End If UPCondicionesPago.Update() - ElseIf UsuarioActual.CveEmpresa.Contiene(72, 80, 146, 119, 140, 158) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso CveVenta < 1 Then + ElseIf UsuarioActual.CveEmpresa.Contiene(72, 80, 146, 119, 158, 140) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem", "Cot", "PA") AndAlso CveVenta < 1 Then RBLPago.SelectedValue = "1" RBLPago_SelectedIndexChanged(Nothing, Nothing) UPCondicionesPago.Update() @@ -5991,7 +5992,7 @@ Partial Class Ventas LnkOCs.Visible = False Else - If Alertas Then Alert("El cliente tiene su límite de crédito agotado.", TipoMensaje.MsgAdvertencia) + If Alertas AndAlso UsuarioActual.Empresa.Funcionalidad(518) = "1" Then Alert("El cliente tiene su límite de crédito agotado.", TipoMensaje.MsgAdvertencia) End If End If UPPCreditoDisponible.Update() @@ -12798,23 +12799,23 @@ Partial Class Ventas 'Concepto = String.Format("{0} - {1}", Row2("Clasificacion").ToString(), Row2("SubProyecto").ToString()) IdCtaContable = GlobalDTClasificaciones(factura.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero() - CveCuenta = GlobalDTClasificaciones(factura.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero() - If ValorInventario <> 0 Then + ' CveCuenta = GlobalDTClasificaciones(factura.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero() + 'If ValorInventario <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, TipoMovto69, ValorInventario, factura.SerieFolio, 69, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveSubProyecto:=factura.CveSubProyecto, CveClasificacion:=RowInv("CveClasificacion").ToString().ToEntero(), CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta) Then - OcurrioError = True - End If + If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, TipoMovto69, ValorInventario, factura.SerieFolio, 69, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveSubProyecto:=factura.CveSubProyecto, CveClasificacion:=RowInv("CveClasificacion").ToString().ToEntero(), CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta) Then + OcurrioError = True End If + 'End If cont += 1 Next End If IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", CveAlmacen)).ToEntero() - If TotalCosto <> 0 Then - If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, TipoMovto68, TotalCosto, factura.SerieFolio, 68, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=TotalCosto, CveCuenta:=CveCuenta, CveSubProyecto:=factura.CveSubProyecto) Then + 'If TotalCosto <> 0 Then + If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, TipoMovto68, TotalCosto, factura.SerieFolio, 68, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=TotalCosto, CveCuenta:=CveCuenta, CveSubProyecto:=factura.CveSubProyecto) Then OcurrioError = True End If - End If + 'End If Else OcurrioError = True @@ -15424,7 +15425,7 @@ Partial Class Ventas UpnTools.Update() tdTelefonoGen.Visible = False tdTxtTelefonoGen.Visible = False - If UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12, 122, 145) Then + If UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12, 122, 145, 140) Then ChkEnviarFactura.Checked = False End If @@ -15817,13 +15818,13 @@ Partial Class Ventas If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count > 0 AndAlso (Not CveVenta > 0 Or EsCreaApartirDe Or CveDevolucion > 0) Then RecalculaIVA() 'ViewState("SubProyectoPorcentajeIVA") = dr("IVA") ViewState("TipoFormato") = dr("TipoFormato") - ViewState("Serie") = dr("Serie") + 'ViewState("Serie") = dr("Serie") - If UsuarioActual.CveEmpresa = 140 AndAlso Me.CveVenta > 0 AndAlso Not EsCreaApartirDe AndAlso Not String.IsNullOrEmpty(SerieVenta) Then - LblSerie.Text = SerieVenta - Else - LblSerie.Text = dr("Serie").ToString() - End If + 'If UsuarioActual.CveEmpresa = 140 AndAlso Me.CveVenta > 0 AndAlso Not EsCreaApartirDe AndAlso Not String.IsNullOrEmpty(SerieVenta) Then + ' LblSerie.Text = SerieVenta + 'Else + ' LblSerie.Text = dr("Serie").ToString() + 'End If If SerieXML <> "" Then LblSerie.Text = SerieXML Dim CveSubProyecto As Integer = GetSubProyectoSucursal() From 3ca0f435d7ae4e4efb3b3d41d4b1875aa9ea1d2c Mon Sep 17 00:00:00 2001 From: rrene Date: Tue, 29 Dec 2020 17:37:06 -0700 Subject: [PATCH 05/22] aplica para venta, para la empresa 141 --- Ashx/SIGWeb.ashx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ashx/SIGWeb.ashx b/Ashx/SIGWeb.ashx index 0b6332772..5b1f83c44 100644 --- a/Ashx/SIGWeb.ashx +++ b/Ashx/SIGWeb.ashx @@ -702,7 +702,7 @@ Public Class SIGWeb : Implements IHttpHandler, IRequiresSessionState If Pagina.Contiene("ventas/ventas", "oc/oc", "inv/traspaso") AndAlso CveEmpresa.Contiene(72, 80, 119, 140, 141, 152, 153, 159, 160, 161, 162, 163) Then UsaGlobal = False - If CveEmpresa = 140 And Pagina.Contiene("ventas/ventas") Then + If CveEmpresa.Contiene(140, 141) And Pagina.Contiene("ventas/ventas") Then AplicaParaVenta = 1 End If From 035bb423de96a58d230f123ea30f859256aa004a Mon Sep 17 00:00:00 2001 From: rrene Date: Tue, 29 Dec 2020 17:37:40 -0700 Subject: [PATCH 06/22] cancelacion de en base a fechas --- Bancos/IE.aspx.vb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb index 598bfd446..87c370a23 100644 --- a/Bancos/IE.aspx.vb +++ b/Bancos/IE.aspx.vb @@ -4480,8 +4480,8 @@ Partial Class Bancos_IE Else ' If TxtFechaDocumento.Text.ToDate.Month < TxtFechaCancelacion.Text.ToDate.Month Or TxtFechaDocumento.Text.ToDate.Year < TxtFechaCancelacion.Text.ToDate.Year Then - Dim GeneraCancelacionEnCero As Boolean = True - If TxtFechaDocumento.Text.ToDate >= TxtFechaCancelacion.Text.ToDate.FirstDayOfMonth Then 'si es del mismo mes, se genra cancelacion en cero + Dim GeneraCancelacionEnCero As Boolean = False + If TxtFechaCancelacion.Text.ToDate <= TxtFechaDocumento.Text.ToDate.LastDayOfMonth Then 'si es del mismo mes, se genra cancelacion en cero GeneraCancelacionEnCero = True End If From a2fc7ad106320430eff47afe047b016b9ddff896 Mon Sep 17 00:00:00 2001 From: rrene Date: Tue, 29 Dec 2020 17:37:53 -0700 Subject: [PATCH 07/22] poliza requerida --- Inventarios/RecepcionUsados.aspx | 4 +- Inventarios/RecepcionUsados.aspx.vb | 85 +++++++++++++++-------------- 2 files changed, 47 insertions(+), 42 deletions(-) diff --git a/Inventarios/RecepcionUsados.aspx b/Inventarios/RecepcionUsados.aspx index f5b6dcc47..73a3c86bf 100644 --- a/Inventarios/RecepcionUsados.aspx +++ b/Inventarios/RecepcionUsados.aspx @@ -494,8 +494,8 @@
- <%----%> - <%----%> + +
diff --git a/Inventarios/RecepcionUsados.aspx.vb b/Inventarios/RecepcionUsados.aspx.vb index 22e3f17ec..51f377cdc 100644 --- a/Inventarios/RecepcionUsados.aspx.vb +++ b/Inventarios/RecepcionUsados.aspx.vb @@ -1113,62 +1113,67 @@ Partial Class Inventarios_RecepcionUsados FolioInv = Resp.FolioUsado Else - CveMovimiento = ObjInventario.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, CveConcepto, 1, Fecha, tFolio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, + Dim tCveConcepto As Integer = CveConcepto + If RblUsadosAjuste.SelectedValue = "1" Then 'cuando es garantia, el concepto es de entrada + tCveConcepto = 2 + End If + + CveMovimiento = ObjInventario.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, tCveConcepto, 1, Fecha, tFolio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVenta, CveSubProyecto, ActivoFijo, Guia:=TxtGuia.Text, Observaciones:=TxtObservaciones.Text, CvePersonal:=DdlPersonal.SelectedValue.ToEntero, Recibio:=TxtResponsable.Text.Trim, CveCliente:=CveCliente, CveClienteSucursal:=CveClienteSucursal, DepartamentoEntrega:=TxtDepartamentoEntrega.Text, PedidoContrato:=TxtPedidoContrato.Text, CveProveedor:=tCveProveedor, Modulo:="RU/G") If CveMovimiento <= 0 Then - Mensaje = "Error al guardar los movimientos" - ErrorMovInv = True - Else - FolioInv = ObjInventario.Folio.ToString() + Mensaje = "Error al guardar los movimientos" + ErrorMovInv = True + Else + FolioInv = ObjInventario.Folio.ToString() - For Each Dr As DataRow In DtMovimientos.Rows + For Each Dr As DataRow In DtMovimientos.Rows - If CveConcepto = 42 AndAlso DdlMoneda.SelectedValue.ToEntero = 2 Then - ImporteConcepto = Dr("PU").ToString.ToDecimal * GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal - Else - ImporteConcepto = Dr("PU").ToString.ToDecimal - End If + If CveConcepto = 42 AndAlso DdlMoneda.SelectedValue.ToEntero = 2 Then + ImporteConcepto = Dr("PU").ToString.ToDecimal * GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal + Else + 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" - ErrorMovInv = True - Exit For - End If - - If CveVenta > 0 AndAlso Not ObjVentas.UpdateVentaUsadoRecibido(CveVenta, Dr("CvePS").ToString.ToEntero, True, CveMovimiento) Then - Mensaje = "Error al actualizar el recibo de los usados" - ErrorMovInv = True - Exit For - End If - - 'si es selectedvalue = 42, es entrada ,3 -salida - Dim CveConceptoUsados As Integer = If(RBLOpcion.SelectedValue.ToEntero = 42, 1, 2) - - If EsDistribuidor AndAlso RBLOpcion.SelectedValue.ToEntero = 42 AndAlso Dr("CveTamaño").ToString.ToEntero > 0 Then - - If Not ObjAcum.DistribuidorMovtosAdd(DdlClientes.SelectedValue.ToEntero, Dr("Cantidad").ToString.ToEntero(), Dr("CveTamaño").ToString.ToEntero, CveConceptoUsados, CveVenta, UsuarioActual.CveUsuario, - UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, CveMovimiento:=CveMovimiento) Then - Mensaje = "Error al guardar Movimientos de distribuidor" + 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" ErrorMovInv = True Exit For End If - End If - Next + If CveVenta > 0 AndAlso Not ObjVentas.UpdateVentaUsadoRecibido(CveVenta, Dr("CvePS").ToString.ToEntero, True, CveMovimiento) Then + Mensaje = "Error al actualizar el recibo de los usados" + ErrorMovInv = True + Exit For + End If - 'GENERA LA PREPOLIZA DE ALMACEN VS EL CONCEPTO DE RNC - 'If Not ErrorMovInv Then - ' ErrorMovInv = Not GeneraPrePoliza(CveMovimiento, ObjInventario, ObjConta, True) - 'End If + 'si es selectedvalue = 42, es entrada ,3 -salida + Dim CveConceptoUsados As Integer = If(RBLOpcion.SelectedValue.ToEntero = 42, 1, 2) + + If EsDistribuidor AndAlso RBLOpcion.SelectedValue.ToEntero = 42 AndAlso Dr("CveTamaño").ToString.ToEntero > 0 Then + + If Not ObjAcum.DistribuidorMovtosAdd(DdlClientes.SelectedValue.ToEntero, Dr("Cantidad").ToString.ToEntero(), Dr("CveTamaño").ToString.ToEntero, CveConceptoUsados, CveVenta, UsuarioActual.CveUsuario, + UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, CveMovimiento:=CveMovimiento) Then + Mensaje = "Error al guardar Movimientos de distribuidor" + ErrorMovInv = True + Exit For + End If + + End If + Next + + 'GENERA LA PREPOLIZA DE ALMACEN VS EL CONCEPTO DE RNC + 'If Not ErrorMovInv Then + ' ErrorMovInv = Not GeneraPrePoliza(CveMovimiento, ObjInventario, ObjConta, True) + 'End If + + End If End If - End If - - If Not ErrorMovInv Then + If Not ErrorMovInv Then If Resp IsNot Nothing Then For Each mensaje2 As String In Resp.Mensajes Msg.AppendFormat("
{0}", mensaje2) From d540460ad06a57b03f96ef0b80b9cd32b155cd8c Mon Sep 17 00:00:00 2001 From: rrene Date: Tue, 29 Dec 2020 17:38:18 -0700 Subject: [PATCH 08/22] nombre de cuenta contable --- Contabilidad/PlantillasPolizasDetalle.aspx | 4 ++- Contabilidad/PlantillasPolizasDetalle.aspx.vb | 30 +++++++++++++++++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Contabilidad/PlantillasPolizasDetalle.aspx b/Contabilidad/PlantillasPolizasDetalle.aspx index 294b70ce4..3db8c7b0a 100644 --- a/Contabilidad/PlantillasPolizasDetalle.aspx +++ b/Contabilidad/PlantillasPolizasDetalle.aspx @@ -176,7 +176,7 @@ -  > +  > @@ -269,6 +269,8 @@ + +
diff --git a/Contabilidad/PlantillasPolizasDetalle.aspx.vb b/Contabilidad/PlantillasPolizasDetalle.aspx.vb index d97ccd009..7449e664d 100644 --- a/Contabilidad/PlantillasPolizasDetalle.aspx.vb +++ b/Contabilidad/PlantillasPolizasDetalle.aspx.vb @@ -138,9 +138,32 @@ Partial Class Contabilidad_PlantillasPolizasDetalle Private Sub CargaCuenta() DdlCtaContable.Items.Clear() - DdlCtaContable.DataSource = DTCuentasContables - DdlCtaContable.DataBind() + DdlCtaContable.Items.Insert(0, New ListItem("Seleccione", "-1")) + + If UsuarioActual.Empresa.TipoContabilizacion = 2 Then + Dim Conta As New ClsContabilidad + Dim dtt As New DataTable + + If Conta.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then + dtt = Conta.DtResultados + End If + + Conta.Dispose() + + DdlCuentas.Items.Clear() + DdlCuentas.DataSource = dtt + DdlCuentas.DataBind() + DdlCuentas.Visible = True + DdlCtaContable.Visible = False + Else + + DdlCtaContable.DataSource = DTCuentasContables + DdlCtaContable.DataBind() + End If + + + DdlCuentas.Items.Insert(0, New ListItem("Seleccione", "-1")) End Sub Private Sub CargarConcepto() @@ -229,7 +252,8 @@ Partial Class Contabilidad_PlantillasPolizasDetalle If HdnModalidad.Value = "I" Then If CvePlantillaPoliza > 0 Then - If ObjPlantillaPolizaDetalle.AddConta_PlantillasPolizasDetalles(CvePlantillaPoliza, DdlConcepto.SelectedValue.ToEntero, DdlTipoMovimiento.SelectedValue.ToEntero, DdlCtaContable.SelectedValue.ToEntero, TxtOrden.Text.Trim.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DDLSubProyecto.SelectedValue.ToEntero, DDLProveedor.SelectedValue.ToEntero, DdlPersonal.SelectedValue.ToEntero, DdlPorcentajeImpuesto.SelectedValue.ToDecimal) Then + If ObjPlantillaPolizaDetalle.AddConta_PlantillasPolizasDetalles(CvePlantillaPoliza, DdlConcepto.SelectedValue.ToEntero, DdlTipoMovimiento.SelectedValue.ToEntero, DdlCtaContable.SelectedValue.ToEntero, TxtOrden.Text.Trim.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DDLSubProyecto.SelectedValue.ToEntero, DDLProveedor.SelectedValue.ToEntero, DdlPersonal.SelectedValue.ToEntero, DdlPorcentajeImpuesto.SelectedValue.ToDecimal, +CveCuenta:=DdlCuentas.SelectedValue.ToEntero) Then TxtOrden.Text = "" If Not ChkSeguirAgregando.Checked Then updatatos() From 5a46518cc8753aeb106aedf990b4278ed029438a Mon Sep 17 00:00:00 2001 From: rrene Date: Tue, 29 Dec 2020 17:38:37 -0700 Subject: [PATCH 09/22] datakeys --- Contabilidad/RegPrePoliza.aspx | 2 +- Contabilidad/RegPrePoliza.aspx.vb | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Contabilidad/RegPrePoliza.aspx b/Contabilidad/RegPrePoliza.aspx index c29f117a8..1cb80a307 100644 --- a/Contabilidad/RegPrePoliza.aspx +++ b/Contabilidad/RegPrePoliza.aspx @@ -303,7 +303,7 @@
- + Cuenta diff --git a/Contabilidad/RegPrePoliza.aspx.vb b/Contabilidad/RegPrePoliza.aspx.vb index c5b0c6618..6215cdbce 100644 --- a/Contabilidad/RegPrePoliza.aspx.vb +++ b/Contabilidad/RegPrePoliza.aspx.vb @@ -322,6 +322,7 @@ Partial Class ContabilidadC_RegPrePoliza .Add("ConceptoContable", Type.GetType("System.String")) .Add("TC", Type.GetType("System.Decimal")) .Add("PorcentajeImpuesto", Type.GetType("System.Decimal")) + .Add("CveCuenta", Type.GetType("System.Int32")) End With End Sub @@ -715,15 +716,20 @@ Partial Class ContabilidadC_RegPrePoliza If drr IsNot Nothing Then IdCuenta = drt("IdCtaContable").ToString.ToEntero CodigoCuenta = drr("CuentaFormato").ToString() - NombreCuenta = drr("Nombre").ToString() - 'Cuenta = drr("Nombre").ToString() + NombreCuenta = drr("Nombre").ToString() + 'Cuenta = drr("Nombre").ToString() + NombreCuenta = CodigoCuenta & "
" & NombreCuenta End If EsComodin = 0 End If + If drt("CveCuenta").ToString.ToEntero > 0 Then + NombreCuenta = String.Format("{0}
{1}", drt("Codigo"), drt("Nombre")) + End If + Dim dr As DataRow = DtMovimientos.NewRow dr("IdCuenta") = IdCuenta - dr("CodigoCuenta") = CodigoCuenta & "
" & NombreCuenta + dr("CodigoCuenta") = NombreCuenta dr("Cuenta") = Cuenta 'TxtCuentaContable.Text dr("Referencia") = If(drt("CveConcepto").ToString.Contiene("29", "130"), drt("Personal"), drt("RazonSocial")) dr("Concepto") = TxtObservaciones.Text @@ -737,7 +743,8 @@ Partial Class ContabilidadC_RegPrePoliza dr("CvePersonal") = drt("CvePersonal") dr("CveClasificacion") = -1 dr("MultipleSubProyecto") = drt("MultipleSubProyecto") - dr("PorcentajeImpuesto") = drt("PorcentajeImpuesto") + dr("PorcentajeImpuesto") = drt("PorcentajeImpuesto") + dr("CveCuenta") = drt("CveCuenta") DtMovimientos.Rows.Add(dr) Next @@ -945,8 +952,8 @@ Partial Class ContabilidadC_RegPrePoliza CvePersonal:=gvr.DataKey("CvePersonal").ToEntero, CveClasificacion:=gvr.DataKey("CveClasificacion").ToEntero, ImporteMX:=Importe, CveTipoGasto:=gvr.FCDropDownList("DdlTipoGasto").SelectedValue.ToEntero, CveCliente:=gvr.DataKey("CveCliente").ToEntero, CveVenta:=gvr.DataKey("CveVenta").ToEntero, TipoCambio:=If(gvr.DataKey("TC").ToString.ToDecimal > 0, gvr.DataKey("TC").ToString.ToDecimal, 1), - ImporteME:=If(gvr.DataKey("TC").ToString.ToDecimal > 0, (Importe / (gvr.DataKey("TC").ToString.ToDecimal - 1)).RoundSQL, 0), - PorcentajeImpuesto:=gvr.DataKey("PorcentajeImpuesto").ToDecimal) Then + ImporteME:=If(gvr.DataKey("TC").ToString.ToDecimal > 0, (Importe / (gvr.DataKey("TC").ToString.ToDecimal - 1)).RoundSQL, 0), + PorcentajeImpuesto:=gvr.DataKey("PorcentajeImpuesto").ToDecimal, CveCuenta:=gvr.DataKey("CveCuenta").ToEntero) Then Else MsgError = "No se pudo insertar el detalle de la póliza2" Exit For From 2e3330e5d422d4614ed729465f16d9a2f46b3252 Mon Sep 17 00:00:00 2001 From: rrene Date: Tue, 29 Dec 2020 17:39:18 -0700 Subject: [PATCH 10/22] sat requerido --- Ventas/ProductosServicios.aspx.vb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Ventas/ProductosServicios.aspx.vb b/Ventas/ProductosServicios.aspx.vb index 18dbbe908..d6c0cbaf4 100644 --- a/Ventas/ProductosServicios.aspx.vb +++ b/Ventas/ProductosServicios.aspx.vb @@ -1146,7 +1146,7 @@ Partial Class ProductosyServicios End Sub Protected Sub BtnGuardar_Click(sender As Object, e As System.EventArgs) Handles BtnGuardar.Click - If DdlSATPS.SelectedValue = "46920" Then + If DdlSATPS.SelectedValue.Contiene("46920", "0", "-1") AndAlso UsuarioActual.CveEmpresa.Contiene(119, 158, 72, 80, 145) Then Alert("El Producto Servicio SAT con clave '01010101' no es valido, por favor seleccione otro", TipoMensaje.MsgAdvertencia) Exit Sub End If @@ -1159,13 +1159,13 @@ Partial Class ProductosyServicios Dim CveClasificacion2 As Integer = DdlClasificacion2.SelectedValue.ToEntero If (TxtCodigo.Text = TxtCodigoBarras.Text AndAlso TxtCodigo.Text <> "") Then - Alert("Los codigos no pueden ser iguales. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) + Alert("Los códigos no pueden ser iguales. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) Return End If If ddlMetodos.SelectedValue = "5" Or ChkSerie.Checked Then If Not (ddlMetodos.SelectedValue = "5" And ChkSerie.Checked) Then - Dim Mensaje As String = If(ddlMetodos.SelectedValue = "5", "Si el método de salida del inventario es 'SerieLote' el producto debe poder aplicar serie", "Si el produco aplica serie el método de inventario debe ser 'SerieLote'") + Dim Mensaje As String = If(ddlMetodos.SelectedValue = "5", "Si el método de salida del inventario es 'Serie' el producto debe poder aplicar serie", "Si el produco aplica serie el método de inventario debe ser 'SerieLote'") Alert(Mensaje) Exit Sub End If @@ -1176,12 +1176,12 @@ Partial Class ProductosyServicios 'End If If UsuarioActual.Empresa.Funcionalidad(265) = "1" And TxtCodigo.Text = "" Then - Alert("El codigo es requerido.", TipoMensaje.MsgAdvertencia) + Alert("El código es requerido.", TipoMensaje.MsgAdvertencia) Return End If If TxtCodigo.Text <> "" AndAlso Not TxtCodigo.Text.Length >= 3 Then - Alert("El codigo tiene que que tener una longitud de al menos 3 digitos.", TipoMensaje.MsgAdvertencia) + Alert("El código tiene que que tener una longitud de al menos 3 digitos.", TipoMensaje.MsgAdvertencia) Return End If @@ -1450,7 +1450,7 @@ Partial Class ProductosyServicios Dim ObjAliasDelete As New ClsProductosServicios Dim TieneError = False - If ObjAliasDelete.RemovePSAlias(GVAlias.Rows(e.RowIndex).DataKey("CvePS").ToString.ToEntero, GVAlias.Rows(e.RowIndex).DataKey("PSAlias").ToString, -1) Then + If ObjAliasDelete.RemovePSAlias(GVAlias.Rows(e.RowIndex).DataKey("CvePS").ToString.ToEntero, GVAlias.Rows(e.RowIndex).DataKey("PSAlias").ToString, UsuarioActual.CveUsuario) Then GVAlias.EditIndex = -1 CargarAlias() UPGVAlias.Update() From 7726177eda2161f467c0a4a3a4f6d23064cf208a Mon Sep 17 00:00:00 2001 From: rrene Date: Tue, 29 Dec 2020 17:39:44 -0700 Subject: [PATCH 11/22] porcentajeimpuesto en concepto 6 --- Compras/Compras.aspx.vb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index b109f0059..05acca532 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -6833,20 +6833,20 @@ Partial Class Compras_Compras End If End If Case 6 + PorcentajeImpuesto = TmpDT.MAX("IVAPorcentaje").ToDecimal Concepto = $"{NombreProveedor} {TxtSerie.Text} - {TxtFolio.Text}" - For Each RowDetalle As DataRow In TmpDT.FiltraParametros("ISNULL(TipoAF,0) <> 2", "", {"CveClasificacion", "CveSubProyecto"}).Rows + For Each RowDetalle As DataRow In TmpDT.FiltraParametros("ISNULL(TipoAF,0) <> 2", "", {"CveClasificacion", "CveSubProyecto", "IVAPorcentaje"}).Rows If ObjConta.GetRetCuenta(6, RowDetalle("CveClasificacion").ToString().ToEntero()) Then If ObjConta.DtResultados.Rows.Count > 0 Then IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaGasto").ToString.ToEntero - CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaGastoSIG").ToString.ToEntero End If End If If importeMN <> 0 Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMN, Referencia, 6, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, CveAcreedor:=CveAcreedor, CveIE:=CveIE, CvePersonal:=CvePersonal, CveColectiva:=CveColectiva, CveCreditoDetalle:=CveCreditoDetalle, ImporteMX:=importeMN, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), CveCuenta:=CveCuenta, TipoCambio:=tipoCambioActual, - CveClasificacion:=RowDetalle("CveClasificacion").ToString().ToEntero(), CveSubProyecto:=RowDetalle("CveSubProyecto").ToString().ToEntero(), Contabilizable:=SeContabiliza) Then + CveClasificacion:=RowDetalle("CveClasificacion").ToString().ToEntero(), CveSubProyecto:=RowDetalle("CveSubProyecto").ToString().ToEntero(), Contabilizable:=SeContabiliza, PorcentajeImpuesto:=RowDetalle("IVAPorcentaje").ToString.ToDecimal) Then ErrorPrepoliza = True End If End If @@ -19669,8 +19669,8 @@ Partial Class Compras_Compras Dim Multiplicador = If(DdlTipoComprobante.SelectedValue = "NC", -1, 1) If DdlMoneda.SelectedValue.ToString.ToEntero = 2 Then - tipoCambioActual = GlobalTipoCambio(TxtFecha.Text.ToDate).ToString.ToDecimal - tipoCambioActual = If(DivTC.Visible, TipoCambio.ToDecimal, tipoCambioActual) + 'tipoCambioActual = GlobalTipoCambio(TxtFecha.Text.ToDate).ToString.ToDecimal + tipoCambioActual = TxtTC.Text.ToDecimal Else tipoCambioActual = 1 End If From 65f3181806f8da2cc46a29d7a3b2499672375d72 Mon Sep 17 00:00:00 2001 From: rrene Date: Tue, 29 Dec 2020 17:40:05 -0700 Subject: [PATCH 12/22] que tenga folio fiscal --- Ventas/RepCancelacionesPorRespuesta.aspx.cs | 423 ++++++++++---------- 1 file changed, 212 insertions(+), 211 deletions(-) diff --git a/Ventas/RepCancelacionesPorRespuesta.aspx.cs b/Ventas/RepCancelacionesPorRespuesta.aspx.cs index df8d7e78a..05451a07f 100644 --- a/Ventas/RepCancelacionesPorRespuesta.aspx.cs +++ b/Ventas/RepCancelacionesPorRespuesta.aspx.cs @@ -1,47 +1,47 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.IO; -using System.Linq; -using System.ServiceModel; -using System.Text; -using System.Web; -using System.Web.UI; -using System.Web.UI.WebControls; -using Extensiones; -using static Extensiones.ModExtensiones; +using System; +using System.Collections.Generic; +using System.Data; +using System.IO; +using System.Linq; +using System.ServiceModel; +using System.Text; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Extensiones; +using static Extensiones.ModExtensiones; using Microsoft.Reporting.WebForms; -public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas -{ - private DataTable DtVentas - { - get { return (ViewState["DtVentas"] == null) ? null : (DataTable)ViewState["DtVentas"]; } - set { ViewState["DtVentas"] = value; } - } - private int CveVenta - { - get { return (ViewState["CveVenta"] == null) ? -1 : ViewState["CveVenta"].ToString().ToEntero(); } - set { ViewState["CveVenta"] = value; } - } - protected void Page_Load(object sender, EventArgs e) - { - if (!IsPostBack) - { - CargaDatos(); - } - } - private void CargaDatos() - { - HdnLigaRefacturar.Value = ""; - - if (Request["CveVenta"] != null) - { - this.CveVenta = Request["CveVenta"].ToString().ToEntero(); - } - - var ObjVentas = new ClsVentas(); - if (ObjVentas.GetVentas(UsuarioActual.CveEmpresa, "-1", "-1", -1, "-1", -1, -1, -2, -1, "-1", "-1", "-1", CveUsuarioConsulta: UsuarioActual.CveUsuario)) +public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas +{ + private DataTable DtVentas + { + get { return (ViewState["DtVentas"] == null) ? null : (DataTable)ViewState["DtVentas"]; } + set { ViewState["DtVentas"] = value; } + } + private int CveVenta + { + get { return (ViewState["CveVenta"] == null) ? -1 : ViewState["CveVenta"].ToString().ToEntero(); } + set { ViewState["CveVenta"] = value; } + } + protected void Page_Load(object sender, EventArgs e) + { + if (!IsPostBack) + { + CargaDatos(); + } + } + private void CargaDatos() + { + HdnLigaRefacturar.Value = ""; + + if (Request["CveVenta"] != null) + { + this.CveVenta = Request["CveVenta"].ToString().ToEntero(); + } + + var ObjVentas = new ClsVentas(); + if (ObjVentas.GetVentas(UsuarioActual.CveEmpresa, "-1", "-1", -1, "-1", -1, -1, -2, -1, "-1", "-1", "-1", CveUsuarioConsulta: UsuarioActual.CveUsuario)) { if (Request["CveVenta"] != null && Request["CveVenta"].ToString().ToEntero() > 0) @@ -51,42 +51,42 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas else { DtVentas = ObjVentas.DtResultados.Copy(); - } - } - - ObjVentas.Dispose(); - GvDatos.DataSource = DtVentas.FiltraParametros("CveEstatusFactura = 20 AND CveEstatusRefacturacion = 0"); - - var DtRefacturar = DtVentas.FiltraParametros("CveEstatusRefacturacion IN (1,3)"); - if (DtRefacturar != null && DtRefacturar.Rows.Count > 0) - { - DivRefacturar.Visible = true; - GvRefacturaciones.DataSource = DtRefacturar; - GvRefacturaciones.DataBind(); - } - - GvDatos.DataBind(); - UPDatos.Update(); - } - protected void BtnValidar_Click(object sender, EventArgs e) - { + } + } + + ObjVentas.Dispose(); + GvDatos.DataSource = DtVentas.FiltraParametros("CveEstatusFactura = 20 AND CveEstatusRefacturacion = 0"); + + var DtRefacturar = DtVentas.FiltraParametros("CveEstatusRefacturacion IN (1,3)"); + if (DtRefacturar != null && DtRefacturar.Rows.Count > 0) + { + DivRefacturar.Visible = true; + GvRefacturaciones.DataSource = DtRefacturar; + GvRefacturaciones.DataBind(); + } + + GvDatos.DataBind(); + UPDatos.Update(); + } + protected void BtnValidar_Click(object sender, EventArgs e) + { this.HdnLigaRefacturar.Value = ""; - this.CveVenta = -1; - - GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); - this.CveVenta = GvRow.DataKey("CveVenta").ToEntero(); - - int CveCliente = GvRow.DataKey("CveCliente").ToEntero(); - string Total = GvRow.DataKey("Total"); - string SubTotal = GvRow.DataKey("SubTotal"); - string Uuid = GvRow.DataKey("FolioFiscal"); - string RFCCliente = GvRow.DataKey("RFCCliente"); - string Folio = GvRow.DataKey("Folio"); - string TipoDocto = GvRow.DataKey("TipoDocto"); - string Nombre = GvRow.DataKey("Nombre"); - if (CveVenta > 0) - { - var resp = VerificarVigenciaSAT(CveVenta, CveCliente, Folio, TipoDocto, Uuid, UsuarioActual.Empresa.RFC, RFCCliente, Total); + this.CveVenta = -1; + + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + this.CveVenta = GvRow.DataKey("CveVenta").ToEntero(); + + int CveCliente = GvRow.DataKey("CveCliente").ToEntero(); + string Total = GvRow.DataKey("Total"); + string SubTotal = GvRow.DataKey("SubTotal"); + string Uuid = GvRow.DataKey("FolioFiscal"); + string RFCCliente = GvRow.DataKey("RFCCliente"); + string Folio = GvRow.DataKey("Folio"); + string TipoDocto = GvRow.DataKey("TipoDocto"); + string Nombre = GvRow.DataKey("Nombre"); + if (CveVenta > 0 && Uuid != "") + { + var resp = VerificarVigenciaSAT(CveVenta, CveCliente, Folio, TipoDocto, Uuid, UsuarioActual.Empresa.RFC, RFCCliente, Total); if (resp.EnviarAcuse) { Alert(resp.Mensaje,TipoMensaje.MsgConfirmacion,"BtnEnviarMailCancelacion();"); @@ -94,30 +94,31 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas else { Alert(resp.Mensaje); - } - - } - CargaDatos(); + } + + } + CargaDatos(); } - protected void BtnValidarRefacturacion_Click(object sender, EventArgs e) - { + protected void BtnValidarRefacturacion_Click(object sender, EventArgs e) + { this.HdnLigaRefacturar.Value = ""; - this.CveVenta = -1; - - GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); - this.CveVenta = GvRow.DataKey("CveVenta").ToEntero(); - - int CveCliente = GvRow.DataKey("CveCliente").ToEntero(); - string Total = GvRow.DataKey("Total"); - string SubTotal = GvRow.DataKey("SubTotal"); - string Uuid = GvRow.DataKey("FolioFiscal"); - string RFCCliente = GvRow.DataKey("RFCCliente"); - string Folio = GvRow.DataKey("Folio"); - string TipoDocto = GvRow.DataKey("TipoDocto"); - string Nombre = GvRow.DataKey("Nombre"); - - if (CveVenta > 0) - { + this.CveVenta = -1; + + GridViewRow GvRow = (GridViewRow)(((LinkButton)sender).NamingContainer); + this.CveVenta = GvRow.DataKey("CveVenta").ToEntero(); + + int CveCliente = GvRow.DataKey("CveCliente").ToEntero(); + string Total = GvRow.DataKey("Total"); + string SubTotal = GvRow.DataKey("SubTotal"); + string Uuid = GvRow.DataKey("FolioFiscal"); + string RFCCliente = GvRow.DataKey("RFCCliente"); + string Folio = GvRow.DataKey("Folio"); + string TipoDocto = GvRow.DataKey("TipoDocto"); + string Nombre = GvRow.DataKey("Nombre"); + + + if (CveVenta > 0 && Uuid != "") + { var respuesta = VerificarVigenciaSAT(CveVenta, CveCliente, Folio, TipoDocto, Uuid, UsuarioActual.Empresa.RFC, RFCCliente, Total, true); CargaDatos(); if (respuesta.CveEstatus.Contiene(4,5)) @@ -129,7 +130,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas { Alert(respuesta.Mensaje,TipoMensaje.MsgAdvertencia); } - + //if (respuesta.IrARefacturar) //{ // Server.Transfer(respuesta.LigaRefacturacion); @@ -138,46 +139,46 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas //{ // Alert(respuesta.Mensaje); // CargaDatos(); - //} - } - UPDatos.Update(); - - } - private MRespuestaSAT VerificarVigenciaSAT(int CveVenta, int CveCliente, string Folio, string TipoDocto, string uuid, string emisor, string receptor, string total, bool EsRefacturacion = false) - { - HdnLigaRefacturar.Value = ""; - + //} + } + UPDatos.Update(); + + } + private MRespuestaSAT VerificarVigenciaSAT(int CveVenta, int CveCliente, string Folio, string TipoDocto, string uuid, string emisor, string receptor, string total, bool EsRefacturacion = false) + { + HdnLigaRefacturar.Value = ""; + var retorno = new MRespuestaSAT() { Mensaje = "", EnviarAcuse = false, LigaRefacturacion = "", IrARefacturar = false - }; - - var sb = new StringBuilder(); - - string CancelacionAcuse = ""; - DateTime CancelacionFecha = DateTime.Now; - int CveEstatus = 4; - - try - { - var resp = Timbrado.VerificarVigenciaSAT(uuid, UsuarioActual.Empresa.RFC, receptor, total, true); - if (resp != null) + }; + + var sb = new StringBuilder(); + + string CancelacionAcuse = ""; + DateTime CancelacionFecha = DateTime.Now; + int CveEstatus = 4; + + try + { + var resp = Timbrado.VerificarVigenciaSAT(uuid, UsuarioActual.Empresa.RFC, receptor, total, true); + if (resp != null) { - - if (resp.Estado == null) - { - sb.Append("No se pudo comprobar el estado de la factura. El servicio del sat no esta disponible"); - retorno.Mensaje = sb.ToString(); - return retorno; - } - - sb.AppendFormat("Folio Fiscal: {0}
", uuid); - sb.AppendFormat("Codigo Estado: {0}
", resp.CodigoEstatus); - sb.AppendFormat("Estado: {0}
", resp.Estado); - sb.AppendFormat("Es Cancelable: {0}
", string.IsNullOrEmpty(resp.EsCancelable) ? "Desconocido" : resp.EsCancelable); + + if (resp.Estado == null) + { + sb.Append("No se pudo comprobar el estado de la factura. El servicio del sat no esta disponible"); + retorno.Mensaje = sb.ToString(); + return retorno; + } + + sb.AppendFormat("Folio Fiscal: {0}
", uuid); + sb.AppendFormat("Codigo Estado: {0}
", resp.CodigoEstatus); + sb.AppendFormat("Estado: {0}
", resp.Estado); + sb.AppendFormat("Es Cancelable: {0}
", string.IsNullOrEmpty(resp.EsCancelable) ? "Desconocido" : resp.EsCancelable); sb.AppendFormat("Estatus de Cancelación: {0}

", string.IsNullOrEmpty(resp.EsCancelable) ? "Desconocido" : resp.EstatusCancelacion); if (!UsuarioActual.Empresa.FacturaProduccion && (string.IsNullOrEmpty(uuid) || uuid.Contains("test"))) @@ -253,31 +254,31 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas } ObjVentas.Dispose(); } - } - } - else - { - sb.Append("No se pudo comprobar la vigencia de la factura."); + } + } + else + { + sb.Append("No se pudo comprobar la vigencia de la factura."); retorno.Mensaje = sb.ToString(); - return retorno; - } - } - catch (Exception ex) - { + return retorno; + } + } + catch (Exception ex) + { sb.Append("Error al consumir el servicio: " + ex.Message); retorno.Mensaje = sb.ToString(); - return retorno; - } - - retorno.CveEstatus = CveEstatus; - + return retorno; + } + + retorno.CveEstatus = CveEstatus; + retorno.Mensaje = sb.ToString(); - return retorno; - } - private Modelos.Factura.MCancelacionVentaMensaje CancelarDocumento(int CveVenta, int CveEstatus, int CveCliente, string Folio, string FolioFiscal, string CancelacionAcuse, DateTime CancelacionFecha, string TipoComprobante, double Total, int CvePACCancelacion, bool EsRefacturacion = false) - { - Modelos.Factura.MCancelacionVentaMensaje retorno = null; - var factura = new Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:true); + return retorno; + } + private Modelos.Factura.MCancelacionVentaMensaje CancelarDocumento(int CveVenta, int CveEstatus, int CveCliente, string Folio, string FolioFiscal, string CancelacionAcuse, DateTime CancelacionFecha, string TipoComprobante, double Total, int CvePACCancelacion, bool EsRefacturacion = false) + { + Modelos.Factura.MCancelacionVentaMensaje retorno = null; + var factura = new Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:true); if (EsRefacturacion) { retorno = factura.CancelarPorRefacturacion(); @@ -285,63 +286,63 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas else { retorno = factura.EjecutarCancelacionPendiente(CveEstatus, CancelacionFecha, CancelacionAcuse); - } - - return retorno; - } - - private string DecodeBase64(string strXMLCodificado) - { - try - { - byte[] decbuff = Convert.FromBase64String(strXMLCodificado); - return System.Text.Encoding.UTF8.GetString(decbuff); - } - catch - { - return ""; - } - } - - protected void LnkValidar_Click(object sender, EventArgs e) + } + + return retorno; + } + + private string DecodeBase64(string strXMLCodificado) + { + try + { + byte[] decbuff = Convert.FromBase64String(strXMLCodificado); + return System.Text.Encoding.UTF8.GetString(decbuff); + } + catch + { + return ""; + } + } + + protected void LnkValidar_Click(object sender, EventArgs e) { this.HdnLigaRefacturar.Value = ""; - this.CveVenta = -1; - - if (DtVentas != null) - { - var sb = new StringBuilder(); - foreach (DataRow Row in DtVentas.Rows) - { - int CveVenta = Row["CveVenta"].ToEntero(); - string Total = Row["Total"].ToString(); - string SubTotal = Row["SubTotal"].ToString(); - string Uuid = Row["FolioFiscal"].ToString(); - string RFCCliente = Row["RFCCliente"].ToString(); - string Folio = Row["Folio"].ToString(); - string TipoDocto = Row["TipoDocto"].ToString(); - string Nombre = Row["Nombre"].ToString(); - int CveCliente = Row["CveCliente"].ToEntero(); - if (CveVenta > 0) - { - sb.AppendFormat("{0}
", VerificarVigenciaSAT(CveVenta, CveCliente, Folio, TipoDocto, Uuid, UsuarioActual.Empresa.RFC, RFCCliente, SubTotal)); - } - } - Alert(sb.ToString()); - } - CargaDatos(); - } - - protected void GvDatos_RowDataBound(object sender, GridViewRowEventArgs e) - { - if (e.Row.RowType == DataControlRowType.DataRow) - { - if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 0) - { - e.Row.Cells[10].Text = ""; - } - } - } + this.CveVenta = -1; + + if (DtVentas != null) + { + var sb = new StringBuilder(); + foreach (DataRow Row in DtVentas.Rows) + { + int CveVenta = Row["CveVenta"].ToEntero(); + string Total = Row["Total"].ToString(); + string SubTotal = Row["SubTotal"].ToString(); + string Uuid = Row["FolioFiscal"].ToString(); + string RFCCliente = Row["RFCCliente"].ToString(); + string Folio = Row["Folio"].ToString(); + string TipoDocto = Row["TipoDocto"].ToString(); + string Nombre = Row["Nombre"].ToString(); + int CveCliente = Row["CveCliente"].ToEntero(); + if (CveVenta > 0) + { + sb.AppendFormat("{0}
", VerificarVigenciaSAT(CveVenta, CveCliente, Folio, TipoDocto, Uuid, UsuarioActual.Empresa.RFC, RFCCliente, SubTotal)); + } + } + Alert(sb.ToString()); + } + CargaDatos(); + } + + protected void GvDatos_RowDataBound(object sender, GridViewRowEventArgs e) + { + if (e.Row.RowType == DataControlRowType.DataRow) + { + if (e.Row.DBCampo("PuedeRefacturar").ToString().ToEntero() == 0) + { + e.Row.Cells[10].Text = ""; + } + } + } public void BtnEnviarMailCancelacion_Click(object sender, EventArgs e) { if (this.CveVenta > 0) @@ -353,7 +354,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas Alert("No se encontro la factura para enviar el acuse", TipoMensaje.MsgAdvertencia); } } - + public void ImprimeCancelacion(int CveVenta) { var Archivo = new System.IO.FileInfo(ModExtensiones.DirectorioBaseEmpresas + @"Empresas\Grales\Formatos\AcuseCancelacion.rdlc"); @@ -457,7 +458,7 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas } } -} +} public class MRespuestaSAT { public int CveEstatus { get; set; } From dc9c1b339515a295bd071f803a41535fb222084c Mon Sep 17 00:00:00 2001 From: rrene Date: Tue, 29 Dec 2020 17:40:29 -0700 Subject: [PATCH 13/22] validacion efos --- App_WebReferences/wsValidaCFDi2/ConsultaCFDIService.xsd | 1 + 1 file changed, 1 insertion(+) diff --git a/App_WebReferences/wsValidaCFDi2/ConsultaCFDIService.xsd b/App_WebReferences/wsValidaCFDi2/ConsultaCFDIService.xsd index 1e54f4ce6..2b9fa47bf 100644 --- a/App_WebReferences/wsValidaCFDi2/ConsultaCFDIService.xsd +++ b/App_WebReferences/wsValidaCFDi2/ConsultaCFDIService.xsd @@ -6,6 +6,7 @@ + From de63a27f3a32d84b0b2193a3d95090f7456f641f Mon Sep 17 00:00:00 2001 From: rakcsle Date: Tue, 29 Dec 2020 18:57:18 -0700 Subject: [PATCH 14/22] Contratos modal avancve RH y maquinaria --- App_Code/ClsContratos.vb | 5 ++- Contratos/ContratoObra.aspx | 23 +++++++++++++- Contratos/ContratoObra.aspx.vb | 58 ++++++++++++++++++++++++++++++---- 3 files changed, 77 insertions(+), 9 deletions(-) diff --git a/App_Code/ClsContratos.vb b/App_Code/ClsContratos.vb index a8235bf19..83a20daf6 100644 --- a/App_Code/ClsContratos.vb +++ b/App_Code/ClsContratos.vb @@ -2507,7 +2507,7 @@ Public Class ClsContratos Return Retorno End Function - Public Function GetVentasAvanceObra(CveContrato As Integer, CveClasificacion As Integer, CvePS As Integer, Tipo As Integer) As Boolean + Public Function GetVentasAvanceObra(CveContrato As Integer, CveClasificacion As Integer, CvePS As Integer, Tipo As Integer, CveRubro As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Con_RepVentasAvancesObra") @@ -2517,6 +2517,9 @@ Public Class ClsContratos .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion .Add("@CvePS", SqlDbType.Int).Value = CvePS .Add("@Tipo", SqlDbType.Int).Value = Tipo + .Add("@CveRubro", SqlDbType.Int).Value = CveRubro + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With diff --git a/Contratos/ContratoObra.aspx b/Contratos/ContratoObra.aspx index bea7e596d..416c1b002 100644 --- a/Contratos/ContratoObra.aspx +++ b/Contratos/ContratoObra.aspx @@ -1357,7 +1357,7 @@
@@ -2406,6 +2406,27 @@ + + + + + + + + + + + + + + + + + + + + +
diff --git a/Contratos/ContratoObra.aspx.vb b/Contratos/ContratoObra.aspx.vb index 3b045b946..c768e35c3 100644 --- a/Contratos/ContratoObra.aspx.vb +++ b/Contratos/ContratoObra.aspx.vb @@ -2372,6 +2372,8 @@ Partial Class Contratos_ContratoObra GvDatosVentasAvance.Visible = True GvDatosVentasAvanceInterno.Visible = False + GvDatosVentasAvanceInternoRH.Visible = False + GvDatosVentasAvanceInternoMaquinaria.Visible = False 'Dim Btn = CType(sender, LinkButton) 'Dim Parametros = Btn.CommandArgument.Split("|"c) @@ -2384,7 +2386,7 @@ Partial Class Contratos_ContratoObra Dim ObjContratos As New ClsContratos - If ObjContratos.GetVentasAvanceObra(CveContrato, CveClasificacion, CvePS, 1) Then + If ObjContratos.GetVentasAvanceObra(CveContrato, CveClasificacion, CvePS, 1, -1, UsuarioActual.CveEmpresa) Then GvDatosVentasAvance.DataSource = ObjContratos.DtResultados RegistraScript("$('#ModalVentasAvance').modal('show');RecargaAvances = true;") Else @@ -2409,26 +2411,68 @@ Partial Class Contratos_ContratoObra Dim GvRow As GridViewRow = CType(((CType(sender, LinkButton)).NamingContainer), GridViewRow) - GvDatosVentasAvance.Visible = False - GvDatosVentasAvanceInterno.Visible = True + Dim CveClasificacion As Integer = GvRow.DataKey("CveClasificacion").ToEntero Dim CvePS As Integer = GvRow.DataKey("CvePS").ToEntero Dim CodigoPS As String = GvRow.DataKey("CodigoPS") Dim Clasificacion As String = GvRow.DataKey("Clasificacion") + Dim CveRubro As Integer = GvRow.DataKey("CveRubro").ToEntero + + + + + GvDatosVentasAvance.Visible = False + + If CveRubro = 3 Then + GvDatosVentasAvanceInterno.Visible = False + GvDatosVentasAvanceInternoRH.Visible = True + GvDatosVentasAvanceInternoMaquinaria.Visible = False + ElseIf CveRubro = 4 Then + GvDatosVentasAvanceInterno.Visible = False + GvDatosVentasAvanceInternoRH.Visible = False + GvDatosVentasAvanceInternoMaquinaria.Visible = True + Else + GvDatosVentasAvanceInterno.Visible = True + GvDatosVentasAvanceInternoRH.Visible = False + GvDatosVentasAvanceInternoMaquinaria.Visible = False + End If + + + GvDatosVentasAvanceInterno.Visible = True Dim ObjContratos As New ClsContratos - If ObjContratos.GetVentasAvanceObra(CveContrato, CveClasificacion, CvePS, 2) Then - GvDatosVentasAvanceInterno.DataSource = ObjContratos.DtResultados + If ObjContratos.GetVentasAvanceObra(CveContrato, CveClasificacion, CvePS, 2, CveRubro, UsuarioActual.CveEmpresa) Then + + + + + If CveRubro = 3 Then + GvDatosVentasAvanceInternoRH.DataSource = ObjContratos.DtResultados + ElseIf CveRubro = 4 Then + GvDatosVentasAvanceInternoMaquinaria.DataSource = ObjContratos.DtResultados + Else + GvDatosVentasAvanceInterno.DataSource = ObjContratos.DtResultados + End If + + RegistraScript("$('#ModalVentasAvance').modal('show');RecargaAvances = true;") Else Alert("Ocurrió un error al obtener el Listado de Ventas de Avance. Por favor vuelva a intentar", TipoMensaje.MsgError) End If - ObjContratos.Dispose() - GvDatosVentasAvanceInterno.DataBind() + ObjContratos.Dispose() + + If CveRubro = 3 Then + GvDatosVentasAvanceInternoRH.DataBind() + ElseIf CveRubro = 4 Then + GvDatosVentasAvanceInternoMaquinaria.DataBind() + Else + GvDatosVentasAvanceInterno.DataBind() + End If + LbTituloModalVentasAvance.Text = "Compras de Avance" From 7384cabd721e270fc806fde3ce05f3ed124d1958 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Tue, 29 Dec 2020 18:58:50 -0700 Subject: [PATCH 15/22] Contratos alineacion de unas lineas --- Contratos/ContratoObra.aspx.vb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Contratos/ContratoObra.aspx.vb b/Contratos/ContratoObra.aspx.vb index c768e35c3..e0dc4dbf5 100644 --- a/Contratos/ContratoObra.aspx.vb +++ b/Contratos/ContratoObra.aspx.vb @@ -2446,9 +2446,6 @@ Partial Class Contratos_ContratoObra If ObjContratos.GetVentasAvanceObra(CveContrato, CveClasificacion, CvePS, 2, CveRubro, UsuarioActual.CveEmpresa) Then - - - If CveRubro = 3 Then GvDatosVentasAvanceInternoRH.DataSource = ObjContratos.DtResultados ElseIf CveRubro = 4 Then @@ -2457,7 +2454,6 @@ Partial Class Contratos_ContratoObra GvDatosVentasAvanceInterno.DataSource = ObjContratos.DtResultados End If - RegistraScript("$('#ModalVentasAvance').modal('show');RecargaAvances = true;") Else Alert("Ocurrió un error al obtener el Listado de Ventas de Avance. Por favor vuelva a intentar", TipoMensaje.MsgError) From 7e99432d44c6cce2730c2f348b91c229e314b74b Mon Sep 17 00:00:00 2001 From: rakcsle Date: Wed, 30 Dec 2020 10:13:36 -0700 Subject: [PATCH 16/22] Solicitud de traspaso, permiso eliminar solicitud de traspaso --- Contratos/ContratoObra.aspx | 2 +- Contratos/ContratoObra.aspx.vb | 3 --- Inventarios/TrasladoSolicitud.aspx.vb | 11 +++++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Contratos/ContratoObra.aspx b/Contratos/ContratoObra.aspx index 416c1b002..6efbb60f6 100644 --- a/Contratos/ContratoObra.aspx +++ b/Contratos/ContratoObra.aspx @@ -2420,7 +2420,7 @@ - + diff --git a/Contratos/ContratoObra.aspx.vb b/Contratos/ContratoObra.aspx.vb index e0dc4dbf5..257981658 100644 --- a/Contratos/ContratoObra.aspx.vb +++ b/Contratos/ContratoObra.aspx.vb @@ -2439,9 +2439,6 @@ Partial Class Contratos_ContratoObra GvDatosVentasAvanceInternoMaquinaria.Visible = False End If - - GvDatosVentasAvanceInterno.Visible = True - Dim ObjContratos As New ClsContratos If ObjContratos.GetVentasAvanceObra(CveContrato, CveClasificacion, CvePS, 2, CveRubro, UsuarioActual.CveEmpresa) Then diff --git a/Inventarios/TrasladoSolicitud.aspx.vb b/Inventarios/TrasladoSolicitud.aspx.vb index baf983a9c..828eadeda 100644 --- a/Inventarios/TrasladoSolicitud.aspx.vb +++ b/Inventarios/TrasladoSolicitud.aspx.vb @@ -214,7 +214,11 @@ Partial Class Inventarios_TrasladoSolicitud Else TrGuia.Visible = False End If - BtnEliminar.Visible = True + + If UsuarioActual.TienePermisoProceso(313) Then + BtnEliminar.Visible = True + End If + BtnGuardar.Enabled = False TxtObservaciones.Enabled = False TxtFecha.Enabled = False @@ -563,6 +567,8 @@ Partial Class Inventarios_TrasladoSolicitud Dim CodigoPS As String = "" + + 'Aqui poner permiso para poder evitar permiso de traslado If ObjInventarios.GetAlmacenes(-1, -1, UsuarioActual.CveEmpresa, -1) Then If ObjInventarios.DtResultados.Rows.Count > 0 Then @@ -1037,9 +1043,6 @@ Partial Class Inventarios_TrasladoSolicitud MandaCorreoRechazo(LbFolio.Text.ToEntero, CveTraspasoSolicitud, CveUsuarioSolicita, TxtMotivoRechazo.Text) CargaDatos() RegistraScript("$('#ModalRechazarTraslado').modal('hide');") - - - End If End Sub From 093d511a6caec84838698b38e36bed20766f03b4 Mon Sep 17 00:00:00 2001 From: Antonio Gonzalez Date: Thu, 31 Dec 2020 14:17:32 -0700 Subject: [PATCH 17/22] cuentas de bancos se actualizan con estatus del banco --- App_Code/ClsBancos.vb | 15 +++++++++++++++ Bancos/CatBancos.aspx.vb | 25 ++++++++++++++++++++----- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/App_Code/ClsBancos.vb b/App_Code/ClsBancos.vb index a2129f8a1..4e3b0b213 100644 --- a/App_Code/ClsBancos.vb +++ b/App_Code/ClsBancos.vb @@ -4463,6 +4463,21 @@ Public Class ClsBancos Return Retorno End Function + Public Function InhabilitarCuentasBancos(CveBanco As Integer, Estatus As Boolean) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_InhabilitarCuentas") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveBanco", SqlDbType.Int).Value = CveBanco + .Add("@Estatus", SqlDbType.Bit).Value = Estatus + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al inhabilitar las Cuentas Bancarias.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + Return Retorno + End Function Public Function GetBancosSAT() As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Nom_Sat_BancosGet") diff --git a/Bancos/CatBancos.aspx.vb b/Bancos/CatBancos.aspx.vb index 9a57ab193..0aee43f9b 100644 --- a/Bancos/CatBancos.aspx.vb +++ b/Bancos/CatBancos.aspx.vb @@ -119,6 +119,7 @@ Partial Class Bancos_CatBancos Protected Sub GvDatos_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvDatos.RowUpdating Dim ObjBancos As New ClsBancos + ObjBancos.IniciaTransacSQL() Dim Banco As String = DirectCast(GvDatos.Rows(e.RowIndex).FindControl("TxtBanco"), TextBox).Text.Trim Dim Ejecutivo As String = DirectCast(GvDatos.Rows(e.RowIndex).FindControl("TxtEjecutivo"), TextBox).Text.Trim @@ -126,13 +127,27 @@ Partial Class Bancos_CatBancos Dim Estatus As Boolean = GvDatos.Rows(e.RowIndex).FCCheckBox("ChkEstatus").Checked Dim CveBanco As Integer = GvDatos.DataKeys(e.RowIndex).Value.ToString.ToEntero + Dim TieneError As Boolean = False If ObjBancos.UpdateBancos(Banco, Ejecutivo, Telefono, Estatus, CveBanco) Then - GvDatos.EditIndex = -1 - ViewState("DTBancos") = ObjBancos.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) - DtBan = ObjBancos.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) - GlobalDTBancos = ObjBancos.DtResultados - Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion) + If ObjBancos.InhabilitarCuentasBancos(CveBanco, Estatus) Then + GvDatos.EditIndex = -1 + ViewState("DTBancos") = ObjBancos.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) + DtBan = ObjBancos.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) + GlobalDTBancos = ObjBancos.DtResultados + Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion) + Else + TieneError = True + End If + Else + TieneError = True + End If + + If TieneError Then + ObjBancos.RollBack() + Else + ObjBancos.Commit() + GlobalDTBancosCuentas(-1, CveEmpresa:=UsuarioActual.CveEmpresa) = Nothing End If ObjBancos.Dispose() From 40ba9adc0f10b6984bf7701c24bbfdb17155405b Mon Sep 17 00:00:00 2001 From: rrene Date: Mon, 4 Jan 2021 11:59:23 -0700 Subject: [PATCH 18/22] --- correccion de campos, y de diferencia recibida por oc --- OC/OC.aspx | 4 ++-- OC/OC.aspx.vb | 28 ++++++++++++++++------------ 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/OC/OC.aspx b/OC/OC.aspx index a5c5ecb11..e622ac180 100644 --- a/OC/OC.aspx +++ b/OC/OC.aspx @@ -941,7 +941,7 @@ - + @@ -1961,7 +1961,7 @@ Cantidad - + diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb index 440141f5c..3b6988841 100644 --- a/OC/OC.aspx.vb +++ b/OC/OC.aspx.vb @@ -2761,7 +2761,7 @@ Partial Class OC For Each DrInv As DataRow In DtInvOC.FiltraParametros($"CveOrdenCompraDetalle = {dr("CveOrdenCompraDetalle").ToString.ToEntero} AND CveCompraDetalle < 1").Rows DrInvOCDiferencias = DtInvOCDiferencias.NewRow DrInvOCDiferencias("TipoCambioAjuste") = DrInv("TipoCambioAjuste").ToString.ToDouble - DrInvOCDiferencias("Diferencia") = ((dr("Importe").ToString.ToDouble * DrInv("TipoCambioAjuste").ToString.ToDouble) - DrInv("PU").ToString.ToDouble) * DrInv("Cantidad").ToString.ToDouble + DrInvOCDiferencias("Diferencia") = ((dr("Importe").ToString.ToDouble * DrInv("TipoCambioAjuste").ToString.ToDouble) - DrInv("PUOriginal").ToString.ToDouble) * DrInv("Cantidad").ToString.ToDouble DrInvOCDiferencias("CveAlmacen") = DrInv("CveAlmacen").ToString.ToEntero DrInvOCDiferencias("CveOrdenCompraDetalle") = DrInv("CveOrdenCompraDetalle").ToString.ToEntero DrInvOCDiferencias("ImporteMovto") = dr("Importe").ToString.ToDouble * DrInv("TipoCambioAjuste").ToString.ToDouble @@ -2853,14 +2853,11 @@ Partial Class OC IdCtaContableAlmacen = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", $"CveAlmacen = {DrDiferencias("CveAlmacen").ToString.ToEntero}").ToEntero If DiferenciaInvOC.RoundSQL() <> 0 Then + Dim tCveSubProyecto As Integer = 0 If CvePrePoliza > 0 Then - If DdlSubProyecto.SelectedValue <= 0 Then - Alert("Debe de asignar un sub proyecto o centro de costos.", TipoMensaje.MsgAdvertencia) - TieneError = True - Exit For - End If + tCveSubProyecto = DtDetalle.FiltroPrimeroValor("CveSubProyecto", "CveOrdenCompraDetalle =" & CveOCDetalle).ToEntero If DdlMoneda.SelectedValue.ToEntero <> 1 And UsuarioActual.CveEmpresa.Contiene(119) Then ImporteME = (DiferenciaInvOC / TCInvOC).RoundSQL() @@ -2877,7 +2874,7 @@ Partial Class OC ' Exit For 'End If - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, -DiferenciaInvOC, SerieFolio, 177, SerieFolio, Fecha, IdCtaContableRecepcionOCER, -1, CveProveedor:=CveProveedor, CveMovimientoAlmacen:=CveMovimientoAlmacen, CveOC:=CveOrdenCompra, ImporteMX:=-DiferenciaInvOC, CveOCDetalle:=CveOCDetalle, CveSubProyecto:=DdlSubProyecto.SelectedValue.ToEntero) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, -DiferenciaInvOC, SerieFolio, 177, SerieFolio, Fecha, IdCtaContableRecepcionOCER, -1, CveProveedor:=CveProveedor, CveMovimientoAlmacen:=CveMovimientoAlmacen, CveOC:=CveOrdenCompra, ImporteMX:=-DiferenciaInvOC, CveOCDetalle:=CveOCDetalle, CveSubProyecto:=tCveSubProyecto) Then TieneError = True Exit For End If @@ -2895,7 +2892,7 @@ Partial Class OC '2018.11.24 se cambia concepto 176, de cargo a abono negativo., petición MALL '2019.03.26 se cambia concepto 177, de abono a cargo., petición MALL '2019.04.10 se cambia concepto 177, de cargo a abono., petición MALL - If ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, -DiferenciaInvOC, SerieFolio, If(ConceptoSalida = 0, 177, 177), SerieFolio, Fecha, IdCtaContableRecepcionOCER, -1, CveProveedor:=CveProveedor, CveMovimientoAlmacen:=CveMovimientoAlmacen, CveOC:=CveOrdenCompra, ImporteMX:=-DiferenciaInvOC, CveOCDetalle:=CveOCDetalle, CveSubProyecto:=DdlSubProyecto.SelectedValue.ToEntero) Then + If ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, -DiferenciaInvOC, SerieFolio, If(ConceptoSalida = 0, 177, 177), SerieFolio, Fecha, IdCtaContableRecepcionOCER, -1, CveProveedor:=CveProveedor, CveMovimientoAlmacen:=CveMovimientoAlmacen, CveOC:=CveOrdenCompra, ImporteMX:=-DiferenciaInvOC, CveOCDetalle:=CveOCDetalle, CveSubProyecto:=tCveSubProyecto) Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, DiferenciaInvOC, SerieFolio, 176, SerieFolio, Fecha, IdCtaContableRecepcionOC, -1, CveProveedor:=CveProveedor, CveMovimientoAlmacen:=CveMovimientoAlmacen, CveOC:=CveOrdenCompra, ImporteMX:=DiferenciaInvOC, CveOCDetalle:=CveOCDetalle) Then TieneError = True Exit For @@ -3551,8 +3548,11 @@ Partial Class OC If e.Row.RowType = DataControlRowType.DataRow Then Try - e.Row.FCLabel("LtlCantidad").Attributes.Add("data-toggle", "tooltip") - e.Row.FCLabel("LtlCantidad").Attributes.Add("Title", e.Row.DataKey("CveOrdenCompraDetalle")) + If e.Row.FCLabel("LtlCantidad") IsNot Nothing Then + e.Row.FCLabel("LtlCantidad").Attributes.Add("data-toggle", "tooltip") + e.Row.FCLabel("LtlCantidad").Attributes.Add("Title", e.Row.DataKey("CveOrdenCompraDetalle")) + End If + Catch ex As Exception End Try @@ -3749,7 +3749,7 @@ Partial Class OC - If UsuarioActual.Empresa.Funcionalidad(590).ToString.ToEntero = 1 Then + If UsuarioActual.Empresa.Funcionalidad(590).ToString.ToEntero = 1 Then 'empresa agricola e.Row.FCDropDownList("DdlCultivosCuadroEdit").Visible = True e.Row.FCDropDownList("DdlCultivosCuadroEdit").DataSource = GlobalDTCultivosCuadro(UsuarioActual.CveEmpresa).FiltraParametros($"CveSubProyecto = {e.Row.DBCampo("CveSubProyecto").ToEntero}") e.Row.FCDropDownList("DdlCultivosCuadroEdit").DataBind() @@ -3871,7 +3871,11 @@ Partial Class OC CveCultivoCuadroDetalle = gvr.FCDropDownList("DdlCultivosCuadroEdit").SelectedValue.ToEntero - Cuadro = gvr.FCDropDownList("DdlCultivosCuadroEdit").SelectedItem.Text + Cuadro = "" + If CveCultivoCuadroDetalle > 0 Then + Cuadro = gvr.FCDropDownList("DdlCultivosCuadroEdit").SelectedItem.Text + End If + If UsuarioActual.Empresa.Tipo_CentroCosto = 1 Or UsuarioActual.Empresa.Tipo_CentroCosto = 2 Then From 029557c9496f73c269a019baffbaf18f176d6244 Mon Sep 17 00:00:00 2001 From: rrene Date: Mon, 4 Jan 2021 11:59:47 -0700 Subject: [PATCH 19/22] coreccion de proyecto asignado --- Contratos/Contrato.aspx.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Contratos/Contrato.aspx.vb b/Contratos/Contrato.aspx.vb index fb51b55b5..1653e71d9 100644 --- a/Contratos/Contrato.aspx.vb +++ b/Contratos/Contrato.aspx.vb @@ -1048,7 +1048,7 @@ Partial Class Contratos_Default TxtPorAnticipo.Text = ObjContratos.PorAmortizacionAnticipo.FormatoNumero TxtPorAmortizacionAnticipo.Text = ObjContratos.PorAmortizacionAnticipo.FormatoNumero TxtPorGarantia.Text = ObjContratos.PorGarantia.FormatoNumero - DdlProyecto.SelectedValue = ObjContratos.CveProyecto.ToString + 'DdlProyecto.SelectedValue = ObjContratos.CveProyecto.ToString CargaSubProyectoContrato(DdlProyecto.SelectedValue.ToEntero) DdlSubProyectoContrato.SelectedValue = ObjContratos.CveSubProyecto.ToString TxtPorIVA.Text = ObjContratos.PorIVA.ToString From 19d906446858493f1d2fa5ff2b9eab2a05fa7eeb Mon Sep 17 00:00:00 2001 From: rrene Date: Mon, 4 Jan 2021 12:00:12 -0700 Subject: [PATCH 20/22] contabilizacion de movimietnos --- Inventarios/ResguardoMaterial.aspx.vb | 31 +++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/Inventarios/ResguardoMaterial.aspx.vb b/Inventarios/ResguardoMaterial.aspx.vb index 320899cee..95743d634 100644 --- a/Inventarios/ResguardoMaterial.aspx.vb +++ b/Inventarios/ResguardoMaterial.aspx.vb @@ -802,6 +802,7 @@ Partial Class Inventarios_ResguardoMaterial Private Sub Guardar(Concepto As Integer) Dim ObjInventario As New ClsInventarios Dim ObjEventos As New ClsOIEventos(ObjInventario.IniciaTransacSQL()) 'Inicia la transacción + Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL()) Dim TieneError = False Dim MensajeError As String = "" Dim ImporteConcepto = 0.0 @@ -854,6 +855,7 @@ Partial Class Inventarios_ResguardoMaterial If Not TieneError Then CveMovimientoEntrada = ObjInventario.AddMovimiento(DdlAlmacenDestino.SelectedValue.ToEntero, 2, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, SubProyecto, ActivoFijo, Observaciones:=TxtObservaciones.Text, CvePersonal:=CvePersonal, CveMovimientoRelacionado:=CveMovimientoSalida, CveCliente:=CveCliente, CveProveedor:=CveProveedor, Modulo:="ResgMat2") FolioEntrada = ObjInventario.Folio + Dim Importe As Decimal = 0 If CveMovimientoEntrada <= 0 Then MensajeError = "Ocurrió un error al guardar el movimiento de entrada correctamente. Por favor vuelva a intentar." @@ -862,6 +864,7 @@ Partial Class Inventarios_ResguardoMaterial If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then Dim CveSeccionAlmacen As Integer = 0 + Importe = ObjInventario.DtResultados.SUMD("Total").RoundSQL For Each Dr As DataRow In ObjInventario.DtResultados.Rows If CBool(Dr("AplicaSeccion")) Then CveSeccionAlmacen = GlobalDTInvPSSeccionesAlmacen(UsuarioActual.CveEmpresa, DdlAlmacenDestino.SelectedValue.ToEntero, Dr("CvePS").ToString.ToEntero).FiltroPrimeroValor("CveSeccionAlmacen").ToEntero @@ -880,6 +883,10 @@ Partial Class Inventarios_ResguardoMaterial Next End If End If + + 'registra la prepoliza + + ContabilizaMovimientoAlmacen(ObjConta, Fecha, "Resguardo", "ResgMat", CveMovimientoSalida, CveMovimientoEntrada, Importe, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False) End If Case 24 'LIBERACION @@ -914,6 +921,7 @@ Partial Class Inventarios_ResguardoMaterial If Not TieneError Then CveMovimientoEntrada = ObjInventario.AddMovimiento(DdlAlmacenDestinoLiberacion.SelectedValue.ToEntero, 23, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, SubProyecto, ActivoFijo, Observaciones:=TxtObservacionesLiberacion.Text, CvePersonal:=CvePersonalLiberacion, CveMovimientoRelacionado:=CveMovimientoSalida, CveProveedor:=CveProveedorLiberacion, CveCliente:=CveClienteLiberacion, MovimientoFijo:=True, Modulo:="ResgMat4") FolioEntrada = ObjInventario.Folio + Dim Importe As Decimal = 0 If CveMovimientoEntrada <= 0 Then MensajeError = "Ocurrió un error al guardar el movimiento de entrada correctamente. Por favor vuelva a intentar." @@ -921,6 +929,7 @@ Partial Class Inventarios_ResguardoMaterial Else If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then Cont = 0 + Importe = ObjInventario.DtResultados.SUMD("Total").RoundSQL For Each Dr As DataRow In ObjInventario.DtResultados.Rows Dim CveSeccionAlmacen As Integer = DiccionarioSecciones(Dr("CveMovimientoDetalle").ToString.ToEntero).ToString.ToEntero If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=CveSeccionAlmacen, Serie:=Dr("Serie").ToString, Observaciones:=Dr("Observaciones").ToString) Then @@ -932,6 +941,9 @@ Partial Class Inventarios_ResguardoMaterial Cont += 1 Next End If + + ContabilizaMovimientoAlmacen(ObjConta, Fecha, "Resguardo", "ResgMat", CveMovimientoSalida, CveMovimientoEntrada, Importe, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False) + End If End If @@ -981,6 +993,25 @@ Partial Class Inventarios_ResguardoMaterial ObjInventario.Dispose() ObjEventos.Dispose() End Sub + + Public Function ContabilizaMovimientoAlmacen(ByRef ObjConta As ClsContabilidad, Fecha As Date, Concepto As String, Modulo As String, CveMovimientoSalida As Integer, CveMovimientoEntrada As Integer, Importe As Decimal, CveUsuario As Integer, CveEmpresa As Integer, Contabilizable As Boolean) As Integer + Dim Retorno As Integer = -1 + Dim ErrorMovInv As Boolean = False + + Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas(Modulo, 53, 0, 0, 1, Fecha, Concepto, CveUsuario, CveEmpresa) + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Importe, "", 68, Concepto, Fecha, -1, -1, CveMovimientoAlmacen:=CveMovimientoSalida, ImporteMX:=Importe, Contabilizable:=Contabilizable) Then + ErrorMovInv = True + End If + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Importe, "", 68, Concepto, Fecha, -1, -1, CveMovimientoAlmacen:=CveMovimientoEntrada, ImporteMX:=Importe, Contabilizable:=Contabilizable) Then + ErrorMovInv = True + End If + + If Not ErrorMovInv Then Retorno = CvePrePoliza + + Return Retorno + End Function + Private Function AgregarAgenda(ByRef ObjEventos As ClsOIEventos, FolioEntrada As Integer, FolioSalida As Integer) As Boolean Dim TieneError As Boolean = False Dim RecurrenciaTipo = 0, Frecuencia = -1, DiasSemana = "-1", Dias = -1, Mes = -1, RecurrenciaFin = "-1", CveAgendaTipo = 4, Prioridad = 3, CveTipoEvento = 2, Importe = -1 From 9441439c852cb5f71ce2e1dbcb15a654ef722d74 Mon Sep 17 00:00:00 2001 From: rrene Date: Mon, 4 Jan 2021 12:00:43 -0700 Subject: [PATCH 21/22] -- cambios temporales --- App_Code/ClsInventarios.vb | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index b89221914..e4bdd741e 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -5252,6 +5252,30 @@ Public Class ClsInventarios Return Retorno End Function + + 'Public Function GetMovimientosDetalleTransitorio(CveMovimiento As Integer, CveEmpresa As Integer) As Boolean + ' Dim Retorno As Boolean = False + ' DataAdapter(" + ' select t.FechaMovto, t.CveMovimiento, d.CvePS, d.Cantidad, d.PUOriginal,d.CveUM, dm.CveMovimiento, db.CveMovimientoDetalle from ( + ' select * from Inv_Movimientos m where CveConcepto = 27 and CveEmpresa = @CveEmpresa and + ' m.FechaMovto > '2020/10/01' and m.CveMovimiento = @CveMovimiento and not exists (select * from Conta_PrePolizasDetalle dd where dd.CveMovimientoAlmacen = m.CveMovimiento) + ' ) t left join Inv_MovimientosDetalle d on d.CveMovimiento = t.CveMovimiento left join Inv_MovimientosDetalle dm on dm.CveMovimientoDetalle = d.CveMovimientoDetalleEntrada + ' left join Inv_MovimientosDetalle db on db.CveMovimientoDetalleEntrada = dm.CveMovimientoDetalle and db.CveMovimiento = dm.CveMovimiento + 1 order by db.CveMovimientoDetalle ", CommandType.Text) + + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@CveMovimiento", SqlDbType.Int).Value = CveMovimiento + ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + ' End With + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al obtener los movimientos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + ' End Try + + ' Return Retorno + 'End Function + #Region "Proyeccion" Public Function AddMovimientosProyectados(CvePS As Integer, Cantidad As Decimal, TipoMovto As Integer) As Boolean Dim Retorno As Boolean = False From 3f05fa31b35ef55507e6ab3650ca07a1a881ec12 Mon Sep 17 00:00:00 2001 From: rrene Date: Mon, 4 Jan 2021 13:23:54 -0700 Subject: [PATCH 22/22] -- cambios en recepcion de traspaso --- Inventarios/TraspasoAlmacen.aspx | 2 +- Inventarios/TraspasoAlmacen.aspx.vb | 45 +++++++++++++++-------------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/Inventarios/TraspasoAlmacen.aspx b/Inventarios/TraspasoAlmacen.aspx index 06766458f..eaf48f3d2 100644 --- a/Inventarios/TraspasoAlmacen.aspx +++ b/Inventarios/TraspasoAlmacen.aspx @@ -650,7 +650,7 @@
- + <%-- diff --git a/Inventarios/TraspasoAlmacen.aspx.vb b/Inventarios/TraspasoAlmacen.aspx.vb index 5146a4a86..69e440040 100644 --- a/Inventarios/TraspasoAlmacen.aspx.vb +++ b/Inventarios/TraspasoAlmacen.aspx.vb @@ -1532,7 +1532,7 @@ Partial Class Inventarios_TraspasoAlmacen If Dtt IsNot Nothing Then If TxtFolioRecepcion.Text.Trim <> "" Then - CveMovimientoSalida = ObjInventarios.DtResultados.FiltroPrimeroValor("CveMovimiento", "").ToEntero + CveMovimientoSalida = Dtt.FiltroPrimeroValor("CveMovimiento", "").ToEntero End If CveAlmacenDestino = DdlAlmacenRecepcion.SelectedValue.ToEntero @@ -1810,6 +1810,7 @@ Partial Class Inventarios_TraspasoAlmacen Dim ObjInventario As New ClsInventarios Dim Dtt As DataTable = Nothing Dim CveMovimientoEntrada As Integer = 0 + Dim CveMovimientoSalidaTransitorio As Integer = 0 Dim Folio = 0 Dim ErrorMovInv As Boolean = False Dim TextoError = "" @@ -1845,15 +1846,15 @@ Partial Class Inventarios_TraspasoAlmacen 'AGREGAMOS LA SALIDA - 'CveMovimientoSalida = ObjInventario.AddMovimiento(CveAlmacenSalida, 8, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, - ' Observaciones:=TxtObservacionesRecepcion.Text.Trim, CveAlmacenDestino:=GvDatosRecepcion.Rows(0).DataKey("CveAlmacenSalida").ToEntero, Modulo:="TA/G11") + CveMovimientoSalidaTransitorio = ObjInventario.AddMovimiento(CveAlmacenSalida, 8, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, + Observaciones:=TxtObservacionesRecepcion.Text.Trim, CveAlmacenDestino:=GvDatosRecepcion.Rows(0).DataKey("CveAlmacenSalida").ToEntero, Modulo:="TA/G11") 'AGREGAMOS LA ENTRADA CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacenEntrada, 27, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservacionesRecepcion.Text.Trim, CveAlmacenDestino:=GvDatosRecepcion.Rows(0).DataKey("CveAlmacenSalida").ToEntero, CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="TA/G1") Folio = ObjInventario.Folio - If CveMovimientoSalida <= 0 Then + If CveMovimientoSalidaTransitorio <= 0 Then TextoError = "No se pudo generar el movimiento de salida correctamente" ErrorMovInv = True Else @@ -1887,12 +1888,12 @@ Partial Class Inventarios_TraspasoAlmacen TextoError = "Ocurrió un error al guardar los movimientos de salida" Exit For End If - ''MOV, Alm, Transito - 'If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal, gvr.DataKey("CveUM").ToString.ToEntero, gvr.DataKey("CvePS").ToString.ToEntero, PrecioEntrada, CveAF:=gvr.DataKey("CveAF").ToString.ToEntero, CveSeccionAlmacen:=gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero, Serie:=gvr.DataKey("Serie").ToString, Lote:=gvr.DataKey("Lote").ToString, FechaCaducidad:=gvr.DataKey("FechaCaducidad").ToDate, CveMovimientoDetalleEntrada:=CveMovimientoDetalleEntrada) Then - ' ErrorMovInv = True - ' TextoError = "Ocurrió un error al guardar los movimientos de salida" - ' Exit For - 'End If + 'MOV, Alm, Transito + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaTransitorio, gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal, gvr.DataKey("CveUM").ToString.ToEntero, gvr.DataKey("CvePS").ToString.ToEntero, PrecioEntrada, CveAF:=gvr.DataKey("CveAF").ToString.ToEntero, CveSeccionAlmacen:=gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero, Serie:=gvr.DataKey("Serie").ToString, Lote:=gvr.DataKey("Lote").ToString, FechaCaducidad:=gvr.DataKey("FechaCaducidad").ToDate, CveMovimientoDetalleEntrada:=gvr.DataKey("CveMovimientoDetalleTransitorio").ToString.ToEntero) Then + ErrorMovInv = True + TextoError = "Ocurrió un error al guardar los movimientos de salida" + Exit For + End If ElseIf cantidadDisponibleValidacion < 0 Then TextoError = String.Format("Se exceden la cantidad disponibles para {0}", gvr.DataKey("PS").ToString) @@ -1903,21 +1904,21 @@ Partial Class Inventarios_TraspasoAlmacen If Not ErrorMovInv Then Dim Concepto As String = TxtObservacionesRecepcion.Text If Concepto = "" Then Concepto = "Recepción Traspaso" - 'Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inventario/TraspasoAlmacen", 53, 0, 0, 1, Fecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - 'If ObjInventario.GetMovimientosDetalle(CveMovimientoEntrada, UsuarioActual.CveEmpresa) Then + Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inventario/TraspasoAlmacen", 53, 0, 0, 1, Fecha, Concepto, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + If ObjInventario.GetMovimientosDetalle(CveMovimientoEntrada, UsuarioActual.CveEmpresa) Then - ' Dim resultado As DataTable = ObjInventario.DtResultados - ' Dim importe As Decimal = resultado.SUMD("Total").RoundSQL - ' Dim IdCtaContable As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", DdlAlmacenTransitorioRecepcion.SelectedValue.ToEntero)).ToEntero + Dim resultado As DataTable = ObjInventario.DtResultados + Dim importe As Decimal = resultado.SUMD("Total").RoundSQL + Dim IdCtaContable As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", DdlAlmacenTransitorioRecepcion.SelectedValue.ToEntero)).ToEntero - ' If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoSalida, ImporteMX:=importe, Contabilizable:=False) Then - ' ErrorMovInv = True - ' End If + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoSalidaTransitorio, ImporteMX:=importe, Contabilizable:=False) Then + ErrorMovInv = True + End If - ' If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoEntrada, ImporteMX:=importe, Contabilizable:=False) Then - ' ErrorMovInv = True - ' End If - 'End If + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, importe, TxtObservaciones.Text, 68, TxtObservaciones.Text, Fecha, IdCtaContable, -1, CveMovimientoAlmacen:=CveMovimientoEntrada, ImporteMX:=importe, Contabilizable:=False) Then + ErrorMovInv = True + End If + End If End If End If