diff --git a/Bancos/DepositosCaja.aspx b/Bancos/DepositosCaja.aspx index db0f577d6..d687afed7 100644 --- a/Bancos/DepositosCaja.aspx +++ b/Bancos/DepositosCaja.aspx @@ -120,7 +120,8 @@
-
+
@@ -287,6 +284,24 @@
+
+ +
+ +
+ +
@@ -406,8 +421,7 @@ var saldo = 0; var IVA = 0; var ComisionIntermediario = 0; - - + var CuentaRetorno = 0; function FnSuma(chk, cantidad) { var saldoInicial = ToDouble($('#C_lblValorTotal').text()); @@ -528,6 +542,30 @@ } } } + + if ($('#C_ChkCuentaRetorno').attr('checked')) { + var txtcuentaretorno = ToDouble($('#C_TxtCuentaRetorno').val()); + if (txtcuentaretorno != 0) { + var DescuentoNegativa = 0; + if (txtcuentaretorno > 0) { + DescuentoNegativa = txtcuentaretorno * -1; + } + if (DescuentoNegativa > saldo) { + $('#C_TxtCuentaRetorno').val(0); + comision = 0; + descuento = 0; + txtdescuento = 0; + alert("No es posible poner un descuento superior a lo seleccionado"); + saldo = 0; + $('#C_lblValorTotal').text(FormatoNumero(ValorTotalSeleccionado, 2)); + } else { + //saldo = ValorTotalSeleccionado + txtdescuento + comision; + //$('#C_lblValorTotal').text(FormatoNumero(saldo, 2)); + //descuento = ToDouble($('#C_TxtDescuento').val()) + //debugger; + } + } + } } @@ -559,13 +597,28 @@ $('#C_TxtDescuento').val(descuento) alert("No es posible poner un IVA superior a lo seleccionado") } else { - saldo = ValorTotalSeleccionado - comision2 + comision - IVA - ComisionIntermediario; + saldo = ValorTotalSeleccionado - comision2 + comision - IVA - ComisionIntermediario - CuentaRetorno; $('#C_lblValorTotal').text(FormatoNumero(saldo, 2)); descuento = ToDouble($('#C_TxtDescuento').val()) } } + function txtSumaCuentaRetorno(txt) { + debugger; + var comision2 = ToDouble($('#C_TxtCuentaRetorno').val()); + if (comision2 > ValorTotalSeleccionado) { + $('#C_TxtCuentaRetorno').val(descuento) + alert("No es posible poner un IVA superior a lo seleccionado") + } else { + saldo = ValorTotalSeleccionado - comision2 + comision - IVA - ComisionIntermediario; + $('#C_lblValorTotal').text(FormatoNumero(saldo, 2)); + descuento = ToDouble($('#C_TxtCuentaRetorno').val()) + } + + } + + function txtSumaIVA(txt) { var comision2 = ToDouble($('#C_TxtIVA').val()); @@ -573,7 +626,7 @@ $('#C_TxtIVA').val(IVA); alert("No es posible poner un IVA superior a lo seleccionado"); } else { - saldo = ValorTotalSeleccionado - descuento + comision - comision2 - ComisionIntermediario; + saldo = ValorTotalSeleccionado - descuento + comision - comision2 - ComisionIntermediario - CuentaRetorno; $('#C_lblValorTotal').text(FormatoNumero(saldo, 2)); IVA = ToDouble($('#C_TxtIVA').val()); } @@ -586,7 +639,7 @@ //$('#C_TxtComisionIntermediario').val(ComisionIntermediario); //alert("No es posible poner un importe superior a lo seleccionado"); } else { - saldo = ValorTotalSeleccionado - descuento + comision - comision2 - IVA; + saldo = ValorTotalSeleccionado - descuento + comision - comision2 - IVA - CuentaRetorno; $('#C_lblValorTotal').text(FormatoNumero(saldo, 2)); ComisionIntermediario = ToDouble($('#C_TxtComisionIntermediario').val()); } @@ -638,9 +691,19 @@ Recalcular(); $('#DivInter').css("display", "none"); - $('#DivIntercheck').addClass("truncate"); - + $('#DivIntercheck').addClass("truncate"); + } + } + function CheckRowCuenta(chk) { + if (chk.checked == true) { + $('#DivRowCuenta2').css("display", "block"); + $('#DivRowCuenta').removeClass("truncate"); + } else { + + Recalcular(); + $('#DivRowCuenta2').css("display", "none"); + $('#DivRowCuenta').addClass("truncate"); } } @@ -650,8 +713,9 @@ var Descuento = ToDouble($('#C_TxtDescuento').val()); var IVA = ToDouble($('#C_TxtIVA').val()); var ImporteInter = ToDouble($('#C_TxtComisionIntermediario').val()); + var ImporteCuentaRetorno= ToDouble($('#C_TxtCuentaRetorno').val()); - var total = ValorTotalSeleccionado + Comision - Descuento - IVA - ImporteInter + var total = ValorTotalSeleccionado + Comision - Descuento - IVA - ImporteInter - ImporteCuentaRetorno $('#C_lblValorTotal').text(FormatoNumero(total, 2)); debugger; diff --git a/Bancos/DepositosCaja.aspx.vb b/Bancos/DepositosCaja.aspx.vb index f1d222eae..471cde81e 100644 --- a/Bancos/DepositosCaja.aspx.vb +++ b/Bancos/DepositosCaja.aspx.vb @@ -25,6 +25,7 @@ Partial Class Bancos_DepositosCaja txtFechaF.Text = NowADS().ToShortDateString TxtComision.Attributes.Add("onKeyUp", "txtSuma(this);") TxtDescuento.Attributes.Add("onKeyUp", "txtSumaDescuento(this);") + TxtCuentaRetorno.Attributes.Add("onKeyUp", "txtSumaCuentaRetorno(this);") TxtIVA.Attributes.Add("onKeyUp", "txtSumaIVA(this);") TxtComisionIntermediario.Attributes.Add("onKeyUp", "txtSumaTntermediario(this);") @@ -32,7 +33,8 @@ Partial Class Bancos_DepositosCaja CargaCuentas() ChkFaltante.Attributes.Add("onclick", "CheckFaltante(this);") ChkDescuento.Attributes.Add("onclick", "CheckDescuento(this);") - ChkIntermediario.Attributes.Add("onclick", "CheckIntermediario(this);") + ChkIntermediario.Attributes.Add("onclick", "CheckIntermediario(this);") + ChkCuentaRetorno.Attributes.Add("onclick", "CheckRowCuenta(this);") BtnConsultar.Attributes.Add("onclick", "Consultar(this);") BtnDepositar.Attributes.Add("onclick", "Depositar(this);") @@ -41,7 +43,8 @@ Partial Class Bancos_DepositosCaja Private Sub CargaCuentas() DdlCuentaDeposito.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros(" CveTipoCuenta <> 1", "", {"CveCuenta", "NumCuentaMoneda"}) - DdlCuentaDeposito.DataBind() + DdlCuentaDeposito.DataBind() + DdlCuentaDeposito.Items.Insert(0, New ListItem("-", "-1")) DdlCajaChica.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros(" CveTipoCuenta = 1", "", {"CveCuenta", "NumCuentaMoneda"}) DdlCajaChica.DataBind() @@ -54,6 +57,13 @@ Partial Class Bancos_DepositosCaja divFolio.Visible = True End If + DdlCajaChicaRetorno.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros(" CveTipoCuenta = 1", "", {"CveCuenta", "NumCuentaMoneda"}) + DdlCajaChicaRetorno.DataBind() + + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then + DivRowCuenta.Visible = True + End If + DdlSubProyectos.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa) DdlSubProyectos.DataBind() DdlSubProyectos.Items.Insert(0, New ListItem("Todos", "-1")) @@ -148,12 +158,19 @@ Partial Class Bancos_DepositosCaja Dim TotalImporte As Decimal = 0 Dim TotalImportePrePoliza As Decimal Dim Comision As Decimal = TxtComision.Text.ToDecimal - Dim Descuento As Decimal = TxtDescuento.Text.ToDecimal + Dim Descuento As Decimal = TxtDescuento.Text.ToDecimal + Dim CuentaRetorno As Decimal = TxtCuentaRetorno.Text.ToDecimal Dim IVA As Decimal = TxtIVA.Text.ToDecimal Dim ImporteInter As Decimal = TxtComisionIntermediario.Text.ToDecimal Dim MsgError As String = "Ocurrió un error al realizar los depositos" + If DdlCuentaDeposito.SelectedValue.ToEntero <= 0 Then + Alert("No se ha especificado la cuenta a depositar.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + For Each Gvr As GridViewRow In GvFacturas.Rows If Gvr.FCCheckBox("ChkFactura").Checked Then TotalImporte += Gvr.DataKey("Importe").ToDecimal Next @@ -183,6 +200,15 @@ Partial Class Bancos_DepositosCaja End If End If + If CuentaRetorno <> 0 Then + TotalImporte = TotalImporte - CuentaRetorno + 'Descuento = -(Descuento) ' se inverte el valor, va cargada + 'If DdlSubProyectoDescuento.SelectedValue.ToEntero = -1 Or DdlClasificacionDescuento.SelectedValue.ToEntero = -1 Then + ' Alert("Debes Seleccionar un Subproyecto y una Clasificación de descuento", TipoMensaje.MsgAdvertencia) + ' Exit Sub + 'End If + End If + If TxtComisionIntermediario.Text.ToDecimal <> 0 Then TotalImporte = TotalImporte - TxtComisionIntermediario.Text.ToDecimal - IVA End If @@ -321,6 +347,17 @@ Partial Class Bancos_DepositosCaja Else OcurrioError = True End If + + If Not OcurrioError AndAlso ChkCuentaRetorno.Checked Then + CveTransaccionBanco = 13 + FolioIE = ObjBancos.GetNextFolio(DdlCajaChicaRetorno.SelectedValue.ToEntero, CveTransaccionBanco) + CveIEOrigen = ObjBancos.AddBancos_IE(DdlCajaChicaRetorno.SelectedValue.ToEntero, CveTransaccionBanco, Fecha, FolioIE.ToString, "Retorno Depósito Bancario", CuentaRetorno, CveMoneda, 1, TxtObservaciones.Text, "", False, False, -1, NuevaCvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + + If Not ObjConta.AddPrePolizasDetalle(NuevaCvePrePoliza, False, CuentaRetorno, CuentaRetorno * TipoCambio, 30, "", "Retorno", CveClasificacion:=CveClasificacionDescuento, CveSubProyecto:=CveSubProyecto, CveIE:=CveIEOrigen) Then + OcurrioError = True + End If + End If + If Not OcurrioError Then Dim i As Integer = 0 For Each Gvr As GridViewRow In GvFacturas.Rows @@ -365,7 +402,7 @@ Partial Class Bancos_DepositosCaja Next 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") + documentos += String.Format("Imprimir {1}
", StrEncript, "Depósito Bancario") End If