diff --git a/Bancos/DepositosCaja.aspx b/Bancos/DepositosCaja.aspx index 05ca350a2..63d270a83 100644 --- a/Bancos/DepositosCaja.aspx +++ b/Bancos/DepositosCaja.aspx @@ -87,11 +87,16 @@ @@ -104,15 +109,16 @@
-
- -
- -
- - -
-
+
+ + +
+
+
+ +
+
+
@@ -124,16 +130,22 @@
-
-
-
- Importe seleccionado: $00.00
+ + +
+
+ + +
+ +
+ Importe seleccionado: $ + 00.00
-
- + @@ -213,7 +225,21 @@ debugger; $('#C_lblValorTotal').text(FormatoNumero(saldo, 2)); debugger; - } + } + + var comision = 0; + + function txtSuma(txt) { + var saldo = ToDouble($('#C_lblValorTotal').text()); + var comision2 = ToDouble($('#C_TxtComision').val()); + comision2 = comision2 - comision + saldo = saldo - comision2; + $('#C_lblValorTotal').text(FormatoNumero(saldo, 2)); + comision = ToDouble($('#C_TxtComision').val()) + + } + + diff --git a/Bancos/DepositosCaja.aspx.vb b/Bancos/DepositosCaja.aspx.vb index d20bfd0df..6d2911286 100644 --- a/Bancos/DepositosCaja.aspx.vb +++ b/Bancos/DepositosCaja.aspx.vb @@ -21,6 +21,8 @@ Partial Class Bancos_DepositosCaja TxtFecha.Text = Now.ToShortDateString txtFechaI.Text = Now.AddDays(-1).ToShortDateString txtFechaF.Text = Now.ToShortDateString + TxtComision.Attributes.Add("onKeyUp", "txtSuma(event);") + CargaCuentas() End If End Sub @@ -35,6 +37,10 @@ Partial Class Bancos_DepositosCaja DdlSubProyectos.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa) DdlSubProyectos.DataBind() DdlSubProyectos.Items.Insert(0, New ListItem("Todos", "-1")) + + DdlClasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) + DdlClasificacion.DataBind() + DdlClasificacion.Items.Insert(0, New ListItem("Todos", "-1")) End Sub Private Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click @@ -56,11 +62,14 @@ Partial Class Bancos_DepositosCaja GvFacturas.DataBind() lblValorTotal.Text = "00.00" divLabelTotal.Visible = True + DivComision.Visible = True End Sub Private Sub BtnDepositar_Click(sender As Object, e As EventArgs) Handles BtnDepositar.Click Dim TotalImporte As Decimal = 0 + Dim TotalImportePrePoliza As Decimal + For Each Gvr As GridViewRow In GvFacturas.Rows If Gvr.FCCheckBox("ChkFactura").Checked Then TotalImporte += Gvr.DataKey("Importe").ToDecimal Next @@ -70,6 +79,14 @@ Partial Class Bancos_DepositosCaja Exit Sub End If + TotalImportePrePoliza = TotalImporte + If TxtComision.Text.ToEntero > 0 Then + TotalImporte = TotalImporte - TxtComision.Text.ToEntero + If DdlSubProyectos.SelectedValue.ToEntero = -1 Or DdlClasificacion.SelectedValue.ToEntero = -1 Then + Alert("Debes Seleccionar un Subproyecto y una Clasificación", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + End If Dim OcurrioError As Boolean = False Dim ObjContabilidad As New ClsContabilidad() @@ -88,7 +105,10 @@ Partial Class Bancos_DepositosCaja Dim CveCuentaBancariaDestino As Integer = 0 Dim drOrigen As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveCuenta:=DdlCajaChica.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero("") Dim drDestino As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveCuenta:=DdlCuentaDeposito.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero("") - + Dim CveSubProyecto As Integer = 0 + Dim CveClasificacion As Integer = 0 + Dim documentos As String = "Los Depósitos se realizaron exitósamente

" + Dim imprimirFolios As String = "" If drOrigen IsNot Nothing Then CveMoneda = drOrigen("CveMoneda").ToString.ToEntero IdCuentaBancariaOrigen = drOrigen("IdCtaContable").ToString.ToEntero @@ -101,7 +121,9 @@ Partial Class Bancos_DepositosCaja CveCuentaBancariaDestino = drDestino("IdCtaContableSIG").ToString.ToEntero End If - NuevaCvePrePoliza = ObjContabilidad.AddPrePolizas("Vta", 13, TotalImporte, TotalImporte, CveMoneda, Fecha, "Depósito Bancario", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + NuevaCvePrePoliza = ObjContabilidad.AddPrePolizas("Vta", 13, TotalImportePrePoliza, TotalImportePrePoliza, CveMoneda, Fecha, "Depósito Bancario", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + + 'Salida de Caja Chica FolioIE = ObjBancos.GetNextFolio(DdlCajaChica.SelectedValue.ToEntero, 2) @@ -110,42 +132,59 @@ Partial Class Bancos_DepositosCaja End If CveIEOrigen = ObjBancos.AddBancos_IE(DdlCajaChica.SelectedValue.ToEntero, 2, Fecha, FolioIE.ToString, "Depósito Bancario", TotalImporte, CveMoneda, 1, "Depósito Bancario", "", False, False, -1, NuevaCvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - - 'Entrada a Bancos - FolioIE = ObjBancos.GetNextFolio(DdlCuentaDeposito.SelectedValue.ToEntero, 8) - If Not FolioIE > 0 Then - OcurrioError = True + If TxtComision.Text.ToEntero > 0 Then + CveSubProyecto = DdlSubProyectos.SelectedValue.ToEntero + CveClasificacion = DdlClasificacion.SelectedValue.ToEntero + If ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, True, TotalImporte, "Depósito Bancario", 30, "Depósito Bancario", Fecha, IdCuentaBancariaOrigen, -1, CveIE:=CveIEOrigen, ImporteMX:=TotalImporte * TipoCambio, CveCuenta:=CveCuentaBancariaOrigen) Then + If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, True, TxtComision.Text.ToEntero, "Comisión", 78, "Depósito Bancario", Fecha, IdCuentaBancariaOrigen, -1, CveClasificacion:=CveClasificacion, CveSubProyecto:=CveSubProyecto, ImporteMX:=TxtComision.Text.ToEntero * TipoCambio, CveCuenta:=CveCuentaBancariaOrigen) Then + OcurrioError = True + End If + Else OcurrioError = True + End If + Else + If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, True, TotalImporte, "Depósito Bancario", 30, "Depósito Bancario", Fecha, IdCuentaBancariaOrigen, -1, CveIE:=CveIEOrigen, ImporteMX:=TotalImporte * TipoCambio, CveCuenta:=CveCuentaBancariaOrigen) Then + OcurrioError = True + End If End If - CveIEDestino = ObjBancos.AddBancos_IE(DdlCuentaDeposito.SelectedValue.ToEntero, 8, Fecha, FolioIE.ToString, "Depósito Bancario", TotalImporte, CveMoneda, 1, "Depósito Bancario", "", False, False, -1, NuevaCvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - 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 Double = Gvr.DataKey("Importe").ToDouble + 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(DdlCuentaDeposito.SelectedValue.ToEntero, 8) + If Not FolioIE > 0 Then + OcurrioError = True + End If + CveIEDestino = ObjBancos.AddBancos_IE(DdlCuentaDeposito.SelectedValue.ToEntero, 8, Fecha, FolioIE.ToString, "Depósito Bancario", Importe, CveMoneda, 1, "Depósito Bancario", "", False, False, -1, NuevaCvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + + + If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, False, Importe.ToDecimal, SerieFolio, 30, "Depósito Bancario", Fecha, IdCuentaBancariaDestino, -1, CveIE:=CveIEDestino, ImporteMX:=Importe.ToDecimal * TipoCambio, CveCuenta:=CveCuentaBancariaDestino) Then + OcurrioError = True + End If + 'Asignamos la cuenta Deposito If Not ObjBancos.UpdateBancos_IECuentaDeposito(CveIEDestino, CveIE) Then OcurrioError = True End If - + Dim StrEncript As String = Encripta($"OP=DC&CveIE={CveIEDestino}&CuentaCaja={DdlCajaChica.SelectedItem.Text}&CuentaDepo={DdlCuentaDeposito.SelectedItem.Text}") + documentos += String.Format("Documento {1}     ", CveIEDestino.ToString, SerieFolio) + documentos += String.Format("Imprimir {1}

", StrEncript, SerieFolio) End If + Next - If ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, True, TotalImporte, "Depósito Bancario", 30, "Depósito Bancario", Fecha, IdCuentaBancariaOrigen, -1, CveIE:=CveIEOrigen, ImporteMX:=TotalImporte * TipoCambio, CveCuenta:=CveCuentaBancariaOrigen) Then - If Not ObjContabilidad.AddPrePolizasDetalle(NuevaCvePrePoliza, False, TotalImporte, "Depósito Bancario", 30, "Depósito Bancario", Fecha, IdCuentaBancariaDestino, -1, CveIE:=CveIEDestino, ImporteMX:=TotalImporte * TipoCambio, CveCuenta:=CveCuentaBancariaDestino) Then - OcurrioError = True - End If - Else OcurrioError = True - End If + If OcurrioError Then ObjContabilidad.RollBack() @@ -153,12 +192,8 @@ Partial Class Bancos_DepositosCaja Else ObjContabilidad.Commit() CargaDatos() - Dim SbMensaje As New StringBuilder() - Dim StrEncript As String = Encripta($"OP=DC&CveIE={CveIEDestino}&CuentaCaja={DdlCajaChica.SelectedItem.Text}&CuentaDepo={DdlCuentaDeposito.SelectedItem.Text}") - SbMensaje.Append("Los Depósitos se realizaron exitósamente

") - SbMensaje.AppendFormat("Documento     ", CveIEDestino) - SbMensaje.AppendFormat("Imprimir ", StrEncript) - Alert(SbMensaje.ToString) + + Alert(documentos.ToString) End If