diff --git a/App_Code/ClsPaginas.vb b/App_Code/ClsPaginas.vb index 19dd4304d..d46da9077 100644 --- a/App_Code/ClsPaginas.vb +++ b/App_Code/ClsPaginas.vb @@ -10091,11 +10091,21 @@ Public Class ClsPaginas If Pago.TipoPago = "Egsc" AndAlso Not ErrorMovtos Then ' A N T I C I P O / E G R E S O S X C O M P R O B A R Dim Ret As New ConceptosRetenciones If Pago.CveMonedaPago > 1 Then + + Dim Importe21 As Decimal = Pago.ImportePago + If Not UsaComplementaria Then + Importe21 = (Importe21 + (Pago.ImportePago * TCValuacionPago - Pago.ImportePago)).RoundSQL + End If + 'Agregamos la Extranjera - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Pago.ImportePago, Pago.ImportePago, 21, Pago.Referencia, Concepto, CompraActual.IdCtaContableAnticipoProv, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, ImporteME:=Pago.ImportePago, TipoCambio:=TCValuacionPago, CveSubProyecto:=CompraActual.CveSubProyecto) Then ErrorMovtos = True + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Pago.ImportePago, Importe21, 21, Pago.Referencia, Concepto, CompraActual.IdCtaContableAnticipoProv, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, ImporteME:=Pago.ImportePago, TipoCambio:=TCValuacionPago, CveSubProyecto:=CompraActual.CveSubProyecto) Then ErrorMovtos = True ImporteMN = (Pago.ImportePago * TCValuacionPago - Pago.ImportePago).RoundSQL - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Pago.ImportePago, ImporteMN, 266, Pago.Referencia, Concepto, CompraActual.IdCtaContableAnticipoProvComplementaria, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, ImporteME:=Pago.ImportePago, TipoCambio:=TCValuacionPago, CveSubProyecto:=CompraActual.CveSubProyecto) Then ErrorMovtos = True + + If UsaComplementaria Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Pago.ImportePago, ImporteMN, 266, Pago.Referencia, Concepto, CompraActual.IdCtaContableAnticipoProvComplementaria, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, ImporteME:=Pago.ImportePago, TipoCambio:=TCValuacionPago, CveSubProyecto:=CompraActual.CveSubProyecto) Then ErrorMovtos = True + End If + Else 'Agregamos Nacional If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Pago.ImportePago, Pago.ImportePago, 21, Pago.Referencia, Concepto, CompraActual.IdCtaContableAnticipoProv, CveCompra:=CompraActual.CveCompra, CveProveedor:=CompraActual.CveProveedor, CveIE:=Pago.CveIE, CvePersonal:=Pago.CvePersonal, TipoCambioPago:=Pago.TCPago) Then ErrorMovtos = True diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb index 1752b34e4..454d6d5c8 100644 --- a/App_Code/ClsVentas.vb +++ b/App_Code/ClsVentas.vb @@ -2152,7 +2152,7 @@ Public Class ClsVentas End Function Public Function AddPromociones(Promocion As String, FechaInicio As Date, FechaFin As Date, CveVendedor As Integer, CveCliente As Integer, Estatus As Boolean, CveMoneda As Integer, CveUsuario As Integer, CveEmpresa As Integer, CveSubProyecto As Integer, TipoAplicacion As String, - Optional CveMarca As Integer = -1, Optional EsDistribuidor As Integer = -1, Optional CvePromocionPadre As Integer = -1) As Integer + Optional CveMarca As Integer = -1, Optional EsDistribuidor As Integer = -1) As Integer Dim Retorno = -1 DataAdapter("PA_Vta_PromocionesAdd") @@ -2170,7 +2170,6 @@ Public Class ClsVentas .Add("@TipoAplicacion", SqlDbType.VarChar).Value = TipoAplicacion .Add("@CveMarca", SqlDbType.Int).Value = CveMarca .Add("@EsDistribuidor", SqlDbType.Int).Value = EsDistribuidor - .Add("@CvePromocionPadre", SqlDbType.Int).Value = CvePromocionPadre .Add("@CvePromocion", SqlDbType.Int).Direction = ParameterDirection.Output End With diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb index dad351faf..1225270c4 100644 --- a/Bancos/IE.aspx.vb +++ b/Bancos/IE.aspx.vb @@ -2773,7 +2773,7 @@ Partial Class Bancos_IE End If End If Dim UsaComplementariaBancos As Boolean = False - UsaComplementariaBancos = True + UsaComplementariaBancos = If(UsuarioActual.CveEmpresa.Contiene(13, 83), False, True) If MsgError = "" Then @@ -3706,8 +3706,16 @@ Partial Class Bancos_IE IDCtaBeneficiario = IdCtaAnticipoExtranjera End If + + Dim Importe30 As Decimal = TxtImporte.Text.ToDecimal + + If Not UsaComplementariaBancos AndAlso tCveMoneda > 1 Then + Importe30 = TxtImporte.Text.ToDecimal + (TxtImporte.Text.ToDecimal * TxtTipoCambio.Text.ToDecimal - TxtImporte.Text.ToDecimal).RoundSQL() + End If + + 'MOVIMIENTOS EGRESOS - If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, TxtImporte.Text.ToDecimal, Ref, CveConceptoContable, Conc, Now, IDCtaContable, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveOC:=CveOrdenCompra, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=TxtImporte.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera, CveIEDevolucion:=DDlCheques.SelectedValue.ToEntero) Then + If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, TxtImporte.Text.ToDecimal, Ref, CveConceptoContable, Conc, Now, IDCtaContable, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveOC:=CveOrdenCompra, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=Importe30, ImporteME:=tImporteMonedaExtranjera, CveIEDevolucion:=DDlCheques.SelectedValue.ToEntero) Then Dim IVA As Decimal = 0 ' TxtImporte.Text.ToDouble * HdnProvPorIVA.Value.ToDouble If ObjMov.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, TxtImporte.Text.ToDecimal - IVA - CIF, Ref, CveConceptoCompra, Conc, Now, IDCtaBeneficiario, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveOC:=CveOrdenCompra, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=If(UsaComplementariaBancos, TxtImporte.Text.ToDecimal, tImporteMonedaExtranjera), ImporteME:=TxtImporte.Text.ToDecimal, CveIEDevolucion:=DdlIEAcreedor.SelectedValue.ToEntero) Then If IVA > 0 AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, IVA, Ref, 19, Conc, Now, IDCtaBeneficiario, -1, CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveOC:=CveOrdenCompra, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteMX:=TxtImporte.Text.ToDecimal, ImporteME:=tImporteMonedaExtranjera, CveIEDevolucion:=DDlCheques.SelectedValue.ToEntero) Then @@ -3725,7 +3733,7 @@ Partial Class Bancos_IE End If 'BANCOS COMPLEMENTARIA - If tCveMoneda > 1 Then + If tCveMoneda > 1 And UsaComplementariaBancos Then Dim ImporteAplicar As Decimal = TxtImporte.Text.ToDecimal Dim ImporteAplicarMN = (ImporteAplicar * TxtTipoCambio.Text.ToDecimal - ImporteAplicar).RoundSQL() If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteAplicar, Ref, 204, Conc, Now, IDCtaContableComplementaria, -1, CveIE, CveCompra:=CveCompraDeCDin, CveProveedor:=CveProveedor, ImporteMX:=ImporteAplicarMN, ImporteME:=ImporteAplicar, TipoCambio:=TxtTipoCambio.Text.ToDecimal) Then diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 2c13b4900..0714daa10 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -7416,11 +7416,12 @@ Partial Class Compras_Compras Else Dim usacomplementariaAnticipo As Boolean = False - usacomplementariaAnticipo = If(Ant.TCCompra > 1, True, False) + usacomplementariaAnticipo = If(Ant.TCCompra > 1 And not UsuarioActual.CveEmpresa.Contiene(13,83), True, False) Dim TipoCambioAnt As Decimal = Ant.TCCompra Dim ImporteAnt As Decimal = importeMovimiento Dim ImporteAntMN As Decimal = ImporteAnt * TipoCambioAnt + If usacomplementariaAnticipo Then IdCtaContable = CtaProveedorAnticiposComplementaria ImporteAntMN = TipoCambioAnt * ImporteAnt - ImporteAnt @@ -7440,6 +7441,11 @@ Partial Class Compras_Compras 'Dim ImporComisionAnticipo As Decimal = Ant.ImporteComision 'Dim importeMNComision As Decimal = ImporComisionAnticipo * tipoCambioActual * Multiplicador + + If Not usacomplementariaAnticipo Then + ImporteAntMN = TipoCambioAnt * ImporteAnt + End If + If ImporComisionAnticipo = 0 Then If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteAnt, Referencia, ConceptoContableAnticipo, Concepto, FechaMovimiento, IdCtaContable, -1, CveCompra:=CveCompraNC, CveCompraAmortizacion:=CveCompra, CveProveedor:=CveProveedorLocal, CveIE:=Ant.CveIE, ImporteMX:=ImporteAntMN, ImporteME:=If(tipoCambioActual = 1, 0, ImporteAnt), TipoCambio:=TipoCambioAnt, Contabilizable:=SeContabiliza) Then ErrorPrepoliza = True diff --git a/Inventarios/EntregaAlmacen.aspx.vb b/Inventarios/EntregaAlmacen.aspx.vb index f52220856..7656ec45a 100644 --- a/Inventarios/EntregaAlmacen.aspx.vb +++ b/Inventarios/EntregaAlmacen.aspx.vb @@ -293,6 +293,24 @@ Partial Class Inventarios_EntregaAlmacen End Set End Property + + Private Property CargaBitacora As Boolean + Get + + If ViewState("CargaBitacora") Is Nothing Then + ViewState("CargaBitacora") = False + End If + + Return Boolean.Parse(ViewState("CargaBitacora").ToString) + End Get + Set(value As Boolean) + ViewState("CargaBitacora") = value + End Set + End Property + + + + #End Region Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load @@ -932,7 +950,11 @@ Partial Class Inventarios_EntregaAlmacen 'SugerirFecha() If DdlAlmacen.SelectedValue.ToEntero > 0 And CveVentaSurtir > 0 Then CargaVentaPorSurtir(CveVentaSurtir, CveAlmacen:=DdlAlmacen.SelectedValue.ToEntero) - ' SugiereLoteCaducidad(DdlAlmacen.SelectedValue.ToEntero) + + If CargaBitacora Then + CargaBitacoraSerie() + End If + End If End If GvDatos.DataSource = DtDatos @@ -1283,26 +1305,26 @@ Partial Class Inventarios_EntregaAlmacen 'Valida Existencia - If TipoMovimiento = 1 Then - Dim ObjInventarios As New ClsInventarios - Dim Existencia = ObjInventarios.GetExistenciasPS(CvePSSerie, CveUMSerie, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero(), FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Serie:=Serie, CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=If(TipoEntrega = 2, 1, -1)) - If Existencia < 1 Then - Alert($"No hay existencia suficiente del producto ""{PSSerie}"" con la Serie definida ""{Serie}"". Por favor rectifique y vuelva a intentar", TipoMensaje.MsgAdvertencia, If(Tipo = 2, "window.setTimeout(Focus,200);", "")) - RegistraScript("playsonidito('142608__autistic-lucario__error.wav')", "Error2") - ObjInventarios.Dispose() - Exit Sub - End If - ObjInventarios.Dispose() - Else - If DtExistencias IsNot Nothing Then - Dim Existencia = DtExistencias.SUM("Cantidad", $"CvePS = {CvePSSerie} AND CveUM = {CveUMSerie} AND Serie = '{Serie}'") - If Existencia < 1 Then - Alert($"No hay existencia suficiente del producto ""{PSSerie}"" con la Serie definida ""{Serie}"". Por favor rectifique y vuelva a intentar", TipoMensaje.MsgAdvertencia, If(Tipo = 2, "window.setTimeout(Focus,200);", "")) - RegistraScript("playsonidito('142608__autistic-lucario__error.wav')", "Error3") - Exit Sub - End If - End If - End If + 'If TipoMovimiento = 1 Then + ' Dim ObjInventarios As New ClsInventarios + ' Dim Existencia = ObjInventarios.GetExistenciasPS(CvePSSerie, CveUMSerie, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero(), FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Serie:=Serie, CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=If(TipoEntrega = 2, 1, -1)) + ' If Existencia < 1 Then + ' Alert($"No hay existencia suficiente del producto ""{PSSerie}"" con la Serie definida ""{Serie}"". Por favor rectifique y vuelva a intentar", TipoMensaje.MsgAdvertencia, If(Tipo = 2, "window.setTimeout(Focus,200);", "")) + ' RegistraScript("playsonidito('142608__autistic-lucario__error.wav')", "Error2") + ' ObjInventarios.Dispose() + ' Exit Sub + ' End If + ' ObjInventarios.Dispose() + 'Else + ' If DtExistencias IsNot Nothing Then + ' Dim Existencia = DtExistencias.SUM("Cantidad", $"CvePS = {CvePSSerie} AND CveUM = {CveUMSerie} AND Serie = '{Serie}'") + ' If Existencia < 1 Then + ' Alert($"No hay existencia suficiente del producto ""{PSSerie}"" con la Serie definida ""{Serie}"". Por favor rectifique y vuelva a intentar", TipoMensaje.MsgAdvertencia, If(Tipo = 2, "window.setTimeout(Focus,200);", "")) + ' RegistraScript("playsonidito('142608__autistic-lucario__error.wav')", "Error3") + ' Exit Sub + ' End If + ' End If + 'End If Dim Row = DtDatosDetalle.NewRow @@ -1364,23 +1386,35 @@ Partial Class Inventarios_EntregaAlmacen Protected Sub HplCargaBitacora_Click(sender As Object, e As EventArgs) + CargaBitacora = False If IO.File.Exists(ArchivoBitacora) Then - 'DtInv.Clear() - 'DtDatosDetalle.Clear() + + CargaBitacoraSerie() + CargaGvDatos() + CargaBitacora = True + Else + Alert("No hay bitácora para recuperar.", TipoMensaje.ToastInformacion) + End If + + End Sub + + Private Sub CargaBitacoraSerie() + + If IO.File.Exists(ArchivoBitacora) Then + DtDatos.ReadXml(ArchivoBitacora) If IO.File.Exists(ArchivoBitacoraDetalle) Then Dim dtt As New DataTable dtt.ReadXml(ArchivoBitacoraDetalle) DtDatosDetalle = dtt Alert("Registro(s) Recuperados", TipoMensaje.ToastInformacion) - End If - CargaGvDatos() + End If Else Alert("No hay bitácora para recuperar.", TipoMensaje.ToastInformacion) End If - End Sub + #End Region #Region " AGREGA CON LOTE BATCH " @@ -3020,6 +3054,10 @@ Partial Class Inventarios_EntregaAlmacen Limpia() CargaPendientes() LimpiaCampos() + + CargaBitacora = False + + Else ObjInventario.RollBack() Alert(TextoError.ToString(), TipoMensaje.MsgError) @@ -3452,6 +3490,9 @@ Partial Class Inventarios_EntregaAlmacen Limpia() LimpiaCampos() CargaPendientes() + + CargaBitacora = False + Else Alert(TextoError, TipoMensaje.MsgError) RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") diff --git a/Ventas/ClientesAbonar.aspx.vb b/Ventas/ClientesAbonar.aspx.vb index 46eeba02a..7942b3f89 100644 --- a/Ventas/ClientesAbonar.aspx.vb +++ b/Ventas/ClientesAbonar.aspx.vb @@ -951,7 +951,7 @@ Partial Class Ventas_ClientesAbonar VentaActual.CveSubProyecto = gvr.DataKey("CveSubProyecto").ToEntero VentaActual.IdCtaContableCliente = IIf(VentaActual.CveMoneda = 1, IdCuentaCliente, IdCtaContMonedaExtranjera) VentaActual.IdCtaContableClienteComplementaria = IdCtaContComplementaria - + VentaActual.IdCtaContableClienteAnticipo = IdCtaAnticipo 'Importe de pago Dim Pago As New VentaPago Pago.Fecha = TxtFechaDocumento.Text.ToDate