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 = ""