diff --git a/App_Code/ClsBancos.vb b/App_Code/ClsBancos.vb index be580aea7..77940930c 100644 --- a/App_Code/ClsBancos.vb +++ b/App_Code/ClsBancos.vb @@ -1704,6 +1704,30 @@ Public Class ClsBancos Return Retorno End Function + + Public Function UpdateBancosIECobranza(CveIE As Integer, CveTipoTransaccion As Integer, Folio As String, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_IECobranzaUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@CveTipoTransaccion", SqlDbType.Int).Value = CveTipoTransaccion + .Add("@Folio", SqlDbType.VarChar).Value = Folio + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el tipo cambio del IE.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function GetUsuariosConcilio(CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 26d4b1869..aeb94a329 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -6489,7 +6489,8 @@ Partial Class Compras_Compras If DdlMoneda.SelectedValue.ToEntero <> 1 Then TCO = TxtTC.Text.ToDecimal ImporteCI176 = ObjOC.DtResultados.FiltroPrimeroValor("ImporteCI228").ToDecimal - CostoIndirectoAcum176 += ImporteCI176 + 'CostoIndirectoAcum176 += ImporteCI176 + CostoIndirectoAcum176 += 0 SumatoriaInventario += Importe228 + Importe229 'se considera costoindirecto, para que la factura tiene en un concepto tipo servicio SumatoriaOCINV += (Dr(If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 AndAlso TxtTotal.Text.ToDecimal = 0, "ImporteSinImpuestos", "Total")).ToString.ToDecimal * tipoCambioActual) - (ImporteMN228 + ImporteMN229 - ImporteCI176) diff --git a/Ventas/PVCobranza.aspx b/Ventas/PVCobranza.aspx index cbf9cb318..d6615ce7d 100644 --- a/Ventas/PVCobranza.aspx +++ b/Ventas/PVCobranza.aspx @@ -11,7 +11,7 @@ width: 200px; } - .btn-xs { + .btn-xs { padding: 0px 5px; } @@ -270,232 +270,287 @@ + + -
- - -
- Turno: - -
-
-
-
-
-
- - - - - - - - - -   - - - - - -
-
- -
-
-
-
Nombre:
-
         
- -
Folio:
-
  
- -
-
-
- -
-
-
-
+
+
+ + +
+ Turno: +
-
-
-
+ + +
+
+
+ + + + + + + + + +   + + + + + +
+
+ +
+
+
+
Nombre:
+
         
-
-
-
-
- -
- $ - - -
-
- - - +
Folio:
+
  
+ +
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+ $ + + +
+
+ + + +
-
-
-
- -
- $ - - -
-
- - - -
-
- - MSI - 3M - 6M - 9M - 12M - - <%-- - --%> +
+
+ +
+ $ + + +
+
+ + + +
+
+ + MSI + 3M + 6M + 9M + 12M + + <%-- + --%> +
-
-
-
- -
- $ - - -
-
- - - +
+
+ +
+ $ + + +
+
+ + + +
-
-
-
- -
- $ - - -
-
- - - +
+
+ +
+ $ + + +
+
+ + + +
-
-
-
- -
- $ - - -
-
- - - +
+
+ +
+ $ + + +
+
+ + + +
-
-
-
+
+
-
- - Otros - Credito - Debito - Cheque - -
+
+ + Otros + Credito + Debito + Cheque + +
-
- $ - - -
+
+ $ + + +
-
- - - -
+
+ + + +
-
- - Meses - 3M - 6M - 9M - 12M - -
+
+ + Meses + 3M + 6M + 9M + 12M + +
-
-
- -
-
- -
- $ - - - -
- -
- $ - - -
-
-
- - - + +
+
+ +
+ $ + + + +
+ +
+ $ + + +
+
+
+
+
+ + + +
-
- + +
+
+
+
+ + + + + + Serie - Folio + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + + - +     @@ -668,25 +723,15 @@
+ + + + + + + @@ -875,5 +974,8 @@ $('#C_LblDiferenciaCajaBloqueo').val(FormatoNumero(total)); } + + + diff --git a/Ventas/PVCobranza.aspx.vb b/Ventas/PVCobranza.aspx.vb index fbe4f03c8..9d05b153f 100644 --- a/Ventas/PVCobranza.aspx.vb +++ b/Ventas/PVCobranza.aspx.vb @@ -17,6 +17,8 @@ Partial Class Ventas_PVCobranza End Set End Property + + Private Property DineroCaja As Double Get Return If(IsNothing(ViewState("DineroCaja")), 0, ViewState("DineroCaja").ToString().ToDecimal()) @@ -24,12 +26,51 @@ Partial Class Ventas_PVCobranza Set(value As Double) ViewState("DineroCaja") = value End Set + End Property + + Private Property CveIE As Integer + Get + If ViewState("CveIE") Is Nothing Then + ViewState("CveIE") = -1 + End If + Return ViewState("CveIE").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveIE") = value + End Set + End Property + + Private Property CveTipoTransaccionOriginal As Integer + Get + If ViewState("CveTipoTransaccionOriginal") Is Nothing Then + ViewState("CveTipoTransaccionOriginal") = -1 + End If + Return ViewState("CveTipoTransaccionOriginal").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveTipoTransaccionOriginal") = value + End Set + End Property + + Private Property DtCortesVentas As DataTable + Get + + If ViewState("DtCortesVentas") Is Nothing Then + ViewState("DtCortesVentas") = New DataTable + End If + Return CType(ViewState("DtCortesVentas"), DataTable) + + End Get + Set(value As DataTable) + ViewState("DtCortesVentas") = value + End Set End Property Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then CveCorte = 0 CargaFiltros() + CargaDdlPagos() If UsuarioActual.TienePermisoProceso(371) Then CargaCorteCaja() End If @@ -38,10 +79,6 @@ Partial Class Ventas_PVCobranza Private Sub CargaFiltros() - If UsuarioActual.CveRol <> 1 Then - ChkAplicaGasto.Visible = False - End If - DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1) DdlSubProyecto.DataBind() @@ -66,11 +103,7 @@ Partial Class Ventas_PVCobranza 'If UsuarioActual.Empresa.Funcionalidad(558) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(531) = "1" Then DdlCuentaTarjetaCredito.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1 AND TieneTerminal = 1", CveMon)) DdlCuentaTarjetaDebito.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1 AND TieneTerminal = 1", CveMon)) - DdlCuentaTransferencia.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta <> 1", CveMon)) - - DdlCuentaGasto.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = 1 AND CveTipoCuenta = 1", CveMon)) - DdlCuentaGasto.DataBind() - DdlCuentaGasto.Items.Insert(0, New ListItem("Seleccione", "-1")) + DdlCuentaTransferencia.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta <> 1", CveMon)) DtCC.Dispose() @@ -78,7 +111,7 @@ Partial Class Ventas_PVCobranza DdlCuentaTarjetaCredito.DataBind() DdlCuentaTarjetaDebito.DataBind() DdlCuentaCheque.DataBind() - DdlCuentaTransferencia.DataBind() + DdlCuentaTransferencia.DataBind() TxtImporteEfectivo.Attributes.Add("onKeyUp", "CalculaTotalPagoContado();") TxtImporteCredito.Attributes.Add("onKeyUp", "CalculaTotalPagoContado();") @@ -218,12 +251,25 @@ Partial Class Ventas_PVCobranza TxtImporteOtrosContado.Text = "" TxtCambio.Text = "" - End Sub - - Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click - CargaDatos() - End Sub - + End Sub + + + Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click + + If ChkMostrarSoloPagados.Checked Then + DVCobraza.Visible = False + DVPagado.Visible = True + CargaDatosPagos() + Else + DVCobraza.Visible = True + DVPagado.Visible = False + CargaDatos() + End If + + End Sub + + + Private Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then @@ -589,73 +635,17 @@ Partial Class Ventas_PVCobranza End Sub Private Sub BtnAceptarIE_Click(sender As Object, e As EventArgs) Handles BtnAceptarIE.Click - If TxtCantidadIE.Text.ToEntero() <= 0 Then - Alert("La cantidad debe ser mayor a 0", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - Dim TieneError As Boolean = False Dim ObjPVenta As New ClsPuntoVenta - Dim ObjIE As New ClsBancos(ObjPVenta.IniciaTransacSQL()) - Dim ObjMov As New ClsContabilidad(ObjPVenta.IniciaTransacSQL()) - Try - Dim CveMoneda As Integer = 1 - Dim TipoCambio As Decimal = 1D - - Dim Importe As Decimal = TxtCantidadIE.Text.ToDecimal() - If Not ObjPVenta.AddVta_MovimientosCajas(CveCorte, UsuarioActual.CveUsuario, Importe, TxtDescripcionIE.Text, HdnTipoMovimiento.Value.ToEntero(), NowADS()) Then - TieneError = True + If TxtCantidadIE.Text.ToEntero() > 0 Then + If ObjPVenta.AddVta_MovimientosCajas(CveCorte, UsuarioActual.CveUsuario, TxtCantidadIE.Text.ToDouble, TxtDescripcionIE.Text, HdnTipoMovimiento.Value.ToEntero(), NowADS()) Then + TxtCantidadIE.Text = "" + TxtDescripcionIE.Text = "" + RegistraScript("$('#DivIngresoEgreso').modal('hide')", "divingresoegreso") + Alert("El movimiento se realizó correctamente") + UpIngresoEgreso.Update() End If - If ChkAplicaGasto.Checked Then - - Dim CveTipoTransaccion As Integer = 2 - Dim CvePrePoliza = ObjMov.AddPrePolizas("PVCobranza/Gasto ", 23, Importe, Importe, CveMoneda, Now, "Gasto", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - 'TRANSFERENCIA BANCARIA - Dim EsAbonoEnCuenta As Boolean = False - Dim AplicaImpuestos As Boolean = False - Dim Folio As Long = ObjIE.GetNextFolio(DdlCuentaGasto.SelectedValue.ToEntero, CveTipoTransaccion) - - Dim CveIE = ObjIE.AddBancos_IE(DdlCuentaGasto.SelectedValue.ToEntero, CveTipoTransaccion, Now, Folio.ToString(), "", Importe, CveMoneda, - TipoCambio, TxtDescripcionIE.Text.Trim(), "", EsAbonoEnCuenta, AplicaImpuestos, -1, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCorte:=Me.CveCorte) - - Dim TipoMovimiento As Boolean = True - - Dim Importe30 As Decimal = TxtCantidadIE.Text.ToDecimal - - If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, Importe, Importe30, 30, Folio.ToString(), Folio.ToString(), CveIE:=CveIE) Then - Dim IVA As Decimal = 0 ' TxtImporte.Text.ToDouble * HdnProvPorIVA.Value.ToDouble - 'TEMPORAL - Préstamo Personal/Gasto por Comprobar - If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, Importe, Importe30, 28, Folio.ToString(), Folio.ToString(), CveIE:=CveIE, CvePersonal:=UsuarioActual.CvePersonal) Then - 'If IVA > 0 AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, IVA, TxtImporte.Text.ToDecimal, 19, Ref, Conc, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveOC:=CveOrdenCompra, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteME:=tImporteMonedaExtranjera, CveIEDevolucion:=DDlCheques.SelectedValue.ToEntero) Then - ' TieneError = True - 'End If - Else - TieneError = True - End If - Else - TieneError = True - End If - - End If - Catch ex As Exception - TieneError = True - End Try - - If TieneError Then - ObjPVenta.RollBack() - Else - ObjPVenta.Commit() End If - ObjPVenta.Dispose() - - If Not TieneError Then - TxtCantidadIE.Text = "" - TxtDescripcionIE.Text = "" - RegistraScript("$('#DivIngresoEgreso').modal('hide')", "divingresoegreso") - Alert("El movimiento se realizó correctamente") - UpIngresoEgreso.Update() - End If End Sub Private Sub ImpresionDirectaPDF(CveVenta As Integer) @@ -727,9 +717,105 @@ Partial Class Ventas_PVCobranza End If End Sub - Protected Sub ChkAplicaGasto_CheckedChanged(sender As Object, e As EventArgs) - DivCuentaGasto.Visible = ChkAplicaGasto.Checked - UpIngresoEgreso.Update() + + +#Region "PAGOS" + + Public Sub CargaDatosPagos() + + Dim FechaI As Date = If(txtFechaI.Text <> "", txtFechaI.Text.ToDate, MinFecha) + Dim FechaF As Date = If(txtFechaF.Text <> "", txtFechaF.Text.ToDate, MaxFecha) + + Dim ObjPuntoVenta As New ClsPuntoVenta + + If ObjPuntoVenta.GetCortesDetalleVentas(CveCorte, DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, 2) Then + GvD.DataSource = ObjPuntoVenta.DtResultados + DtCortesVentas = ObjPuntoVenta.DtResultados + End If + + ObjPuntoVenta.Dispose() + + GvD.DataBind() + UpL.Update() End Sub + + Protected Sub GvD_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvD.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + If e.Row.DBCampo("CveVenta").ToString = "" Then + e.Row.CssClass = "Totales" + End If + If e.Row.DBCampo("ImportePagado").ToDecimal() < 0 Then + e.Row.FCLabel("LblTotal").CssClass = "badge badge-danger" + End If + If e.Row.DataKey("CveIE").ToEntero > 0 Then + e.Row.FCLinkButton("LnkEditarPago").Visible = True + End If + End If + End Sub + + + + Sub CargaDdlPagos() + + DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones.FiltraParametros("Tipo='Ing'") + DdlTipoTransaccion.DataBind() + DdlTipoTransaccion.Items.Insert(0, New ListItem("Seleccione Tipo Movimiento", "-1")) + + + DdlCuenta.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa) + DdlCuenta.DataBind() + DdlCuenta.Items.Insert(0, New ListItem("Seleccione", "-1")) + + End Sub + + Protected Sub LnkEditarPago_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + + + CveIE = GvRow.DataKey("CveIE").ToEntero + CveTipoTransaccionOriginal = GvRow.DataKey("CveTipoTransaccion").ToEntero + + Dim CveTipoTransaccion As Integer = GvRow.DataKey("CveTipoTransaccion").ToEntero + Dim CveCuenta As Integer = GvRow.DataKey("CveCuenta").ToEntero + + LblModalPagoTitulo.Text = $"Editar Pago {GvRow.DataKey("SerieFolio")}" + DdlTipoTransaccion.SelectedValueExist(CveTipoTransaccion) + DdlCuenta.SelectedValueExist(CveCuenta) + + UpModalPago.Update() + + RegistraScript("$('#DVModalPagos').modal('show');") + + End Sub + + + Protected Sub LnkDvModalPagoAceptar_Click(sender As Object, e As EventArgs) + + Dim TieneError As Boolean = False + If CveTipoTransaccionOriginal <> DdlTipoTransaccion.SelectedValue.ToEntero Then + + Dim Folio As Long + Dim objBanco As New ClsBancos + Folio = objBanco.GetNextFolio(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero) + + If Not objBanco.UpdateBancosIECobranza(CveIE, DdlTipoTransaccion.SelectedValue.ToEntero, Folio.ToString, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + TieneError = True + End If + + objBanco.Dispose() + + End If + + If Not TieneError Then + CargaDatosPagos() + Alert("Movimiento actualizado correctamente") + RegistraScript("$('#DVModalPagos').modal('hide');") + End If + + End Sub + +#End Region + End Class