diff --git a/Acarreos/CatChoferes.aspx.vb b/Acarreos/CatChoferes.aspx.vb index 9cb694e84..12be6ccc0 100644 --- a/Acarreos/CatChoferes.aspx.vb +++ b/Acarreos/CatChoferes.aspx.vb @@ -212,9 +212,11 @@ Partial Class Acarreos_CatChoferes Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) HdnID.Value = GvRow.DataKey("CveChofer") UpDatos.Update() - If ObjAcar.RemoveChofer(HdnID.Value) Then + If ObjAcar.RemoveChofer(HdnID.Value, UsuarioActual.CveEmpresa) Then CargaDatos() Alert("Eliminado Correctamente.", TipoMensaje.MsgInformacion) + Else + Alert("No se puede eliminar el chofer. verifique que no tenga movimientos registrados.", TipoMensaje.MsgError) End If ObjAcar.Dispose() UpDatos.Update() @@ -312,7 +314,7 @@ Partial Class Acarreos_CatChoferes If CPTxt > 0 And CveColonia > 0 Then Dim CP As Integer = GlobalDTGralColonias("-1", "-1", "-1", CveColonia:=CveColonia).FiltroPrimeroValor("CP", "").ToEntero If CPTxt <> CP Then - Alert("El código postal selecionado es diferente del codigo postal de la Colonia.", TipoMensaje.MsgAdvertencia) + Alert("El código postal seleccionado es diferente del codigo postal de la Colonia.", TipoMensaje.MsgAdvertencia) End If End If End Sub diff --git a/App_Code/ClsAcarreos.vb b/App_Code/ClsAcarreos.vb index 40453e466..b1d38972e 100644 --- a/App_Code/ClsAcarreos.vb +++ b/App_Code/ClsAcarreos.vb @@ -207,26 +207,27 @@ Public Class ClsAcarreos Return Retorno End Function - Public Function RemoveChofer(CveChofer As Integer) As Boolean + Public Function RemoveChofer(CveChofer As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Acar_ChoferesRemove") With SqlAdapter.SelectCommand.Parameters - .Add("@CveChofer", SqlDbType.Int).Value = CveChofer - + .Add("@CveChofer", SqlDbType.Int).Value = CveChofer + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@vRetorno", SqlDbType.Int).Direction = ParameterDirection.Output End With Try SqlAdapter.Fill(Data) - Retorno = True + Retorno = SqlAdapter.SelectCommand.Parameters("@vRetorno").Value.ToString = "1" Catch ex As Exception OnError("Ocurrió un error al eliminar el chofer.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return Retorno - End Function - - + End Function + + #End Region - + #Region "Transportistas" Public Function AddTransportista(Transportista As String, CveUsuario As Integer, CveEmpresa As Integer, CveProveedor As Integer) As Boolean Dim Retorno As Boolean = False diff --git a/App_Code/ClsBancos.vb b/App_Code/ClsBancos.vb index 5c05914f1..3d3f33619 100644 --- a/App_Code/ClsBancos.vb +++ b/App_Code/ClsBancos.vb @@ -3353,8 +3353,8 @@ Public Class ClsBancos Return Retorno End Function - Public Function AddFluctuacionesBitacora(IdPoliza As Integer, Fecha As Date, TipoFluctuacion As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False + Public Function AddFluctuacionesBitacora(IdPoliza As Integer, Fecha As Date, TipoFluctuacion As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Integer + Dim Retorno As Integer = 0 DataAdapter("PA_Banc_FluctuacionesBitacoraAdd") @@ -3364,11 +3364,13 @@ Public Class ClsBancos .Add("@TipoFluctuacion", SqlDbType.SmallInt).Value = TipoFluctuacion .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@vCveFluctuacionBitacora", SqlDbType.Int).Direction = ParameterDirection.Output End With Try SqlAdapter.Fill(Data) - Retorno = True + Retorno = SqlAdapter.SelectCommand.Parameters("@vCveFluctuacionBitacora").Value.ToString.ToEntero + Catch ex As Exception OnError("Ocurrió un error al agregar a la bitacora de Fluctuaciones", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try @@ -3395,6 +3397,52 @@ Public Class ClsBancos Return Retorno End Function + + Public Function UpdateFluctuacionesBitacoraPrePoliza(CvePrePoliza As Integer, TipoFluctuacion As Integer, CveFluctuacionBitacora As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = True + + DataAdapter("PA_Banc_FluctuacionesBitacoraPrePolizaUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePrePoliza", SqlDbType.VarChar).Value = CvePrePoliza + .Add("@TipoFluctuacion", SqlDbType.SmallInt).Value = TipoFluctuacion + .Add("@CveFluctuacionBitacora", SqlDbType.Int).Value = CveFluctuacionBitacora + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + + Catch ex As Exception + OnError("Ocurrió un error al agregar a la bitacora de Fluctuaciones", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function FluctuacionesBitacoraPrePolizaRemove(CvePrePoliza As Integer, TipoFluctuacion As Integer, CveFluctuacionBitacora As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = True + + DataAdapter("PA_Banc_FluctuacionesBitacoraPrePolizaRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePrePoliza", SqlDbType.VarChar).Value = CvePrePoliza + .Add("@TipoFluctuacion", SqlDbType.SmallInt).Value = TipoFluctuacion + .Add("@CveFluctuacionBitacora", SqlDbType.Int).Value = CveFluctuacionBitacora + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + + Catch ex As Exception + OnError("Ocurrió un error al eliminar a la bitacora de Fluctuaciones", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + #End Region #Region "B A N C O S - T A R J E T A S C R E D I T O S" diff --git a/App_Code/ClsMovimientos.vb b/App_Code/ClsMovimientos.vb index f08a19c90..03ccd11b5 100644 --- a/App_Code/ClsMovimientos.vb +++ b/App_Code/ClsMovimientos.vb @@ -1505,7 +1505,7 @@ Public Class ClsMovimientos Optional TipoCambio As Integer = -1, Optional TCEspecifico As Double = 0, Optional CveClienteClasificacion As Integer = -1, Optional EsDistribuidor As Integer = -1, Optional FechaAplicadoI As Date = MinFecha, Optional FechaAplicadoF As Date = MaxFecha, Optional FechaRegistroIEI As Date = MinFecha, Optional FechaRegistroIEF As Date = MaxFecha, - Optional CveCondicionesPago As Integer = -1) As Boolean + Optional CveCondicionesPago As Integer = -1, Optional CveTipoTransaccion As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Vta_RepRecuperacion") With SqlAdapter.SelectCommand.Parameters @@ -1530,6 +1530,7 @@ Public Class ClsMovimientos .Add("@CveClienteClasificacion", SqlDbType.Int).Value = CveClienteClasificacion .Add("@EsDistribuidor", SqlDbType.Int).Value = EsDistribuidor .Add("@CveCondicionesPago", SqlDbType.Int).Value = CveCondicionesPago + .Add("@CveTipoTransaccion", SqlDbType.Int).Value = CveTipoTransaccion .Add("@FechaAplicadoI", SqlDbType.Date).Value = FechaAplicadoI.ToShortDateString .Add("@FechaAplicadoF", SqlDbType.Date).Value = FechaAplicadoF.ToShortDateString @@ -1590,7 +1591,8 @@ Public Class ClsMovimientos Optional TipoCambio As Integer = -1, Optional TCEspecifico As Double = 0, Optional CveMoneda As Integer = -1, Optional CveClienteClasificacion As Integer = -1, Optional Tipo As Integer = -1, Optional EsDistribuidor As Integer = -1, Optional FechaAplicadoI As Date = Nothing, Optional FechaAplicadoF As Date = Nothing, - Optional FechaRegistroIEI As Date = MinFecha, Optional FechaRegistroIEF As Date = MaxFecha) As Boolean + Optional FechaRegistroIEI As Date = MinFecha, Optional FechaRegistroIEF As Date = MaxFecha, + Optional CveCondicionesPago As Integer = -1, Optional CveTipoTransaccion As Integer = -1) As Boolean Dim Retorno As Boolean = False @@ -1620,6 +1622,8 @@ Public Class ClsMovimientos .Add("@CveClienteClasificacion", SqlDbType.Int).Value = CveClienteClasificacion .Add("@Tipo", SqlDbType.Int).Value = Tipo .Add("@EsDistribuidor", SqlDbType.Int).Value = EsDistribuidor + .Add("@CveCondicionesPago", SqlDbType.Int).Value = CveCondicionesPago + .Add("@CveTipoTransaccion", SqlDbType.Int).Value = CveTipoTransaccion .Add("@FechaAplicadoI", SqlDbType.Date).Value = FechaAplicadoI.ToShortDateString .Add("@FechaAplicadoF", SqlDbType.Date).Value = FechaAplicadoF.ToShortDateString diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 4cd08b3e3..469a026bf 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -7554,11 +7554,12 @@ Public Class ClsPaginas If Dr("EstadoDestino").ToString.Length > 0 Then SBDireccionD.AppendFormat(", Edo: {0}", Dr("EstadoDestino").ToString) If Dr("PaisDestino").ToString.Length > 0 Then SBDireccionD.AppendFormat(", País: {0}", Dr("PaisDestino").ToString) End If + + + End If - params.Add(New ReportParameter("Chofer", Dr("Chofer").ToString)) - params.Add(New ReportParameter("Placa", Dr("Placa").ToString)) - params.Add(New ReportParameter("EspecifUnidad", Dr("Especificacion").ToString)) + End If End If diff --git a/App_Code/Timbrado.vb b/App_Code/Timbrado.vb index 95cad2ac0..d11401ed9 100644 --- a/App_Code/Timbrado.vb +++ b/App_Code/Timbrado.vb @@ -20,7 +20,7 @@ Public Class Timbrado Public Property CancelacionState As Integer Public Property CancelacionMensaje As String Public Property CancelacionFecha As Date - + Public Const LigaVerificacionSAT = "https://verificacfdi.facturaelectronica.sat.gob.mx/default.aspx" Public Class AcuseCancelacionSAT Public Property CodigoEstatus As String @@ -1956,8 +1956,9 @@ Public Class Timbrado If Not IO.Directory.Exists($"{UsuarioActual.Empresa.Ruta}CBB\") Then IO.Directory.CreateDirectory($"{UsuarioActual.Empresa.Ruta}CBB\") Dim RutaCBB As String = $"{UsuarioActual.Empresa.Ruta}CBB\{ObjCFDITimbre.Comprobante.SerieFolio}.jpg" - Dim b As Byte() = cfdi.ConvertirQrCode($"?re={UsuarioActual.Empresa.RFC}&rr={ObjCFDITimbre.Receptor.RFC}&tt={String.Format("{0,12:F6}", ObjCFDITimbre.Comprobante.Total).Trim()}&id={FolioFiscal}") - File.WriteAllBytes(RutaCBB, b) + Dim CBB As New ClbNegBICFDv3_2.ClsNegCBBGenerar() + CBB.GenerarCBB(UsuarioActual.Empresa.RFC, ObjCFDITimbre.Receptor.RFC, ObjCFDITimbre.Comprobante.Total, FolioFiscal, RutaCBB) + CBB = Nothing Retorno = "" Else @@ -2342,7 +2343,7 @@ Public Class Timbrado cfdi.CartaPorteMercancias(Carta.Mercancias.PesoBrutoTotal, Carta.Mercancias.UnidadPeso, Carta.Mercancias.PesoNetoTotal, Carta.Mercancias.NumTotalMercancias, Carta.Mercancias.CargoporTasacion) If Carta.Mercancias IsNot Nothing AndAlso Carta.Mercancias.Mercancias.Count > 0 Then For Each concep As CFDICartaPorteMercancia In Carta.Mercancias.Mercancias - cfdi.CartaPorteMercancia(concep.BienesTransp, concep.ClaveSTCC, concep.Descripción, concep.Cantidad, concep.ClaveUnidad, concep.Unidad, concep.Dimensiones, concep.MaterialPeligroso, concep.ClaveMaterialPeligroso, If(concep.ClaveMaterialPeligroso <> "", concep.Embalaje, ""), concep.DescripEmbalaje, concep.PesoenKg, concep.ValorMercancia, concep.Moneda, concep.FraccionArrancelaria, concep.UUIDComercioExt) + cfdi.CartaPorteMercancia(concep.BienesTransp, concep.ClaveSTCC, concep.Descripción, concep.Cantidad, concep.ClaveUnidad, concep.Unidad, concep.Dimensiones, concep.MaterialPeligroso, concep.ClaveMaterialPeligroso, If(concep.ClaveMaterialPeligroso <> "", concep.Embalaje, ""), If(concep.ClaveMaterialPeligroso <> "", concep.DescripEmbalaje, ""), concep.PesoenKg, concep.ValorMercancia, concep.Moneda, concep.FraccionArrancelaria, concep.UUIDComercioExt) For Each transp In concep.MercanciasCantidadTransporta cfdi.CartaPorteCantidadTransporta(transp.Cantidad, transp.IDOrigen, transp.IDDestino, transp.CvesTransportes) Next @@ -2665,8 +2666,9 @@ Public Class Timbrado Try Dim RutaCBB As String = $"{UsuarioActual.Empresa.Ruta}CBB\{ObjCFDITimbre.Comprobante.SerieFolio}.jpg" - Dim b As Byte() = cfdi.QrCode($"?re={UsuarioActual.Empresa.RFC}&rr={ObjCFDITimbre.Receptor.RFC}&tt={String.Format("{0,12:F6}", ObjCFDITimbre.Comprobante.Total).Trim()}&id={FolioFiscal}") - File.WriteAllBytes(RutaCBB, b) + Dim bCBB As Byte() = cfdi.QrCode($"{LigaVerificacionSAT}?re={UsuarioActual.Empresa.RFC}&rr={ObjCFDITimbre.Receptor.RFC}&tt={String.Format("{0,12:F6}", ObjCFDITimbre.Comprobante.Total).Trim()}&id={FolioFiscal}&fe=ELleDg==") + File.WriteAllBytes(RutaCBB, bCBB) + bCBB = Nothing Catch ex As Exception OnError("Ocurrió un error al generar el QR", ex) End Try @@ -3268,8 +3270,9 @@ Public Class Timbrado Try Dim RutaCBB As String = $"{UsuarioActual.Empresa.Ruta}CBB\{ObjCFDITimbre.Comprobante.SerieFolio}.jpg" - Dim b As Byte() = cfdi.QrCode($"?re={UsuarioActual.Empresa.RFC}&rr={ObjCFDITimbre.Receptor.RFC}&tt={String.Format("{0,12:F6}", ObjCFDITimbre.Comprobante.Total).Trim()}&id={FolioFiscal}") - File.WriteAllBytes(RutaCBB, b) + Dim CBB As New ClbNegBICFDv3_2.ClsNegCBBGenerar() + CBB.GenerarCBB(UsuarioActual.Empresa.RFC, ObjCFDITimbre.Receptor.RFC, ObjCFDITimbre.Comprobante.Total, FolioFiscal, RutaCBB) + CBB = Nothing Catch ex As Exception OnError("Ocurrió un error al generar el QR", ex) End Try @@ -3684,7 +3687,7 @@ Public Class Timbrado cfdi.CartaPorteMercancias(Carta.Mercancias.PesoBrutoTotal, Carta.Mercancias.UnidadPeso, Carta.Mercancias.PesoNetoTotal, Carta.Mercancias.NumTotalMercancias, Carta.Mercancias.CargoporTasacion) If Carta.Mercancias IsNot Nothing AndAlso Carta.Mercancias.Mercancias.Count > 0 Then For Each concep As CFDICartaPorteMercancia In Carta.Mercancias.Mercancias - cfdi.CartaPorteMercancia(concep.BienesTransp, concep.ClaveSTCC, concep.Descripción, concep.Cantidad, concep.ClaveUnidad, concep.Unidad, concep.Dimensiones, concep.MaterialPeligroso, concep.ClaveMaterialPeligroso, If(concep.ClaveMaterialPeligroso <> "", concep.Embalaje, ""), concep.DescripEmbalaje, concep.PesoenKg, concep.ValorMercancia, concep.Moneda, concep.FraccionArrancelaria, concep.UUIDComercioExt) + cfdi.CartaPorteMercancia(concep.BienesTransp, concep.ClaveSTCC, concep.Descripción, concep.Cantidad, concep.ClaveUnidad, concep.Unidad, concep.Dimensiones, concep.MaterialPeligroso, concep.ClaveMaterialPeligroso, If(concep.ClaveMaterialPeligroso <> "", concep.Embalaje, ""), If(concep.ClaveMaterialPeligroso <> "", concep.DescripEmbalaje, ""), concep.PesoenKg, concep.ValorMercancia, concep.Moneda, concep.FraccionArrancelaria, concep.UUIDComercioExt) For Each transp In concep.MercanciasCantidadTransporta cfdi.CartaPorteCantidadTransporta(transp.Cantidad, transp.IDOrigen, transp.IDDestino, transp.CvesTransportes) Next diff --git a/Bancos/DepositosCaja.aspx b/Bancos/DepositosCaja.aspx index accb3c4ed..959d3de1b 100644 --- a/Bancos/DepositosCaja.aspx +++ b/Bancos/DepositosCaja.aspx @@ -416,13 +416,19 @@ comisionNegativa = txtcomision * -1; } if (comisionNegativa > saldo) { - $('#C_TxtComision').val(0); - comision = 0; - descuento = 0; - txtcomision = 0; - alert("No es posible poner un importe Faltante/Sobrante superior a lo seleccionado"); - saldo = 0; - $('#C_lblValorTotal').text(FormatoNumero(ValorTotalSeleccionado, 2)); + + //var opcion = confirm("El importe especificado es superior a lo seleccionado, está seguro?"); + //if (opcion != true) { + // debugger; + // $('#C_TxtComision').val(0); + // comision = 0; + // descuento = 0; + // txtcomision = 0; + // //alert("No es posible poner un importe Faltante/Sobrante superior a lo seleccionado"); + // saldo = 0; + // $('#C_lblValorTotal').text(FormatoNumero(ValorTotalSeleccionado, 2)); + //} + } else { //debugger; @@ -509,14 +515,18 @@ if (comision2 < 0) { comisionNegativa = comision2 * -1; } - if (comisionNegativa > ValorTotalSeleccionado) { - $('#C_TxtComision').val(0) - alert("No es posible poner una comision superior a lo seleccionado") - } else { + //if (comisionNegativa > ValorTotalSeleccionado) { + // var opcion = confirm("El importe especificado es superior a lo seleccionado, está seguro?"); + // if (opcion != true) { + // debugger; + // $('#C_TxtComision').val(0) + // // alert("No es posible poner una comision superior a lo seleccionado") + // } + //} else { saldo = ValorTotalSeleccionado + comision2 + descuento - IVA - ComisionIntermediario; $('#C_lblValorTotal').text(FormatoNumero(saldo, 2)); comision = ToDouble($('#C_TxtComision').val()) - } + //} } diff --git a/Bancos/DepositosCaja.aspx.vb b/Bancos/DepositosCaja.aspx.vb index da29b34eb..dc9c99b5c 100644 --- a/Bancos/DepositosCaja.aspx.vb +++ b/Bancos/DepositosCaja.aspx.vb @@ -236,17 +236,21 @@ Partial Class Bancos_DepositosCaja End If End If + Dim CveTransaccionBanco As Integer = 13 + + If TotalImporte < 0 Then 'que es una devolución, entonces como es negativo, se cambia el concetpo de bancos, por condición de trigger + CveTransaccionBanco = 6 + End If 'Entrada a bancos - FolioIE = ObjBancos.GetNextFolio(DdlCuentaDeposito.SelectedValue.ToEntero, 13) + FolioIE = ObjBancos.GetNextFolio(DdlCuentaDeposito.SelectedValue.ToEntero, CveTransaccionBanco) If Not FolioIE > 0 Then OcurrioError = True End If - CveIEOrigen = ObjBancos.AddBancos_IE(DdlCuentaDeposito.SelectedValue.ToEntero, 13, Fecha, FolioIE.ToString, "Depósito Bancario", TotalImporte, CveMoneda, 1, "Depósito Bancario", "", False, False, -1, NuevaCvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveProveedorIntermediario:=CveProveedorIntermediario) - - documentos += String.Format("Depósito: {1}    
", CveIEOrigen, FolioIE) - + CveIEOrigen = ObjBancos.AddBancos_IE(DdlCuentaDeposito.SelectedValue.ToEntero, CveTransaccionBanco, Fecha, FolioIE.ToString, "Depósito Bancario", TotalImporte, CveMoneda, 1, "Depósito Bancario", "", False, False, -1, NuevaCvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveProveedorIntermediario:=CveProveedorIntermediario) + documentos += String.Format("Depósito: {1}    
", CveIEOrigen, FolioIE) + If ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, False, TotalImporte, "Depósito Bancario", 30, "Depósito Bancario", Fecha, IdCuentaBancariaOrigen, -1, CveClasificacion:=CveClasificacion, CveSubProyecto:=CveSubProyecto, CveIE:=CveIEOrigen, ImporteMX:=TotalImporte * TipoCambio) Then If ChkFaltante.Checked Then @@ -256,9 +260,7 @@ Partial Class Bancos_DepositosCaja If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, True, Comision, DdlClasificacion.SelectedItem.Text, 51, DdlClasificacion.SelectedItem.Text, Fecha, IdCuentaBancariaOrigen, -1, CveClasificacion:=CveClasificacionComision, CveSubProyecto:=CveSubProyectoComision, ImporteMX:=Comision * TipoCambio) Then OcurrioError = True End If - End If - - + End If End If If ChkDescuento.Checked Then @@ -268,68 +270,64 @@ Partial Class Bancos_DepositosCaja If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, False, Descuento, DdlClasificacionDescuento.SelectedItem.Text, 51, DdlClasificacionDescuento.SelectedItem.Text & " " & DdlPersonal.SelectedItem.Text, Fecha, IdCuentaBancariaOrigen, -1, CveClasificacion:=CveClasificacionDescuento, CveSubProyecto:=CveSubProyectoDescuento, ImporteMX:=Descuento * TipoCambio, CvePersonal:=DdlPersonal.SelectedValue.ToEntero) Then OcurrioError = True End If - End If - - - + End If + Else OcurrioError = True End If - - For Each Gvr As GridViewRow In GvFacturas.Rows - - If Gvr.FCCheckBox("ChkFactura").Checked Then - 'Datos de las Nuevas PrePolizas - 'Entrada a Bancos - - Dim Importe As Decimal = Gvr.DataKey("Importe").ToDecimal - Dim SerieFolio As String = Gvr.DataKey("SerieFolio").ToString - - 'Datos de las Prepolizas A Cancelar - Dim CveIE As Integer = Gvr.DataKey("CveIE").ToEntero - Dim CveVenta As Integer = Gvr.DataKey("CveVenta").ToEntero - Dim CvePrePoliza As Integer = Gvr.DataKey("CvePrePoliza").ToEntero - - FolioIE = ObjBancos.GetNextFolio(DdlCajaChica.SelectedValue.ToEntero, 2) - If Not FolioIE > 0 Then - OcurrioError = True - Exit For - End If - CveIEDestino = ObjBancos.AddBancos_IE(DdlCajaChica.SelectedValue.ToEntero, 2, Fecha, FolioIE.ToString, String.Format("Depósito Bancario: {0}", SerieFolio), Importe, CveMoneda, 1, "Depósito Bancario", "", False, False, -1, NuevaCvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - - - If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, True, Importe, SerieFolio, 30, String.Format("Depósito Bancario: {0}", SerieFolio), Fecha, IdCuentaBancariaDestino, -1, CveClasificacion:=CveClasificacion, CveSubProyecto:=CveSubProyecto, CveVenta:=CveVenta, CveIE:=CveIEDestino, ImporteMX:=Importe * TipoCambio, CveCuenta:=CveCuentaBancariaDestino) Then - OcurrioError = True - Exit For - End If - - 'Asignamos la cuenta Deposito - If Not OcurrioError AndAlso Not ObjBancos.UpdateBancos_IECuentaDeposito(CveIEOrigen, CveIE) Then - OcurrioError = True - Exit For + If Not OcurrioError Then + For Each Gvr As GridViewRow In GvFacturas.Rows + + If Gvr.FCCheckBox("ChkFactura").Checked Then + 'Datos de las Nuevas PrePolizas + 'Entrada a Bancos + + Dim Importe As Decimal = Gvr.DataKey("Importe").ToDecimal + Dim SerieFolio As String = Gvr.DataKey("SerieFolio").ToString + + 'Datos de las Prepolizas A Cancelar + Dim CveIE As Integer = Gvr.DataKey("CveIE").ToEntero + Dim CveVenta As Integer = Gvr.DataKey("CveVenta").ToEntero + Dim CvePrePoliza As Integer = Gvr.DataKey("CvePrePoliza").ToEntero + + FolioIE = ObjBancos.GetNextFolio(DdlCajaChica.SelectedValue.ToEntero, 2) + If Not FolioIE > 0 Then + OcurrioError = True + Exit For + End If + CveIEDestino = ObjBancos.AddBancos_IE(DdlCajaChica.SelectedValue.ToEntero, 2, Fecha, FolioIE.ToString, String.Format("Depósito Bancario: {0}", SerieFolio), Importe, CveMoneda, 1, "Depósito Bancario", "", False, False, -1, NuevaCvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + + + If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, True, Importe, SerieFolio, 30, String.Format("Depósito Bancario: {0}", SerieFolio), Fecha, IdCuentaBancariaDestino, -1, CveClasificacion:=CveClasificacion, CveSubProyecto:=CveSubProyecto, CveVenta:=CveVenta, CveIE:=CveIEDestino, ImporteMX:=Importe * TipoCambio, CveCuenta:=CveCuentaBancariaDestino) Then + OcurrioError = True + Exit For + End If + + 'Asignamos la cuenta Deposito + If Not OcurrioError AndAlso Not ObjBancos.UpdateBancos_IECuentaDeposito(CveIEOrigen, CveIE) Then + OcurrioError = True + Exit For + End If + End If + Next - End If - - Next + Dim StrEncript As String = Encripta($"OP=DC&CveIE={CveIEOrigen}&CuentaCaja={DdlCajaChica.SelectedItem.Text}&CuentaDepo={DdlCuentaDeposito.SelectedItem.Text}") - Dim StrEncript As String = Encripta($"OP=DC&CveIE={CveIEOrigen}&CuentaCaja={DdlCajaChica.SelectedItem.Text}&CuentaDepo={DdlCuentaDeposito.SelectedItem.Text}") + documentos += String.Format("
Imprimir {1}

", StrEncript, "Depósito Bancario") + End If - documentos += String.Format("
Imprimir {1}

", StrEncript, "Depósito Bancario") - If OcurrioError Then ObjContabilidad.RollBack() Alert("Ocurrio un error al realizar los depositos", TipoMensaje.MsgError) Else - ObjContabilidad.Commit() - CargaDatos() - + ObjContabilidad.Commit() documentos += String.Format("Prepóliza

", NuevaCvePrePoliza) - Alert(documentos.ToString) - + Alert(documentos.ToString) + CargaDatos() End If TxtComision.Text = "" diff --git a/Bancos/FluctuacionCambiaria.aspx b/Bancos/FluctuacionCambiaria.aspx index 19dc04717..f161ebbdc 100644 --- a/Bancos/FluctuacionCambiaria.aspx +++ b/Bancos/FluctuacionCambiaria.aspx @@ -151,6 +151,7 @@
+
@@ -159,7 +160,7 @@ - + @@ -222,8 +223,7 @@
- - +
+
+
- - - - +
@@ -267,7 +266,7 @@ <%----%>
- + @@ -308,6 +307,7 @@

+
@@ -322,7 +322,7 @@
- +
@@ -353,7 +353,7 @@
-
+ diff --git a/Bancos/FluctuacionCambiaria.aspx.vb b/Bancos/FluctuacionCambiaria.aspx.vb index a70c0be21..18efa98d4 100644 --- a/Bancos/FluctuacionCambiaria.aspx.vb +++ b/Bancos/FluctuacionCambiaria.aspx.vb @@ -131,6 +131,8 @@ Partial Class Bancos_FluctuacionCambiaria Dim GanaciaAux As Double = Ganancias.SUM("Fluctuacion") Dim Final As Double = GanaciaAux - PerdidaAux + HdnProveedorCvePrePoliza.Value = ObjBancos.DtResultados.MAX("CvePrePoliza").ToString + HdnCveFluctuacionBitacora.Value = ObjBancos.DtResultados.MAX("CveFluctuacionBitacora").ToString IImagenResultado.Attributes("class") = If(Final > 0, "widget-thumb-icon bg-green-jungle fa fa-usd", "widget-thumb-icon bg-red fa fa-usd") @@ -280,8 +282,8 @@ Partial Class Bancos_FluctuacionCambiaria Protected Sub BtnGeneraCompras_Click(sender As Object, e As EventArgs) Dim Total As Decimal = 0 - Dim Conta As New ClsContabilidad - Conta.IniciaTransacSQL() + Dim Conta As New ClsContabilidad + Dim Banco As New ClsBancos(Conta.IniciaTransacSQL()) Dim CvePrePoliza As Integer = Conta.AddPrePolizas("Banc/FluctuaC", 1, 0, 0, 1, FechaUltimoDiaMes, TxtConceptoCompras.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Dim idCta As Integer = 0 @@ -316,7 +318,12 @@ Partial Class Bancos_FluctuacionCambiaria If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), "Fluctuación Compras", CveConceptoContable, "Fluctuación Compras", Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveSubProyecto:=DdlSubProyectoCompras.SelectedValue.ToEntero) Then ErrorRegistrar = True - End If + End If + + 'Dim CveBitacora As Integer = Banco.AddFluctuacionesBitacora(-1, FechaUltimoDiaMes, 1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + 'If CveBitacora <= 0 Then + ' ErrorRegistrar = True + 'End If 'saco las cuentas de pérdida y ganancia @@ -326,18 +333,20 @@ Partial Class Bancos_FluctuacionCambiaria IdCtaComplementaria = gvr.DataKey("IdCtaContComplementaria").ToString().ToEntero() 'movimiento de complementaria - If Not Conta.AddPrePolizasDetalle(CvePrePoliza, False, Total, gvr.DataKey("SerieFolio"), 201, gvr.DataKey("SerieFolio"), Now, IdCtaComplementaria, 0, CveCompra:=gvr.DataKey("CveCompra").ToEntero, TipoCambio:=TC, ImporteMX:=Total, ImporteME:=Total) Then + If Not Conta.AddPrePolizasDetalle(CvePrePoliza, False, Total, gvr.DataKey("SerieFolio"), gvr.DataKey("CveConceptoContable").ToEntero, gvr.DataKey("SerieFolio"), Now, IdCtaComplementaria, 0, CveCompra:=gvr.DataKey("CveCompra").ToEntero, TipoCambio:=TC, TipoCambioPago:=gvr.DataKey("TipoCambio").ToDecimal, ImporteMX:=Total, ImporteME:=Total) Then ErrorRegistrar = True Exit For End If - If Not Conta.UpdateCompraTCValuacion(gvr.DataKey("CveCompra").ToEntero, TCValuacion:=TCUltimaFluctuacion) Then - ErrorRegistrar = True - Exit For - End If + 'If Not Conta.UpdateCompraTCValuacion(gvr.DataKey("CveCompra").ToEntero, TCValuacion:=TCUltimaFluctuacion) Then + ' ErrorRegistrar = True + ' Exit For + 'End If Next + 'Banco.UpdateFluctuacionesBitacoraPrePoliza(CvePrePoliza, 1, CveBitacora, UsuarioActual.CveEmpresa) + If Not ErrorRegistrar Then Conta.Commit() Alert(String.Format("La Fluctuación se ha generado
Ver PrePóliza", CvePrePoliza), TipoMensaje.MsgInformacion) @@ -393,13 +402,17 @@ Partial Class Bancos_FluctuacionCambiaria End If Dim Conta As New ClsContabilidad - Conta.IniciaTransacSQL() + Dim Banco As New ClsBancos(Conta.IniciaTransacSQL()) Dim CvePrePoliza As Integer = Conta.AddPrePolizas("Banc/FluctuaV", 1, 0, 0, 1, FechaUltimoDiaMes, TxtConceptoVentas.Text, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) If Not Conta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Math.Abs(Total), "Fluctuación Ventas", CveConceptoContable, "Fluctuación Ventas", Now, idCta, 0, ImporteMX:=Math.Abs(Total), CveCuenta:=CveCuenta, CveSubProyecto:=DdlsubProyectoVentas.SelectedValue.ToEntero) Then ErrorRegistrar = True End If + If Not Banco.UpdateFluctuacionesBitacoraPrePoliza(CvePrePoliza, 1, HdnCveFluctuacionBitacora.Value.ToEntero, UsuarioActual.CveEmpresa) Then + ErrorRegistrar = True + End If + Dim CveConconceptoCliente As Integer = 203 'saco las cuentas de pérdida y ganancia @@ -414,10 +427,10 @@ Partial Class Bancos_FluctuacionCambiaria CveConconceptoCliente = 203 End If - If Not Conta.UpdateVentaTCValuacion(gvr.DataKey("CveVenta").ToEntero, TCValuacion:=TCUltimaFluctuacion) Then - ErrorRegistrar = True - Exit For - End If + 'If Not Conta.UpdateVentaTCValuacion(gvr.DataKey("CveVenta").ToEntero, TCValuacion:=TCUltimaFluctuacion) Then + ' ErrorRegistrar = True + ' Exit For + 'End If 'movimiento de complementaria If Not Conta.AddPrePolizasDetalle(CvePrePoliza, True, Total, gvr.DataKey("SerieFolio"), CveConconceptoCliente, gvr.DataKey("SerieFolio"), Now, IdCtaComplementaria, 0, CveVenta:=gvr.DataKey("CveVenta").ToEntero, TipoCambio:=TC, ImporteMX:=Total, ImporteME:=Total, CveIE:=gvr.DataKey("CveIE").ToEntero) Then @@ -981,4 +994,13 @@ Partial Class Bancos_FluctuacionCambiaria #End Region + Protected Sub BtnProveedoresRemove_Click(sender As Object, e As EventArgs) + Dim Banco As New ClsBancos + If Not Banco.FluctuacionesBitacoraPrePolizaRemove(HdnProveedorCvePrePoliza.Value.ToEntero, 1, 1, UsuarioActual.CveEmpresa) Then + Alert("Flucturación eliminada.") + End If + Banco.Dispose() + + + End Sub End Class diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 55031430c..85dfd42e1 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -2194,6 +2194,9 @@ Partial Class Compras_Compras DdlRetISRConcepto.Items.Clear() DdlRetISRConcepto.Items.Insert(0, New ListItem("Honorarios", "1")) DdlRetISRConcepto.Items.Insert(1, New ListItem("Arrendamiento", "2")) + If UsuarioActual.CveEmpresa = 119 Then + DdlRetISRConcepto.Items.Insert(1, New ListItem("Resico", "3")) + End If End If UpPS.Update() End Sub @@ -6315,7 +6318,10 @@ Partial Class Compras_Compras funcionalidad = 318 ConceptoContable = 244 ConceptoContableContra = 243 - + ElseIf DdlRetISRConcepto.SelectedValue.ToEntero = 3 Then + funcionalidad = 348 + ConceptoContable = 328 + ConceptoContableContra = 327 End If importeMovimiento = importeRetISRAcreditable @@ -6352,7 +6358,9 @@ Partial Class Compras_Compras ElseIf DdlRetISRConcepto.SelectedValue.ToEntero = 2 Then funcionalidad = 317 ConceptoContable = 243 - + ElseIf DdlRetISRConcepto.SelectedValue.ToEntero = 3 Then + funcionalidad = 348 + ConceptoContable = 327 End If importeMovimiento = importeRetISRxAcreditar importeMN = Math.Round(importeMovimiento, 2) * tipoCambioActual * Multiplicador @@ -6891,24 +6899,34 @@ Partial Class Compras_Compras Dim DiferenciaDevolucion As Decimal = importeMovimiento - TotalRealDevolucion - If Math.Abs(DiferenciaDevolucion) > 0 Then + + If TotalRealDevolucion <> 0 Then + + If Math.Abs(DiferenciaDevolucion) > 0 Then - Dim CveSubProyecto69 As Integer = TmpDT.FiltroPrimeroValor("CveSubProyecto", "CveSubProyecto > 0 ").ToEntero - Dim CveClasificacion69 As Integer = TmpDT.FiltroPrimeroValor("CveClasificacion", "CveClasificacion > 0 ").ToEntero + Dim CveSubProyecto69 As Integer = TmpDT.FiltroPrimeroValor("CveSubProyecto", "CveSubProyecto > 0 ").ToEntero + Dim CveClasificacion69 As Integer = TmpDT.FiltroPrimeroValor("CveClasificacion", "CveClasificacion > 0 ").ToEntero - Dim IdCtaContable69 As Integer = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {CveClasificacion69}").ToString.ToEntero + Dim IdCtaContable69 As Integer = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {CveClasificacion69}").ToString.ToEntero - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, DiferenciaDevolucion, Referencia, 69, Concepto, FechaMovimiento, IdCtaContable69, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, ImporteMX:=DiferenciaDevolucion, ImporteME:=If(tipoCambioActual = 1, 0, DiferenciaDevolucion), TipoCambio:=tipoCambioActual, CveMovimientoAlmacen:=CveMovimientoDevolucion, Contabilizable:=SeContabiliza, CveSubProyecto:=CveSubProyecto69, CveClasificacion:=CveClasificacion69) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, DiferenciaDevolucion, Referencia, 69, Concepto, FechaMovimiento, IdCtaContable69, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, ImporteMX:=DiferenciaDevolucion, ImporteME:=If(tipoCambioActual = 1, 0, DiferenciaDevolucion), TipoCambio:=tipoCambioActual, CveMovimientoAlmacen:=CveMovimientoDevolucion, Contabilizable:=SeContabiliza, CveSubProyecto:=CveSubProyecto69, CveClasificacion:=CveClasificacion69) Then + ErrorPrepoliza = True + End If + End If + + + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, TotalRealDevolucion, Referencia, ConceptoContabilizacionNC, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, ImporteMX:=importeMovimiento * tipoCambioActual, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), TipoCambio:=tipoCambioActual, CveMovimientoAlmacen:=CveMovimientoDevolucion, Contabilizable:=SeContabiliza) Then + ErrorPrepoliza = True + End If + Else + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, ConceptoContabilizacionNC, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, ImporteMX:=importeMovimiento * tipoCambioActual, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), TipoCambio:=tipoCambioActual, CveMovimientoAlmacen:=CveMovimientoDevolucion, Contabilizable:=SeContabiliza) Then ErrorPrepoliza = True End If End If - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, TotalRealDevolucion, Referencia, ConceptoContabilizacionNC, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedorConcepto, ImporteMX:=TotalRealDevolucion, ImporteME:=If(tipoCambioActual = 1, 0, importeMovimiento), TipoCambio:=tipoCambioActual, CveMovimientoAlmacen:=CveMovimientoDevolucion, Contabilizable:=SeContabiliza) Then - ErrorPrepoliza = True - End If End If End If diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb index 726a1ee46..df4a7914f 100644 --- a/Compras/PopUpVerFactura.aspx.vb +++ b/Compras/PopUpVerFactura.aspx.vb @@ -1016,7 +1016,7 @@ Partial Class PopUpVerFactura Private Sub ImprimeFormatoCartaPorte(CveMovimiento As Integer) If CveMovimiento > 0 Then Dim ObjInv As New ClsInventarios - Dim ObjAcar As New ClsAcarreos + Dim SerieFolio As String = "" Dim DomicilioSucursal As String = "" Dim LugarFecha As String = "" @@ -1037,6 +1037,10 @@ Partial Class PopUpVerFactura Dim Ciudad As String = "" Dim Licencia As String = "" + + + + Dim SBDireccionO As New StringBuilder() Dim SBDireccionD As New StringBuilder() @@ -1051,9 +1055,8 @@ Partial Class PopUpVerFactura Destino = Dr("AlmacenDestino").ToString Observaciones = Dr("Observaciones").ToString CveChofer = Dr("CveChofer").ToString - If ObjAcar.GetChofer(CveChofer.ToEntero, UsuarioActual.CveEmpresa, -1, -1) Then - Chofer = ObjAcar.DtResultados.FiltroPrimeroValor("Chofer") - End If + + Placa = Dr("Traslado_Placa").ToString Recibio = Dr("Recibio").ToString FechaEntrega = Dr("FechaEntrega").ToString @@ -1087,10 +1090,18 @@ Partial Class PopUpVerFactura Telefono = Dr("Telefono1").ToString Ciudad = Dr("Ciudad").ToString Licencia = Dr("Licencia").ToString + + + Chofer = Dr("Chofer").ToString + Placa = Dr("Placa").ToString + EspecifUnidad = Dr("Especificacion").ToString + + + End If End If End If - ObjAcar.Dispose() + Dim Dt As DataTable = Nothing If ObjInv.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then @@ -1103,18 +1114,19 @@ Partial Class PopUpVerFactura Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) - 'params.Add(New ReportParameter("LogoPath", If(Imagen.Exists, ImageToBase64(Drawing.Image.FromFile(Imagen.FullName), Drawing.Imaging.ImageFormat.Png), ""))) + Dim LogoRuta As String = String.Format("file://{0}", Imagen.FullName) + + If Imagen.Exists Then - Dim LogoRuta As String = String.Format("file://{0}", Imagen.FullName) params.Add(New ReportParameter("LogoPath", LogoRuta)) - - Else params.Add(New ReportParameter("LogoPath", "")) End If + + params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) @@ -1129,6 +1141,7 @@ Partial Class PopUpVerFactura params.Add(New ReportParameter("Destinatario", "")) params.Add(New ReportParameter("Observaciones", Observaciones)) params.Add(New ReportParameter("Chofer", Chofer)) + params.Add(New ReportParameter("ResponsableRecibio", Chofer)) params.Add(New ReportParameter("Placa", Placa)) params.Add(New ReportParameter("Recibio", Recibio)) params.Add(New ReportParameter("FechaEntrega", FechaEntrega.ToDateTime().ToString("dd/MM/yyyy"))) @@ -1142,6 +1155,7 @@ Partial Class PopUpVerFactura params.Add(New ReportParameter("Telefono", Telefono)) params.Add(New ReportParameter("Ciudad", Ciudad)) params.Add(New ReportParameter("Licencia", Licencia)) + ImprimirPDF("Empresas/Grales/Formatos/CartaPorte.rdlc", Dt, params, String.Format("Carta Porte -{0}", Now.ToDateTime.ToShortDateString)) End If End If diff --git a/OC/OC.aspx.vb b/OC/OC.aspx.vb index b83424a7b..c8ecc8f12 100644 --- a/OC/OC.aspx.vb +++ b/OC/OC.aspx.vb @@ -19,6 +19,14 @@ Partial Class OC ViewState("CveEmpresaActual") = value End Set End Property + Private Property EmpresaActualOC As Empresa + Get + EmpresaActualOC = If(IsNothing(ViewState("EmpresaActualOC")), Nothing, DirectCast(ViewState("EmpresaActualOC"), Empresa)) + End Get + Set(value As Empresa) + ViewState("EmpresaActualOC") = value + End Set + End Property Private Property CveUsuarioAsignado As Integer Get Return If(IsNothing(ViewState("CveUsuarioAsignado")), -1, ViewState("CveUsuarioAsignado").ToString.ToEntero) @@ -584,6 +592,9 @@ Partial Class OC CveProveedorOriginal = -1 'MODALIDAD MULTIEMPRESA CveEmpresaActual = UsuarioActual.CveEmpresa + If CveEmpresaActual > 0 Then + EmpresaActualOC = UsuarioActual.Empresa + End If CargaEstatusUsuariosClasificaciones() TxtObsPS.Attributes.Add("maxlength", "750") @@ -1275,6 +1286,9 @@ Partial Class OC If objOC.GetOC(pCveOrdenCompra, CveEmpresaActual, CveUsuario:=UsuarioActual.CveUsuario) AndAlso objOC.DtResultados.Rows.Count > 0 Then CveEmpresaActual = objOC.CveEmpresa + If CveEmpresaActual > 0 Then + EmpresaActualOC = CreaObjetoEmpresa(CveEmpresaActual) + End If InicializarValores() ViewState("CveOrdenCompra") = pCveOrdenCompra @@ -4956,6 +4970,27 @@ Partial Class OC End Sub + Private Function CreaObjetoEmpresa(CveEmpresa As Integer) As Empresa + Dim Retorno As Empresa = Nothing + + Dim ObjEmpresa As New ClsSisEmpresas() + If ObjEmpresa.GetEmpresas(CveEmpresa, "-1", "-1", "-1", "-1") Then + If ObjEmpresa.GetEmpresasFuncionalidades(CveEmpresa) Then + Dim dttmp As Data.DataTable = ObjEmpresa.DtResultados + + Dim EmpresasFuncionalidades As New HybridDictionary + For Each Row As Data.DataRow In dttmp.Rows + EmpresasFuncionalidades.Add(Convert.ToInt32(Row("CveFuncionalidad")), Row("Valor").ToString) + Next + ObjEmpresa.Empresa.SetFuncionalidades(EmpresasFuncionalidades) + End If + + Retorno = ObjEmpresa.Empresa + End If + ObjEmpresa.Dispose() + + Return Retorno + End Function #Region " GUARDA DIRECTO " Private Sub GuardaBitacora(Optional EsCotizacion As Boolean = False) @@ -4974,7 +5009,12 @@ Partial Class OC If ObjEventoBitacora.AddEventoBitacora(descripcion, String.Format("{0}", FileExtension), UsuarioActual.CveUsuario, CveEmpresaActual, CveOC:=CveOrdenCompra, Prioridad:=Prioridad) Then If Filename <> "" Then - Filename.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("Empresas\{0}\OI", CveEmpresaActual)) + If EmpresaActualOC IsNot Nothing Then + Filename.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("{0}\OI", EmpresaActualOC.Ruta), ConcatenarDirectorioBase:=False) + Else + Filename.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("Empresas\{0}\OI", CveEmpresaActual)) + End If + End If GvEB.DataSource = ObjEventoBitacora.DtResultados @@ -5061,7 +5101,11 @@ Partial Class OC End If If Filename <> "" Then - Filename.FilesMove(String.Format("OI{0}{1}", UsuarioActual.CveUsuario, DtDetalle.Rows.Count), String.Format("Empresas\{0}\OI\Temp", CveEmpresaActual)) + If EmpresaActualOC IsNot Nothing Then + Filename.FilesMove(String.Format("OI{0}{1}", UsuarioActual.CveUsuario, DtDetalle.Rows.Count), String.Format("{0}OI\Temp", EmpresaActualOC.Ruta), ConcatenarDirectorioBase:=False) + Else + Filename.FilesMove(String.Format("OI{0}{1}", UsuarioActual.CveUsuario, DtDetalle.Rows.Count), String.Format("Empresas\{0}\OI\Temp", CveEmpresaActual)) + End If End If diff --git a/Ventas/CatMetasVendedores.aspx b/Ventas/CatMetasVendedores.aspx index e502470b9..f4a31b5c6 100644 --- a/Ventas/CatMetasVendedores.aspx +++ b/Ventas/CatMetasVendedores.aspx @@ -70,7 +70,7 @@
- + @@ -122,7 +122,7 @@ - + @@ -132,9 +132,9 @@ - + - + diff --git a/Ventas/CatMetasVendedores.aspx.vb b/Ventas/CatMetasVendedores.aspx.vb index ac1883e6e..f7e55c204 100644 --- a/Ventas/CatMetasVendedores.aspx.vb +++ b/Ventas/CatMetasVendedores.aspx.vb @@ -15,6 +15,7 @@ Partial Class CatMetasVendedores Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then + txtMesAnio.Text = Now.FirstDayOfMonth.ToShortDateString CargaDatosModal() CargaCombos() CargaDatos() @@ -87,7 +88,7 @@ Partial Class CatMetasVendedores Dim ObjVentas As New ClsVentas If BtnAgregarMetaVendedor.Text = "Agregar" Then If ObjVentas.AddMetasVendedores(DdlVendedores.SelectedValue.ToEntero, TxtFechaI.Text, DdlMarcas.SelectedValue.ToEntero, TxtMetaCantidad.Text.ToEntero, - TxtMetaImporte.Text.ToDecimal, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacionSup.SelectedValue.ToEntero) Then + TxtMetaImporte.Text.ToDecimal, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacionSup.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then Alert("Se agregó la meta al vendedor") Else Alert("No se pudo agregar la meta al vendedor", TipoMensaje.MsgError) @@ -279,105 +280,75 @@ Partial Class CatMetasVendedores Dim ProductosNoCargados As New StringBuilder() Dim RowsCargados As Integer = 0 Dim RowsNoCargados As Integer = 0 - Dim ObjMetas As New ClsVentas - 'ObjPS.IniciaTransacSQL() + Dim ObjMetas As New ClsVentas + Dim Correcto As Boolean = True + ObjMetas.IniciaTransacSQL() Try Dim DtVendedores As DataTable = GlobalDTVendedores(UsuarioActual.CveEmpresa) Dim DtClasificaciones As DataTable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) - Dim DtClasificaciones2 As DataTable = GlobalDTClasificaciones2(UsuarioActual.CveEmpresa) - - For Each row As DataRow In dt.Rows - Dim Correcto As Boolean = False - Dim TieneError As Boolean = False - Dim CveVendedor As Integer = DtVendedores.FiltroPrimeroValor("CveVendedor", String.Format("Vendedor LIKE '%{0}%'", row("Vendedor").ToString().TrimStart().TrimEnd())).ToEntero - Dim CveClasificacion As Integer = DtClasificaciones.FiltroPrimeroValor("CveClasificacion", String.Format("Clasificacion='{0}'", row("Clasificación Superior").ToString().TrimStart().TrimEnd())).ToEntero - Dim CveClasificacion2 As Integer = DtClasificaciones2.FiltroPrimeroValor("CveClasificacion", String.Format("Clasificacion='{0}'", row("Clasificación").ToString().TrimStart().TrimEnd())).ToEntero - Dim CveMarca As Integer = DtMarcas.FiltroPrimeroValor("CveMarca", String.Format("Marca='{0}'", row("Marca").ToString().TrimStart().TrimEnd())).ToEntero - - Dim Mes As Decimal = row("Mes").ToString().ToDecimal() - Dim Anio As Decimal = row("Año").ToString().ToDecimal() - Dim Cantidad As Decimal = row("Cantidad").ToString().ToDecimal() - Dim Importe As Decimal = row("Importe").ToString().ToDecimal() - - Dim FechaRef As New DateTime(Anio, Mes, 1) - If CveVendedor > 0 AndAlso CveVendedor > 0 AndAlso CveClasificacion > 0 AndAlso CveClasificacion2 > 0 AndAlso CveMarca > 0 Then - Correcto = ObjMetas.AddMetasVendedores(CveVendedor, FechaRef, CveMarca, Cantidad, Importe, CveClasificacion2, CveClasificacion) - If Correcto Then - RowsCargados += 1 - End If - End If - - If Not Correcto Then - RowsNoCargados += 1 - End If + Dim DtClasificaciones2 As DataTable = GlobalDTClasificaciones2(UsuarioActual.CveEmpresa) + + + For Each row As DataRow In dt.Rows + + If Correcto Then + Dim TieneError As Boolean = False + Dim CveVendedor As Integer = DtVendedores.FiltroPrimeroValor("CveVendedor", String.Format("trim(Vendedor) LIKE '%{0}%'", row("Vendedor").ToString().TrimStart().TrimEnd())).ToEntero + Dim CveClasificacion As Integer = DtClasificaciones.FiltroPrimeroValor("CveClasificacion", String.Format("trim(Clasificacion)='{0}'", row("Clasificación Superior").ToString().TrimStart().TrimEnd())).ToEntero + Dim CveClasificacion2 As Integer = DtClasificaciones2.FiltroPrimeroValor("CveClasificacion", String.Format("trim(Clasificacion)='{0}'", row("Clasificación").ToString().TrimStart().TrimEnd())).ToEntero + Dim CveMarca As Integer = DtMarcas.FiltroPrimeroValor("CveMarca", String.Format("Marca='{0}'", row("Marca").ToString().TrimStart().TrimEnd())).ToEntero + + Dim Mes As Decimal = row("Mes").ToString().ToDecimal() + Dim Anio As Decimal = row("Año").ToString().ToDecimal() + Dim Cantidad As Decimal = row("Cantidad").ToString().ToDecimal() + Dim Importe As Decimal = row("Importe").ToString().ToDecimal() + + Dim FechaRef As New DateTime(Anio, Mes, 1) + If CveVendedor > 0 AndAlso CveVendedor > 0 AndAlso CveClasificacion > 0 AndAlso CveClasificacion2 > 0 AndAlso CveMarca > 0 Then + Correcto = ObjMetas.AddMetasVendedores(CveVendedor, FechaRef, CveMarca, Cantidad, Importe, CveClasificacion2, CveClasificacion, UsuarioActual.CveEmpresa) + If Correcto Then + RowsCargados += 1 + End If + End If + + If Not Correcto Then + RowsNoCargados += 1 + End If + End If + Next Catch ex As Exception OnError("Ocurrió un error al cargar los precios.", ex) Finally - ObjMarcas.Dispose() - - Dim MensajeFinal As New StringBuilder() - If RowsNoCargados = 0 AndAlso RowsCargados > 0 Then - MensajeFinal.Append("Las metas se cargaron correctamente.

") - End If - If RowsCargados > 0 Then - MensajeFinal.Append("Se cargaron " & RowsCargados & " metas correctamente.") - End If - If RowsNoCargados > 0 Then - MensajeFinal.Append("No se pudieron actualizar " & RowsNoCargados & " metas.
") - End If - - Alert(MensajeFinal.ToString()) + Dim MensajeFinal As New StringBuilder() + + If Correcto Then + ObjMetas.Commit() + If RowsNoCargados = 0 AndAlso RowsCargados > 0 Then + MensajeFinal.Append("Las metas se cargaron correctamente.

") + End If + If RowsCargados > 0 Then + MensajeFinal.Append("Se cargaron " & RowsCargados & " metas correctamente.") + End If + If RowsNoCargados > 0 Then + MensajeFinal.Append("No se pudieron actualizar " & RowsNoCargados & " metas.
") + End If + + Alert(MensajeFinal.ToString()) + Else + ObjMetas.RollBack() + If RowsNoCargados > 0 Then + MensajeFinal.Append("No se pudieron actualizar " & RowsNoCargados & " metas.
") + End If + Alert(MensajeFinal.ToString()) + End If + + + End Try End If - End Sub - - Private Function ReadExcelFile(ByVal flatFilePath As String, ByVal firstRowHasHeaders As Boolean) As DataTable - SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet) - Dim excelFile As ExcelFile = ExcelFile.Load(flatFilePath) - - Dim unnamed As Integer = 0 - Dim cols As Integer - Dim columns As String() - Dim curRow As Integer = 0 - Dim curCol As Integer = 0 - Dim dataTable As DataTable = New DataTable() - Dim worksheet As ExcelWorksheet = excelFile.Worksheets(0) - - For cols = 0 To worksheet.Rows(0).AllocatedCells.Count - 1 - - If firstRowHasHeaders Then - - If worksheet.Rows(0).Cells(cols).Value IsNot Nothing Then - dataTable.Columns.Add(worksheet.Rows(0).Cells(cols).Value.ToString()) - Else - dataTable.Columns.Add("Unnamed Column " & (System.Threading.Interlocked.Increment(unnamed))) - End If - - curRow = 1 - Else - dataTable.Columns.Add("Column " & (cols + 1)) - End If - Next - - While curRow < worksheet.Rows.Count - columns = New String(cols - 1) {} - - For curCol = 0 To cols - 1 - - If worksheet.Rows(curRow).Cells(curCol).Value Is Nothing Then - columns(curCol) = "" - Else - columns(curCol) = worksheet.Rows(curRow).Cells(curCol).Value.ToString() - End If - Next - - dataTable.Rows.Add(columns) - curRow += 1 - End While - - Return dataTable - End Function + End Sub + End Class diff --git a/Ventas/Clientes.aspx b/Ventas/Clientes.aspx index 3a646abb2..74bccf089 100644 --- a/Ventas/Clientes.aspx +++ b/Ventas/Clientes.aspx @@ -4434,7 +4434,7 @@ diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index fe9167a1a..9daf8def2 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -9420,7 +9420,7 @@ Partial Class Clientes If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.DataKey("CveConcepto").ToEntero() = 1 Then + If e.Row.DataKey("CveConcepto").ToEntero() = 1 AndAlso e.Row.DataKey("TipoEstatus").ToEntero() <> 5 Then Dim FacturadoCargo As Boolean = Boolean.Parse(e.Row.DataKey("FacturadoCargo")) Dim FacturadoBonificacion As Boolean = Boolean.Parse(e.Row.DataKey("FacturadoBonificacion")) diff --git a/Ventas/MetasVendedores.aspx b/Ventas/MetasVendedores.aspx index bc92e3f74..26f289904 100644 --- a/Ventas/MetasVendedores.aspx +++ b/Ventas/MetasVendedores.aspx @@ -144,59 +144,86 @@ CssClass="table table-advance Widthall ScrollAD" data-sort="true" ShowHeader="True" EmptyDataText="No se encontraron resultados." ShowHeaderWhenEmpty="true" AutoGenerateColumns="False" AllowPaging="False" ShowFooter="False"> - + - + - + - + + + %Inte + - + + + Año
Anterior +
- +
- + + + Obj.
Mes +
- +
- + + + Var
Mes A.A +
- +
- + + + Var
Obj. +
- +
- + + + Real
Acum. +
- +
- + + + %Inte + - + + + Acum
Año Ant +
- +
- + + + Obj.
Acum +
- +
<%-- @@ -204,14 +231,20 @@ --%> - + + + Var
vs AA +
- +
- + + + Var
Obj. +
- +
diff --git a/Ventas/MetasVendedores.aspx.vb b/Ventas/MetasVendedores.aspx.vb index 95b680714..27db649af 100644 --- a/Ventas/MetasVendedores.aspx.vb +++ b/Ventas/MetasVendedores.aspx.vb @@ -86,7 +86,7 @@ Partial Class MetasVendedores Select Case e.Row.DBCampo("TipoFila") Case "1" - e.Row.CssClass = "GrupoSuperior" + e.Row.CssClass = "Totales" ' e.Row.FCLabel("lblRealMes").Text = "" ' e.Row.FCLabel("lblVtaMesAA").Text = "" ' e.Row.FCLabel("lblObjMes").Text = "" @@ -98,11 +98,11 @@ Partial Class MetasVendedores ' e.Row.FCLabel("lblVarVSAA").Text = "" ' e.Row.FCLabel("lblVarVSObjAcum").Text = "" Case "2" - e.Row.CssClass = "Totales" - Case "3" e.Row.CssClass = "SubTotales2" - Case "4" + Case "3" e.Row.CssClass = "SubTotales" + Case "4" + e.Row.CssClass = "SubTotales3" End Select If e.Row.DataKey("Titulo") = "" Then diff --git a/Ventas/PV.aspx.vb b/Ventas/PV.aspx.vb index 6ed007114..8d4cb3db8 100644 --- a/Ventas/PV.aspx.vb +++ b/Ventas/PV.aspx.vb @@ -1286,6 +1286,7 @@ Partial Class PV If UsuarioActual.Empresa.Funcionalidad(569) = "1" Then DdlTipoComprobante.Items.Add(New ListItem("Remisión", "Rem")) DdlTipoComprobante.SelectedValueExist("Rem") + DdlTipoComprobante_SelectedIndexChanged(DdlTipoComprobante, EventArgs.Empty) End If DdlTipoDefecto.Width = New Unit(260%) @@ -5964,7 +5965,7 @@ Partial Class PV Case 1 'CREDITO TxtFechaPago.Text = Now.AddDays(PlazoCobranza).ToShortDateString Case 2 'CONTADO - If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") Then + If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant") Then DivContado.Visible = True TxtImporteContado.Text = TxtTotal.Text End If @@ -6165,6 +6166,11 @@ Partial Class PV Retorno = True End If + If DtPagos IsNot Nothing AndAlso DtPagos.SUM("Importe").ToString.ToDecimal() > 0 AndAlso DdlTipoComprobante.SelectedValue = "Rem" Then + Alert("Los pagos no deben ser aplicados a una remisión.", TipoMensaje.MsgAdvertencia) + Retorno = True + End If + Return Retorno End Function @@ -7315,12 +7321,10 @@ Partial Class PV TxtPrecio.Text = TxtPrecio.Text TxtObsPS.Text = "Descuento por garantía" Else - 'For Each Gvr As GridViewRow In GvRecepcionUsados.Rows - ' If Gvr.RowType = DataControlRowType.DataRow Then - ' Gvr.FCTextBox("TxtCantidad").Text = "" - ' Gvr.FCTextBox("TxtCantidad").Enabled = True - ' End If - 'Next + If TmpDTAjustes IsNot Nothing Then + TmpDTAjustes.Clear() + End If + TxtObsPS.Text = TxtObsPS.Text.Replace("Descuento por garantía", "") DdlRecepcionUsados.SelectedValueExist("-1") DdlRecepcionUsados.Enabled = True diff --git a/Ventas/RepProductosServicios.aspx.vb b/Ventas/RepProductosServicios.aspx.vb index 723798e90..30114c074 100644 --- a/Ventas/RepProductosServicios.aspx.vb +++ b/Ventas/RepProductosServicios.aspx.vb @@ -194,7 +194,7 @@ Partial Class Ventas_RepProductosServicios DdlSubProyectoEjecucion.DataBind() 'Vendedor - DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa) + DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa, VendedorTipo:=-1).FiltraParametros("VendedorTipo in (1,3)") 'vendedores y vendedores de piso DdlVendedor.DataBind() 'CargaUsuarios diff --git a/Ventas/RepRecuperacion.aspx.vb b/Ventas/RepRecuperacion.aspx.vb index eff509902..61db1d92a 100644 --- a/Ventas/RepRecuperacion.aspx.vb +++ b/Ventas/RepRecuperacion.aspx.vb @@ -180,15 +180,15 @@ Partial Class Ventas_RepRecuperacion End If End If - Dim Liga4 As String = String.Format("/Ventas/RepRecuperacionDetalle.aspx?GPO={0}&CveCliente={1}&CveSubProyecto={2}&Vendedor={3}&CveUsuario={4}&CveEstatusFactura={5}&IVA={6}&FechaI={7}&FechaF={8}&CveResponsable={9}&TipoDocto={10}&CveClienteSucursal={11}&CveBanco{12}&CveCuenta{13}&Grupo={14}&TipoCambio={15}&TCEspecifico={16}&CveMoneda={17}&Tipo={18}&EsDistribuidor={19}&FechaAplicadoI={20}&FechaAplicadoF={21}&FechaRegistroIEI={22}&FechaRegistroIEF={23}", + Dim Liga4 As String = String.Format("/Ventas/RepRecuperacionDetalle.aspx?GPO={0}&CveCliente={1}&CveSubProyecto={2}&Vendedor={3}&CveUsuario={4}&CveEstatusFactura={5}&IVA={6}&FechaI={7}&FechaF={8}&CveResponsable={9}&TipoDocto={10}&CveClienteSucursal={11}&CveBanco{12}&CveCuenta{13}&Grupo={14}&TipoCambio={15}&TCEspecifico={16}&CveMoneda={17}&Tipo={18}&EsDistribuidor={19}&FechaAplicadoI={20}&FechaAplicadoF={21}&FechaRegistroIEI={22}&FechaRegistroIEF={23}&CveCondicionesPago={24}&CveTipoTransaccion={25}", DdlGrupo.SelectedValue, e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveVendedor"), - e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF, DdlResponsable.SelectedValue, e.Row.DBCampo("TipoDocto"), CveClienteSucursal, e.Row.DBCampo("CveBanco"), e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("GPO"), e.Row.DBCampo("TipoCambio"), e.Row.DBCampo("TCEspecifico"), e.Row.DBCampo("CveMoneda"), 2, e.Row.DBCampo("EsDistribuidor"), FechaAplicadoI, FechaAplicadoF, FechaRegistroIEI, FechaRegistroIEF) + e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF, DdlResponsable.SelectedValue, e.Row.DBCampo("TipoDocto"), CveClienteSucursal, e.Row.DBCampo("CveBanco"), e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("GPO"), e.Row.DBCampo("TipoCambio"), e.Row.DBCampo("TCEspecifico"), e.Row.DBCampo("CveMoneda"), 2, e.Row.DBCampo("EsDistribuidor"), FechaAplicadoI, FechaAplicadoF, FechaRegistroIEI, FechaRegistroIEF, -1, e.Row.DBCampo("CveTipoTransaccion")) e.Row.FCHyperLink("HplPagado").NavigateUrl = Liga4 - Dim Liga5 As String = String.Format("/Ventas/RepRecuperacionDetalle.aspx?GPO={0}&CveCliente={1}&CveSubProyecto={2}&Vendedor={3}&CveUsuario={4}&CveEstatusFactura={5}&IVA={6}&FechaI={7}&FechaF={8}&CveResponsable={9}&TipoDocto={10}&CveClienteSucursal={11}&CveBanco{12}&CveCuenta{13}&Grupo={14}&TipoCambio={15}&TCEspecifico={16}&CveMoneda={17}&Tipo={18}&EsDistribuidor={19}&FechaAplicadoI={20}&FechaAplicadoF={21}&FechaRegistroIEI={22}&FechaRegistroIEF={23}", + Dim Liga5 As String = String.Format("/Ventas/RepRecuperacionDetalle.aspx?GPO={0}&CveCliente={1}&CveSubProyecto={2}&Vendedor={3}&CveUsuario={4}&CveEstatusFactura={5}&IVA={6}&FechaI={7}&FechaF={8}&CveResponsable={9}&TipoDocto={10}&CveClienteSucursal={11}&CveBanco{12}&CveCuenta{13}&Grupo={14}&TipoCambio={15}&TCEspecifico={16}&CveMoneda={17}&Tipo={18}&EsDistribuidor={19}&FechaAplicadoI={20}&FechaAplicadoF={21}&FechaRegistroIEI={22}&FechaRegistroIEF={23}&CveCondicionesPago={24}&CveTipoTransaccion={25}", DdlGrupo.SelectedValue, e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveVendedor"), - e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF, DdlResponsable.SelectedValue, e.Row.DBCampo("TipoDocto"), CveClienteSucursal, e.Row.DBCampo("CveBanco"), e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("GPO"), e.Row.DBCampo("TipoCambio"), e.Row.DBCampo("TCEspecifico"), e.Row.DBCampo("CveMoneda"), 1, e.Row.DBCampo("EsDistribuidor"), FechaAplicadoI, FechaAplicadoF, FechaRegistroIEI, FechaRegistroIEF) + e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF, DdlResponsable.SelectedValue, e.Row.DBCampo("TipoDocto"), CveClienteSucursal, e.Row.DBCampo("CveBanco"), e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("GPO"), e.Row.DBCampo("TipoCambio"), e.Row.DBCampo("TCEspecifico"), e.Row.DBCampo("CveMoneda"), 1, e.Row.DBCampo("EsDistribuidor"), FechaAplicadoI, FechaAplicadoF, FechaRegistroIEI, FechaRegistroIEF, -1, e.Row.DBCampo("CveTipoTransaccion")) e.Row.FCHyperLink("HplVendido").NavigateUrl = Liga5 diff --git a/Ventas/RepRecuperacionDetalle.aspx b/Ventas/RepRecuperacionDetalle.aspx index 02842ef9f..bf1ee36a7 100644 --- a/Ventas/RepRecuperacionDetalle.aspx +++ b/Ventas/RepRecuperacionDetalle.aspx @@ -219,6 +219,12 @@ + +
+ + + +
F. Registro IE inicio:
@@ -249,6 +255,7 @@
+
diff --git a/Ventas/RepRecuperacionDetalle.aspx.vb b/Ventas/RepRecuperacionDetalle.aspx.vb index 1c99eed8e..8be1388ab 100644 --- a/Ventas/RepRecuperacionDetalle.aspx.vb +++ b/Ventas/RepRecuperacionDetalle.aspx.vb @@ -133,10 +133,11 @@ Partial Class Ventas_RepRecuperacionDetalle DdlMoneda.Items.Insert(0, New ListItem("Todos", "-1")) DdlMoneda.DataBind() - 'txtFechaI.Text = $"01/{Now.Month}/{Now.Year}" - 'txtFechaF.Text = Now.ToShortDateString - - 'Cargamos las fechas + DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones().FiltraParametros("Tipo = 'Ing' and Estatus = True ") + DdlTipoTransaccion.DataBind() + DdlTipoTransaccion.Items.Insert(0, New ListItem("Todos", "-1")) + + 'Cargamos las fechas FechaI = If(Request("FechaI") IsNot Nothing, Request("FechaI").ToString, "-1").ToString FechaF = If(Request("FechaF") IsNot Nothing, Request("FechaF").ToString, "-1").ToString If FechaF <> "-1" Then @@ -186,6 +187,7 @@ Partial Class Ventas_RepRecuperacionDetalle CveClienteClasificacion = IfNull(Request("CveClienteClasificacion"), "-1").ToString.ToEntero Tipo = IfNull(Request("Tipo"), "-1").ToString.ToEntero EsDistribuidor = IfNull(Request("EsDistribuidor"), "-1").ToString.ToEntero + Dim CveTipoTransaccion As Integer = IfNull(Request("CveTipoTransaccion"), "-1").ToString.ToEntero 'Carga Clasificacion Cliente' Dim ObjCliente As New ClsClientes @@ -230,6 +232,7 @@ Partial Class Ventas_RepRecuperacionDetalle DdlClienteClasificacion.SelectedValueExist(CveClienteClasificacion) DdlClienteSucursal.SelectedValueExist(CveClienteSucursal) DdlDistribuidor.SelectedValueExist(EsDistribuidor) + DdlTipoTransaccion.SelectedValueExist(CveTipoTransaccion) If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then lblEsDistribuidor.Visible = True @@ -256,7 +259,8 @@ Partial Class Ventas_RepRecuperacionDetalle Iva.ToString, DdlGrupo.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlResponsable.SelectedValue.ToEntero, DdlTipoDocto.SelectedValue, CveUsuarioConsulta:=UsuarioActual.CveUsuario, CveBanco:=DdlBanco.SelectedValue.ToEntero, CveCuenta:=DdlCuentaBancaria.SelectedValue.ToEntero, Grupo:=Grupo, TipoCambio:=RblTipoCambio.SelectedValue.ToEntero, TCEspecifico:=TCEspecifico, CveMoneda:=DdlMoneda.SelectedValue.ToEntero, CveClienteClasificacion:=DdlClienteClasificacion.SelectedValue.ToEntero, Tipo:=Tipo, - EsDistribuidor:=DdlDistribuidor.SelectedValue.ToEntero(), FechaAplicadoI:=FechaAplicadoI, FechaAplicadoF:=FechaAplicadoF, FechaRegistroIEI:=FechaRegistroIEI, FechaRegistroIEF:=FechaRegistroIEF) Then + EsDistribuidor:=DdlDistribuidor.SelectedValue.ToEntero(), FechaAplicadoI:=FechaAplicadoI, FechaAplicadoF:=FechaAplicadoF, FechaRegistroIEI:=FechaRegistroIEI, FechaRegistroIEF:=FechaRegistroIEF, + CveTipoTransaccion:=DdlTipoTransaccion.SelectedValue.ToEntero) Then GvDatos.DataSource = ObjMovtos.DtResultados DtDatos = ObjMovtos.DtResultados diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index c773f2420..e35a5f8a6 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -6602,6 +6602,30 @@ Partial Class Ventas LnkOCs.Visible = False End If + If DdlTipoComprobante.SelectedValue = "Cot" AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" Then + Dim Autorizacion As Integer = 0 + + Dim ObjVentas As New ClsVentas + If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero, "Ing", CveEstatus:=1) Then + Dim RowAutorizacion As DataRow = Nothing + 'SI TIENE DIAS VENCIDOS BUSCAR POR TIPO VENCIMIENTO + If TieneDiasVencidos Then + RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion IN(1,2) AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC") + Else + RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC") + End If + + If RowAutorizacion IsNot Nothing Then + Autorizacion = RowAutorizacion("CveAutorizacion").ToString().ToEntero() + End If + End If + ObjVentas.Dispose() + + 'SI NO TIENE AUTORIZACION, MANTIENE EL BLOQUEO POR CONDICIONES DE CREDITO + If Autorizacion > 0 Then + BtnsFacturar.Visible = True + End If + End If Else @@ -6620,6 +6644,32 @@ Partial Class Ventas DdlTipoComprobante.SelectedValueExistInsert("Cot", "Cotización") End If TxtFechaPago.Text = If(DdlTipoComprobante.SelectedValue = "Rem", Now.AddDays(PlazoCobranzaRemision), Now.AddDays(PlazoCobranza)).ToShortDateString + + If EsCotizacion AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" Then + Dim Autorizacion As Integer = 0 + + Dim ObjVentas As New ClsVentas + If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero, "Ing", CveEstatus:=1) Then + Dim RowAutorizacion As DataRow = Nothing + 'SI TIENE DIAS VENCIDOS BUSCAR POR TIPO VENCIMIENTO + If TieneDiasVencidos Then + RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion IN(1,2) AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC") + Else + RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC") + End If + + If RowAutorizacion IsNot Nothing Then + Autorizacion = RowAutorizacion("CveAutorizacion").ToString().ToEntero() + End If + End If + ObjVentas.Dispose() + + 'SI NO TIENE AUTORIZACION, MANTIENE EL BLOQUEO POR CONDICIONES DE CREDITO + If Autorizacion > 0 Then + BtnsFacturar.Visible = True + End If + End If + End If @@ -6753,10 +6803,39 @@ Partial Class Ventas 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) Vta.Dispose() - If Opcion > 0 Then - Alert(OpcionMsg, TipoMensaje.MsgAdvertencia) - BtnsFacturar.Visible = False - BtnGenerarRemision.Visible = False + + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then + Dim Autorizacion As Integer = 0 + + Dim ObjVentas As New ClsVentas + If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero, "Ing", CveEstatus:=1) Then + Dim RowAutorizacion As DataRow = Nothing + 'SI TIENE DIAS VENCIDOS BUSCAR POR TIPO VENCIMIENTO + If TieneDiasVencidos Then + RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion IN(1,2) AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC") + Else + RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC") + End If + + If RowAutorizacion IsNot Nothing Then + Autorizacion = RowAutorizacion("CveAutorizacion").ToString().ToEntero() + End If + End If + ObjVentas.Dispose() + + 'SI NO TIENE AUTORIZACION, MANTIENE EL BLOQUEO POR CONDICIONES DE CREDITO + If Opcion > 0 AndAlso Autorizacion <= 0 Then + Alert(OpcionMsg, TipoMensaje.MsgAdvertencia) + BtnsFacturar.Visible = False + BtnGenerarRemision.Visible = False + End If + + Else + If Opcion > 0 Then + Alert(OpcionMsg, TipoMensaje.MsgAdvertencia) + BtnsFacturar.Visible = False + BtnGenerarRemision.Visible = False + End If End If End If End If