From 64bc05602cf1be2fd2310185bd03e6cc6c349b68 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 11 Mar 2020 17:26:01 -0700 Subject: [PATCH 1/3] Impuestos locales al aplicar NC --- Ventas/Ventas.aspx.vb | 57 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 11 deletions(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 52b6db6e6..ce903284a 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -9344,7 +9344,7 @@ Partial Class Ventas Dim CveTipoRetencion As Integer = 0 If UsuarioActual.Empresa.Funcionalidad(579) = "1" Then - CveTipoRetencion = DdlTipoRetencion.SelectedValue.ToEntero() + CveTipoRetencion = factura.CveTipoRetencion End If factura.CvePrePoliza = ObjConta.AddPrePolizas("Ventas/GuardarVenta", factura.CvePlantillaPoliza, factura.Total, factura.Total, factura.CveMoneda, factura.Fecha, If(CveEmpresaCRM > 0, LblEmpresaCRM.Text, factura.Cliente.Nombre), factura.CveUsuario, factura.CveEmpresa) @@ -21486,13 +21486,22 @@ Partial Class Ventas End If End If DdlTipoComprobante.SelectedValue = "Egs" + Dim AplicaImpuestosLocales As Boolean = False - AplicarNC(DdlNCPS.SelectedValue.ToEntero, EsNCAmortizacion:=ChkAplicaNCAnticipo.Checked) + Dim ObjCliente As New ClsClientes + If ObjCliente.GetClienteImpuestosLocales(CveCliente) Then + 'se cargan impuestos locales + Dim DtClienteImpuesto As DataTable = ObjCliente.DtResultados.FiltraParametros("Seleccionado = 1", "Orden") + AplicaImpuestosLocales = (DtClienteImpuesto IsNot Nothing AndAlso DtClienteImpuesto.Rows.Count > 0) + End If + ObjCliente.Dispose() + + AplicarNC(DdlNCPS.SelectedValue.ToEntero, EsNCAmortizacion:=ChkAplicaNCAnticipo.Checked, AplicaImpuestosLocales:=AplicaImpuestosLocales) RegistraScript("$('#ModalAplicarNC').modal('hide');", "EscondeModalNC") End Sub - Private Sub AplicarNC(CvePS As Integer, Optional NCDescuento As Boolean = False, Optional EsNCAmortizacion As Boolean = False) + Private Sub AplicarNC(CvePS As Integer, Optional NCDescuento As Boolean = False, Optional EsNCAmortizacion As Boolean = False, Optional AplicaImpuestosLocales As Boolean = True) Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") If DrPS Is Nothing Then Alert("Ocurrió un error al cargar la información del producto. Por favor comuniquese con asistencia SIG", TipoMensaje.MsgError) @@ -21509,6 +21518,12 @@ Partial Class Ventas End If End If + If Not AplicaImpuestosLocales Then + TmpDTImpuestos.Rows.Clear() + GvImpuestosLocales2.DataSource = TmpDTImpuestos + GvImpuestosLocales2.DataBind() + End If + 'CREAMOS DT PARA UTILIZAR AL TIMBRAR InicializaDTVentasNC() @@ -21530,13 +21545,13 @@ Partial Class Ventas If AplicaNCMasiva Then If NCDescuento Then For Each RNC In ListaNCDesc - DtImpuestos.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True), True, MissingSchemaAction.Ignore) + DtImpuestos.Merge(CargaDtImpuestosNC(RNC.CveVenta, RNC.TotalRemNCAplicado, NCDescuento:=True, AplicaImpuestosLocales:=AplicaImpuestosLocales), True, MissingSchemaAction.Ignore) Next Else For Each Gvr As GridViewRow In GvCxC.Rows If Gvr.FCCheckBox("ChkCxC").Checked Then - DtImpuestos.Merge(CargaDtImpuestosNC(Gvr.DataKey("CveVenta").ToString.ToEntero, Gvr.FCTextBox("TxtImporte").Text.ToString.ToDecimal), True, MissingSchemaAction.Ignore) + DtImpuestos.Merge(CargaDtImpuestosNC(Gvr.DataKey("CveVenta").ToString.ToEntero, Gvr.FCTextBox("TxtImporte").Text.ToString.ToDecimal, AplicaImpuestosLocales:=AplicaImpuestosLocales), True, MissingSchemaAction.Ignore) 'CARGA FACTURA A LA CUAL SE APLICA LA NC AcumuladoNC += Gvr.FCTextBox("TxtImporte").Text.ToString.ToDecimal CargaNCDT(Gvr.DataKey("CveVenta").ToString.ToEntero, Gvr.FCTextBox("TxtImporte").Text.ToString.ToDecimal) @@ -21544,7 +21559,7 @@ Partial Class Ventas Next End If Else - DtImpuestos = CargaDtImpuestosNC(CveVenta, TxtNCImporte.Text.Trim.ToDecimal) + DtImpuestos = CargaDtImpuestosNC(CveVenta, TxtNCImporte.Text.Trim.ToDecimal, AplicaImpuestosLocales:=AplicaImpuestosLocales) If EsNCAmortizacion Then If DtAnticipoAmortizacion Is Nothing Then @@ -21646,7 +21661,7 @@ Partial Class Ventas GvPS.DataSource = TmpDT GvPS.DataBind() - CalculaTotalesVenta(True) + CalculaTotalesVenta(RecalculaImpuestosLocales:=AplicaImpuestosLocales) TrTipoRelacion.Visible = True DdlTiposRelacion.SelectedValueExist("1") @@ -21671,14 +21686,21 @@ Partial Class Ventas End Sub - Private Function CargaDtImpuestosNC(CveVentaNC As Integer, Importe As Decimal, Optional NCDescuento As Boolean = False) As DataTable + Private Function CargaDtImpuestosNC(CveVentaNC As Integer, Importe As Decimal, Optional NCDescuento As Boolean = False, Optional AplicaImpuestosLocales As Boolean = True) As DataTable Dim Total As Decimal = 0, SubTotal As Decimal = 0, Saldo As Decimal = 0 Dim TmpDT As DataTable = Nothing + Dim TmpDTImpuestos As DataTable = Nothing Dim ObjVentas As New ClsVentas + If ObjVentas.GetVentaImpuestosLocales(CveVentaNC) Then + If ObjVentas.DtResultados.Rows.Count > 0 Then + TmpDTImpuestos = ObjVentas.DtResultados.Copy() + End If + End If + If ObjVentas.GetVentaDetalle(CveVentaNC) Then - TmpDT = ObjVentas.DtResultados + TmpDT = ObjVentas.DtResultados.Copy() TmpDT.Columns.Add("EntregaDirecta", GetType(Integer)) TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer)) End If @@ -21708,10 +21730,19 @@ Partial Class Ventas Dim Porcentaje As Decimal = ((Importe * 100) / ImporteReferencia) / 100 Dim FiltroStr As String = "" Dim importePuTemp As Decimal = 0 + Dim TotalImpuestosLocales As Decimal = 0 + If TmpDTImpuestos IsNot Nothing AndAlso TmpDTImpuestos.Rows.Count > 0 Then + TotalImpuestosLocales = TmpDTImpuestos.SUM("Importe").ToDecimal() + End If For Each Dr As DataRow In DtImpuestosLocal.Rows FiltroStr = String.Format("ISNULL(PorcentajeIVA,0) = {0} AND ISNULL(PorcentajeRetIVA,0) = {1} AND ISNULL(PorcentajeRetISR,0) = {2} AND ISNULL(PorcentajeIEPS,0) = {3} AND ISNULL(CveSubProyecto,0) = {4} ", Dr("PorcentajeIVA").ToString.ToDecimal, Dr("PorcentajeRetIVA").ToString.ToDecimal, Dr("PorcentajeRetISR").ToString.ToDecimal, Dr("PorcentajeIEPS").ToString.ToDecimal, Dr("CveSubProyecto")) importePuTemp = (Porcentaje * (TmpDT.SUM("TotalImporte", FiltroStr).ToDecimal() - TmpDT.SUM("Descuento", FiltroStr).ToDecimal())) + + If Not AplicaImpuestosLocales Then + importePuTemp = importePuTemp - TotalImpuestosLocales + End If + Dr("ImporteTotal") = importePuTemp.RoundSQL(2) @@ -21728,9 +21759,13 @@ Partial Class Ventas Dr("ImportePU") = importePuTemp.RoundSQL(6) 'Dr("ImporteTotal").ToString.ToDecimal.RoundSQL(2) '(Dr("ImporteTotal").ToString.ToDecimal - Dr("ImporteIVA").ToString.ToDecimal - Dr("ImporteRetIVA").ToString.ToDecimal - Dr("ImporteRetISR").ToString.ToDecimal - Dr("ImporteIEPS").ToString.ToDecimal) Next - + Dim importeNC = (DtImpuestosLocal.SUMD("ImporteTotal") + DtImpuestosLocal.SUMD("ImporteIVA") + DtImpuestosLocal.SUMD("ImporteIEPS") - DtImpuestosLocal.SUMD("ImporteRetIVA") - DtImpuestosLocal.SUMD("ImporteRetISR")) + If AplicaImpuestosLocales Then + Importe = Importe + TotalImpuestosLocales + End If 'codigo para ajuste de centavo, si el importe total no cuadra con los totales - Dim difTmp As Decimal = Importe - (DtImpuestosLocal.SUMD("ImporteTotal") + DtImpuestosLocal.SUMD("ImporteIVA") + DtImpuestosLocal.SUMD("ImporteIEPS") - DtImpuestosLocal.SUMD("ImporteRetIVA") - DtImpuestosLocal.SUMD("ImporteRetISR")) + Dim difTmp As Decimal = Importe - importeNC + If Math.Abs(difTmp) >= 0.01 Then 'asusto la diferencia en el último concepto Dim ImporteAjustado As Decimal = DtImpuestosLocal.Rows(DtImpuestosLocal.Rows.Count - 1)("ImporteTotal").ToString.ToDecimal + difTmp From 1e26906883ea7e05cdeaf5d91951a7416e9dcf00 Mon Sep 17 00:00:00 2001 From: rrene Date: Wed, 11 Mar 2020 17:35:43 -0700 Subject: [PATCH 2/3] -correcciones de inicio, opcion seleccionada --- Ventas/RepIngresos.aspx | 4 ++-- Ventas/RepIngresos.aspx.vb | 2 +- vwd.webinfo | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Ventas/RepIngresos.aspx b/Ventas/RepIngresos.aspx index 460a9e479..53d3073c4 100644 --- a/Ventas/RepIngresos.aspx +++ b/Ventas/RepIngresos.aspx @@ -225,8 +225,8 @@ - - + + <%----%>
diff --git a/Ventas/RepIngresos.aspx.vb b/Ventas/RepIngresos.aspx.vb index 9bb39a6f6..802e23eb1 100644 --- a/Ventas/RepIngresos.aspx.vb +++ b/Ventas/RepIngresos.aspx.vb @@ -94,7 +94,7 @@ Partial Class Ventas_RepIngresos Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load If Not IsPostBack Then TCEspecifico = -1 - TipoCambio = 1 + TipoCambio = 2 CveSubProyecto = -1 TxtFechaInicio.Text = String.Format("01/01/{0}", Now.Year) DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1) diff --git a/vwd.webinfo b/vwd.webinfo index a280964b8..93df9a232 100644 --- a/vwd.webinfo +++ b/vwd.webinfo @@ -21,6 +21,10 @@ + + + + From ab34ae1d4987b001f8e3947d0309763ed8932f4a Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Thu, 12 Mar 2020 10:22:59 -0700 Subject: [PATCH 3/3] Registrar compras automaticamente --- .gitignore | 2 +- Compras/Compras.aspx.vb | 46 ++++++++++++++++++++++++++++++++++++-- Ventas/RepIngresos.aspx | 4 ++-- Ventas/RepIngresos.aspx.vb | 28 +++++++++++------------ vwd.webinfo | 2 ++ 5 files changed, 63 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index a7b361013..9b5134ac3 100644 --- a/.gitignore +++ b/.gitignore @@ -14,7 +14,7 @@ LogTimbrado.txt *.user *.userosscache *.sln.docstates - +vwd.webinfo # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index c8104569b..12fc56201 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -1621,11 +1621,21 @@ Partial Class Compras_Compras ' 'End If 'End If - 'RegistraScript("ScrollVentanaAddProducto();") End Sub #Region "C A R G A S" + Private Sub CargaRegistarEntradaAlmacenAutomatico() + 'REGISTRA ENTRADA DE ALMACÉN EN AUTOMÁTICO + If UsuarioActual.Empresa.Funcionalidad(585) = "1" Then + GvInv.HeaderRow.FCCheckBox("cbAll").Checked = True + For Each GvRow As GridViewRow In GvInv.Rows + If GvRow.RowType = DataControlRowType.DataRow Then + GvRow.FCCheckBox("cbInv").Checked = True + End If + Next + End If + End Sub Private Sub CargaOrdenCorte() Dim ObjCGame As New ClsCGame() If ObjCGame.GetOrdenCorte(UsuarioActual.CveEmpresa) Then @@ -3847,6 +3857,34 @@ Partial Class Compras_Compras Protected Sub BtnGuardar_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnGuardar.Click '------------------INICIA VALIDACIONES------------------ + 'REGISTRA ENTRADA DE ALMACÉN EN AUTOMÁTICO + If UsuarioActual.Empresa.Funcionalidad(585) = "1" Then + + If Not GvInv.HeaderRow.FCCheckBox("cbAll").Checked Then + Alert("Debe seleccionar aplicar el inventario", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + If GvInv.HeaderRow.FCDropDownList("ddlAlmacen").SelectedValue.ToEntero() <= 0 Then + Alert("Debe seleccionar un almacen para el inventario", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + For Each GvRow As GridViewRow In GvInv.Rows + If GvRow.RowType = DataControlRowType.DataRow Then + If Not GvRow.FCCheckBox("cbInv").Checked Then + Alert("Debe seleccionar todos los productos para el inventario", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + If GvRow.FCDropDownList("ddlEAlmacen").SelectedValue.ToEntero() <= 0 Then + Alert("Debe seleccionar un almacen para todos los productos para el inventario", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + End If + Next + End If + Dim EstatusCredito As Integer = 0 'Credito Multiple If RBLPago.SelectedValue.ToEntero = 4 Then @@ -11170,6 +11208,8 @@ Partial Class Compras_Compras If ChkConsignacion.Checked Then End If + CargaRegistarEntradaAlmacenAutomatico() + UpINV.Update() End Sub @@ -11222,7 +11262,9 @@ Partial Class Compras_Compras If e.Row.DBCampo("AlmacenRegistrado").ToString = "1" Then e.Row.FCCheckBox("cbInv").Checked = True End If - e.Row.FCCheckBox("cbInv").Enabled = False + e.Row.FCCheckBox("cbInv").Enabled = False + Else + End If 'CONSIGNACIONES diff --git a/Ventas/RepIngresos.aspx b/Ventas/RepIngresos.aspx index 460a9e479..59b888063 100644 --- a/Ventas/RepIngresos.aspx +++ b/Ventas/RepIngresos.aspx @@ -225,8 +225,8 @@ - - + + <%----%>
diff --git a/Ventas/RepIngresos.aspx.vb b/Ventas/RepIngresos.aspx.vb index 9bb39a6f6..467609afe 100644 --- a/Ventas/RepIngresos.aspx.vb +++ b/Ventas/RepIngresos.aspx.vb @@ -94,7 +94,7 @@ Partial Class Ventas_RepIngresos Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load If Not IsPostBack Then TCEspecifico = -1 - TipoCambio = 1 + TipoCambio = 2 CveSubProyecto = -1 TxtFechaInicio.Text = String.Format("01/01/{0}", Now.Year) DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1) @@ -107,11 +107,11 @@ Partial Class Ventas_RepIngresos Dim Cves_Subprotectos As String = If(DdlSubProyecto.GetSelectedValuesM = "", "-1", DdlSubProyecto.GetSelectedValuesM) Dim TiposDoc As String = If(DdlTipoDocto.GetSelectedValuesM = "", "-1", DdlTipoDocto.GetSelectedValuesM) - If RblTipoCambio.SelectedValue.ToEntero = 3 And TxtEspecifico.Text <> "" Then - TCEspecifico = TxtEspecifico.Text.ToDecimal - Else - TCEspecifico = -1 - End If + 'If RblTipoCambio.SelectedValue.ToEntero = 3 And TxtEspecifico.Text <> "" Then + ' TCEspecifico = TxtEspecifico.Text.ToDecimal + 'Else + ' TCEspecifico = -1 + 'End If Dim ObjRepI As New ClsVentas() If ObjRepI.RepIngresos(UsuarioActual.CveEmpresa, If(RsFechaI = "-1", MinFecha, RsFechaI.ToDate), If(RsFechaF = "-1", MaxFecha, RsFechaF.ToDate), TiposDoc, Cves_Subprotectos, TipoCambio:=TipoCambio, TCEspecifico:=TCEspecifico) Then @@ -174,20 +174,20 @@ Partial Class Ventas_RepIngresos If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.DBCampo("TipoAmortizacion") = "" Then e.Row.CssClass = "Totales" - ElseIf e.Row.DBCampo("TipoAmortizacion") <> "" AndAlso e.Row.DBCampo("CveConceptoContable") = "-1" Then + ElseIf e.Row.DBCampo("TipoAmortizacion") <> "" AndAlso e.Row.DBCampo("CveConceptoContable") = "" Then e.Row.CssClass = "SubTotales" End If End If End Sub Private Sub RblTipoCambio_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RblTipoCambio.SelectedIndexChanged TipoCambio = RblTipoCambio.SelectedValue.ToEntero - If TipoCambio = 3 Then - LiEspecifico.Visible = True - TCEspecifico = GlobalTipoCambio(Now).ToDecimal - TxtEspecifico.Text = TCEspecifico.ToString - Else - LiEspecifico.Visible = False - End If + 'If TipoCambio = 3 Then + ' LiEspecifico.Visible = True + ' TCEspecifico = GlobalTipoCambio(Now).ToDecimal + ' TxtEspecifico.Text = TCEspecifico.ToString + 'Else + ' LiEspecifico.Visible = False + 'End If UpBodyTipoCambio.Update() End Sub Private Sub BtnTipoCambio_Click(sender As Object, e As EventArgs) Handles BtnTipoCambio.Click diff --git a/vwd.webinfo b/vwd.webinfo index bfda47f43..a280964b8 100644 --- a/vwd.webinfo +++ b/vwd.webinfo @@ -23,6 +23,8 @@ + + \ No newline at end of file